From: support Date: Wed, 16 Nov 2022 11:17:32 +0000 (+0000) Subject: Built motion from commit 4de5e0c9.|2.6.22 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=1ce7e49a0ee32bd3342435863447a735978606f6;p=motion2.git Built motion from commit 4de5e0c9.|2.6.22 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f22cd0e..6c80094 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.21", + "version": "2.6.22", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-15T15:36:35.915Z", + "time": "2022-11-16T11:08:45.001Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index fa44d27..985ba28 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.21", + "version": "2.6.22", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-15T15:36:35.915Z", + "time": "2022-11-16T11:08:45.001Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index efe6876..e40c91e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.21", + "version": "2.6.22", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index 69f22db..2279703 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.21", + "version": "2.6.22", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3c2a054..4687a33 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 _0xc98d=['urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc98d,0xbe));var _0xdc98=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0xc98d[_0x4f35f4];return _0x2e9a70;};'use strict';var Sequelize=require(_0xdc98('0x0'));module[_0xdc98('0x1')]={'name':{'type':Sequelize[_0xdc98('0x2')],'get':function(_0x4458b9){return this[_0xdc98('0x3')](_0xdc98('0x4'));}},'action':{'type':Sequelize[_0xdc98('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdc98('0x6'),_0xdc98('0x7'),_0xdc98('0x8'),_0xdc98('0x9'),_0xdc98('0xa'),'browser',_0xdc98('0xb'),_0xdc98('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdc98('0xd')},'data1':{'type':Sequelize[_0xdc98('0x5')](0x1000),'comment':_0xdc98('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xdc98('0x5')](0x1000),'comment':_0xdc98('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xdc98('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xdc98('0x11')},'data6':{'type':Sequelize[_0xdc98('0x5')],'comments':_0xdc98('0x12')},'data7':{'type':Sequelize[_0xdc98('0x13')],'comments':_0xdc98('0x14')}}; \ No newline at end of file +var _0x9af2=['integration','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x40fd66,_0x14e0f2){var _0x53e0c1=function(_0x10d1f4){while(--_0x10d1f4){_0x40fd66['push'](_0x40fd66['shift']());}};_0x53e0c1(++_0x14e0f2);}(_0x9af2,0x1c2));var _0x29af=function(_0x4b928b,_0x495842){_0x4b928b=_0x4b928b-0x0;var _0x207219=_0x9af2[_0x4b928b];return _0x207219;};'use strict';var Sequelize=require(_0x29af('0x0'));module[_0x29af('0x1')]={'name':{'type':Sequelize[_0x29af('0x2')],'get':function(_0x31f6fd){return this[_0x29af('0x3')](_0x29af('0x4'));}},'action':{'type':Sequelize[_0x29af('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x29af('0x6'),'motionbar','jscripty',_0x29af('0x7'),'browser',_0x29af('0x8'),'script']],'msg':_0x29af('0x9')}},'comment':_0x29af('0x9')},'data1':{'type':Sequelize[_0x29af('0x5')](0x1000),'comment':_0x29af('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x29af('0x5')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x29af('0x5')](0x1000),'comments':_0x29af('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x29af('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 8b74a77..58e6dcb 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 _0xefd0=['util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','update','body','Action','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0xefd0,0x1e9));var _0x0efd=function(_0xc91f7d,_0x334ff1){_0xc91f7d=_0xc91f7d-0x0;var _0x742f34=_0xefd0[_0xc91f7d];return _0x742f34;};'use strict';var emlformat=require(_0x0efd('0x0'));var rimraf=require(_0x0efd('0x1'));var zipdir=require(_0x0efd('0x2'));var jsonpatch=require(_0x0efd('0x3'));var rp=require(_0x0efd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0efd('0x5'));var util=require(_0x0efd('0x6'));var path=require(_0x0efd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0efd('0x8'));var fs=require('fs');var fs_extra=require(_0x0efd('0x9'));var _=require('lodash');var squel=require(_0x0efd('0xa'));var crypto=require(_0x0efd('0xb'));var jsforce=require(_0x0efd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0efd('0xd'));var Papa=require(_0x0efd('0xe'));var Redis=require(_0x0efd('0xf'));var authService=require(_0x0efd('0x10'));var qs=require(_0x0efd('0x11'));var as=require(_0x0efd('0x12'));var hardwareService=require(_0x0efd('0x13'));var logger=require('../../config/logger')(_0x0efd('0x14'));var utils=require('../../config/utils');var config=require(_0x0efd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0efd('0x16'))['db'];function respondWithStatusCode(_0x40d20d,_0x4e2284){_0x4e2284=_0x4e2284||0xcc;return function(_0x1cc0ea){if(_0x1cc0ea){return _0x40d20d[_0x0efd('0x17')](_0x4e2284);}return _0x40d20d[_0x0efd('0x18')](_0x4e2284)[_0x0efd('0x19')]();};}function respondWithResult(_0x191ef7,_0x2d8501){_0x2d8501=_0x2d8501||0xc8;return function(_0x59751){if(_0x59751){return _0x191ef7[_0x0efd('0x18')](_0x2d8501)[_0x0efd('0x1a')](_0x59751);}};}function respondWithFilteredResult(_0xea364d,_0xcb76d7){return function(_0x570917){if(_0x570917){var _0x117c0f=typeof _0xcb76d7[_0x0efd('0x1b')]===_0x0efd('0x1c')&&typeof _0xcb76d7[_0x0efd('0x1d')]==='undefined';var _0x1e301e=_0x570917[_0x0efd('0x1e')];var _0x2655fe=_0x117c0f?0x0:_0xcb76d7[_0x0efd('0x1b')];var _0x49a8cb=_0x117c0f?_0x570917[_0x0efd('0x1e')]:_0xcb76d7[_0x0efd('0x1b')]+_0xcb76d7[_0x0efd('0x1d')];var _0x1c88cf;if(_0x49a8cb>=_0x1e301e){_0x49a8cb=_0x1e301e;_0x1c88cf=0xc8;}else{_0x1c88cf=0xce;}_0xea364d[_0x0efd('0x18')](_0x1c88cf);return _0xea364d[_0x0efd('0x1f')](_0x0efd('0x20'),_0x2655fe+'-'+_0x49a8cb+'/'+_0x1e301e)[_0x0efd('0x1a')](_0x570917);}return null;};}function patchUpdates(_0x254c59){return function(_0x383312){try{jsonpatch[_0x0efd('0x21')](_0x383312,_0x254c59,!![]);}catch(_0x4b0f18){return BPromise['reject'](_0x4b0f18);}return _0x383312[_0x0efd('0x22')]();};}function saveUpdates(_0x3aefe7,_0x1220e5){return function(_0x439ced){if(_0x439ced){return _0x439ced['update'](_0x3aefe7)[_0x0efd('0x23')](function(_0x5cb9b4){return _0x5cb9b4;});}return null;};}function removeEntity(_0x117690,_0x1cca54){return function(_0x303f16){if(_0x303f16){return _0x303f16[_0x0efd('0x24')]()[_0x0efd('0x23')](function(){_0x117690['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6de9,_0x3201ad){return function(_0x539c00){if(!_0x539c00){_0x4a6de9['sendStatus'](0x194);}return _0x539c00;};}function handleError(_0x48cd7e,_0x32114b){_0x32114b=_0x32114b||0x1f4;return function(_0x2b1dbc){logger['error'](_0x2b1dbc[_0x0efd('0x25')]);if(_0x2b1dbc[_0x0efd('0x26')]){delete _0x2b1dbc['name'];}_0x48cd7e[_0x0efd('0x18')](_0x32114b)[_0x0efd('0x27')](_0x2b1dbc);};}exports[_0x0efd('0x28')]=function(_0x1c5397,_0x2f6b24){if(_0x1c5397[_0x0efd('0x29')]['id']){delete _0x1c5397['body']['id'];}return db[_0x0efd('0x2a')][_0x0efd('0x2b')]({'where':{'id':_0x1c5397['params']['id']}})['then'](handleEntityNotFound(_0x2f6b24,null))[_0x0efd('0x23')](saveUpdates(_0x1c5397[_0x0efd('0x29')],null))[_0x0efd('0x23')](respondWithResult(_0x2f6b24,null))[_0x0efd('0x2c')](handleError(_0x2f6b24,null));};exports[_0x0efd('0x24')]=function(_0x2ff977,_0x2c11db){return db['Action'][_0x0efd('0x2b')]({'where':{'id':_0x2ff977['params']['id']}})[_0x0efd('0x23')](handleEntityNotFound(_0x2c11db,null))[_0x0efd('0x23')](removeEntity(_0x2c11db,null))[_0x0efd('0x2c')](handleError(_0x2c11db,null));}; \ No newline at end of file +var _0x63da=['Action','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','body','find','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63da,0xba));var _0xa63d=function(_0x8b885,_0x31740b){_0x8b885=_0x8b885-0x0;var _0x122eb8=_0x63da[_0x8b885];return _0x122eb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa63d('0x0'));var zipdir=require(_0xa63d('0x1'));var jsonpatch=require(_0xa63d('0x2'));var rp=require('request-promise');var moment=require(_0xa63d('0x3'));var BPromise=require(_0xa63d('0x4'));var Mustache=require('mustache');var util=require(_0xa63d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa63d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa63d('0x7'));var squel=require(_0xa63d('0x8'));var crypto=require(_0xa63d('0x9'));var jsforce=require(_0xa63d('0xa'));var deskjs=require(_0xa63d('0xb'));var toCsv=require(_0xa63d('0x6'));var querystring=require(_0xa63d('0xc'));var Papa=require(_0xa63d('0xd'));var Redis=require(_0xa63d('0xe'));var authService=require(_0xa63d('0xf'));var qs=require(_0xa63d('0x10'));var as=require(_0xa63d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa63d('0x12'))(_0xa63d('0x13'));var utils=require(_0xa63d('0x14'));var config=require(_0xa63d('0x15'));var licenseUtil=require(_0xa63d('0x16'));var db=require(_0xa63d('0x17'))['db'];function respondWithStatusCode(_0x2a407a,_0x50309b){_0x50309b=_0x50309b||0xcc;return function(_0x5d02ae){if(_0x5d02ae){return _0x2a407a[_0xa63d('0x18')](_0x50309b);}return _0x2a407a[_0xa63d('0x19')](_0x50309b)[_0xa63d('0x1a')]();};}function respondWithResult(_0x698848,_0xa2f5d){_0xa2f5d=_0xa2f5d||0xc8;return function(_0x2289aa){if(_0x2289aa){return _0x698848[_0xa63d('0x19')](_0xa2f5d)[_0xa63d('0x1b')](_0x2289aa);}};}function respondWithFilteredResult(_0x38f8e4,_0x50fa44){return function(_0x3ac1fb){if(_0x3ac1fb){var _0xf24ce9=typeof _0x50fa44['offset']===_0xa63d('0x1c')&&typeof _0x50fa44[_0xa63d('0x1d')]===_0xa63d('0x1c');var _0x225c92=_0x3ac1fb[_0xa63d('0x1e')];var _0x2a40d0=_0xf24ce9?0x0:_0x50fa44['offset'];var _0x44f5a6=_0xf24ce9?_0x3ac1fb[_0xa63d('0x1e')]:_0x50fa44['offset']+_0x50fa44[_0xa63d('0x1d')];var _0x57dbc8;if(_0x44f5a6>=_0x225c92){_0x44f5a6=_0x225c92;_0x57dbc8=0xc8;}else{_0x57dbc8=0xce;}_0x38f8e4[_0xa63d('0x19')](_0x57dbc8);return _0x38f8e4[_0xa63d('0x1f')]('Content-Range',_0x2a40d0+'-'+_0x44f5a6+'/'+_0x225c92)[_0xa63d('0x1b')](_0x3ac1fb);}return null;};}function patchUpdates(_0x38c50b){return function(_0x383c66){try{jsonpatch['apply'](_0x383c66,_0x38c50b,!![]);}catch(_0x1e76dd){return BPromise[_0xa63d('0x20')](_0x1e76dd);}return _0x383c66[_0xa63d('0x21')]();};}function saveUpdates(_0x523c3d,_0x4781fa){return function(_0x2cc7ec){if(_0x2cc7ec){return _0x2cc7ec[_0xa63d('0x22')](_0x523c3d)[_0xa63d('0x23')](function(_0x39a977){return _0x39a977;});}return null;};}function removeEntity(_0x2f6809,_0x69f9e7){return function(_0x386ca8){if(_0x386ca8){return _0x386ca8[_0xa63d('0x24')]()[_0xa63d('0x23')](function(){_0x2f6809[_0xa63d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ebc2f,_0x3f62d9){return function(_0x141906){if(!_0x141906){_0x7ebc2f['sendStatus'](0x194);}return _0x141906;};}function handleError(_0x3ca914,_0x28e092){_0x28e092=_0x28e092||0x1f4;return function(_0xdb4255){logger[_0xa63d('0x25')](_0xdb4255[_0xa63d('0x26')]);if(_0xdb4255[_0xa63d('0x27')]){delete _0xdb4255[_0xa63d('0x27')];}_0x3ca914[_0xa63d('0x19')](_0x28e092)[_0xa63d('0x28')](_0xdb4255);};}exports['update']=function(_0x5b22d9,_0x33cb2c){if(_0x5b22d9[_0xa63d('0x29')]['id']){delete _0x5b22d9[_0xa63d('0x29')]['id'];}return db['Action'][_0xa63d('0x2a')]({'where':{'id':_0x5b22d9['params']['id']}})[_0xa63d('0x23')](handleEntityNotFound(_0x33cb2c,null))[_0xa63d('0x23')](saveUpdates(_0x5b22d9[_0xa63d('0x29')],null))[_0xa63d('0x23')](respondWithResult(_0x33cb2c,null))[_0xa63d('0x2b')](handleError(_0x33cb2c,null));};exports[_0xa63d('0x24')]=function(_0x108e92,_0x1b4cbb){return db[_0xa63d('0x2c')][_0xa63d('0x2a')]({'where':{'id':_0x108e92[_0xa63d('0x2d')]['id']}})[_0xa63d('0x23')](handleEntityNotFound(_0x1b4cbb,null))[_0xa63d('0x23')](removeEntity(_0x1b4cbb,null))[_0xa63d('0x2b')](handleError(_0x1b4cbb,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9943e7f..4b8ac6d 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 _0x28cc=['rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xc2e269,_0x297324){var _0x427447=function(_0xca59dc){while(--_0xca59dc){_0xc2e269['push'](_0xc2e269['shift']());}};_0x427447(++_0x297324);}(_0x28cc,0x180));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc28c('0x0'));var util=require(_0xc28c('0x1'));var logger=require(_0xc28c('0x2'))(_0xc28c('0x3'));var moment=require(_0xc28c('0x4'));var BPromise=require(_0xc28c('0x5'));var rp=require(_0xc28c('0x6'));var fs=require('fs');var path=require(_0xc28c('0x7'));var rimraf=require(_0xc28c('0x8'));var config=require(_0xc28c('0x9'));var attributes=require(_0xc28c('0xa'));module[_0xc28c('0xb')]=function(_0xba2032,_0x227a35){return _0xba2032['define'](_0xc28c('0xc'),attributes,{'tableName':_0xc28c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb368=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Action','lodash','util','../../config/logger','api'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xb368,0x68));var _0x8b36=function(_0xa1ffb0,_0x501e4a){_0xa1ffb0=_0xa1ffb0-0x0;var _0x3372e7=_0xb368[_0xa1ffb0];return _0x3372e7;};'use strict';var _=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var logger=require(_0x8b36('0x2'))(_0x8b36('0x3'));var moment=require(_0x8b36('0x4'));var BPromise=require(_0x8b36('0x5'));var rp=require(_0x8b36('0x6'));var fs=require('fs');var path=require(_0x8b36('0x7'));var rimraf=require(_0x8b36('0x8'));var config=require(_0x8b36('0x9'));var attributes=require('./action.attributes');module[_0x8b36('0xa')]=function(_0x2ce0fc,_0x48a8a4){return _0x2ce0fc['define'](_0x8b36('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e3ae303..fe4e0e8 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2e28dd,_0x1a66e9){var _0x1aa4cc=function(_0x872dc6){while(--_0x872dc6){_0x2e28dd['push'](_0x2e28dd['shift']());}};_0x1aa4cc(++_0x1a66e9);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x340c09,_0xc08941){_0x340c09=_0x340c09-0x0;var _0x1cc1b6=_0x7fbe[_0x340c09];return _0x1cc1b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x326f=['info','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12b253,_0x2153bc){var _0xd04dac=function(_0x20b8a8){while(--_0x20b8a8){_0x12b253['push'](_0x12b253['shift']());}};_0xd04dac(++_0x2153bc);}(_0x326f,0xd1));var _0xf326=function(_0x16cb6c,_0x5fb2cc){_0x16cb6c=_0x16cb6c-0x0;var _0x1f8a57=_0x326f[_0x16cb6c];return _0x1f8a57;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index bdcfcce..7356027 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 _0xfafa=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','path'];(function(_0x45082d,_0x15223d){var _0x706d81=function(_0x289274){while(--_0x289274){_0x45082d['push'](_0x45082d['shift']());}};_0x706d81(++_0x15223d);}(_0xfafa,0xde));var _0xafaf=function(_0x57b8d0,_0x33d4f5){_0x57b8d0=_0x57b8d0-0x0;var _0x138517=_0xfafa[_0x57b8d0];return _0x138517;};'use strict';var multer=require('multer');var util=require(_0xafaf('0x0'));var path=require(_0xafaf('0x1'));var timeout=require(_0xafaf('0x2'));var express=require(_0xafaf('0x3'));var router=express[_0xafaf('0x4')]();var fs_extra=require(_0xafaf('0x5'));var auth=require(_0xafaf('0x6'));var interaction=require(_0xafaf('0x7'));var config=require(_0xafaf('0x8'));var controller=require(_0xafaf('0x9'));router['put'](_0xafaf('0xa'),auth[_0xafaf('0xb')](),controller[_0xafaf('0xc')]);router[_0xafaf('0xd')]('/:id',auth[_0xafaf('0xb')](),controller[_0xafaf('0xe')]);module[_0xafaf('0xf')]=router; \ No newline at end of file +var _0xedc5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','multer','util','express','Router'];(function(_0x3035a5,_0x6a1b0b){var _0x396e01=function(_0x505f0d){while(--_0x505f0d){_0x3035a5['push'](_0x3035a5['shift']());}};_0x396e01(++_0x6a1b0b);}(_0xedc5,0x1dd));var _0x5edc=function(_0xcdf809,_0x2881f0){_0xcdf809=_0xcdf809-0x0;var _0x4d4d70=_0xedc5[_0xcdf809];return _0x4d4d70;};'use strict';var multer=require(_0x5edc('0x0'));var util=require(_0x5edc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5edc('0x2'));var router=express[_0x5edc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5edc('0x4'));var interaction=require(_0x5edc('0x5'));var config=require(_0x5edc('0x6'));var controller=require(_0x5edc('0x7'));router['put']('/:id',auth[_0x5edc('0x8')](),controller[_0x5edc('0x9')]);router[_0x5edc('0xa')](_0x5edc('0xb'),auth[_0x5edc('0x8')](),controller[_0x5edc('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index dc31d81..2c2ce2d 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 _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x55e007,_0x19be52){var _0x3c7531=function(_0x367a69){while(--_0x367a69){_0x55e007['push'](_0x55e007['shift']());}};_0x3c7531(++_0x19be52);}(_0x2bd8,0x130));var _0x82bd=function(_0x542239,_0x4f5659){_0x542239=_0x542239-0x0;var _0x10849e=_0x2bd8[_0x542239];return _0x10849e;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x195c91,_0x26f6ba){var _0x30e2e0=function(_0x1b3017){while(--_0x1b3017){_0x195c91['push'](_0x195c91['shift']());}};_0x30e2e0(++_0x26f6ba);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3a8be0e..03efcb7 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 _0xa491=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','type','VIRTUAL','merge','count','rows','catch','show','params','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','body','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','AVG(%s)','IS\x20NOT\x20NULL','operator','Sequelize','AnalyticMetric','keyBy','from','order','DESC','clone','output','web','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','run','runReport','DATE(%s)','eml-format','rimraf','zip-dir','moment','bluebird','util','ejs'];(function(_0x427fff,_0x20ea23){var _0x5ede74=function(_0x8c771){while(--_0x8c771){_0x427fff['push'](_0x427fff['shift']());}};_0x5ede74(++_0x20ea23);}(_0xa491,0x14d));var _0x1a49=function(_0x2901cf,_0xb570cc){_0x2901cf=_0x2901cf-0x0;var _0x47ee3f=_0xa491[_0x2901cf];return _0x47ee3f;};'use strict';var emlformat=require(_0x1a49('0x0'));var rimraf=require(_0x1a49('0x1'));var zipdir=require(_0x1a49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a49('0x3'));var BPromise=require(_0x1a49('0x4'));var Mustache=require('mustache');var util=require(_0x1a49('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1a49('0x6'));var fs=require('fs');var fs_extra=require(_0x1a49('0x7'));var _=require(_0x1a49('0x8'));var squel=require(_0x1a49('0x9'));var crypto=require(_0x1a49('0xa'));var jsforce=require(_0x1a49('0xb'));var deskjs=require(_0x1a49('0xc'));var toCsv=require(_0x1a49('0xd'));var querystring=require(_0x1a49('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a49('0xf'));var authService=require(_0x1a49('0x10'));var qs=require(_0x1a49('0x11'));var as=require(_0x1a49('0x12'));var hardwareService=require(_0x1a49('0x13'));var logger=require(_0x1a49('0x14'))(_0x1a49('0x15'));var utils=require('../../config/utils');var config=require(_0x1a49('0x16'));var licenseUtil=require(_0x1a49('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1a49('0x18'))[_0x1a49('0x19')];function respondWithStatusCode(_0x3c247d,_0x1464ee){_0x1464ee=_0x1464ee||0xcc;return function(_0x20d6e7){if(_0x20d6e7){return _0x3c247d[_0x1a49('0x1a')](_0x1464ee);}return _0x3c247d['status'](_0x1464ee)[_0x1a49('0x1b')]();};}function respondWithResult(_0x2370a1,_0x100ee3){_0x100ee3=_0x100ee3||0xc8;return function(_0x19b88a){if(_0x19b88a){return _0x2370a1['status'](_0x100ee3)[_0x1a49('0x1c')](_0x19b88a);}};}function respondWithFilteredResult(_0x4127e1,_0xa1dfe7){return function(_0x1473c1){if(_0x1473c1){var _0x16f579=typeof _0xa1dfe7[_0x1a49('0x1d')]===_0x1a49('0x1e')&&typeof _0xa1dfe7['limit']==='undefined';var _0x25e2c5=_0x1473c1['count'];var _0x9b91f3=_0x16f579?0x0:_0xa1dfe7[_0x1a49('0x1d')];var _0x1205e1=_0x16f579?_0x1473c1['count']:_0xa1dfe7[_0x1a49('0x1d')]+_0xa1dfe7[_0x1a49('0x1f')];var _0x3e2786;if(_0x1205e1>=_0x25e2c5){_0x1205e1=_0x25e2c5;_0x3e2786=0xc8;}else{_0x3e2786=0xce;}_0x4127e1[_0x1a49('0x20')](_0x3e2786);return _0x4127e1[_0x1a49('0x21')](_0x1a49('0x22'),_0x9b91f3+'-'+_0x1205e1+'/'+_0x25e2c5)[_0x1a49('0x1c')](_0x1473c1);}return null;};}function patchUpdates(_0x58ebe5){return function(_0x20a42e){try{jsonpatch[_0x1a49('0x23')](_0x20a42e,_0x58ebe5,!![]);}catch(_0x2d6e6b){return BPromise[_0x1a49('0x24')](_0x2d6e6b);}return _0x20a42e[_0x1a49('0x25')]();};}function saveUpdates(_0x475322,_0x491df2){return function(_0x4e242a){if(_0x4e242a){return _0x4e242a[_0x1a49('0x26')](_0x475322)['then'](function(_0x2d626b){return _0x2d626b;});}return null;};}function removeEntity(_0x114606,_0x10dd38){return function(_0x10d789){if(_0x10d789){return _0x10d789[_0x1a49('0x27')]()[_0x1a49('0x28')](function(){var _0x2225a5=_0x10d789[_0x1a49('0x29')]({'plain':!![]});var _0xaaa13d=_0x1a49('0x2a');return db[_0x1a49('0x2b')][_0x1a49('0x27')]({'where':{'type':_0xaaa13d,'resourceId':_0x2225a5['id']}})['then'](function(){return _0x10d789;});})[_0x1a49('0x28')](function(){_0x114606['status'](0xcc)[_0x1a49('0x1b')]();});}};}function handleEntityNotFound(_0x41751f,_0xefc8e2){return function(_0x518baa){if(!_0x518baa){_0x41751f[_0x1a49('0x1a')](0x194);}return _0x518baa;};}function handleError(_0x366b0c,_0x31acb3){_0x31acb3=_0x31acb3||0x1f4;return function(_0x520900){logger['error'](_0x520900[_0x1a49('0x2c')]);if(_0x520900[_0x1a49('0x2d')]){delete _0x520900[_0x1a49('0x2d')];}_0x366b0c[_0x1a49('0x20')](_0x31acb3)[_0x1a49('0x2e')](_0x520900);};}exports[_0x1a49('0x2f')]=function(_0xfdfde4,_0x3b4ab6){var _0x302c4f={},_0x37c328={},_0x54934e={'count':0x0,'rows':[]};var _0x877c9b=_['map'](db[_0x1a49('0x30')][_0x1a49('0x31')],function(_0x454906){return{'name':_0x454906[_0x1a49('0x32')],'type':_0x454906['type'][_0x1a49('0x33')]};});_0x37c328[_0x1a49('0x34')]=_['map'](_0x877c9b,_0x1a49('0x2d'));_0x37c328[_0x1a49('0x35')]=_[_0x1a49('0x36')](_0xfdfde4[_0x1a49('0x35')]);_0x37c328[_0x1a49('0x37')]=_[_0x1a49('0x38')](_0x37c328['model'],_0x37c328[_0x1a49('0x35')]);_0x302c4f[_0x1a49('0x39')]=_['intersection'](_0x37c328[_0x1a49('0x34')],qs[_0x1a49('0x3a')](_0xfdfde4['query'][_0x1a49('0x3a')]));_0x302c4f[_0x1a49('0x39')]=_0x302c4f[_0x1a49('0x39')][_0x1a49('0x3b')]?_0x302c4f[_0x1a49('0x39')]:_0x37c328[_0x1a49('0x34')];if(!_0xfdfde4[_0x1a49('0x35')][_0x1a49('0x3c')]('nolimit')){_0x302c4f[_0x1a49('0x1f')]=qs['limit'](_0xfdfde4[_0x1a49('0x35')][_0x1a49('0x1f')]);_0x302c4f['offset']=qs[_0x1a49('0x1d')](_0xfdfde4[_0x1a49('0x35')]['offset']);}_0x302c4f['order']=qs[_0x1a49('0x3d')](_0xfdfde4['query'][_0x1a49('0x3d')]);_0x302c4f[_0x1a49('0x3e')]=qs[_0x1a49('0x37')](_[_0x1a49('0x3f')](_0xfdfde4[_0x1a49('0x35')],_0x37c328[_0x1a49('0x37')]),_0x877c9b);if(_0xfdfde4[_0x1a49('0x35')][_0x1a49('0x40')]){_0x302c4f[_0x1a49('0x3e')]=_['merge'](_0x302c4f[_0x1a49('0x3e')],{'$or':_[_0x1a49('0x41')](_0x877c9b,function(_0x46c498){if(_0x46c498[_0x1a49('0x42')]!==_0x1a49('0x43')){var _0x507fb7={};_0x507fb7[_0x46c498[_0x1a49('0x2d')]]={'$like':'%'+_0xfdfde4[_0x1a49('0x35')]['filter']+'%'};return _0x507fb7;}})});}_0x302c4f=_[_0x1a49('0x44')]({},_0x302c4f,_0xfdfde4['options']);var _0x145ca9={'where':_0x302c4f[_0x1a49('0x3e')]};return db[_0x1a49('0x30')][_0x1a49('0x45')](_0x145ca9)[_0x1a49('0x28')](function(_0x5484fb){_0x54934e[_0x1a49('0x45')]=_0x5484fb;if(_0xfdfde4['query']['includeAll']){_0x302c4f['include']=[{'all':!![]}];}return db[_0x1a49('0x30')]['findAll'](_0x302c4f);})[_0x1a49('0x28')](function(_0x5f1115){_0x54934e[_0x1a49('0x46')]=_0x5f1115;return _0x54934e;})['then'](respondWithFilteredResult(_0x3b4ab6,_0x302c4f))[_0x1a49('0x47')](handleError(_0x3b4ab6,null));};exports[_0x1a49('0x48')]=function(_0x2e932c,_0x427e2c){var _0x93fdb1={'raw':![],'where':{'id':_0x2e932c[_0x1a49('0x49')]['id']}},_0x1c6f5b={};_0x1c6f5b['model']=_[_0x1a49('0x36')](db['AnalyticCustomReport'][_0x1a49('0x31')]);_0x1c6f5b[_0x1a49('0x35')]=_[_0x1a49('0x36')](_0x2e932c[_0x1a49('0x35')]);_0x1c6f5b[_0x1a49('0x37')]=_[_0x1a49('0x38')](_0x1c6f5b[_0x1a49('0x34')],_0x1c6f5b[_0x1a49('0x35')]);_0x93fdb1[_0x1a49('0x39')]=_[_0x1a49('0x38')](_0x1c6f5b[_0x1a49('0x34')],qs[_0x1a49('0x3a')](_0x2e932c[_0x1a49('0x35')][_0x1a49('0x3a')]));_0x93fdb1['attributes']=_0x93fdb1[_0x1a49('0x39')][_0x1a49('0x3b')]?_0x93fdb1[_0x1a49('0x39')]:_0x1c6f5b[_0x1a49('0x34')];if(_0x2e932c['query'][_0x1a49('0x4a')]){_0x93fdb1[_0x1a49('0x4b')]=[{'all':!![]}];}_0x93fdb1=_[_0x1a49('0x44')]({},_0x93fdb1,_0x2e932c[_0x1a49('0x4c')]);return db[_0x1a49('0x30')][_0x1a49('0x4d')](_0x93fdb1)[_0x1a49('0x28')](handleEntityNotFound(_0x427e2c,null))[_0x1a49('0x28')](respondWithResult(_0x427e2c,null))[_0x1a49('0x47')](handleError(_0x427e2c,null));};exports[_0x1a49('0x4e')]=function(_0x568159,_0x213ff0){return db['AnalyticCustomReport'][_0x1a49('0x4e')](_0x568159['body'],{})['then'](function(_0x51ea57){var _0xe7422a=_0x568159[_0x1a49('0x4f')][_0x1a49('0x29')]({'plain':!![]});if(!_0xe7422a)throw new Error(_0x1a49('0x50'));if(_0xe7422a[_0x1a49('0x51')]===_0x1a49('0x4f')){var _0x1fb43a=_0x51ea57[_0x1a49('0x29')]({'plain':!![]});var _0x3eddb3=_0x1a49('0x52');return db[_0x1a49('0x53')][_0x1a49('0x4d')]({'where':{'name':_0x3eddb3,'userProfileId':_0xe7422a[_0x1a49('0x54')]},'raw':!![]})[_0x1a49('0x28')](function(_0x3d8a47){if(_0x3d8a47&&_0x3d8a47[_0x1a49('0x55')]===0x0){return db[_0x1a49('0x2b')][_0x1a49('0x4e')]({'name':_0x1fb43a[_0x1a49('0x2d')],'resourceId':_0x1fb43a['id'],'type':_0x1a49('0x2a'),'sectionId':_0x3d8a47['id']},{})[_0x1a49('0x28')](function(){return _0x51ea57;});}else{return _0x51ea57;}})[_0x1a49('0x47')](function(_0x202f34){logger[_0x1a49('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x202f34);throw _0x202f34;});}return _0x51ea57;})[_0x1a49('0x28')](respondWithResult(_0x213ff0,0xc9))[_0x1a49('0x47')](handleError(_0x213ff0,null));};exports[_0x1a49('0x26')]=function(_0x1d06fa,_0x588ae6){if(_0x1d06fa['body']['id']){delete _0x1d06fa['body']['id'];}return db[_0x1a49('0x30')][_0x1a49('0x4d')]({'where':{'id':_0x1d06fa[_0x1a49('0x49')]['id']}})[_0x1a49('0x28')](handleEntityNotFound(_0x588ae6,null))[_0x1a49('0x28')](saveUpdates(_0x1d06fa[_0x1a49('0x57')],null))[_0x1a49('0x28')](respondWithResult(_0x588ae6,null))[_0x1a49('0x47')](handleError(_0x588ae6,null));};exports[_0x1a49('0x27')]=function(_0x45ccbc,_0x2b71c1){return db[_0x1a49('0x30')][_0x1a49('0x4d')]({'where':{'id':_0x45ccbc[_0x1a49('0x49')]['id']}})[_0x1a49('0x28')](handleEntityNotFound(_0x2b71c1,null))[_0x1a49('0x28')](removeEntity(_0x2b71c1,null))[_0x1a49('0x47')](handleError(_0x2b71c1,null));};exports['preview']=function(_0x13eca2,_0x3c3ad5){var _0x44ae7c=0xa;var _0x47c8e7=['join','left_join',_0x1a49('0x58'),_0x1a49('0x59')];var _0x4c9318={'SUM':_0x1a49('0x5a'),'COUNT':_0x1a49('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1a49('0x5c'),'MIN':_0x1a49('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1a49('0x5e'),'GROUP_CONCAT ASC':_0x1a49('0x5f'),'GROUP_CONCAT DESC':_0x1a49('0x60')};var _0x4bf43a={'SEC_TO_TIME':_0x1a49('0x61'),'DATE':'DATE(%s)','HOUR':_0x1a49('0x62'),'ROUND':_0x1a49('0x63'),'UNIX_TIMESTAMP':_0x1a49('0x64')};var _0x481d46=function(_0x2734ce){return!_[_0x1a49('0x65')]([_0x1a49('0x66'),'IS\x20NOT\x20NULL',_0x1a49('0x67'),_0x1a49('0x68')],_0x2734ce);};var _0x102c84=function(_0x425483){if(!_0x425483||!_0x425483['rules']['length']){return'';}for(var _0x58117e='(',_0x55795f=0x0;_0x55795f<_0x425483['rules'][_0x1a49('0x3b')];_0x55795f+=0x1){_0x55795f>0x0&&(_0x58117e+='\x20'+_0x425483['operator']+'\x20');_0x58117e+=_0x425483[_0x1a49('0x69')][_0x55795f]['group']?_0x102c84(_0x425483['rules'][_0x55795f]['group']):_0x425483[_0x1a49('0x69')][_0x55795f][_0x1a49('0x6a')]+'\x20'+_0x425483[_0x1a49('0x69')][_0x55795f]['condition']+(_0x481d46(_0x425483[_0x1a49('0x69')][_0x55795f][_0x1a49('0x6b')])?'\x20'+_0x425483[_0x1a49('0x69')][_0x55795f][_0x1a49('0x6c')]:'');}return _0x58117e+')';};var _0x29350d={'where':{'id':_0x13eca2[_0x1a49('0x49')]['id']}},_0x1ef031,_0x41cb0b,_0x45579b,_0x3574c3,_0x1f740d;_0x29350d=_['merge']({},_0x29350d,_0x13eca2[_0x1a49('0x4c')]);return db[_0x1a49('0x30')][_0x1a49('0x4d')](_0x29350d)[_0x1a49('0x28')](function(_0x4df4d1){if(_0x4df4d1){_0x1ef031=_0x4df4d1;return _0x4df4d1[_0x1a49('0x6d')]();}return null;})[_0x1a49('0x28')](function(_0x406af7){if(_0x406af7){if(!_0x406af7['length']){throw new db['Sequelize'][(_0x1a49('0x6e'))](_0x1a49('0x6f'),0x193);}_0x41cb0b=_0x406af7;return db['AnalyticMetric'][_0x1a49('0x70')]({'raw':!![]});}return null;})[_0x1a49('0x28')](function(_0x5b14e9){if(_0x5b14e9){_0x45579b=_['keyBy'](_0x5b14e9,'id');var _0x3c8af6;var _0x5dba5c=squel[_0x1a49('0x71')]();_0x5dba5c['from'](_0x1ef031[_0x1a49('0x72')]);for(var _0x328f78=0x0;_0x328f78<_0x41cb0b['length'];_0x328f78+=0x1){_0x3c8af6=_0x41cb0b[_0x328f78][_0x1a49('0x73')]?_0x45579b[_0x41cb0b[_0x328f78][_0x1a49('0x73')]][_0x1a49('0x74')]:_0x41cb0b[_0x328f78][_0x1a49('0x6a')];_0x3c8af6=_0x41cb0b[_0x328f78][_0x1a49('0x75')]?_[_0x1a49('0x76')](_0x4c9318[_0x41cb0b[_0x328f78][_0x1a49('0x75')]],'%s',_0x3c8af6):_0x3c8af6;_0x3c8af6=_0x41cb0b[_0x328f78][_0x1a49('0x77')]?_[_0x1a49('0x76')](_0x4bf43a[_0x41cb0b[_0x328f78]['format']],'%s',_0x3c8af6):_0x3c8af6;if(_0x41cb0b[_0x328f78][_0x1a49('0x78')]){_0x5dba5c['group'](_0x3c8af6);}_0x41cb0b[_0x328f78]['orderBy']&&_0x5dba5c['order'](_0x3c8af6,_0x41cb0b[_0x328f78][_0x1a49('0x79')]==='DESC'?![]:!![]);_0x5dba5c[_0x1a49('0x6a')](_0x3c8af6,_0x41cb0b[_0x328f78][_0x1a49('0x7a')]||_0x3c8af6);}if(_0x1ef031['joins']){_0x1ef031['joins']=JSON[_0x1a49('0x7b')](_0x1ef031[_0x1a49('0x7c')]);for(var _0x394423=0x0;_0x394423<_0x1ef031['joins'][_0x1a49('0x3b')];_0x394423+=0x1){if(_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x42')]&&_[_0x1a49('0x65')](_0x47c8e7,_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x42')])&&_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7d')]&&_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7e')]&&_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7f')]){_0x5dba5c[_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x42')]](_0x1ef031['joins'][_0x394423][_0x1a49('0x7e')],null,util[_0x1a49('0x77')](_0x1a49('0x80'),_0x1ef031[_0x1a49('0x72')],_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7d')],_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7e')],_0x1ef031[_0x1a49('0x7c')][_0x394423][_0x1a49('0x7f')]));}}}if(_0x1ef031[_0x1a49('0x81')]){_0x1ef031['conditions']=JSON['parse'](_0x1ef031['conditions']);_0x5dba5c[_0x1a49('0x3e')](_0x102c84(_0x1ef031['conditions'][_0x1a49('0x82')]));}_0x1f740d=_0x5dba5c['clone']();_0x5dba5c[_0x1a49('0x1f')](_0x44ae7c);_0x5dba5c[_0x1a49('0x1d')](0x0);logger[_0x1a49('0x83')](_0x1a49('0x84'),_0x5dba5c['toString']());return dbH[_0x1a49('0x85')][_0x1a49('0x35')](_0x5dba5c[_0x1a49('0x86')](),{'type':dbH[_0x1a49('0x85')][_0x1a49('0x87')][_0x1a49('0x88')]});}})[_0x1a49('0x28')](respondWithResult(_0x3c3ad5,null))[_0x1a49('0x47')](handleError(_0x3c3ad5,null));};function runReport(_0x317b70,_0x3e716b,_0x46a4e1){var _0x37844d=_0x3e716b[_0x1a49('0x2d')];var _0x2204d5=0xa;var _0x5e80a4=[_0x1a49('0x89'),_0x1a49('0x8a'),'right_join',_0x1a49('0x59')];var _0x4667ef={'SUM':_0x1a49('0x5a'),'COUNT':_0x1a49('0x5b'),'COUNT DISTINCT':_0x1a49('0x8b'),'MAX':'MAX(%s)','MIN':_0x1a49('0x5d'),'AVG':_0x1a49('0x8c'),'GROUP_CONCAT':_0x1a49('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1a49('0x60')};var _0x349847={'SEC_TO_TIME':_0x1a49('0x61'),'DATE':'DATE(%s)','HOUR':_0x1a49('0x62'),'ROUND':_0x1a49('0x63'),'UNIX_TIMESTAMP':_0x1a49('0x64')};var _0x74b04c=function(_0x3f6be2){return!_[_0x1a49('0x65')]([_0x1a49('0x66'),_0x1a49('0x8d'),_0x1a49('0x67'),_0x1a49('0x68')],_0x3f6be2);};var _0x2c29c9=function(_0x41ae9e){if(!_0x41ae9e||!_0x41ae9e['rules'][_0x1a49('0x3b')]){return'';}for(var _0x4fd60c='(',_0x19c96a=0x0;_0x19c96a<_0x41ae9e[_0x1a49('0x69')][_0x1a49('0x3b')];_0x19c96a+=0x1){_0x19c96a>0x0&&(_0x4fd60c+='\x20'+_0x41ae9e[_0x1a49('0x8e')]+'\x20');_0x4fd60c+=_0x41ae9e['rules'][_0x19c96a]['group']?_0x2c29c9(_0x41ae9e[_0x1a49('0x69')][_0x19c96a][_0x1a49('0x82')]):_0x41ae9e['rules'][_0x19c96a][_0x1a49('0x6a')]+'\x20'+_0x41ae9e['rules'][_0x19c96a][_0x1a49('0x6b')]+(_0x74b04c(_0x41ae9e[_0x1a49('0x69')][_0x19c96a][_0x1a49('0x6b')])?'\x20'+_0x41ae9e[_0x1a49('0x69')][_0x19c96a][_0x1a49('0x6c')]:'');}return _0x4fd60c+')';};var _0x46fc78={'where':{'id':_0x317b70['id']}},_0x27d2e3,_0x5315ac,_0x2ee398,_0x320aee,_0x8ae0e9;_0x46fc78=_[_0x1a49('0x44')]({},_0x46fc78,_0x46a4e1);return db['AnalyticCustomReport'][_0x1a49('0x4d')](_0x46fc78)['then'](function(_0x5cd639){if(_0x5cd639){_0x27d2e3=_0x5cd639;return _0x5cd639[_0x1a49('0x6d')]();}return null;})['then'](function(_0x45e55f){if(_0x45e55f){if(!_0x45e55f['length']){throw new db[(_0x1a49('0x8f'))][(_0x1a49('0x6e'))](_0x1a49('0x6f'),0x193);}_0x5315ac=_0x45e55f;return db[_0x1a49('0x90')][_0x1a49('0x70')]({'raw':!![]});}return null;})[_0x1a49('0x28')](function(_0x15a3a2){if(_0x15a3a2){_0x2ee398=_[_0x1a49('0x91')](_0x15a3a2,'id');var _0x10dfa9;var _0x51bf47=squel[_0x1a49('0x71')]();_0x51bf47[_0x1a49('0x92')](_0x27d2e3[_0x1a49('0x72')]);for(var _0x30559b=0x0;_0x30559b<_0x5315ac[_0x1a49('0x3b')];_0x30559b+=0x1){_0x10dfa9=_0x5315ac[_0x30559b][_0x1a49('0x73')]?_0x2ee398[_0x5315ac[_0x30559b]['MetricId']][_0x1a49('0x74')]:_0x5315ac[_0x30559b]['field'];_0x10dfa9=_0x5315ac[_0x30559b]['function']?_[_0x1a49('0x76')](_0x4667ef[_0x5315ac[_0x30559b]['function']],'%s',_0x10dfa9):_0x10dfa9;_0x10dfa9=_0x5315ac[_0x30559b]['format']?_[_0x1a49('0x76')](_0x349847[_0x5315ac[_0x30559b][_0x1a49('0x77')]],'%s',_0x10dfa9):_0x10dfa9;if(_0x5315ac[_0x30559b][_0x1a49('0x78')]){_0x51bf47[_0x1a49('0x82')](_0x10dfa9);}_0x5315ac[_0x30559b][_0x1a49('0x79')]&&_0x51bf47[_0x1a49('0x93')](_0x10dfa9,_0x5315ac[_0x30559b]['orderBy']===_0x1a49('0x94')?![]:!![]);_0x51bf47['field'](_0x10dfa9,_0x5315ac[_0x30559b][_0x1a49('0x7a')]||_0x10dfa9);}if(_0x27d2e3[_0x1a49('0x7c')]){_0x27d2e3['joins']=JSON[_0x1a49('0x7b')](_0x27d2e3[_0x1a49('0x7c')]);for(var _0x13e06c=0x0;_0x13e06c<_0x27d2e3[_0x1a49('0x7c')]['length'];_0x13e06c+=0x1){if(_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x42')]&&_[_0x1a49('0x65')](_0x5e80a4,_0x27d2e3['joins'][_0x13e06c][_0x1a49('0x42')])&&_0x27d2e3['joins'][_0x13e06c]['parentKey']&&_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x7e')]&&_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x7f')]){_0x51bf47[_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x42')]](_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x7e')],null,util['format'](_0x1a49('0x80'),_0x27d2e3[_0x1a49('0x72')],_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x7d')],_0x27d2e3[_0x1a49('0x7c')][_0x13e06c]['foreignTable'],_0x27d2e3[_0x1a49('0x7c')][_0x13e06c][_0x1a49('0x7f')]));}}}if(_0x27d2e3[_0x1a49('0x81')]){_0x27d2e3['conditions']=JSON['parse'](_0x27d2e3['conditions']);_0x51bf47[_0x1a49('0x3e')](_0x2c29c9(_0x27d2e3['conditions']['group']));}_0x8ae0e9=_0x51bf47[_0x1a49('0x95')]();_0x51bf47['limit'](_0x2204d5);_0x51bf47['offset'](0x0);return;}})['then'](function(){if(_0x3e716b[_0x1a49('0x96')]===_0x1a49('0x97')){return null;}var _0x173d7d=_[_0x1a49('0x44')](_0x3e716b,{'name':_0x3e716b['fullPath']||_0x3e716b[_0x1a49('0x2d')]||_0x27d2e3[_0x1a49('0x2d')],'basename':_0x37844d,'savename':util[_0x1a49('0x77')](_0x1a49('0x98'),_0x3e716b['name']||_0x27d2e3['name'],require(_0x1a49('0x99'))['generate'](0x4),_0x3e716b['output']||_0x1a49('0x9a')),'reportId':_0x27d2e3['id'],'reportType':_0x1a49('0x9b')});return db['AnalyticExtractedReport']['create'](_0x173d7d,{'raw':!![]});})['then'](function(_0x1b0d3e){if(_0x27d2e3['table']===_0x1a49('0x9c')){_0x8ae0e9['where'](_0x27d2e3['table']+_0x1a49('0x9d'),_0x3e716b['startDate'],_0x3e716b['endDate']);}else{_0x8ae0e9[_0x1a49('0x3e')](_0x27d2e3['table']+_0x1a49('0x9e'),_0x3e716b[_0x1a49('0x9f')],_0x3e716b[_0x1a49('0xa0')]);}if(_0x1b0d3e){logger[_0x1a49('0xa1')](_0x1a49('0xa2'),_0x8ae0e9[_0x1a49('0x86')]());require(_0x1a49('0xa3'))['fork'](path[_0x1a49('0x89')](__dirname,'../../components/export/',_0x1b0d3e[_0x1a49('0x96')]),[_0x1b0d3e['id'],_0x8ae0e9['toString'](),path[_0x1a49('0x89')](__dirname,_0x1a49('0xa4'),_0x1b0d3e[_0x1a49('0xa5')]),_0x37844d]);return _0x1b0d3e;}else{var _0xc2e669=squel['select']();_0xc2e669[_0x1a49('0x92')]('('+_0x8ae0e9[_0x1a49('0x86')]()+')','countTable');_0xc2e669['field'](_0x1a49('0xa6'),'count');_0x8ae0e9[_0x1a49('0x1f')](_0x3e716b[_0x1a49('0x1f')]||_0x2204d5);_0x8ae0e9[_0x1a49('0x1d')](_0x3e716b['offset']||0x0);return dbH[_0x1a49('0x85')][_0x1a49('0x35')](_0xc2e669[_0x1a49('0x86')](),{'type':dbH[_0x1a49('0x85')][_0x1a49('0x87')][_0x1a49('0x88')]})['then'](function(_0x4ce09f){if(!_0x4ce09f['length']){_0x320aee=0x0;}else{_0x320aee=_0x4ce09f[0x0][_0x1a49('0x45')]||0x0;}return dbH[_0x1a49('0x85')][_0x1a49('0x35')](_0x8ae0e9[_0x1a49('0x86')](),{'type':dbH[_0x1a49('0x85')][_0x1a49('0x87')][_0x1a49('0x88')]});})['then'](function(_0xf0fc6a){return{'rows':_0xf0fc6a||[],'count':_0x320aee};});}});}exports[_0x1a49('0xa7')]=function(_0x5cf1e3,_0x429bfb){return runReport(_0x5cf1e3[_0x1a49('0x49')],_0x5cf1e3[_0x1a49('0x35')],_0x5cf1e3[_0x1a49('0x4c')])[_0x1a49('0x28')](respondWithResult(_0x429bfb,null))['catch'](handleError(_0x429bfb,null));};exports[_0x1a49('0xa8')]=runReport;exports[_0x1a49('0x35')]=function(_0x1c6ae0,_0x1e41be){var _0x3ca024=0xa;var _0x570d3e=[_0x1a49('0x89'),'left_join','right_join','cross_join'];var _0x12f9b6={'SUM':_0x1a49('0x5a'),'COUNT':_0x1a49('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x1a49('0x5d'),'AVG':_0x1a49('0x8c'),'GROUP_CONCAT':_0x1a49('0x5e'),'GROUP_CONCAT ASC':_0x1a49('0x5f'),'GROUP_CONCAT DESC':_0x1a49('0x60')};var _0x4300a7={'SEC_TO_TIME':_0x1a49('0x61'),'DATE':_0x1a49('0xa9'),'HOUR':'HOUR(%s)','ROUND':_0x1a49('0x63'),'UNIX_TIMESTAMP':_0x1a49('0x64')};var _0x304b03=function(_0x305fa1){return!_['includes']([_0x1a49('0x66'),_0x1a49('0x8d'),_0x1a49('0x67'),'IS\x20NOT\x20EMPTY'],_0x305fa1);};var _0x3ca0bd=function(_0x1c9a67){if(!_0x1c9a67||!_0x1c9a67[_0x1a49('0x69')][_0x1a49('0x3b')]){return'';}for(var _0x34948d='(',_0xa17168=0x0;_0xa17168<_0x1c9a67[_0x1a49('0x69')][_0x1a49('0x3b')];_0xa17168+=0x1){_0xa17168>0x0&&(_0x34948d+='\x20'+_0x1c9a67[_0x1a49('0x8e')]+'\x20');_0x34948d+=_0x1c9a67[_0x1a49('0x69')][_0xa17168][_0x1a49('0x82')]?_0x3ca0bd(_0x1c9a67[_0x1a49('0x69')][_0xa17168]['group']):_0x1c9a67[_0x1a49('0x69')][_0xa17168][_0x1a49('0x6a')]+'\x20'+_0x1c9a67[_0x1a49('0x69')][_0xa17168]['condition']+(_0x304b03(_0x1c9a67[_0x1a49('0x69')][_0xa17168][_0x1a49('0x6b')])?'\x20'+_0x1c9a67[_0x1a49('0x69')][_0xa17168][_0x1a49('0x6c')]:'');}return _0x34948d+')';};var _0x226bd4={'where':{'id':_0x1c6ae0[_0x1a49('0x49')]['id']}},_0x3e8cfb,_0x7fe985,_0x167397,_0x4aeda4,_0x3b5bde;_0x226bd4=_[_0x1a49('0x44')]({},_0x226bd4,_0x1c6ae0[_0x1a49('0x4c')]);return db['AnalyticCustomReport'][_0x1a49('0x4d')](_0x226bd4)['then'](function(_0x481de4){if(_0x481de4){_0x3e8cfb=_0x481de4;return _0x481de4[_0x1a49('0x6d')]();}return null;})[_0x1a49('0x28')](function(_0x1b6efb){if(_0x1b6efb){if(!_0x1b6efb[_0x1a49('0x3b')]){throw new db[(_0x1a49('0x8f'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x7fe985=_0x1b6efb;return db['AnalyticMetric'][_0x1a49('0x70')]({'raw':!![]});}return null;})[_0x1a49('0x28')](function(_0x3c7fc1){if(_0x3c7fc1){_0x167397=_[_0x1a49('0x91')](_0x3c7fc1,'id');var _0x1a075c;var _0x53b425=squel['select']();_0x53b425[_0x1a49('0x92')](_0x3e8cfb['table']);for(var _0x3472e9=0x0;_0x3472e9<_0x7fe985[_0x1a49('0x3b')];_0x3472e9+=0x1){_0x1a075c=_0x7fe985[_0x3472e9][_0x1a49('0x73')]?_0x167397[_0x7fe985[_0x3472e9]['MetricId']][_0x1a49('0x74')]:_0x7fe985[_0x3472e9][_0x1a49('0x6a')];_0x1a075c=_0x7fe985[_0x3472e9]['function']?_[_0x1a49('0x76')](_0x12f9b6[_0x7fe985[_0x3472e9][_0x1a49('0x75')]],'%s',_0x1a075c):_0x1a075c;_0x1a075c=_0x7fe985[_0x3472e9][_0x1a49('0x77')]?_[_0x1a49('0x76')](_0x4300a7[_0x7fe985[_0x3472e9][_0x1a49('0x77')]],'%s',_0x1a075c):_0x1a075c;if(_0x7fe985[_0x3472e9][_0x1a49('0x78')]){_0x53b425[_0x1a49('0x82')](_0x1a075c);}_0x7fe985[_0x3472e9]['orderBy']&&_0x53b425[_0x1a49('0x93')](_0x1a075c,_0x7fe985[_0x3472e9]['orderBy']===_0x1a49('0x94')?![]:!![]);_0x53b425[_0x1a49('0x6a')](_0x1a075c,_0x7fe985[_0x3472e9][_0x1a49('0x7a')]||_0x1a075c);}if(_0x3e8cfb[_0x1a49('0x7c')]){_0x3e8cfb[_0x1a49('0x7c')]=JSON[_0x1a49('0x7b')](_0x3e8cfb[_0x1a49('0x7c')]);for(var _0x15895=0x0;_0x15895<_0x3e8cfb[_0x1a49('0x7c')][_0x1a49('0x3b')];_0x15895+=0x1){if(_0x3e8cfb['joins'][_0x15895][_0x1a49('0x42')]&&_['includes'](_0x570d3e,_0x3e8cfb[_0x1a49('0x7c')][_0x15895][_0x1a49('0x42')])&&_0x3e8cfb[_0x1a49('0x7c')][_0x15895]['parentKey']&&_0x3e8cfb[_0x1a49('0x7c')][_0x15895][_0x1a49('0x7e')]&&_0x3e8cfb['joins'][_0x15895][_0x1a49('0x7f')]){_0x53b425[_0x3e8cfb['joins'][_0x15895][_0x1a49('0x42')]](_0x3e8cfb['joins'][_0x15895][_0x1a49('0x7e')],null,util[_0x1a49('0x77')](_0x1a49('0x80'),_0x3e8cfb[_0x1a49('0x72')],_0x3e8cfb[_0x1a49('0x7c')][_0x15895][_0x1a49('0x7d')],_0x3e8cfb[_0x1a49('0x7c')][_0x15895][_0x1a49('0x7e')],_0x3e8cfb['joins'][_0x15895][_0x1a49('0x7f')]));}}}if(_0x3e8cfb[_0x1a49('0x81')]){_0x3e8cfb[_0x1a49('0x81')]=JSON[_0x1a49('0x7b')](_0x3e8cfb[_0x1a49('0x81')]);_0x53b425[_0x1a49('0x3e')](_0x3ca0bd(_0x3e8cfb[_0x1a49('0x81')][_0x1a49('0x82')]));}_0x3b5bde=_0x53b425[_0x1a49('0x95')]();_0x53b425['limit'](_0x3ca024);_0x53b425[_0x1a49('0x1d')](0x0);logger[_0x1a49('0x83')](_0x1a49('0x84'),_0x53b425[_0x1a49('0x86')]());return dbH[_0x1a49('0x85')][_0x1a49('0x35')](_0x53b425[_0x1a49('0x86')](),{'type':dbH[_0x1a49('0x85')]['QueryTypes'][_0x1a49('0x88')]});}})[_0x1a49('0x28')](function(){return{'sql':_0x3b5bde[_0x1a49('0x86')]()};})['then'](respondWithResult(_0x1e41be,null))[_0x1a49('0x47')](handleError(_0x1e41be,null));}; \ No newline at end of file +var _0x8946=['dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','sequelize','toString','QueryTypes','SELECT','UNIX_TIMESTAMP(%s)','operator','value','Sequelize','ValidationErrorItem','function','clone','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','savename','run','right_join','AnalyticMetric','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x62f666,_0x2279b7){var _0x4827d8=function(_0x406a73){while(--_0x406a73){_0x62f666['push'](_0x62f666['shift']());}};_0x4827d8(++_0x2279b7);}(_0x8946,0x130));var _0x6894=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x8946[_0x2faddb];return _0x273c05;};'use strict';var emlformat=require(_0x6894('0x0'));var rimraf=require(_0x6894('0x1'));var zipdir=require(_0x6894('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6894('0x3'));var moment=require(_0x6894('0x4'));var BPromise=require(_0x6894('0x5'));var Mustache=require(_0x6894('0x6'));var util=require(_0x6894('0x7'));var path=require(_0x6894('0x8'));var sox=require(_0x6894('0x9'));var csv=require(_0x6894('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6894('0xa'));var querystring=require('querystring');var Papa=require(_0x6894('0xb'));var Redis=require(_0x6894('0xc'));var authService=require(_0x6894('0xd'));var qs=require(_0x6894('0xe'));var as=require(_0x6894('0xf'));var hardwareService=require(_0x6894('0x10'));var logger=require(_0x6894('0x11'))(_0x6894('0x12'));var utils=require(_0x6894('0x13'));var config=require(_0x6894('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6894('0x15'))['db'];var dbH=require(_0x6894('0x15'))[_0x6894('0x16')];function respondWithStatusCode(_0x486d81,_0x47eaff){_0x47eaff=_0x47eaff||0xcc;return function(_0x22b531){if(_0x22b531){return _0x486d81[_0x6894('0x17')](_0x47eaff);}return _0x486d81[_0x6894('0x18')](_0x47eaff)[_0x6894('0x19')]();};}function respondWithResult(_0x5be040,_0x1391a3){_0x1391a3=_0x1391a3||0xc8;return function(_0x1d78a9){if(_0x1d78a9){return _0x5be040[_0x6894('0x18')](_0x1391a3)[_0x6894('0x1a')](_0x1d78a9);}};}function respondWithFilteredResult(_0x3aec8f,_0x45b9b7){return function(_0xf8f5ee){if(_0xf8f5ee){var _0x482475=typeof _0x45b9b7[_0x6894('0x1b')]==='undefined'&&typeof _0x45b9b7[_0x6894('0x1c')]===_0x6894('0x1d');var _0x53e9f2=_0xf8f5ee['count'];var _0x1960e6=_0x482475?0x0:_0x45b9b7[_0x6894('0x1b')];var _0x3b1ecf=_0x482475?_0xf8f5ee[_0x6894('0x1e')]:_0x45b9b7[_0x6894('0x1b')]+_0x45b9b7[_0x6894('0x1c')];var _0x242448;if(_0x3b1ecf>=_0x53e9f2){_0x3b1ecf=_0x53e9f2;_0x242448=0xc8;}else{_0x242448=0xce;}_0x3aec8f[_0x6894('0x18')](_0x242448);return _0x3aec8f[_0x6894('0x1f')]('Content-Range',_0x1960e6+'-'+_0x3b1ecf+'/'+_0x53e9f2)[_0x6894('0x1a')](_0xf8f5ee);}return null;};}function patchUpdates(_0x167af9){return function(_0x6be790){try{jsonpatch[_0x6894('0x20')](_0x6be790,_0x167af9,!![]);}catch(_0x199b3f){return BPromise[_0x6894('0x21')](_0x199b3f);}return _0x6be790[_0x6894('0x22')]();};}function saveUpdates(_0x19fd58,_0x258597){return function(_0x4e79ed){if(_0x4e79ed){return _0x4e79ed[_0x6894('0x23')](_0x19fd58)[_0x6894('0x24')](function(_0x4fb52e){return _0x4fb52e;});}return null;};}function removeEntity(_0x1efa03,_0x29179c){return function(_0x38b746){if(_0x38b746){return _0x38b746[_0x6894('0x25')]()[_0x6894('0x24')](function(){var _0x57aa38=_0x38b746[_0x6894('0x26')]({'plain':!![]});var _0x241d46=_0x6894('0x27');return db[_0x6894('0x28')]['destroy']({'where':{'type':_0x241d46,'resourceId':_0x57aa38['id']}})['then'](function(){return _0x38b746;});})[_0x6894('0x24')](function(){_0x1efa03[_0x6894('0x18')](0xcc)[_0x6894('0x19')]();});}};}function handleEntityNotFound(_0x284dc5,_0x3e7acc){return function(_0x48cec2){if(!_0x48cec2){_0x284dc5[_0x6894('0x17')](0x194);}return _0x48cec2;};}function handleError(_0x46141e,_0x3b7716){_0x3b7716=_0x3b7716||0x1f4;return function(_0x4f56cd){logger[_0x6894('0x29')](_0x4f56cd[_0x6894('0x2a')]);if(_0x4f56cd[_0x6894('0x2b')]){delete _0x4f56cd[_0x6894('0x2b')];}_0x46141e[_0x6894('0x18')](_0x3b7716)[_0x6894('0x2c')](_0x4f56cd);};}exports[_0x6894('0x2d')]=function(_0x24c4ed,_0x504a7a){var _0x2ff7b7={},_0x1c8ef9={},_0x2e933d={'count':0x0,'rows':[]};var _0x479bda=_['map'](db['AnalyticCustomReport'][_0x6894('0x2e')],function(_0x26daba){return{'name':_0x26daba[_0x6894('0x2f')],'type':_0x26daba['type'][_0x6894('0x30')]};});_0x1c8ef9[_0x6894('0x31')]=_['map'](_0x479bda,_0x6894('0x2b'));_0x1c8ef9[_0x6894('0x32')]=_['keys'](_0x24c4ed[_0x6894('0x32')]);_0x1c8ef9[_0x6894('0x33')]=_[_0x6894('0x34')](_0x1c8ef9[_0x6894('0x31')],_0x1c8ef9[_0x6894('0x32')]);_0x2ff7b7[_0x6894('0x35')]=_[_0x6894('0x34')](_0x1c8ef9[_0x6894('0x31')],qs['fields'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x36')]));_0x2ff7b7[_0x6894('0x35')]=_0x2ff7b7[_0x6894('0x35')][_0x6894('0x37')]?_0x2ff7b7['attributes']:_0x1c8ef9['model'];if(!_0x24c4ed['query'][_0x6894('0x38')](_0x6894('0x39'))){_0x2ff7b7[_0x6894('0x1c')]=qs['limit'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x1c')]);_0x2ff7b7[_0x6894('0x1b')]=qs['offset'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x1b')]);}_0x2ff7b7['order']=qs['sort'](_0x24c4ed[_0x6894('0x32')][_0x6894('0x3a')]);_0x2ff7b7[_0x6894('0x3b')]=qs[_0x6894('0x33')](_[_0x6894('0x3c')](_0x24c4ed[_0x6894('0x32')],_0x1c8ef9[_0x6894('0x33')]),_0x479bda);if(_0x24c4ed[_0x6894('0x32')][_0x6894('0x3d')]){_0x2ff7b7['where']=_[_0x6894('0x3e')](_0x2ff7b7[_0x6894('0x3b')],{'$or':_['map'](_0x479bda,function(_0x16a68c){if(_0x16a68c[_0x6894('0x3f')]!=='VIRTUAL'){var _0x54b5d2={};_0x54b5d2[_0x16a68c[_0x6894('0x2b')]]={'$like':'%'+_0x24c4ed['query'][_0x6894('0x3d')]+'%'};return _0x54b5d2;}})});}_0x2ff7b7=_['merge']({},_0x2ff7b7,_0x24c4ed[_0x6894('0x40')]);var _0x20a9de={'where':_0x2ff7b7[_0x6894('0x3b')]};return db[_0x6894('0x41')][_0x6894('0x1e')](_0x20a9de)[_0x6894('0x24')](function(_0x57e99c){_0x2e933d[_0x6894('0x1e')]=_0x57e99c;if(_0x24c4ed[_0x6894('0x32')][_0x6894('0x42')]){_0x2ff7b7[_0x6894('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x6894('0x44')](_0x2ff7b7);})[_0x6894('0x24')](function(_0x45fda8){_0x2e933d[_0x6894('0x45')]=_0x45fda8;return _0x2e933d;})['then'](respondWithFilteredResult(_0x504a7a,_0x2ff7b7))[_0x6894('0x46')](handleError(_0x504a7a,null));};exports[_0x6894('0x47')]=function(_0x1b5102,_0x5ccf96){var _0x2e13d7={'raw':![],'where':{'id':_0x1b5102[_0x6894('0x48')]['id']}},_0x5a795a={};_0x5a795a[_0x6894('0x31')]=_[_0x6894('0x49')](db[_0x6894('0x41')]['rawAttributes']);_0x5a795a['query']=_['keys'](_0x1b5102[_0x6894('0x32')]);_0x5a795a['filters']=_['intersection'](_0x5a795a['model'],_0x5a795a[_0x6894('0x32')]);_0x2e13d7[_0x6894('0x35')]=_['intersection'](_0x5a795a['model'],qs[_0x6894('0x36')](_0x1b5102[_0x6894('0x32')][_0x6894('0x36')]));_0x2e13d7['attributes']=_0x2e13d7[_0x6894('0x35')][_0x6894('0x37')]?_0x2e13d7['attributes']:_0x5a795a['model'];if(_0x1b5102[_0x6894('0x32')]['includeAll']){_0x2e13d7[_0x6894('0x43')]=[{'all':!![]}];}_0x2e13d7=_[_0x6894('0x3e')]({},_0x2e13d7,_0x1b5102[_0x6894('0x40')]);return db['AnalyticCustomReport'][_0x6894('0x4a')](_0x2e13d7)[_0x6894('0x24')](handleEntityNotFound(_0x5ccf96,null))['then'](respondWithResult(_0x5ccf96,null))[_0x6894('0x46')](handleError(_0x5ccf96,null));};exports[_0x6894('0x4b')]=function(_0x3f010f,_0x5cb7d3){return db['AnalyticCustomReport'][_0x6894('0x4b')](_0x3f010f[_0x6894('0x4c')],{})[_0x6894('0x24')](function(_0xbb2f08){var _0x154f7f=_0x3f010f['user'][_0x6894('0x26')]({'plain':!![]});if(!_0x154f7f)throw new Error(_0x6894('0x4d'));if(_0x154f7f[_0x6894('0x4e')]==='user'){var _0x1c486e=_0xbb2f08[_0x6894('0x26')]({'plain':!![]});var _0x8abbee=_0x6894('0x4f');return db[_0x6894('0x50')]['find']({'where':{'name':_0x8abbee,'userProfileId':_0x154f7f[_0x6894('0x51')]},'raw':!![]})[_0x6894('0x24')](function(_0x584823){if(_0x584823&&_0x584823[_0x6894('0x52')]===0x0){return db[_0x6894('0x28')][_0x6894('0x4b')]({'name':_0x1c486e[_0x6894('0x2b')],'resourceId':_0x1c486e['id'],'type':_0x6894('0x27'),'sectionId':_0x584823['id']},{})[_0x6894('0x24')](function(){return _0xbb2f08;});}else{return _0xbb2f08;}})[_0x6894('0x46')](function(_0x355218){logger[_0x6894('0x29')](_0x6894('0x53'),_0x355218);throw _0x355218;});}return _0xbb2f08;})['then'](respondWithResult(_0x5cb7d3,0xc9))['catch'](handleError(_0x5cb7d3,null));};exports[_0x6894('0x23')]=function(_0x5c9e4c,_0x2bcc0f){if(_0x5c9e4c['body']['id']){delete _0x5c9e4c[_0x6894('0x4c')]['id'];}return db[_0x6894('0x41')]['find']({'where':{'id':_0x5c9e4c[_0x6894('0x48')]['id']}})[_0x6894('0x24')](handleEntityNotFound(_0x2bcc0f,null))['then'](saveUpdates(_0x5c9e4c[_0x6894('0x4c')],null))[_0x6894('0x24')](respondWithResult(_0x2bcc0f,null))[_0x6894('0x46')](handleError(_0x2bcc0f,null));};exports[_0x6894('0x25')]=function(_0x33e8d6,_0x39a2e5){return db['AnalyticCustomReport'][_0x6894('0x4a')]({'where':{'id':_0x33e8d6['params']['id']}})['then'](handleEntityNotFound(_0x39a2e5,null))['then'](removeEntity(_0x39a2e5,null))[_0x6894('0x46')](handleError(_0x39a2e5,null));};exports[_0x6894('0x54')]=function(_0x2e8c46,_0x207989){var _0x4f87e8=0xa;var _0x409f51=[_0x6894('0x55'),_0x6894('0x56'),'right_join',_0x6894('0x57')];var _0x1c2d9c={'SUM':_0x6894('0x58'),'COUNT':_0x6894('0x59'),'COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':_0x6894('0x5c'),'AVG':_0x6894('0x5d'),'GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':_0x6894('0x5f'),'GROUP_CONCAT DESC':_0x6894('0x60')};var _0x493c8a={'SEC_TO_TIME':_0x6894('0x61'),'DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':_0x6894('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x32127b=function(_0x4e67fe){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),_0x6894('0x68'),_0x6894('0x69')],_0x4e67fe);};var _0x16aaee=function(_0x1c604c){if(!_0x1c604c||!_0x1c604c[_0x6894('0x6a')][_0x6894('0x37')]){return'';}for(var _0x5c4df6='(',_0x177c61=0x0;_0x177c61<_0x1c604c['rules'][_0x6894('0x37')];_0x177c61+=0x1){_0x177c61>0x0&&(_0x5c4df6+='\x20'+_0x1c604c['operator']+'\x20');_0x5c4df6+=_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6b')]?_0x16aaee(_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6b')]):_0x1c604c['rules'][_0x177c61][_0x6894('0x6c')]+'\x20'+_0x1c604c[_0x6894('0x6a')][_0x177c61]['condition']+(_0x32127b(_0x1c604c[_0x6894('0x6a')][_0x177c61][_0x6894('0x6d')])?'\x20'+_0x1c604c[_0x6894('0x6a')][_0x177c61]['value']:'');}return _0x5c4df6+')';};var _0x1ba7b9={'where':{'id':_0x2e8c46['params']['id']}},_0x3a9795,_0x2be92a,_0x408f8f,_0x5f32ea,_0x31ed10;_0x1ba7b9=_['merge']({},_0x1ba7b9,_0x2e8c46[_0x6894('0x40')]);return db[_0x6894('0x41')][_0x6894('0x4a')](_0x1ba7b9)[_0x6894('0x24')](function(_0x4683a5){if(_0x4683a5){_0x3a9795=_0x4683a5;return _0x4683a5[_0x6894('0x6e')]();}return null;})[_0x6894('0x24')](function(_0x12b1b5){if(_0x12b1b5){if(!_0x12b1b5[_0x6894('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x6894('0x6f'),0x193);}_0x2be92a=_0x12b1b5;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x6894('0x24')](function(_0x9cadb9){if(_0x9cadb9){_0x408f8f=_[_0x6894('0x70')](_0x9cadb9,'id');var _0x51c7e6;var _0x4c6385=squel[_0x6894('0x71')]();_0x4c6385[_0x6894('0x72')](_0x3a9795[_0x6894('0x73')]);for(var _0x2c978f=0x0;_0x2c978f<_0x2be92a[_0x6894('0x37')];_0x2c978f+=0x1){_0x51c7e6=_0x2be92a[_0x2c978f][_0x6894('0x74')]?_0x408f8f[_0x2be92a[_0x2c978f][_0x6894('0x74')]][_0x6894('0x75')]:_0x2be92a[_0x2c978f][_0x6894('0x6c')];_0x51c7e6=_0x2be92a[_0x2c978f]['function']?_[_0x6894('0x76')](_0x1c2d9c[_0x2be92a[_0x2c978f]['function']],'%s',_0x51c7e6):_0x51c7e6;_0x51c7e6=_0x2be92a[_0x2c978f][_0x6894('0x77')]?_['replace'](_0x493c8a[_0x2be92a[_0x2c978f][_0x6894('0x77')]],'%s',_0x51c7e6):_0x51c7e6;if(_0x2be92a[_0x2c978f][_0x6894('0x78')]){_0x4c6385[_0x6894('0x6b')](_0x51c7e6);}_0x2be92a[_0x2c978f][_0x6894('0x79')]&&_0x4c6385[_0x6894('0x7a')](_0x51c7e6,_0x2be92a[_0x2c978f][_0x6894('0x79')]===_0x6894('0x7b')?![]:!![]);_0x4c6385[_0x6894('0x6c')](_0x51c7e6,_0x2be92a[_0x2c978f][_0x6894('0x7c')]||_0x51c7e6);}if(_0x3a9795[_0x6894('0x7d')]){_0x3a9795[_0x6894('0x7d')]=JSON[_0x6894('0x7e')](_0x3a9795[_0x6894('0x7d')]);for(var _0xcb7ac0=0x0;_0xcb7ac0<_0x3a9795[_0x6894('0x7d')]['length'];_0xcb7ac0+=0x1){if(_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['type']&&_[_0x6894('0x65')](_0x409f51,_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x3f')])&&_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['parentKey']&&_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x7f')]&&_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x80')]){_0x4c6385[_0x3a9795[_0x6894('0x7d')][_0xcb7ac0]['type']](_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x7f')],null,util['format'](_0x6894('0x81'),_0x3a9795[_0x6894('0x73')],_0x3a9795['joins'][_0xcb7ac0][_0x6894('0x82')],_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x7f')],_0x3a9795[_0x6894('0x7d')][_0xcb7ac0][_0x6894('0x80')]));}}}if(_0x3a9795[_0x6894('0x83')]){_0x3a9795[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x3a9795[_0x6894('0x83')]);_0x4c6385[_0x6894('0x3b')](_0x16aaee(_0x3a9795[_0x6894('0x83')][_0x6894('0x6b')]));}_0x31ed10=_0x4c6385['clone']();_0x4c6385['limit'](_0x4f87e8);_0x4c6385['offset'](0x0);logger[_0x6894('0x84')]('Limited\x20Query:',_0x4c6385['toString']());return dbH[_0x6894('0x85')]['query'](_0x4c6385[_0x6894('0x86')](),{'type':dbH[_0x6894('0x85')][_0x6894('0x87')][_0x6894('0x88')]});}})['then'](respondWithResult(_0x207989,null))[_0x6894('0x46')](handleError(_0x207989,null));};function runReport(_0x2f6da5,_0xef6f4c,_0x3ef4ca){var _0x218c26=_0xef6f4c[_0x6894('0x2b')];var _0xe62227=0xa;var _0x4cff1d=[_0x6894('0x55'),_0x6894('0x56'),'right_join',_0x6894('0x57')];var _0x1a4e9c={'SUM':_0x6894('0x58'),'COUNT':_0x6894('0x59'),'COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':'MIN(%s)','AVG':_0x6894('0x5d'),'GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6894('0x60')};var _0x2dad52={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':_0x6894('0x64'),'UNIX_TIMESTAMP':_0x6894('0x89')};var _0x1ad75b=function(_0x29ddc0){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),_0x6894('0x68'),_0x6894('0x69')],_0x29ddc0);};var _0x23be9d=function(_0x1a4abd){if(!_0x1a4abd||!_0x1a4abd[_0x6894('0x6a')]['length']){return'';}for(var _0x463f20='(',_0xc97bf7=0x0;_0xc97bf7<_0x1a4abd['rules'][_0x6894('0x37')];_0xc97bf7+=0x1){_0xc97bf7>0x0&&(_0x463f20+='\x20'+_0x1a4abd[_0x6894('0x8a')]+'\x20');_0x463f20+=_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x6b')]?_0x23be9d(_0x1a4abd['rules'][_0xc97bf7][_0x6894('0x6b')]):_0x1a4abd[_0x6894('0x6a')][_0xc97bf7]['field']+'\x20'+_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x6d')]+(_0x1ad75b(_0x1a4abd['rules'][_0xc97bf7][_0x6894('0x6d')])?'\x20'+_0x1a4abd[_0x6894('0x6a')][_0xc97bf7][_0x6894('0x8b')]:'');}return _0x463f20+')';};var _0x106845={'where':{'id':_0x2f6da5['id']}},_0x50fd06,_0x2771a7,_0x26e980,_0x7f45d0,_0x57d661;_0x106845=_[_0x6894('0x3e')]({},_0x106845,_0x3ef4ca);return db[_0x6894('0x41')]['find'](_0x106845)[_0x6894('0x24')](function(_0x4a39f6){if(_0x4a39f6){_0x50fd06=_0x4a39f6;return _0x4a39f6['getFields']();}return null;})['then'](function(_0x263658){if(_0x263658){if(!_0x263658[_0x6894('0x37')]){throw new db[(_0x6894('0x8c'))][(_0x6894('0x8d'))](_0x6894('0x6f'),0x193);}_0x2771a7=_0x263658;return db['AnalyticMetric'][_0x6894('0x44')]({'raw':!![]});}return null;})['then'](function(_0x3696cb){if(_0x3696cb){_0x26e980=_[_0x6894('0x70')](_0x3696cb,'id');var _0x192c15;var _0x402458=squel['select']();_0x402458[_0x6894('0x72')](_0x50fd06['table']);for(var _0x19e62a=0x0;_0x19e62a<_0x2771a7[_0x6894('0x37')];_0x19e62a+=0x1){_0x192c15=_0x2771a7[_0x19e62a][_0x6894('0x74')]?_0x26e980[_0x2771a7[_0x19e62a][_0x6894('0x74')]][_0x6894('0x75')]:_0x2771a7[_0x19e62a][_0x6894('0x6c')];_0x192c15=_0x2771a7[_0x19e62a][_0x6894('0x8e')]?_[_0x6894('0x76')](_0x1a4e9c[_0x2771a7[_0x19e62a][_0x6894('0x8e')]],'%s',_0x192c15):_0x192c15;_0x192c15=_0x2771a7[_0x19e62a]['format']?_[_0x6894('0x76')](_0x2dad52[_0x2771a7[_0x19e62a][_0x6894('0x77')]],'%s',_0x192c15):_0x192c15;if(_0x2771a7[_0x19e62a][_0x6894('0x78')]){_0x402458['group'](_0x192c15);}_0x2771a7[_0x19e62a][_0x6894('0x79')]&&_0x402458[_0x6894('0x7a')](_0x192c15,_0x2771a7[_0x19e62a]['orderBy']===_0x6894('0x7b')?![]:!![]);_0x402458[_0x6894('0x6c')](_0x192c15,_0x2771a7[_0x19e62a][_0x6894('0x7c')]||_0x192c15);}if(_0x50fd06[_0x6894('0x7d')]){_0x50fd06['joins']=JSON[_0x6894('0x7e')](_0x50fd06[_0x6894('0x7d')]);for(var _0x47cefc=0x0;_0x47cefc<_0x50fd06['joins']['length'];_0x47cefc+=0x1){if(_0x50fd06['joins'][_0x47cefc][_0x6894('0x3f')]&&_['includes'](_0x4cff1d,_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x3f')])&&_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x82')]&&_0x50fd06[_0x6894('0x7d')][_0x47cefc]['foreignTable']&&_0x50fd06['joins'][_0x47cefc][_0x6894('0x80')]){_0x402458[_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x3f')]](_0x50fd06['joins'][_0x47cefc][_0x6894('0x7f')],null,util[_0x6894('0x77')](_0x6894('0x81'),_0x50fd06[_0x6894('0x73')],_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x82')],_0x50fd06['joins'][_0x47cefc][_0x6894('0x7f')],_0x50fd06[_0x6894('0x7d')][_0x47cefc][_0x6894('0x80')]));}}}if(_0x50fd06['conditions']){_0x50fd06[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x50fd06[_0x6894('0x83')]);_0x402458['where'](_0x23be9d(_0x50fd06[_0x6894('0x83')][_0x6894('0x6b')]));}_0x57d661=_0x402458[_0x6894('0x8f')]();_0x402458[_0x6894('0x1c')](_0xe62227);_0x402458[_0x6894('0x1b')](0x0);return;}})[_0x6894('0x24')](function(){if(_0xef6f4c[_0x6894('0x90')]===_0x6894('0x91')){return null;}var _0x40c506=_[_0x6894('0x3e')](_0xef6f4c,{'name':_0xef6f4c['fullPath']||_0xef6f4c['name']||_0x50fd06[_0x6894('0x2b')],'basename':_0x218c26,'savename':util[_0x6894('0x77')](_0x6894('0x92'),_0xef6f4c[_0x6894('0x2b')]||_0x50fd06[_0x6894('0x2b')],require(_0x6894('0x93'))[_0x6894('0x94')](0x4),_0xef6f4c['output']||_0x6894('0x95')),'reportId':_0x50fd06['id'],'reportType':_0x6894('0x96')});return db['AnalyticExtractedReport'][_0x6894('0x4b')](_0x40c506,{'raw':!![]});})[_0x6894('0x24')](function(_0x458498){if(_0x50fd06[_0x6894('0x73')]===_0x6894('0x97')){_0x57d661[_0x6894('0x3b')](_0x50fd06[_0x6894('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xef6f4c['startDate'],_0xef6f4c[_0x6894('0x98')]);}else{_0x57d661['where'](_0x50fd06[_0x6894('0x73')]+_0x6894('0x99'),_0xef6f4c[_0x6894('0x9a')],_0xef6f4c[_0x6894('0x98')]);}if(_0x458498){logger['info'](_0x6894('0x9b'),_0x57d661['toString']());require(_0x6894('0x9c'))[_0x6894('0x9d')](path[_0x6894('0x55')](__dirname,'../../components/export/',_0x458498[_0x6894('0x90')]),[_0x458498['id'],_0x57d661[_0x6894('0x86')](),path[_0x6894('0x55')](__dirname,'../../files/reports',_0x458498[_0x6894('0x9e')]),_0x218c26]);return _0x458498;}else{var _0x7c49db=squel[_0x6894('0x71')]();_0x7c49db[_0x6894('0x72')]('('+_0x57d661[_0x6894('0x86')]()+')','countTable');_0x7c49db['field']('COUNT(*)',_0x6894('0x1e'));_0x57d661[_0x6894('0x1c')](_0xef6f4c[_0x6894('0x1c')]||_0xe62227);_0x57d661[_0x6894('0x1b')](_0xef6f4c['offset']||0x0);return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x7c49db[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]})[_0x6894('0x24')](function(_0x5f03f0){if(!_0x5f03f0[_0x6894('0x37')]){_0x7f45d0=0x0;}else{_0x7f45d0=_0x5f03f0[0x0][_0x6894('0x1e')]||0x0;}return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x57d661[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]});})[_0x6894('0x24')](function(_0x41a083){return{'rows':_0x41a083||[],'count':_0x7f45d0};});}});}exports[_0x6894('0x9f')]=function(_0x32de82,_0x372643){return runReport(_0x32de82['params'],_0x32de82['query'],_0x32de82['options'])['then'](respondWithResult(_0x372643,null))['catch'](handleError(_0x372643,null));};exports['runReport']=runReport;exports['query']=function(_0xd41f27,_0x3eec29){var _0x318919=0xa;var _0x15bcbf=[_0x6894('0x55'),_0x6894('0x56'),_0x6894('0xa0'),_0x6894('0x57')];var _0x33adfb={'SUM':_0x6894('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6894('0x5a'),'MAX':_0x6894('0x5b'),'MIN':_0x6894('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6894('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6894('0x60')};var _0xc6c15f={'SEC_TO_TIME':_0x6894('0x61'),'DATE':_0x6894('0x62'),'HOUR':_0x6894('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24e7e5=function(_0x45ce41){return!_[_0x6894('0x65')]([_0x6894('0x66'),_0x6894('0x67'),'IS\x20EMPTY',_0x6894('0x69')],_0x45ce41);};var _0x182665=function(_0x4a8a81){if(!_0x4a8a81||!_0x4a8a81[_0x6894('0x6a')][_0x6894('0x37')]){return'';}for(var _0x1d44bc='(',_0x5066d2=0x0;_0x5066d2<_0x4a8a81['rules'][_0x6894('0x37')];_0x5066d2+=0x1){_0x5066d2>0x0&&(_0x1d44bc+='\x20'+_0x4a8a81[_0x6894('0x8a')]+'\x20');_0x1d44bc+=_0x4a8a81['rules'][_0x5066d2][_0x6894('0x6b')]?_0x182665(_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6b')]):_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6c')]+'\x20'+_0x4a8a81[_0x6894('0x6a')][_0x5066d2][_0x6894('0x6d')]+(_0x24e7e5(_0x4a8a81[_0x6894('0x6a')][_0x5066d2]['condition'])?'\x20'+_0x4a8a81['rules'][_0x5066d2][_0x6894('0x8b')]:'');}return _0x1d44bc+')';};var _0x24ce0a={'where':{'id':_0xd41f27[_0x6894('0x48')]['id']}},_0x240d8a,_0x4be470,_0x41d383,_0x422db9,_0x5b5cc5;_0x24ce0a=_[_0x6894('0x3e')]({},_0x24ce0a,_0xd41f27[_0x6894('0x40')]);return db[_0x6894('0x41')][_0x6894('0x4a')](_0x24ce0a)['then'](function(_0x412678){if(_0x412678){_0x240d8a=_0x412678;return _0x412678[_0x6894('0x6e')]();}return null;})[_0x6894('0x24')](function(_0x450af8){if(_0x450af8){if(!_0x450af8[_0x6894('0x37')]){throw new db[(_0x6894('0x8c'))]['ValidationErrorItem'](_0x6894('0x6f'),0x193);}_0x4be470=_0x450af8;return db[_0x6894('0xa1')][_0x6894('0x44')]({'raw':!![]});}return null;})[_0x6894('0x24')](function(_0x4c4f08){if(_0x4c4f08){_0x41d383=_[_0x6894('0x70')](_0x4c4f08,'id');var _0x1c9bb5;var _0x55104e=squel[_0x6894('0x71')]();_0x55104e['from'](_0x240d8a['table']);for(var _0x1e4ecd=0x0;_0x1e4ecd<_0x4be470[_0x6894('0x37')];_0x1e4ecd+=0x1){_0x1c9bb5=_0x4be470[_0x1e4ecd]['MetricId']?_0x41d383[_0x4be470[_0x1e4ecd][_0x6894('0x74')]][_0x6894('0x75')]:_0x4be470[_0x1e4ecd]['field'];_0x1c9bb5=_0x4be470[_0x1e4ecd][_0x6894('0x8e')]?_['replace'](_0x33adfb[_0x4be470[_0x1e4ecd][_0x6894('0x8e')]],'%s',_0x1c9bb5):_0x1c9bb5;_0x1c9bb5=_0x4be470[_0x1e4ecd][_0x6894('0x77')]?_['replace'](_0xc6c15f[_0x4be470[_0x1e4ecd][_0x6894('0x77')]],'%s',_0x1c9bb5):_0x1c9bb5;if(_0x4be470[_0x1e4ecd]['groupBy']){_0x55104e[_0x6894('0x6b')](_0x1c9bb5);}_0x4be470[_0x1e4ecd][_0x6894('0x79')]&&_0x55104e['order'](_0x1c9bb5,_0x4be470[_0x1e4ecd][_0x6894('0x79')]==='DESC'?![]:!![]);_0x55104e[_0x6894('0x6c')](_0x1c9bb5,_0x4be470[_0x1e4ecd][_0x6894('0x7c')]||_0x1c9bb5);}if(_0x240d8a['joins']){_0x240d8a['joins']=JSON[_0x6894('0x7e')](_0x240d8a[_0x6894('0x7d')]);for(var _0x24ce49=0x0;_0x24ce49<_0x240d8a[_0x6894('0x7d')][_0x6894('0x37')];_0x24ce49+=0x1){if(_0x240d8a['joins'][_0x24ce49][_0x6894('0x3f')]&&_['includes'](_0x15bcbf,_0x240d8a[_0x6894('0x7d')][_0x24ce49]['type'])&&_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x82')]&&_0x240d8a['joins'][_0x24ce49][_0x6894('0x7f')]&&_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x80')]){_0x55104e[_0x240d8a['joins'][_0x24ce49]['type']](_0x240d8a[_0x6894('0x7d')][_0x24ce49]['foreignTable'],null,util[_0x6894('0x77')](_0x6894('0x81'),_0x240d8a[_0x6894('0x73')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x82')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x7f')],_0x240d8a[_0x6894('0x7d')][_0x24ce49][_0x6894('0x80')]));}}}if(_0x240d8a[_0x6894('0x83')]){_0x240d8a[_0x6894('0x83')]=JSON[_0x6894('0x7e')](_0x240d8a[_0x6894('0x83')]);_0x55104e['where'](_0x182665(_0x240d8a[_0x6894('0x83')][_0x6894('0x6b')]));}_0x5b5cc5=_0x55104e['clone']();_0x55104e['limit'](_0x318919);_0x55104e[_0x6894('0x1b')](0x0);logger[_0x6894('0x84')](_0x6894('0xa2'),_0x55104e[_0x6894('0x86')]());return dbH[_0x6894('0x85')][_0x6894('0x32')](_0x55104e[_0x6894('0x86')](),{'type':dbH['sequelize'][_0x6894('0x87')][_0x6894('0x88')]});}})[_0x6894('0x24')](function(){return{'sql':_0x5b5cc5[_0x6894('0x86')]()};})[_0x6894('0x24')](respondWithResult(_0x3eec29,null))[_0x6894('0x46')](handleError(_0x3eec29,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bf6587e..7af897b 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 _0x3c54=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','util','api'];(function(_0x1f0149,_0x4e5570){var _0x3bf819=function(_0x243be9){while(--_0x243be9){_0x1f0149['push'](_0x1f0149['shift']());}};_0x3bf819(++_0x4e5570);}(_0x3c54,0x1b5));var _0x43c5=function(_0x5af2a4,_0x26c908){_0x5af2a4=_0x5af2a4-0x0;var _0x300616=_0x3c54[_0x5af2a4];return _0x300616;};'use strict';var _=require(_0x43c5('0x0'));var util=require(_0x43c5('0x1'));var logger=require('../../config/logger')(_0x43c5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x43c5('0x3'));var fs=require('fs');var path=require(_0x43c5('0x4'));var rimraf=require(_0x43c5('0x5'));var config=require(_0x43c5('0x6'));var attributes=require(_0x43c5('0x7'));module[_0x43c5('0x8')]=function(_0x161c63,_0x339400){return _0x161c63['define']('AnalyticCustomReport',attributes,{'tableName':_0x43c5('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb4f=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a7b8f,_0x2a4c6a){var _0x467b8=function(_0x3c0cbc){while(--_0x3c0cbc){_0x2a7b8f['push'](_0x2a7b8f['shift']());}};_0x467b8(++_0x2a4c6a);}(_0xbb4f,0x10b));var _0xfbb4=function(_0x4e8210,_0x26f275){_0x4e8210=_0x4e8210-0x0;var _0x3edabc=_0xbb4f[_0x4e8210];return _0x3edabc;};'use strict';var _=require(_0xfbb4('0x0'));var util=require('util');var logger=require(_0xfbb4('0x1'))(_0xfbb4('0x2'));var moment=require(_0xfbb4('0x3'));var BPromise=require(_0xfbb4('0x4'));var rp=require(_0xfbb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbb4('0x6'));var config=require(_0xfbb4('0x7'));var attributes=require(_0xfbb4('0x8'));module[_0xfbb4('0x9')]=function(_0x1a8604,_0x44cc45){return _0x1a8604[_0xfbb4('0xa')](_0xfbb4('0xb'),attributes,{'tableName':_0xfbb4('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 50f43e4..5937918 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 _0x0a2a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a2a,0xf8));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0a2('0x0'));var util=require(_0xa0a2('0x1'));var moment=require('moment');var BPromise=require(_0xa0a2('0x2'));var rs=require(_0xa0a2('0x3'));var fs=require('fs');var Redis=require(_0xa0a2('0x4'));var db=require(_0xa0a2('0x5'))['db'];var utils=require(_0xa0a2('0x6'));var logger=require(_0xa0a2('0x7'))('rpc');var config=require(_0xa0a2('0x8'));var jayson=require(_0xa0a2('0x9'));var client=jayson['client'][_0xa0a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x182959,_0x602a74,_0x4547a2){return new BPromise(function(_0x560112,_0x45b97a){return client[_0xa0a2('0xb')](_0x182959,_0x4547a2)[_0xa0a2('0xc')](function(_0x41f01a){logger[_0xa0a2('0xd')](_0xa0a2('0xe'),_0x602a74,_0xa0a2('0xf'));logger[_0xa0a2('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x602a74,_0xa0a2('0xf'),JSON[_0xa0a2('0x11')](_0x41f01a));if(_0x41f01a[_0xa0a2('0x12')]){if(_0x41f01a[_0xa0a2('0x12')][_0xa0a2('0x13')]===0x1f4){logger['error'](_0xa0a2('0xe'),_0x602a74,_0x41f01a[_0xa0a2('0x12')][_0xa0a2('0x14')]);return _0x45b97a(_0x41f01a[_0xa0a2('0x12')][_0xa0a2('0x14')]);}logger[_0xa0a2('0x12')](_0xa0a2('0xe'),_0x602a74,_0x41f01a['error'][_0xa0a2('0x14')]);return _0x560112(_0x41f01a[_0xa0a2('0x12')][_0xa0a2('0x14')]);}else{logger[_0xa0a2('0xd')](_0xa0a2('0xe'),_0x602a74,'request\x20sent');_0x560112(_0x41f01a[_0xa0a2('0x15')][_0xa0a2('0x14')]);}})[_0xa0a2('0x16')](function(_0x97ec0f){logger['error'](_0xa0a2('0xe'),_0x602a74,_0x97ec0f);_0x45b97a(_0x97ec0f);});});} \ No newline at end of file +var _0x2fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x2fd9,0x114));var _0x92fd=function(_0x2bfd90,_0x102539){_0x2bfd90=_0x2bfd90-0x0;var _0x33e709=_0x2fd9[_0x2bfd90];return _0x33e709;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x92fd('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92fd('0x1'));var db=require(_0x92fd('0x2'))['db'];var utils=require(_0x92fd('0x3'));var logger=require(_0x92fd('0x4'))(_0x92fd('0x5'));var config=require(_0x92fd('0x6'));var jayson=require(_0x92fd('0x7'));var client=jayson[_0x92fd('0x8')][_0x92fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50533a,_0x52f35a,_0x2e4657){return new BPromise(function(_0x1c8271,_0x4a4b87){return client[_0x92fd('0xa')](_0x50533a,_0x2e4657)[_0x92fd('0xb')](function(_0x562957){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x52f35a,_0x92fd('0xc'));logger[_0x92fd('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x52f35a,_0x92fd('0xc'),JSON[_0x92fd('0xe')](_0x562957));if(_0x562957['error']){if(_0x562957[_0x92fd('0xf')][_0x92fd('0x10')]===0x1f4){logger[_0x92fd('0xf')](_0x92fd('0x11'),_0x52f35a,_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);return _0x4a4b87(_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);}logger[_0x92fd('0xf')](_0x92fd('0x11'),_0x52f35a,_0x562957[_0x92fd('0xf')]['message']);return _0x1c8271(_0x562957[_0x92fd('0xf')][_0x92fd('0x12')]);}else{logger['info'](_0x92fd('0x11'),_0x52f35a,'request\x20sent');_0x1c8271(_0x562957[_0x92fd('0x13')][_0x92fd('0x12')]);}})['catch'](function(_0x3fa5b9){logger[_0x92fd('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x52f35a,_0x3fa5b9);_0x4a4b87(_0x3fa5b9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a7a1c2d..11bed6c 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 _0x544d=['preview','/:id/run','run','/:id/query','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x544d,0x113));var _0xd544=function(_0x42cb52,_0x5dfb0a){_0x42cb52=_0x42cb52-0x0;var _0x18387b=_0x544d[_0x42cb52];return _0x18387b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd544('0x0'));var timeout=require(_0xd544('0x1'));var express=require(_0xd544('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd544('0x3'));var interaction=require(_0xd544('0x4'));var config=require(_0xd544('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xd544('0x6')](),controller['index']);router[_0xd544('0x7')](_0xd544('0x8'),auth[_0xd544('0x6')](),controller[_0xd544('0x9')]);router[_0xd544('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0xd544('0xa')]);router[_0xd544('0x7')](_0xd544('0xb'),auth[_0xd544('0x6')](),controller[_0xd544('0xc')]);router['get'](_0xd544('0xd'),auth[_0xd544('0x6')](),controller['query']);router['post']('/',auth[_0xd544('0x6')](),controller['create']);router[_0xd544('0xe')](_0xd544('0x8'),auth[_0xd544('0x6')](),controller[_0xd544('0xf')]);router[_0xd544('0x10')](_0xd544('0x8'),auth[_0xd544('0x6')](),controller[_0xd544('0x11')]);module[_0xd544('0x12')]=router; \ No newline at end of file +var _0x8297=['show','get','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','/:id'];(function(_0x4bca31,_0x394def){var _0x49816d=function(_0xfe82d5){while(--_0xfe82d5){_0x4bca31['push'](_0x4bca31['shift']());}};_0x49816d(++_0x394def);}(_0x8297,0x18c));var _0x7829=function(_0x19b50b,_0x34d7ba){_0x19b50b=_0x19b50b-0x0;var _0x2ac4f3=_0x8297[_0x19b50b];return _0x2ac4f3;};'use strict';var multer=require(_0x7829('0x0'));var util=require(_0x7829('0x1'));var path=require(_0x7829('0x2'));var timeout=require(_0x7829('0x3'));var express=require('express');var router=express[_0x7829('0x4')]();var fs_extra=require(_0x7829('0x5'));var auth=require(_0x7829('0x6'));var interaction=require(_0x7829('0x7'));var config=require(_0x7829('0x8'));var controller=require(_0x7829('0x9'));router['get']('/',auth[_0x7829('0xa')](),controller['index']);router['get'](_0x7829('0xb'),auth[_0x7829('0xa')](),controller[_0x7829('0xc')]);router[_0x7829('0xd')](_0x7829('0xe'),auth[_0x7829('0xa')](),controller[_0x7829('0xf')]);router[_0x7829('0xd')](_0x7829('0x10'),auth[_0x7829('0xa')](),controller[_0x7829('0x11')]);router[_0x7829('0xd')](_0x7829('0x12'),auth[_0x7829('0xa')](),controller['query']);router['post']('/',auth[_0x7829('0xa')](),controller[_0x7829('0x13')]);router[_0x7829('0x14')](_0x7829('0xb'),auth['isAuthenticated'](),controller[_0x7829('0x15')]);router['delete'](_0x7829('0xb'),auth['isAuthenticated'](),controller[_0x7829('0x16')]);module[_0x7829('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b5f4b07..926fd61 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 _0x7fbe=['STRING','TEXT'];(function(_0x3c083b,_0x549e68){var _0x1c4f50=function(_0x49f5aa){while(--_0x49f5aa){_0x3c083b['push'](_0x3c083b['shift']());}};_0x1c4f50(++_0x549e68);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x16818e,_0x4c3656){_0x16818e=_0x16818e-0x0;var _0x6fadf9=_0x7fbe[_0x16818e];return _0x6fadf9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x419876,_0x2905d6){var _0xd7f3d8=function(_0xa2e0ca){while(--_0xa2e0ca){_0x419876['push'](_0x419876['shift']());}};_0xd7f3d8(++_0x2905d6);}(_0x33c5,0xe6));var _0x533c=function(_0xd5160a,_0x572c4b){_0xd5160a=_0xd5160a-0x0;var _0x576cf9=_0x33c5[_0xd5160a];return _0x576cf9;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dbc1921..dfe3d7a 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 _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x46cbe0,_0x382b2a){var _0x4b47ac=function(_0xe0e3f3){while(--_0xe0e3f3){_0x46cbe0['push'](_0x46cbe0['shift']());}};_0x4b47ac(++_0x382b2a);}(_0x0295,0x1f0));var _0x5029=function(_0x27a1a0,_0x410857){_0x27a1a0=_0x27a1a0-0x0;var _0x1321a0=_0x0295[_0x27a1a0];return _0x1321a0;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x2bd263,_0x56818c){var _0x9e64d0=function(_0x503583){while(--_0x503583){_0x2bd263['push'](_0x2bd263['shift']());}};_0x9e64d0(++_0x56818c);}(_0x5fab,0x177));var _0xb5fa=function(_0x37b07c,_0x5941a1){_0x37b07c=_0x37b07c-0x0;var _0x264672=_0x5fab[_0x37b07c];return _0x264672;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a3eff6a..72276af 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 _0xd2b2=['path','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','api'];(function(_0x17c4ce,_0x3d1b7b){var _0xaeb684=function(_0x316434){while(--_0x316434){_0x17c4ce['push'](_0x17c4ce['shift']());}};_0xaeb684(++_0x3d1b7b);}(_0xd2b2,0x180));var _0x2d2b=function(_0x202372,_0x5b4a58){_0x202372=_0x202372-0x0;var _0x25ac89=_0xd2b2[_0x202372];return _0x25ac89;};'use strict';var _=require(_0x2d2b('0x0'));var util=require(_0x2d2b('0x1'));var logger=require('../../config/logger')(_0x2d2b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d2b('0x3'));var rimraf=require('rimraf');var config=require(_0x2d2b('0x4'));var attributes=require(_0x2d2b('0x5'));module[_0x2d2b('0x6')]=function(_0x2a63ed,_0x47d9e7){return _0x2a63ed[_0x2d2b('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x2d2b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a61=['AnalyticDefaultReport','analytics_default_reports','lodash','api','moment','path','rimraf','./analyticDefaultReport.attributes','exports','define'];(function(_0x5b4915,_0x336b69){var _0x4eaaca=function(_0x5e9047){while(--_0x5e9047){_0x5b4915['push'](_0x5b4915['shift']());}};_0x4eaaca(++_0x336b69);}(_0x9a61,0x110));var _0x19a6=function(_0x2125d3,_0x599ffb){_0x2125d3=_0x2125d3-0x0;var _0x2f2cf5=_0x9a61[_0x2125d3];return _0x2f2cf5;};'use strict';var _=require(_0x19a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19a6('0x1'));var moment=require(_0x19a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19a6('0x3'));var rimraf=require(_0x19a6('0x4'));var config=require('../../config/environment');var attributes=require(_0x19a6('0x5'));module[_0x19a6('0x6')]=function(_0x717482,_0x39951e){return _0x717482[_0x19a6('0x7')](_0x19a6('0x8'),attributes,{'tableName':_0x19a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index dd9eb84..0d04483 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 _0x07da=['code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x07da,0x1a3));var _0xa07d=function(_0x1772e6,_0x374858){_0x1772e6=_0x1772e6-0x0;var _0x5f28aa=_0x07da[_0x1772e6];return _0x5f28aa;};'use strict';var _=require(_0xa07d('0x0'));var util=require(_0xa07d('0x1'));var moment=require(_0xa07d('0x2'));var BPromise=require(_0xa07d('0x3'));var rs=require(_0xa07d('0x4'));var fs=require('fs');var Redis=require(_0xa07d('0x5'));var db=require(_0xa07d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa07d('0x7'))(_0xa07d('0x8'));var config=require(_0xa07d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa07d('0xa')][_0xa07d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19f6ab,_0x4eb0b2,_0x26daad){return new BPromise(function(_0x111c08,_0x62fa03){return client[_0xa07d('0xc')](_0x19f6ab,_0x26daad)['then'](function(_0x2f204c){logger['info'](_0xa07d('0xd'),_0x4eb0b2,'request\x20sent');logger[_0xa07d('0xe')](_0xa07d('0xf'),_0x4eb0b2,'request\x20sent',JSON[_0xa07d('0x10')](_0x2f204c));if(_0x2f204c[_0xa07d('0x11')]){if(_0x2f204c['error'][_0xa07d('0x12')]===0x1f4){logger[_0xa07d('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4eb0b2,_0x2f204c[_0xa07d('0x11')][_0xa07d('0x13')]);return _0x62fa03(_0x2f204c[_0xa07d('0x11')]['message']);}logger[_0xa07d('0x11')](_0xa07d('0xd'),_0x4eb0b2,_0x2f204c[_0xa07d('0x11')][_0xa07d('0x13')]);return _0x111c08(_0x2f204c[_0xa07d('0x11')][_0xa07d('0x13')]);}else{logger[_0xa07d('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4eb0b2,_0xa07d('0x15'));_0x111c08(_0x2f204c['result'][_0xa07d('0x13')]);}})[_0xa07d('0x16')](function(_0x548c2c){logger[_0xa07d('0x11')](_0xa07d('0xd'),_0x4eb0b2,_0x548c2c);_0x62fa03(_0x548c2c);});});} \ No newline at end of file +var _0x3ff4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0x3ff4,0x1c5));var _0x43ff=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3ff4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x43ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x43ff('0x1'));var rs=require(_0x43ff('0x2'));var fs=require('fs');var Redis=require(_0x43ff('0x3'));var db=require(_0x43ff('0x4'))['db'];var utils=require(_0x43ff('0x5'));var logger=require(_0x43ff('0x6'))(_0x43ff('0x7'));var config=require(_0x43ff('0x8'));var jayson=require(_0x43ff('0x9'));var client=jayson[_0x43ff('0xa')][_0x43ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4441ed,_0x3913e6,_0x250056){return new BPromise(function(_0x9f3b6a,_0xaaa72a){return client['request'](_0x4441ed,_0x250056)[_0x43ff('0xc')](function(_0x3d6c99){logger['info'](_0x43ff('0xd'),_0x3913e6,_0x43ff('0xe'));logger[_0x43ff('0xf')](_0x43ff('0x10'),_0x3913e6,_0x43ff('0xe'),JSON[_0x43ff('0x11')](_0x3d6c99));if(_0x3d6c99[_0x43ff('0x12')]){if(_0x3d6c99['error'][_0x43ff('0x13')]===0x1f4){logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x3d6c99['error'][_0x43ff('0x14')]);return _0xaaa72a(_0x3d6c99['error']['message']);}logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x3d6c99['error'][_0x43ff('0x14')]);return _0x9f3b6a(_0x3d6c99[_0x43ff('0x12')][_0x43ff('0x14')]);}else{logger[_0x43ff('0x15')](_0x43ff('0xd'),_0x3913e6,'request\x20sent');_0x9f3b6a(_0x3d6c99[_0x43ff('0x16')]['message']);}})[_0x43ff('0x17')](function(_0x591036){logger[_0x43ff('0x12')](_0x43ff('0xd'),_0x3913e6,_0x591036);_0xaaa72a(_0x591036);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 210c1b2..b15a900 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 _0x36fe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','preview','/:id/run','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x312bd1,_0xaaa2cc){var _0x3e6494=function(_0x3e43a7){while(--_0x3e43a7){_0x312bd1['push'](_0x312bd1['shift']());}};_0x3e6494(++_0xaaa2cc);}(_0x36fe,0x127));var _0xe36f=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0x36fe[_0x134bfc];return _0x2f4dcc;};'use strict';var multer=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var path=require(_0xe36f('0x2'));var timeout=require(_0xe36f('0x3'));var express=require(_0xe36f('0x4'));var router=express[_0xe36f('0x5')]();var fs_extra=require(_0xe36f('0x6'));var auth=require(_0xe36f('0x7'));var interaction=require(_0xe36f('0x8'));var config=require(_0xe36f('0x9'));var controller=require(_0xe36f('0xa'));router['get']('/',auth[_0xe36f('0xb')](),controller['index']);router[_0xe36f('0xc')](_0xe36f('0xd'),auth['isAuthenticated'](),controller[_0xe36f('0xe')]);router[_0xe36f('0xc')]('/:id/preview',auth[_0xe36f('0xb')](),controller[_0xe36f('0xf')]);router[_0xe36f('0xc')](_0xe36f('0x10'),auth[_0xe36f('0xb')](),controller['run']);router[_0xe36f('0xc')]('/:id/query',auth[_0xe36f('0xb')](),controller[_0xe36f('0x11')]);router[_0xe36f('0x12')]('/',auth['isAuthenticated'](),controller[_0xe36f('0x13')]);router[_0xe36f('0x14')]('/:id',auth[_0xe36f('0xb')](),controller[_0xe36f('0x15')]);router[_0xe36f('0x16')](_0xe36f('0xd'),auth['isAuthenticated'](),controller[_0xe36f('0x17')]);module[_0xe36f('0x18')]=router; \ No newline at end of file +var _0xe6ae=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','preview','/:id/run','run','/:id/query','query','post','create','/:id','update','destroy'];(function(_0x44976e,_0x311385){var _0x4852b2=function(_0xd57529){while(--_0xd57529){_0x44976e['push'](_0x44976e['shift']());}};_0x4852b2(++_0x311385);}(_0xe6ae,0x1e3));var _0xee6a=function(_0x4ba880,_0x3eada2){_0x4ba880=_0x4ba880-0x0;var _0x8055ff=_0xe6ae[_0x4ba880];return _0x8055ff;};'use strict';var multer=require(_0xee6a('0x0'));var util=require(_0xee6a('0x1'));var path=require(_0xee6a('0x2'));var timeout=require(_0xee6a('0x3'));var express=require(_0xee6a('0x4'));var router=express[_0xee6a('0x5')]();var fs_extra=require(_0xee6a('0x6'));var auth=require(_0xee6a('0x7'));var interaction=require(_0xee6a('0x8'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xee6a('0x9')]('/',auth['isAuthenticated'](),controller[_0xee6a('0xa')]);router[_0xee6a('0x9')]('/:id',auth[_0xee6a('0xb')](),controller[_0xee6a('0xc')]);router[_0xee6a('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xee6a('0xd')]);router[_0xee6a('0x9')](_0xee6a('0xe'),auth['isAuthenticated'](),controller[_0xee6a('0xf')]);router['get'](_0xee6a('0x10'),auth['isAuthenticated'](),controller[_0xee6a('0x11')]);router[_0xee6a('0x12')]('/',auth[_0xee6a('0xb')](),controller[_0xee6a('0x13')]);router['put'](_0xee6a('0x14'),auth[_0xee6a('0xb')](),controller[_0xee6a('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee6a('0x16')]);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 c16c677..6420dbe 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 _0x41b3=['UNSIGNED','moment','STRING','ENUM','csv','pdf','DATE','manual','scheduled','INTEGER'];(function(_0x1dac99,_0x12ea46){var _0xb9f1d7=function(_0x46518a){while(--_0x46518a){_0x1dac99['push'](_0x1dac99['shift']());}};_0xb9f1d7(++_0x12ea46);}(_0x41b3,0xbf));var _0x341b=function(_0x1ae74e,_0x21889d){_0x1ae74e=_0x1ae74e-0x0;var _0x4f5d22=_0x41b3[_0x1ae74e];return _0x4f5d22;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x341b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x341b('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x341b('0x2')](_0x341b('0x3'),_0x341b('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x341b('0x3')},'savename':{'type':Sequelize[_0x341b('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x341b('0x5')]},'endDate':{'type':Sequelize[_0x341b('0x5')]},'status':{'type':Sequelize[_0x341b('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x341b('0x6'),_0x341b('0x7')),'allowNull':![],'defaultValue':_0x341b('0x6')},'reportId':{'type':Sequelize[_0x341b('0x8')](0xb)[_0x341b('0x9')]},'reportType':{'type':Sequelize[_0x341b('0x1')]}}; \ No newline at end of file +var _0xadf1=['csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x2d1343,_0x1e519d){var _0x2c17f4=function(_0x5d97f6){while(--_0x5d97f6){_0x2d1343['push'](_0x2d1343['shift']());}};_0x2c17f4(++_0x1e519d);}(_0xadf1,0xe3));var _0x1adf=function(_0x2b1255,_0x4869da){_0x2b1255=_0x2b1255-0x0;var _0x44442d=_0xadf1[_0x2b1255];return _0x44442d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1adf('0x0'));module[_0x1adf('0x1')]={'name':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x1adf('0x3')](_0x1adf('0x4'),_0x1adf('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x1adf('0x4')},'savename':{'type':Sequelize[_0x1adf('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1adf('0x6')]},'endDate':{'type':Sequelize[_0x1adf('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x1adf('0x7')},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':_0x1adf('0x8')},'reportId':{'type':Sequelize[_0x1adf('0x9')](0xb)[_0x1adf('0xa')]},'reportType':{'type':Sequelize[_0x1adf('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d1c0267..96bb1aa 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 _0x7023=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','then','end','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','user','ExtractedReports','UserProfileSection'];(function(_0x41285f,_0x242ecb){var _0x358377=function(_0xb4f14d){while(--_0xb4f14d){_0x41285f['push'](_0x41285f['shift']());}};_0x358377(++_0x242ecb);}(_0x7023,0x1e5));var _0x3702=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7023[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x3702('0x0'));var rimraf=require(_0x3702('0x1'));var zipdir=require(_0x3702('0x2'));var jsonpatch=require(_0x3702('0x3'));var rp=require(_0x3702('0x4'));var moment=require('moment');var BPromise=require(_0x3702('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3702('0x6'));var sox=require(_0x3702('0x7'));var csv=require(_0x3702('0x8'));var ejs=require(_0x3702('0x9'));var fs=require('fs');var fs_extra=require(_0x3702('0xa'));var _=require('lodash');var squel=require(_0x3702('0xb'));var crypto=require(_0x3702('0xc'));var jsforce=require(_0x3702('0xd'));var deskjs=require(_0x3702('0xe'));var toCsv=require(_0x3702('0x8'));var querystring=require(_0x3702('0xf'));var Papa=require(_0x3702('0x10'));var Redis=require(_0x3702('0x11'));var authService=require(_0x3702('0x12'));var qs=require(_0x3702('0x13'));var as=require(_0x3702('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3702('0x15'));var utils=require('../../config/utils');var config=require(_0x3702('0x16'));var licenseUtil=require(_0x3702('0x17'));var db=require(_0x3702('0x18'))['db'];function respondWithStatusCode(_0x155fbd,_0x2dd506){_0x2dd506=_0x2dd506||0xcc;return function(_0x2c5eb1){if(_0x2c5eb1){return _0x155fbd[_0x3702('0x19')](_0x2dd506);}return _0x155fbd[_0x3702('0x1a')](_0x2dd506)['end']();};}function respondWithResult(_0xecf37,_0x16cb37){_0x16cb37=_0x16cb37||0xc8;return function(_0x1ed66a){if(_0x1ed66a){return _0xecf37[_0x3702('0x1a')](_0x16cb37)[_0x3702('0x1b')](_0x1ed66a);}};}function respondWithFilteredResult(_0x235a25,_0x2d9c45){return function(_0x472a8a){if(_0x472a8a){var _0xcb9d5c=typeof _0x2d9c45[_0x3702('0x1c')]===_0x3702('0x1d')&&typeof _0x2d9c45[_0x3702('0x1e')]===_0x3702('0x1d');var _0x316af5=_0x472a8a[_0x3702('0x1f')];var _0xe450f8=_0xcb9d5c?0x0:_0x2d9c45['offset'];var _0xc2d3b1=_0xcb9d5c?_0x472a8a['count']:_0x2d9c45[_0x3702('0x1c')]+_0x2d9c45[_0x3702('0x1e')];var _0x56f846;if(_0xc2d3b1>=_0x316af5){_0xc2d3b1=_0x316af5;_0x56f846=0xc8;}else{_0x56f846=0xce;}_0x235a25[_0x3702('0x1a')](_0x56f846);return _0x235a25[_0x3702('0x20')](_0x3702('0x21'),_0xe450f8+'-'+_0xc2d3b1+'/'+_0x316af5)['json'](_0x472a8a);}return null;};}function patchUpdates(_0x3e3942){return function(_0x963b19){try{jsonpatch['apply'](_0x963b19,_0x3e3942,!![]);}catch(_0x3a2a24){return BPromise[_0x3702('0x22')](_0x3a2a24);}return _0x963b19[_0x3702('0x23')]();};}function saveUpdates(_0x26a6aa,_0x15cd71){return function(_0x5e6d9c){if(_0x5e6d9c){return _0x5e6d9c[_0x3702('0x24')](_0x26a6aa)['then'](function(_0x17a9d6){return _0x17a9d6;});}return null;};}function removeEntity(_0x56cccc,_0x592c29){return function(_0xc8f314){if(_0xc8f314){return _0xc8f314[_0x3702('0x25')]()['then'](function(){var _0x104204=_0xc8f314[_0x3702('0x26')]({'plain':!![]});var _0x5d3966='ExtractedReports';return db[_0x3702('0x27')]['destroy']({'where':{'type':_0x5d3966,'resourceId':_0x104204['id']}})[_0x3702('0x28')](function(){return _0xc8f314;});})[_0x3702('0x28')](function(){_0x56cccc[_0x3702('0x1a')](0xcc)[_0x3702('0x29')]();});}};}function handleEntityNotFound(_0x2f1a1f,_0x5e3043){return function(_0x36c38c){if(!_0x36c38c){_0x2f1a1f[_0x3702('0x19')](0x194);}return _0x36c38c;};}function handleError(_0x34adb7,_0x19b20b){_0x19b20b=_0x19b20b||0x1f4;return function(_0x3f528f){logger['error'](_0x3f528f[_0x3702('0x2a')]);if(_0x3f528f[_0x3702('0x2b')]){delete _0x3f528f[_0x3702('0x2b')];}_0x34adb7[_0x3702('0x1a')](_0x19b20b)[_0x3702('0x2c')](_0x3f528f);};}exports['index']=function(_0x4c533d,_0x54c4d6){var _0x35aa43={},_0x45eac5={},_0x185994={'count':0x0,'rows':[]};var _0x998916=_[_0x3702('0x2d')](db[_0x3702('0x2e')]['rawAttributes'],function(_0x4d5baa){return{'name':_0x4d5baa[_0x3702('0x2f')],'type':_0x4d5baa[_0x3702('0x30')][_0x3702('0x31')]};});_0x45eac5[_0x3702('0x32')]=_[_0x3702('0x2d')](_0x998916,'name');_0x45eac5[_0x3702('0x33')]=_[_0x3702('0x34')](_0x4c533d[_0x3702('0x33')]);_0x45eac5['filters']=_['intersection'](_0x45eac5[_0x3702('0x32')],_0x45eac5['query']);_0x35aa43[_0x3702('0x35')]=_[_0x3702('0x36')](_0x45eac5[_0x3702('0x32')],qs['fields'](_0x4c533d[_0x3702('0x33')][_0x3702('0x37')]));_0x35aa43[_0x3702('0x35')]=_0x35aa43[_0x3702('0x35')][_0x3702('0x38')]?_0x35aa43[_0x3702('0x35')]:_0x45eac5[_0x3702('0x32')];if(!_0x4c533d[_0x3702('0x33')][_0x3702('0x39')](_0x3702('0x3a'))){_0x35aa43['limit']=qs[_0x3702('0x1e')](_0x4c533d[_0x3702('0x33')]['limit']);_0x35aa43['offset']=qs[_0x3702('0x1c')](_0x4c533d[_0x3702('0x33')]['offset']);}_0x35aa43[_0x3702('0x3b')]=qs[_0x3702('0x3c')](_0x4c533d['query']['sort']);_0x35aa43[_0x3702('0x3d')]=qs['filters'](_[_0x3702('0x3e')](_0x4c533d[_0x3702('0x33')],_0x45eac5[_0x3702('0x3f')]),_0x998916);if(_0x4c533d[_0x3702('0x33')][_0x3702('0x40')]){_0x35aa43[_0x3702('0x3d')]=_[_0x3702('0x41')](_0x35aa43['where'],{'$or':_[_0x3702('0x2d')](_0x998916,function(_0x1ad63a){if(_0x1ad63a['type']!==_0x3702('0x42')){var _0x5eb0a8={};_0x5eb0a8[_0x1ad63a['name']]={'$like':'%'+_0x4c533d['query'][_0x3702('0x40')]+'%'};return _0x5eb0a8;}})});}_0x35aa43=_['merge']({},_0x35aa43,_0x4c533d[_0x3702('0x43')]);var _0x50415d={'where':_0x35aa43[_0x3702('0x3d')]};return db[_0x3702('0x2e')][_0x3702('0x1f')](_0x50415d)[_0x3702('0x28')](function(_0x1fc529){_0x185994[_0x3702('0x1f')]=_0x1fc529;if(_0x4c533d[_0x3702('0x33')][_0x3702('0x44')]){_0x35aa43['include']=[{'all':!![]}];}return db[_0x3702('0x2e')][_0x3702('0x45')](_0x35aa43);})[_0x3702('0x28')](function(_0x48d0db){_0x185994[_0x3702('0x46')]=_0x48d0db;return _0x185994;})[_0x3702('0x28')](respondWithFilteredResult(_0x54c4d6,_0x35aa43))[_0x3702('0x47')](handleError(_0x54c4d6,null));};exports['show']=function(_0xe65521,_0x1968a5){var _0x21f0f9={'raw':!![],'where':{'id':_0xe65521[_0x3702('0x48')]['id']}},_0x200724={};_0x200724['model']=_['keys'](db[_0x3702('0x2e')]['rawAttributes']);_0x200724[_0x3702('0x33')]=_[_0x3702('0x34')](_0xe65521['query']);_0x200724[_0x3702('0x3f')]=_[_0x3702('0x36')](_0x200724[_0x3702('0x32')],_0x200724[_0x3702('0x33')]);_0x21f0f9[_0x3702('0x35')]=_[_0x3702('0x36')](_0x200724['model'],qs['fields'](_0xe65521['query'][_0x3702('0x37')]));_0x21f0f9[_0x3702('0x35')]=_0x21f0f9[_0x3702('0x35')][_0x3702('0x38')]?_0x21f0f9[_0x3702('0x35')]:_0x200724['model'];if(_0xe65521[_0x3702('0x33')]['includeAll']){_0x21f0f9['include']=[{'all':!![]}];}_0x21f0f9=_[_0x3702('0x41')]({},_0x21f0f9,_0xe65521['options']);return db[_0x3702('0x2e')][_0x3702('0x49')](_0x21f0f9)[_0x3702('0x28')](handleEntityNotFound(_0x1968a5,null))[_0x3702('0x28')](respondWithResult(_0x1968a5,null))['catch'](handleError(_0x1968a5,null));};exports[_0x3702('0x4a')]=function(_0x8ade92,_0x29b2a2){return db[_0x3702('0x2e')][_0x3702('0x4a')](_0x8ade92[_0x3702('0x4b')],{})['then'](function(_0x222878){var _0x182dc6=_0x8ade92[_0x3702('0x4c')][_0x3702('0x26')]({'plain':!![]});if(!_0x182dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x182dc6['role']===_0x3702('0x4c')){var _0x5bbb63=_0x222878[_0x3702('0x26')]({'plain':!![]});var _0x2bf85e=_0x3702('0x4d');return db[_0x3702('0x4e')]['find']({'where':{'name':_0x2bf85e,'userProfileId':_0x182dc6[_0x3702('0x4f')]},'raw':!![]})[_0x3702('0x28')](function(_0x5a9afb){if(_0x5a9afb&&_0x5a9afb[_0x3702('0x50')]===0x0){return db[_0x3702('0x27')][_0x3702('0x4a')]({'name':_0x5bbb63[_0x3702('0x2b')],'resourceId':_0x5bbb63['id'],'type':_0x5a9afb[_0x3702('0x2b')],'sectionId':_0x5a9afb['id']},{})[_0x3702('0x28')](function(){return _0x222878;});}else{return _0x222878;}})[_0x3702('0x47')](function(_0x2d528e){logger[_0x3702('0x51')](_0x3702('0x52'),_0x2d528e);throw _0x2d528e;});}return _0x222878;})[_0x3702('0x28')](respondWithResult(_0x29b2a2,0xc9))['catch'](handleError(_0x29b2a2,null));};exports[_0x3702('0x24')]=function(_0x4e0569,_0x7083dd){if(_0x4e0569[_0x3702('0x4b')]['id']){delete _0x4e0569[_0x3702('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x3702('0x49')]({'where':{'id':_0x4e0569[_0x3702('0x48')]['id']}})[_0x3702('0x28')](handleEntityNotFound(_0x7083dd,null))[_0x3702('0x28')](saveUpdates(_0x4e0569[_0x3702('0x4b')],null))[_0x3702('0x28')](respondWithResult(_0x7083dd,null))[_0x3702('0x47')](handleError(_0x7083dd,null));};exports['destroy']=function(_0x3bfb1a,_0x1b05c3){return db[_0x3702('0x2e')][_0x3702('0x49')]({'where':{'id':_0x3bfb1a[_0x3702('0x48')]['id']}})[_0x3702('0x28')](handleEntityNotFound(_0x1b05c3,null))[_0x3702('0x28')](removeEntity(_0x1b05c3,null))['catch'](handleError(_0x1b05c3,null));};exports[_0x3702('0x53')]=function(_0x2e28b8,_0x53e6ec,_0x225aaa){return db[_0x3702('0x2e')][_0x3702('0x49')]({'where':{'id':_0x2e28b8[_0x3702('0x48')]['id']},'attributes':[_0x3702('0x2b'),'basename',_0x3702('0x54'),_0x3702('0x55')],'raw':!![]})[_0x3702('0x28')](handleEntityNotFound(_0x53e6ec,null))[_0x3702('0x28')](function(_0x190159){if(_0x190159){if(!fs[_0x3702('0x56')](path[_0x3702('0x57')](config[_0x3702('0x58')],_0x3702('0x59'),_0x190159[_0x3702('0x54')]))){throw new db[(_0x3702('0x5a'))][(_0x3702('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2e28b8['query'][_0x3702('0x5c')]){return _0x53e6ec[_0x3702('0x19')](0xc8);}return _0x53e6ec[_0x3702('0x53')](path[_0x3702('0x57')](config[_0x3702('0x58')],_0x3702('0x59'),_0x190159[_0x3702('0x54')]),util['format']('%s.%s',_0x190159['basename']||_0x190159[_0x3702('0x2b')],_0x190159[_0x3702('0x55')][_0x3702('0x5d')]()));}})[_0x3702('0x47')](handleError(_0x53e6ec,null));}; \ No newline at end of file +var _0x6f71=['name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','include','findAll','rows','catch','params','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','error','download','savename','join','root','server/files/reports','Sequelize','ValidationError','exists','format','basename','output','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus'];(function(_0x1fc936,_0x22fcc3){var _0xf45083=function(_0x23368a){while(--_0x23368a){_0x1fc936['push'](_0x1fc936['shift']());}};_0xf45083(++_0x22fcc3);}(_0x6f71,0x1a4));var _0x16f7=function(_0x386b69,_0x396f3a){_0x386b69=_0x386b69-0x0;var _0x159277=_0x6f71[_0x386b69];return _0x159277;};'use strict';var emlformat=require(_0x16f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16f7('0x1'));var jsonpatch=require(_0x16f7('0x2'));var rp=require(_0x16f7('0x3'));var moment=require(_0x16f7('0x4'));var BPromise=require(_0x16f7('0x5'));var Mustache=require(_0x16f7('0x6'));var util=require(_0x16f7('0x7'));var path=require(_0x16f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x16f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16f7('0xa'));var jsforce=require(_0x16f7('0xb'));var deskjs=require(_0x16f7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x16f7('0xd'));var Redis=require(_0x16f7('0xe'));var authService=require(_0x16f7('0xf'));var qs=require(_0x16f7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16f7('0x11'));var logger=require(_0x16f7('0x12'))(_0x16f7('0x13'));var utils=require(_0x16f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x16f7('0x15'));var db=require(_0x16f7('0x16'))['db'];function respondWithStatusCode(_0x38e506,_0x267782){_0x267782=_0x267782||0xcc;return function(_0xf859af){if(_0xf859af){return _0x38e506['sendStatus'](_0x267782);}return _0x38e506[_0x16f7('0x17')](_0x267782)[_0x16f7('0x18')]();};}function respondWithResult(_0x5d85ea,_0x4e0bab){_0x4e0bab=_0x4e0bab||0xc8;return function(_0x6c7437){if(_0x6c7437){return _0x5d85ea['status'](_0x4e0bab)[_0x16f7('0x19')](_0x6c7437);}};}function respondWithFilteredResult(_0x384747,_0x69fb70){return function(_0xa7e713){if(_0xa7e713){var _0xc805e2=typeof _0x69fb70[_0x16f7('0x1a')]===_0x16f7('0x1b')&&typeof _0x69fb70[_0x16f7('0x1c')]==='undefined';var _0x43f05f=_0xa7e713[_0x16f7('0x1d')];var _0x5a88c8=_0xc805e2?0x0:_0x69fb70[_0x16f7('0x1a')];var _0x14f192=_0xc805e2?_0xa7e713[_0x16f7('0x1d')]:_0x69fb70[_0x16f7('0x1a')]+_0x69fb70[_0x16f7('0x1c')];var _0x3f5309;if(_0x14f192>=_0x43f05f){_0x14f192=_0x43f05f;_0x3f5309=0xc8;}else{_0x3f5309=0xce;}_0x384747[_0x16f7('0x17')](_0x3f5309);return _0x384747[_0x16f7('0x1e')](_0x16f7('0x1f'),_0x5a88c8+'-'+_0x14f192+'/'+_0x43f05f)[_0x16f7('0x19')](_0xa7e713);}return null;};}function patchUpdates(_0x5f329a){return function(_0x5e5c53){try{jsonpatch[_0x16f7('0x20')](_0x5e5c53,_0x5f329a,!![]);}catch(_0x537ec1){return BPromise[_0x16f7('0x21')](_0x537ec1);}return _0x5e5c53['save']();};}function saveUpdates(_0x150aff,_0x318983){return function(_0x12c84d){if(_0x12c84d){return _0x12c84d[_0x16f7('0x22')](_0x150aff)[_0x16f7('0x23')](function(_0xc6d313){return _0xc6d313;});}return null;};}function removeEntity(_0x2a28bd,_0x497b1c){return function(_0xca0191){if(_0xca0191){return _0xca0191[_0x16f7('0x24')]()['then'](function(){var _0x538ec7=_0xca0191[_0x16f7('0x25')]({'plain':!![]});var _0x4a8436='ExtractedReports';return db[_0x16f7('0x26')][_0x16f7('0x24')]({'where':{'type':_0x4a8436,'resourceId':_0x538ec7['id']}})[_0x16f7('0x23')](function(){return _0xca0191;});})[_0x16f7('0x23')](function(){_0x2a28bd[_0x16f7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15f23a,_0x408978){return function(_0x556e62){if(!_0x556e62){_0x15f23a[_0x16f7('0x27')](0x194);}return _0x556e62;};}function handleError(_0x30bc3d,_0x262011){_0x262011=_0x262011||0x1f4;return function(_0x11072a){logger['error'](_0x11072a['stack']);if(_0x11072a[_0x16f7('0x28')]){delete _0x11072a['name'];}_0x30bc3d[_0x16f7('0x17')](_0x262011)[_0x16f7('0x29')](_0x11072a);};}exports[_0x16f7('0x2a')]=function(_0x6b6317,_0x371935){var _0x123173={},_0x2818ad={},_0x14782f={'count':0x0,'rows':[]};var _0x774e40=_[_0x16f7('0x2b')](db['AnalyticExtractedReport'][_0x16f7('0x2c')],function(_0x3135cb){return{'name':_0x3135cb[_0x16f7('0x2d')],'type':_0x3135cb['type'][_0x16f7('0x2e')]};});_0x2818ad[_0x16f7('0x2f')]=_[_0x16f7('0x2b')](_0x774e40,_0x16f7('0x28'));_0x2818ad[_0x16f7('0x30')]=_['keys'](_0x6b6317[_0x16f7('0x30')]);_0x2818ad[_0x16f7('0x31')]=_[_0x16f7('0x32')](_0x2818ad[_0x16f7('0x2f')],_0x2818ad['query']);_0x123173[_0x16f7('0x33')]=_['intersection'](_0x2818ad[_0x16f7('0x2f')],qs[_0x16f7('0x34')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x34')]));_0x123173[_0x16f7('0x33')]=_0x123173[_0x16f7('0x33')][_0x16f7('0x35')]?_0x123173[_0x16f7('0x33')]:_0x2818ad[_0x16f7('0x2f')];if(!_0x6b6317[_0x16f7('0x30')][_0x16f7('0x36')](_0x16f7('0x37'))){_0x123173['limit']=qs[_0x16f7('0x1c')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x1c')]);_0x123173['offset']=qs['offset'](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x1a')]);}_0x123173[_0x16f7('0x38')]=qs[_0x16f7('0x39')](_0x6b6317[_0x16f7('0x30')][_0x16f7('0x39')]);_0x123173[_0x16f7('0x3a')]=qs[_0x16f7('0x31')](_['pick'](_0x6b6317[_0x16f7('0x30')],_0x2818ad[_0x16f7('0x31')]),_0x774e40);if(_0x6b6317[_0x16f7('0x30')][_0x16f7('0x3b')]){_0x123173[_0x16f7('0x3a')]=_[_0x16f7('0x3c')](_0x123173[_0x16f7('0x3a')],{'$or':_[_0x16f7('0x2b')](_0x774e40,function(_0x4d5140){if(_0x4d5140['type']!==_0x16f7('0x3d')){var _0x2f3c33={};_0x2f3c33[_0x4d5140['name']]={'$like':'%'+_0x6b6317[_0x16f7('0x30')][_0x16f7('0x3b')]+'%'};return _0x2f3c33;}})});}_0x123173=_[_0x16f7('0x3c')]({},_0x123173,_0x6b6317[_0x16f7('0x3e')]);var _0x16830d={'where':_0x123173[_0x16f7('0x3a')]};return db[_0x16f7('0x3f')]['count'](_0x16830d)[_0x16f7('0x23')](function(_0x379f7a){_0x14782f[_0x16f7('0x1d')]=_0x379f7a;if(_0x6b6317[_0x16f7('0x30')]['includeAll']){_0x123173[_0x16f7('0x40')]=[{'all':!![]}];}return db[_0x16f7('0x3f')][_0x16f7('0x41')](_0x123173);})['then'](function(_0x1ae5be){_0x14782f[_0x16f7('0x42')]=_0x1ae5be;return _0x14782f;})['then'](respondWithFilteredResult(_0x371935,_0x123173))[_0x16f7('0x43')](handleError(_0x371935,null));};exports['show']=function(_0x54cfda,_0x3f9c71){var _0x4198f4={'raw':!![],'where':{'id':_0x54cfda[_0x16f7('0x44')]['id']}},_0x2b2dc4={};_0x2b2dc4[_0x16f7('0x2f')]=_[_0x16f7('0x45')](db[_0x16f7('0x3f')]['rawAttributes']);_0x2b2dc4['query']=_['keys'](_0x54cfda['query']);_0x2b2dc4[_0x16f7('0x31')]=_['intersection'](_0x2b2dc4[_0x16f7('0x2f')],_0x2b2dc4[_0x16f7('0x30')]);_0x4198f4[_0x16f7('0x33')]=_[_0x16f7('0x32')](_0x2b2dc4[_0x16f7('0x2f')],qs['fields'](_0x54cfda['query'][_0x16f7('0x34')]));_0x4198f4[_0x16f7('0x33')]=_0x4198f4[_0x16f7('0x33')][_0x16f7('0x35')]?_0x4198f4[_0x16f7('0x33')]:_0x2b2dc4[_0x16f7('0x2f')];if(_0x54cfda[_0x16f7('0x30')][_0x16f7('0x46')]){_0x4198f4[_0x16f7('0x40')]=[{'all':!![]}];}_0x4198f4=_[_0x16f7('0x3c')]({},_0x4198f4,_0x54cfda[_0x16f7('0x3e')]);return db[_0x16f7('0x3f')]['find'](_0x4198f4)[_0x16f7('0x23')](handleEntityNotFound(_0x3f9c71,null))['then'](respondWithResult(_0x3f9c71,null))[_0x16f7('0x43')](handleError(_0x3f9c71,null));};exports[_0x16f7('0x47')]=function(_0x22ecca,_0x5f462f){return db['AnalyticExtractedReport'][_0x16f7('0x47')](_0x22ecca[_0x16f7('0x48')],{})[_0x16f7('0x23')](function(_0x3448a4){var _0x2b9ac2=_0x22ecca['user'][_0x16f7('0x25')]({'plain':!![]});if(!_0x2b9ac2)throw new Error(_0x16f7('0x49'));if(_0x2b9ac2['role']===_0x16f7('0x4a')){var _0x161b87=_0x3448a4[_0x16f7('0x25')]({'plain':!![]});var _0x24b2a1=_0x16f7('0x4b');return db[_0x16f7('0x4c')][_0x16f7('0x4d')]({'where':{'name':_0x24b2a1,'userProfileId':_0x2b9ac2[_0x16f7('0x4e')]},'raw':!![]})[_0x16f7('0x23')](function(_0x3e95a0){if(_0x3e95a0&&_0x3e95a0[_0x16f7('0x4f')]===0x0){return db[_0x16f7('0x26')][_0x16f7('0x47')]({'name':_0x161b87['name'],'resourceId':_0x161b87['id'],'type':_0x3e95a0['name'],'sectionId':_0x3e95a0['id']},{})['then'](function(){return _0x3448a4;});}else{return _0x3448a4;}})[_0x16f7('0x43')](function(_0x140b88){logger[_0x16f7('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140b88);throw _0x140b88;});}return _0x3448a4;})[_0x16f7('0x23')](respondWithResult(_0x5f462f,0xc9))[_0x16f7('0x43')](handleError(_0x5f462f,null));};exports[_0x16f7('0x22')]=function(_0x16446d,_0x25416d){if(_0x16446d[_0x16f7('0x48')]['id']){delete _0x16446d[_0x16f7('0x48')]['id'];}return db[_0x16f7('0x3f')]['find']({'where':{'id':_0x16446d[_0x16f7('0x44')]['id']}})[_0x16f7('0x23')](handleEntityNotFound(_0x25416d,null))['then'](saveUpdates(_0x16446d[_0x16f7('0x48')],null))['then'](respondWithResult(_0x25416d,null))[_0x16f7('0x43')](handleError(_0x25416d,null));};exports['destroy']=function(_0x565cf2,_0x4b6790){return db[_0x16f7('0x3f')][_0x16f7('0x4d')]({'where':{'id':_0x565cf2[_0x16f7('0x44')]['id']}})[_0x16f7('0x23')](handleEntityNotFound(_0x4b6790,null))[_0x16f7('0x23')](removeEntity(_0x4b6790,null))[_0x16f7('0x43')](handleError(_0x4b6790,null));};exports[_0x16f7('0x51')]=function(_0x1fae22,_0x3f9eca,_0x1b30f6){return db[_0x16f7('0x3f')][_0x16f7('0x4d')]({'where':{'id':_0x1fae22['params']['id']},'attributes':[_0x16f7('0x28'),'basename',_0x16f7('0x52'),'output'],'raw':!![]})[_0x16f7('0x23')](handleEntityNotFound(_0x3f9eca,null))[_0x16f7('0x23')](function(_0x27df65){if(_0x27df65){if(!fs['existsSync'](path[_0x16f7('0x53')](config[_0x16f7('0x54')],_0x16f7('0x55'),_0x27df65[_0x16f7('0x52')]))){throw new db[(_0x16f7('0x56'))][(_0x16f7('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1fae22[_0x16f7('0x30')][_0x16f7('0x58')]){return _0x3f9eca['sendStatus'](0xc8);}return _0x3f9eca[_0x16f7('0x51')](path[_0x16f7('0x53')](config[_0x16f7('0x54')],_0x16f7('0x55'),_0x27df65[_0x16f7('0x52')]),util[_0x16f7('0x59')]('%s.%s',_0x27df65[_0x16f7('0x5a')]||_0x27df65[_0x16f7('0x28')],_0x27df65[_0x16f7('0x5b')]['toLowerCase']()));}})[_0x16f7('0x43')](handleError(_0x3f9eca,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index df28efe..0a4fa6c 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 _0xb4af=['exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise'];(function(_0x43361e,_0x350f7f){var _0x1b3560=function(_0x1bebdd){while(--_0x1bebdd){_0x43361e['push'](_0x43361e['shift']());}};_0x1b3560(++_0x350f7f);}(_0xb4af,0x1c5));var _0xfb4a=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb4af[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xfb4a('0x0'));var util=require(_0xfb4a('0x1'));var logger=require('../../config/logger')(_0xfb4a('0x2'));var moment=require(_0xfb4a('0x3'));var BPromise=require(_0xfb4a('0x4'));var rp=require(_0xfb4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xfb4a('0x6')]=function(_0x1d5730,_0x482a3c){return _0x1d5730['define'](_0xfb4a('0x7'),attributes,{'tableName':_0xfb4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02b5=['analytics_extracted_reports','lodash','util','api','moment','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x282700,_0x270bc0){var _0x178681=function(_0x1f97c9){while(--_0x1f97c9){_0x282700['push'](_0x282700['shift']());}};_0x178681(++_0x270bc0);}(_0x02b5,0xb5));var _0x502b=function(_0xabfdd,_0x3b1589){_0xabfdd=_0xabfdd-0x0;var _0x25c06c=_0x02b5[_0xabfdd];return _0x25c06c;};'use strict';var _=require(_0x502b('0x0'));var util=require(_0x502b('0x1'));var logger=require('../../config/logger')(_0x502b('0x2'));var moment=require(_0x502b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x502b('0x4'));var config=require('../../config/environment');var attributes=require(_0x502b('0x5'));module['exports']=function(_0xf6b476,_0x4aad80){return _0xf6b476[_0x502b('0x6')](_0x502b('0x7'),attributes,{'tableName':_0x502b('0x8'),'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 c70c149..8fcc022 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 _0x4c86=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5641d9,_0x1de53b){var _0x1b1f89=function(_0x27b5b3){while(--_0x27b5b3){_0x5641d9['push'](_0x5641d9['shift']());}};_0x1b1f89(++_0x1de53b);}(_0x4c86,0x8e));var _0x64c8=function(_0x4577e0,_0x34bffb){_0x4577e0=_0x4577e0-0x0;var _0x31f524=_0x4c86[_0x4577e0];return _0x31f524;};'use strict';var _=require(_0x64c8('0x0'));var util=require(_0x64c8('0x1'));var moment=require('moment');var BPromise=require(_0x64c8('0x2'));var rs=require(_0x64c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x64c8('0x4'));var logger=require(_0x64c8('0x5'))(_0x64c8('0x6'));var config=require(_0x64c8('0x7'));var jayson=require(_0x64c8('0x8'));var client=jayson[_0x64c8('0x9')][_0x64c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46171f,_0x3bf4b7,_0x334f07){return new BPromise(function(_0xa8ac03,_0x5b9c9f){return client[_0x64c8('0xb')](_0x46171f,_0x334f07)[_0x64c8('0xc')](function(_0x1470fa){logger[_0x64c8('0xd')](_0x64c8('0xe'),_0x3bf4b7,_0x64c8('0xf'));logger[_0x64c8('0x10')](_0x64c8('0x11'),_0x3bf4b7,_0x64c8('0xf'),JSON[_0x64c8('0x12')](_0x1470fa));if(_0x1470fa[_0x64c8('0x13')]){if(_0x1470fa[_0x64c8('0x13')][_0x64c8('0x14')]===0x1f4){logger[_0x64c8('0x13')](_0x64c8('0xe'),_0x3bf4b7,_0x1470fa['error']['message']);return _0x5b9c9f(_0x1470fa[_0x64c8('0x13')][_0x64c8('0x15')]);}logger[_0x64c8('0x13')](_0x64c8('0xe'),_0x3bf4b7,_0x1470fa[_0x64c8('0x13')][_0x64c8('0x15')]);return _0xa8ac03(_0x1470fa[_0x64c8('0x13')][_0x64c8('0x15')]);}else{logger['info'](_0x64c8('0xe'),_0x3bf4b7,_0x64c8('0xf'));_0xa8ac03(_0x1470fa[_0x64c8('0x16')][_0x64c8('0x15')]);}})[_0x64c8('0x17')](function(_0x28bbb0){logger[_0x64c8('0x13')](_0x64c8('0xe'),_0x3bf4b7,_0x28bbb0);_0x5b9c9f(_0x28bbb0);});});} \ No newline at end of file +var _0x3743=['code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','stringify','error'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3743,0xd1));var _0x3374=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x3743[_0x46a671];return _0x526d75;};'use strict';var _=require(_0x3374('0x0'));var util=require('util');var moment=require(_0x3374('0x1'));var BPromise=require('bluebird');var rs=require(_0x3374('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3374('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3374('0x4'));var client=jayson[_0x3374('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x230a13,_0x58333f,_0xb537e6){return new BPromise(function(_0x2f6287,_0x12189f){return client['request'](_0x230a13,_0xb537e6)[_0x3374('0x6')](function(_0x5d3880){logger[_0x3374('0x7')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'));logger[_0x3374('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'),JSON[_0x3374('0xa')](_0x5d3880));if(_0x5d3880[_0x3374('0xb')]){if(_0x5d3880[_0x3374('0xb')][_0x3374('0xc')]===0x1f4){logger['error'](_0x3374('0xd'),_0x58333f,_0x5d3880[_0x3374('0xb')][_0x3374('0xe')]);return _0x12189f(_0x5d3880['error']['message']);}logger[_0x3374('0xb')](_0x3374('0xd'),_0x58333f,_0x5d3880['error'][_0x3374('0xe')]);return _0x2f6287(_0x5d3880[_0x3374('0xb')]['message']);}else{logger[_0x3374('0x7')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58333f,_0x3374('0x8'));_0x2f6287(_0x5d3880[_0x3374('0xf')][_0x3374('0xe')]);}})[_0x3374('0x10')](function(_0x3ce639){logger['error'](_0x3374('0xd'),_0x58333f,_0x3ce639);_0x12189f(_0x3ce639);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 73136aa..ca83bd1 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 _0x9e4c=['../../config/environment','isAuthenticated','get','/:id/download','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48531e,_0x402d8b){var _0x1a97a9=function(_0x8dd53b){while(--_0x8dd53b){_0x48531e['push'](_0x48531e['shift']());}};_0x1a97a9(++_0x402d8b);}(_0x9e4c,0xc9));var _0xc9e4=function(_0x33dda7,_0xf1a77b){_0x33dda7=_0x33dda7-0x0;var _0x24eb43=_0x9e4c[_0x33dda7];return _0x24eb43;};'use strict';var multer=require(_0xc9e4('0x0'));var util=require('util');var path=require(_0xc9e4('0x1'));var timeout=require(_0xc9e4('0x2'));var express=require(_0xc9e4('0x3'));var router=express[_0xc9e4('0x4')]();var fs_extra=require(_0xc9e4('0x5'));var auth=require(_0xc9e4('0x6'));var interaction=require(_0xc9e4('0x7'));var config=require(_0xc9e4('0x8'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xc9e4('0x9')](),controller['index']);router[_0xc9e4('0xa')]('/:id',auth[_0xc9e4('0x9')](),controller['show']);router['get'](_0xc9e4('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xc9e4('0xc')]('/',auth[_0xc9e4('0x9')](),controller[_0xc9e4('0xd')]);router[_0xc9e4('0xe')]('/:id',auth[_0xc9e4('0x9')](),controller[_0xc9e4('0xf')]);router[_0xc9e4('0x10')](_0xc9e4('0x11'),auth[_0xc9e4('0x9')](),controller[_0xc9e4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x55dc=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x55dc,0x10e));var _0xc55d=function(_0xdaa031,_0x1b6b9d){_0xdaa031=_0xdaa031-0x0;var _0x17b754=_0x55dc[_0xdaa031];return _0x17b754;};'use strict';var multer=require('multer');var util=require(_0xc55d('0x0'));var path=require(_0xc55d('0x1'));var timeout=require(_0xc55d('0x2'));var express=require(_0xc55d('0x3'));var router=express['Router']();var fs_extra=require(_0xc55d('0x4'));var auth=require(_0xc55d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc55d('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xc55d('0x7')]('/',auth[_0xc55d('0x8')](),controller[_0xc55d('0x9')]);router[_0xc55d('0x7')](_0xc55d('0xa'),auth[_0xc55d('0x8')](),controller['show']);router[_0xc55d('0x7')](_0xc55d('0xb'),auth['isAuthenticated'](),controller[_0xc55d('0xc')]);router[_0xc55d('0xd')]('/',auth['isAuthenticated'](),controller[_0xc55d('0xe')]);router[_0xc55d('0xf')](_0xc55d('0xa'),auth['isAuthenticated'](),controller[_0xc55d('0x10')]);router['delete'](_0xc55d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc55d('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 2f7c5f3..dd4e090 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 _0x1bb2=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3aae83,_0x11d202){var _0x1a21ba=function(_0xf2b23e){while(--_0xf2b23e){_0x3aae83['push'](_0x3aae83['shift']());}};_0x1a21ba(++_0x11d202);}(_0x1bb2,0x8e));var _0x21bb=function(_0x25b064,_0x27f3fb){_0x25b064=_0x25b064-0x0;var _0x533a84=_0x1bb2[_0x25b064];return _0x533a84;};'use strict';var Sequelize=require(_0x21bb('0x0'));module[_0x21bb('0x1')]={'field':{'type':Sequelize[_0x21bb('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x21bb('0x3')]},'format':{'type':Sequelize[_0x21bb('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x21bb('0x3')]},'custom':{'type':Sequelize[_0x21bb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x78ed=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x78ed,0xec));var _0xd78e=function(_0x21f75e,_0x3ccd22){_0x21f75e=_0x21f75e-0x0;var _0x5f2c0f=_0x78ed[_0x21f75e];return _0x5f2c0f;};'use strict';var Sequelize=require(_0xd78e('0x0'));module[_0xd78e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd78e('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xd78e('0x2')]},'groupBy':{'type':Sequelize[_0xd78e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9b4beda..5f0beb1 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 _0xf0bf=['stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','length','find','catch','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','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','offset','undefined','limit','count','set','json','reject','update','then','error'];(function(_0x200b47,_0x23670f){var _0x577a7b=function(_0x4d1cad){while(--_0x4d1cad){_0x200b47['push'](_0x200b47['shift']());}};_0x577a7b(++_0x23670f);}(_0xf0bf,0xd8));var _0xff0b=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xf0bf[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xff0b('0x0'));var rimraf=require(_0xff0b('0x1'));var zipdir=require(_0xff0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff0b('0x3'));var BPromise=require(_0xff0b('0x4'));var Mustache=require(_0xff0b('0x5'));var util=require(_0xff0b('0x6'));var path=require(_0xff0b('0x7'));var sox=require(_0xff0b('0x8'));var csv=require('to-csv');var ejs=require(_0xff0b('0x9'));var fs=require('fs');var fs_extra=require(_0xff0b('0xa'));var _=require(_0xff0b('0xb'));var squel=require('squel');var crypto=require(_0xff0b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff0b('0xd'));var querystring=require(_0xff0b('0xe'));var Papa=require(_0xff0b('0xf'));var Redis=require(_0xff0b('0x10'));var authService=require(_0xff0b('0x11'));var qs=require(_0xff0b('0x12'));var as=require(_0xff0b('0x13'));var hardwareService=require(_0xff0b('0x14'));var logger=require(_0xff0b('0x15'))('api');var utils=require(_0xff0b('0x16'));var config=require(_0xff0b('0x17'));var licenseUtil=require(_0xff0b('0x18'));var db=require(_0xff0b('0x19'))['db'];function respondWithStatusCode(_0x1967ef,_0x3f672d){_0x3f672d=_0x3f672d||0xcc;return function(_0x4e8d21){if(_0x4e8d21){return _0x1967ef[_0xff0b('0x1a')](_0x3f672d);}return _0x1967ef[_0xff0b('0x1b')](_0x3f672d)[_0xff0b('0x1c')]();};}function respondWithResult(_0x3516bc,_0x3bca7e){_0x3bca7e=_0x3bca7e||0xc8;return function(_0xd5520f){if(_0xd5520f){return _0x3516bc[_0xff0b('0x1b')](_0x3bca7e)['json'](_0xd5520f);}};}function respondWithFilteredResult(_0x7a0ca,_0x314179){return function(_0xe75e40){if(_0xe75e40){var _0x3ee714=typeof _0x314179[_0xff0b('0x1d')]===_0xff0b('0x1e')&&typeof _0x314179[_0xff0b('0x1f')]===_0xff0b('0x1e');var _0x5b39c7=_0xe75e40[_0xff0b('0x20')];var _0x2e62b8=_0x3ee714?0x0:_0x314179[_0xff0b('0x1d')];var _0x164930=_0x3ee714?_0xe75e40[_0xff0b('0x20')]:_0x314179[_0xff0b('0x1d')]+_0x314179['limit'];var _0x5aba06;if(_0x164930>=_0x5b39c7){_0x164930=_0x5b39c7;_0x5aba06=0xc8;}else{_0x5aba06=0xce;}_0x7a0ca[_0xff0b('0x1b')](_0x5aba06);return _0x7a0ca[_0xff0b('0x21')]('Content-Range',_0x2e62b8+'-'+_0x164930+'/'+_0x5b39c7)[_0xff0b('0x22')](_0xe75e40);}return null;};}function patchUpdates(_0x3a634a){return function(_0x3e0d22){try{jsonpatch['apply'](_0x3e0d22,_0x3a634a,!![]);}catch(_0x5205f2){return BPromise[_0xff0b('0x23')](_0x5205f2);}return _0x3e0d22['save']();};}function saveUpdates(_0x5596d1,_0x38fc9c){return function(_0x86758c){if(_0x86758c){return _0x86758c[_0xff0b('0x24')](_0x5596d1)['then'](function(_0x4caf54){return _0x4caf54;});}return null;};}function removeEntity(_0x1a392b,_0x1b92d4){return function(_0x4af4db){if(_0x4af4db){return _0x4af4db['destroy']()[_0xff0b('0x25')](function(){_0x1a392b[_0xff0b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ef7b,_0x38b484){return function(_0x472d63){if(!_0x472d63){_0x18ef7b['sendStatus'](0x194);}return _0x472d63;};}function handleError(_0x4049ef,_0x2e3a98){_0x2e3a98=_0x2e3a98||0x1f4;return function(_0x24e58d){logger[_0xff0b('0x26')](_0x24e58d[_0xff0b('0x27')]);if(_0x24e58d[_0xff0b('0x28')]){delete _0x24e58d[_0xff0b('0x28')];}_0x4049ef[_0xff0b('0x1b')](_0x2e3a98)[_0xff0b('0x29')](_0x24e58d);};}exports[_0xff0b('0x2a')]=function(_0x4df610,_0x270661){var _0x42fa43={},_0x468351={},_0x1b61e0={'count':0x0,'rows':[]};var _0x5325d4=_[_0xff0b('0x2b')](db[_0xff0b('0x2c')][_0xff0b('0x2d')],function(_0x20cbae){return{'name':_0x20cbae[_0xff0b('0x2e')],'type':_0x20cbae[_0xff0b('0x2f')][_0xff0b('0x30')]};});_0x468351[_0xff0b('0x31')]=_[_0xff0b('0x2b')](_0x5325d4,_0xff0b('0x28'));_0x468351['query']=_[_0xff0b('0x32')](_0x4df610[_0xff0b('0x33')]);_0x468351[_0xff0b('0x34')]=_[_0xff0b('0x35')](_0x468351[_0xff0b('0x31')],_0x468351['query']);_0x42fa43[_0xff0b('0x36')]=_[_0xff0b('0x35')](_0x468351['model'],qs['fields'](_0x4df610[_0xff0b('0x33')]['fields']));_0x42fa43['attributes']=_0x42fa43[_0xff0b('0x36')]['length']?_0x42fa43[_0xff0b('0x36')]:_0x468351[_0xff0b('0x31')];if(!_0x4df610[_0xff0b('0x33')][_0xff0b('0x37')](_0xff0b('0x38'))){_0x42fa43[_0xff0b('0x1f')]=qs[_0xff0b('0x1f')](_0x4df610[_0xff0b('0x33')]['limit']);_0x42fa43[_0xff0b('0x1d')]=qs[_0xff0b('0x1d')](_0x4df610[_0xff0b('0x33')][_0xff0b('0x1d')]);}_0x42fa43[_0xff0b('0x39')]=qs[_0xff0b('0x3a')](_0x4df610[_0xff0b('0x33')][_0xff0b('0x3a')]);_0x42fa43['where']=qs[_0xff0b('0x34')](_['pick'](_0x4df610[_0xff0b('0x33')],_0x468351[_0xff0b('0x34')]),_0x5325d4);if(_0x4df610[_0xff0b('0x33')][_0xff0b('0x3b')]){_0x42fa43[_0xff0b('0x3c')]=_[_0xff0b('0x3d')](_0x42fa43['where'],{'$or':_[_0xff0b('0x2b')](_0x5325d4,function(_0x32ff93){if(_0x32ff93[_0xff0b('0x2f')]!==_0xff0b('0x3e')){var _0x465ec9={};_0x465ec9[_0x32ff93[_0xff0b('0x28')]]={'$like':'%'+_0x4df610[_0xff0b('0x33')][_0xff0b('0x3b')]+'%'};return _0x465ec9;}})});}_0x42fa43=_[_0xff0b('0x3d')]({},_0x42fa43,_0x4df610[_0xff0b('0x3f')]);var _0x2067cb={'where':_0x42fa43[_0xff0b('0x3c')]};return db[_0xff0b('0x2c')]['count'](_0x2067cb)[_0xff0b('0x25')](function(_0x2247c5){_0x1b61e0['count']=_0x2247c5;if(_0x4df610[_0xff0b('0x33')][_0xff0b('0x40')]){_0x42fa43[_0xff0b('0x41')]=[{'all':!![]}];}return db[_0xff0b('0x2c')][_0xff0b('0x42')](_0x42fa43);})[_0xff0b('0x25')](function(_0x2f8287){_0x1b61e0[_0xff0b('0x43')]=_0x2f8287;return _0x1b61e0;})[_0xff0b('0x25')](respondWithFilteredResult(_0x270661,_0x42fa43))['catch'](handleError(_0x270661,null));};exports[_0xff0b('0x44')]=function(_0x1b7b93,_0x348c13){var _0x12b055={'raw':![],'where':{'id':_0x1b7b93[_0xff0b('0x45')]['id']}},_0x52c807={};_0x52c807[_0xff0b('0x31')]=_['keys'](db['AnalyticFieldReport'][_0xff0b('0x2d')]);_0x52c807[_0xff0b('0x33')]=_[_0xff0b('0x32')](_0x1b7b93[_0xff0b('0x33')]);_0x52c807[_0xff0b('0x34')]=_[_0xff0b('0x35')](_0x52c807[_0xff0b('0x31')],_0x52c807[_0xff0b('0x33')]);_0x12b055[_0xff0b('0x36')]=_[_0xff0b('0x35')](_0x52c807[_0xff0b('0x31')],qs['fields'](_0x1b7b93[_0xff0b('0x33')][_0xff0b('0x46')]));_0x12b055[_0xff0b('0x36')]=_0x12b055[_0xff0b('0x36')][_0xff0b('0x47')]?_0x12b055[_0xff0b('0x36')]:_0x52c807['model'];if(_0x1b7b93[_0xff0b('0x33')][_0xff0b('0x40')]){_0x12b055[_0xff0b('0x41')]=[{'all':!![]}];}_0x12b055=_['merge']({},_0x12b055,_0x1b7b93[_0xff0b('0x3f')]);return db[_0xff0b('0x2c')][_0xff0b('0x48')](_0x12b055)[_0xff0b('0x25')](handleEntityNotFound(_0x348c13,null))[_0xff0b('0x25')](respondWithResult(_0x348c13,null))[_0xff0b('0x49')](handleError(_0x348c13,null));};exports[_0xff0b('0x4a')]=function(_0x4405b8,_0x454b52){return db['AnalyticFieldReport'][_0xff0b('0x4a')](_0x4405b8[_0xff0b('0x4b')],{})[_0xff0b('0x25')](respondWithResult(_0x454b52,0xc9))[_0xff0b('0x49')](handleError(_0x454b52,null));};exports['bulkCreate']=function(_0xdce8ec,_0x2edb5d){return db['AnalyticFieldReport'][_0xff0b('0x4c')](_0xdce8ec[_0xff0b('0x4b')],{'raw':![],'individualHooks':!![]})[_0xff0b('0x25')](respondWithResult(_0x2edb5d,0xc9))[_0xff0b('0x49')](handleError(_0x2edb5d,null));};exports[_0xff0b('0x24')]=function(_0x5174ba,_0x2c03ce){if(_0x5174ba[_0xff0b('0x4b')]['id']){delete _0x5174ba['body']['id'];}return db[_0xff0b('0x2c')]['find']({'where':{'id':_0x5174ba[_0xff0b('0x45')]['id']}})[_0xff0b('0x25')](handleEntityNotFound(_0x2c03ce,null))[_0xff0b('0x25')](saveUpdates(_0x5174ba[_0xff0b('0x4b')],null))['then'](respondWithResult(_0x2c03ce,null))[_0xff0b('0x49')](handleError(_0x2c03ce,null));};exports[_0xff0b('0x4d')]=function(_0x716764,_0x1b7433){return db[_0xff0b('0x2c')][_0xff0b('0x48')]({'where':{'id':_0x716764['params']['id']}})[_0xff0b('0x25')](handleEntityNotFound(_0x1b7433,null))[_0xff0b('0x25')](removeEntity(_0x1b7433,null))[_0xff0b('0x49')](handleError(_0x1b7433,null));};exports[_0xff0b('0x4e')]=function(_0x167bfc,_0x1513a7){return db['AnalyticFieldReport'][_0xff0b('0x4d')]({'where':{'id':_0x167bfc['query'][_0xff0b('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0xff0b('0x25')](respondWithResult(_0x1513a7,0xcc))[_0xff0b('0x49')](handleError(_0x1513a7,null));};exports[_0xff0b('0x50')]=function(_0x2e1d30,_0x22a81d,_0x512237){return db[_0xff0b('0x51')][_0xff0b('0x52')]({'where':{'id':_0x2e1d30[_0xff0b('0x45')]['id']}})[_0xff0b('0x25')](handleEntityNotFound(_0x22a81d,null))['then'](function(_0x317f70){if(_0x317f70){return db['sequelize'][_0xff0b('0x53')](function(_0x8a5a96){return db[_0xff0b('0x2c')][_0xff0b('0x4d')]({'where':{'CustomReportId':_0x2e1d30['params']['id']},'transaction':_0x8a5a96})[_0xff0b('0x25')](function(_0x21d116){var _0x5287d5=_['map'](_0x2e1d30[_0xff0b('0x4b')],function(_0x278b99){delete _0x278b99['id'];_0x278b99[_0xff0b('0x54')]=_0x2e1d30[_0xff0b('0x45')]['id'];return _0x278b99;});return db[_0xff0b('0x2c')]['bulkCreate'](_0x5287d5,{'transaction':_0x8a5a96});});})[_0xff0b('0x25')](function(){return db[_0xff0b('0x2c')]['findAll']({'where':{'CustomReportId':_0x2e1d30[_0xff0b('0x45')]['id']}});});}})['then'](respondWithResult(_0x22a81d,null))[_0xff0b('0x49')](handleError(_0x22a81d,null));}; \ No newline at end of file +var _0x613e=['body','params','bulkDestroy','ids','addFields','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','find','create','bulkCreate'];(function(_0x391eb4,_0x5a855a){var _0x40079c=function(_0x125d66){while(--_0x125d66){_0x391eb4['push'](_0x391eb4['shift']());}};_0x40079c(++_0x5a855a);}(_0x613e,0xa7));var _0xe613=function(_0x15b552,_0x27f26b){_0x15b552=_0x15b552-0x0;var _0x3a9523=_0x613e[_0x15b552];return _0x3a9523;};'use strict';var emlformat=require(_0xe613('0x0'));var rimraf=require(_0xe613('0x1'));var zipdir=require(_0xe613('0x2'));var jsonpatch=require(_0xe613('0x3'));var rp=require(_0xe613('0x4'));var moment=require(_0xe613('0x5'));var BPromise=require(_0xe613('0x6'));var Mustache=require('mustache');var util=require(_0xe613('0x7'));var path=require(_0xe613('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe613('0x9'));var _=require(_0xe613('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe613('0xb'));var deskjs=require(_0xe613('0xc'));var toCsv=require(_0xe613('0xd'));var querystring=require(_0xe613('0xe'));var Papa=require(_0xe613('0xf'));var Redis=require(_0xe613('0x10'));var authService=require(_0xe613('0x11'));var qs=require(_0xe613('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe613('0x13'));var logger=require(_0xe613('0x14'))('api');var utils=require(_0xe613('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe613('0x16'))['db'];function respondWithStatusCode(_0x1c5188,_0x5b7af0){_0x5b7af0=_0x5b7af0||0xcc;return function(_0x477225){if(_0x477225){return _0x1c5188['sendStatus'](_0x5b7af0);}return _0x1c5188[_0xe613('0x17')](_0x5b7af0)[_0xe613('0x18')]();};}function respondWithResult(_0x373f28,_0x395502){_0x395502=_0x395502||0xc8;return function(_0x5c8f29){if(_0x5c8f29){return _0x373f28[_0xe613('0x17')](_0x395502)['json'](_0x5c8f29);}};}function respondWithFilteredResult(_0x100fc1,_0x4e024d){return function(_0x511cf8){if(_0x511cf8){var _0xc4ff83=typeof _0x4e024d['offset']===_0xe613('0x19')&&typeof _0x4e024d[_0xe613('0x1a')]==='undefined';var _0x5d7608=_0x511cf8[_0xe613('0x1b')];var _0x4dd212=_0xc4ff83?0x0:_0x4e024d[_0xe613('0x1c')];var _0x767989=_0xc4ff83?_0x511cf8['count']:_0x4e024d[_0xe613('0x1c')]+_0x4e024d[_0xe613('0x1a')];var _0x27842e;if(_0x767989>=_0x5d7608){_0x767989=_0x5d7608;_0x27842e=0xc8;}else{_0x27842e=0xce;}_0x100fc1['status'](_0x27842e);return _0x100fc1['set'](_0xe613('0x1d'),_0x4dd212+'-'+_0x767989+'/'+_0x5d7608)[_0xe613('0x1e')](_0x511cf8);}return null;};}function patchUpdates(_0x1ae539){return function(_0x283128){try{jsonpatch[_0xe613('0x1f')](_0x283128,_0x1ae539,!![]);}catch(_0x1fc67c){return BPromise[_0xe613('0x20')](_0x1fc67c);}return _0x283128[_0xe613('0x21')]();};}function saveUpdates(_0x744e7e,_0x56d677){return function(_0x46fe1d){if(_0x46fe1d){return _0x46fe1d[_0xe613('0x22')](_0x744e7e)[_0xe613('0x23')](function(_0x18ae16){return _0x18ae16;});}return null;};}function removeEntity(_0x56bc4d,_0x39b30e){return function(_0x3d7b1b){if(_0x3d7b1b){return _0x3d7b1b[_0xe613('0x24')]()[_0xe613('0x23')](function(){_0x56bc4d[_0xe613('0x17')](0xcc)[_0xe613('0x18')]();});}};}function handleEntityNotFound(_0x8735b1,_0x5da3d6){return function(_0x3fbc62){if(!_0x3fbc62){_0x8735b1[_0xe613('0x25')](0x194);}return _0x3fbc62;};}function handleError(_0x1af053,_0x2be5ca){_0x2be5ca=_0x2be5ca||0x1f4;return function(_0x1404fb){logger[_0xe613('0x26')](_0x1404fb[_0xe613('0x27')]);if(_0x1404fb[_0xe613('0x28')]){delete _0x1404fb[_0xe613('0x28')];}_0x1af053[_0xe613('0x17')](_0x2be5ca)['send'](_0x1404fb);};}exports['index']=function(_0x1edc4a,_0x410372){var _0x2798af={},_0x41b0eb={},_0x5a7281={'count':0x0,'rows':[]};var _0x19ad60=_['map'](db[_0xe613('0x29')][_0xe613('0x2a')],function(_0x3ffaf5){return{'name':_0x3ffaf5[_0xe613('0x2b')],'type':_0x3ffaf5[_0xe613('0x2c')]['key']};});_0x41b0eb[_0xe613('0x2d')]=_[_0xe613('0x2e')](_0x19ad60,_0xe613('0x28'));_0x41b0eb['query']=_['keys'](_0x1edc4a[_0xe613('0x2f')]);_0x41b0eb[_0xe613('0x30')]=_[_0xe613('0x31')](_0x41b0eb[_0xe613('0x2d')],_0x41b0eb['query']);_0x2798af[_0xe613('0x32')]=_['intersection'](_0x41b0eb[_0xe613('0x2d')],qs[_0xe613('0x33')](_0x1edc4a[_0xe613('0x2f')]['fields']));_0x2798af['attributes']=_0x2798af[_0xe613('0x32')][_0xe613('0x34')]?_0x2798af['attributes']:_0x41b0eb[_0xe613('0x2d')];if(!_0x1edc4a['query'][_0xe613('0x35')](_0xe613('0x36'))){_0x2798af[_0xe613('0x1a')]=qs[_0xe613('0x1a')](_0x1edc4a[_0xe613('0x2f')][_0xe613('0x1a')]);_0x2798af[_0xe613('0x1c')]=qs[_0xe613('0x1c')](_0x1edc4a['query'][_0xe613('0x1c')]);}_0x2798af[_0xe613('0x37')]=qs[_0xe613('0x38')](_0x1edc4a['query']['sort']);_0x2798af['where']=qs[_0xe613('0x30')](_[_0xe613('0x39')](_0x1edc4a[_0xe613('0x2f')],_0x41b0eb[_0xe613('0x30')]),_0x19ad60);if(_0x1edc4a[_0xe613('0x2f')]['filter']){_0x2798af[_0xe613('0x3a')]=_['merge'](_0x2798af[_0xe613('0x3a')],{'$or':_[_0xe613('0x2e')](_0x19ad60,function(_0x1e4a2b){if(_0x1e4a2b[_0xe613('0x2c')]!==_0xe613('0x3b')){var _0x14cb53={};_0x14cb53[_0x1e4a2b[_0xe613('0x28')]]={'$like':'%'+_0x1edc4a[_0xe613('0x2f')][_0xe613('0x3c')]+'%'};return _0x14cb53;}})});}_0x2798af=_[_0xe613('0x3d')]({},_0x2798af,_0x1edc4a[_0xe613('0x3e')]);var _0x1151f5={'where':_0x2798af[_0xe613('0x3a')]};return db[_0xe613('0x29')][_0xe613('0x1b')](_0x1151f5)[_0xe613('0x23')](function(_0x3c844){_0x5a7281['count']=_0x3c844;if(_0x1edc4a[_0xe613('0x2f')][_0xe613('0x3f')]){_0x2798af['include']=[{'all':!![]}];}return db[_0xe613('0x29')][_0xe613('0x40')](_0x2798af);})[_0xe613('0x23')](function(_0xa0634){_0x5a7281[_0xe613('0x41')]=_0xa0634;return _0x5a7281;})[_0xe613('0x23')](respondWithFilteredResult(_0x410372,_0x2798af))[_0xe613('0x42')](handleError(_0x410372,null));};exports[_0xe613('0x43')]=function(_0x5c2e56,_0x5542c4){var _0x5eda54={'raw':![],'where':{'id':_0x5c2e56['params']['id']}},_0x2266e8={};_0x2266e8[_0xe613('0x2d')]=_['keys'](db[_0xe613('0x29')][_0xe613('0x2a')]);_0x2266e8['query']=_[_0xe613('0x44')](_0x5c2e56[_0xe613('0x2f')]);_0x2266e8[_0xe613('0x30')]=_[_0xe613('0x31')](_0x2266e8[_0xe613('0x2d')],_0x2266e8['query']);_0x5eda54[_0xe613('0x32')]=_[_0xe613('0x31')](_0x2266e8[_0xe613('0x2d')],qs['fields'](_0x5c2e56[_0xe613('0x2f')][_0xe613('0x33')]));_0x5eda54[_0xe613('0x32')]=_0x5eda54['attributes']['length']?_0x5eda54['attributes']:_0x2266e8[_0xe613('0x2d')];if(_0x5c2e56['query'][_0xe613('0x3f')]){_0x5eda54[_0xe613('0x45')]=[{'all':!![]}];}_0x5eda54=_[_0xe613('0x3d')]({},_0x5eda54,_0x5c2e56[_0xe613('0x3e')]);return db['AnalyticFieldReport'][_0xe613('0x46')](_0x5eda54)[_0xe613('0x23')](handleEntityNotFound(_0x5542c4,null))[_0xe613('0x23')](respondWithResult(_0x5542c4,null))[_0xe613('0x42')](handleError(_0x5542c4,null));};exports[_0xe613('0x47')]=function(_0xd12708,_0x3affb1){return db[_0xe613('0x29')]['create'](_0xd12708['body'],{})[_0xe613('0x23')](respondWithResult(_0x3affb1,0xc9))['catch'](handleError(_0x3affb1,null));};exports[_0xe613('0x48')]=function(_0x5f4415,_0x53e86f){return db[_0xe613('0x29')][_0xe613('0x48')](_0x5f4415[_0xe613('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53e86f,0xc9))[_0xe613('0x42')](handleError(_0x53e86f,null));};exports['update']=function(_0x17ae16,_0x37839d){if(_0x17ae16[_0xe613('0x49')]['id']){delete _0x17ae16[_0xe613('0x49')]['id'];}return db[_0xe613('0x29')][_0xe613('0x46')]({'where':{'id':_0x17ae16['params']['id']}})[_0xe613('0x23')](handleEntityNotFound(_0x37839d,null))['then'](saveUpdates(_0x17ae16[_0xe613('0x49')],null))[_0xe613('0x23')](respondWithResult(_0x37839d,null))[_0xe613('0x42')](handleError(_0x37839d,null));};exports[_0xe613('0x24')]=function(_0x283bb2,_0x424ca6){return db['AnalyticFieldReport'][_0xe613('0x46')]({'where':{'id':_0x283bb2[_0xe613('0x4a')]['id']}})[_0xe613('0x23')](handleEntityNotFound(_0x424ca6,null))[_0xe613('0x23')](removeEntity(_0x424ca6,null))[_0xe613('0x42')](handleError(_0x424ca6,null));};exports[_0xe613('0x4b')]=function(_0x2f9e75,_0x27d62e){return db[_0xe613('0x29')][_0xe613('0x24')]({'where':{'id':_0x2f9e75[_0xe613('0x2f')][_0xe613('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x27d62e,0xcc))[_0xe613('0x42')](handleError(_0x27d62e,null));};exports[_0xe613('0x4d')]=function(_0x923701,_0x2f9436,_0x261a3e){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x923701['params']['id']}})['then'](handleEntityNotFound(_0x2f9436,null))[_0xe613('0x23')](function(_0x4e9618){if(_0x4e9618){return db['sequelize'][_0xe613('0x4e')](function(_0x323864){return db[_0xe613('0x29')][_0xe613('0x24')]({'where':{'CustomReportId':_0x923701[_0xe613('0x4a')]['id']},'transaction':_0x323864})[_0xe613('0x23')](function(_0x2c0a0a){var _0x4d5ee1=_[_0xe613('0x2e')](_0x923701[_0xe613('0x49')],function(_0x4c29cb){delete _0x4c29cb['id'];_0x4c29cb[_0xe613('0x4f')]=_0x923701[_0xe613('0x4a')]['id'];return _0x4c29cb;});return db['AnalyticFieldReport']['bulkCreate'](_0x4d5ee1,{'transaction':_0x323864});});})[_0xe613('0x23')](function(){return db[_0xe613('0x29')][_0xe613('0x40')]({'where':{'CustomReportId':_0x923701['params']['id']}});});}})[_0xe613('0x23')](respondWithResult(_0x2f9436,null))['catch'](handleError(_0x2f9436,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index efb25aa..551a45c 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 _0xb3d2=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticFieldReport','analytics_report_fields','util'];(function(_0x1ea4e6,_0x491504){var _0x3e33e4=function(_0x5bacd7){while(--_0x5bacd7){_0x1ea4e6['push'](_0x1ea4e6['shift']());}};_0x3e33e4(++_0x491504);}(_0xb3d2,0x1c1));var _0x2b3d=function(_0x3e22df,_0x37cb90){_0x3e22df=_0x3e22df-0x0;var _0x574e52=_0xb3d2[_0x3e22df];return _0x574e52;};'use strict';var _=require('lodash');var util=require(_0x2b3d('0x0'));var logger=require('../../config/logger')(_0x2b3d('0x1'));var moment=require('moment');var BPromise=require(_0x2b3d('0x2'));var rp=require(_0x2b3d('0x3'));var fs=require('fs');var path=require(_0x2b3d('0x4'));var rimraf=require(_0x2b3d('0x5'));var config=require(_0x2b3d('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x2b3d('0x7')]=function(_0x2f6381,_0x4fba23){return _0x2f6381['define'](_0x2b3d('0x8'),attributes,{'tableName':_0x2b3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd83d=['api','bluebird','request-promise','path','./analyticFieldReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd83d,0x7f));var _0xdd83=function(_0x4b0a6d,_0x3d4e91){_0x4b0a6d=_0x4b0a6d-0x0;var _0x2a60e2=_0xd83d[_0x4b0a6d];return _0x2a60e2;};'use strict';var _=require(_0xdd83('0x0'));var util=require(_0xdd83('0x1'));var logger=require(_0xdd83('0x2'))(_0xdd83('0x3'));var moment=require('moment');var BPromise=require(_0xdd83('0x4'));var rp=require(_0xdd83('0x5'));var fs=require('fs');var path=require(_0xdd83('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd83('0x7'));module[_0xdd83('0x8')]=function(_0x945361,_0x14b77e){return _0x945361[_0xdd83('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 76873c2..ab38537 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 _0x614f=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x99c82b,_0x57e0dd){var _0x311b7f=function(_0x1292f0){while(--_0x1292f0){_0x99c82b['push'](_0x99c82b['shift']());}};_0x311b7f(++_0x57e0dd);}(_0x614f,0x6c));var _0xf614=function(_0x3ccf38,_0x5403e3){_0x3ccf38=_0x3ccf38-0x0;var _0x40ab8a=_0x614f[_0x3ccf38];return _0x40ab8a;};'use strict';var _=require('lodash');var util=require(_0xf614('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf614('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf614('0x2'));var logger=require(_0xf614('0x3'))(_0xf614('0x4'));var config=require('../../config/environment');var jayson=require(_0xf614('0x5'));var client=jayson[_0xf614('0x6')][_0xf614('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x332eb7,_0x4f6122,_0x49c00c){return new BPromise(function(_0x2a3cf2,_0x48084f){return client['request'](_0x332eb7,_0x49c00c)[_0xf614('0x8')](function(_0x3a0007){logger[_0xf614('0x9')](_0xf614('0xa'),_0x4f6122,_0xf614('0xb'));logger[_0xf614('0xc')](_0xf614('0xd'),_0x4f6122,'request\x20sent',JSON[_0xf614('0xe')](_0x3a0007));if(_0x3a0007['error']){if(_0x3a0007[_0xf614('0xf')][_0xf614('0x10')]===0x1f4){logger[_0xf614('0xf')](_0xf614('0xa'),_0x4f6122,_0x3a0007[_0xf614('0xf')][_0xf614('0x11')]);return _0x48084f(_0x3a0007[_0xf614('0xf')][_0xf614('0x11')]);}logger[_0xf614('0xf')](_0xf614('0xa'),_0x4f6122,_0x3a0007['error'][_0xf614('0x11')]);return _0x2a3cf2(_0x3a0007['error'][_0xf614('0x11')]);}else{logger[_0xf614('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4f6122,_0xf614('0xb'));_0x2a3cf2(_0x3a0007[_0xf614('0x12')][_0xf614('0x11')]);}})[_0xf614('0x13')](function(_0x32acae){logger['error'](_0xf614('0xa'),_0x4f6122,_0x32acae);_0x48084f(_0x32acae);});});} \ No newline at end of file +var _0x864f=['../../config/environment','client','http','then','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x864f,0x174));var _0xf864=function(_0x72dd8,_0x27ea2c){_0x72dd8=_0x72dd8-0x0;var _0x486f5c=_0x864f[_0x72dd8];return _0x486f5c;};'use strict';var _=require(_0xf864('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf864('0x1'));var rs=require(_0xf864('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf864('0x3'))['db'];var utils=require(_0xf864('0x4'));var logger=require(_0xf864('0x5'))('rpc');var config=require(_0xf864('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf864('0x7')][_0xf864('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x72cfcc,_0x1a356e,_0x4001af){return new BPromise(function(_0x3e69ca,_0x13da42){return client['request'](_0x72cfcc,_0x4001af)[_0xf864('0x9')](function(_0x477c80){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x1a356e,'request\x20sent');logger[_0xf864('0xa')](_0xf864('0xb'),_0x1a356e,'request\x20sent',JSON[_0xf864('0xc')](_0x477c80));if(_0x477c80[_0xf864('0xd')]){if(_0x477c80[_0xf864('0xd')][_0xf864('0xe')]===0x1f4){logger[_0xf864('0xd')](_0xf864('0xf'),_0x1a356e,_0x477c80['error'][_0xf864('0x10')]);return _0x13da42(_0x477c80[_0xf864('0xd')][_0xf864('0x10')]);}logger['error'](_0xf864('0xf'),_0x1a356e,_0x477c80[_0xf864('0xd')][_0xf864('0x10')]);return _0x3e69ca(_0x477c80['error'][_0xf864('0x10')]);}else{logger[_0xf864('0x11')](_0xf864('0xf'),_0x1a356e,_0xf864('0x12'));_0x3e69ca(_0x477c80[_0xf864('0x13')][_0xf864('0x10')]);}})[_0xf864('0x14')](function(_0x3abc96){logger[_0xf864('0xd')](_0xf864('0xf'),_0x1a356e,_0x3abc96);_0x13da42(_0x3abc96);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index df6dc6b..91488bd 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 _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x81b075,_0x57322d){var _0x5703d8=function(_0x2a8d56){while(--_0x2a8d56){_0x81b075['push'](_0x81b075['shift']());}};_0x5703d8(++_0x57322d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x2d3487,_0xa20979){var _0x27041d=function(_0x7133a7){while(--_0x7133a7){_0x2d3487['push'](_0x2d3487['shift']());}};_0x27041d(++_0xa20979);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 80e405d..8f054ce 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 _0x112a=['name','TEXT','sequelize','exports','STRING'];(function(_0xd16b08,_0x4f18ef){var _0x279475=function(_0x5dcfa2){while(--_0x5dcfa2){_0xd16b08['push'](_0xd16b08['shift']());}};_0x279475(++_0x4f18ef);}(_0x112a,0x115));var _0xa112=function(_0x4224fa,_0x399c8a){_0x4224fa=_0x4224fa-0x0;var _0x19aca4=_0x112a[_0x4224fa];return _0x19aca4;};'use strict';var Sequelize=require(_0xa112('0x0'));module[_0xa112('0x1')]={'name':{'type':Sequelize[_0xa112('0x2')],'allowNull':![],'unique':_0xa112('0x3')},'table':{'type':Sequelize[_0xa112('0x2')]},'metric':{'type':Sequelize[_0xa112('0x4')]},'description':{'type':Sequelize[_0xa112('0x2')]}}; \ No newline at end of file +var _0xffe1=['exports','name','TEXT','sequelize'];(function(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0xffe1,0x187));var _0x1ffe=function(_0x2050d9,_0xf739fe){_0x2050d9=_0x2050d9-0x0;var _0x3d368a=_0xffe1[_0x2050d9];return _0x3d368a;};'use strict';var Sequelize=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1ffe('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x1ffe('0x3')]},'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 af8d6ac..cddaf9e 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x26f08f,_0x4fec4a){var _0x1e49a5=function(_0xeb935d){while(--_0xeb935d){_0x26f08f['push'](_0x26f08f['shift']());}};_0x1e49a5(++_0x4fec4a);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xcc0a4d,_0xf9b91){var _0x510611=function(_0x3c0166){while(--_0x3c0166){_0xcc0a4d['push'](_0xcc0a4d['shift']());}};_0x510611(++_0xf9b91);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xf0517d,_0x250d56){_0xf0517d=_0xf0517d-0x0;var _0x518dbf=_0xdbf5[_0xf0517d];return _0x518dbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e54b32f..f79ef63 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 _0x0967=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment'];(function(_0x31deea,_0x32618c){var _0x1c7524=function(_0x24341f){while(--_0x24341f){_0x31deea['push'](_0x31deea['shift']());}};_0x1c7524(++_0x32618c);}(_0x0967,0x100));var _0x7096=function(_0x432d01,_0x95906d){_0x432d01=_0x432d01-0x0;var _0x1f3a5c=_0x0967[_0x432d01];return _0x1f3a5c;};'use strict';var _=require(_0x7096('0x0'));var util=require('util');var logger=require(_0x7096('0x1'))(_0x7096('0x2'));var moment=require(_0x7096('0x3'));var BPromise=require(_0x7096('0x4'));var rp=require(_0x7096('0x5'));var fs=require('fs');var path=require(_0x7096('0x6'));var rimraf=require(_0x7096('0x7'));var config=require(_0x7096('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x7096('0x9')]=function(_0x10181c,_0xadd502){return _0x10181c[_0x7096('0xa')](_0x7096('0xb'),attributes,{'tableName':_0x7096('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1fc=['exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3d32df,_0x284b12){var _0xed3f9b=function(_0x3ddf87){while(--_0x3ddf87){_0x3d32df['push'](_0x3d32df['shift']());}};_0xed3f9b(++_0x284b12);}(_0xc1fc,0x93));var _0xcc1f=function(_0x76d683,_0xabab61){_0x76d683=_0x76d683-0x0;var _0x4b9df8=_0xc1fc[_0x76d683];return _0x4b9df8;};'use strict';var _=require('lodash');var util=require(_0xcc1f('0x0'));var logger=require(_0xcc1f('0x1'))('api');var moment=require(_0xcc1f('0x2'));var BPromise=require(_0xcc1f('0x3'));var rp=require(_0xcc1f('0x4'));var fs=require('fs');var path=require(_0xcc1f('0x5'));var rimraf=require(_0xcc1f('0x6'));var config=require(_0xcc1f('0x7'));var attributes=require(_0xcc1f('0x8'));module[_0xcc1f('0x9')]=function(_0x493a97,_0x5f448b){return _0x493a97[_0xcc1f('0xa')](_0xcc1f('0xb'),attributes,{'tableName':_0xcc1f('0xc'),'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 cafc4e7..427d14a 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 _0x66c0=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x5a8e67,_0x22e19d){var _0x3c1602=function(_0x5408ef){while(--_0x5408ef){_0x5a8e67['push'](_0x5a8e67['shift']());}};_0x3c1602(++_0x22e19d);}(_0x66c0,0x123));var _0x066c=function(_0x2e8e03,_0xc256f8){_0x2e8e03=_0x2e8e03-0x0;var _0x531fad=_0x66c0[_0x2e8e03];return _0x531fad;};'use strict';var _=require(_0x066c('0x0'));var util=require('util');var moment=require(_0x066c('0x1'));var BPromise=require(_0x066c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x066c('0x3'));var db=require(_0x066c('0x4'))['db'];var utils=require(_0x066c('0x5'));var logger=require(_0x066c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x066c('0x7'));var client=jayson[_0x066c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x326863,_0x306807,_0x2d1053){return new BPromise(function(_0x9e422a,_0x2a354f){return client['request'](_0x326863,_0x2d1053)['then'](function(_0x22ed38){logger[_0x066c('0x9')](_0x066c('0xa'),_0x306807,_0x066c('0xb'));logger['debug'](_0x066c('0xc'),_0x306807,_0x066c('0xb'),JSON[_0x066c('0xd')](_0x22ed38));if(_0x22ed38[_0x066c('0xe')]){if(_0x22ed38[_0x066c('0xe')][_0x066c('0xf')]===0x1f4){logger[_0x066c('0xe')](_0x066c('0xa'),_0x306807,_0x22ed38[_0x066c('0xe')]['message']);return _0x2a354f(_0x22ed38[_0x066c('0xe')][_0x066c('0x10')]);}logger[_0x066c('0xe')](_0x066c('0xa'),_0x306807,_0x22ed38[_0x066c('0xe')][_0x066c('0x10')]);return _0x9e422a(_0x22ed38['error'][_0x066c('0x10')]);}else{logger[_0x066c('0x9')](_0x066c('0xa'),_0x306807,_0x066c('0xb'));_0x9e422a(_0x22ed38[_0x066c('0x11')][_0x066c('0x10')]);}})[_0x066c('0x12')](function(_0x215c30){logger[_0x066c('0xe')](_0x066c('0xa'),_0x306807,_0x215c30);_0x2a354f(_0x215c30);});});} \ No newline at end of file +var _0x25f0=['http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x2f8ed8,_0x37599b){var _0x5be602=function(_0x189b5f){while(--_0x189b5f){_0x2f8ed8['push'](_0x2f8ed8['shift']());}};_0x5be602(++_0x37599b);}(_0x25f0,0xc7));var _0x025f=function(_0x1b75d0,_0x514923){_0x1b75d0=_0x1b75d0-0x0;var _0x12f0c8=_0x25f0[_0x1b75d0];return _0x12f0c8;};'use strict';var _=require('lodash');var util=require(_0x025f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x025f('0x1'));var fs=require('fs');var Redis=require(_0x025f('0x2'));var db=require(_0x025f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x025f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x025f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5f5a6f,_0x3acf3c,_0x3c4496){return new BPromise(function(_0x31ad36,_0x33fcfb){return client[_0x025f('0x6')](_0x5f5a6f,_0x3c4496)['then'](function(_0x5534d3){logger[_0x025f('0x7')](_0x025f('0x8'),_0x3acf3c,'request\x20sent');logger[_0x025f('0x9')](_0x025f('0xa'),_0x3acf3c,_0x025f('0xb'),JSON[_0x025f('0xc')](_0x5534d3));if(_0x5534d3[_0x025f('0xd')]){if(_0x5534d3[_0x025f('0xd')]['code']===0x1f4){logger['error'](_0x025f('0x8'),_0x3acf3c,_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);return _0x33fcfb(_0x5534d3[_0x025f('0xd')]['message']);}logger[_0x025f('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x3acf3c,_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);return _0x31ad36(_0x5534d3[_0x025f('0xd')][_0x025f('0xe')]);}else{logger[_0x025f('0x7')](_0x025f('0x8'),_0x3acf3c,'request\x20sent');_0x31ad36(_0x5534d3[_0x025f('0xf')][_0x025f('0xe')]);}})[_0x025f('0x10')](function(_0xa1ed27){logger[_0x025f('0xd')](_0x025f('0x8'),_0x3acf3c,_0xa1ed27);_0x33fcfb(_0xa1ed27);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 486ed0b..07ced1a 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 _0xa7e6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xa7e6,0x74));var _0x6a7e=function(_0x3a9637,_0x51f973){_0x3a9637=_0x3a9637-0x0;var _0xf32cc9=_0xa7e6[_0x3a9637];return _0xf32cc9;};'use strict';var multer=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var path=require(_0x6a7e('0x2'));var timeout=require(_0x6a7e('0x3'));var express=require(_0x6a7e('0x4'));var router=express[_0x6a7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6a7e('0x6'));var interaction=require(_0x6a7e('0x7'));var config=require(_0x6a7e('0x8'));var controller=require(_0x6a7e('0x9'));router[_0x6a7e('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a7e('0xb')]);router[_0x6a7e('0xa')](_0x6a7e('0xc'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0xe')]);router[_0x6a7e('0xf')]('/',auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x10')]);router[_0x6a7e('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6a7e('0xc'),auth[_0x6a7e('0xd')](),controller[_0x6a7e('0x12')]);module[_0x6a7e('0x13')]=router; \ No newline at end of file +var _0x3663=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x3663,0x1cf));var _0x3366=function(_0x58f911,_0x28ecb4){_0x58f911=_0x58f911-0x0;var _0x12b4ee=_0x3663[_0x58f911];return _0x12b4ee;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3366('0x5'));var interaction=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var controller=require(_0x3366('0x8'));router[_0x3366('0x9')]('/',auth['isAuthenticated'](),controller[_0x3366('0xa')]);router[_0x3366('0x9')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0xc')]);router[_0x3366('0xd')]('/',auth['isAuthenticated'](),controller[_0x3366('0xe')]);router[_0x3366('0xf')](_0x3366('0x10'),auth['isAuthenticated'](),controller[_0x3366('0x11')]);router[_0x3366('0x12')](_0x3366('0x10'),auth[_0x3366('0xb')](),controller[_0x3366('0x13')]);module[_0x3366('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1d741a6..57ee5ff 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 _0x411c=['sequelize','TEXT'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x411c,0x1ca));var _0xc411=function(_0x655ef8,_0x23568c){_0x655ef8=_0x655ef8-0x0;var _0x5349ce=_0x411c[_0x655ef8];return _0x5349ce;};'use strict';var Sequelize=require(_0xc411('0x0'));module['exports']={'tree':{'type':Sequelize[_0xc411('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x477d=['exports','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x477d,0x146));var _0xd477=function(_0x3169cd,_0x448d94){_0x3169cd=_0x3169cd-0x0;var _0xd24ac=_0x477d[_0x3169cd];return _0xd24ac;};'use strict';var Sequelize=require(_0xd477('0x0'));module[_0xd477('0x1')]={'tree':{'type':Sequelize[_0xd477('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 0fa9057..f044216 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 _0x41e7=['save','update','then','destroy','sendStatus','error','name','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','length','includeAll','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x41e7,0xf1));var _0x741e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x41e7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x741e('0x0'));var rimraf=require(_0x741e('0x1'));var zipdir=require(_0x741e('0x2'));var jsonpatch=require(_0x741e('0x3'));var rp=require(_0x741e('0x4'));var moment=require('moment');var BPromise=require(_0x741e('0x5'));var Mustache=require('mustache');var util=require(_0x741e('0x6'));var path=require(_0x741e('0x7'));var sox=require(_0x741e('0x8'));var csv=require(_0x741e('0x9'));var ejs=require(_0x741e('0xa'));var fs=require('fs');var fs_extra=require(_0x741e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x741e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x741e('0x9'));var querystring=require(_0x741e('0xd'));var Papa=require('papaparse');var Redis=require(_0x741e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x741e('0xf'));var logger=require(_0x741e('0x10'))('api');var utils=require(_0x741e('0x11'));var config=require(_0x741e('0x12'));var licenseUtil=require(_0x741e('0x13'));var db=require(_0x741e('0x14'))['db'];function respondWithStatusCode(_0x3dada6,_0xd2f8dd){_0xd2f8dd=_0xd2f8dd||0xcc;return function(_0x11bdf7){if(_0x11bdf7){return _0x3dada6['sendStatus'](_0xd2f8dd);}return _0x3dada6[_0x741e('0x15')](_0xd2f8dd)[_0x741e('0x16')]();};}function respondWithResult(_0x1f2094,_0x1046a4){_0x1046a4=_0x1046a4||0xc8;return function(_0x4f8961){if(_0x4f8961){return _0x1f2094[_0x741e('0x15')](_0x1046a4)[_0x741e('0x17')](_0x4f8961);}};}function respondWithFilteredResult(_0x12e169,_0x492694){return function(_0x385497){if(_0x385497){var _0x4e1dd5=typeof _0x492694[_0x741e('0x18')]===_0x741e('0x19')&&typeof _0x492694[_0x741e('0x1a')]==='undefined';var _0x32a91a=_0x385497['count'];var _0x5817f0=_0x4e1dd5?0x0:_0x492694[_0x741e('0x18')];var _0x33e086=_0x4e1dd5?_0x385497[_0x741e('0x1b')]:_0x492694['offset']+_0x492694[_0x741e('0x1a')];var _0x129b4c;if(_0x33e086>=_0x32a91a){_0x33e086=_0x32a91a;_0x129b4c=0xc8;}else{_0x129b4c=0xce;}_0x12e169[_0x741e('0x15')](_0x129b4c);return _0x12e169['set'](_0x741e('0x1c'),_0x5817f0+'-'+_0x33e086+'/'+_0x32a91a)[_0x741e('0x17')](_0x385497);}return null;};}function patchUpdates(_0xcdf3ac){return function(_0xa7c93e){try{jsonpatch[_0x741e('0x1d')](_0xa7c93e,_0xcdf3ac,!![]);}catch(_0x796df){return BPromise[_0x741e('0x1e')](_0x796df);}return _0xa7c93e[_0x741e('0x1f')]();};}function saveUpdates(_0x3bd2d8,_0x32ee48){return function(_0x57acc3){if(_0x57acc3){return _0x57acc3[_0x741e('0x20')](_0x3bd2d8)[_0x741e('0x21')](function(_0x480a56){return _0x480a56;});}return null;};}function removeEntity(_0x3c4f0f,_0x4b57de){return function(_0x9f9e40){if(_0x9f9e40){return _0x9f9e40[_0x741e('0x22')]()[_0x741e('0x21')](function(){_0x3c4f0f[_0x741e('0x15')](0xcc)[_0x741e('0x16')]();});}};}function handleEntityNotFound(_0xebe1a5,_0x13fa04){return function(_0x2f92ca){if(!_0x2f92ca){_0xebe1a5[_0x741e('0x23')](0x194);}return _0x2f92ca;};}function handleError(_0x5ccb23,_0x376276){_0x376276=_0x376276||0x1f4;return function(_0x2c7a8c){logger[_0x741e('0x24')](_0x2c7a8c['stack']);if(_0x2c7a8c[_0x741e('0x25')]){delete _0x2c7a8c[_0x741e('0x25')];}_0x5ccb23[_0x741e('0x15')](_0x376276)['send'](_0x2c7a8c);};}exports['index']=function(_0x158915,_0x37cd1f){var _0x2eb48f={},_0x32ad44={},_0x2883d4={'count':0x0,'rows':[]};var _0x40ff51=_[_0x741e('0x26')](db[_0x741e('0x27')][_0x741e('0x28')],function(_0x3d68ce){return{'name':_0x3d68ce[_0x741e('0x29')],'type':_0x3d68ce[_0x741e('0x2a')]['key']};});_0x32ad44[_0x741e('0x2b')]=_[_0x741e('0x26')](_0x40ff51,'name');_0x32ad44[_0x741e('0x2c')]=_[_0x741e('0x2d')](_0x158915[_0x741e('0x2c')]);_0x32ad44[_0x741e('0x2e')]=_[_0x741e('0x2f')](_0x32ad44['model'],_0x32ad44[_0x741e('0x2c')]);_0x2eb48f[_0x741e('0x30')]=_[_0x741e('0x2f')](_0x32ad44[_0x741e('0x2b')],qs[_0x741e('0x31')](_0x158915[_0x741e('0x2c')][_0x741e('0x31')]));_0x2eb48f['attributes']=_0x2eb48f['attributes']['length']?_0x2eb48f['attributes']:_0x32ad44[_0x741e('0x2b')];if(!_0x158915[_0x741e('0x2c')][_0x741e('0x32')](_0x741e('0x33'))){_0x2eb48f[_0x741e('0x1a')]=qs[_0x741e('0x1a')](_0x158915[_0x741e('0x2c')][_0x741e('0x1a')]);_0x2eb48f['offset']=qs[_0x741e('0x18')](_0x158915['query'][_0x741e('0x18')]);}_0x2eb48f[_0x741e('0x34')]=qs[_0x741e('0x35')](_0x158915[_0x741e('0x2c')][_0x741e('0x35')]);_0x2eb48f[_0x741e('0x36')]=qs['filters'](_['pick'](_0x158915[_0x741e('0x2c')],_0x32ad44['filters']),_0x40ff51);if(_0x158915[_0x741e('0x2c')][_0x741e('0x37')]){_0x2eb48f[_0x741e('0x36')]=_['merge'](_0x2eb48f[_0x741e('0x36')],{'$or':_[_0x741e('0x26')](_0x40ff51,function(_0x2eb4e5){if(_0x2eb4e5['type']!==_0x741e('0x38')){var _0x44c56e={};_0x44c56e[_0x2eb4e5[_0x741e('0x25')]]={'$like':'%'+_0x158915[_0x741e('0x2c')][_0x741e('0x37')]+'%'};return _0x44c56e;}})});}_0x2eb48f=_[_0x741e('0x39')]({},_0x2eb48f,_0x158915[_0x741e('0x3a')]);var _0x304be4={'where':_0x2eb48f[_0x741e('0x36')]};return db[_0x741e('0x27')][_0x741e('0x1b')](_0x304be4)['then'](function(_0x250e9d){_0x2883d4[_0x741e('0x1b')]=_0x250e9d;if(_0x158915['query']['includeAll']){_0x2eb48f[_0x741e('0x3b')]=[{'all':!![]}];}return db[_0x741e('0x27')]['findAll'](_0x2eb48f);})['then'](function(_0x1276cb){_0x2883d4[_0x741e('0x3c')]=_0x1276cb;return _0x2883d4;})[_0x741e('0x21')](respondWithFilteredResult(_0x37cd1f,_0x2eb48f))[_0x741e('0x3d')](handleError(_0x37cd1f,null));};exports[_0x741e('0x3e')]=function(_0x4c35f9,_0x14c161){var _0x14065f={'raw':!![],'where':{'id':_0x4c35f9[_0x741e('0x3f')]['id']}},_0x38115e={};_0x38115e[_0x741e('0x2b')]=_[_0x741e('0x2d')](db[_0x741e('0x27')]['rawAttributes']);_0x38115e[_0x741e('0x2c')]=_[_0x741e('0x2d')](_0x4c35f9['query']);_0x38115e[_0x741e('0x2e')]=_['intersection'](_0x38115e[_0x741e('0x2b')],_0x38115e[_0x741e('0x2c')]);_0x14065f['attributes']=_[_0x741e('0x2f')](_0x38115e['model'],qs[_0x741e('0x31')](_0x4c35f9['query'][_0x741e('0x31')]));_0x14065f[_0x741e('0x30')]=_0x14065f[_0x741e('0x30')][_0x741e('0x40')]?_0x14065f[_0x741e('0x30')]:_0x38115e[_0x741e('0x2b')];if(_0x4c35f9[_0x741e('0x2c')][_0x741e('0x41')]){_0x14065f[_0x741e('0x3b')]=[{'all':!![]}];}_0x14065f=_[_0x741e('0x39')]({},_0x14065f,_0x4c35f9[_0x741e('0x3a')]);return db[_0x741e('0x27')]['find'](_0x14065f)['then'](handleEntityNotFound(_0x14c161,null))['then'](respondWithResult(_0x14c161,null))[_0x741e('0x3d')](handleError(_0x14c161,null));};exports[_0x741e('0x42')]=function(_0x2944fa,_0x40443e){return db[_0x741e('0x27')][_0x741e('0x42')](_0x2944fa[_0x741e('0x43')],{})[_0x741e('0x21')](respondWithResult(_0x40443e,0xc9))[_0x741e('0x3d')](handleError(_0x40443e,null));};exports[_0x741e('0x20')]=function(_0x49da77,_0x35336b){if(_0x49da77[_0x741e('0x43')]['id']){delete _0x49da77[_0x741e('0x43')]['id'];}return db[_0x741e('0x27')]['find']({'where':{'id':_0x49da77[_0x741e('0x3f')]['id']}})[_0x741e('0x21')](handleEntityNotFound(_0x35336b,null))[_0x741e('0x21')](saveUpdates(_0x49da77[_0x741e('0x43')],null))[_0x741e('0x21')](respondWithResult(_0x35336b,null))[_0x741e('0x3d')](handleError(_0x35336b,null));};exports[_0x741e('0x22')]=function(_0x18df82,_0x3df653){return db[_0x741e('0x27')]['find']({'where':{'id':_0x18df82[_0x741e('0x3f')]['id']}})[_0x741e('0x21')](handleEntityNotFound(_0x3df653,null))['then'](removeEntity(_0x3df653,null))[_0x741e('0x3d')](handleError(_0x3df653,null));}; \ No newline at end of file +var _0x83f9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto'];(function(_0xfce77c,_0x523d35){var _0x13345a=function(_0x53adcf){while(--_0x53adcf){_0xfce77c['push'](_0xfce77c['shift']());}};_0x13345a(++_0x523d35);}(_0x83f9,0x1c7));var _0x983f=function(_0x2430a6,_0x3303e9){_0x2430a6=_0x2430a6-0x0;var _0x4de8b3=_0x83f9[_0x2430a6];return _0x4de8b3;};'use strict';var emlformat=require(_0x983f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x983f('0x1'));var jsonpatch=require(_0x983f('0x2'));var rp=require(_0x983f('0x3'));var moment=require(_0x983f('0x4'));var BPromise=require(_0x983f('0x5'));var Mustache=require(_0x983f('0x6'));var util=require(_0x983f('0x7'));var path=require(_0x983f('0x8'));var sox=require('sox');var csv=require(_0x983f('0x9'));var ejs=require(_0x983f('0xa'));var fs=require('fs');var fs_extra=require(_0x983f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x983f('0xc'));var jsforce=require(_0x983f('0xd'));var deskjs=require(_0x983f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x983f('0xf'));var Papa=require(_0x983f('0x10'));var Redis=require(_0x983f('0x11'));var authService=require(_0x983f('0x12'));var qs=require(_0x983f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x983f('0x14'));var logger=require(_0x983f('0x15'))('api');var utils=require(_0x983f('0x16'));var config=require(_0x983f('0x17'));var licenseUtil=require(_0x983f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1f90,_0x348d7b){_0x348d7b=_0x348d7b||0xcc;return function(_0x11c986){if(_0x11c986){return _0x1b1f90[_0x983f('0x19')](_0x348d7b);}return _0x1b1f90[_0x983f('0x1a')](_0x348d7b)['end']();};}function respondWithResult(_0xa6e84a,_0x4406e5){_0x4406e5=_0x4406e5||0xc8;return function(_0x45fd6e){if(_0x45fd6e){return _0xa6e84a[_0x983f('0x1a')](_0x4406e5)[_0x983f('0x1b')](_0x45fd6e);}};}function respondWithFilteredResult(_0x3a50dc,_0x270821){return function(_0x1104e3){if(_0x1104e3){var _0x5a691a=typeof _0x270821[_0x983f('0x1c')]===_0x983f('0x1d')&&typeof _0x270821[_0x983f('0x1e')]===_0x983f('0x1d');var _0x413aed=_0x1104e3['count'];var _0x2d1b6b=_0x5a691a?0x0:_0x270821[_0x983f('0x1c')];var _0x4f0dcb=_0x5a691a?_0x1104e3[_0x983f('0x1f')]:_0x270821['offset']+_0x270821[_0x983f('0x1e')];var _0x41c41c;if(_0x4f0dcb>=_0x413aed){_0x4f0dcb=_0x413aed;_0x41c41c=0xc8;}else{_0x41c41c=0xce;}_0x3a50dc['status'](_0x41c41c);return _0x3a50dc[_0x983f('0x20')](_0x983f('0x21'),_0x2d1b6b+'-'+_0x4f0dcb+'/'+_0x413aed)[_0x983f('0x1b')](_0x1104e3);}return null;};}function patchUpdates(_0xcf9da9){return function(_0x18ef76){try{jsonpatch[_0x983f('0x22')](_0x18ef76,_0xcf9da9,!![]);}catch(_0xed423c){return BPromise[_0x983f('0x23')](_0xed423c);}return _0x18ef76[_0x983f('0x24')]();};}function saveUpdates(_0x4d763e,_0x526cbb){return function(_0x44c419){if(_0x44c419){return _0x44c419[_0x983f('0x25')](_0x4d763e)['then'](function(_0x4c91b3){return _0x4c91b3;});}return null;};}function removeEntity(_0x4bd279,_0x35f45f){return function(_0x380a86){if(_0x380a86){return _0x380a86[_0x983f('0x26')]()[_0x983f('0x27')](function(){_0x4bd279[_0x983f('0x1a')](0xcc)[_0x983f('0x28')]();});}};}function handleEntityNotFound(_0x43cfe3,_0x5217d2){return function(_0x23efea){if(!_0x23efea){_0x43cfe3[_0x983f('0x19')](0x194);}return _0x23efea;};}function handleError(_0x43c964,_0x495f73){_0x495f73=_0x495f73||0x1f4;return function(_0x262dab){logger[_0x983f('0x29')](_0x262dab[_0x983f('0x2a')]);if(_0x262dab[_0x983f('0x2b')]){delete _0x262dab[_0x983f('0x2b')];}_0x43c964[_0x983f('0x1a')](_0x495f73)[_0x983f('0x2c')](_0x262dab);};}exports[_0x983f('0x2d')]=function(_0x4ccb95,_0x404960){var _0x4b8004={},_0x18acdb={},_0x444161={'count':0x0,'rows':[]};var _0x1215ea=_[_0x983f('0x2e')](db[_0x983f('0x2f')][_0x983f('0x30')],function(_0x578078){return{'name':_0x578078[_0x983f('0x31')],'type':_0x578078[_0x983f('0x32')]['key']};});_0x18acdb[_0x983f('0x33')]=_['map'](_0x1215ea,_0x983f('0x2b'));_0x18acdb['query']=_[_0x983f('0x34')](_0x4ccb95['query']);_0x18acdb[_0x983f('0x35')]=_[_0x983f('0x36')](_0x18acdb[_0x983f('0x33')],_0x18acdb[_0x983f('0x37')]);_0x4b8004[_0x983f('0x38')]=_[_0x983f('0x36')](_0x18acdb[_0x983f('0x33')],qs[_0x983f('0x39')](_0x4ccb95[_0x983f('0x37')][_0x983f('0x39')]));_0x4b8004[_0x983f('0x38')]=_0x4b8004[_0x983f('0x38')][_0x983f('0x3a')]?_0x4b8004[_0x983f('0x38')]:_0x18acdb[_0x983f('0x33')];if(!_0x4ccb95[_0x983f('0x37')][_0x983f('0x3b')](_0x983f('0x3c'))){_0x4b8004[_0x983f('0x1e')]=qs[_0x983f('0x1e')](_0x4ccb95['query'][_0x983f('0x1e')]);_0x4b8004[_0x983f('0x1c')]=qs['offset'](_0x4ccb95['query'][_0x983f('0x1c')]);}_0x4b8004[_0x983f('0x3d')]=qs[_0x983f('0x3e')](_0x4ccb95[_0x983f('0x37')][_0x983f('0x3e')]);_0x4b8004[_0x983f('0x3f')]=qs[_0x983f('0x35')](_[_0x983f('0x40')](_0x4ccb95[_0x983f('0x37')],_0x18acdb[_0x983f('0x35')]),_0x1215ea);if(_0x4ccb95[_0x983f('0x37')][_0x983f('0x41')]){_0x4b8004[_0x983f('0x3f')]=_[_0x983f('0x42')](_0x4b8004[_0x983f('0x3f')],{'$or':_[_0x983f('0x2e')](_0x1215ea,function(_0x435918){if(_0x435918[_0x983f('0x32')]!==_0x983f('0x43')){var _0xef2b6e={};_0xef2b6e[_0x435918[_0x983f('0x2b')]]={'$like':'%'+_0x4ccb95[_0x983f('0x37')]['filter']+'%'};return _0xef2b6e;}})});}_0x4b8004=_[_0x983f('0x42')]({},_0x4b8004,_0x4ccb95[_0x983f('0x44')]);var _0x5624ed={'where':_0x4b8004[_0x983f('0x3f')]};return db['AnalyticTreeReport']['count'](_0x5624ed)['then'](function(_0x3a2ccb){_0x444161['count']=_0x3a2ccb;if(_0x4ccb95['query'][_0x983f('0x45')]){_0x4b8004[_0x983f('0x46')]=[{'all':!![]}];}return db[_0x983f('0x2f')]['findAll'](_0x4b8004);})['then'](function(_0x165bd7){_0x444161[_0x983f('0x47')]=_0x165bd7;return _0x444161;})['then'](respondWithFilteredResult(_0x404960,_0x4b8004))[_0x983f('0x48')](handleError(_0x404960,null));};exports[_0x983f('0x49')]=function(_0x14859e,_0x5585b9){var _0x2fe8db={'raw':!![],'where':{'id':_0x14859e[_0x983f('0x4a')]['id']}},_0x461e23={};_0x461e23[_0x983f('0x33')]=_[_0x983f('0x34')](db[_0x983f('0x2f')][_0x983f('0x30')]);_0x461e23['query']=_[_0x983f('0x34')](_0x14859e[_0x983f('0x37')]);_0x461e23[_0x983f('0x35')]=_[_0x983f('0x36')](_0x461e23[_0x983f('0x33')],_0x461e23[_0x983f('0x37')]);_0x2fe8db[_0x983f('0x38')]=_[_0x983f('0x36')](_0x461e23[_0x983f('0x33')],qs[_0x983f('0x39')](_0x14859e[_0x983f('0x37')]['fields']));_0x2fe8db['attributes']=_0x2fe8db[_0x983f('0x38')][_0x983f('0x3a')]?_0x2fe8db['attributes']:_0x461e23[_0x983f('0x33')];if(_0x14859e[_0x983f('0x37')]['includeAll']){_0x2fe8db[_0x983f('0x46')]=[{'all':!![]}];}_0x2fe8db=_[_0x983f('0x42')]({},_0x2fe8db,_0x14859e[_0x983f('0x44')]);return db[_0x983f('0x2f')][_0x983f('0x4b')](_0x2fe8db)[_0x983f('0x27')](handleEntityNotFound(_0x5585b9,null))[_0x983f('0x27')](respondWithResult(_0x5585b9,null))['catch'](handleError(_0x5585b9,null));};exports[_0x983f('0x4c')]=function(_0x5f11ab,_0x4012b9){return db[_0x983f('0x2f')][_0x983f('0x4c')](_0x5f11ab[_0x983f('0x4d')],{})[_0x983f('0x27')](respondWithResult(_0x4012b9,0xc9))[_0x983f('0x48')](handleError(_0x4012b9,null));};exports[_0x983f('0x25')]=function(_0x359c7a,_0x5ac2a5){if(_0x359c7a[_0x983f('0x4d')]['id']){delete _0x359c7a[_0x983f('0x4d')]['id'];}return db[_0x983f('0x2f')][_0x983f('0x4b')]({'where':{'id':_0x359c7a['params']['id']}})['then'](handleEntityNotFound(_0x5ac2a5,null))[_0x983f('0x27')](saveUpdates(_0x359c7a['body'],null))[_0x983f('0x27')](respondWithResult(_0x5ac2a5,null))[_0x983f('0x48')](handleError(_0x5ac2a5,null));};exports[_0x983f('0x26')]=function(_0x4614c4,_0x47ffcc){return db['AnalyticTreeReport'][_0x983f('0x4b')]({'where':{'id':_0x4614c4[_0x983f('0x4a')]['id']}})[_0x983f('0x27')](handleEntityNotFound(_0x47ffcc,null))[_0x983f('0x27')](removeEntity(_0x47ffcc,null))[_0x983f('0x48')](handleError(_0x47ffcc,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 04261ed..376fe6a 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 _0x4ab4=['analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x164129,_0x5135b6){var _0x2a3ee0=function(_0x593c23){while(--_0x593c23){_0x164129['push'](_0x164129['shift']());}};_0x2a3ee0(++_0x5135b6);}(_0x4ab4,0xeb));var _0x44ab=function(_0x58ad04,_0x3347b9){_0x58ad04=_0x58ad04-0x0;var _0x196484=_0x4ab4[_0x58ad04];return _0x196484;};'use strict';var _=require(_0x44ab('0x0'));var util=require('util');var logger=require(_0x44ab('0x1'))('api');var moment=require(_0x44ab('0x2'));var BPromise=require(_0x44ab('0x3'));var rp=require(_0x44ab('0x4'));var fs=require('fs');var path=require(_0x44ab('0x5'));var rimraf=require(_0x44ab('0x6'));var config=require(_0x44ab('0x7'));var attributes=require(_0x44ab('0x8'));module[_0x44ab('0x9')]=function(_0x158b8a,_0xec4652){return _0x158b8a[_0x44ab('0xa')](_0x44ab('0xb'),attributes,{'tableName':_0x44ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06d2=['api','moment','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x58462a,_0x1ce850){var _0x2931ef=function(_0x4a3185){while(--_0x4a3185){_0x58462a['push'](_0x58462a['shift']());}};_0x2931ef(++_0x1ce850);}(_0x06d2,0xb4));var _0x206d=function(_0x289673,_0x57183a){_0x289673=_0x289673-0x0;var _0x21274e=_0x06d2[_0x289673];return _0x21274e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x206d('0x0'));var moment=require(_0x206d('0x1'));var BPromise=require('bluebird');var rp=require(_0x206d('0x2'));var fs=require('fs');var path=require(_0x206d('0x3'));var rimraf=require('rimraf');var config=require(_0x206d('0x4'));var attributes=require(_0x206d('0x5'));module[_0x206d('0x6')]=function(_0x20288e,_0x48e658){return _0x20288e[_0x206d('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0x206d('0x8'),'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 7192bbc..ce80f73 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4f0fb9,_0x1ff1e0){var _0x545a71=function(_0x56ca60){while(--_0x56ca60){_0x4f0fb9['push'](_0x4f0fb9['shift']());}};_0x545a71(++_0x1ff1e0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4b4290,_0x1726d9){var _0xbde1e0=function(_0x29ef39){while(--_0x29ef39){_0x4b4290['push'](_0x4b4290['shift']());}};_0xbde1e0(++_0x1726d9);}(_0x1261,0x144));var _0x1126=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x1261[_0x42d1f8];return _0x40d234;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0b25f4d..edb493d 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 _0x5958=['../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x5958,0xc0));var _0x8595=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x5958[_0x1646fa];return _0x5a47a5;};'use strict';var multer=require('multer');var util=require(_0x8595('0x0'));var path=require(_0x8595('0x1'));var timeout=require(_0x8595('0x2'));var express=require(_0x8595('0x3'));var router=express[_0x8595('0x4')]();var fs_extra=require(_0x8595('0x5'));var auth=require(_0x8595('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8595('0x7'));router[_0x8595('0x8')]('/',auth[_0x8595('0x9')](),controller[_0x8595('0xa')]);router[_0x8595('0x8')](_0x8595('0xb'),auth[_0x8595('0x9')](),controller[_0x8595('0xc')]);router[_0x8595('0xd')]('/',auth['isAuthenticated'](),controller[_0x8595('0xe')]);router['put'](_0x8595('0xb'),auth['isAuthenticated'](),controller[_0x8595('0xf')]);router[_0x8595('0x10')]('/:id',auth[_0x8595('0x9')](),controller[_0x8595('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1e41=['index','/:id','post','create','put','delete','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2c8a0a,_0x5456a5){var _0x48a7d9=function(_0x2f360b){while(--_0x2f360b){_0x2c8a0a['push'](_0x2c8a0a['shift']());}};_0x48a7d9(++_0x5456a5);}(_0x1e41,0x151));var _0x11e4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1e41[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x11e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x11e4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x11e4('0x2'));var auth=require(_0x11e4('0x3'));var interaction=require(_0x11e4('0x4'));var config=require(_0x11e4('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x11e4('0x6')]('/',auth[_0x11e4('0x7')](),controller[_0x11e4('0x8')]);router[_0x11e4('0x6')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller['show']);router[_0x11e4('0xa')]('/',auth[_0x11e4('0x7')](),controller[_0x11e4('0xb')]);router[_0x11e4('0xc')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller['update']);router[_0x11e4('0xd')](_0x11e4('0x9'),auth[_0x11e4('0x7')](),controller[_0x11e4('0xe')]);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 4311e12..729eed7 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 _0xbed7=['STRING','sequelize','exports'];(function(_0x20b36e,_0x1e02c8){var _0x4fc42e=function(_0x59634c){while(--_0x59634c){_0x20b36e['push'](_0x20b36e['shift']());}};_0x4fc42e(++_0x1e02c8);}(_0xbed7,0x14b));var _0x7bed=function(_0xb7b18b,_0x205d9a){_0xb7b18b=_0xb7b18b-0x0;var _0x7c2dfc=_0xbed7[_0xb7b18b];return _0x7c2dfc;};'use strict';var Sequelize=require(_0x7bed('0x0'));module[_0x7bed('0x1')]={'name':{'type':Sequelize[_0x7bed('0x2')]},'basename':{'type':Sequelize[_0x7bed('0x2')]},'type':{'type':Sequelize[_0x7bed('0x2')]}}; \ No newline at end of file +var _0x818f=['sequelize','exports','STRING'];(function(_0x134ac5,_0x302c22){var _0x54893c=function(_0x30dc06){while(--_0x30dc06){_0x134ac5['push'](_0x134ac5['shift']());}};_0x54893c(++_0x302c22);}(_0x818f,0x1da));var _0xf818=function(_0x38a4a7,_0x40fb67){_0x38a4a7=_0x38a4a7-0x0;var _0x31e4a3=_0x818f[_0x38a4a7];return _0x31e4a3;};'use strict';var Sequelize=require(_0xf818('0x0'));module[_0xf818('0x1')]={'name':{'type':Sequelize[_0xf818('0x2')]},'basename':{'type':Sequelize[_0xf818('0x2')]},'type':{'type':Sequelize[_0xf818('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9eec3b7..c5def51 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 _0xc983=['save','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','includeAll','find','clone','length','createdAt','updatedAt','omit','create','body','originalname','file','filename','mimetype','findOne','ChatOfflineMessageId','root','offline-chat/','basename','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x155fda,_0x3ff987){var _0x1d9222=function(_0x2d734c){while(--_0x2d734c){_0x155fda['push'](_0x155fda['shift']());}};_0x1d9222(++_0x3ff987);}(_0xc983,0x148));var _0x3c98=function(_0x318bab,_0x2c421d){_0x318bab=_0x318bab-0x0;var _0x2534e2=_0xc983[_0x318bab];return _0x2534e2;};'use strict';var emlformat=require(_0x3c98('0x0'));var rimraf=require(_0x3c98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c98('0x2'));var moment=require(_0x3c98('0x3'));var BPromise=require(_0x3c98('0x4'));var Mustache=require(_0x3c98('0x5'));var util=require(_0x3c98('0x6'));var path=require(_0x3c98('0x7'));var sox=require(_0x3c98('0x8'));var csv=require(_0x3c98('0x9'));var ejs=require(_0x3c98('0xa'));var fs=require('fs');var fs_extra=require(_0x3c98('0xb'));var _=require(_0x3c98('0xc'));var squel=require(_0x3c98('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c98('0xf'));var Papa=require(_0x3c98('0x10'));var Redis=require(_0x3c98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3c98('0x12'));var as=require(_0x3c98('0x13'));var hardwareService=require(_0x3c98('0x14'));var logger=require(_0x3c98('0x15'))(_0x3c98('0x16'));var utils=require('../../config/utils');var config=require(_0x3c98('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c98('0x18'))['db'];function respondWithStatusCode(_0x4ad82d,_0x4e3faa){_0x4e3faa=_0x4e3faa||0xcc;return function(_0x1f9998){if(_0x1f9998){return _0x4ad82d[_0x3c98('0x19')](_0x4e3faa);}return _0x4ad82d['status'](_0x4e3faa)[_0x3c98('0x1a')]();};}function respondWithResult(_0x351bc1,_0x5e8167){_0x5e8167=_0x5e8167||0xc8;return function(_0x229cac){if(_0x229cac){return _0x351bc1[_0x3c98('0x1b')](_0x5e8167)[_0x3c98('0x1c')](_0x229cac);}};}function respondWithFilteredResult(_0x12c86c,_0x105ae4){return function(_0x4ef2d9){if(_0x4ef2d9){var _0x4fd43b=typeof _0x105ae4[_0x3c98('0x1d')]===_0x3c98('0x1e')&&typeof _0x105ae4[_0x3c98('0x1f')]===_0x3c98('0x1e');var _0x1bf82f=_0x4ef2d9['count'];var _0x1d0fa4=_0x4fd43b?0x0:_0x105ae4[_0x3c98('0x1d')];var _0x35083e=_0x4fd43b?_0x4ef2d9[_0x3c98('0x20')]:_0x105ae4[_0x3c98('0x1d')]+_0x105ae4['limit'];var _0x4f56b2;if(_0x35083e>=_0x1bf82f){_0x35083e=_0x1bf82f;_0x4f56b2=0xc8;}else{_0x4f56b2=0xce;}_0x12c86c[_0x3c98('0x1b')](_0x4f56b2);return _0x12c86c[_0x3c98('0x21')]('Content-Range',_0x1d0fa4+'-'+_0x35083e+'/'+_0x1bf82f)[_0x3c98('0x1c')](_0x4ef2d9);}return null;};}function patchUpdates(_0x1fa1f8){return function(_0x1d2535){try{jsonpatch[_0x3c98('0x22')](_0x1d2535,_0x1fa1f8,!![]);}catch(_0x3d0363){return BPromise[_0x3c98('0x23')](_0x3d0363);}return _0x1d2535[_0x3c98('0x24')]();};}function saveUpdates(_0x4d22b4,_0x328486){return function(_0x30ab75){if(_0x30ab75){return _0x30ab75['update'](_0x4d22b4)[_0x3c98('0x25')](function(_0x5912ed){return _0x5912ed;});}return null;};}function removeEntity(_0xba650b,_0x3efb13){return function(_0x2fe345){if(_0x2fe345){return _0x2fe345[_0x3c98('0x26')]()[_0x3c98('0x25')](function(){_0xba650b[_0x3c98('0x1b')](0xcc)[_0x3c98('0x1a')]();});}};}function handleEntityNotFound(_0x55171a,_0x18cba8){return function(_0x1bc0d5){if(!_0x1bc0d5){_0x55171a[_0x3c98('0x19')](0x194);}return _0x1bc0d5;};}function handleError(_0x496da0,_0x293bad){_0x293bad=_0x293bad||0x1f4;return function(_0x127458){logger[_0x3c98('0x27')](_0x127458[_0x3c98('0x28')]);if(_0x127458['name']){delete _0x127458[_0x3c98('0x29')];}_0x496da0['status'](_0x293bad)[_0x3c98('0x2a')](_0x127458);};}exports[_0x3c98('0x2b')]=function(_0x5ef815,_0x387a28){var _0x30b5d9={},_0x5f8aab={},_0x3d0c29={'count':0x0,'rows':[]};var _0x5e2a5d=_[_0x3c98('0x2c')](db[_0x3c98('0x2d')][_0x3c98('0x2e')],function(_0xfcd8de){return{'name':_0xfcd8de['fieldName'],'type':_0xfcd8de[_0x3c98('0x2f')][_0x3c98('0x30')]};});_0x5f8aab[_0x3c98('0x31')]=_[_0x3c98('0x2c')](_0x5e2a5d,_0x3c98('0x29'));_0x5f8aab[_0x3c98('0x32')]=_[_0x3c98('0x33')](_0x5ef815[_0x3c98('0x32')]);_0x5f8aab[_0x3c98('0x34')]=_[_0x3c98('0x35')](_0x5f8aab[_0x3c98('0x31')],_0x5f8aab[_0x3c98('0x32')]);_0x30b5d9['attributes']=_[_0x3c98('0x35')](_0x5f8aab[_0x3c98('0x31')],qs['fields'](_0x5ef815[_0x3c98('0x32')][_0x3c98('0x36')]));_0x30b5d9['attributes']=_0x30b5d9['attributes']['length']?_0x30b5d9[_0x3c98('0x37')]:_0x5f8aab['model'];if(!_0x5ef815[_0x3c98('0x32')][_0x3c98('0x38')](_0x3c98('0x39'))){_0x30b5d9[_0x3c98('0x1f')]=qs[_0x3c98('0x1f')](_0x5ef815[_0x3c98('0x32')][_0x3c98('0x1f')]);_0x30b5d9[_0x3c98('0x1d')]=qs[_0x3c98('0x1d')](_0x5ef815['query']['offset']);}_0x30b5d9[_0x3c98('0x3a')]=qs[_0x3c98('0x3b')](_0x5ef815[_0x3c98('0x32')][_0x3c98('0x3b')]);_0x30b5d9['where']=qs[_0x3c98('0x34')](_[_0x3c98('0x3c')](_0x5ef815[_0x3c98('0x32')],_0x5f8aab[_0x3c98('0x34')]),_0x5e2a5d);if(_0x5ef815[_0x3c98('0x32')][_0x3c98('0x3d')]){_0x30b5d9['where']=_[_0x3c98('0x3e')](_0x30b5d9['where'],{'$or':_[_0x3c98('0x2c')](_0x5e2a5d,function(_0x2ef903){if(_0x2ef903[_0x3c98('0x2f')]!==_0x3c98('0x3f')){var _0x3b3054={};_0x3b3054[_0x2ef903[_0x3c98('0x29')]]={'$like':'%'+_0x5ef815['query'][_0x3c98('0x3d')]+'%'};return _0x3b3054;}})});}_0x30b5d9=_[_0x3c98('0x3e')]({},_0x30b5d9,_0x5ef815[_0x3c98('0x40')]);var _0x23297a={'where':_0x30b5d9[_0x3c98('0x41')]};return db[_0x3c98('0x2d')][_0x3c98('0x20')](_0x23297a)[_0x3c98('0x25')](function(_0x440e05){_0x3d0c29[_0x3c98('0x20')]=_0x440e05;if(_0x5ef815[_0x3c98('0x32')]['includeAll']){_0x30b5d9[_0x3c98('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x3c98('0x43')](_0x30b5d9);})[_0x3c98('0x25')](function(_0x4f885d){_0x3d0c29[_0x3c98('0x44')]=_0x4f885d;return _0x3d0c29;})[_0x3c98('0x25')](respondWithFilteredResult(_0x387a28,_0x30b5d9))[_0x3c98('0x45')](handleError(_0x387a28,null));};exports[_0x3c98('0x46')]=function(_0x1ba464,_0x4bcb9a){var _0x22e3ba={'raw':!![],'where':{'id':_0x1ba464[_0x3c98('0x47')]['id']}},_0xfbed={};_0xfbed['model']=_[_0x3c98('0x33')](db[_0x3c98('0x2d')]['rawAttributes']);_0xfbed['query']=_[_0x3c98('0x33')](_0x1ba464['query']);_0xfbed[_0x3c98('0x34')]=_[_0x3c98('0x35')](_0xfbed[_0x3c98('0x31')],_0xfbed['query']);_0x22e3ba[_0x3c98('0x37')]=_['intersection'](_0xfbed[_0x3c98('0x31')],qs[_0x3c98('0x36')](_0x1ba464[_0x3c98('0x32')][_0x3c98('0x36')]));_0x22e3ba[_0x3c98('0x37')]=_0x22e3ba[_0x3c98('0x37')]['length']?_0x22e3ba[_0x3c98('0x37')]:_0xfbed[_0x3c98('0x31')];if(_0x1ba464[_0x3c98('0x32')][_0x3c98('0x48')]){_0x22e3ba[_0x3c98('0x42')]=[{'all':!![]}];}_0x22e3ba=_[_0x3c98('0x3e')]({},_0x22e3ba,_0x1ba464[_0x3c98('0x40')]);return db[_0x3c98('0x2d')][_0x3c98('0x49')](_0x22e3ba)[_0x3c98('0x25')](handleEntityNotFound(_0x4bcb9a,null))[_0x3c98('0x25')](respondWithResult(_0x4bcb9a,null))[_0x3c98('0x45')](handleError(_0x4bcb9a,null));};exports[_0x3c98('0x4a')]=function(_0x23a9e9,_0x430b6b){var _0x23f83d={'where':{'id':_0x23a9e9[_0x3c98('0x47')]['id']}},_0x1d1a5b={};_0x1d1a5b[_0x3c98('0x31')]=_[_0x3c98('0x33')](db[_0x3c98('0x2d')][_0x3c98('0x2e')]);_0x23f83d[_0x3c98('0x37')]=_[_0x3c98('0x35')](_0x1d1a5b[_0x3c98('0x31')],qs[_0x3c98('0x36')](_0x23a9e9['query'][_0x3c98('0x36')]));_0x23f83d[_0x3c98('0x37')]=_0x23f83d[_0x3c98('0x37')][_0x3c98('0x4b')]?_0x23f83d[_0x3c98('0x37')]:_0x1d1a5b['model'];if(_0x23a9e9[_0x3c98('0x32')][_0x3c98('0x48')]){_0x23f83d[_0x3c98('0x42')]=[{'all':!![]}];}_0x23f83d=_[_0x3c98('0x3e')]({},_0x23f83d,_0x23a9e9[_0x3c98('0x40')]);return db[_0x3c98('0x2d')][_0x3c98('0x49')](_0x23f83d)['then'](handleEntityNotFound(_0x430b6b,null))['then'](function(_0x450fc1){if(_0x450fc1){var _0x1a5d17=_0x450fc1['get']({'plain':!![]});_0x1a5d17=qs['omit'](_0x1a5d17,['id',_0x3c98('0x4c'),_0x3c98('0x4d')]);_0x23a9e9['body']=_[_0x3c98('0x4e')](_0x23a9e9['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0x3c98('0x4f')](_[_0x3c98('0x3e')](_0x1a5d17,_0x23a9e9['body']),{'include':_0x23a9e9[_0x3c98('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x430b6b,0xc9))[_0x3c98('0x45')](handleError(_0x430b6b,null));};exports['update']=function(_0x5f4ba9,_0x5212bd){if(_0x5f4ba9[_0x3c98('0x50')]['id']){delete _0x5f4ba9[_0x3c98('0x50')]['id'];}return db[_0x3c98('0x2d')]['find']({'where':{'id':_0x5f4ba9[_0x3c98('0x47')]['id']}})[_0x3c98('0x25')](handleEntityNotFound(_0x5212bd,null))[_0x3c98('0x25')](saveUpdates(_0x5f4ba9[_0x3c98('0x50')],null))[_0x3c98('0x25')](respondWithResult(_0x5212bd,null))[_0x3c98('0x45')](handleError(_0x5212bd,null));};exports['destroy']=function(_0x38d339,_0x474c4a){return db[_0x3c98('0x2d')][_0x3c98('0x49')]({'where':{'id':_0x38d339[_0x3c98('0x47')]['id']}})[_0x3c98('0x25')](handleEntityNotFound(_0x474c4a,null))[_0x3c98('0x25')](removeEntity(_0x474c4a,null))['catch'](handleError(_0x474c4a,null));};exports[_0x3c98('0x4f')]=function(_0x16e569,_0x27c07f,_0xf03a3a){_0x16e569[_0x3c98('0x50')]['name']=_0x16e569['file'][_0x3c98('0x51')];_0x16e569[_0x3c98('0x50')]['basename']=_0x16e569[_0x3c98('0x52')][_0x3c98('0x53')];_0x16e569[_0x3c98('0x50')]['type']=_0x16e569[_0x3c98('0x52')][_0x3c98('0x54')];return db['Attachment'][_0x3c98('0x4f')](_0x16e569['body'])[_0x3c98('0x25')](respondWithResult(_0x27c07f,0xc9))[_0x3c98('0x45')](handleError(_0x27c07f,null));};exports['download']=function(_0x16e0ec,_0x281427,_0x2691b7){return db[_0x3c98('0x2d')][_0x3c98('0x55')]({'where':{'id':_0x16e0ec['params']['id']},'raw':!![]})[_0x3c98('0x25')](handleEntityNotFound(_0x281427,null))['then'](function(_0x327fbb){if(_0x327fbb){var _0x14c7b7=_0x327fbb[_0x3c98('0x56')]!==null;var _0x2ba80d=path['join'](config[_0x3c98('0x57')],'server/files/attachments/');if(_0x14c7b7){_0x2ba80d=path['join'](_0x2ba80d,_0x3c98('0x58'));}var _0x59e175=path['join'](_0x2ba80d,_0x327fbb[_0x3c98('0x59')]);return _0x281427[_0x3c98('0x5a')](_0x59e175);}})[_0x3c98('0x45')](handleError(_0x281427,null));}; \ No newline at end of file +var _0x7069=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','name','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','Attachment','includeAll','include','findAll','rows','show','params','length','options','find','catch','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','server/files/attachments/','offline-chat/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2279ad,_0x467d8d){var _0x5b51d9=function(_0x26e830){while(--_0x26e830){_0x2279ad['push'](_0x2279ad['shift']());}};_0x5b51d9(++_0x467d8d);}(_0x7069,0x9b));var _0x9706=function(_0x1d074e,_0x1a4cd3){_0x1d074e=_0x1d074e-0x0;var _0x2ff036=_0x7069[_0x1d074e];return _0x2ff036;};'use strict';var emlformat=require(_0x9706('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9706('0x1'));var jsonpatch=require(_0x9706('0x2'));var rp=require(_0x9706('0x3'));var moment=require(_0x9706('0x4'));var BPromise=require(_0x9706('0x5'));var Mustache=require(_0x9706('0x6'));var util=require('util');var path=require(_0x9706('0x7'));var sox=require(_0x9706('0x8'));var csv=require(_0x9706('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9706('0xa'));var _=require(_0x9706('0xb'));var squel=require(_0x9706('0xc'));var crypto=require(_0x9706('0xd'));var jsforce=require(_0x9706('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9706('0x9'));var querystring=require(_0x9706('0xf'));var Papa=require(_0x9706('0x10'));var Redis=require(_0x9706('0x11'));var authService=require(_0x9706('0x12'));var qs=require(_0x9706('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9706('0x14'));var logger=require('../../config/logger')(_0x9706('0x15'));var utils=require(_0x9706('0x16'));var config=require(_0x9706('0x17'));var licenseUtil=require(_0x9706('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373aa1,_0x2e652f){_0x2e652f=_0x2e652f||0xcc;return function(_0x14be07){if(_0x14be07){return _0x373aa1[_0x9706('0x19')](_0x2e652f);}return _0x373aa1[_0x9706('0x1a')](_0x2e652f)[_0x9706('0x1b')]();};}function respondWithResult(_0x5a63d1,_0x3bcb88){_0x3bcb88=_0x3bcb88||0xc8;return function(_0x3ed864){if(_0x3ed864){return _0x5a63d1[_0x9706('0x1a')](_0x3bcb88)[_0x9706('0x1c')](_0x3ed864);}};}function respondWithFilteredResult(_0xa5d4a3,_0x1e8110){return function(_0x13e0ba){if(_0x13e0ba){var _0x4152a9=typeof _0x1e8110['offset']===_0x9706('0x1d')&&typeof _0x1e8110[_0x9706('0x1e')]==='undefined';var _0x162a69=_0x13e0ba[_0x9706('0x1f')];var _0x462e2a=_0x4152a9?0x0:_0x1e8110[_0x9706('0x20')];var _0x3b252e=_0x4152a9?_0x13e0ba[_0x9706('0x1f')]:_0x1e8110['offset']+_0x1e8110[_0x9706('0x1e')];var _0x32ec98;if(_0x3b252e>=_0x162a69){_0x3b252e=_0x162a69;_0x32ec98=0xc8;}else{_0x32ec98=0xce;}_0xa5d4a3[_0x9706('0x1a')](_0x32ec98);return _0xa5d4a3['set'](_0x9706('0x21'),_0x462e2a+'-'+_0x3b252e+'/'+_0x162a69)['json'](_0x13e0ba);}return null;};}function patchUpdates(_0x488090){return function(_0x69271a){try{jsonpatch[_0x9706('0x22')](_0x69271a,_0x488090,!![]);}catch(_0x3ff053){return BPromise['reject'](_0x3ff053);}return _0x69271a[_0x9706('0x23')]();};}function saveUpdates(_0x31ef84,_0x191dbf){return function(_0x1839f8){if(_0x1839f8){return _0x1839f8[_0x9706('0x24')](_0x31ef84)[_0x9706('0x25')](function(_0x26be91){return _0x26be91;});}return null;};}function removeEntity(_0x34e111,_0x14a14a){return function(_0x3167be){if(_0x3167be){return _0x3167be[_0x9706('0x26')]()[_0x9706('0x25')](function(){_0x34e111['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2123c4,_0x1679c6){return function(_0x57b211){if(!_0x57b211){_0x2123c4[_0x9706('0x19')](0x194);}return _0x57b211;};}function handleError(_0x28b3e0,_0x8670f5){_0x8670f5=_0x8670f5||0x1f4;return function(_0x2f0c8a){logger[_0x9706('0x27')](_0x2f0c8a['stack']);if(_0x2f0c8a[_0x9706('0x28')]){delete _0x2f0c8a[_0x9706('0x28')];}_0x28b3e0[_0x9706('0x1a')](_0x8670f5)['send'](_0x2f0c8a);};}exports[_0x9706('0x29')]=function(_0x19dbe7,_0x6b7717){var _0x3ffaf2={},_0x57fe64={},_0x1f220e={'count':0x0,'rows':[]};var _0xd2f1f6=_[_0x9706('0x2a')](db['Attachment'][_0x9706('0x2b')],function(_0x3325b9){return{'name':_0x3325b9['fieldName'],'type':_0x3325b9['type'][_0x9706('0x2c')]};});_0x57fe64['model']=_[_0x9706('0x2a')](_0xd2f1f6,'name');_0x57fe64[_0x9706('0x2d')]=_[_0x9706('0x2e')](_0x19dbe7[_0x9706('0x2d')]);_0x57fe64['filters']=_[_0x9706('0x2f')](_0x57fe64[_0x9706('0x30')],_0x57fe64[_0x9706('0x2d')]);_0x3ffaf2[_0x9706('0x31')]=_[_0x9706('0x2f')](_0x57fe64['model'],qs[_0x9706('0x32')](_0x19dbe7['query']['fields']));_0x3ffaf2[_0x9706('0x31')]=_0x3ffaf2[_0x9706('0x31')]['length']?_0x3ffaf2['attributes']:_0x57fe64['model'];if(!_0x19dbe7[_0x9706('0x2d')][_0x9706('0x33')](_0x9706('0x34'))){_0x3ffaf2[_0x9706('0x1e')]=qs['limit'](_0x19dbe7['query'][_0x9706('0x1e')]);_0x3ffaf2['offset']=qs[_0x9706('0x20')](_0x19dbe7[_0x9706('0x2d')][_0x9706('0x20')]);}_0x3ffaf2[_0x9706('0x35')]=qs[_0x9706('0x36')](_0x19dbe7['query'][_0x9706('0x36')]);_0x3ffaf2[_0x9706('0x37')]=qs[_0x9706('0x38')](_[_0x9706('0x39')](_0x19dbe7[_0x9706('0x2d')],_0x57fe64[_0x9706('0x38')]),_0xd2f1f6);if(_0x19dbe7[_0x9706('0x2d')]['filter']){_0x3ffaf2[_0x9706('0x37')]=_[_0x9706('0x3a')](_0x3ffaf2[_0x9706('0x37')],{'$or':_[_0x9706('0x2a')](_0xd2f1f6,function(_0x21892e){if(_0x21892e[_0x9706('0x3b')]!=='VIRTUAL'){var _0x309675={};_0x309675[_0x21892e[_0x9706('0x28')]]={'$like':'%'+_0x19dbe7[_0x9706('0x2d')][_0x9706('0x3c')]+'%'};return _0x309675;}})});}_0x3ffaf2=_[_0x9706('0x3a')]({},_0x3ffaf2,_0x19dbe7['options']);var _0x149289={'where':_0x3ffaf2[_0x9706('0x37')]};return db[_0x9706('0x3d')][_0x9706('0x1f')](_0x149289)[_0x9706('0x25')](function(_0x4ac47e){_0x1f220e[_0x9706('0x1f')]=_0x4ac47e;if(_0x19dbe7[_0x9706('0x2d')][_0x9706('0x3e')]){_0x3ffaf2[_0x9706('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x9706('0x40')](_0x3ffaf2);})[_0x9706('0x25')](function(_0x504dc7){_0x1f220e[_0x9706('0x41')]=_0x504dc7;return _0x1f220e;})['then'](respondWithFilteredResult(_0x6b7717,_0x3ffaf2))['catch'](handleError(_0x6b7717,null));};exports[_0x9706('0x42')]=function(_0x1c66ab,_0x56406c){var _0x1274d6={'raw':!![],'where':{'id':_0x1c66ab[_0x9706('0x43')]['id']}},_0x3d9d5e={};_0x3d9d5e[_0x9706('0x30')]=_[_0x9706('0x2e')](db['Attachment']['rawAttributes']);_0x3d9d5e[_0x9706('0x2d')]=_[_0x9706('0x2e')](_0x1c66ab['query']);_0x3d9d5e[_0x9706('0x38')]=_[_0x9706('0x2f')](_0x3d9d5e[_0x9706('0x30')],_0x3d9d5e[_0x9706('0x2d')]);_0x1274d6[_0x9706('0x31')]=_['intersection'](_0x3d9d5e['model'],qs[_0x9706('0x32')](_0x1c66ab[_0x9706('0x2d')]['fields']));_0x1274d6[_0x9706('0x31')]=_0x1274d6[_0x9706('0x31')][_0x9706('0x44')]?_0x1274d6['attributes']:_0x3d9d5e[_0x9706('0x30')];if(_0x1c66ab['query']['includeAll']){_0x1274d6[_0x9706('0x3f')]=[{'all':!![]}];}_0x1274d6=_['merge']({},_0x1274d6,_0x1c66ab[_0x9706('0x45')]);return db['Attachment'][_0x9706('0x46')](_0x1274d6)['then'](handleEntityNotFound(_0x56406c,null))[_0x9706('0x25')](respondWithResult(_0x56406c,null))[_0x9706('0x47')](handleError(_0x56406c,null));};exports['clone']=function(_0x336d3b,_0x36c265){var _0x5b6488={'where':{'id':_0x336d3b[_0x9706('0x43')]['id']}},_0xc489a5={};_0xc489a5[_0x9706('0x30')]=_[_0x9706('0x2e')](db[_0x9706('0x3d')][_0x9706('0x2b')]);_0x5b6488[_0x9706('0x31')]=_['intersection'](_0xc489a5['model'],qs['fields'](_0x336d3b['query'][_0x9706('0x32')]));_0x5b6488['attributes']=_0x5b6488[_0x9706('0x31')][_0x9706('0x44')]?_0x5b6488[_0x9706('0x31')]:_0xc489a5[_0x9706('0x30')];if(_0x336d3b[_0x9706('0x2d')][_0x9706('0x3e')]){_0x5b6488[_0x9706('0x3f')]=[{'all':!![]}];}_0x5b6488=_['merge']({},_0x5b6488,_0x336d3b['options']);return db[_0x9706('0x3d')][_0x9706('0x46')](_0x5b6488)[_0x9706('0x25')](handleEntityNotFound(_0x36c265,null))[_0x9706('0x25')](function(_0x32c4d9){if(_0x32c4d9){var _0x42dccb=_0x32c4d9[_0x9706('0x48')]({'plain':!![]});_0x42dccb=qs[_0x9706('0x49')](_0x42dccb,['id',_0x9706('0x4a'),_0x9706('0x4b')]);_0x336d3b['body']=_['omit'](_0x336d3b[_0x9706('0x4c')],['id',_0x9706('0x4a'),'updatedAt']);return db['Attachment'][_0x9706('0x4d')](_[_0x9706('0x3a')](_0x42dccb,_0x336d3b[_0x9706('0x4c')]),{'include':_0x336d3b[_0x9706('0x2d')][_0x9706('0x3e')]?[{'all':!![]}]:undefined});}})[_0x9706('0x25')](respondWithResult(_0x36c265,0xc9))[_0x9706('0x47')](handleError(_0x36c265,null));};exports[_0x9706('0x24')]=function(_0x246435,_0x53c879){if(_0x246435[_0x9706('0x4c')]['id']){delete _0x246435[_0x9706('0x4c')]['id'];}return db[_0x9706('0x3d')][_0x9706('0x46')]({'where':{'id':_0x246435[_0x9706('0x43')]['id']}})[_0x9706('0x25')](handleEntityNotFound(_0x53c879,null))['then'](saveUpdates(_0x246435['body'],null))[_0x9706('0x25')](respondWithResult(_0x53c879,null))[_0x9706('0x47')](handleError(_0x53c879,null));};exports[_0x9706('0x26')]=function(_0x557428,_0x2fd10d){return db['Attachment'][_0x9706('0x46')]({'where':{'id':_0x557428[_0x9706('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fd10d,null))[_0x9706('0x25')](removeEntity(_0x2fd10d,null))['catch'](handleError(_0x2fd10d,null));};exports[_0x9706('0x4d')]=function(_0x29b613,_0x5c5657,_0x1b8000){_0x29b613['body'][_0x9706('0x28')]=_0x29b613[_0x9706('0x4e')][_0x9706('0x4f')];_0x29b613['body'][_0x9706('0x50')]=_0x29b613[_0x9706('0x4e')][_0x9706('0x51')];_0x29b613[_0x9706('0x4c')]['type']=_0x29b613[_0x9706('0x4e')][_0x9706('0x52')];return db[_0x9706('0x3d')][_0x9706('0x4d')](_0x29b613[_0x9706('0x4c')])[_0x9706('0x25')](respondWithResult(_0x5c5657,0xc9))[_0x9706('0x47')](handleError(_0x5c5657,null));};exports['download']=function(_0x302924,_0x1d4255,_0x4713c3){return db['Attachment'][_0x9706('0x53')]({'where':{'id':_0x302924[_0x9706('0x43')]['id']},'raw':!![]})[_0x9706('0x25')](handleEntityNotFound(_0x1d4255,null))[_0x9706('0x25')](function(_0x2d2528){if(_0x2d2528){var _0x49b6cf=_0x2d2528[_0x9706('0x54')]!==null;var _0x2afc50=path['join'](config['root'],_0x9706('0x55'));if(_0x49b6cf){_0x2afc50=path['join'](_0x2afc50,_0x9706('0x56'));}var _0xbfc5f1=path[_0x9706('0x57')](_0x2afc50,_0x2d2528[_0x9706('0x50')]);return _0x1d4255['download'](_0xbfc5f1);}})['catch'](handleError(_0x1d4255,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 09cb26b..8925214 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 _0x0d23=['exports','Attachment','util','../../config/logger','api','moment','path','rimraf'];(function(_0x4ce2d9,_0x5644fb){var _0x24eafc=function(_0x3471c7){while(--_0x3471c7){_0x4ce2d9['push'](_0x4ce2d9['shift']());}};_0x24eafc(++_0x5644fb);}(_0x0d23,0x72));var _0x30d2=function(_0x108284,_0x57930b){_0x108284=_0x108284-0x0;var _0xff58d=_0x0d23[_0x108284];return _0xff58d;};'use strict';var _=require('lodash');var util=require(_0x30d2('0x0'));var logger=require(_0x30d2('0x1'))(_0x30d2('0x2'));var moment=require(_0x30d2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d2('0x4'));var rimraf=require(_0x30d2('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x30d2('0x6')]=function(_0x4c9add,_0x13fac6){return _0x4c9add['define'](_0x30d2('0x7'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c46=['../../config/environment','./attachment.attributes','Attachment','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x149145,_0x352f93){var _0x9db71b=function(_0x5df39f){while(--_0x5df39f){_0x149145['push'](_0x149145['shift']());}};_0x9db71b(++_0x352f93);}(_0x7c46,0x100));var _0x67c4=function(_0x31c70c,_0x145807){_0x31c70c=_0x31c70c-0x0;var _0x3fc86b=_0x7c46[_0x31c70c];return _0x3fc86b;};'use strict';var _=require(_0x67c4('0x0'));var util=require(_0x67c4('0x1'));var logger=require('../../config/logger')(_0x67c4('0x2'));var moment=require(_0x67c4('0x3'));var BPromise=require(_0x67c4('0x4'));var rp=require(_0x67c4('0x5'));var fs=require('fs');var path=require(_0x67c4('0x6'));var rimraf=require(_0x67c4('0x7'));var config=require(_0x67c4('0x8'));var attributes=require(_0x67c4('0x9'));module['exports']=function(_0x2647e4,_0x3500f9){return _0x2647e4['define'](_0x67c4('0xa'),attributes,{'tableName':'attachments','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 cfc71ae..6b67f00 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 _0x202c=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x11bc40,_0x537bbc){var _0x2b7a99=function(_0x50135b){while(--_0x50135b){_0x11bc40['push'](_0x11bc40['shift']());}};_0x2b7a99(++_0x537bbc);}(_0x202c,0x178));var _0xc202=function(_0x3582de,_0x4cd6d1){_0x3582de=_0x3582de-0x0;var _0x202b18=_0x202c[_0x3582de];return _0x202b18;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Attachment,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});}exports[_0xc202('0x16')]=function(_0x9620a0){var _0x591ecc=this;return new Promise(function(_0x16ec7c,_0x2c5557){return db[_0xc202('0x17')]['create'](_0x9620a0['body'],{'raw':_0x9620a0[_0xc202('0x18')]?_0x9620a0[_0xc202('0x18')][_0xc202('0x19')]===undefined?!![]:![]:!![]})[_0xc202('0xb')](function(_0x2ae3c1){logger['info']('CreateAttachment',_0x9620a0);logger[_0xc202('0xf')]('CreateAttachment',_0x9620a0,JSON[_0xc202('0x11')](_0x2ae3c1));_0x16ec7c(_0x2ae3c1);})[_0xc202('0x15')](function(_0x56e979){logger['error'](_0xc202('0x16'),_0x56e979['message'],_0x9620a0);_0x2c5557(_0x591ecc[_0xc202('0x12')](0x1f4,_0x56e979[_0xc202('0x14')]));});});}; \ No newline at end of file +var _0xd49c=['body','options','raw','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateAttachment','create'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xd49c,0x1d8));var _0xcd49=function(_0x1766b6,_0x8052b0){_0x1766b6=_0x1766b6-0x0;var _0x11dc3d=_0xd49c[_0x1766b6];return _0x11dc3d;};'use strict';var _=require('lodash');var util=require(_0xcd49('0x0'));var moment=require('moment');var BPromise=require(_0xcd49('0x1'));var rs=require(_0xcd49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd49('0x4'))('rpc');var config=require(_0xcd49('0x5'));var jayson=require(_0xcd49('0x6'));var client=jayson[_0xcd49('0x7')][_0xcd49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x704584,_0x22f64b,_0x321013){return new BPromise(function(_0x17f26f,_0x3742e1){return client[_0xcd49('0x9')](_0x704584,_0x321013)[_0xcd49('0xa')](function(_0x4b7316){logger[_0xcd49('0xb')](_0xcd49('0xc'),_0x22f64b,_0xcd49('0xd'));logger[_0xcd49('0xe')](_0xcd49('0xf'),_0x22f64b,_0xcd49('0xd'),JSON[_0xcd49('0x10')](_0x4b7316));if(_0x4b7316[_0xcd49('0x11')]){if(_0x4b7316[_0xcd49('0x11')][_0xcd49('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x22f64b,_0x4b7316[_0xcd49('0x11')][_0xcd49('0x13')]);return _0x3742e1(_0x4b7316[_0xcd49('0x11')]['message']);}logger[_0xcd49('0x11')](_0xcd49('0xc'),_0x22f64b,_0x4b7316['error'][_0xcd49('0x13')]);return _0x17f26f(_0x4b7316[_0xcd49('0x11')][_0xcd49('0x13')]);}else{logger[_0xcd49('0xb')](_0xcd49('0xc'),_0x22f64b,_0xcd49('0xd'));_0x17f26f(_0x4b7316['result']['message']);}})['catch'](function(_0x4dabea){logger[_0xcd49('0x11')](_0xcd49('0xc'),_0x22f64b,_0x4dabea);_0x3742e1(_0x4dabea);});});}exports[_0xcd49('0x14')]=function(_0x484900){var _0x3074a4=this;return new Promise(function(_0x5f2ecb,_0x9c7262){return db['Attachment'][_0xcd49('0x15')](_0x484900[_0xcd49('0x16')],{'raw':_0x484900[_0xcd49('0x17')]?_0x484900[_0xcd49('0x17')][_0xcd49('0x18')]===undefined?!![]:![]:!![]})[_0xcd49('0xa')](function(_0x1c40a6){logger[_0xcd49('0xb')](_0xcd49('0x14'),_0x484900);logger['debug'](_0xcd49('0x14'),_0x484900,JSON[_0xcd49('0x10')](_0x1c40a6));_0x5f2ecb(_0x1c40a6);})[_0xcd49('0x19')](function(_0x5829d1){logger['error']('CreateAttachment',_0x5829d1[_0xcd49('0x13')],_0x484900);_0x9c7262(_0x3074a4[_0xcd49('0x11')](0x1f4,_0x5829d1['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 34f8496..eb45a93 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x4a7de1,_0x389df7){var _0x5817bd=function(_0x446225){while(--_0x446225){_0x4a7de1['push'](_0x4a7de1['shift']());}};_0x5817bd(++_0x389df7);}(_0x757a,0xde));var _0xa757=function(_0x5a5a95,_0x3ad80f){_0x5a5a95=_0x5a5a95-0x0;var _0x2d7358=_0x757a[_0x5a5a95];return _0x2d7358;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x7d0afd,_0x220310){var _0x112426=function(_0x2e85cb){while(--_0x2e85cb){_0x7d0afd['push'](_0x7d0afd['shift']());}};_0x112426(++_0x220310);}(_0xadb5,0xad));var _0x5adb=function(_0x1d81cd,_0x854c20){_0x1d81cd=_0x1d81cd-0x0;var _0xab87b5=_0xadb5[_0x1d81cd];return _0xab87b5;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index abf692e..9d6ee7b 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5467=['disabled','blocked','online','admin','agent','then','blockedAt','add','minutes','clearBlockUser','getLicense','catch','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','password','User','passport-local','Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','activedirectory','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role'];(function(_0x5d977f,_0x1f96a1){var _0x4b4b53=function(_0x16ea7f){while(--_0x16ea7f){_0x5d977f['push'](_0x5d977f['shift']());}};_0x4b4b53(++_0x1f96a1);}(_0x5467,0x1ab));var _0x7546=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x5467[_0xbb091];return _0x467a04;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x7546('0x0'))[_0x7546('0x1')];var moment=require(_0x7546('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x7546('0x3'));var util=require('util');var db=require(_0x7546('0x4'))['db'];var authService=require(_0x7546('0x5'));var utils=require(_0x7546('0x6'));var config=require(_0x7546('0x7'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x17b1e7){var _0x817e31=![];if(typeof _0x17b1e7['activedirectory']!=='undefined'){_0x817e31=_0x17b1e7['activedirectory']['baseDN']&&_0x17b1e7[_0x7546('0x8')]['url']&&_0x17b1e7[_0x7546('0x8')][_0x7546('0x9')];}return _0x817e31;}function adAuthenticate(_0x4ca4a2,_0x546f46,_0x1378b6){return new BPromise(function(_0x76e149,_0x401417){try{var _0x29c176=new ActiveDirectory(_0x4ca4a2);_0x29c176[_0x7546('0xa')](_0x546f46,_0x1378b6,function(_0x36b53d,_0x2afc83){if(_0x36b53d){logger[_0x7546('0xb')](_0x7546('0xc'),_0x546f46,util[_0x7546('0xd')](_0x36b53d,{'showHidden':![],'depth':null}));_0x401417(_0x7546('0xe'));}else if(!_0x2afc83){logger[_0x7546('0xb')](_0x7546('0xf'),_0x546f46);_0x401417(_0x7546('0xe'));}else{_0x76e149(_0x2afc83);}});}catch(_0x4a72df){_0x401417(_0x4a72df);}});}function ActiveDirectoryAuthenticate(_0x2702ec,_0x3c41ef,_0x13a645,_0x51bbbe){var _0x484b78,_0x2af3aa;if(!isActiveDirectoryConfigured(config)){logger[_0x7546('0xb')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3c41ef);return _0x51bbbe(null,![],{'message':_0x7546('0xe')});}return db['Setting'][_0x7546('0x10')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7546('0x11')],'raw':!![]})['then'](function(_0x23e2fa){_0x484b78=_0x23e2fa;if(!_0x484b78[_0x7546('0x12')]){logger[_0x7546('0xb')](_0x7546('0x13'),_0x3c41ef);throw new Error(_0x7546('0xe'));}return _0x2702ec[_0x7546('0x10')]({'attributes':['id',_0x7546('0x14'),'password',_0x7546('0x15'),_0x7546('0x16'),_0x7546('0x17'),_0x7546('0x18'),'blockedAt',_0x7546('0x19')],'where':{'name':_0x3c41ef,'role':{'$or':[_0x7546('0x1a'),'user',_0x7546('0x1b')]},'adSsoEnabled':!![]}});})['then'](function(_0x140809){if(!_0x140809||_0x140809&&_0x140809[_0x7546('0x14')]!==_0x3c41ef){throw new Error(_0x7546('0xe'));}_0x2af3aa=_0x140809;var _0x2b1154=_0x2af3aa[_0x7546('0x14')]+'@'+config[_0x7546('0x8')][_0x7546('0x9')];return adAuthenticate(config[_0x7546('0x8')],_0x2b1154,_0x13a645);})[_0x7546('0x1c')](function(_0x2c674c){if(_0x2af3aa[_0x7546('0x17')]){throw new Error(_0x7546('0xe'));}if(_0x484b78['blockDuration']>0x0){if(_0x2af3aa['blocked']){if(moment(_0x2af3aa[_0x7546('0x1d')])[_0x7546('0x1e')](_0x484b78['blockDuration'],_0x7546('0x1f'))>moment()){throw new Error(_0x7546('0xe'));}return utils[_0x7546('0x20')](_0x2af3aa,0x0,![],null)[_0x7546('0x1c')](function(){return utils[_0x7546('0x21')](_0x2af3aa);})[_0x7546('0x1c')](function(){return _0x51bbbe(null,_0x2af3aa);});}else{return utils[_0x7546('0x21')](_0x2af3aa)[_0x7546('0x1c')](function(){return _0x51bbbe(null,_0x2af3aa);});}}else{return utils[_0x7546('0x21')](_0x2af3aa)[_0x7546('0x1c')](function(){return _0x51bbbe(null,_0x2af3aa);});}})[_0x7546('0x22')](function(_0x2c752e){return _0x51bbbe(null,![],_0x2c752e);});}function handleError(_0x365321,_0x286b12,_0x1b657a){return _0x365321['status'](_0x286b12||0x1f4)[_0x7546('0x23')]({'message':_0x1b657a?_0x1b657a[_0x7546('0x24')]||_0x1b657a:''});}exports[_0x7546('0x25')]=function(_0x51caea,_0x1ab151,_0x3f952a){passport[_0x7546('0xa')]('ad-login',function(_0x4055e0,_0x5f4f78,_0x2bcfad){var _0x3a364d=_0x4055e0||_0x2bcfad;if(_0x3a364d){return handleError(_0x1ab151,0x191,_0x3a364d);}if(!_0x5f4f78){return handleError(_0x1ab151,0x194,{'message':_0x7546('0x26')});}else{var _0x50af9e={'payload':{'id':_0x5f4f78['id'],'role':_0x5f4f78[_0x7546('0x16')]},'options':{'expiresIn':0x15180}};return authService[_0x7546('0x27')](_0x50af9e)[_0x7546('0x1c')](function(_0x2bdf7e){_0x1ab151[_0x7546('0x28')]({'id':_0x5f4f78['id'],'token':_0x2bdf7e,'statusCall':'','isAlreadyLogged':_0x5f4f78[_0x7546('0x19')]});});}})(_0x51caea,_0x1ab151,_0x3f952a);};passport[_0x7546('0x29')](_0x7546('0x2a'),new LocalStrategy({'usernameField':'name','passwordField':_0x7546('0x2b')},function(_0x1f567e,_0x499bd3,_0x591378){return ActiveDirectoryAuthenticate(db[_0x7546('0x2c')],_0x1f567e,_0x499bd3,_0x591378);})); \ No newline at end of file +var _0x7649=['inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','admin','user','agent','disabled','blockedAt','add','minutes','getLicense','catch','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','User','passport','passport-local','Strategy','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s'];(function(_0x5d2840,_0x3233e3){var _0x5f3555=function(_0x5550d0){while(--_0x5550d0){_0x5d2840['push'](_0x5d2840['shift']());}};_0x5f3555(++_0x3233e3);}(_0x7649,0x11f));var _0x9764=function(_0x274989,_0x34a495){_0x274989=_0x274989-0x0;var _0x334ac5=_0x7649[_0x274989];return _0x334ac5;};'use strict';var passport=require(_0x9764('0x0'));var LocalStrategy=require(_0x9764('0x1'))[_0x9764('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x9764('0x3'));var BPromise=require('bluebird');var util=require(_0x9764('0x4'));var db=require(_0x9764('0x5'))['db'];var authService=require(_0x9764('0x6'));var utils=require(_0x9764('0x7'));var config=require(_0x9764('0x8'));var logger=require(_0x9764('0x9'))(_0x9764('0xa'));function isActiveDirectoryConfigured(_0x41e071){var _0x4a1e07=![];if(typeof _0x41e071[_0x9764('0xb')]!==_0x9764('0xc')){_0x4a1e07=_0x41e071[_0x9764('0xb')][_0x9764('0xd')]&&_0x41e071[_0x9764('0xb')][_0x9764('0xe')]&&_0x41e071[_0x9764('0xb')][_0x9764('0xf')];}return _0x4a1e07;}function adAuthenticate(_0x3addca,_0x1b957c,_0x221d33){return new BPromise(function(_0xafef82,_0x343186){try{var _0x1a858f=new ActiveDirectory(_0x3addca);_0x1a858f[_0x9764('0x10')](_0x1b957c,_0x221d33,function(_0x208675,_0x5e7c01){if(_0x208675){logger[_0x9764('0x11')](_0x9764('0x12'),_0x1b957c,util[_0x9764('0x13')](_0x208675,{'showHidden':![],'depth':null}));_0x343186(_0x9764('0x14'));}else if(!_0x5e7c01){logger[_0x9764('0x11')](_0x9764('0x15'),_0x1b957c);_0x343186('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xafef82(_0x5e7c01);}});}catch(_0x4f0ab9){_0x343186(_0x4f0ab9);}});}function ActiveDirectoryAuthenticate(_0x7a19d7,_0x110ff1,_0x5abb2d,_0x301c37){var _0x276fa8,_0x258705;if(!isActiveDirectoryConfigured(config)){logger[_0x9764('0x11')](_0x9764('0x16'),_0x110ff1);return _0x301c37(null,![],{'message':_0x9764('0x14')});}return db[_0x9764('0x17')][_0x9764('0x18')]({'where':{'id':0x1},'attributes':[_0x9764('0x19'),_0x9764('0x1a')],'raw':!![]})[_0x9764('0x1b')](function(_0x46bbd8){_0x276fa8=_0x46bbd8;if(!_0x276fa8['adSsoEnabled']){logger[_0x9764('0x11')](_0x9764('0x1c'),_0x110ff1);throw new Error(_0x9764('0x14'));}return _0x7a19d7[_0x9764('0x18')]({'attributes':['id',_0x9764('0x1d'),_0x9764('0x1e'),_0x9764('0x1f'),_0x9764('0x20'),'disabled',_0x9764('0x21'),'blockedAt','online'],'where':{'name':_0x110ff1,'role':{'$or':[_0x9764('0x22'),_0x9764('0x23'),_0x9764('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0x155d35){if(!_0x155d35||_0x155d35&&_0x155d35['name']!==_0x110ff1){throw new Error(_0x9764('0x14'));}_0x258705=_0x155d35;var _0x33a3c2=_0x258705[_0x9764('0x1d')]+'@'+config[_0x9764('0xb')]['domain'];return adAuthenticate(config[_0x9764('0xb')],_0x33a3c2,_0x5abb2d);})[_0x9764('0x1b')](function(_0x3223b3){if(_0x258705[_0x9764('0x25')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x276fa8[_0x9764('0x1a')]>0x0){if(_0x258705[_0x9764('0x21')]){if(moment(_0x258705[_0x9764('0x26')])[_0x9764('0x27')](_0x276fa8[_0x9764('0x1a')],_0x9764('0x28'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x258705,0x0,![],null)[_0x9764('0x1b')](function(){return utils['getLicense'](_0x258705);})[_0x9764('0x1b')](function(){return _0x301c37(null,_0x258705);});}else{return utils[_0x9764('0x29')](_0x258705)['then'](function(){return _0x301c37(null,_0x258705);});}}else{return utils['getLicense'](_0x258705)[_0x9764('0x1b')](function(){return _0x301c37(null,_0x258705);});}})[_0x9764('0x2a')](function(_0x695359){return _0x301c37(null,![],_0x695359);});}function handleError(_0x363afb,_0x4ead44,_0x5ef3cd){return _0x363afb[_0x9764('0x2b')](_0x4ead44||0x1f4)[_0x9764('0x2c')]({'message':_0x5ef3cd?_0x5ef3cd[_0x9764('0x2d')]||_0x5ef3cd:''});}exports['login']=function(_0x100baf,_0x252e3b,_0x5ba766){passport['authenticate']('ad-login',function(_0x427050,_0x5956d3,_0x3b5596){var _0x48fb7a=_0x427050||_0x3b5596;if(_0x48fb7a){return handleError(_0x252e3b,0x191,_0x48fb7a);}if(!_0x5956d3){return handleError(_0x252e3b,0x194,{'message':_0x9764('0x2e')});}else{var _0x562611={'payload':{'id':_0x5956d3['id'],'role':_0x5956d3[_0x9764('0x20')]},'options':{'expiresIn':0x15180}};return authService[_0x9764('0x2f')](_0x562611)[_0x9764('0x1b')](function(_0x175da3){_0x252e3b['json']({'id':_0x5956d3['id'],'token':_0x175da3,'statusCall':'','isAlreadyLogged':_0x5956d3[_0x9764('0x30')]});});}})(_0x100baf,_0x252e3b,_0x5ba766);};passport[_0x9764('0x31')]('ad-login',new LocalStrategy({'usernameField':_0x9764('0x1d'),'passwordField':_0x9764('0x1e')},function(_0x304d23,_0x54a9f3,_0x34ec33){return ActiveDirectoryAuthenticate(db[_0x9764('0x32')],_0x304d23,_0x54a9f3,_0x34ec33);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a71b791..11c60ec 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e7a=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x12e6ff,_0x81cde2){var _0x40ea1c=function(_0x2faaef){while(--_0x2faaef){_0x12e6ff['push'](_0x12e6ff['shift']());}};_0x40ea1c(++_0x81cde2);}(_0x7e7a,0x1a8));var _0xa7e7=function(_0x20c361,_0x22697c){_0x20c361=_0x20c361-0x0;var _0x2ad721=_0x7e7a[_0x20c361];return _0x2ad721;};'use strict';var express=require(_0xa7e7('0x0'));var router=express[_0xa7e7('0x1')]();var controller=require(_0xa7e7('0x2'));router[_0xa7e7('0x3')]('/',controller[_0xa7e7('0x4')]);module[_0xa7e7('0x5')]=router; \ No newline at end of file +var _0x9c45=['post','login','Router','./authActiveDirectory.controller'];(function(_0x2b1a98,_0x4c9c43){var _0x457556=function(_0x4e2c1c){while(--_0x4e2c1c){_0x2b1a98['push'](_0x2b1a98['shift']());}};_0x457556(++_0x4c9c43);}(_0x9c45,0x12a));var _0x59c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c45[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x59c4('0x0')]();var controller=require(_0x59c4('0x1'));router[_0x59c4('0x2')]('/',controller[_0x59c4('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e92d0c3..ead9bb6 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x55380a,_0x536668){var _0x333037=function(_0x1ab290){while(--_0x1ab290){_0x55380a['push'](_0x55380a['shift']());}};_0x333037(++_0x536668);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x24fb83,_0x18caba){var _0x445a66=function(_0x3e4a23){while(--_0x3e4a23){_0x24fb83['push'](_0x24fb83['shift']());}};_0x445a66(++_0x18caba);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index bddc58f..037c734 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 _0xc7b9=['/callback','callback','isMiddleware','setTokenCookie','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xc7b9,0x1da));var _0x9c7b=function(_0x4ecd43,_0x4e2e28){_0x4ecd43=_0x4ecd43-0x0;var _0xf3bc9c=_0xc7b9[_0x4ecd43];return _0xf3bc9c;};'use strict';var express=require(_0x9c7b('0x0'));var passport=require(_0x9c7b('0x1'));var router=express['Router']();var controller=require(_0x9c7b('0x2'));var userController=require(_0x9c7b('0x3'));var authService=require(_0x9c7b('0x4'));router['get']('/',controller[_0x9c7b('0x5')]);router['get'](_0x9c7b('0x6'),controller[_0x9c7b('0x7')],authService[_0x9c7b('0x8')],userController['login'],authService[_0x9c7b('0x9')]);module['exports']=router; \ No newline at end of file +var _0xf5be=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','express'];(function(_0x48475b,_0x4d3077){var _0x3b241a=function(_0x5c4a49){while(--_0x5c4a49){_0x48475b['push'](_0x48475b['shift']());}};_0x3b241a(++_0x4d3077);}(_0xf5be,0x107));var _0xef5b=function(_0x20e255,_0x1cf24a){_0x20e255=_0x20e255-0x0;var _0x4c9db6=_0xf5be[_0x20e255];return _0x4c9db6;};'use strict';var express=require(_0xef5b('0x0'));var passport=require(_0xef5b('0x1'));var router=express[_0xef5b('0x2')]();var controller=require(_0xef5b('0x3'));var userController=require(_0xef5b('0x4'));var authService=require(_0xef5b('0x5'));router['get']('/',controller[_0xef5b('0x6')]);router[_0xef5b('0x7')](_0xef5b('0x8'),controller[_0xef5b('0x9')],authService[_0xef5b('0xa')],userController[_0xef5b('0x6')],authService[_0xef5b('0xb')]);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 44e334e..9d28ac1 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 _0x5a1a=['util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','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','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login'];(function(_0x39933f,_0x569b3f){var _0x326e4b=function(_0x2f37fc){while(--_0x2f37fc){_0x39933f['push'](_0x39933f['shift']());}};_0x326e4b(++_0x569b3f);}(_0x5a1a,0xff));var _0xa5a1=function(_0x27efcf,_0x320952){_0x27efcf=_0x27efcf-0x0;var _0xdb0237=_0x5a1a[_0x27efcf];return _0xdb0237;};'use strict';var util=require(_0xa5a1('0x0'));var passport=require(_0xa5a1('0x1'));var LocalStrategy=require(_0xa5a1('0x2'))[_0xa5a1('0x3')];var jayson=require(_0xa5a1('0x4'));var _=require(_0xa5a1('0x5'));var rs=require(_0xa5a1('0x6'));var moment=require(_0xa5a1('0x7'));var db=require(_0xa5a1('0x8'))['db'];var authService=require(_0xa5a1('0x9'));var utils=require(_0xa5a1('0xa'));var client=jayson['client'][_0xa5a1('0xb')]({'port':0x232b});function localAuthenticate(_0x3ba8ca,_0x508776,_0x3431a1,_0x217815){var _0x3f0102,_0x34fe2c;return db[_0xa5a1('0xc')][_0xa5a1('0xd')]({'where':{'id':0x1},'attributes':[_0xa5a1('0xe'),_0xa5a1('0xf')],'raw':!![]})[_0xa5a1('0x10')](function(_0x1559b0){_0x3f0102=_0x1559b0;return _0x3ba8ca['findOne']({'attributes':['id',_0xa5a1('0x11'),_0xa5a1('0x12'),_0xa5a1('0x13'),_0xa5a1('0x14'),_0xa5a1('0x15'),_0xa5a1('0x16'),_0xa5a1('0x17'),'loginAttempts'],'where':{'name':_0x508776,'role':{'$or':[_0xa5a1('0x18'),_0xa5a1('0x19'),_0xa5a1('0x1a')]}}});})[_0xa5a1('0x10')](function(_0x223453){if(!_0x223453||_0x223453&&_0x223453[_0xa5a1('0x11')]!==_0x508776){throw new Error(_0xa5a1('0x1b'));}else{_0x34fe2c=_0x223453;return _0x34fe2c;}})[_0xa5a1('0x10')](function(){_0x34fe2c[_0xa5a1('0x1c')](_0x3431a1,function(_0x177c58,_0x665e19){var _0x4f2b94=_0x34fe2c[_0xa5a1('0x1d')]+0x1;if(_0x177c58){return _0x217815(_0x177c58);}else if(!_0x665e19){if(_0x34fe2c['disabled']){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}else if(_0x3f0102[_0xa5a1('0xe')]>0x0){if(_0x34fe2c[_0xa5a1('0x16')]){if(_0x3f0102[_0xa5a1('0xf')]>0x0){if(moment(_0x34fe2c['blockedAt'])[_0xa5a1('0x1e')](_0x3f0102[_0xa5a1('0xf')],'minutes')>moment()){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}else{return utils['clearBlockUser'](_0x34fe2c,_0x4f2b94,![],null)[_0xa5a1('0x10')](function(){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});});}}else{return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}}else{if(_0x4f2b94>=_0x3f0102[_0xa5a1('0xe')]){return utils[_0xa5a1('0x1f')](_0x34fe2c,0x0,!![],moment())['then'](function(){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});});}else{return utils[_0xa5a1('0x1f')](_0x34fe2c,_0x4f2b94,![],null)[_0xa5a1('0x10')](function(){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});});}}}else{return _0x217815(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x34fe2c[_0xa5a1('0x15')]){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}else if(_0x3f0102[_0xa5a1('0xe')]>0x0){if(_0x34fe2c[_0xa5a1('0x16')]){if(_0x3f0102[_0xa5a1('0xf')]>0x0){if(moment(_0x34fe2c[_0xa5a1('0x17')])['add'](_0x3f0102[_0xa5a1('0xf')],_0xa5a1('0x20'))>moment()){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}else{return utils[_0xa5a1('0x1f')](_0x34fe2c,0x0,![],null)[_0xa5a1('0x10')](function(){return utils[_0xa5a1('0x21')](_0x34fe2c);})['then'](function(){return _0x217815(null,_0x34fe2c);});}}else{return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}}else{return utils[_0xa5a1('0x1f')](_0x34fe2c,0x0,![],null)['then'](function(){return utils[_0xa5a1('0x21')](_0x34fe2c);})['then'](function(){return _0x217815(null,_0x34fe2c);})[_0xa5a1('0x22')](function(_0x343c3d){return _0x217815(null,![],_0x343c3d);});}}else{if(_0x34fe2c['blocked']){return _0x217815(null,![],{'message':_0xa5a1('0x1b')});}else{return utils[_0xa5a1('0x21')](_0x34fe2c)[_0xa5a1('0x10')](function(){return _0x217815(null,_0x34fe2c);});}}}});})[_0xa5a1('0x22')](function(_0x2e4da8){return _0x217815(null,![],_0x2e4da8);});}function sendServiceMail(_0x26ce2d){return db[_0xa5a1('0x23')]['find']({'where':{'service':!![]},'attributes':['id',_0xa5a1('0x11'),_0xa5a1('0x24')],'include':[{'model':db['MailServerOut'],'as':_0xa5a1('0x25'),'include':[{'model':db['CloudProvider'],'as':_0xa5a1('0x26')}]}]})[_0xa5a1('0x10')](function(_0x2fca7c){if(!_0x2fca7c){throw new Error(_0xa5a1('0x27'));}var _0x54d5b2=_0x2fca7c[_0xa5a1('0x28')]();var _0xa38359={'account':_0x54d5b2,'message':_[_0xa5a1('0x29')]({'from':util[_0xa5a1('0x2a')](_0xa5a1('0x2b'),_0x2fca7c[_0xa5a1('0x11')],_0x2fca7c[_0xa5a1('0x24')]||_0x2fca7c[_0xa5a1('0x25')][_0xa5a1('0x19')])},_0x26ce2d)};return client[_0xa5a1('0x2c')](_0xa5a1('0x2d'),_0xa38359);})['then'](function(_0x43309a){if(_0x43309a[_0xa5a1('0x2e')]){throw new Error(util[_0xa5a1('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x43309a['error'][_0xa5a1('0x2f')]||JSON[_0xa5a1('0x30')](_0x43309a[_0xa5a1('0x2e')])));}return!![];});}function handleError(_0x7abeae,_0x30fd2d,_0x2279b3){return _0x7abeae['status'](_0x30fd2d||0x1f4)[_0xa5a1('0x31')]({'message':_0x2279b3?_0x2279b3[_0xa5a1('0x2f')]||_0x2279b3:''});}exports['login']=function(_0x3bdb03,_0x53a074,_0x4c4158){passport[_0xa5a1('0x1c')]('local-login',function(_0x1770d7,_0x2e49ea,_0x5d1eb9){var _0xe6ddf2=_0x1770d7||_0x5d1eb9;if(_0xe6ddf2){return handleError(_0x53a074,0x191,_0xe6ddf2);}if(!_0x2e49ea){return handleError(_0x53a074,0x194,{'message':_0xa5a1('0x32')});}else{var _0x171ca2={'payload':{'id':_0x2e49ea['id'],'role':_0x2e49ea[_0xa5a1('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0xa5a1('0x33')](_0x171ca2)['then'](function(_0x99b982){_0x53a074['json']({'id':_0x2e49ea['id'],'token':_0x99b982,'statusCall':'','isAlreadyLogged':_0x2e49ea['online']});});}})(_0x3bdb03,_0x53a074,_0x4c4158);};exports[_0xa5a1('0x34')]=function(_0x949f88,_0x152114){if(!_0x949f88[_0xa5a1('0x35')][_0xa5a1('0x24')]){return handleError(_0x152114,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1b9caa=rs[_0xa5a1('0x36')]();_0x949f88[_0xa5a1('0x35')][_0xa5a1('0x24')]=_0x949f88[_0xa5a1('0x35')][_0xa5a1('0x24')][_0xa5a1('0x37')]()[_0xa5a1('0x38')]();var _0x87092c;return db[_0xa5a1('0xc')][_0xa5a1('0xd')]({'where':{'id':0x1},'attributes':[_0xa5a1('0xe'),_0xa5a1('0xf')],'raw':!![]})[_0xa5a1('0x10')](function(_0x39ef02){_0x87092c=_0x39ef02;return db[_0xa5a1('0x39')]['find']({'where':{'email':_0x949f88[_0xa5a1('0x35')][_0xa5a1('0x24')]}});})[_0xa5a1('0x10')](function(_0x3ab7c7){if(!_0x3ab7c7){throw new Error(_0xa5a1('0x3a'));}if(_0x3ab7c7['disabled']){throw new Error(_0xa5a1('0x3b'));}if(_0x3ab7c7[_0xa5a1('0x16')]){if(moment(_0x3ab7c7[_0xa5a1('0x17')])[_0xa5a1('0x1e')](_0x87092c[_0xa5a1('0xf')],'minutes')>moment()){throw new Error(_0xa5a1('0x3c'));}else{_0x3ab7c7['blocked']=![];_0x3ab7c7[_0xa5a1('0x17')]=null;}}_0x3ab7c7['resetPasswordToken']=_0x1b9caa;_0x3ab7c7[_0xa5a1('0x3d')]=Date['now']()+0x36ee80;return _0x3ab7c7[_0xa5a1('0x3e')]();})[_0xa5a1('0x10')](function(){return sendServiceMail({'to':_0x949f88[_0xa5a1('0x35')]['email'],'subject':_0xa5a1('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xa5a1('0x40')+_0xa5a1('0x41')+_0x949f88[_0xa5a1('0x42')][_0xa5a1('0x43')]+_0xa5a1('0x44')+_0x1b9caa+'\x0a\x0a'+_0xa5a1('0x45')});})['then'](function(){_0x152114[_0xa5a1('0x46')](0xc8)[_0xa5a1('0x31')]({'message':_0xa5a1('0x47')});})[_0xa5a1('0x22')](function(_0x9a0bee){return handleError(_0x152114,0x1f4,_0x9a0bee);});};exports['reset']=function(_0x13284b,_0x14ea73){return db[_0xa5a1('0x39')][_0xa5a1('0x48')]({'where':{'resetPasswordToken':_0x13284b[_0xa5a1('0x49')][_0xa5a1('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xa5a1('0x10')](function(_0x4805cc){if(!_0x4805cc){throw new Error(_0xa5a1('0x4b'));}return db[_0xa5a1('0xc')][_0xa5a1('0xd')]({'attributes':['id',_0xa5a1('0x4c'),_0xa5a1('0x4d'),_0xa5a1('0x4e')]})[_0xa5a1('0x10')](function(_0xcb4843){if(_0xcb4843[_0xa5a1('0x4c')])authService[_0xa5a1('0x4f')](_0x13284b[_0xa5a1('0x35')][_0xa5a1('0x12')]);if(!_0xcb4843['enforcePasswordHistory']||!_0x4805cc[_0xa5a1('0x50')])return _0x4805cc;authService[_0xa5a1('0x51')](_0x13284b['body'][_0xa5a1('0x12')],_0x4805cc[_0xa5a1('0x50')],_0xcb4843[_0xa5a1('0x4e')]);return _0x4805cc;})[_0xa5a1('0x10')](function(){_0x4805cc[_0xa5a1('0x12')]=_0x13284b[_0xa5a1('0x35')]['password'];_0x4805cc['resetPasswordToken']=null;_0x4805cc[_0xa5a1('0x3d')]=null;return _0x4805cc['save']();});})[_0xa5a1('0x10')](function(){_0x14ea73[_0xa5a1('0x46')](0xc8)['send']({'message':_0xa5a1('0x52')});})[_0xa5a1('0x22')](function(_0x1dd910){return handleError(_0x14ea73,0x1f4,_0x1dd910);});};passport[_0xa5a1('0x53')](_0xa5a1('0x54'),new LocalStrategy({'usernameField':_0xa5a1('0x11'),'passwordField':_0xa5a1('0x12')},function(_0x22c4d1,_0x5db419,_0x5ee097){return localAuthenticate(db[_0xa5a1('0x39')],_0x22c4d1,_0x5db419,_0x5ee097);})); \ No newline at end of file +var _0x1b38=['find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','email','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','then','name','password','salt','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blocked','blockDuration','add','clearBlockUser','allowedLoginAttempts','minutes','getLicense','catch','MailAccount'];(function(_0x30e55c,_0x407005){var _0x1683c7=function(_0x4a1d46){while(--_0x4a1d46){_0x30e55c['push'](_0x30e55c['shift']());}};_0x1683c7(++_0x407005);}(_0x1b38,0x12d));var _0x81b3=function(_0x322c2f,_0x254da0){_0x322c2f=_0x322c2f-0x0;var _0x33994f=_0x1b38[_0x322c2f];return _0x33994f;};'use strict';var util=require(_0x81b3('0x0'));var passport=require(_0x81b3('0x1'));var LocalStrategy=require(_0x81b3('0x2'))[_0x81b3('0x3')];var jayson=require('jayson/promise');var _=require(_0x81b3('0x4'));var rs=require(_0x81b3('0x5'));var moment=require(_0x81b3('0x6'));var db=require(_0x81b3('0x7'))['db'];var authService=require(_0x81b3('0x8'));var utils=require('../../config/utils');var client=jayson[_0x81b3('0x9')][_0x81b3('0xa')]({'port':0x232b});function localAuthenticate(_0x4ce1f3,_0x47542d,_0x2d8eff,_0x1cdb80){var _0x5ee89c,_0x494f69;return db[_0x81b3('0xb')][_0x81b3('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x81b3('0xd')](function(_0x3749d7){_0x5ee89c=_0x3749d7;return _0x4ce1f3['findOne']({'attributes':['id',_0x81b3('0xe'),_0x81b3('0xf'),_0x81b3('0x10'),_0x81b3('0x11'),'disabled','blocked',_0x81b3('0x12'),_0x81b3('0x13')],'where':{'name':_0x47542d,'role':{'$or':[_0x81b3('0x14'),_0x81b3('0x15'),_0x81b3('0x16')]}}});})[_0x81b3('0xd')](function(_0x45a6f4){if(!_0x45a6f4||_0x45a6f4&&_0x45a6f4[_0x81b3('0xe')]!==_0x47542d){throw new Error(_0x81b3('0x17'));}else{_0x494f69=_0x45a6f4;return _0x494f69;}})[_0x81b3('0xd')](function(){_0x494f69[_0x81b3('0x18')](_0x2d8eff,function(_0x2a9d79,_0x520f29){var _0x1555f9=_0x494f69[_0x81b3('0x13')]+0x1;if(_0x2a9d79){return _0x1cdb80(_0x2a9d79);}else if(!_0x520f29){if(_0x494f69[_0x81b3('0x19')]){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ee89c['allowedLoginAttempts']>0x0){if(_0x494f69[_0x81b3('0x1a')]){if(_0x5ee89c[_0x81b3('0x1b')]>0x0){if(moment(_0x494f69[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5ee89c[_0x81b3('0x1b')],'minutes')>moment()){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x81b3('0x1d')](_0x494f69,_0x1555f9,![],null)[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});});}}else{return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}}else{if(_0x1555f9>=_0x5ee89c[_0x81b3('0x1e')]){return utils[_0x81b3('0x1d')](_0x494f69,0x0,!![],moment())[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});});}else{return utils[_0x81b3('0x1d')](_0x494f69,_0x1555f9,![],null)[_0x81b3('0xd')](function(){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x494f69[_0x81b3('0x19')]){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}else if(_0x5ee89c[_0x81b3('0x1e')]>0x0){if(_0x494f69[_0x81b3('0x1a')]){if(_0x5ee89c[_0x81b3('0x1b')]>0x0){if(moment(_0x494f69[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5ee89c[_0x81b3('0x1b')],_0x81b3('0x1f'))>moment()){return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}else{return utils[_0x81b3('0x1d')](_0x494f69,0x0,![],null)[_0x81b3('0xd')](function(){return utils[_0x81b3('0x20')](_0x494f69);})[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);});}}else{return _0x1cdb80(null,![],{'message':_0x81b3('0x17')});}}else{return utils[_0x81b3('0x1d')](_0x494f69,0x0,![],null)['then'](function(){return utils[_0x81b3('0x20')](_0x494f69);})[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);})[_0x81b3('0x21')](function(_0x1b26ad){return _0x1cdb80(null,![],_0x1b26ad);});}}else{if(_0x494f69['blocked']){return _0x1cdb80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x81b3('0x20')](_0x494f69)[_0x81b3('0xd')](function(){return _0x1cdb80(null,_0x494f69);});}}}});})[_0x81b3('0x21')](function(_0x1f49f7){return _0x1cdb80(null,![],_0x1f49f7);});}function sendServiceMail(_0x1da86a){return db[_0x81b3('0x22')][_0x81b3('0x23')]({'where':{'service':!![]},'attributes':['id',_0x81b3('0xe'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x81b3('0x24'),'include':[{'model':db['CloudProvider'],'as':_0x81b3('0x25')}]}]})[_0x81b3('0xd')](function(_0x190bcc){if(!_0x190bcc){throw new Error(_0x81b3('0x26'));}var _0x9dd9be=_0x190bcc[_0x81b3('0x27')]();var _0x1f5e88={'account':_0x9dd9be,'message':_[_0x81b3('0x28')]({'from':util['format'](_0x81b3('0x29'),_0x190bcc[_0x81b3('0xe')],_0x190bcc[_0x81b3('0x2a')]||_0x190bcc['Smtp'][_0x81b3('0x15')])},_0x1da86a)};return client[_0x81b3('0x2b')]('SendMail',_0x1f5e88);})[_0x81b3('0xd')](function(_0x26ca99){if(_0x26ca99[_0x81b3('0x2c')]){throw new Error(util[_0x81b3('0x2d')](_0x81b3('0x2e'),_0x26ca99[_0x81b3('0x2c')][_0x81b3('0x2f')]||JSON[_0x81b3('0x30')](_0x26ca99[_0x81b3('0x2c')])));}return!![];});}function handleError(_0x3d809e,_0x23ea2b,_0x384264){return _0x3d809e[_0x81b3('0x31')](_0x23ea2b||0x1f4)[_0x81b3('0x32')]({'message':_0x384264?_0x384264[_0x81b3('0x2f')]||_0x384264:''});}exports[_0x81b3('0x33')]=function(_0x1ec3d7,_0x1c4464,_0x5205af){passport[_0x81b3('0x18')](_0x81b3('0x34'),function(_0x217e2f,_0x5c6698,_0x5ccd05){var _0xe719e0=_0x217e2f||_0x5ccd05;if(_0xe719e0){return handleError(_0x1c4464,0x191,_0xe719e0);}if(!_0x5c6698){return handleError(_0x1c4464,0x194,{'message':_0x81b3('0x35')});}else{var _0x5469a2={'payload':{'id':_0x5c6698['id'],'role':_0x5c6698['role']},'options':{'expiresIn':0x15180}};return authService[_0x81b3('0x36')](_0x5469a2)[_0x81b3('0xd')](function(_0x4565d9){_0x1c4464['json']({'id':_0x5c6698['id'],'token':_0x4565d9,'statusCall':'','isAlreadyLogged':_0x5c6698[_0x81b3('0x37')]});});}})(_0x1ec3d7,_0x1c4464,_0x5205af);};exports['forgot']=function(_0x6a0891,_0x2cd792){if(!_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]){return handleError(_0x2cd792,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3ad444=rs[_0x81b3('0x39')]();_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]=_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')][_0x81b3('0x3a')]()['toLowerCase']();var _0x5279c4;return db[_0x81b3('0xb')][_0x81b3('0xc')]({'where':{'id':0x1},'attributes':[_0x81b3('0x1e'),_0x81b3('0x1b')],'raw':!![]})[_0x81b3('0xd')](function(_0x43b13f){_0x5279c4=_0x43b13f;return db['User'][_0x81b3('0x23')]({'where':{'email':_0x6a0891[_0x81b3('0x38')][_0x81b3('0x2a')]}});})['then'](function(_0x3a9693){if(!_0x3a9693){throw new Error(_0x81b3('0x3b'));}if(_0x3a9693[_0x81b3('0x19')]){throw new Error(_0x81b3('0x3c'));}if(_0x3a9693[_0x81b3('0x1a')]){if(moment(_0x3a9693[_0x81b3('0x12')])[_0x81b3('0x1c')](_0x5279c4[_0x81b3('0x1b')],_0x81b3('0x1f'))>moment()){throw new Error(_0x81b3('0x3d'));}else{_0x3a9693[_0x81b3('0x1a')]=![];_0x3a9693[_0x81b3('0x12')]=null;}}_0x3a9693[_0x81b3('0x3e')]=_0x3ad444;_0x3a9693['resetPasswordExpires']=Date[_0x81b3('0x3f')]()+0x36ee80;return _0x3a9693[_0x81b3('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x6a0891[_0x81b3('0x38')]['email'],'subject':_0x81b3('0x41'),'text':_0x81b3('0x42')+_0x81b3('0x43')+_0x81b3('0x44')+_0x6a0891['headers']['host']+_0x81b3('0x45')+_0x3ad444+'\x0a\x0a'+_0x81b3('0x46')});})['then'](function(){_0x2cd792[_0x81b3('0x31')](0xc8)[_0x81b3('0x32')]({'message':_0x81b3('0x47')});})['catch'](function(_0x5b2cda){return handleError(_0x2cd792,0x1f4,_0x5b2cda);});};exports[_0x81b3('0x48')]=function(_0x10a26d,_0x2a537b){return db[_0x81b3('0x49')]['find']({'where':{'resetPasswordToken':_0x10a26d[_0x81b3('0x4a')][_0x81b3('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x81b3('0x3f')]()}}})[_0x81b3('0xd')](function(_0x26bfce){if(!_0x26bfce){throw new Error(_0x81b3('0x4c'));}return db[_0x81b3('0xb')][_0x81b3('0xc')]({'attributes':['id',_0x81b3('0x4d'),_0x81b3('0x4e'),_0x81b3('0x4f')]})[_0x81b3('0xd')](function(_0x5d2de4){if(_0x5d2de4[_0x81b3('0x4d')])authService['validatePasswordPattern'](_0x10a26d[_0x81b3('0x38')][_0x81b3('0xf')]);if(!_0x5d2de4[_0x81b3('0x4e')]||!_0x26bfce['previousPasswords'])return _0x26bfce;authService[_0x81b3('0x50')](_0x10a26d['body']['password'],_0x26bfce[_0x81b3('0x51')],_0x5d2de4['passwordHistoryLimit']);return _0x26bfce;})[_0x81b3('0xd')](function(){_0x26bfce[_0x81b3('0xf')]=_0x10a26d[_0x81b3('0x38')][_0x81b3('0xf')];_0x26bfce[_0x81b3('0x3e')]=null;_0x26bfce['resetPasswordExpires']=null;return _0x26bfce[_0x81b3('0x40')]();});})[_0x81b3('0xd')](function(){_0x2a537b[_0x81b3('0x31')](0xc8)[_0x81b3('0x32')]({'message':_0x81b3('0x52')});})['catch'](function(_0x175e15){return handleError(_0x2a537b,0x1f4,_0x175e15);});};passport[_0x81b3('0x53')](_0x81b3('0x34'),new LocalStrategy({'usernameField':_0x81b3('0xe'),'passwordField':_0x81b3('0xf')},function(_0x4cc439,_0x647e3d,_0x4547ff){return localAuthenticate(db['User'],_0x4cc439,_0x647e3d,_0x4547ff);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 76a1af9..8a1db0d 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 _0xc499=['login','/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller','post'];(function(_0x101be8,_0x1ea713){var _0x32fb9c=function(_0x375ad3){while(--_0x375ad3){_0x101be8['push'](_0x101be8['shift']());}};_0x32fb9c(++_0x1ea713);}(_0xc499,0x1e3));var _0x9c49=function(_0xed9c99,_0x2217b1){_0xed9c99=_0xed9c99-0x0;var _0x5443a1=_0xc499[_0xed9c99];return _0x5443a1;};'use strict';var express=require('express');var router=express[_0x9c49('0x0')]();var controller=require(_0x9c49('0x1'));router[_0x9c49('0x2')]('/',controller[_0x9c49('0x3')]);router[_0x9c49('0x2')](_0x9c49('0x4'),controller[_0x9c49('0x5')]);router[_0x9c49('0x2')](_0x9c49('0x6'),controller[_0x9c49('0x7')]);module[_0x9c49('0x8')]=router; \ No newline at end of file +var _0x4a08=['./authLocal.controller','post','/forgot','/reset/:token','reset','Router'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4a08,0xb3));var _0x84a0=function(_0x461d6e,_0x4e622c){_0x461d6e=_0x461d6e-0x0;var _0x4f2620=_0x4a08[_0x461d6e];return _0x4f2620;};'use strict';var express=require('express');var router=express[_0x84a0('0x0')]();var controller=require(_0x84a0('0x1'));router[_0x84a0('0x2')]('/',controller['login']);router[_0x84a0('0x2')](_0x84a0('0x3'),controller['forgot']);router[_0x84a0('0x2')](_0x84a0('0x4'),controller[_0x84a0('0x5')]);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 941f5cd..a40dcbd 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 _0xe585=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2afd47,_0x59ccbb){var _0x5d95bd=function(_0x27d1d5){while(--_0x27d1d5){_0x2afd47['push'](_0x2afd47['shift']());}};_0x5d95bd(++_0x59ccbb);}(_0xe585,0x13f));var _0x5e58=function(_0x558207,_0x1a5222){_0x558207=_0x558207-0x0;var _0x4c8d28=_0xe585[_0x558207];return _0x4c8d28;};'use strict';var Sequelize=require(_0x5e58('0x0'));module[_0x5e58('0x1')]={'name':{'type':Sequelize[_0x5e58('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5e58('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5e58('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5e58('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7c93=['INTEGER','exports','STRING','BOOLEAN'];(function(_0xe0aa5d,_0x3ff8b7){var _0x5c27aa=function(_0x454deb){while(--_0x454deb){_0xe0aa5d['push'](_0xe0aa5d['shift']());}};_0x5c27aa(++_0x3ff8b7);}(_0x7c93,0xf5));var _0x37c9=function(_0x18e49a,_0x5bf163){_0x18e49a=_0x18e49a-0x0;var _0x1397b5=_0x7c93[_0x18e49a];return _0x1397b5;};'use strict';var Sequelize=require('sequelize');module[_0x37c9('0x0')]={'name':{'type':Sequelize[_0x37c9('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x37c9('0x1')]},'description':{'type':Sequelize[_0x37c9('0x1')]},'status':{'type':Sequelize[_0x37c9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x37c9('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0c95be2..e7bc4fb 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 _0x9840=['jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','Automation','then','include','findAll','rows','catch','show','params','create','body','find','addConditions','ids','getConditions','findOne','Condition','filter','hasOwnProperty','addActions','Action','omit','getActions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto'];(function(_0x149673,_0x282583){var _0x11e986=function(_0x5374bf){while(--_0x5374bf){_0x149673['push'](_0x149673['shift']());}};_0x11e986(++_0x282583);}(_0x9840,0x13d));var _0x0984=function(_0x10017e,_0x1615c4){_0x10017e=_0x10017e-0x0;var _0x5640d8=_0x9840[_0x10017e];return _0x5640d8;};'use strict';var emlformat=require(_0x0984('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0984('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0984('0x2'));var moment=require(_0x0984('0x3'));var BPromise=require(_0x0984('0x4'));var Mustache=require('mustache');var util=require(_0x0984('0x5'));var path=require(_0x0984('0x6'));var sox=require(_0x0984('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0984('0x8'));var _=require('lodash');var squel=require(_0x0984('0x9'));var crypto=require(_0x0984('0xa'));var jsforce=require(_0x0984('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0984('0xc'));var querystring=require(_0x0984('0xd'));var Papa=require('papaparse');var Redis=require(_0x0984('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0984('0xf'));var as=require(_0x0984('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0984('0x11'))(_0x0984('0x12'));var utils=require(_0x0984('0x13'));var config=require(_0x0984('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x241259,_0x4ce7d3){_0x4ce7d3=_0x4ce7d3||0xcc;return function(_0x402090){if(_0x402090){return _0x241259[_0x0984('0x15')](_0x4ce7d3);}return _0x241259[_0x0984('0x16')](_0x4ce7d3)['end']();};}function respondWithResult(_0xf9cef0,_0x45552a){_0x45552a=_0x45552a||0xc8;return function(_0x448e93){if(_0x448e93){return _0xf9cef0[_0x0984('0x16')](_0x45552a)[_0x0984('0x17')](_0x448e93);}};}function respondWithFilteredResult(_0x3ebb49,_0x5dc6b1){return function(_0x1333ba){if(_0x1333ba){var _0x5a48bb=typeof _0x5dc6b1[_0x0984('0x18')]===_0x0984('0x19')&&typeof _0x5dc6b1['limit']===_0x0984('0x19');var _0x2502fe=_0x1333ba[_0x0984('0x1a')];var _0x5b72ff=_0x5a48bb?0x0:_0x5dc6b1[_0x0984('0x18')];var _0x106867=_0x5a48bb?_0x1333ba[_0x0984('0x1a')]:_0x5dc6b1[_0x0984('0x18')]+_0x5dc6b1[_0x0984('0x1b')];var _0x14d8e8;if(_0x106867>=_0x2502fe){_0x106867=_0x2502fe;_0x14d8e8=0xc8;}else{_0x14d8e8=0xce;}_0x3ebb49['status'](_0x14d8e8);return _0x3ebb49[_0x0984('0x1c')](_0x0984('0x1d'),_0x5b72ff+'-'+_0x106867+'/'+_0x2502fe)[_0x0984('0x17')](_0x1333ba);}return null;};}function patchUpdates(_0x3e00bf){return function(_0x5879c2){try{jsonpatch[_0x0984('0x1e')](_0x5879c2,_0x3e00bf,!![]);}catch(_0xd36ffb){return BPromise[_0x0984('0x1f')](_0xd36ffb);}return _0x5879c2[_0x0984('0x20')]();};}function saveUpdates(_0x3f85d5,_0x2ff037){return function(_0x55fe36){if(_0x55fe36){return _0x55fe36[_0x0984('0x21')](_0x3f85d5)['then'](function(_0x4592f7){return _0x4592f7;});}return null;};}function removeEntity(_0x57f1e1,_0x57c311){return function(_0x29f4ac){if(_0x29f4ac){return _0x29f4ac[_0x0984('0x22')]()['then'](function(){_0x57f1e1['status'](0xcc)[_0x0984('0x23')]();});}};}function handleEntityNotFound(_0x22b751,_0x6f26f5){return function(_0x182d57){if(!_0x182d57){_0x22b751[_0x0984('0x15')](0x194);}return _0x182d57;};}function handleError(_0x4a1020,_0x2ccdc5){_0x2ccdc5=_0x2ccdc5||0x1f4;return function(_0x41f75c){logger[_0x0984('0x24')](_0x41f75c[_0x0984('0x25')]);if(_0x41f75c[_0x0984('0x26')]){delete _0x41f75c['name'];}_0x4a1020[_0x0984('0x16')](_0x2ccdc5)[_0x0984('0x27')](_0x41f75c);};}exports[_0x0984('0x28')]=function(_0x3bc235,_0xd0ae1a){var _0x5167d4={},_0x4f897c={},_0x2d9b76={'count':0x0,'rows':[]};var _0x5bcd60=_['map'](db['Automation'][_0x0984('0x29')],function(_0x1373d4){return{'name':_0x1373d4['fieldName'],'type':_0x1373d4[_0x0984('0x2a')]['key']};});_0x4f897c[_0x0984('0x2b')]=_[_0x0984('0x2c')](_0x5bcd60,_0x0984('0x26'));_0x4f897c['query']=_[_0x0984('0x2d')](_0x3bc235[_0x0984('0x2e')]);_0x4f897c[_0x0984('0x2f')]=_['intersection'](_0x4f897c[_0x0984('0x2b')],_0x4f897c[_0x0984('0x2e')]);_0x5167d4['attributes']=_[_0x0984('0x30')](_0x4f897c[_0x0984('0x2b')],qs[_0x0984('0x31')](_0x3bc235[_0x0984('0x2e')][_0x0984('0x31')]));_0x5167d4[_0x0984('0x32')]=_0x5167d4[_0x0984('0x32')][_0x0984('0x33')]?_0x5167d4[_0x0984('0x32')]:_0x4f897c[_0x0984('0x2b')];if(!_0x3bc235['query']['hasOwnProperty'](_0x0984('0x34'))){_0x5167d4[_0x0984('0x1b')]=qs[_0x0984('0x1b')](_0x3bc235['query'][_0x0984('0x1b')]);_0x5167d4[_0x0984('0x18')]=qs[_0x0984('0x18')](_0x3bc235[_0x0984('0x2e')]['offset']);}_0x5167d4[_0x0984('0x35')]=qs[_0x0984('0x36')](_0x3bc235[_0x0984('0x2e')][_0x0984('0x36')]);_0x5167d4[_0x0984('0x37')]=qs[_0x0984('0x2f')](_[_0x0984('0x38')](_0x3bc235['query'],_0x4f897c[_0x0984('0x2f')]),_0x5bcd60);if(_0x3bc235[_0x0984('0x2e')]['filter']){_0x5167d4[_0x0984('0x37')]=_[_0x0984('0x39')](_0x5167d4[_0x0984('0x37')],{'$or':_[_0x0984('0x2c')](_0x5bcd60,function(_0x343fc0){if(_0x343fc0[_0x0984('0x2a')]!==_0x0984('0x3a')){var _0x1fa46f={};_0x1fa46f[_0x343fc0['name']]={'$like':'%'+_0x3bc235[_0x0984('0x2e')]['filter']+'%'};return _0x1fa46f;}})});}_0x5167d4=_[_0x0984('0x39')]({},_0x5167d4,_0x3bc235[_0x0984('0x3b')]);var _0x536d1c={'where':_0x5167d4[_0x0984('0x37')]};return db[_0x0984('0x3c')][_0x0984('0x1a')](_0x536d1c)[_0x0984('0x3d')](function(_0x4e22c4){_0x2d9b76['count']=_0x4e22c4;if(_0x3bc235['query']['includeAll']){_0x5167d4[_0x0984('0x3e')]=[{'all':!![]}];}return db[_0x0984('0x3c')][_0x0984('0x3f')](_0x5167d4);})['then'](function(_0x2f2d7a){_0x2d9b76[_0x0984('0x40')]=_0x2f2d7a;return _0x2d9b76;})[_0x0984('0x3d')](respondWithFilteredResult(_0xd0ae1a,_0x5167d4))[_0x0984('0x41')](handleError(_0xd0ae1a,null));};exports[_0x0984('0x42')]=function(_0x35e6a2,_0x4d8c26){var _0x982021={'raw':![],'where':{'id':_0x35e6a2[_0x0984('0x43')]['id']}},_0x14808d={};_0x14808d[_0x0984('0x2b')]=_[_0x0984('0x2d')](db[_0x0984('0x3c')][_0x0984('0x29')]);_0x14808d[_0x0984('0x2e')]=_[_0x0984('0x2d')](_0x35e6a2['query']);_0x14808d[_0x0984('0x2f')]=_['intersection'](_0x14808d['model'],_0x14808d[_0x0984('0x2e')]);_0x982021[_0x0984('0x32')]=_[_0x0984('0x30')](_0x14808d[_0x0984('0x2b')],qs[_0x0984('0x31')](_0x35e6a2[_0x0984('0x2e')][_0x0984('0x31')]));_0x982021['attributes']=_0x982021[_0x0984('0x32')][_0x0984('0x33')]?_0x982021[_0x0984('0x32')]:_0x14808d[_0x0984('0x2b')];if(_0x35e6a2[_0x0984('0x2e')]['includeAll']){_0x982021[_0x0984('0x3e')]=[{'all':!![]}];}_0x982021=_[_0x0984('0x39')]({},_0x982021,_0x35e6a2[_0x0984('0x3b')]);return db[_0x0984('0x3c')]['find'](_0x982021)['then'](handleEntityNotFound(_0x4d8c26,null))[_0x0984('0x3d')](respondWithResult(_0x4d8c26,null))['catch'](handleError(_0x4d8c26,null));};exports[_0x0984('0x44')]=function(_0x51b2bd,_0xcfb155){return db[_0x0984('0x3c')][_0x0984('0x44')](_0x51b2bd[_0x0984('0x45')],{})['then'](respondWithResult(_0xcfb155,0xc9))[_0x0984('0x41')](handleError(_0xcfb155,null));};exports['update']=function(_0x5292bc,_0x1108c0){if(_0x5292bc['body']['id']){delete _0x5292bc[_0x0984('0x45')]['id'];}return db[_0x0984('0x3c')][_0x0984('0x46')]({'where':{'id':_0x5292bc[_0x0984('0x43')]['id']}})[_0x0984('0x3d')](handleEntityNotFound(_0x1108c0,null))[_0x0984('0x3d')](saveUpdates(_0x5292bc['body'],null))['then'](respondWithResult(_0x1108c0,null))[_0x0984('0x41')](handleError(_0x1108c0,null));};exports['destroy']=function(_0x2d659f,_0x2e71ba){return db[_0x0984('0x3c')][_0x0984('0x46')]({'where':{'id':_0x2d659f[_0x0984('0x43')]['id']}})[_0x0984('0x3d')](handleEntityNotFound(_0x2e71ba,null))[_0x0984('0x3d')](removeEntity(_0x2e71ba,null))['catch'](handleError(_0x2e71ba,null));};exports[_0x0984('0x47')]=function(_0x7bf39e,_0x56ec43,_0x1c5b16){return db['Condition'][_0x0984('0x46')]({'where':{'id':_0x7bf39e[_0x0984('0x43')]['id']}})[_0x0984('0x3d')](handleEntityNotFound(_0x56ec43,null))[_0x0984('0x3d')](function(_0x2f3563){if(_0x2f3563){return _0x2f3563['addConditions'](_0x7bf39e['body'][_0x0984('0x48')],_['omit'](_0x7bf39e[_0x0984('0x45')],[_0x0984('0x48'),'id'])||{});}})['then'](respondWithResult(_0x56ec43,null))[_0x0984('0x41')](handleError(_0x56ec43,null));};exports[_0x0984('0x49')]=function(_0x1b5381,_0x279bbe,_0x1b09a4){var _0x4f57ce={};var _0x19e3cb={};var _0x3a569f;var _0x50d37a;return db[_0x0984('0x3c')][_0x0984('0x4a')]({'where':{'id':_0x1b5381[_0x0984('0x43')]['id']}})['then'](handleEntityNotFound(_0x279bbe,null))[_0x0984('0x3d')](function(_0x4dad26){if(_0x4dad26){_0x3a569f=_0x4dad26;_0x19e3cb[_0x0984('0x2b')]=_['keys'](db[_0x0984('0x4b')][_0x0984('0x29')]);_0x19e3cb[_0x0984('0x2e')]=_[_0x0984('0x2d')](_0x1b5381[_0x0984('0x2e')]);_0x19e3cb[_0x0984('0x2f')]=_[_0x0984('0x30')](_0x19e3cb[_0x0984('0x2b')],_0x19e3cb[_0x0984('0x2e')]);_0x4f57ce[_0x0984('0x32')]=_[_0x0984('0x30')](_0x19e3cb[_0x0984('0x2b')],qs[_0x0984('0x31')](_0x1b5381[_0x0984('0x2e')][_0x0984('0x31')]));_0x4f57ce[_0x0984('0x32')]=_0x4f57ce[_0x0984('0x32')][_0x0984('0x33')]?_0x4f57ce[_0x0984('0x32')]:_0x19e3cb[_0x0984('0x2b')];_0x4f57ce[_0x0984('0x35')]=qs[_0x0984('0x36')](_0x1b5381[_0x0984('0x2e')][_0x0984('0x36')]);_0x4f57ce[_0x0984('0x37')]=qs[_0x0984('0x2f')](_[_0x0984('0x38')](_0x1b5381[_0x0984('0x2e')],_0x19e3cb[_0x0984('0x2f')]));if(_0x1b5381['query']['filter']){_0x4f57ce[_0x0984('0x37')]=_[_0x0984('0x39')](_0x4f57ce['where'],{'$or':_[_0x0984('0x2c')](_0x4f57ce[_0x0984('0x32')],function(_0x44ebbc){var _0x2c8511={};_0x2c8511[_0x44ebbc]={'$like':'%'+_0x1b5381[_0x0984('0x2e')][_0x0984('0x4c')]+'%'};return _0x2c8511;})});}_0x4f57ce=_['merge']({},_0x4f57ce,_0x1b5381[_0x0984('0x3b')]);return _0x3a569f[_0x0984('0x49')](_0x4f57ce);}})[_0x0984('0x3d')](function(_0x300a08){if(_0x300a08){_0x50d37a=_0x300a08[_0x0984('0x33')];if(!_0x1b5381[_0x0984('0x2e')][_0x0984('0x4d')](_0x0984('0x34'))){_0x4f57ce[_0x0984('0x1b')]=qs['limit'](_0x1b5381[_0x0984('0x2e')][_0x0984('0x1b')]);_0x4f57ce[_0x0984('0x18')]=qs[_0x0984('0x18')](_0x1b5381['query'][_0x0984('0x18')]);}return _0x3a569f[_0x0984('0x49')](_0x4f57ce);}})['then'](function(_0x59d33c){if(_0x59d33c){return _0x59d33c?{'count':_0x50d37a,'rows':_0x59d33c}:null;}})[_0x0984('0x3d')](respondWithResult(_0x279bbe,null))[_0x0984('0x41')](handleError(_0x279bbe,null));};exports[_0x0984('0x4e')]=function(_0x358d45,_0x3846fd,_0x267824){return db[_0x0984('0x4f')][_0x0984('0x46')]({'where':{'id':_0x358d45[_0x0984('0x43')]['id']}})['then'](handleEntityNotFound(_0x3846fd,null))['then'](function(_0x712a7a){if(_0x712a7a){return _0x712a7a[_0x0984('0x4e')](_0x358d45['body'][_0x0984('0x48')],_[_0x0984('0x50')](_0x358d45[_0x0984('0x45')],[_0x0984('0x48'),'id'])||{});}})[_0x0984('0x3d')](respondWithResult(_0x3846fd,null))['catch'](handleError(_0x3846fd,null));};exports[_0x0984('0x51')]=function(_0x48ad01,_0x43b7e1,_0x5be423){var _0x1e247b={};var _0x5dfc93={};var _0x585dd1;var _0x47a2a9;return db['Automation']['findOne']({'where':{'id':_0x48ad01[_0x0984('0x43')]['id']}})['then'](handleEntityNotFound(_0x43b7e1,null))[_0x0984('0x3d')](function(_0xbc834){if(_0xbc834){_0x585dd1=_0xbc834;_0x5dfc93[_0x0984('0x2b')]=_[_0x0984('0x2d')](db[_0x0984('0x4f')]['rawAttributes']);_0x5dfc93['query']=_[_0x0984('0x2d')](_0x48ad01['query']);_0x5dfc93[_0x0984('0x2f')]=_[_0x0984('0x30')](_0x5dfc93[_0x0984('0x2b')],_0x5dfc93[_0x0984('0x2e')]);_0x1e247b[_0x0984('0x32')]=_[_0x0984('0x30')](_0x5dfc93[_0x0984('0x2b')],qs[_0x0984('0x31')](_0x48ad01['query'][_0x0984('0x31')]));_0x1e247b[_0x0984('0x32')]=_0x1e247b['attributes'][_0x0984('0x33')]?_0x1e247b[_0x0984('0x32')]:_0x5dfc93[_0x0984('0x2b')];_0x1e247b[_0x0984('0x35')]=qs['sort'](_0x48ad01[_0x0984('0x2e')][_0x0984('0x36')]);_0x1e247b[_0x0984('0x37')]=qs[_0x0984('0x2f')](_[_0x0984('0x38')](_0x48ad01[_0x0984('0x2e')],_0x5dfc93[_0x0984('0x2f')]));if(_0x48ad01[_0x0984('0x2e')]['filter']){_0x1e247b['where']=_['merge'](_0x1e247b[_0x0984('0x37')],{'$or':_['map'](_0x1e247b[_0x0984('0x32')],function(_0x50e3cc){var _0x108bd3={};_0x108bd3[_0x50e3cc]={'$like':'%'+_0x48ad01[_0x0984('0x2e')][_0x0984('0x4c')]+'%'};return _0x108bd3;})});}_0x1e247b=_['merge']({},_0x1e247b,_0x48ad01[_0x0984('0x3b')]);return _0x585dd1[_0x0984('0x51')](_0x1e247b);}})['then'](function(_0x82be4a){if(_0x82be4a){_0x47a2a9=_0x82be4a['length'];if(!_0x48ad01[_0x0984('0x2e')]['hasOwnProperty'](_0x0984('0x34'))){_0x1e247b[_0x0984('0x1b')]=qs[_0x0984('0x1b')](_0x48ad01['query'][_0x0984('0x1b')]);_0x1e247b['offset']=qs[_0x0984('0x18')](_0x48ad01[_0x0984('0x2e')][_0x0984('0x18')]);}return _0x585dd1[_0x0984('0x51')](_0x1e247b);}})[_0x0984('0x3d')](function(_0x359d66){if(_0x359d66){return _0x359d66?{'count':_0x47a2a9,'rows':_0x359d66}:null;}})[_0x0984('0x3d')](respondWithResult(_0x43b7e1,null))[_0x0984('0x41')](handleError(_0x43b7e1,null));}; \ No newline at end of file +var _0xc4cd=['merge','options','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','rimraf','zip-dir','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','send','index','map','Automation','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','length','nolimit','offset','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x47848c,_0x1c52f3){var _0x520324=function(_0x202798){while(--_0x202798){_0x47848c['push'](_0x47848c['shift']());}};_0x520324(++_0x1c52f3);}(_0xc4cd,0x106));var _0xdc4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4cd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc4c('0x0'));var zipdir=require(_0xdc4c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc4c('0x2'));var BPromise=require(_0xdc4c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc4c('0x4'));var ejs=require(_0xdc4c('0x5'));var fs=require('fs');var fs_extra=require(_0xdc4c('0x6'));var _=require(_0xdc4c('0x7'));var squel=require(_0xdc4c('0x8'));var crypto=require(_0xdc4c('0x9'));var jsforce=require(_0xdc4c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdc4c('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc4c('0xb'));var authService=require(_0xdc4c('0xc'));var qs=require(_0xdc4c('0xd'));var as=require(_0xdc4c('0xe'));var hardwareService=require(_0xdc4c('0xf'));var logger=require(_0xdc4c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xdc4c('0x11'));var licenseUtil=require(_0xdc4c('0x12'));var db=require(_0xdc4c('0x13'))['db'];function respondWithStatusCode(_0x4b4e2c,_0x925ba2){_0x925ba2=_0x925ba2||0xcc;return function(_0x1f6530){if(_0x1f6530){return _0x4b4e2c[_0xdc4c('0x14')](_0x925ba2);}return _0x4b4e2c['status'](_0x925ba2)['end']();};}function respondWithResult(_0x2d4ce5,_0x44d75b){_0x44d75b=_0x44d75b||0xc8;return function(_0x4bdb0b){if(_0x4bdb0b){return _0x2d4ce5[_0xdc4c('0x15')](_0x44d75b)[_0xdc4c('0x16')](_0x4bdb0b);}};}function respondWithFilteredResult(_0x506777,_0x3ee2aa){return function(_0x56d6b4){if(_0x56d6b4){var _0xcca126=typeof _0x3ee2aa['offset']===_0xdc4c('0x17')&&typeof _0x3ee2aa[_0xdc4c('0x18')]===_0xdc4c('0x17');var _0x1c3910=_0x56d6b4[_0xdc4c('0x19')];var _0x2f22cf=_0xcca126?0x0:_0x3ee2aa['offset'];var _0x228c54=_0xcca126?_0x56d6b4[_0xdc4c('0x19')]:_0x3ee2aa['offset']+_0x3ee2aa[_0xdc4c('0x18')];var _0x457e77;if(_0x228c54>=_0x1c3910){_0x228c54=_0x1c3910;_0x457e77=0xc8;}else{_0x457e77=0xce;}_0x506777[_0xdc4c('0x15')](_0x457e77);return _0x506777[_0xdc4c('0x1a')](_0xdc4c('0x1b'),_0x2f22cf+'-'+_0x228c54+'/'+_0x1c3910)[_0xdc4c('0x16')](_0x56d6b4);}return null;};}function patchUpdates(_0x73df32){return function(_0x585286){try{jsonpatch[_0xdc4c('0x1c')](_0x585286,_0x73df32,!![]);}catch(_0x5afb1d){return BPromise[_0xdc4c('0x1d')](_0x5afb1d);}return _0x585286[_0xdc4c('0x1e')]();};}function saveUpdates(_0x42d926,_0x395909){return function(_0x36bf02){if(_0x36bf02){return _0x36bf02[_0xdc4c('0x1f')](_0x42d926)[_0xdc4c('0x20')](function(_0x40d28e){return _0x40d28e;});}return null;};}function removeEntity(_0x41aa06,_0x51472f){return function(_0x267568){if(_0x267568){return _0x267568['destroy']()['then'](function(){_0x41aa06['status'](0xcc)[_0xdc4c('0x21')]();});}};}function handleEntityNotFound(_0x1ab266,_0x75f27a){return function(_0x4d4905){if(!_0x4d4905){_0x1ab266[_0xdc4c('0x14')](0x194);}return _0x4d4905;};}function handleError(_0x52b0c0,_0x3d6910){_0x3d6910=_0x3d6910||0x1f4;return function(_0x43a114){logger['error'](_0x43a114[_0xdc4c('0x22')]);if(_0x43a114['name']){delete _0x43a114['name'];}_0x52b0c0[_0xdc4c('0x15')](_0x3d6910)[_0xdc4c('0x23')](_0x43a114);};}exports[_0xdc4c('0x24')]=function(_0x11b331,_0x3f1b87){var _0x2f9fa7={},_0x3949c7={},_0x18d7a4={'count':0x0,'rows':[]};var _0x4237f0=_[_0xdc4c('0x25')](db[_0xdc4c('0x26')][_0xdc4c('0x27')],function(_0x5c7720){return{'name':_0x5c7720[_0xdc4c('0x28')],'type':_0x5c7720[_0xdc4c('0x29')][_0xdc4c('0x2a')]};});_0x3949c7[_0xdc4c('0x2b')]=_[_0xdc4c('0x25')](_0x4237f0,_0xdc4c('0x2c'));_0x3949c7['query']=_[_0xdc4c('0x2d')](_0x11b331[_0xdc4c('0x2e')]);_0x3949c7[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x3949c7[_0xdc4c('0x2b')],_0x3949c7[_0xdc4c('0x2e')]);_0x2f9fa7[_0xdc4c('0x31')]=_[_0xdc4c('0x30')](_0x3949c7[_0xdc4c('0x2b')],qs['fields'](_0x11b331[_0xdc4c('0x2e')]['fields']));_0x2f9fa7['attributes']=_0x2f9fa7[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x2f9fa7[_0xdc4c('0x31')]:_0x3949c7[_0xdc4c('0x2b')];if(!_0x11b331[_0xdc4c('0x2e')]['hasOwnProperty'](_0xdc4c('0x33'))){_0x2f9fa7[_0xdc4c('0x18')]=qs['limit'](_0x11b331[_0xdc4c('0x2e')]['limit']);_0x2f9fa7['offset']=qs[_0xdc4c('0x34')](_0x11b331[_0xdc4c('0x2e')][_0xdc4c('0x34')]);}_0x2f9fa7[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x11b331['query']['sort']);_0x2f9fa7[_0xdc4c('0x37')]=qs['filters'](_[_0xdc4c('0x38')](_0x11b331[_0xdc4c('0x2e')],_0x3949c7['filters']),_0x4237f0);if(_0x11b331['query']['filter']){_0x2f9fa7[_0xdc4c('0x37')]=_['merge'](_0x2f9fa7['where'],{'$or':_[_0xdc4c('0x25')](_0x4237f0,function(_0x45f0a7){if(_0x45f0a7['type']!=='VIRTUAL'){var _0x3a753c={};_0x3a753c[_0x45f0a7[_0xdc4c('0x2c')]]={'$like':'%'+_0x11b331['query'][_0xdc4c('0x39')]+'%'};return _0x3a753c;}})});}_0x2f9fa7=_['merge']({},_0x2f9fa7,_0x11b331['options']);var _0x1d41b3={'where':_0x2f9fa7[_0xdc4c('0x37')]};return db[_0xdc4c('0x26')]['count'](_0x1d41b3)[_0xdc4c('0x20')](function(_0x167f8d){_0x18d7a4['count']=_0x167f8d;if(_0x11b331[_0xdc4c('0x2e')][_0xdc4c('0x3a')]){_0x2f9fa7[_0xdc4c('0x3b')]=[{'all':!![]}];}return db['Automation'][_0xdc4c('0x3c')](_0x2f9fa7);})[_0xdc4c('0x20')](function(_0x2c7f70){_0x18d7a4[_0xdc4c('0x3d')]=_0x2c7f70;return _0x18d7a4;})['then'](respondWithFilteredResult(_0x3f1b87,_0x2f9fa7))[_0xdc4c('0x3e')](handleError(_0x3f1b87,null));};exports[_0xdc4c('0x3f')]=function(_0x208b0c,_0x41afdc){var _0x362265={'raw':![],'where':{'id':_0x208b0c[_0xdc4c('0x40')]['id']}},_0x3b625e={};_0x3b625e['model']=_[_0xdc4c('0x2d')](db[_0xdc4c('0x26')][_0xdc4c('0x27')]);_0x3b625e[_0xdc4c('0x2e')]=_['keys'](_0x208b0c[_0xdc4c('0x2e')]);_0x3b625e[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x3b625e[_0xdc4c('0x2b')],_0x3b625e[_0xdc4c('0x2e')]);_0x362265[_0xdc4c('0x31')]=_['intersection'](_0x3b625e[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x208b0c['query'][_0xdc4c('0x41')]));_0x362265[_0xdc4c('0x31')]=_0x362265[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x362265['attributes']:_0x3b625e[_0xdc4c('0x2b')];if(_0x208b0c[_0xdc4c('0x2e')][_0xdc4c('0x3a')]){_0x362265[_0xdc4c('0x3b')]=[{'all':!![]}];}_0x362265=_[_0xdc4c('0x42')]({},_0x362265,_0x208b0c[_0xdc4c('0x43')]);return db['Automation'][_0xdc4c('0x44')](_0x362265)[_0xdc4c('0x20')](handleEntityNotFound(_0x41afdc,null))[_0xdc4c('0x20')](respondWithResult(_0x41afdc,null))[_0xdc4c('0x3e')](handleError(_0x41afdc,null));};exports[_0xdc4c('0x45')]=function(_0x25adc4,_0x4331e3){return db['Automation']['create'](_0x25adc4[_0xdc4c('0x46')],{})[_0xdc4c('0x20')](respondWithResult(_0x4331e3,0xc9))[_0xdc4c('0x3e')](handleError(_0x4331e3,null));};exports[_0xdc4c('0x1f')]=function(_0x39beea,_0x5db30a){if(_0x39beea['body']['id']){delete _0x39beea[_0xdc4c('0x46')]['id'];}return db[_0xdc4c('0x26')][_0xdc4c('0x44')]({'where':{'id':_0x39beea[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x5db30a,null))[_0xdc4c('0x20')](saveUpdates(_0x39beea[_0xdc4c('0x46')],null))[_0xdc4c('0x20')](respondWithResult(_0x5db30a,null))[_0xdc4c('0x3e')](handleError(_0x5db30a,null));};exports[_0xdc4c('0x47')]=function(_0x4a81a5,_0x135f01){return db[_0xdc4c('0x26')][_0xdc4c('0x44')]({'where':{'id':_0x4a81a5[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x135f01,null))['then'](removeEntity(_0x135f01,null))['catch'](handleError(_0x135f01,null));};exports[_0xdc4c('0x48')]=function(_0x591e75,_0x51a828,_0x54a225){return db[_0xdc4c('0x49')]['find']({'where':{'id':_0x591e75[_0xdc4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x51a828,null))[_0xdc4c('0x20')](function(_0x2ad58f){if(_0x2ad58f){return _0x2ad58f[_0xdc4c('0x48')](_0x591e75['body'][_0xdc4c('0x4a')],_[_0xdc4c('0x4b')](_0x591e75[_0xdc4c('0x46')],['ids','id'])||{});}})[_0xdc4c('0x20')](respondWithResult(_0x51a828,null))[_0xdc4c('0x3e')](handleError(_0x51a828,null));};exports[_0xdc4c('0x4c')]=function(_0x4d888d,_0x54916e,_0x2bf0ee){var _0x2620ab={};var _0x385004={};var _0x1263fa;var _0x29ec6e;return db[_0xdc4c('0x26')][_0xdc4c('0x4d')]({'where':{'id':_0x4d888d[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x54916e,null))['then'](function(_0x328da0){if(_0x328da0){_0x1263fa=_0x328da0;_0x385004[_0xdc4c('0x2b')]=_[_0xdc4c('0x2d')](db['Condition']['rawAttributes']);_0x385004['query']=_[_0xdc4c('0x2d')](_0x4d888d[_0xdc4c('0x2e')]);_0x385004[_0xdc4c('0x2f')]=_[_0xdc4c('0x30')](_0x385004['model'],_0x385004['query']);_0x2620ab['attributes']=_[_0xdc4c('0x30')](_0x385004[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x4d888d['query'][_0xdc4c('0x41')]));_0x2620ab[_0xdc4c('0x31')]=_0x2620ab[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x2620ab[_0xdc4c('0x31')]:_0x385004[_0xdc4c('0x2b')];_0x2620ab[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x36')]);_0x2620ab['where']=qs[_0xdc4c('0x2f')](_[_0xdc4c('0x38')](_0x4d888d[_0xdc4c('0x2e')],_0x385004['filters']));if(_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x39')]){_0x2620ab[_0xdc4c('0x37')]=_['merge'](_0x2620ab[_0xdc4c('0x37')],{'$or':_[_0xdc4c('0x25')](_0x2620ab[_0xdc4c('0x31')],function(_0x23da26){var _0x5e302e={};_0x5e302e[_0x23da26]={'$like':'%'+_0x4d888d[_0xdc4c('0x2e')]['filter']+'%'};return _0x5e302e;})});}_0x2620ab=_[_0xdc4c('0x42')]({},_0x2620ab,_0x4d888d['options']);return _0x1263fa['getConditions'](_0x2620ab);}})[_0xdc4c('0x20')](function(_0x6779a7){if(_0x6779a7){_0x29ec6e=_0x6779a7[_0xdc4c('0x32')];if(!_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x4e')](_0xdc4c('0x33'))){_0x2620ab[_0xdc4c('0x18')]=qs[_0xdc4c('0x18')](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x18')]);_0x2620ab[_0xdc4c('0x34')]=qs['offset'](_0x4d888d[_0xdc4c('0x2e')][_0xdc4c('0x34')]);}return _0x1263fa[_0xdc4c('0x4c')](_0x2620ab);}})[_0xdc4c('0x20')](function(_0x2f0dca){if(_0x2f0dca){return _0x2f0dca?{'count':_0x29ec6e,'rows':_0x2f0dca}:null;}})['then'](respondWithResult(_0x54916e,null))[_0xdc4c('0x3e')](handleError(_0x54916e,null));};exports[_0xdc4c('0x4f')]=function(_0x2e3f05,_0x332462,_0x5c8f3f){return db[_0xdc4c('0x50')][_0xdc4c('0x44')]({'where':{'id':_0x2e3f05['params']['id']}})['then'](handleEntityNotFound(_0x332462,null))[_0xdc4c('0x20')](function(_0x33a50e){if(_0x33a50e){return _0x33a50e[_0xdc4c('0x4f')](_0x2e3f05[_0xdc4c('0x46')]['ids'],_[_0xdc4c('0x4b')](_0x2e3f05['body'],[_0xdc4c('0x4a'),'id'])||{});}})[_0xdc4c('0x20')](respondWithResult(_0x332462,null))[_0xdc4c('0x3e')](handleError(_0x332462,null));};exports['getActions']=function(_0x436b92,_0x5163ce,_0x1ed7a2){var _0x540781={};var _0x2411d3={};var _0x302899;var _0x59336c;return db[_0xdc4c('0x26')][_0xdc4c('0x4d')]({'where':{'id':_0x436b92[_0xdc4c('0x40')]['id']}})[_0xdc4c('0x20')](handleEntityNotFound(_0x5163ce,null))[_0xdc4c('0x20')](function(_0x530fde){if(_0x530fde){_0x302899=_0x530fde;_0x2411d3[_0xdc4c('0x2b')]=_[_0xdc4c('0x2d')](db[_0xdc4c('0x50')][_0xdc4c('0x27')]);_0x2411d3[_0xdc4c('0x2e')]=_[_0xdc4c('0x2d')](_0x436b92[_0xdc4c('0x2e')]);_0x2411d3['filters']=_[_0xdc4c('0x30')](_0x2411d3[_0xdc4c('0x2b')],_0x2411d3[_0xdc4c('0x2e')]);_0x540781[_0xdc4c('0x31')]=_[_0xdc4c('0x30')](_0x2411d3[_0xdc4c('0x2b')],qs[_0xdc4c('0x41')](_0x436b92[_0xdc4c('0x2e')]['fields']));_0x540781[_0xdc4c('0x31')]=_0x540781[_0xdc4c('0x31')][_0xdc4c('0x32')]?_0x540781[_0xdc4c('0x31')]:_0x2411d3[_0xdc4c('0x2b')];_0x540781[_0xdc4c('0x35')]=qs[_0xdc4c('0x36')](_0x436b92[_0xdc4c('0x2e')][_0xdc4c('0x36')]);_0x540781[_0xdc4c('0x37')]=qs['filters'](_['pick'](_0x436b92[_0xdc4c('0x2e')],_0x2411d3['filters']));if(_0x436b92['query'][_0xdc4c('0x39')]){_0x540781[_0xdc4c('0x37')]=_[_0xdc4c('0x42')](_0x540781[_0xdc4c('0x37')],{'$or':_[_0xdc4c('0x25')](_0x540781['attributes'],function(_0x661ce8){var _0x236194={};_0x236194[_0x661ce8]={'$like':'%'+_0x436b92[_0xdc4c('0x2e')][_0xdc4c('0x39')]+'%'};return _0x236194;})});}_0x540781=_['merge']({},_0x540781,_0x436b92[_0xdc4c('0x43')]);return _0x302899[_0xdc4c('0x51')](_0x540781);}})[_0xdc4c('0x20')](function(_0x24c336){if(_0x24c336){_0x59336c=_0x24c336[_0xdc4c('0x32')];if(!_0x436b92[_0xdc4c('0x2e')]['hasOwnProperty'](_0xdc4c('0x33'))){_0x540781['limit']=qs[_0xdc4c('0x18')](_0x436b92['query'][_0xdc4c('0x18')]);_0x540781['offset']=qs[_0xdc4c('0x34')](_0x436b92['query'][_0xdc4c('0x34')]);}return _0x302899[_0xdc4c('0x51')](_0x540781);}})[_0xdc4c('0x20')](function(_0x10021f){if(_0x10021f){return _0x10021f?{'count':_0x59336c,'rows':_0x10021f}:null;}})['then'](respondWithResult(_0x5163ce,null))[_0xdc4c('0x3e')](handleError(_0x5163ce,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 18c65b9..6d7765c 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 _0xba2b=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','bluebird','request-promise','path'];(function(_0x24fdd,_0x38a268){var _0x3eee0d=function(_0x37addb){while(--_0x37addb){_0x24fdd['push'](_0x24fdd['shift']());}};_0x3eee0d(++_0x38a268);}(_0xba2b,0xcd));var _0xbba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbba2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbba2('0x1'));var rp=require(_0xbba2('0x2'));var fs=require('fs');var path=require(_0xbba2('0x3'));var rimraf=require(_0xbba2('0x4'));var config=require(_0xbba2('0x5'));var attributes=require(_0xbba2('0x6'));module[_0xbba2('0x7')]=function(_0x3efdf2,_0x38629f){return _0x3efdf2[_0xbba2('0x8')](_0xbba2('0x9'),attributes,{'tableName':_0xbba2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1d3=['bluebird','request-promise','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','api'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xb1d3,0x81));var _0x3b1d=function(_0xc724e5,_0x11fcdc){_0xc724e5=_0xc724e5-0x0;var _0x363065=_0xb1d3[_0xc724e5];return _0x363065;};'use strict';var _=require('lodash');var util=require(_0x3b1d('0x0'));var logger=require(_0x3b1d('0x1'))(_0x3b1d('0x2'));var moment=require('moment');var BPromise=require(_0x3b1d('0x3'));var rp=require(_0x3b1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b1d('0x5'));var attributes=require(_0x3b1d('0x6'));module[_0x3b1d('0x7')]=function(_0x308a19,_0xb65a78){return _0x308a19[_0x3b1d('0x8')](_0x3b1d('0x9'),attributes,{'tableName':_0x3b1d('0xa'),'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 7bc0ded..e146ede 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 _0x2977=['client','request','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x2977,0xa5));var _0x7297=function(_0x28dc07,_0x5f4d9a){_0x28dc07=_0x28dc07-0x0;var _0x5bcc6a=_0x2977[_0x28dc07];return _0x5bcc6a;};'use strict';var _=require(_0x7297('0x0'));var util=require('util');var moment=require(_0x7297('0x1'));var BPromise=require(_0x7297('0x2'));var rs=require(_0x7297('0x3'));var fs=require('fs');var Redis=require(_0x7297('0x4'));var db=require(_0x7297('0x5'))['db'];var utils=require(_0x7297('0x6'));var logger=require(_0x7297('0x7'))(_0x7297('0x8'));var config=require(_0x7297('0x9'));var jayson=require(_0x7297('0xa'));var client=jayson[_0x7297('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9e570,_0x581d60,_0x2be768){return new BPromise(function(_0x4fc888,_0x4c5832){return client[_0x7297('0xc')](_0xc9e570,_0x2be768)['then'](function(_0x909a14){logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,'request\x20sent');logger['debug'](_0x7297('0xf'),_0x581d60,_0x7297('0x10'),JSON[_0x7297('0x11')](_0x909a14));if(_0x909a14[_0x7297('0x12')]){if(_0x909a14['error'][_0x7297('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x581d60,_0x909a14[_0x7297('0x12')]['message']);return _0x4c5832(_0x909a14[_0x7297('0x12')]['message']);}logger[_0x7297('0x12')]('Automation,\x20%s,\x20%s',_0x581d60,_0x909a14['error'][_0x7297('0x14')]);return _0x4fc888(_0x909a14[_0x7297('0x12')][_0x7297('0x14')]);}else{logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,_0x7297('0x10'));_0x4fc888(_0x909a14[_0x7297('0x15')][_0x7297('0x14')]);}})['catch'](function(_0x558f04){logger[_0x7297('0x12')](_0x7297('0xe'),_0x581d60,_0x558f04);_0x4c5832(_0x558f04);});});} \ No newline at end of file +var _0x3264=['jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x48f860,_0x495541){var _0x550734=function(_0x30f5e4){while(--_0x30f5e4){_0x48f860['push'](_0x48f860['shift']());}};_0x550734(++_0x495541);}(_0x3264,0x7f));var _0x4326=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x3264[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bcce,_0x3a7544,_0x2993a1){return new BPromise(function(_0x22071c,_0x129365){return client[_0x4326('0x9')](_0x56bcce,_0x2993a1)[_0x4326('0xa')](function(_0x1609f){logger['info']('Automation,\x20%s,\x20%s',_0x3a7544,_0x4326('0xb'));logger[_0x4326('0xc')](_0x4326('0xd'),_0x3a7544,_0x4326('0xb'),JSON['stringify'](_0x1609f));if(_0x1609f['error']){if(_0x1609f[_0x4326('0xe')]['code']===0x1f4){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x1609f[_0x4326('0xe')]['message']);return _0x129365(_0x1609f['error'][_0x4326('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3a7544,_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);return _0x22071c(_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);}else{logger['info'](_0x4326('0xf'),_0x3a7544,_0x4326('0xb'));_0x22071c(_0x1609f[_0x4326('0x11')]['message']);}})[_0x4326('0x12')](function(_0x40c169){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x40c169);_0x129365(_0x40c169);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e352843..c0e0aad 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 _0x6873=['/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','show'];(function(_0x14e934,_0x18b80a){var _0x3c0754=function(_0x1db643){while(--_0x1db643){_0x14e934['push'](_0x14e934['shift']());}};_0x3c0754(++_0x18b80a);}(_0x6873,0xac));var _0x3687=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x6873[_0x845505];return _0x2513b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3687('0x0'));var timeout=require(_0x3687('0x1'));var express=require(_0x3687('0x2'));var router=express[_0x3687('0x3')]();var fs_extra=require(_0x3687('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3687('0x5'));var config=require('../../config/environment');var controller=require(_0x3687('0x6'));router[_0x3687('0x7')]('/',auth['isAuthenticated'](),controller[_0x3687('0x8')]);router[_0x3687('0x7')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0xb')]);router[_0x3687('0x7')](_0x3687('0xc'),auth[_0x3687('0xa')](),controller[_0x3687('0xd')]);router['get'](_0x3687('0xe'),auth[_0x3687('0xa')](),controller['getActions']);router[_0x3687('0xf')]('/',auth[_0x3687('0xa')](),controller[_0x3687('0x10')]);router[_0x3687('0xf')](_0x3687('0xc'),auth['isAuthenticated'](),controller[_0x3687('0x11')]);router[_0x3687('0xf')]('/:id/actions',auth[_0x3687('0xa')](),controller[_0x3687('0x12')]);router[_0x3687('0x13')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0x14')]);router[_0x3687('0x15')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller['destroy']);module[_0x3687('0x16')]=router; \ No newline at end of file +var _0x899a=['/:id/conditions','getConditions','/:id/actions','getActions','addConditions','post','addActions','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x899a,0x1b6));var _0xa899=function(_0x582a71,_0x3594fa){_0x582a71=_0x582a71-0x0;var _0x1c0b81=_0x899a[_0x582a71];return _0x1c0b81;};'use strict';var multer=require(_0xa899('0x0'));var util=require(_0xa899('0x1'));var path=require('path');var timeout=require(_0xa899('0x2'));var express=require(_0xa899('0x3'));var router=express['Router']();var fs_extra=require(_0xa899('0x4'));var auth=require(_0xa899('0x5'));var interaction=require(_0xa899('0x6'));var config=require(_0xa899('0x7'));var controller=require('./automation.controller');router[_0xa899('0x8')]('/',auth[_0xa899('0x9')](),controller[_0xa899('0xa')]);router[_0xa899('0x8')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0xb')]);router[_0xa899('0x8')](_0xa899('0xc'),auth[_0xa899('0x9')](),controller[_0xa899('0xd')]);router[_0xa899('0x8')](_0xa899('0xe'),auth[_0xa899('0x9')](),controller[_0xa899('0xf')]);router['post']('/',auth[_0xa899('0x9')](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0xa899('0x10')]);router[_0xa899('0x11')](_0xa899('0xe'),auth['isAuthenticated'](),controller[_0xa899('0x12')]);router[_0xa899('0x13')]('/:id',auth[_0xa899('0x9')](),controller[_0xa899('0x14')]);router[_0xa899('0x15')](_0xa899('0x16'),auth['isAuthenticated'](),controller[_0xa899('0x17')]);module[_0xa899('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7ef1509..6441ad6 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 _0x4111=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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)'];(function(_0xbad179,_0x35579f){var _0x54e6ca=function(_0x517a61){while(--_0x517a61){_0xbad179['push'](_0xbad179['shift']());}};_0x54e6ca(++_0x35579f);}(_0x4111,0x188));var _0x1411=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4111[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1411('0x0'));module[_0x1411('0x1')]={'name':{'type':Sequelize[_0x1411('0x2')],'unique':_0x1411('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1411('0x4')),'allowNull':![],'defaultValue':_0x1411('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1411('0x5')],'defaultValue':0x0,'comment':_0x1411('0x6')},'limitCalls':{'type':Sequelize[_0x1411('0x7')](0x4)[_0x1411('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1411('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1411('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1411('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1411('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'comment':_0x1411('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1411('0x10')},'dialTimezone':{'type':Sequelize[_0x1411('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1411('0x2')],'defaultValue':_0x1411('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1411('0x12')](_0x1411('0x13'),_0x1411('0x14'),'onlyIfOpen'),'defaultValue':_0x1411('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1411('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1411('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1411('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x1411('0x7')](0x9)[_0x1411('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1411('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1411('0x7')](0x9)[_0x1411('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1411('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1411('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1411('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x1411('0x7')](0x9)[_0x1411('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1411('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1411('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1411('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1411('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1411('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1411('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1411('0x7')](0x9)[_0x1411('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1411('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1411('0x12')](_0x1411('0x1f'),_0x1411('0x20')),'defaultValue':_0x1411('0x1f')},'dialPrefix':{'type':Sequelize[_0x1411('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1411('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1411('0x21')},'dialCutDigit':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0x27')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)[_0x1411('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1411('0x7')](0x3)[_0x1411('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1411('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1411('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1411('0x2a')}}; \ No newline at end of file +var _0x6d11=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6d11,0xbf));var _0x16d1=function(_0xb381b2,_0x1d209f){_0xb381b2=_0xb381b2-0x0;var _0x3e24fd=_0x6d11[_0xb381b2];return _0x3e24fd;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x16d1('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x16d1('0x4')},'description':{'type':Sequelize[_0x16d1('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x16d1('0x5')](0x4)[_0x16d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x16d1('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x16d1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x16d1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'comment':_0x16d1('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x16d1('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x16d1('0x2')],'defaultValue':_0x16d1('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x10'),_0x16d1('0x11'),_0x16d1('0x12')),'defaultValue':_0x16d1('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x16d1('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x16d1('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x16d1('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x16d1('0x5')](0x9)[_0x16d1('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x16d1('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x16d1('0x5')](0x9)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x16d1('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x16d1('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x16d1('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x16d1('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x19'),_0x16d1('0x1a')),'defaultValue':_0x16d1('0x19')},'dialPrefix':{'type':Sequelize[_0x16d1('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16d1('0x1b')},'dialCutDigit':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x16d1('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x16d1('0x5')](0x3)[_0x16d1('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x16d1('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x16d1('0x5')](0x5)[_0x16d1('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x16d1('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f15490f..1d69b59 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 _0xefe3=['nolimit','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','Campaign','includeAll','include','rows','catch','show','params','intersection','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','keys','updatedAt','omit','body','createdAt','update','getHoppers','findOne','order','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','fromQuery','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','map','rawAttributes','fieldName','key','query','attributes','model','fields','length','hasOwnProperty'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3efe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3efe('0x1'));var moment=require(_0x3efe('0x2'));var BPromise=require(_0x3efe('0x3'));var Mustache=require(_0x3efe('0x4'));var util=require('util');var path=require(_0x3efe('0x5'));var sox=require('sox');var csv=require(_0x3efe('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3efe('0x7'));var _=require(_0x3efe('0x8'));var squel=require(_0x3efe('0x9'));var crypto=require(_0x3efe('0xa'));var jsforce=require(_0x3efe('0xb'));var deskjs=require(_0x3efe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3efe('0xd'));var Papa=require('papaparse');var Redis=require(_0x3efe('0xe'));var authService=require(_0x3efe('0xf'));var qs=require(_0x3efe('0x10'));var as=require(_0x3efe('0x11'));var hardwareService=require(_0x3efe('0x12'));var logger=require(_0x3efe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3efe('0x14'));var licenseUtil=require(_0x3efe('0x15'));var db=require(_0x3efe('0x16'))['db'];function respondWithStatusCode(_0x3ad584,_0x11b9b4){_0x11b9b4=_0x11b9b4||0xcc;return function(_0x3778ec){if(_0x3778ec){return _0x3ad584[_0x3efe('0x17')](_0x11b9b4);}return _0x3ad584[_0x3efe('0x18')](_0x11b9b4)[_0x3efe('0x19')]();};}function respondWithResult(_0x44bdbf,_0x2dd99f){_0x2dd99f=_0x2dd99f||0xc8;return function(_0x49f4ff){if(_0x49f4ff){return _0x44bdbf[_0x3efe('0x18')](_0x2dd99f)[_0x3efe('0x1a')](_0x49f4ff);}};}function respondWithFilteredResult(_0x1e1ce9,_0x230785){return function(_0x4a3d0d){if(_0x4a3d0d){var _0x219ecf=typeof _0x230785[_0x3efe('0x1b')]===_0x3efe('0x1c')&&typeof _0x230785['limit']==='undefined';var _0x3adf52=_0x4a3d0d[_0x3efe('0x1d')];var _0x26a8c4=_0x219ecf?0x0:_0x230785[_0x3efe('0x1b')];var _0x433c53=_0x219ecf?_0x4a3d0d[_0x3efe('0x1d')]:_0x230785['offset']+_0x230785[_0x3efe('0x1e')];var _0x30b3fb;if(_0x433c53>=_0x3adf52){_0x433c53=_0x3adf52;_0x30b3fb=0xc8;}else{_0x30b3fb=0xce;}_0x1e1ce9[_0x3efe('0x18')](_0x30b3fb);return _0x1e1ce9[_0x3efe('0x1f')](_0x3efe('0x20'),_0x26a8c4+'-'+_0x433c53+'/'+_0x3adf52)[_0x3efe('0x1a')](_0x4a3d0d);}return null;};}function patchUpdates(_0x41cfcd){return function(_0x2b2c09){try{jsonpatch[_0x3efe('0x21')](_0x2b2c09,_0x41cfcd,!![]);}catch(_0x49392e){return BPromise[_0x3efe('0x22')](_0x49392e);}return _0x2b2c09[_0x3efe('0x23')]();};}function saveUpdates(_0x3403ce,_0x3b6464){return function(_0x4a3fdb){if(_0x4a3fdb){return _0x4a3fdb['update'](_0x3403ce)[_0x3efe('0x24')](function(_0x2891b1){return _0x2891b1;});}return null;};}function removeEntity(_0x5d9601,_0x5c8b1d){return function(_0x2aec5c){if(_0x2aec5c){return _0x2aec5c[_0x3efe('0x25')]()[_0x3efe('0x24')](function(){var _0x252c27=_0x2aec5c[_0x3efe('0x26')]({'plain':!![]});var _0x39fc88=_0x3efe('0x27');return db[_0x3efe('0x28')][_0x3efe('0x25')]({'where':{'type':_0x39fc88,'resourceId':_0x252c27['id']}})['then'](function(){return _0x2aec5c;});})[_0x3efe('0x24')](function(){_0x5d9601['status'](0xcc)[_0x3efe('0x19')]();});}};}function handleEntityNotFound(_0x21c15d,_0x5cbe1a){return function(_0x25bf85){if(!_0x25bf85){_0x21c15d[_0x3efe('0x17')](0x194);}return _0x25bf85;};}function handleError(_0x331a83,_0x4cedac){_0x4cedac=_0x4cedac||0x1f4;return function(_0xdedd1c){logger[_0x3efe('0x29')](_0xdedd1c['stack']);if(_0xdedd1c[_0x3efe('0x2a')]){delete _0xdedd1c[_0x3efe('0x2a')];}_0x331a83[_0x3efe('0x18')](_0x4cedac)['send'](_0xdedd1c);};}exports['index']=function(_0x2e2d68,_0x34229c){var _0x423056={},_0x1f08e2={},_0x45d873={'count':0x0,'rows':[]};var _0x1f271b=_[_0x3efe('0x2b')](db['Campaign'][_0x3efe('0x2c')],function(_0x574d53){return{'name':_0x574d53[_0x3efe('0x2d')],'type':_0x574d53['type'][_0x3efe('0x2e')]};});_0x1f08e2['model']=_[_0x3efe('0x2b')](_0x1f271b,'name');_0x1f08e2['query']=_['keys'](_0x2e2d68[_0x3efe('0x2f')]);_0x1f08e2['filters']=_['intersection'](_0x1f08e2['model'],_0x1f08e2[_0x3efe('0x2f')]);_0x423056[_0x3efe('0x30')]=_['intersection'](_0x1f08e2[_0x3efe('0x31')],qs[_0x3efe('0x32')](_0x2e2d68[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x423056[_0x3efe('0x30')]=_0x423056[_0x3efe('0x30')][_0x3efe('0x33')]?_0x423056[_0x3efe('0x30')]:_0x1f08e2[_0x3efe('0x31')];if(!_0x2e2d68[_0x3efe('0x2f')][_0x3efe('0x34')](_0x3efe('0x35'))){_0x423056[_0x3efe('0x1e')]=qs[_0x3efe('0x1e')](_0x2e2d68[_0x3efe('0x2f')][_0x3efe('0x1e')]);_0x423056[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x2e2d68[_0x3efe('0x2f')][_0x3efe('0x1b')]);}_0x423056['order']=qs[_0x3efe('0x36')](_0x2e2d68[_0x3efe('0x2f')]['sort']);_0x423056[_0x3efe('0x37')]=qs['filters'](_[_0x3efe('0x38')](_0x2e2d68[_0x3efe('0x2f')],_0x1f08e2[_0x3efe('0x39')]),_0x1f271b);if(_0x2e2d68[_0x3efe('0x2f')]['filter']){_0x423056['where']=_[_0x3efe('0x3a')](_0x423056['where'],{'$or':_[_0x3efe('0x2b')](_0x1f271b,function(_0x398cf2){if(_0x398cf2[_0x3efe('0x3b')]!==_0x3efe('0x3c')){var _0x1448ce={};_0x1448ce[_0x398cf2[_0x3efe('0x2a')]]={'$like':'%'+_0x2e2d68['query'][_0x3efe('0x3d')]+'%'};return _0x1448ce;}})});}_0x423056=_[_0x3efe('0x3a')]({},_0x423056,_0x2e2d68[_0x3efe('0x3e')]);var _0xd26138={'where':_0x423056[_0x3efe('0x37')]};return db[_0x3efe('0x3f')]['count'](_0xd26138)[_0x3efe('0x24')](function(_0xf2622c){_0x45d873[_0x3efe('0x1d')]=_0xf2622c;if(_0x2e2d68['query'][_0x3efe('0x40')]){_0x423056[_0x3efe('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x423056);})['then'](function(_0x4640db){_0x45d873[_0x3efe('0x42')]=_0x4640db;return _0x45d873;})['then'](respondWithFilteredResult(_0x34229c,_0x423056))[_0x3efe('0x43')](handleError(_0x34229c,null));};exports[_0x3efe('0x44')]=function(_0x4de5f8,_0x838267){var _0x5b79f4={'raw':![],'where':{'id':_0x4de5f8[_0x3efe('0x45')]['id']}},_0x2718dc={};_0x2718dc[_0x3efe('0x31')]=_['keys'](db[_0x3efe('0x3f')][_0x3efe('0x2c')]);_0x2718dc[_0x3efe('0x2f')]=_['keys'](_0x4de5f8[_0x3efe('0x2f')]);_0x2718dc[_0x3efe('0x39')]=_['intersection'](_0x2718dc[_0x3efe('0x31')],_0x2718dc[_0x3efe('0x2f')]);_0x5b79f4[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0x2718dc[_0x3efe('0x31')],qs[_0x3efe('0x32')](_0x4de5f8[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x5b79f4[_0x3efe('0x30')]=_0x5b79f4[_0x3efe('0x30')][_0x3efe('0x33')]?_0x5b79f4['attributes']:_0x2718dc['model'];if(_0x4de5f8[_0x3efe('0x2f')][_0x3efe('0x40')]){_0x5b79f4[_0x3efe('0x41')]=[{'all':!![]}];}_0x5b79f4=_[_0x3efe('0x3a')]({},_0x5b79f4,_0x4de5f8['options']);return db[_0x3efe('0x3f')][_0x3efe('0x47')](_0x5b79f4)['then'](handleEntityNotFound(_0x838267,null))[_0x3efe('0x24')](respondWithResult(_0x838267,null))[_0x3efe('0x43')](handleError(_0x838267,null));};exports[_0x3efe('0x48')]=function(_0x2abf19,_0x4da22d){return db[_0x3efe('0x3f')][_0x3efe('0x48')](_0x2abf19['body'],{})[_0x3efe('0x24')](function(_0x608c6){var _0xaa87c0=_0x2abf19[_0x3efe('0x49')][_0x3efe('0x26')]({'plain':!![]});if(!_0xaa87c0)throw new Error(_0x3efe('0x4a'));if(_0xaa87c0[_0x3efe('0x4b')]===_0x3efe('0x49')){var _0x2e8c07=_0x608c6[_0x3efe('0x26')]({'plain':!![]});var _0x4dbe67='IvrCampaigns';return db[_0x3efe('0x4c')]['find']({'where':{'name':_0x4dbe67,'userProfileId':_0xaa87c0[_0x3efe('0x4d')]},'raw':!![]})[_0x3efe('0x24')](function(_0x596418){if(_0x596418&&_0x596418[_0x3efe('0x4e')]===0x0){return db[_0x3efe('0x28')][_0x3efe('0x48')]({'name':_0x2e8c07[_0x3efe('0x2a')],'resourceId':_0x2e8c07['id'],'type':_0x596418[_0x3efe('0x2a')],'sectionId':_0x596418['id']},{})['then'](function(){return _0x608c6;});}else{return _0x608c6;}})[_0x3efe('0x43')](function(_0x52db49){logger[_0x3efe('0x29')](_0x3efe('0x4f'),_0x52db49);throw _0x52db49;});}return _0x608c6;})[_0x3efe('0x24')](respondWithResult(_0x4da22d,0xc9))[_0x3efe('0x43')](handleError(_0x4da22d,null));};exports[_0x3efe('0x50')]=function(_0x9ab635,_0x306b42){var _0x40c1f3={'where':{'id':_0x9ab635[_0x3efe('0x45')]['id']}},_0xb74ca={};_0xb74ca['model']=_[_0x3efe('0x51')](db['Campaign'][_0x3efe('0x2c')]);_0x40c1f3[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0xb74ca[_0x3efe('0x31')],qs[_0x3efe('0x32')](_0x9ab635[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x40c1f3[_0x3efe('0x30')]=_0x40c1f3[_0x3efe('0x30')]['length']?_0x40c1f3[_0x3efe('0x30')]:_0xb74ca[_0x3efe('0x31')];if(_0x9ab635[_0x3efe('0x2f')][_0x3efe('0x40')]){_0x40c1f3[_0x3efe('0x41')]=[{'all':!![]}];}_0x40c1f3=_[_0x3efe('0x3a')]({},_0x40c1f3,_0x9ab635['options']);return db[_0x3efe('0x3f')][_0x3efe('0x47')](_0x40c1f3)['then'](handleEntityNotFound(_0x306b42,null))[_0x3efe('0x24')](function(_0x31ccd4){if(_0x31ccd4){var _0x1e314b=_0x31ccd4['get']({'plain':!![]});_0x1e314b=qs['omit'](_0x1e314b,['id','createdAt',_0x3efe('0x52')]);_0x9ab635['body']=_[_0x3efe('0x53')](_0x9ab635[_0x3efe('0x54')],['id',_0x3efe('0x55'),_0x3efe('0x52')]);return db[_0x3efe('0x3f')]['create'](_[_0x3efe('0x3a')](_0x1e314b,_0x9ab635[_0x3efe('0x54')]),{'include':_0x9ab635[_0x3efe('0x2f')][_0x3efe('0x40')]?[{'all':!![]}]:undefined})[_0x3efe('0x24')](function(_0x59dba9){var _0x481870=_0x9ab635[_0x3efe('0x49')][_0x3efe('0x26')]({'plain':!![]});if(!_0x481870)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481870[_0x3efe('0x4b')]==='user'){var _0x5be3d7=_0x59dba9[_0x3efe('0x26')]({'plain':!![]});var _0x3eee6e='IvrCampaigns';return db['UserProfileSection'][_0x3efe('0x47')]({'where':{'name':_0x3eee6e,'userProfileId':_0x481870['userProfileId']},'raw':!![]})[_0x3efe('0x24')](function(_0x4a909c){if(_0x4a909c&&_0x4a909c[_0x3efe('0x4e')]===0x0){return db[_0x3efe('0x28')][_0x3efe('0x48')]({'name':_0x5be3d7['name'],'resourceId':_0x5be3d7['id'],'type':_0x4a909c[_0x3efe('0x2a')],'sectionId':_0x4a909c['id']},{})['then'](function(){return _0x59dba9;});}else{return _0x59dba9;}})['catch'](function(_0x4ce223){logger[_0x3efe('0x29')](_0x3efe('0x4f'),_0x4ce223);throw _0x4ce223;});}return _0x59dba9;});}})[_0x3efe('0x24')](respondWithResult(_0x306b42,0xc9))[_0x3efe('0x43')](handleError(_0x306b42,null));};exports[_0x3efe('0x56')]=function(_0x554854,_0x5ebd01){if(_0x554854['body']['id']){delete _0x554854['body']['id'];}return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x554854['params']['id']}})['then'](handleEntityNotFound(_0x5ebd01,null))['then'](saveUpdates(_0x554854[_0x3efe('0x54')],null))[_0x3efe('0x24')](respondWithResult(_0x5ebd01,null))[_0x3efe('0x43')](handleError(_0x5ebd01,null));};exports['destroy']=function(_0x575580,_0x3dc3c7){return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x575580[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x3dc3c7,null))[_0x3efe('0x24')](removeEntity(_0x3dc3c7,null))[_0x3efe('0x43')](handleError(_0x3dc3c7,null));};exports[_0x3efe('0x57')]=function(_0x1daa11,_0x54fd9f,_0x185da1){var _0x4cb191={'raw':!![],'where':{}};var _0x4586ae={};var _0x45235d={'count':0x0,'rows':[]};return db[_0x3efe('0x3f')][_0x3efe('0x58')]({'where':{'id':_0x1daa11[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x54fd9f,null))[_0x3efe('0x24')](function(_0x4ee844){if(_0x4ee844){_0x4586ae[_0x3efe('0x31')]=_['keys'](db['CmHopper']['rawAttributes']);_0x4586ae[_0x3efe('0x2f')]=_['keys'](_0x1daa11[_0x3efe('0x2f')]);_0x4586ae[_0x3efe('0x39')]=_[_0x3efe('0x46')](_0x4586ae[_0x3efe('0x31')],_0x4586ae['query']);_0x4cb191['attributes']=_['intersection'](_0x4586ae[_0x3efe('0x31')],qs['fields'](_0x1daa11['query'][_0x3efe('0x32')]));_0x4cb191[_0x3efe('0x30')]=_0x4cb191[_0x3efe('0x30')][_0x3efe('0x33')]?_0x4cb191['attributes']:_0x4586ae[_0x3efe('0x31')];if(!_0x1daa11[_0x3efe('0x2f')]['hasOwnProperty']('nolimit')){_0x4cb191[_0x3efe('0x1e')]=qs[_0x3efe('0x1e')](_0x1daa11[_0x3efe('0x2f')][_0x3efe('0x1e')]);_0x4cb191[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x1daa11['query'][_0x3efe('0x1b')]);}_0x4cb191[_0x3efe('0x59')]=qs[_0x3efe('0x36')](_0x1daa11[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x4cb191[_0x3efe('0x37')]=qs[_0x3efe('0x39')](_[_0x3efe('0x38')](_0x1daa11['query'],_0x4586ae[_0x3efe('0x39')]));_0x4cb191[_0x3efe('0x37')][_0x3efe('0x5a')]=_0x4ee844['id'];if(_0x1daa11[_0x3efe('0x2f')]['filter']){_0x4cb191[_0x3efe('0x37')]=_[_0x3efe('0x3a')](_0x4cb191['where'],{'$or':_[_0x3efe('0x2b')](_0x4cb191[_0x3efe('0x30')],function(_0xe5653){var _0x3f7412={};_0x3f7412[_0xe5653]={'$like':'%'+_0x1daa11[_0x3efe('0x2f')]['filter']+'%'};return _0x3f7412;})});}_0x4cb191=_[_0x3efe('0x3a')]({},_0x4cb191,_0x1daa11[_0x3efe('0x3e')]);return db[_0x3efe('0x5b')][_0x3efe('0x1d')]({'where':_0x4cb191[_0x3efe('0x37')]})['then'](function(_0x371354){_0x45235d[_0x3efe('0x1d')]=_0x371354;if(_0x1daa11[_0x3efe('0x2f')][_0x3efe('0x40')]){_0x4cb191['include']=[{'all':!![]}];}return db[_0x3efe('0x5b')][_0x3efe('0x5c')](_0x4cb191);})[_0x3efe('0x24')](function(_0x4fdf8a){_0x45235d['rows']=_0x4fdf8a;return _0x45235d;});}})['then'](respondWithFilteredResult(_0x54fd9f,_0x4cb191))[_0x3efe('0x43')](handleError(_0x54fd9f,null));};exports[_0x3efe('0x5d')]=function(_0xb94458,_0x3b823d,_0x4f9a8e){var _0x599b6b={'raw':!![],'where':{}};var _0x113995={};var _0x31c47d={'count':0x0,'rows':[]};return db[_0x3efe('0x3f')][_0x3efe('0x58')]({'where':{'id':_0xb94458['params']['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x3b823d,null))[_0x3efe('0x24')](function(_0x56dc49){if(_0x56dc49){_0x113995[_0x3efe('0x31')]=_[_0x3efe('0x51')](db[_0x3efe('0x5e')][_0x3efe('0x2c')]);_0x113995[_0x3efe('0x2f')]=_['keys'](_0xb94458[_0x3efe('0x2f')]);_0x113995['filters']=_['intersection'](_0x113995[_0x3efe('0x31')],_0x113995['query']);_0x599b6b[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0x113995['model'],qs[_0x3efe('0x32')](_0xb94458[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x599b6b['attributes']=_0x599b6b[_0x3efe('0x30')][_0x3efe('0x33')]?_0x599b6b[_0x3efe('0x30')]:_0x113995[_0x3efe('0x31')];if(!_0xb94458[_0x3efe('0x2f')]['hasOwnProperty'](_0x3efe('0x35'))){_0x599b6b[_0x3efe('0x1e')]=qs[_0x3efe('0x1e')](_0xb94458[_0x3efe('0x2f')][_0x3efe('0x1e')]);_0x599b6b[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0xb94458[_0x3efe('0x2f')][_0x3efe('0x1b')]);}_0x599b6b[_0x3efe('0x59')]=qs[_0x3efe('0x36')](_0xb94458[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x599b6b['where']=qs[_0x3efe('0x39')](_[_0x3efe('0x38')](_0xb94458[_0x3efe('0x2f')],_0x113995[_0x3efe('0x39')]));_0x599b6b['where']['CampaignId']=_0x56dc49['id'];if(_0xb94458[_0x3efe('0x2f')]['filter']){_0x599b6b[_0x3efe('0x37')]=_[_0x3efe('0x3a')](_0x599b6b[_0x3efe('0x37')],{'$or':_['map'](_0x599b6b['attributes'],function(_0x330b95){var _0x325de1={};_0x325de1[_0x330b95]={'$like':'%'+_0xb94458[_0x3efe('0x2f')][_0x3efe('0x3d')]+'%'};return _0x325de1;})});}_0x599b6b=_[_0x3efe('0x3a')]({},_0x599b6b,_0xb94458[_0x3efe('0x3e')]);return db[_0x3efe('0x5e')][_0x3efe('0x1d')]({'where':_0x599b6b[_0x3efe('0x37')]})[_0x3efe('0x24')](function(_0x2014b8){_0x31c47d[_0x3efe('0x1d')]=_0x2014b8;if(_0xb94458[_0x3efe('0x2f')][_0x3efe('0x40')]){_0x599b6b[_0x3efe('0x41')]=[{'all':!![]}];}return db[_0x3efe('0x5e')]['findAll'](_0x599b6b);})['then'](function(_0x55dad0){_0x31c47d[_0x3efe('0x42')]=_0x55dad0;return _0x31c47d;});}})[_0x3efe('0x24')](respondWithFilteredResult(_0x3b823d,_0x599b6b))[_0x3efe('0x43')](handleError(_0x3b823d,null));};exports[_0x3efe('0x5f')]=function(_0x1cedfb,_0x3ce91e,_0x5b3fce){var _0x123f07={'raw':!![],'where':{}};var _0x2d588e={};var _0x2b06b4={'count':0x0,'rows':[]};return db[_0x3efe('0x3f')]['findOne']({'where':{'id':_0x1cedfb[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x3ce91e,null))[_0x3efe('0x24')](function(_0x16a4f1){if(_0x16a4f1){_0x2d588e[_0x3efe('0x31')]=_[_0x3efe('0x51')](db[_0x3efe('0x60')][_0x3efe('0x2c')]);_0x2d588e[_0x3efe('0x2f')]=_['keys'](_0x1cedfb[_0x3efe('0x2f')]);_0x2d588e['filters']=_[_0x3efe('0x46')](_0x2d588e[_0x3efe('0x31')],_0x2d588e[_0x3efe('0x2f')]);_0x123f07[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0x2d588e['model'],qs['fields'](_0x1cedfb[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x123f07['attributes']=_0x123f07['attributes']['length']?_0x123f07['attributes']:_0x2d588e[_0x3efe('0x31')];if(!_0x1cedfb[_0x3efe('0x2f')]['hasOwnProperty'](_0x3efe('0x35'))){_0x123f07[_0x3efe('0x1e')]=qs['limit'](_0x1cedfb[_0x3efe('0x2f')][_0x3efe('0x1e')]);_0x123f07['offset']=qs[_0x3efe('0x1b')](_0x1cedfb['query'][_0x3efe('0x1b')]);}_0x123f07[_0x3efe('0x59')]=qs[_0x3efe('0x36')](_0x1cedfb[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x123f07[_0x3efe('0x37')]=qs[_0x3efe('0x39')](_[_0x3efe('0x38')](_0x1cedfb[_0x3efe('0x2f')],_0x2d588e[_0x3efe('0x39')]));_0x123f07[_0x3efe('0x37')][_0x3efe('0x5a')]=_0x16a4f1['id'];if(_0x1cedfb[_0x3efe('0x2f')]['filter']){_0x123f07['where']=_['merge'](_0x123f07[_0x3efe('0x37')],{'$or':_[_0x3efe('0x2b')](_0x123f07[_0x3efe('0x30')],function(_0x3c9a09){var _0x384dec={};_0x384dec[_0x3c9a09]={'$like':'%'+_0x1cedfb[_0x3efe('0x2f')]['filter']+'%'};return _0x384dec;})});}_0x123f07=_[_0x3efe('0x3a')]({},_0x123f07,_0x1cedfb['options']);return db['CmHopperFinal'][_0x3efe('0x1d')]({'where':_0x123f07['where']})[_0x3efe('0x24')](function(_0x2ba3a0){_0x2b06b4[_0x3efe('0x1d')]=_0x2ba3a0;if(_0x1cedfb[_0x3efe('0x2f')][_0x3efe('0x40')]){_0x123f07[_0x3efe('0x41')]=[{'all':!![]}];}return db[_0x3efe('0x60')][_0x3efe('0x5c')](_0x123f07);})['then'](function(_0x35002b){_0x2b06b4[_0x3efe('0x42')]=_0x35002b;return _0x2b06b4;});}})[_0x3efe('0x24')](respondWithFilteredResult(_0x3ce91e,_0x123f07))[_0x3efe('0x43')](handleError(_0x3ce91e,null));};exports[_0x3efe('0x61')]=function(_0x13e4bb,_0x13ea5e,_0x1f7e1b){var _0x50a6ff={'raw':!![],'where':{}};var _0x44ec74={};var _0x3b9b45={'count':0x0,'rows':[]};return db[_0x3efe('0x3f')][_0x3efe('0x58')]({'where':{'id':_0x13e4bb['params']['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x13ea5e,null))[_0x3efe('0x24')](function(_0x5e3187){if(_0x5e3187){_0x44ec74[_0x3efe('0x31')]=_[_0x3efe('0x51')](db[_0x3efe('0x62')][_0x3efe('0x2c')]);_0x44ec74[_0x3efe('0x2f')]=_[_0x3efe('0x51')](_0x13e4bb['query']);_0x44ec74['filters']=_[_0x3efe('0x46')](_0x44ec74[_0x3efe('0x31')],_0x44ec74['query']);_0x50a6ff[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0x44ec74[_0x3efe('0x31')],qs[_0x3efe('0x32')](_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x50a6ff['attributes']=_0x50a6ff[_0x3efe('0x30')]['length']?_0x50a6ff[_0x3efe('0x30')]:_0x44ec74[_0x3efe('0x31')];if(!_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x34')](_0x3efe('0x35'))){_0x50a6ff[_0x3efe('0x1e')]=qs[_0x3efe('0x1e')](_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x1e')]);_0x50a6ff[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x13e4bb[_0x3efe('0x2f')]['offset']);}_0x50a6ff[_0x3efe('0x59')]=qs[_0x3efe('0x36')](_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x50a6ff['where']=qs[_0x3efe('0x39')](_['pick'](_0x13e4bb['query'],_0x44ec74[_0x3efe('0x39')]));_0x50a6ff[_0x3efe('0x37')][_0x3efe('0x5a')]=_0x5e3187['id'];if(_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x3d')]){_0x50a6ff['where']=_[_0x3efe('0x3a')](_0x50a6ff[_0x3efe('0x37')],{'$or':_[_0x3efe('0x2b')](_0x50a6ff[_0x3efe('0x30')],function(_0x4d7061){var _0x4e7bc0={};_0x4e7bc0[_0x4d7061]={'$like':'%'+_0x13e4bb[_0x3efe('0x2f')][_0x3efe('0x3d')]+'%'};return _0x4e7bc0;})});}_0x50a6ff=_[_0x3efe('0x3a')]({},_0x50a6ff,_0x13e4bb[_0x3efe('0x3e')]);return db[_0x3efe('0x62')][_0x3efe('0x1d')]({'where':_0x50a6ff['where']})[_0x3efe('0x24')](function(_0x3aa22b){_0x3b9b45[_0x3efe('0x1d')]=_0x3aa22b;if(_0x13e4bb['query'][_0x3efe('0x40')]){_0x50a6ff[_0x3efe('0x41')]=[{'all':!![]}];}return db[_0x3efe('0x62')][_0x3efe('0x5c')](_0x50a6ff);})[_0x3efe('0x24')](function(_0x9e3b70){_0x3b9b45[_0x3efe('0x42')]=_0x9e3b70;return _0x3b9b45;});}})[_0x3efe('0x24')](respondWithFilteredResult(_0x13ea5e,_0x50a6ff))[_0x3efe('0x43')](handleError(_0x13ea5e,null));};exports['getLists']=function(_0x390e0c,_0x44ed1b,_0x457f76){var _0x30eabd={};var _0x15db83={};var _0x3b42e3;var _0x5d396e;return db[_0x3efe('0x3f')][_0x3efe('0x58')]({'where':{'id':_0x390e0c[_0x3efe('0x45')]['id']}})['then'](handleEntityNotFound(_0x44ed1b,null))['then'](function(_0x5910e1){if(_0x5910e1){_0x3b42e3=_0x5910e1;_0x15db83['model']=_[_0x3efe('0x51')](db[_0x3efe('0x63')][_0x3efe('0x2c')]);_0x15db83[_0x3efe('0x2f')]=_[_0x3efe('0x51')](_0x390e0c[_0x3efe('0x2f')]);_0x15db83[_0x3efe('0x39')]=_['intersection'](_0x15db83['model'],_0x15db83[_0x3efe('0x2f')]);_0x30eabd[_0x3efe('0x30')]=_['intersection'](_0x15db83[_0x3efe('0x31')],qs[_0x3efe('0x32')](_0x390e0c[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x30eabd[_0x3efe('0x30')]=_0x30eabd[_0x3efe('0x30')][_0x3efe('0x33')]?_0x30eabd[_0x3efe('0x30')]:_0x15db83[_0x3efe('0x31')];_0x30eabd['order']=qs[_0x3efe('0x36')](_0x390e0c[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x30eabd['where']=qs[_0x3efe('0x39')](_[_0x3efe('0x38')](_0x390e0c['query'],_0x15db83[_0x3efe('0x39')]));if(_0x390e0c[_0x3efe('0x2f')]['filter']){_0x30eabd[_0x3efe('0x37')]=_[_0x3efe('0x3a')](_0x30eabd[_0x3efe('0x37')],{'$or':_[_0x3efe('0x2b')](_0x30eabd[_0x3efe('0x30')],function(_0xced445){var _0x2a94cd={};_0x2a94cd[_0xced445]={'$like':'%'+_0x390e0c[_0x3efe('0x2f')][_0x3efe('0x3d')]+'%'};return _0x2a94cd;})});}_0x30eabd=_['merge']({},_0x30eabd,_0x390e0c[_0x3efe('0x3e')]);return _0x3b42e3['getLists'](_0x30eabd);}})[_0x3efe('0x24')](function(_0x4d850a){if(_0x4d850a){_0x5d396e=_0x4d850a[_0x3efe('0x33')];if(!_0x390e0c[_0x3efe('0x2f')]['hasOwnProperty']('nolimit')){_0x30eabd[_0x3efe('0x1e')]=qs[_0x3efe('0x1e')](_0x390e0c['query']['limit']);_0x30eabd[_0x3efe('0x1b')]=qs[_0x3efe('0x1b')](_0x390e0c[_0x3efe('0x2f')][_0x3efe('0x1b')]);}return _0x3b42e3[_0x3efe('0x64')](_0x30eabd);}})[_0x3efe('0x24')](function(_0x483042){if(_0x483042){return _0x483042?{'count':_0x5d396e,'rows':_0x483042}:null;}})['then'](respondWithResult(_0x44ed1b,null))['catch'](handleError(_0x44ed1b,null));};exports['addLists']=function(_0x234232,_0x27e3e5,_0x220459){var _0x39126d,_0x199dca;var _0x47e34d=[];var _0x3d4ffd=moment()[_0x3efe('0x65')](_0x3efe('0x66'));return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x234232['params']['id']}})['then'](handleEntityNotFound(_0x27e3e5,null))[_0x3efe('0x24')](function(_0x159155){if(_0x159155){_0x199dca=_0x159155;return _0x159155[_0x3efe('0x67')](_0x234232[_0x3efe('0x54')][_0x3efe('0x68')],_[_0x3efe('0x53')](_0x234232[_0x3efe('0x54')],[_0x3efe('0x68'),'id'])||{});}return null;})[_0x3efe('0x69')](function(_0x1981d4){var _0x41b218;var _0x2908ba;_0x39126d=_0x1981d4||[];var _0x1c3674=[];if(_0x1981d4){for(var _0x2a536e=0x0;_0x2a536e<_0x1981d4[_0x3efe('0x33')];_0x2a536e+=0x1){var _0x6fcb32=_0x1981d4[_0x2a536e][_0x3efe('0x26')]({'plain':!![]});_0x199dca[_0x3efe('0x6a')]=_0x234232[_0x3efe('0x54')][_0x3efe('0x6a')]?_0x234232[_0x3efe('0x54')]['dialCheckDuplicateType']:_0x199dca['dialCheckDuplicateType'];switch(_0x199dca[_0x3efe('0x6a')]){case _0x3efe('0x6b'):_0x41b218=squel['insert']()[_0x3efe('0x6c')](_0x3efe('0x6d'))['fromQuery']([_0x3efe('0x6e'),_0x3efe('0x6f'),_0x3efe('0x70'),_0x3efe('0x71'),_0x3efe('0x5a'),'createdAt',_0x3efe('0x52')],squel['select']()[_0x3efe('0x72')](_0x3efe('0x6e'),'phone')[_0x3efe('0x72')](_0x3efe('0x73'),_0x3efe('0x6f'))[_0x3efe('0x72')]('id',_0x3efe('0x70'))[_0x3efe('0x72')](_0x6fcb32['CmListId'][_0x3efe('0x74')](),_0x3efe('0x71'))[_0x3efe('0x72')](_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')](),'CampaignId')[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x55'))[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27','updatedAt')[_0x3efe('0x75')](_0x3efe('0x76'))[_0x3efe('0x37')](_0x3efe('0x77'))[_0x3efe('0x37')](_0x3efe('0x78'),_0x6fcb32[_0x3efe('0x79')][_0x3efe('0x74')]())[_0x3efe('0x37')](_0x3efe('0x7a'))[_0x3efe('0x37')](_0x3efe('0x7b'),squel[_0x3efe('0x7c')]()['field'](_0x3efe('0x7d'))[_0x3efe('0x75')](_0x3efe('0x7e'))[_0x3efe('0x37')](_0x3efe('0x7f'),_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')]()))[_0x3efe('0x37')](_0x3efe('0x7b'),squel[_0x3efe('0x7c')]()[_0x3efe('0x72')](_0x3efe('0x80'))[_0x3efe('0x75')]('cm_hopper')[_0x3efe('0x37')](_0x3efe('0x7f'),_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')]())))['toString']();break;case'onlyIfOpen':_0x41b218=squel[_0x3efe('0x81')]()['into'](_0x3efe('0x6d'))[_0x3efe('0x82')]([_0x3efe('0x6e'),_0x3efe('0x6f'),_0x3efe('0x70'),_0x3efe('0x71'),_0x3efe('0x5a'),_0x3efe('0x55'),_0x3efe('0x52')],squel[_0x3efe('0x7c')]()['field'](_0x3efe('0x6e'),_0x3efe('0x6e'))[_0x3efe('0x72')](_0x3efe('0x73'),'scheduledAt')[_0x3efe('0x72')]('id',_0x3efe('0x70'))['field'](_0x6fcb32[_0x3efe('0x79')][_0x3efe('0x74')](),_0x3efe('0x71'))['field'](_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')](),_0x3efe('0x5a'))[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x55'))[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27','updatedAt')['from'](_0x3efe('0x76'))[_0x3efe('0x37')]('deletedAt\x20IS\x20NULL')[_0x3efe('0x37')]('ListId\x20=\x20?',_0x6fcb32[_0x3efe('0x79')][_0x3efe('0x74')]())[_0x3efe('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x3efe('0x37')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3efe('0x72')](_0x3efe('0x80'))['from'](_0x3efe('0x6d'))[_0x3efe('0x37')](_0x3efe('0x7f'),_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')]())))[_0x3efe('0x74')]();break;default:_0x41b218=squel[_0x3efe('0x81')]()['into']('cm_hopper')[_0x3efe('0x82')]([_0x3efe('0x6e'),_0x3efe('0x6f'),_0x3efe('0x70'),_0x3efe('0x71'),_0x3efe('0x5a'),_0x3efe('0x55'),_0x3efe('0x52')],squel[_0x3efe('0x7c')]()[_0x3efe('0x72')](_0x3efe('0x6e'),_0x3efe('0x6e'))['field'](_0x3efe('0x73'),_0x3efe('0x6f'))['field']('id',_0x3efe('0x70'))[_0x3efe('0x72')](_0x6fcb32['CmListId'][_0x3efe('0x74')](),_0x3efe('0x71'))[_0x3efe('0x72')](_0x234232[_0x3efe('0x45')]['id'][_0x3efe('0x74')](),_0x3efe('0x5a'))['field']('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x55'))[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x52'))[_0x3efe('0x75')](_0x3efe('0x76'))[_0x3efe('0x37')](_0x3efe('0x77'))['where'](_0x3efe('0x78'),_0x6fcb32[_0x3efe('0x79')][_0x3efe('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3efe('0x74')]();}_0x2908ba=squel[_0x3efe('0x81')]()[_0x3efe('0x6c')](_0x3efe('0x83'))[_0x3efe('0x82')]([_0x3efe('0x84'),_0x3efe('0x6f'),_0x3efe('0x6e'),_0x3efe('0x85'),'createdAt',_0x3efe('0x52')],squel[_0x3efe('0x7c')]()[_0x3efe('0x72')]('h.id','id')[_0x3efe('0x72')](_0x3efe('0x73'),'scheduledAt')['field'](_0x3efe('0x86'),_0x3efe('0x6e'))['field'](_0x3efe('0x87'),_0x3efe('0x85'))['field']('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x55'))[_0x3efe('0x72')]('\x27'+_0x3d4ffd+'\x27',_0x3efe('0x52'))['from'](_0x3efe('0x88'),'ci')[_0x3efe('0x89')](_0x3efe('0x6d'),'h',_0x3efe('0x8a'))['where'](_0x3efe('0x8b'),_0x6fcb32[_0x3efe('0x79')]['toString']())[_0x3efe('0x37')](_0x3efe('0x8c'),_0x234232['params']['id'][_0x3efe('0x74')]())['where']('h.createdAt\x20=\x20?',_0x3d4ffd))[_0x3efe('0x74')]();_0x1c3674[_0x3efe('0x8d')](db[_0x3efe('0x8e')][_0x3efe('0x2f')](_0x41b218));_0x47e34d['push'](db[_0x3efe('0x8e')]['query'](_0x2908ba));}return BPromise['all'](_0x1c3674);}})[_0x3efe('0x24')](function(){return BPromise[_0x3efe('0x8f')](_0x47e34d);})[_0x3efe('0x24')](function(){return _0x39126d;})[_0x3efe('0x24')](respondWithResult(_0x27e3e5,null))[_0x3efe('0x43')](handleError(_0x27e3e5,null));};exports[_0x3efe('0x90')]=function(_0x412b03,_0x5177bd,_0x317fd3){return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x412b03['params']['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x5177bd,null))[_0x3efe('0x24')](function(_0x1b75ea){if(_0x1b75ea){return _0x1b75ea['removeLists'](_0x412b03[_0x3efe('0x2f')][_0x3efe('0x68')]);}})[_0x3efe('0x24')](function(_0x5eb913){if(_0x5eb913){return db[_0x3efe('0x5b')][_0x3efe('0x25')]({'where':{'ListId':_0x412b03['query'][_0x3efe('0x68')],'CampaignId':_0x412b03[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](function(){return _0x5eb913;});}})[_0x3efe('0x24')](respondWithStatusCode(_0x5177bd,null))[_0x3efe('0x43')](handleError(_0x5177bd,null));};exports['getBlackLists']=function(_0x5cf763,_0x54b22a,_0x532546){var _0x566d83={};var _0x2ba952={};var _0x27d4cc;var _0x34572f;return db['Campaign']['findOne']({'where':{'id':_0x5cf763[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x54b22a,null))[_0x3efe('0x24')](function(_0x335469){if(_0x335469){_0x27d4cc=_0x335469;_0x2ba952['model']=_[_0x3efe('0x51')](db[_0x3efe('0x63')][_0x3efe('0x2c')]);_0x2ba952[_0x3efe('0x2f')]=_[_0x3efe('0x51')](_0x5cf763[_0x3efe('0x2f')]);_0x2ba952[_0x3efe('0x39')]=_[_0x3efe('0x46')](_0x2ba952[_0x3efe('0x31')],_0x2ba952['query']);_0x566d83[_0x3efe('0x30')]=_[_0x3efe('0x46')](_0x2ba952[_0x3efe('0x31')],qs['fields'](_0x5cf763[_0x3efe('0x2f')][_0x3efe('0x32')]));_0x566d83['attributes']=_0x566d83[_0x3efe('0x30')][_0x3efe('0x33')]?_0x566d83['attributes']:_0x2ba952[_0x3efe('0x31')];_0x566d83[_0x3efe('0x59')]=qs['sort'](_0x5cf763[_0x3efe('0x2f')][_0x3efe('0x36')]);_0x566d83['where']=qs[_0x3efe('0x39')](_[_0x3efe('0x38')](_0x5cf763[_0x3efe('0x2f')],_0x2ba952[_0x3efe('0x39')]));if(_0x5cf763['query']['filter']){_0x566d83[_0x3efe('0x37')]=_[_0x3efe('0x3a')](_0x566d83[_0x3efe('0x37')],{'$or':_[_0x3efe('0x2b')](_0x566d83[_0x3efe('0x30')],function(_0x5c0962){var _0x99559f={};_0x99559f[_0x5c0962]={'$like':'%'+_0x5cf763[_0x3efe('0x2f')][_0x3efe('0x3d')]+'%'};return _0x99559f;})});}_0x566d83=_[_0x3efe('0x3a')]({},_0x566d83,_0x5cf763[_0x3efe('0x3e')]);return _0x27d4cc[_0x3efe('0x91')](_0x566d83);}})[_0x3efe('0x24')](function(_0x19ef0c){if(_0x19ef0c){_0x34572f=_0x19ef0c[_0x3efe('0x33')];if(!_0x5cf763[_0x3efe('0x2f')][_0x3efe('0x34')]('nolimit')){_0x566d83['limit']=qs['limit'](_0x5cf763['query']['limit']);_0x566d83['offset']=qs[_0x3efe('0x1b')](_0x5cf763[_0x3efe('0x2f')][_0x3efe('0x1b')]);}return _0x27d4cc[_0x3efe('0x91')](_0x566d83);}})[_0x3efe('0x24')](function(_0x4d3308){if(_0x4d3308){return _0x4d3308?{'count':_0x34572f,'rows':_0x4d3308}:null;}})[_0x3efe('0x24')](respondWithResult(_0x54b22a,null))[_0x3efe('0x43')](handleError(_0x54b22a,null));};exports[_0x3efe('0x92')]=function(_0x37c132,_0xf3c356,_0x55759f){var _0x3bf7a9,_0x23197f;var _0x4527f5=[];var _0x5b9060=moment()[_0x3efe('0x65')](_0x3efe('0x66'));return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x37c132['params']['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0xf3c356,null))['then'](function(_0x415dfd){if(_0x415dfd){_0x23197f=_0x415dfd;return _0x415dfd[_0x3efe('0x92')](_0x37c132['body']['ids'],_[_0x3efe('0x53')](_0x37c132[_0x3efe('0x54')],['ids','id'])||{});}return null;})[_0x3efe('0x69')](function(_0x35d3f5){var _0xcdd6f7;var _0x4003f7;_0x3bf7a9=_0x35d3f5||[];var _0x3d7b1c=[];if(_0x35d3f5){for(var _0x50b43b=0x0;_0x50b43b<_0x35d3f5[_0x3efe('0x33')];_0x50b43b+=0x1){var _0x5ecb38=_0x35d3f5[_0x50b43b][_0x3efe('0x26')]({'plain':!![]});_0xcdd6f7=squel[_0x3efe('0x81')]()[_0x3efe('0x6c')](_0x3efe('0x93'))[_0x3efe('0x82')]([_0x3efe('0x6e'),_0x3efe('0x70'),_0x3efe('0x71'),_0x3efe('0x5a'),_0x3efe('0x55'),'updatedAt'],squel['select']()[_0x3efe('0x72')](_0x3efe('0x6e'),'phone')['field']('id','ContactId')[_0x3efe('0x72')](_0x5ecb38[_0x3efe('0x79')]['toString'](),'ListId')[_0x3efe('0x72')](_0x37c132['params']['id'][_0x3efe('0x74')](),_0x3efe('0x5a'))['field'](_0x3efe('0x73'),'createdAt')['field'](_0x3efe('0x73'),_0x3efe('0x52'))['from']('cm_contacts')[_0x3efe('0x37')](_0x3efe('0x77'))['where'](_0x3efe('0x78'),_0x5ecb38[_0x3efe('0x79')]['toString']())[_0x3efe('0x37')](_0x3efe('0x7a')))['toString']();_0x3d7b1c[_0x3efe('0x8d')](db[_0x3efe('0x8e')][_0x3efe('0x2f')](_0xcdd6f7));}return BPromise[_0x3efe('0x8f')](_0x3d7b1c);}})[_0x3efe('0x24')](function(){return _0x3bf7a9;})[_0x3efe('0x24')](respondWithResult(_0xf3c356,null))[_0x3efe('0x43')](handleError(_0xf3c356,null));};exports[_0x3efe('0x94')]=function(_0x2ef142,_0x391bb9,_0x348fb3){return db[_0x3efe('0x3f')][_0x3efe('0x47')]({'where':{'id':_0x2ef142[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](handleEntityNotFound(_0x391bb9,null))[_0x3efe('0x24')](function(_0x5453e0){if(_0x5453e0){return _0x5453e0['removeBlackLists'](_0x2ef142[_0x3efe('0x2f')][_0x3efe('0x68')]);}})[_0x3efe('0x24')](function(_0x4f2d0f){if(_0x4f2d0f){return db['CmHopperBlack'][_0x3efe('0x25')]({'where':{'ListId':_0x2ef142[_0x3efe('0x2f')][_0x3efe('0x68')],'CampaignId':_0x2ef142[_0x3efe('0x45')]['id']}})[_0x3efe('0x24')](function(){return _0x4f2d0f;});}})[_0x3efe('0x24')](respondWithStatusCode(_0x391bb9,null))[_0x3efe('0x43')](handleError(_0x391bb9,null));}; \ No newline at end of file +var _0x1c8a=['cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ContactId','NOW()','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','Campaign','include','findAll','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ListId','field','scheduledAt','toString','from'];(function(_0x16eb3d,_0x157803){var _0x31612a=function(_0xedbb00){while(--_0xedbb00){_0x16eb3d['push'](_0x16eb3d['shift']());}};_0x31612a(++_0x157803);}(_0x1c8a,0x140));var _0xa1c8=function(_0x47dd29,_0x5a47a8){_0x47dd29=_0x47dd29-0x0;var _0x5c1eab=_0x1c8a[_0x47dd29];return _0x5c1eab;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require('moment');var BPromise=require(_0xa1c8('0x5'));var Mustache=require('mustache');var util=require(_0xa1c8('0x6'));var path=require(_0xa1c8('0x7'));var sox=require(_0xa1c8('0x8'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xa'));var _=require(_0xa1c8('0xb'));var squel=require('squel');var crypto=require(_0xa1c8('0xc'));var jsforce=require(_0xa1c8('0xd'));var deskjs=require(_0xa1c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c8('0xf'));var Papa=require(_0xa1c8('0x10'));var Redis=require(_0xa1c8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x14'));var db=require(_0xa1c8('0x15'))['db'];function respondWithStatusCode(_0x2647fa,_0x707249){_0x707249=_0x707249||0xcc;return function(_0x644e9c){if(_0x644e9c){return _0x2647fa[_0xa1c8('0x16')](_0x707249);}return _0x2647fa['status'](_0x707249)[_0xa1c8('0x17')]();};}function respondWithResult(_0x282525,_0xcccc7b){_0xcccc7b=_0xcccc7b||0xc8;return function(_0x3797fe){if(_0x3797fe){return _0x282525[_0xa1c8('0x18')](_0xcccc7b)[_0xa1c8('0x19')](_0x3797fe);}};}function respondWithFilteredResult(_0x517130,_0x7f1128){return function(_0x51b1c3){if(_0x51b1c3){var _0x17d4d2=typeof _0x7f1128[_0xa1c8('0x1a')]===_0xa1c8('0x1b')&&typeof _0x7f1128['limit']===_0xa1c8('0x1b');var _0x59284a=_0x51b1c3['count'];var _0x1fe87f=_0x17d4d2?0x0:_0x7f1128[_0xa1c8('0x1a')];var _0x57fe23=_0x17d4d2?_0x51b1c3[_0xa1c8('0x1c')]:_0x7f1128[_0xa1c8('0x1a')]+_0x7f1128[_0xa1c8('0x1d')];var _0x4e967e;if(_0x57fe23>=_0x59284a){_0x57fe23=_0x59284a;_0x4e967e=0xc8;}else{_0x4e967e=0xce;}_0x517130[_0xa1c8('0x18')](_0x4e967e);return _0x517130[_0xa1c8('0x1e')](_0xa1c8('0x1f'),_0x1fe87f+'-'+_0x57fe23+'/'+_0x59284a)['json'](_0x51b1c3);}return null;};}function patchUpdates(_0x2eabb2){return function(_0x874b1f){try{jsonpatch['apply'](_0x874b1f,_0x2eabb2,!![]);}catch(_0x38008a){return BPromise[_0xa1c8('0x20')](_0x38008a);}return _0x874b1f[_0xa1c8('0x21')]();};}function saveUpdates(_0x2a7fa5,_0x19fe5a){return function(_0x23ff11){if(_0x23ff11){return _0x23ff11[_0xa1c8('0x22')](_0x2a7fa5)[_0xa1c8('0x23')](function(_0x40bb1d){return _0x40bb1d;});}return null;};}function removeEntity(_0x193077,_0x28473c){return function(_0x125047){if(_0x125047){return _0x125047[_0xa1c8('0x24')]()[_0xa1c8('0x23')](function(){var _0x3f929f=_0x125047[_0xa1c8('0x25')]({'plain':!![]});var _0x572362=_0xa1c8('0x26');return db['UserProfileResource'][_0xa1c8('0x24')]({'where':{'type':_0x572362,'resourceId':_0x3f929f['id']}})['then'](function(){return _0x125047;});})[_0xa1c8('0x23')](function(){_0x193077[_0xa1c8('0x18')](0xcc)[_0xa1c8('0x17')]();});}};}function handleEntityNotFound(_0x4eb627,_0x305148){return function(_0x914018){if(!_0x914018){_0x4eb627[_0xa1c8('0x16')](0x194);}return _0x914018;};}function handleError(_0xa067ae,_0x5d756d){_0x5d756d=_0x5d756d||0x1f4;return function(_0x23131b){logger[_0xa1c8('0x27')](_0x23131b[_0xa1c8('0x28')]);if(_0x23131b['name']){delete _0x23131b['name'];}_0xa067ae[_0xa1c8('0x18')](_0x5d756d)[_0xa1c8('0x29')](_0x23131b);};}exports['index']=function(_0x348356,_0x42326b){var _0xeadfdd={},_0x560b55={},_0x4bd7cf={'count':0x0,'rows':[]};var _0x5c78eb=_[_0xa1c8('0x2a')](db['Campaign'][_0xa1c8('0x2b')],function(_0x2cee8b){return{'name':_0x2cee8b[_0xa1c8('0x2c')],'type':_0x2cee8b[_0xa1c8('0x2d')][_0xa1c8('0x2e')]};});_0x560b55[_0xa1c8('0x2f')]=_['map'](_0x5c78eb,_0xa1c8('0x30'));_0x560b55[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x348356[_0xa1c8('0x31')]);_0x560b55['filters']=_['intersection'](_0x560b55[_0xa1c8('0x2f')],_0x560b55['query']);_0xeadfdd[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x560b55[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0xeadfdd[_0xa1c8('0x33')]=_0xeadfdd[_0xa1c8('0x33')]['length']?_0xeadfdd[_0xa1c8('0x33')]:_0x560b55[_0xa1c8('0x2f')];if(!_0x348356[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0xeadfdd[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0xeadfdd[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x348356[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0xeadfdd[_0xa1c8('0x38')]=qs['sort'](_0x348356['query'][_0xa1c8('0x39')]);_0xeadfdd[_0xa1c8('0x3a')]=qs[_0xa1c8('0x3b')](_['pick'](_0x348356['query'],_0x560b55['filters']),_0x5c78eb);if(_0x348356[_0xa1c8('0x31')]['filter']){_0xeadfdd['where']=_[_0xa1c8('0x3c')](_0xeadfdd[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x5c78eb,function(_0x4d3899){if(_0x4d3899[_0xa1c8('0x2d')]!==_0xa1c8('0x3d')){var _0x585ba2={};_0x585ba2[_0x4d3899[_0xa1c8('0x30')]]={'$like':'%'+_0x348356[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x585ba2;}})});}_0xeadfdd=_['merge']({},_0xeadfdd,_0x348356[_0xa1c8('0x3f')]);var _0x947616={'where':_0xeadfdd[_0xa1c8('0x3a')]};return db[_0xa1c8('0x40')][_0xa1c8('0x1c')](_0x947616)['then'](function(_0x52aea5){_0x4bd7cf['count']=_0x52aea5;if(_0x348356['query']['includeAll']){_0xeadfdd[_0xa1c8('0x41')]=[{'all':!![]}];}return db[_0xa1c8('0x40')][_0xa1c8('0x42')](_0xeadfdd);})[_0xa1c8('0x23')](function(_0x3a5cd4){_0x4bd7cf['rows']=_0x3a5cd4;return _0x4bd7cf;})['then'](respondWithFilteredResult(_0x42326b,_0xeadfdd))[_0xa1c8('0x43')](handleError(_0x42326b,null));};exports[_0xa1c8('0x44')]=function(_0x1b0fad,_0x4d6e10){var _0x55d0e0={'raw':![],'where':{'id':_0x1b0fad[_0xa1c8('0x45')]['id']}},_0x45a913={};_0x45a913[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x40')][_0xa1c8('0x2b')]);_0x45a913[_0xa1c8('0x31')]=_['keys'](_0x1b0fad[_0xa1c8('0x31')]);_0x45a913['filters']=_[_0xa1c8('0x34')](_0x45a913[_0xa1c8('0x2f')],_0x45a913[_0xa1c8('0x31')]);_0x55d0e0['attributes']=_[_0xa1c8('0x34')](_0x45a913['model'],qs[_0xa1c8('0x35')](_0x1b0fad[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x55d0e0['attributes']=_0x55d0e0[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x55d0e0['attributes']:_0x45a913[_0xa1c8('0x2f')];if(_0x1b0fad[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x55d0e0[_0xa1c8('0x41')]=[{'all':!![]}];}_0x55d0e0=_[_0xa1c8('0x3c')]({},_0x55d0e0,_0x1b0fad[_0xa1c8('0x3f')]);return db[_0xa1c8('0x40')][_0xa1c8('0x48')](_0x55d0e0)[_0xa1c8('0x23')](handleEntityNotFound(_0x4d6e10,null))['then'](respondWithResult(_0x4d6e10,null))[_0xa1c8('0x43')](handleError(_0x4d6e10,null));};exports[_0xa1c8('0x49')]=function(_0x470479,_0xf29fc){return db['Campaign'][_0xa1c8('0x49')](_0x470479[_0xa1c8('0x4a')],{})[_0xa1c8('0x23')](function(_0x44580d){var _0x364b57=_0x470479['user'][_0xa1c8('0x25')]({'plain':!![]});if(!_0x364b57)throw new Error(_0xa1c8('0x4b'));if(_0x364b57[_0xa1c8('0x4c')]===_0xa1c8('0x4d')){var _0x14ce13=_0x44580d['get']({'plain':!![]});var _0x5bbef3=_0xa1c8('0x26');return db[_0xa1c8('0x4e')][_0xa1c8('0x48')]({'where':{'name':_0x5bbef3,'userProfileId':_0x364b57['userProfileId']},'raw':!![]})[_0xa1c8('0x23')](function(_0x475590){if(_0x475590&&_0x475590[_0xa1c8('0x4f')]===0x0){return db[_0xa1c8('0x50')][_0xa1c8('0x49')]({'name':_0x14ce13[_0xa1c8('0x30')],'resourceId':_0x14ce13['id'],'type':_0x475590[_0xa1c8('0x30')],'sectionId':_0x475590['id']},{})[_0xa1c8('0x23')](function(){return _0x44580d;});}else{return _0x44580d;}})[_0xa1c8('0x43')](function(_0xf13fa3){logger[_0xa1c8('0x27')](_0xa1c8('0x51'),_0xf13fa3);throw _0xf13fa3;});}return _0x44580d;})[_0xa1c8('0x23')](respondWithResult(_0xf29fc,0xc9))['catch'](handleError(_0xf29fc,null));};exports[_0xa1c8('0x52')]=function(_0x1a117a,_0x3fb365){var _0x3d35b4={'where':{'id':_0x1a117a[_0xa1c8('0x45')]['id']}},_0x56a38d={};_0x56a38d[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['Campaign'][_0xa1c8('0x2b')]);_0x3d35b4[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x56a38d[_0xa1c8('0x2f')],qs['fields'](_0x1a117a['query'][_0xa1c8('0x35')]));_0x3d35b4['attributes']=_0x3d35b4[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x3d35b4[_0xa1c8('0x33')]:_0x56a38d[_0xa1c8('0x2f')];if(_0x1a117a[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x3d35b4['include']=[{'all':!![]}];}_0x3d35b4=_[_0xa1c8('0x3c')]({},_0x3d35b4,_0x1a117a['options']);return db[_0xa1c8('0x40')]['find'](_0x3d35b4)[_0xa1c8('0x23')](handleEntityNotFound(_0x3fb365,null))[_0xa1c8('0x23')](function(_0x437ca8){if(_0x437ca8){var _0x1ccdd9=_0x437ca8['get']({'plain':!![]});_0x1ccdd9=qs[_0xa1c8('0x53')](_0x1ccdd9,['id',_0xa1c8('0x54'),_0xa1c8('0x55')]);_0x1a117a[_0xa1c8('0x4a')]=_[_0xa1c8('0x53')](_0x1a117a['body'],['id','createdAt',_0xa1c8('0x55')]);return db[_0xa1c8('0x40')]['create'](_[_0xa1c8('0x3c')](_0x1ccdd9,_0x1a117a['body']),{'include':_0x1a117a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa1c8('0x23')](function(_0x4df225){var _0x529182=_0x1a117a[_0xa1c8('0x4d')]['get']({'plain':!![]});if(!_0x529182)throw new Error(_0xa1c8('0x4b'));if(_0x529182['role']==='user'){var _0x419bbe=_0x4df225[_0xa1c8('0x25')]({'plain':!![]});var _0x2722a7='IvrCampaigns';return db[_0xa1c8('0x4e')][_0xa1c8('0x48')]({'where':{'name':_0x2722a7,'userProfileId':_0x529182[_0xa1c8('0x56')]},'raw':!![]})['then'](function(_0x458579){if(_0x458579&&_0x458579[_0xa1c8('0x4f')]===0x0){return db['UserProfileResource'][_0xa1c8('0x49')]({'name':_0x419bbe[_0xa1c8('0x30')],'resourceId':_0x419bbe['id'],'type':_0x458579[_0xa1c8('0x30')],'sectionId':_0x458579['id']},{})['then'](function(){return _0x4df225;});}else{return _0x4df225;}})[_0xa1c8('0x43')](function(_0x98355b){logger['error'](_0xa1c8('0x51'),_0x98355b);throw _0x98355b;});}return _0x4df225;});}})['then'](respondWithResult(_0x3fb365,0xc9))[_0xa1c8('0x43')](handleError(_0x3fb365,null));};exports['update']=function(_0x125cfb,_0x2938ed){if(_0x125cfb[_0xa1c8('0x4a')]['id']){delete _0x125cfb[_0xa1c8('0x4a')]['id'];}return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0x125cfb[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x2938ed,null))['then'](saveUpdates(_0x125cfb[_0xa1c8('0x4a')],null))[_0xa1c8('0x23')](respondWithResult(_0x2938ed,null))[_0xa1c8('0x43')](handleError(_0x2938ed,null));};exports[_0xa1c8('0x24')]=function(_0xbe6d30,_0x809ee3){return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0xbe6d30[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x809ee3,null))[_0xa1c8('0x23')](removeEntity(_0x809ee3,null))[_0xa1c8('0x43')](handleError(_0x809ee3,null));};exports[_0xa1c8('0x57')]=function(_0x42e30c,_0x2c62b2,_0x15321d){var _0x3dee79={'raw':!![],'where':{}};var _0x1630bc={};var _0x376f19={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x42e30c[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x2c62b2,null))[_0xa1c8('0x23')](function(_0x7bce81){if(_0x7bce81){_0x1630bc['model']=_[_0xa1c8('0x32')](db[_0xa1c8('0x59')][_0xa1c8('0x2b')]);_0x1630bc[_0xa1c8('0x31')]=_['keys'](_0x42e30c[_0xa1c8('0x31')]);_0x1630bc['filters']=_[_0xa1c8('0x34')](_0x1630bc[_0xa1c8('0x2f')],_0x1630bc[_0xa1c8('0x31')]);_0x3dee79[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x1630bc[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x3dee79[_0xa1c8('0x33')]=_0x3dee79['attributes'][_0xa1c8('0x46')]?_0x3dee79[_0xa1c8('0x33')]:_0x1630bc[_0xa1c8('0x2f')];if(!_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x3dee79[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x42e30c[_0xa1c8('0x31')]['limit']);_0x3dee79['offset']=qs[_0xa1c8('0x1a')](_0x42e30c[_0xa1c8('0x31')]['offset']);}_0x3dee79[_0xa1c8('0x38')]=qs['sort'](_0x42e30c['query'][_0xa1c8('0x39')]);_0x3dee79['where']=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x42e30c['query'],_0x1630bc['filters']));_0x3dee79[_0xa1c8('0x3a')][_0xa1c8('0x5b')]=_0x7bce81['id'];if(_0x42e30c['query']['filter']){_0x3dee79[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x3dee79[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x3dee79[_0xa1c8('0x33')],function(_0xaecf67){var _0x2c0a57={};_0x2c0a57[_0xaecf67]={'$like':'%'+_0x42e30c['query'][_0xa1c8('0x3e')]+'%'};return _0x2c0a57;})});}_0x3dee79=_[_0xa1c8('0x3c')]({},_0x3dee79,_0x42e30c[_0xa1c8('0x3f')]);return db[_0xa1c8('0x59')][_0xa1c8('0x1c')]({'where':_0x3dee79[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x15c664){_0x376f19[_0xa1c8('0x1c')]=_0x15c664;if(_0x42e30c[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x3dee79['include']=[{'all':!![]}];}return db['CmHopper'][_0xa1c8('0x42')](_0x3dee79);})[_0xa1c8('0x23')](function(_0x557dc3){_0x376f19[_0xa1c8('0x5c')]=_0x557dc3;return _0x376f19;});}})['then'](respondWithFilteredResult(_0x2c62b2,_0x3dee79))[_0xa1c8('0x43')](handleError(_0x2c62b2,null));};exports[_0xa1c8('0x5d')]=function(_0x54f3b9,_0x31c23f,_0x9397e7){var _0x467372={'raw':!![],'where':{}};var _0x36d508={};var _0x3bb064={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x54f3b9['params']['id']}})['then'](handleEntityNotFound(_0x31c23f,null))[_0xa1c8('0x23')](function(_0x4b829f){if(_0x4b829f){_0x36d508[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x5e')][_0xa1c8('0x2b')]);_0x36d508['query']=_['keys'](_0x54f3b9['query']);_0x36d508[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x36d508[_0xa1c8('0x2f')],_0x36d508[_0xa1c8('0x31')]);_0x467372[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x36d508['model'],qs[_0xa1c8('0x35')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x467372[_0xa1c8('0x33')]=_0x467372['attributes']['length']?_0x467372[_0xa1c8('0x33')]:_0x36d508[_0xa1c8('0x2f')];if(!_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x467372[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x467372[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x467372[_0xa1c8('0x38')]=qs[_0xa1c8('0x39')](_0x54f3b9[_0xa1c8('0x31')]['sort']);_0x467372['where']=qs['filters'](_[_0xa1c8('0x5a')](_0x54f3b9[_0xa1c8('0x31')],_0x36d508[_0xa1c8('0x3b')]));_0x467372['where'][_0xa1c8('0x5b')]=_0x4b829f['id'];if(_0x54f3b9[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x467372[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x467372['where'],{'$or':_[_0xa1c8('0x2a')](_0x467372[_0xa1c8('0x33')],function(_0x3d71fc){var _0x17ebe8={};_0x17ebe8[_0x3d71fc]={'$like':'%'+_0x54f3b9[_0xa1c8('0x31')]['filter']+'%'};return _0x17ebe8;})});}_0x467372=_[_0xa1c8('0x3c')]({},_0x467372,_0x54f3b9[_0xa1c8('0x3f')]);return db[_0xa1c8('0x5e')]['count']({'where':_0x467372[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x4797b3){_0x3bb064[_0xa1c8('0x1c')]=_0x4797b3;if(_0x54f3b9[_0xa1c8('0x31')]['includeAll']){_0x467372[_0xa1c8('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa1c8('0x42')](_0x467372);})['then'](function(_0x1e1128){_0x3bb064[_0xa1c8('0x5c')]=_0x1e1128;return _0x3bb064;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x31c23f,_0x467372))[_0xa1c8('0x43')](handleError(_0x31c23f,null));};exports[_0xa1c8('0x5f')]=function(_0x5ee23c,_0x514d1f,_0x432c54){var _0x1eb4ac={'raw':!![],'where':{}};var _0x30c9e9={};var _0x369590={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x5ee23c[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x514d1f,null))[_0xa1c8('0x23')](function(_0x5709cb){if(_0x5709cb){_0x30c9e9[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['CmHopperFinal'][_0xa1c8('0x2b')]);_0x30c9e9[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x5ee23c[_0xa1c8('0x31')]);_0x30c9e9[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x30c9e9['model'],_0x30c9e9[_0xa1c8('0x31')]);_0x1eb4ac[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x30c9e9[_0xa1c8('0x2f')],qs['fields'](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x1eb4ac['attributes']=_0x1eb4ac[_0xa1c8('0x33')]['length']?_0x1eb4ac[_0xa1c8('0x33')]:_0x30c9e9['model'];if(!_0x5ee23c['query'][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x1eb4ac['limit']=qs[_0xa1c8('0x1d')](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x1eb4ac[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x1eb4ac[_0xa1c8('0x38')]=qs['sort'](_0x5ee23c[_0xa1c8('0x31')]['sort']);_0x1eb4ac['where']=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x5ee23c[_0xa1c8('0x31')],_0x30c9e9[_0xa1c8('0x3b')]));_0x1eb4ac[_0xa1c8('0x3a')][_0xa1c8('0x5b')]=_0x5709cb['id'];if(_0x5ee23c[_0xa1c8('0x31')]['filter']){_0x1eb4ac[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x1eb4ac[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x1eb4ac['attributes'],function(_0x50a1b6){var _0x470ef9={};_0x470ef9[_0x50a1b6]={'$like':'%'+_0x5ee23c[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x470ef9;})});}_0x1eb4ac=_[_0xa1c8('0x3c')]({},_0x1eb4ac,_0x5ee23c['options']);return db[_0xa1c8('0x60')][_0xa1c8('0x1c')]({'where':_0x1eb4ac[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x5dee1e){_0x369590[_0xa1c8('0x1c')]=_0x5dee1e;if(_0x5ee23c[_0xa1c8('0x31')]['includeAll']){_0x1eb4ac[_0xa1c8('0x41')]=[{'all':!![]}];}return db[_0xa1c8('0x60')]['findAll'](_0x1eb4ac);})['then'](function(_0x51e6da){_0x369590[_0xa1c8('0x5c')]=_0x51e6da;return _0x369590;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x514d1f,_0x1eb4ac))['catch'](handleError(_0x514d1f,null));};exports[_0xa1c8('0x61')]=function(_0x179894,_0x24d2e6,_0xa08588){var _0x5819e0={'raw':!![],'where':{}};var _0x517145={};var _0x4c1297={'count':0x0,'rows':[]};return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x179894[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x24d2e6,null))[_0xa1c8('0x23')](function(_0x5ecd81){if(_0x5ecd81){_0x517145[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db['CmHopperBlack']['rawAttributes']);_0x517145[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x179894[_0xa1c8('0x31')]);_0x517145[_0xa1c8('0x3b')]=_[_0xa1c8('0x34')](_0x517145[_0xa1c8('0x2f')],_0x517145[_0xa1c8('0x31')]);_0x5819e0[_0xa1c8('0x33')]=_['intersection'](_0x517145[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x179894[_0xa1c8('0x31')]['fields']));_0x5819e0[_0xa1c8('0x33')]=_0x5819e0[_0xa1c8('0x33')]['length']?_0x5819e0[_0xa1c8('0x33')]:_0x517145[_0xa1c8('0x2f')];if(!_0x179894[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x5819e0['limit']=qs[_0xa1c8('0x1d')](_0x179894[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x5819e0[_0xa1c8('0x1a')]=qs['offset'](_0x179894[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}_0x5819e0[_0xa1c8('0x38')]=qs['sort'](_0x179894[_0xa1c8('0x31')]['sort']);_0x5819e0['where']=qs[_0xa1c8('0x3b')](_['pick'](_0x179894[_0xa1c8('0x31')],_0x517145[_0xa1c8('0x3b')]));_0x5819e0['where'][_0xa1c8('0x5b')]=_0x5ecd81['id'];if(_0x179894[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x5819e0[_0xa1c8('0x3a')]=_['merge'](_0x5819e0[_0xa1c8('0x3a')],{'$or':_['map'](_0x5819e0[_0xa1c8('0x33')],function(_0x43144d){var _0x384094={};_0x384094[_0x43144d]={'$like':'%'+_0x179894[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x384094;})});}_0x5819e0=_['merge']({},_0x5819e0,_0x179894[_0xa1c8('0x3f')]);return db[_0xa1c8('0x62')]['count']({'where':_0x5819e0[_0xa1c8('0x3a')]})[_0xa1c8('0x23')](function(_0x691df5){_0x4c1297[_0xa1c8('0x1c')]=_0x691df5;if(_0x179894[_0xa1c8('0x31')][_0xa1c8('0x47')]){_0x5819e0['include']=[{'all':!![]}];}return db[_0xa1c8('0x62')]['findAll'](_0x5819e0);})[_0xa1c8('0x23')](function(_0x4fc625){_0x4c1297['rows']=_0x4fc625;return _0x4c1297;});}})[_0xa1c8('0x23')](respondWithFilteredResult(_0x24d2e6,_0x5819e0))['catch'](handleError(_0x24d2e6,null));};exports[_0xa1c8('0x63')]=function(_0x263bb9,_0x1c5286,_0x502b29){var _0x241af7={};var _0x5e52cd={};var _0x58e7fb;var _0x500ba9;return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x263bb9['params']['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x1c5286,null))[_0xa1c8('0x23')](function(_0x8b3dc6){if(_0x8b3dc6){_0x58e7fb=_0x8b3dc6;_0x5e52cd['model']=_[_0xa1c8('0x32')](db[_0xa1c8('0x64')][_0xa1c8('0x2b')]);_0x5e52cd[_0xa1c8('0x31')]=_[_0xa1c8('0x32')](_0x263bb9[_0xa1c8('0x31')]);_0x5e52cd[_0xa1c8('0x3b')]=_['intersection'](_0x5e52cd[_0xa1c8('0x2f')],_0x5e52cd[_0xa1c8('0x31')]);_0x241af7[_0xa1c8('0x33')]=_['intersection'](_0x5e52cd[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x35')]));_0x241af7[_0xa1c8('0x33')]=_0x241af7[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x241af7['attributes']:_0x5e52cd[_0xa1c8('0x2f')];_0x241af7[_0xa1c8('0x38')]=qs['sort'](_0x263bb9['query'][_0xa1c8('0x39')]);_0x241af7[_0xa1c8('0x3a')]=qs[_0xa1c8('0x3b')](_[_0xa1c8('0x5a')](_0x263bb9[_0xa1c8('0x31')],_0x5e52cd['filters']));if(_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x3e')]){_0x241af7[_0xa1c8('0x3a')]=_['merge'](_0x241af7['where'],{'$or':_[_0xa1c8('0x2a')](_0x241af7[_0xa1c8('0x33')],function(_0x40cbdb){var _0x39a2e5={};_0x39a2e5[_0x40cbdb]={'$like':'%'+_0x263bb9['query'][_0xa1c8('0x3e')]+'%'};return _0x39a2e5;})});}_0x241af7=_[_0xa1c8('0x3c')]({},_0x241af7,_0x263bb9['options']);return _0x58e7fb[_0xa1c8('0x63')](_0x241af7);}})['then'](function(_0x1b09a5){if(_0x1b09a5){_0x500ba9=_0x1b09a5[_0xa1c8('0x46')];if(!_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x36')](_0xa1c8('0x37'))){_0x241af7[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x241af7[_0xa1c8('0x1a')]=qs[_0xa1c8('0x1a')](_0x263bb9[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}return _0x58e7fb['getLists'](_0x241af7);}})[_0xa1c8('0x23')](function(_0x4f5a4e){if(_0x4f5a4e){return _0x4f5a4e?{'count':_0x500ba9,'rows':_0x4f5a4e}:null;}})[_0xa1c8('0x23')](respondWithResult(_0x1c5286,null))['catch'](handleError(_0x1c5286,null));};exports[_0xa1c8('0x65')]=function(_0x4f3382,_0x1b19ce,_0x3df5ee){var _0x5f3dd8,_0x253b86;var _0x5cd3c8=[];var _0x456956=moment()[_0xa1c8('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x4f3382[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x1b19ce,null))['then'](function(_0x26e7df){if(_0x26e7df){_0x253b86=_0x26e7df;return _0x26e7df['addLists'](_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x67')],_[_0xa1c8('0x53')](_0x4f3382[_0xa1c8('0x4a')],[_0xa1c8('0x67'),'id'])||{});}return null;})['spread'](function(_0x52200a){var _0x18b6fd;var _0x615b5b;_0x5f3dd8=_0x52200a||[];var _0x3a19af=[];if(_0x52200a){for(var _0x3c8715=0x0;_0x3c8715<_0x52200a[_0xa1c8('0x46')];_0x3c8715+=0x1){var _0x135214=_0x52200a[_0x3c8715]['get']({'plain':!![]});_0x253b86['dialCheckDuplicateType']=_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x68')]?_0x4f3382[_0xa1c8('0x4a')][_0xa1c8('0x68')]:_0x253b86[_0xa1c8('0x68')];switch(_0x253b86[_0xa1c8('0x68')]){case _0xa1c8('0x69'):_0x18b6fd=squel[_0xa1c8('0x6a')]()[_0xa1c8('0x6b')](_0xa1c8('0x6c'))['fromQuery']([_0xa1c8('0x6d'),'scheduledAt','ContactId',_0xa1c8('0x6e'),_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')]('NOW()',_0xa1c8('0x70'))['field']('id','ContactId')[_0xa1c8('0x6f')](_0x135214['CmListId'][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382['params']['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))[_0xa1c8('0x3a')](_0xa1c8('0x74'))[_0xa1c8('0x3a')](_0xa1c8('0x75'),_0x135214['CmListId']['toString']())['where'](_0xa1c8('0x76'))[_0xa1c8('0x3a')](_0xa1c8('0x77'),squel['select']()['field'](_0xa1c8('0x78'))[_0xa1c8('0x72')]('cm_hopper_final')[_0xa1c8('0x3a')]('CampaignId\x20=\x20?',_0x4f3382['params']['id'][_0xa1c8('0x71')]()))[_0xa1c8('0x3a')](_0xa1c8('0x77'),squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x7a'))[_0xa1c8('0x72')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x4f3382['params']['id']['toString']())))[_0xa1c8('0x71')]();break;case _0xa1c8('0x7b'):_0x18b6fd=squel[_0xa1c8('0x6a')]()[_0xa1c8('0x6b')](_0xa1c8('0x6c'))[_0xa1c8('0x7c')]([_0xa1c8('0x6d'),_0xa1c8('0x70'),_0xa1c8('0x7d'),'ListId','CampaignId',_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')](_0xa1c8('0x7e'),'scheduledAt')[_0xa1c8('0x6f')]('id','ContactId')['field'](_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382['params']['id']['toString'](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))['where'](_0xa1c8('0x74'))[_0xa1c8('0x3a')]('ListId\x20=\x20?',_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())['where'](_0xa1c8('0x76'))['where'](_0xa1c8('0x77'),squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x7a'))[_0xa1c8('0x72')]('cm_hopper')[_0xa1c8('0x3a')]('CampaignId\x20=\x20?',_0x4f3382[_0xa1c8('0x45')]['id']['toString']())))[_0xa1c8('0x71')]();break;default:_0x18b6fd=squel['insert']()['into']('cm_hopper')[_0xa1c8('0x7c')](['phone',_0xa1c8('0x70'),_0xa1c8('0x7d'),'ListId',_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel['select']()['field']('phone','phone')[_0xa1c8('0x6f')](_0xa1c8('0x7e'),_0xa1c8('0x70'))[_0xa1c8('0x6f')]('id',_0xa1c8('0x7d'))[_0xa1c8('0x6f')](_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')](),_0xa1c8('0x6e'))[_0xa1c8('0x6f')](_0x4f3382[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27','createdAt')[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27','updatedAt')['from']('cm_contacts')[_0xa1c8('0x3a')](_0xa1c8('0x74'))['where'](_0xa1c8('0x75'),_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())[_0xa1c8('0x3a')](_0xa1c8('0x76')))['toString']();}_0x615b5b=squel['insert']()[_0xa1c8('0x6b')](_0xa1c8('0x80'))[_0xa1c8('0x7c')]([_0xa1c8('0x81'),_0xa1c8('0x70'),'phone',_0xa1c8('0x82'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x83'),'id')[_0xa1c8('0x6f')](_0xa1c8('0x7e'),'scheduledAt')['field'](_0xa1c8('0x84'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')](_0xa1c8('0x85'),'OrderBy')[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x54'))[_0xa1c8('0x6f')]('\x27'+_0x456956+'\x27',_0xa1c8('0x55'))['from']('cm_contact_has_items','ci')['join'](_0xa1c8('0x6c'),'h',_0xa1c8('0x86'))['where']('h.ListId\x20=\x20?',_0x135214[_0xa1c8('0x7f')][_0xa1c8('0x71')]())[_0xa1c8('0x3a')]('h.CampaignId=?',_0x4f3382[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')]())[_0xa1c8('0x3a')](_0xa1c8('0x87'),_0x456956))[_0xa1c8('0x71')]();_0x3a19af['push'](db[_0xa1c8('0x88')][_0xa1c8('0x31')](_0x18b6fd));_0x5cd3c8[_0xa1c8('0x89')](db[_0xa1c8('0x88')]['query'](_0x615b5b));}return BPromise[_0xa1c8('0x8a')](_0x3a19af);}})[_0xa1c8('0x23')](function(){return BPromise[_0xa1c8('0x8a')](_0x5cd3c8);})['then'](function(){return _0x5f3dd8;})[_0xa1c8('0x23')](respondWithResult(_0x1b19ce,null))[_0xa1c8('0x43')](handleError(_0x1b19ce,null));};exports['removeLists']=function(_0x19f9b1,_0x3375da,_0x52468d){return db[_0xa1c8('0x40')][_0xa1c8('0x48')]({'where':{'id':_0x19f9b1[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x3375da,null))[_0xa1c8('0x23')](function(_0x1292e7){if(_0x1292e7){return _0x1292e7[_0xa1c8('0x8b')](_0x19f9b1['query']['ids']);}})[_0xa1c8('0x23')](function(_0x1f2ff3){if(_0x1f2ff3){return db[_0xa1c8('0x59')][_0xa1c8('0x24')]({'where':{'ListId':_0x19f9b1[_0xa1c8('0x31')][_0xa1c8('0x67')],'CampaignId':_0x19f9b1['params']['id']}})[_0xa1c8('0x23')](function(){return _0x1f2ff3;});}})[_0xa1c8('0x23')](respondWithStatusCode(_0x3375da,null))[_0xa1c8('0x43')](handleError(_0x3375da,null));};exports[_0xa1c8('0x8c')]=function(_0x4e188b,_0x39bd90,_0x51c8ac){var _0x522608={};var _0x399ddc={};var _0x147fce;var _0x1909bb;return db[_0xa1c8('0x40')][_0xa1c8('0x58')]({'where':{'id':_0x4e188b[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x39bd90,null))[_0xa1c8('0x23')](function(_0x1f60e3){if(_0x1f60e3){_0x147fce=_0x1f60e3;_0x399ddc[_0xa1c8('0x2f')]=_[_0xa1c8('0x32')](db[_0xa1c8('0x64')][_0xa1c8('0x2b')]);_0x399ddc['query']=_[_0xa1c8('0x32')](_0x4e188b[_0xa1c8('0x31')]);_0x399ddc['filters']=_['intersection'](_0x399ddc[_0xa1c8('0x2f')],_0x399ddc[_0xa1c8('0x31')]);_0x522608[_0xa1c8('0x33')]=_[_0xa1c8('0x34')](_0x399ddc[_0xa1c8('0x2f')],qs[_0xa1c8('0x35')](_0x4e188b[_0xa1c8('0x31')]['fields']));_0x522608['attributes']=_0x522608[_0xa1c8('0x33')][_0xa1c8('0x46')]?_0x522608[_0xa1c8('0x33')]:_0x399ddc[_0xa1c8('0x2f')];_0x522608['order']=qs[_0xa1c8('0x39')](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x39')]);_0x522608['where']=qs['filters'](_[_0xa1c8('0x5a')](_0x4e188b[_0xa1c8('0x31')],_0x399ddc[_0xa1c8('0x3b')]));if(_0x4e188b['query'][_0xa1c8('0x3e')]){_0x522608[_0xa1c8('0x3a')]=_[_0xa1c8('0x3c')](_0x522608[_0xa1c8('0x3a')],{'$or':_[_0xa1c8('0x2a')](_0x522608[_0xa1c8('0x33')],function(_0x1ec82f){var _0x1e63a6={};_0x1e63a6[_0x1ec82f]={'$like':'%'+_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x3e')]+'%'};return _0x1e63a6;})});}_0x522608=_[_0xa1c8('0x3c')]({},_0x522608,_0x4e188b[_0xa1c8('0x3f')]);return _0x147fce[_0xa1c8('0x8c')](_0x522608);}})['then'](function(_0x498a84){if(_0x498a84){_0x1909bb=_0x498a84['length'];if(!_0x4e188b[_0xa1c8('0x31')]['hasOwnProperty'](_0xa1c8('0x37'))){_0x522608[_0xa1c8('0x1d')]=qs[_0xa1c8('0x1d')](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x1d')]);_0x522608[_0xa1c8('0x1a')]=qs['offset'](_0x4e188b[_0xa1c8('0x31')][_0xa1c8('0x1a')]);}return _0x147fce[_0xa1c8('0x8c')](_0x522608);}})['then'](function(_0x595f0a){if(_0x595f0a){return _0x595f0a?{'count':_0x1909bb,'rows':_0x595f0a}:null;}})[_0xa1c8('0x23')](respondWithResult(_0x39bd90,null))[_0xa1c8('0x43')](handleError(_0x39bd90,null));};exports[_0xa1c8('0x8d')]=function(_0x196c41,_0xca5f56,_0x3f495d){var _0x591183,_0x5b7e15;var _0x58ad36=[];var _0xab9b23=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x196c41[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0xca5f56,null))[_0xa1c8('0x23')](function(_0x10bec3){if(_0x10bec3){_0x5b7e15=_0x10bec3;return _0x10bec3['addBlackLists'](_0x196c41[_0xa1c8('0x4a')][_0xa1c8('0x67')],_[_0xa1c8('0x53')](_0x196c41[_0xa1c8('0x4a')],[_0xa1c8('0x67'),'id'])||{});}return null;})[_0xa1c8('0x8e')](function(_0x420b49){var _0x1cc0ef;var _0x15c987;_0x591183=_0x420b49||[];var _0x32ab13=[];if(_0x420b49){for(var _0xc891a1=0x0;_0xc891a1<_0x420b49[_0xa1c8('0x46')];_0xc891a1+=0x1){var _0x57ca6f=_0x420b49[_0xc891a1][_0xa1c8('0x25')]({'plain':!![]});_0x1cc0ef=squel['insert']()[_0xa1c8('0x6b')](_0xa1c8('0x8f'))[_0xa1c8('0x7c')](['phone','ContactId','ListId',_0xa1c8('0x5b'),_0xa1c8('0x54'),_0xa1c8('0x55')],squel[_0xa1c8('0x79')]()[_0xa1c8('0x6f')](_0xa1c8('0x6d'),_0xa1c8('0x6d'))[_0xa1c8('0x6f')]('id',_0xa1c8('0x7d'))[_0xa1c8('0x6f')](_0x57ca6f[_0xa1c8('0x7f')]['toString'](),_0xa1c8('0x6e'))['field'](_0x196c41[_0xa1c8('0x45')]['id'][_0xa1c8('0x71')](),_0xa1c8('0x5b'))['field'](_0xa1c8('0x7e'),_0xa1c8('0x54'))['field']('NOW()',_0xa1c8('0x55'))[_0xa1c8('0x72')](_0xa1c8('0x73'))[_0xa1c8('0x3a')](_0xa1c8('0x74'))[_0xa1c8('0x3a')]('ListId\x20=\x20?',_0x57ca6f[_0xa1c8('0x7f')][_0xa1c8('0x71')]())['where'](_0xa1c8('0x76')))['toString']();_0x32ab13[_0xa1c8('0x89')](db[_0xa1c8('0x88')][_0xa1c8('0x31')](_0x1cc0ef));}return BPromise['all'](_0x32ab13);}})[_0xa1c8('0x23')](function(){return _0x591183;})[_0xa1c8('0x23')](respondWithResult(_0xca5f56,null))['catch'](handleError(_0xca5f56,null));};exports[_0xa1c8('0x90')]=function(_0x28ad90,_0x42eb01,_0x276439){return db['Campaign'][_0xa1c8('0x48')]({'where':{'id':_0x28ad90[_0xa1c8('0x45')]['id']}})[_0xa1c8('0x23')](handleEntityNotFound(_0x42eb01,null))[_0xa1c8('0x23')](function(_0x432ccd){if(_0x432ccd){return _0x432ccd[_0xa1c8('0x90')](_0x28ad90['query'][_0xa1c8('0x67')]);}})['then'](function(_0x4f1eb7){if(_0x4f1eb7){return db[_0xa1c8('0x62')][_0xa1c8('0x24')]({'where':{'ListId':_0x28ad90[_0xa1c8('0x31')][_0xa1c8('0x67')],'CampaignId':_0x28ad90[_0xa1c8('0x45')]['id']}})['then'](function(){return _0x4f1eb7;});}})['then'](respondWithStatusCode(_0x42eb01,null))[_0xa1c8('0x43')](handleError(_0x42eb01,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7a14db0..e4e3a97 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3ef4ce,_0x5b4e3e){var _0x414d9d=function(_0x28e388){while(--_0x28e388){_0x3ef4ce['push'](_0x3ef4ce['shift']());}};_0x414d9d(++_0x5b4e3e);}(_0x7a54,0x106));var _0x47a5=function(_0x54b5c6,_0x53fd66){_0x54b5c6=_0x54b5c6-0x0;var _0x428829=_0x7a54[_0x54b5c6];return _0x428829;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 6b33369..1b03fbd 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 _0xfc03=['limit','include','map','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes'];(function(_0x3d95c1,_0x264b94){var _0x25147f=function(_0x24e562){while(--_0x24e562){_0x3d95c1['push'](_0x3d95c1['shift']());}};_0x25147f(++_0x264b94);}(_0xfc03,0x16f));var _0x3fc0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfc03[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var moment=require(_0x3fc0('0x1'));var BPromise=require(_0x3fc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fc0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fc0('0x4'));var logger=require(_0x3fc0('0x5'))(_0x3fc0('0x6'));var config=require(_0x3fc0('0x7'));var jayson=require(_0x3fc0('0x8'));var client=jayson[_0x3fc0('0x9')][_0x3fc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeeb912,_0x55eac5,_0x2fb1a6){return new BPromise(function(_0x5f52b5,_0x1369ac){return client[_0x3fc0('0xb')](_0xeeb912,_0x2fb1a6)[_0x3fc0('0xc')](function(_0x392999){logger['info'](_0x3fc0('0xd'),_0x55eac5,_0x3fc0('0xe'));logger[_0x3fc0('0xf')](_0x3fc0('0x10'),_0x55eac5,_0x3fc0('0xe'),JSON['stringify'](_0x392999));if(_0x392999[_0x3fc0('0x11')]){if(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x12')]===0x1f4){logger['error'](_0x3fc0('0xd'),_0x55eac5,_0x392999['error'][_0x3fc0('0x13')]);return _0x1369ac(_0x392999[_0x3fc0('0x11')]['message']);}logger[_0x3fc0('0x11')](_0x3fc0('0xd'),_0x55eac5,_0x392999[_0x3fc0('0x11')]['message']);return _0x5f52b5(_0x392999[_0x3fc0('0x11')][_0x3fc0('0x13')]);}else{logger[_0x3fc0('0x14')](_0x3fc0('0xd'),_0x55eac5,'request\x20sent');_0x5f52b5(_0x392999[_0x3fc0('0x15')][_0x3fc0('0x13')]);}})[_0x3fc0('0x16')](function(_0x5b59f1){logger[_0x3fc0('0x11')]('Campaign,\x20%s,\x20%s',_0x55eac5,_0x5b59f1);_0x1369ac(_0x5b59f1);});});}exports[_0x3fc0('0x17')]=function(_0x3c5026){var _0x4b947c=this;return new Promise(function(_0x3bb388,_0x33ffbc){return db[_0x3fc0('0x18')][_0x3fc0('0x19')]({'raw':_0x3c5026[_0x3fc0('0x1a')]?_0x3c5026[_0x3fc0('0x1a')][_0x3fc0('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c5026[_0x3fc0('0x1a')]?_0x3c5026[_0x3fc0('0x1a')]['where']||null:null,'attributes':_0x3c5026[_0x3fc0('0x1a')]?_0x3c5026[_0x3fc0('0x1a')][_0x3fc0('0x1c')]||null:null,'limit':_0x3c5026[_0x3fc0('0x1a')]?_0x3c5026[_0x3fc0('0x1a')][_0x3fc0('0x1d')]||null:null,'include':_0x3c5026['options']?_0x3c5026[_0x3fc0('0x1a')][_0x3fc0('0x1e')]?_[_0x3fc0('0x1f')](_0x3c5026[_0x3fc0('0x1a')][_0x3fc0('0x1e')],function(_0x303dd2){return{'model':db[_0x303dd2[_0x3fc0('0x20')]],'as':_0x303dd2['as'],'attributes':_0x303dd2[_0x3fc0('0x1c')],'include':_0x303dd2[_0x3fc0('0x1e')]?_[_0x3fc0('0x1f')](_0x303dd2[_0x3fc0('0x1e')],function(_0x1abe10){return{'model':db[_0x1abe10[_0x3fc0('0x20')]],'as':_0x1abe10['as'],'attributes':_0x1abe10[_0x3fc0('0x1c')],'include':_0x1abe10[_0x3fc0('0x1e')]?_[_0x3fc0('0x1f')](_0x1abe10['include'],function(_0x365c8e){return{'model':db[_0x365c8e[_0x3fc0('0x20')]],'as':_0x365c8e['as'],'attributes':_0x365c8e[_0x3fc0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3fc0('0xc')](function(_0x5a9179){logger[_0x3fc0('0x14')](_0x3fc0('0x17'),_0x3c5026);logger[_0x3fc0('0xf')](_0x3fc0('0x17'),_0x3c5026,JSON['stringify'](_0x5a9179));_0x3bb388(_0x5a9179);})[_0x3fc0('0x16')](function(_0x1a2261){logger[_0x3fc0('0x11')](_0x3fc0('0x17'),_0x1a2261[_0x3fc0('0x13')],_0x3c5026);_0x33ffbc(_0x4b947c[_0x3fc0('0x11')](0x1f4,_0x1a2261['message']));});});}; \ No newline at end of file +var _0xbc17=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','lodash','util'];(function(_0x5acaba,_0x383a16){var _0x1bf657=function(_0x390901){while(--_0x390901){_0x5acaba['push'](_0x5acaba['shift']());}};_0x1bf657(++_0x383a16);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x354b70,_0x2ee366){_0x354b70=_0x354b70-0x0;var _0x56a7e8=_0xbc17[_0x354b70];return _0x56a7e8;};'use strict';var _=require(_0x7bc1('0x0'));var util=require(_0x7bc1('0x1'));var moment=require('moment');var BPromise=require(_0x7bc1('0x2'));var rs=require(_0x7bc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7bc1('0x4'));var logger=require(_0x7bc1('0x5'))('rpc');var config=require(_0x7bc1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7bc1('0x7')][_0x7bc1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b720f,_0x3aed05,_0x3fdce7){return new BPromise(function(_0x351340,_0x3c08dc){return client[_0x7bc1('0x9')](_0x1b720f,_0x3fdce7)['then'](function(_0x48454c){logger[_0x7bc1('0xa')](_0x7bc1('0xb'),_0x3aed05,_0x7bc1('0xc'));logger['debug'](_0x7bc1('0xd'),_0x3aed05,_0x7bc1('0xc'),JSON[_0x7bc1('0xe')](_0x48454c));if(_0x48454c[_0x7bc1('0xf')]){if(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x10')]===0x1f4){logger[_0x7bc1('0xf')](_0x7bc1('0xb'),_0x3aed05,_0x48454c[_0x7bc1('0xf')]['message']);return _0x3c08dc(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x11')]);}logger['error'](_0x7bc1('0xb'),_0x3aed05,_0x48454c[_0x7bc1('0xf')]['message']);return _0x351340(_0x48454c[_0x7bc1('0xf')][_0x7bc1('0x11')]);}else{logger['info'](_0x7bc1('0xb'),_0x3aed05,_0x7bc1('0xc'));_0x351340(_0x48454c[_0x7bc1('0x12')][_0x7bc1('0x11')]);}})[_0x7bc1('0x13')](function(_0x5a5a59){logger[_0x7bc1('0xf')]('Campaign,\x20%s,\x20%s',_0x3aed05,_0x5a5a59);_0x3c08dc(_0x5a5a59);});});}exports[_0x7bc1('0x14')]=function(_0x901465){var _0xdf994=this;return new Promise(function(_0x22e6fd,_0x20ce32){return db[_0x7bc1('0x15')][_0x7bc1('0x16')]({'raw':_0x901465[_0x7bc1('0x17')]?_0x901465['options'][_0x7bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x901465[_0x7bc1('0x17')]?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x19')]||null:null,'attributes':_0x901465[_0x7bc1('0x17')]?_0x901465['options'][_0x7bc1('0x1a')]||null:null,'limit':_0x901465['options']?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x1b')]||null:null,'include':_0x901465[_0x7bc1('0x17')]?_0x901465[_0x7bc1('0x17')][_0x7bc1('0x1c')]?_['map'](_0x901465['options'][_0x7bc1('0x1c')],function(_0x306db7){return{'model':db[_0x306db7['model']],'as':_0x306db7['as'],'attributes':_0x306db7['attributes'],'include':_0x306db7[_0x7bc1('0x1c')]?_[_0x7bc1('0x1d')](_0x306db7['include'],function(_0x1e9b8a){return{'model':db[_0x1e9b8a[_0x7bc1('0x1e')]],'as':_0x1e9b8a['as'],'attributes':_0x1e9b8a[_0x7bc1('0x1a')],'include':_0x1e9b8a[_0x7bc1('0x1c')]?_[_0x7bc1('0x1d')](_0x1e9b8a[_0x7bc1('0x1c')],function(_0x25d3a9){return{'model':db[_0x25d3a9[_0x7bc1('0x1e')]],'as':_0x25d3a9['as'],'attributes':_0x25d3a9[_0x7bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7bc1('0x1f')](function(_0x3eb13b){logger[_0x7bc1('0xa')](_0x7bc1('0x14'),_0x901465);logger[_0x7bc1('0x20')]('GetCampaign',_0x901465,JSON[_0x7bc1('0xe')](_0x3eb13b));_0x22e6fd(_0x3eb13b);})[_0x7bc1('0x13')](function(_0x26bf05){logger[_0x7bc1('0xf')](_0x7bc1('0x14'),_0x26bf05[_0x7bc1('0x11')],_0x901465);_0x20ce32(_0xdf994[_0x7bc1('0xf')](0x1f4,_0x26bf05[_0x7bc1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9505b32..f52a2bb 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 _0x2a23=['removeBlackLists','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2a23,0x65));var _0x32a2=function(_0x27aa73,_0x17b3e5){_0x27aa73=_0x27aa73-0x0;var _0x13f650=_0x2a23[_0x27aa73];return _0x13f650;};'use strict';var multer=require(_0x32a2('0x0'));var util=require(_0x32a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x32a2('0x2'));var router=express[_0x32a2('0x3')]();var fs_extra=require(_0x32a2('0x4'));var auth=require(_0x32a2('0x5'));var interaction=require(_0x32a2('0x6'));var config=require(_0x32a2('0x7'));var controller=require(_0x32a2('0x8'));router['get']('/',auth[_0x32a2('0x9')](),controller[_0x32a2('0xa')]);router[_0x32a2('0xb')](_0x32a2('0xc'),auth[_0x32a2('0x9')](),controller[_0x32a2('0xd')]);router[_0x32a2('0xb')]('/:id/hoppers',auth[_0x32a2('0x9')](),controller[_0x32a2('0xe')]);router['get']('/:id/hopper_histories',auth[_0x32a2('0x9')](),controller[_0x32a2('0xf')]);router['get'](_0x32a2('0x10'),auth[_0x32a2('0x9')](),controller[_0x32a2('0x11')]);router[_0x32a2('0xb')]('/:id/hopper_black',auth[_0x32a2('0x9')](),controller[_0x32a2('0x12')]);router[_0x32a2('0xb')](_0x32a2('0x13'),auth[_0x32a2('0x9')](),controller[_0x32a2('0x14')]);router[_0x32a2('0xb')](_0x32a2('0x15'),auth[_0x32a2('0x9')](),controller['getBlackLists']);router[_0x32a2('0x16')]('/',auth[_0x32a2('0x9')](),controller[_0x32a2('0x17')]);router[_0x32a2('0x16')](_0x32a2('0x18'),auth[_0x32a2('0x9')](),controller[_0x32a2('0x19')]);router[_0x32a2('0x16')](_0x32a2('0x13'),auth['isAuthenticated'](),controller[_0x32a2('0x1a')]);router['post']('/:id/blacklists',auth[_0x32a2('0x9')](),controller[_0x32a2('0x1b')]);router[_0x32a2('0x1c')](_0x32a2('0xc'),auth[_0x32a2('0x9')](),controller[_0x32a2('0x1d')]);router[_0x32a2('0x1e')](_0x32a2('0xc'),auth[_0x32a2('0x9')](),controller['destroy']);router[_0x32a2('0x1e')](_0x32a2('0x13'),auth[_0x32a2('0x9')](),controller['removeLists']);router[_0x32a2('0x1e')]('/:id/blacklists',auth[_0x32a2('0x9')](),controller[_0x32a2('0x1f')]);module[_0x32a2('0x20')]=router; \ No newline at end of file +var _0x0834=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','addLists','addBlackLists','put','delete','destroy','removeLists','/:id/blacklists','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller'];(function(_0x54aaf1,_0x21b5ba){var _0x1a9abe=function(_0x1ea09b){while(--_0x1ea09b){_0x54aaf1['push'](_0x54aaf1['shift']());}};_0x1a9abe(++_0x21b5ba);}(_0x0834,0x18e));var _0x4083=function(_0x21d97e,_0x3eb1de){_0x21d97e=_0x21d97e-0x0;var _0x2623eb=_0x0834[_0x21d97e];return _0x2623eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4083('0x0'));var timeout=require(_0x4083('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4083('0x2'));var interaction=require(_0x4083('0x3'));var config=require('../../config/environment');var controller=require(_0x4083('0x4'));router[_0x4083('0x5')]('/',auth['isAuthenticated'](),controller[_0x4083('0x6')]);router['get'](_0x4083('0x7'),auth[_0x4083('0x8')](),controller[_0x4083('0x9')]);router[_0x4083('0x5')](_0x4083('0xa'),auth[_0x4083('0x8')](),controller[_0x4083('0xb')]);router[_0x4083('0x5')](_0x4083('0xc'),auth[_0x4083('0x8')](),controller[_0x4083('0xd')]);router[_0x4083('0x5')](_0x4083('0xe'),auth[_0x4083('0x8')](),controller[_0x4083('0xf')]);router['get']('/:id/hopper_black',auth[_0x4083('0x8')](),controller[_0x4083('0x10')]);router['get'](_0x4083('0x11'),auth[_0x4083('0x8')](),controller[_0x4083('0x12')]);router['get']('/:id/blacklists',auth[_0x4083('0x8')](),controller[_0x4083('0x13')]);router['post']('/',auth[_0x4083('0x8')](),controller[_0x4083('0x14')]);router[_0x4083('0x15')](_0x4083('0x16'),auth[_0x4083('0x8')](),controller['clone']);router[_0x4083('0x15')](_0x4083('0x11'),auth[_0x4083('0x8')](),controller[_0x4083('0x17')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x4083('0x18')]);router[_0x4083('0x19')]('/:id',auth[_0x4083('0x8')](),controller['update']);router[_0x4083('0x1a')](_0x4083('0x7'),auth[_0x4083('0x8')](),controller[_0x4083('0x1b')]);router['delete'](_0x4083('0x11'),auth['isAuthenticated'](),controller[_0x4083('0x1c')]);router[_0x4083('0x1a')](_0x4083('0x1d'),auth[_0x4083('0x8')](),controller['removeBlackLists']);module[_0x4083('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 162ebb3..2541c36 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 _0xc6d7=['STRING','TEXT','medium','getDataValue','key','sequelize','exports'];(function(_0x4303cc,_0x4a75fc){var _0x6d9fd2=function(_0x578ad8){while(--_0x578ad8){_0x4303cc['push'](_0x4303cc['shift']());}};_0x6d9fd2(++_0x4a75fc);}(_0xc6d7,0x163));var _0x7c6d=function(_0x29ced9,_0x449939){_0x29ced9=_0x29ced9-0x0;var _0x407e0a=_0xc6d7[_0x29ced9];return _0x407e0a;};'use strict';var Sequelize=require(_0x7c6d('0x0'));module[_0x7c6d('0x1')]={'key':{'type':Sequelize[_0x7c6d('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7c6d('0x3')],'length':_0x7c6d('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x7c6d('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7c6d('0x5')](_0x7c6d('0x6'));}}}; \ No newline at end of file +var _0xd1a2=['sequelize','exports','STRING','medium','VIRTUAL','getDataValue'];(function(_0x1876c7,_0x379202){var _0x2b9572=function(_0x9bf2ff){while(--_0x9bf2ff){_0x1876c7['push'](_0x1876c7['shift']());}};_0x2b9572(++_0x379202);}(_0xd1a2,0x12c));var _0x2d1a=function(_0x1f7290,_0x3d4325){_0x1f7290=_0x1f7290-0x0;var _0x129d16=_0xd1a2[_0x1f7290];return _0x129d16;};'use strict';var Sequelize=require(_0x2d1a('0x0'));module[_0x2d1a('0x1')]={'key':{'type':Sequelize[_0x2d1a('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x2d1a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2d1a('0x2')]},'name':{'type':Sequelize[_0x2d1a('0x4')],'get':function(){return this[_0x2d1a('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 708b63d..466991d 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 _0x92f0=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','show','params','length','find','catch','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','user','UserProfileResource','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','update','then','destroy','get','CannedAnswers','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0x92f0,0x166));var _0x092f=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x92f0[_0x529059];return _0x156bc2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x092f('0x0'));var zipdir=require(_0x092f('0x1'));var jsonpatch=require(_0x092f('0x2'));var rp=require('request-promise');var moment=require(_0x092f('0x3'));var BPromise=require(_0x092f('0x4'));var Mustache=require(_0x092f('0x5'));var util=require('util');var path=require(_0x092f('0x6'));var sox=require(_0x092f('0x7'));var csv=require(_0x092f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x092f('0x9'));var _=require(_0x092f('0xa'));var squel=require(_0x092f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x092f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x092f('0xd'));var Papa=require('papaparse');var Redis=require(_0x092f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x092f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x092f('0x10'))(_0x092f('0x11'));var utils=require(_0x092f('0x12'));var config=require(_0x092f('0x13'));var licenseUtil=require(_0x092f('0x14'));var db=require(_0x092f('0x15'))['db'];function respondWithStatusCode(_0x17e01b,_0x22bb62){_0x22bb62=_0x22bb62||0xcc;return function(_0x12d7d2){if(_0x12d7d2){return _0x17e01b[_0x092f('0x16')](_0x22bb62);}return _0x17e01b[_0x092f('0x17')](_0x22bb62)[_0x092f('0x18')]();};}function respondWithResult(_0x3c0127,_0x11886e){_0x11886e=_0x11886e||0xc8;return function(_0x47f90f){if(_0x47f90f){return _0x3c0127[_0x092f('0x17')](_0x11886e)['json'](_0x47f90f);}};}function respondWithFilteredResult(_0x13ce74,_0x5b8f25){return function(_0x5f33d9){if(_0x5f33d9){var _0x140d64=typeof _0x5b8f25[_0x092f('0x19')]===_0x092f('0x1a')&&typeof _0x5b8f25[_0x092f('0x1b')]==='undefined';var _0x50f17=_0x5f33d9[_0x092f('0x1c')];var _0x56e52b=_0x140d64?0x0:_0x5b8f25[_0x092f('0x19')];var _0xc76e29=_0x140d64?_0x5f33d9[_0x092f('0x1c')]:_0x5b8f25['offset']+_0x5b8f25[_0x092f('0x1b')];var _0x32d49d;if(_0xc76e29>=_0x50f17){_0xc76e29=_0x50f17;_0x32d49d=0xc8;}else{_0x32d49d=0xce;}_0x13ce74['status'](_0x32d49d);return _0x13ce74[_0x092f('0x1d')]('Content-Range',_0x56e52b+'-'+_0xc76e29+'/'+_0x50f17)['json'](_0x5f33d9);}return null;};}function patchUpdates(_0x3669d9){return function(_0x13c1ce){try{jsonpatch['apply'](_0x13c1ce,_0x3669d9,!![]);}catch(_0x393452){return BPromise['reject'](_0x393452);}return _0x13c1ce['save']();};}function saveUpdates(_0x1ad88c,_0x272933){return function(_0x7b8daa){if(_0x7b8daa){return _0x7b8daa[_0x092f('0x1e')](_0x1ad88c)[_0x092f('0x1f')](function(_0x1bee3d){return _0x1bee3d;});}return null;};}function removeEntity(_0x4537da,_0x2bb280){return function(_0x2f4029){if(_0x2f4029){return _0x2f4029[_0x092f('0x20')]()[_0x092f('0x1f')](function(){var _0x134948=_0x2f4029[_0x092f('0x21')]({'plain':!![]});var _0x3c779a=_0x092f('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c779a,'resourceId':_0x134948['id']}})['then'](function(){return _0x2f4029;});})[_0x092f('0x1f')](function(){_0x4537da[_0x092f('0x17')](0xcc)[_0x092f('0x18')]();});}};}function handleEntityNotFound(_0x4e74ab,_0x2e1285){return function(_0x4aa9f3){if(!_0x4aa9f3){_0x4e74ab[_0x092f('0x16')](0x194);}return _0x4aa9f3;};}function handleError(_0x3aaec7,_0x16f074){_0x16f074=_0x16f074||0x1f4;return function(_0x2e9e84){logger[_0x092f('0x23')](_0x2e9e84[_0x092f('0x24')]);if(_0x2e9e84[_0x092f('0x25')]){delete _0x2e9e84[_0x092f('0x25')];}_0x3aaec7[_0x092f('0x17')](_0x16f074)['send'](_0x2e9e84);};}exports[_0x092f('0x26')]=function(_0x27fcb7,_0x37d9f1){var _0x13caf3={},_0x4f38e9={},_0x55d13d={'count':0x0,'rows':[]};var _0x44e1b2=_[_0x092f('0x27')](db['CannedAnswer'][_0x092f('0x28')],function(_0x9e8046){return{'name':_0x9e8046[_0x092f('0x29')],'type':_0x9e8046['type']['key']};});_0x4f38e9[_0x092f('0x2a')]=_[_0x092f('0x27')](_0x44e1b2,_0x092f('0x25'));_0x4f38e9[_0x092f('0x2b')]=_[_0x092f('0x2c')](_0x27fcb7[_0x092f('0x2b')]);_0x4f38e9['filters']=_[_0x092f('0x2d')](_0x4f38e9['model'],_0x4f38e9[_0x092f('0x2b')]);_0x13caf3['attributes']=_[_0x092f('0x2d')](_0x4f38e9[_0x092f('0x2a')],qs[_0x092f('0x2e')](_0x27fcb7[_0x092f('0x2b')][_0x092f('0x2e')]));_0x13caf3[_0x092f('0x2f')]=_0x13caf3[_0x092f('0x2f')]['length']?_0x13caf3[_0x092f('0x2f')]:_0x4f38e9['model'];if(!_0x27fcb7[_0x092f('0x2b')][_0x092f('0x30')](_0x092f('0x31'))){_0x13caf3[_0x092f('0x1b')]=qs['limit'](_0x27fcb7['query']['limit']);_0x13caf3[_0x092f('0x19')]=qs[_0x092f('0x19')](_0x27fcb7[_0x092f('0x2b')][_0x092f('0x19')]);}_0x13caf3[_0x092f('0x32')]=qs['sort'](_0x27fcb7[_0x092f('0x2b')][_0x092f('0x33')]);_0x13caf3[_0x092f('0x34')]=qs[_0x092f('0x35')](_[_0x092f('0x36')](_0x27fcb7[_0x092f('0x2b')],_0x4f38e9[_0x092f('0x35')]),_0x44e1b2);if(_0x27fcb7['query'][_0x092f('0x37')]){_0x13caf3[_0x092f('0x34')]=_[_0x092f('0x38')](_0x13caf3[_0x092f('0x34')],{'$or':[{'key':{'$like':'%'+_0x27fcb7[_0x092f('0x2b')][_0x092f('0x37')]+'%'}},{'value':{'$like':'%'+_0x27fcb7['query'][_0x092f('0x37')]+'%'}}]});}_0x13caf3=_['merge']({},_0x13caf3,_0x27fcb7[_0x092f('0x39')]);var _0x2108ff={'where':_0x13caf3['where']};return db[_0x092f('0x3a')][_0x092f('0x1c')](_0x2108ff)[_0x092f('0x1f')](function(_0x34af2e){_0x55d13d[_0x092f('0x1c')]=_0x34af2e;if(_0x27fcb7[_0x092f('0x2b')][_0x092f('0x3b')]){_0x13caf3[_0x092f('0x3c')]=[{'all':!![]}];}return db[_0x092f('0x3a')][_0x092f('0x3d')](_0x13caf3);})[_0x092f('0x1f')](function(_0x5534af){_0x55d13d[_0x092f('0x3e')]=_0x5534af;return _0x55d13d;})[_0x092f('0x1f')](respondWithFilteredResult(_0x37d9f1,_0x13caf3))['catch'](handleError(_0x37d9f1,null));};exports[_0x092f('0x3f')]=function(_0x8092ee,_0x7a6ed2){var _0xa48d9c={'raw':!![],'where':{'id':_0x8092ee[_0x092f('0x40')]['id']}},_0x5880c2={};_0x5880c2['model']=_[_0x092f('0x2c')](db[_0x092f('0x3a')]['rawAttributes']);_0x5880c2[_0x092f('0x2b')]=_['keys'](_0x8092ee[_0x092f('0x2b')]);_0x5880c2[_0x092f('0x35')]=_['intersection'](_0x5880c2[_0x092f('0x2a')],_0x5880c2['query']);_0xa48d9c['attributes']=_['intersection'](_0x5880c2[_0x092f('0x2a')],qs['fields'](_0x8092ee['query'][_0x092f('0x2e')]));_0xa48d9c[_0x092f('0x2f')]=_0xa48d9c[_0x092f('0x2f')][_0x092f('0x41')]?_0xa48d9c[_0x092f('0x2f')]:_0x5880c2['model'];if(_0x8092ee[_0x092f('0x2b')][_0x092f('0x3b')]){_0xa48d9c[_0x092f('0x3c')]=[{'all':!![]}];}_0xa48d9c=_[_0x092f('0x38')]({},_0xa48d9c,_0x8092ee[_0x092f('0x39')]);return db[_0x092f('0x3a')][_0x092f('0x42')](_0xa48d9c)[_0x092f('0x1f')](handleEntityNotFound(_0x7a6ed2,null))[_0x092f('0x1f')](respondWithResult(_0x7a6ed2,null))[_0x092f('0x43')](handleError(_0x7a6ed2,null));};exports[_0x092f('0x1e')]=function(_0x2e348e,_0x6ee1d0){if(_0x2e348e[_0x092f('0x44')]['id']){delete _0x2e348e[_0x092f('0x44')]['id'];}return db[_0x092f('0x3a')]['find']({'where':{'id':_0x2e348e[_0x092f('0x40')]['id']}})[_0x092f('0x1f')](handleEntityNotFound(_0x6ee1d0,null))[_0x092f('0x1f')](saveUpdates(_0x2e348e[_0x092f('0x44')],null))[_0x092f('0x1f')](respondWithResult(_0x6ee1d0,null))[_0x092f('0x43')](handleError(_0x6ee1d0,null));};exports[_0x092f('0x20')]=function(_0x38a300,_0x14c523){return db[_0x092f('0x3a')][_0x092f('0x42')]({'where':{'id':_0x38a300['params']['id']}})[_0x092f('0x1f')](handleEntityNotFound(_0x14c523,null))[_0x092f('0x1f')](removeEntity(_0x14c523,null))['catch'](handleError(_0x14c523,null));};exports[_0x092f('0x45')]=function(_0x1399db,_0x3a03e7){var _0x1a5247={'key':_0x1399db[_0x092f('0x44')][_0x092f('0x46')]};if(_0x1399db[_0x092f('0x44')][_0x092f('0x47')]){_0x1a5247[_0x092f('0x47')]=_0x1399db['body'][_0x092f('0x47')];}else if(_0x1399db[_0x092f('0x44')]['SmsAccountId']){_0x1a5247[_0x092f('0x48')]=_0x1399db[_0x092f('0x44')]['SmsAccountId'];}else if(_0x1399db[_0x092f('0x44')][_0x092f('0x49')]){_0x1a5247[_0x092f('0x49')]=_0x1399db[_0x092f('0x44')][_0x092f('0x49')];}else if(_0x1399db[_0x092f('0x44')][_0x092f('0x4a')]){_0x1a5247[_0x092f('0x4a')]=_0x1399db[_0x092f('0x44')][_0x092f('0x4a')];}return db[_0x092f('0x3a')]['find']({'where':_0x1a5247})['then'](function(_0x5268e9){if(_0x5268e9){throw new db[(_0x092f('0x4b'))][(_0x092f('0x4c'))](_0x092f('0x4d'));}return db[_0x092f('0x3a')]['create'](_0x1399db[_0x092f('0x44')]);})[_0x092f('0x1f')](function(_0x2e8923){var _0x983623=_0x1399db['user'][_0x092f('0x21')]({'plain':!![]});if(!_0x983623)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x983623[_0x092f('0x4e')]===_0x092f('0x4f')){var _0x11be75=_0x2e8923[_0x092f('0x21')]({'plain':!![]});return db['UserProfileSection'][_0x092f('0x42')]({'where':{'name':_0x092f('0x22'),'userProfileId':_0x983623['userProfileId']},'raw':!![]})['then'](function(_0x20fa71){if(_0x20fa71&&_0x20fa71['autoAssociation']===0x0){return db[_0x092f('0x50')]['create']({'name':_0x11be75['name'],'resourceId':_0x11be75['id'],'type':_0x20fa71[_0x092f('0x25')],'sectionId':_0x20fa71['id']},{})[_0x092f('0x1f')](function(){return _0x2e8923;});}else{return _0x2e8923;}})[_0x092f('0x43')](function(_0x4bb668){logger[_0x092f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bb668);throw _0x4bb668;});}return _0x2e8923;})['then'](respondWithResult(_0x3a03e7,0xc9))[_0x092f('0x43')](handleError(_0x3a03e7,null));}; \ No newline at end of file +var _0x244b=['count','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit'];(function(_0x25b12d,_0x1551e9){var _0x5c38bb=function(_0x4867e1){while(--_0x4867e1){_0x25b12d['push'](_0x25b12d['shift']());}};_0x5c38bb(++_0x1551e9);}(_0x244b,0x12d));var _0xb244=function(_0x3c7605,_0x16de37){_0x3c7605=_0x3c7605-0x0;var _0x2a12ba=_0x244b[_0x3c7605];return _0x2a12ba;};'use strict';var emlformat=require(_0xb244('0x0'));var rimraf=require(_0xb244('0x1'));var zipdir=require(_0xb244('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb244('0x3'));var moment=require('moment');var BPromise=require(_0xb244('0x4'));var Mustache=require(_0xb244('0x5'));var util=require('util');var path=require(_0xb244('0x6'));var sox=require(_0xb244('0x7'));var csv=require('to-csv');var ejs=require(_0xb244('0x8'));var fs=require('fs');var fs_extra=require(_0xb244('0x9'));var _=require(_0xb244('0xa'));var squel=require(_0xb244('0xb'));var crypto=require('crypto');var jsforce=require(_0xb244('0xc'));var deskjs=require(_0xb244('0xd'));var toCsv=require(_0xb244('0xe'));var querystring=require(_0xb244('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb244('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb244('0x11'));var hardwareService=require(_0xb244('0x12'));var logger=require('../../config/logger')(_0xb244('0x13'));var utils=require(_0xb244('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb244('0x15'));var db=require(_0xb244('0x16'))['db'];function respondWithStatusCode(_0x283050,_0x600fce){_0x600fce=_0x600fce||0xcc;return function(_0x2e13a7){if(_0x2e13a7){return _0x283050['sendStatus'](_0x600fce);}return _0x283050[_0xb244('0x17')](_0x600fce)[_0xb244('0x18')]();};}function respondWithResult(_0x534e15,_0x333d44){_0x333d44=_0x333d44||0xc8;return function(_0x1e0f43){if(_0x1e0f43){return _0x534e15[_0xb244('0x17')](_0x333d44)['json'](_0x1e0f43);}};}function respondWithFilteredResult(_0x4d052b,_0x2ae6e4){return function(_0x558c83){if(_0x558c83){var _0x1622cb=typeof _0x2ae6e4[_0xb244('0x19')]==='undefined'&&typeof _0x2ae6e4[_0xb244('0x1a')]==='undefined';var _0x43b910=_0x558c83['count'];var _0x2b5799=_0x1622cb?0x0:_0x2ae6e4[_0xb244('0x19')];var _0x5b23c5=_0x1622cb?_0x558c83[_0xb244('0x1b')]:_0x2ae6e4['offset']+_0x2ae6e4[_0xb244('0x1a')];var _0x5c6fce;if(_0x5b23c5>=_0x43b910){_0x5b23c5=_0x43b910;_0x5c6fce=0xc8;}else{_0x5c6fce=0xce;}_0x4d052b[_0xb244('0x17')](_0x5c6fce);return _0x4d052b[_0xb244('0x1c')](_0xb244('0x1d'),_0x2b5799+'-'+_0x5b23c5+'/'+_0x43b910)['json'](_0x558c83);}return null;};}function patchUpdates(_0x3ce98a){return function(_0x647fd7){try{jsonpatch[_0xb244('0x1e')](_0x647fd7,_0x3ce98a,!![]);}catch(_0x46ede3){return BPromise[_0xb244('0x1f')](_0x46ede3);}return _0x647fd7['save']();};}function saveUpdates(_0x3c1a44,_0x4a9fd9){return function(_0x885ec2){if(_0x885ec2){return _0x885ec2['update'](_0x3c1a44)[_0xb244('0x20')](function(_0x18283b){return _0x18283b;});}return null;};}function removeEntity(_0x369c50,_0x1542ab){return function(_0x3fdbb0){if(_0x3fdbb0){return _0x3fdbb0[_0xb244('0x21')]()[_0xb244('0x20')](function(){var _0x718873=_0x3fdbb0[_0xb244('0x22')]({'plain':!![]});var _0xa77a34=_0xb244('0x23');return db[_0xb244('0x24')]['destroy']({'where':{'type':_0xa77a34,'resourceId':_0x718873['id']}})[_0xb244('0x20')](function(){return _0x3fdbb0;});})[_0xb244('0x20')](function(){_0x369c50[_0xb244('0x17')](0xcc)[_0xb244('0x18')]();});}};}function handleEntityNotFound(_0x2db535,_0x3f63a0){return function(_0x539611){if(!_0x539611){_0x2db535['sendStatus'](0x194);}return _0x539611;};}function handleError(_0x5f4676,_0x20308b){_0x20308b=_0x20308b||0x1f4;return function(_0x2f900e){logger[_0xb244('0x25')](_0x2f900e['stack']);if(_0x2f900e[_0xb244('0x26')]){delete _0x2f900e['name'];}_0x5f4676['status'](_0x20308b)['send'](_0x2f900e);};}exports[_0xb244('0x27')]=function(_0x50eb37,_0x3f7bad){var _0x5d3d48={},_0x4b300a={},_0x1ae98d={'count':0x0,'rows':[]};var _0xd4e901=_[_0xb244('0x28')](db[_0xb244('0x29')][_0xb244('0x2a')],function(_0x2f82d0){return{'name':_0x2f82d0[_0xb244('0x2b')],'type':_0x2f82d0[_0xb244('0x2c')][_0xb244('0x2d')]};});_0x4b300a[_0xb244('0x2e')]=_[_0xb244('0x28')](_0xd4e901,_0xb244('0x26'));_0x4b300a[_0xb244('0x2f')]=_[_0xb244('0x30')](_0x50eb37[_0xb244('0x2f')]);_0x4b300a[_0xb244('0x31')]=_[_0xb244('0x32')](_0x4b300a[_0xb244('0x2e')],_0x4b300a[_0xb244('0x2f')]);_0x5d3d48['attributes']=_[_0xb244('0x32')](_0x4b300a[_0xb244('0x2e')],qs[_0xb244('0x33')](_0x50eb37[_0xb244('0x2f')]['fields']));_0x5d3d48[_0xb244('0x34')]=_0x5d3d48['attributes']['length']?_0x5d3d48[_0xb244('0x34')]:_0x4b300a['model'];if(!_0x50eb37[_0xb244('0x2f')][_0xb244('0x35')](_0xb244('0x36'))){_0x5d3d48[_0xb244('0x1a')]=qs[_0xb244('0x1a')](_0x50eb37[_0xb244('0x2f')][_0xb244('0x1a')]);_0x5d3d48[_0xb244('0x19')]=qs[_0xb244('0x19')](_0x50eb37[_0xb244('0x2f')]['offset']);}_0x5d3d48[_0xb244('0x37')]=qs[_0xb244('0x38')](_0x50eb37[_0xb244('0x2f')][_0xb244('0x38')]);_0x5d3d48[_0xb244('0x39')]=qs[_0xb244('0x31')](_['pick'](_0x50eb37[_0xb244('0x2f')],_0x4b300a[_0xb244('0x31')]),_0xd4e901);if(_0x50eb37['query'][_0xb244('0x3a')]){_0x5d3d48[_0xb244('0x39')]=_[_0xb244('0x3b')](_0x5d3d48['where'],{'$or':[{'key':{'$like':'%'+_0x50eb37[_0xb244('0x2f')][_0xb244('0x3a')]+'%'}},{'value':{'$like':'%'+_0x50eb37[_0xb244('0x2f')][_0xb244('0x3a')]+'%'}}]});}_0x5d3d48=_[_0xb244('0x3b')]({},_0x5d3d48,_0x50eb37[_0xb244('0x3c')]);var _0x155416={'where':_0x5d3d48[_0xb244('0x39')]};return db[_0xb244('0x29')][_0xb244('0x1b')](_0x155416)['then'](function(_0x4a11d1){_0x1ae98d[_0xb244('0x1b')]=_0x4a11d1;if(_0x50eb37[_0xb244('0x2f')][_0xb244('0x3d')]){_0x5d3d48[_0xb244('0x3e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5d3d48);})[_0xb244('0x20')](function(_0x2e56d8){_0x1ae98d[_0xb244('0x3f')]=_0x2e56d8;return _0x1ae98d;})['then'](respondWithFilteredResult(_0x3f7bad,_0x5d3d48))[_0xb244('0x40')](handleError(_0x3f7bad,null));};exports['show']=function(_0x5acac2,_0x5a195d){var _0x4141c6={'raw':!![],'where':{'id':_0x5acac2[_0xb244('0x41')]['id']}},_0x3d406a={};_0x3d406a[_0xb244('0x2e')]=_[_0xb244('0x30')](db['CannedAnswer'][_0xb244('0x2a')]);_0x3d406a['query']=_[_0xb244('0x30')](_0x5acac2[_0xb244('0x2f')]);_0x3d406a[_0xb244('0x31')]=_[_0xb244('0x32')](_0x3d406a['model'],_0x3d406a[_0xb244('0x2f')]);_0x4141c6[_0xb244('0x34')]=_[_0xb244('0x32')](_0x3d406a['model'],qs[_0xb244('0x33')](_0x5acac2[_0xb244('0x2f')][_0xb244('0x33')]));_0x4141c6[_0xb244('0x34')]=_0x4141c6[_0xb244('0x34')][_0xb244('0x42')]?_0x4141c6['attributes']:_0x3d406a[_0xb244('0x2e')];if(_0x5acac2[_0xb244('0x2f')][_0xb244('0x3d')]){_0x4141c6[_0xb244('0x3e')]=[{'all':!![]}];}_0x4141c6=_['merge']({},_0x4141c6,_0x5acac2[_0xb244('0x3c')]);return db[_0xb244('0x29')][_0xb244('0x43')](_0x4141c6)[_0xb244('0x20')](handleEntityNotFound(_0x5a195d,null))['then'](respondWithResult(_0x5a195d,null))[_0xb244('0x40')](handleError(_0x5a195d,null));};exports[_0xb244('0x44')]=function(_0x18d9f6,_0x203678){if(_0x18d9f6[_0xb244('0x45')]['id']){delete _0x18d9f6[_0xb244('0x45')]['id'];}return db['CannedAnswer'][_0xb244('0x43')]({'where':{'id':_0x18d9f6[_0xb244('0x41')]['id']}})['then'](handleEntityNotFound(_0x203678,null))['then'](saveUpdates(_0x18d9f6[_0xb244('0x45')],null))[_0xb244('0x20')](respondWithResult(_0x203678,null))[_0xb244('0x40')](handleError(_0x203678,null));};exports[_0xb244('0x21')]=function(_0x5562cf,_0x18e538){return db['CannedAnswer'][_0xb244('0x43')]({'where':{'id':_0x5562cf['params']['id']}})['then'](handleEntityNotFound(_0x18e538,null))[_0xb244('0x20')](removeEntity(_0x18e538,null))[_0xb244('0x40')](handleError(_0x18e538,null));};exports[_0xb244('0x46')]=function(_0x109ccf,_0x528bf2){var _0xde6fb8={'key':_0x109ccf[_0xb244('0x45')][_0xb244('0x2d')]};if(_0x109ccf[_0xb244('0x45')][_0xb244('0x47')]){_0xde6fb8[_0xb244('0x47')]=_0x109ccf[_0xb244('0x45')][_0xb244('0x47')];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x48')]){_0xde6fb8['SmsAccountId']=_0x109ccf[_0xb244('0x45')]['SmsAccountId'];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x49')]){_0xde6fb8[_0xb244('0x49')]=_0x109ccf[_0xb244('0x45')]['OpenchannelAccountId'];}else if(_0x109ccf[_0xb244('0x45')][_0xb244('0x4a')]){_0xde6fb8[_0xb244('0x4a')]=_0x109ccf['body'][_0xb244('0x4a')];}return db[_0xb244('0x29')][_0xb244('0x43')]({'where':_0xde6fb8})[_0xb244('0x20')](function(_0x23ad14){if(_0x23ad14){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xb244('0x46')](_0x109ccf[_0xb244('0x45')]);})[_0xb244('0x20')](function(_0x245e54){var _0x4fc916=_0x109ccf['user'][_0xb244('0x22')]({'plain':!![]});if(!_0x4fc916)throw new Error(_0xb244('0x4b'));if(_0x4fc916[_0xb244('0x4c')]===_0xb244('0x4d')){var _0x1b0f56=_0x245e54[_0xb244('0x22')]({'plain':!![]});return db[_0xb244('0x4e')][_0xb244('0x43')]({'where':{'name':'CannedAnswers','userProfileId':_0x4fc916[_0xb244('0x4f')]},'raw':!![]})[_0xb244('0x20')](function(_0x37190){if(_0x37190&&_0x37190[_0xb244('0x50')]===0x0){return db[_0xb244('0x24')][_0xb244('0x46')]({'name':_0x1b0f56[_0xb244('0x26')],'resourceId':_0x1b0f56['id'],'type':_0x37190[_0xb244('0x26')],'sectionId':_0x37190['id']},{})[_0xb244('0x20')](function(){return _0x245e54;});}else{return _0x245e54;}})[_0xb244('0x40')](function(_0x5dc07e){logger['error'](_0xb244('0x51'),_0x5dc07e);throw _0x5dc07e;});}return _0x245e54;})['then'](respondWithResult(_0x528bf2,0xc9))[_0xb244('0x40')](handleError(_0x528bf2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 09bce9c..efa8d62 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 _0x1410=['moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','api'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x1410,0x19e));var _0x0141=function(_0x4483bb,_0x4cae9e){_0x4483bb=_0x4483bb-0x0;var _0xd930aa=_0x1410[_0x4483bb];return _0xd930aa;};'use strict';var _=require(_0x0141('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rp=require(_0x0141('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0141('0x5'));var config=require(_0x0141('0x6'));var attributes=require(_0x0141('0x7'));module[_0x0141('0x8')]=function(_0x440fdb,_0x22db1d){return _0x440fdb[_0x0141('0x9')](_0x0141('0xa'),attributes,{'tableName':_0x0141('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0141('0xc')});}; \ No newline at end of file +var _0x5228=['request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x5228,0xcc));var _0x8522=function(_0x23427e,_0x3309f3){_0x23427e=_0x23427e-0x0;var _0x414ba3=_0x5228[_0x23427e];return _0x414ba3;};'use strict';var _=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var logger=require(_0x8522('0x2'))(_0x8522('0x3'));var moment=require(_0x8522('0x4'));var BPromise=require(_0x8522('0x5'));var rp=require(_0x8522('0x6'));var fs=require('fs');var path=require(_0x8522('0x7'));var rimraf=require('rimraf');var config=require(_0x8522('0x8'));var attributes=require(_0x8522('0x9'));module[_0x8522('0xa')]=function(_0x11d5fe,_0x53d658){return _0x11d5fe[_0x8522('0xb')](_0x8522('0xc'),attributes,{'tableName':_0x8522('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8522('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index db9456c..ca6a166 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 _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\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(_0x2bcc97,_0x32f0b3){var _0x19075f=function(_0x1e7a86){while(--_0x1e7a86){_0x2bcc97['push'](_0x2bcc97['shift']());}};_0x19075f(++_0x32f0b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\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(_0xc25d,_0x9ec289){var _0x3aa213=function(_0x404f5f){while(--_0x404f5f){_0xc25d['push'](_0xc25d['shift']());}};_0x3aa213(++_0x9ec289);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 5c9d97d..ad5c776 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 _0x380c=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x36e508,_0x5002e7){var _0x191e46=function(_0xf8d2a2){while(--_0xf8d2a2){_0x36e508['push'](_0x36e508['shift']());}};_0x191e46(++_0x5002e7);}(_0x380c,0xc3));var _0xc380=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x380c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xc380('0x0'));var util=require(_0xc380('0x1'));var path=require(_0xc380('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc380('0x3'));var auth=require(_0xc380('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc380('0x5'));var controller=require('./cannedAnswer.controller');router[_0xc380('0x6')]('/',auth[_0xc380('0x7')](),controller[_0xc380('0x8')]);router[_0xc380('0x6')](_0xc380('0x9'),auth[_0xc380('0x7')](),controller[_0xc380('0xa')]);router[_0xc380('0xb')]('/',auth[_0xc380('0x7')](),controller['create']);router[_0xc380('0xc')](_0xc380('0x9'),auth[_0xc380('0x7')](),controller[_0xc380('0xd')]);router[_0xc380('0xe')](_0xc380('0x9'),auth['isAuthenticated'](),controller[_0xc380('0xf')]);module[_0xc380('0x10')]=router; \ No newline at end of file +var _0x5574=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','create','put','/:id'];(function(_0x2894e1,_0x46e6a0){var _0x5df491=function(_0x1eb4c2){while(--_0x1eb4c2){_0x2894e1['push'](_0x2894e1['shift']());}};_0x5df491(++_0x46e6a0);}(_0x5574,0xaa));var _0x4557=function(_0x439c35,_0x552da7){_0x439c35=_0x439c35-0x0;var _0xd68b45=_0x5574[_0x439c35];return _0xd68b45;};'use strict';var multer=require('multer');var util=require(_0x4557('0x0'));var path=require('path');var timeout=require(_0x4557('0x1'));var express=require(_0x4557('0x2'));var router=express[_0x4557('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4557('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4557('0x5'));var controller=require(_0x4557('0x6'));router['get']('/',auth[_0x4557('0x7')](),controller['index']);router[_0x4557('0x8')]('/:id',auth[_0x4557('0x7')](),controller['show']);router['post']('/',auth[_0x4557('0x7')](),controller[_0x4557('0x9')]);router[_0x4557('0xa')](_0x4557('0xb'),auth[_0x4557('0x7')](),controller['update']);router[_0x4557('0xc')](_0x4557('0xb'),auth[_0x4557('0x7')](),controller[_0x4557('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4315e35..ea61d5b 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 _0x1ba2=['sequelize','DATE','STRING','INTEGER'];(function(_0x11fa58,_0x9cdf4c){var _0x5c23c1=function(_0x24ec43){while(--_0x24ec43){_0x11fa58['push'](_0x11fa58['shift']());}};_0x5c23c1(++_0x9cdf4c);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x21ba('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x21ba('0x2')]},'src':{'type':Sequelize[_0x21ba('0x2')]},'dst':{'type':Sequelize[_0x21ba('0x2')]},'dcontext':{'type':Sequelize[_0x21ba('0x2')]},'channel':{'type':Sequelize[_0x21ba('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x21ba('0x2')]},'lastdata':{'type':Sequelize[_0x21ba('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x21ba('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x21ba('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x21ba('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x21ba('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x21ba('0x2')]},'peeraccount':{'type':Sequelize[_0x21ba('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x21ba('0x2')]}}; \ No newline at end of file +var _0xb584=['STRING','INTEGER','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb584,0x1c1));var _0x4b58=function(_0x3c7c71,_0x9c0c2){_0x3c7c71=_0x3c7c71-0x0;var _0x516df7=_0xb584[_0x3c7c71];return _0x516df7;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x4b58('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x4b58('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4b58('0x1')]},'dcontext':{'type':Sequelize[_0x4b58('0x1')]},'channel':{'type':Sequelize[_0x4b58('0x1')]},'dstchannel':{'type':Sequelize[_0x4b58('0x1')]},'lastapp':{'type':Sequelize[_0x4b58('0x1')]},'lastdata':{'type':Sequelize[_0x4b58('0x1')]},'duration':{'type':Sequelize[_0x4b58('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4b58('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4b58('0x1')]},'userfield':{'type':Sequelize[_0x4b58('0x1')]},'uniqueid':{'type':Sequelize[_0x4b58('0x1')]},'linkedid':{'type':Sequelize[_0x4b58('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4b58('0x1')]},'type':{'type':Sequelize[_0x4b58('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 25ef2e8..312c16c 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 _0xfc17=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x3c38a9,_0x571fe7){var _0x36f44b=function(_0x1c5278){while(--_0x1c5278){_0x3c38a9['push'](_0x3c38a9['shift']());}};_0x36f44b(++_0x571fe7);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x47c885,_0x59e51d){_0x47c885=_0x47c885-0x0;var _0x321443=_0xfc17[_0x47c885];return _0x321443;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];function respondWithStatusCode(_0x53277f,_0x3a7c8e){_0x3a7c8e=_0x3a7c8e||0xcc;return function(_0x902325){if(_0x902325){return _0x53277f[_0x7fc1('0x1b')](_0x3a7c8e);}return _0x53277f[_0x7fc1('0x1c')](_0x3a7c8e)[_0x7fc1('0x1d')]();};}function respondWithResult(_0x5651f2,_0x54a204){_0x54a204=_0x54a204||0xc8;return function(_0x881462){if(_0x881462){return _0x5651f2[_0x7fc1('0x1c')](_0x54a204)[_0x7fc1('0x1e')](_0x881462);}};}function respondWithFilteredResult(_0x391de7,_0x432825){return function(_0x3c4671){if(_0x3c4671){var _0x3d8e82=typeof _0x432825[_0x7fc1('0x1f')]===_0x7fc1('0x20')&&typeof _0x432825[_0x7fc1('0x21')]==='undefined';var _0x419170=_0x3c4671['count'];var _0x30fc04=_0x3d8e82?0x0:_0x432825[_0x7fc1('0x1f')];var _0x535ae1=_0x3d8e82?_0x3c4671[_0x7fc1('0x22')]:_0x432825[_0x7fc1('0x1f')]+_0x432825['limit'];var _0x25d384;if(_0x535ae1>=_0x419170){_0x535ae1=_0x419170;_0x25d384=0xc8;}else{_0x25d384=0xce;}_0x391de7[_0x7fc1('0x1c')](_0x25d384);return _0x391de7[_0x7fc1('0x23')](_0x7fc1('0x24'),_0x30fc04+'-'+_0x535ae1+'/'+_0x419170)[_0x7fc1('0x1e')](_0x3c4671);}return null;};}function patchUpdates(_0x1c249d){return function(_0x3e7c92){try{jsonpatch[_0x7fc1('0x25')](_0x3e7c92,_0x1c249d,!![]);}catch(_0x327569){return BPromise[_0x7fc1('0x26')](_0x327569);}return _0x3e7c92['save']();};}function saveUpdates(_0x49a44f,_0x2390b8){return function(_0x5e10cd){if(_0x5e10cd){return _0x5e10cd[_0x7fc1('0x27')](_0x49a44f)[_0x7fc1('0x28')](function(_0x253ae9){return _0x253ae9;});}return null;};}function removeEntity(_0x3683f4,_0x56c5d6){return function(_0x38b5b5){if(_0x38b5b5){return _0x38b5b5[_0x7fc1('0x29')]()[_0x7fc1('0x28')](function(){_0x3683f4['status'](0xcc)[_0x7fc1('0x1d')]();});}};}function handleEntityNotFound(_0x252b18,_0x5ddc11){return function(_0x4b24d6){if(!_0x4b24d6){_0x252b18[_0x7fc1('0x1b')](0x194);}return _0x4b24d6;};}function handleError(_0x293a2a,_0x1f58ca){_0x1f58ca=_0x1f58ca||0x1f4;return function(_0x2ae7db){logger['error'](_0x2ae7db[_0x7fc1('0x2a')]);if(_0x2ae7db[_0x7fc1('0x2b')]){delete _0x2ae7db[_0x7fc1('0x2b')];}_0x293a2a[_0x7fc1('0x1c')](_0x1f58ca)['send'](_0x2ae7db);};}exports[_0x7fc1('0x2c')]=function(_0x583e60,_0x1f7fce){var _0x22a3c1={},_0x34ec70={},_0x231913={'count':0x0,'rows':[]};var _0x2317f5=_['map'](db[_0x7fc1('0x2d')]['rawAttributes'],function(_0x55b4f1){return{'name':_0x55b4f1[_0x7fc1('0x2e')],'type':_0x55b4f1[_0x7fc1('0x2f')][_0x7fc1('0x30')]};});_0x34ec70[_0x7fc1('0x31')]=_[_0x7fc1('0x32')](_0x2317f5,_0x7fc1('0x2b'));_0x34ec70[_0x7fc1('0x33')]=_[_0x7fc1('0x34')](_0x583e60[_0x7fc1('0x33')]);_0x34ec70[_0x7fc1('0x35')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],_0x34ec70[_0x7fc1('0x33')]);_0x22a3c1[_0x7fc1('0x37')]=_[_0x7fc1('0x36')](_0x34ec70[_0x7fc1('0x31')],qs['fields'](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x22a3c1[_0x7fc1('0x37')]=_0x22a3c1[_0x7fc1('0x37')][_0x7fc1('0x39')]?_0x22a3c1[_0x7fc1('0x37')]:_0x34ec70['model'];if(!_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3a')]('nolimit')){_0x22a3c1[_0x7fc1('0x21')]=qs[_0x7fc1('0x21')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x21')]);_0x22a3c1[_0x7fc1('0x1f')]=qs['offset'](_0x583e60['query'][_0x7fc1('0x1f')]);}_0x22a3c1[_0x7fc1('0x3b')]=qs[_0x7fc1('0x3c')](_0x583e60[_0x7fc1('0x33')][_0x7fc1('0x3c')]);_0x22a3c1[_0x7fc1('0x3d')]=qs[_0x7fc1('0x35')](_[_0x7fc1('0x3e')](_0x583e60['query'],_0x34ec70[_0x7fc1('0x35')]),_0x2317f5);if(_0x583e60[_0x7fc1('0x33')]['filter']){_0x22a3c1[_0x7fc1('0x3d')]=_[_0x7fc1('0x3f')](_0x22a3c1[_0x7fc1('0x3d')],{'$or':_['map'](_0x2317f5,function(_0x57ef4c){if(_0x57ef4c[_0x7fc1('0x2f')]!==_0x7fc1('0x40')){var _0xafc8b0={};_0xafc8b0[_0x57ef4c['name']]={'$like':'%'+_0x583e60['query']['filter']+'%'};return _0xafc8b0;}})});}_0x22a3c1=_[_0x7fc1('0x3f')]({},_0x22a3c1,_0x583e60[_0x7fc1('0x41')]);var _0x32607c={'where':_0x22a3c1[_0x7fc1('0x3d')]};return db['Cdr']['count'](_0x32607c)[_0x7fc1('0x28')](function(_0xf26d98){_0x231913[_0x7fc1('0x22')]=_0xf26d98;if(_0x583e60['query']['includeAll']){_0x22a3c1['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x22a3c1);})[_0x7fc1('0x28')](function(_0x54749f){_0x231913[_0x7fc1('0x42')]=_0x54749f;return _0x231913;})[_0x7fc1('0x28')](respondWithFilteredResult(_0x1f7fce,_0x22a3c1))['catch'](handleError(_0x1f7fce,null));};exports[_0x7fc1('0x43')]=function(_0x16ad03,_0x111d51){var _0x3282dd={'raw':!![],'where':{'id':_0x16ad03[_0x7fc1('0x44')]['id']}},_0x56b853={};_0x56b853['model']=_[_0x7fc1('0x34')](db[_0x7fc1('0x2d')][_0x7fc1('0x45')]);_0x56b853[_0x7fc1('0x33')]=_['keys'](_0x16ad03[_0x7fc1('0x33')]);_0x56b853[_0x7fc1('0x35')]=_['intersection'](_0x56b853[_0x7fc1('0x31')],_0x56b853[_0x7fc1('0x33')]);_0x3282dd['attributes']=_[_0x7fc1('0x36')](_0x56b853[_0x7fc1('0x31')],qs['fields'](_0x16ad03[_0x7fc1('0x33')][_0x7fc1('0x38')]));_0x3282dd[_0x7fc1('0x37')]=_0x3282dd['attributes'][_0x7fc1('0x39')]?_0x3282dd[_0x7fc1('0x37')]:_0x56b853[_0x7fc1('0x31')];if(_0x16ad03[_0x7fc1('0x33')]['includeAll']){_0x3282dd['include']=[{'all':!![]}];}_0x3282dd=_[_0x7fc1('0x3f')]({},_0x3282dd,_0x16ad03[_0x7fc1('0x41')]);return db[_0x7fc1('0x2d')][_0x7fc1('0x46')](_0x3282dd)[_0x7fc1('0x28')](handleEntityNotFound(_0x111d51,null))[_0x7fc1('0x28')](respondWithResult(_0x111d51,null))[_0x7fc1('0x47')](handleError(_0x111d51,null));};exports[_0x7fc1('0x48')]=function(_0x419ea1,_0x4c4606){return db['Cdr']['create'](_0x419ea1[_0x7fc1('0x49')],{})[_0x7fc1('0x28')](respondWithResult(_0x4c4606,0xc9))[_0x7fc1('0x47')](handleError(_0x4c4606,null));};exports[_0x7fc1('0x27')]=function(_0x4bcd63,_0xafd821){if(_0x4bcd63[_0x7fc1('0x49')]['id']){delete _0x4bcd63[_0x7fc1('0x49')]['id'];}return db[_0x7fc1('0x2d')]['find']({'where':{'id':_0x4bcd63[_0x7fc1('0x44')]['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0xafd821,null))[_0x7fc1('0x28')](saveUpdates(_0x4bcd63[_0x7fc1('0x49')],null))[_0x7fc1('0x28')](respondWithResult(_0xafd821,null))[_0x7fc1('0x47')](handleError(_0xafd821,null));};exports[_0x7fc1('0x29')]=function(_0x4d27db,_0x3d5f40){return db['Cdr'][_0x7fc1('0x46')]({'where':{'id':_0x4d27db['params']['id']}})[_0x7fc1('0x28')](handleEntityNotFound(_0x3d5f40,null))[_0x7fc1('0x28')](removeEntity(_0x3d5f40,null))['catch'](handleError(_0x3d5f40,null));};exports[_0x7fc1('0x4a')]=function(_0x3b492a,_0x509959){return db[_0x7fc1('0x2d')][_0x7fc1('0x4a')]()[_0x7fc1('0x28')](respondWithResult(_0x509959,null))[_0x7fc1('0x47')](handleError(_0x509959,null));}; \ No newline at end of file +var _0x24ca=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','update','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x21ee0e,_0x317447){var _0x3c180c=function(_0x1b3698){while(--_0x1b3698){_0x21ee0e['push'](_0x21ee0e['shift']());}};_0x3c180c(++_0x317447);}(_0x24ca,0x8c));var _0xa24c=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x24ca[_0x4bb145];return _0x4db596;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24c('0x1'));var rp=require('request-promise');var moment=require(_0xa24c('0x2'));var BPromise=require(_0xa24c('0x3'));var Mustache=require(_0xa24c('0x4'));var util=require('util');var path=require(_0xa24c('0x5'));var sox=require(_0xa24c('0x6'));var csv=require(_0xa24c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0x7'));var querystring=require(_0xa24c('0xc'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xd'));var authService=require(_0xa24c('0xe'));var qs=require(_0xa24c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x10'))(_0xa24c('0x11'));var utils=require(_0xa24c('0x12'));var config=require(_0xa24c('0x13'));var licenseUtil=require(_0xa24c('0x14'));var db=require(_0xa24c('0x15'))['db'];function respondWithStatusCode(_0x566313,_0x5bb631){_0x5bb631=_0x5bb631||0xcc;return function(_0x4907f6){if(_0x4907f6){return _0x566313[_0xa24c('0x16')](_0x5bb631);}return _0x566313[_0xa24c('0x17')](_0x5bb631)[_0xa24c('0x18')]();};}function respondWithResult(_0x9fe9e3,_0x4351a8){_0x4351a8=_0x4351a8||0xc8;return function(_0x4971af){if(_0x4971af){return _0x9fe9e3[_0xa24c('0x17')](_0x4351a8)['json'](_0x4971af);}};}function respondWithFilteredResult(_0x493bcb,_0x588acf){return function(_0x2e8dc9){if(_0x2e8dc9){var _0x2a4270=typeof _0x588acf[_0xa24c('0x19')]===_0xa24c('0x1a')&&typeof _0x588acf[_0xa24c('0x1b')]===_0xa24c('0x1a');var _0x2197da=_0x2e8dc9[_0xa24c('0x1c')];var _0x14f0aa=_0x2a4270?0x0:_0x588acf[_0xa24c('0x19')];var _0x1970fc=_0x2a4270?_0x2e8dc9[_0xa24c('0x1c')]:_0x588acf[_0xa24c('0x19')]+_0x588acf[_0xa24c('0x1b')];var _0x5276b6;if(_0x1970fc>=_0x2197da){_0x1970fc=_0x2197da;_0x5276b6=0xc8;}else{_0x5276b6=0xce;}_0x493bcb[_0xa24c('0x17')](_0x5276b6);return _0x493bcb['set'](_0xa24c('0x1d'),_0x14f0aa+'-'+_0x1970fc+'/'+_0x2197da)[_0xa24c('0x1e')](_0x2e8dc9);}return null;};}function patchUpdates(_0x8c3949){return function(_0x37e20e){try{jsonpatch[_0xa24c('0x1f')](_0x37e20e,_0x8c3949,!![]);}catch(_0x416dea){return BPromise[_0xa24c('0x20')](_0x416dea);}return _0x37e20e[_0xa24c('0x21')]();};}function saveUpdates(_0xba710,_0x2ec5ad){return function(_0x2b471a){if(_0x2b471a){return _0x2b471a['update'](_0xba710)['then'](function(_0x10fa25){return _0x10fa25;});}return null;};}function removeEntity(_0xdd32a8,_0x316a68){return function(_0x1a04ff){if(_0x1a04ff){return _0x1a04ff[_0xa24c('0x22')]()[_0xa24c('0x23')](function(){_0xdd32a8[_0xa24c('0x17')](0xcc)[_0xa24c('0x18')]();});}};}function handleEntityNotFound(_0x304d6c,_0x4dc3dc){return function(_0x2290e1){if(!_0x2290e1){_0x304d6c['sendStatus'](0x194);}return _0x2290e1;};}function handleError(_0x1f347b,_0x256fbc){_0x256fbc=_0x256fbc||0x1f4;return function(_0x471421){logger[_0xa24c('0x24')](_0x471421['stack']);if(_0x471421['name']){delete _0x471421['name'];}_0x1f347b['status'](_0x256fbc)[_0xa24c('0x25')](_0x471421);};}exports[_0xa24c('0x26')]=function(_0xab6197,_0x1cdee4){var _0x37cbd3={},_0x5361d4={},_0x5c8113={'count':0x0,'rows':[]};var _0x33c208=_[_0xa24c('0x27')](db[_0xa24c('0x28')][_0xa24c('0x29')],function(_0x4566dc){return{'name':_0x4566dc[_0xa24c('0x2a')],'type':_0x4566dc[_0xa24c('0x2b')][_0xa24c('0x2c')]};});_0x5361d4[_0xa24c('0x2d')]=_[_0xa24c('0x27')](_0x33c208,'name');_0x5361d4[_0xa24c('0x2e')]=_[_0xa24c('0x2f')](_0xab6197['query']);_0x5361d4[_0xa24c('0x30')]=_[_0xa24c('0x31')](_0x5361d4[_0xa24c('0x2d')],_0x5361d4[_0xa24c('0x2e')]);_0x37cbd3[_0xa24c('0x32')]=_[_0xa24c('0x31')](_0x5361d4[_0xa24c('0x2d')],qs[_0xa24c('0x33')](_0xab6197[_0xa24c('0x2e')][_0xa24c('0x33')]));_0x37cbd3['attributes']=_0x37cbd3['attributes']['length']?_0x37cbd3[_0xa24c('0x32')]:_0x5361d4['model'];if(!_0xab6197[_0xa24c('0x2e')][_0xa24c('0x34')](_0xa24c('0x35'))){_0x37cbd3['limit']=qs[_0xa24c('0x1b')](_0xab6197[_0xa24c('0x2e')][_0xa24c('0x1b')]);_0x37cbd3['offset']=qs[_0xa24c('0x19')](_0xab6197[_0xa24c('0x2e')]['offset']);}_0x37cbd3[_0xa24c('0x36')]=qs[_0xa24c('0x37')](_0xab6197[_0xa24c('0x2e')]['sort']);_0x37cbd3[_0xa24c('0x38')]=qs[_0xa24c('0x30')](_[_0xa24c('0x39')](_0xab6197[_0xa24c('0x2e')],_0x5361d4[_0xa24c('0x30')]),_0x33c208);if(_0xab6197['query'][_0xa24c('0x3a')]){_0x37cbd3[_0xa24c('0x38')]=_['merge'](_0x37cbd3[_0xa24c('0x38')],{'$or':_[_0xa24c('0x27')](_0x33c208,function(_0x2417d9){if(_0x2417d9['type']!=='VIRTUAL'){var _0x1f7535={};_0x1f7535[_0x2417d9[_0xa24c('0x3b')]]={'$like':'%'+_0xab6197[_0xa24c('0x2e')][_0xa24c('0x3a')]+'%'};return _0x1f7535;}})});}_0x37cbd3=_[_0xa24c('0x3c')]({},_0x37cbd3,_0xab6197[_0xa24c('0x3d')]);var _0x54ea40={'where':_0x37cbd3[_0xa24c('0x38')]};return db[_0xa24c('0x28')][_0xa24c('0x1c')](_0x54ea40)[_0xa24c('0x23')](function(_0x5f3cd4){_0x5c8113[_0xa24c('0x1c')]=_0x5f3cd4;if(_0xab6197[_0xa24c('0x2e')][_0xa24c('0x3e')]){_0x37cbd3[_0xa24c('0x3f')]=[{'all':!![]}];}return db[_0xa24c('0x28')][_0xa24c('0x40')](_0x37cbd3);})[_0xa24c('0x23')](function(_0x54939b){_0x5c8113['rows']=_0x54939b;return _0x5c8113;})[_0xa24c('0x23')](respondWithFilteredResult(_0x1cdee4,_0x37cbd3))['catch'](handleError(_0x1cdee4,null));};exports[_0xa24c('0x41')]=function(_0x4fae76,_0x32e151){var _0x214627={'raw':!![],'where':{'id':_0x4fae76[_0xa24c('0x42')]['id']}},_0x37372d={};_0x37372d[_0xa24c('0x2d')]=_[_0xa24c('0x2f')](db[_0xa24c('0x28')][_0xa24c('0x29')]);_0x37372d[_0xa24c('0x2e')]=_[_0xa24c('0x2f')](_0x4fae76[_0xa24c('0x2e')]);_0x37372d[_0xa24c('0x30')]=_[_0xa24c('0x31')](_0x37372d[_0xa24c('0x2d')],_0x37372d[_0xa24c('0x2e')]);_0x214627[_0xa24c('0x32')]=_['intersection'](_0x37372d[_0xa24c('0x2d')],qs[_0xa24c('0x33')](_0x4fae76[_0xa24c('0x2e')]['fields']));_0x214627[_0xa24c('0x32')]=_0x214627[_0xa24c('0x32')][_0xa24c('0x43')]?_0x214627[_0xa24c('0x32')]:_0x37372d['model'];if(_0x4fae76[_0xa24c('0x2e')][_0xa24c('0x3e')]){_0x214627[_0xa24c('0x3f')]=[{'all':!![]}];}_0x214627=_[_0xa24c('0x3c')]({},_0x214627,_0x4fae76[_0xa24c('0x3d')]);return db[_0xa24c('0x28')][_0xa24c('0x44')](_0x214627)[_0xa24c('0x23')](handleEntityNotFound(_0x32e151,null))[_0xa24c('0x23')](respondWithResult(_0x32e151,null))[_0xa24c('0x45')](handleError(_0x32e151,null));};exports[_0xa24c('0x46')]=function(_0xeac74f,_0x261c41){return db['Cdr'][_0xa24c('0x46')](_0xeac74f['body'],{})[_0xa24c('0x23')](respondWithResult(_0x261c41,0xc9))[_0xa24c('0x45')](handleError(_0x261c41,null));};exports[_0xa24c('0x47')]=function(_0x1641b8,_0xd4761e){if(_0x1641b8[_0xa24c('0x48')]['id']){delete _0x1641b8[_0xa24c('0x48')]['id'];}return db[_0xa24c('0x28')][_0xa24c('0x44')]({'where':{'id':_0x1641b8[_0xa24c('0x42')]['id']}})[_0xa24c('0x23')](handleEntityNotFound(_0xd4761e,null))[_0xa24c('0x23')](saveUpdates(_0x1641b8[_0xa24c('0x48')],null))['then'](respondWithResult(_0xd4761e,null))[_0xa24c('0x45')](handleError(_0xd4761e,null));};exports[_0xa24c('0x22')]=function(_0x3875fb,_0x456181){return db['Cdr'][_0xa24c('0x44')]({'where':{'id':_0x3875fb[_0xa24c('0x42')]['id']}})[_0xa24c('0x23')](handleEntityNotFound(_0x456181,null))['then'](removeEntity(_0x456181,null))['catch'](handleError(_0x456181,null));};exports[_0xa24c('0x49')]=function(_0x1c8980,_0x4992ee){return db[_0xa24c('0x28')][_0xa24c('0x49')]()['then'](respondWithResult(_0x4992ee,null))[_0xa24c('0x45')](handleError(_0x4992ee,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f064312..279a350 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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xee55be,_0x1150ab){var _0x4301d4=function(_0x312bdb){while(--_0x312bdb){_0xee55be['push'](_0xee55be['shift']());}};_0x4301d4(++_0x1150ab);}(_0x7a54,0x106));var _0x47a5=function(_0xa0e90b,_0x5d996d){_0xa0e90b=_0xa0e90b-0x0;var _0x146706=_0x7a54[_0xa0e90b];return _0x146706;};'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':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1f0821,_0x3c6eff){var _0x382a17=function(_0x42911c){while(--_0x42911c){_0x1f0821['push'](_0x1f0821['shift']());}};_0x382a17(++_0x3c6eff);}(_0x7a54,0x106));var _0x47a5=function(_0x1145b1,_0x4041bf){_0x1145b1=_0x1145b1-0x0;var _0x733832=_0x7a54[_0x1145b1];return _0x733832;};'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':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('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 4143d44..c90288e 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 _0x30cb=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','stringify','error','Cdr,\x20%s,\x20%s','message','request\x20sent'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x30cb,0xaa));var _0xb30c=function(_0x384495,_0x209c96){_0x384495=_0x384495-0x0;var _0x9c88e5=_0x30cb[_0x384495];return _0x9c88e5;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var moment=require(_0xb30c('0x2'));var BPromise=require(_0xb30c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb30c('0x4'));var db=require(_0xb30c('0x5'))['db'];var utils=require(_0xb30c('0x6'));var logger=require('../../config/logger')(_0xb30c('0x7'));var config=require(_0xb30c('0x8'));var jayson=require(_0xb30c('0x9'));var client=jayson[_0xb30c('0xa')][_0xb30c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ad1ea,_0x1d7b0b,_0x1e8037){return new BPromise(function(_0x42fac2,_0x49106f){return client['request'](_0x3ad1ea,_0x1e8037)[_0xb30c('0xc')](function(_0x597b97){logger[_0xb30c('0xd')]('Cdr,\x20%s,\x20%s',_0x1d7b0b,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x1d7b0b,'request\x20sent',JSON[_0xb30c('0xe')](_0x597b97));if(_0x597b97[_0xb30c('0xf')]){if(_0x597b97['error']['code']===0x1f4){logger[_0xb30c('0xf')](_0xb30c('0x10'),_0x1d7b0b,_0x597b97[_0xb30c('0xf')][_0xb30c('0x11')]);return _0x49106f(_0x597b97[_0xb30c('0xf')]['message']);}logger[_0xb30c('0xf')]('Cdr,\x20%s,\x20%s',_0x1d7b0b,_0x597b97[_0xb30c('0xf')]['message']);return _0x42fac2(_0x597b97[_0xb30c('0xf')][_0xb30c('0x11')]);}else{logger[_0xb30c('0xd')](_0xb30c('0x10'),_0x1d7b0b,_0xb30c('0x12'));_0x42fac2(_0x597b97[_0xb30c('0x13')][_0xb30c('0x11')]);}})[_0xb30c('0x14')](function(_0x4a3234){logger[_0xb30c('0xf')](_0xb30c('0x10'),_0x1d7b0b,_0x4a3234);_0x49106f(_0x4a3234);});});} \ No newline at end of file +var _0xfa35=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4e0f30,_0x296fc5){var _0x3cb81d=function(_0x245df7){while(--_0x245df7){_0x4e0f30['push'](_0x4e0f30['shift']());}};_0x3cb81d(++_0x296fc5);}(_0xfa35,0x172));var _0x5fa3=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0xfa35[_0x2c2a8e];return _0x3b9e38;};'use strict';var _=require(_0x5fa3('0x0'));var util=require(_0x5fa3('0x1'));var moment=require('moment');var BPromise=require(_0x5fa3('0x2'));var rs=require(_0x5fa3('0x3'));var fs=require('fs');var Redis=require(_0x5fa3('0x4'));var db=require(_0x5fa3('0x5'))['db'];var utils=require(_0x5fa3('0x6'));var logger=require(_0x5fa3('0x7'))(_0x5fa3('0x8'));var config=require(_0x5fa3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5fa3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5334e0,_0x57ffd2,_0x5a272e){return new BPromise(function(_0x8ec117,_0x335f5f){return client[_0x5fa3('0xb')](_0x5334e0,_0x5a272e)[_0x5fa3('0xc')](function(_0x39dd8d){logger[_0x5fa3('0xd')](_0x5fa3('0xe'),_0x57ffd2,'request\x20sent');logger[_0x5fa3('0xf')](_0x5fa3('0x10'),_0x57ffd2,_0x5fa3('0x11'),JSON[_0x5fa3('0x12')](_0x39dd8d));if(_0x39dd8d[_0x5fa3('0x13')]){if(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x14')]===0x1f4){logger['error'](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')]['message']);return _0x335f5f(_0x39dd8d[_0x5fa3('0x13')]['message']);}logger[_0x5fa3('0x13')](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);return _0x8ec117(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);}else{logger[_0x5fa3('0xd')]('Cdr,\x20%s,\x20%s',_0x57ffd2,_0x5fa3('0x11'));_0x8ec117(_0x39dd8d['result']['message']);}})[_0x5fa3('0x16')](function(_0x3bc77f){logger[_0x5fa3('0x13')]('Cdr,\x20%s,\x20%s',_0x57ffd2,_0x3bc77f);_0x335f5f(_0x3bc77f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b45f22e..fdbcf7b 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('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 52296be..e6c06a9 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 _0x6ff1=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x66f589,_0x3a2588){var _0xb321ae=function(_0x208c6b){while(--_0x208c6b){_0x66f589['push'](_0x66f589['shift']());}};_0xb321ae(++_0x3a2588);}(_0x6ff1,0x74));var _0x16ff=function(_0x194a86,_0x5cf904){_0x194a86=_0x194a86-0x0;var _0x38a2f7=_0x6ff1[_0x194a86];return _0x38a2f7;};'use strict';var Sequelize=require(_0x16ff('0x0'));module['exports']={'priority':{'type':Sequelize[_0x16ff('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x16ff('0x2')],'allowNull':![],'defaultValue':_0x16ff('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x16ff('0x2')]},'interval':{'type':Sequelize[_0x16ff('0x2')],'defaultValue':_0x16ff('0x4')}}; \ No newline at end of file +var _0x8055=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x4dc4d7,_0x39d190){var _0x1dc843=function(_0xf20cbc){while(--_0xf20cbc){_0x4dc4d7['push'](_0x4dc4d7['shift']());}};_0x1dc843(++_0x39d190);}(_0x8055,0x1aa));var _0x5805=function(_0x257b8b,_0x417c05){_0x257b8b=_0x257b8b-0x0;var _0x42097a=_0x8055[_0x257b8b];return _0x42097a;};'use strict';var Sequelize=require('sequelize');module[_0x5805('0x0')]={'priority':{'type':Sequelize[_0x5805('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5805('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5805('0x3')]()},'description':{'type':Sequelize[_0x5805('0x2')]},'interval':{'type':Sequelize[_0x5805('0x2')],'defaultValue':_0x5805('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c4d5cad..17c7158 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 _0xcd60=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','then','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2fd686,_0x204b08){var _0x20fe03=function(_0x22b7e4){while(--_0x22b7e4){_0x2fd686['push'](_0x2fd686['shift']());}};_0x20fe03(++_0x204b08);}(_0xcd60,0xf0));var _0x0cd6=function(_0x156279,_0x340beb){_0x156279=_0x156279-0x0;var _0x3d9d66=_0xcd60[_0x156279];return _0x3d9d66;};'use strict';var emlformat=require(_0x0cd6('0x0'));var rimraf=require(_0x0cd6('0x1'));var zipdir=require(_0x0cd6('0x2'));var jsonpatch=require(_0x0cd6('0x3'));var rp=require(_0x0cd6('0x4'));var moment=require(_0x0cd6('0x5'));var BPromise=require(_0x0cd6('0x6'));var Mustache=require('mustache');var util=require(_0x0cd6('0x7'));var path=require(_0x0cd6('0x8'));var sox=require(_0x0cd6('0x9'));var csv=require(_0x0cd6('0xa'));var ejs=require(_0x0cd6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cd6('0xc'));var squel=require(_0x0cd6('0xd'));var crypto=require('crypto');var jsforce=require(_0x0cd6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0cd6('0xa'));var querystring=require(_0x0cd6('0xf'));var Papa=require(_0x0cd6('0x10'));var Redis=require(_0x0cd6('0x11'));var authService=require(_0x0cd6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0cd6('0x13'));var hardwareService=require(_0x0cd6('0x14'));var logger=require(_0x0cd6('0x15'))(_0x0cd6('0x16'));var utils=require(_0x0cd6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cd6('0x18'))['db'];function respondWithStatusCode(_0x327d41,_0x2750c9){_0x2750c9=_0x2750c9||0xcc;return function(_0x54c660){if(_0x54c660){return _0x327d41[_0x0cd6('0x19')](_0x2750c9);}return _0x327d41['status'](_0x2750c9)[_0x0cd6('0x1a')]();};}function respondWithResult(_0x259190,_0x134b64){_0x134b64=_0x134b64||0xc8;return function(_0x443290){if(_0x443290){return _0x259190[_0x0cd6('0x1b')](_0x134b64)[_0x0cd6('0x1c')](_0x443290);}};}function respondWithFilteredResult(_0xf6fdb3,_0x1efb4a){return function(_0x1727e5){if(_0x1727e5){var _0x364880=typeof _0x1efb4a[_0x0cd6('0x1d')]===_0x0cd6('0x1e')&&typeof _0x1efb4a[_0x0cd6('0x1f')]===_0x0cd6('0x1e');var _0x596a46=_0x1727e5[_0x0cd6('0x20')];var _0x202d73=_0x364880?0x0:_0x1efb4a['offset'];var _0x5c37ee=_0x364880?_0x1727e5['count']:_0x1efb4a[_0x0cd6('0x1d')]+_0x1efb4a['limit'];var _0x5bdd3f;if(_0x5c37ee>=_0x596a46){_0x5c37ee=_0x596a46;_0x5bdd3f=0xc8;}else{_0x5bdd3f=0xce;}_0xf6fdb3[_0x0cd6('0x1b')](_0x5bdd3f);return _0xf6fdb3['set'](_0x0cd6('0x21'),_0x202d73+'-'+_0x5c37ee+'/'+_0x596a46)[_0x0cd6('0x1c')](_0x1727e5);}return null;};}function patchUpdates(_0x1b29b1){return function(_0x1bb2d6){try{jsonpatch[_0x0cd6('0x22')](_0x1bb2d6,_0x1b29b1,!![]);}catch(_0x33b228){return BPromise[_0x0cd6('0x23')](_0x33b228);}return _0x1bb2d6[_0x0cd6('0x24')]();};}function saveUpdates(_0x5734a5,_0x643aa0){return function(_0x1488bf){if(_0x1488bf){return _0x1488bf[_0x0cd6('0x25')](_0x5734a5)['then'](function(_0x55f68f){return _0x55f68f;});}return null;};}function removeEntity(_0x5cacd5,_0x6689ab){return function(_0x5c8b8b){if(_0x5c8b8b){return _0x5c8b8b['destroy']()['then'](function(){_0x5cacd5['status'](0xcc)[_0x0cd6('0x1a')]();});}};}function handleEntityNotFound(_0x37ff86,_0x2a883a){return function(_0x304a09){if(!_0x304a09){_0x37ff86['sendStatus'](0x194);}return _0x304a09;};}function handleError(_0x55def9,_0x147d7e){_0x147d7e=_0x147d7e||0x1f4;return function(_0x47cd69){logger[_0x0cd6('0x26')](_0x47cd69[_0x0cd6('0x27')]);if(_0x47cd69[_0x0cd6('0x28')]){delete _0x47cd69[_0x0cd6('0x28')];}_0x55def9[_0x0cd6('0x1b')](_0x147d7e)[_0x0cd6('0x29')](_0x47cd69);};}exports[_0x0cd6('0x2a')]=function(_0x341cee,_0x90fa6d){var _0x72c358={'raw':!![],'where':{'id':_0x341cee[_0x0cd6('0x2b')]['id']}},_0x1cb053={};_0x1cb053[_0x0cd6('0x2c')]=_[_0x0cd6('0x2d')](db[_0x0cd6('0x2e')][_0x0cd6('0x2f')]);_0x1cb053['query']=_[_0x0cd6('0x2d')](_0x341cee[_0x0cd6('0x30')]);_0x1cb053[_0x0cd6('0x31')]=_[_0x0cd6('0x32')](_0x1cb053['model'],_0x1cb053[_0x0cd6('0x30')]);_0x72c358[_0x0cd6('0x33')]=_[_0x0cd6('0x32')](_0x1cb053[_0x0cd6('0x2c')],qs[_0x0cd6('0x34')](_0x341cee['query'][_0x0cd6('0x34')]));_0x72c358[_0x0cd6('0x33')]=_0x72c358[_0x0cd6('0x33')][_0x0cd6('0x35')]?_0x72c358[_0x0cd6('0x33')]:_0x1cb053['model'];if(_0x341cee[_0x0cd6('0x30')][_0x0cd6('0x36')]){_0x72c358['include']=[{'all':!![]}];}_0x72c358=_[_0x0cd6('0x37')]({},_0x72c358,_0x341cee[_0x0cd6('0x38')]);return db[_0x0cd6('0x2e')]['find'](_0x72c358)[_0x0cd6('0x39')](handleEntityNotFound(_0x90fa6d,null))[_0x0cd6('0x39')](respondWithResult(_0x90fa6d,null))['catch'](handleError(_0x90fa6d,null));};exports[_0x0cd6('0x25')]=function(_0x12bdb4,_0xf8ec39){if(_0x12bdb4['body']['id']){delete _0x12bdb4[_0x0cd6('0x3a')]['id'];}return db[_0x0cd6('0x2e')][_0x0cd6('0x3b')]({'where':{'id':_0x12bdb4['params']['id']}})[_0x0cd6('0x39')](handleEntityNotFound(_0xf8ec39,null))['then'](saveUpdates(_0x12bdb4[_0x0cd6('0x3a')],null))[_0x0cd6('0x39')](respondWithResult(_0xf8ec39,null))[_0x0cd6('0x3c')](handleError(_0xf8ec39,null));};exports['destroy']=function(_0x2ac6ab,_0x2ab84d){return db[_0x0cd6('0x2e')][_0x0cd6('0x3b')]({'where':{'id':_0x2ac6ab[_0x0cd6('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ab84d,null))['then'](removeEntity(_0x2ab84d,null))[_0x0cd6('0x3c')](handleError(_0x2ab84d,null));}; \ No newline at end of file +var _0xd139=['include','find','catch','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','length','includeAll'];(function(_0x3ddd29,_0x26f096){var _0x34cb20=function(_0x6bbb15){while(--_0x6bbb15){_0x3ddd29['push'](_0x3ddd29['shift']());}};_0x34cb20(++_0x26f096);}(_0xd139,0x14e));var _0x9d13=function(_0x2fde33,_0x1e0652){_0x2fde33=_0x2fde33-0x0;var _0x4d2075=_0xd139[_0x2fde33];return _0x4d2075;};'use strict';var emlformat=require(_0x9d13('0x0'));var rimraf=require(_0x9d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d13('0x2'));var moment=require(_0x9d13('0x3'));var BPromise=require(_0x9d13('0x4'));var Mustache=require(_0x9d13('0x5'));var util=require(_0x9d13('0x6'));var path=require(_0x9d13('0x7'));var sox=require(_0x9d13('0x8'));var csv=require('to-csv');var ejs=require(_0x9d13('0x9'));var fs=require('fs');var fs_extra=require(_0x9d13('0xa'));var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d13('0x15'))['db'];function respondWithStatusCode(_0x3933d1,_0x39020){_0x39020=_0x39020||0xcc;return function(_0x331fea){if(_0x331fea){return _0x3933d1[_0x9d13('0x16')](_0x39020);}return _0x3933d1['status'](_0x39020)['end']();};}function respondWithResult(_0x37607a,_0x43bf27){_0x43bf27=_0x43bf27||0xc8;return function(_0x2f5442){if(_0x2f5442){return _0x37607a[_0x9d13('0x17')](_0x43bf27)[_0x9d13('0x18')](_0x2f5442);}};}function respondWithFilteredResult(_0x1a2b65,_0x38f368){return function(_0x47bcd3){if(_0x47bcd3){var _0x3acfc1=typeof _0x38f368[_0x9d13('0x19')]===_0x9d13('0x1a')&&typeof _0x38f368[_0x9d13('0x1b')]===_0x9d13('0x1a');var _0x42d5a5=_0x47bcd3[_0x9d13('0x1c')];var _0x10aa89=_0x3acfc1?0x0:_0x38f368[_0x9d13('0x19')];var _0x2acb0b=_0x3acfc1?_0x47bcd3[_0x9d13('0x1c')]:_0x38f368[_0x9d13('0x19')]+_0x38f368[_0x9d13('0x1b')];var _0x4d6b9d;if(_0x2acb0b>=_0x42d5a5){_0x2acb0b=_0x42d5a5;_0x4d6b9d=0xc8;}else{_0x4d6b9d=0xce;}_0x1a2b65[_0x9d13('0x17')](_0x4d6b9d);return _0x1a2b65[_0x9d13('0x1d')](_0x9d13('0x1e'),_0x10aa89+'-'+_0x2acb0b+'/'+_0x42d5a5)[_0x9d13('0x18')](_0x47bcd3);}return null;};}function patchUpdates(_0x4e1425){return function(_0x48ce3d){try{jsonpatch['apply'](_0x48ce3d,_0x4e1425,!![]);}catch(_0x223ea5){return BPromise[_0x9d13('0x1f')](_0x223ea5);}return _0x48ce3d[_0x9d13('0x20')]();};}function saveUpdates(_0x1fefe4,_0x3971e0){return function(_0x3040e7){if(_0x3040e7){return _0x3040e7[_0x9d13('0x21')](_0x1fefe4)[_0x9d13('0x22')](function(_0x5d14c8){return _0x5d14c8;});}return null;};}function removeEntity(_0xb34817,_0xd5a981){return function(_0x22963f){if(_0x22963f){return _0x22963f[_0x9d13('0x23')]()['then'](function(){_0xb34817[_0x9d13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c673,_0xfaf587){return function(_0xe0c57){if(!_0xe0c57){_0x40c673[_0x9d13('0x16')](0x194);}return _0xe0c57;};}function handleError(_0x453536,_0x45a299){_0x45a299=_0x45a299||0x1f4;return function(_0x1c36e5){logger[_0x9d13('0x24')](_0x1c36e5['stack']);if(_0x1c36e5[_0x9d13('0x25')]){delete _0x1c36e5['name'];}_0x453536[_0x9d13('0x17')](_0x45a299)[_0x9d13('0x26')](_0x1c36e5);};}exports[_0x9d13('0x27')]=function(_0x1d9f56,_0x5ebfaf){var _0x23c91f={'raw':!![],'where':{'id':_0x1d9f56[_0x9d13('0x28')]['id']}},_0x441118={};_0x441118[_0x9d13('0x29')]=_[_0x9d13('0x2a')](db[_0x9d13('0x2b')][_0x9d13('0x2c')]);_0x441118['query']=_[_0x9d13('0x2a')](_0x1d9f56['query']);_0x441118[_0x9d13('0x2d')]=_[_0x9d13('0x2e')](_0x441118['model'],_0x441118[_0x9d13('0x2f')]);_0x23c91f[_0x9d13('0x30')]=_['intersection'](_0x441118['model'],qs['fields'](_0x1d9f56[_0x9d13('0x2f')]['fields']));_0x23c91f[_0x9d13('0x30')]=_0x23c91f[_0x9d13('0x30')][_0x9d13('0x31')]?_0x23c91f['attributes']:_0x441118[_0x9d13('0x29')];if(_0x1d9f56[_0x9d13('0x2f')][_0x9d13('0x32')]){_0x23c91f[_0x9d13('0x33')]=[{'all':!![]}];}_0x23c91f=_['merge']({},_0x23c91f,_0x1d9f56['options']);return db[_0x9d13('0x2b')][_0x9d13('0x34')](_0x23c91f)['then'](handleEntityNotFound(_0x5ebfaf,null))[_0x9d13('0x22')](respondWithResult(_0x5ebfaf,null))[_0x9d13('0x35')](handleError(_0x5ebfaf,null));};exports[_0x9d13('0x21')]=function(_0x96da64,_0x7f7a0f){if(_0x96da64[_0x9d13('0x36')]['id']){delete _0x96da64[_0x9d13('0x36')]['id'];}return db['ChatApplication'][_0x9d13('0x34')]({'where':{'id':_0x96da64['params']['id']}})['then'](handleEntityNotFound(_0x7f7a0f,null))['then'](saveUpdates(_0x96da64[_0x9d13('0x36')],null))[_0x9d13('0x22')](respondWithResult(_0x7f7a0f,null))[_0x9d13('0x35')](handleError(_0x7f7a0f,null));};exports[_0x9d13('0x23')]=function(_0x3467eb,_0x4b32d8){return db[_0x9d13('0x2b')][_0x9d13('0x34')]({'where':{'id':_0x3467eb[_0x9d13('0x28')]['id']}})[_0x9d13('0x22')](handleEntityNotFound(_0x4b32d8,null))[_0x9d13('0x22')](removeEntity(_0x4b32d8,null))[_0x9d13('0x35')](handleError(_0x4b32d8,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7f4f829..3e62332 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 _0x3512=['rimraf','../../config/environment','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0x3512,0x13b));var _0x2351=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3512[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x2351('0x0'));var logger=require(_0x2351('0x1'))(_0x2351('0x2'));var moment=require(_0x2351('0x3'));var BPromise=require(_0x2351('0x4'));var rp=require(_0x2351('0x5'));var fs=require('fs');var path=require(_0x2351('0x6'));var rimraf=require(_0x2351('0x7'));var config=require(_0x2351('0x8'));var attributes=require(_0x2351('0x9'));module['exports']=function(_0x23eaa0,_0x24ef90){return _0x23eaa0['define'](_0x2351('0xa'),attributes,{'tableName':_0x2351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2351('0xc'),'collate':_0x2351('0xd')});}; \ No newline at end of file +var _0x8cec=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1cd577,_0x180f2a){var _0x790837=function(_0x2cace5){while(--_0x2cace5){_0x1cd577['push'](_0x1cd577['shift']());}};_0x790837(++_0x180f2a);}(_0x8cec,0x104));var _0xc8ce=function(_0x44249e,_0x5a0e0c){_0x44249e=_0x44249e-0x0;var _0x333e30=_0x8cec[_0x44249e];return _0x333e30;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8ce('0xc'),'collate':_0xc8ce('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 804667b..c045186 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 _0xc8c4=['catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1aaef9,_0x25790e){var _0x2ce77f=function(_0x4910b6){while(--_0x4910b6){_0x1aaef9['push'](_0x1aaef9['shift']());}};_0x2ce77f(++_0x25790e);}(_0xc8c4,0x1b9));var _0x4c8c=function(_0x46ea77,_0x2fdae1){_0x46ea77=_0x46ea77-0x0;var _0x294b2b=_0xc8c4[_0x46ea77];return _0x294b2b;};'use strict';var _=require(_0x4c8c('0x0'));var util=require(_0x4c8c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c8c('0x2'));var fs=require('fs');var Redis=require(_0x4c8c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c8c('0x4'));var logger=require(_0x4c8c('0x5'))(_0x4c8c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c8c('0x7')][_0x4c8c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23cb9e,_0x13953c,_0x358a7c){return new BPromise(function(_0x303aaf,_0x135d05){return client[_0x4c8c('0x9')](_0x23cb9e,_0x358a7c)[_0x4c8c('0xa')](function(_0x51c58e){logger[_0x4c8c('0xb')](_0x4c8c('0xc'),_0x13953c,_0x4c8c('0xd'));logger[_0x4c8c('0xe')](_0x4c8c('0xf'),_0x13953c,_0x4c8c('0xd'),JSON['stringify'](_0x51c58e));if(_0x51c58e[_0x4c8c('0x10')]){if(_0x51c58e[_0x4c8c('0x10')][_0x4c8c('0x11')]===0x1f4){logger[_0x4c8c('0x10')](_0x4c8c('0xc'),_0x13953c,_0x51c58e[_0x4c8c('0x10')][_0x4c8c('0x12')]);return _0x135d05(_0x51c58e[_0x4c8c('0x10')][_0x4c8c('0x12')]);}logger[_0x4c8c('0x10')](_0x4c8c('0xc'),_0x13953c,_0x51c58e[_0x4c8c('0x10')][_0x4c8c('0x12')]);return _0x303aaf(_0x51c58e[_0x4c8c('0x10')][_0x4c8c('0x12')]);}else{logger['info'](_0x4c8c('0xc'),_0x13953c,_0x4c8c('0xd'));_0x303aaf(_0x51c58e['result']['message']);}})[_0x4c8c('0x13')](function(_0x45c006){logger[_0x4c8c('0x10')](_0x4c8c('0xc'),_0x13953c,_0x45c006);_0x135d05(_0x45c006);});});} \ No newline at end of file +var _0xbbe0=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x730dc0,_0x2ce9cc){var _0x96a727=function(_0x42bc3b){while(--_0x42bc3b){_0x730dc0['push'](_0x730dc0['shift']());}};_0x96a727(++_0x2ce9cc);}(_0xbbe0,0xc3));var _0x0bbe=function(_0x2dde57,_0x54ef96){_0x2dde57=_0x2dde57-0x0;var _0x2c74f2=_0xbbe0[_0x2dde57];return _0x2c74f2;};'use strict';var _=require(_0x0bbe('0x0'));var util=require('util');var moment=require(_0x0bbe('0x1'));var BPromise=require(_0x0bbe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bbe('0x3'));var db=require(_0x0bbe('0x4'))['db'];var utils=require(_0x0bbe('0x5'));var logger=require(_0x0bbe('0x6'))(_0x0bbe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bbe('0x8')][_0x0bbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c48fb,_0x495008,_0x20ea37){return new BPromise(function(_0x4e344b,_0x13e967){return client[_0x0bbe('0xa')](_0x1c48fb,_0x20ea37)[_0x0bbe('0xb')](function(_0x42b625){logger[_0x0bbe('0xc')](_0x0bbe('0xd'),_0x495008,_0x0bbe('0xe'));logger[_0x0bbe('0xf')](_0x0bbe('0x10'),_0x495008,_0x0bbe('0xe'),JSON[_0x0bbe('0x11')](_0x42b625));if(_0x42b625[_0x0bbe('0x12')]){if(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x13')]===0x1f4){logger['error'](_0x0bbe('0xd'),_0x495008,_0x42b625[_0x0bbe('0x12')]['message']);return _0x13e967(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x14')]);}logger[_0x0bbe('0x12')](_0x0bbe('0xd'),_0x495008,_0x42b625['error']['message']);return _0x4e344b(_0x42b625[_0x0bbe('0x12')][_0x0bbe('0x14')]);}else{logger['info'](_0x0bbe('0xd'),_0x495008,_0x0bbe('0xe'));_0x4e344b(_0x42b625[_0x0bbe('0x15')][_0x0bbe('0x14')]);}})[_0x0bbe('0x16')](function(_0x38c835){logger[_0x0bbe('0x12')]('ChatApplication,\x20%s,\x20%s',_0x495008,_0x38c835);_0x13e967(_0x38c835);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8095ea3..4029d8b 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 _0x0b2b=['show','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x0b2b,0xa8));var _0xb0b2=function(_0x3fdaec,_0x21b8d8){_0x3fdaec=_0x3fdaec-0x0;var _0x1d2dc8=_0x0b2b[_0x3fdaec];return _0x1d2dc8;};'use strict';var multer=require(_0xb0b2('0x0'));var util=require(_0xb0b2('0x1'));var path=require(_0xb0b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0b2('0x3'));var router=express[_0xb0b2('0x4')]();var fs_extra=require(_0xb0b2('0x5'));var auth=require(_0xb0b2('0x6'));var interaction=require(_0xb0b2('0x7'));var config=require(_0xb0b2('0x8'));var controller=require(_0xb0b2('0x9'));router['get'](_0xb0b2('0xa'),auth[_0xb0b2('0xb')](),controller[_0xb0b2('0xc')]);router[_0xb0b2('0xd')](_0xb0b2('0xa'),auth['isAuthenticated'](),controller[_0xb0b2('0xe')]);router[_0xb0b2('0xf')](_0xb0b2('0xa'),auth[_0xb0b2('0xb')](),controller[_0xb0b2('0x10')]);module[_0xb0b2('0x11')]=router; \ No newline at end of file +var _0xd2ab=['./chatApplication.controller','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xd2ab,0x78));var _0xbd2a=function(_0x308a44,_0x479628){_0x308a44=_0x308a44-0x0;var _0x567c52=_0xd2ab[_0x308a44];return _0x567c52;};'use strict';var multer=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var path=require(_0xbd2a('0x2'));var timeout=require(_0xbd2a('0x3'));var express=require(_0xbd2a('0x4'));var router=express[_0xbd2a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd2a('0x6'));var interaction=require(_0xbd2a('0x7'));var config=require('../../config/environment');var controller=require(_0xbd2a('0x8'));router['get'](_0xbd2a('0x9'),auth['isAuthenticated'](),controller[_0xbd2a('0xa')]);router[_0xbd2a('0xb')](_0xbd2a('0x9'),auth[_0xbd2a('0xc')](),controller[_0xbd2a('0xd')]);router['delete'](_0xbd2a('0x9'),auth[_0xbd2a('0xc')](),controller[_0xbd2a('0xe')]);module[_0xbd2a('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e0de98a..84aa386 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 _0xa151=['BOOLEAN','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa151,0x13d));var _0x1a15=function(_0x31d72e,_0x30b720){_0x31d72e=_0x31d72e-0x0;var _0x3b6795=_0xa151[_0x31d72e];return _0x3b6795;};'use strict';var Sequelize=require(_0x1a15('0x0'));module[_0x1a15('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1a15('0x2')]},'write':{'type':Sequelize[_0x1a15('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02b6=['STRING','BOOLEAN','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x02b6,0xfe));var _0x602b=function(_0x4475b3,_0xf90028){_0x4475b3=_0x4475b3-0x0;var _0x1f06c7=_0x02b6[_0x4475b3];return _0x1f06c7;};'use strict';var Sequelize=require(_0x602b('0x0'));module['exports']={'name':{'type':Sequelize[_0x602b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x602b('0x1')]},'write':{'type':Sequelize[_0x602b('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0c0e63f..88fbf0d 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 _0xd0f4=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','describe','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','hasOwnProperty','removeMembers','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','util','path'];(function(_0x4e1a81,_0x4c3697){var _0x52ea72=function(_0x4cda82){while(--_0x4cda82){_0x4e1a81['push'](_0x4e1a81['shift']());}};_0x52ea72(++_0x4c3697);}(_0xd0f4,0x1b7));var _0x4d0f=function(_0x563a6c,_0x3220c2){_0x563a6c=_0x563a6c-0x0;var _0x58bafd=_0xd0f4[_0x563a6c];return _0x58bafd;};'use strict';var emlformat=require(_0x4d0f('0x0'));var rimraf=require(_0x4d0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d0f('0x2'));var moment=require(_0x4d0f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d0f('0x4'));var path=require(_0x4d0f('0x5'));var sox=require('sox');var csv=require(_0x4d0f('0x6'));var ejs=require(_0x4d0f('0x7'));var fs=require('fs');var fs_extra=require(_0x4d0f('0x8'));var _=require(_0x4d0f('0x9'));var squel=require(_0x4d0f('0xa'));var crypto=require('crypto');var jsforce=require(_0x4d0f('0xb'));var deskjs=require(_0x4d0f('0xc'));var toCsv=require(_0x4d0f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4d0f('0xd'));var as=require(_0x4d0f('0xe'));var hardwareService=require(_0x4d0f('0xf'));var logger=require(_0x4d0f('0x10'))(_0x4d0f('0x11'));var utils=require('../../config/utils');var config=require(_0x4d0f('0x12'));var licenseUtil=require(_0x4d0f('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4d0f('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d0f('0x15'))(new Redis(config['redis']));require(_0x4d0f('0x16'))[_0x4d0f('0x17')](socket);function respondWithStatusCode(_0x100216,_0x4af127){_0x4af127=_0x4af127||0xcc;return function(_0x8954d9){if(_0x8954d9){return _0x100216['sendStatus'](_0x4af127);}return _0x100216[_0x4d0f('0x18')](_0x4af127)[_0x4d0f('0x19')]();};}function respondWithResult(_0x3c070d,_0x555da6){_0x555da6=_0x555da6||0xc8;return function(_0x2928e2){if(_0x2928e2){return _0x3c070d[_0x4d0f('0x18')](_0x555da6)[_0x4d0f('0x1a')](_0x2928e2);}};}function respondWithFilteredResult(_0x498454,_0x41efc6){return function(_0xe831d4){if(_0xe831d4){var _0x321d73=typeof _0x41efc6[_0x4d0f('0x1b')]===_0x4d0f('0x1c')&&typeof _0x41efc6[_0x4d0f('0x1d')]===_0x4d0f('0x1c');var _0x94150d=_0xe831d4[_0x4d0f('0x1e')];var _0x4cb1c6=_0x321d73?0x0:_0x41efc6['offset'];var _0xbd14bc=_0x321d73?_0xe831d4[_0x4d0f('0x1e')]:_0x41efc6[_0x4d0f('0x1b')]+_0x41efc6[_0x4d0f('0x1d')];var _0x36d0e3;if(_0xbd14bc>=_0x94150d){_0xbd14bc=_0x94150d;_0x36d0e3=0xc8;}else{_0x36d0e3=0xce;}_0x498454['status'](_0x36d0e3);return _0x498454[_0x4d0f('0x1f')](_0x4d0f('0x20'),_0x4cb1c6+'-'+_0xbd14bc+'/'+_0x94150d)[_0x4d0f('0x1a')](_0xe831d4);}return null;};}function patchUpdates(_0x498ecb){return function(_0x14259c){try{jsonpatch[_0x4d0f('0x21')](_0x14259c,_0x498ecb,!![]);}catch(_0x4bb2fd){return BPromise[_0x4d0f('0x22')](_0x4bb2fd);}return _0x14259c['save']();};}function saveUpdates(_0x5a57cd,_0x5562a4){return function(_0x5d7cde){if(_0x5d7cde){return _0x5d7cde[_0x4d0f('0x23')](_0x5a57cd)[_0x4d0f('0x24')](function(_0x560749){return _0x560749;});}return null;};}function removeEntity(_0x4aa291,_0x1c5eb2){return function(_0x389ba6){if(_0x389ba6){return _0x389ba6[_0x4d0f('0x25')]()[_0x4d0f('0x24')](function(){_0x4aa291[_0x4d0f('0x18')](0xcc)[_0x4d0f('0x19')]();});}};}function handleEntityNotFound(_0x379092,_0x4231c1){return function(_0x3f4348){if(!_0x3f4348){_0x379092[_0x4d0f('0x26')](0x194);}return _0x3f4348;};}function handleError(_0x3f3e71,_0x194823){_0x194823=_0x194823||0x1f4;return function(_0x4ad04e){logger[_0x4d0f('0x27')](_0x4ad04e[_0x4d0f('0x28')]);if(_0x4ad04e[_0x4d0f('0x29')]){delete _0x4ad04e['name'];}_0x3f3e71[_0x4d0f('0x18')](_0x194823)[_0x4d0f('0x2a')](_0x4ad04e);};}exports[_0x4d0f('0x2b')]=function(_0x216691,_0x4993fc){var _0x4ab5a7={},_0x55a712={},_0x4cefd8={'count':0x0,'rows':[]};var _0x4bedd8=_[_0x4d0f('0x2c')](db[_0x4d0f('0x2d')][_0x4d0f('0x2e')],function(_0x3fedec){return{'name':_0x3fedec['fieldName'],'type':_0x3fedec[_0x4d0f('0x2f')][_0x4d0f('0x30')]};});_0x55a712[_0x4d0f('0x31')]=_['map'](_0x4bedd8,_0x4d0f('0x29'));_0x55a712[_0x4d0f('0x32')]=_[_0x4d0f('0x33')](_0x216691[_0x4d0f('0x32')]);_0x55a712[_0x4d0f('0x34')]=_[_0x4d0f('0x35')](_0x55a712[_0x4d0f('0x31')],_0x55a712[_0x4d0f('0x32')]);_0x4ab5a7[_0x4d0f('0x36')]=_[_0x4d0f('0x35')](_0x55a712[_0x4d0f('0x31')],qs[_0x4d0f('0x37')](_0x216691[_0x4d0f('0x32')][_0x4d0f('0x37')]));_0x4ab5a7[_0x4d0f('0x36')]=_0x4ab5a7[_0x4d0f('0x36')][_0x4d0f('0x38')]?_0x4ab5a7[_0x4d0f('0x36')]:_0x55a712['model'];if(!_0x216691[_0x4d0f('0x32')]['hasOwnProperty'](_0x4d0f('0x39'))){_0x4ab5a7[_0x4d0f('0x1d')]=qs['limit'](_0x216691['query']['limit']);_0x4ab5a7['offset']=qs[_0x4d0f('0x1b')](_0x216691['query'][_0x4d0f('0x1b')]);}_0x4ab5a7[_0x4d0f('0x3a')]=qs[_0x4d0f('0x3b')](_0x216691['query']['sort']);_0x4ab5a7[_0x4d0f('0x3c')]=qs['filters'](_[_0x4d0f('0x3d')](_0x216691['query'],_0x55a712[_0x4d0f('0x34')]),_0x4bedd8);if(_0x216691[_0x4d0f('0x32')][_0x4d0f('0x3e')]){_0x4ab5a7['where']=_[_0x4d0f('0x3f')](_0x4ab5a7[_0x4d0f('0x3c')],{'$or':_[_0x4d0f('0x2c')](_0x4bedd8,function(_0x471029){if(_0x471029[_0x4d0f('0x2f')]!=='VIRTUAL'){var _0x349470={};_0x349470[_0x471029[_0x4d0f('0x29')]]={'$like':'%'+_0x216691[_0x4d0f('0x32')][_0x4d0f('0x3e')]+'%'};return _0x349470;}})});}_0x4ab5a7=_[_0x4d0f('0x3f')]({},_0x4ab5a7,_0x216691[_0x4d0f('0x40')]);var _0x3f34e9={'where':_0x4ab5a7[_0x4d0f('0x3c')]};return db[_0x4d0f('0x2d')][_0x4d0f('0x1e')](_0x3f34e9)[_0x4d0f('0x24')](function(_0x1c0359){_0x4cefd8['count']=_0x1c0359;if(_0x216691[_0x4d0f('0x32')][_0x4d0f('0x41')]){_0x4ab5a7['include']=[{'all':!![]}];}return db[_0x4d0f('0x2d')]['findAll'](_0x4ab5a7);})[_0x4d0f('0x24')](function(_0xce71cb){_0x4cefd8['rows']=_0xce71cb;return _0x4cefd8;})[_0x4d0f('0x24')](respondWithFilteredResult(_0x4993fc,_0x4ab5a7))[_0x4d0f('0x42')](handleError(_0x4993fc,null));};exports[_0x4d0f('0x43')]=function(_0x4c7c49,_0x95ea85){var _0x4d579c={'raw':!![],'where':{'id':_0x4c7c49[_0x4d0f('0x44')]['id']}},_0x49862a={};_0x49862a['model']=_[_0x4d0f('0x33')](db[_0x4d0f('0x2d')][_0x4d0f('0x2e')]);_0x49862a[_0x4d0f('0x32')]=_[_0x4d0f('0x33')](_0x4c7c49[_0x4d0f('0x32')]);_0x49862a[_0x4d0f('0x34')]=_['intersection'](_0x49862a[_0x4d0f('0x31')],_0x49862a[_0x4d0f('0x32')]);_0x4d579c[_0x4d0f('0x36')]=_[_0x4d0f('0x35')](_0x49862a[_0x4d0f('0x31')],qs['fields'](_0x4c7c49['query'][_0x4d0f('0x37')]));_0x4d579c[_0x4d0f('0x36')]=_0x4d579c[_0x4d0f('0x36')][_0x4d0f('0x38')]?_0x4d579c[_0x4d0f('0x36')]:_0x49862a['model'];if(_0x4c7c49['query'][_0x4d0f('0x41')]){_0x4d579c[_0x4d0f('0x45')]=[{'all':!![]}];}_0x4d579c=_[_0x4d0f('0x3f')]({},_0x4d579c,_0x4c7c49['options']);return db[_0x4d0f('0x2d')][_0x4d0f('0x46')](_0x4d579c)[_0x4d0f('0x24')](handleEntityNotFound(_0x95ea85,null))[_0x4d0f('0x24')](respondWithResult(_0x95ea85,null))[_0x4d0f('0x42')](handleError(_0x95ea85,null));};exports[_0x4d0f('0x47')]=function(_0x2fcf8e,_0x1bde92){return db[_0x4d0f('0x2d')]['create'](_0x2fcf8e[_0x4d0f('0x48')],{})[_0x4d0f('0x24')](respondWithResult(_0x1bde92,0xc9))[_0x4d0f('0x42')](handleError(_0x1bde92,null));};exports[_0x4d0f('0x23')]=function(_0x3a163f,_0x3923d7){if(_0x3a163f[_0x4d0f('0x48')]['id']){delete _0x3a163f[_0x4d0f('0x48')]['id'];}return db[_0x4d0f('0x2d')][_0x4d0f('0x46')]({'where':{'id':_0x3a163f[_0x4d0f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3923d7,null))['then'](saveUpdates(_0x3a163f['body'],null))['then'](respondWithResult(_0x3923d7,null))[_0x4d0f('0x42')](handleError(_0x3923d7,null));};exports[_0x4d0f('0x25')]=function(_0x2f8d70,_0x143630){return db[_0x4d0f('0x2d')][_0x4d0f('0x46')]({'where':{'id':_0x2f8d70[_0x4d0f('0x44')]['id']}})['then'](handleEntityNotFound(_0x143630,null))[_0x4d0f('0x24')](removeEntity(_0x143630,null))[_0x4d0f('0x42')](handleError(_0x143630,null));};exports[_0x4d0f('0x49')]=function(_0x491bd5,_0x58106c){return db[_0x4d0f('0x2d')][_0x4d0f('0x49')]()['then'](respondWithResult(_0x58106c,null))[_0x4d0f('0x42')](handleError(_0x58106c,null));};exports['getUnread']=function(_0x17680e,_0x5eceea,_0x5c3586){return db['ChatInternalMessage'][_0x4d0f('0x1e')]({'where':{'ChatGroupId':_0x17680e[_0x4d0f('0x44')]['id'],'ToId':_0x17680e[_0x4d0f('0x4a')]['id'],'read':![]}})[_0x4d0f('0x24')](function(_0x47eaaa){return{'id':_[_0x4d0f('0x4b')](_0x17680e[_0x4d0f('0x44')]['id']),'count':_0x47eaaa};})[_0x4d0f('0x24')](respondWithResult(_0x5eceea,null))['catch'](handleError(_0x5eceea,null));};exports[_0x4d0f('0x4c')]=function(_0x487b4d,_0x3e983f,_0xea2ba7){return db[_0x4d0f('0x2d')]['find']({'where':{'id':_0x487b4d['params']['id']}})['then'](handleEntityNotFound(_0x3e983f,null))[_0x4d0f('0x24')](function(_0x5ee124){if(_0x5ee124){return _0x5ee124['addMembers'](_0x487b4d[_0x4d0f('0x48')][_0x4d0f('0x4d')],_[_0x4d0f('0x4e')](_0x487b4d[_0x4d0f('0x48')],['ids','id'])||{});}})[_0x4d0f('0x24')](respondWithResult(_0x3e983f,null))[_0x4d0f('0x42')](handleError(_0x3e983f,null));};exports[_0x4d0f('0x4f')]=function(_0x49c76f,_0x173c64,_0x385ba6){var _0x22ed56={};var _0x4e7a93={};var _0x54e63e;var _0x417ac3;return db[_0x4d0f('0x2d')][_0x4d0f('0x50')]({'where':{'id':_0x49c76f[_0x4d0f('0x44')]['id']}})[_0x4d0f('0x24')](handleEntityNotFound(_0x173c64,null))[_0x4d0f('0x24')](function(_0x51f2f8){if(_0x51f2f8){_0x54e63e=_0x51f2f8;_0x4e7a93['model']=_[_0x4d0f('0x33')](db[_0x4d0f('0x51')][_0x4d0f('0x2e')]);_0x4e7a93[_0x4d0f('0x32')]=_[_0x4d0f('0x33')](_0x49c76f['query']);_0x4e7a93[_0x4d0f('0x34')]=_[_0x4d0f('0x35')](_0x4e7a93[_0x4d0f('0x31')],_0x4e7a93[_0x4d0f('0x32')]);_0x22ed56[_0x4d0f('0x36')]=_[_0x4d0f('0x35')](_0x4e7a93[_0x4d0f('0x31')],qs['fields'](_0x49c76f[_0x4d0f('0x32')][_0x4d0f('0x37')]));_0x22ed56['attributes']=_0x22ed56[_0x4d0f('0x36')][_0x4d0f('0x38')]?_0x22ed56['attributes']:_0x4e7a93[_0x4d0f('0x31')];_0x22ed56['order']=qs['sort'](_0x49c76f[_0x4d0f('0x32')][_0x4d0f('0x3b')]);_0x22ed56[_0x4d0f('0x3c')]=qs[_0x4d0f('0x34')](_[_0x4d0f('0x3d')](_0x49c76f[_0x4d0f('0x32')],_0x4e7a93[_0x4d0f('0x34')]));if(_0x49c76f['query'][_0x4d0f('0x3e')]){_0x22ed56[_0x4d0f('0x3c')]=_[_0x4d0f('0x3f')](_0x22ed56[_0x4d0f('0x3c')],{'$or':_['map'](_0x22ed56[_0x4d0f('0x36')],function(_0xb751da){var _0x1e5b0d={};_0x1e5b0d[_0xb751da]={'$like':'%'+_0x49c76f[_0x4d0f('0x32')][_0x4d0f('0x3e')]+'%'};return _0x1e5b0d;})});}_0x22ed56=_[_0x4d0f('0x3f')]({},_0x22ed56,_0x49c76f[_0x4d0f('0x40')]);return _0x54e63e[_0x4d0f('0x4f')](_0x22ed56);}})[_0x4d0f('0x24')](function(_0x3aa99b){if(_0x3aa99b){_0x417ac3=_0x3aa99b[_0x4d0f('0x38')];if(!_0x49c76f[_0x4d0f('0x32')][_0x4d0f('0x52')](_0x4d0f('0x39'))){_0x22ed56[_0x4d0f('0x1d')]=qs[_0x4d0f('0x1d')](_0x49c76f[_0x4d0f('0x32')][_0x4d0f('0x1d')]);_0x22ed56[_0x4d0f('0x1b')]=qs[_0x4d0f('0x1b')](_0x49c76f['query']['offset']);}return _0x54e63e['getMembers'](_0x22ed56);}})[_0x4d0f('0x24')](function(_0x4f83d1){if(_0x4f83d1){return _0x4f83d1?{'count':_0x417ac3,'rows':_0x4f83d1}:null;}})['then'](respondWithResult(_0x173c64,null))[_0x4d0f('0x42')](handleError(_0x173c64,null));};exports[_0x4d0f('0x53')]=function(_0x26370c,_0x1e69bd,_0x22cfdf){return db['ChatGroup']['find']({'where':{'id':_0x26370c[_0x4d0f('0x44')]['id']}})[_0x4d0f('0x24')](handleEntityNotFound(_0x1e69bd,null))[_0x4d0f('0x24')](function(_0x38c803){if(_0x38c803){return _0x38c803[_0x4d0f('0x53')](_0x26370c['query'][_0x4d0f('0x4d')]);}})[_0x4d0f('0x24')](respondWithStatusCode(_0x1e69bd,null))[_0x4d0f('0x42')](handleError(_0x1e69bd,null));};exports['addMessage']=function(_0x3464f1,_0x2cf148,_0x5cbfb8){if(_0x3464f1[_0x4d0f('0x48')]['id']){delete _0x3464f1[_0x4d0f('0x48')]['id'];}return db[_0x4d0f('0x2d')]['find']({'where':{'id':_0x3464f1[_0x4d0f('0x44')]['id']}})[_0x4d0f('0x24')](handleEntityNotFound(_0x2cf148,null))['then'](function(_0x537ad7){if(_0x537ad7){_0x3464f1[_0x4d0f('0x48')]['ChatGroupId']=_0x537ad7['id'];return db[_0x4d0f('0x54')][_0x4d0f('0x47')](_0x3464f1[_0x4d0f('0x48')]);}})[_0x4d0f('0x24')](respondWithResult(_0x2cf148,null))['catch'](handleError(_0x2cf148,null));};exports[_0x4d0f('0x55')]=function(_0x4bdf10,_0x37b700,_0x2eaebb){var _0x516a28={};var _0x19de27={};var _0x19ce39;var _0x2531e0;return db[_0x4d0f('0x2d')]['findOne']({'where':{'id':_0x4bdf10['params']['id']}})[_0x4d0f('0x24')](handleEntityNotFound(_0x37b700,null))['then'](function(_0x11765b){if(_0x11765b){_0x19ce39=_0x11765b;_0x19de27[_0x4d0f('0x31')]=_[_0x4d0f('0x33')](db[_0x4d0f('0x54')][_0x4d0f('0x2e')]);_0x19de27[_0x4d0f('0x32')]=_[_0x4d0f('0x33')](_0x4bdf10['query']);_0x19de27[_0x4d0f('0x34')]=_[_0x4d0f('0x35')](_0x19de27[_0x4d0f('0x31')],_0x19de27[_0x4d0f('0x32')]);_0x516a28[_0x4d0f('0x36')]=_[_0x4d0f('0x35')](_0x19de27[_0x4d0f('0x31')],qs[_0x4d0f('0x37')](_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x37')]));_0x516a28['attributes']=_0x516a28[_0x4d0f('0x36')][_0x4d0f('0x38')]?_0x516a28[_0x4d0f('0x36')]:_0x19de27[_0x4d0f('0x31')];_0x516a28[_0x4d0f('0x3a')]=qs[_0x4d0f('0x3b')](_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x3b')]);_0x516a28[_0x4d0f('0x3c')]=qs['filters'](_['pick'](_0x4bdf10[_0x4d0f('0x32')],_0x19de27['filters']));if(_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x3e')]){_0x516a28[_0x4d0f('0x3c')]=_[_0x4d0f('0x3f')](_0x516a28[_0x4d0f('0x3c')],{'$or':_[_0x4d0f('0x2c')](_0x516a28[_0x4d0f('0x36')],function(_0x5cda81){var _0x5ab47b={};_0x5ab47b[_0x5cda81]={'$like':'%'+_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x3e')]+'%'};return _0x5ab47b;})});}if(_0x4bdf10[_0x4d0f('0x32')]['$gte']){var _0x21e315=_0x4bdf10['query'][_0x4d0f('0x56')][_0x4d0f('0x57')](',');var _0x479210={};_0x479210[_0x21e315[0x0]]={'$gte':moment(_0x21e315[0x1])['format'](_0x4d0f('0x58'))};_0x516a28[_0x4d0f('0x3c')]=_[_0x4d0f('0x3f')](_0x516a28[_0x4d0f('0x3c')],_0x479210);}_0x516a28=_[_0x4d0f('0x3f')]({},_0x516a28,_0x4bdf10['options']);return _0x19ce39[_0x4d0f('0x55')](_0x516a28);}})[_0x4d0f('0x24')](function(_0x1de09b){if(_0x1de09b){_0x2531e0=_0x1de09b[_0x4d0f('0x38')];if(!_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x52')]('nolimit')){_0x516a28[_0x4d0f('0x1d')]=qs['limit'](_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x1d')]);_0x516a28['offset']=qs[_0x4d0f('0x1b')](_0x4bdf10[_0x4d0f('0x32')][_0x4d0f('0x1b')]);}return _0x19ce39[_0x4d0f('0x55')](_0x516a28);}})['then'](function(_0x5440c4){if(_0x5440c4){return _0x5440c4?{'count':_0x2531e0,'rows':_0x5440c4}:null;}})[_0x4d0f('0x24')](respondWithResult(_0x37b700,null))['catch'](handleError(_0x37b700,null));}; \ No newline at end of file +var _0x12dd=['include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','pick','getMembers','length','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','name','options','ChatGroup','includeAll'];(function(_0x231146,_0x561e18){var _0x562350=function(_0x21d5ed){while(--_0x21d5ed){_0x231146['push'](_0x231146['shift']());}};_0x562350(++_0x561e18);}(_0x12dd,0x14b));var _0xd12d=function(_0x446414,_0x166ce3){_0x446414=_0x446414-0x0;var _0x3bbeac=_0x12dd[_0x446414];return _0x3bbeac;};'use strict';var emlformat=require(_0xd12d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd12d('0x1'));var jsonpatch=require(_0xd12d('0x2'));var rp=require(_0xd12d('0x3'));var moment=require(_0xd12d('0x4'));var BPromise=require(_0xd12d('0x5'));var Mustache=require(_0xd12d('0x6'));var util=require('util');var path=require(_0xd12d('0x7'));var sox=require(_0xd12d('0x8'));var csv=require('to-csv');var ejs=require(_0xd12d('0x9'));var fs=require('fs');var fs_extra=require(_0xd12d('0xa'));var _=require(_0xd12d('0xb'));var squel=require(_0xd12d('0xc'));var crypto=require(_0xd12d('0xd'));var jsforce=require(_0xd12d('0xe'));var deskjs=require(_0xd12d('0xf'));var toCsv=require(_0xd12d('0x10'));var querystring=require('querystring');var Papa=require(_0xd12d('0x11'));var Redis=require(_0xd12d('0x12'));var authService=require(_0xd12d('0x13'));var qs=require(_0xd12d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd12d('0x15'));var logger=require(_0xd12d('0x16'))(_0xd12d('0x17'));var utils=require(_0xd12d('0x18'));var config=require(_0xd12d('0x19'));var licenseUtil=require(_0xd12d('0x1a'));var db=require(_0xd12d('0x1b'))['db'];config[_0xd12d('0x1c')]=_['defaults'](config[_0xd12d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd12d('0x1d'))(new Redis(config[_0xd12d('0x1c')]));require(_0xd12d('0x1e'))[_0xd12d('0x1f')](socket);function respondWithStatusCode(_0x20cd55,_0x52b175){_0x52b175=_0x52b175||0xcc;return function(_0xc34984){if(_0xc34984){return _0x20cd55[_0xd12d('0x20')](_0x52b175);}return _0x20cd55[_0xd12d('0x21')](_0x52b175)[_0xd12d('0x22')]();};}function respondWithResult(_0x543be4,_0x535561){_0x535561=_0x535561||0xc8;return function(_0x191e05){if(_0x191e05){return _0x543be4[_0xd12d('0x21')](_0x535561)[_0xd12d('0x23')](_0x191e05);}};}function respondWithFilteredResult(_0x3ed8da,_0x2f3c0e){return function(_0x19f0f6){if(_0x19f0f6){var _0x546c37=typeof _0x2f3c0e[_0xd12d('0x24')]===_0xd12d('0x25')&&typeof _0x2f3c0e['limit']===_0xd12d('0x25');var _0x5ea3af=_0x19f0f6[_0xd12d('0x26')];var _0x301c84=_0x546c37?0x0:_0x2f3c0e[_0xd12d('0x24')];var _0x58ec9b=_0x546c37?_0x19f0f6[_0xd12d('0x26')]:_0x2f3c0e[_0xd12d('0x24')]+_0x2f3c0e[_0xd12d('0x27')];var _0xc6262;if(_0x58ec9b>=_0x5ea3af){_0x58ec9b=_0x5ea3af;_0xc6262=0xc8;}else{_0xc6262=0xce;}_0x3ed8da['status'](_0xc6262);return _0x3ed8da[_0xd12d('0x28')](_0xd12d('0x29'),_0x301c84+'-'+_0x58ec9b+'/'+_0x5ea3af)['json'](_0x19f0f6);}return null;};}function patchUpdates(_0x44aa31){return function(_0x31a39b){try{jsonpatch['apply'](_0x31a39b,_0x44aa31,!![]);}catch(_0x33d0b4){return BPromise[_0xd12d('0x2a')](_0x33d0b4);}return _0x31a39b[_0xd12d('0x2b')]();};}function saveUpdates(_0x4c70ef,_0x3ab3c3){return function(_0x289fce){if(_0x289fce){return _0x289fce['update'](_0x4c70ef)[_0xd12d('0x2c')](function(_0xd2fd2e){return _0xd2fd2e;});}return null;};}function removeEntity(_0x375358,_0x13a5df){return function(_0x132015){if(_0x132015){return _0x132015[_0xd12d('0x2d')]()['then'](function(){_0x375358[_0xd12d('0x21')](0xcc)[_0xd12d('0x22')]();});}};}function handleEntityNotFound(_0x34377d,_0x881470){return function(_0x7e9a4a){if(!_0x7e9a4a){_0x34377d['sendStatus'](0x194);}return _0x7e9a4a;};}function handleError(_0x22e811,_0x36f462){_0x36f462=_0x36f462||0x1f4;return function(_0x90cfdc){logger[_0xd12d('0x2e')](_0x90cfdc['stack']);if(_0x90cfdc['name']){delete _0x90cfdc['name'];}_0x22e811[_0xd12d('0x21')](_0x36f462)[_0xd12d('0x2f')](_0x90cfdc);};}exports[_0xd12d('0x30')]=function(_0x3a8e45,_0x33fa64){var _0x16b154={},_0x5a98cc={},_0x563add={'count':0x0,'rows':[]};var _0x2df34e=_[_0xd12d('0x31')](db['ChatGroup']['rawAttributes'],function(_0x4b5275){return{'name':_0x4b5275[_0xd12d('0x32')],'type':_0x4b5275[_0xd12d('0x33')]['key']};});_0x5a98cc[_0xd12d('0x34')]=_[_0xd12d('0x31')](_0x2df34e,'name');_0x5a98cc['query']=_[_0xd12d('0x35')](_0x3a8e45[_0xd12d('0x36')]);_0x5a98cc['filters']=_[_0xd12d('0x37')](_0x5a98cc[_0xd12d('0x34')],_0x5a98cc[_0xd12d('0x36')]);_0x16b154[_0xd12d('0x38')]=_[_0xd12d('0x37')](_0x5a98cc[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x39')]));_0x16b154[_0xd12d('0x38')]=_0x16b154[_0xd12d('0x38')]['length']?_0x16b154[_0xd12d('0x38')]:_0x5a98cc[_0xd12d('0x34')];if(!_0x3a8e45[_0xd12d('0x36')]['hasOwnProperty'](_0xd12d('0x3a'))){_0x16b154[_0xd12d('0x27')]=qs[_0xd12d('0x27')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x27')]);_0x16b154['offset']=qs[_0xd12d('0x24')](_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x24')]);}_0x16b154[_0xd12d('0x3b')]=qs[_0xd12d('0x3c')](_0x3a8e45[_0xd12d('0x36')]['sort']);_0x16b154[_0xd12d('0x3d')]=qs[_0xd12d('0x3e')](_['pick'](_0x3a8e45[_0xd12d('0x36')],_0x5a98cc[_0xd12d('0x3e')]),_0x2df34e);if(_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x3f')]){_0x16b154['where']=_[_0xd12d('0x40')](_0x16b154[_0xd12d('0x3d')],{'$or':_['map'](_0x2df34e,function(_0x1f1e6c){if(_0x1f1e6c[_0xd12d('0x33')]!=='VIRTUAL'){var _0x356bf7={};_0x356bf7[_0x1f1e6c[_0xd12d('0x41')]]={'$like':'%'+_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x3f')]+'%'};return _0x356bf7;}})});}_0x16b154=_[_0xd12d('0x40')]({},_0x16b154,_0x3a8e45[_0xd12d('0x42')]);var _0xf4ecca={'where':_0x16b154['where']};return db[_0xd12d('0x43')][_0xd12d('0x26')](_0xf4ecca)['then'](function(_0x109e55){_0x563add[_0xd12d('0x26')]=_0x109e55;if(_0x3a8e45[_0xd12d('0x36')][_0xd12d('0x44')]){_0x16b154[_0xd12d('0x45')]=[{'all':!![]}];}return db['ChatGroup'][_0xd12d('0x46')](_0x16b154);})[_0xd12d('0x2c')](function(_0x272984){_0x563add[_0xd12d('0x47')]=_0x272984;return _0x563add;})[_0xd12d('0x2c')](respondWithFilteredResult(_0x33fa64,_0x16b154))[_0xd12d('0x48')](handleError(_0x33fa64,null));};exports[_0xd12d('0x49')]=function(_0x1b24e0,_0x2c0f0c){var _0x1cabec={'raw':!![],'where':{'id':_0x1b24e0['params']['id']}},_0x1967ad={};_0x1967ad[_0xd12d('0x34')]=_[_0xd12d('0x35')](db['ChatGroup'][_0xd12d('0x4a')]);_0x1967ad['query']=_[_0xd12d('0x35')](_0x1b24e0[_0xd12d('0x36')]);_0x1967ad[_0xd12d('0x3e')]=_['intersection'](_0x1967ad['model'],_0x1967ad[_0xd12d('0x36')]);_0x1cabec['attributes']=_['intersection'](_0x1967ad[_0xd12d('0x34')],qs['fields'](_0x1b24e0[_0xd12d('0x36')][_0xd12d('0x39')]));_0x1cabec[_0xd12d('0x38')]=_0x1cabec['attributes']['length']?_0x1cabec['attributes']:_0x1967ad[_0xd12d('0x34')];if(_0x1b24e0['query'][_0xd12d('0x44')]){_0x1cabec['include']=[{'all':!![]}];}_0x1cabec=_[_0xd12d('0x40')]({},_0x1cabec,_0x1b24e0['options']);return db[_0xd12d('0x43')][_0xd12d('0x4b')](_0x1cabec)[_0xd12d('0x2c')](handleEntityNotFound(_0x2c0f0c,null))[_0xd12d('0x2c')](respondWithResult(_0x2c0f0c,null))[_0xd12d('0x48')](handleError(_0x2c0f0c,null));};exports['create']=function(_0x2e9f86,_0x33fb0d){return db['ChatGroup'][_0xd12d('0x4c')](_0x2e9f86['body'],{})[_0xd12d('0x2c')](respondWithResult(_0x33fb0d,0xc9))[_0xd12d('0x48')](handleError(_0x33fb0d,null));};exports[_0xd12d('0x4d')]=function(_0x6246a7,_0x527ee4){if(_0x6246a7[_0xd12d('0x4e')]['id']){delete _0x6246a7['body']['id'];}return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x6246a7['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x527ee4,null))[_0xd12d('0x2c')](saveUpdates(_0x6246a7[_0xd12d('0x4e')],null))['then'](respondWithResult(_0x527ee4,null))[_0xd12d('0x48')](handleError(_0x527ee4,null));};exports[_0xd12d('0x2d')]=function(_0x2bf44e,_0x1f7de2){return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x2bf44e[_0xd12d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f7de2,null))['then'](removeEntity(_0x1f7de2,null))[_0xd12d('0x48')](handleError(_0x1f7de2,null));};exports[_0xd12d('0x50')]=function(_0xdf029,_0x47e46d){return db[_0xd12d('0x43')]['describe']()[_0xd12d('0x2c')](respondWithResult(_0x47e46d,null))[_0xd12d('0x48')](handleError(_0x47e46d,null));};exports['getUnread']=function(_0xf1663f,_0x5cae69,_0x7aff96){return db[_0xd12d('0x51')][_0xd12d('0x26')]({'where':{'ChatGroupId':_0xf1663f[_0xd12d('0x4f')]['id'],'ToId':_0xf1663f[_0xd12d('0x52')]['id'],'read':![]}})[_0xd12d('0x2c')](function(_0x3c5baa){return{'id':_[_0xd12d('0x53')](_0xf1663f[_0xd12d('0x4f')]['id']),'count':_0x3c5baa};})[_0xd12d('0x2c')](respondWithResult(_0x5cae69,null))['catch'](handleError(_0x5cae69,null));};exports[_0xd12d('0x54')]=function(_0x34f8c4,_0x484781,_0x38d671){return db['ChatGroup'][_0xd12d('0x4b')]({'where':{'id':_0x34f8c4[_0xd12d('0x4f')]['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x484781,null))['then'](function(_0x5c8ad4){if(_0x5c8ad4){return _0x5c8ad4[_0xd12d('0x54')](_0x34f8c4[_0xd12d('0x4e')][_0xd12d('0x55')],_[_0xd12d('0x56')](_0x34f8c4[_0xd12d('0x4e')],['ids','id'])||{});}})[_0xd12d('0x2c')](respondWithResult(_0x484781,null))['catch'](handleError(_0x484781,null));};exports['getMembers']=function(_0x122fae,_0x5b6e09,_0x3b9e8d){var _0x1d1648={};var _0xd11b81={};var _0x4cc63d;var _0x34b1e5;return db[_0xd12d('0x43')][_0xd12d('0x57')]({'where':{'id':_0x122fae['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x5b6e09,null))[_0xd12d('0x2c')](function(_0x57fed0){if(_0x57fed0){_0x4cc63d=_0x57fed0;_0xd11b81['model']=_['keys'](db[_0xd12d('0x58')][_0xd12d('0x4a')]);_0xd11b81[_0xd12d('0x36')]=_[_0xd12d('0x35')](_0x122fae[_0xd12d('0x36')]);_0xd11b81[_0xd12d('0x3e')]=_[_0xd12d('0x37')](_0xd11b81[_0xd12d('0x34')],_0xd11b81[_0xd12d('0x36')]);_0x1d1648[_0xd12d('0x38')]=_[_0xd12d('0x37')](_0xd11b81[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x122fae[_0xd12d('0x36')][_0xd12d('0x39')]));_0x1d1648[_0xd12d('0x38')]=_0x1d1648[_0xd12d('0x38')]['length']?_0x1d1648[_0xd12d('0x38')]:_0xd11b81[_0xd12d('0x34')];_0x1d1648[_0xd12d('0x3b')]=qs['sort'](_0x122fae['query'][_0xd12d('0x3c')]);_0x1d1648[_0xd12d('0x3d')]=qs[_0xd12d('0x3e')](_[_0xd12d('0x59')](_0x122fae[_0xd12d('0x36')],_0xd11b81[_0xd12d('0x3e')]));if(_0x122fae[_0xd12d('0x36')]['filter']){_0x1d1648[_0xd12d('0x3d')]=_[_0xd12d('0x40')](_0x1d1648[_0xd12d('0x3d')],{'$or':_[_0xd12d('0x31')](_0x1d1648[_0xd12d('0x38')],function(_0x792ff){var _0x124074={};_0x124074[_0x792ff]={'$like':'%'+_0x122fae[_0xd12d('0x36')][_0xd12d('0x3f')]+'%'};return _0x124074;})});}_0x1d1648=_[_0xd12d('0x40')]({},_0x1d1648,_0x122fae[_0xd12d('0x42')]);return _0x4cc63d[_0xd12d('0x5a')](_0x1d1648);}})[_0xd12d('0x2c')](function(_0x6b954e){if(_0x6b954e){_0x34b1e5=_0x6b954e[_0xd12d('0x5b')];if(!_0x122fae[_0xd12d('0x36')][_0xd12d('0x5c')](_0xd12d('0x3a'))){_0x1d1648[_0xd12d('0x27')]=qs['limit'](_0x122fae[_0xd12d('0x36')][_0xd12d('0x27')]);_0x1d1648[_0xd12d('0x24')]=qs[_0xd12d('0x24')](_0x122fae['query'][_0xd12d('0x24')]);}return _0x4cc63d[_0xd12d('0x5a')](_0x1d1648);}})[_0xd12d('0x2c')](function(_0x4a4843){if(_0x4a4843){return _0x4a4843?{'count':_0x34b1e5,'rows':_0x4a4843}:null;}})[_0xd12d('0x2c')](respondWithResult(_0x5b6e09,null))[_0xd12d('0x48')](handleError(_0x5b6e09,null));};exports['removeMembers']=function(_0x49abf4,_0x487ecc,_0x342b4d){return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x49abf4['params']['id']}})['then'](handleEntityNotFound(_0x487ecc,null))[_0xd12d('0x2c')](function(_0x1694f9){if(_0x1694f9){return _0x1694f9[_0xd12d('0x5d')](_0x49abf4[_0xd12d('0x36')][_0xd12d('0x55')]);}})[_0xd12d('0x2c')](respondWithStatusCode(_0x487ecc,null))[_0xd12d('0x48')](handleError(_0x487ecc,null));};exports[_0xd12d('0x5e')]=function(_0x34135e,_0xd4d85c,_0x25c86c){if(_0x34135e[_0xd12d('0x4e')]['id']){delete _0x34135e[_0xd12d('0x4e')]['id'];}return db[_0xd12d('0x43')][_0xd12d('0x4b')]({'where':{'id':_0x34135e['params']['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0xd4d85c,null))[_0xd12d('0x2c')](function(_0x210541){if(_0x210541){_0x34135e[_0xd12d('0x4e')][_0xd12d('0x5f')]=_0x210541['id'];return db[_0xd12d('0x51')][_0xd12d('0x4c')](_0x34135e[_0xd12d('0x4e')]);}})[_0xd12d('0x2c')](respondWithResult(_0xd4d85c,null))['catch'](handleError(_0xd4d85c,null));};exports[_0xd12d('0x60')]=function(_0x1e22b7,_0x3527b2,_0x53b7f0){var _0x5f034a={};var _0x38be77={};var _0x4f46bc;var _0x43802e;return db[_0xd12d('0x43')]['findOne']({'where':{'id':_0x1e22b7[_0xd12d('0x4f')]['id']}})[_0xd12d('0x2c')](handleEntityNotFound(_0x3527b2,null))[_0xd12d('0x2c')](function(_0x56a7b6){if(_0x56a7b6){_0x4f46bc=_0x56a7b6;_0x38be77['model']=_[_0xd12d('0x35')](db['ChatInternalMessage'][_0xd12d('0x4a')]);_0x38be77[_0xd12d('0x36')]=_[_0xd12d('0x35')](_0x1e22b7['query']);_0x38be77[_0xd12d('0x3e')]=_[_0xd12d('0x37')](_0x38be77['model'],_0x38be77['query']);_0x5f034a[_0xd12d('0x38')]=_['intersection'](_0x38be77[_0xd12d('0x34')],qs[_0xd12d('0x39')](_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x39')]));_0x5f034a[_0xd12d('0x38')]=_0x5f034a[_0xd12d('0x38')][_0xd12d('0x5b')]?_0x5f034a[_0xd12d('0x38')]:_0x38be77['model'];_0x5f034a['order']=qs['sort'](_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x3c')]);_0x5f034a[_0xd12d('0x3d')]=qs['filters'](_['pick'](_0x1e22b7[_0xd12d('0x36')],_0x38be77[_0xd12d('0x3e')]));if(_0x1e22b7['query']['filter']){_0x5f034a[_0xd12d('0x3d')]=_[_0xd12d('0x40')](_0x5f034a[_0xd12d('0x3d')],{'$or':_[_0xd12d('0x31')](_0x5f034a[_0xd12d('0x38')],function(_0x4600f7){var _0x4e6f7b={};_0x4e6f7b[_0x4600f7]={'$like':'%'+_0x1e22b7['query'][_0xd12d('0x3f')]+'%'};return _0x4e6f7b;})});}if(_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x61')]){var _0xea625d=_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x61')]['split'](',');var _0x455748={};_0x455748[_0xea625d[0x0]]={'$gte':moment(_0xea625d[0x1])[_0xd12d('0x62')](_0xd12d('0x63'))};_0x5f034a[_0xd12d('0x3d')]=_['merge'](_0x5f034a[_0xd12d('0x3d')],_0x455748);}_0x5f034a=_[_0xd12d('0x40')]({},_0x5f034a,_0x1e22b7[_0xd12d('0x42')]);return _0x4f46bc[_0xd12d('0x60')](_0x5f034a);}})['then'](function(_0x52a426){if(_0x52a426){_0x43802e=_0x52a426[_0xd12d('0x5b')];if(!_0x1e22b7[_0xd12d('0x36')][_0xd12d('0x5c')](_0xd12d('0x3a'))){_0x5f034a[_0xd12d('0x27')]=qs['limit'](_0x1e22b7[_0xd12d('0x36')]['limit']);_0x5f034a[_0xd12d('0x24')]=qs[_0xd12d('0x24')](_0x1e22b7[_0xd12d('0x36')]['offset']);}return _0x4f46bc[_0xd12d('0x60')](_0x5f034a);}})[_0xd12d('0x2c')](function(_0x3c5c28){if(_0x3c5c28){return _0x3c5c28?{'count':_0x43802e,'rows':_0x3c5c28}:null;}})[_0xd12d('0x2c')](respondWithResult(_0x3527b2,null))[_0xd12d('0x48')](handleError(_0x3527b2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5de20b8..7802af4 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 _0xd739=['../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x516035,_0xd61e86){var _0x3e5c18=function(_0x46ccac){while(--_0x46ccac){_0x516035['push'](_0x516035['shift']());}};_0x3e5c18(++_0xd61e86);}(_0xd739,0x135));var _0x9d73=function(_0x35f44a,_0x2603b9){_0x35f44a=_0x35f44a-0x0;var _0x26d8c5=_0xd739[_0x35f44a];return _0x26d8c5;};'use strict';var EventEmitter=require(_0x9d73('0x0'));var ChatGroup=require(_0x9d73('0x1'))['db'][_0x9d73('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9d73('0x3')](0x0);var events={'afterCreate':_0x9d73('0x4'),'afterUpdate':'update','afterDestroy':_0x9d73('0x5')};function emitEvent(_0x40263b){return function(_0x29696b,_0x4ff94d,_0x516f96){ChatGroupEvents[_0x9d73('0x6')](_0x40263b+':'+_0x29696b['id'],_0x29696b);ChatGroupEvents[_0x9d73('0x6')](_0x40263b,_0x29696b);_0x516f96(null);};}for(var e in events){if(events[_0x9d73('0x7')](e)){var event=events[e];ChatGroup[_0x9d73('0x8')](e,emitEvent(event));}}module[_0x9d73('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x7e74=['events','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5930ba,_0x325f6f){var _0x4899a9=function(_0x125131){while(--_0x125131){_0x5930ba['push'](_0x5930ba['shift']());}};_0x4899a9(++_0x325f6f);}(_0x7e74,0xbd));var _0x47e7=function(_0x5a74d2,_0x23fe51){_0x5a74d2=_0x5a74d2-0x0;var _0x17d102=_0x7e74[_0x5a74d2];return _0x17d102;};'use strict';var EventEmitter=require(_0x47e7('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x47e7('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x47e7('0x2')](0x0);var events={'afterCreate':_0x47e7('0x3'),'afterUpdate':_0x47e7('0x4'),'afterDestroy':_0x47e7('0x5')};function emitEvent(_0x548d8b){return function(_0x2f084c,_0x75f99d,_0xb4dd0){ChatGroupEvents[_0x47e7('0x6')](_0x548d8b+':'+_0x2f084c['id'],_0x2f084c);ChatGroupEvents[_0x47e7('0x6')](_0x548d8b,_0x2f084c);_0xb4dd0(null);};}for(var e in events){if(events[_0x47e7('0x7')](e)){var event=events[e];ChatGroup[_0x47e7('0x8')](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 45f5255..bf3ed81 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 _0x4e9d=['api','moment','bluebird','request-promise','path','../../config/environment','./chatGroup.attributes','define','ChatGroup','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e9d,0x1a1));var _0xd4e9=function(_0x5d10c2,_0x4b0a49){_0x5d10c2=_0x5d10c2-0x0;var _0x57c7c4=_0x4e9d[_0x5d10c2];return _0x57c7c4;};'use strict';var _=require(_0xd4e9('0x0'));var util=require(_0xd4e9('0x1'));var logger=require(_0xd4e9('0x2'))(_0xd4e9('0x3'));var moment=require(_0xd4e9('0x4'));var BPromise=require(_0xd4e9('0x5'));var rp=require(_0xd4e9('0x6'));var fs=require('fs');var path=require(_0xd4e9('0x7'));var rimraf=require('rimraf');var config=require(_0xd4e9('0x8'));var attributes=require(_0xd4e9('0x9'));module['exports']=function(_0x4700b8,_0x17305e){return _0x4700b8[_0xd4e9('0xa')](_0xd4e9('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4637=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x6d76e8,_0x3a5b96){var _0x10a933=function(_0xcca43b){while(--_0xcca43b){_0x6d76e8['push'](_0x6d76e8['shift']());}};_0x10a933(++_0x3a5b96);}(_0x4637,0x114));var _0x7463=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x4637[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x7463('0x0'));var util=require('util');var logger=require(_0x7463('0x1'))('api');var moment=require(_0x7463('0x2'));var BPromise=require(_0x7463('0x3'));var rp=require(_0x7463('0x4'));var fs=require('fs');var path=require(_0x7463('0x5'));var rimraf=require(_0x7463('0x6'));var config=require(_0x7463('0x7'));var attributes=require(_0x7463('0x8'));module[_0x7463('0x9')]=function(_0x3d5a76,_0x4ec237){return _0x3d5a76[_0x7463('0xa')](_0x7463('0xb'),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 25b3784..456a2bc 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 _0x01e7=['lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch'];(function(_0x796a02,_0x19c78d){var _0x1ef784=function(_0x32f2b8){while(--_0x32f2b8){_0x796a02['push'](_0x796a02['shift']());}};_0x1ef784(++_0x19c78d);}(_0x01e7,0x134));var _0x701e=function(_0x7ae17,_0x4e3207){_0x7ae17=_0x7ae17-0x0;var _0x286bb8=_0x01e7[_0x7ae17];return _0x286bb8;};'use strict';var _=require(_0x701e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x701e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x701e('0x2'))['db'];var utils=require(_0x701e('0x3'));var logger=require(_0x701e('0x4'))('rpc');var config=require(_0x701e('0x5'));var jayson=require(_0x701e('0x6'));var client=jayson[_0x701e('0x7')][_0x701e('0x8')]({'port':0x232a});config['redis']=_[_0x701e('0x9')](config[_0x701e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x701e('0xb'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x701e('0xc')](socket);function respondWithRpcPromise(_0x595771,_0x111b7e,_0x529fa7){return new BPromise(function(_0x2236d5,_0x2ef2b1){return client['request'](_0x595771,_0x529fa7)[_0x701e('0xd')](function(_0x5e3f62){logger['info'](_0x701e('0xe'),_0x111b7e,_0x701e('0xf'));logger[_0x701e('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x111b7e,_0x701e('0xf'),JSON[_0x701e('0x11')](_0x5e3f62));if(_0x5e3f62[_0x701e('0x12')]){if(_0x5e3f62[_0x701e('0x12')]['code']===0x1f4){logger[_0x701e('0x12')](_0x701e('0xe'),_0x111b7e,_0x5e3f62[_0x701e('0x12')][_0x701e('0x13')]);return _0x2ef2b1(_0x5e3f62[_0x701e('0x12')][_0x701e('0x13')]);}logger[_0x701e('0x12')](_0x701e('0xe'),_0x111b7e,_0x5e3f62[_0x701e('0x12')][_0x701e('0x13')]);return _0x2236d5(_0x5e3f62[_0x701e('0x12')][_0x701e('0x13')]);}else{logger[_0x701e('0x14')](_0x701e('0xe'),_0x111b7e,_0x701e('0xf'));_0x2236d5(_0x5e3f62['result'][_0x701e('0x13')]);}})[_0x701e('0x15')](function(_0x150a70){logger[_0x701e('0x12')]('ChatGroup,\x20%s,\x20%s',_0x111b7e,_0x150a70);_0x2ef2b1(_0x150a70);});});} \ No newline at end of file +var _0x536e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x536e,0x155));var _0xe536=function(_0x5b7696,_0x3ebd92){_0x5b7696=_0x5b7696-0x0;var _0x42d7b9=_0x536e[_0x5b7696];return _0x42d7b9;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var rs=require(_0xe536('0x4'));var fs=require('fs');var Redis=require(_0xe536('0x5'));var db=require(_0xe536('0x6'))['db'];var utils=require(_0xe536('0x7'));var logger=require(_0xe536('0x8'))(_0xe536('0x9'));var config=require(_0xe536('0xa'));var jayson=require(_0xe536('0xb'));var client=jayson[_0xe536('0xc')][_0xe536('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe536('0xe')],{'host':_0xe536('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe536('0xe')]));require(_0xe536('0x10'))[_0xe536('0x11')](socket);function respondWithRpcPromise(_0x1d9dcd,_0x2581df,_0x1df409){return new BPromise(function(_0xe08ef0,_0x507dad){return client['request'](_0x1d9dcd,_0x1df409)[_0xe536('0x12')](function(_0xbec6ca){logger['info'](_0xe536('0x13'),_0x2581df,_0xe536('0x14'));logger[_0xe536('0x15')](_0xe536('0x16'),_0x2581df,_0xe536('0x14'),JSON[_0xe536('0x17')](_0xbec6ca));if(_0xbec6ca['error']){if(_0xbec6ca[_0xe536('0x18')][_0xe536('0x19')]===0x1f4){logger[_0xe536('0x18')](_0xe536('0x13'),_0x2581df,_0xbec6ca[_0xe536('0x18')]['message']);return _0x507dad(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}logger[_0xe536('0x18')]('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);return _0xe08ef0(_0xbec6ca[_0xe536('0x18')][_0xe536('0x1a')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2581df,_0xe536('0x14'));_0xe08ef0(_0xbec6ca[_0xe536('0x1b')][_0xe536('0x1a')]);}})[_0xe536('0x1c')](function(_0x4f6eb2){logger['error'](_0xe536('0x13'),_0x2581df,_0x4f6eb2);_0x507dad(_0x4f6eb2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 65c2b2a..538d146 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 _0x34c5=['remove','update','emit','removeListener','length','chatGroup:','./chatGroup.events','save'];(function(_0x100398,_0x2e8080){var _0x51fef4=function(_0x5b567b){while(--_0x5b567b){_0x100398['push'](_0x100398['shift']());}};_0x51fef4(++_0x2e8080);}(_0x34c5,0x76));var _0x534c=function(_0x37d72f,_0x10116f){_0x37d72f=_0x37d72f-0x0;var _0x22bb4c=_0x34c5[_0x37d72f];return _0x22bb4c;};'use strict';var ChatGroupEvents=require(_0x534c('0x0'));var events=[_0x534c('0x1'),_0x534c('0x2'),_0x534c('0x3')];function createListener(_0x402d4a,_0x9cc313){return function(_0x3e591f){_0x9cc313[_0x534c('0x4')](_0x402d4a,_0x3e591f);};}function removeListener(_0x414bc0,_0x37081b){return function(){ChatGroupEvents[_0x534c('0x5')](_0x414bc0,_0x37081b);};}exports['register']=function(_0x53afda){for(var _0x17db65=0x0,_0x8d5d84=events[_0x534c('0x6')];_0x17db65<_0x8d5d84;_0x17db65++){var _0x57ce6b=events[_0x17db65];var _0x243b87=createListener(_0x534c('0x7')+_0x57ce6b,_0x53afda);ChatGroupEvents['on'](_0x57ce6b,_0x243b87);}}; \ No newline at end of file +var _0x57a9=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x5ace25,_0x536239){var _0x4ba17a=function(_0x1ee54e){while(--_0x1ee54e){_0x5ace25['push'](_0x5ace25['shift']());}};_0x4ba17a(++_0x536239);}(_0x57a9,0x1d5));var _0x957a=function(_0x4e8659,_0x8d6bc6){_0x4e8659=_0x4e8659-0x0;var _0x44d415=_0x57a9[_0x4e8659];return _0x44d415;};'use strict';var ChatGroupEvents=require(_0x957a('0x0'));var events=[_0x957a('0x1'),_0x957a('0x2'),_0x957a('0x3')];function createListener(_0x6d6b35,_0x4ac365){return function(_0x533099){_0x4ac365['emit'](_0x6d6b35,_0x533099);};}function removeListener(_0xc92e85,_0x46b7a7){return function(){ChatGroupEvents[_0x957a('0x4')](_0xc92e85,_0x46b7a7);};}exports[_0x957a('0x5')]=function(_0x34e441){for(var _0x491a34=0x0,_0x9766f=events[_0x957a('0x6')];_0x491a34<_0x9766f;_0x491a34++){var _0x281f42=events[_0x491a34];var _0x55d88f=createListener(_0x957a('0x7')+_0x281f42,_0x34e441);ChatGroupEvents['on'](_0x281f42,_0x55d88f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index b923d9c..8af2921 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 _0x9b2a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b2a,0x1ee));var _0xa9b2=function(_0x4d3df5,_0x5992c1){_0x4d3df5=_0x4d3df5-0x0;var _0x48f386=_0x9b2a[_0x4d3df5];return _0x48f386;};'use strict';var multer=require(_0xa9b2('0x0'));var util=require(_0xa9b2('0x1'));var path=require(_0xa9b2('0x2'));var timeout=require(_0xa9b2('0x3'));var express=require(_0xa9b2('0x4'));var router=express[_0xa9b2('0x5')]();var fs_extra=require(_0xa9b2('0x6'));var auth=require(_0xa9b2('0x7'));var interaction=require(_0xa9b2('0x8'));var config=require(_0xa9b2('0x9'));var controller=require(_0xa9b2('0xa'));router[_0xa9b2('0xb')]('/',auth[_0xa9b2('0xc')](),controller['index']);router['get'](_0xa9b2('0xd'),auth[_0xa9b2('0xc')](),controller[_0xa9b2('0xe')]);router[_0xa9b2('0xb')](_0xa9b2('0xf'),auth[_0xa9b2('0xc')](),controller['show']);router[_0xa9b2('0xb')](_0xa9b2('0x10'),auth[_0xa9b2('0xc')](),controller[_0xa9b2('0x11')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xa9b2('0x12')]);router[_0xa9b2('0xb')](_0xa9b2('0x13'),auth['isAuthenticated'](),controller[_0xa9b2('0x14')]);router[_0xa9b2('0x15')]('/',auth[_0xa9b2('0xc')](),controller[_0xa9b2('0x16')]);router[_0xa9b2('0x15')]('/:id/members',auth['isAuthenticated'](),controller[_0xa9b2('0x17')]);router['post'](_0xa9b2('0x13'),auth[_0xa9b2('0xc')](),controller['addMessage']);router[_0xa9b2('0x18')](_0xa9b2('0xf'),auth[_0xa9b2('0xc')](),controller[_0xa9b2('0x19')]);router[_0xa9b2('0x1a')](_0xa9b2('0xf'),auth[_0xa9b2('0xc')](),controller[_0xa9b2('0x1b')]);router['delete']('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xa9b2('0x1c')]=router; \ No newline at end of file +var _0x4059=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','put'];(function(_0x43da28,_0x223efe){var _0x2c26a5=function(_0x4724b7){while(--_0x4724b7){_0x43da28['push'](_0x43da28['shift']());}};_0x2c26a5(++_0x223efe);}(_0x4059,0x1be));var _0x9405=function(_0x4a8ab9,_0x5615d3){_0x4a8ab9=_0x4a8ab9-0x0;var _0x22ce40=_0x4059[_0x4a8ab9];return _0x22ce40;};'use strict';var multer=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var path=require(_0x9405('0x2'));var timeout=require(_0x9405('0x3'));var express=require(_0x9405('0x4'));var router=express['Router']();var fs_extra=require(_0x9405('0x5'));var auth=require(_0x9405('0x6'));var interaction=require(_0x9405('0x7'));var config=require(_0x9405('0x8'));var controller=require('./chatGroup.controller');router[_0x9405('0x9')]('/',auth[_0x9405('0xa')](),controller[_0x9405('0xb')]);router[_0x9405('0x9')](_0x9405('0xc'),auth[_0x9405('0xa')](),controller['describe']);router[_0x9405('0x9')](_0x9405('0xd'),auth[_0x9405('0xa')](),controller[_0x9405('0xe')]);router[_0x9405('0x9')](_0x9405('0xf'),auth[_0x9405('0xa')](),controller[_0x9405('0x10')]);router[_0x9405('0x9')](_0x9405('0x11'),auth[_0x9405('0xa')](),controller[_0x9405('0x12')]);router[_0x9405('0x9')](_0x9405('0x13'),auth[_0x9405('0xa')](),controller['getMessages']);router[_0x9405('0x14')]('/',auth[_0x9405('0xa')](),controller['create']);router['post'](_0x9405('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0x9405('0x14')]('/:id/messages',auth[_0x9405('0xa')](),controller['addMessage']);router[_0x9405('0x15')](_0x9405('0xd'),auth[_0x9405('0xa')](),controller[_0x9405('0x16')]);router[_0x9405('0x17')]('/:id',auth[_0x9405('0xa')](),controller[_0x9405('0x18')]);router[_0x9405('0x17')](_0x9405('0x11'),auth[_0x9405('0xa')](),controller['removeMembers']);module[_0x9405('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index d6641f8..854c3d8 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 _0x8c90=['INTEGER','star','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN'];(function(_0x51b8eb,_0x45e664){var _0x219949=function(_0x21d965){while(--_0x21d965){_0x51b8eb['push'](_0x51b8eb['shift']());}};_0x219949(++_0x45e664);}(_0x8c90,0x6a));var _0x08c9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8c90[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x08c9('0x0'));module['exports']={'closed':{'type':Sequelize[_0x08c9('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x08c9('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x08c9('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x08c9('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x08c9('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x08c9('0x6')]},'disposition':{'type':Sequelize[_0x08c9('0x5')]},'secondDisposition':{'type':Sequelize[_0x08c9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x08c9('0x5')]},'note':{'type':Sequelize[_0x08c9('0x5')]},'browserName':{'type':Sequelize[_0x08c9('0x5')]},'browserVersion':{'type':Sequelize[_0x08c9('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x08c9('0x5')]},'deviceModel':{'type':Sequelize[_0x08c9('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x08c9('0x5')]},'referer':{'type':Sequelize[_0x08c9('0x4')]},'customerIp':{'type':Sequelize[_0x08c9('0x5')]},'formData':{'type':Sequelize[_0x08c9('0x4')](_0x08c9('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x08c9('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x08c9('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x08c9('0x5')]},'customerPort':{'type':Sequelize[_0x08c9('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x08c9('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x08c9('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x08c9('0x2')]}}; \ No newline at end of file +var _0x2805=['DATE','long','out','INTEGER','exports','BOOLEAN','star','thumb','TEXT','STRING'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2805,0x13a));var _0x5280=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x2805[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require('sequelize');module[_0x5280('0x0')]={'closed':{'type':Sequelize[_0x5280('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x5280('0x2'),_0x5280('0x3')),'defaultValue':_0x5280('0x2')},'ratingMessage':{'type':Sequelize[_0x5280('0x4')]},'pathTranscript':{'type':Sequelize[_0x5280('0x4')]},'mailTranscript':{'type':Sequelize[_0x5280('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5280('0x6')]},'disposition':{'type':Sequelize[_0x5280('0x5')]},'secondDisposition':{'type':Sequelize[_0x5280('0x5')]},'thirdDisposition':{'type':Sequelize[_0x5280('0x5')]},'note':{'type':Sequelize[_0x5280('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x5280('0x5')]},'osName':{'type':Sequelize[_0x5280('0x5')]},'osVersion':{'type':Sequelize[_0x5280('0x5')]},'deviceModel':{'type':Sequelize[_0x5280('0x5')]},'deviceVendor':{'type':Sequelize[_0x5280('0x5')]},'deviceType':{'type':Sequelize[_0x5280('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x5280('0x5')]},'formData':{'type':Sequelize[_0x5280('0x4')](_0x5280('0x7'))},'read1stAt':{'type':Sequelize[_0x5280('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5280('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x5280('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x5280('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x5280('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5280('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5020c2c..226ea18 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 _0xbed9=['YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','hasOwnProperty','filter','secret','includeAgent','push','alias','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','read','Account','Owner','get','mkdirSync','N.A.','closedAt','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','params','model','keys','filters','attributes','intersection','fields','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooApiKey','user','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','file','filename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','now','pathTranscript','CmContact','ContactId','Messages','length','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','User','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','sort','where','pick','ChatInteractionId','$gte'];(function(_0x51bef8,_0x101d36){var _0x4574a9=function(_0x4029a6){while(--_0x4029a6){_0x51bef8['push'](_0x51bef8['shift']());}};_0x4574a9(++_0x101d36);}(_0xbed9,0x100));var _0x9bed=function(_0xe17f3d,_0x363e1a){_0xe17f3d=_0xe17f3d-0x0;var _0x4e716d=_0xbed9[_0xe17f3d];return _0x4e716d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9bed('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9bed('0x1'));var Mustache=require(_0x9bed('0x2'));var util=require(_0x9bed('0x3'));var path=require(_0x9bed('0x4'));var ejs=require(_0x9bed('0x5'));var fs=require('fs');var _=require(_0x9bed('0x6'));var Redis=require(_0x9bed('0x7'));var interaction=require(_0x9bed('0x8'));var qs=require(_0x9bed('0x9'));var pdf=require(_0x9bed('0xa'));var logger=require('../../config/logger')('api');var config=require(_0x9bed('0xb'));var db=require(_0x9bed('0xc'))['db'];config[_0x9bed('0xd')]=_[_0x9bed('0xe')](config[_0x9bed('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bed('0xf'))(new Redis(config['redis']));require(_0x9bed('0x10'))[_0x9bed('0x11')](socket);var jayson=require(_0x9bed('0x12'));var client=jayson[_0x9bed('0x13')][_0x9bed('0x14')]({'port':0x232b});var client9004=jayson['client'][_0x9bed('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x503610,_0x22a00a,_0xda127f,_0x3a4501){return new BPromise(function(_0x34c01f,_0x12adae){var _0x3c52d4=_0x3a4501||client;return _0x3c52d4[_0x9bed('0x15')](_0x503610,_0xda127f)[_0x9bed('0x16')](function(_0x266d3e){logger[_0x9bed('0x17')](_0x9bed('0x18'),_0x22a00a,_0x9bed('0x19'));logger[_0x9bed('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x22a00a,'request\x20sent',JSON['stringify'](_0x266d3e));if(_0x266d3e[_0x9bed('0x1b')]){if(_0x266d3e[_0x9bed('0x1b')]['code']===0x1f4){logger['error'](_0x9bed('0x18'),_0x22a00a,_0x266d3e[_0x9bed('0x1b')][_0x9bed('0x1c')]);return _0x12adae(_0x266d3e[_0x9bed('0x1b')]['message']);}logger[_0x9bed('0x1b')](_0x9bed('0x18'),_0x22a00a,_0x266d3e[_0x9bed('0x1b')]['message']);return _0x34c01f(_0x266d3e[_0x9bed('0x1b')][_0x9bed('0x1c')]);}else{logger[_0x9bed('0x17')](_0x9bed('0x18'),_0x22a00a,_0x9bed('0x19'));_0x34c01f(_0x266d3e[_0x9bed('0x1d')][_0x9bed('0x1c')]);}})[_0x9bed('0x1e')](function(_0x3753c7){logger[_0x9bed('0x1b')](_0x9bed('0x18'),_0x22a00a,_0x3753c7);_0x12adae(_0x3753c7);});});}function respondWithStatusCode(_0x384f31,_0x5c61c4){_0x5c61c4=_0x5c61c4||0xcc;return function(_0x44f62e){if(_0x44f62e){return _0x384f31[_0x9bed('0x1f')](_0x5c61c4);}return _0x384f31['status'](_0x5c61c4)[_0x9bed('0x20')]();};}function respondWithResult(_0x99994,_0x4ffe51){_0x4ffe51=_0x4ffe51||0xc8;return function(_0x92b2a8){if(_0x92b2a8){return _0x99994[_0x9bed('0x21')](_0x4ffe51)[_0x9bed('0x22')](_0x92b2a8);}};}function respondWithFilteredResult(_0x326062,_0x50390b){return function(_0x3e0d2b){if(_0x3e0d2b){var _0x4c96f0=typeof _0x50390b[_0x9bed('0x23')]===_0x9bed('0x24')&&typeof _0x50390b['limit']===_0x9bed('0x24');var _0x4b0ddd=_0x3e0d2b[_0x9bed('0x25')];var _0x5bf833=_0x4c96f0?0x0:_0x50390b['offset'];var _0x37acf8=_0x4c96f0?_0x3e0d2b[_0x9bed('0x25')]:_0x50390b['offset']+_0x50390b[_0x9bed('0x26')];var _0x232ce0;if(_0x37acf8>=_0x4b0ddd){_0x37acf8=_0x4b0ddd;_0x232ce0=0xc8;}else{_0x232ce0=0xce;}_0x326062['status'](_0x232ce0);return _0x326062[_0x9bed('0x27')](_0x9bed('0x28'),_0x5bf833+'-'+_0x37acf8+'/'+_0x4b0ddd)['json'](_0x3e0d2b);}return null;};}function saveUpdates(_0x5df86a){return function(_0x3dd486){if(_0x3dd486){return _0x3dd486[_0x9bed('0x29')](_0x5df86a)[_0x9bed('0x16')](function(_0x2f63c8){return _0x2f63c8;});}return null;};}function removeEntity(_0x28eb1e){return function(_0x39c2b8){if(_0x39c2b8){return _0x39c2b8[_0x9bed('0x2a')]()[_0x9bed('0x16')](function(){_0x28eb1e[_0x9bed('0x21')](0xcc)[_0x9bed('0x20')]();});}};}function handleEntityNotFound(_0x171dcc){return function(_0x2648c3){if(!_0x2648c3){_0x171dcc[_0x9bed('0x1f')](0x194);}return _0x2648c3;};}function handleError(_0x2c3927,_0x3d274f){_0x3d274f=_0x3d274f||0x1f4;return function(_0x1a9574){logger[_0x9bed('0x1b')](_0x1a9574[_0x9bed('0x2b')]);if(_0x1a9574['name']){delete _0x1a9574[_0x9bed('0x2c')];}_0x2c3927['status'](_0x3d274f)['send'](_0x1a9574);};}function getMustacheRender(_0x1c02d0,_0x11e13b){return Mustache[_0x9bed('0x2d')](_0x1c02d0,_[_0x9bed('0x2e')](_0x11e13b[_0x9bed('0x2f')],{'contact':_0x11e13b[_0x9bed('0x30')],'message':_0x11e13b[_0x9bed('0x1c')],'agent':_0x11e13b[_0x9bed('0x31')],'interaction':_0x11e13b[_0x9bed('0x32')],'account':_0x11e13b[_0x9bed('0x33')]}))||'';}exports[_0x9bed('0x34')]=function(_0x28c060,_0x2f978b){var _0x33be7a={};var _0x34ce26=_[_0x9bed('0x35')](db[_0x9bed('0x36')][_0x9bed('0x37')],function(_0x5975c6){return{'name':_0x5975c6[_0x9bed('0x38')],'type':_0x5975c6[_0x9bed('0x39')][_0x9bed('0x3a')]};});_0x33be7a=qs[_0x9bed('0x3b')](_0x34ce26,_0x28c060);return interaction[_0x9bed('0x3c')](_0x9bed('0x3d'),_0x28c060[_0x9bed('0x3e')],_0x28c060['user'],_0x33be7a,_0x34ce26)['then'](respondWithFilteredResult(_0x2f978b,_0x33be7a))[_0x9bed('0x1e')](handleError(_0x2f978b,null));};exports['show']=function(_0x208368,_0xe4edd){var _0x317c27={'raw':![],'where':{'id':_0x208368[_0x9bed('0x3f')]['id']}},_0x6e3aef={};_0x6e3aef[_0x9bed('0x40')]=_[_0x9bed('0x41')](db[_0x9bed('0x36')]['rawAttributes']);_0x6e3aef[_0x9bed('0x3e')]=_[_0x9bed('0x41')](_0x208368[_0x9bed('0x3e')]);_0x6e3aef[_0x9bed('0x42')]=_['intersection'](_0x6e3aef[_0x9bed('0x40')],_0x6e3aef['query']);_0x317c27[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x6e3aef[_0x9bed('0x40')],qs[_0x9bed('0x45')](_0x208368['query'][_0x9bed('0x45')]));_0x317c27[_0x9bed('0x43')]=_0x317c27[_0x9bed('0x43')]['length']?_0x317c27[_0x9bed('0x43')]:_0x6e3aef['model'];if(_0x208368[_0x9bed('0x3e')][_0x9bed('0x46')]){_0x317c27[_0x9bed('0x47')]=[{'all':!![]}];}_0x317c27=_[_0x9bed('0x2e')]({},_0x317c27,_0x208368[_0x9bed('0x48')]);return db[_0x9bed('0x36')][_0x9bed('0x49')](_0x317c27)[_0x9bed('0x16')](handleEntityNotFound(_0xe4edd,null))[_0x9bed('0x16')](respondWithResult(_0xe4edd,null))[_0x9bed('0x1e')](handleError(_0xe4edd,null));};exports[_0x9bed('0x4a')]=function(_0x16365d,_0x4a9fd3){return db[_0x9bed('0x36')][_0x9bed('0x4a')](_0x16365d[_0x9bed('0x2f')],{})[_0x9bed('0x16')](respondWithResult(_0x4a9fd3,0xc9))[_0x9bed('0x1e')](handleError(_0x4a9fd3,null));};exports['update']=function(_0x5bbfd1,_0x482279){if(_0x5bbfd1[_0x9bed('0x2f')]['id']){delete _0x5bbfd1[_0x9bed('0x2f')]['id'];}return db['ChatInteraction'][_0x9bed('0x49')]({'where':{'id':_0x5bbfd1[_0x9bed('0x3f')]['id']}})[_0x9bed('0x16')](handleEntityNotFound(_0x482279,null))[_0x9bed('0x16')](saveUpdates(_0x5bbfd1[_0x9bed('0x2f')],null))[_0x9bed('0x16')](respondWithResult(_0x482279,null))[_0x9bed('0x1e')](handleError(_0x482279,null));};exports[_0x9bed('0x2a')]=function(_0x316e65,_0x37fec6){return db['ChatInteraction'][_0x9bed('0x49')]({'where':{'id':_0x316e65[_0x9bed('0x3f')]['id']}})[_0x9bed('0x16')](handleEntityNotFound(_0x37fec6,null))[_0x9bed('0x16')](removeEntity(_0x37fec6,null))[_0x9bed('0x1e')](handleError(_0x37fec6,null));};exports[_0x9bed('0x4b')]=function(_0x353728,_0x5be160){return db[_0x9bed('0x36')]['describe']()[_0x9bed('0x16')](respondWithResult(_0x5be160,null))[_0x9bed('0x1e')](handleError(_0x5be160,null));};exports[_0x9bed('0x4c')]=function(_0x4cfec7,_0x4ebc3c){var _0x475b7b=_0x4cfec7[_0x9bed('0x3f')]['id'];var _0x58b937;var _0x48fd71;var _0x54dbb3;return db[_0x9bed('0x36')][_0x9bed('0x4d')]({'where':{'id':_0x475b7b}})['then'](function(_0x3eb937){_0x58b937=_0x3eb937;return db[_0x9bed('0x4e')]['findOne']({'where':{'id':_0x3eb937[_0x9bed('0x4f')]},'attributes':['id','vidaooApiKey',_0x9bed('0x50'),_0x9bed('0x51'),_0x9bed('0x52'),'vidaooMetadata'],'raw':!![]});})[_0x9bed('0x16')](function(_0x2abf19){if(_0x2abf19&&_0x2abf19[_0x9bed('0x53')]&&_0x2abf19[_0x9bed('0x50')]){_0x48fd71=_0x2abf19;var _0x15ee12={'interaction':{'id':_0x475b7b},'agent':{'id':_0x4cfec7[_0x9bed('0x54')]['id'],'name':_0x4cfec7[_0x9bed('0x54')][_0x9bed('0x2c')],'fullname':_0x4cfec7[_0x9bed('0x54')][_0x9bed('0x55')],'email':_0x4cfec7[_0x9bed('0x54')][_0x9bed('0x56')]},'contact':_0x4cfec7[_0x9bed('0x2f')]['contact'],'account':_0x4cfec7['body'][_0x9bed('0x33')]};var _0x29dbb1={'rejectUnauthorized':![],'method':'POST','url':_0x9bed('0x57'),'headers':{'X-APIKEY':_0x2abf19[_0x9bed('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4cfec7[_0x9bed('0x54')][_0x9bed('0x56')]],'buttons':null,'topic':_0x48fd71[_0x9bed('0x51')],'note':_[_0x9bed('0x58')](_0x48fd71[_0x9bed('0x52')])?null:getMustacheRender(_0x48fd71['vidaooNote'],_0x15ee12),'metadata':null},'redirect':_0x9bed('0x59'),'json':!![]};try{if(!_[_0x9bed('0x58')](_0x48fd71[_0x9bed('0x5a')])){var _0x5f2657=getMustacheRender(_0x48fd71['vidaooMetadata'],_0x15ee12);var _0x5b19ad=JSON['parse'](_0x5f2657);_0x29dbb1[_0x9bed('0x2f')][_0x9bed('0x5b')]=_0x5b19ad;}}catch(_0x9e0332){throw new db['Sequelize'][(_0x9bed('0x5c'))](_0x9bed('0x5d'));}return rp(_0x29dbb1);}else{throw new db[(_0x9bed('0x5e'))][(_0x9bed('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x9bed('0x16')](function(_0xc7409c){_0x54dbb3=_0xc7409c;if(_0x54dbb3['id']){var _0x26ced0={'body':_0x54dbb3[_0x9bed('0x5f')],'ChatWebsiteId':_0x48fd71['id'],'ChatInteractionId':_0x58b937['id'],'direction':_0x9bed('0x60'),'UserId':_0x4cfec7[_0x9bed('0x54')]['id']};return db[_0x9bed('0x61')][_0x9bed('0x4a')](_0x26ced0,{});}else{throw new db[(_0x9bed('0x5e'))][(_0x9bed('0x5c'))](_0x9bed('0x62'));}})[_0x9bed('0x16')](function(){return _0x58b937[_0x9bed('0x63')]({'vidaooSessionId':_0x54dbb3['id']});})['then'](respondWithResult(_0x4ebc3c,null))[_0x9bed('0x1e')](handleError(_0x4ebc3c,null));};exports[_0x9bed('0x64')]=function(_0x2d819c,_0xe614ef){if(_0x2d819c['body']['id']){delete _0x2d819c[_0x9bed('0x2f')]['id'];}return db[_0x9bed('0x36')]['find']({'where':{'id':_0x2d819c[_0x9bed('0x3f')]['id']},'include':[{'model':db['CmContact'],'as':_0x9bed('0x65')}]})[_0x9bed('0x16')](handleEntityNotFound(_0xe614ef,null))[_0x9bed('0x16')](saveUpdates(_0x2d819c[_0x9bed('0x2f')],null))[_0x9bed('0x16')](respondWithResult(_0xe614ef,null))[_0x9bed('0x1e')](handleError(_0xe614ef,null));};exports['abandon']=function(_0x12cdc2,_0x2f2f82){if(_0x12cdc2[_0x9bed('0x2f')]['id']){delete _0x12cdc2[_0x9bed('0x2f')]['id'];}return db[_0x9bed('0x36')]['find']({'where':{'id':_0x12cdc2[_0x9bed('0x3f')]['id']}})[_0x9bed('0x16')](function(_0x3ff794){if(!_0x3ff794){logger['error'](_0x9bed('0x66'),_0x9bed('0x67'),0x194,_0x9bed('0x68'));_0x2f2f82['sendStatus'](0x194);}else{if(_0x3ff794[_0x9bed('0x69')]){throw new db[(_0x9bed('0x5e'))][(_0x9bed('0x5c'))](_0x9bed('0x6a'));}}return _0x3ff794;})[_0x9bed('0x16')](function(_0x4598b3){if(_0x4598b3){return _0x4598b3['update']({'closed':_0x12cdc2[_0x9bed('0x2f')][_0x9bed('0x6b')],'disposition':_0x12cdc2['body'][_0x9bed('0x6c')]})[_0x9bed('0x16')](function(_0x563eb1){return _0x563eb1;});}})[_0x9bed('0x16')](function(){return respondWithRpcPromise(_0x9bed('0x6d'),_0x9bed('0x67'),_0x12cdc2[_0x9bed('0x2f')],client9004);})[_0x9bed('0x16')](respondWithResult(_0x2f2f82,null))[_0x9bed('0x1e')](handleError(_0x2f2f82,null));};exports['attachmentUpload']=function(_0x4e5a3a,_0x51f5b9){_0x4e5a3a[_0x9bed('0x2f')][_0x9bed('0x2c')]=_0x4e5a3a['file'][_0x9bed('0x6e')];_0x4e5a3a['body'][_0x9bed('0x6f')]=_0x4e5a3a[_0x9bed('0x70')][_0x9bed('0x71')];_0x4e5a3a['body'][_0x9bed('0x39')]=_0x4e5a3a[_0x9bed('0x70')][_0x9bed('0x72')];return db['Attachment'][_0x9bed('0x4a')](_0x4e5a3a[_0x9bed('0x2f')])[_0x9bed('0x16')](respondWithResult(_0x51f5b9,0xc9))[_0x9bed('0x1e')](handleError(_0x51f5b9,null));};exports[_0x9bed('0x73')]=function(_0x2c58bd,_0x4ed6d6){return db['ChatInteraction']['findOne']({'where':{'id':_0x2c58bd[_0x9bed('0x3f')]['id']},'raw':!![]})[_0x9bed('0x16')](handleEntityNotFound(_0x4ed6d6,null))['then'](function(_0x58bb83){if(_0x58bb83){if(_0x58bb83['closed']){return _0x4ed6d6[_0x9bed('0x21')](0x193)[_0x9bed('0x22')]({'status':0x193,'message':_0x9bed('0x74')});}return db['Attachment']['findOne']({'where':{'id':_0x2c58bd[_0x9bed('0x3e')][_0x9bed('0x75')]},'raw':!![]})[_0x9bed('0x16')](handleEntityNotFound(_0x4ed6d6,null));}})[_0x9bed('0x16')](function(_0x145124){if(_0x145124){var _0x51505c=_0x145124[_0x9bed('0x76')]!==null;var _0xc8c87e=path[_0x9bed('0x77')](config[_0x9bed('0x78')],_0x9bed('0x79'));if(_0x51505c){_0xc8c87e=path[_0x9bed('0x77')](_0xc8c87e,_0x9bed('0x7a'));}var _0x20739c=path[_0x9bed('0x77')](_0xc8c87e,_0x145124[_0x9bed('0x6f')]);return _0x4ed6d6[_0x9bed('0x7b')](_0x20739c);}})[_0x9bed('0x1e')](handleError(_0x4ed6d6,null));};exports[_0x9bed('0x7c')]=function(_0x29a2cc,_0x8de8d5){var _0x2efd42=null;var _0x342dc9=null;var _0x246150=null;if(_0x29a2cc[_0x9bed('0x2f')]['id']){delete _0x29a2cc[_0x9bed('0x2f')]['id'];}if(_0x29a2cc['body'][_0x9bed('0x7d')]){_0x246150=path['join'](config[_0x9bed('0x78')],'server/files/chat/upload/',util[_0x9bed('0x7e')]('transcript-%s.txt',Date[_0x9bed('0x7f')]()));_0x29a2cc[_0x9bed('0x2f')][_0x9bed('0x80')]=_0x246150;}return db['ChatInteraction'][_0x9bed('0x49')]({'where':{'id':_0x29a2cc['params']['id']},'include':[{'model':db[_0x9bed('0x61')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x9bed('0x16')](handleEntityNotFound(_0x8de8d5,null))[_0x9bed('0x16')](saveUpdates(_0x29a2cc['body'],null))[_0x9bed('0x16')](function(_0x55eb07){if(_0x55eb07){_0x2efd42=_0x55eb07;return db[_0x9bed('0x4e')]['find']({'where':{'id':_0x2efd42[_0x9bed('0x4f')]}});}})[_0x9bed('0x16')](function(_0x122acd){if(_0x122acd){_0x342dc9=_0x122acd;return db[_0x9bed('0x81')]['find']({'where':{'id':_0x2efd42[_0x9bed('0x82')]}});}})[_0x9bed('0x16')](function(_0x8a4c86){if(_0x8a4c86){if(_0x246150){var _0x2fdcd4=null;for(var _0x5f2afb=0x1;_0x5f2afb<_0x2efd42[_0x9bed('0x83')][_0x9bed('0x84')];++_0x5f2afb){_0x2fdcd4=_0x2efd42[_0x9bed('0x83')][_0x5f2afb];var _0x384248=_0x2fdcd4[_0x9bed('0x69')]?util[_0x9bed('0x7e')](_0x9bed('0x85'),_0x342dc9[_0x9bed('0x86')],_0x2fdcd4[_0x9bed('0x69')]):_0x9bed('0x87');var _0xcf5a4a=_0x29a2cc[_0x9bed('0x2f')][_0x9bed('0x88')]||util[_0x9bed('0x7e')]('%s%d',_0x9bed('0x89'),_0x2fdcd4[_0x9bed('0x82')]);switch(_0x342dc9[_0x9bed('0x8a')]){case _0x9bed('0x8b'):_0x384248=_0x2fdcd4[_0x9bed('0x69')]?util[_0x9bed('0x7e')]('%s%d',_0x342dc9[_0x9bed('0x86')],_0x2fdcd4[_0x9bed('0x69')]):_0x9bed('0x87');break;case'agent_alias':_0x384248=_0x2fdcd4[_0x9bed('0x69')]?_0x2fdcd4[_0x9bed('0x8c')]['alias']||_0x2fdcd4[_0x9bed('0x8c')]['fullname']:'System';break;case _0x9bed('0x8d'):_0x384248=_0x2fdcd4['UserId']?_0x2fdcd4[_0x9bed('0x8c')][_0x9bed('0x55')]:_0x9bed('0x87');break;default:_0x384248=_0x2fdcd4[_0x9bed('0x69')]?util[_0x9bed('0x7e')](_0x9bed('0x85'),_0x342dc9[_0x9bed('0x86')],_0x2fdcd4[_0x9bed('0x69')]):_0x9bed('0x87');}var _0x33d5a1=util['format'](_0x9bed('0x8e'),moment(_0x2fdcd4[_0x9bed('0x8f')])[_0x9bed('0x7e')](_0x9bed('0x90')),_0x2fdcd4[_0x9bed('0x91')]==='in'?_0xcf5a4a:_0x384248,_0x2fdcd4[_0x9bed('0x2f')]);if(!_0x2fdcd4['secret']){fs[_0x9bed('0x92')](_0x246150,_0x33d5a1);}}return db[_0x9bed('0x93')][_0x9bed('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x9bed('0x94')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9bed('0x95')],'as':_0x9bed('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x4de6e8){if(!_0x4de6e8||!_0x4de6e8[_0x9bed('0x96')]||!_0x29a2cc[_0x9bed('0x2f')])return _0x2efd42;var _0x573b48=_0x4de6e8['getSmtpOptions']();return respondWithRpcPromise(_0x9bed('0x97'),'sendMail',{'account':_0x573b48,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4de6e8['name'],_0x4de6e8[_0x9bed('0x56')]||_0x4de6e8[_0x9bed('0x96')][_0x9bed('0x54')]),'to':_0x29a2cc['body'][_0x9bed('0x7d')],'subject':_0x9bed('0x98'),'text':util[_0x9bed('0x7e')](_0x9bed('0x99'),_0x29a2cc[_0x9bed('0x2f')][_0x9bed('0x7d')]),'attachments':[{'path':_0x246150}]}})['then'](function(){return _0x2efd42;})[_0x9bed('0x1e')](function(_0x51ca2b){logger[_0x9bed('0x1b')](_0x51ca2b);});})[_0x9bed('0x16')](respondWithStatusCode(_0x8de8d5,0xc8))['catch'](handleError(_0x8de8d5,null));};exports[_0x9bed('0x9a')]=function(_0x4e02ec,_0x5e4a7d){return db['ChatMessage'][_0x9bed('0x49')]({'where':{'id':_0x4e02ec[_0x9bed('0x3f')]['id']}})[_0x9bed('0x16')](handleEntityNotFound(_0x5e4a7d,null))[_0x9bed('0x16')](function(_0x3834b9){if(_0x3834b9){return _0x3834b9[_0x9bed('0x9a')](_0x4e02ec['body']['ids'],_['omit'](_0x4e02ec['body'],[_0x9bed('0x9b'),'id'])||{});}})[_0x9bed('0x16')](respondWithResult(_0x5e4a7d,null))[_0x9bed('0x1e')](handleError(_0x5e4a7d,null));};exports['getMessages']=function(_0x2f6012,_0x71eeef){var _0xf06e2={'raw':![],'where':{}};var _0x2fe415={};var _0x55b086={'count':0x0,'rows':[]};return db[_0x9bed('0x36')]['findOne']({'where':{'id':_0x2f6012[_0x9bed('0x3f')]['id']}})['then'](handleEntityNotFound(_0x71eeef,null))[_0x9bed('0x16')](function(_0x5206d6){if(_0x5206d6){_0x2fe415[_0x9bed('0x40')]=_[_0x9bed('0x41')](db[_0x9bed('0x61')]['rawAttributes']);_0x2fe415[_0x9bed('0x3e')]=_[_0x9bed('0x41')](_0x2f6012[_0x9bed('0x3e')]);_0x2fe415[_0x9bed('0x42')]=_['intersection'](_0x2fe415[_0x9bed('0x40')],_0x2fe415[_0x9bed('0x3e')]);_0xf06e2[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x2fe415[_0x9bed('0x40')],qs['fields'](_0x2f6012[_0x9bed('0x3e')][_0x9bed('0x45')]));_0xf06e2[_0x9bed('0x43')]=_0xf06e2[_0x9bed('0x43')]['length']?_0xf06e2['attributes']:_0x2fe415[_0x9bed('0x40')];if(!_0x2f6012[_0x9bed('0x3e')]['hasOwnProperty'](_0x9bed('0x9c'))){_0xf06e2['limit']=qs[_0x9bed('0x26')](_0x2f6012['query'][_0x9bed('0x26')]);_0xf06e2[_0x9bed('0x23')]=qs[_0x9bed('0x23')](_0x2f6012['query'][_0x9bed('0x23')]);}_0xf06e2['order']=qs['sort'](_0x2f6012['query'][_0x9bed('0x9d')]);_0xf06e2[_0x9bed('0x9e')]=qs[_0x9bed('0x42')](_[_0x9bed('0x9f')](_0x2f6012[_0x9bed('0x3e')],_0x2fe415[_0x9bed('0x42')]));_0xf06e2[_0x9bed('0x9e')][_0x9bed('0xa0')]=_0x5206d6['id'];if(_0x2f6012[_0x9bed('0x3e')]['filter']){_0xf06e2[_0x9bed('0x9e')]=_[_0x9bed('0x2e')](_0xf06e2[_0x9bed('0x9e')],{'$or':_[_0x9bed('0x35')](_0xf06e2[_0x9bed('0x43')],function(_0x251b77){var _0x3d0b29={};_0x3d0b29[_0x251b77]={'$like':'%'+_0x2f6012[_0x9bed('0x3e')]['filter']+'%'};return _0x3d0b29;})});}if(_0x2f6012['query'][_0x9bed('0xa1')]){var _0x24ae34=_0x2f6012[_0x9bed('0x3e')]['$gte']['split'](',');var _0xc99fb={};_0xc99fb[_0x24ae34[0x0]]={'$gte':moment(_0x24ae34[0x1])[_0x9bed('0x7e')](_0x9bed('0xa2'))};_0xf06e2[_0x9bed('0x9e')]=_[_0x9bed('0x2e')](_0xf06e2['where'],_0xc99fb);}_0xf06e2=_[_0x9bed('0x2e')]({},_0xf06e2,_0x2f6012[_0x9bed('0x48')]);return db['ChatMessage'][_0x9bed('0x25')]({'where':_0xf06e2[_0x9bed('0x9e')]})[_0x9bed('0x16')](function(_0x202f54){_0x55b086[_0x9bed('0x25')]=_0x202f54;if(_0x2f6012[_0x9bed('0x3e')]['includeAll']){_0xf06e2[_0x9bed('0x47')]=[{'all':!![]}];}return db[_0x9bed('0x61')][_0x9bed('0x3c')](_0xf06e2);})[_0x9bed('0x16')](function(_0x2aa10f){_0x55b086[_0x9bed('0xa3')]=_0x2aa10f;return _0x55b086;});}})['then'](respondWithFilteredResult(_0x71eeef,_0xf06e2))[_0x9bed('0x1e')](handleError(_0x71eeef,null));};exports[_0x9bed('0xa4')]=function(_0x4108f2,_0x98d979){var _0x290060={'where':{}},_0x4a1767={},_0x2fa186={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9bed('0x4d')]({'where':{'id':_0x4108f2['params']['id']}})[_0x9bed('0x16')](handleEntityNotFound(_0x98d979,null))[_0x9bed('0x16')](function(_0x516aa8){if(_0x516aa8){_0x4a1767[_0x9bed('0x40')]=_[_0x9bed('0x41')](db[_0x9bed('0x61')][_0x9bed('0x37')]);_0x4a1767['query']=_['keys'](_0x4108f2[_0x9bed('0x3e')]);_0x4a1767[_0x9bed('0x42')]=_[_0x9bed('0x44')](_0x4a1767[_0x9bed('0x40')],_0x4a1767[_0x9bed('0x3e')]);_0x290060[_0x9bed('0x43')]=_[_0x9bed('0x44')](_0x4a1767['model'],qs[_0x9bed('0x45')](_0x4108f2['query'][_0x9bed('0x45')]));_0x290060[_0x9bed('0x43')]=_0x290060['attributes']['length']?_0x290060['attributes']:_0x4a1767[_0x9bed('0x40')];if(!_0x4108f2[_0x9bed('0x3e')][_0x9bed('0xa5')]('nolimit')){_0x290060[_0x9bed('0x26')]=qs['limit'](_0x4108f2[_0x9bed('0x3e')][_0x9bed('0x26')]);_0x290060['offset']=qs[_0x9bed('0x23')](_0x4108f2[_0x9bed('0x3e')][_0x9bed('0x23')]);}_0x290060['order']=qs['sort'](_0x4108f2[_0x9bed('0x3e')][_0x9bed('0x9d')]);_0x290060['where']=qs[_0x9bed('0x42')](_[_0x9bed('0x9f')](_0x4108f2[_0x9bed('0x3e')],_0x4a1767['filters']));_0x290060[_0x9bed('0x9e')][_0x9bed('0xa0')]=_0x516aa8['id'];if(_0x4108f2[_0x9bed('0x3e')][_0x9bed('0xa6')]){_0x290060[_0x9bed('0x9e')]=_[_0x9bed('0x2e')](_0x290060[_0x9bed('0x9e')],{'$or':_[_0x9bed('0x35')](_0x290060['attributes'],function(_0x3bc85a){var _0x1b351b={};_0x1b351b[_0x3bc85a]={'$like':'%'+_0x4108f2['query'][_0x9bed('0xa6')]+'%'};return _0x1b351b;})});}_0x290060[_0x9bed('0x9e')][_0x9bed('0xa7')]=![];if(_0x4108f2['query']['id']){_0x290060[_0x9bed('0x9e')]['id']={'$gt':_0x4108f2['query']['id']};}_0x290060=_[_0x9bed('0x2e')]({},_0x290060,_0x4108f2[_0x9bed('0x48')]);return db[_0x9bed('0x61')][_0x9bed('0x25')]({'where':_0x290060[_0x9bed('0x9e')]})[_0x9bed('0x16')](function(_0x1f2880){_0x2fa186['count']=_0x1f2880;_0x290060[_0x9bed('0x47')]=[];if(_0x4108f2['query'][_0x9bed('0xa8')]){_0x290060[_0x9bed('0x47')][_0x9bed('0xa9')]({'model':db[_0x9bed('0x8c')],'as':_0x9bed('0x8c'),'attributes':['id',_0x9bed('0x55'),_0x9bed('0xaa')]});}if(_0x4108f2[_0x9bed('0x3e')]['includeAll']){_0x290060[_0x9bed('0x47')]=[{'all':!![]}];}return db['ChatMessage'][_0x9bed('0x3c')](_0x290060);})[_0x9bed('0x16')](function(_0x10bdb2){_0x2fa186[_0x9bed('0xa3')]=_0x10bdb2;return _0x2fa186;});}})[_0x9bed('0x16')](respondWithFilteredResult(_0x98d979,_0x290060))[_0x9bed('0x1e')](handleError(_0x98d979,null));};exports[_0x9bed('0xab')]=function(_0x2bd930,_0x1972eb){return db[_0x9bed('0x36')][_0x9bed('0x49')]({'where':{'id':_0x2bd930['params']['id']}})['then'](handleEntityNotFound(_0x1972eb,null))[_0x9bed('0x16')](function(_0x4aad37){if(_0x4aad37){return _0x4aad37[_0x9bed('0xac')](_0x2bd930[_0x9bed('0x2f')][_0x9bed('0x9b')],_['omit'](_0x2bd930[_0x9bed('0x2f')],['ids','id'])||{})[_0x9bed('0xad')](function(){return db[_0x9bed('0xae')][_0x9bed('0x3c')]({'attributes':['id',_0x9bed('0x2c'),_0x9bed('0xaf')],'where':{'id':_0x2bd930[_0x9bed('0x2f')][_0x9bed('0x9b')]}});})[_0x9bed('0x16')](function(_0x2a8dd0){socket['emit'](_0x9bed('0xb0'),{'id':Number(_0x2bd930[_0x9bed('0x3f')]['id']),'tags':_0x2a8dd0||[]});return{'id':Number(_0x2bd930['params']['id']),'tags':_0x2a8dd0||[]};});}})[_0x9bed('0x16')](respondWithResult(_0x1972eb,null))[_0x9bed('0x1e')](handleError(_0x1972eb,null));};exports['removeTags']=function(_0x3deb14,_0x4ee306){return db[_0x9bed('0x36')]['find']({'where':{'id':_0x3deb14['params']['id']}})[_0x9bed('0x16')](handleEntityNotFound(_0x4ee306,null))[_0x9bed('0x16')](function(_0x5ca86b){if(_0x5ca86b){return _0x5ca86b[_0x9bed('0xb1')](_0x3deb14[_0x9bed('0x3e')][_0x9bed('0x9b')]);}})['then'](respondWithStatusCode(_0x4ee306,null))[_0x9bed('0x1e')](handleError(_0x4ee306,null));};exports['download']=function(_0x341ccf,_0x3ff7c4){var _0x1c4a0c=moment()[_0x9bed('0xb2')]()[_0x9bed('0xb3')]();var _0x271ad3=path[_0x9bed('0x77')](config[_0x9bed('0x78')],_0x9bed('0xb4'),'files','tmp');var _0x4c81df=path[_0x9bed('0x77')](config['root'],_0x9bed('0xb4'),_0x9bed('0xb5'),'attachments');var _0x2c59d8=path[_0x9bed('0x77')](_0x271ad3,_0x1c4a0c);var _0x14f533=util['format'](_0x9bed('0xb6'),_0x341ccf[_0x9bed('0x3f')]['id'],_0x1c4a0c);var _0x21073e=path[_0x9bed('0x77')](_0x271ad3,_0x14f533);var _0x4ff1d6=[];_0x4ff1d6[_0x9bed('0xa9')]({'model':db[_0x9bed('0x8c')],'as':_0x9bed('0x8c'),'attributes':['id',_0x9bed('0x55')],'raw':!![]});_0x4ff1d6['push']({'model':db[_0x9bed('0x81')],'as':_0x9bed('0x65'),'attributes':['id',_0x9bed('0xb7'),_0x9bed('0xb8')],'raw':!![]});if(_0x341ccf[_0x9bed('0x3e')][_0x9bed('0xb9')]){_0x4ff1d6[_0x9bed('0xa9')]({'model':db[_0x9bed('0xba')],'as':_0x9bed('0xba'),'raw':!![]});}var _0x57339f=[{'model':db[_0x9bed('0x61')],'as':'Messages','attributes':['id',_0x9bed('0x2f'),_0x9bed('0x8f'),_0x9bed('0x91'),'secret',_0x9bed('0xbb')],'include':_0x4ff1d6}];_0x57339f[_0x9bed('0xa9')]({'model':db['ChatWebsite'],'as':_0x9bed('0xbc'),'attributes':['id',_0x9bed('0x2c')]});_0x57339f[_0x9bed('0xa9')]({'model':db['User'],'as':_0x9bed('0xbd'),'attributes':['id',_0x9bed('0x55')]});return db[_0x9bed('0x36')][_0x9bed('0x49')]({'where':{'id':_0x341ccf['params']['id']},'include':_0x57339f})[_0x9bed('0x16')](handleEntityNotFound(_0x3ff7c4,null))[_0x9bed('0x16')](function(_0x439c71){if(_0x439c71){var _0x436d99=_0x439c71[_0x9bed('0xbe')]({'plain':!![]});fs[_0x9bed('0xbf')](_0x2c59d8);var _0x4beeb7={'channel':'Chat','account':_0x436d99[_0x9bed('0xbc')][_0x9bed('0x2c')],'agent':_0x436d99['Owner']?_0x436d99['Owner'][_0x9bed('0x55')]:_0x9bed('0xc0'),'createdAt':moment(_0x436d99[_0x9bed('0x8f')])[_0x9bed('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x436d99['closed']?moment(_0x436d99[_0x9bed('0xc1')])[_0x9bed('0x7e')](_0x9bed('0xa2'))[_0x9bed('0xb3')]():'','disposition':_0x436d99['disposition'],'chatInfo':{'browser':_0x436d99['browserName'],'os':_0x436d99['osName'],'referer':_0x436d99[_0x9bed('0xc2')],'customerIp':_0x436d99[_0x9bed('0xc3')],'customerPort':_0x436d99['customerPort']?_0x436d99[_0x9bed('0xc4')]:'N.A.'},'messages':_(_0x436d99['Messages'])[_0x9bed('0xc5')]()[_0x9bed('0xa6')]({'secret':![]})[_0x9bed('0x35')](function(_0x32fac0){if(_0x32fac0[_0x9bed('0xba')]){var _0x22a374=path['join'](_0x4c81df,_0x32fac0[_0x9bed('0xba')]['basename']);if(fs['existsSync'](_0x22a374)){fs[_0x9bed('0xc6')](_0x22a374)[_0x9bed('0xc7')](fs[_0x9bed('0xc8')](path['join'](_0x2c59d8,_0x32fac0['Attachment']['basename'])));}}return{'date':moment(_0x32fac0['createdAt'])[_0x9bed('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9bed('0xb3')](),'sender':_0x32fac0[_0x9bed('0x91')]==='out'?_0x32fac0['User']?_0x32fac0[_0x9bed('0x8c')][_0x9bed('0x55')]:_0x9bed('0x87'):_0x32fac0['Contact'][_0x9bed('0xb7')]+(_0x32fac0[_0x9bed('0x65')][_0x9bed('0xb8')]?'\x20'+_0x32fac0['Contact'][_0x9bed('0xb8')]:''),'body':_0x32fac0[_0x9bed('0xba')]?_0x32fac0['Attachment'][_0x9bed('0x6f')]:_0x32fac0[_0x9bed('0x2f')],'direction':_0x32fac0[_0x9bed('0x91')]===_0x9bed('0x60')?'A':'C','secret':_0x32fac0[_0x9bed('0xa7')],'read':_0x32fac0[_0x9bed('0xbb')],'attachment':_0x32fac0[_0x9bed('0xba')]};})[_0x9bed('0xc9')]()};return ejs[_0x9bed('0xca')](path[_0x9bed('0x77')](config[_0x9bed('0x78')],_0x9bed('0xb4'),_0x9bed('0xcb'),'downloadInteraction.ejs'),{'interaction':_0x4beeb7})['then'](function(_0x132c93){var _0x421ede=path[_0x9bed('0x77')](_0x2c59d8,_0x9bed('0xcc')+_0x436d99['id']+'-'+_0x1c4a0c+'.pdf');var _0x27569c={'path':_0x421ede,'channel':_0x9bed('0xcd'),'interactionId':_0x436d99['id']};return pdf[_0x9bed('0xce')](_0x132c93,_0x27569c);})['then'](function(){return new Promise(function(_0x1fe146,_0x309fad){zipdir(_0x2c59d8,{'saveTo':_0x21073e},function(_0x12ff36,_0x4490fa){if(_0x12ff36)return _0x309fad(_0x12ff36);return _0x1fe146(_0x4490fa);});})[_0x9bed('0x16')](function(){return new BPromise(function(_0x5305dd,_0x4c346b){rimraf(_0x2c59d8,function(_0x10d4ba){if(_0x10d4ba)_0x4c346b(_0x10d4ba);return _0x5305dd();});});})[_0x9bed('0x16')](function(){return _0x3ff7c4[_0x9bed('0x7b')](_0x21073e,_0x14f533,function(_0x32dd8d){if(_0x32dd8d){logger[_0x9bed('0x1b')](_0x9bed('0xcf'),_0x32dd8d);}else{fs[_0x9bed('0xd0')](_0x21073e);}});});});}else{return _0x3ff7c4[_0x9bed('0x1f')](0xc8);}})[_0x9bed('0x1e')](handleError(_0x3ff7c4,null));}; \ No newline at end of file +var _0x03fa=['../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','stack','name','send','render','body','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','findAll','chat','query','user','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','parse','metadata','Sequelize','ValidationError','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','User','ChatWebsite','ContactId','Messages','format','%s%d','agentAlias','System','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','includeAgent','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Owner','get','mkdirSync','Chat','Account','toString','closedAt','browserName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','value','renderFile','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','ioredis','../../components/interaction/service','../../config/logger','api'];(function(_0x302c75,_0x3701e7){var _0x473a4d=function(_0x117dbb){while(--_0x117dbb){_0x302c75['push'](_0x302c75['shift']());}};_0x473a4d(++_0x3701e7);}(_0x03fa,0x199));var _0xa03f=function(_0x346097,_0xf7c47b){_0x346097=_0x346097-0x0;var _0x52065e=_0x03fa[_0x346097];return _0x52065e;};'use strict';var rimraf=require(_0xa03f('0x0'));var zipdir=require(_0xa03f('0x1'));var rp=require('request-promise');var moment=require(_0xa03f('0x2'));var BPromise=require(_0xa03f('0x3'));var Mustache=require(_0xa03f('0x4'));var util=require(_0xa03f('0x5'));var path=require('path');var ejs=require(_0xa03f('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa03f('0x7'));var interaction=require(_0xa03f('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xa03f('0x9'))(_0xa03f('0xa'));var config=require('../../config/environment');var db=require(_0xa03f('0xb'))['db'];config['redis']=_[_0xa03f('0xc')](config['redis'],{'host':_0xa03f('0xd'),'port':0x18eb});var socket=require(_0xa03f('0xe'))(new Redis(config[_0xa03f('0xf')]));require(_0xa03f('0x10'))[_0xa03f('0x11')](socket);var jayson=require(_0xa03f('0x12'));var client=jayson[_0xa03f('0x13')][_0xa03f('0x14')]({'port':0x232b});var client9004=jayson[_0xa03f('0x13')][_0xa03f('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x1c7d2e,_0x31878b,_0x4fb1c2,_0x4ef29a){return new BPromise(function(_0x5ca89e,_0x4cf73f){var _0x365403=_0x4ef29a||client;return _0x365403[_0xa03f('0x15')](_0x1c7d2e,_0x4fb1c2)[_0xa03f('0x16')](function(_0x53785a){logger[_0xa03f('0x17')](_0xa03f('0x18'),_0x31878b,_0xa03f('0x19'));logger['debug'](_0xa03f('0x1a'),_0x31878b,_0xa03f('0x19'),JSON[_0xa03f('0x1b')](_0x53785a));if(_0x53785a[_0xa03f('0x1c')]){if(_0x53785a['error']['code']===0x1f4){logger[_0xa03f('0x1c')](_0xa03f('0x18'),_0x31878b,_0x53785a[_0xa03f('0x1c')][_0xa03f('0x1d')]);return _0x4cf73f(_0x53785a['error'][_0xa03f('0x1d')]);}logger[_0xa03f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0x53785a[_0xa03f('0x1c')][_0xa03f('0x1d')]);return _0x5ca89e(_0x53785a['error'][_0xa03f('0x1d')]);}else{logger[_0xa03f('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0xa03f('0x19'));_0x5ca89e(_0x53785a[_0xa03f('0x1e')][_0xa03f('0x1d')]);}})[_0xa03f('0x1f')](function(_0x43ac65){logger[_0xa03f('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x31878b,_0x43ac65);_0x4cf73f(_0x43ac65);});});}function respondWithStatusCode(_0xbbd263,_0x2b03f6){_0x2b03f6=_0x2b03f6||0xcc;return function(_0x22472c){if(_0x22472c){return _0xbbd263[_0xa03f('0x20')](_0x2b03f6);}return _0xbbd263['status'](_0x2b03f6)[_0xa03f('0x21')]();};}function respondWithResult(_0x5b0313,_0x3ee6eb){_0x3ee6eb=_0x3ee6eb||0xc8;return function(_0x4c9287){if(_0x4c9287){return _0x5b0313[_0xa03f('0x22')](_0x3ee6eb)[_0xa03f('0x23')](_0x4c9287);}};}function respondWithFilteredResult(_0x4e4d44,_0x6ed85e){return function(_0x36c817){if(_0x36c817){var _0xc158cf=typeof _0x6ed85e['offset']===_0xa03f('0x24')&&typeof _0x6ed85e['limit']===_0xa03f('0x24');var _0x589c5a=_0x36c817[_0xa03f('0x25')];var _0x84769c=_0xc158cf?0x0:_0x6ed85e[_0xa03f('0x26')];var _0x25a272=_0xc158cf?_0x36c817[_0xa03f('0x25')]:_0x6ed85e[_0xa03f('0x26')]+_0x6ed85e[_0xa03f('0x27')];var _0xa114b1;if(_0x25a272>=_0x589c5a){_0x25a272=_0x589c5a;_0xa114b1=0xc8;}else{_0xa114b1=0xce;}_0x4e4d44[_0xa03f('0x22')](_0xa114b1);return _0x4e4d44[_0xa03f('0x28')](_0xa03f('0x29'),_0x84769c+'-'+_0x25a272+'/'+_0x589c5a)[_0xa03f('0x23')](_0x36c817);}return null;};}function saveUpdates(_0x2ac4ec){return function(_0xe502ac){if(_0xe502ac){return _0xe502ac[_0xa03f('0x2a')](_0x2ac4ec)[_0xa03f('0x16')](function(_0x5f3207){return _0x5f3207;});}return null;};}function removeEntity(_0x11298d){return function(_0x6a57cd){if(_0x6a57cd){return _0x6a57cd[_0xa03f('0x2b')]()[_0xa03f('0x16')](function(){_0x11298d[_0xa03f('0x22')](0xcc)[_0xa03f('0x21')]();});}};}function handleEntityNotFound(_0x4f7fce){return function(_0x36eff6){if(!_0x36eff6){_0x4f7fce[_0xa03f('0x20')](0x194);}return _0x36eff6;};}function handleError(_0x22d5b3,_0x1c1b5e){_0x1c1b5e=_0x1c1b5e||0x1f4;return function(_0x10336d){logger[_0xa03f('0x1c')](_0x10336d[_0xa03f('0x2c')]);if(_0x10336d[_0xa03f('0x2d')]){delete _0x10336d[_0xa03f('0x2d')];}_0x22d5b3['status'](_0x1c1b5e)[_0xa03f('0x2e')](_0x10336d);};}function getMustacheRender(_0x1da92c,_0x53214a){return Mustache[_0xa03f('0x2f')](_0x1da92c,_['merge'](_0x53214a[_0xa03f('0x30')],{'contact':_0x53214a['contact'],'message':_0x53214a[_0xa03f('0x1d')],'agent':_0x53214a[_0xa03f('0x31')],'interaction':_0x53214a[_0xa03f('0x32')],'account':_0x53214a[_0xa03f('0x33')]}))||'';}exports[_0xa03f('0x34')]=function(_0xdb9cff,_0x22b56f){var _0x2083a3={};var _0x30a050=_[_0xa03f('0x35')](db[_0xa03f('0x36')]['rawAttributes'],function(_0x25114b){return{'name':_0x25114b[_0xa03f('0x37')],'type':_0x25114b[_0xa03f('0x38')][_0xa03f('0x39')]};});_0x2083a3=qs['getOptions'](_0x30a050,_0xdb9cff);return interaction[_0xa03f('0x3a')](_0xa03f('0x3b'),_0xdb9cff[_0xa03f('0x3c')],_0xdb9cff[_0xa03f('0x3d')],_0x2083a3,_0x30a050)[_0xa03f('0x16')](respondWithFilteredResult(_0x22b56f,_0x2083a3))['catch'](handleError(_0x22b56f,null));};exports[_0xa03f('0x3e')]=function(_0x552ba0,_0x297fca){var _0x12740a={'raw':![],'where':{'id':_0x552ba0[_0xa03f('0x3f')]['id']}},_0x10f354={};_0x10f354[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x36')][_0xa03f('0x42')]);_0x10f354[_0xa03f('0x3c')]=_['keys'](_0x552ba0['query']);_0x10f354[_0xa03f('0x43')]=_[_0xa03f('0x44')](_0x10f354[_0xa03f('0x40')],_0x10f354[_0xa03f('0x3c')]);_0x12740a[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x10f354[_0xa03f('0x40')],qs[_0xa03f('0x46')](_0x552ba0['query'][_0xa03f('0x46')]));_0x12740a[_0xa03f('0x45')]=_0x12740a['attributes'][_0xa03f('0x47')]?_0x12740a['attributes']:_0x10f354['model'];if(_0x552ba0[_0xa03f('0x3c')][_0xa03f('0x48')]){_0x12740a['include']=[{'all':!![]}];}_0x12740a=_[_0xa03f('0x49')]({},_0x12740a,_0x552ba0[_0xa03f('0x4a')]);return db[_0xa03f('0x36')][_0xa03f('0x4b')](_0x12740a)[_0xa03f('0x16')](handleEntityNotFound(_0x297fca,null))[_0xa03f('0x16')](respondWithResult(_0x297fca,null))[_0xa03f('0x1f')](handleError(_0x297fca,null));};exports[_0xa03f('0x4c')]=function(_0x51cf58,_0x1e1961){return db['ChatInteraction'][_0xa03f('0x4c')](_0x51cf58[_0xa03f('0x30')],{})[_0xa03f('0x16')](respondWithResult(_0x1e1961,0xc9))[_0xa03f('0x1f')](handleError(_0x1e1961,null));};exports['update']=function(_0x583449,_0x1211cc){if(_0x583449['body']['id']){delete _0x583449[_0xa03f('0x30')]['id'];}return db[_0xa03f('0x36')][_0xa03f('0x4b')]({'where':{'id':_0x583449[_0xa03f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1211cc,null))[_0xa03f('0x16')](saveUpdates(_0x583449[_0xa03f('0x30')],null))[_0xa03f('0x16')](respondWithResult(_0x1211cc,null))[_0xa03f('0x1f')](handleError(_0x1211cc,null));};exports['destroy']=function(_0x31145f,_0x8e4b13){return db[_0xa03f('0x36')]['find']({'where':{'id':_0x31145f[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x8e4b13,null))['then'](removeEntity(_0x8e4b13,null))[_0xa03f('0x1f')](handleError(_0x8e4b13,null));};exports[_0xa03f('0x4d')]=function(_0xfb610,_0x4272c2){return db[_0xa03f('0x36')][_0xa03f('0x4d')]()['then'](respondWithResult(_0x4272c2,null))['catch'](handleError(_0x4272c2,null));};exports[_0xa03f('0x4e')]=function(_0x3bec9e,_0x4ec390){var _0x173df4=_0x3bec9e[_0xa03f('0x3f')]['id'];var _0x3f8a2a;var _0x1b35b6;var _0xcd3ff1;return db['ChatInteraction'][_0xa03f('0x4f')]({'where':{'id':_0x173df4}})[_0xa03f('0x16')](function(_0x3bd8f6){_0x3f8a2a=_0x3bd8f6;return db['ChatWebsite'][_0xa03f('0x4f')]({'where':{'id':_0x3bd8f6[_0xa03f('0x50')]},'attributes':['id','vidaooApiKey',_0xa03f('0x51'),_0xa03f('0x52'),_0xa03f('0x53'),_0xa03f('0x54')],'raw':!![]});})[_0xa03f('0x16')](function(_0x37c6f4){if(_0x37c6f4&&_0x37c6f4['vidaooApiKey']&&_0x37c6f4[_0xa03f('0x51')]){_0x1b35b6=_0x37c6f4;var _0x5dd430={'interaction':{'id':_0x173df4},'agent':{'id':_0x3bec9e[_0xa03f('0x3d')]['id'],'name':_0x3bec9e[_0xa03f('0x3d')][_0xa03f('0x2d')],'fullname':_0x3bec9e[_0xa03f('0x3d')]['fullname'],'email':_0x3bec9e[_0xa03f('0x3d')][_0xa03f('0x55')]},'contact':_0x3bec9e[_0xa03f('0x30')][_0xa03f('0x56')],'account':_0x3bec9e[_0xa03f('0x30')]['account']};var _0x547d1f={'rejectUnauthorized':![],'method':_0xa03f('0x57'),'url':_0xa03f('0x58'),'headers':{'X-APIKEY':_0x37c6f4[_0xa03f('0x59')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3bec9e['user'][_0xa03f('0x55')]],'buttons':null,'topic':_0x1b35b6['vidaooTopic'],'note':_[_0xa03f('0x5a')](_0x1b35b6[_0xa03f('0x53')])?null:getMustacheRender(_0x1b35b6['vidaooNote'],_0x5dd430),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xa03f('0x5a')](_0x1b35b6[_0xa03f('0x54')])){var _0x230a94=getMustacheRender(_0x1b35b6['vidaooMetadata'],_0x5dd430);var _0x30e95c=JSON[_0xa03f('0x5b')](_0x230a94);_0x547d1f[_0xa03f('0x30')][_0xa03f('0x5c')]=_0x30e95c;}}catch(_0x426ef7){throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x547d1f);}else{throw new db[(_0xa03f('0x5d'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x17967b){_0xcd3ff1=_0x17967b;if(_0xcd3ff1['id']){var _0x35986e={'body':_0xcd3ff1[_0xa03f('0x5f')],'ChatWebsiteId':_0x1b35b6['id'],'ChatInteractionId':_0x3f8a2a['id'],'direction':_0xa03f('0x60'),'UserId':_0x3bec9e['user']['id']};return db[_0xa03f('0x61')][_0xa03f('0x4c')](_0x35986e,{});}else{throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x3f8a2a[_0xa03f('0x62')]({'vidaooSessionId':_0xcd3ff1['id']});})[_0xa03f('0x16')](respondWithResult(_0x4ec390,null))['catch'](handleError(_0x4ec390,null));};exports[_0xa03f('0x63')]=function(_0x16ce62,_0x25a831){if(_0x16ce62[_0xa03f('0x30')]['id']){delete _0x16ce62['body']['id'];}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x16ce62['params']['id']},'include':[{'model':db[_0xa03f('0x64')],'as':_0xa03f('0x65')}]})[_0xa03f('0x16')](handleEntityNotFound(_0x25a831,null))[_0xa03f('0x16')](saveUpdates(_0x16ce62['body'],null))[_0xa03f('0x16')](respondWithResult(_0x25a831,null))[_0xa03f('0x1f')](handleError(_0x25a831,null));};exports[_0xa03f('0x66')]=function(_0x2e234c,_0x588b0a){if(_0x2e234c[_0xa03f('0x30')]['id']){delete _0x2e234c[_0xa03f('0x30')]['id'];}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x2e234c[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](function(_0x2b3cc5){if(!_0x2b3cc5){logger[_0xa03f('0x1c')](_0xa03f('0x67'),'abandon',0x194,'entity\x20not\x20found');_0x588b0a[_0xa03f('0x20')](0x194);}else{if(_0x2b3cc5[_0xa03f('0x68')]){throw new db[(_0xa03f('0x5d'))][(_0xa03f('0x5e'))](_0xa03f('0x69'));}}return _0x2b3cc5;})[_0xa03f('0x16')](function(_0x189044){if(_0x189044){return _0x189044[_0xa03f('0x2a')]({'closed':_0x2e234c[_0xa03f('0x30')][_0xa03f('0x6a')],'disposition':_0x2e234c['body'][_0xa03f('0x6b')]})[_0xa03f('0x16')](function(_0x2159b8){return _0x2159b8;});}})[_0xa03f('0x16')](function(){return respondWithRpcPromise('AbandonInteraction',_0xa03f('0x66'),_0x2e234c[_0xa03f('0x30')],client9004);})[_0xa03f('0x16')](respondWithResult(_0x588b0a,null))['catch'](handleError(_0x588b0a,null));};exports[_0xa03f('0x6c')]=function(_0x49e6fc,_0x35d137){_0x49e6fc[_0xa03f('0x30')][_0xa03f('0x2d')]=_0x49e6fc[_0xa03f('0x6d')]['originalname'];_0x49e6fc['body'][_0xa03f('0x6e')]=_0x49e6fc[_0xa03f('0x6d')][_0xa03f('0x6f')];_0x49e6fc[_0xa03f('0x30')]['type']=_0x49e6fc['file'][_0xa03f('0x70')];return db[_0xa03f('0x71')][_0xa03f('0x4c')](_0x49e6fc[_0xa03f('0x30')])[_0xa03f('0x16')](respondWithResult(_0x35d137,0xc9))[_0xa03f('0x1f')](handleError(_0x35d137,null));};exports[_0xa03f('0x72')]=function(_0x2007aa,_0x47e512){return db[_0xa03f('0x36')][_0xa03f('0x4f')]({'where':{'id':_0x2007aa[_0xa03f('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x47e512,null))['then'](function(_0x4708a4){if(_0x4708a4){if(_0x4708a4['closed']){return _0x47e512['status'](0x193)[_0xa03f('0x23')]({'status':0x193,'message':_0xa03f('0x73')});}return db['Attachment'][_0xa03f('0x4f')]({'where':{'id':_0x2007aa[_0xa03f('0x3c')]['attachId']},'raw':!![]})[_0xa03f('0x16')](handleEntityNotFound(_0x47e512,null));}})[_0xa03f('0x16')](function(_0x556f7a){if(_0x556f7a){var _0x1a5bf6=_0x556f7a['ChatOfflineMessageId']!==null;var _0x1b83f0=path[_0xa03f('0x74')](config[_0xa03f('0x75')],_0xa03f('0x76'));if(_0x1a5bf6){_0x1b83f0=path[_0xa03f('0x74')](_0x1b83f0,'offline-chat/');}var _0x4b783d=path[_0xa03f('0x74')](_0x1b83f0,_0x556f7a['basename']);return _0x47e512[_0xa03f('0x77')](_0x4b783d);}})[_0xa03f('0x1f')](handleError(_0x47e512,null));};exports[_0xa03f('0x78')]=function(_0x4dfb95,_0x4bed41){var _0x3afed5=null;var _0x5b22d9=null;var _0x449764=null;if(_0x4dfb95[_0xa03f('0x30')]['id']){delete _0x4dfb95[_0xa03f('0x30')]['id'];}if(_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')]){_0x449764=path[_0xa03f('0x74')](config['root'],_0xa03f('0x7a'),util['format']('transcript-%s.txt',Date[_0xa03f('0x7b')]()));_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x7c')]=_0x449764;}return db[_0xa03f('0x36')]['find']({'where':{'id':_0x4dfb95[_0xa03f('0x3f')]['id']},'include':[{'model':db[_0xa03f('0x61')],'as':'Messages','include':[{'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d')}]}]})[_0xa03f('0x16')](handleEntityNotFound(_0x4bed41,null))[_0xa03f('0x16')](saveUpdates(_0x4dfb95['body'],null))[_0xa03f('0x16')](function(_0x2c1d4f){if(_0x2c1d4f){_0x3afed5=_0x2c1d4f;return db[_0xa03f('0x7e')][_0xa03f('0x4b')]({'where':{'id':_0x3afed5[_0xa03f('0x50')]}});}})[_0xa03f('0x16')](function(_0x217aae){if(_0x217aae){_0x5b22d9=_0x217aae;return db['CmContact'][_0xa03f('0x4b')]({'where':{'id':_0x3afed5[_0xa03f('0x7f')]}});}})[_0xa03f('0x16')](function(_0x166d99){if(_0x166d99){if(_0x449764){var _0x31cad5=null;for(var _0x5ee519=0x1;_0x5ee519<_0x3afed5[_0xa03f('0x80')]['length'];++_0x5ee519){_0x31cad5=_0x3afed5[_0xa03f('0x80')][_0x5ee519];var _0x4e3fa2=_0x31cad5[_0xa03f('0x68')]?util[_0xa03f('0x81')](_0xa03f('0x82'),_0x5b22d9[_0xa03f('0x83')],_0x31cad5[_0xa03f('0x68')]):_0xa03f('0x84');var _0x4ff0e9=_0x4dfb95['body']['customer']||util[_0xa03f('0x81')](_0xa03f('0x82'),'Visitor',_0x31cad5[_0xa03f('0x7f')]);switch(_0x5b22d9[_0xa03f('0x85')]){case _0xa03f('0x86'):_0x4e3fa2=_0x31cad5[_0xa03f('0x68')]?util['format'](_0xa03f('0x82'),_0x5b22d9[_0xa03f('0x83')],_0x31cad5['UserId']):'System';break;case _0xa03f('0x87'):_0x4e3fa2=_0x31cad5['UserId']?_0x31cad5[_0xa03f('0x7d')][_0xa03f('0x88')]||_0x31cad5[_0xa03f('0x7d')][_0xa03f('0x89')]:_0xa03f('0x84');break;case _0xa03f('0x8a'):_0x4e3fa2=_0x31cad5['UserId']?_0x31cad5['User'][_0xa03f('0x89')]:_0xa03f('0x84');break;default:_0x4e3fa2=_0x31cad5['UserId']?util[_0xa03f('0x81')]('%s%d',_0x5b22d9[_0xa03f('0x83')],_0x31cad5[_0xa03f('0x68')]):_0xa03f('0x84');}var _0x5b36f5=util[_0xa03f('0x81')](_0xa03f('0x8b'),moment(_0x31cad5[_0xa03f('0x8c')])[_0xa03f('0x81')](_0xa03f('0x8d')),_0x31cad5[_0xa03f('0x8e')]==='in'?_0x4ff0e9:_0x4e3fa2,_0x31cad5['body']);if(!_0x31cad5['secret']){fs['appendFileSync'](_0x449764,_0x5b36f5);}}return db[_0xa03f('0x8f')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa03f('0x90')],'as':_0xa03f('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa03f('0x92'),'raw':!![]}]}]});}}})[_0xa03f('0x16')](function(_0x40af97){if(!_0x40af97||!_0x40af97[_0xa03f('0x91')]||!_0x4dfb95['body'])return _0x3afed5;var _0x331816=_0x40af97[_0xa03f('0x93')]();return respondWithRpcPromise(_0xa03f('0x94'),_0xa03f('0x95'),{'account':_0x331816,'message':{'from':util[_0xa03f('0x81')](_0xa03f('0x96'),_0x40af97['name'],_0x40af97[_0xa03f('0x55')]||_0x40af97[_0xa03f('0x91')][_0xa03f('0x3d')]),'to':_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')],'subject':_0xa03f('0x97'),'text':util[_0xa03f('0x81')](_0xa03f('0x98'),_0x4dfb95[_0xa03f('0x30')][_0xa03f('0x79')]),'attachments':[{'path':_0x449764}]}})[_0xa03f('0x16')](function(){return _0x3afed5;})['catch'](function(_0x2d0c46){logger[_0xa03f('0x1c')](_0x2d0c46);});})[_0xa03f('0x16')](respondWithStatusCode(_0x4bed41,0xc8))[_0xa03f('0x1f')](handleError(_0x4bed41,null));};exports[_0xa03f('0x99')]=function(_0x378bbc,_0x437572){return db['ChatMessage'][_0xa03f('0x4b')]({'where':{'id':_0x378bbc[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x437572,null))['then'](function(_0x160ac7){if(_0x160ac7){return _0x160ac7['addMessage'](_0x378bbc['body'][_0xa03f('0x9a')],_[_0xa03f('0x9b')](_0x378bbc['body'],[_0xa03f('0x9a'),'id'])||{});}})[_0xa03f('0x16')](respondWithResult(_0x437572,null))['catch'](handleError(_0x437572,null));};exports[_0xa03f('0x9c')]=function(_0x10bd39,_0x4b1fdb){var _0x47124a={'raw':![],'where':{}};var _0x23f603={};var _0x4c8ca1={'count':0x0,'rows':[]};return db[_0xa03f('0x36')]['findOne']({'where':{'id':_0x10bd39[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4b1fdb,null))['then'](function(_0x436e3e){if(_0x436e3e){_0x23f603[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x61')][_0xa03f('0x42')]);_0x23f603[_0xa03f('0x3c')]=_['keys'](_0x10bd39[_0xa03f('0x3c')]);_0x23f603[_0xa03f('0x43')]=_[_0xa03f('0x44')](_0x23f603['model'],_0x23f603[_0xa03f('0x3c')]);_0x47124a[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x23f603[_0xa03f('0x40')],qs['fields'](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0x46')]));_0x47124a[_0xa03f('0x45')]=_0x47124a[_0xa03f('0x45')][_0xa03f('0x47')]?_0x47124a[_0xa03f('0x45')]:_0x23f603['model'];if(!_0x10bd39['query'][_0xa03f('0x9d')](_0xa03f('0x9e'))){_0x47124a['limit']=qs[_0xa03f('0x27')](_0x10bd39[_0xa03f('0x3c')]['limit']);_0x47124a[_0xa03f('0x26')]=qs['offset'](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0x26')]);}_0x47124a[_0xa03f('0x9f')]=qs[_0xa03f('0xa0')](_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa0')]);_0x47124a[_0xa03f('0xa1')]=qs[_0xa03f('0x43')](_[_0xa03f('0xa2')](_0x10bd39[_0xa03f('0x3c')],_0x23f603[_0xa03f('0x43')]));_0x47124a[_0xa03f('0xa1')][_0xa03f('0xa3')]=_0x436e3e['id'];if(_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa4')]){_0x47124a['where']=_[_0xa03f('0x49')](_0x47124a['where'],{'$or':_[_0xa03f('0x35')](_0x47124a[_0xa03f('0x45')],function(_0x221517){var _0x1ec65b={};_0x1ec65b[_0x221517]={'$like':'%'+_0x10bd39['query']['filter']+'%'};return _0x1ec65b;})});}if(_0x10bd39['query'][_0xa03f('0xa5')]){var _0x1cb361=_0x10bd39[_0xa03f('0x3c')][_0xa03f('0xa5')][_0xa03f('0xa6')](',');var _0xb20b91={};_0xb20b91[_0x1cb361[0x0]]={'$gte':moment(_0x1cb361[0x1])[_0xa03f('0x81')](_0xa03f('0xa7'))};_0x47124a[_0xa03f('0xa1')]=_[_0xa03f('0x49')](_0x47124a[_0xa03f('0xa1')],_0xb20b91);}_0x47124a=_[_0xa03f('0x49')]({},_0x47124a,_0x10bd39[_0xa03f('0x4a')]);return db[_0xa03f('0x61')][_0xa03f('0x25')]({'where':_0x47124a['where']})[_0xa03f('0x16')](function(_0x19913e){_0x4c8ca1['count']=_0x19913e;if(_0x10bd39['query'][_0xa03f('0x48')]){_0x47124a[_0xa03f('0xa8')]=[{'all':!![]}];}return db[_0xa03f('0x61')][_0xa03f('0x3a')](_0x47124a);})['then'](function(_0x22dc6d){_0x4c8ca1[_0xa03f('0xa9')]=_0x22dc6d;return _0x4c8ca1;});}})['then'](respondWithFilteredResult(_0x4b1fdb,_0x47124a))[_0xa03f('0x1f')](handleError(_0x4b1fdb,null));};exports[_0xa03f('0xaa')]=function(_0x37d3cb,_0x4f392a){var _0x3da1fb={'where':{}},_0x102103={},_0x53efb8={'count':0x0,'rows':[]};return db[_0xa03f('0x36')]['findOne']({'where':{'id':_0x37d3cb['params']['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4f392a,null))['then'](function(_0x53fbac){if(_0x53fbac){_0x102103[_0xa03f('0x40')]=_[_0xa03f('0x41')](db[_0xa03f('0x61')][_0xa03f('0x42')]);_0x102103[_0xa03f('0x3c')]=_['keys'](_0x37d3cb[_0xa03f('0x3c')]);_0x102103['filters']=_[_0xa03f('0x44')](_0x102103['model'],_0x102103[_0xa03f('0x3c')]);_0x3da1fb[_0xa03f('0x45')]=_[_0xa03f('0x44')](_0x102103[_0xa03f('0x40')],qs[_0xa03f('0x46')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x46')]));_0x3da1fb[_0xa03f('0x45')]=_0x3da1fb[_0xa03f('0x45')]['length']?_0x3da1fb[_0xa03f('0x45')]:_0x102103[_0xa03f('0x40')];if(!_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x9d')](_0xa03f('0x9e'))){_0x3da1fb['limit']=qs[_0xa03f('0x27')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x27')]);_0x3da1fb[_0xa03f('0x26')]=qs[_0xa03f('0x26')](_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x26')]);}_0x3da1fb[_0xa03f('0x9f')]=qs[_0xa03f('0xa0')](_0x37d3cb[_0xa03f('0x3c')]['sort']);_0x3da1fb[_0xa03f('0xa1')]=qs[_0xa03f('0x43')](_[_0xa03f('0xa2')](_0x37d3cb[_0xa03f('0x3c')],_0x102103[_0xa03f('0x43')]));_0x3da1fb['where'][_0xa03f('0xa3')]=_0x53fbac['id'];if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xa4')]){_0x3da1fb[_0xa03f('0xa1')]=_[_0xa03f('0x49')](_0x3da1fb[_0xa03f('0xa1')],{'$or':_['map'](_0x3da1fb[_0xa03f('0x45')],function(_0xeaa31e){var _0x36f6af={};_0x36f6af[_0xeaa31e]={'$like':'%'+_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xa4')]+'%'};return _0x36f6af;})});}_0x3da1fb[_0xa03f('0xa1')]['secret']=![];if(_0x37d3cb[_0xa03f('0x3c')]['id']){_0x3da1fb[_0xa03f('0xa1')]['id']={'$gt':_0x37d3cb['query']['id']};}_0x3da1fb=_[_0xa03f('0x49')]({},_0x3da1fb,_0x37d3cb[_0xa03f('0x4a')]);return db[_0xa03f('0x61')][_0xa03f('0x25')]({'where':_0x3da1fb[_0xa03f('0xa1')]})['then'](function(_0x80e591){_0x53efb8['count']=_0x80e591;_0x3da1fb[_0xa03f('0xa8')]=[];if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0xab')]){_0x3da1fb[_0xa03f('0xa8')]['push']({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d'),'attributes':['id',_0xa03f('0x89'),'alias']});}if(_0x37d3cb[_0xa03f('0x3c')][_0xa03f('0x48')]){_0x3da1fb[_0xa03f('0xa8')]=[{'all':!![]}];}return db[_0xa03f('0x61')][_0xa03f('0x3a')](_0x3da1fb);})[_0xa03f('0x16')](function(_0x180fdc){_0x53efb8[_0xa03f('0xa9')]=_0x180fdc;return _0x53efb8;});}})[_0xa03f('0x16')](respondWithFilteredResult(_0x4f392a,_0x3da1fb))['catch'](handleError(_0x4f392a,null));};exports[_0xa03f('0xac')]=function(_0x5db843,_0x412a3e){return db['ChatInteraction'][_0xa03f('0x4b')]({'where':{'id':_0x5db843[_0xa03f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x412a3e,null))[_0xa03f('0x16')](function(_0x5a3520){if(_0x5a3520){return _0x5a3520[_0xa03f('0xad')](_0x5db843[_0xa03f('0x30')][_0xa03f('0x9a')],_[_0xa03f('0x9b')](_0x5db843[_0xa03f('0x30')],[_0xa03f('0x9a'),'id'])||{})[_0xa03f('0xae')](function(){return db[_0xa03f('0xaf')][_0xa03f('0x3a')]({'attributes':['id',_0xa03f('0x2d'),'color'],'where':{'id':_0x5db843[_0xa03f('0x30')][_0xa03f('0x9a')]}});})['then'](function(_0x1dd0b6){socket[_0xa03f('0xb0')](_0xa03f('0xb1'),{'id':Number(_0x5db843[_0xa03f('0x3f')]['id']),'tags':_0x1dd0b6||[]});return{'id':Number(_0x5db843[_0xa03f('0x3f')]['id']),'tags':_0x1dd0b6||[]};});}})[_0xa03f('0x16')](respondWithResult(_0x412a3e,null))[_0xa03f('0x1f')](handleError(_0x412a3e,null));};exports[_0xa03f('0xb2')]=function(_0x38d390,_0x4108a6){return db[_0xa03f('0x36')][_0xa03f('0x4b')]({'where':{'id':_0x38d390[_0xa03f('0x3f')]['id']}})[_0xa03f('0x16')](handleEntityNotFound(_0x4108a6,null))[_0xa03f('0x16')](function(_0xf4a0de){if(_0xf4a0de){return _0xf4a0de['removeTags'](_0x38d390[_0xa03f('0x3c')][_0xa03f('0x9a')]);}})[_0xa03f('0x16')](respondWithStatusCode(_0x4108a6,null))[_0xa03f('0x1f')](handleError(_0x4108a6,null));};exports[_0xa03f('0x77')]=function(_0x596435,_0x583fdf){var _0x36d6eb=moment()[_0xa03f('0xb3')]()['toString']();var _0x1bc66e=path[_0xa03f('0x74')](config['root'],'server',_0xa03f('0xb4'),_0xa03f('0xb5'));var _0x372fe1=path[_0xa03f('0x74')](config[_0xa03f('0x75')],'server',_0xa03f('0xb4'),_0xa03f('0xb6'));var _0x28ef80=path['join'](_0x1bc66e,_0x36d6eb);var _0x504d44=util[_0xa03f('0x81')](_0xa03f('0xb7'),_0x596435[_0xa03f('0x3f')]['id'],_0x36d6eb);var _0x2713db=path['join'](_0x1bc66e,_0x504d44);var _0x209d70=[];_0x209d70[_0xa03f('0xb8')]({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0x7d'),'attributes':['id',_0xa03f('0x89')],'raw':!![]});_0x209d70[_0xa03f('0xb8')]({'model':db[_0xa03f('0x64')],'as':'Contact','attributes':['id',_0xa03f('0xb9'),_0xa03f('0xba')],'raw':!![]});if(_0x596435[_0xa03f('0x3c')]['attachments']){_0x209d70['push']({'model':db[_0xa03f('0x71')],'as':'Attachment','raw':!![]});}var _0x3febb4=[{'model':db[_0xa03f('0x61')],'as':_0xa03f('0x80'),'attributes':['id',_0xa03f('0x30'),'createdAt',_0xa03f('0x8e'),'secret',_0xa03f('0xbb')],'include':_0x209d70}];_0x3febb4['push']({'model':db[_0xa03f('0x7e')],'as':'Account','attributes':['id','name']});_0x3febb4[_0xa03f('0xb8')]({'model':db[_0xa03f('0x7d')],'as':_0xa03f('0xbc'),'attributes':['id',_0xa03f('0x89')]});return db['ChatInteraction'][_0xa03f('0x4b')]({'where':{'id':_0x596435[_0xa03f('0x3f')]['id']},'include':_0x3febb4})[_0xa03f('0x16')](handleEntityNotFound(_0x583fdf,null))['then'](function(_0x55ea99){if(_0x55ea99){var _0x1060e3=_0x55ea99[_0xa03f('0xbd')]({'plain':!![]});fs[_0xa03f('0xbe')](_0x28ef80);var _0x507e45={'channel':_0xa03f('0xbf'),'account':_0x1060e3[_0xa03f('0xc0')][_0xa03f('0x2d')],'agent':_0x1060e3[_0xa03f('0xbc')]?_0x1060e3[_0xa03f('0xbc')][_0xa03f('0x89')]:'N.A.','createdAt':moment(_0x1060e3[_0xa03f('0x8c')])[_0xa03f('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa03f('0xc1')](),'closedAt':_0x1060e3['closed']?moment(_0x1060e3[_0xa03f('0xc2')])[_0xa03f('0x81')](_0xa03f('0xa7'))[_0xa03f('0xc1')]():'','disposition':_0x1060e3['disposition'],'chatInfo':{'browser':_0x1060e3[_0xa03f('0xc3')],'os':_0x1060e3['osName'],'referer':_0x1060e3[_0xa03f('0xc4')],'customerIp':_0x1060e3[_0xa03f('0xc5')],'customerPort':_0x1060e3[_0xa03f('0xc6')]?_0x1060e3[_0xa03f('0xc6')]:_0xa03f('0xc7')},'messages':_(_0x1060e3[_0xa03f('0x80')])[_0xa03f('0xc8')]()[_0xa03f('0xa4')]({'secret':![]})[_0xa03f('0x35')](function(_0x35cd5f){if(_0x35cd5f[_0xa03f('0x71')]){var _0x3a013e=path[_0xa03f('0x74')](_0x372fe1,_0x35cd5f[_0xa03f('0x71')][_0xa03f('0x6e')]);if(fs[_0xa03f('0xc9')](_0x3a013e)){fs[_0xa03f('0xca')](_0x3a013e)[_0xa03f('0xcb')](fs['createWriteStream'](path[_0xa03f('0x74')](_0x28ef80,_0x35cd5f['Attachment'][_0xa03f('0x6e')])));}}return{'date':moment(_0x35cd5f['createdAt'])[_0xa03f('0x81')](_0xa03f('0xa7'))['toString'](),'sender':_0x35cd5f[_0xa03f('0x8e')]===_0xa03f('0x60')?_0x35cd5f['User']?_0x35cd5f[_0xa03f('0x7d')][_0xa03f('0x89')]:'System':_0x35cd5f['Contact']['firstName']+(_0x35cd5f[_0xa03f('0x65')][_0xa03f('0xba')]?'\x20'+_0x35cd5f[_0xa03f('0x65')][_0xa03f('0xba')]:''),'body':_0x35cd5f[_0xa03f('0x71')]?_0x35cd5f[_0xa03f('0x71')]['basename']:_0x35cd5f[_0xa03f('0x30')],'direction':_0x35cd5f[_0xa03f('0x8e')]===_0xa03f('0x60')?'A':'C','secret':_0x35cd5f['secret'],'read':_0x35cd5f['read'],'attachment':_0x35cd5f[_0xa03f('0x71')]};})[_0xa03f('0xcc')]()};return ejs[_0xa03f('0xcd')](path[_0xa03f('0x74')](config[_0xa03f('0x75')],'server','views','downloadInteraction.ejs'),{'interaction':_0x507e45})[_0xa03f('0x16')](function(_0x2e6295){var _0x10c333=path['join'](_0x28ef80,_0xa03f('0xce')+_0x1060e3['id']+'-'+_0x36d6eb+_0xa03f('0xcf'));var _0x202de1={'path':_0x10c333,'channel':_0xa03f('0xbf'),'interactionId':_0x1060e3['id']};return pdf['createPdfFromHTML'](_0x2e6295,_0x202de1);})[_0xa03f('0x16')](function(){return new Promise(function(_0x16e6ef,_0x46b7d2){zipdir(_0x28ef80,{'saveTo':_0x2713db},function(_0x2360fe,_0x16f53b){if(_0x2360fe)return _0x46b7d2(_0x2360fe);return _0x16e6ef(_0x16f53b);});})[_0xa03f('0x16')](function(){return new BPromise(function(_0x4e7878,_0x23b937){rimraf(_0x28ef80,function(_0x5e7733){if(_0x5e7733)_0x23b937(_0x5e7733);return _0x4e7878();});});})['then'](function(){return _0x583fdf[_0xa03f('0x77')](_0x2713db,_0x504d44,function(_0x48ee5e){if(_0x48ee5e){logger['error'](_0xa03f('0xd0'),_0x48ee5e);}else{fs[_0xa03f('0xd1')](_0x2713db);}});});});}else{return _0x583fdf['sendStatus'](0xc8);}})['catch'](handleError(_0x583fdf,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3327bcb..ba3abf8 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 _0xd02d=['setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','update','then','Users','map'];(function(_0x22f35d,_0x22fb48){var _0x586a07=function(_0x3a266a){while(--_0x3a266a){_0x22f35d['push'](_0x22f35d['shift']());}};_0x586a07(++_0x22fb48);}(_0xd02d,0x1ab));var _0xdd02=function(_0x2e155b,_0x3169ae){_0x2e155b=_0x2e155b-0x0;var _0x6c0d69=_0xd02d[_0x2e155b];return _0x6c0d69;};'use strict';var EventEmitter=require(_0xdd02('0x0'));var ChatInteraction=require(_0xdd02('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xdd02('0x1'))['db'][_0xdd02('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdd02('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd02('0x4'),'afterDestroy':'remove'};function emitEvent(_0x30cb63){return function(_0x30aada,_0x8b969c,_0x37ac8f){_0x30aada['getUsers']({'attributes':['id'],'raw':!![]})[_0xdd02('0x5')](function(_0x53d29b){_0x30aada['setDataValue'](_0xdd02('0x6'),_0x53d29b[_0xdd02('0x7')](function(_0x19875c){return{'id':_0x19875c['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x30aada['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x44c328){_0x30aada[_0xdd02('0x8')]('unreadMessages',_0x44c328[_0xdd02('0x9')]);ChatInteractionEvents[_0xdd02('0xa')](_0x30cb63+':'+_0x30aada['id'],_0x30aada);ChatInteractionEvents[_0xdd02('0xa')](_0x30cb63,_0x30aada);_0x37ac8f(null);})[_0xdd02('0xb')](_0x37ac8f(null));};}for(var e in events){if(events[_0xdd02('0xc')](e)){var event=events[e];ChatInteraction[_0xdd02('0xd')](e,emitEvent(event));}}module[_0xdd02('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x9ee6=['../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','exports','events'];(function(_0xc7484e,_0x33d408){var _0x3a2ae7=function(_0xe774f7){while(--_0xe774f7){_0xc7484e['push'](_0xc7484e['shift']());}};_0x3a2ae7(++_0x33d408);}(_0x9ee6,0x11c));var _0x69ee=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x9ee6[_0x37b3e5];return _0x207f20;};'use strict';var EventEmitter=require(_0x69ee('0x0'));var ChatInteraction=require(_0x69ee('0x1'))['db'][_0x69ee('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x69ee('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x69ee('0x4'),'afterUpdate':'update','afterDestroy':_0x69ee('0x5')};function emitEvent(_0x1b2db6){return function(_0x2f109e,_0x143bb2,_0x154891){_0x2f109e[_0x69ee('0x6')]({'attributes':['id'],'raw':!![]})[_0x69ee('0x7')](function(_0x5cd47a){_0x2f109e[_0x69ee('0x8')](_0x69ee('0x9'),_0x5cd47a[_0x69ee('0xa')](function(_0x49bdcb){return{'id':_0x49bdcb['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2f109e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x69ee('0x7')](function(_0x451a18){_0x2f109e[_0x69ee('0x8')]('unreadMessages',_0x451a18['length']);ChatInteractionEvents[_0x69ee('0xb')](_0x1b2db6+':'+_0x2f109e['id'],_0x2f109e);ChatInteractionEvents[_0x69ee('0xb')](_0x1b2db6,_0x2f109e);_0x154891(null);})[_0x69ee('0xc')](_0x154891(null));};}for(var e in events){if(events[_0x69ee('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x69ee('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 40a7f55..50e701c 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 _0xedbf=['chat_interactions','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xedbf,0xf2));var _0xfedb=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xedbf[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xfedb('0x0'));var util=require(_0xfedb('0x1'));var logger=require(_0xfedb('0x2'))(_0xfedb('0x3'));var moment=require(_0xfedb('0x4'));var BPromise=require(_0xfedb('0x5'));var rp=require(_0xfedb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfedb('0x7'));var config=require(_0xfedb('0x8'));var attributes=require(_0xfedb('0x9'));module[_0xfedb('0xa')]=function(_0x4fb7a5,_0x530ead){return _0x4fb7a5[_0xfedb('0xb')](_0xfedb('0xc'),attributes,{'tableName':_0xfedb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b1013,_0x2fcdff,_0x41ce3f){if(_0x4b1013['changed']('closed')){_0x4b1013[_0xfedb('0xe')]=moment()[_0xfedb('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x41ce3f(null,_0x4b1013);}},'charset':_0xfedb('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0454=['utf8mb4','util','api','moment','request-promise','path','rimraf','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x27e208,_0x4d1182){var _0xcda460=function(_0x2b7f75){while(--_0x2b7f75){_0x27e208['push'](_0x27e208['shift']());}};_0xcda460(++_0x4d1182);}(_0x0454,0x1dd));var _0x4045=function(_0x552a93,_0x154d78){_0x552a93=_0x552a93-0x0;var _0x2a2fed=_0x0454[_0x552a93];return _0x2a2fed;};'use strict';var _=require('lodash');var util=require(_0x4045('0x0'));var logger=require('../../config/logger')(_0x4045('0x1'));var moment=require(_0x4045('0x2'));var BPromise=require('bluebird');var rp=require(_0x4045('0x3'));var fs=require('fs');var path=require(_0x4045('0x4'));var rimraf=require(_0x4045('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x4d12e4,_0x269748){return _0x4d12e4['define'](_0x4045('0x6'),attributes,{'tableName':_0x4045('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2470c3,_0x19fcad,_0x2ab312){if(_0x2470c3[_0x4045('0x8')](_0x4045('0x9'))){_0x2470c3[_0x4045('0xa')]=moment()[_0x4045('0xb')](_0x4045('0xc'));}_0x2ab312(null,_0x2470c3);}},'charset':_0x4045('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d6a41d4..051c3b1 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 _0xf42b=['attributes','limit','then','debug','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf42b,0x64));var _0xbf42=function(_0x556397,_0x49dca4){_0x556397=_0x556397-0x0;var _0x4a593e=_0xf42b[_0x556397];return _0x4a593e;};'use strict';var _=require(_0xbf42('0x0'));var util=require(_0xbf42('0x1'));var moment=require(_0xbf42('0x2'));var BPromise=require(_0xbf42('0x3'));var rs=require(_0xbf42('0x4'));var fs=require('fs');var Redis=require(_0xbf42('0x5'));var db=require(_0xbf42('0x6'))['db'];var utils=require(_0xbf42('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbf42('0x8'));var client=jayson[_0xbf42('0x9')][_0xbf42('0xa')]({'port':0x232a});config[_0xbf42('0xb')]=_[_0xbf42('0xc')](config[_0xbf42('0xb')],{'host':_0xbf42('0xd'),'port':0x18eb});var socket=require(_0xbf42('0xe'))(new Redis(config['redis']));require(_0xbf42('0xf'))[_0xbf42('0x10')](socket);function respondWithRpcPromise(_0x3db589,_0x34acda,_0x1bdf40){return new BPromise(function(_0x232063,_0x2ddc8b){return client[_0xbf42('0x11')](_0x3db589,_0x1bdf40)['then'](function(_0x4646b2){logger[_0xbf42('0x12')](_0xbf42('0x13'),_0x34acda,_0xbf42('0x14'));logger['debug'](_0xbf42('0x15'),_0x34acda,'request\x20sent',JSON[_0xbf42('0x16')](_0x4646b2));if(_0x4646b2[_0xbf42('0x17')]){if(_0x4646b2[_0xbf42('0x17')][_0xbf42('0x18')]===0x1f4){logger['error'](_0xbf42('0x13'),_0x34acda,_0x4646b2[_0xbf42('0x17')][_0xbf42('0x19')]);return _0x2ddc8b(_0x4646b2[_0xbf42('0x17')][_0xbf42('0x19')]);}logger[_0xbf42('0x17')](_0xbf42('0x13'),_0x34acda,_0x4646b2['error']['message']);return _0x232063(_0x4646b2[_0xbf42('0x17')][_0xbf42('0x19')]);}else{logger[_0xbf42('0x12')](_0xbf42('0x13'),_0x34acda,_0xbf42('0x14'));_0x232063(_0x4646b2[_0xbf42('0x1a')][_0xbf42('0x19')]);}})[_0xbf42('0x1b')](function(_0xa77bf1){logger[_0xbf42('0x17')](_0xbf42('0x13'),_0x34acda,_0xa77bf1);_0x2ddc8b(_0xa77bf1);});});}exports[_0xbf42('0x1c')]=function(_0x5d5720){var _0x4924b3=this;return new Promise(function(_0xfeca7b,_0x5a095a){return db[_0xbf42('0x1d')][_0xbf42('0x1e')](_0x5d5720[_0xbf42('0x1f')],{'raw':_0x5d5720[_0xbf42('0x20')]?_0x5d5720['options'][_0xbf42('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5720['options']?_0x5d5720[_0xbf42('0x20')][_0xbf42('0x22')]||null:null,'attributes':_0x5d5720['options']?_0x5d5720['options'][_0xbf42('0x23')]||null:null,'limit':_0x5d5720[_0xbf42('0x20')]?_0x5d5720[_0xbf42('0x20')][_0xbf42('0x24')]||null:null})[_0xbf42('0x25')](function(_0x4fee90){logger[_0xbf42('0x12')]('UpdateChatInteraction',_0x5d5720);logger[_0xbf42('0x26')](_0xbf42('0x1c'),_0x5d5720,JSON[_0xbf42('0x16')](_0x4fee90));_0xfeca7b(_0x4fee90);})[_0xbf42('0x1b')](function(_0x10d72a){logger[_0xbf42('0x17')](_0xbf42('0x1c'),_0x10d72a[_0xbf42('0x19')],_0x5d5720);_0x5a095a(_0x4924b3[_0xbf42('0x17')](0x1f4,_0x10d72a[_0xbf42('0x19')]));});});};exports[_0xbf42('0x27')]=function(_0x14dce5){return new Promise(function(_0x3b8c3c,_0x4a7557){return db[_0xbf42('0x1d')][_0xbf42('0x28')]({'where':_0x14dce5[_0xbf42('0x20')]?_0x14dce5[_0xbf42('0x20')]['where']||null:null})[_0xbf42('0x25')](function(_0x3c802b){if(_0x3c802b){return _0x3c802b[_0xbf42('0x29')](_0x14dce5[_0xbf42('0x1f')][_0xbf42('0x2a')],_['omit'](_0x14dce5[_0xbf42('0x1f')],['ids','id'])||{});}})[_0xbf42('0x2b')](function(_0x963d38){logger[_0xbf42('0x12')](_0xbf42('0x2c'),_0x14dce5);logger[_0xbf42('0x26')]('AddTags',_0x14dce5,JSON[_0xbf42('0x16')](_0x963d38));_0x3b8c3c(_0x963d38);})[_0xbf42('0x1b')](function(_0x4cecb7){logger['error']('AddTags',_0x4cecb7['message'],_0x14dce5);_0x4a7557(_this[_0xbf42('0x17')](0x1f4,_0x4cecb7[_0xbf42('0x19')]));});});}; \ No newline at end of file +var _0xedb3=['client','http','redis','defaults','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','debug','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x53e661,_0xc28ce3){var _0xb5873f=function(_0x3a2af5){while(--_0x3a2af5){_0x53e661['push'](_0x53e661['shift']());}};_0xb5873f(++_0xc28ce3);}(_0xedb3,0x1a5));var _0x3edb=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xedb3[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x3edb('0x0'));var util=require('util');var moment=require(_0x3edb('0x1'));var BPromise=require(_0x3edb('0x2'));var rs=require(_0x3edb('0x3'));var fs=require('fs');var Redis=require(_0x3edb('0x4'));var db=require(_0x3edb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3edb('0x6'))(_0x3edb('0x7'));var config=require('../../config/environment');var jayson=require(_0x3edb('0x8'));var client=jayson[_0x3edb('0x9')][_0x3edb('0xa')]({'port':0x232a});config[_0x3edb('0xb')]=_[_0x3edb('0xc')](config[_0x3edb('0xb')],{'host':_0x3edb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3edb('0xb')]));require('./chatInteraction.socket')[_0x3edb('0xe')](socket);function respondWithRpcPromise(_0x2d8eec,_0x3f07b3,_0xdc1591){return new BPromise(function(_0x465f51,_0x2aeb00){return client[_0x3edb('0xf')](_0x2d8eec,_0xdc1591)[_0x3edb('0x10')](function(_0x80ae06){logger[_0x3edb('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,'request\x20sent');logger['debug'](_0x3edb('0x12'),_0x3f07b3,_0x3edb('0x13'),JSON[_0x3edb('0x14')](_0x80ae06));if(_0x80ae06[_0x3edb('0x15')]){if(_0x80ae06[_0x3edb('0x15')][_0x3edb('0x16')]===0x1f4){logger[_0x3edb('0x15')](_0x3edb('0x17'),_0x3f07b3,_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);return _0x2aeb00(_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);}logger[_0x3edb('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,_0x80ae06[_0x3edb('0x15')][_0x3edb('0x18')]);return _0x465f51(_0x80ae06['error'][_0x3edb('0x18')]);}else{logger[_0x3edb('0x11')](_0x3edb('0x17'),_0x3f07b3,'request\x20sent');_0x465f51(_0x80ae06[_0x3edb('0x19')][_0x3edb('0x18')]);}})[_0x3edb('0x1a')](function(_0x5899da){logger[_0x3edb('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3f07b3,_0x5899da);_0x2aeb00(_0x5899da);});});}exports['UpdateChatInteraction']=function(_0x49e539){var _0x1515e9=this;return new Promise(function(_0x2616cd,_0x1ed4b2){return db['ChatInteraction'][_0x3edb('0x1b')](_0x49e539[_0x3edb('0x1c')],{'raw':_0x49e539[_0x3edb('0x1d')]?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e539['options']?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x1f')]||null:null,'attributes':_0x49e539[_0x3edb('0x1d')]?_0x49e539['options'][_0x3edb('0x20')]||null:null,'limit':_0x49e539[_0x3edb('0x1d')]?_0x49e539[_0x3edb('0x1d')][_0x3edb('0x21')]||null:null})[_0x3edb('0x10')](function(_0x39228e){logger[_0x3edb('0x11')](_0x3edb('0x22'),_0x49e539);logger[_0x3edb('0x23')](_0x3edb('0x22'),_0x49e539,JSON[_0x3edb('0x14')](_0x39228e));_0x2616cd(_0x39228e);})['catch'](function(_0xeef83f){logger[_0x3edb('0x15')](_0x3edb('0x22'),_0xeef83f[_0x3edb('0x18')],_0x49e539);_0x1ed4b2(_0x1515e9[_0x3edb('0x15')](0x1f4,_0xeef83f[_0x3edb('0x18')]));});});};exports[_0x3edb('0x24')]=function(_0x3f73ec){return new Promise(function(_0x3b4804,_0x49460e){return db[_0x3edb('0x25')][_0x3edb('0x26')]({'where':_0x3f73ec[_0x3edb('0x1d')]?_0x3f73ec[_0x3edb('0x1d')]['where']||null:null})[_0x3edb('0x10')](function(_0x12f397){if(_0x12f397){return _0x12f397[_0x3edb('0x27')](_0x3f73ec[_0x3edb('0x1c')][_0x3edb('0x28')],_['omit'](_0x3f73ec[_0x3edb('0x1c')],[_0x3edb('0x28'),'id'])||{});}})[_0x3edb('0x29')](function(_0x400dce){logger[_0x3edb('0x11')](_0x3edb('0x2a'),_0x3f73ec);logger[_0x3edb('0x23')]('AddTags',_0x3f73ec,JSON[_0x3edb('0x14')](_0x400dce));_0x3b4804(_0x400dce);})[_0x3edb('0x1a')](function(_0x58efdc){logger[_0x3edb('0x15')]('AddTags',_0x58efdc[_0x3edb('0x18')],_0x3f73ec);_0x49460e(_this[_0x3edb('0x15')](0x1f4,_0x58efdc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index eec8806..ad84b5f 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 _0x95e7=['chatInteraction:','./chatInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x34ffac,_0x416951){var _0x4f0d03=function(_0x57689f){while(--_0x57689f){_0x34ffac['push'](_0x34ffac['shift']());}};_0x4f0d03(++_0x416951);}(_0x95e7,0xa1));var _0x795e=function(_0x4511b5,_0x1b50cd){_0x4511b5=_0x4511b5-0x0;var _0x1e540e=_0x95e7[_0x4511b5];return _0x1e540e;};'use strict';var ChatInteractionEvents=require(_0x795e('0x0'));var events=[_0x795e('0x1'),_0x795e('0x2'),_0x795e('0x3')];function createListener(_0x580ccf,_0x456db6){return function(_0x5cc1cd){_0x456db6['emit'](_0x580ccf,_0x5cc1cd);};}function removeListener(_0x4950be,_0x176ac3){return function(){ChatInteractionEvents[_0x795e('0x4')](_0x4950be,_0x176ac3);};}exports[_0x795e('0x5')]=function(_0x25045a){for(var _0x5519d4=0x0,_0xda4a70=events[_0x795e('0x6')];_0x5519d4<_0xda4a70;_0x5519d4++){var _0x3a400d=events[_0x5519d4];var _0x23c210=createListener(_0x795e('0x7')+_0x3a400d,_0x25045a);ChatInteractionEvents['on'](_0x3a400d,_0x23c210);}}; \ No newline at end of file +var _0x53d5=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x3eda00,_0x224b78){var _0x44b022=function(_0x377ef0){while(--_0x377ef0){_0x3eda00['push'](_0x3eda00['shift']());}};_0x44b022(++_0x224b78);}(_0x53d5,0x1cc));var _0x553d=function(_0x2ff5c6,_0x248fe2){_0x2ff5c6=_0x2ff5c6-0x0;var _0x5605f2=_0x53d5[_0x2ff5c6];return _0x5605f2;};'use strict';var ChatInteractionEvents=require(_0x553d('0x0'));var events=[_0x553d('0x1'),_0x553d('0x2'),_0x553d('0x3')];function createListener(_0x1036b6,_0x81eca2){return function(_0x36f940){_0x81eca2['emit'](_0x1036b6,_0x36f940);};}function removeListener(_0xd5d2f7,_0x9e2c06){return function(){ChatInteractionEvents[_0x553d('0x4')](_0xd5d2f7,_0x9e2c06);};}exports[_0x553d('0x5')]=function(_0x2936ad){for(var _0x5328ca=0x0,_0x1d5a5e=events[_0x553d('0x6')];_0x5328ca<_0x1d5a5e;_0x5328ca++){var _0x1c38b2=events[_0x5328ca];var _0x14ef22=createListener(_0x553d('0x7')+_0x1c38b2,_0x2936ad);ChatInteractionEvents['on'](_0x1c38b2,_0x14ef22);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1fde97e..c319b98 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 _0x512e=['getMyMessages','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','now','originalname','/:id/attachment_upload','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x512e,0x1d6));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe512('0x0'));var path=require(_0xe512('0x1'));var timeout=require(_0xe512('0x2'));var express=require(_0xe512('0x3'));var router=express[_0xe512('0x4')]();var fs_extra=require(_0xe512('0x5'));var auth=require(_0xe512('0x6'));var interaction=require(_0xe512('0x7'));var config=require('../../config/environment');var controller=require(_0xe512('0x8'));router['get']('/',auth[_0xe512('0x9')](),controller[_0xe512('0xa')]);router[_0xe512('0xb')](_0xe512('0xc'),auth[_0xe512('0x9')](),controller[_0xe512('0xd')]);router[_0xe512('0xb')](_0xe512('0xe'),auth[_0xe512('0xf')](),controller['show']);router[_0xe512('0xb')](_0xe512('0x10'),auth[_0xe512('0xf')](),controller['attachmentDownload']);router['get'](_0xe512('0x11'),auth[_0xe512('0x9')](),controller[_0xe512('0x12')]);router[_0xe512('0xb')](_0xe512('0x13'),auth[_0xe512('0xf')](),controller[_0xe512('0x14')]);router[_0xe512('0xb')]('/:id/download',auth[_0xe512('0x9')](),controller[_0xe512('0x15')]);router[_0xe512('0x16')]('/',auth[_0xe512('0x9')](),controller['create']);router['post'](_0xe512('0x17'),auth[_0xe512('0x9')](),controller[_0xe512('0x18')]);var upload=multer({'storage':multer[_0xe512('0x19')]({'destination':function(_0x2a1a4d,_0x3b0b43,_0x1fbef5){_0x1fbef5(null,path[_0xe512('0x1a')](config['root'],'server/files/attachments/'));},'filename':function(_0x172e8b,_0x257f0b,_0xd34b2d){_0xd34b2d(null,util['format'](_0xe512('0x1b'),Date[_0xe512('0x1c')](),_0x257f0b[_0xe512('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe512('0x1e'),upload['single'](_0xe512('0x1f')),controller['attachmentUpload']);router[_0xe512('0x16')](_0xe512('0x11'),auth[_0xe512('0xf')](),controller[_0xe512('0x20')]);router[_0xe512('0x16')](_0xe512('0x21'),auth['isAuthenticated'](),interaction[_0xe512('0x22')](_0xe512('0x23'),_0xe512('0x24')),controller[_0xe512('0x25')]);router[_0xe512('0x26')]('/:id',auth[_0xe512('0x9')](),interaction[_0xe512('0x22')](_0xe512('0x23'),'chatinteraction:update'),controller[_0xe512('0x27')]);router[_0xe512('0x26')]('/:id/custom_update',controller[_0xe512('0x28')]);router[_0xe512('0x26')](_0xe512('0x29'),auth[_0xe512('0xf')](),controller[_0xe512('0x2a')]);router[_0xe512('0x26')](_0xe512('0x2b'),controller[_0xe512('0x2c')]);router[_0xe512('0x2d')](_0xe512('0xe'),auth[_0xe512('0x9')](),interaction[_0xe512('0x22')](_0xe512('0x23'),'chatinteraction:destroy'),controller[_0xe512('0x2e')]);router[_0xe512('0x2d')](_0xe512('0x21'),auth['isAuthenticated'](),controller[_0xe512('0x2f')]);module[_0xe512('0x30')]=router; \ No newline at end of file +var _0x7ec7=['/:id/attachment_download','/:id/messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7ec7,0x1d6));var _0x77ec=function(_0x1be34d,_0x1c5537){_0x1be34d=_0x1be34d-0x0;var _0x449843=_0x7ec7[_0x1be34d];return _0x449843;};'use strict';var multer=require(_0x77ec('0x0'));var util=require(_0x77ec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77ec('0x2'));var router=express[_0x77ec('0x3')]();var fs_extra=require(_0x77ec('0x4'));var auth=require(_0x77ec('0x5'));var interaction=require(_0x77ec('0x6'));var config=require(_0x77ec('0x7'));var controller=require(_0x77ec('0x8'));router['get']('/',auth[_0x77ec('0x9')](),controller[_0x77ec('0xa')]);router['get'](_0x77ec('0xb'),auth[_0x77ec('0x9')](),controller[_0x77ec('0xc')]);router[_0x77ec('0xd')](_0x77ec('0xe'),auth[_0x77ec('0xf')](),controller['show']);router[_0x77ec('0xd')](_0x77ec('0x10'),auth[_0x77ec('0xf')](),controller['attachmentDownload']);router[_0x77ec('0xd')](_0x77ec('0x11'),auth[_0x77ec('0x9')](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0x77ec('0xf')](),controller[_0x77ec('0x12')]);router[_0x77ec('0xd')](_0x77ec('0x13'),auth[_0x77ec('0x9')](),controller['download']);router[_0x77ec('0x14')]('/',auth[_0x77ec('0x9')](),controller[_0x77ec('0x15')]);router[_0x77ec('0x14')](_0x77ec('0x16'),auth[_0x77ec('0x9')](),controller[_0x77ec('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b18c6,_0x28b260,_0x1f6523){_0x1f6523(null,path[_0x77ec('0x18')](config[_0x77ec('0x19')],_0x77ec('0x1a')));},'filename':function(_0x964f4e,_0x301815,_0x1ae428){_0x1ae428(null,util[_0x77ec('0x1b')](_0x77ec('0x1c'),Date[_0x77ec('0x1d')](),_0x301815[_0x77ec('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x77ec('0x14')](_0x77ec('0x1f'),upload[_0x77ec('0x20')](_0x77ec('0x21')),controller[_0x77ec('0x22')]);router[_0x77ec('0x14')](_0x77ec('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x77ec('0x23')]);router[_0x77ec('0x14')](_0x77ec('0x24'),auth[_0x77ec('0x9')](),interaction[_0x77ec('0x25')](_0x77ec('0x26'),_0x77ec('0x27')),controller[_0x77ec('0x28')]);router[_0x77ec('0x29')](_0x77ec('0xe'),auth['isAuthenticated'](),interaction[_0x77ec('0x25')]('chat',_0x77ec('0x2a')),controller['update']);router['put'](_0x77ec('0x2b'),controller[_0x77ec('0x2c')]);router[_0x77ec('0x29')](_0x77ec('0x2d'),auth[_0x77ec('0xf')](),controller[_0x77ec('0x2e')]);router[_0x77ec('0x29')](_0x77ec('0x2f'),controller[_0x77ec('0x30')]);router[_0x77ec('0x31')](_0x77ec('0xe'),auth[_0x77ec('0x9')](),interaction[_0x77ec('0x25')](_0x77ec('0x26'),_0x77ec('0x32')),controller[_0x77ec('0x33')]);router[_0x77ec('0x31')](_0x77ec('0x24'),auth['isAuthenticated'](),controller[_0x77ec('0x34')]);module[_0x77ec('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8cadc24..aad828a 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 _0xede6=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5908f9,_0x59d9d1){var _0xbdc629=function(_0x129012){while(--_0x129012){_0x5908f9['push'](_0x5908f9['shift']());}};_0xbdc629(++_0x59d9d1);}(_0xede6,0x1e3));var _0x6ede=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xede6[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x6ede('0x0'));module[_0x6ede('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6ede('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6ede('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6ede('0x4')]}}; \ No newline at end of file +var _0x610e=['exports','medium','BOOLEAN','sequelize'];(function(_0x31fb32,_0x52dd18){var _0x3ee276=function(_0x4c53a6){while(--_0x4c53a6){_0x31fb32['push'](_0x31fb32['shift']());}};_0x3ee276(++_0x52dd18);}(_0x610e,0x73));var _0xe610=function(_0x3946f0,_0x50663c){_0x3946f0=_0x3946f0-0x0;var _0x5dfae0=_0x610e[_0x3946f0];return _0x5dfae0;};'use strict';var Sequelize=require(_0xe610('0x0'));module[_0xe610('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe610('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe610('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3a60088..a5adc19 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 _0x6da4=['reject','save','update','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x5ec34c,_0x3b7b23){var _0x2f1d82=function(_0x5155da){while(--_0x5155da){_0x5ec34c['push'](_0x5ec34c['shift']());}};_0x2f1d82(++_0x3b7b23);}(_0x6da4,0x12c));var _0x46da=function(_0x43a5d2,_0x279cd1){_0x43a5d2=_0x43a5d2-0x0;var _0x58465d=_0x6da4[_0x43a5d2];return _0x58465d;};'use strict';var emlformat=require(_0x46da('0x0'));var rimraf=require(_0x46da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46da('0x2'));var rp=require(_0x46da('0x3'));var moment=require(_0x46da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46da('0x5'));var util=require('util');var path=require('path');var sox=require(_0x46da('0x6'));var csv=require(_0x46da('0x7'));var ejs=require(_0x46da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46da('0x9'));var crypto=require(_0x46da('0xa'));var jsforce=require(_0x46da('0xb'));var deskjs=require(_0x46da('0xc'));var toCsv=require(_0x46da('0x7'));var querystring=require(_0x46da('0xd'));var Papa=require(_0x46da('0xe'));var Redis=require(_0x46da('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46da('0x10'));var hardwareService=require(_0x46da('0x11'));var logger=require(_0x46da('0x12'))(_0x46da('0x13'));var utils=require(_0x46da('0x14'));var config=require(_0x46da('0x15'));var licenseUtil=require(_0x46da('0x16'));var db=require(_0x46da('0x17'))['db'];config[_0x46da('0x18')]=_['defaults'](config[_0x46da('0x18')],{'host':_0x46da('0x19'),'port':0x18eb});var socket=require(_0x46da('0x1a'))(new Redis(config['redis']));require(_0x46da('0x1b'))[_0x46da('0x1c')](socket);function respondWithStatusCode(_0xc65bd0,_0x42314a){_0x42314a=_0x42314a||0xcc;return function(_0x139c18){if(_0x139c18){return _0xc65bd0[_0x46da('0x1d')](_0x42314a);}return _0xc65bd0[_0x46da('0x1e')](_0x42314a)[_0x46da('0x1f')]();};}function respondWithResult(_0x572fb9,_0x1f4953){_0x1f4953=_0x1f4953||0xc8;return function(_0x1ed5af){if(_0x1ed5af){return _0x572fb9[_0x46da('0x1e')](_0x1f4953)[_0x46da('0x20')](_0x1ed5af);}};}function respondWithFilteredResult(_0x6d06a0,_0xe15cc8){return function(_0x23f0e1){if(_0x23f0e1){var _0x52dcc2=typeof _0xe15cc8[_0x46da('0x21')]===_0x46da('0x22')&&typeof _0xe15cc8[_0x46da('0x23')]===_0x46da('0x22');var _0x4ac2c8=_0x23f0e1[_0x46da('0x24')];var _0x48c95c=_0x52dcc2?0x0:_0xe15cc8[_0x46da('0x21')];var _0xd996d2=_0x52dcc2?_0x23f0e1['count']:_0xe15cc8[_0x46da('0x21')]+_0xe15cc8['limit'];var _0x46bc88;if(_0xd996d2>=_0x4ac2c8){_0xd996d2=_0x4ac2c8;_0x46bc88=0xc8;}else{_0x46bc88=0xce;}_0x6d06a0[_0x46da('0x1e')](_0x46bc88);return _0x6d06a0['set'](_0x46da('0x25'),_0x48c95c+'-'+_0xd996d2+'/'+_0x4ac2c8)[_0x46da('0x20')](_0x23f0e1);}return null;};}function patchUpdates(_0x5e8a4d){return function(_0x3a3952){try{jsonpatch[_0x46da('0x26')](_0x3a3952,_0x5e8a4d,!![]);}catch(_0x1d506f){return BPromise[_0x46da('0x27')](_0x1d506f);}return _0x3a3952[_0x46da('0x28')]();};}function saveUpdates(_0x8fb50a,_0x18c87f){return function(_0xf9cfed){if(_0xf9cfed){return _0xf9cfed[_0x46da('0x29')](_0x8fb50a)['then'](function(_0x2359be){return _0x2359be;});}return null;};}function removeEntity(_0x2db388,_0x102536){return function(_0x25c37c){if(_0x25c37c){return _0x25c37c[_0x46da('0x2a')]()['then'](function(){_0x2db388[_0x46da('0x1e')](0xcc)[_0x46da('0x1f')]();});}};}function handleEntityNotFound(_0x316f91,_0x271c49){return function(_0x5f4dec){if(!_0x5f4dec){_0x316f91[_0x46da('0x1d')](0x194);}return _0x5f4dec;};}function handleError(_0x51b7ea,_0x26ba71){_0x26ba71=_0x26ba71||0x1f4;return function(_0x4105da){logger[_0x46da('0x2b')](_0x4105da[_0x46da('0x2c')]);if(_0x4105da[_0x46da('0x2d')]){delete _0x4105da[_0x46da('0x2d')];}_0x51b7ea[_0x46da('0x1e')](_0x26ba71)['send'](_0x4105da);};}exports[_0x46da('0x2e')]=function(_0x4a8811,_0x5044f9){var _0x392a25={},_0x5aebbd={},_0xa45c97={'count':0x0,'rows':[]};var _0x2e857c=_[_0x46da('0x2f')](db[_0x46da('0x30')][_0x46da('0x31')],function(_0xecc25e){return{'name':_0xecc25e[_0x46da('0x32')],'type':_0xecc25e[_0x46da('0x33')][_0x46da('0x34')]};});_0x5aebbd[_0x46da('0x35')]=_['map'](_0x2e857c,'name');_0x5aebbd['query']=_[_0x46da('0x36')](_0x4a8811[_0x46da('0x37')]);_0x5aebbd[_0x46da('0x38')]=_['intersection'](_0x5aebbd['model'],_0x5aebbd['query']);_0x392a25[_0x46da('0x39')]=_[_0x46da('0x3a')](_0x5aebbd['model'],qs[_0x46da('0x3b')](_0x4a8811['query'][_0x46da('0x3b')]));_0x392a25['attributes']=_0x392a25[_0x46da('0x39')][_0x46da('0x3c')]?_0x392a25[_0x46da('0x39')]:_0x5aebbd['model'];if(!_0x4a8811[_0x46da('0x37')][_0x46da('0x3d')](_0x46da('0x3e'))){_0x392a25['limit']=qs[_0x46da('0x23')](_0x4a8811[_0x46da('0x37')][_0x46da('0x23')]);_0x392a25[_0x46da('0x21')]=qs[_0x46da('0x21')](_0x4a8811[_0x46da('0x37')][_0x46da('0x21')]);}_0x392a25[_0x46da('0x3f')]=qs[_0x46da('0x40')](_0x4a8811[_0x46da('0x37')][_0x46da('0x40')]);_0x392a25['where']=qs['filters'](_[_0x46da('0x41')](_0x4a8811['query'],_0x5aebbd[_0x46da('0x38')]),_0x2e857c);if(_0x4a8811[_0x46da('0x37')][_0x46da('0x42')]){_0x392a25[_0x46da('0x43')]=_[_0x46da('0x44')](_0x392a25[_0x46da('0x43')],{'$or':_['map'](_0x2e857c,function(_0x5439f2){if(_0x5439f2['type']!==_0x46da('0x45')){var _0x2cff3e={};_0x2cff3e[_0x5439f2['name']]={'$like':'%'+_0x4a8811[_0x46da('0x37')][_0x46da('0x42')]+'%'};return _0x2cff3e;}})});}_0x392a25=_[_0x46da('0x44')]({},_0x392a25,_0x4a8811[_0x46da('0x46')]);var _0x121878={'where':_0x392a25[_0x46da('0x43')]};return db[_0x46da('0x30')]['count'](_0x121878)['then'](function(_0x44bb85){_0xa45c97[_0x46da('0x24')]=_0x44bb85;if(_0x4a8811[_0x46da('0x37')][_0x46da('0x47')]){_0x392a25[_0x46da('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x46da('0x49')](_0x392a25);})[_0x46da('0x4a')](function(_0x372276){_0xa45c97[_0x46da('0x4b')]=_0x372276;return _0xa45c97;})[_0x46da('0x4a')](respondWithFilteredResult(_0x5044f9,_0x392a25))[_0x46da('0x4c')](handleError(_0x5044f9,null));};exports[_0x46da('0x4d')]=function(_0x5bdfa9,_0x413e47){var _0x506637={'raw':!![],'where':{'id':_0x5bdfa9[_0x46da('0x4e')]['id']}},_0x111acf={};_0x111acf[_0x46da('0x35')]=_[_0x46da('0x36')](db['ChatInternalMessage'][_0x46da('0x31')]);_0x111acf[_0x46da('0x37')]=_['keys'](_0x5bdfa9[_0x46da('0x37')]);_0x111acf[_0x46da('0x38')]=_['intersection'](_0x111acf[_0x46da('0x35')],_0x111acf[_0x46da('0x37')]);_0x506637[_0x46da('0x39')]=_[_0x46da('0x3a')](_0x111acf[_0x46da('0x35')],qs['fields'](_0x5bdfa9[_0x46da('0x37')][_0x46da('0x3b')]));_0x506637[_0x46da('0x39')]=_0x506637[_0x46da('0x39')]['length']?_0x506637[_0x46da('0x39')]:_0x111acf[_0x46da('0x35')];if(_0x5bdfa9[_0x46da('0x37')][_0x46da('0x47')]){_0x506637[_0x46da('0x48')]=[{'all':!![]}];}_0x506637=_[_0x46da('0x44')]({},_0x506637,_0x5bdfa9[_0x46da('0x46')]);return db['ChatInternalMessage']['find'](_0x506637)[_0x46da('0x4a')](handleEntityNotFound(_0x413e47,null))['then'](respondWithResult(_0x413e47,null))[_0x46da('0x4c')](handleError(_0x413e47,null));};exports['create']=function(_0x37102e,_0x40e5f3){return db['ChatInternalMessage'][_0x46da('0x4f')](_0x37102e[_0x46da('0x50')],{})[_0x46da('0x4a')](respondWithResult(_0x40e5f3,0xc9))[_0x46da('0x4c')](handleError(_0x40e5f3,null));};exports['update']=function(_0x4088c4,_0x5003d8){if(_0x4088c4[_0x46da('0x50')]['id']){delete _0x4088c4[_0x46da('0x50')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x4088c4[_0x46da('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5003d8,null))[_0x46da('0x4a')](saveUpdates(_0x4088c4[_0x46da('0x50')],null))['then'](respondWithResult(_0x5003d8,null))[_0x46da('0x4c')](handleError(_0x5003d8,null));};exports[_0x46da('0x2a')]=function(_0x4f97c6,_0x4063bd){return db[_0x46da('0x30')][_0x46da('0x51')]({'where':{'id':_0x4f97c6['params']['id']}})[_0x46da('0x4a')](handleEntityNotFound(_0x4063bd,null))[_0x46da('0x4a')](removeEntity(_0x4063bd,null))[_0x46da('0x4c')](handleError(_0x4063bd,null));};exports[_0x46da('0x52')]=function(_0x3c8ab1,_0x2396f9){return db['ChatInternalMessage'][_0x46da('0x52')]()[_0x46da('0x4a')](respondWithResult(_0x2396f9,null))[_0x46da('0x4c')](handleError(_0x2396f9,null));};function wrapUser(_0x4b35cf){return function(_0x2a4699){var _0x1beff9=_0x4b35cf[_0x46da('0x53')]({'plain':!![]});_0x1beff9['messages']=[];if(_0x2a4699){_0x1beff9[_0x46da('0x54')]=_0x2a4699[_0x46da('0x55')];_0x1beff9[_0x46da('0x56')]=_0x2a4699;}else{_0x1beff9[_0x46da('0x54')]=moment(0x0)[_0x46da('0x57')](_0x46da('0x58'));_0x1beff9[_0x46da('0x56')]={};}return _0x1beff9;};}exports[_0x46da('0x59')]=function(_0x10850b,_0x338670,_0x3be94a){var _0x1bcde4=[];return db[_0x46da('0x5a')][_0x46da('0x49')]({'where':{'role':[_0x46da('0x5b'),_0x46da('0x5c'),'user']},'attributes':['id','fullname','name',_0x46da('0x5d'),_0x46da('0x5e'),_0x46da('0x5f'),'online',_0x46da('0x60'),_0x46da('0x61'),_0x46da('0x62')],'order':qs[_0x46da('0x40')]('-online'),'include':[{'model':db[_0x46da('0x63')],'as':_0x46da('0x64'),'attributes':['id',_0x46da('0x2d'),_0x46da('0x33')],'through':{'attributes':[]}}]})[_0x46da('0x4a')](function(_0x5e48c7){if(_0x5e48c7){var _0x1332f7=_0x10850b['user']['get']({'plain':!![]});if(!_0x1332f7)throw new Error(_0x46da('0x65'));if(_0x1332f7[_0x46da('0x5d')]===_0x46da('0x66')){return db['UserProfileSection'][_0x46da('0x51')]({'where':{'name':_0x46da('0x67'),'userProfileId':_0x1332f7[_0x46da('0x68')]},'raw':!![]})[_0x46da('0x4a')](function(_0x5b6960){if(_0x5b6960){if(_0x5b6960[_0x46da('0x69')]===0x0){return db[_0x46da('0x6a')][_0x46da('0x49')]({'where':{'sectionId':_0x5b6960['id']},'raw':!![]})['then'](function(_0x4fad4d){var _0x35cf51=[];if(_['isEmpty'](_0x4fad4d)){_0x35cf51=_[_0x46da('0x42')](_0x5e48c7,function(_0x16f254){if(_0x16f254[_0x46da('0x5d')]!==_0x46da('0x5b')){return _0x16f254;}});return _0x35cf51;}else{for(var _0x55a55b=0x0;_0x55a55b<_0x5e48c7[_0x46da('0x3c')];_0x55a55b++){var _0x24ed0b=_0x5e48c7[_0x55a55b];if(_0x24ed0b[_0x46da('0x5d')]===_0x46da('0x5b')){var _0x16aa52=_[_0x46da('0x51')](_0x4fad4d,function(_0x107f08){return _0x107f08[_0x46da('0x6b')]===_0x24ed0b['id'];});if(_0x16aa52)_0x35cf51['push'](_0x24ed0b);}else{_0x35cf51[_0x46da('0x6c')](_0x24ed0b);}}return _0x35cf51;}});}else{return _0x5e48c7;}}else{var _0x4fcbe4=_[_0x46da('0x42')](_0x5e48c7,function(_0x1e04d3){if(_0x1e04d3['role']!==_0x46da('0x5b')){return _0x1e04d3;}});return _0x4fcbe4;}});}else{return _0x5e48c7;}}})[_0x46da('0x4a')](function(_0x25a701){var _0x306bf0=[];if(_0x25a701){_0x1bcde4=_0x25a701;for(var _0x2f2c06=0x0;_0x2f2c06<_0x25a701[_0x46da('0x3c')];_0x2f2c06+=0x1){_0x1bcde4[_0x2f2c06][_0x46da('0x6d')]=[];_0x306bf0[_0x46da('0x6c')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x10850b['user']['id'],_0x25a701[_0x2f2c06]['id']],'ToId':[_0x10850b['user']['id'],_0x25a701[_0x2f2c06]['id']],'ChatGroupId':null},'attributes':['id',_0x46da('0x55'),'FromId','ToId',_0x46da('0x6e'),_0x46da('0x50')],'order':qs[_0x46da('0x40')](_0x46da('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x46da('0x4a')](wrapUser(_0x25a701[_0x2f2c06])));}return BPromise[_0x46da('0x70')](_0x306bf0);}return[];})[_0x46da('0x4a')](function(_0x47cd40){return{'rows':_0x47cd40,'count':_0x47cd40[_0x46da('0x3c')]};})[_0x46da('0x4a')](respondWithResult(_0x338670,null))['catch'](handleError(_0x338670,null));}; \ No newline at end of file +var _0x950a=['create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','userpic','online','showWebBar','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','role','resourceId','push','FromId','ToId','read','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find'];(function(_0x1abad1,_0x54ec22){var _0x46639a=function(_0x284108){while(--_0x284108){_0x1abad1['push'](_0x1abad1['shift']());}};_0x46639a(++_0x54ec22);}(_0x950a,0x100));var _0xa950=function(_0x31d353,_0x438585){_0x31d353=_0x31d353-0x0;var _0x46ace9=_0x950a[_0x31d353];return _0x46ace9;};'use strict';var emlformat=require(_0xa950('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa950('0x1'));var jsonpatch=require(_0xa950('0x2'));var rp=require(_0xa950('0x3'));var moment=require(_0xa950('0x4'));var BPromise=require(_0xa950('0x5'));var Mustache=require(_0xa950('0x6'));var util=require(_0xa950('0x7'));var path=require(_0xa950('0x8'));var sox=require('sox');var csv=require(_0xa950('0x9'));var ejs=require(_0xa950('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa950('0xb'));var squel=require(_0xa950('0xc'));var crypto=require(_0xa950('0xd'));var jsforce=require(_0xa950('0xe'));var deskjs=require(_0xa950('0xf'));var toCsv=require(_0xa950('0x9'));var querystring=require(_0xa950('0x10'));var Papa=require(_0xa950('0x11'));var Redis=require(_0xa950('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa950('0x13'));var as=require(_0xa950('0x14'));var hardwareService=require(_0xa950('0x15'));var logger=require(_0xa950('0x16'))(_0xa950('0x17'));var utils=require(_0xa950('0x18'));var config=require(_0xa950('0x19'));var licenseUtil=require(_0xa950('0x1a'));var db=require(_0xa950('0x1b'))['db'];config[_0xa950('0x1c')]=_[_0xa950('0x1d')](config[_0xa950('0x1c')],{'host':_0xa950('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa950('0x1f'))[_0xa950('0x20')](socket);function respondWithStatusCode(_0x19e8ef,_0x3922fc){_0x3922fc=_0x3922fc||0xcc;return function(_0x2c6575){if(_0x2c6575){return _0x19e8ef[_0xa950('0x21')](_0x3922fc);}return _0x19e8ef[_0xa950('0x22')](_0x3922fc)[_0xa950('0x23')]();};}function respondWithResult(_0x596fec,_0x557e77){_0x557e77=_0x557e77||0xc8;return function(_0x11a870){if(_0x11a870){return _0x596fec[_0xa950('0x22')](_0x557e77)[_0xa950('0x24')](_0x11a870);}};}function respondWithFilteredResult(_0x3737cb,_0x463a33){return function(_0x12c4cf){if(_0x12c4cf){var _0x5c2edd=typeof _0x463a33[_0xa950('0x25')]==='undefined'&&typeof _0x463a33[_0xa950('0x26')]===_0xa950('0x27');var _0x4e552e=_0x12c4cf[_0xa950('0x28')];var _0x568c96=_0x5c2edd?0x0:_0x463a33[_0xa950('0x25')];var _0x39c529=_0x5c2edd?_0x12c4cf[_0xa950('0x28')]:_0x463a33[_0xa950('0x25')]+_0x463a33[_0xa950('0x26')];var _0x47f9ae;if(_0x39c529>=_0x4e552e){_0x39c529=_0x4e552e;_0x47f9ae=0xc8;}else{_0x47f9ae=0xce;}_0x3737cb['status'](_0x47f9ae);return _0x3737cb['set'](_0xa950('0x29'),_0x568c96+'-'+_0x39c529+'/'+_0x4e552e)[_0xa950('0x24')](_0x12c4cf);}return null;};}function patchUpdates(_0x52ec4d){return function(_0x58db42){try{jsonpatch[_0xa950('0x2a')](_0x58db42,_0x52ec4d,!![]);}catch(_0x4aa1dd){return BPromise[_0xa950('0x2b')](_0x4aa1dd);}return _0x58db42[_0xa950('0x2c')]();};}function saveUpdates(_0x415b0a,_0x653ed7){return function(_0x5af40b){if(_0x5af40b){return _0x5af40b[_0xa950('0x2d')](_0x415b0a)[_0xa950('0x2e')](function(_0x306807){return _0x306807;});}return null;};}function removeEntity(_0x57582c,_0x1e1529){return function(_0x357f71){if(_0x357f71){return _0x357f71[_0xa950('0x2f')]()[_0xa950('0x2e')](function(){_0x57582c['status'](0xcc)[_0xa950('0x23')]();});}};}function handleEntityNotFound(_0x13dce0,_0x37008f){return function(_0xb14b4c){if(!_0xb14b4c){_0x13dce0['sendStatus'](0x194);}return _0xb14b4c;};}function handleError(_0x4543b7,_0x3e4824){_0x3e4824=_0x3e4824||0x1f4;return function(_0x116c24){logger['error'](_0x116c24[_0xa950('0x30')]);if(_0x116c24[_0xa950('0x31')]){delete _0x116c24[_0xa950('0x31')];}_0x4543b7[_0xa950('0x22')](_0x3e4824)[_0xa950('0x32')](_0x116c24);};}exports['index']=function(_0x152aaa,_0xfa0333){var _0x271e87={},_0x331989={},_0x1b6a2a={'count':0x0,'rows':[]};var _0x1e3157=_[_0xa950('0x33')](db[_0xa950('0x34')][_0xa950('0x35')],function(_0x9b8edb){return{'name':_0x9b8edb[_0xa950('0x36')],'type':_0x9b8edb[_0xa950('0x37')][_0xa950('0x38')]};});_0x331989[_0xa950('0x39')]=_['map'](_0x1e3157,_0xa950('0x31'));_0x331989['query']=_[_0xa950('0x3a')](_0x152aaa['query']);_0x331989[_0xa950('0x3b')]=_[_0xa950('0x3c')](_0x331989[_0xa950('0x39')],_0x331989[_0xa950('0x3d')]);_0x271e87[_0xa950('0x3e')]=_[_0xa950('0x3c')](_0x331989[_0xa950('0x39')],qs[_0xa950('0x3f')](_0x152aaa['query'][_0xa950('0x3f')]));_0x271e87['attributes']=_0x271e87[_0xa950('0x3e')]['length']?_0x271e87['attributes']:_0x331989[_0xa950('0x39')];if(!_0x152aaa[_0xa950('0x3d')]['hasOwnProperty'](_0xa950('0x40'))){_0x271e87[_0xa950('0x26')]=qs[_0xa950('0x26')](_0x152aaa[_0xa950('0x3d')][_0xa950('0x26')]);_0x271e87[_0xa950('0x25')]=qs[_0xa950('0x25')](_0x152aaa[_0xa950('0x3d')][_0xa950('0x25')]);}_0x271e87['order']=qs['sort'](_0x152aaa[_0xa950('0x3d')][_0xa950('0x41')]);_0x271e87[_0xa950('0x42')]=qs[_0xa950('0x3b')](_['pick'](_0x152aaa[_0xa950('0x3d')],_0x331989[_0xa950('0x3b')]),_0x1e3157);if(_0x152aaa['query'][_0xa950('0x43')]){_0x271e87[_0xa950('0x42')]=_[_0xa950('0x44')](_0x271e87['where'],{'$or':_[_0xa950('0x33')](_0x1e3157,function(_0x115b23){if(_0x115b23[_0xa950('0x37')]!==_0xa950('0x45')){var _0x1eb499={};_0x1eb499[_0x115b23[_0xa950('0x31')]]={'$like':'%'+_0x152aaa[_0xa950('0x3d')][_0xa950('0x43')]+'%'};return _0x1eb499;}})});}_0x271e87=_[_0xa950('0x44')]({},_0x271e87,_0x152aaa[_0xa950('0x46')]);var _0x2eec53={'where':_0x271e87['where']};return db[_0xa950('0x34')]['count'](_0x2eec53)['then'](function(_0x4643c6){_0x1b6a2a[_0xa950('0x28')]=_0x4643c6;if(_0x152aaa[_0xa950('0x3d')][_0xa950('0x47')]){_0x271e87[_0xa950('0x48')]=[{'all':!![]}];}return db[_0xa950('0x34')]['findAll'](_0x271e87);})[_0xa950('0x2e')](function(_0x15fa60){_0x1b6a2a['rows']=_0x15fa60;return _0x1b6a2a;})['then'](respondWithFilteredResult(_0xfa0333,_0x271e87))[_0xa950('0x49')](handleError(_0xfa0333,null));};exports[_0xa950('0x4a')]=function(_0xf40575,_0x4e2c23){var _0x2ffd19={'raw':!![],'where':{'id':_0xf40575[_0xa950('0x4b')]['id']}},_0x1e6ac7={};_0x1e6ac7[_0xa950('0x39')]=_[_0xa950('0x3a')](db[_0xa950('0x34')]['rawAttributes']);_0x1e6ac7[_0xa950('0x3d')]=_[_0xa950('0x3a')](_0xf40575[_0xa950('0x3d')]);_0x1e6ac7['filters']=_[_0xa950('0x3c')](_0x1e6ac7[_0xa950('0x39')],_0x1e6ac7[_0xa950('0x3d')]);_0x2ffd19[_0xa950('0x3e')]=_[_0xa950('0x3c')](_0x1e6ac7['model'],qs[_0xa950('0x3f')](_0xf40575[_0xa950('0x3d')][_0xa950('0x3f')]));_0x2ffd19[_0xa950('0x3e')]=_0x2ffd19['attributes']['length']?_0x2ffd19['attributes']:_0x1e6ac7[_0xa950('0x39')];if(_0xf40575[_0xa950('0x3d')]['includeAll']){_0x2ffd19[_0xa950('0x48')]=[{'all':!![]}];}_0x2ffd19=_['merge']({},_0x2ffd19,_0xf40575[_0xa950('0x46')]);return db['ChatInternalMessage'][_0xa950('0x4c')](_0x2ffd19)['then'](handleEntityNotFound(_0x4e2c23,null))[_0xa950('0x2e')](respondWithResult(_0x4e2c23,null))['catch'](handleError(_0x4e2c23,null));};exports[_0xa950('0x4d')]=function(_0x26e9c0,_0x3c600a){return db['ChatInternalMessage'][_0xa950('0x4d')](_0x26e9c0['body'],{})[_0xa950('0x2e')](respondWithResult(_0x3c600a,0xc9))['catch'](handleError(_0x3c600a,null));};exports[_0xa950('0x2d')]=function(_0x2f27a8,_0x291017){if(_0x2f27a8[_0xa950('0x4e')]['id']){delete _0x2f27a8['body']['id'];}return db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'id':_0x2f27a8['params']['id']}})[_0xa950('0x2e')](handleEntityNotFound(_0x291017,null))[_0xa950('0x2e')](saveUpdates(_0x2f27a8[_0xa950('0x4e')],null))[_0xa950('0x2e')](respondWithResult(_0x291017,null))[_0xa950('0x49')](handleError(_0x291017,null));};exports[_0xa950('0x2f')]=function(_0x51481a,_0x39c125){return db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'id':_0x51481a[_0xa950('0x4b')]['id']}})[_0xa950('0x2e')](handleEntityNotFound(_0x39c125,null))[_0xa950('0x2e')](removeEntity(_0x39c125,null))[_0xa950('0x49')](handleError(_0x39c125,null));};exports[_0xa950('0x4f')]=function(_0x5aaa84,_0x23a211){return db[_0xa950('0x34')][_0xa950('0x4f')]()[_0xa950('0x2e')](respondWithResult(_0x23a211,null))[_0xa950('0x49')](handleError(_0x23a211,null));};function wrapUser(_0x3d7e57){return function(_0x3e511c){var _0xf0a8a=_0x3d7e57[_0xa950('0x50')]({'plain':!![]});_0xf0a8a[_0xa950('0x51')]=[];if(_0x3e511c){_0xf0a8a['lastMessageAt']=_0x3e511c[_0xa950('0x52')];_0xf0a8a[_0xa950('0x53')]=_0x3e511c;}else{_0xf0a8a[_0xa950('0x54')]=moment(0x0)[_0xa950('0x55')](_0xa950('0x56'));_0xf0a8a[_0xa950('0x53')]={};}return _0xf0a8a;};}exports[_0xa950('0x57')]=function(_0x10fa02,_0x58fd84,_0x5c86c9){var _0x1db7ac=[];return db[_0xa950('0x58')][_0xa950('0x59')]({'where':{'role':[_0xa950('0x5a'),'admin',_0xa950('0x5b')]},'attributes':['id',_0xa950('0x5c'),_0xa950('0x31'),'role',_0xa950('0x5d'),'internal',_0xa950('0x5e'),'lastLoginAt','allowmessenger',_0xa950('0x5f')],'order':qs[_0xa950('0x41')](_0xa950('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0xa950('0x61'),'attributes':['id','name',_0xa950('0x37')],'through':{'attributes':[]}}]})[_0xa950('0x2e')](function(_0x57ae0f){if(_0x57ae0f){var _0xee450=_0x10fa02[_0xa950('0x5b')][_0xa950('0x50')]({'plain':!![]});if(!_0xee450)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xee450['role']===_0xa950('0x5b')){return db[_0xa950('0x62')][_0xa950('0x4c')]({'where':{'name':_0xa950('0x63'),'userProfileId':_0xee450[_0xa950('0x64')]},'raw':!![]})['then'](function(_0x290162){if(_0x290162){if(_0x290162[_0xa950('0x65')]===0x0){return db[_0xa950('0x66')][_0xa950('0x59')]({'where':{'sectionId':_0x290162['id']},'raw':!![]})[_0xa950('0x2e')](function(_0xcf5da){var _0x301e88=[];if(_[_0xa950('0x67')](_0xcf5da)){_0x301e88=_[_0xa950('0x43')](_0x57ae0f,function(_0x347e9d){if(_0x347e9d['role']!=='agent'){return _0x347e9d;}});return _0x301e88;}else{for(var _0x4c4e6d=0x0;_0x4c4e6d<_0x57ae0f[_0xa950('0x68')];_0x4c4e6d++){var _0x56588d=_0x57ae0f[_0x4c4e6d];if(_0x56588d[_0xa950('0x69')]===_0xa950('0x5a')){var _0x11e25d=_['find'](_0xcf5da,function(_0x5cd86f){return _0x5cd86f[_0xa950('0x6a')]===_0x56588d['id'];});if(_0x11e25d)_0x301e88[_0xa950('0x6b')](_0x56588d);}else{_0x301e88[_0xa950('0x6b')](_0x56588d);}}return _0x301e88;}});}else{return _0x57ae0f;}}else{var _0x5c81a2=_['filter'](_0x57ae0f,function(_0x2ce80c){if(_0x2ce80c['role']!==_0xa950('0x5a')){return _0x2ce80c;}});return _0x5c81a2;}});}else{return _0x57ae0f;}}})[_0xa950('0x2e')](function(_0x17e710){var _0x115352=[];if(_0x17e710){_0x1db7ac=_0x17e710;for(var _0x5a6943=0x0;_0x5a6943<_0x17e710[_0xa950('0x68')];_0x5a6943+=0x1){_0x1db7ac[_0x5a6943][_0xa950('0x51')]=[];_0x115352['push'](db[_0xa950('0x34')][_0xa950('0x4c')]({'where':{'FromId':[_0x10fa02[_0xa950('0x5b')]['id'],_0x17e710[_0x5a6943]['id']],'ToId':[_0x10fa02[_0xa950('0x5b')]['id'],_0x17e710[_0x5a6943]['id']],'ChatGroupId':null},'attributes':['id',_0xa950('0x52'),_0xa950('0x6c'),_0xa950('0x6d'),_0xa950('0x6e'),_0xa950('0x4e')],'order':qs[_0xa950('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa950('0x2e')](wrapUser(_0x17e710[_0x5a6943])));}return BPromise['all'](_0x115352);}return[];})[_0xa950('0x2e')](function(_0x220b05){return{'rows':_0x220b05,'count':_0x220b05[_0xa950('0x68')]};})[_0xa950('0x2e')](respondWithResult(_0x58fd84,null))[_0xa950('0x49')](handleError(_0x58fd84,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c275588..c0fed80 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 _0x9017=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4cb8d7,_0x485454){var _0x2cc0e4=function(_0x304757){while(--_0x304757){_0x4cb8d7['push'](_0x4cb8d7['shift']());}};_0x2cc0e4(++_0x485454);}(_0x9017,0xbe));var _0x7901=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9017[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7901('0x0'));var ChatInternalMessage=require(_0x7901('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7901('0x2')](0x0);var events={'afterCreate':_0x7901('0x3'),'afterUpdate':_0x7901('0x4'),'afterDestroy':_0x7901('0x5')};function emitEvent(_0x380c3f){return function(_0x2b8c21,_0x2ae415,_0x22377b){ChatInternalMessageEvents[_0x7901('0x6')](_0x380c3f+':'+_0x2b8c21['id'],_0x2b8c21);ChatInternalMessageEvents['emit'](_0x380c3f,_0x2b8c21);_0x22377b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x7901('0x7')](e,emitEvent(event));}}module[_0x7901('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb126=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','remove','emit'];(function(_0x1ff8d7,_0x309a3b){var _0x22afc1=function(_0x309f38){while(--_0x309f38){_0x1ff8d7['push'](_0x1ff8d7['shift']());}};_0x22afc1(++_0x309a3b);}(_0xb126,0x127));var _0x6b12=function(_0x7ff018,_0x5719a6){_0x7ff018=_0x7ff018-0x0;var _0x470172=_0xb126[_0x7ff018];return _0x470172;};'use strict';var EventEmitter=require(_0x6b12('0x0'));var ChatInternalMessage=require(_0x6b12('0x1'))['db'][_0x6b12('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6b12('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6b12('0x4')};function emitEvent(_0xcecb2){return function(_0x4bae8c,_0x4e0286,_0x12fbf2){ChatInternalMessageEvents[_0x6b12('0x5')](_0xcecb2+':'+_0x4bae8c['id'],_0x4bae8c);ChatInternalMessageEvents['emit'](_0xcecb2,_0x4bae8c);_0x12fbf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x6b12('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index de4989f..fdb94e2 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 _0x7474=['lodash','../../config/logger','api','moment','request-promise','rimraf','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4a84d,_0x5e3c24){var _0x2bc51a=function(_0x3cf154){while(--_0x3cf154){_0x4a84d['push'](_0x4a84d['shift']());}};_0x2bc51a(++_0x5e3c24);}(_0x7474,0xe7));var _0x4747=function(_0x3f1204,_0x2da03e){_0x3f1204=_0x3f1204-0x0;var _0x8bcca1=_0x7474[_0x3f1204];return _0x8bcca1;};'use strict';var _=require(_0x4747('0x0'));var util=require('util');var logger=require(_0x4747('0x1'))(_0x4747('0x2'));var moment=require(_0x4747('0x3'));var BPromise=require('bluebird');var rp=require(_0x4747('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4747('0x5'));var config=require('../../config/environment');var attributes=require(_0x4747('0x6'));module['exports']=function(_0x35f8c1,_0x23179c){return _0x35f8c1[_0x4747('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x4747('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4747('0x9'),'collate':_0x4747('0xa')});}; \ No newline at end of file +var _0x35fe=['utf8mb4_unicode_ci','lodash','util','api','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x2a36ea,_0x312d3f){var _0x248369=function(_0x15401e){while(--_0x15401e){_0x2a36ea['push'](_0x2a36ea['shift']());}};_0x248369(++_0x312d3f);}(_0x35fe,0x85));var _0xe35f=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x35fe[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xe35f('0x0'));var util=require(_0xe35f('0x1'));var logger=require('../../config/logger')(_0xe35f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe35f('0x3'));var rimraf=require(_0xe35f('0x4'));var config=require(_0xe35f('0x5'));var attributes=require(_0xe35f('0x6'));module['exports']=function(_0x19d8c4,_0x1a5e76){return _0x19d8c4[_0xe35f('0x7')](_0xe35f('0x8'),attributes,{'tableName':_0xe35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe35f('0xa'),'collate':_0xe35f('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e290551..dadf410 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 _0x2908=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client'];(function(_0x57cfc8,_0x22116b){var _0x1a024b=function(_0x215d16){while(--_0x215d16){_0x57cfc8['push'](_0x57cfc8['shift']());}};_0x1a024b(++_0x22116b);}(_0x2908,0x1ef));var _0x8290=function(_0x5ad5f8,_0x433a55){_0x5ad5f8=_0x5ad5f8-0x0;var _0x4befc6=_0x2908[_0x5ad5f8];return _0x4befc6;};'use strict';var _=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var moment=require(_0x8290('0x2'));var BPromise=require(_0x8290('0x3'));var rs=require(_0x8290('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8290('0x5'));var logger=require('../../config/logger')(_0x8290('0x6'));var config=require(_0x8290('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8290('0x8')]['http']({'port':0x232a});config[_0x8290('0x9')]=_[_0x8290('0xa')](config['redis'],{'host':_0x8290('0xb'),'port':0x18eb});var socket=require(_0x8290('0xc'))(new Redis(config[_0x8290('0x9')]));require(_0x8290('0xd'))['register'](socket);function respondWithRpcPromise(_0x21fca1,_0x46e0c9,_0x2b0c6a){return new BPromise(function(_0x46fb6b,_0x226edc){return client['request'](_0x21fca1,_0x2b0c6a)[_0x8290('0xe')](function(_0x3037b8){logger[_0x8290('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,'request\x20sent');logger['debug'](_0x8290('0x10'),_0x46e0c9,_0x8290('0x11'),JSON[_0x8290('0x12')](_0x3037b8));if(_0x3037b8[_0x8290('0x13')]){if(_0x3037b8[_0x8290('0x13')][_0x8290('0x14')]===0x1f4){logger[_0x8290('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x226edc(_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);}logger['error'](_0x8290('0x16'),_0x46e0c9,_0x3037b8[_0x8290('0x13')][_0x8290('0x15')]);return _0x46fb6b(_0x3037b8['error'][_0x8290('0x15')]);}else{logger[_0x8290('0xf')](_0x8290('0x16'),_0x46e0c9,_0x8290('0x11'));_0x46fb6b(_0x3037b8[_0x8290('0x17')][_0x8290('0x15')]);}})['catch'](function(_0x4caf0c){logger[_0x8290('0x13')](_0x8290('0x16'),_0x46e0c9,_0x4caf0c);_0x226edc(_0x4caf0c);});});} \ No newline at end of file +var _0x4cad=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x22e535,_0x2344a7){var _0x2b8eac=function(_0xcea172){while(--_0xcea172){_0x22e535['push'](_0x22e535['shift']());}};_0x2b8eac(++_0x2344a7);}(_0x4cad,0xe7));var _0xd4ca=function(_0x536aea,_0x48e27d){_0x536aea=_0x536aea-0x0;var _0x275449=_0x4cad[_0x536aea];return _0x275449;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var moment=require(_0xd4ca('0x2'));var BPromise=require(_0xd4ca('0x3'));var rs=require(_0xd4ca('0x4'));var fs=require('fs');var Redis=require(_0xd4ca('0x5'));var db=require(_0xd4ca('0x6'))['db'];var utils=require(_0xd4ca('0x7'));var logger=require(_0xd4ca('0x8'))(_0xd4ca('0x9'));var config=require(_0xd4ca('0xa'));var jayson=require(_0xd4ca('0xb'));var client=jayson[_0xd4ca('0xc')][_0xd4ca('0xd')]({'port':0x232a});config[_0xd4ca('0xe')]=_[_0xd4ca('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd4ca('0x10'))(new Redis(config[_0xd4ca('0xe')]));require('./chatInternalMessage.socket')[_0xd4ca('0x11')](socket);function respondWithRpcPromise(_0x47855b,_0x428f88,_0x3d5781){return new BPromise(function(_0x19abf7,_0x1e66e6){return client['request'](_0x47855b,_0x3d5781)['then'](function(_0xb8ffbf){logger[_0xd4ca('0x12')](_0xd4ca('0x13'),_0x428f88,_0xd4ca('0x14'));logger[_0xd4ca('0x15')](_0xd4ca('0x16'),_0x428f88,'request\x20sent',JSON['stringify'](_0xb8ffbf));if(_0xb8ffbf[_0xd4ca('0x17')]){if(_0xb8ffbf['error'][_0xd4ca('0x18')]===0x1f4){logger[_0xd4ca('0x17')](_0xd4ca('0x13'),_0x428f88,_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);return _0x1e66e6(_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);}logger[_0xd4ca('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x428f88,_0xb8ffbf[_0xd4ca('0x17')][_0xd4ca('0x19')]);return _0x19abf7(_0xb8ffbf[_0xd4ca('0x17')]['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x428f88,_0xd4ca('0x14'));_0x19abf7(_0xb8ffbf[_0xd4ca('0x1a')][_0xd4ca('0x19')]);}})[_0xd4ca('0x1b')](function(_0x2fd3cb){logger[_0xd4ca('0x17')](_0xd4ca('0x13'),_0x428f88,_0x2fd3cb);_0x1e66e6(_0x2fd3cb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 609c7f2..dedb097 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 _0xd2c8=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','register'];(function(_0x418874,_0x3c4c7e){var _0x1420e4=function(_0x26b306){while(--_0x26b306){_0x418874['push'](_0x418874['shift']());}};_0x1420e4(++_0x3c4c7e);}(_0xd2c8,0x18a));var _0x8d2c=function(_0x259697,_0x17e1b0){_0x259697=_0x259697-0x0;var _0x390f0f=_0xd2c8[_0x259697];return _0x390f0f;};'use strict';var ChatInternalMessageEvents=require(_0x8d2c('0x0'));var events=[_0x8d2c('0x1'),_0x8d2c('0x2'),_0x8d2c('0x3')];function createListener(_0x5101da,_0x25f243){return function(_0x6ae5ba){_0x25f243['emit'](_0x5101da,_0x6ae5ba);};}function removeListener(_0xdfeb66,_0x5bd8ba){return function(){ChatInternalMessageEvents['removeListener'](_0xdfeb66,_0x5bd8ba);};}exports[_0x8d2c('0x4')]=function(_0x3ba0c4){for(var _0x5bd5d6=0x0,_0x407bec=events[_0x8d2c('0x5')];_0x5bd5d6<_0x407bec;_0x5bd5d6++){var _0x196c16=events[_0x5bd5d6];var _0x1e4864=createListener(_0x8d2c('0x6')+_0x196c16,_0x3ba0c4);ChatInternalMessageEvents['on'](_0x196c16,_0x1e4864);}}; \ No newline at end of file +var _0x9523=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener'];(function(_0x52c71b,_0x4d8190){var _0x12fd26=function(_0x3dd283){while(--_0x3dd283){_0x52c71b['push'](_0x52c71b['shift']());}};_0x12fd26(++_0x4d8190);}(_0x9523,0x14c));var _0x3952=function(_0x20cb27,_0x13a7f){_0x20cb27=_0x20cb27-0x0;var _0xeee669=_0x9523[_0x20cb27];return _0xeee669;};'use strict';var ChatInternalMessageEvents=require(_0x3952('0x0'));var events=[_0x3952('0x1'),'remove',_0x3952('0x2')];function createListener(_0x5f04e2,_0x4097f1){return function(_0x48c613){_0x4097f1['emit'](_0x5f04e2,_0x48c613);};}function removeListener(_0x4bcca2,_0x345b8d){return function(){ChatInternalMessageEvents[_0x3952('0x3')](_0x4bcca2,_0x345b8d);};}exports[_0x3952('0x4')]=function(_0x29e194){for(var _0x1fd6e7=0x0,_0x21847e=events[_0x3952('0x5')];_0x1fd6e7<_0x21847e;_0x1fd6e7++){var _0x4a7d40=events[_0x1fd6e7];var _0x4d77ed=createListener(_0x3952('0x6')+_0x4a7d40,_0x29e194);ChatInternalMessageEvents['on'](_0x4a7d40,_0x4d77ed);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2837868..4e538a2 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 _0xb1b7=['get','/describe','describe','isAuthenticated','getUsers','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./chatInternalMessage.controller'];(function(_0x449aa4,_0x394570){var _0x7f5619=function(_0x22d068){while(--_0x22d068){_0x449aa4['push'](_0x449aa4['shift']());}};_0x7f5619(++_0x394570);}(_0xb1b7,0x13e));var _0x7b1b=function(_0x206fc6,_0x1c1db9){_0x206fc6=_0x206fc6-0x0;var _0x35cc76=_0xb1b7[_0x206fc6];return _0x35cc76;};'use strict';var multer=require(_0x7b1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b1b('0x1'));var express=require(_0x7b1b('0x2'));var router=express[_0x7b1b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b1b('0x4'));var config=require('../../config/environment');var controller=require(_0x7b1b('0x5'));router[_0x7b1b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b1b('0x6')](_0x7b1b('0x7'),auth['isAuthenticated'](),controller[_0x7b1b('0x8')]);router['get']('/users',auth[_0x7b1b('0x9')](),controller[_0x7b1b('0xa')]);router[_0x7b1b('0x6')](_0x7b1b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7b1b('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b1b('0xd')]);router['put'](_0x7b1b('0xb'),controller[_0x7b1b('0xe')]);router[_0x7b1b('0xf')](_0x7b1b('0xb'),auth[_0x7b1b('0x9')](),controller[_0x7b1b('0x10')]);module[_0x7b1b('0x11')]=router; \ No newline at end of file +var _0x260e=['index','/describe','describe','/users','getUsers','/:id','show','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x57cf34,_0x2cf8c5){var _0x378b6a=function(_0x423342){while(--_0x423342){_0x57cf34['push'](_0x57cf34['shift']());}};_0x378b6a(++_0x2cf8c5);}(_0x260e,0x1d7));var _0xe260=function(_0x1b8cb0,_0x148054){_0x1b8cb0=_0x1b8cb0-0x0;var _0x5cfe5a=_0x260e[_0x1b8cb0];return _0x5cfe5a;};'use strict';var multer=require(_0xe260('0x0'));var util=require(_0xe260('0x1'));var path=require('path');var timeout=require(_0xe260('0x2'));var express=require(_0xe260('0x3'));var router=express[_0xe260('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe260('0x5'));var config=require('../../config/environment');var controller=require(_0xe260('0x6'));router[_0xe260('0x7')]('/',auth[_0xe260('0x8')](),controller[_0xe260('0x9')]);router[_0xe260('0x7')](_0xe260('0xa'),auth['isAuthenticated'](),controller[_0xe260('0xb')]);router[_0xe260('0x7')](_0xe260('0xc'),auth[_0xe260('0x8')](),controller[_0xe260('0xd')]);router[_0xe260('0x7')](_0xe260('0xe'),auth['isAuthenticated'](),controller[_0xe260('0xf')]);router['post']('/',auth[_0xe260('0x8')](),controller[_0xe260('0x10')]);router[_0xe260('0x11')](_0xe260('0xe'),controller[_0xe260('0x12')]);router['delete'](_0xe260('0xe'),auth[_0xe260('0x8')](),controller[_0xe260('0x13')]);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 da8200b..56e7bc1 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 _0xbd8e=['out','DATE','STRING','sequelize','exports','BOOLEAN','ENUM'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xbd8e,0x1b5));var _0xebd8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbd8e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xebd8('0x0'));module[_0xebd8('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xebd8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xebd8('0x3')]('in',_0xebd8('0x4')),'defaultValue':_0xebd8('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xebd8('0x5')]},'providerName':{'type':Sequelize[_0xebd8('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3e36be,_0xf8506){var _0x107cbe=function(_0x3cab73){while(--_0x3cab73){_0x3e36be['push'](_0x3e36be['shift']());}};_0x107cbe(++_0xf8506);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x52017c,_0x393604){_0x52017c=_0x52017c-0x0;var _0xada67d=_0xd0e4[_0x52017c];return _0xada67d;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e9ab451..9427827 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 _0xb774=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','describe','accept','chat','read','readAt','format','UserId','agent','message','get','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','internal','manual','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteraction','ChatInteractionId','RejectMessage','rejectMessage','fullname','email','interface','SIP/%s','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','info','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model'];(function(_0x3342aa,_0x45057b){var _0xe85254=function(_0x30ad64){while(--_0x30ad64){_0x3342aa['push'](_0x3342aa['shift']());}};_0xe85254(++_0x45057b);}(_0xb774,0x15a));var _0x4b77=function(_0x5dcc6b,_0x3766a7){_0x5dcc6b=_0x5dcc6b-0x0;var _0x5a06b3=_0xb774[_0x5dcc6b];return _0x5a06b3;};'use strict';var emlformat=require(_0x4b77('0x0'));var rimraf=require(_0x4b77('0x1'));var zipdir=require(_0x4b77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b77('0x3'));var BPromise=require(_0x4b77('0x4'));var Mustache=require(_0x4b77('0x5'));var util=require(_0x4b77('0x6'));var path=require('path');var sox=require(_0x4b77('0x7'));var csv=require(_0x4b77('0x8'));var ejs=require(_0x4b77('0x9'));var fs=require('fs');var fs_extra=require(_0x4b77('0xa'));var _=require(_0x4b77('0xb'));var squel=require(_0x4b77('0xc'));var crypto=require(_0x4b77('0xd'));var jsforce=require(_0x4b77('0xe'));var deskjs=require(_0x4b77('0xf'));var toCsv=require(_0x4b77('0x8'));var querystring=require(_0x4b77('0x10'));var Papa=require(_0x4b77('0x11'));var Redis=require('ioredis');var authService=require(_0x4b77('0x12'));var qs=require(_0x4b77('0x13'));var as=require(_0x4b77('0x14'));var hardwareService=require(_0x4b77('0x15'));var logger=require(_0x4b77('0x16'))(_0x4b77('0x17'));var utils=require('../../config/utils');var config=require(_0x4b77('0x18'));var licenseUtil=require(_0x4b77('0x19'));var db=require(_0x4b77('0x1a'))['db'];config['redis']=_[_0x4b77('0x1b')](config[_0x4b77('0x1c')],{'host':_0x4b77('0x1d'),'port':0x18eb});var socket=require(_0x4b77('0x1e'))(new Redis(config[_0x4b77('0x1c')]));require(_0x4b77('0x1f'))[_0x4b77('0x20')](socket);var jayson=require(_0x4b77('0x21'));var client=jayson[_0x4b77('0x22')][_0x4b77('0x23')]({'port':0x232c});var client9002=jayson[_0x4b77('0x22')][_0x4b77('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1ba1a4,_0x4dc61b,_0xa2199d,_0x4369e9){return new BPromise(function(_0x38a948,_0x354f5e){var _0x2ac41f=_0x4369e9||client;return _0x2ac41f[_0x4b77('0x24')](_0x1ba1a4,_0xa2199d)[_0x4b77('0x25')](function(_0x57b70c){logger['info'](_0x4b77('0x26'),_0x4dc61b,_0x4b77('0x27'));logger['debug'](_0x4b77('0x28'),_0x4dc61b,_0x4b77('0x27'),JSON[_0x4b77('0x29')](_0x57b70c));if(_0x57b70c[_0x4b77('0x2a')]){if(_0x57b70c[_0x4b77('0x2a')]['code']===0x1f4){logger['error'](_0x4b77('0x26'),_0x4dc61b,_0x57b70c[_0x4b77('0x2a')]['message']);return _0x354f5e(_0x57b70c[_0x4b77('0x2a')]['message']);}logger[_0x4b77('0x2a')](_0x4b77('0x26'),_0x4dc61b,_0x57b70c['error']['message']);return _0x38a948(_0x57b70c[_0x4b77('0x2a')]['message']);}else{logger[_0x4b77('0x2b')](_0x4b77('0x26'),_0x4dc61b,_0x4b77('0x27'));_0x38a948(_0x57b70c[_0x4b77('0x2c')]['message']);}})[_0x4b77('0x2d')](function(_0x54bcad){logger['error'](_0x4b77('0x26'),_0x4dc61b,_0x54bcad);_0x354f5e(_0x54bcad);});});}function respondWithStatusCode(_0x2bfb3b,_0x3bb855){_0x3bb855=_0x3bb855||0xcc;return function(_0x393e83){if(_0x393e83){return _0x2bfb3b[_0x4b77('0x2e')](_0x3bb855);}return _0x2bfb3b[_0x4b77('0x2f')](_0x3bb855)['end']();};}function respondWithResult(_0x4f8acf,_0x423214){_0x423214=_0x423214||0xc8;return function(_0x1dad29){if(_0x1dad29){return _0x4f8acf[_0x4b77('0x2f')](_0x423214)['json'](_0x1dad29);}};}function respondWithFilteredResult(_0x587f35,_0x2b596b){return function(_0x1e84b8){if(_0x1e84b8){var _0x5acefe=typeof _0x2b596b[_0x4b77('0x30')]===_0x4b77('0x31')&&typeof _0x2b596b[_0x4b77('0x32')]===_0x4b77('0x31');var _0x575ded=_0x1e84b8[_0x4b77('0x33')];var _0x4a6a72=_0x5acefe?0x0:_0x2b596b[_0x4b77('0x30')];var _0xd509a0=_0x5acefe?_0x1e84b8[_0x4b77('0x33')]:_0x2b596b[_0x4b77('0x30')]+_0x2b596b[_0x4b77('0x32')];var _0x55579c;if(_0xd509a0>=_0x575ded){_0xd509a0=_0x575ded;_0x55579c=0xc8;}else{_0x55579c=0xce;}_0x587f35[_0x4b77('0x2f')](_0x55579c);return _0x587f35['set'](_0x4b77('0x34'),_0x4a6a72+'-'+_0xd509a0+'/'+_0x575ded)[_0x4b77('0x35')](_0x1e84b8);}return null;};}function patchUpdates(_0x2d0030){return function(_0x46fc02){try{jsonpatch['apply'](_0x46fc02,_0x2d0030,!![]);}catch(_0x118f9a){return BPromise[_0x4b77('0x36')](_0x118f9a);}return _0x46fc02[_0x4b77('0x37')]();};}function saveUpdates(_0x15da3a,_0x1037c4){return function(_0x4dcf18){if(_0x4dcf18){return _0x4dcf18[_0x4b77('0x38')](_0x15da3a)[_0x4b77('0x25')](function(_0x3357e2){return _0x3357e2;});}return null;};}function removeEntity(_0x175096,_0x2f2d8d){return function(_0x1d368e){if(_0x1d368e){return _0x1d368e[_0x4b77('0x39')]()[_0x4b77('0x25')](function(){_0x175096[_0x4b77('0x2f')](0xcc)[_0x4b77('0x3a')]();});}};}function handleEntityNotFound(_0x3a9a62,_0x4e0c37){return function(_0x321b51){if(!_0x321b51){_0x3a9a62[_0x4b77('0x2e')](0x194);}return _0x321b51;};}function handleError(_0x12d076,_0x5223eb){_0x5223eb=_0x5223eb||0x1f4;return function(_0x2c5a7e){logger['error'](_0x2c5a7e['stack']);if(_0x2c5a7e[_0x4b77('0x3b')]){delete _0x2c5a7e[_0x4b77('0x3b')];}_0x12d076[_0x4b77('0x2f')](_0x5223eb)[_0x4b77('0x3c')](_0x2c5a7e);};}exports[_0x4b77('0x3d')]=function(_0x26ef4f,_0x1f16f0){var _0x2e8405={},_0x3b2755={},_0xe3132f={'count':0x0,'rows':[]};var _0x3bd994=_[_0x4b77('0x3e')](db[_0x4b77('0x3f')][_0x4b77('0x40')],function(_0x830ba5){return{'name':_0x830ba5[_0x4b77('0x41')],'type':_0x830ba5['type'][_0x4b77('0x42')]};});_0x3b2755[_0x4b77('0x43')]=_[_0x4b77('0x3e')](_0x3bd994,_0x4b77('0x3b'));_0x3b2755[_0x4b77('0x44')]=_['keys'](_0x26ef4f['query']);_0x3b2755[_0x4b77('0x45')]=_[_0x4b77('0x46')](_0x3b2755[_0x4b77('0x43')],_0x3b2755['query']);_0x2e8405['attributes']=_['intersection'](_0x3b2755[_0x4b77('0x43')],qs[_0x4b77('0x47')](_0x26ef4f['query'][_0x4b77('0x47')]));_0x2e8405[_0x4b77('0x48')]=_0x2e8405[_0x4b77('0x48')][_0x4b77('0x49')]?_0x2e8405[_0x4b77('0x48')]:_0x3b2755['model'];if(!_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x4a')](_0x4b77('0x4b'))){_0x2e8405[_0x4b77('0x32')]=qs['limit'](_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x32')]);_0x2e8405[_0x4b77('0x30')]=qs[_0x4b77('0x30')](_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x30')]);}_0x2e8405[_0x4b77('0x4c')]=qs[_0x4b77('0x4d')](_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x4d')]);_0x2e8405[_0x4b77('0x4e')]=qs[_0x4b77('0x45')](_[_0x4b77('0x4f')](_0x26ef4f[_0x4b77('0x44')],_0x3b2755[_0x4b77('0x45')]),_0x3bd994);if(_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x50')]){_0x2e8405[_0x4b77('0x4e')]=_[_0x4b77('0x51')](_0x2e8405['where'],{'$or':_[_0x4b77('0x3e')](_0x3bd994,function(_0x3db58d){if(_0x3db58d[_0x4b77('0x52')]!==_0x4b77('0x53')){var _0x337e47={};_0x337e47[_0x3db58d['name']]={'$like':'%'+_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x50')]+'%'};return _0x337e47;}})});}_0x2e8405=_[_0x4b77('0x51')]({},_0x2e8405,_0x26ef4f[_0x4b77('0x54')]);var _0x3ba911={'where':_0x2e8405[_0x4b77('0x4e')]};return db[_0x4b77('0x3f')][_0x4b77('0x33')](_0x3ba911)[_0x4b77('0x25')](function(_0x3ad4d5){_0xe3132f[_0x4b77('0x33')]=_0x3ad4d5;if(_0x26ef4f[_0x4b77('0x44')][_0x4b77('0x55')]){_0x2e8405[_0x4b77('0x56')]=[{'all':!![]}];}return db[_0x4b77('0x3f')][_0x4b77('0x57')](_0x2e8405);})[_0x4b77('0x25')](function(_0x1271a7){_0xe3132f['rows']=_0x1271a7;return _0xe3132f;})[_0x4b77('0x25')](respondWithFilteredResult(_0x1f16f0,_0x2e8405))[_0x4b77('0x2d')](handleError(_0x1f16f0,null));};exports[_0x4b77('0x58')]=function(_0xc3441c,_0x43a0f4){var _0x32b02b={'raw':!![],'where':{'id':_0xc3441c[_0x4b77('0x59')]['id']}},_0x12e876={};_0x12e876[_0x4b77('0x43')]=_['keys'](db[_0x4b77('0x3f')][_0x4b77('0x40')]);_0x12e876[_0x4b77('0x44')]=_[_0x4b77('0x5a')](_0xc3441c['query']);_0x12e876['filters']=_[_0x4b77('0x46')](_0x12e876[_0x4b77('0x43')],_0x12e876[_0x4b77('0x44')]);_0x32b02b[_0x4b77('0x48')]=_[_0x4b77('0x46')](_0x12e876[_0x4b77('0x43')],qs[_0x4b77('0x47')](_0xc3441c[_0x4b77('0x44')][_0x4b77('0x47')]));_0x32b02b[_0x4b77('0x48')]=_0x32b02b[_0x4b77('0x48')][_0x4b77('0x49')]?_0x32b02b[_0x4b77('0x48')]:_0x12e876[_0x4b77('0x43')];if(_0xc3441c['query'][_0x4b77('0x55')]){_0x32b02b['include']=[{'all':!![]}];}_0x32b02b=_[_0x4b77('0x51')]({},_0x32b02b,_0xc3441c[_0x4b77('0x54')]);return db[_0x4b77('0x3f')][_0x4b77('0x5b')](_0x32b02b)[_0x4b77('0x25')](handleEntityNotFound(_0x43a0f4,null))[_0x4b77('0x25')](respondWithResult(_0x43a0f4,null))[_0x4b77('0x2d')](handleError(_0x43a0f4,null));};exports[_0x4b77('0x5c')]=function(_0x307048,_0x504e66){return db[_0x4b77('0x3f')][_0x4b77('0x5c')](_0x307048[_0x4b77('0x5d')],{})['then'](respondWithResult(_0x504e66,0xc9))[_0x4b77('0x2d')](handleError(_0x504e66,null));};exports[_0x4b77('0x38')]=function(_0x11bf60,_0x48c415){if(_0x11bf60[_0x4b77('0x5d')]['id']){delete _0x11bf60['body']['id'];}return db[_0x4b77('0x3f')][_0x4b77('0x5b')]({'where':{'id':_0x11bf60[_0x4b77('0x59')]['id']}})[_0x4b77('0x25')](handleEntityNotFound(_0x48c415,null))['then'](saveUpdates(_0x11bf60[_0x4b77('0x5d')],null))[_0x4b77('0x25')](respondWithResult(_0x48c415,null))['catch'](handleError(_0x48c415,null));};exports[_0x4b77('0x39')]=function(_0x2fa2b5,_0x4b1e17){return db['ChatMessage'][_0x4b77('0x5b')]({'where':{'id':_0x2fa2b5[_0x4b77('0x59')]['id']}})[_0x4b77('0x25')](handleEntityNotFound(_0x4b1e17,null))[_0x4b77('0x25')](removeEntity(_0x4b1e17,null))[_0x4b77('0x2d')](handleError(_0x4b1e17,null));};exports['describe']=function(_0x4f9ebb,_0x13cfd3){return db[_0x4b77('0x3f')][_0x4b77('0x5e')]()[_0x4b77('0x25')](respondWithResult(_0x13cfd3,null))[_0x4b77('0x2d')](handleError(_0x13cfd3,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x4b77('0x5f')]=function(_0x371f0e,_0x5302fc,_0x3648f9){var _0x458621={'agent':{},'channel':_0x4b77('0x60')};if(_0x371f0e[_0x4b77('0x5d')]['id']){delete _0x371f0e['body']['id'];}_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x61')]=!![];_0x371f0e['body'][_0x4b77('0x62')]=moment()[_0x4b77('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x64')]=_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x64')]||_0x371f0e['user']['id'];_0x458621[_0x4b77('0x65')]['id']=_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x64')];return db['ChatMessage'][_0x4b77('0x5b')]({'where':{'id':_0x371f0e[_0x4b77('0x59')]['id'],'UserId':null}})[_0x4b77('0x25')](handleEntityNotFound(_0x5302fc,null))[_0x4b77('0x25')](saveUpdates(_0x371f0e[_0x4b77('0x5d')],null))[_0x4b77('0x25')](function(_0xd54159){if(_0xd54159){_0x458621[_0x4b77('0x66')]=_0xd54159[_0x4b77('0x67')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0xd54159['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5302fc,null))[_0x4b77('0x25')](function(_0x5882b9){if(_0x5882b9){return _0x5882b9[_0x4b77('0x38')]({'UserId':_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x64')],'read1stAt':_[_0x4b77('0x68')](_0x5882b9['read1stAt'])?moment()['format'](_0x4b77('0x69')):undefined});}return null;})['then'](function(_0x1a137c){if(_0x1a137c){_0x458621[_0x4b77('0x6a')]=_0x1a137c[_0x4b77('0x67')]({'plain':!![]});interaction_log[_0x4b77('0x2b')](_0x4b77('0x6b'),_0x371f0e['user']['id'],_0x371f0e['user'][_0x4b77('0x3b')],_0x371f0e[_0x4b77('0x6c')][_0x4b77('0x6d')],_0x458621[_0x4b77('0x6a')]['id'],_0x371f0e['body']?JSON['stringify'](_0x371f0e['body']):_0x4b77('0x6e'));return respondWithRpcPromise(_0x4b77('0x6f'),_0x4b77('0x70'),_0x458621);}return null;})[_0x4b77('0x25')](function(_0x45af61){var _0x3b6b74=_0x4b77('0x71')+_0x45af61[_0x4b77('0x66')][_0x4b77('0x72')];return db[_0x4b77('0x73')]['query'](_0x3b6b74,{'type':db['Sequelize'][_0x4b77('0x74')][_0x4b77('0x75')],'raw':!![]})[_0x4b77('0x25')](function(_0x4f51d2){return _0x4f51d2;});})[_0x4b77('0x25')](function(_0x2ef88a){if(_0x2ef88a){_0x458621[_0x4b77('0x66')][_0x4b77('0x76')]=_0x2ef88a[0x0];if(!_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x64')])return;return db['User'][_0x4b77('0x5b')]({'where':{'id':_0x371f0e['body'][_0x4b77('0x64')],'role':_0x4b77('0x65')},'attributes':['id',_0x4b77('0x3b'),'fullname','email',_0x4b77('0x77')],'raw':!![]});}return null;})[_0x4b77('0x25')](function(_0x33bebc){if(!_0x33bebc)return null;_0x458621[_0x4b77('0x66')]['agent']=_0x33bebc;return _0x458621;})['then'](function(_0x50d124){if(_0x50d124){if(_0x371f0e[_0x4b77('0x5d')][_0x4b77('0x78')]){_0x458621[_0x4b77('0x66')]['interface']=util[_0x4b77('0x63')]('SIP/%s',_0x371f0e[_0x4b77('0x6c')][_0x4b77('0x3b')]);_0x458621[_0x4b77('0x66')][_0x4b77('0x79')]=_0x458621[_0x4b77('0x79')];_0x458621[_0x4b77('0x66')]['motionChannel']=_0x458621['channel'];_0x458621['message'][_0x4b77('0x7a')]=_0x4b77('0x5f');return respondWithRpcPromise(_0x4b77('0x7b'),_0x4b77('0x7b'),{'event':_0x4b77('0x7c'),'message':_[_0x4b77('0x51')](_0x458621[_0x4b77('0x66')],JSON[_0x4b77('0x7d')](_0x458621['interaction'][_0x4b77('0x7e')]))},client9002)[_0x4b77('0x25')](function(){return _0x458621;});}return _0x458621;}return null;})[_0x4b77('0x25')](respondWithResult(_0x5302fc,null))[_0x4b77('0x2d')](handleError(_0x5302fc,null));};var interaction_log=require(_0x4b77('0x16'))(_0x4b77('0x7f'));exports[_0x4b77('0x36')]=function(_0x46f14f,_0x266666,_0x4518ea){var _0x2b0805={'agent':{},'channel':_0x4b77('0x60')};if(_0x46f14f['body']['id']){delete _0x46f14f[_0x4b77('0x5d')]['id'];}_0x46f14f['body']['UserId']=_0x46f14f[_0x4b77('0x5d')][_0x4b77('0x64')]||_0x46f14f['user']['id'];_0x2b0805[_0x4b77('0x65')]['id']=_0x46f14f[_0x4b77('0x5d')][_0x4b77('0x64')];return db[_0x4b77('0x3f')][_0x4b77('0x5b')]({'where':{'id':_0x46f14f[_0x4b77('0x59')]['id'],'UserId':null}})[_0x4b77('0x25')](handleEntityNotFound(_0x266666,null))['then'](function(_0x513942){if(_0x513942){_0x2b0805[_0x4b77('0x66')]=_0x513942[_0x4b77('0x67')]({'plain':!![]});return db[_0x4b77('0x80')][_0x4b77('0x5b')]({'where':{'id':_0x513942[_0x4b77('0x81')]}});}return null;})[_0x4b77('0x25')](handleEntityNotFound(_0x266666,null))[_0x4b77('0x25')](function(_0x2aaf9d){if(_0x2aaf9d){_0x2b0805[_0x4b77('0x6a')]=_0x2aaf9d[_0x4b77('0x67')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46f14f[_0x4b77('0x6c')]['id'],_0x46f14f['user'][_0x4b77('0x3b')],_0x46f14f['user'][_0x4b77('0x6d')],_0x2b0805[_0x4b77('0x6a')]['id'],_0x46f14f[_0x4b77('0x5d')]?JSON[_0x4b77('0x29')](_0x46f14f[_0x4b77('0x5d')]):_0x4b77('0x6e'));return respondWithRpcPromise(_0x4b77('0x82'),_0x4b77('0x83'),_0x2b0805);}return null;})[_0x4b77('0x25')](function(_0x5cdc0e){var _0x357b13=_0x4b77('0x71')+_0x5cdc0e['message'][_0x4b77('0x72')];return db['sequelize'][_0x4b77('0x44')](_0x357b13,{'type':db['Sequelize'][_0x4b77('0x74')][_0x4b77('0x75')],'raw':!![]})['then'](function(_0x1f1ed6){return _0x1f1ed6;});})['then'](function(_0x2d7a56){if(_0x2d7a56){_0x2b0805[_0x4b77('0x66')][_0x4b77('0x76')]=_0x2d7a56[0x0];if(!_0x46f14f['body'][_0x4b77('0x64')])return;return db['User'][_0x4b77('0x5b')]({'where':{'id':_0x46f14f[_0x4b77('0x5d')]['UserId'],'role':_0x4b77('0x65')},'attributes':['id','name',_0x4b77('0x84'),_0x4b77('0x85'),_0x4b77('0x77')],'raw':!![]});}return null;})[_0x4b77('0x25')](function(_0x42d702){if(!_0x42d702)return null;_0x2b0805[_0x4b77('0x66')][_0x4b77('0x65')]=_0x42d702;return _0x2b0805;})[_0x4b77('0x25')](function(_0x4625b5){if(_0x4625b5){_0x4625b5['message'][_0x4b77('0x86')]=util[_0x4b77('0x63')](_0x4b77('0x87'),_0x46f14f[_0x4b77('0x6c')][_0x4b77('0x3b')]);_0x4625b5[_0x4b77('0x66')][_0x4b77('0x79')]=_0x2b0805[_0x4b77('0x79')];_0x4625b5[_0x4b77('0x66')][_0x4b77('0x88')]=_0x2b0805['channel'];_0x4625b5[_0x4b77('0x66')]['event']='reject';respondWithRpcPromise(_0x4b77('0x7b'),'EventManager',{'event':_0x4b77('0x89'),'message':_[_0x4b77('0x51')](_0x2b0805[_0x4b77('0x66')],JSON[_0x4b77('0x7d')](_0x2b0805[_0x4b77('0x6a')][_0x4b77('0x7e')]))},client9002);return _0x2b0805;}return null;})['then'](respondWithResult(_0x266666,null))['catch'](handleError(_0x266666,null));}; \ No newline at end of file +var _0x7e74=['includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','email','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0xee76bb,_0x583e9b){var _0x35a5c1=function(_0x3f516b){while(--_0x3f516b){_0xee76bb['push'](_0xee76bb['shift']());}};_0x35a5c1(++_0x583e9b);}(_0x7e74,0xbd));var _0x47e7=function(_0x5d1ca7,_0x40be3c){_0x5d1ca7=_0x5d1ca7-0x0;var _0x1448f6=_0x7e74[_0x5d1ca7];return _0x1448f6;};'use strict';var emlformat=require(_0x47e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47e7('0x1'));var jsonpatch=require(_0x47e7('0x2'));var rp=require(_0x47e7('0x3'));var moment=require(_0x47e7('0x4'));var BPromise=require(_0x47e7('0x5'));var Mustache=require('mustache');var util=require(_0x47e7('0x6'));var path=require(_0x47e7('0x7'));var sox=require(_0x47e7('0x8'));var csv=require(_0x47e7('0x9'));var ejs=require(_0x47e7('0xa'));var fs=require('fs');var fs_extra=require(_0x47e7('0xb'));var _=require(_0x47e7('0xc'));var squel=require('squel');var crypto=require(_0x47e7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47e7('0xe'));var toCsv=require(_0x47e7('0x9'));var querystring=require(_0x47e7('0xf'));var Papa=require(_0x47e7('0x10'));var Redis=require(_0x47e7('0x11'));var authService=require(_0x47e7('0x12'));var qs=require(_0x47e7('0x13'));var as=require(_0x47e7('0x14'));var hardwareService=require(_0x47e7('0x15'));var logger=require(_0x47e7('0x16'))(_0x47e7('0x17'));var utils=require(_0x47e7('0x18'));var config=require(_0x47e7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x47e7('0x1a'))['db'];config[_0x47e7('0x1b')]=_[_0x47e7('0x1c')](config['redis'],{'host':_0x47e7('0x1d'),'port':0x18eb});var socket=require(_0x47e7('0x1e'))(new Redis(config[_0x47e7('0x1b')]));require(_0x47e7('0x1f'))['register'](socket);var jayson=require(_0x47e7('0x20'));var client=jayson[_0x47e7('0x21')][_0x47e7('0x22')]({'port':0x232c});var client9002=jayson[_0x47e7('0x21')][_0x47e7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x5369d4,_0x2e2aeb,_0x5d4801,_0x402ccc){return new BPromise(function(_0x8c320e,_0x14b43f){var _0x433705=_0x402ccc||client;return _0x433705[_0x47e7('0x23')](_0x5369d4,_0x5d4801)[_0x47e7('0x24')](function(_0x6a3682){logger[_0x47e7('0x25')](_0x47e7('0x26'),_0x2e2aeb,_0x47e7('0x27'));logger[_0x47e7('0x28')](_0x47e7('0x29'),_0x2e2aeb,_0x47e7('0x27'),JSON[_0x47e7('0x2a')](_0x6a3682));if(_0x6a3682['error']){if(_0x6a3682['error']['code']===0x1f4){logger['error'](_0x47e7('0x26'),_0x2e2aeb,_0x6a3682[_0x47e7('0x2b')][_0x47e7('0x2c')]);return _0x14b43f(_0x6a3682[_0x47e7('0x2b')]['message']);}logger['error'](_0x47e7('0x26'),_0x2e2aeb,_0x6a3682['error'][_0x47e7('0x2c')]);return _0x8c320e(_0x6a3682['error'][_0x47e7('0x2c')]);}else{logger[_0x47e7('0x25')](_0x47e7('0x26'),_0x2e2aeb,_0x47e7('0x27'));_0x8c320e(_0x6a3682['result']['message']);}})[_0x47e7('0x2d')](function(_0x25c0ca){logger[_0x47e7('0x2b')](_0x47e7('0x26'),_0x2e2aeb,_0x25c0ca);_0x14b43f(_0x25c0ca);});});}function respondWithStatusCode(_0x5b6736,_0x43fa51){_0x43fa51=_0x43fa51||0xcc;return function(_0x105add){if(_0x105add){return _0x5b6736[_0x47e7('0x2e')](_0x43fa51);}return _0x5b6736[_0x47e7('0x2f')](_0x43fa51)['end']();};}function respondWithResult(_0x2fb377,_0x1bdb4c){_0x1bdb4c=_0x1bdb4c||0xc8;return function(_0x301a68){if(_0x301a68){return _0x2fb377[_0x47e7('0x2f')](_0x1bdb4c)[_0x47e7('0x30')](_0x301a68);}};}function respondWithFilteredResult(_0x303ff6,_0x150c8b){return function(_0x55866e){if(_0x55866e){var _0x172c80=typeof _0x150c8b[_0x47e7('0x31')]===_0x47e7('0x32')&&typeof _0x150c8b[_0x47e7('0x33')]===_0x47e7('0x32');var _0x247515=_0x55866e['count'];var _0x2bc66d=_0x172c80?0x0:_0x150c8b[_0x47e7('0x31')];var _0x4078bd=_0x172c80?_0x55866e[_0x47e7('0x34')]:_0x150c8b[_0x47e7('0x31')]+_0x150c8b['limit'];var _0x47662b;if(_0x4078bd>=_0x247515){_0x4078bd=_0x247515;_0x47662b=0xc8;}else{_0x47662b=0xce;}_0x303ff6[_0x47e7('0x2f')](_0x47662b);return _0x303ff6[_0x47e7('0x35')](_0x47e7('0x36'),_0x2bc66d+'-'+_0x4078bd+'/'+_0x247515)[_0x47e7('0x30')](_0x55866e);}return null;};}function patchUpdates(_0x24f833){return function(_0x437b89){try{jsonpatch['apply'](_0x437b89,_0x24f833,!![]);}catch(_0x5dfae3){return BPromise[_0x47e7('0x37')](_0x5dfae3);}return _0x437b89['save']();};}function saveUpdates(_0x2d73c8,_0x6be695){return function(_0x5667fe){if(_0x5667fe){return _0x5667fe[_0x47e7('0x38')](_0x2d73c8)[_0x47e7('0x24')](function(_0x1f80e0){return _0x1f80e0;});}return null;};}function removeEntity(_0x526ad1,_0x58657f){return function(_0x2ad26d){if(_0x2ad26d){return _0x2ad26d[_0x47e7('0x39')]()['then'](function(){_0x526ad1[_0x47e7('0x2f')](0xcc)[_0x47e7('0x3a')]();});}};}function handleEntityNotFound(_0x3af095,_0x54542a){return function(_0x1fc445){if(!_0x1fc445){_0x3af095['sendStatus'](0x194);}return _0x1fc445;};}function handleError(_0x442081,_0x33c4f6){_0x33c4f6=_0x33c4f6||0x1f4;return function(_0x182cb9){logger['error'](_0x182cb9[_0x47e7('0x3b')]);if(_0x182cb9[_0x47e7('0x3c')]){delete _0x182cb9[_0x47e7('0x3c')];}_0x442081[_0x47e7('0x2f')](_0x33c4f6)[_0x47e7('0x3d')](_0x182cb9);};}exports[_0x47e7('0x3e')]=function(_0x4a551a,_0x5621ed){var _0x2b4994={},_0x4dabbb={},_0x16f2dd={'count':0x0,'rows':[]};var _0x3eb435=_[_0x47e7('0x3f')](db[_0x47e7('0x40')][_0x47e7('0x41')],function(_0x127bdc){return{'name':_0x127bdc[_0x47e7('0x42')],'type':_0x127bdc[_0x47e7('0x43')][_0x47e7('0x44')]};});_0x4dabbb[_0x47e7('0x45')]=_['map'](_0x3eb435,_0x47e7('0x3c'));_0x4dabbb['query']=_['keys'](_0x4a551a['query']);_0x4dabbb[_0x47e7('0x46')]=_[_0x47e7('0x47')](_0x4dabbb['model'],_0x4dabbb[_0x47e7('0x48')]);_0x2b4994[_0x47e7('0x49')]=_[_0x47e7('0x47')](_0x4dabbb[_0x47e7('0x45')],qs[_0x47e7('0x4a')](_0x4a551a['query'][_0x47e7('0x4a')]));_0x2b4994['attributes']=_0x2b4994[_0x47e7('0x49')][_0x47e7('0x4b')]?_0x2b4994[_0x47e7('0x49')]:_0x4dabbb['model'];if(!_0x4a551a[_0x47e7('0x48')][_0x47e7('0x4c')]('nolimit')){_0x2b4994['limit']=qs[_0x47e7('0x33')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x33')]);_0x2b4994['offset']=qs[_0x47e7('0x31')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x31')]);}_0x2b4994[_0x47e7('0x4d')]=qs[_0x47e7('0x4e')](_0x4a551a[_0x47e7('0x48')][_0x47e7('0x4e')]);_0x2b4994[_0x47e7('0x4f')]=qs[_0x47e7('0x46')](_[_0x47e7('0x50')](_0x4a551a[_0x47e7('0x48')],_0x4dabbb['filters']),_0x3eb435);if(_0x4a551a[_0x47e7('0x48')]['filter']){_0x2b4994[_0x47e7('0x4f')]=_['merge'](_0x2b4994[_0x47e7('0x4f')],{'$or':_['map'](_0x3eb435,function(_0x515665){if(_0x515665[_0x47e7('0x43')]!==_0x47e7('0x51')){var _0x594509={};_0x594509[_0x515665[_0x47e7('0x3c')]]={'$like':'%'+_0x4a551a[_0x47e7('0x48')][_0x47e7('0x52')]+'%'};return _0x594509;}})});}_0x2b4994=_[_0x47e7('0x53')]({},_0x2b4994,_0x4a551a[_0x47e7('0x54')]);var _0x8f2e5b={'where':_0x2b4994[_0x47e7('0x4f')]};return db[_0x47e7('0x40')][_0x47e7('0x34')](_0x8f2e5b)['then'](function(_0x18449a){_0x16f2dd['count']=_0x18449a;if(_0x4a551a['query'][_0x47e7('0x55')]){_0x2b4994[_0x47e7('0x56')]=[{'all':!![]}];}return db[_0x47e7('0x40')][_0x47e7('0x57')](_0x2b4994);})['then'](function(_0x59cc9a){_0x16f2dd[_0x47e7('0x58')]=_0x59cc9a;return _0x16f2dd;})[_0x47e7('0x24')](respondWithFilteredResult(_0x5621ed,_0x2b4994))[_0x47e7('0x2d')](handleError(_0x5621ed,null));};exports[_0x47e7('0x59')]=function(_0x5d0ad6,_0x926bc4){var _0x4db135={'raw':!![],'where':{'id':_0x5d0ad6[_0x47e7('0x5a')]['id']}},_0x5611fd={};_0x5611fd['model']=_[_0x47e7('0x5b')](db[_0x47e7('0x40')][_0x47e7('0x41')]);_0x5611fd[_0x47e7('0x48')]=_[_0x47e7('0x5b')](_0x5d0ad6[_0x47e7('0x48')]);_0x5611fd[_0x47e7('0x46')]=_[_0x47e7('0x47')](_0x5611fd[_0x47e7('0x45')],_0x5611fd[_0x47e7('0x48')]);_0x4db135[_0x47e7('0x49')]=_[_0x47e7('0x47')](_0x5611fd['model'],qs[_0x47e7('0x4a')](_0x5d0ad6['query'][_0x47e7('0x4a')]));_0x4db135[_0x47e7('0x49')]=_0x4db135[_0x47e7('0x49')][_0x47e7('0x4b')]?_0x4db135[_0x47e7('0x49')]:_0x5611fd[_0x47e7('0x45')];if(_0x5d0ad6[_0x47e7('0x48')][_0x47e7('0x55')]){_0x4db135[_0x47e7('0x56')]=[{'all':!![]}];}_0x4db135=_[_0x47e7('0x53')]({},_0x4db135,_0x5d0ad6[_0x47e7('0x54')]);return db[_0x47e7('0x40')][_0x47e7('0x5c')](_0x4db135)[_0x47e7('0x24')](handleEntityNotFound(_0x926bc4,null))[_0x47e7('0x24')](respondWithResult(_0x926bc4,null))['catch'](handleError(_0x926bc4,null));};exports['create']=function(_0x393a7e,_0x342ae3){return db['ChatMessage'][_0x47e7('0x5d')](_0x393a7e[_0x47e7('0x5e')],{})[_0x47e7('0x24')](respondWithResult(_0x342ae3,0xc9))['catch'](handleError(_0x342ae3,null));};exports[_0x47e7('0x38')]=function(_0x47d3fb,_0x4200c2){if(_0x47d3fb[_0x47e7('0x5e')]['id']){delete _0x47d3fb['body']['id'];}return db[_0x47e7('0x40')][_0x47e7('0x5c')]({'where':{'id':_0x47d3fb[_0x47e7('0x5a')]['id']}})[_0x47e7('0x24')](handleEntityNotFound(_0x4200c2,null))[_0x47e7('0x24')](saveUpdates(_0x47d3fb[_0x47e7('0x5e')],null))[_0x47e7('0x24')](respondWithResult(_0x4200c2,null))['catch'](handleError(_0x4200c2,null));};exports[_0x47e7('0x39')]=function(_0x12868c,_0x2da89c){return db[_0x47e7('0x40')]['find']({'where':{'id':_0x12868c[_0x47e7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2da89c,null))[_0x47e7('0x24')](removeEntity(_0x2da89c,null))['catch'](handleError(_0x2da89c,null));};exports[_0x47e7('0x5f')]=function(_0x5a953a,_0x192f8f){return db[_0x47e7('0x40')][_0x47e7('0x5f')]()[_0x47e7('0x24')](respondWithResult(_0x192f8f,null))[_0x47e7('0x2d')](handleError(_0x192f8f,null));};var interaction_log=require(_0x47e7('0x16'))(_0x47e7('0x60'));exports[_0x47e7('0x61')]=function(_0xb92a0b,_0x5c8213,_0x4f7aba){var _0x3788b8={'agent':{},'channel':_0x47e7('0x62')};if(_0xb92a0b['body']['id']){delete _0xb92a0b[_0x47e7('0x5e')]['id'];}_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x63')]=!![];_0xb92a0b[_0x47e7('0x5e')]['readAt']=moment()[_0x47e7('0x64')](_0x47e7('0x65'));_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')]=_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')]||_0xb92a0b[_0x47e7('0x67')]['id'];_0x3788b8[_0x47e7('0x68')]['id']=_0xb92a0b[_0x47e7('0x5e')]['UserId'];return db[_0x47e7('0x40')][_0x47e7('0x5c')]({'where':{'id':_0xb92a0b[_0x47e7('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c8213,null))[_0x47e7('0x24')](saveUpdates(_0xb92a0b[_0x47e7('0x5e')],null))['then'](function(_0x52de0c){if(_0x52de0c){_0x3788b8[_0x47e7('0x2c')]=_0x52de0c[_0x47e7('0x69')]({'plain':!![]});return db[_0x47e7('0x6a')][_0x47e7('0x5c')]({'where':{'id':_0x52de0c[_0x47e7('0x6b')]}});}return null;})[_0x47e7('0x24')](handleEntityNotFound(_0x5c8213,null))['then'](function(_0x50df62){if(_0x50df62){return _0x50df62[_0x47e7('0x38')]({'UserId':_0xb92a0b[_0x47e7('0x5e')]['UserId'],'read1stAt':_['isNil'](_0x50df62[_0x47e7('0x6c')])?moment()[_0x47e7('0x64')](_0x47e7('0x65')):undefined});}return null;})['then'](function(_0x8c3fa6){if(_0x8c3fa6){_0x3788b8[_0x47e7('0x6d')]=_0x8c3fa6[_0x47e7('0x69')]({'plain':!![]});interaction_log['info'](_0x47e7('0x6e'),_0xb92a0b[_0x47e7('0x67')]['id'],_0xb92a0b[_0x47e7('0x67')][_0x47e7('0x3c')],_0xb92a0b[_0x47e7('0x67')]['role'],_0x3788b8[_0x47e7('0x6d')]['id'],_0xb92a0b['body']?JSON[_0x47e7('0x2a')](_0xb92a0b[_0x47e7('0x5e')]):_0x47e7('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3788b8);}return null;})[_0x47e7('0x24')](function(_0x5ac619){var _0x5a33b2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ac619['message'][_0x47e7('0x70')];return db['sequelize']['query'](_0x5a33b2,{'type':db[_0x47e7('0x71')][_0x47e7('0x72')][_0x47e7('0x73')],'raw':!![]})[_0x47e7('0x24')](function(_0x1e3cdb){return _0x1e3cdb;});})[_0x47e7('0x24')](function(_0x43ca43){if(_0x43ca43){_0x3788b8[_0x47e7('0x2c')][_0x47e7('0x74')]=_0x43ca43[0x0];if(!_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')])return;return db['User'][_0x47e7('0x5c')]({'where':{'id':_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x66')],'role':_0x47e7('0x68')},'attributes':['id',_0x47e7('0x3c'),_0x47e7('0x75'),'email',_0x47e7('0x76')],'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x5a5cfd){if(!_0x5a5cfd)return null;_0x3788b8[_0x47e7('0x2c')]['agent']=_0x5a5cfd;return _0x3788b8;})[_0x47e7('0x24')](function(_0x421efb){if(_0x421efb){if(_0xb92a0b[_0x47e7('0x5e')][_0x47e7('0x77')]){_0x3788b8['message'][_0x47e7('0x78')]=util[_0x47e7('0x64')](_0x47e7('0x79'),_0xb92a0b['user']['name']);_0x3788b8[_0x47e7('0x2c')]['channel']=_0x3788b8[_0x47e7('0x7a')];_0x3788b8[_0x47e7('0x2c')][_0x47e7('0x7b')]=_0x3788b8[_0x47e7('0x7a')];_0x3788b8['message'][_0x47e7('0x7c')]=_0x47e7('0x61');return respondWithRpcPromise(_0x47e7('0x7d'),_0x47e7('0x7d'),{'event':_0x47e7('0x7e'),'message':_[_0x47e7('0x53')](_0x3788b8[_0x47e7('0x2c')],JSON[_0x47e7('0x7f')](_0x3788b8['interaction'][_0x47e7('0x80')]))},client9002)[_0x47e7('0x24')](function(){return _0x3788b8;});}return _0x3788b8;}return null;})[_0x47e7('0x24')](respondWithResult(_0x5c8213,null))[_0x47e7('0x2d')](handleError(_0x5c8213,null));};var interaction_log=require(_0x47e7('0x16'))('chat-interactions');exports['reject']=function(_0x347ba9,_0x4916e1,_0x1ceed6){var _0x454d8c={'agent':{},'channel':_0x47e7('0x62')};if(_0x347ba9['body']['id']){delete _0x347ba9['body']['id'];}_0x347ba9[_0x47e7('0x5e')]['UserId']=_0x347ba9[_0x47e7('0x5e')][_0x47e7('0x66')]||_0x347ba9[_0x47e7('0x67')]['id'];_0x454d8c[_0x47e7('0x68')]['id']=_0x347ba9[_0x47e7('0x5e')][_0x47e7('0x66')];return db['ChatMessage'][_0x47e7('0x5c')]({'where':{'id':_0x347ba9[_0x47e7('0x5a')]['id'],'UserId':null}})[_0x47e7('0x24')](handleEntityNotFound(_0x4916e1,null))['then'](function(_0x3cba0d){if(_0x3cba0d){_0x454d8c['message']=_0x3cba0d[_0x47e7('0x69')]({'plain':!![]});return db[_0x47e7('0x6a')][_0x47e7('0x5c')]({'where':{'id':_0x3cba0d[_0x47e7('0x6b')]}});}return null;})[_0x47e7('0x24')](handleEntityNotFound(_0x4916e1,null))[_0x47e7('0x24')](function(_0x3d9f17){if(_0x3d9f17){_0x454d8c[_0x47e7('0x6d')]=_0x3d9f17['get']({'plain':!![]});interaction_log[_0x47e7('0x25')](_0x47e7('0x81'),_0x347ba9['user']['id'],_0x347ba9[_0x47e7('0x67')][_0x47e7('0x3c')],_0x347ba9['user'][_0x47e7('0x82')],_0x454d8c['interaction']['id'],_0x347ba9[_0x47e7('0x5e')]?JSON['stringify'](_0x347ba9[_0x47e7('0x5e')]):'null');return respondWithRpcPromise(_0x47e7('0x83'),_0x47e7('0x84'),_0x454d8c);}return null;})[_0x47e7('0x24')](function(_0x417da2){var _0x6f88fa=_0x47e7('0x85')+_0x417da2[_0x47e7('0x2c')][_0x47e7('0x70')];return db[_0x47e7('0x86')][_0x47e7('0x48')](_0x6f88fa,{'type':db[_0x47e7('0x71')][_0x47e7('0x72')][_0x47e7('0x73')],'raw':!![]})['then'](function(_0x58b318){return _0x58b318;});})[_0x47e7('0x24')](function(_0xd25b68){if(_0xd25b68){_0x454d8c[_0x47e7('0x2c')]['contact']=_0xd25b68[0x0];if(!_0x347ba9[_0x47e7('0x5e')]['UserId'])return;return db['User']['find']({'where':{'id':_0x347ba9['body'][_0x47e7('0x66')],'role':'agent'},'attributes':['id','name',_0x47e7('0x75'),_0x47e7('0x87'),'internal'],'raw':!![]});}return null;})[_0x47e7('0x24')](function(_0x149fe0){if(!_0x149fe0)return null;_0x454d8c[_0x47e7('0x2c')][_0x47e7('0x68')]=_0x149fe0;return _0x454d8c;})[_0x47e7('0x24')](function(_0x47b71d){if(_0x47b71d){_0x47b71d['message'][_0x47e7('0x78')]=util[_0x47e7('0x64')](_0x47e7('0x79'),_0x347ba9['user'][_0x47e7('0x3c')]);_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7a')]=_0x454d8c[_0x47e7('0x7a')];_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7b')]=_0x454d8c[_0x47e7('0x7a')];_0x47b71d[_0x47e7('0x2c')][_0x47e7('0x7c')]='reject';respondWithRpcPromise(_0x47e7('0x7d'),_0x47e7('0x7d'),{'event':_0x47e7('0x88'),'message':_[_0x47e7('0x53')](_0x454d8c[_0x47e7('0x2c')],JSON['parse'](_0x454d8c[_0x47e7('0x6d')]['formData']))},client9002);return _0x454d8c;}return null;})[_0x47e7('0x24')](respondWithResult(_0x4916e1,null))[_0x47e7('0x2d')](handleError(_0x4916e1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 64abe5a..9df2b3e 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 _0x6505=['hasOwnProperty','hook','exports','ChatMessage','save','update','remove','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6505,0x1bb));var _0x5650=function(_0x379e1a,_0x5423f7){_0x379e1a=_0x379e1a-0x0;var _0xa4613e=_0x6505[_0x379e1a];return _0xa4613e;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x5650('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5650('0x1'),'afterUpdate':_0x5650('0x2'),'afterDestroy':_0x5650('0x3')};function emitEvent(_0x547fcc){return function(_0xc8feca,_0x4b88d2,_0x333de1){ChatMessageEvents['emit'](_0x547fcc+':'+_0xc8feca['id'],_0xc8feca);ChatMessageEvents[_0x5650('0x4')](_0x547fcc,_0xc8feca);_0x333de1(null);};}for(var e in events){if(events[_0x5650('0x5')](e)){var event=events[e];ChatMessage[_0x5650('0x6')](e,emitEvent(event));}}module[_0x5650('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x044c=['exports','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x155a6a,_0xd1824e){var _0x2d8a38=function(_0x44bbd3){while(--_0x44bbd3){_0x155a6a['push'](_0x155a6a['shift']());}};_0x2d8a38(++_0xd1824e);}(_0x044c,0xd3));var _0xc044=function(_0x352fbb,_0x2a6bfa){_0x352fbb=_0x352fbb-0x0;var _0x2a14ab=_0x044c[_0x352fbb];return _0x2a14ab;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc044('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc044('0x1'),'afterUpdate':_0xc044('0x2'),'afterDestroy':'remove'};function emitEvent(_0x451826){return function(_0x5cfc29,_0x3e64a2,_0x201a7d){ChatMessageEvents[_0xc044('0x3')](_0x451826+':'+_0x5cfc29['id'],_0x5cfc29);ChatMessageEvents['emit'](_0x451826,_0x5cfc29);_0x201a7d(null);};}for(var e in events){if(events[_0xc044('0x4')](e)){var event=events[e];ChatMessage[_0xc044('0x5')](e,emitEvent(event));}}module[_0xc044('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c9cf604..720ab24 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 _0x7ece=['findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction'];(function(_0x2ab251,_0x41f7bb){var _0x4461c4=function(_0x5258bf){while(--_0x5258bf){_0x2ab251['push'](_0x2ab251['shift']());}};_0x4461c4(++_0x41f7bb);}(_0x7ece,0xc9));var _0xe7ec=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x7ece[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var util=require(_0xe7ec('0x0'));var logger=require(_0xe7ec('0x1'))('api');var moment=require(_0xe7ec('0x2'));var BPromise=require(_0xe7ec('0x3'));var rp=require(_0xe7ec('0x4'));var fs=require('fs');var path=require(_0xe7ec('0x5'));var rimraf=require(_0xe7ec('0x6'));var config=require(_0xe7ec('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x3c75d4,_0x5607ec){return _0x3c75d4[_0xe7ec('0x8')](_0xe7ec('0x9'),attributes,{'tableName':_0xe7ec('0xa'),'paranoid':![],'indexes':[{'name':_0xe7ec('0xb'),'fields':[_0xe7ec('0xc')],'type':_0xe7ec('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c1a09,_0x80c380,_0x54770e){var _0x2b6681=_0x3c75d4[_0xe7ec('0xe')];var _0x56762c=_0x5c1a09[_0xe7ec('0xf')]({'plain':!![]});if(_0x56762c[_0xe7ec('0x10')]['toLowerCase']()==='in'||_0x56762c[_0xe7ec('0x10')][_0xe7ec('0x11')]()===_0xe7ec('0x12')&&!_0x56762c[_0xe7ec('0x13')]&&!_[_0xe7ec('0x14')](_0x56762c[_0xe7ec('0x15')])){_0x2b6681[_0xe7ec('0x16')][_0xe7ec('0x17')]({'where':{'id':_0x56762c[_0xe7ec('0x18')]}})[_0xe7ec('0x19')](function(_0x4bc02d){if(_0x4bc02d){_0x4bc02d[_0xe7ec('0x1a')]({'lastMsgAt':_0x56762c[_0xe7ec('0x1b')],'lastMsgDirection':_0x56762c['direction']['toLowerCase']()});}})[_0xe7ec('0x1c')](function(_0x28c353){console[_0xe7ec('0x1d')](_0x28c353);});}_0x54770e();}},'charset':_0xe7ec('0x1e'),'collate':_0xe7ec('0x1f')});}; \ No newline at end of file +var _0xdbd0=['moment','request-promise','path','rimraf','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdbd0,0x88));var _0x0dbd=function(_0x464292,_0x33a95b){_0x464292=_0x464292-0x0;var _0x3c0e40=_0xdbd0[_0x464292];return _0x3c0e40;};'use strict';var _=require(_0x0dbd('0x0'));var util=require(_0x0dbd('0x1'));var logger=require(_0x0dbd('0x2'))(_0x0dbd('0x3'));var moment=require(_0x0dbd('0x4'));var BPromise=require('bluebird');var rp=require(_0x0dbd('0x5'));var fs=require('fs');var path=require(_0x0dbd('0x6'));var rimraf=require(_0x0dbd('0x7'));var config=require('../../config/environment');var attributes=require(_0x0dbd('0x8'));module[_0x0dbd('0x9')]=function(_0xcd515f,_0x3bd770){return _0xcd515f['define']('ChatMessage',attributes,{'tableName':_0x0dbd('0xa'),'paranoid':![],'indexes':[{'name':_0x0dbd('0xb'),'fields':[_0x0dbd('0xc')],'type':_0x0dbd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12057a,_0x453836,_0x5329e7){var _0x55f318=_0xcd515f[_0x0dbd('0xe')];var _0x1e0d57=_0x12057a[_0x0dbd('0xf')]({'plain':!![]});if(_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()==='in'||_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()===_0x0dbd('0x12')&&!_0x1e0d57['secret']&&!_[_0x0dbd('0x13')](_0x1e0d57[_0x0dbd('0x14')])){_0x55f318[_0x0dbd('0x15')]['findOne']({'where':{'id':_0x1e0d57[_0x0dbd('0x16')]}})[_0x0dbd('0x17')](function(_0x1a45d0){if(_0x1a45d0){_0x1a45d0[_0x0dbd('0x18')]({'lastMsgAt':_0x1e0d57[_0x0dbd('0x19')],'lastMsgDirection':_0x1e0d57[_0x0dbd('0x10')][_0x0dbd('0x11')]()});}})[_0x0dbd('0x1a')](function(_0x1b9134){console['error'](_0x1b9134);});}_0x5329e7();}},'charset':'utf8mb4','collate':_0x0dbd('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7b6624d..e09f211 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 _0x7f5f=['error','message','result','catch','CreateChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x7f5f,0xa0));var _0xf7f5=function(_0x3cb29e,_0x18685c){_0x3cb29e=_0x3cb29e-0x0;var _0x578d7e=_0x7f5f[_0x3cb29e];return _0x578d7e;};'use strict';var _=require(_0xf7f5('0x0'));var util=require(_0xf7f5('0x1'));var moment=require(_0xf7f5('0x2'));var BPromise=require(_0xf7f5('0x3'));var rs=require(_0xf7f5('0x4'));var fs=require('fs');var Redis=require(_0xf7f5('0x5'));var db=require(_0xf7f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7f5('0x7'))(_0xf7f5('0x8'));var config=require(_0xf7f5('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf7f5('0xa')]=_['defaults'](config[_0xf7f5('0xa')],{'host':_0xf7f5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7f5('0xa')]));require('./chatMessage.socket')[_0xf7f5('0xc')](socket);function respondWithRpcPromise(_0x217eb1,_0x22712a,_0x20f38e){return new BPromise(function(_0x1ffe26,_0x497590){return client[_0xf7f5('0xd')](_0x217eb1,_0x20f38e)[_0xf7f5('0xe')](function(_0x462a37){logger[_0xf7f5('0xf')](_0xf7f5('0x10'),_0x22712a,'request\x20sent');logger['debug'](_0xf7f5('0x11'),_0x22712a,_0xf7f5('0x12'),JSON[_0xf7f5('0x13')](_0x462a37));if(_0x462a37[_0xf7f5('0x14')]){if(_0x462a37['error']['code']===0x1f4){logger[_0xf7f5('0x14')]('ChatMessage,\x20%s,\x20%s',_0x22712a,_0x462a37[_0xf7f5('0x14')][_0xf7f5('0x15')]);return _0x497590(_0x462a37['error'][_0xf7f5('0x15')]);}logger[_0xf7f5('0x14')](_0xf7f5('0x10'),_0x22712a,_0x462a37[_0xf7f5('0x14')][_0xf7f5('0x15')]);return _0x1ffe26(_0x462a37[_0xf7f5('0x14')][_0xf7f5('0x15')]);}else{logger['info'](_0xf7f5('0x10'),_0x22712a,_0xf7f5('0x12'));_0x1ffe26(_0x462a37[_0xf7f5('0x16')][_0xf7f5('0x15')]);}})[_0xf7f5('0x17')](function(_0x52f72f){logger['error'](_0xf7f5('0x10'),_0x22712a,_0x52f72f);_0x497590(_0x52f72f);});});}exports[_0xf7f5('0x18')]=function(_0x50c4e2){var _0x4b3cd5=this;return new Promise(function(_0x477cf4,_0x3c6f4a){return db['ChatMessage'][_0xf7f5('0x19')](_0x50c4e2[_0xf7f5('0x1a')],{'raw':_0x50c4e2['options']?_0x50c4e2[_0xf7f5('0x1b')][_0xf7f5('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2f5b74){logger[_0xf7f5('0xf')]('CreateChatMessage',_0x50c4e2);logger[_0xf7f5('0x1d')](_0xf7f5('0x18'),_0x50c4e2,JSON[_0xf7f5('0x13')](_0x2f5b74));_0x477cf4(_0x2f5b74);})[_0xf7f5('0x17')](function(_0x4b4d26){logger[_0xf7f5('0x14')](_0xf7f5('0x18'),_0x4b4d26[_0xf7f5('0x15')],_0x50c4e2);_0x3c6f4a(_0x4b3cd5['error'](0x1f4,_0x4b4d26[_0xf7f5('0x15')]));});});}; \ No newline at end of file +var _0x209e=['request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x209e,0x70));var _0xe209=function(_0x504023,_0x8d76bc){_0x504023=_0x504023-0x0;var _0x36acf4=_0x209e[_0x504023];return _0x36acf4;};'use strict';var _=require(_0xe209('0x0'));var util=require(_0xe209('0x1'));var moment=require(_0xe209('0x2'));var BPromise=require(_0xe209('0x3'));var rs=require(_0xe209('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe209('0x5'))['db'];var utils=require(_0xe209('0x6'));var logger=require(_0xe209('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe209('0x8'));var client=jayson[_0xe209('0x9')][_0xe209('0xa')]({'port':0x232a});config[_0xe209('0xb')]=_[_0xe209('0xc')](config[_0xe209('0xb')],{'host':_0xe209('0xd'),'port':0x18eb});var socket=require(_0xe209('0xe'))(new Redis(config[_0xe209('0xb')]));require('./chatMessage.socket')[_0xe209('0xf')](socket);function respondWithRpcPromise(_0x2c2437,_0x517e98,_0x8dd254){return new BPromise(function(_0x4511a9,_0x90f35e){return client[_0xe209('0x10')](_0x2c2437,_0x8dd254)[_0xe209('0x11')](function(_0x4fc971){logger[_0xe209('0x12')](_0xe209('0x13'),_0x517e98,_0xe209('0x14'));logger[_0xe209('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x517e98,_0xe209('0x14'),JSON['stringify'](_0x4fc971));if(_0x4fc971[_0xe209('0x16')]){if(_0x4fc971[_0xe209('0x16')][_0xe209('0x17')]===0x1f4){logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x4fc971[_0xe209('0x16')]['message']);return _0x90f35e(_0x4fc971[_0xe209('0x16')][_0xe209('0x18')]);}logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x4fc971['error'][_0xe209('0x18')]);return _0x4511a9(_0x4fc971[_0xe209('0x16')][_0xe209('0x18')]);}else{logger[_0xe209('0x12')](_0xe209('0x13'),_0x517e98,'request\x20sent');_0x4511a9(_0x4fc971[_0xe209('0x19')][_0xe209('0x18')]);}})[_0xe209('0x1a')](function(_0x1e927a){logger[_0xe209('0x16')](_0xe209('0x13'),_0x517e98,_0x1e927a);_0x90f35e(_0x1e927a);});});}exports[_0xe209('0x1b')]=function(_0x35b05c){var _0x5197ef=this;return new Promise(function(_0xde1346,_0x1e35ed){return db[_0xe209('0x1c')][_0xe209('0x1d')](_0x35b05c['body'],{'raw':_0x35b05c['options']?_0x35b05c[_0xe209('0x1e')][_0xe209('0x1f')]===undefined?!![]:![]:!![]})[_0xe209('0x11')](function(_0x9a7ee){logger[_0xe209('0x12')](_0xe209('0x1b'),_0x35b05c);logger['debug'](_0xe209('0x1b'),_0x35b05c,JSON[_0xe209('0x20')](_0x9a7ee));_0xde1346(_0x9a7ee);})[_0xe209('0x1a')](function(_0x173f4d){logger['error'](_0xe209('0x1b'),_0x173f4d[_0xe209('0x18')],_0x35b05c);_0x1e35ed(_0x5197ef[_0xe209('0x16')](0x1f4,_0x173f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e417bde..771cbe1 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 _0xd9ef=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','update'];(function(_0x147501,_0x117d97){var _0x5e8a73=function(_0x3254a3){while(--_0x3254a3){_0x147501['push'](_0x147501['shift']());}};_0x5e8a73(++_0x117d97);}(_0xd9ef,0x95));var _0xfd9e=function(_0x5e0297,_0x11dd50){_0x5e0297=_0x5e0297-0x0;var _0x47c1ec=_0xd9ef[_0x5e0297];return _0x47c1ec;};'use strict';var ChatMessageEvents=require(_0xfd9e('0x0'));var events=[_0xfd9e('0x1'),'remove',_0xfd9e('0x2')];function createListener(_0x55d1e2,_0x57c743){return function(_0x505f7f){_0x57c743[_0xfd9e('0x3')](_0x55d1e2,_0x505f7f);};}function removeListener(_0x28cfac,_0xe6990b){return function(){ChatMessageEvents[_0xfd9e('0x4')](_0x28cfac,_0xe6990b);};}exports[_0xfd9e('0x5')]=function(_0x178ceb){for(var _0x2d549f=0x0,_0x3c3dec=events[_0xfd9e('0x6')];_0x2d549f<_0x3c3dec;_0x2d549f++){var _0x302795=events[_0x2d549f];var _0xb61585=createListener(_0xfd9e('0x7')+_0x302795,_0x178ceb);ChatMessageEvents['on'](_0x302795,_0xb61585);}}; \ No newline at end of file +var _0xaa3f=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x11bcbd,_0x4d39b3){var _0x58aa24=function(_0x7b15f3){while(--_0x7b15f3){_0x11bcbd['push'](_0x11bcbd['shift']());}};_0x58aa24(++_0x4d39b3);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x503a45,_0x12312f){_0x503a45=_0x503a45-0x0;var _0x1a27d1=_0xaa3f[_0x503a45];return _0x1a27d1;};'use strict';var ChatMessageEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),_0xfaa3('0x2'),_0xfaa3('0x3')];function createListener(_0x1ebbfb,_0x1da39b){return function(_0x408343){_0x1da39b[_0xfaa3('0x4')](_0x1ebbfb,_0x408343);};}function removeListener(_0x32f4e1,_0x5123a3){return function(){ChatMessageEvents['removeListener'](_0x32f4e1,_0x5123a3);};}exports[_0xfaa3('0x5')]=function(_0x4bac92){for(var _0x3d09aa=0x0,_0xeecce5=events[_0xfaa3('0x6')];_0x3d09aa<_0xeecce5;_0x3d09aa++){var _0xbf270c=events[_0x3d09aa];var _0x328d5f=createListener(_0xfaa3('0x7')+_0xbf270c,_0x4bac92);ChatMessageEvents['on'](_0xbf270c,_0x328d5f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9c2772c..85f1ed6 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 _0x9753=['isAuthenticated','describe','/:id','post','tracked','chatmessage:create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatMessage.controller','get','index'];(function(_0x21a616,_0x285a7f){var _0x2d0cd6=function(_0x7b77f){while(--_0x7b77f){_0x21a616['push'](_0x21a616['shift']());}};_0x2d0cd6(++_0x285a7f);}(_0x9753,0xce));var _0x3975=function(_0x53f3ad,_0x39163e){_0x53f3ad=_0x53f3ad-0x0;var _0x48b203=_0x9753[_0x53f3ad];return _0x48b203;};'use strict';var multer=require(_0x3975('0x0'));var util=require(_0x3975('0x1'));var path=require(_0x3975('0x2'));var timeout=require('connect-timeout');var express=require(_0x3975('0x3'));var router=express[_0x3975('0x4')]();var fs_extra=require(_0x3975('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3975('0x6'));var controller=require(_0x3975('0x7'));router[_0x3975('0x8')]('/',auth['isAuthenticated'](),controller[_0x3975('0x9')]);router['get']('/describe',auth[_0x3975('0xa')](),controller[_0x3975('0xb')]);router[_0x3975('0x8')](_0x3975('0xc'),auth[_0x3975('0xa')](),controller['show']);router[_0x3975('0xd')]('/',auth['isAuthenticated'](),interaction[_0x3975('0xe')]('chat',_0x3975('0xf')),controller['create']);router[_0x3975('0x10')](_0x3975('0xc'),controller[_0x3975('0x11')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x3975('0x12')]);router[_0x3975('0x10')](_0x3975('0x13'),auth[_0x3975('0xa')](),controller[_0x3975('0x14')]);router[_0x3975('0x15')](_0x3975('0xc'),auth['isAuthenticated'](),controller[_0x3975('0x16')]);module[_0x3975('0x17')]=router; \ No newline at end of file +var _0x3c8a=['update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','chat','chatmessage:create','put'];(function(_0x5dafd0,_0x3bcbb6){var _0x364354=function(_0x5da31c){while(--_0x5da31c){_0x5dafd0['push'](_0x5dafd0['shift']());}};_0x364354(++_0x3bcbb6);}(_0x3c8a,0xb6));var _0xa3c8=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0x3c8a[_0x4e82ff];return _0x495205;};'use strict';var multer=require(_0xa3c8('0x0'));var util=require(_0xa3c8('0x1'));var path=require(_0xa3c8('0x2'));var timeout=require(_0xa3c8('0x3'));var express=require(_0xa3c8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa3c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa3c8('0x6'));var controller=require(_0xa3c8('0x7'));router[_0xa3c8('0x8')]('/',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0xa')]);router[_0xa3c8('0x8')]('/describe',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0xb')]);router[_0xa3c8('0x8')](_0xa3c8('0xc'),auth[_0xa3c8('0x9')](),controller['show']);router[_0xa3c8('0xd')]('/',auth['isAuthenticated'](),interaction[_0xa3c8('0xe')](_0xa3c8('0xf'),_0xa3c8('0x10')),controller['create']);router[_0xa3c8('0x11')](_0xa3c8('0xc'),controller[_0xa3c8('0x12')]);router[_0xa3c8('0x11')]('/:id/accept',auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x13')]);router[_0xa3c8('0x11')](_0xa3c8('0x14'),auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x15')]);router[_0xa3c8('0x16')](_0xa3c8('0xc'),auth[_0xa3c8('0x9')](),controller[_0xa3c8('0x17')]);module[_0xa3c8('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 485d0f0..86db0dd 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 _0xadb5=['medium','TEXT','exports'];(function(_0x12bd66,_0x5c242f){var _0x3ba6ce=function(_0x18caca){while(--_0x18caca){_0x12bd66['push'](_0x12bd66['shift']());}};_0x3ba6ce(++_0x5c242f);}(_0xadb5,0xad));var _0x5adb=function(_0x521cef,_0x511f7a){_0x521cef=_0x521cef-0x0;var _0x4f4820=_0xadb5[_0x521cef];return _0x4f4820;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x263957,_0x39f977){var _0x55d0f9=function(_0x27f20a){while(--_0x27f20a){_0x263957['push'](_0x263957['shift']());}};_0x55d0f9(++_0x39f977);}(_0x5f2f,0x73));var _0xf5f2=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x5f2f[_0x138293];return _0x34c4a2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a7d557e..2c39eac 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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x7a54,0x106));var _0x47a5=function(_0x21f680,_0xc7743f){_0x21f680=_0x21f680-0x0;var _0x312207=_0x7a54[_0x21f680];return _0x312207;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));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=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab49e,_0xcb5a13){_0x5ab49e=_0x5ab49e-0x0;var _0x233117=_0x7a54[_0x5ab49e];return _0x233117;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));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=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 5c0446d..ef0291c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafd1=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x71bcd3,_0x5672a9){var _0x356dc0=function(_0x15bb97){while(--_0x15bb97){_0x71bcd3['push'](_0x71bcd3['shift']());}};_0x356dc0(++_0x5672a9);}(_0xafd1,0x1c2));var _0x1afd=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xafd1[_0x32b122];return _0x4ad25a;};'use strict';var EventEmitter=require(_0x1afd('0x0'));var ChatOfflineMessage=require(_0x1afd('0x1'))['db'][_0x1afd('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1afd('0x3')](0x0);var events={'afterCreate':_0x1afd('0x4'),'afterUpdate':_0x1afd('0x5'),'afterDestroy':_0x1afd('0x6')};function emitEvent(_0x39d144){return function(_0x50579d,_0x101d1f,_0x77e164){ChatOfflineMessageEvents[_0x1afd('0x7')](_0x39d144+':'+_0x50579d['id'],_0x50579d);ChatOfflineMessageEvents[_0x1afd('0x7')](_0x39d144,_0x50579d);_0x77e164(null);};}for(var e in events){if(events[_0x1afd('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x1afd('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x299c=['ChatOfflineMessage','save','update','emit','hasOwnProperty','exports','events'];(function(_0x44b795,_0x8d7c1b){var _0x2bb91e=function(_0x4027f1){while(--_0x4027f1){_0x44b795['push'](_0x44b795['shift']());}};_0x2bb91e(++_0x8d7c1b);}(_0x299c,0x180));var _0xc299=function(_0x213c03,_0x22ba9d){_0x213c03=_0x213c03-0x0;var _0x478e2d=_0x299c[_0x213c03];return _0x478e2d;};'use strict';var EventEmitter=require(_0xc299('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xc299('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc299('0x2'),'afterUpdate':_0xc299('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3550ec){return function(_0x17d6c5,_0x453b10,_0x577391){ChatOfflineMessageEvents[_0xc299('0x4')](_0x3550ec+':'+_0x17d6c5['id'],_0x17d6c5);ChatOfflineMessageEvents[_0xc299('0x4')](_0x3550ec,_0x17d6c5);_0x577391(null);};}for(var e in events){if(events[_0xc299('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xc299('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 74f7e49..99bd5ab 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 _0xde48=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xde48,0x18d));var _0x8de4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xde48[_0x397e5f];return _0x5302b8;};'use strict';var attributes=require(_0x8de4('0x0'));module[_0x8de4('0x1')]=function(_0x55da12){return _0x55da12[_0x8de4('0x2')](_0x8de4('0x3'),attributes,{'tableName':_0x8de4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8de4('0x5'),'collate':_0x8de4('0x6')});}; \ No newline at end of file +var _0xb0a2=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x588e96,_0x3a4978){var _0x3683df=function(_0x1cbc4a){while(--_0x1cbc4a){_0x588e96['push'](_0x588e96['shift']());}};_0x3683df(++_0x3a4978);}(_0xb0a2,0x117));var _0x2b0a=function(_0x5aeedb,_0x2e9c48){_0x5aeedb=_0x5aeedb-0x0;var _0x3e5e60=_0xb0a2[_0x5aeedb];return _0x3e5e60;};'use strict';var attributes=require(_0x2b0a('0x0'));module[_0x2b0a('0x1')]=function(_0x3a3d1c){return _0x3a3d1c['define'](_0x2b0a('0x2'),attributes,{'tableName':_0x2b0a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2b0a('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 76f6eaf..feba091 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 _0x8406=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8406,0x10c));var _0x6840=function(_0x551da1,_0x39a47b){_0x551da1=_0x551da1-0x0;var _0x5c93e7=_0x8406[_0x551da1];return _0x5c93e7;};'use strict';var _=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var moment=require(_0x6840('0x2'));var BPromise=require(_0x6840('0x3'));var rs=require(_0x6840('0x4'));var fs=require('fs');var Redis=require(_0x6840('0x5'));var db=require(_0x6840('0x6'))['db'];var utils=require(_0x6840('0x7'));var logger=require('../../config/logger')(_0x6840('0x8'));var config=require(_0x6840('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x763ff0,_0x183b34,_0x2f1fe9){return new BPromise(function(_0x14ac02,_0x16779f){return client[_0x6840('0xb')](_0x763ff0,_0x2f1fe9)['then'](function(_0x24ef0e){logger['info'](_0x6840('0xc'),_0x183b34,_0x6840('0xd'));logger['debug'](_0x6840('0xe'),_0x183b34,_0x6840('0xd'),JSON[_0x6840('0xf')](_0x24ef0e));if(_0x24ef0e['error']){if(_0x24ef0e[_0x6840('0x10')][_0x6840('0x11')]===0x1f4){logger['error'](_0x6840('0xc'),_0x183b34,_0x24ef0e[_0x6840('0x10')][_0x6840('0x12')]);return _0x16779f(_0x24ef0e[_0x6840('0x10')][_0x6840('0x12')]);}logger[_0x6840('0x10')](_0x6840('0xc'),_0x183b34,_0x24ef0e[_0x6840('0x10')][_0x6840('0x12')]);return _0x14ac02(_0x24ef0e[_0x6840('0x10')]['message']);}else{logger[_0x6840('0x13')](_0x6840('0xc'),_0x183b34,_0x6840('0xd'));_0x14ac02(_0x24ef0e['result'][_0x6840('0x12')]);}})[_0x6840('0x14')](function(_0x16c89d){logger[_0x6840('0x10')](_0x6840('0xc'),_0x183b34,_0x16c89d);_0x16779f(_0x16c89d);});});} \ No newline at end of file +var _0x1580=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3f9f9d,_0x923a36){var _0x3f9fc9=function(_0x1b0e3d){while(--_0x1b0e3d){_0x3f9f9d['push'](_0x3f9f9d['shift']());}};_0x3f9fc9(++_0x923a36);}(_0x1580,0x15a));var _0x0158=function(_0x4e699b,_0x459659){_0x4e699b=_0x4e699b-0x0;var _0x59d53b=_0x1580[_0x4e699b];return _0x59d53b;};'use strict';var _=require(_0x0158('0x0'));var util=require(_0x0158('0x1'));var moment=require(_0x0158('0x2'));var BPromise=require(_0x0158('0x3'));var rs=require(_0x0158('0x4'));var fs=require('fs');var Redis=require(_0x0158('0x5'));var db=require(_0x0158('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0158('0x7'))('rpc');var config=require(_0x0158('0x8'));var jayson=require(_0x0158('0x9'));var client=jayson['client'][_0x0158('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b9af3,_0xecf81c,_0x2d7a30){return new BPromise(function(_0x3e885c,_0x4d5047){return client[_0x0158('0xb')](_0x2b9af3,_0x2d7a30)[_0x0158('0xc')](function(_0x4b5450){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xecf81c,_0x0158('0xd'));logger['debug'](_0x0158('0xe'),_0xecf81c,_0x0158('0xd'),JSON[_0x0158('0xf')](_0x4b5450));if(_0x4b5450[_0x0158('0x10')]){if(_0x4b5450[_0x0158('0x10')]['code']===0x1f4){logger[_0x0158('0x10')](_0x0158('0x11'),_0xecf81c,_0x4b5450['error'][_0x0158('0x12')]);return _0x4d5047(_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);}logger[_0x0158('0x10')](_0x0158('0x11'),_0xecf81c,_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);return _0x3e885c(_0x4b5450[_0x0158('0x10')][_0x0158('0x12')]);}else{logger[_0x0158('0x13')](_0x0158('0x11'),_0xecf81c,_0x0158('0xd'));_0x3e885c(_0x4b5450[_0x0158('0x14')][_0x0158('0x12')]);}})[_0x0158('0x15')](function(_0x52d6af){logger['error'](_0x0158('0x11'),_0xecf81c,_0x52d6af);_0x4d5047(_0x52d6af);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4210398..97d714a 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 _0xb179=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports'];(function(_0x213458,_0x42ebf3){var _0x49fcc0=function(_0x5bc2b7){while(--_0x5bc2b7){_0x213458['push'](_0x213458['shift']());}};_0x49fcc0(++_0x42ebf3);}(_0xb179,0xa0));var _0x9b17=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb179[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x9b17('0x0'));var util=require(_0x9b17('0x1'));var path=require(_0x9b17('0x2'));var timeout=require(_0x9b17('0x3'));var express=require(_0x9b17('0x4'));var router=express[_0x9b17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9b17('0x6'));var interaction=require(_0x9b17('0x7'));var config=require(_0x9b17('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x9b17('0x9')]('/',auth[_0x9b17('0xa')](),controller[_0x9b17('0xb')]);router[_0x9b17('0x9')](_0x9b17('0xc'),auth['isAuthenticated'](),controller[_0x9b17('0xd')]);router['get'](_0x9b17('0xe'),auth[_0x9b17('0xa')](),controller[_0x9b17('0xf')]);router[_0x9b17('0x10')]('/',auth[_0x9b17('0xa')](),controller['create']);router[_0x9b17('0x11')](_0x9b17('0xe'),auth[_0x9b17('0xa')](),controller['update']);router['delete'](_0x9b17('0xe'),auth['isAuthenticated'](),controller[_0x9b17('0x12')]);module[_0x9b17('0x13')]=router; \ No newline at end of file +var _0x9de4=['/:id','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9de4,0x92));var _0x49de=function(_0x583ee5,_0x2acd9a){_0x583ee5=_0x583ee5-0x0;var _0x3f002a=_0x9de4[_0x583ee5];return _0x3f002a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49de('0x0'));var timeout=require(_0x49de('0x1'));var express=require(_0x49de('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x49de('0x3'));var config=require(_0x49de('0x4'));var controller=require(_0x49de('0x5'));router[_0x49de('0x6')]('/',auth[_0x49de('0x7')](),controller[_0x49de('0x8')]);router[_0x49de('0x6')](_0x49de('0x9'),auth['isAuthenticated'](),controller[_0x49de('0xa')]);router[_0x49de('0x6')]('/:id',auth[_0x49de('0x7')](),controller[_0x49de('0xb')]);router[_0x49de('0xc')]('/',auth[_0x49de('0x7')](),controller[_0x49de('0xd')]);router['put'](_0x49de('0xe'),auth[_0x49de('0x7')](),controller['update']);router['delete'](_0x49de('0xe'),auth[_0x49de('0x7')](),controller['destroy']);module[_0x49de('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c7c8e52..a32c39f 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 _0xc5db=['INTEGER','sequelize','STRING','ENUM','mouseOver','timeout'];(function(_0x116c46,_0x3cc3c1){var _0x3aa72f=function(_0x1cc6b7){while(--_0x1cc6b7){_0x116c46['push'](_0x116c46['shift']());}};_0x3aa72f(++_0x3cc3c1);}(_0xc5db,0x8b));var _0xbc5d=function(_0x237743,_0x361707){_0x237743=_0x237743-0x0;var _0x15fd6e=_0xc5db[_0x237743];return _0x15fd6e;};'use strict';var Sequelize=require(_0xbc5d('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc5d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbc5d('0x2')](_0xbc5d('0x3'),_0xbc5d('0x4')),'defaultValue':_0xbc5d('0x3')},'selector':{'type':Sequelize[_0xbc5d('0x1')]},'timeout':{'type':Sequelize[_0xbc5d('0x5')]}}; \ No newline at end of file +var _0xa20e=['STRING','ENUM','mouseOver','timeout','exports'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xa20e,0x1a8));var _0xea20=function(_0x4369ef,_0x55cfbc){_0x4369ef=_0x4369ef-0x0;var _0x5b6913=_0xa20e[_0x4369ef];return _0x5b6913;};'use strict';var Sequelize=require('sequelize');module[_0xea20('0x0')]={'name':{'type':Sequelize[_0xea20('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea20('0x2')](_0xea20('0x3'),_0xea20('0x4')),'defaultValue':_0xea20('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e38f1c2..65248b5 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 _0x535d=['eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','show','ChatProactiveAction','rawAttributes','query','keys','model','attributes','intersection','fields','length','includeAll','merge','options','find','then','create','body','params','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x535d,0xe8));var _0xd535=function(_0x123b94,_0x2bf61a){_0x123b94=_0x123b94-0x0;var _0x55719c=_0x535d[_0x123b94];return _0x55719c;};'use strict';var emlformat=require(_0xd535('0x0'));var rimraf=require(_0xd535('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd535('0x2'));var rp=require(_0xd535('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd535('0x4'));var util=require(_0xd535('0x5'));var path=require(_0xd535('0x6'));var sox=require(_0xd535('0x7'));var csv=require(_0xd535('0x8'));var ejs=require(_0xd535('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd535('0xa'));var crypto=require(_0xd535('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd535('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd535('0xd'));var Papa=require(_0xd535('0xe'));var Redis=require(_0xd535('0xf'));var authService=require(_0xd535('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd535('0x11'));var hardwareService=require(_0xd535('0x12'));var logger=require(_0xd535('0x13'))(_0xd535('0x14'));var utils=require('../../config/utils');var config=require(_0xd535('0x15'));var licenseUtil=require(_0xd535('0x16'));var db=require(_0xd535('0x17'))['db'];function respondWithStatusCode(_0x7aab34,_0x352bf3){_0x352bf3=_0x352bf3||0xcc;return function(_0x3fd304){if(_0x3fd304){return _0x7aab34[_0xd535('0x18')](_0x352bf3);}return _0x7aab34['status'](_0x352bf3)[_0xd535('0x19')]();};}function respondWithResult(_0x52f768,_0x5c659d){_0x5c659d=_0x5c659d||0xc8;return function(_0x2b3e1b){if(_0x2b3e1b){return _0x52f768[_0xd535('0x1a')](_0x5c659d)['json'](_0x2b3e1b);}};}function respondWithFilteredResult(_0x2078ad,_0x338042){return function(_0x29e478){if(_0x29e478){var _0x500675=typeof _0x338042['offset']===_0xd535('0x1b')&&typeof _0x338042[_0xd535('0x1c')]===_0xd535('0x1b');var _0xb3cc32=_0x29e478['count'];var _0x921b2e=_0x500675?0x0:_0x338042['offset'];var _0x22d4e2=_0x500675?_0x29e478['count']:_0x338042[_0xd535('0x1d')]+_0x338042['limit'];var _0x2d7338;if(_0x22d4e2>=_0xb3cc32){_0x22d4e2=_0xb3cc32;_0x2d7338=0xc8;}else{_0x2d7338=0xce;}_0x2078ad[_0xd535('0x1a')](_0x2d7338);return _0x2078ad[_0xd535('0x1e')](_0xd535('0x1f'),_0x921b2e+'-'+_0x22d4e2+'/'+_0xb3cc32)['json'](_0x29e478);}return null;};}function patchUpdates(_0x4b11d9){return function(_0x185966){try{jsonpatch['apply'](_0x185966,_0x4b11d9,!![]);}catch(_0x5c4afa){return BPromise[_0xd535('0x20')](_0x5c4afa);}return _0x185966[_0xd535('0x21')]();};}function saveUpdates(_0x283d41,_0x11187d){return function(_0x3cad49){if(_0x3cad49){return _0x3cad49[_0xd535('0x22')](_0x283d41)['then'](function(_0x8e32ee){return _0x8e32ee;});}return null;};}function removeEntity(_0x34106a,_0x42008f){return function(_0x7cc1ef){if(_0x7cc1ef){return _0x7cc1ef[_0xd535('0x23')]()['then'](function(){_0x34106a['status'](0xcc)[_0xd535('0x19')]();});}};}function handleEntityNotFound(_0x1abfec,_0x482d00){return function(_0x4aa746){if(!_0x4aa746){_0x1abfec[_0xd535('0x18')](0x194);}return _0x4aa746;};}function handleError(_0x1995ee,_0x13cdb2){_0x13cdb2=_0x13cdb2||0x1f4;return function(_0x551a99){logger['error'](_0x551a99[_0xd535('0x24')]);if(_0x551a99[_0xd535('0x25')]){delete _0x551a99[_0xd535('0x25')];}_0x1995ee[_0xd535('0x1a')](_0x13cdb2)[_0xd535('0x26')](_0x551a99);};}exports[_0xd535('0x27')]=function(_0x231736,_0x4b1e24){var _0xcecc70={'raw':!![],'where':{'id':_0x231736['params']['id']}},_0x3ea7f7={};_0x3ea7f7['model']=_['keys'](db[_0xd535('0x28')][_0xd535('0x29')]);_0x3ea7f7[_0xd535('0x2a')]=_[_0xd535('0x2b')](_0x231736[_0xd535('0x2a')]);_0x3ea7f7['filters']=_['intersection'](_0x3ea7f7[_0xd535('0x2c')],_0x3ea7f7[_0xd535('0x2a')]);_0xcecc70[_0xd535('0x2d')]=_[_0xd535('0x2e')](_0x3ea7f7['model'],qs[_0xd535('0x2f')](_0x231736[_0xd535('0x2a')][_0xd535('0x2f')]));_0xcecc70[_0xd535('0x2d')]=_0xcecc70[_0xd535('0x2d')][_0xd535('0x30')]?_0xcecc70['attributes']:_0x3ea7f7[_0xd535('0x2c')];if(_0x231736[_0xd535('0x2a')][_0xd535('0x31')]){_0xcecc70['include']=[{'all':!![]}];}_0xcecc70=_[_0xd535('0x32')]({},_0xcecc70,_0x231736[_0xd535('0x33')]);return db[_0xd535('0x28')][_0xd535('0x34')](_0xcecc70)[_0xd535('0x35')](handleEntityNotFound(_0x4b1e24,null))['then'](respondWithResult(_0x4b1e24,null))['catch'](handleError(_0x4b1e24,null));};exports['create']=function(_0x17bf49,_0x2ccd79){return db[_0xd535('0x28')][_0xd535('0x36')](_0x17bf49[_0xd535('0x37')],{})[_0xd535('0x35')](respondWithResult(_0x2ccd79,0xc9))['catch'](handleError(_0x2ccd79,null));};exports['update']=function(_0x2a96c8,_0x49cb56){if(_0x2a96c8[_0xd535('0x37')]['id']){delete _0x2a96c8['body']['id'];}return db[_0xd535('0x28')]['find']({'where':{'id':_0x2a96c8[_0xd535('0x38')]['id']}})['then'](handleEntityNotFound(_0x49cb56,null))[_0xd535('0x35')](saveUpdates(_0x2a96c8[_0xd535('0x37')],null))[_0xd535('0x35')](respondWithResult(_0x49cb56,null))[_0xd535('0x39')](handleError(_0x49cb56,null));};exports['destroy']=function(_0x35db72,_0x314fce){return db['ChatProactiveAction'][_0xd535('0x34')]({'where':{'id':_0x35db72[_0xd535('0x38')]['id']}})[_0xd535('0x35')](handleEntityNotFound(_0x314fce,null))[_0xd535('0x35')](removeEntity(_0x314fce,null))[_0xd535('0x39')](handleError(_0x314fce,null));}; \ No newline at end of file +var _0x3f27=['find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','include','options'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3f27,0x1f4));var _0x73f2=function(_0x31fa80,_0x506183){_0x31fa80=_0x31fa80-0x0;var _0x1cc1de=_0x3f27[_0x31fa80];return _0x1cc1de;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['show']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={'raw':!![],'where':{'id':_0x2840f0[_0x73f2('0x27')]['id']}},_0x21b18={};_0x21b18[_0x73f2('0x28')]=_[_0x73f2('0x29')](db[_0x73f2('0x2a')]['rawAttributes']);_0x21b18[_0x73f2('0x2b')]=_[_0x73f2('0x29')](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2c')](_0x21b18[_0x73f2('0x28')],_0x21b18[_0x73f2('0x2b')]);_0x4a90ac['attributes']=_['intersection'](_0x21b18['model'],qs['fields'](_0x2840f0[_0x73f2('0x2b')]['fields']));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac[_0x73f2('0x2d')][_0x73f2('0x2e')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18['model'];if(_0x2840f0[_0x73f2('0x2b')][_0x73f2('0x2f')]){_0x4a90ac[_0x73f2('0x30')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x2840f0[_0x73f2('0x31')]);return db[_0x73f2('0x2a')][_0x73f2('0x32')](_0x4a90ac)['then'](handleEntityNotFound(_0xf0e828,null))[_0x73f2('0x21')](respondWithResult(_0xf0e828,null))[_0x73f2('0x33')](handleError(_0xf0e828,null));};exports[_0x73f2('0x34')]=function(_0x2ba1ec,_0x3f50b2){return db[_0x73f2('0x2a')][_0x73f2('0x34')](_0x2ba1ec[_0x73f2('0x35')],{})[_0x73f2('0x21')](respondWithResult(_0x3f50b2,0xc9))['catch'](handleError(_0x3f50b2,null));};exports['update']=function(_0x54a21f,_0x379cee){if(_0x54a21f[_0x73f2('0x35')]['id']){delete _0x54a21f[_0x73f2('0x35')]['id'];}return db['ChatProactiveAction'][_0x73f2('0x32')]({'where':{'id':_0x54a21f[_0x73f2('0x27')]['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x379cee,null))[_0x73f2('0x21')](saveUpdates(_0x54a21f[_0x73f2('0x35')],null))['then'](respondWithResult(_0x379cee,null))[_0x73f2('0x33')](handleError(_0x379cee,null));};exports[_0x73f2('0x36')]=function(_0xde2a1c,_0x42e3b5){return db[_0x73f2('0x2a')][_0x73f2('0x32')]({'where':{'id':_0xde2a1c['params']['id']}})[_0x73f2('0x21')](handleEntityNotFound(_0x42e3b5,null))['then'](removeEntity(_0x42e3b5,null))[_0x73f2('0x33')](handleError(_0x42e3b5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e4bc4e9..ed95d8e 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 _0x368f=['ChatProactiveAction','chat_proactive_actions','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x368f,0x1c4));var _0xf368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf368('0x0'))('api');var moment=require(_0xf368('0x1'));var BPromise=require('bluebird');var rp=require(_0xf368('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf368('0x3'));var config=require(_0xf368('0x4'));var attributes=require(_0xf368('0x5'));module[_0xf368('0x6')]=function(_0x3e0a1f,_0x5b73be){return _0x3e0a1f[_0xf368('0x7')](_0xf368('0x8'),attributes,{'tableName':_0xf368('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc5f=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x187184,_0x13aadf){var _0x390763=function(_0x49f325){while(--_0x49f325){_0x187184['push'](_0x187184['shift']());}};_0x390763(++_0x13aadf);}(_0xdc5f,0xaf));var _0xfdc5=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xdc5f[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xfdc5('0x0'));var util=require(_0xfdc5('0x1'));var logger=require(_0xfdc5('0x2'))(_0xfdc5('0x3'));var moment=require(_0xfdc5('0x4'));var BPromise=require('bluebird');var rp=require(_0xfdc5('0x5'));var fs=require('fs');var path=require(_0xfdc5('0x6'));var rimraf=require(_0xfdc5('0x7'));var config=require('../../config/environment');var attributes=require(_0xfdc5('0x8'));module[_0xfdc5('0x9')]=function(_0x2ec582,_0x5ee63c){return _0x2ec582['define'](_0xfdc5('0xa'),attributes,{'tableName':_0xfdc5('0xb'),'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 830ecfd..976ad32 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 _0xff38=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe86314,_0x4bdff1){var _0x249d37=function(_0x3814c0){while(--_0x3814c0){_0xe86314['push'](_0xe86314['shift']());}};_0x249d37(++_0x4bdff1);}(_0xff38,0xf3));var _0x8ff3=function(_0x2cd589,_0x5547ec){_0x2cd589=_0x2cd589-0x0;var _0x5e8d09=_0xff38[_0x2cd589];return _0x5e8d09;};'use strict';var _=require(_0x8ff3('0x0'));var util=require(_0x8ff3('0x1'));var moment=require('moment');var BPromise=require(_0x8ff3('0x2'));var rs=require(_0x8ff3('0x3'));var fs=require('fs');var Redis=require(_0x8ff3('0x4'));var db=require(_0x8ff3('0x5'))['db'];var utils=require(_0x8ff3('0x6'));var logger=require(_0x8ff3('0x7'))(_0x8ff3('0x8'));var config=require(_0x8ff3('0x9'));var jayson=require(_0x8ff3('0xa'));var client=jayson[_0x8ff3('0xb')][_0x8ff3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe38f,_0x5bfc9f,_0x5a4b13){return new BPromise(function(_0x140e43,_0xd1a3f3){return client['request'](_0x4fe38f,_0x5a4b13)[_0x8ff3('0xd')](function(_0x36b2a2){logger[_0x8ff3('0xe')](_0x8ff3('0xf'),_0x5bfc9f,'request\x20sent');logger[_0x8ff3('0x10')](_0x8ff3('0x11'),_0x5bfc9f,'request\x20sent',JSON[_0x8ff3('0x12')](_0x36b2a2));if(_0x36b2a2['error']){if(_0x36b2a2[_0x8ff3('0x13')][_0x8ff3('0x14')]===0x1f4){logger[_0x8ff3('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x5bfc9f,_0x36b2a2[_0x8ff3('0x13')][_0x8ff3('0x15')]);return _0xd1a3f3(_0x36b2a2[_0x8ff3('0x13')][_0x8ff3('0x15')]);}logger['error'](_0x8ff3('0xf'),_0x5bfc9f,_0x36b2a2[_0x8ff3('0x13')]['message']);return _0x140e43(_0x36b2a2['error'][_0x8ff3('0x15')]);}else{logger[_0x8ff3('0xe')](_0x8ff3('0xf'),_0x5bfc9f,_0x8ff3('0x16'));_0x140e43(_0x36b2a2[_0x8ff3('0x17')][_0x8ff3('0x15')]);}})[_0x8ff3('0x18')](function(_0x5016d3){logger[_0x8ff3('0x13')](_0x8ff3('0xf'),_0x5bfc9f,_0x5016d3);_0xd1a3f3(_0x5016d3);});});} \ No newline at end of file +var _0xb0fb=['jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb0fb,0x15e));var _0xbb0f=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb0fb[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0xbb0f('0x0'));var moment=require(_0xbb0f('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb0f('0x2'));var fs=require('fs');var Redis=require(_0xbb0f('0x3'));var db=require(_0xbb0f('0x4'))['db'];var utils=require(_0xbb0f('0x5'));var logger=require(_0xbb0f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbb0f('0x7'));var client=jayson[_0xbb0f('0x8')][_0xbb0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaa1c5f,_0x43cd28,_0x2d10d3){return new BPromise(function(_0x596f10,_0xd7d346){return client[_0xbb0f('0xa')](_0xaa1c5f,_0x2d10d3)[_0xbb0f('0xb')](function(_0x17f95b){logger[_0xbb0f('0xc')](_0xbb0f('0xd'),_0x43cd28,'request\x20sent');logger[_0xbb0f('0xe')](_0xbb0f('0xf'),_0x43cd28,_0xbb0f('0x10'),JSON['stringify'](_0x17f95b));if(_0x17f95b[_0xbb0f('0x11')]){if(_0x17f95b[_0xbb0f('0x11')]['code']===0x1f4){logger[_0xbb0f('0x11')](_0xbb0f('0xd'),_0x43cd28,_0x17f95b[_0xbb0f('0x11')][_0xbb0f('0x12')]);return _0xd7d346(_0x17f95b[_0xbb0f('0x11')]['message']);}logger[_0xbb0f('0x11')](_0xbb0f('0xd'),_0x43cd28,_0x17f95b[_0xbb0f('0x11')]['message']);return _0x596f10(_0x17f95b[_0xbb0f('0x11')]['message']);}else{logger[_0xbb0f('0xc')](_0xbb0f('0xd'),_0x43cd28,_0xbb0f('0x10'));_0x596f10(_0x17f95b[_0xbb0f('0x13')][_0xbb0f('0x12')]);}})[_0xbb0f('0x14')](function(_0x3efe1a){logger['error'](_0xbb0f('0xd'),_0x43cd28,_0x3efe1a);_0xd7d346(_0x3efe1a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 609cf57..d56c5df 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x13ea36,_0x2805ad){var _0x312066=function(_0xfbee88){while(--_0xfbee88){_0x13ea36['push'](_0x13ea36['shift']());}};_0x312066(++_0x2805ad);}(_0x814b,0x1a2));var _0xb814=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x814b[_0x264b9b];return _0x4c7a0e;};'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 fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')](_0xb814('0xb'),auth['isAuthenticated'](),controller[_0xb814('0xc')]);router[_0xb814('0xd')]('/',auth['isAuthenticated'](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0xa630=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x582028,_0x5c1dc0){var _0xc3f006=function(_0x16624a){while(--_0x16624a){_0x582028['push'](_0x582028['shift']());}};_0xc3f006(++_0x5c1dc0);}(_0xa630,0xbe));var _0x0a63=function(_0x3fa127,_0x557c3d){_0x3fa127=_0x3fa127-0x0;var _0x4c32d5=_0xa630[_0x3fa127];return _0x4c32d5;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0x9')]);router[_0x0a63('0xa')]('/',auth[_0x0a63('0xb')](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')](_0x0a63('0x8'),auth['isAuthenticated'](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0x8'),auth[_0x0a63('0xb')](),controller[_0x0a63('0x10')]);module[_0x0a63('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ff83ea3..1b9d4c8 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 _0xfa82=['ENUM','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x15fb51,_0x164cd4){var _0x438b20=function(_0x5e918b){while(--_0x5e918b){_0x15fb51['push'](_0x15fb51['shift']());}};_0x438b20(++_0x164cd4);}(_0xfa82,0xa3));var _0x2fa8=function(_0x3a20f0,_0x2ee456){_0x3a20f0=_0x3a20f0-0x0;var _0x31c636=_0xfa82[_0x3a20f0];return _0x31c636;};'use strict';var Sequelize=require(_0x2fa8('0x0'));module[_0x2fa8('0x1')]={'name':{'type':Sequelize[_0x2fa8('0x2')],'unique':_0x2fa8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2fa8('0x2')]},'timeout':{'type':Sequelize[_0x2fa8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fa8('0x5')]('rrmemory','beepall',_0x2fa8('0x6'))}}; \ No newline at end of file +var _0x6d09=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f5c3a,_0x30dbe0){var _0x363a19=function(_0x29110b){while(--_0x29110b){_0x2f5c3a['push'](_0x2f5c3a['shift']());}};_0x363a19(++_0x30dbe0);}(_0x6d09,0x13f));var _0x96d0=function(_0x1dbb50,_0x5a4d06){_0x1dbb50=_0x1dbb50-0x0;var _0x4ccd44=_0x6d09[_0x1dbb50];return _0x4ccd44;};'use strict';var Sequelize=require(_0x96d0('0x0'));module[_0x96d0('0x1')]={'name':{'type':Sequelize[_0x96d0('0x2')],'unique':_0x96d0('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x96d0('0x2')]},'timeout':{'type':Sequelize[_0x96d0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x96d0('0x5')](_0x96d0('0x6'),'beepall',_0x96d0('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e97465f..35aab2d 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 _0x444b=['all','union','compact','value','removeTeams','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatQueue.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','get','destroy','then','end','error','index','map','ChatQueue','fieldName','key','where','include','query','findAll','catch','show','params','model','keys','attributes','fields','length','includeAll','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','rawAttributes','filters','intersection','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','options','UserId','agent','name','chatPause','createdAt','format','SIP','updatedAt','getTeams','Team','pick','addTeams','User','Agents','interface','flatMap','sequelize','transaction','each','UserChatQueue','findOrCreate','emit','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes'];(function(_0x5a7414,_0x3d73c1){var _0x12d543=function(_0x5802de){while(--_0x5802de){_0x5a7414['push'](_0x5a7414['shift']());}};_0x12d543(++_0x3d73c1);}(_0x444b,0x176));var _0xb444=function(_0x4d1ec1,_0x342bbe){_0x4d1ec1=_0x4d1ec1-0x0;var _0x8caef6=_0x444b[_0x4d1ec1];return _0x8caef6;};'use strict';var BPromise=require(_0xb444('0x0'));var util=require(_0xb444('0x1'));var _=require(_0xb444('0x2'));var squel=require(_0xb444('0x3'));var Redis=require(_0xb444('0x4'));var qs=require(_0xb444('0x5'));var logger=require(_0xb444('0x6'))(_0xb444('0x7'));var config=require(_0xb444('0x8'));var db=require(_0xb444('0x9'))['db'];config[_0xb444('0xa')]=_['defaults'](config[_0xb444('0xa')],{'host':_0xb444('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb444('0xc'))['register'](socket);function respondWithStatusCode(_0xee5100,_0x4de151){_0x4de151=_0x4de151||0xcc;return function(_0x48bde0){if(_0x48bde0){return _0xee5100[_0xb444('0xd')](_0x4de151);}return _0xee5100['status'](_0x4de151)['end']();};}function respondWithResult(_0x1b56e4,_0x291f08){_0x291f08=_0x291f08||0xc8;return function(_0x3ad75e){if(_0x3ad75e){return _0x1b56e4[_0xb444('0xe')](_0x291f08)[_0xb444('0xf')](_0x3ad75e);}};}function respondWithFilteredResult(_0x1d8173,_0xe7911b){return function(_0x406e16){if(_0x406e16){var _0x12deee=typeof _0xe7911b[_0xb444('0x10')]===_0xb444('0x11')&&typeof _0xe7911b[_0xb444('0x12')]===_0xb444('0x11');var _0x25f3fd=_0x406e16[_0xb444('0x13')];var _0x5e3eac=_0x12deee?0x0:_0xe7911b[_0xb444('0x10')];var _0x968020=_0x12deee?_0x406e16[_0xb444('0x13')]:_0xe7911b[_0xb444('0x10')]+_0xe7911b[_0xb444('0x12')];var _0x563c09;if(_0x968020>=_0x25f3fd){_0x968020=_0x25f3fd;_0x563c09=0xc8;}else{_0x563c09=0xce;}_0x1d8173[_0xb444('0xe')](_0x563c09);return _0x1d8173['set'](_0xb444('0x14'),_0x5e3eac+'-'+_0x968020+'/'+_0x25f3fd)[_0xb444('0xf')](_0x406e16);}return null;};}function saveUpdates(_0x6b83da){return function(_0x50162f){if(_0x50162f){return _0x50162f[_0xb444('0x15')](_0x6b83da)['then'](function(_0x15e445){return _0x15e445;});}return null;};}function removeEntity(_0x4429cc){return function(_0x116dfc){if(_0x116dfc){return _0x116dfc['destroy']()['then'](function(){var _0x1b8d7=_0x116dfc[_0xb444('0x16')]({'plain':!![]});var _0x4eee3a='ChatQueues';return db['UserProfileResource'][_0xb444('0x17')]({'where':{'type':_0x4eee3a,'resourceId':_0x1b8d7['id']}})[_0xb444('0x18')](function(){return _0x116dfc;});})[_0xb444('0x18')](function(){_0x4429cc[_0xb444('0xe')](0xcc)[_0xb444('0x19')]();});}};}function handleEntityNotFound(_0xbc62e0){return function(_0x5f3900){if(!_0x5f3900){_0xbc62e0[_0xb444('0xd')](0x194);}return _0x5f3900;};}function handleError(_0x5e48ee,_0x556c5a){_0x556c5a=_0x556c5a||0x1f4;return function(_0xbd7ed7){logger[_0xb444('0x1a')](_0xbd7ed7['stack']);if(_0xbd7ed7['name']){delete _0xbd7ed7['name'];}_0x5e48ee[_0xb444('0xe')](_0x556c5a)['send'](_0xbd7ed7);};}exports[_0xb444('0x1b')]=function(_0x10e04c,_0x98b876){var _0x943f68={};var _0x3641aa={'count':0x0,'rows':[]};var _0x5d46dd=_[_0xb444('0x1c')](db[_0xb444('0x1d')]['rawAttributes'],function(_0x36c1de){return{'name':_0x36c1de[_0xb444('0x1e')],'type':_0x36c1de['type'][_0xb444('0x1f')]};});_0x943f68=qs['getOptions'](_0x5d46dd,_0x10e04c);var _0x212968={'where':_0x943f68[_0xb444('0x20')]};return db[_0xb444('0x1d')][_0xb444('0x13')](_0x212968)[_0xb444('0x18')](function(_0x11bfff){_0x3641aa[_0xb444('0x13')]=_0x11bfff;_0x943f68[_0xb444('0x21')]=qs[_0xb444('0x21')](_0x10e04c[_0xb444('0x22')]);return db[_0xb444('0x1d')][_0xb444('0x23')](_0x943f68);})[_0xb444('0x18')](function(_0x243ee4){_0x3641aa['rows']=_0x243ee4;return _0x3641aa;})['then'](respondWithFilteredResult(_0x98b876,_0x943f68))[_0xb444('0x24')](handleError(_0x98b876,null));};exports[_0xb444('0x25')]=function(_0x2fe3bd,_0x4ef0ee){var _0x319e3e={'raw':!![],'where':{'id':_0x2fe3bd[_0xb444('0x26')]['id']}},_0x2fdf6c={};_0x2fdf6c[_0xb444('0x27')]=_[_0xb444('0x28')](db[_0xb444('0x1d')]['rawAttributes']);_0x2fdf6c[_0xb444('0x22')]=_[_0xb444('0x28')](_0x2fe3bd['query']);_0x2fdf6c['filters']=_['intersection'](_0x2fdf6c['model'],_0x2fdf6c[_0xb444('0x22')]);_0x319e3e[_0xb444('0x29')]=_['intersection'](_0x2fdf6c[_0xb444('0x27')],qs[_0xb444('0x2a')](_0x2fe3bd['query'][_0xb444('0x2a')]));_0x319e3e[_0xb444('0x29')]=_0x319e3e[_0xb444('0x29')][_0xb444('0x2b')]?_0x319e3e['attributes']:_0x2fdf6c[_0xb444('0x27')];if(_0x2fe3bd[_0xb444('0x22')][_0xb444('0x2c')]){_0x319e3e['include']=[{'all':!![]}];}_0x319e3e=_[_0xb444('0x2d')]({},_0x319e3e,_0x2fe3bd['options']);return db[_0xb444('0x1d')][_0xb444('0x2e')](_0x319e3e)[_0xb444('0x18')](handleEntityNotFound(_0x4ef0ee,null))[_0xb444('0x18')](respondWithResult(_0x4ef0ee,null))[_0xb444('0x24')](handleError(_0x4ef0ee,null));};exports['create']=function(_0x169a1d,_0x14a577){return db[_0xb444('0x1d')][_0xb444('0x2f')](_0x169a1d['body'],{})[_0xb444('0x18')](function(_0x4c707a){var _0x340d06=_0x169a1d[_0xb444('0x30')][_0xb444('0x16')]({'plain':!![]});if(!_0x340d06)throw new Error(_0xb444('0x31'));if(_0x340d06[_0xb444('0x32')]===_0xb444('0x30')){var _0xb7d883=_0x4c707a[_0xb444('0x16')]({'plain':!![]});var _0x55df3e=_0xb444('0x33');return db['UserProfileSection'][_0xb444('0x2e')]({'where':{'name':_0x55df3e,'userProfileId':_0x340d06[_0xb444('0x34')]},'raw':!![]})[_0xb444('0x18')](function(_0x53e009){if(_0x53e009&&_0x53e009[_0xb444('0x35')]===0x0){return db['UserProfileResource'][_0xb444('0x2f')]({'name':_0xb7d883['name'],'resourceId':_0xb7d883['id'],'type':_0x53e009['name'],'sectionId':_0x53e009['id']},{})[_0xb444('0x18')](function(){return _0x4c707a;});}else{return _0x4c707a;}})[_0xb444('0x24')](function(_0x2c50c1){logger['error'](_0xb444('0x36'),_0x2c50c1);throw _0x2c50c1;});}return _0x4c707a;})[_0xb444('0x18')](respondWithResult(_0x14a577,0xc9))[_0xb444('0x24')](handleError(_0x14a577,null));};exports['update']=function(_0x22f3a6,_0x194fde){if(_0x22f3a6[_0xb444('0x37')]['id']){delete _0x22f3a6[_0xb444('0x37')]['id'];}return db[_0xb444('0x1d')][_0xb444('0x2e')]({'where':{'id':_0x22f3a6['params']['id']}})[_0xb444('0x18')](handleEntityNotFound(_0x194fde,null))[_0xb444('0x18')](saveUpdates(_0x22f3a6[_0xb444('0x37')],null))[_0xb444('0x18')](respondWithResult(_0x194fde,null))[_0xb444('0x24')](handleError(_0x194fde,null));};exports[_0xb444('0x17')]=function(_0x5bc51f,_0x24ff6f){return db[_0xb444('0x1d')][_0xb444('0x2e')]({'where':{'id':_0x5bc51f[_0xb444('0x26')]['id']}})[_0xb444('0x18')](handleEntityNotFound(_0x24ff6f,null))['then'](removeEntity(_0x24ff6f,null))[_0xb444('0x24')](handleError(_0x24ff6f,null));};exports[_0xb444('0x38')]=function(_0x100ead,_0x2ec538){return db[_0xb444('0x1d')][_0xb444('0x38')]()['then'](respondWithResult(_0x2ec538,null))[_0xb444('0x24')](handleError(_0x2ec538,null));};exports['getMembers']=function(_0x4c1388,_0x1e16e7){var _0x18b5eb={'raw':!![],'where':{}},_0x4cf9b7={},_0x3ec166;return db[_0xb444('0x1d')][_0xb444('0x39')]({'where':{'id':_0x4c1388['params']['id']}})[_0xb444('0x18')](handleEntityNotFound(_0x1e16e7,null))[_0xb444('0x18')](function(_0x327218){if(_0x327218){_0x3ec166=_0x327218['get']({'plain':!![]});_0x4cf9b7['model']=_[_0xb444('0x28')](db['UserChatQueue'][_0xb444('0x3a')]);_0x4cf9b7['query']=_[_0xb444('0x28')](_0x4c1388[_0xb444('0x22')]);_0x4cf9b7[_0xb444('0x3b')]=_[_0xb444('0x3c')](_0x4cf9b7['model'],_0x4cf9b7[_0xb444('0x22')]);_0x18b5eb[_0xb444('0x29')]=_[_0xb444('0x3c')](_0x4cf9b7['model'],qs[_0xb444('0x2a')](_0x4c1388[_0xb444('0x22')][_0xb444('0x2a')]));_0x18b5eb[_0xb444('0x29')]=_0x18b5eb[_0xb444('0x29')][_0xb444('0x2b')]?_0x18b5eb['attributes']:_0x4cf9b7[_0xb444('0x27')];if(!_0x4c1388['query'][_0xb444('0x3d')](_0xb444('0x3e'))){_0x18b5eb['limit']=qs[_0xb444('0x12')](_0x4c1388[_0xb444('0x22')]['limit']);_0x18b5eb[_0xb444('0x10')]=qs[_0xb444('0x10')](_0x4c1388[_0xb444('0x22')][_0xb444('0x10')]);}_0x18b5eb[_0xb444('0x3f')]=qs[_0xb444('0x40')](_0x4c1388[_0xb444('0x22')][_0xb444('0x40')]);_0x18b5eb[_0xb444('0x20')]=qs['filters'](_['pick'](_0x4c1388['query'],_0x4cf9b7[_0xb444('0x3b')]));_0x18b5eb[_0xb444('0x20')][_0xb444('0x41')]=_0x327218['id'];if(_0x4c1388[_0xb444('0x22')][_0xb444('0x42')]){_0x18b5eb[_0xb444('0x20')]=_[_0xb444('0x2d')](_0x18b5eb[_0xb444('0x20')],{'$or':_['map'](_0x18b5eb[_0xb444('0x29')],function(_0x341b20){var _0x49fa97={};_0x49fa97[_0x341b20]={'$like':'%'+_0x4c1388[_0xb444('0x22')][_0xb444('0x42')]+'%'};return _0x49fa97;})});}_0x18b5eb=_['merge']({},_0x18b5eb,_0x4c1388[_0xb444('0x43')]);return db['UserChatQueue'][_0xb444('0x23')](_0x18b5eb);}})[_0xb444('0x18')](function(_0x26460d){if(_0x26460d){return db['User']['findAndCountAll']({'where':{'id':_[_0xb444('0x1c')](_0x26460d,_0xb444('0x44')),'role':_0xb444('0x45')},'attributes':['id',_0xb444('0x46'),_0xb444('0x47'),'updatedAt',_0xb444('0x48')]});}})[_0xb444('0x18')](function(_0xb13923){if(_0xb13923){return{'count':_0xb13923[_0xb444('0x13')],'rows':_['map'](_0xb13923['rows'],function(_0x32ab37){return{'membername':_0x32ab37['name'],'UserId':_0x32ab37['id'],'queue_name':_0x3ec166['name'],'ChatQueueId':_0x3ec166['id'],'interface':util[_0xb444('0x49')]('%s/%s',_0xb444('0x4a'),_0x32ab37[_0xb444('0x46')]),'penalty':0x0,'paused':_0x32ab37[_0xb444('0x47')],'createdAt':_0x32ab37[_0xb444('0x48')],'updatedAt':_0x32ab37[_0xb444('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb444('0x18')](respondWithFilteredResult(_0x1e16e7,_0x18b5eb))['catch'](handleError(_0x1e16e7,null));};exports[_0xb444('0x4c')]=function(_0x149410,_0x445d68){var _0x155dcc={};var _0x22ccb5={};var _0x3610c3;var _0x2a4300;return db[_0xb444('0x1d')][_0xb444('0x39')]({'where':{'id':_0x149410['params']['id']}})['then'](handleEntityNotFound(_0x445d68,null))[_0xb444('0x18')](function(_0x346f47){if(_0x346f47){_0x3610c3=_0x346f47;_0x22ccb5[_0xb444('0x27')]=_['keys'](db[_0xb444('0x4d')]['rawAttributes']);_0x22ccb5[_0xb444('0x22')]=_[_0xb444('0x28')](_0x149410[_0xb444('0x22')]);_0x22ccb5[_0xb444('0x3b')]=_['intersection'](_0x22ccb5[_0xb444('0x27')],_0x22ccb5[_0xb444('0x22')]);_0x155dcc[_0xb444('0x29')]=_[_0xb444('0x3c')](_0x22ccb5[_0xb444('0x27')],qs['fields'](_0x149410[_0xb444('0x22')][_0xb444('0x2a')]));_0x155dcc['attributes']=_0x155dcc[_0xb444('0x29')][_0xb444('0x2b')]?_0x155dcc[_0xb444('0x29')]:_0x22ccb5[_0xb444('0x27')];_0x155dcc[_0xb444('0x3f')]=qs['sort'](_0x149410[_0xb444('0x22')][_0xb444('0x40')]);_0x155dcc[_0xb444('0x20')]=qs[_0xb444('0x3b')](_[_0xb444('0x4e')](_0x149410[_0xb444('0x22')],_0x22ccb5['filters']));if(_0x149410['query'][_0xb444('0x42')]){_0x155dcc[_0xb444('0x20')]=_[_0xb444('0x2d')](_0x155dcc[_0xb444('0x20')],{'$or':_[_0xb444('0x1c')](_0x155dcc[_0xb444('0x29')],function(_0x4f37a6){var _0x543626={};_0x543626[_0x4f37a6]={'$like':'%'+_0x149410['query'][_0xb444('0x42')]+'%'};return _0x543626;})});}_0x155dcc=_['merge']({},_0x155dcc,_0x149410[_0xb444('0x43')]);return _0x3610c3[_0xb444('0x4c')](_0x155dcc);}})[_0xb444('0x18')](function(_0x463c97){if(_0x463c97){_0x2a4300=_0x463c97[_0xb444('0x2b')];if(!_0x149410[_0xb444('0x22')]['hasOwnProperty']('nolimit')){_0x155dcc[_0xb444('0x12')]=qs['limit'](_0x149410['query'][_0xb444('0x12')]);_0x155dcc[_0xb444('0x10')]=qs['offset'](_0x149410['query'][_0xb444('0x10')]);}return _0x3610c3[_0xb444('0x4c')](_0x155dcc);}})[_0xb444('0x18')](function(_0x468c1c){if(_0x468c1c){return _0x468c1c?{'count':_0x2a4300,'rows':_0x468c1c}:null;}})[_0xb444('0x18')](respondWithResult(_0x445d68,null))[_0xb444('0x24')](handleError(_0x445d68,null));};exports[_0xb444('0x4f')]=function(_0x42aaea,_0x4cb910){var _0x29c287=_0x42aaea[_0xb444('0x37')]['ids'];return db[_0xb444('0x4d')][_0xb444('0x23')]({'where':{'id':_0x29c287},'attributes':['id'],'include':[{'model':db[_0xb444('0x50')],'as':_0xb444('0x51'),'attributes':['id',_0xb444('0x46'),'online','voicePause',_0xb444('0x52')],'raw':!![]}]})[_0xb444('0x18')](function(_0x169f49){if(_0x169f49){var _0x57c5e4=_[_0xb444('0x53')](_0x169f49,function(_0x57a76a){var _0x349f0a=_0x57a76a[_0xb444('0x16')]({'plain':!![]});return _0x349f0a[_0xb444('0x51')];});return db['ChatQueue']['find']({'where':{'id':_0x42aaea[_0xb444('0x26')]['id']}})[_0xb444('0x18')](function(_0x58e83e){return db[_0xb444('0x54')][_0xb444('0x55')](function(_0x2e44a2){return _0x58e83e[_0xb444('0x4f')](_0x29c287,{'transaction':_0x2e44a2})['then'](function(){return BPromise[_0xb444('0x56')](_0x57c5e4,function(_0x2fe7e6){return db[_0xb444('0x57')][_0xb444('0x58')]({'where':{'UserId':_0x2fe7e6['id'],'ChatQueueId':_0x42aaea['params']['id']},'transaction':_0x2e44a2});});})['then'](function(){_0x57c5e4['forEach'](function(_0x4069bf){socket[_0xb444('0x59')]('userChatQueue:save',{'UserId':_0x4069bf['id'],'ChatQueueId':_0x58e83e['id']});});});});});}})[_0xb444('0x18')](respondWithStatusCode(_0x4cb910,null))[_0xb444('0x24')](handleError(_0x4cb910,null));};exports['removeTeams']=function(_0x2c9c12,_0x12442){return db[_0xb444('0x4d')][_0xb444('0x23')]({'where':{'id':_0x2c9c12[_0xb444('0x22')][_0xb444('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xb444('0x50')],'as':_0xb444('0x51'),'attributes':['id'],'raw':!![]}]})[_0xb444('0x18')](handleEntityNotFound(_0x12442,null))[_0xb444('0x18')](function(_0x162441){var _0x284c86=_[_0xb444('0x1c')](_0x162441,'id');var _0x2c1a3d=[];var _0x4521dc=[];var _0x625d=squel[_0xb444('0x5b')]();_0x625d[_0xb444('0x5c')]('tq.TeamId')[_0xb444('0x5d')]('team_has_chat_queues','tq')[_0xb444('0x5e')](_0xb444('0x5f'),'ut',_0xb444('0x60'))[_0xb444('0x20')](_0xb444('0x61'),_0x2c9c12['params']['id']);for(var _0x24700a=0x0;_0x24700a<_0x162441[_0xb444('0x2b')];_0x24700a+=0x1){let _0x2e41a4=_0x162441[_0x24700a];for(var _0x38e59c=0x0;_0x38e59c<_0x2e41a4[_0xb444('0x51')][_0xb444('0x2b')];_0x38e59c+=0x1){let _0x21df72=_0x2e41a4[_0xb444('0x51')][_0x38e59c];var _0x1da6bf=_0x625d[_0xb444('0x62')]();_0x1da6bf['where'](_0xb444('0x63'),_0x21df72['id']);_0x4521dc[_0xb444('0x64')](db[_0xb444('0x54')][_0xb444('0x22')](_0x1da6bf[_0xb444('0x65')](),{'type':db['sequelize'][_0xb444('0x66')][_0xb444('0x67')]})[_0xb444('0x18')](function(_0x49641a){if(_0x49641a[_0xb444('0x2b')]===0x1){return _0x21df72['id'];}else{var _0x3b6930=_[_0xb444('0x68')](_['map'](_0x49641a,'TeamId'),function(_0x39e823){return _[_0xb444('0x69')](_0x284c86,_0x39e823);});if(_0x3b6930){return _0x21df72['id'];}}}));}}return BPromise[_0xb444('0x6a')](_0x4521dc)[_0xb444('0x18')](function(_0x9ad77d){_0x2c1a3d=_(_0x2c1a3d)[_0xb444('0x6b')](_0x9ad77d)[_0xb444('0x6c')]()[_0xb444('0x6d')]();return db[_0xb444('0x1d')]['find']({'where':{'id':_0x2c9c12['params']['id']}})[_0xb444('0x18')](function(_0x4245a4){return db[_0xb444('0x54')]['transaction'](function(_0x58c0d1){return _0x4245a4[_0xb444('0x6e')](_0x2c9c12[_0xb444('0x22')][_0xb444('0x5a')],{'transaction':_0x58c0d1})[_0xb444('0x18')](function(){if(!_[_0xb444('0x6f')](_0x2c1a3d)){return _0x4245a4['removeAgents'](_0x2c1a3d,{'transaction':_0x58c0d1});}})['then'](function(){_0x2c1a3d[_0xb444('0x70')](function(_0x22f6c5){socket[_0xb444('0x59')](_0xb444('0x71'),{'UserId':_0x22f6c5,'ChatQueueId':_0x4245a4['id']});});});});});});})[_0xb444('0x18')](respondWithStatusCode(_0x12442,null))[_0xb444('0x24')](handleError(_0x12442,null));};exports[_0xb444('0x72')]=function(_0x1955cb,_0x22c69e){return db[_0xb444('0x1d')][_0xb444('0x2e')]({'where':{'id':_0x1955cb[_0xb444('0x26')]['id']}})['then'](handleEntityNotFound(_0x22c69e,null))['then'](function(_0x10ba9e){if(_0x10ba9e){return _0x10ba9e['addAgents'](_0x1955cb['body'][_0xb444('0x5a')],_[_0xb444('0x73')](_0x1955cb[_0xb444('0x37')],[_0xb444('0x5a'),'id'])||{})[_0xb444('0x74')](function(_0x3e6ea8){for(var _0x357ef8=0x0;_0x357ef8<_0x1955cb[_0xb444('0x37')]['ids'][_0xb444('0x2b')];_0x357ef8+=0x1){socket['emit'](_0xb444('0x75'),{'UserId':Number(_0x1955cb['body'][_0xb444('0x5a')][_0x357ef8]),'ChatQueueId':Number(_0x1955cb[_0xb444('0x26')]['id'])});}return _0x3e6ea8;});}})[_0xb444('0x18')](respondWithResult(_0x22c69e,null))[_0xb444('0x24')](handleError(_0x22c69e,null));};exports[_0xb444('0x76')]=function(_0x61b8d8,_0x53d3c2){return db['ChatQueue'][_0xb444('0x2e')]({'where':{'id':_0x61b8d8['params']['id']}})[_0xb444('0x18')](handleEntityNotFound(_0x53d3c2,null))['then'](function(_0x1ad30b){if(_0x1ad30b){return _0x1ad30b[_0xb444('0x76')](_0x61b8d8[_0xb444('0x22')][_0xb444('0x5a')])['then'](function(){if(_['isArray'](_0x61b8d8['query']['ids'])){for(var _0x2017a1=0x0;_0x2017a1<_0x61b8d8[_0xb444('0x22')][_0xb444('0x5a')]['length'];_0x2017a1+=0x1){socket[_0xb444('0x59')](_0xb444('0x71'),{'UserId':Number(_0x61b8d8[_0xb444('0x22')][_0xb444('0x5a')][_0x2017a1]),'ChatQueueId':Number(_0x61b8d8[_0xb444('0x26')]['id'])});}}else{socket[_0xb444('0x59')](_0xb444('0x71'),{'UserId':Number(_0x61b8d8['query']['ids']),'ChatQueueId':Number(_0x61b8d8[_0xb444('0x26')]['id'])});}});}})[_0xb444('0x18')](respondWithStatusCode(_0x53d3c2,null))['catch'](handleError(_0x53d3c2,null));};exports['getAgents']=function(_0x75dee7,_0x24a78b){var _0x302415={};var _0x4ce7f7={};var _0x7f5426;var _0xf7c167;return db[_0xb444('0x1d')][_0xb444('0x39')]({'where':{'id':_0x75dee7[_0xb444('0x26')]['id']}})['then'](handleEntityNotFound(_0x24a78b,null))[_0xb444('0x18')](function(_0x476417){if(_0x476417){_0x7f5426=_0x476417;_0x4ce7f7['model']=_['keys'](db[_0xb444('0x50')][_0xb444('0x3a')]);_0x4ce7f7[_0xb444('0x22')]=_[_0xb444('0x28')](_0x75dee7[_0xb444('0x22')]);_0x4ce7f7['filters']=_[_0xb444('0x3c')](_0x4ce7f7[_0xb444('0x27')],_0x4ce7f7[_0xb444('0x22')]);_0x302415[_0xb444('0x29')]=_[_0xb444('0x3c')](_0x4ce7f7[_0xb444('0x27')],qs['fields'](_0x75dee7[_0xb444('0x22')][_0xb444('0x2a')]));_0x302415['attributes']=_0x302415[_0xb444('0x29')][_0xb444('0x2b')]?_0x302415[_0xb444('0x29')]:_0x4ce7f7['model'];_0x302415['order']=qs['sort'](_0x75dee7[_0xb444('0x22')][_0xb444('0x40')]);_0x302415[_0xb444('0x20')]=qs['filters'](_[_0xb444('0x4e')](_0x75dee7['query'],_0x4ce7f7['filters']));if(_0x75dee7[_0xb444('0x22')][_0xb444('0x42')]){_0x302415[_0xb444('0x20')]=_[_0xb444('0x2d')](_0x302415['where'],{'$or':_[_0xb444('0x1c')](_0x302415[_0xb444('0x29')],function(_0x2ad183){var _0x464ca0={};_0x464ca0[_0x2ad183]={'$like':'%'+_0x75dee7[_0xb444('0x22')][_0xb444('0x42')]+'%'};return _0x464ca0;})});}_0x302415=_[_0xb444('0x2d')]({},_0x302415,_0x75dee7[_0xb444('0x43')]);return _0x7f5426['getAgents'](_0x302415);}})[_0xb444('0x18')](function(_0x582fe1){if(_0x582fe1){_0xf7c167=_0x582fe1[_0xb444('0x2b')];if(!_0x75dee7['query'][_0xb444('0x3d')](_0xb444('0x3e'))){_0x302415['limit']=qs[_0xb444('0x12')](_0x75dee7[_0xb444('0x22')][_0xb444('0x12')]);_0x302415[_0xb444('0x10')]=qs['offset'](_0x75dee7[_0xb444('0x22')]['offset']);}return _0x7f5426[_0xb444('0x77')](_0x302415);}})[_0xb444('0x18')](function(_0x2c8c86){if(_0x2c8c86){return _0x2c8c86?{'count':_0xf7c167,'rows':_0x2c8c86}:null;}})['then'](respondWithResult(_0x24a78b,null))['catch'](handleError(_0x24a78b,null));}; \ No newline at end of file +var _0x8a25=['rows','catch','show','model','keys','intersection','fields','attributes','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','length','nolimit','order','sort','filters','pick','UserChatQueue','findAndCountAll','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','filter','ids','User','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','userChatQueue:save','removeTeams','field','tq.TeamId','from','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','sendStatus','status','offset','undefined','count','limit','set','then','destroy','get','ChatQueues','UserProfileResource','end','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll'];(function(_0x2573ca,_0x550022){var _0x220656=function(_0x1ac82c){while(--_0x1ac82c){_0x2573ca['push'](_0x2573ca['shift']());}};_0x220656(++_0x550022);}(_0x8a25,0x12f));var _0x58a2=function(_0x4b75e7,_0xdb714a){_0x4b75e7=_0x4b75e7-0x0;var _0x1ea0d8=_0x8a25[_0x4b75e7];return _0x1ea0d8;};'use strict';var BPromise=require(_0x58a2('0x0'));var util=require(_0x58a2('0x1'));var _=require(_0x58a2('0x2'));var squel=require(_0x58a2('0x3'));var Redis=require(_0x58a2('0x4'));var qs=require(_0x58a2('0x5'));var logger=require(_0x58a2('0x6'))(_0x58a2('0x7'));var config=require(_0x58a2('0x8'));var db=require(_0x58a2('0x9'))['db'];config[_0x58a2('0xa')]=_[_0x58a2('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x58a2('0xc'))(new Redis(config[_0x58a2('0xa')]));require(_0x58a2('0xd'))['register'](socket);function respondWithStatusCode(_0x5d9d60,_0x2fadfd){_0x2fadfd=_0x2fadfd||0xcc;return function(_0x2d3318){if(_0x2d3318){return _0x5d9d60[_0x58a2('0xe')](_0x2fadfd);}return _0x5d9d60[_0x58a2('0xf')](_0x2fadfd)['end']();};}function respondWithResult(_0x4664b6,_0x15e75d){_0x15e75d=_0x15e75d||0xc8;return function(_0x3f6b2c){if(_0x3f6b2c){return _0x4664b6[_0x58a2('0xf')](_0x15e75d)['json'](_0x3f6b2c);}};}function respondWithFilteredResult(_0x486c89,_0x2d9497){return function(_0x40c476){if(_0x40c476){var _0xc728fb=typeof _0x2d9497[_0x58a2('0x10')]===_0x58a2('0x11')&&typeof _0x2d9497['limit']===_0x58a2('0x11');var _0x12d102=_0x40c476['count'];var _0x27f897=_0xc728fb?0x0:_0x2d9497[_0x58a2('0x10')];var _0x2a7422=_0xc728fb?_0x40c476[_0x58a2('0x12')]:_0x2d9497['offset']+_0x2d9497[_0x58a2('0x13')];var _0x337d25;if(_0x2a7422>=_0x12d102){_0x2a7422=_0x12d102;_0x337d25=0xc8;}else{_0x337d25=0xce;}_0x486c89[_0x58a2('0xf')](_0x337d25);return _0x486c89[_0x58a2('0x14')]('Content-Range',_0x27f897+'-'+_0x2a7422+'/'+_0x12d102)['json'](_0x40c476);}return null;};}function saveUpdates(_0x11abe4){return function(_0x5cf5f){if(_0x5cf5f){return _0x5cf5f['update'](_0x11abe4)[_0x58a2('0x15')](function(_0x53b834){return _0x53b834;});}return null;};}function removeEntity(_0x9401d5){return function(_0x3d8cbe){if(_0x3d8cbe){return _0x3d8cbe[_0x58a2('0x16')]()[_0x58a2('0x15')](function(){var _0x46937e=_0x3d8cbe[_0x58a2('0x17')]({'plain':!![]});var _0x2491f5=_0x58a2('0x18');return db[_0x58a2('0x19')][_0x58a2('0x16')]({'where':{'type':_0x2491f5,'resourceId':_0x46937e['id']}})[_0x58a2('0x15')](function(){return _0x3d8cbe;});})['then'](function(){_0x9401d5[_0x58a2('0xf')](0xcc)[_0x58a2('0x1a')]();});}};}function handleEntityNotFound(_0x49529f){return function(_0x50198b){if(!_0x50198b){_0x49529f['sendStatus'](0x194);}return _0x50198b;};}function handleError(_0x2fc2bc,_0x3da2b1){_0x3da2b1=_0x3da2b1||0x1f4;return function(_0x4f7df6){logger[_0x58a2('0x1b')](_0x4f7df6[_0x58a2('0x1c')]);if(_0x4f7df6[_0x58a2('0x1d')]){delete _0x4f7df6[_0x58a2('0x1d')];}_0x2fc2bc[_0x58a2('0xf')](_0x3da2b1)[_0x58a2('0x1e')](_0x4f7df6);};}exports['index']=function(_0x3c7b9a,_0x5308e2){var _0x276194={};var _0x25d705={'count':0x0,'rows':[]};var _0x34b7d9=_[_0x58a2('0x1f')](db[_0x58a2('0x20')][_0x58a2('0x21')],function(_0x1226cc){return{'name':_0x1226cc[_0x58a2('0x22')],'type':_0x1226cc[_0x58a2('0x23')][_0x58a2('0x24')]};});_0x276194=qs[_0x58a2('0x25')](_0x34b7d9,_0x3c7b9a);var _0x4bff13={'where':_0x276194[_0x58a2('0x26')]};return db[_0x58a2('0x20')][_0x58a2('0x12')](_0x4bff13)[_0x58a2('0x15')](function(_0x1f59d0){_0x25d705[_0x58a2('0x12')]=_0x1f59d0;_0x276194[_0x58a2('0x27')]=qs[_0x58a2('0x27')](_0x3c7b9a[_0x58a2('0x28')]);return db['ChatQueue'][_0x58a2('0x29')](_0x276194);})[_0x58a2('0x15')](function(_0x575a97){_0x25d705[_0x58a2('0x2a')]=_0x575a97;return _0x25d705;})['then'](respondWithFilteredResult(_0x5308e2,_0x276194))[_0x58a2('0x2b')](handleError(_0x5308e2,null));};exports[_0x58a2('0x2c')]=function(_0x423feb,_0x175a4d){var _0x508374={'raw':!![],'where':{'id':_0x423feb['params']['id']}},_0x123ef3={};_0x123ef3[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db['ChatQueue']['rawAttributes']);_0x123ef3[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x423feb[_0x58a2('0x28')]);_0x123ef3['filters']=_['intersection'](_0x123ef3[_0x58a2('0x2d')],_0x123ef3[_0x58a2('0x28')]);_0x508374['attributes']=_[_0x58a2('0x2f')](_0x123ef3['model'],qs[_0x58a2('0x30')](_0x423feb['query']['fields']));_0x508374[_0x58a2('0x31')]=_0x508374[_0x58a2('0x31')]['length']?_0x508374[_0x58a2('0x31')]:_0x123ef3['model'];if(_0x423feb['query']['includeAll']){_0x508374[_0x58a2('0x27')]=[{'all':!![]}];}_0x508374=_[_0x58a2('0x32')]({},_0x508374,_0x423feb[_0x58a2('0x33')]);return db[_0x58a2('0x20')][_0x58a2('0x34')](_0x508374)[_0x58a2('0x15')](handleEntityNotFound(_0x175a4d,null))[_0x58a2('0x15')](respondWithResult(_0x175a4d,null))[_0x58a2('0x2b')](handleError(_0x175a4d,null));};exports[_0x58a2('0x35')]=function(_0xee6ac6,_0x4d0c86){return db[_0x58a2('0x20')]['create'](_0xee6ac6[_0x58a2('0x36')],{})[_0x58a2('0x15')](function(_0x377aa1){var _0x3eacc0=_0xee6ac6['user'][_0x58a2('0x17')]({'plain':!![]});if(!_0x3eacc0)throw new Error(_0x58a2('0x37'));if(_0x3eacc0[_0x58a2('0x38')]===_0x58a2('0x39')){var _0x584899=_0x377aa1[_0x58a2('0x17')]({'plain':!![]});var _0x5a9215='ChatQueues';return db[_0x58a2('0x3a')][_0x58a2('0x34')]({'where':{'name':_0x5a9215,'userProfileId':_0x3eacc0[_0x58a2('0x3b')]},'raw':!![]})[_0x58a2('0x15')](function(_0x3387a2){if(_0x3387a2&&_0x3387a2['autoAssociation']===0x0){return db[_0x58a2('0x19')][_0x58a2('0x35')]({'name':_0x584899['name'],'resourceId':_0x584899['id'],'type':_0x3387a2['name'],'sectionId':_0x3387a2['id']},{})[_0x58a2('0x15')](function(){return _0x377aa1;});}else{return _0x377aa1;}})['catch'](function(_0x58d4e8){logger['error'](_0x58a2('0x3c'),_0x58d4e8);throw _0x58d4e8;});}return _0x377aa1;})[_0x58a2('0x15')](respondWithResult(_0x4d0c86,0xc9))[_0x58a2('0x2b')](handleError(_0x4d0c86,null));};exports['update']=function(_0x1edab5,_0xfc281b){if(_0x1edab5[_0x58a2('0x36')]['id']){delete _0x1edab5['body']['id'];}return db[_0x58a2('0x20')]['find']({'where':{'id':_0x1edab5[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0xfc281b,null))[_0x58a2('0x15')](saveUpdates(_0x1edab5[_0x58a2('0x36')],null))['then'](respondWithResult(_0xfc281b,null))['catch'](handleError(_0xfc281b,null));};exports[_0x58a2('0x16')]=function(_0x47f8df,_0x20a731){return db['ChatQueue'][_0x58a2('0x34')]({'where':{'id':_0x47f8df[_0x58a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x20a731,null))[_0x58a2('0x15')](removeEntity(_0x20a731,null))[_0x58a2('0x2b')](handleError(_0x20a731,null));};exports['describe']=function(_0x4917f8,_0x7903c9){return db['ChatQueue']['describe']()[_0x58a2('0x15')](respondWithResult(_0x7903c9,null))[_0x58a2('0x2b')](handleError(_0x7903c9,null));};exports[_0x58a2('0x3e')]=function(_0x20ee69,_0x3058cd){var _0x2220c8={'raw':!![],'where':{}},_0x168454={},_0xd1b879;return db[_0x58a2('0x20')][_0x58a2('0x3f')]({'where':{'id':_0x20ee69[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x3058cd,null))[_0x58a2('0x15')](function(_0x193836){if(_0x193836){_0xd1b879=_0x193836[_0x58a2('0x17')]({'plain':!![]});_0x168454[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db['UserChatQueue']['rawAttributes']);_0x168454[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x20ee69[_0x58a2('0x28')]);_0x168454['filters']=_[_0x58a2('0x2f')](_0x168454[_0x58a2('0x2d')],_0x168454[_0x58a2('0x28')]);_0x2220c8[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x168454[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x20ee69[_0x58a2('0x28')][_0x58a2('0x30')]));_0x2220c8['attributes']=_0x2220c8[_0x58a2('0x31')][_0x58a2('0x40')]?_0x2220c8['attributes']:_0x168454[_0x58a2('0x2d')];if(!_0x20ee69['query']['hasOwnProperty'](_0x58a2('0x41'))){_0x2220c8[_0x58a2('0x13')]=qs['limit'](_0x20ee69[_0x58a2('0x28')][_0x58a2('0x13')]);_0x2220c8[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x20ee69['query']['offset']);}_0x2220c8[_0x58a2('0x42')]=qs[_0x58a2('0x43')](_0x20ee69['query'][_0x58a2('0x43')]);_0x2220c8[_0x58a2('0x26')]=qs[_0x58a2('0x44')](_[_0x58a2('0x45')](_0x20ee69[_0x58a2('0x28')],_0x168454[_0x58a2('0x44')]));_0x2220c8[_0x58a2('0x26')]['ChatQueueId']=_0x193836['id'];if(_0x20ee69[_0x58a2('0x28')]['filter']){_0x2220c8['where']=_[_0x58a2('0x32')](_0x2220c8[_0x58a2('0x26')],{'$or':_[_0x58a2('0x1f')](_0x2220c8['attributes'],function(_0x402d5b){var _0x278f55={};_0x278f55[_0x402d5b]={'$like':'%'+_0x20ee69[_0x58a2('0x28')]['filter']+'%'};return _0x278f55;})});}_0x2220c8=_[_0x58a2('0x32')]({},_0x2220c8,_0x20ee69[_0x58a2('0x33')]);return db[_0x58a2('0x46')][_0x58a2('0x29')](_0x2220c8);}})[_0x58a2('0x15')](function(_0x366175){if(_0x366175){return db['User'][_0x58a2('0x47')]({'where':{'id':_['map'](_0x366175,'UserId'),'role':_0x58a2('0x48')},'attributes':['id',_0x58a2('0x1d'),_0x58a2('0x49'),'updatedAt',_0x58a2('0x4a')]});}})[_0x58a2('0x15')](function(_0x5f5d55){if(_0x5f5d55){return{'count':_0x5f5d55[_0x58a2('0x12')],'rows':_[_0x58a2('0x1f')](_0x5f5d55[_0x58a2('0x2a')],function(_0x4fd85a){return{'membername':_0x4fd85a[_0x58a2('0x1d')],'UserId':_0x4fd85a['id'],'queue_name':_0xd1b879[_0x58a2('0x1d')],'ChatQueueId':_0xd1b879['id'],'interface':util['format'](_0x58a2('0x4b'),_0x58a2('0x4c'),_0x4fd85a[_0x58a2('0x1d')]),'penalty':0x0,'paused':_0x4fd85a[_0x58a2('0x49')],'createdAt':_0x4fd85a[_0x58a2('0x4a')],'updatedAt':_0x4fd85a[_0x58a2('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3058cd,_0x2220c8))[_0x58a2('0x2b')](handleError(_0x3058cd,null));};exports[_0x58a2('0x4e')]=function(_0x383316,_0x5da002){var _0x5c4598={};var _0x4ac150={};var _0x2519a8;var _0x2b7637;return db['ChatQueue'][_0x58a2('0x3f')]({'where':{'id':_0x383316[_0x58a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5da002,null))[_0x58a2('0x15')](function(_0x5d6550){if(_0x5d6550){_0x2519a8=_0x5d6550;_0x4ac150['model']=_[_0x58a2('0x2e')](db[_0x58a2('0x4f')][_0x58a2('0x21')]);_0x4ac150[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x383316[_0x58a2('0x28')]);_0x4ac150[_0x58a2('0x44')]=_[_0x58a2('0x2f')](_0x4ac150[_0x58a2('0x2d')],_0x4ac150[_0x58a2('0x28')]);_0x5c4598[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x4ac150[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x383316[_0x58a2('0x28')][_0x58a2('0x30')]));_0x5c4598[_0x58a2('0x31')]=_0x5c4598[_0x58a2('0x31')][_0x58a2('0x40')]?_0x5c4598['attributes']:_0x4ac150[_0x58a2('0x2d')];_0x5c4598['order']=qs[_0x58a2('0x43')](_0x383316[_0x58a2('0x28')][_0x58a2('0x43')]);_0x5c4598[_0x58a2('0x26')]=qs['filters'](_['pick'](_0x383316['query'],_0x4ac150[_0x58a2('0x44')]));if(_0x383316[_0x58a2('0x28')]['filter']){_0x5c4598[_0x58a2('0x26')]=_[_0x58a2('0x32')](_0x5c4598[_0x58a2('0x26')],{'$or':_[_0x58a2('0x1f')](_0x5c4598[_0x58a2('0x31')],function(_0x1dab55){var _0x5b6166={};_0x5b6166[_0x1dab55]={'$like':'%'+_0x383316['query'][_0x58a2('0x50')]+'%'};return _0x5b6166;})});}_0x5c4598=_[_0x58a2('0x32')]({},_0x5c4598,_0x383316[_0x58a2('0x33')]);return _0x2519a8[_0x58a2('0x4e')](_0x5c4598);}})[_0x58a2('0x15')](function(_0x241163){if(_0x241163){_0x2b7637=_0x241163['length'];if(!_0x383316[_0x58a2('0x28')]['hasOwnProperty'](_0x58a2('0x41'))){_0x5c4598[_0x58a2('0x13')]=qs['limit'](_0x383316['query']['limit']);_0x5c4598[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x383316[_0x58a2('0x28')][_0x58a2('0x10')]);}return _0x2519a8['getTeams'](_0x5c4598);}})['then'](function(_0x16c1ec){if(_0x16c1ec){return _0x16c1ec?{'count':_0x2b7637,'rows':_0x16c1ec}:null;}})['then'](respondWithResult(_0x5da002,null))[_0x58a2('0x2b')](handleError(_0x5da002,null));};exports['addTeams']=function(_0xa1f741,_0x2f0d0e){var _0x400fd2=_0xa1f741[_0x58a2('0x36')][_0x58a2('0x51')];return db['Team'][_0x58a2('0x29')]({'where':{'id':_0x400fd2},'attributes':['id'],'include':[{'model':db[_0x58a2('0x52')],'as':_0x58a2('0x53'),'attributes':['id','name','online',_0x58a2('0x54'),_0x58a2('0x55')],'raw':!![]}]})[_0x58a2('0x15')](function(_0x45879d){if(_0x45879d){var _0x1077a5=_[_0x58a2('0x56')](_0x45879d,function(_0xc99838){var _0x31e992=_0xc99838[_0x58a2('0x17')]({'plain':!![]});return _0x31e992[_0x58a2('0x53')];});return db[_0x58a2('0x20')]['find']({'where':{'id':_0xa1f741[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](function(_0x343d0a){return db[_0x58a2('0x57')]['transaction'](function(_0x408ffc){return _0x343d0a[_0x58a2('0x58')](_0x400fd2,{'transaction':_0x408ffc})[_0x58a2('0x15')](function(){return BPromise[_0x58a2('0x59')](_0x1077a5,function(_0x24ab2b){return db['UserChatQueue'][_0x58a2('0x5a')]({'where':{'UserId':_0x24ab2b['id'],'ChatQueueId':_0xa1f741['params']['id']},'transaction':_0x408ffc});});})[_0x58a2('0x15')](function(){_0x1077a5['forEach'](function(_0x5e2a9c){socket['emit'](_0x58a2('0x5b'),{'UserId':_0x5e2a9c['id'],'ChatQueueId':_0x343d0a['id']});});});});});}})[_0x58a2('0x15')](respondWithStatusCode(_0x2f0d0e,null))['catch'](handleError(_0x2f0d0e,null));};exports[_0x58a2('0x5c')]=function(_0x3da9fc,_0x47efb4){return db[_0x58a2('0x4f')]['findAll']({'where':{'id':_0x3da9fc[_0x58a2('0x28')][_0x58a2('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x58a2('0x15')](handleEntityNotFound(_0x47efb4,null))[_0x58a2('0x15')](function(_0x3b03f6){var _0x51a593=_[_0x58a2('0x1f')](_0x3b03f6,'id');var _0xed6d92=[];var _0x301afd=[];var _0x993553=squel['select']();_0x993553[_0x58a2('0x5d')](_0x58a2('0x5e'))[_0x58a2('0x5f')]('team_has_chat_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x58a2('0x60'),_0x3da9fc[_0x58a2('0x3d')]['id']);for(var _0x103ca0=0x0;_0x103ca0<_0x3b03f6[_0x58a2('0x40')];_0x103ca0+=0x1){let _0x4371fc=_0x3b03f6[_0x103ca0];for(var _0x1958a7=0x0;_0x1958a7<_0x4371fc[_0x58a2('0x53')][_0x58a2('0x40')];_0x1958a7+=0x1){let _0x48d0e1=_0x4371fc[_0x58a2('0x53')][_0x1958a7];var _0x15642b=_0x993553['clone']();_0x15642b[_0x58a2('0x26')](_0x58a2('0x61'),_0x48d0e1['id']);_0x301afd[_0x58a2('0x62')](db[_0x58a2('0x57')][_0x58a2('0x28')](_0x15642b['toString'](),{'type':db[_0x58a2('0x57')][_0x58a2('0x63')][_0x58a2('0x64')]})[_0x58a2('0x15')](function(_0x106ba3){if(_0x106ba3[_0x58a2('0x40')]===0x1){return _0x48d0e1['id'];}else{var _0x4c623b=_[_0x58a2('0x65')](_[_0x58a2('0x1f')](_0x106ba3,_0x58a2('0x66')),function(_0x1704aa){return _[_0x58a2('0x67')](_0x51a593,_0x1704aa);});if(_0x4c623b){return _0x48d0e1['id'];}}}));}}return BPromise[_0x58a2('0x68')](_0x301afd)[_0x58a2('0x15')](function(_0x2b381f){_0xed6d92=_(_0xed6d92)[_0x58a2('0x69')](_0x2b381f)['compact']()['value']();return db[_0x58a2('0x20')][_0x58a2('0x34')]({'where':{'id':_0x3da9fc['params']['id']}})['then'](function(_0xf3b157){return db[_0x58a2('0x57')][_0x58a2('0x6a')](function(_0x4483e5){return _0xf3b157[_0x58a2('0x5c')](_0x3da9fc[_0x58a2('0x28')][_0x58a2('0x51')],{'transaction':_0x4483e5})['then'](function(){if(!_[_0x58a2('0x6b')](_0xed6d92)){return _0xf3b157[_0x58a2('0x6c')](_0xed6d92,{'transaction':_0x4483e5});}})[_0x58a2('0x15')](function(){_0xed6d92['forEach'](function(_0x1b0ec7){socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':_0x1b0ec7,'ChatQueueId':_0xf3b157['id']});});});});});});})[_0x58a2('0x15')](respondWithStatusCode(_0x47efb4,null))[_0x58a2('0x2b')](handleError(_0x47efb4,null));};exports['addAgents']=function(_0x510463,_0x33e19a){return db['ChatQueue']['find']({'where':{'id':_0x510463[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x33e19a,null))['then'](function(_0x200108){if(_0x200108){return _0x200108['addAgents'](_0x510463[_0x58a2('0x36')][_0x58a2('0x51')],_[_0x58a2('0x6f')](_0x510463[_0x58a2('0x36')],['ids','id'])||{})[_0x58a2('0x70')](function(_0x713134){for(var _0x2bb710=0x0;_0x2bb710<_0x510463['body'][_0x58a2('0x51')]['length'];_0x2bb710+=0x1){socket[_0x58a2('0x6d')](_0x58a2('0x5b'),{'UserId':Number(_0x510463[_0x58a2('0x36')][_0x58a2('0x51')][_0x2bb710]),'ChatQueueId':Number(_0x510463[_0x58a2('0x3d')]['id'])});}return _0x713134;});}})['then'](respondWithResult(_0x33e19a,null))[_0x58a2('0x2b')](handleError(_0x33e19a,null));};exports[_0x58a2('0x6c')]=function(_0x1da349,_0x3f6905){return db[_0x58a2('0x20')]['find']({'where':{'id':_0x1da349[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x3f6905,null))[_0x58a2('0x15')](function(_0x426f93){if(_0x426f93){return _0x426f93[_0x58a2('0x6c')](_0x1da349[_0x58a2('0x28')]['ids'])['then'](function(){if(_[_0x58a2('0x71')](_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')])){for(var _0x3dd624=0x0;_0x3dd624<_0x1da349['query'][_0x58a2('0x51')][_0x58a2('0x40')];_0x3dd624+=0x1){socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':Number(_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')][_0x3dd624]),'ChatQueueId':Number(_0x1da349[_0x58a2('0x3d')]['id'])});}}else{socket[_0x58a2('0x6d')](_0x58a2('0x6e'),{'UserId':Number(_0x1da349[_0x58a2('0x28')][_0x58a2('0x51')]),'ChatQueueId':Number(_0x1da349[_0x58a2('0x3d')]['id'])});}});}})[_0x58a2('0x15')](respondWithStatusCode(_0x3f6905,null))[_0x58a2('0x2b')](handleError(_0x3f6905,null));};exports[_0x58a2('0x72')]=function(_0x59866c,_0x49f3e0){var _0x3c020e={};var _0x257131={};var _0x28f0d7;var _0x3e3757;return db[_0x58a2('0x20')][_0x58a2('0x3f')]({'where':{'id':_0x59866c[_0x58a2('0x3d')]['id']}})[_0x58a2('0x15')](handleEntityNotFound(_0x49f3e0,null))[_0x58a2('0x15')](function(_0x238396){if(_0x238396){_0x28f0d7=_0x238396;_0x257131[_0x58a2('0x2d')]=_[_0x58a2('0x2e')](db[_0x58a2('0x52')][_0x58a2('0x21')]);_0x257131[_0x58a2('0x28')]=_[_0x58a2('0x2e')](_0x59866c[_0x58a2('0x28')]);_0x257131[_0x58a2('0x44')]=_[_0x58a2('0x2f')](_0x257131[_0x58a2('0x2d')],_0x257131[_0x58a2('0x28')]);_0x3c020e[_0x58a2('0x31')]=_[_0x58a2('0x2f')](_0x257131[_0x58a2('0x2d')],qs[_0x58a2('0x30')](_0x59866c['query']['fields']));_0x3c020e[_0x58a2('0x31')]=_0x3c020e[_0x58a2('0x31')][_0x58a2('0x40')]?_0x3c020e[_0x58a2('0x31')]:_0x257131[_0x58a2('0x2d')];_0x3c020e[_0x58a2('0x42')]=qs[_0x58a2('0x43')](_0x59866c[_0x58a2('0x28')]['sort']);_0x3c020e[_0x58a2('0x26')]=qs['filters'](_[_0x58a2('0x45')](_0x59866c['query'],_0x257131[_0x58a2('0x44')]));if(_0x59866c[_0x58a2('0x28')]['filter']){_0x3c020e['where']=_[_0x58a2('0x32')](_0x3c020e['where'],{'$or':_[_0x58a2('0x1f')](_0x3c020e[_0x58a2('0x31')],function(_0x5cbfb){var _0xe08006={};_0xe08006[_0x5cbfb]={'$like':'%'+_0x59866c['query'][_0x58a2('0x50')]+'%'};return _0xe08006;})});}_0x3c020e=_[_0x58a2('0x32')]({},_0x3c020e,_0x59866c[_0x58a2('0x33')]);return _0x28f0d7[_0x58a2('0x72')](_0x3c020e);}})[_0x58a2('0x15')](function(_0x5dc26c){if(_0x5dc26c){_0x3e3757=_0x5dc26c[_0x58a2('0x40')];if(!_0x59866c[_0x58a2('0x28')]['hasOwnProperty'](_0x58a2('0x41'))){_0x3c020e[_0x58a2('0x13')]=qs[_0x58a2('0x13')](_0x59866c['query']['limit']);_0x3c020e[_0x58a2('0x10')]=qs[_0x58a2('0x10')](_0x59866c[_0x58a2('0x28')][_0x58a2('0x10')]);}return _0x28f0d7[_0x58a2('0x72')](_0x3c020e);}})[_0x58a2('0x15')](function(_0x2fb75c){if(_0x2fb75c){return _0x2fb75c?{'count':_0x3e3757,'rows':_0x2fb75c}:null;}})[_0x58a2('0x15')](respondWithResult(_0x49f3e0,null))['catch'](handleError(_0x49f3e0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e889d14..c2972a2 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 _0xa33b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa33b,0x68));var _0xba33=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xa33b[_0x565c49];return _0x20ca34;};'use strict';var EventEmitter=require(_0xba33('0x0'));var ChatQueue=require(_0xba33('0x1'))['db'][_0xba33('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xba33('0x3')](0x0);var events={'afterCreate':_0xba33('0x4'),'afterUpdate':_0xba33('0x5'),'afterDestroy':_0xba33('0x6')};function emitEvent(_0x289106){return function(_0x24c0ea,_0x5cc658,_0x296b61){ChatQueueEvents['emit'](_0x289106+':'+_0x24c0ea['id'],_0x24c0ea);ChatQueueEvents[_0xba33('0x7')](_0x289106,_0x24c0ea);_0x296b61(null);};}for(var e in events){if(events[_0xba33('0x8')](e)){var event=events[e];ChatQueue[_0xba33('0x9')](e,emitEvent(event));}}module[_0xba33('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xa001=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x2f8cd9,_0x3c07da){var _0x21554b=function(_0x10e2d5){while(--_0x10e2d5){_0x2f8cd9['push'](_0x2f8cd9['shift']());}};_0x21554b(++_0x3c07da);}(_0xa001,0x93));var _0x1a00=function(_0xdf58ed,_0x1de90e){_0xdf58ed=_0xdf58ed-0x0;var _0x374120=_0xa001[_0xdf58ed];return _0x374120;};'use strict';var EventEmitter=require(_0x1a00('0x0'));var ChatQueue=require(_0x1a00('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1a00('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a00('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50afe8){return function(_0x52b9df,_0x17d4e9,_0x4ca9cc){ChatQueueEvents[_0x1a00('0x4')](_0x50afe8+':'+_0x52b9df['id'],_0x52b9df);ChatQueueEvents['emit'](_0x50afe8,_0x52b9df);_0x4ca9cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1a00('0x5')](e,emitEvent(event));}}module[_0x1a00('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6be0aee..069bb88 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 _0xae72=['./chatQueue.attributes','define','ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae72,0x121));var _0x2ae7=function(_0x546261,_0x44b70f){_0x546261=_0x546261-0x0;var _0x1c6263=_0xae72[_0x546261];return _0x1c6263;};'use strict';var _=require(_0x2ae7('0x0'));var util=require(_0x2ae7('0x1'));var logger=require(_0x2ae7('0x2'))(_0x2ae7('0x3'));var moment=require(_0x2ae7('0x4'));var BPromise=require(_0x2ae7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ae7('0x6'));var rimraf=require('rimraf');var config=require(_0x2ae7('0x7'));var attributes=require(_0x2ae7('0x8'));module['exports']=function(_0x704d5,_0x772274){return _0x704d5[_0x2ae7('0x9')](_0x2ae7('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc791=['chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc791,0x1e1));var _0x1c79=function(_0x27c741,_0x4bab7c){_0x27c741=_0x27c741-0x0;var _0x353e2b=_0xc791[_0x27c741];return _0x353e2b;};'use strict';var _=require(_0x1c79('0x0'));var util=require(_0x1c79('0x1'));var logger=require('../../config/logger')(_0x1c79('0x2'));var moment=require(_0x1c79('0x3'));var BPromise=require(_0x1c79('0x4'));var rp=require(_0x1c79('0x5'));var fs=require('fs');var path=require(_0x1c79('0x6'));var rimraf=require(_0x1c79('0x7'));var config=require(_0x1c79('0x8'));var attributes=require(_0x1c79('0x9'));module[_0x1c79('0xa')]=function(_0x3b50ec,_0x5d12a8){return _0x3b50ec['define']('ChatQueue',attributes,{'tableName':_0x1c79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 19a09cf..bd74cda 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 _0x8a2a=['result','catch','GetChatQueue','ChatQueue','findAll','options','raw','include','map','model','attributes','ShowChatQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x11c244,_0x1b1aa4){var _0x1c8d70=function(_0x386070){while(--_0x386070){_0x11c244['push'](_0x11c244['shift']());}};_0x1c8d70(++_0x1b1aa4);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8a2a[_0x403c20];return _0x2b271a;};'use strict';var _=require('lodash');var util=require(_0xa8a2('0x0'));var moment=require(_0xa8a2('0x1'));var BPromise=require(_0xa8a2('0x2'));var rs=require(_0xa8a2('0x3'));var fs=require('fs');var Redis=require(_0xa8a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8a2('0x5'));var logger=require(_0xa8a2('0x6'))(_0xa8a2('0x7'));var config=require(_0xa8a2('0x8'));var jayson=require(_0xa8a2('0x9'));var client=jayson[_0xa8a2('0xa')][_0xa8a2('0xb')]({'port':0x232a});config[_0xa8a2('0xc')]=_['defaults'](config[_0xa8a2('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa8a2('0xd'))[_0xa8a2('0xe')](socket);function respondWithRpcPromise(_0x33c48c,_0x59a522,_0x45702c){return new BPromise(function(_0x394813,_0x4624c4){return client[_0xa8a2('0xf')](_0x33c48c,_0x45702c)[_0xa8a2('0x10')](function(_0x28ab32){logger['info'](_0xa8a2('0x11'),_0x59a522,_0xa8a2('0x12'));logger[_0xa8a2('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x59a522,_0xa8a2('0x12'),JSON[_0xa8a2('0x14')](_0x28ab32));if(_0x28ab32[_0xa8a2('0x15')]){if(_0x28ab32[_0xa8a2('0x15')][_0xa8a2('0x16')]===0x1f4){logger[_0xa8a2('0x15')](_0xa8a2('0x11'),_0x59a522,_0x28ab32['error'][_0xa8a2('0x17')]);return _0x4624c4(_0x28ab32[_0xa8a2('0x15')][_0xa8a2('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x59a522,_0x28ab32[_0xa8a2('0x15')][_0xa8a2('0x17')]);return _0x394813(_0x28ab32[_0xa8a2('0x15')][_0xa8a2('0x17')]);}else{logger[_0xa8a2('0x18')](_0xa8a2('0x11'),_0x59a522,_0xa8a2('0x12'));_0x394813(_0x28ab32[_0xa8a2('0x19')]['message']);}})[_0xa8a2('0x1a')](function(_0x391f87){logger[_0xa8a2('0x15')]('ChatQueue,\x20%s,\x20%s',_0x59a522,_0x391f87);_0x4624c4(_0x391f87);});});}exports[_0xa8a2('0x1b')]=function(_0x1b33dd){var _0x10aa02=this;return new Promise(function(_0x30ee45,_0x4cb363){return db[_0xa8a2('0x1c')][_0xa8a2('0x1d')]({'raw':_0x1b33dd[_0xa8a2('0x1e')]?_0x1b33dd[_0xa8a2('0x1e')][_0xa8a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b33dd[_0xa8a2('0x1e')]?_0x1b33dd[_0xa8a2('0x1e')]['where']||null:null,'attributes':_0x1b33dd[_0xa8a2('0x1e')]?_0x1b33dd[_0xa8a2('0x1e')]['attributes']||null:null,'limit':_0x1b33dd[_0xa8a2('0x1e')]?_0x1b33dd[_0xa8a2('0x1e')]['limit']||null:null,'include':_0x1b33dd['options']?_0x1b33dd['options'][_0xa8a2('0x20')]?_[_0xa8a2('0x21')](_0x1b33dd[_0xa8a2('0x1e')][_0xa8a2('0x20')],function(_0x293786){return{'model':db[_0x293786[_0xa8a2('0x22')]],'as':_0x293786['as'],'attributes':_0x293786[_0xa8a2('0x23')],'include':_0x293786[_0xa8a2('0x20')]?_['map'](_0x293786['include'],function(_0x4aeec1){return{'model':db[_0x4aeec1[_0xa8a2('0x22')]],'as':_0x4aeec1['as'],'attributes':_0x4aeec1[_0xa8a2('0x23')],'include':_0x4aeec1[_0xa8a2('0x20')]?_[_0xa8a2('0x21')](_0x4aeec1[_0xa8a2('0x20')],function(_0x49a4c5){return{'model':db[_0x49a4c5[_0xa8a2('0x22')]],'as':_0x49a4c5['as'],'attributes':_0x49a4c5[_0xa8a2('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa8a2('0x10')](function(_0x4b6d3b){logger['info']('GetChatQueue',_0x1b33dd);logger[_0xa8a2('0x13')]('GetChatQueue',_0x1b33dd,JSON[_0xa8a2('0x14')](_0x4b6d3b));_0x30ee45(_0x4b6d3b);})[_0xa8a2('0x1a')](function(_0x266076){logger[_0xa8a2('0x15')]('GetChatQueue',_0x266076[_0xa8a2('0x17')],_0x1b33dd);_0x4cb363(_0x10aa02[_0xa8a2('0x15')](0x1f4,_0x266076[_0xa8a2('0x17')]));});});};exports[_0xa8a2('0x24')]=function(_0x2fa1a4){var _0x2381dd=this;return new Promise(function(_0x303222,_0x426f26){return db[_0xa8a2('0x1c')][_0xa8a2('0x25')]({'raw':_0x2fa1a4[_0xa8a2('0x1e')]?_0x2fa1a4[_0xa8a2('0x1e')][_0xa8a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fa1a4['options']?_0x2fa1a4[_0xa8a2('0x1e')][_0xa8a2('0x26')]||null:null,'attributes':_0x2fa1a4['options']?_0x2fa1a4[_0xa8a2('0x1e')][_0xa8a2('0x23')]||null:null,'include':_0x2fa1a4['options']?_0x2fa1a4[_0xa8a2('0x1e')][_0xa8a2('0x20')]?_[_0xa8a2('0x21')](_0x2fa1a4[_0xa8a2('0x1e')][_0xa8a2('0x20')],function(_0x5dc00e){return{'model':db[_0x5dc00e[_0xa8a2('0x22')]],'as':_0x5dc00e['as'],'attributes':_0x5dc00e[_0xa8a2('0x23')],'include':_0x5dc00e['include']?_[_0xa8a2('0x21')](_0x5dc00e['include'],function(_0x5c1b1f){return{'model':db[_0x5c1b1f[_0xa8a2('0x22')]],'as':_0x5c1b1f['as'],'attributes':_0x5c1b1f[_0xa8a2('0x23')],'include':_0x5c1b1f[_0xa8a2('0x20')]?_[_0xa8a2('0x21')](_0x5c1b1f['include'],function(_0x4a0bf4){return{'model':db[_0x4a0bf4['model']],'as':_0x4a0bf4['as'],'attributes':_0x4a0bf4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa8a2('0x10')](function(_0x1a68aa){logger[_0xa8a2('0x18')](_0xa8a2('0x24'),_0x2fa1a4);logger[_0xa8a2('0x13')](_0xa8a2('0x24'),_0x2fa1a4,JSON['stringify'](_0x1a68aa));_0x303222(_0x1a68aa);})[_0xa8a2('0x1a')](function(_0x46df49){logger[_0xa8a2('0x15')](_0xa8a2('0x24'),_0x46df49[_0xa8a2('0x17')],_0x2fa1a4);_0x426f26(_0x2381dd[_0xa8a2('0x15')](0x1f4,_0x46df49['message']));});});}; \ No newline at end of file +var _0x404d=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','find','ShowChatQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x34273d,_0x4cee59){var _0xd7efeb=function(_0x1491c0){while(--_0x1491c0){_0x34273d['push'](_0x34273d['shift']());}};_0xd7efeb(++_0x4cee59);}(_0x404d,0x1e9));var _0xd404=function(_0x4a652a,_0x20a238){_0x4a652a=_0x4a652a-0x0;var _0x13a67e=_0x404d[_0x4a652a];return _0x13a67e;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});config[_0xd404('0xc')]=_['defaults'](config['redis'],{'host':_0xd404('0xd'),'port':0x18eb});var socket=require(_0xd404('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xd404('0xf')](socket);function respondWithRpcPromise(_0x1b99d2,_0x3a1a89,_0xb018fc){return new BPromise(function(_0x5d3faf,_0x4b60f2){return client[_0xd404('0x10')](_0x1b99d2,_0xb018fc)[_0xd404('0x11')](function(_0x569542){logger[_0xd404('0x12')](_0xd404('0x13'),_0x3a1a89,_0xd404('0x14'));logger[_0xd404('0x15')](_0xd404('0x16'),_0x3a1a89,_0xd404('0x14'),JSON[_0xd404('0x17')](_0x569542));if(_0x569542[_0xd404('0x18')]){if(_0x569542[_0xd404('0x18')][_0xd404('0x19')]===0x1f4){logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);return _0x4b60f2(_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);}logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x569542[_0xd404('0x18')][_0xd404('0x1a')]);return _0x5d3faf(_0x569542[_0xd404('0x18')]['message']);}else{logger[_0xd404('0x12')](_0xd404('0x13'),_0x3a1a89,'request\x20sent');_0x5d3faf(_0x569542[_0xd404('0x1b')][_0xd404('0x1a')]);}})['catch'](function(_0x209a6b){logger[_0xd404('0x18')](_0xd404('0x13'),_0x3a1a89,_0x209a6b);_0x4b60f2(_0x209a6b);});});}exports['GetChatQueue']=function(_0x2fd888){var _0x399a06=this;return new Promise(function(_0x27d9a1,_0x3e8183){return db[_0xd404('0x1c')][_0xd404('0x1d')]({'raw':_0x2fd888[_0xd404('0x1e')]?_0x2fd888['options'][_0xd404('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fd888[_0xd404('0x1e')]?_0x2fd888['options'][_0xd404('0x20')]||null:null,'attributes':_0x2fd888['options']?_0x2fd888['options'][_0xd404('0x21')]||null:null,'limit':_0x2fd888[_0xd404('0x1e')]?_0x2fd888[_0xd404('0x1e')][_0xd404('0x22')]||null:null,'include':_0x2fd888['options']?_0x2fd888[_0xd404('0x1e')][_0xd404('0x23')]?_[_0xd404('0x24')](_0x2fd888['options']['include'],function(_0x3e706a){return{'model':db[_0x3e706a[_0xd404('0x25')]],'as':_0x3e706a['as'],'attributes':_0x3e706a[_0xd404('0x21')],'include':_0x3e706a[_0xd404('0x23')]?_[_0xd404('0x24')](_0x3e706a[_0xd404('0x23')],function(_0x256277){return{'model':db[_0x256277[_0xd404('0x25')]],'as':_0x256277['as'],'attributes':_0x256277['attributes'],'include':_0x256277['include']?_[_0xd404('0x24')](_0x256277['include'],function(_0x2b14ec){return{'model':db[_0x2b14ec['model']],'as':_0x2b14ec['as'],'attributes':_0x2b14ec[_0xd404('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd404('0x11')](function(_0x3e746e){logger[_0xd404('0x12')](_0xd404('0x26'),_0x2fd888);logger[_0xd404('0x15')](_0xd404('0x26'),_0x2fd888,JSON['stringify'](_0x3e746e));_0x27d9a1(_0x3e746e);})['catch'](function(_0xc60d87){logger['error']('GetChatQueue',_0xc60d87[_0xd404('0x1a')],_0x2fd888);_0x3e8183(_0x399a06[_0xd404('0x18')](0x1f4,_0xc60d87[_0xd404('0x1a')]));});});};exports['ShowChatQueue']=function(_0x63430e){var _0x54f0c5=this;return new Promise(function(_0x2ee9b3,_0x1de7b9){return db['ChatQueue'][_0xd404('0x27')]({'raw':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')][_0xd404('0x1f')]===undefined?!![]:![]:!![],'where':_0x63430e[_0xd404('0x1e')]?_0x63430e['options'][_0xd404('0x20')]||null:null,'attributes':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')]['attributes']||null:null,'include':_0x63430e[_0xd404('0x1e')]?_0x63430e[_0xd404('0x1e')][_0xd404('0x23')]?_[_0xd404('0x24')](_0x63430e['options']['include'],function(_0x2551b5){return{'model':db[_0x2551b5[_0xd404('0x25')]],'as':_0x2551b5['as'],'attributes':_0x2551b5[_0xd404('0x21')],'include':_0x2551b5[_0xd404('0x23')]?_[_0xd404('0x24')](_0x2551b5[_0xd404('0x23')],function(_0x50d8ef){return{'model':db[_0x50d8ef[_0xd404('0x25')]],'as':_0x50d8ef['as'],'attributes':_0x50d8ef[_0xd404('0x21')],'include':_0x50d8ef[_0xd404('0x23')]?_['map'](_0x50d8ef[_0xd404('0x23')],function(_0x2e0786){return{'model':db[_0x2e0786[_0xd404('0x25')]],'as':_0x2e0786['as'],'attributes':_0x2e0786['attributes']};}):[]};}):[]};}):[]:[]})[_0xd404('0x11')](function(_0x21111e){logger[_0xd404('0x12')]('ShowChatQueue',_0x63430e);logger[_0xd404('0x15')](_0xd404('0x28'),_0x63430e,JSON['stringify'](_0x21111e));_0x2ee9b3(_0x21111e);})[_0xd404('0x29')](function(_0x128da0){logger[_0xd404('0x18')](_0xd404('0x28'),_0x128da0[_0xd404('0x1a')],_0x63430e);_0x1de7b9(_0x54f0c5[_0xd404('0x18')](0x1f4,_0x128da0[_0xd404('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9f03e87..c534b3b 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 _0x0ba7=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x42567e,_0x55f60f){var _0x2ee88b=function(_0x558ef0){while(--_0x558ef0){_0x42567e['push'](_0x42567e['shift']());}};_0x2ee88b(++_0x55f60f);}(_0x0ba7,0x16d));var _0x70ba=function(_0x92f0d8,_0x191821){_0x92f0d8=_0x92f0d8-0x0;var _0x4674fe=_0x0ba7[_0x92f0d8];return _0x4674fe;};'use strict';var ChatQueueEvents=require(_0x70ba('0x0'));var events=['save',_0x70ba('0x1'),_0x70ba('0x2')];function createListener(_0xadfc69,_0x42d93c){return function(_0x5e5368){_0x42d93c[_0x70ba('0x3')](_0xadfc69,_0x5e5368);};}function removeListener(_0x3e20ab,_0x3cb2e3){return function(){ChatQueueEvents[_0x70ba('0x4')](_0x3e20ab,_0x3cb2e3);};}exports[_0x70ba('0x5')]=function(_0x3f9877){for(var _0x17a00c=0x0,_0x2d5a16=events[_0x70ba('0x6')];_0x17a00c<_0x2d5a16;_0x17a00c++){var _0x1185cb=events[_0x17a00c];var _0x1a968b=createListener(_0x70ba('0x7')+_0x1185cb,_0x3f9877);ChatQueueEvents['on'](_0x1185cb,_0x1a968b);}}; \ No newline at end of file +var _0x9b9b=['save','emit','removeListener','register','length','chatQueue:'];(function(_0x43a327,_0xb19748){var _0x4a6d7e=function(_0x219643){while(--_0x219643){_0x43a327['push'](_0x43a327['shift']());}};_0x4a6d7e(++_0xb19748);}(_0x9b9b,0x114));var _0xb9b9=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x9b9b[_0x2675da];return _0x5e6153;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xb9b9('0x0'),'remove','update'];function createListener(_0x2ae8a0,_0x153734){return function(_0x1adf50){_0x153734[_0xb9b9('0x1')](_0x2ae8a0,_0x1adf50);};}function removeListener(_0x1d6ab6,_0x43c8ff){return function(){ChatQueueEvents[_0xb9b9('0x2')](_0x1d6ab6,_0x43c8ff);};}exports[_0xb9b9('0x3')]=function(_0x79dd){for(var _0x3d1a95=0x0,_0x85eec=events[_0xb9b9('0x4')];_0x3d1a95<_0x85eec;_0x3d1a95++){var _0x5be5bc=events[_0x3d1a95];var _0x297cb6=createListener(_0xb9b9('0x5')+_0x5be5bc,_0x79dd);ChatQueueEvents['on'](_0x5be5bc,_0x297cb6);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 16e0094..64f9ed1 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x21f151,_0xea1bc3){_0x21f151=_0x21f151-0x0;var _0x33f986=_0x3e74[_0x21f151];return _0x33f986;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x935c9c,_0x56f0b7){var _0x10dfad=function(_0x54af8e){while(--_0x54af8e){_0x935c9c['push'](_0x935c9c['shift']());}};_0x10dfad(++_0x56f0b7);}(_0x55ca,0x126));var _0xa55c=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x55ca[_0x3b2369];return _0x5a1367;};'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 fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 412b5d5..289d7ae 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 _0xc46f=['exports','DATE','moment'];(function(_0x205401,_0x3832c4){var _0x569ec1=function(_0x21d59f){while(--_0x21d59f){_0x205401['push'](_0x205401['shift']());}};_0x569ec1(++_0x3832c4);}(_0xc46f,0x158));var _0xfc46=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc46f[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0xfc46('0x0'));var Sequelize=require('sequelize');module[_0xfc46('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfc46('0x2')]},'leaveAt':{'type':Sequelize[_0xfc46('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfc46('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c19=['exports','STRING','DATE','moment','sequelize'];(function(_0x591875,_0x195f1d){var _0x51778e=function(_0x3c28b0){while(--_0x3c28b0){_0x591875['push'](_0x591875['shift']());}};_0x51778e(++_0x195f1d);}(_0x2c19,0x17a));var _0x92c1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2c19[_0x2b4411];return _0x8e41ef;};'use strict';var moment=require(_0x92c1('0x0'));var Sequelize=require(_0x92c1('0x1'));module[_0x92c1('0x2')]={'uniqueid':{'type':Sequelize[_0x92c1('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x92c1('0x4')]},'acceptAt':{'type':Sequelize[_0x92c1('0x4')]},'exitAt':{'type':Sequelize[_0x92c1('0x4')]},'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 13638b0..d423ad8 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 _0x15b2=['limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','ChatQueueReport','rawAttributes','fieldName','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','merge','map','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','model','intersection','options','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x15b2,0x145));var _0x215b=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x15b2[_0x15dbca];return _0x326533;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x215b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x215b('0x1'));var rp=require(_0x215b('0x2'));var moment=require('moment');var BPromise=require(_0x215b('0x3'));var Mustache=require(_0x215b('0x4'));var util=require(_0x215b('0x5'));var path=require(_0x215b('0x6'));var sox=require('sox');var csv=require(_0x215b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x215b('0x8'));var _=require(_0x215b('0x9'));var squel=require(_0x215b('0xa'));var crypto=require(_0x215b('0xb'));var jsforce=require(_0x215b('0xc'));var deskjs=require(_0x215b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x215b('0xe'));var Papa=require(_0x215b('0xf'));var Redis=require('ioredis');var authService=require(_0x215b('0x10'));var qs=require(_0x215b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x215b('0x12'))('api');var utils=require(_0x215b('0x13'));var config=require(_0x215b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x215b('0x15'))['db'];function respondWithStatusCode(_0x49a9cc,_0x4a9360){_0x4a9360=_0x4a9360||0xcc;return function(_0x1cf40c){if(_0x1cf40c){return _0x49a9cc['sendStatus'](_0x4a9360);}return _0x49a9cc[_0x215b('0x16')](_0x4a9360)['end']();};}function respondWithResult(_0x2aa945,_0xc1d4d1){_0xc1d4d1=_0xc1d4d1||0xc8;return function(_0x38d765){if(_0x38d765){return _0x2aa945['status'](_0xc1d4d1)['json'](_0x38d765);}};}function respondWithFilteredResult(_0x4c39d1,_0x1006fe){return function(_0x1c4030){if(_0x1c4030){var _0x2d04cb=typeof _0x1006fe[_0x215b('0x17')]===_0x215b('0x18')&&typeof _0x1006fe[_0x215b('0x19')]===_0x215b('0x18');var _0x4a27aa=_0x1c4030[_0x215b('0x1a')];var _0x2ca496=_0x2d04cb?0x0:_0x1006fe[_0x215b('0x17')];var _0x37248f=_0x2d04cb?_0x1c4030[_0x215b('0x1a')]:_0x1006fe[_0x215b('0x17')]+_0x1006fe[_0x215b('0x19')];var _0x2a1921;if(_0x37248f>=_0x4a27aa){_0x37248f=_0x4a27aa;_0x2a1921=0xc8;}else{_0x2a1921=0xce;}_0x4c39d1['status'](_0x2a1921);return _0x4c39d1['set'](_0x215b('0x1b'),_0x2ca496+'-'+_0x37248f+'/'+_0x4a27aa)['json'](_0x1c4030);}return null;};}function patchUpdates(_0x16732d){return function(_0xac9792){try{jsonpatch[_0x215b('0x1c')](_0xac9792,_0x16732d,!![]);}catch(_0x303c89){return BPromise[_0x215b('0x1d')](_0x303c89);}return _0xac9792[_0x215b('0x1e')]();};}function saveUpdates(_0x7e413c,_0x1a41c0){return function(_0x5cce5d){if(_0x5cce5d){return _0x5cce5d['update'](_0x7e413c)[_0x215b('0x1f')](function(_0x515a5c){return _0x515a5c;});}return null;};}function removeEntity(_0x24386b,_0x267af9){return function(_0x48568a){if(_0x48568a){return _0x48568a[_0x215b('0x20')]()['then'](function(){_0x24386b[_0x215b('0x16')](0xcc)[_0x215b('0x21')]();});}};}function handleEntityNotFound(_0x1b7c12,_0x245a36){return function(_0x1f30b1){if(!_0x1f30b1){_0x1b7c12[_0x215b('0x22')](0x194);}return _0x1f30b1;};}function handleError(_0x29c05e,_0x19fc6f){_0x19fc6f=_0x19fc6f||0x1f4;return function(_0x49dc3d){logger[_0x215b('0x23')](_0x49dc3d[_0x215b('0x24')]);if(_0x49dc3d['name']){delete _0x49dc3d[_0x215b('0x25')];}_0x29c05e[_0x215b('0x16')](_0x19fc6f)[_0x215b('0x26')](_0x49dc3d);};}exports['index']=function(_0x23ffca,_0x41b373){var _0x1471a9={},_0x2038d9={},_0x8dea4c={'count':0x0,'rows':[]};var _0xca5e4a=_['map'](db[_0x215b('0x27')][_0x215b('0x28')],function(_0x1f59dc){return{'name':_0x1f59dc[_0x215b('0x29')],'type':_0x1f59dc['type']['key']};});_0x2038d9['model']=_['map'](_0xca5e4a,'name');_0x2038d9[_0x215b('0x2a')]=_[_0x215b('0x2b')](_0x23ffca[_0x215b('0x2a')]);_0x2038d9[_0x215b('0x2c')]=_['intersection'](_0x2038d9['model'],_0x2038d9['query']);_0x1471a9[_0x215b('0x2d')]=_['intersection'](_0x2038d9['model'],qs[_0x215b('0x2e')](_0x23ffca[_0x215b('0x2a')][_0x215b('0x2e')]));_0x1471a9['attributes']=_0x1471a9[_0x215b('0x2d')][_0x215b('0x2f')]?_0x1471a9['attributes']:_0x2038d9['model'];if(!_0x23ffca[_0x215b('0x2a')]['hasOwnProperty'](_0x215b('0x30'))){_0x1471a9['limit']=qs['limit'](_0x23ffca[_0x215b('0x2a')][_0x215b('0x19')]);_0x1471a9[_0x215b('0x17')]=qs['offset'](_0x23ffca[_0x215b('0x2a')]['offset']);}_0x1471a9['order']=qs[_0x215b('0x31')](_0x23ffca[_0x215b('0x2a')][_0x215b('0x31')]);_0x1471a9[_0x215b('0x32')]=qs[_0x215b('0x2c')](_[_0x215b('0x33')](_0x23ffca['query'],_0x2038d9[_0x215b('0x2c')]),_0xca5e4a);if(_0x23ffca[_0x215b('0x2a')]['filter']){_0x1471a9[_0x215b('0x32')]=_[_0x215b('0x34')](_0x1471a9[_0x215b('0x32')],{'$or':_[_0x215b('0x35')](_0xca5e4a,function(_0x48ecbc){if(_0x48ecbc[_0x215b('0x36')]!==_0x215b('0x37')){var _0x365373={};_0x365373[_0x48ecbc[_0x215b('0x25')]]={'$like':'%'+_0x23ffca[_0x215b('0x2a')][_0x215b('0x38')]+'%'};return _0x365373;}})});}_0x1471a9=_['merge']({},_0x1471a9,_0x23ffca['options']);var _0xae3e16={'where':_0x1471a9[_0x215b('0x32')]};return db['ChatQueueReport'][_0x215b('0x1a')](_0xae3e16)[_0x215b('0x1f')](function(_0x1cf253){_0x8dea4c['count']=_0x1cf253;if(_0x23ffca[_0x215b('0x2a')][_0x215b('0x39')]){_0x1471a9[_0x215b('0x3a')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x215b('0x3b')](_0x1471a9);})['then'](function(_0x5b366d){_0x8dea4c[_0x215b('0x3c')]=_0x5b366d;return _0x8dea4c;})[_0x215b('0x1f')](respondWithFilteredResult(_0x41b373,_0x1471a9))[_0x215b('0x3d')](handleError(_0x41b373,null));};exports['show']=function(_0xa8f48e,_0x20908e){var _0x782816={'raw':!![],'where':{'id':_0xa8f48e['params']['id']}},_0x20e51c={};_0x20e51c[_0x215b('0x3e')]=_[_0x215b('0x2b')](db[_0x215b('0x27')][_0x215b('0x28')]);_0x20e51c[_0x215b('0x2a')]=_['keys'](_0xa8f48e[_0x215b('0x2a')]);_0x20e51c['filters']=_[_0x215b('0x3f')](_0x20e51c['model'],_0x20e51c[_0x215b('0x2a')]);_0x782816[_0x215b('0x2d')]=_[_0x215b('0x3f')](_0x20e51c[_0x215b('0x3e')],qs[_0x215b('0x2e')](_0xa8f48e['query']['fields']));_0x782816[_0x215b('0x2d')]=_0x782816['attributes'][_0x215b('0x2f')]?_0x782816[_0x215b('0x2d')]:_0x20e51c[_0x215b('0x3e')];if(_0xa8f48e[_0x215b('0x2a')]['includeAll']){_0x782816[_0x215b('0x3a')]=[{'all':!![]}];}_0x782816=_[_0x215b('0x34')]({},_0x782816,_0xa8f48e[_0x215b('0x40')]);return db['ChatQueueReport'][_0x215b('0x41')](_0x782816)[_0x215b('0x1f')](handleEntityNotFound(_0x20908e,null))[_0x215b('0x1f')](respondWithResult(_0x20908e,null))[_0x215b('0x3d')](handleError(_0x20908e,null));};exports['create']=function(_0x42e026,_0x5230de){return db[_0x215b('0x27')][_0x215b('0x42')](_0x42e026['body'],{})[_0x215b('0x1f')](respondWithResult(_0x5230de,0xc9))[_0x215b('0x3d')](handleError(_0x5230de,null));};exports['update']=function(_0x533571,_0x3ee566){if(_0x533571[_0x215b('0x43')]['id']){delete _0x533571[_0x215b('0x43')]['id'];}return db['ChatQueueReport'][_0x215b('0x41')]({'where':{'id':_0x533571[_0x215b('0x44')]['id']}})[_0x215b('0x1f')](handleEntityNotFound(_0x3ee566,null))[_0x215b('0x1f')](saveUpdates(_0x533571['body'],null))[_0x215b('0x1f')](respondWithResult(_0x3ee566,null))['catch'](handleError(_0x3ee566,null));};exports[_0x215b('0x20')]=function(_0xf6517b,_0x3a0df2){return db['ChatQueueReport'][_0x215b('0x41')]({'where':{'id':_0xf6517b[_0x215b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a0df2,null))['then'](removeEntity(_0x3a0df2,null))[_0x215b('0x3d')](handleError(_0x3a0df2,null));};exports[_0x215b('0x45')]=function(_0x4fb7f7,_0x389f34){return db[_0x215b('0x27')][_0x215b('0x45')]()[_0x215b('0x1f')](respondWithResult(_0x389f34,null))[_0x215b('0x3d')](handleError(_0x389f34,null));}; \ No newline at end of file +var _0x00cd=['find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params'];(function(_0x37aece,_0xdbfe91){var _0x34dd0b=function(_0x4533ec){while(--_0x4533ec){_0x37aece['push'](_0x37aece['shift']());}};_0x34dd0b(++_0xdbfe91);}(_0x00cd,0xee));var _0xd00c=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x00cd[_0x16a223];return _0x5ded66;};'use strict';var emlformat=require(_0xd00c('0x0'));var rimraf=require(_0xd00c('0x1'));var zipdir=require(_0xd00c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd00c('0x3'));var BPromise=require(_0xd00c('0x4'));var Mustache=require(_0xd00c('0x5'));var util=require(_0xd00c('0x6'));var path=require(_0xd00c('0x7'));var sox=require('sox');var csv=require(_0xd00c('0x8'));var ejs=require(_0xd00c('0x9'));var fs=require('fs');var fs_extra=require(_0xd00c('0xa'));var _=require(_0xd00c('0xb'));var squel=require(_0xd00c('0xc'));var crypto=require(_0xd00c('0xd'));var jsforce=require(_0xd00c('0xe'));var deskjs=require(_0xd00c('0xf'));var toCsv=require(_0xd00c('0x8'));var querystring=require(_0xd00c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd00c('0x11'));var qs=require(_0xd00c('0x12'));var as=require(_0xd00c('0x13'));var hardwareService=require(_0xd00c('0x14'));var logger=require('../../config/logger')(_0xd00c('0x15'));var utils=require('../../config/utils');var config=require(_0xd00c('0x16'));var licenseUtil=require(_0xd00c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49238e,_0x51f391){_0x51f391=_0x51f391||0xcc;return function(_0x4afd7d){if(_0x4afd7d){return _0x49238e[_0xd00c('0x18')](_0x51f391);}return _0x49238e[_0xd00c('0x19')](_0x51f391)[_0xd00c('0x1a')]();};}function respondWithResult(_0x4c0c0f,_0x24c12b){_0x24c12b=_0x24c12b||0xc8;return function(_0x5ed7e7){if(_0x5ed7e7){return _0x4c0c0f[_0xd00c('0x19')](_0x24c12b)[_0xd00c('0x1b')](_0x5ed7e7);}};}function respondWithFilteredResult(_0x3dc54d,_0x4a52b0){return function(_0x50b22e){if(_0x50b22e){var _0x41f67c=typeof _0x4a52b0[_0xd00c('0x1c')]===_0xd00c('0x1d')&&typeof _0x4a52b0[_0xd00c('0x1e')]===_0xd00c('0x1d');var _0x2a5531=_0x50b22e[_0xd00c('0x1f')];var _0x3864a9=_0x41f67c?0x0:_0x4a52b0['offset'];var _0x2b167a=_0x41f67c?_0x50b22e[_0xd00c('0x1f')]:_0x4a52b0[_0xd00c('0x1c')]+_0x4a52b0['limit'];var _0x541174;if(_0x2b167a>=_0x2a5531){_0x2b167a=_0x2a5531;_0x541174=0xc8;}else{_0x541174=0xce;}_0x3dc54d[_0xd00c('0x19')](_0x541174);return _0x3dc54d[_0xd00c('0x20')](_0xd00c('0x21'),_0x3864a9+'-'+_0x2b167a+'/'+_0x2a5531)[_0xd00c('0x1b')](_0x50b22e);}return null;};}function patchUpdates(_0xbced81){return function(_0x40a352){try{jsonpatch[_0xd00c('0x22')](_0x40a352,_0xbced81,!![]);}catch(_0x4ef9f8){return BPromise[_0xd00c('0x23')](_0x4ef9f8);}return _0x40a352[_0xd00c('0x24')]();};}function saveUpdates(_0x3a0b2f,_0x3807fb){return function(_0x10d08d){if(_0x10d08d){return _0x10d08d['update'](_0x3a0b2f)['then'](function(_0x27c892){return _0x27c892;});}return null;};}function removeEntity(_0x22b914,_0x5bcf19){return function(_0x4a6c84){if(_0x4a6c84){return _0x4a6c84['destroy']()[_0xd00c('0x25')](function(){_0x22b914['status'](0xcc)[_0xd00c('0x1a')]();});}};}function handleEntityNotFound(_0x4a918f,_0x25300a){return function(_0x276eef){if(!_0x276eef){_0x4a918f['sendStatus'](0x194);}return _0x276eef;};}function handleError(_0x4c78e9,_0x24f5c8){_0x24f5c8=_0x24f5c8||0x1f4;return function(_0x32e998){logger[_0xd00c('0x26')](_0x32e998[_0xd00c('0x27')]);if(_0x32e998['name']){delete _0x32e998[_0xd00c('0x28')];}_0x4c78e9[_0xd00c('0x19')](_0x24f5c8)[_0xd00c('0x29')](_0x32e998);};}exports[_0xd00c('0x2a')]=function(_0x4987c5,_0x17e58d){var _0x5bb7c4={},_0x3e7e2c={},_0x127a0b={'count':0x0,'rows':[]};var _0x291b71=_[_0xd00c('0x2b')](db[_0xd00c('0x2c')][_0xd00c('0x2d')],function(_0xbbbf0e){return{'name':_0xbbbf0e[_0xd00c('0x2e')],'type':_0xbbbf0e[_0xd00c('0x2f')][_0xd00c('0x30')]};});_0x3e7e2c[_0xd00c('0x31')]=_[_0xd00c('0x2b')](_0x291b71,_0xd00c('0x28'));_0x3e7e2c[_0xd00c('0x32')]=_[_0xd00c('0x33')](_0x4987c5[_0xd00c('0x32')]);_0x3e7e2c[_0xd00c('0x34')]=_[_0xd00c('0x35')](_0x3e7e2c['model'],_0x3e7e2c['query']);_0x5bb7c4[_0xd00c('0x36')]=_['intersection'](_0x3e7e2c[_0xd00c('0x31')],qs[_0xd00c('0x37')](_0x4987c5[_0xd00c('0x32')][_0xd00c('0x37')]));_0x5bb7c4[_0xd00c('0x36')]=_0x5bb7c4['attributes'][_0xd00c('0x38')]?_0x5bb7c4[_0xd00c('0x36')]:_0x3e7e2c['model'];if(!_0x4987c5[_0xd00c('0x32')][_0xd00c('0x39')](_0xd00c('0x3a'))){_0x5bb7c4[_0xd00c('0x1e')]=qs[_0xd00c('0x1e')](_0x4987c5[_0xd00c('0x32')]['limit']);_0x5bb7c4[_0xd00c('0x1c')]=qs['offset'](_0x4987c5[_0xd00c('0x32')]['offset']);}_0x5bb7c4['order']=qs['sort'](_0x4987c5[_0xd00c('0x32')][_0xd00c('0x3b')]);_0x5bb7c4[_0xd00c('0x3c')]=qs['filters'](_[_0xd00c('0x3d')](_0x4987c5[_0xd00c('0x32')],_0x3e7e2c[_0xd00c('0x34')]),_0x291b71);if(_0x4987c5['query'][_0xd00c('0x3e')]){_0x5bb7c4[_0xd00c('0x3c')]=_[_0xd00c('0x3f')](_0x5bb7c4[_0xd00c('0x3c')],{'$or':_[_0xd00c('0x2b')](_0x291b71,function(_0xfb7519){if(_0xfb7519[_0xd00c('0x2f')]!==_0xd00c('0x40')){var _0x1fdc4d={};_0x1fdc4d[_0xfb7519[_0xd00c('0x28')]]={'$like':'%'+_0x4987c5['query'][_0xd00c('0x3e')]+'%'};return _0x1fdc4d;}})});}_0x5bb7c4=_[_0xd00c('0x3f')]({},_0x5bb7c4,_0x4987c5['options']);var _0x1e565f={'where':_0x5bb7c4[_0xd00c('0x3c')]};return db['ChatQueueReport'][_0xd00c('0x1f')](_0x1e565f)[_0xd00c('0x25')](function(_0x3d31a7){_0x127a0b[_0xd00c('0x1f')]=_0x3d31a7;if(_0x4987c5[_0xd00c('0x32')][_0xd00c('0x41')]){_0x5bb7c4[_0xd00c('0x42')]=[{'all':!![]}];}return db[_0xd00c('0x2c')]['findAll'](_0x5bb7c4);})[_0xd00c('0x25')](function(_0x193117){_0x127a0b[_0xd00c('0x43')]=_0x193117;return _0x127a0b;})[_0xd00c('0x25')](respondWithFilteredResult(_0x17e58d,_0x5bb7c4))['catch'](handleError(_0x17e58d,null));};exports[_0xd00c('0x44')]=function(_0x6bcc79,_0x5b0b2b){var _0x923db0={'raw':!![],'where':{'id':_0x6bcc79[_0xd00c('0x45')]['id']}},_0x640a87={};_0x640a87['model']=_[_0xd00c('0x33')](db['ChatQueueReport']['rawAttributes']);_0x640a87[_0xd00c('0x32')]=_['keys'](_0x6bcc79[_0xd00c('0x32')]);_0x640a87[_0xd00c('0x34')]=_[_0xd00c('0x35')](_0x640a87[_0xd00c('0x31')],_0x640a87[_0xd00c('0x32')]);_0x923db0[_0xd00c('0x36')]=_[_0xd00c('0x35')](_0x640a87[_0xd00c('0x31')],qs[_0xd00c('0x37')](_0x6bcc79[_0xd00c('0x32')][_0xd00c('0x37')]));_0x923db0['attributes']=_0x923db0[_0xd00c('0x36')][_0xd00c('0x38')]?_0x923db0[_0xd00c('0x36')]:_0x640a87['model'];if(_0x6bcc79[_0xd00c('0x32')][_0xd00c('0x41')]){_0x923db0['include']=[{'all':!![]}];}_0x923db0=_['merge']({},_0x923db0,_0x6bcc79['options']);return db[_0xd00c('0x2c')][_0xd00c('0x46')](_0x923db0)[_0xd00c('0x25')](handleEntityNotFound(_0x5b0b2b,null))[_0xd00c('0x25')](respondWithResult(_0x5b0b2b,null))[_0xd00c('0x47')](handleError(_0x5b0b2b,null));};exports[_0xd00c('0x48')]=function(_0x3bc7e6,_0x1efbda){return db['ChatQueueReport'][_0xd00c('0x48')](_0x3bc7e6[_0xd00c('0x49')],{})[_0xd00c('0x25')](respondWithResult(_0x1efbda,0xc9))[_0xd00c('0x47')](handleError(_0x1efbda,null));};exports[_0xd00c('0x4a')]=function(_0x207cbc,_0x20ed7c){if(_0x207cbc[_0xd00c('0x49')]['id']){delete _0x207cbc[_0xd00c('0x49')]['id'];}return db[_0xd00c('0x2c')][_0xd00c('0x46')]({'where':{'id':_0x207cbc[_0xd00c('0x45')]['id']}})[_0xd00c('0x25')](handleEntityNotFound(_0x20ed7c,null))[_0xd00c('0x25')](saveUpdates(_0x207cbc['body'],null))[_0xd00c('0x25')](respondWithResult(_0x20ed7c,null))[_0xd00c('0x47')](handleError(_0x20ed7c,null));};exports[_0xd00c('0x4b')]=function(_0x380147,_0x1f7d40){return db[_0xd00c('0x2c')]['find']({'where':{'id':_0x380147[_0xd00c('0x45')]['id']}})[_0xd00c('0x25')](handleEntityNotFound(_0x1f7d40,null))[_0xd00c('0x25')](removeEntity(_0x1f7d40,null))['catch'](handleError(_0x1f7d40,null));};exports[_0xd00c('0x4c')]=function(_0x3c237c,_0x28d8ff){return db['ChatQueueReport']['describe']()[_0xd00c('0x25')](respondWithResult(_0x28d8ff,null))[_0xd00c('0x47')](handleError(_0x28d8ff,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0ae9cec..66e76f7 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1a744b,_0x5f0579){var _0x3ece9e=function(_0x5e2c5f){while(--_0x5e2c5f){_0x1a744b['push'](_0x1a744b['shift']());}};_0x3ece9e(++_0x5f0579);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0xe706,0xa3));var _0x6e70=function(_0x3f553b,_0x49a9c2){_0x3f553b=_0x3f553b-0x0;var _0x183c4e=_0xe706[_0x3f553b];return _0x183c4e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 835ccfd..43b182d 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 _0x4e16=['where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','update','raw'];(function(_0x5dae65,_0x1874d0){var _0x4dcd2b=function(_0x29d2a3){while(--_0x29d2a3){_0x5dae65['push'](_0x5dae65['shift']());}};_0x4dcd2b(++_0x1874d0);}(_0x4e16,0x1ee));var _0x64e1=function(_0x396474,_0x58ec28){_0x396474=_0x396474-0x0;var _0x59542d=_0x4e16[_0x396474];return _0x59542d;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var moment=require(_0x64e1('0x2'));var BPromise=require(_0x64e1('0x3'));var rs=require(_0x64e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e1('0x5'))['db'];var utils=require(_0x64e1('0x6'));var logger=require(_0x64e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64e1('0x8'));var client=jayson[_0x64e1('0x9')][_0x64e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116fdb,_0xc2529e,_0x4c2004){return new BPromise(function(_0x192173,_0x54aeff){return client[_0x64e1('0xb')](_0x116fdb,_0x4c2004)[_0x64e1('0xc')](function(_0x33e0fb){logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));logger[_0x64e1('0x10')](_0x64e1('0x11'),_0xc2529e,_0x64e1('0xf'),JSON[_0x64e1('0x12')](_0x33e0fb));if(_0x33e0fb[_0x64e1('0x13')]){if(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x14')]===0x1f4){logger['error'](_0x64e1('0xe'),_0xc2529e,_0x33e0fb['error'][_0x64e1('0x15')]);return _0x54aeff(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);}logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);return _0x192173(_0x33e0fb['error'][_0x64e1('0x15')]);}else{logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));_0x192173(_0x33e0fb[_0x64e1('0x16')][_0x64e1('0x15')]);}})[_0x64e1('0x17')](function(_0x3160ba){logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x3160ba);_0x54aeff(_0x3160ba);});});}exports[_0x64e1('0x18')]=function(_0x6ec9bc){var _0x32384e=this;return new Promise(function(_0x5b5b0f,_0x2ec414){return db[_0x64e1('0x19')][_0x64e1('0x1a')](_0x6ec9bc[_0x64e1('0x1b')],{'raw':_0x6ec9bc['options']?_0x6ec9bc[_0x64e1('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x64e1('0xc')](function(_0x596a8e){logger[_0x64e1('0xd')](_0x64e1('0x18'),_0x6ec9bc);logger[_0x64e1('0x10')](_0x64e1('0x18'),_0x6ec9bc,JSON['stringify'](_0x596a8e));_0x5b5b0f(_0x596a8e);})['catch'](function(_0x12b781){logger['error'](_0x64e1('0x18'),_0x12b781[_0x64e1('0x15')],_0x6ec9bc);_0x2ec414(_0x32384e['error'](0x1f4,_0x12b781[_0x64e1('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x5d7eb4){var _0x1a6797=this;return new Promise(function(_0x27916c,_0x936e64){return db[_0x64e1('0x19')][_0x64e1('0x1d')](_0x5d7eb4[_0x64e1('0x1b')],{'raw':_0x5d7eb4[_0x64e1('0x1c')]?_0x5d7eb4[_0x64e1('0x1c')][_0x64e1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7eb4[_0x64e1('0x1c')]?_0x5d7eb4[_0x64e1('0x1c')][_0x64e1('0x1f')]||null:null,'attributes':_0x5d7eb4[_0x64e1('0x1c')]?_0x5d7eb4['options'][_0x64e1('0x20')]||null:null,'limit':_0x5d7eb4[_0x64e1('0x1c')]?_0x5d7eb4[_0x64e1('0x1c')][_0x64e1('0x21')]||null:null})[_0x64e1('0xc')](function(_0x303384){logger[_0x64e1('0xd')](_0x64e1('0x22'),_0x5d7eb4);logger[_0x64e1('0x10')](_0x64e1('0x22'),_0x5d7eb4,JSON[_0x64e1('0x12')](_0x303384));_0x27916c(_0x303384);})['catch'](function(_0x54644e){logger[_0x64e1('0x13')](_0x64e1('0x22'),_0x54644e[_0x64e1('0x15')],_0x5d7eb4);_0x936e64(_0x1a6797[_0x64e1('0x13')](0x1f4,_0x54644e[_0x64e1('0x15')]));});});}; \ No newline at end of file +var _0xaad5=['error','code','message','result','ChatQueueReport','create','options','raw','catch','CreateChatQueueReport','UpdateChatQueueReport','update','body','attributes','limit','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1ae951,_0x28d675){var _0x3570aa=function(_0x458cb5){while(--_0x458cb5){_0x1ae951['push'](_0x1ae951['shift']());}};_0x3570aa(++_0x28d675);}(_0xaad5,0x177));var _0x5aad=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xaad5[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x5aad('0x0'));var util=require(_0x5aad('0x1'));var moment=require(_0x5aad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5aad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aad('0x4'))(_0x5aad('0x5'));var config=require(_0x5aad('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5aad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b02e4,_0x59aef4,_0x57e1ed){return new BPromise(function(_0x3f7a73,_0x2dc9d4){return client[_0x5aad('0x8')](_0x3b02e4,_0x57e1ed)[_0x5aad('0x9')](function(_0x543d05){logger[_0x5aad('0xa')](_0x5aad('0xb'),_0x59aef4,_0x5aad('0xc'));logger[_0x5aad('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x59aef4,_0x5aad('0xc'),JSON[_0x5aad('0xe')](_0x543d05));if(_0x543d05[_0x5aad('0xf')]){if(_0x543d05[_0x5aad('0xf')][_0x5aad('0x10')]===0x1f4){logger[_0x5aad('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x59aef4,_0x543d05['error'][_0x5aad('0x11')]);return _0x2dc9d4(_0x543d05[_0x5aad('0xf')][_0x5aad('0x11')]);}logger[_0x5aad('0xf')](_0x5aad('0xb'),_0x59aef4,_0x543d05[_0x5aad('0xf')]['message']);return _0x3f7a73(_0x543d05[_0x5aad('0xf')][_0x5aad('0x11')]);}else{logger[_0x5aad('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x59aef4,'request\x20sent');_0x3f7a73(_0x543d05[_0x5aad('0x12')][_0x5aad('0x11')]);}})['catch'](function(_0x3d5720){logger['error'](_0x5aad('0xb'),_0x59aef4,_0x3d5720);_0x2dc9d4(_0x3d5720);});});}exports['CreateChatQueueReport']=function(_0x26d226){var _0x194b2c=this;return new Promise(function(_0x5e4ca3,_0x108464){return db[_0x5aad('0x13')][_0x5aad('0x14')](_0x26d226['body'],{'raw':_0x26d226[_0x5aad('0x15')]?_0x26d226[_0x5aad('0x15')][_0x5aad('0x16')]===undefined?!![]:![]:!![]})[_0x5aad('0x9')](function(_0x42a98b){logger['info']('CreateChatQueueReport',_0x26d226);logger[_0x5aad('0xd')]('CreateChatQueueReport',_0x26d226,JSON[_0x5aad('0xe')](_0x42a98b));_0x5e4ca3(_0x42a98b);})[_0x5aad('0x17')](function(_0x3ceb52){logger[_0x5aad('0xf')](_0x5aad('0x18'),_0x3ceb52['message'],_0x26d226);_0x108464(_0x194b2c[_0x5aad('0xf')](0x1f4,_0x3ceb52[_0x5aad('0x11')]));});});};exports[_0x5aad('0x19')]=function(_0x19e67a){var _0x5ad3fe=this;return new Promise(function(_0x48f075,_0x233a36){return db[_0x5aad('0x13')][_0x5aad('0x1a')](_0x19e67a[_0x5aad('0x1b')],{'raw':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')]['where']||null:null,'attributes':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x1c')]||null:null,'limit':_0x19e67a[_0x5aad('0x15')]?_0x19e67a[_0x5aad('0x15')][_0x5aad('0x1d')]||null:null})['then'](function(_0x29a9e9){logger[_0x5aad('0xa')](_0x5aad('0x19'),_0x19e67a);logger[_0x5aad('0xd')](_0x5aad('0x19'),_0x19e67a,JSON[_0x5aad('0xe')](_0x29a9e9));_0x48f075(_0x29a9e9);})['catch'](function(_0x59e7c6){logger[_0x5aad('0xf')]('UpdateChatQueueReport',_0x59e7c6[_0x5aad('0x11')],_0x19e67a);_0x233a36(_0x5ad3fe[_0x5aad('0xf')](0x1f4,_0x59e7c6[_0x5aad('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a09487c..d44763e 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 _0x132a=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','/describe','/:id','show','post','put'];(function(_0x583993,_0x3ad7a6){var _0x35ac71=function(_0x5477c7){while(--_0x5477c7){_0x583993['push'](_0x583993['shift']());}};_0x35ac71(++_0x3ad7a6);}(_0x132a,0x100));var _0xa132=function(_0x583d46,_0x2bfbf6){_0x583d46=_0x583d46-0x0;var _0x133967=_0x132a[_0x583d46];return _0x133967;};'use strict';var multer=require(_0xa132('0x0'));var util=require(_0xa132('0x1'));var path=require(_0xa132('0x2'));var timeout=require('connect-timeout');var express=require(_0xa132('0x3'));var router=express[_0xa132('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa132('0x5'));var config=require(_0xa132('0x6'));var controller=require(_0xa132('0x7'));router['get']('/',auth[_0xa132('0x8')](),controller['index']);router['get'](_0xa132('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa132('0xa'),auth[_0xa132('0x8')](),controller[_0xa132('0xb')]);router[_0xa132('0xc')]('/',auth[_0xa132('0x8')](),controller['create']);router[_0xa132('0xd')]('/:id',auth[_0xa132('0x8')](),controller[_0xa132('0xe')]);router[_0xa132('0xf')](_0xa132('0xa'),auth[_0xa132('0x8')](),controller[_0xa132('0x10')]);module[_0xa132('0x11')]=router; \ No newline at end of file +var _0x9d5c=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','post'];(function(_0x375f69,_0x53535f){var _0x34ffba=function(_0x1709c1){while(--_0x1709c1){_0x375f69['push'](_0x375f69['shift']());}};_0x34ffba(++_0x53535f);}(_0x9d5c,0x64));var _0xc9d5=function(_0x1a1055,_0x36ed21){_0x1a1055=_0x1a1055-0x0;var _0x1abd1b=_0x9d5c[_0x1a1055];return _0x1abd1b;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require(_0xc9d5('0x1'));var path=require(_0xc9d5('0x2'));var timeout=require(_0xc9d5('0x3'));var express=require(_0xc9d5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc9d5('0x5'));var controller=require(_0xc9d5('0x6'));router[_0xc9d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc9d5('0x7')]('/describe',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0x9')]);router[_0xc9d5('0x7')](_0xc9d5('0xa'),auth[_0xc9d5('0x8')](),controller['show']);router[_0xc9d5('0xb')]('/',auth[_0xc9d5('0x8')](),controller[_0xc9d5('0xc')]);router['put']('/:id',auth[_0xc9d5('0x8')](),controller['update']);router[_0xc9d5('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc9d5('0xe')]);module[_0xc9d5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 476db56..37dc448 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x9bde,0xe1));var _0xe9bd=function(_0x27c774,_0x56e774){_0x27c774=_0x27c774-0x0;var _0x1193a6=_0x9bde[_0x27c774];return _0x1193a6;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x29f720,_0x13226d){var _0x47519d=function(_0x123858){while(--_0x123858){_0x29f720['push'](_0x29f720['shift']());}};_0x47519d(++_0x13226d);}(_0xe706,0xa3));var _0x6e70=function(_0x36a997,_0x288f0b){_0x36a997=_0x36a997-0x0;var _0x561b1b=_0xe706[_0x36a997];return _0x561b1b;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 897ecb9..11228ef 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 _0x902d=['rawAttributes','fields','length','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','reject','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params'];(function(_0x7c068e,_0x41d489){var _0x572df7=function(_0x37f9c7){while(--_0x37f9c7){_0x7c068e['push'](_0x7c068e['shift']());}};_0x572df7(++_0x41d489);}(_0x902d,0x165));var _0xd902=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x902d[_0x4dae00];return _0x16bf42;};'use strict';var emlformat=require(_0xd902('0x0'));var rimraf=require(_0xd902('0x1'));var zipdir=require(_0xd902('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd902('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd902('0x4'));var util=require(_0xd902('0x5'));var path=require(_0xd902('0x6'));var sox=require(_0xd902('0x7'));var csv=require('to-csv');var ejs=require(_0xd902('0x8'));var fs=require('fs');var fs_extra=require(_0xd902('0x9'));var _=require(_0xd902('0xa'));var squel=require(_0xd902('0xb'));var crypto=require('crypto');var jsforce=require(_0xd902('0xc'));var deskjs=require(_0xd902('0xd'));var toCsv=require(_0xd902('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd902('0xf'));var qs=require(_0xd902('0x10'));var as=require(_0xd902('0x11'));var hardwareService=require(_0xd902('0x12'));var logger=require('../../config/logger')(_0xd902('0x13'));var utils=require(_0xd902('0x14'));var config=require(_0xd902('0x15'));var licenseUtil=require(_0xd902('0x16'));var db=require(_0xd902('0x17'))['db'];function respondWithStatusCode(_0xd4f849,_0x5aab6e){_0x5aab6e=_0x5aab6e||0xcc;return function(_0x58788b){if(_0x58788b){return _0xd4f849['sendStatus'](_0x5aab6e);}return _0xd4f849[_0xd902('0x18')](_0x5aab6e)['end']();};}function respondWithResult(_0x4aecf9,_0xc5a538){_0xc5a538=_0xc5a538||0xc8;return function(_0x33f9bf){if(_0x33f9bf){return _0x4aecf9[_0xd902('0x18')](_0xc5a538)[_0xd902('0x19')](_0x33f9bf);}};}function respondWithFilteredResult(_0x350d03,_0x4ae9a1){return function(_0x384da4){if(_0x384da4){var _0x2e5ac7=typeof _0x4ae9a1[_0xd902('0x1a')]==='undefined'&&typeof _0x4ae9a1[_0xd902('0x1b')]==='undefined';var _0x1f3eb0=_0x384da4['count'];var _0x234876=_0x2e5ac7?0x0:_0x4ae9a1[_0xd902('0x1a')];var _0x45254f=_0x2e5ac7?_0x384da4['count']:_0x4ae9a1[_0xd902('0x1a')]+_0x4ae9a1[_0xd902('0x1b')];var _0x542430;if(_0x45254f>=_0x1f3eb0){_0x45254f=_0x1f3eb0;_0x542430=0xc8;}else{_0x542430=0xce;}_0x350d03[_0xd902('0x18')](_0x542430);return _0x350d03[_0xd902('0x1c')]('Content-Range',_0x234876+'-'+_0x45254f+'/'+_0x1f3eb0)[_0xd902('0x19')](_0x384da4);}return null;};}function patchUpdates(_0x90ad14){return function(_0x85c1f){try{jsonpatch['apply'](_0x85c1f,_0x90ad14,!![]);}catch(_0x2c1ef9){return BPromise[_0xd902('0x1d')](_0x2c1ef9);}return _0x85c1f['save']();};}function saveUpdates(_0x5a6459,_0x11d233){return function(_0x36e014){if(_0x36e014){return _0x36e014['update'](_0x5a6459)[_0xd902('0x1e')](function(_0x38d74c){return _0x38d74c;});}return null;};}function removeEntity(_0x5a2e3c,_0x5265a1){return function(_0x557ede){if(_0x557ede){return _0x557ede['destroy']()[_0xd902('0x1e')](function(){_0x5a2e3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0ae0e,_0x18f802){return function(_0x2aa321){if(!_0x2aa321){_0xe0ae0e[_0xd902('0x1f')](0x194);}return _0x2aa321;};}function handleError(_0x2766a4,_0x29be2f){_0x29be2f=_0x29be2f||0x1f4;return function(_0xb90d88){logger[_0xd902('0x20')](_0xb90d88[_0xd902('0x21')]);if(_0xb90d88[_0xd902('0x22')]){delete _0xb90d88[_0xd902('0x22')];}_0x2766a4[_0xd902('0x18')](_0x29be2f)[_0xd902('0x23')](_0xb90d88);};}exports[_0xd902('0x24')]=function(_0x2d0a9d,_0x425a4d){var _0x140776={},_0x216133={},_0x25f259={'count':0x0,'rows':[]};var _0x49b5bf=_[_0xd902('0x25')](db[_0xd902('0x26')]['rawAttributes'],function(_0x15fb34){return{'name':_0x15fb34[_0xd902('0x27')],'type':_0x15fb34[_0xd902('0x28')][_0xd902('0x29')]};});_0x216133[_0xd902('0x2a')]=_[_0xd902('0x25')](_0x49b5bf,_0xd902('0x22'));_0x216133[_0xd902('0x2b')]=_[_0xd902('0x2c')](_0x2d0a9d[_0xd902('0x2b')]);_0x216133[_0xd902('0x2d')]=_[_0xd902('0x2e')](_0x216133[_0xd902('0x2a')],_0x216133[_0xd902('0x2b')]);_0x140776[_0xd902('0x2f')]=_[_0xd902('0x2e')](_0x216133[_0xd902('0x2a')],qs['fields'](_0x2d0a9d[_0xd902('0x2b')]['fields']));_0x140776[_0xd902('0x2f')]=_0x140776[_0xd902('0x2f')]['length']?_0x140776[_0xd902('0x2f')]:_0x216133[_0xd902('0x2a')];if(!_0x2d0a9d[_0xd902('0x2b')]['hasOwnProperty'](_0xd902('0x30'))){_0x140776['limit']=qs['limit'](_0x2d0a9d['query'][_0xd902('0x1b')]);_0x140776[_0xd902('0x1a')]=qs[_0xd902('0x1a')](_0x2d0a9d[_0xd902('0x2b')]['offset']);}_0x140776['order']=qs[_0xd902('0x31')](_0x2d0a9d[_0xd902('0x2b')][_0xd902('0x31')]);_0x140776[_0xd902('0x32')]=qs[_0xd902('0x2d')](_['pick'](_0x2d0a9d[_0xd902('0x2b')],_0x216133[_0xd902('0x2d')]),_0x49b5bf);if(_0x2d0a9d[_0xd902('0x2b')][_0xd902('0x33')]){_0x140776['where']=_[_0xd902('0x34')](_0x140776[_0xd902('0x32')],{'$or':_['map'](_0x49b5bf,function(_0x340fde){if(_0x340fde[_0xd902('0x28')]!==_0xd902('0x35')){var _0x1ef46e={};_0x1ef46e[_0x340fde[_0xd902('0x22')]]={'$like':'%'+_0x2d0a9d[_0xd902('0x2b')][_0xd902('0x33')]+'%'};return _0x1ef46e;}})});}_0x140776=_[_0xd902('0x34')]({},_0x140776,_0x2d0a9d[_0xd902('0x36')]);var _0x512fca={'where':_0x140776[_0xd902('0x32')]};return db[_0xd902('0x26')]['count'](_0x512fca)[_0xd902('0x1e')](function(_0x5a89f7){_0x25f259[_0xd902('0x37')]=_0x5a89f7;if(_0x2d0a9d[_0xd902('0x2b')][_0xd902('0x38')]){_0x140776[_0xd902('0x39')]=[{'all':!![]}];}return db[_0xd902('0x26')][_0xd902('0x3a')](_0x140776);})['then'](function(_0x21475e){_0x25f259[_0xd902('0x3b')]=_0x21475e;return _0x25f259;})['then'](respondWithFilteredResult(_0x425a4d,_0x140776))[_0xd902('0x3c')](handleError(_0x425a4d,null));};exports[_0xd902('0x3d')]=function(_0x4c7557,_0x52bf47){var _0x2d7898={'raw':!![],'where':{'id':_0x4c7557[_0xd902('0x3e')]['id']}},_0x1f56aa={};_0x1f56aa[_0xd902('0x2a')]=_[_0xd902('0x2c')](db['ChatTransferReport'][_0xd902('0x3f')]);_0x1f56aa[_0xd902('0x2b')]=_[_0xd902('0x2c')](_0x4c7557[_0xd902('0x2b')]);_0x1f56aa[_0xd902('0x2d')]=_[_0xd902('0x2e')](_0x1f56aa['model'],_0x1f56aa[_0xd902('0x2b')]);_0x2d7898['attributes']=_['intersection'](_0x1f56aa[_0xd902('0x2a')],qs['fields'](_0x4c7557['query'][_0xd902('0x40')]));_0x2d7898[_0xd902('0x2f')]=_0x2d7898[_0xd902('0x2f')][_0xd902('0x41')]?_0x2d7898['attributes']:_0x1f56aa[_0xd902('0x2a')];if(_0x4c7557[_0xd902('0x2b')][_0xd902('0x38')]){_0x2d7898[_0xd902('0x39')]=[{'all':!![]}];}_0x2d7898=_[_0xd902('0x34')]({},_0x2d7898,_0x4c7557['options']);return db[_0xd902('0x26')][_0xd902('0x42')](_0x2d7898)[_0xd902('0x1e')](handleEntityNotFound(_0x52bf47,null))[_0xd902('0x1e')](respondWithResult(_0x52bf47,null))[_0xd902('0x3c')](handleError(_0x52bf47,null));};exports[_0xd902('0x43')]=function(_0x46bf07,_0xb7c5b){return db['ChatTransferReport'][_0xd902('0x43')](_0x46bf07['body'],{})[_0xd902('0x1e')](respondWithResult(_0xb7c5b,0xc9))['catch'](handleError(_0xb7c5b,null));};exports['update']=function(_0x339995,_0x1e7855){if(_0x339995[_0xd902('0x44')]['id']){delete _0x339995[_0xd902('0x44')]['id'];}return db['ChatTransferReport'][_0xd902('0x42')]({'where':{'id':_0x339995['params']['id']}})[_0xd902('0x1e')](handleEntityNotFound(_0x1e7855,null))[_0xd902('0x1e')](saveUpdates(_0x339995[_0xd902('0x44')],null))[_0xd902('0x1e')](respondWithResult(_0x1e7855,null))[_0xd902('0x3c')](handleError(_0x1e7855,null));};exports['destroy']=function(_0x563b89,_0x1ea919){return db[_0xd902('0x26')][_0xd902('0x42')]({'where':{'id':_0x563b89[_0xd902('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1ea919,null))[_0xd902('0x1e')](removeEntity(_0x1ea919,null))[_0xd902('0x3c')](handleError(_0x1ea919,null));};exports[_0xd902('0x45')]=function(_0x25f24e,_0x4a400e){return db[_0xd902('0x26')]['describe']()[_0xd902('0x1e')](respondWithResult(_0x4a400e,null))['catch'](handleError(_0x4a400e,null));}; \ No newline at end of file +var _0x7918=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis'];(function(_0x2acd7e,_0x4a5f48){var _0x5a6790=function(_0x52e03c){while(--_0x52e03c){_0x2acd7e['push'](_0x2acd7e['shift']());}};_0x5a6790(++_0x4a5f48);}(_0x7918,0x1e1));var _0x8791=function(_0x10ea94,_0x45b5f1){_0x10ea94=_0x10ea94-0x0;var _0x87c1bf=_0x7918[_0x10ea94];return _0x87c1bf;};'use strict';var emlformat=require(_0x8791('0x0'));var rimraf=require(_0x8791('0x1'));var zipdir=require(_0x8791('0x2'));var jsonpatch=require(_0x8791('0x3'));var rp=require(_0x8791('0x4'));var moment=require(_0x8791('0x5'));var BPromise=require(_0x8791('0x6'));var Mustache=require(_0x8791('0x7'));var util=require('util');var path=require(_0x8791('0x8'));var sox=require(_0x8791('0x9'));var csv=require(_0x8791('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8791('0xb'));var crypto=require(_0x8791('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8791('0xd'));var Papa=require(_0x8791('0xe'));var Redis=require(_0x8791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8791('0x10'));var as=require(_0x8791('0x11'));var hardwareService=require(_0x8791('0x12'));var logger=require('../../config/logger')(_0x8791('0x13'));var utils=require('../../config/utils');var config=require(_0x8791('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20b190,_0x42000e){_0x42000e=_0x42000e||0xcc;return function(_0x313273){if(_0x313273){return _0x20b190[_0x8791('0x15')](_0x42000e);}return _0x20b190['status'](_0x42000e)[_0x8791('0x16')]();};}function respondWithResult(_0x2b42db,_0x32d001){_0x32d001=_0x32d001||0xc8;return function(_0x5cb392){if(_0x5cb392){return _0x2b42db[_0x8791('0x17')](_0x32d001)[_0x8791('0x18')](_0x5cb392);}};}function respondWithFilteredResult(_0xc74b91,_0x58b131){return function(_0x53600b){if(_0x53600b){var _0xc85c60=typeof _0x58b131['offset']==='undefined'&&typeof _0x58b131['limit']==='undefined';var _0x33c9db=_0x53600b[_0x8791('0x19')];var _0x1db2e1=_0xc85c60?0x0:_0x58b131['offset'];var _0x2f8672=_0xc85c60?_0x53600b[_0x8791('0x19')]:_0x58b131[_0x8791('0x1a')]+_0x58b131[_0x8791('0x1b')];var _0x61b79a;if(_0x2f8672>=_0x33c9db){_0x2f8672=_0x33c9db;_0x61b79a=0xc8;}else{_0x61b79a=0xce;}_0xc74b91[_0x8791('0x17')](_0x61b79a);return _0xc74b91[_0x8791('0x1c')](_0x8791('0x1d'),_0x1db2e1+'-'+_0x2f8672+'/'+_0x33c9db)[_0x8791('0x18')](_0x53600b);}return null;};}function patchUpdates(_0x1003f9){return function(_0xb37712){try{jsonpatch['apply'](_0xb37712,_0x1003f9,!![]);}catch(_0x58326f){return BPromise[_0x8791('0x1e')](_0x58326f);}return _0xb37712['save']();};}function saveUpdates(_0x5e25de,_0x5eade7){return function(_0x9d6d90){if(_0x9d6d90){return _0x9d6d90[_0x8791('0x1f')](_0x5e25de)[_0x8791('0x20')](function(_0x13d92e){return _0x13d92e;});}return null;};}function removeEntity(_0x19a75d,_0x17b090){return function(_0x17329f){if(_0x17329f){return _0x17329f['destroy']()[_0x8791('0x20')](function(){_0x19a75d['status'](0xcc)[_0x8791('0x16')]();});}};}function handleEntityNotFound(_0x372fa2,_0x492b1d){return function(_0x411ffe){if(!_0x411ffe){_0x372fa2[_0x8791('0x15')](0x194);}return _0x411ffe;};}function handleError(_0x1de0bc,_0x51edbd){_0x51edbd=_0x51edbd||0x1f4;return function(_0x2e400b){logger[_0x8791('0x21')](_0x2e400b[_0x8791('0x22')]);if(_0x2e400b[_0x8791('0x23')]){delete _0x2e400b['name'];}_0x1de0bc[_0x8791('0x17')](_0x51edbd)['send'](_0x2e400b);};}exports[_0x8791('0x24')]=function(_0x306e3a,_0x1aa4ef){var _0x5b13e1={},_0x546636={},_0x5dc91f={'count':0x0,'rows':[]};var _0x257d0e=_[_0x8791('0x25')](db[_0x8791('0x26')][_0x8791('0x27')],function(_0x3f410c){return{'name':_0x3f410c[_0x8791('0x28')],'type':_0x3f410c[_0x8791('0x29')][_0x8791('0x2a')]};});_0x546636[_0x8791('0x2b')]=_['map'](_0x257d0e,'name');_0x546636[_0x8791('0x2c')]=_[_0x8791('0x2d')](_0x306e3a[_0x8791('0x2c')]);_0x546636['filters']=_[_0x8791('0x2e')](_0x546636['model'],_0x546636[_0x8791('0x2c')]);_0x5b13e1['attributes']=_['intersection'](_0x546636[_0x8791('0x2b')],qs['fields'](_0x306e3a[_0x8791('0x2c')][_0x8791('0x2f')]));_0x5b13e1[_0x8791('0x30')]=_0x5b13e1[_0x8791('0x30')][_0x8791('0x31')]?_0x5b13e1[_0x8791('0x30')]:_0x546636[_0x8791('0x2b')];if(!_0x306e3a[_0x8791('0x2c')]['hasOwnProperty'](_0x8791('0x32'))){_0x5b13e1[_0x8791('0x1b')]=qs[_0x8791('0x1b')](_0x306e3a[_0x8791('0x2c')][_0x8791('0x1b')]);_0x5b13e1[_0x8791('0x1a')]=qs[_0x8791('0x1a')](_0x306e3a['query'][_0x8791('0x1a')]);}_0x5b13e1[_0x8791('0x33')]=qs['sort'](_0x306e3a['query']['sort']);_0x5b13e1['where']=qs[_0x8791('0x34')](_[_0x8791('0x35')](_0x306e3a['query'],_0x546636[_0x8791('0x34')]),_0x257d0e);if(_0x306e3a[_0x8791('0x2c')][_0x8791('0x36')]){_0x5b13e1['where']=_[_0x8791('0x37')](_0x5b13e1[_0x8791('0x38')],{'$or':_['map'](_0x257d0e,function(_0x13eb4b){if(_0x13eb4b[_0x8791('0x29')]!==_0x8791('0x39')){var _0x9372a1={};_0x9372a1[_0x13eb4b['name']]={'$like':'%'+_0x306e3a[_0x8791('0x2c')]['filter']+'%'};return _0x9372a1;}})});}_0x5b13e1=_[_0x8791('0x37')]({},_0x5b13e1,_0x306e3a['options']);var _0x127547={'where':_0x5b13e1[_0x8791('0x38')]};return db[_0x8791('0x26')][_0x8791('0x19')](_0x127547)[_0x8791('0x20')](function(_0x1fe837){_0x5dc91f['count']=_0x1fe837;if(_0x306e3a[_0x8791('0x2c')][_0x8791('0x3a')]){_0x5b13e1[_0x8791('0x3b')]=[{'all':!![]}];}return db[_0x8791('0x26')][_0x8791('0x3c')](_0x5b13e1);})[_0x8791('0x20')](function(_0x30b988){_0x5dc91f[_0x8791('0x3d')]=_0x30b988;return _0x5dc91f;})[_0x8791('0x20')](respondWithFilteredResult(_0x1aa4ef,_0x5b13e1))[_0x8791('0x3e')](handleError(_0x1aa4ef,null));};exports[_0x8791('0x3f')]=function(_0x5bc630,_0x15b2de){var _0x477edf={'raw':!![],'where':{'id':_0x5bc630[_0x8791('0x40')]['id']}},_0x3220e4={};_0x3220e4[_0x8791('0x2b')]=_[_0x8791('0x2d')](db[_0x8791('0x26')][_0x8791('0x27')]);_0x3220e4[_0x8791('0x2c')]=_[_0x8791('0x2d')](_0x5bc630['query']);_0x3220e4['filters']=_[_0x8791('0x2e')](_0x3220e4[_0x8791('0x2b')],_0x3220e4[_0x8791('0x2c')]);_0x477edf[_0x8791('0x30')]=_[_0x8791('0x2e')](_0x3220e4[_0x8791('0x2b')],qs['fields'](_0x5bc630[_0x8791('0x2c')][_0x8791('0x2f')]));_0x477edf[_0x8791('0x30')]=_0x477edf[_0x8791('0x30')][_0x8791('0x31')]?_0x477edf[_0x8791('0x30')]:_0x3220e4[_0x8791('0x2b')];if(_0x5bc630[_0x8791('0x2c')][_0x8791('0x3a')]){_0x477edf[_0x8791('0x3b')]=[{'all':!![]}];}_0x477edf=_[_0x8791('0x37')]({},_0x477edf,_0x5bc630[_0x8791('0x41')]);return db['ChatTransferReport'][_0x8791('0x42')](_0x477edf)[_0x8791('0x20')](handleEntityNotFound(_0x15b2de,null))[_0x8791('0x20')](respondWithResult(_0x15b2de,null))[_0x8791('0x3e')](handleError(_0x15b2de,null));};exports[_0x8791('0x43')]=function(_0x4b9d2d,_0x4894f9){return db[_0x8791('0x26')]['create'](_0x4b9d2d[_0x8791('0x44')],{})[_0x8791('0x20')](respondWithResult(_0x4894f9,0xc9))[_0x8791('0x3e')](handleError(_0x4894f9,null));};exports['update']=function(_0x197525,_0x1cab3){if(_0x197525['body']['id']){delete _0x197525[_0x8791('0x44')]['id'];}return db[_0x8791('0x26')]['find']({'where':{'id':_0x197525[_0x8791('0x40')]['id']}})[_0x8791('0x20')](handleEntityNotFound(_0x1cab3,null))[_0x8791('0x20')](saveUpdates(_0x197525[_0x8791('0x44')],null))[_0x8791('0x20')](respondWithResult(_0x1cab3,null))['catch'](handleError(_0x1cab3,null));};exports[_0x8791('0x45')]=function(_0x164d0e,_0x30f5f8){return db[_0x8791('0x26')][_0x8791('0x42')]({'where':{'id':_0x164d0e[_0x8791('0x40')]['id']}})[_0x8791('0x20')](handleEntityNotFound(_0x30f5f8,null))[_0x8791('0x20')](removeEntity(_0x30f5f8,null))[_0x8791('0x3e')](handleError(_0x30f5f8,null));};exports['describe']=function(_0x5a7791,_0x331785){return db[_0x8791('0x26')][_0x8791('0x46')]()[_0x8791('0x20')](respondWithResult(_0x331785,null))['catch'](handleError(_0x331785,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9cae1cd..a313e35 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 _0x5f46=['exports','report_chat_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x5f46,0xc8));var _0x65f4=function(_0x356ccb,_0x2b16d0){_0x356ccb=_0x356ccb-0x0;var _0x4ecb55=_0x5f46[_0x356ccb];return _0x4ecb55;};'use strict';var _=require(_0x65f4('0x0'));var util=require(_0x65f4('0x1'));var logger=require(_0x65f4('0x2'))(_0x65f4('0x3'));var moment=require(_0x65f4('0x4'));var BPromise=require(_0x65f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65f4('0x6'));var rimraf=require(_0x65f4('0x7'));var config=require(_0x65f4('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x65f4('0x9')]=function(_0x5f2616,_0x52c65c){return _0x5f2616['define']('ChatTransferReport',attributes,{'tableName':_0x65f4('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a54=['request-promise','path','rimraf','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x14d06a,_0x4fa706){var _0x580485=function(_0x286fa3){while(--_0x286fa3){_0x14d06a['push'](_0x14d06a['shift']());}};_0x580485(++_0x4fa706);}(_0x4a54,0x133));var _0x44a5=function(_0x58ef64,_0x47c44e){_0x58ef64=_0x58ef64-0x0;var _0x51584b=_0x4a54[_0x58ef64];return _0x51584b;};'use strict';var _=require(_0x44a5('0x0'));var util=require(_0x44a5('0x1'));var logger=require(_0x44a5('0x2'))(_0x44a5('0x3'));var moment=require(_0x44a5('0x4'));var BPromise=require('bluebird');var rp=require(_0x44a5('0x5'));var fs=require('fs');var path=require(_0x44a5('0x6'));var rimraf=require(_0x44a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x44a5('0x8'));module['exports']=function(_0x4f1ff3,_0x45cbe5){return _0x4f1ff3['define'](_0x44a5('0x9'),attributes,{'tableName':_0x44a5('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x44a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 2433cea..d3fb934 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 _0x25af=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x25af,0x173));var _0xf25a=function(_0x451754,_0x23b69c){_0x451754=_0x451754-0x0;var _0x520826=_0x25af[_0x451754];return _0x520826;};'use strict';var _=require(_0xf25a('0x0'));var util=require('util');var moment=require(_0xf25a('0x1'));var BPromise=require('bluebird');var rs=require(_0xf25a('0x2'));var fs=require('fs');var Redis=require(_0xf25a('0x3'));var db=require(_0xf25a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf25a('0x5'))(_0xf25a('0x6'));var config=require(_0xf25a('0x7'));var jayson=require(_0xf25a('0x8'));var client=jayson[_0xf25a('0x9')][_0xf25a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387ba0,_0x2780e8,_0x4c87f8){return new BPromise(function(_0x221769,_0x2b5689){return client[_0xf25a('0xb')](_0x387ba0,_0x4c87f8)[_0xf25a('0xc')](function(_0x58e6e6){logger[_0xf25a('0xd')](_0xf25a('0xe'),_0x2780e8,_0xf25a('0xf'));logger[_0xf25a('0x10')](_0xf25a('0x11'),_0x2780e8,_0xf25a('0xf'),JSON[_0xf25a('0x12')](_0x58e6e6));if(_0x58e6e6['error']){if(_0x58e6e6['error'][_0xf25a('0x13')]===0x1f4){logger[_0xf25a('0x14')](_0xf25a('0xe'),_0x2780e8,_0x58e6e6[_0xf25a('0x14')]['message']);return _0x2b5689(_0x58e6e6[_0xf25a('0x14')][_0xf25a('0x15')]);}logger[_0xf25a('0x14')](_0xf25a('0xe'),_0x2780e8,_0x58e6e6['error'][_0xf25a('0x15')]);return _0x221769(_0x58e6e6[_0xf25a('0x14')]['message']);}else{logger[_0xf25a('0xd')](_0xf25a('0xe'),_0x2780e8,_0xf25a('0xf'));_0x221769(_0x58e6e6[_0xf25a('0x16')][_0xf25a('0x15')]);}})[_0xf25a('0x17')](function(_0x22cc00){logger['error'](_0xf25a('0xe'),_0x2780e8,_0x22cc00);_0x2b5689(_0x22cc00);});});} \ No newline at end of file +var _0x1ef8=['then','info','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x11e2d1,_0x1edb96){var _0x51fb77=function(_0x246a1d){while(--_0x246a1d){_0x11e2d1['push'](_0x11e2d1['shift']());}};_0x51fb77(++_0x1edb96);}(_0x1ef8,0x137));var _0x81ef=function(_0x38c8c0,_0x52678b){_0x38c8c0=_0x38c8c0-0x0;var _0x397bd5=_0x1ef8[_0x38c8c0];return _0x397bd5;};'use strict';var _=require(_0x81ef('0x0'));var util=require(_0x81ef('0x1'));var moment=require(_0x81ef('0x2'));var BPromise=require(_0x81ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ef('0x4'));var db=require(_0x81ef('0x5'))['db'];var utils=require(_0x81ef('0x6'));var logger=require(_0x81ef('0x7'))(_0x81ef('0x8'));var config=require(_0x81ef('0x9'));var jayson=require(_0x81ef('0xa'));var client=jayson[_0x81ef('0xb')][_0x81ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16bc33,_0x468d55,_0x1c6e46){return new BPromise(function(_0x39235f,_0x19c253){return client[_0x81ef('0xd')](_0x16bc33,_0x1c6e46)[_0x81ef('0xe')](function(_0x19ef26){logger[_0x81ef('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x468d55,'request\x20sent');logger['debug'](_0x81ef('0x10'),_0x468d55,_0x81ef('0x11'),JSON[_0x81ef('0x12')](_0x19ef26));if(_0x19ef26['error']){if(_0x19ef26['error'][_0x81ef('0x13')]===0x1f4){logger[_0x81ef('0x14')](_0x81ef('0x15'),_0x468d55,_0x19ef26[_0x81ef('0x14')]['message']);return _0x19c253(_0x19ef26[_0x81ef('0x14')][_0x81ef('0x16')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x468d55,_0x19ef26['error'][_0x81ef('0x16')]);return _0x39235f(_0x19ef26['error'][_0x81ef('0x16')]);}else{logger['info'](_0x81ef('0x15'),_0x468d55,_0x81ef('0x11'));_0x39235f(_0x19ef26[_0x81ef('0x17')][_0x81ef('0x16')]);}})[_0x81ef('0x18')](function(_0x5bd731){logger[_0x81ef('0x14')](_0x81ef('0x15'),_0x468d55,_0x5bd731);_0x19c253(_0x5bd731);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 82c0fe8..42e2389 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 _0x8a85=['index','/describe','describe','show','post','create','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x4f7cd0,_0x1f716f){var _0x1d6e35=function(_0x3b3b13){while(--_0x3b3b13){_0x4f7cd0['push'](_0x4f7cd0['shift']());}};_0x1d6e35(++_0x1f716f);}(_0x8a85,0xe6));var _0x58a8=function(_0x33df14,_0x2ba900){_0x33df14=_0x33df14-0x0;var _0x180d1d=_0x8a85[_0x33df14];return _0x180d1d;};'use strict';var multer=require('multer');var util=require(_0x58a8('0x0'));var path=require(_0x58a8('0x1'));var timeout=require(_0x58a8('0x2'));var express=require(_0x58a8('0x3'));var router=express[_0x58a8('0x4')]();var fs_extra=require(_0x58a8('0x5'));var auth=require(_0x58a8('0x6'));var interaction=require(_0x58a8('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x58a8('0x8')]('/',auth[_0x58a8('0x9')](),controller[_0x58a8('0xa')]);router[_0x58a8('0x8')](_0x58a8('0xb'),auth[_0x58a8('0x9')](),controller[_0x58a8('0xc')]);router['get']('/:id',auth[_0x58a8('0x9')](),controller[_0x58a8('0xd')]);router[_0x58a8('0xe')]('/',auth[_0x58a8('0x9')](),controller[_0x58a8('0xf')]);router['put']('/:id',auth[_0x58a8('0x9')](),controller[_0x58a8('0x10')]);router['delete'](_0x58a8('0x11'),auth[_0x58a8('0x9')](),controller[_0x58a8('0x12')]);module[_0x58a8('0x13')]=router; \ No newline at end of file +var _0x5889=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','connect-timeout','express','../../components/auth/service'];(function(_0x310990,_0x245984){var _0x648534=function(_0xd320e5){while(--_0xd320e5){_0x310990['push'](_0x310990['shift']());}};_0x648534(++_0x245984);}(_0x5889,0x1e2));var _0x9588=function(_0x3714ae,_0x2b7ddd){_0x3714ae=_0x3714ae-0x0;var _0x23aa06=_0x5889[_0x3714ae];return _0x23aa06;};'use strict';var multer=require(_0x9588('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9588('0x1'));var express=require(_0x9588('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9588('0x3'));var interaction=require(_0x9588('0x4'));var config=require(_0x9588('0x5'));var controller=require(_0x9588('0x6'));router[_0x9588('0x7')]('/',auth[_0x9588('0x8')](),controller[_0x9588('0x9')]);router['get'](_0x9588('0xa'),auth[_0x9588('0x8')](),controller[_0x9588('0xb')]);router[_0x9588('0x7')](_0x9588('0xc'),auth[_0x9588('0x8')](),controller[_0x9588('0xd')]);router[_0x9588('0xe')]('/',auth[_0x9588('0x8')](),controller[_0x9588('0xf')]);router['put'](_0x9588('0xc'),auth['isAuthenticated'](),controller[_0x9588('0x10')]);router[_0x9588('0x11')](_0x9588('0xc'),auth[_0x9588('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 24d5f5a..a140f5a 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 _0xcfaa=['Skip','star','thumb','input','name','text','getDataValue','onlineForm','parse','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x353a87,_0x2730fb){var _0xfe692d=function(_0x3ec956){while(--_0x3ec956){_0x353a87['push'](_0x353a87['shift']());}};_0xfe692d(++_0x2730fb);}(_0xcfaa,0xbc));var _0xacfa=function(_0x2e8660,_0x21b463){_0x2e8660=_0x2e8660-0x0;var _0x2b574e=_0xcfaa[_0x2e8660];return _0x2b574e;};'use strict';var Sequelize=require(_0xacfa('0x0'));var rs=require(_0xacfa('0x1'));module[_0xacfa('0x2')]={'name':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![],'unique':_0xacfa('0x4')},'description':{'type':Sequelize[_0xacfa('0x3')]},'mapKey':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x5')},'mapKeyOffline':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x6')},'customerAlias':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xacfa('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![],'defaultValue':_0xacfa('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xacfa('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xacfa('0x3')]},'animation':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xacfa('0xb')](_0xacfa('0xc'),_0xacfa('0xd')),'defaultValue':_0xacfa('0xc')},'header_online':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0xe')},'start_chat_button':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xacfa('0x11')]},'closingQuestion':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x14')},'noteTitle':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x15')},'placeholderMessage':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xacfa('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xacfa('0x18')},'conditionAgreement':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xacfa('0x19'),_0xacfa('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xacfa('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xacfa('0x1b'),'variable':null,'config':{'placeholder':_0xacfa('0x1c'),'type':_0xacfa('0x1d'),'required':!![]},'props':{'title':_0xacfa('0x1c'),'helpText':''}},{'type':_0xacfa('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xacfa('0x5'),'type':_0xacfa('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xacfa('0x1e')](_0xacfa('0x1f'))?JSON[_0xacfa('0x20')](this[_0xacfa('0x1e')](_0xacfa('0x1f'))):{};},'set':function(_0x3ee9cf){return this['setDataValue'](_0xacfa('0x1f'),JSON[_0xacfa('0x21')](_0x3ee9cf));}},'offlineForm':{'type':Sequelize[_0xacfa('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xacfa('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xacfa('0x5'),'type':_0xacfa('0x5')},'variable':null},{'type':_0xacfa('0x22'),'config':{'placeholder':_0xacfa('0x23')},'props':{'title':_0xacfa('0x23'),'helpText':_0xacfa('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xacfa('0x1e')](_0xacfa('0x25'))?JSON[_0xacfa('0x20')](this[_0xacfa('0x1e')]('offlineForm')):{};},'set':function(_0x965e02){return this[_0xacfa('0x26')](_0xacfa('0x25'),JSON[_0xacfa('0x21')](_0x965e02));}},'token':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':function(){return rs[_0xacfa('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xacfa('0x3')]},'waitingTitle':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xacfa('0x29')},'offlineMessageSubject':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x2a')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x18')},'sendUnmanaged':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xacfa('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xacfa('0x2b');}},'notificationSound':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xacfa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xacfa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x2d')},'verticalAlignment':{'type':Sequelize[_0xacfa('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x2e')},'messagesAlignment':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':_0xacfa('0x2f')},'defaultTitle':{'type':Sequelize[_0xacfa('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xacfa('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xacfa('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xacfa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xacfa('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xacfa('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xacfa('0x9')],'comment':_0xacfa('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![],'comment':_0xacfa('0x31'),'set':function(_0x4b9605){if(!_0x4b9605)this[_0xacfa('0x26')]('mandatoryDispositionPauseId',null);this[_0xacfa('0x26')](_0xacfa('0x32'),_0x4b9605);}},'vidaooEscalation':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xacfa('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xacfa('0x33')},'vidaooNote':{'type':Sequelize[_0xacfa('0x3')],'defaultValue':function(){return _0xacfa('0x34');}},'vidaooMetadata':{'type':Sequelize[_0xacfa('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xacfa('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdfea=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','INTEGER','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.'];(function(_0x4efc87,_0x17a7d1){var _0x191fc4=function(_0x19dda1){while(--_0x19dda1){_0x4efc87['push'](_0x4efc87['shift']());}};_0x191fc4(++_0x17a7d1);}(_0xdfea,0x12f));var _0xadfe=function(_0x38a1b6,_0x652988){_0x38a1b6=_0x38a1b6-0x0;var _0xfbd3d2=_0xdfea[_0x38a1b6];return _0xfbd3d2;};'use strict';var Sequelize=require(_0xadfe('0x0'));var rs=require(_0xadfe('0x1'));module[_0xadfe('0x2')]={'name':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xadfe('0x4')},'description':{'type':Sequelize[_0xadfe('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0x5')},'mapKeyOffline':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0x6')},'customerAlias':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xadfe('0x3')]},'animation':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xadfe('0xa')](_0xadfe('0xb'),_0xadfe('0xc')),'defaultValue':_0xadfe('0xb')},'header_online':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0xd')},'start_chat_button':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0xe')},'header_offline':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0xf')},'download_transcript':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xadfe('0x11')]},'closingQuestion':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x14')},'noteTitle':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x15')},'placeholderMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x16')},'closingMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x18')},'conditionAgreement':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xadfe('0xa')](_0xadfe('0x19'),_0xadfe('0x1a')),'defaultValue':_0xadfe('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xadfe('0x1b')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xadfe('0x11')],'defaultValue':function(){return JSON[_0xadfe('0x1c')]({'items':[{'type':_0xadfe('0x1d'),'variable':null,'config':{'placeholder':_0xadfe('0x1e'),'type':'text','required':!![]},'props':{'title':_0xadfe('0x1e'),'helpText':''}},{'type':_0xadfe('0x1d'),'props':{'title':_0xadfe('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xadfe('0x5'),'type':_0xadfe('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xadfe('0x1f')](_0xadfe('0x20'))?JSON['parse'](this['getDataValue'](_0xadfe('0x20'))):{};},'set':function(_0x3996e6){return this[_0xadfe('0x21')](_0xadfe('0x20'),JSON[_0xadfe('0x1c')](_0x3996e6));}},'offlineForm':{'type':Sequelize[_0xadfe('0x11')],'defaultValue':function(){return JSON[_0xadfe('0x1c')]({'items':[{'type':_0xadfe('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xadfe('0x5'),'type':_0xadfe('0x5')},'variable':null},{'type':_0xadfe('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xadfe('0x1f')](_0xadfe('0x23'))?JSON['parse'](this[_0xadfe('0x1f')](_0xadfe('0x23'))):{};},'set':function(_0x162aec){return this[_0xadfe('0x21')]('offlineForm',JSON[_0xadfe('0x1c')](_0x162aec));}},'token':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xadfe('0x3')]},'forwardOffline':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xadfe('0x3')]},'waitingTitle':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x24')},'waitingMessage':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x26')},'offlineMessageBody':{'type':Sequelize[_0xadfe('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[_0xadfe('0x3')],'defaultValue':_0xadfe('0x27')},'skipUnmanaged':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x18')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xadfe('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xadfe('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xadfe('0x28');}},'notificationSound':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2a')},'messagesAlignment':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2b')},'defaultTitle':{'type':Sequelize[_0xadfe('0x3')]},'customerAvatar':{'type':Sequelize[_0xadfe('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xadfe('0x1b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':_0xadfe('0x2d')},'systemAvatar':{'type':Sequelize[_0xadfe('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xadfe('0x1b')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![],'comment':_0xadfe('0x2e'),'set':function(_0x339465){if(!_0x339465)this[_0xadfe('0x21')]('mandatoryDispositionPauseId',null);this[_0xadfe('0x21')]('mandatoryDisposition',_0x339465);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xadfe('0x3')],'allowNull':![],'defaultValue':_0xadfe('0x2f')},'vidaooNote':{'type':Sequelize[_0xadfe('0x3')],'defaultValue':function(){return _0xadfe('0x30');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xadfe('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xadfe('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4b4e0a2..6b95dd2 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 _0x986b=['interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','map','Intervals','all','some','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','update','params','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','nolimit','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','options','removeAnswers','addLogo','file','filename','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','join','root','server/files/images/logos/','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','download','notify','chat','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','List','account','list','applications','priority','asc','defaults','contact','headers','threadId','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','queueId','waitForTheAssignedQueue','Start','EventManager','offline','files','CmContact','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','hasOwnProperty','Owner','fullname','internal','Tag','Tags','color','tag','virtual','custom','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','URL','origin','3.5.0','remote','connection','remoteAddress','render','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','transaction','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','getSnippet','timezone','format','iftime\x20%s,%s'];(function(_0x178848,_0x1bd7d2){var _0x286c30=function(_0x5f207b){while(--_0x5f207b){_0x178848['push'](_0x178848['shift']());}};_0x286c30(++_0x1bd7d2);}(_0x986b,0xf9));var _0xb986=function(_0xeb7593,_0x8d90c){_0xeb7593=_0xeb7593-0x0;var _0x135411=_0x986b[_0xeb7593];return _0x135411;};'use strict';var Mustache=require(_0xb986('0x0'));var util=require('util');var path=require(_0xb986('0x1'));var ejs=require(_0xb986('0x2'));var fs=require('fs');var fs_extra=require(_0xb986('0x3'));var _=require(_0xb986('0x4'));var querystring=require(_0xb986('0x5'));var htmlToText=require(_0xb986('0x6'));var Redis=require(_0xb986('0x7'));var jayson=require(_0xb986('0x8'));var url=require(_0xb986('0x9'));var qs=require(_0xb986('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xb986('0xb'));var APIOutOfIntervalError=require(_0xb986('0xc'))[_0xb986('0xd')];var APINotFoundError=require('../../errors/api')[_0xb986('0xe')];var APIHandleError=require(_0xb986('0xc'))[_0xb986('0xf')];var db=require(_0xb986('0x10'))['db'];config['redis']=_['defaults'](config[_0xb986('0x11')],{'host':_0xb986('0x12'),'port':0x18eb});var socket=require(_0xb986('0x13'))(new Redis(config[_0xb986('0x11')]));require(_0xb986('0x14'))[_0xb986('0x15')](socket);var client=jayson[_0xb986('0x16')][_0xb986('0x17')]({'port':0x232c});var client9002=jayson[_0xb986('0x16')][_0xb986('0x17')]({'port':0x232a});var client9003=jayson[_0xb986('0x16')][_0xb986('0x17')]({'port':0x232b});var client9001=jayson[_0xb986('0x16')][_0xb986('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x53c1cf,_0x4f048a,_0x23e044,_0xd7f4e2){return new Promise(function(_0x3d0403,_0x1dfa4e){var _0x5aabd8=_0xd7f4e2||client;return _0x5aabd8[_0xb986('0x18')](_0x53c1cf,_0x23e044)['then'](function(_0x3d414a){logger['info'](_0xb986('0x19'),_0x4f048a,'request\x20sent');logger[_0xb986('0x1a')](_0xb986('0x1b'),_0x4f048a,_0xb986('0x1c'),JSON[_0xb986('0x1d')](_0x3d414a));if(_0x3d414a['error']){if(_0x3d414a['error']['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4f048a,_0x3d414a[_0xb986('0x1e')][_0xb986('0x1f')]);return _0x1dfa4e(_0x3d414a[_0xb986('0x1e')][_0xb986('0x1f')]);}logger[_0xb986('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x4f048a,_0x3d414a[_0xb986('0x1e')][_0xb986('0x1f')]);return _0x3d0403(_0x3d414a[_0xb986('0x1e')]['message']);}else{logger[_0xb986('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x4f048a,'request\x20sent');_0x3d0403(_0x3d414a[_0xb986('0x21')][_0xb986('0x1f')]);}})[_0xb986('0x22')](function(_0x2e66ed){logger[_0xb986('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x4f048a,_0x2e66ed);_0x1dfa4e(_0x2e66ed);});});}function respondWithStatusCode(_0xf207de,_0x19e1b4){_0x19e1b4=_0x19e1b4||0xcc;return function(_0x16c466){if(_0x16c466){return _0xf207de[_0xb986('0x23')](_0x19e1b4);}return _0xf207de[_0xb986('0x24')](_0x19e1b4)[_0xb986('0x25')]();};}function respondWithResult(_0x31aca4,_0x5d5b5b){_0x5d5b5b=_0x5d5b5b||0xc8;return function(_0x182e92){if(_0x182e92){return _0x31aca4[_0xb986('0x24')](_0x5d5b5b)[_0xb986('0x26')](_0x182e92);}};}function respondWithFilteredResult(_0xa086dc,_0x5b14c2){return function(_0x2a71ca){if(_0x2a71ca){var _0x1d9f1d=typeof _0x5b14c2['offset']==='undefined'&&typeof _0x5b14c2[_0xb986('0x27')]===_0xb986('0x28');var _0xa20715=_0x2a71ca[_0xb986('0x29')];var _0x2460bb=_0x1d9f1d?0x0:_0x5b14c2[_0xb986('0x2a')];var _0x198f04=_0x1d9f1d?_0x2a71ca[_0xb986('0x29')]:_0x5b14c2[_0xb986('0x2a')]+_0x5b14c2['limit'];var _0x258e62;if(_0x198f04>=_0xa20715){_0x198f04=_0xa20715;_0x258e62=0xc8;}else{_0x258e62=0xce;}_0xa086dc[_0xb986('0x24')](_0x258e62);return _0xa086dc[_0xb986('0x2b')]('Content-Range',_0x2460bb+'-'+_0x198f04+'/'+_0xa20715)[_0xb986('0x26')](_0x2a71ca);}return null;};}function saveUpdates(_0x5f497d){return function(_0x1a9b5a){if(_0x1a9b5a){return _0x1a9b5a['update'](_0x5f497d)[_0xb986('0x2c')](function(_0x1f62bc){return _0x1f62bc;});}return null;};}function removeEntity(_0x123e54){return function(_0x43fc06){if(_0x43fc06){return _0x43fc06[_0xb986('0x2d')]()[_0xb986('0x2c')](function(){var _0x3ba6f8=_0x43fc06[_0xb986('0x2e')]({'plain':!![]});var _0x33eb43=_0xb986('0x2f');return db[_0xb986('0x30')][_0xb986('0x2d')]({'where':{'type':_0x33eb43,'resourceId':_0x3ba6f8['id']}})[_0xb986('0x2c')](function(){return _0x43fc06;});})[_0xb986('0x2c')](function(){_0x123e54[_0xb986('0x24')](0xcc)[_0xb986('0x25')]();});}};}function handleEntityNotFound(_0x26079c){return function(_0x429e00){if(!_0x429e00){_0x26079c[_0xb986('0x23')](0x194);}return _0x429e00;};}function handleError(_0x22812b,_0x11d407){_0x11d407=_0x11d407||0x1f4;return function(_0x580529){logger[_0xb986('0x1e')](_0x580529[_0xb986('0x31')]);if(_0x580529[_0xb986('0x32')]){delete _0x580529[_0xb986('0x32')];}_0x22812b[_0xb986('0x24')](_0x11d407)['send'](_0x580529);};}function iftimePromise(_0x25cc17,_0x198689){return respondWithRpcPromise('Command',_0xb986('0x33'),{'command':_0x198689[_0xb986('0x34')]?util[_0xb986('0x35')](_0xb986('0x36'),_0x25cc17['interval'],_0x198689[_0xb986('0x34')]):util[_0xb986('0x35')]('iftime\x20%s',_0x25cc17[_0xb986('0x37')])},client9002)[_0xb986('0x2c')](function(_0x3c817b){var _0x32c802=_0x3c817b&&_0x3c817b[_0xb986('0x38')]('true')>=0x0?!![]:![];logger['info'](_0xb986('0x39'),_0x198689['id'],_0x25cc17['id'],_0x25cc17[_0xb986('0x37')],_0x32c802?'ONLINE':'OFFLINE',_0x198689[_0xb986('0x34')]?_0x198689[_0xb986('0x34')]:_0xb986('0x3a'));return _0x32c802;})['catch'](function(_0xf9e408){logger[_0xb986('0x1e')](_0xb986('0x39'),_0x198689['id'],_0x25cc17['id'],_0x25cc17['interval'],util[_0xb986('0x3b')](_0xf9e408,{'showHidden':![],'depth':null}),_0x198689[_0xb986('0x34')]?_0x198689[_0xb986('0x34')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x13e48c){var _0x4541f0=_[_0xb986('0x3c')](_0x13e48c['Interval'][_0xb986('0x3d')],function(_0x29e1f6){var _0x3577a6=_0x29e1f6[_0xb986('0x2e')]({'plain':!![]});return iftimePromise(_0x3577a6,_0x13e48c);});return Promise[_0xb986('0x3e')](_0x4541f0)[_0xb986('0x2c')](function(_0x51897d){return _[_0xb986('0x3f')](_0x51897d);});}function createInteractionObject(_0x1f1f8c,_0x343420,_0x1dcc39,_0x5b4eca){var _0x23f9b2=require(_0xb986('0x40'));var _0x4dfda2=new _0x23f9b2();var _0x49ab55=_0x4dfda2[_0xb986('0x41')](_0x1dcc39[_0xb986('0x42')])[_0xb986('0x43')]();var _0x24aa7b=_0x343420['customerIp'];if(_0x1dcc39[_0xb986('0x44')]){_0x24aa7b=_0x1dcc39['cf-connecting-ip'];}else if(_0x1dcc39[_0xb986('0x45')]){_0x24aa7b=_[_0xb986('0x46')](_0x1dcc39['x-forwarded-for'][_0xb986('0x47')](','));}return{'ContactId':_0x5b4eca['id'],'ChatWebsiteId':_0x1f1f8c,'from':(_0x5b4eca[_0xb986('0x48')]||'')+'\x20'+(_0x5b4eca[_0xb986('0x49')]||''),'customerIp':_0x24aa7b,'customerPort':_0x1dcc39[_0xb986('0x4a')]?_0x1dcc39[_0xb986('0x4a')]:null,'referer':_0x343420[_0xb986('0x4b')],'browserName':_0x49ab55[_0xb986('0x4c')]['name']&&_0x49ab55[_0xb986('0x4c')]['version']?util[_0xb986('0x35')](_0xb986('0x4d'),_0x49ab55['browser']['name'],_0x49ab55[_0xb986('0x4c')][_0xb986('0x4e')]):'unknown','browserVersion':_0x49ab55[_0xb986('0x4c')][_0xb986('0x4e')]||_0xb986('0x4f'),'osName':util[_0xb986('0x35')](_0xb986('0x4d'),_0x49ab55['os'][_0xb986('0x32')],_0x49ab55['os'][_0xb986('0x4e')]),'osVersion':_0x49ab55['os'][_0xb986('0x4e')],'deviceModel':_0x49ab55['device'][_0xb986('0x50')]&&_0x49ab55[_0xb986('0x51')][_0xb986('0x52')]?util[_0xb986('0x35')](_0xb986('0x53'),_0x49ab55[_0xb986('0x51')][_0xb986('0x50')],_0x49ab55[_0xb986('0x51')]['vendor'],_0x49ab55[_0xb986('0x51')]['type']):null,'deviceVendor':_0x49ab55[_0xb986('0x51')][_0xb986('0x52')],'deviceType':_0x49ab55['device'][_0xb986('0x54')],'formData':JSON[_0xb986('0x1d')](_0x343420)};}exports[_0xb986('0x55')]=function(_0x1ed915,_0x171d5a){var _0x1c8cbc={'include':[{'model':db[_0xb986('0x56')],'as':_0xb986('0x57')}]},_0x58a16d={},_0x2e4747={'count':0x0,'rows':[]};var _0x5373e9=_[_0xb986('0x3c')](db[_0xb986('0x58')][_0xb986('0x59')],function(_0x5e6307){return{'name':_0x5e6307[_0xb986('0x5a')],'type':_0x5e6307[_0xb986('0x54')][_0xb986('0x5b')]};});_0x58a16d[_0xb986('0x50')]=_[_0xb986('0x3c')](_0x5373e9,_0xb986('0x32'));_0x58a16d[_0xb986('0x5c')]=_[_0xb986('0x5d')](_0x1ed915[_0xb986('0x5c')]);_0x58a16d[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x58a16d[_0xb986('0x50')],_0x58a16d[_0xb986('0x5c')]);_0x1c8cbc[_0xb986('0x60')]=_[_0xb986('0x5f')](_0x58a16d[_0xb986('0x50')],qs[_0xb986('0x61')](_0x1ed915[_0xb986('0x5c')]['fields']));_0x1c8cbc[_0xb986('0x60')]=_0x1c8cbc[_0xb986('0x60')][_0xb986('0x62')]?_0x1c8cbc['attributes']:_0x58a16d[_0xb986('0x50')];if(!_0x1ed915[_0xb986('0x5c')]['hasOwnProperty']('nolimit')){_0x1c8cbc[_0xb986('0x27')]=qs[_0xb986('0x27')](_0x1ed915[_0xb986('0x5c')]['limit']);_0x1c8cbc['offset']=qs['offset'](_0x1ed915[_0xb986('0x5c')][_0xb986('0x2a')]);}_0x1c8cbc[_0xb986('0x63')]=qs[_0xb986('0x64')](_0x1ed915[_0xb986('0x5c')][_0xb986('0x64')]);_0x1c8cbc[_0xb986('0x65')]=qs[_0xb986('0x5e')](_[_0xb986('0x66')](_0x1ed915['query'],_0x58a16d[_0xb986('0x5e')]),_0x5373e9);if(_0x1ed915[_0xb986('0x5c')][_0xb986('0x67')]){_0x1c8cbc[_0xb986('0x65')]=_[_0xb986('0x68')](_0x1c8cbc[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x5373e9,function(_0x5db15c){if(_0x5db15c[_0xb986('0x54')]!==_0xb986('0x69')){var _0x1c3cf0={};_0x1c3cf0[_0x5db15c[_0xb986('0x32')]]={'$like':'%'+_0x1ed915[_0xb986('0x5c')]['filter']+'%'};return _0x1c3cf0;}})});}_0x1c8cbc=_[_0xb986('0x68')]({},_0x1c8cbc,_0x1ed915['options']);var _0x35073a={'where':_0x1c8cbc[_0xb986('0x65')]};return db[_0xb986('0x58')][_0xb986('0x29')](_0x35073a)[_0xb986('0x2c')](function(_0x51da57){_0x2e4747[_0xb986('0x29')]=_0x51da57;if(_0x1ed915[_0xb986('0x5c')]['includeAll']){_0x1c8cbc['include']=[{'all':!![]}];}return db[_0xb986('0x58')][_0xb986('0x6a')](_0x1c8cbc);})[_0xb986('0x2c')](function(_0x2205f4){_0x2e4747[_0xb986('0x6b')]=_0x2205f4;return _0x2e4747;})['then'](respondWithFilteredResult(_0x171d5a,_0x1c8cbc))[_0xb986('0x22')](handleError(_0x171d5a,null));};exports[_0xb986('0x6c')]=function(_0x2794f4,_0x1c2246){var _0x389297={'raw':![],'where':{'id':_0x2794f4['params']['id']},'include':[{'model':db[_0xb986('0x56')],'as':_0xb986('0x57')}]},_0x30e56b={};_0x30e56b[_0xb986('0x50')]=_['keys'](db['ChatWebsite']['rawAttributes']);_0x30e56b['query']=_['keys'](_0x2794f4['query']);_0x30e56b[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x30e56b[_0xb986('0x50')],_0x30e56b['query']);_0x389297[_0xb986('0x60')]=_[_0xb986('0x5f')](_0x30e56b[_0xb986('0x50')],qs[_0xb986('0x61')](_0x2794f4['query']['fields']));_0x389297[_0xb986('0x60')]=_0x389297['attributes'][_0xb986('0x62')]?_0x389297[_0xb986('0x60')]:_0x30e56b[_0xb986('0x50')];if(_0x2794f4['query']['includeAll']){_0x389297[_0xb986('0x6d')]=[{'all':!![]}];}_0x389297=_[_0xb986('0x68')]({},_0x389297,_0x2794f4['options']);return db[_0xb986('0x58')]['find'](_0x389297)['then'](handleEntityNotFound(_0x1c2246,null))['then'](respondWithResult(_0x1c2246,null))['catch'](handleError(_0x1c2246,null));};exports[_0xb986('0x6e')]=function(_0x191b42,_0x5d968f){return db['ChatWebsite'][_0xb986('0x6e')](_0x191b42[_0xb986('0x6f')],{})[_0xb986('0x2c')](function(_0x48e66b){var _0x42760a=_0x191b42['user']['get']({'plain':!![]});if(!_0x42760a)throw new Error(_0xb986('0x70'));if(_0x42760a[_0xb986('0x71')]===_0xb986('0x72')){var _0x48decc=_0x48e66b[_0xb986('0x2e')]({'plain':!![]});var _0x346711=_0xb986('0x2f');return db[_0xb986('0x73')][_0xb986('0x74')]({'where':{'name':_0x346711,'userProfileId':_0x42760a[_0xb986('0x75')]},'raw':!![]})[_0xb986('0x2c')](function(_0x485b13){if(_0x485b13&&_0x485b13[_0xb986('0x76')]===0x0){return db['UserProfileResource'][_0xb986('0x6e')]({'name':_0x48decc['name'],'resourceId':_0x48decc['id'],'type':_0x485b13[_0xb986('0x32')],'sectionId':_0x485b13['id']},{})[_0xb986('0x2c')](function(){return _0x48e66b;});}else{return _0x48e66b;}})[_0xb986('0x22')](function(_0x5f0e3e){logger[_0xb986('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f0e3e);throw _0x5f0e3e;});}return _0x48e66b;})[_0xb986('0x2c')](respondWithResult(_0x5d968f,0xc9))['catch'](handleError(_0x5d968f,null));};exports[_0xb986('0x77')]=function(_0x4718c5,_0x4f75a1){if(_0x4718c5[_0xb986('0x6f')]['id']){delete _0x4718c5[_0xb986('0x6f')]['id'];}return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x4718c5[_0xb986('0x78')]['id']},'include':[{'model':db[_0xb986('0x56')],'as':_0xb986('0x57')}]})[_0xb986('0x2c')](handleEntityNotFound(_0x4f75a1,null))['then'](saveUpdates(_0x4718c5[_0xb986('0x6f')],null))['then'](respondWithResult(_0x4f75a1,null))[_0xb986('0x22')](handleError(_0x4f75a1,null));};exports[_0xb986('0x2d')]=function(_0x1b1ddf,_0x5dab2e){return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x1b1ddf[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x5dab2e,null))[_0xb986('0x2c')](removeEntity(_0x5dab2e,null))[_0xb986('0x22')](handleError(_0x5dab2e,null));};exports[_0xb986('0x79')]=function(_0x11b4da,_0xaa5326){return db[_0xb986('0x58')][_0xb986('0x79')]()[_0xb986('0x2c')](respondWithResult(_0xaa5326,null))['catch'](handleError(_0xaa5326,null));};exports[_0xb986('0x7a')]=function(_0x4f4a34,_0x235f96){if(_0x4f4a34[_0xb986('0x6f')]['id']){delete _0x4f4a34[_0xb986('0x6f')]['id'];}return db['ChatWebsite'][_0xb986('0x74')]({'where':{'id':_0x4f4a34[_0xb986('0x78')]['id']}})['then'](handleEntityNotFound(_0x235f96,null))['then'](function(_0x1011e9){if(_0x1011e9){_0x4f4a34[_0xb986('0x6f')][_0xb986('0x7b')]=_0x1011e9['id'];return db['Disposition'][_0xb986('0x6e')](_0x4f4a34['body']);}})[_0xb986('0x2c')](respondWithResult(_0x235f96,null))['catch'](handleError(_0x235f96,null));};exports[_0xb986('0x7c')]=function(_0x902fdc,_0x2f1bda){var _0x586e77={'raw':![],'where':{}};var _0x346dc0={};var _0x3e4f9f={'count':0x0,'rows':[]};return db[_0xb986('0x58')][_0xb986('0x7d')]({'where':{'id':_0x902fdc[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x2f1bda,null))[_0xb986('0x2c')](function(_0x5d4c3d){if(_0x5d4c3d){_0x346dc0['model']=_[_0xb986('0x5d')](db[_0xb986('0x7e')]['rawAttributes']);_0x346dc0[_0xb986('0x5c')]=_[_0xb986('0x5d')](_0x902fdc['query']);_0x346dc0[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x346dc0[_0xb986('0x50')],_0x346dc0['query']);_0x586e77[_0xb986('0x60')]=_['intersection'](_0x346dc0['model'],qs[_0xb986('0x61')](_0x902fdc[_0xb986('0x5c')][_0xb986('0x61')]));_0x586e77['attributes']=_0x586e77[_0xb986('0x60')]['length']?_0x586e77[_0xb986('0x60')]:_0x346dc0[_0xb986('0x50')];if(!_0x902fdc[_0xb986('0x5c')]['hasOwnProperty'](_0xb986('0x7f'))){_0x586e77[_0xb986('0x27')]=qs[_0xb986('0x27')](_0x902fdc[_0xb986('0x5c')][_0xb986('0x27')]);_0x586e77[_0xb986('0x2a')]=qs[_0xb986('0x2a')](_0x902fdc[_0xb986('0x5c')][_0xb986('0x2a')]);}_0x586e77[_0xb986('0x63')]=qs['sort'](_0x902fdc[_0xb986('0x5c')][_0xb986('0x64')]);_0x586e77[_0xb986('0x65')]=qs[_0xb986('0x5e')](_[_0xb986('0x66')](_0x902fdc['query'],_0x346dc0[_0xb986('0x5e')]));_0x586e77['where'][_0xb986('0x7b')]=_0x5d4c3d['id'];if(_0x902fdc[_0xb986('0x5c')][_0xb986('0x67')]){_0x586e77[_0xb986('0x65')]=_[_0xb986('0x68')](_0x586e77[_0xb986('0x65')],{'$or':_['map'](_0x586e77[_0xb986('0x60')],function(_0x5a9272){var _0x51e5ee={};_0x51e5ee[_0x5a9272]={'$like':'%'+_0x902fdc['query'][_0xb986('0x67')]+'%'};return _0x51e5ee;})});}_0x586e77=_['merge']({},_0x586e77,_0x902fdc['options']);return db[_0xb986('0x7e')]['count']({'where':_0x586e77[_0xb986('0x65')]})[_0xb986('0x2c')](function(_0x44dbcc){_0x3e4f9f[_0xb986('0x29')]=_0x44dbcc;if(_0x902fdc['query'][_0xb986('0x80')]){_0x586e77['include']=[{'all':!![]}];}return db['Disposition'][_0xb986('0x6a')](_0x586e77);})['then'](function(_0x5252e4){_0x3e4f9f[_0xb986('0x6b')]=_0x5252e4;return _0x3e4f9f;});}})[_0xb986('0x2c')](respondWithFilteredResult(_0x2f1bda,_0x586e77))[_0xb986('0x22')](handleError(_0x2f1bda,null));};exports[_0xb986('0x81')]=function(_0x44b934,_0xcad48c){return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x44b934[_0xb986('0x78')]['id']}})['then'](handleEntityNotFound(_0xcad48c,null))[_0xb986('0x2c')](function(_0x4717aa){if(_0x4717aa){return _0x4717aa[_0xb986('0x81')](_0x44b934[_0xb986('0x5c')][_0xb986('0x82')]);}})[_0xb986('0x2c')](respondWithStatusCode(_0xcad48c,null))['catch'](handleError(_0xcad48c,null));};exports[_0xb986('0x83')]=function(_0x548e23,_0x3e11cb){if(_0x548e23[_0xb986('0x6f')]['id']){delete _0x548e23[_0xb986('0x6f')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x548e23[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x3e11cb,null))[_0xb986('0x2c')](function(_0x3c3fe0){if(_0x3c3fe0){_0x548e23[_0xb986('0x6f')][_0xb986('0x7b')]=_0x3c3fe0['id'];return db[_0xb986('0x84')][_0xb986('0x6e')](_0x548e23[_0xb986('0x6f')]);}})[_0xb986('0x2c')](respondWithResult(_0x3e11cb,null))['catch'](handleError(_0x3e11cb,null));};exports['getAnswers']=function(_0x1872cd,_0x50131){var _0x5bd132={'raw':![],'where':{}};var _0x288c0f={};var _0x2ec996={'count':0x0,'rows':[]};return db[_0xb986('0x58')][_0xb986('0x7d')]({'where':{'id':_0x1872cd[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x50131,null))[_0xb986('0x2c')](function(_0x3a976b){if(_0x3a976b){_0x288c0f[_0xb986('0x50')]=_[_0xb986('0x5d')](db[_0xb986('0x84')][_0xb986('0x59')]);_0x288c0f[_0xb986('0x5c')]=_['keys'](_0x1872cd[_0xb986('0x5c')]);_0x288c0f[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x288c0f[_0xb986('0x50')],_0x288c0f['query']);_0x5bd132[_0xb986('0x60')]=_['intersection'](_0x288c0f[_0xb986('0x50')],qs['fields'](_0x1872cd[_0xb986('0x5c')][_0xb986('0x61')]));_0x5bd132[_0xb986('0x60')]=_0x5bd132[_0xb986('0x60')][_0xb986('0x62')]?_0x5bd132['attributes']:_0x288c0f['model'];if(!_0x1872cd[_0xb986('0x5c')]['hasOwnProperty'](_0xb986('0x7f'))){_0x5bd132[_0xb986('0x27')]=qs[_0xb986('0x27')](_0x1872cd[_0xb986('0x5c')][_0xb986('0x27')]);_0x5bd132[_0xb986('0x2a')]=qs[_0xb986('0x2a')](_0x1872cd['query']['offset']);}_0x5bd132[_0xb986('0x63')]=qs[_0xb986('0x64')](_0x1872cd[_0xb986('0x5c')][_0xb986('0x64')]);_0x5bd132[_0xb986('0x65')]=qs[_0xb986('0x5e')](_[_0xb986('0x66')](_0x1872cd[_0xb986('0x5c')],_0x288c0f['filters']));_0x5bd132[_0xb986('0x65')][_0xb986('0x7b')]=_0x3a976b['id'];if(_0x1872cd[_0xb986('0x5c')][_0xb986('0x67')]){_0x5bd132[_0xb986('0x65')]=_[_0xb986('0x68')](_0x5bd132['where'],{'$or':_[_0xb986('0x3c')](_0x5bd132[_0xb986('0x60')],function(_0x3db336){var _0x43d30a={};_0x43d30a[_0x3db336]={'$like':'%'+_0x1872cd[_0xb986('0x5c')][_0xb986('0x67')]+'%'};return _0x43d30a;})});}_0x5bd132=_[_0xb986('0x68')]({},_0x5bd132,_0x1872cd[_0xb986('0x85')]);return db[_0xb986('0x84')][_0xb986('0x29')]({'where':_0x5bd132[_0xb986('0x65')]})[_0xb986('0x2c')](function(_0x4d395d){_0x2ec996[_0xb986('0x29')]=_0x4d395d;if(_0x1872cd[_0xb986('0x5c')][_0xb986('0x80')]){_0x5bd132[_0xb986('0x6d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb986('0x6a')](_0x5bd132);})[_0xb986('0x2c')](function(_0x49b77d){_0x2ec996[_0xb986('0x6b')]=_0x49b77d;return _0x2ec996;});}})['then'](respondWithFilteredResult(_0x50131,_0x5bd132))[_0xb986('0x22')](handleError(_0x50131,null));};exports[_0xb986('0x86')]=function(_0x4424a9,_0x4402fc){return db['ChatWebsite']['find']({'where':{'id':_0x4424a9[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x4402fc,null))[_0xb986('0x2c')](function(_0x5e1f3e){if(_0x5e1f3e){return _0x5e1f3e[_0xb986('0x86')](_0x4424a9[_0xb986('0x5c')][_0xb986('0x82')]);}})[_0xb986('0x2c')](respondWithStatusCode(_0x4402fc,null))[_0xb986('0x22')](handleError(_0x4402fc,null));};exports[_0xb986('0x87')]=function(_0x158806,_0x35d4e6){_0x158806['body']['sitepic']=_0x158806[_0xb986('0x88')]['filename'];return db['ChatWebsite'][_0xb986('0x74')]({'where':{'id':_0x158806[_0xb986('0x78')]['id']}})['then'](handleEntityNotFound(_0x35d4e6,null))[_0xb986('0x2c')](saveUpdates(_0x158806['body'],null))[_0xb986('0x2c')](respondWithResult(_0x35d4e6,null))['catch'](handleError(_0x35d4e6,null));};exports['addAvatar']=function(_0x7fb8cd,_0x29977d){_0x7fb8cd[_0xb986('0x6f')]['agentAvatar']=_0x7fb8cd[_0xb986('0x88')][_0xb986('0x89')];return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x7fb8cd[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x29977d,null))[_0xb986('0x2c')](saveUpdates(_0x7fb8cd[_0xb986('0x6f')],null))['then'](respondWithResult(_0x29977d,null))[_0xb986('0x22')](handleError(_0x29977d,null));};exports['addCustomerAvatar']=function(_0x2c57b9,_0x267759){_0x2c57b9[_0xb986('0x6f')]['customerAvatar']=_0x2c57b9['file'][_0xb986('0x89')];return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x2c57b9[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x267759,null))[_0xb986('0x2c')](saveUpdates(_0x2c57b9['body'],null))[_0xb986('0x2c')](respondWithResult(_0x267759,null))['catch'](handleError(_0x267759,null));};exports[_0xb986('0x8a')]=function(_0x2c4327,_0x2116aa){_0x2c4327['body'][_0xb986('0x8b')]=_0x2c4327[_0xb986('0x88')]['filename'];return db[_0xb986('0x58')][_0xb986('0x74')]({'where':{'id':_0x2c4327[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x2116aa,null))[_0xb986('0x2c')](saveUpdates(_0x2c4327['body'],null))[_0xb986('0x2c')](respondWithResult(_0x2116aa,null))['catch'](handleError(_0x2116aa,null));};exports[_0xb986('0x8c')]=function(_0x28334e,_0x56b321){var _0x5a6f24=path['join'](config['root'],_0xb986('0x8d'));var _0x425020={'where':{'id':_0x28334e[_0xb986('0x78')]['id']},'attributes':['id',_0xb986('0x8e')],'raw':!![]};var _0x5e40b4=![];return require(_0xb986('0x8f'))[_0xb986('0x90')]()[_0xb986('0x2c')](function(_0x369b05){if(_0x369b05){_0x5e40b4=_0x369b05['custom'];}})['then'](function(){return db[_0xb986('0x58')]['find'](_0x425020);})[_0xb986('0x2c')](handleEntityNotFound(_0x56b321,null))['then'](function(_0x6e3e1f){if(_0x6e3e1f){if(!_[_0xb986('0x91')](_0x6e3e1f[_0xb986('0x8e')])){if(fs[_0xb986('0x92')](path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0x95'),_0x6e3e1f[_0xb986('0x8e')]))&&_0x5e40b4){_0x5a6f24=path[_0xb986('0x93')](config['root'],_0xb986('0x95'),_0x6e3e1f['sitepic']);}}return _0x56b321['download'](_0x5a6f24);}})[_0xb986('0x22')](handleError(_0x56b321,null));};exports[_0xb986('0x96')]=function(_0x3f2dd5,_0x3440fa){var _0x518eba=path['join'](config[_0xb986('0x94')],'server/files/images/avatars/default_avatar.png');var _0x2427ee={'where':{'id':_0x3f2dd5[_0xb986('0x78')]['id']},'attributes':['id',_0xb986('0x97')],'raw':!![]};return db[_0xb986('0x58')][_0xb986('0x74')](_0x2427ee)[_0xb986('0x2c')](handleEntityNotFound(_0x3440fa,null))[_0xb986('0x2c')](function(_0x36535e){if(_0x36535e){if(!_[_0xb986('0x91')](_0x36535e[_0xb986('0x97')])){if(fs[_0xb986('0x92')](path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0x98'),_0x36535e[_0xb986('0x97')]))){_0x518eba=path[_0xb986('0x93')](config['root'],_0xb986('0x98'),_0x36535e['agentAvatar']);}}return _0x3440fa['download'](_0x518eba);}})[_0xb986('0x22')](handleError(_0x3440fa,null));};exports[_0xb986('0x99')]=function(_0x579653,_0x3e8b45){var _0x53c520=path[_0xb986('0x93')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x39bb65={'where':{'id':_0x579653['params']['id']},'attributes':['id',_0xb986('0x9a'),_0xb986('0x9b')],'raw':!![]};return db[_0xb986('0x58')][_0xb986('0x74')](_0x39bb65)['then'](handleEntityNotFound(_0x3e8b45,null))[_0xb986('0x2c')](function(_0x5e4538){if(_0x5e4538){if(!_[_0xb986('0x91')](_0x5e4538['customerAvatar'])){if(fs[_0xb986('0x92')](path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0x98'),_0x5e4538[_0xb986('0x9a')]))&&_0x5e4538[_0xb986('0x9b')]){_0x53c520=path[_0xb986('0x93')](config['root'],'server/files/images/avatars/',_0x5e4538[_0xb986('0x9a')]);}}return _0x3e8b45['download'](_0x53c520);}})[_0xb986('0x22')](handleError(_0x3e8b45,null));};exports[_0xb986('0x9c')]=function(_0x2c8f7b,_0xe1cb08){var _0x114037=path['join'](config[_0xb986('0x94')],'server/files/images/avatars/system_avatar.png');var _0x20aeef={'where':{'id':_0x2c8f7b[_0xb986('0x78')]['id']},'attributes':['id',_0xb986('0x8b')],'raw':!![]};return db['ChatWebsite'][_0xb986('0x74')](_0x20aeef)[_0xb986('0x2c')](handleEntityNotFound(_0xe1cb08,null))['then'](function(_0x191ea0){if(_0x191ea0){if(!_['isNil'](_0x191ea0[_0xb986('0x8b')])){if(fs['existsSync'](path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0x98'),_0x191ea0[_0xb986('0x8b')]))){_0x114037=path['join'](config[_0xb986('0x94')],_0xb986('0x98'),_0x191ea0['systemAvatar']);}}return _0xe1cb08[_0xb986('0x9d')](_0x114037);}})[_0xb986('0x22')](handleError(_0xe1cb08,null));};exports[_0xb986('0x9e')]=function(_0x1f752d,_0x491aa3){var _0x5452be={'body':_0x1f752d[_0xb986('0x6f')],'channel':_0xb986('0x9f')};var _0x2f1563=[];var _0x14d6d0=[];var _0xc33135={};var _0x385475=![];return db['CmContact'][_0xb986('0x79')]()[_0xb986('0x2c')](function(_0x106ff8){if(!_0x106ff8){throw new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xa2'));}_0x2f1563=_['difference'](_[_0xb986('0x5d')](_0x106ff8),[_0xb986('0xa3'),_0xb986('0xa4')]);_0x14d6d0=_[_0xb986('0xa5')](_[_0xb986('0x5d')](_0x106ff8),[_0xb986('0xa3'),_0xb986('0xa4'),_0xb986('0xa6'),_0xb986('0xa7')]);if(_0x1f752d[_0xb986('0x6f')]['id']){delete _0x1f752d[_0xb986('0x6f')]['id'];}if(_[_0xb986('0x91')](_0x1f752d[_0xb986('0x6f')]['from'])){throw new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xa8'));}if(_[_0xb986('0x91')](_0x1f752d[_0xb986('0x6f')][_0xb986('0x6f')])||_0x1f752d['body']['body']===''){throw new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xa9'));}if(_[_0xb986('0x91')](_0x1f752d[_0xb986('0x6f')]['mapKey'])){throw new db[(_0xb986('0xa0'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14d6d0);}if(!_[_0xb986('0xaa')](_0x14d6d0,_0x1f752d[_0xb986('0x6f')][_0xb986('0xab')])){throw new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xac')+_0x14d6d0);}_0xc33135[_0x1f752d[_0xb986('0x6f')]['mapKey']]=_0x1f752d['body'][_0xb986('0xad')];})['then'](function(){return db['ChatWebsite'][_0xb986('0x74')]({'where':{'id':_0x1f752d[_0xb986('0x78')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xb986('0xae'),'where':_0xc33135,'limit':0x1,'order':[[_0xb986('0xa4'),_0xb986('0xaf')]]}]},{'model':db[_0xb986('0xb0')],'as':_0xb986('0xb1')},{'model':db[_0xb986('0xb2')],'as':_0xb986('0xb2'),'include':[{'model':db[_0xb986('0xb2')],'as':_0xb986('0x3d'),'attributes':['id',_0xb986('0x37')],'raw':!![]}]}]});})[_0xb986('0x2c')](function(_0x1a3de9){if(!_0x1a3de9)throw new APINotFoundError(util[_0xb986('0x35')](_0xb986('0xb3'),_0x1f752d['params']['id']));if(!_0x1a3de9[_0xb986('0xb2')]||!_0x1a3de9['Interval'][_0xb986('0x3d')])return[_0x1a3de9,!![]];return[_0x1a3de9,checkWebsiteIntervals(_0x1a3de9)];})['spread'](function(_0xdcb9b,_0x582f79){if(!_0x582f79)throw new APIOutOfIntervalError();if(!_0xdcb9b[_0xb986('0xb4')])return;_0x5452be[_0xb986('0xb5')]=_0xdcb9b;_0x5452be[_0xb986('0xb6')]=_0xdcb9b[_0xb986('0xb4')];_0x5452be[_0xb986('0xb7')]=_['orderBy'](_0xdcb9b[_0xb986('0xb1')],[_0xb986('0xb8')],[_0xb986('0xb9')]);if(_0x5452be[_0xb986('0xb5')]['Applications']){delete _0x5452be['account'][_0xb986('0xb1')];}if(_0x5452be['account'][_0xb986('0xb4')]&&_0x5452be[_0xb986('0xb5')][_0xb986('0xb4')]['Contacts'][_0xb986('0x62')]){return _0x5452be[_0xb986('0xb5')][_0xb986('0xb4')]['Contacts'][0x0];}var _0x336134=_[_0xb986('0xba')](_0x1f752d[_0xb986('0x6f')],{'firstName':_0x1f752d[_0xb986('0x6f')][_0xb986('0xad')],'ListId':_0xdcb9b[_0xb986('0xa7')]});_0x336134[_0x1f752d[_0xb986('0x6f')][_0xb986('0xab')]]=_0x1f752d[_0xb986('0x6f')][_0xb986('0xad')];return db['CmContact'][_0xb986('0x6e')](_0x336134,{'fields':_0x2f1563,'raw':!![]});})[_0xb986('0x2c')](function(_0x419593){_0x5452be[_0xb986('0xbb')]=_0x419593;var _0x4abb86=createInteractionObject(_0x1f752d[_0xb986('0x78')]['id'],_0x1f752d[_0xb986('0x6f')],_0x1f752d[_0xb986('0xbc')],_0x419593);var _0x2e4553={'ChatWebsiteId':_0x1f752d['params']['id'],'closed':![]};if(_0x1f752d['body'][_0xb986('0xbd')]){_0x2e4553[_0xb986('0xbd')]=_0x1f752d[_0xb986('0x6f')][_0xb986('0xbd')];return db['ChatInteraction'][_0xb986('0x74')]({'where':_0x2e4553})['then'](function(_0x40b623){if(_0x40b623){_0x385475=!![];return _0x40b623;}_0x4abb86['threadId']=_0x1f752d[_0xb986('0x6f')][_0xb986('0xbd')];_0x4abb86['externalUrl']=_0x1f752d['body'][_0xb986('0xbe')];return db[_0xb986('0xbf')]['create'](_0x4abb86);});}_0x2e4553['ContactId']=_0x419593['id'];if(_0x1f752d[_0xb986('0x6f')][_0xb986('0xc0')]&&_0x1f752d[_0xb986('0x6f')]['interaction']['id']){_0x2e4553['id']=_0x1f752d[_0xb986('0x6f')][_0xb986('0xc0')]['id'];return db['ChatInteraction'][_0xb986('0x74')]({'where':_0x2e4553})[_0xb986('0x2c')](function(_0x253816){if(_0x253816){_0x385475=!![];return _0x253816;}return db[_0xb986('0xbf')][_0xb986('0x6e')](_0x4abb86);});}return db['ChatInteraction'][_0xb986('0x6e')](_0x4abb86);})[_0xb986('0x2c')](function(_0x2be7df){if(!_0x385475)return _0x2be7df;var _0x216358={'from':(_0x5452be[_0xb986('0xbb')][_0xb986('0x48')]||'')+'\x20'+(_0x5452be[_0xb986('0xbb')]['lastName']||'')};if(_0x1f752d[_0xb986('0x6f')]['threadId']&&_0x1f752d[_0xb986('0x6f')][_0xb986('0xc1')]&&_0x1f752d[_0xb986('0x6f')]['threadId']!=_0x1f752d[_0xb986('0x6f')][_0xb986('0xc1')]){_0x216358[_0xb986('0xbd')]=_0x1f752d[_0xb986('0x6f')][_0xb986('0xc1')];}return _0x2be7df['update'](_0x216358);})[_0xb986('0x2c')](function(_0x441479){_0x5452be[_0xb986('0xc0')]=_0x441479[_0xb986('0x2e')]({'plain':!![]});_0x5452be['interaction'][_0xb986('0xc2')]=!_0x385475;if(_0x5452be['interaction'][_0xb986('0xc2')]){if(_0x5452be[_0xb986('0xb5')][_0xb986('0xc3')]){_0x5452be[_0xb986('0xb7')]['push']({'id':0x0,'priority':_0x5452be[_0xb986('0xb7')]['length']+0x1,'app':'close','appdata':_0xb986('0xc4'),'interval':_0xb986('0xc5')});}}return db[_0xb986('0xc6')][_0xb986('0x6e')]({'body':_0x1f752d[_0xb986('0x6f')][_0xb986('0x6f')],'ChatWebsiteId':_0x1f752d[_0xb986('0x78')]['id'],'ChatInteractionId':_0x441479['id'],'direction':'in','ContactId':_0x5452be['contact']['id'],'AttachmentId':_0x1f752d[_0xb986('0x6f')][_0xb986('0xc7')]});})[_0xb986('0x2c')](function(_0x4cd5b9){_0x5452be['message']=_0x4cd5b9;if(!_0x5452be[_0xb986('0xc0')][_0xb986('0xc8')]){return;}return db[_0xb986('0xc9')]['find']({'attributes':['id',_0xb986('0x32')],'where':{'id':_0x5452be[_0xb986('0xc0')]['UserId']}});})[_0xb986('0x2c')](function(_0x5cba61){if(_0x5cba61){_0x5452be['applications'][_0xb986('0xca')]({'id':0x0,'priority':0x0,'app':_0xb986('0xcb'),'appdata':_0x5cba61['name']+','+(_0x5452be['account']['waitForTheAssignedAgent']||0xa),'interval':_0xb986('0xc5')});_0x5452be['forcedOwnership']=!![];}if(!_0x5452be[_0xb986('0xc0')]['queueId']){return;}return db['ChatQueue'][_0xb986('0x74')]({'attributes':['id',_0xb986('0x32')],'where':{'id':_0x5452be[_0xb986('0xc0')][_0xb986('0xcc')]}});})['then'](function(_0x3dee1c){if(_0x3dee1c){_0x5452be[_0xb986('0xb7')][_0xb986('0xca')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3dee1c[_0xb986('0x32')]+','+(_0x5452be[_0xb986('0xb5')][_0xb986('0xcd')]||0x12c),'interval':_0xb986('0xc5')});}return respondWithRpcPromise(_0xb986('0xce'),'startRouting',_0x5452be);})[_0xb986('0x2c')](function(_0x37e70e){respondWithRpcPromise(_0xb986('0xcf'),_0xb986('0xcf'),{'event':_0xb986('0x9e'),'message':_0x37e70e},client9002);return _0x37e70e;})['then'](respondWithResult(_0x491aa3,null))[_0xb986('0x22')](APIHandleError(_0x491aa3));};exports[_0xb986('0xd0')]=function(_0x274acc,_0x55bfad){var _0x473292,_0x439265,_0x25b63c;var _0x30167e=[];var _0x244231={};var _0x5e899f=_0x274acc[_0xb986('0xd1')]||[];var _0x575738=[];var _0x401833;return db[_0xb986('0xd2')][_0xb986('0x79')]()[_0xb986('0x2c')](function(_0x4c8ced){if(!_0x4c8ced){throw new db['Sequelize']['ValidationError'](_0xb986('0xa2'));}_0x30167e=_[_0xb986('0xa5')](_[_0xb986('0x5d')](_0x4c8ced),[_0xb986('0xa3'),_0xb986('0xa4'),'CompanyId',_0xb986('0xa7')]);if(_0x274acc[_0xb986('0x6f')]['id']){delete _0x274acc[_0xb986('0x6f')]['id'];}if(_[_0xb986('0x91')](_0x274acc[_0xb986('0x6f')]['from'])){throw _0x55bfad[_0xb986('0x24')](0x1f4)['send'](new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xa8')));}if(_[_0xb986('0x91')](_0x274acc[_0xb986('0x6f')][_0xb986('0x6f')])||_0x274acc[_0xb986('0x6f')][_0xb986('0x6f')]===''){throw _0x55bfad[_0xb986('0x24')](0x1f4)[_0xb986('0xd3')](new db[(_0xb986('0xa0'))]['ValidationError'](_0xb986('0xa9')));}if(_[_0xb986('0x91')](_0x274acc[_0xb986('0x6f')][_0xb986('0xd4')])){throw _0x55bfad[_0xb986('0x24')](0x1f4)[_0xb986('0xd3')](new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xd5')+_0x30167e));}if(!_[_0xb986('0xaa')](_0x30167e,_0x274acc[_0xb986('0x6f')][_0xb986('0xd4')])){throw _0x55bfad[_0xb986('0x24')](0x1f4)[_0xb986('0xd3')](new db[(_0xb986('0xa0'))][(_0xb986('0xa1'))](_0xb986('0xd6')+_0x30167e));}_0x244231[_0x274acc[_0xb986('0x6f')]['mapKeyOffline']]=_0x274acc[_0xb986('0x6f')][_0xb986('0xad')];})[_0xb986('0x2c')](function(){return db['ChatWebsite'][_0xb986('0x74')]({'where':{'id':_0x274acc[_0xb986('0x78')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xb986('0xd7')],'as':'MailAccount'}]});})[_0xb986('0x2c')](handleEntityNotFound(_0x55bfad,null))[_0xb986('0x2c')](function(_0x310181){if(_0x310181&&_0x310181[_0xb986('0xb4')]){_0x439265=_0x310181;var _0x59b5c9=_[_0xb986('0xba')](_0x274acc['body'],{'firstName':_0x274acc[_0xb986('0x6f')][_0xb986('0xad')],'phone':_0x274acc[_0xb986('0x6f')][_0xb986('0xad')],'ListId':_0x310181[_0xb986('0xa7')]});_0x59b5c9[_0x274acc[_0xb986('0x6f')][_0xb986('0xd4')]]=_0x274acc[_0xb986('0x6f')][_0xb986('0xad')];return db[_0xb986('0xd2')]['findOrCreate']({'where':_0x244231,'defaults':_0x59b5c9});}})[_0xb986('0xd8')](function(_0x4ba9a3){if(_0x4ba9a3){_0x25b63c=_0x4ba9a3;var _0x3c2606=fs['readFileSync'](path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0xd9')),_0xb986('0xda'));var _0x381a4b=ejs['render'](_0x3c2606,{'body':_['toPairs'](_0x274acc['body']['body']),'bodyTitle':_0x439265[_0xb986('0xdb')]});return db[_0xb986('0xdc')][_0xb986('0x6e')]({'body':_0x381a4b,'plainBody':htmlToText['fromString'](_0x381a4b),'ContactId':_0x4ba9a3['id'],'ChatWebsiteId':_0x439265['id']});}})['then'](function(_0x4a6978){_0x401833=_0x4a6978;if(_0x5e899f[_0xb986('0x62')]){var _0x19dc32=_0x5e899f['map'](function(_0x2e1710){return{'name':_0x2e1710[_0xb986('0xdd')],'basename':_0x2e1710[_0xb986('0x89')],'type':_0x2e1710['mimetype'],'ChatOfflineMessageId':_0x4a6978['id']};});_0x575738=_0x19dc32[_0xb986('0x3c')](_0x103e64=>{var _0x1a6137={'filename':_0x103e64['name'],'path':path['join'](config[_0xb986('0x94')],_0xb986('0xde'),_0xb986('0xd1'),_0xb986('0xdf'),'offline-chat',_0x103e64[_0xb986('0xe0')])};return _0x1a6137;});if(!_0x439265[_0xb986('0xe1')]){return db[_0xb986('0xe2')]['transaction'](function(_0x429b2b){return db[_0xb986('0xe3')][_0xb986('0xe4')](_0x19dc32,{'transaction':_0x429b2b});});}}})[_0xb986('0x2c')](function(){if(_0x401833){_0x473292=_0x401833;return db[_0xb986('0xd7')][_0xb986('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0xb986('0xe5')],'as':_0xb986('0xe6'),'raw':!![],'include':[{'model':db[_0xb986('0xe7')],'as':_0xb986('0xe7'),'raw':!![]}]}]});}})[_0xb986('0x2c')](function(_0xae91c5){if(_0xae91c5&&_0xae91c5[_0xb986('0xe6')]&&_0x439265[_0xb986('0xe8')]&&_0x439265[_0xb986('0xe9')]){var _0x3c96ba=_0xae91c5[_0xb986('0xea')]();return respondWithRpcPromise('SendMail',_0xb986('0xeb'),{'account':_0x3c96ba,'message':{'from':util[_0xb986('0x35')](_0xb986('0xec'),_0xae91c5[_0xb986('0x32')],_0xae91c5[_0xb986('0xed')]||_0xae91c5[_0xb986('0xe6')][_0xb986('0x72')]),'to':_0x439265['forwardOfflineAddress'],'subject':_0x439265[_0xb986('0xee')],'html':_0x473292['body'],'attachments':_0x575738}},client9003)[_0xb986('0x2c')](function(){return _0x473292;})['catch'](function(_0x23f4f5){logger[_0xb986('0x1e')](_0x23f4f5);});}})[_0xb986('0x2c')](function(){if(_0x439265&&_0x439265[_0xb986('0xe1')]&&_0x439265[_0xb986('0xef')]){var _0x4df51e=[];if(_0x5e899f[_0xb986('0x62')]){_0x4df51e=_0x5e899f[_0xb986('0x3c')](function(_0x288f74){return{'name':_0x288f74[_0xb986('0xdd')],'basename':_0x288f74[_0xb986('0x89')],'type':_0x288f74[_0xb986('0xf0')],'ChatOfflineMessageId':_0x401833['id']};});}var _0x17c67d;if(!_[_0xb986('0x91')](_0x439265[_0xb986('0xf1')])){var _0x2fd1b2=_['map'](_0x274acc['body'],function(_0x329117){return _0x329117;});var _0x112d58=_[_0xb986('0xf2')](_0x2fd1b2)[0x0];var _0x9fe403=_[_0xb986('0xf3')](_0x112d58,function(_0x13ea4d){return _0x13ea4d;});_0x17c67d=_0x9fe403[0x1][_0x439265[_0xb986('0xf1')]];}var _0x5e1da2={'from':_0x25b63c[_0xb986('0xed')],'firstName':_0x25b63c[_0xb986('0x48')],'lastName':_0x25b63c['lastName'],'mapKey':_0xb986('0xed'),'message':{'from':_0x25b63c[_0xb986('0xed')],'to':_0x439265['MailAccount'][_0xb986('0xed')],'cc':'','subject':_[_0xb986('0x91')](_0x17c67d)?_0x439265[_0xb986('0xee')]:_0x17c67d,'messageId':'','sentAt':new Date(),'attach':_0x4df51e[_0xb986('0x62')],'attachments':_0x4df51e,'originChannel':'Chat','ChatWebsiteId':_0x439265['id'],'ChatOfflineMessageId':_0x473292['id'],'originTo':_0x439265[_0xb986('0xd7')]['email']},'body':_0x473292[_0xb986('0x6f')]};var _0x2f6228={'account':{'id':_0x439265[_0xb986('0xef')]},'body':_0x5e1da2,'log':_0xb986('0xf4')};return respondWithRpcPromise(_0xb986('0xf4'),_0xb986('0xf5'),_0x2f6228,client9001)['then'](function(){return _0x473292;})['catch'](function(_0x30cd0b){logger[_0xb986('0x1e')](_0x30cd0b);});}return;})[_0xb986('0x2c')](function(){if(_0x473292){return _0x473292;}})[_0xb986('0x2c')](respondWithResult(_0x55bfad,null))[_0xb986('0x22')](function(){for(var _0x5d3414 of _0x5e899f){var _0x1462d2=path[_0xb986('0x93')](config[_0xb986('0x94')],_0xb986('0xde'),_0xb986('0xd1'),_0xb986('0xdf'),'offline-chat',_0x5d3414['filename']);fs_extra['remove'](_0x1462d2)[_0xb986('0x22')](function(_0x157ede){logger['error'](_0xb986('0xf6'),_0x1462d2,_0x157ede);});}});};exports[_0xb986('0xf7')]=function(_0x4daf62,_0x5abecf){return db['ChatInteraction'][_0xb986('0x74')]({'where':{'id':_0x4daf62[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x5abecf,null))[_0xb986('0x2c')](function(_0x3aa348){if(_0x3aa348){return _0x3aa348[_0xb986('0xf7')](_0x4daf62[_0xb986('0x6f')][_0xb986('0x82')],_[_0xb986('0xf8')](_0x4daf62[_0xb986('0x6f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5abecf,null))['catch'](handleError(_0x5abecf,null));};exports[_0xb986('0xf9')]=function(_0xb24df6,_0x3e87e7){var _0x5beae8={'raw':![],'where':{}};var _0x44f3f6={};var _0x11ace6={'count':0x0,'rows':[]};return db[_0xb986('0x58')][_0xb986('0x7d')]({'where':{'id':_0xb24df6['params']['id']}})['then'](handleEntityNotFound(_0x3e87e7,null))['then'](function(_0x4ced81){if(_0x4ced81){_0x44f3f6[_0xb986('0x50')]=_[_0xb986('0x5d')](db[_0xb986('0xbf')][_0xb986('0x59')]);_0x44f3f6[_0xb986('0x5c')]=_[_0xb986('0x5d')](_0xb24df6[_0xb986('0x5c')]);_0x44f3f6[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x44f3f6[_0xb986('0x50')],_0x44f3f6['query']);_0x5beae8[_0xb986('0x60')]=_[_0xb986('0x5f')](_0x44f3f6[_0xb986('0x50')],qs['fields'](_0xb24df6['query'][_0xb986('0x61')]));_0x5beae8[_0xb986('0x60')]=_0x5beae8[_0xb986('0x60')][_0xb986('0x62')]?_0x5beae8[_0xb986('0x60')]:_0x44f3f6[_0xb986('0x50')];if(!_0xb24df6[_0xb986('0x5c')][_0xb986('0xfa')]('nolimit')){_0x5beae8[_0xb986('0x27')]=qs[_0xb986('0x27')](_0xb24df6['query']['limit']);_0x5beae8[_0xb986('0x2a')]=qs[_0xb986('0x2a')](_0xb24df6[_0xb986('0x5c')][_0xb986('0x2a')]);}_0x5beae8[_0xb986('0x63')]=qs[_0xb986('0x64')](_0xb24df6[_0xb986('0x5c')]['sort']);_0x5beae8[_0xb986('0x65')]=qs[_0xb986('0x5e')](_[_0xb986('0x66')](_0xb24df6[_0xb986('0x5c')],_0x44f3f6['filters']));_0x5beae8['where']['ChatWebsiteId']=_0x4ced81['id'];if(_0xb24df6[_0xb986('0x5c')]['filter']){_0x5beae8[_0xb986('0x65')]=_['merge'](_0x5beae8[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x5beae8[_0xb986('0x60')],function(_0x59335e){var _0x4ded9c={};_0x4ded9c[_0x59335e]={'$like':'%'+_0xb24df6[_0xb986('0x5c')][_0xb986('0x67')]+'%'};return _0x4ded9c;})});}_0x5beae8=_[_0xb986('0x68')]({},_0x5beae8,_0xb24df6[_0xb986('0x85')]);return db[_0xb986('0xbf')][_0xb986('0x29')]({'where':_0x5beae8[_0xb986('0x65')]})[_0xb986('0x2c')](function(_0x27d3da){_0x11ace6['count']=_0x27d3da;if(_0xb24df6[_0xb986('0x5c')][_0xb986('0x80')]){_0x5beae8[_0xb986('0x6d')]=[{'model':db[_0xb986('0xd2')],'as':'Contact','required':![]},{'model':db[_0xb986('0xc9')],'as':_0xb986('0xfb'),'attributes':['name',_0xb986('0xfc'),_0xb986('0xfd')],'required':![]},{'model':db[_0xb986('0xfe')],'as':_0xb986('0xff'),'attributes':['id',_0xb986('0x32'),_0xb986('0x100')],'where':_0xb24df6['query'][_0xb986('0x101')]?{'id':_0xb24df6[_0xb986('0x5c')][_0xb986('0x101')]}:undefined,'required':_0xb24df6[_0xb986('0x5c')][_0xb986('0x101')]?!![]:![]}];}return db[_0xb986('0xbf')][_0xb986('0x6a')](_0x5beae8);})[_0xb986('0x2c')](function(_0x4d0dfb){_0x11ace6[_0xb986('0x6b')]=_0x4d0dfb;return _0x11ace6;});}})[_0xb986('0x2c')](respondWithFilteredResult(_0x3e87e7,_0x5beae8))['catch'](handleError(_0x3e87e7,null));};exports[_0xb986('0x33')]=function(_0x1443b4,_0x249d1b){var _0x28203c=0x0;var _0x11ded3=0x0;var _0x29e5f4=![];var _0x411371;var _0x517e4a;return db['ChatWebsite'][_0xb986('0x74')]({'where':{'id':_0x1443b4[_0xb986('0x78')]['id']},'include':[{'model':db['Interval'],'as':_0xb986('0xb2'),'include':[{'model':db[_0xb986('0xb2')],'as':_0xb986('0x3d'),'attributes':['id',_0xb986('0x37')]}]}]})[_0xb986('0x2c')](handleEntityNotFound(_0x249d1b,null))[_0xb986('0x2c')](function(_0x24f608){if(_0x24f608){_0x411371=_0x24f608;return _0x24f608['getProactiveActions']({'raw':!![]});}})[_0xb986('0x2c')](function(_0x4d608c){if(_0x411371){if(_0x4d608c){_0x517e4a=_0x4d608c;}}return require(_0xb986('0x8f'))[_0xb986('0x90')]();})[_0xb986('0x2c')](function(_0x172cd1){if(_0x172cd1){_0x11ded3=_0x172cd1[_0xb986('0x102')];_0x29e5f4=_0x172cd1[_0xb986('0x103')];}})[_0xb986('0x2c')](function(){return db[_0xb986('0xbf')][_0xb986('0x29')]({'where':{'closed':![]}});})[_0xb986('0x2c')](function(_0xec62db){_0x28203c=_0xec62db;if(_0x11ded3&&_0xec62db>_0x11ded3){return db[_0xb986('0x104')][_0xb986('0x7d')]({'where':{'id':0x1}})[_0xb986('0x2c')](function(_0x528850){if(_0x528850){_0x528850[_0xb986('0x105')](_0xb986('0x106'));}});}})['then'](function(){if(!_0x411371[_0xb986('0xb2')]||!_0x411371[_0xb986('0xb2')][_0xb986('0x3d')])return!![];return checkWebsiteIntervals(_0x411371);})['then'](function(_0x2e1e58){var _0x13e47f=fs[_0xb986('0x107')](path[_0xb986('0x93')](config['root'],_0xb986('0x108')),_0xb986('0xda'));var _0x284507=new url[(_0xb986('0x109'))](_0x411371['address'])[_0xb986('0x10a')];var _0xa4cc49=_0xb986('0x10b');var _0x3f8c72=![];var _0x4c1401={'chatVersion':_0xa4cc49,'chatWebsiteAddressOrigin':_0x284507,'remote':_0x411371[_0xb986('0x10c')],'query':querystring[_0xb986('0x1d')](_[_0xb986('0x68')](_0x411371[_0xb986('0x2e')]({'plain':!![]}),{'customerIp':_0x1443b4[_0xb986('0xbc')][_0xb986('0x45')]||_0x1443b4[_0xb986('0xbc')]['x-real-ip']||_0x1443b4[_0xb986('0x10d')][_0xb986('0x10e')]||_0x1443b4['ip'],'referer':_0x1443b4[_0xb986('0xbc')]['referer'],'openedInteractions':_0x28203c,'maxInteractions':_0x11ded3,'virtual':_0x29e5f4[_0xb986('0x102')],'online':_0x2e1e58,'custom':_0x29e5f4}))['replace'](/'/g,'\x5c\x27')};_0x249d1b[_0xb986('0xd3')](ejs[_0xb986('0x10f')](Mustache['render'](_0x13e47f,_0x4c1401),{'proactiveActions':_0x517e4a,'alignment':_0x411371['alignment'],'verticalAlignment':_0x411371[_0xb986('0x110')],'div_color':_0x411371[_0xb986('0x100')],'labelText':_0x411371[_0xb986('0x111')],'text_color':_0x411371[_0xb986('0x112')],'text_button_color':_0x411371[_0xb986('0x113')],'button_color':_0x411371[_0xb986('0x114')],'background_color':_0x411371[_0xb986('0x115')],'hideWhenOffline':_0x411371[_0xb986('0x116')],'intervalId':_0x411371[_0xb986('0x117')],'isDevelopment':_0x3f8c72,'chatVersion':_0xa4cc49}));})[_0xb986('0x22')](handleError(_0x249d1b,null));};exports['addApplications']=function(_0x1fcd39,_0x590b63){var _0xc747ef=_0x1fcd39[_0xb986('0x78')]['id'];var _0x1593be=_0x1fcd39[_0xb986('0x6f')];var _0x21bbe1=0xc8;var _0x40ece7=null;return db[_0xb986('0xe2')][_0xb986('0x118')]({'isolationLevel':db[_0xb986('0xe2')]['Transaction']['ISOLATION_LEVELS'][_0xb986('0x119')]},function(_0x558ae3){return db['ChatWebsite'][_0xb986('0x7d')]({'where':{'id':_0xc747ef},'transaction':_0x558ae3})[_0xb986('0x2c')](function(_0x20ece9){if(_0x20ece9){return db[_0xb986('0xb0')][_0xb986('0x2d')]({'where':{'ChatWebsiteId':_0xc747ef},'transaction':_0x558ae3})[_0xb986('0x2c')](function(){var _0xa50c39=_[_0xb986('0x3c')](_0x1593be,function(_0x1b5c2e){_0x1b5c2e[_0xb986('0x7b')]=_0xc747ef;return _0x1b5c2e;});return db[_0xb986('0xb0')][_0xb986('0xe4')](_0xa50c39,{'transaction':_0x558ae3});});}else{_0x21bbe1=0x194;_0x40ece7=[];}});})[_0xb986('0x2c')](function(){if(_0x21bbe1!==0x194){return db['ChatApplication'][_0xb986('0x11a')]({'where':{'ChatWebsiteId':_0xc747ef},'order':_0xb986('0xb8')})[_0xb986('0x2c')](function(_0x32e1e2){_0x40ece7=_0x32e1e2;});}})[_0xb986('0x22')](function(_0x4b681d){_0x21bbe1=0x1f4;logger[_0xb986('0x1e')](_0x4b681d['stack']);if(_0x4b681d['name']){delete _0x4b681d['name'];}_0x40ece7=_0x4b681d;})['finally'](function(){if(_0x40ece7===null){_0x590b63[_0xb986('0x23')](_0x21bbe1);}else{if(_0x21bbe1===0x1f4){_0x590b63[_0xb986('0x24')](_0x21bbe1)[_0xb986('0xd3')](_0x40ece7);}else{_0x590b63[_0xb986('0x24')](_0x21bbe1)[_0xb986('0x26')](_0x40ece7);}}});};exports[_0xb986('0x11b')]=function(_0xf19770,_0x4bacfe){var _0x4e75f3={};var _0x2bb45d={};var _0x740194;var _0x2d311a;return db['ChatWebsite'][_0xb986('0x7d')]({'where':{'id':_0xf19770[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x4bacfe,null))[_0xb986('0x2c')](function(_0x14effd){if(_0x14effd){_0x740194=_0x14effd;_0x2bb45d[_0xb986('0x50')]=_[_0xb986('0x5d')](db[_0xb986('0xb0')][_0xb986('0x59')]);_0x2bb45d[_0xb986('0x5c')]=_[_0xb986('0x5d')](_0xf19770[_0xb986('0x5c')]);_0x2bb45d[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x2bb45d['model'],_0x2bb45d['query']);_0x4e75f3['attributes']=_[_0xb986('0x5f')](_0x2bb45d[_0xb986('0x50')],qs[_0xb986('0x61')](_0xf19770[_0xb986('0x5c')][_0xb986('0x61')]));_0x4e75f3[_0xb986('0x60')]=_0x4e75f3['attributes'][_0xb986('0x62')]?_0x4e75f3[_0xb986('0x60')]:_0x2bb45d[_0xb986('0x50')];_0x4e75f3[_0xb986('0x63')]=qs[_0xb986('0x64')](_0xf19770[_0xb986('0x5c')][_0xb986('0x64')]);_0x4e75f3[_0xb986('0x65')]=qs[_0xb986('0x5e')](_['pick'](_0xf19770[_0xb986('0x5c')],_0x2bb45d[_0xb986('0x5e')]));if(_0xf19770[_0xb986('0x5c')][_0xb986('0x67')]){_0x4e75f3['where']=_[_0xb986('0x68')](_0x4e75f3[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x4e75f3[_0xb986('0x60')],function(_0x5b722f){var _0xc3b0a2={};_0xc3b0a2[_0x5b722f]={'$like':'%'+_0xf19770[_0xb986('0x5c')][_0xb986('0x67')]+'%'};return _0xc3b0a2;})});}_0x4e75f3=_['merge']({},_0x4e75f3,_0xf19770[_0xb986('0x85')]);return _0x740194[_0xb986('0x11b')](_0x4e75f3);}})['then'](function(_0x26d4e5){if(_0x26d4e5){_0x2d311a=_0x26d4e5['length'];if(!_0xf19770[_0xb986('0x5c')][_0xb986('0xfa')]('nolimit')){_0x4e75f3['limit']=qs[_0xb986('0x27')](_0xf19770['query'][_0xb986('0x27')]);_0x4e75f3[_0xb986('0x2a')]=qs[_0xb986('0x2a')](_0xf19770[_0xb986('0x5c')]['offset']);}return _0x740194['getApplications'](_0x4e75f3);}})[_0xb986('0x2c')](function(_0x21c596){if(_0x21c596){return _0x21c596?{'count':_0x2d311a,'rows':_0x21c596}:null;}})[_0xb986('0x2c')](respondWithResult(_0x4bacfe,null))['catch'](handleError(_0x4bacfe,null));};exports[_0xb986('0x11c')]=function(_0x24bce3,_0x5dcb8a){return db['chatProactiveAction'][_0xb986('0x74')]({'where':{'id':_0x24bce3[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x5dcb8a,null))[_0xb986('0x2c')](function(_0x1e3d13){if(_0x1e3d13){return _0x1e3d13[_0xb986('0x11c')](_0x24bce3[_0xb986('0x6f')][_0xb986('0x82')],_[_0xb986('0xf8')](_0x24bce3[_0xb986('0x6f')],[_0xb986('0x82'),'id'])||{});}})['then'](respondWithResult(_0x5dcb8a,null))[_0xb986('0x22')](handleError(_0x5dcb8a,null));};exports[_0xb986('0x11d')]=function(_0x41d52b,_0x3ceac7){var _0x1759c2={};var _0x57c66d={};var _0x41593c;var _0x278e3d;return db['ChatWebsite'][_0xb986('0x7d')]({'where':{'id':_0x41d52b[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x3ceac7,null))[_0xb986('0x2c')](function(_0x633f37){if(_0x633f37){_0x41593c=_0x633f37;_0x57c66d['model']=_['keys'](db[_0xb986('0x11e')][_0xb986('0x59')]);_0x57c66d['query']=_['keys'](_0x41d52b['query']);_0x57c66d['filters']=_[_0xb986('0x5f')](_0x57c66d[_0xb986('0x50')],_0x57c66d[_0xb986('0x5c')]);_0x1759c2[_0xb986('0x60')]=_[_0xb986('0x5f')](_0x57c66d['model'],qs[_0xb986('0x61')](_0x41d52b[_0xb986('0x5c')]['fields']));_0x1759c2[_0xb986('0x60')]=_0x1759c2['attributes'][_0xb986('0x62')]?_0x1759c2[_0xb986('0x60')]:_0x57c66d[_0xb986('0x50')];_0x1759c2[_0xb986('0x63')]=qs[_0xb986('0x64')](_0x41d52b[_0xb986('0x5c')]['sort']);_0x1759c2[_0xb986('0x65')]=qs[_0xb986('0x5e')](_[_0xb986('0x66')](_0x41d52b[_0xb986('0x5c')],_0x57c66d['filters']));if(_0x41d52b[_0xb986('0x5c')][_0xb986('0x67')]){_0x1759c2[_0xb986('0x65')]=_['merge'](_0x1759c2[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x1759c2[_0xb986('0x60')],function(_0x161804){var _0x2fde9c={};_0x2fde9c[_0x161804]={'$like':'%'+_0x41d52b['query']['filter']+'%'};return _0x2fde9c;})});}_0x1759c2=_['merge']({},_0x1759c2,_0x41d52b[_0xb986('0x85')]);return _0x41593c['getProactiveActions'](_0x1759c2);}})[_0xb986('0x2c')](function(_0x47f813){if(_0x47f813){_0x278e3d=_0x47f813['length'];if(!_0x41d52b[_0xb986('0x5c')][_0xb986('0xfa')](_0xb986('0x7f'))){_0x1759c2['limit']=qs[_0xb986('0x27')](_0x41d52b[_0xb986('0x5c')][_0xb986('0x27')]);_0x1759c2[_0xb986('0x2a')]=qs['offset'](_0x41d52b[_0xb986('0x5c')][_0xb986('0x2a')]);}return _0x41593c[_0xb986('0x11d')](_0x1759c2);}})['then'](function(_0x11874d){if(_0x11874d){return _0x11874d?{'count':_0x278e3d,'rows':_0x11874d}:null;}})[_0xb986('0x2c')](respondWithResult(_0x3ceac7,null))[_0xb986('0x22')](handleError(_0x3ceac7,null));};exports[_0xb986('0x11f')]=function(_0x372f75,_0x2c2497){var _0x2c7078=_0x372f75[_0xb986('0x5c')][_0xb986('0x120')]===_0xb986('0x121')?_0xb986('0x122'):_0xb986('0x123');return db[_0xb986('0x58')][_0xb986('0x74')]({'attributes':['id',_0x2c7078],'where':{'id':_0x372f75[_0xb986('0x78')]['id']}})['then'](handleEntityNotFound(_0x2c2497,null))[_0xb986('0x2c')](function(_0x3ae87f){if(_0x3ae87f){var _0x4761d5=_0x3ae87f[_0x2c7078];var _0x21a437=_0x4761d5&&_0x4761d5[_0xb986('0x124')]?_0x4761d5[_0xb986('0x124')]:[];_0x2c2497[_0xb986('0xd3')]({'fromKey':_[_0xb986('0x91')](_0x4761d5[_0xb986('0x125')])?undefined:_0x4761d5[_0xb986('0x125')],'count':_0x21a437[_0xb986('0x62')],'rows':_0x21a437});}})['catch'](handleError(_0x2c2497,null));};exports[_0xb986('0x126')]=function(_0x4b05e2,_0x591357){var _0x3033d1={'raw':![],'where':{}};var _0x461907={};var _0x281587={'count':0x0,'rows':[]};return db[_0xb986('0x58')][_0xb986('0x7d')]({'where':{'id':_0x4b05e2[_0xb986('0x78')]['id']}})['then'](handleEntityNotFound(_0x591357,null))[_0xb986('0x2c')](function(_0x45260a){if(_0x45260a){_0x461907[_0xb986('0x50')]=_[_0xb986('0x5d')](db['ChatOfflineMessage'][_0xb986('0x59')]);_0x461907[_0xb986('0x5c')]=_[_0xb986('0x5d')](_0x4b05e2[_0xb986('0x5c')]);_0x461907[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x461907[_0xb986('0x50')],_0x461907['query']);_0x3033d1[_0xb986('0x60')]=_['intersection'](_0x461907[_0xb986('0x50')],qs[_0xb986('0x61')](_0x4b05e2[_0xb986('0x5c')][_0xb986('0x61')]));_0x3033d1[_0xb986('0x60')]=_0x3033d1['attributes'][_0xb986('0x62')]?_0x3033d1['attributes']:_0x461907['model'];if(!_0x4b05e2[_0xb986('0x5c')][_0xb986('0xfa')](_0xb986('0x7f'))){_0x3033d1['limit']=qs[_0xb986('0x27')](_0x4b05e2[_0xb986('0x5c')]['limit']);_0x3033d1[_0xb986('0x2a')]=qs['offset'](_0x4b05e2[_0xb986('0x5c')][_0xb986('0x2a')]);}_0x3033d1[_0xb986('0x63')]=qs[_0xb986('0x64')](_0x4b05e2[_0xb986('0x5c')][_0xb986('0x64')]);_0x3033d1[_0xb986('0x65')]=qs['filters'](_['pick'](_0x4b05e2[_0xb986('0x5c')],_0x461907[_0xb986('0x5e')]));_0x3033d1[_0xb986('0x65')][_0xb986('0x7b')]=_0x45260a['id'];if(_0x4b05e2['query'][_0xb986('0x67')]){_0x3033d1[_0xb986('0x65')]=_[_0xb986('0x68')](_0x3033d1[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x3033d1[_0xb986('0x60')],function(_0x17379e){var _0x289bf2={};_0x289bf2[_0x17379e]={'$like':'%'+_0x4b05e2[_0xb986('0x5c')][_0xb986('0x67')]+'%'};return _0x289bf2;})});}_0x3033d1=_['merge']({},_0x3033d1,_0x4b05e2[_0xb986('0x85')]);return db[_0xb986('0xdc')][_0xb986('0x29')]({'where':_0x3033d1[_0xb986('0x65')]})['then'](function(_0x15e3a2){_0x281587[_0xb986('0x29')]=_0x15e3a2;if(_0x4b05e2['query'][_0xb986('0x80')]){_0x3033d1[_0xb986('0x6d')]=[{'all':!![]}];}else{_0x3033d1[_0xb986('0x6d')]=[{'model':db[_0xb986('0xd2')],'as':_0xb986('0x127'),'required':![]},{'model':db[_0xb986('0xe3')],'as':_0xb986('0x128'),'required':![]}];}return db[_0xb986('0xdc')][_0xb986('0x6a')](_0x3033d1);})[_0xb986('0x2c')](function(_0x444a6b){_0x281587[_0xb986('0x6b')]=_0x444a6b;return _0x281587;});}})[_0xb986('0x2c')](respondWithFilteredResult(_0x591357,_0x3033d1))['catch'](handleError(_0x591357,null));};exports[_0xb986('0x129')]=function(_0x1a7a80,_0xe5efa0){return db[_0xb986('0x58')]['find']({'where':{'id':_0x1a7a80[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0xe5efa0,null))[_0xb986('0x2c')](function(_0x467891){if(_0x467891){return _0x467891[_0xb986('0x129')](_0x1a7a80[_0xb986('0x6f')]['ids'],_[_0xb986('0xf8')](_0x1a7a80[_0xb986('0x6f')],[_0xb986('0x82'),'id'])||{})['spread'](function(_0x370db8){for(var _0x54417c=0x0;_0x54417c<_0x1a7a80[_0xb986('0x6f')][_0xb986('0x82')][_0xb986('0x62')];_0x54417c+=0x1){socket[_0xb986('0x12a')](_0xb986('0x12b'),{'UserId':Number(_0x1a7a80[_0xb986('0x6f')][_0xb986('0x82')][_0x54417c]),'ChatWebsiteId':Number(_0x1a7a80[_0xb986('0x78')]['id'])});}return _0x370db8;});}})[_0xb986('0x2c')](respondWithResult(_0xe5efa0,null))[_0xb986('0x22')](handleError(_0xe5efa0,null));};exports[_0xb986('0x12c')]=function(_0x272973,_0x361f22){return db[_0xb986('0x58')]['find']({'where':{'id':_0x272973['params']['id']}})['then'](handleEntityNotFound(_0x361f22,null))[_0xb986('0x2c')](function(_0x3fa190){if(_0x3fa190){return _0x3fa190[_0xb986('0x12c')](_0x272973['query']['ids'])[_0xb986('0x2c')](function(){if(_[_0xb986('0x12d')](_0x272973[_0xb986('0x5c')][_0xb986('0x82')])){for(var _0x5287e1=0x0;_0x5287e1<_0x272973[_0xb986('0x5c')][_0xb986('0x82')][_0xb986('0x62')];_0x5287e1+=0x1){socket[_0xb986('0x12a')](_0xb986('0x12e'),{'UserId':Number(_0x272973[_0xb986('0x5c')][_0xb986('0x82')][_0x5287e1]),'ChatWebsiteId':Number(_0x272973[_0xb986('0x78')]['id'])});}}else{socket[_0xb986('0x12a')](_0xb986('0x12e'),{'UserId':Number(_0x272973[_0xb986('0x5c')][_0xb986('0x82')]),'ChatWebsiteId':Number(_0x272973['params']['id'])});}});}})[_0xb986('0x2c')](respondWithStatusCode(_0x361f22,null))[_0xb986('0x22')](handleError(_0x361f22,null));};exports[_0xb986('0x12f')]=function(_0x253f80,_0x2e60dc){var _0x2676ac={};var _0x226729={};var _0x56ca90;var _0x354656;return db[_0xb986('0x58')][_0xb986('0x7d')]({'where':{'id':_0x253f80[_0xb986('0x78')]['id']}})[_0xb986('0x2c')](handleEntityNotFound(_0x2e60dc,null))[_0xb986('0x2c')](function(_0x4a7894){if(_0x4a7894){_0x56ca90=_0x4a7894;_0x226729[_0xb986('0x50')]=_[_0xb986('0x5d')](db[_0xb986('0xc9')][_0xb986('0x59')]);_0x226729[_0xb986('0x5c')]=_['keys'](_0x253f80[_0xb986('0x5c')]);_0x226729[_0xb986('0x5e')]=_[_0xb986('0x5f')](_0x226729['model'],_0x226729['query']);_0x2676ac['attributes']=_['intersection'](_0x226729[_0xb986('0x50')],qs['fields'](_0x253f80[_0xb986('0x5c')]['fields']));_0x2676ac[_0xb986('0x60')]=_0x2676ac['attributes'][_0xb986('0x62')]?_0x2676ac['attributes']:_0x226729[_0xb986('0x50')];_0x2676ac[_0xb986('0x63')]=qs['sort'](_0x253f80[_0xb986('0x5c')][_0xb986('0x64')]);_0x2676ac[_0xb986('0x65')]=qs[_0xb986('0x5e')](_['pick'](_0x253f80[_0xb986('0x5c')],_0x226729['filters']));if(_0x253f80[_0xb986('0x5c')]['filter']){_0x2676ac['where']=_['merge'](_0x2676ac[_0xb986('0x65')],{'$or':_[_0xb986('0x3c')](_0x2676ac['attributes'],function(_0x4374ac){var _0x164111={};_0x164111[_0x4374ac]={'$like':'%'+_0x253f80['query'][_0xb986('0x67')]+'%'};return _0x164111;})});}_0x2676ac=_[_0xb986('0x68')]({},_0x2676ac,_0x253f80[_0xb986('0x85')]);return _0x56ca90[_0xb986('0x12f')](_0x2676ac);}})[_0xb986('0x2c')](function(_0x3c9075){if(_0x3c9075){_0x354656=_0x3c9075[_0xb986('0x62')];if(!_0x253f80[_0xb986('0x5c')][_0xb986('0xfa')]('nolimit')){_0x2676ac['limit']=qs[_0xb986('0x27')](_0x253f80[_0xb986('0x5c')][_0xb986('0x27')]);_0x2676ac[_0xb986('0x2a')]=qs[_0xb986('0x2a')](_0x253f80[_0xb986('0x5c')]['offset']);}return _0x56ca90['getAgents'](_0x2676ac);}})[_0xb986('0x2c')](function(_0x392c58){if(_0x392c58){return _0x392c58?{'count':_0x354656,'rows':_0x392c58}:null;}})[_0xb986('0x2c')](respondWithResult(_0x2e60dc,null))['catch'](handleError(_0x2e60dc,null));}; \ No newline at end of file +var _0x5ca6=['created','autoclose','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','difference','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','MailAccountId','subjectOffline','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','tag','getProactiveActions','getLicense','virtual','increment','utf8','URL','3.5.0','remote','x-real-ip','remoteAddress','referer','replace','alignment','labelText','textColor','textButtonColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','ChatProactiveAction','false','offlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','redis','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','Content-Range','update','destroy','get','ChatWebsites','sendStatus','stack','name','timezone','interval','true','ONLINE','OFFLINE','No\x20timezone','map','Intervals','some','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','browser','version','format','unknown','%s\x20%s','model','device','vendor','Pause','rawAttributes','fieldName','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','ChatWebsite','include','findAll','rows','params','mandatoryDispositionPause','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','ValidationError','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','asc','defaults','ListId','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','firstName','messageId'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x5ca6,0x181));var _0x65ca=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x5ca6[_0x5d6e30];return _0x3d3f3b;};'use strict';var Mustache=require(_0x65ca('0x0'));var util=require('util');var path=require(_0x65ca('0x1'));var ejs=require(_0x65ca('0x2'));var fs=require('fs');var fs_extra=require(_0x65ca('0x3'));var _=require(_0x65ca('0x4'));var querystring=require(_0x65ca('0x5'));var htmlToText=require(_0x65ca('0x6'));var Redis=require('ioredis');var jayson=require('jayson/promise');var url=require(_0x65ca('0x7'));var qs=require(_0x65ca('0x8'));var logger=require('../../config/logger')(_0x65ca('0x9'));var config=require(_0x65ca('0xa'));var APIOutOfIntervalError=require(_0x65ca('0xb'))[_0x65ca('0xc')];var APINotFoundError=require(_0x65ca('0xb'))[_0x65ca('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x65ca('0xe'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65ca('0xf')]));require('./chatWebsite.socket')[_0x65ca('0x10')](socket);var client=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x232c});var client9002=jayson[_0x65ca('0x11')]['http']({'port':0x232a});var client9003=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x232b});var client9001=jayson[_0x65ca('0x11')][_0x65ca('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x782230,_0x189a32,_0x18adc0,_0x6c7a94){return new Promise(function(_0x89ed0f,_0x2cc491){var _0x5d6e20=_0x6c7a94||client;return _0x5d6e20[_0x65ca('0x13')](_0x782230,_0x18adc0)[_0x65ca('0x14')](function(_0x2708c7){logger[_0x65ca('0x15')](_0x65ca('0x16'),_0x189a32,_0x65ca('0x17'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x189a32,'request\x20sent',JSON[_0x65ca('0x18')](_0x2708c7));if(_0x2708c7[_0x65ca('0x19')]){if(_0x2708c7['error'][_0x65ca('0x1a')]===0x1f4){logger[_0x65ca('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x189a32,_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);return _0x2cc491(_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);}logger[_0x65ca('0x19')](_0x65ca('0x16'),_0x189a32,_0x2708c7['error'][_0x65ca('0x1b')]);return _0x89ed0f(_0x2708c7[_0x65ca('0x19')][_0x65ca('0x1b')]);}else{logger[_0x65ca('0x15')](_0x65ca('0x16'),_0x189a32,_0x65ca('0x17'));_0x89ed0f(_0x2708c7[_0x65ca('0x1c')][_0x65ca('0x1b')]);}})[_0x65ca('0x1d')](function(_0x333a4f){logger['error'](_0x65ca('0x16'),_0x189a32,_0x333a4f);_0x2cc491(_0x333a4f);});});}function respondWithStatusCode(_0x4fe67f,_0x3a99c9){_0x3a99c9=_0x3a99c9||0xcc;return function(_0x4e389c){if(_0x4e389c){return _0x4fe67f['sendStatus'](_0x3a99c9);}return _0x4fe67f[_0x65ca('0x1e')](_0x3a99c9)[_0x65ca('0x1f')]();};}function respondWithResult(_0x295015,_0x4be997){_0x4be997=_0x4be997||0xc8;return function(_0x19d189){if(_0x19d189){return _0x295015['status'](_0x4be997)[_0x65ca('0x20')](_0x19d189);}};}function respondWithFilteredResult(_0x539045,_0x21dc45){return function(_0x2156c0){if(_0x2156c0){var _0x1cb000=typeof _0x21dc45[_0x65ca('0x21')]==='undefined'&&typeof _0x21dc45[_0x65ca('0x22')]==='undefined';var _0x197f47=_0x2156c0['count'];var _0xb2726c=_0x1cb000?0x0:_0x21dc45[_0x65ca('0x21')];var _0x43a25b=_0x1cb000?_0x2156c0[_0x65ca('0x23')]:_0x21dc45[_0x65ca('0x21')]+_0x21dc45[_0x65ca('0x22')];var _0x1de895;if(_0x43a25b>=_0x197f47){_0x43a25b=_0x197f47;_0x1de895=0xc8;}else{_0x1de895=0xce;}_0x539045['status'](_0x1de895);return _0x539045['set'](_0x65ca('0x24'),_0xb2726c+'-'+_0x43a25b+'/'+_0x197f47)['json'](_0x2156c0);}return null;};}function saveUpdates(_0x51dba2){return function(_0x53b815){if(_0x53b815){return _0x53b815[_0x65ca('0x25')](_0x51dba2)[_0x65ca('0x14')](function(_0x4ab7dc){return _0x4ab7dc;});}return null;};}function removeEntity(_0x387910){return function(_0x14ad15){if(_0x14ad15){return _0x14ad15[_0x65ca('0x26')]()[_0x65ca('0x14')](function(){var _0xc74c7c=_0x14ad15[_0x65ca('0x27')]({'plain':!![]});var _0x3f3fd8=_0x65ca('0x28');return db['UserProfileResource'][_0x65ca('0x26')]({'where':{'type':_0x3f3fd8,'resourceId':_0xc74c7c['id']}})['then'](function(){return _0x14ad15;});})[_0x65ca('0x14')](function(){_0x387910['status'](0xcc)[_0x65ca('0x1f')]();});}};}function handleEntityNotFound(_0x1dd335){return function(_0x34374a){if(!_0x34374a){_0x1dd335[_0x65ca('0x29')](0x194);}return _0x34374a;};}function handleError(_0xbf92b5,_0x12fe28){_0x12fe28=_0x12fe28||0x1f4;return function(_0x50dcb7){logger[_0x65ca('0x19')](_0x50dcb7[_0x65ca('0x2a')]);if(_0x50dcb7[_0x65ca('0x2b')]){delete _0x50dcb7[_0x65ca('0x2b')];}_0xbf92b5['status'](_0x12fe28)['send'](_0x50dcb7);};}function iftimePromise(_0x1a912a,_0x46b66f){return respondWithRpcPromise('Command','getSnippet',{'command':_0x46b66f[_0x65ca('0x2c')]?util['format']('iftime\x20%s,%s',_0x1a912a[_0x65ca('0x2d')],_0x46b66f[_0x65ca('0x2c')]):util['format']('iftime\x20%s',_0x1a912a['interval'])},client9002)[_0x65ca('0x14')](function(_0x18040e){var _0x4f2ba6=_0x18040e&&_0x18040e['indexOf'](_0x65ca('0x2e'))>=0x0?!![]:![];logger[_0x65ca('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46b66f['id'],_0x1a912a['id'],_0x1a912a[_0x65ca('0x2d')],_0x4f2ba6?_0x65ca('0x2f'):_0x65ca('0x30'),_0x46b66f['timezone']?_0x46b66f[_0x65ca('0x2c')]:'No\x20timezone');return _0x4f2ba6;})[_0x65ca('0x1d')](function(_0x56b303){logger[_0x65ca('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46b66f['id'],_0x1a912a['id'],_0x1a912a[_0x65ca('0x2d')],util['inspect'](_0x56b303,{'showHidden':![],'depth':null}),_0x46b66f[_0x65ca('0x2c')]?_0x46b66f['timezone']:_0x65ca('0x31'));return![];});}function checkWebsiteIntervals(_0x1ee098){var _0x51bba3=_[_0x65ca('0x32')](_0x1ee098['Interval'][_0x65ca('0x33')],function(_0x44a80f){var _0xfa72c3=_0x44a80f[_0x65ca('0x27')]({'plain':!![]});return iftimePromise(_0xfa72c3,_0x1ee098);});return Promise['all'](_0x51bba3)[_0x65ca('0x14')](function(_0xbca68d){return _[_0x65ca('0x34')](_0xbca68d);});}function createInteractionObject(_0x877020,_0x21a900,_0x4627c9,_0x481699){var _0x1a559e=require(_0x65ca('0x35'));var _0x28aa66=new _0x1a559e();var _0x31b83a=_0x28aa66['setUA'](_0x4627c9[_0x65ca('0x36')])[_0x65ca('0x37')]();var _0x5ea32d=_0x21a900[_0x65ca('0x38')];if(_0x4627c9[_0x65ca('0x39')]){_0x5ea32d=_0x4627c9[_0x65ca('0x39')];}else if(_0x4627c9[_0x65ca('0x3a')]){_0x5ea32d=_['first'](_0x4627c9[_0x65ca('0x3a')][_0x65ca('0x3b')](','));}return{'ContactId':_0x481699['id'],'ChatWebsiteId':_0x877020,'from':(_0x481699['firstName']||'')+'\x20'+(_0x481699[_0x65ca('0x3c')]||''),'customerIp':_0x5ea32d,'customerPort':_0x4627c9['x-real-port']?_0x4627c9['x-real-port']:null,'referer':_0x21a900['referer'],'browserName':_0x31b83a['browser'][_0x65ca('0x2b')]&&_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]?util[_0x65ca('0x3f')]('%s\x20%s',_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x2b')],_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]):_0x65ca('0x40'),'browserVersion':_0x31b83a[_0x65ca('0x3d')][_0x65ca('0x3e')]||'unknown','osName':util['format'](_0x65ca('0x41'),_0x31b83a['os'][_0x65ca('0x2b')],_0x31b83a['os']['version']),'osVersion':_0x31b83a['os'][_0x65ca('0x3e')],'deviceModel':_0x31b83a['device'][_0x65ca('0x42')]&&_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')]?util[_0x65ca('0x3f')]('%s\x20%s\x20%s',_0x31b83a[_0x65ca('0x43')]['model'],_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')],_0x31b83a['device']['type']):null,'deviceVendor':_0x31b83a[_0x65ca('0x43')][_0x65ca('0x44')],'deviceType':_0x31b83a[_0x65ca('0x43')]['type'],'formData':JSON['stringify'](_0x21a900)};}exports['index']=function(_0x6969de,_0x45456d){var _0x5e555f={'include':[{'model':db[_0x65ca('0x45')],'as':'mandatoryDispositionPause'}]},_0x3e1b77={},_0x509037={'count':0x0,'rows':[]};var _0x271289=_[_0x65ca('0x32')](db['ChatWebsite'][_0x65ca('0x46')],function(_0x53c33c){return{'name':_0x53c33c[_0x65ca('0x47')],'type':_0x53c33c['type']['key']};});_0x3e1b77['model']=_[_0x65ca('0x32')](_0x271289,_0x65ca('0x2b'));_0x3e1b77[_0x65ca('0x48')]=_['keys'](_0x6969de[_0x65ca('0x48')]);_0x3e1b77[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x3e1b77[_0x65ca('0x42')],_0x3e1b77[_0x65ca('0x48')]);_0x5e555f['attributes']=_[_0x65ca('0x4a')](_0x3e1b77['model'],qs['fields'](_0x6969de[_0x65ca('0x48')][_0x65ca('0x4b')]));_0x5e555f[_0x65ca('0x4c')]=_0x5e555f[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x5e555f[_0x65ca('0x4c')]:_0x3e1b77[_0x65ca('0x42')];if(!_0x6969de[_0x65ca('0x48')]['hasOwnProperty'](_0x65ca('0x4e'))){_0x5e555f[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x6969de[_0x65ca('0x48')][_0x65ca('0x22')]);_0x5e555f['offset']=qs[_0x65ca('0x21')](_0x6969de[_0x65ca('0x48')]['offset']);}_0x5e555f['order']=qs['sort'](_0x6969de['query'][_0x65ca('0x4f')]);_0x5e555f['where']=qs['filters'](_[_0x65ca('0x50')](_0x6969de[_0x65ca('0x48')],_0x3e1b77[_0x65ca('0x49')]),_0x271289);if(_0x6969de[_0x65ca('0x48')][_0x65ca('0x51')]){_0x5e555f[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x5e555f[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x271289,function(_0x4c3036){if(_0x4c3036['type']!==_0x65ca('0x54')){var _0x3d22e5={};_0x3d22e5[_0x4c3036[_0x65ca('0x2b')]]={'$like':'%'+_0x6969de[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x3d22e5;}})});}_0x5e555f=_[_0x65ca('0x53')]({},_0x5e555f,_0x6969de[_0x65ca('0x55')]);var _0x4c05e9={'where':_0x5e555f[_0x65ca('0x52')]};return db[_0x65ca('0x56')][_0x65ca('0x23')](_0x4c05e9)[_0x65ca('0x14')](function(_0x45819a){_0x509037['count']=_0x45819a;if(_0x6969de[_0x65ca('0x48')]['includeAll']){_0x5e555f[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x56')][_0x65ca('0x58')](_0x5e555f);})[_0x65ca('0x14')](function(_0x133d78){_0x509037[_0x65ca('0x59')]=_0x133d78;return _0x509037;})['then'](respondWithFilteredResult(_0x45456d,_0x5e555f))['catch'](handleError(_0x45456d,null));};exports['show']=function(_0x55fee2,_0x2d1fb4){var _0x4db809={'raw':![],'where':{'id':_0x55fee2[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x45')],'as':_0x65ca('0x5b')}]},_0x1d7a0a={};_0x1d7a0a[_0x65ca('0x42')]=_['keys'](db[_0x65ca('0x56')][_0x65ca('0x46')]);_0x1d7a0a[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x55fee2[_0x65ca('0x48')]);_0x1d7a0a[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x1d7a0a[_0x65ca('0x42')],_0x1d7a0a[_0x65ca('0x48')]);_0x4db809['attributes']=_['intersection'](_0x1d7a0a[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x55fee2['query']['fields']));_0x4db809[_0x65ca('0x4c')]=_0x4db809['attributes'][_0x65ca('0x4d')]?_0x4db809[_0x65ca('0x4c')]:_0x1d7a0a[_0x65ca('0x42')];if(_0x55fee2[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x4db809['include']=[{'all':!![]}];}_0x4db809=_['merge']({},_0x4db809,_0x55fee2[_0x65ca('0x55')]);return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x4db809)[_0x65ca('0x14')](handleEntityNotFound(_0x2d1fb4,null))['then'](respondWithResult(_0x2d1fb4,null))[_0x65ca('0x1d')](handleError(_0x2d1fb4,null));};exports[_0x65ca('0x5f')]=function(_0x42b216,_0x5688d2){return db[_0x65ca('0x56')][_0x65ca('0x5f')](_0x42b216[_0x65ca('0x60')],{})[_0x65ca('0x14')](function(_0x14f91b){var _0x4c0932=_0x42b216[_0x65ca('0x61')][_0x65ca('0x27')]({'plain':!![]});if(!_0x4c0932)throw new Error(_0x65ca('0x62'));if(_0x4c0932['role']===_0x65ca('0x61')){var _0x2c6f73=_0x14f91b['get']({'plain':!![]});var _0x438ca5=_0x65ca('0x28');return db[_0x65ca('0x63')][_0x65ca('0x5e')]({'where':{'name':_0x438ca5,'userProfileId':_0x4c0932[_0x65ca('0x64')]},'raw':!![]})['then'](function(_0x5c31bf){if(_0x5c31bf&&_0x5c31bf[_0x65ca('0x65')]===0x0){return db[_0x65ca('0x66')]['create']({'name':_0x2c6f73[_0x65ca('0x2b')],'resourceId':_0x2c6f73['id'],'type':_0x5c31bf[_0x65ca('0x2b')],'sectionId':_0x5c31bf['id']},{})[_0x65ca('0x14')](function(){return _0x14f91b;});}else{return _0x14f91b;}})[_0x65ca('0x1d')](function(_0x7d769e){logger[_0x65ca('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d769e);throw _0x7d769e;});}return _0x14f91b;})[_0x65ca('0x14')](respondWithResult(_0x5688d2,0xc9))['catch'](handleError(_0x5688d2,null));};exports[_0x65ca('0x25')]=function(_0x14dec6,_0xa323a2){if(_0x14dec6['body']['id']){delete _0x14dec6[_0x65ca('0x60')]['id'];}return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x14dec6[_0x65ca('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x65ca('0x5b')}]})[_0x65ca('0x14')](handleEntityNotFound(_0xa323a2,null))['then'](saveUpdates(_0x14dec6[_0x65ca('0x60')],null))['then'](respondWithResult(_0xa323a2,null))[_0x65ca('0x1d')](handleError(_0xa323a2,null));};exports['destroy']=function(_0x36c132,_0x25c39f){return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x36c132[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x25c39f,null))[_0x65ca('0x14')](removeEntity(_0x25c39f,null))['catch'](handleError(_0x25c39f,null));};exports['describe']=function(_0x5c4718,_0x49712f){return db['ChatWebsite'][_0x65ca('0x67')]()[_0x65ca('0x14')](respondWithResult(_0x49712f,null))[_0x65ca('0x1d')](handleError(_0x49712f,null));};exports[_0x65ca('0x68')]=function(_0x5cd4d1,_0x112ce4){if(_0x5cd4d1['body']['id']){delete _0x5cd4d1['body']['id'];}return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x5cd4d1[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x112ce4,null))[_0x65ca('0x14')](function(_0x8716fd){if(_0x8716fd){_0x5cd4d1[_0x65ca('0x60')][_0x65ca('0x69')]=_0x8716fd['id'];return db[_0x65ca('0x6a')][_0x65ca('0x5f')](_0x5cd4d1['body']);}})[_0x65ca('0x14')](respondWithResult(_0x112ce4,null))['catch'](handleError(_0x112ce4,null));};exports['getDispositions']=function(_0x45e31a,_0x38c5a3){var _0x219b9a={'raw':![],'where':{}};var _0x3ffc24={};var _0x52abc2={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x65ca('0x6b')]({'where':{'id':_0x45e31a[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x38c5a3,null))['then'](function(_0x19ff90){if(_0x19ff90){_0x3ffc24[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0x6a')][_0x65ca('0x46')]);_0x3ffc24[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x45e31a['query']);_0x3ffc24[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x3ffc24[_0x65ca('0x42')],_0x3ffc24[_0x65ca('0x48')]);_0x219b9a[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x3ffc24[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x4b')]));_0x219b9a['attributes']=_0x219b9a['attributes'][_0x65ca('0x4d')]?_0x219b9a[_0x65ca('0x4c')]:_0x3ffc24[_0x65ca('0x42')];if(!_0x45e31a[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x219b9a[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x45e31a['query'][_0x65ca('0x22')]);_0x219b9a[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x219b9a['order']=qs[_0x65ca('0x4f')](_0x45e31a[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x219b9a[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x45e31a[_0x65ca('0x48')],_0x3ffc24[_0x65ca('0x49')]));_0x219b9a['where'][_0x65ca('0x69')]=_0x19ff90['id'];if(_0x45e31a[_0x65ca('0x48')][_0x65ca('0x51')]){_0x219b9a[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x219b9a[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x219b9a['attributes'],function(_0xcfaf1d){var _0x9d63cd={};_0x9d63cd[_0xcfaf1d]={'$like':'%'+_0x45e31a[_0x65ca('0x48')]['filter']+'%'};return _0x9d63cd;})});}_0x219b9a=_[_0x65ca('0x53')]({},_0x219b9a,_0x45e31a[_0x65ca('0x55')]);return db['Disposition'][_0x65ca('0x23')]({'where':_0x219b9a[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x153ae8){_0x52abc2[_0x65ca('0x23')]=_0x153ae8;if(_0x45e31a[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x219b9a[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x6a')]['findAll'](_0x219b9a);})['then'](function(_0x56feaf){_0x52abc2['rows']=_0x56feaf;return _0x52abc2;});}})['then'](respondWithFilteredResult(_0x38c5a3,_0x219b9a))[_0x65ca('0x1d')](handleError(_0x38c5a3,null));};exports['removeDispositions']=function(_0x977f32,_0x5e25de){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x977f32[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x5e25de,null))[_0x65ca('0x14')](function(_0x1a577a){if(_0x1a577a){return _0x1a577a[_0x65ca('0x6d')](_0x977f32['query'][_0x65ca('0x6e')]);}})[_0x65ca('0x14')](respondWithStatusCode(_0x5e25de,null))['catch'](handleError(_0x5e25de,null));};exports[_0x65ca('0x6f')]=function(_0x22fab6,_0x4826d3){if(_0x22fab6[_0x65ca('0x60')]['id']){delete _0x22fab6[_0x65ca('0x60')]['id'];}return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x22fab6[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4826d3,null))[_0x65ca('0x14')](function(_0x930e51){if(_0x930e51){_0x22fab6[_0x65ca('0x60')][_0x65ca('0x69')]=_0x930e51['id'];return db[_0x65ca('0x70')]['create'](_0x22fab6[_0x65ca('0x60')]);}})['then'](respondWithResult(_0x4826d3,null))['catch'](handleError(_0x4826d3,null));};exports[_0x65ca('0x71')]=function(_0x540e2c,_0x545514){var _0x51fcae={'raw':![],'where':{}};var _0x222f4f={};var _0xea3cd2={'count':0x0,'rows':[]};return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x540e2c[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x545514,null))[_0x65ca('0x14')](function(_0x5d52e6){if(_0x5d52e6){_0x222f4f[_0x65ca('0x42')]=_['keys'](db['CannedAnswer'][_0x65ca('0x46')]);_0x222f4f[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x540e2c[_0x65ca('0x48')]);_0x222f4f[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x222f4f['model'],_0x222f4f[_0x65ca('0x48')]);_0x51fcae['attributes']=_[_0x65ca('0x4a')](_0x222f4f[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x540e2c['query'][_0x65ca('0x4b')]));_0x51fcae[_0x65ca('0x4c')]=_0x51fcae[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x51fcae[_0x65ca('0x4c')]:_0x222f4f[_0x65ca('0x42')];if(!_0x540e2c[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x51fcae[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x540e2c[_0x65ca('0x48')][_0x65ca('0x22')]);_0x51fcae['offset']=qs['offset'](_0x540e2c['query'][_0x65ca('0x21')]);}_0x51fcae[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x540e2c[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x51fcae[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x540e2c[_0x65ca('0x48')],_0x222f4f['filters']));_0x51fcae[_0x65ca('0x52')][_0x65ca('0x69')]=_0x5d52e6['id'];if(_0x540e2c[_0x65ca('0x48')][_0x65ca('0x51')]){_0x51fcae[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x51fcae['where'],{'$or':_['map'](_0x51fcae[_0x65ca('0x4c')],function(_0x3054ab){var _0x3ba20b={};_0x3ba20b[_0x3054ab]={'$like':'%'+_0x540e2c[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x3ba20b;})});}_0x51fcae=_['merge']({},_0x51fcae,_0x540e2c[_0x65ca('0x55')]);return db[_0x65ca('0x70')]['count']({'where':_0x51fcae[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x20f5ba){_0xea3cd2[_0x65ca('0x23')]=_0x20f5ba;if(_0x540e2c[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x51fcae[_0x65ca('0x57')]=[{'all':!![]}];}return db[_0x65ca('0x70')]['findAll'](_0x51fcae);})[_0x65ca('0x14')](function(_0x3c9dce){_0xea3cd2[_0x65ca('0x59')]=_0x3c9dce;return _0xea3cd2;});}})[_0x65ca('0x14')](respondWithFilteredResult(_0x545514,_0x51fcae))[_0x65ca('0x1d')](handleError(_0x545514,null));};exports[_0x65ca('0x73')]=function(_0x314217,_0x24c2e9){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x314217[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x24c2e9,null))['then'](function(_0x5a74c8){if(_0x5a74c8){return _0x5a74c8[_0x65ca('0x73')](_0x314217[_0x65ca('0x48')]['ids']);}})[_0x65ca('0x14')](respondWithStatusCode(_0x24c2e9,null))[_0x65ca('0x1d')](handleError(_0x24c2e9,null));};exports[_0x65ca('0x74')]=function(_0x27a9d7,_0x1ddc42){_0x27a9d7[_0x65ca('0x60')]['sitepic']=_0x27a9d7['file'][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x27a9d7[_0x65ca('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ddc42,null))[_0x65ca('0x14')](saveUpdates(_0x27a9d7[_0x65ca('0x60')],null))['then'](respondWithResult(_0x1ddc42,null))[_0x65ca('0x1d')](handleError(_0x1ddc42,null));};exports[_0x65ca('0x76')]=function(_0x5cb5d3,_0x4b56c0){_0x5cb5d3[_0x65ca('0x60')][_0x65ca('0x77')]=_0x5cb5d3[_0x65ca('0x78')][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x5cb5d3[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4b56c0,null))['then'](saveUpdates(_0x5cb5d3[_0x65ca('0x60')],null))[_0x65ca('0x14')](respondWithResult(_0x4b56c0,null))['catch'](handleError(_0x4b56c0,null));};exports[_0x65ca('0x79')]=function(_0x24627c,_0x1809e0){_0x24627c['body'][_0x65ca('0x7a')]=_0x24627c['file'][_0x65ca('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0x24627c[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x1809e0,null))[_0x65ca('0x14')](saveUpdates(_0x24627c[_0x65ca('0x60')],null))['then'](respondWithResult(_0x1809e0,null))['catch'](handleError(_0x1809e0,null));};exports['addSystemAvatar']=function(_0xf649fd,_0x5e474f){_0xf649fd[_0x65ca('0x60')]['systemAvatar']=_0xf649fd[_0x65ca('0x78')][_0x65ca('0x75')];return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0xf649fd[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x5e474f,null))[_0x65ca('0x14')](saveUpdates(_0xf649fd[_0x65ca('0x60')],null))[_0x65ca('0x14')](respondWithResult(_0x5e474f,null))[_0x65ca('0x1d')](handleError(_0x5e474f,null));};exports[_0x65ca('0x7b')]=function(_0x2b0e7b,_0x4fe8f3){var _0x45d47b=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x7e'));var _0x497880={'where':{'id':_0x2b0e7b[_0x65ca('0x5a')]['id']},'attributes':['id',_0x65ca('0x7f')],'raw':!![]};var _0xbad6ef=![];return require('../../config/license/util')['getLicense']()[_0x65ca('0x14')](function(_0x59b9e2){if(_0x59b9e2){_0xbad6ef=_0x59b9e2[_0x65ca('0x80')];}})[_0x65ca('0x14')](function(){return db[_0x65ca('0x56')]['find'](_0x497880);})[_0x65ca('0x14')](handleEntityNotFound(_0x4fe8f3,null))[_0x65ca('0x14')](function(_0x2b31f2){if(_0x2b31f2){if(!_[_0x65ca('0x81')](_0x2b31f2['sitepic'])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/images/logos/',_0x2b31f2[_0x65ca('0x7f')]))&&_0xbad6ef){_0x45d47b=path[_0x65ca('0x7c')](config['root'],'server/files/images/logos/',_0x2b31f2[_0x65ca('0x7f')]);}}return _0x4fe8f3[_0x65ca('0x83')](_0x45d47b);}})['catch'](handleError(_0x4fe8f3,null));};exports[_0x65ca('0x84')]=function(_0x535634,_0x3c30ab){var _0x3109e5=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x85'));var _0x4549eb={'where':{'id':_0x535634[_0x65ca('0x5a')]['id']},'attributes':['id',_0x65ca('0x77')],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x4549eb)[_0x65ca('0x14')](handleEntityNotFound(_0x3c30ab,null))[_0x65ca('0x14')](function(_0x3bc765){if(_0x3bc765){if(!_[_0x65ca('0x81')](_0x3bc765[_0x65ca('0x77')])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x3bc765[_0x65ca('0x77')]))){_0x3109e5=path[_0x65ca('0x7c')](config['root'],_0x65ca('0x86'),_0x3bc765[_0x65ca('0x77')]);}}return _0x3c30ab[_0x65ca('0x83')](_0x3109e5);}})[_0x65ca('0x1d')](handleError(_0x3c30ab,null));};exports[_0x65ca('0x87')]=function(_0x3a1ad5,_0x51910c){var _0x383cbc=path[_0x65ca('0x7c')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0xfcda7e={'where':{'id':_0x3a1ad5['params']['id']},'attributes':['id',_0x65ca('0x7a'),'showCustomerAvatar'],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0xfcda7e)[_0x65ca('0x14')](handleEntityNotFound(_0x51910c,null))['then'](function(_0x1e735c){if(_0x1e735c){if(!_[_0x65ca('0x81')](_0x1e735c[_0x65ca('0x7a')])){if(fs[_0x65ca('0x82')](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x1e735c[_0x65ca('0x7a')]))&&_0x1e735c[_0x65ca('0x88')]){_0x383cbc=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x86'),_0x1e735c[_0x65ca('0x7a')]);}}return _0x51910c[_0x65ca('0x83')](_0x383cbc);}})['catch'](handleError(_0x51910c,null));};exports[_0x65ca('0x89')]=function(_0x30bfa3,_0x4903bf){var _0x222649=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0x8a'));var _0x331093={'where':{'id':_0x30bfa3['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x65ca('0x56')][_0x65ca('0x5e')](_0x331093)[_0x65ca('0x14')](handleEntityNotFound(_0x4903bf,null))['then'](function(_0x5bbc7a){if(_0x5bbc7a){if(!_[_0x65ca('0x81')](_0x5bbc7a[_0x65ca('0x8b')])){if(fs[_0x65ca('0x82')](path['join'](config[_0x65ca('0x7d')],'server/files/images/avatars/',_0x5bbc7a[_0x65ca('0x8b')]))){_0x222649=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/images/avatars/',_0x5bbc7a['systemAvatar']);}}return _0x4903bf['download'](_0x222649);}})['catch'](handleError(_0x4903bf,null));};exports[_0x65ca('0x8c')]=function(_0x1768d1,_0x5e5c3b){var _0xd1aac={'body':_0x1768d1[_0x65ca('0x60')],'channel':'chat'};var _0x525f3e=[];var _0x4db97b=[];var _0x13dcb6={};var _0x2eda1a=![];return db['CmContact'][_0x65ca('0x67')]()[_0x65ca('0x14')](function(_0x117389){if(!_0x117389){throw new db['Sequelize'][(_0x65ca('0x8d'))]('no\x20available\x20attributes');}_0x525f3e=_['difference'](_[_0x65ca('0x5c')](_0x117389),[_0x65ca('0x8e'),_0x65ca('0x8f')]);_0x4db97b=_['difference'](_[_0x65ca('0x5c')](_0x117389),[_0x65ca('0x8e'),_0x65ca('0x8f'),_0x65ca('0x90'),'ListId']);if(_0x1768d1[_0x65ca('0x60')]['id']){delete _0x1768d1[_0x65ca('0x60')]['id'];}if(_[_0x65ca('0x81')](_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')])){throw new db['Sequelize'][(_0x65ca('0x8d'))](_0x65ca('0x92'));}if(_[_0x65ca('0x81')](_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')])||_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')]===''){throw new db[(_0x65ca('0x93'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1768d1['body'][_0x65ca('0x94')])){throw new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0x95')+_0x4db97b);}if(!_['includes'](_0x4db97b,_0x1768d1[_0x65ca('0x60')][_0x65ca('0x94')])){throw new db['Sequelize']['ValidationError'](_0x65ca('0x96')+_0x4db97b);}_0x13dcb6[_0x1768d1[_0x65ca('0x60')][_0x65ca('0x94')]]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1768d1[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x97')],'as':_0x65ca('0x98'),'include':[{'model':db[_0x65ca('0x99')],'as':_0x65ca('0x9a'),'where':_0x13dcb6,'limit':0x1,'order':[[_0x65ca('0x8f'),'DESC']]}]},{'model':db[_0x65ca('0x9b')],'as':_0x65ca('0x9c')},{'model':db['Interval'],'as':_0x65ca('0x9d'),'include':[{'model':db[_0x65ca('0x9d')],'as':'Intervals','attributes':['id',_0x65ca('0x2d')],'raw':!![]}]}]});})['then'](function(_0x3f0eaf){if(!_0x3f0eaf)throw new APINotFoundError(util[_0x65ca('0x3f')](_0x65ca('0x9e'),_0x1768d1[_0x65ca('0x5a')]['id']));if(!_0x3f0eaf['Interval']||!_0x3f0eaf['Interval'][_0x65ca('0x33')])return[_0x3f0eaf,!![]];return[_0x3f0eaf,checkWebsiteIntervals(_0x3f0eaf)];})[_0x65ca('0x9f')](function(_0x4700c7,_0x3782fc){if(!_0x3782fc)throw new APIOutOfIntervalError();if(!_0x4700c7[_0x65ca('0x98')])return;_0xd1aac[_0x65ca('0xa0')]=_0x4700c7;_0xd1aac[_0x65ca('0xa1')]=_0x4700c7['List'];_0xd1aac[_0x65ca('0xa2')]=_[_0x65ca('0xa3')](_0x4700c7[_0x65ca('0x9c')],[_0x65ca('0xa4')],[_0x65ca('0xa5')]);if(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0x9c')]){delete _0xd1aac[_0x65ca('0xa0')][_0x65ca('0x9c')];}if(_0xd1aac['account'][_0x65ca('0x98')]&&_0xd1aac[_0x65ca('0xa0')]['List'][_0x65ca('0x9a')][_0x65ca('0x4d')]){return _0xd1aac[_0x65ca('0xa0')][_0x65ca('0x98')][_0x65ca('0x9a')][0x0];}var _0x4a7cf0=_[_0x65ca('0xa6')](_0x1768d1['body'],{'firstName':_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')],'ListId':_0x4700c7[_0x65ca('0xa7')]});_0x4a7cf0[_0x1768d1[_0x65ca('0x60')]['mapKey']]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0x91')];return db[_0x65ca('0x99')][_0x65ca('0x5f')](_0x4a7cf0,{'fields':_0x525f3e,'raw':!![]});})[_0x65ca('0x14')](function(_0x3fcbbb){_0xd1aac['contact']=_0x3fcbbb;var _0x53ad5b=createInteractionObject(_0x1768d1[_0x65ca('0x5a')]['id'],_0x1768d1[_0x65ca('0x60')],_0x1768d1[_0x65ca('0xa8')],_0x3fcbbb);var _0x29db8c={'ChatWebsiteId':_0x1768d1[_0x65ca('0x5a')]['id'],'closed':![]};if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]){_0x29db8c[_0x65ca('0xa9')]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')];return db[_0x65ca('0xaa')][_0x65ca('0x5e')]({'where':_0x29db8c})[_0x65ca('0x14')](function(_0x408ed4){if(_0x408ed4){_0x2eda1a=!![];return _0x408ed4;}_0x53ad5b[_0x65ca('0xa9')]=_0x1768d1['body'][_0x65ca('0xa9')];_0x53ad5b[_0x65ca('0xab')]=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xab')];return db['ChatInteraction'][_0x65ca('0x5f')](_0x53ad5b);});}_0x29db8c[_0x65ca('0xac')]=_0x3fcbbb['id'];if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xad')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xad')]['id']){_0x29db8c['id']=_0x1768d1[_0x65ca('0x60')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x29db8c})['then'](function(_0xff95a5){if(_0xff95a5){_0x2eda1a=!![];return _0xff95a5;}return db[_0x65ca('0xaa')][_0x65ca('0x5f')](_0x53ad5b);});}return db['ChatInteraction'][_0x65ca('0x5f')](_0x53ad5b);})['then'](function(_0x13245b){if(!_0x2eda1a)return _0x13245b;var _0x4345d7={'from':(_0xd1aac[_0x65ca('0xae')][_0x65ca('0xaf')]||'')+'\x20'+(_0xd1aac[_0x65ca('0xae')]['lastName']||'')};if(_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb0')]&&_0x1768d1[_0x65ca('0x60')][_0x65ca('0xa9')]!=_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb0')]){_0x4345d7[_0x65ca('0xa9')]=_0x1768d1['body'][_0x65ca('0xb0')];}return _0x13245b[_0x65ca('0x25')](_0x4345d7);})[_0x65ca('0x14')](function(_0x3edb11){_0xd1aac[_0x65ca('0xad')]=_0x3edb11[_0x65ca('0x27')]({'plain':!![]});_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb1')]=!_0x2eda1a;if(_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb1')]){if(_0xd1aac['account'][_0x65ca('0xb2')]){_0xd1aac['applications']['push']({'id':0x0,'priority':_0xd1aac['applications'][_0x65ca('0x4d')]+0x1,'app':_0x65ca('0xb3'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x65ca('0xb4')][_0x65ca('0x5f')]({'body':_0x1768d1[_0x65ca('0x60')][_0x65ca('0x60')],'ChatWebsiteId':_0x1768d1['params']['id'],'ChatInteractionId':_0x3edb11['id'],'direction':'in','ContactId':_0xd1aac[_0x65ca('0xae')]['id'],'AttachmentId':_0x1768d1[_0x65ca('0x60')][_0x65ca('0xb5')]});})[_0x65ca('0x14')](function(_0x29f9a8){_0xd1aac[_0x65ca('0x1b')]=_0x29f9a8;if(!_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb6')]){return;}return db[_0x65ca('0xb7')][_0x65ca('0x5e')]({'attributes':['id',_0x65ca('0x2b')],'where':{'id':_0xd1aac[_0x65ca('0xad')][_0x65ca('0xb6')]}});})[_0x65ca('0x14')](function(_0x57218d){if(_0x57218d){_0xd1aac[_0x65ca('0xa2')][_0x65ca('0xb8')]({'id':0x0,'priority':0x0,'app':_0x65ca('0xb9'),'appdata':_0x57218d['name']+','+(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0xba')]||0xa),'interval':_0x65ca('0xbb')});_0xd1aac[_0x65ca('0xbc')]=!![];}if(!_0xd1aac[_0x65ca('0xad')]['queueId']){return;}return db[_0x65ca('0xbd')][_0x65ca('0x5e')]({'attributes':['id',_0x65ca('0x2b')],'where':{'id':_0xd1aac['interaction']['queueId']}});})[_0x65ca('0x14')](function(_0x2b0b0b){if(_0x2b0b0b){_0xd1aac[_0x65ca('0xa2')][_0x65ca('0xb8')]({'id':0x0,'priority':0x1,'app':_0x65ca('0xbe'),'appdata':_0x2b0b0b[_0x65ca('0x2b')]+','+(_0xd1aac[_0x65ca('0xa0')][_0x65ca('0xbf')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x65ca('0xc0'),_0x65ca('0xc1'),_0xd1aac);})[_0x65ca('0x14')](function(_0x2ce01d){respondWithRpcPromise(_0x65ca('0xc2'),_0x65ca('0xc2'),{'event':_0x65ca('0x8c'),'message':_0x2ce01d},client9002);return _0x2ce01d;})[_0x65ca('0x14')](respondWithResult(_0x5e5c3b,null))[_0x65ca('0x1d')](APIHandleError(_0x5e5c3b));};exports[_0x65ca('0xc3')]=function(_0x3c4d6c,_0x109db6){var _0x58d483,_0x495df0,_0x575f1d;var _0xd33a5f=[];var _0x8e4505={};var _0x4a371f=_0x3c4d6c['files']||[];var _0x4e9e53=[];var _0x428263;return db[_0x65ca('0x99')][_0x65ca('0x67')]()[_0x65ca('0x14')](function(_0x17e65e){if(!_0x17e65e){throw new db[(_0x65ca('0x93'))]['ValidationError']('no\x20available\x20attributes');}_0xd33a5f=_[_0x65ca('0xc4')](_[_0x65ca('0x5c')](_0x17e65e),['createdAt','updatedAt',_0x65ca('0x90'),_0x65ca('0xa7')]);if(_0x3c4d6c['body']['id']){delete _0x3c4d6c[_0x65ca('0x60')]['id'];}if(_[_0x65ca('0x81')](_0x3c4d6c['body'][_0x65ca('0x91')])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db['Sequelize'][(_0x65ca('0x8d'))](_0x65ca('0x92')));}if(_[_0x65ca('0x81')](_0x3c4d6c['body'][_0x65ca('0x60')])||_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x60')]===''){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc6')));}if(_[_0x65ca('0x81')](_0x3c4d6c[_0x65ca('0x60')]['mapKeyOffline'])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc7')+_0xd33a5f));}if(!_['includes'](_0xd33a5f,_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')])){throw _0x109db6[_0x65ca('0x1e')](0x1f4)[_0x65ca('0xc5')](new db[(_0x65ca('0x93'))][(_0x65ca('0x8d'))](_0x65ca('0xc9')+_0xd33a5f));}_0x8e4505[_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')]]=_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')];})[_0x65ca('0x14')](function(){return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'where':{'id':_0x3c4d6c[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x97')],'as':_0x65ca('0x98')},{'model':db[_0x65ca('0xca')],'as':_0x65ca('0xca')}]});})['then'](handleEntityNotFound(_0x109db6,null))['then'](function(_0x37accc){if(_0x37accc&&_0x37accc[_0x65ca('0x98')]){_0x495df0=_0x37accc;var _0xf1a60a=_[_0x65ca('0xa6')](_0x3c4d6c[_0x65ca('0x60')],{'firstName':_0x3c4d6c[_0x65ca('0x60')]['from'],'phone':_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')],'ListId':_0x37accc[_0x65ca('0xa7')]});_0xf1a60a[_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0xc8')]]=_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x91')];return db[_0x65ca('0x99')]['findOrCreate']({'where':_0x8e4505,'defaults':_0xf1a60a});}})[_0x65ca('0x9f')](function(_0x438a21){if(_0x438a21){_0x575f1d=_0x438a21;var _0x24135e=fs[_0x65ca('0xcb')](path['join'](config[_0x65ca('0x7d')],_0x65ca('0xcc')),'utf8');var _0x178c63=ejs[_0x65ca('0xcd')](_0x24135e,{'body':_[_0x65ca('0xce')](_0x3c4d6c[_0x65ca('0x60')][_0x65ca('0x60')]),'bodyTitle':_0x495df0[_0x65ca('0xcf')]});return db[_0x65ca('0xd0')][_0x65ca('0x5f')]({'body':_0x178c63,'plainBody':htmlToText[_0x65ca('0xd1')](_0x178c63),'ContactId':_0x438a21['id'],'ChatWebsiteId':_0x495df0['id']});}})[_0x65ca('0x14')](function(_0x44cd94){_0x428263=_0x44cd94;if(_0x4a371f[_0x65ca('0x4d')]){var _0x5ea09b=_0x4a371f[_0x65ca('0x32')](function(_0x5b5e45){return{'name':_0x5b5e45[_0x65ca('0xd2')],'basename':_0x5b5e45[_0x65ca('0x75')],'type':_0x5b5e45[_0x65ca('0xd3')],'ChatOfflineMessageId':_0x44cd94['id']};});_0x4e9e53=_0x5ea09b[_0x65ca('0x32')](_0x15dae9=>{var _0x42689b={'filename':_0x15dae9[_0x65ca('0x2b')],'path':path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],_0x65ca('0xd4'),_0x65ca('0xd5'),_0x65ca('0xd6'),_0x65ca('0xd7'),_0x15dae9[_0x65ca('0xd8')])};return _0x42689b;});if(!_0x495df0[_0x65ca('0xd9')]){return db[_0x65ca('0xda')][_0x65ca('0xdb')](function(_0x1aa96b){return db[_0x65ca('0xdc')][_0x65ca('0xdd')](_0x5ea09b,{'transaction':_0x1aa96b});});}}})['then'](function(){if(_0x428263){_0x58d483=_0x428263;return db[_0x65ca('0xca')][_0x65ca('0x6b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x65ca('0xde'),'raw':!![],'include':[{'model':db[_0x65ca('0xdf')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x65ca('0x14')](function(_0x3a1938){if(_0x3a1938&&_0x3a1938[_0x65ca('0xde')]&&_0x495df0[_0x65ca('0xe0')]&&_0x495df0[_0x65ca('0xe1')]){var _0x45b23a=_0x3a1938['getSmtpOptions']();return respondWithRpcPromise(_0x65ca('0xe2'),'sendMail',{'account':_0x45b23a,'message':{'from':util[_0x65ca('0x3f')]('\x22%s\x22\x20<%s>',_0x3a1938[_0x65ca('0x2b')],_0x3a1938[_0x65ca('0xe3')]||_0x3a1938[_0x65ca('0xde')][_0x65ca('0x61')]),'to':_0x495df0[_0x65ca('0xe1')],'subject':_0x495df0['offlineMessageSubject'],'html':_0x58d483[_0x65ca('0x60')],'attachments':_0x4e9e53}},client9003)[_0x65ca('0x14')](function(){return _0x58d483;})[_0x65ca('0x1d')](function(_0x34f660){logger['error'](_0x34f660);});}})[_0x65ca('0x14')](function(){if(_0x495df0&&_0x495df0[_0x65ca('0xd9')]&&_0x495df0[_0x65ca('0xe4')]){var _0x52ccec=[];if(_0x4a371f[_0x65ca('0x4d')]){_0x52ccec=_0x4a371f[_0x65ca('0x32')](function(_0xf51ca6){return{'name':_0xf51ca6[_0x65ca('0xd2')],'basename':_0xf51ca6['filename'],'type':_0xf51ca6[_0x65ca('0xd3')],'ChatOfflineMessageId':_0x428263['id']};});}var _0x5a557f;if(!_[_0x65ca('0x81')](_0x495df0['subjectOffline'])){var _0x31abbf=_['map'](_0x3c4d6c[_0x65ca('0x60')],function(_0xf24f07){return _0xf24f07;});var _0x2857b8=_['toPairsIn'](_0x31abbf)[0x0];var _0x2190a5=_['mapValues'](_0x2857b8,function(_0x338901){return _0x338901;});_0x5a557f=_0x2190a5[0x1][_0x495df0[_0x65ca('0xe5')]];}var _0x1c3688={'from':_0x575f1d[_0x65ca('0xe3')],'firstName':_0x575f1d[_0x65ca('0xaf')],'lastName':_0x575f1d['lastName'],'mapKey':_0x65ca('0xe3'),'message':{'from':_0x575f1d['email'],'to':_0x495df0[_0x65ca('0xca')]['email'],'cc':'','subject':_[_0x65ca('0x81')](_0x5a557f)?_0x495df0[_0x65ca('0xe6')]:_0x5a557f,'messageId':'','sentAt':new Date(),'attach':_0x52ccec[_0x65ca('0x4d')],'attachments':_0x52ccec,'originChannel':'Chat','ChatWebsiteId':_0x495df0['id'],'ChatOfflineMessageId':_0x58d483['id'],'originTo':_0x495df0[_0x65ca('0xca')][_0x65ca('0xe3')]},'body':_0x58d483[_0x65ca('0x60')]};var _0x3a200d={'account':{'id':_0x495df0['MailAccountId']},'body':_0x1c3688,'log':_0x65ca('0xe7')};return respondWithRpcPromise(_0x65ca('0xe7'),_0x65ca('0xe8'),_0x3a200d,client9001)['then'](function(){return _0x58d483;})[_0x65ca('0x1d')](function(_0x905625){logger[_0x65ca('0x19')](_0x905625);});}return;})[_0x65ca('0x14')](function(){if(_0x58d483){return _0x58d483;}})['then'](respondWithResult(_0x109db6,null))[_0x65ca('0x1d')](function(){for(var _0x31ba50 of _0x4a371f){var _0x4a0957=path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server',_0x65ca('0xd5'),_0x65ca('0xd6'),_0x65ca('0xd7'),_0x31ba50[_0x65ca('0x75')]);fs_extra[_0x65ca('0xe9')](_0x4a0957)[_0x65ca('0x1d')](function(_0x10e2f4){logger[_0x65ca('0x19')](_0x65ca('0xea'),_0x4a0957,_0x10e2f4);});}});};exports['addInteraction']=function(_0x104eff,_0x1d97c7){return db[_0x65ca('0xaa')]['find']({'where':{'id':_0x104eff['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x1d97c7,null))['then'](function(_0x2f3158){if(_0x2f3158){return _0x2f3158[_0x65ca('0xeb')](_0x104eff['body'][_0x65ca('0x6e')],_[_0x65ca('0xec')](_0x104eff[_0x65ca('0x60')],[_0x65ca('0x6e'),'id'])||{});}})[_0x65ca('0x14')](respondWithResult(_0x1d97c7,null))['catch'](handleError(_0x1d97c7,null));};exports[_0x65ca('0xed')]=function(_0x545935,_0x4952f9){var _0x4ac9e1={'raw':![],'where':{}};var _0x110640={};var _0x23fcfe={'count':0x0,'rows':[]};return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x545935[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4952f9,null))[_0x65ca('0x14')](function(_0x3778cb){if(_0x3778cb){_0x110640[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0xaa')][_0x65ca('0x46')]);_0x110640[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x545935['query']);_0x110640[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x110640[_0x65ca('0x42')],_0x110640['query']);_0x4ac9e1[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x110640[_0x65ca('0x42')],qs['fields'](_0x545935['query'][_0x65ca('0x4b')]));_0x4ac9e1['attributes']=_0x4ac9e1['attributes']['length']?_0x4ac9e1[_0x65ca('0x4c')]:_0x110640[_0x65ca('0x42')];if(!_0x545935[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x4ac9e1[_0x65ca('0x22')]=qs['limit'](_0x545935[_0x65ca('0x48')][_0x65ca('0x22')]);_0x4ac9e1[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x545935[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x4ac9e1[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x545935[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x4ac9e1[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x545935[_0x65ca('0x48')],_0x110640[_0x65ca('0x49')]));_0x4ac9e1['where'][_0x65ca('0x69')]=_0x3778cb['id'];if(_0x545935['query']['filter']){_0x4ac9e1[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x4ac9e1['where'],{'$or':_['map'](_0x4ac9e1[_0x65ca('0x4c')],function(_0x120cb3){var _0x4f7c6d={};_0x4f7c6d[_0x120cb3]={'$like':'%'+_0x545935[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x4f7c6d;})});}_0x4ac9e1=_[_0x65ca('0x53')]({},_0x4ac9e1,_0x545935[_0x65ca('0x55')]);return db['ChatInteraction']['count']({'where':_0x4ac9e1['where']})[_0x65ca('0x14')](function(_0x5d5556){_0x23fcfe[_0x65ca('0x23')]=_0x5d5556;if(_0x545935[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x4ac9e1['include']=[{'model':db[_0x65ca('0x99')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x65ca('0xee'),'attributes':[_0x65ca('0x2b'),_0x65ca('0xef'),_0x65ca('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x65ca('0xf1'),'attributes':['id',_0x65ca('0x2b'),'color'],'where':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]?{'id':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]}:undefined,'required':_0x545935[_0x65ca('0x48')][_0x65ca('0xf2')]?!![]:![]}];}return db['ChatInteraction'][_0x65ca('0x58')](_0x4ac9e1);})[_0x65ca('0x14')](function(_0x442f08){_0x23fcfe[_0x65ca('0x59')]=_0x442f08;return _0x23fcfe;});}})['then'](respondWithFilteredResult(_0x4952f9,_0x4ac9e1))[_0x65ca('0x1d')](handleError(_0x4952f9,null));};exports['getSnippet']=function(_0x3077e0,_0x5dfbf4){var _0x90752e=0x0;var _0xb5afcd=0x0;var _0x5a16b3=![];var _0x54cd6f;var _0x2215b4;return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x3077e0[_0x65ca('0x5a')]['id']},'include':[{'model':db[_0x65ca('0x9d')],'as':_0x65ca('0x9d'),'include':[{'model':db[_0x65ca('0x9d')],'as':_0x65ca('0x33'),'attributes':['id',_0x65ca('0x2d')]}]}]})[_0x65ca('0x14')](handleEntityNotFound(_0x5dfbf4,null))[_0x65ca('0x14')](function(_0x5469b0){if(_0x5469b0){_0x54cd6f=_0x5469b0;return _0x5469b0[_0x65ca('0xf3')]({'raw':!![]});}})[_0x65ca('0x14')](function(_0x28df01){if(_0x54cd6f){if(_0x28df01){_0x2215b4=_0x28df01;}}return require('../../config/license/util')[_0x65ca('0xf4')]();})[_0x65ca('0x14')](function(_0x183979){if(_0x183979){_0xb5afcd=_0x183979[_0x65ca('0xf5')];_0x5a16b3=_0x183979['custom'];}})['then'](function(){return db[_0x65ca('0xaa')]['count']({'where':{'closed':![]}});})[_0x65ca('0x14')](function(_0x1543bf){_0x90752e=_0x1543bf;if(_0xb5afcd&&_0x1543bf>_0xb5afcd){return db['License'][_0x65ca('0x6b')]({'where':{'id':0x1}})[_0x65ca('0x14')](function(_0x4373a9){if(_0x4373a9){_0x4373a9[_0x65ca('0xf6')]('chatLicenseExceeded');}});}})['then'](function(){if(!_0x54cd6f[_0x65ca('0x9d')]||!_0x54cd6f['Interval'][_0x65ca('0x33')])return!![];return checkWebsiteIntervals(_0x54cd6f);})['then'](function(_0xc7c019){var _0x4eed0f=fs['readFileSync'](path[_0x65ca('0x7c')](config[_0x65ca('0x7d')],'server/files/chat/iframe.ejs'),_0x65ca('0xf7'));var _0x4004bd=new url[(_0x65ca('0xf8'))](_0x54cd6f['address'])['origin'];var _0x4d4f48=_0x65ca('0xf9');var _0x49be28=![];var _0xfe3576={'chatVersion':_0x4d4f48,'chatWebsiteAddressOrigin':_0x4004bd,'remote':_0x54cd6f[_0x65ca('0xfa')],'query':querystring[_0x65ca('0x18')](_[_0x65ca('0x53')](_0x54cd6f[_0x65ca('0x27')]({'plain':!![]}),{'customerIp':_0x3077e0['headers'][_0x65ca('0x3a')]||_0x3077e0[_0x65ca('0xa8')][_0x65ca('0xfb')]||_0x3077e0['connection'][_0x65ca('0xfc')]||_0x3077e0['ip'],'referer':_0x3077e0[_0x65ca('0xa8')][_0x65ca('0xfd')],'openedInteractions':_0x90752e,'maxInteractions':_0xb5afcd,'virtual':_0x5a16b3[_0x65ca('0xf5')],'online':_0xc7c019,'custom':_0x5a16b3}))[_0x65ca('0xfe')](/'/g,'\x5c\x27')};_0x5dfbf4[_0x65ca('0xc5')](ejs[_0x65ca('0xcd')](Mustache[_0x65ca('0xcd')](_0x4eed0f,_0xfe3576),{'proactiveActions':_0x2215b4,'alignment':_0x54cd6f[_0x65ca('0xff')],'verticalAlignment':_0x54cd6f['verticalAlignment'],'div_color':_0x54cd6f['color'],'labelText':_0x54cd6f[_0x65ca('0x100')],'text_color':_0x54cd6f[_0x65ca('0x101')],'text_button_color':_0x54cd6f[_0x65ca('0x102')],'button_color':_0x54cd6f['color_button'],'background_color':_0x54cd6f['backgroundColor'],'hideWhenOffline':_0x54cd6f[_0x65ca('0x103')],'intervalId':_0x54cd6f[_0x65ca('0x104')],'isDevelopment':_0x49be28,'chatVersion':_0x4d4f48}));})[_0x65ca('0x1d')](handleError(_0x5dfbf4,null));};exports['addApplications']=function(_0x1d7d66,_0x258ea6){var _0x30954d=_0x1d7d66[_0x65ca('0x5a')]['id'];var _0x317ef8=_0x1d7d66[_0x65ca('0x60')];var _0x550ebc=0xc8;var _0x13a2b2=null;return db[_0x65ca('0xda')][_0x65ca('0xdb')]({'isolationLevel':db[_0x65ca('0xda')][_0x65ca('0x105')][_0x65ca('0x106')][_0x65ca('0x107')]},function(_0x1409ca){return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x30954d},'transaction':_0x1409ca})['then'](function(_0x579a33){if(_0x579a33){return db[_0x65ca('0x9b')][_0x65ca('0x26')]({'where':{'ChatWebsiteId':_0x30954d},'transaction':_0x1409ca})[_0x65ca('0x14')](function(){var _0x48672d=_[_0x65ca('0x32')](_0x317ef8,function(_0x239487){_0x239487[_0x65ca('0x69')]=_0x30954d;return _0x239487;});return db['ChatApplication'][_0x65ca('0xdd')](_0x48672d,{'transaction':_0x1409ca});});}else{_0x550ebc=0x194;_0x13a2b2=[];}});})[_0x65ca('0x14')](function(){if(_0x550ebc!==0x194){return db[_0x65ca('0x9b')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x30954d},'order':_0x65ca('0xa4')})[_0x65ca('0x14')](function(_0x3e1ada){_0x13a2b2=_0x3e1ada;});}})[_0x65ca('0x1d')](function(_0x2ef69f){_0x550ebc=0x1f4;logger[_0x65ca('0x19')](_0x2ef69f[_0x65ca('0x2a')]);if(_0x2ef69f[_0x65ca('0x2b')]){delete _0x2ef69f[_0x65ca('0x2b')];}_0x13a2b2=_0x2ef69f;})[_0x65ca('0x108')](function(){if(_0x13a2b2===null){_0x258ea6['sendStatus'](_0x550ebc);}else{if(_0x550ebc===0x1f4){_0x258ea6[_0x65ca('0x1e')](_0x550ebc)[_0x65ca('0xc5')](_0x13a2b2);}else{_0x258ea6[_0x65ca('0x1e')](_0x550ebc)['json'](_0x13a2b2);}}});};exports[_0x65ca('0x109')]=function(_0x3ff6dc,_0x4c5093){var _0x2066fe={};var _0x164317={};var _0x11b39b;var _0x455ef7;return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x3ff6dc[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x4c5093,null))['then'](function(_0x2b6297){if(_0x2b6297){_0x11b39b=_0x2b6297;_0x164317['model']=_[_0x65ca('0x5c')](db['ChatApplication'][_0x65ca('0x46')]);_0x164317[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x3ff6dc[_0x65ca('0x48')]);_0x164317[_0x65ca('0x49')]=_['intersection'](_0x164317['model'],_0x164317['query']);_0x2066fe[_0x65ca('0x4c')]=_['intersection'](_0x164317[_0x65ca('0x42')],qs[_0x65ca('0x4b')](_0x3ff6dc['query'][_0x65ca('0x4b')]));_0x2066fe[_0x65ca('0x4c')]=_0x2066fe[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x2066fe['attributes']:_0x164317[_0x65ca('0x42')];_0x2066fe[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x3ff6dc[_0x65ca('0x48')]['sort']);_0x2066fe[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x3ff6dc['query'],_0x164317[_0x65ca('0x49')]));if(_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x51')]){_0x2066fe['where']=_[_0x65ca('0x53')](_0x2066fe['where'],{'$or':_[_0x65ca('0x32')](_0x2066fe[_0x65ca('0x4c')],function(_0x339ce0){var _0x2539cf={};_0x2539cf[_0x339ce0]={'$like':'%'+_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x51')]+'%'};return _0x2539cf;})});}_0x2066fe=_[_0x65ca('0x53')]({},_0x2066fe,_0x3ff6dc[_0x65ca('0x55')]);return _0x11b39b['getApplications'](_0x2066fe);}})[_0x65ca('0x14')](function(_0x23a85d){if(_0x23a85d){_0x455ef7=_0x23a85d[_0x65ca('0x4d')];if(!_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x2066fe['limit']=qs[_0x65ca('0x22')](_0x3ff6dc[_0x65ca('0x48')][_0x65ca('0x22')]);_0x2066fe[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x3ff6dc['query'][_0x65ca('0x21')]);}return _0x11b39b[_0x65ca('0x109')](_0x2066fe);}})[_0x65ca('0x14')](function(_0x121959){if(_0x121959){return _0x121959?{'count':_0x455ef7,'rows':_0x121959}:null;}})['then'](respondWithResult(_0x4c5093,null))[_0x65ca('0x1d')](handleError(_0x4c5093,null));};exports[_0x65ca('0x10a')]=function(_0x1b34a5,_0x29a56a){return db['chatProactiveAction'][_0x65ca('0x5e')]({'where':{'id':_0x1b34a5['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x29a56a,null))[_0x65ca('0x14')](function(_0x58f852){if(_0x58f852){return _0x58f852[_0x65ca('0x10a')](_0x1b34a5[_0x65ca('0x60')][_0x65ca('0x6e')],_['omit'](_0x1b34a5['body'],[_0x65ca('0x6e'),'id'])||{});}})[_0x65ca('0x14')](respondWithResult(_0x29a56a,null))['catch'](handleError(_0x29a56a,null));};exports[_0x65ca('0xf3')]=function(_0x4cbf4a,_0x196769){var _0x397c14={};var _0x578c54={};var _0x3c08d3;var _0xcf9335;return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x4cbf4a[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x196769,null))[_0x65ca('0x14')](function(_0x3833fc){if(_0x3833fc){_0x3c08d3=_0x3833fc;_0x578c54[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db[_0x65ca('0x10b')][_0x65ca('0x46')]);_0x578c54[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x4cbf4a[_0x65ca('0x48')]);_0x578c54[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x578c54[_0x65ca('0x42')],_0x578c54[_0x65ca('0x48')]);_0x397c14[_0x65ca('0x4c')]=_['intersection'](_0x578c54['model'],qs[_0x65ca('0x4b')](_0x4cbf4a['query'][_0x65ca('0x4b')]));_0x397c14[_0x65ca('0x4c')]=_0x397c14['attributes'][_0x65ca('0x4d')]?_0x397c14[_0x65ca('0x4c')]:_0x578c54[_0x65ca('0x42')];_0x397c14[_0x65ca('0x72')]=qs['sort'](_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x397c14[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x4cbf4a[_0x65ca('0x48')],_0x578c54[_0x65ca('0x49')]));if(_0x4cbf4a[_0x65ca('0x48')]['filter']){_0x397c14[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x397c14[_0x65ca('0x52')],{'$or':_['map'](_0x397c14['attributes'],function(_0x19bf8a){var _0x121224={};_0x121224[_0x19bf8a]={'$like':'%'+_0x4cbf4a['query'][_0x65ca('0x51')]+'%'};return _0x121224;})});}_0x397c14=_[_0x65ca('0x53')]({},_0x397c14,_0x4cbf4a[_0x65ca('0x55')]);return _0x3c08d3[_0x65ca('0xf3')](_0x397c14);}})[_0x65ca('0x14')](function(_0x2bc40a){if(_0x2bc40a){_0xcf9335=_0x2bc40a[_0x65ca('0x4d')];if(!_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x397c14[_0x65ca('0x22')]=qs[_0x65ca('0x22')](_0x4cbf4a[_0x65ca('0x48')][_0x65ca('0x22')]);_0x397c14['offset']=qs[_0x65ca('0x21')](_0x4cbf4a['query'][_0x65ca('0x21')]);}return _0x3c08d3['getProactiveActions'](_0x397c14);}})[_0x65ca('0x14')](function(_0x3013c6){if(_0x3013c6){return _0x3013c6?{'count':_0xcf9335,'rows':_0x3013c6}:null;}})[_0x65ca('0x14')](respondWithResult(_0x196769,null))[_0x65ca('0x1d')](handleError(_0x196769,null));};exports['getFields']=function(_0x225412,_0x3199b3){var _0x23a14f=_0x225412[_0x65ca('0x48')]['online']===_0x65ca('0x10c')?_0x65ca('0x10d'):'onlineForm';return db[_0x65ca('0x56')][_0x65ca('0x5e')]({'attributes':['id',_0x23a14f],'where':{'id':_0x225412[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x3199b3,null))[_0x65ca('0x14')](function(_0x1589c9){if(_0x1589c9){var _0x4b6c1f=_0x1589c9[_0x23a14f];var _0x29f953=_0x4b6c1f&&_0x4b6c1f['items']?_0x4b6c1f[_0x65ca('0x10e')]:[];_0x3199b3[_0x65ca('0xc5')]({'fromKey':_['isNil'](_0x4b6c1f[_0x65ca('0x10f')])?undefined:_0x4b6c1f['fromKey'],'count':_0x29f953['length'],'rows':_0x29f953});}})[_0x65ca('0x1d')](handleError(_0x3199b3,null));};exports[_0x65ca('0x110')]=function(_0x2bd1b4,_0x10468b){var _0x14c8e4={'raw':![],'where':{}};var _0x5887a0={};var _0x314dd3={'count':0x0,'rows':[]};return db[_0x65ca('0x56')][_0x65ca('0x6b')]({'where':{'id':_0x2bd1b4[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x10468b,null))[_0x65ca('0x14')](function(_0x33da7b){if(_0x33da7b){_0x5887a0[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db['ChatOfflineMessage'][_0x65ca('0x46')]);_0x5887a0[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x2bd1b4[_0x65ca('0x48')]);_0x5887a0['filters']=_[_0x65ca('0x4a')](_0x5887a0[_0x65ca('0x42')],_0x5887a0[_0x65ca('0x48')]);_0x14c8e4[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x5887a0[_0x65ca('0x42')],qs['fields'](_0x2bd1b4['query'][_0x65ca('0x4b')]));_0x14c8e4['attributes']=_0x14c8e4[_0x65ca('0x4c')]['length']?_0x14c8e4[_0x65ca('0x4c')]:_0x5887a0[_0x65ca('0x42')];if(!_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x6c')]('nolimit')){_0x14c8e4['limit']=qs[_0x65ca('0x22')](_0x2bd1b4['query'][_0x65ca('0x22')]);_0x14c8e4[_0x65ca('0x21')]=qs[_0x65ca('0x21')](_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x21')]);}_0x14c8e4[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x14c8e4[_0x65ca('0x52')]=qs[_0x65ca('0x49')](_[_0x65ca('0x50')](_0x2bd1b4[_0x65ca('0x48')],_0x5887a0[_0x65ca('0x49')]));_0x14c8e4[_0x65ca('0x52')][_0x65ca('0x69')]=_0x33da7b['id'];if(_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x51')]){_0x14c8e4['where']=_[_0x65ca('0x53')](_0x14c8e4[_0x65ca('0x52')],{'$or':_['map'](_0x14c8e4[_0x65ca('0x4c')],function(_0x506328){var _0x301d5d={};_0x301d5d[_0x506328]={'$like':'%'+_0x2bd1b4['query']['filter']+'%'};return _0x301d5d;})});}_0x14c8e4=_[_0x65ca('0x53')]({},_0x14c8e4,_0x2bd1b4[_0x65ca('0x55')]);return db['ChatOfflineMessage'][_0x65ca('0x23')]({'where':_0x14c8e4[_0x65ca('0x52')]})[_0x65ca('0x14')](function(_0x5755db){_0x314dd3[_0x65ca('0x23')]=_0x5755db;if(_0x2bd1b4[_0x65ca('0x48')][_0x65ca('0x5d')]){_0x14c8e4[_0x65ca('0x57')]=[{'all':!![]}];}else{_0x14c8e4[_0x65ca('0x57')]=[{'model':db[_0x65ca('0x99')],'as':_0x65ca('0x111'),'required':![]},{'model':db[_0x65ca('0xdc')],'as':_0x65ca('0x112'),'required':![]}];}return db[_0x65ca('0xd0')][_0x65ca('0x58')](_0x14c8e4);})['then'](function(_0x3a2047){_0x314dd3['rows']=_0x3a2047;return _0x314dd3;});}})['then'](respondWithFilteredResult(_0x10468b,_0x14c8e4))[_0x65ca('0x1d')](handleError(_0x10468b,null));};exports[_0x65ca('0x113')]=function(_0x4399db,_0x53bdc5){return db[_0x65ca('0x56')]['find']({'where':{'id':_0x4399db[_0x65ca('0x5a')]['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x53bdc5,null))[_0x65ca('0x14')](function(_0x209d58){if(_0x209d58){return _0x209d58[_0x65ca('0x113')](_0x4399db['body']['ids'],_[_0x65ca('0xec')](_0x4399db[_0x65ca('0x60')],['ids','id'])||{})['spread'](function(_0x157569){for(var _0x3a3954=0x0;_0x3a3954<_0x4399db[_0x65ca('0x60')]['ids'][_0x65ca('0x4d')];_0x3a3954+=0x1){socket[_0x65ca('0x114')](_0x65ca('0x115'),{'UserId':Number(_0x4399db[_0x65ca('0x60')][_0x65ca('0x6e')][_0x3a3954]),'ChatWebsiteId':Number(_0x4399db['params']['id'])});}return _0x157569;});}})[_0x65ca('0x14')](respondWithResult(_0x53bdc5,null))['catch'](handleError(_0x53bdc5,null));};exports[_0x65ca('0x116')]=function(_0x5ecd25,_0x143293){return db['ChatWebsite'][_0x65ca('0x5e')]({'where':{'id':_0x5ecd25[_0x65ca('0x5a')]['id']}})['then'](handleEntityNotFound(_0x143293,null))[_0x65ca('0x14')](function(_0x157fa3){if(_0x157fa3){return _0x157fa3[_0x65ca('0x116')](_0x5ecd25[_0x65ca('0x48')][_0x65ca('0x6e')])[_0x65ca('0x14')](function(){if(_['isArray'](_0x5ecd25['query'][_0x65ca('0x6e')])){for(var _0x1d2180=0x0;_0x1d2180<_0x5ecd25[_0x65ca('0x48')]['ids'][_0x65ca('0x4d')];_0x1d2180+=0x1){socket['emit'](_0x65ca('0x117'),{'UserId':Number(_0x5ecd25[_0x65ca('0x48')]['ids'][_0x1d2180]),'ChatWebsiteId':Number(_0x5ecd25[_0x65ca('0x5a')]['id'])});}}else{socket[_0x65ca('0x114')](_0x65ca('0x117'),{'UserId':Number(_0x5ecd25[_0x65ca('0x48')][_0x65ca('0x6e')]),'ChatWebsiteId':Number(_0x5ecd25[_0x65ca('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x143293,null))[_0x65ca('0x1d')](handleError(_0x143293,null));};exports['getAgents']=function(_0x183aa3,_0x505356){var _0x3bc0c2={};var _0x55772e={};var _0x176bd6;var _0x3a807b;return db[_0x65ca('0x56')]['findOne']({'where':{'id':_0x183aa3['params']['id']}})[_0x65ca('0x14')](handleEntityNotFound(_0x505356,null))['then'](function(_0x187eea){if(_0x187eea){_0x176bd6=_0x187eea;_0x55772e[_0x65ca('0x42')]=_[_0x65ca('0x5c')](db['User'][_0x65ca('0x46')]);_0x55772e[_0x65ca('0x48')]=_[_0x65ca('0x5c')](_0x183aa3[_0x65ca('0x48')]);_0x55772e[_0x65ca('0x49')]=_[_0x65ca('0x4a')](_0x55772e['model'],_0x55772e[_0x65ca('0x48')]);_0x3bc0c2[_0x65ca('0x4c')]=_[_0x65ca('0x4a')](_0x55772e[_0x65ca('0x42')],qs['fields'](_0x183aa3['query'][_0x65ca('0x4b')]));_0x3bc0c2[_0x65ca('0x4c')]=_0x3bc0c2[_0x65ca('0x4c')][_0x65ca('0x4d')]?_0x3bc0c2[_0x65ca('0x4c')]:_0x55772e[_0x65ca('0x42')];_0x3bc0c2[_0x65ca('0x72')]=qs[_0x65ca('0x4f')](_0x183aa3[_0x65ca('0x48')][_0x65ca('0x4f')]);_0x3bc0c2[_0x65ca('0x52')]=qs['filters'](_[_0x65ca('0x50')](_0x183aa3[_0x65ca('0x48')],_0x55772e[_0x65ca('0x49')]));if(_0x183aa3['query'][_0x65ca('0x51')]){_0x3bc0c2[_0x65ca('0x52')]=_[_0x65ca('0x53')](_0x3bc0c2[_0x65ca('0x52')],{'$or':_[_0x65ca('0x32')](_0x3bc0c2[_0x65ca('0x4c')],function(_0x66c77b){var _0x331be7={};_0x331be7[_0x66c77b]={'$like':'%'+_0x183aa3['query'][_0x65ca('0x51')]+'%'};return _0x331be7;})});}_0x3bc0c2=_[_0x65ca('0x53')]({},_0x3bc0c2,_0x183aa3[_0x65ca('0x55')]);return _0x176bd6[_0x65ca('0x118')](_0x3bc0c2);}})[_0x65ca('0x14')](function(_0x39f851){if(_0x39f851){_0x3a807b=_0x39f851[_0x65ca('0x4d')];if(!_0x183aa3[_0x65ca('0x48')][_0x65ca('0x6c')](_0x65ca('0x4e'))){_0x3bc0c2[_0x65ca('0x22')]=qs['limit'](_0x183aa3[_0x65ca('0x48')][_0x65ca('0x22')]);_0x3bc0c2[_0x65ca('0x21')]=qs['offset'](_0x183aa3['query']['offset']);}return _0x176bd6[_0x65ca('0x118')](_0x3bc0c2);}})['then'](function(_0xc0d25){if(_0xc0d25){return _0xc0d25?{'count':_0x3a807b,'rows':_0xc0d25}:null;}})[_0x65ca('0x14')](respondWithResult(_0x505356,null))[_0x65ca('0x1d')](handleError(_0x505356,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 045281d..f5475eb 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 _0x2ce1=['save','update','remove','emit','hasOwnProperty','exports','setMaxListeners'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x2ce1,0x8b));var _0x12ce=function(_0x2416a5,_0x4210a1){_0x2416a5=_0x2416a5-0x0;var _0x529e49=_0x2ce1[_0x2416a5];return _0x529e49;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x12ce('0x0')](0x0);var events={'afterCreate':_0x12ce('0x1'),'afterUpdate':_0x12ce('0x2'),'afterDestroy':_0x12ce('0x3')};function emitEvent(_0x4918dc){return function(_0x37b568,_0x168e95,_0x47dbf8){ChatWebsiteEvents[_0x12ce('0x4')](_0x4918dc+':'+_0x37b568['id'],_0x37b568);ChatWebsiteEvents[_0x12ce('0x4')](_0x4918dc,_0x37b568);_0x47dbf8(null);};}for(var e in events){if(events[_0x12ce('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x12ce('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb7a8=['hook','exports','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0xb7a8,0xec));var _0x8b7a=function(_0x3c5752,_0x4df06b){_0x3c5752=_0x3c5752-0x0;var _0x1a98c7=_0xb7a8[_0x3c5752];return _0x1a98c7;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x8b7a('0x0'))['db'][_0x8b7a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b7a('0x2'),'afterUpdate':_0x8b7a('0x3'),'afterDestroy':_0x8b7a('0x4')};function emitEvent(_0x5b033a){return function(_0x3847b8,_0x2c7217,_0x1185b9){ChatWebsiteEvents[_0x8b7a('0x5')](_0x5b033a+':'+_0x3847b8['id'],_0x3847b8);ChatWebsiteEvents[_0x8b7a('0x5')](_0x5b033a,_0x3847b8);_0x1185b9(null);};}for(var e in events){if(events[_0x8b7a('0x6')](e)){var event=events[e];ChatWebsite[_0x8b7a('0x7')](e,emitEvent(event));}}module[_0x8b7a('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5d54f4c..cba2de3 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 _0x5274=['lodash','../../config/logger','request-promise','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x499a9a,_0x2cd718){var _0x17d768=function(_0x26664e){while(--_0x26664e){_0x499a9a['push'](_0x499a9a['shift']());}};_0x17d768(++_0x2cd718);}(_0x5274,0x90));var _0x4527=function(_0x5baed9,_0x409757){_0x5baed9=_0x5baed9-0x0;var _0x43aad3=_0x5274[_0x5baed9];return _0x43aad3;};'use strict';var _=require(_0x4527('0x0'));var util=require('util');var logger=require(_0x4527('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4527('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4527('0x3'));var config=require('../../config/environment');var attributes=require(_0x4527('0x4'));module[_0x4527('0x5')]=function(_0x3c6f0e,_0xa56ff9){return _0x3c6f0e[_0x4527('0x6')](_0x4527('0x7'),attributes,{'tableName':_0x4527('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c74=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_websites','lodash'];(function(_0x1377da,_0x116f21){var _0x4acefe=function(_0x3bb55e){while(--_0x3bb55e){_0x1377da['push'](_0x1377da['shift']());}};_0x4acefe(++_0x116f21);}(_0x9c74,0x167));var _0x49c7=function(_0x368563,_0x1720cb){_0x368563=_0x368563-0x0;var _0x50a723=_0x9c74[_0x368563];return _0x50a723;};'use strict';var _=require(_0x49c7('0x0'));var util=require(_0x49c7('0x1'));var logger=require(_0x49c7('0x2'))(_0x49c7('0x3'));var moment=require(_0x49c7('0x4'));var BPromise=require(_0x49c7('0x5'));var rp=require(_0x49c7('0x6'));var fs=require('fs');var path=require(_0x49c7('0x7'));var rimraf=require(_0x49c7('0x8'));var config=require(_0x49c7('0x9'));var attributes=require('./chatWebsite.attributes');module[_0x49c7('0xa')]=function(_0x490f2e,_0xed0bb0){return _0x490f2e['define']('ChatWebsite',attributes,{'tableName':_0x49c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 65d6807..40a54d8 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 _0xf3c7=['request','then','info','ChatWebsite,\x20%s,\x20%s','debug','error','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0xf3c7,0x17d));var _0x7f3c=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0xf3c7[_0x40015a];return _0x42f8a4;};'use strict';var _=require(_0x7f3c('0x0'));var util=require(_0x7f3c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f3c('0x2'));var fs=require('fs');var Redis=require(_0x7f3c('0x3'));var db=require(_0x7f3c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f3c('0x5'))(_0x7f3c('0x6'));var config=require(_0x7f3c('0x7'));var jayson=require(_0x7f3c('0x8'));var client=jayson['client'][_0x7f3c('0x9')]({'port':0x232a});config[_0x7f3c('0xa')]=_[_0x7f3c('0xb')](config[_0x7f3c('0xa')],{'host':_0x7f3c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f3c('0xa')]));require(_0x7f3c('0xd'))[_0x7f3c('0xe')](socket);function respondWithRpcPromise(_0x3f9f91,_0x589a1c,_0xa4c533){return new BPromise(function(_0x405545,_0x77929f){return client[_0x7f3c('0xf')](_0x3f9f91,_0xa4c533)[_0x7f3c('0x10')](function(_0x189e2e){logger[_0x7f3c('0x11')](_0x7f3c('0x12'),_0x589a1c,'request\x20sent');logger[_0x7f3c('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x589a1c,'request\x20sent',JSON['stringify'](_0x189e2e));if(_0x189e2e[_0x7f3c('0x14')]){if(_0x189e2e[_0x7f3c('0x14')]['code']===0x1f4){logger['error'](_0x7f3c('0x12'),_0x589a1c,_0x189e2e['error'][_0x7f3c('0x15')]);return _0x77929f(_0x189e2e['error'][_0x7f3c('0x15')]);}logger[_0x7f3c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x589a1c,_0x189e2e[_0x7f3c('0x14')][_0x7f3c('0x15')]);return _0x405545(_0x189e2e[_0x7f3c('0x14')][_0x7f3c('0x15')]);}else{logger['info'](_0x7f3c('0x12'),_0x589a1c,'request\x20sent');_0x405545(_0x189e2e['result'][_0x7f3c('0x15')]);}})['catch'](function(_0x11cb16){logger['error'](_0x7f3c('0x12'),_0x589a1c,_0x11cb16);_0x77929f(_0x11cb16);});});} \ No newline at end of file +var _0x1e1f=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0xfbca3,_0xfba1fd){var _0x2c3fa1=function(_0x47d5bd){while(--_0x47d5bd){_0xfbca3['push'](_0xfbca3['shift']());}};_0x2c3fa1(++_0xfba1fd);}(_0x1e1f,0x1c4));var _0xf1e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e1f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf1e1('0x0'));var util=require('util');var moment=require(_0xf1e1('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1e1('0x2'));var fs=require('fs');var Redis=require(_0xf1e1('0x3'));var db=require(_0xf1e1('0x4'))['db'];var utils=require(_0xf1e1('0x5'));var logger=require(_0xf1e1('0x6'))(_0xf1e1('0x7'));var config=require(_0xf1e1('0x8'));var jayson=require(_0xf1e1('0x9'));var client=jayson['client'][_0xf1e1('0xa')]({'port':0x232a});config[_0xf1e1('0xb')]=_[_0xf1e1('0xc')](config[_0xf1e1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1e1('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xf1e1('0xe')](socket);function respondWithRpcPromise(_0x1a54e6,_0x2cdccf,_0x2f7c3d){return new BPromise(function(_0xa30826,_0x208cd2){return client['request'](_0x1a54e6,_0x2f7c3d)[_0xf1e1('0xf')](function(_0x5544be){logger[_0xf1e1('0x10')](_0xf1e1('0x11'),_0x2cdccf,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2cdccf,_0xf1e1('0x12'),JSON[_0xf1e1('0x13')](_0x5544be));if(_0x5544be['error']){if(_0x5544be['error'][_0xf1e1('0x14')]===0x1f4){logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);return _0x208cd2(_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);}logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x5544be[_0xf1e1('0x15')]['message']);return _0xa30826(_0x5544be[_0xf1e1('0x15')][_0xf1e1('0x16')]);}else{logger[_0xf1e1('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x2cdccf,_0xf1e1('0x12'));_0xa30826(_0x5544be[_0xf1e1('0x17')][_0xf1e1('0x16')]);}})[_0xf1e1('0x18')](function(_0x46bdad){logger[_0xf1e1('0x15')](_0xf1e1('0x11'),_0x2cdccf,_0x46bdad);_0x208cd2(_0x46bdad);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 40fc773..0fd9d03 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 _0xe34d=['update','emit','register','length','./chatWebsite.events','save','remove'];(function(_0xd97b73,_0xce94b1){var _0xefe357=function(_0x48bc4b){while(--_0x48bc4b){_0xd97b73['push'](_0xd97b73['shift']());}};_0xefe357(++_0xce94b1);}(_0xe34d,0xac));var _0xde34=function(_0x5e38cf,_0x469109){_0x5e38cf=_0x5e38cf-0x0;var _0x259d98=_0xe34d[_0x5e38cf];return _0x259d98;};'use strict';var ChatWebsiteEvents=require(_0xde34('0x0'));var events=[_0xde34('0x1'),_0xde34('0x2'),_0xde34('0x3')];function createListener(_0x4ea0b4,_0x910bbc){return function(_0x1fff9f){_0x910bbc[_0xde34('0x4')](_0x4ea0b4,_0x1fff9f);};}function removeListener(_0x28d7e8,_0x729013){return function(){ChatWebsiteEvents['removeListener'](_0x28d7e8,_0x729013);};}exports[_0xde34('0x5')]=function(_0x58002a){for(var _0x421a6a=0x0,_0x420d0c=events[_0xde34('0x6')];_0x421a6a<_0x420d0c;_0x421a6a++){var _0x57f45d=events[_0x421a6a];var _0x302686=createListener('chatWebsite:'+_0x57f45d,_0x58002a);ChatWebsiteEvents['on'](_0x57f45d,_0x302686);}}; \ No newline at end of file +var _0x2e0f=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0xc35608,_0x6f0a34){var _0x4be993=function(_0x424f6c){while(--_0x424f6c){_0xc35608['push'](_0xc35608['shift']());}};_0x4be993(++_0x6f0a34);}(_0x2e0f,0x17c));var _0xf2e0=function(_0x4b32d1,_0xd8ac22){_0x4b32d1=_0x4b32d1-0x0;var _0xcd942d=_0x2e0f[_0x4b32d1];return _0xcd942d;};'use strict';var ChatWebsiteEvents=require(_0xf2e0('0x0'));var events=[_0xf2e0('0x1'),_0xf2e0('0x2'),_0xf2e0('0x3')];function createListener(_0x41ea3b,_0x41af33){return function(_0x4df069){_0x41af33['emit'](_0x41ea3b,_0x4df069);};}function removeListener(_0x25eeeb,_0x493d2c){return function(){ChatWebsiteEvents[_0xf2e0('0x4')](_0x25eeeb,_0x493d2c);};}exports[_0xf2e0('0x5')]=function(_0x24a61b){for(var _0x495fa3=0x0,_0xf40ad9=events[_0xf2e0('0x6')];_0x495fa3<_0xf40ad9;_0x495fa3++){var _0xaa48fc=events[_0x495fa3];var _0x949231=createListener(_0xf2e0('0x7')+_0xaa48fc,_0x24a61b);ChatWebsiteEvents['on'](_0xaa48fc,_0x949231);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 318d569..c57da56 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 _0x492d=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','file','server/files/images/avatars/','originalname','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','put','/:id','update','delete','destroy','removeAnswers'];(function(_0x40c2e,_0x23f20e){var _0x17e891=function(_0x1b39b5){while(--_0x1b39b5){_0x40c2e['push'](_0x40c2e['shift']());}};_0x17e891(++_0x23f20e);}(_0x492d,0x16e));var _0xd492=function(_0x34a863,_0x43936f){_0x34a863=_0x34a863-0x0;var _0x134dd7=_0x492d[_0x34a863];return _0x134dd7;};'use strict';var multer=require('multer');var util=require(_0xd492('0x0'));var path=require(_0xd492('0x1'));var timeout=require(_0xd492('0x2'));var express=require(_0xd492('0x3'));var router=express[_0xd492('0x4')]();var fs_extra=require(_0xd492('0x5'));var auth=require(_0xd492('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd492('0x7'));var controller=require(_0xd492('0x8'));router[_0xd492('0x9')]('/',auth['isAuthenticated'](),controller[_0xd492('0xa')]);router[_0xd492('0x9')](_0xd492('0xb'),auth[_0xd492('0xc')](),controller[_0xd492('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd492('0x9')](_0xd492('0xe'),auth['isAuthenticated'](),controller[_0xd492('0xf')]);router[_0xd492('0x9')](_0xd492('0x10'),auth['isAuthenticated'](),controller[_0xd492('0x11')]);router[_0xd492('0x9')](_0xd492('0x12'),controller[_0xd492('0x13')]);router[_0xd492('0x9')]('/:id/avatar',controller[_0xd492('0x14')]);router['get'](_0xd492('0x15'),controller[_0xd492('0x16')]);router['get'](_0xd492('0x17'),controller[_0xd492('0x18')]);router[_0xd492('0x9')](_0xd492('0x19'),auth[_0xd492('0xc')](),controller[_0xd492('0x1a')]);router[_0xd492('0x9')](_0xd492('0x1b'),controller[_0xd492('0x1c')]);router[_0xd492('0x9')](_0xd492('0x1d'),auth[_0xd492('0xc')](),controller[_0xd492('0x1e')]);router[_0xd492('0x9')](_0xd492('0x1f'),auth[_0xd492('0xc')](),controller[_0xd492('0x20')]);router[_0xd492('0x9')](_0xd492('0x21'),controller[_0xd492('0x22')]);router[_0xd492('0x9')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xd492('0x23')]);router[_0xd492('0x9')](_0xd492('0x24'),auth[_0xd492('0xc')](),controller[_0xd492('0x25')]);router[_0xd492('0x26')]('/',auth[_0xd492('0xc')](),controller['create']);router[_0xd492('0x26')]('/:id/dispositions',auth[_0xd492('0xc')](),controller['addDisposition']);router[_0xd492('0x26')](_0xd492('0x10'),auth[_0xd492('0xc')](),controller[_0xd492('0x27')]);var upload=multer({'storage':multer[_0xd492('0x28')]({'destination':function(_0x10737a,_0x143a7a,_0x1629df){_0x1629df(null,path[_0xd492('0x29')](config[_0xd492('0x2a')],_0xd492('0x2b')));},'filename':function(_0x421a6d,_0x491567,_0x49da24){_0x49da24(null,util[_0xd492('0x2c')](_0xd492('0x2d'),Date[_0xd492('0x2e')](),_0x491567['originalname']));}})});router[_0xd492('0x26')](_0xd492('0x12'),upload['single'](_0xd492('0x2f')),controller['addLogo']);var upload=multer({'storage':multer[_0xd492('0x28')]({'destination':function(_0x4b3692,_0x2e1862,_0xfd324c){_0xfd324c(null,path[_0xd492('0x29')](config[_0xd492('0x2a')],_0xd492('0x30')));},'filename':function(_0x51fe74,_0x447b12,_0x3e7aa0){_0x3e7aa0(null,util[_0xd492('0x2c')](_0xd492('0x2d'),Date[_0xd492('0x2e')](),_0x447b12[_0xd492('0x31')]));}})});router[_0xd492('0x26')]('/:id/avatar',upload['single'](_0xd492('0x2f')),controller[_0xd492('0x32')]);var upload=multer({'storage':multer[_0xd492('0x28')]({'destination':function(_0x3d4b8f,_0x2ab8ef,_0x20c9db){_0x20c9db(null,path[_0xd492('0x29')](config[_0xd492('0x2a')],_0xd492('0x30')));},'filename':function(_0x2d2bbd,_0x4c8f7f,_0x12c13f){_0x12c13f(null,util[_0xd492('0x2c')](_0xd492('0x2d'),Date[_0xd492('0x2e')](),_0x4c8f7f[_0xd492('0x31')]));}})});router[_0xd492('0x26')](_0xd492('0x15'),upload[_0xd492('0x33')](_0xd492('0x2f')),controller[_0xd492('0x34')]);var upload=multer({'storage':multer[_0xd492('0x28')]({'destination':function(_0x334150,_0x4ac3fb,_0x4729bc){_0x4729bc(null,path[_0xd492('0x29')](config['root'],_0xd492('0x30')));},'filename':function(_0x4316b6,_0x3465c1,_0x45f78e){_0x45f78e(null,util[_0xd492('0x2c')](_0xd492('0x2d'),Date['now'](),_0x3465c1[_0xd492('0x31')]));}})});router[_0xd492('0x26')](_0xd492('0x17'),upload[_0xd492('0x33')](_0xd492('0x2f')),controller[_0xd492('0x35')]);router[_0xd492('0x26')](_0xd492('0x36'),controller[_0xd492('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x498cba,_0x12cdcb,_0x55212f){const _0x444ab2=path['join'](config[_0xd492('0x2a')],'server/files',_0xd492('0x38'),_0xd492('0x39'));fs_extra[_0xd492('0x3a')](_0x444ab2,function(){_0x55212f(null,_0x444ab2);});},'filename':function(_0x76e9a9,_0x48a238,_0xb8b593){const _0x4d0994=_0x48a238[_0xd492('0x31')][_0xd492('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x552ed5=path[_0xd492('0x3c')](_0x4d0994);const _0x38f888=Date[_0xd492('0x2e')]()+'-'+_0x4d0994['replace'](_0x552ed5,'')+_0x552ed5;_0xb8b593(null,_0x38f888);}})});router[_0xd492('0x26')](_0xd492('0x3d'),offlineUploadMulter[_0xd492('0x3e')](),controller['offline']);router[_0xd492('0x26')]('/:id/interactions',auth[_0xd492('0xc')](),controller[_0xd492('0x3f')]);router[_0xd492('0x26')](_0xd492('0x1d'),auth[_0xd492('0xc')](),controller[_0xd492('0x40')]);router[_0xd492('0x26')](_0xd492('0x1f'),auth[_0xd492('0xc')](),controller[_0xd492('0x41')]);router[_0xd492('0x26')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xd492('0x42')](_0xd492('0x43'),auth['isAuthenticated'](),controller[_0xd492('0x44')]);router[_0xd492('0x45')]('/:id',auth[_0xd492('0xc')](),controller[_0xd492('0x46')]);router[_0xd492('0x45')](_0xd492('0xe'),auth[_0xd492('0xc')](),controller['removeDispositions']);router['delete'](_0xd492('0x10'),auth[_0xd492('0xc')](),controller[_0xd492('0x47')]);router[_0xd492('0x45')](_0xd492('0x24'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd492('0x48')]=router; \ No newline at end of file +var _0x008f=['/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','file','server/files/images/avatars/','single','addAvatar','addCustomerAvatar','%s-%s','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x008f,0x10c));var _0xf008=function(_0x3b04ce,_0x1030f8){_0x3b04ce=_0x3b04ce-0x0;var _0x4fe066=_0x008f[_0x3b04ce];return _0x4fe066;};'use strict';var multer=require(_0xf008('0x0'));var util=require(_0xf008('0x1'));var path=require(_0xf008('0x2'));var timeout=require(_0xf008('0x3'));var express=require('express');var router=express[_0xf008('0x4')]();var fs_extra=require(_0xf008('0x5'));var auth=require(_0xf008('0x6'));var interaction=require(_0xf008('0x7'));var config=require(_0xf008('0x8'));var controller=require(_0xf008('0x9'));router['get']('/',auth[_0xf008('0xa')](),controller[_0xf008('0xb')]);router[_0xf008('0xc')](_0xf008('0xd'),auth['isAuthenticated'](),controller[_0xf008('0xe')]);router[_0xf008('0xc')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller['show']);router[_0xf008('0xc')](_0xf008('0x10'),auth[_0xf008('0xa')](),controller[_0xf008('0x11')]);router[_0xf008('0xc')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller['getAnswers']);router[_0xf008('0xc')](_0xf008('0x13'),controller['getLogo']);router['get'](_0xf008('0x14'),controller[_0xf008('0x15')]);router['get'](_0xf008('0x16'),controller[_0xf008('0x17')]);router['get'](_0xf008('0x18'),controller[_0xf008('0x19')]);router[_0xf008('0xc')]('/:id/interactions',auth[_0xf008('0xa')](),controller[_0xf008('0x1a')]);router[_0xf008('0xc')](_0xf008('0x1b'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xf008('0xa')](),controller[_0xf008('0x1c')]);router[_0xf008('0xc')](_0xf008('0x1d'),auth[_0xf008('0xa')](),controller['getProactiveActions']);router[_0xf008('0xc')]('/:id/fields',controller[_0xf008('0x1e')]);router[_0xf008('0xc')](_0xf008('0x1f'),auth[_0xf008('0xa')](),controller[_0xf008('0x20')]);router[_0xf008('0xc')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x22')]);router[_0xf008('0x23')]('/',auth[_0xf008('0xa')](),controller[_0xf008('0x24')]);router[_0xf008('0x23')](_0xf008('0x10'),auth[_0xf008('0xa')](),controller['addDisposition']);router[_0xf008('0x23')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller[_0xf008('0x25')]);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x319f05,_0x42033a,_0xb03eaf){_0xb03eaf(null,path[_0xf008('0x27')](config[_0xf008('0x28')],_0xf008('0x29')));},'filename':function(_0x19919b,_0x316b01,_0x439bd0){_0x439bd0(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x316b01[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x13'),upload['single'](_0xf008('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x60abc4,_0x43c193,_0x1bcfee){_0x1bcfee(null,path[_0xf008('0x27')](config['root'],_0xf008('0x2e')));},'filename':function(_0x591848,_0x11d849,_0x4cf232){_0x4cf232(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x11d849[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x14'),upload[_0xf008('0x2f')](_0xf008('0x2d')),controller[_0xf008('0x30')]);var upload=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x463d69,_0x2ad02f,_0xf3f325){_0xf3f325(null,path[_0xf008('0x27')](config[_0xf008('0x28')],_0xf008('0x2e')));},'filename':function(_0x29efc4,_0x115806,_0xb007f3){_0xb007f3(null,util[_0xf008('0x2a')]('%s-%s',Date[_0xf008('0x2b')](),_0x115806[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x16'),upload[_0xf008('0x2f')](_0xf008('0x2d')),controller[_0xf008('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd509d5,_0x4394ea,_0x3f5884){_0x3f5884(null,path['join'](config[_0xf008('0x28')],_0xf008('0x2e')));},'filename':function(_0x52bbdd,_0x1ac458,_0x243d9d){_0x243d9d(null,util['format'](_0xf008('0x32'),Date['now'](),_0x1ac458[_0xf008('0x2c')]));}})});router[_0xf008('0x23')](_0xf008('0x18'),upload['single']('file'),controller[_0xf008('0x33')]);router[_0xf008('0x23')](_0xf008('0x34'),controller[_0xf008('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xf008('0x26')]({'destination':function(_0x340f9a,_0x10738a,_0x18be09){const _0x5e16ea=path[_0xf008('0x27')](config['root'],_0xf008('0x36'),_0xf008('0x37'),_0xf008('0x38'));fs_extra[_0xf008('0x39')](_0x5e16ea,function(){_0x18be09(null,_0x5e16ea);});},'filename':function(_0x4848ca,_0x531720,_0x7e7443){const _0x4f7e14=_0x531720[_0xf008('0x2c')][_0xf008('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1410ee=path['extname'](_0x4f7e14);const _0x49dc2b=Date['now']()+'-'+_0x4f7e14[_0xf008('0x3a')](_0x1410ee,'')+_0x1410ee;_0x7e7443(null,_0x49dc2b);}})});router[_0xf008('0x23')](_0xf008('0x3b'),offlineUploadMulter['any'](),controller['offline']);router['post']('/:id/interactions',auth[_0xf008('0xa')](),controller[_0xf008('0x3c')]);router['post'](_0xf008('0x3d'),auth['isAuthenticated'](),controller[_0xf008('0x3e')]);router[_0xf008('0x23')](_0xf008('0x1d'),auth[_0xf008('0xa')](),controller[_0xf008('0x3f')]);router[_0xf008('0x23')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x40')]);router[_0xf008('0x41')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller[_0xf008('0x42')]);router[_0xf008('0x43')](_0xf008('0xf'),auth[_0xf008('0xa')](),controller[_0xf008('0x44')]);router[_0xf008('0x43')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf008('0x43')](_0xf008('0x12'),auth[_0xf008('0xa')](),controller[_0xf008('0x45')]);router[_0xf008('0x43')](_0xf008('0x21'),auth[_0xf008('0xa')](),controller[_0xf008('0x46')]);module[_0xf008('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index bcaacca..75bfe4b 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3247=['expressEndpoint','/client-logs','isAuthenticated','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x60004,_0x1a53fd){var _0x1b4b52=function(_0x59cb0d){while(--_0x59cb0d){_0x60004['push'](_0x60004['shift']());}};_0x1b4b52(++_0x1a53fd);}(_0x3247,0xc9));var _0x7324=function(_0xb8920f,_0x4a50ea){_0xb8920f=_0xb8920f-0x0;var _0xdc9bfc=_0x3247[_0xb8920f];return _0xdc9bfc;};var beaverLogger=require(_0x7324('0x0'));var express=require('express');var auth=require(_0x7324('0x1'));var config=require(_0x7324('0x2'));var router=express[_0x7324('0x3')]();var isProduction=config[_0x7324('0x4')]===_0x7324('0x5')||![];function clientSideLogs(_0x38cd9e,_0x2c8b6c,_0x3a96fd){var _0x4fb19a=_0x38cd9e['app']['get'](_0x7324('0x6'));if(!_0x4fb19a){throw new Error(_0x7324('0x7'));}return beaverLogger[_0x7324('0x8')]({'uri':_0x7324('0x9'),'logger':_0x4fb19a,'enableCors':!isProduction})(_0x38cd9e,_0x2c8b6c,_0x3a96fd);}router['use'](auth[_0x7324('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x6d8a=['exports','beaver-logger/server','../components/auth/service','env','production','app','get','client-side-logger','expressEndpoint','use'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x6d8a,0x1a5));var _0xa6d8=function(_0x1196bd,_0xba4aea){_0x1196bd=_0x1196bd-0x0;var _0x26014f=_0x6d8a[_0x1196bd];return _0x26014f;};var beaverLogger=require(_0xa6d8('0x0'));var express=require('express');var auth=require(_0xa6d8('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0xa6d8('0x2')]===_0xa6d8('0x3')||![];function clientSideLogs(_0x53f40,_0x202397,_0x5f19be){var _0x545d72=_0x53f40[_0xa6d8('0x4')][_0xa6d8('0x5')](_0xa6d8('0x6'));if(!_0x545d72){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xa6d8('0x7')]({'uri':'/client-logs','logger':_0x545d72,'enableCors':!isProduction})(_0x53f40,_0x202397,_0x5f19be);}router[_0xa6d8('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0xa6d8('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c05869d..2f54b67 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 _0x2a18=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','ENUM','Google','MicrosoftAzure','Outlook365'];(function(_0x14166a,_0x2ce7cb){var _0x90ce7b=function(_0x5de890){while(--_0x5de890){_0x14166a['push'](_0x14166a['shift']());}};_0x90ce7b(++_0x2ce7cb);}(_0x2a18,0x1b6));var _0x82a1=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x2a18[_0x1fc18b];return _0x16a351;};'use strict';var Sequelize=require(_0x82a1('0x0'));module[_0x82a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x82a1('0x2')]('AmazonAWS',_0x82a1('0x3'),_0x82a1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x82a1('0x2')](_0x82a1('0x5'),_0x82a1('0x6'))},'data1':{'type':Sequelize[_0x82a1('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x82a1('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x82a1('0x8')},'data4':{'type':Sequelize[_0x82a1('0x7')],'comment':_0x82a1('0x9')},'data5':{'type':Sequelize[_0x82a1('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x82a1('0xa')],'comment':_0x82a1('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x51de=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x1feb3b,_0x54f735){var _0x28b0a2=function(_0xdfe1d3){while(--_0xdfe1d3){_0x1feb3b['push'](_0x1feb3b['shift']());}};_0x28b0a2(++_0x54f735);}(_0x51de,0x1d5));var _0xe51d=function(_0x66840d,_0x4106af){_0x66840d=_0x66840d-0x0;var _0x5ef852=_0x51de[_0x66840d];return _0x5ef852;};'use strict';var Sequelize=require(_0xe51d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe51d('0x1')](_0xe51d('0x2'),'Google',_0xe51d('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe51d('0x1')]('Outlook365',_0xe51d('0x4'))},'data1':{'type':Sequelize[_0xe51d('0x5')],'comment':_0xe51d('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0xe51d('0x7')},'data3':{'type':Sequelize[_0xe51d('0x5')],'comment':_0xe51d('0x8')},'data4':{'type':Sequelize[_0xe51d('0x5')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xe51d('0x9')],'comment':_0xe51d('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0xe51d('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xe51d('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 6455f02..3f0b9c4 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 _0xda28=['refresh_token','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','stack','name','send','slice','map','CloudProvider','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','options','includeAll','rows','MicrosoftAzure','decryptString','data3','show','keys','rawAttributes','include','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','service','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','catch','params','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','parse','from','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6'];(function(_0x32651b,_0x5553ec){var _0x31080f=function(_0x3aaec8){while(--_0x3aaec8){_0x32651b['push'](_0x32651b['shift']());}};_0x31080f(++_0x5553ec);}(_0xda28,0x112));var _0x8da2=function(_0x383ac0,_0x386219){_0x383ac0=_0x383ac0-0x0;var _0xfb8d41=_0xda28[_0x383ac0];return _0xfb8d41;};'use strict';var _=require(_0x8da2('0x0'));var Redis=require(_0x8da2('0x1'));var qs=require(_0x8da2('0x2'));var encryptor=require(_0x8da2('0x3'));var config=require(_0x8da2('0x4'));var logger=require(_0x8da2('0x5'))(_0x8da2('0x6'));var db=require(_0x8da2('0x7'))['db'];var oauth=require(_0x8da2('0x8'));config[_0x8da2('0x9')]=_[_0x8da2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8da2('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x12567d,_0x4f5437){_0x4f5437=_0x4f5437||0xcc;return function(_0x2e3d4f){if(_0x2e3d4f){return _0x12567d[_0x8da2('0xb')](_0x4f5437);}return _0x12567d[_0x8da2('0xc')](_0x4f5437)['end']();};}function respondWithResult(_0x122499,_0x4c8413){_0x4c8413=_0x4c8413||0xc8;return function(_0x4a1802){if(_0x4a1802){return _0x122499[_0x8da2('0xc')](_0x4c8413)[_0x8da2('0xd')](_0x4a1802);}};}function respondWithFilteredResult(_0x3c4c6f,_0x15689c){return function(_0xc51205){if(_0xc51205){var _0x3c633d=typeof _0x15689c[_0x8da2('0xe')]==='undefined'&&typeof _0x15689c[_0x8da2('0xf')]===_0x8da2('0x10');var _0x23e90f=_0xc51205[_0x8da2('0x11')];var _0x98f422=_0x3c633d?0x0:_0x15689c[_0x8da2('0xe')];var _0x39d547=_0x3c633d?_0xc51205['count']:_0x15689c[_0x8da2('0xe')]+_0x15689c['limit'];var _0x2a1914;if(_0x39d547>=_0x23e90f){_0x39d547=_0x23e90f;_0x2a1914=0xc8;}else{_0x2a1914=0xce;}_0x3c4c6f['status'](_0x2a1914);return _0x3c4c6f[_0x8da2('0x12')](_0x8da2('0x13'),_0x98f422+'-'+_0x39d547+'/'+_0x23e90f)[_0x8da2('0xd')](_0xc51205);}return null;};}function saveUpdates(_0x19df9a){return function(_0x2cc570){if(_0x2cc570){return _0x2cc570['update'](_0x19df9a)[_0x8da2('0x14')](function(_0x3a3d64){return _0x3a3d64;});}return null;};}function removeEntity(_0x41b9fa){return function(_0x33c255){if(_0x33c255){return _0x33c255[_0x8da2('0x15')]()['then'](function(){_0x41b9fa[_0x8da2('0xc')](0xcc)[_0x8da2('0x16')]();});}};}function handleEntityNotFound(_0x37093c){return function(_0x2c89e0){if(!_0x2c89e0){_0x37093c[_0x8da2('0xb')](0x194);}return _0x2c89e0;};}function handleError(_0x22af74,_0x526a07){_0x526a07=_0x526a07||0x1f4;return function(_0x2b0096){logger[_0x8da2('0x17')](_0x2b0096[_0x8da2('0x18')]);if(_0x2b0096[_0x8da2('0x19')]){delete _0x2b0096[_0x8da2('0x19')];}_0x22af74[_0x8da2('0xc')](_0x526a07)[_0x8da2('0x1a')](_0x2b0096);};}function maskClientSecret(_0x301ca1){return _['padEnd'](_0x301ca1[_0x8da2('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x506101,_0x4d5823){var _0x1bcbbe={},_0x1e37d3={},_0x450a75={'count':0x0,'rows':[]};var _0xc03747=_[_0x8da2('0x1c')](db[_0x8da2('0x1d')]['rawAttributes'],function(_0x43342f){return{'name':_0x43342f[_0x8da2('0x1e')],'type':_0x43342f['type'][_0x8da2('0x1f')]};});_0x1e37d3[_0x8da2('0x20')]=_[_0x8da2('0x1c')](_0xc03747,'name');_0x1e37d3[_0x8da2('0x21')]=_['keys'](_0x506101[_0x8da2('0x21')]);_0x1e37d3[_0x8da2('0x22')]=_[_0x8da2('0x23')](_0x1e37d3[_0x8da2('0x20')],_0x1e37d3[_0x8da2('0x21')]);_0x1bcbbe[_0x8da2('0x24')]=_['intersection'](_0x1e37d3[_0x8da2('0x20')],qs[_0x8da2('0x25')](_0x506101[_0x8da2('0x21')][_0x8da2('0x25')]));_0x1bcbbe['attributes']=_0x1bcbbe[_0x8da2('0x24')][_0x8da2('0x26')]?_0x1bcbbe[_0x8da2('0x24')]:_0x1e37d3[_0x8da2('0x20')];if(!_0x506101[_0x8da2('0x21')][_0x8da2('0x27')]('nolimit')){_0x1bcbbe[_0x8da2('0xf')]=qs[_0x8da2('0xf')](_0x506101[_0x8da2('0x21')]['limit']);_0x1bcbbe[_0x8da2('0xe')]=qs[_0x8da2('0xe')](_0x506101[_0x8da2('0x21')][_0x8da2('0xe')]);}_0x1bcbbe[_0x8da2('0x28')]=qs[_0x8da2('0x29')](_0x506101[_0x8da2('0x21')][_0x8da2('0x29')]);_0x1bcbbe['where']=qs[_0x8da2('0x22')](_['pick'](_0x506101['query'],_0x1e37d3[_0x8da2('0x22')]),_0xc03747);if(_0x506101[_0x8da2('0x21')]['filter']){_0x1bcbbe[_0x8da2('0x2a')]=_[_0x8da2('0x2b')](_0x1bcbbe[_0x8da2('0x2a')],{'$or':_[_0x8da2('0x1c')](_0xc03747,function(_0x4107bd){if(_0x4107bd[_0x8da2('0x2c')]!==_0x8da2('0x2d')){var _0x40593d={};_0x40593d[_0x4107bd['name']]={'$like':'%'+_0x506101['query']['filter']+'%'};return _0x40593d;}})});}_0x1bcbbe=_[_0x8da2('0x2b')]({},_0x1bcbbe,_0x506101[_0x8da2('0x2e')]);var _0x183230={'where':_0x1bcbbe['where']};return db[_0x8da2('0x1d')][_0x8da2('0x11')](_0x183230)['then'](function(_0x624462){_0x450a75[_0x8da2('0x11')]=_0x624462;if(_0x506101[_0x8da2('0x21')][_0x8da2('0x2f')]){_0x1bcbbe['include']=[{'all':!![]}];}return db[_0x8da2('0x1d')]['findAll'](_0x1bcbbe);})[_0x8da2('0x14')](function(_0xf5a1c5){_0x450a75[_0x8da2('0x30')]=_[_0x8da2('0x1c')](_0xf5a1c5,function(_0x5be8bb){if(_0x5be8bb['service']===_0x8da2('0x31')){var _0x4d8ab9=encryptor[_0x8da2('0x32')](_0x5be8bb[_0x8da2('0x33')]);_0x5be8bb[_0x8da2('0x33')]=maskClientSecret(_0x4d8ab9);}return _0x5be8bb;});return _0x450a75;})[_0x8da2('0x14')](respondWithFilteredResult(_0x4d5823,_0x1bcbbe))['catch'](handleError(_0x4d5823,null));};exports[_0x8da2('0x34')]=function(_0x48125b,_0xfd0b0d){var _0x5ab49e={'raw':!![],'where':{'id':_0x48125b['params']['id']}},_0x50b5af={};_0x50b5af[_0x8da2('0x20')]=_[_0x8da2('0x35')](db[_0x8da2('0x1d')][_0x8da2('0x36')]);_0x50b5af[_0x8da2('0x21')]=_[_0x8da2('0x35')](_0x48125b[_0x8da2('0x21')]);_0x50b5af['filters']=_[_0x8da2('0x23')](_0x50b5af['model'],_0x50b5af[_0x8da2('0x21')]);_0x5ab49e['attributes']=_[_0x8da2('0x23')](_0x50b5af[_0x8da2('0x20')],qs['fields'](_0x48125b[_0x8da2('0x21')][_0x8da2('0x25')]));_0x5ab49e['attributes']=_0x5ab49e[_0x8da2('0x24')]['length']?_0x5ab49e[_0x8da2('0x24')]:_0x50b5af['model'];if(_0x48125b['query'][_0x8da2('0x2f')]){_0x5ab49e[_0x8da2('0x37')]=[{'all':!![]}];}_0x5ab49e=_['merge']({},_0x5ab49e,_0x48125b[_0x8da2('0x2e')]);return db[_0x8da2('0x1d')][_0x8da2('0x38')](_0x5ab49e)['then'](handleEntityNotFound(_0xfd0b0d,null))[_0x8da2('0x14')](function(_0xf8289a){if(_0xf8289a['service']===_0x8da2('0x31')){var _0x33bfd3=encryptor[_0x8da2('0x32')](_0xf8289a[_0x8da2('0x33')]);_0xf8289a['data3']=maskClientSecret(_0x33bfd3);}return _0xf8289a;})['then'](respondWithResult(_0xfd0b0d,null))['catch'](handleError(_0xfd0b0d,null));};exports[_0x8da2('0x39')]=function(_0x1add81,_0x5af61e){if(!_0x1add81[_0x8da2('0x3a')][_0x8da2('0x19')])throw new Error(_0x8da2('0x3b'));if(!_0x1add81[_0x8da2('0x3a')]['service'])throw new Error(_0x8da2('0x3c'));var _0x15745e=db[_0x8da2('0x1d')][_0x8da2('0x36')][_0x8da2('0x3d')][_0x8da2('0x3e')];if(!_0x15745e[_0x8da2('0x3f')](_0x1add81[_0x8da2('0x3a')][_0x8da2('0x3d')]))throw new Error(_0x8da2('0x40')+_0x15745e[_0x8da2('0x41')](',\x20'));if(_0x1add81[_0x8da2('0x3a')]['service']===_0x8da2('0x31')&&_0x1add81[_0x8da2('0x3a')][_0x8da2('0x33')]){_0x1add81['body'][_0x8da2('0x33')]=encryptor[_0x8da2('0x42')](_0x1add81[_0x8da2('0x3a')][_0x8da2('0x33')]);}return db[_0x8da2('0x1d')][_0x8da2('0x39')](_0x1add81['body'],{})['then'](respondWithResult(_0x5af61e,0xc9))['catch'](handleError(_0x5af61e,null));};exports[_0x8da2('0x43')]=function(_0x5d10dc,_0x18c2a4){if(_0x5d10dc[_0x8da2('0x3a')]['id']){delete _0x5d10dc[_0x8da2('0x3a')]['id'];}return db[_0x8da2('0x1d')]['find']({'where':{'id':_0x5d10dc['params']['id']}})['then'](handleEntityNotFound(_0x18c2a4,null))['then'](function(_0x2a6aba){if(_0x2a6aba[_0x8da2('0x3d')]===_0x8da2('0x31')&&_0x5d10dc[_0x8da2('0x3a')][_0x8da2('0x33')]){_0x5d10dc['body'][_0x8da2('0x33')]=encryptor['encryptString'](_0x5d10dc[_0x8da2('0x3a')][_0x8da2('0x33')]);}return _0x2a6aba;})[_0x8da2('0x14')](saveUpdates(_0x5d10dc[_0x8da2('0x3a')],null))[_0x8da2('0x14')](respondWithResult(_0x18c2a4,null))[_0x8da2('0x44')](handleError(_0x18c2a4,null));};exports[_0x8da2('0x15')]=function(_0x3869a1,_0x577d61){return db[_0x8da2('0x1d')][_0x8da2('0x38')]({'where':{'id':_0x3869a1[_0x8da2('0x45')]['id']}})[_0x8da2('0x14')](handleEntityNotFound(_0x577d61,null))[_0x8da2('0x14')](removeEntity(_0x577d61,null))[_0x8da2('0x44')](handleError(_0x577d61,null));};exports['oauth2MicrosoftAuthorize']=function(_0x3a1f8b,_0x339f75){return db[_0x8da2('0x1d')][_0x8da2('0x46')]({'where':{'id':_0x3a1f8b['params']['id']},'raw':!![]})['then'](function(_0x2ad6e5){if(!_0x2ad6e5)return _0x339f75[_0x8da2('0xb')](0x194);return{'url':oauth[_0x8da2('0x47')](_0x2ad6e5,_0x3a1f8b['user']['id'])};})[_0x8da2('0x14')](respondWithResult(_0x339f75,null))[_0x8da2('0x44')](handleError(_0x339f75,null));};exports[_0x8da2('0x48')]=function(_0x2d9da7,_0x8cd357){var _0x461484=_0x2d9da7[_0x8da2('0x3a')];var _0x4a9159;var _0x90c0b;if(_0x461484[_0x8da2('0x17')])throw _0x461484;redis[_0x8da2('0x49')](_0x461484[_0x8da2('0x4a')])['then'](function(_0x3dbdf6){if(!_0x3dbdf6)throw new Error('Invalid\x20state\x20parameter');_0x4a9159=JSON[_0x8da2('0x4b')](_0x3dbdf6);var _0x176a5b=Buffer[_0x8da2('0x4c')](_0x461484[_0x8da2('0x4a')],'base64')['toString'](_0x8da2('0x4d'));_0x90c0b=JSON[_0x8da2('0x4b')](_0x176a5b);if(!oauth[_0x8da2('0x4e')](_0x461484[_0x8da2('0x4f')],_0x4a9159['oauth2Claims']))throw new Error(_0x8da2('0x50'));redis[_0x8da2('0x51')](_0x461484[_0x8da2('0x4a')]);return oauth[_0x8da2('0x52')](_0x461484[_0x8da2('0x53')],_0x4a9159);})['then'](function(_0x23c19d){_0x4a9159[_0x8da2('0x54')]=_0x23c19d['access_token'];_0x4a9159[_0x8da2('0x55')]=_0x23c19d[_0x8da2('0x56')];return db['CloudProvider'][_0x8da2('0x43')]({'data5':_0x4a9159[_0x8da2('0x54')],'data6':_0x4a9159[_0x8da2('0x55')]},{'where':{'id':_0x4a9159['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x4a9159);socket['emit']('microsoftAuthorization:success',{'id':_0x90c0b['id']});return;})['then'](respondWithStatusCode(_0x8cd357,null))[_0x8da2('0x44')](function(_0x2bdb98){if(_0x90c0b){socket['emit'](_0x8da2('0x57'),{'id':_0x90c0b['id']});}if(!_0x4a9159){logger[_0x8da2('0x17')](_0x8da2('0x58'),_0x2bdb98);return _0x8cd357['status'](0x1f4)[_0x8da2('0x1a')](_0x2bdb98[_0x8da2('0x59')]);}logger[_0x8da2('0x17')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4a9159['id'],JSON['stringify'](_0x2bdb98));});}; \ No newline at end of file +var _0x0029=['update','then','end','stack','name','send','padEnd','slice','index','map','type','key','model','keys','intersection','query','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','decryptString','data3','catch','rawAttributes','find','Service\x20parameter\x20not\x20specified','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','params','destroy','findOne','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0029,0x1bd));var _0x9002=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0029[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var Redis=require(_0x9002('0x0'));var qs=require(_0x9002('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x9002('0x2'));var logger=require(_0x9002('0x3'))(_0x9002('0x4'));var db=require(_0x9002('0x5'))['db'];var oauth=require(_0x9002('0x6'));config[_0x9002('0x7')]=_[_0x9002('0x8')](config['redis'],{'host':_0x9002('0x9'),'port':0x18eb});var socket=require(_0x9002('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xaa6cfe,_0x1bc871){_0x1bc871=_0x1bc871||0xcc;return function(_0x439cd4){if(_0x439cd4){return _0xaa6cfe[_0x9002('0xb')](_0x1bc871);}return _0xaa6cfe[_0x9002('0xc')](_0x1bc871)['end']();};}function respondWithResult(_0x21df76,_0x87e11f){_0x87e11f=_0x87e11f||0xc8;return function(_0x530c37){if(_0x530c37){return _0x21df76[_0x9002('0xc')](_0x87e11f)[_0x9002('0xd')](_0x530c37);}};}function respondWithFilteredResult(_0x1016a4,_0x3e9a65){return function(_0x46416b){if(_0x46416b){var _0x68b66f=typeof _0x3e9a65[_0x9002('0xe')]===_0x9002('0xf')&&typeof _0x3e9a65[_0x9002('0x10')]===_0x9002('0xf');var _0x27e4cb=_0x46416b[_0x9002('0x11')];var _0x1586b4=_0x68b66f?0x0:_0x3e9a65[_0x9002('0xe')];var _0x533e6c=_0x68b66f?_0x46416b[_0x9002('0x11')]:_0x3e9a65['offset']+_0x3e9a65['limit'];var _0x5e2060;if(_0x533e6c>=_0x27e4cb){_0x533e6c=_0x27e4cb;_0x5e2060=0xc8;}else{_0x5e2060=0xce;}_0x1016a4[_0x9002('0xc')](_0x5e2060);return _0x1016a4[_0x9002('0x12')](_0x9002('0x13'),_0x1586b4+'-'+_0x533e6c+'/'+_0x27e4cb)[_0x9002('0xd')](_0x46416b);}return null;};}function saveUpdates(_0x7a208f){return function(_0x5767ee){if(_0x5767ee){return _0x5767ee[_0x9002('0x14')](_0x7a208f)['then'](function(_0x196329){return _0x196329;});}return null;};}function removeEntity(_0x103909){return function(_0x307558){if(_0x307558){return _0x307558['destroy']()[_0x9002('0x15')](function(){_0x103909[_0x9002('0xc')](0xcc)[_0x9002('0x16')]();});}};}function handleEntityNotFound(_0x280b74){return function(_0x18d74a){if(!_0x18d74a){_0x280b74[_0x9002('0xb')](0x194);}return _0x18d74a;};}function handleError(_0x5d1bd2,_0x590bf6){_0x590bf6=_0x590bf6||0x1f4;return function(_0x12c71b){logger['error'](_0x12c71b[_0x9002('0x17')]);if(_0x12c71b[_0x9002('0x18')]){delete _0x12c71b[_0x9002('0x18')];}_0x5d1bd2[_0x9002('0xc')](_0x590bf6)[_0x9002('0x19')](_0x12c71b);};}function maskClientSecret(_0x4a3309){return _[_0x9002('0x1a')](_0x4a3309[_0x9002('0x1b')](0x0,0x3),0x14,'*');}exports[_0x9002('0x1c')]=function(_0x288253,_0x2b80f9){var _0x29801b={},_0x10885d={},_0x2129fa={'count':0x0,'rows':[]};var _0x11800f=_[_0x9002('0x1d')](db['CloudProvider']['rawAttributes'],function(_0x3dcb21){return{'name':_0x3dcb21['fieldName'],'type':_0x3dcb21[_0x9002('0x1e')][_0x9002('0x1f')]};});_0x10885d[_0x9002('0x20')]=_[_0x9002('0x1d')](_0x11800f,_0x9002('0x18'));_0x10885d['query']=_[_0x9002('0x21')](_0x288253['query']);_0x10885d['filters']=_[_0x9002('0x22')](_0x10885d[_0x9002('0x20')],_0x10885d[_0x9002('0x23')]);_0x29801b[_0x9002('0x24')]=_[_0x9002('0x22')](_0x10885d[_0x9002('0x20')],qs[_0x9002('0x25')](_0x288253[_0x9002('0x23')]['fields']));_0x29801b['attributes']=_0x29801b[_0x9002('0x24')]['length']?_0x29801b[_0x9002('0x24')]:_0x10885d[_0x9002('0x20')];if(!_0x288253[_0x9002('0x23')]['hasOwnProperty'](_0x9002('0x26'))){_0x29801b[_0x9002('0x10')]=qs['limit'](_0x288253[_0x9002('0x23')][_0x9002('0x10')]);_0x29801b['offset']=qs['offset'](_0x288253[_0x9002('0x23')][_0x9002('0xe')]);}_0x29801b['order']=qs['sort'](_0x288253[_0x9002('0x23')][_0x9002('0x27')]);_0x29801b[_0x9002('0x28')]=qs[_0x9002('0x29')](_[_0x9002('0x2a')](_0x288253[_0x9002('0x23')],_0x10885d[_0x9002('0x29')]),_0x11800f);if(_0x288253[_0x9002('0x23')][_0x9002('0x2b')]){_0x29801b[_0x9002('0x28')]=_[_0x9002('0x2c')](_0x29801b[_0x9002('0x28')],{'$or':_[_0x9002('0x1d')](_0x11800f,function(_0x5273fa){if(_0x5273fa[_0x9002('0x1e')]!==_0x9002('0x2d')){var _0x67efe0={};_0x67efe0[_0x5273fa[_0x9002('0x18')]]={'$like':'%'+_0x288253[_0x9002('0x23')][_0x9002('0x2b')]+'%'};return _0x67efe0;}})});}_0x29801b=_[_0x9002('0x2c')]({},_0x29801b,_0x288253[_0x9002('0x2e')]);var _0x424aa0={'where':_0x29801b[_0x9002('0x28')]};return db[_0x9002('0x2f')][_0x9002('0x11')](_0x424aa0)[_0x9002('0x15')](function(_0xab61ef){_0x2129fa['count']=_0xab61ef;if(_0x288253[_0x9002('0x23')][_0x9002('0x30')]){_0x29801b[_0x9002('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x9002('0x32')](_0x29801b);})['then'](function(_0x38a339){_0x2129fa[_0x9002('0x33')]=_[_0x9002('0x1d')](_0x38a339,function(_0x9b1275){if(_0x9b1275[_0x9002('0x34')]==='MicrosoftAzure'){var _0x4b9499=encryptor[_0x9002('0x35')](_0x9b1275[_0x9002('0x36')]);_0x9b1275[_0x9002('0x36')]=maskClientSecret(_0x4b9499);}return _0x9b1275;});return _0x2129fa;})[_0x9002('0x15')](respondWithFilteredResult(_0x2b80f9,_0x29801b))[_0x9002('0x37')](handleError(_0x2b80f9,null));};exports['show']=function(_0x28639a,_0x157232){var _0xe2b587={'raw':!![],'where':{'id':_0x28639a['params']['id']}},_0x47ab63={};_0x47ab63[_0x9002('0x20')]=_[_0x9002('0x21')](db[_0x9002('0x2f')][_0x9002('0x38')]);_0x47ab63[_0x9002('0x23')]=_[_0x9002('0x21')](_0x28639a[_0x9002('0x23')]);_0x47ab63['filters']=_[_0x9002('0x22')](_0x47ab63[_0x9002('0x20')],_0x47ab63[_0x9002('0x23')]);_0xe2b587[_0x9002('0x24')]=_[_0x9002('0x22')](_0x47ab63[_0x9002('0x20')],qs['fields'](_0x28639a[_0x9002('0x23')][_0x9002('0x25')]));_0xe2b587[_0x9002('0x24')]=_0xe2b587[_0x9002('0x24')]['length']?_0xe2b587[_0x9002('0x24')]:_0x47ab63[_0x9002('0x20')];if(_0x28639a[_0x9002('0x23')][_0x9002('0x30')]){_0xe2b587[_0x9002('0x31')]=[{'all':!![]}];}_0xe2b587=_[_0x9002('0x2c')]({},_0xe2b587,_0x28639a[_0x9002('0x2e')]);return db[_0x9002('0x2f')][_0x9002('0x39')](_0xe2b587)['then'](handleEntityNotFound(_0x157232,null))['then'](function(_0x13a40e){if(_0x13a40e['service']==='MicrosoftAzure'){var _0x2c2c53=encryptor[_0x9002('0x35')](_0x13a40e[_0x9002('0x36')]);_0x13a40e[_0x9002('0x36')]=maskClientSecret(_0x2c2c53);}return _0x13a40e;})[_0x9002('0x15')](respondWithResult(_0x157232,null))['catch'](handleError(_0x157232,null));};exports['create']=function(_0x6e5dbb,_0x48e19d){if(!_0x6e5dbb['body'][_0x9002('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x6e5dbb['body']['service'])throw new Error(_0x9002('0x3a'));var _0x669d33=db[_0x9002('0x2f')][_0x9002('0x38')][_0x9002('0x34')]['values'];if(!_0x669d33['includes'](_0x6e5dbb[_0x9002('0x3b')]['service']))throw new Error(_0x9002('0x3c')+_0x669d33[_0x9002('0x3d')](',\x20'));if(_0x6e5dbb[_0x9002('0x3b')]['service']===_0x9002('0x3e')&&_0x6e5dbb['body'][_0x9002('0x36')]){_0x6e5dbb['body'][_0x9002('0x36')]=encryptor[_0x9002('0x3f')](_0x6e5dbb['body'][_0x9002('0x36')]);}return db['CloudProvider']['create'](_0x6e5dbb[_0x9002('0x3b')],{})[_0x9002('0x15')](respondWithResult(_0x48e19d,0xc9))[_0x9002('0x37')](handleError(_0x48e19d,null));};exports[_0x9002('0x14')]=function(_0x5a7000,_0x30726c){if(_0x5a7000['body']['id']){delete _0x5a7000[_0x9002('0x3b')]['id'];}return db[_0x9002('0x2f')]['find']({'where':{'id':_0x5a7000[_0x9002('0x40')]['id']}})[_0x9002('0x15')](handleEntityNotFound(_0x30726c,null))[_0x9002('0x15')](function(_0x3c8a0b){if(_0x3c8a0b[_0x9002('0x34')]===_0x9002('0x3e')&&_0x5a7000[_0x9002('0x3b')]['data3']){_0x5a7000[_0x9002('0x3b')][_0x9002('0x36')]=encryptor['encryptString'](_0x5a7000[_0x9002('0x3b')][_0x9002('0x36')]);}return _0x3c8a0b;})[_0x9002('0x15')](saveUpdates(_0x5a7000[_0x9002('0x3b')],null))[_0x9002('0x15')](respondWithResult(_0x30726c,null))['catch'](handleError(_0x30726c,null));};exports[_0x9002('0x41')]=function(_0x3b094b,_0x3273e3){return db[_0x9002('0x2f')][_0x9002('0x39')]({'where':{'id':_0x3b094b['params']['id']}})[_0x9002('0x15')](handleEntityNotFound(_0x3273e3,null))['then'](removeEntity(_0x3273e3,null))[_0x9002('0x37')](handleError(_0x3273e3,null));};exports['oauth2MicrosoftAuthorize']=function(_0x569bef,_0x36561c){return db[_0x9002('0x2f')][_0x9002('0x42')]({'where':{'id':_0x569bef[_0x9002('0x40')]['id']},'raw':!![]})['then'](function(_0x321acd){if(!_0x321acd)return _0x36561c['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x321acd,_0x569bef['user']['id'])};})['then'](respondWithResult(_0x36561c,null))[_0x9002('0x37')](handleError(_0x36561c,null));};exports[_0x9002('0x43')]=function(_0x15c5fe,_0x5ad4dd){var _0x29d993=_0x15c5fe[_0x9002('0x3b')];var _0x42d845;var _0x45b53c;if(_0x29d993['error'])throw _0x29d993;redis['get'](_0x29d993[_0x9002('0x44')])[_0x9002('0x15')](function(_0x17e4e1){if(!_0x17e4e1)throw new Error(_0x9002('0x45'));_0x42d845=JSON[_0x9002('0x46')](_0x17e4e1);var _0x396d07=Buffer[_0x9002('0x47')](_0x29d993[_0x9002('0x44')],_0x9002('0x48'))[_0x9002('0x49')](_0x9002('0x4a'));_0x45b53c=JSON[_0x9002('0x46')](_0x396d07);if(!oauth[_0x9002('0x4b')](_0x29d993[_0x9002('0x4c')],_0x42d845[_0x9002('0x4d')]))throw new Error(_0x9002('0x4e'));redis['del'](_0x29d993[_0x9002('0x44')]);return oauth[_0x9002('0x4f')](_0x29d993['code'],_0x42d845);})[_0x9002('0x15')](function(_0x4c6206){_0x42d845[_0x9002('0x50')]=_0x4c6206[_0x9002('0x51')];_0x42d845[_0x9002('0x52')]=_0x4c6206[_0x9002('0x53')];return db[_0x9002('0x2f')][_0x9002('0x14')]({'data5':_0x42d845['data5'],'data6':_0x42d845['data6']},{'where':{'id':_0x42d845['id']}});})[_0x9002('0x15')](function(){oauth[_0x9002('0x54')](_0x42d845);socket[_0x9002('0x55')](_0x9002('0x56'),{'id':_0x45b53c['id']});return;})[_0x9002('0x15')](respondWithStatusCode(_0x5ad4dd,null))[_0x9002('0x37')](function(_0x18b5f7){if(_0x45b53c){socket[_0x9002('0x55')](_0x9002('0x57'),{'id':_0x45b53c['id']});}if(!_0x42d845){logger[_0x9002('0x58')](_0x9002('0x59'),_0x18b5f7);return _0x5ad4dd[_0x9002('0xc')](0x1f4)[_0x9002('0x19')](_0x18b5f7[_0x9002('0x5a')]);}logger[_0x9002('0x58')](_0x9002('0x5b'),_0x42d845['id'],JSON[_0x9002('0x5c')](_0x18b5f7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1a52db2..bfdea8c 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 _0x3f8d=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x3f8d,0x172));var _0xd3f8=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0x3f8d[_0x19d350];return _0x3bfc8d;};'use strict';var _=require(_0xd3f8('0x0'));var util=require(_0xd3f8('0x1'));var logger=require(_0xd3f8('0x2'))(_0xd3f8('0x3'));var moment=require(_0xd3f8('0x4'));var BPromise=require(_0xd3f8('0x5'));var rp=require(_0xd3f8('0x6'));var fs=require('fs');var path=require(_0xd3f8('0x7'));var rimraf=require(_0xd3f8('0x8'));var config=require(_0xd3f8('0x9'));var attributes=require(_0xd3f8('0xa'));module[_0xd3f8('0xb')]=function(_0x112308,_0x485a82){return _0x112308[_0xd3f8('0xc')](_0xd3f8('0xd'),attributes,{'tableName':_0xd3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb965=['request-promise','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird'];(function(_0x21b438,_0x45de54){var _0x2d1fcf=function(_0xce22d7){while(--_0xce22d7){_0x21b438['push'](_0x21b438['shift']());}};_0x2d1fcf(++_0x45de54);}(_0xb965,0x15b));var _0x5b96=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xb965[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x5b96('0x0'));var util=require(_0x5b96('0x1'));var logger=require('../../config/logger')(_0x5b96('0x2'));var moment=require(_0x5b96('0x3'));var BPromise=require(_0x5b96('0x4'));var rp=require(_0x5b96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b96('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x5b96('0x7')]=function(_0x95655,_0x29935c){return _0x95655[_0x5b96('0x8')](_0x5b96('0x9'),attributes,{'tableName':_0x5b96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 35b2540..d12dfea 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa493=['data1','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','oauth2/','iss','issuer','aud','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','/authorize','/token','map','type','Dynamics365','push','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','hex','client_id'];(function(_0xc911b0,_0x4b667a){var _0x8c0c77=function(_0x534140){while(--_0x534140){_0xc911b0['push'](_0xc911b0['shift']());}};_0x8c0c77(++_0x4b667a);}(_0xa493,0x1f0));var _0x3a49=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa493[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x3a49('0x0'));var crypto=require(_0x3a49('0x1'));var jwt=require(_0x3a49('0x2'));var moment=require(_0x3a49('0x3'));var Redis=require(_0x3a49('0x4'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x3a49('0x5'));var config=require(_0x3a49('0x6'));var logger=require('../../config/logger')(_0x3a49('0x7'));var schedule=require(_0x3a49('0x8'));var db=require('../../mysqldb')['db'];config[_0x3a49('0x9')]=_[_0x3a49('0xa')](config[_0x3a49('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x3a49('0x9')]);var MICROSOFT_AUTH_URL=_0x3a49('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x3a49('0xc'),'email',_0x3a49('0xd'),_0x3a49('0xe'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x3a49('0xf'),_0x3a49('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x3a49('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x3a49('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x449637){var _0x2934a1=_[_0x3a49('0x12')](AZURE_AUTH_SCOPES[_0x449637[_0x3a49('0x13')]]);if(_0x449637[_0x3a49('0x13')]===_0x3a49('0x14'))_0x2934a1[_0x3a49('0x15')](_0x449637['data7']+_0x3a49('0x16'));return _0x2934a1[_0x3a49('0x17')]('\x20');}function getAccessTokenScope(_0x16b384){if(_0x16b384[_0x3a49('0x13')]===_0x3a49('0x18'))return _0x3a49('0xe');if(_0x16b384[_0x3a49('0x13')]==='Dynamics365')return _0x16b384['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x32ddb7,_0x3e235d){var _0x4604fb=MICROSOFT_AUTH_URL[_0x3a49('0x19')](_0x3a49('0x1a'),_0x32ddb7[_0x3a49('0x1b')]);var _0x46cd3a=[_0x3a49('0x1c'),'id_token'];var _0x4f028e=Buffer[_0x3a49('0x1d')](JSON[_0x3a49('0x1e')]({'id':_0x3e235d}))[_0x3a49('0x1f')](_0x3a49('0x20'));var _0x448ec9=crypto[_0x3a49('0x21')](0x10)['toString'](_0x3a49('0x22'));var _0xe2193=getAuthorizationScopes(_0x32ddb7);var _0x34e963=[{'key':_0x3a49('0x23'),'value':_0x32ddb7[_0x3a49('0x24')]},{'key':_0x3a49('0x25'),'value':encodeURIComponent(_0x46cd3a[_0x3a49('0x17')]('\x20'))},{'key':_0x3a49('0x26'),'value':_0x32ddb7[_0x3a49('0x27')]},{'key':_0x3a49('0x28'),'value':_0x3a49('0x29')},{'key':_0x3a49('0x2a'),'value':encodeURIComponent(_0xe2193)},{'key':'state','value':_0x4f028e},{'key':_0x3a49('0x2b'),'value':_0x448ec9},{'key':_0x3a49('0x2c'),'value':_0x3a49('0x2d')}];var _0x32c8f9=_0x4604fb+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x34e963,function(_0x4d4079){return _0x4d4079[_0x3a49('0x2e')]+'='+_0x4d4079[_0x3a49('0x2f')];})['join']('&');_0x32ddb7[_0x3a49('0x30')]={'issuer':_0x4604fb['replace'](_0x3a49('0x31'),''),'audience':_0x32ddb7[_0x3a49('0x24')],'state':_0x4f028e,'nonce':_0x448ec9};redis['set'](_0x4f028e,JSON[_0x3a49('0x1e')](_0x32ddb7));return _0x32c8f9;}function isValidIdToken(_0xf2ba28,_0x3dae0c){try{var _0x3ba4e2=jwt['decode'](_0xf2ba28,{'complete':!![]});var _0x3660bc=_0x3ba4e2['payload'];if(_0x3660bc[_0x3a49('0x32')]!==_0x3dae0c[_0x3a49('0x33')])return![];if(_0x3660bc[_0x3a49('0x34')]!==_0x3dae0c['audience'])return![];if(_0x3660bc[_0x3a49('0x2b')]!==_0x3dae0c[_0x3a49('0x2b')])return![];if(moment()[_0x3a49('0x35')](moment[_0x3a49('0x36')](_0x3660bc[_0x3a49('0x37')])))return![];return!![];}catch(_0x1cb6b7){throw _0x1cb6b7;}}function refreshOauth2MicrosoftAccessToken(_0x3a241a){return Promise[_0x3a49('0x38')]()[_0x3a49('0x39')](function(){if(_0x3a241a['data3'])return _0x3a241a;return db[_0x3a49('0x3a')][_0x3a49('0x3b')]({'where':{'id':_0x3a241a['id']},'raw':!![]});})[_0x3a49('0x39')](function(_0x13a102){var _0xc4e201={'grant_type':_0x3a49('0x3c'),'refresh_token':_0x13a102[_0x3a49('0x3d')],'scope':getAccessTokenScope(_0x13a102),'redirect_uri':_0x13a102[_0x3a49('0x27')],'client_id':_0x13a102[_0x3a49('0x24')],'client_secret':encryptor[_0x3a49('0x3e')](_0x13a102[_0x3a49('0x3f')])};var _0x30003c={'method':_0x3a49('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0x3a49('0x1a'),_0x13a102[_0x3a49('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xc4e201,'json':!![]};return rp(_0x30003c);})[_0x3a49('0x39')](function(_0x8b91b5){_0x3a241a[_0x3a49('0x41')]=_0x8b91b5[_0x3a49('0x42')];_0x3a241a[_0x3a49('0x3d')]=_0x8b91b5['refresh_token'];return db[_0x3a49('0x3a')]['update']({'data5':_0x3a241a[_0x3a49('0x41')],'data6':_0x3a241a['data6']},{'where':{'id':_0x3a241a['id']}});})[_0x3a49('0x39')](function(){return _0x3a241a;})[_0x3a49('0x43')](function(_0x217a40){logger[_0x3a49('0x44')](_0x3a49('0x45'),_0x3a241a['id'],_0x217a40);});}function getOauth2MicrosoftAccessToken(_0x57f720,_0x48bc8d){var _0x1d6e8b={'grant_type':_0x3a49('0x46'),'code':_0x57f720,'scope':getAccessTokenScope(_0x48bc8d),'redirect_uri':_0x48bc8d[_0x3a49('0x27')],'client_id':_0x48bc8d['data1'],'client_secret':encryptor[_0x3a49('0x3e')](_0x48bc8d['data3'])};var _0x2984bb={'method':_0x3a49('0x40'),'uri':MICROSOFT_AUTH_URL[_0x3a49('0x19')](_0x3a49('0x1a'),_0x48bc8d[_0x3a49('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1d6e8b,'json':!![]};return rp(_0x2984bb);}function startRefreshInterval(_0x32b6b1){var _0x103bdf=schedule[_0x3a49('0x47')];if(_0x103bdf[_0x32b6b1['id']])clearInterval(_0x103bdf[_0x32b6b1['id']]);_0x103bdf[_0x32b6b1['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x32b6b1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3a49('0x47')]=_0x103bdf;}function startAllRefreshIntervals(){return db[_0x3a49('0x3a')][_0x3a49('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3a49('0x39')](function(_0x4da592){var _0x3b8ff9=_0x4da592[_0x3a49('0x12')](function(_0x1077d4){return refreshOauth2MicrosoftAccessToken(_0x1077d4)[_0x3a49('0x39')](function(_0x34447e){startRefreshInterval(_0x34447e);});});return Promise[_0x3a49('0x49')](_0x3b8ff9);})[_0x3a49('0x43')](function(_0x58aa59){var _0x33c87b=_0x58aa59?util['inspect'](_0x58aa59,{'showHidden':![],'depth':null}):'';logger[_0x3a49('0x44')](_0x3a49('0x4a'),_0x33c87b);});}module[_0x3a49('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x227e=['id_token','stringify','toString','base64','hex','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','set','decode','payload','iss','issuer','aud','isAfter','exp','resolve','then','data3','CloudProvider','findOne','data6','decryptString','POST','data5','access_token','intervals','bind','findAll','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','push','data7','Outlook365','replace','{TENANT_ID}','data2','code'];(function(_0x28d21b,_0x29693c){var _0x1b1c41=function(_0x4d73f6){while(--_0x4d73f6){_0x28d21b['push'](_0x28d21b['shift']());}};_0x1b1c41(++_0x29693c);}(_0x227e,0x75));var _0xe227=function(_0x1ed95b,_0x1e0bbe){_0x1ed95b=_0x1ed95b-0x0;var _0x4d96a8=_0x227e[_0x1ed95b];return _0x4d96a8;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0xe227('0x0'));var encryptor=require(_0xe227('0x1'));var config=require(_0xe227('0x2'));var logger=require(_0xe227('0x3'))(_0xe227('0x4'));var schedule=require(_0xe227('0x5'));var db=require(_0xe227('0x6'))['db'];config[_0xe227('0x7')]=_[_0xe227('0x8')](config['redis'],{'host':_0xe227('0x9'),'port':0x18eb});var redis=new Redis(config[_0xe227('0x7')]);var MICROSOFT_AUTH_URL=_0xe227('0xa');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xe227('0xb'),_0xe227('0xc'),_0xe227('0xd'),_0xe227('0xe'),_0xe227('0xf'),_0xe227('0x10')],'Dynamics365':[_0xe227('0x11'),_0xe227('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0xe227('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xe227('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5b338a){var _0x4479a5=_[_0xe227('0x14')](AZURE_AUTH_SCOPES[_0x5b338a[_0xe227('0x15')]]);if(_0x5b338a['type']==='Dynamics365')_0x4479a5[_0xe227('0x16')](_0x5b338a[_0xe227('0x17')]+'/.default');return _0x4479a5['join']('\x20');}function getAccessTokenScope(_0x151f03){if(_0x151f03[_0xe227('0x15')]===_0xe227('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x151f03[_0xe227('0x15')]==='Dynamics365')return _0x151f03[_0xe227('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4c8fb3,_0x48dad3){var _0x460eb0=MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x4c8fb3[_0xe227('0x1b')]);var _0x470ed3=[_0xe227('0x1c'),_0xe227('0x1d')];var _0x5150d0=Buffer['from'](JSON[_0xe227('0x1e')]({'id':_0x48dad3}))[_0xe227('0x1f')](_0xe227('0x20'));var _0x4e6a47=crypto['randomBytes'](0x10)['toString'](_0xe227('0x21'));var _0x36af94=getAuthorizationScopes(_0x4c8fb3);var _0x57c448=[{'key':_0xe227('0x22'),'value':_0x4c8fb3[_0xe227('0x23')]},{'key':_0xe227('0x24'),'value':encodeURIComponent(_0x470ed3[_0xe227('0x25')]('\x20'))},{'key':_0xe227('0x26'),'value':_0x4c8fb3[_0xe227('0x27')]},{'key':_0xe227('0x28'),'value':_0xe227('0x29')},{'key':_0xe227('0x2a'),'value':encodeURIComponent(_0x36af94)},{'key':_0xe227('0x2b'),'value':_0x5150d0},{'key':_0xe227('0x2c'),'value':_0x4e6a47},{'key':_0xe227('0x2d'),'value':_0xe227('0x2e')}];var _0x1ce688=_0x460eb0+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x57c448,function(_0x273ac8){return _0x273ac8[_0xe227('0x2f')]+'='+_0x273ac8[_0xe227('0x30')];})[_0xe227('0x25')]('&');_0x4c8fb3['oauth2Claims']={'issuer':_0x460eb0[_0xe227('0x19')]('oauth2/',''),'audience':_0x4c8fb3[_0xe227('0x23')],'state':_0x5150d0,'nonce':_0x4e6a47};redis[_0xe227('0x31')](_0x5150d0,JSON['stringify'](_0x4c8fb3));return _0x1ce688;}function isValidIdToken(_0x53e28c,_0xba4703){try{var _0x2b228a=jwt[_0xe227('0x32')](_0x53e28c,{'complete':!![]});var _0x21fdbe=_0x2b228a[_0xe227('0x33')];if(_0x21fdbe[_0xe227('0x34')]!==_0xba4703[_0xe227('0x35')])return![];if(_0x21fdbe[_0xe227('0x36')]!==_0xba4703['audience'])return![];if(_0x21fdbe[_0xe227('0x2c')]!==_0xba4703[_0xe227('0x2c')])return![];if(moment()[_0xe227('0x37')](moment['unix'](_0x21fdbe[_0xe227('0x38')])))return![];return!![];}catch(_0x88d3e6){throw _0x88d3e6;}}function refreshOauth2MicrosoftAccessToken(_0x481f9c){return Promise[_0xe227('0x39')]()[_0xe227('0x3a')](function(){if(_0x481f9c[_0xe227('0x3b')])return _0x481f9c;return db[_0xe227('0x3c')][_0xe227('0x3d')]({'where':{'id':_0x481f9c['id']},'raw':!![]});})[_0xe227('0x3a')](function(_0x80e0e2){var _0x4f7dde={'grant_type':'refresh_token','refresh_token':_0x80e0e2[_0xe227('0x3e')],'scope':getAccessTokenScope(_0x80e0e2),'redirect_uri':_0x80e0e2['data4'],'client_id':_0x80e0e2[_0xe227('0x23')],'client_secret':encryptor[_0xe227('0x3f')](_0x80e0e2[_0xe227('0x3b')])};var _0xf0b447={'method':_0xe227('0x40'),'uri':MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x80e0e2[_0xe227('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f7dde,'json':!![]};return rp(_0xf0b447);})['then'](function(_0x5b2afd){_0x481f9c[_0xe227('0x41')]=_0x5b2afd[_0xe227('0x42')];_0x481f9c['data6']=_0x5b2afd['refresh_token'];return db[_0xe227('0x3c')]['update']({'data5':_0x481f9c[_0xe227('0x41')],'data6':_0x481f9c['data6']},{'where':{'id':_0x481f9c['id']}});})[_0xe227('0x3a')](function(){return _0x481f9c;})['catch'](function(_0x40b2e9){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x481f9c['id'],_0x40b2e9);});}function getOauth2MicrosoftAccessToken(_0x23d953,_0x176afa){var _0xa593b5={'grant_type':'authorization_code','code':_0x23d953,'scope':getAccessTokenScope(_0x176afa),'redirect_uri':_0x176afa[_0xe227('0x27')],'client_id':_0x176afa['data1'],'client_secret':encryptor[_0xe227('0x3f')](_0x176afa[_0xe227('0x3b')])};var _0x35f8e1={'method':_0xe227('0x40'),'uri':MICROSOFT_AUTH_URL[_0xe227('0x19')](_0xe227('0x1a'),_0x176afa[_0xe227('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xa593b5,'json':!![]};return rp(_0x35f8e1);}function startRefreshInterval(_0x3bbaa7){var _0x30c6d7=schedule[_0xe227('0x43')];if(_0x30c6d7[_0x3bbaa7['id']])clearInterval(_0x30c6d7[_0x3bbaa7['id']]);_0x30c6d7[_0x3bbaa7['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe227('0x44')](this,{'id':_0x3bbaa7['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe227('0x43')]=_0x30c6d7;}function startAllRefreshIntervals(){return db[_0xe227('0x3c')][_0xe227('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe227('0x3a')](function(_0x5a6399){var _0x2b825f=_0x5a6399[_0xe227('0x14')](function(_0x35f9b8){return refreshOauth2MicrosoftAccessToken(_0x35f9b8)[_0xe227('0x3a')](function(_0x529847){startRefreshInterval(_0x529847);});});return Promise['all'](_0x2b825f);})[_0xe227('0x46')](function(_0x12614d){var _0x525040=_0x12614d?util['inspect'](_0x12614d,{'showHidden':![],'depth':null}):'';logger[_0xe227('0x47')](_0xe227('0x48'),_0x525040);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 305ad32..5987229 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 _0x7177=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7177,0x101));var _0x7717=function(_0x64b57d,_0x2a79d8){_0x64b57d=_0x64b57d-0x0;var _0x2f55bd=_0x7177[_0x64b57d];return _0x2f55bd;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3d36b,_0x3db511,_0xaca6aa){return new BPromise(function(_0x2ded67,_0x29a980){return client[_0x7717('0xa')](_0xe3d36b,_0xaca6aa)[_0x7717('0xb')](function(_0x51d2a6){logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,'request\x20sent');logger[_0x7717('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3db511,_0x7717('0xf'),JSON[_0x7717('0x10')](_0x51d2a6));if(_0x51d2a6[_0x7717('0x11')]){if(_0x51d2a6[_0x7717('0x11')][_0x7717('0x12')]===0x1f4){logger['error'](_0x7717('0xd'),_0x3db511,_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);return _0x29a980(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}logger[_0x7717('0x11')](_0x7717('0xd'),_0x3db511,_0x51d2a6['error'][_0x7717('0x13')]);return _0x2ded67(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}else{logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,_0x7717('0xf'));_0x2ded67(_0x51d2a6[_0x7717('0x14')]['message']);}})['catch'](function(_0x4071ff){logger['error'](_0x7717('0xd'),_0x3db511,_0x4071ff);_0x29a980(_0x4071ff);});});} \ No newline at end of file +var _0x26c2=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26c2,0x1d6));var _0x226c=function(_0x3a54b1,_0x2a93cd){_0x3a54b1=_0x3a54b1-0x0;var _0x5b451b=_0x26c2[_0x3a54b1];return _0x5b451b;};'use strict';var _=require('lodash');var util=require(_0x226c('0x0'));var moment=require(_0x226c('0x1'));var BPromise=require(_0x226c('0x2'));var rs=require(_0x226c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x226c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x226c('0x5'))(_0x226c('0x6'));var config=require(_0x226c('0x7'));var jayson=require(_0x226c('0x8'));var client=jayson[_0x226c('0x9')][_0x226c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ccdb,_0x50654d,_0x58ebd8){return new BPromise(function(_0x53fc4f,_0x10cae2){return client[_0x226c('0xb')](_0x23ccdb,_0x58ebd8)['then'](function(_0x475e09){logger[_0x226c('0xc')](_0x226c('0xd'),_0x50654d,_0x226c('0xe'));logger[_0x226c('0xf')](_0x226c('0x10'),_0x50654d,_0x226c('0xe'),JSON['stringify'](_0x475e09));if(_0x475e09['error']){if(_0x475e09[_0x226c('0x11')][_0x226c('0x12')]===0x1f4){logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x475e09['error']['message']);return _0x10cae2(_0x475e09[_0x226c('0x11')][_0x226c('0x13')]);}logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x475e09[_0x226c('0x11')]['message']);return _0x53fc4f(_0x475e09[_0x226c('0x11')][_0x226c('0x13')]);}else{logger[_0x226c('0xc')]('CloudProvider,\x20%s,\x20%s',_0x50654d,_0x226c('0xe'));_0x53fc4f(_0x475e09[_0x226c('0x14')][_0x226c('0x13')]);}})[_0x226c('0x15')](function(_0x3b6d9a){logger[_0x226c('0x11')](_0x226c('0xd'),_0x50654d,_0x3b6d9a);_0x10cae2(_0x3b6d9a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 70ad3d1..6a708ef 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x1261,0x144));var _0x1126=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x1261[_0x5ac1e5];return _0x1bccc6;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x5f2f,0x73));var _0xf5f2=function(_0x214c21,_0x545f27){_0x214c21=_0x214c21-0x0;var _0x34b2cf=_0x5f2f[_0x214c21];return _0x34b2cf;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f8a3e22..162d2e4 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 _0x6f1d=['STRING','name','exports'];(function(_0x3fecfd,_0x89fe75){var _0x4e92d4=function(_0x2013e7){while(--_0x2013e7){_0x3fecfd['push'](_0x3fecfd['shift']());}};_0x4e92d4(++_0x89fe75);}(_0x6f1d,0x1b2));var _0xd6f1=function(_0x351430,_0x1489bd){_0x351430=_0x351430-0x0;var _0x5ae42d=_0x6f1d[_0x351430];return _0x5ae42d;};'use strict';var Sequelize=require('sequelize');module[_0xd6f1('0x0')]={'name':{'type':Sequelize[_0xd6f1('0x1')],'unique':_0xd6f1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd6f1('0x1')]},'companyId':{'type':Sequelize[_0xd6f1('0x1')]},'website':{'type':Sequelize[_0xd6f1('0x1')]},'phone':{'type':Sequelize[_0xd6f1('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd6f1('0x1')]},'street':{'type':Sequelize[_0xd6f1('0x1')]},'postalCode':{'type':Sequelize[_0xd6f1('0x1')]},'city':{'type':Sequelize[_0xd6f1('0x1')]},'country':{'type':Sequelize[_0xd6f1('0x1')]},'email':{'type':Sequelize[_0xd6f1('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd6f1('0x1')]},'sStreet':{'type':Sequelize[_0xd6f1('0x1')]},'sPostalCode':{'type':Sequelize[_0xd6f1('0x1')]},'sCity':{'type':Sequelize[_0xd6f1('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd6f1('0x1')]}}; \ No newline at end of file +var _0x4172=['sequelize','STRING','name'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x4172,0x1aa));var _0x2417=function(_0x1293dc,_0x285c24){_0x1293dc=_0x1293dc-0x0;var _0x3f8089=_0x4172[_0x1293dc];return _0x3f8089;};'use strict';var Sequelize=require(_0x2417('0x0'));module['exports']={'name':{'type':Sequelize[_0x2417('0x1')],'unique':_0x2417('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2417('0x1')]},'companyId':{'type':Sequelize[_0x2417('0x1')]},'website':{'type':Sequelize[_0x2417('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2417('0x1')]},'street':{'type':Sequelize[_0x2417('0x1')]},'postalCode':{'type':Sequelize[_0x2417('0x1')]},'city':{'type':Sequelize[_0x2417('0x1')]},'country':{'type':Sequelize[_0x2417('0x1')]},'email':{'type':Sequelize[_0x2417('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2417('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x2417('0x1')]},'sCity':{'type':Sequelize[_0x2417('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2417('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 7dda340..d2dc0a8 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 _0x44fe=['describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Companies','UserProfileResource','stack','name','index','CmCompany'];(function(_0x1c33e2,_0x22412d){var _0x3dae1a=function(_0x569a97){while(--_0x569a97){_0x1c33e2['push'](_0x1c33e2['shift']());}};_0x3dae1a(++_0x22412d);}(_0x44fe,0x7f));var _0xe44f=function(_0x4c70da,_0x55f8ef){_0x4c70da=_0x4c70da-0x0;var _0x2f2931=_0x44fe[_0x4c70da];return _0x2f2931;};'use strict';var emlformat=require(_0xe44f('0x0'));var rimraf=require(_0xe44f('0x1'));var zipdir=require(_0xe44f('0x2'));var jsonpatch=require(_0xe44f('0x3'));var rp=require('request-promise');var moment=require(_0xe44f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe44f('0x5'));var util=require('util');var path=require(_0xe44f('0x6'));var sox=require(_0xe44f('0x7'));var csv=require(_0xe44f('0x8'));var ejs=require(_0xe44f('0x9'));var fs=require('fs');var fs_extra=require(_0xe44f('0xa'));var _=require(_0xe44f('0xb'));var squel=require(_0xe44f('0xc'));var crypto=require(_0xe44f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe44f('0xe'));var toCsv=require(_0xe44f('0x8'));var querystring=require(_0xe44f('0xf'));var Papa=require(_0xe44f('0x10'));var Redis=require(_0xe44f('0x11'));var authService=require(_0xe44f('0x12'));var qs=require(_0xe44f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe44f('0x14'));var logger=require(_0xe44f('0x15'))(_0xe44f('0x16'));var utils=require(_0xe44f('0x17'));var config=require(_0xe44f('0x18'));var licenseUtil=require(_0xe44f('0x19'));var db=require(_0xe44f('0x1a'))['db'];function respondWithStatusCode(_0x46b798,_0x4c9a07){_0x4c9a07=_0x4c9a07||0xcc;return function(_0x43620d){if(_0x43620d){return _0x46b798[_0xe44f('0x1b')](_0x4c9a07);}return _0x46b798[_0xe44f('0x1c')](_0x4c9a07)[_0xe44f('0x1d')]();};}function respondWithResult(_0x318472,_0x596ce2){_0x596ce2=_0x596ce2||0xc8;return function(_0x46a3b4){if(_0x46a3b4){return _0x318472[_0xe44f('0x1c')](_0x596ce2)['json'](_0x46a3b4);}};}function respondWithFilteredResult(_0x4279e6,_0x626c88){return function(_0x489d18){if(_0x489d18){var _0x2a5a98=typeof _0x626c88['offset']==='undefined'&&typeof _0x626c88['limit']===_0xe44f('0x1e');var _0x4a4721=_0x489d18[_0xe44f('0x1f')];var _0x413b2b=_0x2a5a98?0x0:_0x626c88[_0xe44f('0x20')];var _0x10f4f2=_0x2a5a98?_0x489d18[_0xe44f('0x1f')]:_0x626c88[_0xe44f('0x20')]+_0x626c88[_0xe44f('0x21')];var _0x11204a;if(_0x10f4f2>=_0x4a4721){_0x10f4f2=_0x4a4721;_0x11204a=0xc8;}else{_0x11204a=0xce;}_0x4279e6['status'](_0x11204a);return _0x4279e6[_0xe44f('0x22')](_0xe44f('0x23'),_0x413b2b+'-'+_0x10f4f2+'/'+_0x4a4721)['json'](_0x489d18);}return null;};}function patchUpdates(_0x1e318a){return function(_0xd8a9c3){try{jsonpatch[_0xe44f('0x24')](_0xd8a9c3,_0x1e318a,!![]);}catch(_0x5c71ec){return BPromise[_0xe44f('0x25')](_0x5c71ec);}return _0xd8a9c3['save']();};}function saveUpdates(_0x1ad876,_0x2f137f){return function(_0xbb3246){if(_0xbb3246){return _0xbb3246['update'](_0x1ad876)[_0xe44f('0x26')](function(_0x44de2f){return _0x44de2f;});}return null;};}function removeEntity(_0x1ce23d,_0x48bf35){return function(_0x326f35){if(_0x326f35){return _0x326f35[_0xe44f('0x27')]()[_0xe44f('0x26')](function(){var _0x2c7662=_0x326f35[_0xe44f('0x28')]({'plain':!![]});var _0x44ed9a=_0xe44f('0x29');return db[_0xe44f('0x2a')][_0xe44f('0x27')]({'where':{'type':_0x44ed9a,'resourceId':_0x2c7662['id']}})['then'](function(){return _0x326f35;});})['then'](function(){_0x1ce23d[_0xe44f('0x1c')](0xcc)[_0xe44f('0x1d')]();});}};}function handleEntityNotFound(_0x37b843,_0x49642b){return function(_0x2a696e){if(!_0x2a696e){_0x37b843[_0xe44f('0x1b')](0x194);}return _0x2a696e;};}function handleError(_0x15f7d9,_0x3a443c){_0x3a443c=_0x3a443c||0x1f4;return function(_0x512874){logger['error'](_0x512874[_0xe44f('0x2b')]);if(_0x512874[_0xe44f('0x2c')]){delete _0x512874[_0xe44f('0x2c')];}_0x15f7d9[_0xe44f('0x1c')](_0x3a443c)['send'](_0x512874);};}exports[_0xe44f('0x2d')]=function(_0xb311b2,_0x393aee){var _0x5b83b4={},_0x140931={},_0x3226e4={'count':0x0,'rows':[]};return db[_0xe44f('0x2e')][_0xe44f('0x2f')]()[_0xe44f('0x26')](function(_0x4a7b29){_0x140931[_0xe44f('0x30')]=_['keys'](_0x4a7b29);_0x140931[_0xe44f('0x31')]=_[_0xe44f('0x32')](_0xb311b2[_0xe44f('0x31')]);_0x140931[_0xe44f('0x33')]=_[_0xe44f('0x34')](_0x140931['model'],_0x140931[_0xe44f('0x31')]);_0x5b83b4[_0xe44f('0x35')]=_[_0xe44f('0x34')](_0x140931[_0xe44f('0x30')],qs[_0xe44f('0x36')](_0xb311b2[_0xe44f('0x31')]['fields']));_0x5b83b4[_0xe44f('0x35')]=_0x5b83b4[_0xe44f('0x35')][_0xe44f('0x37')]?_0x5b83b4[_0xe44f('0x35')]:_0x140931['model'];if(!_0xb311b2[_0xe44f('0x31')][_0xe44f('0x38')](_0xe44f('0x39'))){_0x5b83b4[_0xe44f('0x21')]=qs['limit'](_0xb311b2[_0xe44f('0x31')][_0xe44f('0x21')]);_0x5b83b4[_0xe44f('0x20')]=qs[_0xe44f('0x20')](_0xb311b2[_0xe44f('0x31')]['offset']);}_0x5b83b4[_0xe44f('0x3a')]=qs[_0xe44f('0x3b')](_0xb311b2[_0xe44f('0x31')][_0xe44f('0x3b')]);_0x5b83b4[_0xe44f('0x3c')]=qs[_0xe44f('0x33')](_[_0xe44f('0x3d')](_0xb311b2[_0xe44f('0x31')],_0x140931[_0xe44f('0x33')]),_0x4a7b29);if(_0xb311b2[_0xe44f('0x31')]['filter']){_0x5b83b4[_0xe44f('0x3c')]=_[_0xe44f('0x3e')](_0x5b83b4[_0xe44f('0x3c')],{'$or':_['map'](_0x5b83b4['attributes'],function(_0x1b5b50){var _0x4ebccb={};_0x4ebccb[_0x1b5b50]={'$like':'%'+_0xb311b2[_0xe44f('0x31')][_0xe44f('0x3f')]+'%'};return _0x4ebccb;})});}_0x5b83b4=_[_0xe44f('0x3e')]({},_0x5b83b4,_0xb311b2[_0xe44f('0x40')]);var _0x3d9528={'where':_0x5b83b4[_0xe44f('0x3c')]};return db[_0xe44f('0x2e')][_0xe44f('0x1f')](_0x3d9528)[_0xe44f('0x26')](function(_0x567cf9){_0x3226e4[_0xe44f('0x1f')]=_0x567cf9;if(_0xb311b2[_0xe44f('0x31')][_0xe44f('0x41')]){_0x5b83b4[_0xe44f('0x42')]=[{'all':!![]}];}return db[_0xe44f('0x2e')][_0xe44f('0x43')](_0x5b83b4);})[_0xe44f('0x26')](function(_0x15f2f0){_0x3226e4[_0xe44f('0x44')]=_0x15f2f0;return _0x3226e4;})[_0xe44f('0x26')](respondWithFilteredResult(_0x393aee,_0x5b83b4))[_0xe44f('0x45')](handleError(_0x393aee,null));})['catch'](handleError(_0x393aee,null));};exports[_0xe44f('0x46')]=function(_0x121175,_0x2fd308){var _0x29457d={'raw':![],'where':{'id':_0x121175[_0xe44f('0x47')]['id']}},_0x381672={};_0x381672['model']=_['keys'](db[_0xe44f('0x2e')]['rawAttributes']);_0x381672[_0xe44f('0x31')]=_[_0xe44f('0x32')](_0x121175[_0xe44f('0x31')]);_0x381672[_0xe44f('0x33')]=_[_0xe44f('0x34')](_0x381672['model'],_0x381672[_0xe44f('0x31')]);_0x29457d[_0xe44f('0x35')]=_['intersection'](_0x381672[_0xe44f('0x30')],qs[_0xe44f('0x36')](_0x121175[_0xe44f('0x31')]['fields']));_0x29457d['attributes']=_0x29457d[_0xe44f('0x35')][_0xe44f('0x37')]?_0x29457d['attributes']:_0x381672[_0xe44f('0x30')];if(_0x121175[_0xe44f('0x31')]['includeAll']){_0x29457d['include']=[{'all':!![]}];}_0x29457d=_[_0xe44f('0x3e')]({},_0x29457d,_0x121175[_0xe44f('0x40')]);return db[_0xe44f('0x2e')][_0xe44f('0x48')](_0x29457d)[_0xe44f('0x26')](handleEntityNotFound(_0x2fd308,null))['then'](respondWithResult(_0x2fd308,null))[_0xe44f('0x45')](handleError(_0x2fd308,null));};exports[_0xe44f('0x49')]=function(_0x356f81,_0x5f1cf7){return db['CmCompany'][_0xe44f('0x49')](_0x356f81[_0xe44f('0x4a')],{})['then'](function(_0x51f8c5){var _0x186edd=_0x356f81[_0xe44f('0x4b')][_0xe44f('0x28')]({'plain':!![]});if(!_0x186edd)throw new Error(_0xe44f('0x4c'));if(_0x186edd['role']===_0xe44f('0x4b')){var _0x4dd7a9=_0x51f8c5['get']({'plain':!![]});var _0xa919a9='Companies';return db[_0xe44f('0x4d')][_0xe44f('0x48')]({'where':{'name':_0xa919a9,'userProfileId':_0x186edd[_0xe44f('0x4e')]},'raw':!![]})[_0xe44f('0x26')](function(_0x304888){if(_0x304888&&_0x304888['autoAssociation']===0x0){return db[_0xe44f('0x2a')][_0xe44f('0x49')]({'name':_0x4dd7a9['name'],'resourceId':_0x4dd7a9['id'],'type':_0x304888['name'],'sectionId':_0x304888['id']},{})['then'](function(){return _0x51f8c5;});}else{return _0x51f8c5;}})['catch'](function(_0x1f474e){logger['error'](_0xe44f('0x4f'),_0x1f474e);throw _0x1f474e;});}return _0x51f8c5;})[_0xe44f('0x26')](respondWithResult(_0x5f1cf7,0xc9))['catch'](handleError(_0x5f1cf7,null));};exports[_0xe44f('0x50')]=function(_0x489e43,_0x283885){if(_0x489e43['body']['id']){delete _0x489e43[_0xe44f('0x4a')]['id'];}return db['CmCompany'][_0xe44f('0x48')]({'where':{'id':_0x489e43[_0xe44f('0x47')]['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0x283885,null))[_0xe44f('0x26')](saveUpdates(_0x489e43['body'],null))['then'](respondWithResult(_0x283885,null))['catch'](handleError(_0x283885,null));};exports['destroy']=function(_0x2183b0,_0x26509b){return db[_0xe44f('0x2e')][_0xe44f('0x48')]({'where':{'id':_0x2183b0[_0xe44f('0x47')]['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0x26509b,null))[_0xe44f('0x26')](removeEntity(_0x26509b,null))['catch'](handleError(_0x26509b,null));};exports['describe']=function(_0x577eec,_0xdea24a){return db[_0xe44f('0x2e')]['describe']()[_0xe44f('0x26')](respondWithResult(_0xdea24a,null))[_0xe44f('0x45')](handleError(_0xdea24a,null));};exports[_0xe44f('0x51')]=function(_0x2553f1,_0x203564,_0x24e06c){return db[_0xe44f('0x52')][_0xe44f('0x48')]({'where':{'id':_0x2553f1[_0xe44f('0x47')]['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0x203564,null))['then'](function(_0x3d7008){if(_0x3d7008){return _0x3d7008[_0xe44f('0x51')](_0x2553f1[_0xe44f('0x4a')][_0xe44f('0x53')],_['omit'](_0x2553f1[_0xe44f('0x4a')],[_0xe44f('0x53'),'id'])||{});}})[_0xe44f('0x26')](respondWithResult(_0x203564,null))[_0xe44f('0x45')](handleError(_0x203564,null));};exports[_0xe44f('0x54')]=function(_0x4ebd9c,_0xada767,_0x532d24){var _0x4e7245={};var _0x3d0be6={};var _0x390275;var _0x3c121b;return db['CmCompany'][_0xe44f('0x55')]({'where':{'id':_0x4ebd9c['params']['id']}})[_0xe44f('0x26')](handleEntityNotFound(_0xada767,null))[_0xe44f('0x26')](function(_0x1d5b4a){if(_0x1d5b4a){_0x390275=_0x1d5b4a;_0x3d0be6[_0xe44f('0x30')]=_[_0xe44f('0x32')](db[_0xe44f('0x52')][_0xe44f('0x56')]);_0x3d0be6[_0xe44f('0x31')]=_[_0xe44f('0x32')](_0x4ebd9c[_0xe44f('0x31')]);_0x3d0be6[_0xe44f('0x33')]=_[_0xe44f('0x34')](_0x3d0be6['model'],_0x3d0be6['query']);_0x4e7245['attributes']=_[_0xe44f('0x34')](_0x3d0be6[_0xe44f('0x30')],qs[_0xe44f('0x36')](_0x4ebd9c[_0xe44f('0x31')]['fields']));_0x4e7245[_0xe44f('0x35')]=_0x4e7245[_0xe44f('0x35')][_0xe44f('0x37')]?_0x4e7245[_0xe44f('0x35')]:_0x3d0be6[_0xe44f('0x30')];_0x4e7245[_0xe44f('0x3a')]=qs[_0xe44f('0x3b')](_0x4ebd9c['query'][_0xe44f('0x3b')]);_0x4e7245[_0xe44f('0x3c')]=qs[_0xe44f('0x33')](_[_0xe44f('0x3d')](_0x4ebd9c[_0xe44f('0x31')],_0x3d0be6[_0xe44f('0x33')]));if(_0x4ebd9c[_0xe44f('0x31')]['filter']){_0x4e7245[_0xe44f('0x3c')]=_[_0xe44f('0x3e')](_0x4e7245['where'],{'$or':_['map'](_0x4e7245[_0xe44f('0x35')],function(_0x3a6d1c){var _0x1ee973={};_0x1ee973[_0x3a6d1c]={'$like':'%'+_0x4ebd9c[_0xe44f('0x31')][_0xe44f('0x3f')]+'%'};return _0x1ee973;})});}_0x4e7245=_['merge']({},_0x4e7245,_0x4ebd9c[_0xe44f('0x40')]);return _0x390275[_0xe44f('0x54')](_0x4e7245);}})['then'](function(_0x1c61b9){if(_0x1c61b9){_0x3c121b=_0x1c61b9[_0xe44f('0x37')];if(!_0x4ebd9c[_0xe44f('0x31')][_0xe44f('0x38')]('nolimit')){_0x4e7245[_0xe44f('0x21')]=qs[_0xe44f('0x21')](_0x4ebd9c['query'][_0xe44f('0x21')]);_0x4e7245[_0xe44f('0x20')]=qs[_0xe44f('0x20')](_0x4ebd9c[_0xe44f('0x31')][_0xe44f('0x20')]);}return _0x390275['getContacts'](_0x4e7245);}})[_0xe44f('0x26')](function(_0x8de28a){if(_0x8de28a){return _0x8de28a?{'count':_0x3c121b,'rows':_0x8de28a}:null;}})[_0xe44f('0x26')](respondWithResult(_0xada767,null))[_0xe44f('0x45')](handleError(_0xada767,null));}; \ No newline at end of file +var _0xb10d=['send','index','CmCompany','describe','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','filter','map','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb10d,0x132));var _0xdb10=function(_0x10b466,_0x18194f){_0x10b466=_0x10b466-0x0;var _0x2e860a=_0xb10d[_0x10b466];return _0x2e860a;};'use strict';var emlformat=require(_0xdb10('0x0'));var rimraf=require(_0xdb10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb10('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb10('0x3'));var Mustache=require(_0xdb10('0x4'));var util=require(_0xdb10('0x5'));var path=require(_0xdb10('0x6'));var sox=require(_0xdb10('0x7'));var csv=require(_0xdb10('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb10('0x9'));var _=require('lodash');var squel=require(_0xdb10('0xa'));var crypto=require(_0xdb10('0xb'));var jsforce=require(_0xdb10('0xc'));var deskjs=require(_0xdb10('0xd'));var toCsv=require(_0xdb10('0x8'));var querystring=require('querystring');var Papa=require(_0xdb10('0xe'));var Redis=require('ioredis');var authService=require(_0xdb10('0xf'));var qs=require(_0xdb10('0x10'));var as=require(_0xdb10('0x11'));var hardwareService=require(_0xdb10('0x12'));var logger=require(_0xdb10('0x13'))(_0xdb10('0x14'));var utils=require(_0xdb10('0x15'));var config=require(_0xdb10('0x16'));var licenseUtil=require(_0xdb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39fa93,_0x1df989){_0x1df989=_0x1df989||0xcc;return function(_0x3401e0){if(_0x3401e0){return _0x39fa93[_0xdb10('0x18')](_0x1df989);}return _0x39fa93[_0xdb10('0x19')](_0x1df989)[_0xdb10('0x1a')]();};}function respondWithResult(_0x25bbed,_0x2c8df9){_0x2c8df9=_0x2c8df9||0xc8;return function(_0x4dc75d){if(_0x4dc75d){return _0x25bbed[_0xdb10('0x19')](_0x2c8df9)[_0xdb10('0x1b')](_0x4dc75d);}};}function respondWithFilteredResult(_0x168f30,_0x508824){return function(_0x5f58c0){if(_0x5f58c0){var _0x388441=typeof _0x508824['offset']===_0xdb10('0x1c')&&typeof _0x508824[_0xdb10('0x1d')]===_0xdb10('0x1c');var _0x3ef485=_0x5f58c0[_0xdb10('0x1e')];var _0x263170=_0x388441?0x0:_0x508824[_0xdb10('0x1f')];var _0x1f5f47=_0x388441?_0x5f58c0['count']:_0x508824['offset']+_0x508824[_0xdb10('0x1d')];var _0x4b3b19;if(_0x1f5f47>=_0x3ef485){_0x1f5f47=_0x3ef485;_0x4b3b19=0xc8;}else{_0x4b3b19=0xce;}_0x168f30[_0xdb10('0x19')](_0x4b3b19);return _0x168f30[_0xdb10('0x20')](_0xdb10('0x21'),_0x263170+'-'+_0x1f5f47+'/'+_0x3ef485)[_0xdb10('0x1b')](_0x5f58c0);}return null;};}function patchUpdates(_0x93883){return function(_0x44b880){try{jsonpatch[_0xdb10('0x22')](_0x44b880,_0x93883,!![]);}catch(_0x58216f){return BPromise[_0xdb10('0x23')](_0x58216f);}return _0x44b880[_0xdb10('0x24')]();};}function saveUpdates(_0x4709b4,_0x445919){return function(_0x134cfc){if(_0x134cfc){return _0x134cfc[_0xdb10('0x25')](_0x4709b4)['then'](function(_0x491161){return _0x491161;});}return null;};}function removeEntity(_0x2b31c7,_0x250810){return function(_0x577e95){if(_0x577e95){return _0x577e95[_0xdb10('0x26')]()[_0xdb10('0x27')](function(){var _0x2185b2=_0x577e95[_0xdb10('0x28')]({'plain':!![]});var _0x1e7cc7=_0xdb10('0x29');return db[_0xdb10('0x2a')][_0xdb10('0x26')]({'where':{'type':_0x1e7cc7,'resourceId':_0x2185b2['id']}})[_0xdb10('0x27')](function(){return _0x577e95;});})[_0xdb10('0x27')](function(){_0x2b31c7[_0xdb10('0x19')](0xcc)[_0xdb10('0x1a')]();});}};}function handleEntityNotFound(_0x2d6998,_0x5f0d47){return function(_0x5995cc){if(!_0x5995cc){_0x2d6998['sendStatus'](0x194);}return _0x5995cc;};}function handleError(_0x3582d5,_0x3b6d77){_0x3b6d77=_0x3b6d77||0x1f4;return function(_0x47c633){logger[_0xdb10('0x2b')](_0x47c633[_0xdb10('0x2c')]);if(_0x47c633[_0xdb10('0x2d')]){delete _0x47c633[_0xdb10('0x2d')];}_0x3582d5['status'](_0x3b6d77)[_0xdb10('0x2e')](_0x47c633);};}exports[_0xdb10('0x2f')]=function(_0x4caefd,_0x46a728){var _0x1f04b0={},_0x59e77b={},_0x2468eb={'count':0x0,'rows':[]};return db[_0xdb10('0x30')][_0xdb10('0x31')]()[_0xdb10('0x27')](function(_0x11bcb9){_0x59e77b[_0xdb10('0x32')]=_[_0xdb10('0x33')](_0x11bcb9);_0x59e77b[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0x4caefd['query']);_0x59e77b['filters']=_[_0xdb10('0x35')](_0x59e77b[_0xdb10('0x32')],_0x59e77b['query']);_0x1f04b0['attributes']=_['intersection'](_0x59e77b[_0xdb10('0x32')],qs['fields'](_0x4caefd['query'][_0xdb10('0x36')]));_0x1f04b0[_0xdb10('0x37')]=_0x1f04b0[_0xdb10('0x37')][_0xdb10('0x38')]?_0x1f04b0[_0xdb10('0x37')]:_0x59e77b['model'];if(!_0x4caefd[_0xdb10('0x34')][_0xdb10('0x39')](_0xdb10('0x3a'))){_0x1f04b0[_0xdb10('0x1d')]=qs[_0xdb10('0x1d')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x1d')]);_0x1f04b0['offset']=qs[_0xdb10('0x1f')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x1f')]);}_0x1f04b0[_0xdb10('0x3b')]=qs[_0xdb10('0x3c')](_0x4caefd[_0xdb10('0x34')][_0xdb10('0x3c')]);_0x1f04b0[_0xdb10('0x3d')]=qs[_0xdb10('0x3e')](_['pick'](_0x4caefd[_0xdb10('0x34')],_0x59e77b['filters']),_0x11bcb9);if(_0x4caefd[_0xdb10('0x34')]['filter']){_0x1f04b0[_0xdb10('0x3d')]=_[_0xdb10('0x3f')](_0x1f04b0['where'],{'$or':_['map'](_0x1f04b0['attributes'],function(_0x5b338a){var _0x1bb60e={};_0x1bb60e[_0x5b338a]={'$like':'%'+_0x4caefd[_0xdb10('0x34')]['filter']+'%'};return _0x1bb60e;})});}_0x1f04b0=_[_0xdb10('0x3f')]({},_0x1f04b0,_0x4caefd[_0xdb10('0x40')]);var _0x20261b={'where':_0x1f04b0[_0xdb10('0x3d')]};return db[_0xdb10('0x30')][_0xdb10('0x1e')](_0x20261b)['then'](function(_0x3f3009){_0x2468eb['count']=_0x3f3009;if(_0x4caefd[_0xdb10('0x34')][_0xdb10('0x41')]){_0x1f04b0[_0xdb10('0x42')]=[{'all':!![]}];}return db[_0xdb10('0x30')][_0xdb10('0x43')](_0x1f04b0);})['then'](function(_0x2d3561){_0x2468eb['rows']=_0x2d3561;return _0x2468eb;})[_0xdb10('0x27')](respondWithFilteredResult(_0x46a728,_0x1f04b0))[_0xdb10('0x44')](handleError(_0x46a728,null));})[_0xdb10('0x44')](handleError(_0x46a728,null));};exports[_0xdb10('0x45')]=function(_0x52cdc2,_0x19996d){var _0x4d2d4f={'raw':![],'where':{'id':_0x52cdc2[_0xdb10('0x46')]['id']}},_0x40ce47={};_0x40ce47[_0xdb10('0x32')]=_[_0xdb10('0x33')](db[_0xdb10('0x30')]['rawAttributes']);_0x40ce47[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0x52cdc2[_0xdb10('0x34')]);_0x40ce47[_0xdb10('0x3e')]=_[_0xdb10('0x35')](_0x40ce47[_0xdb10('0x32')],_0x40ce47['query']);_0x4d2d4f['attributes']=_[_0xdb10('0x35')](_0x40ce47[_0xdb10('0x32')],qs[_0xdb10('0x36')](_0x52cdc2['query'][_0xdb10('0x36')]));_0x4d2d4f[_0xdb10('0x37')]=_0x4d2d4f[_0xdb10('0x37')]['length']?_0x4d2d4f[_0xdb10('0x37')]:_0x40ce47['model'];if(_0x52cdc2[_0xdb10('0x34')][_0xdb10('0x41')]){_0x4d2d4f[_0xdb10('0x42')]=[{'all':!![]}];}_0x4d2d4f=_[_0xdb10('0x3f')]({},_0x4d2d4f,_0x52cdc2[_0xdb10('0x40')]);return db[_0xdb10('0x30')][_0xdb10('0x47')](_0x4d2d4f)[_0xdb10('0x27')](handleEntityNotFound(_0x19996d,null))[_0xdb10('0x27')](respondWithResult(_0x19996d,null))[_0xdb10('0x44')](handleError(_0x19996d,null));};exports[_0xdb10('0x48')]=function(_0xe83e07,_0x4553c4){return db['CmCompany'][_0xdb10('0x48')](_0xe83e07[_0xdb10('0x49')],{})[_0xdb10('0x27')](function(_0x54ae80){var _0x2c0d47=_0xe83e07[_0xdb10('0x4a')][_0xdb10('0x28')]({'plain':!![]});if(!_0x2c0d47)throw new Error(_0xdb10('0x4b'));if(_0x2c0d47[_0xdb10('0x4c')]==='user'){var _0x168148=_0x54ae80[_0xdb10('0x28')]({'plain':!![]});var _0x497a18=_0xdb10('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x497a18,'userProfileId':_0x2c0d47[_0xdb10('0x4d')]},'raw':!![]})['then'](function(_0x1eaafd){if(_0x1eaafd&&_0x1eaafd['autoAssociation']===0x0){return db[_0xdb10('0x2a')]['create']({'name':_0x168148['name'],'resourceId':_0x168148['id'],'type':_0x1eaafd[_0xdb10('0x2d')],'sectionId':_0x1eaafd['id']},{})['then'](function(){return _0x54ae80;});}else{return _0x54ae80;}})[_0xdb10('0x44')](function(_0x298687){logger[_0xdb10('0x2b')](_0xdb10('0x4e'),_0x298687);throw _0x298687;});}return _0x54ae80;})[_0xdb10('0x27')](respondWithResult(_0x4553c4,0xc9))[_0xdb10('0x44')](handleError(_0x4553c4,null));};exports['update']=function(_0x422424,_0x180e93){if(_0x422424[_0xdb10('0x49')]['id']){delete _0x422424[_0xdb10('0x49')]['id'];}return db['CmCompany'][_0xdb10('0x47')]({'where':{'id':_0x422424[_0xdb10('0x46')]['id']}})['then'](handleEntityNotFound(_0x180e93,null))['then'](saveUpdates(_0x422424[_0xdb10('0x49')],null))[_0xdb10('0x27')](respondWithResult(_0x180e93,null))['catch'](handleError(_0x180e93,null));};exports['destroy']=function(_0x5f30d1,_0x1a3f35){return db['CmCompany'][_0xdb10('0x47')]({'where':{'id':_0x5f30d1[_0xdb10('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a3f35,null))[_0xdb10('0x27')](removeEntity(_0x1a3f35,null))[_0xdb10('0x44')](handleError(_0x1a3f35,null));};exports['describe']=function(_0x226bf7,_0xf03bb0){return db[_0xdb10('0x30')][_0xdb10('0x31')]()[_0xdb10('0x27')](respondWithResult(_0xf03bb0,null))[_0xdb10('0x44')](handleError(_0xf03bb0,null));};exports[_0xdb10('0x4f')]=function(_0x55e66f,_0x7df24f,_0x454c29){return db['CmContact']['find']({'where':{'id':_0x55e66f[_0xdb10('0x46')]['id']}})[_0xdb10('0x27')](handleEntityNotFound(_0x7df24f,null))[_0xdb10('0x27')](function(_0x40a7f1){if(_0x40a7f1){return _0x40a7f1[_0xdb10('0x4f')](_0x55e66f[_0xdb10('0x49')][_0xdb10('0x50')],_[_0xdb10('0x51')](_0x55e66f[_0xdb10('0x49')],[_0xdb10('0x50'),'id'])||{});}})['then'](respondWithResult(_0x7df24f,null))[_0xdb10('0x44')](handleError(_0x7df24f,null));};exports[_0xdb10('0x52')]=function(_0xf2e7e3,_0x3a9825,_0x311812){var _0x309cea={};var _0x398685={};var _0x3bff88;var _0x9a22a5;return db[_0xdb10('0x30')][_0xdb10('0x53')]({'where':{'id':_0xf2e7e3['params']['id']}})[_0xdb10('0x27')](handleEntityNotFound(_0x3a9825,null))['then'](function(_0x5390bc){if(_0x5390bc){_0x3bff88=_0x5390bc;_0x398685['model']=_[_0xdb10('0x33')](db[_0xdb10('0x54')]['rawAttributes']);_0x398685[_0xdb10('0x34')]=_[_0xdb10('0x33')](_0xf2e7e3[_0xdb10('0x34')]);_0x398685[_0xdb10('0x3e')]=_[_0xdb10('0x35')](_0x398685[_0xdb10('0x32')],_0x398685[_0xdb10('0x34')]);_0x309cea[_0xdb10('0x37')]=_[_0xdb10('0x35')](_0x398685[_0xdb10('0x32')],qs[_0xdb10('0x36')](_0xf2e7e3[_0xdb10('0x34')]['fields']));_0x309cea['attributes']=_0x309cea[_0xdb10('0x37')][_0xdb10('0x38')]?_0x309cea[_0xdb10('0x37')]:_0x398685[_0xdb10('0x32')];_0x309cea[_0xdb10('0x3b')]=qs[_0xdb10('0x3c')](_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x3c')]);_0x309cea[_0xdb10('0x3d')]=qs['filters'](_[_0xdb10('0x55')](_0xf2e7e3[_0xdb10('0x34')],_0x398685[_0xdb10('0x3e')]));if(_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x56')]){_0x309cea[_0xdb10('0x3d')]=_[_0xdb10('0x3f')](_0x309cea[_0xdb10('0x3d')],{'$or':_[_0xdb10('0x57')](_0x309cea['attributes'],function(_0x9d0161){var _0x59e5f2={};_0x59e5f2[_0x9d0161]={'$like':'%'+_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x56')]+'%'};return _0x59e5f2;})});}_0x309cea=_[_0xdb10('0x3f')]({},_0x309cea,_0xf2e7e3[_0xdb10('0x40')]);return _0x3bff88[_0xdb10('0x52')](_0x309cea);}})['then'](function(_0x58d648){if(_0x58d648){_0x9a22a5=_0x58d648[_0xdb10('0x38')];if(!_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x39')](_0xdb10('0x3a'))){_0x309cea['limit']=qs[_0xdb10('0x1d')](_0xf2e7e3[_0xdb10('0x34')]['limit']);_0x309cea[_0xdb10('0x1f')]=qs[_0xdb10('0x1f')](_0xf2e7e3[_0xdb10('0x34')][_0xdb10('0x1f')]);}return _0x3bff88['getContacts'](_0x309cea);}})[_0xdb10('0x27')](function(_0x45e689){if(_0x45e689){return _0x45e689?{'count':_0x9a22a5,'rows':_0x45e689}:null;}})[_0xdb10('0x27')](respondWithResult(_0x3a9825,null))[_0xdb10('0x44')](handleError(_0x3a9825,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9fdc1c5..cb81716 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 _0xce7d=['path','../../config/environment','./cmCompany.attributes','exports','CmCompany','lodash','util','api','moment','bluebird','request-promise'];(function(_0x26acab,_0x515330){var _0x37c197=function(_0x42ad4f){while(--_0x42ad4f){_0x26acab['push'](_0x26acab['shift']());}};_0x37c197(++_0x515330);}(_0xce7d,0xaa));var _0xdce7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce7d[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xdce7('0x0'));var util=require(_0xdce7('0x1'));var logger=require('../../config/logger')(_0xdce7('0x2'));var moment=require(_0xdce7('0x3'));var BPromise=require(_0xdce7('0x4'));var rp=require(_0xdce7('0x5'));var fs=require('fs');var path=require(_0xdce7('0x6'));var rimraf=require('rimraf');var config=require(_0xdce7('0x7'));var attributes=require(_0xdce7('0x8'));module[_0xdce7('0x9')]=function(_0x125ed2,_0x2d788f){return _0x125ed2['define'](_0xdce7('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3446=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x26c11f,_0x196f33){var _0x4ca44b=function(_0x215c31){while(--_0x215c31){_0x26c11f['push'](_0x26c11f['shift']());}};_0x4ca44b(++_0x196f33);}(_0x3446,0x152));var _0x6344=function(_0x2a98fa,_0x3ce464){_0x2a98fa=_0x2a98fa-0x0;var _0x92da7f=_0x3446[_0x2a98fa];return _0x92da7f;};'use strict';var _=require(_0x6344('0x0'));var util=require(_0x6344('0x1'));var logger=require(_0x6344('0x2'))(_0x6344('0x3'));var moment=require(_0x6344('0x4'));var BPromise=require(_0x6344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6344('0x6'));var rimraf=require(_0x6344('0x7'));var config=require(_0x6344('0x8'));var attributes=require('./cmCompany.attributes');module[_0x6344('0x9')]=function(_0x5a70ba,_0x135c16){return _0x5a70ba['define'](_0x6344('0xa'),attributes,{'tableName':_0x6344('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 339e635..3d87399 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 _0xaaf0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1007b3,_0x344f7f){var _0x7cf215=function(_0x5e25a0){while(--_0x5e25a0){_0x1007b3['push'](_0x1007b3['shift']());}};_0x7cf215(++_0x344f7f);}(_0xaaf0,0x15a));var _0x0aaf=function(_0x68d16a,_0x24d5af){_0x68d16a=_0x68d16a-0x0;var _0x5d2ad5=_0xaaf0[_0x68d16a];return _0x5d2ad5;};'use strict';var _=require(_0x0aaf('0x0'));var util=require('util');var moment=require(_0x0aaf('0x1'));var BPromise=require(_0x0aaf('0x2'));var rs=require(_0x0aaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0aaf('0x4'))['db'];var utils=require(_0x0aaf('0x5'));var logger=require(_0x0aaf('0x6'))(_0x0aaf('0x7'));var config=require(_0x0aaf('0x8'));var jayson=require(_0x0aaf('0x9'));var client=jayson[_0x0aaf('0xa')][_0x0aaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7c94,_0x3f1fdf,_0x4c2bde){return new BPromise(function(_0x4f4f6b,_0x496f5e){return client['request'](_0x1e7c94,_0x4c2bde)[_0x0aaf('0xc')](function(_0x3b1155){logger[_0x0aaf('0xd')](_0x0aaf('0xe'),_0x3f1fdf,_0x0aaf('0xf'));logger[_0x0aaf('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3f1fdf,'request\x20sent',JSON[_0x0aaf('0x11')](_0x3b1155));if(_0x3b1155[_0x0aaf('0x12')]){if(_0x3b1155[_0x0aaf('0x12')][_0x0aaf('0x13')]===0x1f4){logger[_0x0aaf('0x12')](_0x0aaf('0xe'),_0x3f1fdf,_0x3b1155['error'][_0x0aaf('0x14')]);return _0x496f5e(_0x3b1155[_0x0aaf('0x12')][_0x0aaf('0x14')]);}logger[_0x0aaf('0x12')](_0x0aaf('0xe'),_0x3f1fdf,_0x3b1155[_0x0aaf('0x12')][_0x0aaf('0x14')]);return _0x4f4f6b(_0x3b1155[_0x0aaf('0x12')][_0x0aaf('0x14')]);}else{logger[_0x0aaf('0xd')](_0x0aaf('0xe'),_0x3f1fdf,_0x0aaf('0xf'));_0x4f4f6b(_0x3b1155[_0x0aaf('0x15')][_0x0aaf('0x14')]);}})['catch'](function(_0x359b3e){logger['error'](_0x0aaf('0xe'),_0x3f1fdf,_0x359b3e);_0x496f5e(_0x359b3e);});});} \ No newline at end of file +var _0x4166=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x4166,0x82));var _0x6416=function(_0x2cad67,_0x30a165){_0x2cad67=_0x2cad67-0x0;var _0x557943=_0x4166[_0x2cad67];return _0x557943;};'use strict';var _=require(_0x6416('0x0'));var util=require('util');var moment=require(_0x6416('0x1'));var BPromise=require(_0x6416('0x2'));var rs=require(_0x6416('0x3'));var fs=require('fs');var Redis=require(_0x6416('0x4'));var db=require(_0x6416('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6416('0x6'))(_0x6416('0x7'));var config=require(_0x6416('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6416('0x9')][_0x6416('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a683,_0x5169ea,_0x180660){return new BPromise(function(_0x2e68ef,_0x99a990){return client[_0x6416('0xb')](_0x54a683,_0x180660)[_0x6416('0xc')](function(_0x2e72a3){logger[_0x6416('0xd')](_0x6416('0xe'),_0x5169ea,_0x6416('0xf'));logger['debug'](_0x6416('0x10'),_0x5169ea,_0x6416('0xf'),JSON['stringify'](_0x2e72a3));if(_0x2e72a3[_0x6416('0x11')]){if(_0x2e72a3['error']['code']===0x1f4){logger[_0x6416('0x11')](_0x6416('0xe'),_0x5169ea,_0x2e72a3[_0x6416('0x11')]['message']);return _0x99a990(_0x2e72a3[_0x6416('0x11')]['message']);}logger[_0x6416('0x11')](_0x6416('0xe'),_0x5169ea,_0x2e72a3[_0x6416('0x11')][_0x6416('0x12')]);return _0x2e68ef(_0x2e72a3[_0x6416('0x11')][_0x6416('0x12')]);}else{logger[_0x6416('0xd')](_0x6416('0xe'),_0x5169ea,_0x6416('0xf'));_0x2e68ef(_0x2e72a3['result'][_0x6416('0x12')]);}})[_0x6416('0x13')](function(_0x382a0d){logger[_0x6416('0x11')]('CmCompany,\x20%s,\x20%s',_0x5169ea,_0x382a0d);_0x99a990(_0x382a0d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3e9dea6..d966745 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 _0x0858=['../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','get','/:id','/:id/contacts','getContacts','post','create','addContacts','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x42a08d,_0x135393){var _0x4418a0=function(_0x3d49c3){while(--_0x3d49c3){_0x42a08d['push'](_0x42a08d['shift']());}};_0x4418a0(++_0x135393);}(_0x0858,0x1f3));var _0x8085=function(_0x30e2ac,_0x569e21){_0x30e2ac=_0x30e2ac-0x0;var _0x4eaac5=_0x0858[_0x30e2ac];return _0x4eaac5;};'use strict';var multer=require('multer');var util=require(_0x8085('0x0'));var path=require('path');var timeout=require(_0x8085('0x1'));var express=require(_0x8085('0x2'));var router=express[_0x8085('0x3')]();var fs_extra=require(_0x8085('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8085('0x5'));var config=require(_0x8085('0x6'));var controller=require(_0x8085('0x7'));router['get']('/',auth[_0x8085('0x8')](),controller[_0x8085('0x9')]);router['get'](_0x8085('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8085('0xb')](_0x8085('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8085('0xd'),auth[_0x8085('0x8')](),controller[_0x8085('0xe')]);router[_0x8085('0xf')]('/',auth[_0x8085('0x8')](),controller[_0x8085('0x10')]);router[_0x8085('0xf')](_0x8085('0xd'),auth['isAuthenticated'](),controller[_0x8085('0x11')]);router['put'](_0x8085('0xc'),auth[_0x8085('0x8')](),controller[_0x8085('0x12')]);router['delete']('/:id',auth[_0x8085('0x8')](),controller[_0x8085('0x13')]);module[_0x8085('0x14')]=router; \ No newline at end of file +var _0xa551=['isAuthenticated','describe','show','/:id/contacts','post','addContacts','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa551,0x16a));var _0x1a55=function(_0x308b8e,_0x3de00c){_0x308b8e=_0x308b8e-0x0;var _0x308324=_0xa551[_0x308b8e];return _0x308324;};'use strict';var multer=require(_0x1a55('0x0'));var util=require(_0x1a55('0x1'));var path=require('path');var timeout=require(_0x1a55('0x2'));var express=require(_0x1a55('0x3'));var router=express[_0x1a55('0x4')]();var fs_extra=require(_0x1a55('0x5'));var auth=require(_0x1a55('0x6'));var interaction=require(_0x1a55('0x7'));var config=require(_0x1a55('0x8'));var controller=require(_0x1a55('0x9'));router[_0x1a55('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a55('0xa')](_0x1a55('0xb'),auth[_0x1a55('0xc')](),controller[_0x1a55('0xd')]);router[_0x1a55('0xa')]('/:id',auth[_0x1a55('0xc')](),controller[_0x1a55('0xe')]);router[_0x1a55('0xa')](_0x1a55('0xf'),auth[_0x1a55('0xc')](),controller['getContacts']);router[_0x1a55('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1a55('0xf'),auth['isAuthenticated'](),controller[_0x1a55('0x11')]);router[_0x1a55('0x12')](_0x1a55('0x13'),auth[_0x1a55('0xc')](),controller['update']);router['delete'](_0x1a55('0x13'),auth['isAuthenticated'](),controller[_0x1a55('0x14')]);module[_0x1a55('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 61ee788..bae8f72 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 _0xb862=['sequelize','exports','STRING','TEXT','INTEGER','NOW','lodash'];(function(_0x19df44,_0x547d23){var _0x4ab54e=function(_0x3d4d21){while(--_0x3d4d21){_0x19df44['push'](_0x19df44['shift']());}};_0x4ab54e(++_0x547d23);}(_0xb862,0xb5));var _0x2b86=function(_0xdf4f84,_0x537715){_0xdf4f84=_0xdf4f84-0x0;var _0x23e1f4=_0xb862[_0xdf4f84];return _0x23e1f4;};'use strict';var _=require(_0x2b86('0x0'));var Sequelize=require(_0x2b86('0x1'));module[_0x2b86('0x2')]={'firstName':{'type':Sequelize[_0x2b86('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x2b86('0x3')]},'street':{'type':Sequelize[_0x2b86('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x2b86('0x3')]},'country':{'type':Sequelize[_0x2b86('0x3')]},'dateOfBirth':{'type':Sequelize[_0x2b86('0x3')]},'description':{'type':Sequelize[_0x2b86('0x4')]},'phone':{'type':Sequelize[_0x2b86('0x3')]},'mobile':{'type':Sequelize[_0x2b86('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2b86('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x2b86('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x2b86('0x3')]},'teams':{'type':Sequelize[_0x2b86('0x3')]},'viber':{'type':Sequelize[_0x2b86('0x3')]},'line':{'type':Sequelize[_0x2b86('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x2b86('0x3')]},'UserId':{'type':Sequelize[_0x2b86('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x2b86('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2b86('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2b86('0x5')]}}; \ No newline at end of file +var _0x54da=['UNSIGNED','NOW','INTEGER','sequelize','exports','STRING','TEXT'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x54da,0x106));var _0xa54d=function(_0x5699e7,_0xb9ca23){_0x5699e7=_0x5699e7-0x0;var _0x1e8559=_0x54da[_0x5699e7];return _0x1e8559;};'use strict';var _=require('lodash');var Sequelize=require(_0xa54d('0x0'));module[_0xa54d('0x1')]={'firstName':{'type':Sequelize[_0xa54d('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa54d('0x2')]},'street':{'type':Sequelize[_0xa54d('0x2')]},'postalCode':{'type':Sequelize[_0xa54d('0x2')]},'city':{'type':Sequelize[_0xa54d('0x2')]},'country':{'type':Sequelize[_0xa54d('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa54d('0x2')]},'description':{'type':Sequelize[_0xa54d('0x3')]},'phone':{'type':Sequelize[_0xa54d('0x2')]},'mobile':{'type':Sequelize[_0xa54d('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa54d('0x2')]},'url':{'type':Sequelize[_0xa54d('0x2')]},'facebook':{'type':Sequelize[_0xa54d('0x2')]},'fb_data':{'type':Sequelize[_0xa54d('0x2')]},'twitter':{'type':Sequelize[_0xa54d('0x2')]},'skype':{'type':Sequelize[_0xa54d('0x2')]},'teams':{'type':Sequelize[_0xa54d('0x2')]},'viber':{'type':Sequelize[_0xa54d('0x2')]},'line':{'type':Sequelize[_0xa54d('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa54d('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa54d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa54d('0x5')]},'dialTimezone':{'type':Sequelize[_0xa54d('0x2')]},'utcOffset':{'type':Sequelize[_0xa54d('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f239c51..f145c5e 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 _0x1c1d=['findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Owner','browserName','customerIp','deviceModel','ratingMessage','ratingValue','substatus','Interaction','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','getOptions','findAll','query','user','catch','describe','CmContact','tags','keys','length','startsWith','cf_','columnName','CmCustomField','displayName','alias','values','info','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','findOrCreate','spread','contact','show','params','color','tag','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','ListId','omit','map','cf_%d','find','$and','pickBy','format','isEmpty','setFields','id\x20=\x20?','toParam','phone','findOne','model','Tag','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','getTags','setTags','ids','setAdditionalPhones','all','OrderBy','item_types','items','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','stringify','message','pid','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC'];(function(_0x2bb803,_0x1aa3fd){var _0x50a5ee=function(_0x4ca0e0){while(--_0x4ca0e0){_0x2bb803['push'](_0x2bb803['shift']());}};_0x50a5ee(++_0x1aa3fd);}(_0x1c1d,0x112));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xd1c1('0x0'));var BPromise=require(_0xd1c1('0x1'));var util=require(_0xd1c1('0x2'));var path=require(_0xd1c1('0x3'));var fs=require('fs');var _=require(_0xd1c1('0x4'));var squel=require(_0xd1c1('0x5'));var Papa=require(_0xd1c1('0x6'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0xd1c1('0x7'));var logger=require(_0xd1c1('0x8'))(_0xd1c1('0x9'));var config=require(_0xd1c1('0xa'));var shared=require(_0xd1c1('0xb'));var db=require(_0xd1c1('0xc'))['db'];config[_0xd1c1('0xd')]=_[_0xd1c1('0xe')](config[_0xd1c1('0xd')],{'host':_0xd1c1('0xf'),'port':0x18eb});var socket=require(_0xd1c1('0x10'))(new Redis(config[_0xd1c1('0xd')]));require('./cmContact.socket')[_0xd1c1('0x11')](socket);function respondWithResult(_0x2f5839,_0x3a5cb3){_0x3a5cb3=_0x3a5cb3||0xc8;return function(_0x46c965){if(_0x46c965){return _0x2f5839[_0xd1c1('0x12')](_0x3a5cb3)[_0xd1c1('0x13')](_0x46c965);}};}function respondWithFilteredResult(_0x2395f1,_0xcf8b45){return function(_0x471369){if(_0x471369){var _0x48b29d=typeof _0xcf8b45[_0xd1c1('0x14')]===_0xd1c1('0x15')&&typeof _0xcf8b45['limit']===_0xd1c1('0x15');var _0x435e85=_0x471369[_0xd1c1('0x16')];var _0x5cbaa3=_0x48b29d?0x0:_0xcf8b45[_0xd1c1('0x14')];var _0xe25407=_0x48b29d?_0x471369[_0xd1c1('0x16')]:_0xcf8b45[_0xd1c1('0x14')]+_0xcf8b45[_0xd1c1('0x17')];var _0x3badc5;if(_0xe25407>=_0x435e85){_0xe25407=_0x435e85;_0x3badc5=0xc8;}else{_0x3badc5=0xce;}_0x2395f1[_0xd1c1('0x12')](_0x3badc5);return _0x2395f1[_0xd1c1('0x18')](_0xd1c1('0x19'),_0x5cbaa3+'-'+_0xe25407+'/'+_0x435e85)[_0xd1c1('0x13')](_0x471369);}return null;};}function saveUpdates(_0x5323f4){return function(_0x153db9){if(_0x153db9){return _0x153db9[_0xd1c1('0x1a')](_0x5323f4)[_0xd1c1('0x1b')](function(_0x21f114){return _0x21f114;});}return null;};}function removeEntity(_0x23b51a){return function(_0x182478){if(_0x182478){return _0x182478[_0xd1c1('0x1c')]()[_0xd1c1('0x1b')](function(){_0x23b51a[_0xd1c1('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a6eb9){return function(_0x2dcbf3){if(!_0x2dcbf3){_0x3a6eb9[_0xd1c1('0x1d')](0x194);}return _0x2dcbf3;};}function handleError(_0x552ecc,_0x376a76){_0x376a76=_0x376a76||0x1f4;return function(_0x583e7b){logger[_0xd1c1('0x1e')](_0x583e7b[_0xd1c1('0x1f')]);if(_0x583e7b[_0xd1c1('0x20')]){delete _0x583e7b['name'];}_0x552ecc[_0xd1c1('0x12')](_0x376a76)[_0xd1c1('0x21')](_0x583e7b);};}exports[_0xd1c1('0x22')]=function(_0x257e82,_0x569d2e){var _0x5864a5={};return contacts['describe']()[_0xd1c1('0x1b')](function(_0x4fc2c7){_0x5864a5=qs[_0xd1c1('0x23')](_0x4fc2c7,_0x257e82);return contacts[_0xd1c1('0x24')](_0x257e82[_0xd1c1('0x25')],_0x257e82[_0xd1c1('0x26')],_0x5864a5,_0x4fc2c7);})[_0xd1c1('0x1b')](respondWithFilteredResult(_0x569d2e,_0x5864a5))['catch'](handleError(_0x569d2e,null));};exports['destroy']=function(_0x29b39b,_0x2d98ae){return db['CmContact']['find']({'where':{'id':_0x29b39b['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x2d98ae,null))[_0xd1c1('0x1b')](removeEntity(_0x2d98ae,null))[_0xd1c1('0x27')](handleError(_0x2d98ae,null));};exports[_0xd1c1('0x28')]=function(_0x4a32cd,_0x2897ee){return db[_0xd1c1('0x29')][_0xd1c1('0x28')]()[_0xd1c1('0x1b')](function(_0x18c327){delete _0x18c327[_0xd1c1('0x2a')];for(var _0x46ba25=0x0;_0x46ba250x0){return new Promise(function(_0x27ef81){var _0x52d472=[];for(var _0x1c8123=0x0;_0x1c8123<_0x4dc8f6[_0xd1c1('0x2c')];_0x1c8123++){_0x52d472[_0xd1c1('0x5f')](insertAdditionalPhones(_0x4dc8f6[_0x1c8123][_0xd1c1('0x62')],_0x4dc8f6[_0x1c8123][_0xd1c1('0x5b')]));}Promise['all'](_0x52d472)[_0xd1c1('0x1b')](function(){_0x27ef81(0x1);});})['then'](function(){return{'success':_0x28bf4c,'failure':_0x399242,'duplicates':_0x59d7a4};});}else{return{'success':_0x28bf4c,'failure':_0x399242,'duplicates':_0x59d7a4};}}})[_0xd1c1('0x1b')](respondWithResult(_0x35e80b,0xc9))[_0xd1c1('0x27')](handleError(_0x35e80b,null));};exports[_0xd1c1('0x63')]=function(_0x54a875,_0x64265a){var _0x2cf69e;return db[_0xd1c1('0x29')][_0xd1c1('0x28')]()['then'](function(_0x36b257){return db[_0xd1c1('0x29')]['find']({'where':{'id':_0x54a875[_0xd1c1('0x64')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd1c1('0x20'),_0xd1c1('0x65')],'required':_0x54a875['query'][_0xd1c1('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x54a875[_0xd1c1('0x64')]['id']},'required':![],'include':[{'model':db[_0xd1c1('0x67')],'as':_0xd1c1('0x68')}]}],'order':[db[_0xd1c1('0x69')][_0xd1c1('0x6a')](_0xd1c1('0x6b'))],'attributes':_[_0xd1c1('0x2b')](_0x36b257)});})[_0xd1c1('0x1b')](function(_0x497ced){if(!_[_0xd1c1('0x57')](_0x497ced)){_0x2cf69e=_0x497ced[_0xd1c1('0x3a')]({'plain':!![]});var _0x5d1219={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x497ced&&_0x497ced[_0xd1c1('0x6c')]){if(_0x497ced[_0xd1c1('0x6c')]){_0x5d1219['where']['$and'][_0xd1c1('0x5f')]({'ListId':{'$ne':_0x497ced[_0xd1c1('0x6c')]}});}}return db['CmCustomField'][_0xd1c1('0x24')](_0x5d1219);}})[_0xd1c1('0x1b')](function(_0x557e0e){if(!_[_0xd1c1('0x57')](_0x557e0e)){return _[_0xd1c1('0x6d')](_0x2cf69e,_[_0xd1c1('0x6e')](_0x557e0e,function(_0x130a34){return util['format'](_0xd1c1('0x6f'),_0x130a34['id']);}));}})['then'](handleEntityNotFound(_0x64265a,null))[_0xd1c1('0x1b')](respondWithResult(_0x64265a,null))['catch'](handleError(_0x64265a,null));};exports['update']=function(_0x3cd0b7,_0x2d7465){var _0x3e7142;if(_0x3cd0b7['body']['id']){delete _0x3cd0b7[_0xd1c1('0x38')]['id'];}if(!_[_0xd1c1('0x57')](_0x3cd0b7[_0xd1c1('0x38')]['dialTimezone'])){var _0x34194e=_0x3cd0b7[_0xd1c1('0x38')][_0xd1c1('0x58')];if(!_[_0xd1c1('0x57')](shared[_0xd1c1('0x59')][_0x34194e]))_0x3cd0b7[_0xd1c1('0x38')]['utcOffset']=shared[_0xd1c1('0x59')][_0x34194e][_0xd1c1('0x5a')];}return db[_0xd1c1('0x29')][_0xd1c1('0x70')]({'where':{'id':_0x3cd0b7['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x2d7465,null))['then'](saveUpdates(_0x3cd0b7[_0xd1c1('0x38')],null))[_0xd1c1('0x1b')](function(_0x53aa8e){_0x3e7142=_0x53aa8e;var _0x59006f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x53aa8e&&_0x53aa8e[_0xd1c1('0x6c')]){if(_0x53aa8e['ListId']){_0x59006f[_0xd1c1('0x5d')][_0xd1c1('0x71')][_0xd1c1('0x5f')]({'ListId':{'$ne':_0x53aa8e[_0xd1c1('0x6c')]}});}}return db[_0xd1c1('0x30')][_0xd1c1('0x24')](_0x59006f);})[_0xd1c1('0x1b')](function(_0x5537b4){if(_0x5537b4){return _['omit'](_[_0xd1c1('0x72')](_0x3cd0b7[_0xd1c1('0x38')],function(_0x240434,_0x3869f7){return _[_0xd1c1('0x2d')](_0x3869f7,_0xd1c1('0x2e'));}),_[_0xd1c1('0x6e')](_0x5537b4,function(_0x2d55c2){return util[_0xd1c1('0x73')](_0xd1c1('0x6f'),_0x2d55c2['id']);}));}})['then'](function(_0x129570){if(_0x129570&&!_[_0xd1c1('0x74')](_0x129570)){var _0x512658=squel['update']()['table']('cm_contacts')[_0xd1c1('0x75')](_0x129570)[_0xd1c1('0x5d')](_0xd1c1('0x76'),_0x3cd0b7[_0xd1c1('0x64')]['id'])[_0xd1c1('0x77')]();return db['sequelize'][_0xd1c1('0x25')](_0x512658['text'],{'replacements':_0x512658['values']});}})[_0xd1c1('0x1b')](function(){if(_0x3cd0b7[_0xd1c1('0x38')][_0xd1c1('0x78')]&&_0x3e7142){return db[_0xd1c1('0x3e')][_0xd1c1('0x1a')]({'phone':_0x3cd0b7[_0xd1c1('0x38')][_0xd1c1('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x3e7142['id']}});}})[_0xd1c1('0x1b')](function(){return _0x3e7142;})[_0xd1c1('0x1b')](respondWithResult(_0x2d7465,null))[_0xd1c1('0x27')](handleError(_0x2d7465,null));};exports['getTags']=function(_0x393194,_0x41bd2e){var _0x536860={};var _0x35605f={};var _0x7a2628;var _0xf0796a;return db['CmContact'][_0xd1c1('0x79')]({'where':{'id':_0x393194['params']['id']}})['then'](handleEntityNotFound(_0x41bd2e,null))['then'](function(_0x71ae29){if(_0x71ae29){_0x7a2628=_0x71ae29;_0x35605f[_0xd1c1('0x7a')]=_[_0xd1c1('0x2b')](db[_0xd1c1('0x7b')][_0xd1c1('0x7c')]);_0x35605f[_0xd1c1('0x25')]=_[_0xd1c1('0x2b')](_0x393194[_0xd1c1('0x25')]);_0x35605f[_0xd1c1('0x7d')]=_[_0xd1c1('0x7e')](_0x35605f[_0xd1c1('0x7a')],_0x35605f[_0xd1c1('0x25')]);_0x536860[_0xd1c1('0x7f')]=_[_0xd1c1('0x7e')](_0x35605f[_0xd1c1('0x7a')],qs[_0xd1c1('0x80')](_0x393194[_0xd1c1('0x25')][_0xd1c1('0x80')]));_0x536860[_0xd1c1('0x7f')]=_0x536860['attributes'][_0xd1c1('0x2c')]?_0x536860[_0xd1c1('0x7f')]:_0x35605f[_0xd1c1('0x7a')];_0x536860[_0xd1c1('0x81')]=qs[_0xd1c1('0x82')](_0x393194[_0xd1c1('0x25')][_0xd1c1('0x82')]);_0x536860[_0xd1c1('0x5d')]=qs[_0xd1c1('0x7d')](_[_0xd1c1('0x83')](_0x393194[_0xd1c1('0x25')],_0x35605f[_0xd1c1('0x7d')]));if(_0x393194[_0xd1c1('0x25')][_0xd1c1('0x84')]){_0x536860[_0xd1c1('0x5d')]=_['merge'](_0x536860[_0xd1c1('0x5d')],{'$or':_['map'](_0x536860[_0xd1c1('0x7f')],function(_0x39bbf5){var _0x832814={};_0x832814[_0x39bbf5]={'$like':'%'+_0x393194[_0xd1c1('0x25')]['filter']+'%'};return _0x832814;})});}_0x536860=_[_0xd1c1('0x37')]({},_0x536860,_0x393194[_0xd1c1('0x85')]);return _0x7a2628[_0xd1c1('0x86')](_0x536860);}})['then'](function(_0x48b3e0){if(_0x48b3e0){_0xf0796a=_0x48b3e0[_0xd1c1('0x2c')];if(!_0x393194[_0xd1c1('0x25')]['hasOwnProperty']('nolimit')){_0x536860[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0x393194['query'][_0xd1c1('0x17')]);_0x536860['offset']=qs['offset'](_0x393194['query'][_0xd1c1('0x14')]);}return _0x7a2628[_0xd1c1('0x86')](_0x536860);}})[_0xd1c1('0x1b')](function(_0x4f8b51){if(_0x4f8b51){return _0x4f8b51?{'count':_0xf0796a,'rows':_0x4f8b51}:null;}})[_0xd1c1('0x1b')](respondWithResult(_0x41bd2e,null))[_0xd1c1('0x27')](handleError(_0x41bd2e,null));};exports['setTags']=function(_0x3d8c3c,_0x30912f){if(_0x3d8c3c[_0xd1c1('0x38')]['id']){delete _0x3d8c3c['body']['id'];}return db[_0xd1c1('0x29')][_0xd1c1('0x79')]({'where':{'id':_0x3d8c3c['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x30912f,null))[_0xd1c1('0x1b')](function(_0x4ee1ae){if(_0x4ee1ae){return _0x4ee1ae[_0xd1c1('0x87')](_0x3d8c3c[_0xd1c1('0x38')][_0xd1c1('0x88')]||[]);}return null;})['then'](respondWithResult(_0x30912f,null))[_0xd1c1('0x27')](handleError(_0x30912f,null));};exports[_0xd1c1('0x89')]=function(_0x1da38b,_0x39531b){var _0xf17ed9=[];_0xf17ed9['push'](addAdditionalPhones(_0x1da38b[_0xd1c1('0x38')]));Promise[_0xd1c1('0x8a')](_0xf17ed9)[_0xd1c1('0x1b')](function(){_0xf17ed9=[];_0xf17ed9['push'](deleteCmHopperPhones(_0x1da38b[_0xd1c1('0x38')]['id']));_0xf17ed9[_0xd1c1('0x5f')](addCmHopperPhones(_0x1da38b[_0xd1c1('0x38')]['id']));Promise['all'](_0xf17ed9)[_0xd1c1('0x1b')](function(){return[0x1];})[_0xd1c1('0x1b')](respondWithResult(_0x39531b,null));});};function addAdditionalPhones(_0x5f4ed7){var _0x2a7049;return new Promise(function(_0x1cce71){return db[_0xd1c1('0x4c')][_0xd1c1('0x1c')]({'where':{'CmContactId':_0x5f4ed7['id']}})[_0xd1c1('0x1b')](function(){db['ContactItemType'][_0xd1c1('0x24')]({'raw':!![],'attributes':['id',_0xd1c1('0x8b')]})[_0xd1c1('0x1b')](function(_0x220ab3){var _0x3f9eab=[];for(var _0x4327ba=0x0;_0x4327ba<_0x5f4ed7['items'][_0xd1c1('0x2c')];_0x4327ba++){var _0x5b87bf=_0x5f4ed7['item_types']?_[_0xd1c1('0x57')](_0x5f4ed7['item_types'][_0x4327ba])?'':_0x5f4ed7[_0xd1c1('0x8c')][_0x4327ba]:_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba][_0xd1c1('0x8e')]?_0x5f4ed7['items'][_0x4327ba]['ItemTypeId']:'';var _0x5c6991=_[_0xd1c1('0x57')](_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba][_0xd1c1('0x8f')])?'':_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba][_0xd1c1('0x8f')];var _0x4eafa8=_0x5b87bf+':'+_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba]['phone']+'§'+_0x5c6991;if(_['isNil'](_0x2a7049))_0x2a7049=_0x4eafa8;else _0x2a7049+=';'+_0x4eafa8;var _0x292128=null;var _0x4ba407=null;if(_0x5f4ed7['item_types']){if(!_[_0xd1c1('0x57')](_0x5f4ed7[_0xd1c1('0x8c')][_0x4327ba])){_0x4ba407=_[_0xd1c1('0x70')](_0x220ab3,function(_0x29c715){return _0x29c715['id']===_0x5f4ed7[_0xd1c1('0x8c')][_0x4327ba];});if(!_[_0xd1c1('0x57')](_0x4ba407)){_0x292128=_0x4ba407[_0xd1c1('0x8b')];}}}else{if(!_[_0xd1c1('0x57')](_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba])){_0x4ba407=_['find'](_0x220ab3,function(_0x33f7b5){return _0x33f7b5['id']===_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba]['ItemTypeId'];});if(!_[_0xd1c1('0x57')](_0x4ba407)){_0x292128=_0x4327ba;}}}if(_[_0xd1c1('0x57')](_0x292128)){_0x292128=0x64;}_0x3f9eab[_0xd1c1('0x5f')](addAdditionalPhone(_0x5f4ed7['id'],_0x5f4ed7['items'][_0x4327ba]['phone'],_0x5f4ed7['item_types']?_[_0xd1c1('0x57')](_0x5f4ed7[_0xd1c1('0x8c')][_0x4327ba])?null:_0x5f4ed7[_0xd1c1('0x8c')][_0x4327ba]:_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba][_0xd1c1('0x8e')]?_0x5f4ed7[_0xd1c1('0x8d')][_0x4327ba][_0xd1c1('0x8e')]:null,_0x292128,_0x5c6991));}Promise['all'](_0x3f9eab)[_0xd1c1('0x1b')](function(){db['CmContact'][_0xd1c1('0x1a')]({'AdditionalPhones':_0x2a7049},{'where':{'id':_0x5f4ed7['id']}})['then'](function(){_0x1cce71(0x1);});});});});});}function addAdditionalPhone(_0x34e7e4,_0xc604fc,_0xe57986,_0x4c16a7,_0x2fd076){return db[_0xd1c1('0x4c')][_0xd1c1('0x70')]({'where':{'CmContactId':_0x34e7e4,'item':_0xc604fc}})[_0xd1c1('0x1b')](function(_0x78a280){if(_0x78a280)logger[_0xd1c1('0x34')]('contact\x20phone\x20exists',_0x78a280);else{db[_0xd1c1('0x4c')][_0xd1c1('0x41')]({'CmContactId':_0x34e7e4,'item':_0xc604fc,'ItemTypeId':_0xe57986,'OrderBy':_0x4c16a7,'ItemClass':_0xd1c1('0x90'),'description':_0x2fd076});}});}function deleteCmHopperPhones(_0x3f20f9){return new Promise(function(_0x50b180){return db[_0xd1c1('0x3e')][_0xd1c1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3f20f9}})[_0xd1c1('0x1b')](function(_0x1d9413){db[_0xd1c1('0x91')][_0xd1c1('0x1c')]({'where':{'CmHopperId':{'$in':_[_0xd1c1('0x6e')](_0x1d9413,'id')}}});})[_0xd1c1('0x1b')](function(){_0x50b180(0x1);});});}function addCmHopperPhones(_0x538a33){return new Promise(function(_0x5467a5){return db['CmHopper'][_0xd1c1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x538a33}})['then'](function(_0x2518a3){var _0x4ea6f9=[];_[_0xd1c1('0x6e')](_0x2518a3,function(_0x562f50){_0x4ea6f9['push'](createCmHopperPhone(_0x538a33,_0x562f50['id']));});Promise[_0xd1c1('0x8a')](_0x4ea6f9)[_0xd1c1('0x1b')](function(){_0x5467a5(0x1);});});});}function createCmHopperPhone(_0x383f31,_0x9ee7a6){return new Promise(function(_0x174f5a){db[_0xd1c1('0x4c')][_0xd1c1('0x24')]({'raw':!![],'attributes':[_0xd1c1('0x92'),'OrderBy'],'where':{'CmContactId':_0x383f31,'ItemClass':_0xd1c1('0x90')},'include':[{'model':db[_0xd1c1('0x67')],'attributes':[_0xd1c1('0x8b')],'as':_0xd1c1('0x68')}],'order':['OrderBy',db[_0xd1c1('0x69')][_0xd1c1('0x6a')](_0xd1c1('0x93'))]})[_0xd1c1('0x1b')](function(_0x1c4733){var _0x2cc87f=0x1;var _0x55ad8b=_[_0xd1c1('0x6e')](_0x1c4733,function(_0x46841d){_0x46841d[_0xd1c1('0x94')]=_0x9ee7a6;_0x46841d[_0xd1c1('0x78')]=_0x46841d[_0xd1c1('0x92')];_0x46841d['OrderBy']=_0x2cc87f;delete _0x46841d[_0xd1c1('0x95')];_0x2cc87f=_0x2cc87f+0x1;return _0x46841d;});return db[_0xd1c1('0x91')][_0xd1c1('0x96')](_0x55ad8b,{});})['then'](function(){_0x174f5a(0x1);});});}function insertAdditionalPhones(_0x2b8d99,_0x1fcb3a){return new Promise(function(_0x2538b8){var _0x4b36cb=[];for(var _0x43aa4a=0x0;_0x43aa4a<_0x1fcb3a[_0xd1c1('0x2c')];_0x43aa4a++){var _0x4902af=_0x1fcb3a[_0x43aa4a];_0x4b36cb['push'](parseContactItemType(_0x4902af));}Promise[_0xd1c1('0x8a')](_0x4b36cb)[_0xd1c1('0x1b')](function(){var _0x3618f3={'id':_0x2b8d99['id'],'items':_0x1fcb3a};return addAdditionalPhones(_0x3618f3)[_0xd1c1('0x1b')](function(){return addCmHopperPhones(_0x2b8d99['id']);});})[_0xd1c1('0x1b')](function(){_0x2538b8(_0x2b8d99);});});}function parseContactItemType(_0x64a132){return new Promise(function(_0x1ea390){if(_0x64a132[_0xd1c1('0x36')](_0xd1c1('0x8e'))){_0x1ea390(_0x64a132);}else{return db[_0xd1c1('0x67')][_0xd1c1('0x70')]({'where':{'name':_0x64a132[_0xd1c1('0x68')]}})[_0xd1c1('0x1b')](function(_0x55f8d2){if(_[_0xd1c1('0x57')](_0x55f8d2))_0x64a132[_0xd1c1('0x8e')]=null;else _0x64a132[_0xd1c1('0x8e')]=_0x55f8d2['id'];_0x1ea390(_0x64a132);});}});}exports[_0xd1c1('0x97')]=function(_0x47671b,_0x5ab1ca){return db[_0xd1c1('0x4c')][_0xd1c1('0x24')]({'raw':!![],'where':{'CmContactId':_0x47671b[_0xd1c1('0x64')]['id'],'ItemClass':_0xd1c1('0x90')},'include':[{'model':db[_0xd1c1('0x67')],'as':_0xd1c1('0x68')}],'order':[[_0xd1c1('0x8b')],[db['sequelize']['literal'](_0xd1c1('0x93'))]]})[_0xd1c1('0x1b')](function(_0x37c920){return _0x37c920;})['then'](respondWithResult(_0x5ab1ca,null))[_0xd1c1('0x27')](handleError(_0x5ab1ca,null));};exports['duplicateAdditionalPhones']=function(_0x3edbf1,_0x1d0f1e){return db['CmContactHasItem'][_0xd1c1('0x24')]({'raw':!![],'where':{'CmContactId':_0x3edbf1[_0xd1c1('0x38')][_0xd1c1('0x98')]}})[_0xd1c1('0x1b')](function(_0x2ebe2e){var _0x421976=_[_0xd1c1('0x6e')](_0x2ebe2e,function(_0x424dcf){_0x424dcf[_0xd1c1('0x99')]=_0x3edbf1[_0xd1c1('0x38')][_0xd1c1('0x9a')];return _0x424dcf;});return db[_0xd1c1('0x4c')]['bulkCreate'](_0x421976,{});})[_0xd1c1('0x1b')](function(){return addCmHopperPhones(_0x3edbf1[_0xd1c1('0x38')][_0xd1c1('0x9a')]);})[_0xd1c1('0x1b')](function(){return['ok'];})[_0xd1c1('0x1b')](respondWithResult(_0x1d0f1e,null))[_0xd1c1('0x27')](handleError(_0x1d0f1e,null));};exports[_0xd1c1('0x9b')]=function(_0x2bee6d,_0x1c118f){var _0x23715c=[];_0x23715c[_0xd1c1('0x5f')](createCmHopperPhone(_0x2bee6d[_0xd1c1('0x38')]['id'],_0x2bee6d[_0xd1c1('0x38')]['hopperId']));Promise[_0xd1c1('0x8a')](_0x23715c)['then'](function(){return[0x1];})[_0xd1c1('0x1b')](respondWithResult(_0x1c118f,null));};exports[_0xd1c1('0x9c')]=function(_0x414a03,_0x2a1abb){var _0x2ca20a={'raw':![],'where':{}};var _0x1ff379={};var _0x3ad8bb={'count':0x0,'rows':[]};return db['CmContact'][_0xd1c1('0x79')]({'where':{'id':_0x414a03[_0xd1c1('0x64')]['id']}})['then'](handleEntityNotFound(_0x2a1abb,null))[_0xd1c1('0x1b')](function(_0x24ed9a){if(_0x24ed9a){_0x1ff379[_0xd1c1('0x7a')]=_[_0xd1c1('0x2b')](db[_0xd1c1('0x3e')][_0xd1c1('0x7c')]);_0x1ff379['query']=_['keys'](_0x414a03[_0xd1c1('0x25')]);_0x1ff379[_0xd1c1('0x7d')]=_['intersection'](_0x1ff379[_0xd1c1('0x7a')],_0x1ff379[_0xd1c1('0x25')]);_0x2ca20a[_0xd1c1('0x7f')]=_[_0xd1c1('0x7e')](_0x1ff379[_0xd1c1('0x7a')],qs[_0xd1c1('0x80')](_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x80')]));_0x2ca20a[_0xd1c1('0x7f')]=_0x2ca20a['attributes'][_0xd1c1('0x2c')]?_0x2ca20a[_0xd1c1('0x7f')]:_0x1ff379['model'];if(!_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x36')](_0xd1c1('0x9d'))){_0x2ca20a[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x17')]);_0x2ca20a['offset']=qs['offset'](_0x414a03[_0xd1c1('0x25')]['offset']);}_0x2ca20a[_0xd1c1('0x81')]=qs['sort'](_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x82')]);_0x2ca20a[_0xd1c1('0x5d')]=qs[_0xd1c1('0x7d')](_[_0xd1c1('0x83')](_0x414a03[_0xd1c1('0x25')],_0x1ff379[_0xd1c1('0x7d')]));_0x2ca20a[_0xd1c1('0x5d')][_0xd1c1('0x9e')]=_0x24ed9a['id'];if(_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x84')]){_0x2ca20a[_0xd1c1('0x5d')]=_['merge'](_0x2ca20a[_0xd1c1('0x5d')],{'$or':_['map'](_0x2ca20a[_0xd1c1('0x7f')],function(_0x3a0ca1){var _0xe237f3={};_0xe237f3[_0x3a0ca1]={'$like':'%'+_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x84')]+'%'};return _0xe237f3;})});}_0x2ca20a=_[_0xd1c1('0x37')]({},_0x2ca20a,_0x414a03[_0xd1c1('0x85')]);return db[_0xd1c1('0x3e')]['count']({'where':_0x2ca20a[_0xd1c1('0x5d')]})[_0xd1c1('0x1b')](function(_0x5081bc){_0x3ad8bb[_0xd1c1('0x16')]=_0x5081bc;if(_0x414a03[_0xd1c1('0x25')][_0xd1c1('0x9f')]){_0x2ca20a['include']=[{'all':!![]}];}return db[_0xd1c1('0x3e')][_0xd1c1('0x24')](_0x2ca20a);})[_0xd1c1('0x1b')](function(_0x32ad6a){_0x3ad8bb[_0xd1c1('0xa0')]=_0x32ad6a;return _0x3ad8bb;});}})[_0xd1c1('0x1b')](respondWithFilteredResult(_0x2a1abb,_0x2ca20a))[_0xd1c1('0x27')](handleError(_0x2a1abb,null));};exports[_0xd1c1('0xa1')]=function(_0x4cf968,_0x4855ab){var _0x1f00e7={'raw':!![],'where':{}};var _0x5cf659={};var _0xc29b35={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x4cf968['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x4855ab,null))[_0xd1c1('0x1b')](function(_0x29f8b3){if(_0x29f8b3){_0x5cf659['model']=_[_0xd1c1('0x2b')](db[_0xd1c1('0x4e')][_0xd1c1('0x7c')]);_0x5cf659[_0xd1c1('0x25')]=_[_0xd1c1('0x2b')](_0x4cf968[_0xd1c1('0x25')]);_0x5cf659['filters']=_[_0xd1c1('0x7e')](_0x5cf659['model'],_0x5cf659[_0xd1c1('0x25')]);_0x1f00e7[_0xd1c1('0x7f')]=_[_0xd1c1('0x7e')](_0x5cf659[_0xd1c1('0x7a')],qs[_0xd1c1('0x80')](_0x4cf968['query'][_0xd1c1('0x80')]));_0x1f00e7[_0xd1c1('0x7f')]=_0x1f00e7[_0xd1c1('0x7f')][_0xd1c1('0x2c')]?_0x1f00e7['attributes']:_0x5cf659[_0xd1c1('0x7a')];if(!_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x36')](_0xd1c1('0x9d'))){_0x1f00e7[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x17')]);_0x1f00e7[_0xd1c1('0x14')]=qs['offset'](_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x14')]);}_0x1f00e7[_0xd1c1('0x81')]=qs[_0xd1c1('0x82')](_0x4cf968[_0xd1c1('0x25')]['sort']);_0x1f00e7[_0xd1c1('0x5d')]=qs[_0xd1c1('0x7d')](_[_0xd1c1('0x83')](_0x4cf968[_0xd1c1('0x25')],_0x5cf659['filters']));_0x1f00e7[_0xd1c1('0x5d')][_0xd1c1('0x9e')]=_0x29f8b3['id'];if(_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x84')]){_0x1f00e7[_0xd1c1('0x5d')]=_[_0xd1c1('0x37')](_0x1f00e7['where'],{'$or':_['map'](_0x1f00e7[_0xd1c1('0x7f')],function(_0x317e5a){var _0x4ee29a={};_0x4ee29a[_0x317e5a]={'$like':'%'+_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x84')]+'%'};return _0x4ee29a;})});}_0x1f00e7=_['merge']({},_0x1f00e7,_0x4cf968[_0xd1c1('0x85')]);return db[_0xd1c1('0x4e')][_0xd1c1('0x16')]({'where':_0x1f00e7[_0xd1c1('0x5d')]})[_0xd1c1('0x1b')](function(_0x2e9e17){_0xc29b35[_0xd1c1('0x16')]=_0x2e9e17;if(_0x4cf968[_0xd1c1('0x25')][_0xd1c1('0x9f')]){_0x1f00e7[_0xd1c1('0xa2')]=[{'all':!![]}];}return db[_0xd1c1('0x4e')][_0xd1c1('0x24')](_0x1f00e7);})['then'](function(_0x6fbffa){_0xc29b35[_0xd1c1('0xa0')]=_0x6fbffa;return _0xc29b35;});}})[_0xd1c1('0x1b')](respondWithFilteredResult(_0x4855ab,_0x1f00e7))['catch'](handleError(_0x4855ab,null));};exports[_0xd1c1('0xa3')]=function(_0xa46d00,_0x77a75f){var _0x4aff51={'raw':!![],'where':{}};var _0x447dca={};var _0x48104f={'count':0x0,'rows':[]};return db[_0xd1c1('0x29')]['findOne']({'where':{'id':_0xa46d00['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x77a75f,null))[_0xd1c1('0x1b')](function(_0x6eb1cc){if(_0x6eb1cc){_0x447dca[_0xd1c1('0x7a')]=_[_0xd1c1('0x2b')](db[_0xd1c1('0x4d')][_0xd1c1('0x7c')]);_0x447dca[_0xd1c1('0x25')]=_[_0xd1c1('0x2b')](_0xa46d00[_0xd1c1('0x25')]);_0x447dca[_0xd1c1('0x7d')]=_['intersection'](_0x447dca[_0xd1c1('0x7a')],_0x447dca[_0xd1c1('0x25')]);_0x4aff51[_0xd1c1('0x7f')]=_[_0xd1c1('0x7e')](_0x447dca[_0xd1c1('0x7a')],qs['fields'](_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x80')]));_0x4aff51[_0xd1c1('0x7f')]=_0x4aff51[_0xd1c1('0x7f')][_0xd1c1('0x2c')]?_0x4aff51[_0xd1c1('0x7f')]:_0x447dca[_0xd1c1('0x7a')];if(!_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x36')](_0xd1c1('0x9d'))){_0x4aff51[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x17')]);_0x4aff51[_0xd1c1('0x14')]=qs[_0xd1c1('0x14')](_0xa46d00[_0xd1c1('0x25')]['offset']);}_0x4aff51[_0xd1c1('0x81')]=qs['sort'](_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x82')]);_0x4aff51[_0xd1c1('0x5d')]=qs[_0xd1c1('0x7d')](_['pick'](_0xa46d00[_0xd1c1('0x25')],_0x447dca[_0xd1c1('0x7d')]));_0x4aff51[_0xd1c1('0x5d')][_0xd1c1('0x9e')]=_0x6eb1cc['id'];if(_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x84')]){_0x4aff51[_0xd1c1('0x5d')]=_[_0xd1c1('0x37')](_0x4aff51[_0xd1c1('0x5d')],{'$or':_[_0xd1c1('0x6e')](_0x4aff51['attributes'],function(_0x302519){var _0x5c0b7f={};_0x5c0b7f[_0x302519]={'$like':'%'+_0xa46d00[_0xd1c1('0x25')][_0xd1c1('0x84')]+'%'};return _0x5c0b7f;})});}_0x4aff51=_[_0xd1c1('0x37')]({},_0x4aff51,_0xa46d00[_0xd1c1('0x85')]);return db[_0xd1c1('0x4d')][_0xd1c1('0x16')]({'where':_0x4aff51['where']})[_0xd1c1('0x1b')](function(_0x13b6d7){_0x48104f[_0xd1c1('0x16')]=_0x13b6d7;if(_0xa46d00['query']['includeAll']){_0x4aff51[_0xd1c1('0xa2')]=[{'all':!![]}];}return db[_0xd1c1('0x4d')][_0xd1c1('0x24')](_0x4aff51);})[_0xd1c1('0x1b')](function(_0x225ad9){_0x48104f[_0xd1c1('0xa0')]=_0x225ad9;return _0x48104f;});}})['then'](respondWithFilteredResult(_0x77a75f,_0x4aff51))[_0xd1c1('0x27')](handleError(_0x77a75f,null));};exports[_0xd1c1('0xa4')]=function(_0x49bc94,_0x132cdf){var _0x5a0d5c={'raw':!![],'where':{}};var _0xf490a3={};var _0x5864f9={'count':0x0,'rows':[]};return db[_0xd1c1('0x29')]['findOne']({'where':{'id':_0x49bc94['params']['id']}})[_0xd1c1('0x1b')](handleEntityNotFound(_0x132cdf,null))['then'](function(_0x212b5b){if(_0x212b5b){_0xf490a3[_0xd1c1('0x7a')]=_[_0xd1c1('0x2b')](db[_0xd1c1('0x54')]['rawAttributes']);_0xf490a3['query']=_[_0xd1c1('0x2b')](_0x49bc94[_0xd1c1('0x25')]);_0xf490a3[_0xd1c1('0x7d')]=_[_0xd1c1('0x7e')](_0xf490a3[_0xd1c1('0x7a')],_0xf490a3['query']);_0x5a0d5c[_0xd1c1('0x7f')]=_[_0xd1c1('0x7e')](_0xf490a3[_0xd1c1('0x7a')],qs[_0xd1c1('0x80')](_0x49bc94[_0xd1c1('0x25')][_0xd1c1('0x80')]));_0x5a0d5c[_0xd1c1('0x7f')]=_0x5a0d5c[_0xd1c1('0x7f')]['length']?_0x5a0d5c[_0xd1c1('0x7f')]:_0xf490a3['model'];if(!_0x49bc94[_0xd1c1('0x25')]['hasOwnProperty']('nolimit')){_0x5a0d5c[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0x49bc94[_0xd1c1('0x25')]['limit']);_0x5a0d5c[_0xd1c1('0x14')]=qs[_0xd1c1('0x14')](_0x49bc94[_0xd1c1('0x25')]['offset']);}_0x5a0d5c[_0xd1c1('0x81')]=qs[_0xd1c1('0x82')](_0x49bc94[_0xd1c1('0x25')][_0xd1c1('0x82')]);_0x5a0d5c['where']=qs['filters'](_[_0xd1c1('0x83')](_0x49bc94[_0xd1c1('0x25')],_0xf490a3[_0xd1c1('0x7d')]));_0x5a0d5c[_0xd1c1('0x5d')][_0xd1c1('0x9e')]=_0x212b5b['id'];if(_0x49bc94[_0xd1c1('0x25')][_0xd1c1('0x84')]){_0x5a0d5c[_0xd1c1('0x5d')]=_[_0xd1c1('0x37')](_0x5a0d5c[_0xd1c1('0x5d')],{'$or':_['map'](_0x5a0d5c[_0xd1c1('0x7f')],function(_0x44fde7){var _0x2d3d4c={};_0x2d3d4c[_0x44fde7]={'$like':'%'+_0x49bc94['query'][_0xd1c1('0x84')]+'%'};return _0x2d3d4c;})});}_0x5a0d5c=_[_0xd1c1('0x37')]({},_0x5a0d5c,_0x49bc94[_0xd1c1('0x85')]);return db[_0xd1c1('0x54')][_0xd1c1('0x16')]({'where':_0x5a0d5c['where']})['then'](function(_0x5d7d94){_0x5864f9[_0xd1c1('0x16')]=_0x5d7d94;if(_0x49bc94[_0xd1c1('0x25')][_0xd1c1('0x9f')]){_0x5a0d5c[_0xd1c1('0xa2')]=[{'all':!![]}];}return db[_0xd1c1('0x54')][_0xd1c1('0x24')](_0x5a0d5c);})[_0xd1c1('0x1b')](function(_0x42e45c){_0x5864f9['rows']=_0x42e45c;return _0x5864f9;});}})['then'](respondWithFilteredResult(_0x132cdf,_0x5a0d5c))[_0xd1c1('0x27')](handleError(_0x132cdf,null));};exports[_0xd1c1('0xa5')]=function(_0x4560db,_0x59ac16){try{if(!_0x4560db[_0xd1c1('0x38')][_0xd1c1('0x6c')]){throw new Error(_0xd1c1('0xa6'));}if(!_0x4560db['body'][_0xd1c1('0xa7')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4560db['body'][_0xd1c1('0xa8')]){throw new Error(_0xd1c1('0xa9'));}if(!_0x4560db[_0xd1c1('0x38')][_0xd1c1('0xaa')]){throw new Error(_0xd1c1('0xab'));}var _0x2f74c0=_0x4560db[_0xd1c1('0x38')][_0xd1c1('0xa7')]['split'](',');var _0x5cfb9c=_0x4560db[_0xd1c1('0x38')][_0xd1c1('0xa8')][_0xd1c1('0xac')](',');if(!_0x2f74c0[_0xd1c1('0x2c')]||!_0x5cfb9c[_0xd1c1('0x2c')]||_0x2f74c0['length']!==_0x5cfb9c[_0xd1c1('0x2c')]){throw new Error(_0xd1c1('0xad'));}_0x4560db[_0xd1c1('0x38')]['fields']=_[_0xd1c1('0xae')](_0x2f74c0,_0x5cfb9c);if(!_0x4560db[_0xd1c1('0x38')][_0xd1c1('0x80')]['phone']){throw new Error(_0xd1c1('0xaf'));}if(!_0x4560db[_0xd1c1('0x38')][_0xd1c1('0x80')][_0xd1c1('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x564eb7=path['join'](config[_0xd1c1('0xb1')],_0xd1c1('0xb2'),_0x4560db[_0xd1c1('0xb3')][_0xd1c1('0xb4')]);fs[_0xd1c1('0xb5')](_0x564eb7,parseInt(_0xd1c1('0xb6'),0x8));var _0x19bbb3=require(_0xd1c1('0xb7'))[_0xd1c1('0xb8')](path['join'](__dirname,_0xd1c1('0xb9')),[_0x564eb7,_0x4560db['body'][_0xd1c1('0xa7')],_0x4560db[_0xd1c1('0x38')][_0xd1c1('0xa8')],_0x4560db[_0xd1c1('0x38')][_0xd1c1('0x6c')],_0x4560db['body'][_0xd1c1('0xba')],_0x4560db['body']['duplicates'],_0x4560db['body'][_0xd1c1('0xaa')]]);return _0x59ac16['status'](0xc8)[_0xd1c1('0x13')]({'message':_0xd1c1('0xbb'),'pid':_0x19bbb3['pid']});}catch(_0x6c0832){return _0x59ac16[_0xd1c1('0x12')](0x1f4)[_0xd1c1('0x21')](_0x6c0832);}};exports['upload']=function(_0x278525,_0x53b9a9){var _0x43fc82=fs['createReadStream'](_0x278525['file'][_0xd1c1('0x3')]);Papa[_0xd1c1('0xbc')](_0x43fc82,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x481736){return _0x53b9a9['status'](0xc8)[_0xd1c1('0x13')]({'file':_0x278525['file'],'fields':_0x481736[_0xd1c1('0xbd')][_0xd1c1('0x80')]});}});};exports[_0xd1c1('0xbe')]=function(_0x568d81,_0x3bf2e5){return db[_0xd1c1('0xbf')][_0xd1c1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd1c1('0xc0')}})[_0xd1c1('0x1b')](function(_0x392469){var _0x51e945=![];if(!_0x568d81[_0xd1c1('0x38')]['ListId']){throw new Error(_0xd1c1('0xa6'));}if(!_0x568d81[_0xd1c1('0x38')]['binding'][_0xd1c1('0x78')]){throw new Error(_0xd1c1('0xaf'));}if(!_0x568d81[_0xd1c1('0x38')][_0xd1c1('0xc1')][_0xd1c1('0xb0')]){throw new Error(_0xd1c1('0xc2'));}if(!_0x568d81[_0xd1c1('0x38')]['socket_timestamp']){throw new Error(_0xd1c1('0xab'));}var _0x249f5a=require(_0xd1c1('0xb7'))[_0xd1c1('0xb8')](path[_0xd1c1('0x3c')](__dirname,'../../components/import/cm/csv2'),[_0x568d81['params']['id'],JSON[_0xd1c1('0xc3')](_0x568d81['body']),JSON[_0xd1c1('0xc3')](_0x392469)]);_0x249f5a['on'](_0xd1c1('0xc4'),function(){_0x51e945=!![];return _0x3bf2e5[_0xd1c1('0x12')](0xc8)[_0xd1c1('0x13')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x249f5a[_0xd1c1('0xc5')]});});_0x249f5a['on']('exit',function(_0x5c9d8e){if(_0x5c9d8e&&!_0x51e945){return _0x3bf2e5[_0xd1c1('0x12')](0x1f4)[_0xd1c1('0x13')]({'message':'error\x20child\x20process','pid':_0x249f5a[_0xd1c1('0xc5')]});}});})[_0xd1c1('0x27')](handleError(_0x3bf2e5,null));};exports[_0xd1c1('0xc6')]=function(_0x76595c,_0x62b4d6){return db[_0xd1c1('0xbf')][_0xd1c1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x57c925){var _0x6b0712=![];if(!_0x76595c[_0xd1c1('0x38')][_0xd1c1('0x6c')]){throw new Error(_0xd1c1('0xa6'));}if(!_0x76595c[_0xd1c1('0x38')][_0xd1c1('0xc1')][_0xd1c1('0x78')]){throw new Error(_0xd1c1('0xaf'));}if(!_0x76595c[_0xd1c1('0x38')]['binding'][_0xd1c1('0xb0')]){throw new Error(_0xd1c1('0xc2'));}if(!_0x76595c['body'][_0xd1c1('0xaa')]){throw new Error(_0xd1c1('0xab'));}var _0x50bd26=require(_0xd1c1('0xb7'))['fork'](path[_0xd1c1('0x3c')](__dirname,_0xd1c1('0xc7')),[_0x76595c[_0xd1c1('0x64')]['id'],JSON['stringify'](_0x76595c[_0xd1c1('0x38')]),JSON[_0xd1c1('0xc3')](_0x57c925)]);_0x50bd26['on'](_0xd1c1('0xc4'),function(){_0x6b0712=!![];return _0x62b4d6['status'](0xc8)[_0xd1c1('0x13')]({'message':_0xd1c1('0xc8'),'pid':_0x50bd26[_0xd1c1('0xc5')]});});_0x50bd26['on'](_0xd1c1('0xc9'),function(_0xc81692){if(_0xc81692&&!_0x6b0712){return _0x62b4d6[_0xd1c1('0x12')](0x1f4)['json']({'message':_0xd1c1('0xca'),'pid':_0x50bd26[_0xd1c1('0xc5')]});}});})[_0xd1c1('0x27')](handleError(_0x62b4d6,null));};exports[_0xd1c1('0xcb')]=function(_0x9dff44,_0x4a0a2e){var _0x393471=[_0xd1c1('0xcc'),_0xd1c1('0xcd'),'sms',_0xd1c1('0xce'),'fax',_0xd1c1('0xcf'),'voice'];var _0xa922fb={'offset':0x0,'order':qs[_0xd1c1('0x82')](_0xd1c1('0xd0'))},_0x3e8ca8={'count':0x0,'rows':[]};Promise['resolve']()[_0xd1c1('0x1b')](function(){if(_0x9dff44['query'][_0xd1c1('0xd1')]){if(!_[_0xd1c1('0xd2')](_0x393471,_0x9dff44['query'][_0xd1c1('0xd1')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x393471=[_0x9dff44['query'][_0xd1c1('0xd1')][_0xd1c1('0xd3')]()];}if(_0x9dff44['query'][_0xd1c1('0xd4')]){try{var _0x27f4ba=JSON['parse'](_0x9dff44[_0xd1c1('0x25')][_0xd1c1('0xd4')]);if(!moment(_0x27f4ba[_0xd1c1('0x39')])['isValid']()){throw new Error(_0xd1c1('0xd5'));}if(!moment(_0x27f4ba['to'])[_0xd1c1('0xd6')]()){throw new Error(_0xd1c1('0xd7'));}}catch(_0x490b27){throw new Error(_0xd1c1('0xd8'));}}if(!_0x9dff44[_0xd1c1('0x25')]['hasOwnProperty']('nolimit')){_0xa922fb[_0xd1c1('0x17')]=qs[_0xd1c1('0x17')](_0x9dff44['query'][_0xd1c1('0x17')]||0xa);_0xa922fb[_0xd1c1('0x14')]=qs['offset'](_0x9dff44[_0xd1c1('0x25')][_0xd1c1('0x14')]);}var _0x4a1988=_0x393471[_0xd1c1('0x6e')](function(_0x292f0b){if(_0x292f0b===_0xd1c1('0xd9')){var _0xaa3152={'attributes':['id',_0xd1c1('0xda'),'type',_0xd1c1('0xdb'),_0xd1c1('0xdc'),'callerid',_0xd1c1('0xdd'),'endtime',_0xd1c1('0xde'),_0xd1c1('0xdf'),_0xd1c1('0xe0'),_0xd1c1('0xe1'),_0xd1c1('0xe2'),_0xd1c1('0xe3'),_0xd1c1('0xe4')],'where':{'ContactId':_0x9dff44[_0xd1c1('0x64')]['id']},'include':[{'model':db[_0xd1c1('0xbf')],'as':_0xd1c1('0xbf'),'attributes':['id','name','fullname',_0xd1c1('0x32')]}],'order':[['createdAt',_0xd1c1('0xe5')]]};if(_0x9dff44[_0xd1c1('0x25')][_0xd1c1('0xd4')]){_0xaa3152[_0xd1c1('0x5d')][_0xd1c1('0xe0')]={'$gte':_0x27f4ba[_0xd1c1('0x39')],'$lte':_0x27f4ba['to']};}return db[_0xd1c1('0x4f')][_0xd1c1('0xe6')](_0xaa3152)[_0xd1c1('0x1b')](function(_0x4d70c4){_0x3e8ca8['count']+=_0x4d70c4['count'];return _[_0xd1c1('0x6e')](_0x4d70c4['rows'],function(_0x2fccf3){var _0x268fc7=_0x2fccf3[_0xd1c1('0x3a')]({'plain':!![]});_0x268fc7[_0xd1c1('0xd1')]=_0x292f0b;if(_0x268fc7['User']){_0x268fc7['User']={'id':_0x268fc7[_0xd1c1('0xbf')]['id'],'name':_0x268fc7[_0xd1c1('0xbf')][_0xd1c1('0x20')],'fullname':_0x268fc7[_0xd1c1('0xbf')][_0xd1c1('0xe7')],'alias':_0x268fc7['User'][_0xd1c1('0x32')]};}return _0x268fc7;});});}else{var _0x25f748=_[_0xd1c1('0xe8')](_0x292f0b)+(_0x292f0b===_0xd1c1('0xcd')?_0xd1c1('0xe9'):_0xd1c1('0xea'));var _0x2bf900={'attributes':['id',_0xd1c1('0xeb'),_0xd1c1('0xec'),_0xd1c1('0xe0'),_0xd1c1('0xdf'),_0xd1c1('0xed'),_0xd1c1('0xee'),'thirdDisposition',_0xd1c1('0xe4'),_0x25f748+'Id'],'where':{'ContactId':_0x9dff44[_0xd1c1('0x64')]['id']},'include':[{'model':db[_0x25f748],'as':'Account','attributes':['id',_0xd1c1('0x20'),_0xd1c1('0xef')]},{'model':db['User'],'as':_0xd1c1('0xf0'),'attributes':['id',_0xd1c1('0x20'),'fullname']},{'model':db[_0xd1c1('0x7b')],'as':'Tags','attributes':['id',_0xd1c1('0x20'),_0xd1c1('0x65')],'through':{'attributes':[]}}],'order':[['createdAt',_0xd1c1('0xe5')]]};if(_0x9dff44[_0xd1c1('0x25')][_0xd1c1('0xd4')]){_0x2bf900['where']['createdAt']={'$gte':_0x27f4ba[_0xd1c1('0x39')],'$lte':_0x27f4ba['to']};}switch(_0x292f0b){case _0xd1c1('0xcd'):_0x2bf900[_0xd1c1('0x7f')][_0xd1c1('0x5f')](_0xd1c1('0xf1'),_0xd1c1('0xf2'),'customerPort',_0xd1c1('0xf3'),'osName',_0xd1c1('0xf4'),'ratingType',_0xd1c1('0xf5'),'referer');break;case _0xd1c1('0xcc'):_0x2bf900['attributes'][_0xd1c1('0x5f')]('subject',_0xd1c1('0xf6'));break;case _0xd1c1('0xce'):_0x2bf900[_0xd1c1('0x7f')][_0xd1c1('0x5f')]('externalUrl','threadId');break;}return db[_['startCase'](_0x292f0b)+_0xd1c1('0xf7')][_0xd1c1('0xe6')](_0x2bf900)[_0xd1c1('0x1b')](function(_0x5a1c3f){_0x3e8ca8[_0xd1c1('0x16')]+=_0x5a1c3f[_0xd1c1('0x16')];return _[_0xd1c1('0x6e')](_0x5a1c3f['rows'],function(_0x13712f){var _0x405807=_0x13712f[_0xd1c1('0x3a')]({'plain':!![]});_0x405807['channel']=_0x292f0b;if(_0x405807[_0xd1c1('0xf0')]){_0x405807['Owner']={'id':_0x405807[_0xd1c1('0xf0')]['id'],'name':_0x405807[_0xd1c1('0xf0')][_0xd1c1('0x20')],'fullname':_0x405807['Owner']['fullname']};}return _0x405807;});});}});return Promise['all'](_0x4a1988);})[_0xd1c1('0x1b')](function(_0x2d318e){return _(_0x2d318e)['flatten']()[_0xd1c1('0xf8')](_0xd1c1('0xe0'))[_0xd1c1('0xf9')]()[_0xd1c1('0xfa')]();})['then'](function(_0x1775fa){_0x3e8ca8[_0xd1c1('0xa0')]=_0xa922fb[_0xd1c1('0x17')]?_0x1775fa[_0xd1c1('0xfb')](_0xa922fb[_0xd1c1('0x14')],_0xa922fb[_0xd1c1('0x14')]+_0xa922fb['limit']):_0x1775fa;return _0x3e8ca8;})[_0xd1c1('0x1b')](respondWithFilteredResult(_0x4a0a2e,_0xa922fb))[_0xd1c1('0x27')](handleError(_0x4a0a2e,null));}; \ No newline at end of file +var _0xa8fa=['OpenchannelInteraction','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','push','where','ListId','findOrCreate','spread','hasOwnProperty','all','find','color','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','omit','format','cf_%d','isEmpty','table','toParam','sequelize','phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','sort','filters','pick','filter','map','nolimit','setTags','ids','items','item_types','ItemTypeId','description','OrderBy','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','ContactId','options','includeAll','rows','getHopperHistories','CmHopperHistory','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','server/files/tmp','file','chmodSync','0777','fork','CompanyId','pid','upload','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','child_process','stringify','message','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','sms','fax','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','findAndCountAll','fullname','startCase','chat','Account','closed','closedAt','secondDisposition','Owner','Tag','Tags','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','reverse','slice','moment','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','name','index','describe','getOptions','findAll','user','catch','params','CmContact','tags','keys','length','startsWith','cf_','columnName','displayName','query','CmCustomField','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','SmsMessage','FaxInteraction','FaxMessage'];(function(_0x560900,_0xefaf5a){var _0x399414=function(_0x388c9f){while(--_0x388c9f){_0x560900['push'](_0x560900['shift']());}};_0x399414(++_0xefaf5a);}(_0xa8fa,0x1a5));var _0xaa8f=function(_0x26cbe2,_0x21f2d3){_0x26cbe2=_0x26cbe2-0x0;var _0x231423=_0xa8fa[_0x26cbe2];return _0x231423;};'use strict';var moment=require(_0xaa8f('0x0'));var BPromise=require('bluebird');var util=require(_0xaa8f('0x1'));var path=require(_0xaa8f('0x2'));var fs=require('fs');var _=require(_0xaa8f('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xaa8f('0x4'));var contacts=require(_0xaa8f('0x5'));var qs=require(_0xaa8f('0x6'));var logger=require(_0xaa8f('0x7'))('api');var config=require(_0xaa8f('0x8'));var shared=require(_0xaa8f('0x9'));var db=require(_0xaa8f('0xa'))['db'];config[_0xaa8f('0xb')]=_['defaults'](config[_0xaa8f('0xb')],{'host':_0xaa8f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa8f('0xb')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0xa4102d,_0x21cabe){_0x21cabe=_0x21cabe||0xc8;return function(_0x7665a3){if(_0x7665a3){return _0xa4102d[_0xaa8f('0xd')](_0x21cabe)[_0xaa8f('0xe')](_0x7665a3);}};}function respondWithFilteredResult(_0x27cb56,_0x5deb31){return function(_0x1864eb){if(_0x1864eb){var _0x145c99=typeof _0x5deb31[_0xaa8f('0xf')]===_0xaa8f('0x10')&&typeof _0x5deb31[_0xaa8f('0x11')]==='undefined';var _0x14c2d3=_0x1864eb['count'];var _0x2b018c=_0x145c99?0x0:_0x5deb31[_0xaa8f('0xf')];var _0x52ec27=_0x145c99?_0x1864eb[_0xaa8f('0x12')]:_0x5deb31[_0xaa8f('0xf')]+_0x5deb31[_0xaa8f('0x11')];var _0x67606e;if(_0x52ec27>=_0x14c2d3){_0x52ec27=_0x14c2d3;_0x67606e=0xc8;}else{_0x67606e=0xce;}_0x27cb56['status'](_0x67606e);return _0x27cb56[_0xaa8f('0x13')](_0xaa8f('0x14'),_0x2b018c+'-'+_0x52ec27+'/'+_0x14c2d3)[_0xaa8f('0xe')](_0x1864eb);}return null;};}function saveUpdates(_0x23deb4){return function(_0x4d3e43){if(_0x4d3e43){return _0x4d3e43[_0xaa8f('0x15')](_0x23deb4)[_0xaa8f('0x16')](function(_0x287947){return _0x287947;});}return null;};}function removeEntity(_0x336ac5){return function(_0x18cf9f){if(_0x18cf9f){return _0x18cf9f[_0xaa8f('0x17')]()[_0xaa8f('0x16')](function(){_0x336ac5['status'](0xcc)[_0xaa8f('0x18')]();});}};}function handleEntityNotFound(_0x38f7e8){return function(_0x5c7228){if(!_0x5c7228){_0x38f7e8[_0xaa8f('0x19')](0x194);}return _0x5c7228;};}function handleError(_0x4ec3e8,_0x2a72fd){_0x2a72fd=_0x2a72fd||0x1f4;return function(_0x3a17cf){logger['error'](_0x3a17cf['stack']);if(_0x3a17cf[_0xaa8f('0x1a')]){delete _0x3a17cf['name'];}_0x4ec3e8['status'](_0x2a72fd)['send'](_0x3a17cf);};}exports[_0xaa8f('0x1b')]=function(_0x172aa6,_0x1c069f){var _0x2c97a8={};return contacts[_0xaa8f('0x1c')]()[_0xaa8f('0x16')](function(_0xe6b3d8){_0x2c97a8=qs[_0xaa8f('0x1d')](_0xe6b3d8,_0x172aa6);return contacts[_0xaa8f('0x1e')](_0x172aa6['query'],_0x172aa6[_0xaa8f('0x1f')],_0x2c97a8,_0xe6b3d8);})[_0xaa8f('0x16')](respondWithFilteredResult(_0x1c069f,_0x2c97a8))[_0xaa8f('0x20')](handleError(_0x1c069f,null));};exports['destroy']=function(_0x2dad2a,_0xce5d2f){return db['CmContact']['find']({'where':{'id':_0x2dad2a[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0xce5d2f,null))[_0xaa8f('0x16')](removeEntity(_0xce5d2f,null))[_0xaa8f('0x20')](handleError(_0xce5d2f,null));};exports[_0xaa8f('0x1c')]=function(_0x3794b5,_0x298fd9){return db[_0xaa8f('0x22')][_0xaa8f('0x1c')]()[_0xaa8f('0x16')](function(_0x9a4b54){delete _0x9a4b54[_0xaa8f('0x23')];for(var _0x59c53d=0x0;_0x59c53d0x0){return new Promise(function(_0x8f0753){var _0x13bf88=[];for(var _0x1f0b3b=0x0;_0x1f0b3b<_0x2bb822[_0xaa8f('0x25')];_0x1f0b3b++){_0x13bf88[_0xaa8f('0x59')](insertAdditionalPhones(_0x2bb822[_0x1f0b3b]['contact'],_0x2bb822[_0x1f0b3b][_0xaa8f('0x55')]));}Promise[_0xaa8f('0x5f')](_0x13bf88)[_0xaa8f('0x16')](function(){_0x8f0753(0x1);});})[_0xaa8f('0x16')](function(){return{'success':_0x1b0c72,'failure':_0x343141,'duplicates':_0x29d60b};});}else{return{'success':_0x1b0c72,'failure':_0x343141,'duplicates':_0x29d60b};}}})[_0xaa8f('0x16')](respondWithResult(_0x205527,0xc9))['catch'](handleError(_0x205527,null));};exports['show']=function(_0xf4aea6,_0x50e103){var _0x3adc03;return db[_0xaa8f('0x22')]['describe']()[_0xaa8f('0x16')](function(_0x352ff9){return db['CmContact'][_0xaa8f('0x60')]({'where':{'id':_0xf4aea6['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0x61')],'required':_0xf4aea6[_0xaa8f('0x2a')]['tag']?!![]:![]},{'model':db[_0xaa8f('0x46')],'as':_0xaa8f('0x62'),'where':{'CmContactId':_0xf4aea6[_0xaa8f('0x21')]['id']},'required':![],'include':[{'model':db[_0xaa8f('0x63')],'as':_0xaa8f('0x64')}]}],'order':[db['sequelize'][_0xaa8f('0x65')](_0xaa8f('0x66'))],'attributes':_['keys'](_0x352ff9)});})[_0xaa8f('0x16')](function(_0x290e1f){if(!_[_0xaa8f('0x51')](_0x290e1f)){_0x3adc03=_0x290e1f[_0xaa8f('0x36')]({'plain':!![]});var _0x2b8b41={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x290e1f&&_0x290e1f['ListId']){if(_0x290e1f[_0xaa8f('0x5b')]){_0x2b8b41[_0xaa8f('0x5a')][_0xaa8f('0x67')][_0xaa8f('0x59')]({'ListId':{'$ne':_0x290e1f[_0xaa8f('0x5b')]}});}}return db[_0xaa8f('0x2b')][_0xaa8f('0x1e')](_0x2b8b41);}})[_0xaa8f('0x16')](function(_0x54fca1){if(!_[_0xaa8f('0x51')](_0x54fca1)){return _[_0xaa8f('0x68')](_0x3adc03,_['map'](_0x54fca1,function(_0x40aa67){return util[_0xaa8f('0x69')](_0xaa8f('0x6a'),_0x40aa67['id']);}));}})[_0xaa8f('0x16')](handleEntityNotFound(_0x50e103,null))[_0xaa8f('0x16')](respondWithResult(_0x50e103,null))[_0xaa8f('0x20')](handleError(_0x50e103,null));};exports['update']=function(_0xc7cd09,_0x12c9c6){var _0xbfc7b;if(_0xc7cd09[_0xaa8f('0x34')]['id']){delete _0xc7cd09['body']['id'];}if(!_['isNil'](_0xc7cd09['body'][_0xaa8f('0x52')])){var _0x120896=_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x52')];if(!_[_0xaa8f('0x51')](shared[_0xaa8f('0x53')][_0x120896]))_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x54')]=shared[_0xaa8f('0x53')][_0x120896]['utcOffset'];}return db['CmContact'][_0xaa8f('0x60')]({'where':{'id':_0xc7cd09[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x12c9c6,null))[_0xaa8f('0x16')](saveUpdates(_0xc7cd09[_0xaa8f('0x34')],null))[_0xaa8f('0x16')](function(_0xb07658){_0xbfc7b=_0xb07658;var _0x1c4fc2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xb07658&&_0xb07658['ListId']){if(_0xb07658[_0xaa8f('0x5b')]){_0x1c4fc2['where'][_0xaa8f('0x67')][_0xaa8f('0x59')]({'ListId':{'$ne':_0xb07658[_0xaa8f('0x5b')]}});}}return db[_0xaa8f('0x2b')][_0xaa8f('0x1e')](_0x1c4fc2);})['then'](function(_0x5a8e57){if(_0x5a8e57){return _[_0xaa8f('0x68')](_['pickBy'](_0xc7cd09[_0xaa8f('0x34')],function(_0xdfcf8d,_0x4a67ef){return _['startsWith'](_0x4a67ef,_0xaa8f('0x27'));}),_['map'](_0x5a8e57,function(_0x24f301){return util['format'](_0xaa8f('0x6a'),_0x24f301['id']);}));}})[_0xaa8f('0x16')](function(_0xbd81a3){if(_0xbd81a3&&!_[_0xaa8f('0x6b')](_0xbd81a3)){var _0x2f2e24=squel[_0xaa8f('0x15')]()[_0xaa8f('0x6c')]('cm_contacts')['setFields'](_0xbd81a3)[_0xaa8f('0x5a')]('id\x20=\x20?',_0xc7cd09[_0xaa8f('0x21')]['id'])[_0xaa8f('0x6d')]();return db[_0xaa8f('0x6e')][_0xaa8f('0x2a')](_0x2f2e24['text'],{'replacements':_0x2f2e24[_0xaa8f('0x2f')]});}})[_0xaa8f('0x16')](function(){if(_0xc7cd09[_0xaa8f('0x34')][_0xaa8f('0x6f')]&&_0xbfc7b){return db[_0xaa8f('0x3a')][_0xaa8f('0x15')]({'phone':_0xc7cd09[_0xaa8f('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0xbfc7b['id']}});}})[_0xaa8f('0x16')](function(){return _0xbfc7b;})[_0xaa8f('0x16')](respondWithResult(_0x12c9c6,null))['catch'](handleError(_0x12c9c6,null));};exports[_0xaa8f('0x70')]=function(_0x425bd7,_0x1cee4a){var _0x569431={};var _0x3126ac={};var _0x557df2;var _0x531219;return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x425bd7[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x1cee4a,null))[_0xaa8f('0x16')](function(_0x661874){if(_0x661874){_0x557df2=_0x661874;_0x3126ac[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db['Tag'][_0xaa8f('0x73')]);_0x3126ac[_0xaa8f('0x2a')]=_['keys'](_0x425bd7['query']);_0x3126ac['filters']=_[_0xaa8f('0x74')](_0x3126ac['model'],_0x3126ac[_0xaa8f('0x2a')]);_0x569431[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x3126ac[_0xaa8f('0x72')],qs['fields'](_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x569431[_0xaa8f('0x75')]=_0x569431[_0xaa8f('0x75')][_0xaa8f('0x25')]?_0x569431[_0xaa8f('0x75')]:_0x3126ac[_0xaa8f('0x72')];_0x569431['order']=qs[_0xaa8f('0x77')](_0x425bd7['query'][_0xaa8f('0x77')]);_0x569431[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x425bd7[_0xaa8f('0x2a')],_0x3126ac[_0xaa8f('0x78')]));if(_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x7a')]){_0x569431[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x569431[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x569431[_0xaa8f('0x75')],function(_0x753611){var _0x38e644={};_0x38e644[_0x753611]={'$like':'%'+_0x425bd7['query'][_0xaa8f('0x7a')]+'%'};return _0x38e644;})});}_0x569431=_['merge']({},_0x569431,_0x425bd7['options']);return _0x557df2['getTags'](_0x569431);}})[_0xaa8f('0x16')](function(_0x510070){if(_0x510070){_0x531219=_0x510070[_0xaa8f('0x25')];if(!_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x569431['limit']=qs[_0xaa8f('0x11')](_0x425bd7[_0xaa8f('0x2a')]['limit']);_0x569431[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x425bd7[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}return _0x557df2[_0xaa8f('0x70')](_0x569431);}})[_0xaa8f('0x16')](function(_0x2d6070){if(_0x2d6070){return _0x2d6070?{'count':_0x531219,'rows':_0x2d6070}:null;}})[_0xaa8f('0x16')](respondWithResult(_0x1cee4a,null))[_0xaa8f('0x20')](handleError(_0x1cee4a,null));};exports[_0xaa8f('0x7d')]=function(_0xb4f77e,_0x5cd6df){if(_0xb4f77e[_0xaa8f('0x34')]['id']){delete _0xb4f77e[_0xaa8f('0x34')]['id'];}return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0xb4f77e[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x5cd6df,null))[_0xaa8f('0x16')](function(_0x2b1218){if(_0x2b1218){return _0x2b1218['setTags'](_0xb4f77e[_0xaa8f('0x34')][_0xaa8f('0x7e')]||[]);}return null;})[_0xaa8f('0x16')](respondWithResult(_0x5cd6df,null))['catch'](handleError(_0x5cd6df,null));};exports['setAdditionalPhones']=function(_0x3275fa,_0x131c3a){var _0x4cd75a=[];_0x4cd75a[_0xaa8f('0x59')](addAdditionalPhones(_0x3275fa[_0xaa8f('0x34')]));Promise[_0xaa8f('0x5f')](_0x4cd75a)['then'](function(){_0x4cd75a=[];_0x4cd75a[_0xaa8f('0x59')](deleteCmHopperPhones(_0x3275fa[_0xaa8f('0x34')]['id']));_0x4cd75a[_0xaa8f('0x59')](addCmHopperPhones(_0x3275fa[_0xaa8f('0x34')]['id']));Promise[_0xaa8f('0x5f')](_0x4cd75a)[_0xaa8f('0x16')](function(){return[0x1];})[_0xaa8f('0x16')](respondWithResult(_0x131c3a,null));});};function addAdditionalPhones(_0x23cd6c){var _0x361532;return new Promise(function(_0x9a42b3){return db[_0xaa8f('0x46')][_0xaa8f('0x17')]({'where':{'CmContactId':_0x23cd6c['id']}})[_0xaa8f('0x16')](function(){db['ContactItemType'][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id','OrderBy']})[_0xaa8f('0x16')](function(_0x324057){var _0x5995d9=[];for(var _0x5cbbe7=0x0;_0x5cbbe7<_0x23cd6c[_0xaa8f('0x7f')]['length'];_0x5cbbe7++){var _0x55a755=_0x23cd6c[_0xaa8f('0x80')]?_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])?'':_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7]:_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]?_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]:'';var _0x2173b0=_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x82')])?'':_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x82')];var _0x323fbd=_0x55a755+':'+_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x6f')]+'§'+_0x2173b0;if(_['isNil'](_0x361532))_0x361532=_0x323fbd;else _0x361532+=';'+_0x323fbd;var _0x4238e5=null;var _0x5f5115=null;if(_0x23cd6c['item_types']){if(!_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])){_0x5f5115=_[_0xaa8f('0x60')](_0x324057,function(_0x8b16a8){return _0x8b16a8['id']===_0x23cd6c['item_types'][_0x5cbbe7];});if(!_[_0xaa8f('0x51')](_0x5f5115)){_0x4238e5=_0x5f5115[_0xaa8f('0x83')];}}}else{if(!_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7])){_0x5f5115=_[_0xaa8f('0x60')](_0x324057,function(_0x349084){return _0x349084['id']===_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')];});if(!_['isNil'](_0x5f5115)){_0x4238e5=_0x5cbbe7;}}}if(_[_0xaa8f('0x51')](_0x4238e5)){_0x4238e5=0x64;}_0x5995d9[_0xaa8f('0x59')](addAdditionalPhone(_0x23cd6c['id'],_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x6f')],_0x23cd6c[_0xaa8f('0x80')]?_[_0xaa8f('0x51')](_0x23cd6c[_0xaa8f('0x80')][_0x5cbbe7])?null:_0x23cd6c['item_types'][_0x5cbbe7]:_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]?_0x23cd6c[_0xaa8f('0x7f')][_0x5cbbe7][_0xaa8f('0x81')]:null,_0x4238e5,_0x2173b0));}Promise['all'](_0x5995d9)[_0xaa8f('0x16')](function(){db['CmContact']['update']({'AdditionalPhones':_0x361532},{'where':{'id':_0x23cd6c['id']}})[_0xaa8f('0x16')](function(){_0x9a42b3(0x1);});});});});});}function addAdditionalPhone(_0x4af32a,_0x176b36,_0x34a1b8,_0x3a7996,_0x104419){return db[_0xaa8f('0x46')][_0xaa8f('0x60')]({'where':{'CmContactId':_0x4af32a,'item':_0x176b36}})[_0xaa8f('0x16')](function(_0x47a278){if(_0x47a278)logger['info']('contact\x20phone\x20exists',_0x47a278);else{db[_0xaa8f('0x46')][_0xaa8f('0x3e')]({'CmContactId':_0x4af32a,'item':_0x176b36,'ItemTypeId':_0x34a1b8,'OrderBy':_0x3a7996,'ItemClass':_0xaa8f('0x84'),'description':_0x104419});}});}function deleteCmHopperPhones(_0x2580fb){return new Promise(function(_0x4f653a){return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2580fb}})['then'](function(_0x2d1782){db['CmHopperAdditionalPhone'][_0xaa8f('0x17')]({'where':{'CmHopperId':{'$in':_[_0xaa8f('0x7b')](_0x2d1782,'id')}}});})[_0xaa8f('0x16')](function(){_0x4f653a(0x1);});});}function addCmHopperPhones(_0x1a4c13){return new Promise(function(_0x19bf6a){return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1a4c13}})['then'](function(_0xb7db73){var _0x4c3658=[];_[_0xaa8f('0x7b')](_0xb7db73,function(_0x528fc2){_0x4c3658[_0xaa8f('0x59')](createCmHopperPhone(_0x1a4c13,_0x528fc2['id']));});Promise[_0xaa8f('0x5f')](_0x4c3658)[_0xaa8f('0x16')](function(){_0x19bf6a(0x1);});});});}function createCmHopperPhone(_0x3dc39e,_0x3d758a){return new Promise(function(_0x4ea95e){db[_0xaa8f('0x46')][_0xaa8f('0x1e')]({'raw':!![],'attributes':[_0xaa8f('0x85'),_0xaa8f('0x83')],'where':{'CmContactId':_0x3dc39e,'ItemClass':_0xaa8f('0x84')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':'ItemType'}],'order':[_0xaa8f('0x83'),db[_0xaa8f('0x6e')]['literal'](_0xaa8f('0x86'))]})['then'](function(_0x357a19){var _0x2b92e3=0x1;var _0xfecb2d=_[_0xaa8f('0x7b')](_0x357a19,function(_0x3aa0f4){_0x3aa0f4[_0xaa8f('0x87')]=_0x3d758a;_0x3aa0f4[_0xaa8f('0x6f')]=_0x3aa0f4['item'];_0x3aa0f4['OrderBy']=_0x2b92e3;delete _0x3aa0f4[_0xaa8f('0x88')];_0x2b92e3=_0x2b92e3+0x1;return _0x3aa0f4;});return db[_0xaa8f('0x89')][_0xaa8f('0x56')](_0xfecb2d,{});})['then'](function(){_0x4ea95e(0x1);});});}function insertAdditionalPhones(_0x2e7fa5,_0x3ac47a){return new Promise(function(_0x57d406){var _0xcef321=[];for(var _0x116485=0x0;_0x116485<_0x3ac47a['length'];_0x116485++){var _0x214b08=_0x3ac47a[_0x116485];_0xcef321[_0xaa8f('0x59')](parseContactItemType(_0x214b08));}Promise[_0xaa8f('0x5f')](_0xcef321)['then'](function(){var _0x451dfd={'id':_0x2e7fa5['id'],'items':_0x3ac47a};return addAdditionalPhones(_0x451dfd)[_0xaa8f('0x16')](function(){return addCmHopperPhones(_0x2e7fa5['id']);});})['then'](function(){_0x57d406(_0x2e7fa5);});});}function parseContactItemType(_0x32865d){return new Promise(function(_0x3751b6){if(_0x32865d[_0xaa8f('0x5e')]('ItemTypeId')){_0x3751b6(_0x32865d);}else{return db['ContactItemType'][_0xaa8f('0x60')]({'where':{'name':_0x32865d[_0xaa8f('0x64')]}})['then'](function(_0x197d6c){if(_[_0xaa8f('0x51')](_0x197d6c))_0x32865d['ItemTypeId']=null;else _0x32865d['ItemTypeId']=_0x197d6c['id'];_0x3751b6(_0x32865d);});}});}exports['getAdditionalPhones']=function(_0x568744,_0x1bdfb4){return db[_0xaa8f('0x46')][_0xaa8f('0x1e')]({'raw':!![],'where':{'CmContactId':_0x568744[_0xaa8f('0x21')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xaa8f('0x63')],'as':_0xaa8f('0x64')}],'order':[[_0xaa8f('0x83')],[db[_0xaa8f('0x6e')][_0xaa8f('0x65')](_0xaa8f('0x86'))]]})[_0xaa8f('0x16')](function(_0x2ef7d0){return _0x2ef7d0;})['then'](respondWithResult(_0x1bdfb4,null))['catch'](handleError(_0x1bdfb4,null));};exports[_0xaa8f('0x8a')]=function(_0x398bb6,_0x28e887){return db[_0xaa8f('0x46')]['findAll']({'raw':!![],'where':{'CmContactId':_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8b')]}})[_0xaa8f('0x16')](function(_0x39a957){var _0x20feb7=_[_0xaa8f('0x7b')](_0x39a957,function(_0x32eb22){_0x32eb22[_0xaa8f('0x8c')]=_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8d')];return _0x32eb22;});return db[_0xaa8f('0x46')][_0xaa8f('0x56')](_0x20feb7,{});})[_0xaa8f('0x16')](function(){return addCmHopperPhones(_0x398bb6[_0xaa8f('0x34')][_0xaa8f('0x8d')]);})[_0xaa8f('0x16')](function(){return['ok'];})[_0xaa8f('0x16')](respondWithResult(_0x28e887,null))[_0xaa8f('0x20')](handleError(_0x28e887,null));};exports[_0xaa8f('0x8e')]=function(_0x2a386e,_0x3c32f0){var _0x2ff321=[];_0x2ff321[_0xaa8f('0x59')](createCmHopperPhone(_0x2a386e['body']['id'],_0x2a386e[_0xaa8f('0x34')][_0xaa8f('0x8f')]));Promise[_0xaa8f('0x5f')](_0x2ff321)[_0xaa8f('0x16')](function(){return[0x1];})[_0xaa8f('0x16')](respondWithResult(_0x3c32f0,null));};exports[_0xaa8f('0x90')]=function(_0x19925f,_0x4f6070){var _0x133433={'raw':![],'where':{}};var _0x29598b={};var _0x1bbb84={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')]['findOne']({'where':{'id':_0x19925f[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4f6070,null))['then'](function(_0x38ece2){if(_0x38ece2){_0x29598b[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db['CmHopper']['rawAttributes']);_0x29598b[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x19925f[_0xaa8f('0x2a')]);_0x29598b[_0xaa8f('0x78')]=_['intersection'](_0x29598b['model'],_0x29598b[_0xaa8f('0x2a')]);_0x133433[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x29598b[_0xaa8f('0x72')],qs[_0xaa8f('0x76')](_0x19925f['query'][_0xaa8f('0x76')]));_0x133433[_0xaa8f('0x75')]=_0x133433[_0xaa8f('0x75')]['length']?_0x133433[_0xaa8f('0x75')]:_0x29598b[_0xaa8f('0x72')];if(!_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x133433[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x133433['offset']=qs[_0xaa8f('0xf')](_0x19925f[_0xaa8f('0x2a')]['offset']);}_0x133433[_0xaa8f('0x91')]=qs['sort'](_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x133433[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x19925f[_0xaa8f('0x2a')],_0x29598b[_0xaa8f('0x78')]));_0x133433['where'][_0xaa8f('0x92')]=_0x38ece2['id'];if(_0x19925f['query'][_0xaa8f('0x7a')]){_0x133433[_0xaa8f('0x5a')]=_['merge'](_0x133433[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x133433[_0xaa8f('0x75')],function(_0x8ab994){var _0x143995={};_0x143995[_0x8ab994]={'$like':'%'+_0x19925f[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x143995;})});}_0x133433=_[_0xaa8f('0x33')]({},_0x133433,_0x19925f[_0xaa8f('0x93')]);return db['CmHopper'][_0xaa8f('0x12')]({'where':_0x133433[_0xaa8f('0x5a')]})['then'](function(_0x3a0780){_0x1bbb84[_0xaa8f('0x12')]=_0x3a0780;if(_0x19925f['query'][_0xaa8f('0x94')]){_0x133433['include']=[{'all':!![]}];}return db[_0xaa8f('0x3a')][_0xaa8f('0x1e')](_0x133433);})[_0xaa8f('0x16')](function(_0x410b84){_0x1bbb84[_0xaa8f('0x95')]=_0x410b84;return _0x1bbb84;});}})['then'](respondWithFilteredResult(_0x4f6070,_0x133433))[_0xaa8f('0x20')](handleError(_0x4f6070,null));};exports[_0xaa8f('0x96')]=function(_0x4c8808,_0x4b92f3){var _0x1917a1={'raw':!![],'where':{}};var _0x3ad120={};var _0x115a24={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x4c8808['params']['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4b92f3,null))['then'](function(_0x34425e){if(_0x34425e){_0x3ad120['model']=_[_0xaa8f('0x24')](db[_0xaa8f('0x97')][_0xaa8f('0x73')]);_0x3ad120[_0xaa8f('0x2a')]=_['keys'](_0x4c8808[_0xaa8f('0x2a')]);_0x3ad120[_0xaa8f('0x78')]=_[_0xaa8f('0x74')](_0x3ad120[_0xaa8f('0x72')],_0x3ad120['query']);_0x1917a1['attributes']=_[_0xaa8f('0x74')](_0x3ad120[_0xaa8f('0x72')],qs['fields'](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x1917a1[_0xaa8f('0x75')]=_0x1917a1['attributes']['length']?_0x1917a1[_0xaa8f('0x75')]:_0x3ad120['model'];if(!_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x1917a1[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x1917a1['offset']=qs[_0xaa8f('0xf')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x1917a1[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x1917a1['where']=qs[_0xaa8f('0x78')](_[_0xaa8f('0x79')](_0x4c8808[_0xaa8f('0x2a')],_0x3ad120[_0xaa8f('0x78')]));_0x1917a1[_0xaa8f('0x5a')]['ContactId']=_0x34425e['id'];if(_0x4c8808[_0xaa8f('0x2a')][_0xaa8f('0x7a')]){_0x1917a1[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x1917a1[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x1917a1[_0xaa8f('0x75')],function(_0x26fb9f){var _0x536a59={};_0x536a59[_0x26fb9f]={'$like':'%'+_0x4c8808['query'][_0xaa8f('0x7a')]+'%'};return _0x536a59;})});}_0x1917a1=_[_0xaa8f('0x33')]({},_0x1917a1,_0x4c8808[_0xaa8f('0x93')]);return db[_0xaa8f('0x97')]['count']({'where':_0x1917a1[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x271c47){_0x115a24[_0xaa8f('0x12')]=_0x271c47;if(_0x4c8808['query'][_0xaa8f('0x94')]){_0x1917a1[_0xaa8f('0x98')]=[{'all':!![]}];}return db[_0xaa8f('0x97')][_0xaa8f('0x1e')](_0x1917a1);})[_0xaa8f('0x16')](function(_0x4b3d22){_0x115a24[_0xaa8f('0x95')]=_0x4b3d22;return _0x115a24;});}})[_0xaa8f('0x16')](respondWithFilteredResult(_0x4b92f3,_0x1917a1))[_0xaa8f('0x20')](handleError(_0x4b92f3,null));};exports[_0xaa8f('0x99')]=function(_0x53a72c,_0x37939d){var _0x2a19f5={'raw':!![],'where':{}};var _0x588ccf={};var _0x182154={'count':0x0,'rows':[]};return db[_0xaa8f('0x22')][_0xaa8f('0x71')]({'where':{'id':_0x53a72c['params']['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x37939d,null))['then'](function(_0x249d12){if(_0x249d12){_0x588ccf[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db[_0xaa8f('0x47')][_0xaa8f('0x73')]);_0x588ccf[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x53a72c[_0xaa8f('0x2a')]);_0x588ccf['filters']=_['intersection'](_0x588ccf['model'],_0x588ccf[_0xaa8f('0x2a')]);_0x2a19f5['attributes']=_['intersection'](_0x588ccf['model'],qs[_0xaa8f('0x76')](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x2a19f5[_0xaa8f('0x75')]=_0x2a19f5['attributes'][_0xaa8f('0x25')]?_0x2a19f5[_0xaa8f('0x75')]:_0x588ccf[_0xaa8f('0x72')];if(!_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x2a19f5['limit']=qs['limit'](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x2a19f5['offset']=qs[_0xaa8f('0xf')](_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x2a19f5[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x53a72c['query']['sort']);_0x2a19f5[_0xaa8f('0x5a')]=qs[_0xaa8f('0x78')](_['pick'](_0x53a72c[_0xaa8f('0x2a')],_0x588ccf['filters']));_0x2a19f5[_0xaa8f('0x5a')][_0xaa8f('0x92')]=_0x249d12['id'];if(_0x53a72c[_0xaa8f('0x2a')]['filter']){_0x2a19f5['where']=_[_0xaa8f('0x33')](_0x2a19f5['where'],{'$or':_[_0xaa8f('0x7b')](_0x2a19f5['attributes'],function(_0x396e50){var _0x4abee6={};_0x4abee6[_0x396e50]={'$like':'%'+_0x53a72c[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x4abee6;})});}_0x2a19f5=_[_0xaa8f('0x33')]({},_0x2a19f5,_0x53a72c[_0xaa8f('0x93')]);return db[_0xaa8f('0x47')][_0xaa8f('0x12')]({'where':_0x2a19f5[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x19aa07){_0x182154[_0xaa8f('0x12')]=_0x19aa07;if(_0x53a72c['query'][_0xaa8f('0x94')]){_0x2a19f5[_0xaa8f('0x98')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa8f('0x1e')](_0x2a19f5);})[_0xaa8f('0x16')](function(_0x50b9df){_0x182154[_0xaa8f('0x95')]=_0x50b9df;return _0x182154;});}})['then'](respondWithFilteredResult(_0x37939d,_0x2a19f5))['catch'](handleError(_0x37939d,null));};exports[_0xaa8f('0x9a')]=function(_0x24634e,_0x4e2a2d){var _0x53f01c={'raw':!![],'where':{}};var _0x1e15eb={};var _0x3d583e={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x24634e[_0xaa8f('0x21')]['id']}})[_0xaa8f('0x16')](handleEntityNotFound(_0x4e2a2d,null))[_0xaa8f('0x16')](function(_0x1c3141){if(_0x1c3141){_0x1e15eb[_0xaa8f('0x72')]=_[_0xaa8f('0x24')](db[_0xaa8f('0x4c')][_0xaa8f('0x73')]);_0x1e15eb[_0xaa8f('0x2a')]=_[_0xaa8f('0x24')](_0x24634e[_0xaa8f('0x2a')]);_0x1e15eb['filters']=_[_0xaa8f('0x74')](_0x1e15eb[_0xaa8f('0x72')],_0x1e15eb[_0xaa8f('0x2a')]);_0x53f01c[_0xaa8f('0x75')]=_[_0xaa8f('0x74')](_0x1e15eb[_0xaa8f('0x72')],qs[_0xaa8f('0x76')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x76')]));_0x53f01c[_0xaa8f('0x75')]=_0x53f01c[_0xaa8f('0x75')][_0xaa8f('0x25')]?_0x53f01c[_0xaa8f('0x75')]:_0x1e15eb[_0xaa8f('0x72')];if(!_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x5e')](_0xaa8f('0x7c'))){_0x53f01c[_0xaa8f('0x11')]=qs[_0xaa8f('0x11')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x11')]);_0x53f01c[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0xf')]);}_0x53f01c[_0xaa8f('0x91')]=qs[_0xaa8f('0x77')](_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x77')]);_0x53f01c[_0xaa8f('0x5a')]=qs['filters'](_[_0xaa8f('0x79')](_0x24634e[_0xaa8f('0x2a')],_0x1e15eb[_0xaa8f('0x78')]));_0x53f01c['where'][_0xaa8f('0x92')]=_0x1c3141['id'];if(_0x24634e['query']['filter']){_0x53f01c[_0xaa8f('0x5a')]=_[_0xaa8f('0x33')](_0x53f01c[_0xaa8f('0x5a')],{'$or':_[_0xaa8f('0x7b')](_0x53f01c[_0xaa8f('0x75')],function(_0x32b627){var _0x10ea51={};_0x10ea51[_0x32b627]={'$like':'%'+_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x7a')]+'%'};return _0x10ea51;})});}_0x53f01c=_['merge']({},_0x53f01c,_0x24634e[_0xaa8f('0x93')]);return db[_0xaa8f('0x4c')][_0xaa8f('0x12')]({'where':_0x53f01c[_0xaa8f('0x5a')]})[_0xaa8f('0x16')](function(_0x3c3bdf){_0x3d583e[_0xaa8f('0x12')]=_0x3c3bdf;if(_0x24634e[_0xaa8f('0x2a')][_0xaa8f('0x94')]){_0x53f01c['include']=[{'all':!![]}];}return db[_0xaa8f('0x4c')]['findAll'](_0x53f01c);})[_0xaa8f('0x16')](function(_0x543461){_0x3d583e[_0xaa8f('0x95')]=_0x543461;return _0x3d583e;});}})[_0xaa8f('0x16')](respondWithFilteredResult(_0x4e2a2d,_0x53f01c))['catch'](handleError(_0x4e2a2d,null));};exports[_0xaa8f('0x9b')]=function(_0x47201b,_0x107af4){try{if(!_0x47201b[_0xaa8f('0x34')]['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9d')]){throw new Error(_0xaa8f('0x9e'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9f')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0xa0')]){throw new Error(_0xaa8f('0xa1'));}var _0x57a8bc=_0x47201b[_0xaa8f('0x34')]['binding_keys'][_0xaa8f('0xa2')](',');var _0x334031=_0x47201b['body']['binding_values'][_0xaa8f('0xa2')](',');if(!_0x57a8bc['length']||!_0x334031[_0xaa8f('0x25')]||_0x57a8bc['length']!==_0x334031[_0xaa8f('0x25')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x76')]=_[_0xaa8f('0xa3')](_0x57a8bc,_0x334031);if(!_0x47201b[_0xaa8f('0x34')]['fields'][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x76')][_0xaa8f('0xa5')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2e839f=path[_0xaa8f('0x38')](config['root'],_0xaa8f('0xa6'),_0x47201b[_0xaa8f('0xa7')]['filename']);fs[_0xaa8f('0xa8')](_0x2e839f,parseInt(_0xaa8f('0xa9'),0x8));var _0x3545ac=require('child_process')[_0xaa8f('0xaa')](path[_0xaa8f('0x38')](__dirname,'../../components/import/cm/csv'),[_0x2e839f,_0x47201b[_0xaa8f('0x34')][_0xaa8f('0x9d')],_0x47201b[_0xaa8f('0x34')]['binding_values'],_0x47201b['body'][_0xaa8f('0x5b')],_0x47201b[_0xaa8f('0x34')][_0xaa8f('0xab')],_0x47201b[_0xaa8f('0x34')]['duplicates'],_0x47201b['body'][_0xaa8f('0xa0')]]);return _0x107af4[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0x3545ac[_0xaa8f('0xac')]});}catch(_0x4f8cc4){return _0x107af4[_0xaa8f('0xd')](0x1f4)['send'](_0x4f8cc4);}};exports[_0xaa8f('0xad')]=function(_0x189713,_0x172223){var _0x5aa596=fs['createReadStream'](_0x189713[_0xaa8f('0xa7')][_0xaa8f('0x2')]);Papa[_0xaa8f('0xae')](_0x5aa596,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x156c3b){return _0x172223[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'file':_0x189713[_0xaa8f('0xa7')],'fields':_0x156c3b[_0xaa8f('0xaf')]['fields']});}});};exports[_0xaa8f('0xb0')]=function(_0x368344,_0x19b539){return db[_0xaa8f('0xb1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xaa8f('0xb2')}})[_0xaa8f('0x16')](function(_0x4b427f){var _0x27dc53=![];if(!_0x368344['body']['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x368344[_0xaa8f('0x34')]['binding'][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x368344[_0xaa8f('0x34')][_0xaa8f('0xb3')]['firstName']){throw new Error(_0xaa8f('0xb4'));}if(!_0x368344['body']['socket_timestamp']){throw new Error(_0xaa8f('0xa1'));}var _0x394615=require(_0xaa8f('0xb5'))['fork'](path[_0xaa8f('0x38')](__dirname,'../../components/import/cm/csv2'),[_0x368344[_0xaa8f('0x21')]['id'],JSON[_0xaa8f('0xb6')](_0x368344['body']),JSON['stringify'](_0x4b427f)]);_0x394615['on'](_0xaa8f('0xb7'),function(){_0x27dc53=!![];return _0x19b539['status'](0xc8)[_0xaa8f('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x394615[_0xaa8f('0xac')]});});_0x394615['on'](_0xaa8f('0xb8'),function(_0x359cf5){if(_0x359cf5&&!_0x27dc53){return _0x19b539['status'](0x1f4)[_0xaa8f('0xe')]({'message':_0xaa8f('0xb9'),'pid':_0x394615['pid']});}});})[_0xaa8f('0x20')](handleError(_0x19b539,null));};exports[_0xaa8f('0xba')]=function(_0x184565,_0x55702e){return db['User'][_0xaa8f('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xaa8f('0xb2')}})[_0xaa8f('0x16')](function(_0x588ce0){var _0x15ba51=![];if(!_0x184565[_0xaa8f('0x34')]['ListId']){throw new Error(_0xaa8f('0x9c'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xb3')][_0xaa8f('0x6f')]){throw new Error(_0xaa8f('0xa4'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xb3')][_0xaa8f('0xa5')]){throw new Error(_0xaa8f('0xb4'));}if(!_0x184565[_0xaa8f('0x34')][_0xaa8f('0xa0')]){throw new Error(_0xaa8f('0xa1'));}var _0xefb854=require(_0xaa8f('0xb5'))['fork'](path[_0xaa8f('0x38')](__dirname,_0xaa8f('0xbb')),[_0x184565[_0xaa8f('0x21')]['id'],JSON['stringify'](_0x184565[_0xaa8f('0x34')]),JSON[_0xaa8f('0xb6')](_0x588ce0)]);_0xefb854['on']('message',function(){_0x15ba51=!![];return _0x55702e[_0xaa8f('0xd')](0xc8)[_0xaa8f('0xe')]({'message':_0xaa8f('0xbc'),'pid':_0xefb854[_0xaa8f('0xac')]});});_0xefb854['on'](_0xaa8f('0xb8'),function(_0x98d1d1){if(_0x98d1d1&&!_0x15ba51){return _0x55702e[_0xaa8f('0xd')](0x1f4)['json']({'message':_0xaa8f('0xb9'),'pid':_0xefb854[_0xaa8f('0xac')]});}});})['catch'](handleError(_0x55702e,null));};exports[_0xaa8f('0xbd')]=function(_0x3d21b8,_0x9901bf){var _0xada6c0=[_0xaa8f('0xbe'),'chat',_0xaa8f('0xbf'),'openchannel',_0xaa8f('0xc0'),'whatsapp',_0xaa8f('0xc1')];var _0xbf5363={'offset':0x0,'order':qs[_0xaa8f('0x77')]('-createdAt')},_0x2e558f={'count':0x0,'rows':[]};Promise[_0xaa8f('0xc2')]()['then'](function(){if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc3')]){if(!_[_0xaa8f('0xc4')](_0xada6c0,_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc3')][_0xaa8f('0xc5')]())){throw new Error(_0xaa8f('0xc6'));}_0xada6c0=[_0x3d21b8['query'][_0xaa8f('0xc3')][_0xaa8f('0xc5')]()];}if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){try{var _0x3c84f3=JSON['parse'](_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]);if(!moment(_0x3c84f3[_0xaa8f('0x35')])['isValid']()){throw new Error(_0xaa8f('0xc8'));}if(!moment(_0x3c84f3['to'])[_0xaa8f('0xc9')]()){throw new Error(_0xaa8f('0xca'));}}catch(_0x48a73e){throw new Error(_0xaa8f('0xcb'));}}if(!_0x3d21b8[_0xaa8f('0x2a')]['hasOwnProperty'](_0xaa8f('0x7c'))){_0xbf5363['limit']=qs['limit'](_0x3d21b8['query'][_0xaa8f('0x11')]||0xa);_0xbf5363[_0xaa8f('0xf')]=qs[_0xaa8f('0xf')](_0x3d21b8[_0xaa8f('0x2a')]['offset']);}var _0x5196c0=_0xada6c0[_0xaa8f('0x7b')](function(_0x2c4582){if(_0x2c4582===_0xaa8f('0xc1')){var _0x26966f={'attributes':['id',_0xaa8f('0xcc'),_0xaa8f('0x2e'),_0xaa8f('0xcd'),_0xaa8f('0xce'),_0xaa8f('0xcf'),_0xaa8f('0xd0'),_0xaa8f('0xd1'),_0xaa8f('0xd2'),_0xaa8f('0xd3'),_0xaa8f('0xd4'),_0xaa8f('0xd5'),_0xaa8f('0xd6'),_0xaa8f('0xd7'),_0xaa8f('0xd8')],'where':{'ContactId':_0x3d21b8[_0xaa8f('0x21')]['id']},'include':[{'model':db['User'],'as':_0xaa8f('0xb1'),'attributes':['id',_0xaa8f('0x1a'),'fullname','alias']}],'order':[[_0xaa8f('0xd4'),'DESC']]};if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){_0x26966f[_0xaa8f('0x5a')][_0xaa8f('0xd4')]={'$gte':_0x3c84f3[_0xaa8f('0x35')],'$lte':_0x3c84f3['to']};}return db[_0xaa8f('0x49')][_0xaa8f('0xd9')](_0x26966f)['then'](function(_0x530d84){_0x2e558f[_0xaa8f('0x12')]+=_0x530d84[_0xaa8f('0x12')];return _['map'](_0x530d84[_0xaa8f('0x95')],function(_0x1d22ca){var _0x2f6708=_0x1d22ca[_0xaa8f('0x36')]({'plain':!![]});_0x2f6708[_0xaa8f('0xc3')]=_0x2c4582;if(_0x2f6708[_0xaa8f('0xb1')]){_0x2f6708['User']={'id':_0x2f6708[_0xaa8f('0xb1')]['id'],'name':_0x2f6708[_0xaa8f('0xb1')][_0xaa8f('0x1a')],'fullname':_0x2f6708['User'][_0xaa8f('0xda')],'alias':_0x2f6708[_0xaa8f('0xb1')]['alias']};}return _0x2f6708;});});}else{var _0x2a7d34=_[_0xaa8f('0xdb')](_0x2c4582)+(_0x2c4582===_0xaa8f('0xdc')?'Website':_0xaa8f('0xdd'));var _0x1b5a75={'attributes':['id',_0xaa8f('0xde'),_0xaa8f('0xdf'),_0xaa8f('0xd4'),_0xaa8f('0xd3'),'disposition',_0xaa8f('0xe0'),'thirdDisposition','UserId',_0x2a7d34+'Id'],'where':{'ContactId':_0x3d21b8[_0xaa8f('0x21')]['id']},'include':[{'model':db[_0x2a7d34],'as':'Account','attributes':['id','name','key']},{'model':db[_0xaa8f('0xb1')],'as':_0xaa8f('0xe1'),'attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0xda')]},{'model':db[_0xaa8f('0xe2')],'as':_0xaa8f('0xe3'),'attributes':['id',_0xaa8f('0x1a'),_0xaa8f('0x61')],'through':{'attributes':[]}}],'order':[[_0xaa8f('0xd4'),'DESC']]};if(_0x3d21b8[_0xaa8f('0x2a')][_0xaa8f('0xc7')]){_0x1b5a75['where'][_0xaa8f('0xd4')]={'$gte':_0x3c84f3['from'],'$lte':_0x3c84f3['to']};}switch(_0x2c4582){case _0xaa8f('0xdc'):_0x1b5a75[_0xaa8f('0x75')][_0xaa8f('0x59')](_0xaa8f('0xe4'),'customerIp',_0xaa8f('0xe5'),_0xaa8f('0xe6'),_0xaa8f('0xe7'),_0xaa8f('0xe8'),_0xaa8f('0xe9'),_0xaa8f('0xea'),_0xaa8f('0xeb'));break;case _0xaa8f('0xbe'):_0x1b5a75['attributes']['push'](_0xaa8f('0xec'),_0xaa8f('0xed'));break;case _0xaa8f('0xee'):_0x1b5a75[_0xaa8f('0x75')]['push'](_0xaa8f('0xef'),_0xaa8f('0xf0'));break;}return db[_[_0xaa8f('0xdb')](_0x2c4582)+_0xaa8f('0xf1')][_0xaa8f('0xd9')](_0x1b5a75)[_0xaa8f('0x16')](function(_0x1bd20a){_0x2e558f[_0xaa8f('0x12')]+=_0x1bd20a['count'];return _[_0xaa8f('0x7b')](_0x1bd20a[_0xaa8f('0x95')],function(_0x44c5c6){var _0x541695=_0x44c5c6[_0xaa8f('0x36')]({'plain':!![]});_0x541695[_0xaa8f('0xc3')]=_0x2c4582;if(_0x541695['Owner']){_0x541695[_0xaa8f('0xe1')]={'id':_0x541695['Owner']['id'],'name':_0x541695[_0xaa8f('0xe1')][_0xaa8f('0x1a')],'fullname':_0x541695[_0xaa8f('0xe1')][_0xaa8f('0xda')]};}return _0x541695;});});}});return Promise[_0xaa8f('0x5f')](_0x5196c0);})[_0xaa8f('0x16')](function(_0x12362b){return _(_0x12362b)[_0xaa8f('0xf2')]()['sortBy']('createdAt')[_0xaa8f('0xf3')]()['value']();})[_0xaa8f('0x16')](function(_0x4d3ae0){_0x2e558f[_0xaa8f('0x95')]=_0xbf5363[_0xaa8f('0x11')]?_0x4d3ae0[_0xaa8f('0xf4')](_0xbf5363[_0xaa8f('0xf')],_0xbf5363[_0xaa8f('0xf')]+_0xbf5363[_0xaa8f('0x11')]):_0x4d3ae0;return _0x2e558f;})[_0xaa8f('0x16')](respondWithFilteredResult(_0x9901bf,_0xbf5363))[_0xaa8f('0x20')](handleError(_0x9901bf,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 8939325..ac74b4f 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a2a=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','CmContact'];(function(_0x2cc5bd,_0x3cd4af){var _0x194b51=function(_0x34045b){while(--_0x34045b){_0x2cc5bd['push'](_0x2cc5bd['shift']());}};_0x194b51(++_0x3cd4af);}(_0x6a2a,0x1a4));var _0xa6a2=function(_0x272e18,_0x75e43c){_0x272e18=_0x272e18-0x0;var _0x572ca9=_0x6a2a[_0x272e18];return _0x572ca9;};'use strict';var EventEmitter=require(_0xa6a2('0x0'));var CmContact=require(_0xa6a2('0x1'))['db'][_0xa6a2('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa6a2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6a2('0x4'),'afterDestroy':_0xa6a2('0x5')};function emitEvent(_0x37202b){return function(_0x1bbbc7,_0x44aecd,_0x33bfa9){CmContactEvents[_0xa6a2('0x6')](_0x37202b+':'+_0x1bbbc7['id'],_0x1bbbc7);CmContactEvents['emit'](_0x37202b,_0x1bbbc7);_0x33bfa9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xa6a2('0x7')](e,emitEvent(event));}}module[_0xa6a2('0x8')]=CmContactEvents; \ No newline at end of file +var _0x33d7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x2134a3,_0x44d4c4){var _0x2f4660=function(_0x4ae57c){while(--_0x4ae57c){_0x2134a3['push'](_0x2134a3['shift']());}};_0x2f4660(++_0x44d4c4);}(_0x33d7,0x1d4));var _0x733d=function(_0x1112d6,_0x5e5fcf){_0x1112d6=_0x1112d6-0x0;var _0x1188d7=_0x33d7[_0x1112d6];return _0x1188d7;};'use strict';var EventEmitter=require(_0x733d('0x0'));var CmContact=require(_0x733d('0x1'))['db'][_0x733d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x733d('0x3')](0x0);var events={'afterCreate':_0x733d('0x4'),'afterUpdate':_0x733d('0x5'),'afterDestroy':_0x733d('0x6')};function emitEvent(_0x52ba8b){return function(_0x2f56dc,_0x3710f6,_0x54fa77){CmContactEvents[_0x733d('0x7')](_0x52ba8b+':'+_0x2f56dc['id'],_0x2f56dc);CmContactEvents[_0x733d('0x7')](_0x52ba8b,_0x2f56dc);_0x54fa77(null);};}for(var e in events){if(events[_0x733d('0x8')](e)){var event=events[e];CmContact[_0x733d('0x9')](e,emitEvent(event));}}module[_0x733d('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 665f494..ec1405c 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c6d=['VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','phone','fti_cm_contacts','firstName','lastName','mobile','fax','utf8mb4','models','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','format','ret','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','error','Campaign','minutes','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','get','dialCheckDuplicateType','always','cmContact,\x20%s,\x20%s','onlyIfOpen','BlackLists','CmHopperBlack','message','List\x20not\x20found','isEmpty'];(function(_0x53f0a5,_0x828ba4){var _0x2d0769=function(_0x1d5d32){while(--_0x1d5d32){_0x53f0a5['push'](_0x53f0a5['shift']());}};_0x2d0769(++_0x828ba4);}(_0x1c6d,0x10c));var _0xd1c6=function(_0x470212,_0x1387de){_0x470212=_0x470212-0x0;var _0x5083cb=_0x1c6d[_0x470212];return _0x5083cb;};'use strict';var _=require('lodash');var util=require(_0xd1c6('0x0'));var logger=require(_0xd1c6('0x1'))(_0xd1c6('0x2'));var moment=require(_0xd1c6('0x3'));var BPromise=require(_0xd1c6('0x4'));var rp=require(_0xd1c6('0x5'));var fs=require('fs');var path=require(_0xd1c6('0x6'));var rimraf=require(_0xd1c6('0x7'));var config=require(_0xd1c6('0x8'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0xd1c6('0x9')]=function(_0x2f6218,_0x51505c){return _0x2f6218[_0xd1c6('0xa')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xd1c6('0xb'),'fields':[_0xd1c6('0xb')]},{'name':_0xd1c6('0xc'),'fields':[_0xd1c6('0xd'),_0xd1c6('0xe'),'phone',_0xd1c6('0xf'),_0xd1c6('0x10'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xd1c6('0x11'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x270874,_0x280293,_0x557340){var _0x16501d=_0x2f6218[_0xd1c6('0x12')];var _0x4989dd=_0x270874['get']({'plain':!![]});function _0x5178a2(){return function(_0x519786){logger['error'](_0xd1c6('0x13'),_0xd1c6('0x14'),util[_0xd1c6('0x15')](_0x519786,{'showHidden':![],'depth':null}));};}function _0x2efad5(_0x16d6a5,_0x33af9e){var _0x277081=_0x33af9e[_0xd1c6('0x16')]?_0x33af9e['scheduledat']:moment()['format'](_0xd1c6('0x17'));return new BPromise(function(_0x341132,_0xacafbd){if(_[_0xd1c6('0x18')](_0x33af9e['dialTimezone'])){_0x341132({'ret':_0x277081});}else{_0x16501d[_0xd1c6('0x19')][_0xd1c6('0x1a')]({'where':{'id':_0x16d6a5['id']}})[_0xd1c6('0x1b')](function(_0x5e8ac5){if(!_[_0xd1c6('0x18')](_0x5e8ac5)){var _0x5d71c0=_0x5e8ac5[_0xd1c6('0x1c')];if(!_[_0xd1c6('0x18')](_0x5d71c0)){var _0x3be3a7=shared[_0xd1c6('0x1d')];var _0xd2e8ac=_0x3be3a7[_0x5d71c0];var _0x498757=_0x3be3a7[_0x33af9e['dialTimezone']];if(!_[_0xd1c6('0x18')](_0xd2e8ac)&&!_['isNil'](_0x498757)){var _0x5f1635=_0xd2e8ac['utcOffset']-_0x498757[_0xd1c6('0x1e')];_0x277081=_0x33af9e[_0xd1c6('0x16')]?_0x33af9e[_0xd1c6('0x16')]:moment();var _0x5af8c4=moment(_0x277081)['add'](_0x5f1635,'minutes');_0x341132({'ret':_0x5af8c4[_0xd1c6('0x1f')](_0xd1c6('0x17'))});}else _0x341132({'ret':_0x277081});}else _0x341132({'ret':_0x277081});}else{_0x341132({'ret':_0x277081});}});}});return 0xa;}var _0x4c0913=function(_0x3539bc){return new BPromise(function(_0x8bca6c,_0x425d15){_0x2efad5(_0x3539bc,_0x4989dd)[_0xd1c6('0x1b')](function(_0x359b62){_0x4989dd[_0xd1c6('0x16')]=_0x359b62[_0xd1c6('0x20')];_0x16501d['CmHopper'][_0xd1c6('0x1a')]({'where':{'phone':_0x4989dd['phone'],'VoiceQueueId':_0x3539bc['id']}})['then'](function(_0x5a4393){if(!_[_0xd1c6('0x18')](_0x5a4393)){throw new Error(_0xd1c6('0x21')+_0x4989dd[_0xd1c6('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x3539bc['id']);}return _0x16501d[_0xd1c6('0x22')][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'priority':_0x4989dd[_0xd1c6('0x25')]?_0x4989dd[_0xd1c6('0x25')]:0x2,'scheduledat':_0x4989dd[_0xd1c6('0x16')]?_0x4989dd[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4989dd[_0xd1c6('0x26')]?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd[_0xd1c6('0x26')]:undefined,'callbackat':_0x4989dd['callbackUniqueid']?moment()['format'](_0xd1c6('0x17')):undefined,'VoiceQueueId':_0x3539bc['id']});})[_0xd1c6('0x27')](function(_0x3f3dd0){_0x425d15(_0x3f3dd0);});});});};var _0x5f1c2c=function(_0x323047){return new BPromise(function(_0x3ccbab,_0x3fae1a){_0x2efad5(_0x323047,_0x4989dd)['then'](function(_0x357a8c){_0x4989dd[_0xd1c6('0x16')]=_0x357a8c[_0xd1c6('0x20')];_0x16501d[_0xd1c6('0x22')]['findOne']({'where':{'phone':_0x4989dd[_0xd1c6('0xb')],'VoiceQueueId':_0x323047['id']}})[_0xd1c6('0x1b')](function(_0x55406){if(!_[_0xd1c6('0x18')](_0x55406)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4989dd[_0xd1c6('0xb')]+_0xd1c6('0x28')+_0x323047['id']);}return _0x16501d['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x4989dd[_0xd1c6('0xb')],'VoiceQueueId':_0x323047['id']}});})[_0xd1c6('0x1b')](function(_0x3d62cb){if(!_[_0xd1c6('0x18')](_0x3d62cb)){throw new Error(_0xd1c6('0x29')+_0x4989dd['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x323047['id']);}return _0x16501d[_0xd1c6('0x22')][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'priority':_0x4989dd['priority']?_0x4989dd[_0xd1c6('0x25')]:0x2,'scheduledat':_0x4989dd['scheduledat']?_0x4989dd[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')),'callback':_0x4989dd[_0xd1c6('0x26')]?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd[_0xd1c6('0x26')]:undefined,'callbackat':_0x4989dd[_0xd1c6('0x26')]?moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')):undefined,'VoiceQueueId':_0x323047['id']});})[_0xd1c6('0x27')](function(_0x3091c3){_0x3fae1a(_0x3091c3);});});});};function _0x34cc64(){return function(_0xa9d7b6){logger[_0xd1c6('0x2a')]('cmContact',_0xd1c6('0x14'),util['inspect'](_0xa9d7b6,{'showHidden':![],'depth':null}));};}function _0x5543b9(_0x2e4a83,_0x22be2e){var _0xc3876b=_0x22be2e[_0xd1c6('0x16')]?_0x22be2e[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x3b4bfd,_0x37fcd7){if(_['isNil'](_0x22be2e[_0xd1c6('0x1c')])){_0x3b4bfd({'ret':_0xc3876b});}else{_0x16501d[_0xd1c6('0x2b')][_0xd1c6('0x1a')]({'where':{'id':_0x2e4a83['id']}})[_0xd1c6('0x1b')](function(_0x1ed499){if(!_[_0xd1c6('0x18')](_0x1ed499)){var _0x5b5af1=_0x1ed499[_0xd1c6('0x1c')];if(!_['isNil'](_0x5b5af1)){var _0x1f6518=shared[_0xd1c6('0x1d')];var _0x2d4d23=_0x1f6518[_0x5b5af1];var _0x349ec0=_0x1f6518[_0x22be2e[_0xd1c6('0x1c')]];if(!_[_0xd1c6('0x18')](_0x2d4d23)&&!_['isNil'](_0x349ec0)){var _0x5db6bf=_0x2d4d23[_0xd1c6('0x1e')]-_0x349ec0['utcOffset'];_0xc3876b=_0x22be2e[_0xd1c6('0x16')]?_0x22be2e[_0xd1c6('0x16')]:moment();var _0x3579da=moment(_0xc3876b)['add'](_0x5db6bf,_0xd1c6('0x2c'));_0x3b4bfd({'ret':_0x3579da[_0xd1c6('0x1f')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3b4bfd({'ret':_0xc3876b});}else _0x3b4bfd({'ret':_0xc3876b});}else{_0x3b4bfd({'ret':_0xc3876b});}});}});return 0xa;}var _0x265ce5=function(_0x5a9671){return new BPromise(function(_0x7d73ca,_0x3d477a){_0x5543b9(_0x5a9671,_0x4989dd)[_0xd1c6('0x1b')](function(_0x5009e3){_0x4989dd[_0xd1c6('0x16')]=_0x5009e3['ret'];_0x16501d['CmHopper'][_0xd1c6('0x1a')]({'where':{'phone':_0x4989dd[_0xd1c6('0xb')],'CampaignId':_0x5a9671['id']}})[_0xd1c6('0x1b')](function(_0x4594e2){if(!_[_0xd1c6('0x18')](_0x4594e2)){throw new Error(_0xd1c6('0x21')+_0x4989dd['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x5a9671['id']);}return _0x16501d[_0xd1c6('0x22')][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd['ListId'],'priority':_0x4989dd[_0xd1c6('0x25')]?_0x4989dd['priority']:0x2,'scheduledat':_0x4989dd[_0xd1c6('0x16')]?_0x4989dd[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4989dd[_0xd1c6('0x26')]?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd[_0xd1c6('0x26')]:undefined,'callbackat':_0x4989dd[_0xd1c6('0x26')]?moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')):undefined,'CampaignId':_0x5a9671['id']});})[_0xd1c6('0x27')](function(_0x2eee3a){_0x3d477a(_0x2eee3a);});});});};var _0x2f0513=function(_0x5d3d33){return new BPromise(function(_0x599bf6,_0x656c0){_0x5543b9(_0x5d3d33,_0x4989dd)[_0xd1c6('0x1b')](function(_0x20e97d){_0x4989dd[_0xd1c6('0x16')]=_0x20e97d[_0xd1c6('0x20')];_0x16501d[_0xd1c6('0x22')]['findOne']({'where':{'phone':_0x4989dd['phone'],'CampaignId':_0x5d3d33['id']}})[_0xd1c6('0x1b')](function(_0x3fc49d){if(!_['isNil'](_0x3fc49d)){throw new Error(_0xd1c6('0x21')+_0x4989dd[_0xd1c6('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x5d3d33['id']);}return _0x16501d[_0xd1c6('0x2d')][_0xd1c6('0x1a')]({'where':{'calleridnum':_0x4989dd[_0xd1c6('0xb')],'CampaignId':_0x5d3d33['id']}});})[_0xd1c6('0x1b')](function(_0x4a1b6b){if(!_[_0xd1c6('0x18')](_0x4a1b6b)){throw new Error(_0xd1c6('0x29')+_0x4989dd['phone']+_0xd1c6('0x2e')+_0x5d3d33['id']);}return _0x16501d[_0xd1c6('0x22')][_0xd1c6('0x23')]({'phone':_0x4989dd['phone'],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'priority':_0x4989dd['priority']?_0x4989dd[_0xd1c6('0x25')]:0x2,'scheduledat':_0x4989dd[_0xd1c6('0x16')]?_0x4989dd['scheduledat']:moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')),'callback':_0x4989dd['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd[_0xd1c6('0x26')]:undefined,'callbackat':_0x4989dd[_0xd1c6('0x26')]?moment()['format'](_0xd1c6('0x17')):undefined,'CampaignId':_0x5d3d33['id']});})[_0xd1c6('0x27')](function(_0x521f98){_0x656c0(_0x521f98);});});});};if(_0x4989dd['ListId']){_0x16501d['VoiceQueue'][_0xd1c6('0x2f')]({'where':{'type':_0xd1c6('0x30')},'attributes':['id','dialCheckDuplicateType',_0xd1c6('0x1c')],'include':[{'model':_0x16501d[_0xd1c6('0x31')],'as':_0xd1c6('0x32'),'where':{'id':_0x4989dd[_0xd1c6('0x24')]}}]})[_0xd1c6('0x1b')](function(_0x39defc){if(_0x39defc){var _0x1c94db=[];for(var _0x4ae20f=0x0,_0x4cbd5b;_0x4ae20f<_0x39defc[_0xd1c6('0x33')];_0x4ae20f+=0x1){_0x4cbd5b=_0x39defc[_0x4ae20f][_0xd1c6('0x34')]({'plain':!![]});switch(_0x4cbd5b[_0xd1c6('0x35')]){case _0xd1c6('0x36'):_0x5f1c2c(_0x4cbd5b)[_0xd1c6('0x27')](_0x5178a2());break;case'onlyIfOpen':_0x4c0913(_0x4cbd5b)[_0xd1c6('0x27')](_0x5178a2());break;default:_0x5543b9(_0x4cbd5b,_0x4989dd)['then'](function(_0x40c381){_0x4989dd[_0xd1c6('0x16')]=_0x40c381[_0xd1c6('0x20')];_0x16501d[_0xd1c6('0x22')][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd['ListId'],'scheduledat':_0x4989dd[_0xd1c6('0x16')]?_0x4989dd[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')),'priority':_0x4989dd['priority']?_0x4989dd[_0xd1c6('0x25')]:0x2,'callback':_0x4989dd[_0xd1c6('0x26')]?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd['callbackUniqueid']:undefined,'callbackat':_0x4989dd[_0xd1c6('0x26')]?moment()['format'](_0xd1c6('0x17')):undefined,'VoiceQueueId':_0x4cbd5b['id']})[_0xd1c6('0x27')](_0x5178a2());});}}}})[_0xd1c6('0x1b')](function(){return _0x16501d[_0xd1c6('0x19')][_0xd1c6('0x2f')]({'where':{'type':_0xd1c6('0x30')},'attributes':['id'],'include':[{'model':_0x16501d[_0xd1c6('0x31')],'as':'BlackLists','where':{'id':_0x4989dd[_0xd1c6('0x24')]}}]})[_0xd1c6('0x1b')](function(_0x2f3d09){if(_0x2f3d09){var _0x40bef6=[];for(var _0x31fd74=0x0,_0x1aa70e;_0x31fd74<_0x2f3d09[_0xd1c6('0x33')];_0x31fd74+=0x1){_0x1aa70e=_0x2f3d09[_0x31fd74][_0xd1c6('0x34')]({'plain':!![]});_0x16501d['CmHopperBlack'][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'VoiceQueueId':_0x1aa70e['id']})[_0xd1c6('0x27')](function(_0x1ce863){logger['error'](_0xd1c6('0x37'),_0xd1c6('0x14'),_0x1ce863['message']);});}}});})[_0xd1c6('0x1b')](function(){return _0x16501d[_0xd1c6('0x2b')]['findAll']({'attributes':['id',_0xd1c6('0x35'),_0xd1c6('0x1c')],'include':[{'model':_0x16501d['CmList'],'as':_0xd1c6('0x32'),'where':{'id':_0x4989dd['ListId']}}]})[_0xd1c6('0x1b')](function(_0x5cfe89){if(_0x5cfe89){var _0x435edd=[];for(var _0x102a0d=0x0,_0x239a39;_0x102a0d<_0x5cfe89[_0xd1c6('0x33')];_0x102a0d+=0x1){_0x239a39=_0x5cfe89[_0x102a0d][_0xd1c6('0x34')]({'plain':!![]});switch(_0x239a39[_0xd1c6('0x35')]){case _0xd1c6('0x36'):_0x2f0513(_0x239a39)[_0xd1c6('0x27')](_0x34cc64());break;case _0xd1c6('0x38'):_0x265ce5(_0x239a39)[_0xd1c6('0x27')](_0x34cc64());break;default:_0x16501d['CmHopper'][_0xd1c6('0x23')]({'phone':_0x4989dd[_0xd1c6('0xb')],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'scheduledat':_0x4989dd[_0xd1c6('0x16')]?_0x4989dd[_0xd1c6('0x16')]:moment()[_0xd1c6('0x1f')](_0xd1c6('0x17')),'priority':_0x4989dd[_0xd1c6('0x25')]?_0x4989dd[_0xd1c6('0x25')]:0x2,'callback':_0x4989dd[_0xd1c6('0x26')]?!![]:![],'callbackuniqueid':_0x4989dd[_0xd1c6('0x26')]?_0x4989dd[_0xd1c6('0x26')]:undefined,'callbackat':_0x4989dd[_0xd1c6('0x26')]?moment()[_0xd1c6('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x239a39['id']})[_0xd1c6('0x27')](_0x34cc64());}}}});})[_0xd1c6('0x1b')](function(){return _0x16501d[_0xd1c6('0x2b')]['findAll']({'attributes':['id'],'include':[{'model':_0x16501d[_0xd1c6('0x31')],'as':_0xd1c6('0x39'),'where':{'id':_0x4989dd[_0xd1c6('0x24')]}}]})[_0xd1c6('0x1b')](function(_0x12d2b8){if(_0x12d2b8){var _0x15290c=[];for(var _0x5d1f63=0x0,_0x37b77c;_0x5d1f63<_0x12d2b8[_0xd1c6('0x33')];_0x5d1f63+=0x1){_0x37b77c=_0x12d2b8[_0x5d1f63][_0xd1c6('0x34')]({'plain':!![]});_0x16501d[_0xd1c6('0x3a')]['create']({'phone':_0x4989dd['phone'],'ContactId':_0x4989dd['id'],'ListId':_0x4989dd[_0xd1c6('0x24')],'CampaignId':_0x37b77c['id']})[_0xd1c6('0x27')](function(_0xfadfa8){logger[_0xd1c6('0x2a')](_0xd1c6('0x37'),_0xd1c6('0x14'),_0xfadfa8[_0xd1c6('0x3b')]);});}}});})[_0xd1c6('0x1b')](function(){_0x557340();})[_0xd1c6('0x27')](function(_0x248140){logger[_0xd1c6('0x2a')](_0xd1c6('0x37'),_0xd1c6('0x14'),_0x248140[_0xd1c6('0x3b')]);_0x557340(_0x248140);});}else{_0x557340(new Error(_0xd1c6('0x3c')));}},'afterDestroy':function(_0x34c259,_0xdf9644,_0x48be10){var _0x53b174=_0x2f6218['models'];var _0x1ccda7=_0x34c259[_0xd1c6('0x34')]({'plain':!![]});return _0x53b174[_0xd1c6('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x1ccda7[_0xd1c6('0x24')],'ContactId':_0x1ccda7['id']}})[_0xd1c6('0x1b')](function(_0x5732d5){if(!_[_0xd1c6('0x3d')](_0x5732d5)){var _0x20af78=[];for(var _0x26e78b=0x0;_0x26e78b<_0x5732d5[_0xd1c6('0x33')];_0x26e78b+=0x1){var _0x4967d1=_0x53b174[_0xd1c6('0x22')]['destroy']({'where':{'ListId':_0x5732d5[_0x26e78b][_0xd1c6('0x24')],'ContactId':_0x5732d5[_0x26e78b]['ContactId'],'VoiceQueueId':_0x5732d5[_0x26e78b][_0xd1c6('0x3e')],'CampaignId':_0x5732d5[_0x26e78b][_0xd1c6('0x3f')]}});_0x20af78[_0xd1c6('0x40')](_0x4967d1);}return BPromise['all'](_0x20af78);}})[_0xd1c6('0x1b')](function(_0x503a4f){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xd1c6('0x15')](_0x503a4f,{'showHidden':![],'depth':null}));_0x48be10();})['catch'](function(_0x320272){logger['error'](_0xd1c6('0x41'),util['inspect'](_0x320272,{'showHidden':![],'depth':null}));_0x48be10(_0x320272);});}}});}; \ No newline at end of file +var _0x6ccb=['inspect','scheduledat','format','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','message','Campaign','CmHopperBlack','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate'];(function(_0x352853,_0x4b2ccf){var _0x487b0c=function(_0x22e247){while(--_0x22e247){_0x352853['push'](_0x352853['shift']());}};_0x487b0c(++_0x4b2ccf);}(_0x6ccb,0xcb));var _0xb6cc=function(_0x52aa4a,_0x5781e9){_0x52aa4a=_0x52aa4a-0x0;var _0x4a0704=_0x6ccb[_0x52aa4a];return _0x4a0704;};'use strict';var _=require(_0xb6cc('0x0'));var util=require(_0xb6cc('0x1'));var logger=require(_0xb6cc('0x2'))(_0xb6cc('0x3'));var moment=require(_0xb6cc('0x4'));var BPromise=require(_0xb6cc('0x5'));var rp=require(_0xb6cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6cc('0x7'));var shared=require(_0xb6cc('0x8'));var attributes=require(_0xb6cc('0x9'));module[_0xb6cc('0xa')]=function(_0xe9fc99,_0xfe6d67){return _0xe9fc99[_0xb6cc('0xb')](_0xb6cc('0xc'),attributes,{'tableName':_0xb6cc('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xb6cc('0xe')]},{'name':'fti_cm_contacts','fields':[_0xb6cc('0xf'),'lastName',_0xb6cc('0xe'),_0xb6cc('0x10'),'fax',_0xb6cc('0x11')],'type':_0xb6cc('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xb6cc('0x13'),'hooks':{'afterCreate':function(_0x38a8aa,_0x11e837,_0x2e8534){var _0x17d28e=_0xe9fc99[_0xb6cc('0x14')];var _0x3c60ec=_0x38a8aa[_0xb6cc('0x15')]({'plain':!![]});function _0x26c328(){return function(_0x26449a){logger[_0xb6cc('0x16')](_0xb6cc('0x17'),_0xb6cc('0x18'),util[_0xb6cc('0x19')](_0x26449a,{'showHidden':![],'depth':null}));};}function _0x2b66a3(_0x3dc711,_0x578be8){var _0x475244=_0x578be8['scheduledat']?_0x578be8[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x336e01,_0x39aec3){if(_[_0xb6cc('0x1c')](_0x578be8[_0xb6cc('0x1d')])){_0x336e01({'ret':_0x475244});}else{_0x17d28e['VoiceQueue'][_0xb6cc('0x1e')]({'where':{'id':_0x3dc711['id']}})[_0xb6cc('0x1f')](function(_0x208517){if(!_[_0xb6cc('0x1c')](_0x208517)){var _0x55a388=_0x208517[_0xb6cc('0x1d')];if(!_['isNil'](_0x55a388)){var _0x38018d=shared[_0xb6cc('0x20')];var _0x48fb25=_0x38018d[_0x55a388];var _0x1b2698=_0x38018d[_0x578be8['dialTimezone']];if(!_['isNil'](_0x48fb25)&&!_['isNil'](_0x1b2698)){var _0x50c4d1=_0x48fb25[_0xb6cc('0x21')]-_0x1b2698['utcOffset'];_0x475244=_0x578be8['scheduledat']?_0x578be8[_0xb6cc('0x1a')]:moment();var _0x2509dc=moment(_0x475244)[_0xb6cc('0x22')](_0x50c4d1,_0xb6cc('0x23'));_0x336e01({'ret':_0x2509dc[_0xb6cc('0x1b')](_0xb6cc('0x24'))});}else _0x336e01({'ret':_0x475244});}else _0x336e01({'ret':_0x475244});}else{_0x336e01({'ret':_0x475244});}});}});return 0xa;}var _0x3f8fc7=function(_0x48b349){return new BPromise(function(_0x16e68f,_0x2d7e14){_0x2b66a3(_0x48b349,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x2fb04b){_0x3c60ec[_0xb6cc('0x1a')]=_0x2fb04b[_0xb6cc('0x25')];_0x17d28e['CmHopper'][_0xb6cc('0x1e')]({'where':{'phone':_0x3c60ec['phone'],'VoiceQueueId':_0x48b349['id']}})['then'](function(_0x3c2eca){if(!_['isNil'](_0x3c2eca)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x27')+_0x48b349['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec['priority']:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()['format'](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'VoiceQueueId':_0x48b349['id']});})[_0xb6cc('0x2d')](function(_0x47b8bf){_0x2d7e14(_0x47b8bf);});});});};var _0x37ba5e=function(_0x4a6a3b){return new BPromise(function(_0x5b291f,_0x3e77ca){_0x2b66a3(_0x4a6a3b,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x3f5139){_0x3c60ec['scheduledat']=_0x3f5139[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')]['findOne']({'where':{'phone':_0x3c60ec['phone'],'VoiceQueueId':_0x4a6a3b['id']}})[_0xb6cc('0x1f')](function(_0x4c3eff){if(!_[_0xb6cc('0x1c')](_0x4c3eff)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x2e')+_0x4a6a3b['id']);}return _0x17d28e[_0xb6cc('0x2f')]['findOne']({'where':{'calleridnum':_0x3c60ec[_0xb6cc('0xe')],'VoiceQueueId':_0x4a6a3b['id']}});})[_0xb6cc('0x1f')](function(_0x33b5cf){if(!_[_0xb6cc('0x1c')](_0x33b5cf)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x30')+_0x4a6a3b['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec['scheduledat']:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4a6a3b['id']});})[_0xb6cc('0x2d')](function(_0x3d6071){_0x3e77ca(_0x3d6071);});});});};function _0x30bb55(){return function(_0x585560){logger[_0xb6cc('0x16')]('cmContact','afterCreate',util[_0xb6cc('0x19')](_0x585560,{'showHidden':![],'depth':null}));};}function _0x1df249(_0x11df4e,_0x23ad28){var _0x4ec3a7=_0x23ad28[_0xb6cc('0x1a')]?_0x23ad28['scheduledat']:moment()['format'](_0xb6cc('0x24'));return new BPromise(function(_0x373013,_0x4f97e1){if(_[_0xb6cc('0x1c')](_0x23ad28['dialTimezone'])){_0x373013({'ret':_0x4ec3a7});}else{_0x17d28e['Campaign']['findOne']({'where':{'id':_0x11df4e['id']}})['then'](function(_0x1bbef9){if(!_['isNil'](_0x1bbef9)){var _0x25c9de=_0x1bbef9[_0xb6cc('0x1d')];if(!_['isNil'](_0x25c9de)){var _0x558cf9=shared[_0xb6cc('0x20')];var _0x332f32=_0x558cf9[_0x25c9de];var _0x1ece15=_0x558cf9[_0x23ad28[_0xb6cc('0x1d')]];if(!_[_0xb6cc('0x1c')](_0x332f32)&&!_[_0xb6cc('0x1c')](_0x1ece15)){var _0x3690ea=_0x332f32[_0xb6cc('0x21')]-_0x1ece15[_0xb6cc('0x21')];_0x4ec3a7=_0x23ad28['scheduledat']?_0x23ad28[_0xb6cc('0x1a')]:moment();var _0x28af47=moment(_0x4ec3a7)[_0xb6cc('0x22')](_0x3690ea,_0xb6cc('0x23'));_0x373013({'ret':_0x28af47[_0xb6cc('0x1b')](_0xb6cc('0x24'))});}else _0x373013({'ret':_0x4ec3a7});}else _0x373013({'ret':_0x4ec3a7});}else{_0x373013({'ret':_0x4ec3a7});}});}});return 0xa;}var _0x3a3cac=function(_0x31d8ca){return new BPromise(function(_0x2b6601,_0x28746c){_0x1df249(_0x31d8ca,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x228584){_0x3c60ec[_0xb6cc('0x1a')]=_0x228584[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x1e')]({'where':{'phone':_0x3c60ec[_0xb6cc('0xe')],'CampaignId':_0x31d8ca['id']}})['then'](function(_0x2afb07){if(!_[_0xb6cc('0x1c')](_0x2afb07)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3c60ec['phone']+_0xb6cc('0x31')+_0x31d8ca['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec['priority']?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec['callbackUniqueid']:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'CampaignId':_0x31d8ca['id']});})[_0xb6cc('0x2d')](function(_0x1c571f){_0x28746c(_0x1c571f);});});});};var _0x17daba=function(_0x2424e4){return new BPromise(function(_0x47b96e,_0x784b10){_0x1df249(_0x2424e4,_0x3c60ec)[_0xb6cc('0x1f')](function(_0x3f8b36){_0x3c60ec[_0xb6cc('0x1a')]=_0x3f8b36['ret'];_0x17d28e[_0xb6cc('0x28')]['findOne']({'where':{'phone':_0x3c60ec[_0xb6cc('0xe')],'CampaignId':_0x2424e4['id']}})[_0xb6cc('0x1f')](function(_0x3f7cea){if(!_['isNil'](_0x3f7cea)){throw new Error(_0xb6cc('0x26')+_0x3c60ec[_0xb6cc('0xe')]+_0xb6cc('0x32')+_0x2424e4['id']);}return _0x17d28e['CmHopperFinal'][_0xb6cc('0x1e')]({'where':{'calleridnum':_0x3c60ec['phone'],'CampaignId':_0x2424e4['id']}});})[_0xb6cc('0x1f')](function(_0x53119c){if(!_[_0xb6cc('0x1c')](_0x53119c)){throw new Error(_0xb6cc('0x33')+_0x3c60ec['phone']+_0xb6cc('0x34')+_0x2424e4['id']);}return _0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'priority':_0x3c60ec['priority']?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2424e4['id']});})[_0xb6cc('0x2d')](function(_0x3d8f6f){_0x784b10(_0x3d8f6f);});});});};if(_0x3c60ec[_0xb6cc('0x2a')]){_0x17d28e[_0xb6cc('0x35')][_0xb6cc('0x36')]({'where':{'type':_0xb6cc('0x37')},'attributes':['id',_0xb6cc('0x38'),'dialTimezone'],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3a'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0x238fee){if(_0x238fee){var _0x36b4c0=[];for(var _0x20f629=0x0,_0x41cdc5;_0x20f629<_0x238fee['length'];_0x20f629+=0x1){_0x41cdc5=_0x238fee[_0x20f629]['get']({'plain':!![]});switch(_0x41cdc5[_0xb6cc('0x38')]){case _0xb6cc('0x3b'):_0x37ba5e(_0x41cdc5)['catch'](_0x26c328());break;case _0xb6cc('0x3c'):_0x3f8fc7(_0x41cdc5)[_0xb6cc('0x2d')](_0x26c328());break;default:_0x1df249(_0x41cdc5,_0x3c60ec)['then'](function(_0x1ddcc8){_0x3c60ec[_0xb6cc('0x1a')]=_0x1ddcc8[_0xb6cc('0x25')];_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'scheduledat':_0x3c60ec['scheduledat']?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec[_0xb6cc('0x2c')]?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'VoiceQueueId':_0x41cdc5['id']})[_0xb6cc('0x2d')](_0x26c328());});}}}})[_0xb6cc('0x1f')](function(){return _0x17d28e[_0xb6cc('0x35')]['findAll']({'where':{'type':_0xb6cc('0x37')},'attributes':['id'],'include':[{'model':_0x17d28e['CmList'],'as':_0xb6cc('0x3d'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0xb586ed){if(_0xb586ed){var _0x450e30=[];for(var _0x45928d=0x0,_0x63c9a9;_0x45928d<_0xb586ed[_0xb6cc('0x3e')];_0x45928d+=0x1){_0x63c9a9=_0xb586ed[_0x45928d][_0xb6cc('0x15')]({'plain':!![]});_0x17d28e['CmHopperBlack'][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'VoiceQueueId':_0x63c9a9['id']})[_0xb6cc('0x2d')](function(_0x1501c5){logger[_0xb6cc('0x16')]('cmContact,\x20%s,\x20%s',_0xb6cc('0x18'),_0x1501c5[_0xb6cc('0x3f')]);});}}});})[_0xb6cc('0x1f')](function(){return _0x17d28e['Campaign'][_0xb6cc('0x36')]({'attributes':['id',_0xb6cc('0x38'),_0xb6cc('0x1d')],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3a'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})[_0xb6cc('0x1f')](function(_0x16a5ca){if(_0x16a5ca){var _0x3eb89d=[];for(var _0xbbe28e=0x0,_0x3ea690;_0xbbe28e<_0x16a5ca['length'];_0xbbe28e+=0x1){_0x3ea690=_0x16a5ca[_0xbbe28e][_0xb6cc('0x15')]({'plain':!![]});switch(_0x3ea690[_0xb6cc('0x38')]){case'always':_0x17daba(_0x3ea690)['catch'](_0x30bb55());break;case'onlyIfOpen':_0x3a3cac(_0x3ea690)[_0xb6cc('0x2d')](_0x30bb55());break;default:_0x17d28e[_0xb6cc('0x28')][_0xb6cc('0x29')]({'phone':_0x3c60ec[_0xb6cc('0xe')],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec[_0xb6cc('0x2a')],'scheduledat':_0x3c60ec[_0xb6cc('0x1a')]?_0x3c60ec[_0xb6cc('0x1a')]:moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')),'priority':_0x3c60ec[_0xb6cc('0x2b')]?_0x3c60ec[_0xb6cc('0x2b')]:0x2,'callback':_0x3c60ec[_0xb6cc('0x2c')]?!![]:![],'callbackuniqueid':_0x3c60ec['callbackUniqueid']?_0x3c60ec[_0xb6cc('0x2c')]:undefined,'callbackat':_0x3c60ec[_0xb6cc('0x2c')]?moment()[_0xb6cc('0x1b')](_0xb6cc('0x24')):undefined,'CampaignId':_0x3ea690['id']})[_0xb6cc('0x2d')](_0x30bb55());}}}});})[_0xb6cc('0x1f')](function(){return _0x17d28e[_0xb6cc('0x40')][_0xb6cc('0x36')]({'attributes':['id'],'include':[{'model':_0x17d28e[_0xb6cc('0x39')],'as':_0xb6cc('0x3d'),'where':{'id':_0x3c60ec[_0xb6cc('0x2a')]}}]})['then'](function(_0x2d7567){if(_0x2d7567){var _0xfc4771=[];for(var _0x4ea750=0x0,_0x5978e9;_0x4ea750<_0x2d7567[_0xb6cc('0x3e')];_0x4ea750+=0x1){_0x5978e9=_0x2d7567[_0x4ea750]['get']({'plain':!![]});_0x17d28e[_0xb6cc('0x41')][_0xb6cc('0x29')]({'phone':_0x3c60ec['phone'],'ContactId':_0x3c60ec['id'],'ListId':_0x3c60ec['ListId'],'CampaignId':_0x5978e9['id']})['catch'](function(_0x53e23e){logger[_0xb6cc('0x16')](_0xb6cc('0x42'),'afterCreate',_0x53e23e['message']);});}}});})[_0xb6cc('0x1f')](function(){_0x2e8534();})[_0xb6cc('0x2d')](function(_0x198bea){logger[_0xb6cc('0x16')]('cmContact,\x20%s,\x20%s',_0xb6cc('0x18'),_0x198bea[_0xb6cc('0x3f')]);_0x2e8534(_0x198bea);});}else{_0x2e8534(new Error(_0xb6cc('0x43')));}},'afterDestroy':function(_0x51ad68,_0x3d05c4,_0x3881b6){var _0x1336c9=_0xe9fc99['models'];var _0x502cf6=_0x51ad68[_0xb6cc('0x15')]({'plain':!![]});return _0x1336c9[_0xb6cc('0x28')][_0xb6cc('0x36')]({'raw':!![],'where':{'ListId':_0x502cf6[_0xb6cc('0x2a')],'ContactId':_0x502cf6['id']}})['then'](function(_0x4e63a0){if(!_[_0xb6cc('0x44')](_0x4e63a0)){var _0x3d8afd=[];for(var _0x57e739=0x0;_0x57e739<_0x4e63a0['length'];_0x57e739+=0x1){var _0x4333cc=_0x1336c9[_0xb6cc('0x28')]['destroy']({'where':{'ListId':_0x4e63a0[_0x57e739][_0xb6cc('0x2a')],'ContactId':_0x4e63a0[_0x57e739][_0xb6cc('0x45')],'VoiceQueueId':_0x4e63a0[_0x57e739][_0xb6cc('0x46')],'CampaignId':_0x4e63a0[_0x57e739][_0xb6cc('0x47')]}});_0x3d8afd[_0xb6cc('0x48')](_0x4333cc);}return BPromise['all'](_0x3d8afd);}})[_0xb6cc('0x1f')](function(_0x484012){logger[_0xb6cc('0x49')](_0xb6cc('0x4a'),util[_0xb6cc('0x19')](_0x484012,{'showHidden':![],'depth':null}));_0x3881b6();})[_0xb6cc('0x2d')](function(_0x2e8121){logger[_0xb6cc('0x16')](_0xb6cc('0x4b'),util[_0xb6cc('0x19')](_0x2e8121,{'showHidden':![],'depth':null}));_0x3881b6(_0x2e8121);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 2463161..207f363 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x2042e8,_0x181d85){var _0x4309d6=function(_0x1003e5){while(--_0x1003e5){_0x2042e8['push'](_0x2042e8['shift']());}};_0x4309d6(++_0x181d85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 4201a18..c98e453 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37f8=['STRING','PHONE','exports','INTEGER'];(function(_0x24ca52,_0x1d7478){var _0x2392f9=function(_0x1e0a4){while(--_0x1e0a4){_0x24ca52['push'](_0x24ca52['shift']());}};_0x2392f9(++_0x1d7478);}(_0x37f8,0xd2));var _0x837f=function(_0x362d02,_0x1e1b1d){_0x362d02=_0x362d02-0x0;var _0x5cb943=_0x37f8[_0x362d02];return _0x5cb943;};'use strict';var Sequelize=require('sequelize');module[_0x837f('0x0')]={'CmContactId':{'type':Sequelize[_0x837f('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x837f('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x837f('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x837f('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xa0bc=['STRING','PHONE','exports','INTEGER'];(function(_0x2af777,_0x4ec97d){var _0x655683=function(_0x195fc2){while(--_0x195fc2){_0x2af777['push'](_0x2af777['shift']());}};_0x655683(++_0x4ec97d);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'CmContactId':{'type':Sequelize[_0xca0b('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xca0b('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xca0b('0x2')],'defaultValue':_0xca0b('0x3')},'OrderBy':{'type':Sequelize[_0xca0b('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xca0b('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 954dfe4..8ef0761 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda8e=['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','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','stack','name','send','index','map','CmContactHasItem','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','merge','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0xda8e,0xf9));var _0xeda8=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xda8e[_0x203d64];return _0x462ab3;};'use strict';var emlformat=require(_0xeda8('0x0'));var rimraf=require(_0xeda8('0x1'));var zipdir=require(_0xeda8('0x2'));var jsonpatch=require(_0xeda8('0x3'));var rp=require(_0xeda8('0x4'));var moment=require(_0xeda8('0x5'));var BPromise=require(_0xeda8('0x6'));var Mustache=require(_0xeda8('0x7'));var util=require(_0xeda8('0x8'));var path=require(_0xeda8('0x9'));var sox=require('sox');var csv=require(_0xeda8('0xa'));var ejs=require(_0xeda8('0xb'));var fs=require('fs');var fs_extra=require(_0xeda8('0xc'));var _=require(_0xeda8('0xd'));var squel=require(_0xeda8('0xe'));var crypto=require(_0xeda8('0xf'));var jsforce=require(_0xeda8('0x10'));var deskjs=require(_0xeda8('0x11'));var toCsv=require('to-csv');var querystring=require(_0xeda8('0x12'));var Papa=require(_0xeda8('0x13'));var Redis=require(_0xeda8('0x14'));var authService=require(_0xeda8('0x15'));var qs=require(_0xeda8('0x16'));var as=require(_0xeda8('0x17'));var hardwareService=require(_0xeda8('0x18'));var logger=require(_0xeda8('0x19'))('api');var utils=require(_0xeda8('0x1a'));var config=require(_0xeda8('0x1b'));var licenseUtil=require(_0xeda8('0x1c'));var db=require(_0xeda8('0x1d'))['db'];function respondWithStatusCode(_0x509efd,_0xfd848c){_0xfd848c=_0xfd848c||0xcc;return function(_0xe3f61){if(_0xe3f61){return _0x509efd[_0xeda8('0x1e')](_0xfd848c);}return _0x509efd[_0xeda8('0x1f')](_0xfd848c)[_0xeda8('0x20')]();};}function respondWithResult(_0x1568f8,_0xb0e8ef){_0xb0e8ef=_0xb0e8ef||0xc8;return function(_0x27782a){if(_0x27782a){return _0x1568f8['status'](_0xb0e8ef)['json'](_0x27782a);}};}function respondWithFilteredResult(_0x73e0e9,_0x3cad1a){return function(_0x5eecb7){if(_0x5eecb7){var _0x3b8f75=typeof _0x3cad1a[_0xeda8('0x21')]===_0xeda8('0x22')&&typeof _0x3cad1a[_0xeda8('0x23')]===_0xeda8('0x22');var _0x1ea317=_0x5eecb7['count'];var _0x17f868=_0x3b8f75?0x0:_0x3cad1a[_0xeda8('0x21')];var _0x2741d4=_0x3b8f75?_0x5eecb7[_0xeda8('0x24')]:_0x3cad1a[_0xeda8('0x21')]+_0x3cad1a[_0xeda8('0x23')];var _0x5e4257;if(_0x2741d4>=_0x1ea317){_0x2741d4=_0x1ea317;_0x5e4257=0xc8;}else{_0x5e4257=0xce;}_0x73e0e9[_0xeda8('0x1f')](_0x5e4257);return _0x73e0e9['set'](_0xeda8('0x25'),_0x17f868+'-'+_0x2741d4+'/'+_0x1ea317)[_0xeda8('0x26')](_0x5eecb7);}return null;};}function patchUpdates(_0x4549a2){return function(_0x279cb0){try{jsonpatch[_0xeda8('0x27')](_0x279cb0,_0x4549a2,!![]);}catch(_0x31a0d4){return BPromise[_0xeda8('0x28')](_0x31a0d4);}return _0x279cb0[_0xeda8('0x29')]();};}function saveUpdates(_0x326593,_0x588a94){return function(_0x202fe0){if(_0x202fe0){return _0x202fe0[_0xeda8('0x2a')](_0x326593)[_0xeda8('0x2b')](function(_0x2dd14b){return _0x2dd14b;});}return null;};}function removeEntity(_0x41aeca,_0x5b3fc2){return function(_0x4d0d31){if(_0x4d0d31){return _0x4d0d31[_0xeda8('0x2c')]()[_0xeda8('0x2b')](function(){var _0xb9fe80=_0x4d0d31[_0xeda8('0x2d')]({'plain':!![]});var _0x238006=_0xeda8('0x2e');return db[_0xeda8('0x2f')][_0xeda8('0x2c')]({'where':{'type':_0x238006,'resourceId':_0xb9fe80['id']}})[_0xeda8('0x2b')](function(){return _0x4d0d31;});})[_0xeda8('0x2b')](function(){_0x41aeca[_0xeda8('0x1f')](0xcc)[_0xeda8('0x20')]();});}};}function handleEntityNotFound(_0x4454b9,_0x49e2e8){return function(_0x32a7c7){if(!_0x32a7c7){_0x4454b9[_0xeda8('0x1e')](0x194);}return _0x32a7c7;};}function handleError(_0x24bfce,_0x12ea3d){_0x12ea3d=_0x12ea3d||0x1f4;return function(_0x495f8b){logger['error'](_0x495f8b[_0xeda8('0x30')]);if(_0x495f8b[_0xeda8('0x31')]){delete _0x495f8b[_0xeda8('0x31')];}_0x24bfce[_0xeda8('0x1f')](_0x12ea3d)[_0xeda8('0x32')](_0x495f8b);};}exports[_0xeda8('0x33')]=function(_0x2646a9,_0x501947){var _0x2eb92f={},_0x25ad0b={},_0x5b88e3={'count':0x0,'rows':[]};var _0x4780a7=_[_0xeda8('0x34')](db[_0xeda8('0x35')]['rawAttributes'],function(_0x23d241){return{'name':_0x23d241['fieldName'],'type':_0x23d241[_0xeda8('0x36')][_0xeda8('0x37')]};});_0x25ad0b[_0xeda8('0x38')]=_[_0xeda8('0x34')](_0x4780a7,_0xeda8('0x31'));_0x25ad0b[_0xeda8('0x39')]=_[_0xeda8('0x3a')](_0x2646a9[_0xeda8('0x39')]);_0x25ad0b[_0xeda8('0x3b')]=_[_0xeda8('0x3c')](_0x25ad0b[_0xeda8('0x38')],_0x25ad0b[_0xeda8('0x39')]);_0x2eb92f['attributes']=_[_0xeda8('0x3c')](_0x25ad0b['model'],qs[_0xeda8('0x3d')](_0x2646a9['query'][_0xeda8('0x3d')]));_0x2eb92f['attributes']=_0x2eb92f[_0xeda8('0x3e')]['length']?_0x2eb92f['attributes']:_0x25ad0b[_0xeda8('0x38')];if(!_0x2646a9[_0xeda8('0x39')][_0xeda8('0x3f')](_0xeda8('0x40'))){_0x2eb92f[_0xeda8('0x23')]=qs[_0xeda8('0x23')](_0x2646a9[_0xeda8('0x39')][_0xeda8('0x23')]);_0x2eb92f['offset']=qs[_0xeda8('0x21')](_0x2646a9[_0xeda8('0x39')][_0xeda8('0x21')]);}_0x2eb92f[_0xeda8('0x41')]=qs[_0xeda8('0x42')](_0x2646a9[_0xeda8('0x39')]['sort']);_0x2eb92f[_0xeda8('0x43')]=qs[_0xeda8('0x3b')](_['pick'](_0x2646a9['query'],_0x25ad0b[_0xeda8('0x3b')]),_0x4780a7);if(_0x2646a9[_0xeda8('0x39')][_0xeda8('0x44')]){_0x2eb92f[_0xeda8('0x43')]=_['merge'](_0x2eb92f[_0xeda8('0x43')],{'$or':_[_0xeda8('0x34')](_0x4780a7,function(_0x1bdd78){if(_0x1bdd78[_0xeda8('0x36')]!==_0xeda8('0x45')){var _0x1c46b9={};_0x1c46b9[_0x1bdd78[_0xeda8('0x31')]]={'$like':'%'+_0x2646a9[_0xeda8('0x39')][_0xeda8('0x44')]+'%'};return _0x1c46b9;}})});}_0x2eb92f=_['merge']({},_0x2eb92f,_0x2646a9[_0xeda8('0x46')]);var _0x1aaea1={'where':_0x2eb92f[_0xeda8('0x43')]};return db[_0xeda8('0x35')][_0xeda8('0x24')](_0x1aaea1)[_0xeda8('0x2b')](function(_0x38c285){_0x5b88e3[_0xeda8('0x24')]=_0x38c285;if(_0x2646a9[_0xeda8('0x39')][_0xeda8('0x47')]){_0x2eb92f[_0xeda8('0x48')]=[{'all':!![]}];}return db[_0xeda8('0x35')][_0xeda8('0x49')](_0x2eb92f);})[_0xeda8('0x2b')](function(_0x495bfe){_0x5b88e3['rows']=_0x495bfe;return _0x5b88e3;})[_0xeda8('0x2b')](respondWithFilteredResult(_0x501947,_0x2eb92f))['catch'](handleError(_0x501947,null));};exports[_0xeda8('0x4a')]=function(_0x1cb48e,_0x542126){var _0x31287a={'raw':!![],'where':{'id':_0x1cb48e[_0xeda8('0x4b')]['id']}},_0x31a0bf={};_0x31a0bf['model']=_[_0xeda8('0x3a')](db[_0xeda8('0x35')][_0xeda8('0x4c')]);_0x31a0bf[_0xeda8('0x39')]=_[_0xeda8('0x3a')](_0x1cb48e['query']);_0x31a0bf['filters']=_['intersection'](_0x31a0bf[_0xeda8('0x38')],_0x31a0bf[_0xeda8('0x39')]);_0x31287a[_0xeda8('0x3e')]=_[_0xeda8('0x3c')](_0x31a0bf[_0xeda8('0x38')],qs[_0xeda8('0x3d')](_0x1cb48e[_0xeda8('0x39')][_0xeda8('0x3d')]));_0x31287a['attributes']=_0x31287a[_0xeda8('0x3e')]['length']?_0x31287a[_0xeda8('0x3e')]:_0x31a0bf[_0xeda8('0x38')];if(_0x1cb48e[_0xeda8('0x39')]['includeAll']){_0x31287a[_0xeda8('0x48')]=[{'all':!![]}];}_0x31287a=_[_0xeda8('0x4d')]({},_0x31287a,_0x1cb48e[_0xeda8('0x46')]);return db[_0xeda8('0x35')]['find'](_0x31287a)[_0xeda8('0x2b')](handleEntityNotFound(_0x542126,null))['then'](respondWithResult(_0x542126,null))[_0xeda8('0x4e')](handleError(_0x542126,null));};exports[_0xeda8('0x4f')]=function(_0x519294,_0x504af4){return db[_0xeda8('0x35')][_0xeda8('0x4f')](_0x519294[_0xeda8('0x50')],{})[_0xeda8('0x2b')](function(_0x4498a9){var _0x5ce804=_0x519294['user'][_0xeda8('0x2d')]({'plain':!![]});if(!_0x5ce804)throw new Error(_0xeda8('0x51'));if(_0x5ce804[_0xeda8('0x52')]===_0xeda8('0x53')){var _0x14258b=_0x4498a9[_0xeda8('0x2d')]({'plain':!![]});var _0x46269b=_0xeda8('0x2e');return db[_0xeda8('0x54')][_0xeda8('0x55')]({'where':{'name':_0x46269b,'userProfileId':_0x5ce804['userProfileId']},'raw':!![]})[_0xeda8('0x2b')](function(_0x4a61ba){if(_0x4a61ba&&_0x4a61ba[_0xeda8('0x56')]===0x0){return db[_0xeda8('0x2f')][_0xeda8('0x4f')]({'name':_0x14258b[_0xeda8('0x31')],'resourceId':_0x14258b['id'],'type':_0x4a61ba[_0xeda8('0x31')],'sectionId':_0x4a61ba['id']},{})['then'](function(){return _0x4498a9;});}else{return _0x4498a9;}})[_0xeda8('0x4e')](function(_0xef1c03){logger[_0xeda8('0x57')](_0xeda8('0x58'),_0xef1c03);throw _0xef1c03;});}return _0x4498a9;})[_0xeda8('0x2b')](respondWithResult(_0x504af4,0xc9))[_0xeda8('0x4e')](handleError(_0x504af4,null));};exports[_0xeda8('0x2a')]=function(_0x4a511a,_0xfc453){if(_0x4a511a[_0xeda8('0x50')]['id']){delete _0x4a511a[_0xeda8('0x50')]['id'];}return db[_0xeda8('0x35')]['find']({'where':{'id':_0x4a511a['params']['id']}})['then'](handleEntityNotFound(_0xfc453,null))[_0xeda8('0x2b')](saveUpdates(_0x4a511a['body'],null))[_0xeda8('0x2b')](respondWithResult(_0xfc453,null))[_0xeda8('0x4e')](handleError(_0xfc453,null));};exports[_0xeda8('0x2c')]=function(_0x39e184,_0x2b10c9){return db[_0xeda8('0x35')][_0xeda8('0x55')]({'where':{'id':_0x39e184['params']['id']}})[_0xeda8('0x2b')](handleEntityNotFound(_0x2b10c9,null))[_0xeda8('0x2b')](removeEntity(_0x2b10c9,null))[_0xeda8('0x4e')](handleError(_0x2b10c9,null));}; \ No newline at end of file +var _0xcfa6=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','CmContactHasItem','findAll','rows','show','params','length','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','CmContactHasItems','error','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xcfa6,0x177));var _0x6cfa=function(_0x33f6be,_0x2864a6){_0x33f6be=_0x33f6be-0x0;var _0x3de6ac=_0xcfa6[_0x33f6be];return _0x3de6ac;};'use strict';var emlformat=require(_0x6cfa('0x0'));var rimraf=require(_0x6cfa('0x1'));var zipdir=require(_0x6cfa('0x2'));var jsonpatch=require(_0x6cfa('0x3'));var rp=require(_0x6cfa('0x4'));var moment=require('moment');var BPromise=require(_0x6cfa('0x5'));var Mustache=require(_0x6cfa('0x6'));var util=require('util');var path=require(_0x6cfa('0x7'));var sox=require(_0x6cfa('0x8'));var csv=require('to-csv');var ejs=require(_0x6cfa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cfa('0xa'));var squel=require('squel');var crypto=require(_0x6cfa('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6cfa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cfa('0xd'));var authService=require(_0x6cfa('0xe'));var qs=require(_0x6cfa('0xf'));var as=require(_0x6cfa('0x10'));var hardwareService=require(_0x6cfa('0x11'));var logger=require(_0x6cfa('0x12'))(_0x6cfa('0x13'));var utils=require(_0x6cfa('0x14'));var config=require(_0x6cfa('0x15'));var licenseUtil=require(_0x6cfa('0x16'));var db=require(_0x6cfa('0x17'))['db'];function respondWithStatusCode(_0x4b4f69,_0x3fed7a){_0x3fed7a=_0x3fed7a||0xcc;return function(_0xde8cb2){if(_0xde8cb2){return _0x4b4f69[_0x6cfa('0x18')](_0x3fed7a);}return _0x4b4f69[_0x6cfa('0x19')](_0x3fed7a)[_0x6cfa('0x1a')]();};}function respondWithResult(_0x1b29fe,_0xda6476){_0xda6476=_0xda6476||0xc8;return function(_0x4d6ee4){if(_0x4d6ee4){return _0x1b29fe[_0x6cfa('0x19')](_0xda6476)['json'](_0x4d6ee4);}};}function respondWithFilteredResult(_0x4facb3,_0x513bb0){return function(_0x5a7895){if(_0x5a7895){var _0x297dc1=typeof _0x513bb0[_0x6cfa('0x1b')]===_0x6cfa('0x1c')&&typeof _0x513bb0[_0x6cfa('0x1d')]===_0x6cfa('0x1c');var _0x183481=_0x5a7895[_0x6cfa('0x1e')];var _0x35a7e7=_0x297dc1?0x0:_0x513bb0[_0x6cfa('0x1b')];var _0x1df6b5=_0x297dc1?_0x5a7895[_0x6cfa('0x1e')]:_0x513bb0['offset']+_0x513bb0[_0x6cfa('0x1d')];var _0x957195;if(_0x1df6b5>=_0x183481){_0x1df6b5=_0x183481;_0x957195=0xc8;}else{_0x957195=0xce;}_0x4facb3[_0x6cfa('0x19')](_0x957195);return _0x4facb3[_0x6cfa('0x1f')](_0x6cfa('0x20'),_0x35a7e7+'-'+_0x1df6b5+'/'+_0x183481)[_0x6cfa('0x21')](_0x5a7895);}return null;};}function patchUpdates(_0x10232c){return function(_0x8700a6){try{jsonpatch[_0x6cfa('0x22')](_0x8700a6,_0x10232c,!![]);}catch(_0x22d087){return BPromise['reject'](_0x22d087);}return _0x8700a6[_0x6cfa('0x23')]();};}function saveUpdates(_0x59e285,_0x4431ef){return function(_0x468ef7){if(_0x468ef7){return _0x468ef7[_0x6cfa('0x24')](_0x59e285)[_0x6cfa('0x25')](function(_0x4a773a){return _0x4a773a;});}return null;};}function removeEntity(_0x12cfbd,_0x3edad4){return function(_0x4075b8){if(_0x4075b8){return _0x4075b8[_0x6cfa('0x26')]()['then'](function(){var _0x4a6f0e=_0x4075b8[_0x6cfa('0x27')]({'plain':!![]});var _0x5ccd=_0x6cfa('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5ccd,'resourceId':_0x4a6f0e['id']}})['then'](function(){return _0x4075b8;});})[_0x6cfa('0x25')](function(){_0x12cfbd['status'](0xcc)[_0x6cfa('0x1a')]();});}};}function handleEntityNotFound(_0xcabfc,_0x111269){return function(_0x528dbc){if(!_0x528dbc){_0xcabfc[_0x6cfa('0x18')](0x194);}return _0x528dbc;};}function handleError(_0x2c94c9,_0x1377df){_0x1377df=_0x1377df||0x1f4;return function(_0x1f25dd){logger[_0x6cfa('0x29')](_0x1f25dd[_0x6cfa('0x2a')]);if(_0x1f25dd[_0x6cfa('0x2b')]){delete _0x1f25dd[_0x6cfa('0x2b')];}_0x2c94c9['status'](_0x1377df)[_0x6cfa('0x2c')](_0x1f25dd);};}exports['index']=function(_0x4095ab,_0x1e6304){var _0x3c3424={},_0x4640c0={},_0x43e12f={'count':0x0,'rows':[]};var _0x5758cf=_[_0x6cfa('0x2d')](db['CmContactHasItem'][_0x6cfa('0x2e')],function(_0x2c9c3e){return{'name':_0x2c9c3e[_0x6cfa('0x2f')],'type':_0x2c9c3e[_0x6cfa('0x30')][_0x6cfa('0x31')]};});_0x4640c0['model']=_[_0x6cfa('0x2d')](_0x5758cf,_0x6cfa('0x2b'));_0x4640c0[_0x6cfa('0x32')]=_[_0x6cfa('0x33')](_0x4095ab['query']);_0x4640c0[_0x6cfa('0x34')]=_[_0x6cfa('0x35')](_0x4640c0[_0x6cfa('0x36')],_0x4640c0[_0x6cfa('0x32')]);_0x3c3424[_0x6cfa('0x37')]=_[_0x6cfa('0x35')](_0x4640c0['model'],qs['fields'](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x38')]));_0x3c3424[_0x6cfa('0x37')]=_0x3c3424[_0x6cfa('0x37')]['length']?_0x3c3424['attributes']:_0x4640c0[_0x6cfa('0x36')];if(!_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x39')](_0x6cfa('0x3a'))){_0x3c3424[_0x6cfa('0x1d')]=qs[_0x6cfa('0x1d')](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x1d')]);_0x3c3424[_0x6cfa('0x1b')]=qs[_0x6cfa('0x1b')](_0x4095ab['query'][_0x6cfa('0x1b')]);}_0x3c3424[_0x6cfa('0x3b')]=qs['sort'](_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3c')]);_0x3c3424[_0x6cfa('0x3d')]=qs['filters'](_[_0x6cfa('0x3e')](_0x4095ab[_0x6cfa('0x32')],_0x4640c0[_0x6cfa('0x34')]),_0x5758cf);if(_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3f')]){_0x3c3424[_0x6cfa('0x3d')]=_['merge'](_0x3c3424['where'],{'$or':_[_0x6cfa('0x2d')](_0x5758cf,function(_0x16d28a){if(_0x16d28a[_0x6cfa('0x30')]!==_0x6cfa('0x40')){var _0x3bc0a3={};_0x3bc0a3[_0x16d28a[_0x6cfa('0x2b')]]={'$like':'%'+_0x4095ab[_0x6cfa('0x32')][_0x6cfa('0x3f')]+'%'};return _0x3bc0a3;}})});}_0x3c3424=_['merge']({},_0x3c3424,_0x4095ab[_0x6cfa('0x41')]);var _0x4e00cb={'where':_0x3c3424[_0x6cfa('0x3d')]};return db['CmContactHasItem']['count'](_0x4e00cb)[_0x6cfa('0x25')](function(_0x4fd9cc){_0x43e12f['count']=_0x4fd9cc;if(_0x4095ab['query'][_0x6cfa('0x42')]){_0x3c3424['include']=[{'all':!![]}];}return db[_0x6cfa('0x43')][_0x6cfa('0x44')](_0x3c3424);})[_0x6cfa('0x25')](function(_0x148288){_0x43e12f[_0x6cfa('0x45')]=_0x148288;return _0x43e12f;})['then'](respondWithFilteredResult(_0x1e6304,_0x3c3424))['catch'](handleError(_0x1e6304,null));};exports[_0x6cfa('0x46')]=function(_0x282632,_0x120f2f){var _0x52a74a={'raw':!![],'where':{'id':_0x282632[_0x6cfa('0x47')]['id']}},_0x2bbdc5={};_0x2bbdc5[_0x6cfa('0x36')]=_['keys'](db[_0x6cfa('0x43')][_0x6cfa('0x2e')]);_0x2bbdc5['query']=_[_0x6cfa('0x33')](_0x282632[_0x6cfa('0x32')]);_0x2bbdc5['filters']=_[_0x6cfa('0x35')](_0x2bbdc5[_0x6cfa('0x36')],_0x2bbdc5[_0x6cfa('0x32')]);_0x52a74a['attributes']=_[_0x6cfa('0x35')](_0x2bbdc5['model'],qs['fields'](_0x282632[_0x6cfa('0x32')][_0x6cfa('0x38')]));_0x52a74a['attributes']=_0x52a74a['attributes'][_0x6cfa('0x48')]?_0x52a74a[_0x6cfa('0x37')]:_0x2bbdc5[_0x6cfa('0x36')];if(_0x282632['query'][_0x6cfa('0x42')]){_0x52a74a[_0x6cfa('0x49')]=[{'all':!![]}];}_0x52a74a=_[_0x6cfa('0x4a')]({},_0x52a74a,_0x282632['options']);return db[_0x6cfa('0x43')][_0x6cfa('0x4b')](_0x52a74a)[_0x6cfa('0x25')](handleEntityNotFound(_0x120f2f,null))[_0x6cfa('0x25')](respondWithResult(_0x120f2f,null))[_0x6cfa('0x4c')](handleError(_0x120f2f,null));};exports[_0x6cfa('0x4d')]=function(_0x1c5ecf,_0x1110b7){return db[_0x6cfa('0x43')][_0x6cfa('0x4d')](_0x1c5ecf[_0x6cfa('0x4e')],{})['then'](function(_0xc187f7){var _0x16800c=_0x1c5ecf[_0x6cfa('0x4f')]['get']({'plain':!![]});if(!_0x16800c)throw new Error(_0x6cfa('0x50'));if(_0x16800c[_0x6cfa('0x51')]===_0x6cfa('0x4f')){var _0x1276f5=_0xc187f7['get']({'plain':!![]});var _0x5d057b='CmContactHasItems';return db[_0x6cfa('0x52')][_0x6cfa('0x4b')]({'where':{'name':_0x5d057b,'userProfileId':_0x16800c[_0x6cfa('0x53')]},'raw':!![]})['then'](function(_0x3a15ab){if(_0x3a15ab&&_0x3a15ab['autoAssociation']===0x0){return db['UserProfileResource'][_0x6cfa('0x4d')]({'name':_0x1276f5[_0x6cfa('0x2b')],'resourceId':_0x1276f5['id'],'type':_0x3a15ab[_0x6cfa('0x2b')],'sectionId':_0x3a15ab['id']},{})[_0x6cfa('0x25')](function(){return _0xc187f7;});}else{return _0xc187f7;}})[_0x6cfa('0x4c')](function(_0x23e742){logger[_0x6cfa('0x29')](_0x6cfa('0x54'),_0x23e742);throw _0x23e742;});}return _0xc187f7;})[_0x6cfa('0x25')](respondWithResult(_0x1110b7,0xc9))['catch'](handleError(_0x1110b7,null));};exports[_0x6cfa('0x24')]=function(_0x466ee5,_0x1e3675){if(_0x466ee5[_0x6cfa('0x4e')]['id']){delete _0x466ee5[_0x6cfa('0x4e')]['id'];}return db[_0x6cfa('0x43')]['find']({'where':{'id':_0x466ee5['params']['id']}})[_0x6cfa('0x25')](handleEntityNotFound(_0x1e3675,null))['then'](saveUpdates(_0x466ee5[_0x6cfa('0x4e')],null))[_0x6cfa('0x25')](respondWithResult(_0x1e3675,null))['catch'](handleError(_0x1e3675,null));};exports[_0x6cfa('0x26')]=function(_0x7d3bd1,_0x3fb088){return db[_0x6cfa('0x43')][_0x6cfa('0x4b')]({'where':{'id':_0x7d3bd1[_0x6cfa('0x47')]['id']}})[_0x6cfa('0x25')](handleEntityNotFound(_0x3fb088,null))[_0x6cfa('0x25')](removeEntity(_0x3fb088,null))[_0x6cfa('0x4c')](handleError(_0x3fb088,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 603abd4..224f10f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8429=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','rimraf','./cmContactHasItem.attributes','define'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x8429,0x1b0));var _0x9842=function(_0x272162,_0x4ae51a){_0x272162=_0x272162-0x0;var _0x43aeb7=_0x8429[_0x272162];return _0x43aeb7;};'use strict';var _=require(_0x9842('0x0'));var util=require(_0x9842('0x1'));var logger=require(_0x9842('0x2'))(_0x9842('0x3'));var moment=require(_0x9842('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9842('0x5'));var config=require('../../config/environment');var attributes=require(_0x9842('0x6'));module['exports']=function(_0x720880,_0x350ac2){return _0x720880[_0x9842('0x7')](_0x9842('0x8'),attributes,{'tableName':_0x9842('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42fb=['api','request-promise','path','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x223611,_0x31b708){var _0x53ccaa=function(_0x49787e){while(--_0x49787e){_0x223611['push'](_0x223611['shift']());}};_0x53ccaa(++_0x31b708);}(_0x42fb,0xe3));var _0xb42f=function(_0x3b7b79,_0x35cb05){_0x3b7b79=_0x3b7b79-0x0;var _0x3e0ed0=_0x42fb[_0x3b7b79];return _0x3e0ed0;};'use strict';var _=require(_0xb42f('0x0'));var util=require(_0xb42f('0x1'));var logger=require(_0xb42f('0x2'))(_0xb42f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb42f('0x4'));var fs=require('fs');var path=require(_0xb42f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb42f('0x6'));module[_0xb42f('0x7')]=function(_0x854ea3,_0x1235c1){return _0x854ea3['define'](_0xb42f('0x8'),attributes,{'tableName':_0xb42f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 0e6e97e..cf2bc30 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fb3=['../../config/utils','../../config/logger','rpc','../../config/environment','client','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x34664d,_0x5a9943){var _0x2865cf=function(_0x292b04){while(--_0x292b04){_0x34664d['push'](_0x34664d['shift']());}};_0x2865cf(++_0x5a9943);}(_0x7fb3,0x11c));var _0x37fb=function(_0x29af0e,_0x35f669){_0x29af0e=_0x29af0e-0x0;var _0x349e39=_0x7fb3[_0x29af0e];return _0x349e39;};'use strict';var _=require(_0x37fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x37fb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37fb('0x2'));var db=require(_0x37fb('0x3'))['db'];var utils=require(_0x37fb('0x4'));var logger=require(_0x37fb('0x5'))(_0x37fb('0x6'));var config=require(_0x37fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x37fb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101e29,_0x3e12e2,_0x4b4796){return new BPromise(function(_0x5e662a,_0x30ccb7){return client['request'](_0x101e29,_0x4b4796)['then'](function(_0x19409e){logger[_0x37fb('0x9')](_0x37fb('0xa'),_0x3e12e2,'request\x20sent');logger[_0x37fb('0xb')](_0x37fb('0xc'),_0x3e12e2,'request\x20sent',JSON['stringify'](_0x19409e));if(_0x19409e[_0x37fb('0xd')]){if(_0x19409e[_0x37fb('0xd')]['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3e12e2,_0x19409e[_0x37fb('0xd')][_0x37fb('0xe')]);return _0x30ccb7(_0x19409e[_0x37fb('0xd')][_0x37fb('0xe')]);}logger['error'](_0x37fb('0xa'),_0x3e12e2,_0x19409e[_0x37fb('0xd')][_0x37fb('0xe')]);return _0x5e662a(_0x19409e[_0x37fb('0xd')][_0x37fb('0xe')]);}else{logger[_0x37fb('0x9')](_0x37fb('0xa'),_0x3e12e2,_0x37fb('0xf'));_0x5e662a(_0x19409e[_0x37fb('0x10')][_0x37fb('0xe')]);}})[_0x37fb('0x11')](function(_0xed8474){logger[_0x37fb('0xd')](_0x37fb('0xa'),_0x3e12e2,_0xed8474);_0x30ccb7(_0xed8474);});});} \ No newline at end of file +var _0x4ecb=['error','code','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x42a570,_0x23d19b){var _0x3eb4d9=function(_0x4537c3){while(--_0x4537c3){_0x42a570['push'](_0x42a570['shift']());}};_0x3eb4d9(++_0x23d19b);}(_0x4ecb,0x1ba));var _0xb4ec=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x4ecb[_0xac151d];return _0x111dba;};'use strict';var _=require(_0xb4ec('0x0'));var util=require(_0xb4ec('0x1'));var moment=require('moment');var BPromise=require(_0xb4ec('0x2'));var rs=require(_0xb4ec('0x3'));var fs=require('fs');var Redis=require(_0xb4ec('0x4'));var db=require(_0xb4ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb4ec('0x6'));var config=require('../../config/environment');var jayson=require(_0xb4ec('0x7'));var client=jayson[_0xb4ec('0x8')][_0xb4ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205a9a,_0x501480,_0xc7594c){return new BPromise(function(_0x17233d,_0x1bfb09){return client['request'](_0x205a9a,_0xc7594c)['then'](function(_0x3c1fbc){logger[_0xb4ec('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x501480,'request\x20sent');logger['debug'](_0xb4ec('0xb'),_0x501480,_0xb4ec('0xc'),JSON[_0xb4ec('0xd')](_0x3c1fbc));if(_0x3c1fbc[_0xb4ec('0xe')]){if(_0x3c1fbc['error'][_0xb4ec('0xf')]===0x1f4){logger[_0xb4ec('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x501480,_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);return _0x1bfb09(_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x501480,_0x3c1fbc[_0xb4ec('0xe')][_0xb4ec('0x10')]);return _0x17233d(_0x3c1fbc[_0xb4ec('0xe')]['message']);}else{logger[_0xb4ec('0xa')](_0xb4ec('0x11'),_0x501480,'request\x20sent');_0x17233d(_0x3c1fbc['result'][_0xb4ec('0x10')]);}})[_0xb4ec('0x12')](function(_0x3bb9a9){logger[_0xb4ec('0xe')](_0xb4ec('0x11'),_0x501480,_0x3bb9a9);_0x1bfb09(_0x3bb9a9);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9589930..72780bb 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69a3=['/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x58c58a,_0x3f714e){var _0x23a363=function(_0x1b0fe6){while(--_0x1b0fe6){_0x58c58a['push'](_0x58c58a['shift']());}};_0x23a363(++_0x3f714e);}(_0x69a3,0x8f));var _0x369a=function(_0x900dad,_0x48b2d5){_0x900dad=_0x900dad-0x0;var _0x3a1b58=_0x69a3[_0x900dad];return _0x3a1b58;};'use strict';var multer=require(_0x369a('0x0'));var util=require(_0x369a('0x1'));var path=require(_0x369a('0x2'));var timeout=require(_0x369a('0x3'));var express=require(_0x369a('0x4'));var router=express[_0x369a('0x5')]();var fs_extra=require(_0x369a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x369a('0x7'));var config=require(_0x369a('0x8'));var controller=require(_0x369a('0x9'));router[_0x369a('0xa')]('/',auth[_0x369a('0xb')](),controller[_0x369a('0xc')]);router[_0x369a('0xa')]('/:id',auth[_0x369a('0xb')](),controller[_0x369a('0xd')]);router[_0x369a('0xe')]('/',auth[_0x369a('0xb')](),controller[_0x369a('0xf')]);router[_0x369a('0x10')](_0x369a('0x11'),auth[_0x369a('0xb')](),controller[_0x369a('0x12')]);router['delete'](_0x369a('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x369a('0x13')]=router; \ No newline at end of file +var _0x5454=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0x5454,0x15b));var _0x4545=function(_0x257e9c,_0x5cb237){_0x257e9c=_0x257e9c-0x0;var _0x16031c=_0x5454[_0x257e9c];return _0x16031c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4545('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4545('0x1'));var interaction=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var controller=require(_0x4545('0x4'));router['get']('/',auth[_0x4545('0x5')](),controller[_0x4545('0x6')]);router[_0x4545('0x7')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0x9')]);router[_0x4545('0xa')]('/',auth[_0x4545('0x5')](),controller[_0x4545('0xb')]);router[_0x4545('0xc')](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xd')]);router['delete'](_0x4545('0x8'),auth[_0x4545('0x5')](),controller[_0x4545('0xe')]);module[_0x4545('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 34410c3..9d8d5c0 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 _0x9e5f=['TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name'];(function(_0x4391a6,_0x55e0c2){var _0x1ee86e=function(_0x59618d){while(--_0x59618d){_0x4391a6['push'](_0x4391a6['shift']());}};_0x1ee86e(++_0x55e0c2);}(_0x9e5f,0x69));var _0xf9e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf9e5('0x0'));var _=require(_0xf9e5('0x1'));module[_0xf9e5('0x2')]={'name':{'type':Sequelize[_0xf9e5('0x3')],'get':function(_0x15a408){return this[_0xf9e5('0x4')](_0xf9e5('0x5'));}},'alias':{'type':Sequelize[_0xf9e5('0x6')],'allowNull':![],'set':function(_0x302567){this[_0xf9e5('0x7')](_0xf9e5('0x5'),_0x302567?_0x302567:this[_0xf9e5('0x4')](_0xf9e5('0x8')));}},'type':{'type':Sequelize[_0xf9e5('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xf9e5('0x9')](_0xf9e5('0xa')),'get':function(){if(this['getDataValue'](_0xf9e5('0xb'))===_0xf9e5('0xc')){return JSON[_0xf9e5('0xd')](this[_0xf9e5('0x4')]('values'));}else{return this['getDataValue'](_0xf9e5('0xe'));}},'set':function(_0x5a47be){if(Array[_0xf9e5('0xf')](_0x5a47be)){this[_0xf9e5('0x7')](_0xf9e5('0xe'),JSON[_0xf9e5('0x10')](_0x5a47be));}else{this[_0xf9e5('0x7')](_0xf9e5('0xe'),_0x5a47be);}}},'required':{'type':Sequelize[_0xf9e5('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf9e5('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xf9e5('0x12'))}}; \ No newline at end of file +var _0x82da=['parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','alias','STRING','setDataValue','getDataValue','name','TEXT','select'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x82da,0xe6));var _0xa82d=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x82da[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0xa82d('0x0'));var _=require(_0xa82d('0x1'));module[_0xa82d('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f49b4){return this['getDataValue'](_0xa82d('0x3'));}},'alias':{'type':Sequelize[_0xa82d('0x4')],'allowNull':![],'set':function(_0x3ef8d3){this[_0xa82d('0x5')](_0xa82d('0x3'),_0x3ef8d3?_0x3ef8d3:this[_0xa82d('0x6')](_0xa82d('0x7')));}},'type':{'type':Sequelize[_0xa82d('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa82d('0x8')]('long'),'get':function(){if(this[_0xa82d('0x6')]('type')===_0xa82d('0x9')){return JSON[_0xa82d('0xa')](this['getDataValue'](_0xa82d('0xb')));}else{return this[_0xa82d('0x6')]('values');}},'set':function(_0x3774a5){if(Array[_0xa82d('0xc')](_0x3774a5)){this[_0xa82d('0x5')](_0xa82d('0xb'),JSON[_0xa82d('0xd')](_0x3774a5));}else{this['setDataValue'](_0xa82d('0xb'),_0x3774a5);}}},'required':{'type':Sequelize[_0xa82d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa82d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa82d('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1629b40..6c38135 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 _0x80dd=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','json','apply','reject','then','destroy','stack','name','send','index','map','CmCustomField','fieldName','type','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','catch','keys','include','update','body','find','params','sequelize','transaction','create','Sequelize','TEXT','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x24431a,_0x52459a){var _0x454ec7=function(_0x34cd60){while(--_0x34cd60){_0x24431a['push'](_0x24431a['shift']());}};_0x454ec7(++_0x52459a);}(_0x80dd,0x8b));var _0xd80d=function(_0x3b23be,_0x3ebe5a){_0x3b23be=_0x3b23be-0x0;var _0x4fc9bd=_0x80dd[_0x3b23be];return _0x4fc9bd;};'use strict';var emlformat=require(_0xd80d('0x0'));var rimraf=require(_0xd80d('0x1'));var zipdir=require(_0xd80d('0x2'));var jsonpatch=require(_0xd80d('0x3'));var rp=require(_0xd80d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd80d('0x5'));var util=require('util');var path=require(_0xd80d('0x6'));var sox=require(_0xd80d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd80d('0x8'));var _=require('lodash');var squel=require(_0xd80d('0x9'));var crypto=require('crypto');var jsforce=require(_0xd80d('0xa'));var deskjs=require(_0xd80d('0xb'));var toCsv=require(_0xd80d('0xc'));var querystring=require('querystring');var Papa=require(_0xd80d('0xd'));var Redis=require(_0xd80d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd80d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80d('0x10'));var logger=require(_0xd80d('0x11'))('api');var utils=require(_0xd80d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd80d('0x13'));var db=require(_0xd80d('0x14'))['db'];function respondWithStatusCode(_0x49c2a4,_0x5aeadc){_0x5aeadc=_0x5aeadc||0xcc;return function(_0x13a237){if(_0x13a237){return _0x49c2a4['sendStatus'](_0x5aeadc);}return _0x49c2a4[_0xd80d('0x15')](_0x5aeadc)[_0xd80d('0x16')]();};}function respondWithResult(_0x5b0020,_0x29602d){_0x29602d=_0x29602d||0xc8;return function(_0x2452c8){if(_0x2452c8){return _0x5b0020['status'](_0x29602d)['json'](_0x2452c8);}};}function respondWithFilteredResult(_0x2c0dd6,_0x2c065b){return function(_0x548b84){if(_0x548b84){var _0x35826b=typeof _0x2c065b[_0xd80d('0x17')]==='undefined'&&typeof _0x2c065b[_0xd80d('0x18')]===_0xd80d('0x19');var _0x456281=_0x548b84['count'];var _0xe1ca=_0x35826b?0x0:_0x2c065b[_0xd80d('0x17')];var _0x36daee=_0x35826b?_0x548b84['count']:_0x2c065b[_0xd80d('0x17')]+_0x2c065b['limit'];var _0xe8fcb3;if(_0x36daee>=_0x456281){_0x36daee=_0x456281;_0xe8fcb3=0xc8;}else{_0xe8fcb3=0xce;}_0x2c0dd6[_0xd80d('0x15')](_0xe8fcb3);return _0x2c0dd6['set']('Content-Range',_0xe1ca+'-'+_0x36daee+'/'+_0x456281)[_0xd80d('0x1a')](_0x548b84);}return null;};}function patchUpdates(_0x2d080a){return function(_0x2c1de3){try{jsonpatch[_0xd80d('0x1b')](_0x2c1de3,_0x2d080a,!![]);}catch(_0x76ec08){return BPromise[_0xd80d('0x1c')](_0x76ec08);}return _0x2c1de3['save']();};}function saveUpdates(_0x475c03,_0x16c288){return function(_0x25bcc3){if(_0x25bcc3){return _0x25bcc3['update'](_0x475c03)[_0xd80d('0x1d')](function(_0x118eff){return _0x118eff;});}return null;};}function removeEntity(_0xce96a,_0x3458ad){return function(_0x4526d5){if(_0x4526d5){return _0x4526d5[_0xd80d('0x1e')]()['then'](function(){_0xce96a[_0xd80d('0x15')](0xcc)[_0xd80d('0x16')]();});}};}function handleEntityNotFound(_0x38e7a7,_0x269b5e){return function(_0x183fc2){if(!_0x183fc2){_0x38e7a7['sendStatus'](0x194);}return _0x183fc2;};}function handleError(_0x4ec9fa,_0x4bcad6){_0x4bcad6=_0x4bcad6||0x1f4;return function(_0x477535){logger['error'](_0x477535[_0xd80d('0x1f')]);if(_0x477535['name']){delete _0x477535[_0xd80d('0x20')];}_0x4ec9fa[_0xd80d('0x15')](_0x4bcad6)[_0xd80d('0x21')](_0x477535);};}exports[_0xd80d('0x22')]=function(_0x52351b,_0x520d92){var _0x43b221={},_0x251cf1={},_0x3909ce={'count':0x0,'rows':[]};var _0x4b34e2=_[_0xd80d('0x23')](db[_0xd80d('0x24')]['rawAttributes'],function(_0x3c2791){return{'name':_0x3c2791[_0xd80d('0x25')],'type':_0x3c2791[_0xd80d('0x26')]['key']};});_0x251cf1['model']=_[_0xd80d('0x27')](_['map'](_0x4b34e2,'name'),[_0xd80d('0x20')]);_0x251cf1[_0xd80d('0x28')]=_['keys'](_0x52351b[_0xd80d('0x28')]);_0x251cf1[_0xd80d('0x29')]=_[_0xd80d('0x2a')](_0x251cf1[_0xd80d('0x2b')],_0x251cf1['query']);_0x43b221[_0xd80d('0x2c')]=_[_0xd80d('0x2a')](_0x251cf1['model'],qs[_0xd80d('0x2d')](_0x52351b['query']['fields']));_0x43b221[_0xd80d('0x2c')]=_0x43b221['attributes'][_0xd80d('0x2e')]?_0x43b221['attributes']:_0x251cf1['model'];if(!_0x52351b['query'][_0xd80d('0x2f')](_0xd80d('0x30'))){_0x43b221[_0xd80d('0x18')]=qs[_0xd80d('0x18')](_0x52351b['query'][_0xd80d('0x18')]);_0x43b221[_0xd80d('0x17')]=qs[_0xd80d('0x17')](_0x52351b[_0xd80d('0x28')]['offset']);}_0x43b221[_0xd80d('0x31')]=qs['sort'](_0x52351b['query'][_0xd80d('0x32')]);_0x43b221[_0xd80d('0x33')]=qs['filters'](_['pick'](_0x52351b[_0xd80d('0x28')],_0x251cf1[_0xd80d('0x29')]),_0x4b34e2);if(_0x52351b[_0xd80d('0x28')][_0xd80d('0x34')]){_0x43b221[_0xd80d('0x33')]=_[_0xd80d('0x35')](_0x43b221[_0xd80d('0x33')],{'$or':_[_0xd80d('0x23')](_0x4b34e2,function(_0x53f4fb){if(_0x53f4fb['type']!==_0xd80d('0x36')){var _0x5913c7={};_0x5913c7[_0x53f4fb[_0xd80d('0x20')]]={'$like':'%'+_0x52351b[_0xd80d('0x28')][_0xd80d('0x34')]+'%'};return _0x5913c7;}})});}_0x43b221=_[_0xd80d('0x35')]({},_0x43b221,_0x52351b[_0xd80d('0x37')]);var _0x2c3696={'where':_0x43b221[_0xd80d('0x33')]};return db[_0xd80d('0x24')][_0xd80d('0x38')](_0x2c3696)[_0xd80d('0x1d')](function(_0x1ead45){_0x3909ce[_0xd80d('0x38')]=_0x1ead45;if(_0x52351b[_0xd80d('0x28')]['includeAll']){_0x43b221['include']=[{'all':!![]}];}return db[_0xd80d('0x24')][_0xd80d('0x39')](_0x43b221);})['then'](function(_0x4753d1){_0x3909ce['rows']=_0x4753d1;return _0x3909ce;})[_0xd80d('0x1d')](respondWithFilteredResult(_0x520d92,_0x43b221))[_0xd80d('0x3a')](handleError(_0x520d92,null));};exports['show']=function(_0xf003c2,_0x1dbd24){var _0x323997={'raw':!![],'where':{'id':_0xf003c2['params']['id']}},_0x316234={};_0x316234['model']=_[_0xd80d('0x3b')](db['CmCustomField']['rawAttributes']);_0x316234[_0xd80d('0x28')]=_[_0xd80d('0x3b')](_0xf003c2[_0xd80d('0x28')]);_0x316234[_0xd80d('0x29')]=_[_0xd80d('0x2a')](_0x316234['model'],_0x316234[_0xd80d('0x28')]);_0x323997[_0xd80d('0x2c')]=_[_0xd80d('0x2a')](_0x316234[_0xd80d('0x2b')],qs[_0xd80d('0x2d')](_0xf003c2[_0xd80d('0x28')]['fields']));_0x323997[_0xd80d('0x2c')]=_0x323997['attributes']['length']?_0x323997[_0xd80d('0x2c')]:_0x316234[_0xd80d('0x2b')];if(_0xf003c2[_0xd80d('0x28')]['includeAll']){_0x323997[_0xd80d('0x3c')]=[{'all':!![]}];}_0x323997=_[_0xd80d('0x35')]({},_0x323997,_0xf003c2[_0xd80d('0x37')]);return db[_0xd80d('0x24')]['find'](_0x323997)[_0xd80d('0x1d')](handleEntityNotFound(_0x1dbd24,null))['then'](respondWithResult(_0x1dbd24,null))[_0xd80d('0x3a')](handleError(_0x1dbd24,null));};exports[_0xd80d('0x3d')]=function(_0x1a8efa,_0x176c87){if(_0x1a8efa['body']['id']){delete _0x1a8efa[_0xd80d('0x3e')]['id'];}return db[_0xd80d('0x24')][_0xd80d('0x3f')]({'where':{'id':_0x1a8efa[_0xd80d('0x40')]['id']}})[_0xd80d('0x1d')](handleEntityNotFound(_0x176c87,null))['then'](saveUpdates(_0x1a8efa['body'],null))['then'](respondWithResult(_0x176c87,null))[_0xd80d('0x3a')](handleError(_0x176c87,null));};exports[_0xd80d('0x1e')]=function(_0x2b189f,_0x7bc30a){return db[_0xd80d('0x24')][_0xd80d('0x3f')]({'where':{'id':_0x2b189f[_0xd80d('0x40')]['id']}})[_0xd80d('0x1d')](handleEntityNotFound(_0x7bc30a,null))[_0xd80d('0x1d')](removeEntity(_0x7bc30a,null))[_0xd80d('0x3a')](handleError(_0x7bc30a,null));};exports['create']=function(_0x1cc6b7,_0x1341fa){var _0x1e06da;return db[_0xd80d('0x41')][_0xd80d('0x42')](function(_0x38a69c){return db['CmCustomField'][_0xd80d('0x43')](_0x1cc6b7[_0xd80d('0x3e')],{'transaction':_0x38a69c})[_0xd80d('0x1d')](function(_0x5693de){_0x1e06da=_0x5693de;var _0x1d4488={'type':db[_0xd80d('0x44')][_0xd80d('0x45')],'transaction':_0x38a69c};switch(_0x1cc6b7['body']['type']){case'text':_0x1d4488[_0xd80d('0x26')]=db['Sequelize'][_0xd80d('0x45')];break;case'number':_0x1d4488[_0xd80d('0x26')]=db[_0xd80d('0x44')][_0xd80d('0x46')];break;case _0xd80d('0x47'):_0x1d4488[_0xd80d('0x26')]=db['Sequelize'][_0xd80d('0x48')];_0x1d4488['defaultValue']=![];break;default:}return db[_0xd80d('0x41')][_0xd80d('0x49')][_0xd80d('0x4a')]('cm_contacts',util[_0xd80d('0x4b')](_0xd80d('0x4c'),_0x1e06da['id']),_0x1d4488);})['then'](function(){return _0x1e06da;});})[_0xd80d('0x1d')](respondWithResult(_0x1341fa,0xc9))['catch'](handleError(_0x1341fa,null));}; \ No newline at end of file +var _0xa7bc=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','options','count','includeAll','include','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x3fe2c3,_0x455082){var _0xcff74c=function(_0x2fde3d){while(--_0x2fde3d){_0x3fe2c3['push'](_0x3fe2c3['shift']());}};_0xcff74c(++_0x455082);}(_0xa7bc,0x147));var _0xca7b=function(_0x5df93f,_0x175c69){_0x5df93f=_0x5df93f-0x0;var _0x37312e=_0xa7bc[_0x5df93f];return _0x37312e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xca7b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xca7b('0x2'));var util=require(_0xca7b('0x3'));var path=require(_0xca7b('0x4'));var sox=require(_0xca7b('0x5'));var csv=require('to-csv');var ejs=require(_0xca7b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca7b('0x7'));var squel=require(_0xca7b('0x8'));var crypto=require(_0xca7b('0x9'));var jsforce=require(_0xca7b('0xa'));var deskjs=require(_0xca7b('0xb'));var toCsv=require(_0xca7b('0xc'));var querystring=require(_0xca7b('0xd'));var Papa=require(_0xca7b('0xe'));var Redis=require('ioredis');var authService=require(_0xca7b('0xf'));var qs=require(_0xca7b('0x10'));var as=require(_0xca7b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca7b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xca7b('0x13'));var licenseUtil=require(_0xca7b('0x14'));var db=require(_0xca7b('0x15'))['db'];function respondWithStatusCode(_0x11a599,_0x4bb20b){_0x4bb20b=_0x4bb20b||0xcc;return function(_0x1bf18a){if(_0x1bf18a){return _0x11a599[_0xca7b('0x16')](_0x4bb20b);}return _0x11a599[_0xca7b('0x17')](_0x4bb20b)[_0xca7b('0x18')]();};}function respondWithResult(_0x4ecadc,_0x2214f3){_0x2214f3=_0x2214f3||0xc8;return function(_0xec3801){if(_0xec3801){return _0x4ecadc[_0xca7b('0x17')](_0x2214f3)[_0xca7b('0x19')](_0xec3801);}};}function respondWithFilteredResult(_0x1c8e7a,_0x25ed00){return function(_0x1ec46f){if(_0x1ec46f){var _0x28bce0=typeof _0x25ed00[_0xca7b('0x1a')]===_0xca7b('0x1b')&&typeof _0x25ed00[_0xca7b('0x1c')]===_0xca7b('0x1b');var _0x43549a=_0x1ec46f['count'];var _0x140fc5=_0x28bce0?0x0:_0x25ed00['offset'];var _0x3ba24a=_0x28bce0?_0x1ec46f['count']:_0x25ed00['offset']+_0x25ed00[_0xca7b('0x1c')];var _0x21f3a4;if(_0x3ba24a>=_0x43549a){_0x3ba24a=_0x43549a;_0x21f3a4=0xc8;}else{_0x21f3a4=0xce;}_0x1c8e7a['status'](_0x21f3a4);return _0x1c8e7a['set'](_0xca7b('0x1d'),_0x140fc5+'-'+_0x3ba24a+'/'+_0x43549a)[_0xca7b('0x19')](_0x1ec46f);}return null;};}function patchUpdates(_0x576d88){return function(_0x2e6d89){try{jsonpatch[_0xca7b('0x1e')](_0x2e6d89,_0x576d88,!![]);}catch(_0x538125){return BPromise[_0xca7b('0x1f')](_0x538125);}return _0x2e6d89[_0xca7b('0x20')]();};}function saveUpdates(_0xe8b01d,_0x519b09){return function(_0x471faa){if(_0x471faa){return _0x471faa[_0xca7b('0x21')](_0xe8b01d)['then'](function(_0x19146a){return _0x19146a;});}return null;};}function removeEntity(_0x1305a8,_0x48c27b){return function(_0x370aaf){if(_0x370aaf){return _0x370aaf[_0xca7b('0x22')]()[_0xca7b('0x23')](function(){_0x1305a8[_0xca7b('0x17')](0xcc)[_0xca7b('0x18')]();});}};}function handleEntityNotFound(_0x46e579,_0x1b56b0){return function(_0x109240){if(!_0x109240){_0x46e579[_0xca7b('0x16')](0x194);}return _0x109240;};}function handleError(_0x419b90,_0x17c644){_0x17c644=_0x17c644||0x1f4;return function(_0x2138a9){logger['error'](_0x2138a9[_0xca7b('0x24')]);if(_0x2138a9['name']){delete _0x2138a9[_0xca7b('0x25')];}_0x419b90[_0xca7b('0x17')](_0x17c644)[_0xca7b('0x26')](_0x2138a9);};}exports[_0xca7b('0x27')]=function(_0x163226,_0x5b2968){var _0x3fa904={},_0x3a76b4={},_0x5a6e06={'count':0x0,'rows':[]};var _0x431714=_[_0xca7b('0x28')](db[_0xca7b('0x29')][_0xca7b('0x2a')],function(_0x30798c){return{'name':_0x30798c['fieldName'],'type':_0x30798c[_0xca7b('0x2b')][_0xca7b('0x2c')]};});_0x3a76b4[_0xca7b('0x2d')]=_[_0xca7b('0x2e')](_[_0xca7b('0x28')](_0x431714,_0xca7b('0x25')),[_0xca7b('0x25')]);_0x3a76b4[_0xca7b('0x2f')]=_[_0xca7b('0x30')](_0x163226[_0xca7b('0x2f')]);_0x3a76b4['filters']=_['intersection'](_0x3a76b4['model'],_0x3a76b4['query']);_0x3fa904[_0xca7b('0x31')]=_[_0xca7b('0x32')](_0x3a76b4[_0xca7b('0x2d')],qs[_0xca7b('0x33')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x33')]));_0x3fa904['attributes']=_0x3fa904[_0xca7b('0x31')][_0xca7b('0x34')]?_0x3fa904[_0xca7b('0x31')]:_0x3a76b4['model'];if(!_0x163226[_0xca7b('0x2f')][_0xca7b('0x35')]('nolimit')){_0x3fa904[_0xca7b('0x1c')]=qs[_0xca7b('0x1c')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x1c')]);_0x3fa904[_0xca7b('0x1a')]=qs[_0xca7b('0x1a')](_0x163226[_0xca7b('0x2f')][_0xca7b('0x1a')]);}_0x3fa904[_0xca7b('0x36')]=qs['sort'](_0x163226[_0xca7b('0x2f')][_0xca7b('0x37')]);_0x3fa904[_0xca7b('0x38')]=qs[_0xca7b('0x39')](_['pick'](_0x163226['query'],_0x3a76b4['filters']),_0x431714);if(_0x163226['query']['filter']){_0x3fa904['where']=_['merge'](_0x3fa904[_0xca7b('0x38')],{'$or':_[_0xca7b('0x28')](_0x431714,function(_0x5430e9){if(_0x5430e9['type']!=='VIRTUAL'){var _0x1def74={};_0x1def74[_0x5430e9[_0xca7b('0x25')]]={'$like':'%'+_0x163226[_0xca7b('0x2f')]['filter']+'%'};return _0x1def74;}})});}_0x3fa904=_[_0xca7b('0x3a')]({},_0x3fa904,_0x163226[_0xca7b('0x3b')]);var _0x225132={'where':_0x3fa904['where']};return db[_0xca7b('0x29')][_0xca7b('0x3c')](_0x225132)[_0xca7b('0x23')](function(_0x46ebb0){_0x5a6e06['count']=_0x46ebb0;if(_0x163226['query'][_0xca7b('0x3d')]){_0x3fa904[_0xca7b('0x3e')]=[{'all':!![]}];}return db[_0xca7b('0x29')][_0xca7b('0x3f')](_0x3fa904);})[_0xca7b('0x23')](function(_0x36955f){_0x5a6e06[_0xca7b('0x40')]=_0x36955f;return _0x5a6e06;})[_0xca7b('0x23')](respondWithFilteredResult(_0x5b2968,_0x3fa904))[_0xca7b('0x41')](handleError(_0x5b2968,null));};exports[_0xca7b('0x42')]=function(_0x405fab,_0x34a9af){var _0x2e8540={'raw':!![],'where':{'id':_0x405fab['params']['id']}},_0x1fe819={};_0x1fe819[_0xca7b('0x2d')]=_[_0xca7b('0x30')](db[_0xca7b('0x29')][_0xca7b('0x2a')]);_0x1fe819['query']=_['keys'](_0x405fab[_0xca7b('0x2f')]);_0x1fe819[_0xca7b('0x39')]=_[_0xca7b('0x32')](_0x1fe819[_0xca7b('0x2d')],_0x1fe819[_0xca7b('0x2f')]);_0x2e8540[_0xca7b('0x31')]=_[_0xca7b('0x32')](_0x1fe819[_0xca7b('0x2d')],qs[_0xca7b('0x33')](_0x405fab[_0xca7b('0x2f')][_0xca7b('0x33')]));_0x2e8540[_0xca7b('0x31')]=_0x2e8540[_0xca7b('0x31')][_0xca7b('0x34')]?_0x2e8540['attributes']:_0x1fe819[_0xca7b('0x2d')];if(_0x405fab['query'][_0xca7b('0x3d')]){_0x2e8540[_0xca7b('0x3e')]=[{'all':!![]}];}_0x2e8540=_[_0xca7b('0x3a')]({},_0x2e8540,_0x405fab[_0xca7b('0x3b')]);return db['CmCustomField'][_0xca7b('0x43')](_0x2e8540)['then'](handleEntityNotFound(_0x34a9af,null))[_0xca7b('0x23')](respondWithResult(_0x34a9af,null))[_0xca7b('0x41')](handleError(_0x34a9af,null));};exports[_0xca7b('0x21')]=function(_0x27f5e2,_0xd06390){if(_0x27f5e2['body']['id']){delete _0x27f5e2[_0xca7b('0x44')]['id'];}return db[_0xca7b('0x29')][_0xca7b('0x43')]({'where':{'id':_0x27f5e2[_0xca7b('0x45')]['id']}})[_0xca7b('0x23')](handleEntityNotFound(_0xd06390,null))[_0xca7b('0x23')](saveUpdates(_0x27f5e2[_0xca7b('0x44')],null))[_0xca7b('0x23')](respondWithResult(_0xd06390,null))['catch'](handleError(_0xd06390,null));};exports[_0xca7b('0x22')]=function(_0x626221,_0x59e7e3){return db[_0xca7b('0x29')][_0xca7b('0x43')]({'where':{'id':_0x626221['params']['id']}})[_0xca7b('0x23')](handleEntityNotFound(_0x59e7e3,null))[_0xca7b('0x23')](removeEntity(_0x59e7e3,null))['catch'](handleError(_0x59e7e3,null));};exports[_0xca7b('0x46')]=function(_0x5d0b16,_0x1b9bca){var _0x362765;return db[_0xca7b('0x47')][_0xca7b('0x48')](function(_0x50ec6d){return db[_0xca7b('0x29')][_0xca7b('0x46')](_0x5d0b16['body'],{'transaction':_0x50ec6d})[_0xca7b('0x23')](function(_0x49eb1e){_0x362765=_0x49eb1e;var _0xa0678b={'type':db['Sequelize'][_0xca7b('0x49')],'transaction':_0x50ec6d};switch(_0x5d0b16['body'][_0xca7b('0x2b')]){case _0xca7b('0x4a'):_0xa0678b['type']=db[_0xca7b('0x4b')]['TEXT'];break;case _0xca7b('0x4c'):_0xa0678b['type']=db[_0xca7b('0x4b')][_0xca7b('0x4d')];break;case'switch':_0xa0678b[_0xca7b('0x2b')]=db[_0xca7b('0x4b')][_0xca7b('0x4e')];_0xa0678b[_0xca7b('0x4f')]=![];break;default:}return db[_0xca7b('0x47')][_0xca7b('0x50')][_0xca7b('0x51')](_0xca7b('0x52'),util[_0xca7b('0x53')](_0xca7b('0x54'),_0x362765['id']),_0xa0678b);})['then'](function(){return _0x362765;});})[_0xca7b('0x23')](respondWithResult(_0x1b9bca,0xc9))[_0xca7b('0x41')](handleError(_0x1b9bca,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7e68f4a..cc993aa 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 _0x67cc=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','path'];(function(_0x3ba00e,_0xbd1c3d){var _0x33cb79=function(_0xdcb570){while(--_0xdcb570){_0x3ba00e['push'](_0x3ba00e['shift']());}};_0x33cb79(++_0xbd1c3d);}(_0x67cc,0x1cf));var _0xc67c=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x67cc[_0xbe6d5d];return _0x2cb584;};'use strict';var _=require('lodash');var util=require(_0xc67c('0x0'));var logger=require(_0xc67c('0x1'))(_0xc67c('0x2'));var moment=require(_0xc67c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc67c('0x4'));var rimraf=require(_0xc67c('0x5'));var config=require(_0xc67c('0x6'));var attributes=require(_0xc67c('0x7'));module[_0xc67c('0x8')]=function(_0x156638,_0x99668a){return _0x156638[_0xc67c('0x9')](_0xc67c('0xa'),attributes,{'tableName':_0xc67c('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9290=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','./cmCustomField.attributes','exports'];(function(_0x2003ca,_0x327d9b){var _0xeaa6c9=function(_0x707dd5){while(--_0x707dd5){_0x2003ca['push'](_0x2003ca['shift']());}};_0xeaa6c9(++_0x327d9b);}(_0x9290,0x117));var _0x0929=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x9290[_0x210718];return _0x541bfc;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var logger=require(_0x0929('0x2'))(_0x0929('0x3'));var moment=require('moment');var BPromise=require(_0x0929('0x4'));var rp=require(_0x0929('0x5'));var fs=require('fs');var path=require(_0x0929('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0929('0x7'));module[_0x0929('0x8')]=function(_0x12f527,_0x24adcb){return _0x12f527[_0x0929('0x9')](_0x0929('0xa'),attributes,{'tableName':_0x0929('0xb'),'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 9f2c823..6b1dd9e 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 _0x9539=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x4f248f,_0x131d9e){var _0x233f22=function(_0x2f1e8a){while(--_0x2f1e8a){_0x4f248f['push'](_0x4f248f['shift']());}};_0x233f22(++_0x131d9e);}(_0x9539,0x1a3));var _0x9953=function(_0xea8e31,_0x3f8955){_0xea8e31=_0xea8e31-0x0;var _0x3407ce=_0x9539[_0xea8e31];return _0x3407ce;};'use strict';var _=require(_0x9953('0x0'));var util=require(_0x9953('0x1'));var moment=require(_0x9953('0x2'));var BPromise=require(_0x9953('0x3'));var rs=require(_0x9953('0x4'));var fs=require('fs');var Redis=require(_0x9953('0x5'));var db=require(_0x9953('0x6'))['db'];var utils=require(_0x9953('0x7'));var logger=require(_0x9953('0x8'))(_0x9953('0x9'));var config=require('../../config/environment');var jayson=require(_0x9953('0xa'));var client=jayson['client'][_0x9953('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ab3ea,_0x5d905c,_0x1ea138){return new BPromise(function(_0x54a5c4,_0xc2e0b9){return client['request'](_0x2ab3ea,_0x1ea138)[_0x9953('0xc')](function(_0x132555){logger[_0x9953('0xd')](_0x9953('0xe'),_0x5d905c,_0x9953('0xf'));logger[_0x9953('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5d905c,'request\x20sent',JSON[_0x9953('0x11')](_0x132555));if(_0x132555[_0x9953('0x12')]){if(_0x132555[_0x9953('0x12')][_0x9953('0x13')]===0x1f4){logger[_0x9953('0x12')](_0x9953('0xe'),_0x5d905c,_0x132555[_0x9953('0x12')][_0x9953('0x14')]);return _0xc2e0b9(_0x132555[_0x9953('0x12')]['message']);}logger[_0x9953('0x12')](_0x9953('0xe'),_0x5d905c,_0x132555[_0x9953('0x12')][_0x9953('0x14')]);return _0x54a5c4(_0x132555[_0x9953('0x12')][_0x9953('0x14')]);}else{logger[_0x9953('0xd')](_0x9953('0xe'),_0x5d905c,_0x9953('0xf'));_0x54a5c4(_0x132555['result']['message']);}})['catch'](function(_0x3b3b4a){logger[_0x9953('0x12')](_0x9953('0xe'),_0x5d905c,_0x3b3b4a);_0xc2e0b9(_0x3b3b4a);});});} \ No newline at end of file +var _0xafec=['debug','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','then'];(function(_0x4c666f,_0x39fbdb){var _0x565d46=function(_0x54cb30){while(--_0x54cb30){_0x4c666f['push'](_0x4c666f['shift']());}};_0x565d46(++_0x39fbdb);}(_0xafec,0x86));var _0xcafe=function(_0x4f3412,_0xd570b7){_0x4f3412=_0x4f3412-0x0;var _0x4231e4=_0xafec[_0x4f3412];return _0x4231e4;};'use strict';var _=require(_0xcafe('0x0'));var util=require(_0xcafe('0x1'));var moment=require(_0xcafe('0x2'));var BPromise=require(_0xcafe('0x3'));var rs=require(_0xcafe('0x4'));var fs=require('fs');var Redis=require(_0xcafe('0x5'));var db=require(_0xcafe('0x6'))['db'];var utils=require(_0xcafe('0x7'));var logger=require('../../config/logger')(_0xcafe('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38c477,_0x3c1ce7,_0x3cdedc){return new BPromise(function(_0x20286d,_0x1cdc1f){return client['request'](_0x38c477,_0x3cdedc)[_0xcafe('0x9')](function(_0x5dfa8b){logger['info']('CmCustomField,\x20%s,\x20%s',_0x3c1ce7,'request\x20sent');logger[_0xcafe('0xa')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3c1ce7,_0xcafe('0xb'),JSON['stringify'](_0x5dfa8b));if(_0x5dfa8b[_0xcafe('0xc')]){if(_0x5dfa8b[_0xcafe('0xc')][_0xcafe('0xd')]===0x1f4){logger[_0xcafe('0xc')](_0xcafe('0xe'),_0x3c1ce7,_0x5dfa8b[_0xcafe('0xc')]['message']);return _0x1cdc1f(_0x5dfa8b[_0xcafe('0xc')][_0xcafe('0xf')]);}logger[_0xcafe('0xc')]('CmCustomField,\x20%s,\x20%s',_0x3c1ce7,_0x5dfa8b['error']['message']);return _0x20286d(_0x5dfa8b['error'][_0xcafe('0xf')]);}else{logger['info'](_0xcafe('0xe'),_0x3c1ce7,'request\x20sent');_0x20286d(_0x5dfa8b['result'][_0xcafe('0xf')]);}})['catch'](function(_0x17ee16){logger[_0xcafe('0xc')](_0xcafe('0xe'),_0x3c1ce7,_0x17ee16);_0x1cdc1f(_0x17ee16);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d6655fb..5a2989f 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 _0xeff8=['isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x3758f1,_0x5180d2){var _0x3548bb=function(_0x214de4){while(--_0x214de4){_0x3758f1['push'](_0x3758f1['shift']());}};_0x3548bb(++_0x5180d2);}(_0xeff8,0x186));var _0x8eff=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xeff8[_0x277107];return _0x1da046;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')]('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xf')]);router['put']('/:id',auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router[_0x8eff('0x11')]('/:id',auth[_0x8eff('0x9')](),controller[_0x8eff('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdd41=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var path=require(_0x1dd4('0x2'));var timeout=require(_0x1dd4('0x3'));var express=require('express');var router=express[_0x1dd4('0x4')]();var fs_extra=require(_0x1dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dd4('0x6'));var controller=require(_0x1dd4('0x7'));router['get']('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x9')]);router['get'](_0x1dd4('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1dd4('0xb')]);router['put'](_0x1dd4('0xa'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0xc')]);router[_0x1dd4('0xd')]('/:id',auth[_0x1dd4('0x8')](),controller['destroy']);module[_0x1dd4('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2d8a4ab..81f017b 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 _0xb646=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING'];(function(_0x3a094d,_0x2811f1){var _0x2fce9f=function(_0xf37d1c){while(--_0xf37d1c){_0x3a094d['push'](_0x3a094d['shift']());}};_0x2fce9f(++_0x2811f1);}(_0xb646,0x1c9));var _0x6b64=function(_0x5192eb,_0x565daf){_0x5192eb=_0x5192eb-0x0;var _0xb0b6f7=_0xb646[_0x5192eb];return _0xb0b6f7;};'use strict';var moment=require(_0x6b64('0x0'));var Sequelize=require(_0x6b64('0x1'));module['exports']={'phone':{'type':Sequelize[_0x6b64('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6b64('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6b64('0x4')],'defaultValue':moment()[_0x6b64('0x5')](_0x6b64('0x6'))},'countbusyretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6b64('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6b64('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6b64('0x4')]},'priority':{'type':Sequelize[_0x6b64('0x7')](0x2)[_0x6b64('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6b64('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x6b64('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6b64('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x6b64('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x6b64('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6b64('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6b64('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6b64('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6b64('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x4141=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','STRING','DATE'];(function(_0x2046dd,_0x40a9ab){var _0x2eb055=function(_0x1c65e8){while(--_0x1c65e8){_0x2046dd['push'](_0x2046dd['shift']());}};_0x2eb055(++_0x40a9ab);}(_0x4141,0x1f4));var _0x1414=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4141[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x1414('0x0'));var Sequelize=require(_0x1414('0x1'));module['exports']={'phone':{'type':Sequelize[_0x1414('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1414('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1414('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1414('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1414('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1414('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1414('0x7')},'ListId':{'type':Sequelize[_0x1414('0x4')],'unique':_0x1414('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1414('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1414('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1414('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1414('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index c8e7c96..431f80a 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 _0x7fbe=['$contained','$any','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','find','create','body','params','describe','destroy','VoiceQueueId','Campaign','CampaignId','dataValues','campaign','membername','user','UserId','deleted','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','format','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','transaction','scheduledat','CmCompany','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','model','$and','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notILike','$overlap'];(function(_0x568a14,_0x35aa27){var _0x5b6312=function(_0x4d4eeb){while(--_0x4d4eeb){_0x568a14['push'](_0x568a14['shift']());}};_0x5b6312(++_0x35aa27);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x7fbe[_0x2d2498];return _0x447a5b;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var shared=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];function respondWithResult(_0x47625b,_0x11d2c4){_0x11d2c4=_0x11d2c4||0xc8;return function(_0x4524ff){if(_0x4524ff){return _0x47625b[_0xe7fb('0x5')](_0x11d2c4)[_0xe7fb('0x6')](_0x4524ff);}};}function respondWithFilteredResult(_0x290172,_0x12d1b0){return function(_0x24cd67){if(_0x24cd67){var _0x1f943f=typeof _0x12d1b0['offset']===_0xe7fb('0x7')&&typeof _0x12d1b0[_0xe7fb('0x8')]===_0xe7fb('0x7');var _0x190a7a=_0x24cd67['count'];var _0x558857=_0x1f943f?0x0:_0x12d1b0[_0xe7fb('0x9')];var _0x2f2ea0=_0x1f943f?_0x24cd67[_0xe7fb('0xa')]:_0x12d1b0[_0xe7fb('0x9')]+_0x12d1b0[_0xe7fb('0x8')];var _0x42435c;if(_0x2f2ea0>=_0x190a7a){_0x2f2ea0=_0x190a7a;_0x42435c=0xc8;}else{_0x42435c=0xce;}_0x290172[_0xe7fb('0x5')](_0x42435c);return _0x290172[_0xe7fb('0xb')](_0xe7fb('0xc'),_0x558857+'-'+_0x2f2ea0+'/'+_0x190a7a)[_0xe7fb('0x6')](_0x24cd67);}return null;};}function saveUpdates(_0x2437d4,_0x188e1d){return function(_0xdf9760){if(_0xdf9760){return _0xdf9760[_0xe7fb('0xd')](_0x2437d4)[_0xe7fb('0xe')](function(_0x598729){return _0x598729;});}return null;};}function handleEntityNotFound(_0x278b75,_0x2225e5){return function(_0x5573ab){if(!_0x5573ab){_0x278b75[_0xe7fb('0xf')](0x194);}return _0x5573ab;};}function handleError(_0x37eb9f,_0x482f7d){_0x482f7d=_0x482f7d||0x1f4;return function(_0xa76acf){logger['error'](_0xa76acf[_0xe7fb('0x10')]);if(_0xa76acf[_0xe7fb('0x11')]){delete _0xa76acf[_0xe7fb('0x11')];}_0x37eb9f[_0xe7fb('0x5')](_0x482f7d)['send'](_0xa76acf);};}exports[_0xe7fb('0x12')]=function(_0x5ebc87,_0x293a47){var _0x546463={},_0x1e77fd={},_0x4708f7={'count':0x0,'rows':[]};var _0x3f96a7=_[_0xe7fb('0x13')](db['CmHopper'][_0xe7fb('0x14')],function(_0x5d1c87){return{'name':_0x5d1c87[_0xe7fb('0x15')],'type':_0x5d1c87['type'][_0xe7fb('0x16')]};});_0x1e77fd['model']=_[_0xe7fb('0x13')](_0x3f96a7,_0xe7fb('0x11'));_0x1e77fd['query']=_[_0xe7fb('0x17')](_0x5ebc87[_0xe7fb('0x18')]);_0x1e77fd[_0xe7fb('0x19')]=_['intersection'](_0x1e77fd[_0xe7fb('0x1a')],_0x1e77fd[_0xe7fb('0x18')]);_0x1e77fd['filters']=_['concat'](_0x1e77fd['filters'],[_0xe7fb('0x1b'),'$or','$gt',_0xe7fb('0x1c'),_0xe7fb('0x1d'),_0xe7fb('0x1e'),'$ne',_0xe7fb('0x1f'),_0xe7fb('0x20'),_0xe7fb('0x21'),_0xe7fb('0x22'),_0xe7fb('0x23'),_0xe7fb('0x24'),_0xe7fb('0x25'),'$notLike','$iLike',_0xe7fb('0x26'),_0xe7fb('0x25'),_0xe7fb('0x27'),'$contains',_0xe7fb('0x28'),_0xe7fb('0x29')]);_0x546463[_0xe7fb('0x2a')]=_[_0xe7fb('0x2b')](_0x1e77fd[_0xe7fb('0x1a')],qs[_0xe7fb('0x2c')](_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x2c')]));_0x546463['attributes']=_0x546463[_0xe7fb('0x2a')][_0xe7fb('0x2d')]?_0x546463[_0xe7fb('0x2a')]:_0x1e77fd['model'];if(!_0x5ebc87['query'][_0xe7fb('0x2e')]('nolimit')){_0x546463[_0xe7fb('0x8')]=qs[_0xe7fb('0x8')](_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x8')]);_0x546463['offset']=qs[_0xe7fb('0x9')](_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x9')]);}_0x546463[_0xe7fb('0x2f')]=qs[_0xe7fb('0x30')](_0x5ebc87['query'][_0xe7fb('0x30')]);_0x546463[_0xe7fb('0x31')]=qs[_0xe7fb('0x19')](_[_0xe7fb('0x32')](_0x5ebc87[_0xe7fb('0x18')],_0x1e77fd[_0xe7fb('0x19')]),_0x3f96a7);if(_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x33')]){_0x546463[_0xe7fb('0x31')]=_['merge'](_0x546463[_0xe7fb('0x31')],{'$or':_[_0xe7fb('0x13')](_0x3f96a7,function(_0x2593e3){if(_0x2593e3['type']!==_0xe7fb('0x34')){var _0x3502dc={};_0x3502dc[_0x2593e3[_0xe7fb('0x11')]]={'$like':'%'+_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x33')]+'%'};return _0x3502dc;}})});}_0x546463=_[_0xe7fb('0x35')]({},_0x546463,_0x5ebc87[_0xe7fb('0x36')]);var _0xc4e271={'where':_0x546463[_0xe7fb('0x31')]};return db[_0xe7fb('0x37')][_0xe7fb('0xa')](_0xc4e271)[_0xe7fb('0xe')](function(_0x1544f2){_0x4708f7[_0xe7fb('0xa')]=_0x1544f2;if(_0x5ebc87[_0xe7fb('0x18')][_0xe7fb('0x38')]){_0x546463[_0xe7fb('0x39')]=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x3a')](_0x546463);})['then'](function(_0x261ec5){_0x4708f7[_0xe7fb('0x3b')]=_0x261ec5;return _0x4708f7;})[_0xe7fb('0xe')](respondWithFilteredResult(_0x293a47,_0x546463))[_0xe7fb('0x3c')](handleError(_0x293a47,null));};exports['show']=function(_0x3426a9,_0x186418){var _0xd472d={'raw':!![],'where':{'id':_0x3426a9['params']['id']}},_0x413a13={};_0x413a13[_0xe7fb('0x1a')]=_[_0xe7fb('0x17')](db[_0xe7fb('0x37')][_0xe7fb('0x14')]);_0x413a13[_0xe7fb('0x18')]=_[_0xe7fb('0x17')](_0x3426a9['query']);_0x413a13[_0xe7fb('0x19')]=_[_0xe7fb('0x2b')](_0x413a13[_0xe7fb('0x1a')],_0x413a13['query']);_0xd472d[_0xe7fb('0x2a')]=_[_0xe7fb('0x2b')](_0x413a13['model'],qs['fields'](_0x3426a9['query']['fields']));_0xd472d['attributes']=_0xd472d[_0xe7fb('0x2a')][_0xe7fb('0x2d')]?_0xd472d[_0xe7fb('0x2a')]:_0x413a13['model'];if(_0x3426a9[_0xe7fb('0x18')]['includeAll']){_0xd472d[_0xe7fb('0x39')]=[{'all':!![]}];}_0xd472d=_[_0xe7fb('0x35')]({},_0xd472d,_0x3426a9['options']);return db[_0xe7fb('0x37')][_0xe7fb('0x3d')](_0xd472d)[_0xe7fb('0xe')](handleEntityNotFound(_0x186418,null))[_0xe7fb('0xe')](respondWithResult(_0x186418,null))['catch'](handleError(_0x186418,null));};exports[_0xe7fb('0x3e')]=function(_0x694ee9,_0x1b8a34){return db['CmHopper'][_0xe7fb('0x3e')](_0x694ee9[_0xe7fb('0x3f')],{})[_0xe7fb('0xe')](respondWithResult(_0x1b8a34,0xc9))[_0xe7fb('0x3c')](handleError(_0x1b8a34,null));};exports[_0xe7fb('0xd')]=function(_0x5a1ce1,_0x2eb999){if(_0x5a1ce1['body']['id']){delete _0x5a1ce1[_0xe7fb('0x3f')]['id'];}return db[_0xe7fb('0x37')][_0xe7fb('0x3d')]({'where':{'id':_0x5a1ce1[_0xe7fb('0x40')]['id']}})[_0xe7fb('0xe')](handleEntityNotFound(_0x2eb999,null))['then'](saveUpdates(_0x5a1ce1[_0xe7fb('0x3f')],null))['then'](respondWithResult(_0x2eb999,null))['catch'](handleError(_0x2eb999,null));};exports[_0xe7fb('0x41')]=function(_0x3d740f,_0x16327f){return db['CmHopper'][_0xe7fb('0x41')]()[_0xe7fb('0xe')](respondWithResult(_0x16327f,null))['catch'](handleError(_0x16327f,null));};exports['destroy']=function(_0x284bcb,_0x42270b){var _0x1cbf34;var _0x3dd6bf=_0x284bcb[_0xe7fb('0x40')]['id'];return db[_0xe7fb('0x37')][_0xe7fb('0x3d')]({'where':{'id':_0x284bcb[_0xe7fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x42270b,null))[_0xe7fb('0xe')](function(_0x5cc28f){if(_0x5cc28f){return _0x5cc28f[_0xe7fb('0x42')]()[_0xe7fb('0xe')](function(_0x5cedfb){return _0x5cedfb;});}})[_0xe7fb('0xe')](function(_0x5efd24){_0x1cbf34=_0x5efd24;if(_0x5efd24){if(_0x5efd24[_0xe7fb('0x43')]||_0x5efd24['CampaignId']){return db[_0x5efd24[_0xe7fb('0x43')]?'VoiceQueue':_0xe7fb('0x44')]['find']({'where':{'id':_0x5efd24[_0xe7fb('0x43')]?_0x5efd24[_0xe7fb('0x43')]:_0x5efd24[_0xe7fb('0x45')]},'attributes':['id',_0xe7fb('0x11')],'raw':!![]});}}})[_0xe7fb('0xe')](function(_0x2f959d){var _0x2f4760={};if(_0x2f959d){_['merge'](_0x2f4760,_['omit'](_0x1cbf34[_0xe7fb('0x46')],['createdAt','updatedAt','id']));_0x2f4760['state']=0x15;_0x2f4760['statedesc']='deleted';_0x2f4760[_0xe7fb('0x47')]=_0x2f959d[_0xe7fb('0x11')];_0x2f4760[_0xe7fb('0x48')]=_0x284bcb[_0xe7fb('0x49')]['name'];_0x2f4760[_0xe7fb('0x4a')]=_0x284bcb[_0xe7fb('0x49')]['id'];_0x2f4760[_0xe7fb('0x4b')]=!![];_0x2f4760['deletedat']=moment()['format'](_0xe7fb('0x4c'));_0x2f4760[_0xe7fb('0x4d')]=_0x1cbf34[_0xe7fb('0x4e')];_0x2f4760['campaigntype']=_0x1cbf34[_0xe7fb('0x43')]?_0xe7fb('0x4f'):_0xe7fb('0x50');return db[_0xe7fb('0x51')]['find']({'where':{'id':_0x2f4760['ContactId']},'attributes':[_0xe7fb('0x52'),_0xe7fb('0x53')]})[_0xe7fb('0xe')](function(_0x2f61b1){if(!_[_0xe7fb('0x54')](_0x42270b)&&!_['isNil'](_0x2f61b1[_0xe7fb('0x52')])){_0x2f4760[_0xe7fb('0x55')]=_0x2f61b1[_0xe7fb('0x52')];if(!_['isNil'](_0x2f61b1['lastName'])){_0x2f4760[_0xe7fb('0x55')]+='\x20'+_0x2f61b1[_0xe7fb('0x53')];}}})[_0xe7fb('0x56')](function(){return db[_0xe7fb('0x57')][_0xe7fb('0x3e')](_0x2f4760);});}})[_0xe7fb('0xe')](function(_0x585b7c){return db[_0xe7fb('0x58')][_0xe7fb('0x42')]({'where':{'CmHopperId':_0x3dd6bf}});})[_0xe7fb('0xe')](function(){return _0x42270b[_0xe7fb('0x5')](0xcc)[_0xe7fb('0x59')]();})[_0xe7fb('0x3c')](handleError(_0x42270b,null));};exports['getPreview']=function(_0x2e457c,_0x526f09){var _0x1eda1d=[];return db[_0xe7fb('0x51')][_0xe7fb('0x41')]()[_0xe7fb('0xe')](function(_0x5925e6){_0x1eda1d=_['keys'](_0x5925e6);return _0x2e457c[_0xe7fb('0x49')][_0xe7fb('0x5a')]({'where':{'type':_0xe7fb('0x5b'),'dialActive':!![],'dialMethod':_0xe7fb('0x5c')},'attributes':['id',_0xe7fb('0x5d'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xe7fb('0xe')](function(_0x58d4ec){if(_0x58d4ec&&_0x58d4ec[_0xe7fb('0x2d')]){return db['sequelize']['transaction'](function(_0xc13fac){var _0x203da3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe7fb('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe7fb('0x13')](_0x58d4ec,'id')},'$or':[{'UserId':null},{'UserId':_0x2e457c[_0xe7fb('0x49')]['id']}]};var _0x3401e0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x58d4ec)[_0xe7fb('0x33')]([_0xe7fb('0x5f'),0x0])['map']('id')[_0xe7fb('0x60')]()},'$or':[{'UserId':null},{'UserId':_0x2e457c[_0xe7fb('0x49')]['id']}]};var _0x5151ec={'$or':[_0x203da3,_0x3401e0]};var _0x4136ae=[];if(_0x2e457c[_0xe7fb('0x3f')]['direction']&&_0x2e457c[_0xe7fb('0x3f')]['direction']===_0xe7fb('0x61')){if(!_[_0xe7fb('0x62')](_0x2e457c[_0xe7fb('0x3f')]['hopperIds'])){_0x5151ec['id']={'$in':_0x2e457c[_0xe7fb('0x3f')][_0xe7fb('0x63')]};}_0x4136ae=[[_0xe7fb('0x64'),_0xe7fb('0x65')],[_0xe7fb('0x66'),_0x58d4ec[0x0][_0xe7fb('0x5d')]===_0xe7fb('0x65')?_0xe7fb('0x67'):'ASC'],db['sequelize'][_0xe7fb('0x68')](_0xe7fb('0x69')),['id',_0xe7fb('0x67')]];}else{if(!_['isEmpty'](_0x2e457c['body'][_0xe7fb('0x63')])){_0x5151ec['id']={'$notIn':_0x2e457c[_0xe7fb('0x3f')][_0xe7fb('0x63')]};}_0x4136ae=[[_0xe7fb('0x64'),_0xe7fb('0x67')],[_0xe7fb('0x66'),_0x58d4ec[0x0][_0xe7fb('0x5d')]],db[_0xe7fb('0x6a')][_0xe7fb('0x68')](_0xe7fb('0x6b')),['id',_0xe7fb('0x65')]];}return db[_0xe7fb('0x37')][_0xe7fb('0x6c')]({'attributes':['id','scheduledat','phone',_0xe7fb('0x6d')],'where':_0x5151ec,'order':_0x4136ae,'transaction':_0xc13fac,'lock':_0xc13fac[_0xe7fb('0x6e')][_0xe7fb('0x6f')],'include':[{'model':db[_0xe7fb('0x51')],'as':_0xe7fb('0x70'),'attributes':_0x1eda1d,'include':[{'model':db['CmCompany'],'as':_0xe7fb('0x71'),'attributes':['id',_0xe7fb('0x11')]}]},{'model':db[_0xe7fb('0x72')],'as':_0xe7fb('0x73'),'attributes':['id',_0xe7fb('0x11')]},{'model':db[_0xe7fb('0x74')],'as':_0xe7fb('0x75'),'attributes':['id',_0xe7fb('0x11'),_0xe7fb('0x76')]}]})['then'](function(_0xc13cb){if(_0xc13cb){return _0xc13cb['update']({'UserId':_0x2e457c[_0xe7fb('0x49')]['id']},{'transaction':_0xc13fac});}});});}})[_0xe7fb('0xe')](handleEntityNotFound(_0x526f09,null))[_0xe7fb('0xe')](respondWithResult(_0x526f09,null))[_0xe7fb('0x3c')](handleError(_0x526f09,null));};exports[_0xe7fb('0x77')]=function(_0x4e5f55,_0x3882b5,_0x38e66a){var _0x4fd57a=[];var _0x2bf4aa=_0x4e5f55[_0xe7fb('0x40')]['id'];var _0x172547=_0x4e5f55[_0xe7fb('0x49')]['id'];return db[_0xe7fb('0x51')][_0xe7fb('0x41')]()[_0xe7fb('0xe')](function(_0x2d2373){_0x4fd57a=_[_0xe7fb('0x17')](_0x2d2373);return db[_0xe7fb('0x6a')][_0xe7fb('0x78')](function(_0x52b8a1){const _0x4b5f7e={'id':_0x2bf4aa};return db['CmHopper'][_0xe7fb('0x6c')]({'attributes':['id',_0xe7fb('0x79'),_0xe7fb('0x6d')],'where':_0x4b5f7e,'transaction':_0x52b8a1,'lock':_0x52b8a1[_0xe7fb('0x6e')]['UPDATE'],'include':[{'model':db[_0xe7fb('0x51')],'as':_0xe7fb('0x70'),'attributes':_0x4fd57a,'include':[{'model':db[_0xe7fb('0x7a')],'as':_0xe7fb('0x71'),'attributes':['id','name']}]},{'model':db[_0xe7fb('0x72')],'as':'List','attributes':['id',_0xe7fb('0x11')]},{'model':db[_0xe7fb('0x74')],'as':_0xe7fb('0x75'),'attributes':['id',_0xe7fb('0x11'),_0xe7fb('0x76')]}]})['then'](function(_0x3ffd6c){if(_0x3ffd6c){return _0x3ffd6c['update']({'UserId':_0x172547},{'transaction':_0x52b8a1});}});});})[_0xe7fb('0xe')](handleEntityNotFound(_0x3882b5,null))['then'](respondWithResult(_0x3882b5,null))[_0xe7fb('0x3c')](handleError(_0x3882b5,null));};exports[_0xe7fb('0x7b')]=function(_0x4c37cd,_0x2b6d69){return _0x4c37cd[_0xe7fb('0x49')][_0xe7fb('0x5a')]({'where':{'type':_0xe7fb('0x5b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xe7fb('0xe')](function(_0x277335){if(_0x277335&&_0x277335[_0xe7fb('0x2d')]){return db['CmHopper'][_0xe7fb('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x277335,'id')},'$or':[{'UserId':null},{'UserId':_0x4c37cd[_0xe7fb('0x49')]['id']}]}});}return 0x0;})[_0xe7fb('0xe')](function(_0x4a8a65){if(!_[_0xe7fb('0x54')](_0x4a8a65)&&_[_0xe7fb('0x7c')](_0x4a8a65)){return _0x2b6d69[_0xe7fb('0x5')](0xc8)[_0xe7fb('0x6')]({'contacts':_0x4a8a65});}else{logger[_0xe7fb('0x7d')](_0xe7fb('0x7e'),_0xe7fb('0x7b'),0x194,_0xe7fb('0x7f'));_0x2b6d69[_0xe7fb('0xf')](0x194);}})[_0xe7fb('0x3c')](handleError(_0x2b6d69,null));};exports[_0xe7fb('0x80')]=function(_0x195d8b,_0x3d1f34){var _0x27c97a=shared[_0xe7fb('0x81')];var _0x30abe3=[];_[_0xe7fb('0x13')](_0x27c97a,function(_0x3ca3d1){_0x30abe3[_0xe7fb('0x82')]({'id':_0x3ca3d1[_0xe7fb('0x11')],'name':_0x3ca3d1['name'],'utcOffset':_0x3ca3d1[_0xe7fb('0x83')]});});return _0x3d1f34[_0xe7fb('0x5')](0xc8)[_0xe7fb('0x6')]({'tz':_0x30abe3});};exports[_0xe7fb('0x84')]=function(_0x19fe06,_0x44d443){var _0x320fba=shared['timezones'];var _0x4c0e3e={};if(!_[_0xe7fb('0x54')](_0x320fba[_0x19fe06['body']['id']]))_0x4c0e3e=_0x320fba[_0x19fe06[_0xe7fb('0x3f')]['id']];return _0x44d443[_0xe7fb('0x5')](0xc8)['json'](_0x4c0e3e);}; \ No newline at end of file +var _0xab86=['calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','sequelize','literal','priority','DESC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','update','getPreviewRecall','transaction','findOne','Company','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$like','$iLike','$notILike','$any','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil'];(function(_0xa20086,_0x3978a9){var _0x121c6e=function(_0x16a848){while(--_0x16a848){_0xa20086['push'](_0xa20086['shift']());}};_0x121c6e(++_0x3978a9);}(_0xab86,0x13e));var _0x6ab8=function(_0xf3b525,_0x419b48){_0xf3b525=_0xf3b525-0x0;var _0x1f98b3=_0xab86[_0xf3b525];return _0x1f98b3;};'use strict';var moment=require(_0x6ab8('0x0'));var _=require(_0x6ab8('0x1'));var qs=require(_0x6ab8('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1193a1,_0x48cb6a){_0x48cb6a=_0x48cb6a||0xc8;return function(_0xf27ba7){if(_0xf27ba7){return _0x1193a1[_0x6ab8('0x4')](_0x48cb6a)[_0x6ab8('0x5')](_0xf27ba7);}};}function respondWithFilteredResult(_0x154d17,_0x6f41f){return function(_0x265771){if(_0x265771){var _0x2b6295=typeof _0x6f41f[_0x6ab8('0x6')]===_0x6ab8('0x7')&&typeof _0x6f41f[_0x6ab8('0x8')]===_0x6ab8('0x7');var _0x20f27b=_0x265771[_0x6ab8('0x9')];var _0x5127eb=_0x2b6295?0x0:_0x6f41f['offset'];var _0x383594=_0x2b6295?_0x265771['count']:_0x6f41f[_0x6ab8('0x6')]+_0x6f41f[_0x6ab8('0x8')];var _0x139c0f;if(_0x383594>=_0x20f27b){_0x383594=_0x20f27b;_0x139c0f=0xc8;}else{_0x139c0f=0xce;}_0x154d17['status'](_0x139c0f);return _0x154d17[_0x6ab8('0xa')](_0x6ab8('0xb'),_0x5127eb+'-'+_0x383594+'/'+_0x20f27b)['json'](_0x265771);}return null;};}function saveUpdates(_0x44d1d9,_0x1b9b34){return function(_0x408ce1){if(_0x408ce1){return _0x408ce1['update'](_0x44d1d9)[_0x6ab8('0xc')](function(_0x42b74e){return _0x42b74e;});}return null;};}function handleEntityNotFound(_0x60b50,_0x968bac){return function(_0x1c83a1){if(!_0x1c83a1){_0x60b50[_0x6ab8('0xd')](0x194);}return _0x1c83a1;};}function handleError(_0x1c6402,_0x2043bb){_0x2043bb=_0x2043bb||0x1f4;return function(_0x293389){logger['error'](_0x293389[_0x6ab8('0xe')]);if(_0x293389[_0x6ab8('0xf')]){delete _0x293389[_0x6ab8('0xf')];}_0x1c6402['status'](_0x2043bb)[_0x6ab8('0x10')](_0x293389);};}exports[_0x6ab8('0x11')]=function(_0x50cd9f,_0x543726){var _0x35e92f={},_0x57cd18={},_0x41792d={'count':0x0,'rows':[]};var _0x292b36=_[_0x6ab8('0x12')](db['CmHopper'][_0x6ab8('0x13')],function(_0x3de5b3){return{'name':_0x3de5b3[_0x6ab8('0x14')],'type':_0x3de5b3[_0x6ab8('0x15')]['key']};});_0x57cd18[_0x6ab8('0x16')]=_[_0x6ab8('0x12')](_0x292b36,'name');_0x57cd18['query']=_['keys'](_0x50cd9f[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_[_0x6ab8('0x19')](_0x57cd18['model'],_0x57cd18[_0x6ab8('0x17')]);_0x57cd18[_0x6ab8('0x18')]=_['concat'](_0x57cd18['filters'],[_0x6ab8('0x1a'),_0x6ab8('0x1b'),'$gt',_0x6ab8('0x1c'),_0x6ab8('0x1d'),_0x6ab8('0x1e'),_0x6ab8('0x1f'),_0x6ab8('0x20'),_0x6ab8('0x21'),_0x6ab8('0x22'),_0x6ab8('0x23'),'$in','$notIn',_0x6ab8('0x24'),'$notLike',_0x6ab8('0x25'),_0x6ab8('0x26'),_0x6ab8('0x24'),'$overlap','$contains','$contained',_0x6ab8('0x27')]);_0x35e92f[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x57cd18[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0x35e92f[_0x6ab8('0x28')]=_0x35e92f[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0x35e92f[_0x6ab8('0x28')]:_0x57cd18[_0x6ab8('0x16')];if(!_0x50cd9f[_0x6ab8('0x17')]['hasOwnProperty']('nolimit')){_0x35e92f[_0x6ab8('0x8')]=qs['limit'](_0x50cd9f['query'][_0x6ab8('0x8')]);_0x35e92f[_0x6ab8('0x6')]=qs['offset'](_0x50cd9f[_0x6ab8('0x17')]['offset']);}_0x35e92f[_0x6ab8('0x2b')]=qs[_0x6ab8('0x2c')](_0x50cd9f['query']['sort']);_0x35e92f[_0x6ab8('0x2d')]=qs[_0x6ab8('0x18')](_[_0x6ab8('0x2e')](_0x50cd9f[_0x6ab8('0x17')],_0x57cd18[_0x6ab8('0x18')]),_0x292b36);if(_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]){_0x35e92f[_0x6ab8('0x2d')]=_['merge'](_0x35e92f[_0x6ab8('0x2d')],{'$or':_[_0x6ab8('0x12')](_0x292b36,function(_0x3e6761){if(_0x3e6761[_0x6ab8('0x15')]!==_0x6ab8('0x30')){var _0x26f699={};_0x26f699[_0x3e6761['name']]={'$like':'%'+_0x50cd9f[_0x6ab8('0x17')][_0x6ab8('0x2f')]+'%'};return _0x26f699;}})});}_0x35e92f=_[_0x6ab8('0x31')]({},_0x35e92f,_0x50cd9f['options']);var _0x51111d={'where':_0x35e92f[_0x6ab8('0x2d')]};return db[_0x6ab8('0x32')][_0x6ab8('0x9')](_0x51111d)[_0x6ab8('0xc')](function(_0x14fdc5){_0x41792d['count']=_0x14fdc5;if(_0x50cd9f['query'][_0x6ab8('0x33')]){_0x35e92f['include']=[{'all':!![]}];}return db[_0x6ab8('0x32')][_0x6ab8('0x34')](_0x35e92f);})['then'](function(_0x47c9f9){_0x41792d[_0x6ab8('0x35')]=_0x47c9f9;return _0x41792d;})[_0x6ab8('0xc')](respondWithFilteredResult(_0x543726,_0x35e92f))[_0x6ab8('0x36')](handleError(_0x543726,null));};exports[_0x6ab8('0x37')]=function(_0x2e7fc9,_0x319ada){var _0xef0ce5={'raw':!![],'where':{'id':_0x2e7fc9['params']['id']}},_0x5aa6e5={};_0x5aa6e5[_0x6ab8('0x16')]=_[_0x6ab8('0x38')](db[_0x6ab8('0x32')][_0x6ab8('0x13')]);_0x5aa6e5['query']=_[_0x6ab8('0x38')](_0x2e7fc9['query']);_0x5aa6e5['filters']=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],_0x5aa6e5[_0x6ab8('0x17')]);_0xef0ce5[_0x6ab8('0x28')]=_[_0x6ab8('0x19')](_0x5aa6e5[_0x6ab8('0x16')],qs[_0x6ab8('0x29')](_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x29')]));_0xef0ce5[_0x6ab8('0x28')]=_0xef0ce5[_0x6ab8('0x28')][_0x6ab8('0x2a')]?_0xef0ce5['attributes']:_0x5aa6e5[_0x6ab8('0x16')];if(_0x2e7fc9[_0x6ab8('0x17')][_0x6ab8('0x33')]){_0xef0ce5[_0x6ab8('0x39')]=[{'all':!![]}];}_0xef0ce5=_['merge']({},_0xef0ce5,_0x2e7fc9[_0x6ab8('0x3a')]);return db['CmHopper'][_0x6ab8('0x3b')](_0xef0ce5)[_0x6ab8('0xc')](handleEntityNotFound(_0x319ada,null))['then'](respondWithResult(_0x319ada,null))[_0x6ab8('0x36')](handleError(_0x319ada,null));};exports[_0x6ab8('0x3c')]=function(_0x4b6593,_0x328a19){return db[_0x6ab8('0x32')][_0x6ab8('0x3c')](_0x4b6593[_0x6ab8('0x3d')],{})[_0x6ab8('0xc')](respondWithResult(_0x328a19,0xc9))['catch'](handleError(_0x328a19,null));};exports['update']=function(_0x51a764,_0x408886){if(_0x51a764[_0x6ab8('0x3d')]['id']){delete _0x51a764['body']['id'];}return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x51a764[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x408886,null))[_0x6ab8('0xc')](saveUpdates(_0x51a764[_0x6ab8('0x3d')],null))['then'](respondWithResult(_0x408886,null))[_0x6ab8('0x36')](handleError(_0x408886,null));};exports[_0x6ab8('0x3f')]=function(_0x4b00cc,_0x266026){return db[_0x6ab8('0x32')][_0x6ab8('0x3f')]()['then'](respondWithResult(_0x266026,null))['catch'](handleError(_0x266026,null));};exports[_0x6ab8('0x40')]=function(_0x4c27fa,_0x31965e){var _0x5270c3;var _0x214b8e=_0x4c27fa[_0x6ab8('0x3e')]['id'];return db[_0x6ab8('0x32')][_0x6ab8('0x3b')]({'where':{'id':_0x4c27fa[_0x6ab8('0x3e')]['id']}})[_0x6ab8('0xc')](handleEntityNotFound(_0x31965e,null))['then'](function(_0x5e63ec){if(_0x5e63ec){return _0x5e63ec['destroy']()[_0x6ab8('0xc')](function(_0x54708b){return _0x54708b;});}})[_0x6ab8('0xc')](function(_0x3cacb8){_0x5270c3=_0x3cacb8;if(_0x3cacb8){if(_0x3cacb8[_0x6ab8('0x41')]||_0x3cacb8[_0x6ab8('0x42')]){return db[_0x3cacb8[_0x6ab8('0x41')]?_0x6ab8('0x43'):_0x6ab8('0x44')][_0x6ab8('0x3b')]({'where':{'id':_0x3cacb8['VoiceQueueId']?_0x3cacb8[_0x6ab8('0x41')]:_0x3cacb8[_0x6ab8('0x42')]},'attributes':['id',_0x6ab8('0xf')],'raw':!![]});}}})[_0x6ab8('0xc')](function(_0x5af74c){var _0x619b55={};if(_0x5af74c){_[_0x6ab8('0x31')](_0x619b55,_[_0x6ab8('0x45')](_0x5270c3[_0x6ab8('0x46')],[_0x6ab8('0x47'),_0x6ab8('0x48'),'id']));_0x619b55[_0x6ab8('0x49')]=0x15;_0x619b55[_0x6ab8('0x4a')]='deleted';_0x619b55[_0x6ab8('0x4b')]=_0x5af74c[_0x6ab8('0xf')];_0x619b55['membername']=_0x4c27fa[_0x6ab8('0x4c')][_0x6ab8('0xf')];_0x619b55[_0x6ab8('0x4d')]=_0x4c27fa[_0x6ab8('0x4c')]['id'];_0x619b55[_0x6ab8('0x4e')]=!![];_0x619b55[_0x6ab8('0x4f')]=moment()[_0x6ab8('0x50')](_0x6ab8('0x51'));_0x619b55[_0x6ab8('0x52')]=_0x5270c3['phone'];_0x619b55[_0x6ab8('0x53')]=_0x5270c3[_0x6ab8('0x41')]?_0x6ab8('0x54'):_0x6ab8('0x55');return db['CmContact']['find']({'where':{'id':_0x619b55[_0x6ab8('0x56')]},'attributes':[_0x6ab8('0x57'),_0x6ab8('0x58')]})[_0x6ab8('0xc')](function(_0x17afee){if(!_[_0x6ab8('0x59')](_0x31965e)&&!_[_0x6ab8('0x59')](_0x17afee[_0x6ab8('0x57')])){_0x619b55[_0x6ab8('0x5a')]=_0x17afee[_0x6ab8('0x57')];if(!_['isNil'](_0x17afee['lastName'])){_0x619b55['calleridname']+='\x20'+_0x17afee[_0x6ab8('0x58')];}}})[_0x6ab8('0x5b')](function(){return db[_0x6ab8('0x5c')]['create'](_0x619b55);});}})[_0x6ab8('0xc')](function(_0x399537){return db[_0x6ab8('0x5d')][_0x6ab8('0x40')]({'where':{'CmHopperId':_0x214b8e}});})[_0x6ab8('0xc')](function(){return _0x31965e['status'](0xcc)[_0x6ab8('0x5e')]();})['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x5f')]=function(_0x209d12,_0x2ea704){var _0x5ab635=[];return db[_0x6ab8('0x60')][_0x6ab8('0x3f')]()[_0x6ab8('0xc')](function(_0xd4519c){_0x5ab635=_['keys'](_0xd4519c);return _0x209d12[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id','dialOrderByScheduledAt',_0x6ab8('0x64')],'raw':!![]});})[_0x6ab8('0xc')](function(_0x4c5cee){if(_0x4c5cee&&_0x4c5cee[_0x6ab8('0x2a')]){return db['sequelize']['transaction'](function(_0x35da58){var _0x3d81d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x4c5cee,'id')},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x47fbcb={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4c5cee)[_0x6ab8('0x2f')]([_0x6ab8('0x64'),0x0])[_0x6ab8('0x12')]('id')[_0x6ab8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x209d12[_0x6ab8('0x4c')]['id']}]};var _0x2af78f={'$or':[_0x3d81d3,_0x47fbcb]};var _0x2cde24=[];if(_0x209d12['body'][_0x6ab8('0x66')]&&_0x209d12['body'][_0x6ab8('0x66')]===_0x6ab8('0x67')){if(!_[_0x6ab8('0x68')](_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')])){_0x2af78f['id']={'$in':_0x209d12['body'][_0x6ab8('0x69')]};}_0x2cde24=[['priority',_0x6ab8('0x6a')],[_0x6ab8('0x6b'),_0x4c5cee[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':'ASC'],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x6ab8('0x68')](_0x209d12['body']['hopperIds'])){_0x2af78f['id']={'$notIn':_0x209d12[_0x6ab8('0x3d')][_0x6ab8('0x69')]};}_0x2cde24=[[_0x6ab8('0x6e'),_0x6ab8('0x6f')],[_0x6ab8('0x6b'),_0x4c5cee[0x0][_0x6ab8('0x70')]],db[_0x6ab8('0x6c')][_0x6ab8('0x6d')](_0x6ab8('0x71')),['id','ASC']];}return db[_0x6ab8('0x32')]['findOne']({'attributes':['id',_0x6ab8('0x72'),_0x6ab8('0x73'),_0x6ab8('0x74')],'where':_0x2af78f,'order':_0x2cde24,'transaction':_0x35da58,'lock':_0x35da58[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x5ab635,'include':[{'model':db[_0x6ab8('0x78')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name','dialActive']}]})['then'](function(_0x202a9b){if(_0x202a9b){return _0x202a9b[_0x6ab8('0x7c')]({'UserId':_0x209d12[_0x6ab8('0x4c')]['id']},{'transaction':_0x35da58});}});});}})['then'](handleEntityNotFound(_0x2ea704,null))[_0x6ab8('0xc')](respondWithResult(_0x2ea704,null))[_0x6ab8('0x36')](handleError(_0x2ea704,null));};exports[_0x6ab8('0x7d')]=function(_0x248205,_0x4f82d5,_0x47ad06){var _0x2c4aab=[];var _0x17fde9=_0x248205[_0x6ab8('0x3e')]['id'];var _0x4ddc94=_0x248205[_0x6ab8('0x4c')]['id'];return db['CmContact'][_0x6ab8('0x3f')]()['then'](function(_0x598ca5){_0x2c4aab=_['keys'](_0x598ca5);return db['sequelize'][_0x6ab8('0x7e')](function(_0x16a6e4){const _0x51abcd={'id':_0x17fde9};return db['CmHopper'][_0x6ab8('0x7f')]({'attributes':['id','scheduledat',_0x6ab8('0x74')],'where':_0x51abcd,'transaction':_0x16a6e4,'lock':_0x16a6e4[_0x6ab8('0x75')][_0x6ab8('0x76')],'include':[{'model':db['CmContact'],'as':_0x6ab8('0x77'),'attributes':_0x2c4aab,'include':[{'model':db[_0x6ab8('0x78')],'as':_0x6ab8('0x80'),'attributes':['id',_0x6ab8('0xf')]}]},{'model':db[_0x6ab8('0x79')],'as':_0x6ab8('0x7a'),'attributes':['id',_0x6ab8('0xf')]},{'model':db[_0x6ab8('0x43')],'as':_0x6ab8('0x7b'),'attributes':['id','name',_0x6ab8('0x81')]}]})[_0x6ab8('0xc')](function(_0x237fed){if(_0x237fed){return _0x237fed[_0x6ab8('0x7c')]({'UserId':_0x4ddc94},{'transaction':_0x16a6e4});}});});})[_0x6ab8('0xc')](handleEntityNotFound(_0x4f82d5,null))[_0x6ab8('0xc')](respondWithResult(_0x4f82d5,null))[_0x6ab8('0x36')](handleError(_0x4f82d5,null));};exports[_0x6ab8('0x82')]=function(_0x3b1c90,_0x48ceea){return _0x3b1c90[_0x6ab8('0x4c')][_0x6ab8('0x61')]({'where':{'type':_0x6ab8('0x62'),'dialActive':!![],'dialMethod':_0x6ab8('0x63')},'attributes':['id'],'raw':!![]})['then'](function(_0x4f53c2){if(_0x4f53c2&&_0x4f53c2['length']){return db[_0x6ab8('0x32')][_0x6ab8('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6ab8('0x50')](_0x6ab8('0x51'))},'VoiceQueueId':{'$in':_[_0x6ab8('0x12')](_0x4f53c2,'id')},'$or':[{'UserId':null},{'UserId':_0x3b1c90[_0x6ab8('0x4c')]['id']}]}});}return 0x0;})[_0x6ab8('0xc')](function(_0x3ce36c){if(!_[_0x6ab8('0x59')](_0x3ce36c)&&_[_0x6ab8('0x83')](_0x3ce36c)){return _0x48ceea[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'contacts':_0x3ce36c});}else{logger['error'](_0x6ab8('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x48ceea['sendStatus'](0x194);}})[_0x6ab8('0x36')](handleError(_0x48ceea,null));};exports['getTimezones']=function(_0x35045f,_0x40276f){var _0x5e30d0=shared[_0x6ab8('0x85')];var _0x17c6ea=[];_[_0x6ab8('0x12')](_0x5e30d0,function(_0x126714){_0x17c6ea[_0x6ab8('0x86')]({'id':_0x126714[_0x6ab8('0xf')],'name':_0x126714[_0x6ab8('0xf')],'utcOffset':_0x126714[_0x6ab8('0x87')]});});return _0x40276f[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')]({'tz':_0x17c6ea});};exports['getTimezone']=function(_0x2f8c09,_0x58ba1b){var _0x2b07af=shared[_0x6ab8('0x85')];var _0x5984cd={};if(!_[_0x6ab8('0x59')](_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']]))_0x5984cd=_0x2b07af[_0x2f8c09[_0x6ab8('0x3d')]['id']];return _0x58ba1b[_0x6ab8('0x4')](0xc8)[_0x6ab8('0x5')](_0x5984cd);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f7b0571..51b858c 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 _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4cd226,_0x489a22){var _0x19c008=function(_0x14a9e2){while(--_0x14a9e2){_0x4cd226['push'](_0x4cd226['shift']());}};_0x19c008(++_0x489a22);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x9536,0x179));var _0x6953=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x9536[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'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 d3a242f..ea25719 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 _0x05a0=['error','message','find','then','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','literal','NOW()','CmList','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','options','raw','where','limit','include','map','model','attributes','info','debug','stringify','catch'];(function(_0x56a37a,_0xffb054){var _0x3a57ff=function(_0x16339e){while(--_0x16339e){_0x56a37a['push'](_0x56a37a['shift']());}};_0x3a57ff(++_0xffb054);}(_0x05a0,0x12d));var _0x005a=function(_0x3d6bb4,_0xab2e40){_0x3d6bb4=_0x3d6bb4-0x0;var _0x1d9370=_0x05a0[_0x3d6bb4];return _0x1d9370;};'use strict';var _=require('lodash');var util=require(_0x005a('0x0'));var moment=require(_0x005a('0x1'));var BPromise=require(_0x005a('0x2'));var db=require(_0x005a('0x3'))['db'];var logger=require(_0x005a('0x4'))('rpc');exports[_0x005a('0x5')]=function(_0x59378d){var _0x1e51bb=this;return new Promise(function(_0x470e4,_0x19b9ec){return db[_0x005a('0x6')]['findAll']({'raw':_0x59378d[_0x005a('0x7')]?_0x59378d['options'][_0x005a('0x8')]===undefined?!![]:![]:!![],'where':_0x59378d['options']?_0x59378d[_0x005a('0x7')][_0x005a('0x9')]||null:null,'attributes':_0x59378d['options']?_0x59378d['options']['attributes']||null:null,'limit':_0x59378d[_0x005a('0x7')]?_0x59378d[_0x005a('0x7')][_0x005a('0xa')]||null:null,'include':_0x59378d['options']?_0x59378d[_0x005a('0x7')][_0x005a('0xb')]?_[_0x005a('0xc')](_0x59378d[_0x005a('0x7')][_0x005a('0xb')],function(_0x2bc50c){return{'model':db[_0x2bc50c[_0x005a('0xd')]],'as':_0x2bc50c['as'],'attributes':_0x2bc50c[_0x005a('0xe')],'include':_0x2bc50c[_0x005a('0xb')]?_['map'](_0x2bc50c[_0x005a('0xb')],function(_0x1bb037){return{'model':db[_0x1bb037[_0x005a('0xd')]],'as':_0x1bb037['as'],'attributes':_0x1bb037['attributes'],'include':_0x1bb037['include']?_['map'](_0x1bb037[_0x005a('0xb')],function(_0x319170){return{'model':db[_0x319170['model']],'as':_0x319170['as'],'attributes':_0x319170[_0x005a('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29eaeb){logger[_0x005a('0xf')]('GetCmHopper',_0x59378d);logger[_0x005a('0x10')](_0x005a('0x5'),_0x59378d,JSON[_0x005a('0x11')](_0x29eaeb));_0x470e4(_0x29eaeb);})[_0x005a('0x12')](function(_0x157131){logger[_0x005a('0x13')](_0x005a('0x5'),_0x157131[_0x005a('0x14')],_0x59378d);_0x19b9ec(_0x1e51bb[_0x005a('0x13')](0x1f4,_0x157131[_0x005a('0x14')]));});});};exports['ShowCmHopper']=function(_0x30d761){var _0x235412=this;return new Promise(function(_0x553f7e,_0x44d682){return db[_0x005a('0x6')][_0x005a('0x15')]({'raw':_0x30d761[_0x005a('0x7')]?_0x30d761['options'][_0x005a('0x8')]===undefined?!![]:![]:!![],'where':_0x30d761['options']?_0x30d761[_0x005a('0x7')]['where']||null:null,'attributes':_0x30d761[_0x005a('0x7')]?_0x30d761[_0x005a('0x7')][_0x005a('0xe')]||null:null,'include':_0x30d761[_0x005a('0x7')]?_0x30d761[_0x005a('0x7')][_0x005a('0xb')]?_[_0x005a('0xc')](_0x30d761[_0x005a('0x7')][_0x005a('0xb')],function(_0x357593){return{'model':db[_0x357593[_0x005a('0xd')]],'as':_0x357593['as'],'attributes':_0x357593[_0x005a('0xe')],'include':_0x357593[_0x005a('0xb')]?_[_0x005a('0xc')](_0x357593['include'],function(_0x58bf13){return{'model':db[_0x58bf13[_0x005a('0xd')]],'as':_0x58bf13['as'],'attributes':_0x58bf13[_0x005a('0xe')],'include':_0x58bf13[_0x005a('0xb')]?_[_0x005a('0xc')](_0x58bf13[_0x005a('0xb')],function(_0x250c91){return{'model':db[_0x250c91['model']],'as':_0x250c91['as'],'attributes':_0x250c91[_0x005a('0xe')]};}):[]};}):[]};}):[]:[]})[_0x005a('0x16')](function(_0x3e2223){logger[_0x005a('0xf')](_0x005a('0x17'),_0x30d761);logger[_0x005a('0x10')](_0x005a('0x17'),_0x30d761,JSON['stringify'](_0x3e2223));_0x553f7e(_0x3e2223);})[_0x005a('0x12')](function(_0x2b8ce8){logger[_0x005a('0x13')](_0x005a('0x17'),_0x2b8ce8[_0x005a('0x14')],_0x30d761);_0x44d682(_0x235412[_0x005a('0x13')](0x1f4,_0x2b8ce8[_0x005a('0x14')]));});});};exports[_0x005a('0x18')]=function(_0x47e4c0){var _0x138922=this;return new Promise(function(_0x109ae9,_0x430d3b){return db[_0x005a('0x6')][_0x005a('0x19')](_0x47e4c0[_0x005a('0x1a')],{'raw':_0x47e4c0[_0x005a('0x7')]?_0x47e4c0[_0x005a('0x7')][_0x005a('0x8')]===undefined?!![]:![]:!![]})[_0x005a('0x16')](function(_0x351f07){logger[_0x005a('0xf')](_0x005a('0x18'),_0x47e4c0);logger[_0x005a('0x10')](_0x005a('0x18'),_0x47e4c0,JSON['stringify'](_0x351f07));_0x109ae9(_0x351f07);})[_0x005a('0x12')](function(_0x4af7ab){logger[_0x005a('0x13')](_0x005a('0x18'),_0x4af7ab['message'],_0x47e4c0);_0x430d3b(_0x138922[_0x005a('0x13')](0x1f4,_0x4af7ab[_0x005a('0x14')]));});});};exports[_0x005a('0x1b')]=function(_0x1ac4e1){var _0x1992dd=this;return new Promise(function(_0x53a037,_0x5ef32e){return db[_0x005a('0x6')][_0x005a('0x1c')](_0x1ac4e1[_0x005a('0x1a')],{'raw':_0x1ac4e1[_0x005a('0x7')]?_0x1ac4e1['options'][_0x005a('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac4e1['options']?_0x1ac4e1[_0x005a('0x7')]['where']||null:null,'attributes':_0x1ac4e1[_0x005a('0x7')]?_0x1ac4e1[_0x005a('0x7')]['attributes']||null:null,'limit':_0x1ac4e1['options']?_0x1ac4e1['options'][_0x005a('0xa')]||null:null})[_0x005a('0x16')](function(_0x237a99){logger[_0x005a('0xf')](_0x005a('0x1b'),_0x1ac4e1);logger[_0x005a('0xf')](_0x005a('0x1d'),JSON['stringify'](_0x1ac4e1[_0x005a('0x7')]['where']),_0x1ac4e1[_0x005a('0x1a')][_0x005a('0x1e')]);logger[_0x005a('0x10')](_0x005a('0x1b'),_0x1ac4e1,JSON[_0x005a('0x11')](_0x237a99));_0x53a037(_0x237a99);})[_0x005a('0x12')](function(_0x126340){logger[_0x005a('0x13')](_0x005a('0x1b'),_0x126340[_0x005a('0x14')],_0x1ac4e1);_0x5ef32e(_0x1992dd[_0x005a('0x13')](0x1f4,_0x126340['message']));});});};exports[_0x005a('0x1f')]=function(_0x51e1a2){var _0x42d2fa=this;return new Promise(function(_0x222040,_0x38b3fb){return db[_0x005a('0x6')][_0x005a('0x20')]({'where':_0x51e1a2['options']?_0x51e1a2[_0x005a('0x7')][_0x005a('0x9')]||null:null})[_0x005a('0x16')](function(_0x57a576){logger[_0x005a('0xf')](_0x005a('0x1f'),_0x51e1a2);logger['debug']('DestroyCmHopper',_0x51e1a2,JSON[_0x005a('0x11')](_0x57a576));_0x222040(_0x57a576);})[_0x005a('0x12')](function(_0x3d518f){logger[_0x005a('0x13')](_0x005a('0x1f'),_0x3d518f['message'],_0x51e1a2);_0x38b3fb(_0x42d2fa['error'](0x1f4,_0x3d518f['message']));});});};exports['GetContactDialer']=function(_0x58f722){var _0x191d90=this;return new Promise(function(_0x466c7c,_0x1c840a){return db[_0x005a('0x21')][_0x005a('0x22')]()[_0x005a('0x16')](function(_0x590e96){return db[_0x005a('0x23')][_0x005a('0x24')](function(_0x4a46f7){return db['CmHopper'][_0x005a('0x25')]({'where':_0x58f722[_0x005a('0x7')]?_0x58f722[_0x005a('0x7')][_0x005a('0x9')]||null:null,'attributes':_0x58f722[_0x005a('0x7')]?_0x58f722[_0x005a('0x7')][_0x005a('0xe')]||null:null,'limit':_0x58f722[_0x005a('0x7')]?_0x58f722['options']['limit']||null:null,'order':_0x58f722[_0x005a('0x7')]?_0x58f722[_0x005a('0x7')][_0x005a('0x26')]||null:null,'transaction':_0x4a46f7,'lock':_0x4a46f7[_0x005a('0x27')][_0x005a('0x28')],'include':[{'model':db[_0x005a('0x21')],'as':_0x005a('0x29'),'attributes':_[_0x005a('0x2a')](_0x590e96)},{'model':db[_0x005a('0x2b')],'as':_0x005a('0x2c'),'attributes':['id',_0x005a('0x2d'),_0x005a('0x2e')]}]})[_0x005a('0x16')](function(_0x3aadcb){var _0x537faf=[];var _0x52f8c5=[];for(var _0x22c22e=0x0;_0x22c22e<_0x3aadcb[_0x005a('0x2f')];_0x22c22e+=0x1){var _0x327c9c=_0x3aadcb[_0x22c22e][_0x005a('0x30')];if(_0x327c9c===null){_0x537faf[_0x005a('0x31')](_0x3aadcb[_0x22c22e][_0x005a('0x1c')](_0x58f722['body'],{'transaction':_0x4a46f7}));}else if(!_0x52f8c5[_0x005a('0x32')](_0x327c9c)){_0x52f8c5[_0x005a('0x31')](_0x327c9c);_0x537faf['push'](_0x3aadcb[_0x22c22e]['update'](_0x58f722[_0x005a('0x1a')],{'transaction':_0x4a46f7}));}}return BPromise[_0x005a('0x33')](_0x537faf);});})[_0x005a('0x16')](function(_0x23d43d){logger[_0x005a('0xf')](_0x005a('0x34'),_0x58f722);if(_0x23d43d[_0x005a('0x2f')]>0x0){logger[_0x005a('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x23d43d[0x0][_0x005a('0x35')]['id'],_0x23d43d[0x0][_0x005a('0x35')][_0x005a('0x36')],_0x23d43d[0x0][_0x005a('0x35')][_0x005a('0x1e')]);}logger[_0x005a('0x10')](_0x005a('0x34'),_0x58f722,JSON['stringify'](_0x23d43d));_0x466c7c(_0x23d43d);})[_0x005a('0x12')](function(_0xca9ee1){logger[_0x005a('0x13')](_0x005a('0x34'),_0xca9ee1[_0x005a('0x14')],_0x58f722);_0x1c840a(_0x191d90[_0x005a('0x13')](0x1f4,_0xca9ee1['message']));});});});};exports[_0x005a('0x37')]=function(_0x4b8eab){var _0x189da4=this;return new Promise(function(_0x236aef,_0x5a59d9){return db[_0x005a('0x23')][_0x005a('0x24')](function(_0x94b4){return db[_0x005a('0x38')][_0x005a('0x19')](_0x4b8eab[_0x005a('0x1a')],{'raw':_0x4b8eab[_0x005a('0x7')]?_0x4b8eab['options'][_0x005a('0x8')]===undefined?!![]:![]:!![],'transaction':_0x94b4})[_0x005a('0x16')](function(){logger[_0x005a('0xf')](_0x005a('0x39'),JSON[_0x005a('0x11')](_0x4b8eab[_0x005a('0x7')][_0x005a('0x9')]),_0x4b8eab[_0x005a('0x7')][_0x005a('0x9')][_0x005a('0x1e')]);return db[_0x005a('0x6')][_0x005a('0x20')]({'where':_0x4b8eab[_0x005a('0x7')]?_0x4b8eab[_0x005a('0x7')][_0x005a('0x9')]||null:null,'transaction':_0x94b4});});})[_0x005a('0x16')](function(_0x1eaa9e){logger['info'](_0x005a('0x37'),_0x4b8eab);logger[_0x005a('0x10')](_0x005a('0x37'),_0x4b8eab,JSON[_0x005a('0x11')](_0x1eaa9e));_0x236aef(_0x1eaa9e);})[_0x005a('0x12')](function(_0x15dd94){logger['error'](_0x005a('0x37'),_0x15dd94['message'],_0x4b8eab);_0x5a59d9(_0x189da4[_0x005a('0x13')](0x1f4,_0x15dd94[_0x005a('0x14')]));});});};exports[_0x005a('0x3a')]=function(_0xb0a72f){var _0x3f04ef=this;return new Promise(function(_0x32d617,_0x24e376){return db[_0x005a('0x6')][_0x005a('0x25')]({'raw':_0xb0a72f[_0x005a('0x7')]?_0xb0a72f[_0x005a('0x7')][_0x005a('0x8')]===undefined?!![]:![]:!![],'where':_0xb0a72f[_0x005a('0x7')]?_0xb0a72f[_0x005a('0x7')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x005a('0x23')]['literal'](_0x005a('0x3b')+util['format'](_0x005a('0x3c'),moment()[_0x005a('0x3d')](_0x005a('0x3e')))+_0x005a('0x3f')))),_0x005a('0x40')]]})['then'](function(_0x516d89){logger[_0x005a('0xf')](_0x005a('0x3a'),_0xb0a72f);logger['debug'](_0x005a('0x3a'),_0xb0a72f,JSON[_0x005a('0x11')](_0x516d89));_0x32d617(_0x516d89);})['catch'](function(_0x397e87){logger['error'](_0x005a('0x3a'),_0x397e87[_0x005a('0x14')],_0xb0a72f);_0x24e376(_0x3f04ef[_0x005a('0x13')](0x1f4,_0x397e87[_0x005a('0x14')]));});});};exports[_0x005a('0x41')]=function(_0x2b283a){var _0x2e63e4=this;return new Promise(function(_0x102907,_0x1f4f94){return db['CmContact'][_0x005a('0x22')]()[_0x005a('0x16')](function(){return db[_0x005a('0x23')][_0x005a('0x24')](function(_0x21cc82){return db[_0x005a('0x6')][_0x005a('0x25')]({'where':_0x2b283a[_0x005a('0x7')]?_0x2b283a[_0x005a('0x7')][_0x005a('0x9')]||null:null,'attributes':_0x2b283a[_0x005a('0x7')]?_0x2b283a[_0x005a('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x2b283a['options']?_0x2b283a[_0x005a('0x7')][_0x005a('0x26')]||null:null,'group':db[_0x005a('0x6')][_0x005a('0x30')],'transaction':_0x21cc82,'lock':_0x21cc82[_0x005a('0x27')][_0x005a('0x28')],'include':_0x2b283a[_0x005a('0x7')]?_0x2b283a[_0x005a('0x7')][_0x005a('0xb')]?_[_0x005a('0xc')](_0x2b283a[_0x005a('0x7')][_0x005a('0xb')],function(_0x51c012){return{'model':db[_0x51c012[_0x005a('0xd')]],'as':_0x51c012['as'],'attributes':_0x51c012['attributes'],'include':_0x51c012['include']?_[_0x005a('0xc')](_0x51c012['include'],function(_0x2731ab){return{'model':db[_0x2731ab['model']],'as':_0x2731ab['as'],'attributes':_0x2731ab[_0x005a('0xe')],'include':_0x2731ab[_0x005a('0xb')]?_['map'](_0x2731ab[_0x005a('0xb')],function(_0x2e9daa){return{'model':db[_0x2e9daa['model']],'as':_0x2e9daa['as'],'attributes':_0x2e9daa[_0x005a('0xe')]};}):[]};}):[]};}):[]:[]})[_0x005a('0x16')](function(_0x421e38){var _0xc67665=[];for(var _0x1034df=0x0;_0x1034df<_0x421e38[_0x005a('0x2f')];_0x1034df+=0x1){_0xc67665[_0x005a('0x31')](_0x421e38[_0x1034df]['update'](_0x2b283a[_0x005a('0x1a')],{'transaction':_0x21cc82}));}return BPromise[_0x005a('0x33')](_0xc67665);});})[_0x005a('0x16')](function(_0x4c1428){logger['info'](_0x005a('0x41'),_0x2b283a);logger[_0x005a('0x10')]('GetContactRecallMe',_0x2b283a,JSON[_0x005a('0x11')](_0x4c1428));_0x102907(_0x4c1428);})[_0x005a('0x12')](function(_0x3ba8b7){logger[_0x005a('0x13')](_0x005a('0x41'),_0x3ba8b7[_0x005a('0x14')],_0x2b283a);_0x1f4f94(_0x2e63e4[_0x005a('0x13')](0x1f4,_0x3ba8b7[_0x005a('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x22f016){var _0x59f63b=this;return new Promise(function(_0x1ba42c,_0x410567){db['CmContact'][_0x005a('0x22')]()[_0x005a('0x16')](function(_0x3eb713){return db['CmHopper'][_0x005a('0x25')]({'raw':_0x22f016[_0x005a('0x7')]?_0x22f016[_0x005a('0x7')][_0x005a('0x8')]===undefined?!![]:![]:!![],'where':_0x22f016[_0x005a('0x7')]?_0x22f016[_0x005a('0x7')][_0x005a('0x9')]||null:null,'attributes':_0x22f016[_0x005a('0x7')]?_0x22f016[_0x005a('0x7')][_0x005a('0xe')]||null:null,'limit':_0x22f016[_0x005a('0x7')]?_0x22f016[_0x005a('0x7')][_0x005a('0xa')]||null:null,'include':_0x22f016[_0x005a('0x7')]?_0x22f016[_0x005a('0x7')]['include']?_[_0x005a('0xc')](_0x22f016[_0x005a('0x7')]['include'],function(_0x4f7192){return{'model':db[_0x4f7192['model']],'as':_0x4f7192['as'],'attributes':_0x4f7192['as']===_0x005a('0x29')?_['keys'](_0x3eb713):_0x4f7192[_0x005a('0xe')],'include':_0x4f7192[_0x005a('0xb')]?_[_0x005a('0xc')](_0x4f7192[_0x005a('0xb')],function(_0x513697){return{'model':db[_0x513697[_0x005a('0xd')]],'as':_0x513697['as'],'attributes':_0x513697[_0x005a('0xe')],'include':_0x513697['include']?_['map'](_0x513697['include'],function(_0x591c63){return{'model':db[_0x591c63[_0x005a('0xd')]],'as':_0x591c63['as'],'attributes':_0x591c63[_0x005a('0xe')]};}):[]};}):[]};}):[]:[]})[_0x005a('0x16')](function(_0x4f71b5){logger[_0x005a('0xf')]('GetCmHopper',_0x22f016);logger[_0x005a('0x10')](_0x005a('0x5'),_0x22f016,JSON[_0x005a('0x11')](_0x4f71b5));_0x1ba42c(_0x4f71b5);})['catch'](function(_0x3150f){logger[_0x005a('0x13')](_0x005a('0x5'),_0x3150f['message'],_0x22f016);_0x410567(_0x59f63b[_0x005a('0x13')](0x1f4,_0x3150f['message']));});});});};exports[_0x005a('0x42')]=function(_0x530f53){var _0x2c1b76=this;return new Promise(function(_0x7c8cf5,_0x54cbbb){return db[_0x005a('0x21')]['findOne']({'raw':!![],'where':{'phone':_0x530f53['options']['where'][_0x005a('0x43')]},'attributes':['id',_0x005a('0x44')],'order':[['id',_0x005a('0x45')]]})[_0x005a('0x16')](function(_0x51b09a){logger['info'](_0x005a('0x46'),_0x530f53);logger[_0x005a('0x10')](_0x005a('0x46'),_0x530f53,JSON[_0x005a('0x11')](_0x51b09a));_0x7c8cf5(_0x51b09a);})['catch'](function(_0x3b64f0){logger['error']('getContactByPhone',_0x3b64f0[_0x005a('0x14')],_0x530f53);_0x54cbbb(_0x2c1b76[_0x005a('0x13')](0x1f4,_0x3b64f0[_0x005a('0x14')]));});});};exports['ResetActiveCalls']=function(_0x2845a6){var _0xf426f8=this;return new Promise(function(_0x20e058,_0x222007){return db[_0x005a('0x23')][_0x005a('0x24')](function(_0x59d7e5){var _0x31f9c2=_0x2845a6[_0x005a('0x7')]&&_0x2845a6[_0x005a('0x7')][_0x005a('0x9')]?_0x2845a6[_0x005a('0x7')][_0x005a('0x9')]:{};return db[_0x005a('0x6')][_0x005a('0x1c')](_0x2845a6['body'],{'where':_0x31f9c2,'transaction':_0x59d7e5})[_0x005a('0x16')](function(_0xb32f39){logger[_0x005a('0xf')]('ResetActiveCalls',_0x2845a6);logger['debug'](_0x005a('0x47'),_0x2845a6,JSON['stringify'](_0xb32f39));_0x20e058(_0xb32f39);})[_0x005a('0x12')](function(_0x285904){logger['error'](_0x005a('0x47'),_0x285904[_0x005a('0x14')],_0x2845a6);_0x222007(_0xf426f8[_0x005a('0x13')](0x1f4,_0x285904[_0x005a('0x14')]));});});});};exports[_0x005a('0x48')]=function(_0x11b618){var _0x454f02=this;var _0x33f2d4=_0x11b618[_0x005a('0x1a')][_0x005a('0x9')][_0x005a('0x49')];var _0xb61d3a=_0x11b618[_0x005a('0x1a')][_0x005a('0x9')][_0x005a('0x4a')];var _0x4fb822=_0x11b618[_0x005a('0x1a')][_0x005a('0x9')][_0x005a('0x4b')];return new Promise(function(_0x1dce8d,_0x1609e7){return db[_0x005a('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x33f2d4},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x005a('0x23')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0xb61d3a+_0x005a('0x4c')),'$gt':db[_0x005a('0x23')][_0x005a('0x4d')](_0x005a('0x4e'))}},'UserId':{'$in':_0x4fb822}},'include':[{'model':db['CmContact'],'as':_0x005a('0x29')},{'model':db[_0x005a('0x2b')],'as':'Agent','attributes':['id',_0x005a('0x2d'),'voicePause']},{'model':db[_0x005a('0x4f')],'as':'List'}]})[_0x005a('0x16')](function(_0x52119b){if(_0x52119b['length']>0x0){return db[_0x005a('0x23')][_0x005a('0x24')](function(_0x423b2e){return db[_0x005a('0x6')][_0x005a('0x1c')]({'recallmeNotifiedDate':db[_0x005a('0x23')][_0x005a('0x4d')](_0x005a('0x4e'))},{'where':{'id':{'$in':_['map'](_0x52119b,'id')}},'transaction':_0x423b2e})[_0x005a('0x16')](function(){_0x1dce8d(_0x52119b);})[_0x005a('0x12')](function(_0x54095b){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x54095b[_0x005a('0x14')],_0x11b618);_0x1609e7(_0x454f02[_0x005a('0x13')](0x1f4,_0x54095b[_0x005a('0x14')]));});})[_0x005a('0x12')](function(_0x472644){logger[_0x005a('0x13')](_0x005a('0x48'),_0x472644['message'],_0x11b618);_0x1609e7(_0x454f02[_0x005a('0x13')](0x1f4,_0x472644[_0x005a('0x14')]));});}else{_0x1dce8d(_0x52119b);}});});}; \ No newline at end of file +var _0x54ad=['MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','model','attributes','include','map','info','debug','stringify','error','message','find','then','ShowCmHopper','CreateCmHopper','create','body','catch','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues'];(function(_0x4c4547,_0x460e32){var _0x565c3a=function(_0x140227){while(--_0x140227){_0x4c4547['push'](_0x4c4547['shift']());}};_0x565c3a(++_0x460e32);}(_0x54ad,0x165));var _0xd54a=function(_0x25a3ef,_0x2936de){_0x25a3ef=_0x25a3ef-0x0;var _0x2b64bc=_0x54ad[_0x25a3ef];return _0x2b64bc;};'use strict';var _=require('lodash');var util=require(_0xd54a('0x0'));var moment=require('moment');var BPromise=require(_0xd54a('0x1'));var db=require(_0xd54a('0x2'))['db'];var logger=require('../../config/logger')(_0xd54a('0x3'));exports[_0xd54a('0x4')]=function(_0x4cb1ab){var _0x1cefea=this;return new Promise(function(_0x44a9d6,_0x3e03d6){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'raw':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab['options'][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab['options'][_0xd54a('0x9')]||null:null,'attributes':_0x4cb1ab['options']?_0x4cb1ab['options']['attributes']||null:null,'limit':_0x4cb1ab['options']?_0x4cb1ab[_0xd54a('0x7')]['limit']||null:null,'include':_0x4cb1ab[_0xd54a('0x7')]?_0x4cb1ab[_0xd54a('0x7')]['include']?_['map'](_0x4cb1ab[_0xd54a('0x7')]['include'],function(_0x1260ad){return{'model':db[_0x1260ad[_0xd54a('0xa')]],'as':_0x1260ad['as'],'attributes':_0x1260ad[_0xd54a('0xb')],'include':_0x1260ad[_0xd54a('0xc')]?_['map'](_0x1260ad['include'],function(_0x5d8df0){return{'model':db[_0x5d8df0[_0xd54a('0xa')]],'as':_0x5d8df0['as'],'attributes':_0x5d8df0[_0xd54a('0xb')],'include':_0x5d8df0[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x5d8df0[_0xd54a('0xc')],function(_0x36b52c){return{'model':db[_0x36b52c[_0xd54a('0xa')]],'as':_0x36b52c['as'],'attributes':_0x36b52c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c12be){logger[_0xd54a('0xe')](_0xd54a('0x4'),_0x4cb1ab);logger[_0xd54a('0xf')](_0xd54a('0x4'),_0x4cb1ab,JSON[_0xd54a('0x10')](_0x4c12be));_0x44a9d6(_0x4c12be);})['catch'](function(_0x595726){logger[_0xd54a('0x11')](_0xd54a('0x4'),_0x595726['message'],_0x4cb1ab);_0x3e03d6(_0x1cefea[_0xd54a('0x11')](0x1f4,_0x595726[_0xd54a('0x12')]));});});};exports['ShowCmHopper']=function(_0x351a09){var _0x2dee16=this;return new Promise(function(_0x353804,_0x8771cc){return db[_0xd54a('0x5')][_0xd54a('0x13')]({'raw':_0x351a09[_0xd54a('0x7')]?_0x351a09['options'][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')]['attributes']||null:null,'include':_0x351a09[_0xd54a('0x7')]?_0x351a09[_0xd54a('0x7')][_0xd54a('0xc')]?_['map'](_0x351a09[_0xd54a('0x7')][_0xd54a('0xc')],function(_0x22806d){return{'model':db[_0x22806d[_0xd54a('0xa')]],'as':_0x22806d['as'],'attributes':_0x22806d['attributes'],'include':_0x22806d[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x22806d['include'],function(_0x5b5ae2){return{'model':db[_0x5b5ae2[_0xd54a('0xa')]],'as':_0x5b5ae2['as'],'attributes':_0x5b5ae2['attributes'],'include':_0x5b5ae2['include']?_[_0xd54a('0xd')](_0x5b5ae2[_0xd54a('0xc')],function(_0x1d6ec9){return{'model':db[_0x1d6ec9[_0xd54a('0xa')]],'as':_0x1d6ec9['as'],'attributes':_0x1d6ec9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0x130d27){logger[_0xd54a('0xe')](_0xd54a('0x15'),_0x351a09);logger[_0xd54a('0xf')](_0xd54a('0x15'),_0x351a09,JSON[_0xd54a('0x10')](_0x130d27));_0x353804(_0x130d27);})['catch'](function(_0x165900){logger[_0xd54a('0x11')](_0xd54a('0x15'),_0x165900[_0xd54a('0x12')],_0x351a09);_0x8771cc(_0x2dee16[_0xd54a('0x11')](0x1f4,_0x165900[_0xd54a('0x12')]));});});};exports[_0xd54a('0x16')]=function(_0x4a39df){var _0x596b4f=this;return new Promise(function(_0x3b382d,_0x1c2803){return db[_0xd54a('0x5')][_0xd54a('0x17')](_0x4a39df[_0xd54a('0x18')],{'raw':_0x4a39df[_0xd54a('0x7')]?_0x4a39df['options']['raw']===undefined?!![]:![]:!![]})[_0xd54a('0x14')](function(_0x1d6dd7){logger[_0xd54a('0xe')](_0xd54a('0x16'),_0x4a39df);logger[_0xd54a('0xf')]('CreateCmHopper',_0x4a39df,JSON[_0xd54a('0x10')](_0x1d6dd7));_0x3b382d(_0x1d6dd7);})[_0xd54a('0x19')](function(_0x42b406){logger[_0xd54a('0x11')]('CreateCmHopper',_0x42b406[_0xd54a('0x12')],_0x4a39df);_0x1c2803(_0x596b4f['error'](0x1f4,_0x42b406[_0xd54a('0x12')]));});});};exports[_0xd54a('0x1a')]=function(_0x16a7d4){var _0xf20de8=this;return new Promise(function(_0x5b7b88,_0x29d958){return db[_0xd54a('0x5')][_0xd54a('0x1b')](_0x16a7d4[_0xd54a('0x18')],{'raw':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x16a7d4['options']?_0x16a7d4['options'][_0xd54a('0xb')]||null:null,'limit':_0x16a7d4[_0xd54a('0x7')]?_0x16a7d4[_0xd54a('0x7')][_0xd54a('0x1c')]||null:null})[_0xd54a('0x14')](function(_0x37933b){logger[_0xd54a('0xe')]('UpdateCmHopper',_0x16a7d4);logger['info'](_0xd54a('0x1d'),JSON[_0xd54a('0x10')](_0x16a7d4['options'][_0xd54a('0x9')]),_0x16a7d4[_0xd54a('0x18')][_0xd54a('0x1e')]);logger['debug'](_0xd54a('0x1a'),_0x16a7d4,JSON[_0xd54a('0x10')](_0x37933b));_0x5b7b88(_0x37933b);})[_0xd54a('0x19')](function(_0x1c7368){logger['error']('UpdateCmHopper',_0x1c7368['message'],_0x16a7d4);_0x29d958(_0xf20de8[_0xd54a('0x11')](0x1f4,_0x1c7368[_0xd54a('0x12')]));});});};exports[_0xd54a('0x1f')]=function(_0x25a4d6){var _0x2d7689=this;return new Promise(function(_0x1d279a,_0x161349){return db['CmHopper'][_0xd54a('0x20')]({'where':_0x25a4d6['options']?_0x25a4d6['options'][_0xd54a('0x9')]||null:null})[_0xd54a('0x14')](function(_0x190194){logger[_0xd54a('0xe')](_0xd54a('0x1f'),_0x25a4d6);logger[_0xd54a('0xf')](_0xd54a('0x1f'),_0x25a4d6,JSON[_0xd54a('0x10')](_0x190194));_0x1d279a(_0x190194);})[_0xd54a('0x19')](function(_0x2b8b98){logger[_0xd54a('0x11')](_0xd54a('0x1f'),_0x2b8b98['message'],_0x25a4d6);_0x161349(_0x2d7689[_0xd54a('0x11')](0x1f4,_0x2b8b98[_0xd54a('0x12')]));});});};exports[_0xd54a('0x21')]=function(_0x2088bb){var _0x40c008=this;return new Promise(function(_0x3cc240,_0x50bb71){return db[_0xd54a('0x22')][_0xd54a('0x23')]()[_0xd54a('0x14')](function(_0xce7a0f){return db[_0xd54a('0x24')]['transaction'](function(_0x277349){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'where':_0x2088bb[_0xd54a('0x7')]?_0x2088bb['options'][_0xd54a('0x9')]||null:null,'attributes':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0xb')]||null:null,'limit':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0x1c')]||null:null,'order':_0x2088bb[_0xd54a('0x7')]?_0x2088bb[_0xd54a('0x7')][_0xd54a('0x25')]||null:null,'transaction':_0x277349,'lock':_0x277349[_0xd54a('0x26')][_0xd54a('0x27')],'include':[{'model':db[_0xd54a('0x22')],'as':_0xd54a('0x28'),'attributes':_[_0xd54a('0x29')](_0xce7a0f)},{'model':db[_0xd54a('0x2a')],'as':_0xd54a('0x2b'),'attributes':['id',_0xd54a('0x2c'),_0xd54a('0x2d')]}]})[_0xd54a('0x14')](function(_0x35a33d){var _0x1a0017=[];var _0x378aa2=[];for(var _0x735cf9=0x0;_0x735cf9<_0x35a33d['length'];_0x735cf9+=0x1){var _0x123494=_0x35a33d[_0x735cf9][_0xd54a('0x2e')];if(_0x123494===null){_0x1a0017[_0xd54a('0x2f')](_0x35a33d[_0x735cf9][_0xd54a('0x1b')](_0x2088bb['body'],{'transaction':_0x277349}));}else if(!_0x378aa2[_0xd54a('0x30')](_0x123494)){_0x378aa2[_0xd54a('0x2f')](_0x123494);_0x1a0017[_0xd54a('0x2f')](_0x35a33d[_0x735cf9]['update'](_0x2088bb['body'],{'transaction':_0x277349}));}}return BPromise[_0xd54a('0x31')](_0x1a0017);});})[_0xd54a('0x14')](function(_0x92efcb){logger['info'](_0xd54a('0x21'),_0x2088bb);if(_0x92efcb[_0xd54a('0x32')]>0x0){logger[_0xd54a('0xe')](_0xd54a('0x33'),_0x92efcb[0x0]['dataValues']['id'],_0x92efcb[0x0][_0xd54a('0x34')]['ContactId'],_0x92efcb[0x0][_0xd54a('0x34')][_0xd54a('0x1e')]);}logger[_0xd54a('0xf')](_0xd54a('0x21'),_0x2088bb,JSON['stringify'](_0x92efcb));_0x3cc240(_0x92efcb);})[_0xd54a('0x19')](function(_0x3e7784){logger[_0xd54a('0x11')](_0xd54a('0x21'),_0x3e7784[_0xd54a('0x12')],_0x2088bb);_0x50bb71(_0x40c008[_0xd54a('0x11')](0x1f4,_0x3e7784[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x35')]=function(_0x2ebed5){var _0x316fdf=this;return new Promise(function(_0x44cf8c,_0x2821c5){return db['sequelize'][_0xd54a('0x36')](function(_0x518867){return db[_0xd54a('0x37')]['create'](_0x2ebed5[_0xd54a('0x18')],{'raw':_0x2ebed5[_0xd54a('0x7')]?_0x2ebed5['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x518867})[_0xd54a('0x14')](function(){logger['info'](_0xd54a('0x38'),JSON[_0xd54a('0x10')](_0x2ebed5['options']['where']),_0x2ebed5[_0xd54a('0x7')][_0xd54a('0x9')]['active']);return db[_0xd54a('0x5')]['destroy']({'where':_0x2ebed5['options']?_0x2ebed5['options']['where']||null:null,'transaction':_0x518867});});})[_0xd54a('0x14')](function(_0x79fa7c){logger[_0xd54a('0xe')]('MoveContactManagedDialer',_0x2ebed5);logger[_0xd54a('0xf')](_0xd54a('0x35'),_0x2ebed5,JSON['stringify'](_0x79fa7c));_0x44cf8c(_0x79fa7c);})[_0xd54a('0x19')](function(_0x1589ab){logger[_0xd54a('0x11')](_0xd54a('0x35'),_0x1589ab[_0xd54a('0x12')],_0x2ebed5);_0x2821c5(_0x316fdf['error'](0x1f4,_0x1589ab[_0xd54a('0x12')]));});});};exports[_0xd54a('0x39')]=function(_0x42135c){var _0x537b7b=this;return new Promise(function(_0x37c6cb,_0x1fe18a){return db['CmHopper'][_0xd54a('0x6')]({'raw':_0x42135c['options']?_0x42135c[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x42135c[_0xd54a('0x7')]?_0x42135c[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':[[db[_0xd54a('0x24')]['fn'](_0xd54a('0x3a'),db['sequelize']['fn']('IF',db[_0xd54a('0x24')]['literal'](_0xd54a('0x3b')+util[_0xd54a('0x3c')](_0xd54a('0x3d'),moment()[_0xd54a('0x3c')](_0xd54a('0x3e')))+_0xd54a('0x3f')))),'contactsRescheduled']]})[_0xd54a('0x14')](function(_0x4d4c52){logger[_0xd54a('0xe')](_0xd54a('0x39'),_0x42135c);logger[_0xd54a('0xf')](_0xd54a('0x39'),_0x42135c,JSON['stringify'](_0x4d4c52));_0x37c6cb(_0x4d4c52);})['catch'](function(_0x3a3605){logger[_0xd54a('0x11')](_0xd54a('0x39'),_0x3a3605[_0xd54a('0x12')],_0x42135c);_0x1fe18a(_0x537b7b[_0xd54a('0x11')](0x1f4,_0x3a3605[_0xd54a('0x12')]));});});};exports[_0xd54a('0x40')]=function(_0x21c806){var _0x57d92b=this;return new Promise(function(_0x5cd662,_0x11dfe0){return db['CmContact'][_0xd54a('0x23')]()[_0xd54a('0x14')](function(){return db[_0xd54a('0x24')]['transaction'](function(_0x123c7d){return db[_0xd54a('0x5')][_0xd54a('0x6')]({'where':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0xb')]||null:null,'limit':0x1,'order':_0x21c806[_0xd54a('0x7')]?_0x21c806[_0xd54a('0x7')][_0xd54a('0x25')]||null:null,'group':db['CmHopper'][_0xd54a('0x2e')],'transaction':_0x123c7d,'lock':_0x123c7d[_0xd54a('0x26')][_0xd54a('0x27')],'include':_0x21c806['options']?_0x21c806[_0xd54a('0x7')][_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x21c806[_0xd54a('0x7')]['include'],function(_0x5f336b){return{'model':db[_0x5f336b[_0xd54a('0xa')]],'as':_0x5f336b['as'],'attributes':_0x5f336b[_0xd54a('0xb')],'include':_0x5f336b['include']?_[_0xd54a('0xd')](_0x5f336b[_0xd54a('0xc')],function(_0x35a0fa){return{'model':db[_0x35a0fa[_0xd54a('0xa')]],'as':_0x35a0fa['as'],'attributes':_0x35a0fa[_0xd54a('0xb')],'include':_0x35a0fa[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x35a0fa['include'],function(_0x1dba23){return{'model':db[_0x1dba23['model']],'as':_0x1dba23['as'],'attributes':_0x1dba23[_0xd54a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0x547abd){var _0x40155d=[];for(var _0x1fb03d=0x0;_0x1fb03d<_0x547abd['length'];_0x1fb03d+=0x1){_0x40155d[_0xd54a('0x2f')](_0x547abd[_0x1fb03d]['update'](_0x21c806[_0xd54a('0x18')],{'transaction':_0x123c7d}));}return BPromise[_0xd54a('0x31')](_0x40155d);});})['then'](function(_0x3c53f9){logger[_0xd54a('0xe')]('GetContactRecallMe',_0x21c806);logger[_0xd54a('0xf')](_0xd54a('0x40'),_0x21c806,JSON['stringify'](_0x3c53f9));_0x5cd662(_0x3c53f9);})['catch'](function(_0x1e4de9){logger[_0xd54a('0x11')](_0xd54a('0x40'),_0x1e4de9[_0xd54a('0x12')],_0x21c806);_0x11dfe0(_0x57d92b[_0xd54a('0x11')](0x1f4,_0x1e4de9[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x41')]=function(_0x916e7b){var _0xa3b250=this;return new Promise(function(_0x28bb75,_0x494040){db[_0xd54a('0x22')][_0xd54a('0x23')]()[_0xd54a('0x14')](function(_0x2038a3){return db[_0xd54a('0x5')]['findAll']({'raw':_0x916e7b[_0xd54a('0x7')]?_0x916e7b[_0xd54a('0x7')][_0xd54a('0x8')]===undefined?!![]:![]:!![],'where':_0x916e7b['options']?_0x916e7b[_0xd54a('0x7')][_0xd54a('0x9')]||null:null,'attributes':_0x916e7b['options']?_0x916e7b['options']['attributes']||null:null,'limit':_0x916e7b['options']?_0x916e7b['options'][_0xd54a('0x1c')]||null:null,'include':_0x916e7b[_0xd54a('0x7')]?_0x916e7b[_0xd54a('0x7')][_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x916e7b[_0xd54a('0x7')][_0xd54a('0xc')],function(_0x5f5c89){return{'model':db[_0x5f5c89['model']],'as':_0x5f5c89['as'],'attributes':_0x5f5c89['as']==='Contact'?_[_0xd54a('0x29')](_0x2038a3):_0x5f5c89[_0xd54a('0xb')],'include':_0x5f5c89[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x5f5c89[_0xd54a('0xc')],function(_0x4ac7c6){return{'model':db[_0x4ac7c6[_0xd54a('0xa')]],'as':_0x4ac7c6['as'],'attributes':_0x4ac7c6[_0xd54a('0xb')],'include':_0x4ac7c6[_0xd54a('0xc')]?_[_0xd54a('0xd')](_0x4ac7c6['include'],function(_0x1a8cec){return{'model':db[_0x1a8cec['model']],'as':_0x1a8cec['as'],'attributes':_0x1a8cec[_0xd54a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd54a('0x14')](function(_0xeb2a3e){logger['info'](_0xd54a('0x4'),_0x916e7b);logger['debug'](_0xd54a('0x4'),_0x916e7b,JSON[_0xd54a('0x10')](_0xeb2a3e));_0x28bb75(_0xeb2a3e);})[_0xd54a('0x19')](function(_0x3b927c){logger[_0xd54a('0x11')]('GetCmHopper',_0x3b927c[_0xd54a('0x12')],_0x916e7b);_0x494040(_0xa3b250['error'](0x1f4,_0x3b927c['message']));});});});};exports[_0xd54a('0x42')]=function(_0x2fab85){var _0x2ca386=this;return new Promise(function(_0x84fe62,_0x4798fa){return db[_0xd54a('0x22')][_0xd54a('0x43')]({'raw':!![],'where':{'phone':_0x2fab85['options'][_0xd54a('0x9')][_0xd54a('0x44')]},'attributes':['id',_0xd54a('0x45')],'order':[['id',_0xd54a('0x46')]]})[_0xd54a('0x14')](function(_0x384fd5){logger[_0xd54a('0xe')](_0xd54a('0x47'),_0x2fab85);logger[_0xd54a('0xf')](_0xd54a('0x47'),_0x2fab85,JSON['stringify'](_0x384fd5));_0x84fe62(_0x384fd5);})['catch'](function(_0x5b4ed4){logger[_0xd54a('0x11')](_0xd54a('0x47'),_0x5b4ed4[_0xd54a('0x12')],_0x2fab85);_0x4798fa(_0x2ca386['error'](0x1f4,_0x5b4ed4[_0xd54a('0x12')]));});});};exports['ResetActiveCalls']=function(_0x1c89d1){var _0x479a56=this;return new Promise(function(_0x158c97,_0x4ef5e8){return db[_0xd54a('0x24')][_0xd54a('0x36')](function(_0x1a15cc){var _0x438b82=_0x1c89d1[_0xd54a('0x7')]&&_0x1c89d1[_0xd54a('0x7')][_0xd54a('0x9')]?_0x1c89d1[_0xd54a('0x7')][_0xd54a('0x9')]:{};return db['CmHopper'][_0xd54a('0x1b')](_0x1c89d1[_0xd54a('0x18')],{'where':_0x438b82,'transaction':_0x1a15cc})[_0xd54a('0x14')](function(_0x599d08){logger[_0xd54a('0xe')](_0xd54a('0x48'),_0x1c89d1);logger['debug']('ResetActiveCalls',_0x1c89d1,JSON[_0xd54a('0x10')](_0x599d08));_0x158c97(_0x599d08);})[_0xd54a('0x19')](function(_0x505686){logger[_0xd54a('0x11')](_0xd54a('0x48'),_0x505686[_0xd54a('0x12')],_0x1c89d1);_0x4ef5e8(_0x479a56[_0xd54a('0x11')](0x1f4,_0x505686[_0xd54a('0x12')]));});});});};exports[_0xd54a('0x49')]=function(_0x573ed9){var _0x423aa7=this;var _0x443930=_0x573ed9[_0xd54a('0x18')][_0xd54a('0x9')]['voiceQueueIds'];var _0x3b7228=_0x573ed9[_0xd54a('0x18')][_0xd54a('0x9')][_0xd54a('0x4a')];var _0x386a49=_0x573ed9['body'][_0xd54a('0x9')][_0xd54a('0x4b')];return new Promise(function(_0x42292a,_0x14a468){return db[_0xd54a('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x443930},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd54a('0x24')][_0xd54a('0x4c')](_0xd54a('0x4d')+_0x3b7228+_0xd54a('0x4e')),'$gt':db[_0xd54a('0x24')][_0xd54a('0x4c')]('NOW()')}},'UserId':{'$in':_0x386a49}},'include':[{'model':db['CmContact'],'as':_0xd54a('0x28')},{'model':db[_0xd54a('0x2a')],'as':_0xd54a('0x2b'),'attributes':['id',_0xd54a('0x2c'),'voicePause']},{'model':db[_0xd54a('0x4f')],'as':_0xd54a('0x50')}]})[_0xd54a('0x14')](function(_0x124047){if(_0x124047[_0xd54a('0x32')]>0x0){return db[_0xd54a('0x24')][_0xd54a('0x36')](function(_0x4a0001){return db[_0xd54a('0x5')][_0xd54a('0x1b')]({'recallmeNotifiedDate':db[_0xd54a('0x24')]['literal'](_0xd54a('0x51'))},{'where':{'id':{'$in':_[_0xd54a('0xd')](_0x124047,'id')}},'transaction':_0x4a0001})['then'](function(){_0x42292a(_0x124047);})[_0xd54a('0x19')](function(_0x3e48cb){logger[_0xd54a('0x11')](_0xd54a('0x49'),_0x3e48cb['message'],_0x573ed9);_0x14a468(_0x423aa7[_0xd54a('0x11')](0x1f4,_0x3e48cb[_0xd54a('0x12')]));});})[_0xd54a('0x19')](function(_0x120787){logger[_0xd54a('0x11')](_0xd54a('0x49'),_0x120787[_0xd54a('0x12')],_0x573ed9);_0x14a468(_0x423aa7[_0xd54a('0x11')](0x1f4,_0x120787[_0xd54a('0x12')]));});}else{_0x42292a(_0x124047);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index aa35c0a..83aea14 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 _0x0b1f=['index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','destroy','exports','express','../../components/auth/service','./cmHopper.controller','get','isAuthenticated'];(function(_0x58ac9b,_0x35dc04){var _0x12a47d=function(_0x2af5ce){while(--_0x2af5ce){_0x58ac9b['push'](_0x58ac9b['shift']());}};_0x12a47d(++_0x35dc04);}(_0x0b1f,0x13d));var _0xf0b1=function(_0x3f09ec,_0x26ff94){_0x3f09ec=_0x3f09ec-0x0;var _0x5057e0=_0x0b1f[_0x3f09ec];return _0x5057e0;};'use strict';var express=require(_0xf0b1('0x0'));var router=express['Router']();var auth=require(_0xf0b1('0x1'));var controller=require(_0xf0b1('0x2'));router[_0xf0b1('0x3')]('/',auth[_0xf0b1('0x4')](),controller[_0xf0b1('0x5')]);router['get'](_0xf0b1('0x6'),auth[_0xf0b1('0x4')](),controller[_0xf0b1('0x7')]);router[_0xf0b1('0x3')](_0xf0b1('0x8'),auth[_0xf0b1('0x4')](),controller[_0xf0b1('0x9')]);router[_0xf0b1('0x3')]('/timezones',auth[_0xf0b1('0x4')](),controller['getTimezones']);router['get'](_0xf0b1('0xa'),auth[_0xf0b1('0x4')](),controller[_0xf0b1('0xb')]);router[_0xf0b1('0x3')](_0xf0b1('0xc'),auth[_0xf0b1('0x4')](),controller['getPreviewRecall']);router[_0xf0b1('0xd')]('/',auth[_0xf0b1('0x4')](),controller[_0xf0b1('0xe')]);router[_0xf0b1('0xd')](_0xf0b1('0xf'),auth['isAuthenticated'](),controller[_0xf0b1('0x10')]);router[_0xf0b1('0xd')](_0xf0b1('0x11'),auth[_0xf0b1('0x4')](),controller[_0xf0b1('0x12')]);router[_0xf0b1('0x13')](_0xf0b1('0xa'),auth[_0xf0b1('0x4')](),controller[_0xf0b1('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf0b1('0x15')]);module[_0xf0b1('0x16')]=router; \ No newline at end of file +var _0x0c12=['exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','destroy'];(function(_0x2f0ee3,_0x177e5f){var _0x4cf23a=function(_0x139006){while(--_0x139006){_0x2f0ee3['push'](_0x2f0ee3['shift']());}};_0x4cf23a(++_0x177e5f);}(_0x0c12,0xd3));var _0x20c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0c12[_0x40a045];return _0x1a687c;};'use strict';var express=require('express');var router=express[_0x20c1('0x0')]();var auth=require(_0x20c1('0x1'));var controller=require(_0x20c1('0x2'));router[_0x20c1('0x3')]('/',auth[_0x20c1('0x4')](),controller['index']);router[_0x20c1('0x3')](_0x20c1('0x5'),auth[_0x20c1('0x4')](),controller['describe']);router['get'](_0x20c1('0x6'),auth['isAuthenticated'](),controller[_0x20c1('0x7')]);router[_0x20c1('0x3')]('/timezones',auth['isAuthenticated'](),controller[_0x20c1('0x8')]);router['get'](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0xa')]);router[_0x20c1('0x3')]('/:id/previewrecall',auth[_0x20c1('0x4')](),controller[_0x20c1('0xb')]);router['post']('/',auth[_0x20c1('0x4')](),controller['create']);router[_0x20c1('0xc')](_0x20c1('0xd'),auth[_0x20c1('0x4')](),controller[_0x20c1('0xe')]);router[_0x20c1('0xc')](_0x20c1('0xf'),auth['isAuthenticated'](),controller[_0x20c1('0x10')]);router[_0x20c1('0x11')](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0x12')]);router['delete'](_0x20c1('0x9'),auth[_0x20c1('0x4')](),controller[_0x20c1('0x13')]);module[_0x20c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 95b0baa..01bc53e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cd2=['INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x1b1997,_0x3f15de){var _0x456aa0=function(_0x245031){while(--_0x245031){_0x1b1997['push'](_0x1b1997['shift']());}};_0x456aa0(++_0x3f15de);}(_0x3cd2,0xdf));var _0x23cd=function(_0x422c05,_0x5bc244){_0x422c05=_0x422c05-0x0;var _0xfeaf75=_0x3cd2[_0x422c05];return _0xfeaf75;};'use strict';var moment=require('moment');var Sequelize=require(_0x23cd('0x0'));module[_0x23cd('0x1')]={'CmHopperId':{'type':Sequelize[_0x23cd('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x23cd('0x3')](_0x23cd('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x23cd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b20=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE','format'];(function(_0x102155,_0x5f4c9f){var _0x2c6bd2=function(_0x566cd1){while(--_0x566cd1){_0x102155['push'](_0x102155['shift']());}};_0x2c6bd2(++_0x5f4c9f);}(_0x9b20,0x112));var _0x09b2=function(_0x27a4e0,_0x4816f5){_0x27a4e0=_0x27a4e0-0x0;var _0x2b57c7=_0x9b20[_0x27a4e0];return _0x2b57c7;};'use strict';var moment=require(_0x09b2('0x0'));var Sequelize=require(_0x09b2('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x09b2('0x2')]},'phone':{'type':Sequelize[_0x09b2('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x09b2('0x4')],'defaultValue':moment()[_0x09b2('0x5')](_0x09b2('0x6'))},'countbusyretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x09b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index cd93447..cd18dd0 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaafd=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','CmHopperAdditionalPhone','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','end','sendStatus','error','name','send','index','map','rawAttributes'];(function(_0x44aeff,_0x3e7283){var _0x4e76c7=function(_0x3262d0){while(--_0x3262d0){_0x44aeff['push'](_0x44aeff['shift']());}};_0x4e76c7(++_0x3e7283);}(_0xaafd,0x119));var _0xdaaf=function(_0x1d4663,_0x17cb51){_0x1d4663=_0x1d4663-0x0;var _0x581eb5=_0xaafd[_0x1d4663];return _0x581eb5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdaaf('0x0'));var rp=require(_0xdaaf('0x1'));var moment=require(_0xdaaf('0x2'));var BPromise=require(_0xdaaf('0x3'));var Mustache=require(_0xdaaf('0x4'));var util=require(_0xdaaf('0x5'));var path=require('path');var sox=require(_0xdaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xdaaf('0x7'));var fs=require('fs');var fs_extra=require(_0xdaaf('0x8'));var _=require(_0xdaaf('0x9'));var squel=require(_0xdaaf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaaf('0xb'));var toCsv=require(_0xdaaf('0xc'));var querystring=require(_0xdaaf('0xd'));var Papa=require(_0xdaaf('0xe'));var Redis=require(_0xdaaf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaaf('0x10'));var as=require(_0xdaaf('0x11'));var hardwareService=require(_0xdaaf('0x12'));var logger=require(_0xdaaf('0x13'))(_0xdaaf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdaaf('0x15'));var db=require(_0xdaaf('0x16'))['db'];function respondWithStatusCode(_0x1cc42b,_0x2324ca){_0x2324ca=_0x2324ca||0xcc;return function(_0x4b8f4d){if(_0x4b8f4d){return _0x1cc42b['sendStatus'](_0x2324ca);}return _0x1cc42b['status'](_0x2324ca)['end']();};}function respondWithResult(_0x1d613b,_0xe4ee1b){_0xe4ee1b=_0xe4ee1b||0xc8;return function(_0x2b292a){if(_0x2b292a){return _0x1d613b[_0xdaaf('0x17')](_0xe4ee1b)['json'](_0x2b292a);}};}function respondWithFilteredResult(_0x53b62e,_0x108a62){return function(_0x3128a4){if(_0x3128a4){var _0x11f5d9=typeof _0x108a62[_0xdaaf('0x18')]===_0xdaaf('0x19')&&typeof _0x108a62[_0xdaaf('0x1a')]===_0xdaaf('0x19');var _0x512b42=_0x3128a4[_0xdaaf('0x1b')];var _0x3c3c63=_0x11f5d9?0x0:_0x108a62[_0xdaaf('0x18')];var _0x1a456b=_0x11f5d9?_0x3128a4[_0xdaaf('0x1b')]:_0x108a62[_0xdaaf('0x18')]+_0x108a62[_0xdaaf('0x1a')];var _0x22ed03;if(_0x1a456b>=_0x512b42){_0x1a456b=_0x512b42;_0x22ed03=0xc8;}else{_0x22ed03=0xce;}_0x53b62e[_0xdaaf('0x17')](_0x22ed03);return _0x53b62e[_0xdaaf('0x1c')](_0xdaaf('0x1d'),_0x3c3c63+'-'+_0x1a456b+'/'+_0x512b42)[_0xdaaf('0x1e')](_0x3128a4);}return null;};}function patchUpdates(_0x5d7f60){return function(_0x187164){try{jsonpatch[_0xdaaf('0x1f')](_0x187164,_0x5d7f60,!![]);}catch(_0x26b55c){return BPromise[_0xdaaf('0x20')](_0x26b55c);}return _0x187164[_0xdaaf('0x21')]();};}function saveUpdates(_0x354884,_0x8c1a67){return function(_0x1156b7){if(_0x1156b7){return _0x1156b7[_0xdaaf('0x22')](_0x354884)['then'](function(_0x1ed6ae){return _0x1ed6ae;});}return null;};}function removeEntity(_0x4d2ce7,_0xbde3a2){return function(_0x34a25c){if(_0x34a25c){return _0x34a25c[_0xdaaf('0x23')]()[_0xdaaf('0x24')](function(){var _0x2e405f=_0x34a25c[_0xdaaf('0x25')]({'plain':!![]});var _0x277429='CmHopperAdditionalPhones';return db[_0xdaaf('0x26')][_0xdaaf('0x23')]({'where':{'type':_0x277429,'resourceId':_0x2e405f['id']}})[_0xdaaf('0x24')](function(){return _0x34a25c;});})['then'](function(){_0x4d2ce7[_0xdaaf('0x17')](0xcc)[_0xdaaf('0x27')]();});}};}function handleEntityNotFound(_0x5b7fc5,_0x5ce3ee){return function(_0x28a0ac){if(!_0x28a0ac){_0x5b7fc5[_0xdaaf('0x28')](0x194);}return _0x28a0ac;};}function handleError(_0x4ccfcf,_0x47adf0){_0x47adf0=_0x47adf0||0x1f4;return function(_0x2e2e1b){logger[_0xdaaf('0x29')](_0x2e2e1b['stack']);if(_0x2e2e1b['name']){delete _0x2e2e1b[_0xdaaf('0x2a')];}_0x4ccfcf[_0xdaaf('0x17')](_0x47adf0)[_0xdaaf('0x2b')](_0x2e2e1b);};}exports[_0xdaaf('0x2c')]=function(_0x41b5d1,_0x254324){var _0x99a634={},_0x140ce1={},_0x39ff64={'count':0x0,'rows':[]};var _0x180e7f=_[_0xdaaf('0x2d')](db['CmHopperAdditionalPhone'][_0xdaaf('0x2e')],function(_0x200133){return{'name':_0x200133[_0xdaaf('0x2f')],'type':_0x200133['type'][_0xdaaf('0x30')]};});_0x140ce1['model']=_[_0xdaaf('0x2d')](_0x180e7f,_0xdaaf('0x2a'));_0x140ce1[_0xdaaf('0x31')]=_[_0xdaaf('0x32')](_0x41b5d1[_0xdaaf('0x31')]);_0x140ce1[_0xdaaf('0x33')]=_[_0xdaaf('0x34')](_0x140ce1[_0xdaaf('0x35')],_0x140ce1[_0xdaaf('0x31')]);_0x99a634[_0xdaaf('0x36')]=_[_0xdaaf('0x34')](_0x140ce1[_0xdaaf('0x35')],qs[_0xdaaf('0x37')](_0x41b5d1[_0xdaaf('0x31')]['fields']));_0x99a634['attributes']=_0x99a634[_0xdaaf('0x36')][_0xdaaf('0x38')]?_0x99a634[_0xdaaf('0x36')]:_0x140ce1[_0xdaaf('0x35')];if(!_0x41b5d1['query'][_0xdaaf('0x39')]('nolimit')){_0x99a634[_0xdaaf('0x1a')]=qs['limit'](_0x41b5d1[_0xdaaf('0x31')][_0xdaaf('0x1a')]);_0x99a634[_0xdaaf('0x18')]=qs[_0xdaaf('0x18')](_0x41b5d1['query'][_0xdaaf('0x18')]);}_0x99a634[_0xdaaf('0x3a')]=qs[_0xdaaf('0x3b')](_0x41b5d1[_0xdaaf('0x31')]['sort']);_0x99a634[_0xdaaf('0x3c')]=qs[_0xdaaf('0x33')](_[_0xdaaf('0x3d')](_0x41b5d1['query'],_0x140ce1[_0xdaaf('0x33')]),_0x180e7f);if(_0x41b5d1[_0xdaaf('0x31')][_0xdaaf('0x3e')]){_0x99a634['where']=_[_0xdaaf('0x3f')](_0x99a634[_0xdaaf('0x3c')],{'$or':_['map'](_0x180e7f,function(_0x417cd2){if(_0x417cd2['type']!=='VIRTUAL'){var _0x33255b={};_0x33255b[_0x417cd2[_0xdaaf('0x2a')]]={'$like':'%'+_0x41b5d1[_0xdaaf('0x31')][_0xdaaf('0x3e')]+'%'};return _0x33255b;}})});}_0x99a634=_[_0xdaaf('0x3f')]({},_0x99a634,_0x41b5d1[_0xdaaf('0x40')]);var _0x32ad8b={'where':_0x99a634['where']};return db['CmHopperAdditionalPhone'][_0xdaaf('0x1b')](_0x32ad8b)['then'](function(_0x35fa54){_0x39ff64[_0xdaaf('0x1b')]=_0x35fa54;if(_0x41b5d1['query'][_0xdaaf('0x41')]){_0x99a634[_0xdaaf('0x42')]=[{'all':!![]}];}return db[_0xdaaf('0x43')][_0xdaaf('0x44')](_0x99a634);})[_0xdaaf('0x24')](function(_0x4d8f09){_0x39ff64[_0xdaaf('0x45')]=_0x4d8f09;return _0x39ff64;})['then'](respondWithFilteredResult(_0x254324,_0x99a634))[_0xdaaf('0x46')](handleError(_0x254324,null));};exports[_0xdaaf('0x47')]=function(_0x2a186f,_0x3a33d6){var _0x3794e4={'raw':!![],'where':{'id':_0x2a186f[_0xdaaf('0x48')]['id']}},_0x237622={};_0x237622[_0xdaaf('0x35')]=_[_0xdaaf('0x32')](db[_0xdaaf('0x43')]['rawAttributes']);_0x237622[_0xdaaf('0x31')]=_[_0xdaaf('0x32')](_0x2a186f[_0xdaaf('0x31')]);_0x237622['filters']=_[_0xdaaf('0x34')](_0x237622[_0xdaaf('0x35')],_0x237622[_0xdaaf('0x31')]);_0x3794e4[_0xdaaf('0x36')]=_[_0xdaaf('0x34')](_0x237622[_0xdaaf('0x35')],qs['fields'](_0x2a186f[_0xdaaf('0x31')][_0xdaaf('0x37')]));_0x3794e4[_0xdaaf('0x36')]=_0x3794e4['attributes']['length']?_0x3794e4[_0xdaaf('0x36')]:_0x237622['model'];if(_0x2a186f[_0xdaaf('0x31')][_0xdaaf('0x41')]){_0x3794e4[_0xdaaf('0x42')]=[{'all':!![]}];}_0x3794e4=_[_0xdaaf('0x3f')]({},_0x3794e4,_0x2a186f[_0xdaaf('0x40')]);return db[_0xdaaf('0x43')][_0xdaaf('0x49')](_0x3794e4)['then'](handleEntityNotFound(_0x3a33d6,null))[_0xdaaf('0x24')](respondWithResult(_0x3a33d6,null))['catch'](handleError(_0x3a33d6,null));};exports['create']=function(_0x2f54,_0x9b0182){return db[_0xdaaf('0x43')]['create'](_0x2f54[_0xdaaf('0x4a')],{})[_0xdaaf('0x24')](function(_0x31028f){var _0x47d7c5=_0x2f54[_0xdaaf('0x4b')]['get']({'plain':!![]});if(!_0x47d7c5)throw new Error(_0xdaaf('0x4c'));if(_0x47d7c5[_0xdaaf('0x4d')]===_0xdaaf('0x4b')){var _0xb685b5=_0x31028f[_0xdaaf('0x25')]({'plain':!![]});var _0x1061a2=_0xdaaf('0x4e');return db['UserProfileSection'][_0xdaaf('0x49')]({'where':{'name':_0x1061a2,'userProfileId':_0x47d7c5['userProfileId']},'raw':!![]})[_0xdaaf('0x24')](function(_0x435a5c){if(_0x435a5c&&_0x435a5c[_0xdaaf('0x4f')]===0x0){return db['UserProfileResource'][_0xdaaf('0x50')]({'name':_0xb685b5[_0xdaaf('0x2a')],'resourceId':_0xb685b5['id'],'type':_0x435a5c['name'],'sectionId':_0x435a5c['id']},{})[_0xdaaf('0x24')](function(){return _0x31028f;});}else{return _0x31028f;}})[_0xdaaf('0x46')](function(_0x233462){logger[_0xdaaf('0x29')](_0xdaaf('0x51'),_0x233462);throw _0x233462;});}return _0x31028f;})[_0xdaaf('0x24')](respondWithResult(_0x9b0182,0xc9))['catch'](handleError(_0x9b0182,null));};exports[_0xdaaf('0x22')]=function(_0x4b91eb,_0x2bcc21){if(_0x4b91eb[_0xdaaf('0x4a')]['id']){delete _0x4b91eb[_0xdaaf('0x4a')]['id'];}return db[_0xdaaf('0x43')][_0xdaaf('0x49')]({'where':{'id':_0x4b91eb[_0xdaaf('0x48')]['id']}})[_0xdaaf('0x24')](handleEntityNotFound(_0x2bcc21,null))[_0xdaaf('0x24')](saveUpdates(_0x4b91eb['body'],null))[_0xdaaf('0x24')](respondWithResult(_0x2bcc21,null))[_0xdaaf('0x46')](handleError(_0x2bcc21,null));};exports[_0xdaaf('0x23')]=function(_0x2ca9a5,_0x4385bd){return db[_0xdaaf('0x43')][_0xdaaf('0x49')]({'where':{'id':_0x2ca9a5[_0xdaaf('0x48')]['id']}})['then'](handleEntityNotFound(_0x4385bd,null))['then'](removeEntity(_0x4385bd,null))['catch'](handleError(_0x4385bd,null));}; \ No newline at end of file +var _0x9727=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','CmHopperAdditionalPhone','includeAll','rows','catch','show','params','keys','include','find','create','body','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','end','sendStatus','error','stack','name','send','index','fieldName','key','model','map','query'];(function(_0x632b76,_0x245607){var _0x13b7e9=function(_0x178fec){while(--_0x178fec){_0x632b76['push'](_0x632b76['shift']());}};_0x13b7e9(++_0x245607);}(_0x9727,0x105));var _0x7972=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x9727[_0x291aaf];return _0x5571e6;};'use strict';var emlformat=require(_0x7972('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7972('0x1'));var BPromise=require(_0x7972('0x2'));var Mustache=require(_0x7972('0x3'));var util=require(_0x7972('0x4'));var path=require(_0x7972('0x5'));var sox=require(_0x7972('0x6'));var csv=require(_0x7972('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7972('0x8'));var jsforce=require(_0x7972('0x9'));var deskjs=require(_0x7972('0xa'));var toCsv=require(_0x7972('0x7'));var querystring=require(_0x7972('0xb'));var Papa=require(_0x7972('0xc'));var Redis=require('ioredis');var authService=require(_0x7972('0xd'));var qs=require(_0x7972('0xe'));var as=require(_0x7972('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7972('0x10'))(_0x7972('0x11'));var utils=require(_0x7972('0x12'));var config=require(_0x7972('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377c09,_0x5ae95f){_0x5ae95f=_0x5ae95f||0xcc;return function(_0x4ac45e){if(_0x4ac45e){return _0x377c09['sendStatus'](_0x5ae95f);}return _0x377c09['status'](_0x5ae95f)['end']();};}function respondWithResult(_0x4f1118,_0x513a54){_0x513a54=_0x513a54||0xc8;return function(_0x420c2d){if(_0x420c2d){return _0x4f1118['status'](_0x513a54)[_0x7972('0x14')](_0x420c2d);}};}function respondWithFilteredResult(_0x46abb2,_0x56653c){return function(_0x57bdae){if(_0x57bdae){var _0x1bbcae=typeof _0x56653c[_0x7972('0x15')]===_0x7972('0x16')&&typeof _0x56653c[_0x7972('0x17')]===_0x7972('0x16');var _0xa43d4f=_0x57bdae[_0x7972('0x18')];var _0x4d9aad=_0x1bbcae?0x0:_0x56653c[_0x7972('0x15')];var _0xb7a3a1=_0x1bbcae?_0x57bdae[_0x7972('0x18')]:_0x56653c['offset']+_0x56653c[_0x7972('0x17')];var _0x2f194c;if(_0xb7a3a1>=_0xa43d4f){_0xb7a3a1=_0xa43d4f;_0x2f194c=0xc8;}else{_0x2f194c=0xce;}_0x46abb2[_0x7972('0x19')](_0x2f194c);return _0x46abb2[_0x7972('0x1a')](_0x7972('0x1b'),_0x4d9aad+'-'+_0xb7a3a1+'/'+_0xa43d4f)[_0x7972('0x14')](_0x57bdae);}return null;};}function patchUpdates(_0x19bae2){return function(_0x597322){try{jsonpatch[_0x7972('0x1c')](_0x597322,_0x19bae2,!![]);}catch(_0x111e2d){return BPromise[_0x7972('0x1d')](_0x111e2d);}return _0x597322['save']();};}function saveUpdates(_0x4501f2,_0x16194a){return function(_0x59c03c){if(_0x59c03c){return _0x59c03c[_0x7972('0x1e')](_0x4501f2)[_0x7972('0x1f')](function(_0x3bf598){return _0x3bf598;});}return null;};}function removeEntity(_0x51df08,_0x40033d){return function(_0x378dc0){if(_0x378dc0){return _0x378dc0[_0x7972('0x20')]()[_0x7972('0x1f')](function(){var _0x50617a=_0x378dc0[_0x7972('0x21')]({'plain':!![]});var _0x357ef1=_0x7972('0x22');return db['UserProfileResource'][_0x7972('0x20')]({'where':{'type':_0x357ef1,'resourceId':_0x50617a['id']}})['then'](function(){return _0x378dc0;});})[_0x7972('0x1f')](function(){_0x51df08[_0x7972('0x19')](0xcc)[_0x7972('0x23')]();});}};}function handleEntityNotFound(_0xa53006,_0x222da4){return function(_0x3dc436){if(!_0x3dc436){_0xa53006[_0x7972('0x24')](0x194);}return _0x3dc436;};}function handleError(_0x29013b,_0x5054b4){_0x5054b4=_0x5054b4||0x1f4;return function(_0x47bdbb){logger[_0x7972('0x25')](_0x47bdbb[_0x7972('0x26')]);if(_0x47bdbb[_0x7972('0x27')]){delete _0x47bdbb[_0x7972('0x27')];}_0x29013b[_0x7972('0x19')](_0x5054b4)[_0x7972('0x28')](_0x47bdbb);};}exports[_0x7972('0x29')]=function(_0x277765,_0x59d2e4){var _0xfda0ac={},_0xa4ac38={},_0x3b9ad6={'count':0x0,'rows':[]};var _0x24a965=_['map'](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x4c0de4){return{'name':_0x4c0de4[_0x7972('0x2a')],'type':_0x4c0de4['type'][_0x7972('0x2b')]};});_0xa4ac38[_0x7972('0x2c')]=_[_0x7972('0x2d')](_0x24a965,'name');_0xa4ac38[_0x7972('0x2e')]=_['keys'](_0x277765[_0x7972('0x2e')]);_0xa4ac38[_0x7972('0x2f')]=_[_0x7972('0x30')](_0xa4ac38[_0x7972('0x2c')],_0xa4ac38['query']);_0xfda0ac['attributes']=_[_0x7972('0x30')](_0xa4ac38[_0x7972('0x2c')],qs[_0x7972('0x31')](_0x277765[_0x7972('0x2e')]['fields']));_0xfda0ac[_0x7972('0x32')]=_0xfda0ac[_0x7972('0x32')][_0x7972('0x33')]?_0xfda0ac[_0x7972('0x32')]:_0xa4ac38[_0x7972('0x2c')];if(!_0x277765[_0x7972('0x2e')][_0x7972('0x34')](_0x7972('0x35'))){_0xfda0ac[_0x7972('0x17')]=qs[_0x7972('0x17')](_0x277765[_0x7972('0x2e')][_0x7972('0x17')]);_0xfda0ac[_0x7972('0x15')]=qs[_0x7972('0x15')](_0x277765[_0x7972('0x2e')]['offset']);}_0xfda0ac[_0x7972('0x36')]=qs[_0x7972('0x37')](_0x277765[_0x7972('0x2e')][_0x7972('0x37')]);_0xfda0ac[_0x7972('0x38')]=qs[_0x7972('0x2f')](_['pick'](_0x277765[_0x7972('0x2e')],_0xa4ac38['filters']),_0x24a965);if(_0x277765[_0x7972('0x2e')][_0x7972('0x39')]){_0xfda0ac['where']=_['merge'](_0xfda0ac[_0x7972('0x38')],{'$or':_[_0x7972('0x2d')](_0x24a965,function(_0x3f46fe){if(_0x3f46fe[_0x7972('0x3a')]!==_0x7972('0x3b')){var _0x5b4d8e={};_0x5b4d8e[_0x3f46fe[_0x7972('0x27')]]={'$like':'%'+_0x277765['query'][_0x7972('0x39')]+'%'};return _0x5b4d8e;}})});}_0xfda0ac=_[_0x7972('0x3c')]({},_0xfda0ac,_0x277765[_0x7972('0x3d')]);var _0x27a2a7={'where':_0xfda0ac[_0x7972('0x38')]};return db[_0x7972('0x3e')][_0x7972('0x18')](_0x27a2a7)[_0x7972('0x1f')](function(_0xef4440){_0x3b9ad6[_0x7972('0x18')]=_0xef4440;if(_0x277765['query'][_0x7972('0x3f')]){_0xfda0ac['include']=[{'all':!![]}];}return db[_0x7972('0x3e')]['findAll'](_0xfda0ac);})[_0x7972('0x1f')](function(_0x33bc37){_0x3b9ad6[_0x7972('0x40')]=_0x33bc37;return _0x3b9ad6;})[_0x7972('0x1f')](respondWithFilteredResult(_0x59d2e4,_0xfda0ac))[_0x7972('0x41')](handleError(_0x59d2e4,null));};exports[_0x7972('0x42')]=function(_0xdca41e,_0x1a0be9){var _0x402abf={'raw':!![],'where':{'id':_0xdca41e[_0x7972('0x43')]['id']}},_0x531983={};_0x531983['model']=_[_0x7972('0x44')](db[_0x7972('0x3e')]['rawAttributes']);_0x531983['query']=_[_0x7972('0x44')](_0xdca41e['query']);_0x531983[_0x7972('0x2f')]=_[_0x7972('0x30')](_0x531983[_0x7972('0x2c')],_0x531983[_0x7972('0x2e')]);_0x402abf[_0x7972('0x32')]=_[_0x7972('0x30')](_0x531983['model'],qs[_0x7972('0x31')](_0xdca41e[_0x7972('0x2e')][_0x7972('0x31')]));_0x402abf[_0x7972('0x32')]=_0x402abf[_0x7972('0x32')][_0x7972('0x33')]?_0x402abf[_0x7972('0x32')]:_0x531983[_0x7972('0x2c')];if(_0xdca41e[_0x7972('0x2e')][_0x7972('0x3f')]){_0x402abf[_0x7972('0x45')]=[{'all':!![]}];}_0x402abf=_[_0x7972('0x3c')]({},_0x402abf,_0xdca41e['options']);return db[_0x7972('0x3e')][_0x7972('0x46')](_0x402abf)[_0x7972('0x1f')](handleEntityNotFound(_0x1a0be9,null))['then'](respondWithResult(_0x1a0be9,null))[_0x7972('0x41')](handleError(_0x1a0be9,null));};exports[_0x7972('0x47')]=function(_0x1969b6,_0x378b87){return db[_0x7972('0x3e')]['create'](_0x1969b6[_0x7972('0x48')],{})['then'](function(_0x560372){var _0x11a400=_0x1969b6['user']['get']({'plain':!![]});if(!_0x11a400)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11a400['role']==='user'){var _0x31ed29=_0x560372[_0x7972('0x21')]({'plain':!![]});var _0xbd6b9='CmHopperAdditionalPhones';return db[_0x7972('0x49')][_0x7972('0x46')]({'where':{'name':_0xbd6b9,'userProfileId':_0x11a400[_0x7972('0x4a')]},'raw':!![]})[_0x7972('0x1f')](function(_0x3ece9f){if(_0x3ece9f&&_0x3ece9f[_0x7972('0x4b')]===0x0){return db['UserProfileResource'][_0x7972('0x47')]({'name':_0x31ed29['name'],'resourceId':_0x31ed29['id'],'type':_0x3ece9f[_0x7972('0x27')],'sectionId':_0x3ece9f['id']},{})[_0x7972('0x1f')](function(){return _0x560372;});}else{return _0x560372;}})['catch'](function(_0x4a9626){logger[_0x7972('0x25')](_0x7972('0x4c'),_0x4a9626);throw _0x4a9626;});}return _0x560372;})[_0x7972('0x1f')](respondWithResult(_0x378b87,0xc9))[_0x7972('0x41')](handleError(_0x378b87,null));};exports[_0x7972('0x1e')]=function(_0x358390,_0x15159e){if(_0x358390['body']['id']){delete _0x358390['body']['id'];}return db[_0x7972('0x3e')][_0x7972('0x46')]({'where':{'id':_0x358390['params']['id']}})[_0x7972('0x1f')](handleEntityNotFound(_0x15159e,null))[_0x7972('0x1f')](saveUpdates(_0x358390[_0x7972('0x48')],null))[_0x7972('0x1f')](respondWithResult(_0x15159e,null))[_0x7972('0x41')](handleError(_0x15159e,null));};exports[_0x7972('0x20')]=function(_0x44b08b,_0x2e54ea){return db[_0x7972('0x3e')][_0x7972('0x46')]({'where':{'id':_0x44b08b[_0x7972('0x43')]['id']}})[_0x7972('0x1f')](handleEntityNotFound(_0x2e54ea,null))[_0x7972('0x1f')](removeEntity(_0x2e54ea,null))[_0x7972('0x41')](handleError(_0x2e54ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index c302916..c188e4f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa09f=['bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','moment'];(function(_0x2ab298,_0x12d8f8){var _0x471127=function(_0x4b590c){while(--_0x4b590c){_0x2ab298['push'](_0x2ab298['shift']());}};_0x471127(++_0x12d8f8);}(_0xa09f,0xdf));var _0xfa09=function(_0x41ec96,_0x576e4f){_0x41ec96=_0x41ec96-0x0;var _0x5786fb=_0xa09f[_0x41ec96];return _0x5786fb;};'use strict';var _=require(_0xfa09('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfa09('0x1'));var BPromise=require(_0xfa09('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa09('0x3'));var rimraf=require(_0xfa09('0x4'));var config=require(_0xfa09('0x5'));var attributes=require(_0xfa09('0x6'));module[_0xfa09('0x7')]=function(_0x24f305,_0x44da4b){return _0x24f305['define'](_0xfa09('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e77=['request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment'];(function(_0x319af4,_0x19cce9){var _0x187817=function(_0x28a263){while(--_0x28a263){_0x319af4['push'](_0x319af4['shift']());}};_0x187817(++_0x19cce9);}(_0x2e77,0x19c));var _0x72e7=function(_0x11e8c3,_0x32976c){_0x11e8c3=_0x11e8c3-0x0;var _0x2e7d36=_0x2e77[_0x11e8c3];return _0x2e7d36;};'use strict';var _=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var logger=require('../../config/logger')(_0x72e7('0x2'));var moment=require(_0x72e7('0x3'));var BPromise=require('bluebird');var rp=require(_0x72e7('0x4'));var fs=require('fs');var path=require(_0x72e7('0x5'));var rimraf=require(_0x72e7('0x6'));var config=require(_0x72e7('0x7'));var attributes=require(_0x72e7('0x8'));module[_0x72e7('0x9')]=function(_0x1c09ca,_0x3e0f24){return _0x1c09ca[_0x72e7('0xa')](_0x72e7('0xb'),attributes,{'tableName':_0x72e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index f894b60..03bb2da 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16e8=['waitTime','isNil','scheduledat','add','minutes','phone','countabandonedretry','countmachineretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','countcongestionretry','countagentrejectretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','duration'];(function(_0x1da08e,_0x22fbf6){var _0x1958f6=function(_0x34fb94){while(--_0x34fb94){_0x1da08e['push'](_0x1da08e['shift']());}};_0x1958f6(++_0x22fbf6);}(_0x16e8,0x12c));var _0x816e=function(_0x4457a3,_0x5622ca){_0x4457a3=_0x4457a3-0x0;var _0xd6b909=_0x16e8[_0x4457a3];return _0xd6b909;};'use strict';var _=require('lodash');var util=require(_0x816e('0x0'));var moment=require('moment');var BPromise=require(_0x816e('0x1'));var rs=require(_0x816e('0x2'));var fs=require('fs');var Redis=require(_0x816e('0x3'));var db=require(_0x816e('0x4'))['db'];var utils=require(_0x816e('0x5'));var logger=require(_0x816e('0x6'))('rpc');var config=require(_0x816e('0x7'));var jayson=require(_0x816e('0x8'));var client=jayson[_0x816e('0x9')][_0x816e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eff15,_0x37628b,_0x2db390){return new BPromise(function(_0x323783,_0x3891ae){return client['request'](_0x5eff15,_0x2db390)['then'](function(_0x7f8a9e){logger[_0x816e('0xb')](_0x816e('0xc'),_0x37628b,_0x816e('0xd'));logger[_0x816e('0xe')](_0x816e('0xf'),_0x37628b,_0x816e('0xd'),JSON['stringify'](_0x7f8a9e));if(_0x7f8a9e[_0x816e('0x10')]){if(_0x7f8a9e[_0x816e('0x10')][_0x816e('0x11')]===0x1f4){logger[_0x816e('0x10')](_0x816e('0xc'),_0x37628b,_0x7f8a9e[_0x816e('0x10')]['message']);return _0x3891ae(_0x7f8a9e[_0x816e('0x10')][_0x816e('0x12')]);}logger['error'](_0x816e('0xc'),_0x37628b,_0x7f8a9e['error'][_0x816e('0x12')]);return _0x323783(_0x7f8a9e['error']['message']);}else{logger[_0x816e('0xb')](_0x816e('0xc'),_0x37628b,_0x816e('0xd'));_0x323783(_0x7f8a9e[_0x816e('0x13')][_0x816e('0x12')]);}})['catch'](function(_0x964333){logger[_0x816e('0x10')](_0x816e('0xc'),_0x37628b,_0x964333);_0x3891ae(_0x964333);});});}exports['VerifyAdditionalPhones']=function(_0x3a7e49){var _0x9e80cf=this;return new Promise(function(_0x58393b,_0x1d7e0d){return db[_0x816e('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x3a7e49[_0x816e('0x15')][_0x816e('0x16')],'ListId':_0x3a7e49[_0x816e('0x15')][_0x816e('0x17')],'VoiceQueueId':_0x3a7e49[_0x816e('0x15')]['VoiceQueueId']===undefined?null:_0x3a7e49[_0x816e('0x15')][_0x816e('0x18')],'CampaignId':_0x3a7e49[_0x816e('0x15')][_0x816e('0x19')]===undefined?null:_0x3a7e49[_0x816e('0x15')][_0x816e('0x19')]}})[_0x816e('0x1a')](function(_0xfa7eb6){if(_0xfa7eb6!=null){return db[_0x816e('0x1b')][_0x816e('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xfa7eb6['id'],'OrderBy':{'$gt':_0xfa7eb6[_0x816e('0x1d')]}},'order':[[_0x816e('0x1d'),_0x816e('0x1e')]]})[_0x816e('0x1a')](function(_0xa2cee9){var _0x25186a=0x0;if(_0xa2cee9){if(_0xa2cee9[_0x816e('0x1f')]+_0xa2cee9['countcongestionretry']+_0xa2cee9[_0x816e('0x20')]+_0xa2cee9[_0x816e('0x21')]+_0xa2cee9[_0x816e('0x22')]+_0xa2cee9['countabandonedretry']+_0xa2cee9['countmachineretry']+_0xa2cee9['countagentrejectretry']<_0x3a7e49['entity'][_0x816e('0x23')])_0x25186a=0x1;_0x58393b({'additional':_0x25186a});}else{return db[_0x816e('0x1b')][_0x816e('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xfa7eb6['id']},'order':[[_0x816e('0x1d'),_0x816e('0x1e')]]})[_0x816e('0x1a')](function(_0x229795){var _0x2943d2=0x0;if(_0x229795){if(_0x229795[_0x816e('0x1f')]+_0x229795[_0x816e('0x24')]+_0x229795[_0x816e('0x20')]+_0x229795['countnosuchnumberretry']+_0x229795['countdropretry']+_0x229795['countabandonedretry']+_0x229795['countmachineretry']+_0x229795[_0x816e('0x25')]<_0x3a7e49['entity'][_0x816e('0x23')])_0x2943d2=0x1;_0x58393b({'additional':_0x2943d2});}else{_0x58393b({'additional':0x0});}})[_0x816e('0x26')](function(_0xe657b5){logger[_0x816e('0x10')]('VerifyAdditionalPhones',_0xe657b5[_0x816e('0x12')]);_0x1d7e0d(_0x9e80cf['error'](0x1f4,_0xe657b5[_0x816e('0x12')]));});}})[_0x816e('0x26')](function(_0x2f8f22){logger[_0x816e('0x10')](_0x816e('0x27'),_0x2f8f22[_0x816e('0x12')]);_0x1d7e0d(_0x9e80cf['error'](0x1f4,_0x2f8f22[_0x816e('0x12')]));});}else _0x58393b({'additional':0x0});});});};exports[_0x816e('0x28')]=function(_0x52c522){var _0x2d5d7d=this;return new Promise(function(_0x545ad1,_0xbac1a8){return db[_0x816e('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x52c522[_0x816e('0x15')][_0x816e('0x16')],'ListId':_0x52c522[_0x816e('0x15')][_0x816e('0x17')],'VoiceQueueId':_0x52c522[_0x816e('0x15')]['VoiceQueueId']===undefined?null:_0x52c522[_0x816e('0x15')][_0x816e('0x18')],'CampaignId':_0x52c522[_0x816e('0x15')][_0x816e('0x19')]===undefined?null:_0x52c522['body']['CampaignId']}})['then'](function(_0x108f39){if(_0x108f39!=null){return db[_0x816e('0x1b')][_0x816e('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x108f39['id'],'OrderBy':{'$gte':_0x108f39[_0x816e('0x1d')]}},'order':[[_0x816e('0x1d'),_0x816e('0x1e')]]})[_0x816e('0x1a')](function(_0x57885e){if(_0x57885e)return activateAdditionalPhone(_0x108f39,_0x52c522[_0x816e('0x15')],_0x57885e,_0x52c522[_0x816e('0x29')],_0x52c522[_0x816e('0x2a')])[_0x816e('0x1a')](function(_0x3f5c61){_0x545ad1(_0x3f5c61);});else{return db['CmHopperAdditionalPhone'][_0x816e('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x108f39['id']},'order':[[_0x816e('0x1d'),_0x816e('0x1e')]]})[_0x816e('0x1a')](function(_0x1c311c){if(_0x1c311c)return activateAdditionalPhone(_0x108f39,_0x52c522[_0x816e('0x15')],_0x1c311c,_0x52c522['duration'],_0x52c522[_0x816e('0x2a')])[_0x816e('0x1a')](function(_0x4d4e84){_0x545ad1(_0x4d4e84);});else{_0x545ad1({'id':_0x108f39['id'],'phone':''});}})[_0x816e('0x26')](function(_0x4edbfd){logger[_0x816e('0x10')](_0x816e('0x27'),_0x4edbfd[_0x816e('0x12')]);_0xbac1a8(_0x2d5d7d[_0x816e('0x10')](0x1f4,_0x4edbfd['message']));});}})[_0x816e('0x26')](function(_0x2f5c65){logger[_0x816e('0x10')](_0x816e('0x27'),_0x2f5c65['message']);_0xbac1a8(_0x2d5d7d[_0x816e('0x10')](0x1f4,_0x2f5c65[_0x816e('0x12')]));});}else _0x545ad1(0x1);});});};function activateAdditionalPhone(_0x27606f,_0x50c046,_0x28f8f7,_0x58d031,_0x5945e5){return new Promise(function(_0x3b3a47,_0x4c61a9){var _0x50d511;if(_[_0x816e('0x2b')](_0x28f8f7[_0x816e('0x2c')])){_0x28f8f7['scheduledat']=moment();}if(moment()>moment(_0x28f8f7[_0x816e('0x2c')])){_0x50d511=moment()[_0x816e('0x2d')](_0x5945e5||0x3,'minutes');}else{if(_0x28f8f7['OrderBy']==0x0){_0x50d511=moment(_0x28f8f7[_0x816e('0x2c')]);}else{_0x50d511=moment()[_0x816e('0x2d')](_0x5945e5||0x3,_0x816e('0x2e'));}}if(_[_0x816e('0x2b')](_0x50d511)){_0x50d511=moment()[_0x816e('0x2d')](_0x5945e5||0x3,_0x816e('0x2e'));}var _0x1ee5f0={'phone':_0x27606f[_0x816e('0x2f')],'active':0x0,'OrderBy':_[_0x816e('0x2b')](_0x27606f[_0x816e('0x1d')])?0x0:_0x27606f['OrderBy'],'scheduledat':moment()['add'](_0x58d031||0x1,_0x816e('0x2e')),'countbusyretry':_0x50c046[_0x816e('0x1f')],'countcongestionretry':_0x50c046[_0x816e('0x24')],'countnoanswerretry':_0x50c046['countnoanswerretry'],'countnosuchnumberretry':_0x50c046[_0x816e('0x21')],'countdropretry':_0x50c046[_0x816e('0x22')],'countabandonedretry':_0x50c046[_0x816e('0x30')],'countmachineretry':_0x50c046[_0x816e('0x31')],'countagentrejectretry':_0x50c046['countagentrejectretry'],'createdAt':_0x50c046[_0x816e('0x32')],'updatedAt':_0x50c046['updatedAt']};var _0x28506f={'CmHopperId':_0x27606f['id'],'phone':_0x28f8f7[_0x816e('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x28f8f7['OrderBy'])?0x0:_0x28f8f7[_0x816e('0x1d')],'scheduledat':_0x50d511,'countbusyretry':_0x28f8f7[_0x816e('0x1f')],'countcongestionretry':_0x28f8f7[_0x816e('0x24')],'countnoanswerretry':_0x28f8f7[_0x816e('0x20')],'countnosuchnumberretry':_0x28f8f7['countnosuchnumberretry'],'countdropretry':_0x28f8f7[_0x816e('0x22')],'countabandonedretry':_0x28f8f7[_0x816e('0x30')],'countmachineretry':_0x28f8f7[_0x816e('0x31')],'countagentrejectretry':_0x28f8f7['countagentrejectretry'],'createdAt':_0x28f8f7['createdAt'],'updatedAt':_0x28f8f7[_0x816e('0x33')]};return db[_0x816e('0x34')][_0x816e('0x35')](function(_0x493cbe){return db['CmHopperAdditionalPhone'][_0x816e('0x36')](_0x1ee5f0,{'where':{'id':_0x28f8f7['id']}},{'transaction':_0x493cbe})[_0x816e('0x1a')](function(){return db[_0x816e('0x14')][_0x816e('0x36')](_0x28506f,{'where':{'id':_0x27606f['id']}},{'transaction':_0x493cbe});});})[_0x816e('0x1a')](function(_0x264068){_0x3b3a47({'id':_0x27606f['id'],'phone':_0x28f8f7['phone']});})[_0x816e('0x26')](function(_0x486548){logger[_0x816e('0x10')]('activateAdditionalPhone',_0x486548[_0x816e('0x12')]);_0x4c61a9({'error':_0x486548[_0x816e('0x12')]});});});}exports[_0x816e('0x37')]=function(_0x16c840){var _0x7f7b28=this;return new Promise(function(_0x54f418,_0x11b0fc){return db['CmHopper'][_0x816e('0x36')](_0x16c840[_0x816e('0x15')][_0x816e('0x38')],{'where':{'id':_0x16c840[_0x816e('0x15')]['id']}})[_0x816e('0x1a')](function(_0x9ebf7d){_0x54f418(_0x9ebf7d);})['catch'](function(_0x321640){logger[_0x816e('0x10')](_0x816e('0x37'),_0x321640[_0x816e('0x12')]);_0x11b0fc(_0x7f7b28[_0x816e('0x10')](0x1f4,_0x321640[_0x816e('0x12')]));});});}; \ No newline at end of file +var _0xa0c8=['countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','countabandonedretry','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry'];(function(_0x1644e5,_0x31ac5f){var _0x5bc914=function(_0x2302a1){while(--_0x2302a1){_0x1644e5['push'](_0x1644e5['shift']());}};_0x5bc914(++_0x31ac5f);}(_0xa0c8,0x1dd));var _0x8a0c=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xa0c8[_0x5581ba];return _0x1e927f;};'use strict';var _=require(_0x8a0c('0x0'));var util=require(_0x8a0c('0x1'));var moment=require(_0x8a0c('0x2'));var BPromise=require(_0x8a0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a0c('0x4'));var db=require(_0x8a0c('0x5'))['db'];var utils=require(_0x8a0c('0x6'));var logger=require(_0x8a0c('0x7'))('rpc');var config=require(_0x8a0c('0x8'));var jayson=require(_0x8a0c('0x9'));var client=jayson['client'][_0x8a0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x267d7a,_0xe21dcc,_0xe5486e){return new BPromise(function(_0x5cdf68,_0x44e597){return client[_0x8a0c('0xb')](_0x267d7a,_0xe5486e)['then'](function(_0x2b0b70){logger[_0x8a0c('0xc')](_0x8a0c('0xd'),_0xe21dcc,'request\x20sent');logger[_0x8a0c('0xe')](_0x8a0c('0xf'),_0xe21dcc,_0x8a0c('0x10'),JSON['stringify'](_0x2b0b70));if(_0x2b0b70[_0x8a0c('0x11')]){if(_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x12')]===0x1f4){logger[_0x8a0c('0x11')](_0x8a0c('0xd'),_0xe21dcc,_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x13')]);return _0x44e597(_0x2b0b70[_0x8a0c('0x11')]['message']);}logger['error'](_0x8a0c('0xd'),_0xe21dcc,_0x2b0b70[_0x8a0c('0x11')][_0x8a0c('0x13')]);return _0x5cdf68(_0x2b0b70[_0x8a0c('0x11')]['message']);}else{logger[_0x8a0c('0xc')](_0x8a0c('0xd'),_0xe21dcc,'request\x20sent');_0x5cdf68(_0x2b0b70[_0x8a0c('0x14')][_0x8a0c('0x13')]);}})[_0x8a0c('0x15')](function(_0x40bcbd){logger[_0x8a0c('0x11')](_0x8a0c('0xd'),_0xe21dcc,_0x40bcbd);_0x44e597(_0x40bcbd);});});}exports[_0x8a0c('0x16')]=function(_0x198efc){var _0x55246e=this;return new Promise(function(_0x2d4b67,_0xe415c3){return db[_0x8a0c('0x17')][_0x8a0c('0x18')]({'raw':!![],'where':{'ContactId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1a')],'ListId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1b')],'VoiceQueueId':_0x198efc[_0x8a0c('0x19')]['VoiceQueueId']===undefined?null:_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1c')],'CampaignId':_0x198efc[_0x8a0c('0x19')][_0x8a0c('0x1d')]===undefined?null:_0x198efc['body'][_0x8a0c('0x1d')]}})[_0x8a0c('0x1e')](function(_0x3a1a4f){if(_0x3a1a4f!=null){return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3a1a4f['id'],'OrderBy':{'$gt':_0x3a1a4f[_0x8a0c('0x20')]}},'order':[[_0x8a0c('0x20'),_0x8a0c('0x21')]]})[_0x8a0c('0x1e')](function(_0x403e37){var _0x3e7ec2=0x0;if(_0x403e37){if(_0x403e37[_0x8a0c('0x22')]+_0x403e37[_0x8a0c('0x23')]+_0x403e37[_0x8a0c('0x24')]+_0x403e37[_0x8a0c('0x25')]+_0x403e37[_0x8a0c('0x26')]+_0x403e37['countabandonedretry']+_0x403e37[_0x8a0c('0x27')]+_0x403e37[_0x8a0c('0x28')]<_0x198efc[_0x8a0c('0x29')]['dialGlobalMaxRetry'])_0x3e7ec2=0x1;_0x2d4b67({'additional':_0x3e7ec2});}else{return db[_0x8a0c('0x1f')][_0x8a0c('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3a1a4f['id']},'order':[[_0x8a0c('0x20'),_0x8a0c('0x21')]]})['then'](function(_0x8521f7){var _0x4db898=0x0;if(_0x8521f7){if(_0x8521f7['countbusyretry']+_0x8521f7[_0x8a0c('0x23')]+_0x8521f7[_0x8a0c('0x24')]+_0x8521f7[_0x8a0c('0x25')]+_0x8521f7[_0x8a0c('0x26')]+_0x8521f7['countabandonedretry']+_0x8521f7['countmachineretry']+_0x8521f7['countagentrejectretry']<_0x198efc[_0x8a0c('0x29')]['dialGlobalMaxRetry'])_0x4db898=0x1;_0x2d4b67({'additional':_0x4db898});}else{_0x2d4b67({'additional':0x0});}})[_0x8a0c('0x15')](function(_0x1c4b2d){logger['error'](_0x8a0c('0x16'),_0x1c4b2d['message']);_0xe415c3(_0x55246e['error'](0x1f4,_0x1c4b2d[_0x8a0c('0x13')]));});}})['catch'](function(_0xcd1446){logger[_0x8a0c('0x11')](_0x8a0c('0x16'),_0xcd1446[_0x8a0c('0x13')]);_0xe415c3(_0x55246e[_0x8a0c('0x11')](0x1f4,_0xcd1446[_0x8a0c('0x13')]));});}else _0x2d4b67({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x87ed45){var _0x2bd1e=this;return new Promise(function(_0xd7d5d3,_0x37e9cc){return db[_0x8a0c('0x17')][_0x8a0c('0x18')]({'raw':!![],'where':{'ContactId':_0x87ed45['body'][_0x8a0c('0x1a')],'ListId':_0x87ed45[_0x8a0c('0x19')]['ListId'],'VoiceQueueId':_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1c')]===undefined?null:_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1c')],'CampaignId':_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1d')]===undefined?null:_0x87ed45[_0x8a0c('0x19')][_0x8a0c('0x1d')]}})['then'](function(_0x37df8b){if(_0x37df8b!=null){return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37df8b['id'],'OrderBy':{'$gte':_0x37df8b[_0x8a0c('0x20')]}},'order':[['OrderBy',_0x8a0c('0x21')]]})['then'](function(_0x24473d){if(_0x24473d)return activateAdditionalPhone(_0x37df8b,_0x87ed45[_0x8a0c('0x19')],_0x24473d,_0x87ed45[_0x8a0c('0x2a')],_0x87ed45[_0x8a0c('0x2b')])[_0x8a0c('0x1e')](function(_0x57f6b8){_0xd7d5d3(_0x57f6b8);});else{return db[_0x8a0c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37df8b['id']},'order':[['OrderBy','ASC']]})[_0x8a0c('0x1e')](function(_0x584684){if(_0x584684)return activateAdditionalPhone(_0x37df8b,_0x87ed45['body'],_0x584684,_0x87ed45['duration'],_0x87ed45[_0x8a0c('0x2b')])[_0x8a0c('0x1e')](function(_0x5569aa){_0xd7d5d3(_0x5569aa);});else{_0xd7d5d3({'id':_0x37df8b['id'],'phone':''});}})[_0x8a0c('0x15')](function(_0x130ea5){logger[_0x8a0c('0x11')]('VerifyAdditionalPhones',_0x130ea5['message']);_0x37e9cc(_0x2bd1e['error'](0x1f4,_0x130ea5[_0x8a0c('0x13')]));});}})[_0x8a0c('0x15')](function(_0x72b97a){logger['error'](_0x8a0c('0x16'),_0x72b97a[_0x8a0c('0x13')]);_0x37e9cc(_0x2bd1e[_0x8a0c('0x11')](0x1f4,_0x72b97a[_0x8a0c('0x13')]));});}else _0xd7d5d3(0x1);});});};function activateAdditionalPhone(_0x137226,_0x2a2000,_0x460271,_0x313bcb,_0x51d93f){return new Promise(function(_0x54e67d,_0x1501d8){var _0x9d33c7;if(_['isNil'](_0x460271[_0x8a0c('0x2c')])){_0x460271[_0x8a0c('0x2c')]=moment();}if(moment()>moment(_0x460271['scheduledat'])){_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,_0x8a0c('0x2e'));}else{if(_0x460271['OrderBy']==0x0){_0x9d33c7=moment(_0x460271[_0x8a0c('0x2c')]);}else{_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,_0x8a0c('0x2e'));}}if(_[_0x8a0c('0x2f')](_0x9d33c7)){_0x9d33c7=moment()[_0x8a0c('0x2d')](_0x51d93f||0x3,'minutes');}var _0xe7d535={'phone':_0x137226[_0x8a0c('0x30')],'active':0x0,'OrderBy':_[_0x8a0c('0x2f')](_0x137226[_0x8a0c('0x20')])?0x0:_0x137226['OrderBy'],'scheduledat':moment()[_0x8a0c('0x2d')](_0x313bcb||0x1,_0x8a0c('0x2e')),'countbusyretry':_0x2a2000[_0x8a0c('0x22')],'countcongestionretry':_0x2a2000[_0x8a0c('0x23')],'countnoanswerretry':_0x2a2000[_0x8a0c('0x24')],'countnosuchnumberretry':_0x2a2000['countnosuchnumberretry'],'countdropretry':_0x2a2000[_0x8a0c('0x26')],'countabandonedretry':_0x2a2000['countabandonedretry'],'countmachineretry':_0x2a2000[_0x8a0c('0x27')],'countagentrejectretry':_0x2a2000[_0x8a0c('0x28')],'createdAt':_0x2a2000[_0x8a0c('0x31')],'updatedAt':_0x2a2000[_0x8a0c('0x32')]};var _0x40bfdc={'CmHopperId':_0x137226['id'],'phone':_0x460271['phone'],'active':0x0,'OrderBy':_['isNil'](_0x460271[_0x8a0c('0x20')])?0x0:_0x460271['OrderBy'],'scheduledat':_0x9d33c7,'countbusyretry':_0x460271[_0x8a0c('0x22')],'countcongestionretry':_0x460271[_0x8a0c('0x23')],'countnoanswerretry':_0x460271[_0x8a0c('0x24')],'countnosuchnumberretry':_0x460271['countnosuchnumberretry'],'countdropretry':_0x460271['countdropretry'],'countabandonedretry':_0x460271[_0x8a0c('0x33')],'countmachineretry':_0x460271[_0x8a0c('0x27')],'countagentrejectretry':_0x460271[_0x8a0c('0x28')],'createdAt':_0x460271['createdAt'],'updatedAt':_0x460271[_0x8a0c('0x32')]};return db[_0x8a0c('0x34')]['transaction'](function(_0x289f51){return db[_0x8a0c('0x1f')][_0x8a0c('0x35')](_0xe7d535,{'where':{'id':_0x460271['id']}},{'transaction':_0x289f51})[_0x8a0c('0x1e')](function(){return db[_0x8a0c('0x17')][_0x8a0c('0x35')](_0x40bfdc,{'where':{'id':_0x137226['id']}},{'transaction':_0x289f51});});})[_0x8a0c('0x1e')](function(_0x39322e){_0x54e67d({'id':_0x137226['id'],'phone':_0x460271[_0x8a0c('0x30')]});})[_0x8a0c('0x15')](function(_0x2b1c01){logger[_0x8a0c('0x11')](_0x8a0c('0x36'),_0x2b1c01[_0x8a0c('0x13')]);_0x1501d8({'error':_0x2b1c01[_0x8a0c('0x13')]});});});}exports[_0x8a0c('0x37')]=function(_0x19c9b6){var _0x2c8abe=this;return new Promise(function(_0x1107f7,_0x11b41f){return db['CmHopper'][_0x8a0c('0x35')](_0x19c9b6[_0x8a0c('0x19')][_0x8a0c('0x38')],{'where':{'id':_0x19c9b6[_0x8a0c('0x19')]['id']}})[_0x8a0c('0x1e')](function(_0x5d58d6){_0x1107f7(_0x5d58d6);})['catch'](function(_0x5b8071){logger['error'](_0x8a0c('0x37'),_0x5b8071[_0x8a0c('0x13')]);_0x11b41f(_0x2c8abe[_0x8a0c('0x11')](0x1f4,_0x5b8071[_0x8a0c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 48cdbed..ff4f907 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d5d=['/:id','post','create','put','isAuthenticated','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x56ba58,_0x1697c4){var _0x337772=function(_0x1fd2e8){while(--_0x1fd2e8){_0x56ba58['push'](_0x56ba58['shift']());}};_0x337772(++_0x1697c4);}(_0x1d5d,0x19e));var _0xd1d5=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x1d5d[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0xd1d5('0x0'));var util=require(_0xd1d5('0x1'));var path=require('path');var timeout=require(_0xd1d5('0x2'));var express=require(_0xd1d5('0x3'));var router=express[_0xd1d5('0x4')]();var fs_extra=require(_0xd1d5('0x5'));var auth=require(_0xd1d5('0x6'));var interaction=require(_0xd1d5('0x7'));var config=require(_0xd1d5('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xd1d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xd1d5('0xa')]);router['get'](_0xd1d5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd1d5('0xc')]('/',auth['isAuthenticated'](),controller[_0xd1d5('0xd')]);router[_0xd1d5('0xe')]('/:id',auth[_0xd1d5('0xf')](),controller['update']);router['delete'](_0xd1d5('0xb'),auth[_0xd1d5('0xf')](),controller['destroy']);module[_0xd1d5('0x10')]=router; \ No newline at end of file +var _0x76d2=['connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x5bce9f,_0x47fe07){var _0x3dbd8e=function(_0x1942bf){while(--_0x1942bf){_0x5bce9f['push'](_0x5bce9f['shift']());}};_0x3dbd8e(++_0x47fe07);}(_0x76d2,0x6e));var _0x276d=function(_0x3c3d6b,_0x24dd55){_0x3c3d6b=_0x3c3d6b-0x0;var _0x3c9779=_0x76d2[_0x3c3d6b];return _0x3c9779;};'use strict';var multer=require('multer');var util=require(_0x276d('0x0'));var path=require(_0x276d('0x1'));var timeout=require(_0x276d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x276d('0x3'));var auth=require(_0x276d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x276d('0x5')]('/',auth[_0x276d('0x6')](),controller['index']);router['get']('/:id',auth[_0x276d('0x6')](),controller[_0x276d('0x7')]);router[_0x276d('0x8')]('/',auth[_0x276d('0x6')](),controller[_0x276d('0x9')]);router[_0x276d('0xa')](_0x276d('0xb'),auth[_0x276d('0x6')](),controller[_0x276d('0xc')]);router[_0x276d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x276d('0xe')]);module[_0x276d('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 64ca70c..cf4ae18 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 _0xa69a=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x81f8e9,_0x24c073){var _0x54df18=function(_0x20dd85){while(--_0x20dd85){_0x81f8e9['push'](_0x81f8e9['shift']());}};_0x54df18(++_0x24c073);}(_0xa69a,0x8e));var _0xaa69=function(_0x1aa612,_0x1a5fb7){_0x1aa612=_0x1aa612-0x0;var _0x133d04=_0xa69a[_0x1aa612];return _0x133d04;};'use strict';var moment=require(_0xaa69('0x0'));var Sequelize=require(_0xaa69('0x1'));module[_0xaa69('0x2')]={'phone':{'type':Sequelize[_0xaa69('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaa69('0x4')],'unique':_0xaa69('0x5')},'ListId':{'type':Sequelize[_0xaa69('0x4')],'unique':_0xaa69('0x5')},'VoiceQueueId':{'type':Sequelize[_0xaa69('0x4')],'unique':_0xaa69('0x5')}}; \ No newline at end of file +var _0x9ed1=['exports','STRING','INTEGER','moment','sequelize'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0x9ed1,0x107));var _0x19ed=function(_0x4226a5,_0x27e279){_0x4226a5=_0x4226a5-0x0;var _0x64480e=_0x9ed1[_0x4226a5];return _0x64480e;};'use strict';var moment=require(_0x19ed('0x0'));var Sequelize=require(_0x19ed('0x1'));module[_0x19ed('0x2')]={'phone':{'type':Sequelize[_0x19ed('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x19ed('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b553864..a5cb640 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 _0x5da3=['bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','CmHopperBlack','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x15b44a,_0x76e7e7){var _0x5327e5=function(_0x85c883){while(--_0x85c883){_0x15b44a['push'](_0x15b44a['shift']());}};_0x5327e5(++_0x76e7e7);}(_0x5da3,0x123));var _0x35da=function(_0xdfc87d,_0x28e1a5){_0xdfc87d=_0xdfc87d-0x0;var _0x4e2a5e=_0x5da3[_0xdfc87d];return _0x4e2a5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35da('0x0'));var zipdir=require(_0x35da('0x1'));var jsonpatch=require(_0x35da('0x2'));var rp=require(_0x35da('0x3'));var moment=require(_0x35da('0x4'));var BPromise=require(_0x35da('0x5'));var Mustache=require(_0x35da('0x6'));var util=require(_0x35da('0x7'));var path=require('path');var sox=require(_0x35da('0x8'));var csv=require(_0x35da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35da('0xa'));var _=require(_0x35da('0xb'));var squel=require(_0x35da('0xc'));var crypto=require(_0x35da('0xd'));var jsforce=require(_0x35da('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35da('0xf'));var Papa=require(_0x35da('0x10'));var Redis=require(_0x35da('0x11'));var authService=require(_0x35da('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x35da('0x13'));var hardwareService=require(_0x35da('0x14'));var logger=require(_0x35da('0x15'))(_0x35da('0x16'));var utils=require(_0x35da('0x17'));var config=require(_0x35da('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x35da('0x19'))['db'];function respondWithStatusCode(_0x4e5d90,_0x4b21f1){_0x4b21f1=_0x4b21f1||0xcc;return function(_0x453230){if(_0x453230){return _0x4e5d90[_0x35da('0x1a')](_0x4b21f1);}return _0x4e5d90[_0x35da('0x1b')](_0x4b21f1)[_0x35da('0x1c')]();};}function respondWithResult(_0x340ee3,_0x2fc8ef){_0x2fc8ef=_0x2fc8ef||0xc8;return function(_0x564238){if(_0x564238){return _0x340ee3[_0x35da('0x1b')](_0x2fc8ef)[_0x35da('0x1d')](_0x564238);}};}function respondWithFilteredResult(_0x2993c7,_0x7eff42){return function(_0x332dc8){if(_0x332dc8){var _0x2e56db=typeof _0x7eff42[_0x35da('0x1e')]===_0x35da('0x1f')&&typeof _0x7eff42['limit']===_0x35da('0x1f');var _0x3079d3=_0x332dc8[_0x35da('0x20')];var _0x2d5b2f=_0x2e56db?0x0:_0x7eff42[_0x35da('0x1e')];var _0x140d2e=_0x2e56db?_0x332dc8[_0x35da('0x20')]:_0x7eff42[_0x35da('0x1e')]+_0x7eff42['limit'];var _0x8428b1;if(_0x140d2e>=_0x3079d3){_0x140d2e=_0x3079d3;_0x8428b1=0xc8;}else{_0x8428b1=0xce;}_0x2993c7[_0x35da('0x1b')](_0x8428b1);return _0x2993c7[_0x35da('0x21')](_0x35da('0x22'),_0x2d5b2f+'-'+_0x140d2e+'/'+_0x3079d3)[_0x35da('0x1d')](_0x332dc8);}return null;};}function patchUpdates(_0x3f83ca){return function(_0x175874){try{jsonpatch[_0x35da('0x23')](_0x175874,_0x3f83ca,!![]);}catch(_0x105bf1){return BPromise[_0x35da('0x24')](_0x105bf1);}return _0x175874[_0x35da('0x25')]();};}function saveUpdates(_0x42d1e1,_0x357693){return function(_0x17b1bd){if(_0x17b1bd){return _0x17b1bd[_0x35da('0x26')](_0x42d1e1)[_0x35da('0x27')](function(_0x3b9221){return _0x3b9221;});}return null;};}function removeEntity(_0x3c2d5f,_0x45415f){return function(_0x2bc4f8){if(_0x2bc4f8){return _0x2bc4f8['destroy']()[_0x35da('0x27')](function(){_0x3c2d5f[_0x35da('0x1b')](0xcc)[_0x35da('0x1c')]();});}};}function handleEntityNotFound(_0x96b758,_0x5044ae){return function(_0x55a4f5){if(!_0x55a4f5){_0x96b758[_0x35da('0x1a')](0x194);}return _0x55a4f5;};}function handleError(_0x252b0e,_0xbcfda2){_0xbcfda2=_0xbcfda2||0x1f4;return function(_0x4f0b9e){logger['error'](_0x4f0b9e[_0x35da('0x28')]);if(_0x4f0b9e['name']){delete _0x4f0b9e[_0x35da('0x29')];}_0x252b0e['status'](_0xbcfda2)['send'](_0x4f0b9e);};}exports[_0x35da('0x2a')]=function(_0x38d3fc,_0x2d3ca2){var _0x4c2746={},_0x2d03f6={},_0x2805dd={'count':0x0,'rows':[]};var _0xeb6cae=_[_0x35da('0x2b')](db[_0x35da('0x2c')][_0x35da('0x2d')],function(_0x14b23e){return{'name':_0x14b23e['fieldName'],'type':_0x14b23e[_0x35da('0x2e')]['key']};});_0x2d03f6[_0x35da('0x2f')]=_[_0x35da('0x2b')](_0xeb6cae,_0x35da('0x29'));_0x2d03f6['query']=_[_0x35da('0x30')](_0x38d3fc[_0x35da('0x31')]);_0x2d03f6[_0x35da('0x32')]=_[_0x35da('0x33')](_0x2d03f6[_0x35da('0x2f')],_0x2d03f6[_0x35da('0x31')]);_0x4c2746[_0x35da('0x34')]=_[_0x35da('0x33')](_0x2d03f6[_0x35da('0x2f')],qs['fields'](_0x38d3fc['query'][_0x35da('0x35')]));_0x4c2746[_0x35da('0x34')]=_0x4c2746[_0x35da('0x34')][_0x35da('0x36')]?_0x4c2746['attributes']:_0x2d03f6[_0x35da('0x2f')];if(!_0x38d3fc[_0x35da('0x31')][_0x35da('0x37')]('nolimit')){_0x4c2746[_0x35da('0x38')]=qs[_0x35da('0x38')](_0x38d3fc[_0x35da('0x31')][_0x35da('0x38')]);_0x4c2746['offset']=qs[_0x35da('0x1e')](_0x38d3fc[_0x35da('0x31')]['offset']);}_0x4c2746[_0x35da('0x39')]=qs[_0x35da('0x3a')](_0x38d3fc[_0x35da('0x31')][_0x35da('0x3a')]);_0x4c2746[_0x35da('0x3b')]=qs[_0x35da('0x32')](_['pick'](_0x38d3fc[_0x35da('0x31')],_0x2d03f6['filters']),_0xeb6cae);if(_0x38d3fc[_0x35da('0x31')][_0x35da('0x3c')]){_0x4c2746['where']=_[_0x35da('0x3d')](_0x4c2746[_0x35da('0x3b')],{'$or':_['map'](_0xeb6cae,function(_0xc69c53){if(_0xc69c53['type']!=='VIRTUAL'){var _0x503156={};_0x503156[_0xc69c53[_0x35da('0x29')]]={'$like':'%'+_0x38d3fc[_0x35da('0x31')][_0x35da('0x3c')]+'%'};return _0x503156;}})});}_0x4c2746=_[_0x35da('0x3d')]({},_0x4c2746,_0x38d3fc['options']);var _0x3cdcaf={'where':_0x4c2746[_0x35da('0x3b')]};return db[_0x35da('0x2c')][_0x35da('0x20')](_0x3cdcaf)[_0x35da('0x27')](function(_0x37c1f1){_0x2805dd[_0x35da('0x20')]=_0x37c1f1;if(_0x38d3fc[_0x35da('0x31')][_0x35da('0x3e')]){_0x4c2746[_0x35da('0x3f')]=[{'all':!![]}];}return db[_0x35da('0x2c')][_0x35da('0x40')](_0x4c2746);})['then'](function(_0x2f4b2c){_0x2805dd[_0x35da('0x41')]=_0x2f4b2c;return _0x2805dd;})[_0x35da('0x27')](respondWithFilteredResult(_0x2d3ca2,_0x4c2746))[_0x35da('0x42')](handleError(_0x2d3ca2,null));};exports[_0x35da('0x43')]=function(_0x54df29,_0x1f121f){var _0x2b8390={'raw':!![],'where':{'id':_0x54df29[_0x35da('0x44')]['id']}},_0x57b9c2={};_0x57b9c2[_0x35da('0x2f')]=_['keys'](db[_0x35da('0x2c')][_0x35da('0x2d')]);_0x57b9c2[_0x35da('0x31')]=_[_0x35da('0x30')](_0x54df29[_0x35da('0x31')]);_0x57b9c2['filters']=_['intersection'](_0x57b9c2[_0x35da('0x2f')],_0x57b9c2[_0x35da('0x31')]);_0x2b8390[_0x35da('0x34')]=_[_0x35da('0x33')](_0x57b9c2[_0x35da('0x2f')],qs[_0x35da('0x35')](_0x54df29['query'][_0x35da('0x35')]));_0x2b8390[_0x35da('0x34')]=_0x2b8390[_0x35da('0x34')][_0x35da('0x36')]?_0x2b8390['attributes']:_0x57b9c2[_0x35da('0x2f')];if(_0x54df29[_0x35da('0x31')][_0x35da('0x3e')]){_0x2b8390['include']=[{'all':!![]}];}_0x2b8390=_[_0x35da('0x3d')]({},_0x2b8390,_0x54df29[_0x35da('0x45')]);return db[_0x35da('0x2c')]['find'](_0x2b8390)[_0x35da('0x27')](handleEntityNotFound(_0x1f121f,null))[_0x35da('0x27')](respondWithResult(_0x1f121f,null))[_0x35da('0x42')](handleError(_0x1f121f,null));};exports[_0x35da('0x26')]=function(_0x535204,_0x246e96){if(_0x535204['body']['id']){delete _0x535204[_0x35da('0x46')]['id'];}return db[_0x35da('0x2c')]['find']({'where':{'id':_0x535204[_0x35da('0x44')]['id']}})[_0x35da('0x27')](handleEntityNotFound(_0x246e96,null))[_0x35da('0x27')](saveUpdates(_0x535204['body'],null))[_0x35da('0x27')](respondWithResult(_0x246e96,null))[_0x35da('0x42')](handleError(_0x246e96,null));};exports[_0x35da('0x47')]=function(_0x268fe5,_0x2c4760){return db[_0x35da('0x2c')][_0x35da('0x48')]({'where':{'id':_0x268fe5['params']['id']}})[_0x35da('0x27')](handleEntityNotFound(_0x2c4760,null))[_0x35da('0x27')](removeEntity(_0x2c4760,null))['catch'](handleError(_0x2c4760,null));};exports[_0x35da('0x49')]=function(_0x21eaa1,_0x1b9ae5){return db[_0x35da('0x2c')][_0x35da('0x49')]()[_0x35da('0x27')](respondWithResult(_0x1b9ae5,null))['catch'](handleError(_0x1b9ae5,null));}; \ No newline at end of file +var _0xb9f7=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','count','set','apply','reject','save','update','then','destroy','status','sendStatus','stack','name','index','map','CmHopperBlack','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x3a1602,_0xfbce10){var _0xeeb50f=function(_0x515304){while(--_0x515304){_0x3a1602['push'](_0x3a1602['shift']());}};_0xeeb50f(++_0xfbce10);}(_0xb9f7,0x18b));var _0x7b9f=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xb9f7[_0xf79bae];return _0x5d2cb7;};'use strict';var emlformat=require(_0x7b9f('0x0'));var rimraf=require(_0x7b9f('0x1'));var zipdir=require(_0x7b9f('0x2'));var jsonpatch=require(_0x7b9f('0x3'));var rp=require('request-promise');var moment=require(_0x7b9f('0x4'));var BPromise=require(_0x7b9f('0x5'));var Mustache=require(_0x7b9f('0x6'));var util=require(_0x7b9f('0x7'));var path=require(_0x7b9f('0x8'));var sox=require(_0x7b9f('0x9'));var csv=require('to-csv');var ejs=require(_0x7b9f('0xa'));var fs=require('fs');var fs_extra=require(_0x7b9f('0xb'));var _=require(_0x7b9f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b9f('0xd'));var deskjs=require(_0x7b9f('0xe'));var toCsv=require(_0x7b9f('0xf'));var querystring=require(_0x7b9f('0x10'));var Papa=require(_0x7b9f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b9f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b9f('0x13'))('api');var utils=require(_0x7b9f('0x14'));var config=require(_0x7b9f('0x15'));var licenseUtil=require(_0x7b9f('0x16'));var db=require(_0x7b9f('0x17'))['db'];function respondWithStatusCode(_0x303ec9,_0x322dbe){_0x322dbe=_0x322dbe||0xcc;return function(_0x4b5f3e){if(_0x4b5f3e){return _0x303ec9['sendStatus'](_0x322dbe);}return _0x303ec9['status'](_0x322dbe)[_0x7b9f('0x18')]();};}function respondWithResult(_0x367053,_0x533071){_0x533071=_0x533071||0xc8;return function(_0x4d3999){if(_0x4d3999){return _0x367053['status'](_0x533071)[_0x7b9f('0x19')](_0x4d3999);}};}function respondWithFilteredResult(_0x2159e8,_0x33c449){return function(_0x41eef4){if(_0x41eef4){var _0x47e906=typeof _0x33c449[_0x7b9f('0x1a')]==='undefined'&&typeof _0x33c449['limit']==='undefined';var _0x58accf=_0x41eef4[_0x7b9f('0x1b')];var _0x535afa=_0x47e906?0x0:_0x33c449[_0x7b9f('0x1a')];var _0x2d66ff=_0x47e906?_0x41eef4[_0x7b9f('0x1b')]:_0x33c449[_0x7b9f('0x1a')]+_0x33c449['limit'];var _0x2b582a;if(_0x2d66ff>=_0x58accf){_0x2d66ff=_0x58accf;_0x2b582a=0xc8;}else{_0x2b582a=0xce;}_0x2159e8['status'](_0x2b582a);return _0x2159e8[_0x7b9f('0x1c')]('Content-Range',_0x535afa+'-'+_0x2d66ff+'/'+_0x58accf)[_0x7b9f('0x19')](_0x41eef4);}return null;};}function patchUpdates(_0x380420){return function(_0x783869){try{jsonpatch[_0x7b9f('0x1d')](_0x783869,_0x380420,!![]);}catch(_0x30711b){return BPromise[_0x7b9f('0x1e')](_0x30711b);}return _0x783869[_0x7b9f('0x1f')]();};}function saveUpdates(_0x54475e,_0x804d3d){return function(_0x281c05){if(_0x281c05){return _0x281c05[_0x7b9f('0x20')](_0x54475e)[_0x7b9f('0x21')](function(_0x280e73){return _0x280e73;});}return null;};}function removeEntity(_0x287bfa,_0x59d7b9){return function(_0x3e07c5){if(_0x3e07c5){return _0x3e07c5[_0x7b9f('0x22')]()[_0x7b9f('0x21')](function(){_0x287bfa[_0x7b9f('0x23')](0xcc)[_0x7b9f('0x18')]();});}};}function handleEntityNotFound(_0x5dbffa,_0x38ac91){return function(_0x474880){if(!_0x474880){_0x5dbffa[_0x7b9f('0x24')](0x194);}return _0x474880;};}function handleError(_0x362355,_0x49e455){_0x49e455=_0x49e455||0x1f4;return function(_0x38af88){logger['error'](_0x38af88[_0x7b9f('0x25')]);if(_0x38af88['name']){delete _0x38af88[_0x7b9f('0x26')];}_0x362355[_0x7b9f('0x23')](_0x49e455)['send'](_0x38af88);};}exports[_0x7b9f('0x27')]=function(_0x3ec6bc,_0xcc9f19){var _0x48e924={},_0x180ba7={},_0xf92d84={'count':0x0,'rows':[]};var _0x4cf0c1=_[_0x7b9f('0x28')](db[_0x7b9f('0x29')]['rawAttributes'],function(_0x4f65b3){return{'name':_0x4f65b3['fieldName'],'type':_0x4f65b3[_0x7b9f('0x2a')][_0x7b9f('0x2b')]};});_0x180ba7[_0x7b9f('0x2c')]=_[_0x7b9f('0x28')](_0x4cf0c1,_0x7b9f('0x26'));_0x180ba7[_0x7b9f('0x2d')]=_[_0x7b9f('0x2e')](_0x3ec6bc[_0x7b9f('0x2d')]);_0x180ba7[_0x7b9f('0x2f')]=_['intersection'](_0x180ba7[_0x7b9f('0x2c')],_0x180ba7['query']);_0x48e924[_0x7b9f('0x30')]=_[_0x7b9f('0x31')](_0x180ba7[_0x7b9f('0x2c')],qs[_0x7b9f('0x32')](_0x3ec6bc[_0x7b9f('0x2d')]['fields']));_0x48e924[_0x7b9f('0x30')]=_0x48e924[_0x7b9f('0x30')][_0x7b9f('0x33')]?_0x48e924['attributes']:_0x180ba7['model'];if(!_0x3ec6bc[_0x7b9f('0x2d')]['hasOwnProperty'](_0x7b9f('0x34'))){_0x48e924[_0x7b9f('0x35')]=qs[_0x7b9f('0x35')](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x35')]);_0x48e924[_0x7b9f('0x1a')]=qs[_0x7b9f('0x1a')](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x1a')]);}_0x48e924['order']=qs['sort'](_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x36')]);_0x48e924['where']=qs['filters'](_['pick'](_0x3ec6bc[_0x7b9f('0x2d')],_0x180ba7[_0x7b9f('0x2f')]),_0x4cf0c1);if(_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x37')]){_0x48e924[_0x7b9f('0x38')]=_[_0x7b9f('0x39')](_0x48e924[_0x7b9f('0x38')],{'$or':_[_0x7b9f('0x28')](_0x4cf0c1,function(_0x2756bf){if(_0x2756bf[_0x7b9f('0x2a')]!==_0x7b9f('0x3a')){var _0x2ce5f1={};_0x2ce5f1[_0x2756bf['name']]={'$like':'%'+_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x37')]+'%'};return _0x2ce5f1;}})});}_0x48e924=_['merge']({},_0x48e924,_0x3ec6bc[_0x7b9f('0x3b')]);var _0x2f77c7={'where':_0x48e924[_0x7b9f('0x38')]};return db[_0x7b9f('0x29')]['count'](_0x2f77c7)[_0x7b9f('0x21')](function(_0x133f9c){_0xf92d84[_0x7b9f('0x1b')]=_0x133f9c;if(_0x3ec6bc[_0x7b9f('0x2d')][_0x7b9f('0x3c')]){_0x48e924[_0x7b9f('0x3d')]=[{'all':!![]}];}return db[_0x7b9f('0x29')]['findAll'](_0x48e924);})[_0x7b9f('0x21')](function(_0x96a19a){_0xf92d84[_0x7b9f('0x3e')]=_0x96a19a;return _0xf92d84;})['then'](respondWithFilteredResult(_0xcc9f19,_0x48e924))['catch'](handleError(_0xcc9f19,null));};exports[_0x7b9f('0x3f')]=function(_0x42eebf,_0x1cf94c){var _0x40053c={'raw':!![],'where':{'id':_0x42eebf[_0x7b9f('0x40')]['id']}},_0x162a73={};_0x162a73['model']=_['keys'](db[_0x7b9f('0x29')]['rawAttributes']);_0x162a73[_0x7b9f('0x2d')]=_['keys'](_0x42eebf[_0x7b9f('0x2d')]);_0x162a73[_0x7b9f('0x2f')]=_['intersection'](_0x162a73[_0x7b9f('0x2c')],_0x162a73[_0x7b9f('0x2d')]);_0x40053c[_0x7b9f('0x30')]=_[_0x7b9f('0x31')](_0x162a73[_0x7b9f('0x2c')],qs['fields'](_0x42eebf[_0x7b9f('0x2d')][_0x7b9f('0x32')]));_0x40053c['attributes']=_0x40053c[_0x7b9f('0x30')][_0x7b9f('0x33')]?_0x40053c[_0x7b9f('0x30')]:_0x162a73[_0x7b9f('0x2c')];if(_0x42eebf['query']['includeAll']){_0x40053c[_0x7b9f('0x3d')]=[{'all':!![]}];}_0x40053c=_[_0x7b9f('0x39')]({},_0x40053c,_0x42eebf['options']);return db[_0x7b9f('0x29')]['find'](_0x40053c)[_0x7b9f('0x21')](handleEntityNotFound(_0x1cf94c,null))[_0x7b9f('0x21')](respondWithResult(_0x1cf94c,null))[_0x7b9f('0x41')](handleError(_0x1cf94c,null));};exports[_0x7b9f('0x20')]=function(_0x5854c8,_0xad1167){if(_0x5854c8[_0x7b9f('0x42')]['id']){delete _0x5854c8['body']['id'];}return db[_0x7b9f('0x29')]['find']({'where':{'id':_0x5854c8['params']['id']}})[_0x7b9f('0x21')](handleEntityNotFound(_0xad1167,null))['then'](saveUpdates(_0x5854c8[_0x7b9f('0x42')],null))[_0x7b9f('0x21')](respondWithResult(_0xad1167,null))[_0x7b9f('0x41')](handleError(_0xad1167,null));};exports[_0x7b9f('0x22')]=function(_0x11db80,_0x290f80){return db[_0x7b9f('0x29')][_0x7b9f('0x43')]({'where':{'id':_0x11db80[_0x7b9f('0x40')]['id']}})['then'](handleEntityNotFound(_0x290f80,null))[_0x7b9f('0x21')](removeEntity(_0x290f80,null))['catch'](handleError(_0x290f80,null));};exports['describe']=function(_0x154729,_0x3d871a){return db[_0x7b9f('0x29')][_0x7b9f('0x44')]()['then'](respondWithResult(_0x3d871a,null))[_0x7b9f('0x41')](handleError(_0x3d871a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 81bbc84..3a73e7e 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 _0x4d24=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4d24,0x1a6));var _0x44d2=function(_0x1d1cac,_0x2a142c){_0x1d1cac=_0x1d1cac-0x0;var _0x4557a0=_0x4d24[_0x1d1cac];return _0x4557a0;};'use strict';var _=require(_0x44d2('0x0'));var util=require(_0x44d2('0x1'));var logger=require(_0x44d2('0x2'))(_0x44d2('0x3'));var moment=require(_0x44d2('0x4'));var BPromise=require(_0x44d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x44d2('0x6'));var config=require(_0x44d2('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x44d2('0x8')]=function(_0x413282,_0x56385e){return _0x413282[_0x44d2('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe55e=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe55e,0x79));var _0xee55=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe55e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xee55('0x0'));var logger=require(_0xee55('0x1'))(_0xee55('0x2'));var moment=require(_0xee55('0x3'));var BPromise=require(_0xee55('0x4'));var rp=require(_0xee55('0x5'));var fs=require('fs');var path=require(_0xee55('0x6'));var rimraf=require(_0xee55('0x7'));var config=require(_0xee55('0x8'));var attributes=require(_0xee55('0x9'));module[_0xee55('0xa')]=function(_0x386025,_0x37386c){return _0x386025[_0xee55('0xb')](_0xee55('0xc'),attributes,{'tableName':_0xee55('0xd'),'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 7dfa6c7..12bfa3b 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 _0x95d8=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy'];(function(_0x5e5ecd,_0x12f9f9){var _0x9c481=function(_0x127cc3){while(--_0x127cc3){_0x5e5ecd['push'](_0x5e5ecd['shift']());}};_0x9c481(++_0x12f9f9);}(_0x95d8,0x1d4));var _0x895d=function(_0x3014a3,_0x39764b){_0x3014a3=_0x3014a3-0x0;var _0x53685a=_0x95d8[_0x3014a3];return _0x53685a;};'use strict';var _=require(_0x895d('0x0'));var util=require(_0x895d('0x1'));var moment=require('moment');var BPromise=require(_0x895d('0x2'));var rs=require(_0x895d('0x3'));var fs=require('fs');var Redis=require(_0x895d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x895d('0x5'));var logger=require(_0x895d('0x6'))(_0x895d('0x7'));var config=require(_0x895d('0x8'));var jayson=require(_0x895d('0x9'));var client=jayson[_0x895d('0xa')][_0x895d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e40b9,_0x4faa78,_0xb9b152){return new BPromise(function(_0x5c982c,_0x441e37){return client[_0x895d('0xc')](_0x1e40b9,_0xb9b152)[_0x895d('0xd')](function(_0x59f8b6){logger['info'](_0x895d('0xe'),_0x4faa78,_0x895d('0xf'));logger['debug'](_0x895d('0x10'),_0x4faa78,_0x895d('0xf'),JSON[_0x895d('0x11')](_0x59f8b6));if(_0x59f8b6[_0x895d('0x12')]){if(_0x59f8b6[_0x895d('0x12')][_0x895d('0x13')]===0x1f4){logger[_0x895d('0x12')](_0x895d('0xe'),_0x4faa78,_0x59f8b6[_0x895d('0x12')][_0x895d('0x14')]);return _0x441e37(_0x59f8b6[_0x895d('0x12')][_0x895d('0x14')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4faa78,_0x59f8b6[_0x895d('0x12')]['message']);return _0x5c982c(_0x59f8b6[_0x895d('0x12')]['message']);}else{logger[_0x895d('0x15')](_0x895d('0xe'),_0x4faa78,_0x895d('0xf'));_0x5c982c(_0x59f8b6['result'][_0x895d('0x14')]);}})[_0x895d('0x16')](function(_0x466ff0){logger[_0x895d('0x12')](_0x895d('0xe'),_0x4faa78,_0x466ff0);_0x441e37(_0x466ff0);});});}exports['GetCmHopperBlack']=function(_0x5471c7){var _0x2ac568=this;return new Promise(function(_0x5f49f0,_0x539252){return db[_0x895d('0x17')][_0x895d('0x18')]({'raw':_0x5471c7['options']?_0x5471c7[_0x895d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5471c7[_0x895d('0x19')]?_0x5471c7['options'][_0x895d('0x1a')]||null:null,'attributes':_0x5471c7[_0x895d('0x19')]?_0x5471c7[_0x895d('0x19')][_0x895d('0x1b')]||null:null,'limit':_0x5471c7[_0x895d('0x19')]?_0x5471c7['options'][_0x895d('0x1c')]||null:null,'include':_0x5471c7[_0x895d('0x19')]?_0x5471c7['options'][_0x895d('0x1d')]?_[_0x895d('0x1e')](_0x5471c7[_0x895d('0x19')][_0x895d('0x1d')],function(_0x37b3ec){return{'model':db[_0x37b3ec['model']],'as':_0x37b3ec['as'],'attributes':_0x37b3ec[_0x895d('0x1b')],'include':_0x37b3ec[_0x895d('0x1d')]?_[_0x895d('0x1e')](_0x37b3ec[_0x895d('0x1d')],function(_0x292858){return{'model':db[_0x292858[_0x895d('0x1f')]],'as':_0x292858['as'],'attributes':_0x292858[_0x895d('0x1b')],'include':_0x292858[_0x895d('0x1d')]?_['map'](_0x292858[_0x895d('0x1d')],function(_0x5e119f){return{'model':db[_0x5e119f[_0x895d('0x1f')]],'as':_0x5e119f['as'],'attributes':_0x5e119f[_0x895d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x895d('0xd')](function(_0x81ba85){logger[_0x895d('0x15')](_0x895d('0x20'),_0x5471c7);logger[_0x895d('0x21')](_0x895d('0x20'),_0x5471c7,JSON[_0x895d('0x11')](_0x81ba85));_0x5f49f0(_0x81ba85);})['catch'](function(_0x213be4){logger[_0x895d('0x12')](_0x895d('0x20'),_0x213be4[_0x895d('0x14')],_0x5471c7);_0x539252(_0x2ac568[_0x895d('0x12')](0x1f4,_0x213be4[_0x895d('0x14')]));});});};exports[_0x895d('0x22')]=function(_0x35fd0d){var _0x4d3ab4=this;return new Promise(function(_0x395e46,_0x890afc){return db['CmHopperBlack'][_0x895d('0x23')](_0x35fd0d[_0x895d('0x24')],{'raw':_0x35fd0d[_0x895d('0x19')]?_0x35fd0d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35fd0d[_0x895d('0x19')]?_0x35fd0d[_0x895d('0x19')]['where']||null:null,'attributes':_0x35fd0d['options']?_0x35fd0d[_0x895d('0x19')]['attributes']||null:null,'limit':_0x35fd0d['options']?_0x35fd0d[_0x895d('0x19')][_0x895d('0x1c')]||null:null})[_0x895d('0xd')](function(_0x2c1d9b){logger['info'](_0x895d('0x22'),_0x35fd0d);logger[_0x895d('0x21')](_0x895d('0x22'),_0x35fd0d,JSON[_0x895d('0x11')](_0x2c1d9b));_0x395e46(_0x2c1d9b);})[_0x895d('0x16')](function(_0x535e9d){logger[_0x895d('0x12')](_0x895d('0x22'),_0x535e9d[_0x895d('0x14')],_0x35fd0d);_0x890afc(_0x4d3ab4[_0x895d('0x12')](0x1f4,_0x535e9d[_0x895d('0x14')]));});});};exports[_0x895d('0x25')]=function(_0x1413c1){var _0xaa24a3=this;return new Promise(function(_0x11f490,_0x10b6dc){return db[_0x895d('0x17')][_0x895d('0x26')]({'where':_0x1413c1[_0x895d('0x19')]?_0x1413c1[_0x895d('0x19')][_0x895d('0x1a')]||null:null})['then'](function(_0x2ef8c4){logger[_0x895d('0x15')](_0x895d('0x25'),_0x1413c1);logger[_0x895d('0x21')](_0x895d('0x25'),_0x1413c1,JSON['stringify'](_0x2ef8c4));_0x11f490(_0x2ef8c4);})[_0x895d('0x16')](function(_0x259405){logger[_0x895d('0x12')](_0x895d('0x25'),_0x259405[_0x895d('0x14')],_0x1413c1);_0x10b6dc(_0xaa24a3[_0x895d('0x12')](0x1f4,_0x259405['message']));});});}; \ No newline at end of file +var _0x290c=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','debug','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','then'];(function(_0x3f70b2,_0x573060){var _0x5a10fb=function(_0x11ec79){while(--_0x11ec79){_0x3f70b2['push'](_0x3f70b2['shift']());}};_0x5a10fb(++_0x573060);}(_0x290c,0x7e));var _0xc290=function(_0xb63d67,_0x574a19){_0xb63d67=_0xb63d67-0x0;var _0x4f64dc=_0x290c[_0xb63d67];return _0x4f64dc;};'use strict';var _=require('lodash');var util=require(_0xc290('0x0'));var moment=require(_0xc290('0x1'));var BPromise=require(_0xc290('0x2'));var rs=require(_0xc290('0x3'));var fs=require('fs');var Redis=require(_0xc290('0x4'));var db=require(_0xc290('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc290('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc290('0x7')][_0xc290('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe7c908,_0x2c95e2,_0x5c3a9c){return new BPromise(function(_0x50db98,_0x583b46){return client['request'](_0xe7c908,_0x5c3a9c)[_0xc290('0x9')](function(_0x47dfeb){logger[_0xc290('0xa')](_0xc290('0xb'),_0x2c95e2,_0xc290('0xc'));logger['debug'](_0xc290('0xd'),_0x2c95e2,_0xc290('0xc'),JSON[_0xc290('0xe')](_0x47dfeb));if(_0x47dfeb[_0xc290('0xf')]){if(_0x47dfeb[_0xc290('0xf')][_0xc290('0x10')]===0x1f4){logger['error'](_0xc290('0xb'),_0x2c95e2,_0x47dfeb[_0xc290('0xf')][_0xc290('0x11')]);return _0x583b46(_0x47dfeb[_0xc290('0xf')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2c95e2,_0x47dfeb['error']['message']);return _0x50db98(_0x47dfeb['error'][_0xc290('0x11')]);}else{logger[_0xc290('0xa')](_0xc290('0xb'),_0x2c95e2,_0xc290('0xc'));_0x50db98(_0x47dfeb['result'][_0xc290('0x11')]);}})['catch'](function(_0x3063c2){logger[_0xc290('0xf')](_0xc290('0xb'),_0x2c95e2,_0x3063c2);_0x583b46(_0x3063c2);});});}exports['GetCmHopperBlack']=function(_0x1efd28){var _0x4d5f0d=this;return new Promise(function(_0x497534,_0x74e96c){return db[_0xc290('0x12')][_0xc290('0x13')]({'raw':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x15')]===undefined?!![]:![]:!![],'where':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x16')]||null:null,'attributes':_0x1efd28[_0xc290('0x14')]?_0x1efd28[_0xc290('0x14')][_0xc290('0x17')]||null:null,'limit':_0x1efd28['options']?_0x1efd28[_0xc290('0x14')][_0xc290('0x18')]||null:null,'include':_0x1efd28['options']?_0x1efd28[_0xc290('0x14')][_0xc290('0x19')]?_[_0xc290('0x1a')](_0x1efd28[_0xc290('0x14')][_0xc290('0x19')],function(_0x410079){return{'model':db[_0x410079['model']],'as':_0x410079['as'],'attributes':_0x410079['attributes'],'include':_0x410079[_0xc290('0x19')]?_[_0xc290('0x1a')](_0x410079['include'],function(_0xd33045){return{'model':db[_0xd33045['model']],'as':_0xd33045['as'],'attributes':_0xd33045['attributes'],'include':_0xd33045[_0xc290('0x19')]?_['map'](_0xd33045[_0xc290('0x19')],function(_0x4c5620){return{'model':db[_0x4c5620['model']],'as':_0x4c5620['as'],'attributes':_0x4c5620[_0xc290('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc290('0x9')](function(_0x7b63e2){logger[_0xc290('0xa')]('GetCmHopperBlack',_0x1efd28);logger[_0xc290('0x1b')](_0xc290('0x1c'),_0x1efd28,JSON[_0xc290('0xe')](_0x7b63e2));_0x497534(_0x7b63e2);})['catch'](function(_0x2c815a){logger['error'](_0xc290('0x1c'),_0x2c815a[_0xc290('0x11')],_0x1efd28);_0x74e96c(_0x4d5f0d[_0xc290('0xf')](0x1f4,_0x2c815a[_0xc290('0x11')]));});});};exports[_0xc290('0x1d')]=function(_0x56bbac){var _0x1ff048=this;return new Promise(function(_0x276abb,_0x36d840){return db['CmHopperBlack'][_0xc290('0x1e')](_0x56bbac[_0xc290('0x1f')],{'raw':_0x56bbac['options']?_0x56bbac[_0xc290('0x14')][_0xc290('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options'][_0xc290('0x16')]||null:null,'attributes':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options']['attributes']||null:null,'limit':_0x56bbac[_0xc290('0x14')]?_0x56bbac['options']['limit']||null:null})[_0xc290('0x9')](function(_0x4d9947){logger[_0xc290('0xa')]('UpdateCmHopperBlack',_0x56bbac);logger[_0xc290('0x1b')](_0xc290('0x1d'),_0x56bbac,JSON[_0xc290('0xe')](_0x4d9947));_0x276abb(_0x4d9947);})['catch'](function(_0x16744d){logger[_0xc290('0xf')]('UpdateCmHopperBlack',_0x16744d[_0xc290('0x11')],_0x56bbac);_0x36d840(_0x1ff048[_0xc290('0xf')](0x1f4,_0x16744d['message']));});});};exports[_0xc290('0x20')]=function(_0x384a63){var _0x432eea=this;return new Promise(function(_0x34a2c2,_0x48a11e){return db[_0xc290('0x12')]['destroy']({'where':_0x384a63['options']?_0x384a63[_0xc290('0x14')][_0xc290('0x16')]||null:null})[_0xc290('0x9')](function(_0xc65a97){logger[_0xc290('0xa')](_0xc290('0x20'),_0x384a63);logger[_0xc290('0x1b')](_0xc290('0x20'),_0x384a63,JSON['stringify'](_0xc65a97));_0x34a2c2(_0xc65a97);})[_0xc290('0x21')](function(_0x2ee7a8){logger[_0xc290('0xf')]('DestroyCmHopperBlack',_0x2ee7a8[_0xc290('0x11')],_0x384a63);_0x48a11e(_0x432eea['error'](0x1f4,_0x2ee7a8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bc61ae8..f97dfc6 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 _0x5430=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','util'];(function(_0x4d3142,_0x30c83d){var _0x4b68fa=function(_0x3a4824){while(--_0x3a4824){_0x4d3142['push'](_0x4d3142['shift']());}};_0x4b68fa(++_0x30c83d);}(_0x5430,0x10c));var _0x0543=function(_0x14392a,_0x390624){_0x14392a=_0x14392a-0x0;var _0x2d8711=_0x5430[_0x14392a];return _0x2d8711;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0xf')]);router['delete'](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);module[_0x0543('0x11')]=router; \ No newline at end of file +var _0x11e5=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','put'];(function(_0x2712cb,_0x5ea1ac){var _0x7b6f47=function(_0x2d36d8){while(--_0x2d36d8){_0x2712cb['push'](_0x2712cb['shift']());}};_0x7b6f47(++_0x5ea1ac);}(_0x11e5,0x8b));var _0x511e=function(_0x52a58c,_0x102224){_0x52a58c=_0x52a58c-0x0;var _0x3e826a=_0x11e5[_0x52a58c];return _0x3e826a;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0xb'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);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 a4f93af..957755e 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 _0x3d41=['seconds','BOOLEAN','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','diff'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3d41,0xe9));var _0x13d4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3d41[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x13d4('0x0'));module[_0x13d4('0x1')]={'state':{'type':Sequelize[_0x13d4('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x13d4('0x3')]},'countbusyretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x13d4('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x13d4('0x4')]},'originatecalleridname':{'type':Sequelize[_0x13d4('0x4')]},'calleridnum':{'type':Sequelize[_0x13d4('0x4')]},'calleridname':{'type':Sequelize[_0x13d4('0x4')]},'starttime':{'type':Sequelize[_0x13d4('0x3')]},'responsetime':{'type':Sequelize[_0x13d4('0x3')]},'answertime':{'type':Sequelize[_0x13d4('0x3')]},'droptime':{'type':Sequelize[_0x13d4('0x3')]},'endtime':{'type':Sequelize[_0x13d4('0x3')]},'ringtime':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x13d4('0x4')]},'campaign':{'type':Sequelize[_0x13d4('0x4')]},'campaigntype':{'type':Sequelize[_0x13d4('0x4')]},'membername':{'type':Sequelize[_0x13d4('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x13d4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x13d4('0x4')]},'dispositionat':{'type':Sequelize[_0x13d4('0x3')],'set':function(_0x91055d){var _0x3e113f=this[_0x13d4('0x5')](_0x13d4('0x6'));if(_0x3e113f&&_0x91055d){this[_0x13d4('0x7')]('followuptime',moment(_0x91055d)[_0x13d4('0x8')](moment(_0x3e113f),_0x13d4('0x9')));}}},'amd':{'type':Sequelize[_0x13d4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x13d4('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x13d4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x13d4('0x3')]},'callback':{'type':Sequelize[_0x13d4('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x13d4('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x13d4('0x3')]},'recallme':{'type':Sequelize[_0x13d4('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x13d4('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x13d4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc885=['getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xc885,0x1d4));var _0x5c88=function(_0x231562,_0xab9705){_0x231562=_0x231562-0x0;var _0x3df715=_0xc885[_0x231562];return _0x3df715;};'use strict';var Sequelize=require(_0x5c88('0x0'));var moment=require('moment');module[_0x5c88('0x1')]={'state':{'type':Sequelize[_0x5c88('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5c88('0x3')]},'scheduledat':{'type':Sequelize[_0x5c88('0x4')]},'countbusyretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5c88('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5c88('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5c88('0x3')]},'calleridnum':{'type':Sequelize[_0x5c88('0x3')]},'calleridname':{'type':Sequelize[_0x5c88('0x3')]},'starttime':{'type':Sequelize[_0x5c88('0x4')]},'responsetime':{'type':Sequelize[_0x5c88('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5c88('0x4')]},'endtime':{'type':Sequelize[_0x5c88('0x4')]},'ringtime':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5c88('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5c88('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x5c88('0x3')]},'disposition':{'type':Sequelize[_0x5c88('0x3')]},'secondDisposition':{'type':Sequelize[_0x5c88('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5c88('0x3')]},'dispositionat':{'type':Sequelize[_0x5c88('0x4')],'set':function(_0x6a6e88){var _0x1408cb=this[_0x5c88('0x5')](_0x5c88('0x6'));if(_0x1408cb&&_0x6a6e88){this[_0x5c88('0x7')]('followuptime',moment(_0x6a6e88)[_0x5c88('0x8')](moment(_0x1408cb),_0x5c88('0x9')));}}},'amd':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5c88('0x4')]},'callback':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5c88('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5c88('0x4')]},'deleted':{'type':Sequelize[_0x5c88('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5c88('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5c88('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 7e1e576..c273f60 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 _0x1967=['sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperFinal','includeAll','include','findAll','rows','show','params','fields','options','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','state','calleridnum','group','checkContactHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x35a6fe,_0x312c7f){var _0x21da45=function(_0x34cfc5){while(--_0x34cfc5){_0x35a6fe['push'](_0x35a6fe['shift']());}};_0x21da45(++_0x312c7f);}(_0x1967,0x173));var _0x7196=function(_0x4116cd,_0x4c7db0){_0x4116cd=_0x4116cd-0x0;var _0x1e441a=_0x1967[_0x4116cd];return _0x1e441a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['CmHopperFinal'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['describe']=function(_0x29c7e8,_0x582884){return db['CmHopperFinal'][_0x7196('0x49')]()['then'](respondWithResult(_0x582884,null))['catch'](handleError(_0x582884,null));};exports['update']=function(_0x2299e2,_0x5052ee){if(_0x2299e2['body'][_0x7196('0x4a')]){delete _0x2299e2[_0x7196('0x4b')][_0x7196('0x4a')];}return db[_0x7196('0x3e')]['find']({'where':{'uniqueid':_0x2299e2[_0x7196('0x44')]['id']}})['then'](handleEntityNotFound(_0x5052ee,null))[_0x7196('0x27')](saveUpdates(_0x2299e2[_0x7196('0x4b')],null))['then'](respondWithResult(_0x5052ee,null))[_0x7196('0x48')](handleError(_0x5052ee,null));};exports[_0x7196('0x4c')]=function(_0x3fe092,_0x4fa18f,_0x317ab6){return db['CmHopperFinal'][_0x7196('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x3fe092[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),_0x7196('0x51')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x52')))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x54')))),_0x7196('0x55')],[db['sequelize']['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7196('0x58')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),'reCallContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7196('0x27')](handleEntityNotFound(_0x4fa18f,null))[_0x7196('0x27')](respondWithResult(_0x4fa18f,null))[_0x7196('0x48')](handleError(_0x4fa18f,null));};exports[_0x7196('0x5a')]=function(_0x14cb38,_0x43b9ac,_0xe3fb61){return db[_0x7196('0x3e')][_0x7196('0x41')]({'raw':![],'where':{'CampaignId':_0x14cb38[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5b')))),_0x7196('0x51')],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x54')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),_0x7196('0x5d')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x7196('0x5e')]]})['then'](handleEntityNotFound(_0x43b9ac,null))[_0x7196('0x27')](respondWithResult(_0x43b9ac,null))[_0x7196('0x48')](handleError(_0x43b9ac,null));};exports[_0x7196('0x5f')]=function(_0x267903,_0x5ab6ae,_0x5a786a){return db[_0x7196('0x60')]['find']({'where':{'id':_0x267903[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x5ab6ae,null))[_0x7196('0x27')](function(_0x38c1b3){var _0xd4c784;if(_0x38c1b3){_0xd4c784=squel[_0x7196('0x61')]()['into'](_0x7196('0x62'))[_0x7196('0x63')]([_0x7196('0x64'),_0x7196('0x65'),_0x7196('0x66'),_0x7196('0x67'),_0x7196('0x68'),_0x7196('0x69'),_0x7196('0x6a')],squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x6d'),'phone')[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')['field'](_0x7196('0x6f'),_0x7196('0x66'))[_0x7196('0x6c')]('ANY_VALUE(ListId)',_0x7196('0x67'))['field'](_0x7196('0x70'),_0x7196('0x68'))['field'](_0x7196('0x6e'),'createdAt')['field'](_0x7196('0x6e'),_0x7196('0x6a'))[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')]('VoiceQueueId\x20=\x20?',_0x267903[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x73'),_0x267903[_0x7196('0x4b')]['state'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x74'))[_0x7196('0x3a')](_0x7196('0x75'),squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x64'))['from'](_0x7196('0x62'))[_0x7196('0x3a')](_0x7196('0x76'),_0x267903[_0x7196('0x44')]['id']['toString']()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')]('calleridnum')[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')](_0x7196('0x76'),_0x267903['params']['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x77')))['group']('ContactId'))[_0x7196('0x72')]();return db['sequelize']['query'](_0xd4c784);}return[];})[_0x7196('0x27')](respondWithResult(_0x5ab6ae,null))[_0x7196('0x48')](handleError(_0x5ab6ae,null));};exports[_0x7196('0x78')]=function(_0x509c4a,_0x35c5b3,_0x59370b){return db[_0x7196('0x79')][_0x7196('0x47')]({'where':{'id':_0x509c4a[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x35c5b3,null))[_0x7196('0x27')](function(_0x8673e){var _0x32ba47;if(_0x8673e){_0x32ba47=squel[_0x7196('0x61')]()[_0x7196('0x7a')]('cm_hopper')['fromQuery']([_0x7196('0x64'),'scheduledAt','ContactId',_0x7196('0x67'),_0x7196('0x7b'),_0x7196('0x69'),_0x7196('0x6a')],squel['select']()['field'](_0x7196('0x6d'),_0x7196('0x64'))[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')[_0x7196('0x6c')]('ANY_VALUE(ContactId)','ContactId')[_0x7196('0x6c')](_0x7196('0x7c'),_0x7196('0x67'))['field'](_0x7196('0x7d'),_0x7196('0x7b'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x69'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x6a'))['from'](_0x7196('0x7e'))[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())['where'](_0x7196('0x73'),_0x509c4a[_0x7196('0x4b')][_0x7196('0x80')]['toString']())[_0x7196('0x3a')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7196('0x75'),squel[_0x7196('0x6b')]()['field'](_0x7196('0x64'))[_0x7196('0x71')]('cm_hopper')[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')](_0x7196('0x81'))[_0x7196('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')]('state\x20=\x204'))[_0x7196('0x82')]('ContactId'))[_0x7196('0x72')]();return db['sequelize'][_0x7196('0x31')](_0x32ba47);}return[];})[_0x7196('0x27')](respondWithResult(_0x35c5b3,null))[_0x7196('0x48')](handleError(_0x35c5b3,null));};exports[_0x7196('0x83')]=function(_0x37290e,_0x10b628,_0x43e7d5){return db['CmHopper'][_0x7196('0x84')]({'where':{'VoiceQueueId':_0x37290e['body']['VoiceQueueId'],'CampaignId':_0x37290e['body']['CampaignId'],'ContactId':_0x37290e['body'][_0x7196('0x66')]}})[_0x7196('0x27')](handleEntityNotFound(_0x10b628,null))[_0x7196('0x27')](function(_0x5bab25){if(_0x5bab25){return _0x5bab25;}return null;})[_0x7196('0x27')](respondWithResult(_0x10b628,null))['catch'](handleError(_0x10b628,null));}; \ No newline at end of file +var _0x524e=['destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','then','includeAll','include','findAll','rows','catch','show','length','find','describe','body','uniqueid','params','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','group','Campaign','ContactId','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x524e,0x15e));var _0xe524=function(_0x115c2f,_0x5c15cc){_0x115c2f=_0x115c2f-0x0;var _0x1990ed=_0x524e[_0x115c2f];return _0x1990ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['CmHopperFinal'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['describe']()[_0xe524('0x3f')](respondWithResult(_0x33b1c8,null))['catch'](handleError(_0x33b1c8,null));};exports['update']=function(_0x24f313,_0x59fe6b){if(_0x24f313[_0xe524('0x49')][_0xe524('0x4a')]){delete _0x24f313['body'][_0xe524('0x4a')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x24f313[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x59fe6b,null))[_0xe524('0x3f')](saveUpdates(_0x24f313['body'],null))['then'](respondWithResult(_0x59fe6b,null))['catch'](handleError(_0x59fe6b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x4f7a64,_0x5477ca,_0x45f504){return db[_0xe524('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4f7a64[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x4e')))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x51')))),_0xe524('0x52')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),_0xe524('0x54')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x59')))),'reCallContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe524('0x3f')](handleEntityNotFound(_0x5477ca,null))['then'](respondWithResult(_0x5477ca,null))[_0xe524('0x44')](handleError(_0x5477ca,null));};exports[_0xe524('0x5a')]=function(_0x3f4201,_0x287ab8,_0x2b2a0e){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x3f4201[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),'busyContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x5b')))),_0xe524('0x5c')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x59')))),_0xe524('0x5d')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x5e')))),_0xe524('0x5f')]]})[_0xe524('0x3f')](handleEntityNotFound(_0x287ab8,null))['then'](respondWithResult(_0x287ab8,null))[_0xe524('0x44')](handleError(_0x287ab8,null));};exports[_0xe524('0x60')]=function(_0x43d125,_0x13905f,_0x4514d4){return db['VoiceQueue'][_0xe524('0x47')]({'where':{'id':_0x43d125[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x13905f,null))[_0xe524('0x3f')](function(_0x109da1){var _0x57b6bb;if(_0x109da1){_0x57b6bb=squel[_0xe524('0x61')]()[_0xe524('0x62')](_0xe524('0x63'))[_0xe524('0x64')]([_0xe524('0x65'),_0xe524('0x66'),'ContactId',_0xe524('0x67'),_0xe524('0x68'),_0xe524('0x69'),'updatedAt'],squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('ANY_VALUE(calleridnum)',_0xe524('0x65'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))[_0xe524('0x6b')](_0xe524('0x6d'),'ContactId')[_0xe524('0x6b')](_0xe524('0x6e'),_0xe524('0x67'))[_0xe524('0x6b')](_0xe524('0x6f'),_0xe524('0x68'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x69'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x70'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x20?',_0x43d125[_0xe524('0x49')][_0xe524('0x74')]['toString']())['where'](_0xe524('0x75'))['where'](_0xe524('0x76'),squel['select']()[_0xe524('0x6b')](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where'](_0xe524('0x76'),squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('calleridnum')[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')](_0xe524('0x77'),_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())['where']('state\x20=\x204'))[_0xe524('0x78')]('ContactId'))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0x57b6bb);}return[];})['then'](respondWithResult(_0x13905f,null))[_0xe524('0x44')](handleError(_0x13905f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1681c5,_0x41e693,_0xfc62e5){return db[_0xe524('0x79')][_0xe524('0x47')]({'where':{'id':_0x1681c5[_0xe524('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41e693,null))[_0xe524('0x3f')](function(_0x35d0f4){var _0xa8334;if(_0x35d0f4){_0xa8334=squel['insert']()[_0xe524('0x62')](_0xe524('0x63'))['fromQuery']([_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x7a'),_0xe524('0x67'),'CampaignId',_0xe524('0x69'),_0xe524('0x70')],squel[_0xe524('0x6a')]()['field'](_0xe524('0x7b'),'phone')[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))['field'](_0xe524('0x6d'),_0xe524('0x7a'))[_0xe524('0x6b')]('ANY_VALUE(ListId)','ListId')[_0xe524('0x6b')]('ANY_VALUE(CampaignId)',_0xe524('0x7c'))['field'](_0xe524('0x6c'),_0xe524('0x69'))['field'](_0xe524('0x6c'),_0xe524('0x70'))['from']('cm_hopper_final')[_0xe524('0x38')](_0xe524('0x7d'),_0x1681c5[_0xe524('0x4b')]['id']['toString']())[_0xe524('0x38')](_0xe524('0x7e'),_0x1681c5[_0xe524('0x49')][_0xe524('0x74')][_0xe524('0x73')]())[_0xe524('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe524('0x38')](_0xe524('0x76'),squel['select']()['field'](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe524('0x6a')]()[_0xe524('0x6b')](_0xe524('0x7f'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5['params']['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x204'))['group'](_0xe524('0x7a')))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0xa8334);}return[];})[_0xe524('0x3f')](respondWithResult(_0x41e693,null))[_0xe524('0x44')](handleError(_0x41e693,null));};exports['checkContactHopper']=function(_0x555801,_0x3e8668,_0x390093){return db[_0xe524('0x80')][_0xe524('0x81')]({'where':{'VoiceQueueId':_0x555801[_0xe524('0x49')][_0xe524('0x68')],'CampaignId':_0x555801[_0xe524('0x49')][_0xe524('0x7c')],'ContactId':_0x555801['body'][_0xe524('0x7a')]}})[_0xe524('0x3f')](handleEntityNotFound(_0x3e8668,null))[_0xe524('0x3f')](function(_0x5242b7){if(_0x5242b7){return _0x5242b7;}return null;})['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x44')](handleError(_0x3e8668,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b34c799..6bea38f 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 _0xb77d=['../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x293a6,_0x35ed4b){var _0x5dad9c=function(_0x4bab16){while(--_0x4bab16){_0x293a6['push'](_0x293a6['shift']());}};_0x5dad9c(++_0x35ed4b);}(_0xb77d,0xe0));var _0xdb77=function(_0x4070c7,_0xdc0dea){_0x4070c7=_0x4070c7-0x0;var _0x56bf2d=_0xb77d[_0x4070c7];return _0x56bf2d;};'use strict';var _=require('lodash');var util=require(_0xdb77('0x0'));var logger=require(_0xdb77('0x1'))('api');var moment=require(_0xdb77('0x2'));var BPromise=require(_0xdb77('0x3'));var rp=require(_0xdb77('0x4'));var fs=require('fs');var path=require(_0xdb77('0x5'));var rimraf=require('rimraf');var config=require(_0xdb77('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x48be3b,_0x3351c3){return _0x48be3b['define'](_0xdb77('0x7'),attributes,{'tableName':_0xdb77('0x8'),'paranoid':![],'indexes':[{'name':_0xdb77('0x9'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x288d=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x288d,0x105));var _0xd288=function(_0x1cdb11,_0x102d5c){_0x1cdb11=_0x1cdb11-0x0;var _0x4acaef=_0x288d[_0x1cdb11];return _0x4acaef;};'use strict';var _=require(_0xd288('0x0'));var util=require(_0xd288('0x1'));var logger=require(_0xd288('0x2'))(_0xd288('0x3'));var moment=require(_0xd288('0x4'));var BPromise=require(_0xd288('0x5'));var rp=require(_0xd288('0x6'));var fs=require('fs');var path=require(_0xd288('0x7'));var rimraf=require(_0xd288('0x8'));var config=require(_0xd288('0x9'));var attributes=require(_0xd288('0xa'));module[_0xd288('0xb')]=function(_0x484104,_0x47d17f){return _0x484104['define'](_0xd288('0xc'),attributes,{'tableName':_0xd288('0xd'),'paranoid':![],'indexes':[{'name':_0xd288('0xe'),'fields':[_0xd288('0xe')]},{'name':_0xd288('0xf'),'fields':[_0xd288('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2cae923..a703f7b 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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5513e7,_0x544dce){var _0x408976=function(_0x1a41ff){while(--_0x1a41ff){_0x5513e7['push'](_0x5513e7['shift']());}};_0x408976(++_0x544dce);}(_0x7a54,0x106));var _0x47a5=function(_0x39f225,_0x2cc9b9){_0x39f225=_0x39f225-0x0;var _0x19a9f5=_0x7a54[_0x39f225];return _0x19a9f5;};'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')]('CmHopperFinal,\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);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1c2eaf,_0x34a30a){var _0x492f3c=function(_0x580a51){while(--_0x580a51){_0x1c2eaf['push'](_0x1c2eaf['shift']());}};_0x492f3c(++_0x34a30a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0xb10b[_0x1f2941];return _0x31e313;};'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?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e45736e..66cd9d4 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 _0x7c5a=['describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','update','exports','util','path','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x7c5a,0x184));var _0xa7c5=function(_0x4d8284,_0x74bc9a){_0x4d8284=_0x4d8284-0x0;var _0x33e9df=_0x7c5a[_0x4d8284];return _0x33e9df;};'use strict';var multer=require('multer');var util=require(_0xa7c5('0x0'));var path=require(_0xa7c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7c5('0x2'));var interaction=require(_0xa7c5('0x3'));var config=require('../../config/environment');var controller=require(_0xa7c5('0x4'));router['get']('/',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x6')]);router[_0xa7c5('0x7')]('/describe',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x8')]);router[_0xa7c5('0x7')](_0xa7c5('0x9'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xa')]);router[_0xa7c5('0x7')](_0xa7c5('0xb'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xa7c5('0xc'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xd')]);router[_0xa7c5('0xe')](_0xa7c5('0xf'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x10')]);router['post'](_0xa7c5('0x11'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x12')]);router['post']('/checkContactHopper',auth[_0xa7c5('0x5')](),controller['checkContactHopper']);router[_0xa7c5('0x13')](_0xa7c5('0x9'),auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x14')]);module[_0xa7c5('0x15')]=router; \ No newline at end of file +var _0x47cb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports'];(function(_0x2c0b01,_0x3aaa36){var _0x1a3668=function(_0x3a64d1){while(--_0x3a64d1){_0x2c0b01['push'](_0x2c0b01['shift']());}};_0x1a3668(++_0x3aaa36);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var path=require(_0xb47c('0x2'));var timeout=require(_0xb47c('0x3'));var express=require(_0xb47c('0x4'));var router=express[_0xb47c('0x5')]();var fs_extra=require(_0xb47c('0x6'));var auth=require(_0xb47c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb47c('0x8'));var controller=require(_0xb47c('0x9'));router[_0xb47c('0xa')]('/',auth[_0xb47c('0xb')](),controller[_0xb47c('0xc')]);router[_0xb47c('0xa')](_0xb47c('0xd'),auth[_0xb47c('0xb')](),controller[_0xb47c('0xe')]);router[_0xb47c('0xa')](_0xb47c('0xf'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x10')]);router[_0xb47c('0xa')](_0xb47c('0x11'),auth['isAuthenticated'](),controller[_0xb47c('0x12')]);router[_0xb47c('0xa')](_0xb47c('0x13'),auth['isAuthenticated'](),controller[_0xb47c('0x14')]);router[_0xb47c('0x15')]('/voice/queue/moveContacts/:id',auth[_0xb47c('0xb')](),controller[_0xb47c('0x16')]);router[_0xb47c('0x15')]('/voice/campaign/moveContacts/:id',auth[_0xb47c('0xb')](),controller[_0xb47c('0x17')]);router[_0xb47c('0x15')](_0xb47c('0x18'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x19')]);router[_0xb47c('0x1a')](_0xb47c('0xf'),auth[_0xb47c('0xb')](),controller[_0xb47c('0x1b')]);module[_0xb47c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c111fae..a0907ec 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 _0x65b6=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x65b6,0x101));var _0x665b=function(_0x492269,_0x1a50a9){_0x492269=_0x492269-0x0;var _0x134a8c=_0x65b6[_0x492269];return _0x134a8c;};'use strict';var Sequelize=require(_0x665b('0x0'));module[_0x665b('0x1')]={'state':{'type':Sequelize[_0x665b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x665b('0x3')]},'scheduledat':{'type':Sequelize[_0x665b('0x4')]},'countbusyretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x665b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x665b('0x3')]},'originatecalleridname':{'type':Sequelize[_0x665b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x665b('0x3')]},'starttime':{'type':Sequelize[_0x665b('0x4')]},'responsetime':{'type':Sequelize[_0x665b('0x4')]},'answertime':{'type':Sequelize[_0x665b('0x4')]},'droptime':{'type':Sequelize[_0x665b('0x4')]},'endtime':{'type':Sequelize[_0x665b('0x4')]},'ringtime':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x665b('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x665b('0x3')]},'membername':{'type':Sequelize[_0x665b('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x665b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x665b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x665b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x665b('0x4')]},'recallme':{'type':Sequelize[_0x665b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x665b('0x4')]},'edited':{'type':Sequelize[_0x665b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x665b('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb098=['STRING','BOOLEAN','sequelize','exports','DATE','INTEGER'];(function(_0x3950d9,_0x46980c){var _0x52171b=function(_0x576f38){while(--_0x576f38){_0x3950d9['push'](_0x3950d9['shift']());}};_0x52171b(++_0x46980c);}(_0xb098,0x1c4));var _0x8b09=function(_0x46b64d,_0x2a0223){_0x46b64d=_0x46b64d-0x0;var _0x19222e=_0xb098[_0x46b64d];return _0x19222e;};'use strict';var Sequelize=require(_0x8b09('0x0'));module[_0x8b09('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8b09('0x2')]},'countbusyretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8b09('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8b09('0x4')]},'calleridnum':{'type':Sequelize[_0x8b09('0x4')]},'calleridname':{'type':Sequelize[_0x8b09('0x4')]},'starttime':{'type':Sequelize[_0x8b09('0x2')]},'responsetime':{'type':Sequelize[_0x8b09('0x2')]},'answertime':{'type':Sequelize[_0x8b09('0x2')]},'droptime':{'type':Sequelize[_0x8b09('0x2')]},'endtime':{'type':Sequelize[_0x8b09('0x2')]},'ringtime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8b09('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8b09('0x4')]},'membername':{'type':Sequelize[_0x8b09('0x4')]},'reason':{'type':Sequelize[_0x8b09('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8b09('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8b09('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8b09('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8b09('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f909232..e48f53f 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 _0x1a8d=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','CmHopperHistory','includeAll','include','findAll','catch','show','keys','create','body','describe','uniqueid','params','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x1a8d,0x117));var _0xd1a8=function(_0x297f80,_0x30947d){_0x297f80=_0x297f80-0x0;var _0xa65049=_0x1a8d[_0x297f80];return _0xa65049;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd1a8('0x0'));var jsonpatch=require(_0xd1a8('0x1'));var rp=require('request-promise');var moment=require(_0xd1a8('0x2'));var BPromise=require(_0xd1a8('0x3'));var Mustache=require(_0xd1a8('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd1a8('0x5'));var csv=require(_0xd1a8('0x6'));var ejs=require(_0xd1a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1a8('0x8'));var squel=require(_0xd1a8('0x9'));var crypto=require(_0xd1a8('0xa'));var jsforce=require(_0xd1a8('0xb'));var deskjs=require(_0xd1a8('0xc'));var toCsv=require(_0xd1a8('0x6'));var querystring=require(_0xd1a8('0xd'));var Papa=require(_0xd1a8('0xe'));var Redis=require(_0xd1a8('0xf'));var authService=require(_0xd1a8('0x10'));var qs=require(_0xd1a8('0x11'));var as=require(_0xd1a8('0x12'));var hardwareService=require(_0xd1a8('0x13'));var logger=require(_0xd1a8('0x14'))('api');var utils=require(_0xd1a8('0x15'));var config=require(_0xd1a8('0x16'));var licenseUtil=require(_0xd1a8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349282,_0x2b776e){_0x2b776e=_0x2b776e||0xcc;return function(_0x5d70c8){if(_0x5d70c8){return _0x349282[_0xd1a8('0x18')](_0x2b776e);}return _0x349282[_0xd1a8('0x19')](_0x2b776e)[_0xd1a8('0x1a')]();};}function respondWithResult(_0xfbc36c,_0x6cb0d2){_0x6cb0d2=_0x6cb0d2||0xc8;return function(_0x6cbae){if(_0x6cbae){return _0xfbc36c[_0xd1a8('0x19')](_0x6cb0d2)[_0xd1a8('0x1b')](_0x6cbae);}};}function respondWithFilteredResult(_0xa20057,_0x21cbf2){return function(_0x5ddacf){if(_0x5ddacf){var _0xef023=typeof _0x21cbf2[_0xd1a8('0x1c')]===_0xd1a8('0x1d')&&typeof _0x21cbf2['limit']===_0xd1a8('0x1d');var _0x5aa890=_0x5ddacf[_0xd1a8('0x1e')];var _0xd1c113=_0xef023?0x0:_0x21cbf2['offset'];var _0x818844=_0xef023?_0x5ddacf['count']:_0x21cbf2[_0xd1a8('0x1c')]+_0x21cbf2[_0xd1a8('0x1f')];var _0x458054;if(_0x818844>=_0x5aa890){_0x818844=_0x5aa890;_0x458054=0xc8;}else{_0x458054=0xce;}_0xa20057[_0xd1a8('0x19')](_0x458054);return _0xa20057[_0xd1a8('0x20')](_0xd1a8('0x21'),_0xd1c113+'-'+_0x818844+'/'+_0x5aa890)[_0xd1a8('0x1b')](_0x5ddacf);}return null;};}function patchUpdates(_0x30ed50){return function(_0x51573b){try{jsonpatch[_0xd1a8('0x22')](_0x51573b,_0x30ed50,!![]);}catch(_0x21b167){return BPromise[_0xd1a8('0x23')](_0x21b167);}return _0x51573b[_0xd1a8('0x24')]();};}function saveUpdates(_0x54a137,_0x569127){return function(_0x467917){if(_0x467917){return _0x467917[_0xd1a8('0x25')](_0x54a137)[_0xd1a8('0x26')](function(_0x1aad8e){return _0x1aad8e;});}return null;};}function removeEntity(_0x1c3da0,_0x3ca9d6){return function(_0x37bd74){if(_0x37bd74){return _0x37bd74[_0xd1a8('0x27')]()[_0xd1a8('0x26')](function(){_0x1c3da0[_0xd1a8('0x19')](0xcc)[_0xd1a8('0x1a')]();});}};}function handleEntityNotFound(_0x4e015b,_0xf3d265){return function(_0x110544){if(!_0x110544){_0x4e015b['sendStatus'](0x194);}return _0x110544;};}function handleError(_0x5b59ae,_0x53fea6){_0x53fea6=_0x53fea6||0x1f4;return function(_0x207a6c){logger[_0xd1a8('0x28')](_0x207a6c[_0xd1a8('0x29')]);if(_0x207a6c['name']){delete _0x207a6c[_0xd1a8('0x2a')];}_0x5b59ae[_0xd1a8('0x19')](_0x53fea6)[_0xd1a8('0x2b')](_0x207a6c);};}exports[_0xd1a8('0x2c')]=function(_0x5c473b,_0x27fb7b){var _0x22fe24={},_0x5e9d92={},_0x14ec73={'count':0x0,'rows':[]};var _0xa2f2c0=_[_0xd1a8('0x2d')](db['CmHopperHistory']['rawAttributes'],function(_0x1ea64d){return{'name':_0x1ea64d['fieldName'],'type':_0x1ea64d[_0xd1a8('0x2e')]['key']};});_0x5e9d92['model']=_[_0xd1a8('0x2d')](_0xa2f2c0,'name');_0x5e9d92[_0xd1a8('0x2f')]=_['keys'](_0x5c473b[_0xd1a8('0x2f')]);_0x5e9d92[_0xd1a8('0x30')]=_[_0xd1a8('0x31')](_0x5e9d92[_0xd1a8('0x32')],_0x5e9d92[_0xd1a8('0x2f')]);_0x22fe24[_0xd1a8('0x33')]=_[_0xd1a8('0x31')](_0x5e9d92[_0xd1a8('0x32')],qs[_0xd1a8('0x34')](_0x5c473b['query'][_0xd1a8('0x34')]));_0x22fe24[_0xd1a8('0x33')]=_0x22fe24['attributes'][_0xd1a8('0x35')]?_0x22fe24['attributes']:_0x5e9d92[_0xd1a8('0x32')];if(!_0x5c473b[_0xd1a8('0x2f')][_0xd1a8('0x36')](_0xd1a8('0x37'))){_0x22fe24[_0xd1a8('0x1f')]=qs[_0xd1a8('0x1f')](_0x5c473b[_0xd1a8('0x2f')]['limit']);_0x22fe24[_0xd1a8('0x1c')]=qs[_0xd1a8('0x1c')](_0x5c473b[_0xd1a8('0x2f')][_0xd1a8('0x1c')]);}_0x22fe24[_0xd1a8('0x38')]=qs['sort'](_0x5c473b[_0xd1a8('0x2f')][_0xd1a8('0x39')]);_0x22fe24['where']=qs[_0xd1a8('0x30')](_[_0xd1a8('0x3a')](_0x5c473b[_0xd1a8('0x2f')],_0x5e9d92[_0xd1a8('0x30')]),_0xa2f2c0);if(_0x5c473b[_0xd1a8('0x2f')]['filter']){_0x22fe24[_0xd1a8('0x3b')]=_['merge'](_0x22fe24[_0xd1a8('0x3b')],{'$or':_[_0xd1a8('0x2d')](_0xa2f2c0,function(_0x4a6f38){if(_0x4a6f38[_0xd1a8('0x2e')]!==_0xd1a8('0x3c')){var _0x4d5611={};_0x4d5611[_0x4a6f38[_0xd1a8('0x2a')]]={'$like':'%'+_0x5c473b[_0xd1a8('0x2f')][_0xd1a8('0x3d')]+'%'};return _0x4d5611;}})});}_0x22fe24=_[_0xd1a8('0x3e')]({},_0x22fe24,_0x5c473b[_0xd1a8('0x3f')]);var _0x68eb1d={'where':_0x22fe24[_0xd1a8('0x3b')]};return db[_0xd1a8('0x40')][_0xd1a8('0x1e')](_0x68eb1d)[_0xd1a8('0x26')](function(_0x15bc28){_0x14ec73['count']=_0x15bc28;if(_0x5c473b[_0xd1a8('0x2f')][_0xd1a8('0x41')]){_0x22fe24[_0xd1a8('0x42')]=[{'all':!![]}];}return db[_0xd1a8('0x40')][_0xd1a8('0x43')](_0x22fe24);})[_0xd1a8('0x26')](function(_0x54ea0d){_0x14ec73['rows']=_0x54ea0d;return _0x14ec73;})[_0xd1a8('0x26')](respondWithFilteredResult(_0x27fb7b,_0x22fe24))[_0xd1a8('0x44')](handleError(_0x27fb7b,null));};exports[_0xd1a8('0x45')]=function(_0x286eec,_0x33987c){var _0x4bc38d={'raw':!![],'where':{'id':_0x286eec['params']['id']}},_0x1e72ce={};_0x1e72ce[_0xd1a8('0x32')]=_[_0xd1a8('0x46')](db[_0xd1a8('0x40')]['rawAttributes']);_0x1e72ce[_0xd1a8('0x2f')]=_[_0xd1a8('0x46')](_0x286eec[_0xd1a8('0x2f')]);_0x1e72ce[_0xd1a8('0x30')]=_[_0xd1a8('0x31')](_0x1e72ce[_0xd1a8('0x32')],_0x1e72ce['query']);_0x4bc38d['attributes']=_[_0xd1a8('0x31')](_0x1e72ce[_0xd1a8('0x32')],qs['fields'](_0x286eec[_0xd1a8('0x2f')][_0xd1a8('0x34')]));_0x4bc38d['attributes']=_0x4bc38d[_0xd1a8('0x33')][_0xd1a8('0x35')]?_0x4bc38d[_0xd1a8('0x33')]:_0x1e72ce['model'];if(_0x286eec[_0xd1a8('0x2f')][_0xd1a8('0x41')]){_0x4bc38d[_0xd1a8('0x42')]=[{'all':!![]}];}_0x4bc38d=_[_0xd1a8('0x3e')]({},_0x4bc38d,_0x286eec[_0xd1a8('0x3f')]);return db[_0xd1a8('0x40')]['find'](_0x4bc38d)[_0xd1a8('0x26')](handleEntityNotFound(_0x33987c,null))[_0xd1a8('0x26')](respondWithResult(_0x33987c,null))[_0xd1a8('0x44')](handleError(_0x33987c,null));};exports[_0xd1a8('0x47')]=function(_0x2150ec,_0x3a838e){return db['CmHopperHistory'][_0xd1a8('0x47')](_0x2150ec[_0xd1a8('0x48')],{})[_0xd1a8('0x26')](respondWithResult(_0x3a838e,0xc9))[_0xd1a8('0x44')](handleError(_0x3a838e,null));};exports[_0xd1a8('0x49')]=function(_0x5edaa7,_0x13d654){return db[_0xd1a8('0x40')]['describe']()['then'](respondWithResult(_0x13d654,null))[_0xd1a8('0x44')](handleError(_0x13d654,null));};exports[_0xd1a8('0x25')]=function(_0x359fea,_0x596e03){if(_0x359fea[_0xd1a8('0x48')][_0xd1a8('0x4a')]){delete _0x359fea[_0xd1a8('0x48')][_0xd1a8('0x4a')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x359fea[_0xd1a8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x596e03,null))[_0xd1a8('0x26')](saveUpdates(_0x359fea[_0xd1a8('0x48')],null))[_0xd1a8('0x26')](respondWithResult(_0x596e03,null))[_0xd1a8('0x44')](handleError(_0x596e03,null));}; \ No newline at end of file +var _0x025d=['nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','crypto','desk.js','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','stack','name','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length'];(function(_0x345083,_0x3c2710){var _0x9a76ee=function(_0x594a89){while(--_0x594a89){_0x345083['push'](_0x345083['shift']());}};_0x9a76ee(++_0x3c2710);}(_0x025d,0x1c4));var _0xd025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xd025('0x0'));var rimraf=require(_0xd025('0x1'));var zipdir=require(_0xd025('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd025('0x3'));var moment=require('moment');var BPromise=require(_0xd025('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd025('0x5'));var csv=require(_0xd025('0x6'));var ejs=require(_0xd025('0x7'));var fs=require('fs');var fs_extra=require(_0xd025('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd025('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd025('0xa'));var toCsv=require(_0xd025('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd025('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd025('0xc'));var utils=require(_0xd025('0xd'));var config=require(_0xd025('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e2b13,_0x5c9e21){_0x5c9e21=_0x5c9e21||0xcc;return function(_0x44b415){if(_0x44b415){return _0x4e2b13[_0xd025('0xf')](_0x5c9e21);}return _0x4e2b13[_0xd025('0x10')](_0x5c9e21)['end']();};}function respondWithResult(_0x5a3502,_0x52d526){_0x52d526=_0x52d526||0xc8;return function(_0x267a26){if(_0x267a26){return _0x5a3502[_0xd025('0x10')](_0x52d526)[_0xd025('0x11')](_0x267a26);}};}function respondWithFilteredResult(_0x39afbd,_0x4beb4d){return function(_0x22b6b7){if(_0x22b6b7){var _0x79d7c4=typeof _0x4beb4d[_0xd025('0x12')]===_0xd025('0x13')&&typeof _0x4beb4d[_0xd025('0x14')]===_0xd025('0x13');var _0x2d9e0d=_0x22b6b7[_0xd025('0x15')];var _0x272268=_0x79d7c4?0x0:_0x4beb4d[_0xd025('0x12')];var _0x261b80=_0x79d7c4?_0x22b6b7[_0xd025('0x15')]:_0x4beb4d[_0xd025('0x12')]+_0x4beb4d['limit'];var _0x2e60b8;if(_0x261b80>=_0x2d9e0d){_0x261b80=_0x2d9e0d;_0x2e60b8=0xc8;}else{_0x2e60b8=0xce;}_0x39afbd[_0xd025('0x10')](_0x2e60b8);return _0x39afbd[_0xd025('0x16')](_0xd025('0x17'),_0x272268+'-'+_0x261b80+'/'+_0x2d9e0d)[_0xd025('0x11')](_0x22b6b7);}return null;};}function patchUpdates(_0x472577){return function(_0x3b8291){try{jsonpatch[_0xd025('0x18')](_0x3b8291,_0x472577,!![]);}catch(_0x347f19){return BPromise['reject'](_0x347f19);}return _0x3b8291['save']();};}function saveUpdates(_0x22c23a,_0x105893){return function(_0x30beb7){if(_0x30beb7){return _0x30beb7[_0xd025('0x19')](_0x22c23a)[_0xd025('0x1a')](function(_0x292448){return _0x292448;});}return null;};}function removeEntity(_0x1adcac,_0x59c360){return function(_0x366aed){if(_0x366aed){return _0x366aed['destroy']()[_0xd025('0x1a')](function(){_0x1adcac[_0xd025('0x10')](0xcc)[_0xd025('0x1b')]();});}};}function handleEntityNotFound(_0x4c5fad,_0x3b351a){return function(_0x1afcb1){if(!_0x1afcb1){_0x4c5fad[_0xd025('0xf')](0x194);}return _0x1afcb1;};}function handleError(_0x141d5b,_0x941bb0){_0x941bb0=_0x941bb0||0x1f4;return function(_0x178c21){logger['error'](_0x178c21[_0xd025('0x1c')]);if(_0x178c21[_0xd025('0x1d')]){delete _0x178c21[_0xd025('0x1d')];}_0x141d5b[_0xd025('0x10')](_0x941bb0)['send'](_0x178c21);};}exports['index']=function(_0x63ff42,_0x440f38){var _0x5f0d6f={},_0x2ee356={},_0x3a4d6c={'count':0x0,'rows':[]};var _0x57780b=_['map'](db[_0xd025('0x1e')][_0xd025('0x1f')],function(_0xb84483){return{'name':_0xb84483[_0xd025('0x20')],'type':_0xb84483[_0xd025('0x21')][_0xd025('0x22')]};});_0x2ee356[_0xd025('0x23')]=_[_0xd025('0x24')](_0x57780b,_0xd025('0x1d'));_0x2ee356['query']=_[_0xd025('0x25')](_0x63ff42['query']);_0x2ee356[_0xd025('0x26')]=_[_0xd025('0x27')](_0x2ee356[_0xd025('0x23')],_0x2ee356[_0xd025('0x28')]);_0x5f0d6f['attributes']=_['intersection'](_0x2ee356[_0xd025('0x23')],qs[_0xd025('0x29')](_0x63ff42[_0xd025('0x28')][_0xd025('0x29')]));_0x5f0d6f[_0xd025('0x2a')]=_0x5f0d6f[_0xd025('0x2a')][_0xd025('0x2b')]?_0x5f0d6f[_0xd025('0x2a')]:_0x2ee356[_0xd025('0x23')];if(!_0x63ff42[_0xd025('0x28')]['hasOwnProperty'](_0xd025('0x2c'))){_0x5f0d6f['limit']=qs['limit'](_0x63ff42[_0xd025('0x28')][_0xd025('0x14')]);_0x5f0d6f[_0xd025('0x12')]=qs['offset'](_0x63ff42[_0xd025('0x28')][_0xd025('0x12')]);}_0x5f0d6f['order']=qs[_0xd025('0x2d')](_0x63ff42[_0xd025('0x28')][_0xd025('0x2d')]);_0x5f0d6f[_0xd025('0x2e')]=qs[_0xd025('0x26')](_[_0xd025('0x2f')](_0x63ff42[_0xd025('0x28')],_0x2ee356[_0xd025('0x26')]),_0x57780b);if(_0x63ff42['query'][_0xd025('0x30')]){_0x5f0d6f[_0xd025('0x2e')]=_[_0xd025('0x31')](_0x5f0d6f[_0xd025('0x2e')],{'$or':_[_0xd025('0x24')](_0x57780b,function(_0x12e28a){if(_0x12e28a[_0xd025('0x21')]!=='VIRTUAL'){var _0x37b77b={};_0x37b77b[_0x12e28a[_0xd025('0x1d')]]={'$like':'%'+_0x63ff42[_0xd025('0x28')]['filter']+'%'};return _0x37b77b;}})});}_0x5f0d6f=_['merge']({},_0x5f0d6f,_0x63ff42[_0xd025('0x32')]);var _0x57caad={'where':_0x5f0d6f['where']};return db['CmHopperHistory']['count'](_0x57caad)[_0xd025('0x1a')](function(_0x5ad5b0){_0x3a4d6c[_0xd025('0x15')]=_0x5ad5b0;if(_0x63ff42[_0xd025('0x28')][_0xd025('0x33')]){_0x5f0d6f['include']=[{'all':!![]}];}return db[_0xd025('0x1e')][_0xd025('0x34')](_0x5f0d6f);})['then'](function(_0x51d2ca){_0x3a4d6c['rows']=_0x51d2ca;return _0x3a4d6c;})['then'](respondWithFilteredResult(_0x440f38,_0x5f0d6f))[_0xd025('0x35')](handleError(_0x440f38,null));};exports[_0xd025('0x36')]=function(_0x1457a8,_0x3f761b){var _0x5b8457={'raw':!![],'where':{'id':_0x1457a8[_0xd025('0x37')]['id']}},_0x30259f={};_0x30259f[_0xd025('0x23')]=_[_0xd025('0x25')](db[_0xd025('0x1e')][_0xd025('0x1f')]);_0x30259f['query']=_[_0xd025('0x25')](_0x1457a8[_0xd025('0x28')]);_0x30259f[_0xd025('0x26')]=_['intersection'](_0x30259f[_0xd025('0x23')],_0x30259f[_0xd025('0x28')]);_0x5b8457[_0xd025('0x2a')]=_[_0xd025('0x27')](_0x30259f[_0xd025('0x23')],qs['fields'](_0x1457a8[_0xd025('0x28')][_0xd025('0x29')]));_0x5b8457[_0xd025('0x2a')]=_0x5b8457[_0xd025('0x2a')][_0xd025('0x2b')]?_0x5b8457[_0xd025('0x2a')]:_0x30259f[_0xd025('0x23')];if(_0x1457a8[_0xd025('0x28')][_0xd025('0x33')]){_0x5b8457[_0xd025('0x38')]=[{'all':!![]}];}_0x5b8457=_[_0xd025('0x31')]({},_0x5b8457,_0x1457a8[_0xd025('0x32')]);return db['CmHopperHistory'][_0xd025('0x39')](_0x5b8457)['then'](handleEntityNotFound(_0x3f761b,null))[_0xd025('0x1a')](respondWithResult(_0x3f761b,null))[_0xd025('0x35')](handleError(_0x3f761b,null));};exports[_0xd025('0x3a')]=function(_0x3094e7,_0x507ce6){return db[_0xd025('0x1e')][_0xd025('0x3a')](_0x3094e7[_0xd025('0x3b')],{})[_0xd025('0x1a')](respondWithResult(_0x507ce6,0xc9))['catch'](handleError(_0x507ce6,null));};exports[_0xd025('0x3c')]=function(_0x3ca9bc,_0x3e9648){return db['CmHopperHistory']['describe']()[_0xd025('0x1a')](respondWithResult(_0x3e9648,null))[_0xd025('0x35')](handleError(_0x3e9648,null));};exports[_0xd025('0x19')]=function(_0x484715,_0x24f0cd){if(_0x484715[_0xd025('0x3b')][_0xd025('0x3d')]){delete _0x484715[_0xd025('0x3b')][_0xd025('0x3d')];}return db[_0xd025('0x1e')]['find']({'where':{'uniqueid':_0x484715['params']['id']}})['then'](handleEntityNotFound(_0x24f0cd,null))[_0xd025('0x1a')](saveUpdates(_0x484715[_0xd025('0x3b')],null))['then'](respondWithResult(_0x24f0cd,null))['catch'](handleError(_0x24f0cd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3264f4f..beefa95 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 _0x8579=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x5ee507,_0x2c7a1b){var _0x247560=function(_0x45693a){while(--_0x45693a){_0x5ee507['push'](_0x5ee507['shift']());}};_0x247560(++_0x2c7a1b);}(_0x8579,0x16c));var _0x9857=function(_0x504b9c,_0x129771){_0x504b9c=_0x504b9c-0x0;var _0x42078a=_0x8579[_0x504b9c];return _0x42078a;};'use strict';var _=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var logger=require('../../config/logger')(_0x9857('0x2'));var moment=require(_0x9857('0x3'));var BPromise=require(_0x9857('0x4'));var rp=require(_0x9857('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x9857('0x6')]=function(_0x1e72cd,_0x472eab){return _0x1e72cd[_0x9857('0x7')](_0x9857('0x8'),attributes,{'tableName':_0x9857('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9857('0xa')]},{'name':_0x9857('0xb'),'fields':[_0x9857('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8561=['define','endtime','util','../../config/logger','moment','request-promise','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8561,0x1b2));var _0x1856=function(_0x3d247a,_0x25d35e){_0x3d247a=_0x3d247a-0x0;var _0x40d987=_0x8561[_0x3d247a];return _0x40d987;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var logger=require(_0x1856('0x1'))('api');var moment=require(_0x1856('0x2'));var BPromise=require('bluebird');var rp=require(_0x1856('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1856('0x4'));var config=require('../../config/environment');var attributes=require(_0x1856('0x5'));module[_0x1856('0x6')]=function(_0x4cb57e,_0x5c39bd){return _0x4cb57e[_0x1856('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x1856('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index df45b8b..4b326a7 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 _0xba30=['`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','AvgHandleTime','CmHopperHistory','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x530f09,_0x2d4d43){var _0x1d9f29=function(_0x59f897){while(--_0x59f897){_0x530f09['push'](_0x530f09['shift']());}};_0x1d9f29(++_0x2d4d43);}(_0xba30,0xf0));var _0x0ba3=function(_0x2a6d8c,_0x19c800){_0x2a6d8c=_0x2a6d8c-0x0;var _0x31a401=_0xba30[_0x2a6d8c];return _0x31a401;};'use strict';var _=require(_0x0ba3('0x0'));var util=require(_0x0ba3('0x1'));var moment=require(_0x0ba3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ba3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ba3('0x4'));var logger=require(_0x0ba3('0x5'))('rpc');var config=require(_0x0ba3('0x6'));var jayson=require(_0x0ba3('0x7'));var client=jayson[_0x0ba3('0x8')][_0x0ba3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45429c,_0x1888a2,_0x390541){return new BPromise(function(_0x2b3d81,_0x43e5ba){return client[_0x0ba3('0xa')](_0x45429c,_0x390541)[_0x0ba3('0xb')](function(_0x4695ec){logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,'request\x20sent');logger[_0x0ba3('0xe')](_0x0ba3('0xf'),_0x1888a2,_0x0ba3('0x10'),JSON[_0x0ba3('0x11')](_0x4695ec));if(_0x4695ec[_0x0ba3('0x12')]){if(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x13')]===0x1f4){logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);return _0x43e5ba(_0x4695ec['error'][_0x0ba3('0x14')]);}logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec['error'][_0x0ba3('0x14')]);return _0x2b3d81(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);}else{logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,_0x0ba3('0x10'));_0x2b3d81(_0x4695ec[_0x0ba3('0x15')][_0x0ba3('0x14')]);}})[_0x0ba3('0x16')](function(_0x16fa5a){logger[_0x0ba3('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1888a2,_0x16fa5a);_0x43e5ba(_0x16fa5a);});});}exports[_0x0ba3('0x17')]=function(_0x4f8dff){var _0x23ff5d=this;return new Promise(function(_0x13c515,_0x10f748){return db['CmHopperHistory']['create'](_0x4f8dff[_0x0ba3('0x18')],{'raw':_0x4f8dff[_0x0ba3('0x19')]?_0x4f8dff[_0x0ba3('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0ba3('0xb')](function(_0x2a2315){logger[_0x0ba3('0xc')](_0x0ba3('0x17'),_0x4f8dff);logger[_0x0ba3('0xe')]('CreateCmHopperHistory',_0x4f8dff,JSON[_0x0ba3('0x11')](_0x2a2315));_0x13c515(_0x2a2315);})[_0x0ba3('0x16')](function(_0xeb2208){logger[_0x0ba3('0x12')]('CreateCmHopperHistory',_0xeb2208[_0x0ba3('0x14')],_0x4f8dff);_0x10f748(_0x23ff5d[_0x0ba3('0x12')](0x1f4,_0xeb2208[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x1a')]=function(_0x2e64ff){var _0x4b0339=this;return new Promise(function(_0x30f356,_0x464726){return db[_0x0ba3('0x1b')]['findAll']({'raw':_0x2e64ff[_0x0ba3('0x19')]?_0x2e64ff['options'][_0x0ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e64ff[_0x0ba3('0x19')]?_0x2e64ff['options'][_0x0ba3('0x1d')]||null:null,'attributes':[[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')][_0x0ba3('0x20')]('id')),_0x0ba3('0x21')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x24')))),_0x0ba3('0x25')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x26')))),_0x0ba3('0x27')],[db[_0x0ba3('0x1e')]['fn']('AVG',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x28')))),_0x0ba3('0x29')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x2a'),db['sequelize']['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x2b')))),_0x0ba3('0x2c')]]})['then'](function(_0x45afc7){logger[_0x0ba3('0xc')](_0x0ba3('0x1a'),_0x2e64ff);logger['debug'](_0x0ba3('0x1a'),_0x2e64ff,JSON[_0x0ba3('0x11')](_0x45afc7));_0x30f356(_0x45afc7);})[_0x0ba3('0x16')](function(_0x38b1d9){logger['error'](_0x0ba3('0x1a'),_0x38b1d9['message'],_0x2e64ff);_0x464726(_0x4b0339[_0x0ba3('0x12')](0x1f4,_0x38b1d9[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x2d')]=function(_0x298358){var _0x4f5962=this;return new Promise(function(_0x3a91ff,_0x4453b7){return db[_0x0ba3('0x1b')][_0x0ba3('0x2e')]({'raw':_0x298358[_0x0ba3('0x19')]?_0x298358[_0x0ba3('0x19')][_0x0ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x298358[_0x0ba3('0x19')]?_0x298358['options']['where']||null:null,'attributes':[[_0x0ba3('0x2f'),_0x0ba3('0x30')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x31')))),_0x0ba3('0x32')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x0ba3('0x33')))),_0x0ba3('0x34')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x23')))),_0x0ba3('0x35')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x36')))),_0x0ba3('0x37')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x38')))),_0x0ba3('0x39')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0x0ba3('0x1e')]['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x3b')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x3c')))),_0x0ba3('0x3d')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x3e')))),_0x0ba3('0x3f')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0x0ba3('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x41')))),_0x0ba3('0x42')],[db[_0x0ba3('0x1e')]['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x0ba3('0x43')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x44')))),'outboundRejectCallsDay'],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x45')))),_0x0ba3('0x46')]],'group':['campaign']})[_0x0ba3('0xb')](function(_0x5721e3){logger[_0x0ba3('0xc')](_0x0ba3('0x2d'),_0x298358);logger[_0x0ba3('0xe')](_0x0ba3('0x2d'),_0x298358,JSON[_0x0ba3('0x11')](_0x5721e3));_0x3a91ff(_0x5721e3);})[_0x0ba3('0x16')](function(_0x2f6a03){logger['error']('GetVoiceQueueHopperHistory',_0x2f6a03[_0x0ba3('0x14')],_0x298358);_0x4453b7(_0x4f5962[_0x0ba3('0x12')](0x1f4,_0x2f6a03[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x47')]=function(_0x2434a2){var _0x5e7c3c=this;return new Promise(function(_0x56a606,_0x2e07f6){return db[_0x0ba3('0x1b')][_0x0ba3('0x2e')]({'raw':_0x2434a2[_0x0ba3('0x19')]?_0x2434a2[_0x0ba3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2434a2['options']?_0x2434a2[_0x0ba3('0x19')][_0x0ba3('0x1d')]||null:null,'attributes':[[_0x0ba3('0x2f'),_0x0ba3('0x30')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')][_0x0ba3('0x20')]('id')),_0x0ba3('0x48')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x0ba3('0x49')]],'group':[_0x0ba3('0x2f')]})[_0x0ba3('0xb')](function(_0x1c9ca9){logger['info'](_0x0ba3('0x47'),_0x2434a2);logger[_0x0ba3('0xe')](_0x0ba3('0x47'),_0x2434a2,JSON[_0x0ba3('0x11')](_0x1c9ca9));_0x56a606(_0x1c9ca9);})[_0x0ba3('0x16')](function(_0x18ecf9){logger[_0x0ba3('0x12')](_0x0ba3('0x47'),_0x18ecf9['message'],_0x2434a2);_0x2e07f6(_0x5e7c3c[_0x0ba3('0x12')](0x1f4,_0x18ecf9[_0x0ba3('0x14')]));});});}; \ No newline at end of file +var _0xe7c2=['http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','campaign','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5129e5,_0x104363){var _0x1731d5=function(_0x23759e){while(--_0x23759e){_0x5129e5['push'](_0x5129e5['shift']());}};_0x1731d5(++_0x104363);}(_0xe7c2,0xc8));var _0x2e7c=function(_0x29af46,_0x29d1d7){_0x29af46=_0x29af46-0x0;var _0xd5d03a=_0xe7c2[_0x29af46];return _0xd5d03a;};'use strict';var _=require(_0x2e7c('0x0'));var util=require(_0x2e7c('0x1'));var moment=require(_0x2e7c('0x2'));var BPromise=require(_0x2e7c('0x3'));var rs=require(_0x2e7c('0x4'));var fs=require('fs');var Redis=require(_0x2e7c('0x5'));var db=require(_0x2e7c('0x6'))['db'];var utils=require(_0x2e7c('0x7'));var logger=require(_0x2e7c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2e7c('0x9'));var client=jayson['client'][_0x2e7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375302,_0x3b45e1,_0x5bbaaa){return new BPromise(function(_0x2bbbbc,_0x205aec){return client['request'](_0x375302,_0x5bbaaa)[_0x2e7c('0xb')](function(_0x4a96cb){logger[_0x2e7c('0xc')](_0x2e7c('0xd'),_0x3b45e1,_0x2e7c('0xe'));logger['debug'](_0x2e7c('0xf'),_0x3b45e1,_0x2e7c('0xe'),JSON['stringify'](_0x4a96cb));if(_0x4a96cb[_0x2e7c('0x10')]){if(_0x4a96cb[_0x2e7c('0x10')]['code']===0x1f4){logger[_0x2e7c('0x10')](_0x2e7c('0xd'),_0x3b45e1,_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);return _0x205aec(_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);}logger[_0x2e7c('0x10')](_0x2e7c('0xd'),_0x3b45e1,_0x4a96cb[_0x2e7c('0x10')][_0x2e7c('0x11')]);return _0x2bbbbc(_0x4a96cb['error'][_0x2e7c('0x11')]);}else{logger[_0x2e7c('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x3b45e1,_0x2e7c('0xe'));_0x2bbbbc(_0x4a96cb[_0x2e7c('0x12')][_0x2e7c('0x11')]);}})[_0x2e7c('0x13')](function(_0x3c31ed){logger[_0x2e7c('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3b45e1,_0x3c31ed);_0x205aec(_0x3c31ed);});});}exports['CreateCmHopperHistory']=function(_0x2d56a2){var _0x336ffc=this;return new Promise(function(_0x22cac0,_0x23dfa4){return db[_0x2e7c('0x14')][_0x2e7c('0x15')](_0x2d56a2['body'],{'raw':_0x2d56a2[_0x2e7c('0x16')]?_0x2d56a2[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![]})[_0x2e7c('0xb')](function(_0xfc24de){logger[_0x2e7c('0xc')](_0x2e7c('0x18'),_0x2d56a2);logger['debug'](_0x2e7c('0x18'),_0x2d56a2,JSON['stringify'](_0xfc24de));_0x22cac0(_0xfc24de);})['catch'](function(_0xaf7af2){logger[_0x2e7c('0x10')]('CreateCmHopperHistory',_0xaf7af2['message'],_0x2d56a2);_0x23dfa4(_0x336ffc['error'](0x1f4,_0xaf7af2[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x19')]=function(_0x28950c){var _0x2fd23d=this;return new Promise(function(_0x3169b7,_0x113ae6){return db['CmHopperHistory'][_0x2e7c('0x1a')]({'raw':_0x28950c[_0x2e7c('0x16')]?_0x28950c[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x28950c[_0x2e7c('0x16')]?_0x28950c[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['col']('id')),_0x2e7c('0x1e')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x2e7c('0x1f')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x21')))),_0x2e7c('0x22')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize'][_0x2e7c('0x20')](_0x2e7c('0x23')))),_0x2e7c('0x24')],[db['sequelize']['fn'](_0x2e7c('0x25'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x26')))),'predictiveIntervalAvgHoldtime'],[db[_0x2e7c('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')]['literal'](_0x2e7c('0x27')))),_0x2e7c('0x28')]]})[_0x2e7c('0xb')](function(_0x1092e4){logger[_0x2e7c('0xc')](_0x2e7c('0x19'),_0x28950c);logger['debug'](_0x2e7c('0x19'),_0x28950c,JSON[_0x2e7c('0x29')](_0x1092e4));_0x3169b7(_0x1092e4);})[_0x2e7c('0x13')](function(_0x3a2e68){logger['error'](_0x2e7c('0x19'),_0x3a2e68[_0x2e7c('0x11')],_0x28950c);_0x113ae6(_0x2fd23d['error'](0x1f4,_0x3a2e68[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x2a')]=function(_0x1a0313){var _0x292eeb=this;return new Promise(function(_0xfa3194,_0x172be2){return db[_0x2e7c('0x14')][_0x2e7c('0x1a')]({'raw':_0x1a0313[_0x2e7c('0x16')]?_0x1a0313[_0x2e7c('0x16')][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x1a0313[_0x2e7c('0x16')]?_0x1a0313[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[['campaign',_0x2e7c('0x2b')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x2c')))),_0x2e7c('0x2d')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x2e')))),_0x2e7c('0x2f')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x2e7c('0x30')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x31')))),_0x2e7c('0x32')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x33')))),_0x2e7c('0x34')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')]['literal'](_0x2e7c('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x2e7c('0x36')))),_0x2e7c('0x37')],[db['sequelize']['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x2e7c('0x38')],[db[_0x2e7c('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x2e7c('0x39')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x3a')))),_0x2e7c('0x3b')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db['sequelize'][_0x2e7c('0x20')](_0x2e7c('0x3c')))),_0x2e7c('0x3d')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x3e')))),'outboundRejectCallsDay'],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')]['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x4eefa5){logger[_0x2e7c('0xc')]('GetVoiceQueueHopperHistory',_0x1a0313);logger['debug'](_0x2e7c('0x2a'),_0x1a0313,JSON[_0x2e7c('0x29')](_0x4eefa5));_0xfa3194(_0x4eefa5);})['catch'](function(_0x3cbf29){logger[_0x2e7c('0x10')](_0x2e7c('0x2a'),_0x3cbf29[_0x2e7c('0x11')],_0x1a0313);_0x172be2(_0x292eeb[_0x2e7c('0x10')](0x1f4,_0x3cbf29[_0x2e7c('0x11')]));});});};exports[_0x2e7c('0x3f')]=function(_0x4b3435){var _0x23546d=this;return new Promise(function(_0x51187d,_0x256098){return db[_0x2e7c('0x14')][_0x2e7c('0x1a')]({'raw':_0x4b3435[_0x2e7c('0x16')]?_0x4b3435['options'][_0x2e7c('0x17')]===undefined?!![]:![]:!![],'where':_0x4b3435[_0x2e7c('0x16')]?_0x4b3435[_0x2e7c('0x16')][_0x2e7c('0x1b')]||null:null,'attributes':[[_0x2e7c('0x40'),_0x2e7c('0x2b')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db[_0x2e7c('0x1c')][_0x2e7c('0x41')]('id')),_0x2e7c('0x42')],[db[_0x2e7c('0x1c')]['fn'](_0x2e7c('0x1d'),db['sequelize']['fn']('IF',db[_0x2e7c('0x1c')][_0x2e7c('0x20')](_0x2e7c('0x43')))),_0x2e7c('0x44')]],'group':[_0x2e7c('0x40')]})[_0x2e7c('0xb')](function(_0x131be0){logger['info'](_0x2e7c('0x3f'),_0x4b3435);logger[_0x2e7c('0x45')](_0x2e7c('0x3f'),_0x4b3435,JSON['stringify'](_0x131be0));_0x51187d(_0x131be0);})[_0x2e7c('0x13')](function(_0xe30315){logger[_0x2e7c('0x10')](_0x2e7c('0x3f'),_0xe30315[_0x2e7c('0x11')],_0x4b3435);_0x256098(_0x23546d[_0x2e7c('0x10')](0x1f4,_0xe30315['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 46914a5..dd22376 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 _0x213e=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','show','post','create','isAuthenticated','update','exports','util','path','connect-timeout','express'];(function(_0x40174f,_0x3a6751){var _0x40717c=function(_0x5ae03d){while(--_0x5ae03d){_0x40174f['push'](_0x40174f['shift']());}};_0x40717c(++_0x3a6751);}(_0x213e,0x1c8));var _0xe213=function(_0x31c64b,_0x23a9ad){_0x31c64b=_0x31c64b-0x0;var _0x3684b0=_0x213e[_0x31c64b];return _0x3684b0;};'use strict';var multer=require('multer');var util=require(_0xe213('0x0'));var path=require(_0xe213('0x1'));var timeout=require(_0xe213('0x2'));var express=require(_0xe213('0x3'));var router=express[_0xe213('0x4')]();var fs_extra=require(_0xe213('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe213('0x6'));var config=require(_0xe213('0x7'));var controller=require(_0xe213('0x8'));router[_0xe213('0x9')]('/',auth['isAuthenticated'](),controller[_0xe213('0xa')]);router[_0xe213('0x9')](_0xe213('0xb'),auth['isAuthenticated'](),controller[_0xe213('0xc')]);router['get'](_0xe213('0xd'),auth['isAuthenticated'](),controller[_0xe213('0xe')]);router[_0xe213('0xf')]('/',auth['isAuthenticated'](),controller[_0xe213('0x10')]);router['put'](_0xe213('0xd'),auth[_0xe213('0x11')](),controller[_0xe213('0x12')]);module[_0xe213('0x13')]=router; \ No newline at end of file +var _0xcb8a=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','describe','get','/:id','show','post'];(function(_0x3dba94,_0x1ba94a){var _0x2151cc=function(_0x238b24){while(--_0x238b24){_0x3dba94['push'](_0x3dba94['shift']());}};_0x2151cc(++_0x1ba94a);}(_0xcb8a,0x8e));var _0xacb8=function(_0x21d7c4,_0x1ee1ed){_0x21d7c4=_0x21d7c4-0x0;var _0x5665b8=_0xcb8a[_0x21d7c4];return _0x5665b8;};'use strict';var multer=require(_0xacb8('0x0'));var util=require(_0xacb8('0x1'));var path=require(_0xacb8('0x2'));var timeout=require(_0xacb8('0x3'));var express=require(_0xacb8('0x4'));var router=express[_0xacb8('0x5')]();var fs_extra=require(_0xacb8('0x6'));var auth=require(_0xacb8('0x7'));var interaction=require(_0xacb8('0x8'));var config=require(_0xacb8('0x9'));var controller=require(_0xacb8('0xa'));router['get']('/',auth[_0xacb8('0xb')](),controller[_0xacb8('0xc')]);router['get']('/describe',auth[_0xacb8('0xb')](),controller[_0xacb8('0xd')]);router[_0xacb8('0xe')](_0xacb8('0xf'),auth[_0xacb8('0xb')](),controller[_0xacb8('0x10')]);router[_0xacb8('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xacb8('0xf'),auth[_0xacb8('0xb')](),controller[_0xacb8('0x12')]);module[_0xacb8('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 711371d..9ea0e5b 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 _0x9f5a=['name','sequelize','exports','STRING'];(function(_0x3a3a6a,_0x5eb6a9){var _0xa89294=function(_0x55d78c){while(--_0x55d78c){_0x3a3a6a['push'](_0x3a3a6a['shift']());}};_0xa89294(++_0x5eb6a9);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x3446e1,_0x2a3ac6){_0x3446e1=_0x3446e1-0x0;var _0x262233=_0x9f5a[_0x3446e1];return _0x262233;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')],'unique':_0xa9f5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa9f5('0x2')]}}; \ No newline at end of file +var _0x1052=['sequelize','exports','STRING','name'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1052,0xf4));var _0x2105=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x1052[_0xda501a];return _0x44be3a;};'use strict';var Sequelize=require(_0x2105('0x0'));module[_0x2105('0x1')]={'name':{'type':Sequelize[_0x2105('0x2')],'unique':_0x2105('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2105('0x2')]},'dialPrefix':{'type':Sequelize[_0x2105('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2cf0e4b..832afae 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 _0x0505=['defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','userCmList:remove','User','getAgents','info','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','error','name','send','index','map','CmList','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','isArray','tags','join','each','CmContact','omit','push','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','raw','getContacts','ContactItemType','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch'];(function(_0x28561e,_0x286be0){var _0x4f9952=function(_0x3bc46e){while(--_0x3bc46e){_0x28561e['push'](_0x28561e['shift']());}};_0x4f9952(++_0x286be0);}(_0x0505,0x14f));var _0x5050=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0505[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5050('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5050('0x1'));var rp=require(_0x5050('0x2'));var moment=require(_0x5050('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5050('0x4'));var util=require(_0x5050('0x5'));var path=require('path');var sox=require(_0x5050('0x6'));var csv=require(_0x5050('0x7'));var ejs=require(_0x5050('0x8'));var fs=require('fs');var fs_extra=require(_0x5050('0x9'));var _=require(_0x5050('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5050('0x7'));var querystring=require(_0x5050('0xb'));var Papa=require(_0x5050('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5050('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5050('0xe'))(_0x5050('0xf'));var utils=require(_0x5050('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x5050('0x11'));var db=require(_0x5050('0x12'))['db'];var csv_results;config[_0x5050('0x13')]=_['defaults'](config[_0x5050('0x13')],{'host':_0x5050('0x14'),'port':0x18eb});var socket=require(_0x5050('0x15'))(new Redis(config[_0x5050('0x13')]));require('./cmList.socket')[_0x5050('0x16')](socket);function respondWithStatusCode(_0x9a8cb,_0x309f68){_0x309f68=_0x309f68||0xcc;return function(_0xb7619b){if(_0xb7619b){return _0x9a8cb[_0x5050('0x17')](_0x309f68);}return _0x9a8cb[_0x5050('0x18')](_0x309f68)['end']();};}function respondWithResult(_0x309c71,_0x10e9db){_0x10e9db=_0x10e9db||0xc8;return function(_0x4b8a74){if(_0x4b8a74){return _0x309c71['status'](_0x10e9db)[_0x5050('0x19')](_0x4b8a74);}};}function respondWithFilteredResult(_0x5746b2,_0x1ba4c3){return function(_0x543765){if(_0x543765){var _0x3501ce=typeof _0x1ba4c3[_0x5050('0x1a')]===_0x5050('0x1b')&&typeof _0x1ba4c3[_0x5050('0x1c')]==='undefined';var _0x560b60=_0x543765[_0x5050('0x1d')];var _0x3232ca=_0x3501ce?0x0:_0x1ba4c3[_0x5050('0x1a')];var _0x25ccbe=_0x3501ce?_0x543765['count']:_0x1ba4c3[_0x5050('0x1a')]+_0x1ba4c3['limit'];var _0x10ffe3;if(_0x25ccbe>=_0x560b60){_0x25ccbe=_0x560b60;_0x10ffe3=0xc8;}else{_0x10ffe3=0xce;}_0x5746b2[_0x5050('0x18')](_0x10ffe3);return _0x5746b2[_0x5050('0x1e')](_0x5050('0x1f'),_0x3232ca+'-'+_0x25ccbe+'/'+_0x560b60)['json'](_0x543765);}return null;};}function patchUpdates(_0x359e78){return function(_0x571ee6){try{jsonpatch[_0x5050('0x20')](_0x571ee6,_0x359e78,!![]);}catch(_0x5005f9){return BPromise[_0x5050('0x21')](_0x5005f9);}return _0x571ee6[_0x5050('0x22')]();};}function saveUpdates(_0x334e38,_0x38a471){return function(_0x372206){if(_0x372206){return _0x372206[_0x5050('0x23')](_0x334e38)['then'](function(_0xbea4cc){return _0xbea4cc;});}return null;};}function removeEntity(_0x4d939f,_0x11b3f9){return function(_0xbc1b50){if(_0xbc1b50){return _0xbc1b50[_0x5050('0x24')]()[_0x5050('0x25')](function(){var _0x1a0fb5=_0xbc1b50[_0x5050('0x26')]({'plain':!![]});var _0x43b2e0=_0x5050('0x27');return db['UserProfileResource'][_0x5050('0x24')]({'where':{'type':_0x43b2e0,'resourceId':_0x1a0fb5['id']}})[_0x5050('0x25')](function(){return _0xbc1b50;});})['then'](function(){_0x4d939f[_0x5050('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229872,_0x590045){return function(_0x53efcc){if(!_0x53efcc){_0x229872[_0x5050('0x17')](0x194);}return _0x53efcc;};}function handleError(_0x26a067,_0x5e87e4){_0x5e87e4=_0x5e87e4||0x1f4;return function(_0x2e4012){logger[_0x5050('0x28')](_0x2e4012['stack']);if(_0x2e4012[_0x5050('0x29')]){delete _0x2e4012[_0x5050('0x29')];}_0x26a067[_0x5050('0x18')](_0x5e87e4)[_0x5050('0x2a')](_0x2e4012);};}exports[_0x5050('0x2b')]=function(_0x2682cf,_0xa4c9aa){var _0x16c336={},_0x889cea={},_0x25be7b={'count':0x0,'rows':[]};var _0x205848=_[_0x5050('0x2c')](db[_0x5050('0x2d')][_0x5050('0x2e')],function(_0x66e74d){return{'name':_0x66e74d[_0x5050('0x2f')],'type':_0x66e74d[_0x5050('0x30')]['key']};});_0x889cea['model']=_[_0x5050('0x2c')](_0x205848,'name');_0x889cea[_0x5050('0x31')]=_['keys'](_0x2682cf[_0x5050('0x31')]);_0x889cea[_0x5050('0x32')]=_[_0x5050('0x33')](_0x889cea[_0x5050('0x34')],_0x889cea[_0x5050('0x31')]);_0x16c336['attributes']=_[_0x5050('0x33')](_0x889cea[_0x5050('0x34')],qs[_0x5050('0x35')](_0x2682cf[_0x5050('0x31')]['fields']));_0x16c336['attributes']=_0x16c336[_0x5050('0x36')][_0x5050('0x37')]?_0x16c336[_0x5050('0x36')]:_0x889cea[_0x5050('0x34')];if(!_0x2682cf['query'][_0x5050('0x38')](_0x5050('0x39'))){_0x16c336[_0x5050('0x1c')]=qs[_0x5050('0x1c')](_0x2682cf[_0x5050('0x31')][_0x5050('0x1c')]);_0x16c336['offset']=qs[_0x5050('0x1a')](_0x2682cf[_0x5050('0x31')]['offset']);}_0x16c336[_0x5050('0x3a')]=qs['sort'](_0x2682cf[_0x5050('0x31')][_0x5050('0x3b')]);_0x16c336[_0x5050('0x3c')]=qs[_0x5050('0x32')](_[_0x5050('0x3d')](_0x2682cf[_0x5050('0x31')],_0x889cea['filters']),_0x205848);if(_0x2682cf[_0x5050('0x31')][_0x5050('0x3e')]){_0x16c336['where']=_['merge'](_0x16c336[_0x5050('0x3c')],{'$or':_['map'](_0x205848,function(_0x76d242){if(_0x76d242[_0x5050('0x30')]!==_0x5050('0x3f')){var _0x538a9c={};_0x538a9c[_0x76d242[_0x5050('0x29')]]={'$like':'%'+_0x2682cf[_0x5050('0x31')][_0x5050('0x3e')]+'%'};return _0x538a9c;}})});}_0x16c336=_[_0x5050('0x40')]({},_0x16c336,_0x2682cf[_0x5050('0x41')]);var _0x1273a1={'where':_0x16c336['where']};return db['CmList'][_0x5050('0x1d')](_0x1273a1)[_0x5050('0x25')](function(_0x529ac6){_0x25be7b[_0x5050('0x1d')]=_0x529ac6;if(_0x2682cf[_0x5050('0x31')][_0x5050('0x42')]){_0x16c336[_0x5050('0x43')]=[{'all':!![]}];}return db[_0x5050('0x2d')][_0x5050('0x44')](_0x16c336);})[_0x5050('0x25')](function(_0xe6f59f){_0x25be7b[_0x5050('0x45')]=_0xe6f59f;return _0x25be7b;})[_0x5050('0x25')](respondWithFilteredResult(_0xa4c9aa,_0x16c336))['catch'](handleError(_0xa4c9aa,null));};exports[_0x5050('0x46')]=function(_0xab6e7a,_0x4166cc){var _0x279cf9={'raw':![],'where':{'id':_0xab6e7a[_0x5050('0x47')]['id']}},_0x5df26f={};_0x5df26f['model']=_[_0x5050('0x48')](db[_0x5050('0x2d')][_0x5050('0x2e')]);_0x5df26f[_0x5050('0x31')]=_['keys'](_0xab6e7a['query']);_0x5df26f[_0x5050('0x32')]=_[_0x5050('0x33')](_0x5df26f[_0x5050('0x34')],_0x5df26f[_0x5050('0x31')]);_0x279cf9[_0x5050('0x36')]=_[_0x5050('0x33')](_0x5df26f[_0x5050('0x34')],qs[_0x5050('0x35')](_0xab6e7a[_0x5050('0x31')]['fields']));_0x279cf9[_0x5050('0x36')]=_0x279cf9['attributes'][_0x5050('0x37')]?_0x279cf9[_0x5050('0x36')]:_0x5df26f['model'];if(_0xab6e7a[_0x5050('0x31')][_0x5050('0x42')]){_0x279cf9[_0x5050('0x43')]=[{'all':!![]}];}_0x279cf9=_['merge']({},_0x279cf9,_0xab6e7a[_0x5050('0x41')]);return db['CmList'][_0x5050('0x49')](_0x279cf9)[_0x5050('0x25')](handleEntityNotFound(_0x4166cc,null))[_0x5050('0x25')](respondWithResult(_0x4166cc,null))[_0x5050('0x4a')](handleError(_0x4166cc,null));};exports['create']=function(_0x38beac,_0x2b6b5e){return db['CmList']['create'](_0x38beac[_0x5050('0x4b')],{})[_0x5050('0x25')](function(_0x5820dd){var _0x178b0d=_0x38beac[_0x5050('0x4c')][_0x5050('0x26')]({'plain':!![]});if(!_0x178b0d)throw new Error(_0x5050('0x4d'));if(_0x178b0d[_0x5050('0x4e')]===_0x5050('0x4c')){var _0x515e70=_0x5820dd[_0x5050('0x26')]({'plain':!![]});var _0x53f1ff=_0x5050('0x27');return db[_0x5050('0x4f')][_0x5050('0x49')]({'where':{'name':_0x53f1ff,'userProfileId':_0x178b0d[_0x5050('0x50')]},'raw':!![]})[_0x5050('0x25')](function(_0x23bc55){if(_0x23bc55&&_0x23bc55[_0x5050('0x51')]===0x0){return db[_0x5050('0x52')][_0x5050('0x53')]({'name':_0x515e70[_0x5050('0x29')],'resourceId':_0x515e70['id'],'type':_0x23bc55[_0x5050('0x29')],'sectionId':_0x23bc55['id']},{})[_0x5050('0x25')](function(){return _0x5820dd;});}else{return _0x5820dd;}})['catch'](function(_0x574d74){logger[_0x5050('0x28')](_0x5050('0x54'),_0x574d74);throw _0x574d74;});}return _0x5820dd;})[_0x5050('0x25')](respondWithResult(_0x2b6b5e,0xc9))['catch'](handleError(_0x2b6b5e,null));};exports[_0x5050('0x23')]=function(_0x1380ee,_0x3516fb){if(_0x1380ee['body']['id']){delete _0x1380ee['body']['id'];}return db[_0x5050('0x2d')]['find']({'where':{'id':_0x1380ee[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x3516fb,null))[_0x5050('0x25')](saveUpdates(_0x1380ee[_0x5050('0x4b')],null))[_0x5050('0x25')](respondWithResult(_0x3516fb,null))[_0x5050('0x4a')](handleError(_0x3516fb,null));};exports['destroy']=function(_0x1c1629,_0x18a0d9){return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x1c1629[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x18a0d9,null))[_0x5050('0x25')](removeEntity(_0x18a0d9,null))[_0x5050('0x4a')](handleError(_0x18a0d9,null));};exports['describe']=function(_0x3a58a2,_0x3826c9){return db[_0x5050('0x2d')][_0x5050('0x55')]()['then'](respondWithResult(_0x3826c9,null))[_0x5050('0x4a')](handleError(_0x3826c9,null));};exports[_0x5050('0x56')]=function(_0x229d02,_0x1606d3,_0x525079){if(_0x229d02[_0x5050('0x4b')]['id']){delete _0x229d02['body']['id'];}return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x229d02['params']['id']}})['then'](handleEntityNotFound(_0x1606d3,null))['then'](function(_0x5af852){if(_0x5af852){_0x229d02['body'][_0x5050('0x57')]=_0x5af852['id'];return db[_0x5050('0x58')]['create'](_0x229d02[_0x5050('0x4b')]);}})[_0x5050('0x25')](respondWithResult(_0x1606d3,null))['catch'](handleError(_0x1606d3,null));};exports[_0x5050('0x59')]=function(_0x4abf9d,_0x4ddc9e,_0x17c316){var _0x58acfd={'raw':![],'where':{}};var _0x4abc00={};var _0xe5248f={'count':0x0,'rows':[]};return db[_0x5050('0x2d')][_0x5050('0x5a')]({'where':{'id':_0x4abf9d[_0x5050('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ddc9e,null))[_0x5050('0x25')](function(_0x482a80){if(_0x482a80){_0x4abc00[_0x5050('0x34')]=_['keys'](db[_0x5050('0x58')][_0x5050('0x2e')]);_0x4abc00[_0x5050('0x31')]=_[_0x5050('0x48')](_0x4abf9d[_0x5050('0x31')]);_0x4abc00[_0x5050('0x32')]=_[_0x5050('0x33')](_0x4abc00[_0x5050('0x34')],_0x4abc00[_0x5050('0x31')]);_0x58acfd[_0x5050('0x36')]=_['intersection'](_0x4abc00[_0x5050('0x34')],qs[_0x5050('0x35')](_0x4abf9d[_0x5050('0x31')][_0x5050('0x35')]));_0x58acfd['attributes']=_0x58acfd[_0x5050('0x36')]['length']?_0x58acfd[_0x5050('0x36')]:_0x4abc00['model'];if(!_0x4abf9d[_0x5050('0x31')][_0x5050('0x38')](_0x5050('0x39'))){_0x58acfd[_0x5050('0x1c')]=qs[_0x5050('0x1c')](_0x4abf9d[_0x5050('0x31')][_0x5050('0x1c')]);_0x58acfd[_0x5050('0x1a')]=qs[_0x5050('0x1a')](_0x4abf9d[_0x5050('0x31')]['offset']);}_0x58acfd['order']=qs[_0x5050('0x3b')](_0x4abf9d['query'][_0x5050('0x3b')]);_0x58acfd[_0x5050('0x3c')]=qs['filters'](_[_0x5050('0x3d')](_0x4abf9d[_0x5050('0x31')],_0x4abc00['filters']));_0x58acfd['where'][_0x5050('0x57')]=_0x482a80['id'];if(_0x4abf9d[_0x5050('0x31')][_0x5050('0x3e')]){_0x58acfd[_0x5050('0x3c')]=_[_0x5050('0x40')](_0x58acfd['where'],{'$or':_[_0x5050('0x2c')](_0x58acfd[_0x5050('0x36')],function(_0x55aa8b){var _0x4560c5={};_0x4560c5[_0x55aa8b]={'$like':'%'+_0x4abf9d[_0x5050('0x31')][_0x5050('0x3e')]+'%'};return _0x4560c5;})});}_0x58acfd=_[_0x5050('0x40')]({},_0x58acfd,_0x4abf9d[_0x5050('0x41')]);return db[_0x5050('0x58')][_0x5050('0x1d')]({'where':_0x58acfd[_0x5050('0x3c')]})['then'](function(_0x52308d){_0xe5248f[_0x5050('0x1d')]=_0x52308d;if(_0x4abf9d['query'][_0x5050('0x42')]){_0x58acfd[_0x5050('0x43')]=[{'all':!![]}];}return db[_0x5050('0x58')]['findAll'](_0x58acfd);})[_0x5050('0x25')](function(_0x1475eb){_0xe5248f['rows']=_0x1475eb;return _0xe5248f;});}})[_0x5050('0x25')](respondWithFilteredResult(_0x4ddc9e,_0x58acfd))[_0x5050('0x4a')](handleError(_0x4ddc9e,null));};exports[_0x5050('0x5b')]=function(_0xc28a69,_0x1b335a,_0x455541){return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0xc28a69[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x1b335a,null))['then'](function(_0x299835){if(_0x299835){return _0x299835[_0x5050('0x5b')](_0xc28a69[_0x5050('0x31')][_0x5050('0x5c')]);}})[_0x5050('0x25')](respondWithStatusCode(_0x1b335a,null))[_0x5050('0x4a')](handleError(_0x1b335a,null));};exports[_0x5050('0x5d')]=function(_0x4b66dc,_0x163cda,_0x72fa08){return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x4b66dc['params']['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x163cda,null))[_0x5050('0x25')](function(_0x34d065){if(_0x34d065){var _0x5043e2=[];var _0x1d057a={'success':[],'errors':[]};return db['CmContact'][_0x5050('0x55')]()['then'](function(_0x5845e){if(_0x4b66dc[_0x5050('0x4b')]['tags']&&_[_0x5050('0x5e')](_0x4b66dc[_0x5050('0x4b')][_0x5050('0x5f')])){if(_0x4b66dc['body'][_0x5050('0x5f')][_0x5050('0x37')]){_0x4b66dc[_0x5050('0x4b')][_0x5050('0x5f')]=_0x4b66dc[_0x5050('0x4b')][_0x5050('0x5f')][_0x5050('0x60')](';')+';';}else{_0x4b66dc[_0x5050('0x4b')][_0x5050('0x5f')]=null;}}else{_0x4b66dc[_0x5050('0x4b')][_0x5050('0x5f')]=null;}if(_0x4b66dc[_0x5050('0x4b')]&&_[_0x5050('0x5e')](_0x4b66dc['body'])){for(var _0x45dc28=0x0;_0x45dc28<_0x4b66dc['body']['length'];_0x45dc28+=0x1){_0x4b66dc[_0x5050('0x4b')][_0x45dc28][_0x5050('0x57')]=_0x4b66dc[_0x5050('0x47')]['id'];_0x5043e2['push'](_0x4b66dc[_0x5050('0x4b')][_0x45dc28]);}return BPromise[_0x5050('0x61')](_0x5043e2,function(_0x100933){return db[_0x5050('0x62')][_0x5050('0x53')](_[_0x5050('0x63')](_0x100933,['ids','id'])||{},{'fields':_[_0x5050('0x48')](_0x5845e),'raw':!![]})[_0x5050('0x25')](function(_0x92a1fd){_0x1d057a['success'][_0x5050('0x64')](_0x92a1fd[_0x5050('0x65')]);})[_0x5050('0x4a')](function(_0x2bd5d4){_0x1d057a[_0x5050('0x66')][_0x5050('0x64')]({'data':_0x100933,'error':_0x2bd5d4[_0x5050('0x67')]});});})[_0x5050('0x25')](function(_0x337826){return _0x1d057a;})['catch'](function(_0x49bf35){return _0x49bf35;});}else{_0x163cda[_0x5050('0x18')](0x190)[_0x5050('0x19')]({'message':_0x5050('0x68')});}});}})[_0x5050('0x25')](respondWithResult(_0x163cda,null))[_0x5050('0x4a')](handleError(_0x163cda,null));};exports['getContacts']=function(_0x51c86e,_0x2ce5ea,_0xcfaaea){var _0xfec5f;return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x51c86e[_0x5050('0x47')]['id']},'include':[{'model':db[_0x5050('0x69')],'as':_0x5050('0x6a')}]})[_0x5050('0x25')](handleEntityNotFound(_0x2ce5ea,null))[_0x5050('0x25')](function(_0x2dd31a){if(_0x2dd31a){_0xfec5f=_0x2dd31a;return db[_0x5050('0x62')][_0x5050('0x2e')];}})[_0x5050('0x25')](function(_0x12e1be){if(_0x12e1be){var _0x46bab3={};var _0x2dbade={};_0x2dbade[_0x5050('0x34')]=_['concat'](_[_0x5050('0x48')](_0x12e1be),_[_0x5050('0x2c')](_0xfec5f[_0x5050('0x6a')],function(_0x584d31){return util[_0x5050('0x6b')](_0x5050('0x6c'),_0x584d31['id']);}));_0x2dbade['query']=_[_0x5050('0x48')](_0x51c86e['query']);_0x2dbade[_0x5050('0x32')]=_[_0x5050('0x33')](_0x2dbade[_0x5050('0x34')],_0x2dbade[_0x5050('0x31')]);_0x46bab3[_0x5050('0x36')]=_[_0x5050('0x33')](_0x2dbade['model'],qs['fields'](_0x51c86e[_0x5050('0x31')][_0x5050('0x35')]));_0x46bab3[_0x5050('0x36')]=_0x46bab3[_0x5050('0x36')]['length']?_0x46bab3['attributes']:_0x2dbade[_0x5050('0x34')];if(!_0x51c86e[_0x5050('0x31')][_0x5050('0x38')]('nolimit')){_0x46bab3[_0x5050('0x1c')]=qs[_0x5050('0x1c')](_0x51c86e[_0x5050('0x31')]['limit']);_0x46bab3[_0x5050('0x1a')]=qs[_0x5050('0x1a')](_0x51c86e['query'][_0x5050('0x1a')]);}_0x46bab3[_0x5050('0x3a')]=qs['sort'](_0x51c86e['query'][_0x5050('0x3b')]);_0x46bab3[_0x5050('0x3c')]=qs[_0x5050('0x32')](_[_0x5050('0x3d')](_0x51c86e[_0x5050('0x31')],_0x2dbade['filters']));_0x46bab3[_0x5050('0x6d')]=!![];if(_0x51c86e[_0x5050('0x31')][_0x5050('0x3e')]){_0x46bab3[_0x5050('0x3c')]=_['merge'](_0x46bab3[_0x5050('0x3c')],{'$or':_[_0x5050('0x2c')](_0x46bab3[_0x5050('0x36')],function(_0x309633){var _0x241502={};_0x241502[_0x309633]={'$like':'%'+_0x51c86e['query']['filter']+'%'};return _0x241502;})});}_0x46bab3=_['merge']({},_0x46bab3,_0x51c86e[_0x5050('0x41')]);return _0xfec5f[_0x5050('0x6e')](_0x46bab3);}})[_0x5050('0x25')](respondWithResult(_0x2ce5ea,null))[_0x5050('0x4a')](handleError(_0x2ce5ea,null));};exports['getContactsCsv']=function(_0x9a5264,_0x5dc223,_0x534992){var _0x5fbd92;var _0xc31dec;var _0x22525a;var _0x23eba2=_0x9a5264[_0x5050('0x47')]['id'];csv_results=[];return db[_0x5050('0x6f')][_0x5050('0x44')]({'attributes':['id',_0x5050('0x29')],'raw':!![],'order':['OrderBy']})[_0x5050('0x25')](function(_0x28673b){_0x5fbd92=_0x28673b;var _0x56409b=_[_0x5050('0x48')](db['CmContact']['rawAttributes']);return db[_0x5050('0x69')][_0x5050('0x44')]({'raw':!![],'attributes':['id',_0x5050('0x70')]})['then'](function(_0x73d213){_0xc31dec=_0x73d213;var _0x4b6ae8=squel['select']()[_0x5050('0x35')](_0x56409b)[_0x5050('0x71')](_0x5050('0x72'),'c')[_0x5050('0x3c')](_0x5050('0x73'),_0x23eba2)['where'](_0x5050('0x74'))[_0x5050('0x75')]();for(var _0x457c17=0x0;_0x457c17<_0xc31dec[_0x5050('0x37')];_0x457c17++){_0x4b6ae8[_0x5050('0x76')](_0x5050('0x77')+_0xc31dec[_0x457c17]['id'],_0x5050('0x78')+_0xc31dec[_0x457c17]['alias']);}for(var _0x457c17=0x0;_0x457c17<_0x5fbd92[_0x5050('0x37')];_0x457c17++){_0x4b6ae8[_0x5050('0x76')](squel[_0x5050('0x79')]()['field'](_0x5050('0x7a'))[_0x5050('0x71')]('cm_contact_has_items')['where'](_0x5050('0x7b'),_0x5fbd92[_0x457c17]['id'])[_0x5050('0x3c')](_0x5050('0x7c')),_0x5050('0x7d')+_0x5fbd92[_0x457c17][_0x5050('0x29')]);_0x4b6ae8['field'](squel[_0x5050('0x79')]()[_0x5050('0x76')]('description')['from'](_0x5050('0x7e'))[_0x5050('0x3c')](_0x5050('0x7b'),_0x5fbd92[_0x457c17]['id'])[_0x5050('0x3c')](_0x5050('0x7c')),_0x5050('0x7f')+_0x5fbd92[_0x457c17]['name']);}var _0x27f5a7=[];_0x27f5a7[_0x5050('0x64')](_0x4b6ae8[_0x5050('0x80')]());BPromise['each'](_0x27f5a7,handleQuery)['then'](function(_0x3bbdf9){handleQuery(_0x4b6ae8[_0x5050('0x80')]());var _0x3f806c=csv_results[0x0];if(!_['isEmpty'](_0x3f806c)){var _0x584f8f=toCsv(_0x3f806c);var _0x49f3ee=Date[_0x5050('0x81')]();fs['writeFileSync'](util[_0x5050('0x6b')](_0x5050('0x82'),_0x23eba2,_0x49f3ee),_0x584f8f);_0x5dc223['setHeader'](_0x5050('0x83'),_0x5050('0x84')+util[_0x5050('0x6b')](_0x5050('0x85'),_0x23eba2,_0x49f3ee));_0x5dc223[_0x5050('0x86')](_0x5050('0x87'),_0x5050('0x88'));return _0x5dc223[_0x5050('0x89')](util['format'](_0x5050('0x82'),_0x23eba2,_0x49f3ee));}else{return _0x5dc223[_0x5050('0x17')](0xcc);}});});});};exports[_0x5050('0x8a')]=function(_0x2a464b,_0x816b,_0x4a4001){var _0x256abe;delete _0x2a464b[_0x5050('0x4b')]['id'];return db[_0x5050('0x2d')][_0x5050('0x5a')]({'where':{'id':_0x2a464b['params']['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x816b,null))[_0x5050('0x25')](function(_0x2d3c54){if(_0x2d3c54){return db[_0x5050('0x8b')][_0x5050('0x8c')](function(_0x48fd51){return db[_0x5050('0x69')][_0x5050('0x53')](_0x2a464b[_0x5050('0x4b')],{'transaction':_0x48fd51})[_0x5050('0x25')](function(_0x47623c){_0x256abe=_0x47623c;return _0x2d3c54[_0x5050('0x8d')](_0x47623c,{'transaction':_0x48fd51});})['then'](function(){var _0x3944b1={'type':db[_0x5050('0x8e')][_0x5050('0x8f')],'transaction':_0x48fd51};switch(_0x2a464b[_0x5050('0x4b')][_0x5050('0x30')]){case _0x5050('0x90'):_0x3944b1[_0x5050('0x30')]=db[_0x5050('0x8e')][_0x5050('0x8f')];break;case _0x5050('0x91'):_0x3944b1[_0x5050('0x30')]=db[_0x5050('0x8e')][_0x5050('0x92')];break;case _0x5050('0x93'):_0x3944b1[_0x5050('0x30')]=db[_0x5050('0x8e')]['BOOLEAN'];_0x3944b1[_0x5050('0x94')]=![];break;default:}return db[_0x5050('0x8b')][_0x5050('0x95')]['addColumn'](_0x5050('0x72'),util[_0x5050('0x6b')](_0x5050('0x96'),_0x256abe['id']),_0x3944b1);})[_0x5050('0x25')](function(){return _0x256abe;});});}})[_0x5050('0x25')](respondWithResult(_0x816b,null))[_0x5050('0x4a')](handleError(_0x816b,null));};exports[_0x5050('0x97')]=function(_0x234c38,_0x401645,_0x548df8){var _0x1acce3={};var _0x10869f={};var _0x1accdc;var _0x58d24e;return db[_0x5050('0x2d')][_0x5050('0x5a')]({'where':{'id':_0x234c38[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x401645,null))['then'](function(_0x139be6){if(_0x139be6){_0x1accdc=_0x139be6;_0x10869f[_0x5050('0x34')]=_[_0x5050('0x48')](db[_0x5050('0x69')]['rawAttributes']);_0x10869f[_0x5050('0x31')]=_['keys'](_0x234c38[_0x5050('0x31')]);_0x10869f['filters']=_[_0x5050('0x33')](_0x10869f[_0x5050('0x34')],_0x10869f['query']);_0x1acce3[_0x5050('0x36')]=_[_0x5050('0x33')](_0x10869f[_0x5050('0x34')],qs[_0x5050('0x35')](_0x234c38[_0x5050('0x31')][_0x5050('0x35')]));_0x1acce3[_0x5050('0x36')]=_0x1acce3[_0x5050('0x36')]['length']?_0x1acce3[_0x5050('0x36')]:_0x10869f[_0x5050('0x34')];_0x1acce3[_0x5050('0x3a')]=qs[_0x5050('0x3b')](_0x234c38[_0x5050('0x31')][_0x5050('0x3b')]);_0x1acce3[_0x5050('0x3c')]=qs[_0x5050('0x32')](_[_0x5050('0x3d')](_0x234c38[_0x5050('0x31')],_0x10869f[_0x5050('0x32')]));_0x1acce3[_0x5050('0x3c')]=_[_0x5050('0x40')](_0x1acce3['where'],{'$or':[{'ListId':_0x139be6['id']},{'ListId':null}]});if(_0x234c38[_0x5050('0x31')][_0x5050('0x3e')]){_0x1acce3[_0x5050('0x3c')]=_['merge'](_0x1acce3[_0x5050('0x3c')],{'$or':_[_0x5050('0x2c')](_0x1acce3[_0x5050('0x36')],function(_0x560430){var _0x4d882f={};_0x4d882f[_0x560430]={'$like':'%'+_0x234c38[_0x5050('0x31')][_0x5050('0x3e')]+'%'};return _0x4d882f;})});}_0x1acce3=_[_0x5050('0x40')]({},_0x1acce3,_0x234c38[_0x5050('0x41')]);return db['CmCustomField'][_0x5050('0x98')](_0x1acce3);}})[_0x5050('0x25')](respondWithResult(_0x401645,null))[_0x5050('0x4a')](handleError(_0x401645,null));};exports[_0x5050('0x99')]=function(_0x2d930e,_0x277713){return db[_0x5050('0x69')][_0x5050('0x98')]({'where':{'ListId':null}})[_0x5050('0x25')](handleEntityNotFound(_0x277713,null))[_0x5050('0x25')](function(_0x59662e){return _0x59662e;})[_0x5050('0x25')](respondWithResult(_0x277713,null))[_0x5050('0x4a')](handleError(_0x277713,null));};exports[_0x5050('0x9a')]=function(_0x41f518,_0x3671fd,_0x3a97cc){return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x41f518[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x3671fd,null))[_0x5050('0x25')](function(_0x255b4a){if(_0x255b4a){return _0x255b4a['addAgents'](_0x41f518['body']['ids'],_[_0x5050('0x63')](_0x41f518[_0x5050('0x4b')],[_0x5050('0x5c'),'id'])||{})[_0x5050('0x9b')](function(_0x335e48){for(var _0x4036bc=0x0;_0x4036bc<_0x41f518[_0x5050('0x4b')][_0x5050('0x5c')]['length'];_0x4036bc+=0x1){socket['emit'](_0x5050('0x9c'),{'UserId':Number(_0x41f518[_0x5050('0x4b')]['ids'][_0x4036bc]),'CmListId':Number(_0x41f518[_0x5050('0x47')]['id'])});}return _0x335e48;});}})[_0x5050('0x25')](respondWithResult(_0x3671fd,null))[_0x5050('0x4a')](handleError(_0x3671fd,null));};exports['removeAgents']=function(_0x4b7cc1,_0x3f5208,_0x480ef0){return db[_0x5050('0x2d')][_0x5050('0x49')]({'where':{'id':_0x4b7cc1['params']['id']}})['then'](handleEntityNotFound(_0x3f5208,null))[_0x5050('0x25')](function(_0x169b53){if(_0x169b53){return _0x169b53['removeAgents'](_0x4b7cc1[_0x5050('0x31')]['ids'])[_0x5050('0x25')](function(){if(_[_0x5050('0x5e')](_0x4b7cc1[_0x5050('0x31')][_0x5050('0x5c')])){for(var _0x42acb1=0x0;_0x42acb1<_0x4b7cc1[_0x5050('0x31')][_0x5050('0x5c')]['length'];_0x42acb1+=0x1){socket['emit'](_0x5050('0x9d'),{'UserId':Number(_0x4b7cc1[_0x5050('0x31')][_0x5050('0x5c')][_0x42acb1]),'CmListId':Number(_0x4b7cc1[_0x5050('0x47')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x4b7cc1[_0x5050('0x31')][_0x5050('0x5c')]),'CmListId':Number(_0x4b7cc1[_0x5050('0x47')]['id'])});}});}})[_0x5050('0x25')](respondWithStatusCode(_0x3f5208,null))[_0x5050('0x4a')](handleError(_0x3f5208,null));};exports['getAgents']=function(_0xe715a4,_0x1ffea1,_0x13f85c){var _0x4abcdc={};var _0x22cabb={};var _0x35e6a8;var _0x52766b;return db[_0x5050('0x2d')]['findOne']({'where':{'id':_0xe715a4[_0x5050('0x47')]['id']}})[_0x5050('0x25')](handleEntityNotFound(_0x1ffea1,null))[_0x5050('0x25')](function(_0x586599){if(_0x586599){_0x35e6a8=_0x586599;_0x22cabb[_0x5050('0x34')]=_[_0x5050('0x48')](db[_0x5050('0x9e')][_0x5050('0x2e')]);_0x22cabb['query']=_[_0x5050('0x48')](_0xe715a4[_0x5050('0x31')]);_0x22cabb[_0x5050('0x32')]=_[_0x5050('0x33')](_0x22cabb['model'],_0x22cabb[_0x5050('0x31')]);_0x4abcdc[_0x5050('0x36')]=_['intersection'](_0x22cabb[_0x5050('0x34')],qs[_0x5050('0x35')](_0xe715a4[_0x5050('0x31')]['fields']));_0x4abcdc[_0x5050('0x36')]=_0x4abcdc['attributes']['length']?_0x4abcdc[_0x5050('0x36')]:_0x22cabb[_0x5050('0x34')];_0x4abcdc[_0x5050('0x3a')]=qs['sort'](_0xe715a4[_0x5050('0x31')][_0x5050('0x3b')]);_0x4abcdc['where']=qs['filters'](_[_0x5050('0x3d')](_0xe715a4[_0x5050('0x31')],_0x22cabb[_0x5050('0x32')]));if(_0xe715a4[_0x5050('0x31')][_0x5050('0x3e')]){_0x4abcdc[_0x5050('0x3c')]=_[_0x5050('0x40')](_0x4abcdc[_0x5050('0x3c')],{'$or':_[_0x5050('0x2c')](_0x4abcdc['attributes'],function(_0x4f4033){var _0xeb95fa={};_0xeb95fa[_0x4f4033]={'$like':'%'+_0xe715a4[_0x5050('0x31')][_0x5050('0x3e')]+'%'};return _0xeb95fa;})});}_0x4abcdc=_[_0x5050('0x40')]({},_0x4abcdc,_0xe715a4['options']);return _0x35e6a8[_0x5050('0x9f')](_0x4abcdc);}})[_0x5050('0x25')](function(_0x25274c){if(_0x25274c){_0x52766b=_0x25274c[_0x5050('0x37')];if(!_0xe715a4[_0x5050('0x31')][_0x5050('0x38')](_0x5050('0x39'))){_0x4abcdc['limit']=qs['limit'](_0xe715a4[_0x5050('0x31')][_0x5050('0x1c')]);_0x4abcdc[_0x5050('0x1a')]=qs[_0x5050('0x1a')](_0xe715a4[_0x5050('0x31')]['offset']);}return _0x35e6a8[_0x5050('0x9f')](_0x4abcdc);}})[_0x5050('0x25')](function(_0x305785){if(_0x305785){return _0x305785?{'count':_0x52766b,'rows':_0x305785}:null;}})['then'](respondWithResult(_0x1ffea1,null))['catch'](handleError(_0x1ffea1,null));};function handleQuery(_0x2d83a6){logger[_0x5050('0xa0')](_0x2d83a6);return db[_0x5050('0x8b')][_0x5050('0x31')](_0x2d83a6)['spread'](function(_0x3efc4a){csv_results[_0x5050('0x64')](_0x3efc4a);})[_0x5050('0x4a')](function(_0x249c03){logger[_0x5050('0x28')](_0x249c03[_0x5050('0x67')]);});} \ No newline at end of file +var _0xa9f4=['addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','message','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','Lists','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','CmList','includeAll','findAll','rows','catch','keys','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','field','c.cf_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','format','setHeader','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields'];(function(_0x47f07d,_0x195757){var _0x3fbb32=function(_0xcc9fb8){while(--_0xcc9fb8){_0x47f07d['push'](_0x47f07d['shift']());}};_0x3fbb32(++_0x195757);}(_0xa9f4,0x158));var _0x4a9f=function(_0x4d5bc6,_0xf02808){_0x4d5bc6=_0x4d5bc6-0x0;var _0x5dd7ba=_0xa9f4[_0x4d5bc6];return _0x5dd7ba;};'use strict';var emlformat=require(_0x4a9f('0x0'));var rimraf=require(_0x4a9f('0x1'));var zipdir=require(_0x4a9f('0x2'));var jsonpatch=require(_0x4a9f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a9f('0x4'));var Mustache=require(_0x4a9f('0x5'));var util=require(_0x4a9f('0x6'));var path=require(_0x4a9f('0x7'));var sox=require(_0x4a9f('0x8'));var csv=require(_0x4a9f('0x9'));var ejs=require(_0x4a9f('0xa'));var fs=require('fs');var fs_extra=require(_0x4a9f('0xb'));var _=require(_0x4a9f('0xc'));var squel=require(_0x4a9f('0xd'));var crypto=require(_0x4a9f('0xe'));var jsforce=require(_0x4a9f('0xf'));var deskjs=require(_0x4a9f('0x10'));var toCsv=require(_0x4a9f('0x9'));var querystring=require(_0x4a9f('0x11'));var Papa=require(_0x4a9f('0x12'));var Redis=require(_0x4a9f('0x13'));var authService=require(_0x4a9f('0x14'));var qs=require(_0x4a9f('0x15'));var as=require(_0x4a9f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4a9f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a9f('0x18'))['db'];var csv_results;config[_0x4a9f('0x19')]=_[_0x4a9f('0x1a')](config[_0x4a9f('0x19')],{'host':_0x4a9f('0x1b'),'port':0x18eb});var socket=require(_0x4a9f('0x1c'))(new Redis(config['redis']));require(_0x4a9f('0x1d'))[_0x4a9f('0x1e')](socket);function respondWithStatusCode(_0x508395,_0x51c6a6){_0x51c6a6=_0x51c6a6||0xcc;return function(_0x34be7e){if(_0x34be7e){return _0x508395[_0x4a9f('0x1f')](_0x51c6a6);}return _0x508395[_0x4a9f('0x20')](_0x51c6a6)[_0x4a9f('0x21')]();};}function respondWithResult(_0x363248,_0x2b815f){_0x2b815f=_0x2b815f||0xc8;return function(_0x1e3fb9){if(_0x1e3fb9){return _0x363248[_0x4a9f('0x20')](_0x2b815f)['json'](_0x1e3fb9);}};}function respondWithFilteredResult(_0x1ef894,_0x2df0b6){return function(_0x3e9d71){if(_0x3e9d71){var _0x335783=typeof _0x2df0b6[_0x4a9f('0x22')]===_0x4a9f('0x23')&&typeof _0x2df0b6[_0x4a9f('0x24')]===_0x4a9f('0x23');var _0x5f1acd=_0x3e9d71['count'];var _0x3bb821=_0x335783?0x0:_0x2df0b6['offset'];var _0x4aacb4=_0x335783?_0x3e9d71[_0x4a9f('0x25')]:_0x2df0b6[_0x4a9f('0x22')]+_0x2df0b6[_0x4a9f('0x24')];var _0x3b5070;if(_0x4aacb4>=_0x5f1acd){_0x4aacb4=_0x5f1acd;_0x3b5070=0xc8;}else{_0x3b5070=0xce;}_0x1ef894[_0x4a9f('0x20')](_0x3b5070);return _0x1ef894[_0x4a9f('0x26')](_0x4a9f('0x27'),_0x3bb821+'-'+_0x4aacb4+'/'+_0x5f1acd)[_0x4a9f('0x28')](_0x3e9d71);}return null;};}function patchUpdates(_0x31a5c0){return function(_0x38ac8b){try{jsonpatch[_0x4a9f('0x29')](_0x38ac8b,_0x31a5c0,!![]);}catch(_0x267961){return BPromise[_0x4a9f('0x2a')](_0x267961);}return _0x38ac8b[_0x4a9f('0x2b')]();};}function saveUpdates(_0xa47835,_0xa1e6c4){return function(_0x6c75eb){if(_0x6c75eb){return _0x6c75eb[_0x4a9f('0x2c')](_0xa47835)[_0x4a9f('0x2d')](function(_0x17dcb0){return _0x17dcb0;});}return null;};}function removeEntity(_0x3ace9d,_0x4933db){return function(_0x5ef871){if(_0x5ef871){return _0x5ef871['destroy']()['then'](function(){var _0x4f5ef7=_0x5ef871['get']({'plain':!![]});var _0x226ba8=_0x4a9f('0x2e');return db[_0x4a9f('0x2f')]['destroy']({'where':{'type':_0x226ba8,'resourceId':_0x4f5ef7['id']}})['then'](function(){return _0x5ef871;});})[_0x4a9f('0x2d')](function(){_0x3ace9d[_0x4a9f('0x20')](0xcc)[_0x4a9f('0x21')]();});}};}function handleEntityNotFound(_0x362ef8,_0x42fcee){return function(_0x44cb0c){if(!_0x44cb0c){_0x362ef8[_0x4a9f('0x1f')](0x194);}return _0x44cb0c;};}function handleError(_0x182dc4,_0x15140f){_0x15140f=_0x15140f||0x1f4;return function(_0x147390){logger['error'](_0x147390[_0x4a9f('0x30')]);if(_0x147390[_0x4a9f('0x31')]){delete _0x147390[_0x4a9f('0x31')];}_0x182dc4['status'](_0x15140f)[_0x4a9f('0x32')](_0x147390);};}exports[_0x4a9f('0x33')]=function(_0x5c8eba,_0x74f71e){var _0x2f3ebb={},_0x45f2d0={},_0x459128={'count':0x0,'rows':[]};var _0x4db040=_[_0x4a9f('0x34')](db['CmList']['rawAttributes'],function(_0x15b867){return{'name':_0x15b867[_0x4a9f('0x35')],'type':_0x15b867['type'][_0x4a9f('0x36')]};});_0x45f2d0[_0x4a9f('0x37')]=_[_0x4a9f('0x34')](_0x4db040,'name');_0x45f2d0[_0x4a9f('0x38')]=_['keys'](_0x5c8eba[_0x4a9f('0x38')]);_0x45f2d0[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x45f2d0['model'],_0x45f2d0['query']);_0x2f3ebb['attributes']=_[_0x4a9f('0x3a')](_0x45f2d0['model'],qs[_0x4a9f('0x3b')](_0x5c8eba['query'][_0x4a9f('0x3b')]));_0x2f3ebb[_0x4a9f('0x3c')]=_0x2f3ebb[_0x4a9f('0x3c')]['length']?_0x2f3ebb[_0x4a9f('0x3c')]:_0x45f2d0[_0x4a9f('0x37')];if(!_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x2f3ebb['limit']=qs[_0x4a9f('0x24')](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x24')]);_0x2f3ebb[_0x4a9f('0x22')]=qs['offset'](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x2f3ebb[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x2f3ebb[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_['pick'](_0x5c8eba[_0x4a9f('0x38')],_0x45f2d0[_0x4a9f('0x39')]),_0x4db040);if(_0x5c8eba['query']['filter']){_0x2f3ebb[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x2f3ebb['where'],{'$or':_['map'](_0x4db040,function(_0x1aa4b4){if(_0x1aa4b4['type']!=='VIRTUAL'){var _0x31d19f={};_0x31d19f[_0x1aa4b4[_0x4a9f('0x31')]]={'$like':'%'+_0x5c8eba[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x31d19f;}})});}_0x2f3ebb=_['merge']({},_0x2f3ebb,_0x5c8eba[_0x4a9f('0x44')]);var _0x2d3cba={'where':_0x2f3ebb[_0x4a9f('0x41')]};return db[_0x4a9f('0x45')][_0x4a9f('0x25')](_0x2d3cba)[_0x4a9f('0x2d')](function(_0x4e5556){_0x459128[_0x4a9f('0x25')]=_0x4e5556;if(_0x5c8eba['query'][_0x4a9f('0x46')]){_0x2f3ebb['include']=[{'all':!![]}];}return db['CmList'][_0x4a9f('0x47')](_0x2f3ebb);})[_0x4a9f('0x2d')](function(_0x41b4c1){_0x459128[_0x4a9f('0x48')]=_0x41b4c1;return _0x459128;})[_0x4a9f('0x2d')](respondWithFilteredResult(_0x74f71e,_0x2f3ebb))[_0x4a9f('0x49')](handleError(_0x74f71e,null));};exports['show']=function(_0x5a5ae0,_0x12bacb){var _0x3be41e={'raw':![],'where':{'id':_0x5a5ae0['params']['id']}},_0x421dfe={};_0x421dfe[_0x4a9f('0x37')]=_[_0x4a9f('0x4a')](db['CmList'][_0x4a9f('0x4b')]);_0x421dfe[_0x4a9f('0x38')]=_['keys'](_0x5a5ae0[_0x4a9f('0x38')]);_0x421dfe[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x421dfe[_0x4a9f('0x37')],_0x421dfe[_0x4a9f('0x38')]);_0x3be41e[_0x4a9f('0x3c')]=_['intersection'](_0x421dfe[_0x4a9f('0x37')],qs['fields'](_0x5a5ae0[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x3be41e[_0x4a9f('0x3c')]=_0x3be41e[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x3be41e[_0x4a9f('0x3c')]:_0x421dfe['model'];if(_0x5a5ae0[_0x4a9f('0x38')][_0x4a9f('0x46')]){_0x3be41e[_0x4a9f('0x4d')]=[{'all':!![]}];}_0x3be41e=_[_0x4a9f('0x42')]({},_0x3be41e,_0x5a5ae0[_0x4a9f('0x44')]);return db['CmList'][_0x4a9f('0x4e')](_0x3be41e)[_0x4a9f('0x2d')](handleEntityNotFound(_0x12bacb,null))[_0x4a9f('0x2d')](respondWithResult(_0x12bacb,null))['catch'](handleError(_0x12bacb,null));};exports[_0x4a9f('0x4f')]=function(_0x3a9ab9,_0x3e0560){return db['CmList'][_0x4a9f('0x4f')](_0x3a9ab9[_0x4a9f('0x50')],{})[_0x4a9f('0x2d')](function(_0x8c9727){var _0x4f40ec=_0x3a9ab9[_0x4a9f('0x51')]['get']({'plain':!![]});if(!_0x4f40ec)throw new Error(_0x4a9f('0x52'));if(_0x4f40ec['role']===_0x4a9f('0x51')){var _0x4ef450=_0x8c9727[_0x4a9f('0x53')]({'plain':!![]});var _0x312881=_0x4a9f('0x2e');return db[_0x4a9f('0x54')][_0x4a9f('0x4e')]({'where':{'name':_0x312881,'userProfileId':_0x4f40ec[_0x4a9f('0x55')]},'raw':!![]})[_0x4a9f('0x2d')](function(_0x23144c){if(_0x23144c&&_0x23144c[_0x4a9f('0x56')]===0x0){return db[_0x4a9f('0x2f')][_0x4a9f('0x4f')]({'name':_0x4ef450['name'],'resourceId':_0x4ef450['id'],'type':_0x23144c[_0x4a9f('0x31')],'sectionId':_0x23144c['id']},{})['then'](function(){return _0x8c9727;});}else{return _0x8c9727;}})['catch'](function(_0x28fb9a){logger[_0x4a9f('0x57')](_0x4a9f('0x58'),_0x28fb9a);throw _0x28fb9a;});}return _0x8c9727;})['then'](respondWithResult(_0x3e0560,0xc9))['catch'](handleError(_0x3e0560,null));};exports[_0x4a9f('0x2c')]=function(_0x56284c,_0x5db3c8){if(_0x56284c['body']['id']){delete _0x56284c['body']['id'];}return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x56284c[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x5db3c8,null))[_0x4a9f('0x2d')](saveUpdates(_0x56284c[_0x4a9f('0x50')],null))[_0x4a9f('0x2d')](respondWithResult(_0x5db3c8,null))[_0x4a9f('0x49')](handleError(_0x5db3c8,null));};exports[_0x4a9f('0x5a')]=function(_0x486cf1,_0x672f5c){return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x486cf1[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x672f5c,null))['then'](removeEntity(_0x672f5c,null))['catch'](handleError(_0x672f5c,null));};exports[_0x4a9f('0x5b')]=function(_0x39457c,_0x3bc123){return db['CmList'][_0x4a9f('0x5b')]()[_0x4a9f('0x2d')](respondWithResult(_0x3bc123,null))[_0x4a9f('0x49')](handleError(_0x3bc123,null));};exports[_0x4a9f('0x5c')]=function(_0x4429f9,_0x15b671,_0xbd71cf){if(_0x4429f9[_0x4a9f('0x50')]['id']){delete _0x4429f9[_0x4a9f('0x50')]['id'];}return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x4429f9[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x15b671,null))[_0x4a9f('0x2d')](function(_0x4d9434){if(_0x4d9434){_0x4429f9[_0x4a9f('0x50')]['ListId']=_0x4d9434['id'];return db[_0x4a9f('0x5d')]['create'](_0x4429f9[_0x4a9f('0x50')]);}})[_0x4a9f('0x2d')](respondWithResult(_0x15b671,null))['catch'](handleError(_0x15b671,null));};exports[_0x4a9f('0x5e')]=function(_0x52689b,_0x38913a,_0x51fbeb){var _0x13d74f={'raw':![],'where':{}};var _0x388322={};var _0x3e0b5d={'count':0x0,'rows':[]};return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x52689b[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x38913a,null))[_0x4a9f('0x2d')](function(_0x48a049){if(_0x48a049){_0x388322[_0x4a9f('0x37')]=_['keys'](db[_0x4a9f('0x5d')][_0x4a9f('0x4b')]);_0x388322[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x52689b['query']);_0x388322[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x388322[_0x4a9f('0x37')],_0x388322[_0x4a9f('0x38')]);_0x13d74f[_0x4a9f('0x3c')]=_[_0x4a9f('0x3a')](_0x388322['model'],qs[_0x4a9f('0x3b')](_0x52689b['query'][_0x4a9f('0x3b')]));_0x13d74f['attributes']=_0x13d74f[_0x4a9f('0x3c')]['length']?_0x13d74f[_0x4a9f('0x3c')]:_0x388322[_0x4a9f('0x37')];if(!_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x3d')]('nolimit')){_0x13d74f[_0x4a9f('0x24')]=qs[_0x4a9f('0x24')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x24')]);_0x13d74f[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x13d74f[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x13d74f[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_[_0x4a9f('0x60')](_0x52689b['query'],_0x388322[_0x4a9f('0x39')]));_0x13d74f[_0x4a9f('0x41')]['ListId']=_0x48a049['id'];if(_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x43')]){_0x13d74f[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x13d74f[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x13d74f[_0x4a9f('0x3c')],function(_0x4d04ea){var _0x262d46={};_0x262d46[_0x4d04ea]={'$like':'%'+_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x262d46;})});}_0x13d74f=_['merge']({},_0x13d74f,_0x52689b[_0x4a9f('0x44')]);return db[_0x4a9f('0x5d')]['count']({'where':_0x13d74f[_0x4a9f('0x41')]})[_0x4a9f('0x2d')](function(_0x2750b6){_0x3e0b5d[_0x4a9f('0x25')]=_0x2750b6;if(_0x52689b[_0x4a9f('0x38')][_0x4a9f('0x46')]){_0x13d74f[_0x4a9f('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x4a9f('0x47')](_0x13d74f);})[_0x4a9f('0x2d')](function(_0x3eda1c){_0x3e0b5d[_0x4a9f('0x48')]=_0x3eda1c;return _0x3e0b5d;});}})[_0x4a9f('0x2d')](respondWithFilteredResult(_0x38913a,_0x13d74f))[_0x4a9f('0x49')](handleError(_0x38913a,null));};exports[_0x4a9f('0x61')]=function(_0x573641,_0x4a7e18,_0xedb9be){return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x573641[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x4a7e18,null))[_0x4a9f('0x2d')](function(_0x45d6a1){if(_0x45d6a1){return _0x45d6a1['removeDispositions'](_0x573641[_0x4a9f('0x38')][_0x4a9f('0x62')]);}})[_0x4a9f('0x2d')](respondWithStatusCode(_0x4a7e18,null))[_0x4a9f('0x49')](handleError(_0x4a7e18,null));};exports[_0x4a9f('0x63')]=function(_0x994ecf,_0x4b7ffe,_0x183843){return db[_0x4a9f('0x45')]['find']({'where':{'id':_0x994ecf[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b7ffe,null))[_0x4a9f('0x2d')](function(_0x4f5f82){if(_0x4f5f82){var _0xd7ea0a=[];var _0x593494={'success':[],'errors':[]};return db[_0x4a9f('0x64')][_0x4a9f('0x5b')]()['then'](function(_0xe22ec9){if(_0x994ecf[_0x4a9f('0x50')]['tags']&&_['isArray'](_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')])){if(_0x994ecf['body'][_0x4a9f('0x65')][_0x4a9f('0x4c')]){_0x994ecf['body'][_0x4a9f('0x65')]=_0x994ecf[_0x4a9f('0x50')]['tags'][_0x4a9f('0x66')](';')+';';}else{_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')]=null;}}else{_0x994ecf[_0x4a9f('0x50')][_0x4a9f('0x65')]=null;}if(_0x994ecf[_0x4a9f('0x50')]&&_[_0x4a9f('0x67')](_0x994ecf[_0x4a9f('0x50')])){for(var _0x14af1e=0x0;_0x14af1e<_0x994ecf[_0x4a9f('0x50')]['length'];_0x14af1e+=0x1){_0x994ecf[_0x4a9f('0x50')][_0x14af1e]['ListId']=_0x994ecf[_0x4a9f('0x59')]['id'];_0xd7ea0a[_0x4a9f('0x68')](_0x994ecf['body'][_0x14af1e]);}return BPromise[_0x4a9f('0x69')](_0xd7ea0a,function(_0xe10db2){return db[_0x4a9f('0x64')][_0x4a9f('0x4f')](_[_0x4a9f('0x6a')](_0xe10db2,[_0x4a9f('0x62'),'id'])||{},{'fields':_[_0x4a9f('0x4a')](_0xe22ec9),'raw':!![]})[_0x4a9f('0x2d')](function(_0x4652c3){_0x593494[_0x4a9f('0x6b')][_0x4a9f('0x68')](_0x4652c3['dataValues']);})[_0x4a9f('0x49')](function(_0x1d2a71){_0x593494[_0x4a9f('0x6c')][_0x4a9f('0x68')]({'data':_0xe10db2,'error':_0x1d2a71['message']});});})[_0x4a9f('0x2d')](function(_0x52497e){return _0x593494;})['catch'](function(_0x3af7cf){return _0x3af7cf;});}else{_0x4b7ffe['status'](0x190)[_0x4a9f('0x28')]({'message':_0x4a9f('0x6d')});}});}})['then'](respondWithResult(_0x4b7ffe,null))[_0x4a9f('0x49')](handleError(_0x4b7ffe,null));};exports['getContacts']=function(_0x5c6524,_0xcd3db,_0x3b6000){var _0x29ce23;return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x5c6524[_0x4a9f('0x59')]['id']},'include':[{'model':db[_0x4a9f('0x6e')],'as':_0x4a9f('0x6f')}]})[_0x4a9f('0x2d')](handleEntityNotFound(_0xcd3db,null))[_0x4a9f('0x2d')](function(_0x18ff8c){if(_0x18ff8c){_0x29ce23=_0x18ff8c;return db[_0x4a9f('0x64')]['rawAttributes'];}})[_0x4a9f('0x2d')](function(_0x2fd432){if(_0x2fd432){var _0x50f9af={};var _0x41535c={};_0x41535c[_0x4a9f('0x37')]=_[_0x4a9f('0x70')](_[_0x4a9f('0x4a')](_0x2fd432),_[_0x4a9f('0x34')](_0x29ce23['CustomFields'],function(_0x2b1256){return util['format'](_0x4a9f('0x71'),_0x2b1256['id']);}));_0x41535c[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x5c6524[_0x4a9f('0x38')]);_0x41535c[_0x4a9f('0x39')]=_['intersection'](_0x41535c[_0x4a9f('0x37')],_0x41535c['query']);_0x50f9af['attributes']=_[_0x4a9f('0x3a')](_0x41535c['model'],qs[_0x4a9f('0x3b')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x50f9af[_0x4a9f('0x3c')]=_0x50f9af[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x50f9af['attributes']:_0x41535c['model'];if(!_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x50f9af['limit']=qs[_0x4a9f('0x24')](_0x5c6524[_0x4a9f('0x38')]['limit']);_0x50f9af[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x22')]);}_0x50f9af[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x50f9af[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_['pick'](_0x5c6524['query'],_0x41535c['filters']));_0x50f9af['raw']=!![];if(_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x43')]){_0x50f9af[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x50f9af[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x50f9af['attributes'],function(_0xc6083a){var _0x55c5d4={};_0x55c5d4[_0xc6083a]={'$like':'%'+_0x5c6524[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x55c5d4;})});}_0x50f9af=_[_0x4a9f('0x42')]({},_0x50f9af,_0x5c6524[_0x4a9f('0x44')]);return _0x29ce23['getContacts'](_0x50f9af);}})[_0x4a9f('0x2d')](respondWithResult(_0xcd3db,null))[_0x4a9f('0x49')](handleError(_0xcd3db,null));};exports[_0x4a9f('0x72')]=function(_0x1330f1,_0x2b0218,_0x58f843){var _0x450890;var _0x491f52;var _0x141951;var _0x240cd2=_0x1330f1[_0x4a9f('0x59')]['id'];csv_results=[];return db[_0x4a9f('0x73')][_0x4a9f('0x47')]({'attributes':['id',_0x4a9f('0x31')],'raw':!![],'order':[_0x4a9f('0x74')]})['then'](function(_0x5092e4){_0x450890=_0x5092e4;var _0x25eaa2=_[_0x4a9f('0x4a')](db['CmContact'][_0x4a9f('0x4b')]);return db[_0x4a9f('0x6e')][_0x4a9f('0x47')]({'raw':!![],'attributes':['id',_0x4a9f('0x75')]})['then'](function(_0x1514bc){_0x491f52=_0x1514bc;var _0x445ca5=squel['select']()[_0x4a9f('0x3b')](_0x25eaa2)[_0x4a9f('0x76')](_0x4a9f('0x77'),'c')[_0x4a9f('0x41')](_0x4a9f('0x78'),_0x240cd2)[_0x4a9f('0x41')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x4ee8b6=0x0;_0x4ee8b6<_0x491f52['length'];_0x4ee8b6++){_0x445ca5[_0x4a9f('0x79')](_0x4a9f('0x7a')+_0x491f52[_0x4ee8b6]['id'],'customField_'+_0x491f52[_0x4ee8b6]['alias']);}for(var _0x4ee8b6=0x0;_0x4ee8b6<_0x450890[_0x4a9f('0x4c')];_0x4ee8b6++){_0x445ca5[_0x4a9f('0x79')](squel[_0x4a9f('0x7b')]()[_0x4a9f('0x79')](_0x4a9f('0x7c'))[_0x4a9f('0x76')]('cm_contact_has_items')['where'](_0x4a9f('0x7d'),_0x450890[_0x4ee8b6]['id'])[_0x4a9f('0x41')](_0x4a9f('0x7e')),_0x4a9f('0x7f')+_0x450890[_0x4ee8b6][_0x4a9f('0x31')]);_0x445ca5[_0x4a9f('0x79')](squel[_0x4a9f('0x7b')]()[_0x4a9f('0x79')]('description')[_0x4a9f('0x76')](_0x4a9f('0x80'))[_0x4a9f('0x41')](_0x4a9f('0x7d'),_0x450890[_0x4ee8b6]['id'])[_0x4a9f('0x41')](_0x4a9f('0x7e')),_0x4a9f('0x81')+_0x450890[_0x4ee8b6][_0x4a9f('0x31')]);}var _0x47b799=[];_0x47b799['push'](_0x445ca5[_0x4a9f('0x82')]());BPromise[_0x4a9f('0x69')](_0x47b799,handleQuery)[_0x4a9f('0x2d')](function(_0x212a0f){handleQuery(_0x445ca5['toString']());var _0x36db09=csv_results[0x0];if(!_[_0x4a9f('0x83')](_0x36db09)){var _0x2fd7c7=toCsv(_0x36db09);var _0x5d5755=Date[_0x4a9f('0x84')]();fs['writeFileSync'](util[_0x4a9f('0x85')]('/tmp/list_%d_%s.csv',_0x240cd2,_0x5d5755),_0x2fd7c7);_0x2b0218[_0x4a9f('0x86')]('Content-disposition',_0x4a9f('0x87')+util['format']('list_%d_%s.csv',_0x240cd2,_0x5d5755));_0x2b0218['setHeader'](_0x4a9f('0x88'),_0x4a9f('0x89'));return _0x2b0218[_0x4a9f('0x8a')](util[_0x4a9f('0x85')](_0x4a9f('0x8b'),_0x240cd2,_0x5d5755));}else{return _0x2b0218[_0x4a9f('0x1f')](0xcc);}});});});};exports[_0x4a9f('0x8c')]=function(_0x4cbe1c,_0x2c19bf,_0x1e1386){var _0x573f78;delete _0x4cbe1c[_0x4a9f('0x50')]['id'];return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x4cbe1c[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x2c19bf,null))[_0x4a9f('0x2d')](function(_0xc5ff4f){if(_0xc5ff4f){return db[_0x4a9f('0x8d')][_0x4a9f('0x8e')](function(_0x4f6245){return db[_0x4a9f('0x6e')]['create'](_0x4cbe1c[_0x4a9f('0x50')],{'transaction':_0x4f6245})[_0x4a9f('0x2d')](function(_0x2c76b4){_0x573f78=_0x2c76b4;return _0xc5ff4f['addCustomFields'](_0x2c76b4,{'transaction':_0x4f6245});})['then'](function(){var _0x31a684={'type':db[_0x4a9f('0x8f')]['TEXT'],'transaction':_0x4f6245};switch(_0x4cbe1c['body'][_0x4a9f('0x90')]){case _0x4a9f('0x91'):_0x31a684[_0x4a9f('0x90')]=db['Sequelize'][_0x4a9f('0x92')];break;case _0x4a9f('0x93'):_0x31a684[_0x4a9f('0x90')]=db[_0x4a9f('0x8f')][_0x4a9f('0x94')];break;case _0x4a9f('0x95'):_0x31a684[_0x4a9f('0x90')]=db[_0x4a9f('0x8f')][_0x4a9f('0x96')];_0x31a684[_0x4a9f('0x97')]=![];break;default:}return db[_0x4a9f('0x8d')][_0x4a9f('0x98')][_0x4a9f('0x99')](_0x4a9f('0x77'),util[_0x4a9f('0x85')](_0x4a9f('0x9a'),_0x573f78['id']),_0x31a684);})[_0x4a9f('0x2d')](function(){return _0x573f78;});});}})[_0x4a9f('0x2d')](respondWithResult(_0x2c19bf,null))[_0x4a9f('0x49')](handleError(_0x2c19bf,null));};exports['getCustomFields']=function(_0x35aabc,_0x12a27b,_0x1f4df6){var _0x331211={};var _0x3e264e={};var _0x318f39;var _0x1e184c;return db[_0x4a9f('0x45')]['findOne']({'where':{'id':_0x35aabc[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x12a27b,null))[_0x4a9f('0x2d')](function(_0x201a05){if(_0x201a05){_0x318f39=_0x201a05;_0x3e264e['model']=_['keys'](db[_0x4a9f('0x6e')]['rawAttributes']);_0x3e264e[_0x4a9f('0x38')]=_[_0x4a9f('0x4a')](_0x35aabc[_0x4a9f('0x38')]);_0x3e264e[_0x4a9f('0x39')]=_[_0x4a9f('0x3a')](_0x3e264e[_0x4a9f('0x37')],_0x3e264e[_0x4a9f('0x38')]);_0x331211[_0x4a9f('0x3c')]=_[_0x4a9f('0x3a')](_0x3e264e['model'],qs[_0x4a9f('0x3b')](_0x35aabc['query']['fields']));_0x331211[_0x4a9f('0x3c')]=_0x331211[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x331211[_0x4a9f('0x3c')]:_0x3e264e['model'];_0x331211[_0x4a9f('0x3f')]=qs['sort'](_0x35aabc[_0x4a9f('0x38')][_0x4a9f('0x40')]);_0x331211[_0x4a9f('0x41')]=qs['filters'](_[_0x4a9f('0x60')](_0x35aabc[_0x4a9f('0x38')],_0x3e264e[_0x4a9f('0x39')]));_0x331211['where']=_[_0x4a9f('0x42')](_0x331211[_0x4a9f('0x41')],{'$or':[{'ListId':_0x201a05['id']},{'ListId':null}]});if(_0x35aabc['query'][_0x4a9f('0x43')]){_0x331211[_0x4a9f('0x41')]=_[_0x4a9f('0x42')](_0x331211[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x331211[_0x4a9f('0x3c')],function(_0x256be8){var _0x28ee88={};_0x28ee88[_0x256be8]={'$like':'%'+_0x35aabc[_0x4a9f('0x38')][_0x4a9f('0x43')]+'%'};return _0x28ee88;})});}_0x331211=_[_0x4a9f('0x42')]({},_0x331211,_0x35aabc[_0x4a9f('0x44')]);return db[_0x4a9f('0x6e')][_0x4a9f('0x9b')](_0x331211);}})[_0x4a9f('0x2d')](respondWithResult(_0x12a27b,null))[_0x4a9f('0x49')](handleError(_0x12a27b,null));};exports[_0x4a9f('0x9c')]=function(_0x4769da,_0x37b30e){return db[_0x4a9f('0x6e')][_0x4a9f('0x9b')]({'where':{'ListId':null}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x37b30e,null))[_0x4a9f('0x2d')](function(_0x302761){return _0x302761;})[_0x4a9f('0x2d')](respondWithResult(_0x37b30e,null))[_0x4a9f('0x49')](handleError(_0x37b30e,null));};exports['addAgents']=function(_0x35fc13,_0x361bb4,_0x281c71){return db['CmList'][_0x4a9f('0x4e')]({'where':{'id':_0x35fc13[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x361bb4,null))['then'](function(_0x104071){if(_0x104071){return _0x104071[_0x4a9f('0x9d')](_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')],_['omit'](_0x35fc13[_0x4a9f('0x50')],[_0x4a9f('0x62'),'id'])||{})['spread'](function(_0x5715ac){for(var _0x3ce878=0x0;_0x3ce878<_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')]['length'];_0x3ce878+=0x1){socket[_0x4a9f('0x9e')](_0x4a9f('0x9f'),{'UserId':Number(_0x35fc13[_0x4a9f('0x50')][_0x4a9f('0x62')][_0x3ce878]),'CmListId':Number(_0x35fc13[_0x4a9f('0x59')]['id'])});}return _0x5715ac;});}})[_0x4a9f('0x2d')](respondWithResult(_0x361bb4,null))[_0x4a9f('0x49')](handleError(_0x361bb4,null));};exports[_0x4a9f('0xa0')]=function(_0x5742ba,_0x547c26,_0xd89bf8){return db[_0x4a9f('0x45')][_0x4a9f('0x4e')]({'where':{'id':_0x5742ba[_0x4a9f('0x59')]['id']}})['then'](handleEntityNotFound(_0x547c26,null))['then'](function(_0x5a2cdf){if(_0x5a2cdf){return _0x5a2cdf[_0x4a9f('0xa0')](_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')])[_0x4a9f('0x2d')](function(){if(_[_0x4a9f('0x67')](_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')])){for(var _0x34f1cb=0x0;_0x34f1cb<_0x5742ba['query'][_0x4a9f('0x62')][_0x4a9f('0x4c')];_0x34f1cb+=0x1){socket['emit'](_0x4a9f('0xa1'),{'UserId':Number(_0x5742ba[_0x4a9f('0x38')]['ids'][_0x34f1cb]),'CmListId':Number(_0x5742ba[_0x4a9f('0x59')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x5742ba[_0x4a9f('0x38')][_0x4a9f('0x62')]),'CmListId':Number(_0x5742ba[_0x4a9f('0x59')]['id'])});}});}})[_0x4a9f('0x2d')](respondWithStatusCode(_0x547c26,null))['catch'](handleError(_0x547c26,null));};exports[_0x4a9f('0xa2')]=function(_0x35ea62,_0x5d7166,_0x4d4ef1){var _0x577200={};var _0x5c6242={};var _0x1431ea;var _0x1354e4;return db[_0x4a9f('0x45')][_0x4a9f('0x5f')]({'where':{'id':_0x35ea62[_0x4a9f('0x59')]['id']}})[_0x4a9f('0x2d')](handleEntityNotFound(_0x5d7166,null))[_0x4a9f('0x2d')](function(_0xb22d07){if(_0xb22d07){_0x1431ea=_0xb22d07;_0x5c6242[_0x4a9f('0x37')]=_['keys'](db[_0x4a9f('0xa3')][_0x4a9f('0x4b')]);_0x5c6242['query']=_['keys'](_0x35ea62[_0x4a9f('0x38')]);_0x5c6242[_0x4a9f('0x39')]=_['intersection'](_0x5c6242['model'],_0x5c6242['query']);_0x577200['attributes']=_[_0x4a9f('0x3a')](_0x5c6242[_0x4a9f('0x37')],qs[_0x4a9f('0x3b')](_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x3b')]));_0x577200['attributes']=_0x577200[_0x4a9f('0x3c')][_0x4a9f('0x4c')]?_0x577200[_0x4a9f('0x3c')]:_0x5c6242[_0x4a9f('0x37')];_0x577200[_0x4a9f('0x3f')]=qs[_0x4a9f('0x40')](_0x35ea62[_0x4a9f('0x38')]['sort']);_0x577200[_0x4a9f('0x41')]=qs[_0x4a9f('0x39')](_[_0x4a9f('0x60')](_0x35ea62[_0x4a9f('0x38')],_0x5c6242[_0x4a9f('0x39')]));if(_0x35ea62[_0x4a9f('0x38')]['filter']){_0x577200['where']=_[_0x4a9f('0x42')](_0x577200[_0x4a9f('0x41')],{'$or':_[_0x4a9f('0x34')](_0x577200[_0x4a9f('0x3c')],function(_0x383fa8){var _0x68199={};_0x68199[_0x383fa8]={'$like':'%'+_0x35ea62['query']['filter']+'%'};return _0x68199;})});}_0x577200=_['merge']({},_0x577200,_0x35ea62['options']);return _0x1431ea['getAgents'](_0x577200);}})[_0x4a9f('0x2d')](function(_0x1a114a){if(_0x1a114a){_0x1354e4=_0x1a114a[_0x4a9f('0x4c')];if(!_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x3d')](_0x4a9f('0x3e'))){_0x577200['limit']=qs[_0x4a9f('0x24')](_0x35ea62['query'][_0x4a9f('0x24')]);_0x577200[_0x4a9f('0x22')]=qs[_0x4a9f('0x22')](_0x35ea62[_0x4a9f('0x38')][_0x4a9f('0x22')]);}return _0x1431ea['getAgents'](_0x577200);}})[_0x4a9f('0x2d')](function(_0x43beb6){if(_0x43beb6){return _0x43beb6?{'count':_0x1354e4,'rows':_0x43beb6}:null;}})[_0x4a9f('0x2d')](respondWithResult(_0x5d7166,null))[_0x4a9f('0x49')](handleError(_0x5d7166,null));};function handleQuery(_0x1ba961){logger[_0x4a9f('0xa4')](_0x1ba961);return db[_0x4a9f('0x8d')][_0x4a9f('0x38')](_0x1ba961)[_0x4a9f('0xa5')](function(_0x1cbf00){csv_results[_0x4a9f('0x68')](_0x1cbf00);})['catch'](function(_0x111084){logger[_0x4a9f('0x57')](_0x111084[_0x4a9f('0xa6')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ac91ea8..f5d8c23 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x22bedd,_0x351e57){_0x22bedd=_0x22bedd-0x0;var _0x16743b=_0x326f[_0x22bedd];return _0x16743b;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0xb4bb28,_0x26ae09){_0xb4bb28=_0xb4bb28-0x0;var _0x49a874=_0xe14b[_0xb4bb28];return _0x49a874;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('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 13de666..78cda13 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 _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x59c4aa,_0xa92f2b){var _0x2dd775=function(_0x1ecfb6){while(--_0x1ecfb6){_0x59c4aa['push'](_0x59c4aa['shift']());}};_0x2dd775(++_0xa92f2b);}(_0x22fb,0x192));var _0xb22f=function(_0x516599,_0x37741d){_0x516599=_0x516599-0x0;var _0x25b164=_0x22fb[_0x516599];return _0x25b164;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x4ba229,_0x3d7231){var _0x355980=function(_0x537a1e){while(--_0x537a1e){_0x4ba229['push'](_0x4ba229['shift']());}};_0x355980(++_0x3d7231);}(_0x22fb,0x192));var _0xb22f=function(_0x5b652e,_0x2ee5d8){_0x5b652e=_0x5b652e-0x0;var _0x583519=_0x22fb[_0x5b652e];return _0x583519;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 440cc98..110549b 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 _0x7fae=['socket.io-emitter','./cmList.socket','register','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x32ef47,_0x34e241){var _0x53066a=function(_0x560ea5){while(--_0x560ea5){_0x32ef47['push'](_0x32ef47['shift']());}};_0x53066a(++_0x34e241);}(_0x7fae,0xb0));var _0xe7fa=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7fae[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fa('0x0'));var BPromise=require(_0xe7fa('0x1'));var rs=require(_0xe7fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fa('0x3'))['db'];var utils=require(_0xe7fa('0x4'));var logger=require(_0xe7fa('0x5'))(_0xe7fa('0x6'));var config=require(_0xe7fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe7fa('0x8')][_0xe7fa('0x9')]({'port':0x232a});config[_0xe7fa('0xa')]=_[_0xe7fa('0xb')](config[_0xe7fa('0xa')],{'host':_0xe7fa('0xc'),'port':0x18eb});var socket=require(_0xe7fa('0xd'))(new Redis(config[_0xe7fa('0xa')]));require(_0xe7fa('0xe'))[_0xe7fa('0xf')](socket);function respondWithRpcPromise(_0x49cf44,_0x46b1b8,_0x16ce1d){return new BPromise(function(_0x5f037d,_0x4ad5e1){return client['request'](_0x49cf44,_0x16ce1d)[_0xe7fa('0x10')](function(_0x362399){logger['info']('CmList,\x20%s,\x20%s',_0x46b1b8,_0xe7fa('0x11'));logger[_0xe7fa('0x12')](_0xe7fa('0x13'),_0x46b1b8,_0xe7fa('0x11'),JSON[_0xe7fa('0x14')](_0x362399));if(_0x362399[_0xe7fa('0x15')]){if(_0x362399[_0xe7fa('0x15')]['code']===0x1f4){logger['error'](_0xe7fa('0x16'),_0x46b1b8,_0x362399[_0xe7fa('0x15')][_0xe7fa('0x17')]);return _0x4ad5e1(_0x362399['error'][_0xe7fa('0x17')]);}logger['error'](_0xe7fa('0x16'),_0x46b1b8,_0x362399[_0xe7fa('0x15')][_0xe7fa('0x17')]);return _0x5f037d(_0x362399[_0xe7fa('0x15')][_0xe7fa('0x17')]);}else{logger[_0xe7fa('0x18')]('CmList,\x20%s,\x20%s',_0x46b1b8,_0xe7fa('0x11'));_0x5f037d(_0x362399[_0xe7fa('0x19')][_0xe7fa('0x17')]);}})[_0xe7fa('0x1a')](function(_0x2d2c11){logger[_0xe7fa('0x15')](_0xe7fa('0x16'),_0x46b1b8,_0x2d2c11);_0x4ad5e1(_0x2d2c11);});});} \ No newline at end of file +var _0x2826=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2826,0x99));var _0x6282=function(_0x59481b,_0x4c7624){_0x59481b=_0x59481b-0x0;var _0x55e559=_0x2826[_0x59481b];return _0x55e559;};'use strict';var _=require(_0x6282('0x0'));var util=require(_0x6282('0x1'));var moment=require(_0x6282('0x2'));var BPromise=require(_0x6282('0x3'));var rs=require(_0x6282('0x4'));var fs=require('fs');var Redis=require(_0x6282('0x5'));var db=require(_0x6282('0x6'))['db'];var utils=require(_0x6282('0x7'));var logger=require(_0x6282('0x8'))(_0x6282('0x9'));var config=require(_0x6282('0xa'));var jayson=require(_0x6282('0xb'));var client=jayson['client'][_0x6282('0xc')]({'port':0x232a});config[_0x6282('0xd')]=_[_0x6282('0xe')](config['redis'],{'host':_0x6282('0xf'),'port':0x18eb});var socket=require(_0x6282('0x10'))(new Redis(config[_0x6282('0xd')]));require(_0x6282('0x11'))[_0x6282('0x12')](socket);function respondWithRpcPromise(_0xb743f7,_0x211afe,_0x1142f8){return new BPromise(function(_0x404990,_0x4577a6){return client[_0x6282('0x13')](_0xb743f7,_0x1142f8)['then'](function(_0x2c69c6){logger[_0x6282('0x14')](_0x6282('0x15'),_0x211afe,_0x6282('0x16'));logger[_0x6282('0x17')](_0x6282('0x18'),_0x211afe,_0x6282('0x16'),JSON[_0x6282('0x19')](_0x2c69c6));if(_0x2c69c6[_0x6282('0x1a')]){if(_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1b')]===0x1f4){logger[_0x6282('0x1a')]('CmList,\x20%s,\x20%s',_0x211afe,_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1c')]);return _0x4577a6(_0x2c69c6[_0x6282('0x1a')]['message']);}logger[_0x6282('0x1a')](_0x6282('0x15'),_0x211afe,_0x2c69c6[_0x6282('0x1a')][_0x6282('0x1c')]);return _0x404990(_0x2c69c6['error'][_0x6282('0x1c')]);}else{logger[_0x6282('0x14')](_0x6282('0x15'),_0x211afe,_0x6282('0x16'));_0x404990(_0x2c69c6[_0x6282('0x1d')][_0x6282('0x1c')]);}})[_0x6282('0x1e')](function(_0x13b3e8){logger['error'](_0x6282('0x15'),_0x211afe,_0x13b3e8);_0x4577a6(_0x13b3e8);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ce95abe..2be8891 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 _0xdf6a=['length','cmList:','./cmList.events','save','update','emit','register'];(function(_0x4f37d4,_0x5907d2){var _0x5f1efe=function(_0x5afebd){while(--_0x5afebd){_0x4f37d4['push'](_0x4f37d4['shift']());}};_0x5f1efe(++_0x5907d2);}(_0xdf6a,0x80));var _0xadf6=function(_0x4d7caf,_0x27c696){_0x4d7caf=_0x4d7caf-0x0;var _0x159edb=_0xdf6a[_0x4d7caf];return _0x159edb;};'use strict';var CmListEvents=require(_0xadf6('0x0'));var events=[_0xadf6('0x1'),'remove',_0xadf6('0x2')];function createListener(_0x334043,_0x7c5503){return function(_0x41ad5a){_0x7c5503[_0xadf6('0x3')](_0x334043,_0x41ad5a);};}function removeListener(_0xc8a5ab,_0x1f0627){return function(){CmListEvents['removeListener'](_0xc8a5ab,_0x1f0627);};}exports[_0xadf6('0x4')]=function(_0x5874d0){for(var _0x2406d5=0x0,_0x3488e9=events[_0xadf6('0x5')];_0x2406d5<_0x3488e9;_0x2406d5++){var _0x4ef349=events[_0x2406d5];var _0x2f11ab=createListener(_0xadf6('0x6')+_0x4ef349,_0x5874d0);CmListEvents['on'](_0x4ef349,_0x2f11ab);}}; \ No newline at end of file +var _0x9584=['register','length','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x3af681,_0x25f332){var _0x5d26b2=function(_0x4fefa1){while(--_0x4fefa1){_0x3af681['push'](_0x3af681['shift']());}};_0x5d26b2(++_0x25f332);}(_0x9584,0x1cb));var _0x4958=function(_0x12e24d,_0x480bfa){_0x12e24d=_0x12e24d-0x0;var _0x22a6cb=_0x9584[_0x12e24d];return _0x22a6cb;};'use strict';var CmListEvents=require(_0x4958('0x0'));var events=[_0x4958('0x1'),_0x4958('0x2'),'update'];function createListener(_0x3414c7,_0x46cafa){return function(_0x468bb8){_0x46cafa[_0x4958('0x3')](_0x3414c7,_0x468bb8);};}function removeListener(_0x5023cc,_0x5f36a0){return function(){CmListEvents[_0x4958('0x4')](_0x5023cc,_0x5f36a0);};}exports[_0x4958('0x5')]=function(_0x4c28ea){for(var _0x3749a0=0x0,_0x2a902c=events[_0x4958('0x6')];_0x3749a0<_0x2a902c;_0x3749a0++){var _0x3c32fb=events[_0x3749a0];var _0x55574e=createListener(_0x4958('0x7')+_0x3c32fb,_0x4c28ea);CmListEvents['on'](_0x3c32fb,_0x55574e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b1364df..497b340 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 _0x4d3a=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id'];(function(_0x16d76d,_0x20cfb1){var _0x4eb6d8=function(_0x52b92e){while(--_0x52b92e){_0x16d76d['push'](_0x16d76d['shift']());}};_0x4eb6d8(++_0x20cfb1);}(_0x4d3a,0x157));var _0xa4d3=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x4d3a[_0xbc2974];return _0x3a5b4f;};'use strict';var multer=require('multer');var util=require(_0xa4d3('0x0'));var path=require(_0xa4d3('0x1'));var timeout=require(_0xa4d3('0x2'));var express=require(_0xa4d3('0x3'));var router=express[_0xa4d3('0x4')]();var fs_extra=require(_0xa4d3('0x5'));var auth=require(_0xa4d3('0x6'));var interaction=require(_0xa4d3('0x7'));var config=require(_0xa4d3('0x8'));var controller=require('./cmList.controller');router[_0xa4d3('0x9')]('/',auth[_0xa4d3('0xa')](),controller[_0xa4d3('0xb')]);router[_0xa4d3('0x9')](_0xa4d3('0xc'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0xd')]);router[_0xa4d3('0x9')](_0xa4d3('0xe'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0xf')]);router[_0xa4d3('0x9')](_0xa4d3('0x10'),auth['isAuthenticated'](),controller[_0xa4d3('0x11')]);router[_0xa4d3('0x9')](_0xa4d3('0x12'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x13')]);router['get'](_0xa4d3('0x14'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x15')]);router[_0xa4d3('0x9')](_0xa4d3('0x16'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x17')]);router[_0xa4d3('0x9')](_0xa4d3('0x18'),auth['isAuthenticated'](),controller[_0xa4d3('0x19')]);router[_0xa4d3('0x9')]('/:id/users',auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x1a')]);router[_0xa4d3('0x1b')]('/',auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x1c')]);router[_0xa4d3('0x1b')](_0xa4d3('0x12'),auth['isAuthenticated'](),controller[_0xa4d3('0x1d')]);router[_0xa4d3('0x1b')](_0xa4d3('0x14'),auth['isAuthenticated'](),controller[_0xa4d3('0x1e')]);router[_0xa4d3('0x1b')]('/:id/fields',auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x1f')]);router[_0xa4d3('0x1b')](_0xa4d3('0x20'),auth['isAuthenticated'](),controller[_0xa4d3('0x21')]);router[_0xa4d3('0x22')](_0xa4d3('0x10'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x23')]);router[_0xa4d3('0x24')](_0xa4d3('0x10'),auth[_0xa4d3('0xa')](),controller[_0xa4d3('0x25')]);router[_0xa4d3('0x24')](_0xa4d3('0x12'),auth[_0xa4d3('0xa')](),controller['removeDispositions']);router[_0xa4d3('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xa4d3('0x26')]);module[_0xa4d3('0x27')]=router; \ No newline at end of file +var _0x28c8=['/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','removeDispositions','delete','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x357a01,_0x1e57d0){var _0x252c1f=function(_0x53c71f){while(--_0x53c71f){_0x357a01['push'](_0x357a01['shift']());}};_0x252c1f(++_0x1e57d0);}(_0x28c8,0x119));var _0x828c=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x28c8[_0x361d3f];return _0x320229;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x828c('0x0'));var timeout=require(_0x828c('0x1'));var express=require(_0x828c('0x2'));var router=express[_0x828c('0x3')]();var fs_extra=require(_0x828c('0x4'));var auth=require(_0x828c('0x5'));var interaction=require(_0x828c('0x6'));var config=require(_0x828c('0x7'));var controller=require(_0x828c('0x8'));router[_0x828c('0x9')]('/',auth[_0x828c('0xa')](),controller[_0x828c('0xb')]);router[_0x828c('0x9')](_0x828c('0xc'),auth['isAuthenticated'](),controller[_0x828c('0xd')]);router[_0x828c('0x9')](_0x828c('0xe'),auth[_0x828c('0xa')](),controller[_0x828c('0xf')]);router['get'](_0x828c('0x10'),auth[_0x828c('0xa')](),controller[_0x828c('0x11')]);router[_0x828c('0x9')]('/:id/dispositions',auth[_0x828c('0xa')](),controller[_0x828c('0x12')]);router[_0x828c('0x9')](_0x828c('0x13'),auth[_0x828c('0xa')](),controller[_0x828c('0x14')]);router['get'](_0x828c('0x15'),auth[_0x828c('0xa')](),controller[_0x828c('0x16')]);router[_0x828c('0x9')](_0x828c('0x17'),auth['isAuthenticated'](),controller[_0x828c('0x18')]);router[_0x828c('0x9')](_0x828c('0x19'),auth[_0x828c('0xa')](),controller[_0x828c('0x1a')]);router[_0x828c('0x1b')]('/',auth[_0x828c('0xa')](),controller['create']);router[_0x828c('0x1b')](_0x828c('0x1c'),auth[_0x828c('0xa')](),controller[_0x828c('0x1d')]);router[_0x828c('0x1b')]('/:id/contacts',auth[_0x828c('0xa')](),controller[_0x828c('0x1e')]);router[_0x828c('0x1b')]('/:id/fields',auth[_0x828c('0xa')](),controller[_0x828c('0x1f')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x828c('0x20')]);router[_0x828c('0x21')]('/:id',auth[_0x828c('0xa')](),controller[_0x828c('0x22')]);router['delete']('/:id',auth[_0x828c('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x828c('0x23')]);router[_0x828c('0x24')](_0x828c('0x19'),auth[_0x828c('0xa')](),controller[_0x828c('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c222571..a1be92f 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 _0x93a1=['VIRTUAL','getDataValue','field','STRING'];(function(_0x425313,_0x2f3405){var _0x34e07a=function(_0x4bc84b){while(--_0x4bc84b){_0x425313['push'](_0x425313['shift']());}};_0x34e07a(++_0x2f3405);}(_0x93a1,0x114));var _0x193a=function(_0x17cfd1,_0x3e3d8d){_0x17cfd1=_0x17cfd1-0x0;var _0x2abef8=_0x93a1[_0x17cfd1];return _0x2abef8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x193a('0x0')],'get':function(_0x59e0d0){return this[_0x193a('0x1')](_0x193a('0x2'));}},'field':{'type':Sequelize[_0x193a('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x193a('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x193a('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x3a00=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x3a00,0x17f));var _0x03a0=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3a00[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0x03a0('0x0'));module[_0x03a0('0x1')]={'name':{'type':Sequelize[_0x03a0('0x2')],'get':function(_0x58dc4b){return this[_0x03a0('0x3')](_0x03a0('0x4'));}},'field':{'type':Sequelize[_0x03a0('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x03a0('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 5ecf9da..60013b0 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 _0x7a54=['sox','to-csv','fs-extra','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','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x221c07,_0x471eed){var _0x3a00d4=function(_0x5c9240){while(--_0x5c9240){_0x221c07['push'](_0x221c07['shift']());}};_0x3a00d4(++_0x471eed);}(_0x7a54,0x106));var _0x47a5=function(_0x4c2753,_0x452fda){_0x4c2753=_0x4c2753-0x0;var _0x758fdd=_0x7a54[_0x4c2753];return _0x758fdd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));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=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','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','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x46b6fc,_0x2b7412){var _0x4c5cd3=function(_0x8dcfd8){while(--_0x8dcfd8){_0x46b6fc['push'](_0x46b6fc['shift']());}};_0x4c5cd3(++_0x2b7412);}(_0x7a54,0x106));var _0x47a5=function(_0x24de12,_0x56b68c){_0x24de12=_0x24de12-0x0;var _0x2747a5=_0x7a54[_0x24de12];return _0x2747a5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));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=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 71bdd2b..42ff83e 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 _0xadd2=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x531f56,_0x334fcc){var _0x2cd1d4=function(_0x12a368){while(--_0x12a368){_0x531f56['push'](_0x531f56['shift']());}};_0x2cd1d4(++_0x334fcc);}(_0xadd2,0x1ac));var _0x2add=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xadd2[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2add('0x0'));var util=require('util');var logger=require(_0x2add('0x1'))(_0x2add('0x2'));var moment=require(_0x2add('0x3'));var BPromise=require('bluebird');var rp=require(_0x2add('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var attributes=require(_0x2add('0x7'));module[_0x2add('0x8')]=function(_0x379084,_0x326be7){return _0x379084['define'](_0x2add('0x9'),attributes,{'tableName':_0x2add('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a85=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','api'];(function(_0x4694a0,_0x35b97f){var _0x38a2dc=function(_0x298039){while(--_0x298039){_0x4694a0['push'](_0x4694a0['shift']());}};_0x38a2dc(++_0x35b97f);}(_0x3a85,0x6a));var _0x53a8=function(_0x3767e7,_0x24ffc5){_0x3767e7=_0x3767e7-0x0;var _0x5742a4=_0x3a85[_0x3767e7];return _0x5742a4;};'use strict';var _=require('lodash');var util=require(_0x53a8('0x0'));var logger=require('../../config/logger')(_0x53a8('0x1'));var moment=require('moment');var BPromise=require(_0x53a8('0x2'));var rp=require(_0x53a8('0x3'));var fs=require('fs');var path=require(_0x53a8('0x4'));var rimraf=require(_0x53a8('0x5'));var config=require(_0x53a8('0x6'));var attributes=require(_0x53a8('0x7'));module[_0x53a8('0x8')]=function(_0x38ae94,_0x176388){return _0x38ae94[_0x53a8('0x9')](_0x53a8('0xa'),attributes,{'tableName':_0x53a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index e6558ab..65c19ee 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 _0x9e9a=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0xe70ec8,_0x4c2829){var _0x280996=function(_0x19a80e){while(--_0x19a80e){_0xe70ec8['push'](_0xe70ec8['shift']());}};_0x280996(++_0x4c2829);}(_0x9e9a,0x109));var _0xa9e9=function(_0x21f588,_0x3f63ae){_0x21f588=_0x21f588-0x0;var _0x3b28cb=_0x9e9a[_0x21f588];return _0x3b28cb;};'use strict';var _=require(_0xa9e9('0x0'));var util=require(_0xa9e9('0x1'));var moment=require('moment');var BPromise=require(_0xa9e9('0x2'));var rs=require(_0xa9e9('0x3'));var fs=require('fs');var Redis=require(_0xa9e9('0x4'));var db=require(_0xa9e9('0x5'))['db'];var utils=require(_0xa9e9('0x6'));var logger=require('../../config/logger')(_0xa9e9('0x7'));var config=require(_0xa9e9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479776,_0x1929e0,_0x455710){return new BPromise(function(_0x5c2981,_0x2988f5){return client[_0xa9e9('0xa')](_0x479776,_0x455710)[_0xa9e9('0xb')](function(_0x5e39ad){logger['info'](_0xa9e9('0xc'),_0x1929e0,_0xa9e9('0xd'));logger['debug'](_0xa9e9('0xe'),_0x1929e0,_0xa9e9('0xd'),JSON[_0xa9e9('0xf')](_0x5e39ad));if(_0x5e39ad[_0xa9e9('0x10')]){if(_0x5e39ad[_0xa9e9('0x10')][_0xa9e9('0x11')]===0x1f4){logger[_0xa9e9('0x10')](_0xa9e9('0xc'),_0x1929e0,_0x5e39ad['error'][_0xa9e9('0x12')]);return _0x2988f5(_0x5e39ad[_0xa9e9('0x10')][_0xa9e9('0x12')]);}logger[_0xa9e9('0x10')](_0xa9e9('0xc'),_0x1929e0,_0x5e39ad[_0xa9e9('0x10')][_0xa9e9('0x12')]);return _0x5c2981(_0x5e39ad[_0xa9e9('0x10')]['message']);}else{logger[_0xa9e9('0x13')]('Condition,\x20%s,\x20%s',_0x1929e0,_0xa9e9('0xd'));_0x5c2981(_0x5e39ad[_0xa9e9('0x14')][_0xa9e9('0x12')]);}})[_0xa9e9('0x15')](function(_0x1fb52e){logger[_0xa9e9('0x10')](_0xa9e9('0xc'),_0x1929e0,_0x1fb52e);_0x2988f5(_0x1fb52e);});});} \ No newline at end of file +var _0x978f=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x44c81f,_0xdb5984){var _0x1d7083=function(_0xf374b8){while(--_0xf374b8){_0x44c81f['push'](_0x44c81f['shift']());}};_0x1d7083(++_0xdb5984);}(_0x978f,0x147));var _0xf978=function(_0x1b0565,_0x318694){_0x1b0565=_0x1b0565-0x0;var _0xa87ea7=_0x978f[_0x1b0565];return _0xa87ea7;};'use strict';var _=require(_0xf978('0x0'));var util=require(_0xf978('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf978('0x2'));var fs=require('fs');var Redis=require(_0xf978('0x3'));var db=require(_0xf978('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf978('0x5'))(_0xf978('0x6'));var config=require(_0xf978('0x7'));var jayson=require(_0xf978('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc016,_0xd2299b,_0x375dbb){return new BPromise(function(_0xac1ca9,_0x2534de){return client[_0xf978('0x9')](_0x3fc016,_0x375dbb)[_0xf978('0xa')](function(_0x4ce8b0){logger[_0xf978('0xb')]('Condition,\x20%s,\x20%s',_0xd2299b,_0xf978('0xc'));logger[_0xf978('0xd')](_0xf978('0xe'),_0xd2299b,_0xf978('0xc'),JSON[_0xf978('0xf')](_0x4ce8b0));if(_0x4ce8b0[_0xf978('0x10')]){if(_0x4ce8b0[_0xf978('0x10')][_0xf978('0x11')]===0x1f4){logger[_0xf978('0x10')](_0xf978('0x12'),_0xd2299b,_0x4ce8b0[_0xf978('0x10')][_0xf978('0x13')]);return _0x2534de(_0x4ce8b0['error']['message']);}logger[_0xf978('0x10')]('Condition,\x20%s,\x20%s',_0xd2299b,_0x4ce8b0[_0xf978('0x10')][_0xf978('0x13')]);return _0xac1ca9(_0x4ce8b0['error'][_0xf978('0x13')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xd2299b,_0xf978('0xc'));_0xac1ca9(_0x4ce8b0['result'][_0xf978('0x13')]);}})['catch'](function(_0x4f9d52){logger[_0xf978('0x10')](_0xf978('0x12'),_0xd2299b,_0x4f9d52);_0x2534de(_0x4f9d52);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 56a2fc2..f1b149f 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 _0xf602=['update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated'];(function(_0x2d38f7,_0x653034){var _0x5b1c55=function(_0x50ad78){while(--_0x50ad78){_0x2d38f7['push'](_0x2d38f7['shift']());}};_0x5b1c55(++_0x653034);}(_0xf602,0xd3));var _0x2f60=function(_0x5a19a8,_0x2ddc14){_0x5a19a8=_0x5a19a8-0x0;var _0x87ab46=_0xf602[_0x5a19a8];return _0x87ab46;};'use strict';var multer=require(_0x2f60('0x0'));var util=require(_0x2f60('0x1'));var path=require('path');var timeout=require(_0x2f60('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2f60('0x3'));var interaction=require(_0x2f60('0x4'));var config=require(_0x2f60('0x5'));var controller=require(_0x2f60('0x6'));router[_0x2f60('0x7')](_0x2f60('0x8'),auth[_0x2f60('0x9')](),controller[_0x2f60('0xa')]);router['delete'](_0x2f60('0x8'),auth['isAuthenticated'](),controller[_0x2f60('0xb')]);module[_0x2f60('0xc')]=router; \ No newline at end of file +var _0x6a7a=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./condition.controller','isAuthenticated','update'];(function(_0x1eac8a,_0x2ac819){var _0xab067b=function(_0x1ca27f){while(--_0x1ca27f){_0x1eac8a['push'](_0x1eac8a['shift']());}};_0xab067b(++_0x2ac819);}(_0x6a7a,0xb9));var _0xa6a7=function(_0x9c36e9,_0x5154e6){_0x9c36e9=_0x9c36e9-0x0;var _0x5a393f=_0x6a7a[_0x9c36e9];return _0x5a393f;};'use strict';var multer=require('multer');var util=require(_0xa6a7('0x0'));var path=require(_0xa6a7('0x1'));var timeout=require(_0xa6a7('0x2'));var express=require(_0xa6a7('0x3'));var router=express[_0xa6a7('0x4')]();var fs_extra=require(_0xa6a7('0x5'));var auth=require(_0xa6a7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6a7('0x7'));router['put']('/:id',auth[_0xa6a7('0x8')](),controller[_0xa6a7('0x9')]);router[_0xa6a7('0xa')]('/:id',auth[_0xa6a7('0x8')](),controller[_0xa6a7('0xb')]);module[_0xa6a7('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 91c476c..5fe8c82 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f97=['name','INTEGER','STRING','exports'];(function(_0x11dd73,_0x4cf3e8){var _0x553896=function(_0x5359ad){while(--_0x5359ad){_0x11dd73['push'](_0x11dd73['shift']());}};_0x553896(++_0x4cf3e8);}(_0x7f97,0x11f));var _0x77f9=function(_0x5d2afe,_0x375522){_0x5d2afe=_0x5d2afe-0x0;var _0x42e77a=_0x7f97[_0x5d2afe];return _0x42e77a;};'use strict';var Sequelize=require('sequelize');module[_0x77f9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77f9('0x1')},'OrderBy':{'type':Sequelize[_0x77f9('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x77f9('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xc8d6=['exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc8d6,0x18a));var _0x6c8d=function(_0x55b2ac,_0x5f5628){_0x55b2ac=_0x55b2ac-0x0;var _0x4303d8=_0xc8d6[_0x55b2ac];return _0x4303d8;};'use strict';var Sequelize=require('sequelize');module[_0x6c8d('0x0')]={'name':{'type':Sequelize[_0x6c8d('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 124cc9c..5afc8fb 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','name','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','util'];(function(_0x4743d8,_0x722119){var _0x44a72c=function(_0x5ceb2f){while(--_0x5ceb2f){_0x4743d8['push'](_0x4743d8['shift']());}};_0x44a72c(++_0x722119);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){var _0x19e6b2=_0x3e0b66[_0x5432('0x26')]({'plain':!![]});var _0x637582='ContactItemTypes';return db[_0x5432('0x27')][_0x5432('0x25')]({'where':{'type':_0x637582,'resourceId':_0x19e6b2['id']}})[_0x5432('0x24')](function(){return _0x3e0b66;});})['then'](function(){_0x4af9f6['status'](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x2114b8,_0x589f79){return function(_0x1abe73){if(!_0x1abe73){_0x2114b8[_0x5432('0x17')](0x194);}return _0x1abe73;};}function handleError(_0x1f2e8f,_0x4add5b){_0x4add5b=_0x4add5b||0x1f4;return function(_0x29dc15){logger['error'](_0x29dc15['stack']);if(_0x29dc15[_0x5432('0x28')]){delete _0x29dc15['name'];}_0x1f2e8f[_0x5432('0x18')](_0x4add5b)['send'](_0x29dc15);};}exports['index']=function(_0x465a09,_0x21735e){var _0x345b51={},_0x4e92d5={},_0x31490c={'count':0x0,'rows':[]};var _0x1d436c=_[_0x5432('0x29')](db[_0x5432('0x2a')][_0x5432('0x2b')],function(_0x308b4c){return{'name':_0x308b4c[_0x5432('0x2c')],'type':_0x308b4c[_0x5432('0x2d')][_0x5432('0x2e')]};});_0x4e92d5['model']=_['map'](_0x1d436c,_0x5432('0x28'));_0x4e92d5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x465a09[_0x5432('0x2f')]);_0x4e92d5[_0x5432('0x31')]=_['intersection'](_0x4e92d5[_0x5432('0x32')],_0x4e92d5['query']);_0x345b51[_0x5432('0x33')]=_[_0x5432('0x34')](_0x4e92d5[_0x5432('0x32')],qs[_0x5432('0x35')](_0x465a09[_0x5432('0x2f')][_0x5432('0x35')]));_0x345b51['attributes']=_0x345b51[_0x5432('0x33')][_0x5432('0x36')]?_0x345b51[_0x5432('0x33')]:_0x4e92d5[_0x5432('0x32')];if(!_0x465a09['query'][_0x5432('0x37')](_0x5432('0x38'))){_0x345b51[_0x5432('0x1e')]=qs[_0x5432('0x1e')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1e')]);_0x345b51[_0x5432('0x1d')]=qs[_0x5432('0x1d')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x345b51[_0x5432('0x39')]=qs[_0x5432('0x3a')](_0x465a09[_0x5432('0x2f')][_0x5432('0x3a')]);_0x345b51['where']=qs[_0x5432('0x31')](_['pick'](_0x465a09[_0x5432('0x2f')],_0x4e92d5[_0x5432('0x31')]),_0x1d436c);if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]){_0x345b51['where']=_['merge'](_0x345b51['where'],{'$or':_[_0x5432('0x29')](_0x1d436c,function(_0x2053ed){if(_0x2053ed[_0x5432('0x2d')]!==_0x5432('0x3c')){var _0x52b296={};_0x52b296[_0x2053ed[_0x5432('0x28')]]={'$like':'%'+_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]+'%'};return _0x52b296;}})});}_0x345b51=_['merge']({},_0x345b51,_0x465a09[_0x5432('0x3d')]);var _0x38c951={'where':_0x345b51['where']};return db[_0x5432('0x2a')][_0x5432('0x1c')](_0x38c951)['then'](function(_0x23f8f4){_0x31490c['count']=_0x23f8f4;if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3e')]){_0x345b51[_0x5432('0x3f')]=[{'all':!![]}];}return db[_0x5432('0x2a')]['findAll'](_0x345b51);})[_0x5432('0x24')](function(_0x4b93b4){_0x31490c[_0x5432('0x40')]=_0x4b93b4;return _0x31490c;})[_0x5432('0x24')](respondWithFilteredResult(_0x21735e,_0x345b51))[_0x5432('0x41')](handleError(_0x21735e,null));};exports[_0x5432('0x42')]=function(_0xc656ca,_0x23119a){var _0x2234da={'raw':!![],'where':{'id':_0xc656ca[_0x5432('0x43')]['id']}},_0x4ab024={};_0x4ab024[_0x5432('0x32')]=_[_0x5432('0x30')](db[_0x5432('0x2a')][_0x5432('0x2b')]);_0x4ab024[_0x5432('0x2f')]=_[_0x5432('0x30')](_0xc656ca['query']);_0x4ab024[_0x5432('0x31')]=_[_0x5432('0x34')](_0x4ab024[_0x5432('0x32')],_0x4ab024[_0x5432('0x2f')]);_0x2234da[_0x5432('0x33')]=_['intersection'](_0x4ab024[_0x5432('0x32')],qs['fields'](_0xc656ca[_0x5432('0x2f')][_0x5432('0x35')]));_0x2234da['attributes']=_0x2234da[_0x5432('0x33')]['length']?_0x2234da[_0x5432('0x33')]:_0x4ab024[_0x5432('0x32')];if(_0xc656ca['query']['includeAll']){_0x2234da[_0x5432('0x3f')]=[{'all':!![]}];}_0x2234da=_[_0x5432('0x44')]({},_0x2234da,_0xc656ca[_0x5432('0x3d')]);return db[_0x5432('0x2a')][_0x5432('0x45')](_0x2234da)[_0x5432('0x24')](handleEntityNotFound(_0x23119a,null))[_0x5432('0x24')](respondWithResult(_0x23119a,null))['catch'](handleError(_0x23119a,null));};exports[_0x5432('0x46')]=function(_0x14763c,_0x429da8){return db['ContactItemType']['create'](_0x14763c['body'],{})['then'](function(_0x26d6ae){var _0x42212f=_0x14763c[_0x5432('0x47')][_0x5432('0x26')]({'plain':!![]});if(!_0x42212f)throw new Error(_0x5432('0x48'));if(_0x42212f['role']===_0x5432('0x47')){var _0xce691b=_0x26d6ae[_0x5432('0x26')]({'plain':!![]});var _0x536229=_0x5432('0x49');return db[_0x5432('0x4a')][_0x5432('0x45')]({'where':{'name':_0x536229,'userProfileId':_0x42212f[_0x5432('0x4b')]},'raw':!![]})[_0x5432('0x24')](function(_0x50cd7c){if(_0x50cd7c&&_0x50cd7c[_0x5432('0x4c')]===0x0){return db['UserProfileResource'][_0x5432('0x46')]({'name':_0xce691b['name'],'resourceId':_0xce691b['id'],'type':_0x50cd7c[_0x5432('0x28')],'sectionId':_0x50cd7c['id']},{})[_0x5432('0x24')](function(){return _0x26d6ae;});}else{return _0x26d6ae;}})['catch'](function(_0x7129e2){logger['error'](_0x5432('0x4d'),_0x7129e2);throw _0x7129e2;});}return _0x26d6ae;})[_0x5432('0x24')](respondWithResult(_0x429da8,0xc9))[_0x5432('0x41')](handleError(_0x429da8,null));};exports[_0x5432('0x23')]=function(_0x5f08eb,_0x3757b1){if(_0x5f08eb['body']['id']){delete _0x5f08eb[_0x5432('0x4e')]['id'];}return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x5f08eb[_0x5432('0x43')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x3757b1,null))[_0x5432('0x24')](saveUpdates(_0x5f08eb[_0x5432('0x4e')],null))[_0x5432('0x24')](respondWithResult(_0x3757b1,null))[_0x5432('0x41')](handleError(_0x3757b1,null));};exports[_0x5432('0x25')]=function(_0x3e0259,_0x20d9f5){return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x3e0259[_0x5432('0x43')]['id']}})['then'](handleEntityNotFound(_0x20d9f5,null))[_0x5432('0x24')](db[_0x5432('0x4f')][_0x5432('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3e0259[_0x5432('0x43')]['id']}}))[_0x5432('0x24')](removeEntity(_0x20d9f5,null))['catch'](handleError(_0x20d9f5,null));}; \ No newline at end of file +var _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2c8de4,_0x48ecd7){var _0xa5f1d5=function(_0x521b2a){while(--_0x521b2a){_0x2c8de4['push'](_0x2c8de4['shift']());}};_0xa5f1d5(++_0x48ecd7);}(_0x6d11,0xbf));var _0x16d1=function(_0x3270fd,_0x404d6f){_0x3270fd=_0x3270fd-0x0;var _0x4ccb51=_0x6d11[_0x3270fd];return _0x4ccb51;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 755df81..3611123 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0538=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x13647a,_0x23799f){var _0x41f50c=function(_0x45cdd6){while(--_0x45cdd6){_0x13647a['push'](_0x13647a['shift']());}};_0x41f50c(++_0x23799f);}(_0x0538,0x7c));var _0x8053=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x0538[_0x1196b0];return _0x111c52;};'use strict';var _=require(_0x8053('0x0'));var util=require('util');var logger=require(_0x8053('0x1'))('api');var moment=require(_0x8053('0x2'));var BPromise=require(_0x8053('0x3'));var rp=require(_0x8053('0x4'));var fs=require('fs');var path=require(_0x8053('0x5'));var rimraf=require(_0x8053('0x6'));var config=require(_0x8053('0x7'));var attributes=require(_0x8053('0x8'));module[_0x8053('0x9')]=function(_0x42c133,_0x3e6545){return _0x42c133[_0x8053('0xa')](_0x8053('0xb'),attributes,{'tableName':_0x8053('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x862d=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./contactItemType.attributes','exports'];(function(_0x333d0f,_0x5e49a2){var _0x14cdce=function(_0x44de74){while(--_0x44de74){_0x333d0f['push'](_0x333d0f['shift']());}};_0x14cdce(++_0x5e49a2);}(_0x862d,0x148));var _0xd862=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x862d[_0x8550ba];return _0x432399;};'use strict';var _=require(_0xd862('0x0'));var util=require(_0xd862('0x1'));var logger=require(_0xd862('0x2'))(_0xd862('0x3'));var moment=require(_0xd862('0x4'));var BPromise=require('bluebird');var rp=require(_0xd862('0x5'));var fs=require('fs');var path=require(_0xd862('0x6'));var rimraf=require(_0xd862('0x7'));var config=require('../../config/environment');var attributes=require(_0xd862('0x8'));module[_0xd862('0x9')]=function(_0x4acf0e,_0x30c587){return _0x4acf0e[_0xd862('0xa')](_0xd862('0xb'),attributes,{'tableName':_0xd862('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index d74e9e1..8b72384 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0442=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash'];(function(_0x2a4b6c,_0x2cac39){var _0x3daa18=function(_0xd7a988){while(--_0xd7a988){_0x2a4b6c['push'](_0x2a4b6c['shift']());}};_0x3daa18(++_0x2cac39);}(_0x0442,0x1e2));var _0x2044=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x0442[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var moment=require(_0x2044('0x2'));var BPromise=require('bluebird');var rs=require(_0x2044('0x3'));var fs=require('fs');var Redis=require(_0x2044('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2044('0x5'));var logger=require(_0x2044('0x6'))(_0x2044('0x7'));var config=require('../../config/environment');var jayson=require(_0x2044('0x8'));var client=jayson['client'][_0x2044('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x256263,_0x81a87a,_0x185ff2){return new BPromise(function(_0x215138,_0x3c4680){return client[_0x2044('0xa')](_0x256263,_0x185ff2)[_0x2044('0xb')](function(_0x3abf0b){logger[_0x2044('0xc')](_0x2044('0xd'),_0x81a87a,'request\x20sent');logger[_0x2044('0xe')](_0x2044('0xf'),_0x81a87a,'request\x20sent',JSON[_0x2044('0x10')](_0x3abf0b));if(_0x3abf0b[_0x2044('0x11')]){if(_0x3abf0b[_0x2044('0x11')][_0x2044('0x12')]===0x1f4){logger[_0x2044('0x11')](_0x2044('0xd'),_0x81a87a,_0x3abf0b[_0x2044('0x11')][_0x2044('0x13')]);return _0x3c4680(_0x3abf0b[_0x2044('0x11')]['message']);}logger['error'](_0x2044('0xd'),_0x81a87a,_0x3abf0b['error']['message']);return _0x215138(_0x3abf0b[_0x2044('0x11')][_0x2044('0x13')]);}else{logger[_0x2044('0xc')]('ContactItemType,\x20%s,\x20%s',_0x81a87a,_0x2044('0x14'));_0x215138(_0x3abf0b[_0x2044('0x15')][_0x2044('0x13')]);}})[_0x2044('0x16')](function(_0x34f62a){logger[_0x2044('0x11')](_0x2044('0xd'),_0x81a87a,_0x34f62a);_0x3c4680(_0x34f62a);});});} \ No newline at end of file +var _0x22d8=['message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54e230,_0x567e3d){var _0x4e88d4=function(_0x256d40){while(--_0x256d40){_0x54e230['push'](_0x54e230['shift']());}};_0x4e88d4(++_0x567e3d);}(_0x22d8,0x19c));var _0x822d=function(_0x597e5d,_0x2954d5){_0x597e5d=_0x597e5d-0x0;var _0x6a6659=_0x22d8[_0x597e5d];return _0x6a6659;};'use strict';var _=require(_0x822d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x822d('0x1'));var rs=require(_0x822d('0x2'));var fs=require('fs');var Redis=require(_0x822d('0x3'));var db=require(_0x822d('0x4'))['db'];var utils=require(_0x822d('0x5'));var logger=require(_0x822d('0x6'))(_0x822d('0x7'));var config=require(_0x822d('0x8'));var jayson=require(_0x822d('0x9'));var client=jayson['client'][_0x822d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3085,_0x2df8e1,_0x399ce7){return new BPromise(function(_0x5121dd,_0x31266d){return client[_0x822d('0xb')](_0x3a3085,_0x399ce7)[_0x822d('0xc')](function(_0x23e63c){logger['info'](_0x822d('0xd'),_0x2df8e1,_0x822d('0xe'));logger[_0x822d('0xf')](_0x822d('0x10'),_0x2df8e1,_0x822d('0xe'),JSON[_0x822d('0x11')](_0x23e63c));if(_0x23e63c['error']){if(_0x23e63c[_0x822d('0x12')][_0x822d('0x13')]===0x1f4){logger[_0x822d('0x12')]('ContactItemType,\x20%s,\x20%s',_0x2df8e1,_0x23e63c['error']['message']);return _0x31266d(_0x23e63c[_0x822d('0x12')][_0x822d('0x14')]);}logger['error'](_0x822d('0xd'),_0x2df8e1,_0x23e63c['error'][_0x822d('0x14')]);return _0x5121dd(_0x23e63c[_0x822d('0x12')]['message']);}else{logger[_0x822d('0x15')](_0x822d('0xd'),_0x2df8e1,_0x822d('0xe'));_0x5121dd(_0x23e63c[_0x822d('0x16')][_0x822d('0x14')]);}})[_0x822d('0x17')](function(_0x242aa4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x2df8e1,_0x242aa4);_0x31266d(_0x242aa4);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 3f777c2..57a322e 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x337f=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x29518c,_0x343302){var _0x57fa6b=function(_0x53643c){while(--_0x53643c){_0x29518c['push'](_0x29518c['shift']());}};_0x57fa6b(++_0x343302);}(_0x337f,0x1d3));var _0xf337=function(_0x2c9874,_0xbc149a){_0x2c9874=_0x2c9874-0x0;var _0x2d89c8=_0x337f[_0x2c9874];return _0x2d89c8;};'use strict';var multer=require(_0xf337('0x0'));var util=require(_0xf337('0x1'));var path=require(_0xf337('0x2'));var timeout=require(_0xf337('0x3'));var express=require(_0xf337('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf337('0x5'));var interaction=require(_0xf337('0x6'));var config=require(_0xf337('0x7'));var controller=require(_0xf337('0x8'));router[_0xf337('0x9')]('/',auth[_0xf337('0xa')](),controller['index']);router[_0xf337('0x9')](_0xf337('0xb'),auth[_0xf337('0xa')](),controller[_0xf337('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf337('0xd')]);router['put'](_0xf337('0xb'),auth[_0xf337('0xa')](),controller[_0xf337('0xe')]);router[_0xf337('0xf')](_0xf337('0xb'),auth[_0xf337('0xa')](),controller[_0xf337('0x10')]);module[_0xf337('0x11')]=router; \ No newline at end of file +var _0x09d5=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5bd8db,_0x2a895a){var _0x167b4c=function(_0x4fda7a){while(--_0x4fda7a){_0x5bd8db['push'](_0x5bd8db['shift']());}};_0x167b4c(++_0x2a895a);}(_0x09d5,0x15c));var _0x509d=function(_0x275694,_0x1f971a){_0x275694=_0x275694-0x0;var _0x371055=_0x09d5[_0x275694];return _0x371055;};'use strict';var multer=require(_0x509d('0x0'));var util=require(_0x509d('0x1'));var path=require(_0x509d('0x2'));var timeout=require(_0x509d('0x3'));var express=require(_0x509d('0x4'));var router=express[_0x509d('0x5')]();var fs_extra=require(_0x509d('0x6'));var auth=require(_0x509d('0x7'));var interaction=require(_0x509d('0x8'));var config=require(_0x509d('0x9'));var controller=require(_0x509d('0xa'));router[_0x509d('0xb')]('/',auth[_0x509d('0xc')](),controller[_0x509d('0xd')]);router['get']('/:id',auth[_0x509d('0xc')](),controller[_0x509d('0xe')]);router[_0x509d('0xf')]('/',auth[_0x509d('0xc')](),controller['create']);router[_0x509d('0x10')](_0x509d('0x11'),auth[_0x509d('0xc')](),controller[_0x509d('0x12')]);router[_0x509d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x509d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7b6ab89..785b76c 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 _0x757a=['exports','STRING'];(function(_0x2a67e7,_0x523cb5){var _0x37cf10=function(_0x30d3e7){while(--_0x30d3e7){_0x2a67e7['push'](_0x2a67e7['shift']());}};_0x37cf10(++_0x523cb5);}(_0x757a,0xde));var _0xa757=function(_0x77e39d,_0xdfddb){_0x77e39d=_0x77e39d-0x0;var _0x4da588=_0x757a[_0x77e39d];return _0x4da588;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2d0a0e0..7044dc1 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 _0x84a8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Dashboard','includeAll','show','params','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x5cbf69,_0x48b083){var _0x51b1a4=function(_0x3f979b){while(--_0x3f979b){_0x5cbf69['push'](_0x5cbf69['shift']());}};_0x51b1a4(++_0x48b083);}(_0x84a8,0x17c));var _0x884a=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0x84a8[_0x4e198a];return _0xb84bfe;};'use strict';var emlformat=require(_0x884a('0x0'));var rimraf=require(_0x884a('0x1'));var zipdir=require(_0x884a('0x2'));var jsonpatch=require(_0x884a('0x3'));var rp=require('request-promise');var moment=require(_0x884a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x884a('0x5'));var util=require(_0x884a('0x6'));var path=require(_0x884a('0x7'));var sox=require(_0x884a('0x8'));var csv=require(_0x884a('0x9'));var ejs=require(_0x884a('0xa'));var fs=require('fs');var fs_extra=require(_0x884a('0xb'));var _=require(_0x884a('0xc'));var squel=require(_0x884a('0xd'));var crypto=require('crypto');var jsforce=require(_0x884a('0xe'));var deskjs=require(_0x884a('0xf'));var toCsv=require(_0x884a('0x9'));var querystring=require(_0x884a('0x10'));var Papa=require(_0x884a('0x11'));var Redis=require('ioredis');var authService=require(_0x884a('0x12'));var qs=require(_0x884a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x884a('0x14'));var logger=require(_0x884a('0x15'))(_0x884a('0x16'));var utils=require(_0x884a('0x17'));var config=require(_0x884a('0x18'));var licenseUtil=require(_0x884a('0x19'));var db=require(_0x884a('0x1a'))['db'];config[_0x884a('0x1b')]=_[_0x884a('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x884a('0x1d'))(new Redis(config[_0x884a('0x1b')]));require(_0x884a('0x1e'))['register'](socket);function respondWithStatusCode(_0x3371cf,_0x4d5284){_0x4d5284=_0x4d5284||0xcc;return function(_0x169f7a){if(_0x169f7a){return _0x3371cf['sendStatus'](_0x4d5284);}return _0x3371cf[_0x884a('0x1f')](_0x4d5284)[_0x884a('0x20')]();};}function respondWithResult(_0x1e1c15,_0x101c2d){_0x101c2d=_0x101c2d||0xc8;return function(_0x93bfaa){if(_0x93bfaa){return _0x1e1c15[_0x884a('0x1f')](_0x101c2d)[_0x884a('0x21')](_0x93bfaa);}};}function respondWithFilteredResult(_0x3b5e79,_0x3eac94){return function(_0x435c89){if(_0x435c89){var _0x2b489f=typeof _0x3eac94[_0x884a('0x22')]===_0x884a('0x23')&&typeof _0x3eac94['limit']===_0x884a('0x23');var _0x561eda=_0x435c89[_0x884a('0x24')];var _0x2c8936=_0x2b489f?0x0:_0x3eac94[_0x884a('0x22')];var _0x4b2049=_0x2b489f?_0x435c89[_0x884a('0x24')]:_0x3eac94[_0x884a('0x22')]+_0x3eac94[_0x884a('0x25')];var _0x41e29a;if(_0x4b2049>=_0x561eda){_0x4b2049=_0x561eda;_0x41e29a=0xc8;}else{_0x41e29a=0xce;}_0x3b5e79[_0x884a('0x1f')](_0x41e29a);return _0x3b5e79[_0x884a('0x26')](_0x884a('0x27'),_0x2c8936+'-'+_0x4b2049+'/'+_0x561eda)[_0x884a('0x21')](_0x435c89);}return null;};}function patchUpdates(_0x15a4ed){return function(_0x4a7f66){try{jsonpatch[_0x884a('0x28')](_0x4a7f66,_0x15a4ed,!![]);}catch(_0x344640){return BPromise[_0x884a('0x29')](_0x344640);}return _0x4a7f66[_0x884a('0x2a')]();};}function saveUpdates(_0x566ddc,_0x4f57a8){return function(_0x55d82d){if(_0x55d82d){return _0x55d82d[_0x884a('0x2b')](_0x566ddc)[_0x884a('0x2c')](function(_0x24774){return _0x24774;});}return null;};}function removeEntity(_0x3bb3c3,_0x343822){return function(_0x2f4037){if(_0x2f4037){return _0x2f4037['destroy']()[_0x884a('0x2c')](function(){var _0x470a73=_0x2f4037['get']({'plain':!![]});var _0x1d77c9=_0x884a('0x2d');return db[_0x884a('0x2e')][_0x884a('0x2f')]({'where':{'type':_0x1d77c9,'resourceId':_0x470a73['id']}})[_0x884a('0x2c')](function(){return _0x2f4037;});})[_0x884a('0x2c')](function(){_0x3bb3c3[_0x884a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd2564,_0x423d38){return function(_0x5a581d){if(!_0x5a581d){_0xcd2564[_0x884a('0x30')](0x194);}return _0x5a581d;};}function handleError(_0x2828c5,_0x2960df){_0x2960df=_0x2960df||0x1f4;return function(_0x2c51bc){logger['error'](_0x2c51bc[_0x884a('0x31')]);if(_0x2c51bc[_0x884a('0x32')]){delete _0x2c51bc[_0x884a('0x32')];}_0x2828c5[_0x884a('0x1f')](_0x2960df)[_0x884a('0x33')](_0x2c51bc);};}exports[_0x884a('0x34')]=function(_0x14fa84,_0x2e2e97){var _0x188a90={},_0x5a7710={},_0xcc8ffa={'count':0x0,'rows':[]};var _0x443979=_[_0x884a('0x35')](db['Dashboard'][_0x884a('0x36')],function(_0x20e7cf){return{'name':_0x20e7cf[_0x884a('0x37')],'type':_0x20e7cf[_0x884a('0x38')][_0x884a('0x39')]};});_0x5a7710[_0x884a('0x3a')]=_['map'](_0x443979,'name');_0x5a7710[_0x884a('0x3b')]=_[_0x884a('0x3c')](_0x14fa84[_0x884a('0x3b')]);_0x5a7710[_0x884a('0x3d')]=_[_0x884a('0x3e')](_0x5a7710[_0x884a('0x3a')],_0x5a7710[_0x884a('0x3b')]);_0x188a90[_0x884a('0x3f')]=_[_0x884a('0x3e')](_0x5a7710[_0x884a('0x3a')],qs[_0x884a('0x40')](_0x14fa84['query'][_0x884a('0x40')]));_0x188a90[_0x884a('0x3f')]=_0x188a90['attributes'][_0x884a('0x41')]?_0x188a90[_0x884a('0x3f')]:_0x5a7710[_0x884a('0x3a')];if(!_0x14fa84[_0x884a('0x3b')][_0x884a('0x42')](_0x884a('0x43'))){_0x188a90[_0x884a('0x25')]=qs[_0x884a('0x25')](_0x14fa84[_0x884a('0x3b')]['limit']);_0x188a90[_0x884a('0x22')]=qs[_0x884a('0x22')](_0x14fa84['query']['offset']);}_0x188a90[_0x884a('0x44')]=qs[_0x884a('0x45')](_0x14fa84[_0x884a('0x3b')]['sort']);_0x188a90[_0x884a('0x46')]=qs['filters'](_['pick'](_0x14fa84[_0x884a('0x3b')],_0x5a7710[_0x884a('0x3d')]),_0x443979);if(_0x14fa84[_0x884a('0x3b')][_0x884a('0x47')]){_0x188a90[_0x884a('0x46')]=_[_0x884a('0x48')](_0x188a90['where'],{'$or':_[_0x884a('0x35')](_0x443979,function(_0x4cb32e){if(_0x4cb32e[_0x884a('0x38')]!==_0x884a('0x49')){var _0x3f3a97={};_0x3f3a97[_0x4cb32e[_0x884a('0x32')]]={'$like':'%'+_0x14fa84[_0x884a('0x3b')][_0x884a('0x47')]+'%'};return _0x3f3a97;}})});}_0x188a90=_['merge']({},_0x188a90,_0x14fa84['options']);var _0x34f0b3={'where':_0x188a90[_0x884a('0x46')]};return db[_0x884a('0x4a')]['count'](_0x34f0b3)['then'](function(_0x351a8b){_0xcc8ffa['count']=_0x351a8b;if(_0x14fa84['query'][_0x884a('0x4b')]){_0x188a90['include']=[{'all':!![]}];}return db[_0x884a('0x4a')]['findAll'](_0x188a90);})[_0x884a('0x2c')](function(_0x575811){_0xcc8ffa['rows']=_0x575811;return _0xcc8ffa;})[_0x884a('0x2c')](respondWithFilteredResult(_0x2e2e97,_0x188a90))['catch'](handleError(_0x2e2e97,null));};exports[_0x884a('0x4c')]=function(_0x1af3ac,_0x58ca1a){var _0x4a36d3={'raw':![],'where':{'id':_0x1af3ac[_0x884a('0x4d')]['id']}},_0x329851={};_0x329851['model']=_[_0x884a('0x3c')](db['Dashboard'][_0x884a('0x36')]);_0x329851[_0x884a('0x3b')]=_[_0x884a('0x3c')](_0x1af3ac[_0x884a('0x3b')]);_0x329851['filters']=_[_0x884a('0x3e')](_0x329851[_0x884a('0x3a')],_0x329851[_0x884a('0x3b')]);_0x4a36d3[_0x884a('0x3f')]=_[_0x884a('0x3e')](_0x329851[_0x884a('0x3a')],qs[_0x884a('0x40')](_0x1af3ac[_0x884a('0x3b')]['fields']));_0x4a36d3['attributes']=_0x4a36d3[_0x884a('0x3f')][_0x884a('0x41')]?_0x4a36d3[_0x884a('0x3f')]:_0x329851[_0x884a('0x3a')];if(_0x1af3ac[_0x884a('0x3b')][_0x884a('0x4b')]){_0x4a36d3[_0x884a('0x4e')]=[{'all':!![]}];}_0x4a36d3=_[_0x884a('0x48')]({},_0x4a36d3,_0x1af3ac[_0x884a('0x4f')]);return db[_0x884a('0x4a')][_0x884a('0x50')](_0x4a36d3)[_0x884a('0x2c')](handleEntityNotFound(_0x58ca1a,null))[_0x884a('0x2c')](respondWithResult(_0x58ca1a,null))['catch'](handleError(_0x58ca1a,null));};exports['create']=function(_0x22b4ed,_0x299da7){return db['Dashboard'][_0x884a('0x51')](_0x22b4ed[_0x884a('0x52')],{})['then'](function(_0x36d117){var _0x5d31c6=_0x22b4ed[_0x884a('0x53')][_0x884a('0x54')]({'plain':!![]});if(!_0x5d31c6)throw new Error(_0x884a('0x55'));if(_0x5d31c6[_0x884a('0x56')]===_0x884a('0x53')){var _0x5aeced=_0x36d117['get']({'plain':!![]});var _0xda1867='CustomDashboards';return db[_0x884a('0x57')][_0x884a('0x50')]({'where':{'name':_0xda1867,'userProfileId':_0x5d31c6[_0x884a('0x58')]},'raw':!![]})[_0x884a('0x2c')](function(_0x51148e){if(_0x51148e&&_0x51148e[_0x884a('0x59')]===0x0){return db[_0x884a('0x2e')]['create']({'name':_0x5aeced[_0x884a('0x32')],'resourceId':_0x5aeced['id'],'type':_0x51148e[_0x884a('0x32')],'sectionId':_0x51148e['id']},{})['then'](function(){return _0x36d117;});}else{return _0x36d117;}})[_0x884a('0x5a')](function(_0x296a37){logger[_0x884a('0x5b')](_0x884a('0x5c'),_0x296a37);throw _0x296a37;});}return _0x36d117;})[_0x884a('0x2c')](respondWithResult(_0x299da7,0xc9))[_0x884a('0x5a')](handleError(_0x299da7,null));};exports['clone']=function(_0x554b98,_0x4cc271){var _0x4d4db9={'where':{'id':_0x554b98[_0x884a('0x4d')]['id']}},_0x57173c={};_0x57173c[_0x884a('0x3a')]=_['keys'](db[_0x884a('0x4a')][_0x884a('0x36')]);_0x4d4db9[_0x884a('0x3f')]=_[_0x884a('0x3e')](_0x57173c[_0x884a('0x3a')],qs[_0x884a('0x40')](_0x554b98[_0x884a('0x3b')][_0x884a('0x40')]));_0x4d4db9[_0x884a('0x3f')]=_0x4d4db9[_0x884a('0x3f')]['length']?_0x4d4db9[_0x884a('0x3f')]:_0x57173c[_0x884a('0x3a')];if(_0x554b98[_0x884a('0x3b')][_0x884a('0x4b')]){_0x4d4db9[_0x884a('0x4e')]=[{'all':!![]}];}_0x4d4db9=_[_0x884a('0x48')]({},_0x4d4db9,_0x554b98[_0x884a('0x4f')]);return db['Dashboard']['find'](_0x4d4db9)[_0x884a('0x2c')](handleEntityNotFound(_0x4cc271,null))['then'](function(_0x5081ed){if(_0x5081ed){var _0x25661b=_0x5081ed[_0x884a('0x54')]({'plain':!![]});_0x25661b=qs[_0x884a('0x5d')](_0x25661b,['id',_0x884a('0x5e'),'updatedAt']);_0x554b98[_0x884a('0x52')]=_[_0x884a('0x5d')](_0x554b98[_0x884a('0x52')],['id',_0x884a('0x5e'),_0x884a('0x5f')]);return db[_0x884a('0x4a')][_0x884a('0x51')](_[_0x884a('0x48')](_0x25661b,_0x554b98[_0x884a('0x52')]),{'include':_0x554b98[_0x884a('0x3b')][_0x884a('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x51be1b){var _0x4abf79=_0x554b98['user'][_0x884a('0x54')]({'plain':!![]});if(!_0x4abf79)throw new Error(_0x884a('0x55'));if(_0x4abf79[_0x884a('0x56')]===_0x884a('0x53')){var _0x3befd0=_0x51be1b['get']({'plain':!![]});var _0x122db5=_0x884a('0x2d');return db[_0x884a('0x57')]['find']({'where':{'name':_0x122db5,'userProfileId':_0x4abf79[_0x884a('0x58')]},'raw':!![]})[_0x884a('0x2c')](function(_0x31cced){if(_0x31cced&&_0x31cced[_0x884a('0x59')]===0x0){return db['UserProfileResource'][_0x884a('0x51')]({'name':_0x3befd0['name'],'resourceId':_0x3befd0['id'],'type':_0x31cced[_0x884a('0x32')],'sectionId':_0x31cced['id']},{})[_0x884a('0x2c')](function(){return _0x51be1b;});}else{return _0x51be1b;}})['catch'](function(_0x643833){logger[_0x884a('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x643833);throw _0x643833;});}return _0x51be1b;});}})[_0x884a('0x2c')](respondWithResult(_0x4cc271,0xc9))['catch'](handleError(_0x4cc271,null));};exports[_0x884a('0x2b')]=function(_0x546e6b,_0x55a914){if(_0x546e6b[_0x884a('0x52')]['id']){delete _0x546e6b[_0x884a('0x52')]['id'];}return db[_0x884a('0x4a')][_0x884a('0x50')]({'where':{'id':_0x546e6b['params']['id']}})[_0x884a('0x2c')](handleEntityNotFound(_0x55a914,null))[_0x884a('0x2c')](saveUpdates(_0x546e6b[_0x884a('0x52')],null))[_0x884a('0x2c')](respondWithResult(_0x55a914,null))['catch'](handleError(_0x55a914,null));};exports['destroy']=function(_0x4ff422,_0x7cec66){return db[_0x884a('0x4a')][_0x884a('0x50')]({'where':{'id':_0x4ff422[_0x884a('0x4d')]['id']}})[_0x884a('0x2c')](handleEntityNotFound(_0x7cec66,null))[_0x884a('0x2c')](removeEntity(_0x7cec66,null))[_0x884a('0x5a')](handleError(_0x7cec66,null));};function widgetAttributes(_0x249257){try{switch(_0x249257[_0x884a('0x38')]){case _0x884a('0x60'):return[{'name':'attrUrl','value':_0x249257[_0x884a('0x61')]||(_0x249257[_0x884a('0x62')]&&_0x249257['attrs'][0x0]?_0x249257[_0x884a('0x62')][0x0][_0x884a('0x63')]:undefined)||_0x884a('0x64')}];case _0x884a('0x65'):return[{'name':'attrPath','value':_0x249257[_0x884a('0x66')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x0]?_0x249257[_0x884a('0x62')][0x0][_0x884a('0x63')]:undefined)||''}];case _0x884a('0x67'):return[{'name':_0x884a('0x68'),'value':_0x249257[_0x884a('0x68')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x0]?_0x249257[_0x884a('0x62')][0x0][_0x884a('0x63')]:undefined)||_0x884a('0x69')},{'name':'attrTimezone','value':_0x249257['attrTimezone']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x1]?_0x249257['attrs'][0x1][_0x884a('0x63')]:undefined)||_0x884a('0x6a')},{'name':_0x884a('0x6b'),'value':_0x249257[_0x884a('0x6b')]||(_0x249257['attrs']&&_0x249257[_0x884a('0x62')][0x2]?_0x249257[_0x884a('0x62')][0x2][_0x884a('0x63')]:undefined)||0xc}];case _0x884a('0x6c'):return[{'name':_0x884a('0x6d'),'value':_0x249257[_0x884a('0x6d')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x0]?_0x249257['attrs'][0x0][_0x884a('0x63')]:undefined)||'total'},{'name':_0x884a('0x6e'),'value':_0x249257[_0x884a('0x6e')]||(_0x249257[_0x884a('0x62')]&&_0x249257['attrs'][0x1]?_0x249257[_0x884a('0x62')][0x1]['value']:undefined)||[]},{'name':_0x884a('0x6b'),'value':_0x249257[_0x884a('0x6b')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x2]?_0x249257['attrs'][0x2][_0x884a('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x249257[_0x884a('0x6f')]||(_0x249257['attrs']&&_0x249257[_0x884a('0x62')][0x3]?_0x249257['attrs'][0x3][_0x884a('0x63')]:undefined)||_0x884a('0x70')},{'name':_0x884a('0x71'),'value':_0x249257[_0x884a('0x71')]||(_0x249257[_0x884a('0x62')]&&_0x249257['attrs'][0x4]?_0x249257['attrs'][0x4]['value']:undefined)||''},{'name':_0x884a('0x72'),'value':_0x249257['attrFaxAccounts']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x5]?_0x249257['attrs'][0x5][_0x884a('0x63')]:undefined)||''},{'name':_0x884a('0x73'),'value':_0x249257[_0x884a('0x73')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x6]?_0x249257[_0x884a('0x62')][0x6][_0x884a('0x63')]:undefined)||''},{'name':_0x884a('0x74'),'value':_0x249257[_0x884a('0x74')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x7]?_0x249257[_0x884a('0x62')][0x7][_0x884a('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x249257[_0x884a('0x75')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x8]?_0x249257[_0x884a('0x62')][0x8]['value']:undefined)||''},{'name':_0x884a('0x76'),'value':_0x249257[_0x884a('0x76')]||(_0x249257[_0x884a('0x62')]&&_0x249257['attrs'][0x9]?_0x249257[_0x884a('0x62')][0x9][_0x884a('0x63')]:undefined)||''}];case _0x884a('0x77'):case _0x884a('0x78'):return[{'name':_0x884a('0x79'),'value':_0x249257[_0x884a('0x79')]||(_0x249257['attrs']&&_0x249257[_0x884a('0x62')][0x0]?_0x249257[_0x884a('0x62')][0x0][_0x884a('0x63')]:undefined)||'total'},{'name':'attrSerie2','value':_0x249257['attrSerie2']||(_0x249257['attrs']&&_0x249257[_0x884a('0x62')][0x1]?_0x249257['attrs'][0x1][_0x884a('0x63')]:undefined)||null},{'name':_0x884a('0x7a'),'value':_0x249257[_0x884a('0x7a')]||(_0x249257[_0x884a('0x62')]&&_0x249257['attrs'][0x2]?_0x249257['attrs'][0x2]['value']:undefined)||null},{'name':_0x884a('0x6e'),'value':_0x249257['attrVoiceQueues']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x3]?_0x249257['attrs'][0x3][_0x884a('0x63')]:undefined)||[]},{'name':_0x884a('0x6f'),'value':_0x249257['attrChannel']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x4]?_0x249257[_0x884a('0x62')][0x4][_0x884a('0x63')]:undefined)||_0x884a('0x70')},{'name':_0x884a('0x71'),'value':_0x249257[_0x884a('0x71')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x5]?_0x249257[_0x884a('0x62')][0x5][_0x884a('0x63')]:undefined)||''},{'name':_0x884a('0x72'),'value':_0x249257[_0x884a('0x72')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x6]?_0x249257['attrs'][0x6][_0x884a('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x249257['attrSmsAccounts']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x7]?_0x249257[_0x884a('0x62')][0x7][_0x884a('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x249257['attrOpenchannelAccounts']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x8]?_0x249257[_0x884a('0x62')][0x8][_0x884a('0x63')]:undefined)||''},{'name':_0x884a('0x75'),'value':_0x249257[_0x884a('0x75')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x9]?_0x249257['attrs'][0x9][_0x884a('0x63')]:undefined)||''},{'name':_0x884a('0x76'),'value':_0x249257[_0x884a('0x76')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0xa]?_0x249257['attrs'][0xa][_0x884a('0x63')]:undefined)||''}];case _0x884a('0x7b'):return[{'name':_0x884a('0x7c'),'type':_0x249257[_0x884a('0x7d')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x0]?_0x249257[_0x884a('0x62')][0x0][_0x884a('0x38')]:undefined)||null,'value':_0x249257[_0x884a('0x7c')]||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x0]?_0x249257[_0x884a('0x62')][0x0]['value']:undefined)||null},{'name':_0x884a('0x7e'),'value':_0x249257['attrRefresh']||(_0x249257[_0x884a('0x62')]&&_0x249257[_0x884a('0x62')][0x1]?_0x249257['attrs'][0x1][_0x884a('0x63')]:undefined)||0x0}];default:return[];}}catch(_0xa556cc){logger[_0x884a('0x5b')](_0x884a('0x7f'),JSON[_0x884a('0x80')](_0xa556cc));return[];}}exports[_0x884a('0x81')]=function(_0x53bb08,_0x125d56,_0x30930f){if(_0x53bb08[_0x884a('0x52')]['id']){delete _0x53bb08[_0x884a('0x52')]['id'];}return db['Dashboard'][_0x884a('0x50')]({'where':{'id':_0x53bb08[_0x884a('0x4d')]['id']}})[_0x884a('0x2c')](handleEntityNotFound(_0x125d56,null))['then'](function(_0x4a98d9){if(_0x4a98d9){_0x53bb08[_0x884a('0x52')]['DashboardId']=_0x4a98d9['id'];_0x53bb08['body'][_0x884a('0x62')]=widgetAttributes(_0x53bb08[_0x884a('0x52')]);return db[_0x884a('0x82')][_0x884a('0x51')](_0x53bb08[_0x884a('0x52')]);}})[_0x884a('0x2c')](respondWithResult(_0x125d56,null))[_0x884a('0x5a')](handleError(_0x125d56,null));};exports[_0x884a('0x83')]=function(_0x3c174d,_0xc6d973,_0xc7ad9f){var _0x50a174={};var _0x3ce628={};var _0x1cd5eb;var _0x1df0c6;return db[_0x884a('0x4a')][_0x884a('0x84')]({'where':{'id':_0x3c174d[_0x884a('0x4d')]['id']}})[_0x884a('0x2c')](handleEntityNotFound(_0xc6d973,null))[_0x884a('0x2c')](function(_0x11bace){if(_0x11bace){_0x1cd5eb=_0x11bace;_0x3ce628[_0x884a('0x3a')]=_[_0x884a('0x3c')](db[_0x884a('0x82')][_0x884a('0x36')]);_0x3ce628[_0x884a('0x3b')]=_[_0x884a('0x3c')](_0x3c174d['query']);_0x3ce628[_0x884a('0x3d')]=_[_0x884a('0x3e')](_0x3ce628['model'],_0x3ce628['query']);_0x50a174[_0x884a('0x3f')]=_['intersection'](_0x3ce628[_0x884a('0x3a')],qs[_0x884a('0x40')](_0x3c174d[_0x884a('0x3b')][_0x884a('0x40')]));_0x50a174[_0x884a('0x3f')]=_0x50a174[_0x884a('0x3f')][_0x884a('0x41')]?_0x50a174[_0x884a('0x3f')]:_0x3ce628[_0x884a('0x3a')];_0x50a174[_0x884a('0x44')]=qs[_0x884a('0x45')](_0x3c174d[_0x884a('0x3b')][_0x884a('0x45')]);_0x50a174['where']=qs[_0x884a('0x3d')](_['pick'](_0x3c174d[_0x884a('0x3b')],_0x3ce628[_0x884a('0x3d')]));if(_0x3c174d[_0x884a('0x3b')][_0x884a('0x47')]){_0x50a174['where']=_[_0x884a('0x48')](_0x50a174['where'],{'$or':_[_0x884a('0x35')](_0x50a174[_0x884a('0x3f')],function(_0x2b9dcc){var _0x3c8763={};_0x3c8763[_0x2b9dcc]={'$like':'%'+_0x3c174d['query'][_0x884a('0x47')]+'%'};return _0x3c8763;})});}_0x50a174=_[_0x884a('0x48')]({},_0x50a174,_0x3c174d[_0x884a('0x4f')]);return _0x1cd5eb[_0x884a('0x83')](_0x50a174);}})['then'](function(_0x4ec1f7){if(_0x4ec1f7){_0x1df0c6=_0x4ec1f7[_0x884a('0x41')];if(!_0x3c174d[_0x884a('0x3b')]['hasOwnProperty'](_0x884a('0x43'))){_0x50a174[_0x884a('0x25')]=qs[_0x884a('0x25')](_0x3c174d['query'][_0x884a('0x25')]);_0x50a174[_0x884a('0x22')]=qs['offset'](_0x3c174d[_0x884a('0x3b')][_0x884a('0x22')]);}return _0x1cd5eb['getItems'](_0x50a174);}})[_0x884a('0x2c')](function(_0x1f46a9){if(_0x1f46a9){return _0x1f46a9?{'count':_0x1df0c6,'rows':_0x1f46a9}:null;}})[_0x884a('0x2c')](respondWithResult(_0xc6d973,null))[_0x884a('0x5a')](handleError(_0xc6d973,null));}; \ No newline at end of file +var _0x4a17=['map','Dashboard','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','createdAt','omit','updatedAt','update','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChatWebsites','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x551754,_0x542785){var _0x22869d=function(_0x3ad6eb){while(--_0x3ad6eb){_0x551754['push'](_0x551754['shift']());}};_0x22869d(++_0x542785);}(_0x4a17,0x1d8));var _0x74a1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4a17[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74a1('0x0'));var zipdir=require(_0x74a1('0x1'));var jsonpatch=require(_0x74a1('0x2'));var rp=require(_0x74a1('0x3'));var moment=require(_0x74a1('0x4'));var BPromise=require(_0x74a1('0x5'));var Mustache=require(_0x74a1('0x6'));var util=require(_0x74a1('0x7'));var path=require(_0x74a1('0x8'));var sox=require(_0x74a1('0x9'));var csv=require('to-csv');var ejs=require(_0x74a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74a1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74a1('0xc'));var deskjs=require(_0x74a1('0xd'));var toCsv=require(_0x74a1('0xe'));var querystring=require(_0x74a1('0xf'));var Papa=require(_0x74a1('0x10'));var Redis=require(_0x74a1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x74a1('0x12'));var as=require(_0x74a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74a1('0x14'))('api');var utils=require(_0x74a1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74a1('0x16'))['db'];config[_0x74a1('0x17')]=_[_0x74a1('0x18')](config[_0x74a1('0x17')],{'host':_0x74a1('0x19'),'port':0x18eb});var socket=require(_0x74a1('0x1a'))(new Redis(config['redis']));require(_0x74a1('0x1b'))[_0x74a1('0x1c')](socket);function respondWithStatusCode(_0x29652a,_0x10f43c){_0x10f43c=_0x10f43c||0xcc;return function(_0x1cde3d){if(_0x1cde3d){return _0x29652a['sendStatus'](_0x10f43c);}return _0x29652a[_0x74a1('0x1d')](_0x10f43c)[_0x74a1('0x1e')]();};}function respondWithResult(_0x205276,_0x323017){_0x323017=_0x323017||0xc8;return function(_0x134ab8){if(_0x134ab8){return _0x205276['status'](_0x323017)[_0x74a1('0x1f')](_0x134ab8);}};}function respondWithFilteredResult(_0x181273,_0x130b13){return function(_0x140166){if(_0x140166){var _0x4b6845=typeof _0x130b13[_0x74a1('0x20')]===_0x74a1('0x21')&&typeof _0x130b13[_0x74a1('0x22')]==='undefined';var _0x59fcfa=_0x140166[_0x74a1('0x23')];var _0x32354f=_0x4b6845?0x0:_0x130b13['offset'];var _0xc32bf4=_0x4b6845?_0x140166['count']:_0x130b13[_0x74a1('0x20')]+_0x130b13[_0x74a1('0x22')];var _0x3244a7;if(_0xc32bf4>=_0x59fcfa){_0xc32bf4=_0x59fcfa;_0x3244a7=0xc8;}else{_0x3244a7=0xce;}_0x181273[_0x74a1('0x1d')](_0x3244a7);return _0x181273[_0x74a1('0x24')](_0x74a1('0x25'),_0x32354f+'-'+_0xc32bf4+'/'+_0x59fcfa)['json'](_0x140166);}return null;};}function patchUpdates(_0x261b44){return function(_0x46bd1c){try{jsonpatch[_0x74a1('0x26')](_0x46bd1c,_0x261b44,!![]);}catch(_0x4b3c39){return BPromise[_0x74a1('0x27')](_0x4b3c39);}return _0x46bd1c['save']();};}function saveUpdates(_0x21ed54,_0x1c84fe){return function(_0x320caa){if(_0x320caa){return _0x320caa['update'](_0x21ed54)[_0x74a1('0x28')](function(_0x3fa990){return _0x3fa990;});}return null;};}function removeEntity(_0x491d44,_0x3616b6){return function(_0x28e174){if(_0x28e174){return _0x28e174['destroy']()[_0x74a1('0x28')](function(){var _0x1edfce=_0x28e174[_0x74a1('0x29')]({'plain':!![]});var _0x57eba1='CustomDashboards';return db[_0x74a1('0x2a')]['destroy']({'where':{'type':_0x57eba1,'resourceId':_0x1edfce['id']}})[_0x74a1('0x28')](function(){return _0x28e174;});})['then'](function(){_0x491d44[_0x74a1('0x1d')](0xcc)[_0x74a1('0x1e')]();});}};}function handleEntityNotFound(_0x706db1,_0x523b06){return function(_0x7b414c){if(!_0x7b414c){_0x706db1[_0x74a1('0x2b')](0x194);}return _0x7b414c;};}function handleError(_0x40a6e3,_0x4b7770){_0x4b7770=_0x4b7770||0x1f4;return function(_0x545aaa){logger[_0x74a1('0x2c')](_0x545aaa[_0x74a1('0x2d')]);if(_0x545aaa[_0x74a1('0x2e')]){delete _0x545aaa[_0x74a1('0x2e')];}_0x40a6e3[_0x74a1('0x1d')](_0x4b7770)[_0x74a1('0x2f')](_0x545aaa);};}exports['index']=function(_0x12a9f2,_0x26182d){var _0x23bd74={},_0x2d1118={},_0x4ee173={'count':0x0,'rows':[]};var _0xb88641=_[_0x74a1('0x30')](db[_0x74a1('0x31')]['rawAttributes'],function(_0x2f1609){return{'name':_0x2f1609[_0x74a1('0x32')],'type':_0x2f1609[_0x74a1('0x33')][_0x74a1('0x34')]};});_0x2d1118[_0x74a1('0x35')]=_['map'](_0xb88641,'name');_0x2d1118['query']=_[_0x74a1('0x36')](_0x12a9f2[_0x74a1('0x37')]);_0x2d1118['filters']=_[_0x74a1('0x38')](_0x2d1118['model'],_0x2d1118[_0x74a1('0x37')]);_0x23bd74[_0x74a1('0x39')]=_[_0x74a1('0x38')](_0x2d1118[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3a')]));_0x23bd74[_0x74a1('0x39')]=_0x23bd74[_0x74a1('0x39')]['length']?_0x23bd74['attributes']:_0x2d1118['model'];if(!_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3b')](_0x74a1('0x3c'))){_0x23bd74['limit']=qs[_0x74a1('0x22')](_0x12a9f2[_0x74a1('0x37')]['limit']);_0x23bd74[_0x74a1('0x20')]=qs['offset'](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x20')]);}_0x23bd74[_0x74a1('0x3d')]=qs['sort'](_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x3e')]);_0x23bd74['where']=qs[_0x74a1('0x3f')](_[_0x74a1('0x40')](_0x12a9f2[_0x74a1('0x37')],_0x2d1118['filters']),_0xb88641);if(_0x12a9f2[_0x74a1('0x37')][_0x74a1('0x41')]){_0x23bd74[_0x74a1('0x42')]=_[_0x74a1('0x43')](_0x23bd74[_0x74a1('0x42')],{'$or':_[_0x74a1('0x30')](_0xb88641,function(_0x1a19ea){if(_0x1a19ea['type']!=='VIRTUAL'){var _0x455fa8={};_0x455fa8[_0x1a19ea[_0x74a1('0x2e')]]={'$like':'%'+_0x12a9f2['query']['filter']+'%'};return _0x455fa8;}})});}_0x23bd74=_[_0x74a1('0x43')]({},_0x23bd74,_0x12a9f2[_0x74a1('0x44')]);var _0x2cace3={'where':_0x23bd74['where']};return db['Dashboard'][_0x74a1('0x23')](_0x2cace3)[_0x74a1('0x28')](function(_0x28f53b){_0x4ee173[_0x74a1('0x23')]=_0x28f53b;if(_0x12a9f2['query'][_0x74a1('0x45')]){_0x23bd74['include']=[{'all':!![]}];}return db['Dashboard'][_0x74a1('0x46')](_0x23bd74);})['then'](function(_0x32b22d){_0x4ee173[_0x74a1('0x47')]=_0x32b22d;return _0x4ee173;})[_0x74a1('0x28')](respondWithFilteredResult(_0x26182d,_0x23bd74))[_0x74a1('0x48')](handleError(_0x26182d,null));};exports['show']=function(_0x44f04c,_0xc1ca43){var _0x1793a9={'raw':![],'where':{'id':_0x44f04c['params']['id']}},_0x185bb6={};_0x185bb6[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x31')][_0x74a1('0x49')]);_0x185bb6[_0x74a1('0x37')]=_['keys'](_0x44f04c[_0x74a1('0x37')]);_0x185bb6['filters']=_['intersection'](_0x185bb6[_0x74a1('0x35')],_0x185bb6[_0x74a1('0x37')]);_0x1793a9[_0x74a1('0x39')]=_['intersection'](_0x185bb6[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x44f04c['query'][_0x74a1('0x3a')]));_0x1793a9['attributes']=_0x1793a9[_0x74a1('0x39')]['length']?_0x1793a9[_0x74a1('0x39')]:_0x185bb6[_0x74a1('0x35')];if(_0x44f04c[_0x74a1('0x37')]['includeAll']){_0x1793a9['include']=[{'all':!![]}];}_0x1793a9=_['merge']({},_0x1793a9,_0x44f04c[_0x74a1('0x44')]);return db[_0x74a1('0x31')][_0x74a1('0x4a')](_0x1793a9)[_0x74a1('0x28')](handleEntityNotFound(_0xc1ca43,null))[_0x74a1('0x28')](respondWithResult(_0xc1ca43,null))[_0x74a1('0x48')](handleError(_0xc1ca43,null));};exports[_0x74a1('0x4b')]=function(_0x1a16ca,_0x556e13){return db[_0x74a1('0x31')][_0x74a1('0x4b')](_0x1a16ca[_0x74a1('0x4c')],{})[_0x74a1('0x28')](function(_0x546fc4){var _0x342f6e=_0x1a16ca[_0x74a1('0x4d')][_0x74a1('0x29')]({'plain':!![]});if(!_0x342f6e)throw new Error(_0x74a1('0x4e'));if(_0x342f6e[_0x74a1('0x4f')]===_0x74a1('0x4d')){var _0x2f0b=_0x546fc4[_0x74a1('0x29')]({'plain':!![]});var _0x3d7891=_0x74a1('0x50');return db[_0x74a1('0x51')]['find']({'where':{'name':_0x3d7891,'userProfileId':_0x342f6e[_0x74a1('0x52')]},'raw':!![]})[_0x74a1('0x28')](function(_0x1c6a87){if(_0x1c6a87&&_0x1c6a87[_0x74a1('0x53')]===0x0){return db[_0x74a1('0x2a')][_0x74a1('0x4b')]({'name':_0x2f0b[_0x74a1('0x2e')],'resourceId':_0x2f0b['id'],'type':_0x1c6a87['name'],'sectionId':_0x1c6a87['id']},{})[_0x74a1('0x28')](function(){return _0x546fc4;});}else{return _0x546fc4;}})['catch'](function(_0x15075e){logger[_0x74a1('0x2c')](_0x74a1('0x54'),_0x15075e);throw _0x15075e;});}return _0x546fc4;})[_0x74a1('0x28')](respondWithResult(_0x556e13,0xc9))[_0x74a1('0x48')](handleError(_0x556e13,null));};exports['clone']=function(_0x464026,_0x4bbd39){var _0x90885d={'where':{'id':_0x464026[_0x74a1('0x55')]['id']}},_0x254e5b={};_0x254e5b[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x31')][_0x74a1('0x49')]);_0x90885d[_0x74a1('0x39')]=_[_0x74a1('0x38')](_0x254e5b['model'],qs['fields'](_0x464026['query'][_0x74a1('0x3a')]));_0x90885d[_0x74a1('0x39')]=_0x90885d[_0x74a1('0x39')][_0x74a1('0x56')]?_0x90885d[_0x74a1('0x39')]:_0x254e5b[_0x74a1('0x35')];if(_0x464026['query'][_0x74a1('0x45')]){_0x90885d['include']=[{'all':!![]}];}_0x90885d=_['merge']({},_0x90885d,_0x464026[_0x74a1('0x44')]);return db[_0x74a1('0x31')][_0x74a1('0x4a')](_0x90885d)[_0x74a1('0x28')](handleEntityNotFound(_0x4bbd39,null))[_0x74a1('0x28')](function(_0x59b1c5){if(_0x59b1c5){var _0x18532d=_0x59b1c5[_0x74a1('0x29')]({'plain':!![]});_0x18532d=qs['omit'](_0x18532d,['id',_0x74a1('0x57'),'updatedAt']);_0x464026[_0x74a1('0x4c')]=_[_0x74a1('0x58')](_0x464026[_0x74a1('0x4c')],['id',_0x74a1('0x57'),_0x74a1('0x59')]);return db[_0x74a1('0x31')][_0x74a1('0x4b')](_[_0x74a1('0x43')](_0x18532d,_0x464026['body']),{'include':_0x464026[_0x74a1('0x37')][_0x74a1('0x45')]?[{'all':!![]}]:undefined})[_0x74a1('0x28')](function(_0x77053c){var _0x334d24=_0x464026['user'][_0x74a1('0x29')]({'plain':!![]});if(!_0x334d24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x334d24[_0x74a1('0x4f')]===_0x74a1('0x4d')){var _0x451887=_0x77053c[_0x74a1('0x29')]({'plain':!![]});var _0x116bc4='CustomDashboards';return db['UserProfileSection'][_0x74a1('0x4a')]({'where':{'name':_0x116bc4,'userProfileId':_0x334d24[_0x74a1('0x52')]},'raw':!![]})[_0x74a1('0x28')](function(_0x15ffa5){if(_0x15ffa5&&_0x15ffa5['autoAssociation']===0x0){return db[_0x74a1('0x2a')][_0x74a1('0x4b')]({'name':_0x451887[_0x74a1('0x2e')],'resourceId':_0x451887['id'],'type':_0x15ffa5['name'],'sectionId':_0x15ffa5['id']},{})[_0x74a1('0x28')](function(){return _0x77053c;});}else{return _0x77053c;}})[_0x74a1('0x48')](function(_0x5dae4e){logger['error'](_0x74a1('0x54'),_0x5dae4e);throw _0x5dae4e;});}return _0x77053c;});}})[_0x74a1('0x28')](respondWithResult(_0x4bbd39,0xc9))[_0x74a1('0x48')](handleError(_0x4bbd39,null));};exports[_0x74a1('0x5a')]=function(_0x2f2ecf,_0x254b41){if(_0x2f2ecf[_0x74a1('0x4c')]['id']){delete _0x2f2ecf[_0x74a1('0x4c')]['id'];}return db[_0x74a1('0x31')][_0x74a1('0x4a')]({'where':{'id':_0x2f2ecf[_0x74a1('0x55')]['id']}})[_0x74a1('0x28')](handleEntityNotFound(_0x254b41,null))[_0x74a1('0x28')](saveUpdates(_0x2f2ecf['body'],null))['then'](respondWithResult(_0x254b41,null))[_0x74a1('0x48')](handleError(_0x254b41,null));};exports[_0x74a1('0x5b')]=function(_0x5c7bb3,_0x468a4d){return db[_0x74a1('0x31')][_0x74a1('0x4a')]({'where':{'id':_0x5c7bb3[_0x74a1('0x55')]['id']}})['then'](handleEntityNotFound(_0x468a4d,null))[_0x74a1('0x28')](removeEntity(_0x468a4d,null))[_0x74a1('0x48')](handleError(_0x468a4d,null));};function widgetAttributes(_0x46208f){try{switch(_0x46208f['type']){case _0x74a1('0x5c'):return[{'name':_0x74a1('0x5d'),'value':_0x46208f['attrUrl']||(_0x46208f['attrs']&&_0x46208f['attrs'][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||_0x74a1('0x60')}];case _0x74a1('0x61'):return[{'name':_0x74a1('0x62'),'value':_0x46208f[_0x74a1('0x62')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||''}];case _0x74a1('0x63'):return[{'name':_0x74a1('0x64'),'value':_0x46208f[_0x74a1('0x64')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f['attrs'][0x0][_0x74a1('0x5f')]:undefined)||_0x74a1('0x65')},{'name':_0x74a1('0x66'),'value':_0x46208f['attrTimezone']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||_0x74a1('0x67')},{'name':'attrFontSize','value':_0x46208f[_0x74a1('0x68')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x2]?_0x46208f[_0x74a1('0x5e')][0x2][_0x74a1('0x5f')]:undefined)||0xc}];case _0x74a1('0x69'):return[{'name':'attrMetric','value':_0x46208f[_0x74a1('0x6a')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||'total'},{'name':_0x74a1('0x6b'),'value':_0x46208f[_0x74a1('0x6b')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||[]},{'name':_0x74a1('0x68'),'value':_0x46208f[_0x74a1('0x68')]||(_0x46208f['attrs']&&_0x46208f['attrs'][0x2]?_0x46208f['attrs'][0x2][_0x74a1('0x5f')]:undefined)||0x14},{'name':_0x74a1('0x6c'),'value':_0x46208f[_0x74a1('0x6c')]||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x3]?_0x46208f[_0x74a1('0x5e')][0x3][_0x74a1('0x5f')]:undefined)||_0x74a1('0x6d')},{'name':'attrEmailAccounts','value':_0x46208f[_0x74a1('0x6e')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x4]?_0x46208f[_0x74a1('0x5e')][0x4]['value']:undefined)||''},{'name':_0x74a1('0x6f'),'value':_0x46208f['attrFaxAccounts']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x5]?_0x46208f['attrs'][0x5][_0x74a1('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x46208f[_0x74a1('0x70')]||(_0x46208f['attrs']&&_0x46208f['attrs'][0x6]?_0x46208f[_0x74a1('0x5e')][0x6]['value']:undefined)||''},{'name':_0x74a1('0x71'),'value':_0x46208f[_0x74a1('0x71')]||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x7]?_0x46208f[_0x74a1('0x5e')][0x7]['value']:undefined)||''},{'name':_0x74a1('0x72'),'value':_0x46208f['attrWhatsappAccounts']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x8]?_0x46208f[_0x74a1('0x5e')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x46208f['attrChatWebsites']||(_0x46208f['attrs']&&_0x46208f[_0x74a1('0x5e')][0x9]?_0x46208f['attrs'][0x9]['value']:undefined)||''}];case _0x74a1('0x73'):case'pie-chart':return[{'name':_0x74a1('0x74'),'value':_0x46208f[_0x74a1('0x74')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x0]?_0x46208f['attrs'][0x0]['value']:undefined)||_0x74a1('0x75')},{'name':_0x74a1('0x76'),'value':_0x46208f['attrSerie2']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f['attrs'][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||null},{'name':_0x74a1('0x77'),'value':_0x46208f[_0x74a1('0x77')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x2]?_0x46208f[_0x74a1('0x5e')][0x2]['value']:undefined)||null},{'name':_0x74a1('0x6b'),'value':_0x46208f['attrVoiceQueues']||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x3]?_0x46208f['attrs'][0x3]['value']:undefined)||[]},{'name':_0x74a1('0x6c'),'value':_0x46208f[_0x74a1('0x6c')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x4]?_0x46208f[_0x74a1('0x5e')][0x4][_0x74a1('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x46208f[_0x74a1('0x6e')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x5]?_0x46208f[_0x74a1('0x5e')][0x5][_0x74a1('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x46208f[_0x74a1('0x6f')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x6]?_0x46208f[_0x74a1('0x5e')][0x6][_0x74a1('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x46208f[_0x74a1('0x70')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x7]?_0x46208f[_0x74a1('0x5e')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x46208f[_0x74a1('0x71')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x8]?_0x46208f[_0x74a1('0x5e')][0x8][_0x74a1('0x5f')]:undefined)||''},{'name':_0x74a1('0x72'),'value':_0x46208f[_0x74a1('0x72')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x9]?_0x46208f[_0x74a1('0x5e')][0x9][_0x74a1('0x5f')]:undefined)||''},{'name':_0x74a1('0x78'),'value':_0x46208f[_0x74a1('0x78')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0xa]?_0x46208f[_0x74a1('0x5e')][0xa][_0x74a1('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x74a1('0x79'),'type':_0x46208f[_0x74a1('0x7a')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x33')]:undefined)||null,'value':_0x46208f[_0x74a1('0x79')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x0]?_0x46208f[_0x74a1('0x5e')][0x0][_0x74a1('0x5f')]:undefined)||null},{'name':_0x74a1('0x7b'),'value':_0x46208f[_0x74a1('0x7b')]||(_0x46208f[_0x74a1('0x5e')]&&_0x46208f[_0x74a1('0x5e')][0x1]?_0x46208f[_0x74a1('0x5e')][0x1][_0x74a1('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0xdab7c4){logger['error'](_0x74a1('0x7c'),JSON['stringify'](_0xdab7c4));return[];}}exports[_0x74a1('0x7d')]=function(_0x45eedb,_0x5a6798,_0x4e6949){if(_0x45eedb[_0x74a1('0x4c')]['id']){delete _0x45eedb[_0x74a1('0x4c')]['id'];}return db[_0x74a1('0x31')]['find']({'where':{'id':_0x45eedb['params']['id']}})['then'](handleEntityNotFound(_0x5a6798,null))[_0x74a1('0x28')](function(_0x1127bd){if(_0x1127bd){_0x45eedb[_0x74a1('0x4c')][_0x74a1('0x7e')]=_0x1127bd['id'];_0x45eedb[_0x74a1('0x4c')][_0x74a1('0x5e')]=widgetAttributes(_0x45eedb['body']);return db[_0x74a1('0x7f')][_0x74a1('0x4b')](_0x45eedb[_0x74a1('0x4c')]);}})['then'](respondWithResult(_0x5a6798,null))[_0x74a1('0x48')](handleError(_0x5a6798,null));};exports[_0x74a1('0x80')]=function(_0x5e260f,_0x59eb0b,_0x144001){var _0x4f6059={};var _0x26f32c={};var _0x4f816a;var _0x2315a;return db['Dashboard'][_0x74a1('0x81')]({'where':{'id':_0x5e260f[_0x74a1('0x55')]['id']}})[_0x74a1('0x28')](handleEntityNotFound(_0x59eb0b,null))[_0x74a1('0x28')](function(_0x3b7d85){if(_0x3b7d85){_0x4f816a=_0x3b7d85;_0x26f32c[_0x74a1('0x35')]=_[_0x74a1('0x36')](db[_0x74a1('0x7f')]['rawAttributes']);_0x26f32c[_0x74a1('0x37')]=_[_0x74a1('0x36')](_0x5e260f['query']);_0x26f32c[_0x74a1('0x3f')]=_[_0x74a1('0x38')](_0x26f32c[_0x74a1('0x35')],_0x26f32c[_0x74a1('0x37')]);_0x4f6059['attributes']=_[_0x74a1('0x38')](_0x26f32c[_0x74a1('0x35')],qs[_0x74a1('0x3a')](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x3a')]));_0x4f6059[_0x74a1('0x39')]=_0x4f6059[_0x74a1('0x39')][_0x74a1('0x56')]?_0x4f6059[_0x74a1('0x39')]:_0x26f32c[_0x74a1('0x35')];_0x4f6059['order']=qs[_0x74a1('0x3e')](_0x5e260f['query']['sort']);_0x4f6059[_0x74a1('0x42')]=qs[_0x74a1('0x3f')](_[_0x74a1('0x40')](_0x5e260f[_0x74a1('0x37')],_0x26f32c['filters']));if(_0x5e260f[_0x74a1('0x37')][_0x74a1('0x41')]){_0x4f6059[_0x74a1('0x42')]=_['merge'](_0x4f6059[_0x74a1('0x42')],{'$or':_['map'](_0x4f6059[_0x74a1('0x39')],function(_0x1f2760){var _0x25a7d8={};_0x25a7d8[_0x1f2760]={'$like':'%'+_0x5e260f[_0x74a1('0x37')][_0x74a1('0x41')]+'%'};return _0x25a7d8;})});}_0x4f6059=_[_0x74a1('0x43')]({},_0x4f6059,_0x5e260f[_0x74a1('0x44')]);return _0x4f816a[_0x74a1('0x80')](_0x4f6059);}})[_0x74a1('0x28')](function(_0x5b6ff4){if(_0x5b6ff4){_0x2315a=_0x5b6ff4[_0x74a1('0x56')];if(!_0x5e260f[_0x74a1('0x37')][_0x74a1('0x3b')](_0x74a1('0x3c'))){_0x4f6059[_0x74a1('0x22')]=qs['limit'](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x22')]);_0x4f6059[_0x74a1('0x20')]=qs[_0x74a1('0x20')](_0x5e260f[_0x74a1('0x37')][_0x74a1('0x20')]);}return _0x4f816a[_0x74a1('0x80')](_0x4f6059);}})[_0x74a1('0x28')](function(_0x108e14){if(_0x108e14){return _0x108e14?{'count':_0x2315a,'rows':_0x108e14}:null;}})[_0x74a1('0x28')](respondWithResult(_0x59eb0b,null))[_0x74a1('0x48')](handleError(_0x59eb0b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7bf0af1..fc89496 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 _0x1396=['hook','exports','events','Dashboard','update','remove','emit','hasOwnProperty'];(function(_0x4aae32,_0x23b3ad){var _0x479251=function(_0x1f5d51){while(--_0x1f5d51){_0x4aae32['push'](_0x4aae32['shift']());}};_0x479251(++_0x23b3ad);}(_0x1396,0x1ea));var _0x6139=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x1396[_0x18ab2a];return _0x16dcee;};'use strict';var EventEmitter=require(_0x6139('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x6139('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6139('0x2'),'afterDestroy':_0x6139('0x3')};function emitEvent(_0x558e00){return function(_0x409054,_0x55c7d4,_0x3cb3a9){DashboardEvents[_0x6139('0x4')](_0x558e00+':'+_0x409054['id'],_0x409054);DashboardEvents[_0x6139('0x4')](_0x558e00,_0x409054);_0x3cb3a9(null);};}for(var e in events){if(events[_0x6139('0x5')](e)){var event=events[e];Dashboard[_0x6139('0x6')](e,emitEvent(event));}}module[_0x6139('0x7')]=DashboardEvents; \ No newline at end of file +var _0x4baf=['events','Dashboard','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x5a65ce,_0x446901){var _0x3af041=function(_0x25d617){while(--_0x25d617){_0x5a65ce['push'](_0x5a65ce['shift']());}};_0x3af041(++_0x446901);}(_0x4baf,0xb4));var _0xf4ba=function(_0x33c0fc,_0xde9566){_0x33c0fc=_0x33c0fc-0x0;var _0x1df548=_0x4baf[_0x33c0fc];return _0x1df548;};'use strict';var EventEmitter=require(_0xf4ba('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xf4ba('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf4ba('0x2')](0x0);var events={'afterCreate':_0xf4ba('0x3'),'afterUpdate':_0xf4ba('0x4'),'afterDestroy':_0xf4ba('0x5')};function emitEvent(_0x99dfe0){return function(_0x1e16aa,_0x1bac1a,_0x23e730){DashboardEvents['emit'](_0x99dfe0+':'+_0x1e16aa['id'],_0x1e16aa);DashboardEvents[_0xf4ba('0x6')](_0x99dfe0,_0x1e16aa);_0x23e730(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf4ba('0x7')](e,emitEvent(event));}}module[_0xf4ba('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f5c5dc0..2c1d5be 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 _0x2200=['dashboards','lodash','../../config/logger','request-promise','rimraf','exports','define','Dashboard'];(function(_0x25a7e6,_0x18de96){var _0x592645=function(_0x19d2a0){while(--_0x19d2a0){_0x25a7e6['push'](_0x25a7e6['shift']());}};_0x592645(++_0x18de96);}(_0x2200,0x1e9));var _0x0220=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x2200[_0x333798];return _0x389f4e;};'use strict';var _=require(_0x0220('0x0'));var util=require('util');var logger=require(_0x0220('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0220('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0220('0x3'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x0220('0x4')]=function(_0x4c53df,_0x325cc9){return _0x4c53df[_0x0220('0x5')](_0x0220('0x6'),attributes,{'tableName':_0x0220('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6691=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards'];(function(_0x3ed4b5,_0x17cff5){var _0x2aa0ea=function(_0x10ade6){while(--_0x10ade6){_0x3ed4b5['push'](_0x3ed4b5['shift']());}};_0x2aa0ea(++_0x17cff5);}(_0x6691,0x134));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var logger=require(_0x1669('0x2'))(_0x1669('0x3'));var moment=require(_0x1669('0x4'));var BPromise=require(_0x1669('0x5'));var rp=require(_0x1669('0x6'));var fs=require('fs');var path=require(_0x1669('0x7'));var rimraf=require('rimraf');var config=require(_0x1669('0x8'));var attributes=require(_0x1669('0x9'));module[_0x1669('0xa')]=function(_0x2e2764,_0x467e24){return _0x2e2764[_0x1669('0xb')](_0x1669('0xc'),attributes,{'tableName':_0x1669('0xd'),'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 89d27ad..8f6a2f5 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 _0xd23d=['code','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xd23d,0x170));var _0xdd23=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xd23d[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0xdd23('0x0'));var util=require(_0xdd23('0x1'));var moment=require(_0xdd23('0x2'));var BPromise=require(_0xdd23('0x3'));var rs=require(_0xdd23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd23('0x5'));var logger=require('../../config/logger')(_0xdd23('0x6'));var config=require(_0xdd23('0x7'));var jayson=require(_0xdd23('0x8'));var client=jayson[_0xdd23('0x9')][_0xdd23('0xa')]({'port':0x232a});config[_0xdd23('0xb')]=_[_0xdd23('0xc')](config[_0xdd23('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd23('0xd'))(new Redis(config[_0xdd23('0xb')]));require('./dashboard.socket')[_0xdd23('0xe')](socket);function respondWithRpcPromise(_0x368a4c,_0x248a34,_0x1097d1){return new BPromise(function(_0x417bcb,_0x16a795){return client[_0xdd23('0xf')](_0x368a4c,_0x1097d1)[_0xdd23('0x10')](function(_0x3040a6){logger['info']('Dashboard,\x20%s,\x20%s',_0x248a34,_0xdd23('0x11'));logger[_0xdd23('0x12')](_0xdd23('0x13'),_0x248a34,_0xdd23('0x11'),JSON[_0xdd23('0x14')](_0x3040a6));if(_0x3040a6['error']){if(_0x3040a6[_0xdd23('0x15')][_0xdd23('0x16')]===0x1f4){logger[_0xdd23('0x15')](_0xdd23('0x17'),_0x248a34,_0x3040a6[_0xdd23('0x15')][_0xdd23('0x18')]);return _0x16a795(_0x3040a6[_0xdd23('0x15')][_0xdd23('0x18')]);}logger['error'](_0xdd23('0x17'),_0x248a34,_0x3040a6['error'][_0xdd23('0x18')]);return _0x417bcb(_0x3040a6[_0xdd23('0x15')][_0xdd23('0x18')]);}else{logger['info'](_0xdd23('0x17'),_0x248a34,_0xdd23('0x11'));_0x417bcb(_0x3040a6[_0xdd23('0x19')]['message']);}})['catch'](function(_0x30194d){logger['error'](_0xdd23('0x17'),_0x248a34,_0x30194d);_0x16a795(_0x30194d);});});} \ No newline at end of file +var _0xaa73=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x18e9d2,_0x29ac3e){var _0x1da75e=function(_0x481ed5){while(--_0x481ed5){_0x18e9d2['push'](_0x18e9d2['shift']());}};_0x1da75e(++_0x29ac3e);}(_0xaa73,0xe2));var _0x3aa7=function(_0x37441f,_0x31498b){_0x37441f=_0x37441f-0x0;var _0x786ac1=_0xaa73[_0x37441f];return _0x786ac1;};'use strict';var _=require(_0x3aa7('0x0'));var util=require(_0x3aa7('0x1'));var moment=require(_0x3aa7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3aa7('0x3'));var fs=require('fs');var Redis=require(_0x3aa7('0x4'));var db=require(_0x3aa7('0x5'))['db'];var utils=require(_0x3aa7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3aa7('0x7'));var jayson=require(_0x3aa7('0x8'));var client=jayson['client'][_0x3aa7('0x9')]({'port':0x232a});config['redis']=_[_0x3aa7('0xa')](config[_0x3aa7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3aa7('0xc'))(new Redis(config[_0x3aa7('0xb')]));require('./dashboard.socket')[_0x3aa7('0xd')](socket);function respondWithRpcPromise(_0x4b61b9,_0x117dfc,_0x1ae3e2){return new BPromise(function(_0x42eccc,_0x2d2b4f){return client[_0x3aa7('0xe')](_0x4b61b9,_0x1ae3e2)['then'](function(_0x498724){logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));logger[_0x3aa7('0x12')](_0x3aa7('0x13'),_0x117dfc,_0x3aa7('0x11'),JSON[_0x3aa7('0x14')](_0x498724));if(_0x498724[_0x3aa7('0x15')]){if(_0x498724[_0x3aa7('0x15')]['code']===0x1f4){logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')]['message']);return _0x2d2b4f(_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);}logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);return _0x42eccc(_0x498724[_0x3aa7('0x15')]['message']);}else{logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));_0x42eccc(_0x498724[_0x3aa7('0x17')]['message']);}})[_0x3aa7('0x18')](function(_0x1169b2){logger[_0x3aa7('0x15')](_0x3aa7('0x10'),_0x117dfc,_0x1169b2);_0x2d2b4f(_0x1169b2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f7a2ae0..cdecaa7 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 _0x4ff0=['./dashboard.events','save','remove','update','removeListener','length'];(function(_0x5a0f03,_0x143bf6){var _0x569cb1=function(_0x1e657f){while(--_0x1e657f){_0x5a0f03['push'](_0x5a0f03['shift']());}};_0x569cb1(++_0x143bf6);}(_0x4ff0,0xf0));var _0x04ff=function(_0x43cb99,_0x441893){_0x43cb99=_0x43cb99-0x0;var _0x2ffa7f=_0x4ff0[_0x43cb99];return _0x2ffa7f;};'use strict';var DashboardEvents=require(_0x04ff('0x0'));var events=[_0x04ff('0x1'),_0x04ff('0x2'),_0x04ff('0x3')];function createListener(_0x28fb7a,_0x4dcb89){return function(_0x1dc370){_0x4dcb89['emit'](_0x28fb7a,_0x1dc370);};}function removeListener(_0x445c6d,_0x3f88d8){return function(){DashboardEvents[_0x04ff('0x4')](_0x445c6d,_0x3f88d8);};}exports['register']=function(_0x12a83e){for(var _0x6955c3=0x0,_0x4ad495=events[_0x04ff('0x5')];_0x6955c3<_0x4ad495;_0x6955c3++){var _0x490393=events[_0x6955c3];var _0x55155f=createListener('dashboard:'+_0x490393,_0x12a83e);DashboardEvents['on'](_0x490393,_0x55155f);}}; \ No newline at end of file +var _0xd697=['dashboard:','save','remove','update','emit','removeListener','register'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd697,0x71));var _0x7d69=function(_0x31ea67,_0x2ae326){_0x31ea67=_0x31ea67-0x0;var _0x423462=_0xd697[_0x31ea67];return _0x423462;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x7d69('0x0'),_0x7d69('0x1'),_0x7d69('0x2')];function createListener(_0x542b28,_0x4a1dcc){return function(_0x25eba1){_0x4a1dcc[_0x7d69('0x3')](_0x542b28,_0x25eba1);};}function removeListener(_0x2f390f,_0x2877c8){return function(){DashboardEvents[_0x7d69('0x4')](_0x2f390f,_0x2877c8);};}exports[_0x7d69('0x5')]=function(_0x53d403){for(var _0x5c014d=0x0,_0x243b5f=events['length'];_0x5c014d<_0x243b5f;_0x5c014d++){var _0x582eb8=events[_0x5c014d];var _0x832712=createListener(_0x7d69('0x6')+_0x582eb8,_0x53d403);DashboardEvents['on'](_0x582eb8,_0x832712);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ca0b57b..39a4dae 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 _0x7f12=['../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/items','getItems','post','create','clone','addItem','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x50ec0e,_0x4ee145){var _0x5a4afb=function(_0x39da98){while(--_0x39da98){_0x50ec0e['push'](_0x50ec0e['shift']());}};_0x5a4afb(++_0x4ee145);}(_0x7f12,0x1f3));var _0x27f1=function(_0x45bf3c,_0x5bd01a){_0x45bf3c=_0x45bf3c-0x0;var _0x13fb83=_0x7f12[_0x45bf3c];return _0x13fb83;};'use strict';var multer=require(_0x27f1('0x0'));var util=require(_0x27f1('0x1'));var path=require(_0x27f1('0x2'));var timeout=require(_0x27f1('0x3'));var express=require('express');var router=express[_0x27f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x27f1('0x6'));var controller=require('./dashboard.controller');router[_0x27f1('0x7')]('/',auth[_0x27f1('0x8')](),controller['index']);router[_0x27f1('0x7')]('/:id',auth[_0x27f1('0x8')](),controller[_0x27f1('0x9')]);router[_0x27f1('0x7')](_0x27f1('0xa'),auth[_0x27f1('0x8')](),controller[_0x27f1('0xb')]);router[_0x27f1('0xc')]('/',auth[_0x27f1('0x8')](),controller[_0x27f1('0xd')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x27f1('0xe')]);router[_0x27f1('0xc')]('/:id/items',auth['isAuthenticated'](),controller[_0x27f1('0xf')]);router[_0x27f1('0x10')]('/:id',auth[_0x27f1('0x8')](),controller[_0x27f1('0x11')]);router['delete'](_0x27f1('0x12'),auth[_0x27f1('0x8')](),controller[_0x27f1('0x13')]);module[_0x27f1('0x14')]=router; \ No newline at end of file +var _0x701d=['/:id/items','getItems','create','/:id/clone','clone','post','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show'];(function(_0x2b4852,_0x3ed245){var _0x5eafac=function(_0x536bb7){while(--_0x536bb7){_0x2b4852['push'](_0x2b4852['shift']());}};_0x5eafac(++_0x3ed245);}(_0x701d,0xd0));var _0xd701=function(_0x1b6966,_0xdebb79){_0x1b6966=_0x1b6966-0x0;var _0x28ceff=_0x701d[_0x1b6966];return _0x28ceff;};'use strict';var multer=require(_0xd701('0x0'));var util=require('util');var path=require(_0xd701('0x1'));var timeout=require(_0xd701('0x2'));var express=require('express');var router=express[_0xd701('0x3')]();var fs_extra=require(_0xd701('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd701('0x5'));var config=require(_0xd701('0x6'));var controller=require(_0xd701('0x7'));router[_0xd701('0x8')]('/',auth[_0xd701('0x9')](),controller['index']);router[_0xd701('0x8')](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0xb')]);router[_0xd701('0x8')](_0xd701('0xc'),auth['isAuthenticated'](),controller[_0xd701('0xd')]);router['post']('/',auth[_0xd701('0x9')](),controller[_0xd701('0xe')]);router['post'](_0xd701('0xf'),auth[_0xd701('0x9')](),controller[_0xd701('0x10')]);router[_0xd701('0x11')]('/:id/items',auth[_0xd701('0x9')](),controller['addItem']);router[_0xd701('0x12')](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0x13')]);router['delete'](_0xd701('0xa'),auth[_0xd701('0x9')](),controller[_0xd701('0x14')]);module[_0xd701('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b2ec873..8444728 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 _0x31f0=['INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x4d8c73,_0x1df7ac){var _0x597b1e=function(_0xdefcdb){while(--_0xdefcdb){_0x4d8c73['push'](_0x4d8c73['shift']());}};_0x597b1e(++_0x1df7ac);}(_0x31f0,0xb7));var _0x031f=function(_0x534043,_0x3f55c8){_0x534043=_0x534043-0x0;var _0x39a35b=_0x31f0[_0x534043];return _0x39a35b;};'use strict';var Sequelize=require(_0x031f('0x0'));var squel=require('squel');var _=require(_0x031f('0x1'));module['exports']={'title':{'type':Sequelize[_0x031f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x031f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x031f('0x3')](_0x031f('0x4')),'get':function(){try{return JSON['parse'](this[_0x031f('0x5')](_0x031f('0x6')));}catch(_0x4f6059){return[];}},'set':function(_0x4c0f94){try{this['setDataValue'](_0x031f('0x6'),JSON['stringify'](_0x4c0f94));}catch(_0x365f59){this[_0x031f('0x7')](_0x031f('0x6'),JSON[_0x031f('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x031f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x031f('0x9')]},'col':{'type':Sequelize[_0x031f('0x9')]},'background':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x031f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x18cf67,_0x40b5b4){var _0x19089e=function(_0x1ba3c0){while(--_0x1ba3c0){_0x18cf67['push'](_0x18cf67['shift']());}};_0x19089e(++_0x40b5b4);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c26a0,_0x2b9577){_0x2c26a0=_0x2c26a0-0x0;var _0x3e26d2=_0x5fab[_0x2c26a0];return _0x3e26d2;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index e6fe434..77a60ce 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 _0xb296=['undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','attrOpenchannelAccounts','attrChatWebsites','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./dashboardItem.socket','sendStatus','status','end','json','offset'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb296,0xa3));var _0x6b29=function(_0x289aaa,_0x4a0e5e){_0x289aaa=_0x289aaa-0x0;var _0x17e942=_0xb296[_0x289aaa];return _0x17e942;};'use strict';var emlformat=require(_0x6b29('0x0'));var rimraf=require(_0x6b29('0x1'));var zipdir=require(_0x6b29('0x2'));var jsonpatch=require(_0x6b29('0x3'));var rp=require(_0x6b29('0x4'));var moment=require(_0x6b29('0x5'));var BPromise=require(_0x6b29('0x6'));var Mustache=require('mustache');var util=require(_0x6b29('0x7'));var path=require('path');var sox=require(_0x6b29('0x8'));var csv=require(_0x6b29('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b29('0xa'));var _=require(_0x6b29('0xb'));var squel=require(_0x6b29('0xc'));var crypto=require(_0x6b29('0xd'));var jsforce=require(_0x6b29('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b29('0x9'));var querystring=require(_0x6b29('0xf'));var Papa=require(_0x6b29('0x10'));var Redis=require(_0x6b29('0x11'));var authService=require(_0x6b29('0x12'));var qs=require(_0x6b29('0x13'));var as=require(_0x6b29('0x14'));var hardwareService=require(_0x6b29('0x15'));var logger=require('../../config/logger')(_0x6b29('0x16'));var utils=require(_0x6b29('0x17'));var config=require(_0x6b29('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b29('0x19'))['db'];config['redis']=_['defaults'](config[_0x6b29('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b29('0x1a')]));require(_0x6b29('0x1b'))['register'](socket);function respondWithStatusCode(_0x37a206,_0x222635){_0x222635=_0x222635||0xcc;return function(_0x9e1b53){if(_0x9e1b53){return _0x37a206[_0x6b29('0x1c')](_0x222635);}return _0x37a206[_0x6b29('0x1d')](_0x222635)[_0x6b29('0x1e')]();};}function respondWithResult(_0x383e5f,_0x578ab5){_0x578ab5=_0x578ab5||0xc8;return function(_0x45acdf){if(_0x45acdf){return _0x383e5f[_0x6b29('0x1d')](_0x578ab5)[_0x6b29('0x1f')](_0x45acdf);}};}function respondWithFilteredResult(_0x49620d,_0x4b348d){return function(_0xc9511c){if(_0xc9511c){var _0x298470=typeof _0x4b348d[_0x6b29('0x20')]===_0x6b29('0x21')&&typeof _0x4b348d[_0x6b29('0x22')]===_0x6b29('0x21');var _0x412e1d=_0xc9511c[_0x6b29('0x23')];var _0x555008=_0x298470?0x0:_0x4b348d[_0x6b29('0x20')];var _0xdf69a8=_0x298470?_0xc9511c[_0x6b29('0x23')]:_0x4b348d['offset']+_0x4b348d[_0x6b29('0x22')];var _0x2f2fdc;if(_0xdf69a8>=_0x412e1d){_0xdf69a8=_0x412e1d;_0x2f2fdc=0xc8;}else{_0x2f2fdc=0xce;}_0x49620d['status'](_0x2f2fdc);return _0x49620d[_0x6b29('0x24')](_0x6b29('0x25'),_0x555008+'-'+_0xdf69a8+'/'+_0x412e1d)['json'](_0xc9511c);}return null;};}function patchUpdates(_0x312e12){return function(_0x1696cd){try{jsonpatch[_0x6b29('0x26')](_0x1696cd,_0x312e12,!![]);}catch(_0x263fb2){return BPromise[_0x6b29('0x27')](_0x263fb2);}return _0x1696cd['save']();};}function saveUpdates(_0x2765d5,_0x4d7521){return function(_0x237cad){if(_0x237cad){return _0x237cad[_0x6b29('0x28')](_0x2765d5)[_0x6b29('0x29')](function(_0x5ab584){return _0x5ab584;});}return null;};}function removeEntity(_0x308142,_0x21c442){return function(_0x269d55){if(_0x269d55){return _0x269d55['destroy']()[_0x6b29('0x29')](function(){_0x308142[_0x6b29('0x1d')](0xcc)[_0x6b29('0x1e')]();});}};}function handleEntityNotFound(_0x654528,_0x5546b4){return function(_0x537092){if(!_0x537092){_0x654528[_0x6b29('0x1c')](0x194);}return _0x537092;};}function handleError(_0x207c39,_0x330a6d){_0x330a6d=_0x330a6d||0x1f4;return function(_0x18ea35){logger[_0x6b29('0x2a')](_0x18ea35[_0x6b29('0x2b')]);if(_0x18ea35[_0x6b29('0x2c')]){delete _0x18ea35['name'];}_0x207c39[_0x6b29('0x1d')](_0x330a6d)[_0x6b29('0x2d')](_0x18ea35);};}exports[_0x6b29('0x2e')]=function(_0x36e708,_0x36e293){var _0x2343c0={'raw':![],'where':{'id':_0x36e708[_0x6b29('0x2f')]['id']}},_0x49bb5b={};_0x49bb5b[_0x6b29('0x30')]=_[_0x6b29('0x31')](db[_0x6b29('0x32')][_0x6b29('0x33')]);_0x49bb5b[_0x6b29('0x34')]=_[_0x6b29('0x31')](_0x36e708['query']);_0x49bb5b[_0x6b29('0x35')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],_0x49bb5b[_0x6b29('0x34')]);_0x2343c0[_0x6b29('0x37')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],qs[_0x6b29('0x38')](_0x36e708['query']['fields']));_0x2343c0['attributes']=_0x2343c0['attributes'][_0x6b29('0x39')]?_0x2343c0[_0x6b29('0x37')]:_0x49bb5b[_0x6b29('0x30')];if(_0x36e708['query'][_0x6b29('0x3a')]){_0x2343c0[_0x6b29('0x3b')]=[{'all':!![]}];}_0x2343c0=_[_0x6b29('0x3c')]({},_0x2343c0,_0x36e708[_0x6b29('0x3d')]);return db['DashboardItem'][_0x6b29('0x3e')](_0x2343c0)[_0x6b29('0x29')](handleEntityNotFound(_0x36e293,null))[_0x6b29('0x29')](respondWithResult(_0x36e293,null))['catch'](handleError(_0x36e293,null));};exports['destroy']=function(_0x31fe46,_0x5b8e0f){return db['DashboardItem'][_0x6b29('0x3e')]({'where':{'id':_0x31fe46[_0x6b29('0x2f')]['id']}})[_0x6b29('0x29')](handleEntityNotFound(_0x5b8e0f,null))[_0x6b29('0x29')](removeEntity(_0x5b8e0f,null))['catch'](handleError(_0x5b8e0f,null));};function widgetAttributes(_0x37f14e){try{switch(_0x37f14e['type']){case _0x6b29('0x3f'):return[{'name':_0x6b29('0x40'),'value':_0x37f14e[_0x6b29('0x40')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e['attrs'][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x43')}];case _0x6b29('0x44'):return[{'name':_0x6b29('0x45'),'value':_0x37f14e['attrPath']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x37f14e[_0x6b29('0x46')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x47')},{'name':_0x6b29('0x48'),'value':_0x37f14e['attrTimezone']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||_0x6b29('0x49')},{'name':_0x6b29('0x4a'),'value':_0x37f14e['attrFontSize']||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||0xc}];case _0x6b29('0x4b'):return[{'name':_0x6b29('0x4c'),'value':_0x37f14e[_0x6b29('0x4c')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x4d')},{'name':'attrVoiceQueues','value':_0x37f14e['attrVoiceQueues']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e[_0x6b29('0x41')][0x1]['value']:undefined)||[]},{'name':_0x6b29('0x4a'),'value':_0x37f14e[_0x6b29('0x4a')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e['attrs'][0x2][_0x6b29('0x42')]:undefined)||0x14},{'name':_0x6b29('0x4e'),'value':_0x37f14e['attrChannel']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x3]?_0x37f14e[_0x6b29('0x41')][0x3][_0x6b29('0x42')]:undefined)||'voice'},{'name':_0x6b29('0x4f'),'value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e['attrs'][0x4][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e[_0x6b29('0x51')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e['attrOpenchannelAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e[_0x6b29('0x41')][0x7][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e[_0x6b29('0x41')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e['attrChatWebsites']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e['attrs'][0x9][_0x6b29('0x42')]:undefined)||''}];case _0x6b29('0x53'):case'pie-chart':return[{'name':_0x6b29('0x54'),'value':_0x37f14e[_0x6b29('0x54')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x4d')},{'name':_0x6b29('0x55'),'value':_0x37f14e[_0x6b29('0x55')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x1]?_0x37f14e[_0x6b29('0x41')][0x1][_0x6b29('0x42')]:undefined)||null},{'name':_0x6b29('0x56'),'value':_0x37f14e[_0x6b29('0x56')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x37f14e[_0x6b29('0x57')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x3]?_0x37f14e[_0x6b29('0x41')][0x3]['value']:undefined)||[]},{'name':_0x6b29('0x4e'),'value':_0x37f14e[_0x6b29('0x4e')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e[_0x6b29('0x41')][0x4][_0x6b29('0x42')]:undefined)||_0x6b29('0x58')},{'name':'attrEmailAccounts','value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e['attrSmsAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e['attrs'][0x7][_0x6b29('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e[_0x6b29('0x59')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e['attrs'][0x8]['value']:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e[_0x6b29('0x41')][0x9][_0x6b29('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e[_0x6b29('0x5a')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0xa]?_0x37f14e['attrs'][0xa][_0x6b29('0x42')]:undefined)||''}];case'web-report':return[{'name':_0x6b29('0x5b'),'type':_0x37f14e['reportType']||(_0x37f14e['attrs']&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['type']:undefined)||null,'value':_0x37f14e[_0x6b29('0x5b')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x37f14e[_0x6b29('0x5c')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x41e527){logger[_0x6b29('0x2a')](_0x6b29('0x5d'),JSON[_0x6b29('0x5e')](_0x41e527));return[];}}exports[_0x6b29('0x5f')]=function(_0x466222,_0x1e4684){if(_0x466222[_0x6b29('0x60')]){_0x466222['body'][_0x6b29('0x41')]=widgetAttributes(_0x466222[_0x6b29('0x60')]);}return db[_0x6b29('0x32')][_0x6b29('0x5f')](_0x466222['body'],{})[_0x6b29('0x29')](respondWithResult(_0x1e4684,0xc9))['catch'](handleError(_0x1e4684,null));};exports['update']=function(_0x2e9ee0,_0x92a3b2){if(_0x2e9ee0[_0x6b29('0x60')]['id']){delete _0x2e9ee0[_0x6b29('0x60')]['id'];}_0x2e9ee0[_0x6b29('0x60')][_0x6b29('0x41')]=widgetAttributes(_0x2e9ee0[_0x6b29('0x60')]);return db[_0x6b29('0x32')][_0x6b29('0x3e')]({'where':{'id':_0x2e9ee0['params']['id']}})['then'](handleEntityNotFound(_0x92a3b2,null))[_0x6b29('0x29')](saveUpdates(_0x2e9ee0[_0x6b29('0x60')],null))['then'](respondWithResult(_0x92a3b2,null))[_0x6b29('0x61')](handleError(_0x92a3b2,null));}; \ No newline at end of file +var _0xd3e3=['find','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','update','then','error','stack','name','send','params','keys','query','filters','intersection','model','attributes','fields','includeAll','options','DashboardItem','catch'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x12cdfb,_0x72a29e){_0x12cdfb=_0x12cdfb-0x0;var _0x2d68c0=_0xd3e3[_0x12cdfb];return _0x2d68c0;};'use strict';var emlformat=require(_0x3d3e('0x0'));var rimraf=require(_0x3d3e('0x1'));var zipdir=require(_0x3d3e('0x2'));var jsonpatch=require(_0x3d3e('0x3'));var rp=require('request-promise');var moment=require(_0x3d3e('0x4'));var BPromise=require(_0x3d3e('0x5'));var Mustache=require('mustache');var util=require(_0x3d3e('0x6'));var path=require(_0x3d3e('0x7'));var sox=require('sox');var csv=require(_0x3d3e('0x8'));var ejs=require(_0x3d3e('0x9'));var fs=require('fs');var fs_extra=require(_0x3d3e('0xa'));var _=require(_0x3d3e('0xb'));var squel=require(_0x3d3e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d3e('0xd'));var deskjs=require(_0x3d3e('0xe'));var toCsv=require(_0x3d3e('0x8'));var querystring=require('querystring');var Papa=require(_0x3d3e('0xf'));var Redis=require(_0x3d3e('0x10'));var authService=require(_0x3d3e('0x11'));var qs=require(_0x3d3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3e('0x13'));var logger=require('../../config/logger')(_0x3d3e('0x14'));var utils=require(_0x3d3e('0x15'));var config=require(_0x3d3e('0x16'));var licenseUtil=require(_0x3d3e('0x17'));var db=require('../../mysqldb')['db'];config[_0x3d3e('0x18')]=_[_0x3d3e('0x19')](config['redis'],{'host':_0x3d3e('0x1a'),'port':0x18eb});var socket=require(_0x3d3e('0x1b'))(new Redis(config[_0x3d3e('0x18')]));require(_0x3d3e('0x1c'))[_0x3d3e('0x1d')](socket);function respondWithStatusCode(_0x27ac04,_0xf013f9){_0xf013f9=_0xf013f9||0xcc;return function(_0x260bf8){if(_0x260bf8){return _0x27ac04[_0x3d3e('0x1e')](_0xf013f9);}return _0x27ac04['status'](_0xf013f9)[_0x3d3e('0x1f')]();};}function respondWithResult(_0x2e664b,_0x2c5127){_0x2c5127=_0x2c5127||0xc8;return function(_0x47d8ff){if(_0x47d8ff){return _0x2e664b['status'](_0x2c5127)[_0x3d3e('0x20')](_0x47d8ff);}};}function respondWithFilteredResult(_0x5c19bf,_0x16c799){return function(_0x3f661c){if(_0x3f661c){var _0x317242=typeof _0x16c799[_0x3d3e('0x21')]==='undefined'&&typeof _0x16c799['limit']===_0x3d3e('0x22');var _0x27c782=_0x3f661c['count'];var _0x456e18=_0x317242?0x0:_0x16c799[_0x3d3e('0x21')];var _0x1f90ec=_0x317242?_0x3f661c[_0x3d3e('0x23')]:_0x16c799[_0x3d3e('0x21')]+_0x16c799['limit'];var _0x4a1354;if(_0x1f90ec>=_0x27c782){_0x1f90ec=_0x27c782;_0x4a1354=0xc8;}else{_0x4a1354=0xce;}_0x5c19bf[_0x3d3e('0x24')](_0x4a1354);return _0x5c19bf[_0x3d3e('0x25')](_0x3d3e('0x26'),_0x456e18+'-'+_0x1f90ec+'/'+_0x27c782)[_0x3d3e('0x20')](_0x3f661c);}return null;};}function patchUpdates(_0x434949){return function(_0x986c1e){try{jsonpatch[_0x3d3e('0x27')](_0x986c1e,_0x434949,!![]);}catch(_0x18efd3){return BPromise['reject'](_0x18efd3);}return _0x986c1e['save']();};}function saveUpdates(_0x5b9037,_0x38ce30){return function(_0x2df495){if(_0x2df495){return _0x2df495[_0x3d3e('0x28')](_0x5b9037)[_0x3d3e('0x29')](function(_0x1e4116){return _0x1e4116;});}return null;};}function removeEntity(_0x3860d6,_0x42bd39){return function(_0x2ceb74){if(_0x2ceb74){return _0x2ceb74['destroy']()[_0x3d3e('0x29')](function(){_0x3860d6[_0x3d3e('0x24')](0xcc)[_0x3d3e('0x1f')]();});}};}function handleEntityNotFound(_0x67f196,_0xd3eb2e){return function(_0x466471){if(!_0x466471){_0x67f196[_0x3d3e('0x1e')](0x194);}return _0x466471;};}function handleError(_0x58b5f2,_0x3bcbf3){_0x3bcbf3=_0x3bcbf3||0x1f4;return function(_0x470030){logger[_0x3d3e('0x2a')](_0x470030[_0x3d3e('0x2b')]);if(_0x470030[_0x3d3e('0x2c')]){delete _0x470030['name'];}_0x58b5f2[_0x3d3e('0x24')](_0x3bcbf3)[_0x3d3e('0x2d')](_0x470030);};}exports['show']=function(_0xafdb65,_0x2b643b){var _0x9b1912={'raw':![],'where':{'id':_0xafdb65[_0x3d3e('0x2e')]['id']}},_0x3ac596={};_0x3ac596['model']=_[_0x3d3e('0x2f')](db['DashboardItem']['rawAttributes']);_0x3ac596[_0x3d3e('0x30')]=_[_0x3d3e('0x2f')](_0xafdb65[_0x3d3e('0x30')]);_0x3ac596[_0x3d3e('0x31')]=_[_0x3d3e('0x32')](_0x3ac596[_0x3d3e('0x33')],_0x3ac596['query']);_0x9b1912[_0x3d3e('0x34')]=_[_0x3d3e('0x32')](_0x3ac596[_0x3d3e('0x33')],qs['fields'](_0xafdb65[_0x3d3e('0x30')][_0x3d3e('0x35')]));_0x9b1912['attributes']=_0x9b1912[_0x3d3e('0x34')]['length']?_0x9b1912['attributes']:_0x3ac596['model'];if(_0xafdb65[_0x3d3e('0x30')][_0x3d3e('0x36')]){_0x9b1912['include']=[{'all':!![]}];}_0x9b1912=_['merge']({},_0x9b1912,_0xafdb65[_0x3d3e('0x37')]);return db[_0x3d3e('0x38')]['find'](_0x9b1912)['then'](handleEntityNotFound(_0x2b643b,null))['then'](respondWithResult(_0x2b643b,null))[_0x3d3e('0x39')](handleError(_0x2b643b,null));};exports['destroy']=function(_0x3767e1,_0x366de3){return db[_0x3d3e('0x38')][_0x3d3e('0x3a')]({'where':{'id':_0x3767e1['params']['id']}})[_0x3d3e('0x29')](handleEntityNotFound(_0x366de3,null))[_0x3d3e('0x29')](removeEntity(_0x366de3,null))[_0x3d3e('0x39')](handleError(_0x366de3,null));};function widgetAttributes(_0x437535){try{switch(_0x437535[_0x3d3e('0x3b')]){case'iframe':return[{'name':_0x3d3e('0x3c'),'value':_0x437535[_0x3d3e('0x3c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535['attrs'][0x0]['value']:undefined)||_0x3d3e('0x3e')}];case _0x3d3e('0x3f'):return[{'name':'attrPath','value':_0x437535[_0x3d3e('0x40')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0][_0x3d3e('0x41')]:undefined)||''}];case _0x3d3e('0x42'):return[{'name':'attrHourFormat','value':_0x437535[_0x3d3e('0x43')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0]['value']:undefined)||_0x3d3e('0x44')},{'name':_0x3d3e('0x45'),'value':_0x437535[_0x3d3e('0x45')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535[_0x3d3e('0x3d')][0x1][_0x3d3e('0x41')]:undefined)||'0.00'},{'name':_0x3d3e('0x46'),'value':_0x437535['attrFontSize']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x3d3e('0x47'),'value':_0x437535['attrMetric']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535['attrs'][0x0]['value']:undefined)||_0x3d3e('0x48')},{'name':_0x3d3e('0x49'),'value':_0x437535[_0x3d3e('0x49')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535['attrs'][0x1][_0x3d3e('0x41')]:undefined)||[]},{'name':_0x3d3e('0x46'),'value':_0x437535['attrFontSize']||(_0x437535['attrs']&&_0x437535['attrs'][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||0x14},{'name':_0x3d3e('0x4a'),'value':_0x437535[_0x3d3e('0x4a')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x3]?_0x437535[_0x3d3e('0x3d')][0x3][_0x3d3e('0x41')]:undefined)||_0x3d3e('0x4b')},{'name':_0x3d3e('0x4c'),'value':_0x437535[_0x3d3e('0x4c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x4]?_0x437535[_0x3d3e('0x3d')][0x4]['value']:undefined)||''},{'name':_0x3d3e('0x4d'),'value':_0x437535[_0x3d3e('0x4d')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x5]?_0x437535[_0x3d3e('0x3d')][0x5]['value']:undefined)||''},{'name':_0x3d3e('0x4e'),'value':_0x437535['attrSmsAccounts']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x6]?_0x437535['attrs'][0x6][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x4f'),'value':_0x437535[_0x3d3e('0x4f')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x7]?_0x437535[_0x3d3e('0x3d')][0x7][_0x3d3e('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x437535[_0x3d3e('0x50')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x8]?_0x437535['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x437535[_0x3d3e('0x51')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x9]?_0x437535['attrs'][0x9][_0x3d3e('0x41')]:undefined)||''}];case'multibar-chart':case _0x3d3e('0x52'):return[{'name':'attrSerie1','value':_0x437535[_0x3d3e('0x53')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0][_0x3d3e('0x41')]:undefined)||'total'},{'name':_0x3d3e('0x54'),'value':_0x437535[_0x3d3e('0x54')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x1]?_0x437535[_0x3d3e('0x3d')][0x1][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x55'),'value':_0x437535[_0x3d3e('0x55')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x2]?_0x437535[_0x3d3e('0x3d')][0x2][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x49'),'value':_0x437535[_0x3d3e('0x49')]||(_0x437535['attrs']&&_0x437535['attrs'][0x3]?_0x437535[_0x3d3e('0x3d')][0x3][_0x3d3e('0x41')]:undefined)||[]},{'name':_0x3d3e('0x4a'),'value':_0x437535[_0x3d3e('0x4a')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x4]?_0x437535[_0x3d3e('0x3d')][0x4][_0x3d3e('0x41')]:undefined)||_0x3d3e('0x4b')},{'name':_0x3d3e('0x4c'),'value':_0x437535[_0x3d3e('0x4c')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x5]?_0x437535[_0x3d3e('0x3d')][0x5][_0x3d3e('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x437535[_0x3d3e('0x4d')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x6]?_0x437535[_0x3d3e('0x3d')][0x6][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x4e'),'value':_0x437535[_0x3d3e('0x4e')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x7]?_0x437535[_0x3d3e('0x3d')][0x7]['value']:undefined)||''},{'name':_0x3d3e('0x4f'),'value':_0x437535[_0x3d3e('0x4f')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x8]?_0x437535[_0x3d3e('0x3d')][0x8][_0x3d3e('0x41')]:undefined)||''},{'name':_0x3d3e('0x50'),'value':_0x437535[_0x3d3e('0x50')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0x9]?_0x437535['attrs'][0x9][_0x3d3e('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x437535['attrChatWebsites']||(_0x437535[_0x3d3e('0x3d')]&&_0x437535[_0x3d3e('0x3d')][0xa]?_0x437535[_0x3d3e('0x3d')][0xa][_0x3d3e('0x41')]:undefined)||''}];case'web-report':return[{'name':_0x3d3e('0x56'),'type':_0x437535[_0x3d3e('0x57')]||(_0x437535['attrs']&&_0x437535[_0x3d3e('0x3d')][0x0]?_0x437535[_0x3d3e('0x3d')][0x0]['type']:undefined)||null,'value':_0x437535[_0x3d3e('0x56')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x0]?_0x437535['attrs'][0x0][_0x3d3e('0x41')]:undefined)||null},{'name':_0x3d3e('0x58'),'value':_0x437535[_0x3d3e('0x58')]||(_0x437535[_0x3d3e('0x3d')]&&_0x437535['attrs'][0x1]?_0x437535['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x18a2ab){logger[_0x3d3e('0x2a')](_0x3d3e('0x59'),JSON[_0x3d3e('0x5a')](_0x18a2ab));return[];}}exports[_0x3d3e('0x5b')]=function(_0x4cab2d,_0x170495){if(_0x4cab2d[_0x3d3e('0x5c')]){_0x4cab2d['body'][_0x3d3e('0x3d')]=widgetAttributes(_0x4cab2d[_0x3d3e('0x5c')]);}return db[_0x3d3e('0x38')][_0x3d3e('0x5b')](_0x4cab2d[_0x3d3e('0x5c')],{})['then'](respondWithResult(_0x170495,0xc9))[_0x3d3e('0x39')](handleError(_0x170495,null));};exports[_0x3d3e('0x28')]=function(_0x16c046,_0x16c9de){if(_0x16c046[_0x3d3e('0x5c')]['id']){delete _0x16c046[_0x3d3e('0x5c')]['id'];}_0x16c046['body'][_0x3d3e('0x3d')]=widgetAttributes(_0x16c046[_0x3d3e('0x5c')]);return db[_0x3d3e('0x38')][_0x3d3e('0x3a')]({'where':{'id':_0x16c046[_0x3d3e('0x2e')]['id']}})[_0x3d3e('0x29')](handleEntityNotFound(_0x16c9de,null))['then'](saveUpdates(_0x16c046[_0x3d3e('0x5c')],null))[_0x3d3e('0x29')](respondWithResult(_0x16c9de,null))['catch'](handleError(_0x16c9de,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 309a14b..7be9582 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 _0xa6fc=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem'];(function(_0xcf5b21,_0x2826f0){var _0x20a492=function(_0x6d2642){while(--_0x6d2642){_0xcf5b21['push'](_0xcf5b21['shift']());}};_0x20a492(++_0x2826f0);}(_0xa6fc,0xf7));var _0xca6f=function(_0x1819e9,_0x1796b5){_0x1819e9=_0x1819e9-0x0;var _0x1a3dbb=_0xa6fc[_0x1819e9];return _0x1a3dbb;};'use strict';var EventEmitter=require(_0xca6f('0x0'));var DashboardItem=require(_0xca6f('0x1'))['db'][_0xca6f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xca6f('0x3')](0x0);var events={'afterCreate':_0xca6f('0x4'),'afterUpdate':_0xca6f('0x5'),'afterDestroy':_0xca6f('0x6')};function emitEvent(_0x1f6577){return function(_0x1e4c41,_0x209543,_0x2a2286){DashboardItemEvents[_0xca6f('0x7')](_0x1f6577+':'+_0x1e4c41['id'],_0x1e4c41);DashboardItemEvents[_0xca6f('0x7')](_0x1f6577,_0x1e4c41);_0x2a2286(null);};}for(var e in events){if(events[_0xca6f('0x8')](e)){var event=events[e];DashboardItem[_0xca6f('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x3b77=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','exports'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x3b77,0x188));var _0x73b7=function(_0x434a81,_0x3e0b4b){_0x434a81=_0x434a81-0x0;var _0x4a488f=_0x3b77[_0x434a81];return _0x4a488f;};'use strict';var EventEmitter=require(_0x73b7('0x0'));var DashboardItem=require(_0x73b7('0x1'))['db'][_0x73b7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x73b7('0x3')](0x0);var events={'afterCreate':_0x73b7('0x4'),'afterUpdate':_0x73b7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x56ec6d){return function(_0x27a327,_0x881f24,_0x227c90){DashboardItemEvents['emit'](_0x56ec6d+':'+_0x27a327['id'],_0x27a327);DashboardItemEvents['emit'](_0x56ec6d,_0x27a327);_0x227c90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x73b7('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e6e9d2f..b61fdc4 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 _0x1154=['bluebird','request-promise','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','api','moment'];(function(_0x58e85f,_0x43ee54){var _0x4fecda=function(_0x466dff){while(--_0x466dff){_0x58e85f['push'](_0x58e85f['shift']());}};_0x4fecda(++_0x43ee54);}(_0x1154,0x131));var _0x4115=function(_0x44e227,_0x1941c3){_0x44e227=_0x44e227-0x0;var _0x3f4250=_0x1154[_0x44e227];return _0x3f4250;};'use strict';var _=require('lodash');var util=require(_0x4115('0x0'));var logger=require('../../config/logger')(_0x4115('0x1'));var moment=require(_0x4115('0x2'));var BPromise=require(_0x4115('0x3'));var rp=require(_0x4115('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4115('0x5'));var config=require('../../config/environment');var attributes=require(_0x4115('0x6'));module[_0x4115('0x7')]=function(_0x16a76b,_0x5b8eeb){return _0x16a76b[_0x4115('0x8')](_0x4115('0x9'),attributes,{'tableName':_0x4115('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb37f=['util','../../config/logger','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x5c59d6,_0x456d50){var _0x3f9abe=function(_0x14f373){while(--_0x14f373){_0x5c59d6['push'](_0x5c59d6['shift']());}};_0x3f9abe(++_0x456d50);}(_0xb37f,0x1ef));var _0xfb37=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb37f[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0xfb37('0x0'));var logger=require(_0xfb37('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfb37('0x2'));var rp=require(_0xfb37('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb37('0x4'));var attributes=require(_0xfb37('0x5'));module['exports']=function(_0x5e8e33,_0x2570f9){return _0x5e8e33[_0xfb37('0x6')](_0xfb37('0x7'),attributes,{'tableName':_0xfb37('0x8'),'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 af0a896..29f9009 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 _0xc336=['http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2e175c,_0x5d1658){var _0x1fead8=function(_0x4671de){while(--_0x4671de){_0x2e175c['push'](_0x2e175c['shift']());}};_0x1fead8(++_0x5d1658);}(_0xc336,0xc7));var _0x6c33=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xc336[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x6c33('0x0'));var util=require(_0x6c33('0x1'));var moment=require(_0x6c33('0x2'));var BPromise=require(_0x6c33('0x3'));var rs=require(_0x6c33('0x4'));var fs=require('fs');var Redis=require(_0x6c33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c33('0x6'));var logger=require(_0x6c33('0x7'))(_0x6c33('0x8'));var config=require('../../config/environment');var jayson=require(_0x6c33('0x9'));var client=jayson[_0x6c33('0xa')][_0x6c33('0xb')]({'port':0x232a});config[_0x6c33('0xc')]=_[_0x6c33('0xd')](config['redis'],{'host':_0x6c33('0xe'),'port':0x18eb});var socket=require(_0x6c33('0xf'))(new Redis(config[_0x6c33('0xc')]));require(_0x6c33('0x10'))[_0x6c33('0x11')](socket);function respondWithRpcPromise(_0x1f8b8d,_0xe21fea,_0x66a1b3){return new BPromise(function(_0x2b82c3,_0x4a8d43){return client[_0x6c33('0x12')](_0x1f8b8d,_0x66a1b3)[_0x6c33('0x13')](function(_0x21d07d){logger[_0x6c33('0x14')](_0x6c33('0x15'),_0xe21fea,_0x6c33('0x16'));logger[_0x6c33('0x17')](_0x6c33('0x18'),_0xe21fea,_0x6c33('0x16'),JSON[_0x6c33('0x19')](_0x21d07d));if(_0x21d07d['error']){if(_0x21d07d[_0x6c33('0x1a')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0xe21fea,_0x21d07d[_0x6c33('0x1a')]['message']);return _0x4a8d43(_0x21d07d[_0x6c33('0x1a')]['message']);}logger['error'](_0x6c33('0x15'),_0xe21fea,_0x21d07d[_0x6c33('0x1a')][_0x6c33('0x1b')]);return _0x2b82c3(_0x21d07d[_0x6c33('0x1a')]['message']);}else{logger[_0x6c33('0x14')]('DashboardItem,\x20%s,\x20%s',_0xe21fea,'request\x20sent');_0x2b82c3(_0x21d07d[_0x6c33('0x1c')][_0x6c33('0x1b')]);}})[_0x6c33('0x1d')](function(_0x1b8a88){logger[_0x6c33('0x1a')](_0x6c33('0x15'),_0xe21fea,_0x1b8a88);_0x4a8d43(_0x1b8a88);});});} \ No newline at end of file +var _0x4588=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x4588,0x162));var _0x8458=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x4588[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0x8458('0x0'));var util=require(_0x8458('0x1'));var moment=require(_0x8458('0x2'));var BPromise=require('bluebird');var rs=require(_0x8458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8458('0x4'))['db'];var utils=require(_0x8458('0x5'));var logger=require('../../config/logger')(_0x8458('0x6'));var config=require(_0x8458('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8458('0x8')][_0x8458('0x9')]({'port':0x232a});config[_0x8458('0xa')]=_[_0x8458('0xb')](config[_0x8458('0xa')],{'host':_0x8458('0xc'),'port':0x18eb});var socket=require(_0x8458('0xd'))(new Redis(config[_0x8458('0xa')]));require(_0x8458('0xe'))['register'](socket);function respondWithRpcPromise(_0x209eab,_0x40b00a,_0x16a7b1){return new BPromise(function(_0x492548,_0x25d0d3){return client[_0x8458('0xf')](_0x209eab,_0x16a7b1)[_0x8458('0x10')](function(_0x190dfa){logger[_0x8458('0x11')](_0x8458('0x12'),_0x40b00a,'request\x20sent');logger[_0x8458('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40b00a,_0x8458('0x14'),JSON[_0x8458('0x15')](_0x190dfa));if(_0x190dfa[_0x8458('0x16')]){if(_0x190dfa[_0x8458('0x16')]['code']===0x1f4){logger['error'](_0x8458('0x12'),_0x40b00a,_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);return _0x25d0d3(_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);}logger['error'](_0x8458('0x12'),_0x40b00a,_0x190dfa[_0x8458('0x16')][_0x8458('0x17')]);return _0x492548(_0x190dfa[_0x8458('0x16')]['message']);}else{logger[_0x8458('0x11')](_0x8458('0x12'),_0x40b00a,_0x8458('0x14'));_0x492548(_0x190dfa[_0x8458('0x18')][_0x8458('0x17')]);}})[_0x8458('0x19')](function(_0x2bbb9f){logger[_0x8458('0x16')](_0x8458('0x12'),_0x40b00a,_0x2bbb9f);_0x25d0d3(_0x2bbb9f);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 93dc74f..140f1d5 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 _0x561e=['length','dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener'];(function(_0x988eac,_0x125687){var _0x5dcd06=function(_0x5f03fd){while(--_0x5f03fd){_0x988eac['push'](_0x988eac['shift']());}};_0x5dcd06(++_0x125687);}(_0x561e,0x152));var _0xe561=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x561e[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0xe561('0x0'));var events=[_0xe561('0x1'),_0xe561('0x2'),'update'];function createListener(_0x11639c,_0x21a9a1){return function(_0x418426){_0x21a9a1[_0xe561('0x3')](_0x11639c,_0x418426);};}function removeListener(_0x3f95e8,_0x5f311a){return function(){DashboardItemEvents[_0xe561('0x4')](_0x3f95e8,_0x5f311a);};}exports['register']=function(_0x37699e){for(var _0x4ec9ba=0x0,_0x37d9d1=events[_0xe561('0x5')];_0x4ec9ba<_0x37d9d1;_0x4ec9ba++){var _0x345941=events[_0x4ec9ba];var _0x1f1d3e=createListener(_0xe561('0x6')+_0x345941,_0x37699e);DashboardItemEvents['on'](_0x345941,_0x1f1d3e);}}; \ No newline at end of file +var _0x9816=['removeListener','register','length','dashboardItem:','save','update','emit'];(function(_0xbb1111,_0x3e6b8e){var _0x3a65d9=function(_0x2462be){while(--_0x2462be){_0xbb1111['push'](_0xbb1111['shift']());}};_0x3a65d9(++_0x3e6b8e);}(_0x9816,0xf9));var _0x6981=function(_0x2578fa,_0x2670af){_0x2578fa=_0x2578fa-0x0;var _0x3ff843=_0x9816[_0x2578fa];return _0x3ff843;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x6981('0x0'),'remove',_0x6981('0x1')];function createListener(_0xeae6ea,_0xb9b20e){return function(_0x3aff79){_0xb9b20e[_0x6981('0x2')](_0xeae6ea,_0x3aff79);};}function removeListener(_0x1c8293,_0x1d7508){return function(){DashboardItemEvents[_0x6981('0x3')](_0x1c8293,_0x1d7508);};}exports[_0x6981('0x4')]=function(_0x5db7f5){for(var _0x45c85d=0x0,_0x37e60d=events[_0x6981('0x5')];_0x45c85d<_0x37e60d;_0x45c85d++){var _0xd1e3d5=events[_0x45c85d];var _0x594514=createListener(_0x6981('0x6')+_0xd1e3d5,_0x5db7f5);DashboardItemEvents['on'](_0xd1e3d5,_0x594514);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 669b581..5827fd7 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 _0x3434=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','post','create','put','update'];(function(_0x1b7d9c,_0x59b000){var _0x439e9d=function(_0x530207){while(--_0x530207){_0x1b7d9c['push'](_0x1b7d9c['shift']());}};_0x439e9d(++_0x59b000);}(_0x3434,0x72));var _0x4343=function(_0x594291,_0x8c7ce3){_0x594291=_0x594291-0x0;var _0x5c70ee=_0x3434[_0x594291];return _0x5c70ee;};'use strict';var multer=require('multer');var util=require(_0x4343('0x0'));var path=require(_0x4343('0x1'));var timeout=require(_0x4343('0x2'));var express=require(_0x4343('0x3'));var router=express[_0x4343('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4343('0x5'));var interaction=require(_0x4343('0x6'));var config=require(_0x4343('0x7'));var controller=require('./dashboardItem.controller');router['get'](_0x4343('0x8'),auth[_0x4343('0x9')](),controller['show']);router[_0x4343('0xa')]('/',auth[_0x4343('0x9')](),controller[_0x4343('0xb')]);router[_0x4343('0xc')](_0x4343('0x8'),auth[_0x4343('0x9')](),controller[_0x4343('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4343('0xe')]);module[_0x4343('0xf')]=router; \ No newline at end of file +var _0x98d0=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x555ed9,_0x2fce76){var _0x4dec3b=function(_0x3f68a8){while(--_0x3f68a8){_0x555ed9['push'](_0x555ed9['shift']());}};_0x4dec3b(++_0x2fce76);}(_0x98d0,0x113));var _0x098d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x98d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x098d('0x0'));var timeout=require(_0x098d('0x1'));var express=require(_0x098d('0x2'));var router=express[_0x098d('0x3')]();var fs_extra=require(_0x098d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x098d('0x5'));var config=require('../../config/environment');var controller=require(_0x098d('0x6'));router[_0x098d('0x7')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0xa')]);router[_0x098d('0xb')]('/',auth[_0x098d('0x9')](),controller[_0x098d('0xc')]);router[_0x098d('0xd')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0xe')]);router[_0x098d('0xf')](_0x098d('0x8'),auth[_0x098d('0x9')](),controller[_0x098d('0x10')]);module[_0x098d('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 12ebcdd..23b0060 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 _0xbe8e=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x632aa4,_0x20076f){var _0x82b9d3=function(_0x11cf5c){while(--_0x11cf5c){_0x632aa4['push'](_0x632aa4['shift']());}};_0x82b9d3(++_0x20076f);}(_0xbe8e,0xd3));var _0xebe8=function(_0x3839ee,_0x1b2ca4){_0x3839ee=_0x3839ee-0x0;var _0x1c8e44=_0xbe8e[_0x3839ee];return _0x1c8e44;};'use strict';var Sequelize=require(_0xebe8('0x0'));module[_0xebe8('0x1')]={'name':{'type':Sequelize[_0xebe8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xebe8('0x3')](_0xebe8('0x4'),_0xebe8('0x5'),_0xebe8('0x6')),'allowNull':![],'defaultValue':_0xebe8('0x4')},'description':{'type':Sequelize[_0xebe8('0x2')]}}; \ No newline at end of file +var _0xb797=['second','third','sequelize','exports','STRING','first'];(function(_0x3131e0,_0x194e1c){var _0x376301=function(_0x1c544b){while(--_0x1c544b){_0x3131e0['push'](_0x3131e0['shift']());}};_0x376301(++_0x194e1c);}(_0xb797,0x128));var _0x7b79=function(_0x385024,_0x39a084){_0x385024=_0x385024-0x0;var _0x39927a=_0xb797[_0x385024];return _0x39927a;};'use strict';var Sequelize=require(_0x7b79('0x0'));module[_0x7b79('0x1')]={'name':{'type':Sequelize[_0x7b79('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x7b79('0x3'),_0x7b79('0x4'),_0x7b79('0x5')),'allowNull':![],'defaultValue':_0x7b79('0x3')},'description':{'type':Sequelize[_0x7b79('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 55c3c0b..f7bf2f5 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 _0x24e3=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','apply','reject','then','get','destroy','stack','name','send','index','Disposition','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','find','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x38b7a1,_0x17a13d){var _0x48cdf0=function(_0x3ec40a){while(--_0x3ec40a){_0x38b7a1['push'](_0x38b7a1['shift']());}};_0x48cdf0(++_0x17a13d);}(_0x24e3,0x1a4));var _0x324e=function(_0x35c490,_0xcb651){_0x35c490=_0x35c490-0x0;var _0x3d8e8b=_0x24e3[_0x35c490];return _0x3d8e8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x324e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x324e('0x1'));var rp=require(_0x324e('0x2'));var moment=require(_0x324e('0x3'));var BPromise=require(_0x324e('0x4'));var Mustache=require(_0x324e('0x5'));var util=require(_0x324e('0x6'));var path=require(_0x324e('0x7'));var sox=require(_0x324e('0x8'));var csv=require(_0x324e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x324e('0xa'));var _=require(_0x324e('0xb'));var squel=require(_0x324e('0xc'));var crypto=require(_0x324e('0xd'));var jsforce=require(_0x324e('0xe'));var deskjs=require(_0x324e('0xf'));var toCsv=require(_0x324e('0x9'));var querystring=require('querystring');var Papa=require(_0x324e('0x10'));var Redis=require(_0x324e('0x11'));var authService=require(_0x324e('0x12'));var qs=require(_0x324e('0x13'));var as=require(_0x324e('0x14'));var hardwareService=require(_0x324e('0x15'));var logger=require(_0x324e('0x16'))(_0x324e('0x17'));var utils=require(_0x324e('0x18'));var config=require(_0x324e('0x19'));var licenseUtil=require(_0x324e('0x1a'));var db=require(_0x324e('0x1b'))['db'];function respondWithStatusCode(_0x2012f7,_0x39961b){_0x39961b=_0x39961b||0xcc;return function(_0xe8db6f){if(_0xe8db6f){return _0x2012f7[_0x324e('0x1c')](_0x39961b);}return _0x2012f7[_0x324e('0x1d')](_0x39961b)[_0x324e('0x1e')]();};}function respondWithResult(_0x545f9c,_0x3b6be3){_0x3b6be3=_0x3b6be3||0xc8;return function(_0x328510){if(_0x328510){return _0x545f9c['status'](_0x3b6be3)[_0x324e('0x1f')](_0x328510);}};}function respondWithFilteredResult(_0x350084,_0x508d0d){return function(_0x3bcbc1){if(_0x3bcbc1){var _0x2a77ec=typeof _0x508d0d['offset']===_0x324e('0x20')&&typeof _0x508d0d[_0x324e('0x21')]===_0x324e('0x20');var _0x28d32e=_0x3bcbc1['count'];var _0x4f1bb1=_0x2a77ec?0x0:_0x508d0d['offset'];var _0x2fea3a=_0x2a77ec?_0x3bcbc1['count']:_0x508d0d['offset']+_0x508d0d['limit'];var _0x5084c6;if(_0x2fea3a>=_0x28d32e){_0x2fea3a=_0x28d32e;_0x5084c6=0xc8;}else{_0x5084c6=0xce;}_0x350084['status'](_0x5084c6);return _0x350084[_0x324e('0x22')](_0x324e('0x23'),_0x4f1bb1+'-'+_0x2fea3a+'/'+_0x28d32e)[_0x324e('0x1f')](_0x3bcbc1);}return null;};}function patchUpdates(_0xf728ec){return function(_0x381480){try{jsonpatch[_0x324e('0x24')](_0x381480,_0xf728ec,!![]);}catch(_0x2c3d26){return BPromise[_0x324e('0x25')](_0x2c3d26);}return _0x381480['save']();};}function saveUpdates(_0x4a4010,_0x136573){return function(_0x500de1){if(_0x500de1){return _0x500de1['update'](_0x4a4010)[_0x324e('0x26')](function(_0x387635){return _0x387635;});}return null;};}function removeEntity(_0x1396be,_0x2419e5){return function(_0x3bd6f0){if(_0x3bd6f0){return _0x3bd6f0['destroy']()[_0x324e('0x26')](function(){var _0x3bb4cd=_0x3bd6f0[_0x324e('0x27')]({'plain':!![]});var _0x43e827='Dispositions';return db['UserProfileResource'][_0x324e('0x28')]({'where':{'type':_0x43e827,'resourceId':_0x3bb4cd['id']}})[_0x324e('0x26')](function(){return _0x3bd6f0;});})['then'](function(){_0x1396be[_0x324e('0x1d')](0xcc)[_0x324e('0x1e')]();});}};}function handleEntityNotFound(_0xfcc569,_0x1c5671){return function(_0x49f942){if(!_0x49f942){_0xfcc569['sendStatus'](0x194);}return _0x49f942;};}function handleError(_0x180a44,_0x22a7c3){_0x22a7c3=_0x22a7c3||0x1f4;return function(_0x5b4757){logger['error'](_0x5b4757[_0x324e('0x29')]);if(_0x5b4757[_0x324e('0x2a')]){delete _0x5b4757['name'];}_0x180a44[_0x324e('0x1d')](_0x22a7c3)[_0x324e('0x2b')](_0x5b4757);};}exports[_0x324e('0x2c')]=function(_0x139033,_0x4d8827){var _0x53f10a={},_0x4663c7={},_0x4c5c97={'count':0x0,'rows':[]};var _0x1c2f9f=_['map'](db[_0x324e('0x2d')]['rawAttributes'],function(_0x5bece1){return{'name':_0x5bece1[_0x324e('0x2e')],'type':_0x5bece1[_0x324e('0x2f')][_0x324e('0x30')]};});_0x4663c7['model']=_[_0x324e('0x31')](_0x1c2f9f,_0x324e('0x2a'));_0x4663c7[_0x324e('0x32')]=_['keys'](_0x139033[_0x324e('0x32')]);_0x4663c7[_0x324e('0x33')]=_[_0x324e('0x34')](_0x4663c7['model'],_0x4663c7[_0x324e('0x32')]);_0x53f10a[_0x324e('0x35')]=_[_0x324e('0x34')](_0x4663c7['model'],qs[_0x324e('0x36')](_0x139033[_0x324e('0x32')]['fields']));_0x53f10a[_0x324e('0x35')]=_0x53f10a['attributes'][_0x324e('0x37')]?_0x53f10a[_0x324e('0x35')]:_0x4663c7[_0x324e('0x38')];if(!_0x139033['query'][_0x324e('0x39')](_0x324e('0x3a'))){_0x53f10a[_0x324e('0x21')]=qs[_0x324e('0x21')](_0x139033[_0x324e('0x32')]['limit']);_0x53f10a[_0x324e('0x3b')]=qs[_0x324e('0x3b')](_0x139033[_0x324e('0x32')][_0x324e('0x3b')]);}_0x53f10a[_0x324e('0x3c')]=qs[_0x324e('0x3d')](_0x139033[_0x324e('0x32')][_0x324e('0x3d')]);_0x53f10a[_0x324e('0x3e')]=qs['filters'](_[_0x324e('0x3f')](_0x139033[_0x324e('0x32')],_0x4663c7['filters']),_0x1c2f9f);if(_0x139033[_0x324e('0x32')]['filter']){_0x53f10a[_0x324e('0x3e')]=_[_0x324e('0x40')](_0x53f10a[_0x324e('0x3e')],{'$or':_['map'](_0x1c2f9f,function(_0x3ddfa5){if(_0x3ddfa5['type']!=='VIRTUAL'){var _0x3291a0={};_0x3291a0[_0x3ddfa5[_0x324e('0x2a')]]={'$like':'%'+_0x139033['query'][_0x324e('0x41')]+'%'};return _0x3291a0;}})});}_0x53f10a=_[_0x324e('0x40')]({},_0x53f10a,_0x139033[_0x324e('0x42')]);var _0x49bdd1={'where':_0x53f10a[_0x324e('0x3e')]};return db[_0x324e('0x2d')][_0x324e('0x43')](_0x49bdd1)[_0x324e('0x26')](function(_0x1e7b8a){_0x4c5c97[_0x324e('0x43')]=_0x1e7b8a;if(_0x139033['query'][_0x324e('0x44')]){_0x53f10a[_0x324e('0x45')]=[{'all':!![]}];}return db[_0x324e('0x2d')][_0x324e('0x46')](_0x53f10a);})[_0x324e('0x26')](function(_0x42789e){_0x4c5c97[_0x324e('0x47')]=_0x42789e;return _0x4c5c97;})[_0x324e('0x26')](respondWithFilteredResult(_0x4d8827,_0x53f10a))['catch'](handleError(_0x4d8827,null));};exports[_0x324e('0x48')]=function(_0x1ee44b,_0xbc37da){var _0x39ad14={'raw':!![],'where':{'id':_0x1ee44b[_0x324e('0x49')]['id']}},_0x5622bc={};_0x5622bc[_0x324e('0x38')]=_[_0x324e('0x4a')](db[_0x324e('0x2d')][_0x324e('0x4b')]);_0x5622bc[_0x324e('0x32')]=_[_0x324e('0x4a')](_0x1ee44b[_0x324e('0x32')]);_0x5622bc['filters']=_['intersection'](_0x5622bc[_0x324e('0x38')],_0x5622bc[_0x324e('0x32')]);_0x39ad14[_0x324e('0x35')]=_[_0x324e('0x34')](_0x5622bc[_0x324e('0x38')],qs['fields'](_0x1ee44b[_0x324e('0x32')][_0x324e('0x36')]));_0x39ad14[_0x324e('0x35')]=_0x39ad14[_0x324e('0x35')][_0x324e('0x37')]?_0x39ad14['attributes']:_0x5622bc[_0x324e('0x38')];if(_0x1ee44b[_0x324e('0x32')][_0x324e('0x44')]){_0x39ad14['include']=[{'all':!![]}];}_0x39ad14=_['merge']({},_0x39ad14,_0x1ee44b[_0x324e('0x42')]);return db[_0x324e('0x2d')]['find'](_0x39ad14)[_0x324e('0x26')](handleEntityNotFound(_0xbc37da,null))['then'](respondWithResult(_0xbc37da,null))['catch'](handleError(_0xbc37da,null));};exports[_0x324e('0x4c')]=function(_0x40d4ce,_0x369278){return db[_0x324e('0x2d')][_0x324e('0x4c')](_0x40d4ce['body'],{})[_0x324e('0x26')](function(_0x56b7db){var _0x40a1aa=_0x40d4ce['user'][_0x324e('0x27')]({'plain':!![]});if(!_0x40a1aa)throw new Error(_0x324e('0x4d'));if(_0x40a1aa['role']==='user'){var _0x21bbd9=_0x56b7db[_0x324e('0x27')]({'plain':!![]});var _0x3c1b6c=_0x324e('0x4e');return db[_0x324e('0x4f')][_0x324e('0x50')]({'where':{'name':_0x3c1b6c,'userProfileId':_0x40a1aa['userProfileId']},'raw':!![]})[_0x324e('0x26')](function(_0x2b8bbf){if(_0x2b8bbf&&_0x2b8bbf[_0x324e('0x51')]===0x0){return db[_0x324e('0x52')][_0x324e('0x4c')]({'name':_0x21bbd9[_0x324e('0x2a')],'resourceId':_0x21bbd9['id'],'type':_0x2b8bbf[_0x324e('0x2a')],'sectionId':_0x2b8bbf['id']},{})[_0x324e('0x26')](function(){return _0x56b7db;});}else{return _0x56b7db;}})[_0x324e('0x53')](function(_0x58f939){logger['error'](_0x324e('0x54'),_0x58f939);throw _0x58f939;});}return _0x56b7db;})[_0x324e('0x26')](respondWithResult(_0x369278,0xc9))[_0x324e('0x53')](handleError(_0x369278,null));};exports[_0x324e('0x55')]=function(_0x4b7857,_0x108f2d){if(_0x4b7857[_0x324e('0x56')]['id']){delete _0x4b7857[_0x324e('0x56')]['id'];}return db[_0x324e('0x2d')][_0x324e('0x50')]({'where':{'id':_0x4b7857[_0x324e('0x49')]['id']}})[_0x324e('0x26')](handleEntityNotFound(_0x108f2d,null))['then'](saveUpdates(_0x4b7857['body'],null))['then'](respondWithResult(_0x108f2d,null))['catch'](handleError(_0x108f2d,null));};exports[_0x324e('0x28')]=function(_0x59e0cf,_0x41018a){return db['Disposition'][_0x324e('0x50')]({'where':{'id':_0x59e0cf[_0x324e('0x49')]['id']}})['then'](handleEntityNotFound(_0x41018a,null))[_0x324e('0x26')](removeEntity(_0x41018a,null))[_0x324e('0x53')](handleError(_0x41018a,null));}; \ No newline at end of file +var _0x02ca=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','params','include','find','catch','create','body','role','Dispositions','UserProfileSection','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3b7562,_0x2af0c6){var _0x5e331f=function(_0x3a92ba){while(--_0x3a92ba){_0x3b7562['push'](_0x3b7562['shift']());}};_0x5e331f(++_0x2af0c6);}(_0x02ca,0x97));var _0xa02c=function(_0x2f8a98,_0x4f426e){_0x2f8a98=_0x2f8a98-0x0;var _0x21179d=_0x02ca[_0x2f8a98];return _0x21179d;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){var _0x41e4ab=_0x4ba050[_0xa02c('0x27')]({'plain':!![]});var _0x437308='Dispositions';return db['UserProfileResource'][_0xa02c('0x26')]({'where':{'type':_0x437308,'resourceId':_0x41e4ab['id']}})[_0xa02c('0x25')](function(){return _0x4ba050;});})[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x3f4e0d,_0x279d79){return function(_0x419037){if(!_0x419037){_0x3f4e0d['sendStatus'](0x194);}return _0x419037;};}function handleError(_0x3c8391,_0x1e3d9d){_0x1e3d9d=_0x1e3d9d||0x1f4;return function(_0x31b520){logger[_0xa02c('0x28')](_0x31b520[_0xa02c('0x29')]);if(_0x31b520[_0xa02c('0x2a')]){delete _0x31b520[_0xa02c('0x2a')];}_0x3c8391[_0xa02c('0x1a')](_0x1e3d9d)[_0xa02c('0x2b')](_0x31b520);};}exports['index']=function(_0x116baa,_0xb9f91){var _0x279410={},_0x4de1ac={},_0x58542a={'count':0x0,'rows':[]};var _0x186fe9=_[_0xa02c('0x2c')](db[_0xa02c('0x2d')][_0xa02c('0x2e')],function(_0x7a3b21){return{'name':_0x7a3b21[_0xa02c('0x2f')],'type':_0x7a3b21[_0xa02c('0x30')][_0xa02c('0x31')]};});_0x4de1ac[_0xa02c('0x32')]=_[_0xa02c('0x2c')](_0x186fe9,'name');_0x4de1ac['query']=_[_0xa02c('0x33')](_0x116baa[_0xa02c('0x34')]);_0x4de1ac[_0xa02c('0x35')]=_[_0xa02c('0x36')](_0x4de1ac[_0xa02c('0x32')],_0x4de1ac[_0xa02c('0x34')]);_0x279410[_0xa02c('0x37')]=_[_0xa02c('0x36')](_0x4de1ac[_0xa02c('0x32')],qs[_0xa02c('0x38')](_0x116baa[_0xa02c('0x34')]['fields']));_0x279410[_0xa02c('0x37')]=_0x279410[_0xa02c('0x37')][_0xa02c('0x39')]?_0x279410[_0xa02c('0x37')]:_0x4de1ac['model'];if(!_0x116baa['query'][_0xa02c('0x3a')](_0xa02c('0x3b'))){_0x279410['limit']=qs['limit'](_0x116baa['query']['limit']);_0x279410[_0xa02c('0x1c')]=qs[_0xa02c('0x1c')](_0x116baa[_0xa02c('0x34')][_0xa02c('0x1c')]);}_0x279410['order']=qs[_0xa02c('0x3c')](_0x116baa[_0xa02c('0x34')][_0xa02c('0x3c')]);_0x279410[_0xa02c('0x3d')]=qs[_0xa02c('0x35')](_[_0xa02c('0x3e')](_0x116baa[_0xa02c('0x34')],_0x4de1ac[_0xa02c('0x35')]),_0x186fe9);if(_0x116baa['query']['filter']){_0x279410[_0xa02c('0x3d')]=_[_0xa02c('0x3f')](_0x279410[_0xa02c('0x3d')],{'$or':_[_0xa02c('0x2c')](_0x186fe9,function(_0x1f32f3){if(_0x1f32f3[_0xa02c('0x30')]!==_0xa02c('0x40')){var _0x4bfccc={};_0x4bfccc[_0x1f32f3[_0xa02c('0x2a')]]={'$like':'%'+_0x116baa[_0xa02c('0x34')][_0xa02c('0x41')]+'%'};return _0x4bfccc;}})});}_0x279410=_[_0xa02c('0x3f')]({},_0x279410,_0x116baa['options']);var _0x589b2f={'where':_0x279410[_0xa02c('0x3d')]};return db[_0xa02c('0x2d')][_0xa02c('0x1f')](_0x589b2f)['then'](function(_0x5d2ca0){_0x58542a[_0xa02c('0x1f')]=_0x5d2ca0;if(_0x116baa['query'][_0xa02c('0x42')]){_0x279410['include']=[{'all':!![]}];}return db[_0xa02c('0x2d')][_0xa02c('0x43')](_0x279410);})['then'](function(_0x4a84c4){_0x58542a[_0xa02c('0x44')]=_0x4a84c4;return _0x58542a;})['then'](respondWithFilteredResult(_0xb9f91,_0x279410))['catch'](handleError(_0xb9f91,null));};exports['show']=function(_0x12406f,_0x5da342){var _0x56a375={'raw':!![],'where':{'id':_0x12406f[_0xa02c('0x45')]['id']}},_0x3a19da={};_0x3a19da[_0xa02c('0x32')]=_[_0xa02c('0x33')](db[_0xa02c('0x2d')]['rawAttributes']);_0x3a19da[_0xa02c('0x34')]=_[_0xa02c('0x33')](_0x12406f[_0xa02c('0x34')]);_0x3a19da[_0xa02c('0x35')]=_['intersection'](_0x3a19da[_0xa02c('0x32')],_0x3a19da[_0xa02c('0x34')]);_0x56a375[_0xa02c('0x37')]=_[_0xa02c('0x36')](_0x3a19da['model'],qs[_0xa02c('0x38')](_0x12406f[_0xa02c('0x34')]['fields']));_0x56a375[_0xa02c('0x37')]=_0x56a375[_0xa02c('0x37')][_0xa02c('0x39')]?_0x56a375['attributes']:_0x3a19da[_0xa02c('0x32')];if(_0x12406f[_0xa02c('0x34')][_0xa02c('0x42')]){_0x56a375[_0xa02c('0x46')]=[{'all':!![]}];}_0x56a375=_[_0xa02c('0x3f')]({},_0x56a375,_0x12406f['options']);return db['Disposition'][_0xa02c('0x47')](_0x56a375)[_0xa02c('0x25')](handleEntityNotFound(_0x5da342,null))[_0xa02c('0x25')](respondWithResult(_0x5da342,null))[_0xa02c('0x48')](handleError(_0x5da342,null));};exports[_0xa02c('0x49')]=function(_0x128a87,_0x538df7){return db[_0xa02c('0x2d')][_0xa02c('0x49')](_0x128a87[_0xa02c('0x4a')],{})[_0xa02c('0x25')](function(_0x3e4d59){var _0x131c95=_0x128a87['user']['get']({'plain':!![]});if(!_0x131c95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x131c95[_0xa02c('0x4b')]==='user'){var _0x115c9f=_0x3e4d59[_0xa02c('0x27')]({'plain':!![]});var _0xb4292e=_0xa02c('0x4c');return db[_0xa02c('0x4d')][_0xa02c('0x47')]({'where':{'name':_0xb4292e,'userProfileId':_0x131c95[_0xa02c('0x4e')]},'raw':!![]})['then'](function(_0x393b36){if(_0x393b36&&_0x393b36['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x115c9f[_0xa02c('0x2a')],'resourceId':_0x115c9f['id'],'type':_0x393b36['name'],'sectionId':_0x393b36['id']},{})[_0xa02c('0x25')](function(){return _0x3e4d59;});}else{return _0x3e4d59;}})['catch'](function(_0x313d77){logger[_0xa02c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x313d77);throw _0x313d77;});}return _0x3e4d59;})[_0xa02c('0x25')](respondWithResult(_0x538df7,0xc9))['catch'](handleError(_0x538df7,null));};exports['update']=function(_0xf9b510,_0x3b2bdd){if(_0xf9b510[_0xa02c('0x4a')]['id']){delete _0xf9b510['body']['id'];}return db['Disposition'][_0xa02c('0x47')]({'where':{'id':_0xf9b510[_0xa02c('0x45')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x3b2bdd,null))[_0xa02c('0x25')](saveUpdates(_0xf9b510['body'],null))[_0xa02c('0x25')](respondWithResult(_0x3b2bdd,null))['catch'](handleError(_0x3b2bdd,null));};exports['destroy']=function(_0x4389d7,_0x3038c0){return db[_0xa02c('0x2d')][_0xa02c('0x47')]({'where':{'id':_0x4389d7[_0xa02c('0x45')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x3038c0,null))[_0xa02c('0x25')](removeEntity(_0x3038c0,null))[_0xa02c('0x48')](handleError(_0x3038c0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4c07534..cee2724 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 _0xba35=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','path','exports','define','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x28d6b9,_0xbe9964){var _0x1e2bee=function(_0xc75f76){while(--_0xc75f76){_0x28d6b9['push'](_0x28d6b9['shift']());}};_0x1e2bee(++_0xbe9964);}(_0xba35,0x174));var _0x5ba3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xba35[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5ba3('0x0'));var util=require(_0x5ba3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5ba3('0x2'));var BPromise=require(_0x5ba3('0x3'));var rp=require(_0x5ba3('0x4'));var fs=require('fs');var path=require(_0x5ba3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x5ba3('0x6')]=function(_0x2159c5,_0x48703c){return _0x2159c5[_0x5ba3('0x7')]('Disposition',attributes,{'tableName':_0x5ba3('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5ba3('0x9'),'fields':[_0x5ba3('0xa'),_0x5ba3('0xb')]},{'unique':!![],'name':'name_chat','fields':['name',_0x5ba3('0xc')]},{'unique':!![],'name':_0x5ba3('0xd'),'fields':[_0x5ba3('0xa'),_0x5ba3('0xe')]},{'unique':!![],'name':_0x5ba3('0xf'),'fields':[_0x5ba3('0xa'),_0x5ba3('0x10')]},{'unique':!![],'name':_0x5ba3('0x11'),'fields':['name',_0x5ba3('0x12')]},{'unique':!![],'name':_0x5ba3('0x13'),'fields':[_0x5ba3('0xa'),_0x5ba3('0x14')]},{'unique':!![],'name':_0x5ba3('0x15'),'fields':[_0x5ba3('0xa'),_0x5ba3('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7025=['FaxAccountId','name_openchannel','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x4b0180,_0x50af2a){var _0x387e80=function(_0x1607f0){while(--_0x1607f0){_0x4b0180['push'](_0x4b0180['shift']());}};_0x387e80(++_0x50af2a);}(_0x7025,0x182));var _0x5702=function(_0x4dd245,_0x1f4e37){_0x4dd245=_0x4dd245-0x0;var _0xa4c74=_0x7025[_0x4dd245];return _0xa4c74;};'use strict';var _=require(_0x5702('0x0'));var util=require(_0x5702('0x1'));var logger=require(_0x5702('0x2'))('api');var moment=require(_0x5702('0x3'));var BPromise=require(_0x5702('0x4'));var rp=require(_0x5702('0x5'));var fs=require('fs');var path=require(_0x5702('0x6'));var rimraf=require(_0x5702('0x7'));var config=require(_0x5702('0x8'));var attributes=require(_0x5702('0x9'));module[_0x5702('0xa')]=function(_0x148929,_0x21b2ce){return _0x148929[_0x5702('0xb')]('Disposition',attributes,{'tableName':_0x5702('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5702('0xd'),'fields':[_0x5702('0xe'),_0x5702('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0x5702('0xe'),_0x5702('0x10')]},{'unique':!![],'name':_0x5702('0x11'),'fields':['name',_0x5702('0x12')]},{'unique':!![],'name':_0x5702('0x13'),'fields':['name',_0x5702('0x14')]},{'unique':!![],'name':_0x5702('0x15'),'fields':[_0x5702('0xe'),_0x5702('0x16')]},{'unique':!![],'name':_0x5702('0x17'),'fields':[_0x5702('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x5702('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a42d03d..100efb7 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 _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x464c9d,_0x43d375){var _0xd8bb30=function(_0x4207f7){while(--_0x4207f7){_0x464c9d['push'](_0x464c9d['shift']());}};_0xd8bb30(++_0x43d375);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x30511f,_0x251f02){var _0xf678ec=function(_0x2b16b6){while(--_0x2b16b6){_0x30511f['push'](_0x30511f['shift']());}};_0xf678ec(++_0x251f02);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5a18faa..7c55add 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 _0x7ca4=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','post','put'];(function(_0x51cac3,_0xcfc519){var _0x37adef=function(_0x2e9c9e){while(--_0x2e9c9e){_0x51cac3['push'](_0x51cac3['shift']());}};_0x37adef(++_0xcfc519);}(_0x7ca4,0xe2));var _0x47ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ca4[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x47ca('0x0'));var path=require('path');var timeout=require(_0x47ca('0x1'));var express=require(_0x47ca('0x2'));var router=express[_0x47ca('0x3')]();var fs_extra=require(_0x47ca('0x4'));var auth=require(_0x47ca('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x47ca('0x6')]('/',auth[_0x47ca('0x7')](),controller[_0x47ca('0x8')]);router['get'](_0x47ca('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x47ca('0xa')]('/',auth[_0x47ca('0x7')](),controller['create']);router[_0x47ca('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x47ca('0x9'),auth[_0x47ca('0x7')](),controller[_0x47ca('0xc')]);module[_0x47ca('0xd')]=router; \ No newline at end of file +var _0x8d02=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','exports','multer','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d02,0x85));var _0x28d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8d02[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x28d0('0x0'));var util=require('util');var path=require(_0x28d0('0x1'));var timeout=require(_0x28d0('0x2'));var express=require(_0x28d0('0x3'));var router=express[_0x28d0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28d0('0x5'));var interaction=require(_0x28d0('0x6'));var config=require(_0x28d0('0x7'));var controller=require('./disposition.controller');router[_0x28d0('0x8')]('/',auth[_0x28d0('0x9')](),controller['index']);router['get'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller[_0x28d0('0xb')]);router[_0x28d0('0xc')]('/',auth[_0x28d0('0x9')](),controller[_0x28d0('0xd')]);router['put'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller['update']);router['delete'](_0x28d0('0xa'),auth[_0x28d0('0x9')](),controller['destroy']);module[_0x28d0('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 55c30c5..7c643df 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 _0x6f47=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','14400','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x43801c,_0x45a750){var _0x40bc47=function(_0x180b46){while(--_0x180b46){_0x43801c['push'](_0x43801c['shift']());}};_0x40bc47(++_0x45a750);}(_0x6f47,0xc7));var _0x76f4=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x6f47[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x76f4('0x2')]('yes','no'),'defaultValue':_0x76f4('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x76f4('0x4')},'localstationid':{'type':Sequelize[_0x76f4('0x1')],'unique':_0x76f4('0x5')},'minrate':{'type':Sequelize[_0x76f4('0x2')]('2400',_0x76f4('0x6'),_0x76f4('0x7'),_0x76f4('0x8'),'12000',_0x76f4('0x9')),'defaultValue':_0x76f4('0x6')},'maxrate':{'type':Sequelize[_0x76f4('0x2')](_0x76f4('0xa'),_0x76f4('0x6'),'7200','9600',_0x76f4('0xb'),_0x76f4('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x76f4('0xc')},'gateway':{'type':Sequelize[_0x76f4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x76f4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x76f4('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x76f4('0x2')](_0x76f4('0xe'),_0x76f4('0xf'),_0x76f4('0x10'),_0x76f4('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x76f4('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x76f4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x76f4('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x76f4('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x76f4('0x13')],'defaultValue':![],'comment':_0x76f4('0x15'),'set':function(_0x672960){if(!_0x672960)this[_0x76f4('0x16')](_0x76f4('0x17'),null);this[_0x76f4('0x16')](_0x76f4('0x18'),_0x672960);}}}; \ No newline at end of file +var _0xbd10=['setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','7200','12000','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbd10,0x85));var _0x0bd1=function(_0x1e3a15,_0x246053){_0x1e3a15=_0x1e3a15-0x0;var _0x5bf0d6=_0xbd10[_0x1e3a15];return _0x5bf0d6;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x4'),'no'),'defaultValue':_0x0bd1('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x0bd1('0x5')},'localstationid':{'type':Sequelize[_0x0bd1('0x2')],'unique':_0x0bd1('0x6')},'minrate':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x7'),_0x0bd1('0x8'),'7200',_0x0bd1('0x9'),'12000',_0x0bd1('0xa')),'defaultValue':_0x0bd1('0x8')},'maxrate':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0x7'),'4800',_0x0bd1('0xb'),_0x0bd1('0x9'),_0x0bd1('0xc'),_0x0bd1('0xa')),'defaultValue':_0x0bd1('0xa')},'modem':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0bd1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0bd1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0bd1('0x3')](_0x0bd1('0xe'),_0x0bd1('0xf'),'DADHI',_0x0bd1('0x10')),'defaultValue':_0x0bd1('0xe')},'key':{'type':Sequelize[_0x0bd1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bd1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0bd1('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0bd1('0x11')],'defaultValue':![],'comment':_0x0bd1('0x13'),'set':function(_0x3042c6){if(!_0x3042c6)this['setDataValue'](_0x0bd1('0x14'),null);this[_0x0bd1('0x15')]('mandatoryDisposition',_0x3042c6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 961a17c..8f0d293 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 _0x6e3a=['../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','status','json','offset','undefined','count','set','reject','save','then','destroy','get','FaxAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','rawAttributes','sort','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','stack','sendStatus','getApplications','context','from-voip-provider','localstationid','app','type','Fax\x20Extension','appdata','push','Answer','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','transaction','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1de2d1,_0x10dd8f){var _0x3a2e0b=function(_0xc7bdc2){while(--_0xc7bdc2){_0x1de2d1['push'](_0x1de2d1['shift']());}};_0x3a2e0b(++_0x10dd8f);}(_0x6e3a,0xb0));var _0xa6e3=function(_0x4849d5,_0x40fe94){_0x4849d5=_0x4849d5-0x0;var _0xfe3822=_0x6e3a[_0x4849d5];return _0xfe3822;};'use strict';var emlformat=require(_0xa6e3('0x0'));var rimraf=require(_0xa6e3('0x1'));var zipdir=require(_0xa6e3('0x2'));var jsonpatch=require(_0xa6e3('0x3'));var rp=require('request-promise');var moment=require(_0xa6e3('0x4'));var BPromise=require(_0xa6e3('0x5'));var Mustache=require(_0xa6e3('0x6'));var util=require('util');var path=require(_0xa6e3('0x7'));var sox=require(_0xa6e3('0x8'));var csv=require(_0xa6e3('0x9'));var ejs=require(_0xa6e3('0xa'));var fs=require('fs');var fs_extra=require(_0xa6e3('0xb'));var _=require(_0xa6e3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa6e3('0xd'));var deskjs=require(_0xa6e3('0xe'));var toCsv=require(_0xa6e3('0x9'));var querystring=require('querystring');var Papa=require(_0xa6e3('0xf'));var Redis=require(_0xa6e3('0x10'));var authService=require(_0xa6e3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa6e3('0x12'));var hardwareService=require(_0xa6e3('0x13'));var logger=require(_0xa6e3('0x14'))(_0xa6e3('0x15'));var utils=require(_0xa6e3('0x16'));var config=require(_0xa6e3('0x17'));var licenseUtil=require(_0xa6e3('0x18'));var db=require('../../mysqldb')['db'];config[_0xa6e3('0x19')]=_['defaults'](config['redis'],{'host':_0xa6e3('0x1a'),'port':0x18eb});var socket=require(_0xa6e3('0x1b'))(new Redis(config['redis']));require(_0xa6e3('0x1c'))[_0xa6e3('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xa6e3('0x1e')][_0xa6e3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5bda49,_0x3e6154,_0x47849e,_0xde4acc){return new BPromise(function(_0x3fdbf9,_0x24a0d9){var _0x382860=_0xde4acc||client;return _0x382860[_0xa6e3('0x20')](_0x5bda49,_0x47849e)['then'](function(_0x481f0c){logger['info'](_0xa6e3('0x21'),_0x3e6154,'request\x20sent');logger[_0xa6e3('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3e6154,_0xa6e3('0x23'),JSON['stringify'](_0x481f0c));if(_0x481f0c['error']){if(_0x481f0c[_0xa6e3('0x24')][_0xa6e3('0x25')]===0x1f4){logger[_0xa6e3('0x24')](_0xa6e3('0x21'),_0x3e6154,_0x481f0c[_0xa6e3('0x24')][_0xa6e3('0x26')]);return _0x24a0d9(_0x481f0c[_0xa6e3('0x24')][_0xa6e3('0x26')]);}logger[_0xa6e3('0x24')](_0xa6e3('0x21'),_0x3e6154,_0x481f0c[_0xa6e3('0x24')]['message']);return _0x3fdbf9(_0x481f0c[_0xa6e3('0x24')][_0xa6e3('0x26')]);}else{logger[_0xa6e3('0x27')](_0xa6e3('0x21'),_0x3e6154,_0xa6e3('0x23'));_0x3fdbf9(_0x481f0c[_0xa6e3('0x28')][_0xa6e3('0x26')]);}})[_0xa6e3('0x29')](function(_0x21c761){logger[_0xa6e3('0x24')](_0xa6e3('0x21'),_0x3e6154,_0x21c761);_0x24a0d9(_0x21c761);});});}function respondWithStatusCode(_0x2ad7ba,_0x26abc2){_0x26abc2=_0x26abc2||0xcc;return function(_0x472f7f){if(_0x472f7f){return _0x2ad7ba['sendStatus'](_0x26abc2);}return _0x2ad7ba[_0xa6e3('0x2a')](_0x26abc2)['end']();};}function respondWithResult(_0x26ec5e,_0x17a2c8){_0x17a2c8=_0x17a2c8||0xc8;return function(_0xb32e78){if(_0xb32e78){return _0x26ec5e['status'](_0x17a2c8)[_0xa6e3('0x2b')](_0xb32e78);}};}function respondWithFilteredResult(_0x355be3,_0x379262){return function(_0x4c6733){if(_0x4c6733){var _0xc816f4=typeof _0x379262[_0xa6e3('0x2c')]===_0xa6e3('0x2d')&&typeof _0x379262['limit']===_0xa6e3('0x2d');var _0x378e8b=_0x4c6733[_0xa6e3('0x2e')];var _0x564f52=_0xc816f4?0x0:_0x379262[_0xa6e3('0x2c')];var _0x18db04=_0xc816f4?_0x4c6733[_0xa6e3('0x2e')]:_0x379262[_0xa6e3('0x2c')]+_0x379262['limit'];var _0x2b2df8;if(_0x18db04>=_0x378e8b){_0x18db04=_0x378e8b;_0x2b2df8=0xc8;}else{_0x2b2df8=0xce;}_0x355be3['status'](_0x2b2df8);return _0x355be3[_0xa6e3('0x2f')]('Content-Range',_0x564f52+'-'+_0x18db04+'/'+_0x378e8b)[_0xa6e3('0x2b')](_0x4c6733);}return null;};}function patchUpdates(_0x3acd11){return function(_0x5729ec){try{jsonpatch['apply'](_0x5729ec,_0x3acd11,!![]);}catch(_0x3d004f){return BPromise[_0xa6e3('0x30')](_0x3d004f);}return _0x5729ec[_0xa6e3('0x31')]();};}function saveUpdates(_0x28df67,_0x265119){return function(_0x58abce){if(_0x58abce){return _0x58abce['update'](_0x28df67)[_0xa6e3('0x32')](function(_0x4d32df){return _0x4d32df;});}return null;};}function removeEntity(_0x63cd7b,_0x45a643){return function(_0x39a129){if(_0x39a129){return _0x39a129[_0xa6e3('0x33')]()[_0xa6e3('0x32')](function(){var _0x1fb325=_0x39a129[_0xa6e3('0x34')]({'plain':!![]});var _0x38d80f=_0xa6e3('0x35');return db[_0xa6e3('0x36')][_0xa6e3('0x33')]({'where':{'type':_0x38d80f,'resourceId':_0x1fb325['id']}})[_0xa6e3('0x32')](function(){return _0x39a129;});})[_0xa6e3('0x32')](function(){_0x63cd7b['status'](0xcc)[_0xa6e3('0x37')]();});}};}function handleEntityNotFound(_0x536519,_0x543101){return function(_0x147eec){if(!_0x147eec){_0x536519['sendStatus'](0x194);}return _0x147eec;};}function handleError(_0x563ffe,_0x399f24){_0x399f24=_0x399f24||0x1f4;return function(_0x2efdbb){logger[_0xa6e3('0x24')](_0x2efdbb['stack']);if(_0x2efdbb[_0xa6e3('0x38')]){delete _0x2efdbb['name'];}_0x563ffe[_0xa6e3('0x2a')](_0x399f24)[_0xa6e3('0x39')](_0x2efdbb);};}exports[_0xa6e3('0x3a')]=function(_0x1b4441,_0x55d69d){var _0x5d1fd5={'include':[{'model':db[_0xa6e3('0x3b')],'as':_0xa6e3('0x3c')}]},_0x1ac1de={},_0x469d0b={'count':0x0,'rows':[]};var _0x35d71c=_[_0xa6e3('0x3d')](db[_0xa6e3('0x3e')]['rawAttributes'],function(_0x501bbe){return{'name':_0x501bbe[_0xa6e3('0x3f')],'type':_0x501bbe['type'][_0xa6e3('0x40')]};});_0x1ac1de[_0xa6e3('0x41')]=_[_0xa6e3('0x3d')](_0x35d71c,_0xa6e3('0x38'));_0x1ac1de[_0xa6e3('0x42')]=_[_0xa6e3('0x43')](_0x1b4441[_0xa6e3('0x42')]);_0x1ac1de['filters']=_[_0xa6e3('0x44')](_0x1ac1de[_0xa6e3('0x41')],_0x1ac1de[_0xa6e3('0x42')]);_0x5d1fd5[_0xa6e3('0x45')]=_['intersection'](_0x1ac1de['model'],qs[_0xa6e3('0x46')](_0x1b4441[_0xa6e3('0x42')][_0xa6e3('0x46')]));_0x5d1fd5[_0xa6e3('0x45')]=_0x5d1fd5[_0xa6e3('0x45')][_0xa6e3('0x47')]?_0x5d1fd5[_0xa6e3('0x45')]:_0x1ac1de[_0xa6e3('0x41')];if(!_0x1b4441['query'][_0xa6e3('0x48')](_0xa6e3('0x49'))){_0x5d1fd5[_0xa6e3('0x4a')]=qs['limit'](_0x1b4441['query'][_0xa6e3('0x4a')]);_0x5d1fd5[_0xa6e3('0x2c')]=qs[_0xa6e3('0x2c')](_0x1b4441[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}_0x5d1fd5[_0xa6e3('0x4b')]=qs['sort'](_0x1b4441[_0xa6e3('0x42')]['sort']);_0x5d1fd5[_0xa6e3('0x4c')]=qs[_0xa6e3('0x4d')](_[_0xa6e3('0x4e')](_0x1b4441[_0xa6e3('0x42')],_0x1ac1de[_0xa6e3('0x4d')]),_0x35d71c);if(_0x1b4441[_0xa6e3('0x42')][_0xa6e3('0x4f')]){_0x5d1fd5['where']=_[_0xa6e3('0x50')](_0x5d1fd5[_0xa6e3('0x4c')],{'$or':_[_0xa6e3('0x3d')](_0x35d71c,function(_0x2a4623){if(_0x2a4623['type']!=='VIRTUAL'){var _0x4be1cd={};_0x4be1cd[_0x2a4623[_0xa6e3('0x38')]]={'$like':'%'+_0x1b4441['query'][_0xa6e3('0x4f')]+'%'};return _0x4be1cd;}})});}_0x5d1fd5=_[_0xa6e3('0x50')]({},_0x5d1fd5,_0x1b4441[_0xa6e3('0x51')]);var _0x246e83={'where':_0x5d1fd5[_0xa6e3('0x4c')]};return db[_0xa6e3('0x3e')][_0xa6e3('0x2e')](_0x246e83)[_0xa6e3('0x32')](function(_0x6aa4b8){_0x469d0b[_0xa6e3('0x2e')]=_0x6aa4b8;if(_0x1b4441['query'][_0xa6e3('0x52')]){_0x5d1fd5[_0xa6e3('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0xa6e3('0x54')](_0x5d1fd5);})[_0xa6e3('0x32')](function(_0x119cca){_0x469d0b[_0xa6e3('0x55')]=_0x119cca;return _0x469d0b;})[_0xa6e3('0x32')](respondWithFilteredResult(_0x55d69d,_0x5d1fd5))['catch'](handleError(_0x55d69d,null));};exports[_0xa6e3('0x56')]=function(_0x285c98,_0x1bdb22){var _0x3b8f6c={'raw':![],'where':{'id':_0x285c98[_0xa6e3('0x57')]['id']},'include':[{'model':db[_0xa6e3('0x3b')],'as':_0xa6e3('0x3c')}]},_0x2f3f6f={};_0x2f3f6f[_0xa6e3('0x41')]=_[_0xa6e3('0x43')](db['FaxAccount']['rawAttributes']);_0x2f3f6f[_0xa6e3('0x42')]=_[_0xa6e3('0x43')](_0x285c98[_0xa6e3('0x42')]);_0x2f3f6f[_0xa6e3('0x4d')]=_[_0xa6e3('0x44')](_0x2f3f6f[_0xa6e3('0x41')],_0x2f3f6f['query']);_0x3b8f6c['attributes']=_[_0xa6e3('0x44')](_0x2f3f6f[_0xa6e3('0x41')],qs[_0xa6e3('0x46')](_0x285c98['query'][_0xa6e3('0x46')]));_0x3b8f6c[_0xa6e3('0x45')]=_0x3b8f6c[_0xa6e3('0x45')][_0xa6e3('0x47')]?_0x3b8f6c[_0xa6e3('0x45')]:_0x2f3f6f[_0xa6e3('0x41')];if(_0x285c98['query']['includeAll']){_0x3b8f6c['include']=[{'all':!![]}];}_0x3b8f6c=_[_0xa6e3('0x50')]({},_0x3b8f6c,_0x285c98['options']);return db[_0xa6e3('0x3e')][_0xa6e3('0x58')](_0x3b8f6c)[_0xa6e3('0x32')](handleEntityNotFound(_0x1bdb22,null))[_0xa6e3('0x32')](respondWithResult(_0x1bdb22,null))[_0xa6e3('0x29')](handleError(_0x1bdb22,null));};exports[_0xa6e3('0x59')]=function(_0x39715e,_0x36fa5f){return db['FaxAccount'][_0xa6e3('0x59')](_0x39715e[_0xa6e3('0x5a')],{})[_0xa6e3('0x32')](function(_0xd79582){var _0x4fbdef=_0x39715e[_0xa6e3('0x5b')][_0xa6e3('0x34')]({'plain':!![]});if(!_0x4fbdef)throw new Error(_0xa6e3('0x5c'));if(_0x4fbdef[_0xa6e3('0x5d')]===_0xa6e3('0x5b')){var _0x154bc4=_0xd79582[_0xa6e3('0x34')]({'plain':!![]});var _0xc415fb='FaxAccounts';return db[_0xa6e3('0x5e')][_0xa6e3('0x58')]({'where':{'name':_0xc415fb,'userProfileId':_0x4fbdef['userProfileId']},'raw':!![]})['then'](function(_0x260e11){if(_0x260e11&&_0x260e11[_0xa6e3('0x5f')]===0x0){return db['UserProfileResource'][_0xa6e3('0x59')]({'name':_0x154bc4[_0xa6e3('0x38')],'resourceId':_0x154bc4['id'],'type':_0x260e11['name'],'sectionId':_0x260e11['id']},{})['then'](function(){return _0xd79582;});}else{return _0xd79582;}})['catch'](function(_0x41ffba){logger[_0xa6e3('0x24')](_0xa6e3('0x60'),_0x41ffba);throw _0x41ffba;});}return _0xd79582;})[_0xa6e3('0x32')](respondWithResult(_0x36fa5f,0xc9))[_0xa6e3('0x29')](handleError(_0x36fa5f,null));};exports[_0xa6e3('0x61')]=function(_0xc56aa4,_0x426190){if(_0xc56aa4['body']['id']){delete _0xc56aa4[_0xa6e3('0x5a')]['id'];}return db[_0xa6e3('0x3e')][_0xa6e3('0x58')]({'where':{'id':_0xc56aa4['params']['id']},'include':[{'model':db['Pause'],'as':_0xa6e3('0x3c')}]})['then'](handleEntityNotFound(_0x426190,null))['then'](saveUpdates(_0xc56aa4[_0xa6e3('0x5a')],null))[_0xa6e3('0x32')](respondWithResult(_0x426190,null))[_0xa6e3('0x29')](handleError(_0x426190,null));};exports[_0xa6e3('0x33')]=function(_0x2dc8bf,_0x35db66){return db[_0xa6e3('0x3e')][_0xa6e3('0x58')]({'where':{'id':_0x2dc8bf[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x35db66,null))['then'](removeEntity(_0x35db66,null))[_0xa6e3('0x29')](handleError(_0x35db66,null));};exports['describe']=function(_0x538602,_0x2575fb){return db['FaxAccount']['describe']()[_0xa6e3('0x32')](respondWithResult(_0x2575fb,null))[_0xa6e3('0x29')](handleError(_0x2575fb,null));};exports[_0xa6e3('0x62')]=function(_0x5125cd,_0x3e6c85,_0x2c5cdd){if(_0x5125cd[_0xa6e3('0x5a')]['id']){delete _0x5125cd[_0xa6e3('0x5a')]['id'];}return db[_0xa6e3('0x3e')]['find']({'where':{'id':_0x5125cd[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x3e6c85,null))[_0xa6e3('0x32')](function(_0xd8c182){if(_0xd8c182){_0x5125cd[_0xa6e3('0x5a')][_0xa6e3('0x63')]=_0xd8c182['id'];return db['Disposition'][_0xa6e3('0x59')](_0x5125cd[_0xa6e3('0x5a')]);}})[_0xa6e3('0x32')](respondWithResult(_0x3e6c85,null))['catch'](handleError(_0x3e6c85,null));};exports[_0xa6e3('0x64')]=function(_0x366a0c,_0xfd7681,_0x5a4e8a){var _0xb8ca21={'raw':![],'where':{}};var _0x160543={};var _0x15285d={'count':0x0,'rows':[]};return db[_0xa6e3('0x3e')][_0xa6e3('0x65')]({'where':{'id':_0x366a0c[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0xfd7681,null))[_0xa6e3('0x32')](function(_0x1fca87){if(_0x1fca87){_0x160543[_0xa6e3('0x41')]=_[_0xa6e3('0x43')](db[_0xa6e3('0x66')][_0xa6e3('0x67')]);_0x160543['query']=_['keys'](_0x366a0c[_0xa6e3('0x42')]);_0x160543[_0xa6e3('0x4d')]=_[_0xa6e3('0x44')](_0x160543[_0xa6e3('0x41')],_0x160543[_0xa6e3('0x42')]);_0xb8ca21[_0xa6e3('0x45')]=_[_0xa6e3('0x44')](_0x160543[_0xa6e3('0x41')],qs['fields'](_0x366a0c[_0xa6e3('0x42')][_0xa6e3('0x46')]));_0xb8ca21[_0xa6e3('0x45')]=_0xb8ca21[_0xa6e3('0x45')][_0xa6e3('0x47')]?_0xb8ca21['attributes']:_0x160543['model'];if(!_0x366a0c[_0xa6e3('0x42')][_0xa6e3('0x48')](_0xa6e3('0x49'))){_0xb8ca21[_0xa6e3('0x4a')]=qs[_0xa6e3('0x4a')](_0x366a0c['query'][_0xa6e3('0x4a')]);_0xb8ca21[_0xa6e3('0x2c')]=qs[_0xa6e3('0x2c')](_0x366a0c[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}_0xb8ca21[_0xa6e3('0x4b')]=qs[_0xa6e3('0x68')](_0x366a0c[_0xa6e3('0x42')][_0xa6e3('0x68')]);_0xb8ca21[_0xa6e3('0x4c')]=qs[_0xa6e3('0x4d')](_[_0xa6e3('0x4e')](_0x366a0c[_0xa6e3('0x42')],_0x160543[_0xa6e3('0x4d')]));_0xb8ca21[_0xa6e3('0x4c')][_0xa6e3('0x63')]=_0x1fca87['id'];if(_0x366a0c[_0xa6e3('0x42')][_0xa6e3('0x4f')]){_0xb8ca21['where']=_[_0xa6e3('0x50')](_0xb8ca21[_0xa6e3('0x4c')],{'$or':_['map'](_0xb8ca21[_0xa6e3('0x45')],function(_0x526ef9){var _0xc5415={};_0xc5415[_0x526ef9]={'$like':'%'+_0x366a0c[_0xa6e3('0x42')]['filter']+'%'};return _0xc5415;})});}_0xb8ca21=_[_0xa6e3('0x50')]({},_0xb8ca21,_0x366a0c[_0xa6e3('0x51')]);return db['Disposition'][_0xa6e3('0x2e')]({'where':_0xb8ca21[_0xa6e3('0x4c')]})['then'](function(_0x28662b){_0x15285d[_0xa6e3('0x2e')]=_0x28662b;if(_0x366a0c['query'][_0xa6e3('0x52')]){_0xb8ca21[_0xa6e3('0x53')]=[{'all':!![]}];}return db[_0xa6e3('0x66')][_0xa6e3('0x54')](_0xb8ca21);})['then'](function(_0x330a24){_0x15285d[_0xa6e3('0x55')]=_0x330a24;return _0x15285d;});}})[_0xa6e3('0x32')](respondWithFilteredResult(_0xfd7681,_0xb8ca21))[_0xa6e3('0x29')](handleError(_0xfd7681,null));};exports[_0xa6e3('0x69')]=function(_0x882077,_0x497560,_0x1bbcc9){return db['FaxAccount']['find']({'where':{'id':_0x882077[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x497560,null))['then'](function(_0x2d37fd){if(_0x2d37fd){return _0x2d37fd[_0xa6e3('0x69')](_0x882077['query'][_0xa6e3('0x6a')]);}})[_0xa6e3('0x32')](respondWithStatusCode(_0x497560,null))[_0xa6e3('0x29')](handleError(_0x497560,null));};exports[_0xa6e3('0x6b')]=function(_0x1ca7bb,_0x299e83,_0x2be344){if(_0x1ca7bb[_0xa6e3('0x5a')]['id']){delete _0x1ca7bb[_0xa6e3('0x5a')]['id'];}return db[_0xa6e3('0x3e')][_0xa6e3('0x58')]({'where':{'id':_0x1ca7bb[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x299e83,null))[_0xa6e3('0x32')](function(_0x4f6f1f){if(_0x4f6f1f){_0x1ca7bb[_0xa6e3('0x5a')][_0xa6e3('0x63')]=_0x4f6f1f['id'];return db['CannedAnswer'][_0xa6e3('0x59')](_0x1ca7bb[_0xa6e3('0x5a')]);}})[_0xa6e3('0x32')](respondWithResult(_0x299e83,null))['catch'](handleError(_0x299e83,null));};exports[_0xa6e3('0x6c')]=function(_0x120214,_0x47b6a6,_0x11e347){var _0x548efc={'raw':![],'where':{}};var _0x14efa8={};var _0x4bee42={'count':0x0,'rows':[]};return db[_0xa6e3('0x3e')][_0xa6e3('0x65')]({'where':{'id':_0x120214[_0xa6e3('0x57')]['id']}})['then'](handleEntityNotFound(_0x47b6a6,null))[_0xa6e3('0x32')](function(_0x237840){if(_0x237840){_0x14efa8['model']=_[_0xa6e3('0x43')](db[_0xa6e3('0x6d')][_0xa6e3('0x67')]);_0x14efa8['query']=_[_0xa6e3('0x43')](_0x120214[_0xa6e3('0x42')]);_0x14efa8['filters']=_['intersection'](_0x14efa8[_0xa6e3('0x41')],_0x14efa8[_0xa6e3('0x42')]);_0x548efc['attributes']=_[_0xa6e3('0x44')](_0x14efa8[_0xa6e3('0x41')],qs[_0xa6e3('0x46')](_0x120214[_0xa6e3('0x42')][_0xa6e3('0x46')]));_0x548efc['attributes']=_0x548efc['attributes'][_0xa6e3('0x47')]?_0x548efc[_0xa6e3('0x45')]:_0x14efa8[_0xa6e3('0x41')];if(!_0x120214[_0xa6e3('0x42')][_0xa6e3('0x48')](_0xa6e3('0x49'))){_0x548efc[_0xa6e3('0x4a')]=qs[_0xa6e3('0x4a')](_0x120214['query'][_0xa6e3('0x4a')]);_0x548efc[_0xa6e3('0x2c')]=qs[_0xa6e3('0x2c')](_0x120214[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}_0x548efc[_0xa6e3('0x4b')]=qs[_0xa6e3('0x68')](_0x120214[_0xa6e3('0x42')][_0xa6e3('0x68')]);_0x548efc[_0xa6e3('0x4c')]=qs[_0xa6e3('0x4d')](_[_0xa6e3('0x4e')](_0x120214[_0xa6e3('0x42')],_0x14efa8[_0xa6e3('0x4d')]));_0x548efc[_0xa6e3('0x4c')]['FaxAccountId']=_0x237840['id'];if(_0x120214[_0xa6e3('0x42')][_0xa6e3('0x4f')]){_0x548efc[_0xa6e3('0x4c')]=_[_0xa6e3('0x50')](_0x548efc[_0xa6e3('0x4c')],{'$or':_['map'](_0x548efc[_0xa6e3('0x45')],function(_0x3fc953){var _0x19b82f={};_0x19b82f[_0x3fc953]={'$like':'%'+_0x120214[_0xa6e3('0x42')][_0xa6e3('0x4f')]+'%'};return _0x19b82f;})});}_0x548efc=_[_0xa6e3('0x50')]({},_0x548efc,_0x120214[_0xa6e3('0x51')]);return db[_0xa6e3('0x6d')][_0xa6e3('0x2e')]({'where':_0x548efc[_0xa6e3('0x4c')]})[_0xa6e3('0x32')](function(_0x82a6ae){_0x4bee42[_0xa6e3('0x2e')]=_0x82a6ae;if(_0x120214['query'][_0xa6e3('0x52')]){_0x548efc[_0xa6e3('0x53')]=[{'all':!![]}];}return db[_0xa6e3('0x6d')][_0xa6e3('0x54')](_0x548efc);})['then'](function(_0x4ddbd4){_0x4bee42[_0xa6e3('0x55')]=_0x4ddbd4;return _0x4bee42;});}})[_0xa6e3('0x32')](respondWithFilteredResult(_0x47b6a6,_0x548efc))[_0xa6e3('0x29')](handleError(_0x47b6a6,null));};exports['removeAnswers']=function(_0x3e08f5,_0xb6ccf3,_0x59ad8a){return db[_0xa6e3('0x3e')][_0xa6e3('0x58')]({'where':{'id':_0x3e08f5['params']['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0xb6ccf3,null))[_0xa6e3('0x32')](function(_0x55ac6a){if(_0x55ac6a){return _0x55ac6a[_0xa6e3('0x6e')](_0x3e08f5[_0xa6e3('0x42')][_0xa6e3('0x6a')]);}})[_0xa6e3('0x32')](respondWithStatusCode(_0xb6ccf3,null))['catch'](handleError(_0xb6ccf3,null));};exports[_0xa6e3('0x6f')]=function(_0x5a7fdd,_0x5d3d31,_0x2bda12){return db[_0xa6e3('0x70')][_0xa6e3('0x58')]({'where':{'id':_0x5a7fdd['params']['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x5d3d31,null))[_0xa6e3('0x32')](function(_0x3b29b1){if(_0x3b29b1){return _0x3b29b1[_0xa6e3('0x6f')](_0x5a7fdd[_0xa6e3('0x5a')]['ids'],_[_0xa6e3('0x71')](_0x5a7fdd[_0xa6e3('0x5a')],[_0xa6e3('0x6a'),'id'])||{});}})[_0xa6e3('0x32')](respondWithResult(_0x5d3d31,null))[_0xa6e3('0x29')](handleError(_0x5d3d31,null));};exports[_0xa6e3('0x72')]=function(_0x5708c1,_0x452314,_0x46cbbf){var _0x509f2e={'raw':![],'where':{}};var _0x2c37dd={};var _0x1020c3={'count':0x0,'rows':[]};return db[_0xa6e3('0x3e')][_0xa6e3('0x65')]({'where':{'id':_0x5708c1[_0xa6e3('0x57')]['id']}})['then'](handleEntityNotFound(_0x452314,null))[_0xa6e3('0x32')](function(_0x34c701){if(_0x34c701){_0x2c37dd[_0xa6e3('0x41')]=_[_0xa6e3('0x43')](db[_0xa6e3('0x70')][_0xa6e3('0x67')]);_0x2c37dd[_0xa6e3('0x42')]=_[_0xa6e3('0x43')](_0x5708c1['query']);_0x2c37dd['filters']=_['intersection'](_0x2c37dd[_0xa6e3('0x41')],_0x2c37dd[_0xa6e3('0x42')]);_0x509f2e[_0xa6e3('0x45')]=_[_0xa6e3('0x44')](_0x2c37dd[_0xa6e3('0x41')],qs[_0xa6e3('0x46')](_0x5708c1[_0xa6e3('0x42')]['fields']));_0x509f2e[_0xa6e3('0x45')]=_0x509f2e[_0xa6e3('0x45')][_0xa6e3('0x47')]?_0x509f2e[_0xa6e3('0x45')]:_0x2c37dd['model'];if(!_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x48')](_0xa6e3('0x49'))){_0x509f2e[_0xa6e3('0x4a')]=qs[_0xa6e3('0x4a')](_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x4a')]);_0x509f2e[_0xa6e3('0x2c')]=qs[_0xa6e3('0x2c')](_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}_0x509f2e[_0xa6e3('0x4b')]=qs[_0xa6e3('0x68')](_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x68')]);_0x509f2e[_0xa6e3('0x4c')]=qs['filters'](_[_0xa6e3('0x4e')](_0x5708c1[_0xa6e3('0x42')],_0x2c37dd['filters']));_0x509f2e[_0xa6e3('0x4c')][_0xa6e3('0x63')]=_0x34c701['id'];if(_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x4f')]){_0x509f2e['where']=_[_0xa6e3('0x50')](_0x509f2e[_0xa6e3('0x4c')],{'$or':_[_0xa6e3('0x3d')](_0x509f2e[_0xa6e3('0x45')],function(_0x328858){var _0x48a501={};_0x48a501[_0x328858]={'$like':'%'+_0x5708c1['query'][_0xa6e3('0x4f')]+'%'};return _0x48a501;})});}_0x509f2e=_[_0xa6e3('0x50')]({},_0x509f2e,_0x5708c1[_0xa6e3('0x51')]);return db[_0xa6e3('0x70')][_0xa6e3('0x2e')]({'where':_0x509f2e[_0xa6e3('0x4c')]})[_0xa6e3('0x32')](function(_0x59be89){_0x1020c3[_0xa6e3('0x2e')]=_0x59be89;if(_0x5708c1['query'][_0xa6e3('0x52')]){_0x509f2e[_0xa6e3('0x53')]=[{'model':db[_0xa6e3('0x73')],'as':_0xa6e3('0x74'),'required':![]},{'model':db[_0xa6e3('0x75')],'as':_0xa6e3('0x76'),'attributes':[_0xa6e3('0x38'),_0xa6e3('0x77'),_0xa6e3('0x78')],'required':![]},{'model':db[_0xa6e3('0x79')],'as':'Tags','attributes':['id',_0xa6e3('0x38'),_0xa6e3('0x7a')],'where':_0x5708c1[_0xa6e3('0x42')]['tag']?{'id':_0x5708c1[_0xa6e3('0x42')][_0xa6e3('0x7b')]}:undefined,'required':_0x5708c1[_0xa6e3('0x42')]['tag']?!![]:![]}];}return db[_0xa6e3('0x70')][_0xa6e3('0x54')](_0x509f2e);})[_0xa6e3('0x32')](function(_0x1c4c21){_0x1020c3[_0xa6e3('0x55')]=_0x1c4c21;return _0x1020c3;});}})[_0xa6e3('0x32')](respondWithFilteredResult(_0x452314,_0x509f2e))[_0xa6e3('0x29')](handleError(_0x452314,null));};exports[_0xa6e3('0x7c')]=function(_0x5bfad4,_0x5e6e76){var _0x58e2c3=_0x5bfad4[_0xa6e3('0x57')]['id'];var _0x2258af=_0x5bfad4[_0xa6e3('0x5a')];var _0x33cda8=0xc8;var _0x7dd7d7=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xa6e3('0x7d')]['Transaction'][_0xa6e3('0x7e')][_0xa6e3('0x7f')]},function(_0x51c253){return db[_0xa6e3('0x3e')]['findOne']({'where':{'id':_0x58e2c3},'transaction':_0x51c253})[_0xa6e3('0x32')](function(_0x1fe686){if(_0x1fe686){return db[_0xa6e3('0x80')][_0xa6e3('0x33')]({'where':{'FaxAccountId':_0x58e2c3},'transaction':_0x51c253})['then'](function(){var _0x404c29=_[_0xa6e3('0x3d')](_0x2258af,function(_0x28b075){_0x28b075[_0xa6e3('0x63')]=_0x58e2c3;return _0x28b075;});return db[_0xa6e3('0x80')]['bulkCreate'](_0x404c29,{'transaction':_0x51c253});});}else{_0x33cda8=0x194;_0x7dd7d7=[];}});})[_0xa6e3('0x32')](function(){if(_0x33cda8!==0x194){return db['FaxApplication'][_0xa6e3('0x81')]({'where':{'FaxAccountId':_0x58e2c3},'order':_0xa6e3('0x82')})[_0xa6e3('0x32')](function(_0x5e8794){_0x7dd7d7=_0x5e8794;});}})['catch'](function(_0x11b938){_0x33cda8=0x1f4;logger['error'](_0x11b938[_0xa6e3('0x83')]);if(_0x11b938['name']){delete _0x11b938[_0xa6e3('0x38')];}_0x7dd7d7=_0x11b938;})['finally'](function(){if(_0x7dd7d7===null){_0x5e6e76[_0xa6e3('0x84')](_0x33cda8);}else{if(_0x33cda8===0x1f4){_0x5e6e76[_0xa6e3('0x2a')](_0x33cda8)[_0xa6e3('0x39')](_0x7dd7d7);}else{_0x5e6e76['status'](_0x33cda8)[_0xa6e3('0x2b')](_0x7dd7d7);}}});};exports[_0xa6e3('0x85')]=function(_0x42e0bc,_0x5b0f24,_0x502b80){var _0x2f22aa={};var _0x52e5cd={};var _0x547fed;var _0x1596c9;return db[_0xa6e3('0x3e')]['findOne']({'where':{'id':_0x42e0bc[_0xa6e3('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b0f24,null))[_0xa6e3('0x32')](function(_0x418db0){if(_0x418db0){_0x547fed=_0x418db0;_0x52e5cd[_0xa6e3('0x41')]=_['keys'](db[_0xa6e3('0x80')][_0xa6e3('0x67')]);_0x52e5cd['query']=_[_0xa6e3('0x43')](_0x42e0bc[_0xa6e3('0x42')]);_0x52e5cd[_0xa6e3('0x4d')]=_[_0xa6e3('0x44')](_0x52e5cd[_0xa6e3('0x41')],_0x52e5cd[_0xa6e3('0x42')]);_0x2f22aa['attributes']=_[_0xa6e3('0x44')](_0x52e5cd[_0xa6e3('0x41')],qs[_0xa6e3('0x46')](_0x42e0bc[_0xa6e3('0x42')][_0xa6e3('0x46')]));_0x2f22aa[_0xa6e3('0x45')]=_0x2f22aa['attributes'][_0xa6e3('0x47')]?_0x2f22aa[_0xa6e3('0x45')]:_0x52e5cd[_0xa6e3('0x41')];_0x2f22aa['order']=qs[_0xa6e3('0x68')](_0x42e0bc[_0xa6e3('0x42')][_0xa6e3('0x68')]);_0x2f22aa[_0xa6e3('0x4c')]=qs[_0xa6e3('0x4d')](_['pick'](_0x42e0bc[_0xa6e3('0x42')],_0x52e5cd[_0xa6e3('0x4d')]));if(_0x42e0bc['query'][_0xa6e3('0x4f')]){_0x2f22aa['where']=_[_0xa6e3('0x50')](_0x2f22aa[_0xa6e3('0x4c')],{'$or':_[_0xa6e3('0x3d')](_0x2f22aa['attributes'],function(_0x306e37){var _0x383b01={};_0x383b01[_0x306e37]={'$like':'%'+_0x42e0bc[_0xa6e3('0x42')][_0xa6e3('0x4f')]+'%'};return _0x383b01;})});}_0x2f22aa=_['merge']({},_0x2f22aa,_0x42e0bc[_0xa6e3('0x51')]);return _0x547fed['getApplications'](_0x2f22aa);}})['then'](function(_0x2f651e){if(_0x2f651e){_0x1596c9=_0x2f651e['length'];if(!_0x42e0bc[_0xa6e3('0x42')]['hasOwnProperty'](_0xa6e3('0x49'))){_0x2f22aa[_0xa6e3('0x4a')]=qs[_0xa6e3('0x4a')](_0x42e0bc[_0xa6e3('0x42')][_0xa6e3('0x4a')]);_0x2f22aa['offset']=qs[_0xa6e3('0x2c')](_0x42e0bc[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}return _0x547fed[_0xa6e3('0x85')](_0x2f22aa);}})[_0xa6e3('0x32')](function(_0x1718e6){if(_0x1718e6){return _0x1718e6?{'count':_0x1596c9,'rows':_0x1718e6}:null;}})[_0xa6e3('0x32')](respondWithResult(_0x5b0f24,null))['catch'](handleError(_0x5b0f24,null));};function Extension(_0x23b8fd,_0x28a85f,_0x4939ad,_0x2f4aad){this[_0xa6e3('0x86')]=_0xa6e3('0x87');this['exten']=_0x23b8fd[_0xa6e3('0x88')];this[_0xa6e3('0x89')]=_0x2f4aad;this[_0xa6e3('0x8a')]='system';this['description']=_0xa6e3('0x8b');this[_0xa6e3('0x63')]=_0x23b8fd['id'];this['priority']=_0x28a85f;this[_0xa6e3('0x8c')]=_0x4939ad;}function createExtensionsReciveFax(_0x63d2c0){var _0x590804=0x1;var _0x581743=[];_0x581743[_0xa6e3('0x8d')](new Extension(_0x63d2c0,_0x590804,'',_0xa6e3('0x8e')));_0x590804+=0x1;_0x581743['push'](new Extension(_0x63d2c0,_0x590804,'CDR(type)=inbound-fax',_0xa6e3('0x8f')));_0x590804+=0x1;for(var _0xf7f036 in _0x63d2c0){if(_0x63d2c0[_0xa6e3('0x48')](_0xf7f036)&&(_0xf7f036==='ecm'||_0xf7f036===_0xa6e3('0x88')||_0xf7f036===_0xa6e3('0x90')||_0xf7f036===_0xa6e3('0x91')||_0xf7f036===_0xa6e3('0x92')||_0xf7f036===_0xa6e3('0x93')||_0xf7f036===_0xa6e3('0x94')||_0xf7f036===_0xa6e3('0x95')||_0xf7f036===_0xa6e3('0x96'))){_0x581743[_0xa6e3('0x8d')](new Extension(_0x63d2c0,_0x590804,'FAXOPT('+_0xf7f036+')='+_0x63d2c0[_0xf7f036],_0xa6e3('0x8f')));_0x590804+=0x1;}}_0x581743[_0xa6e3('0x8d')](new Extension(_0x63d2c0,_0x590804,'6',_0xa6e3('0x97')));_0x590804+=0x1;_0x581743[_0xa6e3('0x8d')](new Extension(_0x63d2c0,_0x590804,_0xa6e3('0x98'),_0xa6e3('0x99')));_0x590804=0x0;return _0x581743;}exports['addAccountApplications']=function(_0x21efea,_0x1565ed,_0x2b5efb){var _0x150bd3;return db[_0xa6e3('0x7d')][_0xa6e3('0x9a')](function(_0x4d0613){return db[_0xa6e3('0x3e')][_0xa6e3('0x59')](_0x21efea[_0xa6e3('0x5a')],{'transaction':_0x4d0613})[_0xa6e3('0x32')](function(_0x30c831){_0x150bd3=_0x30c831['get']({'plain':!![]});return db[_0xa6e3('0x9b')][_0xa6e3('0x9c')](createExtensionsReciveFax(_0x150bd3),{'transaction':_0x4d0613});});})['then'](function(){return _0x150bd3;})[_0xa6e3('0x32')](respondWithResult(_0x1565ed,null))[_0xa6e3('0x29')](handleError(_0x1565ed,null));};exports[_0xa6e3('0x9d')]=function(_0x547990,_0x57e0e4,_0x7d27c3){var _0x3924be;return db['sequelize'][_0xa6e3('0x9a')](function(_0x56a34e){return db[_0xa6e3('0x3e')]['update'](_0x547990[_0xa6e3('0x5a')],{'where':{'id':_0x547990[_0xa6e3('0x5a')]['id']},'transaction':_0x56a34e})[_0xa6e3('0x32')](function(_0x565e0f){return db[_0xa6e3('0x9b')][_0xa6e3('0x33')]({'where':{'FaxAccountId':_0x547990[_0xa6e3('0x5a')]['id']},'transaction':_0x56a34e})[_0xa6e3('0x32')](function(_0x5f2976){return db[_0xa6e3('0x9b')][_0xa6e3('0x9c')](createExtensionsReciveFax(_[_0xa6e3('0x71')](_0x547990[_0xa6e3('0x5a')],[_0xa6e3('0x9e'),_0xa6e3('0x40'),_0xa6e3('0x9f'),_0xa6e3('0xa0'),'TrunkId',_0xa6e3('0xa1')])),{'transaction':_0x56a34e});});});})[_0xa6e3('0x32')](function(){return db[_0xa6e3('0x3e')][_0xa6e3('0xa2')](_0x547990[_0xa6e3('0x5a')]['id']);})[_0xa6e3('0x32')](respondWithResult(_0x57e0e4,null))[_0xa6e3('0x29')](handleError(_0x57e0e4,null));};exports[_0xa6e3('0xa3')]=function(_0x2806db,_0x5476e0,_0x12b453){var _0x163796={'raw':!![],'where':{}};var _0x5bec73={};var _0x1de6c2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa6e3('0x65')]({'where':{'id':_0x2806db[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x5476e0,null))[_0xa6e3('0x32')](function(_0x3f296e){if(_0x3f296e){_0x5bec73[_0xa6e3('0x41')]=_[_0xa6e3('0x43')](db[_0xa6e3('0xa4')][_0xa6e3('0x67')]);_0x5bec73[_0xa6e3('0x42')]=_[_0xa6e3('0x43')](_0x2806db[_0xa6e3('0x42')]);_0x5bec73['filters']=_[_0xa6e3('0x44')](_0x5bec73[_0xa6e3('0x41')],_0x5bec73[_0xa6e3('0x42')]);_0x163796[_0xa6e3('0x45')]=_[_0xa6e3('0x44')](_0x5bec73[_0xa6e3('0x41')],qs[_0xa6e3('0x46')](_0x2806db[_0xa6e3('0x42')][_0xa6e3('0x46')]));_0x163796['attributes']=_0x163796[_0xa6e3('0x45')][_0xa6e3('0x47')]?_0x163796[_0xa6e3('0x45')]:_0x5bec73['model'];if(!_0x2806db[_0xa6e3('0x42')][_0xa6e3('0x48')](_0xa6e3('0x49'))){_0x163796[_0xa6e3('0x4a')]=qs['limit'](_0x2806db[_0xa6e3('0x42')]['limit']);_0x163796['offset']=qs[_0xa6e3('0x2c')](_0x2806db[_0xa6e3('0x42')]['offset']);}_0x163796['order']=qs['sort'](_0x2806db['query'][_0xa6e3('0x68')]);_0x163796[_0xa6e3('0x4c')]=qs['filters'](_['pick'](_0x2806db[_0xa6e3('0x42')],_0x5bec73[_0xa6e3('0x4d')]));_0x163796[_0xa6e3('0x4c')]['FaxAccountId']=_0x3f296e['id'];if(_0x2806db[_0xa6e3('0x42')][_0xa6e3('0x4f')]){_0x163796[_0xa6e3('0x4c')]=_['merge'](_0x163796[_0xa6e3('0x4c')],{'$or':_['map'](_0x163796['attributes'],function(_0x1c9451){var _0x3625a0={};_0x3625a0[_0x1c9451]={'$like':'%'+_0x2806db[_0xa6e3('0x42')]['filter']+'%'};return _0x3625a0;})});}if(_0x2806db[_0xa6e3('0x42')][_0xa6e3('0xa5')]){var _0x5bea4d=_0x2806db[_0xa6e3('0x42')][_0xa6e3('0xa5')][_0xa6e3('0xa6')](',');var _0x5cb9e1={};_0x5cb9e1[_0x5bea4d[0x0]]={'$gte':moment(_0x5bea4d[0x1])[_0xa6e3('0xa7')](_0xa6e3('0xa8'))};_0x163796[_0xa6e3('0x4c')]=_[_0xa6e3('0x50')](_0x163796[_0xa6e3('0x4c')],_0x5cb9e1);}_0x163796=_[_0xa6e3('0x50')]({},_0x163796,_0x2806db[_0xa6e3('0x51')]);return db[_0xa6e3('0xa4')][_0xa6e3('0x2e')]({'where':_0x163796['where']})[_0xa6e3('0x32')](function(_0x1e78c8){_0x1de6c2[_0xa6e3('0x2e')]=_0x1e78c8;if(_0x2806db[_0xa6e3('0x42')][_0xa6e3('0x52')]){_0x163796[_0xa6e3('0x53')]=[{'all':!![]}];}return db[_0xa6e3('0xa4')][_0xa6e3('0x54')](_0x163796);})[_0xa6e3('0x32')](function(_0x15a59f){_0x1de6c2['rows']=_0x15a59f;return _0x1de6c2;});}})[_0xa6e3('0x32')](respondWithFilteredResult(_0x5476e0,_0x163796))[_0xa6e3('0x29')](handleError(_0x5476e0,null));};exports[_0xa6e3('0x39')]=function(_0x1c360d,_0x1b853b,_0x33c18){var _0x20ac03,_0x17e1fa={},_0x3d9fab;if(_0x1c360d['body']['to']){_0x3d9fab=_0x1c360d['body']['to'][0x0];}return db['FaxAccount'][_0xa6e3('0x58')]({'where':{'id':_0x1c360d[_0xa6e3('0x57')]['id']},'include':[{'model':db[_0xa6e3('0xa9')],'as':_0xa6e3('0xaa'),'include':[{'model':db[_0xa6e3('0x73')],'as':'Contacts','where':{'fax':_0x3d9fab},'limit':0x1,'order':[['updatedAt',_0xa6e3('0xab')]]}]}]})['then'](handleEntityNotFound(_0x1b853b,null))[_0xa6e3('0x32')](function(_0x3c1d83){_0x20ac03=_0x3c1d83;if(_0x1c360d['body'][_0xa6e3('0xac')]&&_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][_0xa6e3('0x47')]){for(var _0x29362a=0x0;_0x29362a<_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][_0xa6e3('0x47')];_0x29362a+=0x1){_0x1c360d[_0xa6e3('0x5a')]['attachments'][_0x29362a]={'filename':_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][_0x29362a][_0xa6e3('0x38')],'id':_0x1c360d['body'][_0xa6e3('0xac')][_0x29362a]['id'],'path':path[_0xa6e3('0xad')](config['root'],_0xa6e3('0xae'),_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][_0x29362a]['basename'])};}}return respondWithRpcPromise(_0xa6e3('0xaf'),_0xa6e3('0xaf'),{'FaxAccountId':_['isNil'](_0x1c360d[_0xa6e3('0x57')]['id'])?undefined:_0x1c360d[_0xa6e3('0x57')]['id'],'path':_['isNil'](_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0][_0xa6e3('0x7')])?undefined:_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0][_0xa6e3('0x7')],'fax':_[_0xa6e3('0xb0')](_0x1c360d['body']['to'][0x0])?undefined:_0x1c360d[_0xa6e3('0x5a')]['to'][0x0]},client9002);})[_0xa6e3('0x32')](function(){if(_0x20ac03){if(_[_0xa6e3('0xb0')](_0x1c360d['body'][_0xa6e3('0xb1')])){_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xb1')]=util[_0xa6e3('0xa7')](_0xa6e3('0xb2'),_0x20ac03[_0xa6e3('0x38')],_0x20ac03[_0xa6e3('0xb3')]);}if(_0x20ac03[_0xa6e3('0xaa')]){if(_0x20ac03[_0xa6e3('0xaa')][_0xa6e3('0xb4')][_0xa6e3('0x47')]){return _0x20ac03['List'][_0xa6e3('0xb4')][0x0];}else{return db[_0xa6e3('0x73')][_0xa6e3('0x59')](_[_0xa6e3('0xb5')](_0x1c360d[_0xa6e3('0x5a')],{'firstName':_0x1c360d[_0xa6e3('0x5a')]['to'][0x0],'phone':_0x1c360d[_0xa6e3('0x5a')]['to'][0x0],'fax':_0x1c360d[_0xa6e3('0x5a')]['to'][0x0],'ListId':_0x20ac03[_0xa6e3('0xa1')]}));}}else{throw new Error(_0xa6e3('0xb6'));}}else{throw new Error(_0xa6e3('0xb7'));}})[_0xa6e3('0x32')](function(_0x131920){if(_0x131920){return db[_0xa6e3('0x70')][_0xa6e3('0x58')]({'where':{'ContactId':_0x131920['id'],'closed':![],'FaxAccountId':_0x20ac03['id']}})[_0xa6e3('0x32')](function(_0x250814){if(_0x250814){return[_0x250814,![]];}return db[_0xa6e3('0x70')]['create']({'UserId':_0x1c360d[_0xa6e3('0x5b')]['id'],'ContactId':_0x131920['id'],'FaxAccountId':_0x20ac03['id'],'fax':_0x1c360d[_0xa6e3('0x5a')]['to'][0x0],'firstMsgDirection':_0xa6e3('0xb8'),'Messages':[_['merge'](_0x1c360d[_0xa6e3('0x5a')],{'read':![],'body':_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0][_0xa6e3('0xb9')],'FaxAccountId':_0x20ac03['id'],'UserId':_0x1c360d[_0xa6e3('0x5b')]['id'],'ContactId':_0x131920['id'],'AttachmentId':_0x1c360d[_0xa6e3('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xa6e3('0xa4')],'as':_0xa6e3('0xba')}]})[_0xa6e3('0x32')](function(_0x25ecca){return[_0x25ecca,!![]];});});}else{throw new Error(_0xa6e3('0xbb'));}})['spread'](function(_0x24d32f,_0x3c7925){if(_0x3c7925){return _0x24d32f;}return db[_0xa6e3('0xa4')][_0xa6e3('0x59')]({'direction':_0xa6e3('0xb8'),'read':![],'body':_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0][_0xa6e3('0xb9')],'FaxAccountId':_0x20ac03['id'],'FaxInteractionId':_0x24d32f['id'],'UserId':_0x1c360d['user']['id'],'ContactId':_0x24d32f[_0xa6e3('0xbc')],'AttachmentId':_0x1c360d[_0xa6e3('0x5a')]['attachments'][0x0]['id']})[_0xa6e3('0x32')](function(_0x191acf){_0x24d32f['dataValues'][_0xa6e3('0xba')]=[];_0x24d32f[_0xa6e3('0xbd')][_0xa6e3('0xba')][_0xa6e3('0x8d')](_0x191acf[_0xa6e3('0xbd')]);return _0x24d32f;});})[_0xa6e3('0x32')](function(_0x46b248){respondWithRpcPromise(_0xa6e3('0xbe'),_0xa6e3('0xbe'),{'FaxAccountId':_[_0xa6e3('0xb0')](_0x1c360d[_0xa6e3('0x57')]['id'])?undefined:_0x1c360d[_0xa6e3('0x57')]['id'],'path':_['isNil'](_0x1c360d[_0xa6e3('0x5a')]['attachments'][0x0][_0xa6e3('0x7')])?undefined:_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0][_0xa6e3('0x7')],'fax':_['isNil'](_0x1c360d[_0xa6e3('0x5a')]['to'][0x0])?undefined:_0x1c360d['body']['to'][0x0],'AttachmentId':_0x1c360d[_0xa6e3('0x5a')][_0xa6e3('0xac')][0x0]['id']},client9002)[_0xa6e3('0x32')](function(_0x155e71){logger['info']('SendFaxRpc,\x20%s',_0x155e71);})[_0xa6e3('0x29')](function(_0x132152){logger[_0xa6e3('0x27')]('SendFaxRpc,\x20%s',_0x132152);});return _0x46b248;})[_0xa6e3('0x32')](respondWithResult(_0x1b853b,null))[_0xa6e3('0x29')](handleError(_0x1b853b,null));};exports[_0xa6e3('0xbf')]=function(_0x417738,_0x5417c1,_0x4c2adf){return db['FaxAccount']['find']({'where':{'id':_0x417738[_0xa6e3('0x57')]['id']}})['then'](handleEntityNotFound(_0x5417c1,null))[_0xa6e3('0x32')](function(_0x3df303){if(_0x3df303){return _0x3df303[_0xa6e3('0xbf')](_0x417738[_0xa6e3('0x5a')][_0xa6e3('0x6a')],_[_0xa6e3('0x71')](_0x417738[_0xa6e3('0x5a')],['ids','id'])||{})[_0xa6e3('0xc0')](function(_0x374fc1){for(var _0x314a91=0x0;_0x314a91<_0x417738[_0xa6e3('0x5a')][_0xa6e3('0x6a')]['length'];_0x314a91+=0x1){socket[_0xa6e3('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x417738[_0xa6e3('0x5a')][_0xa6e3('0x6a')][_0x314a91]),'FaxAccountId':Number(_0x417738['params']['id'])});}return _0x374fc1;});}})[_0xa6e3('0x32')](respondWithResult(_0x5417c1,null))[_0xa6e3('0x29')](handleError(_0x5417c1,null));};exports[_0xa6e3('0xc2')]=function(_0x5e98e2,_0x3b913d,_0x35d3f3){return db[_0xa6e3('0x3e')]['find']({'where':{'id':_0x5e98e2[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x3b913d,null))['then'](function(_0x34c015){if(_0x34c015){return _0x34c015['removeAgents'](_0x5e98e2[_0xa6e3('0x42')][_0xa6e3('0x6a')])['then'](function(){if(_[_0xa6e3('0xc3')](_0x5e98e2[_0xa6e3('0x42')]['ids'])){for(var _0x1a5636=0x0;_0x1a5636<_0x5e98e2[_0xa6e3('0x42')][_0xa6e3('0x6a')][_0xa6e3('0x47')];_0x1a5636+=0x1){socket[_0xa6e3('0xc1')](_0xa6e3('0xc4'),{'UserId':Number(_0x5e98e2[_0xa6e3('0x42')]['ids'][_0x1a5636]),'FaxAccountId':Number(_0x5e98e2[_0xa6e3('0x57')]['id'])});}}else{socket[_0xa6e3('0xc1')](_0xa6e3('0xc4'),{'UserId':Number(_0x5e98e2[_0xa6e3('0x42')][_0xa6e3('0x6a')]),'FaxAccountId':Number(_0x5e98e2[_0xa6e3('0x57')]['id'])});}});}})[_0xa6e3('0x32')](respondWithStatusCode(_0x3b913d,null))[_0xa6e3('0x29')](handleError(_0x3b913d,null));};exports[_0xa6e3('0xc5')]=function(_0x4d9d23,_0x55642c,_0x4c347c){var _0x555748={};var _0x54d208={};var _0x4bb2f3;var _0x563efd;return db['FaxAccount'][_0xa6e3('0x65')]({'where':{'id':_0x4d9d23[_0xa6e3('0x57')]['id']}})[_0xa6e3('0x32')](handleEntityNotFound(_0x55642c,null))['then'](function(_0x283024){if(_0x283024){_0x4bb2f3=_0x283024;_0x54d208[_0xa6e3('0x41')]=_[_0xa6e3('0x43')](db['User'][_0xa6e3('0x67')]);_0x54d208[_0xa6e3('0x42')]=_[_0xa6e3('0x43')](_0x4d9d23[_0xa6e3('0x42')]);_0x54d208[_0xa6e3('0x4d')]=_['intersection'](_0x54d208[_0xa6e3('0x41')],_0x54d208[_0xa6e3('0x42')]);_0x555748[_0xa6e3('0x45')]=_['intersection'](_0x54d208['model'],qs[_0xa6e3('0x46')](_0x4d9d23['query'][_0xa6e3('0x46')]));_0x555748[_0xa6e3('0x45')]=_0x555748['attributes'][_0xa6e3('0x47')]?_0x555748[_0xa6e3('0x45')]:_0x54d208[_0xa6e3('0x41')];_0x555748['order']=qs[_0xa6e3('0x68')](_0x4d9d23[_0xa6e3('0x42')]['sort']);_0x555748[_0xa6e3('0x4c')]=qs[_0xa6e3('0x4d')](_['pick'](_0x4d9d23[_0xa6e3('0x42')],_0x54d208[_0xa6e3('0x4d')]));if(_0x4d9d23[_0xa6e3('0x42')]['filter']){_0x555748[_0xa6e3('0x4c')]=_[_0xa6e3('0x50')](_0x555748[_0xa6e3('0x4c')],{'$or':_[_0xa6e3('0x3d')](_0x555748[_0xa6e3('0x45')],function(_0x988230){var _0x344668={};_0x344668[_0x988230]={'$like':'%'+_0x4d9d23[_0xa6e3('0x42')][_0xa6e3('0x4f')]+'%'};return _0x344668;})});}_0x555748=_[_0xa6e3('0x50')]({},_0x555748,_0x4d9d23['options']);return _0x4bb2f3[_0xa6e3('0xc5')](_0x555748);}})[_0xa6e3('0x32')](function(_0x3ebdc2){if(_0x3ebdc2){_0x563efd=_0x3ebdc2['length'];if(!_0x4d9d23['query'][_0xa6e3('0x48')]('nolimit')){_0x555748[_0xa6e3('0x4a')]=qs[_0xa6e3('0x4a')](_0x4d9d23[_0xa6e3('0x42')][_0xa6e3('0x4a')]);_0x555748[_0xa6e3('0x2c')]=qs['offset'](_0x4d9d23[_0xa6e3('0x42')][_0xa6e3('0x2c')]);}return _0x4bb2f3[_0xa6e3('0xc5')](_0x555748);}})[_0xa6e3('0x32')](function(_0x83e598){if(_0x83e598){return _0x83e598?{'count':_0x563efd,'rows':_0x83e598}:null;}})[_0xa6e3('0x32')](respondWithResult(_0x55642c,null))['catch'](handleError(_0x55642c,null));}; \ No newline at end of file +var _0x2005=['merge','options','rows','catch','rawAttributes','includeAll','include','create','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','addInteraction','FaxInteraction','omit','getInteractions','User','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','Fax\x20Extension','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','maxrate','minrate','modem','t38timeout','push','Wait','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','bulkCreate','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x5ca8c0,_0x20b3f0){var _0x18e7d1=function(_0x17a6c8){while(--_0x17a6c8){_0x5ca8c0['push'](_0x5ca8c0['shift']());}};_0x18e7d1(++_0x20b3f0);}(_0x2005,0x70));var _0x5200=function(_0x3e79a7,_0x5c6fa7){_0x3e79a7=_0x3e79a7-0x0;var _0x11d050=_0x2005[_0x3e79a7];return _0x11d050;};'use strict';var emlformat=require(_0x5200('0x0'));var rimraf=require(_0x5200('0x1'));var zipdir=require(_0x5200('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5200('0x3'));var sox=require(_0x5200('0x4'));var csv=require(_0x5200('0x5'));var ejs=require(_0x5200('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5200('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5200('0x8'));var toCsv=require(_0x5200('0x5'));var querystring=require(_0x5200('0x9'));var Papa=require(_0x5200('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5200('0xb'));var as=require(_0x5200('0xc'));var hardwareService=require(_0x5200('0xd'));var logger=require(_0x5200('0xe'))(_0x5200('0xf'));var utils=require('../../config/utils');var config=require(_0x5200('0x10'));var licenseUtil=require(_0x5200('0x11'));var db=require(_0x5200('0x12'))['db'];config[_0x5200('0x13')]=_[_0x5200('0x14')](config[_0x5200('0x13')],{'host':_0x5200('0x15'),'port':0x18eb});var socket=require(_0x5200('0x16'))(new Redis(config[_0x5200('0x13')]));require(_0x5200('0x17'))[_0x5200('0x18')](socket);var jayson=require(_0x5200('0x19'));var client=jayson[_0x5200('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x5200('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5594,_0x9cfe5f,_0x1ae55f,_0x402160){return new BPromise(function(_0x59e788,_0xc35db5){var _0x2412f6=_0x402160||client;return _0x2412f6['request'](_0x1a5594,_0x1ae55f)[_0x5200('0x1b')](function(_0x6882b7){logger[_0x5200('0x1c')](_0x5200('0x1d'),_0x9cfe5f,'request\x20sent');logger[_0x5200('0x1e')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x9cfe5f,_0x5200('0x1f'),JSON[_0x5200('0x20')](_0x6882b7));if(_0x6882b7['error']){if(_0x6882b7[_0x5200('0x21')][_0x5200('0x22')]===0x1f4){logger[_0x5200('0x21')](_0x5200('0x1d'),_0x9cfe5f,_0x6882b7[_0x5200('0x21')]['message']);return _0xc35db5(_0x6882b7['error'][_0x5200('0x23')]);}logger[_0x5200('0x21')](_0x5200('0x1d'),_0x9cfe5f,_0x6882b7[_0x5200('0x21')][_0x5200('0x23')]);return _0x59e788(_0x6882b7[_0x5200('0x21')][_0x5200('0x23')]);}else{logger[_0x5200('0x1c')]('FaxAccount,\x20%s,\x20%s',_0x9cfe5f,_0x5200('0x1f'));_0x59e788(_0x6882b7[_0x5200('0x24')]['message']);}})['catch'](function(_0x49e85a){logger['error'](_0x5200('0x1d'),_0x9cfe5f,_0x49e85a);_0xc35db5(_0x49e85a);});});}function respondWithStatusCode(_0x3b1482,_0x3f2e0b){_0x3f2e0b=_0x3f2e0b||0xcc;return function(_0x160bf3){if(_0x160bf3){return _0x3b1482[_0x5200('0x25')](_0x3f2e0b);}return _0x3b1482[_0x5200('0x26')](_0x3f2e0b)[_0x5200('0x27')]();};}function respondWithResult(_0x59d2c3,_0x30aef8){_0x30aef8=_0x30aef8||0xc8;return function(_0x4f6126){if(_0x4f6126){return _0x59d2c3[_0x5200('0x26')](_0x30aef8)[_0x5200('0x28')](_0x4f6126);}};}function respondWithFilteredResult(_0x30f1f3,_0x3618e6){return function(_0x4eb0ed){if(_0x4eb0ed){var _0x49e31a=typeof _0x3618e6[_0x5200('0x29')]===_0x5200('0x2a')&&typeof _0x3618e6[_0x5200('0x2b')]===_0x5200('0x2a');var _0x1b5b0a=_0x4eb0ed[_0x5200('0x2c')];var _0x3e3b23=_0x49e31a?0x0:_0x3618e6['offset'];var _0x4dd85f=_0x49e31a?_0x4eb0ed['count']:_0x3618e6[_0x5200('0x29')]+_0x3618e6[_0x5200('0x2b')];var _0x5bff43;if(_0x4dd85f>=_0x1b5b0a){_0x4dd85f=_0x1b5b0a;_0x5bff43=0xc8;}else{_0x5bff43=0xce;}_0x30f1f3[_0x5200('0x26')](_0x5bff43);return _0x30f1f3[_0x5200('0x2d')](_0x5200('0x2e'),_0x3e3b23+'-'+_0x4dd85f+'/'+_0x1b5b0a)[_0x5200('0x28')](_0x4eb0ed);}return null;};}function patchUpdates(_0x290548){return function(_0x42f978){try{jsonpatch['apply'](_0x42f978,_0x290548,!![]);}catch(_0x5b005b){return BPromise['reject'](_0x5b005b);}return _0x42f978[_0x5200('0x2f')]();};}function saveUpdates(_0x423940,_0x348728){return function(_0x207d2b){if(_0x207d2b){return _0x207d2b[_0x5200('0x30')](_0x423940)[_0x5200('0x1b')](function(_0x2662d2){return _0x2662d2;});}return null;};}function removeEntity(_0x285705,_0x515b11){return function(_0x2190cb){if(_0x2190cb){return _0x2190cb[_0x5200('0x31')]()[_0x5200('0x1b')](function(){var _0x5c14be=_0x2190cb['get']({'plain':!![]});var _0x268837=_0x5200('0x32');return db[_0x5200('0x33')][_0x5200('0x31')]({'where':{'type':_0x268837,'resourceId':_0x5c14be['id']}})['then'](function(){return _0x2190cb;});})[_0x5200('0x1b')](function(){_0x285705[_0x5200('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507efd,_0x5dc311){return function(_0x4f9d73){if(!_0x4f9d73){_0x507efd[_0x5200('0x25')](0x194);}return _0x4f9d73;};}function handleError(_0xb34711,_0x26a0dc){_0x26a0dc=_0x26a0dc||0x1f4;return function(_0x4fbe5d){logger[_0x5200('0x21')](_0x4fbe5d[_0x5200('0x34')]);if(_0x4fbe5d[_0x5200('0x35')]){delete _0x4fbe5d['name'];}_0xb34711[_0x5200('0x26')](_0x26a0dc)[_0x5200('0x36')](_0x4fbe5d);};}exports[_0x5200('0x37')]=function(_0x1c365a,_0x577a07){var _0x5cb4c8={'include':[{'model':db[_0x5200('0x38')],'as':_0x5200('0x39')}]},_0x1d1c72={},_0x4fbb54={'count':0x0,'rows':[]};var _0x222bc8=_[_0x5200('0x3a')](db[_0x5200('0x3b')]['rawAttributes'],function(_0x50f40e){return{'name':_0x50f40e[_0x5200('0x3c')],'type':_0x50f40e['type'][_0x5200('0x3d')]};});_0x1d1c72[_0x5200('0x3e')]=_[_0x5200('0x3a')](_0x222bc8,_0x5200('0x35'));_0x1d1c72[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x1c365a[_0x5200('0x3f')]);_0x1d1c72[_0x5200('0x41')]=_[_0x5200('0x42')](_0x1d1c72['model'],_0x1d1c72[_0x5200('0x3f')]);_0x5cb4c8[_0x5200('0x43')]=_['intersection'](_0x1d1c72[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x1c365a[_0x5200('0x3f')]['fields']));_0x5cb4c8[_0x5200('0x43')]=_0x5cb4c8[_0x5200('0x43')][_0x5200('0x45')]?_0x5cb4c8[_0x5200('0x43')]:_0x1d1c72[_0x5200('0x3e')];if(!_0x1c365a[_0x5200('0x3f')][_0x5200('0x46')]('nolimit')){_0x5cb4c8['limit']=qs[_0x5200('0x2b')](_0x1c365a[_0x5200('0x3f')][_0x5200('0x2b')]);_0x5cb4c8[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x1c365a[_0x5200('0x3f')][_0x5200('0x29')]);}_0x5cb4c8[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x1c365a['query']['sort']);_0x5cb4c8[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x1c365a[_0x5200('0x3f')],_0x1d1c72[_0x5200('0x41')]),_0x222bc8);if(_0x1c365a[_0x5200('0x3f')][_0x5200('0x4b')]){_0x5cb4c8[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x5cb4c8[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x222bc8,function(_0x29fee8){if(_0x29fee8['type']!=='VIRTUAL'){var _0x3194c1={};_0x3194c1[_0x29fee8[_0x5200('0x35')]]={'$like':'%'+_0x1c365a[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x3194c1;}})});}_0x5cb4c8=_['merge']({},_0x5cb4c8,_0x1c365a[_0x5200('0x4d')]);var _0x86d57f={'where':_0x5cb4c8['where']};return db[_0x5200('0x3b')][_0x5200('0x2c')](_0x86d57f)[_0x5200('0x1b')](function(_0x2b8322){_0x4fbb54[_0x5200('0x2c')]=_0x2b8322;if(_0x1c365a[_0x5200('0x3f')]['includeAll']){_0x5cb4c8['include']=[{'all':!![]}];}return db[_0x5200('0x3b')]['findAll'](_0x5cb4c8);})[_0x5200('0x1b')](function(_0x528e18){_0x4fbb54[_0x5200('0x4e')]=_0x528e18;return _0x4fbb54;})[_0x5200('0x1b')](respondWithFilteredResult(_0x577a07,_0x5cb4c8))[_0x5200('0x4f')](handleError(_0x577a07,null));};exports['show']=function(_0x3d96e6,_0x164da4){var _0x3bac05={'raw':![],'where':{'id':_0x3d96e6['params']['id']},'include':[{'model':db['Pause'],'as':_0x5200('0x39')}]},_0x5af0a2={};_0x5af0a2['model']=_[_0x5200('0x40')](db['FaxAccount'][_0x5200('0x50')]);_0x5af0a2['query']=_[_0x5200('0x40')](_0x3d96e6['query']);_0x5af0a2[_0x5200('0x41')]=_[_0x5200('0x42')](_0x5af0a2[_0x5200('0x3e')],_0x5af0a2[_0x5200('0x3f')]);_0x3bac05[_0x5200('0x43')]=_['intersection'](_0x5af0a2[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x3d96e6['query'][_0x5200('0x44')]));_0x3bac05['attributes']=_0x3bac05[_0x5200('0x43')]['length']?_0x3bac05[_0x5200('0x43')]:_0x5af0a2[_0x5200('0x3e')];if(_0x3d96e6['query'][_0x5200('0x51')]){_0x3bac05[_0x5200('0x52')]=[{'all':!![]}];}_0x3bac05=_[_0x5200('0x4c')]({},_0x3bac05,_0x3d96e6[_0x5200('0x4d')]);return db[_0x5200('0x3b')]['find'](_0x3bac05)[_0x5200('0x1b')](handleEntityNotFound(_0x164da4,null))['then'](respondWithResult(_0x164da4,null))['catch'](handleError(_0x164da4,null));};exports[_0x5200('0x53')]=function(_0x23a6a8,_0x45818d){return db[_0x5200('0x3b')][_0x5200('0x53')](_0x23a6a8[_0x5200('0x54')],{})[_0x5200('0x1b')](function(_0x3020be){var _0xa9e2d5=_0x23a6a8[_0x5200('0x55')][_0x5200('0x56')]({'plain':!![]});if(!_0xa9e2d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa9e2d5[_0x5200('0x57')]===_0x5200('0x55')){var _0x2b5611=_0x3020be[_0x5200('0x56')]({'plain':!![]});var _0x61fdb0=_0x5200('0x32');return db[_0x5200('0x58')][_0x5200('0x59')]({'where':{'name':_0x61fdb0,'userProfileId':_0xa9e2d5['userProfileId']},'raw':!![]})['then'](function(_0x55397d){if(_0x55397d&&_0x55397d[_0x5200('0x5a')]===0x0){return db['UserProfileResource'][_0x5200('0x53')]({'name':_0x2b5611['name'],'resourceId':_0x2b5611['id'],'type':_0x55397d[_0x5200('0x35')],'sectionId':_0x55397d['id']},{})[_0x5200('0x1b')](function(){return _0x3020be;});}else{return _0x3020be;}})['catch'](function(_0xd87ed5){logger[_0x5200('0x21')](_0x5200('0x5b'),_0xd87ed5);throw _0xd87ed5;});}return _0x3020be;})['then'](respondWithResult(_0x45818d,0xc9))[_0x5200('0x4f')](handleError(_0x45818d,null));};exports[_0x5200('0x30')]=function(_0x37b12d,_0x2e8027){if(_0x37b12d['body']['id']){delete _0x37b12d['body']['id'];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x37b12d[_0x5200('0x5c')]['id']},'include':[{'model':db[_0x5200('0x38')],'as':'mandatoryDispositionPause'}]})[_0x5200('0x1b')](handleEntityNotFound(_0x2e8027,null))[_0x5200('0x1b')](saveUpdates(_0x37b12d['body'],null))[_0x5200('0x1b')](respondWithResult(_0x2e8027,null))[_0x5200('0x4f')](handleError(_0x2e8027,null));};exports[_0x5200('0x31')]=function(_0xee479,_0x50a728){return db[_0x5200('0x3b')]['find']({'where':{'id':_0xee479[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x50a728,null))[_0x5200('0x1b')](removeEntity(_0x50a728,null))[_0x5200('0x4f')](handleError(_0x50a728,null));};exports[_0x5200('0x5d')]=function(_0x41aeba,_0x5789b1){return db[_0x5200('0x3b')][_0x5200('0x5d')]()[_0x5200('0x1b')](respondWithResult(_0x5789b1,null))[_0x5200('0x4f')](handleError(_0x5789b1,null));};exports[_0x5200('0x5e')]=function(_0x58cb7e,_0x3b957d,_0x5e30c9){if(_0x58cb7e[_0x5200('0x54')]['id']){delete _0x58cb7e['body']['id'];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x58cb7e['params']['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x3b957d,null))[_0x5200('0x1b')](function(_0x5af735){if(_0x5af735){_0x58cb7e[_0x5200('0x54')][_0x5200('0x5f')]=_0x5af735['id'];return db[_0x5200('0x60')]['create'](_0x58cb7e[_0x5200('0x54')]);}})['then'](respondWithResult(_0x3b957d,null))['catch'](handleError(_0x3b957d,null));};exports[_0x5200('0x61')]=function(_0x2622aa,_0x4605f4,_0x263470){var _0x392f7d={'raw':![],'where':{}};var _0x263c32={};var _0x381e52={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x2622aa[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x4605f4,null))[_0x5200('0x1b')](function(_0xab3862){if(_0xab3862){_0x263c32[_0x5200('0x3e')]=_[_0x5200('0x40')](db[_0x5200('0x60')][_0x5200('0x50')]);_0x263c32[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x2622aa['query']);_0x263c32[_0x5200('0x41')]=_['intersection'](_0x263c32[_0x5200('0x3e')],_0x263c32[_0x5200('0x3f')]);_0x392f7d[_0x5200('0x43')]=_[_0x5200('0x42')](_0x263c32[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x2622aa[_0x5200('0x3f')][_0x5200('0x44')]));_0x392f7d[_0x5200('0x43')]=_0x392f7d[_0x5200('0x43')][_0x5200('0x45')]?_0x392f7d['attributes']:_0x263c32[_0x5200('0x3e')];if(!_0x2622aa['query']['hasOwnProperty']('nolimit')){_0x392f7d[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x2622aa['query'][_0x5200('0x2b')]);_0x392f7d[_0x5200('0x29')]=qs['offset'](_0x2622aa['query'][_0x5200('0x29')]);}_0x392f7d['order']=qs[_0x5200('0x48')](_0x2622aa['query'][_0x5200('0x48')]);_0x392f7d['where']=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x2622aa['query'],_0x263c32[_0x5200('0x41')]));_0x392f7d[_0x5200('0x49')][_0x5200('0x5f')]=_0xab3862['id'];if(_0x2622aa[_0x5200('0x3f')][_0x5200('0x4b')]){_0x392f7d[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x392f7d[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x392f7d[_0x5200('0x43')],function(_0x68451e){var _0x1c77d2={};_0x1c77d2[_0x68451e]={'$like':'%'+_0x2622aa[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x1c77d2;})});}_0x392f7d=_[_0x5200('0x4c')]({},_0x392f7d,_0x2622aa[_0x5200('0x4d')]);return db[_0x5200('0x60')][_0x5200('0x2c')]({'where':_0x392f7d[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0xeb865a){_0x381e52[_0x5200('0x2c')]=_0xeb865a;if(_0x2622aa[_0x5200('0x3f')]['includeAll']){_0x392f7d[_0x5200('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x5200('0x63')](_0x392f7d);})[_0x5200('0x1b')](function(_0xeafdb1){_0x381e52[_0x5200('0x4e')]=_0xeafdb1;return _0x381e52;});}})['then'](respondWithFilteredResult(_0x4605f4,_0x392f7d))['catch'](handleError(_0x4605f4,null));};exports[_0x5200('0x64')]=function(_0x291af1,_0x4941f8,_0x26441b){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x291af1[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x4941f8,null))[_0x5200('0x1b')](function(_0x267082){if(_0x267082){return _0x267082['removeDispositions'](_0x291af1['query'][_0x5200('0x65')]);}})[_0x5200('0x1b')](respondWithStatusCode(_0x4941f8,null))[_0x5200('0x4f')](handleError(_0x4941f8,null));};exports[_0x5200('0x66')]=function(_0x589e98,_0x580350,_0x5e7562){if(_0x589e98[_0x5200('0x54')]['id']){delete _0x589e98[_0x5200('0x54')]['id'];}return db[_0x5200('0x3b')]['find']({'where':{'id':_0x589e98[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x580350,null))[_0x5200('0x1b')](function(_0x33fdc3){if(_0x33fdc3){_0x589e98['body']['FaxAccountId']=_0x33fdc3['id'];return db[_0x5200('0x67')][_0x5200('0x53')](_0x589e98[_0x5200('0x54')]);}})[_0x5200('0x1b')](respondWithResult(_0x580350,null))[_0x5200('0x4f')](handleError(_0x580350,null));};exports[_0x5200('0x68')]=function(_0x26d9d8,_0x43791f,_0x39268d){var _0x186c87={'raw':![],'where':{}};var _0x1e159c={};var _0x25c25c={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x26d9d8[_0x5200('0x5c')]['id']}})['then'](handleEntityNotFound(_0x43791f,null))[_0x5200('0x1b')](function(_0x1dbd61){if(_0x1dbd61){_0x1e159c['model']=_[_0x5200('0x40')](db[_0x5200('0x67')]['rawAttributes']);_0x1e159c[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x26d9d8[_0x5200('0x3f')]);_0x1e159c['filters']=_[_0x5200('0x42')](_0x1e159c[_0x5200('0x3e')],_0x1e159c['query']);_0x186c87[_0x5200('0x43')]=_['intersection'](_0x1e159c[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x26d9d8['query'][_0x5200('0x44')]));_0x186c87['attributes']=_0x186c87[_0x5200('0x43')][_0x5200('0x45')]?_0x186c87['attributes']:_0x1e159c[_0x5200('0x3e')];if(!_0x26d9d8[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x186c87['limit']=qs['limit'](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x2b')]);_0x186c87[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x29')]);}_0x186c87[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x26d9d8[_0x5200('0x3f')][_0x5200('0x48')]);_0x186c87[_0x5200('0x49')]=qs[_0x5200('0x41')](_['pick'](_0x26d9d8[_0x5200('0x3f')],_0x1e159c[_0x5200('0x41')]));_0x186c87['where'][_0x5200('0x5f')]=_0x1dbd61['id'];if(_0x26d9d8[_0x5200('0x3f')][_0x5200('0x4b')]){_0x186c87[_0x5200('0x49')]=_['merge'](_0x186c87['where'],{'$or':_['map'](_0x186c87[_0x5200('0x43')],function(_0x1379b6){var _0x168ae4={};_0x168ae4[_0x1379b6]={'$like':'%'+_0x26d9d8[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x168ae4;})});}_0x186c87=_[_0x5200('0x4c')]({},_0x186c87,_0x26d9d8[_0x5200('0x4d')]);return db[_0x5200('0x67')][_0x5200('0x2c')]({'where':_0x186c87[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0xe60032){_0x25c25c[_0x5200('0x2c')]=_0xe60032;if(_0x26d9d8[_0x5200('0x3f')][_0x5200('0x51')]){_0x186c87[_0x5200('0x52')]=[{'all':!![]}];}return db[_0x5200('0x67')]['findAll'](_0x186c87);})[_0x5200('0x1b')](function(_0x31c7b5){_0x25c25c[_0x5200('0x4e')]=_0x31c7b5;return _0x25c25c;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x43791f,_0x186c87))['catch'](handleError(_0x43791f,null));};exports['removeAnswers']=function(_0x5792ec,_0x212fed,_0x1b0713){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x5792ec[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x212fed,null))[_0x5200('0x1b')](function(_0x772917){if(_0x772917){return _0x772917['removeAnswers'](_0x5792ec[_0x5200('0x3f')][_0x5200('0x65')]);}})[_0x5200('0x1b')](respondWithStatusCode(_0x212fed,null))[_0x5200('0x4f')](handleError(_0x212fed,null));};exports[_0x5200('0x6a')]=function(_0x599b44,_0x3165a5,_0x2eb64e){return db[_0x5200('0x6b')][_0x5200('0x59')]({'where':{'id':_0x599b44[_0x5200('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3165a5,null))[_0x5200('0x1b')](function(_0x48c93a){if(_0x48c93a){return _0x48c93a[_0x5200('0x6a')](_0x599b44['body']['ids'],_[_0x5200('0x6c')](_0x599b44[_0x5200('0x54')],['ids','id'])||{});}})[_0x5200('0x1b')](respondWithResult(_0x3165a5,null))[_0x5200('0x4f')](handleError(_0x3165a5,null));};exports[_0x5200('0x6d')]=function(_0x54a252,_0x16f994,_0x5a0599){var _0x18cc87={'raw':![],'where':{}};var _0x52861b={};var _0xcc6953={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x54a252[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x16f994,null))['then'](function(_0x24bfe0){if(_0x24bfe0){_0x52861b['model']=_[_0x5200('0x40')](db[_0x5200('0x6b')][_0x5200('0x50')]);_0x52861b[_0x5200('0x3f')]=_[_0x5200('0x40')](_0x54a252[_0x5200('0x3f')]);_0x52861b[_0x5200('0x41')]=_[_0x5200('0x42')](_0x52861b[_0x5200('0x3e')],_0x52861b[_0x5200('0x3f')]);_0x18cc87[_0x5200('0x43')]=_[_0x5200('0x42')](_0x52861b[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x54a252[_0x5200('0x3f')][_0x5200('0x44')]));_0x18cc87[_0x5200('0x43')]=_0x18cc87[_0x5200('0x43')]['length']?_0x18cc87['attributes']:_0x52861b['model'];if(!_0x54a252[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x18cc87[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x54a252[_0x5200('0x3f')][_0x5200('0x2b')]);_0x18cc87[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x54a252[_0x5200('0x3f')][_0x5200('0x29')]);}_0x18cc87[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x54a252['query']['sort']);_0x18cc87[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x54a252[_0x5200('0x3f')],_0x52861b['filters']));_0x18cc87[_0x5200('0x49')][_0x5200('0x5f')]=_0x24bfe0['id'];if(_0x54a252[_0x5200('0x3f')]['filter']){_0x18cc87['where']=_[_0x5200('0x4c')](_0x18cc87[_0x5200('0x49')],{'$or':_[_0x5200('0x3a')](_0x18cc87[_0x5200('0x43')],function(_0x19bde1){var _0x13b010={};_0x13b010[_0x19bde1]={'$like':'%'+_0x54a252[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x13b010;})});}_0x18cc87=_[_0x5200('0x4c')]({},_0x18cc87,_0x54a252[_0x5200('0x4d')]);return db[_0x5200('0x6b')][_0x5200('0x2c')]({'where':_0x18cc87[_0x5200('0x49')]})['then'](function(_0x466e7c){_0xcc6953[_0x5200('0x2c')]=_0x466e7c;if(_0x54a252['query'][_0x5200('0x51')]){_0x18cc87[_0x5200('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5200('0x6e')],'as':_0x5200('0x6f'),'attributes':[_0x5200('0x35'),'fullname',_0x5200('0x70')],'required':![]},{'model':db[_0x5200('0x71')],'as':_0x5200('0x72'),'attributes':['id',_0x5200('0x35'),_0x5200('0x73')],'where':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]?{'id':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]}:undefined,'required':_0x54a252[_0x5200('0x3f')][_0x5200('0x74')]?!![]:![]}];}return db[_0x5200('0x6b')]['findAll'](_0x18cc87);})[_0x5200('0x1b')](function(_0xcd5938){_0xcc6953[_0x5200('0x4e')]=_0xcd5938;return _0xcc6953;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x16f994,_0x18cc87))[_0x5200('0x4f')](handleError(_0x16f994,null));};exports[_0x5200('0x75')]=function(_0x71c82e,_0x365eb2){var _0x4e207d=_0x71c82e[_0x5200('0x5c')]['id'];var _0x558ca7=_0x71c82e['body'];var _0x536aeb=0xc8;var _0x133d01=null;return db['sequelize'][_0x5200('0x76')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x5200('0x77')]},function(_0x9626dc){return db['FaxAccount'][_0x5200('0x62')]({'where':{'id':_0x4e207d},'transaction':_0x9626dc})[_0x5200('0x1b')](function(_0x3a864e){if(_0x3a864e){return db['FaxApplication'][_0x5200('0x31')]({'where':{'FaxAccountId':_0x4e207d},'transaction':_0x9626dc})[_0x5200('0x1b')](function(){var _0x37cf7d=_[_0x5200('0x3a')](_0x558ca7,function(_0x335dba){_0x335dba[_0x5200('0x5f')]=_0x4e207d;return _0x335dba;});return db['FaxApplication']['bulkCreate'](_0x37cf7d,{'transaction':_0x9626dc});});}else{_0x536aeb=0x194;_0x133d01=[];}});})[_0x5200('0x1b')](function(){if(_0x536aeb!==0x194){return db[_0x5200('0x78')][_0x5200('0x79')]({'where':{'FaxAccountId':_0x4e207d},'order':_0x5200('0x7a')})[_0x5200('0x1b')](function(_0x3556ec){_0x133d01=_0x3556ec;});}})['catch'](function(_0x46520e){_0x536aeb=0x1f4;logger[_0x5200('0x21')](_0x46520e[_0x5200('0x34')]);if(_0x46520e[_0x5200('0x35')]){delete _0x46520e[_0x5200('0x35')];}_0x133d01=_0x46520e;})[_0x5200('0x7b')](function(){if(_0x133d01===null){_0x365eb2[_0x5200('0x25')](_0x536aeb);}else{if(_0x536aeb===0x1f4){_0x365eb2[_0x5200('0x26')](_0x536aeb)[_0x5200('0x36')](_0x133d01);}else{_0x365eb2[_0x5200('0x26')](_0x536aeb)[_0x5200('0x28')](_0x133d01);}}});};exports[_0x5200('0x7c')]=function(_0x233013,_0x52c4f5,_0x255f36){var _0xf6421f={};var _0x2b36ce={};var _0x177b67;var _0x379429;return db[_0x5200('0x3b')]['findOne']({'where':{'id':_0x233013[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x52c4f5,null))['then'](function(_0x58c5ff){if(_0x58c5ff){_0x177b67=_0x58c5ff;_0x2b36ce[_0x5200('0x3e')]=_['keys'](db[_0x5200('0x78')][_0x5200('0x50')]);_0x2b36ce['query']=_['keys'](_0x233013[_0x5200('0x3f')]);_0x2b36ce[_0x5200('0x41')]=_[_0x5200('0x42')](_0x2b36ce[_0x5200('0x3e')],_0x2b36ce[_0x5200('0x3f')]);_0xf6421f[_0x5200('0x43')]=_[_0x5200('0x42')](_0x2b36ce[_0x5200('0x3e')],qs[_0x5200('0x44')](_0x233013['query'][_0x5200('0x44')]));_0xf6421f[_0x5200('0x43')]=_0xf6421f[_0x5200('0x43')][_0x5200('0x45')]?_0xf6421f[_0x5200('0x43')]:_0x2b36ce['model'];_0xf6421f[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x233013[_0x5200('0x3f')][_0x5200('0x48')]);_0xf6421f[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x233013[_0x5200('0x3f')],_0x2b36ce[_0x5200('0x41')]));if(_0x233013[_0x5200('0x3f')][_0x5200('0x4b')]){_0xf6421f[_0x5200('0x49')]=_[_0x5200('0x4c')](_0xf6421f['where'],{'$or':_[_0x5200('0x3a')](_0xf6421f[_0x5200('0x43')],function(_0x4c0c78){var _0x5c2c98={};_0x5c2c98[_0x4c0c78]={'$like':'%'+_0x233013[_0x5200('0x3f')][_0x5200('0x4b')]+'%'};return _0x5c2c98;})});}_0xf6421f=_[_0x5200('0x4c')]({},_0xf6421f,_0x233013[_0x5200('0x4d')]);return _0x177b67[_0x5200('0x7c')](_0xf6421f);}})[_0x5200('0x1b')](function(_0x3013e3){if(_0x3013e3){_0x379429=_0x3013e3['length'];if(!_0x233013['query']['hasOwnProperty'](_0x5200('0x69'))){_0xf6421f[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x233013[_0x5200('0x3f')]['limit']);_0xf6421f[_0x5200('0x29')]=qs[_0x5200('0x29')](_0x233013[_0x5200('0x3f')][_0x5200('0x29')]);}return _0x177b67['getApplications'](_0xf6421f);}})[_0x5200('0x1b')](function(_0x2597d8){if(_0x2597d8){return _0x2597d8?{'count':_0x379429,'rows':_0x2597d8}:null;}})['then'](respondWithResult(_0x52c4f5,null))[_0x5200('0x4f')](handleError(_0x52c4f5,null));};function Extension(_0x19b632,_0x3668b0,_0x17e239,_0x478e48){this[_0x5200('0x7d')]=_0x5200('0x7e');this[_0x5200('0x7f')]=_0x19b632[_0x5200('0x80')];this[_0x5200('0x81')]=_0x478e48;this[_0x5200('0x82')]=_0x5200('0x83');this['description']=_0x5200('0x84');this[_0x5200('0x5f')]=_0x19b632['id'];this['priority']=_0x3668b0;this['appdata']=_0x17e239;}function createExtensionsReciveFax(_0x382e8d){var _0x386030=0x1;var _0x118419=[];_0x118419['push'](new Extension(_0x382e8d,_0x386030,'',_0x5200('0x85')));_0x386030+=0x1;_0x118419['push'](new Extension(_0x382e8d,_0x386030,_0x5200('0x86'),_0x5200('0x87')));_0x386030+=0x1;for(var _0x4a42d7 in _0x382e8d){if(_0x382e8d[_0x5200('0x46')](_0x4a42d7)&&(_0x4a42d7===_0x5200('0x88')||_0x4a42d7===_0x5200('0x80')||_0x4a42d7===_0x5200('0x89')||_0x4a42d7==='faxdetect'||_0x4a42d7==='headerinfo'||_0x4a42d7===_0x5200('0x8a')||_0x4a42d7===_0x5200('0x8b')||_0x4a42d7===_0x5200('0x8c')||_0x4a42d7===_0x5200('0x8d'))){_0x118419['push'](new Extension(_0x382e8d,_0x386030,'FAXOPT('+_0x4a42d7+')='+_0x382e8d[_0x4a42d7],_0x5200('0x87')));_0x386030+=0x1;}}_0x118419[_0x5200('0x8e')](new Extension(_0x382e8d,_0x386030,'6',_0x5200('0x8f')));_0x386030+=0x1;_0x118419[_0x5200('0x8e')](new Extension(_0x382e8d,_0x386030,'/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',_0x5200('0x90')));_0x386030=0x0;return _0x118419;}exports[_0x5200('0x91')]=function(_0x200281,_0x366d56,_0x2aa12c){var _0x3bc036;return db[_0x5200('0x92')][_0x5200('0x76')](function(_0x352cad){return db[_0x5200('0x3b')]['create'](_0x200281[_0x5200('0x54')],{'transaction':_0x352cad})[_0x5200('0x1b')](function(_0x7f2564){_0x3bc036=_0x7f2564[_0x5200('0x56')]({'plain':!![]});return db[_0x5200('0x93')][_0x5200('0x94')](createExtensionsReciveFax(_0x3bc036),{'transaction':_0x352cad});});})['then'](function(){return _0x3bc036;})[_0x5200('0x1b')](respondWithResult(_0x366d56,null))[_0x5200('0x4f')](handleError(_0x366d56,null));};exports['updateAccountApplications']=function(_0x11b73c,_0x5b9685,_0x22e54e){var _0x40532c;return db[_0x5200('0x92')][_0x5200('0x76')](function(_0x404ca5){return db[_0x5200('0x3b')][_0x5200('0x30')](_0x11b73c[_0x5200('0x54')],{'where':{'id':_0x11b73c[_0x5200('0x54')]['id']},'transaction':_0x404ca5})[_0x5200('0x1b')](function(_0x4c52d6){return db[_0x5200('0x93')]['destroy']({'where':{'FaxAccountId':_0x11b73c['body']['id']},'transaction':_0x404ca5})['then'](function(_0x321ab2){return db[_0x5200('0x93')][_0x5200('0x94')](createExtensionsReciveFax(_[_0x5200('0x6c')](_0x11b73c[_0x5200('0x54')],['tech',_0x5200('0x3d'),_0x5200('0x95'),_0x5200('0x96'),_0x5200('0x97'),'ListId'])),{'transaction':_0x404ca5});});});})['then'](function(){return db[_0x5200('0x3b')]['findById'](_0x11b73c['body']['id']);})[_0x5200('0x1b')](respondWithResult(_0x5b9685,null))['catch'](handleError(_0x5b9685,null));};exports[_0x5200('0x98')]=function(_0xae9cbc,_0x5af1b2,_0x320b4e){var _0x3c2e8a={'raw':!![],'where':{}};var _0x97277={};var _0x2ced90={'count':0x0,'rows':[]};return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0xae9cbc[_0x5200('0x5c')]['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x5af1b2,null))[_0x5200('0x1b')](function(_0x446033){if(_0x446033){_0x97277[_0x5200('0x3e')]=_['keys'](db[_0x5200('0x99')][_0x5200('0x50')]);_0x97277[_0x5200('0x3f')]=_['keys'](_0xae9cbc[_0x5200('0x3f')]);_0x97277[_0x5200('0x41')]=_['intersection'](_0x97277[_0x5200('0x3e')],_0x97277[_0x5200('0x3f')]);_0x3c2e8a[_0x5200('0x43')]=_['intersection'](_0x97277[_0x5200('0x3e')],qs[_0x5200('0x44')](_0xae9cbc['query'][_0x5200('0x44')]));_0x3c2e8a[_0x5200('0x43')]=_0x3c2e8a['attributes'][_0x5200('0x45')]?_0x3c2e8a[_0x5200('0x43')]:_0x97277[_0x5200('0x3e')];if(!_0xae9cbc[_0x5200('0x3f')][_0x5200('0x46')](_0x5200('0x69'))){_0x3c2e8a[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0xae9cbc[_0x5200('0x3f')][_0x5200('0x2b')]);_0x3c2e8a['offset']=qs[_0x5200('0x29')](_0xae9cbc[_0x5200('0x3f')]['offset']);}_0x3c2e8a[_0x5200('0x47')]=qs[_0x5200('0x48')](_0xae9cbc[_0x5200('0x3f')][_0x5200('0x48')]);_0x3c2e8a[_0x5200('0x49')]=qs['filters'](_[_0x5200('0x4a')](_0xae9cbc[_0x5200('0x3f')],_0x97277[_0x5200('0x41')]));_0x3c2e8a[_0x5200('0x49')][_0x5200('0x5f')]=_0x446033['id'];if(_0xae9cbc[_0x5200('0x3f')][_0x5200('0x4b')]){_0x3c2e8a[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x3c2e8a[_0x5200('0x49')],{'$or':_['map'](_0x3c2e8a[_0x5200('0x43')],function(_0x483021){var _0x3be83d={};_0x3be83d[_0x483021]={'$like':'%'+_0xae9cbc['query'][_0x5200('0x4b')]+'%'};return _0x3be83d;})});}if(_0xae9cbc[_0x5200('0x3f')]['$gte']){var _0x301646=_0xae9cbc[_0x5200('0x3f')][_0x5200('0x9a')][_0x5200('0x9b')](',');var _0x2a302f={};_0x2a302f[_0x301646[0x0]]={'$gte':moment(_0x301646[0x1])[_0x5200('0x9c')](_0x5200('0x9d'))};_0x3c2e8a[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x3c2e8a[_0x5200('0x49')],_0x2a302f);}_0x3c2e8a=_[_0x5200('0x4c')]({},_0x3c2e8a,_0xae9cbc['options']);return db[_0x5200('0x99')][_0x5200('0x2c')]({'where':_0x3c2e8a[_0x5200('0x49')]})[_0x5200('0x1b')](function(_0x330db5){_0x2ced90[_0x5200('0x2c')]=_0x330db5;if(_0xae9cbc[_0x5200('0x3f')][_0x5200('0x51')]){_0x3c2e8a[_0x5200('0x52')]=[{'all':!![]}];}return db[_0x5200('0x99')][_0x5200('0x63')](_0x3c2e8a);})[_0x5200('0x1b')](function(_0x85d32f){_0x2ced90[_0x5200('0x4e')]=_0x85d32f;return _0x2ced90;});}})[_0x5200('0x1b')](respondWithFilteredResult(_0x5af1b2,_0x3c2e8a))[_0x5200('0x4f')](handleError(_0x5af1b2,null));};exports[_0x5200('0x36')]=function(_0x1e4ba8,_0x2e2d85,_0x34d0d8){var _0x4f370b,_0x4c9ca={},_0x31ed3b;if(_0x1e4ba8[_0x5200('0x54')]['to']){_0x31ed3b=_0x1e4ba8['body']['to'][0x0];}return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x1e4ba8['params']['id']},'include':[{'model':db['CmList'],'as':_0x5200('0x9e'),'include':[{'model':db[_0x5200('0x9f')],'as':_0x5200('0xa0'),'where':{'fax':_0x31ed3b},'limit':0x1,'order':[[_0x5200('0x96'),_0x5200('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x2e2d85,null))[_0x5200('0x1b')](function(_0x4fffa0){_0x4f370b=_0x4fffa0;if(_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')]&&_0x1e4ba8['body'][_0x5200('0xa2')][_0x5200('0x45')]){for(var _0x10f9e1=0x0;_0x10f9e1<_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][_0x5200('0x45')];_0x10f9e1+=0x1){_0x1e4ba8['body'][_0x5200('0xa2')][_0x10f9e1]={'filename':_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1]['name'],'id':_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1]['id'],'path':path[_0x5200('0xa3')](config['root'],_0x5200('0xa4'),_0x1e4ba8[_0x5200('0x54')]['attachments'][_0x10f9e1][_0x5200('0xa5')])};}}return respondWithRpcPromise(_0x5200('0xa6'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x1e4ba8[_0x5200('0x5c')]['id'])?undefined:_0x1e4ba8[_0x5200('0x5c')]['id'],'path':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0][_0x5200('0x3')])?undefined:_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0x3')],'fax':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')]['to'][0x0])?undefined:_0x1e4ba8['body']['to'][0x0]},client9002);})[_0x5200('0x1b')](function(){if(_0x4f370b){if(_[_0x5200('0xa7')](_0x1e4ba8['body']['from'])){_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa8')]=util[_0x5200('0x9c')](_0x5200('0xa9'),_0x4f370b['name'],_0x4f370b['fax']);}if(_0x4f370b[_0x5200('0x9e')]){if(_0x4f370b[_0x5200('0x9e')][_0x5200('0xa0')][_0x5200('0x45')]){return _0x4f370b[_0x5200('0x9e')][_0x5200('0xa0')][0x0];}else{return db[_0x5200('0x9f')][_0x5200('0x53')](_[_0x5200('0x14')](_0x1e4ba8[_0x5200('0x54')],{'firstName':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'phone':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'fax':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'ListId':_0x4f370b[_0x5200('0xaa')]}));}}else{throw new Error(_0x5200('0xab'));}}else{throw new Error(_0x5200('0xac'));}})[_0x5200('0x1b')](function(_0x3e7644){if(_0x3e7644){return db[_0x5200('0x6b')]['find']({'where':{'ContactId':_0x3e7644['id'],'closed':![],'FaxAccountId':_0x4f370b['id']}})[_0x5200('0x1b')](function(_0xfba00b){if(_0xfba00b){return[_0xfba00b,![]];}return db[_0x5200('0x6b')][_0x5200('0x53')]({'UserId':_0x1e4ba8[_0x5200('0x55')]['id'],'ContactId':_0x3e7644['id'],'FaxAccountId':_0x4f370b['id'],'fax':_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'firstMsgDirection':_0x5200('0xad'),'Messages':[_[_0x5200('0x4c')](_0x1e4ba8[_0x5200('0x54')],{'read':![],'body':_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0xae')],'FaxAccountId':_0x4f370b['id'],'UserId':_0x1e4ba8['user']['id'],'ContactId':_0x3e7644['id'],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5200('0xaf')}]})['then'](function(_0x1efe1d){return[_0x1efe1d,!![]];});});}else{throw new Error(_0x5200('0xb0'));}})[_0x5200('0xb1')](function(_0x8cd8f4,_0x3b1dd5){if(_0x3b1dd5){return _0x8cd8f4;}return db[_0x5200('0x99')][_0x5200('0x53')]({'direction':'out','read':![],'body':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['filename'],'FaxAccountId':_0x4f370b['id'],'FaxInteractionId':_0x8cd8f4['id'],'UserId':_0x1e4ba8[_0x5200('0x55')]['id'],'ContactId':_0x8cd8f4[_0x5200('0xb2')],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']})[_0x5200('0x1b')](function(_0x592eea){_0x8cd8f4['dataValues'][_0x5200('0xaf')]=[];_0x8cd8f4[_0x5200('0xb3')]['Messages'][_0x5200('0x8e')](_0x592eea[_0x5200('0xb3')]);return _0x8cd8f4;});})[_0x5200('0x1b')](function(_0x366468){respondWithRpcPromise('SendFax',_0x5200('0xb4'),{'FaxAccountId':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x5c')]['id'])?undefined:_0x1e4ba8[_0x5200('0x5c')]['id'],'path':_['isNil'](_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['path'])?undefined:_0x1e4ba8['body'][_0x5200('0xa2')][0x0][_0x5200('0x3')],'fax':_[_0x5200('0xa7')](_0x1e4ba8[_0x5200('0x54')]['to'][0x0])?undefined:_0x1e4ba8[_0x5200('0x54')]['to'][0x0],'AttachmentId':_0x1e4ba8[_0x5200('0x54')][_0x5200('0xa2')][0x0]['id']},client9002)[_0x5200('0x1b')](function(_0x132fae){logger[_0x5200('0x1c')](_0x5200('0xb5'),_0x132fae);})[_0x5200('0x4f')](function(_0x16d25c){logger[_0x5200('0x1c')](_0x5200('0xb5'),_0x16d25c);});return _0x366468;})[_0x5200('0x1b')](respondWithResult(_0x2e2d85,null))[_0x5200('0x4f')](handleError(_0x2e2d85,null));};exports['addAgents']=function(_0x313cf9,_0x2bad7e,_0x1c4a65){return db[_0x5200('0x3b')][_0x5200('0x59')]({'where':{'id':_0x313cf9['params']['id']}})['then'](handleEntityNotFound(_0x2bad7e,null))[_0x5200('0x1b')](function(_0x14155b){if(_0x14155b){return _0x14155b['addAgents'](_0x313cf9[_0x5200('0x54')][_0x5200('0x65')],_[_0x5200('0x6c')](_0x313cf9[_0x5200('0x54')],[_0x5200('0x65'),'id'])||{})[_0x5200('0xb1')](function(_0x5d0abd){for(var _0x433148=0x0;_0x433148<_0x313cf9[_0x5200('0x54')][_0x5200('0x65')][_0x5200('0x45')];_0x433148+=0x1){socket['emit'](_0x5200('0xb6'),{'UserId':Number(_0x313cf9[_0x5200('0x54')][_0x5200('0x65')][_0x433148]),'FaxAccountId':Number(_0x313cf9['params']['id'])});}return _0x5d0abd;});}})[_0x5200('0x1b')](respondWithResult(_0x2bad7e,null))[_0x5200('0x4f')](handleError(_0x2bad7e,null));};exports[_0x5200('0xb7')]=function(_0x118894,_0x30e0fc,_0x21a673){return db[_0x5200('0x3b')]['find']({'where':{'id':_0x118894['params']['id']}})['then'](handleEntityNotFound(_0x30e0fc,null))[_0x5200('0x1b')](function(_0x4a9ead){if(_0x4a9ead){return _0x4a9ead[_0x5200('0xb7')](_0x118894[_0x5200('0x3f')][_0x5200('0x65')])[_0x5200('0x1b')](function(){if(_[_0x5200('0xb8')](_0x118894[_0x5200('0x3f')]['ids'])){for(var _0x1816f1=0x0;_0x1816f1<_0x118894[_0x5200('0x3f')][_0x5200('0x65')][_0x5200('0x45')];_0x1816f1+=0x1){socket[_0x5200('0xb9')](_0x5200('0xba'),{'UserId':Number(_0x118894[_0x5200('0x3f')]['ids'][_0x1816f1]),'FaxAccountId':Number(_0x118894[_0x5200('0x5c')]['id'])});}}else{socket['emit'](_0x5200('0xba'),{'UserId':Number(_0x118894[_0x5200('0x3f')][_0x5200('0x65')]),'FaxAccountId':Number(_0x118894[_0x5200('0x5c')]['id'])});}});}})[_0x5200('0x1b')](respondWithStatusCode(_0x30e0fc,null))[_0x5200('0x4f')](handleError(_0x30e0fc,null));};exports['getAgents']=function(_0x23ae33,_0x5353b2,_0x41b3ee){var _0x1c466c={};var _0x434718={};var _0x233489;var _0x18c362;return db[_0x5200('0x3b')][_0x5200('0x62')]({'where':{'id':_0x23ae33['params']['id']}})[_0x5200('0x1b')](handleEntityNotFound(_0x5353b2,null))[_0x5200('0x1b')](function(_0x44962d){if(_0x44962d){_0x233489=_0x44962d;_0x434718['model']=_[_0x5200('0x40')](db[_0x5200('0x6e')][_0x5200('0x50')]);_0x434718['query']=_[_0x5200('0x40')](_0x23ae33[_0x5200('0x3f')]);_0x434718[_0x5200('0x41')]=_[_0x5200('0x42')](_0x434718[_0x5200('0x3e')],_0x434718['query']);_0x1c466c[_0x5200('0x43')]=_[_0x5200('0x42')](_0x434718['model'],qs[_0x5200('0x44')](_0x23ae33[_0x5200('0x3f')]['fields']));_0x1c466c[_0x5200('0x43')]=_0x1c466c[_0x5200('0x43')][_0x5200('0x45')]?_0x1c466c[_0x5200('0x43')]:_0x434718[_0x5200('0x3e')];_0x1c466c[_0x5200('0x47')]=qs[_0x5200('0x48')](_0x23ae33['query'][_0x5200('0x48')]);_0x1c466c[_0x5200('0x49')]=qs[_0x5200('0x41')](_[_0x5200('0x4a')](_0x23ae33[_0x5200('0x3f')],_0x434718[_0x5200('0x41')]));if(_0x23ae33[_0x5200('0x3f')][_0x5200('0x4b')]){_0x1c466c[_0x5200('0x49')]=_[_0x5200('0x4c')](_0x1c466c['where'],{'$or':_[_0x5200('0x3a')](_0x1c466c[_0x5200('0x43')],function(_0x441a8d){var _0x536edf={};_0x536edf[_0x441a8d]={'$like':'%'+_0x23ae33['query']['filter']+'%'};return _0x536edf;})});}_0x1c466c=_[_0x5200('0x4c')]({},_0x1c466c,_0x23ae33['options']);return _0x233489['getAgents'](_0x1c466c);}})[_0x5200('0x1b')](function(_0xadf76f){if(_0xadf76f){_0x18c362=_0xadf76f[_0x5200('0x45')];if(!_0x23ae33[_0x5200('0x3f')]['hasOwnProperty'](_0x5200('0x69'))){_0x1c466c['limit']=qs[_0x5200('0x2b')](_0x23ae33[_0x5200('0x3f')][_0x5200('0x2b')]);_0x1c466c['offset']=qs[_0x5200('0x29')](_0x23ae33[_0x5200('0x3f')][_0x5200('0x29')]);}return _0x233489[_0x5200('0xbb')](_0x1c466c);}})['then'](function(_0x22513a){if(_0x22513a){return _0x22513a?{'count':_0x18c362,'rows':_0x22513a}:null;}})[_0x5200('0x1b')](respondWithResult(_0x5353b2,null))[_0x5200('0x4f')](handleError(_0x5353b2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 90b7800..89761c5 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 _0xed11=['remove','emit','hasOwnProperty','hook','exports','update'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xed11,0x107));var _0x1ed1=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xed11[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ed1('0x0'),'afterDestroy':_0x1ed1('0x1')};function emitEvent(_0x5e031){return function(_0x428305,_0x4f2eb3,_0xeb38a7){FaxAccountEvents[_0x1ed1('0x2')](_0x5e031+':'+_0x428305['id'],_0x428305);FaxAccountEvents[_0x1ed1('0x2')](_0x5e031,_0x428305);_0xeb38a7(null);};}for(var e in events){if(events[_0x1ed1('0x3')](e)){var event=events[e];FaxAccount[_0x1ed1('0x4')](e,emitEvent(event));}}module[_0x1ed1('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0xa81d=['../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa81d,0x11e));var _0xda81=function(_0x3c834d,_0x4f9feb){_0x3c834d=_0x3c834d-0x0;var _0x508ff4=_0xa81d[_0x3c834d];return _0x508ff4;};'use strict';var EventEmitter=require(_0xda81('0x0'));var FaxAccount=require(_0xda81('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xda81('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda81('0x3'),'afterDestroy':_0xda81('0x4')};function emitEvent(_0x74cbca){return function(_0x1c3649,_0x3d07ad,_0x380972){FaxAccountEvents['emit'](_0x74cbca+':'+_0x1c3649['id'],_0x1c3649);FaxAccountEvents['emit'](_0x74cbca,_0x1c3649);_0x380972(null);};}for(var e in events){if(events[_0xda81('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xda81('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7a399c1..c19c6ad 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 _0x1381=['./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2c25a9,_0x2d0dc6){var _0x3fcde8=function(_0x350942){while(--_0x350942){_0x2c25a9['push'](_0x2c25a9['shift']());}};_0x3fcde8(++_0x2d0dc6);}(_0x1381,0xba));var _0x1138=function(_0x541c34,_0x5e82a5){_0x541c34=_0x541c34-0x0;var _0x52a59d=_0x1381[_0x541c34];return _0x52a59d;};'use strict';var _=require(_0x1138('0x0'));var util=require(_0x1138('0x1'));var logger=require(_0x1138('0x2'))(_0x1138('0x3'));var moment=require(_0x1138('0x4'));var BPromise=require('bluebird');var rp=require(_0x1138('0x5'));var fs=require('fs');var path=require(_0x1138('0x6'));var rimraf=require(_0x1138('0x7'));var config=require(_0x1138('0x8'));var attributes=require(_0x1138('0x9'));module[_0x1138('0xa')]=function(_0x2c33f2,_0x5901e8){return _0x2c33f2[_0x1138('0xb')](_0x1138('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd910=['../../config/logger','api','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util'];(function(_0x3ebc85,_0x59be56){var _0x2f24df=function(_0x49054f){while(--_0x49054f){_0x3ebc85['push'](_0x3ebc85['shift']());}};_0x2f24df(++_0x59be56);}(_0xd910,0x166));var _0x0d91=function(_0x33e589,_0x4d48d3){_0x33e589=_0x33e589-0x0;var _0x117a6b=_0xd910[_0x33e589];return _0x117a6b;};'use strict';var _=require(_0x0d91('0x0'));var util=require(_0x0d91('0x1'));var logger=require(_0x0d91('0x2'))(_0x0d91('0x3'));var moment=require('moment');var BPromise=require(_0x0d91('0x4'));var rp=require(_0x0d91('0x5'));var fs=require('fs');var path=require(_0x0d91('0x6'));var rimraf=require(_0x0d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d91('0x8'));module[_0x0d91('0x9')]=function(_0x5cc879,_0x5e4717){return _0x5cc879['define'](_0x0d91('0xa'),attributes,{'tableName':_0x0d91('0xb'),'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 919fda2..2f64d68 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 _0x81fc=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','debug','catch','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','get','Applications','list','orderBy','applications','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','queue','Start'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x81fc,0x170));var _0xc81f=function(_0x767e16,_0x20e65e){_0x767e16=_0x767e16-0x0;var _0x129eb4=_0x81fc[_0x767e16];return _0x129eb4;};'use strict';var _=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var moment=require(_0xc81f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc81f('0x3'));var fs=require('fs');var Redis=require(_0xc81f('0x4'));var db=require(_0xc81f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc81f('0x6'))(_0xc81f('0x7'));var config=require('../../config/environment');var jayson=require(_0xc81f('0x8'));var client=jayson['client'][_0xc81f('0x9')]({'port':0x232c});config['redis']=_[_0xc81f('0xa')](config[_0xc81f('0xb')],{'host':_0xc81f('0xc'),'port':0x18eb});var socket=require(_0xc81f('0xd'))(new Redis(config[_0xc81f('0xb')]));require(_0xc81f('0xe'))[_0xc81f('0xf')](socket);function respondWithRpcPromise(_0x4f87a6,_0x3c4a0d,_0x92e07b){return new BPromise(function(_0x511208,_0x5158b3){return client['request'](_0x4f87a6,_0x92e07b)[_0xc81f('0x10')](function(_0x41d9f0){logger[_0xc81f('0x11')](_0xc81f('0x12'),_0x3c4a0d,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3c4a0d,_0xc81f('0x13'),JSON[_0xc81f('0x14')](_0x41d9f0));if(_0x41d9f0[_0xc81f('0x15')]){if(_0x41d9f0[_0xc81f('0x15')]['code']===0x1f4){logger[_0xc81f('0x15')](_0xc81f('0x12'),_0x3c4a0d,_0x41d9f0[_0xc81f('0x15')][_0xc81f('0x16')]);return _0x5158b3(_0x41d9f0[_0xc81f('0x15')][_0xc81f('0x16')]);}logger[_0xc81f('0x15')]('FaxAccount,\x20%s,\x20%s',_0x3c4a0d,_0x41d9f0['error'][_0xc81f('0x16')]);return _0x511208(_0x41d9f0['error']['message']);}else{logger[_0xc81f('0x11')](_0xc81f('0x12'),_0x3c4a0d,_0xc81f('0x13'));_0x511208(_0x41d9f0[_0xc81f('0x17')][_0xc81f('0x16')]);}})['catch'](function(_0x3f9299){logger[_0xc81f('0x15')](_0xc81f('0x12'),_0x3c4a0d,_0x3f9299);_0x5158b3(_0x3f9299);});});}exports[_0xc81f('0x18')]=function(_0x28191a){var _0x25d4ae=this;return new Promise(function(_0x5356a9,_0x3aef81){return db[_0xc81f('0x19')]['findAll']({'raw':_0x28191a[_0xc81f('0x1a')]?_0x28191a[_0xc81f('0x1a')][_0xc81f('0x1b')]===undefined?!![]:![]:!![],'where':_0x28191a[_0xc81f('0x1a')]?_0x28191a[_0xc81f('0x1a')][_0xc81f('0x1c')]||null:null,'attributes':_0x28191a[_0xc81f('0x1a')]?_0x28191a[_0xc81f('0x1a')][_0xc81f('0x1d')]||null:null,'limit':_0x28191a[_0xc81f('0x1a')]?_0x28191a[_0xc81f('0x1a')]['limit']||null:null,'include':_0x28191a[_0xc81f('0x1a')]?_0x28191a[_0xc81f('0x1a')][_0xc81f('0x1e')]?_[_0xc81f('0x1f')](_0x28191a[_0xc81f('0x1a')][_0xc81f('0x1e')],function(_0x31c9c6){return{'model':db[_0x31c9c6['model']],'as':_0x31c9c6['as'],'attributes':_0x31c9c6[_0xc81f('0x1d')],'include':_0x31c9c6[_0xc81f('0x1e')]?_[_0xc81f('0x1f')](_0x31c9c6['include'],function(_0x4260db){return{'model':db[_0x4260db[_0xc81f('0x20')]],'as':_0x4260db['as'],'attributes':_0x4260db[_0xc81f('0x1d')],'include':_0x4260db[_0xc81f('0x1e')]?_[_0xc81f('0x1f')](_0x4260db[_0xc81f('0x1e')],function(_0x474191){return{'model':db[_0x474191[_0xc81f('0x20')]],'as':_0x474191['as'],'attributes':_0x474191[_0xc81f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc81f('0x10')](function(_0x16f9d5){logger[_0xc81f('0x11')](_0xc81f('0x18'),_0x28191a);logger[_0xc81f('0x21')](_0xc81f('0x18'),_0x28191a,JSON[_0xc81f('0x14')](_0x16f9d5));_0x5356a9(_0x16f9d5);})[_0xc81f('0x22')](function(_0x2e5865){logger[_0xc81f('0x15')](_0xc81f('0x18'),_0x2e5865['message'],_0x28191a);_0x3aef81(_0x25d4ae[_0xc81f('0x15')](0x1f4,_0x2e5865[_0xc81f('0x16')]));});});};exports[_0xc81f('0x23')]=function(_0x2eab5c,_0x2f7bf0,_0x9790cc){var _0x588642=this;return new Promise(function(_0xde0387,_0x45757d){var _0x27078e={'body':_0x2eab5c[_0xc81f('0x24')],'channel':'fax'};var _0xb20463=[];var _0x3c0a3d=[];var _0x1854b0={};return db[_0xc81f('0x25')][_0xc81f('0x26')]()[_0xc81f('0x10')](function(_0x4c4b50){if(!_0x4c4b50){throw new db[(_0xc81f('0x27'))]['ValidationError'](_0xc81f('0x28'));}_0xb20463=_['difference'](_[_0xc81f('0x29')](_0x4c4b50),[_0xc81f('0x2a'),_0xc81f('0x2b')]);_0x3c0a3d=_[_0xc81f('0x2c')](_['keys'](_0x4c4b50),[_0xc81f('0x2a'),_0xc81f('0x2b'),_0xc81f('0x2d'),_0xc81f('0x2e')]);if(_0x2eab5c[_0xc81f('0x24')]['id']){delete _0x2eab5c[_0xc81f('0x24')]['id'];}if(_[_0xc81f('0x2f')](_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x30')])){throw new db[(_0xc81f('0x27'))][(_0xc81f('0x31'))](_0xc81f('0x32'));}if(_[_0xc81f('0x2f')](_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x24')])||_0x2eab5c['body'][_0xc81f('0x24')]===''){throw new db[(_0xc81f('0x27'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc81f('0x2f')](_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x33')])){throw new db['Sequelize']['ValidationError'](_0xc81f('0x34')+_0x3c0a3d);}if(!_[_0xc81f('0x35')](_0x3c0a3d,_0x2eab5c[_0xc81f('0x24')]['mapKey'])){throw new db[(_0xc81f('0x27'))]['ValidationError'](_0xc81f('0x36')+_0x3c0a3d);}_0x1854b0[_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x33')]]=_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x30')];})[_0xc81f('0x10')](function(){return db[_0xc81f('0x19')][_0xc81f('0x37')]({'where':{'id':_0x2eab5c[_0xc81f('0x38')]['id']},'include':[{'model':db[_0xc81f('0x39')],'as':_0xc81f('0x3a'),'include':[{'model':db[_0xc81f('0x25')],'as':_0xc81f('0x3b'),'where':_0x1854b0,'limit':0x1,'order':[[_0xc81f('0x2b'),_0xc81f('0x3c')]]}]},{'model':db[_0xc81f('0x3d')],'as':'Applications'}]});})['then'](function(_0x2e168a){if(_0x2e168a&&_0x2e168a[_0xc81f('0x3a')]){var _0x4b27a6=_0x2e168a[_0xc81f('0x3e')]({'plain':!![]});_0x27078e[_0xc81f('0x38')]=_0x4b27a6;_0x27078e['applications']=_0x4b27a6[_0xc81f('0x3f')];_0x27078e[_0xc81f('0x40')]=_0x4b27a6['List'];_0x27078e['applications']=_[_0xc81f('0x41')](_0x27078e[_0xc81f('0x42')],[_0xc81f('0x43')],[_0xc81f('0x44')]);if(_0x27078e[_0xc81f('0x38')][_0xc81f('0x3f')]){delete _0x27078e[_0xc81f('0x38')][_0xc81f('0x3f')];}if(_0x27078e[_0xc81f('0x38')][_0xc81f('0x3a')]&&_0x27078e['account'][_0xc81f('0x3a')]['Contacts'][_0xc81f('0x45')]){return _0x27078e[_0xc81f('0x38')]['List'][_0xc81f('0x3b')][0x0];}var _0x4dc7a7=_[_0xc81f('0xa')](_0x2eab5c[_0xc81f('0x24')],{'firstName':_0x2eab5c[_0xc81f('0x24')]['from'],'ListId':_0x4b27a6[_0xc81f('0x2e')]});_0x4dc7a7[_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x33')]]=_0x2eab5c['body'][_0xc81f('0x30')];return db[_0xc81f('0x25')][_0xc81f('0x46')](_0x4dc7a7,{'fields':_0xb20463,'raw':!![]});}})[_0xc81f('0x10')](function(_0x231321){_0x27078e[_0xc81f('0x47')]=_0x231321;if(_0x231321){var _0xb3b887={'ContactId':_0x231321['id'],'FaxAccountId':_0x2eab5c[_0xc81f('0x38')]['id'],'fax':_0x231321['fax']};return db['FaxInteraction'][_0xc81f('0x37')]({'where':{'ContactId':_0x231321['id'],'closed':![],'FaxAccountId':_0x2eab5c[_0xc81f('0x38')]['id']}})[_0xc81f('0x10')](function(_0x2ca25d){if(_0x2ca25d){return[_0x2ca25d,![]];}return db[_0xc81f('0x48')][_0xc81f('0x46')](_0xb3b887)[_0xc81f('0x10')](function(_0x215eee){return[_0x215eee,!![]];});});}else{throw new Error(_0xc81f('0x49'));}})[_0xc81f('0x4a')](function(_0x8d38fa,_0x1a4cff){var _0x54c43b=_0x8d38fa[_0xc81f('0x3e')]({'plain':!![]});if(_0x1a4cff){if(_0x27078e[_0xc81f('0x38')][_0xc81f('0x4b')]){_0x27078e[_0xc81f('0x42')][_0xc81f('0x4c')]({'id':0x0,'priority':_0x27078e['applications'][_0xc81f('0x45')]+0x1,'app':_0xc81f('0x4d'),'appdata':'unmanaged','interval':_0xc81f('0x4e')});}_0x54c43b[_0xc81f('0x4f')]=!![];}else{_0x54c43b['created']=![];}_0x27078e[_0xc81f('0x50')]=_0x54c43b;return db[_0xc81f('0x51')][_0xc81f('0x46')]({'body':_0x2eab5c[_0xc81f('0x24')]['body'],'FaxAccountId':_0x2eab5c[_0xc81f('0x38')]['id'],'FaxInteractionId':_0x8d38fa['id'],'direction':'in','ContactId':_0x8d38fa[_0xc81f('0x52')],'AttachmentId':_0x2eab5c[_0xc81f('0x24')][_0xc81f('0x53')]});})[_0xc81f('0x10')](function(_0x52bac7){_0x27078e[_0xc81f('0x16')]=_0x52bac7;if(!_0x27078e['interaction'][_0xc81f('0x54')])return;return db['User'][_0xc81f('0x37')]({'attributes':['id','name'],'where':{'id':_0x27078e[_0xc81f('0x50')][_0xc81f('0x54')]}});})['then'](function(_0xef2bc9){if(_0xef2bc9){_0x27078e[_0xc81f('0x42')][_0xc81f('0x55')]({'id':0x0,'priority':0x0,'app':_0xc81f('0x56'),'appdata':_0xef2bc9[_0xc81f('0x57')]+','+(_0x27078e[_0xc81f('0x38')][_0xc81f('0x58')]||0xa),'interval':'*,*,*,*'});}if(!_0x27078e['interaction'][_0xc81f('0x59')])return;return db['FaxQueue']['find']({'attributes':['id','name'],'where':{'id':_0x27078e['interaction'][_0xc81f('0x59')]}});})[_0xc81f('0x10')](function(_0x2044f7){if(_0x2044f7){_0x27078e[_0xc81f('0x42')][_0xc81f('0x55')]({'id':0x0,'priority':0x1,'app':_0xc81f('0x5a'),'appdata':_0x2044f7['name']+','+(_0x27078e[_0xc81f('0x38')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc81f('0x4e')});}return respondWithRpcPromise(_0xc81f('0x5b'),'startRouting',_0x27078e);})[_0xc81f('0x10')](function(_0xa8fb33){_0xde0387(_0xa8fb33);})['catch'](function(_0x5c593e){_0x45757d(_0x588642[_0xc81f('0x15')](0x1f4,_0x5c593e[_0xc81f('0x16')]));});});}; \ No newline at end of file +var _0x546c=['FaxAccount','options','raw','where','attributes','include','model','map','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','priority','account','length','defaults','ListId','contact','fax','FaxInteraction','create','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','*,*,*,*','FaxQueue','queueId','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount'];(function(_0x34fe14,_0x36f526){var _0x3dd3b7=function(_0x5a669f){while(--_0x5a669f){_0x34fe14['push'](_0x34fe14['shift']());}};_0x3dd3b7(++_0x36f526);}(_0x546c,0x94));var _0xc546=function(_0x416528,_0x101c25){_0x416528=_0x416528-0x0;var _0x581955=_0x546c[_0x416528];return _0x581955;};'use strict';var _=require(_0xc546('0x0'));var util=require(_0xc546('0x1'));var moment=require('moment');var BPromise=require(_0xc546('0x2'));var rs=require(_0xc546('0x3'));var fs=require('fs');var Redis=require(_0xc546('0x4'));var db=require(_0xc546('0x5'))['db'];var utils=require(_0xc546('0x6'));var logger=require(_0xc546('0x7'))(_0xc546('0x8'));var config=require(_0xc546('0x9'));var jayson=require(_0xc546('0xa'));var client=jayson[_0xc546('0xb')]['http']({'port':0x232c});config[_0xc546('0xc')]=_['defaults'](config[_0xc546('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc546('0xc')]));require(_0xc546('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e0502,_0x239513,_0x46be21){return new BPromise(function(_0x402f0e,_0x28a553){return client[_0xc546('0xe')](_0x5e0502,_0x46be21)[_0xc546('0xf')](function(_0x50fddd){logger[_0xc546('0x10')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0xc546('0x11'));logger[_0xc546('0x12')](_0xc546('0x13'),_0x239513,_0xc546('0x11'),JSON[_0xc546('0x14')](_0x50fddd));if(_0x50fddd[_0xc546('0x15')]){if(_0x50fddd[_0xc546('0x15')][_0xc546('0x16')]===0x1f4){logger[_0xc546('0x15')](_0xc546('0x17'),_0x239513,_0x50fddd[_0xc546('0x15')]['message']);return _0x28a553(_0x50fddd[_0xc546('0x15')][_0xc546('0x18')]);}logger[_0xc546('0x15')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0x50fddd['error'][_0xc546('0x18')]);return _0x402f0e(_0x50fddd[_0xc546('0x15')]['message']);}else{logger[_0xc546('0x10')]('FaxAccount,\x20%s,\x20%s',_0x239513,_0xc546('0x11'));_0x402f0e(_0x50fddd['result'][_0xc546('0x18')]);}})['catch'](function(_0x50d076){logger['error'](_0xc546('0x17'),_0x239513,_0x50d076);_0x28a553(_0x50d076);});});}exports[_0xc546('0x19')]=function(_0x5cb541){var _0x173692=this;return new Promise(function(_0x4ea11b,_0x3d71f5){return db[_0xc546('0x1a')]['findAll']({'raw':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cb541['options']?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1d')]||null:null,'attributes':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1e')]||null:null,'limit':_0x5cb541['options']?_0x5cb541[_0xc546('0x1b')]['limit']||null:null,'include':_0x5cb541[_0xc546('0x1b')]?_0x5cb541[_0xc546('0x1b')][_0xc546('0x1f')]?_['map'](_0x5cb541['options'][_0xc546('0x1f')],function(_0x29d9b1){return{'model':db[_0x29d9b1[_0xc546('0x20')]],'as':_0x29d9b1['as'],'attributes':_0x29d9b1[_0xc546('0x1e')],'include':_0x29d9b1[_0xc546('0x1f')]?_['map'](_0x29d9b1['include'],function(_0x575bfa){return{'model':db[_0x575bfa[_0xc546('0x20')]],'as':_0x575bfa['as'],'attributes':_0x575bfa[_0xc546('0x1e')],'include':_0x575bfa[_0xc546('0x1f')]?_[_0xc546('0x21')](_0x575bfa['include'],function(_0x14b4bb){return{'model':db[_0x14b4bb[_0xc546('0x20')]],'as':_0x14b4bb['as'],'attributes':_0x14b4bb[_0xc546('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc546('0xf')](function(_0x3baeca){logger[_0xc546('0x10')](_0xc546('0x19'),_0x5cb541);logger[_0xc546('0x12')](_0xc546('0x19'),_0x5cb541,JSON[_0xc546('0x14')](_0x3baeca));_0x4ea11b(_0x3baeca);})['catch'](function(_0x5406e7){logger[_0xc546('0x15')]('GetFaxAccount',_0x5406e7['message'],_0x5cb541);_0x3d71f5(_0x173692['error'](0x1f4,_0x5406e7[_0xc546('0x18')]));});});};exports[_0xc546('0x22')]=function(_0x3a4a91,_0x280e3f,_0x154bf0){var _0x3ab178=this;return new Promise(function(_0x33df0f,_0xa90c97){var _0x1eb792={'body':_0x3a4a91[_0xc546('0x23')],'channel':'fax'};var _0x299c69=[];var _0x501231=[];var _0x22a6f8={};return db[_0xc546('0x24')][_0xc546('0x25')]()[_0xc546('0xf')](function(_0x30ba4a){if(!_0x30ba4a){throw new db[(_0xc546('0x26'))][(_0xc546('0x27'))](_0xc546('0x28'));}_0x299c69=_['difference'](_[_0xc546('0x29')](_0x30ba4a),[_0xc546('0x2a'),_0xc546('0x2b')]);_0x501231=_[_0xc546('0x2c')](_[_0xc546('0x29')](_0x30ba4a),[_0xc546('0x2a'),_0xc546('0x2b'),'CompanyId','ListId']);if(_0x3a4a91[_0xc546('0x23')]['id']){delete _0x3a4a91['body']['id'];}if(_['isNil'](_0x3a4a91[_0xc546('0x23')][_0xc546('0x2d')])){throw new db[(_0xc546('0x26'))][(_0xc546('0x27'))](_0xc546('0x2e'));}if(_['isNil'](_0x3a4a91[_0xc546('0x23')]['body'])||_0x3a4a91['body'][_0xc546('0x23')]===''){throw new db['Sequelize'][(_0xc546('0x27'))](_0xc546('0x2f'));}if(_[_0xc546('0x30')](_0x3a4a91['body']['mapKey'])){throw new db['Sequelize'][(_0xc546('0x27'))](_0xc546('0x31')+_0x501231);}if(!_[_0xc546('0x32')](_0x501231,_0x3a4a91[_0xc546('0x23')][_0xc546('0x33')])){throw new db['Sequelize'][(_0xc546('0x27'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x501231);}_0x22a6f8[_0x3a4a91['body'][_0xc546('0x33')]]=_0x3a4a91[_0xc546('0x23')][_0xc546('0x2d')];})[_0xc546('0xf')](function(){return db[_0xc546('0x1a')][_0xc546('0x34')]({'where':{'id':_0x3a4a91['account']['id']},'include':[{'model':db['CmList'],'as':_0xc546('0x35'),'include':[{'model':db[_0xc546('0x24')],'as':_0xc546('0x36'),'where':_0x22a6f8,'limit':0x1,'order':[[_0xc546('0x2b'),_0xc546('0x37')]]}]},{'model':db[_0xc546('0x38')],'as':_0xc546('0x39')}]});})[_0xc546('0xf')](function(_0x483e6b){if(_0x483e6b&&_0x483e6b[_0xc546('0x35')]){var _0x544e74=_0x483e6b[_0xc546('0x3a')]({'plain':!![]});_0x1eb792['account']=_0x544e74;_0x1eb792['applications']=_0x544e74[_0xc546('0x39')];_0x1eb792[_0xc546('0x3b')]=_0x544e74['List'];_0x1eb792[_0xc546('0x3c')]=_['orderBy'](_0x1eb792[_0xc546('0x3c')],[_0xc546('0x3d')],['asc']);if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x39')]){delete _0x1eb792['account']['Applications'];}if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x35')]&&_0x1eb792[_0xc546('0x3e')]['List'][_0xc546('0x36')][_0xc546('0x3f')]){return _0x1eb792[_0xc546('0x3e')][_0xc546('0x35')]['Contacts'][0x0];}var _0x2a0f11=_[_0xc546('0x40')](_0x3a4a91['body'],{'firstName':_0x3a4a91[_0xc546('0x23')]['from'],'ListId':_0x544e74[_0xc546('0x41')]});_0x2a0f11[_0x3a4a91[_0xc546('0x23')][_0xc546('0x33')]]=_0x3a4a91[_0xc546('0x23')]['from'];return db[_0xc546('0x24')]['create'](_0x2a0f11,{'fields':_0x299c69,'raw':!![]});}})[_0xc546('0xf')](function(_0x5697da){_0x1eb792[_0xc546('0x42')]=_0x5697da;if(_0x5697da){var _0x402dae={'ContactId':_0x5697da['id'],'FaxAccountId':_0x3a4a91[_0xc546('0x3e')]['id'],'fax':_0x5697da[_0xc546('0x43')]};return db[_0xc546('0x44')][_0xc546('0x34')]({'where':{'ContactId':_0x5697da['id'],'closed':![],'FaxAccountId':_0x3a4a91['account']['id']}})[_0xc546('0xf')](function(_0x795763){if(_0x795763){return[_0x795763,![]];}return db[_0xc546('0x44')][_0xc546('0x45')](_0x402dae)['then'](function(_0x24270c){return[_0x24270c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc546('0x46')](function(_0x52842f,_0x194415){var _0x6eb013=_0x52842f[_0xc546('0x3a')]({'plain':!![]});if(_0x194415){if(_0x1eb792[_0xc546('0x3e')][_0xc546('0x47')]){_0x1eb792[_0xc546('0x3c')]['push']({'id':0x0,'priority':_0x1eb792['applications']['length']+0x1,'app':_0xc546('0x48'),'appdata':_0xc546('0x49'),'interval':'*,*,*,*'});}_0x6eb013[_0xc546('0x4a')]=!![];}else{_0x6eb013[_0xc546('0x4a')]=![];}_0x1eb792[_0xc546('0x4b')]=_0x6eb013;return db[_0xc546('0x4c')]['create']({'body':_0x3a4a91[_0xc546('0x23')][_0xc546('0x23')],'FaxAccountId':_0x3a4a91['account']['id'],'FaxInteractionId':_0x52842f['id'],'direction':'in','ContactId':_0x52842f['ContactId'],'AttachmentId':_0x3a4a91['body'][_0xc546('0x4d')]});})['then'](function(_0x1c2e6f){_0x1eb792[_0xc546('0x18')]=_0x1c2e6f;if(!_0x1eb792[_0xc546('0x4b')][_0xc546('0x4e')])return;return db['User'][_0xc546('0x34')]({'attributes':['id',_0xc546('0x4f')],'where':{'id':_0x1eb792[_0xc546('0x4b')][_0xc546('0x4e')]}});})['then'](function(_0x4036d0){if(_0x4036d0){_0x1eb792['applications'][_0xc546('0x50')]({'id':0x0,'priority':0x0,'app':_0xc546('0x51'),'appdata':_0x4036d0['name']+','+(_0x1eb792[_0xc546('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0xc546('0x52')});}if(!_0x1eb792[_0xc546('0x4b')]['queueId'])return;return db[_0xc546('0x53')][_0xc546('0x34')]({'attributes':['id',_0xc546('0x4f')],'where':{'id':_0x1eb792[_0xc546('0x4b')][_0xc546('0x54')]}});})['then'](function(_0x25df9e){if(_0x25df9e){_0x1eb792[_0xc546('0x3c')][_0xc546('0x50')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x25df9e['name']+','+(_0x1eb792[_0xc546('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc546('0x52')});}return respondWithRpcPromise(_0xc546('0x55'),_0xc546('0x56'),_0x1eb792);})[_0xc546('0xf')](function(_0x487a97){_0x33df0f(_0x487a97);})['catch'](function(_0x199627){_0xa90c97(_0x3ab178[_0xc546('0x15')](0x1f4,_0x199627[_0xc546('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1458ddb..babcbb8 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 _0xb2ff=['register','length','save','update','emit','removeListener'];(function(_0x5e02de,_0x35b7e4){var _0x19c3e9=function(_0x58086a){while(--_0x58086a){_0x5e02de['push'](_0x5e02de['shift']());}};_0x19c3e9(++_0x35b7e4);}(_0xb2ff,0xe0));var _0xfb2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2ff[_0x3ab51d];return _0x29a04e;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfb2f('0x0'),'remove',_0xfb2f('0x1')];function createListener(_0x23a496,_0x55c798){return function(_0x2414bb){_0x55c798[_0xfb2f('0x2')](_0x23a496,_0x2414bb);};}function removeListener(_0x456c41,_0x21abcf){return function(){FaxAccountEvents[_0xfb2f('0x3')](_0x456c41,_0x21abcf);};}exports[_0xfb2f('0x4')]=function(_0x22199a){for(var _0x349691=0x0,_0x4d6bfe=events[_0xfb2f('0x5')];_0x349691<_0x4d6bfe;_0x349691++){var _0x3d2277=events[_0x349691];var _0x266739=createListener('faxAccount:'+_0x3d2277,_0x22199a);FaxAccountEvents['on'](_0x3d2277,_0x266739);}}; \ No newline at end of file +var _0x8acf=['emit','register','length','faxAccount:','./faxAccount.events','remove'];(function(_0x238119,_0x14f6f0){var _0x55c3ca=function(_0x12d256){while(--_0x12d256){_0x238119['push'](_0x238119['shift']());}};_0x55c3ca(++_0x14f6f0);}(_0x8acf,0x1d8));var _0xf8ac=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x8acf[_0x12d951];return _0x44de17;};'use strict';var FaxAccountEvents=require(_0xf8ac('0x0'));var events=['save',_0xf8ac('0x1'),'update'];function createListener(_0x3a2d3c,_0x5add35){return function(_0x55677d){_0x5add35[_0xf8ac('0x2')](_0x3a2d3c,_0x55677d);};}function removeListener(_0x54bccd,_0x40918a){return function(){FaxAccountEvents['removeListener'](_0x54bccd,_0x40918a);};}exports[_0xf8ac('0x3')]=function(_0x114365){for(var _0x1bb380=0x0,_0x5c41e6=events[_0xf8ac('0x4')];_0x1bb380<_0x5c41e6;_0x1bb380++){var _0x107e7b=events[_0x1bb380];var _0x1a8829=createListener(_0xf8ac('0x5')+_0x107e7b,_0x114365);FaxAccountEvents['on'](_0x107e7b,_0x1a8829);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9d8fe16..41b95ab 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 _0x718c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/messages','getAgents','post','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','put','delete','/:id','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x21dad7,_0x1d36ee){var _0x5e3602=function(_0x868cb1){while(--_0x868cb1){_0x21dad7['push'](_0x21dad7['shift']());}};_0x5e3602(++_0x1d36ee);}(_0x718c,0x193));var _0xc718=function(_0xcfa0f5,_0x29f37e){_0xcfa0f5=_0xcfa0f5-0x0;var _0x2950d4=_0x718c[_0xcfa0f5];return _0x2950d4;};'use strict';var multer=require(_0xc718('0x0'));var util=require(_0xc718('0x1'));var path=require(_0xc718('0x2'));var timeout=require(_0xc718('0x3'));var express=require(_0xc718('0x4'));var router=express[_0xc718('0x5')]();var fs_extra=require(_0xc718('0x6'));var auth=require(_0xc718('0x7'));var interaction=require(_0xc718('0x8'));var config=require(_0xc718('0x9'));var controller=require(_0xc718('0xa'));router[_0xc718('0xb')]('/',auth[_0xc718('0xc')](),controller['index']);router['get'](_0xc718('0xd'),auth[_0xc718('0xc')](),controller[_0xc718('0xe')]);router[_0xc718('0xb')]('/:id',auth[_0xc718('0xc')](),controller[_0xc718('0xf')]);router[_0xc718('0xb')](_0xc718('0x10'),auth[_0xc718('0xc')](),controller[_0xc718('0x11')]);router[_0xc718('0xb')](_0xc718('0x12'),auth[_0xc718('0xc')](),controller['getAnswers']);router[_0xc718('0xb')](_0xc718('0x13'),auth['isAuthenticated'](),controller[_0xc718('0x14')]);router['get']('/:id/applications',auth[_0xc718('0xc')](),controller['getApplications']);router['get'](_0xc718('0x15'),auth[_0xc718('0xc')](),controller['getMessages']);router[_0xc718('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc718('0x16')]);router['post']('/',auth[_0xc718('0xc')](),controller['create']);router[_0xc718('0x17')](_0xc718('0x10'),auth[_0xc718('0xc')](),controller[_0xc718('0x18')]);router[_0xc718('0x17')](_0xc718('0x12'),auth['isAuthenticated'](),controller[_0xc718('0x19')]);router[_0xc718('0x17')](_0xc718('0x13'),auth[_0xc718('0xc')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xc718('0xc')](),controller[_0xc718('0x1a')]);router[_0xc718('0x17')](_0xc718('0x1b'),auth[_0xc718('0xc')](),controller[_0xc718('0x1c')]);router[_0xc718('0x17')](_0xc718('0x1d'),auth[_0xc718('0xc')](),controller[_0xc718('0x1e')]);router['post'](_0xc718('0x1f'),auth[_0xc718('0xc')](),controller[_0xc718('0x20')]);router[_0xc718('0x17')](_0xc718('0x21'),auth[_0xc718('0xc')](),controller['addAgents']);router[_0xc718('0x22')]('/:id',auth[_0xc718('0xc')](),controller['update']);router[_0xc718('0x23')](_0xc718('0x24'),auth['isAuthenticated'](),controller[_0xc718('0x25')]);router[_0xc718('0x23')](_0xc718('0x10'),auth[_0xc718('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xc718('0xc')](),controller[_0xc718('0x26')]);router[_0xc718('0x23')](_0xc718('0x21'),auth['isAuthenticated'](),controller[_0xc718('0x27')]);module[_0xc718('0x28')]=router; \ No newline at end of file +var _0x3510=['../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','/:id/dispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe45bfc,_0x5e1b01){var _0x151dd9=function(_0xfb6238){while(--_0xfb6238){_0xe45bfc['push'](_0xe45bfc['shift']());}};_0x151dd9(++_0x5e1b01);}(_0x3510,0xa8));var _0x0351=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x3510[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0351('0x0'));var util=require(_0x0351('0x1'));var path=require(_0x0351('0x2'));var timeout=require(_0x0351('0x3'));var express=require(_0x0351('0x4'));var router=express['Router']();var fs_extra=require(_0x0351('0x5'));var auth=require(_0x0351('0x6'));var interaction=require(_0x0351('0x7'));var config=require(_0x0351('0x8'));var controller=require(_0x0351('0x9'));router['get']('/',auth[_0x0351('0xa')](),controller[_0x0351('0xb')]);router[_0x0351('0xc')](_0x0351('0xd'),auth[_0x0351('0xa')](),controller['describe']);router[_0x0351('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x0351('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x0351('0xc')]('/:id/canned_answers',auth[_0x0351('0xa')](),controller['getAnswers']);router[_0x0351('0xc')](_0x0351('0xf'),auth['isAuthenticated'](),controller[_0x0351('0x10')]);router[_0x0351('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0351('0x11')]);router[_0x0351('0xc')](_0x0351('0x12'),auth['isAuthenticated'](),controller[_0x0351('0x13')]);router[_0x0351('0xc')](_0x0351('0x14'),auth['isAuthenticated'](),controller[_0x0351('0x15')]);router['post']('/',auth[_0x0351('0xa')](),controller['create']);router[_0x0351('0x16')](_0x0351('0xe'),auth[_0x0351('0xa')](),controller[_0x0351('0x17')]);router['post'](_0x0351('0x18'),auth[_0x0351('0xa')](),controller[_0x0351('0x19')]);router[_0x0351('0x16')](_0x0351('0xf'),auth[_0x0351('0xa')](),controller[_0x0351('0x1a')]);router[_0x0351('0x16')]('/:id/applications',auth[_0x0351('0xa')](),controller[_0x0351('0x1b')]);router[_0x0351('0x16')](_0x0351('0x1c'),auth[_0x0351('0xa')](),controller[_0x0351('0x1d')]);router[_0x0351('0x16')](_0x0351('0x1e'),auth[_0x0351('0xa')](),controller[_0x0351('0x1f')]);router[_0x0351('0x16')](_0x0351('0x20'),auth['isAuthenticated'](),controller[_0x0351('0x21')]);router[_0x0351('0x16')](_0x0351('0x14'),auth[_0x0351('0xa')](),controller[_0x0351('0x22')]);router[_0x0351('0x23')](_0x0351('0x24'),auth[_0x0351('0xa')](),controller[_0x0351('0x25')]);router[_0x0351('0x26')](_0x0351('0x24'),auth[_0x0351('0xa')](),controller[_0x0351('0x27')]);router[_0x0351('0x26')](_0x0351('0xe'),auth[_0x0351('0xa')](),controller[_0x0351('0x28')]);router['delete'](_0x0351('0x18'),auth['isAuthenticated'](),controller[_0x0351('0x29')]);router[_0x0351('0x26')]('/:id/users',auth[_0x0351('0xa')](),controller[_0x0351('0x2a')]);module[_0x0351('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c0f3dc7..dea71fa 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 _0xb97d=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xb97d,0x1c4));var _0xdb97=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb97d[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xdb97('0x0'));module[_0xdb97('0x1')]={'priority':{'type':Sequelize[_0xdb97('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdb97('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdb97('0x4')]()},'description':{'type':Sequelize[_0xdb97('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3bb4=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3bb4,0x87));var _0x43bb=function(_0x34da1f,_0x37a259){_0x34da1f=_0x34da1f-0x0;var _0x4897cc=_0x3bb4[_0x34da1f];return _0x4897cc;};'use strict';var Sequelize=require(_0x43bb('0x0'));module[_0x43bb('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x43bb('0x2')],'allowNull':![],'defaultValue':_0x43bb('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x43bb('0x2')]},'interval':{'type':Sequelize[_0x43bb('0x2')],'defaultValue':_0x43bb('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 83dab2a..d7df007 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 _0x1977=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x403e67,_0x19ca4c){var _0x3829c6=function(_0x222969){while(--_0x222969){_0x403e67['push'](_0x403e67['shift']());}};_0x3829c6(++_0x19ca4c);}(_0x1977,0xf0));var _0x7197=function(_0x2e4b31,_0x35851a){_0x2e4b31=_0x2e4b31-0x0;var _0x5d23f8=_0x1977[_0x2e4b31];return _0x5d23f8;};'use strict';var emlformat=require(_0x7197('0x0'));var rimraf=require(_0x7197('0x1'));var zipdir=require(_0x7197('0x2'));var jsonpatch=require(_0x7197('0x3'));var rp=require(_0x7197('0x4'));var moment=require(_0x7197('0x5'));var BPromise=require(_0x7197('0x6'));var Mustache=require(_0x7197('0x7'));var util=require('util');var path=require(_0x7197('0x8'));var sox=require(_0x7197('0x9'));var csv=require('to-csv');var ejs=require(_0x7197('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7197('0xb'));var squel=require(_0x7197('0xc'));var crypto=require(_0x7197('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7197('0xe'));var querystring=require(_0x7197('0xf'));var Papa=require('papaparse');var Redis=require(_0x7197('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7197('0x11'));var as=require(_0x7197('0x12'));var hardwareService=require(_0x7197('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7197('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7197('0x15'));var db=require(_0x7197('0x16'))['db'];function respondWithStatusCode(_0x3d1f39,_0x93944a){_0x93944a=_0x93944a||0xcc;return function(_0x43af18){if(_0x43af18){return _0x3d1f39['sendStatus'](_0x93944a);}return _0x3d1f39['status'](_0x93944a)['end']();};}function respondWithResult(_0x3bcf64,_0x2bfbc3){_0x2bfbc3=_0x2bfbc3||0xc8;return function(_0x2892c1){if(_0x2892c1){return _0x3bcf64[_0x7197('0x17')](_0x2bfbc3)[_0x7197('0x18')](_0x2892c1);}};}function respondWithFilteredResult(_0x2dd54c,_0x464c17){return function(_0x458ac5){if(_0x458ac5){var _0x508711=typeof _0x464c17[_0x7197('0x19')]===_0x7197('0x1a')&&typeof _0x464c17[_0x7197('0x1b')]===_0x7197('0x1a');var _0x3320ca=_0x458ac5[_0x7197('0x1c')];var _0x2156b0=_0x508711?0x0:_0x464c17[_0x7197('0x19')];var _0x34275a=_0x508711?_0x458ac5[_0x7197('0x1c')]:_0x464c17[_0x7197('0x19')]+_0x464c17[_0x7197('0x1b')];var _0x177855;if(_0x34275a>=_0x3320ca){_0x34275a=_0x3320ca;_0x177855=0xc8;}else{_0x177855=0xce;}_0x2dd54c[_0x7197('0x17')](_0x177855);return _0x2dd54c[_0x7197('0x1d')](_0x7197('0x1e'),_0x2156b0+'-'+_0x34275a+'/'+_0x3320ca)['json'](_0x458ac5);}return null;};}function patchUpdates(_0x1e5121){return function(_0x46092e){try{jsonpatch[_0x7197('0x1f')](_0x46092e,_0x1e5121,!![]);}catch(_0x31912d){return BPromise['reject'](_0x31912d);}return _0x46092e[_0x7197('0x20')]();};}function saveUpdates(_0x4c9e27,_0x54b73d){return function(_0x117c2f){if(_0x117c2f){return _0x117c2f[_0x7197('0x21')](_0x4c9e27)[_0x7197('0x22')](function(_0x442feb){return _0x442feb;});}return null;};}function removeEntity(_0x42ed98,_0x5476d4){return function(_0x171b42){if(_0x171b42){return _0x171b42[_0x7197('0x23')]()[_0x7197('0x22')](function(){_0x42ed98[_0x7197('0x17')](0xcc)[_0x7197('0x24')]();});}};}function handleEntityNotFound(_0x1d955c,_0x2e4bd2){return function(_0x5c60cc){if(!_0x5c60cc){_0x1d955c[_0x7197('0x25')](0x194);}return _0x5c60cc;};}function handleError(_0x3aeef3,_0x4d063a){_0x4d063a=_0x4d063a||0x1f4;return function(_0x311e23){logger[_0x7197('0x26')](_0x311e23[_0x7197('0x27')]);if(_0x311e23['name']){delete _0x311e23[_0x7197('0x28')];}_0x3aeef3['status'](_0x4d063a)[_0x7197('0x29')](_0x311e23);};}exports[_0x7197('0x2a')]=function(_0x697296,_0x35d58){var _0x5759d2={},_0x269095={},_0x2d4ce9={'count':0x0,'rows':[]};var _0x56b730=_[_0x7197('0x2b')](db[_0x7197('0x2c')][_0x7197('0x2d')],function(_0x90e0bb){return{'name':_0x90e0bb['fieldName'],'type':_0x90e0bb[_0x7197('0x2e')]['key']};});_0x269095[_0x7197('0x2f')]=_[_0x7197('0x2b')](_0x56b730,'name');_0x269095[_0x7197('0x30')]=_['keys'](_0x697296[_0x7197('0x30')]);_0x269095[_0x7197('0x31')]=_['intersection'](_0x269095[_0x7197('0x2f')],_0x269095[_0x7197('0x30')]);_0x5759d2[_0x7197('0x32')]=_[_0x7197('0x33')](_0x269095[_0x7197('0x2f')],qs[_0x7197('0x34')](_0x697296[_0x7197('0x30')][_0x7197('0x34')]));_0x5759d2[_0x7197('0x32')]=_0x5759d2['attributes'][_0x7197('0x35')]?_0x5759d2[_0x7197('0x32')]:_0x269095[_0x7197('0x2f')];if(!_0x697296[_0x7197('0x30')][_0x7197('0x36')](_0x7197('0x37'))){_0x5759d2[_0x7197('0x1b')]=qs['limit'](_0x697296[_0x7197('0x30')][_0x7197('0x1b')]);_0x5759d2[_0x7197('0x19')]=qs[_0x7197('0x19')](_0x697296['query'][_0x7197('0x19')]);}_0x5759d2[_0x7197('0x38')]=qs[_0x7197('0x39')](_0x697296[_0x7197('0x30')][_0x7197('0x39')]);_0x5759d2[_0x7197('0x3a')]=qs[_0x7197('0x31')](_[_0x7197('0x3b')](_0x697296[_0x7197('0x30')],_0x269095[_0x7197('0x31')]),_0x56b730);if(_0x697296[_0x7197('0x30')][_0x7197('0x3c')]){_0x5759d2[_0x7197('0x3a')]=_[_0x7197('0x3d')](_0x5759d2[_0x7197('0x3a')],{'$or':_['map'](_0x56b730,function(_0x154255){if(_0x154255[_0x7197('0x2e')]!==_0x7197('0x3e')){var _0x599765={};_0x599765[_0x154255[_0x7197('0x28')]]={'$like':'%'+_0x697296[_0x7197('0x30')][_0x7197('0x3c')]+'%'};return _0x599765;}})});}_0x5759d2=_[_0x7197('0x3d')]({},_0x5759d2,_0x697296[_0x7197('0x3f')]);var _0x589f68={'where':_0x5759d2['where']};return db[_0x7197('0x2c')][_0x7197('0x1c')](_0x589f68)[_0x7197('0x22')](function(_0x1110bc){_0x2d4ce9[_0x7197('0x1c')]=_0x1110bc;if(_0x697296[_0x7197('0x30')][_0x7197('0x40')]){_0x5759d2['include']=[{'all':!![]}];}return db[_0x7197('0x2c')][_0x7197('0x41')](_0x5759d2);})[_0x7197('0x22')](function(_0x287e41){_0x2d4ce9['rows']=_0x287e41;return _0x2d4ce9;})[_0x7197('0x22')](respondWithFilteredResult(_0x35d58,_0x5759d2))[_0x7197('0x42')](handleError(_0x35d58,null));};exports[_0x7197('0x43')]=function(_0x3aba5c,_0x5e8caa){var _0x3a6f79={'raw':!![],'where':{'id':_0x3aba5c[_0x7197('0x44')]['id']}},_0x55c84a={};_0x55c84a[_0x7197('0x2f')]=_['keys'](db[_0x7197('0x2c')]['rawAttributes']);_0x55c84a[_0x7197('0x30')]=_[_0x7197('0x45')](_0x3aba5c['query']);_0x55c84a['filters']=_['intersection'](_0x55c84a[_0x7197('0x2f')],_0x55c84a[_0x7197('0x30')]);_0x3a6f79['attributes']=_[_0x7197('0x33')](_0x55c84a[_0x7197('0x2f')],qs['fields'](_0x3aba5c[_0x7197('0x30')][_0x7197('0x34')]));_0x3a6f79[_0x7197('0x32')]=_0x3a6f79['attributes'][_0x7197('0x35')]?_0x3a6f79[_0x7197('0x32')]:_0x55c84a[_0x7197('0x2f')];if(_0x3aba5c[_0x7197('0x30')][_0x7197('0x40')]){_0x3a6f79[_0x7197('0x46')]=[{'all':!![]}];}_0x3a6f79=_[_0x7197('0x3d')]({},_0x3a6f79,_0x3aba5c[_0x7197('0x3f')]);return db[_0x7197('0x2c')][_0x7197('0x47')](_0x3a6f79)[_0x7197('0x22')](handleEntityNotFound(_0x5e8caa,null))[_0x7197('0x22')](respondWithResult(_0x5e8caa,null))[_0x7197('0x42')](handleError(_0x5e8caa,null));};exports[_0x7197('0x48')]=function(_0x1919bf,_0x518f0b){return db['FaxApplication'][_0x7197('0x48')](_0x1919bf[_0x7197('0x49')],{})[_0x7197('0x22')](respondWithResult(_0x518f0b,0xc9))[_0x7197('0x42')](handleError(_0x518f0b,null));};exports[_0x7197('0x21')]=function(_0x126f44,_0x1b68cb){if(_0x126f44[_0x7197('0x49')]['id']){delete _0x126f44[_0x7197('0x49')]['id'];}return db[_0x7197('0x2c')][_0x7197('0x47')]({'where':{'id':_0x126f44[_0x7197('0x44')]['id']}})[_0x7197('0x22')](handleEntityNotFound(_0x1b68cb,null))[_0x7197('0x22')](saveUpdates(_0x126f44[_0x7197('0x49')],null))['then'](respondWithResult(_0x1b68cb,null))[_0x7197('0x42')](handleError(_0x1b68cb,null));};exports[_0x7197('0x23')]=function(_0x1f8b79,_0x59fa03){return db[_0x7197('0x2c')][_0x7197('0x47')]({'where':{'id':_0x1f8b79['params']['id']}})['then'](handleEntityNotFound(_0x59fa03,null))[_0x7197('0x22')](removeEntity(_0x59fa03,null))[_0x7197('0x42')](handleError(_0x59fa03,null));}; \ No newline at end of file +var _0xae9e=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4ed3d8,_0x50bcfd){var _0x440d93=function(_0x532264){while(--_0x532264){_0x4ed3d8['push'](_0x4ed3d8['shift']());}};_0x440d93(++_0x50bcfd);}(_0xae9e,0x127));var _0xeae9=function(_0x540dac,_0x4a12dd){_0x540dac=_0x540dac-0x0;var _0x1f7862=_0xae9e[_0x540dac];return _0x1f7862;};'use strict';var emlformat=require(_0xeae9('0x0'));var rimraf=require(_0xeae9('0x1'));var zipdir=require(_0xeae9('0x2'));var jsonpatch=require(_0xeae9('0x3'));var rp=require(_0xeae9('0x4'));var moment=require('moment');var BPromise=require(_0xeae9('0x5'));var Mustache=require(_0xeae9('0x6'));var util=require(_0xeae9('0x7'));var path=require(_0xeae9('0x8'));var sox=require('sox');var csv=require(_0xeae9('0x9'));var ejs=require(_0xeae9('0xa'));var fs=require('fs');var fs_extra=require(_0xeae9('0xb'));var _=require(_0xeae9('0xc'));var squel=require(_0xeae9('0xd'));var crypto=require(_0xeae9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeae9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeae9('0x10'));var Papa=require(_0xeae9('0x11'));var Redis=require(_0xeae9('0x12'));var authService=require(_0xeae9('0x13'));var qs=require(_0xeae9('0x14'));var as=require(_0xeae9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeae9('0x16'))(_0xeae9('0x17'));var utils=require(_0xeae9('0x18'));var config=require(_0xeae9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xeae9('0x1a'))['db'];function respondWithStatusCode(_0x30ea0e,_0x362f76){_0x362f76=_0x362f76||0xcc;return function(_0x349a3d){if(_0x349a3d){return _0x30ea0e[_0xeae9('0x1b')](_0x362f76);}return _0x30ea0e['status'](_0x362f76)[_0xeae9('0x1c')]();};}function respondWithResult(_0x202ebb,_0x1f1841){_0x1f1841=_0x1f1841||0xc8;return function(_0x34da8e){if(_0x34da8e){return _0x202ebb[_0xeae9('0x1d')](_0x1f1841)[_0xeae9('0x1e')](_0x34da8e);}};}function respondWithFilteredResult(_0x5995c1,_0x5d76ca){return function(_0x3ca17e){if(_0x3ca17e){var _0x4fb0dc=typeof _0x5d76ca['offset']===_0xeae9('0x1f')&&typeof _0x5d76ca[_0xeae9('0x20')]==='undefined';var _0x44313b=_0x3ca17e[_0xeae9('0x21')];var _0x1e5f02=_0x4fb0dc?0x0:_0x5d76ca[_0xeae9('0x22')];var _0x100844=_0x4fb0dc?_0x3ca17e['count']:_0x5d76ca[_0xeae9('0x22')]+_0x5d76ca[_0xeae9('0x20')];var _0x433287;if(_0x100844>=_0x44313b){_0x100844=_0x44313b;_0x433287=0xc8;}else{_0x433287=0xce;}_0x5995c1[_0xeae9('0x1d')](_0x433287);return _0x5995c1[_0xeae9('0x23')]('Content-Range',_0x1e5f02+'-'+_0x100844+'/'+_0x44313b)[_0xeae9('0x1e')](_0x3ca17e);}return null;};}function patchUpdates(_0x4b8156){return function(_0x372b0e){try{jsonpatch['apply'](_0x372b0e,_0x4b8156,!![]);}catch(_0x12d108){return BPromise[_0xeae9('0x24')](_0x12d108);}return _0x372b0e[_0xeae9('0x25')]();};}function saveUpdates(_0x1333dd,_0x5ee8f7){return function(_0x590e73){if(_0x590e73){return _0x590e73['update'](_0x1333dd)[_0xeae9('0x26')](function(_0x389c12){return _0x389c12;});}return null;};}function removeEntity(_0x25bab2,_0x1dc5c9){return function(_0x3f127b){if(_0x3f127b){return _0x3f127b[_0xeae9('0x27')]()['then'](function(){_0x25bab2[_0xeae9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a111,_0x2661a3){return function(_0x4789ba){if(!_0x4789ba){_0x10a111[_0xeae9('0x1b')](0x194);}return _0x4789ba;};}function handleError(_0x59453c,_0x254391){_0x254391=_0x254391||0x1f4;return function(_0x1bb567){logger['error'](_0x1bb567[_0xeae9('0x28')]);if(_0x1bb567[_0xeae9('0x29')]){delete _0x1bb567['name'];}_0x59453c[_0xeae9('0x1d')](_0x254391)['send'](_0x1bb567);};}exports[_0xeae9('0x2a')]=function(_0x4881bb,_0x33f67e){var _0x609a6f={},_0xcef44f={},_0x21e705={'count':0x0,'rows':[]};var _0x29bfa1=_['map'](db[_0xeae9('0x2b')][_0xeae9('0x2c')],function(_0x3e029a){return{'name':_0x3e029a[_0xeae9('0x2d')],'type':_0x3e029a[_0xeae9('0x2e')][_0xeae9('0x2f')]};});_0xcef44f[_0xeae9('0x30')]=_[_0xeae9('0x31')](_0x29bfa1,_0xeae9('0x29'));_0xcef44f['query']=_['keys'](_0x4881bb[_0xeae9('0x32')]);_0xcef44f[_0xeae9('0x33')]=_[_0xeae9('0x34')](_0xcef44f[_0xeae9('0x30')],_0xcef44f[_0xeae9('0x32')]);_0x609a6f[_0xeae9('0x35')]=_[_0xeae9('0x34')](_0xcef44f[_0xeae9('0x30')],qs[_0xeae9('0x36')](_0x4881bb[_0xeae9('0x32')][_0xeae9('0x36')]));_0x609a6f['attributes']=_0x609a6f[_0xeae9('0x35')][_0xeae9('0x37')]?_0x609a6f[_0xeae9('0x35')]:_0xcef44f[_0xeae9('0x30')];if(!_0x4881bb[_0xeae9('0x32')][_0xeae9('0x38')](_0xeae9('0x39'))){_0x609a6f[_0xeae9('0x20')]=qs[_0xeae9('0x20')](_0x4881bb[_0xeae9('0x32')][_0xeae9('0x20')]);_0x609a6f[_0xeae9('0x22')]=qs[_0xeae9('0x22')](_0x4881bb['query'][_0xeae9('0x22')]);}_0x609a6f[_0xeae9('0x3a')]=qs[_0xeae9('0x3b')](_0x4881bb['query'][_0xeae9('0x3b')]);_0x609a6f[_0xeae9('0x3c')]=qs[_0xeae9('0x33')](_[_0xeae9('0x3d')](_0x4881bb[_0xeae9('0x32')],_0xcef44f[_0xeae9('0x33')]),_0x29bfa1);if(_0x4881bb[_0xeae9('0x32')][_0xeae9('0x3e')]){_0x609a6f[_0xeae9('0x3c')]=_[_0xeae9('0x3f')](_0x609a6f[_0xeae9('0x3c')],{'$or':_[_0xeae9('0x31')](_0x29bfa1,function(_0x1207d1){if(_0x1207d1['type']!==_0xeae9('0x40')){var _0x2f1590={};_0x2f1590[_0x1207d1[_0xeae9('0x29')]]={'$like':'%'+_0x4881bb[_0xeae9('0x32')]['filter']+'%'};return _0x2f1590;}})});}_0x609a6f=_['merge']({},_0x609a6f,_0x4881bb[_0xeae9('0x41')]);var _0x472e1f={'where':_0x609a6f[_0xeae9('0x3c')]};return db['FaxApplication'][_0xeae9('0x21')](_0x472e1f)[_0xeae9('0x26')](function(_0x548576){_0x21e705[_0xeae9('0x21')]=_0x548576;if(_0x4881bb['query'][_0xeae9('0x42')]){_0x609a6f['include']=[{'all':!![]}];}return db[_0xeae9('0x2b')]['findAll'](_0x609a6f);})[_0xeae9('0x26')](function(_0x3989a2){_0x21e705[_0xeae9('0x43')]=_0x3989a2;return _0x21e705;})[_0xeae9('0x26')](respondWithFilteredResult(_0x33f67e,_0x609a6f))['catch'](handleError(_0x33f67e,null));};exports[_0xeae9('0x44')]=function(_0x107b29,_0x8f16f){var _0x34eb17={'raw':!![],'where':{'id':_0x107b29[_0xeae9('0x45')]['id']}},_0x3579d0={};_0x3579d0[_0xeae9('0x30')]=_['keys'](db[_0xeae9('0x2b')][_0xeae9('0x2c')]);_0x3579d0[_0xeae9('0x32')]=_['keys'](_0x107b29[_0xeae9('0x32')]);_0x3579d0['filters']=_[_0xeae9('0x34')](_0x3579d0[_0xeae9('0x30')],_0x3579d0[_0xeae9('0x32')]);_0x34eb17[_0xeae9('0x35')]=_[_0xeae9('0x34')](_0x3579d0[_0xeae9('0x30')],qs[_0xeae9('0x36')](_0x107b29[_0xeae9('0x32')]['fields']));_0x34eb17[_0xeae9('0x35')]=_0x34eb17[_0xeae9('0x35')][_0xeae9('0x37')]?_0x34eb17['attributes']:_0x3579d0[_0xeae9('0x30')];if(_0x107b29[_0xeae9('0x32')]['includeAll']){_0x34eb17[_0xeae9('0x46')]=[{'all':!![]}];}_0x34eb17=_['merge']({},_0x34eb17,_0x107b29[_0xeae9('0x41')]);return db[_0xeae9('0x2b')]['find'](_0x34eb17)[_0xeae9('0x26')](handleEntityNotFound(_0x8f16f,null))[_0xeae9('0x26')](respondWithResult(_0x8f16f,null))[_0xeae9('0x47')](handleError(_0x8f16f,null));};exports[_0xeae9('0x48')]=function(_0x33947f,_0x394e86){return db['FaxApplication'][_0xeae9('0x48')](_0x33947f['body'],{})[_0xeae9('0x26')](respondWithResult(_0x394e86,0xc9))[_0xeae9('0x47')](handleError(_0x394e86,null));};exports['update']=function(_0x91de40,_0x1e0387){if(_0x91de40['body']['id']){delete _0x91de40[_0xeae9('0x49')]['id'];}return db[_0xeae9('0x2b')][_0xeae9('0x4a')]({'where':{'id':_0x91de40[_0xeae9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e0387,null))[_0xeae9('0x26')](saveUpdates(_0x91de40['body'],null))[_0xeae9('0x26')](respondWithResult(_0x1e0387,null))[_0xeae9('0x47')](handleError(_0x1e0387,null));};exports[_0xeae9('0x27')]=function(_0x41e348,_0x23894a){return db['FaxApplication'][_0xeae9('0x4a')]({'where':{'id':_0x41e348[_0xeae9('0x45')]['id']}})[_0xeae9('0x26')](handleEntityNotFound(_0x23894a,null))[_0xeae9('0x26')](removeEntity(_0x23894a,null))[_0xeae9('0x47')](handleError(_0x23894a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index be99461..57c9b97 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 _0x566d=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x4baaa2,_0x3a100a){var _0x5cfc61=function(_0x184610){while(--_0x184610){_0x4baaa2['push'](_0x4baaa2['shift']());}};_0x5cfc61(++_0x3a100a);}(_0x566d,0x6f));var _0xd566=function(_0x5a24df,_0x484e41){_0x5a24df=_0x5a24df-0x0;var _0x220b70=_0x566d[_0x5a24df];return _0x220b70;};'use strict';var _=require(_0xd566('0x0'));var util=require(_0xd566('0x1'));var logger=require(_0xd566('0x2'))(_0xd566('0x3'));var moment=require('moment');var BPromise=require(_0xd566('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd566('0x5'));var rimraf=require(_0xd566('0x6'));var config=require(_0xd566('0x7'));var attributes=require(_0xd566('0x8'));module[_0xd566('0x9')]=function(_0x8fc06c,_0x40597e){return _0x8fc06c[_0xd566('0xa')](_0xd566('0xb'),attributes,{'tableName':_0xd566('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd566('0xd'),'collate':_0xd566('0xe')});}; \ No newline at end of file +var _0xbe5e=['bluebird','request-promise','path','rimraf','./faxApplication.attributes','define','utf8mb4','lodash','util','api','moment'];(function(_0x1f8fe3,_0x3ecd11){var _0x4d7e3a=function(_0x4e90c0){while(--_0x4e90c0){_0x1f8fe3['push'](_0x1f8fe3['shift']());}};_0x4d7e3a(++_0x3ecd11);}(_0xbe5e,0xf9));var _0xebe5=function(_0xa774f1,_0x29c896){_0xa774f1=_0xa774f1-0x0;var _0x1ca101=_0xbe5e[_0xa774f1];return _0x1ca101;};'use strict';var _=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));var logger=require('../../config/logger')(_0xebe5('0x2'));var moment=require(_0xebe5('0x3'));var BPromise=require(_0xebe5('0x4'));var rp=require(_0xebe5('0x5'));var fs=require('fs');var path=require(_0xebe5('0x6'));var rimraf=require(_0xebe5('0x7'));var config=require('../../config/environment');var attributes=require(_0xebe5('0x8'));module['exports']=function(_0x2c586b,_0x586777){return _0x2c586b[_0xebe5('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebe5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 90ad909..2237001 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 _0x2138=['stringify','error','code','message','result','FaxApplication','update','body','options','raw','UpdateFaxApplication','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4a3dc0,_0xfb849e){var _0x233760=function(_0x219c91){while(--_0x219c91){_0x4a3dc0['push'](_0x4a3dc0['shift']());}};_0x233760(++_0xfb849e);}(_0x2138,0x1ce));var _0x8213=function(_0x453031,_0x56396d){_0x453031=_0x453031-0x0;var _0x4e17ba=_0x2138[_0x453031];return _0x4e17ba;};'use strict';var _=require(_0x8213('0x0'));var util=require(_0x8213('0x1'));var moment=require(_0x8213('0x2'));var BPromise=require('bluebird');var rs=require(_0x8213('0x3'));var fs=require('fs');var Redis=require(_0x8213('0x4'));var db=require(_0x8213('0x5'))['db'];var utils=require(_0x8213('0x6'));var logger=require(_0x8213('0x7'))(_0x8213('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8213('0x9')][_0x8213('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24972d,_0x3b0967,_0x168910){return new BPromise(function(_0x170d1f,_0x1540e7){return client[_0x8213('0xb')](_0x24972d,_0x168910)[_0x8213('0xc')](function(_0x1617bf){logger[_0x8213('0xd')](_0x8213('0xe'),_0x3b0967,_0x8213('0xf'));logger[_0x8213('0x10')](_0x8213('0x11'),_0x3b0967,_0x8213('0xf'),JSON[_0x8213('0x12')](_0x1617bf));if(_0x1617bf[_0x8213('0x13')]){if(_0x1617bf[_0x8213('0x13')][_0x8213('0x14')]===0x1f4){logger[_0x8213('0x13')](_0x8213('0xe'),_0x3b0967,_0x1617bf[_0x8213('0x13')][_0x8213('0x15')]);return _0x1540e7(_0x1617bf[_0x8213('0x13')]['message']);}logger['error'](_0x8213('0xe'),_0x3b0967,_0x1617bf[_0x8213('0x13')][_0x8213('0x15')]);return _0x170d1f(_0x1617bf['error'][_0x8213('0x15')]);}else{logger['info'](_0x8213('0xe'),_0x3b0967,'request\x20sent');_0x170d1f(_0x1617bf[_0x8213('0x16')][_0x8213('0x15')]);}})['catch'](function(_0x39621a){logger[_0x8213('0x13')]('FaxApplication,\x20%s,\x20%s',_0x3b0967,_0x39621a);_0x1540e7(_0x39621a);});});}exports['UpdateFaxApplication']=function(_0x3c81cc){var _0x5eec79=this;return new Promise(function(_0x39e7a9,_0x2f3e5a){return db[_0x8213('0x17')][_0x8213('0x18')](_0x3c81cc[_0x8213('0x19')],{'raw':_0x3c81cc[_0x8213('0x1a')]?_0x3c81cc[_0x8213('0x1a')][_0x8213('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c81cc[_0x8213('0x1a')]?_0x3c81cc['options']['where']||null:null,'attributes':_0x3c81cc[_0x8213('0x1a')]?_0x3c81cc[_0x8213('0x1a')]['attributes']||null:null,'limit':_0x3c81cc[_0x8213('0x1a')]?_0x3c81cc[_0x8213('0x1a')]['limit']||null:null})[_0x8213('0xc')](function(_0x130d48){logger[_0x8213('0xd')](_0x8213('0x1c'),_0x3c81cc);logger[_0x8213('0x10')](_0x8213('0x1c'),_0x3c81cc,JSON[_0x8213('0x12')](_0x130d48));_0x39e7a9(_0x130d48);})[_0x8213('0x1d')](function(_0x46a1db){logger['error']('UpdateFaxApplication',_0x46a1db['message'],_0x3c81cc);_0x2f3e5a(_0x5eec79[_0x8213('0x13')](0x1f4,_0x46a1db[_0x8213('0x15')]));});});}; \ No newline at end of file +var _0x5341=['UpdateFaxApplication','update','options','raw','where','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x506262,_0x54295a){var _0x4828f5=function(_0x3441a7){while(--_0x3441a7){_0x506262['push'](_0x506262['shift']());}};_0x4828f5(++_0x54295a);}(_0x5341,0xbb));var _0x1534=function(_0x6002a0,_0x521485){_0x6002a0=_0x6002a0-0x0;var _0x1c92f2=_0x5341[_0x6002a0];return _0x1c92f2;};'use strict';var _=require(_0x1534('0x0'));var util=require(_0x1534('0x1'));var moment=require(_0x1534('0x2'));var BPromise=require(_0x1534('0x3'));var rs=require(_0x1534('0x4'));var fs=require('fs');var Redis=require(_0x1534('0x5'));var db=require(_0x1534('0x6'))['db'];var utils=require(_0x1534('0x7'));var logger=require('../../config/logger')(_0x1534('0x8'));var config=require('../../config/environment');var jayson=require(_0x1534('0x9'));var client=jayson[_0x1534('0xa')][_0x1534('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cdde6,_0x105587,_0x5966b2){return new BPromise(function(_0x1a526d,_0x52ff7b){return client[_0x1534('0xc')](_0x1cdde6,_0x5966b2)['then'](function(_0xff330b){logger[_0x1534('0xd')](_0x1534('0xe'),_0x105587,_0x1534('0xf'));logger[_0x1534('0x10')](_0x1534('0x11'),_0x105587,_0x1534('0xf'),JSON['stringify'](_0xff330b));if(_0xff330b[_0x1534('0x12')]){if(_0xff330b[_0x1534('0x12')][_0x1534('0x13')]===0x1f4){logger[_0x1534('0x12')](_0x1534('0xe'),_0x105587,_0xff330b['error'][_0x1534('0x14')]);return _0x52ff7b(_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x105587,_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);return _0x1a526d(_0xff330b[_0x1534('0x12')][_0x1534('0x14')]);}else{logger['info'](_0x1534('0xe'),_0x105587,_0x1534('0xf'));_0x1a526d(_0xff330b[_0x1534('0x15')][_0x1534('0x14')]);}})[_0x1534('0x16')](function(_0x3e9816){logger['error'](_0x1534('0xe'),_0x105587,_0x3e9816);_0x52ff7b(_0x3e9816);});});}exports[_0x1534('0x17')]=function(_0x31c5f9){var _0x39d5cb=this;return new Promise(function(_0x38dc45,_0x212445){return db['FaxApplication'][_0x1534('0x18')](_0x31c5f9['body'],{'raw':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9['options'][_0x1534('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')][_0x1534('0x1b')]||null:null,'attributes':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')]['attributes']||null:null,'limit':_0x31c5f9[_0x1534('0x19')]?_0x31c5f9[_0x1534('0x19')][_0x1534('0x1c')]||null:null})['then'](function(_0x2003d7){logger[_0x1534('0xd')](_0x1534('0x17'),_0x31c5f9);logger[_0x1534('0x10')](_0x1534('0x17'),_0x31c5f9,JSON[_0x1534('0x1d')](_0x2003d7));_0x38dc45(_0x2003d7);})[_0x1534('0x16')](function(_0x408d34){logger[_0x1534('0x12')](_0x1534('0x17'),_0x408d34[_0x1534('0x14')],_0x31c5f9);_0x212445(_0x39d5cb[_0x1534('0x12')](0x1f4,_0x408d34[_0x1534('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9a8f99b..ac7eb93 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x4a4d88,_0x2be95a){var _0x479329=function(_0x37bb8e){while(--_0x37bb8e){_0x4a4d88['push'](_0x4a4d88['shift']());}};_0x479329(++_0x2be95a);}(_0xda2d,0x102));var _0xdda2=function(_0x1c04f5,_0x4994cb){_0x1c04f5=_0x1c04f5-0x0;var _0x351019=_0xda2d[_0x1c04f5];return _0x351019;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x0b0e[_0x3d8d0a];return _0x5b9df5;};'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 fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d6ca20e..d33c66b 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 _0x583c=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5a5c11,_0x358f6b){var _0x5d6ba7=function(_0x272c72){while(--_0x272c72){_0x5a5c11['push'](_0x5a5c11['shift']());}};_0x5d6ba7(++_0x358f6b);}(_0x583c,0x12b));var _0xc583=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x583c[_0x54a9e3];return _0x247cce;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'closed':{'type':Sequelize[_0xc583('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc583('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc583('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc583('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc583('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc583('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in',_0xc583('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc583('0x7')]}}; \ No newline at end of file +var _0x8aad=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x3913ff,_0x167ae0){var _0x41cb3b=function(_0x12f3c3){while(--_0x12f3c3){_0x3913ff['push'](_0x3913ff['shift']());}};_0x41cb3b(++_0x167ae0);}(_0x8aad,0x146));var _0xd8aa=function(_0x5b0cdf,_0x43746a){_0x5b0cdf=_0x5b0cdf-0x0;var _0x403183=_0x8aad[_0x5b0cdf];return _0x403183;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8aa('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd8aa('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8aa('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd8aa('0x4')]('in',_0xd8aa('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index f8c1428..105da43 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 _0xdd04=['zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','socket.io-emitter','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','then','destroy','end','error','stack','name','index','FaxInteraction','rawAttributes','type','findAll','user','catch','model','keys','query','attributes','intersection','fields','length','include','merge','options','find','create','body','update','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','filters','FaxInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','Tag','color','emit','removeTags','download','toString','root','server','files','tmp','join','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','err','unlinkSync','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdd04,0x187));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x4dd0('0x0'));var zipdir=require(_0x4dd0('0x1'));var moment=require(_0x4dd0('0x2'));var BPromise=require(_0x4dd0('0x3'));var util=require(_0x4dd0('0x4'));var path=require(_0x4dd0('0x5'));var fs=require('fs');var _=require(_0x4dd0('0x6'));var Redis=require(_0x4dd0('0x7'));var interaction=require(_0x4dd0('0x8'));var qs=require(_0x4dd0('0x9'));var logger=require(_0x4dd0('0xa'))('api');var config=require('../../config/environment');var db=require(_0x4dd0('0xb'))['db'];config[_0x4dd0('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4dd0('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2eaf72,_0x28fff4){_0x28fff4=_0x28fff4||0xcc;return function(_0x3ea4c9){if(_0x3ea4c9){return _0x2eaf72[_0x4dd0('0xe')](_0x28fff4);}return _0x2eaf72[_0x4dd0('0xf')](_0x28fff4)['end']();};}function respondWithResult(_0x104151,_0x4917c9){_0x4917c9=_0x4917c9||0xc8;return function(_0x381502){if(_0x381502){return _0x104151[_0x4dd0('0xf')](_0x4917c9)[_0x4dd0('0x10')](_0x381502);}};}function respondWithFilteredResult(_0x4cd18b,_0x4c1267){return function(_0x3c0055){if(_0x3c0055){var _0x339210=typeof _0x4c1267['offset']===_0x4dd0('0x11')&&typeof _0x4c1267[_0x4dd0('0x12')]===_0x4dd0('0x11');var _0x57ef62=_0x3c0055['count'];var _0x330a78=_0x339210?0x0:_0x4c1267[_0x4dd0('0x13')];var _0x2b66df=_0x339210?_0x3c0055[_0x4dd0('0x14')]:_0x4c1267['offset']+_0x4c1267[_0x4dd0('0x12')];var _0x519f3f;if(_0x2b66df>=_0x57ef62){_0x2b66df=_0x57ef62;_0x519f3f=0xc8;}else{_0x519f3f=0xce;}_0x4cd18b[_0x4dd0('0xf')](_0x519f3f);return _0x4cd18b[_0x4dd0('0x15')](_0x4dd0('0x16'),_0x330a78+'-'+_0x2b66df+'/'+_0x57ef62)['json'](_0x3c0055);}return null;};}function saveUpdates(_0x1d66fa){return function(_0x44924d){if(_0x44924d){return _0x44924d['update'](_0x1d66fa)[_0x4dd0('0x17')](function(_0x20fcbe){return _0x20fcbe;});}return null;};}function removeEntity(_0x377d34){return function(_0x559813){if(_0x559813){return _0x559813[_0x4dd0('0x18')]()[_0x4dd0('0x17')](function(){_0x377d34[_0x4dd0('0xf')](0xcc)[_0x4dd0('0x19')]();});}};}function handleEntityNotFound(_0x5172f8){return function(_0x3ac41c){if(!_0x3ac41c){_0x5172f8[_0x4dd0('0xe')](0x194);}return _0x3ac41c;};}function handleError(_0x445e83,_0x5db554){_0x5db554=_0x5db554||0x1f4;return function(_0x3d55c){logger[_0x4dd0('0x1a')](_0x3d55c[_0x4dd0('0x1b')]);if(_0x3d55c[_0x4dd0('0x1c')]){delete _0x3d55c[_0x4dd0('0x1c')];}_0x445e83[_0x4dd0('0xf')](_0x5db554)['send'](_0x3d55c);};}exports[_0x4dd0('0x1d')]=function(_0x321c1f,_0x5b9ba8){var _0xb8350f={};var _0x5046b5=_['map'](db[_0x4dd0('0x1e')][_0x4dd0('0x1f')],function(_0x229884){return{'name':_0x229884['fieldName'],'type':_0x229884[_0x4dd0('0x20')]['key']};});_0xb8350f=qs['getOptions'](_0x5046b5,_0x321c1f);return interaction[_0x4dd0('0x21')]('fax',_0x321c1f['query'],_0x321c1f[_0x4dd0('0x22')],_0xb8350f,_0x5046b5)[_0x4dd0('0x17')](respondWithFilteredResult(_0x5b9ba8,_0xb8350f))[_0x4dd0('0x23')](handleError(_0x5b9ba8,null));};exports['show']=function(_0x17b051,_0x2875c6){var _0x562b72={'raw':![],'where':{'id':_0x17b051['params']['id']}},_0x151566={};_0x151566[_0x4dd0('0x24')]=_[_0x4dd0('0x25')](db['FaxInteraction']['rawAttributes']);_0x151566[_0x4dd0('0x26')]=_[_0x4dd0('0x25')](_0x17b051['query']);_0x151566['filters']=_['intersection'](_0x151566[_0x4dd0('0x24')],_0x151566['query']);_0x562b72[_0x4dd0('0x27')]=_[_0x4dd0('0x28')](_0x151566[_0x4dd0('0x24')],qs[_0x4dd0('0x29')](_0x17b051[_0x4dd0('0x26')][_0x4dd0('0x29')]));_0x562b72[_0x4dd0('0x27')]=_0x562b72[_0x4dd0('0x27')][_0x4dd0('0x2a')]?_0x562b72[_0x4dd0('0x27')]:_0x151566[_0x4dd0('0x24')];if(_0x17b051[_0x4dd0('0x26')]['includeAll']){_0x562b72[_0x4dd0('0x2b')]=[{'all':!![]}];}_0x562b72=_[_0x4dd0('0x2c')]({},_0x562b72,_0x17b051[_0x4dd0('0x2d')]);return db[_0x4dd0('0x1e')][_0x4dd0('0x2e')](_0x562b72)['then'](handleEntityNotFound(_0x2875c6,null))[_0x4dd0('0x17')](respondWithResult(_0x2875c6,null))[_0x4dd0('0x23')](handleError(_0x2875c6,null));};exports[_0x4dd0('0x2f')]=function(_0x3c9f6a,_0x3f1e17){return db['FaxInteraction'][_0x4dd0('0x2f')](_0x3c9f6a[_0x4dd0('0x30')],{})['then'](respondWithResult(_0x3f1e17,0xc9))['catch'](handleError(_0x3f1e17,null));};exports[_0x4dd0('0x31')]=function(_0x22568e,_0xb11ddb){if(_0x22568e[_0x4dd0('0x30')]['id']){delete _0x22568e[_0x4dd0('0x30')]['id'];}return db[_0x4dd0('0x1e')][_0x4dd0('0x2e')]({'where':{'id':_0x22568e[_0x4dd0('0x32')]['id']}})[_0x4dd0('0x17')](handleEntityNotFound(_0xb11ddb,null))[_0x4dd0('0x17')](saveUpdates(_0x22568e['body'],null))[_0x4dd0('0x17')](respondWithResult(_0xb11ddb,null))[_0x4dd0('0x23')](handleError(_0xb11ddb,null));};exports[_0x4dd0('0x18')]=function(_0x135397,_0x21185c){return db[_0x4dd0('0x1e')][_0x4dd0('0x2e')]({'where':{'id':_0x135397[_0x4dd0('0x32')]['id']}})[_0x4dd0('0x17')](handleEntityNotFound(_0x21185c,null))[_0x4dd0('0x17')](removeEntity(_0x21185c,null))[_0x4dd0('0x23')](handleError(_0x21185c,null));};exports[_0x4dd0('0x33')]=function(_0x4b10eb,_0x3d371f){return db[_0x4dd0('0x1e')][_0x4dd0('0x33')]()['then'](respondWithResult(_0x3d371f,null))['catch'](handleError(_0x3d371f,null));};exports[_0x4dd0('0x34')]=function(_0x42da34,_0x41c017){return db[_0x4dd0('0x35')][_0x4dd0('0x2e')]({'where':{'id':_0x42da34[_0x4dd0('0x32')]['id']}})[_0x4dd0('0x17')](handleEntityNotFound(_0x41c017,null))[_0x4dd0('0x17')](function(_0x1baea7){if(_0x1baea7){return _0x1baea7[_0x4dd0('0x34')](_0x42da34[_0x4dd0('0x30')][_0x4dd0('0x36')],_[_0x4dd0('0x37')](_0x42da34[_0x4dd0('0x30')],[_0x4dd0('0x36'),'id'])||{});}})[_0x4dd0('0x17')](respondWithResult(_0x41c017,null))[_0x4dd0('0x23')](handleError(_0x41c017,null));};exports[_0x4dd0('0x38')]=function(_0x39bec2,_0xb6db9f){var _0x334e16={'raw':![],'where':{}};var _0x591d60={};var _0x48b4c8={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x4dd0('0x39')]({'where':{'id':_0x39bec2['params']['id']}})['then'](handleEntityNotFound(_0xb6db9f,null))[_0x4dd0('0x17')](function(_0x5bb728){if(_0x5bb728){_0x591d60['model']=_[_0x4dd0('0x25')](db[_0x4dd0('0x35')][_0x4dd0('0x1f')]);_0x591d60[_0x4dd0('0x26')]=_[_0x4dd0('0x25')](_0x39bec2[_0x4dd0('0x26')]);_0x591d60['filters']=_[_0x4dd0('0x28')](_0x591d60[_0x4dd0('0x24')],_0x591d60[_0x4dd0('0x26')]);_0x334e16[_0x4dd0('0x27')]=_[_0x4dd0('0x28')](_0x591d60['model'],qs[_0x4dd0('0x29')](_0x39bec2[_0x4dd0('0x26')]['fields']));_0x334e16[_0x4dd0('0x27')]=_0x334e16[_0x4dd0('0x27')]['length']?_0x334e16[_0x4dd0('0x27')]:_0x591d60[_0x4dd0('0x24')];if(!_0x39bec2[_0x4dd0('0x26')]['hasOwnProperty'](_0x4dd0('0x3a'))){_0x334e16[_0x4dd0('0x12')]=qs['limit'](_0x39bec2['query'][_0x4dd0('0x12')]);_0x334e16[_0x4dd0('0x13')]=qs[_0x4dd0('0x13')](_0x39bec2[_0x4dd0('0x26')]['offset']);}_0x334e16[_0x4dd0('0x3b')]=qs[_0x4dd0('0x3c')](_0x39bec2[_0x4dd0('0x26')][_0x4dd0('0x3c')]);_0x334e16[_0x4dd0('0x3d')]=qs['filters'](_['pick'](_0x39bec2[_0x4dd0('0x26')],_0x591d60[_0x4dd0('0x3e')]));_0x334e16['where'][_0x4dd0('0x3f')]=_0x5bb728['id'];if(_0x39bec2['query']['filter']){_0x334e16[_0x4dd0('0x3d')]=_[_0x4dd0('0x2c')](_0x334e16[_0x4dd0('0x3d')],{'$or':_[_0x4dd0('0x40')](_0x334e16[_0x4dd0('0x27')],function(_0x5eefb1){var _0x2e858a={};_0x2e858a[_0x5eefb1]={'$like':'%'+_0x39bec2[_0x4dd0('0x26')][_0x4dd0('0x41')]+'%'};return _0x2e858a;})});}if(_0x39bec2[_0x4dd0('0x26')][_0x4dd0('0x42')]){var _0x40ccd8=_0x39bec2[_0x4dd0('0x26')][_0x4dd0('0x42')][_0x4dd0('0x43')](',');var _0xe466d1={};_0xe466d1[_0x40ccd8[0x0]]={'$gte':moment(_0x40ccd8[0x1])[_0x4dd0('0x44')](_0x4dd0('0x45'))};_0x334e16[_0x4dd0('0x3d')]=_[_0x4dd0('0x2c')](_0x334e16[_0x4dd0('0x3d')],_0xe466d1);}_0x334e16=_[_0x4dd0('0x2c')]({},_0x334e16,_0x39bec2[_0x4dd0('0x2d')]);return db[_0x4dd0('0x35')][_0x4dd0('0x14')]({'where':_0x334e16[_0x4dd0('0x3d')]})[_0x4dd0('0x17')](function(_0x57167e){_0x48b4c8[_0x4dd0('0x14')]=_0x57167e;if(_0x39bec2[_0x4dd0('0x26')][_0x4dd0('0x46')]){_0x334e16[_0x4dd0('0x2b')]=[{'all':!![]}];}return db[_0x4dd0('0x35')]['findAll'](_0x334e16);})[_0x4dd0('0x17')](function(_0x513045){_0x48b4c8[_0x4dd0('0x47')]=_0x513045;return _0x48b4c8;});}})[_0x4dd0('0x17')](respondWithFilteredResult(_0xb6db9f,_0x334e16))[_0x4dd0('0x23')](handleError(_0xb6db9f,null));};exports['addTags']=function(_0x8ddcad,_0x42ef7b){return db[_0x4dd0('0x1e')][_0x4dd0('0x2e')]({'where':{'id':_0x8ddcad[_0x4dd0('0x32')]['id']}})['then'](handleEntityNotFound(_0x42ef7b,null))[_0x4dd0('0x17')](function(_0x3337cf){if(_0x3337cf){return _0x3337cf[_0x4dd0('0x48')](_0x8ddcad[_0x4dd0('0x30')][_0x4dd0('0x36')],_['omit'](_0x8ddcad[_0x4dd0('0x30')],[_0x4dd0('0x36'),'id'])||{})[_0x4dd0('0x49')](function(){return db[_0x4dd0('0x4a')][_0x4dd0('0x21')]({'attributes':['id',_0x4dd0('0x1c'),_0x4dd0('0x4b')],'where':{'id':_0x8ddcad['body'][_0x4dd0('0x36')]}});})[_0x4dd0('0x17')](function(_0x43aca1){socket[_0x4dd0('0x4c')]('faxInteractionTags:save',{'id':Number(_0x8ddcad[_0x4dd0('0x32')]['id']),'tags':_0x43aca1||[]});return{'id':Number(_0x8ddcad[_0x4dd0('0x32')]['id']),'tags':_0x43aca1||[]};});}})[_0x4dd0('0x17')](respondWithResult(_0x42ef7b,null))[_0x4dd0('0x23')](handleError(_0x42ef7b,null));};exports[_0x4dd0('0x4d')]=function(_0x2e97ef,_0xa004fc){return db['FaxInteraction'][_0x4dd0('0x2e')]({'where':{'id':_0x2e97ef[_0x4dd0('0x32')]['id']}})[_0x4dd0('0x17')](handleEntityNotFound(_0xa004fc,null))[_0x4dd0('0x17')](function(_0x4236bb){if(_0x4236bb){return _0x4236bb[_0x4dd0('0x4d')](_0x2e97ef[_0x4dd0('0x26')]['ids']);}})['then'](respondWithStatusCode(_0xa004fc,null))[_0x4dd0('0x23')](handleError(_0xa004fc,null));};exports[_0x4dd0('0x4e')]=function(_0x592515,_0x58e9b6){var _0xf87748=moment()['unix']()[_0x4dd0('0x4f')]();var _0x35885a=path['join'](config[_0x4dd0('0x50')],_0x4dd0('0x51'),_0x4dd0('0x52'),_0x4dd0('0x53'));var _0x12abb1=path[_0x4dd0('0x54')](config[_0x4dd0('0x50')],_0x4dd0('0x51'),_0x4dd0('0x52'),_0x4dd0('0x55'));var _0x3e38f4=path[_0x4dd0('0x54')](_0x35885a,_0xf87748);var _0x56564e=util[_0x4dd0('0x44')]('transcript-%d-%s.zip',_0x592515[_0x4dd0('0x32')]['id'],_0xf87748);var _0x562e25=path[_0x4dd0('0x54')](_0x35885a,_0x56564e);var _0x56cbee=[];_0x56cbee[_0x4dd0('0x56')]({'model':db['Attachment'],'as':_0x4dd0('0x57'),'raw':!![]});var _0x410189=[{'model':db['FaxMessage'],'as':_0x4dd0('0x58'),'attributes':['id',_0x4dd0('0x30'),_0x4dd0('0x59')],'include':_0x56cbee}];return db['FaxInteraction']['find']({'where':{'id':_0x592515[_0x4dd0('0x32')]['id']},'include':_0x410189})[_0x4dd0('0x17')](handleEntityNotFound(_0x58e9b6,null))[_0x4dd0('0x17')](function(_0x5305e7){if(_0x5305e7&&_0x5305e7['Messages']){var _0x21b90d=_0x5305e7[_0x4dd0('0x5a')]({'plain':!![]});fs[_0x4dd0('0x5b')](_0x3e38f4);for(var _0xe364b4=0x0;_0xe364b4<_0x21b90d[_0x4dd0('0x58')][_0x4dd0('0x2a')];_0xe364b4++){var _0x5be4c=_0x21b90d['Messages'][_0xe364b4][_0x4dd0('0x57')];if(_0x5be4c){var _0x2f293a=path[_0x4dd0('0x54')](_0x12abb1,_0x5be4c[_0x4dd0('0x5c')]);if(fs[_0x4dd0('0x5d')](_0x2f293a)){fs[_0x4dd0('0x5e')](_0x2f293a)['pipe'](fs[_0x4dd0('0x5f')](path[_0x4dd0('0x54')](_0x3e38f4,_0x5be4c[_0x4dd0('0x5c')])));}}}return BPromise['resolve']()[_0x4dd0('0x17')](function(){return new BPromise(function(_0x5cfedb,_0x383a96){zipdir(_0x3e38f4,{'saveTo':_0x562e25},function(_0x207c87,_0x4edf0d){if(_0x207c87)return _0x383a96(_0x207c87);return _0x5cfedb(_0x4edf0d);});})[_0x4dd0('0x17')](function(){return new BPromise(function(_0x4ea8be,_0x2690bb){rimraf(_0x3e38f4,function(_0x6b796e){if(_0x6b796e)_0x2690bb(_0x6b796e);return _0x4ea8be();});});})['then'](function(){return _0x58e9b6[_0x4dd0('0x4e')](_0x562e25,_0x56564e,function(_0x18dbf2){if(_0x18dbf2){console['log'](_0x4dd0('0x60'),_0x18dbf2);}else{fs[_0x4dd0('0x61')](_0x562e25);}});});});}else{return _0x58e9b6[_0x4dd0('0xe')](0xc8);}})['catch'](handleError(_0x58e9b6,null));}; \ No newline at end of file +var _0xf2d6=['util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','register','status','json','offset','limit','undefined','count','destroy','then','end','error','stack','name','send','index','map','rawAttributes','type','key','findAll','fax','user','catch','show','params','FaxInteraction','keys','query','filters','intersection','attributes','fields','length','model','include','options','find','create','body','update','describe','addMessage','FaxMessage','ids','findOne','hasOwnProperty','nolimit','sort','where','pick','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','pipe','createWriteStream','resolve','download','err','sendStatus','rimraf','zip-dir','moment'];(function(_0x2c0d65,_0x132871){var _0x533b01=function(_0xdaa9d5){while(--_0xdaa9d5){_0x2c0d65['push'](_0x2c0d65['shift']());}};_0x533b01(++_0x132871);}(_0xf2d6,0xc5));var _0x6f2d=function(_0x5d0206,_0xecf9a3){_0x5d0206=_0x5d0206-0x0;var _0x419f0e=_0xf2d6[_0x5d0206];return _0x419f0e;};'use strict';var rimraf=require(_0x6f2d('0x0'));var zipdir=require(_0x6f2d('0x1'));var moment=require(_0x6f2d('0x2'));var BPromise=require('bluebird');var util=require(_0x6f2d('0x3'));var path=require(_0x6f2d('0x4'));var fs=require('fs');var _=require(_0x6f2d('0x5'));var Redis=require('ioredis');var interaction=require(_0x6f2d('0x6'));var qs=require(_0x6f2d('0x7'));var logger=require(_0x6f2d('0x8'))('api');var config=require(_0x6f2d('0x9'));var db=require(_0x6f2d('0xa'))['db'];config['redis']=_[_0x6f2d('0xb')](config[_0x6f2d('0xc')],{'host':_0x6f2d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f2d('0xe'))[_0x6f2d('0xf')](socket);function respondWithStatusCode(_0x32401d,_0x4fd559){_0x4fd559=_0x4fd559||0xcc;return function(_0x3af24b){if(_0x3af24b){return _0x32401d['sendStatus'](_0x4fd559);}return _0x32401d['status'](_0x4fd559)['end']();};}function respondWithResult(_0x2b41b3,_0x276f2e){_0x276f2e=_0x276f2e||0xc8;return function(_0x262a19){if(_0x262a19){return _0x2b41b3[_0x6f2d('0x10')](_0x276f2e)[_0x6f2d('0x11')](_0x262a19);}};}function respondWithFilteredResult(_0x3ee6d1,_0x40327a){return function(_0x4f33d4){if(_0x4f33d4){var _0x41973d=typeof _0x40327a[_0x6f2d('0x12')]==='undefined'&&typeof _0x40327a[_0x6f2d('0x13')]===_0x6f2d('0x14');var _0x39fcaa=_0x4f33d4[_0x6f2d('0x15')];var _0x3ca493=_0x41973d?0x0:_0x40327a['offset'];var _0x2ed946=_0x41973d?_0x4f33d4[_0x6f2d('0x15')]:_0x40327a['offset']+_0x40327a[_0x6f2d('0x13')];var _0x54c9e0;if(_0x2ed946>=_0x39fcaa){_0x2ed946=_0x39fcaa;_0x54c9e0=0xc8;}else{_0x54c9e0=0xce;}_0x3ee6d1[_0x6f2d('0x10')](_0x54c9e0);return _0x3ee6d1['set']('Content-Range',_0x3ca493+'-'+_0x2ed946+'/'+_0x39fcaa)[_0x6f2d('0x11')](_0x4f33d4);}return null;};}function saveUpdates(_0x2e0b8a){return function(_0xbdf0f0){if(_0xbdf0f0){return _0xbdf0f0['update'](_0x2e0b8a)['then'](function(_0x4cbc4c){return _0x4cbc4c;});}return null;};}function removeEntity(_0x41225a){return function(_0x573930){if(_0x573930){return _0x573930[_0x6f2d('0x16')]()[_0x6f2d('0x17')](function(){_0x41225a[_0x6f2d('0x10')](0xcc)[_0x6f2d('0x18')]();});}};}function handleEntityNotFound(_0x6a35e6){return function(_0x44b146){if(!_0x44b146){_0x6a35e6['sendStatus'](0x194);}return _0x44b146;};}function handleError(_0x4cac43,_0x367e08){_0x367e08=_0x367e08||0x1f4;return function(_0x5768db){logger[_0x6f2d('0x19')](_0x5768db[_0x6f2d('0x1a')]);if(_0x5768db['name']){delete _0x5768db[_0x6f2d('0x1b')];}_0x4cac43[_0x6f2d('0x10')](_0x367e08)[_0x6f2d('0x1c')](_0x5768db);};}exports[_0x6f2d('0x1d')]=function(_0x350a71,_0x375984){var _0x3d6f5b={};var _0x5f4688=_[_0x6f2d('0x1e')](db['FaxInteraction'][_0x6f2d('0x1f')],function(_0x4277e2){return{'name':_0x4277e2['fieldName'],'type':_0x4277e2[_0x6f2d('0x20')][_0x6f2d('0x21')]};});_0x3d6f5b=qs['getOptions'](_0x5f4688,_0x350a71);return interaction[_0x6f2d('0x22')](_0x6f2d('0x23'),_0x350a71['query'],_0x350a71[_0x6f2d('0x24')],_0x3d6f5b,_0x5f4688)[_0x6f2d('0x17')](respondWithFilteredResult(_0x375984,_0x3d6f5b))[_0x6f2d('0x25')](handleError(_0x375984,null));};exports[_0x6f2d('0x26')]=function(_0x204796,_0x1c472a){var _0x21598e={'raw':![],'where':{'id':_0x204796[_0x6f2d('0x27')]['id']}},_0x4bc53c={};_0x4bc53c['model']=_['keys'](db[_0x6f2d('0x28')][_0x6f2d('0x1f')]);_0x4bc53c['query']=_[_0x6f2d('0x29')](_0x204796[_0x6f2d('0x2a')]);_0x4bc53c[_0x6f2d('0x2b')]=_[_0x6f2d('0x2c')](_0x4bc53c['model'],_0x4bc53c[_0x6f2d('0x2a')]);_0x21598e[_0x6f2d('0x2d')]=_['intersection'](_0x4bc53c['model'],qs[_0x6f2d('0x2e')](_0x204796['query'][_0x6f2d('0x2e')]));_0x21598e[_0x6f2d('0x2d')]=_0x21598e[_0x6f2d('0x2d')][_0x6f2d('0x2f')]?_0x21598e[_0x6f2d('0x2d')]:_0x4bc53c[_0x6f2d('0x30')];if(_0x204796[_0x6f2d('0x2a')]['includeAll']){_0x21598e[_0x6f2d('0x31')]=[{'all':!![]}];}_0x21598e=_['merge']({},_0x21598e,_0x204796[_0x6f2d('0x32')]);return db[_0x6f2d('0x28')][_0x6f2d('0x33')](_0x21598e)['then'](handleEntityNotFound(_0x1c472a,null))[_0x6f2d('0x17')](respondWithResult(_0x1c472a,null))[_0x6f2d('0x25')](handleError(_0x1c472a,null));};exports['create']=function(_0x34c8f9,_0x31d081){return db[_0x6f2d('0x28')][_0x6f2d('0x34')](_0x34c8f9[_0x6f2d('0x35')],{})[_0x6f2d('0x17')](respondWithResult(_0x31d081,0xc9))['catch'](handleError(_0x31d081,null));};exports[_0x6f2d('0x36')]=function(_0x696805,_0x3fc101){if(_0x696805['body']['id']){delete _0x696805[_0x6f2d('0x35')]['id'];}return db['FaxInteraction'][_0x6f2d('0x33')]({'where':{'id':_0x696805[_0x6f2d('0x27')]['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x3fc101,null))[_0x6f2d('0x17')](saveUpdates(_0x696805['body'],null))[_0x6f2d('0x17')](respondWithResult(_0x3fc101,null))['catch'](handleError(_0x3fc101,null));};exports[_0x6f2d('0x16')]=function(_0x3c99f2,_0x2d935e){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x3c99f2['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x2d935e,null))[_0x6f2d('0x17')](removeEntity(_0x2d935e,null))[_0x6f2d('0x25')](handleError(_0x2d935e,null));};exports[_0x6f2d('0x37')]=function(_0x352574,_0x45f831){return db[_0x6f2d('0x28')]['describe']()[_0x6f2d('0x17')](respondWithResult(_0x45f831,null))[_0x6f2d('0x25')](handleError(_0x45f831,null));};exports[_0x6f2d('0x38')]=function(_0x48de04,_0x5352c0){return db[_0x6f2d('0x39')][_0x6f2d('0x33')]({'where':{'id':_0x48de04['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x5352c0,null))[_0x6f2d('0x17')](function(_0x5d0bcc){if(_0x5d0bcc){return _0x5d0bcc['addMessage'](_0x48de04['body'][_0x6f2d('0x3a')],_['omit'](_0x48de04[_0x6f2d('0x35')],[_0x6f2d('0x3a'),'id'])||{});}})[_0x6f2d('0x17')](respondWithResult(_0x5352c0,null))['catch'](handleError(_0x5352c0,null));};exports['getMessages']=function(_0x2721ac,_0x1deacd){var _0x1e1c22={'raw':![],'where':{}};var _0x36980a={};var _0xb9a933={'count':0x0,'rows':[]};return db[_0x6f2d('0x28')][_0x6f2d('0x3b')]({'where':{'id':_0x2721ac['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x1deacd,null))[_0x6f2d('0x17')](function(_0xef21b3){if(_0xef21b3){_0x36980a[_0x6f2d('0x30')]=_[_0x6f2d('0x29')](db[_0x6f2d('0x39')][_0x6f2d('0x1f')]);_0x36980a[_0x6f2d('0x2a')]=_[_0x6f2d('0x29')](_0x2721ac[_0x6f2d('0x2a')]);_0x36980a[_0x6f2d('0x2b')]=_[_0x6f2d('0x2c')](_0x36980a[_0x6f2d('0x30')],_0x36980a[_0x6f2d('0x2a')]);_0x1e1c22[_0x6f2d('0x2d')]=_[_0x6f2d('0x2c')](_0x36980a['model'],qs[_0x6f2d('0x2e')](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x2e')]));_0x1e1c22[_0x6f2d('0x2d')]=_0x1e1c22[_0x6f2d('0x2d')]['length']?_0x1e1c22[_0x6f2d('0x2d')]:_0x36980a[_0x6f2d('0x30')];if(!_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x3c')](_0x6f2d('0x3d'))){_0x1e1c22[_0x6f2d('0x13')]=qs['limit'](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x13')]);_0x1e1c22[_0x6f2d('0x12')]=qs['offset'](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x12')]);}_0x1e1c22['order']=qs[_0x6f2d('0x3e')](_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x3e')]);_0x1e1c22[_0x6f2d('0x3f')]=qs['filters'](_[_0x6f2d('0x40')](_0x2721ac[_0x6f2d('0x2a')],_0x36980a[_0x6f2d('0x2b')]));_0x1e1c22['where']['FaxInteractionId']=_0xef21b3['id'];if(_0x2721ac[_0x6f2d('0x2a')]['filter']){_0x1e1c22[_0x6f2d('0x3f')]=_[_0x6f2d('0x41')](_0x1e1c22[_0x6f2d('0x3f')],{'$or':_[_0x6f2d('0x1e')](_0x1e1c22[_0x6f2d('0x2d')],function(_0x43995a){var _0xe3155={};_0xe3155[_0x43995a]={'$like':'%'+_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x42')]+'%'};return _0xe3155;})});}if(_0x2721ac['query']['$gte']){var _0x8771c=_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x43')][_0x6f2d('0x44')](',');var _0x3f022c={};_0x3f022c[_0x8771c[0x0]]={'$gte':moment(_0x8771c[0x1])['format'](_0x6f2d('0x45'))};_0x1e1c22['where']=_[_0x6f2d('0x41')](_0x1e1c22[_0x6f2d('0x3f')],_0x3f022c);}_0x1e1c22=_[_0x6f2d('0x41')]({},_0x1e1c22,_0x2721ac[_0x6f2d('0x32')]);return db[_0x6f2d('0x39')][_0x6f2d('0x15')]({'where':_0x1e1c22[_0x6f2d('0x3f')]})['then'](function(_0x119351){_0xb9a933[_0x6f2d('0x15')]=_0x119351;if(_0x2721ac[_0x6f2d('0x2a')][_0x6f2d('0x46')]){_0x1e1c22[_0x6f2d('0x31')]=[{'all':!![]}];}return db[_0x6f2d('0x39')][_0x6f2d('0x22')](_0x1e1c22);})[_0x6f2d('0x17')](function(_0x560f9a){_0xb9a933[_0x6f2d('0x47')]=_0x560f9a;return _0xb9a933;});}})[_0x6f2d('0x17')](respondWithFilteredResult(_0x1deacd,_0x1e1c22))[_0x6f2d('0x25')](handleError(_0x1deacd,null));};exports[_0x6f2d('0x48')]=function(_0x412ce7,_0x5e8777){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x412ce7[_0x6f2d('0x27')]['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x5e8777,null))[_0x6f2d('0x17')](function(_0x46cf32){if(_0x46cf32){return _0x46cf32[_0x6f2d('0x49')](_0x412ce7['body'][_0x6f2d('0x3a')],_['omit'](_0x412ce7[_0x6f2d('0x35')],[_0x6f2d('0x3a'),'id'])||{})[_0x6f2d('0x4a')](function(){return db[_0x6f2d('0x4b')][_0x6f2d('0x22')]({'attributes':['id',_0x6f2d('0x1b'),_0x6f2d('0x4c')],'where':{'id':_0x412ce7[_0x6f2d('0x35')][_0x6f2d('0x3a')]}});})[_0x6f2d('0x17')](function(_0x1be5c8){socket[_0x6f2d('0x4d')](_0x6f2d('0x4e'),{'id':Number(_0x412ce7[_0x6f2d('0x27')]['id']),'tags':_0x1be5c8||[]});return{'id':Number(_0x412ce7['params']['id']),'tags':_0x1be5c8||[]};});}})[_0x6f2d('0x17')](respondWithResult(_0x5e8777,null))[_0x6f2d('0x25')](handleError(_0x5e8777,null));};exports['removeTags']=function(_0x531776,_0x4fc1a4){return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x531776['params']['id']}})[_0x6f2d('0x17')](handleEntityNotFound(_0x4fc1a4,null))[_0x6f2d('0x17')](function(_0x1e2b48){if(_0x1e2b48){return _0x1e2b48[_0x6f2d('0x4f')](_0x531776[_0x6f2d('0x2a')][_0x6f2d('0x3a')]);}})[_0x6f2d('0x17')](respondWithStatusCode(_0x4fc1a4,null))[_0x6f2d('0x25')](handleError(_0x4fc1a4,null));};exports['download']=function(_0x28439a,_0x4d781b){var _0x1bac28=moment()['unix']()[_0x6f2d('0x50')]();var _0x11e261=path[_0x6f2d('0x51')](config[_0x6f2d('0x52')],_0x6f2d('0x53'),'files','tmp');var _0x4ebed9=path['join'](config['root'],_0x6f2d('0x53'),_0x6f2d('0x54'),'attachments');var _0x451b72=path[_0x6f2d('0x51')](_0x11e261,_0x1bac28);var _0x54fdb5=util[_0x6f2d('0x55')](_0x6f2d('0x56'),_0x28439a[_0x6f2d('0x27')]['id'],_0x1bac28);var _0x3fc0e9=path[_0x6f2d('0x51')](_0x11e261,_0x54fdb5);var _0xf515b1=[];_0xf515b1[_0x6f2d('0x57')]({'model':db[_0x6f2d('0x58')],'as':_0x6f2d('0x58'),'raw':!![]});var _0x56d31e=[{'model':db[_0x6f2d('0x39')],'as':_0x6f2d('0x59'),'attributes':['id',_0x6f2d('0x35'),_0x6f2d('0x5a')],'include':_0xf515b1}];return db[_0x6f2d('0x28')][_0x6f2d('0x33')]({'where':{'id':_0x28439a[_0x6f2d('0x27')]['id']},'include':_0x56d31e})[_0x6f2d('0x17')](handleEntityNotFound(_0x4d781b,null))[_0x6f2d('0x17')](function(_0x245262){if(_0x245262&&_0x245262[_0x6f2d('0x59')]){var _0x5eb787=_0x245262[_0x6f2d('0x5b')]({'plain':!![]});fs['mkdirSync'](_0x451b72);for(var _0x10a444=0x0;_0x10a444<_0x5eb787[_0x6f2d('0x59')][_0x6f2d('0x2f')];_0x10a444++){var _0x3d8290=_0x5eb787[_0x6f2d('0x59')][_0x10a444][_0x6f2d('0x58')];if(_0x3d8290){var _0x2476c3=path[_0x6f2d('0x51')](_0x4ebed9,_0x3d8290[_0x6f2d('0x5c')]);if(fs[_0x6f2d('0x5d')](_0x2476c3)){fs['createReadStream'](_0x2476c3)[_0x6f2d('0x5e')](fs[_0x6f2d('0x5f')](path[_0x6f2d('0x51')](_0x451b72,_0x3d8290['basename'])));}}}return BPromise[_0x6f2d('0x60')]()[_0x6f2d('0x17')](function(){return new BPromise(function(_0x29c0e1,_0x1e4f9a){zipdir(_0x451b72,{'saveTo':_0x3fc0e9},function(_0x241705,_0x4605bb){if(_0x241705)return _0x1e4f9a(_0x241705);return _0x29c0e1(_0x4605bb);});})[_0x6f2d('0x17')](function(){return new BPromise(function(_0x2a0e88,_0x116ed1){rimraf(_0x451b72,function(_0x424e98){if(_0x424e98)_0x116ed1(_0x424e98);return _0x2a0e88();});});})[_0x6f2d('0x17')](function(){return _0x4d781b[_0x6f2d('0x61')](_0x3fc0e9,_0x54fdb5,function(_0x6b1593){if(_0x6b1593){console['log'](_0x6f2d('0x62'),_0x6b1593);}else{fs['unlinkSync'](_0x3fc0e9);}});});});}else{return _0x4d781b[_0x6f2d('0x63')](0xc8);}})[_0x6f2d('0x25')](handleError(_0x4d781b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 58c9e9c..54041aa 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 _0x2ef1=['FaxMessage','setMaxListeners','update','remove','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4ff674,_0x1ded4b){var _0x1151c3=function(_0x36e16d){while(--_0x36e16d){_0x4ff674['push'](_0x4ff674['shift']());}};_0x1151c3(++_0x1ded4b);}(_0x2ef1,0x1c5));var _0x12ef=function(_0x2825fc,_0x360ab5){_0x2825fc=_0x2825fc-0x0;var _0x4f75dc=_0x2ef1[_0x2825fc];return _0x4f75dc;};'use strict';var EventEmitter=require(_0x12ef('0x0'));var FaxInteraction=require(_0x12ef('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0x12ef('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x12ef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x12ef('0x4'),'afterDestroy':_0x12ef('0x5')};function emitEvent(_0x4689b6){return function(_0x1b846e,_0x2f24c2,_0x1fbf13){_0x1b846e['getUsers']({'attributes':['id'],'raw':!![]})[_0x12ef('0x6')](function(_0x549afe){_0x1b846e[_0x12ef('0x7')]('Users',_0x549afe['map'](function(_0x5338f8){return{'id':_0x5338f8['id']};}));return FaxMessage[_0x12ef('0x8')]({'where':{'FaxInteractionId':_0x1b846e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x12ef('0x6')](function(_0x206092){_0x1b846e['setDataValue'](_0x12ef('0x9'),_0x206092['length']);FaxInteractionEvents['emit'](_0x4689b6+':'+_0x1b846e['id'],_0x1b846e);FaxInteractionEvents[_0x12ef('0xa')](_0x4689b6,_0x1b846e);_0x1fbf13(null);})['catch'](_0x1fbf13(null));};}for(var e in events){if(events[_0x12ef('0xb')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x12ef('0xc')]=FaxInteractionEvents; \ No newline at end of file +var _0x94c8=['FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x42d1cc,_0x515c4a){var _0x1adc04=function(_0x478195){while(--_0x478195){_0x42d1cc['push'](_0x42d1cc['shift']());}};_0x1adc04(++_0x515c4a);}(_0x94c8,0x1a1));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x894c('0x0'))['db'][_0x894c('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x894c('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x894c('0x3')](0x0);var events={'afterCreate':_0x894c('0x4'),'afterUpdate':_0x894c('0x5'),'afterDestroy':_0x894c('0x6')};function emitEvent(_0x3ce47c){return function(_0x3dc143,_0x4671a4,_0x21c12a){_0x3dc143['getUsers']({'attributes':['id'],'raw':!![]})[_0x894c('0x7')](function(_0x10007b){_0x3dc143['setDataValue'](_0x894c('0x8'),_0x10007b[_0x894c('0x9')](function(_0x41a12a){return{'id':_0x41a12a['id']};}));return FaxMessage[_0x894c('0xa')]({'where':{'FaxInteractionId':_0x3dc143['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x520c79){_0x3dc143[_0x894c('0xb')](_0x894c('0xc'),_0x520c79[_0x894c('0xd')]);FaxInteractionEvents[_0x894c('0xe')](_0x3ce47c+':'+_0x3dc143['id'],_0x3dc143);FaxInteractionEvents[_0x894c('0xe')](_0x3ce47c,_0x3dc143);_0x21c12a(null);})[_0x894c('0xf')](_0x21c12a(null));};}for(var e in events){if(events[_0x894c('0x10')](e)){var event=events[e];FaxInteraction[_0x894c('0x11')](e,emitEvent(event));}}module[_0x894c('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 42b43ba..ca0101a 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 _0x3c2b=['closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3c2b,0x91));var _0xb3c2=function(_0x22afc5,_0x29477c){_0x22afc5=_0x22afc5-0x0;var _0x550007=_0x3c2b[_0x22afc5];return _0x550007;};'use strict';var _=require('lodash');var util=require(_0xb3c2('0x0'));var logger=require(_0xb3c2('0x1'))(_0xb3c2('0x2'));var moment=require(_0xb3c2('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3c2('0x5'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xb3c2('0x6')]=function(_0x544f97,_0xfba827){return _0x544f97[_0xb3c2('0x7')](_0xb3c2('0x8'),attributes,{'tableName':_0xb3c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x392257,_0x51f1ca,_0x75aa3c){if(_0x392257[_0xb3c2('0xa')]('closed')){_0x392257[_0xb3c2('0xb')]=moment()['format'](_0xb3c2('0xc'));}_0x75aa3c(null,_0x392257);}}});}; \ No newline at end of file +var _0x6931=['path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6931,0x1a9));var _0x1693=function(_0x5d6c60,_0x45334e){_0x5d6c60=_0x5d6c60-0x0;var _0x85c104=_0x6931[_0x5d6c60];return _0x85c104;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))(_0x1693('0x3'));var moment=require(_0x1693('0x4'));var BPromise=require(_0x1693('0x5'));var rp=require(_0x1693('0x6'));var fs=require('fs');var path=require(_0x1693('0x7'));var rimraf=require('rimraf');var config=require(_0x1693('0x8'));var attributes=require(_0x1693('0x9'));module[_0x1693('0xa')]=function(_0x455646,_0x379d6c){return _0x455646['define'](_0x1693('0xb'),attributes,{'tableName':_0x1693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18e32e,_0x579434,_0xc66466){if(_0x18e32e[_0x1693('0xd')](_0x1693('0xe'))){_0x18e32e[_0x1693('0xf')]=moment()[_0x1693('0x10')](_0x1693('0x11'));}_0xc66466(null,_0x18e32e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index ef56581..0dcc29b 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 _0x61ee=['error','code','message','result','catch','FaxInteraction','update','body','options','raw','where','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x13e0ea,_0x39bc32){var _0x5492aa=function(_0x34b8c1){while(--_0x34b8c1){_0x13e0ea['push'](_0x13e0ea['shift']());}};_0x5492aa(++_0x39bc32);}(_0x61ee,0x98));var _0xe61e=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0x61ee[_0x5c811c];return _0x5df3af;};'use strict';var _=require(_0xe61e('0x0'));var util=require(_0xe61e('0x1'));var moment=require(_0xe61e('0x2'));var BPromise=require(_0xe61e('0x3'));var rs=require(_0xe61e('0x4'));var fs=require('fs');var Redis=require(_0xe61e('0x5'));var db=require(_0xe61e('0x6'))['db'];var utils=require(_0xe61e('0x7'));var logger=require(_0xe61e('0x8'))(_0xe61e('0x9'));var config=require(_0xe61e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe61e('0xb')][_0xe61e('0xc')]({'port':0x232a});config[_0xe61e('0xd')]=_[_0xe61e('0xe')](config[_0xe61e('0xd')],{'host':_0xe61e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe61e('0xd')]));require(_0xe61e('0x10'))[_0xe61e('0x11')](socket);function respondWithRpcPromise(_0x63183,_0x5ea83b,_0x4a06f5){return new BPromise(function(_0x28bcbc,_0x1865c0){return client['request'](_0x63183,_0x4a06f5)[_0xe61e('0x12')](function(_0x30a6a0){logger[_0xe61e('0x13')](_0xe61e('0x14'),_0x5ea83b,_0xe61e('0x15'));logger[_0xe61e('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x5ea83b,'request\x20sent',JSON[_0xe61e('0x17')](_0x30a6a0));if(_0x30a6a0[_0xe61e('0x18')]){if(_0x30a6a0[_0xe61e('0x18')][_0xe61e('0x19')]===0x1f4){logger[_0xe61e('0x18')](_0xe61e('0x14'),_0x5ea83b,_0x30a6a0[_0xe61e('0x18')][_0xe61e('0x1a')]);return _0x1865c0(_0x30a6a0[_0xe61e('0x18')][_0xe61e('0x1a')]);}logger['error'](_0xe61e('0x14'),_0x5ea83b,_0x30a6a0['error'][_0xe61e('0x1a')]);return _0x28bcbc(_0x30a6a0['error'][_0xe61e('0x1a')]);}else{logger[_0xe61e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5ea83b,_0xe61e('0x15'));_0x28bcbc(_0x30a6a0[_0xe61e('0x1b')]['message']);}})[_0xe61e('0x1c')](function(_0x1b58ed){logger['error'](_0xe61e('0x14'),_0x5ea83b,_0x1b58ed);_0x1865c0(_0x1b58ed);});});}exports['UpdateFaxInteraction']=function(_0x374862){var _0x56ca10=this;return new Promise(function(_0x231921,_0x5d0301){return db[_0xe61e('0x1d')][_0xe61e('0x1e')](_0x374862[_0xe61e('0x1f')],{'raw':_0x374862[_0xe61e('0x20')]?_0x374862[_0xe61e('0x20')][_0xe61e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374862['options']?_0x374862[_0xe61e('0x20')][_0xe61e('0x22')]||null:null,'attributes':_0x374862['options']?_0x374862[_0xe61e('0x20')]['attributes']||null:null,'limit':_0x374862[_0xe61e('0x20')]?_0x374862[_0xe61e('0x20')][_0xe61e('0x23')]||null:null})[_0xe61e('0x12')](function(_0x54749b){logger[_0xe61e('0x13')](_0xe61e('0x24'),_0x374862);logger[_0xe61e('0x16')](_0xe61e('0x24'),_0x374862,JSON[_0xe61e('0x17')](_0x54749b));_0x231921(_0x54749b);})[_0xe61e('0x1c')](function(_0x28f8d5){logger[_0xe61e('0x18')](_0xe61e('0x24'),_0x28f8d5[_0xe61e('0x1a')],_0x374862);_0x5d0301(_0x56ca10[_0xe61e('0x18')](0x1f4,_0x28f8d5[_0xe61e('0x1a')]));});});};exports[_0xe61e('0x25')]=function(_0x4d57a7){return new Promise(function(_0x41921b,_0x4c40f7){return db[_0xe61e('0x1d')][_0xe61e('0x26')]({'where':_0x4d57a7['options']?_0x4d57a7['options'][_0xe61e('0x22')]||null:null})[_0xe61e('0x12')](function(_0x147363){if(_0x147363){return _0x147363[_0xe61e('0x27')](_0x4d57a7[_0xe61e('0x1f')][_0xe61e('0x28')],_[_0xe61e('0x29')](_0x4d57a7[_0xe61e('0x1f')],[_0xe61e('0x28'),'id'])||{});}})[_0xe61e('0x2a')](function(_0xee18f4){logger[_0xe61e('0x13')](_0xe61e('0x2b'),_0x4d57a7);logger[_0xe61e('0x16')](_0xe61e('0x2b'),_0x4d57a7,JSON[_0xe61e('0x17')](_0xee18f4));_0x41921b(_0xee18f4);})[_0xe61e('0x1c')](function(_0x4611dd){logger[_0xe61e('0x18')](_0xe61e('0x2b'),_0x4611dd[_0xe61e('0x1a')],_0x4d57a7);_0x4c40f7(_this[_0xe61e('0x18')](0x1f4,_0x4611dd[_0xe61e('0x1a')]));});});}; \ No newline at end of file +var _0x99ea=['message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','addTags','body','ids','omit','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x24ac7c,_0x111c73){var _0x4b4413=function(_0x47f9bb){while(--_0x47f9bb){_0x24ac7c['push'](_0x24ac7c['shift']());}};_0x4b4413(++_0x111c73);}(_0x99ea,0x1d7));var _0xa99e=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x99ea[_0xc69f39];return _0x93be41;};'use strict';var _=require('lodash');var util=require(_0xa99e('0x0'));var moment=require('moment');var BPromise=require(_0xa99e('0x1'));var rs=require(_0xa99e('0x2'));var fs=require('fs');var Redis=require(_0xa99e('0x3'));var db=require(_0xa99e('0x4'))['db'];var utils=require(_0xa99e('0x5'));var logger=require(_0xa99e('0x6'))(_0xa99e('0x7'));var config=require(_0xa99e('0x8'));var jayson=require(_0xa99e('0x9'));var client=jayson[_0xa99e('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa99e('0xb')],{'host':_0xa99e('0xc'),'port':0x18eb});var socket=require(_0xa99e('0xd'))(new Redis(config[_0xa99e('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xea8b33,_0xe902c5,_0x465898){return new BPromise(function(_0x14a6fa,_0xe3fd72){return client[_0xa99e('0xe')](_0xea8b33,_0x465898)[_0xa99e('0xf')](function(_0x5a9f5c){logger[_0xa99e('0x10')](_0xa99e('0x11'),_0xe902c5,_0xa99e('0x12'));logger[_0xa99e('0x13')](_0xa99e('0x14'),_0xe902c5,_0xa99e('0x12'),JSON[_0xa99e('0x15')](_0x5a9f5c));if(_0x5a9f5c[_0xa99e('0x16')]){if(_0x5a9f5c[_0xa99e('0x16')]['code']===0x1f4){logger['error'](_0xa99e('0x11'),_0xe902c5,_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);return _0xe3fd72(_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);}logger['error'](_0xa99e('0x11'),_0xe902c5,_0x5a9f5c[_0xa99e('0x16')]['message']);return _0x14a6fa(_0x5a9f5c[_0xa99e('0x16')][_0xa99e('0x17')]);}else{logger['info'](_0xa99e('0x11'),_0xe902c5,'request\x20sent');_0x14a6fa(_0x5a9f5c[_0xa99e('0x18')][_0xa99e('0x17')]);}})[_0xa99e('0x19')](function(_0x4395bb){logger[_0xa99e('0x16')](_0xa99e('0x11'),_0xe902c5,_0x4395bb);_0xe3fd72(_0x4395bb);});});}exports[_0xa99e('0x1a')]=function(_0x17304f){var _0x12a920=this;return new Promise(function(_0x3f5cb7,_0x34d4d6){return db[_0xa99e('0x1b')]['update'](_0x17304f['body'],{'raw':_0x17304f['options']?_0x17304f[_0xa99e('0x1c')][_0xa99e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17304f[_0xa99e('0x1c')]?_0x17304f[_0xa99e('0x1c')][_0xa99e('0x1e')]||null:null,'attributes':_0x17304f[_0xa99e('0x1c')]?_0x17304f['options'][_0xa99e('0x1f')]||null:null,'limit':_0x17304f[_0xa99e('0x1c')]?_0x17304f['options'][_0xa99e('0x20')]||null:null})['then'](function(_0x4eaabe){logger['info']('UpdateFaxInteraction',_0x17304f);logger['debug'](_0xa99e('0x1a'),_0x17304f,JSON[_0xa99e('0x15')](_0x4eaabe));_0x3f5cb7(_0x4eaabe);})[_0xa99e('0x19')](function(_0x4b4eb9){logger[_0xa99e('0x16')](_0xa99e('0x1a'),_0x4b4eb9['message'],_0x17304f);_0x34d4d6(_0x12a920[_0xa99e('0x16')](0x1f4,_0x4b4eb9[_0xa99e('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2b76a2){return new Promise(function(_0x304eed,_0x372c4d){return db[_0xa99e('0x1b')]['find']({'where':_0x2b76a2[_0xa99e('0x1c')]?_0x2b76a2[_0xa99e('0x1c')][_0xa99e('0x1e')]||null:null})[_0xa99e('0xf')](function(_0x26e016){if(_0x26e016){return _0x26e016[_0xa99e('0x21')](_0x2b76a2[_0xa99e('0x22')][_0xa99e('0x23')],_[_0xa99e('0x24')](_0x2b76a2['body'],[_0xa99e('0x23'),'id'])||{});}})['spread'](function(_0x397199){logger[_0xa99e('0x10')](_0xa99e('0x25'),_0x2b76a2);logger[_0xa99e('0x13')](_0xa99e('0x25'),_0x2b76a2,JSON[_0xa99e('0x15')](_0x397199));_0x304eed(_0x397199);})['catch'](function(_0x7397b2){logger['error'](_0xa99e('0x25'),_0x7397b2[_0xa99e('0x17')],_0x2b76a2);_0x372c4d(_this[_0xa99e('0x16')](0x1f4,_0x7397b2[_0xa99e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2f1e3ae..5c28419 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 _0xb4b0=['faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xb4b0,0xd3));var _0x0b4b=function(_0x28aa40,_0x207fb3){_0x28aa40=_0x28aa40-0x0;var _0x415bf6=_0xb4b0[_0x28aa40];return _0x415bf6;};'use strict';var FaxInteractionEvents=require(_0x0b4b('0x0'));var events=['save',_0x0b4b('0x1'),_0x0b4b('0x2')];function createListener(_0x1b34a8,_0x455dbb){return function(_0x309bc9){_0x455dbb[_0x0b4b('0x3')](_0x1b34a8,_0x309bc9);};}function removeListener(_0x564b18,_0x3ce64b){return function(){FaxInteractionEvents[_0x0b4b('0x4')](_0x564b18,_0x3ce64b);};}exports[_0x0b4b('0x5')]=function(_0x42410a){for(var _0x2c03eb=0x0,_0x409532=events['length'];_0x2c03eb<_0x409532;_0x2c03eb++){var _0x47051c=events[_0x2c03eb];var _0x5e1a82=createListener(_0x0b4b('0x6')+_0x47051c,_0x42410a);FaxInteractionEvents['on'](_0x47051c,_0x5e1a82);}}; \ No newline at end of file +var _0x92d3=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92d3,0xcf));var _0x392d=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x92d3[_0x62c958];return _0x57ec61;};'use strict';var FaxInteractionEvents=require(_0x392d('0x0'));var events=[_0x392d('0x1'),_0x392d('0x2'),'update'];function createListener(_0xd3554d,_0x291fd4){return function(_0x54d59c){_0x291fd4['emit'](_0xd3554d,_0x54d59c);};}function removeListener(_0xf072aa,_0x55c069){return function(){FaxInteractionEvents[_0x392d('0x3')](_0xf072aa,_0x55c069);};}exports[_0x392d('0x4')]=function(_0xc53413){for(var _0x4d9142=0x0,_0x1c9055=events[_0x392d('0x5')];_0x4d9142<_0x1c9055;_0x4d9142++){var _0x54455a=events[_0x4d9142];var _0x440074=createListener(_0x392d('0x6')+_0x54455a,_0xc53413);FaxInteractionEvents['on'](_0x54455a,_0x440074);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 52f7593..72dd4f0 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 _0xfa72=['addTags','put','/:id','fax','update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags'];(function(_0x3a51c8,_0x332343){var _0x198d11=function(_0x2fbf8b){while(--_0x2fbf8b){_0x3a51c8['push'](_0x3a51c8['shift']());}};_0x198d11(++_0x332343);}(_0xfa72,0xcf));var _0x2fa7=function(_0x4a9543,_0x5204ee){_0x4a9543=_0x4a9543-0x0;var _0x5798de=_0xfa72[_0x4a9543];return _0x5798de;};'use strict';var multer=require(_0x2fa7('0x0'));var util=require('util');var path=require(_0x2fa7('0x1'));var timeout=require(_0x2fa7('0x2'));var express=require(_0x2fa7('0x3'));var router=express[_0x2fa7('0x4')]();var fs_extra=require(_0x2fa7('0x5'));var auth=require(_0x2fa7('0x6'));var interaction=require(_0x2fa7('0x7'));var config=require(_0x2fa7('0x8'));var controller=require('./faxInteraction.controller');router[_0x2fa7('0x9')]('/',auth[_0x2fa7('0xa')](),controller[_0x2fa7('0xb')]);router[_0x2fa7('0x9')](_0x2fa7('0xc'),auth[_0x2fa7('0xa')](),controller[_0x2fa7('0xd')]);router[_0x2fa7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2fa7('0xe')]);router['get']('/:id/messages',auth[_0x2fa7('0xa')](),controller[_0x2fa7('0xf')]);router[_0x2fa7('0x9')](_0x2fa7('0x10'),auth['isAuthenticated'](),controller[_0x2fa7('0x11')]);router[_0x2fa7('0x12')]('/',auth[_0x2fa7('0xa')](),controller[_0x2fa7('0x13')]);router[_0x2fa7('0x12')]('/:id/messages',auth[_0x2fa7('0xa')](),controller[_0x2fa7('0x14')]);router[_0x2fa7('0x12')](_0x2fa7('0x15'),auth[_0x2fa7('0xa')](),interaction[_0x2fa7('0x16')]('fax',_0x2fa7('0x17')),controller[_0x2fa7('0x18')]);router[_0x2fa7('0x19')](_0x2fa7('0x1a'),auth[_0x2fa7('0xa')](),interaction[_0x2fa7('0x16')](_0x2fa7('0x1b'),'faxinteraction:update'),controller[_0x2fa7('0x1c')]);router[_0x2fa7('0x1d')](_0x2fa7('0x1a'),auth[_0x2fa7('0xa')](),interaction[_0x2fa7('0x16')](_0x2fa7('0x1b'),_0x2fa7('0x1e')),controller[_0x2fa7('0x1f')]);router[_0x2fa7('0x1d')](_0x2fa7('0x15'),auth['isAuthenticated'](),controller['removeTags']);module[_0x2fa7('0x20')]=router; \ No newline at end of file +var _0x4c55=['fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked'];(function(_0x354422,_0x383c8f){var _0x411173=function(_0x3b5edf){while(--_0x3b5edf){_0x354422['push'](_0x354422['shift']());}};_0x411173(++_0x383c8f);}(_0x4c55,0xc4));var _0x54c5=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x4c55[_0xa9a245];return _0x2d0eaa;};'use strict';var multer=require(_0x54c5('0x0'));var util=require(_0x54c5('0x1'));var path=require(_0x54c5('0x2'));var timeout=require(_0x54c5('0x3'));var express=require('express');var router=express[_0x54c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54c5('0x5'));var interaction=require(_0x54c5('0x6'));var config=require('../../config/environment');var controller=require(_0x54c5('0x7'));router['get']('/',auth[_0x54c5('0x8')](),controller['index']);router['get'](_0x54c5('0x9'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xa')]);router[_0x54c5('0xb')](_0x54c5('0xc'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xd')]);router['get'](_0x54c5('0xe'),auth[_0x54c5('0x8')](),controller[_0x54c5('0xf')]);router[_0x54c5('0xb')](_0x54c5('0x10'),auth[_0x54c5('0x8')](),controller['download']);router[_0x54c5('0x11')]('/',auth[_0x54c5('0x8')](),controller[_0x54c5('0x12')]);router[_0x54c5('0x11')](_0x54c5('0xe'),auth[_0x54c5('0x8')](),controller['addMessage']);router['post'](_0x54c5('0x13'),auth['isAuthenticated'](),interaction[_0x54c5('0x14')](_0x54c5('0x15'),_0x54c5('0x16')),controller[_0x54c5('0x17')]);router[_0x54c5('0x18')](_0x54c5('0xc'),auth[_0x54c5('0x8')](),interaction[_0x54c5('0x14')]('fax',_0x54c5('0x19')),controller[_0x54c5('0x1a')]);router[_0x54c5('0x1b')](_0x54c5('0xc'),auth['isAuthenticated'](),interaction[_0x54c5('0x14')](_0x54c5('0x15'),_0x54c5('0x1c')),controller['destroy']);router[_0x54c5('0x1b')](_0x54c5('0x13'),auth[_0x54c5('0x8')](),controller[_0x54c5('0x1d')]);module[_0x54c5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 485b069..fe51994 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 _0xc73e=['BOOLEAN','TEXT','DATE','sequelize','exports','medium'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xc73e,0x1e9));var _0xec73=function(_0x23762f,_0x3ce196){_0x23762f=_0x23762f-0x0;var _0x496c10=_0xc73e[_0x23762f];return _0x496c10;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'body':{'type':Sequelize['TEXT'](_0xec73('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec73('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xec73('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec73('0x5')]}}; \ No newline at end of file +var _0x5455=['TEXT','medium','BOOLEAN','ENUM','out','exports'];(function(_0x23ec04,_0x3733c0){var _0x4e3285=function(_0x511275){while(--_0x511275){_0x23ec04['push'](_0x23ec04['shift']());}};_0x4e3285(++_0x3733c0);}(_0x5455,0x197));var _0x5545=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5455[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x5545('0x0')]={'body':{'type':Sequelize[_0x5545('0x1')](_0x5545('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5545('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5545('0x4')]('in',_0x5545('0x5')),'defaultValue':_0x5545('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index abbc7a9..6bb6cfc 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 _0x16ab=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','map','FaxMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','findAll','rows','show','params','find','body','describe','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','SELECT','contact','fullname','rejectmessage','create','CmContact','ContactId','isNil','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x4b8572,_0x4c3e40){var _0x6de77d=function(_0xc77bcf){while(--_0xc77bcf){_0x4b8572['push'](_0x4b8572['shift']());}};_0x6de77d(++_0x4c3e40);}(_0x16ab,0x80));var _0xb16a=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x16ab[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0xb16a('0x0'));var rimraf=require(_0xb16a('0x1'));var zipdir=require(_0xb16a('0x2'));var jsonpatch=require(_0xb16a('0x3'));var rp=require(_0xb16a('0x4'));var moment=require(_0xb16a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb16a('0x6'));var util=require('util');var path=require(_0xb16a('0x7'));var sox=require(_0xb16a('0x8'));var csv=require(_0xb16a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb16a('0xa'));var squel=require(_0xb16a('0xb'));var crypto=require(_0xb16a('0xc'));var jsforce=require(_0xb16a('0xd'));var deskjs=require(_0xb16a('0xe'));var toCsv=require(_0xb16a('0x9'));var querystring=require(_0xb16a('0xf'));var Papa=require(_0xb16a('0x10'));var Redis=require('ioredis');var authService=require(_0xb16a('0x11'));var qs=require(_0xb16a('0x12'));var as=require(_0xb16a('0x13'));var hardwareService=require(_0xb16a('0x14'));var logger=require(_0xb16a('0x15'))('api');var utils=require(_0xb16a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb16a('0x17'));var db=require(_0xb16a('0x18'))['db'];config[_0xb16a('0x19')]=_[_0xb16a('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb16a('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xb16a('0x1b'));var client=jayson[_0xb16a('0x1c')][_0xb16a('0x1d')]({'port':0x232c});var client9002=jayson[_0xb16a('0x1c')][_0xb16a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x141aff,_0x12a987,_0x450bb1,_0x55e344){return new BPromise(function(_0x591d2c,_0x4002f1){var _0x2d0d11=_0x55e344||client;return _0x2d0d11[_0xb16a('0x1e')](_0x141aff,_0x450bb1)[_0xb16a('0x1f')](function(_0x510ef0){logger[_0xb16a('0x20')](_0xb16a('0x21'),_0x12a987,_0xb16a('0x22'));logger[_0xb16a('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x12a987,_0xb16a('0x22'),JSON['stringify'](_0x510ef0));if(_0x510ef0['error']){if(_0x510ef0[_0xb16a('0x24')][_0xb16a('0x25')]===0x1f4){logger[_0xb16a('0x24')](_0xb16a('0x21'),_0x12a987,_0x510ef0['error'][_0xb16a('0x26')]);return _0x4002f1(_0x510ef0[_0xb16a('0x24')][_0xb16a('0x26')]);}logger['error'](_0xb16a('0x21'),_0x12a987,_0x510ef0[_0xb16a('0x24')][_0xb16a('0x26')]);return _0x591d2c(_0x510ef0['error'][_0xb16a('0x26')]);}else{logger[_0xb16a('0x20')](_0xb16a('0x21'),_0x12a987,_0xb16a('0x22'));_0x591d2c(_0x510ef0[_0xb16a('0x27')]['message']);}})[_0xb16a('0x28')](function(_0x498b98){logger[_0xb16a('0x24')](_0xb16a('0x21'),_0x12a987,_0x498b98);_0x4002f1(_0x498b98);});});}function respondWithStatusCode(_0xc5c2be,_0x3524fc){_0x3524fc=_0x3524fc||0xcc;return function(_0x264881){if(_0x264881){return _0xc5c2be[_0xb16a('0x29')](_0x3524fc);}return _0xc5c2be[_0xb16a('0x2a')](_0x3524fc)[_0xb16a('0x2b')]();};}function respondWithResult(_0x201d33,_0x387613){_0x387613=_0x387613||0xc8;return function(_0x4ee5f6){if(_0x4ee5f6){return _0x201d33[_0xb16a('0x2a')](_0x387613)[_0xb16a('0x2c')](_0x4ee5f6);}};}function respondWithFilteredResult(_0x471a33,_0x1a89b2){return function(_0x31d513){if(_0x31d513){var _0x2882b2=typeof _0x1a89b2[_0xb16a('0x2d')]===_0xb16a('0x2e')&&typeof _0x1a89b2[_0xb16a('0x2f')]==='undefined';var _0x1daabf=_0x31d513[_0xb16a('0x30')];var _0x5c634f=_0x2882b2?0x0:_0x1a89b2['offset'];var _0x19e88c=_0x2882b2?_0x31d513[_0xb16a('0x30')]:_0x1a89b2[_0xb16a('0x2d')]+_0x1a89b2[_0xb16a('0x2f')];var _0x17ead3;if(_0x19e88c>=_0x1daabf){_0x19e88c=_0x1daabf;_0x17ead3=0xc8;}else{_0x17ead3=0xce;}_0x471a33['status'](_0x17ead3);return _0x471a33[_0xb16a('0x31')](_0xb16a('0x32'),_0x5c634f+'-'+_0x19e88c+'/'+_0x1daabf)[_0xb16a('0x2c')](_0x31d513);}return null;};}function patchUpdates(_0x473edc){return function(_0x24391f){try{jsonpatch[_0xb16a('0x33')](_0x24391f,_0x473edc,!![]);}catch(_0xa88a28){return BPromise[_0xb16a('0x34')](_0xa88a28);}return _0x24391f['save']();};}function saveUpdates(_0x321e7e,_0x2afc6e){return function(_0x17d671){if(_0x17d671){return _0x17d671[_0xb16a('0x35')](_0x321e7e)[_0xb16a('0x1f')](function(_0x20360f){return _0x20360f;});}return null;};}function removeEntity(_0x2f1537,_0x59fcae){return function(_0x3e7860){if(_0x3e7860){return _0x3e7860[_0xb16a('0x36')]()[_0xb16a('0x1f')](function(){_0x2f1537[_0xb16a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3f1a,_0x230eb1){return function(_0x2af56f){if(!_0x2af56f){_0x1c3f1a[_0xb16a('0x29')](0x194);}return _0x2af56f;};}function handleError(_0x3163bf,_0x17bb1c){_0x17bb1c=_0x17bb1c||0x1f4;return function(_0x2040e8){logger['error'](_0x2040e8[_0xb16a('0x37')]);if(_0x2040e8['name']){delete _0x2040e8['name'];}_0x3163bf[_0xb16a('0x2a')](_0x17bb1c)['send'](_0x2040e8);};}exports['index']=function(_0x4d21dd,_0x37d14d){var _0x247608={},_0x1d009e={},_0x15ced7={'count':0x0,'rows':[]};var _0x80d70b=_[_0xb16a('0x38')](db[_0xb16a('0x39')][_0xb16a('0x3a')],function(_0x40c3d1){return{'name':_0x40c3d1[_0xb16a('0x3b')],'type':_0x40c3d1[_0xb16a('0x3c')][_0xb16a('0x3d')]};});_0x1d009e[_0xb16a('0x3e')]=_[_0xb16a('0x38')](_0x80d70b,_0xb16a('0x3f'));_0x1d009e[_0xb16a('0x40')]=_[_0xb16a('0x41')](_0x4d21dd[_0xb16a('0x40')]);_0x1d009e[_0xb16a('0x42')]=_[_0xb16a('0x43')](_0x1d009e[_0xb16a('0x3e')],_0x1d009e[_0xb16a('0x40')]);_0x247608[_0xb16a('0x44')]=_[_0xb16a('0x43')](_0x1d009e[_0xb16a('0x3e')],qs[_0xb16a('0x45')](_0x4d21dd[_0xb16a('0x40')]['fields']));_0x247608[_0xb16a('0x44')]=_0x247608[_0xb16a('0x44')][_0xb16a('0x46')]?_0x247608[_0xb16a('0x44')]:_0x1d009e[_0xb16a('0x3e')];if(!_0x4d21dd['query'][_0xb16a('0x47')](_0xb16a('0x48'))){_0x247608[_0xb16a('0x2f')]=qs[_0xb16a('0x2f')](_0x4d21dd[_0xb16a('0x40')][_0xb16a('0x2f')]);_0x247608[_0xb16a('0x2d')]=qs[_0xb16a('0x2d')](_0x4d21dd[_0xb16a('0x40')]['offset']);}_0x247608['order']=qs[_0xb16a('0x49')](_0x4d21dd[_0xb16a('0x40')][_0xb16a('0x49')]);_0x247608['where']=qs[_0xb16a('0x42')](_['pick'](_0x4d21dd[_0xb16a('0x40')],_0x1d009e['filters']),_0x80d70b);if(_0x4d21dd[_0xb16a('0x40')]['filter']){_0x247608[_0xb16a('0x4a')]=_['merge'](_0x247608[_0xb16a('0x4a')],{'$or':_[_0xb16a('0x38')](_0x80d70b,function(_0x5b7957){if(_0x5b7957['type']!=='VIRTUAL'){var _0x10d698={};_0x10d698[_0x5b7957[_0xb16a('0x3f')]]={'$like':'%'+_0x4d21dd[_0xb16a('0x40')][_0xb16a('0x4b')]+'%'};return _0x10d698;}})});}_0x247608=_['merge']({},_0x247608,_0x4d21dd[_0xb16a('0x4c')]);var _0x4c6b0e={'where':_0x247608[_0xb16a('0x4a')]};return db[_0xb16a('0x39')][_0xb16a('0x30')](_0x4c6b0e)[_0xb16a('0x1f')](function(_0x409631){_0x15ced7[_0xb16a('0x30')]=_0x409631;if(_0x4d21dd[_0xb16a('0x40')][_0xb16a('0x4d')]){_0x247608['include']=[{'all':!![]}];}return db[_0xb16a('0x39')][_0xb16a('0x4e')](_0x247608);})['then'](function(_0x23524b){_0x15ced7[_0xb16a('0x4f')]=_0x23524b;return _0x15ced7;})[_0xb16a('0x1f')](respondWithFilteredResult(_0x37d14d,_0x247608))[_0xb16a('0x28')](handleError(_0x37d14d,null));};exports[_0xb16a('0x50')]=function(_0x45caa8,_0x54964c){var _0x420214={'raw':!![],'where':{'id':_0x45caa8[_0xb16a('0x51')]['id']}},_0x576de6={};_0x576de6['model']=_[_0xb16a('0x41')](db[_0xb16a('0x39')][_0xb16a('0x3a')]);_0x576de6['query']=_['keys'](_0x45caa8['query']);_0x576de6['filters']=_[_0xb16a('0x43')](_0x576de6[_0xb16a('0x3e')],_0x576de6[_0xb16a('0x40')]);_0x420214[_0xb16a('0x44')]=_['intersection'](_0x576de6['model'],qs[_0xb16a('0x45')](_0x45caa8[_0xb16a('0x40')]['fields']));_0x420214[_0xb16a('0x44')]=_0x420214[_0xb16a('0x44')][_0xb16a('0x46')]?_0x420214[_0xb16a('0x44')]:_0x576de6[_0xb16a('0x3e')];if(_0x45caa8[_0xb16a('0x40')]['includeAll']){_0x420214['include']=[{'all':!![]}];}_0x420214=_['merge']({},_0x420214,_0x45caa8['options']);return db[_0xb16a('0x39')][_0xb16a('0x52')](_0x420214)[_0xb16a('0x1f')](handleEntityNotFound(_0x54964c,null))['then'](respondWithResult(_0x54964c,null))[_0xb16a('0x28')](handleError(_0x54964c,null));};exports[_0xb16a('0x35')]=function(_0x44b350,_0x193dea){if(_0x44b350[_0xb16a('0x53')]['id']){delete _0x44b350['body']['id'];}return db['FaxMessage'][_0xb16a('0x52')]({'where':{'id':_0x44b350[_0xb16a('0x51')]['id']}})['then'](handleEntityNotFound(_0x193dea,null))['then'](saveUpdates(_0x44b350[_0xb16a('0x53')],null))['then'](respondWithResult(_0x193dea,null))[_0xb16a('0x28')](handleError(_0x193dea,null));};exports[_0xb16a('0x36')]=function(_0x1be36a,_0x11f5bc){return db[_0xb16a('0x39')][_0xb16a('0x52')]({'where':{'id':_0x1be36a['params']['id']}})['then'](handleEntityNotFound(_0x11f5bc,null))[_0xb16a('0x1f')](removeEntity(_0x11f5bc,null))[_0xb16a('0x28')](handleError(_0x11f5bc,null));};exports[_0xb16a('0x54')]=function(_0x597c40,_0x1f950f){return db[_0xb16a('0x39')][_0xb16a('0x54')]()['then'](respondWithResult(_0x1f950f,null))[_0xb16a('0x28')](handleError(_0x1f950f,null));};var interaction_log=require(_0xb16a('0x15'))('fax-interactions');exports[_0xb16a('0x55')]=function(_0x7b23ef,_0xd80cdf,_0xd1c7c8){var _0xd57129={'agent':{},'channel':_0xb16a('0x56')};if(_0x7b23ef[_0xb16a('0x53')]['id']){delete _0x7b23ef[_0xb16a('0x53')]['id'];}_0x7b23ef[_0xb16a('0x53')][_0xb16a('0x57')]=!![];_0x7b23ef['body']['readAt']=moment()[_0xb16a('0x58')](_0xb16a('0x59'));_0x7b23ef['body'][_0xb16a('0x5a')]=_0x7b23ef[_0xb16a('0x53')][_0xb16a('0x5a')]||_0x7b23ef[_0xb16a('0x5b')]['id'];_0xd57129[_0xb16a('0x5c')]['id']=_0x7b23ef['body'][_0xb16a('0x5a')];return db[_0xb16a('0x39')][_0xb16a('0x52')]({'where':{'id':_0x7b23ef['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd80cdf,null))[_0xb16a('0x1f')](saveUpdates(_0x7b23ef[_0xb16a('0x53')],null))[_0xb16a('0x1f')](function(_0x11f57a){if(_0x11f57a){_0xd57129[_0xb16a('0x26')]=_0x11f57a['get']({'plain':!![]});return db[_0xb16a('0x5d')][_0xb16a('0x52')]({'where':{'id':_0x11f57a[_0xb16a('0x5e')]}});}return null;})[_0xb16a('0x1f')](handleEntityNotFound(_0xd80cdf,null))['then'](function(_0x547ad6){if(_0x547ad6){return _0x547ad6['update']({'UserId':_0x7b23ef[_0xb16a('0x53')][_0xb16a('0x5a')],'read1stAt':_['isNil'](_0x547ad6[_0xb16a('0x5f')])?moment()['format'](_0xb16a('0x59')):undefined});}return null;})[_0xb16a('0x1f')](function(_0xd76f26){if(_0xd76f26){_0xd57129[_0xb16a('0x60')]=_0xd76f26[_0xb16a('0x61')]({'plain':!![]});interaction_log[_0xb16a('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7b23ef[_0xb16a('0x5b')]['id'],_0x7b23ef[_0xb16a('0x5b')][_0xb16a('0x3f')],_0x7b23ef[_0xb16a('0x5b')][_0xb16a('0x62')],_0xd57129[_0xb16a('0x60')]['id'],_0x7b23ef[_0xb16a('0x53')]?JSON[_0xb16a('0x63')](_0x7b23ef['body']):_0xb16a('0x64'));return respondWithRpcPromise(_0xb16a('0x65'),'acceptMessage',_0xd57129);}return null;})[_0xb16a('0x1f')](function(_0x4b7821){var _0x5d03aa=_0xb16a('0x66')+_0x4b7821[_0xb16a('0x26')]['ContactId'];return db['sequelize']['query'](_0x5d03aa,{'type':db[_0xb16a('0x67')]['QueryTypes']['SELECT'],'raw':!![]})[_0xb16a('0x1f')](function(_0x2387a9){return _0x2387a9;});})[_0xb16a('0x1f')](function(_0xbfeb77){if(_0xbfeb77){_0xd57129['message']['contact']=_0xbfeb77[0x0];if(!_0x7b23ef[_0xb16a('0x53')][_0xb16a('0x5a')])return;return db[_0xb16a('0x68')][_0xb16a('0x52')]({'where':{'id':_0x7b23ef['body'][_0xb16a('0x5a')],'role':_0xb16a('0x5c')},'attributes':['id',_0xb16a('0x3f'),'fullname',_0xb16a('0x69'),_0xb16a('0x6a')],'raw':!![]});}return null;})['then'](function(_0x3e935a){if(!_0x3e935a)return null;_0xd57129[_0xb16a('0x26')][_0xb16a('0x5c')]=_0x3e935a;return _0xd57129;})[_0xb16a('0x1f')](function(_0x1410ec){if(_0x1410ec){if(_0x7b23ef[_0xb16a('0x53')][_0xb16a('0x6b')]){_0xd57129[_0xb16a('0x26')]['interface']=util[_0xb16a('0x58')](_0xb16a('0x6c'),_0x7b23ef[_0xb16a('0x5b')][_0xb16a('0x3f')]);_0xd57129['message'][_0xb16a('0x6d')]=_0xd57129[_0xb16a('0x6d')];_0xd57129[_0xb16a('0x26')][_0xb16a('0x6e')]=_0xd57129[_0xb16a('0x6d')];_0xd57129[_0xb16a('0x26')][_0xb16a('0x6f')]='accept';return respondWithRpcPromise(_0xb16a('0x70'),_0xb16a('0x70'),{'event':_0xb16a('0x71'),'message':_0xd57129[_0xb16a('0x26')]},client9002)['then'](function(){return _0xd57129;});}return _0xd57129;}return null;})[_0xb16a('0x1f')](respondWithResult(_0xd80cdf,null))[_0xb16a('0x28')](handleError(_0xd80cdf,null));};var interaction_log=require(_0xb16a('0x15'))(_0xb16a('0x72'));exports[_0xb16a('0x34')]=function(_0xa4922a,_0x57fe97,_0x1777dd){var _0x16dff5={'agent':{},'channel':_0xb16a('0x56')};if(_0xa4922a[_0xb16a('0x53')]['id']){delete _0xa4922a[_0xb16a('0x53')]['id'];}_0xa4922a['body']['UserId']=_0xa4922a['body'][_0xb16a('0x5a')]||_0xa4922a[_0xb16a('0x5b')]['id'];_0x16dff5[_0xb16a('0x5c')]['id']=_0xa4922a[_0xb16a('0x53')]['UserId'];return db[_0xb16a('0x39')][_0xb16a('0x52')]({'where':{'id':_0xa4922a[_0xb16a('0x51')]['id'],'UserId':null}})[_0xb16a('0x1f')](handleEntityNotFound(_0x57fe97,null))[_0xb16a('0x1f')](function(_0x447531){if(_0x447531){_0x16dff5[_0xb16a('0x26')]=_0x447531['get']({'plain':!![]});return db[_0xb16a('0x5d')][_0xb16a('0x52')]({'where':{'id':_0x447531[_0xb16a('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x57fe97,null))['then'](function(_0x5a4ea8){if(_0x5a4ea8){_0x16dff5[_0xb16a('0x60')]=_0x5a4ea8[_0xb16a('0x61')]({'plain':!![]});interaction_log[_0xb16a('0x20')](_0xb16a('0x73'),_0xa4922a[_0xb16a('0x5b')]['id'],_0xa4922a['user'][_0xb16a('0x3f')],_0xa4922a['user'][_0xb16a('0x62')],_0x16dff5['interaction']['id'],_0xa4922a['body']?JSON[_0xb16a('0x63')](_0xa4922a[_0xb16a('0x53')]):_0xb16a('0x64'));return respondWithRpcPromise(_0xb16a('0x74'),_0xb16a('0x75'),_0x16dff5);}return null;})[_0xb16a('0x1f')](function(_0x4b88eb){var _0x15c185=_0xb16a('0x66')+_0x4b88eb[_0xb16a('0x26')]['ContactId'];return db[_0xb16a('0x76')][_0xb16a('0x40')](_0x15c185,{'type':db[_0xb16a('0x67')][_0xb16a('0x77')][_0xb16a('0x78')],'raw':!![]})[_0xb16a('0x1f')](function(_0x34d502){return _0x34d502;});})[_0xb16a('0x1f')](function(_0x2e0d85){if(_0x2e0d85){_0x16dff5[_0xb16a('0x26')][_0xb16a('0x79')]=_0x2e0d85[0x0];if(!_0xa4922a[_0xb16a('0x53')][_0xb16a('0x5a')])return;return db[_0xb16a('0x68')]['find']({'where':{'id':_0xa4922a[_0xb16a('0x53')][_0xb16a('0x5a')],'role':_0xb16a('0x5c')},'attributes':['id',_0xb16a('0x3f'),_0xb16a('0x7a'),_0xb16a('0x69'),_0xb16a('0x6a')],'raw':!![]});}return null;})['then'](function(_0x14d182){if(!_0x14d182)return null;_0x16dff5[_0xb16a('0x26')]['agent']=_0x14d182;return _0x16dff5;})['then'](function(_0x4a8f9d){if(_0x4a8f9d){_0x4a8f9d[_0xb16a('0x26')]['interface']=util[_0xb16a('0x58')]('SIP/%s',_0xa4922a[_0xb16a('0x5b')]['name']);_0x4a8f9d[_0xb16a('0x26')][_0xb16a('0x6d')]=_0x16dff5[_0xb16a('0x6d')];_0x4a8f9d[_0xb16a('0x26')][_0xb16a('0x6e')]=_0x16dff5[_0xb16a('0x6d')];_0x4a8f9d['message'][_0xb16a('0x6f')]=_0xb16a('0x34');respondWithRpcPromise(_0xb16a('0x70'),_0xb16a('0x70'),{'event':_0xb16a('0x7b'),'message':_0x4a8f9d[_0xb16a('0x26')]},client9002);return _0x16dff5;}return null;})[_0xb16a('0x1f')](respondWithResult(_0x57fe97,null))[_0xb16a('0x28')](handleError(_0x57fe97,null));};exports[_0xb16a('0x7c')]=function(_0x12a616,_0x3a2ef9){var _0x5283f9;return db[_0xb16a('0x39')][_0xb16a('0x7c')](_0x12a616[_0xb16a('0x53')],{})[_0xb16a('0x1f')](function(_0x5d0eb3){_0x5283f9=_0x5d0eb3;return db[_0xb16a('0x7d')]['findOne']({'where':{'id':_0x5283f9[_0xb16a('0x7e')]}});})[_0xb16a('0x1f')](function(_0x44ec5f){if(_[_0xb16a('0x7f')](_0x44ec5f)){return;}else{_0x5283f9[_0xb16a('0x56')]=_0x44ec5f[_0xb16a('0x56')];return db[_0xb16a('0x80')][_0xb16a('0x81')]({'where':{'id':_0x5283f9[_0xb16a('0x82')]}});}})[_0xb16a('0x1f')](function(_0x4f7a17){return respondWithRpcPromise(_0xb16a('0x83'),_0xb16a('0x83'),{'FaxAccountId':_['isNil'](_0x12a616[_0xb16a('0x53')])?undefined:_0x12a616[_0xb16a('0x53')][_0xb16a('0x84')],'path':_[_0xb16a('0x7f')](_0x4f7a17)?undefined:util[_0xb16a('0x58')]('/var/opt/motion2/server/files/attachments/%s',_0x4f7a17[_0xb16a('0x85')]),'fax':_[_0xb16a('0x7f')](_0x5283f9[_0xb16a('0x56')])?undefined:_0x5283f9['fax'],'AttachmentId':_0x5283f9[_0xb16a('0x82')]},client9002);})['then'](respondWithResult(_0x3a2ef9,0xc9))[_0xb16a('0x28')](handleError(_0x3a2ef9,null));};exports[_0xb16a('0x86')]=function(_0x1fb908,_0xcea852){var _0x47b5ef=path[_0xb16a('0x87')](config[_0xb16a('0x88')],'server','files','attachments');return db[_0xb16a('0x39')][_0xb16a('0x52')]({'where':{'id':_0x1fb908[_0xb16a('0x51')]['id']},'include':[{'model':db[_0xb16a('0x80')],'as':_0xb16a('0x80')}]})[_0xb16a('0x1f')](handleEntityNotFound(_0xcea852,null))[_0xb16a('0x1f')](function(_0x21179d){if(_0x21179d){return _0xcea852[_0xb16a('0x86')](path[_0xb16a('0x87')](_0x47b5ef,_0x21179d[_0xb16a('0x80')][_0xb16a('0x85')]));}})[_0xb16a('0x28')](handleError(_0xcea852,null));}; \ No newline at end of file +var _0x29e9=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','Attachment','download','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','reject','destroy','stack','name','send','index','map','FaxMessage','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','update','body','find','describe','accept','fax','read'];(function(_0x55fcfe,_0x55fc30){var _0x170825=function(_0x11d637){while(--_0x11d637){_0x55fcfe['push'](_0x55fcfe['shift']());}};_0x170825(++_0x55fc30);}(_0x29e9,0x1de));var _0x929e=function(_0x20aa8f,_0x50ebe3){_0x20aa8f=_0x20aa8f-0x0;var _0x96ed1f=_0x29e9[_0x20aa8f];return _0x96ed1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x929e('0x0'));var rp=require(_0x929e('0x1'));var moment=require(_0x929e('0x2'));var BPromise=require(_0x929e('0x3'));var Mustache=require(_0x929e('0x4'));var util=require(_0x929e('0x5'));var path=require('path');var sox=require(_0x929e('0x6'));var csv=require(_0x929e('0x7'));var ejs=require(_0x929e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x929e('0x9'));var squel=require(_0x929e('0xa'));var crypto=require(_0x929e('0xb'));var jsforce=require(_0x929e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x929e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x929e('0xe'));var hardwareService=require(_0x929e('0xf'));var logger=require(_0x929e('0x10'))(_0x929e('0x11'));var utils=require(_0x929e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x929e('0x13'));var db=require(_0x929e('0x14'))['db'];config[_0x929e('0x15')]=_[_0x929e('0x16')](config['redis'],{'host':_0x929e('0x17'),'port':0x18eb});var socket=require(_0x929e('0x18'))(new Redis(config[_0x929e('0x15')]));require('./faxMessage.socket')[_0x929e('0x19')](socket);var jayson=require(_0x929e('0x1a'));var client=jayson[_0x929e('0x1b')][_0x929e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x929e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x8a38d1,_0x5a75a4,_0x6822f2,_0x3ef0e9){return new BPromise(function(_0x1942a6,_0x2338f3){var _0x4a3b1a=_0x3ef0e9||client;return _0x4a3b1a[_0x929e('0x1d')](_0x8a38d1,_0x6822f2)[_0x929e('0x1e')](function(_0x4f0ce5){logger[_0x929e('0x1f')](_0x929e('0x20'),_0x5a75a4,_0x929e('0x21'));logger[_0x929e('0x22')](_0x929e('0x23'),_0x5a75a4,'request\x20sent',JSON[_0x929e('0x24')](_0x4f0ce5));if(_0x4f0ce5[_0x929e('0x25')]){if(_0x4f0ce5[_0x929e('0x25')][_0x929e('0x26')]===0x1f4){logger[_0x929e('0x25')]('FaxMessage,\x20%s,\x20%s',_0x5a75a4,_0x4f0ce5[_0x929e('0x25')][_0x929e('0x27')]);return _0x2338f3(_0x4f0ce5[_0x929e('0x25')][_0x929e('0x27')]);}logger['error'](_0x929e('0x20'),_0x5a75a4,_0x4f0ce5['error'][_0x929e('0x27')]);return _0x1942a6(_0x4f0ce5[_0x929e('0x25')]['message']);}else{logger[_0x929e('0x1f')](_0x929e('0x20'),_0x5a75a4,_0x929e('0x21'));_0x1942a6(_0x4f0ce5[_0x929e('0x28')][_0x929e('0x27')]);}})[_0x929e('0x29')](function(_0x204bf0){logger[_0x929e('0x25')]('FaxMessage,\x20%s,\x20%s',_0x5a75a4,_0x204bf0);_0x2338f3(_0x204bf0);});});}function respondWithStatusCode(_0x2d91d4,_0x403419){_0x403419=_0x403419||0xcc;return function(_0x49fd08){if(_0x49fd08){return _0x2d91d4[_0x929e('0x2a')](_0x403419);}return _0x2d91d4[_0x929e('0x2b')](_0x403419)[_0x929e('0x2c')]();};}function respondWithResult(_0x235e00,_0x36d8d9){_0x36d8d9=_0x36d8d9||0xc8;return function(_0xfea770){if(_0xfea770){return _0x235e00[_0x929e('0x2b')](_0x36d8d9)['json'](_0xfea770);}};}function respondWithFilteredResult(_0x2fa032,_0x1b9e14){return function(_0x2edabd){if(_0x2edabd){var _0x32d862=typeof _0x1b9e14[_0x929e('0x2d')]==='undefined'&&typeof _0x1b9e14[_0x929e('0x2e')]===_0x929e('0x2f');var _0x22d8ee=_0x2edabd[_0x929e('0x30')];var _0x393966=_0x32d862?0x0:_0x1b9e14['offset'];var _0x5d7c2a=_0x32d862?_0x2edabd[_0x929e('0x30')]:_0x1b9e14[_0x929e('0x2d')]+_0x1b9e14[_0x929e('0x2e')];var _0x34fb24;if(_0x5d7c2a>=_0x22d8ee){_0x5d7c2a=_0x22d8ee;_0x34fb24=0xc8;}else{_0x34fb24=0xce;}_0x2fa032['status'](_0x34fb24);return _0x2fa032[_0x929e('0x31')]('Content-Range',_0x393966+'-'+_0x5d7c2a+'/'+_0x22d8ee)['json'](_0x2edabd);}return null;};}function patchUpdates(_0x6f4aa8){return function(_0xfbf6ed){try{jsonpatch['apply'](_0xfbf6ed,_0x6f4aa8,!![]);}catch(_0xdf7f4a){return BPromise[_0x929e('0x32')](_0xdf7f4a);}return _0xfbf6ed['save']();};}function saveUpdates(_0x1b8306,_0x52e681){return function(_0xb2014c){if(_0xb2014c){return _0xb2014c['update'](_0x1b8306)[_0x929e('0x1e')](function(_0x1dea19){return _0x1dea19;});}return null;};}function removeEntity(_0x3a1619,_0x5ac216){return function(_0xf7cfba){if(_0xf7cfba){return _0xf7cfba[_0x929e('0x33')]()[_0x929e('0x1e')](function(){_0x3a1619[_0x929e('0x2b')](0xcc)[_0x929e('0x2c')]();});}};}function handleEntityNotFound(_0xcc6ca1,_0x476692){return function(_0x72336a){if(!_0x72336a){_0xcc6ca1['sendStatus'](0x194);}return _0x72336a;};}function handleError(_0x5e361e,_0x191391){_0x191391=_0x191391||0x1f4;return function(_0x21570d){logger[_0x929e('0x25')](_0x21570d[_0x929e('0x34')]);if(_0x21570d[_0x929e('0x35')]){delete _0x21570d[_0x929e('0x35')];}_0x5e361e[_0x929e('0x2b')](_0x191391)[_0x929e('0x36')](_0x21570d);};}exports[_0x929e('0x37')]=function(_0x3164bf,_0x2b2a7d){var _0x1ac736={},_0x26b7c6={},_0x3674a4={'count':0x0,'rows':[]};var _0x2cbe0b=_[_0x929e('0x38')](db[_0x929e('0x39')]['rawAttributes'],function(_0x4b836a){return{'name':_0x4b836a['fieldName'],'type':_0x4b836a[_0x929e('0x3a')]['key']};});_0x26b7c6['model']=_[_0x929e('0x38')](_0x2cbe0b,'name');_0x26b7c6[_0x929e('0x3b')]=_[_0x929e('0x3c')](_0x3164bf[_0x929e('0x3b')]);_0x26b7c6[_0x929e('0x3d')]=_['intersection'](_0x26b7c6[_0x929e('0x3e')],_0x26b7c6[_0x929e('0x3b')]);_0x1ac736['attributes']=_[_0x929e('0x3f')](_0x26b7c6[_0x929e('0x3e')],qs[_0x929e('0x40')](_0x3164bf[_0x929e('0x3b')]['fields']));_0x1ac736[_0x929e('0x41')]=_0x1ac736[_0x929e('0x41')][_0x929e('0x42')]?_0x1ac736[_0x929e('0x41')]:_0x26b7c6[_0x929e('0x3e')];if(!_0x3164bf[_0x929e('0x3b')][_0x929e('0x43')](_0x929e('0x44'))){_0x1ac736['limit']=qs[_0x929e('0x2e')](_0x3164bf[_0x929e('0x3b')][_0x929e('0x2e')]);_0x1ac736['offset']=qs['offset'](_0x3164bf['query']['offset']);}_0x1ac736['order']=qs[_0x929e('0x45')](_0x3164bf[_0x929e('0x3b')][_0x929e('0x45')]);_0x1ac736[_0x929e('0x46')]=qs[_0x929e('0x3d')](_[_0x929e('0x47')](_0x3164bf['query'],_0x26b7c6[_0x929e('0x3d')]),_0x2cbe0b);if(_0x3164bf[_0x929e('0x3b')][_0x929e('0x48')]){_0x1ac736[_0x929e('0x46')]=_[_0x929e('0x49')](_0x1ac736[_0x929e('0x46')],{'$or':_[_0x929e('0x38')](_0x2cbe0b,function(_0x152201){if(_0x152201[_0x929e('0x3a')]!==_0x929e('0x4a')){var _0x488981={};_0x488981[_0x152201['name']]={'$like':'%'+_0x3164bf[_0x929e('0x3b')][_0x929e('0x48')]+'%'};return _0x488981;}})});}_0x1ac736=_[_0x929e('0x49')]({},_0x1ac736,_0x3164bf[_0x929e('0x4b')]);var _0x89a4a0={'where':_0x1ac736[_0x929e('0x46')]};return db[_0x929e('0x39')][_0x929e('0x30')](_0x89a4a0)[_0x929e('0x1e')](function(_0x904101){_0x3674a4[_0x929e('0x30')]=_0x904101;if(_0x3164bf['query'][_0x929e('0x4c')]){_0x1ac736[_0x929e('0x4d')]=[{'all':!![]}];}return db[_0x929e('0x39')][_0x929e('0x4e')](_0x1ac736);})[_0x929e('0x1e')](function(_0x255448){_0x3674a4[_0x929e('0x4f')]=_0x255448;return _0x3674a4;})['then'](respondWithFilteredResult(_0x2b2a7d,_0x1ac736))[_0x929e('0x29')](handleError(_0x2b2a7d,null));};exports[_0x929e('0x50')]=function(_0xcf533b,_0x492cbb){var _0x3b0816={'raw':!![],'where':{'id':_0xcf533b[_0x929e('0x51')]['id']}},_0x589d56={};_0x589d56[_0x929e('0x3e')]=_[_0x929e('0x3c')](db[_0x929e('0x39')][_0x929e('0x52')]);_0x589d56[_0x929e('0x3b')]=_['keys'](_0xcf533b[_0x929e('0x3b')]);_0x589d56[_0x929e('0x3d')]=_[_0x929e('0x3f')](_0x589d56[_0x929e('0x3e')],_0x589d56[_0x929e('0x3b')]);_0x3b0816[_0x929e('0x41')]=_['intersection'](_0x589d56[_0x929e('0x3e')],qs[_0x929e('0x40')](_0xcf533b['query'][_0x929e('0x40')]));_0x3b0816[_0x929e('0x41')]=_0x3b0816[_0x929e('0x41')][_0x929e('0x42')]?_0x3b0816[_0x929e('0x41')]:_0x589d56[_0x929e('0x3e')];if(_0xcf533b[_0x929e('0x3b')][_0x929e('0x4c')]){_0x3b0816[_0x929e('0x4d')]=[{'all':!![]}];}_0x3b0816=_[_0x929e('0x49')]({},_0x3b0816,_0xcf533b[_0x929e('0x4b')]);return db['FaxMessage']['find'](_0x3b0816)[_0x929e('0x1e')](handleEntityNotFound(_0x492cbb,null))[_0x929e('0x1e')](respondWithResult(_0x492cbb,null))[_0x929e('0x29')](handleError(_0x492cbb,null));};exports[_0x929e('0x53')]=function(_0x3a63a2,_0x18bb8d){if(_0x3a63a2[_0x929e('0x54')]['id']){delete _0x3a63a2[_0x929e('0x54')]['id'];}return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x3a63a2[_0x929e('0x51')]['id']}})[_0x929e('0x1e')](handleEntityNotFound(_0x18bb8d,null))['then'](saveUpdates(_0x3a63a2[_0x929e('0x54')],null))[_0x929e('0x1e')](respondWithResult(_0x18bb8d,null))[_0x929e('0x29')](handleError(_0x18bb8d,null));};exports[_0x929e('0x33')]=function(_0x317a11,_0x51600b){return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x317a11[_0x929e('0x51')]['id']}})['then'](handleEntityNotFound(_0x51600b,null))[_0x929e('0x1e')](removeEntity(_0x51600b,null))[_0x929e('0x29')](handleError(_0x51600b,null));};exports[_0x929e('0x56')]=function(_0x2c8a38,_0x33319d){return db[_0x929e('0x39')][_0x929e('0x56')]()[_0x929e('0x1e')](respondWithResult(_0x33319d,null))[_0x929e('0x29')](handleError(_0x33319d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x929e('0x57')]=function(_0x24f803,_0x1ebfcc,_0x53690b){var _0x2e937c={'agent':{},'channel':_0x929e('0x58')};if(_0x24f803[_0x929e('0x54')]['id']){delete _0x24f803[_0x929e('0x54')]['id'];}_0x24f803[_0x929e('0x54')][_0x929e('0x59')]=!![];_0x24f803['body'][_0x929e('0x5a')]=moment()[_0x929e('0x5b')](_0x929e('0x5c'));_0x24f803['body']['UserId']=_0x24f803['body']['UserId']||_0x24f803['user']['id'];_0x2e937c[_0x929e('0x5d')]['id']=_0x24f803[_0x929e('0x54')][_0x929e('0x5e')];return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x24f803['params']['id'],'UserId':null}})[_0x929e('0x1e')](handleEntityNotFound(_0x1ebfcc,null))[_0x929e('0x1e')](saveUpdates(_0x24f803[_0x929e('0x54')],null))[_0x929e('0x1e')](function(_0x1d1999){if(_0x1d1999){_0x2e937c[_0x929e('0x27')]=_0x1d1999['get']({'plain':!![]});return db[_0x929e('0x5f')][_0x929e('0x55')]({'where':{'id':_0x1d1999[_0x929e('0x60')]}});}return null;})[_0x929e('0x1e')](handleEntityNotFound(_0x1ebfcc,null))['then'](function(_0x41c11e){if(_0x41c11e){return _0x41c11e[_0x929e('0x53')]({'UserId':_0x24f803[_0x929e('0x54')][_0x929e('0x5e')],'read1stAt':_[_0x929e('0x61')](_0x41c11e[_0x929e('0x62')])?moment()[_0x929e('0x5b')](_0x929e('0x5c')):undefined});}return null;})[_0x929e('0x1e')](function(_0x29471b){if(_0x29471b){_0x2e937c[_0x929e('0x63')]=_0x29471b[_0x929e('0x64')]({'plain':!![]});interaction_log[_0x929e('0x1f')](_0x929e('0x65'),_0x24f803[_0x929e('0x66')]['id'],_0x24f803[_0x929e('0x66')][_0x929e('0x35')],_0x24f803['user'][_0x929e('0x67')],_0x2e937c['interaction']['id'],_0x24f803['body']?JSON[_0x929e('0x24')](_0x24f803[_0x929e('0x54')]):_0x929e('0x68'));return respondWithRpcPromise(_0x929e('0x69'),'acceptMessage',_0x2e937c);}return null;})[_0x929e('0x1e')](function(_0x5caad9){var _0x5c352d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5caad9[_0x929e('0x27')][_0x929e('0x6a')];return db[_0x929e('0x6b')]['query'](_0x5c352d,{'type':db[_0x929e('0x6c')][_0x929e('0x6d')][_0x929e('0x6e')],'raw':!![]})[_0x929e('0x1e')](function(_0x24608a){return _0x24608a;});})[_0x929e('0x1e')](function(_0x550eb6){if(_0x550eb6){_0x2e937c[_0x929e('0x27')][_0x929e('0x6f')]=_0x550eb6[0x0];if(!_0x24f803[_0x929e('0x54')]['UserId'])return;return db['User'][_0x929e('0x55')]({'where':{'id':_0x24f803['body'][_0x929e('0x5e')],'role':_0x929e('0x5d')},'attributes':['id','name',_0x929e('0x70'),_0x929e('0x71'),_0x929e('0x72')],'raw':!![]});}return null;})['then'](function(_0x5ed24a){if(!_0x5ed24a)return null;_0x2e937c[_0x929e('0x27')][_0x929e('0x5d')]=_0x5ed24a;return _0x2e937c;})[_0x929e('0x1e')](function(_0x46370e){if(_0x46370e){if(_0x24f803[_0x929e('0x54')][_0x929e('0x73')]){_0x2e937c[_0x929e('0x27')][_0x929e('0x74')]=util[_0x929e('0x5b')](_0x929e('0x75'),_0x24f803[_0x929e('0x66')][_0x929e('0x35')]);_0x2e937c[_0x929e('0x27')]['channel']=_0x2e937c[_0x929e('0x76')];_0x2e937c[_0x929e('0x27')][_0x929e('0x77')]=_0x2e937c['channel'];_0x2e937c[_0x929e('0x27')][_0x929e('0x78')]=_0x929e('0x57');return respondWithRpcPromise(_0x929e('0x79'),_0x929e('0x79'),{'event':'acceptmessage','message':_0x2e937c[_0x929e('0x27')]},client9002)[_0x929e('0x1e')](function(){return _0x2e937c;});}return _0x2e937c;}return null;})['then'](respondWithResult(_0x1ebfcc,null))[_0x929e('0x29')](handleError(_0x1ebfcc,null));};var interaction_log=require(_0x929e('0x10'))(_0x929e('0x7a'));exports['reject']=function(_0x274865,_0x47c0c3,_0xa0a588){var _0x29eff3={'agent':{},'channel':'fax'};if(_0x274865[_0x929e('0x54')]['id']){delete _0x274865[_0x929e('0x54')]['id'];}_0x274865[_0x929e('0x54')][_0x929e('0x5e')]=_0x274865[_0x929e('0x54')][_0x929e('0x5e')]||_0x274865[_0x929e('0x66')]['id'];_0x29eff3[_0x929e('0x5d')]['id']=_0x274865[_0x929e('0x54')][_0x929e('0x5e')];return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x274865[_0x929e('0x51')]['id'],'UserId':null}})[_0x929e('0x1e')](handleEntityNotFound(_0x47c0c3,null))[_0x929e('0x1e')](function(_0x1183aa){if(_0x1183aa){_0x29eff3[_0x929e('0x27')]=_0x1183aa[_0x929e('0x64')]({'plain':!![]});return db[_0x929e('0x5f')][_0x929e('0x55')]({'where':{'id':_0x1183aa[_0x929e('0x60')]}});}return null;})[_0x929e('0x1e')](handleEntityNotFound(_0x47c0c3,null))[_0x929e('0x1e')](function(_0x3060cd){if(_0x3060cd){_0x29eff3['interaction']=_0x3060cd[_0x929e('0x64')]({'plain':!![]});interaction_log[_0x929e('0x1f')](_0x929e('0x7b'),_0x274865[_0x929e('0x66')]['id'],_0x274865[_0x929e('0x66')]['name'],_0x274865[_0x929e('0x66')]['role'],_0x29eff3[_0x929e('0x63')]['id'],_0x274865['body']?JSON[_0x929e('0x24')](_0x274865[_0x929e('0x54')]):'null');return respondWithRpcPromise(_0x929e('0x7c'),_0x929e('0x7d'),_0x29eff3);}return null;})[_0x929e('0x1e')](function(_0x317b75){var _0x34394b=_0x929e('0x7e')+_0x317b75['message']['ContactId'];return db[_0x929e('0x6b')][_0x929e('0x3b')](_0x34394b,{'type':db[_0x929e('0x6c')][_0x929e('0x6d')][_0x929e('0x6e')],'raw':!![]})['then'](function(_0x377150){return _0x377150;});})['then'](function(_0x4d7eb1){if(_0x4d7eb1){_0x29eff3['message'][_0x929e('0x6f')]=_0x4d7eb1[0x0];if(!_0x274865[_0x929e('0x54')][_0x929e('0x5e')])return;return db[_0x929e('0x7f')][_0x929e('0x55')]({'where':{'id':_0x274865['body'][_0x929e('0x5e')],'role':_0x929e('0x5d')},'attributes':['id',_0x929e('0x35'),'fullname',_0x929e('0x71'),_0x929e('0x72')],'raw':!![]});}return null;})[_0x929e('0x1e')](function(_0x56fcc4){if(!_0x56fcc4)return null;_0x29eff3[_0x929e('0x27')][_0x929e('0x5d')]=_0x56fcc4;return _0x29eff3;})[_0x929e('0x1e')](function(_0xf8c1c3){if(_0xf8c1c3){_0xf8c1c3[_0x929e('0x27')]['interface']=util[_0x929e('0x5b')](_0x929e('0x75'),_0x274865[_0x929e('0x66')][_0x929e('0x35')]);_0xf8c1c3['message']['channel']=_0x29eff3['channel'];_0xf8c1c3['message'][_0x929e('0x77')]=_0x29eff3[_0x929e('0x76')];_0xf8c1c3[_0x929e('0x27')][_0x929e('0x78')]=_0x929e('0x32');respondWithRpcPromise(_0x929e('0x79'),'EventManager',{'event':_0x929e('0x80'),'message':_0xf8c1c3[_0x929e('0x27')]},client9002);return _0x29eff3;}return null;})[_0x929e('0x1e')](respondWithResult(_0x47c0c3,null))[_0x929e('0x29')](handleError(_0x47c0c3,null));};exports[_0x929e('0x81')]=function(_0x19e807,_0x425af9){var _0x27b899;return db[_0x929e('0x39')]['create'](_0x19e807['body'],{})[_0x929e('0x1e')](function(_0x19a980){_0x27b899=_0x19a980;return db[_0x929e('0x82')]['findOne']({'where':{'id':_0x27b899[_0x929e('0x6a')]}});})['then'](function(_0x375520){if(_[_0x929e('0x61')](_0x375520)){return;}else{_0x27b899[_0x929e('0x58')]=_0x375520[_0x929e('0x58')];return db['Attachment'][_0x929e('0x83')]({'where':{'id':_0x27b899[_0x929e('0x84')]}});}})[_0x929e('0x1e')](function(_0x5a08f5){return respondWithRpcPromise(_0x929e('0x85'),_0x929e('0x85'),{'FaxAccountId':_['isNil'](_0x19e807[_0x929e('0x54')])?undefined:_0x19e807[_0x929e('0x54')]['FaxAccountId'],'path':_[_0x929e('0x61')](_0x5a08f5)?undefined:util['format'](_0x929e('0x86'),_0x5a08f5[_0x929e('0x87')]),'fax':_[_0x929e('0x61')](_0x27b899['fax'])?undefined:_0x27b899[_0x929e('0x58')],'AttachmentId':_0x27b899['AttachmentId']},client9002);})['then'](respondWithResult(_0x425af9,0xc9))[_0x929e('0x29')](handleError(_0x425af9,null));};exports['download']=function(_0x1537ef,_0x4cf3de){var _0x4a0a10=path[_0x929e('0x88')](config[_0x929e('0x89')],_0x929e('0x8a'),'files',_0x929e('0x8b'));return db[_0x929e('0x39')][_0x929e('0x55')]({'where':{'id':_0x1537ef['params']['id']},'include':[{'model':db[_0x929e('0x8c')],'as':_0x929e('0x8c')}]})['then'](handleEntityNotFound(_0x4cf3de,null))[_0x929e('0x1e')](function(_0x138715){if(_0x138715){return _0x4cf3de[_0x929e('0x8d')](path[_0x929e('0x88')](_0x4a0a10,_0x138715[_0x929e('0x8c')][_0x929e('0x87')]));}})[_0x929e('0x29')](handleError(_0x4cf3de,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3e38457..e8a7334 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 _0xc9ab=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x519959,_0x30bb3a){var _0x24c418=function(_0x36d481){while(--_0x36d481){_0x519959['push'](_0x519959['shift']());}};_0x24c418(++_0x30bb3a);}(_0xc9ab,0x125));var _0xbc9a=function(_0x646db,_0x125f4b){_0x646db=_0x646db-0x0;var _0x54979f=_0xc9ab[_0x646db];return _0x54979f;};'use strict';var EventEmitter=require(_0xbc9a('0x0'));var FaxMessage=require(_0xbc9a('0x1'))['db'][_0xbc9a('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbc9a('0x3')};function emitEvent(_0x20e8eb){return function(_0x23d40c,_0x33e557,_0x16f84d){FaxMessageEvents[_0xbc9a('0x4')](_0x20e8eb+':'+_0x23d40c['id'],_0x23d40c);FaxMessageEvents[_0xbc9a('0x4')](_0x20e8eb,_0x23d40c);_0x16f84d(null);};}for(var e in events){if(events[_0xbc9a('0x5')](e)){var event=events[e];FaxMessage[_0xbc9a('0x6')](e,emitEvent(event));}}module[_0xbc9a('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x44fe=['FaxMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x44fe,0x16f));var _0xe44f=function(_0x9dce5c,_0x5e835e){_0x9dce5c=_0x9dce5c-0x0;var _0x39dfb6=_0x44fe[_0x9dce5c];return _0x39dfb6;};'use strict';var EventEmitter=require(_0xe44f('0x0'));var FaxMessage=require(_0xe44f('0x1'))['db'][_0xe44f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe44f('0x3')](0x0);var events={'afterCreate':_0xe44f('0x4'),'afterUpdate':_0xe44f('0x5'),'afterDestroy':_0xe44f('0x6')};function emitEvent(_0x3f66c9){return function(_0x1e14a5,_0x44b438,_0x2e1d0a){FaxMessageEvents['emit'](_0x3f66c9+':'+_0x1e14a5['id'],_0x1e14a5);FaxMessageEvents['emit'](_0x3f66c9,_0x1e14a5);_0x2e1d0a(null);};}for(var e in events){if(events[_0xe44f('0x7')](e)){var event=events[e];FaxMessage[_0xe44f('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3274492..c64eea5 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 _0x1c0d=['direction','toLowerCase','out','secret','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT'];(function(_0x4547b2,_0x4cf460){var _0x4f5195=function(_0x4c4c27){while(--_0x4c4c27){_0x4547b2['push'](_0x4547b2['shift']());}};_0x4f5195(++_0x4cf460);}(_0x1c0d,0x1ed));var _0xd1c0=function(_0x28dbd1,_0x1ad08e){_0x28dbd1=_0x28dbd1-0x0;var _0x1e24d3=_0x1c0d[_0x28dbd1];return _0x1e24d3;};'use strict';var _=require(_0xd1c0('0x0'));var util=require(_0xd1c0('0x1'));var logger=require(_0xd1c0('0x2'))(_0xd1c0('0x3'));var moment=require(_0xd1c0('0x4'));var BPromise=require(_0xd1c0('0x5'));var rp=require(_0xd1c0('0x6'));var fs=require('fs');var path=require(_0xd1c0('0x7'));var rimraf=require(_0xd1c0('0x8'));var config=require(_0xd1c0('0x9'));var attributes=require(_0xd1c0('0xa'));module['exports']=function(_0x20435b,_0x1cce1b){return _0x20435b[_0xd1c0('0xb')](_0xd1c0('0xc'),attributes,{'tableName':_0xd1c0('0xd'),'paranoid':![],'indexes':[{'name':_0xd1c0('0xe'),'fields':[_0xd1c0('0xf')],'type':_0xd1c0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fdd4f,_0x5c80c1,_0xcc8ed2){var _0x3e6f44=_0x20435b['models'];var _0x49c87b=_0x4fdd4f['get']({'plain':!![]});if(_0x49c87b[_0xd1c0('0x11')][_0xd1c0('0x12')]()==='in'||_0x49c87b['direction'][_0xd1c0('0x12')]()===_0xd1c0('0x13')&&!_0x49c87b[_0xd1c0('0x14')]&&!_['isNil'](_0x49c87b['UserId'])){_0x3e6f44['FaxInteraction'][_0xd1c0('0x15')]({'where':{'id':_0x49c87b[_0xd1c0('0x16')]}})[_0xd1c0('0x17')](function(_0x1e4943){if(_0x1e4943){_0x1e4943[_0xd1c0('0x18')]({'lastMsgAt':_0x49c87b[_0xd1c0('0x19')],'lastMsgDirection':_0x49c87b[_0xd1c0('0x11')]['toLowerCase']()});}})[_0xd1c0('0x1a')](function(_0x3206e5){console[_0xd1c0('0x1b')](_0x3206e5);});}_0xcc8ed2();}},'charset':_0xd1c0('0x1c'),'collate':_0xd1c0('0x1d')});}; \ No newline at end of file +var _0xe99d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','body','models','get','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x33c41b,_0x5c8fbe){var _0xa19c5=function(_0x314ba9){while(--_0x314ba9){_0x33c41b['push'](_0x33c41b['shift']());}};_0xa19c5(++_0x5c8fbe);}(_0xe99d,0x15b));var _0xde99=function(_0x5e1762,_0x35541a){_0x5e1762=_0x5e1762-0x0;var _0x5b7c4a=_0xe99d[_0x5e1762];return _0x5b7c4a;};'use strict';var _=require(_0xde99('0x0'));var util=require('util');var logger=require(_0xde99('0x1'))(_0xde99('0x2'));var moment=require(_0xde99('0x3'));var BPromise=require(_0xde99('0x4'));var rp=require(_0xde99('0x5'));var fs=require('fs');var path=require(_0xde99('0x6'));var rimraf=require(_0xde99('0x7'));var config=require(_0xde99('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x3f147f,_0x384e72){return _0x3f147f[_0xde99('0x9')](_0xde99('0xa'),attributes,{'tableName':_0xde99('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xde99('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e4146,_0x122b58,_0xd7a093){var _0x3f30fe=_0x3f147f[_0xde99('0xd')];var _0x12e5fa=_0x3e4146[_0xde99('0xe')]({'plain':!![]});if(_0x12e5fa['direction']['toLowerCase']()==='in'||_0x12e5fa['direction'][_0xde99('0xf')]()===_0xde99('0x10')&&!_0x12e5fa[_0xde99('0x11')]&&!_[_0xde99('0x12')](_0x12e5fa['UserId'])){_0x3f30fe[_0xde99('0x13')][_0xde99('0x14')]({'where':{'id':_0x12e5fa[_0xde99('0x15')]}})['then'](function(_0x1bf7b1){if(_0x1bf7b1){_0x1bf7b1[_0xde99('0x16')]({'lastMsgAt':_0x12e5fa[_0xde99('0x17')],'lastMsgDirection':_0x12e5fa[_0xde99('0x18')][_0xde99('0xf')]()});}})[_0xde99('0x19')](function(_0x286bf2){console[_0xde99('0x1a')](_0x286bf2);});}_0xd7a093();}},'charset':_0xde99('0x1b'),'collate':_0xde99('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 75626e6..7f707b1 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 _0x3e74=['result','catch','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','create','body','options','raw','then','attributes','limit','UpdateFaxMessage','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5255d6,_0x8ea560){var _0x53810d=function(_0x1335be){while(--_0x1335be){_0x5255d6['push'](_0x5255d6['shift']());}};_0x53810d(++_0x8ea560);}(_0x3e74,0x175));var _0x43e7=function(_0x1830c0,_0x485349){_0x1830c0=_0x1830c0-0x0;var _0x4406cc=_0x3e74[_0x1830c0];return _0x4406cc;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});config['redis']=_[_0x43e7('0xa')](config[_0x43e7('0xb')],{'host':_0x43e7('0xc'),'port':0x18eb});var socket=require(_0x43e7('0xd'))(new Redis(config[_0x43e7('0xb')]));require('./faxMessage.socket')[_0x43e7('0xe')](socket);function respondWithRpcPromise(_0x554d44,_0x54948c,_0x39c8bd){return new BPromise(function(_0x4139c9,_0x5c34f4){return client[_0x43e7('0xf')](_0x554d44,_0x39c8bd)['then'](function(_0xf7c520){logger[_0x43e7('0x10')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));logger[_0x43e7('0x12')](_0x43e7('0x13'),_0x54948c,_0x43e7('0x11'),JSON['stringify'](_0xf7c520));if(_0xf7c520['error']){if(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x15')]===0x1f4){logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x5c34f4(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x4139c9(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));_0x4139c9(_0xf7c520[_0x43e7('0x17')][_0x43e7('0x16')]);}})[_0x43e7('0x18')](function(_0x3776f5){logger[_0x43e7('0x14')](_0x43e7('0x19'),_0x54948c,_0x3776f5);_0x5c34f4(_0x3776f5);});});}exports[_0x43e7('0x1a')]=function(_0x2377a3){var _0xab63cf=this;return new Promise(function(_0x191dd5,_0x177ee1){return db['FaxMessage'][_0x43e7('0x1b')](_0x2377a3[_0x43e7('0x1c')],{'raw':_0x2377a3['options']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![]})[_0x43e7('0x1f')](function(_0x28aacc){logger[_0x43e7('0x10')](_0x43e7('0x1a'),_0x2377a3);logger['debug'](_0x43e7('0x1a'),_0x2377a3,JSON['stringify'](_0x28aacc));_0x191dd5(_0x28aacc);})['catch'](function(_0x47204e){logger[_0x43e7('0x14')]('CreateFaxMessage',_0x47204e[_0x43e7('0x16')],_0x2377a3);_0x177ee1(_0xab63cf['error'](0x1f4,_0x47204e[_0x43e7('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x1af208){var _0x1b5f50=this;return new Promise(function(_0x20888b,_0x405f85){return db['FaxMessage']['update'](_0x1af208[_0x43e7('0x1c')],{'raw':_0x1af208['options']?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')]['where']||null:null,'attributes':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x20')]||null:null,'limit':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x21')]||null:null})[_0x43e7('0x1f')](function(_0x31b2a6){logger[_0x43e7('0x10')](_0x43e7('0x22'),_0x1af208);logger[_0x43e7('0x12')](_0x43e7('0x22'),_0x1af208,JSON[_0x43e7('0x23')](_0x31b2a6));_0x20888b(_0x31b2a6);})[_0x43e7('0x18')](function(_0x4bdb17){logger[_0x43e7('0x14')](_0x43e7('0x22'),_0x4bdb17[_0x43e7('0x16')],_0x1af208);_0x405f85(_0x1b5f50[_0x43e7('0x14')](0x1f4,_0x4bdb17[_0x43e7('0x16')]));});});}; \ No newline at end of file +var _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0xae7072,_0x625cc4){var _0x55414e=function(_0x4bb456){while(--_0x4bb456){_0xae7072['push'](_0xae7072['shift']());}};_0x55414e(++_0x625cc4);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x24c2a9,_0x5bb58e){_0x24c2a9=_0x24c2a9-0x0;var _0x53a2a2=_0xd6d6[_0x24c2a9];return _0x53a2a2;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f36eaab..d0b456c 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 _0xabed=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x1e068c,_0x4c913e){var _0x46d180=function(_0x47a3a6){while(--_0x47a3a6){_0x1e068c['push'](_0x1e068c['shift']());}};_0x46d180(++_0x4c913e);}(_0xabed,0xc0));var _0xdabe=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xabed[_0x3e6729];return _0x535bcd;};'use strict';var FaxMessageEvents=require(_0xdabe('0x0'));var events=[_0xdabe('0x1'),_0xdabe('0x2'),_0xdabe('0x3')];function createListener(_0x458e12,_0x5b2075){return function(_0x5019c6){_0x5b2075[_0xdabe('0x4')](_0x458e12,_0x5019c6);};}function removeListener(_0x583772,_0x52731e){return function(){FaxMessageEvents[_0xdabe('0x5')](_0x583772,_0x52731e);};}exports[_0xdabe('0x6')]=function(_0x507b89){for(var _0x521ff2=0x0,_0x558572=events[_0xdabe('0x7')];_0x521ff2<_0x558572;_0x521ff2++){var _0x10dc76=events[_0x521ff2];var _0x4024a2=createListener(_0xdabe('0x8')+_0x10dc76,_0x507b89);FaxMessageEvents['on'](_0x10dc76,_0x4024a2);}}; \ No newline at end of file +var _0x87f2=['length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x30a2cd,_0x4261d9){var _0x386733=function(_0x2b73c7){while(--_0x2b73c7){_0x30a2cd['push'](_0x30a2cd['shift']());}};_0x386733(++_0x4261d9);}(_0x87f2,0x87));var _0x287f=function(_0x58c6f6,_0x4ddb62){_0x58c6f6=_0x58c6f6-0x0;var _0x4a37ff=_0x87f2[_0x58c6f6];return _0x4a37ff;};'use strict';var FaxMessageEvents=require(_0x287f('0x0'));var events=[_0x287f('0x1'),_0x287f('0x2'),_0x287f('0x3')];function createListener(_0x3af52c,_0x6d0b67){return function(_0x2b7c69){_0x6d0b67[_0x287f('0x4')](_0x3af52c,_0x2b7c69);};}function removeListener(_0x57e5d1,_0xeb23b){return function(){FaxMessageEvents['removeListener'](_0x57e5d1,_0xeb23b);};}exports['register']=function(_0x30e822){for(var _0x4950c2=0x0,_0x1b835d=events[_0x287f('0x5')];_0x4950c2<_0x1b835d;_0x4950c2++){var _0x3cde4f=events[_0x4950c2];var _0x42ccdc=createListener(_0x287f('0x6')+_0x3cde4f,_0x30e822);FaxMessageEvents['on'](_0x3cde4f,_0x42ccdc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ed03c5b..545a997 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 _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0xcaecb8,_0x1421cb){var _0x4f8a0a=function(_0x104e4b){while(--_0x104e4b){_0xcaecb8['push'](_0xcaecb8['shift']());}};_0x4f8a0a(++_0x1421cb);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1bb18c,_0x5ccfa6){_0x1bb18c=_0x1bb18c-0x0;var _0xe49d38=_0xee5b[_0x1bb18c];return _0xe49d38;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file +var _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20275f,_0x4528c5){var _0x5a5457=function(_0x2bd2cc){while(--_0x2bd2cc){_0x20275f['push'](_0x20275f['shift']());}};_0x5a5457(++_0x4528c5);}(_0x593e,0xcb));var _0xe593=function(_0x555774,_0x400a0a){_0x555774=_0x555774-0x0;var _0x1f84f9=_0x593e[_0x555774];return _0x1f84f9;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0f479e9..b1b3777 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 _0x0810=['roundrobin','STRING','INTEGER','ENUM','beepall'];(function(_0x215f9e,_0x438b14){var _0x217ce4=function(_0x2d8081){while(--_0x2d8081){_0x215f9e['push'](_0x215f9e['shift']());}};_0x217ce4(++_0x438b14);}(_0x0810,0x1e6));var _0x0081=function(_0x5d4cf1,_0x48fde0){_0x5d4cf1=_0x5d4cf1-0x0;var _0x1e50e8=_0x0810[_0x5d4cf1];return _0x1e50e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0081('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0081('0x0')]},'timeout':{'type':Sequelize[_0x0081('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0081('0x2')]('rrmemory',_0x0081('0x3'),_0x0081('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0081('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x11d1=['rrmemory','beepall','INTEGER','sequelize','STRING','name','ENUM'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x11d1,0x184));var _0x111d=function(_0x454f5b,_0x286ba1){_0x454f5b=_0x454f5b-0x0;var _0x5dcb77=_0x11d1[_0x454f5b];return _0x5dcb77;};'use strict';var Sequelize=require(_0x111d('0x0'));module['exports']={'name':{'type':Sequelize[_0x111d('0x1')],'unique':_0x111d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x111d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x111d('0x3')](_0x111d('0x4'),_0x111d('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x111d('0x6')],'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 5863710..bb187f1 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 _0xdded=['addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','end','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','user','role','FaxQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','findOne','Team','rawAttributes','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','isEmpty','removeAgents'];(function(_0x4f1d29,_0x4f33c6){var _0x8486f7=function(_0x10cee8){while(--_0x10cee8){_0x4f1d29['push'](_0x4f1d29['shift']());}};_0x8486f7(++_0x4f33c6);}(_0xdded,0x17a));var _0xddde=function(_0x518967,_0x483923){_0x518967=_0x518967-0x0;var _0xbbcc81=_0xdded[_0x518967];return _0xbbcc81;};'use strict';var BPromise=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var _=require(_0xddde('0x2'));var squel=require(_0xddde('0x3'));var Redis=require(_0xddde('0x4'));var qs=require(_0xddde('0x5'));var logger=require('../../config/logger')(_0xddde('0x6'));var config=require(_0xddde('0x7'));var db=require(_0xddde('0x8'))['db'];config[_0xddde('0x9')]=_[_0xddde('0xa')](config[_0xddde('0x9')],{'host':_0xddde('0xb'),'port':0x18eb});var socket=require(_0xddde('0xc'))(new Redis(config[_0xddde('0x9')]));require(_0xddde('0xd'))[_0xddde('0xe')](socket);function respondWithStatusCode(_0x5f1a34,_0x32723a){_0x32723a=_0x32723a||0xcc;return function(_0x4f0f3c){if(_0x4f0f3c){return _0x5f1a34['sendStatus'](_0x32723a);}return _0x5f1a34['status'](_0x32723a)[_0xddde('0xf')]();};}function respondWithResult(_0x567859,_0x247097){_0x247097=_0x247097||0xc8;return function(_0x5a01fc){if(_0x5a01fc){return _0x567859[_0xddde('0x10')](_0x247097)[_0xddde('0x11')](_0x5a01fc);}};}function respondWithFilteredResult(_0xaaed0c,_0x27a882){return function(_0x29a446){if(_0x29a446){var _0xb8ed21=typeof _0x27a882[_0xddde('0x12')]===_0xddde('0x13')&&typeof _0x27a882['limit']===_0xddde('0x13');var _0x218779=_0x29a446[_0xddde('0x14')];var _0x860ff4=_0xb8ed21?0x0:_0x27a882[_0xddde('0x12')];var _0x31c111=_0xb8ed21?_0x29a446['count']:_0x27a882[_0xddde('0x12')]+_0x27a882[_0xddde('0x15')];var _0x3698d4;if(_0x31c111>=_0x218779){_0x31c111=_0x218779;_0x3698d4=0xc8;}else{_0x3698d4=0xce;}_0xaaed0c['status'](_0x3698d4);return _0xaaed0c['set'](_0xddde('0x16'),_0x860ff4+'-'+_0x31c111+'/'+_0x218779)['json'](_0x29a446);}return null;};}function saveUpdates(_0x30a9da){return function(_0x441bc9){if(_0x441bc9){return _0x441bc9[_0xddde('0x17')](_0x30a9da)[_0xddde('0x18')](function(_0x2f0e58){return _0x2f0e58;});}return null;};}function removeEntity(_0x55349b){return function(_0x249f19){if(_0x249f19){return _0x249f19[_0xddde('0x19')]()['then'](function(){var _0x221df0=_0x249f19[_0xddde('0x1a')]({'plain':!![]});var _0x556a47='FaxQueues';return db[_0xddde('0x1b')]['destroy']({'where':{'type':_0x556a47,'resourceId':_0x221df0['id']}})[_0xddde('0x18')](function(){return _0x249f19;});})['then'](function(){_0x55349b[_0xddde('0x10')](0xcc)[_0xddde('0xf')]();});}};}function handleEntityNotFound(_0x558e37){return function(_0x4ae0a8){if(!_0x4ae0a8){_0x558e37[_0xddde('0x1c')](0x194);}return _0x4ae0a8;};}function handleError(_0x107bca,_0x97bb0f){_0x97bb0f=_0x97bb0f||0x1f4;return function(_0x275f76){logger[_0xddde('0x1d')](_0x275f76[_0xddde('0x1e')]);if(_0x275f76[_0xddde('0x1f')]){delete _0x275f76['name'];}_0x107bca['status'](_0x97bb0f)[_0xddde('0x20')](_0x275f76);};}exports[_0xddde('0x21')]=function(_0x40f2d6,_0x306c01){var _0xdb57ef={};var _0x533332={'count':0x0,'rows':[]};var _0x394da0=_[_0xddde('0x22')](db['FaxQueue']['rawAttributes'],function(_0xa60e85){return{'name':_0xa60e85[_0xddde('0x23')],'type':_0xa60e85['type'][_0xddde('0x24')]};});_0xdb57ef=qs[_0xddde('0x25')](_0x394da0,_0x40f2d6);var _0x5328ac={'where':_0xdb57ef[_0xddde('0x26')]};return db[_0xddde('0x27')][_0xddde('0x14')](_0x5328ac)[_0xddde('0x18')](function(_0x477d44){_0x533332[_0xddde('0x14')]=_0x477d44;_0xdb57ef[_0xddde('0x28')]=qs[_0xddde('0x28')](_0x40f2d6[_0xddde('0x29')]);return db[_0xddde('0x27')][_0xddde('0x2a')](_0xdb57ef);})[_0xddde('0x18')](function(_0xe3d006){_0x533332[_0xddde('0x2b')]=_0xe3d006;return _0x533332;})[_0xddde('0x18')](respondWithFilteredResult(_0x306c01,_0xdb57ef))[_0xddde('0x2c')](handleError(_0x306c01,null));};exports[_0xddde('0x2d')]=function(_0x24f01b,_0x2969b0){var _0x2c5d25={'raw':!![],'where':{'id':_0x24f01b['params']['id']}},_0x483c9d={};_0x483c9d[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x27')]['rawAttributes']);_0x483c9d['query']=_[_0xddde('0x2f')](_0x24f01b[_0xddde('0x29')]);_0x483c9d[_0xddde('0x30')]=_[_0xddde('0x31')](_0x483c9d['model'],_0x483c9d[_0xddde('0x29')]);_0x2c5d25['attributes']=_[_0xddde('0x31')](_0x483c9d[_0xddde('0x2e')],qs[_0xddde('0x32')](_0x24f01b[_0xddde('0x29')][_0xddde('0x32')]));_0x2c5d25[_0xddde('0x33')]=_0x2c5d25[_0xddde('0x33')][_0xddde('0x34')]?_0x2c5d25[_0xddde('0x33')]:_0x483c9d[_0xddde('0x2e')];if(_0x24f01b[_0xddde('0x29')][_0xddde('0x35')]){_0x2c5d25['include']=[{'all':!![]}];}_0x2c5d25=_[_0xddde('0x36')]({},_0x2c5d25,_0x24f01b[_0xddde('0x37')]);return db['FaxQueue']['find'](_0x2c5d25)['then'](handleEntityNotFound(_0x2969b0,null))[_0xddde('0x18')](respondWithResult(_0x2969b0,null))[_0xddde('0x2c')](handleError(_0x2969b0,null));};exports[_0xddde('0x38')]=function(_0x12431d,_0x2825c6){return db[_0xddde('0x27')][_0xddde('0x38')](_0x12431d['body'],{})['then'](function(_0x2d7936){var _0x5595a7=_0x12431d[_0xddde('0x39')][_0xddde('0x1a')]({'plain':!![]});if(!_0x5595a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5595a7[_0xddde('0x3a')]===_0xddde('0x39')){var _0x616bc6=_0x2d7936['get']({'plain':!![]});var _0x5cb615=_0xddde('0x3b');return db['UserProfileSection'][_0xddde('0x3c')]({'where':{'name':_0x5cb615,'userProfileId':_0x5595a7[_0xddde('0x3d')]},'raw':!![]})[_0xddde('0x18')](function(_0x216b12){if(_0x216b12&&_0x216b12[_0xddde('0x3e')]===0x0){return db[_0xddde('0x1b')]['create']({'name':_0x616bc6[_0xddde('0x1f')],'resourceId':_0x616bc6['id'],'type':_0x216b12[_0xddde('0x1f')],'sectionId':_0x216b12['id']},{})[_0xddde('0x18')](function(){return _0x2d7936;});}else{return _0x2d7936;}})[_0xddde('0x2c')](function(_0x10d9d3){logger['error'](_0xddde('0x3f'),_0x10d9d3);throw _0x10d9d3;});}return _0x2d7936;})[_0xddde('0x18')](respondWithResult(_0x2825c6,0xc9))[_0xddde('0x2c')](handleError(_0x2825c6,null));};exports[_0xddde('0x17')]=function(_0x21b469,_0xb0c016){if(_0x21b469[_0xddde('0x40')]['id']){delete _0x21b469[_0xddde('0x40')]['id'];}return db[_0xddde('0x27')]['find']({'where':{'id':_0x21b469[_0xddde('0x41')]['id']}})['then'](handleEntityNotFound(_0xb0c016,null))[_0xddde('0x18')](saveUpdates(_0x21b469[_0xddde('0x40')],null))['then'](respondWithResult(_0xb0c016,null))[_0xddde('0x2c')](handleError(_0xb0c016,null));};exports[_0xddde('0x19')]=function(_0x3b154b,_0x4c70ae){return db['FaxQueue']['find']({'where':{'id':_0x3b154b[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x4c70ae,null))[_0xddde('0x18')](removeEntity(_0x4c70ae,null))[_0xddde('0x2c')](handleError(_0x4c70ae,null));};exports['describe']=function(_0xc26795,_0x338f93){return db[_0xddde('0x27')]['describe']()[_0xddde('0x18')](respondWithResult(_0x338f93,null))[_0xddde('0x2c')](handleError(_0x338f93,null));};exports[_0xddde('0x42')]=function(_0x42371e,_0x42388c){var _0x4dbf84={'raw':!![],'where':{}},_0x3ac8c3={},_0x497898;return db[_0xddde('0x27')]['findOne']({'where':{'id':_0x42371e[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x42388c,null))[_0xddde('0x18')](function(_0x83ee21){if(_0x83ee21){_0x497898=_0x83ee21[_0xddde('0x1a')]({'plain':!![]});_0x3ac8c3[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x43')]['rawAttributes']);_0x3ac8c3[_0xddde('0x29')]=_[_0xddde('0x2f')](_0x42371e[_0xddde('0x29')]);_0x3ac8c3[_0xddde('0x30')]=_[_0xddde('0x31')](_0x3ac8c3[_0xddde('0x2e')],_0x3ac8c3['query']);_0x4dbf84[_0xddde('0x33')]=_[_0xddde('0x31')](_0x3ac8c3[_0xddde('0x2e')],qs[_0xddde('0x32')](_0x42371e[_0xddde('0x29')]['fields']));_0x4dbf84[_0xddde('0x33')]=_0x4dbf84[_0xddde('0x33')][_0xddde('0x34')]?_0x4dbf84[_0xddde('0x33')]:_0x3ac8c3[_0xddde('0x2e')];if(!_0x42371e[_0xddde('0x29')][_0xddde('0x44')](_0xddde('0x45'))){_0x4dbf84[_0xddde('0x15')]=qs[_0xddde('0x15')](_0x42371e[_0xddde('0x29')][_0xddde('0x15')]);_0x4dbf84[_0xddde('0x12')]=qs[_0xddde('0x12')](_0x42371e[_0xddde('0x29')][_0xddde('0x12')]);}_0x4dbf84[_0xddde('0x46')]=qs[_0xddde('0x47')](_0x42371e['query']['sort']);_0x4dbf84[_0xddde('0x26')]=qs[_0xddde('0x30')](_[_0xddde('0x48')](_0x42371e[_0xddde('0x29')],_0x3ac8c3[_0xddde('0x30')]));_0x4dbf84['where'][_0xddde('0x49')]=_0x83ee21['id'];if(_0x42371e[_0xddde('0x29')][_0xddde('0x4a')]){_0x4dbf84[_0xddde('0x26')]=_[_0xddde('0x36')](_0x4dbf84[_0xddde('0x26')],{'$or':_['map'](_0x4dbf84[_0xddde('0x33')],function(_0x14dcc3){var _0x15ab38={};_0x15ab38[_0x14dcc3]={'$like':'%'+_0x42371e['query'][_0xddde('0x4a')]+'%'};return _0x15ab38;})});}_0x4dbf84=_[_0xddde('0x36')]({},_0x4dbf84,_0x42371e['options']);return db['UserFaxQueue']['findAll'](_0x4dbf84);}})[_0xddde('0x18')](function(_0x4c8fef){if(_0x4c8fef){return db[_0xddde('0x4b')][_0xddde('0x4c')]({'where':{'id':_[_0xddde('0x22')](_0x4c8fef,_0xddde('0x4d')),'role':_0xddde('0x4e')},'attributes':['id','name','faxPause',_0xddde('0x4f'),_0xddde('0x50')]});}})['then'](function(_0xcc5e3a){if(_0xcc5e3a){return{'count':_0xcc5e3a[_0xddde('0x14')],'rows':_[_0xddde('0x22')](_0xcc5e3a[_0xddde('0x2b')],function(_0x34e3d9){return{'membername':_0x34e3d9[_0xddde('0x1f')],'UserId':_0x34e3d9['id'],'queue_name':_0x497898[_0xddde('0x1f')],'FaxQueueId':_0x497898['id'],'interface':util[_0xddde('0x51')](_0xddde('0x52'),_0xddde('0x53'),_0x34e3d9['name']),'penalty':0x0,'paused':_0x34e3d9[_0xddde('0x54')],'createdAt':_0x34e3d9['createdAt'],'updatedAt':_0x34e3d9[_0xddde('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xddde('0x18')](respondWithFilteredResult(_0x42388c,_0x4dbf84))['catch'](handleError(_0x42388c,null));};exports['getTeams']=function(_0x5725ef,_0x1430bb){var _0x51589c={};var _0x31eb36={};var _0x20f512;var _0x1fbca9;return db['FaxQueue'][_0xddde('0x55')]({'where':{'id':_0x5725ef[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x1430bb,null))['then'](function(_0x460b04){if(_0x460b04){_0x20f512=_0x460b04;_0x31eb36[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x56')][_0xddde('0x57')]);_0x31eb36['query']=_[_0xddde('0x2f')](_0x5725ef['query']);_0x31eb36[_0xddde('0x30')]=_[_0xddde('0x31')](_0x31eb36[_0xddde('0x2e')],_0x31eb36['query']);_0x51589c['attributes']=_[_0xddde('0x31')](_0x31eb36['model'],qs[_0xddde('0x32')](_0x5725ef[_0xddde('0x29')][_0xddde('0x32')]));_0x51589c[_0xddde('0x33')]=_0x51589c[_0xddde('0x33')][_0xddde('0x34')]?_0x51589c[_0xddde('0x33')]:_0x31eb36[_0xddde('0x2e')];_0x51589c[_0xddde('0x46')]=qs['sort'](_0x5725ef[_0xddde('0x29')]['sort']);_0x51589c[_0xddde('0x26')]=qs[_0xddde('0x30')](_['pick'](_0x5725ef[_0xddde('0x29')],_0x31eb36[_0xddde('0x30')]));if(_0x5725ef[_0xddde('0x29')][_0xddde('0x4a')]){_0x51589c[_0xddde('0x26')]=_[_0xddde('0x36')](_0x51589c[_0xddde('0x26')],{'$or':_[_0xddde('0x22')](_0x51589c['attributes'],function(_0x207baf){var _0x141103={};_0x141103[_0x207baf]={'$like':'%'+_0x5725ef[_0xddde('0x29')]['filter']+'%'};return _0x141103;})});}_0x51589c=_[_0xddde('0x36')]({},_0x51589c,_0x5725ef['options']);return _0x20f512[_0xddde('0x58')](_0x51589c);}})[_0xddde('0x18')](function(_0x3ca2cf){if(_0x3ca2cf){_0x1fbca9=_0x3ca2cf['length'];if(!_0x5725ef[_0xddde('0x29')]['hasOwnProperty'](_0xddde('0x45'))){_0x51589c['limit']=qs['limit'](_0x5725ef[_0xddde('0x29')][_0xddde('0x15')]);_0x51589c[_0xddde('0x12')]=qs['offset'](_0x5725ef[_0xddde('0x29')][_0xddde('0x12')]);}return _0x20f512['getTeams'](_0x51589c);}})[_0xddde('0x18')](function(_0x5440d4){if(_0x5440d4){return _0x5440d4?{'count':_0x1fbca9,'rows':_0x5440d4}:null;}})['then'](respondWithResult(_0x1430bb,null))[_0xddde('0x2c')](handleError(_0x1430bb,null));};exports[_0xddde('0x59')]=function(_0x38b5d1,_0x497989){var _0x55a315=_0x38b5d1['body'][_0xddde('0x5a')];return db[_0xddde('0x56')][_0xddde('0x2a')]({'where':{'id':_0x55a315},'attributes':['id'],'include':[{'model':db[_0xddde('0x4b')],'as':_0xddde('0x5b'),'attributes':['id',_0xddde('0x1f'),_0xddde('0x5c'),'voicePause',_0xddde('0x5d')],'raw':!![]}]})['then'](function(_0x970ea6){if(_0x970ea6){var _0x45db05=_[_0xddde('0x5e')](_0x970ea6,function(_0x1c5cf6){var _0x16e211=_0x1c5cf6['get']({'plain':!![]});return _0x16e211[_0xddde('0x5b')];});return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x38b5d1['params']['id']}})[_0xddde('0x18')](function(_0x86dcad){return db[_0xddde('0x5f')][_0xddde('0x60')](function(_0x121837){return _0x86dcad[_0xddde('0x59')](_0x55a315,{'transaction':_0x121837})[_0xddde('0x18')](function(){return BPromise[_0xddde('0x61')](_0x45db05,function(_0x12422a){return db[_0xddde('0x43')][_0xddde('0x62')]({'where':{'UserId':_0x12422a['id'],'FaxQueueId':_0x38b5d1[_0xddde('0x41')]['id']},'transaction':_0x121837});});})['then'](function(){_0x45db05[_0xddde('0x63')](function(_0x5ca8cb){socket[_0xddde('0x64')](_0xddde('0x65'),{'UserId':_0x5ca8cb['id'],'FaxQueueId':_0x86dcad['id']});});});});});}})[_0xddde('0x18')](respondWithStatusCode(_0x497989,null))[_0xddde('0x2c')](handleError(_0x497989,null));};exports[_0xddde('0x66')]=function(_0x56ebba,_0x18bc86){return db['Team'][_0xddde('0x2a')]({'where':{'id':_0x56ebba['query'][_0xddde('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xddde('0x4b')],'as':_0xddde('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x18bc86,null))['then'](function(_0x2708bc){var _0x30b9e6=_[_0xddde('0x22')](_0x2708bc,'id');var _0x4d9ee0=[];var _0x38c130=[];var _0x5ae4c1=squel['select']();_0x5ae4c1['field'](_0xddde('0x67'))[_0xddde('0x68')]('team_has_fax_queues','tq')[_0xddde('0x69')](_0xddde('0x6a'),'ut',_0xddde('0x6b'))[_0xddde('0x26')](_0xddde('0x6c'),_0x56ebba[_0xddde('0x41')]['id']);for(var _0x570912=0x0;_0x570912<_0x2708bc['length'];_0x570912+=0x1){let _0x562bf9=_0x2708bc[_0x570912];for(var _0x76548d=0x0;_0x76548d<_0x562bf9['Agents'][_0xddde('0x34')];_0x76548d+=0x1){let _0x747553=_0x562bf9[_0xddde('0x5b')][_0x76548d];var _0x3dcd02=_0x5ae4c1[_0xddde('0x6d')]();_0x3dcd02[_0xddde('0x26')]('ut.UserId\x20=\x20?',_0x747553['id']);_0x38c130[_0xddde('0x6e')](db[_0xddde('0x5f')]['query'](_0x3dcd02[_0xddde('0x6f')](),{'type':db[_0xddde('0x5f')][_0xddde('0x70')][_0xddde('0x71')]})[_0xddde('0x18')](function(_0x232a7e){if(_0x232a7e[_0xddde('0x34')]===0x1){return _0x747553['id'];}else{var _0x2ff77b=_['every'](_[_0xddde('0x22')](_0x232a7e,_0xddde('0x72')),function(_0x2c38a0){return _[_0xddde('0x73')](_0x30b9e6,_0x2c38a0);});if(_0x2ff77b){return _0x747553['id'];}}}));}}return BPromise['all'](_0x38c130)[_0xddde('0x18')](function(_0x1bf965){_0x4d9ee0=_(_0x4d9ee0)['union'](_0x1bf965)['compact']()['value']();return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x56ebba['params']['id']}})[_0xddde('0x18')](function(_0x29e936){return db['sequelize'][_0xddde('0x60')](function(_0x4e4226){return _0x29e936[_0xddde('0x66')](_0x56ebba[_0xddde('0x29')]['ids'],{'transaction':_0x4e4226})['then'](function(){if(!_[_0xddde('0x74')](_0x4d9ee0)){return _0x29e936[_0xddde('0x75')](_0x4d9ee0,{'transaction':_0x4e4226});}})[_0xddde('0x18')](function(){_0x4d9ee0[_0xddde('0x63')](function(_0x3272ba){socket['emit']('userFaxQueue:remove',{'UserId':_0x3272ba,'FaxQueueId':_0x29e936['id']});});});});});});})['then'](respondWithStatusCode(_0x18bc86,null))[_0xddde('0x2c')](handleError(_0x18bc86,null));};exports[_0xddde('0x76')]=function(_0x241fc1,_0x335291){return db['FaxQueue']['find']({'where':{'id':_0x241fc1[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x335291,null))[_0xddde('0x18')](function(_0xeca6a3){if(_0xeca6a3){return _0xeca6a3['addAgents'](_0x241fc1['body']['ids'],_[_0xddde('0x77')](_0x241fc1['body'],[_0xddde('0x5a'),'id'])||{})[_0xddde('0x78')](function(_0x10b4b8){for(var _0x437ebb=0x0;_0x437ebb<_0x241fc1[_0xddde('0x40')][_0xddde('0x5a')][_0xddde('0x34')];_0x437ebb+=0x1){socket[_0xddde('0x64')]('userFaxQueue:save',{'UserId':Number(_0x241fc1[_0xddde('0x40')]['ids'][_0x437ebb]),'FaxQueueId':Number(_0x241fc1['params']['id'])});}return _0x10b4b8;});}})[_0xddde('0x18')](respondWithResult(_0x335291,null))[_0xddde('0x2c')](handleError(_0x335291,null));};exports['removeAgents']=function(_0x38503b,_0x53bb31){return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x38503b[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x53bb31,null))[_0xddde('0x18')](function(_0x51869e){if(_0x51869e){return _0x51869e[_0xddde('0x75')](_0x38503b[_0xddde('0x29')][_0xddde('0x5a')])[_0xddde('0x18')](function(){if(_[_0xddde('0x79')](_0x38503b['query'][_0xddde('0x5a')])){for(var _0x4fe083=0x0;_0x4fe083<_0x38503b[_0xddde('0x29')][_0xddde('0x5a')][_0xddde('0x34')];_0x4fe083+=0x1){socket[_0xddde('0x64')](_0xddde('0x7a'),{'UserId':Number(_0x38503b[_0xddde('0x29')][_0xddde('0x5a')][_0x4fe083]),'FaxQueueId':Number(_0x38503b[_0xddde('0x41')]['id'])});}}else{socket[_0xddde('0x64')](_0xddde('0x7a'),{'UserId':Number(_0x38503b[_0xddde('0x29')][_0xddde('0x5a')]),'FaxQueueId':Number(_0x38503b[_0xddde('0x41')]['id'])});}});}})[_0xddde('0x18')](respondWithStatusCode(_0x53bb31,null))[_0xddde('0x2c')](handleError(_0x53bb31,null));};exports[_0xddde('0x7b')]=function(_0x5d3c69,_0xa1f102){var _0x257a07={};var _0x524d63={};var _0x5048fd;var _0x34a2f6;return db['FaxQueue'][_0xddde('0x55')]({'where':{'id':_0x5d3c69[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0xa1f102,null))[_0xddde('0x18')](function(_0x591289){if(_0x591289){_0x5048fd=_0x591289;_0x524d63[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x4b')][_0xddde('0x57')]);_0x524d63[_0xddde('0x29')]=_[_0xddde('0x2f')](_0x5d3c69[_0xddde('0x29')]);_0x524d63[_0xddde('0x30')]=_[_0xddde('0x31')](_0x524d63[_0xddde('0x2e')],_0x524d63['query']);_0x257a07['attributes']=_[_0xddde('0x31')](_0x524d63['model'],qs[_0xddde('0x32')](_0x5d3c69[_0xddde('0x29')][_0xddde('0x32')]));_0x257a07[_0xddde('0x33')]=_0x257a07[_0xddde('0x33')][_0xddde('0x34')]?_0x257a07['attributes']:_0x524d63['model'];_0x257a07[_0xddde('0x46')]=qs[_0xddde('0x47')](_0x5d3c69[_0xddde('0x29')][_0xddde('0x47')]);_0x257a07[_0xddde('0x26')]=qs[_0xddde('0x30')](_[_0xddde('0x48')](_0x5d3c69[_0xddde('0x29')],_0x524d63[_0xddde('0x30')]));if(_0x5d3c69[_0xddde('0x29')][_0xddde('0x4a')]){_0x257a07[_0xddde('0x26')]=_[_0xddde('0x36')](_0x257a07[_0xddde('0x26')],{'$or':_[_0xddde('0x22')](_0x257a07[_0xddde('0x33')],function(_0x3c779c){var _0x4e9cff={};_0x4e9cff[_0x3c779c]={'$like':'%'+_0x5d3c69[_0xddde('0x29')][_0xddde('0x4a')]+'%'};return _0x4e9cff;})});}_0x257a07=_[_0xddde('0x36')]({},_0x257a07,_0x5d3c69[_0xddde('0x37')]);return _0x5048fd[_0xddde('0x7b')](_0x257a07);}})['then'](function(_0x2e9fe8){if(_0x2e9fe8){_0x34a2f6=_0x2e9fe8[_0xddde('0x34')];if(!_0x5d3c69[_0xddde('0x29')][_0xddde('0x44')](_0xddde('0x45'))){_0x257a07[_0xddde('0x15')]=qs['limit'](_0x5d3c69[_0xddde('0x29')]['limit']);_0x257a07[_0xddde('0x12')]=qs['offset'](_0x5d3c69[_0xddde('0x29')][_0xddde('0x12')]);}return _0x5048fd[_0xddde('0x7b')](_0x257a07);}})[_0xddde('0x18')](function(_0x416988){if(_0x416988){return _0x416988?{'count':_0x34a2f6,'rows':_0x416988}:null;}})[_0xddde('0x18')](respondWithResult(_0xa1f102,null))[_0xddde('0x2c')](handleError(_0xa1f102,null));}; \ No newline at end of file +var _0xc1db=['UserFaxQueue','intersection','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','Team','order','getTeams','addTeams','Agents','online','voicePause','flatMap','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','union','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userFaxQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','then','get','UserProfileResource','destroy','stack','name','index','map','FaxQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','attributes','fields','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','update','describe','findOne'];(function(_0x4741fc,_0x38cf62){var _0x275437=function(_0x244956){while(--_0x244956){_0x4741fc['push'](_0x4741fc['shift']());}};_0x275437(++_0x38cf62);}(_0xc1db,0x120));var _0xbc1d=function(_0x1b40ae,_0x262405){_0x1b40ae=_0x1b40ae-0x0;var _0x2ac87c=_0xc1db[_0x1b40ae];return _0x2ac87c;};'use strict';var BPromise=require(_0xbc1d('0x0'));var util=require('util');var _=require(_0xbc1d('0x1'));var squel=require(_0xbc1d('0x2'));var Redis=require(_0xbc1d('0x3'));var qs=require(_0xbc1d('0x4'));var logger=require(_0xbc1d('0x5'))('api');var config=require(_0xbc1d('0x6'));var db=require(_0xbc1d('0x7'))['db'];config[_0xbc1d('0x8')]=_['defaults'](config['redis'],{'host':_0xbc1d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc1d('0xa'))['register'](socket);function respondWithStatusCode(_0x268200,_0x451e8d){_0x451e8d=_0x451e8d||0xcc;return function(_0x4c2d30){if(_0x4c2d30){return _0x268200[_0xbc1d('0xb')](_0x451e8d);}return _0x268200['status'](_0x451e8d)[_0xbc1d('0xc')]();};}function respondWithResult(_0x23176d,_0x51282b){_0x51282b=_0x51282b||0xc8;return function(_0x1c211f){if(_0x1c211f){return _0x23176d[_0xbc1d('0xd')](_0x51282b)[_0xbc1d('0xe')](_0x1c211f);}};}function respondWithFilteredResult(_0x23f1b4,_0x5e19f3){return function(_0x2d6f04){if(_0x2d6f04){var _0x4e9cee=typeof _0x5e19f3[_0xbc1d('0xf')]===_0xbc1d('0x10')&&typeof _0x5e19f3['limit']===_0xbc1d('0x10');var _0x242428=_0x2d6f04['count'];var _0x373f20=_0x4e9cee?0x0:_0x5e19f3[_0xbc1d('0xf')];var _0x58e7f4=_0x4e9cee?_0x2d6f04[_0xbc1d('0x11')]:_0x5e19f3['offset']+_0x5e19f3[_0xbc1d('0x12')];var _0x238c0d;if(_0x58e7f4>=_0x242428){_0x58e7f4=_0x242428;_0x238c0d=0xc8;}else{_0x238c0d=0xce;}_0x23f1b4[_0xbc1d('0xd')](_0x238c0d);return _0x23f1b4[_0xbc1d('0x13')](_0xbc1d('0x14'),_0x373f20+'-'+_0x58e7f4+'/'+_0x242428)[_0xbc1d('0xe')](_0x2d6f04);}return null;};}function saveUpdates(_0x5bddda){return function(_0x30360e){if(_0x30360e){return _0x30360e['update'](_0x5bddda)[_0xbc1d('0x15')](function(_0x225310){return _0x225310;});}return null;};}function removeEntity(_0x57de11){return function(_0x58c56e){if(_0x58c56e){return _0x58c56e['destroy']()[_0xbc1d('0x15')](function(){var _0x403afc=_0x58c56e[_0xbc1d('0x16')]({'plain':!![]});var _0x1bd6d7='FaxQueues';return db[_0xbc1d('0x17')][_0xbc1d('0x18')]({'where':{'type':_0x1bd6d7,'resourceId':_0x403afc['id']}})[_0xbc1d('0x15')](function(){return _0x58c56e;});})[_0xbc1d('0x15')](function(){_0x57de11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fc05){return function(_0x497eba){if(!_0x497eba){_0x33fc05[_0xbc1d('0xb')](0x194);}return _0x497eba;};}function handleError(_0x52c7c9,_0x1b065e){_0x1b065e=_0x1b065e||0x1f4;return function(_0x1c1e0e){logger['error'](_0x1c1e0e[_0xbc1d('0x19')]);if(_0x1c1e0e[_0xbc1d('0x1a')]){delete _0x1c1e0e[_0xbc1d('0x1a')];}_0x52c7c9['status'](_0x1b065e)['send'](_0x1c1e0e);};}exports[_0xbc1d('0x1b')]=function(_0x497df8,_0x1f6217){var _0x13ce62={};var _0x59fd2e={'count':0x0,'rows':[]};var _0x4d959a=_[_0xbc1d('0x1c')](db[_0xbc1d('0x1d')]['rawAttributes'],function(_0x7b37c3){return{'name':_0x7b37c3[_0xbc1d('0x1e')],'type':_0x7b37c3[_0xbc1d('0x1f')][_0xbc1d('0x20')]};});_0x13ce62=qs[_0xbc1d('0x21')](_0x4d959a,_0x497df8);var _0x2b5c55={'where':_0x13ce62[_0xbc1d('0x22')]};return db['FaxQueue'][_0xbc1d('0x11')](_0x2b5c55)['then'](function(_0x584fa5){_0x59fd2e[_0xbc1d('0x11')]=_0x584fa5;_0x13ce62[_0xbc1d('0x23')]=qs[_0xbc1d('0x23')](_0x497df8[_0xbc1d('0x24')]);return db['FaxQueue'][_0xbc1d('0x25')](_0x13ce62);})[_0xbc1d('0x15')](function(_0x586007){_0x59fd2e[_0xbc1d('0x26')]=_0x586007;return _0x59fd2e;})[_0xbc1d('0x15')](respondWithFilteredResult(_0x1f6217,_0x13ce62))[_0xbc1d('0x27')](handleError(_0x1f6217,null));};exports[_0xbc1d('0x28')]=function(_0x18ca96,_0x21705d){var _0x3fd527={'raw':!![],'where':{'id':_0x18ca96[_0xbc1d('0x29')]['id']}},_0x403e0b={};_0x403e0b[_0xbc1d('0x2a')]=_['keys'](db[_0xbc1d('0x1d')][_0xbc1d('0x2b')]);_0x403e0b[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x18ca96[_0xbc1d('0x24')]);_0x403e0b[_0xbc1d('0x2d')]=_['intersection'](_0x403e0b[_0xbc1d('0x2a')],_0x403e0b[_0xbc1d('0x24')]);_0x3fd527[_0xbc1d('0x2e')]=_['intersection'](_0x403e0b[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x18ca96[_0xbc1d('0x24')]['fields']));_0x3fd527[_0xbc1d('0x2e')]=_0x3fd527[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x3fd527[_0xbc1d('0x2e')]:_0x403e0b['model'];if(_0x18ca96['query'][_0xbc1d('0x31')]){_0x3fd527[_0xbc1d('0x23')]=[{'all':!![]}];}_0x3fd527=_[_0xbc1d('0x32')]({},_0x3fd527,_0x18ca96['options']);return db['FaxQueue']['find'](_0x3fd527)['then'](handleEntityNotFound(_0x21705d,null))[_0xbc1d('0x15')](respondWithResult(_0x21705d,null))[_0xbc1d('0x27')](handleError(_0x21705d,null));};exports[_0xbc1d('0x33')]=function(_0x267713,_0x4009ef){return db[_0xbc1d('0x1d')]['create'](_0x267713[_0xbc1d('0x34')],{})['then'](function(_0x2ac3f2){var _0x560a7c=_0x267713[_0xbc1d('0x35')][_0xbc1d('0x16')]({'plain':!![]});if(!_0x560a7c)throw new Error(_0xbc1d('0x36'));if(_0x560a7c['role']===_0xbc1d('0x35')){var _0x7ca90c=_0x2ac3f2[_0xbc1d('0x16')]({'plain':!![]});var _0x1df5fe='FaxQueues';return db[_0xbc1d('0x37')][_0xbc1d('0x38')]({'where':{'name':_0x1df5fe,'userProfileId':_0x560a7c[_0xbc1d('0x39')]},'raw':!![]})[_0xbc1d('0x15')](function(_0x107e00){if(_0x107e00&&_0x107e00[_0xbc1d('0x3a')]===0x0){return db[_0xbc1d('0x17')][_0xbc1d('0x33')]({'name':_0x7ca90c['name'],'resourceId':_0x7ca90c['id'],'type':_0x107e00[_0xbc1d('0x1a')],'sectionId':_0x107e00['id']},{})[_0xbc1d('0x15')](function(){return _0x2ac3f2;});}else{return _0x2ac3f2;}})['catch'](function(_0xbf378){logger[_0xbc1d('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbf378);throw _0xbf378;});}return _0x2ac3f2;})['then'](respondWithResult(_0x4009ef,0xc9))[_0xbc1d('0x27')](handleError(_0x4009ef,null));};exports[_0xbc1d('0x3c')]=function(_0x3e09f9,_0x4a9006){if(_0x3e09f9[_0xbc1d('0x34')]['id']){delete _0x3e09f9[_0xbc1d('0x34')]['id'];}return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x3e09f9['params']['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x4a9006,null))['then'](saveUpdates(_0x3e09f9[_0xbc1d('0x34')],null))[_0xbc1d('0x15')](respondWithResult(_0x4a9006,null))['catch'](handleError(_0x4a9006,null));};exports[_0xbc1d('0x18')]=function(_0x3c06f3,_0x1832df){return db[_0xbc1d('0x1d')]['find']({'where':{'id':_0x3c06f3[_0xbc1d('0x29')]['id']}})['then'](handleEntityNotFound(_0x1832df,null))[_0xbc1d('0x15')](removeEntity(_0x1832df,null))['catch'](handleError(_0x1832df,null));};exports[_0xbc1d('0x3d')]=function(_0x59dfd6,_0x247653){return db[_0xbc1d('0x1d')][_0xbc1d('0x3d')]()[_0xbc1d('0x15')](respondWithResult(_0x247653,null))[_0xbc1d('0x27')](handleError(_0x247653,null));};exports['getMembers']=function(_0x2de552,_0x4f4aeb){var _0x5c6e4e={'raw':!![],'where':{}},_0x398f1a={},_0x3b8ac5;return db[_0xbc1d('0x1d')][_0xbc1d('0x3e')]({'where':{'id':_0x2de552[_0xbc1d('0x29')]['id']}})['then'](handleEntityNotFound(_0x4f4aeb,null))['then'](function(_0x1c4e23){if(_0x1c4e23){_0x3b8ac5=_0x1c4e23[_0xbc1d('0x16')]({'plain':!![]});_0x398f1a['model']=_[_0xbc1d('0x2c')](db[_0xbc1d('0x3f')][_0xbc1d('0x2b')]);_0x398f1a[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x2de552[_0xbc1d('0x24')]);_0x398f1a[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x398f1a[_0xbc1d('0x2a')],_0x398f1a[_0xbc1d('0x24')]);_0x5c6e4e[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x398f1a[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x2f')]));_0x5c6e4e[_0xbc1d('0x2e')]=_0x5c6e4e[_0xbc1d('0x2e')]['length']?_0x5c6e4e[_0xbc1d('0x2e')]:_0x398f1a[_0xbc1d('0x2a')];if(!_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x41')](_0xbc1d('0x42'))){_0x5c6e4e[_0xbc1d('0x12')]=qs[_0xbc1d('0x12')](_0x2de552['query']['limit']);_0x5c6e4e[_0xbc1d('0xf')]=qs[_0xbc1d('0xf')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0xf')]);}_0x5c6e4e['order']=qs[_0xbc1d('0x43')](_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x43')]);_0x5c6e4e[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_[_0xbc1d('0x44')](_0x2de552['query'],_0x398f1a[_0xbc1d('0x2d')]));_0x5c6e4e[_0xbc1d('0x22')][_0xbc1d('0x45')]=_0x1c4e23['id'];if(_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x46')]){_0x5c6e4e[_0xbc1d('0x22')]=_[_0xbc1d('0x32')](_0x5c6e4e[_0xbc1d('0x22')],{'$or':_[_0xbc1d('0x1c')](_0x5c6e4e['attributes'],function(_0x182334){var _0x271a2b={};_0x271a2b[_0x182334]={'$like':'%'+_0x2de552[_0xbc1d('0x24')][_0xbc1d('0x46')]+'%'};return _0x271a2b;})});}_0x5c6e4e=_[_0xbc1d('0x32')]({},_0x5c6e4e,_0x2de552[_0xbc1d('0x47')]);return db[_0xbc1d('0x3f')][_0xbc1d('0x25')](_0x5c6e4e);}})[_0xbc1d('0x15')](function(_0x3a3e03){if(_0x3a3e03){return db[_0xbc1d('0x48')][_0xbc1d('0x49')]({'where':{'id':_[_0xbc1d('0x1c')](_0x3a3e03,_0xbc1d('0x4a')),'role':'agent'},'attributes':['id',_0xbc1d('0x1a'),_0xbc1d('0x4b'),_0xbc1d('0x4c'),_0xbc1d('0x4d')]});}})['then'](function(_0x541461){if(_0x541461){return{'count':_0x541461[_0xbc1d('0x11')],'rows':_[_0xbc1d('0x1c')](_0x541461[_0xbc1d('0x26')],function(_0x426aa4){return{'membername':_0x426aa4[_0xbc1d('0x1a')],'UserId':_0x426aa4['id'],'queue_name':_0x3b8ac5[_0xbc1d('0x1a')],'FaxQueueId':_0x3b8ac5['id'],'interface':util[_0xbc1d('0x4e')](_0xbc1d('0x4f'),'SIP',_0x426aa4['name']),'penalty':0x0,'paused':_0x426aa4[_0xbc1d('0x4b')],'createdAt':_0x426aa4[_0xbc1d('0x4d')],'updatedAt':_0x426aa4[_0xbc1d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f4aeb,_0x5c6e4e))[_0xbc1d('0x27')](handleError(_0x4f4aeb,null));};exports['getTeams']=function(_0x3d4e92,_0x26fdc6){var _0x29d919={};var _0x15f5a9={};var _0x51b4cd;var _0x1a6848;return db[_0xbc1d('0x1d')][_0xbc1d('0x3e')]({'where':{'id':_0x3d4e92[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x26fdc6,null))[_0xbc1d('0x15')](function(_0xee6d22){if(_0xee6d22){_0x51b4cd=_0xee6d22;_0x15f5a9['model']=_[_0xbc1d('0x2c')](db[_0xbc1d('0x50')][_0xbc1d('0x2b')]);_0x15f5a9[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x3d4e92['query']);_0x15f5a9[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x15f5a9[_0xbc1d('0x2a')],_0x15f5a9[_0xbc1d('0x24')]);_0x29d919[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x15f5a9[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x3d4e92[_0xbc1d('0x24')][_0xbc1d('0x2f')]));_0x29d919['attributes']=_0x29d919[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x29d919['attributes']:_0x15f5a9[_0xbc1d('0x2a')];_0x29d919[_0xbc1d('0x51')]=qs[_0xbc1d('0x43')](_0x3d4e92[_0xbc1d('0x24')][_0xbc1d('0x43')]);_0x29d919[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_['pick'](_0x3d4e92[_0xbc1d('0x24')],_0x15f5a9[_0xbc1d('0x2d')]));if(_0x3d4e92['query'][_0xbc1d('0x46')]){_0x29d919['where']=_[_0xbc1d('0x32')](_0x29d919[_0xbc1d('0x22')],{'$or':_[_0xbc1d('0x1c')](_0x29d919[_0xbc1d('0x2e')],function(_0x126e83){var _0x5a628d={};_0x5a628d[_0x126e83]={'$like':'%'+_0x3d4e92[_0xbc1d('0x24')]['filter']+'%'};return _0x5a628d;})});}_0x29d919=_[_0xbc1d('0x32')]({},_0x29d919,_0x3d4e92['options']);return _0x51b4cd[_0xbc1d('0x52')](_0x29d919);}})['then'](function(_0x4d571c){if(_0x4d571c){_0x1a6848=_0x4d571c[_0xbc1d('0x30')];if(!_0x3d4e92['query'][_0xbc1d('0x41')]('nolimit')){_0x29d919['limit']=qs[_0xbc1d('0x12')](_0x3d4e92['query'][_0xbc1d('0x12')]);_0x29d919['offset']=qs['offset'](_0x3d4e92['query'][_0xbc1d('0xf')]);}return _0x51b4cd['getTeams'](_0x29d919);}})[_0xbc1d('0x15')](function(_0x4ecbfd){if(_0x4ecbfd){return _0x4ecbfd?{'count':_0x1a6848,'rows':_0x4ecbfd}:null;}})[_0xbc1d('0x15')](respondWithResult(_0x26fdc6,null))[_0xbc1d('0x27')](handleError(_0x26fdc6,null));};exports[_0xbc1d('0x53')]=function(_0xb624e1,_0x1188c9){var _0x27992a=_0xb624e1[_0xbc1d('0x34')]['ids'];return db[_0xbc1d('0x50')][_0xbc1d('0x25')]({'where':{'id':_0x27992a},'attributes':['id'],'include':[{'model':db[_0xbc1d('0x48')],'as':_0xbc1d('0x54'),'attributes':['id',_0xbc1d('0x1a'),_0xbc1d('0x55'),_0xbc1d('0x56'),'interface'],'raw':!![]}]})[_0xbc1d('0x15')](function(_0x3e7f35){if(_0x3e7f35){var _0x44c748=_[_0xbc1d('0x57')](_0x3e7f35,function(_0x371962){var _0x2db400=_0x371962[_0xbc1d('0x16')]({'plain':!![]});return _0x2db400[_0xbc1d('0x54')];});return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0xb624e1[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](function(_0x4b0a44){return db['sequelize'][_0xbc1d('0x58')](function(_0x2e2698){return _0x4b0a44[_0xbc1d('0x53')](_0x27992a,{'transaction':_0x2e2698})[_0xbc1d('0x15')](function(){return BPromise['each'](_0x44c748,function(_0xee2ad7){return db[_0xbc1d('0x3f')][_0xbc1d('0x59')]({'where':{'UserId':_0xee2ad7['id'],'FaxQueueId':_0xb624e1['params']['id']},'transaction':_0x2e2698});});})[_0xbc1d('0x15')](function(){_0x44c748['forEach'](function(_0xfaac23){socket[_0xbc1d('0x5a')](_0xbc1d('0x5b'),{'UserId':_0xfaac23['id'],'FaxQueueId':_0x4b0a44['id']});});});});});}})['then'](respondWithStatusCode(_0x1188c9,null))[_0xbc1d('0x27')](handleError(_0x1188c9,null));};exports[_0xbc1d('0x5c')]=function(_0x58c01a,_0x4b682d){return db[_0xbc1d('0x50')][_0xbc1d('0x25')]({'where':{'id':_0x58c01a[_0xbc1d('0x24')][_0xbc1d('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xbc1d('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbc1d('0x15')](handleEntityNotFound(_0x4b682d,null))[_0xbc1d('0x15')](function(_0x17ab8f){var _0x51eec1=_[_0xbc1d('0x1c')](_0x17ab8f,'id');var _0x25a3a1=[];var _0x1d57b0=[];var _0x104402=squel[_0xbc1d('0x5e')]();_0x104402[_0xbc1d('0x5f')](_0xbc1d('0x60'))[_0xbc1d('0x61')](_0xbc1d('0x62'),'tq')['join']('user_has_teams','ut',_0xbc1d('0x63'))['where'](_0xbc1d('0x64'),_0x58c01a[_0xbc1d('0x29')]['id']);for(var _0x2efd25=0x0;_0x2efd25<_0x17ab8f['length'];_0x2efd25+=0x1){let _0x5e0182=_0x17ab8f[_0x2efd25];for(var _0x1bf1b2=0x0;_0x1bf1b2<_0x5e0182[_0xbc1d('0x54')][_0xbc1d('0x30')];_0x1bf1b2+=0x1){let _0x4e4389=_0x5e0182[_0xbc1d('0x54')][_0x1bf1b2];var _0x5f3ad6=_0x104402['clone']();_0x5f3ad6[_0xbc1d('0x22')](_0xbc1d('0x65'),_0x4e4389['id']);_0x1d57b0[_0xbc1d('0x66')](db[_0xbc1d('0x67')][_0xbc1d('0x24')](_0x5f3ad6['toString'](),{'type':db[_0xbc1d('0x67')][_0xbc1d('0x68')][_0xbc1d('0x69')]})[_0xbc1d('0x15')](function(_0x48a590){if(_0x48a590[_0xbc1d('0x30')]===0x1){return _0x4e4389['id'];}else{var _0x374d29=_[_0xbc1d('0x6a')](_['map'](_0x48a590,'TeamId'),function(_0x209c37){return _[_0xbc1d('0x6b')](_0x51eec1,_0x209c37);});if(_0x374d29){return _0x4e4389['id'];}}}));}}return BPromise['all'](_0x1d57b0)[_0xbc1d('0x15')](function(_0x20cabe){_0x25a3a1=_(_0x25a3a1)[_0xbc1d('0x6c')](_0x20cabe)['compact']()['value']();return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x58c01a['params']['id']}})[_0xbc1d('0x15')](function(_0x35870b){return db['sequelize'][_0xbc1d('0x58')](function(_0x328786){return _0x35870b[_0xbc1d('0x5c')](_0x58c01a['query'][_0xbc1d('0x5d')],{'transaction':_0x328786})[_0xbc1d('0x15')](function(){if(!_[_0xbc1d('0x6d')](_0x25a3a1)){return _0x35870b[_0xbc1d('0x6e')](_0x25a3a1,{'transaction':_0x328786});}})['then'](function(){_0x25a3a1[_0xbc1d('0x6f')](function(_0xe95686){socket[_0xbc1d('0x5a')]('userFaxQueue:remove',{'UserId':_0xe95686,'FaxQueueId':_0x35870b['id']});});});});});});})['then'](respondWithStatusCode(_0x4b682d,null))[_0xbc1d('0x27')](handleError(_0x4b682d,null));};exports[_0xbc1d('0x70')]=function(_0x4bbac2,_0x350a82){return db['FaxQueue'][_0xbc1d('0x38')]({'where':{'id':_0x4bbac2[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x350a82,null))[_0xbc1d('0x15')](function(_0xb60aba){if(_0xb60aba){return _0xb60aba[_0xbc1d('0x70')](_0x4bbac2['body']['ids'],_['omit'](_0x4bbac2[_0xbc1d('0x34')],[_0xbc1d('0x5d'),'id'])||{})[_0xbc1d('0x71')](function(_0x4834c2){for(var _0x164dcb=0x0;_0x164dcb<_0x4bbac2[_0xbc1d('0x34')][_0xbc1d('0x5d')][_0xbc1d('0x30')];_0x164dcb+=0x1){socket[_0xbc1d('0x5a')](_0xbc1d('0x5b'),{'UserId':Number(_0x4bbac2[_0xbc1d('0x34')][_0xbc1d('0x5d')][_0x164dcb]),'FaxQueueId':Number(_0x4bbac2[_0xbc1d('0x29')]['id'])});}return _0x4834c2;});}})['then'](respondWithResult(_0x350a82,null))[_0xbc1d('0x27')](handleError(_0x350a82,null));};exports[_0xbc1d('0x6e')]=function(_0x18ad2e,_0x55f5f4){return db[_0xbc1d('0x1d')][_0xbc1d('0x38')]({'where':{'id':_0x18ad2e[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x55f5f4,null))[_0xbc1d('0x15')](function(_0x10c8d1){if(_0x10c8d1){return _0x10c8d1[_0xbc1d('0x6e')](_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')])['then'](function(){if(_[_0xbc1d('0x72')](_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')])){for(var _0x12b3a0=0x0;_0x12b3a0<_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')][_0xbc1d('0x30')];_0x12b3a0+=0x1){socket[_0xbc1d('0x5a')](_0xbc1d('0x73'),{'UserId':Number(_0x18ad2e[_0xbc1d('0x24')][_0xbc1d('0x5d')][_0x12b3a0]),'FaxQueueId':Number(_0x18ad2e[_0xbc1d('0x29')]['id'])});}}else{socket[_0xbc1d('0x5a')](_0xbc1d('0x73'),{'UserId':Number(_0x18ad2e['query'][_0xbc1d('0x5d')]),'FaxQueueId':Number(_0x18ad2e['params']['id'])});}});}})[_0xbc1d('0x15')](respondWithStatusCode(_0x55f5f4,null))[_0xbc1d('0x27')](handleError(_0x55f5f4,null));};exports['getAgents']=function(_0x1e8910,_0x2febf6){var _0x51be9c={};var _0x4855be={};var _0x5001a3;var _0x56998a;return db[_0xbc1d('0x1d')]['findOne']({'where':{'id':_0x1e8910[_0xbc1d('0x29')]['id']}})[_0xbc1d('0x15')](handleEntityNotFound(_0x2febf6,null))['then'](function(_0x36332e){if(_0x36332e){_0x5001a3=_0x36332e;_0x4855be[_0xbc1d('0x2a')]=_['keys'](db[_0xbc1d('0x48')][_0xbc1d('0x2b')]);_0x4855be[_0xbc1d('0x24')]=_[_0xbc1d('0x2c')](_0x1e8910['query']);_0x4855be[_0xbc1d('0x2d')]=_[_0xbc1d('0x40')](_0x4855be[_0xbc1d('0x2a')],_0x4855be[_0xbc1d('0x24')]);_0x51be9c[_0xbc1d('0x2e')]=_[_0xbc1d('0x40')](_0x4855be[_0xbc1d('0x2a')],qs[_0xbc1d('0x2f')](_0x1e8910['query'][_0xbc1d('0x2f')]));_0x51be9c[_0xbc1d('0x2e')]=_0x51be9c[_0xbc1d('0x2e')][_0xbc1d('0x30')]?_0x51be9c[_0xbc1d('0x2e')]:_0x4855be[_0xbc1d('0x2a')];_0x51be9c['order']=qs[_0xbc1d('0x43')](_0x1e8910['query'][_0xbc1d('0x43')]);_0x51be9c[_0xbc1d('0x22')]=qs[_0xbc1d('0x2d')](_[_0xbc1d('0x44')](_0x1e8910[_0xbc1d('0x24')],_0x4855be[_0xbc1d('0x2d')]));if(_0x1e8910['query'][_0xbc1d('0x46')]){_0x51be9c['where']=_[_0xbc1d('0x32')](_0x51be9c['where'],{'$or':_[_0xbc1d('0x1c')](_0x51be9c[_0xbc1d('0x2e')],function(_0x3147d6){var _0x167757={};_0x167757[_0x3147d6]={'$like':'%'+_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0x46')]+'%'};return _0x167757;})});}_0x51be9c=_[_0xbc1d('0x32')]({},_0x51be9c,_0x1e8910[_0xbc1d('0x47')]);return _0x5001a3[_0xbc1d('0x74')](_0x51be9c);}})[_0xbc1d('0x15')](function(_0x2b615d){if(_0x2b615d){_0x56998a=_0x2b615d[_0xbc1d('0x30')];if(!_0x1e8910[_0xbc1d('0x24')]['hasOwnProperty'](_0xbc1d('0x42'))){_0x51be9c[_0xbc1d('0x12')]=qs[_0xbc1d('0x12')](_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0x12')]);_0x51be9c['offset']=qs[_0xbc1d('0xf')](_0x1e8910[_0xbc1d('0x24')][_0xbc1d('0xf')]);}return _0x5001a3[_0xbc1d('0x74')](_0x51be9c);}})['then'](function(_0x4d5c17){if(_0x4d5c17){return _0x4d5c17?{'count':_0x56998a,'rows':_0x4d5c17}:null;}})[_0xbc1d('0x15')](respondWithResult(_0x2febf6,null))[_0xbc1d('0x27')](handleError(_0x2febf6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e0c61d8..93618fa 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 _0x3097=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3097,0xf5));var _0x7309=function(_0x51679b,_0x2d621c){_0x51679b=_0x51679b-0x0;var _0x4085f3=_0x3097[_0x51679b];return _0x4085f3;};'use strict';var EventEmitter=require(_0x7309('0x0'));var FaxQueue=require(_0x7309('0x1'))['db'][_0x7309('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7309('0x3')](0x0);var events={'afterCreate':_0x7309('0x4'),'afterUpdate':'update','afterDestroy':_0x7309('0x5')};function emitEvent(_0x136cb5){return function(_0x34f521,_0x119e7e,_0x1121a0){FaxQueueEvents[_0x7309('0x6')](_0x136cb5+':'+_0x34f521['id'],_0x34f521);FaxQueueEvents[_0x7309('0x6')](_0x136cb5,_0x34f521);_0x1121a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x7309('0x7')](e,emitEvent(event));}}module[_0x7309('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x75d6=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75d6,0x188));var _0x675d=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x75d6[_0x400b43];return _0x3c330f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x675d('0x0'))['db'][_0x675d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x675d('0x2')](0x0);var events={'afterCreate':_0x675d('0x3'),'afterUpdate':_0x675d('0x4'),'afterDestroy':_0x675d('0x5')};function emitEvent(_0x320e57){return function(_0x8137cc,_0x4a1d5f,_0x366147){FaxQueueEvents[_0x675d('0x6')](_0x320e57+':'+_0x8137cc['id'],_0x8137cc);FaxQueueEvents[_0x675d('0x6')](_0x320e57,_0x8137cc);_0x366147(null);};}for(var e in events){if(events[_0x675d('0x7')](e)){var event=events[e];FaxQueue[_0x675d('0x8')](e,emitEvent(event));}}module[_0x675d('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 71c35cb..f96bb6e 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 _0x78a7=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','FaxQueue','fax_queues'];(function(_0x41980e,_0x527b1d){var _0x1428fc=function(_0x48814c){while(--_0x48814c){_0x41980e['push'](_0x41980e['shift']());}};_0x1428fc(++_0x527b1d);}(_0x78a7,0x14a));var _0x778a=function(_0x2a0099,_0x4cf712){_0x2a0099=_0x2a0099-0x0;var _0x2d4237=_0x78a7[_0x2a0099];return _0x2d4237;};'use strict';var _=require(_0x778a('0x0'));var util=require(_0x778a('0x1'));var logger=require(_0x778a('0x2'))(_0x778a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x778a('0x4'));var fs=require('fs');var path=require(_0x778a('0x5'));var rimraf=require('rimraf');var config=require(_0x778a('0x6'));var attributes=require('./faxQueue.attributes');module[_0x778a('0x7')]=function(_0x513e3b,_0x463b96){return _0x513e3b[_0x778a('0x8')](_0x778a('0x9'),attributes,{'tableName':_0x778a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6345=['define','FaxQueue','fax_queues','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4ae6da,_0x2e67c7){var _0x2e4a5f=function(_0x53d109){while(--_0x53d109){_0x4ae6da['push'](_0x4ae6da['shift']());}};_0x2e4a5f(++_0x2e67c7);}(_0x6345,0x1e3));var _0x5634=function(_0x31796e,_0x281e0a){_0x31796e=_0x31796e-0x0;var _0x22d91f=_0x6345[_0x31796e];return _0x22d91f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5634('0x0'))(_0x5634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5634('0x2'));var fs=require('fs');var path=require(_0x5634('0x3'));var rimraf=require(_0x5634('0x4'));var config=require(_0x5634('0x5'));var attributes=require(_0x5634('0x6'));module['exports']=function(_0x1367cd,_0x7a793c){return _0x1367cd[_0x5634('0x7')](_0x5634('0x8'),attributes,{'tableName':_0x5634('0x9'),'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 b5bb028..ca67f9d 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 _0x8525=['FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x8525,0x1a6));var _0x5852=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8525[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x5852('0x0'));var moment=require(_0x5852('0x1'));var BPromise=require(_0x5852('0x2'));var rs=require(_0x5852('0x3'));var fs=require('fs');var Redis=require(_0x5852('0x4'));var db=require(_0x5852('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5852('0x6'))('rpc');var config=require(_0x5852('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5852('0x8')]['http']({'port':0x232a});config[_0x5852('0x9')]=_[_0x5852('0xa')](config[_0x5852('0x9')],{'host':_0x5852('0xb'),'port':0x18eb});var socket=require(_0x5852('0xc'))(new Redis(config[_0x5852('0x9')]));require(_0x5852('0xd'))[_0x5852('0xe')](socket);function respondWithRpcPromise(_0x1016cd,_0x1eb612,_0x318ead){return new BPromise(function(_0x4a77aa,_0x570ae1){return client[_0x5852('0xf')](_0x1016cd,_0x318ead)[_0x5852('0x10')](function(_0x5b63fa){logger[_0x5852('0x11')](_0x5852('0x12'),_0x1eb612,'request\x20sent');logger['debug'](_0x5852('0x13'),_0x1eb612,_0x5852('0x14'),JSON[_0x5852('0x15')](_0x5b63fa));if(_0x5b63fa[_0x5852('0x16')]){if(_0x5b63fa[_0x5852('0x16')]['code']===0x1f4){logger[_0x5852('0x16')](_0x5852('0x12'),_0x1eb612,_0x5b63fa[_0x5852('0x16')][_0x5852('0x17')]);return _0x570ae1(_0x5b63fa[_0x5852('0x16')][_0x5852('0x17')]);}logger[_0x5852('0x16')](_0x5852('0x12'),_0x1eb612,_0x5b63fa['error'][_0x5852('0x17')]);return _0x4a77aa(_0x5b63fa[_0x5852('0x16')][_0x5852('0x17')]);}else{logger[_0x5852('0x11')](_0x5852('0x12'),_0x1eb612,_0x5852('0x14'));_0x4a77aa(_0x5b63fa[_0x5852('0x18')]['message']);}})['catch'](function(_0x59ce6c){logger[_0x5852('0x16')](_0x5852('0x12'),_0x1eb612,_0x59ce6c);_0x570ae1(_0x59ce6c);});});}exports[_0x5852('0x19')]=function(_0x3189de){var _0x5af519=this;return new Promise(function(_0x2c78ec,_0x263cbc){return db['FaxQueue'][_0x5852('0x1a')]({'raw':_0x3189de[_0x5852('0x1b')]?_0x3189de[_0x5852('0x1b')][_0x5852('0x1c')]===undefined?!![]:![]:!![],'where':_0x3189de[_0x5852('0x1b')]?_0x3189de[_0x5852('0x1b')][_0x5852('0x1d')]||null:null,'attributes':_0x3189de[_0x5852('0x1b')]?_0x3189de[_0x5852('0x1b')][_0x5852('0x1e')]||null:null,'limit':_0x3189de[_0x5852('0x1b')]?_0x3189de['options'][_0x5852('0x1f')]||null:null,'include':_0x3189de[_0x5852('0x1b')]?_0x3189de['options'][_0x5852('0x20')]?_[_0x5852('0x21')](_0x3189de[_0x5852('0x1b')][_0x5852('0x20')],function(_0x56798d){return{'model':db[_0x56798d[_0x5852('0x22')]],'as':_0x56798d['as'],'attributes':_0x56798d[_0x5852('0x1e')],'include':_0x56798d['include']?_[_0x5852('0x21')](_0x56798d['include'],function(_0x1f42c6){return{'model':db[_0x1f42c6[_0x5852('0x22')]],'as':_0x1f42c6['as'],'attributes':_0x1f42c6[_0x5852('0x1e')],'include':_0x1f42c6['include']?_[_0x5852('0x21')](_0x1f42c6[_0x5852('0x20')],function(_0x156666){return{'model':db[_0x156666['model']],'as':_0x156666['as'],'attributes':_0x156666[_0x5852('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5852('0x10')](function(_0xa9193b){logger['info']('GetFaxQueue',_0x3189de);logger[_0x5852('0x23')](_0x5852('0x19'),_0x3189de,JSON[_0x5852('0x15')](_0xa9193b));_0x2c78ec(_0xa9193b);})[_0x5852('0x24')](function(_0x48b3cf){logger[_0x5852('0x16')](_0x5852('0x19'),_0x48b3cf[_0x5852('0x17')],_0x3189de);_0x263cbc(_0x5af519['error'](0x1f4,_0x48b3cf[_0x5852('0x17')]));});});};exports[_0x5852('0x25')]=function(_0xbc54b1){var _0x585c40=this;return new Promise(function(_0x48db18,_0x31b7fb){return db[_0x5852('0x26')][_0x5852('0x27')]({'raw':_0xbc54b1[_0x5852('0x1b')]?_0xbc54b1['options'][_0x5852('0x1c')]===undefined?!![]:![]:!![],'where':_0xbc54b1[_0x5852('0x1b')]?_0xbc54b1['options'][_0x5852('0x1d')]||null:null,'attributes':_0xbc54b1['options']?_0xbc54b1[_0x5852('0x1b')][_0x5852('0x1e')]||null:null,'include':_0xbc54b1[_0x5852('0x1b')]?_0xbc54b1['options']['include']?_[_0x5852('0x21')](_0xbc54b1[_0x5852('0x1b')][_0x5852('0x20')],function(_0x4e8fcb){return{'model':db[_0x4e8fcb[_0x5852('0x22')]],'as':_0x4e8fcb['as'],'attributes':_0x4e8fcb[_0x5852('0x1e')],'include':_0x4e8fcb[_0x5852('0x20')]?_['map'](_0x4e8fcb[_0x5852('0x20')],function(_0x553fc7){return{'model':db[_0x553fc7[_0x5852('0x22')]],'as':_0x553fc7['as'],'attributes':_0x553fc7[_0x5852('0x1e')],'include':_0x553fc7[_0x5852('0x20')]?_[_0x5852('0x21')](_0x553fc7[_0x5852('0x20')],function(_0x27432c){return{'model':db[_0x27432c['model']],'as':_0x27432c['as'],'attributes':_0x27432c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5852('0x10')](function(_0x3b7b55){logger['info']('ShowFaxQueue',_0xbc54b1);logger['debug'](_0x5852('0x25'),_0xbc54b1,JSON['stringify'](_0x3b7b55));_0x48db18(_0x3b7b55);})[_0x5852('0x24')](function(_0x58de24){logger[_0x5852('0x16')](_0x5852('0x25'),_0x58de24[_0x5852('0x17')],_0xbc54b1);_0x31b7fb(_0x585c40[_0x5852('0x16')](0x1f4,_0x58de24['message']));});});}; \ No newline at end of file +var _0xebce=['message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55109a,_0x18cd54){var _0x5eeb68=function(_0x4bf976){while(--_0x4bf976){_0x55109a['push'](_0x55109a['shift']());}};_0x5eeb68(++_0x18cd54);}(_0xebce,0x127));var _0xeebc=function(_0x239b5e,_0x208a3f){_0x239b5e=_0x239b5e-0x0;var _0x577f3d=_0xebce[_0x239b5e];return _0x577f3d;};'use strict';var _=require(_0xeebc('0x0'));var util=require(_0xeebc('0x1'));var moment=require('moment');var BPromise=require(_0xeebc('0x2'));var rs=require(_0xeebc('0x3'));var fs=require('fs');var Redis=require(_0xeebc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeebc('0x5'));var logger=require(_0xeebc('0x6'))(_0xeebc('0x7'));var config=require(_0xeebc('0x8'));var jayson=require(_0xeebc('0x9'));var client=jayson[_0xeebc('0xa')]['http']({'port':0x232a});config[_0xeebc('0xb')]=_[_0xeebc('0xc')](config[_0xeebc('0xb')],{'host':_0xeebc('0xd'),'port':0x18eb});var socket=require(_0xeebc('0xe'))(new Redis(config[_0xeebc('0xb')]));require(_0xeebc('0xf'))[_0xeebc('0x10')](socket);function respondWithRpcPromise(_0x5e238a,_0x1f7d16,_0x2b1233){return new BPromise(function(_0x35555b,_0x527a0d){return client['request'](_0x5e238a,_0x2b1233)[_0xeebc('0x11')](function(_0x4347fb){logger[_0xeebc('0x12')](_0xeebc('0x13'),_0x1f7d16,_0xeebc('0x14'));logger[_0xeebc('0x15')](_0xeebc('0x16'),_0x1f7d16,_0xeebc('0x14'),JSON[_0xeebc('0x17')](_0x4347fb));if(_0x4347fb[_0xeebc('0x18')]){if(_0x4347fb['error']['code']===0x1f4){logger['error'](_0xeebc('0x13'),_0x1f7d16,_0x4347fb[_0xeebc('0x18')][_0xeebc('0x19')]);return _0x527a0d(_0x4347fb[_0xeebc('0x18')][_0xeebc('0x19')]);}logger[_0xeebc('0x18')](_0xeebc('0x13'),_0x1f7d16,_0x4347fb[_0xeebc('0x18')]['message']);return _0x35555b(_0x4347fb[_0xeebc('0x18')]['message']);}else{logger[_0xeebc('0x12')](_0xeebc('0x13'),_0x1f7d16,_0xeebc('0x14'));_0x35555b(_0x4347fb[_0xeebc('0x1a')]['message']);}})[_0xeebc('0x1b')](function(_0xac4159){logger[_0xeebc('0x18')](_0xeebc('0x13'),_0x1f7d16,_0xac4159);_0x527a0d(_0xac4159);});});}exports['GetFaxQueue']=function(_0x130815){var _0x1b86b0=this;return new Promise(function(_0x388766,_0x20796a){return db[_0xeebc('0x1c')][_0xeebc('0x1d')]({'raw':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x1f')]===undefined?!![]:![]:!![],'where':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x20')]||null:null,'attributes':_0x130815[_0xeebc('0x1e')]?_0x130815['options'][_0xeebc('0x21')]||null:null,'limit':_0x130815['options']?_0x130815[_0xeebc('0x1e')]['limit']||null:null,'include':_0x130815[_0xeebc('0x1e')]?_0x130815[_0xeebc('0x1e')][_0xeebc('0x22')]?_[_0xeebc('0x23')](_0x130815[_0xeebc('0x1e')]['include'],function(_0x5ba2bd){return{'model':db[_0x5ba2bd[_0xeebc('0x24')]],'as':_0x5ba2bd['as'],'attributes':_0x5ba2bd[_0xeebc('0x21')],'include':_0x5ba2bd[_0xeebc('0x22')]?_['map'](_0x5ba2bd[_0xeebc('0x22')],function(_0xf81d){return{'model':db[_0xf81d[_0xeebc('0x24')]],'as':_0xf81d['as'],'attributes':_0xf81d[_0xeebc('0x21')],'include':_0xf81d[_0xeebc('0x22')]?_['map'](_0xf81d[_0xeebc('0x22')],function(_0x38e2db){return{'model':db[_0x38e2db[_0xeebc('0x24')]],'as':_0x38e2db['as'],'attributes':_0x38e2db[_0xeebc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeebc('0x11')](function(_0x3a012f){logger[_0xeebc('0x12')]('GetFaxQueue',_0x130815);logger[_0xeebc('0x15')]('GetFaxQueue',_0x130815,JSON['stringify'](_0x3a012f));_0x388766(_0x3a012f);})[_0xeebc('0x1b')](function(_0x3bb898){logger[_0xeebc('0x18')](_0xeebc('0x25'),_0x3bb898['message'],_0x130815);_0x20796a(_0x1b86b0[_0xeebc('0x18')](0x1f4,_0x3bb898['message']));});});};exports[_0xeebc('0x26')]=function(_0x56794d){var _0x17824c=this;return new Promise(function(_0x3bf906,_0x30b697){return db[_0xeebc('0x1c')][_0xeebc('0x27')]({'raw':_0x56794d['options']?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x1f')]===undefined?!![]:![]:!![],'where':_0x56794d[_0xeebc('0x1e')]?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x20')]||null:null,'attributes':_0x56794d[_0xeebc('0x1e')]?_0x56794d[_0xeebc('0x1e')][_0xeebc('0x21')]||null:null,'include':_0x56794d['options']?_0x56794d['options'][_0xeebc('0x22')]?_[_0xeebc('0x23')](_0x56794d[_0xeebc('0x1e')][_0xeebc('0x22')],function(_0x131781){return{'model':db[_0x131781[_0xeebc('0x24')]],'as':_0x131781['as'],'attributes':_0x131781[_0xeebc('0x21')],'include':_0x131781[_0xeebc('0x22')]?_['map'](_0x131781[_0xeebc('0x22')],function(_0x1a32e0){return{'model':db[_0x1a32e0[_0xeebc('0x24')]],'as':_0x1a32e0['as'],'attributes':_0x1a32e0[_0xeebc('0x21')],'include':_0x1a32e0['include']?_[_0xeebc('0x23')](_0x1a32e0[_0xeebc('0x22')],function(_0x5bbf8b){return{'model':db[_0x5bbf8b[_0xeebc('0x24')]],'as':_0x5bbf8b['as'],'attributes':_0x5bbf8b[_0xeebc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeebc('0x11')](function(_0x3cb539){logger[_0xeebc('0x12')]('ShowFaxQueue',_0x56794d);logger[_0xeebc('0x15')]('ShowFaxQueue',_0x56794d,JSON[_0xeebc('0x17')](_0x3cb539));_0x3bf906(_0x3cb539);})[_0xeebc('0x1b')](function(_0x317a91){logger[_0xeebc('0x18')](_0xeebc('0x26'),_0x317a91[_0xeebc('0x19')],_0x56794d);_0x30b697(_0x17824c['error'](0x1f4,_0x317a91[_0xeebc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dbb1715..c8dc7e9 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 _0x9d35=['faxQueue:','./faxQueue.events','save','remove','update','removeListener','length'];(function(_0x16622b,_0x4f3b89){var _0x17f371=function(_0x477143){while(--_0x477143){_0x16622b['push'](_0x16622b['shift']());}};_0x17f371(++_0x4f3b89);}(_0x9d35,0x174));var _0x59d3=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0x9d35[_0x54e6f5];return _0x5e8794;};'use strict';var FaxQueueEvents=require(_0x59d3('0x0'));var events=[_0x59d3('0x1'),_0x59d3('0x2'),_0x59d3('0x3')];function createListener(_0x24f1fe,_0x128b6e){return function(_0x2ca34c){_0x128b6e['emit'](_0x24f1fe,_0x2ca34c);};}function removeListener(_0xd4ff2a,_0x20e02a){return function(){FaxQueueEvents[_0x59d3('0x4')](_0xd4ff2a,_0x20e02a);};}exports['register']=function(_0x1b3018){for(var _0x4fb56c=0x0,_0x42a579=events[_0x59d3('0x5')];_0x4fb56c<_0x42a579;_0x4fb56c++){var _0x42394b=events[_0x4fb56c];var _0x16cc20=createListener(_0x59d3('0x6')+_0x42394b,_0x1b3018);FaxQueueEvents['on'](_0x42394b,_0x16cc20);}}; \ No newline at end of file +var _0xaf08=['removeListener','register','length','./faxQueue.events','remove','update','emit'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xaf08,0x1a0));var _0x8af0=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xaf08[_0x1d0aee];return _0x34ee2c;};'use strict';var FaxQueueEvents=require(_0x8af0('0x0'));var events=['save',_0x8af0('0x1'),_0x8af0('0x2')];function createListener(_0xe538b0,_0x3e046e){return function(_0x2a8142){_0x3e046e[_0x8af0('0x3')](_0xe538b0,_0x2a8142);};}function removeListener(_0x2b81d7,_0x15c260){return function(){FaxQueueEvents[_0x8af0('0x4')](_0x2b81d7,_0x15c260);};}exports[_0x8af0('0x5')]=function(_0x4ffce3){for(var _0x3e81f2=0x0,_0x15e23d=events[_0x8af0('0x6')];_0x3e81f2<_0x15e23d;_0x3e81f2++){var _0x37136a=events[_0x3e81f2];var _0x3bc4e7=createListener('faxQueue:'+_0x37136a,_0x4ffce3);FaxQueueEvents['on'](_0x37136a,_0x3bc4e7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ba68329..58f3a57 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 _0x5fdc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x42b3d0,_0x1578a4){var _0x2dc411=function(_0x4c6f57){while(--_0x4c6f57){_0x42b3d0['push'](_0x42b3d0['shift']());}};_0x2dc411(++_0x1578a4);}(_0x5fdc,0x127));var _0xc5fd=function(_0x13c8fa,_0x182229){_0x13c8fa=_0x13c8fa-0x0;var _0x2e61bd=_0x5fdc[_0x13c8fa];return _0x2e61bd;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['get']('/:id/members',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0xb')](_0xc5fd('0x11'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x12')]);router['get'](_0xc5fd('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xc5fd('0x14')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x15')]);router[_0xc5fd('0x14')](_0xc5fd('0x11'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x16')]);router[_0xc5fd('0x14')]('/:id/users',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x17')]);router[_0xc5fd('0x18')](_0xc5fd('0xe'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc5fd('0x19')]);router[_0xc5fd('0x1a')](_0xc5fd('0x11'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x1b')]);router[_0xc5fd('0x1a')](_0xc5fd('0x13'),auth['isAuthenticated'](),controller[_0xc5fd('0x1c')]);module[_0xc5fd('0x1d')]=router; \ No newline at end of file +var _0x39e6=['getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x39e6,0x9e));var _0x639e=function(_0x473457,_0x3b9135){_0x473457=_0x473457-0x0;var _0x1e8cd1=_0x39e6[_0x473457];return _0x1e8cd1;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var fs_extra=require(_0x639e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var controller=require(_0x639e('0x6'));router[_0x639e('0x7')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x9')]);router[_0x639e('0x7')](_0x639e('0xa'),auth[_0x639e('0x8')](),controller[_0x639e('0xb')]);router[_0x639e('0x7')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xd')]);router[_0x639e('0x7')](_0x639e('0xe'),auth[_0x639e('0x8')](),controller[_0x639e('0xf')]);router['get']('/:id/teams',auth[_0x639e('0x8')](),controller[_0x639e('0x10')]);router[_0x639e('0x7')](_0x639e('0x11'),auth[_0x639e('0x8')](),controller[_0x639e('0x12')]);router[_0x639e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x639e('0x13')](_0x639e('0x14'),auth[_0x639e('0x8')](),controller[_0x639e('0x15')]);router[_0x639e('0x13')](_0x639e('0x11'),auth['isAuthenticated'](),controller[_0x639e('0x16')]);router[_0x639e('0x17')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller['update']);router[_0x639e('0x18')]('/:id',auth[_0x639e('0x8')](),controller[_0x639e('0x19')]);router[_0x639e('0x18')](_0x639e('0x14'),auth[_0x639e('0x8')](),controller[_0x639e('0x1a')]);router['delete'](_0x639e('0x11'),auth[_0x639e('0x8')](),controller[_0x639e('0x1b')]);module[_0x639e('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 8b0aa9f..a88e530 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 _0xabf6=['exports','STRING','DATE','sequelize'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xabf6,0x173));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x6abf('0x0'));module[_0x6abf('0x1')]={'uniqueid':{'type':Sequelize[_0x6abf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6abf('0x2')]},'joinAt':{'type':Sequelize[_0x6abf('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6abf('0x3')]},'exitAt':{'type':Sequelize[_0x6abf('0x3')]},'reason':{'type':Sequelize[_0x6abf('0x2')]}}; \ No newline at end of file +var _0xf24b=['moment','sequelize','exports','STRING','DATE'];(function(_0x815307,_0x3b6e6f){var _0x3261bf=function(_0x42f703){while(--_0x42f703){_0x815307['push'](_0x815307['shift']());}};_0x3261bf(++_0x3b6e6f);}(_0xf24b,0xff));var _0xbf24=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xf24b[_0x50fda9];return _0x36b92b;};'use strict';var moment=require(_0xbf24('0x0'));var Sequelize=require(_0xbf24('0x1'));module[_0xbf24('0x2')]={'uniqueid':{'type':Sequelize[_0xbf24('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbf24('0x3')]},'joinAt':{'type':Sequelize[_0xbf24('0x4')]},'leaveAt':{'type':Sequelize[_0xbf24('0x4')]},'acceptAt':{'type':Sequelize[_0xbf24('0x4')]},'exitAt':{'type':Sequelize[_0xbf24('0x4')]},'reason':{'type':Sequelize[_0xbf24('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a93c965..deee38c 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 _0xf69b=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','FaxQueueReport','rawAttributes','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','merge','where','type','filter','options','include','findAll','rows','catch','show','includeAll','create','body','params','find','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x35dc1a,_0x5b7ac0){var _0x426c06=function(_0xd1eacb){while(--_0xd1eacb){_0x35dc1a['push'](_0x35dc1a['shift']());}};_0x426c06(++_0x5b7ac0);}(_0xf69b,0xc8));var _0xbf69=function(_0x2de0f9,_0x86bda1){_0x2de0f9=_0x2de0f9-0x0;var _0x281529=_0xf69b[_0x2de0f9];return _0x281529;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf69('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf69('0x1'));var rp=require('request-promise');var moment=require(_0xbf69('0x2'));var BPromise=require(_0xbf69('0x3'));var Mustache=require(_0xbf69('0x4'));var util=require('util');var path=require(_0xbf69('0x5'));var sox=require('sox');var csv=require(_0xbf69('0x6'));var ejs=require(_0xbf69('0x7'));var fs=require('fs');var fs_extra=require(_0xbf69('0x8'));var _=require(_0xbf69('0x9'));var squel=require(_0xbf69('0xa'));var crypto=require(_0xbf69('0xb'));var jsforce=require(_0xbf69('0xc'));var deskjs=require(_0xbf69('0xd'));var toCsv=require(_0xbf69('0x6'));var querystring=require(_0xbf69('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf69('0xf'));var authService=require(_0xbf69('0x10'));var qs=require(_0xbf69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf69('0x12'));var logger=require(_0xbf69('0x13'))(_0xbf69('0x14'));var utils=require(_0xbf69('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbf69('0x16'));var db=require(_0xbf69('0x17'))['db'];function respondWithStatusCode(_0x2edf93,_0x980232){_0x980232=_0x980232||0xcc;return function(_0x294fdb){if(_0x294fdb){return _0x2edf93['sendStatus'](_0x980232);}return _0x2edf93['status'](_0x980232)[_0xbf69('0x18')]();};}function respondWithResult(_0x514f81,_0x4d858a){_0x4d858a=_0x4d858a||0xc8;return function(_0x4bd76d){if(_0x4bd76d){return _0x514f81[_0xbf69('0x19')](_0x4d858a)[_0xbf69('0x1a')](_0x4bd76d);}};}function respondWithFilteredResult(_0x87c8a9,_0x4a44a5){return function(_0x1b7412){if(_0x1b7412){var _0x301fe7=typeof _0x4a44a5[_0xbf69('0x1b')]===_0xbf69('0x1c')&&typeof _0x4a44a5[_0xbf69('0x1d')]===_0xbf69('0x1c');var _0x342883=_0x1b7412[_0xbf69('0x1e')];var _0x307fbb=_0x301fe7?0x0:_0x4a44a5[_0xbf69('0x1b')];var _0x41e749=_0x301fe7?_0x1b7412[_0xbf69('0x1e')]:_0x4a44a5[_0xbf69('0x1b')]+_0x4a44a5[_0xbf69('0x1d')];var _0x191972;if(_0x41e749>=_0x342883){_0x41e749=_0x342883;_0x191972=0xc8;}else{_0x191972=0xce;}_0x87c8a9[_0xbf69('0x19')](_0x191972);return _0x87c8a9['set'](_0xbf69('0x1f'),_0x307fbb+'-'+_0x41e749+'/'+_0x342883)[_0xbf69('0x1a')](_0x1b7412);}return null;};}function patchUpdates(_0x331a3c){return function(_0x4998b7){try{jsonpatch[_0xbf69('0x20')](_0x4998b7,_0x331a3c,!![]);}catch(_0x3fcfd9){return BPromise[_0xbf69('0x21')](_0x3fcfd9);}return _0x4998b7['save']();};}function saveUpdates(_0x4cb86f,_0xc75cf){return function(_0x1e5cf1){if(_0x1e5cf1){return _0x1e5cf1[_0xbf69('0x22')](_0x4cb86f)[_0xbf69('0x23')](function(_0x3e0f36){return _0x3e0f36;});}return null;};}function removeEntity(_0x5de824,_0x14b4b0){return function(_0x49edb3){if(_0x49edb3){return _0x49edb3[_0xbf69('0x24')]()['then'](function(){_0x5de824[_0xbf69('0x19')](0xcc)[_0xbf69('0x18')]();});}};}function handleEntityNotFound(_0x10b9c0,_0x276a00){return function(_0x23bef3){if(!_0x23bef3){_0x10b9c0[_0xbf69('0x25')](0x194);}return _0x23bef3;};}function handleError(_0x1ff38b,_0xfb7055){_0xfb7055=_0xfb7055||0x1f4;return function(_0x7ad809){logger[_0xbf69('0x26')](_0x7ad809[_0xbf69('0x27')]);if(_0x7ad809[_0xbf69('0x28')]){delete _0x7ad809[_0xbf69('0x28')];}_0x1ff38b[_0xbf69('0x19')](_0xfb7055)['send'](_0x7ad809);};}exports[_0xbf69('0x29')]=function(_0x3c8f0a,_0x36c8e5){var _0x320585={},_0x1711f7={},_0x18ff67={'count':0x0,'rows':[]};var _0x2e8556=_['map'](db[_0xbf69('0x2a')][_0xbf69('0x2b')],function(_0x56fe97){return{'name':_0x56fe97['fieldName'],'type':_0x56fe97['type']['key']};});_0x1711f7[_0xbf69('0x2c')]=_[_0xbf69('0x2d')](_0x2e8556,'name');_0x1711f7[_0xbf69('0x2e')]=_[_0xbf69('0x2f')](_0x3c8f0a[_0xbf69('0x2e')]);_0x1711f7['filters']=_['intersection'](_0x1711f7[_0xbf69('0x2c')],_0x1711f7[_0xbf69('0x2e')]);_0x320585[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0x1711f7['model'],qs[_0xbf69('0x32')](_0x3c8f0a[_0xbf69('0x2e')][_0xbf69('0x32')]));_0x320585[_0xbf69('0x30')]=_0x320585[_0xbf69('0x30')][_0xbf69('0x33')]?_0x320585[_0xbf69('0x30')]:_0x1711f7[_0xbf69('0x2c')];if(!_0x3c8f0a['query'][_0xbf69('0x34')](_0xbf69('0x35'))){_0x320585[_0xbf69('0x1d')]=qs['limit'](_0x3c8f0a[_0xbf69('0x2e')]['limit']);_0x320585['offset']=qs[_0xbf69('0x1b')](_0x3c8f0a[_0xbf69('0x2e')]['offset']);}_0x320585['order']=qs[_0xbf69('0x36')](_0x3c8f0a[_0xbf69('0x2e')][_0xbf69('0x36')]);_0x320585['where']=qs[_0xbf69('0x37')](_['pick'](_0x3c8f0a[_0xbf69('0x2e')],_0x1711f7['filters']),_0x2e8556);if(_0x3c8f0a[_0xbf69('0x2e')]['filter']){_0x320585['where']=_[_0xbf69('0x38')](_0x320585[_0xbf69('0x39')],{'$or':_[_0xbf69('0x2d')](_0x2e8556,function(_0x219c57){if(_0x219c57[_0xbf69('0x3a')]!=='VIRTUAL'){var _0x8576a2={};_0x8576a2[_0x219c57[_0xbf69('0x28')]]={'$like':'%'+_0x3c8f0a[_0xbf69('0x2e')][_0xbf69('0x3b')]+'%'};return _0x8576a2;}})});}_0x320585=_[_0xbf69('0x38')]({},_0x320585,_0x3c8f0a[_0xbf69('0x3c')]);var _0x4b4790={'where':_0x320585[_0xbf69('0x39')]};return db[_0xbf69('0x2a')]['count'](_0x4b4790)[_0xbf69('0x23')](function(_0x3c82dd){_0x18ff67['count']=_0x3c82dd;if(_0x3c8f0a[_0xbf69('0x2e')]['includeAll']){_0x320585[_0xbf69('0x3d')]=[{'all':!![]}];}return db[_0xbf69('0x2a')][_0xbf69('0x3e')](_0x320585);})[_0xbf69('0x23')](function(_0x4cb394){_0x18ff67[_0xbf69('0x3f')]=_0x4cb394;return _0x18ff67;})[_0xbf69('0x23')](respondWithFilteredResult(_0x36c8e5,_0x320585))[_0xbf69('0x40')](handleError(_0x36c8e5,null));};exports[_0xbf69('0x41')]=function(_0xdcd0c1,_0x40fd64){var _0x2c9100={'raw':!![],'where':{'id':_0xdcd0c1['params']['id']}},_0x496a64={};_0x496a64['model']=_[_0xbf69('0x2f')](db['FaxQueueReport'][_0xbf69('0x2b')]);_0x496a64['query']=_[_0xbf69('0x2f')](_0xdcd0c1['query']);_0x496a64['filters']=_[_0xbf69('0x31')](_0x496a64[_0xbf69('0x2c')],_0x496a64[_0xbf69('0x2e')]);_0x2c9100[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0x496a64[_0xbf69('0x2c')],qs[_0xbf69('0x32')](_0xdcd0c1[_0xbf69('0x2e')][_0xbf69('0x32')]));_0x2c9100[_0xbf69('0x30')]=_0x2c9100[_0xbf69('0x30')][_0xbf69('0x33')]?_0x2c9100[_0xbf69('0x30')]:_0x496a64['model'];if(_0xdcd0c1[_0xbf69('0x2e')][_0xbf69('0x42')]){_0x2c9100[_0xbf69('0x3d')]=[{'all':!![]}];}_0x2c9100=_[_0xbf69('0x38')]({},_0x2c9100,_0xdcd0c1['options']);return db['FaxQueueReport']['find'](_0x2c9100)[_0xbf69('0x23')](handleEntityNotFound(_0x40fd64,null))[_0xbf69('0x23')](respondWithResult(_0x40fd64,null))[_0xbf69('0x40')](handleError(_0x40fd64,null));};exports[_0xbf69('0x43')]=function(_0x2fe13c,_0x4bbdda){return db['FaxQueueReport']['create'](_0x2fe13c[_0xbf69('0x44')],{})['then'](respondWithResult(_0x4bbdda,0xc9))['catch'](handleError(_0x4bbdda,null));};exports[_0xbf69('0x22')]=function(_0x55dc90,_0x7d69cb){if(_0x55dc90[_0xbf69('0x44')]['id']){delete _0x55dc90[_0xbf69('0x44')]['id'];}return db[_0xbf69('0x2a')]['find']({'where':{'id':_0x55dc90[_0xbf69('0x45')]['id']}})[_0xbf69('0x23')](handleEntityNotFound(_0x7d69cb,null))['then'](saveUpdates(_0x55dc90[_0xbf69('0x44')],null))[_0xbf69('0x23')](respondWithResult(_0x7d69cb,null))[_0xbf69('0x40')](handleError(_0x7d69cb,null));};exports['destroy']=function(_0x275b2c,_0x46096c){return db[_0xbf69('0x2a')][_0xbf69('0x46')]({'where':{'id':_0x275b2c[_0xbf69('0x45')]['id']}})[_0xbf69('0x23')](handleEntityNotFound(_0x46096c,null))[_0xbf69('0x23')](removeEntity(_0x46096c,null))['catch'](handleError(_0x46096c,null));};exports[_0xbf69('0x47')]=function(_0x515f65,_0x5220d1){return db[_0xbf69('0x2a')][_0xbf69('0x47')]()[_0xbf69('0x23')](respondWithResult(_0x5220d1,null))[_0xbf69('0x40')](handleError(_0x5220d1,null));}; \ No newline at end of file +var _0xf323=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','reject','update','destroy','then','end','error','stack','name','index','map','FaxQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick'];(function(_0x10393a,_0x2371f2){var _0x4eba0b=function(_0x49d3e0){while(--_0x49d3e0){_0x10393a['push'](_0x10393a['shift']());}};_0x4eba0b(++_0x2371f2);}(_0xf323,0x1c6));var _0x3f32=function(_0x5150e1,_0x91cff0){_0x5150e1=_0x5150e1-0x0;var _0x2b5175=_0xf323[_0x5150e1];return _0x2b5175;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f32('0x0'));var jsonpatch=require(_0x3f32('0x1'));var rp=require('request-promise');var moment=require(_0x3f32('0x2'));var BPromise=require(_0x3f32('0x3'));var Mustache=require(_0x3f32('0x4'));var util=require(_0x3f32('0x5'));var path=require(_0x3f32('0x6'));var sox=require('sox');var csv=require(_0x3f32('0x7'));var ejs=require(_0x3f32('0x8'));var fs=require('fs');var fs_extra=require(_0x3f32('0x9'));var _=require(_0x3f32('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f32('0xb'));var deskjs=require(_0x3f32('0xc'));var toCsv=require(_0x3f32('0x7'));var querystring=require(_0x3f32('0xd'));var Papa=require(_0x3f32('0xe'));var Redis=require(_0x3f32('0xf'));var authService=require(_0x3f32('0x10'));var qs=require(_0x3f32('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f32('0x12'));var logger=require(_0x3f32('0x13'))(_0x3f32('0x14'));var utils=require('../../config/utils');var config=require(_0x3f32('0x15'));var licenseUtil=require(_0x3f32('0x16'));var db=require(_0x3f32('0x17'))['db'];function respondWithStatusCode(_0x2b1aa3,_0x5c876b){_0x5c876b=_0x5c876b||0xcc;return function(_0x4d7e41){if(_0x4d7e41){return _0x2b1aa3[_0x3f32('0x18')](_0x5c876b);}return _0x2b1aa3[_0x3f32('0x19')](_0x5c876b)['end']();};}function respondWithResult(_0x4097b4,_0x22b00){_0x22b00=_0x22b00||0xc8;return function(_0xc68dd5){if(_0xc68dd5){return _0x4097b4['status'](_0x22b00)['json'](_0xc68dd5);}};}function respondWithFilteredResult(_0x360b1b,_0x1de24c){return function(_0x1adaa5){if(_0x1adaa5){var _0x219d91=typeof _0x1de24c['offset']==='undefined'&&typeof _0x1de24c[_0x3f32('0x1a')]===_0x3f32('0x1b');var _0x3a8e7b=_0x1adaa5['count'];var _0x5c36d9=_0x219d91?0x0:_0x1de24c[_0x3f32('0x1c')];var _0x19ec90=_0x219d91?_0x1adaa5[_0x3f32('0x1d')]:_0x1de24c[_0x3f32('0x1c')]+_0x1de24c[_0x3f32('0x1a')];var _0x517e49;if(_0x19ec90>=_0x3a8e7b){_0x19ec90=_0x3a8e7b;_0x517e49=0xc8;}else{_0x517e49=0xce;}_0x360b1b[_0x3f32('0x19')](_0x517e49);return _0x360b1b[_0x3f32('0x1e')](_0x3f32('0x1f'),_0x5c36d9+'-'+_0x19ec90+'/'+_0x3a8e7b)[_0x3f32('0x20')](_0x1adaa5);}return null;};}function patchUpdates(_0xbc366b){return function(_0x2e698a){try{jsonpatch['apply'](_0x2e698a,_0xbc366b,!![]);}catch(_0x1e2d85){return BPromise[_0x3f32('0x21')](_0x1e2d85);}return _0x2e698a['save']();};}function saveUpdates(_0x1874e4,_0x21cf2e){return function(_0x3ddf25){if(_0x3ddf25){return _0x3ddf25[_0x3f32('0x22')](_0x1874e4)['then'](function(_0x1ea58b){return _0x1ea58b;});}return null;};}function removeEntity(_0x20f7d1,_0x4eb2ad){return function(_0x416015){if(_0x416015){return _0x416015[_0x3f32('0x23')]()[_0x3f32('0x24')](function(){_0x20f7d1[_0x3f32('0x19')](0xcc)[_0x3f32('0x25')]();});}};}function handleEntityNotFound(_0x11f4ab,_0x28bff4){return function(_0x38de66){if(!_0x38de66){_0x11f4ab[_0x3f32('0x18')](0x194);}return _0x38de66;};}function handleError(_0x3130de,_0x30ef37){_0x30ef37=_0x30ef37||0x1f4;return function(_0x5b5e9d){logger[_0x3f32('0x26')](_0x5b5e9d[_0x3f32('0x27')]);if(_0x5b5e9d['name']){delete _0x5b5e9d[_0x3f32('0x28')];}_0x3130de['status'](_0x30ef37)['send'](_0x5b5e9d);};}exports[_0x3f32('0x29')]=function(_0x785270,_0x1ee79e){var _0x320972={},_0x20b333={},_0x36623c={'count':0x0,'rows':[]};var _0x293c05=_[_0x3f32('0x2a')](db[_0x3f32('0x2b')][_0x3f32('0x2c')],function(_0x448bf7){return{'name':_0x448bf7['fieldName'],'type':_0x448bf7[_0x3f32('0x2d')][_0x3f32('0x2e')]};});_0x20b333[_0x3f32('0x2f')]=_[_0x3f32('0x2a')](_0x293c05,'name');_0x20b333['query']=_['keys'](_0x785270[_0x3f32('0x30')]);_0x20b333[_0x3f32('0x31')]=_[_0x3f32('0x32')](_0x20b333[_0x3f32('0x2f')],_0x20b333[_0x3f32('0x30')]);_0x320972[_0x3f32('0x33')]=_[_0x3f32('0x32')](_0x20b333[_0x3f32('0x2f')],qs[_0x3f32('0x34')](_0x785270['query'][_0x3f32('0x34')]));_0x320972[_0x3f32('0x33')]=_0x320972['attributes']['length']?_0x320972[_0x3f32('0x33')]:_0x20b333[_0x3f32('0x2f')];if(!_0x785270[_0x3f32('0x30')]['hasOwnProperty']('nolimit')){_0x320972[_0x3f32('0x1a')]=qs[_0x3f32('0x1a')](_0x785270[_0x3f32('0x30')][_0x3f32('0x1a')]);_0x320972['offset']=qs[_0x3f32('0x1c')](_0x785270['query'][_0x3f32('0x1c')]);}_0x320972[_0x3f32('0x35')]=qs['sort'](_0x785270[_0x3f32('0x30')][_0x3f32('0x36')]);_0x320972[_0x3f32('0x37')]=qs[_0x3f32('0x31')](_[_0x3f32('0x38')](_0x785270[_0x3f32('0x30')],_0x20b333[_0x3f32('0x31')]),_0x293c05);if(_0x785270[_0x3f32('0x30')]['filter']){_0x320972['where']=_[_0x3f32('0x39')](_0x320972[_0x3f32('0x37')],{'$or':_[_0x3f32('0x2a')](_0x293c05,function(_0x1e0e9a){if(_0x1e0e9a[_0x3f32('0x2d')]!==_0x3f32('0x3a')){var _0x28bd51={};_0x28bd51[_0x1e0e9a[_0x3f32('0x28')]]={'$like':'%'+_0x785270[_0x3f32('0x30')]['filter']+'%'};return _0x28bd51;}})});}_0x320972=_[_0x3f32('0x39')]({},_0x320972,_0x785270[_0x3f32('0x3b')]);var _0x3210a5={'where':_0x320972['where']};return db[_0x3f32('0x2b')][_0x3f32('0x1d')](_0x3210a5)['then'](function(_0xfaed17){_0x36623c[_0x3f32('0x1d')]=_0xfaed17;if(_0x785270[_0x3f32('0x30')][_0x3f32('0x3c')]){_0x320972[_0x3f32('0x3d')]=[{'all':!![]}];}return db[_0x3f32('0x2b')][_0x3f32('0x3e')](_0x320972);})['then'](function(_0x5831fe){_0x36623c[_0x3f32('0x3f')]=_0x5831fe;return _0x36623c;})[_0x3f32('0x24')](respondWithFilteredResult(_0x1ee79e,_0x320972))['catch'](handleError(_0x1ee79e,null));};exports[_0x3f32('0x40')]=function(_0x35701f,_0x25a4ce){var _0x23b773={'raw':!![],'where':{'id':_0x35701f[_0x3f32('0x41')]['id']}},_0x21a803={};_0x21a803[_0x3f32('0x2f')]=_['keys'](db[_0x3f32('0x2b')][_0x3f32('0x2c')]);_0x21a803[_0x3f32('0x30')]=_[_0x3f32('0x42')](_0x35701f[_0x3f32('0x30')]);_0x21a803[_0x3f32('0x31')]=_[_0x3f32('0x32')](_0x21a803[_0x3f32('0x2f')],_0x21a803[_0x3f32('0x30')]);_0x23b773['attributes']=_[_0x3f32('0x32')](_0x21a803[_0x3f32('0x2f')],qs[_0x3f32('0x34')](_0x35701f[_0x3f32('0x30')][_0x3f32('0x34')]));_0x23b773['attributes']=_0x23b773['attributes'][_0x3f32('0x43')]?_0x23b773[_0x3f32('0x33')]:_0x21a803[_0x3f32('0x2f')];if(_0x35701f['query'][_0x3f32('0x3c')]){_0x23b773['include']=[{'all':!![]}];}_0x23b773=_[_0x3f32('0x39')]({},_0x23b773,_0x35701f[_0x3f32('0x3b')]);return db[_0x3f32('0x2b')][_0x3f32('0x44')](_0x23b773)[_0x3f32('0x24')](handleEntityNotFound(_0x25a4ce,null))['then'](respondWithResult(_0x25a4ce,null))[_0x3f32('0x45')](handleError(_0x25a4ce,null));};exports[_0x3f32('0x46')]=function(_0x2158c2,_0x4a0870){return db['FaxQueueReport'][_0x3f32('0x46')](_0x2158c2['body'],{})[_0x3f32('0x24')](respondWithResult(_0x4a0870,0xc9))[_0x3f32('0x45')](handleError(_0x4a0870,null));};exports[_0x3f32('0x22')]=function(_0x2753eb,_0x80bffd){if(_0x2753eb['body']['id']){delete _0x2753eb[_0x3f32('0x47')]['id'];}return db[_0x3f32('0x2b')][_0x3f32('0x44')]({'where':{'id':_0x2753eb[_0x3f32('0x41')]['id']}})[_0x3f32('0x24')](handleEntityNotFound(_0x80bffd,null))['then'](saveUpdates(_0x2753eb[_0x3f32('0x47')],null))[_0x3f32('0x24')](respondWithResult(_0x80bffd,null))['catch'](handleError(_0x80bffd,null));};exports[_0x3f32('0x23')]=function(_0x422da0,_0x2c6160){return db[_0x3f32('0x2b')]['find']({'where':{'id':_0x422da0[_0x3f32('0x41')]['id']}})[_0x3f32('0x24')](handleEntityNotFound(_0x2c6160,null))[_0x3f32('0x24')](removeEntity(_0x2c6160,null))[_0x3f32('0x45')](handleError(_0x2c6160,null));};exports[_0x3f32('0x48')]=function(_0x38107f,_0x9f14d8){return db['FaxQueueReport']['describe']()[_0x3f32('0x24')](respondWithResult(_0x9f14d8,null))[_0x3f32('0x45')](handleError(_0x9f14d8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index cf23a25..823611d 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x38e927,_0x8691f){var _0x1ed089=function(_0x1f793f){while(--_0x1f793f){_0x38e927['push'](_0x38e927['shift']());}};_0x1ed089(++_0x8691f);}(_0x4975,0x86));var _0x5497=function(_0x3f7044,_0x4b4de8){_0x3f7044=_0x3f7044-0x0;var _0x45fc2c=_0x4975[_0x3f7044];return _0x45fc2c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1cb9,0x14e));var _0x91cb=function(_0x265f57,_0x5100e6){_0x265f57=_0x265f57-0x0;var _0x549c53=_0x1cb9[_0x265f57];return _0x549c53;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index cc04d88..ec7e48b 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 _0xccca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','body','raw','where','attributes','UpdateFaxQueueReport','lodash','util','moment'];(function(_0x42e4aa,_0x2a2f6e){var _0x7b27d3=function(_0x2aa0a8){while(--_0x2aa0a8){_0x42e4aa['push'](_0x42e4aa['shift']());}};_0x7b27d3(++_0x2a2f6e);}(_0xccca,0x1ce));var _0xaccc=function(_0x3d644d,_0xa4f1b5){_0x3d644d=_0x3d644d-0x0;var _0x3ace93=_0xccca[_0x3d644d];return _0x3ace93;};'use strict';var _=require(_0xaccc('0x0'));var util=require(_0xaccc('0x1'));var moment=require(_0xaccc('0x2'));var BPromise=require(_0xaccc('0x3'));var rs=require(_0xaccc('0x4'));var fs=require('fs');var Redis=require(_0xaccc('0x5'));var db=require(_0xaccc('0x6'))['db'];var utils=require(_0xaccc('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xaccc('0x8'));var client=jayson[_0xaccc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26294a,_0x1502a9,_0x82b326){return new BPromise(function(_0xaf97d0,_0xc65aad){return client[_0xaccc('0xa')](_0x26294a,_0x82b326)[_0xaccc('0xb')](function(_0xe900cc){logger[_0xaccc('0xc')](_0xaccc('0xd'),_0x1502a9,_0xaccc('0xe'));logger[_0xaccc('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1502a9,_0xaccc('0xe'),JSON[_0xaccc('0x10')](_0xe900cc));if(_0xe900cc[_0xaccc('0x11')]){if(_0xe900cc[_0xaccc('0x11')][_0xaccc('0x12')]===0x1f4){logger['error'](_0xaccc('0xd'),_0x1502a9,_0xe900cc[_0xaccc('0x11')]['message']);return _0xc65aad(_0xe900cc[_0xaccc('0x11')]['message']);}logger['error'](_0xaccc('0xd'),_0x1502a9,_0xe900cc['error']['message']);return _0xaf97d0(_0xe900cc['error'][_0xaccc('0x13')]);}else{logger['info'](_0xaccc('0xd'),_0x1502a9,_0xaccc('0xe'));_0xaf97d0(_0xe900cc[_0xaccc('0x14')][_0xaccc('0x13')]);}})[_0xaccc('0x15')](function(_0x196e0f){logger['error'](_0xaccc('0xd'),_0x1502a9,_0x196e0f);_0xc65aad(_0x196e0f);});});}exports[_0xaccc('0x16')]=function(_0xdf88d3){var _0x84aa2d=this;return new Promise(function(_0x336fb5,_0x55baaf){return db[_0xaccc('0x17')][_0xaccc('0x18')](_0xdf88d3['body'],{'raw':_0xdf88d3[_0xaccc('0x19')]?_0xdf88d3[_0xaccc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaccc('0xb')](function(_0x12124c){logger[_0xaccc('0xc')]('CreateFaxQueueReport',_0xdf88d3);logger['debug'](_0xaccc('0x16'),_0xdf88d3,JSON[_0xaccc('0x10')](_0x12124c));_0x336fb5(_0x12124c);})['catch'](function(_0xc5dfd2){logger[_0xaccc('0x11')](_0xaccc('0x16'),_0xc5dfd2[_0xaccc('0x13')],_0xdf88d3);_0x55baaf(_0x84aa2d[_0xaccc('0x11')](0x1f4,_0xc5dfd2[_0xaccc('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x4387eb){var _0x433a50=this;return new Promise(function(_0x4343c7,_0x1b077d){return db[_0xaccc('0x17')]['update'](_0x4387eb[_0xaccc('0x1a')],{'raw':_0x4387eb['options']?_0x4387eb[_0xaccc('0x19')][_0xaccc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4387eb['options']?_0x4387eb[_0xaccc('0x19')][_0xaccc('0x1c')]||null:null,'attributes':_0x4387eb[_0xaccc('0x19')]?_0x4387eb[_0xaccc('0x19')][_0xaccc('0x1d')]||null:null,'limit':_0x4387eb[_0xaccc('0x19')]?_0x4387eb['options']['limit']||null:null})[_0xaccc('0xb')](function(_0xac5d60){logger[_0xaccc('0xc')]('UpdateFaxQueueReport',_0x4387eb);logger[_0xaccc('0xf')](_0xaccc('0x1e'),_0x4387eb,JSON[_0xaccc('0x10')](_0xac5d60));_0x4343c7(_0xac5d60);})[_0xaccc('0x15')](function(_0x4949b5){logger['error'](_0xaccc('0x1e'),_0x4949b5[_0xaccc('0x13')],_0x4387eb);_0x1b077d(_0x433a50[_0xaccc('0x11')](0x1f4,_0x4949b5[_0xaccc('0x13')]));});});}; \ No newline at end of file +var _0xb99f=['util','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','debug','UpdateFaxQueueReport','update','body','raw','where','attributes'];(function(_0x1d4420,_0x314978){var _0x4c3dcc=function(_0x33b259){while(--_0x33b259){_0x1d4420['push'](_0x1d4420['shift']());}};_0x4c3dcc(++_0x314978);}(_0xb99f,0x70));var _0xfb99=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb99f[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require('lodash');var util=require(_0xfb99('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb99('0x1'))['db'];var utils=require(_0xfb99('0x2'));var logger=require('../../config/logger')(_0xfb99('0x3'));var config=require(_0xfb99('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xfb99('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb26c,_0x24216d,_0x35907d){return new BPromise(function(_0x5ce159,_0x5eb1f6){return client[_0xfb99('0x6')](_0x4cb26c,_0x35907d)[_0xfb99('0x7')](function(_0x2d30e4){logger[_0xfb99('0x8')](_0xfb99('0x9'),_0x24216d,_0xfb99('0xa'));logger['debug'](_0xfb99('0xb'),_0x24216d,_0xfb99('0xa'),JSON[_0xfb99('0xc')](_0x2d30e4));if(_0x2d30e4[_0xfb99('0xd')]){if(_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xe')]===0x1f4){logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);return _0x5eb1f6(_0x2d30e4[_0xfb99('0xd')]['message']);}logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);return _0x5ce159(_0x2d30e4[_0xfb99('0xd')][_0xfb99('0xf')]);}else{logger['info'](_0xfb99('0x9'),_0x24216d,_0xfb99('0xa'));_0x5ce159(_0x2d30e4[_0xfb99('0x10')][_0xfb99('0xf')]);}})[_0xfb99('0x11')](function(_0x48a396){logger[_0xfb99('0xd')](_0xfb99('0x9'),_0x24216d,_0x48a396);_0x5eb1f6(_0x48a396);});});}exports[_0xfb99('0x12')]=function(_0x37e4c6){var _0xabebe=this;return new Promise(function(_0x29bc30,_0x5619d5){return db[_0xfb99('0x13')]['create'](_0x37e4c6['body'],{'raw':_0x37e4c6[_0xfb99('0x14')]?_0x37e4c6['options']['raw']===undefined?!![]:![]:!![]})[_0xfb99('0x7')](function(_0x29194e){logger[_0xfb99('0x8')](_0xfb99('0x12'),_0x37e4c6);logger[_0xfb99('0x15')](_0xfb99('0x12'),_0x37e4c6,JSON[_0xfb99('0xc')](_0x29194e));_0x29bc30(_0x29194e);})[_0xfb99('0x11')](function(_0x1c2ca5){logger['error']('CreateFaxQueueReport',_0x1c2ca5[_0xfb99('0xf')],_0x37e4c6);_0x5619d5(_0xabebe['error'](0x1f4,_0x1c2ca5[_0xfb99('0xf')]));});});};exports[_0xfb99('0x16')]=function(_0x4504c9){var _0x179d69=this;return new Promise(function(_0x322aee,_0x50c743){return db[_0xfb99('0x13')][_0xfb99('0x17')](_0x4504c9[_0xfb99('0x18')],{'raw':_0x4504c9[_0xfb99('0x14')]?_0x4504c9['options'][_0xfb99('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4504c9[_0xfb99('0x14')]?_0x4504c9[_0xfb99('0x14')][_0xfb99('0x1a')]||null:null,'attributes':_0x4504c9[_0xfb99('0x14')]?_0x4504c9[_0xfb99('0x14')][_0xfb99('0x1b')]||null:null,'limit':_0x4504c9['options']?_0x4504c9[_0xfb99('0x14')]['limit']||null:null})[_0xfb99('0x7')](function(_0x1ca0da){logger[_0xfb99('0x8')](_0xfb99('0x16'),_0x4504c9);logger[_0xfb99('0x15')](_0xfb99('0x16'),_0x4504c9,JSON[_0xfb99('0xc')](_0x1ca0da));_0x322aee(_0x1ca0da);})[_0xfb99('0x11')](function(_0xae398b){logger[_0xfb99('0xd')](_0xfb99('0x16'),_0xae398b['message'],_0x4504c9);_0x50c743(_0x179d69[_0xfb99('0xd')](0x1f4,_0xae398b[_0xfb99('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a041ada..68ef200 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 _0x17bf=['/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','show','post'];(function(_0xb61626,_0x63af0d){var _0x2fca8f=function(_0x5aa972){while(--_0x5aa972){_0xb61626['push'](_0xb61626['shift']());}};_0x2fca8f(++_0x63af0d);}(_0x17bf,0x1b2));var _0xf17b=function(_0x513dce,_0x3bbd40){_0x513dce=_0x513dce-0x0;var _0x50d79d=_0x17bf[_0x513dce];return _0x50d79d;};'use strict';var multer=require(_0xf17b('0x0'));var util=require(_0xf17b('0x1'));var path=require(_0xf17b('0x2'));var timeout=require(_0xf17b('0x3'));var express=require(_0xf17b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf17b('0x5'));var interaction=require(_0xf17b('0x6'));var config=require(_0xf17b('0x7'));var controller=require(_0xf17b('0x8'));router[_0xf17b('0x9')]('/',auth[_0xf17b('0xa')](),controller[_0xf17b('0xb')]);router['get']('/describe',auth[_0xf17b('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf17b('0xc')]);router[_0xf17b('0xd')]('/',auth[_0xf17b('0xa')](),controller['create']);router['put'](_0xf17b('0xe'),auth[_0xf17b('0xa')](),controller['update']);router['delete'](_0xf17b('0xe'),auth[_0xf17b('0xa')](),controller[_0xf17b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5e58=['show','create','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x5a13de,_0x156d86){var _0x58304d=function(_0x1ef25e){while(--_0x1ef25e){_0x5a13de['push'](_0x5a13de['shift']());}};_0x58304d(++_0x156d86);}(_0x5e58,0x1be));var _0x85e5=function(_0xbb4325,_0x293598){_0xbb4325=_0xbb4325-0x0;var _0xf7423a=_0x5e58[_0xbb4325];return _0xf7423a;};'use strict';var multer=require(_0x85e5('0x0'));var util=require('util');var path=require(_0x85e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x85e5('0x2'));var router=express[_0x85e5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x85e5('0x4'));var interaction=require(_0x85e5('0x5'));var config=require(_0x85e5('0x6'));var controller=require(_0x85e5('0x7'));router[_0x85e5('0x8')]('/',auth[_0x85e5('0x9')](),controller[_0x85e5('0xa')]);router['get']('/describe',auth[_0x85e5('0x9')](),controller[_0x85e5('0xb')]);router[_0x85e5('0x8')](_0x85e5('0xc'),auth[_0x85e5('0x9')](),controller[_0x85e5('0xd')]);router['post']('/',auth[_0x85e5('0x9')](),controller[_0x85e5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x85e5('0xf')]('/:id',auth[_0x85e5('0x9')](),controller[_0x85e5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 61b8bcf..af00789 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3de2cc,_0x1561c7){var _0x20fb41=function(_0x54bf7e){while(--_0x54bf7e){_0x3de2cc['push'](_0x3de2cc['shift']());}};_0x20fb41(++_0x1561c7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x13c174,_0xda25fe){_0x13c174=_0x13c174-0x0;var _0x160654=_0xf3cd[_0x13c174];return _0x160654;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1dce30,_0x5a776c){var _0x49bd71=function(_0x351020){while(--_0x351020){_0x1dce30['push'](_0x1dce30['shift']());}};_0x49bd71(++_0x5a776c);}(_0x70e0,0x17b));var _0x070e=function(_0x34874f,_0xb4f7f1){_0x34874f=_0x34874f-0x0;var _0x56b834=_0x70e0[_0x34874f];return _0x56b834;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 48fb098..05eb59f 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 _0xf9e3=['request-promise','moment','bluebird','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/environment','../../config/license/util','status','end','offset','undefined','set','json','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','FaxTransferReport','include','findAll','rows','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir'];(function(_0x5f47c8,_0x29695a){var _0x54cd62=function(_0x394172){while(--_0x394172){_0x5f47c8['push'](_0x5f47c8['shift']());}};_0x54cd62(++_0x29695a);}(_0xf9e3,0xd5));var _0x3f9e=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf9e3[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x3f9e('0x0'));var rimraf=require(_0x3f9e('0x1'));var zipdir=require(_0x3f9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f9e('0x3'));var moment=require(_0x3f9e('0x4'));var BPromise=require(_0x3f9e('0x5'));var Mustache=require('mustache');var util=require(_0x3f9e('0x6'));var path=require(_0x3f9e('0x7'));var sox=require('sox');var csv=require(_0x3f9e('0x8'));var ejs=require(_0x3f9e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f9e('0xa'));var squel=require(_0x3f9e('0xb'));var crypto=require(_0x3f9e('0xc'));var jsforce=require(_0x3f9e('0xd'));var deskjs=require(_0x3f9e('0xe'));var toCsv=require(_0x3f9e('0x8'));var querystring=require('querystring');var Papa=require(_0x3f9e('0xf'));var Redis=require(_0x3f9e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3f9e('0x11'));var as=require(_0x3f9e('0x12'));var hardwareService=require(_0x3f9e('0x13'));var logger=require(_0x3f9e('0x14'))(_0x3f9e('0x15'));var utils=require(_0x3f9e('0x16'));var config=require(_0x3f9e('0x17'));var licenseUtil=require(_0x3f9e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47cf4f,_0x42e3d6){_0x42e3d6=_0x42e3d6||0xcc;return function(_0x5d05d3){if(_0x5d05d3){return _0x47cf4f['sendStatus'](_0x42e3d6);}return _0x47cf4f[_0x3f9e('0x19')](_0x42e3d6)[_0x3f9e('0x1a')]();};}function respondWithResult(_0x436fa7,_0x4d63f7){_0x4d63f7=_0x4d63f7||0xc8;return function(_0x53f528){if(_0x53f528){return _0x436fa7['status'](_0x4d63f7)['json'](_0x53f528);}};}function respondWithFilteredResult(_0x2badc9,_0x31abfb){return function(_0x4d4fec){if(_0x4d4fec){var _0x4fd727=typeof _0x31abfb[_0x3f9e('0x1b')]===_0x3f9e('0x1c')&&typeof _0x31abfb['limit']===_0x3f9e('0x1c');var _0x562fdb=_0x4d4fec['count'];var _0x488dde=_0x4fd727?0x0:_0x31abfb[_0x3f9e('0x1b')];var _0x46ba04=_0x4fd727?_0x4d4fec['count']:_0x31abfb[_0x3f9e('0x1b')]+_0x31abfb['limit'];var _0x341d87;if(_0x46ba04>=_0x562fdb){_0x46ba04=_0x562fdb;_0x341d87=0xc8;}else{_0x341d87=0xce;}_0x2badc9[_0x3f9e('0x19')](_0x341d87);return _0x2badc9[_0x3f9e('0x1d')]('Content-Range',_0x488dde+'-'+_0x46ba04+'/'+_0x562fdb)[_0x3f9e('0x1e')](_0x4d4fec);}return null;};}function patchUpdates(_0x28520a){return function(_0x5cd579){try{jsonpatch['apply'](_0x5cd579,_0x28520a,!![]);}catch(_0x3f5139){return BPromise[_0x3f9e('0x1f')](_0x3f5139);}return _0x5cd579[_0x3f9e('0x20')]();};}function saveUpdates(_0x32ed6b,_0x19ba79){return function(_0x1dc032){if(_0x1dc032){return _0x1dc032[_0x3f9e('0x21')](_0x32ed6b)[_0x3f9e('0x22')](function(_0x2dba80){return _0x2dba80;});}return null;};}function removeEntity(_0x35318f,_0x1bb32f){return function(_0x377c63){if(_0x377c63){return _0x377c63[_0x3f9e('0x23')]()[_0x3f9e('0x22')](function(){_0x35318f[_0x3f9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48caea,_0x5beb24){return function(_0x499572){if(!_0x499572){_0x48caea['sendStatus'](0x194);}return _0x499572;};}function handleError(_0x38e673,_0x4fe3eb){_0x4fe3eb=_0x4fe3eb||0x1f4;return function(_0x47e112){logger['error'](_0x47e112['stack']);if(_0x47e112[_0x3f9e('0x24')]){delete _0x47e112[_0x3f9e('0x24')];}_0x38e673['status'](_0x4fe3eb)[_0x3f9e('0x25')](_0x47e112);};}exports[_0x3f9e('0x26')]=function(_0x1aa934,_0x274ee1){var _0x31e5a5={},_0x425911={},_0x4d9307={'count':0x0,'rows':[]};var _0x520a38=_[_0x3f9e('0x27')](db['FaxTransferReport'][_0x3f9e('0x28')],function(_0x3b213c){return{'name':_0x3b213c[_0x3f9e('0x29')],'type':_0x3b213c[_0x3f9e('0x2a')][_0x3f9e('0x2b')]};});_0x425911[_0x3f9e('0x2c')]=_['map'](_0x520a38,_0x3f9e('0x24'));_0x425911[_0x3f9e('0x2d')]=_[_0x3f9e('0x2e')](_0x1aa934[_0x3f9e('0x2d')]);_0x425911[_0x3f9e('0x2f')]=_[_0x3f9e('0x30')](_0x425911['model'],_0x425911[_0x3f9e('0x2d')]);_0x31e5a5[_0x3f9e('0x31')]=_[_0x3f9e('0x30')](_0x425911[_0x3f9e('0x2c')],qs[_0x3f9e('0x32')](_0x1aa934[_0x3f9e('0x2d')]['fields']));_0x31e5a5[_0x3f9e('0x31')]=_0x31e5a5[_0x3f9e('0x31')][_0x3f9e('0x33')]?_0x31e5a5[_0x3f9e('0x31')]:_0x425911['model'];if(!_0x1aa934[_0x3f9e('0x2d')][_0x3f9e('0x34')](_0x3f9e('0x35'))){_0x31e5a5[_0x3f9e('0x36')]=qs[_0x3f9e('0x36')](_0x1aa934[_0x3f9e('0x2d')][_0x3f9e('0x36')]);_0x31e5a5[_0x3f9e('0x1b')]=qs['offset'](_0x1aa934[_0x3f9e('0x2d')]['offset']);}_0x31e5a5['order']=qs[_0x3f9e('0x37')](_0x1aa934['query']['sort']);_0x31e5a5[_0x3f9e('0x38')]=qs[_0x3f9e('0x2f')](_[_0x3f9e('0x39')](_0x1aa934[_0x3f9e('0x2d')],_0x425911[_0x3f9e('0x2f')]),_0x520a38);if(_0x1aa934[_0x3f9e('0x2d')][_0x3f9e('0x3a')]){_0x31e5a5['where']=_[_0x3f9e('0x3b')](_0x31e5a5[_0x3f9e('0x38')],{'$or':_[_0x3f9e('0x27')](_0x520a38,function(_0x5685de){if(_0x5685de[_0x3f9e('0x2a')]!==_0x3f9e('0x3c')){var _0x248fd4={};_0x248fd4[_0x5685de['name']]={'$like':'%'+_0x1aa934[_0x3f9e('0x2d')][_0x3f9e('0x3a')]+'%'};return _0x248fd4;}})});}_0x31e5a5=_['merge']({},_0x31e5a5,_0x1aa934[_0x3f9e('0x3d')]);var _0x2d454a={'where':_0x31e5a5[_0x3f9e('0x38')]};return db[_0x3f9e('0x3e')]['count'](_0x2d454a)[_0x3f9e('0x22')](function(_0x3ac67e){_0x4d9307['count']=_0x3ac67e;if(_0x1aa934[_0x3f9e('0x2d')]['includeAll']){_0x31e5a5[_0x3f9e('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x3f9e('0x40')](_0x31e5a5);})['then'](function(_0x309a14){_0x4d9307[_0x3f9e('0x41')]=_0x309a14;return _0x4d9307;})[_0x3f9e('0x22')](respondWithFilteredResult(_0x274ee1,_0x31e5a5))[_0x3f9e('0x42')](handleError(_0x274ee1,null));};exports['show']=function(_0x5c8992,_0x55b5f9){var _0x43cfc2={'raw':!![],'where':{'id':_0x5c8992['params']['id']}},_0x4172ad={};_0x4172ad[_0x3f9e('0x2c')]=_[_0x3f9e('0x2e')](db[_0x3f9e('0x3e')]['rawAttributes']);_0x4172ad['query']=_[_0x3f9e('0x2e')](_0x5c8992['query']);_0x4172ad['filters']=_['intersection'](_0x4172ad[_0x3f9e('0x2c')],_0x4172ad[_0x3f9e('0x2d')]);_0x43cfc2[_0x3f9e('0x31')]=_[_0x3f9e('0x30')](_0x4172ad[_0x3f9e('0x2c')],qs['fields'](_0x5c8992[_0x3f9e('0x2d')][_0x3f9e('0x32')]));_0x43cfc2[_0x3f9e('0x31')]=_0x43cfc2[_0x3f9e('0x31')][_0x3f9e('0x33')]?_0x43cfc2[_0x3f9e('0x31')]:_0x4172ad[_0x3f9e('0x2c')];if(_0x5c8992[_0x3f9e('0x2d')]['includeAll']){_0x43cfc2[_0x3f9e('0x3f')]=[{'all':!![]}];}_0x43cfc2=_[_0x3f9e('0x3b')]({},_0x43cfc2,_0x5c8992['options']);return db['FaxTransferReport']['find'](_0x43cfc2)[_0x3f9e('0x22')](handleEntityNotFound(_0x55b5f9,null))['then'](respondWithResult(_0x55b5f9,null))[_0x3f9e('0x42')](handleError(_0x55b5f9,null));};exports[_0x3f9e('0x43')]=function(_0x380c23,_0x4aa929){return db['FaxTransferReport'][_0x3f9e('0x43')](_0x380c23[_0x3f9e('0x44')],{})[_0x3f9e('0x22')](respondWithResult(_0x4aa929,0xc9))[_0x3f9e('0x42')](handleError(_0x4aa929,null));};exports[_0x3f9e('0x21')]=function(_0x3c3231,_0x16e487){if(_0x3c3231[_0x3f9e('0x44')]['id']){delete _0x3c3231['body']['id'];}return db['FaxTransferReport'][_0x3f9e('0x45')]({'where':{'id':_0x3c3231[_0x3f9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x16e487,null))[_0x3f9e('0x22')](saveUpdates(_0x3c3231[_0x3f9e('0x44')],null))[_0x3f9e('0x22')](respondWithResult(_0x16e487,null))[_0x3f9e('0x42')](handleError(_0x16e487,null));};exports[_0x3f9e('0x23')]=function(_0x5b4567,_0x3bb741){return db[_0x3f9e('0x3e')]['find']({'where':{'id':_0x5b4567[_0x3f9e('0x46')]['id']}})[_0x3f9e('0x22')](handleEntityNotFound(_0x3bb741,null))[_0x3f9e('0x22')](removeEntity(_0x3bb741,null))[_0x3f9e('0x42')](handleError(_0x3bb741,null));};exports[_0x3f9e('0x47')]=function(_0x3f89de,_0x5b8f62){return db[_0x3f9e('0x3e')]['describe']()[_0x3f9e('0x22')](respondWithResult(_0x5b8f62,null))[_0x3f9e('0x42')](handleError(_0x5b8f62,null));}; \ No newline at end of file +var _0x6683=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','include','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','update','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','FaxTransferReport','fieldName','type','key','model','query','intersection','attributes','fields','length'];(function(_0x564a3a,_0x49d35c){var _0x8193f9=function(_0x3dfe7d){while(--_0x3dfe7d){_0x564a3a['push'](_0x564a3a['shift']());}};_0x8193f9(++_0x49d35c);}(_0x6683,0x154));var _0x3668=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x6683[_0x2bbc07];return _0x6879e4;};'use strict';var emlformat=require(_0x3668('0x0'));var rimraf=require(_0x3668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3668('0x2'));var moment=require(_0x3668('0x3'));var BPromise=require(_0x3668('0x4'));var Mustache=require('mustache');var util=require(_0x3668('0x5'));var path=require(_0x3668('0x6'));var sox=require(_0x3668('0x7'));var csv=require(_0x3668('0x8'));var ejs=require(_0x3668('0x9'));var fs=require('fs');var fs_extra=require(_0x3668('0xa'));var _=require(_0x3668('0xb'));var squel=require(_0x3668('0xc'));var crypto=require(_0x3668('0xd'));var jsforce=require(_0x3668('0xe'));var deskjs=require(_0x3668('0xf'));var toCsv=require(_0x3668('0x8'));var querystring=require(_0x3668('0x10'));var Papa=require(_0x3668('0x11'));var Redis=require(_0x3668('0x12'));var authService=require(_0x3668('0x13'));var qs=require(_0x3668('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3668('0x15'));var logger=require(_0x3668('0x16'))(_0x3668('0x17'));var utils=require(_0x3668('0x18'));var config=require(_0x3668('0x19'));var licenseUtil=require(_0x3668('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465453,_0x272401){_0x272401=_0x272401||0xcc;return function(_0x1fc1a3){if(_0x1fc1a3){return _0x465453[_0x3668('0x1b')](_0x272401);}return _0x465453[_0x3668('0x1c')](_0x272401)[_0x3668('0x1d')]();};}function respondWithResult(_0x5f9e67,_0x51b1ad){_0x51b1ad=_0x51b1ad||0xc8;return function(_0x4da748){if(_0x4da748){return _0x5f9e67[_0x3668('0x1c')](_0x51b1ad)[_0x3668('0x1e')](_0x4da748);}};}function respondWithFilteredResult(_0x43a094,_0x518d3e){return function(_0x21de31){if(_0x21de31){var _0x236f1e=typeof _0x518d3e[_0x3668('0x1f')]==='undefined'&&typeof _0x518d3e[_0x3668('0x20')]===_0x3668('0x21');var _0x40eec6=_0x21de31['count'];var _0x4d9083=_0x236f1e?0x0:_0x518d3e[_0x3668('0x1f')];var _0x4ae3f3=_0x236f1e?_0x21de31['count']:_0x518d3e[_0x3668('0x1f')]+_0x518d3e['limit'];var _0x548deb;if(_0x4ae3f3>=_0x40eec6){_0x4ae3f3=_0x40eec6;_0x548deb=0xc8;}else{_0x548deb=0xce;}_0x43a094[_0x3668('0x1c')](_0x548deb);return _0x43a094[_0x3668('0x22')](_0x3668('0x23'),_0x4d9083+'-'+_0x4ae3f3+'/'+_0x40eec6)[_0x3668('0x1e')](_0x21de31);}return null;};}function patchUpdates(_0x398c2a){return function(_0x16f7b2){try{jsonpatch[_0x3668('0x24')](_0x16f7b2,_0x398c2a,!![]);}catch(_0x3ed688){return BPromise[_0x3668('0x25')](_0x3ed688);}return _0x16f7b2['save']();};}function saveUpdates(_0x557777,_0x376920){return function(_0x211310){if(_0x211310){return _0x211310['update'](_0x557777)[_0x3668('0x26')](function(_0xefe0de){return _0xefe0de;});}return null;};}function removeEntity(_0x47b720,_0x276faa){return function(_0x2c7347){if(_0x2c7347){return _0x2c7347[_0x3668('0x27')]()[_0x3668('0x26')](function(){_0x47b720[_0x3668('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0569,_0xea4717){return function(_0x674c60){if(!_0x674c60){_0x3d0569[_0x3668('0x1b')](0x194);}return _0x674c60;};}function handleError(_0x343f0d,_0x292e77){_0x292e77=_0x292e77||0x1f4;return function(_0xe1bbfd){logger[_0x3668('0x28')](_0xe1bbfd[_0x3668('0x29')]);if(_0xe1bbfd[_0x3668('0x2a')]){delete _0xe1bbfd['name'];}_0x343f0d[_0x3668('0x1c')](_0x292e77)[_0x3668('0x2b')](_0xe1bbfd);};}exports['index']=function(_0x1e9088,_0x26ea8f){var _0x5039bc={},_0x4e91d5={},_0x4bd200={'count':0x0,'rows':[]};var _0x3e64fd=_[_0x3668('0x2c')](db[_0x3668('0x2d')]['rawAttributes'],function(_0x1106a8){return{'name':_0x1106a8[_0x3668('0x2e')],'type':_0x1106a8[_0x3668('0x2f')][_0x3668('0x30')]};});_0x4e91d5[_0x3668('0x31')]=_['map'](_0x3e64fd,_0x3668('0x2a'));_0x4e91d5[_0x3668('0x32')]=_['keys'](_0x1e9088[_0x3668('0x32')]);_0x4e91d5['filters']=_[_0x3668('0x33')](_0x4e91d5[_0x3668('0x31')],_0x4e91d5['query']);_0x5039bc[_0x3668('0x34')]=_[_0x3668('0x33')](_0x4e91d5['model'],qs[_0x3668('0x35')](_0x1e9088[_0x3668('0x32')]['fields']));_0x5039bc[_0x3668('0x34')]=_0x5039bc[_0x3668('0x34')][_0x3668('0x36')]?_0x5039bc['attributes']:_0x4e91d5[_0x3668('0x31')];if(!_0x1e9088[_0x3668('0x32')][_0x3668('0x37')](_0x3668('0x38'))){_0x5039bc[_0x3668('0x20')]=qs[_0x3668('0x20')](_0x1e9088['query'][_0x3668('0x20')]);_0x5039bc['offset']=qs[_0x3668('0x1f')](_0x1e9088['query'][_0x3668('0x1f')]);}_0x5039bc[_0x3668('0x39')]=qs[_0x3668('0x3a')](_0x1e9088['query'][_0x3668('0x3a')]);_0x5039bc[_0x3668('0x3b')]=qs[_0x3668('0x3c')](_[_0x3668('0x3d')](_0x1e9088[_0x3668('0x32')],_0x4e91d5['filters']),_0x3e64fd);if(_0x1e9088[_0x3668('0x32')][_0x3668('0x3e')]){_0x5039bc[_0x3668('0x3b')]=_[_0x3668('0x3f')](_0x5039bc[_0x3668('0x3b')],{'$or':_[_0x3668('0x2c')](_0x3e64fd,function(_0x35261d){if(_0x35261d[_0x3668('0x2f')]!=='VIRTUAL'){var _0x2cad95={};_0x2cad95[_0x35261d['name']]={'$like':'%'+_0x1e9088[_0x3668('0x32')][_0x3668('0x3e')]+'%'};return _0x2cad95;}})});}_0x5039bc=_['merge']({},_0x5039bc,_0x1e9088[_0x3668('0x40')]);var _0x12dd0e={'where':_0x5039bc[_0x3668('0x3b')]};return db[_0x3668('0x2d')][_0x3668('0x41')](_0x12dd0e)[_0x3668('0x26')](function(_0x1a6e02){_0x4bd200[_0x3668('0x41')]=_0x1a6e02;if(_0x1e9088[_0x3668('0x32')]['includeAll']){_0x5039bc[_0x3668('0x42')]=[{'all':!![]}];}return db[_0x3668('0x2d')]['findAll'](_0x5039bc);})[_0x3668('0x26')](function(_0x4f8ef9){_0x4bd200[_0x3668('0x43')]=_0x4f8ef9;return _0x4bd200;})[_0x3668('0x26')](respondWithFilteredResult(_0x26ea8f,_0x5039bc))[_0x3668('0x44')](handleError(_0x26ea8f,null));};exports[_0x3668('0x45')]=function(_0x219bd0,_0x366673){var _0x2c7904={'raw':!![],'where':{'id':_0x219bd0[_0x3668('0x46')]['id']}},_0xe40ec3={};_0xe40ec3[_0x3668('0x31')]=_[_0x3668('0x47')](db[_0x3668('0x2d')][_0x3668('0x48')]);_0xe40ec3['query']=_[_0x3668('0x47')](_0x219bd0['query']);_0xe40ec3[_0x3668('0x3c')]=_[_0x3668('0x33')](_0xe40ec3['model'],_0xe40ec3[_0x3668('0x32')]);_0x2c7904[_0x3668('0x34')]=_['intersection'](_0xe40ec3[_0x3668('0x31')],qs[_0x3668('0x35')](_0x219bd0[_0x3668('0x32')][_0x3668('0x35')]));_0x2c7904[_0x3668('0x34')]=_0x2c7904[_0x3668('0x34')][_0x3668('0x36')]?_0x2c7904[_0x3668('0x34')]:_0xe40ec3[_0x3668('0x31')];if(_0x219bd0[_0x3668('0x32')][_0x3668('0x49')]){_0x2c7904[_0x3668('0x42')]=[{'all':!![]}];}_0x2c7904=_[_0x3668('0x3f')]({},_0x2c7904,_0x219bd0['options']);return db['FaxTransferReport']['find'](_0x2c7904)[_0x3668('0x26')](handleEntityNotFound(_0x366673,null))[_0x3668('0x26')](respondWithResult(_0x366673,null))[_0x3668('0x44')](handleError(_0x366673,null));};exports[_0x3668('0x4a')]=function(_0x327d7c,_0xf52b1a){return db[_0x3668('0x2d')][_0x3668('0x4a')](_0x327d7c[_0x3668('0x4b')],{})[_0x3668('0x26')](respondWithResult(_0xf52b1a,0xc9))[_0x3668('0x44')](handleError(_0xf52b1a,null));};exports[_0x3668('0x4c')]=function(_0x15b685,_0x59cf26){if(_0x15b685[_0x3668('0x4b')]['id']){delete _0x15b685['body']['id'];}return db[_0x3668('0x2d')][_0x3668('0x4d')]({'where':{'id':_0x15b685['params']['id']}})['then'](handleEntityNotFound(_0x59cf26,null))['then'](saveUpdates(_0x15b685[_0x3668('0x4b')],null))[_0x3668('0x26')](respondWithResult(_0x59cf26,null))[_0x3668('0x44')](handleError(_0x59cf26,null));};exports[_0x3668('0x27')]=function(_0x3b96d1,_0x161947){return db[_0x3668('0x2d')][_0x3668('0x4d')]({'where':{'id':_0x3b96d1['params']['id']}})[_0x3668('0x26')](handleEntityNotFound(_0x161947,null))[_0x3668('0x26')](removeEntity(_0x161947,null))['catch'](handleError(_0x161947,null));};exports['describe']=function(_0x2fe788,_0x54736d){return db[_0x3668('0x2d')][_0x3668('0x4e')]()[_0x3668('0x26')](respondWithResult(_0x54736d,null))[_0x3668('0x44')](handleError(_0x54736d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7df349b..85c73fe 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 _0x9b0c=['rimraf','exports','define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa47835,_0x1c64cc){var _0x5817ae=function(_0x1f19f9){while(--_0x1f19f9){_0xa47835['push'](_0xa47835['shift']());}};_0x5817ae(++_0x1c64cc);}(_0x9b0c,0x138));var _0xc9b0=function(_0x428fb1,_0x45162e){_0x428fb1=_0x428fb1-0x0;var _0x4c3078=_0x9b0c[_0x428fb1];return _0x4c3078;};'use strict';var _=require('lodash');var util=require(_0xc9b0('0x0'));var logger=require(_0xc9b0('0x1'))(_0xc9b0('0x2'));var moment=require(_0xc9b0('0x3'));var BPromise=require(_0xc9b0('0x4'));var rp=require(_0xc9b0('0x5'));var fs=require('fs');var path=require(_0xc9b0('0x6'));var rimraf=require(_0xc9b0('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xc9b0('0x8')]=function(_0x5017a9,_0x28df2d){return _0x5017a9[_0xc9b0('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc9b0('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd14=['path','../../config/environment','define','report_fax_transfer','uniqueid','../../config/logger','api','request-promise'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0xfd14,0x195));var _0x4fd1=function(_0x46ad37,_0x8e795){_0x46ad37=_0x46ad37-0x0;var _0x6927e3=_0xfd14[_0x46ad37];return _0x6927e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4fd1('0x0'))(_0x4fd1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fd1('0x2'));var fs=require('fs');var path=require(_0x4fd1('0x3'));var rimraf=require('rimraf');var config=require(_0x4fd1('0x4'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x294a09,_0x4ab501){return _0x294a09[_0x4fd1('0x5')]('FaxTransferReport',attributes,{'tableName':_0x4fd1('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4fd1('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 573c6aa..74df6bd 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 _0xe06e=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe06e,0x1d3));var _0xee06=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe06e[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xee06('0x0'));var util=require(_0xee06('0x1'));var moment=require(_0xee06('0x2'));var BPromise=require(_0xee06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee06('0x4'));var db=require(_0xee06('0x5'))['db'];var utils=require(_0xee06('0x6'));var logger=require(_0xee06('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee06('0x8'));var client=jayson[_0xee06('0x9')][_0xee06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f9ed1,_0x3621c5,_0x4d849c){return new BPromise(function(_0x3a0414,_0x38341b){return client[_0xee06('0xb')](_0x1f9ed1,_0x4d849c)['then'](function(_0x41b8be){logger[_0xee06('0xc')](_0xee06('0xd'),_0x3621c5,_0xee06('0xe'));logger[_0xee06('0xf')](_0xee06('0x10'),_0x3621c5,_0xee06('0xe'),JSON[_0xee06('0x11')](_0x41b8be));if(_0x41b8be['error']){if(_0x41b8be[_0xee06('0x12')][_0xee06('0x13')]===0x1f4){logger[_0xee06('0x12')](_0xee06('0xd'),_0x3621c5,_0x41b8be[_0xee06('0x12')][_0xee06('0x14')]);return _0x38341b(_0x41b8be['error'][_0xee06('0x14')]);}logger['error'](_0xee06('0xd'),_0x3621c5,_0x41b8be[_0xee06('0x12')][_0xee06('0x14')]);return _0x3a0414(_0x41b8be[_0xee06('0x12')][_0xee06('0x14')]);}else{logger[_0xee06('0xc')](_0xee06('0xd'),_0x3621c5,_0xee06('0xe'));_0x3a0414(_0x41b8be[_0xee06('0x15')]['message']);}})[_0xee06('0x16')](function(_0x13ee64){logger[_0xee06('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x3621c5,_0x13ee64);_0x38341b(_0x13ee64);});});} \ No newline at end of file +var _0x5e92=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x39f559,_0x2ad5bc){var _0x359a88=function(_0x54598e){while(--_0x54598e){_0x39f559['push'](_0x39f559['shift']());}};_0x359a88(++_0x2ad5bc);}(_0x5e92,0xbb));var _0x25e9=function(_0x177e76,_0x58849b){_0x177e76=_0x177e76-0x0;var _0x30d292=_0x5e92[_0x177e76];return _0x30d292;};'use strict';var _=require(_0x25e9('0x0'));var util=require(_0x25e9('0x1'));var moment=require(_0x25e9('0x2'));var BPromise=require(_0x25e9('0x3'));var rs=require(_0x25e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25e9('0x5'))['db'];var utils=require(_0x25e9('0x6'));var logger=require(_0x25e9('0x7'))(_0x25e9('0x8'));var config=require(_0x25e9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x25e9('0xa')][_0x25e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249805,_0x406d8c,_0x2ca23d){return new BPromise(function(_0x4d175e,_0x4dde4c){return client[_0x25e9('0xc')](_0x249805,_0x2ca23d)[_0x25e9('0xd')](function(_0x49016d){logger[_0x25e9('0xe')](_0x25e9('0xf'),_0x406d8c,_0x25e9('0x10'));logger[_0x25e9('0x11')](_0x25e9('0x12'),_0x406d8c,_0x25e9('0x10'),JSON[_0x25e9('0x13')](_0x49016d));if(_0x49016d[_0x25e9('0x14')]){if(_0x49016d[_0x25e9('0x14')]['code']===0x1f4){logger[_0x25e9('0x14')](_0x25e9('0xf'),_0x406d8c,_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);return _0x4dde4c(_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);}logger[_0x25e9('0x14')](_0x25e9('0xf'),_0x406d8c,_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);return _0x4d175e(_0x49016d[_0x25e9('0x14')][_0x25e9('0x15')]);}else{logger['info'](_0x25e9('0xf'),_0x406d8c,_0x25e9('0x10'));_0x4d175e(_0x49016d[_0x25e9('0x16')][_0x25e9('0x15')]);}})[_0x25e9('0x17')](function(_0x1bfa1a){logger[_0x25e9('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x406d8c,_0x1bfa1a);_0x4dde4c(_0x1bfa1a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 944217e..1f792bc 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 _0xdcb1=['../../components/interaction/service','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34824b,_0x12c656){var _0x5be23a=function(_0x97ad02){while(--_0x97ad02){_0x34824b['push'](_0x34824b['shift']());}};_0x5be23a(++_0x12c656);}(_0xdcb1,0xca));var _0x1dcb=function(_0x343c7b,_0x460f2c){_0x343c7b=_0x343c7b-0x0;var _0x8fdb57=_0xdcb1[_0x343c7b];return _0x8fdb57;};'use strict';var multer=require(_0x1dcb('0x0'));var util=require(_0x1dcb('0x1'));var path=require(_0x1dcb('0x2'));var timeout=require(_0x1dcb('0x3'));var express=require(_0x1dcb('0x4'));var router=express[_0x1dcb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1dcb('0x6'));var interaction=require(_0x1dcb('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x1dcb('0x8')](),controller[_0x1dcb('0x9')]);router['get']('/describe',auth[_0x1dcb('0x8')](),controller[_0x1dcb('0xa')]);router['get'](_0x1dcb('0xb'),auth[_0x1dcb('0x8')](),controller[_0x1dcb('0xc')]);router[_0x1dcb('0xd')]('/',auth[_0x1dcb('0x8')](),controller[_0x1dcb('0xe')]);router[_0x1dcb('0xf')](_0x1dcb('0xb'),auth[_0x1dcb('0x8')](),controller[_0x1dcb('0x10')]);router[_0x1dcb('0x11')](_0x1dcb('0xb'),auth[_0x1dcb('0x8')](),controller[_0x1dcb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7f7f=['express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','delete','exports','util','connect-timeout'];(function(_0x3b208d,_0x414cf8){var _0x2a968f=function(_0x243a4b){while(--_0x243a4b){_0x3b208d['push'](_0x3b208d['shift']());}};_0x2a968f(++_0x414cf8);}(_0x7f7f,0xfe));var _0xf7f7=function(_0x36b761,_0x3388c4){_0x36b761=_0x36b761-0x0;var _0x1cbe82=_0x7f7f[_0x36b761];return _0x1cbe82;};'use strict';var multer=require('multer');var util=require(_0xf7f7('0x0'));var path=require('path');var timeout=require(_0xf7f7('0x1'));var express=require(_0xf7f7('0x2'));var router=express[_0xf7f7('0x3')]();var fs_extra=require(_0xf7f7('0x4'));var auth=require(_0xf7f7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7f7('0x6'));router[_0xf7f7('0x7')]('/',auth[_0xf7f7('0x8')](),controller[_0xf7f7('0x9')]);router['get'](_0xf7f7('0xa'),auth[_0xf7f7('0x8')](),controller[_0xf7f7('0xb')]);router['get'](_0xf7f7('0xc'),auth[_0xf7f7('0x8')](),controller['show']);router[_0xf7f7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf7f7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf7f7('0xe')](_0xf7f7('0xc'),auth[_0xf7f7('0x8')](),controller['destroy']);module[_0xf7f7('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 769586e..e5f509e 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 _0x30cf=['post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xd1aae2,_0x2ebd3f){var _0x58531c=function(_0x5a8660){while(--_0x5a8660){_0xd1aae2['push'](_0xd1aae2['shift']());}};_0x58531c(++_0x2ebd3f);}(_0x30cf,0xd9));var _0xf30c=function(_0x13fdd6,_0xc9b988){_0x13fdd6=_0x13fdd6-0x0;var _0x3f3e33=_0x30cf[_0x13fdd6];return _0x3f3e33;};'use strict';var multer=require(_0xf30c('0x0'));var util=require(_0xf30c('0x1'));var path=require('path');var timeout=require(_0xf30c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf30c('0x3'));var config=require(_0xf30c('0x4'));var controller=require(_0xf30c('0x5'));router[_0xf30c('0x6')]('/',auth[_0xf30c('0x7')](),controller['index']);router[_0xf30c('0x6')](_0xf30c('0x8'),auth[_0xf30c('0x7')](),controller[_0xf30c('0x9')]);router['get'](_0xf30c('0xa'),auth[_0xf30c('0x7')](),controller[_0xf30c('0xb')]);router[_0xf30c('0x6')](_0xf30c('0xc'),auth[_0xf30c('0x7')](),controller[_0xf30c('0xd')]);router[_0xf30c('0xe')]('/',auth[_0xf30c('0x7')](),controller[_0xf30c('0xf')]);router[_0xf30c('0xe')](_0xf30c('0xa'),auth[_0xf30c('0x7')](),controller[_0xf30c('0x10')]);router[_0xf30c('0x11')]('/:id',auth[_0xf30c('0x7')](),controller[_0xf30c('0x12')]);router[_0xf30c('0x13')](_0xf30c('0x8'),auth[_0xf30c('0x7')](),controller[_0xf30c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7ec0=['isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x4caeab,_0x5177c9){var _0x1ed98d=function(_0x5d404d){while(--_0x5d404d){_0x4caeab['push'](_0x4caeab['shift']());}};_0x1ed98d(++_0x5177c9);}(_0x7ec0,0xca));var _0x07ec=function(_0x527a09,_0x1f8707){_0x527a09=_0x527a09-0x0;var _0x247ba4=_0x7ec0[_0x527a09];return _0x247ba4;};'use strict';var multer=require(_0x07ec('0x0'));var util=require(_0x07ec('0x1'));var path=require(_0x07ec('0x2'));var timeout=require(_0x07ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07ec('0x4'));var interaction=require(_0x07ec('0x5'));var config=require('../../config/environment');var controller=require(_0x07ec('0x6'));router[_0x07ec('0x7')]('/',auth[_0x07ec('0x8')](),controller[_0x07ec('0x9')]);router['get']('/:id',auth[_0x07ec('0x8')](),controller[_0x07ec('0xa')]);router[_0x07ec('0x7')](_0x07ec('0xb'),auth[_0x07ec('0x8')](),controller[_0x07ec('0xc')]);router[_0x07ec('0x7')]('/:id/fields',auth[_0x07ec('0x8')](),controller[_0x07ec('0xd')]);router[_0x07ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x07ec('0xf')]);router[_0x07ec('0xe')](_0x07ec('0xb'),auth[_0x07ec('0x8')](),controller['addConfiguration']);router[_0x07ec('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x07ec('0x11')]);router[_0x07ec('0x12')]('/:id',auth[_0x07ec('0x8')](),controller[_0x07ec('0x13')]);module[_0x07ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0421d19..e9a1c98 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 _0x2dfa=['STRING','basic','ENUM','integrationTab','exports'];(function(_0x1983e8,_0x225f04){var _0x3fe358=function(_0x1872cc){while(--_0x1872cc){_0x1983e8['push'](_0x1983e8['shift']());}};_0x3fe358(++_0x225f04);}(_0x2dfa,0x9a));var _0xa2df=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2dfa[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xa2df('0x0')]={'name':{'type':Sequelize[_0xa2df('0x1')]},'description':{'type':Sequelize[_0xa2df('0x1')]},'username':{'type':Sequelize[_0xa2df('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xa2df('0x2')},'password':{'type':Sequelize[_0xa2df('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa2df('0x1')]},'token':{'type':Sequelize[_0xa2df('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa2df('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa2df('0x3')](_0xa2df('0x4'),'newTab'),'defaultValue':_0xa2df('0x4')}}; \ No newline at end of file +var _0x4b26=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x3651fb,_0x4e40ca){var _0x57ff19=function(_0x3c172b){while(--_0x3c172b){_0x3651fb['push'](_0x3651fb['shift']());}};_0x57ff19(++_0x4e40ca);}(_0x4b26,0x142));var _0x64b2=function(_0x33223a,_0x2fff49){_0x33223a=_0x33223a-0x0;var _0x56906a=_0x4b26[_0x33223a];return _0x56906a;};'use strict';var Sequelize=require(_0x64b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x64b2('0x1')]},'description':{'type':Sequelize[_0x64b2('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x64b2('0x1')]},'authType':{'type':Sequelize[_0x64b2('0x2')](_0x64b2('0x3')),'defaultValue':_0x64b2('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x64b2('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x64b2('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x64b2('0x4'),_0x64b2('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 4f6c9f6..4116cd1 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 _0x1e9f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','query','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','fields','include','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getDescriptions','channel','DeskField','Subjects','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x1e9f,0x15f));var _0xf1e9=function(_0x3c14de,_0x3982e1){_0x3c14de=_0x3c14de-0x0;var _0x358226=_0x1e9f[_0x3c14de];return _0x358226;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1e9('0x0'));var zipdir=require(_0xf1e9('0x1'));var jsonpatch=require(_0xf1e9('0x2'));var rp=require(_0xf1e9('0x3'));var moment=require(_0xf1e9('0x4'));var BPromise=require(_0xf1e9('0x5'));var Mustache=require('mustache');var util=require(_0xf1e9('0x6'));var path=require(_0xf1e9('0x7'));var sox=require(_0xf1e9('0x8'));var csv=require(_0xf1e9('0x9'));var ejs=require(_0xf1e9('0xa'));var fs=require('fs');var fs_extra=require(_0xf1e9('0xb'));var _=require('lodash');var squel=require(_0xf1e9('0xc'));var crypto=require(_0xf1e9('0xd'));var jsforce=require(_0xf1e9('0xe'));var deskjs=require(_0xf1e9('0xf'));var toCsv=require(_0xf1e9('0x9'));var querystring=require('querystring');var Papa=require(_0xf1e9('0x10'));var Redis=require(_0xf1e9('0x11'));var authService=require(_0xf1e9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf1e9('0x13'));var hardwareService=require(_0xf1e9('0x14'));var logger=require(_0xf1e9('0x15'))(_0xf1e9('0x16'));var utils=require(_0xf1e9('0x17'));var config=require(_0xf1e9('0x18'));var licenseUtil=require(_0xf1e9('0x19'));var db=require(_0xf1e9('0x1a'))['db'];var integrations=require(_0xf1e9('0x1b'));function respondWithStatusCode(_0x25fd38,_0x72f17c){_0x72f17c=_0x72f17c||0xcc;return function(_0x2c54fe){if(_0x2c54fe){return _0x25fd38[_0xf1e9('0x1c')](_0x72f17c);}return _0x25fd38[_0xf1e9('0x1d')](_0x72f17c)[_0xf1e9('0x1e')]();};}function respondWithResult(_0x298a80,_0x5effd1){_0x5effd1=_0x5effd1||0xc8;return function(_0x132cf1){if(_0x132cf1){return _0x298a80[_0xf1e9('0x1d')](_0x5effd1)[_0xf1e9('0x1f')](_0x132cf1);}};}function respondWithFilteredResult(_0x5a9188,_0x3d7b67){return function(_0x2b3063){if(_0x2b3063){var _0x1bd440=typeof _0x3d7b67['offset']===_0xf1e9('0x20')&&typeof _0x3d7b67['limit']===_0xf1e9('0x20');var _0x46bd70=_0x2b3063['count'];var _0x18e7c=_0x1bd440?0x0:_0x3d7b67[_0xf1e9('0x21')];var _0x39648a=_0x1bd440?_0x2b3063[_0xf1e9('0x22')]:_0x3d7b67[_0xf1e9('0x21')]+_0x3d7b67[_0xf1e9('0x23')];var _0x2e2fc3;if(_0x39648a>=_0x46bd70){_0x39648a=_0x46bd70;_0x2e2fc3=0xc8;}else{_0x2e2fc3=0xce;}_0x5a9188['status'](_0x2e2fc3);return _0x5a9188[_0xf1e9('0x24')](_0xf1e9('0x25'),_0x18e7c+'-'+_0x39648a+'/'+_0x46bd70)[_0xf1e9('0x1f')](_0x2b3063);}return null;};}function patchUpdates(_0x5c9817){return function(_0x57b2ce){try{jsonpatch['apply'](_0x57b2ce,_0x5c9817,!![]);}catch(_0x15f189){return BPromise[_0xf1e9('0x26')](_0x15f189);}return _0x57b2ce[_0xf1e9('0x27')]();};}function saveUpdates(_0x4a8af9,_0x3759b9){return function(_0x331884){if(_0x331884){return _0x331884[_0xf1e9('0x28')](_0x4a8af9)['then'](function(_0x4e965e){return _0x4e965e;});}return null;};}function removeEntity(_0x4c57fb,_0x2e43aa){return function(_0x408d84){if(_0x408d84){return _0x408d84[_0xf1e9('0x29')]()[_0xf1e9('0x2a')](function(){_0x4c57fb[_0xf1e9('0x1d')](0xcc)[_0xf1e9('0x1e')]();});}};}function handleEntityNotFound(_0x4160b1,_0x184400){return function(_0x3255e9){if(!_0x3255e9){_0x4160b1[_0xf1e9('0x1c')](0x194);}return _0x3255e9;};}function handleError(_0x413b98,_0x280f71){_0x280f71=_0x280f71||0x1f4;return function(_0x166b02){logger['error'](_0x166b02[_0xf1e9('0x2b')]);if(_0x166b02[_0xf1e9('0x2c')]){delete _0x166b02[_0xf1e9('0x2c')];}_0x413b98[_0xf1e9('0x1d')](_0x280f71)[_0xf1e9('0x2d')](_0x166b02);};}exports[_0xf1e9('0x2e')]=function(_0x2c943e,_0x1a2d7f){var _0x1cf548={},_0xfab6c7={},_0x12c7b5={'count':0x0,'rows':[]};var _0x2dc315=_['map'](db[_0xf1e9('0x2f')][_0xf1e9('0x30')],function(_0x19373e){return{'name':_0x19373e[_0xf1e9('0x31')],'type':_0x19373e[_0xf1e9('0x32')]['key']};});_0xfab6c7['model']=_['map'](_0x2dc315,_0xf1e9('0x2c'));_0xfab6c7[_0xf1e9('0x33')]=_['keys'](_0x2c943e[_0xf1e9('0x33')]);_0xfab6c7['filters']=_[_0xf1e9('0x34')](_0xfab6c7['model'],_0xfab6c7[_0xf1e9('0x33')]);_0x1cf548[_0xf1e9('0x35')]=_[_0xf1e9('0x34')](_0xfab6c7['model'],qs['fields'](_0x2c943e[_0xf1e9('0x33')]['fields']));_0x1cf548[_0xf1e9('0x35')]=_0x1cf548[_0xf1e9('0x35')][_0xf1e9('0x36')]?_0x1cf548['attributes']:_0xfab6c7[_0xf1e9('0x37')];if(!_0x2c943e['query'][_0xf1e9('0x38')](_0xf1e9('0x39'))){_0x1cf548[_0xf1e9('0x23')]=qs[_0xf1e9('0x23')](_0x2c943e[_0xf1e9('0x33')][_0xf1e9('0x23')]);_0x1cf548[_0xf1e9('0x21')]=qs['offset'](_0x2c943e[_0xf1e9('0x33')][_0xf1e9('0x21')]);}_0x1cf548[_0xf1e9('0x3a')]=qs['sort'](_0x2c943e[_0xf1e9('0x33')][_0xf1e9('0x3b')]);_0x1cf548[_0xf1e9('0x3c')]=qs[_0xf1e9('0x3d')](_[_0xf1e9('0x3e')](_0x2c943e[_0xf1e9('0x33')],_0xfab6c7['filters']),_0x2dc315);if(_0x2c943e['query']['filter']){_0x1cf548['where']=_[_0xf1e9('0x3f')](_0x1cf548['where'],{'$or':_[_0xf1e9('0x40')](_0x2dc315,function(_0x22857a){if(_0x22857a[_0xf1e9('0x32')]!==_0xf1e9('0x41')){var _0x18d2f8={};_0x18d2f8[_0x22857a[_0xf1e9('0x2c')]]={'$like':'%'+_0x2c943e['query'][_0xf1e9('0x42')]+'%'};return _0x18d2f8;}})});}_0x1cf548=_['merge']({},_0x1cf548,_0x2c943e[_0xf1e9('0x43')]);var _0xf6c444={'where':_0x1cf548[_0xf1e9('0x3c')]};return db[_0xf1e9('0x2f')][_0xf1e9('0x22')](_0xf6c444)[_0xf1e9('0x2a')](function(_0x563c6f){_0x12c7b5[_0xf1e9('0x22')]=_0x563c6f;if(_0x2c943e['query'][_0xf1e9('0x44')]){_0x1cf548['include']=[{'all':!![]}];}return db[_0xf1e9('0x2f')][_0xf1e9('0x45')](_0x1cf548);})[_0xf1e9('0x2a')](function(_0x553800){_0x12c7b5['rows']=_0x553800;return _0x12c7b5;})[_0xf1e9('0x2a')](respondWithFilteredResult(_0x1a2d7f,_0x1cf548))[_0xf1e9('0x46')](handleError(_0x1a2d7f,null));};exports[_0xf1e9('0x47')]=function(_0x2ca357,_0x47adc7){var _0x49ffab={'raw':![],'where':{'id':_0x2ca357[_0xf1e9('0x48')]['id']}},_0x253390={};_0x253390[_0xf1e9('0x37')]=_[_0xf1e9('0x49')](db[_0xf1e9('0x2f')]['rawAttributes']);_0x253390[_0xf1e9('0x33')]=_[_0xf1e9('0x49')](_0x2ca357[_0xf1e9('0x33')]);_0x253390[_0xf1e9('0x3d')]=_[_0xf1e9('0x34')](_0x253390['model'],_0x253390[_0xf1e9('0x33')]);_0x49ffab[_0xf1e9('0x35')]=_[_0xf1e9('0x34')](_0x253390[_0xf1e9('0x37')],qs[_0xf1e9('0x4a')](_0x2ca357[_0xf1e9('0x33')][_0xf1e9('0x4a')]));_0x49ffab[_0xf1e9('0x35')]=_0x49ffab[_0xf1e9('0x35')][_0xf1e9('0x36')]?_0x49ffab[_0xf1e9('0x35')]:_0x253390[_0xf1e9('0x37')];if(_0x2ca357['query'][_0xf1e9('0x44')]){_0x49ffab[_0xf1e9('0x4b')]=[{'all':!![]}];}_0x49ffab=_[_0xf1e9('0x3f')]({},_0x49ffab,_0x2ca357[_0xf1e9('0x43')]);return db['DeskAccount'][_0xf1e9('0x4c')](_0x49ffab)[_0xf1e9('0x2a')](handleEntityNotFound(_0x47adc7,null))[_0xf1e9('0x2a')](respondWithResult(_0x47adc7,null))['catch'](handleError(_0x47adc7,null));};exports[_0xf1e9('0x4d')]=function(_0x16092f,_0x34a74c){return db['DeskAccount']['create'](_0x16092f[_0xf1e9('0x4e')],{})[_0xf1e9('0x2a')](respondWithResult(_0x34a74c,0xc9))[_0xf1e9('0x46')](handleError(_0x34a74c,null));};exports[_0xf1e9('0x28')]=function(_0x539120,_0x1b1f88){if(_0x539120[_0xf1e9('0x4e')]['id']){delete _0x539120[_0xf1e9('0x4e')]['id'];}return db[_0xf1e9('0x2f')]['find']({'where':{'id':_0x539120[_0xf1e9('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b1f88,null))[_0xf1e9('0x2a')](saveUpdates(_0x539120[_0xf1e9('0x4e')],null))[_0xf1e9('0x2a')](respondWithResult(_0x1b1f88,null))['catch'](handleError(_0x1b1f88,null));};exports[_0xf1e9('0x29')]=function(_0x274262,_0x489755){return db['DeskAccount'][_0xf1e9('0x4c')]({'where':{'id':_0x274262['params']['id']}})[_0xf1e9('0x2a')](handleEntityNotFound(_0x489755,null))[_0xf1e9('0x2a')](removeEntity(_0x489755,null))['catch'](handleError(_0x489755,null));};exports[_0xf1e9('0x4f')]=function(_0x5015b2,_0x46cd00,_0x2960a3){var _0x2cffc3={};var _0x590f00={};var _0x4c8f54;var _0x2ee17d;return db[_0xf1e9('0x2f')][_0xf1e9('0x50')]({'where':{'id':_0x5015b2['params']['id']}})[_0xf1e9('0x2a')](handleEntityNotFound(_0x46cd00,null))['then'](function(_0xf05c6e){if(_0xf05c6e){_0x4c8f54=_0xf05c6e;_0x590f00[_0xf1e9('0x37')]=_[_0xf1e9('0x49')](db[_0xf1e9('0x51')][_0xf1e9('0x30')]);_0x590f00[_0xf1e9('0x33')]=_[_0xf1e9('0x49')](_0x5015b2[_0xf1e9('0x33')]);_0x590f00['filters']=_[_0xf1e9('0x34')](_0x590f00[_0xf1e9('0x37')],_0x590f00[_0xf1e9('0x33')]);_0x2cffc3['attributes']=_[_0xf1e9('0x34')](_0x590f00[_0xf1e9('0x37')],qs['fields'](_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x4a')]));_0x2cffc3[_0xf1e9('0x35')]=_0x2cffc3[_0xf1e9('0x35')][_0xf1e9('0x36')]?_0x2cffc3[_0xf1e9('0x35')]:_0x590f00[_0xf1e9('0x37')];_0x2cffc3[_0xf1e9('0x3a')]=qs['sort'](_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x3b')]);_0x2cffc3[_0xf1e9('0x3c')]=qs[_0xf1e9('0x3d')](_[_0xf1e9('0x3e')](_0x5015b2['query'],_0x590f00[_0xf1e9('0x3d')]));if(_0x5015b2[_0xf1e9('0x33')]['filter']){_0x2cffc3['where']=_[_0xf1e9('0x3f')](_0x2cffc3[_0xf1e9('0x3c')],{'$or':_['map'](_0x2cffc3[_0xf1e9('0x35')],function(_0x322550){var _0x23c4ca={};_0x23c4ca[_0x322550]={'$like':'%'+_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x42')]+'%'};return _0x23c4ca;})});}_0x2cffc3=_[_0xf1e9('0x3f')]({},_0x2cffc3,_0x5015b2['options']);return _0x4c8f54[_0xf1e9('0x4f')](_0x2cffc3);}})[_0xf1e9('0x2a')](function(_0x353d95){if(_0x353d95){_0x2ee17d=_0x353d95[_0xf1e9('0x36')];if(!_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x38')](_0xf1e9('0x39'))){_0x2cffc3[_0xf1e9('0x23')]=qs[_0xf1e9('0x23')](_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x23')]);_0x2cffc3[_0xf1e9('0x21')]=qs[_0xf1e9('0x21')](_0x5015b2[_0xf1e9('0x33')][_0xf1e9('0x21')]);}return _0x4c8f54[_0xf1e9('0x4f')](_0x2cffc3);}})[_0xf1e9('0x2a')](function(_0x116590){if(_0x116590){return _0x116590?{'count':_0x2ee17d,'rows':_0x116590}:null;}})[_0xf1e9('0x2a')](respondWithResult(_0x46cd00,null))[_0xf1e9('0x46')](handleError(_0x46cd00,null));};exports[_0xf1e9('0x52')]=function(_0x5ca29d,_0x29ab22,_0x2a276d){if(_0x5ca29d[_0xf1e9('0x4e')]['id']){delete _0x5ca29d['body']['id'];}return db[_0xf1e9('0x2f')]['findOne']({'where':{'id':_0x5ca29d[_0xf1e9('0x48')]['id']}})['then'](handleEntityNotFound(_0x29ab22,null))[_0xf1e9('0x2a')](function(_0x14a573){if(_0x14a573){_0x5ca29d[_0xf1e9('0x4e')][_0xf1e9('0x53')]=_0x14a573['id'];_0x5ca29d[_0xf1e9('0x4e')]['Subjects']=integrations['getSubjects'](_0x5ca29d[_0xf1e9('0x4e')]['channel'],_0x5ca29d['body']['type']);_0x5ca29d[_0xf1e9('0x4e')]['Descriptions']=integrations[_0xf1e9('0x54')](_0x5ca29d[_0xf1e9('0x4e')][_0xf1e9('0x55')],_0x5ca29d[_0xf1e9('0x4e')][_0xf1e9('0x32')]);return db['DeskConfiguration']['create'](_0x5ca29d[_0xf1e9('0x4e')],{'include':[{'model':db[_0xf1e9('0x56')],'as':_0xf1e9('0x57')},{'model':db[_0xf1e9('0x56')],'as':_0xf1e9('0x58')}]});}return null;})[_0xf1e9('0x2a')](respondWithResult(_0x29ab22,null))[_0xf1e9('0x46')](handleError(_0x29ab22,null));};exports['getFields']=function(_0x22a41e,_0x2be5f8,_0xbdeb64){var _0x596b64=[{'name':'priority','label':_0xf1e9('0x59'),'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 _0x4045a1='';return db[_0xf1e9('0x2f')]['findOne']({'where':{'id':_0x22a41e['params']['id']},'attributes':['id',_0xf1e9('0x5a'),_0xf1e9('0x5b'),_0xf1e9('0x5c'),_0xf1e9('0x5d'),_0xf1e9('0x5e'),_0xf1e9('0x5f'),'token',_0xf1e9('0x60')]})[_0xf1e9('0x2a')](handleEntityNotFound(_0x2be5f8,null))['then'](function(_0x1ccac5){if(_0x1ccac5){_0x4045a1=_0x1ccac5[_0xf1e9('0x5a')];var _0x225922=_0x4045a1[_0xf1e9('0x61')](-0x1);if(_0x225922==='/'){_0x4045a1=_0x4045a1[_0xf1e9('0x62')](0x0,_0x4045a1['lastIndexOf'](_0x225922));}var _0x57400a={'method':'GET','uri':util['format'](_0xf1e9('0x63'),_0x4045a1),'headers':{'Content-Type':'application/json','Accept':_0xf1e9('0x64')},'json':!![]};if(_0x1ccac5['authType']===_0xf1e9('0x65')){_0x57400a[_0xf1e9('0x66')]['Authorization']=util[_0xf1e9('0x67')](_0xf1e9('0x68'),new Buffer(util[_0xf1e9('0x67')](_0xf1e9('0x69'),_0x1ccac5[_0xf1e9('0x5c')],_0x1ccac5[_0xf1e9('0x5d')]))[_0xf1e9('0x6a')](_0xf1e9('0x6b')));}return rp(_0x57400a)[_0xf1e9('0x2a')](function(_0x2b1c7d){return _0x596b64[_0xf1e9('0x6c')](_[_0xf1e9('0x40')](_0x2b1c7d[_0xf1e9('0x6d')][_0xf1e9('0x6e')],function(_0x40fa85){return{'id':_0x40fa85[_0xf1e9('0x2c')],'name':_0x40fa85[_0xf1e9('0x2c')],'type':_0x40fa85[_0xf1e9('0x32')],'active':_0x40fa85[_0xf1e9('0x6f')],'label':_0x40fa85[_0xf1e9('0x70')],'custom':!![]};}));});}})[_0xf1e9('0x2a')](function(_0xe60fb6){return{'count':_0xe60fb6[_0xf1e9('0x36')],'rows':_0xe60fb6};})['then'](respondWithResult(_0x2be5f8,null))[_0xf1e9('0x46')](function(_0x972105){var _0xdd650b=_0x22a41e[_0xf1e9('0x33')][_0xf1e9('0x71')]?0x1f4:_0x972105['statusCode']||0x1f4;logger['error'](_0xf1e9('0x72'),'getFields',_0xdd650b,JSON[_0xf1e9('0x73')](_0x972105));delete _0x972105['name'];if(_0xdd650b===0x191){_0xdd650b=0x190;}_0x2be5f8[_0xf1e9('0x1d')](_0xdd650b)[_0xf1e9('0x2d')](_0x22a41e[_0xf1e9('0x33')][_0xf1e9('0x71')]?{'message':_0xf1e9('0x74'),'statusCode':_0x972105['statusCode']}:_0x972105);});}; \ No newline at end of file +var _0x2f5c=['undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','params','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','consumerKey','token','tokenSecret','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','%s:%s','password','concat','_embedded','label','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x502096,_0x61ad2f){var _0x4a86f4=function(_0xbae5c3){while(--_0xbae5c3){_0x502096['push'](_0x502096['shift']());}};_0x4a86f4(++_0x61ad2f);}(_0x2f5c,0x1a7));var _0xc2f5=function(_0xe519fc,_0x4b3e34){_0xe519fc=_0xe519fc-0x0;var _0x25811d=_0x2f5c[_0xe519fc];return _0x25811d;};'use strict';var emlformat=require(_0xc2f5('0x0'));var rimraf=require(_0xc2f5('0x1'));var zipdir=require(_0xc2f5('0x2'));var jsonpatch=require(_0xc2f5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc2f5('0x4'));var Mustache=require(_0xc2f5('0x5'));var util=require(_0xc2f5('0x6'));var path=require(_0xc2f5('0x7'));var sox=require(_0xc2f5('0x8'));var csv=require(_0xc2f5('0x9'));var ejs=require(_0xc2f5('0xa'));var fs=require('fs');var fs_extra=require(_0xc2f5('0xb'));var _=require('lodash');var squel=require(_0xc2f5('0xc'));var crypto=require(_0xc2f5('0xd'));var jsforce=require(_0xc2f5('0xe'));var deskjs=require(_0xc2f5('0xf'));var toCsv=require(_0xc2f5('0x9'));var querystring=require(_0xc2f5('0x10'));var Papa=require(_0xc2f5('0x11'));var Redis=require(_0xc2f5('0x12'));var authService=require(_0xc2f5('0x13'));var qs=require(_0xc2f5('0x14'));var as=require(_0xc2f5('0x15'));var hardwareService=require(_0xc2f5('0x16'));var logger=require(_0xc2f5('0x17'))(_0xc2f5('0x18'));var utils=require(_0xc2f5('0x19'));var config=require(_0xc2f5('0x1a'));var licenseUtil=require(_0xc2f5('0x1b'));var db=require(_0xc2f5('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x10d968,_0x1ca55b){_0x1ca55b=_0x1ca55b||0xcc;return function(_0x1adc14){if(_0x1adc14){return _0x10d968[_0xc2f5('0x1d')](_0x1ca55b);}return _0x10d968[_0xc2f5('0x1e')](_0x1ca55b)[_0xc2f5('0x1f')]();};}function respondWithResult(_0x107dc6,_0xf7c95d){_0xf7c95d=_0xf7c95d||0xc8;return function(_0xdbf0a5){if(_0xdbf0a5){return _0x107dc6['status'](_0xf7c95d)['json'](_0xdbf0a5);}};}function respondWithFilteredResult(_0x185f5c,_0x71cdff){return function(_0x5c2e0a){if(_0x5c2e0a){var _0x1f8122=typeof _0x71cdff[_0xc2f5('0x20')]===_0xc2f5('0x21')&&typeof _0x71cdff[_0xc2f5('0x22')]==='undefined';var _0x496c1f=_0x5c2e0a[_0xc2f5('0x23')];var _0x49b50a=_0x1f8122?0x0:_0x71cdff['offset'];var _0x1c0435=_0x1f8122?_0x5c2e0a[_0xc2f5('0x23')]:_0x71cdff['offset']+_0x71cdff[_0xc2f5('0x22')];var _0x38d6bf;if(_0x1c0435>=_0x496c1f){_0x1c0435=_0x496c1f;_0x38d6bf=0xc8;}else{_0x38d6bf=0xce;}_0x185f5c['status'](_0x38d6bf);return _0x185f5c[_0xc2f5('0x24')](_0xc2f5('0x25'),_0x49b50a+'-'+_0x1c0435+'/'+_0x496c1f)[_0xc2f5('0x26')](_0x5c2e0a);}return null;};}function patchUpdates(_0x4b2ca6){return function(_0x57f01d){try{jsonpatch['apply'](_0x57f01d,_0x4b2ca6,!![]);}catch(_0x5350e1){return BPromise[_0xc2f5('0x27')](_0x5350e1);}return _0x57f01d[_0xc2f5('0x28')]();};}function saveUpdates(_0x1375ce,_0x5a725f){return function(_0x233fc3){if(_0x233fc3){return _0x233fc3[_0xc2f5('0x29')](_0x1375ce)[_0xc2f5('0x2a')](function(_0x3da358){return _0x3da358;});}return null;};}function removeEntity(_0x44086d,_0x2570c1){return function(_0x5b6d5e){if(_0x5b6d5e){return _0x5b6d5e['destroy']()[_0xc2f5('0x2a')](function(){_0x44086d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x151964,_0x1668ef){return function(_0x3477cf){if(!_0x3477cf){_0x151964[_0xc2f5('0x1d')](0x194);}return _0x3477cf;};}function handleError(_0x5b2231,_0x13e205){_0x13e205=_0x13e205||0x1f4;return function(_0x561e2f){logger[_0xc2f5('0x2b')](_0x561e2f[_0xc2f5('0x2c')]);if(_0x561e2f[_0xc2f5('0x2d')]){delete _0x561e2f[_0xc2f5('0x2d')];}_0x5b2231['status'](_0x13e205)[_0xc2f5('0x2e')](_0x561e2f);};}exports[_0xc2f5('0x2f')]=function(_0x4bdd1a,_0x33c4f5){var _0x456ed4={},_0x558c8e={},_0x34d372={'count':0x0,'rows':[]};var _0x351ddd=_[_0xc2f5('0x30')](db[_0xc2f5('0x31')]['rawAttributes'],function(_0x13ebfd){return{'name':_0x13ebfd[_0xc2f5('0x32')],'type':_0x13ebfd[_0xc2f5('0x33')][_0xc2f5('0x34')]};});_0x558c8e[_0xc2f5('0x35')]=_[_0xc2f5('0x30')](_0x351ddd,_0xc2f5('0x2d'));_0x558c8e[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x4bdd1a['query']);_0x558c8e['filters']=_['intersection'](_0x558c8e['model'],_0x558c8e['query']);_0x456ed4[_0xc2f5('0x38')]=_[_0xc2f5('0x39')](_0x558c8e[_0xc2f5('0x35')],qs[_0xc2f5('0x3a')](_0x4bdd1a[_0xc2f5('0x36')]['fields']));_0x456ed4[_0xc2f5('0x38')]=_0x456ed4[_0xc2f5('0x38')][_0xc2f5('0x3b')]?_0x456ed4[_0xc2f5('0x38')]:_0x558c8e[_0xc2f5('0x35')];if(!_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x3c')](_0xc2f5('0x3d'))){_0x456ed4[_0xc2f5('0x22')]=qs[_0xc2f5('0x22')](_0x4bdd1a['query'][_0xc2f5('0x22')]);_0x456ed4[_0xc2f5('0x20')]=qs[_0xc2f5('0x20')](_0x4bdd1a[_0xc2f5('0x36')]['offset']);}_0x456ed4[_0xc2f5('0x3e')]=qs[_0xc2f5('0x3f')](_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x3f')]);_0x456ed4[_0xc2f5('0x40')]=qs[_0xc2f5('0x41')](_[_0xc2f5('0x42')](_0x4bdd1a[_0xc2f5('0x36')],_0x558c8e[_0xc2f5('0x41')]),_0x351ddd);if(_0x4bdd1a['query'][_0xc2f5('0x43')]){_0x456ed4[_0xc2f5('0x40')]=_['merge'](_0x456ed4[_0xc2f5('0x40')],{'$or':_[_0xc2f5('0x30')](_0x351ddd,function(_0x3cf1ff){if(_0x3cf1ff[_0xc2f5('0x33')]!=='VIRTUAL'){var _0x47c58b={};_0x47c58b[_0x3cf1ff[_0xc2f5('0x2d')]]={'$like':'%'+_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x43')]+'%'};return _0x47c58b;}})});}_0x456ed4=_[_0xc2f5('0x44')]({},_0x456ed4,_0x4bdd1a['options']);var _0x26be43={'where':_0x456ed4['where']};return db[_0xc2f5('0x31')][_0xc2f5('0x23')](_0x26be43)[_0xc2f5('0x2a')](function(_0x4d074a){_0x34d372[_0xc2f5('0x23')]=_0x4d074a;if(_0x4bdd1a[_0xc2f5('0x36')][_0xc2f5('0x45')]){_0x456ed4[_0xc2f5('0x46')]=[{'all':!![]}];}return db[_0xc2f5('0x31')][_0xc2f5('0x47')](_0x456ed4);})[_0xc2f5('0x2a')](function(_0x57c56a){_0x34d372['rows']=_0x57c56a;return _0x34d372;})[_0xc2f5('0x2a')](respondWithFilteredResult(_0x33c4f5,_0x456ed4))[_0xc2f5('0x48')](handleError(_0x33c4f5,null));};exports[_0xc2f5('0x49')]=function(_0x6c14b2,_0x4da524){var _0x2f966b={'raw':![],'where':{'id':_0x6c14b2['params']['id']}},_0x16ddc4={};_0x16ddc4[_0xc2f5('0x35')]=_[_0xc2f5('0x37')](db[_0xc2f5('0x31')][_0xc2f5('0x4a')]);_0x16ddc4[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x6c14b2[_0xc2f5('0x36')]);_0x16ddc4[_0xc2f5('0x41')]=_[_0xc2f5('0x39')](_0x16ddc4[_0xc2f5('0x35')],_0x16ddc4[_0xc2f5('0x36')]);_0x2f966b['attributes']=_[_0xc2f5('0x39')](_0x16ddc4['model'],qs[_0xc2f5('0x3a')](_0x6c14b2['query'][_0xc2f5('0x3a')]));_0x2f966b[_0xc2f5('0x38')]=_0x2f966b[_0xc2f5('0x38')][_0xc2f5('0x3b')]?_0x2f966b[_0xc2f5('0x38')]:_0x16ddc4['model'];if(_0x6c14b2['query'][_0xc2f5('0x45')]){_0x2f966b[_0xc2f5('0x46')]=[{'all':!![]}];}_0x2f966b=_[_0xc2f5('0x44')]({},_0x2f966b,_0x6c14b2[_0xc2f5('0x4b')]);return db[_0xc2f5('0x31')][_0xc2f5('0x4c')](_0x2f966b)['then'](handleEntityNotFound(_0x4da524,null))[_0xc2f5('0x2a')](respondWithResult(_0x4da524,null))[_0xc2f5('0x48')](handleError(_0x4da524,null));};exports[_0xc2f5('0x4d')]=function(_0x2fc91b,_0x476b7f){return db[_0xc2f5('0x31')][_0xc2f5('0x4d')](_0x2fc91b[_0xc2f5('0x4e')],{})[_0xc2f5('0x2a')](respondWithResult(_0x476b7f,0xc9))['catch'](handleError(_0x476b7f,null));};exports['update']=function(_0x3d5abc,_0x2a5325){if(_0x3d5abc[_0xc2f5('0x4e')]['id']){delete _0x3d5abc[_0xc2f5('0x4e')]['id'];}return db['DeskAccount'][_0xc2f5('0x4c')]({'where':{'id':_0x3d5abc[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x2a5325,null))[_0xc2f5('0x2a')](saveUpdates(_0x3d5abc['body'],null))[_0xc2f5('0x2a')](respondWithResult(_0x2a5325,null))[_0xc2f5('0x48')](handleError(_0x2a5325,null));};exports[_0xc2f5('0x50')]=function(_0x10f3e9,_0x49dadc){return db[_0xc2f5('0x31')][_0xc2f5('0x4c')]({'where':{'id':_0x10f3e9[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x49dadc,null))['then'](removeEntity(_0x49dadc,null))['catch'](handleError(_0x49dadc,null));};exports[_0xc2f5('0x51')]=function(_0x43c06d,_0x6179e0,_0x334932){var _0x307daa={};var _0x56baff={};var _0x3e73d6;var _0x39917d;return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x43c06d[_0xc2f5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6179e0,null))[_0xc2f5('0x2a')](function(_0x19d05d){if(_0x19d05d){_0x3e73d6=_0x19d05d;_0x56baff[_0xc2f5('0x35')]=_['keys'](db['DeskConfiguration'][_0xc2f5('0x4a')]);_0x56baff[_0xc2f5('0x36')]=_[_0xc2f5('0x37')](_0x43c06d['query']);_0x56baff[_0xc2f5('0x41')]=_[_0xc2f5('0x39')](_0x56baff[_0xc2f5('0x35')],_0x56baff[_0xc2f5('0x36')]);_0x307daa[_0xc2f5('0x38')]=_[_0xc2f5('0x39')](_0x56baff[_0xc2f5('0x35')],qs[_0xc2f5('0x3a')](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x3a')]));_0x307daa[_0xc2f5('0x38')]=_0x307daa[_0xc2f5('0x38')]['length']?_0x307daa[_0xc2f5('0x38')]:_0x56baff[_0xc2f5('0x35')];_0x307daa['order']=qs[_0xc2f5('0x3f')](_0x43c06d['query'][_0xc2f5('0x3f')]);_0x307daa[_0xc2f5('0x40')]=qs['filters'](_[_0xc2f5('0x42')](_0x43c06d[_0xc2f5('0x36')],_0x56baff[_0xc2f5('0x41')]));if(_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x43')]){_0x307daa['where']=_[_0xc2f5('0x44')](_0x307daa['where'],{'$or':_[_0xc2f5('0x30')](_0x307daa['attributes'],function(_0x5a0aef){var _0x23fc90={};_0x23fc90[_0x5a0aef]={'$like':'%'+_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x43')]+'%'};return _0x23fc90;})});}_0x307daa=_[_0xc2f5('0x44')]({},_0x307daa,_0x43c06d[_0xc2f5('0x4b')]);return _0x3e73d6[_0xc2f5('0x51')](_0x307daa);}})['then'](function(_0x63b5a0){if(_0x63b5a0){_0x39917d=_0x63b5a0[_0xc2f5('0x3b')];if(!_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x3c')](_0xc2f5('0x3d'))){_0x307daa[_0xc2f5('0x22')]=qs['limit'](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x22')]);_0x307daa['offset']=qs[_0xc2f5('0x20')](_0x43c06d[_0xc2f5('0x36')][_0xc2f5('0x20')]);}return _0x3e73d6[_0xc2f5('0x51')](_0x307daa);}})[_0xc2f5('0x2a')](function(_0x7d139f){if(_0x7d139f){return _0x7d139f?{'count':_0x39917d,'rows':_0x7d139f}:null;}})[_0xc2f5('0x2a')](respondWithResult(_0x6179e0,null))[_0xc2f5('0x48')](handleError(_0x6179e0,null));};exports[_0xc2f5('0x53')]=function(_0x22b4c5,_0x42d06d,_0x4fd6c7){if(_0x22b4c5[_0xc2f5('0x4e')]['id']){delete _0x22b4c5[_0xc2f5('0x4e')]['id'];}return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x22b4c5[_0xc2f5('0x4f')]['id']}})[_0xc2f5('0x2a')](handleEntityNotFound(_0x42d06d,null))[_0xc2f5('0x2a')](function(_0x2806d7){if(_0x2806d7){_0x22b4c5[_0xc2f5('0x4e')]['AccountId']=_0x2806d7['id'];_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x54')]=integrations[_0xc2f5('0x55')](_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x56')],_0x22b4c5[_0xc2f5('0x4e')]['type']);_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x57')]=integrations[_0xc2f5('0x58')](_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x56')],_0x22b4c5[_0xc2f5('0x4e')][_0xc2f5('0x33')]);return db[_0xc2f5('0x59')][_0xc2f5('0x4d')](_0x22b4c5[_0xc2f5('0x4e')],{'include':[{'model':db[_0xc2f5('0x5a')],'as':'Subjects'},{'model':db[_0xc2f5('0x5a')],'as':'Descriptions'}]});}return null;})[_0xc2f5('0x2a')](respondWithResult(_0x42d06d,null))['catch'](handleError(_0x42d06d,null));};exports[_0xc2f5('0x5b')]=function(_0x502291,_0x2d3e38,_0x46e101){var _0x10a24b=[{'name':_0xc2f5('0x5c'),'label':_0xc2f5('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 _0x4f784d='';return db[_0xc2f5('0x31')][_0xc2f5('0x52')]({'where':{'id':_0x502291[_0xc2f5('0x4f')]['id']},'attributes':['id',_0xc2f5('0x5d'),'authType',_0xc2f5('0x5e'),'password',_0xc2f5('0x5f'),'consumerSecret',_0xc2f5('0x60'),_0xc2f5('0x61')]})[_0xc2f5('0x2a')](handleEntityNotFound(_0x2d3e38,null))[_0xc2f5('0x2a')](function(_0xe83bea){if(_0xe83bea){_0x4f784d=_0xe83bea[_0xc2f5('0x5d')];var _0x185dbb=_0x4f784d['slice'](-0x1);if(_0x185dbb==='/'){_0x4f784d=_0x4f784d['substring'](0x0,_0x4f784d['lastIndexOf'](_0x185dbb));}var _0xfb166c={'method':_0xc2f5('0x62'),'uri':util[_0xc2f5('0x63')](_0xc2f5('0x64'),_0x4f784d),'headers':{'Content-Type':_0xc2f5('0x65'),'Accept':_0xc2f5('0x65')},'json':!![]};if(_0xe83bea[_0xc2f5('0x66')]==='basic'){_0xfb166c[_0xc2f5('0x67')][_0xc2f5('0x68')]=util[_0xc2f5('0x63')](_0xc2f5('0x69'),new Buffer(util[_0xc2f5('0x63')](_0xc2f5('0x6a'),_0xe83bea[_0xc2f5('0x5e')],_0xe83bea[_0xc2f5('0x6b')]))['toString']('base64'));}return rp(_0xfb166c)[_0xc2f5('0x2a')](function(_0xaf529f){return _0x10a24b[_0xc2f5('0x6c')](_['map'](_0xaf529f[_0xc2f5('0x6d')]['entries'],function(_0x19e629){return{'id':_0x19e629[_0xc2f5('0x2d')],'name':_0x19e629[_0xc2f5('0x2d')],'type':_0x19e629[_0xc2f5('0x33')],'active':_0x19e629['active'],'label':_0x19e629[_0xc2f5('0x6e')],'custom':!![]};}));});}})[_0xc2f5('0x2a')](function(_0x5b1d60){return{'count':_0x5b1d60[_0xc2f5('0x3b')],'rows':_0x5b1d60};})[_0xc2f5('0x2a')](respondWithResult(_0x2d3e38,null))[_0xc2f5('0x48')](function(_0x247fac){var _0x37325d=_0x502291['query'][_0xc2f5('0x6f')]?0x1f4:_0x247fac[_0xc2f5('0x70')]||0x1f4;logger[_0xc2f5('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0xc2f5('0x5b'),_0x37325d,JSON['stringify'](_0x247fac));delete _0x247fac[_0xc2f5('0x2d')];if(_0x37325d===0x191){_0x37325d=0x190;}_0x2d3e38[_0xc2f5('0x1e')](_0x37325d)[_0xc2f5('0x2e')](_0x502291[_0xc2f5('0x36')][_0xc2f5('0x6f')]?{'message':_0xc2f5('0x71'),'statusCode':_0x247fac[_0xc2f5('0x70')]}:_0x247fac);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7d27d70..9bb89ad 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 _0x47d5=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','api'];(function(_0x2ff208,_0x48214e){var _0xa4a53b=function(_0x402330){while(--_0x402330){_0x2ff208['push'](_0x2ff208['shift']());}};_0xa4a53b(++_0x48214e);}(_0x47d5,0x142));var _0x547d=function(_0x407e73,_0x281dad){_0x407e73=_0x407e73-0x0;var _0x2600e5=_0x47d5[_0x407e73];return _0x2600e5;};'use strict';var _=require(_0x547d('0x0'));var util=require(_0x547d('0x1'));var logger=require('../../config/logger')(_0x547d('0x2'));var moment=require(_0x547d('0x3'));var BPromise=require(_0x547d('0x4'));var rp=require(_0x547d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x547d('0x6'));var config=require(_0x547d('0x7'));var attributes=require(_0x547d('0x8'));var integrations=require(_0x547d('0x9'));module[_0x547d('0xa')]=function(_0x1ee2cc,_0x85ae9){return _0x1ee2cc[_0x547d('0xb')](_0x547d('0xc'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b35=['exports','define','DeskAccount','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x4b35,0xdb));var _0x54b3=function(_0x568eca,_0x549174){_0x568eca=_0x568eca-0x0;var _0x767192=_0x4b35[_0x568eca];return _0x767192;};'use strict';var _=require(_0x54b3('0x0'));var util=require('util');var logger=require(_0x54b3('0x1'))(_0x54b3('0x2'));var moment=require(_0x54b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x54b3('0x4'));var fs=require('fs');var path=require(_0x54b3('0x5'));var rimraf=require(_0x54b3('0x6'));var config=require(_0x54b3('0x7'));var attributes=require(_0x54b3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x54b3('0x9')]=function(_0x41e1b3,_0x36eca4){return _0x41e1b3[_0x54b3('0xa')](_0x54b3('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 80978c8..b1ddb6d 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 _0x1857=['raw','where','attributes','limit','map','include','model','debug','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options'];(function(_0x4fefea,_0x13d2ec){var _0x106105=function(_0x536863){while(--_0x536863){_0x4fefea['push'](_0x4fefea['shift']());}};_0x106105(++_0x13d2ec);}(_0x1857,0xe8));var _0x7185=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1857[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7185('0x0'));var util=require(_0x7185('0x1'));var moment=require(_0x7185('0x2'));var BPromise=require(_0x7185('0x3'));var rs=require(_0x7185('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7185('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7185('0x6'))(_0x7185('0x7'));var config=require(_0x7185('0x8'));var jayson=require(_0x7185('0x9'));var client=jayson['client'][_0x7185('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17c165,_0x146826,_0x10e32b){return new BPromise(function(_0x4570b9,_0x4a56af){return client[_0x7185('0xb')](_0x17c165,_0x10e32b)[_0x7185('0xc')](function(_0x6a26c1){logger[_0x7185('0xd')](_0x7185('0xe'),_0x146826,_0x7185('0xf'));logger['debug'](_0x7185('0x10'),_0x146826,_0x7185('0xf'),JSON[_0x7185('0x11')](_0x6a26c1));if(_0x6a26c1[_0x7185('0x12')]){if(_0x6a26c1['error'][_0x7185('0x13')]===0x1f4){logger[_0x7185('0x12')]('DeskAccount,\x20%s,\x20%s',_0x146826,_0x6a26c1[_0x7185('0x12')][_0x7185('0x14')]);return _0x4a56af(_0x6a26c1['error'][_0x7185('0x14')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x146826,_0x6a26c1['error']['message']);return _0x4570b9(_0x6a26c1[_0x7185('0x12')]['message']);}else{logger['info'](_0x7185('0xe'),_0x146826,_0x7185('0xf'));_0x4570b9(_0x6a26c1[_0x7185('0x15')][_0x7185('0x14')]);}})[_0x7185('0x16')](function(_0x1666ab){logger[_0x7185('0x12')](_0x7185('0xe'),_0x146826,_0x1666ab);_0x4a56af(_0x1666ab);});});}exports[_0x7185('0x17')]=function(_0x97d1cf){var _0x544086=this;return new Promise(function(_0x2ff01f,_0x41d521){return db[_0x7185('0x18')][_0x7185('0x19')]({'raw':_0x97d1cf[_0x7185('0x1a')]?_0x97d1cf[_0x7185('0x1a')][_0x7185('0x1b')]===undefined?!![]:![]:!![],'where':_0x97d1cf['options']?_0x97d1cf[_0x7185('0x1a')][_0x7185('0x1c')]||null:null,'attributes':_0x97d1cf[_0x7185('0x1a')]?_0x97d1cf['options'][_0x7185('0x1d')]||null:null,'limit':_0x97d1cf['options']?_0x97d1cf[_0x7185('0x1a')][_0x7185('0x1e')]||null:null,'include':_0x97d1cf[_0x7185('0x1a')]?_0x97d1cf[_0x7185('0x1a')]['include']?_[_0x7185('0x1f')](_0x97d1cf[_0x7185('0x1a')][_0x7185('0x20')],function(_0xcea62){return{'model':db[_0xcea62[_0x7185('0x21')]],'as':_0xcea62['as'],'attributes':_0xcea62[_0x7185('0x1d')],'include':_0xcea62[_0x7185('0x20')]?_['map'](_0xcea62[_0x7185('0x20')],function(_0x585bf5){return{'model':db[_0x585bf5[_0x7185('0x21')]],'as':_0x585bf5['as'],'attributes':_0x585bf5[_0x7185('0x1d')],'include':_0x585bf5[_0x7185('0x20')]?_[_0x7185('0x1f')](_0x585bf5[_0x7185('0x20')],function(_0xbbc9bb){return{'model':db[_0xbbc9bb[_0x7185('0x21')]],'as':_0xbbc9bb['as'],'attributes':_0xbbc9bb[_0x7185('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7185('0xc')](function(_0x4886f6){logger[_0x7185('0xd')](_0x7185('0x17'),_0x97d1cf);logger[_0x7185('0x22')](_0x7185('0x17'),_0x97d1cf,JSON[_0x7185('0x11')](_0x4886f6));_0x2ff01f(_0x4886f6);})[_0x7185('0x16')](function(_0x588112){logger[_0x7185('0x12')]('GetDeskAccount',_0x588112[_0x7185('0x14')],_0x97d1cf);_0x41d521(_0x544086[_0x7185('0x12')](0x1f4,_0x588112['message']));});});};exports[_0x7185('0x23')]=function(_0x519493){var _0x1273da=this;return new Promise(function(_0x58ca88,_0xfde135){return db[_0x7185('0x18')][_0x7185('0x24')]({'raw':_0x519493[_0x7185('0x1a')]?_0x519493['options'][_0x7185('0x1b')]===undefined?!![]:![]:!![],'where':_0x519493[_0x7185('0x1a')]?_0x519493[_0x7185('0x1a')][_0x7185('0x1c')]||null:null,'attributes':_0x519493[_0x7185('0x1a')]?_0x519493[_0x7185('0x1a')][_0x7185('0x1d')]||null:null,'include':_0x519493[_0x7185('0x1a')]?_0x519493[_0x7185('0x1a')][_0x7185('0x20')]?_['map'](_0x519493[_0x7185('0x1a')][_0x7185('0x20')],function(_0x46a72d){return{'model':db[_0x46a72d['model']],'as':_0x46a72d['as'],'attributes':_0x46a72d[_0x7185('0x1d')],'include':_0x46a72d[_0x7185('0x20')]?_[_0x7185('0x1f')](_0x46a72d[_0x7185('0x20')],function(_0x113c96){return{'model':db[_0x113c96[_0x7185('0x21')]],'as':_0x113c96['as'],'attributes':_0x113c96[_0x7185('0x1d')],'include':_0x113c96[_0x7185('0x20')]?_['map'](_0x113c96[_0x7185('0x20')],function(_0x74fe60){return{'model':db[_0x74fe60[_0x7185('0x21')]],'as':_0x74fe60['as'],'attributes':_0x74fe60[_0x7185('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7185('0xc')](function(_0x15a6af){logger[_0x7185('0xd')](_0x7185('0x23'),_0x519493);logger['debug'](_0x7185('0x23'),_0x519493,JSON['stringify'](_0x15a6af));_0x58ca88(_0x15a6af);})[_0x7185('0x16')](function(_0xf377ce){logger[_0x7185('0x12')]('ShowDeskAccount',_0xf377ce['message'],_0x519493);_0xfde135(_0x1273da[_0x7185('0x12')](0x1f4,_0xf377ce[_0x7185('0x14')]));});});}; \ No newline at end of file +var _0xc1fa=['message','info','catch','GetDeskAccount','options','raw','attributes','limit','include','model','map','debug','ShowDeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x318de8,_0x5ac51e){var _0x31b14a=function(_0x225ff9){while(--_0x225ff9){_0x318de8['push'](_0x318de8['shift']());}};_0x31b14a(++_0x5ac51e);}(_0xc1fa,0x11f));var _0xac1f=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xc1fa[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0xac1f('0x0'));var moment=require(_0xac1f('0x1'));var BPromise=require(_0xac1f('0x2'));var rs=require(_0xac1f('0x3'));var fs=require('fs');var Redis=require(_0xac1f('0x4'));var db=require(_0xac1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac1f('0x6'));var config=require(_0xac1f('0x7'));var jayson=require(_0xac1f('0x8'));var client=jayson[_0xac1f('0x9')][_0xac1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39e51a,_0x4b8f14,_0x2c1309){return new BPromise(function(_0x3c0593,_0x25147c){return client[_0xac1f('0xb')](_0x39e51a,_0x2c1309)[_0xac1f('0xc')](function(_0x53211a){logger['info'](_0xac1f('0xd'),_0x4b8f14,'request\x20sent');logger['debug'](_0xac1f('0xe'),_0x4b8f14,_0xac1f('0xf'),JSON[_0xac1f('0x10')](_0x53211a));if(_0x53211a['error']){if(_0x53211a[_0xac1f('0x11')][_0xac1f('0x12')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4b8f14,_0x53211a[_0xac1f('0x11')][_0xac1f('0x13')]);return _0x25147c(_0x53211a[_0xac1f('0x11')][_0xac1f('0x13')]);}logger['error'](_0xac1f('0xd'),_0x4b8f14,_0x53211a[_0xac1f('0x11')]['message']);return _0x3c0593(_0x53211a[_0xac1f('0x11')]['message']);}else{logger[_0xac1f('0x14')](_0xac1f('0xd'),_0x4b8f14,_0xac1f('0xf'));_0x3c0593(_0x53211a['result'][_0xac1f('0x13')]);}})[_0xac1f('0x15')](function(_0x55db15){logger[_0xac1f('0x11')](_0xac1f('0xd'),_0x4b8f14,_0x55db15);_0x25147c(_0x55db15);});});}exports[_0xac1f('0x16')]=function(_0x20ce0a){var _0x38f9c4=this;return new Promise(function(_0x1e1b80,_0x19375c){return db['DeskAccount']['findAll']({'raw':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x18')]===undefined?!![]:![]:!![],'where':_0x20ce0a['options']?_0x20ce0a[_0xac1f('0x17')]['where']||null:null,'attributes':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x19')]||null:null,'limit':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x1a')]||null:null,'include':_0x20ce0a[_0xac1f('0x17')]?_0x20ce0a['options'][_0xac1f('0x1b')]?_['map'](_0x20ce0a[_0xac1f('0x17')][_0xac1f('0x1b')],function(_0x10bd4e){return{'model':db[_0x10bd4e[_0xac1f('0x1c')]],'as':_0x10bd4e['as'],'attributes':_0x10bd4e[_0xac1f('0x19')],'include':_0x10bd4e['include']?_['map'](_0x10bd4e[_0xac1f('0x1b')],function(_0xa6d05a){return{'model':db[_0xa6d05a[_0xac1f('0x1c')]],'as':_0xa6d05a['as'],'attributes':_0xa6d05a[_0xac1f('0x19')],'include':_0xa6d05a['include']?_[_0xac1f('0x1d')](_0xa6d05a['include'],function(_0x538a70){return{'model':db[_0x538a70['model']],'as':_0x538a70['as'],'attributes':_0x538a70[_0xac1f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xac1f('0xc')](function(_0x8da77a){logger[_0xac1f('0x14')](_0xac1f('0x16'),_0x20ce0a);logger[_0xac1f('0x1e')]('GetDeskAccount',_0x20ce0a,JSON[_0xac1f('0x10')](_0x8da77a));_0x1e1b80(_0x8da77a);})['catch'](function(_0x9c689a){logger[_0xac1f('0x11')](_0xac1f('0x16'),_0x9c689a[_0xac1f('0x13')],_0x20ce0a);_0x19375c(_0x38f9c4[_0xac1f('0x11')](0x1f4,_0x9c689a[_0xac1f('0x13')]));});});};exports[_0xac1f('0x1f')]=function(_0x16417e){var _0x16f681=this;return new Promise(function(_0x35697b,_0x226b55){return db['DeskAccount'][_0xac1f('0x20')]({'raw':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')][_0xac1f('0x18')]===undefined?!![]:![]:!![],'where':_0x16417e[_0xac1f('0x17')]?_0x16417e['options'][_0xac1f('0x21')]||null:null,'attributes':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')]['attributes']||null:null,'include':_0x16417e[_0xac1f('0x17')]?_0x16417e[_0xac1f('0x17')]['include']?_[_0xac1f('0x1d')](_0x16417e[_0xac1f('0x17')][_0xac1f('0x1b')],function(_0x583309){return{'model':db[_0x583309[_0xac1f('0x1c')]],'as':_0x583309['as'],'attributes':_0x583309[_0xac1f('0x19')],'include':_0x583309[_0xac1f('0x1b')]?_[_0xac1f('0x1d')](_0x583309[_0xac1f('0x1b')],function(_0x40ae42){return{'model':db[_0x40ae42[_0xac1f('0x1c')]],'as':_0x40ae42['as'],'attributes':_0x40ae42[_0xac1f('0x19')],'include':_0x40ae42['include']?_[_0xac1f('0x1d')](_0x40ae42[_0xac1f('0x1b')],function(_0x9356ec){return{'model':db[_0x9356ec[_0xac1f('0x1c')]],'as':_0x9356ec['as'],'attributes':_0x9356ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xac1f('0xc')](function(_0x55b00c){logger[_0xac1f('0x14')](_0xac1f('0x1f'),_0x16417e);logger[_0xac1f('0x1e')]('ShowDeskAccount',_0x16417e,JSON[_0xac1f('0x10')](_0x55b00c));_0x35697b(_0x55b00c);})[_0xac1f('0x15')](function(_0x5eceef){logger[_0xac1f('0x11')]('ShowDeskAccount',_0x5eceef[_0xac1f('0x13')],_0x16417e);_0x226b55(_0x16f681[_0xac1f('0x11')](0x1f4,_0x5eceef[_0xac1f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ef206fe..4691e01 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x50c9b6,_0x21d360){var _0x46f4a0=function(_0x373042){while(--_0x373042){_0x50c9b6['push'](_0x50c9b6['shift']());}};_0x46f4a0(++_0x21d360);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x964b6e,_0x4cfa24){var _0x5d5406=function(_0x240333){while(--_0x240333){_0x964b6e['push'](_0x964b6e['shift']());}};_0x5d5406(++_0x4cfa24);}(_0x008c,0x188));var _0xc008=function(_0x50521f,_0x4375b3){_0x50521f=_0x50521f-0x0;var _0x29b4be=_0x008c[_0x50521f];return _0x29b4be;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('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 6051d0c..f8b141d 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 _0x7f56=['exports','STRING','sequelize'];(function(_0x5e96d2,_0x5d5ec8){var _0x3f6438=function(_0x168e9){while(--_0x168e9){_0x5e96d2['push'](_0x5e96d2['shift']());}};_0x3f6438(++_0x5d5ec8);}(_0x7f56,0x197));var _0x67f5=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7f56[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x67f5('0x0'));module[_0x67f5('0x1')]={'name':{'type':Sequelize[_0x67f5('0x2')]},'description':{'type':Sequelize[_0x67f5('0x2')]}}; \ No newline at end of file +var _0x55d2=['STRING','sequelize','exports'];(function(_0x3ed049,_0x19da21){var _0x3d9597=function(_0x874e1f){while(--_0x874e1f){_0x3ed049['push'](_0x3ed049['shift']());}};_0x3d9597(++_0x19da21);}(_0x55d2,0x16c));var _0x255d=function(_0x598c1e,_0x395e6e){_0x598c1e=_0x598c1e-0x0;var _0x487a43=_0x55d2[_0x598c1e];return _0x487a43;};'use strict';var Sequelize=require(_0x255d('0x0'));module[_0x255d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x255d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ee58d3b..5a6d15f 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 _0xae22=['setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','end','name','index','DeskConfiguration','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','then','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','DeskField','getSubjects','findOne','Tag','getTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae22,0x18d));var _0x2ae2=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xae22[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0x2ae2('0x0'));var rimraf=require(_0x2ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ae2('0x2'));var rp=require(_0x2ae2('0x3'));var moment=require('moment');var BPromise=require(_0x2ae2('0x4'));var Mustache=require(_0x2ae2('0x5'));var util=require('util');var path=require(_0x2ae2('0x6'));var sox=require(_0x2ae2('0x7'));var csv=require(_0x2ae2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ae2('0x9'));var squel=require(_0x2ae2('0xa'));var crypto=require(_0x2ae2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2ae2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2ae2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ae2('0xe'));var qs=require(_0x2ae2('0xf'));var as=require(_0x2ae2('0x10'));var hardwareService=require(_0x2ae2('0x11'));var logger=require(_0x2ae2('0x12'))('api');var utils=require(_0x2ae2('0x13'));var config=require(_0x2ae2('0x14'));var licenseUtil=require(_0x2ae2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe63c26,_0x54ed43){_0x54ed43=_0x54ed43||0xcc;return function(_0x2d186e){if(_0x2d186e){return _0xe63c26[_0x2ae2('0x16')](_0x54ed43);}return _0xe63c26[_0x2ae2('0x17')](_0x54ed43)['end']();};}function respondWithResult(_0x5398ce,_0x440d1d){_0x440d1d=_0x440d1d||0xc8;return function(_0x495dc5){if(_0x495dc5){return _0x5398ce['status'](_0x440d1d)[_0x2ae2('0x18')](_0x495dc5);}};}function respondWithFilteredResult(_0x5d2faf,_0x580ce2){return function(_0x533d65){if(_0x533d65){var _0x5320d8=typeof _0x580ce2['offset']===_0x2ae2('0x19')&&typeof _0x580ce2[_0x2ae2('0x1a')]===_0x2ae2('0x19');var _0x505141=_0x533d65[_0x2ae2('0x1b')];var _0xb45e98=_0x5320d8?0x0:_0x580ce2['offset'];var _0x3c2a24=_0x5320d8?_0x533d65[_0x2ae2('0x1b')]:_0x580ce2[_0x2ae2('0x1c')]+_0x580ce2['limit'];var _0x186ee4;if(_0x3c2a24>=_0x505141){_0x3c2a24=_0x505141;_0x186ee4=0xc8;}else{_0x186ee4=0xce;}_0x5d2faf['status'](_0x186ee4);return _0x5d2faf['set'](_0x2ae2('0x1d'),_0xb45e98+'-'+_0x3c2a24+'/'+_0x505141)[_0x2ae2('0x18')](_0x533d65);}return null;};}function patchUpdates(_0x2e0b85){return function(_0x5e89eb){try{jsonpatch[_0x2ae2('0x1e')](_0x5e89eb,_0x2e0b85,!![]);}catch(_0x4a27c3){return BPromise['reject'](_0x4a27c3);}return _0x5e89eb[_0x2ae2('0x1f')]();};}function saveUpdates(_0xf41329,_0x1e5126){return function(_0x42ec5b){if(_0x42ec5b){return _0x42ec5b[_0x2ae2('0x20')](_0xf41329)['then'](function(_0x3e9510){return _0x3e9510;});}return null;};}function removeEntity(_0xd0cab8,_0x261c66){return function(_0x3b3ea6){if(_0x3b3ea6){return _0x3b3ea6[_0x2ae2('0x21')]()['then'](function(){_0xd0cab8['status'](0xcc)[_0x2ae2('0x22')]();});}};}function handleEntityNotFound(_0x456136,_0x24ec79){return function(_0x44105c){if(!_0x44105c){_0x456136[_0x2ae2('0x16')](0x194);}return _0x44105c;};}function handleError(_0x20f6b7,_0x3e1ab6){_0x3e1ab6=_0x3e1ab6||0x1f4;return function(_0x5c8180){logger['error'](_0x5c8180['stack']);if(_0x5c8180[_0x2ae2('0x23')]){delete _0x5c8180['name'];}_0x20f6b7[_0x2ae2('0x17')](_0x3e1ab6)['send'](_0x5c8180);};}exports[_0x2ae2('0x24')]=function(_0x2bc732,_0x1a32cb){var _0x19d1e9={},_0x1b2867={},_0x305858={'count':0x0,'rows':[]};var _0x5f314a=_['map'](db[_0x2ae2('0x25')]['rawAttributes'],function(_0x42cad5){return{'name':_0x42cad5[_0x2ae2('0x26')],'type':_0x42cad5['type'][_0x2ae2('0x27')]};});_0x1b2867[_0x2ae2('0x28')]=_[_0x2ae2('0x29')](_0x5f314a,_0x2ae2('0x23'));_0x1b2867[_0x2ae2('0x2a')]=_[_0x2ae2('0x2b')](_0x2bc732['query']);_0x1b2867['filters']=_[_0x2ae2('0x2c')](_0x1b2867[_0x2ae2('0x28')],_0x1b2867[_0x2ae2('0x2a')]);_0x19d1e9['attributes']=_[_0x2ae2('0x2c')](_0x1b2867[_0x2ae2('0x28')],qs[_0x2ae2('0x2d')](_0x2bc732['query'][_0x2ae2('0x2d')]));_0x19d1e9[_0x2ae2('0x2e')]=_0x19d1e9['attributes'][_0x2ae2('0x2f')]?_0x19d1e9[_0x2ae2('0x2e')]:_0x1b2867['model'];if(!_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x30')](_0x2ae2('0x31'))){_0x19d1e9['limit']=qs[_0x2ae2('0x1a')](_0x2bc732['query']['limit']);_0x19d1e9[_0x2ae2('0x1c')]=qs['offset'](_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x1c')]);}_0x19d1e9[_0x2ae2('0x32')]=qs['sort'](_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x33')]);_0x19d1e9[_0x2ae2('0x34')]=qs[_0x2ae2('0x35')](_[_0x2ae2('0x36')](_0x2bc732[_0x2ae2('0x2a')],_0x1b2867['filters']),_0x5f314a);if(_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x37')]){_0x19d1e9[_0x2ae2('0x34')]=_[_0x2ae2('0x38')](_0x19d1e9[_0x2ae2('0x34')],{'$or':_[_0x2ae2('0x29')](_0x5f314a,function(_0x5b821){if(_0x5b821[_0x2ae2('0x39')]!==_0x2ae2('0x3a')){var _0x28bb83={};_0x28bb83[_0x5b821[_0x2ae2('0x23')]]={'$like':'%'+_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x37')]+'%'};return _0x28bb83;}})});}_0x19d1e9=_[_0x2ae2('0x38')]({},_0x19d1e9,_0x2bc732['options']);var _0x430bfe={'where':_0x19d1e9[_0x2ae2('0x34')]};return db[_0x2ae2('0x25')][_0x2ae2('0x1b')](_0x430bfe)['then'](function(_0x14a3b4){_0x305858[_0x2ae2('0x1b')]=_0x14a3b4;if(_0x2bc732[_0x2ae2('0x2a')][_0x2ae2('0x3b')]){_0x19d1e9[_0x2ae2('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x19d1e9);})[_0x2ae2('0x3d')](function(_0x45feb1){_0x305858[_0x2ae2('0x3e')]=_0x45feb1;return _0x305858;})['then'](respondWithFilteredResult(_0x1a32cb,_0x19d1e9))[_0x2ae2('0x3f')](handleError(_0x1a32cb,null));};exports[_0x2ae2('0x40')]=function(_0x4f29f7,_0x193559){var _0x2065cd={'raw':![],'where':{'id':_0x4f29f7[_0x2ae2('0x41')]['id']}},_0x48c8e4={};_0x48c8e4[_0x2ae2('0x28')]=_[_0x2ae2('0x2b')](db['DeskConfiguration'][_0x2ae2('0x42')]);_0x48c8e4[_0x2ae2('0x2a')]=_['keys'](_0x4f29f7['query']);_0x48c8e4['filters']=_['intersection'](_0x48c8e4[_0x2ae2('0x28')],_0x48c8e4['query']);_0x2065cd[_0x2ae2('0x2e')]=_[_0x2ae2('0x2c')](_0x48c8e4['model'],qs[_0x2ae2('0x2d')](_0x4f29f7[_0x2ae2('0x2a')][_0x2ae2('0x2d')]));_0x2065cd['attributes']=_0x2065cd['attributes']['length']?_0x2065cd[_0x2ae2('0x2e')]:_0x48c8e4[_0x2ae2('0x28')];if(_0x4f29f7[_0x2ae2('0x2a')][_0x2ae2('0x3b')]){_0x2065cd[_0x2ae2('0x3c')]=[{'all':!![]}];}_0x2065cd=_[_0x2ae2('0x38')]({},_0x2065cd,_0x4f29f7[_0x2ae2('0x43')]);return db[_0x2ae2('0x25')][_0x2ae2('0x44')](_0x2065cd)[_0x2ae2('0x3d')](handleEntityNotFound(_0x193559,null))[_0x2ae2('0x3d')](respondWithResult(_0x193559,null))[_0x2ae2('0x3f')](handleError(_0x193559,null));};exports[_0x2ae2('0x45')]=function(_0xfda7d1,_0x2c5eb6){return db[_0x2ae2('0x25')][_0x2ae2('0x45')](_0xfda7d1['body'],{})['then'](respondWithResult(_0x2c5eb6,0xc9))[_0x2ae2('0x3f')](handleError(_0x2c5eb6,null));};exports[_0x2ae2('0x20')]=function(_0x286b8d,_0x496279){if(_0x286b8d['body']['id']){delete _0x286b8d[_0x2ae2('0x46')]['id'];}return db[_0x2ae2('0x25')][_0x2ae2('0x44')]({'where':{'id':_0x286b8d[_0x2ae2('0x41')]['id']}})[_0x2ae2('0x3d')](handleEntityNotFound(_0x496279,null))['then'](saveUpdates(_0x286b8d[_0x2ae2('0x46')],null))[_0x2ae2('0x3d')](respondWithResult(_0x496279,null))['catch'](handleError(_0x496279,null));};exports[_0x2ae2('0x21')]=function(_0x28bd28,_0xeae6a0){return db[_0x2ae2('0x25')][_0x2ae2('0x44')]({'where':{'id':_0x28bd28[_0x2ae2('0x41')]['id']}})['then'](handleEntityNotFound(_0xeae6a0,null))[_0x2ae2('0x3d')](removeEntity(_0xeae6a0,null))[_0x2ae2('0x3f')](handleError(_0xeae6a0,null));};exports[_0x2ae2('0x47')]=function(_0x2c30de,_0x4b51ae,_0x50d43b){var _0x3a9bce={};var _0x3bff0b={};var _0x19902f;var _0x2088f8;return db[_0x2ae2('0x25')]['findOne']({'where':{'id':_0x2c30de['params']['id']}})[_0x2ae2('0x3d')](handleEntityNotFound(_0x4b51ae,null))['then'](function(_0x4a187f){if(_0x4a187f){_0x19902f=_0x4a187f;_0x3bff0b[_0x2ae2('0x28')]=_['keys'](db[_0x2ae2('0x48')][_0x2ae2('0x42')]);_0x3bff0b[_0x2ae2('0x2a')]=_[_0x2ae2('0x2b')](_0x2c30de[_0x2ae2('0x2a')]);_0x3bff0b[_0x2ae2('0x35')]=_['intersection'](_0x3bff0b[_0x2ae2('0x28')],_0x3bff0b[_0x2ae2('0x2a')]);_0x3a9bce[_0x2ae2('0x2e')]=_[_0x2ae2('0x2c')](_0x3bff0b[_0x2ae2('0x28')],qs[_0x2ae2('0x2d')](_0x2c30de['query']['fields']));_0x3a9bce[_0x2ae2('0x2e')]=_0x3a9bce['attributes'][_0x2ae2('0x2f')]?_0x3a9bce[_0x2ae2('0x2e')]:_0x3bff0b[_0x2ae2('0x28')];_0x3a9bce['order']=qs[_0x2ae2('0x33')](_0x2c30de['query'][_0x2ae2('0x33')]);_0x3a9bce[_0x2ae2('0x34')]=qs['filters'](_[_0x2ae2('0x36')](_0x2c30de[_0x2ae2('0x2a')],_0x3bff0b[_0x2ae2('0x35')]));if(_0x2c30de[_0x2ae2('0x2a')][_0x2ae2('0x37')]){_0x3a9bce[_0x2ae2('0x34')]=_[_0x2ae2('0x38')](_0x3a9bce['where'],{'$or':_['map'](_0x3a9bce['attributes'],function(_0x540c05){var _0x2e94eb={};_0x2e94eb[_0x540c05]={'$like':'%'+_0x2c30de[_0x2ae2('0x2a')][_0x2ae2('0x37')]+'%'};return _0x2e94eb;})});}_0x3a9bce=_['merge']({},_0x3a9bce,_0x2c30de[_0x2ae2('0x43')]);return _0x19902f['getFields'](_0x3a9bce);}})[_0x2ae2('0x3d')](function(_0x2972ad){if(_0x2972ad){_0x2088f8=_0x2972ad['length'];if(!_0x2c30de[_0x2ae2('0x2a')]['hasOwnProperty']('nolimit')){_0x3a9bce[_0x2ae2('0x1a')]=qs[_0x2ae2('0x1a')](_0x2c30de[_0x2ae2('0x2a')][_0x2ae2('0x1a')]);_0x3a9bce['offset']=qs[_0x2ae2('0x1c')](_0x2c30de[_0x2ae2('0x2a')]['offset']);}return _0x19902f[_0x2ae2('0x47')](_0x3a9bce);}})[_0x2ae2('0x3d')](function(_0xd956d5){if(_0xd956d5){return _0xd956d5?{'count':_0x2088f8,'rows':_0xd956d5}:null;}})[_0x2ae2('0x3d')](respondWithResult(_0x4b51ae,null))['catch'](handleError(_0x4b51ae,null));};exports[_0x2ae2('0x49')]=function(_0x4fe665,_0x471c44,_0x134226){var _0x3d4e44={};var _0x5a3c17={};var _0x13d8ba;var _0x32d212;return db['DeskConfiguration'][_0x2ae2('0x4a')]({'where':{'id':_0x4fe665['params']['id']}})[_0x2ae2('0x3d')](handleEntityNotFound(_0x471c44,null))[_0x2ae2('0x3d')](function(_0xea187e){if(_0xea187e){_0x13d8ba=_0xea187e;_0x5a3c17[_0x2ae2('0x28')]=_[_0x2ae2('0x2b')](db['DeskField'][_0x2ae2('0x42')]);_0x5a3c17[_0x2ae2('0x2a')]=_['keys'](_0x4fe665['query']);_0x5a3c17[_0x2ae2('0x35')]=_['intersection'](_0x5a3c17[_0x2ae2('0x28')],_0x5a3c17[_0x2ae2('0x2a')]);_0x3d4e44[_0x2ae2('0x2e')]=_[_0x2ae2('0x2c')](_0x5a3c17['model'],qs[_0x2ae2('0x2d')](_0x4fe665[_0x2ae2('0x2a')][_0x2ae2('0x2d')]));_0x3d4e44[_0x2ae2('0x2e')]=_0x3d4e44[_0x2ae2('0x2e')]['length']?_0x3d4e44['attributes']:_0x5a3c17[_0x2ae2('0x28')];_0x3d4e44[_0x2ae2('0x32')]=qs[_0x2ae2('0x33')](_0x4fe665[_0x2ae2('0x2a')][_0x2ae2('0x33')]);_0x3d4e44['where']=qs[_0x2ae2('0x35')](_[_0x2ae2('0x36')](_0x4fe665['query'],_0x5a3c17[_0x2ae2('0x35')]));if(_0x4fe665[_0x2ae2('0x2a')][_0x2ae2('0x37')]){_0x3d4e44[_0x2ae2('0x34')]=_[_0x2ae2('0x38')](_0x3d4e44['where'],{'$or':_[_0x2ae2('0x29')](_0x3d4e44[_0x2ae2('0x2e')],function(_0x2d66a3){var _0x28a0e0={};_0x28a0e0[_0x2d66a3]={'$like':'%'+_0x4fe665[_0x2ae2('0x2a')]['filter']+'%'};return _0x28a0e0;})});}_0x3d4e44=_[_0x2ae2('0x38')]({},_0x3d4e44,_0x4fe665[_0x2ae2('0x43')]);return _0x13d8ba[_0x2ae2('0x49')](_0x3d4e44);}})[_0x2ae2('0x3d')](function(_0x347144){if(_0x347144){_0x32d212=_0x347144[_0x2ae2('0x2f')];if(!_0x4fe665['query'][_0x2ae2('0x30')](_0x2ae2('0x31'))){_0x3d4e44[_0x2ae2('0x1a')]=qs['limit'](_0x4fe665['query'][_0x2ae2('0x1a')]);_0x3d4e44[_0x2ae2('0x1c')]=qs[_0x2ae2('0x1c')](_0x4fe665[_0x2ae2('0x2a')]['offset']);}return _0x13d8ba[_0x2ae2('0x49')](_0x3d4e44);}})[_0x2ae2('0x3d')](function(_0xff5355){if(_0xff5355){return _0xff5355?{'count':_0x32d212,'rows':_0xff5355}:null;}})[_0x2ae2('0x3d')](respondWithResult(_0x471c44,null))['catch'](handleError(_0x471c44,null));};exports['getDescriptions']=function(_0x3df180,_0x4855d0,_0x4a6dad){var _0x4c6efc={};var _0x5e682f={};var _0x102c39;var _0x1185fc;return db[_0x2ae2('0x25')][_0x2ae2('0x4a')]({'where':{'id':_0x3df180[_0x2ae2('0x41')]['id']}})['then'](handleEntityNotFound(_0x4855d0,null))[_0x2ae2('0x3d')](function(_0x2fc515){if(_0x2fc515){_0x102c39=_0x2fc515;_0x5e682f[_0x2ae2('0x28')]=_[_0x2ae2('0x2b')](db[_0x2ae2('0x48')][_0x2ae2('0x42')]);_0x5e682f[_0x2ae2('0x2a')]=_['keys'](_0x3df180[_0x2ae2('0x2a')]);_0x5e682f[_0x2ae2('0x35')]=_[_0x2ae2('0x2c')](_0x5e682f['model'],_0x5e682f['query']);_0x4c6efc['attributes']=_[_0x2ae2('0x2c')](_0x5e682f['model'],qs['fields'](_0x3df180[_0x2ae2('0x2a')][_0x2ae2('0x2d')]));_0x4c6efc['attributes']=_0x4c6efc[_0x2ae2('0x2e')]['length']?_0x4c6efc[_0x2ae2('0x2e')]:_0x5e682f['model'];_0x4c6efc[_0x2ae2('0x32')]=qs[_0x2ae2('0x33')](_0x3df180[_0x2ae2('0x2a')][_0x2ae2('0x33')]);_0x4c6efc['where']=qs['filters'](_[_0x2ae2('0x36')](_0x3df180[_0x2ae2('0x2a')],_0x5e682f[_0x2ae2('0x35')]));if(_0x3df180['query'][_0x2ae2('0x37')]){_0x4c6efc[_0x2ae2('0x34')]=_[_0x2ae2('0x38')](_0x4c6efc['where'],{'$or':_[_0x2ae2('0x29')](_0x4c6efc[_0x2ae2('0x2e')],function(_0x4f3030){var _0x523455={};_0x523455[_0x4f3030]={'$like':'%'+_0x3df180[_0x2ae2('0x2a')]['filter']+'%'};return _0x523455;})});}_0x4c6efc=_[_0x2ae2('0x38')]({},_0x4c6efc,_0x3df180['options']);return _0x102c39['getDescriptions'](_0x4c6efc);}})['then'](function(_0x529703){if(_0x529703){_0x1185fc=_0x529703[_0x2ae2('0x2f')];if(!_0x3df180[_0x2ae2('0x2a')][_0x2ae2('0x30')](_0x2ae2('0x31'))){_0x4c6efc[_0x2ae2('0x1a')]=qs['limit'](_0x3df180['query'][_0x2ae2('0x1a')]);_0x4c6efc[_0x2ae2('0x1c')]=qs[_0x2ae2('0x1c')](_0x3df180[_0x2ae2('0x2a')][_0x2ae2('0x1c')]);}return _0x102c39['getDescriptions'](_0x4c6efc);}})['then'](function(_0x3109bd){if(_0x3109bd){return _0x3109bd?{'count':_0x1185fc,'rows':_0x3109bd}:null;}})[_0x2ae2('0x3d')](respondWithResult(_0x4855d0,null))[_0x2ae2('0x3f')](handleError(_0x4855d0,null));};exports['getTags']=function(_0xaa1ba7,_0x482cfd,_0x2c5ea3){var _0x402731={};var _0x1955fe={};var _0x2a4a9d;var _0x2928fc;return db['DeskConfiguration'][_0x2ae2('0x4a')]({'where':{'id':_0xaa1ba7[_0x2ae2('0x41')]['id']}})[_0x2ae2('0x3d')](handleEntityNotFound(_0x482cfd,null))[_0x2ae2('0x3d')](function(_0x180e46){if(_0x180e46){_0x2a4a9d=_0x180e46;_0x1955fe[_0x2ae2('0x28')]=_[_0x2ae2('0x2b')](db[_0x2ae2('0x4b')][_0x2ae2('0x42')]);_0x1955fe[_0x2ae2('0x2a')]=_['keys'](_0xaa1ba7[_0x2ae2('0x2a')]);_0x1955fe[_0x2ae2('0x35')]=_[_0x2ae2('0x2c')](_0x1955fe[_0x2ae2('0x28')],_0x1955fe[_0x2ae2('0x2a')]);_0x402731[_0x2ae2('0x2e')]=_[_0x2ae2('0x2c')](_0x1955fe[_0x2ae2('0x28')],qs[_0x2ae2('0x2d')](_0xaa1ba7[_0x2ae2('0x2a')][_0x2ae2('0x2d')]));_0x402731[_0x2ae2('0x2e')]=_0x402731['attributes']['length']?_0x402731[_0x2ae2('0x2e')]:_0x1955fe['model'];_0x402731[_0x2ae2('0x32')]=qs[_0x2ae2('0x33')](_0xaa1ba7[_0x2ae2('0x2a')][_0x2ae2('0x33')]);_0x402731[_0x2ae2('0x34')]=qs['filters'](_[_0x2ae2('0x36')](_0xaa1ba7[_0x2ae2('0x2a')],_0x1955fe[_0x2ae2('0x35')]));if(_0xaa1ba7[_0x2ae2('0x2a')][_0x2ae2('0x37')]){_0x402731[_0x2ae2('0x34')]=_[_0x2ae2('0x38')](_0x402731[_0x2ae2('0x34')],{'$or':_[_0x2ae2('0x29')](_0x402731[_0x2ae2('0x2e')],function(_0x570224){var _0x125bd8={};_0x125bd8[_0x570224]={'$like':'%'+_0xaa1ba7[_0x2ae2('0x2a')][_0x2ae2('0x37')]+'%'};return _0x125bd8;})});}_0x402731=_[_0x2ae2('0x38')]({},_0x402731,_0xaa1ba7[_0x2ae2('0x43')]);return _0x2a4a9d[_0x2ae2('0x4c')](_0x402731);}})[_0x2ae2('0x3d')](function(_0x4712d0){if(_0x4712d0){_0x2928fc=_0x4712d0[_0x2ae2('0x2f')];if(!_0xaa1ba7['query'][_0x2ae2('0x30')](_0x2ae2('0x31'))){_0x402731[_0x2ae2('0x1a')]=qs[_0x2ae2('0x1a')](_0xaa1ba7[_0x2ae2('0x2a')]['limit']);_0x402731[_0x2ae2('0x1c')]=qs['offset'](_0xaa1ba7[_0x2ae2('0x2a')][_0x2ae2('0x1c')]);}return _0x2a4a9d[_0x2ae2('0x4c')](_0x402731);}})[_0x2ae2('0x3d')](function(_0x130ce5){if(_0x130ce5){return _0x130ce5?{'count':_0x2928fc,'rows':_0x130ce5}:null;}})[_0x2ae2('0x3d')](respondWithResult(_0x482cfd,null))[_0x2ae2('0x3f')](handleError(_0x482cfd,null));};exports['setTags']=function(_0x24d6cf,_0x41d92b,_0x2b81f7){if(_0x24d6cf[_0x2ae2('0x46')]['id']){delete _0x24d6cf[_0x2ae2('0x46')]['id'];}return db[_0x2ae2('0x25')][_0x2ae2('0x4a')]({'where':{'id':_0x24d6cf[_0x2ae2('0x41')]['id']}})[_0x2ae2('0x3d')](handleEntityNotFound(_0x41d92b,null))[_0x2ae2('0x3d')](function(_0x185725){if(_0x185725){return _0x185725[_0x2ae2('0x4d')](_0x24d6cf[_0x2ae2('0x46')][_0x2ae2('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x41d92b,null))[_0x2ae2('0x3f')](handleError(_0x41d92b,null));}; \ No newline at end of file +var _0x9b5a=['update','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','rows','show','params','keys','length','find','catch','create','body','getFields','findOne','DeskField','intersection','getSubjects','nolimit','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x9b5a,0x88));var _0xa9b5=function(_0xd170c0,_0x56ab77){_0xd170c0=_0xd170c0-0x0;var _0x106b68=_0x9b5a[_0xd170c0];return _0x106b68;};'use strict';var emlformat=require(_0xa9b5('0x0'));var rimraf=require(_0xa9b5('0x1'));var zipdir=require(_0xa9b5('0x2'));var jsonpatch=require(_0xa9b5('0x3'));var rp=require(_0xa9b5('0x4'));var moment=require('moment');var BPromise=require(_0xa9b5('0x5'));var Mustache=require('mustache');var util=require(_0xa9b5('0x6'));var path=require(_0xa9b5('0x7'));var sox=require(_0xa9b5('0x8'));var csv=require(_0xa9b5('0x9'));var ejs=require(_0xa9b5('0xa'));var fs=require('fs');var fs_extra=require(_0xa9b5('0xb'));var _=require(_0xa9b5('0xc'));var squel=require(_0xa9b5('0xd'));var crypto=require(_0xa9b5('0xe'));var jsforce=require(_0xa9b5('0xf'));var deskjs=require(_0xa9b5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9b5('0x11'));var authService=require(_0xa9b5('0x12'));var qs=require(_0xa9b5('0x13'));var as=require(_0xa9b5('0x14'));var hardwareService=require(_0xa9b5('0x15'));var logger=require(_0xa9b5('0x16'))('api');var utils=require(_0xa9b5('0x17'));var config=require(_0xa9b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cea13,_0xc82666){_0xc82666=_0xc82666||0xcc;return function(_0x244879){if(_0x244879){return _0x4cea13[_0xa9b5('0x19')](_0xc82666);}return _0x4cea13[_0xa9b5('0x1a')](_0xc82666)[_0xa9b5('0x1b')]();};}function respondWithResult(_0x7f1b9a,_0x5cc88f){_0x5cc88f=_0x5cc88f||0xc8;return function(_0x58a170){if(_0x58a170){return _0x7f1b9a[_0xa9b5('0x1a')](_0x5cc88f)[_0xa9b5('0x1c')](_0x58a170);}};}function respondWithFilteredResult(_0x48229c,_0x4be52c){return function(_0x331fab){if(_0x331fab){var _0x3d5606=typeof _0x4be52c[_0xa9b5('0x1d')]===_0xa9b5('0x1e')&&typeof _0x4be52c[_0xa9b5('0x1f')]===_0xa9b5('0x1e');var _0x622156=_0x331fab[_0xa9b5('0x20')];var _0x54c051=_0x3d5606?0x0:_0x4be52c[_0xa9b5('0x1d')];var _0x6ad57d=_0x3d5606?_0x331fab[_0xa9b5('0x20')]:_0x4be52c[_0xa9b5('0x1d')]+_0x4be52c['limit'];var _0x545d14;if(_0x6ad57d>=_0x622156){_0x6ad57d=_0x622156;_0x545d14=0xc8;}else{_0x545d14=0xce;}_0x48229c[_0xa9b5('0x1a')](_0x545d14);return _0x48229c[_0xa9b5('0x21')](_0xa9b5('0x22'),_0x54c051+'-'+_0x6ad57d+'/'+_0x622156)['json'](_0x331fab);}return null;};}function patchUpdates(_0x4a1245){return function(_0x240559){try{jsonpatch[_0xa9b5('0x23')](_0x240559,_0x4a1245,!![]);}catch(_0x9ea6d3){return BPromise[_0xa9b5('0x24')](_0x9ea6d3);}return _0x240559[_0xa9b5('0x25')]();};}function saveUpdates(_0x4d1db4,_0x3f9250){return function(_0x1a981d){if(_0x1a981d){return _0x1a981d[_0xa9b5('0x26')](_0x4d1db4)['then'](function(_0x1f2476){return _0x1f2476;});}return null;};}function removeEntity(_0x57c195,_0x49e369){return function(_0x447da9){if(_0x447da9){return _0x447da9[_0xa9b5('0x27')]()[_0xa9b5('0x28')](function(){_0x57c195[_0xa9b5('0x1a')](0xcc)[_0xa9b5('0x1b')]();});}};}function handleEntityNotFound(_0x5b9612,_0x433dd1){return function(_0x4d57d6){if(!_0x4d57d6){_0x5b9612['sendStatus'](0x194);}return _0x4d57d6;};}function handleError(_0x13a07c,_0x3e4231){_0x3e4231=_0x3e4231||0x1f4;return function(_0x466000){logger[_0xa9b5('0x29')](_0x466000[_0xa9b5('0x2a')]);if(_0x466000['name']){delete _0x466000[_0xa9b5('0x2b')];}_0x13a07c[_0xa9b5('0x1a')](_0x3e4231)['send'](_0x466000);};}exports[_0xa9b5('0x2c')]=function(_0x192a90,_0x5d785d){var _0x354739={},_0x247d58={},_0x262178={'count':0x0,'rows':[]};var _0x15ae19=_['map'](db['DeskConfiguration'][_0xa9b5('0x2d')],function(_0x2a4e59){return{'name':_0x2a4e59[_0xa9b5('0x2e')],'type':_0x2a4e59[_0xa9b5('0x2f')][_0xa9b5('0x30')]};});_0x247d58['model']=_[_0xa9b5('0x31')](_0x15ae19,_0xa9b5('0x2b'));_0x247d58[_0xa9b5('0x32')]=_['keys'](_0x192a90['query']);_0x247d58['filters']=_['intersection'](_0x247d58[_0xa9b5('0x33')],_0x247d58[_0xa9b5('0x32')]);_0x354739[_0xa9b5('0x34')]=_['intersection'](_0x247d58[_0xa9b5('0x33')],qs['fields'](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x354739[_0xa9b5('0x34')]=_0x354739[_0xa9b5('0x34')]['length']?_0x354739[_0xa9b5('0x34')]:_0x247d58[_0xa9b5('0x33')];if(!_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x36')]('nolimit')){_0x354739[_0xa9b5('0x1f')]=qs['limit'](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x354739[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}_0x354739[_0xa9b5('0x37')]=qs['sort'](_0x192a90['query'][_0xa9b5('0x38')]);_0x354739[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x192a90[_0xa9b5('0x32')],_0x247d58['filters']),_0x15ae19);if(_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x354739['where']=_[_0xa9b5('0x3d')](_0x354739[_0xa9b5('0x39')],{'$or':_['map'](_0x15ae19,function(_0x1da417){if(_0x1da417[_0xa9b5('0x2f')]!==_0xa9b5('0x3e')){var _0x47da3e={};_0x47da3e[_0x1da417[_0xa9b5('0x2b')]]={'$like':'%'+_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x47da3e;}})});}_0x354739=_[_0xa9b5('0x3d')]({},_0x354739,_0x192a90[_0xa9b5('0x3f')]);var _0x1311c6={'where':_0x354739[_0xa9b5('0x39')]};return db[_0xa9b5('0x40')]['count'](_0x1311c6)[_0xa9b5('0x28')](function(_0x4f72fd){_0x262178[_0xa9b5('0x20')]=_0x4f72fd;if(_0x192a90[_0xa9b5('0x32')][_0xa9b5('0x41')]){_0x354739[_0xa9b5('0x42')]=[{'all':!![]}];}return db[_0xa9b5('0x40')]['findAll'](_0x354739);})['then'](function(_0x5aa3ed){_0x262178[_0xa9b5('0x43')]=_0x5aa3ed;return _0x262178;})[_0xa9b5('0x28')](respondWithFilteredResult(_0x5d785d,_0x354739))['catch'](handleError(_0x5d785d,null));};exports[_0xa9b5('0x44')]=function(_0x51b239,_0x428088){var _0x37dbba={'raw':![],'where':{'id':_0x51b239[_0xa9b5('0x45')]['id']}},_0x236a56={};_0x236a56[_0xa9b5('0x33')]=_[_0xa9b5('0x46')](db[_0xa9b5('0x40')][_0xa9b5('0x2d')]);_0x236a56[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x51b239[_0xa9b5('0x32')]);_0x236a56[_0xa9b5('0x3a')]=_['intersection'](_0x236a56[_0xa9b5('0x33')],_0x236a56[_0xa9b5('0x32')]);_0x37dbba[_0xa9b5('0x34')]=_['intersection'](_0x236a56[_0xa9b5('0x33')],qs[_0xa9b5('0x35')](_0x51b239[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x37dbba[_0xa9b5('0x34')]=_0x37dbba[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x37dbba[_0xa9b5('0x34')]:_0x236a56[_0xa9b5('0x33')];if(_0x51b239['query'][_0xa9b5('0x41')]){_0x37dbba[_0xa9b5('0x42')]=[{'all':!![]}];}_0x37dbba=_[_0xa9b5('0x3d')]({},_0x37dbba,_0x51b239[_0xa9b5('0x3f')]);return db['DeskConfiguration'][_0xa9b5('0x48')](_0x37dbba)['then'](handleEntityNotFound(_0x428088,null))[_0xa9b5('0x28')](respondWithResult(_0x428088,null))[_0xa9b5('0x49')](handleError(_0x428088,null));};exports[_0xa9b5('0x4a')]=function(_0x57bf4a,_0x53f760){return db[_0xa9b5('0x40')][_0xa9b5('0x4a')](_0x57bf4a[_0xa9b5('0x4b')],{})[_0xa9b5('0x28')](respondWithResult(_0x53f760,0xc9))[_0xa9b5('0x49')](handleError(_0x53f760,null));};exports[_0xa9b5('0x26')]=function(_0x4b9a98,_0x231a62){if(_0x4b9a98[_0xa9b5('0x4b')]['id']){delete _0x4b9a98[_0xa9b5('0x4b')]['id'];}return db[_0xa9b5('0x40')]['find']({'where':{'id':_0x4b9a98[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x231a62,null))[_0xa9b5('0x28')](saveUpdates(_0x4b9a98['body'],null))['then'](respondWithResult(_0x231a62,null))[_0xa9b5('0x49')](handleError(_0x231a62,null));};exports[_0xa9b5('0x27')]=function(_0x244c2b,_0x38815a){return db['DeskConfiguration']['find']({'where':{'id':_0x244c2b[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x38815a,null))['then'](removeEntity(_0x38815a,null))[_0xa9b5('0x49')](handleError(_0x38815a,null));};exports[_0xa9b5('0x4c')]=function(_0x12db8c,_0x1f86cd,_0x123fdc){var _0x36bc0b={};var _0x199929={};var _0x132144;var _0x17d026;return db['DeskConfiguration'][_0xa9b5('0x4d')]({'where':{'id':_0x12db8c[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x1f86cd,null))['then'](function(_0x22c64b){if(_0x22c64b){_0x132144=_0x22c64b;_0x199929['model']=_[_0xa9b5('0x46')](db[_0xa9b5('0x4e')][_0xa9b5('0x2d')]);_0x199929[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x12db8c[_0xa9b5('0x32')]);_0x199929[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x199929[_0xa9b5('0x33')],_0x199929[_0xa9b5('0x32')]);_0x36bc0b[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x199929[_0xa9b5('0x33')],qs['fields'](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x36bc0b['attributes']=_0x36bc0b['attributes'][_0xa9b5('0x47')]?_0x36bc0b[_0xa9b5('0x34')]:_0x199929['model'];_0x36bc0b['order']=qs[_0xa9b5('0x38')](_0x12db8c['query'][_0xa9b5('0x38')]);_0x36bc0b[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x12db8c['query'],_0x199929[_0xa9b5('0x3a')]));if(_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x36bc0b['where']=_['merge'](_0x36bc0b[_0xa9b5('0x39')],{'$or':_[_0xa9b5('0x31')](_0x36bc0b[_0xa9b5('0x34')],function(_0x3a2897){var _0x2f3642={};_0x2f3642[_0x3a2897]={'$like':'%'+_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x2f3642;})});}_0x36bc0b=_[_0xa9b5('0x3d')]({},_0x36bc0b,_0x12db8c[_0xa9b5('0x3f')]);return _0x132144[_0xa9b5('0x4c')](_0x36bc0b);}})[_0xa9b5('0x28')](function(_0x48e50){if(_0x48e50){_0x17d026=_0x48e50['length'];if(!_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x36')]('nolimit')){_0x36bc0b[_0xa9b5('0x1f')]=qs['limit'](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x36bc0b['offset']=qs[_0xa9b5('0x1d')](_0x12db8c[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0x132144[_0xa9b5('0x4c')](_0x36bc0b);}})[_0xa9b5('0x28')](function(_0x4044eb){if(_0x4044eb){return _0x4044eb?{'count':_0x17d026,'rows':_0x4044eb}:null;}})['then'](respondWithResult(_0x1f86cd,null))[_0xa9b5('0x49')](handleError(_0x1f86cd,null));};exports['getSubjects']=function(_0x76f01a,_0x4f6a60,_0x52b8a6){var _0x403e36={};var _0x12a053={};var _0x5c2535;var _0x2fb627;return db[_0xa9b5('0x40')][_0xa9b5('0x4d')]({'where':{'id':_0x76f01a['params']['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x4f6a60,null))['then'](function(_0x5c4356){if(_0x5c4356){_0x5c2535=_0x5c4356;_0x12a053['model']=_['keys'](db['DeskField'][_0xa9b5('0x2d')]);_0x12a053[_0xa9b5('0x32')]=_['keys'](_0x76f01a['query']);_0x12a053[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x12a053[_0xa9b5('0x33')],_0x12a053['query']);_0x403e36[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x12a053[_0xa9b5('0x33')],qs['fields'](_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x403e36[_0xa9b5('0x34')]=_0x403e36[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x403e36[_0xa9b5('0x34')]:_0x12a053[_0xa9b5('0x33')];_0x403e36['order']=qs[_0xa9b5('0x38')](_0x76f01a[_0xa9b5('0x32')]['sort']);_0x403e36[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x76f01a[_0xa9b5('0x32')],_0x12a053[_0xa9b5('0x3a')]));if(_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x403e36[_0xa9b5('0x39')]=_['merge'](_0x403e36['where'],{'$or':_['map'](_0x403e36[_0xa9b5('0x34')],function(_0x16f78d){var _0x1314b4={};_0x1314b4[_0x16f78d]={'$like':'%'+_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0x1314b4;})});}_0x403e36=_[_0xa9b5('0x3d')]({},_0x403e36,_0x76f01a['options']);return _0x5c2535[_0xa9b5('0x50')](_0x403e36);}})[_0xa9b5('0x28')](function(_0x3cc9ba){if(_0x3cc9ba){_0x2fb627=_0x3cc9ba[_0xa9b5('0x47')];if(!_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x36')](_0xa9b5('0x51'))){_0x403e36[_0xa9b5('0x1f')]=qs[_0xa9b5('0x1f')](_0x76f01a['query']['limit']);_0x403e36[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x76f01a[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0x5c2535[_0xa9b5('0x50')](_0x403e36);}})['then'](function(_0x2c1cb9){if(_0x2c1cb9){return _0x2c1cb9?{'count':_0x2fb627,'rows':_0x2c1cb9}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x4f6a60,null))[_0xa9b5('0x49')](handleError(_0x4f6a60,null));};exports[_0xa9b5('0x52')]=function(_0x239d8d,_0x5e10e3,_0x1902d2){var _0x144a67={};var _0x5e257a={};var _0x4727ad;var _0xca6fd7;return db['DeskConfiguration'][_0xa9b5('0x4d')]({'where':{'id':_0x239d8d[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x5e10e3,null))['then'](function(_0x228a50){if(_0x228a50){_0x4727ad=_0x228a50;_0x5e257a[_0xa9b5('0x33')]=_['keys'](db[_0xa9b5('0x4e')][_0xa9b5('0x2d')]);_0x5e257a['query']=_[_0xa9b5('0x46')](_0x239d8d['query']);_0x5e257a[_0xa9b5('0x3a')]=_[_0xa9b5('0x4f')](_0x5e257a[_0xa9b5('0x33')],_0x5e257a[_0xa9b5('0x32')]);_0x144a67[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x5e257a[_0xa9b5('0x33')],qs[_0xa9b5('0x35')](_0x239d8d['query'][_0xa9b5('0x35')]));_0x144a67[_0xa9b5('0x34')]=_0x144a67[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x144a67['attributes']:_0x5e257a[_0xa9b5('0x33')];_0x144a67[_0xa9b5('0x37')]=qs[_0xa9b5('0x38')](_0x239d8d[_0xa9b5('0x32')]['sort']);_0x144a67[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_[_0xa9b5('0x3b')](_0x239d8d[_0xa9b5('0x32')],_0x5e257a[_0xa9b5('0x3a')]));if(_0x239d8d[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x144a67[_0xa9b5('0x39')]=_[_0xa9b5('0x3d')](_0x144a67['where'],{'$or':_['map'](_0x144a67['attributes'],function(_0x47d9ad){var _0x175925={};_0x175925[_0x47d9ad]={'$like':'%'+_0x239d8d['query'][_0xa9b5('0x3c')]+'%'};return _0x175925;})});}_0x144a67=_[_0xa9b5('0x3d')]({},_0x144a67,_0x239d8d['options']);return _0x4727ad[_0xa9b5('0x52')](_0x144a67);}})[_0xa9b5('0x28')](function(_0x4bcf03){if(_0x4bcf03){_0xca6fd7=_0x4bcf03['length'];if(!_0x239d8d['query'][_0xa9b5('0x36')](_0xa9b5('0x51'))){_0x144a67[_0xa9b5('0x1f')]=qs[_0xa9b5('0x1f')](_0x239d8d[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x144a67[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x239d8d['query'][_0xa9b5('0x1d')]);}return _0x4727ad[_0xa9b5('0x52')](_0x144a67);}})[_0xa9b5('0x28')](function(_0xc6d1f4){if(_0xc6d1f4){return _0xc6d1f4?{'count':_0xca6fd7,'rows':_0xc6d1f4}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x5e10e3,null))[_0xa9b5('0x49')](handleError(_0x5e10e3,null));};exports['getTags']=function(_0x938ab2,_0x58f966,_0x98ec2e){var _0x3138fc={};var _0x5857ac={};var _0xfd5838;var _0x4d6afe;return db[_0xa9b5('0x40')][_0xa9b5('0x4d')]({'where':{'id':_0x938ab2[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x58f966,null))[_0xa9b5('0x28')](function(_0x4809f9){if(_0x4809f9){_0xfd5838=_0x4809f9;_0x5857ac[_0xa9b5('0x33')]=_[_0xa9b5('0x46')](db[_0xa9b5('0x53')]['rawAttributes']);_0x5857ac[_0xa9b5('0x32')]=_[_0xa9b5('0x46')](_0x938ab2[_0xa9b5('0x32')]);_0x5857ac[_0xa9b5('0x3a')]=_['intersection'](_0x5857ac[_0xa9b5('0x33')],_0x5857ac[_0xa9b5('0x32')]);_0x3138fc[_0xa9b5('0x34')]=_[_0xa9b5('0x4f')](_0x5857ac['model'],qs[_0xa9b5('0x35')](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x35')]));_0x3138fc[_0xa9b5('0x34')]=_0x3138fc[_0xa9b5('0x34')][_0xa9b5('0x47')]?_0x3138fc[_0xa9b5('0x34')]:_0x5857ac[_0xa9b5('0x33')];_0x3138fc['order']=qs[_0xa9b5('0x38')](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x38')]);_0x3138fc['where']=qs['filters'](_[_0xa9b5('0x3b')](_0x938ab2[_0xa9b5('0x32')],_0x5857ac[_0xa9b5('0x3a')]));if(_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x3c')]){_0x3138fc[_0xa9b5('0x39')]=_[_0xa9b5('0x3d')](_0x3138fc['where'],{'$or':_['map'](_0x3138fc['attributes'],function(_0x98b6a6){var _0xb228ef={};_0xb228ef[_0x98b6a6]={'$like':'%'+_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x3c')]+'%'};return _0xb228ef;})});}_0x3138fc=_[_0xa9b5('0x3d')]({},_0x3138fc,_0x938ab2[_0xa9b5('0x3f')]);return _0xfd5838[_0xa9b5('0x54')](_0x3138fc);}})[_0xa9b5('0x28')](function(_0x4031c3){if(_0x4031c3){_0x4d6afe=_0x4031c3['length'];if(!_0x938ab2['query']['hasOwnProperty'](_0xa9b5('0x51'))){_0x3138fc[_0xa9b5('0x1f')]=qs['limit'](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x1f')]);_0x3138fc[_0xa9b5('0x1d')]=qs['offset'](_0x938ab2[_0xa9b5('0x32')][_0xa9b5('0x1d')]);}return _0xfd5838[_0xa9b5('0x54')](_0x3138fc);}})[_0xa9b5('0x28')](function(_0x5da2ae){if(_0x5da2ae){return _0x5da2ae?{'count':_0x4d6afe,'rows':_0x5da2ae}:null;}})[_0xa9b5('0x28')](respondWithResult(_0x58f966,null))['catch'](handleError(_0x58f966,null));};exports[_0xa9b5('0x55')]=function(_0x5e8f9e,_0x212f6f,_0x413836){if(_0x5e8f9e[_0xa9b5('0x4b')]['id']){delete _0x5e8f9e[_0xa9b5('0x4b')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x5e8f9e[_0xa9b5('0x45')]['id']}})[_0xa9b5('0x28')](handleEntityNotFound(_0x212f6f,null))['then'](function(_0x180e3b){if(_0x180e3b){return _0x180e3b[_0xa9b5('0x55')](_0x5e8f9e['body'][_0xa9b5('0x56')]||[]);}return null;})[_0xa9b5('0x28')](respondWithResult(_0x212f6f,null))[_0xa9b5('0x49')](handleError(_0x212f6f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7d26efa..87f2ffe 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 _0x5418=['util','../../config/logger','api','moment','path','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5418,0xc7));var _0x8541=function(_0x26adc2,_0x213ab4){_0x26adc2=_0x26adc2-0x0;var _0x296234=_0x5418[_0x26adc2];return _0x296234;};'use strict';var _=require(_0x8541('0x0'));var util=require(_0x8541('0x1'));var logger=require(_0x8541('0x2'))(_0x8541('0x3'));var moment=require(_0x8541('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8541('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8541('0x6'));module[_0x8541('0x7')]=function(_0x215114,_0x277b66){return _0x215114[_0x8541('0x8')]('DeskConfiguration',attributes,{'tableName':_0x8541('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb591=['path','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1dd467,_0x4a19b4){var _0x106e44=function(_0x3ef7b7){while(--_0x3ef7b7){_0x1dd467['push'](_0x1dd467['shift']());}};_0x106e44(++_0x4a19b4);}(_0xb591,0xa2));var _0x1b59=function(_0x1ef0d1,_0x5a856c){_0x1ef0d1=_0x1ef0d1-0x0;var _0x1d1e85=_0xb591[_0x1ef0d1];return _0x1d1e85;};'use strict';var _=require(_0x1b59('0x0'));var util=require(_0x1b59('0x1'));var logger=require(_0x1b59('0x2'))(_0x1b59('0x3'));var moment=require(_0x1b59('0x4'));var BPromise=require(_0x1b59('0x5'));var rp=require(_0x1b59('0x6'));var fs=require('fs');var path=require(_0x1b59('0x7'));var rimraf=require('rimraf');var config=require(_0x1b59('0x8'));var attributes=require(_0x1b59('0x9'));module[_0x1b59('0xa')]=function(_0x55b257,_0x52a950){return _0x55b257['define'](_0x1b59('0xb'),attributes,{'tableName':_0x1b59('0xc'),'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 b264869..fcd3b21 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 _0x1f3c=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1fa968,_0x1085f2){var _0x552365=function(_0x4969e5){while(--_0x4969e5){_0x1fa968['push'](_0x1fa968['shift']());}};_0x552365(++_0x1085f2);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x1f3c[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var moment=require(_0xc1f3('0x2'));var BPromise=require(_0xc1f3('0x3'));var rs=require(_0xc1f3('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('../../config/environment');var jayson=require(_0xc1f3('0x5'));var client=jayson['client'][_0xc1f3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x245eff,_0x47949a,_0x1ecd80){return new BPromise(function(_0x3d0978,_0x48c5a7){return client[_0xc1f3('0x7')](_0x245eff,_0x1ecd80)[_0xc1f3('0x8')](function(_0x3ad994){logger[_0xc1f3('0x9')](_0xc1f3('0xa'),_0x47949a,_0xc1f3('0xb'));logger[_0xc1f3('0xc')](_0xc1f3('0xd'),_0x47949a,_0xc1f3('0xb'),JSON[_0xc1f3('0xe')](_0x3ad994));if(_0x3ad994[_0xc1f3('0xf')]){if(_0x3ad994[_0xc1f3('0xf')]['code']===0x1f4){logger[_0xc1f3('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x47949a,_0x3ad994[_0xc1f3('0xf')]['message']);return _0x48c5a7(_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);}logger[_0xc1f3('0xf')](_0xc1f3('0xa'),_0x47949a,_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);return _0x3d0978(_0x3ad994[_0xc1f3('0xf')][_0xc1f3('0x10')]);}else{logger[_0xc1f3('0x9')](_0xc1f3('0xa'),_0x47949a,_0xc1f3('0xb'));_0x3d0978(_0x3ad994[_0xc1f3('0x11')][_0xc1f3('0x10')]);}})[_0xc1f3('0x12')](function(_0x1d0bbf){logger[_0xc1f3('0xf')](_0xc1f3('0xa'),_0x47949a,_0x1d0bbf);_0x48c5a7(_0x1d0bbf);});});} \ No newline at end of file +var _0x2b84=['jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x408e97,_0x4b23e2){var _0x227b62=function(_0x5477a4){while(--_0x5477a4){_0x408e97['push'](_0x408e97['shift']());}};_0x227b62(++_0x4b23e2);}(_0x2b84,0x1ed));var _0x42b8=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2b84[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x42b8('0x0'));var util=require(_0x42b8('0x1'));var moment=require('moment');var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require('../../config/logger')(_0x42b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x42b8('0x7'));var client=jayson[_0x42b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a040d,_0x399f8e,_0x23459e){return new BPromise(function(_0x1c6323,_0x38de8a){return client[_0x42b8('0x9')](_0x4a040d,_0x23459e)['then'](function(_0x381f1a){logger[_0x42b8('0xa')](_0x42b8('0xb'),_0x399f8e,_0x42b8('0xc'));logger[_0x42b8('0xd')](_0x42b8('0xe'),_0x399f8e,_0x42b8('0xc'),JSON[_0x42b8('0xf')](_0x381f1a));if(_0x381f1a['error']){if(_0x381f1a['error'][_0x42b8('0x10')]===0x1f4){logger[_0x42b8('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x399f8e,_0x381f1a[_0x42b8('0x11')]['message']);return _0x38de8a(_0x381f1a['error'][_0x42b8('0x12')]);}logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x381f1a[_0x42b8('0x11')][_0x42b8('0x12')]);return _0x1c6323(_0x381f1a['error'][_0x42b8('0x12')]);}else{logger['info'](_0x42b8('0xb'),_0x399f8e,'request\x20sent');_0x1c6323(_0x381f1a['result'][_0x42b8('0x12')]);}})[_0x42b8('0x13')](function(_0x2d1706){logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x2d1706);_0x38de8a(_0x2d1706);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0090fe8..fd0a3ff 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 _0x6ef1=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x19a47d,_0x39fa00){var _0x7f8140=function(_0x5f095c){while(--_0x5f095c){_0x19a47d['push'](_0x19a47d['shift']());}};_0x7f8140(++_0x39fa00);}(_0x6ef1,0xac));var _0x16ef=function(_0x8f1b64,_0x6b7c8e){_0x8f1b64=_0x8f1b64-0x0;var _0x130c71=_0x6ef1[_0x8f1b64];return _0x130c71;};'use strict';var multer=require(_0x16ef('0x0'));var util=require(_0x16ef('0x1'));var path=require(_0x16ef('0x2'));var timeout=require(_0x16ef('0x3'));var express=require(_0x16ef('0x4'));var router=express[_0x16ef('0x5')]();var fs_extra=require(_0x16ef('0x6'));var auth=require(_0x16ef('0x7'));var interaction=require(_0x16ef('0x8'));var config=require(_0x16ef('0x9'));var controller=require(_0x16ef('0xa'));router['get']('/',auth[_0x16ef('0xb')](),controller[_0x16ef('0xc')]);router[_0x16ef('0xd')](_0x16ef('0xe'),auth['isAuthenticated'](),controller[_0x16ef('0xf')]);router[_0x16ef('0x10')]('/',auth[_0x16ef('0xb')](),controller[_0x16ef('0x11')]);router['put'](_0x16ef('0xe'),auth[_0x16ef('0xb')](),controller['update']);router[_0x16ef('0x12')](_0x16ef('0xe'),auth[_0x16ef('0xb')](),controller[_0x16ef('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2bdb=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','show','post','create','/:id','update','delete','destroy','multer','util','path'];(function(_0x4da09b,_0x3a8749){var _0x4b36d8=function(_0x36b932){while(--_0x36b932){_0x4da09b['push'](_0x4da09b['shift']());}};_0x4b36d8(++_0x3a8749);}(_0x2bdb,0x1e3));var _0xb2bd=function(_0x5782c2,_0x498d40){_0x5782c2=_0x5782c2-0x0;var _0x161669=_0x2bdb[_0x5782c2];return _0x161669;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require(_0xb2bd('0x1'));var path=require(_0xb2bd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x3'));var router=express[_0xb2bd('0x4')]();var fs_extra=require(_0xb2bd('0x5'));var auth=require(_0xb2bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb2bd('0x7'));var controller=require(_0xb2bd('0x8'));router['get']('/',auth[_0xb2bd('0x9')](),controller['index']);router[_0xb2bd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb2bd('0xb')]);router[_0xb2bd('0xc')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xd')]);router['put'](_0xb2bd('0xe'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xf')]);router[_0xb2bd('0x10')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);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 29978ef..ca18e1f 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 _0x8757=['exports','ENUM','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x8757,0x157));var _0x7875=function(_0x47ae02,_0x4f7ff8){_0x47ae02=_0x47ae02-0x0;var _0x4df61d=_0x8757[_0x47ae02];return _0x4df61d;};'use strict';var Sequelize=require(_0x7875('0x0'));module[_0x7875('0x1')]={'type':{'type':Sequelize[_0x7875('0x2')](_0x7875('0x3'),_0x7875('0x4'),_0x7875('0x5'),'keyValue',_0x7875('0x6')),'defaultValue':_0x7875('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7875('0x7')]},'keyType':{'type':Sequelize[_0x7875('0x2')]('string',_0x7875('0x4'),_0x7875('0x5'))},'keyContent':{'type':Sequelize[_0x7875('0x7')]},'idField':{'type':Sequelize[_0x7875('0x7')]},'nameField':{'type':Sequelize[_0x7875('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7875('0x7')]}}; \ No newline at end of file +var _0xc0ec=['STRING','variable','BOOLEAN','ENUM','customVariable','picklist','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0ec,0xb2));var _0xcc0e=function(_0x2094a5,_0x40f4f4){_0x2094a5=_0x2094a5-0x0;var _0x17826d=_0xc0ec[_0x2094a5];return _0x17826d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xcc0e('0x0')]('string','variable',_0xcc0e('0x1'),'keyValue',_0xcc0e('0x2')),'defaultValue':_0xcc0e('0x3')},'content':{'type':Sequelize[_0xcc0e('0x4')]},'key':{'type':Sequelize[_0xcc0e('0x4')]},'keyType':{'type':Sequelize[_0xcc0e('0x0')]('string',_0xcc0e('0x5'),_0xcc0e('0x1'))},'keyContent':{'type':Sequelize[_0xcc0e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc0e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc0e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index f740a92..1068228 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 _0xda1e=['DeskField','includeAll','include','rows','then','catch','show','params','rawAttributes','length','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xda1e,0xeb));var _0xeda1=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0xda1e[_0x33c70e];return _0x5a33e5;};'use strict';var emlformat=require(_0xeda1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeda1('0x1'));var jsonpatch=require(_0xeda1('0x2'));var rp=require(_0xeda1('0x3'));var moment=require(_0xeda1('0x4'));var BPromise=require(_0xeda1('0x5'));var Mustache=require(_0xeda1('0x6'));var util=require(_0xeda1('0x7'));var path=require(_0xeda1('0x8'));var sox=require(_0xeda1('0x9'));var csv=require('to-csv');var ejs=require(_0xeda1('0xa'));var fs=require('fs');var fs_extra=require(_0xeda1('0xb'));var _=require(_0xeda1('0xc'));var squel=require(_0xeda1('0xd'));var crypto=require(_0xeda1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeda1('0xf'));var Papa=require(_0xeda1('0x10'));var Redis=require(_0xeda1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeda1('0x12'));var as=require(_0xeda1('0x13'));var hardwareService=require(_0xeda1('0x14'));var logger=require(_0xeda1('0x15'))(_0xeda1('0x16'));var utils=require(_0xeda1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeda1('0x18'))['db'];function respondWithStatusCode(_0x22253c,_0x28bbb2){_0x28bbb2=_0x28bbb2||0xcc;return function(_0x309d9e){if(_0x309d9e){return _0x22253c['sendStatus'](_0x28bbb2);}return _0x22253c['status'](_0x28bbb2)[_0xeda1('0x19')]();};}function respondWithResult(_0x47ef41,_0x488605){_0x488605=_0x488605||0xc8;return function(_0x31ac85){if(_0x31ac85){return _0x47ef41[_0xeda1('0x1a')](_0x488605)[_0xeda1('0x1b')](_0x31ac85);}};}function respondWithFilteredResult(_0x1e399e,_0x574333){return function(_0x14d61e){if(_0x14d61e){var _0x76b6e4=typeof _0x574333[_0xeda1('0x1c')]===_0xeda1('0x1d')&&typeof _0x574333[_0xeda1('0x1e')]===_0xeda1('0x1d');var _0x3fa47b=_0x14d61e[_0xeda1('0x1f')];var _0x1fd8f5=_0x76b6e4?0x0:_0x574333['offset'];var _0x54cdc6=_0x76b6e4?_0x14d61e['count']:_0x574333[_0xeda1('0x1c')]+_0x574333[_0xeda1('0x1e')];var _0x1f3646;if(_0x54cdc6>=_0x3fa47b){_0x54cdc6=_0x3fa47b;_0x1f3646=0xc8;}else{_0x1f3646=0xce;}_0x1e399e[_0xeda1('0x1a')](_0x1f3646);return _0x1e399e[_0xeda1('0x20')](_0xeda1('0x21'),_0x1fd8f5+'-'+_0x54cdc6+'/'+_0x3fa47b)['json'](_0x14d61e);}return null;};}function patchUpdates(_0x517b82){return function(_0x3f3638){try{jsonpatch[_0xeda1('0x22')](_0x3f3638,_0x517b82,!![]);}catch(_0x723334){return BPromise[_0xeda1('0x23')](_0x723334);}return _0x3f3638[_0xeda1('0x24')]();};}function saveUpdates(_0x39f93f,_0x3f7075){return function(_0x55a554){if(_0x55a554){return _0x55a554[_0xeda1('0x25')](_0x39f93f)['then'](function(_0x2caf24){return _0x2caf24;});}return null;};}function removeEntity(_0x4b1ea7,_0x18f70b){return function(_0x4e754c){if(_0x4e754c){return _0x4e754c['destroy']()['then'](function(){_0x4b1ea7[_0xeda1('0x1a')](0xcc)[_0xeda1('0x19')]();});}};}function handleEntityNotFound(_0x472595,_0xf8eedb){return function(_0x2300d0){if(!_0x2300d0){_0x472595[_0xeda1('0x26')](0x194);}return _0x2300d0;};}function handleError(_0x2f7213,_0xade676){_0xade676=_0xade676||0x1f4;return function(_0x2bb03d){logger['error'](_0x2bb03d['stack']);if(_0x2bb03d[_0xeda1('0x27')]){delete _0x2bb03d['name'];}_0x2f7213[_0xeda1('0x1a')](_0xade676)[_0xeda1('0x28')](_0x2bb03d);};}exports[_0xeda1('0x29')]=function(_0x5e057e,_0x44f7f9){var _0x128e4f={},_0x218e64={},_0xcc81df={'count':0x0,'rows':[]};var _0x2b11dd=_[_0xeda1('0x2a')](db['DeskField']['rawAttributes'],function(_0xab7490){return{'name':_0xab7490[_0xeda1('0x2b')],'type':_0xab7490[_0xeda1('0x2c')][_0xeda1('0x2d')]};});_0x218e64[_0xeda1('0x2e')]=_[_0xeda1('0x2a')](_0x2b11dd,_0xeda1('0x27'));_0x218e64[_0xeda1('0x2f')]=_[_0xeda1('0x30')](_0x5e057e[_0xeda1('0x2f')]);_0x218e64['filters']=_['intersection'](_0x218e64[_0xeda1('0x2e')],_0x218e64[_0xeda1('0x2f')]);_0x128e4f[_0xeda1('0x31')]=_[_0xeda1('0x32')](_0x218e64[_0xeda1('0x2e')],qs[_0xeda1('0x33')](_0x5e057e[_0xeda1('0x2f')][_0xeda1('0x33')]));_0x128e4f[_0xeda1('0x31')]=_0x128e4f[_0xeda1('0x31')]['length']?_0x128e4f[_0xeda1('0x31')]:_0x218e64[_0xeda1('0x2e')];if(!_0x5e057e[_0xeda1('0x2f')][_0xeda1('0x34')](_0xeda1('0x35'))){_0x128e4f[_0xeda1('0x1e')]=qs['limit'](_0x5e057e[_0xeda1('0x2f')][_0xeda1('0x1e')]);_0x128e4f[_0xeda1('0x1c')]=qs[_0xeda1('0x1c')](_0x5e057e[_0xeda1('0x2f')][_0xeda1('0x1c')]);}_0x128e4f[_0xeda1('0x36')]=qs['sort'](_0x5e057e[_0xeda1('0x2f')][_0xeda1('0x37')]);_0x128e4f[_0xeda1('0x38')]=qs[_0xeda1('0x39')](_['pick'](_0x5e057e['query'],_0x218e64['filters']),_0x2b11dd);if(_0x5e057e['query'][_0xeda1('0x3a')]){_0x128e4f[_0xeda1('0x38')]=_[_0xeda1('0x3b')](_0x128e4f[_0xeda1('0x38')],{'$or':_['map'](_0x2b11dd,function(_0x3b8204){if(_0x3b8204[_0xeda1('0x2c')]!=='VIRTUAL'){var _0x30a00f={};_0x30a00f[_0x3b8204[_0xeda1('0x27')]]={'$like':'%'+_0x5e057e[_0xeda1('0x2f')]['filter']+'%'};return _0x30a00f;}})});}_0x128e4f=_[_0xeda1('0x3b')]({},_0x128e4f,_0x5e057e[_0xeda1('0x3c')]);var _0x218147={'where':_0x128e4f[_0xeda1('0x38')]};return db[_0xeda1('0x3d')][_0xeda1('0x1f')](_0x218147)['then'](function(_0x3e3786){_0xcc81df['count']=_0x3e3786;if(_0x5e057e['query'][_0xeda1('0x3e')]){_0x128e4f[_0xeda1('0x3f')]=[{'all':!![]}];}return db[_0xeda1('0x3d')]['findAll'](_0x128e4f);})['then'](function(_0x1ce791){_0xcc81df[_0xeda1('0x40')]=_0x1ce791;return _0xcc81df;})[_0xeda1('0x41')](respondWithFilteredResult(_0x44f7f9,_0x128e4f))[_0xeda1('0x42')](handleError(_0x44f7f9,null));};exports[_0xeda1('0x43')]=function(_0x464e35,_0x149480){var _0x475b0d={'raw':!![],'where':{'id':_0x464e35[_0xeda1('0x44')]['id']}},_0x16e3cf={};_0x16e3cf[_0xeda1('0x2e')]=_[_0xeda1('0x30')](db[_0xeda1('0x3d')][_0xeda1('0x45')]);_0x16e3cf[_0xeda1('0x2f')]=_[_0xeda1('0x30')](_0x464e35[_0xeda1('0x2f')]);_0x16e3cf[_0xeda1('0x39')]=_[_0xeda1('0x32')](_0x16e3cf[_0xeda1('0x2e')],_0x16e3cf['query']);_0x475b0d[_0xeda1('0x31')]=_[_0xeda1('0x32')](_0x16e3cf[_0xeda1('0x2e')],qs[_0xeda1('0x33')](_0x464e35[_0xeda1('0x2f')][_0xeda1('0x33')]));_0x475b0d[_0xeda1('0x31')]=_0x475b0d[_0xeda1('0x31')][_0xeda1('0x46')]?_0x475b0d[_0xeda1('0x31')]:_0x16e3cf[_0xeda1('0x2e')];if(_0x464e35['query']['includeAll']){_0x475b0d[_0xeda1('0x3f')]=[{'all':!![]}];}_0x475b0d=_[_0xeda1('0x3b')]({},_0x475b0d,_0x464e35[_0xeda1('0x3c')]);return db['DeskField']['find'](_0x475b0d)['then'](handleEntityNotFound(_0x149480,null))[_0xeda1('0x41')](respondWithResult(_0x149480,null))['catch'](handleError(_0x149480,null));};exports['create']=function(_0x35942f,_0x1cc400){return db[_0xeda1('0x3d')][_0xeda1('0x47')](_0x35942f[_0xeda1('0x48')],{})[_0xeda1('0x41')](respondWithResult(_0x1cc400,0xc9))[_0xeda1('0x42')](handleError(_0x1cc400,null));};exports[_0xeda1('0x25')]=function(_0x5e7934,_0xaef5e6){if(_0x5e7934['body']['id']){delete _0x5e7934[_0xeda1('0x48')]['id'];}return db[_0xeda1('0x3d')]['find']({'where':{'id':_0x5e7934['params']['id']}})['then'](handleEntityNotFound(_0xaef5e6,null))[_0xeda1('0x41')](saveUpdates(_0x5e7934[_0xeda1('0x48')],null))[_0xeda1('0x41')](respondWithResult(_0xaef5e6,null))[_0xeda1('0x42')](handleError(_0xaef5e6,null));};exports[_0xeda1('0x49')]=function(_0x57a457,_0x31aaea){return db['DeskField']['find']({'where':{'id':_0x57a457[_0xeda1('0x44')]['id']}})['then'](handleEntityNotFound(_0x31aaea,null))[_0xeda1('0x41')](removeEntity(_0x31aaea,null))[_0xeda1('0x42')](handleError(_0x31aaea,null));}; \ No newline at end of file +var _0x3bf5=['destroy','error','name','send','map','DeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','find','catch','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','then'];(function(_0x1eeb15,_0x539688){var _0x12a9ce=function(_0x3933de){while(--_0x3933de){_0x1eeb15['push'](_0x1eeb15['shift']());}};_0x12a9ce(++_0x539688);}(_0x3bf5,0x17e));var _0x53bf=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x3bf5[_0x17b0d4];return _0x2d02c7;};'use strict';var emlformat=require(_0x53bf('0x0'));var rimraf=require(_0x53bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53bf('0x2'));var rp=require(_0x53bf('0x3'));var moment=require('moment');var BPromise=require(_0x53bf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53bf('0x5'));var sox=require(_0x53bf('0x6'));var csv=require(_0x53bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53bf('0x8'));var squel=require(_0x53bf('0x9'));var crypto=require(_0x53bf('0xa'));var jsforce=require(_0x53bf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x53bf('0x7'));var querystring=require(_0x53bf('0xc'));var Papa=require(_0x53bf('0xd'));var Redis=require('ioredis');var authService=require(_0x53bf('0xe'));var qs=require(_0x53bf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53bf('0x10'));var logger=require(_0x53bf('0x11'))(_0x53bf('0x12'));var utils=require(_0x53bf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x53bf('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3fa47,_0x2a1596){_0x2a1596=_0x2a1596||0xcc;return function(_0x37b4dd){if(_0x37b4dd){return _0xf3fa47[_0x53bf('0x15')](_0x2a1596);}return _0xf3fa47['status'](_0x2a1596)[_0x53bf('0x16')]();};}function respondWithResult(_0x7413a9,_0x14ebcc){_0x14ebcc=_0x14ebcc||0xc8;return function(_0x51c9d0){if(_0x51c9d0){return _0x7413a9[_0x53bf('0x17')](_0x14ebcc)[_0x53bf('0x18')](_0x51c9d0);}};}function respondWithFilteredResult(_0x2a3638,_0x4d304c){return function(_0x19dd62){if(_0x19dd62){var _0x5b7fbe=typeof _0x4d304c[_0x53bf('0x19')]===_0x53bf('0x1a')&&typeof _0x4d304c[_0x53bf('0x1b')]===_0x53bf('0x1a');var _0x382570=_0x19dd62['count'];var _0x58964a=_0x5b7fbe?0x0:_0x4d304c[_0x53bf('0x19')];var _0x2f05ed=_0x5b7fbe?_0x19dd62['count']:_0x4d304c[_0x53bf('0x19')]+_0x4d304c[_0x53bf('0x1b')];var _0xf6f7b0;if(_0x2f05ed>=_0x382570){_0x2f05ed=_0x382570;_0xf6f7b0=0xc8;}else{_0xf6f7b0=0xce;}_0x2a3638['status'](_0xf6f7b0);return _0x2a3638['set'](_0x53bf('0x1c'),_0x58964a+'-'+_0x2f05ed+'/'+_0x382570)[_0x53bf('0x18')](_0x19dd62);}return null;};}function patchUpdates(_0x12c3fc){return function(_0x31fe18){try{jsonpatch[_0x53bf('0x1d')](_0x31fe18,_0x12c3fc,!![]);}catch(_0x3af640){return BPromise['reject'](_0x3af640);}return _0x31fe18[_0x53bf('0x1e')]();};}function saveUpdates(_0xe381f3,_0x5bb33a){return function(_0x4478a0){if(_0x4478a0){return _0x4478a0['update'](_0xe381f3)[_0x53bf('0x1f')](function(_0x16f3af){return _0x16f3af;});}return null;};}function removeEntity(_0x179303,_0x2b9bde){return function(_0xdd4f0){if(_0xdd4f0){return _0xdd4f0[_0x53bf('0x20')]()[_0x53bf('0x1f')](function(){_0x179303[_0x53bf('0x17')](0xcc)[_0x53bf('0x16')]();});}};}function handleEntityNotFound(_0x23807d,_0xff6011){return function(_0x52f0df){if(!_0x52f0df){_0x23807d[_0x53bf('0x15')](0x194);}return _0x52f0df;};}function handleError(_0x20b5ed,_0x58005c){_0x58005c=_0x58005c||0x1f4;return function(_0x1e9a60){logger[_0x53bf('0x21')](_0x1e9a60['stack']);if(_0x1e9a60[_0x53bf('0x22')]){delete _0x1e9a60[_0x53bf('0x22')];}_0x20b5ed[_0x53bf('0x17')](_0x58005c)[_0x53bf('0x23')](_0x1e9a60);};}exports['index']=function(_0x2b643e,_0xf18bd5){var _0x53de98={},_0x46555b={},_0x153f12={'count':0x0,'rows':[]};var _0x41f2c3=_[_0x53bf('0x24')](db[_0x53bf('0x25')][_0x53bf('0x26')],function(_0x5f368a){return{'name':_0x5f368a[_0x53bf('0x27')],'type':_0x5f368a[_0x53bf('0x28')][_0x53bf('0x29')]};});_0x46555b['model']=_[_0x53bf('0x24')](_0x41f2c3,'name');_0x46555b['query']=_[_0x53bf('0x2a')](_0x2b643e[_0x53bf('0x2b')]);_0x46555b[_0x53bf('0x2c')]=_[_0x53bf('0x2d')](_0x46555b[_0x53bf('0x2e')],_0x46555b[_0x53bf('0x2b')]);_0x53de98['attributes']=_[_0x53bf('0x2d')](_0x46555b[_0x53bf('0x2e')],qs[_0x53bf('0x2f')](_0x2b643e['query'][_0x53bf('0x2f')]));_0x53de98[_0x53bf('0x30')]=_0x53de98[_0x53bf('0x30')][_0x53bf('0x31')]?_0x53de98['attributes']:_0x46555b[_0x53bf('0x2e')];if(!_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x32')](_0x53bf('0x33'))){_0x53de98[_0x53bf('0x1b')]=qs[_0x53bf('0x1b')](_0x2b643e['query'][_0x53bf('0x1b')]);_0x53de98[_0x53bf('0x19')]=qs[_0x53bf('0x19')](_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x19')]);}_0x53de98[_0x53bf('0x34')]=qs[_0x53bf('0x35')](_0x2b643e['query'][_0x53bf('0x35')]);_0x53de98['where']=qs[_0x53bf('0x2c')](_['pick'](_0x2b643e[_0x53bf('0x2b')],_0x46555b[_0x53bf('0x2c')]),_0x41f2c3);if(_0x2b643e[_0x53bf('0x2b')]['filter']){_0x53de98[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0x53de98['where'],{'$or':_[_0x53bf('0x24')](_0x41f2c3,function(_0x33a79b){if(_0x33a79b[_0x53bf('0x28')]!==_0x53bf('0x38')){var _0x30887a={};_0x30887a[_0x33a79b[_0x53bf('0x22')]]={'$like':'%'+_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x39')]+'%'};return _0x30887a;}})});}_0x53de98=_['merge']({},_0x53de98,_0x2b643e[_0x53bf('0x3a')]);var _0xdded86={'where':_0x53de98[_0x53bf('0x36')]};return db['DeskField']['count'](_0xdded86)[_0x53bf('0x1f')](function(_0x1cf4ad){_0x153f12[_0x53bf('0x3b')]=_0x1cf4ad;if(_0x2b643e[_0x53bf('0x2b')][_0x53bf('0x3c')]){_0x53de98['include']=[{'all':!![]}];}return db[_0x53bf('0x25')][_0x53bf('0x3d')](_0x53de98);})[_0x53bf('0x1f')](function(_0x30fd31){_0x153f12[_0x53bf('0x3e')]=_0x30fd31;return _0x153f12;})['then'](respondWithFilteredResult(_0xf18bd5,_0x53de98))['catch'](handleError(_0xf18bd5,null));};exports[_0x53bf('0x3f')]=function(_0x105702,_0x58f13e){var _0x2d62a7={'raw':!![],'where':{'id':_0x105702['params']['id']}},_0x52105b={};_0x52105b['model']=_[_0x53bf('0x2a')](db[_0x53bf('0x25')]['rawAttributes']);_0x52105b[_0x53bf('0x2b')]=_['keys'](_0x105702['query']);_0x52105b[_0x53bf('0x2c')]=_[_0x53bf('0x2d')](_0x52105b[_0x53bf('0x2e')],_0x52105b['query']);_0x2d62a7[_0x53bf('0x30')]=_['intersection'](_0x52105b['model'],qs[_0x53bf('0x2f')](_0x105702['query'][_0x53bf('0x2f')]));_0x2d62a7[_0x53bf('0x30')]=_0x2d62a7[_0x53bf('0x30')][_0x53bf('0x31')]?_0x2d62a7[_0x53bf('0x30')]:_0x52105b[_0x53bf('0x2e')];if(_0x105702['query']['includeAll']){_0x2d62a7['include']=[{'all':!![]}];}_0x2d62a7=_[_0x53bf('0x37')]({},_0x2d62a7,_0x105702['options']);return db[_0x53bf('0x25')][_0x53bf('0x40')](_0x2d62a7)['then'](handleEntityNotFound(_0x58f13e,null))[_0x53bf('0x1f')](respondWithResult(_0x58f13e,null))[_0x53bf('0x41')](handleError(_0x58f13e,null));};exports['create']=function(_0xcc1f83,_0x57fda7){return db[_0x53bf('0x25')]['create'](_0xcc1f83[_0x53bf('0x42')],{})[_0x53bf('0x1f')](respondWithResult(_0x57fda7,0xc9))['catch'](handleError(_0x57fda7,null));};exports[_0x53bf('0x43')]=function(_0x2430bb,_0x2553ff){if(_0x2430bb[_0x53bf('0x42')]['id']){delete _0x2430bb[_0x53bf('0x42')]['id'];}return db[_0x53bf('0x25')][_0x53bf('0x40')]({'where':{'id':_0x2430bb[_0x53bf('0x44')]['id']}})[_0x53bf('0x1f')](handleEntityNotFound(_0x2553ff,null))[_0x53bf('0x1f')](saveUpdates(_0x2430bb[_0x53bf('0x42')],null))['then'](respondWithResult(_0x2553ff,null))[_0x53bf('0x41')](handleError(_0x2553ff,null));};exports[_0x53bf('0x20')]=function(_0x5459da,_0x4f0540){return db[_0x53bf('0x25')][_0x53bf('0x40')]({'where':{'id':_0x5459da['params']['id']}})[_0x53bf('0x1f')](handleEntityNotFound(_0x4f0540,null))[_0x53bf('0x1f')](removeEntity(_0x4f0540,null))[_0x53bf('0x41')](handleError(_0x4f0540,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e25e0f3..4f856ff 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 _0x3506=['DeskField','int_desk_fields','idField','FieldId','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x3506,0xc7));var _0x6350=function(_0x359ed9,_0xefc385){_0x359ed9=_0x359ed9-0x0;var _0x29621c=_0x3506[_0x359ed9];return _0x29621c;};'use strict';var _=require(_0x6350('0x0'));var util=require(_0x6350('0x1'));var logger=require('../../config/logger')(_0x6350('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6350('0x3'));var fs=require('fs');var path=require(_0x6350('0x4'));var rimraf=require(_0x6350('0x5'));var config=require(_0x6350('0x6'));var attributes=require(_0x6350('0x7'));module['exports']=function(_0x1c034e,_0x1ee7b2){return _0x1c034e[_0x6350('0x8')](_0x6350('0x9'),attributes,{'tableName':_0x6350('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6350('0xb'),_0x6350('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f8b=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x147656,_0x2480fc){var _0x43df2f=function(_0x525c28){while(--_0x525c28){_0x147656['push'](_0x147656['shift']());}};_0x43df2f(++_0x2480fc);}(_0x2f8b,0x1e2));var _0xb2f8=function(_0x5d3815,_0x41f35b){_0x5d3815=_0x5d3815-0x0;var _0x2275ee=_0x2f8b[_0x5d3815];return _0x2275ee;};'use strict';var _=require('lodash');var util=require(_0xb2f8('0x0'));var logger=require(_0xb2f8('0x1'))(_0xb2f8('0x2'));var moment=require(_0xb2f8('0x3'));var BPromise=require(_0xb2f8('0x4'));var rp=require(_0xb2f8('0x5'));var fs=require('fs');var path=require(_0xb2f8('0x6'));var rimraf=require(_0xb2f8('0x7'));var config=require(_0xb2f8('0x8'));var attributes=require(_0xb2f8('0x9'));module[_0xb2f8('0xa')]=function(_0x36368b,_0x4b860a){return _0x36368b[_0xb2f8('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xb2f8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 2d16810..beabf09 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 _0x1504=['then','DeskField,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1504,0x1d6));var _0x4150=function(_0x2137c7,_0x1c2b5a){_0x2137c7=_0x2137c7-0x0;var _0x466a90=_0x1504[_0x2137c7];return _0x466a90;};'use strict';var _=require(_0x4150('0x0'));var util=require(_0x4150('0x1'));var moment=require(_0x4150('0x2'));var BPromise=require(_0x4150('0x3'));var rs=require(_0x4150('0x4'));var fs=require('fs');var Redis=require(_0x4150('0x5'));var db=require(_0x4150('0x6'))['db'];var utils=require(_0x4150('0x7'));var logger=require('../../config/logger')(_0x4150('0x8'));var config=require('../../config/environment');var jayson=require(_0x4150('0x9'));var client=jayson[_0x4150('0xa')][_0x4150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d1178,_0x1ed13b,_0x44acd9){return new BPromise(function(_0x5ea6f1,_0x3f108d){return client[_0x4150('0xc')](_0x1d1178,_0x44acd9)[_0x4150('0xd')](function(_0x4b0753){logger['info'](_0x4150('0xe'),_0x1ed13b,_0x4150('0xf'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x1ed13b,'request\x20sent',JSON['stringify'](_0x4b0753));if(_0x4b0753[_0x4150('0x10')]){if(_0x4b0753[_0x4150('0x10')]['code']===0x1f4){logger[_0x4150('0x10')](_0x4150('0xe'),_0x1ed13b,_0x4b0753[_0x4150('0x10')][_0x4150('0x11')]);return _0x3f108d(_0x4b0753['error'][_0x4150('0x11')]);}logger[_0x4150('0x10')](_0x4150('0xe'),_0x1ed13b,_0x4b0753['error'][_0x4150('0x11')]);return _0x5ea6f1(_0x4b0753[_0x4150('0x10')]['message']);}else{logger[_0x4150('0x12')](_0x4150('0xe'),_0x1ed13b,_0x4150('0xf'));_0x5ea6f1(_0x4b0753[_0x4150('0x13')]['message']);}})[_0x4150('0x14')](function(_0x245d70){logger[_0x4150('0x10')](_0x4150('0xe'),_0x1ed13b,_0x245d70);_0x3f108d(_0x245d70);});});} \ No newline at end of file +var _0xcf21=['debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x36cd93,_0x593481){var _0x10f6cd=function(_0x1c3aa3){while(--_0x1c3aa3){_0x36cd93['push'](_0x36cd93['shift']());}};_0x10f6cd(++_0x593481);}(_0xcf21,0x8c));var _0x1cf2=function(_0x419dd2,_0x4c2bb8){_0x419dd2=_0x419dd2-0x0;var _0x345587=_0xcf21[_0x419dd2];return _0x345587;};'use strict';var _=require(_0x1cf2('0x0'));var util=require('util');var moment=require(_0x1cf2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cf2('0x2'))['db'];var utils=require(_0x1cf2('0x3'));var logger=require(_0x1cf2('0x4'))(_0x1cf2('0x5'));var config=require(_0x1cf2('0x6'));var jayson=require(_0x1cf2('0x7'));var client=jayson[_0x1cf2('0x8')][_0x1cf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f91,_0x2a0e86,_0x1b9ff4){return new BPromise(function(_0x1c0fdd,_0x2cee51){return client[_0x1cf2('0xa')](_0x1b6f91,_0x1b9ff4)[_0x1cf2('0xb')](function(_0x1346cc){logger[_0x1cf2('0xc')]('DeskField,\x20%s,\x20%s',_0x2a0e86,_0x1cf2('0xd'));logger[_0x1cf2('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2a0e86,'request\x20sent',JSON[_0x1cf2('0xf')](_0x1346cc));if(_0x1346cc[_0x1cf2('0x10')]){if(_0x1346cc[_0x1cf2('0x10')][_0x1cf2('0x11')]===0x1f4){logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x1346cc['error'][_0x1cf2('0x13')]);return _0x2cee51(_0x1346cc['error'][_0x1cf2('0x13')]);}logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x1346cc[_0x1cf2('0x10')]['message']);return _0x1c0fdd(_0x1346cc['error']['message']);}else{logger[_0x1cf2('0xc')](_0x1cf2('0x12'),_0x2a0e86,_0x1cf2('0xd'));_0x1c0fdd(_0x1346cc[_0x1cf2('0x14')][_0x1cf2('0x13')]);}})[_0x1cf2('0x15')](function(_0x176e45){logger[_0x1cf2('0x10')](_0x1cf2('0x12'),_0x2a0e86,_0x176e45);_0x2cee51(_0x176e45);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8994eae..742c732 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 _0xd06b=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','addConfiguration','put'];(function(_0x104f0e,_0x207f2d){var _0x322790=function(_0x42c6ce){while(--_0x42c6ce){_0x104f0e['push'](_0x104f0e['shift']());}};_0x322790(++_0x207f2d);}(_0xd06b,0x82));var _0xbd06=function(_0x423e26,_0x3899b6){_0x423e26=_0x423e26-0x0;var _0x1deaf3=_0xd06b[_0x423e26];return _0x1deaf3;};'use strict';var multer=require(_0xbd06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd06('0x1'));var express=require(_0xbd06('0x2'));var router=express[_0xbd06('0x3')]();var fs_extra=require(_0xbd06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd06('0x5'));var config=require('../../config/environment');var controller=require(_0xbd06('0x6'));router['get']('/',auth[_0xbd06('0x7')](),controller[_0xbd06('0x8')]);router[_0xbd06('0x9')](_0xbd06('0xa'),auth['isAuthenticated'](),controller[_0xbd06('0xb')]);router[_0xbd06('0x9')]('/:id/configurations',auth[_0xbd06('0x7')](),controller[_0xbd06('0xc')]);router[_0xbd06('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbd06('0xd')]);router['post']('/',auth[_0xbd06('0x7')](),controller[_0xbd06('0xe')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xbd06('0xf')]);router[_0xbd06('0x10')]('/:id',auth[_0xbd06('0x7')](),controller[_0xbd06('0x11')]);router[_0xbd06('0x12')](_0xbd06('0xa'),auth[_0xbd06('0x7')](),controller[_0xbd06('0x13')]);module[_0xbd06('0x14')]=router; \ No newline at end of file +var _0xe321=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3f0eb3,_0x2b12b1){var _0x5329af=function(_0x90f9e5){while(--_0x90f9e5){_0x3f0eb3['push'](_0x3f0eb3['shift']());}};_0x5329af(++_0x2b12b1);}(_0xe321,0xfc));var _0x1e32=function(_0x1ca18a,_0x3235bc){_0x1ca18a=_0x1ca18a-0x0;var _0x8b22c6=_0xe321[_0x1ca18a];return _0x8b22c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e32('0x0'));var timeout=require(_0x1e32('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e32('0x2'));var auth=require(_0x1e32('0x3'));var interaction=require(_0x1e32('0x4'));var config=require(_0x1e32('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x1e32('0x6')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0x8')]);router[_0x1e32('0x6')](_0x1e32('0x9'),auth['isAuthenticated'](),controller[_0x1e32('0xa')]);router[_0x1e32('0x6')]('/:id/configurations',auth[_0x1e32('0x7')](),controller['getConfigurations']);router['get'](_0x1e32('0xb'),auth[_0x1e32('0x7')](),controller[_0x1e32('0xc')]);router[_0x1e32('0xd')]('/',auth[_0x1e32('0x7')](),controller[_0x1e32('0xe')]);router[_0x1e32('0xd')](_0x1e32('0xf'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x10')]);router[_0x1e32('0x11')](_0x1e32('0x9'),auth[_0x1e32('0x7')](),controller[_0x1e32('0x12')]);router[_0x1e32('0x13')](_0x1e32('0x9'),auth['isAuthenticated'](),controller[_0x1e32('0x14')]);module[_0x1e32('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2d10e92..157f3e6 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 _0x522b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x522b,0x1c3));var _0xb522=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x522b[_0x3b87f4];return _0x63d16e;};'use strict';var Sequelize=require(_0xb522('0x0'));module[_0xb522('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb522('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb522('0x2')]},'clientId':{'type':Sequelize[_0xb522('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb522('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb522('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb522('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x36b2=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4826ea,_0x4d5513){var _0x4f365d=function(_0x525884){while(--_0x525884){_0x4826ea['push'](_0x4826ea['shift']());}};_0x4f365d(++_0x4d5513);}(_0x36b2,0x6b));var _0x236b=function(_0x455b27,_0x44eca6){_0x455b27=_0x455b27-0x0;var _0x3f87f8=_0x36b2[_0x455b27];return _0x3f87f8;};'use strict';var Sequelize=require(_0x236b('0x0'));module[_0x236b('0x1')]={'name':{'type':Sequelize[_0x236b('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x236b('0x2')]},'remoteUri':{'type':Sequelize[_0x236b('0x2')]},'tenantId':{'type':Sequelize[_0x236b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x236b('0x2')]},'serverUrl':{'type':Sequelize[_0x236b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x236b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 2f018eb..828dfe3 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 _0x6153=['accountidname','accountidyominame','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0x6153,0x6c));var _0x3615=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6153[_0x59ee6f];return _0x4c0979;};'use strict';var rp=require(_0x3615('0x0'));var util=require(_0x3615('0x1'));var _=require(_0x3615('0x2'));var qs=require(_0x3615('0x3'));var logger=require(_0x3615('0x4'))(_0x3615('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x41c6dc,_0x23ddfd){_0x23ddfd=_0x23ddfd||0xc8;return function(_0x571064){if(_0x571064){return _0x41c6dc[_0x3615('0x6')](_0x23ddfd)[_0x3615('0x7')](_0x571064);}};}function respondWithFilteredResult(_0x27bf1e,_0x16c4c0){return function(_0x275094){if(_0x275094){var _0x21bbb7=typeof _0x16c4c0[_0x3615('0x8')]===_0x3615('0x9')&&typeof _0x16c4c0['limit']===_0x3615('0x9');var _0x566a3a=_0x275094[_0x3615('0xa')];var _0x29100c=_0x21bbb7?0x0:_0x16c4c0['offset'];var _0x4e6d48=_0x21bbb7?_0x275094[_0x3615('0xa')]:_0x16c4c0['offset']+_0x16c4c0[_0x3615('0xb')];var _0x2df483;if(_0x4e6d48>=_0x566a3a){_0x4e6d48=_0x566a3a;_0x2df483=0xc8;}else{_0x2df483=0xce;}_0x27bf1e['status'](_0x2df483);return _0x27bf1e[_0x3615('0xc')]('Content-Range',_0x29100c+'-'+_0x4e6d48+'/'+_0x566a3a)['json'](_0x275094);}return null;};}function saveUpdates(_0x5d11c6){return function(_0x36dbe6){if(_0x36dbe6){return _0x36dbe6[_0x3615('0xd')](_0x5d11c6)[_0x3615('0xe')](function(_0x41c40c){return _0x41c40c;});}return null;};}function removeEntity(_0x3b3e10){return function(_0x3888a2){if(_0x3888a2){return _0x3888a2[_0x3615('0xf')]()['then'](function(){_0x3b3e10[_0x3615('0x6')](0xcc)[_0x3615('0x10')]();});}};}function handleEntityNotFound(_0x27b355){return function(_0x5577cd){if(!_0x5577cd){_0x27b355[_0x3615('0x11')](0x194);}return _0x5577cd;};}function handleError(_0x118704,_0x5ab98e){_0x5ab98e=_0x5ab98e||0x1f4;return function(_0x4f3170){logger[_0x3615('0x12')](_0x4f3170[_0x3615('0x13')]);if(_0x4f3170[_0x3615('0x14')]){delete _0x4f3170['name'];}_0x118704[_0x3615('0x6')](_0x5ab98e)['send'](_0x4f3170);};}exports['index']=function(_0x2808f1,_0x287e71){var _0x143117={},_0x27a2b9={},_0x17ec07={'count':0x0,'rows':[]};var _0x4f9749=_[_0x3615('0x15')](db[_0x3615('0x16')]['rawAttributes'],function(_0x3fbd95){return{'name':_0x3fbd95[_0x3615('0x17')],'type':_0x3fbd95[_0x3615('0x18')][_0x3615('0x19')]};});_0x27a2b9[_0x3615('0x1a')]=_[_0x3615('0x15')](_0x4f9749,'name');_0x27a2b9[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x2808f1[_0x3615('0x1b')]);_0x27a2b9[_0x3615('0x1d')]=_[_0x3615('0x1e')](_0x27a2b9[_0x3615('0x1a')],_0x27a2b9['query']);_0x143117[_0x3615('0x1f')]=_['intersection'](_0x27a2b9[_0x3615('0x1a')],qs[_0x3615('0x20')](_0x2808f1[_0x3615('0x1b')][_0x3615('0x20')]));_0x143117[_0x3615('0x1f')]=_0x143117['attributes']['length']?_0x143117[_0x3615('0x1f')]:_0x27a2b9[_0x3615('0x1a')];if(!_0x2808f1['query'][_0x3615('0x21')](_0x3615('0x22'))){_0x143117[_0x3615('0xb')]=qs[_0x3615('0xb')](_0x2808f1[_0x3615('0x1b')]['limit']);_0x143117['offset']=qs[_0x3615('0x8')](_0x2808f1['query'][_0x3615('0x8')]);}_0x143117[_0x3615('0x23')]=qs[_0x3615('0x24')](_0x2808f1[_0x3615('0x1b')][_0x3615('0x24')]);_0x143117[_0x3615('0x25')]=qs[_0x3615('0x1d')](_[_0x3615('0x26')](_0x2808f1[_0x3615('0x1b')],_0x27a2b9[_0x3615('0x1d')]),_0x4f9749);if(_0x2808f1['query'][_0x3615('0x27')]){_0x143117[_0x3615('0x25')]=_[_0x3615('0x28')](_0x143117[_0x3615('0x25')],{'$or':_[_0x3615('0x15')](_0x4f9749,function(_0x2d2e91){if(_0x2d2e91[_0x3615('0x18')]!==_0x3615('0x29')){var _0xadf3c9={};_0xadf3c9[_0x2d2e91[_0x3615('0x14')]]={'$like':'%'+_0x2808f1[_0x3615('0x1b')][_0x3615('0x27')]+'%'};return _0xadf3c9;}})});}_0x143117=_[_0x3615('0x28')]({},_0x143117,_0x2808f1[_0x3615('0x2a')]);var _0x3bbdba={'where':_0x143117['where']};return db[_0x3615('0x16')][_0x3615('0xa')](_0x3bbdba)['then'](function(_0x3e0c20){_0x17ec07['count']=_0x3e0c20;if(_0x2808f1['query'][_0x3615('0x2b')]){_0x143117['include']=[{'all':!![]}];}return db[_0x3615('0x16')][_0x3615('0x2c')](_0x143117);})[_0x3615('0xe')](function(_0x1928f9){_0x17ec07[_0x3615('0x2d')]=_0x1928f9;return _0x17ec07;})[_0x3615('0xe')](respondWithFilteredResult(_0x287e71,_0x143117))[_0x3615('0x2e')](handleError(_0x287e71,null));};exports[_0x3615('0x2f')]=function(_0x5bf070,_0x47568a){var _0x5f25a2={'raw':![],'where':{'id':_0x5bf070[_0x3615('0x30')]['id']}},_0x20fab9={};_0x20fab9[_0x3615('0x1a')]=_[_0x3615('0x1c')](db[_0x3615('0x16')]['rawAttributes']);_0x20fab9[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x5bf070['query']);_0x20fab9[_0x3615('0x1d')]=_[_0x3615('0x1e')](_0x20fab9[_0x3615('0x1a')],_0x20fab9['query']);_0x5f25a2[_0x3615('0x1f')]=_[_0x3615('0x1e')](_0x20fab9[_0x3615('0x1a')],qs['fields'](_0x5bf070[_0x3615('0x1b')][_0x3615('0x20')]));_0x5f25a2[_0x3615('0x1f')]=_0x5f25a2[_0x3615('0x1f')][_0x3615('0x31')]?_0x5f25a2[_0x3615('0x1f')]:_0x20fab9['model'];if(_0x5bf070['query'][_0x3615('0x2b')]){_0x5f25a2[_0x3615('0x32')]=[{'all':!![]}];}_0x5f25a2=_[_0x3615('0x28')]({},_0x5f25a2,_0x5bf070[_0x3615('0x2a')]);return db['Dynamics365Account'][_0x3615('0x33')](_0x5f25a2)[_0x3615('0xe')](handleEntityNotFound(_0x47568a,null))[_0x3615('0xe')](respondWithResult(_0x47568a,null))[_0x3615('0x2e')](handleError(_0x47568a,null));};exports['create']=function(_0x21307e,_0x4db600){return db['Dynamics365Account'][_0x3615('0x34')](_0x21307e[_0x3615('0x35')],{})['then'](respondWithResult(_0x4db600,0xc9))[_0x3615('0x2e')](handleError(_0x4db600,null));};exports[_0x3615('0xd')]=function(_0x4debf6,_0x173c05){if(_0x4debf6[_0x3615('0x35')]['id']){delete _0x4debf6[_0x3615('0x35')]['id'];}return db[_0x3615('0x16')][_0x3615('0x33')]({'where':{'id':_0x4debf6['params']['id']}})['then'](handleEntityNotFound(_0x173c05,null))[_0x3615('0xe')](saveUpdates(_0x4debf6[_0x3615('0x35')],null))[_0x3615('0xe')](respondWithResult(_0x173c05,null))[_0x3615('0x2e')](handleError(_0x173c05,null));};exports[_0x3615('0xf')]=function(_0x3ed939,_0x51ef23){return db['Dynamics365Account'][_0x3615('0x33')]({'where':{'id':_0x3ed939[_0x3615('0x30')]['id']}})[_0x3615('0xe')](handleEntityNotFound(_0x51ef23,null))[_0x3615('0xe')](removeEntity(_0x51ef23,null))[_0x3615('0x2e')](handleError(_0x51ef23,null));};exports[_0x3615('0x36')]=function(_0x4d648d,_0x2eee6e){var _0x3d7efb={};var _0x51df89={};var _0x200e88;var _0x11858b;return db[_0x3615('0x16')][_0x3615('0x37')]({'where':{'id':_0x4d648d[_0x3615('0x30')]['id']}})[_0x3615('0xe')](handleEntityNotFound(_0x2eee6e,null))[_0x3615('0xe')](function(_0x460eb9){if(_0x460eb9){_0x200e88=_0x460eb9;_0x51df89['model']=_[_0x3615('0x1c')](db[_0x3615('0x38')][_0x3615('0x39')]);_0x51df89[_0x3615('0x1b')]=_[_0x3615('0x1c')](_0x4d648d[_0x3615('0x1b')]);_0x51df89[_0x3615('0x1d')]=_['intersection'](_0x51df89[_0x3615('0x1a')],_0x51df89[_0x3615('0x1b')]);_0x3d7efb[_0x3615('0x1f')]=_[_0x3615('0x1e')](_0x51df89['model'],qs['fields'](_0x4d648d[_0x3615('0x1b')][_0x3615('0x20')]));_0x3d7efb[_0x3615('0x1f')]=_0x3d7efb['attributes']['length']?_0x3d7efb[_0x3615('0x1f')]:_0x51df89[_0x3615('0x1a')];_0x3d7efb[_0x3615('0x23')]=qs[_0x3615('0x24')](_0x4d648d['query']['sort']);_0x3d7efb['where']=qs[_0x3615('0x1d')](_[_0x3615('0x26')](_0x4d648d['query'],_0x51df89['filters']));if(_0x4d648d['query']['filter']){_0x3d7efb[_0x3615('0x25')]=_[_0x3615('0x28')](_0x3d7efb[_0x3615('0x25')],{'$or':_[_0x3615('0x15')](_0x3d7efb[_0x3615('0x1f')],function(_0x5b2b28){var _0x11d918={};_0x11d918[_0x5b2b28]={'$like':'%'+_0x4d648d[_0x3615('0x1b')][_0x3615('0x27')]+'%'};return _0x11d918;})});}_0x3d7efb=_[_0x3615('0x28')]({},_0x3d7efb,_0x4d648d[_0x3615('0x2a')]);return _0x200e88[_0x3615('0x36')](_0x3d7efb);}})[_0x3615('0xe')](function(_0x4fee26){if(_0x4fee26){_0x11858b=_0x4fee26[_0x3615('0x31')];if(!_0x4d648d[_0x3615('0x1b')][_0x3615('0x21')](_0x3615('0x22'))){_0x3d7efb['limit']=qs['limit'](_0x4d648d[_0x3615('0x1b')]['limit']);_0x3d7efb['offset']=qs['offset'](_0x4d648d['query'][_0x3615('0x8')]);}return _0x200e88['getConfigurations'](_0x3d7efb);}})['then'](function(_0x54e0df){if(_0x54e0df){return _0x54e0df?{'count':_0x11858b,'rows':_0x54e0df}:null;}})[_0x3615('0xe')](respondWithResult(_0x2eee6e,null))[_0x3615('0x2e')](handleError(_0x2eee6e,null));};exports[_0x3615('0x3a')]=function(_0x41e8c6,_0x100011){if(_0x41e8c6[_0x3615('0x35')]['id']){delete _0x41e8c6[_0x3615('0x35')]['id'];}return db['Dynamics365Account'][_0x3615('0x37')]({'where':{'id':_0x41e8c6[_0x3615('0x30')]['id']}})['then'](handleEntityNotFound(_0x100011,null))[_0x3615('0xe')](function(_0x1e62f7){if(_0x1e62f7){_0x41e8c6[_0x3615('0x35')][_0x3615('0x3b')]=_0x1e62f7['id'];_0x41e8c6[_0x3615('0x35')][_0x3615('0x3c')]=integrations[_0x3615('0x3d')](_0x41e8c6['body'][_0x3615('0x3e')],_0x41e8c6[_0x3615('0x35')][_0x3615('0x18')]);_0x41e8c6[_0x3615('0x35')][_0x3615('0x3f')]=integrations['getDescriptions'](_0x41e8c6[_0x3615('0x35')][_0x3615('0x3e')],_0x41e8c6['body'][_0x3615('0x18')]);return db[_0x3615('0x38')][_0x3615('0x34')](_0x41e8c6[_0x3615('0x35')],{'include':[{'model':db[_0x3615('0x40')],'as':_0x3615('0x3c')},{'model':db[_0x3615('0x40')],'as':_0x3615('0x3f')}]});}return null;})['then'](respondWithResult(_0x100011,null))[_0x3615('0x2e')](handleError(_0x100011,null));};function sanitizeRemoteUri(_0x12cc28){var _0x248270=_0x12cc28[_0x3615('0x41')](-0x1);if(_0x248270==='/')return _0x12cc28[_0x3615('0x42')](0x0,_0x12cc28[_0x3615('0x43')](_0x248270));return _0x12cc28;}function getWebApiUrl(_0x5d84f3){return util['format']('%s/api/data/v9.0/',_0x5d84f3);}exports[_0x3615('0x44')]=function(_0x27c2c7,_0x119567){var _0x106a7b=_0x27c2c7[_0x3615('0x1b')]['ticketType'];var _0x3bd138=_0x106a7b===_0x3615('0x45')?_0x3615('0x46'):_0x3615('0x47');var _0x14d627='';var _0x224370='';var _0x169e2a='';var _0x5cfebc='';var _0xb0c015='';var _0x1950ec='';var _0x4b38ed='';var _0x584f8d='';var _0x23d3d5=['title',_0x3615('0x48'),'customerid','ownerid',_0x3615('0x49'),_0x3615('0x4a'),_0x3615('0x4b'),_0x3615('0x4c'),_0x3615('0x4d'),_0x3615('0x4e')];var _0x50bb77=[_0x3615('0x4f'),_0x3615('0x50'),'actualserviceunits',_0x3615('0x51'),'contactidname',_0x3615('0x52'),'contractdetailidname',_0x3615('0x53'),'createdbyexternalpartyname',_0x3615('0x54'),_0x3615('0x55'),_0x3615('0x56'),_0x3615('0x57'),'createdonbehalfbyname',_0x3615('0x58'),_0x3615('0x59'),'customeridtype',_0x3615('0x5a'),_0x3615('0x5b'),'entitlementidname',_0x3615('0x5c'),_0x3615('0x5d'),_0x3615('0x5e'),_0x3615('0x5f'),'firstresponsebykpiidname',_0x3615('0x60'),'importsequencenumber',_0x3615('0x61'),'kbarticleidname',_0x3615('0x62'),_0x3615('0x63'),'modifiedbyexternalpartyname',_0x3615('0x64'),_0x3615('0x65'),_0x3615('0x66'),_0x3615('0x67'),_0x3615('0x68'),'modifiedonbehalfbyyominame',_0x3615('0x69'),_0x3615('0x6a'),_0x3615('0x6b'),_0x3615('0x6c'),'overriddencreatedon',_0x3615('0x6d'),_0x3615('0x6e'),_0x3615('0x6f'),_0x3615('0x70'),_0x3615('0x71'),_0x3615('0x72'),_0x3615('0x73'),_0x3615('0x74'),'productserialnumber',_0x3615('0x75'),_0x3615('0x76'),'responseby',_0x3615('0x77'),'responsiblecontactidyominame',_0x3615('0x78'),_0x3615('0x79'),_0x3615('0x7a'),_0x3615('0x7b'),_0x3615('0x7c'),_0x3615('0x7d'),'subjectidname',_0x3615('0x7e'),_0x3615('0x7f'),_0x3615('0x80'),_0x3615('0x81'),'utcconversiontimezonecode',_0x3615('0x82')];var _0xaffb42=_0x23d3d5[_0x3615('0x83')](_0x50bb77);return db[_0x3615('0x16')][_0x3615('0x37')]({'where':{'id':_0x27c2c7['params']['id']},'attributes':['id',_0x3615('0x84'),'password',_0x3615('0x85'),_0x3615('0x86'),_0x3615('0x87'),_0x3615('0x88'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x3615('0x89'),'attributes':['id',_0x3615('0x8a'),_0x3615('0x8b')]}]})[_0x3615('0xe')](handleEntityNotFound(_0x119567,null))[_0x3615('0xe')](function(_0x9594be){if(_0x9594be){if(_0x9594be['modernAuthentication']){_0x9594be['access_token']=_0x9594be[_0x3615('0x89')][_0x3615('0x8a')];_0x584f8d=sanitizeRemoteUri(_0x9594be[_0x3615('0x89')]['data7']);_0x4b38ed=getWebApiUrl(_0x584f8d);return _0x9594be;}_0x584f8d=sanitizeRemoteUri(_0x9594be[_0x3615('0x85')]);_0x4b38ed=getWebApiUrl(_0x584f8d);var _0x48748f={'method':_0x3615('0x8c'),'uri':_0x3615('0x8d')+_0x9594be['tenantId']+_0x3615('0x8e'),'form':{'client_id':_0x9594be[_0x3615('0x87')],'resource':_0x584f8d,'username':_0x9594be[_0x3615('0x84')],'password':_0x9594be['password'],'grant_type':_0x3615('0x8f'),'client_secret':_0x9594be['clientSecret']},'json':!![]};return rp(_0x48748f);}})[_0x3615('0xe')](function(_0x121e62){_0x1950ec=_0x121e62['access_token'];var _0x44bbff={'method':_0x3615('0x90'),'uri':encodeURI(_0x4b38ed+_0x3615('0x91')+_0x3bd138+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1950ec,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x44bbff);})[_0x3615('0xe')](function(_0x3d47e2){var _0x2a096a=_0x3d47e2['value'][0x0];var _0x371931=_0x2a096a['MetadataId'];var _0x641776={'method':_0x3615('0x90'),'uri':_0x4b38ed+_0x3615('0x93')+_0x371931+_0x3615('0x94'),'headers':{'Authorization':_0x3615('0x95')+_0x1950ec,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x641776);})[_0x3615('0xe')](function(_0x1825f0){_0x14d627=_0x1825f0;_0x224370=_0x14d627[_0x3615('0x96')];_0x224370=_[_0x3615('0x97')](_0x224370,function(_0xc498d3){return!_0xaffb42['includes'](_0xc498d3[_0x3615('0x98')]);});var _0x59ccc4=[];var _0x43dea7=[];_0x224370[_0x3615('0x99')](function(_0x466567){if(_0x466567[_0x3615('0x9a')]){var _0x36a6da=_0x466567[_0x3615('0x9a')][_0x3615('0x42')](_0x466567[_0x3615('0x9a')][_0x3615('0x43')]('.')+0x1);if(_0x36a6da===_0x3615('0x9b')){_0x59ccc4['push'](getSelectList(_0x4b38ed,_0x106a7b,_0x43dea7,_0x14d627[_0x3615('0x9c')],_0x466567[_0x3615('0x9c')],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x59ccc4);})[_0x3615('0xe')](function(_0x293f67){_0x169e2a=_0x293f67[0x0];var _0x11e610=[];var _0x85210d=[];_0x224370[_0x3615('0x99')](function(_0xe0763b){if(!_[_0x3615('0x9e')](_0xe0763b['@odata.type'])){var _0x4d3881=_0xe0763b[_0x3615('0x9a')]['substring'](_0xe0763b[_0x3615('0x9a')]['lastIndexOf']('.')+0x1);if(_0x4d3881===_0x3615('0x9f')){_0x11e610[_0x3615('0xa0')](getBooleanList(_0x4b38ed,_0x106a7b,_0x85210d,_0x14d627['MetadataId'],_0xe0763b[_0x3615('0x9c')],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x11e610);})[_0x3615('0xe')](function(_0x27afd3){_0x5cfebc=_0x27afd3[0x0];var _0x5278a8=[];var _0x157c2d=[];_0x224370['forEach'](function(_0x46684a){if(_0x46684a[_0x3615('0x9a')]){var _0x32dd94=_0x46684a[_0x3615('0x9a')]['substring'](_0x46684a['@odata.type']['lastIndexOf']('.')+0x1);if(_0x32dd94===_0x3615('0xa1')||_0x32dd94===_0x3615('0xa2')||_0x32dd94===_0x3615('0xa3')||_0x32dd94===_0x3615('0xa4')||_0x32dd94==='MemoAttributeMetadata'||_0x32dd94===_0x3615('0xa5')||_0x32dd94===_0x3615('0xa6')||_0x32dd94===_0x3615('0xa7')||_0x32dd94===_0x3615('0xa8')||_0x32dd94===_0x3615('0xa9')){_0x5278a8[_0x3615('0xa0')](getInputList(_0x4b38ed,_0x106a7b,_0x32dd94,_0x157c2d,_0x14d627[_0x3615('0x9c')],_0x46684a['MetadataId'],_0x1950ec));}}});return Promise[_0x3615('0x9d')](_0x5278a8);})['then'](function(_0x26c15b){_0xb0c015=_0x26c15b[0x0];var _0x9d529f=_0x169e2a[_0x3615('0x83')](_0x5cfebc)['concat'](_0xb0c015);var _0x39f0e2={'count':_0x9d529f[_0x3615('0x31')],'rows':_0x9d529f};return _0x39f0e2;})[_0x3615('0xe')](respondWithResult(_0x119567,null))[_0x3615('0x2e')](function(_0x40ad8a){var _0x1cdbc2=_0x27c2c7[_0x3615('0x1b')][_0x3615('0xaa')]?0x1f4:_0x40ad8a[_0x3615('0xab')]||0x1f4;logger['error'](_0x40ad8a[_0x3615('0x13')]);delete _0x40ad8a[_0x3615('0x14')];if(_0x1cdbc2===0x191){_0x1cdbc2=0x190;}_0x119567[_0x3615('0x6')](_0x1cdbc2)[_0x3615('0xac')](_0x27c2c7[_0x3615('0x1b')][_0x3615('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x40ad8a[_0x3615('0xab')]}:_0x40ad8a);});};function getSelectList(_0xb7cce5,_0x594bcb,_0x21871e,_0x28282b,_0x14dc6a,_0x52358a){var _0x2141d8={'method':_0x3615('0x90'),'uri':_0xb7cce5+_0x3615('0x93')+_0x28282b+_0x3615('0xad')+_0x14dc6a+_0x3615('0xae')+_0x3615('0xaf'),'headers':{'Authorization':_0x3615('0x95')+_0x52358a,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x2141d8)[_0x3615('0xe')](function(_0x470426){var _0x4b5deb=[];var _0x403bbd=_0x470426[_0x3615('0xb0')][_0x3615('0xb1')];_0x403bbd[_0x3615('0x99')](function(_0x32fce3){_0x4b5deb[_0x3615('0xa0')]({'name':_0x32fce3[_0x3615('0xb2')][_0x3615('0xb3')][_0x3615('0xb2')],'value':String(_0x32fce3[_0x3615('0xb4')])});});var _0x2492d2={'id':_0x594bcb+'_'+_0x470426[_0x3615('0x98')],'name':_0x470426['DisplayName'][_0x3615('0xb3')][_0x3615('0xb2')],'custom':![],'options':_0x4b5deb};_0x21871e[_0x3615('0xa0')](_0x2492d2);return _0x21871e;});}function getBooleanList(_0x46748c,_0x4d81a2,_0x28de59,_0x5179f0,_0x533ca0,_0x19491b){var _0x53a5d2={'method':_0x3615('0x90'),'uri':_0x46748c+'EntityDefinitions('+_0x5179f0+_0x3615('0xad')+_0x533ca0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x3615('0x95')+_0x19491b,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x53a5d2)[_0x3615('0xe')](function(_0x40c671){var _0x4a78cd=[];_0x4a78cd[_0x3615('0xa0')]({'name':_0x40c671[_0x3615('0xb0')][_0x3615('0xb5')]['Label'][_0x3615('0xb3')][_0x3615('0xb2')],'value':_0x3615('0xb6')},{'name':_0x40c671[_0x3615('0xb0')][_0x3615('0xb7')][_0x3615('0xb2')][_0x3615('0xb3')][_0x3615('0xb2')],'value':'false'});var _0x58bd37={'id':_0x4d81a2+'_'+_0x40c671[_0x3615('0x98')],'name':_0x40c671[_0x3615('0xb8')][_0x3615('0xb3')][_0x3615('0xb2')],'custom':![],'options':_0x4a78cd};_0x28de59[_0x3615('0xa0')](_0x58bd37);return _0x28de59;});}function getInputList(_0x53b5a4,_0x358834,_0x286493,_0x564c4e,_0x4bc6c4,_0x343961,_0x538c56){var _0x3fcc8d={'method':_0x3615('0x90'),'uri':_0x53b5a4+_0x3615('0x93')+_0x4bc6c4+')/Attributes('+_0x343961+_0x3615('0xb9')+_0x286493+_0x3615('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x538c56,'If-None-Match':null,'OData-Version':_0x3615('0x92')},'json':!![]};return rp(_0x3fcc8d)[_0x3615('0xe')](function(_0x56985a){var _0x416f7c={'id':_0x358834+'_'+_0x56985a[_0x3615('0x98')],'name':_0x56985a[_0x3615('0xb8')]['UserLocalizedLabel']?_0x56985a[_0x3615('0xb8')][_0x3615('0xb3')][_0x3615('0xb2')]:_0x56985a[_0x3615('0x98')],'custom':![],'options':[]};_0x564c4e[_0x3615('0xa0')](_0x416f7c);return _0x564c4e;});} \ No newline at end of file +var _0x730a=['AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','format','getFields','ticketType','incident','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_url','followupby','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','modernAuthentication','access_token','data5','data7','https://login.microsoftonline.com/','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','TrueOption','UserLocalizedLabel','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','then','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','findOne'];(function(_0x13e8db,_0x5038bc){var _0x3cbce2=function(_0x4acf0b){while(--_0x4acf0b){_0x13e8db['push'](_0x13e8db['shift']());}};_0x3cbce2(++_0x5038bc);}(_0x730a,0x80));var _0xa730=function(_0x4d98b8,_0x539839){_0x4d98b8=_0x4d98b8-0x0;var _0x5e271b=_0x730a[_0x4d98b8];return _0x5e271b;};'use strict';var rp=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var _=require(_0xa730('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xa730('0x3'))('api');var db=require(_0xa730('0x4'))['db'];var integrations=require(_0xa730('0x5'));function respondWithResult(_0x40264e,_0x379c7c){_0x379c7c=_0x379c7c||0xc8;return function(_0x23d56e){if(_0x23d56e){return _0x40264e[_0xa730('0x6')](_0x379c7c)[_0xa730('0x7')](_0x23d56e);}};}function respondWithFilteredResult(_0x1d72d3,_0x1f30df){return function(_0x4ded32){if(_0x4ded32){var _0x2d3e19=typeof _0x1f30df[_0xa730('0x8')]===_0xa730('0x9')&&typeof _0x1f30df[_0xa730('0xa')]===_0xa730('0x9');var _0x2890d5=_0x4ded32['count'];var _0x2adcfd=_0x2d3e19?0x0:_0x1f30df['offset'];var _0x56328b=_0x2d3e19?_0x4ded32[_0xa730('0xb')]:_0x1f30df[_0xa730('0x8')]+_0x1f30df['limit'];var _0x432434;if(_0x56328b>=_0x2890d5){_0x56328b=_0x2890d5;_0x432434=0xc8;}else{_0x432434=0xce;}_0x1d72d3[_0xa730('0x6')](_0x432434);return _0x1d72d3['set'](_0xa730('0xc'),_0x2adcfd+'-'+_0x56328b+'/'+_0x2890d5)[_0xa730('0x7')](_0x4ded32);}return null;};}function saveUpdates(_0x3bff35){return function(_0x5b3ec9){if(_0x5b3ec9){return _0x5b3ec9['update'](_0x3bff35)[_0xa730('0xd')](function(_0x125a31){return _0x125a31;});}return null;};}function removeEntity(_0x44e546){return function(_0x4e4a25){if(_0x4e4a25){return _0x4e4a25['destroy']()[_0xa730('0xd')](function(){_0x44e546[_0xa730('0x6')](0xcc)[_0xa730('0xe')]();});}};}function handleEntityNotFound(_0x218ac4){return function(_0x6a6d74){if(!_0x6a6d74){_0x218ac4[_0xa730('0xf')](0x194);}return _0x6a6d74;};}function handleError(_0x40a022,_0x4d4187){_0x4d4187=_0x4d4187||0x1f4;return function(_0x53fd11){logger[_0xa730('0x10')](_0x53fd11[_0xa730('0x11')]);if(_0x53fd11[_0xa730('0x12')]){delete _0x53fd11[_0xa730('0x12')];}_0x40a022[_0xa730('0x6')](_0x4d4187)['send'](_0x53fd11);};}exports[_0xa730('0x13')]=function(_0x35ceea,_0x1a1a97){var _0x33afa7={},_0x7b82d5={},_0x5b69c3={'count':0x0,'rows':[]};var _0x1c36e1=_[_0xa730('0x14')](db[_0xa730('0x15')][_0xa730('0x16')],function(_0x394c21){return{'name':_0x394c21[_0xa730('0x17')],'type':_0x394c21[_0xa730('0x18')][_0xa730('0x19')]};});_0x7b82d5[_0xa730('0x1a')]=_['map'](_0x1c36e1,'name');_0x7b82d5[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x35ceea['query']);_0x7b82d5[_0xa730('0x1d')]=_[_0xa730('0x1e')](_0x7b82d5[_0xa730('0x1a')],_0x7b82d5[_0xa730('0x1b')]);_0x33afa7[_0xa730('0x1f')]=_[_0xa730('0x1e')](_0x7b82d5[_0xa730('0x1a')],qs[_0xa730('0x20')](_0x35ceea[_0xa730('0x1b')][_0xa730('0x20')]));_0x33afa7[_0xa730('0x1f')]=_0x33afa7[_0xa730('0x1f')][_0xa730('0x21')]?_0x33afa7[_0xa730('0x1f')]:_0x7b82d5[_0xa730('0x1a')];if(!_0x35ceea[_0xa730('0x1b')][_0xa730('0x22')](_0xa730('0x23'))){_0x33afa7[_0xa730('0xa')]=qs[_0xa730('0xa')](_0x35ceea['query'][_0xa730('0xa')]);_0x33afa7[_0xa730('0x8')]=qs[_0xa730('0x8')](_0x35ceea[_0xa730('0x1b')]['offset']);}_0x33afa7[_0xa730('0x24')]=qs[_0xa730('0x25')](_0x35ceea[_0xa730('0x1b')][_0xa730('0x25')]);_0x33afa7[_0xa730('0x26')]=qs[_0xa730('0x1d')](_[_0xa730('0x27')](_0x35ceea[_0xa730('0x1b')],_0x7b82d5[_0xa730('0x1d')]),_0x1c36e1);if(_0x35ceea[_0xa730('0x1b')][_0xa730('0x28')]){_0x33afa7['where']=_['merge'](_0x33afa7[_0xa730('0x26')],{'$or':_[_0xa730('0x14')](_0x1c36e1,function(_0x4a86bd){if(_0x4a86bd[_0xa730('0x18')]!=='VIRTUAL'){var _0x5edfd7={};_0x5edfd7[_0x4a86bd[_0xa730('0x12')]]={'$like':'%'+_0x35ceea[_0xa730('0x1b')][_0xa730('0x28')]+'%'};return _0x5edfd7;}})});}_0x33afa7=_[_0xa730('0x29')]({},_0x33afa7,_0x35ceea['options']);var _0x6cb52={'where':_0x33afa7['where']};return db[_0xa730('0x15')][_0xa730('0xb')](_0x6cb52)[_0xa730('0xd')](function(_0x1df03f){_0x5b69c3[_0xa730('0xb')]=_0x1df03f;if(_0x35ceea[_0xa730('0x1b')]['includeAll']){_0x33afa7[_0xa730('0x2a')]=[{'all':!![]}];}return db[_0xa730('0x15')]['findAll'](_0x33afa7);})[_0xa730('0xd')](function(_0x23dee9){_0x5b69c3[_0xa730('0x2b')]=_0x23dee9;return _0x5b69c3;})[_0xa730('0xd')](respondWithFilteredResult(_0x1a1a97,_0x33afa7))[_0xa730('0x2c')](handleError(_0x1a1a97,null));};exports[_0xa730('0x2d')]=function(_0x34051a,_0x89f978){var _0x51e8e4={'raw':![],'where':{'id':_0x34051a[_0xa730('0x2e')]['id']}},_0x15205a={};_0x15205a['model']=_['keys'](db[_0xa730('0x15')][_0xa730('0x16')]);_0x15205a[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x34051a[_0xa730('0x1b')]);_0x15205a['filters']=_[_0xa730('0x1e')](_0x15205a[_0xa730('0x1a')],_0x15205a[_0xa730('0x1b')]);_0x51e8e4[_0xa730('0x1f')]=_['intersection'](_0x15205a[_0xa730('0x1a')],qs[_0xa730('0x20')](_0x34051a[_0xa730('0x1b')][_0xa730('0x20')]));_0x51e8e4[_0xa730('0x1f')]=_0x51e8e4['attributes'][_0xa730('0x21')]?_0x51e8e4[_0xa730('0x1f')]:_0x15205a['model'];if(_0x34051a[_0xa730('0x1b')]['includeAll']){_0x51e8e4[_0xa730('0x2a')]=[{'all':!![]}];}_0x51e8e4=_['merge']({},_0x51e8e4,_0x34051a['options']);return db[_0xa730('0x15')][_0xa730('0x2f')](_0x51e8e4)[_0xa730('0xd')](handleEntityNotFound(_0x89f978,null))['then'](respondWithResult(_0x89f978,null))[_0xa730('0x2c')](handleError(_0x89f978,null));};exports[_0xa730('0x30')]=function(_0x190c6a,_0x16a7d6){return db[_0xa730('0x15')][_0xa730('0x30')](_0x190c6a[_0xa730('0x31')],{})['then'](respondWithResult(_0x16a7d6,0xc9))[_0xa730('0x2c')](handleError(_0x16a7d6,null));};exports[_0xa730('0x32')]=function(_0x3fdbbe,_0x5bcc08){if(_0x3fdbbe[_0xa730('0x31')]['id']){delete _0x3fdbbe[_0xa730('0x31')]['id'];}return db[_0xa730('0x15')][_0xa730('0x2f')]({'where':{'id':_0x3fdbbe[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x5bcc08,null))[_0xa730('0xd')](saveUpdates(_0x3fdbbe[_0xa730('0x31')],null))[_0xa730('0xd')](respondWithResult(_0x5bcc08,null))[_0xa730('0x2c')](handleError(_0x5bcc08,null));};exports[_0xa730('0x33')]=function(_0x290fd9,_0x47d435){return db['Dynamics365Account'][_0xa730('0x2f')]({'where':{'id':_0x290fd9[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x47d435,null))[_0xa730('0xd')](removeEntity(_0x47d435,null))[_0xa730('0x2c')](handleError(_0x47d435,null));};exports[_0xa730('0x34')]=function(_0x31dbfc,_0x4d98a6){var _0x39a7ef={};var _0x3cf34f={};var _0x3f6b7e;var _0x574d40;return db['Dynamics365Account']['findOne']({'where':{'id':_0x31dbfc[_0xa730('0x2e')]['id']}})[_0xa730('0xd')](handleEntityNotFound(_0x4d98a6,null))['then'](function(_0x168c0c){if(_0x168c0c){_0x3f6b7e=_0x168c0c;_0x3cf34f[_0xa730('0x1a')]=_[_0xa730('0x1c')](db[_0xa730('0x35')][_0xa730('0x16')]);_0x3cf34f[_0xa730('0x1b')]=_[_0xa730('0x1c')](_0x31dbfc[_0xa730('0x1b')]);_0x3cf34f['filters']=_['intersection'](_0x3cf34f[_0xa730('0x1a')],_0x3cf34f[_0xa730('0x1b')]);_0x39a7ef['attributes']=_[_0xa730('0x1e')](_0x3cf34f['model'],qs[_0xa730('0x20')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x20')]));_0x39a7ef['attributes']=_0x39a7ef[_0xa730('0x1f')][_0xa730('0x21')]?_0x39a7ef[_0xa730('0x1f')]:_0x3cf34f[_0xa730('0x1a')];_0x39a7ef['order']=qs['sort'](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x25')]);_0x39a7ef['where']=qs[_0xa730('0x1d')](_['pick'](_0x31dbfc[_0xa730('0x1b')],_0x3cf34f['filters']));if(_0x31dbfc[_0xa730('0x1b')][_0xa730('0x28')]){_0x39a7ef[_0xa730('0x26')]=_[_0xa730('0x29')](_0x39a7ef[_0xa730('0x26')],{'$or':_['map'](_0x39a7ef[_0xa730('0x1f')],function(_0x2cec02){var _0x53aa52={};_0x53aa52[_0x2cec02]={'$like':'%'+_0x31dbfc['query'][_0xa730('0x28')]+'%'};return _0x53aa52;})});}_0x39a7ef=_[_0xa730('0x29')]({},_0x39a7ef,_0x31dbfc['options']);return _0x3f6b7e[_0xa730('0x34')](_0x39a7ef);}})[_0xa730('0xd')](function(_0x12e356){if(_0x12e356){_0x574d40=_0x12e356['length'];if(!_0x31dbfc[_0xa730('0x1b')][_0xa730('0x22')]('nolimit')){_0x39a7ef['limit']=qs[_0xa730('0xa')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0xa')]);_0x39a7ef[_0xa730('0x8')]=qs[_0xa730('0x8')](_0x31dbfc[_0xa730('0x1b')][_0xa730('0x8')]);}return _0x3f6b7e[_0xa730('0x34')](_0x39a7ef);}})['then'](function(_0x133fba){if(_0x133fba){return _0x133fba?{'count':_0x574d40,'rows':_0x133fba}:null;}})[_0xa730('0xd')](respondWithResult(_0x4d98a6,null))[_0xa730('0x2c')](handleError(_0x4d98a6,null));};exports[_0xa730('0x36')]=function(_0x4b62be,_0x27da45){if(_0x4b62be[_0xa730('0x31')]['id']){delete _0x4b62be['body']['id'];}return db[_0xa730('0x15')][_0xa730('0x37')]({'where':{'id':_0x4b62be[_0xa730('0x2e')]['id']}})['then'](handleEntityNotFound(_0x27da45,null))[_0xa730('0xd')](function(_0x15e24c){if(_0x15e24c){_0x4b62be[_0xa730('0x31')][_0xa730('0x38')]=_0x15e24c['id'];_0x4b62be['body'][_0xa730('0x39')]=integrations[_0xa730('0x3a')](_0x4b62be[_0xa730('0x31')]['channel'],_0x4b62be['body'][_0xa730('0x18')]);_0x4b62be[_0xa730('0x31')][_0xa730('0x3b')]=integrations[_0xa730('0x3c')](_0x4b62be[_0xa730('0x31')][_0xa730('0x3d')],_0x4b62be['body']['type']);return db['Dynamics365Configuration'][_0xa730('0x30')](_0x4b62be['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xa730('0x39')},{'model':db[_0xa730('0x3e')],'as':'Descriptions'}]});}return null;})[_0xa730('0xd')](respondWithResult(_0x27da45,null))['catch'](handleError(_0x27da45,null));};function sanitizeRemoteUri(_0x260107){var _0x16a291=_0x260107[_0xa730('0x3f')](-0x1);if(_0x16a291==='/')return _0x260107[_0xa730('0x40')](0x0,_0x260107['lastIndexOf'](_0x16a291));return _0x260107;}function getWebApiUrl(_0x5d89aa){return util[_0xa730('0x41')]('%s/api/data/v9.0/',_0x5d89aa);}exports[_0xa730('0x42')]=function(_0x7a6e69,_0x2a4149){var _0x3dd125=_0x7a6e69[_0xa730('0x1b')][_0xa730('0x43')];var _0x4c963=_0x3dd125===_0xa730('0x44')?'Incident':'PhoneCall';var _0x69f13a='';var _0x405093='';var _0x8ce35='';var _0x5d71f0='';var _0x86ed51='';var _0x2afa6e='';var _0x42566b='';var _0xbf1079='';var _0x707aad=['title','description',_0xa730('0x45'),_0xa730('0x46'),'caseorigincode',_0xa730('0x47'),_0xa730('0x48'),_0xa730('0x49'),_0xa730('0x4a'),'phonecall_activity_parties'];var _0x15e3fb=[_0xa730('0x4b'),_0xa730('0x4c'),_0xa730('0x4d'),_0xa730('0x4e'),_0xa730('0x4f'),_0xa730('0x50'),_0xa730('0x51'),_0xa730('0x52'),_0xa730('0x53'),_0xa730('0x54'),_0xa730('0x55'),'createdbyyominame',_0xa730('0x56'),'createdonbehalfbyname',_0xa730('0x57'),_0xa730('0x58'),'customeridtype','customeridyominame',_0xa730('0x59'),_0xa730('0x5a'),'entityimage_timestamp',_0xa730('0x5b'),'escalatedon','exchangerate','firstresponsebykpiidname',_0xa730('0x5c'),'importsequencenumber','influencescore',_0xa730('0x5d'),'lastonholdtime',_0xa730('0x5e'),'modifiedbyexternalpartyname',_0xa730('0x5f'),_0xa730('0x60'),_0xa730('0x61'),_0xa730('0x62'),_0xa730('0x63'),'modifiedonbehalfbyyominame',_0xa730('0x64'),_0xa730('0x65'),'numberofchildincidents',_0xa730('0x66'),_0xa730('0x67'),_0xa730('0x68'),_0xa730('0x69'),_0xa730('0x6a'),_0xa730('0x6b'),'primarycontactidname',_0xa730('0x6c'),_0xa730('0x6d'),'productidname','productserialnumber',_0xa730('0x6e'),_0xa730('0x6f'),_0xa730('0x70'),_0xa730('0x71'),_0xa730('0x72'),_0xa730('0x73'),_0xa730('0x74'),_0xa730('0x75'),_0xa730('0x76'),_0xa730('0x77'),_0xa730('0x78'),_0xa730('0x79'),_0xa730('0x7a'),'timezoneruleversionnumber','transactioncurrencyidname',_0xa730('0x7b'),_0xa730('0x7c'),_0xa730('0x7d')];var _0x401578=_0x707aad[_0xa730('0x7e')](_0x15e3fb);return db[_0xa730('0x15')][_0xa730('0x37')]({'where':{'id':_0x7a6e69[_0xa730('0x2e')]['id']},'attributes':['id',_0xa730('0x7f'),_0xa730('0x80'),_0xa730('0x81'),_0xa730('0x82'),'clientId',_0xa730('0x83'),'modernAuthentication'],'include':[{'model':db[_0xa730('0x84')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0xa730('0xd')](handleEntityNotFound(_0x2a4149,null))[_0xa730('0xd')](function(_0x46462b){if(_0x46462b){if(_0x46462b[_0xa730('0x85')]){_0x46462b[_0xa730('0x86')]=_0x46462b[_0xa730('0x84')][_0xa730('0x87')];_0xbf1079=sanitizeRemoteUri(_0x46462b['CloudProvider'][_0xa730('0x88')]);_0x42566b=getWebApiUrl(_0xbf1079);return _0x46462b;}_0xbf1079=sanitizeRemoteUri(_0x46462b[_0xa730('0x81')]);_0x42566b=getWebApiUrl(_0xbf1079);var _0x345a42={'method':'POST','uri':_0xa730('0x89')+_0x46462b['tenantId']+_0xa730('0x8a'),'form':{'client_id':_0x46462b[_0xa730('0x8b')],'resource':_0xbf1079,'username':_0x46462b[_0xa730('0x7f')],'password':_0x46462b[_0xa730('0x80')],'grant_type':_0xa730('0x80'),'client_secret':_0x46462b[_0xa730('0x83')]},'json':!![]};return rp(_0x345a42);}})[_0xa730('0xd')](function(_0x3353e1){_0x2afa6e=_0x3353e1['access_token'];var _0x374032={'method':'GET','uri':encodeURI(_0x42566b+_0xa730('0x8c')+_0x4c963+'\x27'),'headers':{'Authorization':_0xa730('0x8d')+_0x2afa6e,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x374032);})['then'](function(_0x24b97e){var _0x213865=_0x24b97e['value'][0x0];var _0x33e87d=_0x213865['MetadataId'];var _0xa21293={'method':_0xa730('0x8f'),'uri':_0x42566b+_0xa730('0x90')+_0x33e87d+_0xa730('0x91'),'headers':{'Authorization':_0xa730('0x8d')+_0x2afa6e,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0xa21293);})[_0xa730('0xd')](function(_0x130990){_0x69f13a=_0x130990;_0x405093=_0x69f13a[_0xa730('0x92')];_0x405093=_[_0xa730('0x93')](_0x405093,function(_0x598e62){return!_0x401578[_0xa730('0x94')](_0x598e62[_0xa730('0x95')]);});var _0x572bb4=[];var _0xda17a1=[];_0x405093[_0xa730('0x96')](function(_0x4e6e57){if(_0x4e6e57[_0xa730('0x97')]){var _0x5be8cc=_0x4e6e57[_0xa730('0x97')]['substring'](_0x4e6e57[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x5be8cc===_0xa730('0x99')){_0x572bb4[_0xa730('0x9a')](getSelectList(_0x42566b,_0x3dd125,_0xda17a1,_0x69f13a[_0xa730('0x9b')],_0x4e6e57['MetadataId'],_0x2afa6e));}}});return Promise[_0xa730('0x9c')](_0x572bb4);})[_0xa730('0xd')](function(_0x1bb625){_0x8ce35=_0x1bb625[0x0];var _0x599571=[];var _0x4948f9=[];_0x405093['forEach'](function(_0x33e1b9){if(!_[_0xa730('0x9d')](_0x33e1b9[_0xa730('0x97')])){var _0x4bb2ef=_0x33e1b9[_0xa730('0x97')]['substring'](_0x33e1b9[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x4bb2ef===_0xa730('0x9e')){_0x599571[_0xa730('0x9a')](getBooleanList(_0x42566b,_0x3dd125,_0x4948f9,_0x69f13a['MetadataId'],_0x33e1b9[_0xa730('0x9b')],_0x2afa6e));}}});return Promise[_0xa730('0x9c')](_0x599571);})['then'](function(_0xce306c){_0x5d71f0=_0xce306c[0x0];var _0x34deba=[];var _0x30e93f=[];_0x405093[_0xa730('0x96')](function(_0x3e8e0d){if(_0x3e8e0d[_0xa730('0x97')]){var _0x3154e6=_0x3e8e0d[_0xa730('0x97')][_0xa730('0x40')](_0x3e8e0d[_0xa730('0x97')][_0xa730('0x98')]('.')+0x1);if(_0x3154e6===_0xa730('0x9f')||_0x3154e6===_0xa730('0xa0')||_0x3154e6==='BigIntAttributeMetadata'||_0x3154e6===_0xa730('0xa1')||_0x3154e6===_0xa730('0xa2')||_0x3154e6===_0xa730('0xa3')||_0x3154e6==='StatusAttributeMetadata'||_0x3154e6===_0xa730('0xa4')||_0x3154e6===_0xa730('0xa5')||_0x3154e6===_0xa730('0xa6')){_0x34deba[_0xa730('0x9a')](getInputList(_0x42566b,_0x3dd125,_0x3154e6,_0x30e93f,_0x69f13a[_0xa730('0x9b')],_0x3e8e0d[_0xa730('0x9b')],_0x2afa6e));}}});return Promise['all'](_0x34deba);})[_0xa730('0xd')](function(_0xb58ec0){_0x86ed51=_0xb58ec0[0x0];var _0x481708=_0x8ce35[_0xa730('0x7e')](_0x5d71f0)[_0xa730('0x7e')](_0x86ed51);var _0x2c2db3={'count':_0x481708[_0xa730('0x21')],'rows':_0x481708};return _0x2c2db3;})['then'](respondWithResult(_0x2a4149,null))[_0xa730('0x2c')](function(_0x517361){var _0x56a948=_0x7a6e69[_0xa730('0x1b')][_0xa730('0xa7')]?0x1f4:_0x517361['statusCode']||0x1f4;logger[_0xa730('0x10')](_0x517361[_0xa730('0x11')]);delete _0x517361[_0xa730('0x12')];if(_0x56a948===0x191){_0x56a948=0x190;}_0x2a4149['status'](_0x56a948)[_0xa730('0xa8')](_0x7a6e69[_0xa730('0x1b')]['test']?{'message':_0xa730('0xa9'),'statusCode':_0x517361[_0xa730('0xaa')]}:_0x517361);});};function getSelectList(_0x53bbd7,_0x214aaf,_0x7feb70,_0x2ff99c,_0x24ada6,_0x1e87fd){var _0x2dab4f={'method':_0xa730('0x8f'),'uri':_0x53bbd7+'EntityDefinitions('+_0x2ff99c+_0xa730('0xab')+_0x24ada6+_0xa730('0xac')+_0xa730('0xad'),'headers':{'Authorization':_0xa730('0x8d')+_0x1e87fd,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x2dab4f)[_0xa730('0xd')](function(_0x560c53){var _0x3b57a0=[];var _0x1d8652=_0x560c53[_0xa730('0xae')][_0xa730('0xaf')];_0x1d8652[_0xa730('0x96')](function(_0x240323){_0x3b57a0['push']({'name':_0x240323['Label']['UserLocalizedLabel'][_0xa730('0xb0')],'value':String(_0x240323[_0xa730('0xb1')])});});var _0x44cba1={'id':_0x214aaf+'_'+_0x560c53['LogicalName'],'name':_0x560c53[_0xa730('0xb2')]['UserLocalizedLabel'][_0xa730('0xb0')],'custom':![],'options':_0x3b57a0};_0x7feb70['push'](_0x44cba1);return _0x7feb70;});}function getBooleanList(_0x4505a1,_0x411453,_0x3c8b62,_0x592e09,_0x35c5b4,_0x281c3f){var _0x5ad419={'method':_0xa730('0x8f'),'uri':_0x4505a1+_0xa730('0x90')+_0x592e09+_0xa730('0xab')+_0x35c5b4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xa730('0x8d')+_0x281c3f,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x5ad419)[_0xa730('0xd')](function(_0x1dd153){var _0x25bf11=[];_0x25bf11[_0xa730('0x9a')]({'name':_0x1dd153['OptionSet'][_0xa730('0xb3')]['Label'][_0xa730('0xb4')][_0xa730('0xb0')],'value':'true'},{'name':_0x1dd153['OptionSet'][_0xa730('0xb5')][_0xa730('0xb0')][_0xa730('0xb4')][_0xa730('0xb0')],'value':'false'});var _0x5f3ccf={'id':_0x411453+'_'+_0x1dd153[_0xa730('0x95')],'name':_0x1dd153[_0xa730('0xb2')][_0xa730('0xb4')][_0xa730('0xb0')],'custom':![],'options':_0x25bf11};_0x3c8b62[_0xa730('0x9a')](_0x5f3ccf);return _0x3c8b62;});}function getInputList(_0x1a671a,_0x316c02,_0x3dd1ae,_0x1b3a8a,_0x5e7140,_0x10f9cf,_0x180bbe){var _0x53b3e6={'method':_0xa730('0x8f'),'uri':_0x1a671a+_0xa730('0x90')+_0x5e7140+_0xa730('0xab')+_0x10f9cf+_0xa730('0xb6')+_0x3dd1ae+_0xa730('0xb7'),'headers':{'Authorization':_0xa730('0x8d')+_0x180bbe,'If-None-Match':null,'OData-Version':_0xa730('0x8e')},'json':!![]};return rp(_0x53b3e6)[_0xa730('0xd')](function(_0xb4c786){var _0x2cc635={'id':_0x316c02+'_'+_0xb4c786[_0xa730('0x95')],'name':_0xb4c786[_0xa730('0xb2')][_0xa730('0xb4')]?_0xb4c786[_0xa730('0xb2')][_0xa730('0xb4')][_0xa730('0xb0')]:_0xb4c786[_0xa730('0x95')],'custom':![],'options':[]};_0x1b3a8a[_0xa730('0x9a')](_0x2cc635);return _0x1b3a8a;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 778da14..0689e47 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_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 logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0xdf95a,_0x45f56a){var _0x58cf1b=function(_0x272bf5){while(--_0x272bf5){_0xdf95a['push'](_0xdf95a['shift']());}};_0x58cf1b(++_0x45f56a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 1d2c64c..6c79d28 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 _0x26d8=['include','model','map','attributes','debug','stringify','catch','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDynamics365Account','Dynamics365Account','options','raw','limit'];(function(_0x5baa60,_0x160d9e){var _0x2a8c75=function(_0x53acc7){while(--_0x53acc7){_0x5baa60['push'](_0x5baa60['shift']());}};_0x2a8c75(++_0x160d9e);}(_0x26d8,0xbd));var _0x826d=function(_0x1dda8d,_0x2263f9){_0x1dda8d=_0x1dda8d-0x0;var _0x4b6592=_0x26d8[_0x1dda8d];return _0x4b6592;};'use strict';var _=require(_0x826d('0x0'));var util=require(_0x826d('0x1'));var moment=require(_0x826d('0x2'));var BPromise=require(_0x826d('0x3'));var rs=require(_0x826d('0x4'));var fs=require('fs');var Redis=require(_0x826d('0x5'));var db=require(_0x826d('0x6'))['db'];var utils=require(_0x826d('0x7'));var logger=require(_0x826d('0x8'))('rpc');var config=require(_0x826d('0x9'));var jayson=require(_0x826d('0xa'));var client=jayson[_0x826d('0xb')][_0x826d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x141653,_0xfc41bc,_0x435452){return new BPromise(function(_0x5aee20,_0x1e1a29){return client[_0x826d('0xd')](_0x141653,_0x435452)[_0x826d('0xe')](function(_0x597f14){logger[_0x826d('0xf')](_0x826d('0x10'),_0xfc41bc,_0x826d('0x11'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xfc41bc,_0x826d('0x11'),JSON['stringify'](_0x597f14));if(_0x597f14[_0x826d('0x12')]){if(_0x597f14[_0x826d('0x12')][_0x826d('0x13')]===0x1f4){logger[_0x826d('0x12')](_0x826d('0x10'),_0xfc41bc,_0x597f14[_0x826d('0x12')][_0x826d('0x14')]);return _0x1e1a29(_0x597f14['error']['message']);}logger[_0x826d('0x12')](_0x826d('0x10'),_0xfc41bc,_0x597f14[_0x826d('0x12')][_0x826d('0x14')]);return _0x5aee20(_0x597f14['error']['message']);}else{logger[_0x826d('0xf')](_0x826d('0x10'),_0xfc41bc,_0x826d('0x11'));_0x5aee20(_0x597f14[_0x826d('0x15')]['message']);}})['catch'](function(_0x48b29f){logger[_0x826d('0x12')](_0x826d('0x10'),_0xfc41bc,_0x48b29f);_0x1e1a29(_0x48b29f);});});}exports[_0x826d('0x16')]=function(_0x2156bb){var _0x11f091=this;return new Promise(function(_0x22966c,_0x48bdb0){return db[_0x826d('0x17')]['findAll']({'raw':_0x2156bb[_0x826d('0x18')]?_0x2156bb[_0x826d('0x18')][_0x826d('0x19')]===undefined?!![]:![]:!![],'where':_0x2156bb[_0x826d('0x18')]?_0x2156bb[_0x826d('0x18')]['where']||null:null,'attributes':_0x2156bb[_0x826d('0x18')]?_0x2156bb[_0x826d('0x18')]['attributes']||null:null,'limit':_0x2156bb[_0x826d('0x18')]?_0x2156bb[_0x826d('0x18')][_0x826d('0x1a')]||null:null,'include':_0x2156bb[_0x826d('0x18')]?_0x2156bb[_0x826d('0x18')][_0x826d('0x1b')]?_['map'](_0x2156bb['options'][_0x826d('0x1b')],function(_0x1b4d19){return{'model':db[_0x1b4d19[_0x826d('0x1c')]],'as':_0x1b4d19['as'],'attributes':_0x1b4d19['attributes'],'include':_0x1b4d19[_0x826d('0x1b')]?_[_0x826d('0x1d')](_0x1b4d19[_0x826d('0x1b')],function(_0x577008){return{'model':db[_0x577008[_0x826d('0x1c')]],'as':_0x577008['as'],'attributes':_0x577008[_0x826d('0x1e')],'include':_0x577008[_0x826d('0x1b')]?_[_0x826d('0x1d')](_0x577008[_0x826d('0x1b')],function(_0x4dd094){return{'model':db[_0x4dd094['model']],'as':_0x4dd094['as'],'attributes':_0x4dd094['attributes']};}):[]};}):[]};}):[]:[]})[_0x826d('0xe')](function(_0x27de67){logger[_0x826d('0xf')]('GetDynamics365Account',_0x2156bb);logger[_0x826d('0x1f')](_0x826d('0x16'),_0x2156bb,JSON[_0x826d('0x20')](_0x27de67));_0x22966c(_0x27de67);})[_0x826d('0x21')](function(_0xbe0085){logger[_0x826d('0x12')](_0x826d('0x16'),_0xbe0085[_0x826d('0x14')],_0x2156bb);_0x48bdb0(_0x11f091[_0x826d('0x12')](0x1f4,_0xbe0085['message']));});});};exports['ShowDynamics365Account']=function(_0x3ceb20){var _0x5f364c=this;return new Promise(function(_0x2cda5f,_0x2e7189){return db[_0x826d('0x17')]['find']({'raw':_0x3ceb20[_0x826d('0x18')]?_0x3ceb20[_0x826d('0x18')][_0x826d('0x19')]===undefined?!![]:![]:!![],'where':_0x3ceb20['options']?_0x3ceb20[_0x826d('0x18')][_0x826d('0x22')]||null:null,'attributes':_0x3ceb20[_0x826d('0x18')]?_0x3ceb20[_0x826d('0x18')][_0x826d('0x1e')]||null:null,'include':_0x3ceb20[_0x826d('0x18')]?_0x3ceb20[_0x826d('0x18')][_0x826d('0x1b')]?_[_0x826d('0x1d')](_0x3ceb20['options'][_0x826d('0x1b')],function(_0x57dbdb){return{'model':db[_0x57dbdb['model']],'as':_0x57dbdb['as'],'attributes':_0x57dbdb['attributes'],'include':_0x57dbdb['include']?_[_0x826d('0x1d')](_0x57dbdb['include'],function(_0x1f087c){return{'model':db[_0x1f087c['model']],'as':_0x1f087c['as'],'attributes':_0x1f087c['attributes'],'include':_0x1f087c[_0x826d('0x1b')]?_['map'](_0x1f087c['include'],function(_0x23011a){return{'model':db[_0x23011a[_0x826d('0x1c')]],'as':_0x23011a['as'],'attributes':_0x23011a[_0x826d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x826d('0xe')](function(_0x492d2b){logger[_0x826d('0xf')](_0x826d('0x23'),_0x3ceb20);logger[_0x826d('0x1f')]('ShowDynamics365Account',_0x3ceb20,JSON[_0x826d('0x20')](_0x492d2b));_0x2cda5f(_0x492d2b);})[_0x826d('0x21')](function(_0x4faf62){logger[_0x826d('0x12')](_0x826d('0x23'),_0x4faf62[_0x826d('0x14')],_0x3ceb20);_0x2e7189(_0x5f364c['error'](0x1f4,_0x4faf62[_0x826d('0x14')]));});});}; \ No newline at end of file +var _0x7d18=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDynamics365Account','raw','options','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0x7d18,0x1a6));var _0x87d1=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x7d18[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x87d1('0x0'));var util=require(_0x87d1('0x1'));var moment=require(_0x87d1('0x2'));var BPromise=require(_0x87d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87d1('0x4'));var db=require(_0x87d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x87d1('0x6'))('rpc');var config=require(_0x87d1('0x7'));var jayson=require(_0x87d1('0x8'));var client=jayson[_0x87d1('0x9')][_0x87d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf21442,_0x59fadd,_0xd147b4){return new BPromise(function(_0x1df956,_0x2c83bc){return client[_0x87d1('0xb')](_0xf21442,_0xd147b4)[_0x87d1('0xc')](function(_0x2d9de6){logger[_0x87d1('0xd')](_0x87d1('0xe'),_0x59fadd,'request\x20sent');logger[_0x87d1('0xf')](_0x87d1('0x10'),_0x59fadd,_0x87d1('0x11'),JSON[_0x87d1('0x12')](_0x2d9de6));if(_0x2d9de6[_0x87d1('0x13')]){if(_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x14')]===0x1f4){logger[_0x87d1('0x13')](_0x87d1('0xe'),_0x59fadd,_0x2d9de6['error'][_0x87d1('0x15')]);return _0x2c83bc(_0x2d9de6[_0x87d1('0x13')]['message']);}logger['error'](_0x87d1('0xe'),_0x59fadd,_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x15')]);return _0x1df956(_0x2d9de6[_0x87d1('0x13')][_0x87d1('0x15')]);}else{logger[_0x87d1('0xd')](_0x87d1('0xe'),_0x59fadd,_0x87d1('0x11'));_0x1df956(_0x2d9de6[_0x87d1('0x16')][_0x87d1('0x15')]);}})['catch'](function(_0x126eaf){logger['error'](_0x87d1('0xe'),_0x59fadd,_0x126eaf);_0x2c83bc(_0x126eaf);});});}exports[_0x87d1('0x17')]=function(_0x98d25e){var _0x59ea49=this;return new Promise(function(_0x54f00f,_0x1be3de){return db['Dynamics365Account']['findAll']({'raw':_0x98d25e['options']?_0x98d25e['options'][_0x87d1('0x18')]===undefined?!![]:![]:!![],'where':_0x98d25e[_0x87d1('0x19')]?_0x98d25e['options'][_0x87d1('0x1a')]||null:null,'attributes':_0x98d25e['options']?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1b')]||null:null,'limit':_0x98d25e[_0x87d1('0x19')]?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1c')]||null:null,'include':_0x98d25e[_0x87d1('0x19')]?_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x98d25e[_0x87d1('0x19')][_0x87d1('0x1d')],function(_0x229000){return{'model':db[_0x229000[_0x87d1('0x1f')]],'as':_0x229000['as'],'attributes':_0x229000[_0x87d1('0x1b')],'include':_0x229000[_0x87d1('0x1d')]?_['map'](_0x229000[_0x87d1('0x1d')],function(_0x4a4e34){return{'model':db[_0x4a4e34[_0x87d1('0x1f')]],'as':_0x4a4e34['as'],'attributes':_0x4a4e34[_0x87d1('0x1b')],'include':_0x4a4e34[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x4a4e34[_0x87d1('0x1d')],function(_0x5d0e4f){return{'model':db[_0x5d0e4f['model']],'as':_0x5d0e4f['as'],'attributes':_0x5d0e4f[_0x87d1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x87d1('0xc')](function(_0x34cb57){logger[_0x87d1('0xd')]('GetDynamics365Account',_0x98d25e);logger[_0x87d1('0xf')](_0x87d1('0x17'),_0x98d25e,JSON[_0x87d1('0x12')](_0x34cb57));_0x54f00f(_0x34cb57);})[_0x87d1('0x20')](function(_0x48b1a3){logger[_0x87d1('0x13')](_0x87d1('0x17'),_0x48b1a3[_0x87d1('0x15')],_0x98d25e);_0x1be3de(_0x59ea49[_0x87d1('0x13')](0x1f4,_0x48b1a3[_0x87d1('0x15')]));});});};exports[_0x87d1('0x21')]=function(_0x43ff43){var _0x3944b3=this;return new Promise(function(_0x16ece3,_0x403469){return db[_0x87d1('0x22')][_0x87d1('0x23')]({'raw':_0x43ff43['options']?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x18')]===undefined?!![]:![]:!![],'where':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')]['where']||null:null,'attributes':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1b')]||null:null,'include':_0x43ff43[_0x87d1('0x19')]?_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x43ff43[_0x87d1('0x19')][_0x87d1('0x1d')],function(_0x5f0148){return{'model':db[_0x5f0148[_0x87d1('0x1f')]],'as':_0x5f0148['as'],'attributes':_0x5f0148[_0x87d1('0x1b')],'include':_0x5f0148[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0x5f0148[_0x87d1('0x1d')],function(_0xf0bd55){return{'model':db[_0xf0bd55[_0x87d1('0x1f')]],'as':_0xf0bd55['as'],'attributes':_0xf0bd55[_0x87d1('0x1b')],'include':_0xf0bd55[_0x87d1('0x1d')]?_[_0x87d1('0x1e')](_0xf0bd55[_0x87d1('0x1d')],function(_0x2b88ea){return{'model':db[_0x2b88ea[_0x87d1('0x1f')]],'as':_0x2b88ea['as'],'attributes':_0x2b88ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x426418){logger[_0x87d1('0xd')](_0x87d1('0x21'),_0x43ff43);logger['debug']('ShowDynamics365Account',_0x43ff43,JSON[_0x87d1('0x12')](_0x426418));_0x16ece3(_0x426418);})[_0x87d1('0x20')](function(_0x2913bb){logger[_0x87d1('0x13')](_0x87d1('0x21'),_0x2913bb[_0x87d1('0x15')],_0x43ff43);_0x403469(_0x3944b3[_0x87d1('0x13')](0x1f4,_0x2913bb[_0x87d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 150fa82..3bb25ed 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 _0xe6e4=['../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','index','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x57534d,_0x4dcaed){var _0x580a2e=function(_0x53fb88){while(--_0x53fb88){_0x57534d['push'](_0x57534d['shift']());}};_0x580a2e(++_0x4dcaed);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x327c12,_0x2874c9){_0x327c12=_0x327c12-0x0;var _0x4cd602=_0xe6e4[_0x327c12];return _0x4cd602;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require(_0x4e6e('0x2'));var timeout=require(_0x4e6e('0x3'));var express=require(_0x4e6e('0x4'));var router=express[_0x4e6e('0x5')]();var fs_extra=require(_0x4e6e('0x6'));var auth=require(_0x4e6e('0x7'));var interaction=require(_0x4e6e('0x8'));var config=require('../../config/environment');var controller=require(_0x4e6e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e6e('0xa')]);router[_0x4e6e('0xb')]('/:id',auth[_0x4e6e('0xc')](),controller[_0x4e6e('0xd')]);router[_0x4e6e('0xb')](_0x4e6e('0xe'),auth[_0x4e6e('0xc')](),controller['getFields']);router[_0x4e6e('0xb')](_0x4e6e('0xf'),auth[_0x4e6e('0xc')](),controller[_0x4e6e('0x10')]);router[_0x4e6e('0xb')]('/:id/descriptions',auth[_0x4e6e('0xc')](),controller[_0x4e6e('0x11')]);router['post']('/',auth[_0x4e6e('0xc')](),controller[_0x4e6e('0x12')]);router[_0x4e6e('0x13')](_0x4e6e('0x14'),auth[_0x4e6e('0xc')](),controller[_0x4e6e('0x15')]);router[_0x4e6e('0x16')]('/:id',auth[_0x4e6e('0xc')](),controller[_0x4e6e('0x17')]);module[_0x4e6e('0x18')]=router; \ No newline at end of file +var _0x256e=['create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x545a88,_0x2518b8){var _0x1df32c=function(_0x102b40){while(--_0x102b40){_0x545a88['push'](_0x545a88['shift']());}};_0x1df32c(++_0x2518b8);}(_0x256e,0x176));var _0xe256=function(_0x1bb908,_0xb62dc1){_0x1bb908=_0x1bb908-0x0;var _0x40515e=_0x256e[_0x1bb908];return _0x40515e;};'use strict';var multer=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe256('0x2'));var router=express[_0xe256('0x3')]();var fs_extra=require(_0xe256('0x4'));var auth=require(_0xe256('0x5'));var interaction=require(_0xe256('0x6'));var config=require(_0xe256('0x7'));var controller=require(_0xe256('0x8'));router[_0xe256('0x9')]('/',auth[_0xe256('0xa')](),controller[_0xe256('0xb')]);router[_0xe256('0x9')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller['show']);router[_0xe256('0x9')]('/:id/fields',auth[_0xe256('0xa')](),controller['getFields']);router[_0xe256('0x9')](_0xe256('0xd'),auth[_0xe256('0xa')](),controller[_0xe256('0xe')]);router[_0xe256('0x9')]('/:id/descriptions',auth[_0xe256('0xa')](),controller[_0xe256('0xf')]);router[_0xe256('0x10')]('/',auth['isAuthenticated'](),controller[_0xe256('0x11')]);router[_0xe256('0x12')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller[_0xe256('0x13')]);router[_0xe256('0x14')](_0xe256('0xc'),auth[_0xe256('0xa')](),controller[_0xe256('0x15')]);module[_0xe256('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a455357..ca45a26 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 _0x7015=['exports','STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x6480a6,_0x250b90){var _0x374579=function(_0x4c8f86){while(--_0x4c8f86){_0x6480a6['push'](_0x6480a6['shift']());}};_0x374579(++_0x250b90);}(_0x7015,0x1af));var _0x5701=function(_0x6e51e2,_0xccee82){_0x6e51e2=_0x6e51e2-0x0;var _0x54714b=_0x7015[_0x6e51e2];return _0x54714b;};'use strict';var Sequelize=require(_0x5701('0x0'));module[_0x5701('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5701('0x2')]},'ticketType':{'type':Sequelize[_0x5701('0x3')](_0x5701('0x4'),'phonecall'),'defaultValue':_0x5701('0x4')},'moduleCreate':{'type':Sequelize[_0x5701('0x3')](_0x5701('0x5'),_0x5701('0x6')),'defaultValue':_0x5701('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5701('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5e7b=['STRING','incident','ENUM','contact','exports'];(function(_0x31f420,_0x2ea4fe){var _0x90f962=function(_0x253b45){while(--_0x253b45){_0x31f420['push'](_0x31f420['shift']());}};_0x90f962(++_0x2ea4fe);}(_0x5e7b,0x1b2));var _0xb5e7=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x5e7b[_0x2718c7];return _0x59d89c;};'use strict';var Sequelize=require('sequelize');module[_0xb5e7('0x0')]={'name':{'type':Sequelize[_0xb5e7('0x1')]},'description':{'type':Sequelize[_0xb5e7('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xb5e7('0x2'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xb5e7('0x3')](_0xb5e7('0x4'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb5e7('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3c7d1cd..e4d9970 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 _0x52ef=['find','destroy','getFields','Dynamics365Field','order','hasOwnProperty','getSubjects','getDescriptions','findOne','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','sendStatus','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','params','include','catch','create','body'];(function(_0x1cbf0e,_0x1f9ebc){var _0x2d329e=function(_0x31888f){while(--_0x31888f){_0x1cbf0e['push'](_0x1cbf0e['shift']());}};_0x2d329e(++_0x1f9ebc);}(_0x52ef,0x1cb));var _0xf52e=function(_0x267084,_0x224f6d){_0x267084=_0x267084-0x0;var _0x4d9f9f=_0x52ef[_0x267084];return _0x4d9f9f;};'use strict';var emlformat=require(_0xf52e('0x0'));var rimraf=require(_0xf52e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf52e('0x2'));var moment=require(_0xf52e('0x3'));var BPromise=require(_0xf52e('0x4'));var Mustache=require(_0xf52e('0x5'));var util=require(_0xf52e('0x6'));var path=require('path');var sox=require(_0xf52e('0x7'));var csv=require(_0xf52e('0x8'));var ejs=require(_0xf52e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf52e('0xa'));var squel=require('squel');var crypto=require(_0xf52e('0xb'));var jsforce=require(_0xf52e('0xc'));var deskjs=require(_0xf52e('0xd'));var toCsv=require(_0xf52e('0x8'));var querystring=require('querystring');var Papa=require(_0xf52e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf52e('0xf'));var as=require(_0xf52e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf52e('0x11'));var utils=require(_0xf52e('0x12'));var config=require(_0xf52e('0x13'));var licenseUtil=require(_0xf52e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f883d,_0x1b9253){_0x1b9253=_0x1b9253||0xcc;return function(_0x3e7c8c){if(_0x3e7c8c){return _0x1f883d['sendStatus'](_0x1b9253);}return _0x1f883d[_0xf52e('0x15')](_0x1b9253)[_0xf52e('0x16')]();};}function respondWithResult(_0x159ab3,_0x22bad8){_0x22bad8=_0x22bad8||0xc8;return function(_0x377608){if(_0x377608){return _0x159ab3[_0xf52e('0x15')](_0x22bad8)[_0xf52e('0x17')](_0x377608);}};}function respondWithFilteredResult(_0x13e24e,_0x158c07){return function(_0x168b82){if(_0x168b82){var _0x3d0761=typeof _0x158c07[_0xf52e('0x18')]===_0xf52e('0x19')&&typeof _0x158c07['limit']===_0xf52e('0x19');var _0x11a7bc=_0x168b82[_0xf52e('0x1a')];var _0x323a67=_0x3d0761?0x0:_0x158c07['offset'];var _0x107b1b=_0x3d0761?_0x168b82[_0xf52e('0x1a')]:_0x158c07[_0xf52e('0x18')]+_0x158c07[_0xf52e('0x1b')];var _0x11d5ee;if(_0x107b1b>=_0x11a7bc){_0x107b1b=_0x11a7bc;_0x11d5ee=0xc8;}else{_0x11d5ee=0xce;}_0x13e24e['status'](_0x11d5ee);return _0x13e24e[_0xf52e('0x1c')](_0xf52e('0x1d'),_0x323a67+'-'+_0x107b1b+'/'+_0x11a7bc)[_0xf52e('0x17')](_0x168b82);}return null;};}function patchUpdates(_0x1e0080){return function(_0x4cb9a2){try{jsonpatch[_0xf52e('0x1e')](_0x4cb9a2,_0x1e0080,!![]);}catch(_0x3b1cd7){return BPromise['reject'](_0x3b1cd7);}return _0x4cb9a2[_0xf52e('0x1f')]();};}function saveUpdates(_0x58b94d,_0x595049){return function(_0x1fe1b8){if(_0x1fe1b8){return _0x1fe1b8[_0xf52e('0x20')](_0x58b94d)['then'](function(_0xb8eb8){return _0xb8eb8;});}return null;};}function removeEntity(_0x2f7400,_0x3b9bf6){return function(_0x1fe1b5){if(_0x1fe1b5){return _0x1fe1b5['destroy']()['then'](function(){_0x2f7400[_0xf52e('0x15')](0xcc)[_0xf52e('0x16')]();});}};}function handleEntityNotFound(_0x55a049,_0x59e4b2){return function(_0x42e033){if(!_0x42e033){_0x55a049[_0xf52e('0x21')](0x194);}return _0x42e033;};}function handleError(_0x2d7842,_0x1e2a9e){_0x1e2a9e=_0x1e2a9e||0x1f4;return function(_0x38db00){logger[_0xf52e('0x22')](_0x38db00[_0xf52e('0x23')]);if(_0x38db00[_0xf52e('0x24')]){delete _0x38db00[_0xf52e('0x24')];}_0x2d7842[_0xf52e('0x15')](_0x1e2a9e)[_0xf52e('0x25')](_0x38db00);};}exports['index']=function(_0x4b7eee,_0x159e9c){var _0x8871ac={},_0x54f3ee={},_0x365f90={'count':0x0,'rows':[]};var _0x565b82=_[_0xf52e('0x26')](db[_0xf52e('0x27')][_0xf52e('0x28')],function(_0x18f209){return{'name':_0x18f209['fieldName'],'type':_0x18f209[_0xf52e('0x29')]['key']};});_0x54f3ee[_0xf52e('0x2a')]=_[_0xf52e('0x26')](_0x565b82,_0xf52e('0x24'));_0x54f3ee[_0xf52e('0x2b')]=_[_0xf52e('0x2c')](_0x4b7eee[_0xf52e('0x2b')]);_0x54f3ee[_0xf52e('0x2d')]=_[_0xf52e('0x2e')](_0x54f3ee['model'],_0x54f3ee[_0xf52e('0x2b')]);_0x8871ac[_0xf52e('0x2f')]=_[_0xf52e('0x2e')](_0x54f3ee[_0xf52e('0x2a')],qs[_0xf52e('0x30')](_0x4b7eee[_0xf52e('0x2b')][_0xf52e('0x30')]));_0x8871ac[_0xf52e('0x2f')]=_0x8871ac[_0xf52e('0x2f')][_0xf52e('0x31')]?_0x8871ac['attributes']:_0x54f3ee[_0xf52e('0x2a')];if(!_0x4b7eee['query']['hasOwnProperty'](_0xf52e('0x32'))){_0x8871ac[_0xf52e('0x1b')]=qs[_0xf52e('0x1b')](_0x4b7eee['query'][_0xf52e('0x1b')]);_0x8871ac[_0xf52e('0x18')]=qs['offset'](_0x4b7eee[_0xf52e('0x2b')]['offset']);}_0x8871ac['order']=qs['sort'](_0x4b7eee[_0xf52e('0x2b')][_0xf52e('0x33')]);_0x8871ac[_0xf52e('0x34')]=qs[_0xf52e('0x2d')](_[_0xf52e('0x35')](_0x4b7eee[_0xf52e('0x2b')],_0x54f3ee[_0xf52e('0x2d')]),_0x565b82);if(_0x4b7eee[_0xf52e('0x2b')][_0xf52e('0x36')]){_0x8871ac[_0xf52e('0x34')]=_[_0xf52e('0x37')](_0x8871ac[_0xf52e('0x34')],{'$or':_[_0xf52e('0x26')](_0x565b82,function(_0x14c0b5){if(_0x14c0b5['type']!==_0xf52e('0x38')){var _0x726cd6={};_0x726cd6[_0x14c0b5[_0xf52e('0x24')]]={'$like':'%'+_0x4b7eee[_0xf52e('0x2b')][_0xf52e('0x36')]+'%'};return _0x726cd6;}})});}_0x8871ac=_[_0xf52e('0x37')]({},_0x8871ac,_0x4b7eee[_0xf52e('0x39')]);var _0x4021a3={'where':_0x8871ac[_0xf52e('0x34')]};return db[_0xf52e('0x27')][_0xf52e('0x1a')](_0x4021a3)[_0xf52e('0x3a')](function(_0x104944){_0x365f90[_0xf52e('0x1a')]=_0x104944;if(_0x4b7eee[_0xf52e('0x2b')][_0xf52e('0x3b')]){_0x8871ac['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x8871ac);})[_0xf52e('0x3a')](function(_0x5847e7){_0x365f90[_0xf52e('0x3c')]=_0x5847e7;return _0x365f90;})[_0xf52e('0x3a')](respondWithFilteredResult(_0x159e9c,_0x8871ac))['catch'](handleError(_0x159e9c,null));};exports['show']=function(_0x53f7ac,_0xfb9efc){var _0x3cb1fd={'raw':![],'where':{'id':_0x53f7ac[_0xf52e('0x3d')]['id']}},_0x2fcf33={};_0x2fcf33[_0xf52e('0x2a')]=_[_0xf52e('0x2c')](db[_0xf52e('0x27')][_0xf52e('0x28')]);_0x2fcf33['query']=_[_0xf52e('0x2c')](_0x53f7ac[_0xf52e('0x2b')]);_0x2fcf33[_0xf52e('0x2d')]=_[_0xf52e('0x2e')](_0x2fcf33[_0xf52e('0x2a')],_0x2fcf33[_0xf52e('0x2b')]);_0x3cb1fd[_0xf52e('0x2f')]=_[_0xf52e('0x2e')](_0x2fcf33[_0xf52e('0x2a')],qs[_0xf52e('0x30')](_0x53f7ac[_0xf52e('0x2b')][_0xf52e('0x30')]));_0x3cb1fd[_0xf52e('0x2f')]=_0x3cb1fd['attributes'][_0xf52e('0x31')]?_0x3cb1fd['attributes']:_0x2fcf33['model'];if(_0x53f7ac[_0xf52e('0x2b')][_0xf52e('0x3b')]){_0x3cb1fd[_0xf52e('0x3e')]=[{'all':!![]}];}_0x3cb1fd=_['merge']({},_0x3cb1fd,_0x53f7ac['options']);return db['Dynamics365Configuration']['find'](_0x3cb1fd)[_0xf52e('0x3a')](handleEntityNotFound(_0xfb9efc,null))[_0xf52e('0x3a')](respondWithResult(_0xfb9efc,null))[_0xf52e('0x3f')](handleError(_0xfb9efc,null));};exports['create']=function(_0x29969b,_0x438067){return db[_0xf52e('0x27')][_0xf52e('0x40')](_0x29969b[_0xf52e('0x41')],{})[_0xf52e('0x3a')](respondWithResult(_0x438067,0xc9))['catch'](handleError(_0x438067,null));};exports[_0xf52e('0x20')]=function(_0x1806af,_0x379d32){if(_0x1806af[_0xf52e('0x41')]['id']){delete _0x1806af['body']['id'];}return db['Dynamics365Configuration'][_0xf52e('0x42')]({'where':{'id':_0x1806af['params']['id']}})[_0xf52e('0x3a')](handleEntityNotFound(_0x379d32,null))[_0xf52e('0x3a')](saveUpdates(_0x1806af[_0xf52e('0x41')],null))[_0xf52e('0x3a')](respondWithResult(_0x379d32,null))[_0xf52e('0x3f')](handleError(_0x379d32,null));};exports[_0xf52e('0x43')]=function(_0x979b6b,_0x48d292){return db[_0xf52e('0x27')][_0xf52e('0x42')]({'where':{'id':_0x979b6b[_0xf52e('0x3d')]['id']}})[_0xf52e('0x3a')](handleEntityNotFound(_0x48d292,null))[_0xf52e('0x3a')](removeEntity(_0x48d292,null))['catch'](handleError(_0x48d292,null));};exports[_0xf52e('0x44')]=function(_0x366f44,_0x121be0,_0x116a42){var _0x2bed53={};var _0x33d135={};var _0x18a53e;var _0x5b8e44;return db[_0xf52e('0x27')]['findOne']({'where':{'id':_0x366f44['params']['id']}})['then'](handleEntityNotFound(_0x121be0,null))[_0xf52e('0x3a')](function(_0x5ceb1b){if(_0x5ceb1b){_0x18a53e=_0x5ceb1b;_0x33d135[_0xf52e('0x2a')]=_[_0xf52e('0x2c')](db[_0xf52e('0x45')]['rawAttributes']);_0x33d135[_0xf52e('0x2b')]=_[_0xf52e('0x2c')](_0x366f44['query']);_0x33d135[_0xf52e('0x2d')]=_[_0xf52e('0x2e')](_0x33d135['model'],_0x33d135[_0xf52e('0x2b')]);_0x2bed53[_0xf52e('0x2f')]=_[_0xf52e('0x2e')](_0x33d135[_0xf52e('0x2a')],qs[_0xf52e('0x30')](_0x366f44[_0xf52e('0x2b')][_0xf52e('0x30')]));_0x2bed53[_0xf52e('0x2f')]=_0x2bed53['attributes'][_0xf52e('0x31')]?_0x2bed53['attributes']:_0x33d135['model'];_0x2bed53[_0xf52e('0x46')]=qs[_0xf52e('0x33')](_0x366f44[_0xf52e('0x2b')]['sort']);_0x2bed53[_0xf52e('0x34')]=qs[_0xf52e('0x2d')](_[_0xf52e('0x35')](_0x366f44[_0xf52e('0x2b')],_0x33d135[_0xf52e('0x2d')]));if(_0x366f44['query'][_0xf52e('0x36')]){_0x2bed53[_0xf52e('0x34')]=_[_0xf52e('0x37')](_0x2bed53['where'],{'$or':_['map'](_0x2bed53[_0xf52e('0x2f')],function(_0x1c8efd){var _0x17c04b={};_0x17c04b[_0x1c8efd]={'$like':'%'+_0x366f44['query']['filter']+'%'};return _0x17c04b;})});}_0x2bed53=_[_0xf52e('0x37')]({},_0x2bed53,_0x366f44[_0xf52e('0x39')]);return _0x18a53e['getFields'](_0x2bed53);}})[_0xf52e('0x3a')](function(_0x505a09){if(_0x505a09){_0x5b8e44=_0x505a09['length'];if(!_0x366f44[_0xf52e('0x2b')][_0xf52e('0x47')]('nolimit')){_0x2bed53[_0xf52e('0x1b')]=qs['limit'](_0x366f44['query'][_0xf52e('0x1b')]);_0x2bed53[_0xf52e('0x18')]=qs[_0xf52e('0x18')](_0x366f44[_0xf52e('0x2b')][_0xf52e('0x18')]);}return _0x18a53e[_0xf52e('0x44')](_0x2bed53);}})[_0xf52e('0x3a')](function(_0x20bc12){if(_0x20bc12){return _0x20bc12?{'count':_0x5b8e44,'rows':_0x20bc12}:null;}})['then'](respondWithResult(_0x121be0,null))[_0xf52e('0x3f')](handleError(_0x121be0,null));};exports[_0xf52e('0x48')]=function(_0x1f2bc7,_0x1f2d6d,_0x19c171){var _0x103768={};var _0x446066={};var _0x10c379;var _0x3e9352;return db[_0xf52e('0x27')]['findOne']({'where':{'id':_0x1f2bc7[_0xf52e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1f2d6d,null))[_0xf52e('0x3a')](function(_0x3cd40b){if(_0x3cd40b){_0x10c379=_0x3cd40b;_0x446066[_0xf52e('0x2a')]=_[_0xf52e('0x2c')](db['Dynamics365Field'][_0xf52e('0x28')]);_0x446066[_0xf52e('0x2b')]=_[_0xf52e('0x2c')](_0x1f2bc7[_0xf52e('0x2b')]);_0x446066[_0xf52e('0x2d')]=_[_0xf52e('0x2e')](_0x446066[_0xf52e('0x2a')],_0x446066['query']);_0x103768[_0xf52e('0x2f')]=_[_0xf52e('0x2e')](_0x446066[_0xf52e('0x2a')],qs[_0xf52e('0x30')](_0x1f2bc7[_0xf52e('0x2b')]['fields']));_0x103768[_0xf52e('0x2f')]=_0x103768['attributes'][_0xf52e('0x31')]?_0x103768[_0xf52e('0x2f')]:_0x446066[_0xf52e('0x2a')];_0x103768[_0xf52e('0x46')]=qs[_0xf52e('0x33')](_0x1f2bc7['query'][_0xf52e('0x33')]);_0x103768[_0xf52e('0x34')]=qs[_0xf52e('0x2d')](_[_0xf52e('0x35')](_0x1f2bc7[_0xf52e('0x2b')],_0x446066['filters']));if(_0x1f2bc7[_0xf52e('0x2b')]['filter']){_0x103768['where']=_['merge'](_0x103768[_0xf52e('0x34')],{'$or':_[_0xf52e('0x26')](_0x103768['attributes'],function(_0xdc3d24){var _0x1fb1ce={};_0x1fb1ce[_0xdc3d24]={'$like':'%'+_0x1f2bc7[_0xf52e('0x2b')]['filter']+'%'};return _0x1fb1ce;})});}_0x103768=_[_0xf52e('0x37')]({},_0x103768,_0x1f2bc7['options']);return _0x10c379[_0xf52e('0x48')](_0x103768);}})[_0xf52e('0x3a')](function(_0x1d07fc){if(_0x1d07fc){_0x3e9352=_0x1d07fc[_0xf52e('0x31')];if(!_0x1f2bc7['query'][_0xf52e('0x47')](_0xf52e('0x32'))){_0x103768[_0xf52e('0x1b')]=qs[_0xf52e('0x1b')](_0x1f2bc7[_0xf52e('0x2b')]['limit']);_0x103768[_0xf52e('0x18')]=qs[_0xf52e('0x18')](_0x1f2bc7[_0xf52e('0x2b')]['offset']);}return _0x10c379['getSubjects'](_0x103768);}})[_0xf52e('0x3a')](function(_0x7948c7){if(_0x7948c7){return _0x7948c7?{'count':_0x3e9352,'rows':_0x7948c7}:null;}})[_0xf52e('0x3a')](respondWithResult(_0x1f2d6d,null))[_0xf52e('0x3f')](handleError(_0x1f2d6d,null));};exports[_0xf52e('0x49')]=function(_0x55d050,_0x325c5d,_0x3412d4){var _0x93807={};var _0x371868={};var _0x77f2a;var _0x53dcf1;return db[_0xf52e('0x27')][_0xf52e('0x4a')]({'where':{'id':_0x55d050[_0xf52e('0x3d')]['id']}})[_0xf52e('0x3a')](handleEntityNotFound(_0x325c5d,null))[_0xf52e('0x3a')](function(_0x49fa0a){if(_0x49fa0a){_0x77f2a=_0x49fa0a;_0x371868['model']=_['keys'](db['Dynamics365Field'][_0xf52e('0x28')]);_0x371868[_0xf52e('0x2b')]=_[_0xf52e('0x2c')](_0x55d050['query']);_0x371868[_0xf52e('0x2d')]=_[_0xf52e('0x2e')](_0x371868[_0xf52e('0x2a')],_0x371868['query']);_0x93807[_0xf52e('0x2f')]=_[_0xf52e('0x2e')](_0x371868['model'],qs['fields'](_0x55d050['query'][_0xf52e('0x30')]));_0x93807[_0xf52e('0x2f')]=_0x93807[_0xf52e('0x2f')][_0xf52e('0x31')]?_0x93807[_0xf52e('0x2f')]:_0x371868[_0xf52e('0x2a')];_0x93807[_0xf52e('0x46')]=qs[_0xf52e('0x33')](_0x55d050[_0xf52e('0x2b')][_0xf52e('0x33')]);_0x93807[_0xf52e('0x34')]=qs[_0xf52e('0x2d')](_['pick'](_0x55d050[_0xf52e('0x2b')],_0x371868[_0xf52e('0x2d')]));if(_0x55d050[_0xf52e('0x2b')]['filter']){_0x93807['where']=_[_0xf52e('0x37')](_0x93807[_0xf52e('0x34')],{'$or':_[_0xf52e('0x26')](_0x93807['attributes'],function(_0x40eb43){var _0x5234a3={};_0x5234a3[_0x40eb43]={'$like':'%'+_0x55d050[_0xf52e('0x2b')][_0xf52e('0x36')]+'%'};return _0x5234a3;})});}_0x93807=_[_0xf52e('0x37')]({},_0x93807,_0x55d050[_0xf52e('0x39')]);return _0x77f2a[_0xf52e('0x49')](_0x93807);}})[_0xf52e('0x3a')](function(_0x142fe2){if(_0x142fe2){_0x53dcf1=_0x142fe2[_0xf52e('0x31')];if(!_0x55d050[_0xf52e('0x2b')][_0xf52e('0x47')]('nolimit')){_0x93807[_0xf52e('0x1b')]=qs[_0xf52e('0x1b')](_0x55d050[_0xf52e('0x2b')][_0xf52e('0x1b')]);_0x93807[_0xf52e('0x18')]=qs[_0xf52e('0x18')](_0x55d050[_0xf52e('0x2b')][_0xf52e('0x18')]);}return _0x77f2a['getDescriptions'](_0x93807);}})[_0xf52e('0x3a')](function(_0xb82dcb){if(_0xb82dcb){return _0xb82dcb?{'count':_0x53dcf1,'rows':_0xb82dcb}:null;}})['then'](respondWithResult(_0x325c5d,null))['catch'](handleError(_0x325c5d,null));}; \ No newline at end of file +var _0x2bf7=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','getFields','findOne','Dynamics365Field','pick','getDescriptions','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','Dynamics365Configuration','rawAttributes','fieldName','map','keys','query'];(function(_0x5b27ed,_0x337a39){var _0x172d15=function(_0x25368d){while(--_0x25368d){_0x5b27ed['push'](_0x5b27ed['shift']());}};_0x172d15(++_0x337a39);}(_0x2bf7,0x144));var _0x72bf=function(_0x30d0d4,_0xaee220){_0x30d0d4=_0x30d0d4-0x0;var _0x5e95b0=_0x2bf7[_0x30d0d4];return _0x5e95b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x72bf('0x0'));var jsonpatch=require(_0x72bf('0x1'));var rp=require('request-promise');var moment=require(_0x72bf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x72bf('0x3'));var util=require(_0x72bf('0x4'));var path=require('path');var sox=require(_0x72bf('0x5'));var csv=require(_0x72bf('0x6'));var ejs=require(_0x72bf('0x7'));var fs=require('fs');var fs_extra=require(_0x72bf('0x8'));var _=require('lodash');var squel=require(_0x72bf('0x9'));var crypto=require(_0x72bf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x72bf('0xb'));var toCsv=require(_0x72bf('0x6'));var querystring=require(_0x72bf('0xc'));var Papa=require('papaparse');var Redis=require(_0x72bf('0xd'));var authService=require(_0x72bf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x72bf('0xf'));var hardwareService=require(_0x72bf('0x10'));var logger=require('../../config/logger')(_0x72bf('0x11'));var utils=require('../../config/utils');var config=require(_0x72bf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x72bf('0x13'))['db'];function respondWithStatusCode(_0x23e4fb,_0x1aec3b){_0x1aec3b=_0x1aec3b||0xcc;return function(_0x505b6f){if(_0x505b6f){return _0x23e4fb['sendStatus'](_0x1aec3b);}return _0x23e4fb[_0x72bf('0x14')](_0x1aec3b)[_0x72bf('0x15')]();};}function respondWithResult(_0x287908,_0x4f3bcb){_0x4f3bcb=_0x4f3bcb||0xc8;return function(_0x3e9914){if(_0x3e9914){return _0x287908[_0x72bf('0x14')](_0x4f3bcb)[_0x72bf('0x16')](_0x3e9914);}};}function respondWithFilteredResult(_0x2b1a03,_0x175dbe){return function(_0x13fbed){if(_0x13fbed){var _0x54b458=typeof _0x175dbe[_0x72bf('0x17')]===_0x72bf('0x18')&&typeof _0x175dbe[_0x72bf('0x19')]==='undefined';var _0x2f2fa8=_0x13fbed[_0x72bf('0x1a')];var _0x534dce=_0x54b458?0x0:_0x175dbe[_0x72bf('0x17')];var _0x126cec=_0x54b458?_0x13fbed[_0x72bf('0x1a')]:_0x175dbe[_0x72bf('0x17')]+_0x175dbe['limit'];var _0x31af90;if(_0x126cec>=_0x2f2fa8){_0x126cec=_0x2f2fa8;_0x31af90=0xc8;}else{_0x31af90=0xce;}_0x2b1a03[_0x72bf('0x14')](_0x31af90);return _0x2b1a03[_0x72bf('0x1b')](_0x72bf('0x1c'),_0x534dce+'-'+_0x126cec+'/'+_0x2f2fa8)['json'](_0x13fbed);}return null;};}function patchUpdates(_0x3aec1d){return function(_0x81ff42){try{jsonpatch['apply'](_0x81ff42,_0x3aec1d,!![]);}catch(_0x5c4239){return BPromise['reject'](_0x5c4239);}return _0x81ff42['save']();};}function saveUpdates(_0x349693,_0x22c2f8){return function(_0x1fb1af){if(_0x1fb1af){return _0x1fb1af[_0x72bf('0x1d')](_0x349693)[_0x72bf('0x1e')](function(_0x463a5b){return _0x463a5b;});}return null;};}function removeEntity(_0x1a5009,_0x593e47){return function(_0x150cb7){if(_0x150cb7){return _0x150cb7['destroy']()[_0x72bf('0x1e')](function(){_0x1a5009[_0x72bf('0x14')](0xcc)[_0x72bf('0x15')]();});}};}function handleEntityNotFound(_0x125627,_0x480b82){return function(_0x11cc72){if(!_0x11cc72){_0x125627['sendStatus'](0x194);}return _0x11cc72;};}function handleError(_0x58f492,_0x187845){_0x187845=_0x187845||0x1f4;return function(_0xbac6c7){logger[_0x72bf('0x1f')](_0xbac6c7[_0x72bf('0x20')]);if(_0xbac6c7[_0x72bf('0x21')]){delete _0xbac6c7['name'];}_0x58f492[_0x72bf('0x14')](_0x187845)[_0x72bf('0x22')](_0xbac6c7);};}exports['index']=function(_0x45d9d1,_0x416028){var _0x258594={},_0x5e5fd0={},_0x422962={'count':0x0,'rows':[]};var _0x4051b4=_['map'](db[_0x72bf('0x23')][_0x72bf('0x24')],function(_0x570df5){return{'name':_0x570df5[_0x72bf('0x25')],'type':_0x570df5['type']['key']};});_0x5e5fd0['model']=_[_0x72bf('0x26')](_0x4051b4,_0x72bf('0x21'));_0x5e5fd0['query']=_[_0x72bf('0x27')](_0x45d9d1[_0x72bf('0x28')]);_0x5e5fd0[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0x5e5fd0[_0x72bf('0x2b')],_0x5e5fd0[_0x72bf('0x28')]);_0x258594[_0x72bf('0x2c')]=_['intersection'](_0x5e5fd0['model'],qs['fields'](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x258594[_0x72bf('0x2c')]=_0x258594[_0x72bf('0x2c')]['length']?_0x258594[_0x72bf('0x2c')]:_0x5e5fd0[_0x72bf('0x2b')];if(!_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x258594[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x19')]);_0x258594[_0x72bf('0x17')]=qs[_0x72bf('0x17')](_0x45d9d1['query'][_0x72bf('0x17')]);}_0x258594[_0x72bf('0x30')]=qs[_0x72bf('0x31')](_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x31')]);_0x258594['where']=qs[_0x72bf('0x29')](_['pick'](_0x45d9d1[_0x72bf('0x28')],_0x5e5fd0[_0x72bf('0x29')]),_0x4051b4);if(_0x45d9d1[_0x72bf('0x28')][_0x72bf('0x32')]){_0x258594[_0x72bf('0x33')]=_[_0x72bf('0x34')](_0x258594[_0x72bf('0x33')],{'$or':_['map'](_0x4051b4,function(_0x14cc7f){if(_0x14cc7f[_0x72bf('0x35')]!==_0x72bf('0x36')){var _0x2c8a14={};_0x2c8a14[_0x14cc7f[_0x72bf('0x21')]]={'$like':'%'+_0x45d9d1[_0x72bf('0x28')]['filter']+'%'};return _0x2c8a14;}})});}_0x258594=_[_0x72bf('0x34')]({},_0x258594,_0x45d9d1[_0x72bf('0x37')]);var _0x2c1f66={'where':_0x258594[_0x72bf('0x33')]};return db[_0x72bf('0x23')]['count'](_0x2c1f66)[_0x72bf('0x1e')](function(_0x31dde0){_0x422962[_0x72bf('0x1a')]=_0x31dde0;if(_0x45d9d1[_0x72bf('0x28')]['includeAll']){_0x258594[_0x72bf('0x38')]=[{'all':!![]}];}return db[_0x72bf('0x23')][_0x72bf('0x39')](_0x258594);})[_0x72bf('0x1e')](function(_0x1fa800){_0x422962[_0x72bf('0x3a')]=_0x1fa800;return _0x422962;})[_0x72bf('0x1e')](respondWithFilteredResult(_0x416028,_0x258594))[_0x72bf('0x3b')](handleError(_0x416028,null));};exports[_0x72bf('0x3c')]=function(_0xbf7994,_0x4393ca){var _0x52a027={'raw':![],'where':{'id':_0xbf7994[_0x72bf('0x3d')]['id']}},_0x180554={};_0x180554[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x23')][_0x72bf('0x24')]);_0x180554[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0xbf7994[_0x72bf('0x28')]);_0x180554[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0x180554[_0x72bf('0x2b')],_0x180554['query']);_0x52a027['attributes']=_[_0x72bf('0x2a')](_0x180554['model'],qs[_0x72bf('0x2d')](_0xbf7994[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x52a027[_0x72bf('0x2c')]=_0x52a027[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x52a027[_0x72bf('0x2c')]:_0x180554[_0x72bf('0x2b')];if(_0xbf7994[_0x72bf('0x28')][_0x72bf('0x3f')]){_0x52a027[_0x72bf('0x38')]=[{'all':!![]}];}_0x52a027=_['merge']({},_0x52a027,_0xbf7994[_0x72bf('0x37')]);return db[_0x72bf('0x23')][_0x72bf('0x40')](_0x52a027)[_0x72bf('0x1e')](handleEntityNotFound(_0x4393ca,null))[_0x72bf('0x1e')](respondWithResult(_0x4393ca,null))['catch'](handleError(_0x4393ca,null));};exports[_0x72bf('0x41')]=function(_0x2562c7,_0x5815f1){return db['Dynamics365Configuration'][_0x72bf('0x41')](_0x2562c7[_0x72bf('0x42')],{})[_0x72bf('0x1e')](respondWithResult(_0x5815f1,0xc9))['catch'](handleError(_0x5815f1,null));};exports['update']=function(_0x1de556,_0x27ba94){if(_0x1de556[_0x72bf('0x42')]['id']){delete _0x1de556['body']['id'];}return db[_0x72bf('0x23')][_0x72bf('0x40')]({'where':{'id':_0x1de556['params']['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x27ba94,null))[_0x72bf('0x1e')](saveUpdates(_0x1de556[_0x72bf('0x42')],null))['then'](respondWithResult(_0x27ba94,null))['catch'](handleError(_0x27ba94,null));};exports[_0x72bf('0x43')]=function(_0xb63717,_0x1a1f61){return db[_0x72bf('0x23')]['find']({'where':{'id':_0xb63717[_0x72bf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1a1f61,null))[_0x72bf('0x1e')](removeEntity(_0x1a1f61,null))[_0x72bf('0x3b')](handleError(_0x1a1f61,null));};exports[_0x72bf('0x44')]=function(_0x578cdf,_0x2cfc6b,_0x156fa8){var _0x2c9ccf={};var _0x178ceb={};var _0x263226;var _0x23394a;return db['Dynamics365Configuration'][_0x72bf('0x45')]({'where':{'id':_0x578cdf[_0x72bf('0x3d')]['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x2cfc6b,null))['then'](function(_0x1a3362){if(_0x1a3362){_0x263226=_0x1a3362;_0x178ceb[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x46')][_0x72bf('0x24')]);_0x178ceb['query']=_[_0x72bf('0x27')](_0x578cdf[_0x72bf('0x28')]);_0x178ceb['filters']=_['intersection'](_0x178ceb[_0x72bf('0x2b')],_0x178ceb[_0x72bf('0x28')]);_0x2c9ccf['attributes']=_[_0x72bf('0x2a')](_0x178ceb[_0x72bf('0x2b')],qs[_0x72bf('0x2d')](_0x578cdf['query'][_0x72bf('0x2d')]));_0x2c9ccf[_0x72bf('0x2c')]=_0x2c9ccf[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x2c9ccf[_0x72bf('0x2c')]:_0x178ceb[_0x72bf('0x2b')];_0x2c9ccf[_0x72bf('0x30')]=qs['sort'](_0x578cdf['query']['sort']);_0x2c9ccf[_0x72bf('0x33')]=qs[_0x72bf('0x29')](_[_0x72bf('0x47')](_0x578cdf[_0x72bf('0x28')],_0x178ceb[_0x72bf('0x29')]));if(_0x578cdf['query'][_0x72bf('0x32')]){_0x2c9ccf[_0x72bf('0x33')]=_['merge'](_0x2c9ccf['where'],{'$or':_[_0x72bf('0x26')](_0x2c9ccf[_0x72bf('0x2c')],function(_0xdaeb73){var _0x766f4={};_0x766f4[_0xdaeb73]={'$like':'%'+_0x578cdf['query'][_0x72bf('0x32')]+'%'};return _0x766f4;})});}_0x2c9ccf=_[_0x72bf('0x34')]({},_0x2c9ccf,_0x578cdf[_0x72bf('0x37')]);return _0x263226['getFields'](_0x2c9ccf);}})[_0x72bf('0x1e')](function(_0x3df124){if(_0x3df124){_0x23394a=_0x3df124[_0x72bf('0x3e')];if(!_0x578cdf[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x2c9ccf['limit']=qs[_0x72bf('0x19')](_0x578cdf[_0x72bf('0x28')][_0x72bf('0x19')]);_0x2c9ccf[_0x72bf('0x17')]=qs['offset'](_0x578cdf['query'][_0x72bf('0x17')]);}return _0x263226['getFields'](_0x2c9ccf);}})[_0x72bf('0x1e')](function(_0x24bff3){if(_0x24bff3){return _0x24bff3?{'count':_0x23394a,'rows':_0x24bff3}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x2cfc6b,null))[_0x72bf('0x3b')](handleError(_0x2cfc6b,null));};exports['getSubjects']=function(_0xa7edc9,_0x1314cf,_0x4f1380){var _0x41f693={};var _0xa3c73f={};var _0x24df97;var _0x4e9925;return db[_0x72bf('0x23')][_0x72bf('0x45')]({'where':{'id':_0xa7edc9['params']['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x1314cf,null))[_0x72bf('0x1e')](function(_0x5d5fa9){if(_0x5d5fa9){_0x24df97=_0x5d5fa9;_0xa3c73f[_0x72bf('0x2b')]=_[_0x72bf('0x27')](db[_0x72bf('0x46')][_0x72bf('0x24')]);_0xa3c73f[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0xa7edc9['query']);_0xa3c73f[_0x72bf('0x29')]=_[_0x72bf('0x2a')](_0xa3c73f['model'],_0xa3c73f[_0x72bf('0x28')]);_0x41f693[_0x72bf('0x2c')]=_[_0x72bf('0x2a')](_0xa3c73f['model'],qs[_0x72bf('0x2d')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x41f693[_0x72bf('0x2c')]=_0x41f693[_0x72bf('0x2c')][_0x72bf('0x3e')]?_0x41f693['attributes']:_0xa3c73f[_0x72bf('0x2b')];_0x41f693['order']=qs[_0x72bf('0x31')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x31')]);_0x41f693[_0x72bf('0x33')]=qs['filters'](_[_0x72bf('0x47')](_0xa7edc9[_0x72bf('0x28')],_0xa3c73f[_0x72bf('0x29')]));if(_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x32')]){_0x41f693[_0x72bf('0x33')]=_[_0x72bf('0x34')](_0x41f693[_0x72bf('0x33')],{'$or':_['map'](_0x41f693[_0x72bf('0x2c')],function(_0x1f180d){var _0x226139={};_0x226139[_0x1f180d]={'$like':'%'+_0xa7edc9[_0x72bf('0x28')]['filter']+'%'};return _0x226139;})});}_0x41f693=_[_0x72bf('0x34')]({},_0x41f693,_0xa7edc9[_0x72bf('0x37')]);return _0x24df97['getSubjects'](_0x41f693);}})[_0x72bf('0x1e')](function(_0x31777c){if(_0x31777c){_0x4e9925=_0x31777c[_0x72bf('0x3e')];if(!_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x2e')]('nolimit')){_0x41f693[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0xa7edc9[_0x72bf('0x28')]['limit']);_0x41f693[_0x72bf('0x17')]=qs[_0x72bf('0x17')](_0xa7edc9[_0x72bf('0x28')][_0x72bf('0x17')]);}return _0x24df97['getSubjects'](_0x41f693);}})['then'](function(_0x26dc80){if(_0x26dc80){return _0x26dc80?{'count':_0x4e9925,'rows':_0x26dc80}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x1314cf,null))[_0x72bf('0x3b')](handleError(_0x1314cf,null));};exports[_0x72bf('0x48')]=function(_0x390809,_0x4707fe,_0x1b78e3){var _0x3cb04f={};var _0x5d3168={};var _0x104862;var _0x13f9aa;return db[_0x72bf('0x23')][_0x72bf('0x45')]({'where':{'id':_0x390809[_0x72bf('0x3d')]['id']}})[_0x72bf('0x1e')](handleEntityNotFound(_0x4707fe,null))[_0x72bf('0x1e')](function(_0x5a1916){if(_0x5a1916){_0x104862=_0x5a1916;_0x5d3168[_0x72bf('0x2b')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x5d3168[_0x72bf('0x28')]=_[_0x72bf('0x27')](_0x390809['query']);_0x5d3168[_0x72bf('0x29')]=_['intersection'](_0x5d3168[_0x72bf('0x2b')],_0x5d3168[_0x72bf('0x28')]);_0x3cb04f[_0x72bf('0x2c')]=_[_0x72bf('0x2a')](_0x5d3168[_0x72bf('0x2b')],qs[_0x72bf('0x2d')](_0x390809[_0x72bf('0x28')][_0x72bf('0x2d')]));_0x3cb04f[_0x72bf('0x2c')]=_0x3cb04f[_0x72bf('0x2c')]['length']?_0x3cb04f['attributes']:_0x5d3168[_0x72bf('0x2b')];_0x3cb04f[_0x72bf('0x30')]=qs[_0x72bf('0x31')](_0x390809['query'][_0x72bf('0x31')]);_0x3cb04f[_0x72bf('0x33')]=qs['filters'](_[_0x72bf('0x47')](_0x390809[_0x72bf('0x28')],_0x5d3168['filters']));if(_0x390809[_0x72bf('0x28')][_0x72bf('0x32')]){_0x3cb04f[_0x72bf('0x33')]=_['merge'](_0x3cb04f['where'],{'$or':_[_0x72bf('0x26')](_0x3cb04f[_0x72bf('0x2c')],function(_0x5a0935){var _0x132a74={};_0x132a74[_0x5a0935]={'$like':'%'+_0x390809[_0x72bf('0x28')][_0x72bf('0x32')]+'%'};return _0x132a74;})});}_0x3cb04f=_[_0x72bf('0x34')]({},_0x3cb04f,_0x390809[_0x72bf('0x37')]);return _0x104862[_0x72bf('0x48')](_0x3cb04f);}})[_0x72bf('0x1e')](function(_0x31ce68){if(_0x31ce68){_0x13f9aa=_0x31ce68['length'];if(!_0x390809[_0x72bf('0x28')][_0x72bf('0x2e')](_0x72bf('0x2f'))){_0x3cb04f[_0x72bf('0x19')]=qs[_0x72bf('0x19')](_0x390809[_0x72bf('0x28')][_0x72bf('0x19')]);_0x3cb04f['offset']=qs[_0x72bf('0x17')](_0x390809['query'][_0x72bf('0x17')]);}return _0x104862[_0x72bf('0x48')](_0x3cb04f);}})[_0x72bf('0x1e')](function(_0x243ce1){if(_0x243ce1){return _0x243ce1?{'count':_0x13f9aa,'rows':_0x243ce1}:null;}})[_0x72bf('0x1e')](respondWithResult(_0x4707fe,null))[_0x72bf('0x3b')](handleError(_0x4707fe,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 409074a..b52326b 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4fe828,_0x40242c){var _0x27e194=function(_0x2761f3){while(--_0x2761f3){_0x4fe828['push'](_0x4fe828['shift']());}};_0x27e194(++_0x40242c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4ff5c6,_0x3571f8){_0x4ff5c6=_0x4ff5c6-0x0;var _0x3a743d=_0xd6d6[_0x4ff5c6];return _0x3a743d;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x30a937,_0x4cb3fa){var _0x1adb64=function(_0x4e77d5){while(--_0x4e77d5){_0x30a937['push'](_0x30a937['shift']());}};_0x1adb64(++_0x4cb3fa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0xf3cd[_0x16b667];return _0x58620e;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'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 5c365d9..ae5d26b 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 _0xc6f1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0xe48233,_0x36bce3){var _0x17b1ca=function(_0x5ac2c2){while(--_0x5ac2c2){_0xe48233['push'](_0xe48233['shift']());}};_0x17b1ca(++_0x36bce3);}(_0xc6f1,0x11c));var _0x1c6f=function(_0x175a46,_0x467177){_0x175a46=_0x175a46-0x0;var _0x4050a7=_0xc6f1[_0x175a46];return _0x4050a7;};'use strict';var _=require(_0x1c6f('0x0'));var util=require(_0x1c6f('0x1'));var moment=require(_0x1c6f('0x2'));var BPromise=require(_0x1c6f('0x3'));var rs=require(_0x1c6f('0x4'));var fs=require('fs');var Redis=require(_0x1c6f('0x5'));var db=require(_0x1c6f('0x6'))['db'];var utils=require(_0x1c6f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1c6f('0x8'));var client=jayson[_0x1c6f('0x9')][_0x1c6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2daf7b,_0x3c6490,_0xb9d2bd){return new BPromise(function(_0x4f883f,_0x55740d){return client[_0x1c6f('0xb')](_0x2daf7b,_0xb9d2bd)[_0x1c6f('0xc')](function(_0x507162){logger['info'](_0x1c6f('0xd'),_0x3c6490,_0x1c6f('0xe'));logger[_0x1c6f('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3c6490,'request\x20sent',JSON[_0x1c6f('0x10')](_0x507162));if(_0x507162[_0x1c6f('0x11')]){if(_0x507162['error'][_0x1c6f('0x12')]===0x1f4){logger['error'](_0x1c6f('0xd'),_0x3c6490,_0x507162[_0x1c6f('0x11')][_0x1c6f('0x13')]);return _0x55740d(_0x507162[_0x1c6f('0x11')][_0x1c6f('0x13')]);}logger['error'](_0x1c6f('0xd'),_0x3c6490,_0x507162['error'][_0x1c6f('0x13')]);return _0x4f883f(_0x507162['error']['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3c6490,_0x1c6f('0xe'));_0x4f883f(_0x507162[_0x1c6f('0x14')][_0x1c6f('0x13')]);}})[_0x1c6f('0x15')](function(_0x96cbe2){logger[_0x1c6f('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c6490,_0x96cbe2);_0x55740d(_0x96cbe2);});});} \ No newline at end of file +var _0x29ad=['util','moment','bluebird','randomstring','../../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','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash'];(function(_0x3b4823,_0x5c8e7a){var _0x15c670=function(_0x3cd81a){while(--_0x3cd81a){_0x3b4823['push'](_0x3b4823['shift']());}};_0x15c670(++_0x5c8e7a);}(_0x29ad,0x151));var _0xd29a=function(_0x3228a2,_0x5e030a){_0x3228a2=_0x3228a2-0x0;var _0x55195b=_0x29ad[_0x3228a2];return _0x55195b;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var moment=require(_0xd29a('0x2'));var BPromise=require(_0xd29a('0x3'));var rs=require(_0xd29a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd29a('0x5'))['db'];var utils=require(_0xd29a('0x6'));var logger=require(_0xd29a('0x7'))(_0xd29a('0x8'));var config=require(_0xd29a('0x9'));var jayson=require(_0xd29a('0xa'));var client=jayson[_0xd29a('0xb')][_0xd29a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa1bbb0,_0x557955,_0x4c81b2){return new BPromise(function(_0x5dada2,_0x2d2967){return client[_0xd29a('0xd')](_0xa1bbb0,_0x4c81b2)[_0xd29a('0xe')](function(_0x4cd95e){logger[_0xd29a('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x557955,_0xd29a('0x10'));logger[_0xd29a('0x11')](_0xd29a('0x12'),_0x557955,_0xd29a('0x10'),JSON[_0xd29a('0x13')](_0x4cd95e));if(_0x4cd95e[_0xd29a('0x14')]){if(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x15')]===0x1f4){logger[_0xd29a('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x557955,_0x4cd95e[_0xd29a('0x14')]['message']);return _0x2d2967(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);}logger[_0xd29a('0x14')](_0xd29a('0x17'),_0x557955,_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);return _0x5dada2(_0x4cd95e[_0xd29a('0x14')][_0xd29a('0x16')]);}else{logger[_0xd29a('0xf')](_0xd29a('0x17'),_0x557955,_0xd29a('0x10'));_0x5dada2(_0x4cd95e[_0xd29a('0x18')]['message']);}})[_0xd29a('0x19')](function(_0x2c3c18){logger[_0xd29a('0x14')](_0xd29a('0x17'),_0x557955,_0x2c3c18);_0x2d2967(_0x2c3c18);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index db38b23..afe62b8 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 _0x9c04=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x184a8e,_0xe3284c){var _0x3ebe73=function(_0x278226){while(--_0x278226){_0x184a8e['push'](_0x184a8e['shift']());}};_0x3ebe73(++_0xe3284c);}(_0x9c04,0xdf));var _0x49c0=function(_0xf5aede,_0x5b2e7f){_0xf5aede=_0xf5aede-0x0;var _0x5c6890=_0x9c04[_0xf5aede];return _0x5c6890;};'use strict';var multer=require(_0x49c0('0x0'));var util=require(_0x49c0('0x1'));var path=require(_0x49c0('0x2'));var timeout=require(_0x49c0('0x3'));var express=require(_0x49c0('0x4'));var router=express[_0x49c0('0x5')]();var fs_extra=require(_0x49c0('0x6'));var auth=require(_0x49c0('0x7'));var interaction=require(_0x49c0('0x8'));var config=require(_0x49c0('0x9'));var controller=require(_0x49c0('0xa'));router[_0x49c0('0xb')]('/',auth[_0x49c0('0xc')](),controller[_0x49c0('0xd')]);router['get'](_0x49c0('0xe'),auth[_0x49c0('0xc')](),controller['show']);router['post']('/',auth[_0x49c0('0xc')](),controller[_0x49c0('0xf')]);router[_0x49c0('0x10')](_0x49c0('0xe'),auth[_0x49c0('0xc')](),controller['update']);router['delete'](_0x49c0('0xe'),auth[_0x49c0('0xc')](),controller[_0x49c0('0x11')]);module[_0x49c0('0x12')]=router; \ No newline at end of file +var _0xbcbb=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xbcbb,0xbe));var _0xbbcb=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0xbcbb[_0x5c049a];return _0x168e70;};'use strict';var multer=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var path=require(_0xbbcb('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbcb('0x3'));var router=express[_0xbbcb('0x4')]();var fs_extra=require(_0xbbcb('0x5'));var auth=require(_0xbbcb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbcb('0x7'));var controller=require(_0xbbcb('0x8'));router[_0xbbcb('0x9')]('/',auth[_0xbbcb('0xa')](),controller['index']);router[_0xbbcb('0x9')](_0xbbcb('0xb'),auth[_0xbbcb('0xa')](),controller[_0xbbcb('0xc')]);router[_0xbbcb('0xd')]('/',auth[_0xbbcb('0xa')](),controller[_0xbbcb('0xe')]);router[_0xbbcb('0xf')]('/:id',auth[_0xbbcb('0xa')](),controller['update']);router[_0xbbcb('0x10')]('/:id',auth[_0xbbcb('0xa')](),controller[_0xbbcb('0x11')]);module[_0xbbcb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fbc7eb8..5026ea2 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 _0x462b=['string','variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x462b,0x17e));var _0xb462=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x462b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xb462('0x0')]={'type':{'type':Sequelize[_0xb462('0x1')](_0xb462('0x2'),_0xb462('0x3'),_0xb462('0x4'),'keyValue',_0xb462('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb462('0x6')]},'key':{'type':Sequelize[_0xb462('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xb462('0x4'))},'keyContent':{'type':Sequelize[_0xb462('0x6')]},'idField':{'type':Sequelize[_0xb462('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb462('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xccc9=['picklist','string','STRING','ENUM','variable','BOOLEAN','exports','customVariable','keyValue'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xccc9,0x126));var _0x9ccc=function(_0x4e0351,_0x1cded3){_0x4e0351=_0x4e0351-0x0;var _0x5778e6=_0xccc9[_0x4e0351];return _0x5778e6;};'use strict';var Sequelize=require('sequelize');module[_0x9ccc('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x9ccc('0x1'),_0x9ccc('0x2'),_0x9ccc('0x3')),'defaultValue':_0x9ccc('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9ccc('0x5')]},'keyType':{'type':Sequelize[_0x9ccc('0x6')](_0x9ccc('0x4'),_0x9ccc('0x7'),_0x9ccc('0x1'))},'keyContent':{'type':Sequelize[_0x9ccc('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9ccc('0x5')]},'customField':{'type':Sequelize[_0x9ccc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index af5ebb7..4fadafd 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 _0x8fc9=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','include','rows','catch','params','rawAttributes','find','create','body','zip-dir','request-promise','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','then','error','name','Dynamics365Field','type','key','model','map','query'];(function(_0x17430a,_0x13a137){var _0x4bf787=function(_0x234020){while(--_0x234020){_0x17430a['push'](_0x17430a['shift']());}};_0x4bf787(++_0x13a137);}(_0x8fc9,0xd5));var _0x98fc=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x8fc9[_0x308213];return _0x2e1619;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98fc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98fc('0x1'));var moment=require('moment');var BPromise=require(_0x98fc('0x2'));var Mustache=require(_0x98fc('0x3'));var util=require(_0x98fc('0x4'));var path=require(_0x98fc('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x98fc('0x6'));var crypto=require(_0x98fc('0x7'));var jsforce=require(_0x98fc('0x8'));var deskjs=require(_0x98fc('0x9'));var toCsv=require(_0x98fc('0xa'));var querystring=require(_0x98fc('0xb'));var Papa=require(_0x98fc('0xc'));var Redis=require(_0x98fc('0xd'));var authService=require(_0x98fc('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x98fc('0xf'));var hardwareService=require(_0x98fc('0x10'));var logger=require('../../config/logger')(_0x98fc('0x11'));var utils=require(_0x98fc('0x12'));var config=require(_0x98fc('0x13'));var licenseUtil=require(_0x98fc('0x14'));var db=require(_0x98fc('0x15'))['db'];function respondWithStatusCode(_0x417888,_0x596180){_0x596180=_0x596180||0xcc;return function(_0x4d7e0c){if(_0x4d7e0c){return _0x417888[_0x98fc('0x16')](_0x596180);}return _0x417888[_0x98fc('0x17')](_0x596180)[_0x98fc('0x18')]();};}function respondWithResult(_0x2e917e,_0x366e4e){_0x366e4e=_0x366e4e||0xc8;return function(_0x4a8275){if(_0x4a8275){return _0x2e917e['status'](_0x366e4e)[_0x98fc('0x19')](_0x4a8275);}};}function respondWithFilteredResult(_0x497585,_0x596474){return function(_0x2ca8ad){if(_0x2ca8ad){var _0x598da1=typeof _0x596474['offset']===_0x98fc('0x1a')&&typeof _0x596474['limit']===_0x98fc('0x1a');var _0x1525ca=_0x2ca8ad[_0x98fc('0x1b')];var _0x48b735=_0x598da1?0x0:_0x596474['offset'];var _0x24e779=_0x598da1?_0x2ca8ad[_0x98fc('0x1b')]:_0x596474[_0x98fc('0x1c')]+_0x596474[_0x98fc('0x1d')];var _0x4ff183;if(_0x24e779>=_0x1525ca){_0x24e779=_0x1525ca;_0x4ff183=0xc8;}else{_0x4ff183=0xce;}_0x497585[_0x98fc('0x17')](_0x4ff183);return _0x497585[_0x98fc('0x1e')](_0x98fc('0x1f'),_0x48b735+'-'+_0x24e779+'/'+_0x1525ca)[_0x98fc('0x19')](_0x2ca8ad);}return null;};}function patchUpdates(_0x38420f){return function(_0x36aa0d){try{jsonpatch['apply'](_0x36aa0d,_0x38420f,!![]);}catch(_0x5be716){return BPromise['reject'](_0x5be716);}return _0x36aa0d['save']();};}function saveUpdates(_0x5d722b,_0x234727){return function(_0x46903d){if(_0x46903d){return _0x46903d[_0x98fc('0x20')](_0x5d722b)['then'](function(_0x2685ce){return _0x2685ce;});}return null;};}function removeEntity(_0x3b6962,_0x370ee2){return function(_0x4b4e79){if(_0x4b4e79){return _0x4b4e79[_0x98fc('0x21')]()[_0x98fc('0x22')](function(){_0x3b6962[_0x98fc('0x17')](0xcc)[_0x98fc('0x18')]();});}};}function handleEntityNotFound(_0x4b9117,_0x3b294f){return function(_0x203c5e){if(!_0x203c5e){_0x4b9117['sendStatus'](0x194);}return _0x203c5e;};}function handleError(_0x506262,_0x4682e7){_0x4682e7=_0x4682e7||0x1f4;return function(_0x11327c){logger[_0x98fc('0x23')](_0x11327c['stack']);if(_0x11327c[_0x98fc('0x24')]){delete _0x11327c[_0x98fc('0x24')];}_0x506262[_0x98fc('0x17')](_0x4682e7)['send'](_0x11327c);};}exports['index']=function(_0x855725,_0x50e030){var _0x43cc33={},_0x2064b7={},_0x5c1c0a={'count':0x0,'rows':[]};var _0xda0f6e=_['map'](db[_0x98fc('0x25')]['rawAttributes'],function(_0x108c7d){return{'name':_0x108c7d['fieldName'],'type':_0x108c7d[_0x98fc('0x26')][_0x98fc('0x27')]};});_0x2064b7[_0x98fc('0x28')]=_[_0x98fc('0x29')](_0xda0f6e,'name');_0x2064b7[_0x98fc('0x2a')]=_[_0x98fc('0x2b')](_0x855725[_0x98fc('0x2a')]);_0x2064b7[_0x98fc('0x2c')]=_['intersection'](_0x2064b7[_0x98fc('0x28')],_0x2064b7[_0x98fc('0x2a')]);_0x43cc33['attributes']=_[_0x98fc('0x2d')](_0x2064b7['model'],qs[_0x98fc('0x2e')](_0x855725[_0x98fc('0x2a')][_0x98fc('0x2e')]));_0x43cc33[_0x98fc('0x2f')]=_0x43cc33['attributes'][_0x98fc('0x30')]?_0x43cc33[_0x98fc('0x2f')]:_0x2064b7[_0x98fc('0x28')];if(!_0x855725[_0x98fc('0x2a')][_0x98fc('0x31')](_0x98fc('0x32'))){_0x43cc33[_0x98fc('0x1d')]=qs[_0x98fc('0x1d')](_0x855725[_0x98fc('0x2a')][_0x98fc('0x1d')]);_0x43cc33['offset']=qs[_0x98fc('0x1c')](_0x855725[_0x98fc('0x2a')][_0x98fc('0x1c')]);}_0x43cc33['order']=qs['sort'](_0x855725[_0x98fc('0x2a')]['sort']);_0x43cc33[_0x98fc('0x33')]=qs[_0x98fc('0x2c')](_[_0x98fc('0x34')](_0x855725['query'],_0x2064b7[_0x98fc('0x2c')]),_0xda0f6e);if(_0x855725[_0x98fc('0x2a')][_0x98fc('0x35')]){_0x43cc33[_0x98fc('0x33')]=_['merge'](_0x43cc33[_0x98fc('0x33')],{'$or':_[_0x98fc('0x29')](_0xda0f6e,function(_0x1d0530){if(_0x1d0530[_0x98fc('0x26')]!=='VIRTUAL'){var _0xfb72a0={};_0xfb72a0[_0x1d0530[_0x98fc('0x24')]]={'$like':'%'+_0x855725['query']['filter']+'%'};return _0xfb72a0;}})});}_0x43cc33=_[_0x98fc('0x36')]({},_0x43cc33,_0x855725[_0x98fc('0x37')]);var _0xf4f519={'where':_0x43cc33[_0x98fc('0x33')]};return db[_0x98fc('0x25')][_0x98fc('0x1b')](_0xf4f519)[_0x98fc('0x22')](function(_0x1449b7){_0x5c1c0a[_0x98fc('0x1b')]=_0x1449b7;if(_0x855725[_0x98fc('0x2a')]['includeAll']){_0x43cc33[_0x98fc('0x38')]=[{'all':!![]}];}return db[_0x98fc('0x25')]['findAll'](_0x43cc33);})[_0x98fc('0x22')](function(_0x2e862a){_0x5c1c0a[_0x98fc('0x39')]=_0x2e862a;return _0x5c1c0a;})['then'](respondWithFilteredResult(_0x50e030,_0x43cc33))[_0x98fc('0x3a')](handleError(_0x50e030,null));};exports['show']=function(_0x240036,_0x2fc0f6){var _0x15e28c={'raw':!![],'where':{'id':_0x240036[_0x98fc('0x3b')]['id']}},_0x2ad227={};_0x2ad227[_0x98fc('0x28')]=_['keys'](db[_0x98fc('0x25')][_0x98fc('0x3c')]);_0x2ad227[_0x98fc('0x2a')]=_[_0x98fc('0x2b')](_0x240036[_0x98fc('0x2a')]);_0x2ad227[_0x98fc('0x2c')]=_['intersection'](_0x2ad227[_0x98fc('0x28')],_0x2ad227[_0x98fc('0x2a')]);_0x15e28c[_0x98fc('0x2f')]=_[_0x98fc('0x2d')](_0x2ad227[_0x98fc('0x28')],qs[_0x98fc('0x2e')](_0x240036[_0x98fc('0x2a')][_0x98fc('0x2e')]));_0x15e28c[_0x98fc('0x2f')]=_0x15e28c[_0x98fc('0x2f')][_0x98fc('0x30')]?_0x15e28c[_0x98fc('0x2f')]:_0x2ad227[_0x98fc('0x28')];if(_0x240036[_0x98fc('0x2a')]['includeAll']){_0x15e28c[_0x98fc('0x38')]=[{'all':!![]}];}_0x15e28c=_[_0x98fc('0x36')]({},_0x15e28c,_0x240036[_0x98fc('0x37')]);return db[_0x98fc('0x25')][_0x98fc('0x3d')](_0x15e28c)[_0x98fc('0x22')](handleEntityNotFound(_0x2fc0f6,null))[_0x98fc('0x22')](respondWithResult(_0x2fc0f6,null))[_0x98fc('0x3a')](handleError(_0x2fc0f6,null));};exports[_0x98fc('0x3e')]=function(_0x40fffa,_0x122cd1){return db[_0x98fc('0x25')][_0x98fc('0x3e')](_0x40fffa[_0x98fc('0x3f')],{})[_0x98fc('0x22')](respondWithResult(_0x122cd1,0xc9))[_0x98fc('0x3a')](handleError(_0x122cd1,null));};exports['update']=function(_0x50efdc,_0x1edf8b){if(_0x50efdc[_0x98fc('0x3f')]['id']){delete _0x50efdc[_0x98fc('0x3f')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x50efdc['params']['id']}})[_0x98fc('0x22')](handleEntityNotFound(_0x1edf8b,null))[_0x98fc('0x22')](saveUpdates(_0x50efdc[_0x98fc('0x3f')],null))[_0x98fc('0x22')](respondWithResult(_0x1edf8b,null))[_0x98fc('0x3a')](handleError(_0x1edf8b,null));};exports[_0x98fc('0x21')]=function(_0x5f360a,_0x899f9d){return db['Dynamics365Field'][_0x98fc('0x3d')]({'where':{'id':_0x5f360a[_0x98fc('0x3b')]['id']}})[_0x98fc('0x22')](handleEntityNotFound(_0x899f9d,null))[_0x98fc('0x22')](removeEntity(_0x899f9d,null))[_0x98fc('0x3a')](handleError(_0x899f9d,null));}; \ No newline at end of file +var _0x78dd=['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','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0x78dd,0xd8));var _0xd78d=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x78dd[_0x34ad72];return _0x5c9aa8;};'use strict';var emlformat=require(_0xd78d('0x0'));var rimraf=require(_0xd78d('0x1'));var zipdir=require(_0xd78d('0x2'));var jsonpatch=require(_0xd78d('0x3'));var rp=require(_0xd78d('0x4'));var moment=require(_0xd78d('0x5'));var BPromise=require(_0xd78d('0x6'));var Mustache=require(_0xd78d('0x7'));var util=require(_0xd78d('0x8'));var path=require(_0xd78d('0x9'));var sox=require(_0xd78d('0xa'));var csv=require(_0xd78d('0xb'));var ejs=require(_0xd78d('0xc'));var fs=require('fs');var fs_extra=require(_0xd78d('0xd'));var _=require(_0xd78d('0xe'));var squel=require(_0xd78d('0xf'));var crypto=require(_0xd78d('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd78d('0x11'));var toCsv=require(_0xd78d('0xb'));var querystring=require(_0xd78d('0x12'));var Papa=require(_0xd78d('0x13'));var Redis=require(_0xd78d('0x14'));var authService=require(_0xd78d('0x15'));var qs=require(_0xd78d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd78d('0x17'));var logger=require(_0xd78d('0x18'))(_0xd78d('0x19'));var utils=require(_0xd78d('0x1a'));var config=require(_0xd78d('0x1b'));var licenseUtil=require(_0xd78d('0x1c'));var db=require(_0xd78d('0x1d'))['db'];function respondWithStatusCode(_0x8f408e,_0x21c705){_0x21c705=_0x21c705||0xcc;return function(_0x401720){if(_0x401720){return _0x8f408e[_0xd78d('0x1e')](_0x21c705);}return _0x8f408e['status'](_0x21c705)[_0xd78d('0x1f')]();};}function respondWithResult(_0x4f4f3a,_0x3723c1){_0x3723c1=_0x3723c1||0xc8;return function(_0x17c4b6){if(_0x17c4b6){return _0x4f4f3a[_0xd78d('0x20')](_0x3723c1)['json'](_0x17c4b6);}};}function respondWithFilteredResult(_0x4050ac,_0x49a157){return function(_0x1fa9ed){if(_0x1fa9ed){var _0x4fc2fb=typeof _0x49a157[_0xd78d('0x21')]===_0xd78d('0x22')&&typeof _0x49a157[_0xd78d('0x23')]===_0xd78d('0x22');var _0x100ca3=_0x1fa9ed['count'];var _0x140ac9=_0x4fc2fb?0x0:_0x49a157[_0xd78d('0x21')];var _0x42e6b6=_0x4fc2fb?_0x1fa9ed[_0xd78d('0x24')]:_0x49a157[_0xd78d('0x21')]+_0x49a157[_0xd78d('0x23')];var _0x287d55;if(_0x42e6b6>=_0x100ca3){_0x42e6b6=_0x100ca3;_0x287d55=0xc8;}else{_0x287d55=0xce;}_0x4050ac[_0xd78d('0x20')](_0x287d55);return _0x4050ac[_0xd78d('0x25')](_0xd78d('0x26'),_0x140ac9+'-'+_0x42e6b6+'/'+_0x100ca3)['json'](_0x1fa9ed);}return null;};}function patchUpdates(_0x156d16){return function(_0x973639){try{jsonpatch[_0xd78d('0x27')](_0x973639,_0x156d16,!![]);}catch(_0x2dd493){return BPromise['reject'](_0x2dd493);}return _0x973639[_0xd78d('0x28')]();};}function saveUpdates(_0x262430,_0x4c2ac2){return function(_0x198cab){if(_0x198cab){return _0x198cab[_0xd78d('0x29')](_0x262430)[_0xd78d('0x2a')](function(_0x432ee8){return _0x432ee8;});}return null;};}function removeEntity(_0x31df4a,_0x5548ce){return function(_0x5c2702){if(_0x5c2702){return _0x5c2702[_0xd78d('0x2b')]()[_0xd78d('0x2a')](function(){_0x31df4a[_0xd78d('0x20')](0xcc)[_0xd78d('0x1f')]();});}};}function handleEntityNotFound(_0x2d271f,_0x2ae617){return function(_0x302296){if(!_0x302296){_0x2d271f[_0xd78d('0x1e')](0x194);}return _0x302296;};}function handleError(_0xf7a6eb,_0x4083fd){_0x4083fd=_0x4083fd||0x1f4;return function(_0x38c45d){logger['error'](_0x38c45d[_0xd78d('0x2c')]);if(_0x38c45d[_0xd78d('0x2d')]){delete _0x38c45d['name'];}_0xf7a6eb['status'](_0x4083fd)[_0xd78d('0x2e')](_0x38c45d);};}exports['index']=function(_0x485bde,_0x4abaf2){var _0x315666={},_0x5e09b9={},_0x286b30={'count':0x0,'rows':[]};var _0x1124b6=_['map'](db[_0xd78d('0x2f')][_0xd78d('0x30')],function(_0x4dda91){return{'name':_0x4dda91[_0xd78d('0x31')],'type':_0x4dda91[_0xd78d('0x32')][_0xd78d('0x33')]};});_0x5e09b9[_0xd78d('0x34')]=_[_0xd78d('0x35')](_0x1124b6,_0xd78d('0x2d'));_0x5e09b9['query']=_[_0xd78d('0x36')](_0x485bde[_0xd78d('0x37')]);_0x5e09b9['filters']=_['intersection'](_0x5e09b9['model'],_0x5e09b9[_0xd78d('0x37')]);_0x315666[_0xd78d('0x38')]=_[_0xd78d('0x39')](_0x5e09b9[_0xd78d('0x34')],qs[_0xd78d('0x3a')](_0x485bde['query'][_0xd78d('0x3a')]));_0x315666[_0xd78d('0x38')]=_0x315666[_0xd78d('0x38')][_0xd78d('0x3b')]?_0x315666[_0xd78d('0x38')]:_0x5e09b9[_0xd78d('0x34')];if(!_0x485bde[_0xd78d('0x37')][_0xd78d('0x3c')](_0xd78d('0x3d'))){_0x315666['limit']=qs[_0xd78d('0x23')](_0x485bde[_0xd78d('0x37')]['limit']);_0x315666[_0xd78d('0x21')]=qs[_0xd78d('0x21')](_0x485bde[_0xd78d('0x37')][_0xd78d('0x21')]);}_0x315666[_0xd78d('0x3e')]=qs[_0xd78d('0x3f')](_0x485bde[_0xd78d('0x37')][_0xd78d('0x3f')]);_0x315666['where']=qs[_0xd78d('0x40')](_[_0xd78d('0x41')](_0x485bde[_0xd78d('0x37')],_0x5e09b9['filters']),_0x1124b6);if(_0x485bde[_0xd78d('0x37')][_0xd78d('0x42')]){_0x315666[_0xd78d('0x43')]=_[_0xd78d('0x44')](_0x315666['where'],{'$or':_['map'](_0x1124b6,function(_0xce599a){if(_0xce599a[_0xd78d('0x32')]!=='VIRTUAL'){var _0x23db06={};_0x23db06[_0xce599a['name']]={'$like':'%'+_0x485bde[_0xd78d('0x37')][_0xd78d('0x42')]+'%'};return _0x23db06;}})});}_0x315666=_[_0xd78d('0x44')]({},_0x315666,_0x485bde[_0xd78d('0x45')]);var _0x82ace1={'where':_0x315666[_0xd78d('0x43')]};return db[_0xd78d('0x2f')]['count'](_0x82ace1)[_0xd78d('0x2a')](function(_0x5e0ec2){_0x286b30['count']=_0x5e0ec2;if(_0x485bde[_0xd78d('0x37')][_0xd78d('0x46')]){_0x315666[_0xd78d('0x47')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x315666);})['then'](function(_0x37a264){_0x286b30[_0xd78d('0x48')]=_0x37a264;return _0x286b30;})[_0xd78d('0x2a')](respondWithFilteredResult(_0x4abaf2,_0x315666))[_0xd78d('0x49')](handleError(_0x4abaf2,null));};exports['show']=function(_0x4b5df4,_0x31b457){var _0x491565={'raw':!![],'where':{'id':_0x4b5df4[_0xd78d('0x4a')]['id']}},_0x1d0e9e={};_0x1d0e9e[_0xd78d('0x34')]=_[_0xd78d('0x36')](db[_0xd78d('0x2f')]['rawAttributes']);_0x1d0e9e[_0xd78d('0x37')]=_[_0xd78d('0x36')](_0x4b5df4['query']);_0x1d0e9e['filters']=_['intersection'](_0x1d0e9e[_0xd78d('0x34')],_0x1d0e9e[_0xd78d('0x37')]);_0x491565[_0xd78d('0x38')]=_[_0xd78d('0x39')](_0x1d0e9e['model'],qs[_0xd78d('0x3a')](_0x4b5df4[_0xd78d('0x37')]['fields']));_0x491565[_0xd78d('0x38')]=_0x491565[_0xd78d('0x38')][_0xd78d('0x3b')]?_0x491565[_0xd78d('0x38')]:_0x1d0e9e[_0xd78d('0x34')];if(_0x4b5df4[_0xd78d('0x37')]['includeAll']){_0x491565['include']=[{'all':!![]}];}_0x491565=_['merge']({},_0x491565,_0x4b5df4['options']);return db['Dynamics365Field'][_0xd78d('0x4b')](_0x491565)[_0xd78d('0x2a')](handleEntityNotFound(_0x31b457,null))[_0xd78d('0x2a')](respondWithResult(_0x31b457,null))[_0xd78d('0x49')](handleError(_0x31b457,null));};exports[_0xd78d('0x4c')]=function(_0x319f9e,_0x28d51a){return db['Dynamics365Field'][_0xd78d('0x4c')](_0x319f9e['body'],{})[_0xd78d('0x2a')](respondWithResult(_0x28d51a,0xc9))[_0xd78d('0x49')](handleError(_0x28d51a,null));};exports['update']=function(_0x32f2a2,_0xea7a8a){if(_0x32f2a2[_0xd78d('0x4d')]['id']){delete _0x32f2a2[_0xd78d('0x4d')]['id'];}return db[_0xd78d('0x2f')]['find']({'where':{'id':_0x32f2a2['params']['id']}})['then'](handleEntityNotFound(_0xea7a8a,null))[_0xd78d('0x2a')](saveUpdates(_0x32f2a2[_0xd78d('0x4d')],null))[_0xd78d('0x2a')](respondWithResult(_0xea7a8a,null))[_0xd78d('0x49')](handleError(_0xea7a8a,null));};exports['destroy']=function(_0x14e3bf,_0xeb8d2f){return db['Dynamics365Field'][_0xd78d('0x4b')]({'where':{'id':_0x14e3bf['params']['id']}})['then'](handleEntityNotFound(_0xeb8d2f,null))[_0xd78d('0x2a')](removeEntity(_0xeb8d2f,null))[_0xd78d('0x49')](handleError(_0xeb8d2f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2f48153..f8041bf 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 _0xe6d9=['FieldId','lodash','util','../../config/logger','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x18020c,_0x5f3e49){var _0xb2367b=function(_0x4c9d40){while(--_0x4c9d40){_0x18020c['push'](_0x18020c['shift']());}};_0xb2367b(++_0x5f3e49);}(_0xe6d9,0x175));var _0x9e6d=function(_0x2ec477,_0x1e155a){_0x2ec477=_0x2ec477-0x0;var _0x23f196=_0xe6d9[_0x2ec477];return _0x23f196;};'use strict';var _=require(_0x9e6d('0x0'));var util=require(_0x9e6d('0x1'));var logger=require(_0x9e6d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e6d('0x3'));var config=require(_0x9e6d('0x4'));var attributes=require(_0x9e6d('0x5'));module[_0x9e6d('0x6')]=function(_0x4f855f,_0x33a9d3){return _0x4f855f[_0x9e6d('0x7')](_0x9e6d('0x8'),attributes,{'tableName':_0x9e6d('0x9'),'paranoid':![],'indexes':[{'name':_0x9e6d('0xa'),'fields':['idField',_0x9e6d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0f0=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46fd08,_0x4a9815){var _0x187103=function(_0x523cd1){while(--_0x523cd1){_0x46fd08['push'](_0x46fd08['shift']());}};_0x187103(++_0x4a9815);}(_0xd0f0,0xad));var _0x0d0f=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0xd0f0[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0x0d0f('0x0'));var util=require(_0x0d0f('0x1'));var logger=require(_0x0d0f('0x2'))(_0x0d0f('0x3'));var moment=require(_0x0d0f('0x4'));var BPromise=require('bluebird');var rp=require(_0x0d0f('0x5'));var fs=require('fs');var path=require(_0x0d0f('0x6'));var rimraf=require(_0x0d0f('0x7'));var config=require(_0x0d0f('0x8'));var attributes=require(_0x0d0f('0x9'));module[_0x0d0f('0xa')]=function(_0x5ce3a8,_0x27dc17){return _0x5ce3a8[_0x0d0f('0xb')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0d0f('0xc'),'fields':[_0x0d0f('0xd'),_0x0d0f('0xe')],'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 35f0a47..c194ea5 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 _0xf537=['Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x754f7f,_0x5a0753){var _0x20d21b=function(_0x36594e){while(--_0x36594e){_0x754f7f['push'](_0x754f7f['shift']());}};_0x20d21b(++_0x5a0753);}(_0xf537,0x1c8));var _0x7f53=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf537[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7f53('0x0'));var util=require(_0x7f53('0x1'));var moment=require(_0x7f53('0x2'));var BPromise=require(_0x7f53('0x3'));var rs=require(_0x7f53('0x4'));var fs=require('fs');var Redis=require(_0x7f53('0x5'));var db=require(_0x7f53('0x6'))['db'];var utils=require(_0x7f53('0x7'));var logger=require(_0x7f53('0x8'))(_0x7f53('0x9'));var config=require(_0x7f53('0xa'));var jayson=require(_0x7f53('0xb'));var client=jayson['client'][_0x7f53('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21997a,_0x19db01,_0x4c2233){return new BPromise(function(_0x250b9a,_0x6040f4){return client[_0x7f53('0xd')](_0x21997a,_0x4c2233)[_0x7f53('0xe')](function(_0x409d05){logger[_0x7f53('0xf')](_0x7f53('0x10'),_0x19db01,_0x7f53('0x11'));logger[_0x7f53('0x12')](_0x7f53('0x13'),_0x19db01,_0x7f53('0x11'),JSON['stringify'](_0x409d05));if(_0x409d05[_0x7f53('0x14')]){if(_0x409d05['error'][_0x7f53('0x15')]===0x1f4){logger['error'](_0x7f53('0x10'),_0x19db01,_0x409d05[_0x7f53('0x14')][_0x7f53('0x16')]);return _0x6040f4(_0x409d05[_0x7f53('0x14')][_0x7f53('0x16')]);}logger[_0x7f53('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x19db01,_0x409d05[_0x7f53('0x14')]['message']);return _0x250b9a(_0x409d05[_0x7f53('0x14')]['message']);}else{logger[_0x7f53('0xf')](_0x7f53('0x10'),_0x19db01,'request\x20sent');_0x250b9a(_0x409d05[_0x7f53('0x17')][_0x7f53('0x16')]);}})[_0x7f53('0x18')](function(_0x34a5b2){logger[_0x7f53('0x14')](_0x7f53('0x10'),_0x19db01,_0x34a5b2);_0x6040f4(_0x34a5b2);});});} \ No newline at end of file +var _0xd527=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd527,0xd4));var _0x7d52=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xd527[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x7d52('0x0'));var util=require('util');var moment=require(_0x7d52('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d52('0x2'));var fs=require('fs');var Redis=require(_0x7d52('0x3'));var db=require(_0x7d52('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7d52('0x5'));var jayson=require(_0x7d52('0x6'));var client=jayson[_0x7d52('0x7')][_0x7d52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b5385,_0x3462c0,_0x910122){return new BPromise(function(_0x3cc216,_0x5b0607){return client[_0x7d52('0x9')](_0x4b5385,_0x910122)['then'](function(_0x5ed132){logger[_0x7d52('0xa')](_0x7d52('0xb'),_0x3462c0,'request\x20sent');logger[_0x7d52('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3462c0,_0x7d52('0xd'),JSON['stringify'](_0x5ed132));if(_0x5ed132['error']){if(_0x5ed132[_0x7d52('0xe')]['code']===0x1f4){logger[_0x7d52('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3462c0,_0x5ed132['error'][_0x7d52('0xf')]);return _0x5b0607(_0x5ed132[_0x7d52('0xe')][_0x7d52('0xf')]);}logger[_0x7d52('0xe')](_0x7d52('0xb'),_0x3462c0,_0x5ed132['error'][_0x7d52('0xf')]);return _0x3cc216(_0x5ed132['error'][_0x7d52('0xf')]);}else{logger[_0x7d52('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x3462c0,_0x7d52('0xd'));_0x3cc216(_0x5ed132[_0x7d52('0x10')][_0x7d52('0xf')]);}})[_0x7d52('0x11')](function(_0x4b7bd4){logger['error'](_0x7d52('0xb'),_0x3462c0,_0x4b7bd4);_0x5b0607(_0x4b7bd4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8425fb0..15835ed 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 _0xdcf3=['getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x201474,_0x1d0dbd){var _0x595f42=function(_0x4a3c57){while(--_0x4a3c57){_0x201474['push'](_0x201474['shift']());}};_0x595f42(++_0x1d0dbd);}(_0xdcf3,0x1cb));var _0x3dcf=function(_0x314f8d,_0x5c8f17){_0x314f8d=_0x314f8d-0x0;var _0x337de8=_0xdcf3[_0x314f8d];return _0x337de8;};'use strict';var multer=require('multer');var util=require(_0x3dcf('0x0'));var path=require(_0x3dcf('0x1'));var timeout=require(_0x3dcf('0x2'));var express=require(_0x3dcf('0x3'));var router=express[_0x3dcf('0x4')]();var fs_extra=require(_0x3dcf('0x5'));var auth=require(_0x3dcf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3dcf('0x7'));var controller=require(_0x3dcf('0x8'));router[_0x3dcf('0x9')]('/',auth['isAuthenticated'](),controller[_0x3dcf('0xa')]);router[_0x3dcf('0x9')]('/:id',auth[_0x3dcf('0xb')](),controller[_0x3dcf('0xc')]);router[_0x3dcf('0x9')](_0x3dcf('0xd'),auth[_0x3dcf('0xb')](),controller[_0x3dcf('0xe')]);router[_0x3dcf('0x9')](_0x3dcf('0xf'),auth[_0x3dcf('0xb')](),controller[_0x3dcf('0x10')]);router[_0x3dcf('0x11')]('/',auth[_0x3dcf('0xb')](),controller[_0x3dcf('0x12')]);router['post'](_0x3dcf('0xd'),auth[_0x3dcf('0xb')](),controller[_0x3dcf('0x13')]);router[_0x3dcf('0x14')](_0x3dcf('0x15'),auth[_0x3dcf('0xb')](),controller[_0x3dcf('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3dcf('0x17')]);module[_0x3dcf('0x18')]=router; \ No newline at end of file +var _0x3b6e=['create','post','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/fields'];(function(_0x4f48b7,_0x85f1bd){var _0x3c0fbb=function(_0x19cd46){while(--_0x19cd46){_0x4f48b7['push'](_0x4f48b7['shift']());}};_0x3c0fbb(++_0x85f1bd);}(_0x3b6e,0x1ad));var _0xe3b6=function(_0x21c079,_0x190c96){_0x21c079=_0x21c079-0x0;var _0x2f5856=_0x3b6e[_0x21c079];return _0x2f5856;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe3b6('0x0'));var timeout=require(_0xe3b6('0x1'));var express=require(_0xe3b6('0x2'));var router=express[_0xe3b6('0x3')]();var fs_extra=require(_0xe3b6('0x4'));var auth=require(_0xe3b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3b6('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0xe3b6('0x7')]('/',auth[_0xe3b6('0x8')](),controller['index']);router[_0xe3b6('0x7')]('/:id',auth[_0xe3b6('0x8')](),controller[_0xe3b6('0x9')]);router[_0xe3b6('0x7')]('/:id/configurations',auth[_0xe3b6('0x8')](),controller['getConfigurations']);router[_0xe3b6('0x7')](_0xe3b6('0xa'),auth[_0xe3b6('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xe3b6('0xb')]);router[_0xe3b6('0xc')](_0xe3b6('0xd'),auth[_0xe3b6('0x8')](),controller[_0xe3b6('0xe')]);router[_0xe3b6('0xf')](_0xe3b6('0x10'),auth[_0xe3b6('0x8')](),controller[_0xe3b6('0x11')]);router['delete'](_0xe3b6('0x10'),auth['isAuthenticated'](),controller[_0xe3b6('0x12')]);module[_0xe3b6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bec69c9..299aa5c 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 _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0xafb54f,_0xa16c42){var _0x4e358a=function(_0x2372aa){while(--_0x2372aa){_0xafb54f['push'](_0xafb54f['shift']());}};_0x4e358a(++_0xa16c42);}(_0x66fa,0x117));var _0xa66f=function(_0x1191c0,_0x2eb743){_0x1191c0=_0x1191c0-0x0;var _0x219213=_0x66fa[_0x1191c0];return _0x219213;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2032=['remoteUri','exports','STRING','username'];(function(_0x4c1c90,_0x43ddb7){var _0x277420=function(_0x2d45c8){while(--_0x2d45c8){_0x4c1c90['push'](_0x4c1c90['shift']());}};_0x277420(++_0x43ddb7);}(_0x2032,0xd9));var _0x2203=function(_0x4aee9f,_0x160885){_0x4aee9f=_0x4aee9f-0x0;var _0x9e72=_0x2032[_0x4aee9f];return _0x9e72;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2203('0x2')},'apiKey':{'type':Sequelize[_0x2203('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2203('0x3')},'serverUrl':{'type':Sequelize[_0x2203('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 2b9ac02..265bd96 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 _0xa0bc=['limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','find','body','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x51832b,_0x6fc83c){var _0x111f6d=function(_0x2f82f9){while(--_0x2f82f9){_0x51832b['push'](_0x51832b['shift']());}};_0x111f6d(++_0x6fc83c);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];var integrations=require(_0xca0b('0x1c'));function respondWithStatusCode(_0x22ca9d,_0x2ce366){_0x2ce366=_0x2ce366||0xcc;return function(_0x514c4d){if(_0x514c4d){return _0x22ca9d[_0xca0b('0x1d')](_0x2ce366);}return _0x22ca9d[_0xca0b('0x1e')](_0x2ce366)[_0xca0b('0x1f')]();};}function respondWithResult(_0x5da205,_0x106ed6){_0x106ed6=_0x106ed6||0xc8;return function(_0x3c19c2){if(_0x3c19c2){return _0x5da205[_0xca0b('0x1e')](_0x106ed6)[_0xca0b('0x20')](_0x3c19c2);}};}function respondWithFilteredResult(_0x42b68e,_0x404c6d){return function(_0x4d7620){if(_0x4d7620){var _0x7cab85=typeof _0x404c6d[_0xca0b('0x21')]==='undefined'&&typeof _0x404c6d[_0xca0b('0x22')]==='undefined';var _0x449961=_0x4d7620['count'];var _0x236503=_0x7cab85?0x0:_0x404c6d[_0xca0b('0x21')];var _0x97be82=_0x7cab85?_0x4d7620['count']:_0x404c6d[_0xca0b('0x21')]+_0x404c6d[_0xca0b('0x22')];var _0x4e1f66;if(_0x97be82>=_0x449961){_0x97be82=_0x449961;_0x4e1f66=0xc8;}else{_0x4e1f66=0xce;}_0x42b68e[_0xca0b('0x1e')](_0x4e1f66);return _0x42b68e[_0xca0b('0x23')](_0xca0b('0x24'),_0x236503+'-'+_0x97be82+'/'+_0x449961)['json'](_0x4d7620);}return null;};}function patchUpdates(_0x865393){return function(_0xd0a4bc){try{jsonpatch[_0xca0b('0x25')](_0xd0a4bc,_0x865393,!![]);}catch(_0x38812f){return BPromise[_0xca0b('0x26')](_0x38812f);}return _0xd0a4bc[_0xca0b('0x27')]();};}function saveUpdates(_0x49e695,_0x119589){return function(_0x16976e){if(_0x16976e){return _0x16976e[_0xca0b('0x28')](_0x49e695)['then'](function(_0x54fb03){return _0x54fb03;});}return null;};}function removeEntity(_0x11f5c3,_0x428459){return function(_0x3f7f97){if(_0x3f7f97){return _0x3f7f97[_0xca0b('0x29')]()[_0xca0b('0x2a')](function(){_0x11f5c3['status'](0xcc)[_0xca0b('0x1f')]();});}};}function handleEntityNotFound(_0x10b5f3,_0x131c0e){return function(_0x2f82a5){if(!_0x2f82a5){_0x10b5f3[_0xca0b('0x1d')](0x194);}return _0x2f82a5;};}function handleError(_0x48e172,_0x4d2d1a){_0x4d2d1a=_0x4d2d1a||0x1f4;return function(_0x4e0515){logger[_0xca0b('0x2b')](_0x4e0515[_0xca0b('0x2c')]);if(_0x4e0515[_0xca0b('0x2d')]){delete _0x4e0515[_0xca0b('0x2d')];}_0x48e172[_0xca0b('0x1e')](_0x4d2d1a)['send'](_0x4e0515);};}exports[_0xca0b('0x2e')]=function(_0xbfcb5f,_0x3b73ff){var _0x20f0d5={},_0x227cdc={},_0x449a3a={'count':0x0,'rows':[]};var _0xa59ab0=_['map'](db[_0xca0b('0x2f')][_0xca0b('0x30')],function(_0x3b72b2){return{'name':_0x3b72b2[_0xca0b('0x31')],'type':_0x3b72b2['type'][_0xca0b('0x32')]};});_0x227cdc[_0xca0b('0x33')]=_[_0xca0b('0x34')](_0xa59ab0,_0xca0b('0x2d'));_0x227cdc[_0xca0b('0x35')]=_[_0xca0b('0x36')](_0xbfcb5f[_0xca0b('0x35')]);_0x227cdc[_0xca0b('0x37')]=_[_0xca0b('0x38')](_0x227cdc[_0xca0b('0x33')],_0x227cdc[_0xca0b('0x35')]);_0x20f0d5[_0xca0b('0x39')]=_[_0xca0b('0x38')](_0x227cdc[_0xca0b('0x33')],qs[_0xca0b('0x3a')](_0xbfcb5f['query'][_0xca0b('0x3a')]));_0x20f0d5[_0xca0b('0x39')]=_0x20f0d5[_0xca0b('0x39')][_0xca0b('0x3b')]?_0x20f0d5['attributes']:_0x227cdc[_0xca0b('0x33')];if(!_0xbfcb5f[_0xca0b('0x35')]['hasOwnProperty'](_0xca0b('0x3c'))){_0x20f0d5[_0xca0b('0x22')]=qs[_0xca0b('0x22')](_0xbfcb5f[_0xca0b('0x35')][_0xca0b('0x22')]);_0x20f0d5[_0xca0b('0x21')]=qs[_0xca0b('0x21')](_0xbfcb5f[_0xca0b('0x35')]['offset']);}_0x20f0d5['order']=qs[_0xca0b('0x3d')](_0xbfcb5f[_0xca0b('0x35')][_0xca0b('0x3d')]);_0x20f0d5[_0xca0b('0x3e')]=qs[_0xca0b('0x37')](_[_0xca0b('0x3f')](_0xbfcb5f[_0xca0b('0x35')],_0x227cdc[_0xca0b('0x37')]),_0xa59ab0);if(_0xbfcb5f[_0xca0b('0x35')][_0xca0b('0x40')]){_0x20f0d5[_0xca0b('0x3e')]=_[_0xca0b('0x41')](_0x20f0d5[_0xca0b('0x3e')],{'$or':_[_0xca0b('0x34')](_0xa59ab0,function(_0x2a023f){if(_0x2a023f[_0xca0b('0x42')]!==_0xca0b('0x43')){var _0x3d3037={};_0x3d3037[_0x2a023f[_0xca0b('0x2d')]]={'$like':'%'+_0xbfcb5f[_0xca0b('0x35')][_0xca0b('0x40')]+'%'};return _0x3d3037;}})});}_0x20f0d5=_[_0xca0b('0x41')]({},_0x20f0d5,_0xbfcb5f[_0xca0b('0x44')]);var _0x42a68f={'where':_0x20f0d5[_0xca0b('0x3e')]};return db['FreshdeskAccount']['count'](_0x42a68f)[_0xca0b('0x2a')](function(_0xba48ee){_0x449a3a['count']=_0xba48ee;if(_0xbfcb5f['query']['includeAll']){_0x20f0d5[_0xca0b('0x45')]=[{'all':!![]}];}return db[_0xca0b('0x2f')][_0xca0b('0x46')](_0x20f0d5);})[_0xca0b('0x2a')](function(_0x3c3dfb){_0x449a3a['rows']=_0x3c3dfb;return _0x449a3a;})['then'](respondWithFilteredResult(_0x3b73ff,_0x20f0d5))[_0xca0b('0x47')](handleError(_0x3b73ff,null));};exports['show']=function(_0x170d76,_0x4eca5d){var _0x57bab3={'raw':![],'where':{'id':_0x170d76[_0xca0b('0x48')]['id']}},_0x54036c={};_0x54036c[_0xca0b('0x33')]=_[_0xca0b('0x36')](db[_0xca0b('0x2f')][_0xca0b('0x30')]);_0x54036c[_0xca0b('0x35')]=_['keys'](_0x170d76[_0xca0b('0x35')]);_0x54036c[_0xca0b('0x37')]=_[_0xca0b('0x38')](_0x54036c[_0xca0b('0x33')],_0x54036c[_0xca0b('0x35')]);_0x57bab3['attributes']=_['intersection'](_0x54036c[_0xca0b('0x33')],qs[_0xca0b('0x3a')](_0x170d76[_0xca0b('0x35')][_0xca0b('0x3a')]));_0x57bab3['attributes']=_0x57bab3[_0xca0b('0x39')][_0xca0b('0x3b')]?_0x57bab3[_0xca0b('0x39')]:_0x54036c[_0xca0b('0x33')];if(_0x170d76['query']['includeAll']){_0x57bab3[_0xca0b('0x45')]=[{'all':!![]}];}_0x57bab3=_[_0xca0b('0x41')]({},_0x57bab3,_0x170d76[_0xca0b('0x44')]);return db['FreshdeskAccount'][_0xca0b('0x49')](_0x57bab3)[_0xca0b('0x2a')](handleEntityNotFound(_0x4eca5d,null))['then'](respondWithResult(_0x4eca5d,null))['catch'](handleError(_0x4eca5d,null));};exports['create']=function(_0x379a06,_0x169207){return db[_0xca0b('0x2f')]['create'](_0x379a06['body'],{})[_0xca0b('0x2a')](respondWithResult(_0x169207,0xc9))[_0xca0b('0x47')](handleError(_0x169207,null));};exports[_0xca0b('0x28')]=function(_0x174e81,_0xeea21f){if(_0x174e81[_0xca0b('0x4a')]['id']){delete _0x174e81['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x174e81[_0xca0b('0x48')]['id']}})[_0xca0b('0x2a')](handleEntityNotFound(_0xeea21f,null))['then'](saveUpdates(_0x174e81[_0xca0b('0x4a')],null))[_0xca0b('0x2a')](respondWithResult(_0xeea21f,null))[_0xca0b('0x47')](handleError(_0xeea21f,null));};exports['destroy']=function(_0x251820,_0x5a3734){return db[_0xca0b('0x2f')][_0xca0b('0x49')]({'where':{'id':_0x251820[_0xca0b('0x48')]['id']}})[_0xca0b('0x2a')](handleEntityNotFound(_0x5a3734,null))[_0xca0b('0x2a')](removeEntity(_0x5a3734,null))[_0xca0b('0x47')](handleError(_0x5a3734,null));};exports[_0xca0b('0x4b')]=function(_0x25e582,_0x123f40,_0x35a678){var _0x38727a={};var _0x1386c5={};var _0x6d737e;var _0x21d2d5;return db[_0xca0b('0x2f')][_0xca0b('0x4c')]({'where':{'id':_0x25e582[_0xca0b('0x48')]['id']}})[_0xca0b('0x2a')](handleEntityNotFound(_0x123f40,null))['then'](function(_0x27fdbd){if(_0x27fdbd){_0x6d737e=_0x27fdbd;_0x1386c5[_0xca0b('0x33')]=_['keys'](db[_0xca0b('0x4d')][_0xca0b('0x30')]);_0x1386c5[_0xca0b('0x35')]=_[_0xca0b('0x36')](_0x25e582[_0xca0b('0x35')]);_0x1386c5[_0xca0b('0x37')]=_[_0xca0b('0x38')](_0x1386c5[_0xca0b('0x33')],_0x1386c5['query']);_0x38727a[_0xca0b('0x39')]=_[_0xca0b('0x38')](_0x1386c5[_0xca0b('0x33')],qs[_0xca0b('0x3a')](_0x25e582['query']['fields']));_0x38727a[_0xca0b('0x39')]=_0x38727a[_0xca0b('0x39')]['length']?_0x38727a[_0xca0b('0x39')]:_0x1386c5['model'];_0x38727a['order']=qs[_0xca0b('0x3d')](_0x25e582[_0xca0b('0x35')][_0xca0b('0x3d')]);_0x38727a['where']=qs['filters'](_[_0xca0b('0x3f')](_0x25e582['query'],_0x1386c5['filters']));if(_0x25e582[_0xca0b('0x35')]['filter']){_0x38727a[_0xca0b('0x3e')]=_[_0xca0b('0x41')](_0x38727a[_0xca0b('0x3e')],{'$or':_['map'](_0x38727a[_0xca0b('0x39')],function(_0x491971){var _0x171c22={};_0x171c22[_0x491971]={'$like':'%'+_0x25e582[_0xca0b('0x35')][_0xca0b('0x40')]+'%'};return _0x171c22;})});}_0x38727a=_[_0xca0b('0x41')]({},_0x38727a,_0x25e582['options']);return _0x6d737e[_0xca0b('0x4b')](_0x38727a);}})[_0xca0b('0x2a')](function(_0x417f24){if(_0x417f24){_0x21d2d5=_0x417f24[_0xca0b('0x3b')];if(!_0x25e582[_0xca0b('0x35')][_0xca0b('0x4e')](_0xca0b('0x3c'))){_0x38727a[_0xca0b('0x22')]=qs[_0xca0b('0x22')](_0x25e582['query']['limit']);_0x38727a[_0xca0b('0x21')]=qs[_0xca0b('0x21')](_0x25e582[_0xca0b('0x35')][_0xca0b('0x21')]);}return _0x6d737e[_0xca0b('0x4b')](_0x38727a);}})[_0xca0b('0x2a')](function(_0x5965ae){if(_0x5965ae){return _0x5965ae?{'count':_0x21d2d5,'rows':_0x5965ae}:null;}})[_0xca0b('0x2a')](respondWithResult(_0x123f40,null))[_0xca0b('0x47')](handleError(_0x123f40,null));};exports[_0xca0b('0x4f')]=function(_0x53fff8,_0x3d07eb,_0x339c38){if(_0x53fff8[_0xca0b('0x4a')]['id']){delete _0x53fff8[_0xca0b('0x4a')]['id'];}return db[_0xca0b('0x2f')][_0xca0b('0x4c')]({'where':{'id':_0x53fff8[_0xca0b('0x48')]['id']}})[_0xca0b('0x2a')](handleEntityNotFound(_0x3d07eb,null))['then'](function(_0x54c09a){if(_0x54c09a){_0x53fff8['body']['AccountId']=_0x54c09a['id'];_0x53fff8['body'][_0xca0b('0x50')]=integrations[_0xca0b('0x51')](_0x53fff8[_0xca0b('0x4a')][_0xca0b('0x52')],_0x53fff8[_0xca0b('0x4a')][_0xca0b('0x42')]);_0x53fff8[_0xca0b('0x4a')][_0xca0b('0x53')]=integrations[_0xca0b('0x54')](_0x53fff8[_0xca0b('0x4a')]['channel'],_0x53fff8[_0xca0b('0x4a')]['type']);return db[_0xca0b('0x4d')]['create'](_0x53fff8[_0xca0b('0x4a')],{'include':[{'model':db[_0xca0b('0x55')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xca0b('0x53')}]});}return null;})[_0xca0b('0x2a')](respondWithResult(_0x3d07eb,null))[_0xca0b('0x47')](handleError(_0x3d07eb,null));};exports['getFields']=function(_0x3b8852,_0xb32532,_0x2a7a72){var _0x40b121='';return db['FreshdeskAccount'][_0xca0b('0x4c')]({'where':{'id':_0x3b8852['params']['id']},'attributes':['id',_0xca0b('0x56'),'apiKey']})[_0xca0b('0x2a')](handleEntityNotFound(_0xb32532,null))[_0xca0b('0x2a')](function(_0x5a7e69){if(_0x5a7e69){_0x40b121=_0x5a7e69[_0xca0b('0x56')];var _0x1a0cd2=_0x40b121['slice'](-0x1);if(_0x1a0cd2==='/'){_0x40b121=_0x40b121[_0xca0b('0x57')](0x0,_0x40b121[_0xca0b('0x58')](_0x1a0cd2));}return rp({'method':_0xca0b('0x59'),'uri':util['format'](_0xca0b('0x5a'),_0x40b121,_0xca0b('0x5b')),'headers':{'Authorization':util[_0xca0b('0x5c')]('Basic\x20%s',new Buffer(util[_0xca0b('0x5c')](_0xca0b('0x5d'),_0x5a7e69[_0xca0b('0x5e')]))[_0xca0b('0x5f')](_0xca0b('0x60')))},'json':!![]});}})[_0xca0b('0x2a')](function(_0x1c10db){if(_0x1c10db){var _0xdb60d5=[_0xca0b('0x61'),_0xca0b('0x62'),_0xca0b('0x63'),_0xca0b('0x64'),_0xca0b('0x1e'),_0xca0b('0x65'),_0xca0b('0x66'),'source',_0xca0b('0x67'),_0xca0b('0x66'),_0xca0b('0x68')];_[_0xca0b('0x69')](_0x1c10db,function(_0xea5ddd){return _0xdb60d5[_0xca0b('0x6a')](_0xea5ddd[_0xca0b('0x2d')])||!_0xea5ddd[_0xca0b('0x6b')]&&_0xea5ddd['type']!==_0xca0b('0x6c')&&_0xea5ddd[_0xca0b('0x42')]!==_0xca0b('0x6d');});return{'count':_0x1c10db[_0xca0b('0x3b')],'rows':_[_0xca0b('0x34')](_0x1c10db,function(_0x3f5cd0){return{'id':_0x3f5cd0['name'],'name':_0x3f5cd0[_0xca0b('0x6e')],'custom':!_0x3f5cd0[_0xca0b('0x6b')],'options':_0x3f5cd0[_0xca0b('0x6f')]?_[_0xca0b('0x34')](_0x3f5cd0[_0xca0b('0x6f')],function(_0x36ba5b){return{'name':_[_0xca0b('0x70')](_0x36ba5b),'value':_0x36ba5b};}):[]};})};}})[_0xca0b('0x2a')](respondWithResult(_0xb32532,null))[_0xca0b('0x47')](function(_0x12fee3){var _0x154c56=_0x3b8852[_0xca0b('0x35')]['test']?0x1f4:_0x12fee3[_0xca0b('0x71')]||0x1f4;logger['error'](_0xca0b('0x72'),_0xca0b('0x73'),_0x154c56,JSON['stringify'](_0x12fee3));delete _0x12fee3[_0xca0b('0x2d')];if(_0x154c56===0x191){_0x154c56=0x190;}_0xb32532[_0xca0b('0x1e')](_0x154c56)['send'](_0x3b8852['query'][_0xca0b('0x74')]?{'message':_0xca0b('0x75'),'statusCode':_0x12fee3[_0xca0b('0x71')]}:_0x12fee3);});}; \ No newline at end of file +var _0xbd5f=['%s:X','toString','requester','agent','priority','group','source','ticket_type','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','create','body','catch','find','findOne','FreshdeskConfiguration','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','format'];(function(_0x170ef3,_0x30b052){var _0x196ece=function(_0x3f9d38){while(--_0x3f9d38){_0x170ef3['push'](_0x170ef3['shift']());}};_0x196ece(++_0x30b052);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x353b70,_0x5d1df5){_0x353b70=_0x353b70-0x0;var _0x362a17=_0xbd5f[_0x353b70];return _0x362a17;};'use strict';var emlformat=require(_0xfbd5('0x0'));var rimraf=require(_0xfbd5('0x1'));var zipdir=require(_0xfbd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbd5('0x3'));var moment=require('moment');var BPromise=require(_0xfbd5('0x4'));var Mustache=require('mustache');var util=require(_0xfbd5('0x5'));var path=require(_0xfbd5('0x6'));var sox=require(_0xfbd5('0x7'));var csv=require(_0xfbd5('0x8'));var ejs=require(_0xfbd5('0x9'));var fs=require('fs');var fs_extra=require(_0xfbd5('0xa'));var _=require(_0xfbd5('0xb'));var squel=require('squel');var crypto=require(_0xfbd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbd5('0x8'));var querystring=require('querystring');var Papa=require(_0xfbd5('0xd'));var Redis=require(_0xfbd5('0xe'));var authService=require(_0xfbd5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd5('0x10'))(_0xfbd5('0x11'));var utils=require(_0xfbd5('0x12'));var config=require(_0xfbd5('0x13'));var licenseUtil=require(_0xfbd5('0x14'));var db=require(_0xfbd5('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x12d472,_0x5bc15f){_0x5bc15f=_0x5bc15f||0xcc;return function(_0xaadca0){if(_0xaadca0){return _0x12d472[_0xfbd5('0x16')](_0x5bc15f);}return _0x12d472['status'](_0x5bc15f)['end']();};}function respondWithResult(_0x82027d,_0x2db3b0){_0x2db3b0=_0x2db3b0||0xc8;return function(_0x2eb58a){if(_0x2eb58a){return _0x82027d[_0xfbd5('0x17')](_0x2db3b0)[_0xfbd5('0x18')](_0x2eb58a);}};}function respondWithFilteredResult(_0x1e09be,_0x1918aa){return function(_0x288d71){if(_0x288d71){var _0x48efb8=typeof _0x1918aa[_0xfbd5('0x19')]===_0xfbd5('0x1a')&&typeof _0x1918aa[_0xfbd5('0x1b')]==='undefined';var _0x472325=_0x288d71[_0xfbd5('0x1c')];var _0x56c8f4=_0x48efb8?0x0:_0x1918aa[_0xfbd5('0x19')];var _0x51cc13=_0x48efb8?_0x288d71['count']:_0x1918aa[_0xfbd5('0x19')]+_0x1918aa[_0xfbd5('0x1b')];var _0x4b3d44;if(_0x51cc13>=_0x472325){_0x51cc13=_0x472325;_0x4b3d44=0xc8;}else{_0x4b3d44=0xce;}_0x1e09be[_0xfbd5('0x17')](_0x4b3d44);return _0x1e09be[_0xfbd5('0x1d')]('Content-Range',_0x56c8f4+'-'+_0x51cc13+'/'+_0x472325)[_0xfbd5('0x18')](_0x288d71);}return null;};}function patchUpdates(_0x364c0c){return function(_0x4a3d68){try{jsonpatch[_0xfbd5('0x1e')](_0x4a3d68,_0x364c0c,!![]);}catch(_0x5b9911){return BPromise[_0xfbd5('0x1f')](_0x5b9911);}return _0x4a3d68[_0xfbd5('0x20')]();};}function saveUpdates(_0x22c032,_0x32dd82){return function(_0x4da1e3){if(_0x4da1e3){return _0x4da1e3[_0xfbd5('0x21')](_0x22c032)[_0xfbd5('0x22')](function(_0x6f4990){return _0x6f4990;});}return null;};}function removeEntity(_0x1e2702,_0x3b7aa7){return function(_0x2ddfd3){if(_0x2ddfd3){return _0x2ddfd3[_0xfbd5('0x23')]()[_0xfbd5('0x22')](function(){_0x1e2702['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d5d1,_0x2a6f8c){return function(_0x16faad){if(!_0x16faad){_0x51d5d1[_0xfbd5('0x16')](0x194);}return _0x16faad;};}function handleError(_0x5195c3,_0x5b2080){_0x5b2080=_0x5b2080||0x1f4;return function(_0x12d3c3){logger[_0xfbd5('0x24')](_0x12d3c3[_0xfbd5('0x25')]);if(_0x12d3c3[_0xfbd5('0x26')]){delete _0x12d3c3[_0xfbd5('0x26')];}_0x5195c3[_0xfbd5('0x17')](_0x5b2080)[_0xfbd5('0x27')](_0x12d3c3);};}exports[_0xfbd5('0x28')]=function(_0x582ad8,_0x284301){var _0x903794={},_0x195f41={},_0x3a18d8={'count':0x0,'rows':[]};var _0x4c1d97=_[_0xfbd5('0x29')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')],function(_0x443900){return{'name':_0x443900[_0xfbd5('0x2c')],'type':_0x443900[_0xfbd5('0x2d')][_0xfbd5('0x2e')]};});_0x195f41[_0xfbd5('0x2f')]=_[_0xfbd5('0x29')](_0x4c1d97,'name');_0x195f41[_0xfbd5('0x30')]=_[_0xfbd5('0x31')](_0x582ad8[_0xfbd5('0x30')]);_0x195f41[_0xfbd5('0x32')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],_0x195f41['query']);_0x903794[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x195f41[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x582ad8['query']['fields']));_0x903794['attributes']=_0x903794[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x903794[_0xfbd5('0x34')]:_0x195f41['model'];if(!_0x582ad8['query'][_0xfbd5('0x37')](_0xfbd5('0x38'))){_0x903794['limit']=qs['limit'](_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x1b')]);_0x903794[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x582ad8['query'][_0xfbd5('0x19')]);}_0x903794[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x582ad8['query'][_0xfbd5('0x3a')]);_0x903794[_0xfbd5('0x3b')]=qs['filters'](_[_0xfbd5('0x3c')](_0x582ad8[_0xfbd5('0x30')],_0x195f41[_0xfbd5('0x32')]),_0x4c1d97);if(_0x582ad8['query'][_0xfbd5('0x3d')]){_0x903794[_0xfbd5('0x3b')]=_[_0xfbd5('0x3e')](_0x903794[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x4c1d97,function(_0x4901cd){if(_0x4901cd[_0xfbd5('0x2d')]!==_0xfbd5('0x3f')){var _0x2387b1={};_0x2387b1[_0x4901cd[_0xfbd5('0x26')]]={'$like':'%'+_0x582ad8[_0xfbd5('0x30')]['filter']+'%'};return _0x2387b1;}})});}_0x903794=_[_0xfbd5('0x3e')]({},_0x903794,_0x582ad8['options']);var _0x3c4b10={'where':_0x903794[_0xfbd5('0x3b')]};return db[_0xfbd5('0x2a')][_0xfbd5('0x1c')](_0x3c4b10)[_0xfbd5('0x22')](function(_0x5b5a76){_0x3a18d8[_0xfbd5('0x1c')]=_0x5b5a76;if(_0x582ad8[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x903794[_0xfbd5('0x41')]=[{'all':!![]}];}return db[_0xfbd5('0x2a')]['findAll'](_0x903794);})[_0xfbd5('0x22')](function(_0x3440b0){_0x3a18d8['rows']=_0x3440b0;return _0x3a18d8;})[_0xfbd5('0x22')](respondWithFilteredResult(_0x284301,_0x903794))['catch'](handleError(_0x284301,null));};exports[_0xfbd5('0x42')]=function(_0x43ae35,_0x5c502f){var _0x290ee4={'raw':![],'where':{'id':_0x43ae35[_0xfbd5('0x43')]['id']}},_0x2a976d={};_0x2a976d[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x2a')][_0xfbd5('0x2b')]);_0x2a976d[_0xfbd5('0x30')]=_['keys'](_0x43ae35['query']);_0x2a976d['filters']=_['intersection'](_0x2a976d[_0xfbd5('0x2f')],_0x2a976d[_0xfbd5('0x30')]);_0x290ee4[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x2a976d[_0xfbd5('0x2f')],qs['fields'](_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x290ee4['attributes']=_0x290ee4['attributes'][_0xfbd5('0x36')]?_0x290ee4[_0xfbd5('0x34')]:_0x2a976d[_0xfbd5('0x2f')];if(_0x43ae35[_0xfbd5('0x30')][_0xfbd5('0x40')]){_0x290ee4[_0xfbd5('0x41')]=[{'all':!![]}];}_0x290ee4=_[_0xfbd5('0x3e')]({},_0x290ee4,_0x43ae35[_0xfbd5('0x44')]);return db[_0xfbd5('0x2a')]['find'](_0x290ee4)[_0xfbd5('0x22')](handleEntityNotFound(_0x5c502f,null))[_0xfbd5('0x22')](respondWithResult(_0x5c502f,null))['catch'](handleError(_0x5c502f,null));};exports[_0xfbd5('0x45')]=function(_0x2285f9,_0x2764d0){return db[_0xfbd5('0x2a')][_0xfbd5('0x45')](_0x2285f9[_0xfbd5('0x46')],{})['then'](respondWithResult(_0x2764d0,0xc9))[_0xfbd5('0x47')](handleError(_0x2764d0,null));};exports[_0xfbd5('0x21')]=function(_0x5df44d,_0x5e0475){if(_0x5df44d['body']['id']){delete _0x5df44d[_0xfbd5('0x46')]['id'];}return db['FreshdeskAccount'][_0xfbd5('0x48')]({'where':{'id':_0x5df44d[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x5e0475,null))[_0xfbd5('0x22')](saveUpdates(_0x5df44d['body'],null))['then'](respondWithResult(_0x5e0475,null))['catch'](handleError(_0x5e0475,null));};exports[_0xfbd5('0x23')]=function(_0x14eca5,_0x14c4ff){return db[_0xfbd5('0x2a')]['find']({'where':{'id':_0x14eca5[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0x14c4ff,null))[_0xfbd5('0x22')](removeEntity(_0x14c4ff,null))[_0xfbd5('0x47')](handleError(_0x14c4ff,null));};exports['getConfigurations']=function(_0x48c0d6,_0xa718dd,_0x4b55db){var _0x522bec={};var _0x110368={};var _0x9f848e;var _0x2d37bc;return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x48c0d6[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xa718dd,null))[_0xfbd5('0x22')](function(_0x1cd8b4){if(_0x1cd8b4){_0x9f848e=_0x1cd8b4;_0x110368[_0xfbd5('0x2f')]=_[_0xfbd5('0x31')](db[_0xfbd5('0x4a')][_0xfbd5('0x2b')]);_0x110368['query']=_[_0xfbd5('0x31')](_0x48c0d6['query']);_0x110368[_0xfbd5('0x32')]=_['intersection'](_0x110368[_0xfbd5('0x2f')],_0x110368['query']);_0x522bec[_0xfbd5('0x34')]=_[_0xfbd5('0x33')](_0x110368[_0xfbd5('0x2f')],qs[_0xfbd5('0x35')](_0x48c0d6[_0xfbd5('0x30')][_0xfbd5('0x35')]));_0x522bec['attributes']=_0x522bec[_0xfbd5('0x34')][_0xfbd5('0x36')]?_0x522bec[_0xfbd5('0x34')]:_0x110368[_0xfbd5('0x2f')];_0x522bec[_0xfbd5('0x39')]=qs[_0xfbd5('0x3a')](_0x48c0d6['query'][_0xfbd5('0x3a')]);_0x522bec[_0xfbd5('0x3b')]=qs[_0xfbd5('0x32')](_[_0xfbd5('0x3c')](_0x48c0d6[_0xfbd5('0x30')],_0x110368[_0xfbd5('0x32')]));if(_0x48c0d6[_0xfbd5('0x30')]['filter']){_0x522bec['where']=_[_0xfbd5('0x3e')](_0x522bec[_0xfbd5('0x3b')],{'$or':_[_0xfbd5('0x29')](_0x522bec['attributes'],function(_0x34882e){var _0x5b2d9a={};_0x5b2d9a[_0x34882e]={'$like':'%'+_0x48c0d6['query']['filter']+'%'};return _0x5b2d9a;})});}_0x522bec=_[_0xfbd5('0x3e')]({},_0x522bec,_0x48c0d6[_0xfbd5('0x44')]);return _0x9f848e[_0xfbd5('0x4b')](_0x522bec);}})[_0xfbd5('0x22')](function(_0x404801){if(_0x404801){_0x2d37bc=_0x404801['length'];if(!_0x48c0d6['query']['hasOwnProperty'](_0xfbd5('0x38'))){_0x522bec[_0xfbd5('0x1b')]=qs[_0xfbd5('0x1b')](_0x48c0d6[_0xfbd5('0x30')]['limit']);_0x522bec[_0xfbd5('0x19')]=qs[_0xfbd5('0x19')](_0x48c0d6[_0xfbd5('0x30')]['offset']);}return _0x9f848e['getConfigurations'](_0x522bec);}})[_0xfbd5('0x22')](function(_0x5c3ca7){if(_0x5c3ca7){return _0x5c3ca7?{'count':_0x2d37bc,'rows':_0x5c3ca7}:null;}})[_0xfbd5('0x22')](respondWithResult(_0xa718dd,null))['catch'](handleError(_0xa718dd,null));};exports['addConfiguration']=function(_0x53a135,_0xf67581,_0x583164){if(_0x53a135[_0xfbd5('0x46')]['id']){delete _0x53a135[_0xfbd5('0x46')]['id'];}return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x53a135[_0xfbd5('0x43')]['id']}})[_0xfbd5('0x22')](handleEntityNotFound(_0xf67581,null))[_0xfbd5('0x22')](function(_0x1c4bcf){if(_0x1c4bcf){_0x53a135[_0xfbd5('0x46')]['AccountId']=_0x1c4bcf['id'];_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x4c')]=integrations[_0xfbd5('0x4d')](_0x53a135['body']['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);_0x53a135['body'][_0xfbd5('0x4e')]=integrations[_0xfbd5('0x4f')](_0x53a135[_0xfbd5('0x46')]['channel'],_0x53a135[_0xfbd5('0x46')][_0xfbd5('0x2d')]);return db['FreshdeskConfiguration'][_0xfbd5('0x45')](_0x53a135[_0xfbd5('0x46')],{'include':[{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4c')},{'model':db[_0xfbd5('0x50')],'as':_0xfbd5('0x4e')}]});}return null;})[_0xfbd5('0x22')](respondWithResult(_0xf67581,null))[_0xfbd5('0x47')](handleError(_0xf67581,null));};exports[_0xfbd5('0x51')]=function(_0x370ee7,_0x1b6dae,_0x35db5d){var _0x11ba00='';return db[_0xfbd5('0x2a')][_0xfbd5('0x49')]({'where':{'id':_0x370ee7[_0xfbd5('0x43')]['id']},'attributes':['id',_0xfbd5('0x52'),_0xfbd5('0x53')]})[_0xfbd5('0x22')](handleEntityNotFound(_0x1b6dae,null))[_0xfbd5('0x22')](function(_0x2ab57a){if(_0x2ab57a){_0x11ba00=_0x2ab57a[_0xfbd5('0x52')];var _0x23317e=_0x11ba00[_0xfbd5('0x54')](-0x1);if(_0x23317e==='/'){_0x11ba00=_0x11ba00[_0xfbd5('0x55')](0x0,_0x11ba00[_0xfbd5('0x56')](_0x23317e));}return rp({'method':_0xfbd5('0x57'),'uri':util['format'](_0xfbd5('0x58'),_0x11ba00,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xfbd5('0x59')]('Basic\x20%s',new Buffer(util[_0xfbd5('0x59')](_0xfbd5('0x5a'),_0x2ab57a[_0xfbd5('0x53')]))[_0xfbd5('0x5b')]('base64'))},'json':!![]});}})['then'](function(_0x14d9d7){if(_0x14d9d7){var _0x19ea66=[_0xfbd5('0x5c'),'subject',_0xfbd5('0x5d'),'description',_0xfbd5('0x17'),_0xfbd5('0x5e'),_0xfbd5('0x5f'),_0xfbd5('0x60'),_0xfbd5('0x61'),_0xfbd5('0x5f'),'company'];_['remove'](_0x14d9d7,function(_0x51f670){return _0x19ea66[_0xfbd5('0x62')](_0x51f670[_0xfbd5('0x26')])||!_0x51f670[_0xfbd5('0x63')]&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x64')&&_0x51f670[_0xfbd5('0x2d')]!==_0xfbd5('0x65');});return{'count':_0x14d9d7['length'],'rows':_['map'](_0x14d9d7,function(_0x24a625){return{'id':_0x24a625['name'],'name':_0x24a625['label'],'custom':!_0x24a625[_0xfbd5('0x63')],'options':_0x24a625[_0xfbd5('0x66')]?_[_0xfbd5('0x29')](_0x24a625[_0xfbd5('0x66')],function(_0x109ad5){return{'name':_[_0xfbd5('0x67')](_0x109ad5),'value':_0x109ad5};}):[]};})};}})[_0xfbd5('0x22')](respondWithResult(_0x1b6dae,null))[_0xfbd5('0x47')](function(_0x5942b5){var _0x462f53=_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?0x1f4:_0x5942b5[_0xfbd5('0x69')]||0x1f4;logger[_0xfbd5('0x24')](_0xfbd5('0x6a'),_0xfbd5('0x51'),_0x462f53,JSON[_0xfbd5('0x6b')](_0x5942b5));delete _0x5942b5['name'];if(_0x462f53===0x191){_0x462f53=0x190;}_0x1b6dae[_0xfbd5('0x17')](_0x462f53)['send'](_0x370ee7[_0xfbd5('0x30')][_0xfbd5('0x68')]?{'message':_0xfbd5('0x6c'),'statusCode':_0x5942b5[_0xfbd5('0x69')]}:_0x5942b5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ed00377..7e0b740 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 _0x58dc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x58dc,0x1b0));var _0xc58d=function(_0x5e2952,_0x7030ab){_0x5e2952=_0x5e2952-0x0;var _0x2ef155=_0x58dc[_0x5e2952];return _0x2ef155;};'use strict';var _=require(_0xc58d('0x0'));var util=require('util');var logger=require(_0xc58d('0x1'))('api');var moment=require(_0xc58d('0x2'));var BPromise=require(_0xc58d('0x3'));var rp=require(_0xc58d('0x4'));var fs=require('fs');var path=require(_0xc58d('0x5'));var rimraf=require(_0xc58d('0x6'));var config=require(_0xc58d('0x7'));var attributes=require(_0xc58d('0x8'));var integrations=require(_0xc58d('0x9'));module['exports']=function(_0x6b1467,_0x19eb4d){return _0x6b1467['define'](_0xc58d('0xa'),attributes,{'tableName':_0xc58d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eed=['bluebird','request-promise','path','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment'];(function(_0x173d82,_0x1bd048){var _0x1713c1=function(_0x46fa1c){while(--_0x46fa1c){_0x173d82['push'](_0x173d82['shift']());}};_0x1713c1(++_0x1bd048);}(_0x6eed,0x8c));var _0xd6ee=function(_0x450678,_0x2b6600){_0x450678=_0x450678-0x0;var _0xb0d108=_0x6eed[_0x450678];return _0xb0d108;};'use strict';var _=require(_0xd6ee('0x0'));var util=require('util');var logger=require(_0xd6ee('0x1'))('api');var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var fs=require('fs');var path=require(_0xd6ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd6ee('0x6'));module[_0xd6ee('0x7')]=function(_0x30a7b1,_0x36e534){return _0x30a7b1[_0xd6ee('0x8')](_0xd6ee('0x9'),attributes,{'tableName':_0xd6ee('0xa'),'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 16c8c54..d8cbc83 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 _0x3c17=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','model','map','ShowFreshdeskAccount','find','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x519102,_0x58c004){var _0x262633=function(_0xaba9a0){while(--_0xaba9a0){_0x519102['push'](_0x519102['shift']());}};_0x262633(++_0x58c004);}(_0x3c17,0x1a1));var _0x73c1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3c17[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var moment=require(_0x73c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x73c1('0x2'));var fs=require('fs');var Redis=require(_0x73c1('0x3'));var db=require(_0x73c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73c1('0x5'))(_0x73c1('0x6'));var config=require(_0x73c1('0x7'));var jayson=require(_0x73c1('0x8'));var client=jayson['client'][_0x73c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58151c,_0x4433e0,_0x42ca06){return new BPromise(function(_0x422176,_0x5155aa){return client['request'](_0x58151c,_0x42ca06)[_0x73c1('0xa')](function(_0x2eb6fe){logger[_0x73c1('0xb')](_0x73c1('0xc'),_0x4433e0,_0x73c1('0xd'));logger[_0x73c1('0xe')](_0x73c1('0xf'),_0x4433e0,'request\x20sent',JSON['stringify'](_0x2eb6fe));if(_0x2eb6fe[_0x73c1('0x10')]){if(_0x2eb6fe[_0x73c1('0x10')][_0x73c1('0x11')]===0x1f4){logger[_0x73c1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x4433e0,_0x2eb6fe[_0x73c1('0x10')]['message']);return _0x5155aa(_0x2eb6fe[_0x73c1('0x10')]['message']);}logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4433e0,_0x2eb6fe['error']['message']);return _0x422176(_0x2eb6fe[_0x73c1('0x10')]['message']);}else{logger[_0x73c1('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x4433e0,_0x73c1('0xd'));_0x422176(_0x2eb6fe['result'][_0x73c1('0x12')]);}})[_0x73c1('0x13')](function(_0x39256e){logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4433e0,_0x39256e);_0x5155aa(_0x39256e);});});}exports[_0x73c1('0x14')]=function(_0x16deb6){var _0x3e984c=this;return new Promise(function(_0x1ce19e,_0x4f6460){return db[_0x73c1('0x15')][_0x73c1('0x16')]({'raw':_0x16deb6[_0x73c1('0x17')]?_0x16deb6[_0x73c1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x16deb6[_0x73c1('0x17')]?_0x16deb6[_0x73c1('0x17')][_0x73c1('0x18')]||null:null,'attributes':_0x16deb6[_0x73c1('0x17')]?_0x16deb6[_0x73c1('0x17')][_0x73c1('0x19')]||null:null,'limit':_0x16deb6[_0x73c1('0x17')]?_0x16deb6[_0x73c1('0x17')]['limit']||null:null,'include':_0x16deb6[_0x73c1('0x17')]?_0x16deb6[_0x73c1('0x17')][_0x73c1('0x1a')]?_['map'](_0x16deb6[_0x73c1('0x17')][_0x73c1('0x1a')],function(_0x1125ff){return{'model':db[_0x1125ff[_0x73c1('0x1b')]],'as':_0x1125ff['as'],'attributes':_0x1125ff[_0x73c1('0x19')],'include':_0x1125ff['include']?_[_0x73c1('0x1c')](_0x1125ff['include'],function(_0x54feeb){return{'model':db[_0x54feeb[_0x73c1('0x1b')]],'as':_0x54feeb['as'],'attributes':_0x54feeb[_0x73c1('0x19')],'include':_0x54feeb[_0x73c1('0x1a')]?_[_0x73c1('0x1c')](_0x54feeb[_0x73c1('0x1a')],function(_0x30ec73){return{'model':db[_0x30ec73[_0x73c1('0x1b')]],'as':_0x30ec73['as'],'attributes':_0x30ec73[_0x73c1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x73c1('0xa')](function(_0xf82fb9){logger[_0x73c1('0xb')](_0x73c1('0x14'),_0x16deb6);logger[_0x73c1('0xe')](_0x73c1('0x14'),_0x16deb6,JSON['stringify'](_0xf82fb9));_0x1ce19e(_0xf82fb9);})[_0x73c1('0x13')](function(_0x9050fd){logger[_0x73c1('0x10')](_0x73c1('0x14'),_0x9050fd[_0x73c1('0x12')],_0x16deb6);_0x4f6460(_0x3e984c[_0x73c1('0x10')](0x1f4,_0x9050fd[_0x73c1('0x12')]));});});};exports[_0x73c1('0x1d')]=function(_0x361f33){var _0x5130c6=this;return new Promise(function(_0x56c0a5,_0xf8fa4c){return db[_0x73c1('0x15')][_0x73c1('0x1e')]({'raw':_0x361f33[_0x73c1('0x17')]?_0x361f33['options'][_0x73c1('0x1f')]===undefined?!![]:![]:!![],'where':_0x361f33[_0x73c1('0x17')]?_0x361f33[_0x73c1('0x17')]['where']||null:null,'attributes':_0x361f33[_0x73c1('0x17')]?_0x361f33[_0x73c1('0x17')][_0x73c1('0x19')]||null:null,'include':_0x361f33[_0x73c1('0x17')]?_0x361f33[_0x73c1('0x17')][_0x73c1('0x1a')]?_['map'](_0x361f33[_0x73c1('0x17')][_0x73c1('0x1a')],function(_0x359b2c){return{'model':db[_0x359b2c[_0x73c1('0x1b')]],'as':_0x359b2c['as'],'attributes':_0x359b2c[_0x73c1('0x19')],'include':_0x359b2c[_0x73c1('0x1a')]?_[_0x73c1('0x1c')](_0x359b2c[_0x73c1('0x1a')],function(_0x3103ec){return{'model':db[_0x3103ec[_0x73c1('0x1b')]],'as':_0x3103ec['as'],'attributes':_0x3103ec['attributes'],'include':_0x3103ec[_0x73c1('0x1a')]?_['map'](_0x3103ec[_0x73c1('0x1a')],function(_0x25e2f6){return{'model':db[_0x25e2f6[_0x73c1('0x1b')]],'as':_0x25e2f6['as'],'attributes':_0x25e2f6[_0x73c1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9258){logger['info'](_0x73c1('0x1d'),_0x361f33);logger['debug'](_0x73c1('0x1d'),_0x361f33,JSON[_0x73c1('0x20')](_0x5e9258));_0x56c0a5(_0x5e9258);})[_0x73c1('0x13')](function(_0x1234a6){logger[_0x73c1('0x10')](_0x73c1('0x1d'),_0x1234a6[_0x73c1('0x12')],_0x361f33);_0xf8fa4c(_0x5130c6[_0x73c1('0x10')](0x1f4,_0x1234a6[_0x73c1('0x12')]));});});}; \ No newline at end of file +var _0x86d8=['error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','stringify','ShowFreshdeskAccount','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x380030,_0x1d39e1){var _0x1b4473=function(_0x51c52e){while(--_0x51c52e){_0x380030['push'](_0x380030['shift']());}};_0x1b4473(++_0x1d39e1);}(_0x86d8,0xb8));var _0x886d=function(_0x50694c,_0x97a97d){_0x50694c=_0x50694c-0x0;var _0x33111e=_0x86d8[_0x50694c];return _0x33111e;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x886d('0x2'));var db=require(_0x886d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x886d('0x4'))('rpc');var config=require(_0x886d('0x5'));var jayson=require(_0x886d('0x6'));var client=jayson[_0x886d('0x7')][_0x886d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42cfa4,_0x488f3c,_0x35753e){return new BPromise(function(_0x44b586,_0x237864){return client[_0x886d('0x9')](_0x42cfa4,_0x35753e)[_0x886d('0xa')](function(_0x1090fe){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x488f3c,_0x886d('0xb'));logger[_0x886d('0xc')](_0x886d('0xd'),_0x488f3c,_0x886d('0xb'),JSON['stringify'](_0x1090fe));if(_0x1090fe[_0x886d('0xe')]){if(_0x1090fe[_0x886d('0xe')][_0x886d('0xf')]===0x1f4){logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x1090fe['error'][_0x886d('0x11')]);return _0x237864(_0x1090fe[_0x886d('0xe')][_0x886d('0x11')]);}logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x1090fe['error'][_0x886d('0x11')]);return _0x44b586(_0x1090fe[_0x886d('0xe')]['message']);}else{logger[_0x886d('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x488f3c,_0x886d('0xb'));_0x44b586(_0x1090fe['result'][_0x886d('0x11')]);}})[_0x886d('0x13')](function(_0x5e9be0){logger[_0x886d('0xe')](_0x886d('0x10'),_0x488f3c,_0x5e9be0);_0x237864(_0x5e9be0);});});}exports[_0x886d('0x14')]=function(_0x4be275){var _0x2da963=this;return new Promise(function(_0x40fa6d,_0x5c7f44){return db[_0x886d('0x15')][_0x886d('0x16')]({'raw':_0x4be275['options']?_0x4be275[_0x886d('0x17')][_0x886d('0x18')]===undefined?!![]:![]:!![],'where':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')][_0x886d('0x19')]||null:null,'attributes':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')][_0x886d('0x1a')]||null:null,'limit':_0x4be275[_0x886d('0x17')]?_0x4be275['options'][_0x886d('0x1b')]||null:null,'include':_0x4be275[_0x886d('0x17')]?_0x4be275[_0x886d('0x17')]['include']?_[_0x886d('0x1c')](_0x4be275[_0x886d('0x17')]['include'],function(_0x31b433){return{'model':db[_0x31b433[_0x886d('0x1d')]],'as':_0x31b433['as'],'attributes':_0x31b433[_0x886d('0x1a')],'include':_0x31b433[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x31b433['include'],function(_0x4359bb){return{'model':db[_0x4359bb[_0x886d('0x1d')]],'as':_0x4359bb['as'],'attributes':_0x4359bb[_0x886d('0x1a')],'include':_0x4359bb[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x4359bb[_0x886d('0x1e')],function(_0x4719a8){return{'model':db[_0x4719a8['model']],'as':_0x4719a8['as'],'attributes':_0x4719a8[_0x886d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x886d('0xa')](function(_0x6eee28){logger[_0x886d('0x12')](_0x886d('0x14'),_0x4be275);logger[_0x886d('0xc')]('GetFreshdeskAccount',_0x4be275,JSON[_0x886d('0x1f')](_0x6eee28));_0x40fa6d(_0x6eee28);})[_0x886d('0x13')](function(_0x8bcb0d){logger[_0x886d('0xe')](_0x886d('0x14'),_0x8bcb0d['message'],_0x4be275);_0x5c7f44(_0x2da963[_0x886d('0xe')](0x1f4,_0x8bcb0d[_0x886d('0x11')]));});});};exports[_0x886d('0x20')]=function(_0x2682d7){var _0x2b5cf3=this;return new Promise(function(_0x2ece66,_0x4161da){return db['FreshdeskAccount']['find']({'raw':_0x2682d7[_0x886d('0x17')]?_0x2682d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x19')]||null:null,'attributes':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x1a')]||null:null,'include':_0x2682d7[_0x886d('0x17')]?_0x2682d7[_0x886d('0x17')][_0x886d('0x1e')]?_['map'](_0x2682d7[_0x886d('0x17')]['include'],function(_0x536891){return{'model':db[_0x536891[_0x886d('0x1d')]],'as':_0x536891['as'],'attributes':_0x536891[_0x886d('0x1a')],'include':_0x536891[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x536891[_0x886d('0x1e')],function(_0x4f61f2){return{'model':db[_0x4f61f2['model']],'as':_0x4f61f2['as'],'attributes':_0x4f61f2[_0x886d('0x1a')],'include':_0x4f61f2[_0x886d('0x1e')]?_[_0x886d('0x1c')](_0x4f61f2[_0x886d('0x1e')],function(_0x2713ee){return{'model':db[_0x2713ee[_0x886d('0x1d')]],'as':_0x2713ee['as'],'attributes':_0x2713ee[_0x886d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x886d('0xa')](function(_0xa3f173){logger[_0x886d('0x12')](_0x886d('0x20'),_0x2682d7);logger[_0x886d('0xc')](_0x886d('0x20'),_0x2682d7,JSON['stringify'](_0xa3f173));_0x2ece66(_0xa3f173);})[_0x886d('0x13')](function(_0x45d582){logger[_0x886d('0xe')](_0x886d('0x20'),_0x45d582[_0x886d('0x11')],_0x2682d7);_0x4161da(_0x2b5cf3['error'](0x1f4,_0x45d582[_0x886d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ca91d8f..4797a7c 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 _0x38ef=['getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields'];(function(_0xfaf131,_0x11ec1a){var _0x5da103=function(_0x5ccecb){while(--_0x5ccecb){_0xfaf131['push'](_0xfaf131['shift']());}};_0x5da103(++_0x11ec1a);}(_0x38ef,0x110));var _0xf38e=function(_0x10083a,_0x47617b){_0x10083a=_0x10083a-0x0;var _0x59de5e=_0x38ef[_0x10083a];return _0x59de5e;};'use strict';var multer=require(_0xf38e('0x0'));var util=require(_0xf38e('0x1'));var path=require(_0xf38e('0x2'));var timeout=require(_0xf38e('0x3'));var express=require('express');var router=express[_0xf38e('0x4')]();var fs_extra=require(_0xf38e('0x5'));var auth=require(_0xf38e('0x6'));var interaction=require(_0xf38e('0x7'));var config=require('../../config/environment');var controller=require(_0xf38e('0x8'));router[_0xf38e('0x9')]('/',auth[_0xf38e('0xa')](),controller[_0xf38e('0xb')]);router[_0xf38e('0x9')](_0xf38e('0xc'),auth[_0xf38e('0xa')](),controller['show']);router[_0xf38e('0x9')](_0xf38e('0xd'),auth['isAuthenticated'](),controller[_0xf38e('0xe')]);router['get'](_0xf38e('0xf'),auth['isAuthenticated'](),controller[_0xf38e('0x10')]);router['get']('/:id/descriptions',auth[_0xf38e('0xa')](),controller[_0xf38e('0x11')]);router[_0xf38e('0x9')](_0xf38e('0x12'),auth['isAuthenticated'](),controller[_0xf38e('0x13')]);router[_0xf38e('0x14')]('/',auth['isAuthenticated'](),controller[_0xf38e('0x15')]);router[_0xf38e('0x14')](_0xf38e('0x12'),auth[_0xf38e('0xa')](),controller['setTags']);router[_0xf38e('0x16')](_0xf38e('0xc'),auth[_0xf38e('0xa')](),controller[_0xf38e('0x17')]);router[_0xf38e('0x18')](_0xf38e('0xc'),auth['isAuthenticated'](),controller[_0xf38e('0x19')]);module['exports']=router; \ No newline at end of file +var _0x437a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','exports','multer','util'];(function(_0x52ad84,_0x4e34ce){var _0x3ad2a1=function(_0x5a3056){while(--_0x5a3056){_0x52ad84['push'](_0x52ad84['shift']());}};_0x3ad2a1(++_0x4e34ce);}(_0x437a,0x76));var _0xa437=function(_0x49b5ed,_0x35cb99){_0x49b5ed=_0x49b5ed-0x0;var _0x117247=_0x437a[_0x49b5ed];return _0x117247;};'use strict';var multer=require(_0xa437('0x0'));var util=require(_0xa437('0x1'));var path=require(_0xa437('0x2'));var timeout=require(_0xa437('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa437('0x4'));var interaction=require(_0xa437('0x5'));var config=require(_0xa437('0x6'));var controller=require(_0xa437('0x7'));router[_0xa437('0x8')]('/',auth[_0xa437('0x9')](),controller['index']);router[_0xa437('0x8')](_0xa437('0xa'),auth[_0xa437('0x9')](),controller[_0xa437('0xb')]);router['get'](_0xa437('0xc'),auth[_0xa437('0x9')](),controller[_0xa437('0xd')]);router[_0xa437('0x8')](_0xa437('0xe'),auth[_0xa437('0x9')](),controller['getSubjects']);router[_0xa437('0x8')](_0xa437('0xf'),auth[_0xa437('0x9')](),controller[_0xa437('0x10')]);router[_0xa437('0x8')]('/:id/tags',auth[_0xa437('0x9')](),controller[_0xa437('0x11')]);router[_0xa437('0x12')]('/',auth[_0xa437('0x9')](),controller[_0xa437('0x13')]);router[_0xa437('0x12')](_0xa437('0x14'),auth[_0xa437('0x9')](),controller[_0xa437('0x15')]);router['put'](_0xa437('0xa'),auth[_0xa437('0x9')](),controller['update']);router[_0xa437('0x16')]('/:id',auth[_0xa437('0x9')](),controller['destroy']);module[_0xa437('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4939e69..1f66287 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 _0xeee8=['sequelize','exports','STRING'];(function(_0x29a9f0,_0x541d5d){var _0x514c1a=function(_0x27d1e4){while(--_0x27d1e4){_0x29a9f0['push'](_0x29a9f0['shift']());}};_0x514c1a(++_0x541d5d);}(_0xeee8,0x177));var _0x8eee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeee8[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8eee('0x0'));module[_0x8eee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8eee('0x2')]}}; \ No newline at end of file +var _0xa599=['sequelize','exports','STRING'];(function(_0x10ad06,_0x2c8756){var _0x515e08=function(_0x3073eb){while(--_0x3073eb){_0x10ad06['push'](_0x10ad06['shift']());}};_0x515e08(++_0x2c8756);}(_0xa599,0x186));var _0x9a59=function(_0x252aae,_0x4c8fa9){_0x252aae=_0x252aae-0x0;var _0x397bbe=_0xa599[_0x252aae];return _0x397bbe;};'use strict';var Sequelize=require(_0x9a59('0x0'));module[_0x9a59('0x1')]={'name':{'type':Sequelize[_0x9a59('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 d390e35..4798d7e 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 _0xd67a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','Tag','order','getTags','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x5d23e8,_0x414d97){var _0x4d0c9a=function(_0x121798){while(--_0x121798){_0x5d23e8['push'](_0x5d23e8['shift']());}};_0x4d0c9a(++_0x414d97);}(_0xd67a,0xa5));var _0xad67=function(_0x3e8642,_0x59c1ea){_0x3e8642=_0x3e8642-0x0;var _0x5105cf=_0xd67a[_0x3e8642];return _0x5105cf;};'use strict';var emlformat=require(_0xad67('0x0'));var rimraf=require(_0xad67('0x1'));var zipdir=require(_0xad67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xad67('0x3'));var BPromise=require(_0xad67('0x4'));var Mustache=require(_0xad67('0x5'));var util=require(_0xad67('0x6'));var path=require(_0xad67('0x7'));var sox=require(_0xad67('0x8'));var csv=require(_0xad67('0x9'));var ejs=require(_0xad67('0xa'));var fs=require('fs');var fs_extra=require(_0xad67('0xb'));var _=require(_0xad67('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad67('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad67('0x9'));var querystring=require(_0xad67('0xe'));var Papa=require(_0xad67('0xf'));var Redis=require('ioredis');var authService=require(_0xad67('0x10'));var qs=require(_0xad67('0x11'));var as=require(_0xad67('0x12'));var hardwareService=require(_0xad67('0x13'));var logger=require('../../config/logger')(_0xad67('0x14'));var utils=require(_0xad67('0x15'));var config=require(_0xad67('0x16'));var licenseUtil=require(_0xad67('0x17'));var db=require(_0xad67('0x18'))['db'];function respondWithStatusCode(_0x4a6036,_0x450acb){_0x450acb=_0x450acb||0xcc;return function(_0x163a19){if(_0x163a19){return _0x4a6036['sendStatus'](_0x450acb);}return _0x4a6036[_0xad67('0x19')](_0x450acb)['end']();};}function respondWithResult(_0x5e8eb4,_0x29ca03){_0x29ca03=_0x29ca03||0xc8;return function(_0x565215){if(_0x565215){return _0x5e8eb4['status'](_0x29ca03)[_0xad67('0x1a')](_0x565215);}};}function respondWithFilteredResult(_0x2b4d0e,_0x2836fd){return function(_0x3c5d50){if(_0x3c5d50){var _0x41a5d6=typeof _0x2836fd[_0xad67('0x1b')]==='undefined'&&typeof _0x2836fd[_0xad67('0x1c')]===_0xad67('0x1d');var _0x5d1389=_0x3c5d50[_0xad67('0x1e')];var _0x363cef=_0x41a5d6?0x0:_0x2836fd[_0xad67('0x1b')];var _0x253f1e=_0x41a5d6?_0x3c5d50[_0xad67('0x1e')]:_0x2836fd['offset']+_0x2836fd[_0xad67('0x1c')];var _0x2fbfda;if(_0x253f1e>=_0x5d1389){_0x253f1e=_0x5d1389;_0x2fbfda=0xc8;}else{_0x2fbfda=0xce;}_0x2b4d0e['status'](_0x2fbfda);return _0x2b4d0e[_0xad67('0x1f')](_0xad67('0x20'),_0x363cef+'-'+_0x253f1e+'/'+_0x5d1389)['json'](_0x3c5d50);}return null;};}function patchUpdates(_0x561a79){return function(_0x1849a1){try{jsonpatch['apply'](_0x1849a1,_0x561a79,!![]);}catch(_0x5a9d1a){return BPromise['reject'](_0x5a9d1a);}return _0x1849a1[_0xad67('0x21')]();};}function saveUpdates(_0x1c55d2,_0x4feb72){return function(_0x337be4){if(_0x337be4){return _0x337be4[_0xad67('0x22')](_0x1c55d2)[_0xad67('0x23')](function(_0x47925f){return _0x47925f;});}return null;};}function removeEntity(_0x40d964,_0x205a5f){return function(_0x5bfcfb){if(_0x5bfcfb){return _0x5bfcfb[_0xad67('0x24')]()[_0xad67('0x23')](function(){_0x40d964['status'](0xcc)[_0xad67('0x25')]();});}};}function handleEntityNotFound(_0x411809,_0x3ae24c){return function(_0x4ac074){if(!_0x4ac074){_0x411809[_0xad67('0x26')](0x194);}return _0x4ac074;};}function handleError(_0x494425,_0x313338){_0x313338=_0x313338||0x1f4;return function(_0x1ca30e){logger[_0xad67('0x27')](_0x1ca30e['stack']);if(_0x1ca30e['name']){delete _0x1ca30e[_0xad67('0x28')];}_0x494425[_0xad67('0x19')](_0x313338)[_0xad67('0x29')](_0x1ca30e);};}exports[_0xad67('0x2a')]=function(_0xb294cb,_0x4eb9e0){var _0x4ec31e={},_0x18e041={},_0x51bf3c={'count':0x0,'rows':[]};var _0xe79440=_[_0xad67('0x2b')](db[_0xad67('0x2c')][_0xad67('0x2d')],function(_0x190bb1){return{'name':_0x190bb1[_0xad67('0x2e')],'type':_0x190bb1[_0xad67('0x2f')][_0xad67('0x30')]};});_0x18e041[_0xad67('0x31')]=_['map'](_0xe79440,_0xad67('0x28'));_0x18e041[_0xad67('0x32')]=_[_0xad67('0x33')](_0xb294cb[_0xad67('0x32')]);_0x18e041[_0xad67('0x34')]=_[_0xad67('0x35')](_0x18e041[_0xad67('0x31')],_0x18e041['query']);_0x4ec31e['attributes']=_['intersection'](_0x18e041[_0xad67('0x31')],qs[_0xad67('0x36')](_0xb294cb[_0xad67('0x32')]['fields']));_0x4ec31e[_0xad67('0x37')]=_0x4ec31e[_0xad67('0x37')][_0xad67('0x38')]?_0x4ec31e[_0xad67('0x37')]:_0x18e041['model'];if(!_0xb294cb[_0xad67('0x32')][_0xad67('0x39')](_0xad67('0x3a'))){_0x4ec31e[_0xad67('0x1c')]=qs[_0xad67('0x1c')](_0xb294cb[_0xad67('0x32')][_0xad67('0x1c')]);_0x4ec31e[_0xad67('0x1b')]=qs[_0xad67('0x1b')](_0xb294cb[_0xad67('0x32')]['offset']);}_0x4ec31e['order']=qs[_0xad67('0x3b')](_0xb294cb[_0xad67('0x32')][_0xad67('0x3b')]);_0x4ec31e[_0xad67('0x3c')]=qs[_0xad67('0x34')](_[_0xad67('0x3d')](_0xb294cb[_0xad67('0x32')],_0x18e041['filters']),_0xe79440);if(_0xb294cb['query'][_0xad67('0x3e')]){_0x4ec31e[_0xad67('0x3c')]=_[_0xad67('0x3f')](_0x4ec31e[_0xad67('0x3c')],{'$or':_[_0xad67('0x2b')](_0xe79440,function(_0x12c2c3){if(_0x12c2c3[_0xad67('0x2f')]!==_0xad67('0x40')){var _0x8cda07={};_0x8cda07[_0x12c2c3[_0xad67('0x28')]]={'$like':'%'+_0xb294cb[_0xad67('0x32')][_0xad67('0x3e')]+'%'};return _0x8cda07;}})});}_0x4ec31e=_[_0xad67('0x3f')]({},_0x4ec31e,_0xb294cb[_0xad67('0x41')]);var _0x5436a3={'where':_0x4ec31e[_0xad67('0x3c')]};return db[_0xad67('0x2c')][_0xad67('0x1e')](_0x5436a3)['then'](function(_0xb8ae99){_0x51bf3c[_0xad67('0x1e')]=_0xb8ae99;if(_0xb294cb['query'][_0xad67('0x42')]){_0x4ec31e[_0xad67('0x43')]=[{'all':!![]}];}return db[_0xad67('0x2c')][_0xad67('0x44')](_0x4ec31e);})[_0xad67('0x23')](function(_0x47458d){_0x51bf3c['rows']=_0x47458d;return _0x51bf3c;})['then'](respondWithFilteredResult(_0x4eb9e0,_0x4ec31e))['catch'](handleError(_0x4eb9e0,null));};exports[_0xad67('0x45')]=function(_0x37a1b6,_0x3d1933){var _0x4a6e4b={'raw':![],'where':{'id':_0x37a1b6[_0xad67('0x46')]['id']}},_0x3077a5={};_0x3077a5['model']=_['keys'](db[_0xad67('0x2c')][_0xad67('0x2d')]);_0x3077a5[_0xad67('0x32')]=_[_0xad67('0x33')](_0x37a1b6[_0xad67('0x32')]);_0x3077a5['filters']=_[_0xad67('0x35')](_0x3077a5[_0xad67('0x31')],_0x3077a5[_0xad67('0x32')]);_0x4a6e4b['attributes']=_['intersection'](_0x3077a5[_0xad67('0x31')],qs[_0xad67('0x36')](_0x37a1b6[_0xad67('0x32')][_0xad67('0x36')]));_0x4a6e4b[_0xad67('0x37')]=_0x4a6e4b[_0xad67('0x37')][_0xad67('0x38')]?_0x4a6e4b[_0xad67('0x37')]:_0x3077a5[_0xad67('0x31')];if(_0x37a1b6[_0xad67('0x32')]['includeAll']){_0x4a6e4b[_0xad67('0x43')]=[{'all':!![]}];}_0x4a6e4b=_[_0xad67('0x3f')]({},_0x4a6e4b,_0x37a1b6['options']);return db[_0xad67('0x2c')][_0xad67('0x47')](_0x4a6e4b)[_0xad67('0x23')](handleEntityNotFound(_0x3d1933,null))[_0xad67('0x23')](respondWithResult(_0x3d1933,null))[_0xad67('0x48')](handleError(_0x3d1933,null));};exports[_0xad67('0x49')]=function(_0x264a4e,_0x1d6c1b){return db[_0xad67('0x2c')][_0xad67('0x49')](_0x264a4e[_0xad67('0x4a')],{})[_0xad67('0x23')](respondWithResult(_0x1d6c1b,0xc9))['catch'](handleError(_0x1d6c1b,null));};exports[_0xad67('0x22')]=function(_0x45512d,_0xd64fac){if(_0x45512d[_0xad67('0x4a')]['id']){delete _0x45512d['body']['id'];}return db[_0xad67('0x2c')][_0xad67('0x47')]({'where':{'id':_0x45512d['params']['id']}})[_0xad67('0x23')](handleEntityNotFound(_0xd64fac,null))['then'](saveUpdates(_0x45512d[_0xad67('0x4a')],null))[_0xad67('0x23')](respondWithResult(_0xd64fac,null))[_0xad67('0x48')](handleError(_0xd64fac,null));};exports[_0xad67('0x24')]=function(_0x12ffee,_0x34d3f2){return db[_0xad67('0x2c')][_0xad67('0x47')]({'where':{'id':_0x12ffee[_0xad67('0x46')]['id']}})[_0xad67('0x23')](handleEntityNotFound(_0x34d3f2,null))[_0xad67('0x23')](removeEntity(_0x34d3f2,null))[_0xad67('0x48')](handleError(_0x34d3f2,null));};exports[_0xad67('0x4b')]=function(_0x51fcd6,_0x3e859a,_0x195f30){var _0xf0b109={};var _0x322b9d={};var _0x6c1426;var _0x412c2d;return db[_0xad67('0x2c')][_0xad67('0x4c')]({'where':{'id':_0x51fcd6[_0xad67('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e859a,null))[_0xad67('0x23')](function(_0x5ae0aa){if(_0x5ae0aa){_0x6c1426=_0x5ae0aa;_0x322b9d[_0xad67('0x31')]=_[_0xad67('0x33')](db['FreshdeskField']['rawAttributes']);_0x322b9d['query']=_[_0xad67('0x33')](_0x51fcd6[_0xad67('0x32')]);_0x322b9d[_0xad67('0x34')]=_['intersection'](_0x322b9d[_0xad67('0x31')],_0x322b9d[_0xad67('0x32')]);_0xf0b109[_0xad67('0x37')]=_[_0xad67('0x35')](_0x322b9d['model'],qs[_0xad67('0x36')](_0x51fcd6[_0xad67('0x32')][_0xad67('0x36')]));_0xf0b109['attributes']=_0xf0b109[_0xad67('0x37')][_0xad67('0x38')]?_0xf0b109[_0xad67('0x37')]:_0x322b9d[_0xad67('0x31')];_0xf0b109['order']=qs[_0xad67('0x3b')](_0x51fcd6[_0xad67('0x32')]['sort']);_0xf0b109[_0xad67('0x3c')]=qs[_0xad67('0x34')](_['pick'](_0x51fcd6[_0xad67('0x32')],_0x322b9d[_0xad67('0x34')]));if(_0x51fcd6[_0xad67('0x32')][_0xad67('0x3e')]){_0xf0b109[_0xad67('0x3c')]=_[_0xad67('0x3f')](_0xf0b109['where'],{'$or':_[_0xad67('0x2b')](_0xf0b109['attributes'],function(_0x1f33ee){var _0x247090={};_0x247090[_0x1f33ee]={'$like':'%'+_0x51fcd6[_0xad67('0x32')][_0xad67('0x3e')]+'%'};return _0x247090;})});}_0xf0b109=_['merge']({},_0xf0b109,_0x51fcd6[_0xad67('0x41')]);return _0x6c1426[_0xad67('0x4b')](_0xf0b109);}})[_0xad67('0x23')](function(_0x914658){if(_0x914658){_0x412c2d=_0x914658[_0xad67('0x38')];if(!_0x51fcd6[_0xad67('0x32')][_0xad67('0x39')]('nolimit')){_0xf0b109[_0xad67('0x1c')]=qs[_0xad67('0x1c')](_0x51fcd6[_0xad67('0x32')][_0xad67('0x1c')]);_0xf0b109['offset']=qs[_0xad67('0x1b')](_0x51fcd6[_0xad67('0x32')][_0xad67('0x1b')]);}return _0x6c1426[_0xad67('0x4b')](_0xf0b109);}})[_0xad67('0x23')](function(_0x5658f1){if(_0x5658f1){return _0x5658f1?{'count':_0x412c2d,'rows':_0x5658f1}:null;}})[_0xad67('0x23')](respondWithResult(_0x3e859a,null))[_0xad67('0x48')](handleError(_0x3e859a,null));};exports[_0xad67('0x4d')]=function(_0x267be1,_0x54a2f0,_0x219983){var _0x7b393d={};var _0x4f1c27={};var _0x39c685;var _0xed9d9e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x267be1[_0xad67('0x46')]['id']}})['then'](handleEntityNotFound(_0x54a2f0,null))[_0xad67('0x23')](function(_0x28625d){if(_0x28625d){_0x39c685=_0x28625d;_0x4f1c27[_0xad67('0x31')]=_[_0xad67('0x33')](db[_0xad67('0x4e')][_0xad67('0x2d')]);_0x4f1c27['query']=_[_0xad67('0x33')](_0x267be1[_0xad67('0x32')]);_0x4f1c27[_0xad67('0x34')]=_['intersection'](_0x4f1c27['model'],_0x4f1c27['query']);_0x7b393d[_0xad67('0x37')]=_[_0xad67('0x35')](_0x4f1c27['model'],qs[_0xad67('0x36')](_0x267be1[_0xad67('0x32')][_0xad67('0x36')]));_0x7b393d[_0xad67('0x37')]=_0x7b393d[_0xad67('0x37')][_0xad67('0x38')]?_0x7b393d[_0xad67('0x37')]:_0x4f1c27[_0xad67('0x31')];_0x7b393d['order']=qs[_0xad67('0x3b')](_0x267be1[_0xad67('0x32')][_0xad67('0x3b')]);_0x7b393d[_0xad67('0x3c')]=qs['filters'](_['pick'](_0x267be1[_0xad67('0x32')],_0x4f1c27[_0xad67('0x34')]));if(_0x267be1[_0xad67('0x32')][_0xad67('0x3e')]){_0x7b393d[_0xad67('0x3c')]=_['merge'](_0x7b393d[_0xad67('0x3c')],{'$or':_[_0xad67('0x2b')](_0x7b393d[_0xad67('0x37')],function(_0x242849){var _0x468047={};_0x468047[_0x242849]={'$like':'%'+_0x267be1[_0xad67('0x32')][_0xad67('0x3e')]+'%'};return _0x468047;})});}_0x7b393d=_['merge']({},_0x7b393d,_0x267be1['options']);return _0x39c685[_0xad67('0x4d')](_0x7b393d);}})[_0xad67('0x23')](function(_0x460863){if(_0x460863){_0xed9d9e=_0x460863['length'];if(!_0x267be1[_0xad67('0x32')][_0xad67('0x39')](_0xad67('0x3a'))){_0x7b393d[_0xad67('0x1c')]=qs[_0xad67('0x1c')](_0x267be1['query'][_0xad67('0x1c')]);_0x7b393d[_0xad67('0x1b')]=qs[_0xad67('0x1b')](_0x267be1[_0xad67('0x32')][_0xad67('0x1b')]);}return _0x39c685[_0xad67('0x4d')](_0x7b393d);}})['then'](function(_0xe57043){if(_0xe57043){return _0xe57043?{'count':_0xed9d9e,'rows':_0xe57043}:null;}})['then'](respondWithResult(_0x54a2f0,null))['catch'](handleError(_0x54a2f0,null));};exports[_0xad67('0x4f')]=function(_0x59a2b1,_0xf6fcf7,_0x4b9fb3){var _0x4096ea={};var _0xcb7c5a={};var _0x442403;var _0x4c2a11;return db[_0xad67('0x2c')][_0xad67('0x4c')]({'where':{'id':_0x59a2b1[_0xad67('0x46')]['id']}})['then'](handleEntityNotFound(_0xf6fcf7,null))[_0xad67('0x23')](function(_0x1a971e){if(_0x1a971e){_0x442403=_0x1a971e;_0xcb7c5a['model']=_['keys'](db[_0xad67('0x4e')][_0xad67('0x2d')]);_0xcb7c5a[_0xad67('0x32')]=_[_0xad67('0x33')](_0x59a2b1[_0xad67('0x32')]);_0xcb7c5a['filters']=_[_0xad67('0x35')](_0xcb7c5a[_0xad67('0x31')],_0xcb7c5a[_0xad67('0x32')]);_0x4096ea[_0xad67('0x37')]=_[_0xad67('0x35')](_0xcb7c5a['model'],qs[_0xad67('0x36')](_0x59a2b1[_0xad67('0x32')][_0xad67('0x36')]));_0x4096ea[_0xad67('0x37')]=_0x4096ea[_0xad67('0x37')][_0xad67('0x38')]?_0x4096ea['attributes']:_0xcb7c5a[_0xad67('0x31')];_0x4096ea['order']=qs[_0xad67('0x3b')](_0x59a2b1[_0xad67('0x32')]['sort']);_0x4096ea[_0xad67('0x3c')]=qs['filters'](_[_0xad67('0x3d')](_0x59a2b1['query'],_0xcb7c5a[_0xad67('0x34')]));if(_0x59a2b1[_0xad67('0x32')][_0xad67('0x3e')]){_0x4096ea[_0xad67('0x3c')]=_[_0xad67('0x3f')](_0x4096ea[_0xad67('0x3c')],{'$or':_[_0xad67('0x2b')](_0x4096ea[_0xad67('0x37')],function(_0x1d514a){var _0x14cbda={};_0x14cbda[_0x1d514a]={'$like':'%'+_0x59a2b1[_0xad67('0x32')][_0xad67('0x3e')]+'%'};return _0x14cbda;})});}_0x4096ea=_[_0xad67('0x3f')]({},_0x4096ea,_0x59a2b1[_0xad67('0x41')]);return _0x442403[_0xad67('0x4f')](_0x4096ea);}})[_0xad67('0x23')](function(_0x12ff66){if(_0x12ff66){_0x4c2a11=_0x12ff66[_0xad67('0x38')];if(!_0x59a2b1[_0xad67('0x32')][_0xad67('0x39')](_0xad67('0x3a'))){_0x4096ea[_0xad67('0x1c')]=qs[_0xad67('0x1c')](_0x59a2b1[_0xad67('0x32')]['limit']);_0x4096ea[_0xad67('0x1b')]=qs[_0xad67('0x1b')](_0x59a2b1[_0xad67('0x32')][_0xad67('0x1b')]);}return _0x442403[_0xad67('0x4f')](_0x4096ea);}})[_0xad67('0x23')](function(_0x58add1){if(_0x58add1){return _0x58add1?{'count':_0x4c2a11,'rows':_0x58add1}:null;}})['then'](respondWithResult(_0xf6fcf7,null))[_0xad67('0x48')](handleError(_0xf6fcf7,null));};exports['getTags']=function(_0x23f763,_0x82c8ab,_0x49c9ee){var _0x456093={};var _0x41096a={};var _0x3a5e93;var _0x631b08;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x23f763[_0xad67('0x46')]['id']}})[_0xad67('0x23')](handleEntityNotFound(_0x82c8ab,null))[_0xad67('0x23')](function(_0x1a74c9){if(_0x1a74c9){_0x3a5e93=_0x1a74c9;_0x41096a[_0xad67('0x31')]=_[_0xad67('0x33')](db[_0xad67('0x50')][_0xad67('0x2d')]);_0x41096a[_0xad67('0x32')]=_[_0xad67('0x33')](_0x23f763[_0xad67('0x32')]);_0x41096a[_0xad67('0x34')]=_[_0xad67('0x35')](_0x41096a['model'],_0x41096a[_0xad67('0x32')]);_0x456093[_0xad67('0x37')]=_[_0xad67('0x35')](_0x41096a['model'],qs[_0xad67('0x36')](_0x23f763[_0xad67('0x32')][_0xad67('0x36')]));_0x456093[_0xad67('0x37')]=_0x456093['attributes'][_0xad67('0x38')]?_0x456093[_0xad67('0x37')]:_0x41096a[_0xad67('0x31')];_0x456093[_0xad67('0x51')]=qs[_0xad67('0x3b')](_0x23f763[_0xad67('0x32')]['sort']);_0x456093['where']=qs[_0xad67('0x34')](_[_0xad67('0x3d')](_0x23f763[_0xad67('0x32')],_0x41096a[_0xad67('0x34')]));if(_0x23f763[_0xad67('0x32')][_0xad67('0x3e')]){_0x456093[_0xad67('0x3c')]=_[_0xad67('0x3f')](_0x456093['where'],{'$or':_['map'](_0x456093[_0xad67('0x37')],function(_0x227bc0){var _0x594801={};_0x594801[_0x227bc0]={'$like':'%'+_0x23f763[_0xad67('0x32')][_0xad67('0x3e')]+'%'};return _0x594801;})});}_0x456093=_[_0xad67('0x3f')]({},_0x456093,_0x23f763['options']);return _0x3a5e93[_0xad67('0x52')](_0x456093);}})[_0xad67('0x23')](function(_0x43cc59){if(_0x43cc59){_0x631b08=_0x43cc59[_0xad67('0x38')];if(!_0x23f763[_0xad67('0x32')][_0xad67('0x39')](_0xad67('0x3a'))){_0x456093[_0xad67('0x1c')]=qs[_0xad67('0x1c')](_0x23f763['query'][_0xad67('0x1c')]);_0x456093[_0xad67('0x1b')]=qs[_0xad67('0x1b')](_0x23f763[_0xad67('0x32')][_0xad67('0x1b')]);}return _0x3a5e93['getTags'](_0x456093);}})[_0xad67('0x23')](function(_0x3ba534){if(_0x3ba534){return _0x3ba534?{'count':_0x631b08,'rows':_0x3ba534}:null;}})[_0xad67('0x23')](respondWithResult(_0x82c8ab,null))[_0xad67('0x48')](handleError(_0x82c8ab,null));};exports[_0xad67('0x53')]=function(_0x533429,_0x4f48fc,_0x473a8d){if(_0x533429[_0xad67('0x4a')]['id']){delete _0x533429[_0xad67('0x4a')]['id'];}return db[_0xad67('0x2c')][_0xad67('0x4c')]({'where':{'id':_0x533429['params']['id']}})[_0xad67('0x23')](handleEntityNotFound(_0x4f48fc,null))[_0xad67('0x23')](function(_0x50c174){if(_0x50c174){return _0x50c174[_0xad67('0x53')](_0x533429['body'][_0xad67('0x54')]||[]);}return null;})['then'](respondWithResult(_0x4f48fc,null))['catch'](handleError(_0x4f48fc,null));}; \ No newline at end of file +var _0x9e36=['status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','pick','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5b95ec,_0x16e0d0){var _0x2af647=function(_0x4f7a18){while(--_0x4f7a18){_0x5b95ec['push'](_0x5b95ec['shift']());}};_0x2af647(++_0x16e0d0);}(_0x9e36,0x91));var _0x69e3=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0x9e36[_0x307d2b];return _0xe82587;};'use strict';var emlformat=require(_0x69e3('0x0'));var rimraf=require(_0x69e3('0x1'));var zipdir=require(_0x69e3('0x2'));var jsonpatch=require(_0x69e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x69e3('0x4'));var util=require(_0x69e3('0x5'));var path=require(_0x69e3('0x6'));var sox=require(_0x69e3('0x7'));var csv=require(_0x69e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69e3('0x9'));var _=require(_0x69e3('0xa'));var squel=require(_0x69e3('0xb'));var crypto=require(_0x69e3('0xc'));var jsforce=require(_0x69e3('0xd'));var deskjs=require(_0x69e3('0xe'));var toCsv=require(_0x69e3('0x8'));var querystring=require(_0x69e3('0xf'));var Papa=require(_0x69e3('0x10'));var Redis=require(_0x69e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69e3('0x12'));var as=require(_0x69e3('0x13'));var hardwareService=require(_0x69e3('0x14'));var logger=require(_0x69e3('0x15'))(_0x69e3('0x16'));var utils=require(_0x69e3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x69e3('0x18'));var db=require(_0x69e3('0x19'))['db'];function respondWithStatusCode(_0x5b23b4,_0x3278e8){_0x3278e8=_0x3278e8||0xcc;return function(_0x13060a){if(_0x13060a){return _0x5b23b4[_0x69e3('0x1a')](_0x3278e8);}return _0x5b23b4[_0x69e3('0x1b')](_0x3278e8)[_0x69e3('0x1c')]();};}function respondWithResult(_0x1c3fca,_0xfd9ce1){_0xfd9ce1=_0xfd9ce1||0xc8;return function(_0x537757){if(_0x537757){return _0x1c3fca['status'](_0xfd9ce1)['json'](_0x537757);}};}function respondWithFilteredResult(_0x531deb,_0x58ed27){return function(_0x555da3){if(_0x555da3){var _0x2954e9=typeof _0x58ed27[_0x69e3('0x1d')]==='undefined'&&typeof _0x58ed27['limit']===_0x69e3('0x1e');var _0x186344=_0x555da3[_0x69e3('0x1f')];var _0x2c69ae=_0x2954e9?0x0:_0x58ed27[_0x69e3('0x1d')];var _0x1576f9=_0x2954e9?_0x555da3[_0x69e3('0x1f')]:_0x58ed27[_0x69e3('0x1d')]+_0x58ed27[_0x69e3('0x20')];var _0x102ee8;if(_0x1576f9>=_0x186344){_0x1576f9=_0x186344;_0x102ee8=0xc8;}else{_0x102ee8=0xce;}_0x531deb['status'](_0x102ee8);return _0x531deb['set'](_0x69e3('0x21'),_0x2c69ae+'-'+_0x1576f9+'/'+_0x186344)[_0x69e3('0x22')](_0x555da3);}return null;};}function patchUpdates(_0x5557b0){return function(_0x5f57d1){try{jsonpatch[_0x69e3('0x23')](_0x5f57d1,_0x5557b0,!![]);}catch(_0x1cfcba){return BPromise['reject'](_0x1cfcba);}return _0x5f57d1[_0x69e3('0x24')]();};}function saveUpdates(_0x21c016,_0x248cb8){return function(_0x1284ad){if(_0x1284ad){return _0x1284ad[_0x69e3('0x25')](_0x21c016)[_0x69e3('0x26')](function(_0x129210){return _0x129210;});}return null;};}function removeEntity(_0x1fc16c,_0x4620a9){return function(_0x3d236c){if(_0x3d236c){return _0x3d236c[_0x69e3('0x27')]()[_0x69e3('0x26')](function(){_0x1fc16c['status'](0xcc)[_0x69e3('0x1c')]();});}};}function handleEntityNotFound(_0x326e33,_0x28679f){return function(_0x14c795){if(!_0x14c795){_0x326e33[_0x69e3('0x1a')](0x194);}return _0x14c795;};}function handleError(_0x2f2d7e,_0x4276d3){_0x4276d3=_0x4276d3||0x1f4;return function(_0x33c283){logger[_0x69e3('0x28')](_0x33c283[_0x69e3('0x29')]);if(_0x33c283[_0x69e3('0x2a')]){delete _0x33c283[_0x69e3('0x2a')];}_0x2f2d7e['status'](_0x4276d3)[_0x69e3('0x2b')](_0x33c283);};}exports[_0x69e3('0x2c')]=function(_0x293c39,_0x202d4b){var _0x279260={},_0x303213={},_0x3bfcd6={'count':0x0,'rows':[]};var _0x8313fc=_[_0x69e3('0x2d')](db[_0x69e3('0x2e')][_0x69e3('0x2f')],function(_0x1f935b){return{'name':_0x1f935b[_0x69e3('0x30')],'type':_0x1f935b[_0x69e3('0x31')][_0x69e3('0x32')]};});_0x303213['model']=_[_0x69e3('0x2d')](_0x8313fc,_0x69e3('0x2a'));_0x303213[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x293c39['query']);_0x303213[_0x69e3('0x35')]=_['intersection'](_0x303213[_0x69e3('0x36')],_0x303213['query']);_0x279260[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x303213[_0x69e3('0x36')],qs['fields'](_0x293c39[_0x69e3('0x33')][_0x69e3('0x39')]));_0x279260[_0x69e3('0x37')]=_0x279260['attributes'][_0x69e3('0x3a')]?_0x279260[_0x69e3('0x37')]:_0x303213[_0x69e3('0x36')];if(!_0x293c39['query'][_0x69e3('0x3b')]('nolimit')){_0x279260[_0x69e3('0x20')]=qs['limit'](_0x293c39[_0x69e3('0x33')][_0x69e3('0x20')]);_0x279260[_0x69e3('0x1d')]=qs['offset'](_0x293c39[_0x69e3('0x33')]['offset']);}_0x279260['order']=qs[_0x69e3('0x3c')](_0x293c39[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x279260[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x293c39[_0x69e3('0x33')],_0x303213['filters']),_0x8313fc);if(_0x293c39['query'][_0x69e3('0x3e')]){_0x279260['where']=_[_0x69e3('0x3f')](_0x279260[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x8313fc,function(_0x1962e0){if(_0x1962e0['type']!=='VIRTUAL'){var _0xa0ab16={};_0xa0ab16[_0x1962e0[_0x69e3('0x2a')]]={'$like':'%'+_0x293c39[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0xa0ab16;}})});}_0x279260=_['merge']({},_0x279260,_0x293c39[_0x69e3('0x40')]);var _0x4cc1cb={'where':_0x279260[_0x69e3('0x3d')]};return db[_0x69e3('0x2e')][_0x69e3('0x1f')](_0x4cc1cb)['then'](function(_0x380ac9){_0x3bfcd6['count']=_0x380ac9;if(_0x293c39[_0x69e3('0x33')][_0x69e3('0x41')]){_0x279260[_0x69e3('0x42')]=[{'all':!![]}];}return db[_0x69e3('0x2e')][_0x69e3('0x43')](_0x279260);})[_0x69e3('0x26')](function(_0x87e35a){_0x3bfcd6['rows']=_0x87e35a;return _0x3bfcd6;})['then'](respondWithFilteredResult(_0x202d4b,_0x279260))['catch'](handleError(_0x202d4b,null));};exports[_0x69e3('0x44')]=function(_0x975845,_0x1a72b0){var _0x1d1f11={'raw':![],'where':{'id':_0x975845[_0x69e3('0x45')]['id']}},_0xe7bab1={};_0xe7bab1[_0x69e3('0x36')]=_['keys'](db[_0x69e3('0x2e')][_0x69e3('0x2f')]);_0xe7bab1[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x975845[_0x69e3('0x33')]);_0xe7bab1[_0x69e3('0x35')]=_['intersection'](_0xe7bab1[_0x69e3('0x36')],_0xe7bab1[_0x69e3('0x33')]);_0x1d1f11['attributes']=_[_0x69e3('0x38')](_0xe7bab1['model'],qs['fields'](_0x975845[_0x69e3('0x33')]['fields']));_0x1d1f11['attributes']=_0x1d1f11[_0x69e3('0x37')]['length']?_0x1d1f11[_0x69e3('0x37')]:_0xe7bab1[_0x69e3('0x36')];if(_0x975845['query']['includeAll']){_0x1d1f11['include']=[{'all':!![]}];}_0x1d1f11=_[_0x69e3('0x3f')]({},_0x1d1f11,_0x975845[_0x69e3('0x40')]);return db[_0x69e3('0x2e')][_0x69e3('0x46')](_0x1d1f11)[_0x69e3('0x26')](handleEntityNotFound(_0x1a72b0,null))[_0x69e3('0x26')](respondWithResult(_0x1a72b0,null))[_0x69e3('0x47')](handleError(_0x1a72b0,null));};exports['create']=function(_0x48a6cd,_0x5499aa){return db[_0x69e3('0x2e')][_0x69e3('0x48')](_0x48a6cd[_0x69e3('0x49')],{})[_0x69e3('0x26')](respondWithResult(_0x5499aa,0xc9))[_0x69e3('0x47')](handleError(_0x5499aa,null));};exports[_0x69e3('0x25')]=function(_0x2890d9,_0x39e248){if(_0x2890d9[_0x69e3('0x49')]['id']){delete _0x2890d9['body']['id'];}return db['FreshdeskConfiguration'][_0x69e3('0x46')]({'where':{'id':_0x2890d9[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x39e248,null))[_0x69e3('0x26')](saveUpdates(_0x2890d9[_0x69e3('0x49')],null))[_0x69e3('0x26')](respondWithResult(_0x39e248,null))['catch'](handleError(_0x39e248,null));};exports[_0x69e3('0x27')]=function(_0x1e6690,_0x478b40){return db[_0x69e3('0x2e')][_0x69e3('0x46')]({'where':{'id':_0x1e6690[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x478b40,null))[_0x69e3('0x26')](removeEntity(_0x478b40,null))[_0x69e3('0x47')](handleError(_0x478b40,null));};exports[_0x69e3('0x4a')]=function(_0x44e753,_0x4d6b13,_0x486e8f){var _0x146cd={};var _0xa5d855={};var _0x40edac;var _0xc7f693;return db['FreshdeskConfiguration'][_0x69e3('0x4b')]({'where':{'id':_0x44e753['params']['id']}})['then'](handleEntityNotFound(_0x4d6b13,null))[_0x69e3('0x26')](function(_0x50e4ed){if(_0x50e4ed){_0x40edac=_0x50e4ed;_0xa5d855[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x4c')][_0x69e3('0x2f')]);_0xa5d855['query']=_[_0x69e3('0x34')](_0x44e753[_0x69e3('0x33')]);_0xa5d855[_0x69e3('0x35')]=_['intersection'](_0xa5d855[_0x69e3('0x36')],_0xa5d855[_0x69e3('0x33')]);_0x146cd['attributes']=_['intersection'](_0xa5d855[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x44e753[_0x69e3('0x33')][_0x69e3('0x39')]));_0x146cd[_0x69e3('0x37')]=_0x146cd['attributes']['length']?_0x146cd[_0x69e3('0x37')]:_0xa5d855[_0x69e3('0x36')];_0x146cd['order']=qs['sort'](_0x44e753['query'][_0x69e3('0x3c')]);_0x146cd[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x44e753['query'],_0xa5d855[_0x69e3('0x35')]));if(_0x44e753[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x146cd[_0x69e3('0x3d')]=_[_0x69e3('0x3f')](_0x146cd[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x146cd[_0x69e3('0x37')],function(_0x10c3d0){var _0x51075d={};_0x51075d[_0x10c3d0]={'$like':'%'+_0x44e753['query'][_0x69e3('0x3e')]+'%'};return _0x51075d;})});}_0x146cd=_['merge']({},_0x146cd,_0x44e753['options']);return _0x40edac[_0x69e3('0x4a')](_0x146cd);}})[_0x69e3('0x26')](function(_0x91250e){if(_0x91250e){_0xc7f693=_0x91250e[_0x69e3('0x3a')];if(!_0x44e753[_0x69e3('0x33')]['hasOwnProperty'](_0x69e3('0x4d'))){_0x146cd[_0x69e3('0x20')]=qs['limit'](_0x44e753[_0x69e3('0x33')][_0x69e3('0x20')]);_0x146cd[_0x69e3('0x1d')]=qs[_0x69e3('0x1d')](_0x44e753[_0x69e3('0x33')]['offset']);}return _0x40edac['getFields'](_0x146cd);}})[_0x69e3('0x26')](function(_0x110cca){if(_0x110cca){return _0x110cca?{'count':_0xc7f693,'rows':_0x110cca}:null;}})[_0x69e3('0x26')](respondWithResult(_0x4d6b13,null))[_0x69e3('0x47')](handleError(_0x4d6b13,null));};exports[_0x69e3('0x4e')]=function(_0x218eaf,_0x35c2fa,_0x345c0b){var _0x4bbbfc={};var _0x5dbd1f={};var _0x5aaae7;var _0x281603;return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x218eaf[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x35c2fa,null))[_0x69e3('0x26')](function(_0x48f233){if(_0x48f233){_0x5aaae7=_0x48f233;_0x5dbd1f['model']=_[_0x69e3('0x34')](db[_0x69e3('0x4c')]['rawAttributes']);_0x5dbd1f['query']=_[_0x69e3('0x34')](_0x218eaf[_0x69e3('0x33')]);_0x5dbd1f[_0x69e3('0x35')]=_[_0x69e3('0x38')](_0x5dbd1f['model'],_0x5dbd1f['query']);_0x4bbbfc[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x5dbd1f[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x218eaf['query'][_0x69e3('0x39')]));_0x4bbbfc[_0x69e3('0x37')]=_0x4bbbfc[_0x69e3('0x37')]['length']?_0x4bbbfc[_0x69e3('0x37')]:_0x5dbd1f[_0x69e3('0x36')];_0x4bbbfc['order']=qs['sort'](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x4bbbfc['where']=qs[_0x69e3('0x35')](_[_0x69e3('0x4f')](_0x218eaf[_0x69e3('0x33')],_0x5dbd1f[_0x69e3('0x35')]));if(_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x4bbbfc['where']=_['merge'](_0x4bbbfc['where'],{'$or':_[_0x69e3('0x2d')](_0x4bbbfc[_0x69e3('0x37')],function(_0x5f5aa1){var _0x2d93c1={};_0x2d93c1[_0x5f5aa1]={'$like':'%'+_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0x2d93c1;})});}_0x4bbbfc=_[_0x69e3('0x3f')]({},_0x4bbbfc,_0x218eaf[_0x69e3('0x40')]);return _0x5aaae7[_0x69e3('0x4e')](_0x4bbbfc);}})[_0x69e3('0x26')](function(_0x2900cd){if(_0x2900cd){_0x281603=_0x2900cd[_0x69e3('0x3a')];if(!_0x218eaf[_0x69e3('0x33')][_0x69e3('0x3b')]('nolimit')){_0x4bbbfc[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x20')]);_0x4bbbfc[_0x69e3('0x1d')]=qs[_0x69e3('0x1d')](_0x218eaf[_0x69e3('0x33')][_0x69e3('0x1d')]);}return _0x5aaae7[_0x69e3('0x4e')](_0x4bbbfc);}})[_0x69e3('0x26')](function(_0x4a28ab){if(_0x4a28ab){return _0x4a28ab?{'count':_0x281603,'rows':_0x4a28ab}:null;}})[_0x69e3('0x26')](respondWithResult(_0x35c2fa,null))[_0x69e3('0x47')](handleError(_0x35c2fa,null));};exports['getDescriptions']=function(_0xf62682,_0x306071,_0xf3aee7){var _0x1db0ca={};var _0x1b9400={};var _0xad7490;var _0x49f88d;return db[_0x69e3('0x2e')]['findOne']({'where':{'id':_0xf62682[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x306071,null))[_0x69e3('0x26')](function(_0x11c72c){if(_0x11c72c){_0xad7490=_0x11c72c;_0x1b9400[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x4c')]['rawAttributes']);_0x1b9400[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0xf62682[_0x69e3('0x33')]);_0x1b9400[_0x69e3('0x35')]=_['intersection'](_0x1b9400[_0x69e3('0x36')],_0x1b9400[_0x69e3('0x33')]);_0x1db0ca[_0x69e3('0x37')]=_[_0x69e3('0x38')](_0x1b9400[_0x69e3('0x36')],qs['fields'](_0xf62682['query'][_0x69e3('0x39')]));_0x1db0ca[_0x69e3('0x37')]=_0x1db0ca[_0x69e3('0x37')][_0x69e3('0x3a')]?_0x1db0ca[_0x69e3('0x37')]:_0x1b9400['model'];_0x1db0ca[_0x69e3('0x50')]=qs[_0x69e3('0x3c')](_0xf62682['query'][_0x69e3('0x3c')]);_0x1db0ca[_0x69e3('0x3d')]=qs['filters'](_[_0x69e3('0x4f')](_0xf62682[_0x69e3('0x33')],_0x1b9400['filters']));if(_0xf62682[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x1db0ca[_0x69e3('0x3d')]=_['merge'](_0x1db0ca[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x1db0ca[_0x69e3('0x37')],function(_0x321056){var _0xc654d9={};_0xc654d9[_0x321056]={'$like':'%'+_0xf62682[_0x69e3('0x33')]['filter']+'%'};return _0xc654d9;})});}_0x1db0ca=_[_0x69e3('0x3f')]({},_0x1db0ca,_0xf62682[_0x69e3('0x40')]);return _0xad7490[_0x69e3('0x51')](_0x1db0ca);}})[_0x69e3('0x26')](function(_0x59f671){if(_0x59f671){_0x49f88d=_0x59f671[_0x69e3('0x3a')];if(!_0xf62682[_0x69e3('0x33')]['hasOwnProperty']('nolimit')){_0x1db0ca[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0xf62682['query'][_0x69e3('0x20')]);_0x1db0ca['offset']=qs[_0x69e3('0x1d')](_0xf62682[_0x69e3('0x33')][_0x69e3('0x1d')]);}return _0xad7490[_0x69e3('0x51')](_0x1db0ca);}})['then'](function(_0x4d5bb6){if(_0x4d5bb6){return _0x4d5bb6?{'count':_0x49f88d,'rows':_0x4d5bb6}:null;}})[_0x69e3('0x26')](respondWithResult(_0x306071,null))[_0x69e3('0x47')](handleError(_0x306071,null));};exports['getTags']=function(_0x4c30d2,_0xb8d853,_0x1b33d9){var _0x1aebec={};var _0xe37d62={};var _0x2ed37e;var _0x255cd2;return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x4c30d2[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0xb8d853,null))[_0x69e3('0x26')](function(_0x54e494){if(_0x54e494){_0x2ed37e=_0x54e494;_0xe37d62[_0x69e3('0x36')]=_[_0x69e3('0x34')](db[_0x69e3('0x52')][_0x69e3('0x2f')]);_0xe37d62[_0x69e3('0x33')]=_[_0x69e3('0x34')](_0x4c30d2['query']);_0xe37d62[_0x69e3('0x35')]=_['intersection'](_0xe37d62[_0x69e3('0x36')],_0xe37d62['query']);_0x1aebec[_0x69e3('0x37')]=_['intersection'](_0xe37d62[_0x69e3('0x36')],qs[_0x69e3('0x39')](_0x4c30d2[_0x69e3('0x33')]['fields']));_0x1aebec[_0x69e3('0x37')]=_0x1aebec[_0x69e3('0x37')][_0x69e3('0x3a')]?_0x1aebec[_0x69e3('0x37')]:_0xe37d62[_0x69e3('0x36')];_0x1aebec[_0x69e3('0x50')]=qs[_0x69e3('0x3c')](_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3c')]);_0x1aebec[_0x69e3('0x3d')]=qs[_0x69e3('0x35')](_['pick'](_0x4c30d2[_0x69e3('0x33')],_0xe37d62[_0x69e3('0x35')]));if(_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3e')]){_0x1aebec['where']=_[_0x69e3('0x3f')](_0x1aebec[_0x69e3('0x3d')],{'$or':_[_0x69e3('0x2d')](_0x1aebec[_0x69e3('0x37')],function(_0x1f54d3){var _0x4e7cbd={};_0x4e7cbd[_0x1f54d3]={'$like':'%'+_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x3e')]+'%'};return _0x4e7cbd;})});}_0x1aebec=_['merge']({},_0x1aebec,_0x4c30d2[_0x69e3('0x40')]);return _0x2ed37e['getTags'](_0x1aebec);}})[_0x69e3('0x26')](function(_0x9e7b7a){if(_0x9e7b7a){_0x255cd2=_0x9e7b7a[_0x69e3('0x3a')];if(!_0x4c30d2[_0x69e3('0x33')]['hasOwnProperty'](_0x69e3('0x4d'))){_0x1aebec[_0x69e3('0x20')]=qs[_0x69e3('0x20')](_0x4c30d2[_0x69e3('0x33')][_0x69e3('0x20')]);_0x1aebec['offset']=qs[_0x69e3('0x1d')](_0x4c30d2['query'][_0x69e3('0x1d')]);}return _0x2ed37e[_0x69e3('0x53')](_0x1aebec);}})[_0x69e3('0x26')](function(_0xcf4581){if(_0xcf4581){return _0xcf4581?{'count':_0x255cd2,'rows':_0xcf4581}:null;}})[_0x69e3('0x26')](respondWithResult(_0xb8d853,null))[_0x69e3('0x47')](handleError(_0xb8d853,null));};exports[_0x69e3('0x54')]=function(_0x13d3fc,_0x3374c7,_0x54001d){if(_0x13d3fc[_0x69e3('0x49')]['id']){delete _0x13d3fc['body']['id'];}return db[_0x69e3('0x2e')][_0x69e3('0x4b')]({'where':{'id':_0x13d3fc[_0x69e3('0x45')]['id']}})[_0x69e3('0x26')](handleEntityNotFound(_0x3374c7,null))['then'](function(_0x10db5f){if(_0x10db5f){return _0x10db5f[_0x69e3('0x54')](_0x13d3fc[_0x69e3('0x49')][_0x69e3('0x55')]||[]);}return null;})[_0x69e3('0x26')](respondWithResult(_0x3374c7,null))['catch'](handleError(_0x3374c7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bcef59a..8170c8c 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 _0x803f=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x4a1aa5,_0x2cfa38){var _0x28532b=function(_0x4b10ea){while(--_0x4b10ea){_0x4a1aa5['push'](_0x4a1aa5['shift']());}};_0x28532b(++_0x2cfa38);}(_0x803f,0x198));var _0xf803=function(_0x2882e7,_0x5e885f){_0x2882e7=_0x2882e7-0x0;var _0x75ef86=_0x803f[_0x2882e7];return _0x75ef86;};'use strict';var _=require(_0xf803('0x0'));var util=require(_0xf803('0x1'));var logger=require(_0xf803('0x2'))(_0xf803('0x3'));var moment=require('moment');var BPromise=require(_0xf803('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf803('0x5'));var rimraf=require(_0xf803('0x6'));var config=require(_0xf803('0x7'));var attributes=require(_0xf803('0x8'));module[_0xf803('0x9')]=function(_0x4d4309,_0x351b58){return _0x4d4309[_0xf803('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0xf803('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a59=['request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','api','moment'];(function(_0x52207b,_0x166990){var _0x1a2824=function(_0x20c589){while(--_0x20c589){_0x52207b['push'](_0x52207b['shift']());}};_0x1a2824(++_0x166990);}(_0x6a59,0xe3));var _0x96a5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x6a59[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x96a5('0x0'));var util=require(_0x96a5('0x1'));var logger=require('../../config/logger')(_0x96a5('0x2'));var moment=require(_0x96a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x96a5('0x4'));var fs=require('fs');var path=require(_0x96a5('0x5'));var rimraf=require(_0x96a5('0x6'));var config=require(_0x96a5('0x7'));var attributes=require(_0x96a5('0x8'));module['exports']=function(_0x19ec7e,_0x2e7965){return _0x19ec7e[_0x96a5('0x9')](_0x96a5('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 3f68b70..f84ab9f 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 _0xc481=['then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x294c88,_0x502342){var _0x4f436d=function(_0x207f7a){while(--_0x207f7a){_0x294c88['push'](_0x294c88['shift']());}};_0x4f436d(++_0x502342);}(_0xc481,0x6c));var _0x1c48=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0xc481[_0x306646];return _0x40bd8d;};'use strict';var _=require(_0x1c48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c48('0x1'));var rs=require(_0x1c48('0x2'));var fs=require('fs');var Redis=require(_0x1c48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c48('0x4'));var logger=require(_0x1c48('0x5'))(_0x1c48('0x6'));var config=require(_0x1c48('0x7'));var jayson=require(_0x1c48('0x8'));var client=jayson[_0x1c48('0x9')][_0x1c48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x471fee,_0x3affa8,_0x1192a6){return new BPromise(function(_0x27918d,_0x2761cb){return client[_0x1c48('0xb')](_0x471fee,_0x1192a6)[_0x1c48('0xc')](function(_0x1667c6){logger[_0x1c48('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3affa8,_0x1c48('0xe'));logger[_0x1c48('0xf')](_0x1c48('0x10'),_0x3affa8,_0x1c48('0xe'),JSON[_0x1c48('0x11')](_0x1667c6));if(_0x1667c6[_0x1c48('0x12')]){if(_0x1667c6[_0x1c48('0x12')][_0x1c48('0x13')]===0x1f4){logger[_0x1c48('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3affa8,_0x1667c6[_0x1c48('0x12')][_0x1c48('0x14')]);return _0x2761cb(_0x1667c6[_0x1c48('0x12')][_0x1c48('0x14')]);}logger[_0x1c48('0x12')](_0x1c48('0x15'),_0x3affa8,_0x1667c6['error'][_0x1c48('0x14')]);return _0x27918d(_0x1667c6[_0x1c48('0x12')][_0x1c48('0x14')]);}else{logger['info'](_0x1c48('0x15'),_0x3affa8,'request\x20sent');_0x27918d(_0x1667c6[_0x1c48('0x16')][_0x1c48('0x14')]);}})[_0x1c48('0x17')](function(_0x5b400f){logger[_0x1c48('0x12')](_0x1c48('0x15'),_0x3affa8,_0x5b400f);_0x2761cb(_0x5b400f);});});} \ No newline at end of file +var _0xcf26=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xcf26,0x16e));var _0x6cf2=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xcf26[_0x216d45];return _0xbaac0b;};'use strict';var _=require(_0x6cf2('0x0'));var util=require(_0x6cf2('0x1'));var moment=require(_0x6cf2('0x2'));var BPromise=require(_0x6cf2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cf2('0x4'));var db=require(_0x6cf2('0x5'))['db'];var utils=require(_0x6cf2('0x6'));var logger=require('../../config/logger')(_0x6cf2('0x7'));var config=require(_0x6cf2('0x8'));var jayson=require(_0x6cf2('0x9'));var client=jayson[_0x6cf2('0xa')][_0x6cf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b20c0,_0x244dbc,_0x1bf830){return new BPromise(function(_0x5577a2,_0x1f2449){return client['request'](_0x3b20c0,_0x1bf830)['then'](function(_0x19b22d){logger[_0x6cf2('0xc')](_0x6cf2('0xd'),_0x244dbc,_0x6cf2('0xe'));logger[_0x6cf2('0xf')](_0x6cf2('0x10'),_0x244dbc,'request\x20sent',JSON[_0x6cf2('0x11')](_0x19b22d));if(_0x19b22d[_0x6cf2('0x12')]){if(_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x13')]===0x1f4){logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);return _0x1f2449(_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);}logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0x19b22d[_0x6cf2('0x12')][_0x6cf2('0x14')]);return _0x5577a2(_0x19b22d['error'][_0x6cf2('0x14')]);}else{logger[_0x6cf2('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x244dbc,_0x6cf2('0xe'));_0x5577a2(_0x19b22d[_0x6cf2('0x15')][_0x6cf2('0x14')]);}})[_0x6cf2('0x16')](function(_0xc21e36){logger[_0x6cf2('0x12')](_0x6cf2('0xd'),_0x244dbc,_0xc21e36);_0x1f2449(_0xc21e36);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 53b1b26..addb868 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 _0xba66=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5cd51d,_0x20d4fa){var _0x444608=function(_0x32a9dc){while(--_0x32a9dc){_0x5cd51d['push'](_0x5cd51d['shift']());}};_0x444608(++_0x20d4fa);}(_0xba66,0xa5));var _0x6ba6=function(_0x1dca6d,_0x1ce509){_0x1dca6d=_0x1dca6d-0x0;var _0x42613b=_0xba66[_0x1dca6d];return _0x42613b;};'use strict';var multer=require(_0x6ba6('0x0'));var util=require(_0x6ba6('0x1'));var path=require(_0x6ba6('0x2'));var timeout=require(_0x6ba6('0x3'));var express=require(_0x6ba6('0x4'));var router=express[_0x6ba6('0x5')]();var fs_extra=require(_0x6ba6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6ba6('0x7'));var config=require(_0x6ba6('0x8'));var controller=require(_0x6ba6('0x9'));router['get']('/',auth[_0x6ba6('0xa')](),controller[_0x6ba6('0xb')]);router[_0x6ba6('0xc')](_0x6ba6('0xd'),auth[_0x6ba6('0xa')](),controller[_0x6ba6('0xe')]);router['post']('/',auth[_0x6ba6('0xa')](),controller['create']);router[_0x6ba6('0xf')](_0x6ba6('0xd'),auth[_0x6ba6('0xa')](),controller['update']);router[_0x6ba6('0x10')]('/:id',auth[_0x6ba6('0xa')](),controller[_0x6ba6('0x11')]);module[_0x6ba6('0x12')]=router; \ No newline at end of file +var _0x0f8a=['index','show','post','create','put','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4baea9,_0x5484b0){var _0x337c11=function(_0x5ee4d8){while(--_0x5ee4d8){_0x4baea9['push'](_0x4baea9['shift']());}};_0x337c11(++_0x5484b0);}(_0x0f8a,0xa9));var _0xa0f8=function(_0x38bf94,_0x173992){_0x38bf94=_0x38bf94-0x0;var _0x4a92e0=_0x0f8a[_0x38bf94];return _0x4a92e0;};'use strict';var multer=require(_0xa0f8('0x0'));var util=require('util');var path=require(_0xa0f8('0x1'));var timeout=require(_0xa0f8('0x2'));var express=require(_0xa0f8('0x3'));var router=express[_0xa0f8('0x4')]();var fs_extra=require(_0xa0f8('0x5'));var auth=require(_0xa0f8('0x6'));var interaction=require(_0xa0f8('0x7'));var config=require(_0xa0f8('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xa0f8('0x9')]('/',auth[_0xa0f8('0xa')](),controller[_0xa0f8('0xb')]);router[_0xa0f8('0x9')]('/:id',auth[_0xa0f8('0xa')](),controller[_0xa0f8('0xc')]);router[_0xa0f8('0xd')]('/',auth['isAuthenticated'](),controller[_0xa0f8('0xe')]);router[_0xa0f8('0xf')](_0xa0f8('0x10'),auth[_0xa0f8('0xa')](),controller['update']);router[_0xa0f8('0x11')](_0xa0f8('0x10'),auth[_0xa0f8('0xa')](),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 1158d05..6d413b7 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 _0xbdea=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbdea,0x162));var _0xabde=function(_0x1e4177,_0x26a73a){_0x1e4177=_0x1e4177-0x0;var _0xa6e76c=_0xbdea[_0x1e4177];return _0xa6e76c;};'use strict';var Sequelize=require(_0xabde('0x0'));module[_0xabde('0x1')]={'type':{'type':Sequelize[_0xabde('0x2')]('string',_0xabde('0x3'),_0xabde('0x4'),_0xabde('0x5'),_0xabde('0x6')),'defaultValue':_0xabde('0x7')},'content':{'type':Sequelize[_0xabde('0x8')]},'key':{'type':Sequelize[_0xabde('0x8')]},'keyType':{'type':Sequelize[_0xabde('0x2')](_0xabde('0x7'),_0xabde('0x3'),_0xabde('0x4'))},'keyContent':{'type':Sequelize[_0xabde('0x8')]},'idField':{'type':Sequelize[_0xabde('0x8')]},'nameField':{'type':Sequelize[_0xabde('0x8')]},'customField':{'type':Sequelize[_0xabde('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabde('0x8')]}}; \ No newline at end of file +var _0xbe99=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xbe99,0x83));var _0x9be9=function(_0x220d70,_0xa12514){_0x220d70=_0x220d70-0x0;var _0x5d3c2f=_0xbe99[_0x220d70];return _0x5d3c2f;};'use strict';var Sequelize=require(_0x9be9('0x0'));module[_0x9be9('0x1')]={'type':{'type':Sequelize[_0x9be9('0x2')](_0x9be9('0x3'),_0x9be9('0x4'),_0x9be9('0x5'),_0x9be9('0x6'),'picklist'),'defaultValue':_0x9be9('0x3')},'content':{'type':Sequelize[_0x9be9('0x7')]},'key':{'type':Sequelize[_0x9be9('0x7')]},'keyType':{'type':Sequelize[_0x9be9('0x2')](_0x9be9('0x3'),_0x9be9('0x4'),_0x9be9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9be9('0x7')]},'nameField':{'type':Sequelize[_0x9be9('0x7')]},'customField':{'type':Sequelize[_0x9be9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ccfff38..e403b91 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 _0x9aea=['sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','status','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','eml-format','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4b017a,_0x171787){var _0x19c799=function(_0x306583){while(--_0x306583){_0x4b017a['push'](_0x4b017a['shift']());}};_0x19c799(++_0x171787);}(_0x9aea,0xdd));var _0xa9ae=function(_0x56b231,_0x1b4316){_0x56b231=_0x56b231-0x0;var _0x1ecdc9=_0x9aea[_0x56b231];return _0x1ecdc9;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];function respondWithStatusCode(_0x35f861,_0x33a72f){_0x33a72f=_0x33a72f||0xcc;return function(_0xa34271){if(_0xa34271){return _0x35f861[_0xa9ae('0x19')](_0x33a72f);}return _0x35f861['status'](_0x33a72f)[_0xa9ae('0x1a')]();};}function respondWithResult(_0x365e90,_0x10882e){_0x10882e=_0x10882e||0xc8;return function(_0x3f7f61){if(_0x3f7f61){return _0x365e90['status'](_0x10882e)[_0xa9ae('0x1b')](_0x3f7f61);}};}function respondWithFilteredResult(_0x1ec742,_0x31c03e){return function(_0x40b756){if(_0x40b756){var _0x77b0a4=typeof _0x31c03e[_0xa9ae('0x1c')]==='undefined'&&typeof _0x31c03e[_0xa9ae('0x1d')]===_0xa9ae('0x1e');var _0x3e31d9=_0x40b756['count'];var _0x4dbb30=_0x77b0a4?0x0:_0x31c03e[_0xa9ae('0x1c')];var _0x581345=_0x77b0a4?_0x40b756['count']:_0x31c03e[_0xa9ae('0x1c')]+_0x31c03e[_0xa9ae('0x1d')];var _0xbfd2ff;if(_0x581345>=_0x3e31d9){_0x581345=_0x3e31d9;_0xbfd2ff=0xc8;}else{_0xbfd2ff=0xce;}_0x1ec742[_0xa9ae('0x1f')](_0xbfd2ff);return _0x1ec742['set'](_0xa9ae('0x20'),_0x4dbb30+'-'+_0x581345+'/'+_0x3e31d9)[_0xa9ae('0x1b')](_0x40b756);}return null;};}function patchUpdates(_0x39f133){return function(_0x688153){try{jsonpatch[_0xa9ae('0x21')](_0x688153,_0x39f133,!![]);}catch(_0x2e204d){return BPromise[_0xa9ae('0x22')](_0x2e204d);}return _0x688153['save']();};}function saveUpdates(_0xc021cf,_0x4ca9a9){return function(_0x49dca9){if(_0x49dca9){return _0x49dca9['update'](_0xc021cf)['then'](function(_0x1afd07){return _0x1afd07;});}return null;};}function removeEntity(_0x4edd55,_0x13fb05){return function(_0x5093ad){if(_0x5093ad){return _0x5093ad[_0xa9ae('0x23')]()[_0xa9ae('0x24')](function(){_0x4edd55[_0xa9ae('0x1f')](0xcc)[_0xa9ae('0x1a')]();});}};}function handleEntityNotFound(_0x12b061,_0x3f3f97){return function(_0x23c1ec){if(!_0x23c1ec){_0x12b061['sendStatus'](0x194);}return _0x23c1ec;};}function handleError(_0x3eb591,_0x3873aa){_0x3873aa=_0x3873aa||0x1f4;return function(_0x2aac9e){logger[_0xa9ae('0x25')](_0x2aac9e[_0xa9ae('0x26')]);if(_0x2aac9e[_0xa9ae('0x27')]){delete _0x2aac9e[_0xa9ae('0x27')];}_0x3eb591['status'](_0x3873aa)['send'](_0x2aac9e);};}exports[_0xa9ae('0x28')]=function(_0x3c324e,_0x3d1131){var _0x3d84d7={},_0x74cd94={},_0x54a821={'count':0x0,'rows':[]};var _0x52dd4f=_[_0xa9ae('0x29')](db[_0xa9ae('0x2a')][_0xa9ae('0x2b')],function(_0x3a48b7){return{'name':_0x3a48b7[_0xa9ae('0x2c')],'type':_0x3a48b7[_0xa9ae('0x2d')]['key']};});_0x74cd94['model']=_[_0xa9ae('0x29')](_0x52dd4f,_0xa9ae('0x27'));_0x74cd94[_0xa9ae('0x2e')]=_[_0xa9ae('0x2f')](_0x3c324e[_0xa9ae('0x2e')]);_0x74cd94[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x74cd94[_0xa9ae('0x32')],_0x74cd94['query']);_0x3d84d7[_0xa9ae('0x33')]=_['intersection'](_0x74cd94[_0xa9ae('0x32')],qs[_0xa9ae('0x34')](_0x3c324e[_0xa9ae('0x2e')]['fields']));_0x3d84d7[_0xa9ae('0x33')]=_0x3d84d7[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x3d84d7[_0xa9ae('0x33')]:_0x74cd94[_0xa9ae('0x32')];if(!_0x3c324e['query'][_0xa9ae('0x36')](_0xa9ae('0x37'))){_0x3d84d7[_0xa9ae('0x1d')]=qs['limit'](_0x3c324e['query'][_0xa9ae('0x1d')]);_0x3d84d7[_0xa9ae('0x1c')]=qs[_0xa9ae('0x1c')](_0x3c324e[_0xa9ae('0x2e')]['offset']);}_0x3d84d7[_0xa9ae('0x38')]=qs[_0xa9ae('0x39')](_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x39')]);_0x3d84d7[_0xa9ae('0x3a')]=qs['filters'](_[_0xa9ae('0x3b')](_0x3c324e['query'],_0x74cd94[_0xa9ae('0x30')]),_0x52dd4f);if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x3c')]){_0x3d84d7['where']=_[_0xa9ae('0x3d')](_0x3d84d7[_0xa9ae('0x3a')],{'$or':_[_0xa9ae('0x29')](_0x52dd4f,function(_0x48d36b){if(_0x48d36b[_0xa9ae('0x2d')]!==_0xa9ae('0x3e')){var _0x4e2001={};_0x4e2001[_0x48d36b[_0xa9ae('0x27')]]={'$like':'%'+_0x3c324e['query'][_0xa9ae('0x3c')]+'%'};return _0x4e2001;}})});}_0x3d84d7=_[_0xa9ae('0x3d')]({},_0x3d84d7,_0x3c324e['options']);var _0x37da9b={'where':_0x3d84d7[_0xa9ae('0x3a')]};return db[_0xa9ae('0x2a')][_0xa9ae('0x3f')](_0x37da9b)[_0xa9ae('0x24')](function(_0xf48d22){_0x54a821['count']=_0xf48d22;if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x40')]){_0x3d84d7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xa9ae('0x41')](_0x3d84d7);})[_0xa9ae('0x24')](function(_0xc4f775){_0x54a821[_0xa9ae('0x42')]=_0xc4f775;return _0x54a821;})['then'](respondWithFilteredResult(_0x3d1131,_0x3d84d7))[_0xa9ae('0x43')](handleError(_0x3d1131,null));};exports[_0xa9ae('0x44')]=function(_0x20dd83,_0x42dab2){var _0x23c91d={'raw':!![],'where':{'id':_0x20dd83[_0xa9ae('0x45')]['id']}},_0x2bef06={};_0x2bef06['model']=_[_0xa9ae('0x2f')](db[_0xa9ae('0x2a')]['rawAttributes']);_0x2bef06[_0xa9ae('0x2e')]=_['keys'](_0x20dd83[_0xa9ae('0x2e')]);_0x2bef06[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x2bef06[_0xa9ae('0x32')],_0x2bef06[_0xa9ae('0x2e')]);_0x23c91d[_0xa9ae('0x33')]=_[_0xa9ae('0x31')](_0x2bef06['model'],qs[_0xa9ae('0x34')](_0x20dd83[_0xa9ae('0x2e')]['fields']));_0x23c91d[_0xa9ae('0x33')]=_0x23c91d[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x23c91d[_0xa9ae('0x33')]:_0x2bef06[_0xa9ae('0x32')];if(_0x20dd83[_0xa9ae('0x2e')]['includeAll']){_0x23c91d[_0xa9ae('0x46')]=[{'all':!![]}];}_0x23c91d=_['merge']({},_0x23c91d,_0x20dd83[_0xa9ae('0x47')]);return db[_0xa9ae('0x2a')]['find'](_0x23c91d)['then'](handleEntityNotFound(_0x42dab2,null))[_0xa9ae('0x24')](respondWithResult(_0x42dab2,null))[_0xa9ae('0x43')](handleError(_0x42dab2,null));};exports[_0xa9ae('0x48')]=function(_0x47615f,_0x435c29){return db[_0xa9ae('0x2a')][_0xa9ae('0x48')](_0x47615f[_0xa9ae('0x49')],{})['then'](respondWithResult(_0x435c29,0xc9))['catch'](handleError(_0x435c29,null));};exports[_0xa9ae('0x4a')]=function(_0x3cf89c,_0x4efe55){if(_0x3cf89c[_0xa9ae('0x49')]['id']){delete _0x3cf89c[_0xa9ae('0x49')]['id'];}return db[_0xa9ae('0x2a')][_0xa9ae('0x4b')]({'where':{'id':_0x3cf89c[_0xa9ae('0x45')]['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x4efe55,null))[_0xa9ae('0x24')](saveUpdates(_0x3cf89c[_0xa9ae('0x49')],null))['then'](respondWithResult(_0x4efe55,null))[_0xa9ae('0x43')](handleError(_0x4efe55,null));};exports[_0xa9ae('0x23')]=function(_0x5ea18d,_0x128f88){return db['FreshdeskField']['find']({'where':{'id':_0x5ea18d['params']['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x128f88,null))[_0xa9ae('0x24')](removeEntity(_0x128f88,null))['catch'](handleError(_0x128f88,null));}; \ No newline at end of file +var _0xbc9d=['stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','map','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../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','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then'];(function(_0x55f4a8,_0x46d283){var _0x560de9=function(_0x942ac8){while(--_0x942ac8){_0x55f4a8['push'](_0x55f4a8['shift']());}};_0x560de9(++_0x46d283);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x51cbc6,_0x56410c){_0x51cbc6=_0x51cbc6-0x0;var _0x2dc19c=_0xbc9d[_0x51cbc6];return _0x2dc19c;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={},_0x539e57={},_0x561f8e={'count':0x0,'rows':[]};var _0x210a40=_['map'](db['FreshdeskField'][_0xdbc9('0x2b')],function(_0x20eb4f){return{'name':_0x20eb4f[_0xdbc9('0x2c')],'type':_0x20eb4f['type'][_0xdbc9('0x2d')]};});_0x539e57[_0xdbc9('0x2e')]=_['map'](_0x210a40,'name');_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x473430[_0xdbc9('0x2f')]);_0x539e57[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],_0x539e57[_0xdbc9('0x2f')]);_0x13a432['attributes']=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],qs[_0xdbc9('0x33')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x33')]));_0x13a432[_0xdbc9('0x34')]=_0x13a432['attributes'][_0xdbc9('0x35')]?_0x13a432['attributes']:_0x539e57['model'];if(!_0x473430['query']['hasOwnProperty']('nolimit')){_0x13a432[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x473430[_0xdbc9('0x2f')]['limit']);_0x13a432[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x20')]);}_0x13a432[_0xdbc9('0x36')]=qs[_0xdbc9('0x37')](_0x473430['query'][_0xdbc9('0x37')]);_0x13a432[_0xdbc9('0x38')]=qs[_0xdbc9('0x31')](_['pick'](_0x473430[_0xdbc9('0x2f')],_0x539e57[_0xdbc9('0x31')]),_0x210a40);if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x39')]){_0x13a432['where']=_['merge'](_0x13a432[_0xdbc9('0x38')],{'$or':_[_0xdbc9('0x3a')](_0x210a40,function(_0x136392){if(_0x136392[_0xdbc9('0x3b')]!=='VIRTUAL'){var _0x1b651f={};_0x1b651f[_0x136392[_0xdbc9('0x28')]]={'$like':'%'+_0x473430[_0xdbc9('0x2f')]['filter']+'%'};return _0x1b651f;}})});}_0x13a432=_[_0xdbc9('0x3c')]({},_0x13a432,_0x473430[_0xdbc9('0x3d')]);var _0x444219={'where':_0x13a432['where']};return db[_0xdbc9('0x3e')][_0xdbc9('0x1f')](_0x444219)['then'](function(_0x5173c2){_0x561f8e[_0xdbc9('0x1f')]=_0x5173c2;if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x13a432[_0xdbc9('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xdbc9('0x41')](_0x13a432);})[_0xdbc9('0x26')](function(_0x577725){_0x561f8e[_0xdbc9('0x42')]=_0x577725;return _0x561f8e;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x59bfd2,_0x13a432))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x43')]=function(_0x72dee3,_0x2adb23){var _0x3415c3={'raw':!![],'where':{'id':_0x72dee3[_0xdbc9('0x44')]['id']}},_0x3ed4de={};_0x3ed4de[_0xdbc9('0x2e')]=_['keys'](db['FreshdeskField'][_0xdbc9('0x2b')]);_0x3ed4de[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x72dee3[_0xdbc9('0x2f')]);_0x3ed4de[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],_0x3ed4de[_0xdbc9('0x2f')]);_0x3415c3[_0xdbc9('0x34')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],qs['fields'](_0x72dee3['query'][_0xdbc9('0x33')]));_0x3415c3[_0xdbc9('0x34')]=_0x3415c3[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x3415c3[_0xdbc9('0x34')]:_0x3ed4de[_0xdbc9('0x2e')];if(_0x72dee3[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x3415c3['include']=[{'all':!![]}];}_0x3415c3=_['merge']({},_0x3415c3,_0x72dee3[_0xdbc9('0x3d')]);return db[_0xdbc9('0x3e')][_0xdbc9('0x45')](_0x3415c3)[_0xdbc9('0x26')](handleEntityNotFound(_0x2adb23,null))[_0xdbc9('0x26')](respondWithResult(_0x2adb23,null))[_0xdbc9('0x46')](handleError(_0x2adb23,null));};exports[_0xdbc9('0x47')]=function(_0x2ea096,_0x43e3ec){return db['FreshdeskField'][_0xdbc9('0x47')](_0x2ea096[_0xdbc9('0x48')],{})['then'](respondWithResult(_0x43e3ec,0xc9))['catch'](handleError(_0x43e3ec,null));};exports[_0xdbc9('0x24')]=function(_0xc3db3c,_0x133a13){if(_0xc3db3c['body']['id']){delete _0xc3db3c[_0xdbc9('0x48')]['id'];}return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0xc3db3c[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x133a13,null))[_0xdbc9('0x26')](saveUpdates(_0xc3db3c[_0xdbc9('0x48')],null))[_0xdbc9('0x26')](respondWithResult(_0x133a13,null))[_0xdbc9('0x46')](handleError(_0x133a13,null));};exports['destroy']=function(_0x3e89f5,_0x36c70e){return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0x3e89f5[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x36c70e,null))[_0xdbc9('0x26')](removeEntity(_0x36c70e,null))[_0xdbc9('0x46')](handleError(_0x36c70e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9d26a51..3bc10c7 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 _0x79d3=['util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x2708de,_0x2df8b3){var _0x3489a9=function(_0x356d54){while(--_0x356d54){_0x2708de['push'](_0x2708de['shift']());}};_0x3489a9(++_0x2df8b3);}(_0x79d3,0x179));var _0x379d=function(_0x2a568e,_0x4788b1){_0x2a568e=_0x2a568e-0x0;var _0xe1df87=_0x79d3[_0x2a568e];return _0xe1df87;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var logger=require(_0x379d('0x2'))(_0x379d('0x3'));var moment=require(_0x379d('0x4'));var BPromise=require(_0x379d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x379d('0x6'));var rimraf=require(_0x379d('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x379d('0x8')]=function(_0x18b0be,_0x2a0f02){return _0x18b0be[_0x379d('0x9')](_0x379d('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x379d('0xb'),'fields':[_0x379d('0xc'),_0x379d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f2b=['api','moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x7f2b,0x11d));var _0xb7f2=function(_0x4c99b6,_0x3a2cc1){_0x4c99b6=_0x4c99b6-0x0;var _0x58eeb1=_0x7f2b[_0x4c99b6];return _0x58eeb1;};'use strict';var _=require(_0xb7f2('0x0'));var util=require(_0xb7f2('0x1'));var logger=require(_0xb7f2('0x2'))(_0xb7f2('0x3'));var moment=require(_0xb7f2('0x4'));var BPromise=require(_0xb7f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f2('0x6'));var rimraf=require('rimraf');var config=require(_0xb7f2('0x7'));var attributes=require(_0xb7f2('0x8'));module[_0xb7f2('0x9')]=function(_0x550f7c,_0x1e7c59){return _0x550f7c[_0xb7f2('0xa')](_0xb7f2('0xb'),attributes,{'tableName':_0xb7f2('0xc'),'paranoid':![],'indexes':[{'name':_0xb7f2('0xd'),'fields':[_0xb7f2('0xe'),_0xb7f2('0xf')],'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 22aea7c..0f4115e 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 _0x5780=['randomstring','../../mysqldb','../../config/utils','../../config/environment','client','then','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x5780,0x1eb));var _0x0578=function(_0x57efba,_0x58dbb0){_0x57efba=_0x57efba-0x0;var _0x4fb410=_0x5780[_0x57efba];return _0x4fb410;};'use strict';var _=require('lodash');var util=require(_0x0578('0x0'));var moment=require('moment');var BPromise=require(_0x0578('0x1'));var rs=require(_0x0578('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0578('0x3'))['db'];var utils=require(_0x0578('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0578('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0578('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5f12,_0x3815e4,_0x48ddb6){return new BPromise(function(_0x48a550,_0x4fc84a){return client['request'](_0x5d5f12,_0x48ddb6)[_0x0578('0x7')](function(_0x42cbd8){logger['info'](_0x0578('0x8'),_0x3815e4,'request\x20sent');logger[_0x0578('0x9')](_0x0578('0xa'),_0x3815e4,_0x0578('0xb'),JSON['stringify'](_0x42cbd8));if(_0x42cbd8[_0x0578('0xc')]){if(_0x42cbd8[_0x0578('0xc')][_0x0578('0xd')]===0x1f4){logger[_0x0578('0xc')](_0x0578('0x8'),_0x3815e4,_0x42cbd8[_0x0578('0xc')][_0x0578('0xe')]);return _0x4fc84a(_0x42cbd8['error']['message']);}logger[_0x0578('0xc')](_0x0578('0x8'),_0x3815e4,_0x42cbd8['error'][_0x0578('0xe')]);return _0x48a550(_0x42cbd8['error'][_0x0578('0xe')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3815e4,_0x0578('0xb'));_0x48a550(_0x42cbd8[_0x0578('0xf')][_0x0578('0xe')]);}})[_0x0578('0x10')](function(_0x3454b8){logger['error'](_0x0578('0x8'),_0x3815e4,_0x3454b8);_0x4fc84a(_0x3454b8);});});} \ No newline at end of file +var _0x42e3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x39ec2a,_0x4302e8){var _0x111682=function(_0xb2979f){while(--_0xb2979f){_0x39ec2a['push'](_0x39ec2a['shift']());}};_0x111682(++_0x4302e8);}(_0x42e3,0x175));var _0x342e=function(_0x5d9bde,_0x1e72c6){_0x5d9bde=_0x5d9bde-0x0;var _0x5b9be5=_0x42e3[_0x5d9bde];return _0x5b9be5;};'use strict';var _=require(_0x342e('0x0'));var util=require(_0x342e('0x1'));var moment=require(_0x342e('0x2'));var BPromise=require(_0x342e('0x3'));var rs=require(_0x342e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x342e('0x5'))['db'];var utils=require(_0x342e('0x6'));var logger=require('../../config/logger')(_0x342e('0x7'));var config=require(_0x342e('0x8'));var jayson=require(_0x342e('0x9'));var client=jayson[_0x342e('0xa')][_0x342e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b750,_0x4803a4,_0x2bf5e9){return new BPromise(function(_0x16e19e,_0x38e432){return client[_0x342e('0xc')](_0x19b750,_0x2bf5e9)['then'](function(_0x4be78d){logger[_0x342e('0xd')](_0x342e('0xe'),_0x4803a4,_0x342e('0xf'));logger[_0x342e('0x10')](_0x342e('0x11'),_0x4803a4,_0x342e('0xf'),JSON['stringify'](_0x4be78d));if(_0x4be78d[_0x342e('0x12')]){if(_0x4be78d[_0x342e('0x12')][_0x342e('0x13')]===0x1f4){logger['error'](_0x342e('0xe'),_0x4803a4,_0x4be78d['error'][_0x342e('0x14')]);return _0x38e432(_0x4be78d[_0x342e('0x12')][_0x342e('0x14')]);}logger[_0x342e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4803a4,_0x4be78d[_0x342e('0x12')]['message']);return _0x16e19e(_0x4be78d[_0x342e('0x12')]['message']);}else{logger[_0x342e('0xd')](_0x342e('0xe'),_0x4803a4,'request\x20sent');_0x16e19e(_0x4be78d[_0x342e('0x15')][_0x342e('0x14')]);}})['catch'](function(_0x128349){logger[_0x342e('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4803a4,_0x128349);_0x38e432(_0x128349);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d99418b..1683221 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 _0x6b20=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x56ca61,_0x187321){var _0x1e7bee=function(_0x1d6eb4){while(--_0x1d6eb4){_0x56ca61['push'](_0x56ca61['shift']());}};_0x1e7bee(++_0x187321);}(_0x6b20,0xd1));var _0x06b2=function(_0x32e7dc,_0x3f407e){_0x32e7dc=_0x32e7dc-0x0;var _0x3fe9de=_0x6b20[_0x32e7dc];return _0x3fe9de;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));var controller=require(_0x06b2('0x7'));router[_0x06b2('0x8')]('/',auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0x8')](_0x06b2('0xb'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0x8')](_0x06b2('0xd'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);router['get'](_0x06b2('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x06b2('0x10')]('/',auth[_0x06b2('0x9')](),controller['create']);router[_0x06b2('0x10')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x11')]);router[_0x06b2('0x12')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x13')]);router[_0x06b2('0x14')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x15')]);module[_0x06b2('0x16')]=router; \ No newline at end of file +var _0x3c81=['connect-timeout','express','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','multer','util'];(function(_0x137a64,_0x1bcfae){var _0x11c24c=function(_0x1004b9){while(--_0x1004b9){_0x137a64['push'](_0x137a64['shift']());}};_0x11c24c(++_0x1bcfae);}(_0x3c81,0x102));var _0x13c8=function(_0x2fd376,_0x1afebd){_0x2fd376=_0x2fd376-0x0;var _0x1d27a7=_0x3c81[_0x2fd376];return _0x1d27a7;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x11')]);router['put'](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router[_0x13c8('0x13')]('/:id',auth[_0x13c8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bfce417..c5a570d 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 _0xffd6=['exports','STRING','username','sequelize'];(function(_0x381f8b,_0x372f77){var _0x7dba9d=function(_0x39d182){while(--_0x39d182){_0x381f8b['push'](_0x381f8b['shift']());}};_0x7dba9d(++_0x372f77);}(_0xffd6,0x97));var _0x6ffd=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xffd6[_0x999b85];return _0x1d7124;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa456=['STRING','username','sequelize','exports'];(function(_0x5e6874,_0x9d1c9e){var _0x290295=function(_0x123a79){while(--_0x123a79){_0x5e6874['push'](_0x5e6874['shift']());}};_0x290295(++_0x9d1c9e);}(_0xa456,0x142));var _0x6a45=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xa456[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 788e633..bd75867 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 _0xe08d=['apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','then','show','params','includeAll','include','catch','create','body','update','find','getConfigurations','findOne','intersection','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','slice','substring','lastIndexOf','format'];(function(_0x5936e6,_0x5347ff){var _0x39874d=function(_0x398b6f){while(--_0x398b6f){_0x5936e6['push'](_0x5936e6['shift']());}};_0x39874d(++_0x5347ff);}(_0xe08d,0x6e));var _0xde08=function(_0x107329,_0x5c570d){_0x107329=_0x107329-0x0;var _0x5bec66=_0xe08d[_0x107329];return _0x5bec66;};'use strict';var emlformat=require(_0xde08('0x0'));var rimraf=require(_0xde08('0x1'));var zipdir=require(_0xde08('0x2'));var jsonpatch=require(_0xde08('0x3'));var rp=require(_0xde08('0x4'));var moment=require(_0xde08('0x5'));var BPromise=require(_0xde08('0x6'));var Mustache=require(_0xde08('0x7'));var util=require(_0xde08('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xde08('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde08('0xa'));var _=require(_0xde08('0xb'));var squel=require(_0xde08('0xc'));var crypto=require(_0xde08('0xd'));var jsforce=require(_0xde08('0xe'));var deskjs=require(_0xde08('0xf'));var toCsv=require('to-csv');var querystring=require(_0xde08('0x10'));var Papa=require(_0xde08('0x11'));var Redis=require(_0xde08('0x12'));var authService=require(_0xde08('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xde08('0x14'))('api');var utils=require(_0xde08('0x15'));var config=require(_0xde08('0x16'));var licenseUtil=require(_0xde08('0x17'));var db=require(_0xde08('0x18'))['db'];var integrations=require(_0xde08('0x19'));function respondWithStatusCode(_0x4483c6,_0x44e6af){_0x44e6af=_0x44e6af||0xcc;return function(_0x469774){if(_0x469774){return _0x4483c6[_0xde08('0x1a')](_0x44e6af);}return _0x4483c6[_0xde08('0x1b')](_0x44e6af)[_0xde08('0x1c')]();};}function respondWithResult(_0x26e7d5,_0x547684){_0x547684=_0x547684||0xc8;return function(_0x4ff8fa){if(_0x4ff8fa){return _0x26e7d5['status'](_0x547684)[_0xde08('0x1d')](_0x4ff8fa);}};}function respondWithFilteredResult(_0x1b23b7,_0x1b9c4b){return function(_0x2f2e3e){if(_0x2f2e3e){var _0x427864=typeof _0x1b9c4b[_0xde08('0x1e')]===_0xde08('0x1f')&&typeof _0x1b9c4b[_0xde08('0x20')]===_0xde08('0x1f');var _0x33818b=_0x2f2e3e[_0xde08('0x21')];var _0x289eb9=_0x427864?0x0:_0x1b9c4b[_0xde08('0x1e')];var _0x122f18=_0x427864?_0x2f2e3e[_0xde08('0x21')]:_0x1b9c4b[_0xde08('0x1e')]+_0x1b9c4b['limit'];var _0x4ea5be;if(_0x122f18>=_0x33818b){_0x122f18=_0x33818b;_0x4ea5be=0xc8;}else{_0x4ea5be=0xce;}_0x1b23b7[_0xde08('0x1b')](_0x4ea5be);return _0x1b23b7[_0xde08('0x22')](_0xde08('0x23'),_0x289eb9+'-'+_0x122f18+'/'+_0x33818b)['json'](_0x2f2e3e);}return null;};}function patchUpdates(_0x584908){return function(_0x2c792c){try{jsonpatch[_0xde08('0x24')](_0x2c792c,_0x584908,!![]);}catch(_0x53e956){return BPromise['reject'](_0x53e956);}return _0x2c792c[_0xde08('0x25')]();};}function saveUpdates(_0x3e3ba0,_0x424e6c){return function(_0x45bc90){if(_0x45bc90){return _0x45bc90['update'](_0x3e3ba0)['then'](function(_0x4b6ed5){return _0x4b6ed5;});}return null;};}function removeEntity(_0x43c429,_0x3fef13){return function(_0xd91795){if(_0xd91795){return _0xd91795[_0xde08('0x26')]()['then'](function(){_0x43c429['status'](0xcc)[_0xde08('0x1c')]();});}};}function handleEntityNotFound(_0x43f94f,_0x3613b0){return function(_0xb1dbe6){if(!_0xb1dbe6){_0x43f94f[_0xde08('0x1a')](0x194);}return _0xb1dbe6;};}function handleError(_0x510bae,_0x15151b){_0x15151b=_0x15151b||0x1f4;return function(_0x17a245){logger['error'](_0x17a245[_0xde08('0x27')]);if(_0x17a245[_0xde08('0x28')]){delete _0x17a245[_0xde08('0x28')];}_0x510bae[_0xde08('0x1b')](_0x15151b)['send'](_0x17a245);};}exports[_0xde08('0x29')]=function(_0x20d361,_0x1ee9dd){var _0x35b2f4={},_0x5b72b1={},_0x11b3dd={'count':0x0,'rows':[]};var _0x3f1b05=_['map'](db['FreshsalesAccount'][_0xde08('0x2a')],function(_0x2e82b6){return{'name':_0x2e82b6[_0xde08('0x2b')],'type':_0x2e82b6[_0xde08('0x2c')][_0xde08('0x2d')]};});_0x5b72b1[_0xde08('0x2e')]=_['map'](_0x3f1b05,_0xde08('0x28'));_0x5b72b1[_0xde08('0x2f')]=_[_0xde08('0x30')](_0x20d361['query']);_0x5b72b1[_0xde08('0x31')]=_['intersection'](_0x5b72b1[_0xde08('0x2e')],_0x5b72b1[_0xde08('0x2f')]);_0x35b2f4[_0xde08('0x32')]=_['intersection'](_0x5b72b1['model'],qs[_0xde08('0x33')](_0x20d361[_0xde08('0x2f')][_0xde08('0x33')]));_0x35b2f4[_0xde08('0x32')]=_0x35b2f4[_0xde08('0x32')][_0xde08('0x34')]?_0x35b2f4['attributes']:_0x5b72b1['model'];if(!_0x20d361[_0xde08('0x2f')][_0xde08('0x35')]('nolimit')){_0x35b2f4[_0xde08('0x20')]=qs[_0xde08('0x20')](_0x20d361['query'][_0xde08('0x20')]);_0x35b2f4[_0xde08('0x1e')]=qs[_0xde08('0x1e')](_0x20d361[_0xde08('0x2f')]['offset']);}_0x35b2f4[_0xde08('0x36')]=qs[_0xde08('0x37')](_0x20d361[_0xde08('0x2f')][_0xde08('0x37')]);_0x35b2f4[_0xde08('0x38')]=qs[_0xde08('0x31')](_[_0xde08('0x39')](_0x20d361[_0xde08('0x2f')],_0x5b72b1[_0xde08('0x31')]),_0x3f1b05);if(_0x20d361[_0xde08('0x2f')][_0xde08('0x3a')]){_0x35b2f4['where']=_[_0xde08('0x3b')](_0x35b2f4[_0xde08('0x38')],{'$or':_['map'](_0x3f1b05,function(_0x38564d){if(_0x38564d[_0xde08('0x2c')]!==_0xde08('0x3c')){var _0x991cca={};_0x991cca[_0x38564d[_0xde08('0x28')]]={'$like':'%'+_0x20d361[_0xde08('0x2f')][_0xde08('0x3a')]+'%'};return _0x991cca;}})});}_0x35b2f4=_[_0xde08('0x3b')]({},_0x35b2f4,_0x20d361[_0xde08('0x3d')]);var _0x13113a={'where':_0x35b2f4[_0xde08('0x38')]};return db[_0xde08('0x3e')][_0xde08('0x21')](_0x13113a)[_0xde08('0x3f')](function(_0xb32b9c){_0x11b3dd['count']=_0xb32b9c;if(_0x20d361[_0xde08('0x2f')]['includeAll']){_0x35b2f4['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x35b2f4);})[_0xde08('0x3f')](function(_0x514c7a){_0x11b3dd['rows']=_0x514c7a;return _0x11b3dd;})['then'](respondWithFilteredResult(_0x1ee9dd,_0x35b2f4))['catch'](handleError(_0x1ee9dd,null));};exports[_0xde08('0x40')]=function(_0x4c6bfd,_0x1c70e6){var _0x21ef8c={'raw':![],'where':{'id':_0x4c6bfd[_0xde08('0x41')]['id']}},_0x47e2d4={};_0x47e2d4[_0xde08('0x2e')]=_[_0xde08('0x30')](db[_0xde08('0x3e')]['rawAttributes']);_0x47e2d4[_0xde08('0x2f')]=_[_0xde08('0x30')](_0x4c6bfd[_0xde08('0x2f')]);_0x47e2d4[_0xde08('0x31')]=_['intersection'](_0x47e2d4[_0xde08('0x2e')],_0x47e2d4[_0xde08('0x2f')]);_0x21ef8c['attributes']=_['intersection'](_0x47e2d4[_0xde08('0x2e')],qs[_0xde08('0x33')](_0x4c6bfd['query'][_0xde08('0x33')]));_0x21ef8c[_0xde08('0x32')]=_0x21ef8c[_0xde08('0x32')][_0xde08('0x34')]?_0x21ef8c['attributes']:_0x47e2d4[_0xde08('0x2e')];if(_0x4c6bfd[_0xde08('0x2f')][_0xde08('0x42')]){_0x21ef8c[_0xde08('0x43')]=[{'all':!![]}];}_0x21ef8c=_[_0xde08('0x3b')]({},_0x21ef8c,_0x4c6bfd['options']);return db['FreshsalesAccount']['find'](_0x21ef8c)[_0xde08('0x3f')](handleEntityNotFound(_0x1c70e6,null))[_0xde08('0x3f')](respondWithResult(_0x1c70e6,null))[_0xde08('0x44')](handleError(_0x1c70e6,null));};exports[_0xde08('0x45')]=function(_0x41a01e,_0xd376c1){return db['FreshsalesAccount'][_0xde08('0x45')](_0x41a01e[_0xde08('0x46')],{})['then'](respondWithResult(_0xd376c1,0xc9))[_0xde08('0x44')](handleError(_0xd376c1,null));};exports[_0xde08('0x47')]=function(_0x5cee2c,_0xd6f135){if(_0x5cee2c['body']['id']){delete _0x5cee2c[_0xde08('0x46')]['id'];}return db[_0xde08('0x3e')][_0xde08('0x48')]({'where':{'id':_0x5cee2c['params']['id']}})[_0xde08('0x3f')](handleEntityNotFound(_0xd6f135,null))[_0xde08('0x3f')](saveUpdates(_0x5cee2c[_0xde08('0x46')],null))[_0xde08('0x3f')](respondWithResult(_0xd6f135,null))[_0xde08('0x44')](handleError(_0xd6f135,null));};exports[_0xde08('0x26')]=function(_0x10bc74,_0x33a6d9){return db[_0xde08('0x3e')][_0xde08('0x48')]({'where':{'id':_0x10bc74[_0xde08('0x41')]['id']}})[_0xde08('0x3f')](handleEntityNotFound(_0x33a6d9,null))['then'](removeEntity(_0x33a6d9,null))[_0xde08('0x44')](handleError(_0x33a6d9,null));};exports[_0xde08('0x49')]=function(_0x3292bd,_0x4fe622,_0x29b8c4){var _0x48641d={};var _0x2e1849={};var _0x3b6235;var _0x547e98;return db[_0xde08('0x3e')][_0xde08('0x4a')]({'where':{'id':_0x3292bd[_0xde08('0x41')]['id']}})[_0xde08('0x3f')](handleEntityNotFound(_0x4fe622,null))[_0xde08('0x3f')](function(_0x4fa446){if(_0x4fa446){_0x3b6235=_0x4fa446;_0x2e1849[_0xde08('0x2e')]=_[_0xde08('0x30')](db['FreshsalesConfiguration']['rawAttributes']);_0x2e1849[_0xde08('0x2f')]=_[_0xde08('0x30')](_0x3292bd[_0xde08('0x2f')]);_0x2e1849['filters']=_[_0xde08('0x4b')](_0x2e1849[_0xde08('0x2e')],_0x2e1849[_0xde08('0x2f')]);_0x48641d[_0xde08('0x32')]=_[_0xde08('0x4b')](_0x2e1849[_0xde08('0x2e')],qs[_0xde08('0x33')](_0x3292bd[_0xde08('0x2f')][_0xde08('0x33')]));_0x48641d['attributes']=_0x48641d[_0xde08('0x32')][_0xde08('0x34')]?_0x48641d['attributes']:_0x2e1849['model'];_0x48641d[_0xde08('0x36')]=qs[_0xde08('0x37')](_0x3292bd[_0xde08('0x2f')][_0xde08('0x37')]);_0x48641d['where']=qs[_0xde08('0x31')](_['pick'](_0x3292bd[_0xde08('0x2f')],_0x2e1849['filters']));if(_0x3292bd[_0xde08('0x2f')][_0xde08('0x3a')]){_0x48641d['where']=_[_0xde08('0x3b')](_0x48641d[_0xde08('0x38')],{'$or':_['map'](_0x48641d[_0xde08('0x32')],function(_0x5b173d){var _0x309fed={};_0x309fed[_0x5b173d]={'$like':'%'+_0x3292bd[_0xde08('0x2f')][_0xde08('0x3a')]+'%'};return _0x309fed;})});}_0x48641d=_[_0xde08('0x3b')]({},_0x48641d,_0x3292bd[_0xde08('0x3d')]);return _0x3b6235[_0xde08('0x49')](_0x48641d);}})[_0xde08('0x3f')](function(_0x4c493b){if(_0x4c493b){_0x547e98=_0x4c493b['length'];if(!_0x3292bd['query'][_0xde08('0x35')](_0xde08('0x4c'))){_0x48641d[_0xde08('0x20')]=qs[_0xde08('0x20')](_0x3292bd[_0xde08('0x2f')][_0xde08('0x20')]);_0x48641d[_0xde08('0x1e')]=qs[_0xde08('0x1e')](_0x3292bd[_0xde08('0x2f')][_0xde08('0x1e')]);}return _0x3b6235[_0xde08('0x49')](_0x48641d);}})[_0xde08('0x3f')](function(_0x21bc0e){if(_0x21bc0e){return _0x21bc0e?{'count':_0x547e98,'rows':_0x21bc0e}:null;}})['then'](respondWithResult(_0x4fe622,null))['catch'](handleError(_0x4fe622,null));};exports[_0xde08('0x4d')]=function(_0x5857cc,_0x10ea3e,_0x474d27){if(_0x5857cc[_0xde08('0x46')]['id']){delete _0x5857cc['body']['id'];}return db[_0xde08('0x3e')][_0xde08('0x4a')]({'where':{'id':_0x5857cc[_0xde08('0x41')]['id']}})['then'](handleEntityNotFound(_0x10ea3e,null))[_0xde08('0x3f')](function(_0x2dde52){if(_0x2dde52){_0x5857cc['body']['AccountId']=_0x2dde52['id'];_0x5857cc[_0xde08('0x46')][_0xde08('0x4e')]=integrations[_0xde08('0x4f')](_0x5857cc[_0xde08('0x46')][_0xde08('0x50')],_0x5857cc[_0xde08('0x46')][_0xde08('0x2c')]);_0x5857cc['body'][_0xde08('0x51')]=integrations[_0xde08('0x52')](_0x5857cc[_0xde08('0x46')][_0xde08('0x50')],_0x5857cc[_0xde08('0x46')]['type']);return db['FreshsalesConfiguration'][_0xde08('0x45')](_0x5857cc[_0xde08('0x46')],{'include':[{'model':db[_0xde08('0x53')],'as':'Subjects'},{'model':db[_0xde08('0x53')],'as':_0xde08('0x51')}]});}return null;})[_0xde08('0x3f')](respondWithResult(_0x10ea3e,null))['catch'](handleError(_0x10ea3e,null));};exports['getFields']=function(_0xca6ea9,_0x28f2ea,_0x3d80c3){var _0x20f6b3='';var _0x2edde0='';return db['FreshsalesAccount'][_0xde08('0x4a')]({'where':{'id':_0xca6ea9['params']['id']},'attributes':['id',_0xde08('0x54'),_0xde08('0x55'),'apiKey']})[_0xde08('0x3f')](handleEntityNotFound(_0x28f2ea,null))[_0xde08('0x3f')](function(_0x4119b3){if(_0x4119b3){_0x2edde0=_0x4119b3[_0xde08('0x54')];_0x20f6b3=_0x4119b3[_0xde08('0x55')];var _0x5784dd=_0x4119b3['remoteUri'][_0xde08('0x56')](-0x1);if(_0x5784dd==='/'){_0x20f6b3=_0x20f6b3[_0xde08('0x57')](0x0,_0x20f6b3[_0xde08('0x58')](_0x5784dd));}return rp({'method':'GET','uri':util[_0xde08('0x59')]('%s%s',_0x20f6b3,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x4119b3[_0xde08('0x5a')]},'json':!![]});}})[_0xde08('0x3f')](function(_0x2a8042){if(_0x2a8042){var _0x39e79a=_0x2a8042[_0xde08('0x5b')];var _0xc93fa5=![];var _0x2efc9b=null;for(_0x2efc9b=0x0;_0x2efc9b<_0x39e79a[_0xde08('0x34')];_0x2efc9b++){if(_0x39e79a[_0x2efc9b][_0xde08('0x5c')]===_0x2edde0){_0xc93fa5=!![];}}if(_0xc93fa5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xde08('0x5d')});}}})[_0xde08('0x3f')](respondWithResult(_0x28f2ea,null))[_0xde08('0x44')](function(_0x359445){var _0x259c21=_0xca6ea9[_0xde08('0x2f')]['test']?0x1f4:_0x359445[_0xde08('0x5e')]||0x1f4;logger[_0xde08('0x5f')](_0xde08('0x60'),_0xde08('0x61'),_0x259c21,JSON[_0xde08('0x62')](_0x359445));delete _0x359445[_0xde08('0x28')];if(_0x259c21===0x191){_0x259c21=0x190;}_0x28f2ea[_0xde08('0x1b')](_0x259c21)['send'](_0xca6ea9['query'][_0xde08('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x359445[_0xde08('0x5e')]}:_0x359445);});}; \ No newline at end of file +var _0x202e=['getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','params','includeAll','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Token\x20token=','email','test','statusCode'];(function(_0x35c964,_0x544301){var _0x460f4b=function(_0x49e241){while(--_0x49e241){_0x35c964['push'](_0x35c964['shift']());}};_0x460f4b(++_0x544301);}(_0x202e,0x68));var _0xe202=function(_0x22d995,_0x4981ab){_0x22d995=_0x22d995-0x0;var _0x1e7df8=_0x202e[_0x22d995];return _0x1e7df8;};'use strict';var emlformat=require(_0xe202('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe202('0x1'));var jsonpatch=require(_0xe202('0x2'));var rp=require(_0xe202('0x3'));var moment=require(_0xe202('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe202('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe202('0x6'));var csv=require(_0xe202('0x7'));var ejs=require(_0xe202('0x8'));var fs=require('fs');var fs_extra=require(_0xe202('0x9'));var _=require(_0xe202('0xa'));var squel=require(_0xe202('0xb'));var crypto=require('crypto');var jsforce=require(_0xe202('0xc'));var deskjs=require(_0xe202('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe202('0xe'));var Redis=require(_0xe202('0xf'));var authService=require(_0xe202('0x10'));var qs=require(_0xe202('0x11'));var as=require(_0xe202('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe202('0x13'))(_0xe202('0x14'));var utils=require(_0xe202('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe202('0x16'));var db=require(_0xe202('0x17'))['db'];var integrations=require(_0xe202('0x18'));function respondWithStatusCode(_0x5248af,_0x1b830c){_0x1b830c=_0x1b830c||0xcc;return function(_0x35e87d){if(_0x35e87d){return _0x5248af['sendStatus'](_0x1b830c);}return _0x5248af['status'](_0x1b830c)[_0xe202('0x19')]();};}function respondWithResult(_0x3e8423,_0x194912){_0x194912=_0x194912||0xc8;return function(_0x5ca73b){if(_0x5ca73b){return _0x3e8423['status'](_0x194912)[_0xe202('0x1a')](_0x5ca73b);}};}function respondWithFilteredResult(_0x4ec6db,_0x3d6a03){return function(_0x54f8c2){if(_0x54f8c2){var _0x1a9843=typeof _0x3d6a03['offset']===_0xe202('0x1b')&&typeof _0x3d6a03[_0xe202('0x1c')]===_0xe202('0x1b');var _0x49fb84=_0x54f8c2[_0xe202('0x1d')];var _0x4c0fc5=_0x1a9843?0x0:_0x3d6a03[_0xe202('0x1e')];var _0x499e29=_0x1a9843?_0x54f8c2[_0xe202('0x1d')]:_0x3d6a03[_0xe202('0x1e')]+_0x3d6a03[_0xe202('0x1c')];var _0x5e5825;if(_0x499e29>=_0x49fb84){_0x499e29=_0x49fb84;_0x5e5825=0xc8;}else{_0x5e5825=0xce;}_0x4ec6db[_0xe202('0x1f')](_0x5e5825);return _0x4ec6db[_0xe202('0x20')](_0xe202('0x21'),_0x4c0fc5+'-'+_0x499e29+'/'+_0x49fb84)[_0xe202('0x1a')](_0x54f8c2);}return null;};}function patchUpdates(_0x587715){return function(_0xbc5d4d){try{jsonpatch['apply'](_0xbc5d4d,_0x587715,!![]);}catch(_0x3cb555){return BPromise[_0xe202('0x22')](_0x3cb555);}return _0xbc5d4d['save']();};}function saveUpdates(_0x24a6f9,_0x4dd51b){return function(_0x53c9ed){if(_0x53c9ed){return _0x53c9ed[_0xe202('0x23')](_0x24a6f9)[_0xe202('0x24')](function(_0x3a1bb9){return _0x3a1bb9;});}return null;};}function removeEntity(_0xb21794,_0x197e36){return function(_0x50fa92){if(_0x50fa92){return _0x50fa92[_0xe202('0x25')]()[_0xe202('0x24')](function(){_0xb21794[_0xe202('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221428,_0x282e6b){return function(_0x3d28a2){if(!_0x3d28a2){_0x221428[_0xe202('0x26')](0x194);}return _0x3d28a2;};}function handleError(_0x437dd6,_0x49541a){_0x49541a=_0x49541a||0x1f4;return function(_0x459519){logger[_0xe202('0x27')](_0x459519[_0xe202('0x28')]);if(_0x459519[_0xe202('0x29')]){delete _0x459519[_0xe202('0x29')];}_0x437dd6[_0xe202('0x1f')](_0x49541a)['send'](_0x459519);};}exports[_0xe202('0x2a')]=function(_0x1cb04c,_0x43cb6f){var _0x14035b={},_0x10339b={},_0x3d1cbf={'count':0x0,'rows':[]};var _0x19a473=_[_0xe202('0x2b')](db[_0xe202('0x2c')][_0xe202('0x2d')],function(_0x259437){return{'name':_0x259437[_0xe202('0x2e')],'type':_0x259437[_0xe202('0x2f')][_0xe202('0x30')]};});_0x10339b[_0xe202('0x31')]=_['map'](_0x19a473,_0xe202('0x29'));_0x10339b[_0xe202('0x32')]=_[_0xe202('0x33')](_0x1cb04c[_0xe202('0x32')]);_0x10339b[_0xe202('0x34')]=_[_0xe202('0x35')](_0x10339b[_0xe202('0x31')],_0x10339b['query']);_0x14035b['attributes']=_[_0xe202('0x35')](_0x10339b[_0xe202('0x31')],qs[_0xe202('0x36')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x36')]));_0x14035b['attributes']=_0x14035b[_0xe202('0x37')][_0xe202('0x38')]?_0x14035b['attributes']:_0x10339b[_0xe202('0x31')];if(!_0x1cb04c[_0xe202('0x32')]['hasOwnProperty'](_0xe202('0x39'))){_0x14035b['limit']=qs[_0xe202('0x1c')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x1c')]);_0x14035b[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x1cb04c[_0xe202('0x32')][_0xe202('0x1e')]);}_0x14035b[_0xe202('0x3a')]=qs[_0xe202('0x3b')](_0x1cb04c[_0xe202('0x32')]['sort']);_0x14035b['where']=qs['filters'](_[_0xe202('0x3c')](_0x1cb04c[_0xe202('0x32')],_0x10339b['filters']),_0x19a473);if(_0x1cb04c[_0xe202('0x32')][_0xe202('0x3d')]){_0x14035b[_0xe202('0x3e')]=_[_0xe202('0x3f')](_0x14035b[_0xe202('0x3e')],{'$or':_['map'](_0x19a473,function(_0x3af043){if(_0x3af043[_0xe202('0x2f')]!=='VIRTUAL'){var _0x4db1e5={};_0x4db1e5[_0x3af043[_0xe202('0x29')]]={'$like':'%'+_0x1cb04c[_0xe202('0x32')][_0xe202('0x3d')]+'%'};return _0x4db1e5;}})});}_0x14035b=_[_0xe202('0x3f')]({},_0x14035b,_0x1cb04c[_0xe202('0x40')]);var _0x9d2bae={'where':_0x14035b[_0xe202('0x3e')]};return db['FreshsalesAccount']['count'](_0x9d2bae)[_0xe202('0x24')](function(_0x410810){_0x3d1cbf[_0xe202('0x1d')]=_0x410810;if(_0x1cb04c[_0xe202('0x32')]['includeAll']){_0x14035b[_0xe202('0x41')]=[{'all':!![]}];}return db[_0xe202('0x2c')][_0xe202('0x42')](_0x14035b);})[_0xe202('0x24')](function(_0x44e526){_0x3d1cbf['rows']=_0x44e526;return _0x3d1cbf;})[_0xe202('0x24')](respondWithFilteredResult(_0x43cb6f,_0x14035b))['catch'](handleError(_0x43cb6f,null));};exports['show']=function(_0x6a9326,_0x480ada){var _0x1990a0={'raw':![],'where':{'id':_0x6a9326[_0xe202('0x43')]['id']}},_0x9863e1={};_0x9863e1[_0xe202('0x31')]=_['keys'](db[_0xe202('0x2c')][_0xe202('0x2d')]);_0x9863e1[_0xe202('0x32')]=_[_0xe202('0x33')](_0x6a9326['query']);_0x9863e1['filters']=_['intersection'](_0x9863e1[_0xe202('0x31')],_0x9863e1['query']);_0x1990a0[_0xe202('0x37')]=_[_0xe202('0x35')](_0x9863e1['model'],qs[_0xe202('0x36')](_0x6a9326[_0xe202('0x32')][_0xe202('0x36')]));_0x1990a0[_0xe202('0x37')]=_0x1990a0[_0xe202('0x37')][_0xe202('0x38')]?_0x1990a0['attributes']:_0x9863e1[_0xe202('0x31')];if(_0x6a9326['query'][_0xe202('0x44')]){_0x1990a0[_0xe202('0x41')]=[{'all':!![]}];}_0x1990a0=_[_0xe202('0x3f')]({},_0x1990a0,_0x6a9326[_0xe202('0x40')]);return db[_0xe202('0x2c')][_0xe202('0x45')](_0x1990a0)[_0xe202('0x24')](handleEntityNotFound(_0x480ada,null))[_0xe202('0x24')](respondWithResult(_0x480ada,null))[_0xe202('0x46')](handleError(_0x480ada,null));};exports[_0xe202('0x47')]=function(_0x4450a8,_0x168907){return db[_0xe202('0x2c')][_0xe202('0x47')](_0x4450a8[_0xe202('0x48')],{})['then'](respondWithResult(_0x168907,0xc9))[_0xe202('0x46')](handleError(_0x168907,null));};exports[_0xe202('0x23')]=function(_0x30c8ae,_0x1e25c9){if(_0x30c8ae[_0xe202('0x48')]['id']){delete _0x30c8ae[_0xe202('0x48')]['id'];}return db[_0xe202('0x2c')]['find']({'where':{'id':_0x30c8ae[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x1e25c9,null))[_0xe202('0x24')](saveUpdates(_0x30c8ae[_0xe202('0x48')],null))[_0xe202('0x24')](respondWithResult(_0x1e25c9,null))[_0xe202('0x46')](handleError(_0x1e25c9,null));};exports[_0xe202('0x25')]=function(_0x5340ac,_0x4c6dfa){return db[_0xe202('0x2c')]['find']({'where':{'id':_0x5340ac[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x4c6dfa,null))['then'](removeEntity(_0x4c6dfa,null))['catch'](handleError(_0x4c6dfa,null));};exports[_0xe202('0x49')]=function(_0x3f6fc5,_0x5c67a9,_0x2f0a22){var _0x5c09ef={};var _0x5d438b={};var _0x30efcb;var _0xbe08e0;return db['FreshsalesAccount'][_0xe202('0x4a')]({'where':{'id':_0x3f6fc5[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x5c67a9,null))[_0xe202('0x24')](function(_0x494457){if(_0x494457){_0x30efcb=_0x494457;_0x5d438b[_0xe202('0x31')]=_[_0xe202('0x33')](db[_0xe202('0x4b')][_0xe202('0x2d')]);_0x5d438b[_0xe202('0x32')]=_[_0xe202('0x33')](_0x3f6fc5['query']);_0x5d438b[_0xe202('0x34')]=_[_0xe202('0x35')](_0x5d438b[_0xe202('0x31')],_0x5d438b['query']);_0x5c09ef[_0xe202('0x37')]=_[_0xe202('0x35')](_0x5d438b[_0xe202('0x31')],qs[_0xe202('0x36')](_0x3f6fc5['query']['fields']));_0x5c09ef[_0xe202('0x37')]=_0x5c09ef[_0xe202('0x37')]['length']?_0x5c09ef['attributes']:_0x5d438b[_0xe202('0x31')];_0x5c09ef[_0xe202('0x3a')]=qs[_0xe202('0x3b')](_0x3f6fc5['query'][_0xe202('0x3b')]);_0x5c09ef['where']=qs['filters'](_[_0xe202('0x3c')](_0x3f6fc5[_0xe202('0x32')],_0x5d438b[_0xe202('0x34')]));if(_0x3f6fc5[_0xe202('0x32')][_0xe202('0x3d')]){_0x5c09ef[_0xe202('0x3e')]=_[_0xe202('0x3f')](_0x5c09ef[_0xe202('0x3e')],{'$or':_['map'](_0x5c09ef['attributes'],function(_0x523f56){var _0x31a94d={};_0x31a94d[_0x523f56]={'$like':'%'+_0x3f6fc5['query']['filter']+'%'};return _0x31a94d;})});}_0x5c09ef=_[_0xe202('0x3f')]({},_0x5c09ef,_0x3f6fc5[_0xe202('0x40')]);return _0x30efcb['getConfigurations'](_0x5c09ef);}})['then'](function(_0xda968b){if(_0xda968b){_0xbe08e0=_0xda968b[_0xe202('0x38')];if(!_0x3f6fc5[_0xe202('0x32')]['hasOwnProperty'](_0xe202('0x39'))){_0x5c09ef[_0xe202('0x1c')]=qs['limit'](_0x3f6fc5[_0xe202('0x32')][_0xe202('0x1c')]);_0x5c09ef[_0xe202('0x1e')]=qs[_0xe202('0x1e')](_0x3f6fc5[_0xe202('0x32')]['offset']);}return _0x30efcb[_0xe202('0x49')](_0x5c09ef);}})['then'](function(_0xabe47f){if(_0xabe47f){return _0xabe47f?{'count':_0xbe08e0,'rows':_0xabe47f}:null;}})[_0xe202('0x24')](respondWithResult(_0x5c67a9,null))[_0xe202('0x46')](handleError(_0x5c67a9,null));};exports[_0xe202('0x4c')]=function(_0x4e4003,_0x211be5,_0x1e5c82){if(_0x4e4003[_0xe202('0x48')]['id']){delete _0x4e4003[_0xe202('0x48')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4e4003[_0xe202('0x43')]['id']}})[_0xe202('0x24')](handleEntityNotFound(_0x211be5,null))['then'](function(_0x1ad7cb){if(_0x1ad7cb){_0x4e4003['body'][_0xe202('0x4d')]=_0x1ad7cb['id'];_0x4e4003[_0xe202('0x48')][_0xe202('0x4e')]=integrations[_0xe202('0x4f')](_0x4e4003['body'][_0xe202('0x50')],_0x4e4003[_0xe202('0x48')][_0xe202('0x2f')]);_0x4e4003[_0xe202('0x48')]['Descriptions']=integrations[_0xe202('0x51')](_0x4e4003[_0xe202('0x48')][_0xe202('0x50')],_0x4e4003[_0xe202('0x48')][_0xe202('0x2f')]);return db[_0xe202('0x4b')][_0xe202('0x47')](_0x4e4003['body'],{'include':[{'model':db[_0xe202('0x52')],'as':_0xe202('0x4e')},{'model':db['FreshsalesField'],'as':_0xe202('0x53')}]});}return null;})['then'](respondWithResult(_0x211be5,null))[_0xe202('0x46')](handleError(_0x211be5,null));};exports['getFields']=function(_0x5057,_0x1169f2,_0xb45033){var _0x258e6a='';var _0x18cdce='';return db[_0xe202('0x2c')][_0xe202('0x4a')]({'where':{'id':_0x5057[_0xe202('0x43')]['id']},'attributes':['id',_0xe202('0x54'),_0xe202('0x55'),_0xe202('0x56')]})[_0xe202('0x24')](handleEntityNotFound(_0x1169f2,null))[_0xe202('0x24')](function(_0x9eb00c){if(_0x9eb00c){_0x18cdce=_0x9eb00c[_0xe202('0x54')];_0x258e6a=_0x9eb00c[_0xe202('0x55')];var _0x3d65c1=_0x9eb00c[_0xe202('0x55')][_0xe202('0x57')](-0x1);if(_0x3d65c1==='/'){_0x258e6a=_0x258e6a[_0xe202('0x58')](0x0,_0x258e6a[_0xe202('0x59')](_0x3d65c1));}return rp({'method':_0xe202('0x5a'),'uri':util[_0xe202('0x5b')]('%s%s',_0x258e6a,'/api/selector/owners'),'headers':{'Authorization':_0xe202('0x5c')+_0x9eb00c[_0xe202('0x56')]},'json':!![]});}})[_0xe202('0x24')](function(_0x283057){if(_0x283057){var _0x4d4174=_0x283057['users'];var _0x3001dd=![];var _0x497975=null;for(_0x497975=0x0;_0x497975<_0x4d4174['length'];_0x497975++){if(_0x4d4174[_0x497975][_0xe202('0x5d')]===_0x18cdce){_0x3001dd=!![];}}if(_0x3001dd){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xe202('0x24')](respondWithResult(_0x1169f2,null))[_0xe202('0x46')](function(_0x1035f5){var _0x9c9580=_0x5057['query'][_0xe202('0x5e')]?0x1f4:_0x1035f5[_0xe202('0x5f')]||0x1f4;logger[_0xe202('0x27')](_0xe202('0x60'),'getFields',_0x9c9580,JSON[_0xe202('0x61')](_0x1035f5));delete _0x1035f5[_0xe202('0x29')];if(_0x9c9580===0x191){_0x9c9580=0x190;}_0x1169f2[_0xe202('0x1f')](_0x9c9580)[_0xe202('0x62')](_0x5057[_0xe202('0x32')][_0xe202('0x5e')]?{'message':_0xe202('0x63'),'statusCode':_0x1035f5[_0xe202('0x5f')]}:_0x1035f5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index eb776ed..ed6fdbf 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 _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x328cf7,_0x2c7d51){var _0x9e596d=function(_0x70e533){while(--_0x70e533){_0x328cf7['push'](_0x328cf7['shift']());}};_0x9e596d(++_0x2c7d51);}(_0x7880,0x1f4));var _0x0788=function(_0x893787,_0x2ecfe4){_0x893787=_0x893787-0x0;var _0x4d2cb0=_0x7880[_0x893787];return _0x4d2cb0;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));var integrations=require(_0x0788('0x9'));module[_0x0788('0xa')]=function(_0x775629,_0x3f9cb8){return _0x775629[_0x0788('0xb')](_0x0788('0xc'),attributes,{'tableName':_0x0788('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x2d72,0xa8));var _0x22d7=function(_0x40f474,_0x5d2426){_0x40f474=_0x40f474-0x0;var _0x566daf=_0x2d72[_0x40f474];return _0x566daf;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));var integrations=require(_0x22d7('0xb'));module[_0x22d7('0xc')]=function(_0x100426,_0x52a3e3){return _0x100426[_0x22d7('0xd')](_0x22d7('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index f516366..703741f 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 _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x3340e9,_0x4621e4){var _0x18c3e4=function(_0x24ca71){while(--_0x24ca71){_0x3340e9['push'](_0x3340e9['shift']());}};_0x18c3e4(++_0x4621e4);}(_0x47c5,0x165));var _0x547c=function(_0x143ce6,_0x46e089){_0x143ce6=_0x143ce6-0x0;var _0x33ed64=_0x47c5[_0x143ce6];return _0x33ed64;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1e9912,_0x50f826){var _0x193d70=function(_0x78541e){while(--_0x78541e){_0x1e9912['push'](_0x1e9912['shift']());}};_0x193d70(++_0x50f826);}(_0xef0f,0x168));var _0xfef0=function(_0x4f8967,_0x28552e){_0x4f8967=_0x4f8967-0x0;var _0x1e1ba7=_0xef0f[_0x4f8967];return _0x1e1ba7;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 42359ce..8d32ad5 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 _0x920b=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x56899b,_0x80fce){var _0x47d591=function(_0x23d7cf){while(--_0x23d7cf){_0x56899b['push'](_0x56899b['shift']());}};_0x47d591(++_0x80fce);}(_0x920b,0x18a));var _0xb920=function(_0x4c6edc,_0x41432a){_0x4c6edc=_0x4c6edc-0x0;var _0x4aac7f=_0x920b[_0x4c6edc];return _0x4aac7f;};'use strict';var multer=require(_0xb920('0x0'));var util=require('util');var path=require(_0xb920('0x1'));var timeout=require(_0xb920('0x2'));var express=require(_0xb920('0x3'));var router=express[_0xb920('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb920('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb920('0x6'));var controller=require(_0xb920('0x7'));router[_0xb920('0x8')]('/',auth[_0xb920('0x9')](),controller[_0xb920('0xa')]);router[_0xb920('0x8')](_0xb920('0xb'),auth[_0xb920('0x9')](),controller[_0xb920('0xc')]);router[_0xb920('0x8')]('/:id/subjects',auth[_0xb920('0x9')](),controller['getSubjects']);router[_0xb920('0x8')](_0xb920('0xd'),auth[_0xb920('0x9')](),controller[_0xb920('0xe')]);router[_0xb920('0x8')](_0xb920('0xf'),auth['isAuthenticated'](),controller[_0xb920('0x10')]);router[_0xb920('0x11')]('/',auth[_0xb920('0x9')](),controller[_0xb920('0x12')]);router[_0xb920('0x13')](_0xb920('0xb'),auth[_0xb920('0x9')](),controller[_0xb920('0x14')]);router['delete'](_0xb920('0xb'),auth['isAuthenticated'](),controller[_0xb920('0x15')]);module[_0xb920('0x16')]=router; \ No newline at end of file +var _0x91d6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x125a8a,_0x490d31){var _0xe767a5=function(_0x2a505c){while(--_0x2a505c){_0x125a8a['push'](_0x125a8a['shift']());}};_0xe767a5(++_0x490d31);}(_0x91d6,0xf9));var _0x691d=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x91d6[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require('multer');var util=require(_0x691d('0x0'));var path=require(_0x691d('0x1'));var timeout=require(_0x691d('0x2'));var express=require(_0x691d('0x3'));var router=express[_0x691d('0x4')]();var fs_extra=require(_0x691d('0x5'));var auth=require(_0x691d('0x6'));var interaction=require(_0x691d('0x7'));var config=require('../../config/environment');var controller=require(_0x691d('0x8'));router[_0x691d('0x9')]('/',auth['isAuthenticated'](),controller[_0x691d('0xa')]);router[_0x691d('0x9')](_0x691d('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/subjects',auth[_0x691d('0xc')](),controller[_0x691d('0xd')]);router[_0x691d('0x9')]('/:id/descriptions',auth[_0x691d('0xc')](),controller[_0x691d('0xe')]);router[_0x691d('0x9')](_0x691d('0xf'),auth[_0x691d('0xc')](),controller[_0x691d('0x10')]);router['post']('/',auth[_0x691d('0xc')](),controller[_0x691d('0x11')]);router[_0x691d('0x12')]('/:id',auth[_0x691d('0xc')](),controller[_0x691d('0x13')]);router[_0x691d('0x14')](_0x691d('0xb'),auth[_0x691d('0xc')](),controller[_0x691d('0x15')]);module[_0x691d('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 e044987..3cd5f6f 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 _0xeac0=['STRING','exports'];(function(_0x101c29,_0x18b9ea){var _0x518708=function(_0x479d64){while(--_0x479d64){_0x101c29['push'](_0x101c29['shift']());}};_0x518708(++_0x18b9ea);}(_0xeac0,0x103));var _0x0eac=function(_0x3cd11a,_0x2fc6f0){_0x3cd11a=_0x3cd11a-0x0;var _0x1e569b=_0xeac0[_0x3cd11a];return _0x1e569b;};'use strict';var Sequelize=require('sequelize');module[_0x0eac('0x0')]={'name':{'type':Sequelize[_0x0eac('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6ca4=['STRING'];(function(_0x2e6e12,_0x238fc4){var _0x4bebf6=function(_0x55643c){while(--_0x55643c){_0x2e6e12['push'](_0x2e6e12['shift']());}};_0x4bebf6(++_0x238fc4);}(_0x6ca4,0x8b));var _0x46ca=function(_0x87e7c5,_0x1a86db){_0x87e7c5=_0x87e7c5-0x0;var _0x3c10df=_0x6ca4[_0x87e7c5];return _0x3c10df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x46ca('0x0')]},'description':{'type':Sequelize[_0x46ca('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d2cfa43..3e64f2d 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 _0xa487=['map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','findOne','sort','getSubjects','getDescriptions','FreshsalesField','order','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','name'];(function(_0x24b12c,_0x14b083){var _0x75499a=function(_0x39d2e0){while(--_0x39d2e0){_0x24b12c['push'](_0x24b12c['shift']());}};_0x75499a(++_0x14b083);}(_0xa487,0x1d0));var _0x7a48=function(_0x416110,_0x4787ac){_0x416110=_0x416110-0x0;var _0x221b14=_0xa487[_0x416110];return _0x221b14;};'use strict';var emlformat=require(_0x7a48('0x0'));var rimraf=require(_0x7a48('0x1'));var zipdir=require(_0x7a48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7a48('0x3'));var moment=require(_0x7a48('0x4'));var BPromise=require(_0x7a48('0x5'));var Mustache=require(_0x7a48('0x6'));var util=require(_0x7a48('0x7'));var path=require(_0x7a48('0x8'));var sox=require(_0x7a48('0x9'));var csv=require(_0x7a48('0xa'));var ejs=require(_0x7a48('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a48('0xc'));var squel=require(_0x7a48('0xd'));var crypto=require(_0x7a48('0xe'));var jsforce=require(_0x7a48('0xf'));var deskjs=require(_0x7a48('0x10'));var toCsv=require(_0x7a48('0xa'));var querystring=require(_0x7a48('0x11'));var Papa=require(_0x7a48('0x12'));var Redis=require(_0x7a48('0x13'));var authService=require(_0x7a48('0x14'));var qs=require(_0x7a48('0x15'));var as=require(_0x7a48('0x16'));var hardwareService=require(_0x7a48('0x17'));var logger=require(_0x7a48('0x18'))(_0x7a48('0x19'));var utils=require(_0x7a48('0x1a'));var config=require(_0x7a48('0x1b'));var licenseUtil=require(_0x7a48('0x1c'));var db=require(_0x7a48('0x1d'))['db'];function respondWithStatusCode(_0x48e369,_0x3be731){_0x3be731=_0x3be731||0xcc;return function(_0xac9556){if(_0xac9556){return _0x48e369[_0x7a48('0x1e')](_0x3be731);}return _0x48e369[_0x7a48('0x1f')](_0x3be731)[_0x7a48('0x20')]();};}function respondWithResult(_0x515259,_0x2c3e5d){_0x2c3e5d=_0x2c3e5d||0xc8;return function(_0x5b0ae4){if(_0x5b0ae4){return _0x515259[_0x7a48('0x1f')](_0x2c3e5d)[_0x7a48('0x21')](_0x5b0ae4);}};}function respondWithFilteredResult(_0x570b16,_0xaca780){return function(_0x48cc15){if(_0x48cc15){var _0x555ffd=typeof _0xaca780[_0x7a48('0x22')]==='undefined'&&typeof _0xaca780[_0x7a48('0x23')]===_0x7a48('0x24');var _0x465916=_0x48cc15[_0x7a48('0x25')];var _0x4a15bd=_0x555ffd?0x0:_0xaca780[_0x7a48('0x22')];var _0xdbe861=_0x555ffd?_0x48cc15['count']:_0xaca780[_0x7a48('0x22')]+_0xaca780['limit'];var _0xff2ae3;if(_0xdbe861>=_0x465916){_0xdbe861=_0x465916;_0xff2ae3=0xc8;}else{_0xff2ae3=0xce;}_0x570b16[_0x7a48('0x1f')](_0xff2ae3);return _0x570b16[_0x7a48('0x26')](_0x7a48('0x27'),_0x4a15bd+'-'+_0xdbe861+'/'+_0x465916)[_0x7a48('0x21')](_0x48cc15);}return null;};}function patchUpdates(_0x4407ba){return function(_0xc649af){try{jsonpatch[_0x7a48('0x28')](_0xc649af,_0x4407ba,!![]);}catch(_0x31525f){return BPromise[_0x7a48('0x29')](_0x31525f);}return _0xc649af[_0x7a48('0x2a')]();};}function saveUpdates(_0x221364,_0x2da115){return function(_0x2124e5){if(_0x2124e5){return _0x2124e5['update'](_0x221364)['then'](function(_0x281820){return _0x281820;});}return null;};}function removeEntity(_0x1b207b,_0x48b9a0){return function(_0x2468ea){if(_0x2468ea){return _0x2468ea['destroy']()[_0x7a48('0x2b')](function(){_0x1b207b[_0x7a48('0x1f')](0xcc)[_0x7a48('0x20')]();});}};}function handleEntityNotFound(_0x4053c2,_0x3ed9c1){return function(_0x3e04f6){if(!_0x3e04f6){_0x4053c2[_0x7a48('0x1e')](0x194);}return _0x3e04f6;};}function handleError(_0x2d5486,_0x439994){_0x439994=_0x439994||0x1f4;return function(_0x2f7dd7){logger[_0x7a48('0x2c')](_0x2f7dd7['stack']);if(_0x2f7dd7[_0x7a48('0x2d')]){delete _0x2f7dd7[_0x7a48('0x2d')];}_0x2d5486[_0x7a48('0x1f')](_0x439994)['send'](_0x2f7dd7);};}exports['index']=function(_0x2c5b20,_0x481cac){var _0xb8f463={},_0x216b95={},_0x31ae7d={'count':0x0,'rows':[]};var _0x231a51=_[_0x7a48('0x2e')](db[_0x7a48('0x2f')][_0x7a48('0x30')],function(_0x46b935){return{'name':_0x46b935['fieldName'],'type':_0x46b935[_0x7a48('0x31')][_0x7a48('0x32')]};});_0x216b95[_0x7a48('0x33')]=_['map'](_0x231a51,'name');_0x216b95[_0x7a48('0x34')]=_[_0x7a48('0x35')](_0x2c5b20[_0x7a48('0x34')]);_0x216b95[_0x7a48('0x36')]=_[_0x7a48('0x37')](_0x216b95['model'],_0x216b95[_0x7a48('0x34')]);_0xb8f463['attributes']=_[_0x7a48('0x37')](_0x216b95[_0x7a48('0x33')],qs[_0x7a48('0x38')](_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x38')]));_0xb8f463[_0x7a48('0x39')]=_0xb8f463[_0x7a48('0x39')][_0x7a48('0x3a')]?_0xb8f463[_0x7a48('0x39')]:_0x216b95[_0x7a48('0x33')];if(!_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x3b')](_0x7a48('0x3c'))){_0xb8f463[_0x7a48('0x23')]=qs[_0x7a48('0x23')](_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x23')]);_0xb8f463['offset']=qs[_0x7a48('0x22')](_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x22')]);}_0xb8f463['order']=qs['sort'](_0x2c5b20[_0x7a48('0x34')]['sort']);_0xb8f463[_0x7a48('0x3d')]=qs['filters'](_[_0x7a48('0x3e')](_0x2c5b20[_0x7a48('0x34')],_0x216b95[_0x7a48('0x36')]),_0x231a51);if(_0x2c5b20['query'][_0x7a48('0x3f')]){_0xb8f463[_0x7a48('0x3d')]=_[_0x7a48('0x40')](_0xb8f463[_0x7a48('0x3d')],{'$or':_[_0x7a48('0x2e')](_0x231a51,function(_0x459f38){if(_0x459f38[_0x7a48('0x31')]!=='VIRTUAL'){var _0x9e97cd={};_0x9e97cd[_0x459f38[_0x7a48('0x2d')]]={'$like':'%'+_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x3f')]+'%'};return _0x9e97cd;}})});}_0xb8f463=_['merge']({},_0xb8f463,_0x2c5b20[_0x7a48('0x41')]);var _0x25f3f2={'where':_0xb8f463[_0x7a48('0x3d')]};return db['FreshsalesConfiguration']['count'](_0x25f3f2)[_0x7a48('0x2b')](function(_0x339995){_0x31ae7d[_0x7a48('0x25')]=_0x339995;if(_0x2c5b20[_0x7a48('0x34')][_0x7a48('0x42')]){_0xb8f463[_0x7a48('0x43')]=[{'all':!![]}];}return db[_0x7a48('0x2f')][_0x7a48('0x44')](_0xb8f463);})[_0x7a48('0x2b')](function(_0x50cd92){_0x31ae7d[_0x7a48('0x45')]=_0x50cd92;return _0x31ae7d;})[_0x7a48('0x2b')](respondWithFilteredResult(_0x481cac,_0xb8f463))[_0x7a48('0x46')](handleError(_0x481cac,null));};exports[_0x7a48('0x47')]=function(_0x258e47,_0x232141){var _0x315863={'raw':![],'where':{'id':_0x258e47[_0x7a48('0x48')]['id']}},_0x4d8887={};_0x4d8887[_0x7a48('0x33')]=_[_0x7a48('0x35')](db[_0x7a48('0x2f')]['rawAttributes']);_0x4d8887[_0x7a48('0x34')]=_[_0x7a48('0x35')](_0x258e47[_0x7a48('0x34')]);_0x4d8887[_0x7a48('0x36')]=_[_0x7a48('0x37')](_0x4d8887[_0x7a48('0x33')],_0x4d8887[_0x7a48('0x34')]);_0x315863['attributes']=_[_0x7a48('0x37')](_0x4d8887['model'],qs[_0x7a48('0x38')](_0x258e47[_0x7a48('0x34')][_0x7a48('0x38')]));_0x315863[_0x7a48('0x39')]=_0x315863[_0x7a48('0x39')]['length']?_0x315863['attributes']:_0x4d8887['model'];if(_0x258e47[_0x7a48('0x34')][_0x7a48('0x42')]){_0x315863[_0x7a48('0x43')]=[{'all':!![]}];}_0x315863=_[_0x7a48('0x40')]({},_0x315863,_0x258e47[_0x7a48('0x41')]);return db[_0x7a48('0x2f')]['find'](_0x315863)[_0x7a48('0x2b')](handleEntityNotFound(_0x232141,null))[_0x7a48('0x2b')](respondWithResult(_0x232141,null))[_0x7a48('0x46')](handleError(_0x232141,null));};exports['create']=function(_0x4cf5f9,_0x3348d7){return db['FreshsalesConfiguration'][_0x7a48('0x49')](_0x4cf5f9[_0x7a48('0x4a')],{})[_0x7a48('0x2b')](respondWithResult(_0x3348d7,0xc9))['catch'](handleError(_0x3348d7,null));};exports[_0x7a48('0x4b')]=function(_0x364998,_0x3de7b2){if(_0x364998[_0x7a48('0x4a')]['id']){delete _0x364998['body']['id'];}return db[_0x7a48('0x2f')]['find']({'where':{'id':_0x364998[_0x7a48('0x48')]['id']}})[_0x7a48('0x2b')](handleEntityNotFound(_0x3de7b2,null))[_0x7a48('0x2b')](saveUpdates(_0x364998['body'],null))[_0x7a48('0x2b')](respondWithResult(_0x3de7b2,null))['catch'](handleError(_0x3de7b2,null));};exports[_0x7a48('0x4c')]=function(_0x327947,_0x1c61fa){return db['FreshsalesConfiguration'][_0x7a48('0x4d')]({'where':{'id':_0x327947[_0x7a48('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c61fa,null))['then'](removeEntity(_0x1c61fa,null))[_0x7a48('0x46')](handleError(_0x1c61fa,null));};exports['getSubjects']=function(_0x584b47,_0x4881c9,_0x28d443){var _0x3a9c08={};var _0x5ccf01={};var _0x33ee20;var _0x3c441e;return db[_0x7a48('0x2f')][_0x7a48('0x4e')]({'where':{'id':_0x584b47[_0x7a48('0x48')]['id']}})[_0x7a48('0x2b')](handleEntityNotFound(_0x4881c9,null))[_0x7a48('0x2b')](function(_0x85f6f9){if(_0x85f6f9){_0x33ee20=_0x85f6f9;_0x5ccf01[_0x7a48('0x33')]=_[_0x7a48('0x35')](db['FreshsalesField']['rawAttributes']);_0x5ccf01[_0x7a48('0x34')]=_[_0x7a48('0x35')](_0x584b47['query']);_0x5ccf01['filters']=_[_0x7a48('0x37')](_0x5ccf01[_0x7a48('0x33')],_0x5ccf01[_0x7a48('0x34')]);_0x3a9c08[_0x7a48('0x39')]=_[_0x7a48('0x37')](_0x5ccf01[_0x7a48('0x33')],qs['fields'](_0x584b47[_0x7a48('0x34')][_0x7a48('0x38')]));_0x3a9c08['attributes']=_0x3a9c08[_0x7a48('0x39')][_0x7a48('0x3a')]?_0x3a9c08['attributes']:_0x5ccf01[_0x7a48('0x33')];_0x3a9c08['order']=qs[_0x7a48('0x4f')](_0x584b47[_0x7a48('0x34')][_0x7a48('0x4f')]);_0x3a9c08[_0x7a48('0x3d')]=qs[_0x7a48('0x36')](_[_0x7a48('0x3e')](_0x584b47[_0x7a48('0x34')],_0x5ccf01['filters']));if(_0x584b47[_0x7a48('0x34')]['filter']){_0x3a9c08[_0x7a48('0x3d')]=_['merge'](_0x3a9c08[_0x7a48('0x3d')],{'$or':_[_0x7a48('0x2e')](_0x3a9c08[_0x7a48('0x39')],function(_0x1dde8e){var _0x442f6d={};_0x442f6d[_0x1dde8e]={'$like':'%'+_0x584b47[_0x7a48('0x34')][_0x7a48('0x3f')]+'%'};return _0x442f6d;})});}_0x3a9c08=_[_0x7a48('0x40')]({},_0x3a9c08,_0x584b47['options']);return _0x33ee20[_0x7a48('0x50')](_0x3a9c08);}})['then'](function(_0xfde693){if(_0xfde693){_0x3c441e=_0xfde693[_0x7a48('0x3a')];if(!_0x584b47[_0x7a48('0x34')]['hasOwnProperty']('nolimit')){_0x3a9c08[_0x7a48('0x23')]=qs[_0x7a48('0x23')](_0x584b47['query'][_0x7a48('0x23')]);_0x3a9c08[_0x7a48('0x22')]=qs[_0x7a48('0x22')](_0x584b47[_0x7a48('0x34')]['offset']);}return _0x33ee20[_0x7a48('0x50')](_0x3a9c08);}})[_0x7a48('0x2b')](function(_0x1c6aaa){if(_0x1c6aaa){return _0x1c6aaa?{'count':_0x3c441e,'rows':_0x1c6aaa}:null;}})[_0x7a48('0x2b')](respondWithResult(_0x4881c9,null))[_0x7a48('0x46')](handleError(_0x4881c9,null));};exports[_0x7a48('0x51')]=function(_0x355e36,_0x1e52dd,_0x59c965){var _0x54e603={};var _0x3f2a89={};var _0x5cf2b0;var _0x2934ee;return db[_0x7a48('0x2f')][_0x7a48('0x4e')]({'where':{'id':_0x355e36[_0x7a48('0x48')]['id']}})[_0x7a48('0x2b')](handleEntityNotFound(_0x1e52dd,null))[_0x7a48('0x2b')](function(_0x8852df){if(_0x8852df){_0x5cf2b0=_0x8852df;_0x3f2a89[_0x7a48('0x33')]=_[_0x7a48('0x35')](db[_0x7a48('0x52')]['rawAttributes']);_0x3f2a89[_0x7a48('0x34')]=_[_0x7a48('0x35')](_0x355e36[_0x7a48('0x34')]);_0x3f2a89[_0x7a48('0x36')]=_[_0x7a48('0x37')](_0x3f2a89[_0x7a48('0x33')],_0x3f2a89[_0x7a48('0x34')]);_0x54e603[_0x7a48('0x39')]=_['intersection'](_0x3f2a89[_0x7a48('0x33')],qs[_0x7a48('0x38')](_0x355e36[_0x7a48('0x34')][_0x7a48('0x38')]));_0x54e603[_0x7a48('0x39')]=_0x54e603['attributes']['length']?_0x54e603[_0x7a48('0x39')]:_0x3f2a89[_0x7a48('0x33')];_0x54e603[_0x7a48('0x53')]=qs[_0x7a48('0x4f')](_0x355e36['query'][_0x7a48('0x4f')]);_0x54e603[_0x7a48('0x3d')]=qs[_0x7a48('0x36')](_['pick'](_0x355e36[_0x7a48('0x34')],_0x3f2a89[_0x7a48('0x36')]));if(_0x355e36[_0x7a48('0x34')]['filter']){_0x54e603[_0x7a48('0x3d')]=_[_0x7a48('0x40')](_0x54e603[_0x7a48('0x3d')],{'$or':_['map'](_0x54e603[_0x7a48('0x39')],function(_0x86e682){var _0x3fb64a={};_0x3fb64a[_0x86e682]={'$like':'%'+_0x355e36[_0x7a48('0x34')][_0x7a48('0x3f')]+'%'};return _0x3fb64a;})});}_0x54e603=_[_0x7a48('0x40')]({},_0x54e603,_0x355e36[_0x7a48('0x41')]);return _0x5cf2b0['getDescriptions'](_0x54e603);}})[_0x7a48('0x2b')](function(_0x434707){if(_0x434707){_0x2934ee=_0x434707['length'];if(!_0x355e36[_0x7a48('0x34')][_0x7a48('0x3b')](_0x7a48('0x3c'))){_0x54e603[_0x7a48('0x23')]=qs['limit'](_0x355e36[_0x7a48('0x34')][_0x7a48('0x23')]);_0x54e603[_0x7a48('0x22')]=qs[_0x7a48('0x22')](_0x355e36[_0x7a48('0x34')]['offset']);}return _0x5cf2b0[_0x7a48('0x51')](_0x54e603);}})[_0x7a48('0x2b')](function(_0x12c86f){if(_0x12c86f){return _0x12c86f?{'count':_0x2934ee,'rows':_0x12c86f}:null;}})['then'](respondWithResult(_0x1e52dd,null))[_0x7a48('0x46')](handleError(_0x1e52dd,null));};exports[_0x7a48('0x54')]=function(_0x36aaa2,_0x336fc7,_0x228726){var _0x5cb10b={};var _0x6079c8={};var _0xf8a08d;var _0x28fe86;return db['FreshsalesConfiguration'][_0x7a48('0x4e')]({'where':{'id':_0x36aaa2['params']['id']}})[_0x7a48('0x2b')](handleEntityNotFound(_0x336fc7,null))[_0x7a48('0x2b')](function(_0x4a999e){if(_0x4a999e){_0xf8a08d=_0x4a999e;_0x6079c8[_0x7a48('0x33')]=_[_0x7a48('0x35')](db[_0x7a48('0x52')][_0x7a48('0x30')]);_0x6079c8[_0x7a48('0x34')]=_[_0x7a48('0x35')](_0x36aaa2['query']);_0x6079c8['filters']=_[_0x7a48('0x37')](_0x6079c8[_0x7a48('0x33')],_0x6079c8[_0x7a48('0x34')]);_0x5cb10b[_0x7a48('0x39')]=_[_0x7a48('0x37')](_0x6079c8[_0x7a48('0x33')],qs['fields'](_0x36aaa2[_0x7a48('0x34')]['fields']));_0x5cb10b[_0x7a48('0x39')]=_0x5cb10b['attributes']['length']?_0x5cb10b[_0x7a48('0x39')]:_0x6079c8[_0x7a48('0x33')];_0x5cb10b[_0x7a48('0x53')]=qs[_0x7a48('0x4f')](_0x36aaa2[_0x7a48('0x34')][_0x7a48('0x4f')]);_0x5cb10b[_0x7a48('0x3d')]=qs[_0x7a48('0x36')](_[_0x7a48('0x3e')](_0x36aaa2[_0x7a48('0x34')],_0x6079c8[_0x7a48('0x36')]));if(_0x36aaa2[_0x7a48('0x34')]['filter']){_0x5cb10b['where']=_['merge'](_0x5cb10b[_0x7a48('0x3d')],{'$or':_[_0x7a48('0x2e')](_0x5cb10b[_0x7a48('0x39')],function(_0x1f8fb4){var _0x259f5f={};_0x259f5f[_0x1f8fb4]={'$like':'%'+_0x36aaa2[_0x7a48('0x34')][_0x7a48('0x3f')]+'%'};return _0x259f5f;})});}_0x5cb10b=_[_0x7a48('0x40')]({},_0x5cb10b,_0x36aaa2[_0x7a48('0x41')]);return _0xf8a08d['getFields'](_0x5cb10b);}})[_0x7a48('0x2b')](function(_0x53a348){if(_0x53a348){_0x28fe86=_0x53a348['length'];if(!_0x36aaa2[_0x7a48('0x34')][_0x7a48('0x3b')](_0x7a48('0x3c'))){_0x5cb10b[_0x7a48('0x23')]=qs[_0x7a48('0x23')](_0x36aaa2[_0x7a48('0x34')][_0x7a48('0x23')]);_0x5cb10b[_0x7a48('0x22')]=qs[_0x7a48('0x22')](_0x36aaa2['query'][_0x7a48('0x22')]);}return _0xf8a08d[_0x7a48('0x54')](_0x5cb10b);}})['then'](function(_0x2601a0){if(_0x2601a0){return _0x2601a0?{'count':_0x28fe86,'rows':_0x2601a0}:null;}})['then'](respondWithResult(_0x336fc7,null))[_0x7a48('0x46')](handleError(_0x336fc7,null));}; \ No newline at end of file +var _0x68cf=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','reject','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','rows','catch','show','length','includeAll','include','find','create','update','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x68cf,0x129));var _0xf68c=function(_0x1cf980,_0x4177f3){_0x1cf980=_0x1cf980-0x0;var _0x59e3c0=_0x68cf[_0x1cf980];return _0x59e3c0;};'use strict';var emlformat=require(_0xf68c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf68c('0x1'));var jsonpatch=require(_0xf68c('0x2'));var rp=require('request-promise');var moment=require(_0xf68c('0x3'));var BPromise=require(_0xf68c('0x4'));var Mustache=require(_0xf68c('0x5'));var util=require(_0xf68c('0x6'));var path=require('path');var sox=require(_0xf68c('0x7'));var csv=require(_0xf68c('0x8'));var ejs=require(_0xf68c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf68c('0xa'));var squel=require(_0xf68c('0xb'));var crypto=require(_0xf68c('0xc'));var jsforce=require(_0xf68c('0xd'));var deskjs=require(_0xf68c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf68c('0xf'));var Redis=require(_0xf68c('0x10'));var authService=require(_0xf68c('0x11'));var qs=require(_0xf68c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf68c('0x13'))(_0xf68c('0x14'));var utils=require(_0xf68c('0x15'));var config=require(_0xf68c('0x16'));var licenseUtil=require(_0xf68c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1fc1,_0x1c52bd){_0x1c52bd=_0x1c52bd||0xcc;return function(_0x4b98c2){if(_0x4b98c2){return _0x3b1fc1[_0xf68c('0x18')](_0x1c52bd);}return _0x3b1fc1[_0xf68c('0x19')](_0x1c52bd)[_0xf68c('0x1a')]();};}function respondWithResult(_0x195487,_0x28fc97){_0x28fc97=_0x28fc97||0xc8;return function(_0x583531){if(_0x583531){return _0x195487[_0xf68c('0x19')](_0x28fc97)[_0xf68c('0x1b')](_0x583531);}};}function respondWithFilteredResult(_0x2d6e97,_0x47d8ca){return function(_0x2abe86){if(_0x2abe86){var _0x16e556=typeof _0x47d8ca[_0xf68c('0x1c')]==='undefined'&&typeof _0x47d8ca[_0xf68c('0x1d')]==='undefined';var _0x363e47=_0x2abe86[_0xf68c('0x1e')];var _0x528ba9=_0x16e556?0x0:_0x47d8ca['offset'];var _0x50cffc=_0x16e556?_0x2abe86[_0xf68c('0x1e')]:_0x47d8ca['offset']+_0x47d8ca[_0xf68c('0x1d')];var _0x4e9db5;if(_0x50cffc>=_0x363e47){_0x50cffc=_0x363e47;_0x4e9db5=0xc8;}else{_0x4e9db5=0xce;}_0x2d6e97['status'](_0x4e9db5);return _0x2d6e97[_0xf68c('0x1f')]('Content-Range',_0x528ba9+'-'+_0x50cffc+'/'+_0x363e47)[_0xf68c('0x1b')](_0x2abe86);}return null;};}function patchUpdates(_0x1801cb){return function(_0x161fcc){try{jsonpatch[_0xf68c('0x20')](_0x161fcc,_0x1801cb,!![]);}catch(_0x29c679){return BPromise[_0xf68c('0x21')](_0x29c679);}return _0x161fcc['save']();};}function saveUpdates(_0xc9ad75,_0x1f679d){return function(_0x41cf1d){if(_0x41cf1d){return _0x41cf1d['update'](_0xc9ad75)[_0xf68c('0x22')](function(_0x550bcf){return _0x550bcf;});}return null;};}function removeEntity(_0x2b3cf0,_0x492832){return function(_0x3ee437){if(_0x3ee437){return _0x3ee437[_0xf68c('0x23')]()['then'](function(){_0x2b3cf0[_0xf68c('0x19')](0xcc)[_0xf68c('0x1a')]();});}};}function handleEntityNotFound(_0x59ce09,_0xbc5d4b){return function(_0x3bf3c6){if(!_0x3bf3c6){_0x59ce09['sendStatus'](0x194);}return _0x3bf3c6;};}function handleError(_0x49c131,_0x2efc46){_0x2efc46=_0x2efc46||0x1f4;return function(_0x2b614c){logger['error'](_0x2b614c[_0xf68c('0x24')]);if(_0x2b614c[_0xf68c('0x25')]){delete _0x2b614c[_0xf68c('0x25')];}_0x49c131[_0xf68c('0x19')](_0x2efc46)[_0xf68c('0x26')](_0x2b614c);};}exports[_0xf68c('0x27')]=function(_0x17911e,_0x382ec3){var _0x4682bf={},_0x7c0af={},_0x428587={'count':0x0,'rows':[]};var _0x3af067=_[_0xf68c('0x28')](db[_0xf68c('0x29')][_0xf68c('0x2a')],function(_0x1f679c){return{'name':_0x1f679c[_0xf68c('0x2b')],'type':_0x1f679c['type'][_0xf68c('0x2c')]};});_0x7c0af[_0xf68c('0x2d')]=_[_0xf68c('0x28')](_0x3af067,_0xf68c('0x25'));_0x7c0af['query']=_[_0xf68c('0x2e')](_0x17911e[_0xf68c('0x2f')]);_0x7c0af[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x7c0af[_0xf68c('0x2d')],_0x7c0af[_0xf68c('0x2f')]);_0x4682bf[_0xf68c('0x32')]=_['intersection'](_0x7c0af[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x17911e['query'][_0xf68c('0x33')]));_0x4682bf[_0xf68c('0x32')]=_0x4682bf[_0xf68c('0x32')]['length']?_0x4682bf['attributes']:_0x7c0af[_0xf68c('0x2d')];if(!_0x17911e[_0xf68c('0x2f')][_0xf68c('0x34')]('nolimit')){_0x4682bf[_0xf68c('0x1d')]=qs[_0xf68c('0x1d')](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x1d')]);_0x4682bf['offset']=qs['offset'](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x1c')]);}_0x4682bf[_0xf68c('0x35')]=qs[_0xf68c('0x36')](_0x17911e[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x4682bf[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_['pick'](_0x17911e[_0xf68c('0x2f')],_0x7c0af[_0xf68c('0x30')]),_0x3af067);if(_0x17911e[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x4682bf[_0xf68c('0x37')]=_[_0xf68c('0x39')](_0x4682bf[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x3af067,function(_0x38f15c){if(_0x38f15c[_0xf68c('0x3a')]!==_0xf68c('0x3b')){var _0x4265f7={};_0x4265f7[_0x38f15c[_0xf68c('0x25')]]={'$like':'%'+_0x17911e[_0xf68c('0x2f')]['filter']+'%'};return _0x4265f7;}})});}_0x4682bf=_[_0xf68c('0x39')]({},_0x4682bf,_0x17911e[_0xf68c('0x3c')]);var _0x564d00={'where':_0x4682bf[_0xf68c('0x37')]};return db['FreshsalesConfiguration']['count'](_0x564d00)[_0xf68c('0x22')](function(_0x200441){_0x428587[_0xf68c('0x1e')]=_0x200441;if(_0x17911e[_0xf68c('0x2f')]['includeAll']){_0x4682bf['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x4682bf);})['then'](function(_0x579c5b){_0x428587[_0xf68c('0x3d')]=_0x579c5b;return _0x428587;})[_0xf68c('0x22')](respondWithFilteredResult(_0x382ec3,_0x4682bf))[_0xf68c('0x3e')](handleError(_0x382ec3,null));};exports[_0xf68c('0x3f')]=function(_0x5b0270,_0x46d9ae){var _0x42927a={'raw':![],'where':{'id':_0x5b0270['params']['id']}},_0x508e4a={};_0x508e4a[_0xf68c('0x2d')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x508e4a['query']=_['keys'](_0x5b0270['query']);_0x508e4a[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x508e4a['model'],_0x508e4a['query']);_0x42927a[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x508e4a[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x5b0270[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x42927a[_0xf68c('0x32')]=_0x42927a[_0xf68c('0x32')][_0xf68c('0x40')]?_0x42927a[_0xf68c('0x32')]:_0x508e4a[_0xf68c('0x2d')];if(_0x5b0270[_0xf68c('0x2f')][_0xf68c('0x41')]){_0x42927a[_0xf68c('0x42')]=[{'all':!![]}];}_0x42927a=_[_0xf68c('0x39')]({},_0x42927a,_0x5b0270[_0xf68c('0x3c')]);return db[_0xf68c('0x29')][_0xf68c('0x43')](_0x42927a)[_0xf68c('0x22')](handleEntityNotFound(_0x46d9ae,null))[_0xf68c('0x22')](respondWithResult(_0x46d9ae,null))[_0xf68c('0x3e')](handleError(_0x46d9ae,null));};exports[_0xf68c('0x44')]=function(_0x2b25e9,_0x25c453){return db[_0xf68c('0x29')][_0xf68c('0x44')](_0x2b25e9['body'],{})[_0xf68c('0x22')](respondWithResult(_0x25c453,0xc9))[_0xf68c('0x3e')](handleError(_0x25c453,null));};exports[_0xf68c('0x45')]=function(_0xa76ac9,_0x39b247){if(_0xa76ac9[_0xf68c('0x46')]['id']){delete _0xa76ac9[_0xf68c('0x46')]['id'];}return db[_0xf68c('0x29')][_0xf68c('0x43')]({'where':{'id':_0xa76ac9[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x39b247,null))['then'](saveUpdates(_0xa76ac9[_0xf68c('0x46')],null))[_0xf68c('0x22')](respondWithResult(_0x39b247,null))[_0xf68c('0x3e')](handleError(_0x39b247,null));};exports[_0xf68c('0x23')]=function(_0x186155,_0x375005){return db[_0xf68c('0x29')][_0xf68c('0x43')]({'where':{'id':_0x186155[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x375005,null))[_0xf68c('0x22')](removeEntity(_0x375005,null))[_0xf68c('0x3e')](handleError(_0x375005,null));};exports[_0xf68c('0x48')]=function(_0x57de17,_0x400b00,_0x2a0269){var _0x3b9d65={};var _0x4f5d9e={};var _0x4298a5;var _0x3774a3;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x57de17[_0xf68c('0x47')]['id']}})['then'](handleEntityNotFound(_0x400b00,null))[_0xf68c('0x22')](function(_0xf6dc67){if(_0xf6dc67){_0x4298a5=_0xf6dc67;_0x4f5d9e[_0xf68c('0x2d')]=_[_0xf68c('0x2e')](db[_0xf68c('0x4a')][_0xf68c('0x2a')]);_0x4f5d9e[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x57de17[_0xf68c('0x2f')]);_0x4f5d9e[_0xf68c('0x30')]=_[_0xf68c('0x31')](_0x4f5d9e[_0xf68c('0x2d')],_0x4f5d9e[_0xf68c('0x2f')]);_0x3b9d65[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x4f5d9e[_0xf68c('0x2d')],qs['fields'](_0x57de17[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x3b9d65['attributes']=_0x3b9d65[_0xf68c('0x32')][_0xf68c('0x40')]?_0x3b9d65['attributes']:_0x4f5d9e[_0xf68c('0x2d')];_0x3b9d65['order']=qs[_0xf68c('0x36')](_0x57de17[_0xf68c('0x2f')]['sort']);_0x3b9d65['where']=qs[_0xf68c('0x30')](_['pick'](_0x57de17[_0xf68c('0x2f')],_0x4f5d9e[_0xf68c('0x30')]));if(_0x57de17[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x3b9d65[_0xf68c('0x37')]=_['merge'](_0x3b9d65[_0xf68c('0x37')],{'$or':_['map'](_0x3b9d65[_0xf68c('0x32')],function(_0x56f32d){var _0x3ba038={};_0x3ba038[_0x56f32d]={'$like':'%'+_0x57de17[_0xf68c('0x2f')][_0xf68c('0x38')]+'%'};return _0x3ba038;})});}_0x3b9d65=_['merge']({},_0x3b9d65,_0x57de17[_0xf68c('0x3c')]);return _0x4298a5['getSubjects'](_0x3b9d65);}})[_0xf68c('0x22')](function(_0x7501c8){if(_0x7501c8){_0x3774a3=_0x7501c8[_0xf68c('0x40')];if(!_0x57de17[_0xf68c('0x2f')]['hasOwnProperty']('nolimit')){_0x3b9d65['limit']=qs[_0xf68c('0x1d')](_0x57de17['query']['limit']);_0x3b9d65[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x57de17[_0xf68c('0x2f')]['offset']);}return _0x4298a5['getSubjects'](_0x3b9d65);}})['then'](function(_0x24eaa5){if(_0x24eaa5){return _0x24eaa5?{'count':_0x3774a3,'rows':_0x24eaa5}:null;}})[_0xf68c('0x22')](respondWithResult(_0x400b00,null))[_0xf68c('0x3e')](handleError(_0x400b00,null));};exports[_0xf68c('0x4b')]=function(_0x2ef7d1,_0x41acbb,_0xb71fc7){var _0x2c83d0={};var _0x1f7819={};var _0x226c2d;var _0x5a176f;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x2ef7d1[_0xf68c('0x47')]['id']}})[_0xf68c('0x22')](handleEntityNotFound(_0x41acbb,null))[_0xf68c('0x22')](function(_0x2c4ffe){if(_0x2c4ffe){_0x226c2d=_0x2c4ffe;_0x1f7819[_0xf68c('0x2d')]=_['keys'](db['FreshsalesField'][_0xf68c('0x2a')]);_0x1f7819[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x2ef7d1[_0xf68c('0x2f')]);_0x1f7819['filters']=_[_0xf68c('0x31')](_0x1f7819[_0xf68c('0x2d')],_0x1f7819['query']);_0x2c83d0[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x1f7819['model'],qs[_0xf68c('0x33')](_0x2ef7d1[_0xf68c('0x2f')]['fields']));_0x2c83d0[_0xf68c('0x32')]=_0x2c83d0['attributes'][_0xf68c('0x40')]?_0x2c83d0[_0xf68c('0x32')]:_0x1f7819[_0xf68c('0x2d')];_0x2c83d0['order']=qs['sort'](_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x2c83d0[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_[_0xf68c('0x4c')](_0x2ef7d1[_0xf68c('0x2f')],_0x1f7819[_0xf68c('0x30')]));if(_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x2c83d0[_0xf68c('0x37')]=_[_0xf68c('0x39')](_0x2c83d0[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x2c83d0['attributes'],function(_0x31820c){var _0x283630={};_0x283630[_0x31820c]={'$like':'%'+_0x2ef7d1[_0xf68c('0x2f')][_0xf68c('0x38')]+'%'};return _0x283630;})});}_0x2c83d0=_['merge']({},_0x2c83d0,_0x2ef7d1[_0xf68c('0x3c')]);return _0x226c2d[_0xf68c('0x4b')](_0x2c83d0);}})['then'](function(_0x444688){if(_0x444688){_0x5a176f=_0x444688['length'];if(!_0x2ef7d1[_0xf68c('0x2f')]['hasOwnProperty']('nolimit')){_0x2c83d0[_0xf68c('0x1d')]=qs[_0xf68c('0x1d')](_0x2ef7d1['query'][_0xf68c('0x1d')]);_0x2c83d0[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x2ef7d1['query'][_0xf68c('0x1c')]);}return _0x226c2d[_0xf68c('0x4b')](_0x2c83d0);}})[_0xf68c('0x22')](function(_0x5e0f94){if(_0x5e0f94){return _0x5e0f94?{'count':_0x5a176f,'rows':_0x5e0f94}:null;}})[_0xf68c('0x22')](respondWithResult(_0x41acbb,null))[_0xf68c('0x3e')](handleError(_0x41acbb,null));};exports[_0xf68c('0x4d')]=function(_0x3f352b,_0x1ba78c,_0x298fd1){var _0x13d8dd={};var _0x269d0d={};var _0x56ab0e;var _0x1ff84c;return db[_0xf68c('0x29')][_0xf68c('0x49')]({'where':{'id':_0x3f352b[_0xf68c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ba78c,null))[_0xf68c('0x22')](function(_0x2d6931){if(_0x2d6931){_0x56ab0e=_0x2d6931;_0x269d0d[_0xf68c('0x2d')]=_[_0xf68c('0x2e')](db['FreshsalesField'][_0xf68c('0x2a')]);_0x269d0d[_0xf68c('0x2f')]=_[_0xf68c('0x2e')](_0x3f352b['query']);_0x269d0d[_0xf68c('0x30')]=_['intersection'](_0x269d0d['model'],_0x269d0d['query']);_0x13d8dd[_0xf68c('0x32')]=_[_0xf68c('0x31')](_0x269d0d[_0xf68c('0x2d')],qs[_0xf68c('0x33')](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x33')]));_0x13d8dd[_0xf68c('0x32')]=_0x13d8dd['attributes']['length']?_0x13d8dd[_0xf68c('0x32')]:_0x269d0d[_0xf68c('0x2d')];_0x13d8dd['order']=qs['sort'](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x36')]);_0x13d8dd[_0xf68c('0x37')]=qs[_0xf68c('0x30')](_[_0xf68c('0x4c')](_0x3f352b['query'],_0x269d0d[_0xf68c('0x30')]));if(_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x38')]){_0x13d8dd[_0xf68c('0x37')]=_['merge'](_0x13d8dd[_0xf68c('0x37')],{'$or':_[_0xf68c('0x28')](_0x13d8dd['attributes'],function(_0x21b4dc){var _0x245b50={};_0x245b50[_0x21b4dc]={'$like':'%'+_0x3f352b[_0xf68c('0x2f')]['filter']+'%'};return _0x245b50;})});}_0x13d8dd=_[_0xf68c('0x39')]({},_0x13d8dd,_0x3f352b['options']);return _0x56ab0e['getFields'](_0x13d8dd);}})['then'](function(_0x51b0a8){if(_0x51b0a8){_0x1ff84c=_0x51b0a8['length'];if(!_0x3f352b['query']['hasOwnProperty'](_0xf68c('0x4e'))){_0x13d8dd['limit']=qs[_0xf68c('0x1d')](_0x3f352b[_0xf68c('0x2f')]['limit']);_0x13d8dd[_0xf68c('0x1c')]=qs[_0xf68c('0x1c')](_0x3f352b[_0xf68c('0x2f')][_0xf68c('0x1c')]);}return _0x56ab0e['getFields'](_0x13d8dd);}})['then'](function(_0x395459){if(_0x395459){return _0x395459?{'count':_0x1ff84c,'rows':_0x395459}:null;}})[_0xf68c('0x22')](respondWithResult(_0x1ba78c,null))[_0xf68c('0x3e')](handleError(_0x1ba78c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1edd66f..a00a7e4 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 _0x786a=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','api','bluebird','request-promise','path'];(function(_0x1ea763,_0x586717){var _0x33f6fd=function(_0x8f4187){while(--_0x8f4187){_0x1ea763['push'](_0x1ea763['shift']());}};_0x33f6fd(++_0x586717);}(_0x786a,0x1db));var _0xa786=function(_0x26cd45,_0x470f0a){_0x26cd45=_0x26cd45-0x0;var _0x2802d6=_0x786a[_0x26cd45];return _0x2802d6;};'use strict';var _=require(_0xa786('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa786('0x1'));var moment=require('moment');var BPromise=require(_0xa786('0x2'));var rp=require(_0xa786('0x3'));var fs=require('fs');var path=require(_0xa786('0x4'));var rimraf=require(_0xa786('0x5'));var config=require(_0xa786('0x6'));var attributes=require(_0xa786('0x7'));module['exports']=function(_0x55568b,_0x17a48a){return _0x55568b[_0xa786('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0xa786('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49d5=['define','int_freshsales_configurations','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x49d5,0x9b));var _0x549d=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x49d5[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x549d('0x0'));var util=require('util');var logger=require(_0x549d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x549d('0x2'));var fs=require('fs');var path=require(_0x549d('0x3'));var rimraf=require(_0x549d('0x4'));var config=require(_0x549d('0x5'));var attributes=require(_0x549d('0x6'));module['exports']=function(_0xaa9cff,_0x5c99e1){return _0xaa9cff[_0x549d('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0x549d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 3c2c073..d17c5bb 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 _0x956e=['http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xdc4265,_0x1d1559){var _0x3bcdba=function(_0x80c87){while(--_0x80c87){_0xdc4265['push'](_0xdc4265['shift']());}};_0x3bcdba(++_0x1d1559);}(_0x956e,0xf8));var _0xe956=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x956e[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require('lodash');var util=require(_0xe956('0x0'));var moment=require(_0xe956('0x1'));var BPromise=require(_0xe956('0x2'));var rs=require(_0xe956('0x3'));var fs=require('fs');var Redis=require(_0xe956('0x4'));var db=require(_0xe956('0x5'))['db'];var utils=require(_0xe956('0x6'));var logger=require(_0xe956('0x7'))(_0xe956('0x8'));var config=require(_0xe956('0x9'));var jayson=require(_0xe956('0xa'));var client=jayson[_0xe956('0xb')][_0xe956('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13f68,_0x1fb120,_0x3babc7){return new BPromise(function(_0x4f8d50,_0x524a7e){return client[_0xe956('0xd')](_0x13f68,_0x3babc7)[_0xe956('0xe')](function(_0x2cb548){logger['info'](_0xe956('0xf'),_0x1fb120,_0xe956('0x10'));logger[_0xe956('0x11')](_0xe956('0x12'),_0x1fb120,_0xe956('0x10'),JSON[_0xe956('0x13')](_0x2cb548));if(_0x2cb548[_0xe956('0x14')]){if(_0x2cb548[_0xe956('0x14')][_0xe956('0x15')]===0x1f4){logger['error'](_0xe956('0xf'),_0x1fb120,_0x2cb548[_0xe956('0x14')]['message']);return _0x524a7e(_0x2cb548[_0xe956('0x14')]['message']);}logger[_0xe956('0x14')](_0xe956('0xf'),_0x1fb120,_0x2cb548[_0xe956('0x14')][_0xe956('0x16')]);return _0x4f8d50(_0x2cb548[_0xe956('0x14')][_0xe956('0x16')]);}else{logger[_0xe956('0x17')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1fb120,'request\x20sent');_0x4f8d50(_0x2cb548[_0xe956('0x18')][_0xe956('0x16')]);}})[_0xe956('0x19')](function(_0x66e6cb){logger[_0xe956('0x14')](_0xe956('0xf'),_0x1fb120,_0x66e6cb);_0x524a7e(_0x66e6cb);});});} \ No newline at end of file +var _0xb728=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xb728,0x14d));var _0x8b72=function(_0x52b4f2,_0x5b1a64){_0x52b4f2=_0x52b4f2-0x0;var _0x1e07eb=_0xb728[_0x52b4f2];return _0x1e07eb;};'use strict';var _=require(_0x8b72('0x0'));var util=require(_0x8b72('0x1'));var moment=require(_0x8b72('0x2'));var BPromise=require(_0x8b72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b72('0x4'));var db=require(_0x8b72('0x5'))['db'];var utils=require(_0x8b72('0x6'));var logger=require('../../config/logger')(_0x8b72('0x7'));var config=require(_0x8b72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b72('0x9')][_0x8b72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f402a,_0x34edd1,_0xc67b71){return new BPromise(function(_0x450aee,_0x2e1d98){return client[_0x8b72('0xb')](_0x4f402a,_0xc67b71)['then'](function(_0x228669){logger['info'](_0x8b72('0xc'),_0x34edd1,'request\x20sent');logger['debug'](_0x8b72('0xd'),_0x34edd1,_0x8b72('0xe'),JSON[_0x8b72('0xf')](_0x228669));if(_0x228669[_0x8b72('0x10')]){if(_0x228669['error'][_0x8b72('0x11')]===0x1f4){logger[_0x8b72('0x10')](_0x8b72('0xc'),_0x34edd1,_0x228669['error']['message']);return _0x2e1d98(_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x34edd1,_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);return _0x450aee(_0x228669[_0x8b72('0x10')][_0x8b72('0x12')]);}else{logger[_0x8b72('0x13')](_0x8b72('0xc'),_0x34edd1,'request\x20sent');_0x450aee(_0x228669[_0x8b72('0x14')][_0x8b72('0x12')]);}})[_0x8b72('0x15')](function(_0x581c46){logger[_0x8b72('0x10')](_0x8b72('0xc'),_0x34edd1,_0x581c46);_0x2e1d98(_0x581c46);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bd2bfa6..7cef9fa 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 _0xd2ce=['get','index','/:id','show','isAuthenticated','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc77379,_0x5977d6){var _0x497fc5=function(_0x48a211){while(--_0x48a211){_0xc77379['push'](_0xc77379['shift']());}};_0x497fc5(++_0x5977d6);}(_0xd2ce,0x13c));var _0xed2c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd2ce[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require('multer');var util=require(_0xed2c('0x0'));var path=require('path');var timeout=require(_0xed2c('0x1'));var express=require(_0xed2c('0x2'));var router=express[_0xed2c('0x3')]();var fs_extra=require(_0xed2c('0x4'));var auth=require(_0xed2c('0x5'));var interaction=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xed2c('0x8')]('/',auth['isAuthenticated'](),controller[_0xed2c('0x9')]);router[_0xed2c('0x8')](_0xed2c('0xa'),auth['isAuthenticated'](),controller[_0xed2c('0xb')]);router['post']('/',auth[_0xed2c('0xc')](),controller[_0xed2c('0xd')]);router['put']('/:id',auth[_0xed2c('0xc')](),controller[_0xed2c('0xe')]);router[_0xed2c('0xf')](_0xed2c('0xa'),auth['isAuthenticated'](),controller[_0xed2c('0x10')]);module[_0xed2c('0x11')]=router; \ No newline at end of file +var _0x6364=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6364,0x8f));var _0x4636=function(_0x507e43,_0x40ad84){_0x507e43=_0x507e43-0x0;var _0x5e5df6=_0x6364[_0x507e43];return _0x5e5df6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4636('0x0'));var timeout=require(_0x4636('0x1'));var express=require(_0x4636('0x2'));var router=express[_0x4636('0x3')]();var fs_extra=require(_0x4636('0x4'));var auth=require(_0x4636('0x5'));var interaction=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4636('0x8')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xa')]);router[_0x4636('0x8')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0xc')]);router[_0x4636('0xd')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xe')]);router['put'](_0x4636('0xb'),auth[_0x4636('0x9')](),controller[_0x4636('0xf')]);router[_0x4636('0x10')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0x11')]);module[_0x4636('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 458748f..53a8786 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 _0xcf38=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xcf38,0xb1));var _0x8cf3=function(_0x520f1a,_0x52350f){_0x520f1a=_0x520f1a-0x0;var _0x39041a=_0xcf38[_0x520f1a];return _0x39041a;};'use strict';var Sequelize=require(_0x8cf3('0x0'));module['exports']={'type':{'type':Sequelize[_0x8cf3('0x1')](_0x8cf3('0x2'),_0x8cf3('0x3'),'customVariable',_0x8cf3('0x4'),'picklist'),'defaultValue':_0x8cf3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8cf3('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x8cf3('0x2'),_0x8cf3('0x3'),_0x8cf3('0x6'))},'keyContent':{'type':Sequelize[_0x8cf3('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8cf3('0x5')]},'customField':{'type':Sequelize[_0x8cf3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8cf3('0x5')]}}; \ No newline at end of file +var _0xaf4c=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x26c967,_0x2f12e7){var _0x1e1944=function(_0x183bd3){while(--_0x183bd3){_0x26c967['push'](_0x26c967['shift']());}};_0x1e1944(++_0x2f12e7);}(_0xaf4c,0x14f));var _0xcaf4=function(_0x31d61f,_0x1fe64d){_0x31d61f=_0x31d61f-0x0;var _0x19d3ff=_0xaf4c[_0x31d61f];return _0x19d3ff;};'use strict';var Sequelize=require(_0xcaf4('0x0'));module[_0xcaf4('0x1')]={'type':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4'),_0xcaf4('0x5'),_0xcaf4('0x6'),_0xcaf4('0x7')),'defaultValue':_0xcaf4('0x3')},'content':{'type':Sequelize[_0xcaf4('0x8')]},'key':{'type':Sequelize[_0xcaf4('0x8')]},'keyType':{'type':Sequelize[_0xcaf4('0x2')](_0xcaf4('0x3'),_0xcaf4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcaf4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcaf4('0x8')]},'customField':{'type':Sequelize[_0xcaf4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaf4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 32a3c36..786e626 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 _0x4498=['filter','options','includeAll','include','findAll','rows','catch','params','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','index','FreshsalesField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x4498,0xe7));var _0x8449=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x4498[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x8449('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8449('0x1'));var jsonpatch=require(_0x8449('0x2'));var rp=require(_0x8449('0x3'));var moment=require(_0x8449('0x4'));var BPromise=require(_0x8449('0x5'));var Mustache=require(_0x8449('0x6'));var util=require(_0x8449('0x7'));var path=require('path');var sox=require(_0x8449('0x8'));var csv=require(_0x8449('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8449('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8449('0xb'));var toCsv=require(_0x8449('0x9'));var querystring=require(_0x8449('0xc'));var Papa=require(_0x8449('0xd'));var Redis=require(_0x8449('0xe'));var authService=require(_0x8449('0xf'));var qs=require(_0x8449('0x10'));var as=require(_0x8449('0x11'));var hardwareService=require(_0x8449('0x12'));var logger=require(_0x8449('0x13'))(_0x8449('0x14'));var utils=require(_0x8449('0x15'));var config=require(_0x8449('0x16'));var licenseUtil=require(_0x8449('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef617,_0x435a80){_0x435a80=_0x435a80||0xcc;return function(_0x25990a){if(_0x25990a){return _0x4ef617[_0x8449('0x18')](_0x435a80);}return _0x4ef617[_0x8449('0x19')](_0x435a80)['end']();};}function respondWithResult(_0x4cba4c,_0x64a3ff){_0x64a3ff=_0x64a3ff||0xc8;return function(_0x1bda6a){if(_0x1bda6a){return _0x4cba4c[_0x8449('0x19')](_0x64a3ff)[_0x8449('0x1a')](_0x1bda6a);}};}function respondWithFilteredResult(_0x37c75f,_0x2866a9){return function(_0x13afb4){if(_0x13afb4){var _0x4d347a=typeof _0x2866a9[_0x8449('0x1b')]===_0x8449('0x1c')&&typeof _0x2866a9[_0x8449('0x1d')]===_0x8449('0x1c');var _0x542b88=_0x13afb4[_0x8449('0x1e')];var _0x2a1675=_0x4d347a?0x0:_0x2866a9[_0x8449('0x1b')];var _0x483718=_0x4d347a?_0x13afb4[_0x8449('0x1e')]:_0x2866a9[_0x8449('0x1b')]+_0x2866a9[_0x8449('0x1d')];var _0x1b29c1;if(_0x483718>=_0x542b88){_0x483718=_0x542b88;_0x1b29c1=0xc8;}else{_0x1b29c1=0xce;}_0x37c75f[_0x8449('0x19')](_0x1b29c1);return _0x37c75f[_0x8449('0x1f')](_0x8449('0x20'),_0x2a1675+'-'+_0x483718+'/'+_0x542b88)[_0x8449('0x1a')](_0x13afb4);}return null;};}function patchUpdates(_0x35034e){return function(_0x41062c){try{jsonpatch[_0x8449('0x21')](_0x41062c,_0x35034e,!![]);}catch(_0x3dfc3d){return BPromise['reject'](_0x3dfc3d);}return _0x41062c[_0x8449('0x22')]();};}function saveUpdates(_0x430745,_0x2dfa0b){return function(_0x47d4ac){if(_0x47d4ac){return _0x47d4ac['update'](_0x430745)[_0x8449('0x23')](function(_0xb5c11d){return _0xb5c11d;});}return null;};}function removeEntity(_0x4fe790,_0x10a241){return function(_0x586f33){if(_0x586f33){return _0x586f33[_0x8449('0x24')]()[_0x8449('0x23')](function(){_0x4fe790['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd566,_0x45fe55){return function(_0x2cdc1a){if(!_0x2cdc1a){_0x1bd566[_0x8449('0x18')](0x194);}return _0x2cdc1a;};}function handleError(_0x5b1766,_0x177d7f){_0x177d7f=_0x177d7f||0x1f4;return function(_0x46dcbb){logger['error'](_0x46dcbb['stack']);if(_0x46dcbb[_0x8449('0x25')]){delete _0x46dcbb[_0x8449('0x25')];}_0x5b1766[_0x8449('0x19')](_0x177d7f)[_0x8449('0x26')](_0x46dcbb);};}exports[_0x8449('0x27')]=function(_0x5ac168,_0x5cf9f0){var _0x7527b4={},_0x3524ce={},_0x27cabf={'count':0x0,'rows':[]};var _0x39e173=_['map'](db[_0x8449('0x28')]['rawAttributes'],function(_0x491cf5){return{'name':_0x491cf5[_0x8449('0x29')],'type':_0x491cf5[_0x8449('0x2a')][_0x8449('0x2b')]};});_0x3524ce[_0x8449('0x2c')]=_[_0x8449('0x2d')](_0x39e173,'name');_0x3524ce[_0x8449('0x2e')]=_[_0x8449('0x2f')](_0x5ac168['query']);_0x3524ce[_0x8449('0x30')]=_[_0x8449('0x31')](_0x3524ce[_0x8449('0x2c')],_0x3524ce[_0x8449('0x2e')]);_0x7527b4[_0x8449('0x32')]=_['intersection'](_0x3524ce[_0x8449('0x2c')],qs[_0x8449('0x33')](_0x5ac168['query'][_0x8449('0x33')]));_0x7527b4[_0x8449('0x32')]=_0x7527b4['attributes'][_0x8449('0x34')]?_0x7527b4[_0x8449('0x32')]:_0x3524ce['model'];if(!_0x5ac168['query'][_0x8449('0x35')](_0x8449('0x36'))){_0x7527b4[_0x8449('0x1d')]=qs[_0x8449('0x1d')](_0x5ac168[_0x8449('0x2e')]['limit']);_0x7527b4[_0x8449('0x1b')]=qs['offset'](_0x5ac168[_0x8449('0x2e')][_0x8449('0x1b')]);}_0x7527b4[_0x8449('0x37')]=qs[_0x8449('0x38')](_0x5ac168[_0x8449('0x2e')][_0x8449('0x38')]);_0x7527b4[_0x8449('0x39')]=qs[_0x8449('0x30')](_[_0x8449('0x3a')](_0x5ac168[_0x8449('0x2e')],_0x3524ce['filters']),_0x39e173);if(_0x5ac168[_0x8449('0x2e')]['filter']){_0x7527b4[_0x8449('0x39')]=_[_0x8449('0x3b')](_0x7527b4[_0x8449('0x39')],{'$or':_[_0x8449('0x2d')](_0x39e173,function(_0x4d668d){if(_0x4d668d[_0x8449('0x2a')]!==_0x8449('0x3c')){var _0x29ce5d={};_0x29ce5d[_0x4d668d[_0x8449('0x25')]]={'$like':'%'+_0x5ac168[_0x8449('0x2e')][_0x8449('0x3d')]+'%'};return _0x29ce5d;}})});}_0x7527b4=_[_0x8449('0x3b')]({},_0x7527b4,_0x5ac168[_0x8449('0x3e')]);var _0x36b4b0={'where':_0x7527b4['where']};return db[_0x8449('0x28')]['count'](_0x36b4b0)[_0x8449('0x23')](function(_0x205c5d){_0x27cabf[_0x8449('0x1e')]=_0x205c5d;if(_0x5ac168[_0x8449('0x2e')][_0x8449('0x3f')]){_0x7527b4[_0x8449('0x40')]=[{'all':!![]}];}return db[_0x8449('0x28')][_0x8449('0x41')](_0x7527b4);})[_0x8449('0x23')](function(_0x5f0b6f){_0x27cabf[_0x8449('0x42')]=_0x5f0b6f;return _0x27cabf;})[_0x8449('0x23')](respondWithFilteredResult(_0x5cf9f0,_0x7527b4))[_0x8449('0x43')](handleError(_0x5cf9f0,null));};exports['show']=function(_0x14ebe4,_0x534900){var _0x40c513={'raw':!![],'where':{'id':_0x14ebe4[_0x8449('0x44')]['id']}},_0x469dbb={};_0x469dbb[_0x8449('0x2c')]=_['keys'](db[_0x8449('0x28')]['rawAttributes']);_0x469dbb['query']=_[_0x8449('0x2f')](_0x14ebe4[_0x8449('0x2e')]);_0x469dbb[_0x8449('0x30')]=_[_0x8449('0x31')](_0x469dbb[_0x8449('0x2c')],_0x469dbb['query']);_0x40c513[_0x8449('0x32')]=_[_0x8449('0x31')](_0x469dbb[_0x8449('0x2c')],qs['fields'](_0x14ebe4['query'][_0x8449('0x33')]));_0x40c513[_0x8449('0x32')]=_0x40c513[_0x8449('0x32')][_0x8449('0x34')]?_0x40c513['attributes']:_0x469dbb[_0x8449('0x2c')];if(_0x14ebe4[_0x8449('0x2e')]['includeAll']){_0x40c513[_0x8449('0x40')]=[{'all':!![]}];}_0x40c513=_[_0x8449('0x3b')]({},_0x40c513,_0x14ebe4[_0x8449('0x3e')]);return db[_0x8449('0x28')]['find'](_0x40c513)[_0x8449('0x23')](handleEntityNotFound(_0x534900,null))[_0x8449('0x23')](respondWithResult(_0x534900,null))[_0x8449('0x43')](handleError(_0x534900,null));};exports['create']=function(_0x464635,_0x5c1b61){return db[_0x8449('0x28')][_0x8449('0x45')](_0x464635['body'],{})['then'](respondWithResult(_0x5c1b61,0xc9))[_0x8449('0x43')](handleError(_0x5c1b61,null));};exports[_0x8449('0x46')]=function(_0x1c019b,_0x3c6ef7){if(_0x1c019b[_0x8449('0x47')]['id']){delete _0x1c019b[_0x8449('0x47')]['id'];}return db[_0x8449('0x28')][_0x8449('0x48')]({'where':{'id':_0x1c019b['params']['id']}})[_0x8449('0x23')](handleEntityNotFound(_0x3c6ef7,null))[_0x8449('0x23')](saveUpdates(_0x1c019b[_0x8449('0x47')],null))['then'](respondWithResult(_0x3c6ef7,null))[_0x8449('0x43')](handleError(_0x3c6ef7,null));};exports[_0x8449('0x24')]=function(_0x402fa4,_0x14eaa9){return db['FreshsalesField'][_0x8449('0x48')]({'where':{'id':_0x402fa4['params']['id']}})[_0x8449('0x23')](handleEntityNotFound(_0x14eaa9,null))['then'](removeEntity(_0x14eaa9,null))[_0x8449('0x43')](handleError(_0x14eaa9,null));}; \ No newline at end of file +var _0x0334=['keys','include','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x22d953,_0x5183b){var _0x3d7a0c=function(_0x1217d3){while(--_0x1217d3){_0x22d953['push'](_0x22d953['shift']());}};_0x3d7a0c(++_0x5183b);}(_0x0334,0x173));var _0x4033=function(_0x1d7319,_0x3cb9ac){_0x1d7319=_0x1d7319-0x0;var _0x59dfd6=_0x0334[_0x1d7319];return _0x59dfd6;};'use strict';var emlformat=require(_0x4033('0x0'));var rimraf=require(_0x4033('0x1'));var zipdir=require(_0x4033('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4033('0x3'));var BPromise=require(_0x4033('0x4'));var Mustache=require(_0x4033('0x5'));var util=require(_0x4033('0x6'));var path=require('path');var sox=require(_0x4033('0x7'));var csv=require(_0x4033('0x8'));var ejs=require(_0x4033('0x9'));var fs=require('fs');var fs_extra=require(_0x4033('0xa'));var _=require('lodash');var squel=require(_0x4033('0xb'));var crypto=require(_0x4033('0xc'));var jsforce=require(_0x4033('0xd'));var deskjs=require(_0x4033('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4033('0xf'));var Papa=require(_0x4033('0x10'));var Redis=require(_0x4033('0x11'));var authService=require(_0x4033('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4033('0x13'));var hardwareService=require(_0x4033('0x14'));var logger=require(_0x4033('0x15'))('api');var utils=require(_0x4033('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4033('0x17'));var db=require(_0x4033('0x18'))['db'];function respondWithStatusCode(_0x5f2a77,_0x1885fa){_0x1885fa=_0x1885fa||0xcc;return function(_0x57e27e){if(_0x57e27e){return _0x5f2a77['sendStatus'](_0x1885fa);}return _0x5f2a77[_0x4033('0x19')](_0x1885fa)[_0x4033('0x1a')]();};}function respondWithResult(_0x518c37,_0x300bc7){_0x300bc7=_0x300bc7||0xc8;return function(_0x117a0b){if(_0x117a0b){return _0x518c37[_0x4033('0x19')](_0x300bc7)[_0x4033('0x1b')](_0x117a0b);}};}function respondWithFilteredResult(_0x5d4368,_0x17cca1){return function(_0x3d357e){if(_0x3d357e){var _0x15c5dc=typeof _0x17cca1[_0x4033('0x1c')]===_0x4033('0x1d')&&typeof _0x17cca1[_0x4033('0x1e')]===_0x4033('0x1d');var _0x1f59d8=_0x3d357e['count'];var _0x4607a4=_0x15c5dc?0x0:_0x17cca1['offset'];var _0x5b9a78=_0x15c5dc?_0x3d357e[_0x4033('0x1f')]:_0x17cca1[_0x4033('0x1c')]+_0x17cca1['limit'];var _0x56ca4c;if(_0x5b9a78>=_0x1f59d8){_0x5b9a78=_0x1f59d8;_0x56ca4c=0xc8;}else{_0x56ca4c=0xce;}_0x5d4368[_0x4033('0x19')](_0x56ca4c);return _0x5d4368['set']('Content-Range',_0x4607a4+'-'+_0x5b9a78+'/'+_0x1f59d8)[_0x4033('0x1b')](_0x3d357e);}return null;};}function patchUpdates(_0x46a32e){return function(_0x133058){try{jsonpatch[_0x4033('0x20')](_0x133058,_0x46a32e,!![]);}catch(_0x205a2c){return BPromise[_0x4033('0x21')](_0x205a2c);}return _0x133058['save']();};}function saveUpdates(_0x134f48,_0x3e4b4a){return function(_0x3f636b){if(_0x3f636b){return _0x3f636b['update'](_0x134f48)[_0x4033('0x22')](function(_0x1885ee){return _0x1885ee;});}return null;};}function removeEntity(_0x342c31,_0x36e32){return function(_0x1df32b){if(_0x1df32b){return _0x1df32b[_0x4033('0x23')]()[_0x4033('0x22')](function(){_0x342c31['status'](0xcc)[_0x4033('0x1a')]();});}};}function handleEntityNotFound(_0x56dc9e,_0x82b06b){return function(_0x53a666){if(!_0x53a666){_0x56dc9e['sendStatus'](0x194);}return _0x53a666;};}function handleError(_0x3fb281,_0x31f5e3){_0x31f5e3=_0x31f5e3||0x1f4;return function(_0x584b55){logger[_0x4033('0x24')](_0x584b55[_0x4033('0x25')]);if(_0x584b55[_0x4033('0x26')]){delete _0x584b55[_0x4033('0x26')];}_0x3fb281['status'](_0x31f5e3)[_0x4033('0x27')](_0x584b55);};}exports[_0x4033('0x28')]=function(_0x50b6ee,_0x375836){var _0x5e2eeb={},_0x2528c1={},_0x5d304c={'count':0x0,'rows':[]};var _0x4ffa23=_[_0x4033('0x29')](db[_0x4033('0x2a')][_0x4033('0x2b')],function(_0x4dbd96){return{'name':_0x4dbd96[_0x4033('0x2c')],'type':_0x4dbd96['type'][_0x4033('0x2d')]};});_0x2528c1[_0x4033('0x2e')]=_[_0x4033('0x29')](_0x4ffa23,_0x4033('0x26'));_0x2528c1['query']=_['keys'](_0x50b6ee[_0x4033('0x2f')]);_0x2528c1[_0x4033('0x30')]=_['intersection'](_0x2528c1[_0x4033('0x2e')],_0x2528c1[_0x4033('0x2f')]);_0x5e2eeb['attributes']=_[_0x4033('0x31')](_0x2528c1[_0x4033('0x2e')],qs[_0x4033('0x32')](_0x50b6ee['query']['fields']));_0x5e2eeb['attributes']=_0x5e2eeb[_0x4033('0x33')][_0x4033('0x34')]?_0x5e2eeb[_0x4033('0x33')]:_0x2528c1['model'];if(!_0x50b6ee[_0x4033('0x2f')][_0x4033('0x35')](_0x4033('0x36'))){_0x5e2eeb['limit']=qs[_0x4033('0x1e')](_0x50b6ee[_0x4033('0x2f')][_0x4033('0x1e')]);_0x5e2eeb[_0x4033('0x1c')]=qs[_0x4033('0x1c')](_0x50b6ee[_0x4033('0x2f')][_0x4033('0x1c')]);}_0x5e2eeb['order']=qs['sort'](_0x50b6ee[_0x4033('0x2f')]['sort']);_0x5e2eeb[_0x4033('0x37')]=qs['filters'](_[_0x4033('0x38')](_0x50b6ee[_0x4033('0x2f')],_0x2528c1[_0x4033('0x30')]),_0x4ffa23);if(_0x50b6ee[_0x4033('0x2f')]['filter']){_0x5e2eeb['where']=_[_0x4033('0x39')](_0x5e2eeb['where'],{'$or':_[_0x4033('0x29')](_0x4ffa23,function(_0xf4b5d){if(_0xf4b5d['type']!==_0x4033('0x3a')){var _0x489470={};_0x489470[_0xf4b5d['name']]={'$like':'%'+_0x50b6ee[_0x4033('0x2f')][_0x4033('0x3b')]+'%'};return _0x489470;}})});}_0x5e2eeb=_[_0x4033('0x39')]({},_0x5e2eeb,_0x50b6ee[_0x4033('0x3c')]);var _0x14c594={'where':_0x5e2eeb[_0x4033('0x37')]};return db['FreshsalesField'][_0x4033('0x1f')](_0x14c594)[_0x4033('0x22')](function(_0x4c1a84){_0x5d304c[_0x4033('0x1f')]=_0x4c1a84;if(_0x50b6ee['query'][_0x4033('0x3d')]){_0x5e2eeb['include']=[{'all':!![]}];}return db[_0x4033('0x2a')][_0x4033('0x3e')](_0x5e2eeb);})[_0x4033('0x22')](function(_0x487aee){_0x5d304c[_0x4033('0x3f')]=_0x487aee;return _0x5d304c;})['then'](respondWithFilteredResult(_0x375836,_0x5e2eeb))[_0x4033('0x40')](handleError(_0x375836,null));};exports[_0x4033('0x41')]=function(_0x3cb36d,_0x2b2c4f){var _0x368c0c={'raw':!![],'where':{'id':_0x3cb36d[_0x4033('0x42')]['id']}},_0xef1252={};_0xef1252[_0x4033('0x2e')]=_[_0x4033('0x43')](db[_0x4033('0x2a')]['rawAttributes']);_0xef1252[_0x4033('0x2f')]=_[_0x4033('0x43')](_0x3cb36d[_0x4033('0x2f')]);_0xef1252[_0x4033('0x30')]=_[_0x4033('0x31')](_0xef1252['model'],_0xef1252[_0x4033('0x2f')]);_0x368c0c[_0x4033('0x33')]=_['intersection'](_0xef1252['model'],qs[_0x4033('0x32')](_0x3cb36d['query'][_0x4033('0x32')]));_0x368c0c['attributes']=_0x368c0c[_0x4033('0x33')]['length']?_0x368c0c[_0x4033('0x33')]:_0xef1252[_0x4033('0x2e')];if(_0x3cb36d['query'][_0x4033('0x3d')]){_0x368c0c[_0x4033('0x44')]=[{'all':!![]}];}_0x368c0c=_['merge']({},_0x368c0c,_0x3cb36d['options']);return db[_0x4033('0x2a')][_0x4033('0x45')](_0x368c0c)[_0x4033('0x22')](handleEntityNotFound(_0x2b2c4f,null))[_0x4033('0x22')](respondWithResult(_0x2b2c4f,null))[_0x4033('0x40')](handleError(_0x2b2c4f,null));};exports[_0x4033('0x46')]=function(_0x412c20,_0x22b9cf){return db['FreshsalesField'][_0x4033('0x46')](_0x412c20['body'],{})['then'](respondWithResult(_0x22b9cf,0xc9))[_0x4033('0x40')](handleError(_0x22b9cf,null));};exports[_0x4033('0x47')]=function(_0x4d5736,_0x4cf70a){if(_0x4d5736[_0x4033('0x48')]['id']){delete _0x4d5736[_0x4033('0x48')]['id'];}return db[_0x4033('0x2a')][_0x4033('0x45')]({'where':{'id':_0x4d5736[_0x4033('0x42')]['id']}})[_0x4033('0x22')](handleEntityNotFound(_0x4cf70a,null))[_0x4033('0x22')](saveUpdates(_0x4d5736[_0x4033('0x48')],null))[_0x4033('0x22')](respondWithResult(_0x4cf70a,null))[_0x4033('0x40')](handleError(_0x4cf70a,null));};exports[_0x4033('0x23')]=function(_0xad8f41,_0x11f99a){return db[_0x4033('0x2a')]['find']({'where':{'id':_0xad8f41['params']['id']}})['then'](handleEntityNotFound(_0x11f99a,null))['then'](removeEntity(_0x11f99a,null))[_0x4033('0x40')](handleError(_0x11f99a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d310ce7..be01545 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 _0x6d4b=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d4b,0xbf));var _0xb6d4=function(_0xc39ba3,_0x49c857){_0xc39ba3=_0xc39ba3-0x0;var _0x1a5cd4=_0x6d4b[_0xc39ba3];return _0x1a5cd4;};'use strict';var _=require(_0xb6d4('0x0'));var util=require(_0xb6d4('0x1'));var logger=require(_0xb6d4('0x2'))('api');var moment=require(_0xb6d4('0x3'));var BPromise=require(_0xb6d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6d4('0x5'));var config=require(_0xb6d4('0x6'));var attributes=require(_0xb6d4('0x7'));module[_0xb6d4('0x8')]=function(_0x1e9c41,_0x2d2725){return _0x1e9c41[_0xb6d4('0x9')](_0xb6d4('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xb6d4('0xb'),'fields':[_0xb6d4('0xc'),_0xb6d4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d7=['FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x2f597d,_0x24ed49){_0x2f597d=_0x2f597d-0x0;var _0x2f12c4=_0xc0d7[_0x2f597d];return _0x2f12c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var fs=require('fs');var path=require(_0x7c0d('0x4'));var rimraf=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var attributes=require(_0x7c0d('0x7'));module[_0x7c0d('0x8')]=function(_0x5a6a70,_0x507bc0){return _0x5a6a70[_0x7c0d('0x9')](_0x7c0d('0xa'),attributes,{'tableName':_0x7c0d('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7c0d('0xc'),_0x7c0d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 327449d..a6cc6ec 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1273fb,_0x54c64d){var _0x1a9d6c=function(_0xdc92cd){while(--_0xdc92cd){_0x1273fb['push'](_0x1273fb['shift']());}};_0x1a9d6c(++_0x54c64d);}(_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 moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x524e,0x15e));var _0xe524=function(_0x371548,_0x4116a3){_0x371548=_0x371548-0x0;var _0x1324d6=_0x524e[_0x371548];return _0x1324d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f01eb40..b0c83c8 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x367f61,_0x4727cb){var _0x57522f=function(_0x59d3a5){while(--_0x59d3a5){_0x367f61['push'](_0x367f61['shift']());}};_0x57522f(++_0x4727cb);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1ac5b3,_0x575ec9){var _0x2431e8=function(_0x251f20){while(--_0x251f20){_0x1ac5b3['push'](_0x1ac5b3['shift']());}};_0x2431e8(++_0x575ec9);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 80cca47..0d213e9 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 _0x4910=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x4910,0x1d9));var _0x0491=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4910[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x0491('0x0'));module[_0x0491('0x1')]={'name':{'type':Sequelize[_0x0491('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0491('0x2')],'unique':_0x0491('0x3')},'remoteUri':{'type':Sequelize[_0x0491('0x2')]},'password':{'type':Sequelize[_0x0491('0x2')]},'clientId':{'type':Sequelize[_0x0491('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x0491('0x2')]},'serverUrl':{'type':Sequelize[_0x0491('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0491('0x4')](_0x0491('0x5'),_0x0491('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4bd3=['newTab','integrationTab','sequelize','STRING','ENUM'];(function(_0x20c2b6,_0x45d57d){var _0x1d89ca=function(_0x36f90a){while(--_0x36f90a){_0x20c2b6['push'](_0x20c2b6['shift']());}};_0x1d89ca(++_0x45d57d);}(_0x4bd3,0x174));var _0x34bd=function(_0x22038d,_0x1977c6){_0x22038d=_0x22038d-0x0;var _0x226838=_0x4bd3[_0x22038d];return _0x226838;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x34bd('0x1')]},'clientId':{'type':Sequelize[_0x34bd('0x1')]},'clientSecret':{'type':Sequelize[_0x34bd('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x34bd('0x2')]('integrationTab',_0x34bd('0x3')),'defaultValue':_0x34bd('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c952536..9842554 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 _0x9376=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','limit','undefined','status','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceAccount','count','includeAll','include','rows','catch','show','params','keys','intersection','create','body','find','getConfigurations','findOne','order','AccountId','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','clientId','username','password','remoteUri','substring','lastIndexOf','Connection','clientSecret','login','concat','securityToken','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','picklist','email','textarea','phone','includes','label','custom','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir'];(function(_0x199389,_0x142da7){var _0x26927a=function(_0x17de2e){while(--_0x17de2e){_0x199389['push'](_0x199389['shift']());}};_0x26927a(++_0x142da7);}(_0x9376,0x174));var _0x6937=function(_0x105487,_0x3268ec){_0x105487=_0x105487-0x0;var _0x3d4f52=_0x9376[_0x105487];return _0x3d4f52;};'use strict';var emlformat=require(_0x6937('0x0'));var rimraf=require(_0x6937('0x1'));var zipdir=require(_0x6937('0x2'));var jsonpatch=require(_0x6937('0x3'));var rp=require(_0x6937('0x4'));var moment=require(_0x6937('0x5'));var BPromise=require(_0x6937('0x6'));var Mustache=require(_0x6937('0x7'));var util=require(_0x6937('0x8'));var path=require(_0x6937('0x9'));var sox=require('sox');var csv=require(_0x6937('0xa'));var ejs=require(_0x6937('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6937('0xc'));var squel=require(_0x6937('0xd'));var crypto=require(_0x6937('0xe'));var jsforce=require(_0x6937('0xf'));var deskjs=require(_0x6937('0x10'));var toCsv=require(_0x6937('0xa'));var querystring=require('querystring');var Papa=require(_0x6937('0x11'));var Redis=require(_0x6937('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6937('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6937('0x14'));var logger=require('../../config/logger')(_0x6937('0x15'));var utils=require(_0x6937('0x16'));var config=require(_0x6937('0x17'));var licenseUtil=require(_0x6937('0x18'));var db=require(_0x6937('0x19'))['db'];var integrations=require(_0x6937('0x1a'));function respondWithStatusCode(_0x576bf0,_0x55c026){_0x55c026=_0x55c026||0xcc;return function(_0x3e3415){if(_0x3e3415){return _0x576bf0['sendStatus'](_0x55c026);}return _0x576bf0['status'](_0x55c026)[_0x6937('0x1b')]();};}function respondWithResult(_0x2c4dd4,_0x25bdda){_0x25bdda=_0x25bdda||0xc8;return function(_0x22dc4d){if(_0x22dc4d){return _0x2c4dd4['status'](_0x25bdda)[_0x6937('0x1c')](_0x22dc4d);}};}function respondWithFilteredResult(_0x18481d,_0x251289){return function(_0x1fe80b){if(_0x1fe80b){var _0x102be6=typeof _0x251289[_0x6937('0x1d')]==='undefined'&&typeof _0x251289[_0x6937('0x1e')]===_0x6937('0x1f');var _0x30cccd=_0x1fe80b['count'];var _0x10b8f4=_0x102be6?0x0:_0x251289['offset'];var _0x2b9a20=_0x102be6?_0x1fe80b['count']:_0x251289[_0x6937('0x1d')]+_0x251289[_0x6937('0x1e')];var _0x33433a;if(_0x2b9a20>=_0x30cccd){_0x2b9a20=_0x30cccd;_0x33433a=0xc8;}else{_0x33433a=0xce;}_0x18481d[_0x6937('0x20')](_0x33433a);return _0x18481d[_0x6937('0x21')](_0x6937('0x22'),_0x10b8f4+'-'+_0x2b9a20+'/'+_0x30cccd)[_0x6937('0x1c')](_0x1fe80b);}return null;};}function patchUpdates(_0x4989f0){return function(_0x561ab9){try{jsonpatch[_0x6937('0x23')](_0x561ab9,_0x4989f0,!![]);}catch(_0x37e21c){return BPromise[_0x6937('0x24')](_0x37e21c);}return _0x561ab9['save']();};}function saveUpdates(_0x3be242,_0x31fd3b){return function(_0x194370){if(_0x194370){return _0x194370[_0x6937('0x25')](_0x3be242)['then'](function(_0x4c068c){return _0x4c068c;});}return null;};}function removeEntity(_0x15f238,_0x17df69){return function(_0x5ce356){if(_0x5ce356){return _0x5ce356[_0x6937('0x26')]()[_0x6937('0x27')](function(){_0x15f238[_0x6937('0x20')](0xcc)[_0x6937('0x1b')]();});}};}function handleEntityNotFound(_0x37b086,_0x16dddb){return function(_0xb054a5){if(!_0xb054a5){_0x37b086[_0x6937('0x28')](0x194);}return _0xb054a5;};}function handleError(_0x46274f,_0x562cd5){_0x562cd5=_0x562cd5||0x1f4;return function(_0x5c6793){logger[_0x6937('0x29')](_0x5c6793['stack']);if(_0x5c6793[_0x6937('0x2a')]){delete _0x5c6793[_0x6937('0x2a')];}_0x46274f[_0x6937('0x20')](_0x562cd5)[_0x6937('0x2b')](_0x5c6793);};}exports['index']=function(_0x210078,_0x455753){var _0x39feca={},_0x4252ae={},_0x1f4621={'count':0x0,'rows':[]};var _0xdf22b7=_[_0x6937('0x2c')](db['SalesforceAccount'][_0x6937('0x2d')],function(_0x2f99aa){return{'name':_0x2f99aa[_0x6937('0x2e')],'type':_0x2f99aa[_0x6937('0x2f')][_0x6937('0x30')]};});_0x4252ae[_0x6937('0x31')]=_[_0x6937('0x2c')](_0xdf22b7,_0x6937('0x2a'));_0x4252ae[_0x6937('0x32')]=_['keys'](_0x210078[_0x6937('0x32')]);_0x4252ae[_0x6937('0x33')]=_['intersection'](_0x4252ae[_0x6937('0x31')],_0x4252ae[_0x6937('0x32')]);_0x39feca[_0x6937('0x34')]=_['intersection'](_0x4252ae[_0x6937('0x31')],qs['fields'](_0x210078['query'][_0x6937('0x35')]));_0x39feca['attributes']=_0x39feca[_0x6937('0x34')][_0x6937('0x36')]?_0x39feca[_0x6937('0x34')]:_0x4252ae[_0x6937('0x31')];if(!_0x210078[_0x6937('0x32')][_0x6937('0x37')](_0x6937('0x38'))){_0x39feca[_0x6937('0x1e')]=qs['limit'](_0x210078[_0x6937('0x32')]['limit']);_0x39feca[_0x6937('0x1d')]=qs['offset'](_0x210078[_0x6937('0x32')]['offset']);}_0x39feca['order']=qs[_0x6937('0x39')](_0x210078[_0x6937('0x32')][_0x6937('0x39')]);_0x39feca[_0x6937('0x3a')]=qs['filters'](_[_0x6937('0x3b')](_0x210078[_0x6937('0x32')],_0x4252ae[_0x6937('0x33')]),_0xdf22b7);if(_0x210078['query']['filter']){_0x39feca[_0x6937('0x3a')]=_[_0x6937('0x3c')](_0x39feca['where'],{'$or':_[_0x6937('0x2c')](_0xdf22b7,function(_0x3982ff){if(_0x3982ff[_0x6937('0x2f')]!==_0x6937('0x3d')){var _0x57f025={};_0x57f025[_0x3982ff[_0x6937('0x2a')]]={'$like':'%'+_0x210078[_0x6937('0x32')][_0x6937('0x3e')]+'%'};return _0x57f025;}})});}_0x39feca=_[_0x6937('0x3c')]({},_0x39feca,_0x210078[_0x6937('0x3f')]);var _0x4e1ce1={'where':_0x39feca['where']};return db[_0x6937('0x40')][_0x6937('0x41')](_0x4e1ce1)['then'](function(_0x448487){_0x1f4621[_0x6937('0x41')]=_0x448487;if(_0x210078['query'][_0x6937('0x42')]){_0x39feca[_0x6937('0x43')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x39feca);})[_0x6937('0x27')](function(_0x296ff9){_0x1f4621[_0x6937('0x44')]=_0x296ff9;return _0x1f4621;})['then'](respondWithFilteredResult(_0x455753,_0x39feca))[_0x6937('0x45')](handleError(_0x455753,null));};exports[_0x6937('0x46')]=function(_0x18f97e,_0x5b42b4){var _0x3223d6={'raw':![],'where':{'id':_0x18f97e[_0x6937('0x47')]['id']}},_0x45debf={};_0x45debf[_0x6937('0x31')]=_[_0x6937('0x48')](db[_0x6937('0x40')][_0x6937('0x2d')]);_0x45debf[_0x6937('0x32')]=_['keys'](_0x18f97e[_0x6937('0x32')]);_0x45debf[_0x6937('0x33')]=_['intersection'](_0x45debf[_0x6937('0x31')],_0x45debf[_0x6937('0x32')]);_0x3223d6['attributes']=_[_0x6937('0x49')](_0x45debf['model'],qs['fields'](_0x18f97e[_0x6937('0x32')][_0x6937('0x35')]));_0x3223d6[_0x6937('0x34')]=_0x3223d6['attributes'][_0x6937('0x36')]?_0x3223d6['attributes']:_0x45debf[_0x6937('0x31')];if(_0x18f97e[_0x6937('0x32')]['includeAll']){_0x3223d6[_0x6937('0x43')]=[{'all':!![]}];}_0x3223d6=_[_0x6937('0x3c')]({},_0x3223d6,_0x18f97e[_0x6937('0x3f')]);return db[_0x6937('0x40')]['find'](_0x3223d6)['then'](handleEntityNotFound(_0x5b42b4,null))[_0x6937('0x27')](respondWithResult(_0x5b42b4,null))[_0x6937('0x45')](handleError(_0x5b42b4,null));};exports[_0x6937('0x4a')]=function(_0x4b306e,_0x48cbd6){return db['SalesforceAccount'][_0x6937('0x4a')](_0x4b306e[_0x6937('0x4b')],{})[_0x6937('0x27')](respondWithResult(_0x48cbd6,0xc9))[_0x6937('0x45')](handleError(_0x48cbd6,null));};exports[_0x6937('0x25')]=function(_0x352c84,_0x3f980d){if(_0x352c84[_0x6937('0x4b')]['id']){delete _0x352c84[_0x6937('0x4b')]['id'];}return db[_0x6937('0x40')][_0x6937('0x4c')]({'where':{'id':_0x352c84['params']['id']}})[_0x6937('0x27')](handleEntityNotFound(_0x3f980d,null))['then'](saveUpdates(_0x352c84[_0x6937('0x4b')],null))['then'](respondWithResult(_0x3f980d,null))['catch'](handleError(_0x3f980d,null));};exports['destroy']=function(_0x168898,_0x1b92b1){return db['SalesforceAccount'][_0x6937('0x4c')]({'where':{'id':_0x168898[_0x6937('0x47')]['id']}})[_0x6937('0x27')](handleEntityNotFound(_0x1b92b1,null))[_0x6937('0x27')](removeEntity(_0x1b92b1,null))[_0x6937('0x45')](handleError(_0x1b92b1,null));};exports[_0x6937('0x4d')]=function(_0x29bacb,_0x4827ed,_0x3a6c06){var _0x4e3a0e={};var _0x765ea3={};var _0x1e0af2;var _0x5c0731;return db[_0x6937('0x40')][_0x6937('0x4e')]({'where':{'id':_0x29bacb[_0x6937('0x47')]['id']}})[_0x6937('0x27')](handleEntityNotFound(_0x4827ed,null))[_0x6937('0x27')](function(_0x1386a1){if(_0x1386a1){_0x1e0af2=_0x1386a1;_0x765ea3[_0x6937('0x31')]=_[_0x6937('0x48')](db['SalesforceConfiguration'][_0x6937('0x2d')]);_0x765ea3[_0x6937('0x32')]=_['keys'](_0x29bacb[_0x6937('0x32')]);_0x765ea3['filters']=_['intersection'](_0x765ea3[_0x6937('0x31')],_0x765ea3[_0x6937('0x32')]);_0x4e3a0e[_0x6937('0x34')]=_['intersection'](_0x765ea3[_0x6937('0x31')],qs[_0x6937('0x35')](_0x29bacb[_0x6937('0x32')][_0x6937('0x35')]));_0x4e3a0e[_0x6937('0x34')]=_0x4e3a0e[_0x6937('0x34')]['length']?_0x4e3a0e['attributes']:_0x765ea3['model'];_0x4e3a0e[_0x6937('0x4f')]=qs['sort'](_0x29bacb[_0x6937('0x32')]['sort']);_0x4e3a0e['where']=qs[_0x6937('0x33')](_['pick'](_0x29bacb[_0x6937('0x32')],_0x765ea3[_0x6937('0x33')]));if(_0x29bacb[_0x6937('0x32')][_0x6937('0x3e')]){_0x4e3a0e['where']=_['merge'](_0x4e3a0e[_0x6937('0x3a')],{'$or':_[_0x6937('0x2c')](_0x4e3a0e[_0x6937('0x34')],function(_0x3cfc2c){var _0x266d09={};_0x266d09[_0x3cfc2c]={'$like':'%'+_0x29bacb[_0x6937('0x32')][_0x6937('0x3e')]+'%'};return _0x266d09;})});}_0x4e3a0e=_[_0x6937('0x3c')]({},_0x4e3a0e,_0x29bacb[_0x6937('0x3f')]);return _0x1e0af2[_0x6937('0x4d')](_0x4e3a0e);}})[_0x6937('0x27')](function(_0x1ee8bb){if(_0x1ee8bb){_0x5c0731=_0x1ee8bb[_0x6937('0x36')];if(!_0x29bacb[_0x6937('0x32')][_0x6937('0x37')](_0x6937('0x38'))){_0x4e3a0e[_0x6937('0x1e')]=qs[_0x6937('0x1e')](_0x29bacb[_0x6937('0x32')][_0x6937('0x1e')]);_0x4e3a0e['offset']=qs[_0x6937('0x1d')](_0x29bacb[_0x6937('0x32')][_0x6937('0x1d')]);}return _0x1e0af2[_0x6937('0x4d')](_0x4e3a0e);}})[_0x6937('0x27')](function(_0x4ee65c){if(_0x4ee65c){return _0x4ee65c?{'count':_0x5c0731,'rows':_0x4ee65c}:null;}})[_0x6937('0x27')](respondWithResult(_0x4827ed,null))[_0x6937('0x45')](handleError(_0x4827ed,null));};exports['addConfiguration']=function(_0x2b447c,_0x37c49a,_0x47c4f7){if(_0x2b447c[_0x6937('0x4b')]['id']){delete _0x2b447c[_0x6937('0x4b')]['id'];}return db[_0x6937('0x40')]['findOne']({'where':{'id':_0x2b447c[_0x6937('0x47')]['id']}})['then'](handleEntityNotFound(_0x37c49a,null))['then'](function(_0x49c727){if(_0x49c727){_0x2b447c[_0x6937('0x4b')][_0x6937('0x50')]=_0x49c727['id'];_0x2b447c[_0x6937('0x4b')]['Subjects']=integrations['getSubjects'](_0x2b447c[_0x6937('0x4b')][_0x6937('0x51')],_0x2b447c[_0x6937('0x4b')]['type']);_0x2b447c[_0x6937('0x4b')][_0x6937('0x52')]=integrations[_0x6937('0x53')](_0x2b447c[_0x6937('0x4b')]['channel'],_0x2b447c[_0x6937('0x4b')][_0x6937('0x2f')]);return db['SalesforceConfiguration'][_0x6937('0x4a')](_0x2b447c['body'],{'include':[{'model':db[_0x6937('0x54')],'as':_0x6937('0x55')},{'model':db['SalesforceField'],'as':_0x6937('0x52')}]});}return null;})[_0x6937('0x27')](respondWithResult(_0x37c49a,null))[_0x6937('0x45')](handleError(_0x37c49a,null));};exports['getFields']=function(_0x84f146,_0x104f92,_0x2b634b){var _0x37cfdf;var _0xb39c1a='';var _0x2aa3f1=_0x6937('0x56');return db[_0x6937('0x40')][_0x6937('0x4e')]({'where':{'id':_0x84f146[_0x6937('0x47')]['id']},'attributes':['id','remoteUri',_0x6937('0x57'),'clientSecret',_0x6937('0x58'),_0x6937('0x59'),'securityToken']})[_0x6937('0x27')](handleEntityNotFound(_0x104f92,null))[_0x6937('0x27')](function(_0x4d9adf){if(_0x4d9adf){_0xb39c1a=_0x4d9adf[_0x6937('0x5a')];var _0x3c0f68=_0xb39c1a['slice'](-0x1);if(_0x3c0f68==='/'){_0xb39c1a=_0xb39c1a[_0x6937('0x5b')](0x0,_0xb39c1a[_0x6937('0x5c')](_0x3c0f68));}_0x37cfdf=new jsforce[(_0x6937('0x5d'))]({'oauth2':{'loginUrl':_0xb39c1a,'clientId':_0x4d9adf[_0x6937('0x57')],'clientSecret':_0x4d9adf[_0x6937('0x5e')]}});return _0x37cfdf[_0x6937('0x5f')](_0x4d9adf[_0x6937('0x58')],_0x4d9adf['password'][_0x6937('0x60')](_0x4d9adf[_0x6937('0x61')]));}})['then'](function(_0xee2c71){if(_0xee2c71){if(!_['isNil'](_0x84f146[_0x6937('0x32')]['ticketType'])){_0x2aa3f1=_0x84f146[_0x6937('0x32')][_0x6937('0x62')];}return _0x37cfdf['sobject'](_0x2aa3f1)[_0x6937('0x63')]();}})[_0x6937('0x27')](function(_0x21481e){var _0x19e4ba=[_0x6937('0x64'),_0x6937('0x65'),'IsReminderSet',_0x6937('0x66'),_0x6937('0x67'),'Description'];var _0x5b7d47=[_0x6937('0x68'),_0x6937('0x69'),_0x6937('0x6a'),'boolean',_0x6937('0x6b'),_0x6937('0x6c'),_0x6937('0x6d')];if(_0x21481e){_['remove'](_0x21481e[_0x6937('0x35')],function(_0x54368f){return _0x19e4ba[_0x6937('0x6e')](_0x54368f['name'])||!_0x5b7d47['includes'](_0x54368f[_0x6937('0x2f')]);});return{'count':_0x21481e[_0x6937('0x35')][_0x6937('0x36')],'rows':_[_0x6937('0x2c')](_0x21481e[_0x6937('0x35')],function(_0x405f16){return{'id':_0x405f16['name'],'name':_0x405f16[_0x6937('0x6f')],'custom':_0x405f16[_0x6937('0x70')],'options':_0x405f16[_0x6937('0x71')][_0x6937('0x36')]>0x0?_[_0x6937('0x2c')](_0x405f16[_0x6937('0x71')],function(_0x3797f0){return{'name':_0x3797f0[_0x6937('0x6f')],'value':_0x3797f0[_0x6937('0x72')]};}):_0x405f16[_0x6937('0x2f')]==_0x6937('0x73')?[{'name':_0x6937('0x74'),'value':_0x6937('0x75')},{'name':'False','value':_0x6937('0x76')}]:[]};})};}})[_0x6937('0x27')](respondWithResult(_0x104f92,null))[_0x6937('0x45')](function(_0x231e0b){var _0x14dee5=_0x84f146[_0x6937('0x32')][_0x6937('0x77')]?0x1f4:_0x231e0b[_0x6937('0x78')]||0x1f4;logger[_0x6937('0x29')](_0x6937('0x79'),_0x6937('0x7a'),_0x14dee5,JSON[_0x6937('0x7b')](_0x231e0b));delete _0x231e0b['name'];if(_0x14dee5===0x191){_0x14dee5=0x190;}_0x104f92[_0x6937('0x20')](_0x14dee5)[_0x6937('0x2b')](_0x84f146[_0x6937('0x32')][_0x6937('0x77')]?{'message':_0x6937('0x7c'),'statusCode':_0x231e0b[_0x6937('0x78')]}:_0x231e0b);});}; \ No newline at end of file +var _0x69b6=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','password','securityToken','remoteUri','slice','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','IsRecurrence','Subject','Description','string','email','textarea','remove','includes','label','picklistValues','value','boolean','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x367e77,_0x48d200){var _0xde8024=function(_0x314208){while(--_0x314208){_0x367e77['push'](_0x367e77['shift']());}};_0xde8024(++_0x48d200);}(_0x69b6,0x139));var _0x669b=function(_0x526aaf,_0x3284ca){_0x526aaf=_0x526aaf-0x0;var _0x184067=_0x69b6[_0x526aaf];return _0x184067;};'use strict';var emlformat=require(_0x669b('0x0'));var rimraf=require(_0x669b('0x1'));var zipdir=require(_0x669b('0x2'));var jsonpatch=require(_0x669b('0x3'));var rp=require(_0x669b('0x4'));var moment=require(_0x669b('0x5'));var BPromise=require(_0x669b('0x6'));var Mustache=require(_0x669b('0x7'));var util=require(_0x669b('0x8'));var path=require(_0x669b('0x9'));var sox=require(_0x669b('0xa'));var csv=require('to-csv');var ejs=require(_0x669b('0xb'));var fs=require('fs');var fs_extra=require(_0x669b('0xc'));var _=require(_0x669b('0xd'));var squel=require(_0x669b('0xe'));var crypto=require(_0x669b('0xf'));var jsforce=require(_0x669b('0x10'));var deskjs=require(_0x669b('0x11'));var toCsv=require(_0x669b('0x12'));var querystring=require(_0x669b('0x13'));var Papa=require(_0x669b('0x14'));var Redis=require(_0x669b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x669b('0x16'));var as=require(_0x669b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x669b('0x18'))(_0x669b('0x19'));var utils=require(_0x669b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x669b('0x1b'))['db'];var integrations=require(_0x669b('0x1c'));function respondWithStatusCode(_0x24b9ac,_0x174ac1){_0x174ac1=_0x174ac1||0xcc;return function(_0x4ea8f6){if(_0x4ea8f6){return _0x24b9ac[_0x669b('0x1d')](_0x174ac1);}return _0x24b9ac[_0x669b('0x1e')](_0x174ac1)[_0x669b('0x1f')]();};}function respondWithResult(_0x57aee0,_0x15c053){_0x15c053=_0x15c053||0xc8;return function(_0x13f67f){if(_0x13f67f){return _0x57aee0[_0x669b('0x1e')](_0x15c053)[_0x669b('0x20')](_0x13f67f);}};}function respondWithFilteredResult(_0x4a2cff,_0x31cbdd){return function(_0x39336a){if(_0x39336a){var _0x5b5773=typeof _0x31cbdd[_0x669b('0x21')]==='undefined'&&typeof _0x31cbdd['limit']===_0x669b('0x22');var _0x2b132e=_0x39336a[_0x669b('0x23')];var _0x2dad10=_0x5b5773?0x0:_0x31cbdd[_0x669b('0x21')];var _0x45db61=_0x5b5773?_0x39336a[_0x669b('0x23')]:_0x31cbdd[_0x669b('0x21')]+_0x31cbdd[_0x669b('0x24')];var _0x356655;if(_0x45db61>=_0x2b132e){_0x45db61=_0x2b132e;_0x356655=0xc8;}else{_0x356655=0xce;}_0x4a2cff[_0x669b('0x1e')](_0x356655);return _0x4a2cff[_0x669b('0x25')](_0x669b('0x26'),_0x2dad10+'-'+_0x45db61+'/'+_0x2b132e)[_0x669b('0x20')](_0x39336a);}return null;};}function patchUpdates(_0x4e3e51){return function(_0x1811c2){try{jsonpatch['apply'](_0x1811c2,_0x4e3e51,!![]);}catch(_0x5c42ad){return BPromise['reject'](_0x5c42ad);}return _0x1811c2['save']();};}function saveUpdates(_0x455106,_0x153797){return function(_0x612e74){if(_0x612e74){return _0x612e74[_0x669b('0x27')](_0x455106)['then'](function(_0x1ea453){return _0x1ea453;});}return null;};}function removeEntity(_0x1ae348,_0xca602){return function(_0x502617){if(_0x502617){return _0x502617[_0x669b('0x28')]()[_0x669b('0x29')](function(){_0x1ae348[_0x669b('0x1e')](0xcc)[_0x669b('0x1f')]();});}};}function handleEntityNotFound(_0xcd1262,_0x2be549){return function(_0x3feee4){if(!_0x3feee4){_0xcd1262[_0x669b('0x1d')](0x194);}return _0x3feee4;};}function handleError(_0x4d13f1,_0x1d1fc7){_0x1d1fc7=_0x1d1fc7||0x1f4;return function(_0x329435){logger[_0x669b('0x2a')](_0x329435[_0x669b('0x2b')]);if(_0x329435[_0x669b('0x2c')]){delete _0x329435[_0x669b('0x2c')];}_0x4d13f1[_0x669b('0x1e')](_0x1d1fc7)[_0x669b('0x2d')](_0x329435);};}exports[_0x669b('0x2e')]=function(_0x5a4e45,_0x2e13cb){var _0x59770c={},_0x32d996={},_0x2c0cc3={'count':0x0,'rows':[]};var _0xe45467=_['map'](db[_0x669b('0x2f')][_0x669b('0x30')],function(_0x2c5598){return{'name':_0x2c5598[_0x669b('0x31')],'type':_0x2c5598[_0x669b('0x32')][_0x669b('0x33')]};});_0x32d996[_0x669b('0x34')]=_[_0x669b('0x35')](_0xe45467,_0x669b('0x2c'));_0x32d996[_0x669b('0x36')]=_['keys'](_0x5a4e45[_0x669b('0x36')]);_0x32d996[_0x669b('0x37')]=_[_0x669b('0x38')](_0x32d996[_0x669b('0x34')],_0x32d996[_0x669b('0x36')]);_0x59770c[_0x669b('0x39')]=_[_0x669b('0x38')](_0x32d996['model'],qs['fields'](_0x5a4e45[_0x669b('0x36')][_0x669b('0x3a')]));_0x59770c['attributes']=_0x59770c[_0x669b('0x39')][_0x669b('0x3b')]?_0x59770c[_0x669b('0x39')]:_0x32d996[_0x669b('0x34')];if(!_0x5a4e45['query'][_0x669b('0x3c')](_0x669b('0x3d'))){_0x59770c[_0x669b('0x24')]=qs[_0x669b('0x24')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x24')]);_0x59770c[_0x669b('0x21')]=qs[_0x669b('0x21')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x21')]);}_0x59770c[_0x669b('0x3e')]=qs[_0x669b('0x3f')](_0x5a4e45[_0x669b('0x36')][_0x669b('0x3f')]);_0x59770c[_0x669b('0x40')]=qs[_0x669b('0x37')](_[_0x669b('0x41')](_0x5a4e45['query'],_0x32d996[_0x669b('0x37')]),_0xe45467);if(_0x5a4e45[_0x669b('0x36')][_0x669b('0x42')]){_0x59770c['where']=_[_0x669b('0x43')](_0x59770c[_0x669b('0x40')],{'$or':_[_0x669b('0x35')](_0xe45467,function(_0x720d0d){if(_0x720d0d[_0x669b('0x32')]!==_0x669b('0x44')){var _0x4ecbfa={};_0x4ecbfa[_0x720d0d['name']]={'$like':'%'+_0x5a4e45[_0x669b('0x36')][_0x669b('0x42')]+'%'};return _0x4ecbfa;}})});}_0x59770c=_[_0x669b('0x43')]({},_0x59770c,_0x5a4e45[_0x669b('0x45')]);var _0x31ec0c={'where':_0x59770c[_0x669b('0x40')]};return db[_0x669b('0x2f')]['count'](_0x31ec0c)[_0x669b('0x29')](function(_0x7e92c0){_0x2c0cc3[_0x669b('0x23')]=_0x7e92c0;if(_0x5a4e45['query'][_0x669b('0x46')]){_0x59770c['include']=[{'all':!![]}];}return db[_0x669b('0x2f')][_0x669b('0x47')](_0x59770c);})[_0x669b('0x29')](function(_0x26eae7){_0x2c0cc3[_0x669b('0x48')]=_0x26eae7;return _0x2c0cc3;})[_0x669b('0x29')](respondWithFilteredResult(_0x2e13cb,_0x59770c))[_0x669b('0x49')](handleError(_0x2e13cb,null));};exports['show']=function(_0x249ee3,_0x5cf7fc){var _0x30b38e={'raw':![],'where':{'id':_0x249ee3[_0x669b('0x4a')]['id']}},_0x5590c0={};_0x5590c0['model']=_[_0x669b('0x4b')](db[_0x669b('0x2f')][_0x669b('0x30')]);_0x5590c0[_0x669b('0x36')]=_[_0x669b('0x4b')](_0x249ee3['query']);_0x5590c0['filters']=_['intersection'](_0x5590c0[_0x669b('0x34')],_0x5590c0[_0x669b('0x36')]);_0x30b38e['attributes']=_[_0x669b('0x38')](_0x5590c0['model'],qs[_0x669b('0x3a')](_0x249ee3[_0x669b('0x36')][_0x669b('0x3a')]));_0x30b38e['attributes']=_0x30b38e[_0x669b('0x39')]['length']?_0x30b38e[_0x669b('0x39')]:_0x5590c0[_0x669b('0x34')];if(_0x249ee3[_0x669b('0x36')][_0x669b('0x46')]){_0x30b38e[_0x669b('0x4c')]=[{'all':!![]}];}_0x30b38e=_[_0x669b('0x43')]({},_0x30b38e,_0x249ee3['options']);return db[_0x669b('0x2f')][_0x669b('0x4d')](_0x30b38e)['then'](handleEntityNotFound(_0x5cf7fc,null))[_0x669b('0x29')](respondWithResult(_0x5cf7fc,null))[_0x669b('0x49')](handleError(_0x5cf7fc,null));};exports[_0x669b('0x4e')]=function(_0x46e29c,_0x3a2ef4){return db[_0x669b('0x2f')]['create'](_0x46e29c[_0x669b('0x4f')],{})[_0x669b('0x29')](respondWithResult(_0x3a2ef4,0xc9))[_0x669b('0x49')](handleError(_0x3a2ef4,null));};exports['update']=function(_0x2b92e1,_0x443dd4){if(_0x2b92e1[_0x669b('0x4f')]['id']){delete _0x2b92e1['body']['id'];}return db['SalesforceAccount'][_0x669b('0x4d')]({'where':{'id':_0x2b92e1[_0x669b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x443dd4,null))['then'](saveUpdates(_0x2b92e1[_0x669b('0x4f')],null))[_0x669b('0x29')](respondWithResult(_0x443dd4,null))['catch'](handleError(_0x443dd4,null));};exports[_0x669b('0x28')]=function(_0x32696f,_0x2511eb){return db[_0x669b('0x2f')][_0x669b('0x4d')]({'where':{'id':_0x32696f[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x2511eb,null))[_0x669b('0x29')](removeEntity(_0x2511eb,null))[_0x669b('0x49')](handleError(_0x2511eb,null));};exports[_0x669b('0x50')]=function(_0x1d8202,_0x59eb9d,_0x2086f9){var _0x5a0940={};var _0x371917={};var _0x3d76c3;var _0x145fce;return db[_0x669b('0x2f')][_0x669b('0x51')]({'where':{'id':_0x1d8202[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x59eb9d,null))[_0x669b('0x29')](function(_0x4bf06c){if(_0x4bf06c){_0x3d76c3=_0x4bf06c;_0x371917[_0x669b('0x34')]=_[_0x669b('0x4b')](db[_0x669b('0x52')][_0x669b('0x30')]);_0x371917[_0x669b('0x36')]=_['keys'](_0x1d8202[_0x669b('0x36')]);_0x371917[_0x669b('0x37')]=_[_0x669b('0x38')](_0x371917[_0x669b('0x34')],_0x371917[_0x669b('0x36')]);_0x5a0940[_0x669b('0x39')]=_[_0x669b('0x38')](_0x371917[_0x669b('0x34')],qs[_0x669b('0x3a')](_0x1d8202[_0x669b('0x36')][_0x669b('0x3a')]));_0x5a0940['attributes']=_0x5a0940[_0x669b('0x39')][_0x669b('0x3b')]?_0x5a0940[_0x669b('0x39')]:_0x371917[_0x669b('0x34')];_0x5a0940[_0x669b('0x3e')]=qs[_0x669b('0x3f')](_0x1d8202[_0x669b('0x36')][_0x669b('0x3f')]);_0x5a0940[_0x669b('0x40')]=qs[_0x669b('0x37')](_[_0x669b('0x41')](_0x1d8202[_0x669b('0x36')],_0x371917[_0x669b('0x37')]));if(_0x1d8202[_0x669b('0x36')][_0x669b('0x42')]){_0x5a0940[_0x669b('0x40')]=_[_0x669b('0x43')](_0x5a0940[_0x669b('0x40')],{'$or':_[_0x669b('0x35')](_0x5a0940[_0x669b('0x39')],function(_0x20292b){var _0x37075d={};_0x37075d[_0x20292b]={'$like':'%'+_0x1d8202[_0x669b('0x36')]['filter']+'%'};return _0x37075d;})});}_0x5a0940=_['merge']({},_0x5a0940,_0x1d8202['options']);return _0x3d76c3[_0x669b('0x50')](_0x5a0940);}})[_0x669b('0x29')](function(_0x3714d3){if(_0x3714d3){_0x145fce=_0x3714d3[_0x669b('0x3b')];if(!_0x1d8202['query'][_0x669b('0x3c')](_0x669b('0x3d'))){_0x5a0940[_0x669b('0x24')]=qs[_0x669b('0x24')](_0x1d8202[_0x669b('0x36')][_0x669b('0x24')]);_0x5a0940[_0x669b('0x21')]=qs[_0x669b('0x21')](_0x1d8202[_0x669b('0x36')][_0x669b('0x21')]);}return _0x3d76c3[_0x669b('0x50')](_0x5a0940);}})[_0x669b('0x29')](function(_0x3612c0){if(_0x3612c0){return _0x3612c0?{'count':_0x145fce,'rows':_0x3612c0}:null;}})[_0x669b('0x29')](respondWithResult(_0x59eb9d,null))[_0x669b('0x49')](handleError(_0x59eb9d,null));};exports['addConfiguration']=function(_0x1fec7c,_0x3cdf38,_0x16267b){if(_0x1fec7c[_0x669b('0x4f')]['id']){delete _0x1fec7c[_0x669b('0x4f')]['id'];}return db['SalesforceAccount'][_0x669b('0x51')]({'where':{'id':_0x1fec7c[_0x669b('0x4a')]['id']}})[_0x669b('0x29')](handleEntityNotFound(_0x3cdf38,null))[_0x669b('0x29')](function(_0x62cf3d){if(_0x62cf3d){_0x1fec7c[_0x669b('0x4f')][_0x669b('0x53')]=_0x62cf3d['id'];_0x1fec7c['body'][_0x669b('0x54')]=integrations[_0x669b('0x55')](_0x1fec7c[_0x669b('0x4f')][_0x669b('0x56')],_0x1fec7c['body'][_0x669b('0x32')]);_0x1fec7c[_0x669b('0x4f')][_0x669b('0x57')]=integrations[_0x669b('0x58')](_0x1fec7c['body'][_0x669b('0x56')],_0x1fec7c[_0x669b('0x4f')][_0x669b('0x32')]);return db['SalesforceConfiguration']['create'](_0x1fec7c[_0x669b('0x4f')],{'include':[{'model':db[_0x669b('0x59')],'as':_0x669b('0x54')},{'model':db[_0x669b('0x59')],'as':_0x669b('0x57')}]});}return null;})[_0x669b('0x29')](respondWithResult(_0x3cdf38,null))['catch'](handleError(_0x3cdf38,null));};exports[_0x669b('0x5a')]=function(_0x30febb,_0x55808d,_0x381ddd){var _0x3f3a7a;var _0x19c653='';var _0x48824d=_0x669b('0x5b');return db[_0x669b('0x2f')][_0x669b('0x51')]({'where':{'id':_0x30febb[_0x669b('0x4a')]['id']},'attributes':['id','remoteUri',_0x669b('0x5c'),'clientSecret','username',_0x669b('0x5d'),_0x669b('0x5e')]})[_0x669b('0x29')](handleEntityNotFound(_0x55808d,null))[_0x669b('0x29')](function(_0x4410eb){if(_0x4410eb){_0x19c653=_0x4410eb[_0x669b('0x5f')];var _0x284df0=_0x19c653[_0x669b('0x60')](-0x1);if(_0x284df0==='/'){_0x19c653=_0x19c653[_0x669b('0x61')](0x0,_0x19c653['lastIndexOf'](_0x284df0));}_0x3f3a7a=new jsforce[(_0x669b('0x62'))]({'oauth2':{'loginUrl':_0x19c653,'clientId':_0x4410eb['clientId'],'clientSecret':_0x4410eb['clientSecret']}});return _0x3f3a7a[_0x669b('0x63')](_0x4410eb[_0x669b('0x64')],_0x4410eb[_0x669b('0x5d')][_0x669b('0x65')](_0x4410eb[_0x669b('0x5e')]));}})[_0x669b('0x29')](function(_0x5b7e93){if(_0x5b7e93){if(!_[_0x669b('0x66')](_0x30febb[_0x669b('0x36')]['ticketType'])){_0x48824d=_0x30febb[_0x669b('0x36')][_0x669b('0x67')];}return _0x3f3a7a[_0x669b('0x68')](_0x48824d)[_0x669b('0x69')]();}})['then'](function(_0x3dfd9e){var _0x18ee9b=['OwnerId','ActivityDate','IsReminderSet',_0x669b('0x6a'),_0x669b('0x6b'),_0x669b('0x6c')];var _0x3b0057=[_0x669b('0x6d'),'int','picklist','boolean',_0x669b('0x6e'),_0x669b('0x6f'),'phone'];if(_0x3dfd9e){_[_0x669b('0x70')](_0x3dfd9e[_0x669b('0x3a')],function(_0x53fe5d){return _0x18ee9b[_0x669b('0x71')](_0x53fe5d['name'])||!_0x3b0057['includes'](_0x53fe5d[_0x669b('0x32')]);});return{'count':_0x3dfd9e[_0x669b('0x3a')]['length'],'rows':_[_0x669b('0x35')](_0x3dfd9e[_0x669b('0x3a')],function(_0x328f6b){return{'id':_0x328f6b['name'],'name':_0x328f6b[_0x669b('0x72')],'custom':_0x328f6b['custom'],'options':_0x328f6b[_0x669b('0x73')][_0x669b('0x3b')]>0x0?_[_0x669b('0x35')](_0x328f6b['picklistValues'],function(_0x32462e){return{'name':_0x32462e['label'],'value':_0x32462e[_0x669b('0x74')]};}):_0x328f6b[_0x669b('0x32')]==_0x669b('0x75')?[{'name':_0x669b('0x76'),'value':_0x669b('0x77')},{'name':_0x669b('0x78'),'value':_0x669b('0x79')}]:[]};})};}})[_0x669b('0x29')](respondWithResult(_0x55808d,null))[_0x669b('0x49')](function(_0x5d2a13){var _0x8c9ac=_0x30febb[_0x669b('0x36')][_0x669b('0x7a')]?0x1f4:_0x5d2a13['statusCode']||0x1f4;logger[_0x669b('0x2a')](_0x669b('0x7b'),_0x669b('0x5a'),_0x8c9ac,JSON[_0x669b('0x7c')](_0x5d2a13));delete _0x5d2a13[_0x669b('0x2c')];if(_0x8c9ac===0x191){_0x8c9ac=0x190;}_0x55808d[_0x669b('0x1e')](_0x8c9ac)['send'](_0x30febb[_0x669b('0x36')][_0x669b('0x7a')]?{'message':_0x669b('0x7d'),'statusCode':_0x5d2a13['statusCode']}:_0x5d2a13);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8c96282..3c0816f 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 _0x8f32=['rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x8f32,0x102));var _0x28f3=function(_0x59a48e,_0x25600a){_0x59a48e=_0x59a48e-0x0;var _0xdacc9a=_0x8f32[_0x59a48e];return _0xdacc9a;};'use strict';var _=require(_0x28f3('0x0'));var util=require('util');var logger=require(_0x28f3('0x1'))(_0x28f3('0x2'));var moment=require(_0x28f3('0x3'));var BPromise=require(_0x28f3('0x4'));var rp=require(_0x28f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28f3('0x6'));var config=require('../../config/environment');var attributes=require(_0x28f3('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x28f3('0x8')]=function(_0x2831fe,_0x5b8eee){return _0x2831fe[_0x28f3('0x9')](_0x28f3('0xa'),attributes,{'tableName':_0x28f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa923=['lodash','util','../../config/logger','moment','bluebird','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount'];(function(_0x2d1481,_0x3404ce){var _0x2f8e06=function(_0x320670){while(--_0x320670){_0x2d1481['push'](_0x2d1481['shift']());}};_0x2f8e06(++_0x3404ce);}(_0xa923,0xc8));var _0x3a92=function(_0x5ac05b,_0x45e8ce){_0x5ac05b=_0x5ac05b-0x0;var _0x4e5369=_0xa923[_0x5ac05b];return _0x4e5369;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var logger=require(_0x3a92('0x2'))('api');var moment=require(_0x3a92('0x3'));var BPromise=require(_0x3a92('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a92('0x5'));var config=require('../../config/environment');var attributes=require(_0x3a92('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3a92('0x7')]=function(_0x37407b,_0x3a1751){return _0x37407b[_0x3a92('0x8')](_0x3a92('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index b191f3a..5aedc51 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 _0xcb1a=['GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowSalesforceAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4446f6,_0x21ad25){var _0x3aa6f1=function(_0x41edbc){while(--_0x41edbc){_0x4446f6['push'](_0x4446f6['shift']());}};_0x3aa6f1(++_0x21ad25);}(_0xcb1a,0xb6));var _0xacb1=function(_0x3a9989,_0x2c8c70){_0x3a9989=_0x3a9989-0x0;var _0x4a6300=_0xcb1a[_0x3a9989];return _0x4a6300;};'use strict';var _=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var moment=require(_0xacb1('0x2'));var BPromise=require(_0xacb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacb1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacb1('0x5'))(_0xacb1('0x6'));var config=require('../../config/environment');var jayson=require(_0xacb1('0x7'));var client=jayson[_0xacb1('0x8')][_0xacb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x317779,_0x270f0d,_0xb6ec05){return new BPromise(function(_0x54888c,_0x39a417){return client[_0xacb1('0xa')](_0x317779,_0xb6ec05)[_0xacb1('0xb')](function(_0x1492f3){logger[_0xacb1('0xc')](_0xacb1('0xd'),_0x270f0d,_0xacb1('0xe'));logger[_0xacb1('0xf')](_0xacb1('0x10'),_0x270f0d,_0xacb1('0xe'),JSON[_0xacb1('0x11')](_0x1492f3));if(_0x1492f3['error']){if(_0x1492f3[_0xacb1('0x12')][_0xacb1('0x13')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x270f0d,_0x1492f3[_0xacb1('0x12')][_0xacb1('0x14')]);return _0x39a417(_0x1492f3[_0xacb1('0x12')][_0xacb1('0x14')]);}logger[_0xacb1('0x12')](_0xacb1('0xd'),_0x270f0d,_0x1492f3['error'][_0xacb1('0x14')]);return _0x54888c(_0x1492f3['error'][_0xacb1('0x14')]);}else{logger[_0xacb1('0xc')](_0xacb1('0xd'),_0x270f0d,_0xacb1('0xe'));_0x54888c(_0x1492f3['result']['message']);}})[_0xacb1('0x15')](function(_0x2bed0d){logger[_0xacb1('0x12')](_0xacb1('0xd'),_0x270f0d,_0x2bed0d);_0x39a417(_0x2bed0d);});});}exports[_0xacb1('0x16')]=function(_0x687132){var _0x58821f=this;return new Promise(function(_0x393c83,_0x460ad9){return db[_0xacb1('0x17')][_0xacb1('0x18')]({'raw':_0x687132[_0xacb1('0x19')]?_0x687132[_0xacb1('0x19')][_0xacb1('0x1a')]===undefined?!![]:![]:!![],'where':_0x687132[_0xacb1('0x19')]?_0x687132[_0xacb1('0x19')][_0xacb1('0x1b')]||null:null,'attributes':_0x687132[_0xacb1('0x19')]?_0x687132[_0xacb1('0x19')][_0xacb1('0x1c')]||null:null,'limit':_0x687132[_0xacb1('0x19')]?_0x687132[_0xacb1('0x19')][_0xacb1('0x1d')]||null:null,'include':_0x687132[_0xacb1('0x19')]?_0x687132[_0xacb1('0x19')]['include']?_[_0xacb1('0x1e')](_0x687132[_0xacb1('0x19')]['include'],function(_0x4c96f6){return{'model':db[_0x4c96f6[_0xacb1('0x1f')]],'as':_0x4c96f6['as'],'attributes':_0x4c96f6[_0xacb1('0x1c')],'include':_0x4c96f6['include']?_[_0xacb1('0x1e')](_0x4c96f6[_0xacb1('0x20')],function(_0x11374f){return{'model':db[_0x11374f[_0xacb1('0x1f')]],'as':_0x11374f['as'],'attributes':_0x11374f['attributes'],'include':_0x11374f['include']?_[_0xacb1('0x1e')](_0x11374f[_0xacb1('0x20')],function(_0x5dd30e){return{'model':db[_0x5dd30e[_0xacb1('0x1f')]],'as':_0x5dd30e['as'],'attributes':_0x5dd30e[_0xacb1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacb1('0xb')](function(_0xa77c67){logger[_0xacb1('0xc')]('GetSalesforceAccount',_0x687132);logger[_0xacb1('0xf')](_0xacb1('0x16'),_0x687132,JSON['stringify'](_0xa77c67));_0x393c83(_0xa77c67);})[_0xacb1('0x15')](function(_0x2e41bd){logger[_0xacb1('0x12')]('GetSalesforceAccount',_0x2e41bd[_0xacb1('0x14')],_0x687132);_0x460ad9(_0x58821f[_0xacb1('0x12')](0x1f4,_0x2e41bd['message']));});});};exports[_0xacb1('0x21')]=function(_0xd15adc){var _0x1ae7ef=this;return new Promise(function(_0x4f537b,_0x5943db){return db[_0xacb1('0x17')]['find']({'raw':_0xd15adc[_0xacb1('0x19')]?_0xd15adc[_0xacb1('0x19')][_0xacb1('0x1a')]===undefined?!![]:![]:!![],'where':_0xd15adc[_0xacb1('0x19')]?_0xd15adc[_0xacb1('0x19')][_0xacb1('0x1b')]||null:null,'attributes':_0xd15adc[_0xacb1('0x19')]?_0xd15adc[_0xacb1('0x19')][_0xacb1('0x1c')]||null:null,'include':_0xd15adc[_0xacb1('0x19')]?_0xd15adc[_0xacb1('0x19')][_0xacb1('0x20')]?_[_0xacb1('0x1e')](_0xd15adc[_0xacb1('0x19')][_0xacb1('0x20')],function(_0x234dc0){return{'model':db[_0x234dc0['model']],'as':_0x234dc0['as'],'attributes':_0x234dc0[_0xacb1('0x1c')],'include':_0x234dc0[_0xacb1('0x20')]?_['map'](_0x234dc0[_0xacb1('0x20')],function(_0x42e307){return{'model':db[_0x42e307['model']],'as':_0x42e307['as'],'attributes':_0x42e307[_0xacb1('0x1c')],'include':_0x42e307[_0xacb1('0x20')]?_[_0xacb1('0x1e')](_0x42e307['include'],function(_0x12f335){return{'model':db[_0x12f335[_0xacb1('0x1f')]],'as':_0x12f335['as'],'attributes':_0x12f335[_0xacb1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacb1('0xb')](function(_0x43a824){logger[_0xacb1('0xc')](_0xacb1('0x21'),_0xd15adc);logger[_0xacb1('0xf')]('ShowSalesforceAccount',_0xd15adc,JSON[_0xacb1('0x11')](_0x43a824));_0x4f537b(_0x43a824);})[_0xacb1('0x15')](function(_0x4316f2){logger['error'](_0xacb1('0x21'),_0x4316f2[_0xacb1('0x14')],_0xd15adc);_0x5943db(_0x1ae7ef['error'](0x1f4,_0x4316f2[_0xacb1('0x14')]));});});}; \ No newline at end of file +var _0x4b87=['GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowSalesforceAccount','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x2d5c94,_0x4fb0b3){var _0x1e564f=function(_0x27336c){while(--_0x27336c){_0x2d5c94['push'](_0x2d5c94['shift']());}};_0x1e564f(++_0x4fb0b3);}(_0x4b87,0x1dc));var _0x74b8=function(_0x44fe9e,_0x2b9290){_0x44fe9e=_0x44fe9e-0x0;var _0x27161a=_0x4b87[_0x44fe9e];return _0x27161a;};'use strict';var _=require(_0x74b8('0x0'));var util=require(_0x74b8('0x1'));var moment=require('moment');var BPromise=require(_0x74b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74b8('0x3'));var db=require(_0x74b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x74b8('0x5'))(_0x74b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x74b8('0x7'));var client=jayson[_0x74b8('0x8')][_0x74b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd25a67,_0x496f77,_0x515d49){return new BPromise(function(_0x539a30,_0x14a9c2){return client['request'](_0xd25a67,_0x515d49)[_0x74b8('0xa')](function(_0x340c0d){logger[_0x74b8('0xb')](_0x74b8('0xc'),_0x496f77,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x496f77,_0x74b8('0xd'),JSON[_0x74b8('0xe')](_0x340c0d));if(_0x340c0d[_0x74b8('0xf')]){if(_0x340c0d[_0x74b8('0xf')]['code']===0x1f4){logger[_0x74b8('0xf')](_0x74b8('0xc'),_0x496f77,_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);return _0x14a9c2(_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);}logger[_0x74b8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x496f77,_0x340c0d['error'][_0x74b8('0x10')]);return _0x539a30(_0x340c0d[_0x74b8('0xf')][_0x74b8('0x10')]);}else{logger['info'](_0x74b8('0xc'),_0x496f77,_0x74b8('0xd'));_0x539a30(_0x340c0d[_0x74b8('0x11')][_0x74b8('0x10')]);}})[_0x74b8('0x12')](function(_0x4aefca){logger[_0x74b8('0xf')](_0x74b8('0xc'),_0x496f77,_0x4aefca);_0x14a9c2(_0x4aefca);});});}exports[_0x74b8('0x13')]=function(_0x49e7d2){var _0x45ec2b=this;return new Promise(function(_0xa84637,_0x341109){return db[_0x74b8('0x14')][_0x74b8('0x15')]({'raw':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x17')]===undefined?!![]:![]:!![],'where':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2['options'][_0x74b8('0x18')]||null:null,'attributes':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x19')]||null:null,'limit':_0x49e7d2['options']?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1a')]||null:null,'include':_0x49e7d2[_0x74b8('0x16')]?_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1b')]?_['map'](_0x49e7d2[_0x74b8('0x16')][_0x74b8('0x1b')],function(_0x42e09c){return{'model':db[_0x42e09c[_0x74b8('0x1c')]],'as':_0x42e09c['as'],'attributes':_0x42e09c[_0x74b8('0x19')],'include':_0x42e09c[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x42e09c[_0x74b8('0x1b')],function(_0x38a9a4){return{'model':db[_0x38a9a4['model']],'as':_0x38a9a4['as'],'attributes':_0x38a9a4['attributes'],'include':_0x38a9a4[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x38a9a4[_0x74b8('0x1b')],function(_0x12b59f){return{'model':db[_0x12b59f[_0x74b8('0x1c')]],'as':_0x12b59f['as'],'attributes':_0x12b59f[_0x74b8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74b8('0xa')](function(_0x26a27a){logger[_0x74b8('0xb')]('GetSalesforceAccount',_0x49e7d2);logger['debug'](_0x74b8('0x13'),_0x49e7d2,JSON[_0x74b8('0xe')](_0x26a27a));_0xa84637(_0x26a27a);})['catch'](function(_0x4a18b6){logger[_0x74b8('0xf')](_0x74b8('0x13'),_0x4a18b6[_0x74b8('0x10')],_0x49e7d2);_0x341109(_0x45ec2b[_0x74b8('0xf')](0x1f4,_0x4a18b6[_0x74b8('0x10')]));});});};exports['ShowSalesforceAccount']=function(_0x286e4e){var _0x3a257e=this;return new Promise(function(_0x47eee6,_0x35de79){return db['SalesforceAccount'][_0x74b8('0x1e')]({'raw':_0x286e4e[_0x74b8('0x16')]?_0x286e4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x286e4e['options']?_0x286e4e['options'][_0x74b8('0x18')]||null:null,'attributes':_0x286e4e['options']?_0x286e4e[_0x74b8('0x16')]['attributes']||null:null,'include':_0x286e4e[_0x74b8('0x16')]?_0x286e4e['options'][_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x286e4e['options'][_0x74b8('0x1b')],function(_0x5bee7c){return{'model':db[_0x5bee7c['model']],'as':_0x5bee7c['as'],'attributes':_0x5bee7c[_0x74b8('0x19')],'include':_0x5bee7c[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x5bee7c[_0x74b8('0x1b')],function(_0x2e3b08){return{'model':db[_0x2e3b08[_0x74b8('0x1c')]],'as':_0x2e3b08['as'],'attributes':_0x2e3b08[_0x74b8('0x19')],'include':_0x2e3b08[_0x74b8('0x1b')]?_[_0x74b8('0x1d')](_0x2e3b08['include'],function(_0x28a28a){return{'model':db[_0x28a28a[_0x74b8('0x1c')]],'as':_0x28a28a['as'],'attributes':_0x28a28a['attributes']};}):[]};}):[]};}):[]:[]})[_0x74b8('0xa')](function(_0x140faa){logger[_0x74b8('0xb')](_0x74b8('0x1f'),_0x286e4e);logger[_0x74b8('0x20')]('ShowSalesforceAccount',_0x286e4e,JSON['stringify'](_0x140faa));_0x47eee6(_0x140faa);})['catch'](function(_0x317d08){logger[_0x74b8('0xf')]('ShowSalesforceAccount',_0x317d08[_0x74b8('0x10')],_0x286e4e);_0x35de79(_0x3a257e[_0x74b8('0xf')](0x1f4,_0x317d08['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a57b01e..894d8bd 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x157eaf,_0x39264f){var _0x432f0b=function(_0x20baad){while(--_0x20baad){_0x157eaf['push'](_0x157eaf['shift']());}};_0x432f0b(++_0x39264f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x1610fb,_0x571498){_0x1610fb=_0x1610fb-0x0;var _0x4bf6d5=_0x2032[_0x1610fb];return _0x4bf6d5;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0cf6ae0..bbb1795 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 _0xf368=['exports','STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead','lead','account','sequelize'];(function(_0x4caa90,_0x5bb693){var _0x412023=function(_0x1b958e){while(--_0x1b958e){_0x4caa90['push'](_0x4caa90['shift']());}};_0x412023(++_0x5bb693);}(_0xf368,0x107));var _0x8f36=function(_0x36e02a,_0x5d262d){_0x36e02a=_0x36e02a-0x0;var _0x4698c3=_0xf368[_0x36e02a];return _0x4698c3;};'use strict';var Sequelize=require(_0x8f36('0x0'));module[_0x8f36('0x1')]={'name':{'type':Sequelize[_0x8f36('0x2')]},'description':{'type':Sequelize[_0x8f36('0x2')]},'ticketType':{'type':Sequelize[_0x8f36('0x3')](_0x8f36('0x4'),_0x8f36('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x8f36('0x3')](_0x8f36('0x6'),_0x8f36('0x7'),'lead',_0x8f36('0x8'),'account'),'defaultValue':_0x8f36('0x6')},'moduleCreate':{'type':Sequelize[_0x8f36('0x3')]('nothing','contact',_0x8f36('0x9'),_0x8f36('0xa')),'defaultValue':_0x8f36('0x9')},'leadId':{'type':Sequelize[_0x8f36('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8f36('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x8f36('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x8f36('0x2')]}}; \ No newline at end of file +var _0x60fc=['exports','STRING','Task','Case','lead','account_contact_lead','contact','account','sequelize'];(function(_0xba606b,_0x2d93ba){var _0x1c036a=function(_0x75c4ad){while(--_0x75c4ad){_0xba606b['push'](_0xba606b['shift']());}};_0x1c036a(++_0x2d93ba);}(_0x60fc,0x128));var _0xc60f=function(_0x19ad6b,_0x53abda){_0x19ad6b=_0x19ad6b-0x0;var _0x32ad40=_0x60fc[_0x19ad6b];return _0x32ad40;};'use strict';var Sequelize=require(_0xc60f('0x0'));module[_0xc60f('0x1')]={'name':{'type':Sequelize[_0xc60f('0x2')]},'description':{'type':Sequelize[_0xc60f('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xc60f('0x3'),_0xc60f('0x4')),'defaultValue':_0xc60f('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xc60f('0x5'),_0xc60f('0x6'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xc60f('0x7'),_0xc60f('0x5'),_0xc60f('0x8')),'defaultValue':_0xc60f('0x5')},'leadId':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc60f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc60f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e675600..901a358 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 _0x39d5=['name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','params','includeAll','include','find','create','body','catch','findOne','SalesforceField','getFields','getSubjects','merge','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','json','apply','reject','update','then','destroy','sendStatus','stack'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x39d5,0x11c));var _0x539d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x39d5[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x539d('0x0'));var rimraf=require(_0x539d('0x1'));var zipdir=require(_0x539d('0x2'));var jsonpatch=require(_0x539d('0x3'));var rp=require(_0x539d('0x4'));var moment=require('moment');var BPromise=require(_0x539d('0x5'));var Mustache=require(_0x539d('0x6'));var util=require(_0x539d('0x7'));var path=require(_0x539d('0x8'));var sox=require(_0x539d('0x9'));var csv=require(_0x539d('0xa'));var ejs=require(_0x539d('0xb'));var fs=require('fs');var fs_extra=require(_0x539d('0xc'));var _=require(_0x539d('0xd'));var squel=require('squel');var crypto=require(_0x539d('0xe'));var jsforce=require(_0x539d('0xf'));var deskjs=require(_0x539d('0x10'));var toCsv=require(_0x539d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x539d('0x11'));var authService=require(_0x539d('0x12'));var qs=require(_0x539d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x539d('0x14'));var logger=require(_0x539d('0x15'))(_0x539d('0x16'));var utils=require(_0x539d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x539d('0x18'));var db=require(_0x539d('0x19'))['db'];function respondWithStatusCode(_0x4e774f,_0x4180aa){_0x4180aa=_0x4180aa||0xcc;return function(_0x3f0582){if(_0x3f0582){return _0x4e774f['sendStatus'](_0x4180aa);}return _0x4e774f['status'](_0x4180aa)['end']();};}function respondWithResult(_0x559b1c,_0xf0ed4e){_0xf0ed4e=_0xf0ed4e||0xc8;return function(_0x140fe0){if(_0x140fe0){return _0x559b1c[_0x539d('0x1a')](_0xf0ed4e)['json'](_0x140fe0);}};}function respondWithFilteredResult(_0x3c8474,_0x2c77c4){return function(_0x1b9a13){if(_0x1b9a13){var _0x4ba5bb=typeof _0x2c77c4['offset']==='undefined'&&typeof _0x2c77c4['limit']===_0x539d('0x1b');var _0x49d8af=_0x1b9a13[_0x539d('0x1c')];var _0x34cd92=_0x4ba5bb?0x0:_0x2c77c4[_0x539d('0x1d')];var _0x4e5c38=_0x4ba5bb?_0x1b9a13[_0x539d('0x1c')]:_0x2c77c4[_0x539d('0x1d')]+_0x2c77c4[_0x539d('0x1e')];var _0x2b0293;if(_0x4e5c38>=_0x49d8af){_0x4e5c38=_0x49d8af;_0x2b0293=0xc8;}else{_0x2b0293=0xce;}_0x3c8474[_0x539d('0x1a')](_0x2b0293);return _0x3c8474[_0x539d('0x1f')]('Content-Range',_0x34cd92+'-'+_0x4e5c38+'/'+_0x49d8af)[_0x539d('0x20')](_0x1b9a13);}return null;};}function patchUpdates(_0x55b47c){return function(_0x23eca3){try{jsonpatch[_0x539d('0x21')](_0x23eca3,_0x55b47c,!![]);}catch(_0x2eef6d){return BPromise[_0x539d('0x22')](_0x2eef6d);}return _0x23eca3['save']();};}function saveUpdates(_0x254c3a,_0x498f77){return function(_0x39710b){if(_0x39710b){return _0x39710b[_0x539d('0x23')](_0x254c3a)[_0x539d('0x24')](function(_0x429948){return _0x429948;});}return null;};}function removeEntity(_0x235baf,_0x1dde83){return function(_0x214d77){if(_0x214d77){return _0x214d77[_0x539d('0x25')]()[_0x539d('0x24')](function(){_0x235baf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33b9ba,_0x4225f7){return function(_0x3b4a7a){if(!_0x3b4a7a){_0x33b9ba[_0x539d('0x26')](0x194);}return _0x3b4a7a;};}function handleError(_0x133222,_0x3a9261){_0x3a9261=_0x3a9261||0x1f4;return function(_0x5b91d6){logger['error'](_0x5b91d6[_0x539d('0x27')]);if(_0x5b91d6[_0x539d('0x28')]){delete _0x5b91d6[_0x539d('0x28')];}_0x133222['status'](_0x3a9261)[_0x539d('0x29')](_0x5b91d6);};}exports[_0x539d('0x2a')]=function(_0x295d89,_0xfb90c){var _0x245891={},_0xe7b2af={},_0x4ca45b={'count':0x0,'rows':[]};var _0x24fa3a=_['map'](db[_0x539d('0x2b')][_0x539d('0x2c')],function(_0x33309d){return{'name':_0x33309d[_0x539d('0x2d')],'type':_0x33309d[_0x539d('0x2e')][_0x539d('0x2f')]};});_0xe7b2af[_0x539d('0x30')]=_[_0x539d('0x31')](_0x24fa3a,_0x539d('0x28'));_0xe7b2af[_0x539d('0x32')]=_[_0x539d('0x33')](_0x295d89[_0x539d('0x32')]);_0xe7b2af[_0x539d('0x34')]=_[_0x539d('0x35')](_0xe7b2af[_0x539d('0x30')],_0xe7b2af[_0x539d('0x32')]);_0x245891[_0x539d('0x36')]=_['intersection'](_0xe7b2af['model'],qs[_0x539d('0x37')](_0x295d89[_0x539d('0x32')][_0x539d('0x37')]));_0x245891[_0x539d('0x36')]=_0x245891['attributes'][_0x539d('0x38')]?_0x245891[_0x539d('0x36')]:_0xe7b2af[_0x539d('0x30')];if(!_0x295d89[_0x539d('0x32')][_0x539d('0x39')](_0x539d('0x3a'))){_0x245891[_0x539d('0x1e')]=qs[_0x539d('0x1e')](_0x295d89[_0x539d('0x32')][_0x539d('0x1e')]);_0x245891[_0x539d('0x1d')]=qs[_0x539d('0x1d')](_0x295d89[_0x539d('0x32')][_0x539d('0x1d')]);}_0x245891[_0x539d('0x3b')]=qs[_0x539d('0x3c')](_0x295d89['query'][_0x539d('0x3c')]);_0x245891[_0x539d('0x3d')]=qs[_0x539d('0x34')](_[_0x539d('0x3e')](_0x295d89[_0x539d('0x32')],_0xe7b2af['filters']),_0x24fa3a);if(_0x295d89['query'][_0x539d('0x3f')]){_0x245891[_0x539d('0x3d')]=_['merge'](_0x245891['where'],{'$or':_[_0x539d('0x31')](_0x24fa3a,function(_0x4f3be5){if(_0x4f3be5[_0x539d('0x2e')]!==_0x539d('0x40')){var _0x5b6674={};_0x5b6674[_0x4f3be5['name']]={'$like':'%'+_0x295d89['query'][_0x539d('0x3f')]+'%'};return _0x5b6674;}})});}_0x245891=_['merge']({},_0x245891,_0x295d89[_0x539d('0x41')]);var _0x9de9ac={'where':_0x245891[_0x539d('0x3d')]};return db[_0x539d('0x2b')]['count'](_0x9de9ac)[_0x539d('0x24')](function(_0x2f6547){_0x4ca45b[_0x539d('0x1c')]=_0x2f6547;if(_0x295d89[_0x539d('0x32')]['includeAll']){_0x245891['include']=[{'all':!![]}];}return db[_0x539d('0x2b')][_0x539d('0x42')](_0x245891);})[_0x539d('0x24')](function(_0x58cd69){_0x4ca45b[_0x539d('0x43')]=_0x58cd69;return _0x4ca45b;})[_0x539d('0x24')](respondWithFilteredResult(_0xfb90c,_0x245891))['catch'](handleError(_0xfb90c,null));};exports['show']=function(_0x348fc8,_0x654f7c){var _0x38106f={'raw':![],'where':{'id':_0x348fc8[_0x539d('0x44')]['id']}},_0x2c1bde={};_0x2c1bde['model']=_[_0x539d('0x33')](db['SalesforceConfiguration'][_0x539d('0x2c')]);_0x2c1bde['query']=_[_0x539d('0x33')](_0x348fc8[_0x539d('0x32')]);_0x2c1bde['filters']=_[_0x539d('0x35')](_0x2c1bde[_0x539d('0x30')],_0x2c1bde[_0x539d('0x32')]);_0x38106f[_0x539d('0x36')]=_[_0x539d('0x35')](_0x2c1bde[_0x539d('0x30')],qs[_0x539d('0x37')](_0x348fc8[_0x539d('0x32')][_0x539d('0x37')]));_0x38106f['attributes']=_0x38106f[_0x539d('0x36')][_0x539d('0x38')]?_0x38106f[_0x539d('0x36')]:_0x2c1bde[_0x539d('0x30')];if(_0x348fc8['query'][_0x539d('0x45')]){_0x38106f[_0x539d('0x46')]=[{'all':!![]}];}_0x38106f=_['merge']({},_0x38106f,_0x348fc8[_0x539d('0x41')]);return db[_0x539d('0x2b')][_0x539d('0x47')](_0x38106f)[_0x539d('0x24')](handleEntityNotFound(_0x654f7c,null))[_0x539d('0x24')](respondWithResult(_0x654f7c,null))['catch'](handleError(_0x654f7c,null));};exports[_0x539d('0x48')]=function(_0x524cf,_0x3ab9b3){return db[_0x539d('0x2b')][_0x539d('0x48')](_0x524cf[_0x539d('0x49')],{})[_0x539d('0x24')](respondWithResult(_0x3ab9b3,0xc9))[_0x539d('0x4a')](handleError(_0x3ab9b3,null));};exports[_0x539d('0x23')]=function(_0x40bd62,_0x112dde){if(_0x40bd62['body']['id']){delete _0x40bd62[_0x539d('0x49')]['id'];}return db[_0x539d('0x2b')][_0x539d('0x47')]({'where':{'id':_0x40bd62[_0x539d('0x44')]['id']}})[_0x539d('0x24')](handleEntityNotFound(_0x112dde,null))[_0x539d('0x24')](saveUpdates(_0x40bd62[_0x539d('0x49')],null))['then'](respondWithResult(_0x112dde,null))[_0x539d('0x4a')](handleError(_0x112dde,null));};exports['destroy']=function(_0x47bae3,_0x10c8ed){return db[_0x539d('0x2b')][_0x539d('0x47')]({'where':{'id':_0x47bae3[_0x539d('0x44')]['id']}})[_0x539d('0x24')](handleEntityNotFound(_0x10c8ed,null))[_0x539d('0x24')](removeEntity(_0x10c8ed,null))[_0x539d('0x4a')](handleError(_0x10c8ed,null));};exports['getFields']=function(_0x2f9cef,_0x2589e5,_0x103b05){var _0x2fdaf9={};var _0x7508c7={};var _0x2babd9;var _0x7aa3b5;return db[_0x539d('0x2b')][_0x539d('0x4b')]({'where':{'id':_0x2f9cef['params']['id']}})[_0x539d('0x24')](handleEntityNotFound(_0x2589e5,null))['then'](function(_0x4d4e7d){if(_0x4d4e7d){_0x2babd9=_0x4d4e7d;_0x7508c7[_0x539d('0x30')]=_[_0x539d('0x33')](db[_0x539d('0x4c')]['rawAttributes']);_0x7508c7['query']=_[_0x539d('0x33')](_0x2f9cef['query']);_0x7508c7[_0x539d('0x34')]=_[_0x539d('0x35')](_0x7508c7['model'],_0x7508c7[_0x539d('0x32')]);_0x2fdaf9[_0x539d('0x36')]=_['intersection'](_0x7508c7[_0x539d('0x30')],qs[_0x539d('0x37')](_0x2f9cef[_0x539d('0x32')]['fields']));_0x2fdaf9['attributes']=_0x2fdaf9['attributes'][_0x539d('0x38')]?_0x2fdaf9[_0x539d('0x36')]:_0x7508c7[_0x539d('0x30')];_0x2fdaf9[_0x539d('0x3b')]=qs[_0x539d('0x3c')](_0x2f9cef[_0x539d('0x32')]['sort']);_0x2fdaf9[_0x539d('0x3d')]=qs[_0x539d('0x34')](_[_0x539d('0x3e')](_0x2f9cef[_0x539d('0x32')],_0x7508c7['filters']));if(_0x2f9cef[_0x539d('0x32')][_0x539d('0x3f')]){_0x2fdaf9[_0x539d('0x3d')]=_['merge'](_0x2fdaf9['where'],{'$or':_['map'](_0x2fdaf9[_0x539d('0x36')],function(_0x459111){var _0x55b82a={};_0x55b82a[_0x459111]={'$like':'%'+_0x2f9cef[_0x539d('0x32')][_0x539d('0x3f')]+'%'};return _0x55b82a;})});}_0x2fdaf9=_['merge']({},_0x2fdaf9,_0x2f9cef[_0x539d('0x41')]);return _0x2babd9[_0x539d('0x4d')](_0x2fdaf9);}})[_0x539d('0x24')](function(_0x4913f0){if(_0x4913f0){_0x7aa3b5=_0x4913f0[_0x539d('0x38')];if(!_0x2f9cef[_0x539d('0x32')]['hasOwnProperty'](_0x539d('0x3a'))){_0x2fdaf9[_0x539d('0x1e')]=qs[_0x539d('0x1e')](_0x2f9cef[_0x539d('0x32')][_0x539d('0x1e')]);_0x2fdaf9['offset']=qs[_0x539d('0x1d')](_0x2f9cef[_0x539d('0x32')][_0x539d('0x1d')]);}return _0x2babd9[_0x539d('0x4d')](_0x2fdaf9);}})[_0x539d('0x24')](function(_0x421e5a){if(_0x421e5a){return _0x421e5a?{'count':_0x7aa3b5,'rows':_0x421e5a}:null;}})[_0x539d('0x24')](respondWithResult(_0x2589e5,null))[_0x539d('0x4a')](handleError(_0x2589e5,null));};exports[_0x539d('0x4e')]=function(_0x93879a,_0x521828,_0x2dc811){var _0x31e800={};var _0x11b5ea={};var _0x25c92b;var _0x59f224;return db['SalesforceConfiguration'][_0x539d('0x4b')]({'where':{'id':_0x93879a['params']['id']}})[_0x539d('0x24')](handleEntityNotFound(_0x521828,null))[_0x539d('0x24')](function(_0x288be3){if(_0x288be3){_0x25c92b=_0x288be3;_0x11b5ea[_0x539d('0x30')]=_[_0x539d('0x33')](db[_0x539d('0x4c')][_0x539d('0x2c')]);_0x11b5ea[_0x539d('0x32')]=_[_0x539d('0x33')](_0x93879a[_0x539d('0x32')]);_0x11b5ea[_0x539d('0x34')]=_[_0x539d('0x35')](_0x11b5ea['model'],_0x11b5ea[_0x539d('0x32')]);_0x31e800['attributes']=_[_0x539d('0x35')](_0x11b5ea[_0x539d('0x30')],qs[_0x539d('0x37')](_0x93879a[_0x539d('0x32')][_0x539d('0x37')]));_0x31e800['attributes']=_0x31e800[_0x539d('0x36')][_0x539d('0x38')]?_0x31e800[_0x539d('0x36')]:_0x11b5ea['model'];_0x31e800[_0x539d('0x3b')]=qs[_0x539d('0x3c')](_0x93879a[_0x539d('0x32')]['sort']);_0x31e800[_0x539d('0x3d')]=qs['filters'](_[_0x539d('0x3e')](_0x93879a[_0x539d('0x32')],_0x11b5ea[_0x539d('0x34')]));if(_0x93879a[_0x539d('0x32')]['filter']){_0x31e800['where']=_[_0x539d('0x4f')](_0x31e800['where'],{'$or':_['map'](_0x31e800[_0x539d('0x36')],function(_0x38414b){var _0x3c8b66={};_0x3c8b66[_0x38414b]={'$like':'%'+_0x93879a[_0x539d('0x32')]['filter']+'%'};return _0x3c8b66;})});}_0x31e800=_[_0x539d('0x4f')]({},_0x31e800,_0x93879a[_0x539d('0x41')]);return _0x25c92b[_0x539d('0x4e')](_0x31e800);}})['then'](function(_0x303601){if(_0x303601){_0x59f224=_0x303601['length'];if(!_0x93879a['query']['hasOwnProperty'](_0x539d('0x3a'))){_0x31e800[_0x539d('0x1e')]=qs[_0x539d('0x1e')](_0x93879a[_0x539d('0x32')][_0x539d('0x1e')]);_0x31e800[_0x539d('0x1d')]=qs['offset'](_0x93879a[_0x539d('0x32')]['offset']);}return _0x25c92b[_0x539d('0x4e')](_0x31e800);}})['then'](function(_0x41784c){if(_0x41784c){return _0x41784c?{'count':_0x59f224,'rows':_0x41784c}:null;}})[_0x539d('0x24')](respondWithResult(_0x521828,null))[_0x539d('0x4a')](handleError(_0x521828,null));};exports[_0x539d('0x50')]=function(_0x548db9,_0x13d58f,_0x21059e){var _0x4f194d={};var _0x470c5c={};var _0x28dee9;var _0x4c3b43;return db[_0x539d('0x2b')]['findOne']({'where':{'id':_0x548db9[_0x539d('0x44')]['id']}})[_0x539d('0x24')](handleEntityNotFound(_0x13d58f,null))['then'](function(_0x12c858){if(_0x12c858){_0x28dee9=_0x12c858;_0x470c5c[_0x539d('0x30')]=_[_0x539d('0x33')](db['SalesforceField'][_0x539d('0x2c')]);_0x470c5c[_0x539d('0x32')]=_[_0x539d('0x33')](_0x548db9['query']);_0x470c5c[_0x539d('0x34')]=_['intersection'](_0x470c5c[_0x539d('0x30')],_0x470c5c['query']);_0x4f194d[_0x539d('0x36')]=_['intersection'](_0x470c5c[_0x539d('0x30')],qs[_0x539d('0x37')](_0x548db9[_0x539d('0x32')]['fields']));_0x4f194d[_0x539d('0x36')]=_0x4f194d[_0x539d('0x36')]['length']?_0x4f194d[_0x539d('0x36')]:_0x470c5c['model'];_0x4f194d['order']=qs[_0x539d('0x3c')](_0x548db9[_0x539d('0x32')]['sort']);_0x4f194d[_0x539d('0x3d')]=qs[_0x539d('0x34')](_[_0x539d('0x3e')](_0x548db9[_0x539d('0x32')],_0x470c5c[_0x539d('0x34')]));if(_0x548db9[_0x539d('0x32')][_0x539d('0x3f')]){_0x4f194d[_0x539d('0x3d')]=_[_0x539d('0x4f')](_0x4f194d[_0x539d('0x3d')],{'$or':_[_0x539d('0x31')](_0x4f194d['attributes'],function(_0x3dc985){var _0x37bfae={};_0x37bfae[_0x3dc985]={'$like':'%'+_0x548db9[_0x539d('0x32')][_0x539d('0x3f')]+'%'};return _0x37bfae;})});}_0x4f194d=_[_0x539d('0x4f')]({},_0x4f194d,_0x548db9[_0x539d('0x41')]);return _0x28dee9[_0x539d('0x50')](_0x4f194d);}})[_0x539d('0x24')](function(_0x1268ac){if(_0x1268ac){_0x4c3b43=_0x1268ac[_0x539d('0x38')];if(!_0x548db9[_0x539d('0x32')][_0x539d('0x39')](_0x539d('0x3a'))){_0x4f194d[_0x539d('0x1e')]=qs[_0x539d('0x1e')](_0x548db9[_0x539d('0x32')][_0x539d('0x1e')]);_0x4f194d['offset']=qs[_0x539d('0x1d')](_0x548db9[_0x539d('0x32')]['offset']);}return _0x28dee9[_0x539d('0x50')](_0x4f194d);}})[_0x539d('0x24')](function(_0x36544d){if(_0x36544d){return _0x36544d?{'count':_0x4c3b43,'rows':_0x36544d}:null;}})[_0x539d('0x24')](respondWithResult(_0x13d58f,null))[_0x539d('0x4a')](handleError(_0x13d58f,null));}; \ No newline at end of file +var _0x1c3b=['findOne','rawAttributes','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields'];(function(_0x1ec618,_0x1b80cd){var _0x4112d0=function(_0x1c2c94){while(--_0x1c2c94){_0x1ec618['push'](_0x1ec618['shift']());}};_0x4112d0(++_0x1b80cd);}(_0x1c3b,0xab));var _0xb1c3=function(_0x3772e7,_0x14926d){_0x3772e7=_0x3772e7-0x0;var _0x5d5eff=_0x1c3b[_0x3772e7];return _0x5d5eff;};'use strict';var emlformat=require(_0xb1c3('0x0'));var rimraf=require(_0xb1c3('0x1'));var zipdir=require(_0xb1c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb1c3('0x3'));var BPromise=require(_0xb1c3('0x4'));var Mustache=require(_0xb1c3('0x5'));var util=require(_0xb1c3('0x6'));var path=require(_0xb1c3('0x7'));var sox=require(_0xb1c3('0x8'));var csv=require('to-csv');var ejs=require(_0xb1c3('0x9'));var fs=require('fs');var fs_extra=require(_0xb1c3('0xa'));var _=require(_0xb1c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb1c3('0xc'));var querystring=require('querystring');var Papa=require(_0xb1c3('0xd'));var Redis=require(_0xb1c3('0xe'));var authService=require(_0xb1c3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb1c3('0x10'));var hardwareService=require(_0xb1c3('0x11'));var logger=require(_0xb1c3('0x12'))('api');var utils=require(_0xb1c3('0x13'));var config=require(_0xb1c3('0x14'));var licenseUtil=require(_0xb1c3('0x15'));var db=require(_0xb1c3('0x16'))['db'];function respondWithStatusCode(_0x4dae53,_0xac2af8){_0xac2af8=_0xac2af8||0xcc;return function(_0x30ce26){if(_0x30ce26){return _0x4dae53[_0xb1c3('0x17')](_0xac2af8);}return _0x4dae53['status'](_0xac2af8)[_0xb1c3('0x18')]();};}function respondWithResult(_0x15de90,_0x57b6c9){_0x57b6c9=_0x57b6c9||0xc8;return function(_0x1eb0fa){if(_0x1eb0fa){return _0x15de90[_0xb1c3('0x19')](_0x57b6c9)[_0xb1c3('0x1a')](_0x1eb0fa);}};}function respondWithFilteredResult(_0x378d7a,_0x1bd7e7){return function(_0x4e5f43){if(_0x4e5f43){var _0x3397f0=typeof _0x1bd7e7[_0xb1c3('0x1b')]===_0xb1c3('0x1c')&&typeof _0x1bd7e7[_0xb1c3('0x1d')]===_0xb1c3('0x1c');var _0x599810=_0x4e5f43[_0xb1c3('0x1e')];var _0x2bdeed=_0x3397f0?0x0:_0x1bd7e7[_0xb1c3('0x1b')];var _0x36b25f=_0x3397f0?_0x4e5f43[_0xb1c3('0x1e')]:_0x1bd7e7[_0xb1c3('0x1b')]+_0x1bd7e7[_0xb1c3('0x1d')];var _0x3d0672;if(_0x36b25f>=_0x599810){_0x36b25f=_0x599810;_0x3d0672=0xc8;}else{_0x3d0672=0xce;}_0x378d7a[_0xb1c3('0x19')](_0x3d0672);return _0x378d7a[_0xb1c3('0x1f')](_0xb1c3('0x20'),_0x2bdeed+'-'+_0x36b25f+'/'+_0x599810)[_0xb1c3('0x1a')](_0x4e5f43);}return null;};}function patchUpdates(_0x10c351){return function(_0x5a0950){try{jsonpatch[_0xb1c3('0x21')](_0x5a0950,_0x10c351,!![]);}catch(_0x443040){return BPromise[_0xb1c3('0x22')](_0x443040);}return _0x5a0950[_0xb1c3('0x23')]();};}function saveUpdates(_0x8570d4,_0x236dd6){return function(_0x585d4b){if(_0x585d4b){return _0x585d4b['update'](_0x8570d4)[_0xb1c3('0x24')](function(_0x430a94){return _0x430a94;});}return null;};}function removeEntity(_0x59d11c,_0xdb96){return function(_0x3778fa){if(_0x3778fa){return _0x3778fa[_0xb1c3('0x25')]()[_0xb1c3('0x24')](function(){_0x59d11c['status'](0xcc)[_0xb1c3('0x18')]();});}};}function handleEntityNotFound(_0x1cefff,_0x3614ae){return function(_0x1bfd04){if(!_0x1bfd04){_0x1cefff[_0xb1c3('0x17')](0x194);}return _0x1bfd04;};}function handleError(_0x5c7f13,_0x31aabe){_0x31aabe=_0x31aabe||0x1f4;return function(_0xc6c566){logger[_0xb1c3('0x26')](_0xc6c566[_0xb1c3('0x27')]);if(_0xc6c566[_0xb1c3('0x28')]){delete _0xc6c566[_0xb1c3('0x28')];}_0x5c7f13[_0xb1c3('0x19')](_0x31aabe)[_0xb1c3('0x29')](_0xc6c566);};}exports[_0xb1c3('0x2a')]=function(_0x31ce8a,_0x1c2ed8){var _0x3a91bb={},_0x11eb58={},_0x5c335f={'count':0x0,'rows':[]};var _0x2b82ff=_['map'](db[_0xb1c3('0x2b')]['rawAttributes'],function(_0x295fae){return{'name':_0x295fae[_0xb1c3('0x2c')],'type':_0x295fae[_0xb1c3('0x2d')][_0xb1c3('0x2e')]};});_0x11eb58[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x2b82ff,'name');_0x11eb58['query']=_[_0xb1c3('0x31')](_0x31ce8a[_0xb1c3('0x32')]);_0x11eb58[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x11eb58[_0xb1c3('0x2f')],_0x11eb58[_0xb1c3('0x32')]);_0x3a91bb[_0xb1c3('0x35')]=_['intersection'](_0x11eb58[_0xb1c3('0x2f')],qs['fields'](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x3a91bb['attributes']=_0x3a91bb[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x3a91bb[_0xb1c3('0x35')]:_0x11eb58[_0xb1c3('0x2f')];if(!_0x31ce8a['query'][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x3a91bb[_0xb1c3('0x1d')]=qs[_0xb1c3('0x1d')](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x3a91bb[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x1b')]);}_0x3a91bb[_0xb1c3('0x3a')]=qs[_0xb1c3('0x3b')](_0x31ce8a['query'][_0xb1c3('0x3b')]);_0x3a91bb[_0xb1c3('0x3c')]=qs['filters'](_[_0xb1c3('0x3d')](_0x31ce8a[_0xb1c3('0x32')],_0x11eb58[_0xb1c3('0x33')]),_0x2b82ff);if(_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x3a91bb[_0xb1c3('0x3c')]=_[_0xb1c3('0x3f')](_0x3a91bb[_0xb1c3('0x3c')],{'$or':_['map'](_0x2b82ff,function(_0x2e6bdc){if(_0x2e6bdc[_0xb1c3('0x2d')]!==_0xb1c3('0x40')){var _0x5b7e25={};_0x5b7e25[_0x2e6bdc['name']]={'$like':'%'+_0x31ce8a[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x5b7e25;}})});}_0x3a91bb=_['merge']({},_0x3a91bb,_0x31ce8a[_0xb1c3('0x41')]);var _0x419db6={'where':_0x3a91bb['where']};return db[_0xb1c3('0x2b')]['count'](_0x419db6)[_0xb1c3('0x24')](function(_0x58c3d9){_0x5c335f[_0xb1c3('0x1e')]=_0x58c3d9;if(_0x31ce8a['query'][_0xb1c3('0x42')]){_0x3a91bb[_0xb1c3('0x43')]=[{'all':!![]}];}return db[_0xb1c3('0x2b')][_0xb1c3('0x44')](_0x3a91bb);})['then'](function(_0x2ce0a5){_0x5c335f[_0xb1c3('0x45')]=_0x2ce0a5;return _0x5c335f;})['then'](respondWithFilteredResult(_0x1c2ed8,_0x3a91bb))[_0xb1c3('0x46')](handleError(_0x1c2ed8,null));};exports[_0xb1c3('0x47')]=function(_0x37eb4b,_0xc6df31){var _0x387c70={'raw':![],'where':{'id':_0x37eb4b[_0xb1c3('0x48')]['id']}},_0x24d0e5={};_0x24d0e5[_0xb1c3('0x2f')]=_[_0xb1c3('0x31')](db[_0xb1c3('0x2b')]['rawAttributes']);_0x24d0e5[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x37eb4b[_0xb1c3('0x32')]);_0x24d0e5[_0xb1c3('0x33')]=_['intersection'](_0x24d0e5['model'],_0x24d0e5['query']);_0x387c70[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x24d0e5['model'],qs[_0xb1c3('0x36')](_0x37eb4b[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x387c70[_0xb1c3('0x35')]=_0x387c70[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x387c70[_0xb1c3('0x35')]:_0x24d0e5[_0xb1c3('0x2f')];if(_0x37eb4b[_0xb1c3('0x32')][_0xb1c3('0x42')]){_0x387c70[_0xb1c3('0x43')]=[{'all':!![]}];}_0x387c70=_[_0xb1c3('0x3f')]({},_0x387c70,_0x37eb4b[_0xb1c3('0x41')]);return db[_0xb1c3('0x2b')][_0xb1c3('0x49')](_0x387c70)[_0xb1c3('0x24')](handleEntityNotFound(_0xc6df31,null))[_0xb1c3('0x24')](respondWithResult(_0xc6df31,null))[_0xb1c3('0x46')](handleError(_0xc6df31,null));};exports[_0xb1c3('0x4a')]=function(_0x2d6085,_0x24f927){return db[_0xb1c3('0x2b')][_0xb1c3('0x4a')](_0x2d6085[_0xb1c3('0x4b')],{})['then'](respondWithResult(_0x24f927,0xc9))['catch'](handleError(_0x24f927,null));};exports[_0xb1c3('0x4c')]=function(_0x55a72c,_0x2a0554){if(_0x55a72c[_0xb1c3('0x4b')]['id']){delete _0x55a72c['body']['id'];}return db[_0xb1c3('0x2b')][_0xb1c3('0x49')]({'where':{'id':_0x55a72c['params']['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x2a0554,null))[_0xb1c3('0x24')](saveUpdates(_0x55a72c[_0xb1c3('0x4b')],null))[_0xb1c3('0x24')](respondWithResult(_0x2a0554,null))[_0xb1c3('0x46')](handleError(_0x2a0554,null));};exports[_0xb1c3('0x25')]=function(_0x3ace7b,_0x1affe5){return db[_0xb1c3('0x2b')][_0xb1c3('0x49')]({'where':{'id':_0x3ace7b[_0xb1c3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1affe5,null))[_0xb1c3('0x24')](removeEntity(_0x1affe5,null))[_0xb1c3('0x46')](handleError(_0x1affe5,null));};exports[_0xb1c3('0x4d')]=function(_0x84e68a,_0x581b04,_0x3e24e3){var _0x13fd72={};var _0x17084f={};var _0x44b461;var _0x146703;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x84e68a[_0xb1c3('0x48')]['id']}})['then'](handleEntityNotFound(_0x581b04,null))['then'](function(_0x8158f9){if(_0x8158f9){_0x44b461=_0x8158f9;_0x17084f[_0xb1c3('0x2f')]=_[_0xb1c3('0x31')](db['SalesforceField'][_0xb1c3('0x4f')]);_0x17084f[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x84e68a[_0xb1c3('0x32')]);_0x17084f[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x17084f[_0xb1c3('0x2f')],_0x17084f[_0xb1c3('0x32')]);_0x13fd72[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x17084f[_0xb1c3('0x2f')],qs[_0xb1c3('0x36')](_0x84e68a['query'][_0xb1c3('0x36')]));_0x13fd72[_0xb1c3('0x35')]=_0x13fd72[_0xb1c3('0x35')][_0xb1c3('0x37')]?_0x13fd72[_0xb1c3('0x35')]:_0x17084f[_0xb1c3('0x2f')];_0x13fd72[_0xb1c3('0x3a')]=qs['sort'](_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3b')]);_0x13fd72['where']=qs['filters'](_[_0xb1c3('0x3d')](_0x84e68a[_0xb1c3('0x32')],_0x17084f['filters']));if(_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x13fd72['where']=_['merge'](_0x13fd72[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x30')](_0x13fd72[_0xb1c3('0x35')],function(_0x561397){var _0x7e37fc={};_0x7e37fc[_0x561397]={'$like':'%'+_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x7e37fc;})});}_0x13fd72=_['merge']({},_0x13fd72,_0x84e68a[_0xb1c3('0x41')]);return _0x44b461[_0xb1c3('0x4d')](_0x13fd72);}})[_0xb1c3('0x24')](function(_0x5c4ae4){if(_0x5c4ae4){_0x146703=_0x5c4ae4[_0xb1c3('0x37')];if(!_0x84e68a['query']['hasOwnProperty'](_0xb1c3('0x39'))){_0x13fd72[_0xb1c3('0x1d')]=qs[_0xb1c3('0x1d')](_0x84e68a['query'][_0xb1c3('0x1d')]);_0x13fd72[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x84e68a[_0xb1c3('0x32')][_0xb1c3('0x1b')]);}return _0x44b461[_0xb1c3('0x4d')](_0x13fd72);}})[_0xb1c3('0x24')](function(_0x3f2f7e){if(_0x3f2f7e){return _0x3f2f7e?{'count':_0x146703,'rows':_0x3f2f7e}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x581b04,null))[_0xb1c3('0x46')](handleError(_0x581b04,null));};exports[_0xb1c3('0x50')]=function(_0x2c0404,_0x3c4b38,_0xb989cf){var _0x1facf2={};var _0x36d86c={};var _0x17a3d2;var _0x22fd6f;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x2c0404['params']['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x3c4b38,null))[_0xb1c3('0x24')](function(_0x59296b){if(_0x59296b){_0x17a3d2=_0x59296b;_0x36d86c['model']=_['keys'](db[_0xb1c3('0x51')][_0xb1c3('0x4f')]);_0x36d86c[_0xb1c3('0x32')]=_[_0xb1c3('0x31')](_0x2c0404['query']);_0x36d86c[_0xb1c3('0x33')]=_[_0xb1c3('0x34')](_0x36d86c['model'],_0x36d86c[_0xb1c3('0x32')]);_0x1facf2[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x36d86c[_0xb1c3('0x2f')],qs[_0xb1c3('0x36')](_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x36')]));_0x1facf2['attributes']=_0x1facf2[_0xb1c3('0x35')]['length']?_0x1facf2[_0xb1c3('0x35')]:_0x36d86c['model'];_0x1facf2['order']=qs[_0xb1c3('0x3b')](_0x2c0404[_0xb1c3('0x32')]['sort']);_0x1facf2[_0xb1c3('0x3c')]=qs[_0xb1c3('0x33')](_[_0xb1c3('0x3d')](_0x2c0404[_0xb1c3('0x32')],_0x36d86c[_0xb1c3('0x33')]));if(_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x1facf2[_0xb1c3('0x3c')]=_[_0xb1c3('0x3f')](_0x1facf2[_0xb1c3('0x3c')],{'$or':_[_0xb1c3('0x30')](_0x1facf2[_0xb1c3('0x35')],function(_0x4a3309){var _0x302015={};_0x302015[_0x4a3309]={'$like':'%'+_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x3e')]+'%'};return _0x302015;})});}_0x1facf2=_[_0xb1c3('0x3f')]({},_0x1facf2,_0x2c0404[_0xb1c3('0x41')]);return _0x17a3d2[_0xb1c3('0x50')](_0x1facf2);}})['then'](function(_0x212830){if(_0x212830){_0x22fd6f=_0x212830[_0xb1c3('0x37')];if(!_0x2c0404['query'][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x1facf2['limit']=qs['limit'](_0x2c0404[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x1facf2[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x2c0404['query']['offset']);}return _0x17a3d2[_0xb1c3('0x50')](_0x1facf2);}})['then'](function(_0x5e22d0){if(_0x5e22d0){return _0x5e22d0?{'count':_0x22fd6f,'rows':_0x5e22d0}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x3c4b38,null))[_0xb1c3('0x46')](handleError(_0x3c4b38,null));};exports[_0xb1c3('0x52')]=function(_0x207079,_0x283963,_0x1fd65f){var _0x8a75ad={};var _0x2c16d3={};var _0x5be9b9;var _0x557083;return db[_0xb1c3('0x2b')][_0xb1c3('0x4e')]({'where':{'id':_0x207079[_0xb1c3('0x48')]['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x283963,null))[_0xb1c3('0x24')](function(_0x3e62fa){if(_0x3e62fa){_0x5be9b9=_0x3e62fa;_0x2c16d3[_0xb1c3('0x2f')]=_['keys'](db['SalesforceField'][_0xb1c3('0x4f')]);_0x2c16d3['query']=_['keys'](_0x207079[_0xb1c3('0x32')]);_0x2c16d3['filters']=_[_0xb1c3('0x34')](_0x2c16d3[_0xb1c3('0x2f')],_0x2c16d3[_0xb1c3('0x32')]);_0x8a75ad[_0xb1c3('0x35')]=_[_0xb1c3('0x34')](_0x2c16d3['model'],qs[_0xb1c3('0x36')](_0x207079['query'][_0xb1c3('0x36')]));_0x8a75ad['attributes']=_0x8a75ad[_0xb1c3('0x35')]['length']?_0x8a75ad[_0xb1c3('0x35')]:_0x2c16d3[_0xb1c3('0x2f')];_0x8a75ad[_0xb1c3('0x3a')]=qs[_0xb1c3('0x3b')](_0x207079[_0xb1c3('0x32')]['sort']);_0x8a75ad[_0xb1c3('0x3c')]=qs[_0xb1c3('0x33')](_['pick'](_0x207079[_0xb1c3('0x32')],_0x2c16d3['filters']));if(_0x207079[_0xb1c3('0x32')][_0xb1c3('0x3e')]){_0x8a75ad[_0xb1c3('0x3c')]=_['merge'](_0x8a75ad['where'],{'$or':_['map'](_0x8a75ad[_0xb1c3('0x35')],function(_0x1327c7){var _0x66f9fc={};_0x66f9fc[_0x1327c7]={'$like':'%'+_0x207079['query'][_0xb1c3('0x3e')]+'%'};return _0x66f9fc;})});}_0x8a75ad=_[_0xb1c3('0x3f')]({},_0x8a75ad,_0x207079['options']);return _0x5be9b9[_0xb1c3('0x52')](_0x8a75ad);}})[_0xb1c3('0x24')](function(_0x28531d){if(_0x28531d){_0x557083=_0x28531d[_0xb1c3('0x37')];if(!_0x207079[_0xb1c3('0x32')][_0xb1c3('0x38')](_0xb1c3('0x39'))){_0x8a75ad['limit']=qs['limit'](_0x207079[_0xb1c3('0x32')][_0xb1c3('0x1d')]);_0x8a75ad[_0xb1c3('0x1b')]=qs[_0xb1c3('0x1b')](_0x207079[_0xb1c3('0x32')]['offset']);}return _0x5be9b9[_0xb1c3('0x52')](_0x8a75ad);}})[_0xb1c3('0x24')](function(_0x329b06){if(_0x329b06){return _0x329b06?{'count':_0x557083,'rows':_0x329b06}:null;}})[_0xb1c3('0x24')](respondWithResult(_0x283963,null))['catch'](handleError(_0x283963,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 22783c2..ca12aa7 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 _0xb93e=['define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0xb55ee7,_0xb17992){var _0x2c6448=function(_0x431757){while(--_0x431757){_0xb55ee7['push'](_0xb55ee7['shift']());}};_0x2c6448(++_0xb17992);}(_0xb93e,0xf4));var _0xeb93=function(_0xcca8d9,_0x1b0659){_0xcca8d9=_0xcca8d9-0x0;var _0x4c7c13=_0xb93e[_0xcca8d9];return _0x4c7c13;};'use strict';var _=require(_0xeb93('0x0'));var util=require(_0xeb93('0x1'));var logger=require(_0xeb93('0x2'))(_0xeb93('0x3'));var moment=require(_0xeb93('0x4'));var BPromise=require(_0xeb93('0x5'));var rp=require(_0xeb93('0x6'));var fs=require('fs');var path=require(_0xeb93('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xeb93('0x8')]=function(_0x5a2685,_0x4f755d){return _0x5a2685[_0xeb93('0x9')](_0xeb93('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f25=['api','moment','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x152f5e,_0x222866){var _0x20c698=function(_0x3edd83){while(--_0x3edd83){_0x152f5e['push'](_0x152f5e['shift']());}};_0x20c698(++_0x222866);}(_0x4f25,0xf4));var _0x54f2=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x4f25[_0x590b63];return _0x3c9380;};'use strict';var _=require(_0x54f2('0x0'));var util=require(_0x54f2('0x1'));var logger=require(_0x54f2('0x2'))(_0x54f2('0x3'));var moment=require(_0x54f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x54f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54f2('0x6'));var config=require(_0x54f2('0x7'));var attributes=require(_0x54f2('0x8'));module[_0x54f2('0x9')]=function(_0x56cdbb,_0x611401){return _0x56cdbb[_0x54f2('0xa')](_0x54f2('0xb'),attributes,{'tableName':_0x54f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 5969c86..f2cc00d 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 _0x20e4=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e242e,_0x38591e){var _0x5c8730=function(_0x4f0f1a){while(--_0x4f0f1a){_0x3e242e['push'](_0x3e242e['shift']());}};_0x5c8730(++_0x38591e);}(_0x20e4,0x187));var _0x420e=function(_0x1f7386,_0x424a37){_0x1f7386=_0x1f7386-0x0;var _0x6c7b5d=_0x20e4[_0x1f7386];return _0x6c7b5d;};'use strict';var _=require('lodash');var util=require(_0x420e('0x0'));var moment=require('moment');var BPromise=require(_0x420e('0x1'));var rs=require(_0x420e('0x2'));var fs=require('fs');var Redis=require(_0x420e('0x3'));var db=require(_0x420e('0x4'))['db'];var utils=require(_0x420e('0x5'));var logger=require(_0x420e('0x6'))(_0x420e('0x7'));var config=require('../../config/environment');var jayson=require(_0x420e('0x8'));var client=jayson[_0x420e('0x9')][_0x420e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15d2b9,_0x35e823,_0x46c488){return new BPromise(function(_0x1f2f76,_0x41e558){return client['request'](_0x15d2b9,_0x46c488)[_0x420e('0xb')](function(_0x4554e6){logger['info'](_0x420e('0xc'),_0x35e823,'request\x20sent');logger[_0x420e('0xd')](_0x420e('0xe'),_0x35e823,_0x420e('0xf'),JSON[_0x420e('0x10')](_0x4554e6));if(_0x4554e6[_0x420e('0x11')]){if(_0x4554e6[_0x420e('0x11')][_0x420e('0x12')]===0x1f4){logger[_0x420e('0x11')](_0x420e('0xc'),_0x35e823,_0x4554e6['error'][_0x420e('0x13')]);return _0x41e558(_0x4554e6[_0x420e('0x11')]['message']);}logger['error'](_0x420e('0xc'),_0x35e823,_0x4554e6[_0x420e('0x11')]['message']);return _0x1f2f76(_0x4554e6['error'][_0x420e('0x13')]);}else{logger['info'](_0x420e('0xc'),_0x35e823,'request\x20sent');_0x1f2f76(_0x4554e6[_0x420e('0x14')][_0x420e('0x13')]);}})[_0x420e('0x15')](function(_0x19b313){logger[_0x420e('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35e823,_0x19b313);_0x41e558(_0x19b313);});});} \ No newline at end of file +var _0xbd44=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x1ae4bd,_0x45bee0){var _0x10d0af=function(_0x118bea){while(--_0x118bea){_0x1ae4bd['push'](_0x1ae4bd['shift']());}};_0x10d0af(++_0x45bee0);}(_0xbd44,0xc5));var _0x4bd4=function(_0x219659,_0x19a27a){_0x219659=_0x219659-0x0;var _0x1f29b6=_0xbd44[_0x219659];return _0x1f29b6;};'use strict';var _=require(_0x4bd4('0x0'));var util=require(_0x4bd4('0x1'));var moment=require('moment');var BPromise=require(_0x4bd4('0x2'));var rs=require(_0x4bd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bd4('0x4'))['db'];var utils=require(_0x4bd4('0x5'));var logger=require(_0x4bd4('0x6'))('rpc');var config=require(_0x4bd4('0x7'));var jayson=require(_0x4bd4('0x8'));var client=jayson[_0x4bd4('0x9')][_0x4bd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x567f2d,_0x3ddafa,_0x191568){return new BPromise(function(_0x4be1f3,_0x33a1b0){return client[_0x4bd4('0xb')](_0x567f2d,_0x191568)[_0x4bd4('0xc')](function(_0x60e7e2){logger[_0x4bd4('0xd')](_0x4bd4('0xe'),_0x3ddafa,_0x4bd4('0xf'));logger[_0x4bd4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3ddafa,_0x4bd4('0xf'),JSON[_0x4bd4('0x11')](_0x60e7e2));if(_0x60e7e2['error']){if(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x13')]===0x1f4){logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x60e7e2[_0x4bd4('0x12')]['message']);return _0x33a1b0(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x14')]);}logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x60e7e2['error']['message']);return _0x4be1f3(_0x60e7e2[_0x4bd4('0x12')][_0x4bd4('0x14')]);}else{logger[_0x4bd4('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ddafa,_0x4bd4('0xf'));_0x4be1f3(_0x60e7e2['result'][_0x4bd4('0x14')]);}})[_0x4bd4('0x15')](function(_0x1d5b82){logger[_0x4bd4('0x12')](_0x4bd4('0xe'),_0x3ddafa,_0x1d5b82);_0x33a1b0(_0x1d5b82);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b422ad3..0e2bd3b 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 _0xab9f=['../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3e6b57,_0x4ecbad){var _0x3dc355=function(_0x5d179e){while(--_0x5d179e){_0x3e6b57['push'](_0x3e6b57['shift']());}};_0x3dc355(++_0x4ecbad);}(_0xab9f,0xe1));var _0xfab9=function(_0x3873bf,_0x1c0241){_0x3873bf=_0x3873bf-0x0;var _0x9e86c9=_0xab9f[_0x3873bf];return _0x9e86c9;};'use strict';var multer=require(_0xfab9('0x0'));var util=require(_0xfab9('0x1'));var path=require(_0xfab9('0x2'));var timeout=require(_0xfab9('0x3'));var express=require(_0xfab9('0x4'));var router=express['Router']();var fs_extra=require(_0xfab9('0x5'));var auth=require(_0xfab9('0x6'));var interaction=require(_0xfab9('0x7'));var config=require('../../config/environment');var controller=require(_0xfab9('0x8'));router[_0xfab9('0x9')]('/',auth[_0xfab9('0xa')](),controller[_0xfab9('0xb')]);router[_0xfab9('0x9')](_0xfab9('0xc'),auth[_0xfab9('0xa')](),controller[_0xfab9('0xd')]);router[_0xfab9('0xe')]('/',auth['isAuthenticated'](),controller[_0xfab9('0xf')]);router[_0xfab9('0x10')]('/:id',auth[_0xfab9('0xa')](),controller[_0xfab9('0x11')]);router[_0xfab9('0x12')]('/:id',auth[_0xfab9('0xa')](),controller[_0xfab9('0x13')]);module[_0xfab9('0x14')]=router; \ No newline at end of file +var _0x5a8c=['put','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5a8c,0x167));var _0xc5a8=function(_0x3b3e54,_0x27f854){_0x3b3e54=_0x3b3e54-0x0;var _0x4f86e1=_0x5a8c[_0x3b3e54];return _0x4f86e1;};'use strict';var multer=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var path=require(_0xc5a8('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5a8('0x3'));var router=express[_0xc5a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5a8('0x5'));var interaction=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var controller=require('./intSalesforceField.controller');router[_0xc5a8('0x8')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xa')]);router[_0xc5a8('0x8')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xc')]);router[_0xc5a8('0xd')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xe')]);router[_0xc5a8('0xf')](_0xc5a8('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0x10')]);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 83aa394..5d0cbf1 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 _0x7cc6=['ENUM','variable','sequelize','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0xf52fd8,_0x48824e){var _0x57dcb1=function(_0x1879ca){while(--_0x1879ca){_0xf52fd8['push'](_0xf52fd8['shift']());}};_0x57dcb1(++_0x48824e);}(_0x7cc6,0x1bb));var _0x67cc=function(_0x1c07bd,_0x280360){_0x1c07bd=_0x1c07bd-0x0;var _0x4e8ef1=_0x7cc6[_0x1c07bd];return _0x4e8ef1;};'use strict';var Sequelize=require(_0x67cc('0x0'));module[_0x67cc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x67cc('0x2'),'variable',_0x67cc('0x3'),_0x67cc('0x4'),_0x67cc('0x5')),'defaultValue':_0x67cc('0x2')},'content':{'type':Sequelize[_0x67cc('0x6')]},'key':{'type':Sequelize[_0x67cc('0x6')]},'keyType':{'type':Sequelize[_0x67cc('0x7')](_0x67cc('0x2'),_0x67cc('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x67cc('0x6')]},'idField':{'type':Sequelize[_0x67cc('0x6')]},'variableName':{'type':Sequelize[_0x67cc('0x6')]}}; \ No newline at end of file +var _0xbbb6=['exports','ENUM','string','variable','keyValue','picklist','STRING','sequelize'];(function(_0x584f68,_0x348cd5){var _0x2e7908=function(_0x3570f1){while(--_0x3570f1){_0x584f68['push'](_0x584f68['shift']());}};_0x2e7908(++_0x348cd5);}(_0xbbb6,0xd7));var _0x6bbb=function(_0x1f8a5e,_0x1ada04){_0x1f8a5e=_0x1f8a5e-0x0;var _0x20854b=_0xbbb6[_0x1f8a5e];return _0x20854b;};'use strict';var Sequelize=require(_0x6bbb('0x0'));module[_0x6bbb('0x1')]={'type':{'type':Sequelize[_0x6bbb('0x2')](_0x6bbb('0x3'),_0x6bbb('0x4'),'customVariable',_0x6bbb('0x5'),_0x6bbb('0x6')),'defaultValue':_0x6bbb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6bbb('0x7')]},'keyType':{'type':Sequelize[_0x6bbb('0x2')](_0x6bbb('0x3'),_0x6bbb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6bbb('0x7')]},'idField':{'type':Sequelize[_0x6bbb('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fb20d99..dcfa557 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 _0xd36d=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','rawAttributes','length','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceField','fieldName','model','query','keys','filters'];(function(_0x57b301,_0x5ddf19){var _0x2564bb=function(_0x5865ad){while(--_0x5865ad){_0x57b301['push'](_0x57b301['shift']());}};_0x2564bb(++_0x5ddf19);}(_0xd36d,0x1c2));var _0xdd36=function(_0x520da8,_0x5f0951){_0x520da8=_0x520da8-0x0;var _0x2e4964=_0xd36d[_0x520da8];return _0x2e4964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd36('0x0'));var zipdir=require(_0xdd36('0x1'));var jsonpatch=require(_0xdd36('0x2'));var rp=require('request-promise');var moment=require(_0xdd36('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd36('0x4'));var util=require(_0xdd36('0x5'));var path=require(_0xdd36('0x6'));var sox=require(_0xdd36('0x7'));var csv=require(_0xdd36('0x8'));var ejs=require(_0xdd36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd36('0xa'));var squel=require(_0xdd36('0xb'));var crypto=require(_0xdd36('0xc'));var jsforce=require(_0xdd36('0xd'));var deskjs=require(_0xdd36('0xe'));var toCsv=require(_0xdd36('0x8'));var querystring=require(_0xdd36('0xf'));var Papa=require(_0xdd36('0x10'));var Redis=require(_0xdd36('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd36('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdd36('0x13'));var licenseUtil=require(_0xdd36('0x14'));var db=require(_0xdd36('0x15'))['db'];function respondWithStatusCode(_0x36ce82,_0x51c71c){_0x51c71c=_0x51c71c||0xcc;return function(_0x2ee795){if(_0x2ee795){return _0x36ce82[_0xdd36('0x16')](_0x51c71c);}return _0x36ce82['status'](_0x51c71c)[_0xdd36('0x17')]();};}function respondWithResult(_0xd0e1ea,_0x28104d){_0x28104d=_0x28104d||0xc8;return function(_0x1e3c43){if(_0x1e3c43){return _0xd0e1ea[_0xdd36('0x18')](_0x28104d)['json'](_0x1e3c43);}};}function respondWithFilteredResult(_0x3c229d,_0x371ba6){return function(_0x4f02e8){if(_0x4f02e8){var _0x2001a5=typeof _0x371ba6[_0xdd36('0x19')]===_0xdd36('0x1a')&&typeof _0x371ba6['limit']==='undefined';var _0x5f340c=_0x4f02e8[_0xdd36('0x1b')];var _0x39f892=_0x2001a5?0x0:_0x371ba6['offset'];var _0x3334ca=_0x2001a5?_0x4f02e8['count']:_0x371ba6[_0xdd36('0x19')]+_0x371ba6['limit'];var _0x2d2782;if(_0x3334ca>=_0x5f340c){_0x3334ca=_0x5f340c;_0x2d2782=0xc8;}else{_0x2d2782=0xce;}_0x3c229d[_0xdd36('0x18')](_0x2d2782);return _0x3c229d[_0xdd36('0x1c')](_0xdd36('0x1d'),_0x39f892+'-'+_0x3334ca+'/'+_0x5f340c)[_0xdd36('0x1e')](_0x4f02e8);}return null;};}function patchUpdates(_0x5770ce){return function(_0x391f84){try{jsonpatch['apply'](_0x391f84,_0x5770ce,!![]);}catch(_0x501bc4){return BPromise[_0xdd36('0x1f')](_0x501bc4);}return _0x391f84[_0xdd36('0x20')]();};}function saveUpdates(_0x4a01cf,_0x437f89){return function(_0x1263a1){if(_0x1263a1){return _0x1263a1['update'](_0x4a01cf)[_0xdd36('0x21')](function(_0x385c54){return _0x385c54;});}return null;};}function removeEntity(_0x468164,_0xae4857){return function(_0x1827ef){if(_0x1827ef){return _0x1827ef[_0xdd36('0x22')]()['then'](function(){_0x468164['status'](0xcc)[_0xdd36('0x17')]();});}};}function handleEntityNotFound(_0x1f5403,_0x2e02c1){return function(_0x58e26b){if(!_0x58e26b){_0x1f5403[_0xdd36('0x16')](0x194);}return _0x58e26b;};}function handleError(_0x17fd25,_0x7bed07){_0x7bed07=_0x7bed07||0x1f4;return function(_0x3dd42e){logger[_0xdd36('0x23')](_0x3dd42e[_0xdd36('0x24')]);if(_0x3dd42e[_0xdd36('0x25')]){delete _0x3dd42e['name'];}_0x17fd25[_0xdd36('0x18')](_0x7bed07)[_0xdd36('0x26')](_0x3dd42e);};}exports[_0xdd36('0x27')]=function(_0x18dac5,_0x4128ec){var _0x3242cf={},_0x145e46={},_0x3ddc20={'count':0x0,'rows':[]};var _0x505bf8=_[_0xdd36('0x28')](db[_0xdd36('0x29')]['rawAttributes'],function(_0x3057e4){return{'name':_0x3057e4[_0xdd36('0x2a')],'type':_0x3057e4['type']['key']};});_0x145e46[_0xdd36('0x2b')]=_[_0xdd36('0x28')](_0x505bf8,_0xdd36('0x25'));_0x145e46[_0xdd36('0x2c')]=_[_0xdd36('0x2d')](_0x18dac5[_0xdd36('0x2c')]);_0x145e46[_0xdd36('0x2e')]=_[_0xdd36('0x2f')](_0x145e46[_0xdd36('0x2b')],_0x145e46[_0xdd36('0x2c')]);_0x3242cf[_0xdd36('0x30')]=_['intersection'](_0x145e46[_0xdd36('0x2b')],qs[_0xdd36('0x31')](_0x18dac5[_0xdd36('0x2c')][_0xdd36('0x31')]));_0x3242cf[_0xdd36('0x30')]=_0x3242cf[_0xdd36('0x30')]['length']?_0x3242cf['attributes']:_0x145e46[_0xdd36('0x2b')];if(!_0x18dac5['query'][_0xdd36('0x32')](_0xdd36('0x33'))){_0x3242cf['limit']=qs['limit'](_0x18dac5[_0xdd36('0x2c')]['limit']);_0x3242cf[_0xdd36('0x19')]=qs[_0xdd36('0x19')](_0x18dac5[_0xdd36('0x2c')][_0xdd36('0x19')]);}_0x3242cf[_0xdd36('0x34')]=qs[_0xdd36('0x35')](_0x18dac5['query'][_0xdd36('0x35')]);_0x3242cf['where']=qs[_0xdd36('0x2e')](_[_0xdd36('0x36')](_0x18dac5['query'],_0x145e46[_0xdd36('0x2e')]),_0x505bf8);if(_0x18dac5[_0xdd36('0x2c')][_0xdd36('0x37')]){_0x3242cf[_0xdd36('0x38')]=_[_0xdd36('0x39')](_0x3242cf[_0xdd36('0x38')],{'$or':_[_0xdd36('0x28')](_0x505bf8,function(_0x26bf8c){if(_0x26bf8c[_0xdd36('0x3a')]!=='VIRTUAL'){var _0x40a655={};_0x40a655[_0x26bf8c[_0xdd36('0x25')]]={'$like':'%'+_0x18dac5[_0xdd36('0x2c')][_0xdd36('0x37')]+'%'};return _0x40a655;}})});}_0x3242cf=_[_0xdd36('0x39')]({},_0x3242cf,_0x18dac5[_0xdd36('0x3b')]);var _0x4714f4={'where':_0x3242cf[_0xdd36('0x38')]};return db[_0xdd36('0x29')][_0xdd36('0x1b')](_0x4714f4)[_0xdd36('0x21')](function(_0x3f9b28){_0x3ddc20[_0xdd36('0x1b')]=_0x3f9b28;if(_0x18dac5[_0xdd36('0x2c')][_0xdd36('0x3c')]){_0x3242cf[_0xdd36('0x3d')]=[{'all':!![]}];}return db[_0xdd36('0x29')][_0xdd36('0x3e')](_0x3242cf);})[_0xdd36('0x21')](function(_0x5bb2c3){_0x3ddc20['rows']=_0x5bb2c3;return _0x3ddc20;})[_0xdd36('0x21')](respondWithFilteredResult(_0x4128ec,_0x3242cf))[_0xdd36('0x3f')](handleError(_0x4128ec,null));};exports['show']=function(_0xd7adc5,_0x1a913c){var _0x1fa1fe={'raw':!![],'where':{'id':_0xd7adc5['params']['id']}},_0x5371cc={};_0x5371cc['model']=_[_0xdd36('0x2d')](db[_0xdd36('0x29')][_0xdd36('0x40')]);_0x5371cc[_0xdd36('0x2c')]=_[_0xdd36('0x2d')](_0xd7adc5[_0xdd36('0x2c')]);_0x5371cc[_0xdd36('0x2e')]=_[_0xdd36('0x2f')](_0x5371cc[_0xdd36('0x2b')],_0x5371cc[_0xdd36('0x2c')]);_0x1fa1fe[_0xdd36('0x30')]=_[_0xdd36('0x2f')](_0x5371cc['model'],qs[_0xdd36('0x31')](_0xd7adc5[_0xdd36('0x2c')][_0xdd36('0x31')]));_0x1fa1fe[_0xdd36('0x30')]=_0x1fa1fe[_0xdd36('0x30')][_0xdd36('0x41')]?_0x1fa1fe[_0xdd36('0x30')]:_0x5371cc[_0xdd36('0x2b')];if(_0xd7adc5[_0xdd36('0x2c')][_0xdd36('0x3c')]){_0x1fa1fe['include']=[{'all':!![]}];}_0x1fa1fe=_[_0xdd36('0x39')]({},_0x1fa1fe,_0xd7adc5[_0xdd36('0x3b')]);return db[_0xdd36('0x29')][_0xdd36('0x42')](_0x1fa1fe)[_0xdd36('0x21')](handleEntityNotFound(_0x1a913c,null))[_0xdd36('0x21')](respondWithResult(_0x1a913c,null))[_0xdd36('0x3f')](handleError(_0x1a913c,null));};exports[_0xdd36('0x43')]=function(_0x5ae9d5,_0x4427cf){return db[_0xdd36('0x29')][_0xdd36('0x43')](_0x5ae9d5[_0xdd36('0x44')],{})[_0xdd36('0x21')](respondWithResult(_0x4427cf,0xc9))['catch'](handleError(_0x4427cf,null));};exports[_0xdd36('0x45')]=function(_0x1b3744,_0x468b3c){if(_0x1b3744['body']['id']){delete _0x1b3744[_0xdd36('0x44')]['id'];}return db[_0xdd36('0x29')]['find']({'where':{'id':_0x1b3744[_0xdd36('0x46')]['id']}})[_0xdd36('0x21')](handleEntityNotFound(_0x468b3c,null))[_0xdd36('0x21')](saveUpdates(_0x1b3744[_0xdd36('0x44')],null))[_0xdd36('0x21')](respondWithResult(_0x468b3c,null))[_0xdd36('0x3f')](handleError(_0x468b3c,null));};exports[_0xdd36('0x22')]=function(_0x39a66b,_0x1aa9eb){return db[_0xdd36('0x29')][_0xdd36('0x42')]({'where':{'id':_0x39a66b['params']['id']}})[_0xdd36('0x21')](handleEntityNotFound(_0x1aa9eb,null))[_0xdd36('0x21')](removeEntity(_0x1aa9eb,null))[_0xdd36('0x3f')](handleError(_0x1aa9eb,null));}; \ No newline at end of file +var _0xe754=['pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','findAll','show','params','find','catch','create','body','update','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x5857af,_0x445e08){var _0xe18293=function(_0x15181c){while(--_0x15181c){_0x5857af['push'](_0x5857af['shift']());}};_0xe18293(++_0x445e08);}(_0xe754,0x1c0));var _0x4e75=function(_0x25c591,_0x223a4f){_0x25c591=_0x25c591-0x0;var _0x4ea225=_0xe754[_0x25c591];return _0x4ea225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e75('0x0'));var zipdir=require(_0x4e75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e75('0x2'));var moment=require(_0x4e75('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e75('0x4'));var path=require(_0x4e75('0x5'));var sox=require('sox');var csv=require(_0x4e75('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e75('0x7'));var _=require(_0x4e75('0x8'));var squel=require(_0x4e75('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e75('0xa'));var deskjs=require(_0x4e75('0xb'));var toCsv=require(_0x4e75('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e75('0xc'));var authService=require(_0x4e75('0xd'));var qs=require(_0x4e75('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e75('0xf'));var logger=require(_0x4e75('0x10'))(_0x4e75('0x11'));var utils=require(_0x4e75('0x12'));var config=require(_0x4e75('0x13'));var licenseUtil=require(_0x4e75('0x14'));var db=require(_0x4e75('0x15'))['db'];function respondWithStatusCode(_0x96cace,_0x2d6da0){_0x2d6da0=_0x2d6da0||0xcc;return function(_0x2e7f9f){if(_0x2e7f9f){return _0x96cace['sendStatus'](_0x2d6da0);}return _0x96cace[_0x4e75('0x16')](_0x2d6da0)[_0x4e75('0x17')]();};}function respondWithResult(_0x5a9c22,_0x47583d){_0x47583d=_0x47583d||0xc8;return function(_0x16e455){if(_0x16e455){return _0x5a9c22[_0x4e75('0x16')](_0x47583d)['json'](_0x16e455);}};}function respondWithFilteredResult(_0x54e553,_0x1e23bd){return function(_0xcff3fc){if(_0xcff3fc){var _0x478f36=typeof _0x1e23bd['offset']===_0x4e75('0x18')&&typeof _0x1e23bd[_0x4e75('0x19')]===_0x4e75('0x18');var _0xbb1ada=_0xcff3fc[_0x4e75('0x1a')];var _0x32d2d9=_0x478f36?0x0:_0x1e23bd[_0x4e75('0x1b')];var _0x23b500=_0x478f36?_0xcff3fc[_0x4e75('0x1a')]:_0x1e23bd[_0x4e75('0x1b')]+_0x1e23bd['limit'];var _0x3b68cc;if(_0x23b500>=_0xbb1ada){_0x23b500=_0xbb1ada;_0x3b68cc=0xc8;}else{_0x3b68cc=0xce;}_0x54e553[_0x4e75('0x16')](_0x3b68cc);return _0x54e553['set'](_0x4e75('0x1c'),_0x32d2d9+'-'+_0x23b500+'/'+_0xbb1ada)[_0x4e75('0x1d')](_0xcff3fc);}return null;};}function patchUpdates(_0x6b6fe6){return function(_0x269a5d){try{jsonpatch['apply'](_0x269a5d,_0x6b6fe6,!![]);}catch(_0x30993c){return BPromise[_0x4e75('0x1e')](_0x30993c);}return _0x269a5d[_0x4e75('0x1f')]();};}function saveUpdates(_0x4d4e28,_0x2f1a3a){return function(_0x184c5b){if(_0x184c5b){return _0x184c5b['update'](_0x4d4e28)[_0x4e75('0x20')](function(_0x41b85c){return _0x41b85c;});}return null;};}function removeEntity(_0x224589,_0x10fd7b){return function(_0x1e05df){if(_0x1e05df){return _0x1e05df[_0x4e75('0x21')]()[_0x4e75('0x20')](function(){_0x224589[_0x4e75('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16817c,_0x31403e){return function(_0x2348d9){if(!_0x2348d9){_0x16817c[_0x4e75('0x22')](0x194);}return _0x2348d9;};}function handleError(_0x4a00dc,_0x4df074){_0x4df074=_0x4df074||0x1f4;return function(_0x55c66a){logger['error'](_0x55c66a[_0x4e75('0x23')]);if(_0x55c66a[_0x4e75('0x24')]){delete _0x55c66a[_0x4e75('0x24')];}_0x4a00dc[_0x4e75('0x16')](_0x4df074)[_0x4e75('0x25')](_0x55c66a);};}exports[_0x4e75('0x26')]=function(_0x566b63,_0x1a2410){var _0x139891={},_0x25fb5b={},_0x4bea09={'count':0x0,'rows':[]};var _0x927b60=_['map'](db['SalesforceField'][_0x4e75('0x27')],function(_0x5657b0){return{'name':_0x5657b0[_0x4e75('0x28')],'type':_0x5657b0[_0x4e75('0x29')][_0x4e75('0x2a')]};});_0x25fb5b[_0x4e75('0x2b')]=_[_0x4e75('0x2c')](_0x927b60,_0x4e75('0x24'));_0x25fb5b[_0x4e75('0x2d')]=_[_0x4e75('0x2e')](_0x566b63['query']);_0x25fb5b[_0x4e75('0x2f')]=_[_0x4e75('0x30')](_0x25fb5b['model'],_0x25fb5b[_0x4e75('0x2d')]);_0x139891[_0x4e75('0x31')]=_[_0x4e75('0x30')](_0x25fb5b[_0x4e75('0x2b')],qs[_0x4e75('0x32')](_0x566b63[_0x4e75('0x2d')]['fields']));_0x139891[_0x4e75('0x31')]=_0x139891[_0x4e75('0x31')][_0x4e75('0x33')]?_0x139891[_0x4e75('0x31')]:_0x25fb5b[_0x4e75('0x2b')];if(!_0x566b63['query']['hasOwnProperty'](_0x4e75('0x34'))){_0x139891['limit']=qs[_0x4e75('0x19')](_0x566b63['query'][_0x4e75('0x19')]);_0x139891[_0x4e75('0x1b')]=qs[_0x4e75('0x1b')](_0x566b63[_0x4e75('0x2d')][_0x4e75('0x1b')]);}_0x139891[_0x4e75('0x35')]=qs['sort'](_0x566b63['query'][_0x4e75('0x36')]);_0x139891[_0x4e75('0x37')]=qs[_0x4e75('0x2f')](_[_0x4e75('0x38')](_0x566b63[_0x4e75('0x2d')],_0x25fb5b[_0x4e75('0x2f')]),_0x927b60);if(_0x566b63['query'][_0x4e75('0x39')]){_0x139891[_0x4e75('0x37')]=_[_0x4e75('0x3a')](_0x139891[_0x4e75('0x37')],{'$or':_[_0x4e75('0x2c')](_0x927b60,function(_0x203d0e){if(_0x203d0e[_0x4e75('0x29')]!==_0x4e75('0x3b')){var _0x7ef218={};_0x7ef218[_0x203d0e[_0x4e75('0x24')]]={'$like':'%'+_0x566b63[_0x4e75('0x2d')]['filter']+'%'};return _0x7ef218;}})});}_0x139891=_[_0x4e75('0x3a')]({},_0x139891,_0x566b63[_0x4e75('0x3c')]);var _0x9afd3a={'where':_0x139891[_0x4e75('0x37')]};return db[_0x4e75('0x3d')]['count'](_0x9afd3a)['then'](function(_0x4a600c){_0x4bea09['count']=_0x4a600c;if(_0x566b63[_0x4e75('0x2d')][_0x4e75('0x3e')]){_0x139891[_0x4e75('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x4e75('0x40')](_0x139891);})[_0x4e75('0x20')](function(_0x55bdc3){_0x4bea09['rows']=_0x55bdc3;return _0x4bea09;})[_0x4e75('0x20')](respondWithFilteredResult(_0x1a2410,_0x139891))['catch'](handleError(_0x1a2410,null));};exports[_0x4e75('0x41')]=function(_0x4cee8f,_0x3cfd62){var _0x5176d8={'raw':!![],'where':{'id':_0x4cee8f[_0x4e75('0x42')]['id']}},_0x13213b={};_0x13213b[_0x4e75('0x2b')]=_[_0x4e75('0x2e')](db[_0x4e75('0x3d')]['rawAttributes']);_0x13213b[_0x4e75('0x2d')]=_[_0x4e75('0x2e')](_0x4cee8f[_0x4e75('0x2d')]);_0x13213b['filters']=_[_0x4e75('0x30')](_0x13213b['model'],_0x13213b[_0x4e75('0x2d')]);_0x5176d8['attributes']=_['intersection'](_0x13213b[_0x4e75('0x2b')],qs[_0x4e75('0x32')](_0x4cee8f[_0x4e75('0x2d')][_0x4e75('0x32')]));_0x5176d8['attributes']=_0x5176d8[_0x4e75('0x31')][_0x4e75('0x33')]?_0x5176d8[_0x4e75('0x31')]:_0x13213b[_0x4e75('0x2b')];if(_0x4cee8f['query'][_0x4e75('0x3e')]){_0x5176d8['include']=[{'all':!![]}];}_0x5176d8=_[_0x4e75('0x3a')]({},_0x5176d8,_0x4cee8f[_0x4e75('0x3c')]);return db['SalesforceField'][_0x4e75('0x43')](_0x5176d8)[_0x4e75('0x20')](handleEntityNotFound(_0x3cfd62,null))['then'](respondWithResult(_0x3cfd62,null))[_0x4e75('0x44')](handleError(_0x3cfd62,null));};exports[_0x4e75('0x45')]=function(_0x222e11,_0x229067){return db[_0x4e75('0x3d')][_0x4e75('0x45')](_0x222e11[_0x4e75('0x46')],{})[_0x4e75('0x20')](respondWithResult(_0x229067,0xc9))['catch'](handleError(_0x229067,null));};exports[_0x4e75('0x47')]=function(_0x1cef86,_0x4f6d9c){if(_0x1cef86[_0x4e75('0x46')]['id']){delete _0x1cef86['body']['id'];}return db['SalesforceField'][_0x4e75('0x43')]({'where':{'id':_0x1cef86['params']['id']}})[_0x4e75('0x20')](handleEntityNotFound(_0x4f6d9c,null))[_0x4e75('0x20')](saveUpdates(_0x1cef86['body'],null))[_0x4e75('0x20')](respondWithResult(_0x4f6d9c,null))[_0x4e75('0x44')](handleError(_0x4f6d9c,null));};exports['destroy']=function(_0x4b5c50,_0x1f5e71){return db['SalesforceField']['find']({'where':{'id':_0x4b5c50[_0x4e75('0x42')]['id']}})[_0x4e75('0x20')](handleEntityNotFound(_0x1f5e71,null))[_0x4e75('0x20')](removeEntity(_0x1f5e71,null))[_0x4e75('0x44')](handleError(_0x1f5e71,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6be1ff5..0638f18 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 _0x005f=['salesforce_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x4b980d,_0x32fc6a){var _0x5c7974=function(_0x3b7af4){while(--_0x3b7af4){_0x4b980d['push'](_0x4b980d['shift']());}};_0x5c7974(++_0x32fc6a);}(_0x005f,0x10c));var _0xf005=function(_0x43172b,_0x1fa1f0){_0x43172b=_0x43172b-0x0;var _0x1f0ac6=_0x005f[_0x43172b];return _0x1f0ac6;};'use strict';var _=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var logger=require(_0xf005('0x2'))('api');var moment=require(_0xf005('0x3'));var BPromise=require(_0xf005('0x4'));var rp=require(_0xf005('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf005('0x6'));var attributes=require(_0xf005('0x7'));module[_0xf005('0x8')]=function(_0x4e0c0e,_0x75cceb){return _0x4e0c0e[_0xf005('0x9')](_0xf005('0xa'),attributes,{'tableName':_0xf005('0xb'),'paranoid':![],'indexes':[{'name':_0xf005('0xc'),'fields':[_0xf005('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3231=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x3231,0x103));var _0x1323=function(_0x3d39ea,_0x4ce74c){_0x3d39ea=_0x3d39ea-0x0;var _0x5832ea=_0x3231[_0x3d39ea];return _0x5832ea;};'use strict';var _=require(_0x1323('0x0'));var util=require(_0x1323('0x1'));var logger=require('../../config/logger')(_0x1323('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1323('0x3'));var fs=require('fs');var path=require(_0x1323('0x4'));var rimraf=require(_0x1323('0x5'));var config=require(_0x1323('0x6'));var attributes=require(_0x1323('0x7'));module[_0x1323('0x8')]=function(_0x5b15d0,_0x3eff29){return _0x5b15d0[_0x1323('0x9')]('SalesforceField',attributes,{'tableName':_0x1323('0xa'),'paranoid':![],'indexes':[{'name':_0x1323('0xb'),'fields':[_0x1323('0xc'),_0x1323('0xd')],'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 961b5f4..c0c96c8 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 _0x14bb=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x3cd128,_0x4c36f5){var _0x1c3e99=function(_0x2b009f){while(--_0x2b009f){_0x3cd128['push'](_0x3cd128['shift']());}};_0x1c3e99(++_0x4c36f5);}(_0x14bb,0x18d));var _0xb14b=function(_0xff797,_0x4117f4){_0xff797=_0xff797-0x0;var _0x230353=_0x14bb[_0xff797];return _0x230353;};'use strict';var _=require('lodash');var util=require(_0xb14b('0x0'));var moment=require(_0xb14b('0x1'));var BPromise=require(_0xb14b('0x2'));var rs=require(_0xb14b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb14b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb14b('0x5'));var config=require(_0xb14b('0x6'));var jayson=require(_0xb14b('0x7'));var client=jayson[_0xb14b('0x8')][_0xb14b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x579abc,_0x20bc8b,_0x56b5c4){return new BPromise(function(_0x4cafe7,_0x4d4cb8){return client['request'](_0x579abc,_0x56b5c4)[_0xb14b('0xa')](function(_0x583c4d){logger[_0xb14b('0xb')](_0xb14b('0xc'),_0x20bc8b,_0xb14b('0xd'));logger[_0xb14b('0xe')](_0xb14b('0xf'),_0x20bc8b,_0xb14b('0xd'),JSON[_0xb14b('0x10')](_0x583c4d));if(_0x583c4d[_0xb14b('0x11')]){if(_0x583c4d[_0xb14b('0x11')][_0xb14b('0x12')]===0x1f4){logger[_0xb14b('0x11')](_0xb14b('0xc'),_0x20bc8b,_0x583c4d[_0xb14b('0x11')]['message']);return _0x4d4cb8(_0x583c4d[_0xb14b('0x11')][_0xb14b('0x13')]);}logger[_0xb14b('0x11')]('SalesforceField,\x20%s,\x20%s',_0x20bc8b,_0x583c4d[_0xb14b('0x11')][_0xb14b('0x13')]);return _0x4cafe7(_0x583c4d[_0xb14b('0x11')]['message']);}else{logger[_0xb14b('0xb')]('SalesforceField,\x20%s,\x20%s',_0x20bc8b,_0xb14b('0xd'));_0x4cafe7(_0x583c4d[_0xb14b('0x14')][_0xb14b('0x13')]);}})['catch'](function(_0x4103bd){logger[_0xb14b('0x11')](_0xb14b('0xc'),_0x20bc8b,_0x4103bd);_0x4d4cb8(_0x4103bd);});});} \ No newline at end of file +var _0xeb28=['stringify','error','code','message','info','result','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5d9cbf,_0x375663){var _0x3834da=function(_0x12cdce){while(--_0x12cdce){_0x5d9cbf['push'](_0x5d9cbf['shift']());}};_0x3834da(++_0x375663);}(_0xeb28,0x10a));var _0x8eb2=function(_0x58ffb0,_0x49b380){_0x58ffb0=_0x58ffb0-0x0;var _0x3f6dae=_0xeb28[_0x58ffb0];return _0x3f6dae;};'use strict';var _=require(_0x8eb2('0x0'));var util=require(_0x8eb2('0x1'));var moment=require(_0x8eb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8eb2('0x3'));var logger=require(_0x8eb2('0x4'))(_0x8eb2('0x5'));var config=require('../../config/environment');var jayson=require(_0x8eb2('0x6'));var client=jayson[_0x8eb2('0x7')][_0x8eb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x255d40,_0x3ec62a,_0x423ab8){return new BPromise(function(_0x5a4aaf,_0x206d91){return client[_0x8eb2('0x9')](_0x255d40,_0x423ab8)[_0x8eb2('0xa')](function(_0x187d44){logger['info'](_0x8eb2('0xb'),_0x3ec62a,_0x8eb2('0xc'));logger['debug'](_0x8eb2('0xd'),_0x3ec62a,'request\x20sent',JSON[_0x8eb2('0xe')](_0x187d44));if(_0x187d44[_0x8eb2('0xf')]){if(_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x10')]===0x1f4){logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x206d91(_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);}logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x187d44[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x5a4aaf(_0x187d44['error'][_0x8eb2('0x11')]);}else{logger[_0x8eb2('0x12')](_0x8eb2('0xb'),_0x3ec62a,'request\x20sent');_0x5a4aaf(_0x187d44[_0x8eb2('0x13')]['message']);}})['catch'](function(_0x5821c8){logger[_0x8eb2('0xf')](_0x8eb2('0xb'),_0x3ec62a,_0x5821c8);_0x206d91(_0x5821c8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3816f22..b8f49f4 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 _0x13dd=['update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put'];(function(_0x4b2387,_0x545980){var _0x2e76af=function(_0x46e409){while(--_0x46e409){_0x4b2387['push'](_0x4b2387['shift']());}};_0x2e76af(++_0x545980);}(_0x13dd,0x1a1));var _0xd13d=function(_0x49aafd,_0x1ab4b0){_0x49aafd=_0x49aafd-0x0;var _0x4af80e=_0x13dd[_0x49aafd];return _0x4af80e;};'use strict';var multer=require(_0xd13d('0x0'));var util=require(_0xd13d('0x1'));var path=require(_0xd13d('0x2'));var timeout=require(_0xd13d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd13d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd13d('0x5'));var config=require(_0xd13d('0x6'));var controller=require(_0xd13d('0x7'));router[_0xd13d('0x8')]('/',auth['isAuthenticated'](),controller[_0xd13d('0x9')]);router[_0xd13d('0x8')](_0xd13d('0xa'),auth[_0xd13d('0xb')](),controller[_0xd13d('0xc')]);router[_0xd13d('0x8')](_0xd13d('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xd13d('0xe'),auth[_0xd13d('0xb')](),controller[_0xd13d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd13d('0x10')]);router[_0xd13d('0x11')](_0xd13d('0xd'),auth[_0xd13d('0xb')](),controller[_0xd13d('0x12')]);router[_0xd13d('0x13')](_0xd13d('0xa'),auth[_0xd13d('0xb')](),controller[_0xd13d('0x14')]);router[_0xd13d('0x15')](_0xd13d('0xa'),auth[_0xd13d('0xb')](),controller['destroy']);module[_0xd13d('0x16')]=router; \ No newline at end of file +var _0xd8b4=['index','/:id','isAuthenticated','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x3d568f,_0x56a0c7){var _0x466d25=function(_0xa20a18){while(--_0xa20a18){_0x3d568f['push'](_0x3d568f['shift']());}};_0x466d25(++_0x56a0c7);}(_0xd8b4,0xff));var _0x4d8b=function(_0x4b10a1,_0x5dba53){_0x4b10a1=_0x4b10a1-0x0;var _0x25f2c5=_0xd8b4[_0x4b10a1];return _0x25f2c5;};'use strict';var multer=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var path=require(_0x4d8b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d8b('0x3'));var router=express[_0x4d8b('0x4')]();var fs_extra=require(_0x4d8b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d8b('0x6'));var controller=require(_0x4d8b('0x7'));router[_0x4d8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d8b('0x9')]);router[_0x4d8b('0x8')](_0x4d8b('0xa'),auth[_0x4d8b('0xb')](),controller['show']);router[_0x4d8b('0x8')]('/:id/configurations',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xc')]);router[_0x4d8b('0x8')]('/:id/fields',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xd')]);router[_0x4d8b('0xe')]('/',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xf')]);router[_0x4d8b('0xe')](_0x4d8b('0x10'),auth['isAuthenticated'](),controller[_0x4d8b('0x11')]);router[_0x4d8b('0x12')]('/:id',auth[_0x4d8b('0xb')](),controller['update']);router[_0x4d8b('0x13')]('/:id',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0x14')]);module[_0x4d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f1e47d3..4749fe1 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 _0x5613=['STRING','username','remoteUri','sequelize','exports'];(function(_0x12acd6,_0x47bc20){var _0x176022=function(_0x53ebcb){while(--_0x53ebcb){_0x12acd6['push'](_0x12acd6['shift']());}};_0x176022(++_0x47bc20);}(_0x5613,0x15c));var _0x3561=function(_0x171498,_0x5a342b){_0x171498=_0x171498-0x0;var _0x39fd69=_0x5613[_0x171498];return _0x39fd69;};'use strict';var Sequelize=require(_0x3561('0x0'));module[_0x3561('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3561('0x2')]},'username':{'type':Sequelize[_0x3561('0x2')],'unique':_0x3561('0x3')},'password':{'type':Sequelize[_0x3561('0x2')]},'email':{'type':Sequelize[_0x3561('0x2')]},'remoteUri':{'type':Sequelize[_0x3561('0x2')],'unique':_0x3561('0x4')},'serverUrl':{'type':Sequelize[_0x3561('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f1e=['exports','STRING','username','sequelize'];(function(_0x66d8f5,_0x2f6f6f){var _0x28d1b5=function(_0x3b8bec){while(--_0x3b8bec){_0x66d8f5['push'](_0x66d8f5['shift']());}};_0x28d1b5(++_0x2f6f6f);}(_0x5f1e,0xbf));var _0xe5f1=function(_0x1695d2,_0x357e1a){_0x1695d2=_0x1695d2-0x0;var _0x3cec68=_0x5f1e[_0x1695d2];return _0x3cec68;};'use strict';var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5f1('0x2')]},'username':{'type':Sequelize[_0xe5f1('0x2')],'unique':_0xe5f1('0x3')},'password':{'type':Sequelize[_0xe5f1('0x2')]},'email':{'type':Sequelize[_0xe5f1('0x2')]},'remoteUri':{'type':Sequelize[_0xe5f1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe5f1('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 260257b..17b268b 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 _0x8e77=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','ServicenowConfiguration','filter','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','close_code','notify','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','password','email','remoteUri','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','result','log','incident\x20table\x20objects','assign','remove','forEach','label','push','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','concat','test','statusCode','send','Wrong\x20credentials','boolean','False','false','inactive','value','eml-format','rimraf'];(function(_0x414e9e,_0x1575f6){var _0x31141f=function(_0x1cdfee){while(--_0x1cdfee){_0x414e9e['push'](_0x414e9e['shift']());}};_0x31141f(++_0x1575f6);}(_0x8e77,0xb9));var _0x78e7=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x8e77[_0x7cb10c];return _0x11df59;};'use strict';var emlformat=require(_0x78e7('0x0'));var rimraf=require(_0x78e7('0x1'));var zipdir=require(_0x78e7('0x2'));var jsonpatch=require(_0x78e7('0x3'));var rp=require(_0x78e7('0x4'));var moment=require(_0x78e7('0x5'));var BPromise=require(_0x78e7('0x6'));var Mustache=require('mustache');var util=require(_0x78e7('0x7'));var path=require(_0x78e7('0x8'));var sox=require(_0x78e7('0x9'));var csv=require(_0x78e7('0xa'));var ejs=require(_0x78e7('0xb'));var fs=require('fs');var fs_extra=require(_0x78e7('0xc'));var _=require(_0x78e7('0xd'));var squel=require(_0x78e7('0xe'));var crypto=require(_0x78e7('0xf'));var jsforce=require(_0x78e7('0x10'));var deskjs=require(_0x78e7('0x11'));var toCsv=require(_0x78e7('0xa'));var querystring=require('querystring');var Papa=require(_0x78e7('0x12'));var Redis=require(_0x78e7('0x13'));var authService=require(_0x78e7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x78e7('0x15'));var hardwareService=require(_0x78e7('0x16'));var logger=require(_0x78e7('0x17'))(_0x78e7('0x18'));var utils=require(_0x78e7('0x19'));var config=require(_0x78e7('0x1a'));var licenseUtil=require(_0x78e7('0x1b'));var db=require(_0x78e7('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5db32c,_0x47dbb2){_0x47dbb2=_0x47dbb2||0xcc;return function(_0x45b1ff){if(_0x45b1ff){return _0x5db32c['sendStatus'](_0x47dbb2);}return _0x5db32c[_0x78e7('0x1d')](_0x47dbb2)['end']();};}function respondWithResult(_0x3942aa,_0x1cb561){_0x1cb561=_0x1cb561||0xc8;return function(_0x28f9fc){if(_0x28f9fc){return _0x3942aa[_0x78e7('0x1d')](_0x1cb561)['json'](_0x28f9fc);}};}function respondWithFilteredResult(_0x41308c,_0x18c3a1){return function(_0x44e1af){if(_0x44e1af){var _0x4395aa=typeof _0x18c3a1[_0x78e7('0x1e')]===_0x78e7('0x1f')&&typeof _0x18c3a1[_0x78e7('0x20')]===_0x78e7('0x1f');var _0xa4d9e4=_0x44e1af[_0x78e7('0x21')];var _0x1ca64f=_0x4395aa?0x0:_0x18c3a1[_0x78e7('0x1e')];var _0x286c2f=_0x4395aa?_0x44e1af[_0x78e7('0x21')]:_0x18c3a1['offset']+_0x18c3a1['limit'];var _0x4dd638;if(_0x286c2f>=_0xa4d9e4){_0x286c2f=_0xa4d9e4;_0x4dd638=0xc8;}else{_0x4dd638=0xce;}_0x41308c[_0x78e7('0x1d')](_0x4dd638);return _0x41308c[_0x78e7('0x22')](_0x78e7('0x23'),_0x1ca64f+'-'+_0x286c2f+'/'+_0xa4d9e4)[_0x78e7('0x24')](_0x44e1af);}return null;};}function patchUpdates(_0x5e9069){return function(_0x5498fb){try{jsonpatch[_0x78e7('0x25')](_0x5498fb,_0x5e9069,!![]);}catch(_0x3f43c1){return BPromise['reject'](_0x3f43c1);}return _0x5498fb[_0x78e7('0x26')]();};}function saveUpdates(_0x275add,_0x1f347f){return function(_0x1e2ca4){if(_0x1e2ca4){return _0x1e2ca4[_0x78e7('0x27')](_0x275add)[_0x78e7('0x28')](function(_0x5c2217){return _0x5c2217;});}return null;};}function removeEntity(_0x259220,_0x27adbb){return function(_0x108fa2){if(_0x108fa2){return _0x108fa2[_0x78e7('0x29')]()[_0x78e7('0x28')](function(){_0x259220[_0x78e7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1363dd,_0x1e3543){return function(_0xec62bb){if(!_0xec62bb){_0x1363dd['sendStatus'](0x194);}return _0xec62bb;};}function handleError(_0x514719,_0x36be8c){_0x36be8c=_0x36be8c||0x1f4;return function(_0x5454ec){logger[_0x78e7('0x2a')](_0x5454ec[_0x78e7('0x2b')]);if(_0x5454ec[_0x78e7('0x2c')]){delete _0x5454ec[_0x78e7('0x2c')];}_0x514719[_0x78e7('0x1d')](_0x36be8c)['send'](_0x5454ec);};}exports[_0x78e7('0x2d')]=function(_0x4662f0,_0xb5bbff){var _0x32e11b={},_0x4d6ebe={},_0x33611a={'count':0x0,'rows':[]};var _0x1ea056=_[_0x78e7('0x2e')](db[_0x78e7('0x2f')][_0x78e7('0x30')],function(_0x920cff){return{'name':_0x920cff[_0x78e7('0x31')],'type':_0x920cff[_0x78e7('0x32')][_0x78e7('0x33')]};});_0x4d6ebe[_0x78e7('0x34')]=_['map'](_0x1ea056,_0x78e7('0x2c'));_0x4d6ebe[_0x78e7('0x35')]=_['keys'](_0x4662f0[_0x78e7('0x35')]);_0x4d6ebe[_0x78e7('0x36')]=_[_0x78e7('0x37')](_0x4d6ebe[_0x78e7('0x34')],_0x4d6ebe[_0x78e7('0x35')]);_0x32e11b[_0x78e7('0x38')]=_[_0x78e7('0x37')](_0x4d6ebe['model'],qs[_0x78e7('0x39')](_0x4662f0['query']['fields']));_0x32e11b[_0x78e7('0x38')]=_0x32e11b[_0x78e7('0x38')][_0x78e7('0x3a')]?_0x32e11b[_0x78e7('0x38')]:_0x4d6ebe[_0x78e7('0x34')];if(!_0x4662f0[_0x78e7('0x35')]['hasOwnProperty']('nolimit')){_0x32e11b[_0x78e7('0x20')]=qs[_0x78e7('0x20')](_0x4662f0[_0x78e7('0x35')]['limit']);_0x32e11b[_0x78e7('0x1e')]=qs['offset'](_0x4662f0[_0x78e7('0x35')][_0x78e7('0x1e')]);}_0x32e11b[_0x78e7('0x3b')]=qs['sort'](_0x4662f0[_0x78e7('0x35')][_0x78e7('0x3c')]);_0x32e11b[_0x78e7('0x3d')]=qs['filters'](_[_0x78e7('0x3e')](_0x4662f0[_0x78e7('0x35')],_0x4d6ebe[_0x78e7('0x36')]),_0x1ea056);if(_0x4662f0['query']['filter']){_0x32e11b['where']=_[_0x78e7('0x3f')](_0x32e11b['where'],{'$or':_[_0x78e7('0x2e')](_0x1ea056,function(_0x4209f5){if(_0x4209f5['type']!==_0x78e7('0x40')){var _0x585c42={};_0x585c42[_0x4209f5[_0x78e7('0x2c')]]={'$like':'%'+_0x4662f0['query']['filter']+'%'};return _0x585c42;}})});}_0x32e11b=_['merge']({},_0x32e11b,_0x4662f0[_0x78e7('0x41')]);var _0x20bc74={'where':_0x32e11b[_0x78e7('0x3d')]};return db[_0x78e7('0x2f')][_0x78e7('0x21')](_0x20bc74)[_0x78e7('0x28')](function(_0x259449){_0x33611a['count']=_0x259449;if(_0x4662f0[_0x78e7('0x35')]['includeAll']){_0x32e11b[_0x78e7('0x42')]=[{'all':!![]}];}return db[_0x78e7('0x2f')][_0x78e7('0x43')](_0x32e11b);})['then'](function(_0x40be17){_0x33611a[_0x78e7('0x44')]=_0x40be17;return _0x33611a;})[_0x78e7('0x28')](respondWithFilteredResult(_0xb5bbff,_0x32e11b))[_0x78e7('0x45')](handleError(_0xb5bbff,null));};exports[_0x78e7('0x46')]=function(_0x5146f5,_0x340726){var _0x3c6d7f={'raw':![],'where':{'id':_0x5146f5[_0x78e7('0x47')]['id']}},_0x195df9={};_0x195df9[_0x78e7('0x34')]=_[_0x78e7('0x48')](db[_0x78e7('0x2f')][_0x78e7('0x30')]);_0x195df9[_0x78e7('0x35')]=_[_0x78e7('0x48')](_0x5146f5['query']);_0x195df9[_0x78e7('0x36')]=_[_0x78e7('0x37')](_0x195df9[_0x78e7('0x34')],_0x195df9['query']);_0x3c6d7f['attributes']=_[_0x78e7('0x37')](_0x195df9[_0x78e7('0x34')],qs['fields'](_0x5146f5['query'][_0x78e7('0x39')]));_0x3c6d7f['attributes']=_0x3c6d7f[_0x78e7('0x38')]['length']?_0x3c6d7f[_0x78e7('0x38')]:_0x195df9[_0x78e7('0x34')];if(_0x5146f5[_0x78e7('0x35')]['includeAll']){_0x3c6d7f[_0x78e7('0x42')]=[{'all':!![]}];}_0x3c6d7f=_[_0x78e7('0x3f')]({},_0x3c6d7f,_0x5146f5[_0x78e7('0x41')]);return db['ServicenowAccount'][_0x78e7('0x49')](_0x3c6d7f)['then'](handleEntityNotFound(_0x340726,null))[_0x78e7('0x28')](respondWithResult(_0x340726,null))[_0x78e7('0x45')](handleError(_0x340726,null));};exports[_0x78e7('0x4a')]=function(_0x3e1a2a,_0x943fa5){return db[_0x78e7('0x2f')]['create'](_0x3e1a2a['body'],{})[_0x78e7('0x28')](respondWithResult(_0x943fa5,0xc9))[_0x78e7('0x45')](handleError(_0x943fa5,null));};exports['update']=function(_0xad96a5,_0x4f3fa6){if(_0xad96a5[_0x78e7('0x4b')]['id']){delete _0xad96a5[_0x78e7('0x4b')]['id'];}return db[_0x78e7('0x2f')]['find']({'where':{'id':_0xad96a5[_0x78e7('0x47')]['id']}})[_0x78e7('0x28')](handleEntityNotFound(_0x4f3fa6,null))[_0x78e7('0x28')](saveUpdates(_0xad96a5[_0x78e7('0x4b')],null))[_0x78e7('0x28')](respondWithResult(_0x4f3fa6,null))[_0x78e7('0x45')](handleError(_0x4f3fa6,null));};exports['destroy']=function(_0x2c4a93,_0x291faa){return db['ServicenowAccount'][_0x78e7('0x49')]({'where':{'id':_0x2c4a93[_0x78e7('0x47')]['id']}})['then'](handleEntityNotFound(_0x291faa,null))['then'](removeEntity(_0x291faa,null))[_0x78e7('0x45')](handleError(_0x291faa,null));};exports[_0x78e7('0x4c')]=function(_0xd4f4ce,_0x3f8e85,_0x73b294){var _0x2d2dd1={};var _0x52e66c={};var _0x58c798;var _0xc70827;return db['ServicenowAccount'][_0x78e7('0x4d')]({'where':{'id':_0xd4f4ce[_0x78e7('0x47')]['id']}})[_0x78e7('0x28')](handleEntityNotFound(_0x3f8e85,null))[_0x78e7('0x28')](function(_0xa5c2bf){if(_0xa5c2bf){_0x58c798=_0xa5c2bf;_0x52e66c['model']=_[_0x78e7('0x48')](db[_0x78e7('0x4e')]['rawAttributes']);_0x52e66c['query']=_['keys'](_0xd4f4ce[_0x78e7('0x35')]);_0x52e66c[_0x78e7('0x36')]=_[_0x78e7('0x37')](_0x52e66c['model'],_0x52e66c['query']);_0x2d2dd1[_0x78e7('0x38')]=_[_0x78e7('0x37')](_0x52e66c['model'],qs['fields'](_0xd4f4ce[_0x78e7('0x35')][_0x78e7('0x39')]));_0x2d2dd1[_0x78e7('0x38')]=_0x2d2dd1[_0x78e7('0x38')][_0x78e7('0x3a')]?_0x2d2dd1[_0x78e7('0x38')]:_0x52e66c[_0x78e7('0x34')];_0x2d2dd1[_0x78e7('0x3b')]=qs[_0x78e7('0x3c')](_0xd4f4ce[_0x78e7('0x35')][_0x78e7('0x3c')]);_0x2d2dd1[_0x78e7('0x3d')]=qs['filters'](_[_0x78e7('0x3e')](_0xd4f4ce[_0x78e7('0x35')],_0x52e66c[_0x78e7('0x36')]));if(_0xd4f4ce[_0x78e7('0x35')][_0x78e7('0x4f')]){_0x2d2dd1[_0x78e7('0x3d')]=_[_0x78e7('0x3f')](_0x2d2dd1[_0x78e7('0x3d')],{'$or':_['map'](_0x2d2dd1[_0x78e7('0x38')],function(_0x215c72){var _0xdfc705={};_0xdfc705[_0x215c72]={'$like':'%'+_0xd4f4ce[_0x78e7('0x35')][_0x78e7('0x4f')]+'%'};return _0xdfc705;})});}_0x2d2dd1=_[_0x78e7('0x3f')]({},_0x2d2dd1,_0xd4f4ce['options']);return _0x58c798['getConfigurations'](_0x2d2dd1);}})['then'](function(_0x3ced56){if(_0x3ced56){_0xc70827=_0x3ced56[_0x78e7('0x3a')];if(!_0xd4f4ce[_0x78e7('0x35')][_0x78e7('0x50')](_0x78e7('0x51'))){_0x2d2dd1[_0x78e7('0x20')]=qs[_0x78e7('0x20')](_0xd4f4ce['query'][_0x78e7('0x20')]);_0x2d2dd1[_0x78e7('0x1e')]=qs[_0x78e7('0x1e')](_0xd4f4ce[_0x78e7('0x35')]['offset']);}return _0x58c798['getConfigurations'](_0x2d2dd1);}})[_0x78e7('0x28')](function(_0x2c1501){if(_0x2c1501){return _0x2c1501?{'count':_0xc70827,'rows':_0x2c1501}:null;}})[_0x78e7('0x28')](respondWithResult(_0x3f8e85,null))[_0x78e7('0x45')](handleError(_0x3f8e85,null));};exports[_0x78e7('0x52')]=function(_0x538e5c,_0x57a01d,_0x53e2b6){if(_0x538e5c[_0x78e7('0x4b')]['id']){delete _0x538e5c['body']['id'];}return db[_0x78e7('0x2f')][_0x78e7('0x4d')]({'where':{'id':_0x538e5c['params']['id']}})[_0x78e7('0x28')](handleEntityNotFound(_0x57a01d,null))[_0x78e7('0x28')](function(_0x6dad25){if(_0x6dad25){_0x538e5c['body'][_0x78e7('0x53')]=_0x6dad25['id'];_0x538e5c[_0x78e7('0x4b')][_0x78e7('0x54')]=integrations[_0x78e7('0x55')](_0x538e5c[_0x78e7('0x4b')][_0x78e7('0x56')],_0x538e5c[_0x78e7('0x4b')]['type']);_0x538e5c[_0x78e7('0x4b')][_0x78e7('0x57')]=integrations[_0x78e7('0x58')](_0x538e5c[_0x78e7('0x4b')][_0x78e7('0x56')],_0x538e5c['body']['type']);return db[_0x78e7('0x4e')]['create'](_0x538e5c[_0x78e7('0x4b')],{'include':[{'model':db['ServicenowField'],'as':_0x78e7('0x54')},{'model':db[_0x78e7('0x59')],'as':_0x78e7('0x57')}]});}return null;})[_0x78e7('0x28')](respondWithResult(_0x57a01d,null))[_0x78e7('0x45')](handleError(_0x57a01d,null));};exports[_0x78e7('0x5a')]=function(_0x4a065c,_0x312b07,_0x45169d){var _0x338497=[_0x78e7('0x5b'),'hold_reason',_0x78e7('0x5c'),'subcategory',_0x78e7('0x5d'),_0x78e7('0x5e'),'incident_state',_0x78e7('0x5f'),_0x78e7('0x60')];var _0x40c268=[_0x78e7('0x61'),_0x78e7('0x5b'),_0x78e7('0x62'),'watch_list',_0x78e7('0x63'),_0x78e7('0x64'),_0x78e7('0x65'),'hold_reason',_0x78e7('0x66'),'number',_0x78e7('0x67'),_0x78e7('0x68'),'opened_by','user_input',_0x78e7('0x69'),'sys_domain',_0x78e7('0x6a'),_0x78e7('0x6b'),'knowledge',_0x78e7('0x3b'),'calendar_stc',_0x78e7('0x6c'),_0x78e7('0x6d'),_0x78e7('0x6e'),_0x78e7('0x6f'),_0x78e7('0x70'),_0x78e7('0x71'),_0x78e7('0x72'),'priority',_0x78e7('0x73'),_0x78e7('0x74'),_0x78e7('0x75'),_0x78e7('0x76'),_0x78e7('0x77'),'business_duration',_0x78e7('0x78'),_0x78e7('0x79'),_0x78e7('0x7a'),_0x78e7('0x7b'),'caller_id',_0x78e7('0x7c'),_0x78e7('0x7d'),'work_notes',_0x78e7('0x7e'),_0x78e7('0x5d'),_0x78e7('0x7f'),'delivery_task',_0x78e7('0x80'),_0x78e7('0x81'),_0x78e7('0x82'),_0x78e7('0x83'),_0x78e7('0x84'),_0x78e7('0x85'),_0x78e7('0x5e'),'sys_class_name',_0x78e7('0x86'),_0x78e7('0x87'),_0x78e7('0x88'),_0x78e7('0x89'),_0x78e7('0x8a'),_0x78e7('0x8b'),_0x78e7('0x8c'),_0x78e7('0x8d'),'urgency',_0x78e7('0x8e'),_0x78e7('0x8f'),_0x78e7('0x90'),_0x78e7('0x91'),_0x78e7('0x92'),_0x78e7('0x5f'),_0x78e7('0x93'),'sla_due',_0x78e7('0x94'),_0x78e7('0x95'),'due_date',_0x78e7('0x96'),_0x78e7('0x97'),_0x78e7('0x98'),_0x78e7('0x99'),_0x78e7('0x9a'),'correlation_id',_0x78e7('0x9b'),_0x78e7('0x60')];var _0x2923d4='';var _0x116d86='';var _0x241840=[];var _0x152256='';var _0x422afd='';var _0x5aae99=[];var _0x1dc7a1='';var _0x563620='';var _0x52cc3b={};var _0x18ccef='';return db[_0x78e7('0x2f')][_0x78e7('0x4d')]({'where':{'id':_0x4a065c[_0x78e7('0x47')]['id']},'attributes':['id','username',_0x78e7('0x9c'),_0x78e7('0x9d'),_0x78e7('0x9e'),'serverUrl']})['then'](handleEntityNotFound(_0x312b07,null))['then'](function(_0x3ca6b2){if(_0x3ca6b2){_0x18ccef=_0x3ca6b2[_0x78e7('0x9e')];var _0x13ea15=_0x18ccef['slice'](-0x1);if(_0x13ea15==='/'){_0x18ccef=_0x18ccef['substring'](0x0,_0x18ccef[_0x78e7('0x9f')](_0x13ea15));}_0x563620=util[_0x78e7('0xa0')](_0x78e7('0xa1'),_0x18ccef);_0x1dc7a1=util['format']('%s/api/now/table/',_0x18ccef);_0x52cc3b={'user':_0x3ca6b2[_0x78e7('0xa2')],'pass':_0x3ca6b2[_0x78e7('0x9c')]};var _0x311f65={'method':_0x78e7('0xa3'),'uri':_0x563620+'incident?sysparm_display_value=all','auth':_0x52cc3b,'json':!![]};return rp(_0x311f65);}})['then'](function(_0x4e4fcd){if(_0x4e4fcd[_0x78e7('0xa4')]['length']>0x0){_0x2923d4=_0x4e4fcd['result'];}console[_0x78e7('0xa5')](_0x78e7('0xa6'),_0x2923d4);_0x5aae99=[];_0x116d86=Object[_0x78e7('0xa7')]([],_0x2923d4);_[_0x78e7('0xa8')](_0x116d86,function(_0x11f805){return!_0x338497['includes'](_0x11f805[_0x78e7('0x2c')]);});_0x116d86[_0x78e7('0xa9')](function(_0x3a9a32){var _0x317cff=createFieldObject(_0x1dc7a1,_0x52cc3b,_0x3a9a32['internalType'],_0x3a9a32[_0x78e7('0x2c')],_0x3a9a32[_0x78e7('0xaa')],![]);_0x5aae99[_0x78e7('0xab')](_0x317cff);});return Promise['all'](_0x5aae99);})[_0x78e7('0x28')](function(_0x36cf14){_0x241840=_0x36cf14;_0x152256=Object['assign']([],_0x2923d4);console[_0x78e7('0xa5')](_0x78e7('0xac'),_0x2923d4);_[_0x78e7('0xa8')](_0x152256,function(_0x1d5364){return _0x40c268[_0x78e7('0xad')](_0x1d5364['name']);});console['log'](_0x78e7('0xae'),_0x152256);_0x5aae99=[];_0x152256[_0x78e7('0xa9')](function(_0x1df014){var _0x433305=createFieldObject(_0x1dc7a1,_0x52cc3b,_0x1df014[_0x78e7('0xaf')],_0x1df014['name'],_0x1df014[_0x78e7('0xaa')],!![]);_0x5aae99[_0x78e7('0xab')](_0x433305);});return Promise[_0x78e7('0xb0')](_0x5aae99);})[_0x78e7('0x28')](function(_0x1ddd1b){_0x422afd=_0x1ddd1b;var _0x290a32=_0x241840[_0x78e7('0xb1')](_0x422afd);return{'count':_0x290a32[_0x78e7('0x3a')],'rows':_0x290a32};})[_0x78e7('0x28')](respondWithResult(_0x312b07,null))['catch'](function(_0x2859c2){console['log']('ServiceNow\x20error:\x20'+_0x2859c2);var _0x38726a=_0x4a065c[_0x78e7('0x35')][_0x78e7('0xb2')]?0x1f4:_0x2859c2[_0x78e7('0xb3')]||0x1f4;logger[_0x78e7('0x2a')](_0x2859c2[_0x78e7('0x2b')]);delete _0x2859c2[_0x78e7('0x2c')];if(_0x38726a===0x191){_0x38726a=0x190;}_0x312b07[_0x78e7('0x1d')](_0x38726a)[_0x78e7('0xb4')](_0x4a065c[_0x78e7('0x35')]['test']?{'message':_0x78e7('0xb5'),'statusCode':_0x2859c2['statusCode']}:_0x2859c2);});};function createFieldObject(_0x6fe4b1,_0x5493b2,_0x43286a,_0x4d1834,_0x51a0f9,_0xd5e6e5){return new Promise(function(_0x118788,_0x5648b2){var _0x40b097={'id':_0x4d1834,'name':_0x51a0f9,'custom':_0xd5e6e5};if(_0x43286a===_0x78e7('0xb6')){_0x40b097[_0x78e7('0x41')]=[{'name':'True','value':'true'},{'name':_0x78e7('0xb7'),'value':_0x78e7('0xb8')}];_0x118788(_0x40b097);}else{var _0x56e61f={'method':_0x78e7('0xa3'),'uri':_0x6fe4b1+'sys_choice?sysparm_query=name=incident^element='+_0x4d1834,'auth':_0x5493b2,'json':!![]};return rp(_0x56e61f)[_0x78e7('0x28')](function(_0x1c5761){var _0x4595d3=[];if(_0x1c5761['result']['length']>0x0){_0x1c5761[_0x78e7('0xa4')][_0x78e7('0xa9')](function(_0x211f79){if(_0x211f79[_0x78e7('0xb9')]===_0x78e7('0xb8')){var _0x408805={'name':_0x211f79[_0x78e7('0xaa')],'value':_0x211f79[_0x78e7('0xba')]};_0x4595d3[_0x78e7('0xab')](_0x408805);}});}_0x40b097['options']=_0x4595d3;if(_0x40b097['options'][_0x78e7('0x3a')]>0x0){_0x118788(_0x40b097);}else{if(_0xd5e6e5==![]){_0x118788();}else{_0x118788(_0x40b097);}}});}});} \ No newline at end of file +var _0xc947=['calendar_stc','cmdb_ci','delivery_plan','active','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','location','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','includes','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','end','sendStatus','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','findAll','rows','catch','show','rawAttributes','keys','include','merge','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by'];(function(_0x413068,_0x4fd2d8){var _0x2ee70e=function(_0x3458a4){while(--_0x3458a4){_0x413068['push'](_0x413068['shift']());}};_0x2ee70e(++_0x4fd2d8);}(_0xc947,0x1ca));var _0x7c94=function(_0x4a7077,_0x5dbcc0){_0x4a7077=_0x4a7077-0x0;var _0x3ed008=_0xc947[_0x4a7077];return _0x3ed008;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c94('0x0'));var zipdir=require(_0x7c94('0x1'));var jsonpatch=require(_0x7c94('0x2'));var rp=require(_0x7c94('0x3'));var moment=require(_0x7c94('0x4'));var BPromise=require(_0x7c94('0x5'));var Mustache=require(_0x7c94('0x6'));var util=require(_0x7c94('0x7'));var path=require(_0x7c94('0x8'));var sox=require(_0x7c94('0x9'));var csv=require('to-csv');var ejs=require(_0x7c94('0xa'));var fs=require('fs');var fs_extra=require(_0x7c94('0xb'));var _=require(_0x7c94('0xc'));var squel=require('squel');var crypto=require(_0x7c94('0xd'));var jsforce=require(_0x7c94('0xe'));var deskjs=require(_0x7c94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7c94('0x10'));var Papa=require(_0x7c94('0x11'));var Redis=require(_0x7c94('0x12'));var authService=require(_0x7c94('0x13'));var qs=require(_0x7c94('0x14'));var as=require(_0x7c94('0x15'));var hardwareService=require(_0x7c94('0x16'));var logger=require(_0x7c94('0x17'))(_0x7c94('0x18'));var utils=require(_0x7c94('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7c94('0x1a'))['db'];var integrations=require(_0x7c94('0x1b'));function respondWithStatusCode(_0x410dac,_0x51c53b){_0x51c53b=_0x51c53b||0xcc;return function(_0x2bb3c6){if(_0x2bb3c6){return _0x410dac['sendStatus'](_0x51c53b);}return _0x410dac[_0x7c94('0x1c')](_0x51c53b)['end']();};}function respondWithResult(_0x130988,_0x49f6fd){_0x49f6fd=_0x49f6fd||0xc8;return function(_0x36e450){if(_0x36e450){return _0x130988['status'](_0x49f6fd)[_0x7c94('0x1d')](_0x36e450);}};}function respondWithFilteredResult(_0x5a4fd9,_0x25f117){return function(_0x5a477f){if(_0x5a477f){var _0x239ded=typeof _0x25f117['offset']===_0x7c94('0x1e')&&typeof _0x25f117[_0x7c94('0x1f')]==='undefined';var _0x5cf6a0=_0x5a477f[_0x7c94('0x20')];var _0x528077=_0x239ded?0x0:_0x25f117[_0x7c94('0x21')];var _0x439712=_0x239ded?_0x5a477f[_0x7c94('0x20')]:_0x25f117['offset']+_0x25f117[_0x7c94('0x1f')];var _0x35534a;if(_0x439712>=_0x5cf6a0){_0x439712=_0x5cf6a0;_0x35534a=0xc8;}else{_0x35534a=0xce;}_0x5a4fd9[_0x7c94('0x1c')](_0x35534a);return _0x5a4fd9[_0x7c94('0x22')]('Content-Range',_0x528077+'-'+_0x439712+'/'+_0x5cf6a0)[_0x7c94('0x1d')](_0x5a477f);}return null;};}function patchUpdates(_0x12f433){return function(_0x48f89f){try{jsonpatch[_0x7c94('0x23')](_0x48f89f,_0x12f433,!![]);}catch(_0x1dfaf2){return BPromise['reject'](_0x1dfaf2);}return _0x48f89f[_0x7c94('0x24')]();};}function saveUpdates(_0x3dfd86,_0x34fa25){return function(_0x3c05de){if(_0x3c05de){return _0x3c05de[_0x7c94('0x25')](_0x3dfd86)[_0x7c94('0x26')](function(_0x41ba21){return _0x41ba21;});}return null;};}function removeEntity(_0x8e53b6,_0x10f683){return function(_0x45d42f){if(_0x45d42f){return _0x45d42f[_0x7c94('0x27')]()['then'](function(){_0x8e53b6[_0x7c94('0x1c')](0xcc)[_0x7c94('0x28')]();});}};}function handleEntityNotFound(_0x3e28a1,_0x163ba6){return function(_0x30dc3a){if(!_0x30dc3a){_0x3e28a1[_0x7c94('0x29')](0x194);}return _0x30dc3a;};}function handleError(_0x363f6a,_0xf3eda9){_0xf3eda9=_0xf3eda9||0x1f4;return function(_0x4166bd){logger['error'](_0x4166bd['stack']);if(_0x4166bd[_0x7c94('0x2a')]){delete _0x4166bd['name'];}_0x363f6a[_0x7c94('0x1c')](_0xf3eda9)[_0x7c94('0x2b')](_0x4166bd);};}exports[_0x7c94('0x2c')]=function(_0x335c85,_0x505f46){var _0x18d206={},_0x35d983={},_0x5bed22={'count':0x0,'rows':[]};var _0x43b650=_[_0x7c94('0x2d')](db[_0x7c94('0x2e')]['rawAttributes'],function(_0x77ab5d){return{'name':_0x77ab5d[_0x7c94('0x2f')],'type':_0x77ab5d[_0x7c94('0x30')][_0x7c94('0x31')]};});_0x35d983[_0x7c94('0x32')]=_['map'](_0x43b650,_0x7c94('0x2a'));_0x35d983[_0x7c94('0x33')]=_['keys'](_0x335c85['query']);_0x35d983[_0x7c94('0x34')]=_[_0x7c94('0x35')](_0x35d983[_0x7c94('0x32')],_0x35d983[_0x7c94('0x33')]);_0x18d206[_0x7c94('0x36')]=_['intersection'](_0x35d983[_0x7c94('0x32')],qs['fields'](_0x335c85[_0x7c94('0x33')][_0x7c94('0x37')]));_0x18d206[_0x7c94('0x36')]=_0x18d206[_0x7c94('0x36')][_0x7c94('0x38')]?_0x18d206[_0x7c94('0x36')]:_0x35d983[_0x7c94('0x32')];if(!_0x335c85['query'][_0x7c94('0x39')](_0x7c94('0x3a'))){_0x18d206['limit']=qs[_0x7c94('0x1f')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x1f')]);_0x18d206[_0x7c94('0x21')]=qs[_0x7c94('0x21')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x21')]);}_0x18d206[_0x7c94('0x3b')]=qs[_0x7c94('0x3c')](_0x335c85[_0x7c94('0x33')][_0x7c94('0x3c')]);_0x18d206['where']=qs[_0x7c94('0x34')](_[_0x7c94('0x3d')](_0x335c85[_0x7c94('0x33')],_0x35d983[_0x7c94('0x34')]),_0x43b650);if(_0x335c85[_0x7c94('0x33')]['filter']){_0x18d206[_0x7c94('0x3e')]=_['merge'](_0x18d206['where'],{'$or':_[_0x7c94('0x2d')](_0x43b650,function(_0x4b1a07){if(_0x4b1a07[_0x7c94('0x30')]!==_0x7c94('0x3f')){var _0x45ae43={};_0x45ae43[_0x4b1a07[_0x7c94('0x2a')]]={'$like':'%'+_0x335c85[_0x7c94('0x33')][_0x7c94('0x40')]+'%'};return _0x45ae43;}})});}_0x18d206=_['merge']({},_0x18d206,_0x335c85[_0x7c94('0x41')]);var _0x18b78e={'where':_0x18d206[_0x7c94('0x3e')]};return db[_0x7c94('0x2e')]['count'](_0x18b78e)[_0x7c94('0x26')](function(_0x5ad3c5){_0x5bed22[_0x7c94('0x20')]=_0x5ad3c5;if(_0x335c85[_0x7c94('0x33')]['includeAll']){_0x18d206['include']=[{'all':!![]}];}return db[_0x7c94('0x2e')][_0x7c94('0x42')](_0x18d206);})[_0x7c94('0x26')](function(_0x321633){_0x5bed22[_0x7c94('0x43')]=_0x321633;return _0x5bed22;})[_0x7c94('0x26')](respondWithFilteredResult(_0x505f46,_0x18d206))[_0x7c94('0x44')](handleError(_0x505f46,null));};exports[_0x7c94('0x45')]=function(_0x70e4c5,_0x153c05){var _0x7f4df2={'raw':![],'where':{'id':_0x70e4c5['params']['id']}},_0x59aac6={};_0x59aac6[_0x7c94('0x32')]=_['keys'](db[_0x7c94('0x2e')][_0x7c94('0x46')]);_0x59aac6[_0x7c94('0x33')]=_[_0x7c94('0x47')](_0x70e4c5[_0x7c94('0x33')]);_0x59aac6['filters']=_[_0x7c94('0x35')](_0x59aac6[_0x7c94('0x32')],_0x59aac6[_0x7c94('0x33')]);_0x7f4df2[_0x7c94('0x36')]=_['intersection'](_0x59aac6[_0x7c94('0x32')],qs[_0x7c94('0x37')](_0x70e4c5['query'][_0x7c94('0x37')]));_0x7f4df2[_0x7c94('0x36')]=_0x7f4df2['attributes']['length']?_0x7f4df2[_0x7c94('0x36')]:_0x59aac6['model'];if(_0x70e4c5[_0x7c94('0x33')]['includeAll']){_0x7f4df2[_0x7c94('0x48')]=[{'all':!![]}];}_0x7f4df2=_[_0x7c94('0x49')]({},_0x7f4df2,_0x70e4c5[_0x7c94('0x41')]);return db[_0x7c94('0x2e')][_0x7c94('0x4a')](_0x7f4df2)['then'](handleEntityNotFound(_0x153c05,null))['then'](respondWithResult(_0x153c05,null))[_0x7c94('0x44')](handleError(_0x153c05,null));};exports[_0x7c94('0x4b')]=function(_0x396803,_0x4485f2){return db[_0x7c94('0x2e')]['create'](_0x396803[_0x7c94('0x4c')],{})[_0x7c94('0x26')](respondWithResult(_0x4485f2,0xc9))['catch'](handleError(_0x4485f2,null));};exports[_0x7c94('0x25')]=function(_0x5c09a3,_0x1f93e5){if(_0x5c09a3[_0x7c94('0x4c')]['id']){delete _0x5c09a3['body']['id'];}return db[_0x7c94('0x2e')][_0x7c94('0x4a')]({'where':{'id':_0x5c09a3['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x1f93e5,null))[_0x7c94('0x26')](saveUpdates(_0x5c09a3[_0x7c94('0x4c')],null))['then'](respondWithResult(_0x1f93e5,null))[_0x7c94('0x44')](handleError(_0x1f93e5,null));};exports['destroy']=function(_0x31ee7b,_0x13ddb6){return db[_0x7c94('0x2e')][_0x7c94('0x4a')]({'where':{'id':_0x31ee7b[_0x7c94('0x4d')]['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x13ddb6,null))['then'](removeEntity(_0x13ddb6,null))[_0x7c94('0x44')](handleError(_0x13ddb6,null));};exports[_0x7c94('0x4e')]=function(_0x64ea0d,_0x5befaa,_0x2c60a8){var _0x482765={};var _0x2d73ff={};var _0x5b3425;var _0x40367e;return db[_0x7c94('0x2e')][_0x7c94('0x4f')]({'where':{'id':_0x64ea0d['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x5befaa,null))['then'](function(_0x196f32){if(_0x196f32){_0x5b3425=_0x196f32;_0x2d73ff[_0x7c94('0x32')]=_[_0x7c94('0x47')](db[_0x7c94('0x50')][_0x7c94('0x46')]);_0x2d73ff['query']=_[_0x7c94('0x47')](_0x64ea0d[_0x7c94('0x33')]);_0x2d73ff[_0x7c94('0x34')]=_['intersection'](_0x2d73ff[_0x7c94('0x32')],_0x2d73ff['query']);_0x482765[_0x7c94('0x36')]=_[_0x7c94('0x35')](_0x2d73ff[_0x7c94('0x32')],qs[_0x7c94('0x37')](_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x37')]));_0x482765[_0x7c94('0x36')]=_0x482765[_0x7c94('0x36')][_0x7c94('0x38')]?_0x482765[_0x7c94('0x36')]:_0x2d73ff[_0x7c94('0x32')];_0x482765[_0x7c94('0x3b')]=qs[_0x7c94('0x3c')](_0x64ea0d['query'][_0x7c94('0x3c')]);_0x482765['where']=qs[_0x7c94('0x34')](_[_0x7c94('0x3d')](_0x64ea0d['query'],_0x2d73ff[_0x7c94('0x34')]));if(_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x40')]){_0x482765[_0x7c94('0x3e')]=_['merge'](_0x482765[_0x7c94('0x3e')],{'$or':_[_0x7c94('0x2d')](_0x482765[_0x7c94('0x36')],function(_0x208081){var _0x5743dd={};_0x5743dd[_0x208081]={'$like':'%'+_0x64ea0d['query'][_0x7c94('0x40')]+'%'};return _0x5743dd;})});}_0x482765=_['merge']({},_0x482765,_0x64ea0d[_0x7c94('0x41')]);return _0x5b3425[_0x7c94('0x4e')](_0x482765);}})[_0x7c94('0x26')](function(_0x46fc0f){if(_0x46fc0f){_0x40367e=_0x46fc0f[_0x7c94('0x38')];if(!_0x64ea0d[_0x7c94('0x33')][_0x7c94('0x39')](_0x7c94('0x3a'))){_0x482765[_0x7c94('0x1f')]=qs[_0x7c94('0x1f')](_0x64ea0d['query'][_0x7c94('0x1f')]);_0x482765[_0x7c94('0x21')]=qs[_0x7c94('0x21')](_0x64ea0d[_0x7c94('0x33')]['offset']);}return _0x5b3425[_0x7c94('0x4e')](_0x482765);}})[_0x7c94('0x26')](function(_0x788ef9){if(_0x788ef9){return _0x788ef9?{'count':_0x40367e,'rows':_0x788ef9}:null;}})[_0x7c94('0x26')](respondWithResult(_0x5befaa,null))[_0x7c94('0x44')](handleError(_0x5befaa,null));};exports[_0x7c94('0x51')]=function(_0x538953,_0x1ef20d,_0xe8569a){if(_0x538953['body']['id']){delete _0x538953[_0x7c94('0x4c')]['id'];}return db['ServicenowAccount'][_0x7c94('0x4f')]({'where':{'id':_0x538953['params']['id']}})[_0x7c94('0x26')](handleEntityNotFound(_0x1ef20d,null))['then'](function(_0x45aa2c){if(_0x45aa2c){_0x538953[_0x7c94('0x4c')]['AccountId']=_0x45aa2c['id'];_0x538953[_0x7c94('0x4c')][_0x7c94('0x52')]=integrations[_0x7c94('0x53')](_0x538953[_0x7c94('0x4c')][_0x7c94('0x54')],_0x538953[_0x7c94('0x4c')][_0x7c94('0x30')]);_0x538953[_0x7c94('0x4c')][_0x7c94('0x55')]=integrations[_0x7c94('0x56')](_0x538953[_0x7c94('0x4c')]['channel'],_0x538953[_0x7c94('0x4c')][_0x7c94('0x30')]);return db[_0x7c94('0x50')]['create'](_0x538953[_0x7c94('0x4c')],{'include':[{'model':db[_0x7c94('0x57')],'as':_0x7c94('0x52')},{'model':db[_0x7c94('0x57')],'as':_0x7c94('0x55')}]});}return null;})[_0x7c94('0x26')](respondWithResult(_0x1ef20d,null))[_0x7c94('0x44')](handleError(_0x1ef20d,null));};exports[_0x7c94('0x58')]=function(_0xfcacb1,_0x5ce061,_0x558cf){var _0x483e05=[_0x7c94('0x59'),_0x7c94('0x5a'),_0x7c94('0x5b'),_0x7c94('0x5c'),'close_code',_0x7c94('0x5d'),'incident_state',_0x7c94('0x5e'),_0x7c94('0x5f')];var _0x16ce32=['parent',_0x7c94('0x59'),_0x7c94('0x60'),_0x7c94('0x61'),_0x7c94('0x62'),_0x7c94('0x63'),_0x7c94('0x64'),_0x7c94('0x5a'),_0x7c94('0x65'),'number',_0x7c94('0x66'),_0x7c94('0x67'),_0x7c94('0x68'),_0x7c94('0x69'),_0x7c94('0x6a'),'sys_domain',_0x7c94('0x6b'),_0x7c94('0x6c'),'knowledge','order',_0x7c94('0x6d'),'closed_at',_0x7c94('0x6e'),_0x7c94('0x6f'),'impact',_0x7c94('0x70'),'work_notes_list','business_service',_0x7c94('0x71'),'sys_domain_path',_0x7c94('0x72'),_0x7c94('0x73'),_0x7c94('0x74'),_0x7c94('0x75'),_0x7c94('0x76'),_0x7c94('0x77'),_0x7c94('0x78'),_0x7c94('0x79'),_0x7c94('0x7a'),_0x7c94('0x7b'),_0x7c94('0x7c'),_0x7c94('0x5c'),'work_notes','short_description','close_code',_0x7c94('0x7d'),_0x7c94('0x7e'),_0x7c94('0x7f'),_0x7c94('0x80'),_0x7c94('0x81'),'additional_assignee_list','description',_0x7c94('0x82'),_0x7c94('0x5d'),_0x7c94('0x83'),_0x7c94('0x84'),_0x7c94('0x85'),_0x7c94('0x86'),'parent_incident','sys_id',_0x7c94('0x87'),_0x7c94('0x88'),'incident_state',_0x7c94('0x89'),_0x7c94('0x8a'),_0x7c94('0x8b'),_0x7c94('0x8c'),_0x7c94('0x8d'),_0x7c94('0x8e'),_0x7c94('0x5e'),_0x7c94('0x8f'),_0x7c94('0x90'),_0x7c94('0x91'),_0x7c94('0x92'),_0x7c94('0x93'),_0x7c94('0x94'),'reopen_count',_0x7c94('0x95'),_0x7c94('0x96'),_0x7c94('0x97'),'correlation_id',_0x7c94('0x98'),_0x7c94('0x5f')];var _0x285b9d='';var _0x497ea3='';var _0x67701b=[];var _0x3f85b5='';var _0x422472='';var _0x343b15=[];var _0x473937='';var _0x2212fe='';var _0x46b6d7={};var _0x29c5d3='';return db[_0x7c94('0x2e')][_0x7c94('0x4f')]({'where':{'id':_0xfcacb1[_0x7c94('0x4d')]['id']},'attributes':['id','username','password',_0x7c94('0x99'),_0x7c94('0x9a'),_0x7c94('0x9b')]})[_0x7c94('0x26')](handleEntityNotFound(_0x5ce061,null))[_0x7c94('0x26')](function(_0x4715ee){if(_0x4715ee){_0x29c5d3=_0x4715ee[_0x7c94('0x9a')];var _0x13405c=_0x29c5d3['slice'](-0x1);if(_0x13405c==='/'){_0x29c5d3=_0x29c5d3[_0x7c94('0x9c')](0x0,_0x29c5d3['lastIndexOf'](_0x13405c));}_0x2212fe=util[_0x7c94('0x9d')](_0x7c94('0x9e'),_0x29c5d3);_0x473937=util[_0x7c94('0x9d')](_0x7c94('0x9f'),_0x29c5d3);_0x46b6d7={'user':_0x4715ee[_0x7c94('0xa0')],'pass':_0x4715ee[_0x7c94('0xa1')]};var _0xd43d2e={'method':_0x7c94('0xa2'),'uri':_0x2212fe+_0x7c94('0xa3'),'auth':_0x46b6d7,'json':!![]};return rp(_0xd43d2e);}})[_0x7c94('0x26')](function(_0x12fb77){if(_0x12fb77[_0x7c94('0xa4')][_0x7c94('0x38')]>0x0){_0x285b9d=_0x12fb77['result'];}console[_0x7c94('0xa5')](_0x7c94('0xa6'),_0x285b9d);_0x343b15=[];_0x497ea3=Object[_0x7c94('0xa7')]([],_0x285b9d);_['remove'](_0x497ea3,function(_0x1c6fa0){return!_0x483e05['includes'](_0x1c6fa0['name']);});_0x497ea3[_0x7c94('0xa8')](function(_0x4d1630){var _0xefc3fd=createFieldObject(_0x473937,_0x46b6d7,_0x4d1630[_0x7c94('0xa9')],_0x4d1630[_0x7c94('0x2a')],_0x4d1630[_0x7c94('0xaa')],![]);_0x343b15[_0x7c94('0xab')](_0xefc3fd);});return Promise[_0x7c94('0xac')](_0x343b15);})[_0x7c94('0x26')](function(_0x1ff2fa){_0x67701b=_0x1ff2fa;_0x3f85b5=Object[_0x7c94('0xa7')]([],_0x285b9d);console[_0x7c94('0xa5')]('TCL:\x20_object',_0x285b9d);_['remove'](_0x3f85b5,function(_0x41e1ae){return _0x16ce32[_0x7c94('0xad')](_0x41e1ae[_0x7c94('0x2a')]);});console[_0x7c94('0xa5')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3f85b5);_0x343b15=[];_0x3f85b5['forEach'](function(_0x595199){var _0x7c52cc=createFieldObject(_0x473937,_0x46b6d7,_0x595199[_0x7c94('0xa9')],_0x595199[_0x7c94('0x2a')],_0x595199[_0x7c94('0xaa')],!![]);_0x343b15['push'](_0x7c52cc);});return Promise[_0x7c94('0xac')](_0x343b15);})[_0x7c94('0x26')](function(_0x8f57bc){_0x422472=_0x8f57bc;var _0x272f4a=_0x67701b[_0x7c94('0xae')](_0x422472);return{'count':_0x272f4a[_0x7c94('0x38')],'rows':_0x272f4a};})[_0x7c94('0x26')](respondWithResult(_0x5ce061,null))[_0x7c94('0x44')](function(_0x52bd3f){console[_0x7c94('0xa5')](_0x7c94('0xaf')+_0x52bd3f);var _0x30db88=_0xfcacb1[_0x7c94('0x33')][_0x7c94('0xb0')]?0x1f4:_0x52bd3f[_0x7c94('0xb1')]||0x1f4;logger[_0x7c94('0xb2')](_0x52bd3f[_0x7c94('0xb3')]);delete _0x52bd3f[_0x7c94('0x2a')];if(_0x30db88===0x191){_0x30db88=0x190;}_0x5ce061[_0x7c94('0x1c')](_0x30db88)[_0x7c94('0x2b')](_0xfcacb1[_0x7c94('0x33')][_0x7c94('0xb0')]?{'message':_0x7c94('0xb4'),'statusCode':_0x52bd3f[_0x7c94('0xb1')]}:_0x52bd3f);});};function createFieldObject(_0x25dd1c,_0x4a4704,_0x5ed210,_0x56bceb,_0x486940,_0x573b82){return new Promise(function(_0x2b419f,_0x206757){var _0x4d9cbd={'id':_0x56bceb,'name':_0x486940,'custom':_0x573b82};if(_0x5ed210===_0x7c94('0xb5')){_0x4d9cbd[_0x7c94('0x41')]=[{'name':_0x7c94('0xb6'),'value':_0x7c94('0xb7')},{'name':_0x7c94('0xb8'),'value':_0x7c94('0xb9')}];_0x2b419f(_0x4d9cbd);}else{var _0x5adc2a={'method':_0x7c94('0xa2'),'uri':_0x25dd1c+_0x7c94('0xba')+_0x56bceb,'auth':_0x4a4704,'json':!![]};return rp(_0x5adc2a)[_0x7c94('0x26')](function(_0x4e1685){var _0x1cee23=[];if(_0x4e1685[_0x7c94('0xa4')][_0x7c94('0x38')]>0x0){_0x4e1685[_0x7c94('0xa4')][_0x7c94('0xa8')](function(_0x64d795){if(_0x64d795[_0x7c94('0xbb')]===_0x7c94('0xb9')){var _0x1332ec={'name':_0x64d795[_0x7c94('0xaa')],'value':_0x64d795[_0x7c94('0xbc')]};_0x1cee23[_0x7c94('0xab')](_0x1332ec);}});}_0x4d9cbd[_0x7c94('0x41')]=_0x1cee23;if(_0x4d9cbd[_0x7c94('0x41')][_0x7c94('0x38')]>0x0){_0x2b419f(_0x4d9cbd);}else{if(_0x573b82==![]){_0x2b419f();}else{_0x2b419f(_0x4d9cbd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5d45551..11c3a45 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x5496,0x175));var _0x6549=function(_0xa83a4a,_0x3bd0f5){_0xa83a4a=_0xa83a4a-0x0;var _0x5b612a=_0x5496[_0xa83a4a];return _0x5b612a;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5b223c,_0x13dfdd){var _0x4ff523=function(_0x43c9e9){while(--_0x43c9e9){_0x5b223c['push'](_0x5b223c['shift']());}};_0x4ff523(++_0x13dfdd);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 3005c1a..4c86d8b 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 _0x0f20=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','util','randomstring','ioredis'];(function(_0x52040e,_0x201cc2){var _0xe26c7b=function(_0x5f56d1){while(--_0x5f56d1){_0x52040e['push'](_0x52040e['shift']());}};_0xe26c7b(++_0x201cc2);}(_0x0f20,0x195));var _0x00f2=function(_0x53d981,_0x4960dc){_0x53d981=_0x53d981-0x0;var _0x189761=_0x0f20[_0x53d981];return _0x189761;};'use strict';var _=require('lodash');var util=require(_0x00f2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00f2('0x1'));var fs=require('fs');var Redis=require(_0x00f2('0x2'));var db=require(_0x00f2('0x3'))['db'];var utils=require(_0x00f2('0x4'));var logger=require(_0x00f2('0x5'))('rpc');var config=require(_0x00f2('0x6'));var jayson=require(_0x00f2('0x7'));var client=jayson[_0x00f2('0x8')][_0x00f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4ae7,_0xfd593b,_0x118d62){return new BPromise(function(_0x103f31,_0x2ee8f4){return client[_0x00f2('0xa')](_0x2b4ae7,_0x118d62)[_0x00f2('0xb')](function(_0x1723bc){logger[_0x00f2('0xc')](_0x00f2('0xd'),_0xfd593b,'request\x20sent');logger[_0x00f2('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0xfd593b,_0x00f2('0xf'),JSON[_0x00f2('0x10')](_0x1723bc));if(_0x1723bc[_0x00f2('0x11')]){if(_0x1723bc[_0x00f2('0x11')][_0x00f2('0x12')]===0x1f4){logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x1723bc['error']['message']);return _0x2ee8f4(_0x1723bc['error'][_0x00f2('0x13')]);}logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x1723bc[_0x00f2('0x11')]['message']);return _0x103f31(_0x1723bc[_0x00f2('0x11')][_0x00f2('0x13')]);}else{logger['info'](_0x00f2('0xd'),_0xfd593b,_0x00f2('0xf'));_0x103f31(_0x1723bc[_0x00f2('0x14')]['message']);}})[_0x00f2('0x15')](function(_0x5ac4e8){logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x5ac4e8);_0x2ee8f4(_0x5ac4e8);});});}exports[_0x00f2('0x16')]=function(_0x1e5c97){var _0x39c69f=this;return new Promise(function(_0x36ecbb,_0x4820ad){return db['ServicenowAccount'][_0x00f2('0x17')]({'raw':_0x1e5c97[_0x00f2('0x18')]?_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x19')]===undefined?!![]:![]:!![],'where':_0x1e5c97[_0x00f2('0x18')]?_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x1a')]||null:null,'attributes':_0x1e5c97[_0x00f2('0x18')]?_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x1b')]||null:null,'limit':_0x1e5c97['options']?_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x1c')]||null:null,'include':_0x1e5c97[_0x00f2('0x18')]?_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x1d')]?_[_0x00f2('0x1e')](_0x1e5c97[_0x00f2('0x18')][_0x00f2('0x1d')],function(_0x125724){return{'model':db[_0x125724[_0x00f2('0x1f')]],'as':_0x125724['as'],'attributes':_0x125724['attributes'],'include':_0x125724[_0x00f2('0x1d')]?_['map'](_0x125724[_0x00f2('0x1d')],function(_0x12c913){return{'model':db[_0x12c913['model']],'as':_0x12c913['as'],'attributes':_0x12c913[_0x00f2('0x1b')],'include':_0x12c913['include']?_[_0x00f2('0x1e')](_0x12c913[_0x00f2('0x1d')],function(_0x150680){return{'model':db[_0x150680[_0x00f2('0x1f')]],'as':_0x150680['as'],'attributes':_0x150680['attributes']};}):[]};}):[]};}):[]:[]})[_0x00f2('0xb')](function(_0x355ba6){logger['info'](_0x00f2('0x16'),_0x1e5c97);logger[_0x00f2('0xe')](_0x00f2('0x16'),_0x1e5c97,JSON[_0x00f2('0x10')](_0x355ba6));_0x36ecbb(_0x355ba6);})[_0x00f2('0x15')](function(_0x3ba8d4){logger[_0x00f2('0x11')](_0x00f2('0x16'),_0x3ba8d4['message'],_0x1e5c97);_0x4820ad(_0x39c69f['error'](0x1f4,_0x3ba8d4[_0x00f2('0x13')]));});});};exports[_0x00f2('0x20')]=function(_0x42ce05){var _0xa66f04=this;return new Promise(function(_0x1ea0dd,_0xe5a599){return db[_0x00f2('0x21')]['find']({'raw':_0x42ce05[_0x00f2('0x18')]?_0x42ce05[_0x00f2('0x18')][_0x00f2('0x19')]===undefined?!![]:![]:!![],'where':_0x42ce05['options']?_0x42ce05['options']['where']||null:null,'attributes':_0x42ce05[_0x00f2('0x18')]?_0x42ce05['options'][_0x00f2('0x1b')]||null:null,'include':_0x42ce05[_0x00f2('0x18')]?_0x42ce05['options']['include']?_[_0x00f2('0x1e')](_0x42ce05['options']['include'],function(_0x1cce84){return{'model':db[_0x1cce84[_0x00f2('0x1f')]],'as':_0x1cce84['as'],'attributes':_0x1cce84[_0x00f2('0x1b')],'include':_0x1cce84[_0x00f2('0x1d')]?_[_0x00f2('0x1e')](_0x1cce84[_0x00f2('0x1d')],function(_0x424773){return{'model':db[_0x424773[_0x00f2('0x1f')]],'as':_0x424773['as'],'attributes':_0x424773['attributes'],'include':_0x424773[_0x00f2('0x1d')]?_[_0x00f2('0x1e')](_0x424773[_0x00f2('0x1d')],function(_0x544b21){return{'model':db[_0x544b21[_0x00f2('0x1f')]],'as':_0x544b21['as'],'attributes':_0x544b21['attributes']};}):[]};}):[]};}):[]:[]})[_0x00f2('0xb')](function(_0x38fa9d){logger[_0x00f2('0xc')](_0x00f2('0x20'),_0x42ce05);logger[_0x00f2('0xe')](_0x00f2('0x20'),_0x42ce05,JSON[_0x00f2('0x10')](_0x38fa9d));_0x1ea0dd(_0x38fa9d);})['catch'](function(_0x4d30ee){logger[_0x00f2('0x11')](_0x00f2('0x20'),_0x4d30ee[_0x00f2('0x13')],_0x42ce05);_0xe5a599(_0xa66f04[_0x00f2('0x11')](0x1f4,_0x4d30ee[_0x00f2('0x13')]));});});}; \ No newline at end of file +var _0xf8a6=['request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','GetServicenowAccount','ServicenowAccount','raw','options','attributes','limit','include','map','model','catch','ShowServicenowAccount','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x4b8fd4,_0x3a7e83){var _0x388b2e=function(_0x59af92){while(--_0x59af92){_0x4b8fd4['push'](_0x4b8fd4['shift']());}};_0x388b2e(++_0x3a7e83);}(_0xf8a6,0xbd));var _0x6f8a=function(_0x3911a1,_0x241182){_0x3911a1=_0x3911a1-0x0;var _0x32ecfe=_0xf8a6[_0x3911a1];return _0x32ecfe;};'use strict';var _=require(_0x6f8a('0x0'));var util=require('util');var moment=require(_0x6f8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f8a('0x2'));var fs=require('fs');var Redis=require(_0x6f8a('0x3'));var db=require(_0x6f8a('0x4'))['db'];var utils=require(_0x6f8a('0x5'));var logger=require(_0x6f8a('0x6'))(_0x6f8a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc15d1,_0x9a9204,_0x135a7c){return new BPromise(function(_0x48eab0,_0x12fcde){return client[_0x6f8a('0x9')](_0xbc15d1,_0x135a7c)[_0x6f8a('0xa')](function(_0x1b7293){logger[_0x6f8a('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x9a9204,_0x6f8a('0xc'));logger[_0x6f8a('0xd')](_0x6f8a('0xe'),_0x9a9204,_0x6f8a('0xc'),JSON[_0x6f8a('0xf')](_0x1b7293));if(_0x1b7293[_0x6f8a('0x10')]){if(_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x11')]===0x1f4){logger[_0x6f8a('0x10')](_0x6f8a('0x12'),_0x9a9204,_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x13')]);return _0x12fcde(_0x1b7293[_0x6f8a('0x10')]['message']);}logger[_0x6f8a('0x10')](_0x6f8a('0x12'),_0x9a9204,_0x1b7293[_0x6f8a('0x10')]['message']);return _0x48eab0(_0x1b7293[_0x6f8a('0x10')][_0x6f8a('0x13')]);}else{logger['info'](_0x6f8a('0x12'),_0x9a9204,_0x6f8a('0xc'));_0x48eab0(_0x1b7293['result'][_0x6f8a('0x13')]);}})['catch'](function(_0x5f316c){logger['error'](_0x6f8a('0x12'),_0x9a9204,_0x5f316c);_0x12fcde(_0x5f316c);});});}exports[_0x6f8a('0x14')]=function(_0xb1d198){var _0x5ddfdd=this;return new Promise(function(_0x14adb1,_0x55cc86){return db[_0x6f8a('0x15')]['findAll']({'raw':_0xb1d198['options']?_0xb1d198['options'][_0x6f8a('0x16')]===undefined?!![]:![]:!![],'where':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198[_0x6f8a('0x17')]['where']||null:null,'attributes':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198[_0x6f8a('0x17')][_0x6f8a('0x18')]||null:null,'limit':_0xb1d198[_0x6f8a('0x17')]?_0xb1d198['options'][_0x6f8a('0x19')]||null:null,'include':_0xb1d198['options']?_0xb1d198[_0x6f8a('0x17')][_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0xb1d198['options'][_0x6f8a('0x1a')],function(_0x3a2873){return{'model':db[_0x3a2873[_0x6f8a('0x1c')]],'as':_0x3a2873['as'],'attributes':_0x3a2873['attributes'],'include':_0x3a2873[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x3a2873[_0x6f8a('0x1a')],function(_0x3fbb7e){return{'model':db[_0x3fbb7e[_0x6f8a('0x1c')]],'as':_0x3fbb7e['as'],'attributes':_0x3fbb7e[_0x6f8a('0x18')],'include':_0x3fbb7e[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x3fbb7e[_0x6f8a('0x1a')],function(_0x58bff7){return{'model':db[_0x58bff7[_0x6f8a('0x1c')]],'as':_0x58bff7['as'],'attributes':_0x58bff7[_0x6f8a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f8a('0xa')](function(_0x11d74a){logger[_0x6f8a('0xb')](_0x6f8a('0x14'),_0xb1d198);logger[_0x6f8a('0xd')](_0x6f8a('0x14'),_0xb1d198,JSON[_0x6f8a('0xf')](_0x11d74a));_0x14adb1(_0x11d74a);})[_0x6f8a('0x1d')](function(_0x267128){logger['error']('GetServicenowAccount',_0x267128['message'],_0xb1d198);_0x55cc86(_0x5ddfdd[_0x6f8a('0x10')](0x1f4,_0x267128[_0x6f8a('0x13')]));});});};exports[_0x6f8a('0x1e')]=function(_0x5486ed){var _0x4fa091=this;return new Promise(function(_0x183e3c,_0x1b62ad){return db[_0x6f8a('0x15')][_0x6f8a('0x1f')]({'raw':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x16')]===undefined?!![]:![]:!![],'where':_0x5486ed['options']?_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x20')]||null:null,'attributes':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed[_0x6f8a('0x17')]['attributes']||null:null,'include':_0x5486ed[_0x6f8a('0x17')]?_0x5486ed['options'][_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x5486ed[_0x6f8a('0x17')][_0x6f8a('0x1a')],function(_0xee0f7e){return{'model':db[_0xee0f7e[_0x6f8a('0x1c')]],'as':_0xee0f7e['as'],'attributes':_0xee0f7e['attributes'],'include':_0xee0f7e[_0x6f8a('0x1a')]?_['map'](_0xee0f7e[_0x6f8a('0x1a')],function(_0x1608c2){return{'model':db[_0x1608c2[_0x6f8a('0x1c')]],'as':_0x1608c2['as'],'attributes':_0x1608c2[_0x6f8a('0x18')],'include':_0x1608c2[_0x6f8a('0x1a')]?_[_0x6f8a('0x1b')](_0x1608c2[_0x6f8a('0x1a')],function(_0x4dbbf3){return{'model':db[_0x4dbbf3[_0x6f8a('0x1c')]],'as':_0x4dbbf3['as'],'attributes':_0x4dbbf3[_0x6f8a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6f8a('0xa')](function(_0x457cd6){logger[_0x6f8a('0xb')]('ShowServicenowAccount',_0x5486ed);logger[_0x6f8a('0xd')](_0x6f8a('0x1e'),_0x5486ed,JSON[_0x6f8a('0xf')](_0x457cd6));_0x183e3c(_0x457cd6);})[_0x6f8a('0x1d')](function(_0x54cb8e){logger[_0x6f8a('0x10')]('ShowServicenowAccount',_0x54cb8e['message'],_0x5486ed);_0x1b62ad(_0x4fa091[_0x6f8a('0x10')](0x1f4,_0x54cb8e[_0x6f8a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cce4246..f7d0f3e 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 _0x9d03=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x418281,_0x5712f2){var _0x2d7bc2=function(_0x5a72c6){while(--_0x5a72c6){_0x418281['push'](_0x418281['shift']());}};_0x2d7bc2(++_0x5712f2);}(_0x9d03,0x17a));var _0x39d0=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x9d03[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require('multer');var util=require(_0x39d0('0x0'));var path=require(_0x39d0('0x1'));var timeout=require(_0x39d0('0x2'));var express=require(_0x39d0('0x3'));var router=express[_0x39d0('0x4')]();var fs_extra=require(_0x39d0('0x5'));var auth=require(_0x39d0('0x6'));var interaction=require(_0x39d0('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x39d0('0x8')]('/',auth[_0x39d0('0x9')](),controller[_0x39d0('0xa')]);router['get'](_0x39d0('0xb'),auth[_0x39d0('0x9')](),controller[_0x39d0('0xc')]);router[_0x39d0('0x8')](_0x39d0('0xd'),auth['isAuthenticated'](),controller[_0x39d0('0xe')]);router[_0x39d0('0x8')]('/:id/subjects',auth[_0x39d0('0x9')](),controller[_0x39d0('0xf')]);router[_0x39d0('0x8')](_0x39d0('0x10'),auth['isAuthenticated'](),controller[_0x39d0('0x11')]);router[_0x39d0('0x12')]('/',auth['isAuthenticated'](),controller[_0x39d0('0x13')]);router[_0x39d0('0x14')](_0x39d0('0xb'),auth[_0x39d0('0x9')](),controller[_0x39d0('0x15')]);router[_0x39d0('0x16')]('/:id',auth[_0x39d0('0x9')](),controller[_0x39d0('0x17')]);module[_0x39d0('0x18')]=router; \ No newline at end of file +var _0x022a=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0xdda501,_0x457a7d){var _0x4b548d=function(_0x121071){while(--_0x121071){_0xdda501['push'](_0xdda501['shift']());}};_0x4b548d(++_0x457a7d);}(_0x022a,0x19a));var _0xa022=function(_0x329421,_0xd2822d){_0x329421=_0x329421-0x0;var _0x499643=_0x022a[_0x329421];return _0x499643;};'use strict';var multer=require('multer');var util=require(_0xa022('0x0'));var path=require(_0xa022('0x1'));var timeout=require(_0xa022('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa022('0x3'));var interaction=require(_0xa022('0x4'));var config=require(_0xa022('0x5'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xa022('0x6')](),controller[_0xa022('0x7')]);router[_0xa022('0x8')]('/:id',auth[_0xa022('0x6')](),controller[_0xa022('0x9')]);router[_0xa022('0x8')](_0xa022('0xa'),auth[_0xa022('0x6')](),controller['getFields']);router[_0xa022('0x8')]('/:id/subjects',auth[_0xa022('0x6')](),controller['getSubjects']);router[_0xa022('0x8')](_0xa022('0xb'),auth[_0xa022('0x6')](),controller[_0xa022('0xc')]);router['post']('/',auth[_0xa022('0x6')](),controller['create']);router[_0xa022('0xd')](_0xa022('0xe'),auth[_0xa022('0x6')](),controller[_0xa022('0xf')]);router['delete']('/:id',auth[_0xa022('0x6')](),controller[_0xa022('0x10')]);module[_0xa022('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d4a8e6b..1f489c6 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 _0xab31=['STRING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xab31,0x18e));var _0x1ab3=function(_0x18b509,_0x4b8523){_0x18b509=_0x18b509-0x0;var _0x444b44=_0xab31[_0x18b509];return _0x444b44;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ab3('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c35=['exports','STRING','sequelize'];(function(_0x20d2e1,_0x40b026){var _0x3fa1e7=function(_0x1ba87a){while(--_0x1ba87a){_0x20d2e1['push'](_0x20d2e1['shift']());}};_0x3fa1e7(++_0x40b026);}(_0x6c35,0xe9));var _0x56c3=function(_0x4dd46b,_0x2a6d98){_0x4dd46b=_0x4dd46b-0x0;var _0x174841=_0x6c35[_0x4dd46b];return _0x174841;};'use strict';var Sequelize=require(_0x56c3('0x0'));module[_0x56c3('0x1')]={'name':{'type':Sequelize[_0x56c3('0x2')]},'description':{'type':Sequelize[_0x56c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d2fef86..5f75af0 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 _0x1a56=['catch','show','params','keys','find','create','update','body','getFields','nolimit','getSubjects','ServicenowField','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1a56,0x156));var _0x61a5=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x1a56[_0x1ae31c];return _0x19519d;};'use strict';var emlformat=require(_0x61a5('0x0'));var rimraf=require(_0x61a5('0x1'));var zipdir=require(_0x61a5('0x2'));var jsonpatch=require(_0x61a5('0x3'));var rp=require(_0x61a5('0x4'));var moment=require(_0x61a5('0x5'));var BPromise=require(_0x61a5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x61a5('0x7'));var sox=require(_0x61a5('0x8'));var csv=require(_0x61a5('0x9'));var ejs=require(_0x61a5('0xa'));var fs=require('fs');var fs_extra=require(_0x61a5('0xb'));var _=require('lodash');var squel=require(_0x61a5('0xc'));var crypto=require(_0x61a5('0xd'));var jsforce=require(_0x61a5('0xe'));var deskjs=require(_0x61a5('0xf'));var toCsv=require(_0x61a5('0x9'));var querystring=require(_0x61a5('0x10'));var Papa=require(_0x61a5('0x11'));var Redis=require(_0x61a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x61a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61a5('0x14'));var logger=require(_0x61a5('0x15'))(_0x61a5('0x16'));var utils=require(_0x61a5('0x17'));var config=require(_0x61a5('0x18'));var licenseUtil=require(_0x61a5('0x19'));var db=require(_0x61a5('0x1a'))['db'];function respondWithStatusCode(_0x271785,_0xe8d596){_0xe8d596=_0xe8d596||0xcc;return function(_0x29b17c){if(_0x29b17c){return _0x271785[_0x61a5('0x1b')](_0xe8d596);}return _0x271785[_0x61a5('0x1c')](_0xe8d596)['end']();};}function respondWithResult(_0x4fc000,_0x2ebb00){_0x2ebb00=_0x2ebb00||0xc8;return function(_0x151bb1){if(_0x151bb1){return _0x4fc000[_0x61a5('0x1c')](_0x2ebb00)[_0x61a5('0x1d')](_0x151bb1);}};}function respondWithFilteredResult(_0x2303bf,_0x57f26d){return function(_0x411874){if(_0x411874){var _0x50f8f5=typeof _0x57f26d['offset']==='undefined'&&typeof _0x57f26d[_0x61a5('0x1e')]===_0x61a5('0x1f');var _0x5086f9=_0x411874[_0x61a5('0x20')];var _0x16df22=_0x50f8f5?0x0:_0x57f26d[_0x61a5('0x21')];var _0x2d34bf=_0x50f8f5?_0x411874[_0x61a5('0x20')]:_0x57f26d['offset']+_0x57f26d[_0x61a5('0x1e')];var _0x44f748;if(_0x2d34bf>=_0x5086f9){_0x2d34bf=_0x5086f9;_0x44f748=0xc8;}else{_0x44f748=0xce;}_0x2303bf['status'](_0x44f748);return _0x2303bf['set'](_0x61a5('0x22'),_0x16df22+'-'+_0x2d34bf+'/'+_0x5086f9)[_0x61a5('0x1d')](_0x411874);}return null;};}function patchUpdates(_0x4a2fcf){return function(_0x3f0cae){try{jsonpatch[_0x61a5('0x23')](_0x3f0cae,_0x4a2fcf,!![]);}catch(_0x4ecf5e){return BPromise[_0x61a5('0x24')](_0x4ecf5e);}return _0x3f0cae[_0x61a5('0x25')]();};}function saveUpdates(_0x5a385c,_0x12e5d6){return function(_0x536698){if(_0x536698){return _0x536698['update'](_0x5a385c)['then'](function(_0x289846){return _0x289846;});}return null;};}function removeEntity(_0x568719,_0x315163){return function(_0x381498){if(_0x381498){return _0x381498[_0x61a5('0x26')]()[_0x61a5('0x27')](function(){_0x568719[_0x61a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fa02,_0x463bbe){return function(_0x23eacc){if(!_0x23eacc){_0x40fa02[_0x61a5('0x1b')](0x194);}return _0x23eacc;};}function handleError(_0x22c0a6,_0x1a6c71){_0x1a6c71=_0x1a6c71||0x1f4;return function(_0x332caf){logger[_0x61a5('0x28')](_0x332caf[_0x61a5('0x29')]);if(_0x332caf[_0x61a5('0x2a')]){delete _0x332caf[_0x61a5('0x2a')];}_0x22c0a6['status'](_0x1a6c71)['send'](_0x332caf);};}exports[_0x61a5('0x2b')]=function(_0x30025e,_0x14356c){var _0x5da8b0={},_0x436a92={},_0x4a87c1={'count':0x0,'rows':[]};var _0x453d46=_[_0x61a5('0x2c')](db[_0x61a5('0x2d')][_0x61a5('0x2e')],function(_0x2b8dd8){return{'name':_0x2b8dd8[_0x61a5('0x2f')],'type':_0x2b8dd8['type'][_0x61a5('0x30')]};});_0x436a92[_0x61a5('0x31')]=_['map'](_0x453d46,'name');_0x436a92[_0x61a5('0x32')]=_['keys'](_0x30025e[_0x61a5('0x32')]);_0x436a92['filters']=_[_0x61a5('0x33')](_0x436a92[_0x61a5('0x31')],_0x436a92['query']);_0x5da8b0[_0x61a5('0x34')]=_[_0x61a5('0x33')](_0x436a92[_0x61a5('0x31')],qs[_0x61a5('0x35')](_0x30025e['query']['fields']));_0x5da8b0[_0x61a5('0x34')]=_0x5da8b0[_0x61a5('0x34')][_0x61a5('0x36')]?_0x5da8b0[_0x61a5('0x34')]:_0x436a92[_0x61a5('0x31')];if(!_0x30025e[_0x61a5('0x32')][_0x61a5('0x37')]('nolimit')){_0x5da8b0['limit']=qs['limit'](_0x30025e[_0x61a5('0x32')][_0x61a5('0x1e')]);_0x5da8b0[_0x61a5('0x21')]=qs[_0x61a5('0x21')](_0x30025e['query'][_0x61a5('0x21')]);}_0x5da8b0[_0x61a5('0x38')]=qs['sort'](_0x30025e[_0x61a5('0x32')][_0x61a5('0x39')]);_0x5da8b0[_0x61a5('0x3a')]=qs['filters'](_[_0x61a5('0x3b')](_0x30025e['query'],_0x436a92[_0x61a5('0x3c')]),_0x453d46);if(_0x30025e['query'][_0x61a5('0x3d')]){_0x5da8b0['where']=_['merge'](_0x5da8b0[_0x61a5('0x3a')],{'$or':_[_0x61a5('0x2c')](_0x453d46,function(_0x20fd05){if(_0x20fd05['type']!==_0x61a5('0x3e')){var _0x5b168b={};_0x5b168b[_0x20fd05['name']]={'$like':'%'+_0x30025e[_0x61a5('0x32')][_0x61a5('0x3d')]+'%'};return _0x5b168b;}})});}_0x5da8b0=_[_0x61a5('0x3f')]({},_0x5da8b0,_0x30025e[_0x61a5('0x40')]);var _0x246e95={'where':_0x5da8b0[_0x61a5('0x3a')]};return db[_0x61a5('0x2d')][_0x61a5('0x20')](_0x246e95)['then'](function(_0x11fdcf){_0x4a87c1[_0x61a5('0x20')]=_0x11fdcf;if(_0x30025e[_0x61a5('0x32')]['includeAll']){_0x5da8b0[_0x61a5('0x41')]=[{'all':!![]}];}return db[_0x61a5('0x2d')][_0x61a5('0x42')](_0x5da8b0);})[_0x61a5('0x27')](function(_0x581313){_0x4a87c1[_0x61a5('0x43')]=_0x581313;return _0x4a87c1;})[_0x61a5('0x27')](respondWithFilteredResult(_0x14356c,_0x5da8b0))[_0x61a5('0x44')](handleError(_0x14356c,null));};exports[_0x61a5('0x45')]=function(_0x418a77,_0x402ea5){var _0x49ef11={'raw':![],'where':{'id':_0x418a77[_0x61a5('0x46')]['id']}},_0x1ac73f={};_0x1ac73f[_0x61a5('0x31')]=_[_0x61a5('0x47')](db[_0x61a5('0x2d')][_0x61a5('0x2e')]);_0x1ac73f[_0x61a5('0x32')]=_[_0x61a5('0x47')](_0x418a77['query']);_0x1ac73f[_0x61a5('0x3c')]=_[_0x61a5('0x33')](_0x1ac73f[_0x61a5('0x31')],_0x1ac73f['query']);_0x49ef11[_0x61a5('0x34')]=_['intersection'](_0x1ac73f[_0x61a5('0x31')],qs[_0x61a5('0x35')](_0x418a77[_0x61a5('0x32')][_0x61a5('0x35')]));_0x49ef11[_0x61a5('0x34')]=_0x49ef11[_0x61a5('0x34')][_0x61a5('0x36')]?_0x49ef11[_0x61a5('0x34')]:_0x1ac73f[_0x61a5('0x31')];if(_0x418a77[_0x61a5('0x32')]['includeAll']){_0x49ef11[_0x61a5('0x41')]=[{'all':!![]}];}_0x49ef11=_['merge']({},_0x49ef11,_0x418a77[_0x61a5('0x40')]);return db['ServicenowConfiguration'][_0x61a5('0x48')](_0x49ef11)[_0x61a5('0x27')](handleEntityNotFound(_0x402ea5,null))[_0x61a5('0x27')](respondWithResult(_0x402ea5,null))[_0x61a5('0x44')](handleError(_0x402ea5,null));};exports['create']=function(_0xa943f2,_0x582311){return db[_0x61a5('0x2d')][_0x61a5('0x49')](_0xa943f2['body'],{})[_0x61a5('0x27')](respondWithResult(_0x582311,0xc9))[_0x61a5('0x44')](handleError(_0x582311,null));};exports[_0x61a5('0x4a')]=function(_0x126d64,_0x5c51a4){if(_0x126d64[_0x61a5('0x4b')]['id']){delete _0x126d64[_0x61a5('0x4b')]['id'];}return db[_0x61a5('0x2d')]['find']({'where':{'id':_0x126d64[_0x61a5('0x46')]['id']}})[_0x61a5('0x27')](handleEntityNotFound(_0x5c51a4,null))[_0x61a5('0x27')](saveUpdates(_0x126d64[_0x61a5('0x4b')],null))['then'](respondWithResult(_0x5c51a4,null))[_0x61a5('0x44')](handleError(_0x5c51a4,null));};exports['destroy']=function(_0x212703,_0x35b94f){return db[_0x61a5('0x2d')][_0x61a5('0x48')]({'where':{'id':_0x212703[_0x61a5('0x46')]['id']}})[_0x61a5('0x27')](handleEntityNotFound(_0x35b94f,null))['then'](removeEntity(_0x35b94f,null))[_0x61a5('0x44')](handleError(_0x35b94f,null));};exports[_0x61a5('0x4c')]=function(_0x4ec225,_0x6779a4,_0x404e32){var _0x5c9051={};var _0x3bfb87={};var _0x225bbd;var _0x550fc3;return db[_0x61a5('0x2d')]['findOne']({'where':{'id':_0x4ec225[_0x61a5('0x46')]['id']}})[_0x61a5('0x27')](handleEntityNotFound(_0x6779a4,null))['then'](function(_0x572880){if(_0x572880){_0x225bbd=_0x572880;_0x3bfb87[_0x61a5('0x31')]=_[_0x61a5('0x47')](db['ServicenowField'][_0x61a5('0x2e')]);_0x3bfb87[_0x61a5('0x32')]=_[_0x61a5('0x47')](_0x4ec225[_0x61a5('0x32')]);_0x3bfb87[_0x61a5('0x3c')]=_[_0x61a5('0x33')](_0x3bfb87[_0x61a5('0x31')],_0x3bfb87[_0x61a5('0x32')]);_0x5c9051[_0x61a5('0x34')]=_[_0x61a5('0x33')](_0x3bfb87['model'],qs[_0x61a5('0x35')](_0x4ec225['query']['fields']));_0x5c9051[_0x61a5('0x34')]=_0x5c9051[_0x61a5('0x34')][_0x61a5('0x36')]?_0x5c9051['attributes']:_0x3bfb87[_0x61a5('0x31')];_0x5c9051[_0x61a5('0x38')]=qs[_0x61a5('0x39')](_0x4ec225[_0x61a5('0x32')]['sort']);_0x5c9051[_0x61a5('0x3a')]=qs[_0x61a5('0x3c')](_[_0x61a5('0x3b')](_0x4ec225[_0x61a5('0x32')],_0x3bfb87[_0x61a5('0x3c')]));if(_0x4ec225[_0x61a5('0x32')][_0x61a5('0x3d')]){_0x5c9051[_0x61a5('0x3a')]=_[_0x61a5('0x3f')](_0x5c9051[_0x61a5('0x3a')],{'$or':_[_0x61a5('0x2c')](_0x5c9051[_0x61a5('0x34')],function(_0x5de2ed){var _0x64dc7d={};_0x64dc7d[_0x5de2ed]={'$like':'%'+_0x4ec225[_0x61a5('0x32')][_0x61a5('0x3d')]+'%'};return _0x64dc7d;})});}_0x5c9051=_[_0x61a5('0x3f')]({},_0x5c9051,_0x4ec225[_0x61a5('0x40')]);return _0x225bbd['getFields'](_0x5c9051);}})[_0x61a5('0x27')](function(_0x39ac6d){if(_0x39ac6d){_0x550fc3=_0x39ac6d['length'];if(!_0x4ec225['query']['hasOwnProperty'](_0x61a5('0x4d'))){_0x5c9051['limit']=qs[_0x61a5('0x1e')](_0x4ec225[_0x61a5('0x32')][_0x61a5('0x1e')]);_0x5c9051[_0x61a5('0x21')]=qs[_0x61a5('0x21')](_0x4ec225['query'][_0x61a5('0x21')]);}return _0x225bbd['getFields'](_0x5c9051);}})[_0x61a5('0x27')](function(_0x4b86d2){if(_0x4b86d2){return _0x4b86d2?{'count':_0x550fc3,'rows':_0x4b86d2}:null;}})['then'](respondWithResult(_0x6779a4,null))[_0x61a5('0x44')](handleError(_0x6779a4,null));};exports[_0x61a5('0x4e')]=function(_0xa8dc79,_0x5ca931,_0x228a01){var _0x2d6bfe={};var _0xdce3e8={};var _0x279a08;var _0x5b6ba6;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xa8dc79[_0x61a5('0x46')]['id']}})[_0x61a5('0x27')](handleEntityNotFound(_0x5ca931,null))[_0x61a5('0x27')](function(_0x358c7c){if(_0x358c7c){_0x279a08=_0x358c7c;_0xdce3e8[_0x61a5('0x31')]=_['keys'](db[_0x61a5('0x4f')]['rawAttributes']);_0xdce3e8['query']=_[_0x61a5('0x47')](_0xa8dc79[_0x61a5('0x32')]);_0xdce3e8[_0x61a5('0x3c')]=_[_0x61a5('0x33')](_0xdce3e8[_0x61a5('0x31')],_0xdce3e8[_0x61a5('0x32')]);_0x2d6bfe[_0x61a5('0x34')]=_[_0x61a5('0x33')](_0xdce3e8['model'],qs['fields'](_0xa8dc79['query']['fields']));_0x2d6bfe[_0x61a5('0x34')]=_0x2d6bfe[_0x61a5('0x34')][_0x61a5('0x36')]?_0x2d6bfe[_0x61a5('0x34')]:_0xdce3e8['model'];_0x2d6bfe[_0x61a5('0x38')]=qs['sort'](_0xa8dc79[_0x61a5('0x32')][_0x61a5('0x39')]);_0x2d6bfe['where']=qs[_0x61a5('0x3c')](_[_0x61a5('0x3b')](_0xa8dc79[_0x61a5('0x32')],_0xdce3e8[_0x61a5('0x3c')]));if(_0xa8dc79['query'][_0x61a5('0x3d')]){_0x2d6bfe[_0x61a5('0x3a')]=_[_0x61a5('0x3f')](_0x2d6bfe[_0x61a5('0x3a')],{'$or':_[_0x61a5('0x2c')](_0x2d6bfe['attributes'],function(_0x481a3b){var _0xfd2302={};_0xfd2302[_0x481a3b]={'$like':'%'+_0xa8dc79['query'][_0x61a5('0x3d')]+'%'};return _0xfd2302;})});}_0x2d6bfe=_[_0x61a5('0x3f')]({},_0x2d6bfe,_0xa8dc79[_0x61a5('0x40')]);return _0x279a08[_0x61a5('0x4e')](_0x2d6bfe);}})[_0x61a5('0x27')](function(_0x1e2332){if(_0x1e2332){_0x5b6ba6=_0x1e2332[_0x61a5('0x36')];if(!_0xa8dc79[_0x61a5('0x32')][_0x61a5('0x37')](_0x61a5('0x4d'))){_0x2d6bfe[_0x61a5('0x1e')]=qs['limit'](_0xa8dc79[_0x61a5('0x32')][_0x61a5('0x1e')]);_0x2d6bfe[_0x61a5('0x21')]=qs[_0x61a5('0x21')](_0xa8dc79[_0x61a5('0x32')][_0x61a5('0x21')]);}return _0x279a08[_0x61a5('0x4e')](_0x2d6bfe);}})['then'](function(_0x790f1c){if(_0x790f1c){return _0x790f1c?{'count':_0x5b6ba6,'rows':_0x790f1c}:null;}})[_0x61a5('0x27')](respondWithResult(_0x5ca931,null))[_0x61a5('0x44')](handleError(_0x5ca931,null));};exports[_0x61a5('0x50')]=function(_0x2a319d,_0x225eb5,_0x1e8454){var _0xb5b9ca={};var _0x19e36b={};var _0x3dad13;var _0x4a8c2f;return db[_0x61a5('0x2d')][_0x61a5('0x51')]({'where':{'id':_0x2a319d[_0x61a5('0x46')]['id']}})['then'](handleEntityNotFound(_0x225eb5,null))[_0x61a5('0x27')](function(_0x495fa0){if(_0x495fa0){_0x3dad13=_0x495fa0;_0x19e36b[_0x61a5('0x31')]=_['keys'](db[_0x61a5('0x4f')][_0x61a5('0x2e')]);_0x19e36b[_0x61a5('0x32')]=_[_0x61a5('0x47')](_0x2a319d[_0x61a5('0x32')]);_0x19e36b['filters']=_['intersection'](_0x19e36b[_0x61a5('0x31')],_0x19e36b[_0x61a5('0x32')]);_0xb5b9ca[_0x61a5('0x34')]=_[_0x61a5('0x33')](_0x19e36b[_0x61a5('0x31')],qs[_0x61a5('0x35')](_0x2a319d[_0x61a5('0x32')][_0x61a5('0x35')]));_0xb5b9ca[_0x61a5('0x34')]=_0xb5b9ca['attributes']['length']?_0xb5b9ca['attributes']:_0x19e36b[_0x61a5('0x31')];_0xb5b9ca[_0x61a5('0x38')]=qs[_0x61a5('0x39')](_0x2a319d['query'][_0x61a5('0x39')]);_0xb5b9ca[_0x61a5('0x3a')]=qs[_0x61a5('0x3c')](_[_0x61a5('0x3b')](_0x2a319d['query'],_0x19e36b['filters']));if(_0x2a319d[_0x61a5('0x32')][_0x61a5('0x3d')]){_0xb5b9ca['where']=_['merge'](_0xb5b9ca[_0x61a5('0x3a')],{'$or':_[_0x61a5('0x2c')](_0xb5b9ca[_0x61a5('0x34')],function(_0x3d41ae){var _0x49093b={};_0x49093b[_0x3d41ae]={'$like':'%'+_0x2a319d[_0x61a5('0x32')]['filter']+'%'};return _0x49093b;})});}_0xb5b9ca=_[_0x61a5('0x3f')]({},_0xb5b9ca,_0x2a319d['options']);return _0x3dad13['getDescriptions'](_0xb5b9ca);}})[_0x61a5('0x27')](function(_0x1f4030){if(_0x1f4030){_0x4a8c2f=_0x1f4030[_0x61a5('0x36')];if(!_0x2a319d[_0x61a5('0x32')][_0x61a5('0x37')](_0x61a5('0x4d'))){_0xb5b9ca[_0x61a5('0x1e')]=qs[_0x61a5('0x1e')](_0x2a319d['query']['limit']);_0xb5b9ca[_0x61a5('0x21')]=qs[_0x61a5('0x21')](_0x2a319d['query'][_0x61a5('0x21')]);}return _0x3dad13[_0x61a5('0x50')](_0xb5b9ca);}})[_0x61a5('0x27')](function(_0x1c0069){if(_0x1c0069){return _0x1c0069?{'count':_0x4a8c2f,'rows':_0x1c0069}:null;}})['then'](respondWithResult(_0x225eb5,null))['catch'](handleError(_0x225eb5,null));}; \ No newline at end of file +var _0x2ca2=['reject','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','ServicenowConfiguration','includeAll','findAll','rows','catch','show','rawAttributes','fields','options','find','create','body','update','params','getFields','ServicenowField','order','filter','getSubjects','getDescriptions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x26d4f0,_0x5f20dc){var _0x1b4727=function(_0x4812f6){while(--_0x4812f6){_0x26d4f0['push'](_0x26d4f0['shift']());}};_0x1b4727(++_0x5f20dc);}(_0x2ca2,0xd4));var _0x22ca=function(_0x4fcf59,_0xc5a493){_0x4fcf59=_0x4fcf59-0x0;var _0xfee2a=_0x2ca2[_0x4fcf59];return _0xfee2a;};'use strict';var emlformat=require(_0x22ca('0x0'));var rimraf=require(_0x22ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22ca('0x2'));var rp=require(_0x22ca('0x3'));var moment=require(_0x22ca('0x4'));var BPromise=require(_0x22ca('0x5'));var Mustache=require(_0x22ca('0x6'));var util=require(_0x22ca('0x7'));var path=require(_0x22ca('0x8'));var sox=require(_0x22ca('0x9'));var csv=require(_0x22ca('0xa'));var ejs=require(_0x22ca('0xb'));var fs=require('fs');var fs_extra=require(_0x22ca('0xc'));var _=require('lodash');var squel=require(_0x22ca('0xd'));var crypto=require(_0x22ca('0xe'));var jsforce=require(_0x22ca('0xf'));var deskjs=require(_0x22ca('0x10'));var toCsv=require(_0x22ca('0xa'));var querystring=require(_0x22ca('0x11'));var Papa=require(_0x22ca('0x12'));var Redis=require(_0x22ca('0x13'));var authService=require(_0x22ca('0x14'));var qs=require(_0x22ca('0x15'));var as=require(_0x22ca('0x16'));var hardwareService=require(_0x22ca('0x17'));var logger=require('../../config/logger')(_0x22ca('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x22ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24973e,_0x2f63fe){_0x2f63fe=_0x2f63fe||0xcc;return function(_0x2fe289){if(_0x2fe289){return _0x24973e[_0x22ca('0x1a')](_0x2f63fe);}return _0x24973e[_0x22ca('0x1b')](_0x2f63fe)[_0x22ca('0x1c')]();};}function respondWithResult(_0x142ffe,_0x1b8070){_0x1b8070=_0x1b8070||0xc8;return function(_0x57d1b7){if(_0x57d1b7){return _0x142ffe['status'](_0x1b8070)[_0x22ca('0x1d')](_0x57d1b7);}};}function respondWithFilteredResult(_0x239d0c,_0x4ffcde){return function(_0xace9a7){if(_0xace9a7){var _0x1edf41=typeof _0x4ffcde[_0x22ca('0x1e')]==='undefined'&&typeof _0x4ffcde[_0x22ca('0x1f')]===_0x22ca('0x20');var _0x3fe974=_0xace9a7[_0x22ca('0x21')];var _0x1a71ab=_0x1edf41?0x0:_0x4ffcde[_0x22ca('0x1e')];var _0x36f14d=_0x1edf41?_0xace9a7[_0x22ca('0x21')]:_0x4ffcde['offset']+_0x4ffcde['limit'];var _0x1871df;if(_0x36f14d>=_0x3fe974){_0x36f14d=_0x3fe974;_0x1871df=0xc8;}else{_0x1871df=0xce;}_0x239d0c[_0x22ca('0x1b')](_0x1871df);return _0x239d0c[_0x22ca('0x22')](_0x22ca('0x23'),_0x1a71ab+'-'+_0x36f14d+'/'+_0x3fe974)['json'](_0xace9a7);}return null;};}function patchUpdates(_0x4b00f2){return function(_0x255806){try{jsonpatch[_0x22ca('0x24')](_0x255806,_0x4b00f2,!![]);}catch(_0x3b0e13){return BPromise[_0x22ca('0x25')](_0x3b0e13);}return _0x255806['save']();};}function saveUpdates(_0x563edf,_0x450ece){return function(_0xf76c13){if(_0xf76c13){return _0xf76c13['update'](_0x563edf)[_0x22ca('0x26')](function(_0x33ac6e){return _0x33ac6e;});}return null;};}function removeEntity(_0x188a36,_0x42a636){return function(_0x43e593){if(_0x43e593){return _0x43e593[_0x22ca('0x27')]()['then'](function(){_0x188a36[_0x22ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf040,_0x582e6d){return function(_0x62dc3e){if(!_0x62dc3e){_0x1cf040['sendStatus'](0x194);}return _0x62dc3e;};}function handleError(_0x5f01ec,_0x29bb2b){_0x29bb2b=_0x29bb2b||0x1f4;return function(_0x5d4f03){logger[_0x22ca('0x28')](_0x5d4f03[_0x22ca('0x29')]);if(_0x5d4f03[_0x22ca('0x2a')]){delete _0x5d4f03['name'];}_0x5f01ec[_0x22ca('0x1b')](_0x29bb2b)[_0x22ca('0x2b')](_0x5d4f03);};}exports[_0x22ca('0x2c')]=function(_0x4911de,_0x11a193){var _0x5c84a1={},_0x4ea43b={},_0x1f00d9={'count':0x0,'rows':[]};var _0x327b73=_[_0x22ca('0x2d')](db['ServicenowConfiguration']['rawAttributes'],function(_0x232c85){return{'name':_0x232c85[_0x22ca('0x2e')],'type':_0x232c85[_0x22ca('0x2f')][_0x22ca('0x30')]};});_0x4ea43b[_0x22ca('0x31')]=_[_0x22ca('0x2d')](_0x327b73,'name');_0x4ea43b[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x4911de[_0x22ca('0x32')]);_0x4ea43b[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x4ea43b[_0x22ca('0x31')],_0x4ea43b['query']);_0x5c84a1['attributes']=_['intersection'](_0x4ea43b[_0x22ca('0x31')],qs['fields'](_0x4911de['query']['fields']));_0x5c84a1['attributes']=_0x5c84a1[_0x22ca('0x36')][_0x22ca('0x37')]?_0x5c84a1['attributes']:_0x4ea43b[_0x22ca('0x31')];if(!_0x4911de['query'][_0x22ca('0x38')](_0x22ca('0x39'))){_0x5c84a1[_0x22ca('0x1f')]=qs[_0x22ca('0x1f')](_0x4911de['query'][_0x22ca('0x1f')]);_0x5c84a1[_0x22ca('0x1e')]=qs[_0x22ca('0x1e')](_0x4911de[_0x22ca('0x32')]['offset']);}_0x5c84a1['order']=qs[_0x22ca('0x3a')](_0x4911de[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x5c84a1['where']=qs[_0x22ca('0x34')](_[_0x22ca('0x3b')](_0x4911de[_0x22ca('0x32')],_0x4ea43b[_0x22ca('0x34')]),_0x327b73);if(_0x4911de[_0x22ca('0x32')]['filter']){_0x5c84a1[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x5c84a1['where'],{'$or':_['map'](_0x327b73,function(_0x4c8aeb){if(_0x4c8aeb[_0x22ca('0x2f')]!=='VIRTUAL'){var _0x14cab0={};_0x14cab0[_0x4c8aeb[_0x22ca('0x2a')]]={'$like':'%'+_0x4911de[_0x22ca('0x32')]['filter']+'%'};return _0x14cab0;}})});}_0x5c84a1=_[_0x22ca('0x3d')]({},_0x5c84a1,_0x4911de['options']);var _0x3a43da={'where':_0x5c84a1[_0x22ca('0x3c')]};return db[_0x22ca('0x3e')][_0x22ca('0x21')](_0x3a43da)[_0x22ca('0x26')](function(_0x5d3bd5){_0x1f00d9['count']=_0x5d3bd5;if(_0x4911de[_0x22ca('0x32')][_0x22ca('0x3f')]){_0x5c84a1['include']=[{'all':!![]}];}return db[_0x22ca('0x3e')][_0x22ca('0x40')](_0x5c84a1);})[_0x22ca('0x26')](function(_0x5c1b4b){_0x1f00d9[_0x22ca('0x41')]=_0x5c1b4b;return _0x1f00d9;})[_0x22ca('0x26')](respondWithFilteredResult(_0x11a193,_0x5c84a1))[_0x22ca('0x42')](handleError(_0x11a193,null));};exports[_0x22ca('0x43')]=function(_0x4a210f,_0x49a3a1){var _0x4aa966={'raw':![],'where':{'id':_0x4a210f['params']['id']}},_0x3645a3={};_0x3645a3[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x3e')][_0x22ca('0x44')]);_0x3645a3[_0x22ca('0x32')]=_['keys'](_0x4a210f[_0x22ca('0x32')]);_0x3645a3['filters']=_[_0x22ca('0x35')](_0x3645a3[_0x22ca('0x31')],_0x3645a3[_0x22ca('0x32')]);_0x4aa966[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x3645a3[_0x22ca('0x31')],qs[_0x22ca('0x45')](_0x4a210f[_0x22ca('0x32')][_0x22ca('0x45')]));_0x4aa966[_0x22ca('0x36')]=_0x4aa966[_0x22ca('0x36')][_0x22ca('0x37')]?_0x4aa966[_0x22ca('0x36')]:_0x3645a3[_0x22ca('0x31')];if(_0x4a210f['query']['includeAll']){_0x4aa966['include']=[{'all':!![]}];}_0x4aa966=_[_0x22ca('0x3d')]({},_0x4aa966,_0x4a210f[_0x22ca('0x46')]);return db[_0x22ca('0x3e')][_0x22ca('0x47')](_0x4aa966)[_0x22ca('0x26')](handleEntityNotFound(_0x49a3a1,null))['then'](respondWithResult(_0x49a3a1,null))[_0x22ca('0x42')](handleError(_0x49a3a1,null));};exports[_0x22ca('0x48')]=function(_0x12bcc5,_0x123a1d){return db[_0x22ca('0x3e')][_0x22ca('0x48')](_0x12bcc5[_0x22ca('0x49')],{})[_0x22ca('0x26')](respondWithResult(_0x123a1d,0xc9))[_0x22ca('0x42')](handleError(_0x123a1d,null));};exports[_0x22ca('0x4a')]=function(_0x21d3bd,_0x225094){if(_0x21d3bd[_0x22ca('0x49')]['id']){delete _0x21d3bd[_0x22ca('0x49')]['id'];}return db[_0x22ca('0x3e')][_0x22ca('0x47')]({'where':{'id':_0x21d3bd['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x225094,null))[_0x22ca('0x26')](saveUpdates(_0x21d3bd['body'],null))[_0x22ca('0x26')](respondWithResult(_0x225094,null))[_0x22ca('0x42')](handleError(_0x225094,null));};exports[_0x22ca('0x27')]=function(_0x26e9cf,_0x2473d1){return db['ServicenowConfiguration'][_0x22ca('0x47')]({'where':{'id':_0x26e9cf[_0x22ca('0x4b')]['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x2473d1,null))[_0x22ca('0x26')](removeEntity(_0x2473d1,null))[_0x22ca('0x42')](handleError(_0x2473d1,null));};exports[_0x22ca('0x4c')]=function(_0x183e95,_0x307c0d,_0x1af072){var _0x1b0696={};var _0x76b4e3={};var _0x1256cb;var _0x4a5d57;return db[_0x22ca('0x3e')]['findOne']({'where':{'id':_0x183e95[_0x22ca('0x4b')]['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x307c0d,null))[_0x22ca('0x26')](function(_0x11ffeb){if(_0x11ffeb){_0x1256cb=_0x11ffeb;_0x76b4e3[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x4d')]['rawAttributes']);_0x76b4e3[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x183e95[_0x22ca('0x32')]);_0x76b4e3['filters']=_[_0x22ca('0x35')](_0x76b4e3[_0x22ca('0x31')],_0x76b4e3[_0x22ca('0x32')]);_0x1b0696[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x76b4e3[_0x22ca('0x31')],qs['fields'](_0x183e95[_0x22ca('0x32')][_0x22ca('0x45')]));_0x1b0696['attributes']=_0x1b0696[_0x22ca('0x36')][_0x22ca('0x37')]?_0x1b0696[_0x22ca('0x36')]:_0x76b4e3[_0x22ca('0x31')];_0x1b0696[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x183e95[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x1b0696[_0x22ca('0x3c')]=qs['filters'](_[_0x22ca('0x3b')](_0x183e95[_0x22ca('0x32')],_0x76b4e3[_0x22ca('0x34')]));if(_0x183e95[_0x22ca('0x32')][_0x22ca('0x4f')]){_0x1b0696['where']=_['merge'](_0x1b0696[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x1b0696['attributes'],function(_0x3d0140){var _0x4a1b53={};_0x4a1b53[_0x3d0140]={'$like':'%'+_0x183e95[_0x22ca('0x32')][_0x22ca('0x4f')]+'%'};return _0x4a1b53;})});}_0x1b0696=_['merge']({},_0x1b0696,_0x183e95[_0x22ca('0x46')]);return _0x1256cb[_0x22ca('0x4c')](_0x1b0696);}})[_0x22ca('0x26')](function(_0x584d74){if(_0x584d74){_0x4a5d57=_0x584d74[_0x22ca('0x37')];if(!_0x183e95['query'][_0x22ca('0x38')]('nolimit')){_0x1b0696[_0x22ca('0x1f')]=qs['limit'](_0x183e95[_0x22ca('0x32')][_0x22ca('0x1f')]);_0x1b0696['offset']=qs[_0x22ca('0x1e')](_0x183e95[_0x22ca('0x32')][_0x22ca('0x1e')]);}return _0x1256cb[_0x22ca('0x4c')](_0x1b0696);}})[_0x22ca('0x26')](function(_0x16830d){if(_0x16830d){return _0x16830d?{'count':_0x4a5d57,'rows':_0x16830d}:null;}})[_0x22ca('0x26')](respondWithResult(_0x307c0d,null))['catch'](handleError(_0x307c0d,null));};exports[_0x22ca('0x50')]=function(_0x4cc7b9,_0x108665,_0x1370a7){var _0x4187ac={};var _0x48d9df={};var _0x450487;var _0x291ae8;return db[_0x22ca('0x3e')]['findOne']({'where':{'id':_0x4cc7b9['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x108665,null))[_0x22ca('0x26')](function(_0x3009a1){if(_0x3009a1){_0x450487=_0x3009a1;_0x48d9df[_0x22ca('0x31')]=_[_0x22ca('0x33')](db[_0x22ca('0x4d')][_0x22ca('0x44')]);_0x48d9df[_0x22ca('0x32')]=_[_0x22ca('0x33')](_0x4cc7b9[_0x22ca('0x32')]);_0x48d9df[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x48d9df[_0x22ca('0x31')],_0x48d9df[_0x22ca('0x32')]);_0x4187ac[_0x22ca('0x36')]=_[_0x22ca('0x35')](_0x48d9df[_0x22ca('0x31')],qs['fields'](_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x45')]));_0x4187ac[_0x22ca('0x36')]=_0x4187ac[_0x22ca('0x36')]['length']?_0x4187ac[_0x22ca('0x36')]:_0x48d9df[_0x22ca('0x31')];_0x4187ac[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x3a')]);_0x4187ac[_0x22ca('0x3c')]=qs[_0x22ca('0x34')](_[_0x22ca('0x3b')](_0x4cc7b9[_0x22ca('0x32')],_0x48d9df[_0x22ca('0x34')]));if(_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x4f')]){_0x4187ac[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x4187ac[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x4187ac[_0x22ca('0x36')],function(_0x49f9d3){var _0x426b7f={};_0x426b7f[_0x49f9d3]={'$like':'%'+_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x4f')]+'%'};return _0x426b7f;})});}_0x4187ac=_[_0x22ca('0x3d')]({},_0x4187ac,_0x4cc7b9[_0x22ca('0x46')]);return _0x450487[_0x22ca('0x50')](_0x4187ac);}})['then'](function(_0x18ed41){if(_0x18ed41){_0x291ae8=_0x18ed41['length'];if(!_0x4cc7b9[_0x22ca('0x32')][_0x22ca('0x38')]('nolimit')){_0x4187ac['limit']=qs[_0x22ca('0x1f')](_0x4cc7b9[_0x22ca('0x32')]['limit']);_0x4187ac['offset']=qs[_0x22ca('0x1e')](_0x4cc7b9[_0x22ca('0x32')]['offset']);}return _0x450487[_0x22ca('0x50')](_0x4187ac);}})['then'](function(_0x49379d){if(_0x49379d){return _0x49379d?{'count':_0x291ae8,'rows':_0x49379d}:null;}})[_0x22ca('0x26')](respondWithResult(_0x108665,null))[_0x22ca('0x42')](handleError(_0x108665,null));};exports[_0x22ca('0x51')]=function(_0x394470,_0x29bace,_0x25b4b6){var _0x31a8ae={};var _0x29b2f7={};var _0xa16bc4;var _0x100641;return db[_0x22ca('0x3e')][_0x22ca('0x52')]({'where':{'id':_0x394470['params']['id']}})[_0x22ca('0x26')](handleEntityNotFound(_0x29bace,null))[_0x22ca('0x26')](function(_0x4a7413){if(_0x4a7413){_0xa16bc4=_0x4a7413;_0x29b2f7[_0x22ca('0x31')]=_[_0x22ca('0x33')](db['ServicenowField'][_0x22ca('0x44')]);_0x29b2f7[_0x22ca('0x32')]=_['keys'](_0x394470['query']);_0x29b2f7[_0x22ca('0x34')]=_[_0x22ca('0x35')](_0x29b2f7[_0x22ca('0x31')],_0x29b2f7[_0x22ca('0x32')]);_0x31a8ae['attributes']=_[_0x22ca('0x35')](_0x29b2f7[_0x22ca('0x31')],qs['fields'](_0x394470[_0x22ca('0x32')]['fields']));_0x31a8ae[_0x22ca('0x36')]=_0x31a8ae['attributes']['length']?_0x31a8ae[_0x22ca('0x36')]:_0x29b2f7[_0x22ca('0x31')];_0x31a8ae[_0x22ca('0x4e')]=qs[_0x22ca('0x3a')](_0x394470['query'][_0x22ca('0x3a')]);_0x31a8ae[_0x22ca('0x3c')]=qs['filters'](_[_0x22ca('0x3b')](_0x394470[_0x22ca('0x32')],_0x29b2f7[_0x22ca('0x34')]));if(_0x394470['query'][_0x22ca('0x4f')]){_0x31a8ae[_0x22ca('0x3c')]=_[_0x22ca('0x3d')](_0x31a8ae[_0x22ca('0x3c')],{'$or':_[_0x22ca('0x2d')](_0x31a8ae[_0x22ca('0x36')],function(_0x588f45){var _0x4d7410={};_0x4d7410[_0x588f45]={'$like':'%'+_0x394470[_0x22ca('0x32')]['filter']+'%'};return _0x4d7410;})});}_0x31a8ae=_[_0x22ca('0x3d')]({},_0x31a8ae,_0x394470[_0x22ca('0x46')]);return _0xa16bc4[_0x22ca('0x51')](_0x31a8ae);}})[_0x22ca('0x26')](function(_0x815b27){if(_0x815b27){_0x100641=_0x815b27['length'];if(!_0x394470['query'][_0x22ca('0x38')](_0x22ca('0x39'))){_0x31a8ae['limit']=qs['limit'](_0x394470[_0x22ca('0x32')][_0x22ca('0x1f')]);_0x31a8ae[_0x22ca('0x1e')]=qs[_0x22ca('0x1e')](_0x394470[_0x22ca('0x32')]['offset']);}return _0xa16bc4[_0x22ca('0x51')](_0x31a8ae);}})['then'](function(_0x46625f){if(_0x46625f){return _0x46625f?{'count':_0x100641,'rows':_0x46625f}:null;}})[_0x22ca('0x26')](respondWithResult(_0x29bace,null))['catch'](handleError(_0x29bace,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c55973b..c3c0152 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 _0x6947=['./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x588702,_0x3f6031){var _0x24a257=function(_0x36d157){while(--_0x36d157){_0x588702['push'](_0x588702['shift']());}};_0x24a257(++_0x3f6031);}(_0x6947,0x72));var _0x7694=function(_0x1f55dc,_0x1d456e){_0x1f55dc=_0x1f55dc-0x0;var _0x5af838=_0x6947[_0x1f55dc];return _0x5af838;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x7694('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b72=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4037e8,_0x20cb13){var _0x575f49=function(_0x1da562){while(--_0x1da562){_0x4037e8['push'](_0x4037e8['shift']());}};_0x575f49(++_0x20cb13);}(_0x6b72,0x19d));var _0x26b7=function(_0x487da0,_0x4409be){_0x487da0=_0x487da0-0x0;var _0x31c643=_0x6b72[_0x487da0];return _0x31c643;};'use strict';var _=require(_0x26b7('0x0'));var util=require('util');var logger=require(_0x26b7('0x1'))(_0x26b7('0x2'));var moment=require('moment');var BPromise=require(_0x26b7('0x3'));var rp=require(_0x26b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x26b7('0x5'));var attributes=require(_0x26b7('0x6'));module[_0x26b7('0x7')]=function(_0x5bf038,_0x26ac11){return _0x5bf038[_0x26b7('0x8')](_0x26b7('0x9'),attributes,{'tableName':_0x26b7('0xa'),'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 b3b3e24..af638e3 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 _0x6d29=['then','request\x20sent','debug','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6d29,0xc8));var _0x96d2=function(_0x5aaf95,_0x5e8f9b){_0x5aaf95=_0x5aaf95-0x0;var _0x1eb0c5=_0x6d29[_0x5aaf95];return _0x1eb0c5;};'use strict';var _=require('lodash');var util=require(_0x96d2('0x0'));var moment=require('moment');var BPromise=require(_0x96d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96d2('0x2'))['db'];var utils=require(_0x96d2('0x3'));var logger=require(_0x96d2('0x4'))(_0x96d2('0x5'));var config=require(_0x96d2('0x6'));var jayson=require(_0x96d2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x356498,_0x7742a6,_0x2cb87b){return new BPromise(function(_0xc481f9,_0xb7c6d9){return client[_0x96d2('0x8')](_0x356498,_0x2cb87b)[_0x96d2('0x9')](function(_0x2de29b){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x7742a6,_0x96d2('0xa'));logger[_0x96d2('0xb')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x7742a6,'request\x20sent',JSON['stringify'](_0x2de29b));if(_0x2de29b['error']){if(_0x2de29b[_0x96d2('0xc')][_0x96d2('0xd')]===0x1f4){logger[_0x96d2('0xc')](_0x96d2('0xe'),_0x7742a6,_0x2de29b[_0x96d2('0xc')][_0x96d2('0xf')]);return _0xb7c6d9(_0x2de29b['error'][_0x96d2('0xf')]);}logger[_0x96d2('0xc')](_0x96d2('0xe'),_0x7742a6,_0x2de29b[_0x96d2('0xc')][_0x96d2('0xf')]);return _0xc481f9(_0x2de29b[_0x96d2('0xc')][_0x96d2('0xf')]);}else{logger[_0x96d2('0x10')](_0x96d2('0xe'),_0x7742a6,_0x96d2('0xa'));_0xc481f9(_0x2de29b[_0x96d2('0x11')]['message']);}})[_0x96d2('0x12')](function(_0x2732fa){logger['error'](_0x96d2('0xe'),_0x7742a6,_0x2732fa);_0xb7c6d9(_0x2732fa);});});} \ No newline at end of file +var _0x6797=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x7de12b,_0x2ae0f8){var _0x114781=function(_0x32e5c7){while(--_0x32e5c7){_0x7de12b['push'](_0x7de12b['shift']());}};_0x114781(++_0x2ae0f8);}(_0x6797,0x94));var _0x7679=function(_0x3f0116,_0x1de9d7){_0x3f0116=_0x3f0116-0x0;var _0x1de4f9=_0x6797[_0x3f0116];return _0x1de4f9;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var moment=require(_0x7679('0x2'));var BPromise=require(_0x7679('0x3'));var rs=require(_0x7679('0x4'));var fs=require('fs');var Redis=require(_0x7679('0x5'));var db=require(_0x7679('0x6'))['db'];var utils=require(_0x7679('0x7'));var logger=require(_0x7679('0x8'))('rpc');var config=require(_0x7679('0x9'));var jayson=require(_0x7679('0xa'));var client=jayson['client'][_0x7679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5326a8,_0x17cd0b,_0xa34325){return new BPromise(function(_0x423561,_0x52150b){return client[_0x7679('0xc')](_0x5326a8,_0xa34325)[_0x7679('0xd')](function(_0x47151a){logger[_0x7679('0xe')](_0x7679('0xf'),_0x17cd0b,_0x7679('0x10'));logger[_0x7679('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x17cd0b,_0x7679('0x10'),JSON[_0x7679('0x12')](_0x47151a));if(_0x47151a[_0x7679('0x13')]){if(_0x47151a[_0x7679('0x13')][_0x7679('0x14')]===0x1f4){logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x47151a[_0x7679('0x13')]['message']);return _0x52150b(_0x47151a[_0x7679('0x13')][_0x7679('0x15')]);}logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x47151a['error'][_0x7679('0x15')]);return _0x423561(_0x47151a[_0x7679('0x13')]['message']);}else{logger[_0x7679('0xe')](_0x7679('0xf'),_0x17cd0b,_0x7679('0x10'));_0x423561(_0x47151a[_0x7679('0x16')][_0x7679('0x15')]);}})[_0x7679('0x17')](function(_0x16eba5){logger[_0x7679('0x13')](_0x7679('0xf'),_0x17cd0b,_0x16eba5);_0x52150b(_0x16eba5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c33ab3d..0b370fa 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 _0x4c26=['update','delete','destroy','exports','multer','util','path','Router','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x7df216,_0x604206){var _0x260f2b=function(_0x10589a){while(--_0x10589a){_0x7df216['push'](_0x7df216['shift']());}};_0x260f2b(++_0x604206);}(_0x4c26,0x64));var _0x64c2=function(_0x29f3f6,_0x3f3e83){_0x29f3f6=_0x29f3f6-0x0;var _0x5ee73d=_0x4c26[_0x29f3f6];return _0x5ee73d;};'use strict';var multer=require(_0x64c2('0x0'));var util=require(_0x64c2('0x1'));var path=require(_0x64c2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64c2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x64c2('0x4'));var controller=require(_0x64c2('0x5'));router[_0x64c2('0x6')]('/',auth[_0x64c2('0x7')](),controller[_0x64c2('0x8')]);router[_0x64c2('0x6')]('/:id',auth[_0x64c2('0x7')](),controller[_0x64c2('0x9')]);router[_0x64c2('0xa')]('/',auth[_0x64c2('0x7')](),controller[_0x64c2('0xb')]);router['put']('/:id',auth[_0x64c2('0x7')](),controller[_0x64c2('0xc')]);router[_0x64c2('0xd')]('/:id',auth[_0x64c2('0x7')](),controller[_0x64c2('0xe')]);module[_0x64c2('0xf')]=router; \ No newline at end of file +var _0x1866=['./intServicenowField.controller','index','get','/:id','isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x7bf12b,_0x236b77){var _0x5f0627=function(_0x4b0dd4){while(--_0x4b0dd4){_0x7bf12b['push'](_0x7bf12b['shift']());}};_0x5f0627(++_0x236b77);}(_0x1866,0xd6));var _0x6186=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1866[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x6186('0x0'));var util=require('util');var path=require(_0x6186('0x1'));var timeout=require(_0x6186('0x2'));var express=require(_0x6186('0x3'));var router=express[_0x6186('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6186('0x5'));var interaction=require(_0x6186('0x6'));var config=require('../../config/environment');var controller=require(_0x6186('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6186('0x8')]);router[_0x6186('0x9')](_0x6186('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6186('0xb')](),controller[_0x6186('0xc')]);router[_0x6186('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6186('0xe')]);router['delete'](_0x6186('0xa'),auth[_0x6186('0xb')](),controller[_0x6186('0xf')]);module[_0x6186('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 45bd7cb..315be45 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 _0xb1da=['BOOLEAN','sequelize','exports','string','keyValue','STRING','ENUM'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xb1da,0xe8));var _0xab1d=function(_0x184ff,_0x39ac1e){_0x184ff=_0x184ff-0x0;var _0x31533f=_0xb1da[_0x184ff];return _0x31533f;};'use strict';var Sequelize=require(_0xab1d('0x0'));module[_0xab1d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xab1d('0x2'),'variable','customVariable',_0xab1d('0x3'),'picklist'),'defaultValue':_0xab1d('0x2')},'content':{'type':Sequelize[_0xab1d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xab1d('0x5')](_0xab1d('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xab1d('0x4')]},'idField':{'type':Sequelize[_0xab1d('0x4')]},'nameField':{'type':Sequelize[_0xab1d('0x4')]},'customField':{'type':Sequelize[_0xab1d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab1d('0x4')]}}; \ No newline at end of file +var _0x947b=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x12e3d2,_0x77a0e0){var _0x2e632c=function(_0x52d273){while(--_0x52d273){_0x12e3d2['push'](_0x12e3d2['shift']());}};_0x2e632c(++_0x77a0e0);}(_0x947b,0x15b));var _0xb947=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x947b[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xb947('0x0'));module[_0xb947('0x1')]={'type':{'type':Sequelize[_0xb947('0x2')]('string',_0xb947('0x3'),_0xb947('0x4'),_0xb947('0x5'),_0xb947('0x6')),'defaultValue':_0xb947('0x7')},'content':{'type':Sequelize[_0xb947('0x8')]},'key':{'type':Sequelize[_0xb947('0x8')]},'keyType':{'type':Sequelize[_0xb947('0x2')](_0xb947('0x7'),'variable',_0xb947('0x4'))},'keyContent':{'type':Sequelize[_0xb947('0x8')]},'idField':{'type':Sequelize[_0xb947('0x8')]},'nameField':{'type':Sequelize[_0xb947('0x8')]},'customField':{'type':Sequelize[_0xb947('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb947('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ead61ca..597db0a 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 _0x5ddd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','sendStatus','stack','name','index','map','ServicenowField','rawAttributes','type','key','keys','filters','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','intersection','length','create','update','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3ca35f,_0x2b9ce9){var _0x179d47=function(_0x24c655){while(--_0x24c655){_0x3ca35f['push'](_0x3ca35f['shift']());}};_0x179d47(++_0x2b9ce9);}(_0x5ddd,0xce));var _0xd5dd=function(_0xb25c71,_0x184611){_0xb25c71=_0xb25c71-0x0;var _0x4ad3a4=_0x5ddd[_0xb25c71];return _0x4ad3a4;};'use strict';var emlformat=require(_0xd5dd('0x0'));var rimraf=require(_0xd5dd('0x1'));var zipdir=require(_0xd5dd('0x2'));var jsonpatch=require(_0xd5dd('0x3'));var rp=require(_0xd5dd('0x4'));var moment=require(_0xd5dd('0x5'));var BPromise=require(_0xd5dd('0x6'));var Mustache=require(_0xd5dd('0x7'));var util=require(_0xd5dd('0x8'));var path=require(_0xd5dd('0x9'));var sox=require(_0xd5dd('0xa'));var csv=require(_0xd5dd('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5dd('0xc'));var _=require(_0xd5dd('0xd'));var squel=require(_0xd5dd('0xe'));var crypto=require('crypto');var jsforce=require(_0xd5dd('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd5dd('0x10'));var Papa=require(_0xd5dd('0x11'));var Redis=require(_0xd5dd('0x12'));var authService=require(_0xd5dd('0x13'));var qs=require(_0xd5dd('0x14'));var as=require(_0xd5dd('0x15'));var hardwareService=require(_0xd5dd('0x16'));var logger=require(_0xd5dd('0x17'))(_0xd5dd('0x18'));var utils=require(_0xd5dd('0x19'));var config=require(_0xd5dd('0x1a'));var licenseUtil=require(_0xd5dd('0x1b'));var db=require(_0xd5dd('0x1c'))['db'];function respondWithStatusCode(_0x5605de,_0x3f33f9){_0x3f33f9=_0x3f33f9||0xcc;return function(_0x25b68d){if(_0x25b68d){return _0x5605de['sendStatus'](_0x3f33f9);}return _0x5605de[_0xd5dd('0x1d')](_0x3f33f9)[_0xd5dd('0x1e')]();};}function respondWithResult(_0x27e9de,_0x4d1b6a){_0x4d1b6a=_0x4d1b6a||0xc8;return function(_0x13c43e){if(_0x13c43e){return _0x27e9de[_0xd5dd('0x1d')](_0x4d1b6a)[_0xd5dd('0x1f')](_0x13c43e);}};}function respondWithFilteredResult(_0x3cd763,_0x93d51e){return function(_0x3d1c19){if(_0x3d1c19){var _0x1f668b=typeof _0x93d51e[_0xd5dd('0x20')]===_0xd5dd('0x21')&&typeof _0x93d51e[_0xd5dd('0x22')]==='undefined';var _0x512a31=_0x3d1c19[_0xd5dd('0x23')];var _0x303fe2=_0x1f668b?0x0:_0x93d51e[_0xd5dd('0x20')];var _0x25c2cd=_0x1f668b?_0x3d1c19[_0xd5dd('0x23')]:_0x93d51e[_0xd5dd('0x20')]+_0x93d51e[_0xd5dd('0x22')];var _0x22fee0;if(_0x25c2cd>=_0x512a31){_0x25c2cd=_0x512a31;_0x22fee0=0xc8;}else{_0x22fee0=0xce;}_0x3cd763['status'](_0x22fee0);return _0x3cd763[_0xd5dd('0x24')]('Content-Range',_0x303fe2+'-'+_0x25c2cd+'/'+_0x512a31)[_0xd5dd('0x1f')](_0x3d1c19);}return null;};}function patchUpdates(_0x10669d){return function(_0x466a12){try{jsonpatch[_0xd5dd('0x25')](_0x466a12,_0x10669d,!![]);}catch(_0x98ca04){return BPromise[_0xd5dd('0x26')](_0x98ca04);}return _0x466a12['save']();};}function saveUpdates(_0x297af3,_0x306665){return function(_0x27f93c){if(_0x27f93c){return _0x27f93c['update'](_0x297af3)[_0xd5dd('0x27')](function(_0x1a06cd){return _0x1a06cd;});}return null;};}function removeEntity(_0x51dfac,_0x18d2a0){return function(_0x38ba32){if(_0x38ba32){return _0x38ba32[_0xd5dd('0x28')]()['then'](function(){_0x51dfac[_0xd5dd('0x1d')](0xcc)[_0xd5dd('0x1e')]();});}};}function handleEntityNotFound(_0x40a079,_0x2f6549){return function(_0x5b28cf){if(!_0x5b28cf){_0x40a079[_0xd5dd('0x29')](0x194);}return _0x5b28cf;};}function handleError(_0x4a279c,_0x1e4b59){_0x1e4b59=_0x1e4b59||0x1f4;return function(_0x3f15ac){logger['error'](_0x3f15ac[_0xd5dd('0x2a')]);if(_0x3f15ac[_0xd5dd('0x2b')]){delete _0x3f15ac[_0xd5dd('0x2b')];}_0x4a279c[_0xd5dd('0x1d')](_0x1e4b59)['send'](_0x3f15ac);};}exports[_0xd5dd('0x2c')]=function(_0x14a183,_0x213102){var _0x545144={},_0x1f19a0={},_0x9ee1b1={'count':0x0,'rows':[]};var _0x28f876=_[_0xd5dd('0x2d')](db[_0xd5dd('0x2e')][_0xd5dd('0x2f')],function(_0x57c3fc){return{'name':_0x57c3fc['fieldName'],'type':_0x57c3fc[_0xd5dd('0x30')][_0xd5dd('0x31')]};});_0x1f19a0['model']=_['map'](_0x28f876,_0xd5dd('0x2b'));_0x1f19a0['query']=_[_0xd5dd('0x32')](_0x14a183['query']);_0x1f19a0[_0xd5dd('0x33')]=_['intersection'](_0x1f19a0[_0xd5dd('0x34')],_0x1f19a0[_0xd5dd('0x35')]);_0x545144[_0xd5dd('0x36')]=_['intersection'](_0x1f19a0[_0xd5dd('0x34')],qs[_0xd5dd('0x37')](_0x14a183['query'][_0xd5dd('0x37')]));_0x545144['attributes']=_0x545144[_0xd5dd('0x36')]['length']?_0x545144['attributes']:_0x1f19a0[_0xd5dd('0x34')];if(!_0x14a183[_0xd5dd('0x35')][_0xd5dd('0x38')](_0xd5dd('0x39'))){_0x545144[_0xd5dd('0x22')]=qs[_0xd5dd('0x22')](_0x14a183[_0xd5dd('0x35')][_0xd5dd('0x22')]);_0x545144[_0xd5dd('0x20')]=qs[_0xd5dd('0x20')](_0x14a183[_0xd5dd('0x35')]['offset']);}_0x545144[_0xd5dd('0x3a')]=qs[_0xd5dd('0x3b')](_0x14a183[_0xd5dd('0x35')][_0xd5dd('0x3b')]);_0x545144[_0xd5dd('0x3c')]=qs[_0xd5dd('0x33')](_['pick'](_0x14a183[_0xd5dd('0x35')],_0x1f19a0[_0xd5dd('0x33')]),_0x28f876);if(_0x14a183['query'][_0xd5dd('0x3d')]){_0x545144[_0xd5dd('0x3c')]=_[_0xd5dd('0x3e')](_0x545144[_0xd5dd('0x3c')],{'$or':_[_0xd5dd('0x2d')](_0x28f876,function(_0x4af141){if(_0x4af141[_0xd5dd('0x30')]!=='VIRTUAL'){var _0x42c4f5={};_0x42c4f5[_0x4af141[_0xd5dd('0x2b')]]={'$like':'%'+_0x14a183['query'][_0xd5dd('0x3d')]+'%'};return _0x42c4f5;}})});}_0x545144=_[_0xd5dd('0x3e')]({},_0x545144,_0x14a183[_0xd5dd('0x3f')]);var _0x2c57ff={'where':_0x545144[_0xd5dd('0x3c')]};return db[_0xd5dd('0x2e')][_0xd5dd('0x23')](_0x2c57ff)['then'](function(_0x425e00){_0x9ee1b1[_0xd5dd('0x23')]=_0x425e00;if(_0x14a183['query'][_0xd5dd('0x40')]){_0x545144[_0xd5dd('0x41')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x545144);})['then'](function(_0x2ca8e3){_0x9ee1b1[_0xd5dd('0x42')]=_0x2ca8e3;return _0x9ee1b1;})['then'](respondWithFilteredResult(_0x213102,_0x545144))[_0xd5dd('0x43')](handleError(_0x213102,null));};exports[_0xd5dd('0x44')]=function(_0x2f605c,_0x8d39dd){var _0x251231={'raw':!![],'where':{'id':_0x2f605c['params']['id']}},_0x15f491={};_0x15f491[_0xd5dd('0x34')]=_[_0xd5dd('0x32')](db[_0xd5dd('0x2e')][_0xd5dd('0x2f')]);_0x15f491[_0xd5dd('0x35')]=_[_0xd5dd('0x32')](_0x2f605c[_0xd5dd('0x35')]);_0x15f491[_0xd5dd('0x33')]=_[_0xd5dd('0x45')](_0x15f491[_0xd5dd('0x34')],_0x15f491[_0xd5dd('0x35')]);_0x251231['attributes']=_[_0xd5dd('0x45')](_0x15f491['model'],qs[_0xd5dd('0x37')](_0x2f605c['query'][_0xd5dd('0x37')]));_0x251231[_0xd5dd('0x36')]=_0x251231[_0xd5dd('0x36')][_0xd5dd('0x46')]?_0x251231['attributes']:_0x15f491[_0xd5dd('0x34')];if(_0x2f605c[_0xd5dd('0x35')][_0xd5dd('0x40')]){_0x251231['include']=[{'all':!![]}];}_0x251231=_[_0xd5dd('0x3e')]({},_0x251231,_0x2f605c[_0xd5dd('0x3f')]);return db['ServicenowField']['find'](_0x251231)[_0xd5dd('0x27')](handleEntityNotFound(_0x8d39dd,null))[_0xd5dd('0x27')](respondWithResult(_0x8d39dd,null))[_0xd5dd('0x43')](handleError(_0x8d39dd,null));};exports[_0xd5dd('0x47')]=function(_0x5f31e3,_0x5419ab){return db[_0xd5dd('0x2e')][_0xd5dd('0x47')](_0x5f31e3['body'],{})[_0xd5dd('0x27')](respondWithResult(_0x5419ab,0xc9))['catch'](handleError(_0x5419ab,null));};exports[_0xd5dd('0x48')]=function(_0x2c5f4e,_0x190b26){if(_0x2c5f4e[_0xd5dd('0x49')]['id']){delete _0x2c5f4e[_0xd5dd('0x49')]['id'];}return db[_0xd5dd('0x2e')][_0xd5dd('0x4a')]({'where':{'id':_0x2c5f4e[_0xd5dd('0x4b')]['id']}})[_0xd5dd('0x27')](handleEntityNotFound(_0x190b26,null))['then'](saveUpdates(_0x2c5f4e[_0xd5dd('0x49')],null))[_0xd5dd('0x27')](respondWithResult(_0x190b26,null))[_0xd5dd('0x43')](handleError(_0x190b26,null));};exports[_0xd5dd('0x28')]=function(_0x2f449c,_0x484310){return db[_0xd5dd('0x2e')][_0xd5dd('0x4a')]({'where':{'id':_0x2f449c[_0xd5dd('0x4b')]['id']}})[_0xd5dd('0x27')](handleEntityNotFound(_0x484310,null))[_0xd5dd('0x27')](removeEntity(_0x484310,null))[_0xd5dd('0x43')](handleError(_0x484310,null));}; \ No newline at end of file +var _0xfa37=['index','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xfa37,0x180));var _0x7fa3=function(_0xfa8f85,_0x3e0c34){_0xfa8f85=_0xfa8f85-0x0;var _0x150225=_0xfa37[_0xfa8f85];return _0x150225;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fa3('0x0'));var zipdir=require(_0x7fa3('0x1'));var jsonpatch=require(_0x7fa3('0x2'));var rp=require(_0x7fa3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fa3('0x4'));var util=require(_0x7fa3('0x5'));var path=require(_0x7fa3('0x6'));var sox=require('sox');var csv=require(_0x7fa3('0x7'));var ejs=require(_0x7fa3('0x8'));var fs=require('fs');var fs_extra=require(_0x7fa3('0x9'));var _=require(_0x7fa3('0xa'));var squel=require(_0x7fa3('0xb'));var crypto=require(_0x7fa3('0xc'));var jsforce=require(_0x7fa3('0xd'));var deskjs=require(_0x7fa3('0xe'));var toCsv=require(_0x7fa3('0x7'));var querystring=require(_0x7fa3('0xf'));var Papa=require(_0x7fa3('0x10'));var Redis=require(_0x7fa3('0x11'));var authService=require(_0x7fa3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fa3('0x13'));var hardwareService=require(_0x7fa3('0x14'));var logger=require(_0x7fa3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x7fa3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fa3('0x17'))['db'];function respondWithStatusCode(_0x397973,_0x386a17){_0x386a17=_0x386a17||0xcc;return function(_0x219c44){if(_0x219c44){return _0x397973[_0x7fa3('0x18')](_0x386a17);}return _0x397973[_0x7fa3('0x19')](_0x386a17)[_0x7fa3('0x1a')]();};}function respondWithResult(_0x1cf2fb,_0x33a72a){_0x33a72a=_0x33a72a||0xc8;return function(_0x5e7b9f){if(_0x5e7b9f){return _0x1cf2fb[_0x7fa3('0x19')](_0x33a72a)['json'](_0x5e7b9f);}};}function respondWithFilteredResult(_0x29763d,_0x54d6da){return function(_0x443368){if(_0x443368){var _0x388a9b=typeof _0x54d6da[_0x7fa3('0x1b')]==='undefined'&&typeof _0x54d6da[_0x7fa3('0x1c')]===_0x7fa3('0x1d');var _0x4a1aa4=_0x443368[_0x7fa3('0x1e')];var _0x46e7d1=_0x388a9b?0x0:_0x54d6da[_0x7fa3('0x1b')];var _0x52240c=_0x388a9b?_0x443368[_0x7fa3('0x1e')]:_0x54d6da[_0x7fa3('0x1b')]+_0x54d6da[_0x7fa3('0x1c')];var _0x279a72;if(_0x52240c>=_0x4a1aa4){_0x52240c=_0x4a1aa4;_0x279a72=0xc8;}else{_0x279a72=0xce;}_0x29763d['status'](_0x279a72);return _0x29763d[_0x7fa3('0x1f')](_0x7fa3('0x20'),_0x46e7d1+'-'+_0x52240c+'/'+_0x4a1aa4)[_0x7fa3('0x21')](_0x443368);}return null;};}function patchUpdates(_0x4266f1){return function(_0x7d4ad8){try{jsonpatch[_0x7fa3('0x22')](_0x7d4ad8,_0x4266f1,!![]);}catch(_0xfff90a){return BPromise['reject'](_0xfff90a);}return _0x7d4ad8[_0x7fa3('0x23')]();};}function saveUpdates(_0xdaec0f,_0x47443e){return function(_0x3f7866){if(_0x3f7866){return _0x3f7866[_0x7fa3('0x24')](_0xdaec0f)[_0x7fa3('0x25')](function(_0x19346d){return _0x19346d;});}return null;};}function removeEntity(_0x3f33b4,_0x17dafb){return function(_0x2ae299){if(_0x2ae299){return _0x2ae299[_0x7fa3('0x26')]()[_0x7fa3('0x25')](function(){_0x3f33b4[_0x7fa3('0x19')](0xcc)[_0x7fa3('0x1a')]();});}};}function handleEntityNotFound(_0x556979,_0x3b5430){return function(_0x55627d){if(!_0x55627d){_0x556979[_0x7fa3('0x18')](0x194);}return _0x55627d;};}function handleError(_0x192270,_0x31072a){_0x31072a=_0x31072a||0x1f4;return function(_0x4c76f8){logger[_0x7fa3('0x27')](_0x4c76f8['stack']);if(_0x4c76f8[_0x7fa3('0x28')]){delete _0x4c76f8[_0x7fa3('0x28')];}_0x192270[_0x7fa3('0x19')](_0x31072a)[_0x7fa3('0x29')](_0x4c76f8);};}exports[_0x7fa3('0x2a')]=function(_0x2ed744,_0x1598cb){var _0x1ebf6a={},_0x16d659={},_0x2222c6={'count':0x0,'rows':[]};var _0x3b9ecb=_['map'](db[_0x7fa3('0x2b')][_0x7fa3('0x2c')],function(_0x14a61d){return{'name':_0x14a61d[_0x7fa3('0x2d')],'type':_0x14a61d[_0x7fa3('0x2e')][_0x7fa3('0x2f')]};});_0x16d659[_0x7fa3('0x30')]=_[_0x7fa3('0x31')](_0x3b9ecb,_0x7fa3('0x28'));_0x16d659[_0x7fa3('0x32')]=_[_0x7fa3('0x33')](_0x2ed744[_0x7fa3('0x32')]);_0x16d659[_0x7fa3('0x34')]=_['intersection'](_0x16d659[_0x7fa3('0x30')],_0x16d659[_0x7fa3('0x32')]);_0x1ebf6a[_0x7fa3('0x35')]=_['intersection'](_0x16d659[_0x7fa3('0x30')],qs['fields'](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x36')]));_0x1ebf6a['attributes']=_0x1ebf6a[_0x7fa3('0x35')][_0x7fa3('0x37')]?_0x1ebf6a[_0x7fa3('0x35')]:_0x16d659[_0x7fa3('0x30')];if(!_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x38')](_0x7fa3('0x39'))){_0x1ebf6a['limit']=qs[_0x7fa3('0x1c')](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x1c')]);_0x1ebf6a[_0x7fa3('0x1b')]=qs['offset'](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x1b')]);}_0x1ebf6a['order']=qs[_0x7fa3('0x3a')](_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3a')]);_0x1ebf6a[_0x7fa3('0x3b')]=qs[_0x7fa3('0x34')](_['pick'](_0x2ed744[_0x7fa3('0x32')],_0x16d659[_0x7fa3('0x34')]),_0x3b9ecb);if(_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3c')]){_0x1ebf6a[_0x7fa3('0x3b')]=_['merge'](_0x1ebf6a[_0x7fa3('0x3b')],{'$or':_[_0x7fa3('0x31')](_0x3b9ecb,function(_0x3549a8){if(_0x3549a8[_0x7fa3('0x2e')]!=='VIRTUAL'){var _0x5e8116={};_0x5e8116[_0x3549a8[_0x7fa3('0x28')]]={'$like':'%'+_0x2ed744[_0x7fa3('0x32')][_0x7fa3('0x3c')]+'%'};return _0x5e8116;}})});}_0x1ebf6a=_[_0x7fa3('0x3d')]({},_0x1ebf6a,_0x2ed744[_0x7fa3('0x3e')]);var _0x32e680={'where':_0x1ebf6a[_0x7fa3('0x3b')]};return db[_0x7fa3('0x2b')][_0x7fa3('0x1e')](_0x32e680)[_0x7fa3('0x25')](function(_0x20fdb1){_0x2222c6['count']=_0x20fdb1;if(_0x2ed744['query'][_0x7fa3('0x3f')]){_0x1ebf6a[_0x7fa3('0x40')]=[{'all':!![]}];}return db[_0x7fa3('0x2b')]['findAll'](_0x1ebf6a);})[_0x7fa3('0x25')](function(_0x4b747a){_0x2222c6['rows']=_0x4b747a;return _0x2222c6;})[_0x7fa3('0x25')](respondWithFilteredResult(_0x1598cb,_0x1ebf6a))[_0x7fa3('0x41')](handleError(_0x1598cb,null));};exports[_0x7fa3('0x42')]=function(_0x21903b,_0x289498){var _0xac7f48={'raw':!![],'where':{'id':_0x21903b[_0x7fa3('0x43')]['id']}},_0x22742d={};_0x22742d[_0x7fa3('0x30')]=_[_0x7fa3('0x33')](db[_0x7fa3('0x2b')][_0x7fa3('0x2c')]);_0x22742d[_0x7fa3('0x32')]=_[_0x7fa3('0x33')](_0x21903b[_0x7fa3('0x32')]);_0x22742d[_0x7fa3('0x34')]=_['intersection'](_0x22742d[_0x7fa3('0x30')],_0x22742d[_0x7fa3('0x32')]);_0xac7f48[_0x7fa3('0x35')]=_['intersection'](_0x22742d[_0x7fa3('0x30')],qs['fields'](_0x21903b[_0x7fa3('0x32')][_0x7fa3('0x36')]));_0xac7f48[_0x7fa3('0x35')]=_0xac7f48[_0x7fa3('0x35')]['length']?_0xac7f48[_0x7fa3('0x35')]:_0x22742d['model'];if(_0x21903b[_0x7fa3('0x32')][_0x7fa3('0x3f')]){_0xac7f48[_0x7fa3('0x40')]=[{'all':!![]}];}_0xac7f48=_[_0x7fa3('0x3d')]({},_0xac7f48,_0x21903b['options']);return db[_0x7fa3('0x2b')][_0x7fa3('0x44')](_0xac7f48)[_0x7fa3('0x25')](handleEntityNotFound(_0x289498,null))[_0x7fa3('0x25')](respondWithResult(_0x289498,null))[_0x7fa3('0x41')](handleError(_0x289498,null));};exports[_0x7fa3('0x45')]=function(_0x366ffa,_0x5e0de3){return db['ServicenowField'][_0x7fa3('0x45')](_0x366ffa[_0x7fa3('0x46')],{})[_0x7fa3('0x25')](respondWithResult(_0x5e0de3,0xc9))['catch'](handleError(_0x5e0de3,null));};exports[_0x7fa3('0x24')]=function(_0x351fc5,_0x4b88c0){if(_0x351fc5['body']['id']){delete _0x351fc5[_0x7fa3('0x46')]['id'];}return db[_0x7fa3('0x2b')][_0x7fa3('0x44')]({'where':{'id':_0x351fc5[_0x7fa3('0x43')]['id']}})[_0x7fa3('0x25')](handleEntityNotFound(_0x4b88c0,null))[_0x7fa3('0x25')](saveUpdates(_0x351fc5[_0x7fa3('0x46')],null))[_0x7fa3('0x25')](respondWithResult(_0x4b88c0,null))[_0x7fa3('0x41')](handleError(_0x4b88c0,null));};exports[_0x7fa3('0x26')]=function(_0x1fefe4,_0x5a5896){return db[_0x7fa3('0x2b')][_0x7fa3('0x44')]({'where':{'id':_0x1fefe4['params']['id']}})[_0x7fa3('0x25')](handleEntityNotFound(_0x5a5896,null))[_0x7fa3('0x25')](removeEntity(_0x5a5896,null))[_0x7fa3('0x41')](handleError(_0x5a5896,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 073bb97..6ca8dee 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 _0x3543=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','idField','FieldId','lodash','util'];(function(_0x2ea805,_0xbde437){var _0x3475ac=function(_0x531b3f){while(--_0x531b3f){_0x2ea805['push'](_0x2ea805['shift']());}};_0x3475ac(++_0xbde437);}(_0x3543,0x108));var _0x3354=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x3543[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x3354('0x0'));var util=require(_0x3354('0x1'));var logger=require(_0x3354('0x2'))(_0x3354('0x3'));var moment=require(_0x3354('0x4'));var BPromise=require(_0x3354('0x5'));var rp=require(_0x3354('0x6'));var fs=require('fs');var path=require(_0x3354('0x7'));var rimraf=require(_0x3354('0x8'));var config=require('../../config/environment');var attributes=require(_0x3354('0x9'));module[_0x3354('0xa')]=function(_0x181338,_0x351576){return _0x181338['define'](_0x3354('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x3354('0xc'),_0x3354('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x638d=['define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x12f76b,_0x100a40){var _0x12b749=function(_0x345d43){while(--_0x345d43){_0x12f76b['push'](_0x12f76b['shift']());}};_0x12b749(++_0x100a40);}(_0x638d,0x19b));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd638('0x0'));var util=require('util');var logger=require(_0xd638('0x1'))(_0xd638('0x2'));var moment=require('moment');var BPromise=require(_0xd638('0x3'));var rp=require(_0xd638('0x4'));var fs=require('fs');var path=require(_0xd638('0x5'));var rimraf=require(_0xd638('0x6'));var config=require('../../config/environment');var attributes=require(_0xd638('0x7'));module[_0xd638('0x8')]=function(_0x47a9ee,_0x3e8616){return _0x47a9ee[_0xd638('0x9')](_0xd638('0xa'),attributes,{'tableName':_0xd638('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd638('0xc'),_0xd638('0xd')],'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 a5ae993..3b86f02 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac4a,0x13f));var _0xaac4=function(_0x19157a,_0x9eeedf){_0x19157a=_0x19157a-0x0;var _0x3b74d6=_0xac4a[_0x19157a];return _0x3b74d6;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1c1577,_0x1d4d6d){var _0x566d1f=function(_0x81f351){while(--_0x81f351){_0x1c1577['push'](_0x1c1577['shift']());}};_0x566d1f(++_0x1d4d6d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fe24e35..41734a2 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x490ecb,_0x5872a9){var _0x508de4=function(_0x59c3b4){while(--_0x59c3b4){_0x490ecb['push'](_0x490ecb['shift']());}};_0x508de4(++_0x5872a9);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1122b0,_0x3259ce){var _0x4dc9c9=function(_0x477a3e){while(--_0x477a3e){_0x1122b0['push'](_0x1122b0['shift']());}};_0x4dc9c9(++_0x3259ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5ef4d77..d325cc3 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 _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x309067,_0x45a0a8){var _0x441240=function(_0x257ef1){while(--_0x257ef1){_0x309067['push'](_0x309067['shift']());}};_0x441240(++_0x45a0a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4738ea,_0x5acfed){var _0x350b48=function(_0x5d79c8){while(--_0x5d79c8){_0x4738ea['push'](_0x4738ea['shift']());}};_0x350b48(++_0x5acfed);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 7bb8baa..8312049 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 _0x8911=['SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','login','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','format','%s%s','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','label','endsWith','value','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','destroy','then','stack','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x8911,0x115));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1891('0x0'));var rimraf=require(_0x1891('0x1'));var zipdir=require(_0x1891('0x2'));var jsonpatch=require(_0x1891('0x3'));var rp=require('request-promise');var moment=require(_0x1891('0x4'));var BPromise=require(_0x1891('0x5'));var Mustache=require(_0x1891('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1891('0x7'));var csv=require(_0x1891('0x8'));var ejs=require(_0x1891('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1891('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1891('0xb'));var toCsv=require(_0x1891('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1891('0xc'));var authService=require(_0x1891('0xd'));var qs=require(_0x1891('0xe'));var as=require(_0x1891('0xf'));var hardwareService=require(_0x1891('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1891('0x11'));var config=require(_0x1891('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1891('0x13'))['db'];var integrations=require(_0x1891('0x14'));function respondWithStatusCode(_0x3795ca,_0x5efc73){_0x5efc73=_0x5efc73||0xcc;return function(_0x4f9539){if(_0x4f9539){return _0x3795ca[_0x1891('0x15')](_0x5efc73);}return _0x3795ca[_0x1891('0x16')](_0x5efc73)[_0x1891('0x17')]();};}function respondWithResult(_0x142bf1,_0x3ac3f1){_0x3ac3f1=_0x3ac3f1||0xc8;return function(_0x4eef07){if(_0x4eef07){return _0x142bf1['status'](_0x3ac3f1)[_0x1891('0x18')](_0x4eef07);}};}function respondWithFilteredResult(_0x26e165,_0x3abfb9){return function(_0x251847){if(_0x251847){var _0x353473=typeof _0x3abfb9['offset']===_0x1891('0x19')&&typeof _0x3abfb9['limit']===_0x1891('0x19');var _0x3c443c=_0x251847[_0x1891('0x1a')];var _0x4d8b81=_0x353473?0x0:_0x3abfb9[_0x1891('0x1b')];var _0x3163ae=_0x353473?_0x251847['count']:_0x3abfb9['offset']+_0x3abfb9['limit'];var _0x1d5ac5;if(_0x3163ae>=_0x3c443c){_0x3163ae=_0x3c443c;_0x1d5ac5=0xc8;}else{_0x1d5ac5=0xce;}_0x26e165['status'](_0x1d5ac5);return _0x26e165[_0x1891('0x1c')]('Content-Range',_0x4d8b81+'-'+_0x3163ae+'/'+_0x3c443c)[_0x1891('0x18')](_0x251847);}return null;};}function patchUpdates(_0x2287a0){return function(_0x50e6a2){try{jsonpatch[_0x1891('0x1d')](_0x50e6a2,_0x2287a0,!![]);}catch(_0x1cbbdd){return BPromise[_0x1891('0x1e')](_0x1cbbdd);}return _0x50e6a2[_0x1891('0x1f')]();};}function saveUpdates(_0x2a6675,_0x4d3ee9){return function(_0x13ff95){if(_0x13ff95){return _0x13ff95[_0x1891('0x20')](_0x2a6675)['then'](function(_0x56cd78){return _0x56cd78;});}return null;};}function removeEntity(_0x195849,_0x4f884b){return function(_0x5d1551){if(_0x5d1551){return _0x5d1551[_0x1891('0x21')]()[_0x1891('0x22')](function(){_0x195849[_0x1891('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d977,_0x559c40){return function(_0xec377b){if(!_0xec377b){_0x56d977[_0x1891('0x15')](0x194);}return _0xec377b;};}function handleError(_0x20aaed,_0x404125){_0x404125=_0x404125||0x1f4;return function(_0x5f39a2){logger['error'](_0x5f39a2[_0x1891('0x23')]);if(_0x5f39a2['name']){delete _0x5f39a2['name'];}_0x20aaed['status'](_0x404125)[_0x1891('0x24')](_0x5f39a2);};}exports[_0x1891('0x25')]=function(_0x77a666,_0x1b5b99){var _0x563532={},_0x1e893a={},_0x39265d={'count':0x0,'rows':[]};var _0x375c0f=_['map'](db[_0x1891('0x26')][_0x1891('0x27')],function(_0x5544f7){return{'name':_0x5544f7[_0x1891('0x28')],'type':_0x5544f7[_0x1891('0x29')][_0x1891('0x2a')]};});_0x1e893a['model']=_[_0x1891('0x2b')](_0x375c0f,_0x1891('0x2c'));_0x1e893a[_0x1891('0x2d')]=_[_0x1891('0x2e')](_0x77a666['query']);_0x1e893a[_0x1891('0x2f')]=_['intersection'](_0x1e893a[_0x1891('0x30')],_0x1e893a[_0x1891('0x2d')]);_0x563532[_0x1891('0x31')]=_[_0x1891('0x32')](_0x1e893a[_0x1891('0x30')],qs[_0x1891('0x33')](_0x77a666[_0x1891('0x2d')][_0x1891('0x33')]));_0x563532[_0x1891('0x31')]=_0x563532[_0x1891('0x31')][_0x1891('0x34')]?_0x563532[_0x1891('0x31')]:_0x1e893a[_0x1891('0x30')];if(!_0x77a666[_0x1891('0x2d')][_0x1891('0x35')]('nolimit')){_0x563532['limit']=qs[_0x1891('0x36')](_0x77a666[_0x1891('0x2d')][_0x1891('0x36')]);_0x563532['offset']=qs[_0x1891('0x1b')](_0x77a666[_0x1891('0x2d')][_0x1891('0x1b')]);}_0x563532[_0x1891('0x37')]=qs[_0x1891('0x38')](_0x77a666['query']['sort']);_0x563532[_0x1891('0x39')]=qs['filters'](_[_0x1891('0x3a')](_0x77a666[_0x1891('0x2d')],_0x1e893a['filters']),_0x375c0f);if(_0x77a666[_0x1891('0x2d')][_0x1891('0x3b')]){_0x563532[_0x1891('0x39')]=_[_0x1891('0x3c')](_0x563532[_0x1891('0x39')],{'$or':_[_0x1891('0x2b')](_0x375c0f,function(_0x13389d){if(_0x13389d['type']!=='VIRTUAL'){var _0x25d8c3={};_0x25d8c3[_0x13389d['name']]={'$like':'%'+_0x77a666[_0x1891('0x2d')][_0x1891('0x3b')]+'%'};return _0x25d8c3;}})});}_0x563532=_[_0x1891('0x3c')]({},_0x563532,_0x77a666[_0x1891('0x3d')]);var _0x3eaf3f={'where':_0x563532[_0x1891('0x39')]};return db[_0x1891('0x26')][_0x1891('0x1a')](_0x3eaf3f)[_0x1891('0x22')](function(_0xfbd3e4){_0x39265d[_0x1891('0x1a')]=_0xfbd3e4;if(_0x77a666[_0x1891('0x2d')][_0x1891('0x3e')]){_0x563532[_0x1891('0x3f')]=[{'all':!![]}];}return db[_0x1891('0x26')][_0x1891('0x40')](_0x563532);})[_0x1891('0x22')](function(_0x1c9f4d){_0x39265d[_0x1891('0x41')]=_0x1c9f4d;return _0x39265d;})[_0x1891('0x22')](respondWithFilteredResult(_0x1b5b99,_0x563532))[_0x1891('0x42')](handleError(_0x1b5b99,null));};exports['show']=function(_0x5cd8f1,_0x33cd4a){var _0x49d0c5={'raw':![],'where':{'id':_0x5cd8f1[_0x1891('0x43')]['id']}},_0x6daef2={};_0x6daef2[_0x1891('0x30')]=_[_0x1891('0x2e')](db[_0x1891('0x26')][_0x1891('0x27')]);_0x6daef2[_0x1891('0x2d')]=_[_0x1891('0x2e')](_0x5cd8f1['query']);_0x6daef2['filters']=_[_0x1891('0x32')](_0x6daef2['model'],_0x6daef2['query']);_0x49d0c5[_0x1891('0x31')]=_[_0x1891('0x32')](_0x6daef2['model'],qs[_0x1891('0x33')](_0x5cd8f1[_0x1891('0x2d')]['fields']));_0x49d0c5[_0x1891('0x31')]=_0x49d0c5['attributes'][_0x1891('0x34')]?_0x49d0c5[_0x1891('0x31')]:_0x6daef2[_0x1891('0x30')];if(_0x5cd8f1['query']['includeAll']){_0x49d0c5[_0x1891('0x3f')]=[{'all':!![]}];}_0x49d0c5=_[_0x1891('0x3c')]({},_0x49d0c5,_0x5cd8f1[_0x1891('0x3d')]);return db[_0x1891('0x26')][_0x1891('0x44')](_0x49d0c5)[_0x1891('0x22')](handleEntityNotFound(_0x33cd4a,null))[_0x1891('0x22')](respondWithResult(_0x33cd4a,null))['catch'](handleError(_0x33cd4a,null));};exports['create']=function(_0x1e61ff,_0x3e2467){return db[_0x1891('0x26')][_0x1891('0x45')](_0x1e61ff[_0x1891('0x46')],{})[_0x1891('0x22')](respondWithResult(_0x3e2467,0xc9))[_0x1891('0x42')](handleError(_0x3e2467,null));};exports[_0x1891('0x20')]=function(_0x1f5644,_0x14b8fc){if(_0x1f5644[_0x1891('0x46')]['id']){delete _0x1f5644[_0x1891('0x46')]['id'];}return db['SugarcrmAccount'][_0x1891('0x44')]({'where':{'id':_0x1f5644['params']['id']}})[_0x1891('0x22')](handleEntityNotFound(_0x14b8fc,null))[_0x1891('0x22')](saveUpdates(_0x1f5644['body'],null))['then'](respondWithResult(_0x14b8fc,null))[_0x1891('0x42')](handleError(_0x14b8fc,null));};exports['destroy']=function(_0x126a3c,_0xd6a98e){return db[_0x1891('0x26')][_0x1891('0x44')]({'where':{'id':_0x126a3c['params']['id']}})[_0x1891('0x22')](handleEntityNotFound(_0xd6a98e,null))[_0x1891('0x22')](removeEntity(_0xd6a98e,null))['catch'](handleError(_0xd6a98e,null));};exports[_0x1891('0x47')]=function(_0x13da6e,_0x3278c4,_0x1243e5){var _0x50cf0f={};var _0x5468e4={};var _0x120faf;var _0x4b8fcc;return db[_0x1891('0x26')][_0x1891('0x48')]({'where':{'id':_0x13da6e[_0x1891('0x43')]['id']}})[_0x1891('0x22')](handleEntityNotFound(_0x3278c4,null))['then'](function(_0x173d27){if(_0x173d27){_0x120faf=_0x173d27;_0x5468e4[_0x1891('0x30')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x5468e4['query']=_[_0x1891('0x2e')](_0x13da6e[_0x1891('0x2d')]);_0x5468e4[_0x1891('0x2f')]=_[_0x1891('0x32')](_0x5468e4[_0x1891('0x30')],_0x5468e4[_0x1891('0x2d')]);_0x50cf0f[_0x1891('0x31')]=_['intersection'](_0x5468e4['model'],qs[_0x1891('0x33')](_0x13da6e[_0x1891('0x2d')][_0x1891('0x33')]));_0x50cf0f['attributes']=_0x50cf0f['attributes']['length']?_0x50cf0f[_0x1891('0x31')]:_0x5468e4['model'];_0x50cf0f[_0x1891('0x37')]=qs[_0x1891('0x38')](_0x13da6e['query'][_0x1891('0x38')]);_0x50cf0f[_0x1891('0x39')]=qs[_0x1891('0x2f')](_['pick'](_0x13da6e[_0x1891('0x2d')],_0x5468e4[_0x1891('0x2f')]));if(_0x13da6e[_0x1891('0x2d')]['filter']){_0x50cf0f[_0x1891('0x39')]=_[_0x1891('0x3c')](_0x50cf0f[_0x1891('0x39')],{'$or':_[_0x1891('0x2b')](_0x50cf0f[_0x1891('0x31')],function(_0x108a6b){var _0x27872b={};_0x27872b[_0x108a6b]={'$like':'%'+_0x13da6e['query'][_0x1891('0x3b')]+'%'};return _0x27872b;})});}_0x50cf0f=_[_0x1891('0x3c')]({},_0x50cf0f,_0x13da6e[_0x1891('0x3d')]);return _0x120faf[_0x1891('0x47')](_0x50cf0f);}})['then'](function(_0x1f268c){if(_0x1f268c){_0x4b8fcc=_0x1f268c[_0x1891('0x34')];if(!_0x13da6e[_0x1891('0x2d')]['hasOwnProperty'](_0x1891('0x49'))){_0x50cf0f[_0x1891('0x36')]=qs[_0x1891('0x36')](_0x13da6e[_0x1891('0x2d')][_0x1891('0x36')]);_0x50cf0f[_0x1891('0x1b')]=qs[_0x1891('0x1b')](_0x13da6e[_0x1891('0x2d')]['offset']);}return _0x120faf[_0x1891('0x47')](_0x50cf0f);}})[_0x1891('0x22')](function(_0x583c7e){if(_0x583c7e){return _0x583c7e?{'count':_0x4b8fcc,'rows':_0x583c7e}:null;}})[_0x1891('0x22')](respondWithResult(_0x3278c4,null))[_0x1891('0x42')](handleError(_0x3278c4,null));};exports[_0x1891('0x4a')]=function(_0x11f59c,_0x303927,_0xe3a9bb){if(_0x11f59c[_0x1891('0x46')]['id']){delete _0x11f59c[_0x1891('0x46')]['id'];}return db[_0x1891('0x26')][_0x1891('0x48')]({'where':{'id':_0x11f59c[_0x1891('0x43')]['id']}})[_0x1891('0x22')](handleEntityNotFound(_0x303927,null))[_0x1891('0x22')](function(_0x3a3bd8){if(_0x3a3bd8){_0x11f59c[_0x1891('0x46')][_0x1891('0x4b')]=_0x3a3bd8['id'];_0x11f59c[_0x1891('0x46')][_0x1891('0x4c')]=integrations[_0x1891('0x4d')](_0x11f59c['body'][_0x1891('0x4e')],_0x11f59c['body'][_0x1891('0x29')]);_0x11f59c['body']['Descriptions']=integrations[_0x1891('0x4f')](_0x11f59c[_0x1891('0x46')][_0x1891('0x4e')],_0x11f59c[_0x1891('0x46')][_0x1891('0x29')]);return db[_0x1891('0x50')][_0x1891('0x45')](_0x11f59c['body'],{'include':[{'model':db[_0x1891('0x51')],'as':_0x1891('0x4c')},{'model':db['SugarcrmField'],'as':_0x1891('0x52')}]});}return null;})[_0x1891('0x22')](respondWithResult(_0x303927,null))[_0x1891('0x42')](handleError(_0x303927,null));};exports[_0x1891('0x53')]=function(_0x1e452c,_0x47f858,_0x381e2a){var _0xe4a3ab='';var _0x5a2b7a=['id',_0x1891('0x2c'),_0x1891('0x54'),'created_by',_0x1891('0x55'),_0x1891('0x56'),_0x1891('0x57'),_0x1891('0x58'),_0x1891('0x59'),_0x1891('0x5a'),_0x1891('0x5b'),'direction'];return db[_0x1891('0x26')]['findOne']({'where':{'id':_0x1e452c[_0x1891('0x43')]['id']},'attributes':['id','username',_0x1891('0x5c'),'remoteUri']})[_0x1891('0x22')](handleEntityNotFound(_0x47f858,null))[_0x1891('0x22')](function(_0x47ed68){if(_0x47ed68){_0xe4a3ab=_0x47ed68[_0x1891('0x5d')];var _0x248056=_0xe4a3ab[_0x1891('0x5e')](-0x1);if(_0x248056==='/'){_0xe4a3ab=_0xe4a3ab[_0x1891('0x5f')](0x0,_0xe4a3ab[_0x1891('0x60')](_0x248056));}return rp({'method':_0x1891('0x61'),'uri':util['format']('%s%s',_0xe4a3ab,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1891('0x62'),'input_type':_0x1891('0x63'),'response_type':'JSON','rest_data':JSON[_0x1891('0x64')]({'user_auth':{'user_name':_0x47ed68[_0x1891('0x65')],'password':_0x47ed68[_0x1891('0x5c')],'encryption':_0x1891('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1891('0x22')](function(_0x2cd4fc){if(_0x2cd4fc&&_0x2cd4fc[_0x1891('0x2c')]!==_0x1891('0x67')&&_0x2cd4fc[_0x1891('0x2c')]!==_0x1891('0x68')){return rp({'method':_0x1891('0x61'),'uri':util[_0x1891('0x69')](_0x1891('0x6a'),_0xe4a3ab,_0x1891('0x6b')),'json':!![],'form':{'method':_0x1891('0x6c'),'input_type':'JSON','response_type':_0x1891('0x63'),'rest_data':JSON[_0x1891('0x64')]({'session':_0x2cd4fc['id'],'module_name':'Calls'})}})[_0x1891('0x22')](function(_0x4efe90){if(_0x4efe90){var _0x2baeab=_[_0x1891('0x6d')](_0x4efe90[_0x1891('0x6e')]);_[_0x1891('0x6f')](_0x2baeab,function(_0x4fe933){return _0x5a2b7a['includes'](_0x4fe933[_0x1891('0x2c')]);});return{'count':_0x2baeab[_0x1891('0x34')],'rows':_[_0x1891('0x2b')](_0x2baeab,function(_0xce4c95){return{'id':_0xce4c95[_0x1891('0x2c')],'name':_0xce4c95[_0x1891('0x70')],'custom':_[_0x1891('0x71')](_0xce4c95['name'],'_c')?!![]:![],'options':_0xce4c95[_0x1891('0x3d')]?_[_0x1891('0x2b')](_[_0x1891('0x6d')](_0xce4c95[_0x1891('0x3d')]),function(_0x2c27ea){return{'name':_0x2c27ea[_0x1891('0x72')],'value':_0x2c27ea[_0x1891('0x2c')]};}):[]};})};}})[_0x1891('0x22')](respondWithResult(_0x47f858,null))[_0x1891('0x42')](function(_0x2c86e5){var _0x38d6a4=_0x1e452c['query'][_0x1891('0x73')]?0x1f4:_0x2c86e5[_0x1891('0x74')]||0x1f4;logger[_0x1891('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0x1891('0x53'),_0x38d6a4,JSON['stringify'](_0x2c86e5));delete _0x2c86e5[_0x1891('0x2c')];if(_0x38d6a4===0x191){_0x38d6a4=0x190;}_0x47f858[_0x1891('0x16')](_0x38d6a4)[_0x1891('0x24')](_0x1e452c[_0x1891('0x2d')]['test']?{'message':_0x1891('0x76'),'statusCode':_0x2c86e5[_0x1891('0x74')]}:_0x2c86e5);});}else{var _0x1cfffe=0x1f4;_0x47f858[_0x1891('0x16')](_0x1cfffe)[_0x1891('0x24')]({'message':_0x1891('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9a62=['index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','options','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x9a62,0x1bc));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d78fa,_0x7acc03){_0x7acc03=_0x7acc03||0xcc;return function(_0x5e2abb){if(_0x5e2abb){return _0x1d78fa[_0x29a6('0x16')](_0x7acc03);}return _0x1d78fa[_0x29a6('0x17')](_0x7acc03)['end']();};}function respondWithResult(_0x50c663,_0x36d6fd){_0x36d6fd=_0x36d6fd||0xc8;return function(_0x186afa){if(_0x186afa){return _0x50c663['status'](_0x36d6fd)[_0x29a6('0x18')](_0x186afa);}};}function respondWithFilteredResult(_0x22378a,_0x307dd9){return function(_0x4fef5c){if(_0x4fef5c){var _0x862659=typeof _0x307dd9[_0x29a6('0x19')]===_0x29a6('0x1a')&&typeof _0x307dd9[_0x29a6('0x1b')]===_0x29a6('0x1a');var _0x340d75=_0x4fef5c[_0x29a6('0x1c')];var _0x34b66e=_0x862659?0x0:_0x307dd9['offset'];var _0x196882=_0x862659?_0x4fef5c['count']:_0x307dd9[_0x29a6('0x19')]+_0x307dd9[_0x29a6('0x1b')];var _0xdc0ff6;if(_0x196882>=_0x340d75){_0x196882=_0x340d75;_0xdc0ff6=0xc8;}else{_0xdc0ff6=0xce;}_0x22378a['status'](_0xdc0ff6);return _0x22378a[_0x29a6('0x1d')]('Content-Range',_0x34b66e+'-'+_0x196882+'/'+_0x340d75)['json'](_0x4fef5c);}return null;};}function patchUpdates(_0x5a8d55){return function(_0x152b00){try{jsonpatch[_0x29a6('0x1e')](_0x152b00,_0x5a8d55,!![]);}catch(_0x2065be){return BPromise[_0x29a6('0x1f')](_0x2065be);}return _0x152b00[_0x29a6('0x20')]();};}function saveUpdates(_0x552bc7,_0x13341e){return function(_0xae08a5){if(_0xae08a5){return _0xae08a5[_0x29a6('0x21')](_0x552bc7)[_0x29a6('0x22')](function(_0x46fcc7){return _0x46fcc7;});}return null;};}function removeEntity(_0x2dc6c0,_0xedfa4){return function(_0x51761e){if(_0x51761e){return _0x51761e[_0x29a6('0x23')]()[_0x29a6('0x22')](function(){_0x2dc6c0[_0x29a6('0x17')](0xcc)[_0x29a6('0x24')]();});}};}function handleEntityNotFound(_0x1798dd,_0x17b835){return function(_0x364e72){if(!_0x364e72){_0x1798dd['sendStatus'](0x194);}return _0x364e72;};}function handleError(_0x483d22,_0x5a67df){_0x5a67df=_0x5a67df||0x1f4;return function(_0x1bcbf1){logger[_0x29a6('0x25')](_0x1bcbf1[_0x29a6('0x26')]);if(_0x1bcbf1[_0x29a6('0x27')]){delete _0x1bcbf1[_0x29a6('0x27')];}_0x483d22['status'](_0x5a67df)['send'](_0x1bcbf1);};}exports[_0x29a6('0x28')]=function(_0x3607b3,_0x4c5cb8){var _0x454df0={},_0x2b6b35={},_0x4fa41e={'count':0x0,'rows':[]};var _0x5a5cea=_[_0x29a6('0x29')](db[_0x29a6('0x2a')][_0x29a6('0x2b')],function(_0x4250f4){return{'name':_0x4250f4[_0x29a6('0x2c')],'type':_0x4250f4[_0x29a6('0x2d')]['key']};});_0x2b6b35['model']=_[_0x29a6('0x29')](_0x5a5cea,_0x29a6('0x27'));_0x2b6b35[_0x29a6('0x2e')]=_[_0x29a6('0x2f')](_0x3607b3[_0x29a6('0x2e')]);_0x2b6b35[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x2b6b35['model'],_0x2b6b35[_0x29a6('0x2e')]);_0x454df0[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2b6b35[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x454df0[_0x29a6('0x32')]=_0x454df0[_0x29a6('0x32')]['length']?_0x454df0[_0x29a6('0x32')]:_0x2b6b35[_0x29a6('0x33')];if(!_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x35')](_0x29a6('0x36'))){_0x454df0[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x3607b3['query']['limit']);_0x454df0['offset']=qs[_0x29a6('0x19')](_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x19')]);}_0x454df0[_0x29a6('0x37')]=qs[_0x29a6('0x38')](_0x3607b3[_0x29a6('0x2e')]['sort']);_0x454df0[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_['pick'](_0x3607b3[_0x29a6('0x2e')],_0x2b6b35[_0x29a6('0x30')]),_0x5a5cea);if(_0x3607b3['query'][_0x29a6('0x3a')]){_0x454df0[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x454df0['where'],{'$or':_[_0x29a6('0x29')](_0x5a5cea,function(_0x3c35b6){if(_0x3c35b6[_0x29a6('0x2d')]!=='VIRTUAL'){var _0x50ab51={};_0x50ab51[_0x3c35b6[_0x29a6('0x27')]]={'$like':'%'+_0x3607b3['query'][_0x29a6('0x3a')]+'%'};return _0x50ab51;}})});}_0x454df0=_[_0x29a6('0x3b')]({},_0x454df0,_0x3607b3['options']);var _0x1a428f={'where':_0x454df0[_0x29a6('0x39')]};return db[_0x29a6('0x2a')][_0x29a6('0x1c')](_0x1a428f)[_0x29a6('0x22')](function(_0xc0e144){_0x4fa41e[_0x29a6('0x1c')]=_0xc0e144;if(_0x3607b3[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x454df0[_0x29a6('0x3d')]=[{'all':!![]}];}return db[_0x29a6('0x2a')][_0x29a6('0x3e')](_0x454df0);})[_0x29a6('0x22')](function(_0x54b0b1){_0x4fa41e[_0x29a6('0x3f')]=_0x54b0b1;return _0x4fa41e;})[_0x29a6('0x22')](respondWithFilteredResult(_0x4c5cb8,_0x454df0))[_0x29a6('0x40')](handleError(_0x4c5cb8,null));};exports['show']=function(_0x3b71ad,_0x5300ee){var _0x46dc89={'raw':![],'where':{'id':_0x3b71ad[_0x29a6('0x41')]['id']}},_0x2e14af={};_0x2e14af[_0x29a6('0x33')]=_['keys'](db[_0x29a6('0x2a')][_0x29a6('0x2b')]);_0x2e14af[_0x29a6('0x2e')]=_['keys'](_0x3b71ad[_0x29a6('0x2e')]);_0x2e14af[_0x29a6('0x30')]=_['intersection'](_0x2e14af[_0x29a6('0x33')],_0x2e14af[_0x29a6('0x2e')]);_0x46dc89[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x2e14af[_0x29a6('0x33')],qs[_0x29a6('0x34')](_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x34')]));_0x46dc89[_0x29a6('0x32')]=_0x46dc89[_0x29a6('0x32')][_0x29a6('0x42')]?_0x46dc89[_0x29a6('0x32')]:_0x2e14af[_0x29a6('0x33')];if(_0x3b71ad[_0x29a6('0x2e')][_0x29a6('0x3c')]){_0x46dc89[_0x29a6('0x3d')]=[{'all':!![]}];}_0x46dc89=_['merge']({},_0x46dc89,_0x3b71ad['options']);return db['SugarcrmAccount'][_0x29a6('0x43')](_0x46dc89)['then'](handleEntityNotFound(_0x5300ee,null))[_0x29a6('0x22')](respondWithResult(_0x5300ee,null))['catch'](handleError(_0x5300ee,null));};exports['create']=function(_0x25995e,_0x57e994){return db[_0x29a6('0x2a')][_0x29a6('0x44')](_0x25995e['body'],{})[_0x29a6('0x22')](respondWithResult(_0x57e994,0xc9))[_0x29a6('0x40')](handleError(_0x57e994,null));};exports[_0x29a6('0x21')]=function(_0x477085,_0x453ba7){if(_0x477085[_0x29a6('0x45')]['id']){delete _0x477085[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x43')]({'where':{'id':_0x477085[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x453ba7,null))[_0x29a6('0x22')](saveUpdates(_0x477085[_0x29a6('0x45')],null))[_0x29a6('0x22')](respondWithResult(_0x453ba7,null))[_0x29a6('0x40')](handleError(_0x453ba7,null));};exports['destroy']=function(_0x3252cd,_0x36ce7e){return db['SugarcrmAccount']['find']({'where':{'id':_0x3252cd['params']['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x36ce7e,null))[_0x29a6('0x22')](removeEntity(_0x36ce7e,null))[_0x29a6('0x40')](handleError(_0x36ce7e,null));};exports[_0x29a6('0x46')]=function(_0x5cf8cf,_0x3c3262,_0x32327b){var _0x5af0be={};var _0x342585={};var _0x1eacb0;var _0x40f52b;return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x5cf8cf[_0x29a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c3262,null))[_0x29a6('0x22')](function(_0x371313){if(_0x371313){_0x1eacb0=_0x371313;_0x342585['model']=_[_0x29a6('0x2f')](db['SugarcrmConfiguration'][_0x29a6('0x2b')]);_0x342585['query']=_[_0x29a6('0x2f')](_0x5cf8cf[_0x29a6('0x2e')]);_0x342585[_0x29a6('0x30')]=_[_0x29a6('0x31')](_0x342585['model'],_0x342585[_0x29a6('0x2e')]);_0x5af0be[_0x29a6('0x32')]=_[_0x29a6('0x31')](_0x342585['model'],qs['fields'](_0x5cf8cf['query']['fields']));_0x5af0be['attributes']=_0x5af0be[_0x29a6('0x32')][_0x29a6('0x42')]?_0x5af0be['attributes']:_0x342585[_0x29a6('0x33')];_0x5af0be['order']=qs[_0x29a6('0x38')](_0x5cf8cf[_0x29a6('0x2e')][_0x29a6('0x38')]);_0x5af0be[_0x29a6('0x39')]=qs[_0x29a6('0x30')](_[_0x29a6('0x48')](_0x5cf8cf[_0x29a6('0x2e')],_0x342585[_0x29a6('0x30')]));if(_0x5cf8cf[_0x29a6('0x2e')]['filter']){_0x5af0be[_0x29a6('0x39')]=_[_0x29a6('0x3b')](_0x5af0be['where'],{'$or':_[_0x29a6('0x29')](_0x5af0be[_0x29a6('0x32')],function(_0x317803){var _0x569944={};_0x569944[_0x317803]={'$like':'%'+_0x5cf8cf['query'][_0x29a6('0x3a')]+'%'};return _0x569944;})});}_0x5af0be=_[_0x29a6('0x3b')]({},_0x5af0be,_0x5cf8cf['options']);return _0x1eacb0[_0x29a6('0x46')](_0x5af0be);}})['then'](function(_0x45f503){if(_0x45f503){_0x40f52b=_0x45f503['length'];if(!_0x5cf8cf[_0x29a6('0x2e')]['hasOwnProperty']('nolimit')){_0x5af0be[_0x29a6('0x1b')]=qs[_0x29a6('0x1b')](_0x5cf8cf['query'][_0x29a6('0x1b')]);_0x5af0be['offset']=qs[_0x29a6('0x19')](_0x5cf8cf['query'][_0x29a6('0x19')]);}return _0x1eacb0['getConfigurations'](_0x5af0be);}})[_0x29a6('0x22')](function(_0x4e4b06){if(_0x4e4b06){return _0x4e4b06?{'count':_0x40f52b,'rows':_0x4e4b06}:null;}})[_0x29a6('0x22')](respondWithResult(_0x3c3262,null))[_0x29a6('0x40')](handleError(_0x3c3262,null));};exports['addConfiguration']=function(_0x290f86,_0x1f8726,_0x41a9e6){if(_0x290f86[_0x29a6('0x45')]['id']){delete _0x290f86[_0x29a6('0x45')]['id'];}return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x290f86[_0x29a6('0x41')]['id']}})[_0x29a6('0x22')](handleEntityNotFound(_0x1f8726,null))[_0x29a6('0x22')](function(_0x9d7bdc){if(_0x9d7bdc){_0x290f86[_0x29a6('0x45')][_0x29a6('0x49')]=_0x9d7bdc['id'];_0x290f86[_0x29a6('0x45')][_0x29a6('0x4a')]=integrations[_0x29a6('0x4b')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86['body'][_0x29a6('0x2d')]);_0x290f86[_0x29a6('0x45')][_0x29a6('0x4d')]=integrations[_0x29a6('0x4e')](_0x290f86[_0x29a6('0x45')][_0x29a6('0x4c')],_0x290f86[_0x29a6('0x45')][_0x29a6('0x2d')]);return db[_0x29a6('0x4f')][_0x29a6('0x44')](_0x290f86[_0x29a6('0x45')],{'include':[{'model':db[_0x29a6('0x50')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1f8726,null))['catch'](handleError(_0x1f8726,null));};exports[_0x29a6('0x51')]=function(_0x13a545,_0x27ba9a,_0x422344){var _0x27d33f='';var _0x38ad8b=['id',_0x29a6('0x27'),_0x29a6('0x52'),_0x29a6('0x53'),_0x29a6('0x54'),'date_start','duration_hours',_0x29a6('0x55'),_0x29a6('0x56'),_0x29a6('0x57'),_0x29a6('0x58'),_0x29a6('0x59')];return db[_0x29a6('0x2a')][_0x29a6('0x47')]({'where':{'id':_0x13a545[_0x29a6('0x41')]['id']},'attributes':['id',_0x29a6('0x5a'),'password',_0x29a6('0x5b')]})[_0x29a6('0x22')](handleEntityNotFound(_0x27ba9a,null))[_0x29a6('0x22')](function(_0x16b728){if(_0x16b728){_0x27d33f=_0x16b728[_0x29a6('0x5b')];var _0x4468de=_0x27d33f[_0x29a6('0x5c')](-0x1);if(_0x4468de==='/'){_0x27d33f=_0x27d33f[_0x29a6('0x5d')](0x0,_0x27d33f[_0x29a6('0x5e')](_0x4468de));}return rp({'method':_0x29a6('0x5f'),'uri':util['format'](_0x29a6('0x60'),_0x27d33f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x29a6('0x61'),'input_type':_0x29a6('0x62'),'response_type':'JSON','rest_data':JSON[_0x29a6('0x63')]({'user_auth':{'user_name':_0x16b728[_0x29a6('0x5a')],'password':_0x16b728[_0x29a6('0x64')],'encryption':_0x29a6('0x65')},'application':_0x29a6('0x66')})}});}})[_0x29a6('0x22')](function(_0x1302ca){if(_0x1302ca&&_0x1302ca['name']!==_0x29a6('0x67')&&_0x1302ca[_0x29a6('0x27')]!==_0x29a6('0x68')){return rp({'method':_0x29a6('0x5f'),'uri':util[_0x29a6('0x69')](_0x29a6('0x60'),_0x27d33f,_0x29a6('0x6a')),'json':!![],'form':{'method':_0x29a6('0x6b'),'input_type':'JSON','response_type':_0x29a6('0x62'),'rest_data':JSON[_0x29a6('0x63')]({'session':_0x1302ca['id'],'module_name':_0x29a6('0x6c')})}})[_0x29a6('0x22')](function(_0xb15526){if(_0xb15526){var _0x4a46d4=_['values'](_0xb15526[_0x29a6('0x6d')]);_[_0x29a6('0x6e')](_0x4a46d4,function(_0x25514c){return _0x38ad8b[_0x29a6('0x6f')](_0x25514c[_0x29a6('0x27')]);});return{'count':_0x4a46d4['length'],'rows':_['map'](_0x4a46d4,function(_0x424824){return{'id':_0x424824[_0x29a6('0x27')],'name':_0x424824[_0x29a6('0x70')],'custom':_[_0x29a6('0x71')](_0x424824[_0x29a6('0x27')],'_c')?!![]:![],'options':_0x424824[_0x29a6('0x72')]?_[_0x29a6('0x29')](_['values'](_0x424824[_0x29a6('0x72')]),function(_0xac15d8){return{'name':_0xac15d8[_0x29a6('0x73')],'value':_0xac15d8[_0x29a6('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x27ba9a,null))['catch'](function(_0xff1334){var _0x4cdd42=_0x13a545['query']['test']?0x1f4:_0xff1334[_0x29a6('0x74')]||0x1f4;logger['error'](_0x29a6('0x75'),_0x29a6('0x51'),_0x4cdd42,JSON['stringify'](_0xff1334));delete _0xff1334[_0x29a6('0x27')];if(_0x4cdd42===0x191){_0x4cdd42=0x190;}_0x27ba9a[_0x29a6('0x17')](_0x4cdd42)[_0x29a6('0x76')](_0x13a545[_0x29a6('0x2e')][_0x29a6('0x77')]?{'message':_0x29a6('0x78'),'statusCode':_0xff1334[_0x29a6('0x74')]}:_0xff1334);});}else{var _0xdf41f2=0x1f4;_0x27ba9a[_0x29a6('0x17')](_0xdf41f2)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 128c05c..4a57095 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 _0x62a8=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x62a8,0x142));var _0x862a=function(_0x47ce8a,_0x53e8b7){_0x47ce8a=_0x47ce8a-0x0;var _0x39ee94=_0x62a8[_0x47ce8a];return _0x39ee94;};'use strict';var _=require(_0x862a('0x0'));var util=require('util');var logger=require(_0x862a('0x1'))(_0x862a('0x2'));var moment=require(_0x862a('0x3'));var BPromise=require(_0x862a('0x4'));var rp=require(_0x862a('0x5'));var fs=require('fs');var path=require(_0x862a('0x6'));var rimraf=require(_0x862a('0x7'));var config=require(_0x862a('0x8'));var attributes=require(_0x862a('0x9'));var integrations=require(_0x862a('0xa'));module['exports']=function(_0x9d4bbe,_0x4ab886){return _0x9d4bbe[_0x862a('0xb')](_0x862a('0xc'),attributes,{'tableName':_0x862a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x945e=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x945e,0xca));var _0xe945=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x945e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var logger=require(_0xe945('0x2'))(_0xe945('0x3'));var moment=require(_0xe945('0x4'));var BPromise=require(_0xe945('0x5'));var rp=require(_0xe945('0x6'));var fs=require('fs');var path=require(_0xe945('0x7'));var rimraf=require(_0xe945('0x8'));var config=require('../../config/environment');var attributes=require(_0xe945('0x9'));var integrations=require(_0xe945('0xa'));module[_0xe945('0xb')]=function(_0x30d2a0,_0x17865e){return _0x30d2a0[_0xe945('0xc')](_0xe945('0xd'),attributes,{'tableName':_0xe945('0xe'),'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 9dcfe0e..2fd46b0 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 _0x65e1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','map','model','include','ShowSugarcrmAccount','SugarcrmAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x24a90c,_0x2a5823){var _0x4a2928=function(_0x150ccf){while(--_0x150ccf){_0x24a90c['push'](_0x24a90c['shift']());}};_0x4a2928(++_0x2a5823);}(_0x65e1,0xb3));var _0x165e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x65e1[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x165e('0x0'));var moment=require(_0x165e('0x1'));var BPromise=require(_0x165e('0x2'));var rs=require(_0x165e('0x3'));var fs=require('fs');var Redis=require(_0x165e('0x4'));var db=require(_0x165e('0x5'))['db'];var utils=require(_0x165e('0x6'));var logger=require(_0x165e('0x7'))(_0x165e('0x8'));var config=require(_0x165e('0x9'));var jayson=require(_0x165e('0xa'));var client=jayson[_0x165e('0xb')][_0x165e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x550ee2,_0x20c154,_0xd2c7ad){return new BPromise(function(_0x342b7a,_0x17a4a4){return client[_0x165e('0xd')](_0x550ee2,_0xd2c7ad)[_0x165e('0xe')](function(_0x51dc21){logger[_0x165e('0xf')](_0x165e('0x10'),_0x20c154,_0x165e('0x11'));logger['debug'](_0x165e('0x12'),_0x20c154,_0x165e('0x11'),JSON[_0x165e('0x13')](_0x51dc21));if(_0x51dc21[_0x165e('0x14')]){if(_0x51dc21['error']['code']===0x1f4){logger[_0x165e('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x20c154,_0x51dc21[_0x165e('0x14')]['message']);return _0x17a4a4(_0x51dc21[_0x165e('0x14')][_0x165e('0x15')]);}logger[_0x165e('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x20c154,_0x51dc21[_0x165e('0x14')][_0x165e('0x15')]);return _0x342b7a(_0x51dc21[_0x165e('0x14')]['message']);}else{logger[_0x165e('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x20c154,_0x165e('0x11'));_0x342b7a(_0x51dc21[_0x165e('0x16')][_0x165e('0x15')]);}})[_0x165e('0x17')](function(_0x466419){logger[_0x165e('0x14')](_0x165e('0x10'),_0x20c154,_0x466419);_0x17a4a4(_0x466419);});});}exports[_0x165e('0x18')]=function(_0x26656e){var _0x418428=this;return new Promise(function(_0x71c558,_0x46f224){return db['SugarcrmAccount'][_0x165e('0x19')]({'raw':_0x26656e['options']?_0x26656e[_0x165e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x26656e[_0x165e('0x1a')]?_0x26656e[_0x165e('0x1a')][_0x165e('0x1b')]||null:null,'attributes':_0x26656e[_0x165e('0x1a')]?_0x26656e[_0x165e('0x1a')][_0x165e('0x1c')]||null:null,'limit':_0x26656e[_0x165e('0x1a')]?_0x26656e['options'][_0x165e('0x1d')]||null:null,'include':_0x26656e[_0x165e('0x1a')]?_0x26656e[_0x165e('0x1a')]['include']?_[_0x165e('0x1e')](_0x26656e['options']['include'],function(_0x2e885a){return{'model':db[_0x2e885a[_0x165e('0x1f')]],'as':_0x2e885a['as'],'attributes':_0x2e885a[_0x165e('0x1c')],'include':_0x2e885a[_0x165e('0x20')]?_['map'](_0x2e885a['include'],function(_0x4c86ab){return{'model':db[_0x4c86ab[_0x165e('0x1f')]],'as':_0x4c86ab['as'],'attributes':_0x4c86ab[_0x165e('0x1c')],'include':_0x4c86ab['include']?_['map'](_0x4c86ab['include'],function(_0x211110){return{'model':db[_0x211110[_0x165e('0x1f')]],'as':_0x211110['as'],'attributes':_0x211110[_0x165e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c234b){logger[_0x165e('0xf')](_0x165e('0x18'),_0x26656e);logger['debug'](_0x165e('0x18'),_0x26656e,JSON[_0x165e('0x13')](_0x5c234b));_0x71c558(_0x5c234b);})['catch'](function(_0x5d73ee){logger[_0x165e('0x14')](_0x165e('0x18'),_0x5d73ee[_0x165e('0x15')],_0x26656e);_0x46f224(_0x418428[_0x165e('0x14')](0x1f4,_0x5d73ee[_0x165e('0x15')]));});});};exports[_0x165e('0x21')]=function(_0x1e64b4){var _0x225e8a=this;return new Promise(function(_0x5d3f34,_0x4fdb51){return db[_0x165e('0x22')][_0x165e('0x23')]({'raw':_0x1e64b4[_0x165e('0x1a')]?_0x1e64b4['options'][_0x165e('0x24')]===undefined?!![]:![]:!![],'where':_0x1e64b4[_0x165e('0x1a')]?_0x1e64b4[_0x165e('0x1a')][_0x165e('0x1b')]||null:null,'attributes':_0x1e64b4[_0x165e('0x1a')]?_0x1e64b4['options'][_0x165e('0x1c')]||null:null,'include':_0x1e64b4['options']?_0x1e64b4['options'][_0x165e('0x20')]?_['map'](_0x1e64b4[_0x165e('0x1a')][_0x165e('0x20')],function(_0x451992){return{'model':db[_0x451992[_0x165e('0x1f')]],'as':_0x451992['as'],'attributes':_0x451992[_0x165e('0x1c')],'include':_0x451992[_0x165e('0x20')]?_[_0x165e('0x1e')](_0x451992[_0x165e('0x20')],function(_0x1e0d92){return{'model':db[_0x1e0d92[_0x165e('0x1f')]],'as':_0x1e0d92['as'],'attributes':_0x1e0d92['attributes'],'include':_0x1e0d92[_0x165e('0x20')]?_[_0x165e('0x1e')](_0x1e0d92['include'],function(_0x5dc3d6){return{'model':db[_0x5dc3d6[_0x165e('0x1f')]],'as':_0x5dc3d6['as'],'attributes':_0x5dc3d6[_0x165e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x165e('0xe')](function(_0x375f10){logger[_0x165e('0xf')](_0x165e('0x21'),_0x1e64b4);logger['debug'](_0x165e('0x21'),_0x1e64b4,JSON[_0x165e('0x13')](_0x375f10));_0x5d3f34(_0x375f10);})[_0x165e('0x17')](function(_0x5a96e4){logger[_0x165e('0x14')](_0x165e('0x21'),_0x5a96e4[_0x165e('0x15')],_0x1e64b4);_0x4fdb51(_0x225e8a[_0x165e('0x14')](0x1f4,_0x5a96e4['message']));});});}; \ No newline at end of file +var _0x41c9=['GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x41c9,0x1b9));var _0x941c=function(_0xb620ff,_0x159a87){_0xb620ff=_0xb620ff-0x0;var _0x42601e=_0x41c9[_0xb620ff];return _0x42601e;};'use strict';var _=require('lodash');var util=require(_0x941c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x941c('0x1'));var fs=require('fs');var Redis=require(_0x941c('0x2'));var db=require(_0x941c('0x3'))['db'];var utils=require(_0x941c('0x4'));var logger=require(_0x941c('0x5'))(_0x941c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x941c('0x7')][_0x941c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x395ee9,_0x2745e7,_0x129ce3){return new BPromise(function(_0x814060,_0x252ac8){return client['request'](_0x395ee9,_0x129ce3)[_0x941c('0x9')](function(_0x4434ef){logger['info'](_0x941c('0xa'),_0x2745e7,_0x941c('0xb'));logger[_0x941c('0xc')](_0x941c('0xd'),_0x2745e7,_0x941c('0xb'),JSON[_0x941c('0xe')](_0x4434ef));if(_0x4434ef['error']){if(_0x4434ef['error'][_0x941c('0xf')]===0x1f4){logger[_0x941c('0x10')](_0x941c('0xa'),_0x2745e7,_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);return _0x252ac8(_0x4434ef['error'][_0x941c('0x11')]);}logger[_0x941c('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2745e7,_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);return _0x814060(_0x4434ef[_0x941c('0x10')][_0x941c('0x11')]);}else{logger[_0x941c('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2745e7,_0x941c('0xb'));_0x814060(_0x4434ef[_0x941c('0x13')]['message']);}})[_0x941c('0x14')](function(_0x150ea8){logger[_0x941c('0x10')](_0x941c('0xa'),_0x2745e7,_0x150ea8);_0x252ac8(_0x150ea8);});});}exports[_0x941c('0x15')]=function(_0x459498){var _0x48b431=this;return new Promise(function(_0x5e739d,_0x2ee1d2){return db[_0x941c('0x16')][_0x941c('0x17')]({'raw':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x19')]===undefined?!![]:![]:!![],'where':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1a')]||null:null,'attributes':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1b')]||null:null,'limit':_0x459498['options']?_0x459498[_0x941c('0x18')][_0x941c('0x1c')]||null:null,'include':_0x459498[_0x941c('0x18')]?_0x459498[_0x941c('0x18')][_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x459498[_0x941c('0x18')][_0x941c('0x1d')],function(_0x1d245d){return{'model':db[_0x1d245d['model']],'as':_0x1d245d['as'],'attributes':_0x1d245d[_0x941c('0x1b')],'include':_0x1d245d[_0x941c('0x1d')]?_['map'](_0x1d245d['include'],function(_0x445556){return{'model':db[_0x445556[_0x941c('0x1f')]],'as':_0x445556['as'],'attributes':_0x445556[_0x941c('0x1b')],'include':_0x445556[_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x445556[_0x941c('0x1d')],function(_0x265a4d){return{'model':db[_0x265a4d[_0x941c('0x1f')]],'as':_0x265a4d['as'],'attributes':_0x265a4d[_0x941c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x941c('0x9')](function(_0x81a24a){logger[_0x941c('0x12')](_0x941c('0x15'),_0x459498);logger['debug'](_0x941c('0x15'),_0x459498,JSON[_0x941c('0xe')](_0x81a24a));_0x5e739d(_0x81a24a);})[_0x941c('0x14')](function(_0x1acb05){logger[_0x941c('0x10')]('GetSugarcrmAccount',_0x1acb05[_0x941c('0x11')],_0x459498);_0x2ee1d2(_0x48b431[_0x941c('0x10')](0x1f4,_0x1acb05[_0x941c('0x11')]));});});};exports[_0x941c('0x20')]=function(_0x23acd6){var _0x29cae6=this;return new Promise(function(_0x5c3df7,_0x2e24dd){return db[_0x941c('0x16')]['find']({'raw':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')][_0x941c('0x19')]===undefined?!![]:![]:!![],'where':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')]['where']||null:null,'attributes':_0x23acd6[_0x941c('0x18')]?_0x23acd6['options']['attributes']||null:null,'include':_0x23acd6[_0x941c('0x18')]?_0x23acd6[_0x941c('0x18')]['include']?_[_0x941c('0x1e')](_0x23acd6[_0x941c('0x18')][_0x941c('0x1d')],function(_0x12604c){return{'model':db[_0x12604c[_0x941c('0x1f')]],'as':_0x12604c['as'],'attributes':_0x12604c['attributes'],'include':_0x12604c[_0x941c('0x1d')]?_[_0x941c('0x1e')](_0x12604c[_0x941c('0x1d')],function(_0x46cc43){return{'model':db[_0x46cc43['model']],'as':_0x46cc43['as'],'attributes':_0x46cc43[_0x941c('0x1b')],'include':_0x46cc43['include']?_['map'](_0x46cc43[_0x941c('0x1d')],function(_0x1e203d){return{'model':db[_0x1e203d[_0x941c('0x1f')]],'as':_0x1e203d['as'],'attributes':_0x1e203d[_0x941c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x941c('0x9')](function(_0x378616){logger[_0x941c('0x12')](_0x941c('0x20'),_0x23acd6);logger[_0x941c('0xc')]('ShowSugarcrmAccount',_0x23acd6,JSON[_0x941c('0xe')](_0x378616));_0x5c3df7(_0x378616);})[_0x941c('0x14')](function(_0x380c4a){logger[_0x941c('0x10')]('ShowSugarcrmAccount',_0x380c4a[_0x941c('0x11')],_0x23acd6);_0x2e24dd(_0x29cae6[_0x941c('0x10')](0x1f4,_0x380c4a[_0x941c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7aa3f27..3efcfb0 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 _0xaa88=['index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0xaa88,0x137));var _0x8aa8=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0xaa88[_0x121b1a];return _0x2d89a6;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require(_0x8aa8('0x4'));var router=express[_0x8aa8('0x5')]();var fs_extra=require(_0x8aa8('0x6'));var auth=require(_0x8aa8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0x9')]('/:id',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xc')]);router['get'](_0x8aa8('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x9')](_0x8aa8('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x11')]);router['put'](_0x8aa8('0x12'),auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0x12'),auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file +var _0x3e38=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x5d5016,_0x2f3401){var _0x48e695=function(_0x15582e){while(--_0x15582e){_0x5d5016['push'](_0x5d5016['shift']());}};_0x48e695(++_0x2f3401);}(_0x3e38,0x174));var _0x83e3=function(_0x23741f,_0x223d52){_0x23741f=_0x23741f-0x0;var _0x3ef43e=_0x3e38[_0x23741f];return _0x3ef43e;};'use strict';var multer=require(_0x83e3('0x0'));var util=require(_0x83e3('0x1'));var path=require(_0x83e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x83e3('0x3'));var router=express[_0x83e3('0x4')]();var fs_extra=require(_0x83e3('0x5'));var auth=require(_0x83e3('0x6'));var interaction=require(_0x83e3('0x7'));var config=require(_0x83e3('0x8'));var controller=require(_0x83e3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x83e3('0xa')](_0x83e3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x83e3('0xa')]('/:id/fields',auth[_0x83e3('0xc')](),controller[_0x83e3('0xd')]);router[_0x83e3('0xa')](_0x83e3('0xe'),auth['isAuthenticated'](),controller[_0x83e3('0xf')]);router[_0x83e3('0xa')]('/:id/descriptions',auth[_0x83e3('0xc')](),controller[_0x83e3('0x10')]);router[_0x83e3('0x11')]('/',auth[_0x83e3('0xc')](),controller[_0x83e3('0x12')]);router[_0x83e3('0x13')](_0x83e3('0xb'),auth['isAuthenticated'](),controller[_0x83e3('0x14')]);router[_0x83e3('0x15')](_0x83e3('0xb'),auth[_0x83e3('0xc')](),controller[_0x83e3('0x16')]);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 d911ef7..363bcd3 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 _0x5a6f=['exports','STRING','sequelize'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x5a6f,0x164));var _0xf5a6=function(_0x237d48,_0x2dfc91){_0x237d48=_0x237d48-0x0;var _0x84a1ff=_0x5a6f[_0x237d48];return _0x84a1ff;};'use strict';var Sequelize=require(_0xf5a6('0x0'));module[_0xf5a6('0x1')]={'name':{'type':Sequelize[_0xf5a6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53a8=['STRING','exports'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0x53a8,0x8b));var _0x853a=function(_0x214cc0,_0x2dd82d){_0x214cc0=_0x214cc0-0x0;var _0x597499=_0x53a8[_0x214cc0];return _0x597499;};'use strict';var Sequelize=require('sequelize');module[_0x853a('0x0')]={'name':{'type':Sequelize[_0x853a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index cb1ff83..e89abe1 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 _0xe878=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','include','findAll','catch','show','params','intersection','length','includeAll','find','create','body','SugarcrmField','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty'];(function(_0x4f50aa,_0x211677){var _0x192adf=function(_0x49ed8c){while(--_0x49ed8c){_0x4f50aa['push'](_0x4f50aa['shift']());}};_0x192adf(++_0x211677);}(_0xe878,0x152));var _0x8e87=function(_0x21f28f,_0x3be6b8){_0x21f28f=_0x21f28f-0x0;var _0x180f21=_0xe878[_0x21f28f];return _0x180f21;};'use strict';var emlformat=require(_0x8e87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e87('0x1'));var jsonpatch=require(_0x8e87('0x2'));var rp=require(_0x8e87('0x3'));var moment=require(_0x8e87('0x4'));var BPromise=require(_0x8e87('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e87('0x6'));var sox=require('sox');var csv=require(_0x8e87('0x7'));var ejs=require(_0x8e87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e87('0x9'));var squel=require('squel');var crypto=require(_0x8e87('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8e87('0xb'));var toCsv=require(_0x8e87('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8e87('0xc'));var authService=require(_0x8e87('0xd'));var qs=require(_0x8e87('0xe'));var as=require(_0x8e87('0xf'));var hardwareService=require(_0x8e87('0x10'));var logger=require(_0x8e87('0x11'))(_0x8e87('0x12'));var utils=require(_0x8e87('0x13'));var config=require(_0x8e87('0x14'));var licenseUtil=require(_0x8e87('0x15'));var db=require(_0x8e87('0x16'))['db'];function respondWithStatusCode(_0x3d5d5f,_0x546620){_0x546620=_0x546620||0xcc;return function(_0x10411d){if(_0x10411d){return _0x3d5d5f[_0x8e87('0x17')](_0x546620);}return _0x3d5d5f[_0x8e87('0x18')](_0x546620)[_0x8e87('0x19')]();};}function respondWithResult(_0x11ff33,_0x29578a){_0x29578a=_0x29578a||0xc8;return function(_0x596089){if(_0x596089){return _0x11ff33[_0x8e87('0x18')](_0x29578a)[_0x8e87('0x1a')](_0x596089);}};}function respondWithFilteredResult(_0x11e492,_0x388a14){return function(_0xc8b413){if(_0xc8b413){var _0x53e99a=typeof _0x388a14[_0x8e87('0x1b')]===_0x8e87('0x1c')&&typeof _0x388a14[_0x8e87('0x1d')]===_0x8e87('0x1c');var _0x474563=_0xc8b413[_0x8e87('0x1e')];var _0x2049a7=_0x53e99a?0x0:_0x388a14[_0x8e87('0x1b')];var _0x9a792b=_0x53e99a?_0xc8b413['count']:_0x388a14[_0x8e87('0x1b')]+_0x388a14['limit'];var _0x4b9a68;if(_0x9a792b>=_0x474563){_0x9a792b=_0x474563;_0x4b9a68=0xc8;}else{_0x4b9a68=0xce;}_0x11e492[_0x8e87('0x18')](_0x4b9a68);return _0x11e492[_0x8e87('0x1f')]('Content-Range',_0x2049a7+'-'+_0x9a792b+'/'+_0x474563)['json'](_0xc8b413);}return null;};}function patchUpdates(_0x36ea06){return function(_0x181810){try{jsonpatch[_0x8e87('0x20')](_0x181810,_0x36ea06,!![]);}catch(_0x38dcf9){return BPromise['reject'](_0x38dcf9);}return _0x181810[_0x8e87('0x21')]();};}function saveUpdates(_0x537f5e,_0x2b2fad){return function(_0x35d607){if(_0x35d607){return _0x35d607[_0x8e87('0x22')](_0x537f5e)['then'](function(_0x5f1dd3){return _0x5f1dd3;});}return null;};}function removeEntity(_0x239546,_0x132d35){return function(_0x145c6b){if(_0x145c6b){return _0x145c6b['destroy']()[_0x8e87('0x23')](function(){_0x239546[_0x8e87('0x18')](0xcc)[_0x8e87('0x19')]();});}};}function handleEntityNotFound(_0x310514,_0x49329c){return function(_0x4daee7){if(!_0x4daee7){_0x310514[_0x8e87('0x17')](0x194);}return _0x4daee7;};}function handleError(_0x21a74c,_0x74bcd7){_0x74bcd7=_0x74bcd7||0x1f4;return function(_0x3de69b){logger[_0x8e87('0x24')](_0x3de69b[_0x8e87('0x25')]);if(_0x3de69b[_0x8e87('0x26')]){delete _0x3de69b['name'];}_0x21a74c[_0x8e87('0x18')](_0x74bcd7)[_0x8e87('0x27')](_0x3de69b);};}exports[_0x8e87('0x28')]=function(_0x4b4f7b,_0x416faa){var _0x25f569={},_0x1d29ed={},_0x20cb68={'count':0x0,'rows':[]};var _0x4834b7=_[_0x8e87('0x29')](db['SugarcrmConfiguration'][_0x8e87('0x2a')],function(_0x3dfcfb){return{'name':_0x3dfcfb[_0x8e87('0x2b')],'type':_0x3dfcfb[_0x8e87('0x2c')]['key']};});_0x1d29ed[_0x8e87('0x2d')]=_[_0x8e87('0x29')](_0x4834b7,'name');_0x1d29ed[_0x8e87('0x2e')]=_[_0x8e87('0x2f')](_0x4b4f7b[_0x8e87('0x2e')]);_0x1d29ed[_0x8e87('0x30')]=_['intersection'](_0x1d29ed[_0x8e87('0x2d')],_0x1d29ed['query']);_0x25f569[_0x8e87('0x31')]=_['intersection'](_0x1d29ed[_0x8e87('0x2d')],qs[_0x8e87('0x32')](_0x4b4f7b['query'][_0x8e87('0x32')]));_0x25f569[_0x8e87('0x31')]=_0x25f569[_0x8e87('0x31')]['length']?_0x25f569[_0x8e87('0x31')]:_0x1d29ed[_0x8e87('0x2d')];if(!_0x4b4f7b[_0x8e87('0x2e')][_0x8e87('0x33')](_0x8e87('0x34'))){_0x25f569['limit']=qs[_0x8e87('0x1d')](_0x4b4f7b['query'][_0x8e87('0x1d')]);_0x25f569['offset']=qs[_0x8e87('0x1b')](_0x4b4f7b['query'][_0x8e87('0x1b')]);}_0x25f569[_0x8e87('0x35')]=qs[_0x8e87('0x36')](_0x4b4f7b['query'][_0x8e87('0x36')]);_0x25f569['where']=qs[_0x8e87('0x30')](_['pick'](_0x4b4f7b[_0x8e87('0x2e')],_0x1d29ed[_0x8e87('0x30')]),_0x4834b7);if(_0x4b4f7b[_0x8e87('0x2e')][_0x8e87('0x37')]){_0x25f569[_0x8e87('0x38')]=_[_0x8e87('0x39')](_0x25f569[_0x8e87('0x38')],{'$or':_[_0x8e87('0x29')](_0x4834b7,function(_0x43d84a){if(_0x43d84a[_0x8e87('0x2c')]!==_0x8e87('0x3a')){var _0x1c8eab={};_0x1c8eab[_0x43d84a[_0x8e87('0x26')]]={'$like':'%'+_0x4b4f7b[_0x8e87('0x2e')][_0x8e87('0x37')]+'%'};return _0x1c8eab;}})});}_0x25f569=_['merge']({},_0x25f569,_0x4b4f7b[_0x8e87('0x3b')]);var _0x1baf0f={'where':_0x25f569[_0x8e87('0x38')]};return db[_0x8e87('0x3c')][_0x8e87('0x1e')](_0x1baf0f)['then'](function(_0x25712a){_0x20cb68[_0x8e87('0x1e')]=_0x25712a;if(_0x4b4f7b[_0x8e87('0x2e')]['includeAll']){_0x25f569[_0x8e87('0x3d')]=[{'all':!![]}];}return db[_0x8e87('0x3c')][_0x8e87('0x3e')](_0x25f569);})[_0x8e87('0x23')](function(_0x5c2a49){_0x20cb68['rows']=_0x5c2a49;return _0x20cb68;})[_0x8e87('0x23')](respondWithFilteredResult(_0x416faa,_0x25f569))[_0x8e87('0x3f')](handleError(_0x416faa,null));};exports[_0x8e87('0x40')]=function(_0x23de9d,_0x124fc4){var _0x1dbfd5={'raw':![],'where':{'id':_0x23de9d[_0x8e87('0x41')]['id']}},_0x1ad76a={};_0x1ad76a[_0x8e87('0x2d')]=_[_0x8e87('0x2f')](db['SugarcrmConfiguration'][_0x8e87('0x2a')]);_0x1ad76a['query']=_['keys'](_0x23de9d[_0x8e87('0x2e')]);_0x1ad76a[_0x8e87('0x30')]=_[_0x8e87('0x42')](_0x1ad76a[_0x8e87('0x2d')],_0x1ad76a[_0x8e87('0x2e')]);_0x1dbfd5[_0x8e87('0x31')]=_[_0x8e87('0x42')](_0x1ad76a[_0x8e87('0x2d')],qs[_0x8e87('0x32')](_0x23de9d['query'][_0x8e87('0x32')]));_0x1dbfd5[_0x8e87('0x31')]=_0x1dbfd5[_0x8e87('0x31')][_0x8e87('0x43')]?_0x1dbfd5[_0x8e87('0x31')]:_0x1ad76a[_0x8e87('0x2d')];if(_0x23de9d[_0x8e87('0x2e')][_0x8e87('0x44')]){_0x1dbfd5[_0x8e87('0x3d')]=[{'all':!![]}];}_0x1dbfd5=_[_0x8e87('0x39')]({},_0x1dbfd5,_0x23de9d[_0x8e87('0x3b')]);return db[_0x8e87('0x3c')][_0x8e87('0x45')](_0x1dbfd5)[_0x8e87('0x23')](handleEntityNotFound(_0x124fc4,null))[_0x8e87('0x23')](respondWithResult(_0x124fc4,null))['catch'](handleError(_0x124fc4,null));};exports[_0x8e87('0x46')]=function(_0x3b075f,_0x229fa1){return db[_0x8e87('0x3c')][_0x8e87('0x46')](_0x3b075f[_0x8e87('0x47')],{})['then'](respondWithResult(_0x229fa1,0xc9))[_0x8e87('0x3f')](handleError(_0x229fa1,null));};exports[_0x8e87('0x22')]=function(_0x287192,_0x739663){if(_0x287192[_0x8e87('0x47')]['id']){delete _0x287192['body']['id'];}return db['SugarcrmConfiguration'][_0x8e87('0x45')]({'where':{'id':_0x287192['params']['id']}})[_0x8e87('0x23')](handleEntityNotFound(_0x739663,null))[_0x8e87('0x23')](saveUpdates(_0x287192['body'],null))[_0x8e87('0x23')](respondWithResult(_0x739663,null))[_0x8e87('0x3f')](handleError(_0x739663,null));};exports['destroy']=function(_0x204232,_0x17c706){return db[_0x8e87('0x3c')][_0x8e87('0x45')]({'where':{'id':_0x204232[_0x8e87('0x41')]['id']}})[_0x8e87('0x23')](handleEntityNotFound(_0x17c706,null))[_0x8e87('0x23')](removeEntity(_0x17c706,null))[_0x8e87('0x3f')](handleError(_0x17c706,null));};exports['getFields']=function(_0x14d5be,_0x3d805d,_0x50809c){var _0x17d996={};var _0x99f904={};var _0x3ea662;var _0x5ce4cb;return db[_0x8e87('0x3c')]['findOne']({'where':{'id':_0x14d5be[_0x8e87('0x41')]['id']}})[_0x8e87('0x23')](handleEntityNotFound(_0x3d805d,null))[_0x8e87('0x23')](function(_0x24c028){if(_0x24c028){_0x3ea662=_0x24c028;_0x99f904['model']=_[_0x8e87('0x2f')](db[_0x8e87('0x48')][_0x8e87('0x2a')]);_0x99f904[_0x8e87('0x2e')]=_[_0x8e87('0x2f')](_0x14d5be[_0x8e87('0x2e')]);_0x99f904[_0x8e87('0x30')]=_[_0x8e87('0x42')](_0x99f904[_0x8e87('0x2d')],_0x99f904[_0x8e87('0x2e')]);_0x17d996['attributes']=_['intersection'](_0x99f904['model'],qs['fields'](_0x14d5be[_0x8e87('0x2e')][_0x8e87('0x32')]));_0x17d996[_0x8e87('0x31')]=_0x17d996[_0x8e87('0x31')][_0x8e87('0x43')]?_0x17d996[_0x8e87('0x31')]:_0x99f904['model'];_0x17d996[_0x8e87('0x35')]=qs[_0x8e87('0x36')](_0x14d5be[_0x8e87('0x2e')]['sort']);_0x17d996['where']=qs[_0x8e87('0x30')](_[_0x8e87('0x49')](_0x14d5be[_0x8e87('0x2e')],_0x99f904[_0x8e87('0x30')]));if(_0x14d5be[_0x8e87('0x2e')][_0x8e87('0x37')]){_0x17d996[_0x8e87('0x38')]=_[_0x8e87('0x39')](_0x17d996[_0x8e87('0x38')],{'$or':_['map'](_0x17d996[_0x8e87('0x31')],function(_0x599dc6){var _0x11a815={};_0x11a815[_0x599dc6]={'$like':'%'+_0x14d5be[_0x8e87('0x2e')]['filter']+'%'};return _0x11a815;})});}_0x17d996=_[_0x8e87('0x39')]({},_0x17d996,_0x14d5be['options']);return _0x3ea662['getFields'](_0x17d996);}})[_0x8e87('0x23')](function(_0x36d2bb){if(_0x36d2bb){_0x5ce4cb=_0x36d2bb[_0x8e87('0x43')];if(!_0x14d5be[_0x8e87('0x2e')][_0x8e87('0x33')](_0x8e87('0x34'))){_0x17d996[_0x8e87('0x1d')]=qs[_0x8e87('0x1d')](_0x14d5be[_0x8e87('0x2e')]['limit']);_0x17d996[_0x8e87('0x1b')]=qs[_0x8e87('0x1b')](_0x14d5be[_0x8e87('0x2e')]['offset']);}return _0x3ea662[_0x8e87('0x4a')](_0x17d996);}})[_0x8e87('0x23')](function(_0x1a8503){if(_0x1a8503){return _0x1a8503?{'count':_0x5ce4cb,'rows':_0x1a8503}:null;}})[_0x8e87('0x23')](respondWithResult(_0x3d805d,null))[_0x8e87('0x3f')](handleError(_0x3d805d,null));};exports[_0x8e87('0x4b')]=function(_0x375684,_0x45b893,_0x698bb7){var _0x1d2e89={};var _0x3f477c={};var _0x1a8651;var _0x23d241;return db[_0x8e87('0x3c')][_0x8e87('0x4c')]({'where':{'id':_0x375684['params']['id']}})[_0x8e87('0x23')](handleEntityNotFound(_0x45b893,null))[_0x8e87('0x23')](function(_0x53ddcb){if(_0x53ddcb){_0x1a8651=_0x53ddcb;_0x3f477c[_0x8e87('0x2d')]=_[_0x8e87('0x2f')](db[_0x8e87('0x48')][_0x8e87('0x2a')]);_0x3f477c[_0x8e87('0x2e')]=_['keys'](_0x375684['query']);_0x3f477c[_0x8e87('0x30')]=_['intersection'](_0x3f477c[_0x8e87('0x2d')],_0x3f477c[_0x8e87('0x2e')]);_0x1d2e89[_0x8e87('0x31')]=_['intersection'](_0x3f477c[_0x8e87('0x2d')],qs[_0x8e87('0x32')](_0x375684[_0x8e87('0x2e')][_0x8e87('0x32')]));_0x1d2e89[_0x8e87('0x31')]=_0x1d2e89[_0x8e87('0x31')]['length']?_0x1d2e89['attributes']:_0x3f477c[_0x8e87('0x2d')];_0x1d2e89[_0x8e87('0x35')]=qs['sort'](_0x375684[_0x8e87('0x2e')][_0x8e87('0x36')]);_0x1d2e89['where']=qs[_0x8e87('0x30')](_['pick'](_0x375684['query'],_0x3f477c['filters']));if(_0x375684[_0x8e87('0x2e')][_0x8e87('0x37')]){_0x1d2e89['where']=_[_0x8e87('0x39')](_0x1d2e89[_0x8e87('0x38')],{'$or':_['map'](_0x1d2e89[_0x8e87('0x31')],function(_0x3f4db9){var _0x5175f2={};_0x5175f2[_0x3f4db9]={'$like':'%'+_0x375684[_0x8e87('0x2e')][_0x8e87('0x37')]+'%'};return _0x5175f2;})});}_0x1d2e89=_[_0x8e87('0x39')]({},_0x1d2e89,_0x375684['options']);return _0x1a8651[_0x8e87('0x4b')](_0x1d2e89);}})[_0x8e87('0x23')](function(_0xcf57e9){if(_0xcf57e9){_0x23d241=_0xcf57e9['length'];if(!_0x375684[_0x8e87('0x2e')][_0x8e87('0x33')](_0x8e87('0x34'))){_0x1d2e89[_0x8e87('0x1d')]=qs[_0x8e87('0x1d')](_0x375684[_0x8e87('0x2e')][_0x8e87('0x1d')]);_0x1d2e89[_0x8e87('0x1b')]=qs[_0x8e87('0x1b')](_0x375684['query']['offset']);}return _0x1a8651['getSubjects'](_0x1d2e89);}})[_0x8e87('0x23')](function(_0x16a4a6){if(_0x16a4a6){return _0x16a4a6?{'count':_0x23d241,'rows':_0x16a4a6}:null;}})[_0x8e87('0x23')](respondWithResult(_0x45b893,null))[_0x8e87('0x3f')](handleError(_0x45b893,null));};exports[_0x8e87('0x4d')]=function(_0x2457cc,_0x10929d,_0xc6ede1){var _0x1790e7={};var _0x468ee6={};var _0xa2d268;var _0x9be256;return db[_0x8e87('0x3c')][_0x8e87('0x4c')]({'where':{'id':_0x2457cc[_0x8e87('0x41')]['id']}})[_0x8e87('0x23')](handleEntityNotFound(_0x10929d,null))[_0x8e87('0x23')](function(_0x50bda8){if(_0x50bda8){_0xa2d268=_0x50bda8;_0x468ee6[_0x8e87('0x2d')]=_[_0x8e87('0x2f')](db[_0x8e87('0x48')][_0x8e87('0x2a')]);_0x468ee6[_0x8e87('0x2e')]=_[_0x8e87('0x2f')](_0x2457cc[_0x8e87('0x2e')]);_0x468ee6['filters']=_[_0x8e87('0x42')](_0x468ee6[_0x8e87('0x2d')],_0x468ee6[_0x8e87('0x2e')]);_0x1790e7[_0x8e87('0x31')]=_[_0x8e87('0x42')](_0x468ee6[_0x8e87('0x2d')],qs[_0x8e87('0x32')](_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x32')]));_0x1790e7['attributes']=_0x1790e7[_0x8e87('0x31')][_0x8e87('0x43')]?_0x1790e7[_0x8e87('0x31')]:_0x468ee6[_0x8e87('0x2d')];_0x1790e7[_0x8e87('0x35')]=qs['sort'](_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x36')]);_0x1790e7['where']=qs[_0x8e87('0x30')](_[_0x8e87('0x49')](_0x2457cc[_0x8e87('0x2e')],_0x468ee6[_0x8e87('0x30')]));if(_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x37')]){_0x1790e7[_0x8e87('0x38')]=_[_0x8e87('0x39')](_0x1790e7[_0x8e87('0x38')],{'$or':_[_0x8e87('0x29')](_0x1790e7[_0x8e87('0x31')],function(_0x10c430){var _0x442aab={};_0x442aab[_0x10c430]={'$like':'%'+_0x2457cc[_0x8e87('0x2e')]['filter']+'%'};return _0x442aab;})});}_0x1790e7=_[_0x8e87('0x39')]({},_0x1790e7,_0x2457cc[_0x8e87('0x3b')]);return _0xa2d268[_0x8e87('0x4d')](_0x1790e7);}})[_0x8e87('0x23')](function(_0x3de705){if(_0x3de705){_0x9be256=_0x3de705[_0x8e87('0x43')];if(!_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x33')]('nolimit')){_0x1790e7[_0x8e87('0x1d')]=qs[_0x8e87('0x1d')](_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x1d')]);_0x1790e7['offset']=qs[_0x8e87('0x1b')](_0x2457cc[_0x8e87('0x2e')][_0x8e87('0x1b')]);}return _0xa2d268['getDescriptions'](_0x1790e7);}})[_0x8e87('0x23')](function(_0x15af91){if(_0x15af91){return _0x15af91?{'count':_0x9be256,'rows':_0x15af91}:null;}})[_0x8e87('0x23')](respondWithResult(_0x10929d,null))[_0x8e87('0x3f')](handleError(_0x10929d,null));}; \ No newline at end of file +var _0x18ad=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','findOne','SugarcrmField','getFields','getSubjects','pick','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','destroy','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x18ad,0x74));var _0xd18a=function(_0x4e2148,_0x382a2c){_0x4e2148=_0x4e2148-0x0;var _0x323345=_0x18ad[_0x4e2148];return _0x323345;};'use strict';var emlformat=require(_0xd18a('0x0'));var rimraf=require(_0xd18a('0x1'));var zipdir=require(_0xd18a('0x2'));var jsonpatch=require(_0xd18a('0x3'));var rp=require(_0xd18a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd18a('0x5'));var util=require(_0xd18a('0x6'));var path=require('path');var sox=require(_0xd18a('0x7'));var csv=require(_0xd18a('0x8'));var ejs=require(_0xd18a('0x9'));var fs=require('fs');var fs_extra=require(_0xd18a('0xa'));var _=require(_0xd18a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd18a('0xc'));var deskjs=require(_0xd18a('0xd'));var toCsv=require(_0xd18a('0x8'));var querystring=require(_0xd18a('0xe'));var Papa=require(_0xd18a('0xf'));var Redis=require(_0xd18a('0x10'));var authService=require(_0xd18a('0x11'));var qs=require(_0xd18a('0x12'));var as=require(_0xd18a('0x13'));var hardwareService=require(_0xd18a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd18a('0x15'));var config=require(_0xd18a('0x16'));var licenseUtil=require(_0xd18a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1154bb,_0x1e8300){_0x1e8300=_0x1e8300||0xcc;return function(_0x5ecd0c){if(_0x5ecd0c){return _0x1154bb[_0xd18a('0x18')](_0x1e8300);}return _0x1154bb['status'](_0x1e8300)['end']();};}function respondWithResult(_0x32c78a,_0x5e9cbc){_0x5e9cbc=_0x5e9cbc||0xc8;return function(_0x1ca0f0){if(_0x1ca0f0){return _0x32c78a[_0xd18a('0x19')](_0x5e9cbc)['json'](_0x1ca0f0);}};}function respondWithFilteredResult(_0xdbb971,_0xf29d6c){return function(_0x4e0432){if(_0x4e0432){var _0x485841=typeof _0xf29d6c[_0xd18a('0x1a')]==='undefined'&&typeof _0xf29d6c[_0xd18a('0x1b')]===_0xd18a('0x1c');var _0x420732=_0x4e0432[_0xd18a('0x1d')];var _0x4b1ef0=_0x485841?0x0:_0xf29d6c[_0xd18a('0x1a')];var _0x155a78=_0x485841?_0x4e0432[_0xd18a('0x1d')]:_0xf29d6c[_0xd18a('0x1a')]+_0xf29d6c[_0xd18a('0x1b')];var _0x23a0e7;if(_0x155a78>=_0x420732){_0x155a78=_0x420732;_0x23a0e7=0xc8;}else{_0x23a0e7=0xce;}_0xdbb971[_0xd18a('0x19')](_0x23a0e7);return _0xdbb971[_0xd18a('0x1e')]('Content-Range',_0x4b1ef0+'-'+_0x155a78+'/'+_0x420732)[_0xd18a('0x1f')](_0x4e0432);}return null;};}function patchUpdates(_0x524923){return function(_0x4d6313){try{jsonpatch[_0xd18a('0x20')](_0x4d6313,_0x524923,!![]);}catch(_0x15d7ca){return BPromise[_0xd18a('0x21')](_0x15d7ca);}return _0x4d6313['save']();};}function saveUpdates(_0x1d0fcb,_0x3f5e3c){return function(_0x5be998){if(_0x5be998){return _0x5be998['update'](_0x1d0fcb)['then'](function(_0x1751df){return _0x1751df;});}return null;};}function removeEntity(_0x2c979d,_0x218d22){return function(_0x24274a){if(_0x24274a){return _0x24274a[_0xd18a('0x22')]()[_0xd18a('0x23')](function(){_0x2c979d[_0xd18a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186cbb,_0x223a4d){return function(_0x587010){if(!_0x587010){_0x186cbb[_0xd18a('0x18')](0x194);}return _0x587010;};}function handleError(_0x5317fb,_0x56d883){_0x56d883=_0x56d883||0x1f4;return function(_0x4c4063){logger[_0xd18a('0x24')](_0x4c4063[_0xd18a('0x25')]);if(_0x4c4063[_0xd18a('0x26')]){delete _0x4c4063[_0xd18a('0x26')];}_0x5317fb[_0xd18a('0x19')](_0x56d883)[_0xd18a('0x27')](_0x4c4063);};}exports[_0xd18a('0x28')]=function(_0xad62ca,_0x19ae9b){var _0xf315e0={},_0x3e9079={},_0x131b97={'count':0x0,'rows':[]};var _0x2ed298=_['map'](db[_0xd18a('0x29')][_0xd18a('0x2a')],function(_0x5316bf){return{'name':_0x5316bf['fieldName'],'type':_0x5316bf[_0xd18a('0x2b')][_0xd18a('0x2c')]};});_0x3e9079[_0xd18a('0x2d')]=_[_0xd18a('0x2e')](_0x2ed298,_0xd18a('0x26'));_0x3e9079[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0xad62ca[_0xd18a('0x2f')]);_0x3e9079[_0xd18a('0x31')]=_['intersection'](_0x3e9079[_0xd18a('0x2d')],_0x3e9079[_0xd18a('0x2f')]);_0xf315e0[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x3e9079['model'],qs[_0xd18a('0x34')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x34')]));_0xf315e0[_0xd18a('0x32')]=_0xf315e0['attributes'][_0xd18a('0x35')]?_0xf315e0[_0xd18a('0x32')]:_0x3e9079[_0xd18a('0x2d')];if(!_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x36')]('nolimit')){_0xf315e0[_0xd18a('0x1b')]=qs[_0xd18a('0x1b')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0xf315e0['offset']=qs[_0xd18a('0x1a')](_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x1a')]);}_0xf315e0[_0xd18a('0x37')]=qs['sort'](_0xad62ca['query'][_0xd18a('0x38')]);_0xf315e0[_0xd18a('0x39')]=qs[_0xd18a('0x31')](_['pick'](_0xad62ca[_0xd18a('0x2f')],_0x3e9079[_0xd18a('0x31')]),_0x2ed298);if(_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0xf315e0[_0xd18a('0x39')]=_['merge'](_0xf315e0[_0xd18a('0x39')],{'$or':_['map'](_0x2ed298,function(_0x3ebc1b){if(_0x3ebc1b[_0xd18a('0x2b')]!==_0xd18a('0x3b')){var _0x139e8c={};_0x139e8c[_0x3ebc1b['name']]={'$like':'%'+_0xad62ca['query'][_0xd18a('0x3a')]+'%'};return _0x139e8c;}})});}_0xf315e0=_[_0xd18a('0x3c')]({},_0xf315e0,_0xad62ca['options']);var _0x5e5452={'where':_0xf315e0[_0xd18a('0x39')]};return db[_0xd18a('0x29')][_0xd18a('0x1d')](_0x5e5452)[_0xd18a('0x23')](function(_0x175295){_0x131b97[_0xd18a('0x1d')]=_0x175295;if(_0xad62ca[_0xd18a('0x2f')][_0xd18a('0x3d')]){_0xf315e0[_0xd18a('0x3e')]=[{'all':!![]}];}return db[_0xd18a('0x29')][_0xd18a('0x3f')](_0xf315e0);})[_0xd18a('0x23')](function(_0x2af5a9){_0x131b97[_0xd18a('0x40')]=_0x2af5a9;return _0x131b97;})[_0xd18a('0x23')](respondWithFilteredResult(_0x19ae9b,_0xf315e0))[_0xd18a('0x41')](handleError(_0x19ae9b,null));};exports[_0xd18a('0x42')]=function(_0x935ff1,_0x1cf7ad){var _0x138832={'raw':![],'where':{'id':_0x935ff1['params']['id']}},_0x3bf232={};_0x3bf232[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db['SugarcrmConfiguration'][_0xd18a('0x2a')]);_0x3bf232[_0xd18a('0x2f')]=_['keys'](_0x935ff1[_0xd18a('0x2f')]);_0x3bf232[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x3bf232[_0xd18a('0x2d')],_0x3bf232[_0xd18a('0x2f')]);_0x138832[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x3bf232[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x935ff1['query'][_0xd18a('0x34')]));_0x138832['attributes']=_0x138832[_0xd18a('0x32')][_0xd18a('0x35')]?_0x138832[_0xd18a('0x32')]:_0x3bf232['model'];if(_0x935ff1[_0xd18a('0x2f')][_0xd18a('0x3d')]){_0x138832['include']=[{'all':!![]}];}_0x138832=_[_0xd18a('0x3c')]({},_0x138832,_0x935ff1[_0xd18a('0x43')]);return db[_0xd18a('0x29')][_0xd18a('0x44')](_0x138832)[_0xd18a('0x23')](handleEntityNotFound(_0x1cf7ad,null))[_0xd18a('0x23')](respondWithResult(_0x1cf7ad,null))['catch'](handleError(_0x1cf7ad,null));};exports[_0xd18a('0x45')]=function(_0x349587,_0x3445d1){return db[_0xd18a('0x29')][_0xd18a('0x45')](_0x349587[_0xd18a('0x46')],{})[_0xd18a('0x23')](respondWithResult(_0x3445d1,0xc9))[_0xd18a('0x41')](handleError(_0x3445d1,null));};exports[_0xd18a('0x47')]=function(_0x24ca40,_0x48c457){if(_0x24ca40[_0xd18a('0x46')]['id']){delete _0x24ca40['body']['id'];}return db['SugarcrmConfiguration'][_0xd18a('0x44')]({'where':{'id':_0x24ca40[_0xd18a('0x48')]['id']}})['then'](handleEntityNotFound(_0x48c457,null))[_0xd18a('0x23')](saveUpdates(_0x24ca40[_0xd18a('0x46')],null))[_0xd18a('0x23')](respondWithResult(_0x48c457,null))[_0xd18a('0x41')](handleError(_0x48c457,null));};exports[_0xd18a('0x22')]=function(_0x1f309e,_0xbbec57){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1f309e[_0xd18a('0x48')]['id']}})['then'](handleEntityNotFound(_0xbbec57,null))[_0xd18a('0x23')](removeEntity(_0xbbec57,null))['catch'](handleError(_0xbbec57,null));};exports['getFields']=function(_0x523170,_0x30d7ad,_0x31b981){var _0x3096db={};var _0x2acbc6={};var _0x12ddb9;var _0x5e6e15;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x523170['params']['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x30d7ad,null))[_0xd18a('0x23')](function(_0x12c9f7){if(_0x12c9f7){_0x12ddb9=_0x12c9f7;_0x2acbc6[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db[_0xd18a('0x4a')][_0xd18a('0x2a')]);_0x2acbc6['query']=_[_0xd18a('0x30')](_0x523170[_0xd18a('0x2f')]);_0x2acbc6[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x2acbc6[_0xd18a('0x2d')],_0x2acbc6[_0xd18a('0x2f')]);_0x3096db[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x2acbc6[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x34')]));_0x3096db[_0xd18a('0x32')]=_0x3096db[_0xd18a('0x32')][_0xd18a('0x35')]?_0x3096db[_0xd18a('0x32')]:_0x2acbc6[_0xd18a('0x2d')];_0x3096db[_0xd18a('0x37')]=qs[_0xd18a('0x38')](_0x523170[_0xd18a('0x2f')]['sort']);_0x3096db[_0xd18a('0x39')]=qs['filters'](_['pick'](_0x523170[_0xd18a('0x2f')],_0x2acbc6[_0xd18a('0x31')]));if(_0x523170[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0x3096db[_0xd18a('0x39')]=_[_0xd18a('0x3c')](_0x3096db[_0xd18a('0x39')],{'$or':_['map'](_0x3096db[_0xd18a('0x32')],function(_0xb896f7){var _0x5c99b3={};_0x5c99b3[_0xb896f7]={'$like':'%'+_0x523170[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x5c99b3;})});}_0x3096db=_[_0xd18a('0x3c')]({},_0x3096db,_0x523170[_0xd18a('0x43')]);return _0x12ddb9[_0xd18a('0x4b')](_0x3096db);}})[_0xd18a('0x23')](function(_0x3fb351){if(_0x3fb351){_0x5e6e15=_0x3fb351[_0xd18a('0x35')];if(!_0x523170[_0xd18a('0x2f')][_0xd18a('0x36')]('nolimit')){_0x3096db[_0xd18a('0x1b')]=qs[_0xd18a('0x1b')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0x3096db['offset']=qs[_0xd18a('0x1a')](_0x523170[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x12ddb9[_0xd18a('0x4b')](_0x3096db);}})[_0xd18a('0x23')](function(_0xc0389b){if(_0xc0389b){return _0xc0389b?{'count':_0x5e6e15,'rows':_0xc0389b}:null;}})[_0xd18a('0x23')](respondWithResult(_0x30d7ad,null))[_0xd18a('0x41')](handleError(_0x30d7ad,null));};exports[_0xd18a('0x4c')]=function(_0x2d90a4,_0x3f7e77,_0x424cf3){var _0x39f40a={};var _0x418e33={};var _0x565b76;var _0x400fef;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x2d90a4[_0xd18a('0x48')]['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x3f7e77,null))[_0xd18a('0x23')](function(_0x12e9db){if(_0x12e9db){_0x565b76=_0x12e9db;_0x418e33[_0xd18a('0x2d')]=_[_0xd18a('0x30')](db['SugarcrmField']['rawAttributes']);_0x418e33[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0x2d90a4[_0xd18a('0x2f')]);_0x418e33[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x418e33[_0xd18a('0x2d')],_0x418e33[_0xd18a('0x2f')]);_0x39f40a[_0xd18a('0x32')]=_[_0xd18a('0x33')](_0x418e33[_0xd18a('0x2d')],qs['fields'](_0x2d90a4[_0xd18a('0x2f')]['fields']));_0x39f40a[_0xd18a('0x32')]=_0x39f40a[_0xd18a('0x32')][_0xd18a('0x35')]?_0x39f40a['attributes']:_0x418e33['model'];_0x39f40a['order']=qs[_0xd18a('0x38')](_0x2d90a4[_0xd18a('0x2f')]['sort']);_0x39f40a[_0xd18a('0x39')]=qs['filters'](_[_0xd18a('0x4d')](_0x2d90a4[_0xd18a('0x2f')],_0x418e33[_0xd18a('0x31')]));if(_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x3a')]){_0x39f40a[_0xd18a('0x39')]=_['merge'](_0x39f40a['where'],{'$or':_[_0xd18a('0x2e')](_0x39f40a['attributes'],function(_0x479bd1){var _0x2d8455={};_0x2d8455[_0x479bd1]={'$like':'%'+_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x2d8455;})});}_0x39f40a=_['merge']({},_0x39f40a,_0x2d90a4['options']);return _0x565b76[_0xd18a('0x4c')](_0x39f40a);}})[_0xd18a('0x23')](function(_0x46ade0){if(_0x46ade0){_0x400fef=_0x46ade0['length'];if(!_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x36')](_0xd18a('0x4e'))){_0x39f40a['limit']=qs[_0xd18a('0x1b')](_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x1b')]);_0x39f40a['offset']=qs['offset'](_0x2d90a4[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x565b76[_0xd18a('0x4c')](_0x39f40a);}})[_0xd18a('0x23')](function(_0x32d92e){if(_0x32d92e){return _0x32d92e?{'count':_0x400fef,'rows':_0x32d92e}:null;}})[_0xd18a('0x23')](respondWithResult(_0x3f7e77,null))[_0xd18a('0x41')](handleError(_0x3f7e77,null));};exports[_0xd18a('0x4f')]=function(_0x4fe9b6,_0x5a60bf,_0x138f0c){var _0x20fef8={};var _0x52507f={};var _0x4bdd4b;var _0x561560;return db[_0xd18a('0x29')][_0xd18a('0x49')]({'where':{'id':_0x4fe9b6[_0xd18a('0x48')]['id']}})[_0xd18a('0x23')](handleEntityNotFound(_0x5a60bf,null))[_0xd18a('0x23')](function(_0x4dd763){if(_0x4dd763){_0x4bdd4b=_0x4dd763;_0x52507f[_0xd18a('0x2d')]=_['keys'](db[_0xd18a('0x4a')][_0xd18a('0x2a')]);_0x52507f[_0xd18a('0x2f')]=_[_0xd18a('0x30')](_0x4fe9b6[_0xd18a('0x2f')]);_0x52507f[_0xd18a('0x31')]=_[_0xd18a('0x33')](_0x52507f[_0xd18a('0x2d')],_0x52507f['query']);_0x20fef8[_0xd18a('0x32')]=_['intersection'](_0x52507f[_0xd18a('0x2d')],qs[_0xd18a('0x34')](_0x4fe9b6[_0xd18a('0x2f')]['fields']));_0x20fef8['attributes']=_0x20fef8[_0xd18a('0x32')]['length']?_0x20fef8[_0xd18a('0x32')]:_0x52507f['model'];_0x20fef8[_0xd18a('0x37')]=qs['sort'](_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x38')]);_0x20fef8[_0xd18a('0x39')]=qs[_0xd18a('0x31')](_[_0xd18a('0x4d')](_0x4fe9b6[_0xd18a('0x2f')],_0x52507f['filters']));if(_0x4fe9b6['query']['filter']){_0x20fef8[_0xd18a('0x39')]=_['merge'](_0x20fef8['where'],{'$or':_[_0xd18a('0x2e')](_0x20fef8[_0xd18a('0x32')],function(_0x37752c){var _0x12f462={};_0x12f462[_0x37752c]={'$like':'%'+_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x3a')]+'%'};return _0x12f462;})});}_0x20fef8=_[_0xd18a('0x3c')]({},_0x20fef8,_0x4fe9b6[_0xd18a('0x43')]);return _0x4bdd4b[_0xd18a('0x4f')](_0x20fef8);}})['then'](function(_0x3588b2){if(_0x3588b2){_0x561560=_0x3588b2[_0xd18a('0x35')];if(!_0x4fe9b6[_0xd18a('0x2f')]['hasOwnProperty'](_0xd18a('0x4e'))){_0x20fef8['limit']=qs[_0xd18a('0x1b')](_0x4fe9b6['query']['limit']);_0x20fef8[_0xd18a('0x1a')]=qs['offset'](_0x4fe9b6[_0xd18a('0x2f')][_0xd18a('0x1a')]);}return _0x4bdd4b[_0xd18a('0x4f')](_0x20fef8);}})[_0xd18a('0x23')](function(_0x470a1b){if(_0x470a1b){return _0x470a1b?{'count':_0x561560,'rows':_0x470a1b}:null;}})['then'](respondWithResult(_0x5a60bf,null))[_0xd18a('0x41')](handleError(_0x5a60bf,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8a82ce5..9c6fe27 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 _0x8411=['SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird','path','../../config/environment','exports','define'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x8411,0x185));var _0x1841=function(_0x116f85,_0x51392d){_0x116f85=_0x116f85-0x0;var _0x522ab4=_0x8411[_0x116f85];return _0x522ab4;};'use strict';var _=require('lodash');var util=require(_0x1841('0x0'));var logger=require('../../config/logger')(_0x1841('0x1'));var moment=require('moment');var BPromise=require(_0x1841('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1841('0x3'));var rimraf=require('rimraf');var config=require(_0x1841('0x4'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1841('0x5')]=function(_0xdf1862,_0x5145bf){return _0xdf1862[_0x1841('0x6')](_0x1841('0x7'),attributes,{'tableName':_0x1841('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc367=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x3bb8bf,_0x4058a1){var _0x1f8b3e=function(_0x43f74f){while(--_0x43f74f){_0x3bb8bf['push'](_0x3bb8bf['shift']());}};_0x1f8b3e(++_0x4058a1);}(_0xc367,0x14b));var _0x7c36=function(_0x178ca1,_0xba37c8){_0x178ca1=_0x178ca1-0x0;var _0x5f2668=_0xc367[_0x178ca1];return _0x5f2668;};'use strict';var _=require(_0x7c36('0x0'));var util=require(_0x7c36('0x1'));var logger=require(_0x7c36('0x2'))(_0x7c36('0x3'));var moment=require(_0x7c36('0x4'));var BPromise=require(_0x7c36('0x5'));var rp=require(_0x7c36('0x6'));var fs=require('fs');var path=require(_0x7c36('0x7'));var rimraf=require(_0x7c36('0x8'));var config=require(_0x7c36('0x9'));var attributes=require(_0x7c36('0xa'));module[_0x7c36('0xb')]=function(_0x28e1c4,_0x44eb37){return _0x28e1c4[_0x7c36('0xc')](_0x7c36('0xd'),attributes,{'tableName':_0x7c36('0xe'),'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 dff5838..5881535 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 _0xc33a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x353653,_0x5356a4){var _0x24b5cb=function(_0x234455){while(--_0x234455){_0x353653['push'](_0x353653['shift']());}};_0x24b5cb(++_0x5356a4);}(_0xc33a,0xe5));var _0xac33=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0xc33a[_0x22d202];return _0x3cb212;};'use strict';var _=require(_0xac33('0x0'));var util=require(_0xac33('0x1'));var moment=require(_0xac33('0x2'));var BPromise=require(_0xac33('0x3'));var rs=require(_0xac33('0x4'));var fs=require('fs');var Redis=require(_0xac33('0x5'));var db=require(_0xac33('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xac33('0x7'))(_0xac33('0x8'));var config=require('../../config/environment');var jayson=require(_0xac33('0x9'));var client=jayson[_0xac33('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af01e,_0x4e1406,_0x12409b){return new BPromise(function(_0x23b206,_0x50538d){return client[_0xac33('0xb')](_0x2af01e,_0x12409b)[_0xac33('0xc')](function(_0x432924){logger[_0xac33('0xd')](_0xac33('0xe'),_0x4e1406,'request\x20sent');logger[_0xac33('0xf')](_0xac33('0x10'),_0x4e1406,_0xac33('0x11'),JSON['stringify'](_0x432924));if(_0x432924[_0xac33('0x12')]){if(_0x432924[_0xac33('0x12')][_0xac33('0x13')]===0x1f4){logger[_0xac33('0x12')](_0xac33('0xe'),_0x4e1406,_0x432924[_0xac33('0x12')]['message']);return _0x50538d(_0x432924[_0xac33('0x12')][_0xac33('0x14')]);}logger[_0xac33('0x12')](_0xac33('0xe'),_0x4e1406,_0x432924['error']['message']);return _0x23b206(_0x432924[_0xac33('0x12')][_0xac33('0x14')]);}else{logger[_0xac33('0xd')](_0xac33('0xe'),_0x4e1406,_0xac33('0x11'));_0x23b206(_0x432924[_0xac33('0x15')][_0xac33('0x14')]);}})[_0xac33('0x16')](function(_0x470dbc){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4e1406,_0x470dbc);_0x50538d(_0x470dbc);});});} \ No newline at end of file +var _0x03ea=['http','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5671c1,_0x41a5e6){var _0xd226f3=function(_0x2bad51){while(--_0x2bad51){_0x5671c1['push'](_0x5671c1['shift']());}};_0xd226f3(++_0x41a5e6);}(_0x03ea,0xbf));var _0xa03e=function(_0xb9c593,_0x391f9b){_0xb9c593=_0xb9c593-0x0;var _0x5b5527=_0x03ea[_0xb9c593];return _0x5b5527;};'use strict';var _=require('lodash');var util=require(_0xa03e('0x0'));var moment=require(_0xa03e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa03e('0x2'));var fs=require('fs');var Redis=require(_0xa03e('0x3'));var db=require(_0xa03e('0x4'))['db'];var utils=require(_0xa03e('0x5'));var logger=require(_0xa03e('0x6'))('rpc');var config=require(_0xa03e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa03e('0x8')][_0xa03e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e8190,_0x280def,_0x3f7b94){return new BPromise(function(_0x1267b3,_0x29acf9){return client['request'](_0x2e8190,_0x3f7b94)['then'](function(_0x3fbd4c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x280def,_0xa03e('0xa'));logger['debug'](_0xa03e('0xb'),_0x280def,'request\x20sent',JSON[_0xa03e('0xc')](_0x3fbd4c));if(_0x3fbd4c[_0xa03e('0xd')]){if(_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0xe')]===0x1f4){logger[_0xa03e('0xd')](_0xa03e('0xf'),_0x280def,_0x3fbd4c[_0xa03e('0xd')]['message']);return _0x29acf9(_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0x10')]);}logger[_0xa03e('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x280def,_0x3fbd4c[_0xa03e('0xd')][_0xa03e('0x10')]);return _0x1267b3(_0x3fbd4c[_0xa03e('0xd')]['message']);}else{logger[_0xa03e('0x11')](_0xa03e('0xf'),_0x280def,_0xa03e('0xa'));_0x1267b3(_0x3fbd4c[_0xa03e('0x12')][_0xa03e('0x10')]);}})[_0xa03e('0x13')](function(_0x2537c6){logger[_0xa03e('0xd')](_0xa03e('0xf'),_0x280def,_0x2537c6);_0x29acf9(_0x2537c6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f801e55..8d22a37 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 _0x0023=['isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','get','index','/:id'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0x0023,0x1a0));var _0x3002=function(_0x1651b6,_0x14800f){_0x1651b6=_0x1651b6-0x0;var _0x1b64f5=_0x0023[_0x1651b6];return _0x1b64f5;};'use strict';var multer=require(_0x3002('0x0'));var util=require('util');var path=require(_0x3002('0x1'));var timeout=require(_0x3002('0x2'));var express=require(_0x3002('0x3'));var router=express[_0x3002('0x4')]();var fs_extra=require(_0x3002('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x3002('0x6')]('/',auth['isAuthenticated'](),controller[_0x3002('0x7')]);router['get'](_0x3002('0x8'),auth[_0x3002('0x9')](),controller[_0x3002('0xa')]);router[_0x3002('0xb')]('/',auth['isAuthenticated'](),controller[_0x3002('0xc')]);router[_0x3002('0xd')](_0x3002('0x8'),auth[_0x3002('0x9')](),controller['update']);router[_0x3002('0xe')](_0x3002('0x8'),auth['isAuthenticated'](),controller[_0x3002('0xf')]);module[_0x3002('0x10')]=router; \ No newline at end of file +var _0xe616=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xe616,0x192));var _0x6e61=function(_0x20ac62,_0x16e289){_0x20ac62=_0x20ac62-0x0;var _0x28eb5a=_0xe616[_0x20ac62];return _0x28eb5a;};'use strict';var multer=require(_0x6e61('0x0'));var util=require(_0x6e61('0x1'));var path=require(_0x6e61('0x2'));var timeout=require(_0x6e61('0x3'));var express=require(_0x6e61('0x4'));var router=express['Router']();var fs_extra=require(_0x6e61('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e61('0x6'));var config=require(_0x6e61('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x6e61('0x8')]('/',auth[_0x6e61('0x9')](),controller[_0x6e61('0xa')]);router[_0x6e61('0x8')](_0x6e61('0xb'),auth[_0x6e61('0x9')](),controller['show']);router[_0x6e61('0xc')]('/',auth[_0x6e61('0x9')](),controller[_0x6e61('0xd')]);router[_0x6e61('0xe')](_0x6e61('0xb'),auth[_0x6e61('0x9')](),controller[_0x6e61('0xf')]);router[_0x6e61('0x10')]('/:id',auth[_0x6e61('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index bab20ed..a496052 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 _0xbf10=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','string'];(function(_0x3a1fdf,_0xae3a12){var _0x288089=function(_0x5b1159){while(--_0x5b1159){_0x3a1fdf['push'](_0x3a1fdf['shift']());}};_0x288089(++_0xae3a12);}(_0xbf10,0x19b));var _0x0bf1=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xbf10[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0bf1('0x0'));module[_0x0bf1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0bf1('0x2'),_0x0bf1('0x3'),'customVariable',_0x0bf1('0x4'),_0x0bf1('0x5')),'defaultValue':_0x0bf1('0x2')},'content':{'type':Sequelize[_0x0bf1('0x6')]},'key':{'type':Sequelize[_0x0bf1('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x0bf1('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0bf1('0x6')]},'nameField':{'type':Sequelize[_0x0bf1('0x6')]},'customField':{'type':Sequelize[_0x0bf1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bf1('0x6')]}}; \ No newline at end of file +var _0x815b=['ENUM','variable','sequelize','exports','customVariable','picklist','string','STRING'];(function(_0x22f0a7,_0x2a5e0d){var _0x19adbb=function(_0x4cd069){while(--_0x4cd069){_0x22f0a7['push'](_0x22f0a7['shift']());}};_0x19adbb(++_0x2a5e0d);}(_0x815b,0x12a));var _0xb815=function(_0x5036a7,_0x1c1b57){_0x5036a7=_0x5036a7-0x0;var _0x25d393=_0x815b[_0x5036a7];return _0x25d393;};'use strict';var Sequelize=require(_0xb815('0x0'));module[_0xb815('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xb815('0x2'),'keyValue',_0xb815('0x3')),'defaultValue':_0xb815('0x4')},'content':{'type':Sequelize[_0xb815('0x5')]},'key':{'type':Sequelize[_0xb815('0x5')]},'keyType':{'type':Sequelize[_0xb815('0x6')]('string',_0xb815('0x7'),_0xb815('0x2'))},'keyContent':{'type':Sequelize[_0xb815('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb815('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb815('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 68341db..4cfb3e0 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 _0x4e84=['findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x198306,_0x16be5b){var _0x249186=function(_0x451866){while(--_0x451866){_0x198306['push'](_0x198306['shift']());}};_0x249186(++_0x16be5b);}(_0x4e84,0x1ca));var _0x44e8=function(_0x535dfa,_0x447976){_0x535dfa=_0x535dfa-0x0;var _0x2ef3da=_0x4e84[_0x535dfa];return _0x2ef3da;};'use strict';var emlformat=require(_0x44e8('0x0'));var rimraf=require(_0x44e8('0x1'));var zipdir=require(_0x44e8('0x2'));var jsonpatch=require(_0x44e8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44e8('0x4'));var Mustache=require(_0x44e8('0x5'));var util=require(_0x44e8('0x6'));var path=require(_0x44e8('0x7'));var sox=require('sox');var csv=require(_0x44e8('0x8'));var ejs=require(_0x44e8('0x9'));var fs=require('fs');var fs_extra=require(_0x44e8('0xa'));var _=require('lodash');var squel=require(_0x44e8('0xb'));var crypto=require(_0x44e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44e8('0xd'));var toCsv=require(_0x44e8('0x8'));var querystring=require(_0x44e8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x44e8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x44e8('0x10'));var hardwareService=require(_0x44e8('0x11'));var logger=require(_0x44e8('0x12'))(_0x44e8('0x13'));var utils=require(_0x44e8('0x14'));var config=require(_0x44e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x44e8('0x16'))['db'];function respondWithStatusCode(_0x40a2fe,_0xa01823){_0xa01823=_0xa01823||0xcc;return function(_0x22b8ad){if(_0x22b8ad){return _0x40a2fe[_0x44e8('0x17')](_0xa01823);}return _0x40a2fe[_0x44e8('0x18')](_0xa01823)[_0x44e8('0x19')]();};}function respondWithResult(_0x41ecc9,_0x241f63){_0x241f63=_0x241f63||0xc8;return function(_0xd104b8){if(_0xd104b8){return _0x41ecc9[_0x44e8('0x18')](_0x241f63)['json'](_0xd104b8);}};}function respondWithFilteredResult(_0xadf66f,_0x1bffd8){return function(_0xebe994){if(_0xebe994){var _0xea6115=typeof _0x1bffd8[_0x44e8('0x1a')]===_0x44e8('0x1b')&&typeof _0x1bffd8[_0x44e8('0x1c')]===_0x44e8('0x1b');var _0x1d9753=_0xebe994[_0x44e8('0x1d')];var _0x361290=_0xea6115?0x0:_0x1bffd8[_0x44e8('0x1a')];var _0x5d3343=_0xea6115?_0xebe994[_0x44e8('0x1d')]:_0x1bffd8['offset']+_0x1bffd8['limit'];var _0x50e849;if(_0x5d3343>=_0x1d9753){_0x5d3343=_0x1d9753;_0x50e849=0xc8;}else{_0x50e849=0xce;}_0xadf66f[_0x44e8('0x18')](_0x50e849);return _0xadf66f[_0x44e8('0x1e')](_0x44e8('0x1f'),_0x361290+'-'+_0x5d3343+'/'+_0x1d9753)[_0x44e8('0x20')](_0xebe994);}return null;};}function patchUpdates(_0x78334){return function(_0x501db9){try{jsonpatch[_0x44e8('0x21')](_0x501db9,_0x78334,!![]);}catch(_0x3974cd){return BPromise[_0x44e8('0x22')](_0x3974cd);}return _0x501db9[_0x44e8('0x23')]();};}function saveUpdates(_0x12a50a,_0x3bffad){return function(_0x2a1186){if(_0x2a1186){return _0x2a1186[_0x44e8('0x24')](_0x12a50a)[_0x44e8('0x25')](function(_0x27e14f){return _0x27e14f;});}return null;};}function removeEntity(_0x324e71,_0xe06996){return function(_0x3aebca){if(_0x3aebca){return _0x3aebca[_0x44e8('0x26')]()[_0x44e8('0x25')](function(){_0x324e71[_0x44e8('0x18')](0xcc)[_0x44e8('0x19')]();});}};}function handleEntityNotFound(_0x459f34,_0x50371b){return function(_0x52d5d5){if(!_0x52d5d5){_0x459f34[_0x44e8('0x17')](0x194);}return _0x52d5d5;};}function handleError(_0x4e3deb,_0x3d1f98){_0x3d1f98=_0x3d1f98||0x1f4;return function(_0xf1a3ad){logger[_0x44e8('0x27')](_0xf1a3ad[_0x44e8('0x28')]);if(_0xf1a3ad[_0x44e8('0x29')]){delete _0xf1a3ad['name'];}_0x4e3deb[_0x44e8('0x18')](_0x3d1f98)[_0x44e8('0x2a')](_0xf1a3ad);};}exports[_0x44e8('0x2b')]=function(_0x260236,_0x490fa5){var _0x38abff={},_0x2fbe54={},_0x1382dd={'count':0x0,'rows':[]};var _0x181db6=_['map'](db[_0x44e8('0x2c')][_0x44e8('0x2d')],function(_0x54a94e){return{'name':_0x54a94e[_0x44e8('0x2e')],'type':_0x54a94e[_0x44e8('0x2f')][_0x44e8('0x30')]};});_0x2fbe54['model']=_[_0x44e8('0x31')](_0x181db6,_0x44e8('0x29'));_0x2fbe54[_0x44e8('0x32')]=_[_0x44e8('0x33')](_0x260236[_0x44e8('0x32')]);_0x2fbe54[_0x44e8('0x34')]=_['intersection'](_0x2fbe54[_0x44e8('0x35')],_0x2fbe54[_0x44e8('0x32')]);_0x38abff[_0x44e8('0x36')]=_[_0x44e8('0x37')](_0x2fbe54[_0x44e8('0x35')],qs['fields'](_0x260236[_0x44e8('0x32')][_0x44e8('0x38')]));_0x38abff[_0x44e8('0x36')]=_0x38abff[_0x44e8('0x36')][_0x44e8('0x39')]?_0x38abff['attributes']:_0x2fbe54[_0x44e8('0x35')];if(!_0x260236[_0x44e8('0x32')][_0x44e8('0x3a')](_0x44e8('0x3b'))){_0x38abff[_0x44e8('0x1c')]=qs[_0x44e8('0x1c')](_0x260236[_0x44e8('0x32')]['limit']);_0x38abff[_0x44e8('0x1a')]=qs[_0x44e8('0x1a')](_0x260236[_0x44e8('0x32')][_0x44e8('0x1a')]);}_0x38abff['order']=qs[_0x44e8('0x3c')](_0x260236[_0x44e8('0x32')][_0x44e8('0x3c')]);_0x38abff[_0x44e8('0x3d')]=qs[_0x44e8('0x34')](_['pick'](_0x260236['query'],_0x2fbe54[_0x44e8('0x34')]),_0x181db6);if(_0x260236['query']['filter']){_0x38abff['where']=_['merge'](_0x38abff[_0x44e8('0x3d')],{'$or':_[_0x44e8('0x31')](_0x181db6,function(_0x3420a){if(_0x3420a[_0x44e8('0x2f')]!==_0x44e8('0x3e')){var _0xfba923={};_0xfba923[_0x3420a[_0x44e8('0x29')]]={'$like':'%'+_0x260236['query']['filter']+'%'};return _0xfba923;}})});}_0x38abff=_[_0x44e8('0x3f')]({},_0x38abff,_0x260236[_0x44e8('0x40')]);var _0x412d93={'where':_0x38abff[_0x44e8('0x3d')]};return db[_0x44e8('0x2c')][_0x44e8('0x1d')](_0x412d93)[_0x44e8('0x25')](function(_0x3b3370){_0x1382dd[_0x44e8('0x1d')]=_0x3b3370;if(_0x260236[_0x44e8('0x32')][_0x44e8('0x41')]){_0x38abff[_0x44e8('0x42')]=[{'all':!![]}];}return db[_0x44e8('0x2c')][_0x44e8('0x43')](_0x38abff);})[_0x44e8('0x25')](function(_0x581dc3){_0x1382dd[_0x44e8('0x44')]=_0x581dc3;return _0x1382dd;})[_0x44e8('0x25')](respondWithFilteredResult(_0x490fa5,_0x38abff))[_0x44e8('0x45')](handleError(_0x490fa5,null));};exports[_0x44e8('0x46')]=function(_0x5dc64f,_0x511327){var _0x20e37a={'raw':!![],'where':{'id':_0x5dc64f[_0x44e8('0x47')]['id']}},_0x541312={};_0x541312[_0x44e8('0x35')]=_[_0x44e8('0x33')](db[_0x44e8('0x2c')][_0x44e8('0x2d')]);_0x541312[_0x44e8('0x32')]=_[_0x44e8('0x33')](_0x5dc64f[_0x44e8('0x32')]);_0x541312['filters']=_[_0x44e8('0x37')](_0x541312[_0x44e8('0x35')],_0x541312[_0x44e8('0x32')]);_0x20e37a[_0x44e8('0x36')]=_['intersection'](_0x541312[_0x44e8('0x35')],qs[_0x44e8('0x38')](_0x5dc64f[_0x44e8('0x32')][_0x44e8('0x38')]));_0x20e37a['attributes']=_0x20e37a['attributes'][_0x44e8('0x39')]?_0x20e37a['attributes']:_0x541312['model'];if(_0x5dc64f[_0x44e8('0x32')][_0x44e8('0x41')]){_0x20e37a[_0x44e8('0x42')]=[{'all':!![]}];}_0x20e37a=_[_0x44e8('0x3f')]({},_0x20e37a,_0x5dc64f[_0x44e8('0x40')]);return db[_0x44e8('0x2c')][_0x44e8('0x48')](_0x20e37a)['then'](handleEntityNotFound(_0x511327,null))[_0x44e8('0x25')](respondWithResult(_0x511327,null))[_0x44e8('0x45')](handleError(_0x511327,null));};exports[_0x44e8('0x49')]=function(_0x201574,_0x4bc006){return db['SugarcrmField'][_0x44e8('0x49')](_0x201574[_0x44e8('0x4a')],{})['then'](respondWithResult(_0x4bc006,0xc9))[_0x44e8('0x45')](handleError(_0x4bc006,null));};exports['update']=function(_0x63f8d5,_0x52cba0){if(_0x63f8d5[_0x44e8('0x4a')]['id']){delete _0x63f8d5['body']['id'];}return db[_0x44e8('0x2c')][_0x44e8('0x48')]({'where':{'id':_0x63f8d5[_0x44e8('0x47')]['id']}})[_0x44e8('0x25')](handleEntityNotFound(_0x52cba0,null))[_0x44e8('0x25')](saveUpdates(_0x63f8d5[_0x44e8('0x4a')],null))[_0x44e8('0x25')](respondWithResult(_0x52cba0,null))[_0x44e8('0x45')](handleError(_0x52cba0,null));};exports['destroy']=function(_0x46c4f0,_0x152fc2){return db[_0x44e8('0x2c')][_0x44e8('0x48')]({'where':{'id':_0x46c4f0[_0x44e8('0x47')]['id']}})['then'](handleEntityNotFound(_0x152fc2,null))[_0x44e8('0x25')](removeEntity(_0x152fc2,null))[_0x44e8('0x45')](handleError(_0x152fc2,null));}; \ No newline at end of file +var _0x196e=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x76e09b,_0x5d18a3){var _0xd18014=function(_0x47509e){while(--_0x47509e){_0x76e09b['push'](_0x76e09b['shift']());}};_0xd18014(++_0x5d18a3);}(_0x196e,0x1e7));var _0xe196=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x196e[_0x2caaef];return _0xd011f8;};'use strict';var emlformat=require(_0xe196('0x0'));var rimraf=require(_0xe196('0x1'));var zipdir=require(_0xe196('0x2'));var jsonpatch=require(_0xe196('0x3'));var rp=require(_0xe196('0x4'));var moment=require(_0xe196('0x5'));var BPromise=require(_0xe196('0x6'));var Mustache=require(_0xe196('0x7'));var util=require('util');var path=require(_0xe196('0x8'));var sox=require(_0xe196('0x9'));var csv=require(_0xe196('0xa'));var ejs=require(_0xe196('0xb'));var fs=require('fs');var fs_extra=require(_0xe196('0xc'));var _=require(_0xe196('0xd'));var squel=require('squel');var crypto=require(_0xe196('0xe'));var jsforce=require(_0xe196('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe196('0x10'));var Papa=require(_0xe196('0x11'));var Redis=require('ioredis');var authService=require(_0xe196('0x12'));var qs=require(_0xe196('0x13'));var as=require(_0xe196('0x14'));var hardwareService=require(_0xe196('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe196('0x16'));var config=require(_0xe196('0x17'));var licenseUtil=require(_0xe196('0x18'));var db=require(_0xe196('0x19'))['db'];function respondWithStatusCode(_0x396aa4,_0x444eca){_0x444eca=_0x444eca||0xcc;return function(_0x2659e3){if(_0x2659e3){return _0x396aa4[_0xe196('0x1a')](_0x444eca);}return _0x396aa4['status'](_0x444eca)[_0xe196('0x1b')]();};}function respondWithResult(_0x3f1980,_0xde37dd){_0xde37dd=_0xde37dd||0xc8;return function(_0x42ee8a){if(_0x42ee8a){return _0x3f1980['status'](_0xde37dd)[_0xe196('0x1c')](_0x42ee8a);}};}function respondWithFilteredResult(_0x31c56e,_0x5a838e){return function(_0x1339f0){if(_0x1339f0){var _0xeab6af=typeof _0x5a838e[_0xe196('0x1d')]===_0xe196('0x1e')&&typeof _0x5a838e[_0xe196('0x1f')]==='undefined';var _0x517117=_0x1339f0[_0xe196('0x20')];var _0x25ebcf=_0xeab6af?0x0:_0x5a838e['offset'];var _0x3ecd4f=_0xeab6af?_0x1339f0[_0xe196('0x20')]:_0x5a838e[_0xe196('0x1d')]+_0x5a838e[_0xe196('0x1f')];var _0x9ef653;if(_0x3ecd4f>=_0x517117){_0x3ecd4f=_0x517117;_0x9ef653=0xc8;}else{_0x9ef653=0xce;}_0x31c56e[_0xe196('0x21')](_0x9ef653);return _0x31c56e[_0xe196('0x22')]('Content-Range',_0x25ebcf+'-'+_0x3ecd4f+'/'+_0x517117)['json'](_0x1339f0);}return null;};}function patchUpdates(_0x297301){return function(_0x446358){try{jsonpatch[_0xe196('0x23')](_0x446358,_0x297301,!![]);}catch(_0x579b76){return BPromise[_0xe196('0x24')](_0x579b76);}return _0x446358[_0xe196('0x25')]();};}function saveUpdates(_0x39bd9f,_0xc8ea5b){return function(_0x3eb4e7){if(_0x3eb4e7){return _0x3eb4e7[_0xe196('0x26')](_0x39bd9f)[_0xe196('0x27')](function(_0x5b38ed){return _0x5b38ed;});}return null;};}function removeEntity(_0x4ea2df,_0x5eb1b8){return function(_0x48c0f5){if(_0x48c0f5){return _0x48c0f5[_0xe196('0x28')]()[_0xe196('0x27')](function(){_0x4ea2df[_0xe196('0x21')](0xcc)[_0xe196('0x1b')]();});}};}function handleEntityNotFound(_0x3c2fe4,_0x91d038){return function(_0x2efc4e){if(!_0x2efc4e){_0x3c2fe4[_0xe196('0x1a')](0x194);}return _0x2efc4e;};}function handleError(_0x114811,_0x49a0db){_0x49a0db=_0x49a0db||0x1f4;return function(_0x47251d){logger[_0xe196('0x29')](_0x47251d[_0xe196('0x2a')]);if(_0x47251d[_0xe196('0x2b')]){delete _0x47251d[_0xe196('0x2b')];}_0x114811[_0xe196('0x21')](_0x49a0db)[_0xe196('0x2c')](_0x47251d);};}exports[_0xe196('0x2d')]=function(_0x10de73,_0x1d5da3){var _0x4df900={},_0x11b910={},_0x139187={'count':0x0,'rows':[]};var _0x31110b=_[_0xe196('0x2e')](db[_0xe196('0x2f')][_0xe196('0x30')],function(_0x2bb9e2){return{'name':_0x2bb9e2[_0xe196('0x31')],'type':_0x2bb9e2[_0xe196('0x32')][_0xe196('0x33')]};});_0x11b910[_0xe196('0x34')]=_[_0xe196('0x2e')](_0x31110b,_0xe196('0x2b'));_0x11b910[_0xe196('0x35')]=_[_0xe196('0x36')](_0x10de73[_0xe196('0x35')]);_0x11b910[_0xe196('0x37')]=_[_0xe196('0x38')](_0x11b910[_0xe196('0x34')],_0x11b910[_0xe196('0x35')]);_0x4df900['attributes']=_[_0xe196('0x38')](_0x11b910[_0xe196('0x34')],qs[_0xe196('0x39')](_0x10de73[_0xe196('0x35')][_0xe196('0x39')]));_0x4df900['attributes']=_0x4df900[_0xe196('0x3a')][_0xe196('0x3b')]?_0x4df900[_0xe196('0x3a')]:_0x11b910[_0xe196('0x34')];if(!_0x10de73[_0xe196('0x35')][_0xe196('0x3c')](_0xe196('0x3d'))){_0x4df900[_0xe196('0x1f')]=qs[_0xe196('0x1f')](_0x10de73[_0xe196('0x35')][_0xe196('0x1f')]);_0x4df900[_0xe196('0x1d')]=qs['offset'](_0x10de73[_0xe196('0x35')][_0xe196('0x1d')]);}_0x4df900[_0xe196('0x3e')]=qs['sort'](_0x10de73[_0xe196('0x35')][_0xe196('0x3f')]);_0x4df900[_0xe196('0x40')]=qs['filters'](_[_0xe196('0x41')](_0x10de73[_0xe196('0x35')],_0x11b910[_0xe196('0x37')]),_0x31110b);if(_0x10de73[_0xe196('0x35')][_0xe196('0x42')]){_0x4df900[_0xe196('0x40')]=_[_0xe196('0x43')](_0x4df900[_0xe196('0x40')],{'$or':_[_0xe196('0x2e')](_0x31110b,function(_0x2291ee){if(_0x2291ee['type']!==_0xe196('0x44')){var _0x134574={};_0x134574[_0x2291ee[_0xe196('0x2b')]]={'$like':'%'+_0x10de73[_0xe196('0x35')][_0xe196('0x42')]+'%'};return _0x134574;}})});}_0x4df900=_[_0xe196('0x43')]({},_0x4df900,_0x10de73[_0xe196('0x45')]);var _0x9310a1={'where':_0x4df900['where']};return db['SugarcrmField'][_0xe196('0x20')](_0x9310a1)[_0xe196('0x27')](function(_0x598bd6){_0x139187['count']=_0x598bd6;if(_0x10de73[_0xe196('0x35')][_0xe196('0x46')]){_0x4df900[_0xe196('0x47')]=[{'all':!![]}];}return db[_0xe196('0x2f')][_0xe196('0x48')](_0x4df900);})[_0xe196('0x27')](function(_0x20ebd7){_0x139187[_0xe196('0x49')]=_0x20ebd7;return _0x139187;})[_0xe196('0x27')](respondWithFilteredResult(_0x1d5da3,_0x4df900))[_0xe196('0x4a')](handleError(_0x1d5da3,null));};exports['show']=function(_0x37ca5b,_0x34790f){var _0x24fe83={'raw':!![],'where':{'id':_0x37ca5b['params']['id']}},_0x3b6de={};_0x3b6de[_0xe196('0x34')]=_[_0xe196('0x36')](db[_0xe196('0x2f')][_0xe196('0x30')]);_0x3b6de[_0xe196('0x35')]=_[_0xe196('0x36')](_0x37ca5b[_0xe196('0x35')]);_0x3b6de[_0xe196('0x37')]=_['intersection'](_0x3b6de[_0xe196('0x34')],_0x3b6de[_0xe196('0x35')]);_0x24fe83[_0xe196('0x3a')]=_[_0xe196('0x38')](_0x3b6de['model'],qs[_0xe196('0x39')](_0x37ca5b[_0xe196('0x35')][_0xe196('0x39')]));_0x24fe83[_0xe196('0x3a')]=_0x24fe83[_0xe196('0x3a')][_0xe196('0x3b')]?_0x24fe83[_0xe196('0x3a')]:_0x3b6de[_0xe196('0x34')];if(_0x37ca5b[_0xe196('0x35')]['includeAll']){_0x24fe83[_0xe196('0x47')]=[{'all':!![]}];}_0x24fe83=_[_0xe196('0x43')]({},_0x24fe83,_0x37ca5b[_0xe196('0x45')]);return db['SugarcrmField'][_0xe196('0x4b')](_0x24fe83)[_0xe196('0x27')](handleEntityNotFound(_0x34790f,null))[_0xe196('0x27')](respondWithResult(_0x34790f,null))[_0xe196('0x4a')](handleError(_0x34790f,null));};exports[_0xe196('0x4c')]=function(_0xa57be4,_0x493c01){return db[_0xe196('0x2f')][_0xe196('0x4c')](_0xa57be4[_0xe196('0x4d')],{})[_0xe196('0x27')](respondWithResult(_0x493c01,0xc9))[_0xe196('0x4a')](handleError(_0x493c01,null));};exports['update']=function(_0x3a25d8,_0x5b76fd){if(_0x3a25d8['body']['id']){delete _0x3a25d8[_0xe196('0x4d')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3a25d8[_0xe196('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b76fd,null))[_0xe196('0x27')](saveUpdates(_0x3a25d8[_0xe196('0x4d')],null))[_0xe196('0x27')](respondWithResult(_0x5b76fd,null))[_0xe196('0x4a')](handleError(_0x5b76fd,null));};exports['destroy']=function(_0x388943,_0x238d09){return db['SugarcrmField']['find']({'where':{'id':_0x388943['params']['id']}})[_0xe196('0x27')](handleEntityNotFound(_0x238d09,null))['then'](removeEntity(_0x238d09,null))[_0xe196('0x4a')](handleError(_0x238d09,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d525371..1123430 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 _0xfe98=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfe98,0x161));var _0x8fe9=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xfe98[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0x8fe9('0x0'));var util=require(_0x8fe9('0x1'));var logger=require(_0x8fe9('0x2'))(_0x8fe9('0x3'));var moment=require(_0x8fe9('0x4'));var BPromise=require(_0x8fe9('0x5'));var rp=require(_0x8fe9('0x6'));var fs=require('fs');var path=require(_0x8fe9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8fe9('0x8'));module[_0x8fe9('0x9')]=function(_0xb2ed2d,_0x41fc42){return _0xb2ed2d[_0x8fe9('0xa')](_0x8fe9('0xb'),attributes,{'tableName':_0x8fe9('0xc'),'paranoid':![],'indexes':[{'name':_0x8fe9('0xd'),'fields':[_0x8fe9('0xe'),_0x8fe9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cef=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','idField','lodash','util','../../config/logger','api','moment'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x3cef,0x82));var _0xf3ce=function(_0x426da6,_0x291c2f){_0x426da6=_0x426da6-0x0;var _0x142658=_0x3cef[_0x426da6];return _0x142658;};'use strict';var _=require(_0xf3ce('0x0'));var util=require(_0xf3ce('0x1'));var logger=require(_0xf3ce('0x2'))(_0xf3ce('0x3'));var moment=require(_0xf3ce('0x4'));var BPromise=require(_0xf3ce('0x5'));var rp=require(_0xf3ce('0x6'));var fs=require('fs');var path=require(_0xf3ce('0x7'));var rimraf=require(_0xf3ce('0x8'));var config=require(_0xf3ce('0x9'));var attributes=require(_0xf3ce('0xa'));module[_0xf3ce('0xb')]=function(_0x1ff0fc,_0x21dfe3){return _0x1ff0fc[_0xf3ce('0xc')](_0xf3ce('0xd'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xf3ce('0xe'),'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 df1a9d2..b430fbf 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 _0x1dbe=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dbe,0x128));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1db('0x0'));var util=require(_0xe1db('0x1'));var moment=require(_0xe1db('0x2'));var BPromise=require(_0xe1db('0x3'));var rs=require(_0xe1db('0x4'));var fs=require('fs');var Redis=require(_0xe1db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1db('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe1db('0x7'));var jayson=require(_0xe1db('0x8'));var client=jayson[_0xe1db('0x9')][_0xe1db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54891d,_0xace43e,_0x34ddbf){return new BPromise(function(_0x158a01,_0x15df08){return client[_0xe1db('0xb')](_0x54891d,_0x34ddbf)['then'](function(_0x34e1bb){logger['info'](_0xe1db('0xc'),_0xace43e,_0xe1db('0xd'));logger[_0xe1db('0xe')](_0xe1db('0xf'),_0xace43e,'request\x20sent',JSON[_0xe1db('0x10')](_0x34e1bb));if(_0x34e1bb['error']){if(_0x34e1bb[_0xe1db('0x11')][_0xe1db('0x12')]===0x1f4){logger[_0xe1db('0x11')](_0xe1db('0xc'),_0xace43e,_0x34e1bb[_0xe1db('0x11')][_0xe1db('0x13')]);return _0x15df08(_0x34e1bb['error']['message']);}logger[_0xe1db('0x11')]('SugarcrmField,\x20%s,\x20%s',_0xace43e,_0x34e1bb['error']['message']);return _0x158a01(_0x34e1bb[_0xe1db('0x11')][_0xe1db('0x13')]);}else{logger[_0xe1db('0x14')](_0xe1db('0xc'),_0xace43e,_0xe1db('0xd'));_0x158a01(_0x34e1bb['result'][_0xe1db('0x13')]);}})[_0xe1db('0x15')](function(_0x25912d){logger[_0xe1db('0x11')]('SugarcrmField,\x20%s,\x20%s',_0xace43e,_0x25912d);_0x15df08(_0x25912d);});});} \ No newline at end of file +var _0x1ef0=['http','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3ddf3e,_0x348eba){var _0x5aa94a=function(_0x360560){while(--_0x360560){_0x3ddf3e['push'](_0x3ddf3e['shift']());}};_0x5aa94a(++_0x348eba);}(_0x1ef0,0x64));var _0x01ef=function(_0x40c9bc,_0x6eb340){_0x40c9bc=_0x40c9bc-0x0;var _0x3acedf=_0x1ef0[_0x40c9bc];return _0x3acedf;};'use strict';var _=require('lodash');var util=require(_0x01ef('0x0'));var moment=require(_0x01ef('0x1'));var BPromise=require(_0x01ef('0x2'));var rs=require(_0x01ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01ef('0x4'))['db'];var utils=require(_0x01ef('0x5'));var logger=require(_0x01ef('0x6'))(_0x01ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x01ef('0x8'));var client=jayson[_0x01ef('0x9')][_0x01ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c79fd,_0x38e5b5,_0x2c93ca){return new BPromise(function(_0x31abfb,_0x173f0d){return client['request'](_0x4c79fd,_0x2c93ca)[_0x01ef('0xb')](function(_0x45e553){logger[_0x01ef('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x38e5b5,_0x01ef('0xd'));logger[_0x01ef('0xe')](_0x01ef('0xf'),_0x38e5b5,_0x01ef('0xd'),JSON[_0x01ef('0x10')](_0x45e553));if(_0x45e553[_0x01ef('0x11')]){if(_0x45e553[_0x01ef('0x11')][_0x01ef('0x12')]===0x1f4){logger[_0x01ef('0x11')](_0x01ef('0x13'),_0x38e5b5,_0x45e553['error']['message']);return _0x173f0d(_0x45e553[_0x01ef('0x11')][_0x01ef('0x14')]);}logger[_0x01ef('0x11')](_0x01ef('0x13'),_0x38e5b5,_0x45e553['error'][_0x01ef('0x14')]);return _0x31abfb(_0x45e553[_0x01ef('0x11')][_0x01ef('0x14')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x38e5b5,_0x01ef('0xd'));_0x31abfb(_0x45e553[_0x01ef('0x15')][_0x01ef('0x14')]);}})['catch'](function(_0xda0389){logger['error'](_0x01ef('0x13'),_0x38e5b5,_0xda0389);_0x173f0d(_0xda0389);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index aa0ac11..202c860 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 _0x5e67=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x41c196,_0x4e963f){var _0x505372=function(_0x173334){while(--_0x173334){_0x41c196['push'](_0x41c196['shift']());}};_0x505372(++_0x4e963f);}(_0x5e67,0x70));var _0x75e6=function(_0x2de857,_0x5ef4fa){_0x2de857=_0x2de857-0x0;var _0x52729c=_0x5e67[_0x2de857];return _0x52729c;};'use strict';var multer=require(_0x75e6('0x0'));var util=require(_0x75e6('0x1'));var path=require(_0x75e6('0x2'));var timeout=require(_0x75e6('0x3'));var express=require(_0x75e6('0x4'));var router=express[_0x75e6('0x5')]();var fs_extra=require(_0x75e6('0x6'));var auth=require(_0x75e6('0x7'));var interaction=require(_0x75e6('0x8'));var config=require(_0x75e6('0x9'));var controller=require(_0x75e6('0xa'));router[_0x75e6('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x75e6('0xc')](),controller['show']);router[_0x75e6('0xb')](_0x75e6('0xd'),auth[_0x75e6('0xc')](),controller[_0x75e6('0xe')]);router['get'](_0x75e6('0xf'),auth[_0x75e6('0xc')](),controller[_0x75e6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x75e6('0x11')]);router[_0x75e6('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x75e6('0x13')]);router[_0x75e6('0x14')](_0x75e6('0x15'),auth[_0x75e6('0xc')](),controller[_0x75e6('0x16')]);router[_0x75e6('0x17')](_0x75e6('0x15'),auth[_0x75e6('0xc')](),controller['destroy']);module[_0x75e6('0x18')]=router; \ No newline at end of file +var _0x3140=['get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x29c7ed,_0x389f4b){var _0x22b24d=function(_0x512d23){while(--_0x512d23){_0x29c7ed['push'](_0x29c7ed['shift']());}};_0x22b24d(++_0x389f4b);}(_0x3140,0xaf));var _0x0314=function(_0x505241,_0x54a73d){_0x505241=_0x505241-0x0;var _0x1a1fcb=_0x3140[_0x505241];return _0x1a1fcb;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['show']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0314('0x9')]('/:id/fields',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0x10')]);router[_0x0314('0xf')]('/:id/configurations',auth[_0x0314('0xa')](),controller[_0x0314('0x11')]);router[_0x0314('0x12')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller[_0x0314('0x13')]);router[_0x0314('0x14')]('/:id',auth[_0x0314('0xa')](),controller[_0x0314('0x15')]);module[_0x0314('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index f7c14d6..5b55265 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 _0x1c0e=['STRING','sequelize','exports'];(function(_0x428377,_0xf1d70d){var _0x143839=function(_0x4522b6){while(--_0x4522b6){_0x428377['push'](_0x428377['shift']());}};_0x143839(++_0xf1d70d);}(_0x1c0e,0x106));var _0xe1c0=function(_0x18b62e,_0x131689){_0x18b62e=_0x18b62e-0x0;var _0x5ff385=_0x1c0e[_0x18b62e];return _0x5ff385;};'use strict';var Sequelize=require(_0xe1c0('0x0'));module[_0xe1c0('0x1')]={'name':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe1c0('0x2')]},'username':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe1c0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3c83=['STRING','HelpDesk','sequelize'];(function(_0xd65530,_0x9a58cd){var _0x317898=function(_0x752ea5){while(--_0x752ea5){_0xd65530['push'](_0xd65530['shift']());}};_0x317898(++_0x9a58cd);}(_0x3c83,0x19a));var _0x33c8=function(_0x210bae,_0x59502b){_0x210bae=_0x210bae-0x0;var _0x5a0766=_0x3c83[_0x210bae];return _0x5a0766;};'use strict';var Sequelize=require(_0x33c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x33c8('0x1')]},'username':{'type':Sequelize[_0x33c8('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c8('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x33c8('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 d7c736f..e5df411 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 _0x654c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','status','sendStatus','error','stack','name','send','map','VtigerAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','catch','getConfigurations','findOne','order','sort','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x654c,0xeb));var _0xc654=function(_0x1f6a13,_0x481807){_0x1f6a13=_0x1f6a13-0x0;var _0x1c4d2c=_0x654c[_0x1f6a13];return _0x1c4d2c;};'use strict';var emlformat=require(_0xc654('0x0'));var rimraf=require(_0xc654('0x1'));var zipdir=require(_0xc654('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc654('0x3'));var moment=require(_0xc654('0x4'));var BPromise=require(_0xc654('0x5'));var Mustache=require(_0xc654('0x6'));var util=require(_0xc654('0x7'));var path=require(_0xc654('0x8'));var sox=require(_0xc654('0x9'));var csv=require(_0xc654('0xa'));var ejs=require(_0xc654('0xb'));var fs=require('fs');var fs_extra=require(_0xc654('0xc'));var _=require(_0xc654('0xd'));var squel=require(_0xc654('0xe'));var crypto=require(_0xc654('0xf'));var jsforce=require(_0xc654('0x10'));var deskjs=require(_0xc654('0x11'));var toCsv=require(_0xc654('0xa'));var querystring=require(_0xc654('0x12'));var Papa=require(_0xc654('0x13'));var Redis=require(_0xc654('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc654('0x15'));var as=require(_0xc654('0x16'));var hardwareService=require(_0xc654('0x17'));var logger=require('../../config/logger')(_0xc654('0x18'));var utils=require(_0xc654('0x19'));var config=require(_0xc654('0x1a'));var licenseUtil=require(_0xc654('0x1b'));var db=require(_0xc654('0x1c'))['db'];var integrations=require(_0xc654('0x1d'));function respondWithStatusCode(_0x268b58,_0x4714ed){_0x4714ed=_0x4714ed||0xcc;return function(_0x315e2f){if(_0x315e2f){return _0x268b58['sendStatus'](_0x4714ed);}return _0x268b58['status'](_0x4714ed)[_0xc654('0x1e')]();};}function respondWithResult(_0x1ac9da,_0x3afe8e){_0x3afe8e=_0x3afe8e||0xc8;return function(_0x3e59ac){if(_0x3e59ac){return _0x1ac9da['status'](_0x3afe8e)[_0xc654('0x1f')](_0x3e59ac);}};}function respondWithFilteredResult(_0x58ceb3,_0x13a4bb){return function(_0x2701f6){if(_0x2701f6){var _0x153490=typeof _0x13a4bb[_0xc654('0x20')]===_0xc654('0x21')&&typeof _0x13a4bb[_0xc654('0x22')]===_0xc654('0x21');var _0x166c7b=_0x2701f6['count'];var _0x4dfd3a=_0x153490?0x0:_0x13a4bb[_0xc654('0x20')];var _0x5378e7=_0x153490?_0x2701f6['count']:_0x13a4bb['offset']+_0x13a4bb['limit'];var _0x3bcb54;if(_0x5378e7>=_0x166c7b){_0x5378e7=_0x166c7b;_0x3bcb54=0xc8;}else{_0x3bcb54=0xce;}_0x58ceb3['status'](_0x3bcb54);return _0x58ceb3[_0xc654('0x23')](_0xc654('0x24'),_0x4dfd3a+'-'+_0x5378e7+'/'+_0x166c7b)[_0xc654('0x1f')](_0x2701f6);}return null;};}function patchUpdates(_0x5eafc6){return function(_0x4deb35){try{jsonpatch[_0xc654('0x25')](_0x4deb35,_0x5eafc6,!![]);}catch(_0x13a814){return BPromise[_0xc654('0x26')](_0x13a814);}return _0x4deb35[_0xc654('0x27')]();};}function saveUpdates(_0x2baf04,_0x58a374){return function(_0x239281){if(_0x239281){return _0x239281[_0xc654('0x28')](_0x2baf04)['then'](function(_0x224b56){return _0x224b56;});}return null;};}function removeEntity(_0x38a571,_0x708bff){return function(_0x199281){if(_0x199281){return _0x199281[_0xc654('0x29')]()[_0xc654('0x2a')](function(){_0x38a571[_0xc654('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225315,_0x4fed34){return function(_0xb0a723){if(!_0xb0a723){_0x225315[_0xc654('0x2c')](0x194);}return _0xb0a723;};}function handleError(_0x2b9f7a,_0x3c57ef){_0x3c57ef=_0x3c57ef||0x1f4;return function(_0x10777a){logger[_0xc654('0x2d')](_0x10777a[_0xc654('0x2e')]);if(_0x10777a[_0xc654('0x2f')]){delete _0x10777a[_0xc654('0x2f')];}_0x2b9f7a['status'](_0x3c57ef)[_0xc654('0x30')](_0x10777a);};}exports['index']=function(_0x2d2743,_0x422728){var _0x2ce937={},_0x1df5e8={},_0x3b4e68={'count':0x0,'rows':[]};var _0x214494=_[_0xc654('0x31')](db[_0xc654('0x32')]['rawAttributes'],function(_0x17ac86){return{'name':_0x17ac86['fieldName'],'type':_0x17ac86[_0xc654('0x33')][_0xc654('0x34')]};});_0x1df5e8[_0xc654('0x35')]=_['map'](_0x214494,_0xc654('0x2f'));_0x1df5e8[_0xc654('0x36')]=_[_0xc654('0x37')](_0x2d2743[_0xc654('0x36')]);_0x1df5e8[_0xc654('0x38')]=_[_0xc654('0x39')](_0x1df5e8[_0xc654('0x35')],_0x1df5e8['query']);_0x2ce937[_0xc654('0x3a')]=_[_0xc654('0x39')](_0x1df5e8['model'],qs[_0xc654('0x3b')](_0x2d2743[_0xc654('0x36')][_0xc654('0x3b')]));_0x2ce937[_0xc654('0x3a')]=_0x2ce937[_0xc654('0x3a')][_0xc654('0x3c')]?_0x2ce937[_0xc654('0x3a')]:_0x1df5e8[_0xc654('0x35')];if(!_0x2d2743[_0xc654('0x36')][_0xc654('0x3d')](_0xc654('0x3e'))){_0x2ce937[_0xc654('0x22')]=qs['limit'](_0x2d2743['query']['limit']);_0x2ce937[_0xc654('0x20')]=qs[_0xc654('0x20')](_0x2d2743[_0xc654('0x36')][_0xc654('0x20')]);}_0x2ce937['order']=qs['sort'](_0x2d2743[_0xc654('0x36')]['sort']);_0x2ce937[_0xc654('0x3f')]=qs[_0xc654('0x38')](_['pick'](_0x2d2743['query'],_0x1df5e8['filters']),_0x214494);if(_0x2d2743[_0xc654('0x36')][_0xc654('0x40')]){_0x2ce937[_0xc654('0x3f')]=_[_0xc654('0x41')](_0x2ce937[_0xc654('0x3f')],{'$or':_['map'](_0x214494,function(_0x1f9202){if(_0x1f9202[_0xc654('0x33')]!==_0xc654('0x42')){var _0x5c7396={};_0x5c7396[_0x1f9202[_0xc654('0x2f')]]={'$like':'%'+_0x2d2743['query']['filter']+'%'};return _0x5c7396;}})});}_0x2ce937=_['merge']({},_0x2ce937,_0x2d2743[_0xc654('0x43')]);var _0x4c1565={'where':_0x2ce937[_0xc654('0x3f')]};return db[_0xc654('0x32')][_0xc654('0x44')](_0x4c1565)['then'](function(_0x4ff37c){_0x3b4e68[_0xc654('0x44')]=_0x4ff37c;if(_0x2d2743[_0xc654('0x36')]['includeAll']){_0x2ce937['include']=[{'all':!![]}];}return db[_0xc654('0x32')][_0xc654('0x45')](_0x2ce937);})[_0xc654('0x2a')](function(_0x449dd2){_0x3b4e68[_0xc654('0x46')]=_0x449dd2;return _0x3b4e68;})[_0xc654('0x2a')](respondWithFilteredResult(_0x422728,_0x2ce937))['catch'](handleError(_0x422728,null));};exports[_0xc654('0x47')]=function(_0x19eff2,_0x287344){var _0x3081dc={'raw':![],'where':{'id':_0x19eff2[_0xc654('0x48')]['id']}},_0x407fec={};_0x407fec['model']=_['keys'](db['VtigerAccount'][_0xc654('0x49')]);_0x407fec[_0xc654('0x36')]=_['keys'](_0x19eff2[_0xc654('0x36')]);_0x407fec[_0xc654('0x38')]=_[_0xc654('0x39')](_0x407fec['model'],_0x407fec[_0xc654('0x36')]);_0x3081dc[_0xc654('0x3a')]=_[_0xc654('0x39')](_0x407fec['model'],qs[_0xc654('0x3b')](_0x19eff2['query'][_0xc654('0x3b')]));_0x3081dc[_0xc654('0x3a')]=_0x3081dc[_0xc654('0x3a')][_0xc654('0x3c')]?_0x3081dc['attributes']:_0x407fec['model'];if(_0x19eff2['query'][_0xc654('0x4a')]){_0x3081dc[_0xc654('0x4b')]=[{'all':!![]}];}_0x3081dc=_[_0xc654('0x41')]({},_0x3081dc,_0x19eff2[_0xc654('0x43')]);return db['VtigerAccount'][_0xc654('0x4c')](_0x3081dc)[_0xc654('0x2a')](handleEntityNotFound(_0x287344,null))[_0xc654('0x2a')](respondWithResult(_0x287344,null))['catch'](handleError(_0x287344,null));};exports['create']=function(_0x12fca4,_0x502347){return db[_0xc654('0x32')][_0xc654('0x4d')](_0x12fca4[_0xc654('0x4e')],{})[_0xc654('0x2a')](respondWithResult(_0x502347,0xc9))[_0xc654('0x4f')](handleError(_0x502347,null));};exports[_0xc654('0x28')]=function(_0x28b134,_0x26b601){if(_0x28b134['body']['id']){delete _0x28b134['body']['id'];}return db[_0xc654('0x32')][_0xc654('0x4c')]({'where':{'id':_0x28b134['params']['id']}})[_0xc654('0x2a')](handleEntityNotFound(_0x26b601,null))['then'](saveUpdates(_0x28b134[_0xc654('0x4e')],null))[_0xc654('0x2a')](respondWithResult(_0x26b601,null))[_0xc654('0x4f')](handleError(_0x26b601,null));};exports[_0xc654('0x29')]=function(_0x240c89,_0x4741ae){return db[_0xc654('0x32')][_0xc654('0x4c')]({'where':{'id':_0x240c89[_0xc654('0x48')]['id']}})[_0xc654('0x2a')](handleEntityNotFound(_0x4741ae,null))[_0xc654('0x2a')](removeEntity(_0x4741ae,null))['catch'](handleError(_0x4741ae,null));};exports[_0xc654('0x50')]=function(_0x936c25,_0x2e8e22,_0x1b7c80){var _0x224a40={};var _0x9fd4c4={};var _0x3cd17e;var _0x4feace;return db[_0xc654('0x32')][_0xc654('0x51')]({'where':{'id':_0x936c25['params']['id']}})[_0xc654('0x2a')](handleEntityNotFound(_0x2e8e22,null))['then'](function(_0x40397a){if(_0x40397a){_0x3cd17e=_0x40397a;_0x9fd4c4['model']=_[_0xc654('0x37')](db['VtigerConfiguration'][_0xc654('0x49')]);_0x9fd4c4[_0xc654('0x36')]=_[_0xc654('0x37')](_0x936c25[_0xc654('0x36')]);_0x9fd4c4['filters']=_['intersection'](_0x9fd4c4['model'],_0x9fd4c4['query']);_0x224a40[_0xc654('0x3a')]=_[_0xc654('0x39')](_0x9fd4c4[_0xc654('0x35')],qs[_0xc654('0x3b')](_0x936c25[_0xc654('0x36')]['fields']));_0x224a40['attributes']=_0x224a40['attributes'][_0xc654('0x3c')]?_0x224a40[_0xc654('0x3a')]:_0x9fd4c4['model'];_0x224a40[_0xc654('0x52')]=qs[_0xc654('0x53')](_0x936c25[_0xc654('0x36')][_0xc654('0x53')]);_0x224a40[_0xc654('0x3f')]=qs['filters'](_['pick'](_0x936c25[_0xc654('0x36')],_0x9fd4c4[_0xc654('0x38')]));if(_0x936c25[_0xc654('0x36')]['filter']){_0x224a40[_0xc654('0x3f')]=_['merge'](_0x224a40['where'],{'$or':_[_0xc654('0x31')](_0x224a40[_0xc654('0x3a')],function(_0x24f6f0){var _0x4ab36e={};_0x4ab36e[_0x24f6f0]={'$like':'%'+_0x936c25[_0xc654('0x36')][_0xc654('0x40')]+'%'};return _0x4ab36e;})});}_0x224a40=_[_0xc654('0x41')]({},_0x224a40,_0x936c25['options']);return _0x3cd17e['getConfigurations'](_0x224a40);}})[_0xc654('0x2a')](function(_0x27d734){if(_0x27d734){_0x4feace=_0x27d734[_0xc654('0x3c')];if(!_0x936c25['query']['hasOwnProperty']('nolimit')){_0x224a40['limit']=qs[_0xc654('0x22')](_0x936c25[_0xc654('0x36')]['limit']);_0x224a40[_0xc654('0x20')]=qs[_0xc654('0x20')](_0x936c25['query'][_0xc654('0x20')]);}return _0x3cd17e[_0xc654('0x50')](_0x224a40);}})['then'](function(_0x5349aa){if(_0x5349aa){return _0x5349aa?{'count':_0x4feace,'rows':_0x5349aa}:null;}})[_0xc654('0x2a')](respondWithResult(_0x2e8e22,null))[_0xc654('0x4f')](handleError(_0x2e8e22,null));};exports[_0xc654('0x54')]=function(_0x493f65,_0x5f59f5,_0x4e5443){if(_0x493f65['body']['id']){delete _0x493f65[_0xc654('0x4e')]['id'];}return db[_0xc654('0x32')][_0xc654('0x51')]({'where':{'id':_0x493f65[_0xc654('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f59f5,null))[_0xc654('0x2a')](function(_0x68c4bc){if(_0x68c4bc){_0x493f65[_0xc654('0x4e')]['AccountId']=_0x68c4bc['id'];_0x493f65[_0xc654('0x4e')][_0xc654('0x55')]=integrations[_0xc654('0x56')](_0x493f65[_0xc654('0x4e')][_0xc654('0x57')],_0x493f65[_0xc654('0x4e')][_0xc654('0x33')]);_0x493f65[_0xc654('0x4e')][_0xc654('0x58')]=integrations[_0xc654('0x59')](_0x493f65[_0xc654('0x4e')][_0xc654('0x57')],_0x493f65[_0xc654('0x4e')][_0xc654('0x33')]);return db['VtigerConfiguration'][_0xc654('0x4d')](_0x493f65[_0xc654('0x4e')],{'include':[{'model':db[_0xc654('0x5a')],'as':_0xc654('0x55')},{'model':db[_0xc654('0x5a')],'as':_0xc654('0x58')}]});}return null;})[_0xc654('0x2a')](respondWithResult(_0x5f59f5,null))[_0xc654('0x4f')](handleError(_0x5f59f5,null));};var md5=require(_0xc654('0x5b'));exports[_0xc654('0x5c')]=function(_0x2753fb,_0x3a5b7,_0x484cd9){var _0x55504a=null;var _0x5245ee=null;var _0x1ee394=null;var _0x44e547=null;var _0x271fa8='';return db[_0xc654('0x32')]['findOne']({'where':{'id':_0x2753fb[_0xc654('0x48')]['id']},'attributes':['id',_0xc654('0x2f'),_0xc654('0x5d'),_0xc654('0x5e'),_0xc654('0x5f'),_0xc654('0x60'),_0xc654('0x61'),_0xc654('0x62')]})[_0xc654('0x2a')](handleEntityNotFound(_0x3a5b7,null))[_0xc654('0x2a')](function(_0xbc9154){if(_0xbc9154){_0x55504a=_0xbc9154['username'];_0x5245ee=_0xbc9154[_0xc654('0x62')];_0x1ee394=_0xbc9154[_0xc654('0x5f')];_0x271fa8=_0xbc9154[_0xc654('0x60')];var _0x5f4d47=_0x271fa8['slice'](-0x1);if(_0x5f4d47==='/'){_0x271fa8=_0x271fa8[_0xc654('0x63')](0x0,_0x271fa8['lastIndexOf'](_0x5f4d47));}_0x44e547=util[_0xc654('0x64')](_0xc654('0x65'),_0x271fa8);var _0x157fb2={'method':_0xc654('0x66'),'uri':_0x44e547,'qs':{'operation':_0xc654('0x67'),'username':_0xbc9154[_0xc654('0x5d')]},'json':!![]};return rp(_0x157fb2);}})['then'](function(_0x3e7dc1){if(_0x3e7dc1['success']){var _0xb57d9e={'method':_0xc654('0x68'),'uri':_0x44e547,'form':{'operation':_0xc654('0x69'),'username':_0x55504a,'accessKey':md5(_0x3e7dc1[_0xc654('0x6a')][_0xc654('0x6b')]+_0x5245ee)},'json':!![]};return rp(_0xb57d9e);}})['then'](function(_0x6cdb82){if(_0x6cdb82[_0xc654('0x6c')]){var _0x473264={'method':_0xc654('0x66'),'uri':_0x44e547,'qs':{'operation':_0xc654('0x6d'),'username':_0x55504a,'sessionName':_0x6cdb82[_0xc654('0x6a')][_0xc654('0x6e')],'elementType':_0x1ee394},'json':!![]};return rp(_0x473264);}})[_0xc654('0x2a')](function(_0x2ddaef){if(_0x2ddaef[_0xc654('0x6c')]){var _0x1771ef=[_0xc654('0x6f'),'reference',_0xc654('0x70')];_[_0xc654('0x71')](_0x2ddaef[_0xc654('0x6a')]['fields'],function(_0x442dcb){return _0x1771ef[_0xc654('0x72')](_0x442dcb[_0xc654('0x33')][_0xc654('0x2f')]);});_[_0xc654('0x71')](_0x2ddaef['result'][_0xc654('0x3b')],function(_0x1b3046){return _0x1b3046[_0xc654('0x73')]===_0xc654('0x74');});return{'count':_0x2ddaef[_0xc654('0x6a')]['fields'][_0xc654('0x3c')],'rows':_['map'](_0x2ddaef[_0xc654('0x6a')][_0xc654('0x3b')],function(_0x21834f){return{'id':_0x21834f[_0xc654('0x2f')],'name':_0x21834f[_0xc654('0x75')],'custom':_[_0xc654('0x76')](_0x21834f['name'],_0xc654('0x77'))?!![]:![],'options':_0x21834f[_0xc654('0x33')]['name']===_0xc654('0x78')&&_0x21834f[_0xc654('0x33')]['picklistValues']['length']>0x0?_[_0xc654('0x31')](_0x21834f[_0xc654('0x33')][_0xc654('0x79')],function(_0x198f1c){return{'name':_0x198f1c[_0xc654('0x75')],'value':_0x198f1c[_0xc654('0x7a')]};}):[]};})};}})[_0xc654('0x2a')](respondWithResult(_0x3a5b7,null))[_0xc654('0x4f')](function(_0x38f3a0){console[_0xc654('0x7b')](_0xc654('0x7c')+_0x38f3a0);var _0x1e03dd=_0x2753fb[_0xc654('0x36')][_0xc654('0x7d')]?0x1f4:_0x38f3a0['statusCode']||0x1f4;logger[_0xc654('0x2d')](_0xc654('0x7e'),_0xc654('0x5c'),_0x1e03dd,JSON[_0xc654('0x7f')](_0x38f3a0));delete _0x38f3a0[_0xc654('0x2f')];if(_0x1e03dd===0x191){_0x1e03dd=0x190;}_0x3a5b7[_0xc654('0x2b')](_0x1e03dd)[_0xc654('0x30')](_0x2753fb[_0xc654('0x36')][_0xc654('0x7d')]?{'message':_0xc654('0x80'),'statusCode':_0x38f3a0[_0xc654('0x81')]}:_0x38f3a0);});}; \ No newline at end of file +var _0x060e=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','VtigerAccount','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','username','description','moduleName','serverUrl','accessKey','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x21bc67,_0xf4ed68){var _0x31d142=function(_0x19daa7){while(--_0x19daa7){_0x21bc67['push'](_0x21bc67['shift']());}};_0x31d142(++_0xf4ed68);}(_0x060e,0x1ea));var _0xe060=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0x060e[_0x2812c2];return _0x218ac9;};'use strict';var emlformat=require(_0xe060('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe060('0x1'));var jsonpatch=require(_0xe060('0x2'));var rp=require(_0xe060('0x3'));var moment=require(_0xe060('0x4'));var BPromise=require(_0xe060('0x5'));var Mustache=require(_0xe060('0x6'));var util=require(_0xe060('0x7'));var path=require(_0xe060('0x8'));var sox=require(_0xe060('0x9'));var csv=require(_0xe060('0xa'));var ejs=require(_0xe060('0xb'));var fs=require('fs');var fs_extra=require(_0xe060('0xc'));var _=require(_0xe060('0xd'));var squel=require(_0xe060('0xe'));var crypto=require('crypto');var jsforce=require(_0xe060('0xf'));var deskjs=require(_0xe060('0x10'));var toCsv=require(_0xe060('0xa'));var querystring=require('querystring');var Papa=require(_0xe060('0x11'));var Redis=require(_0xe060('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe060('0x13'));var as=require(_0xe060('0x14'));var hardwareService=require(_0xe060('0x15'));var logger=require(_0xe060('0x16'))(_0xe060('0x17'));var utils=require(_0xe060('0x18'));var config=require(_0xe060('0x19'));var licenseUtil=require(_0xe060('0x1a'));var db=require(_0xe060('0x1b'))['db'];var integrations=require(_0xe060('0x1c'));function respondWithStatusCode(_0x5939cb,_0x45bb63){_0x45bb63=_0x45bb63||0xcc;return function(_0x50046){if(_0x50046){return _0x5939cb[_0xe060('0x1d')](_0x45bb63);}return _0x5939cb[_0xe060('0x1e')](_0x45bb63)[_0xe060('0x1f')]();};}function respondWithResult(_0xab13cf,_0xb8a84e){_0xb8a84e=_0xb8a84e||0xc8;return function(_0x35ec73){if(_0x35ec73){return _0xab13cf[_0xe060('0x1e')](_0xb8a84e)['json'](_0x35ec73);}};}function respondWithFilteredResult(_0x5d5197,_0x200ea8){return function(_0xeb59f4){if(_0xeb59f4){var _0x450894=typeof _0x200ea8[_0xe060('0x20')]==='undefined'&&typeof _0x200ea8[_0xe060('0x21')]===_0xe060('0x22');var _0x2f5d9f=_0xeb59f4[_0xe060('0x23')];var _0x176b6d=_0x450894?0x0:_0x200ea8[_0xe060('0x20')];var _0x4783d9=_0x450894?_0xeb59f4[_0xe060('0x23')]:_0x200ea8['offset']+_0x200ea8[_0xe060('0x21')];var _0x2e288b;if(_0x4783d9>=_0x2f5d9f){_0x4783d9=_0x2f5d9f;_0x2e288b=0xc8;}else{_0x2e288b=0xce;}_0x5d5197['status'](_0x2e288b);return _0x5d5197[_0xe060('0x24')](_0xe060('0x25'),_0x176b6d+'-'+_0x4783d9+'/'+_0x2f5d9f)[_0xe060('0x26')](_0xeb59f4);}return null;};}function patchUpdates(_0x561083){return function(_0x7a698a){try{jsonpatch[_0xe060('0x27')](_0x7a698a,_0x561083,!![]);}catch(_0x46d229){return BPromise[_0xe060('0x28')](_0x46d229);}return _0x7a698a[_0xe060('0x29')]();};}function saveUpdates(_0x8bf4b7,_0x757f67){return function(_0x3f87a8){if(_0x3f87a8){return _0x3f87a8[_0xe060('0x2a')](_0x8bf4b7)[_0xe060('0x2b')](function(_0x26cf0f){return _0x26cf0f;});}return null;};}function removeEntity(_0x10f36b,_0x1a5184){return function(_0x571ed3){if(_0x571ed3){return _0x571ed3[_0xe060('0x2c')]()[_0xe060('0x2b')](function(){_0x10f36b[_0xe060('0x1e')](0xcc)[_0xe060('0x1f')]();});}};}function handleEntityNotFound(_0x413441,_0x31d1bd){return function(_0x52f561){if(!_0x52f561){_0x413441['sendStatus'](0x194);}return _0x52f561;};}function handleError(_0x3a78e2,_0x35dd0d){_0x35dd0d=_0x35dd0d||0x1f4;return function(_0x287c85){logger[_0xe060('0x2d')](_0x287c85[_0xe060('0x2e')]);if(_0x287c85['name']){delete _0x287c85['name'];}_0x3a78e2[_0xe060('0x1e')](_0x35dd0d)[_0xe060('0x2f')](_0x287c85);};}exports[_0xe060('0x30')]=function(_0x330f88,_0x47102f){var _0x406b58={},_0x2157a0={},_0x44c0d1={'count':0x0,'rows':[]};var _0x20400b=_['map'](db[_0xe060('0x31')][_0xe060('0x32')],function(_0x112227){return{'name':_0x112227[_0xe060('0x33')],'type':_0x112227['type'][_0xe060('0x34')]};});_0x2157a0[_0xe060('0x35')]=_[_0xe060('0x36')](_0x20400b,_0xe060('0x37'));_0x2157a0[_0xe060('0x38')]=_['keys'](_0x330f88[_0xe060('0x38')]);_0x2157a0[_0xe060('0x39')]=_[_0xe060('0x3a')](_0x2157a0[_0xe060('0x35')],_0x2157a0[_0xe060('0x38')]);_0x406b58[_0xe060('0x3b')]=_[_0xe060('0x3a')](_0x2157a0[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x330f88['query']['fields']));_0x406b58[_0xe060('0x3b')]=_0x406b58[_0xe060('0x3b')][_0xe060('0x3d')]?_0x406b58['attributes']:_0x2157a0[_0xe060('0x35')];if(!_0x330f88[_0xe060('0x38')][_0xe060('0x3e')](_0xe060('0x3f'))){_0x406b58[_0xe060('0x21')]=qs[_0xe060('0x21')](_0x330f88[_0xe060('0x38')][_0xe060('0x21')]);_0x406b58[_0xe060('0x20')]=qs['offset'](_0x330f88[_0xe060('0x38')][_0xe060('0x20')]);}_0x406b58[_0xe060('0x40')]=qs['sort'](_0x330f88[_0xe060('0x38')][_0xe060('0x41')]);_0x406b58[_0xe060('0x42')]=qs[_0xe060('0x39')](_[_0xe060('0x43')](_0x330f88[_0xe060('0x38')],_0x2157a0[_0xe060('0x39')]),_0x20400b);if(_0x330f88['query'][_0xe060('0x44')]){_0x406b58['where']=_[_0xe060('0x45')](_0x406b58[_0xe060('0x42')],{'$or':_['map'](_0x20400b,function(_0x420fb0){if(_0x420fb0['type']!==_0xe060('0x46')){var _0x5f4c65={};_0x5f4c65[_0x420fb0[_0xe060('0x37')]]={'$like':'%'+_0x330f88['query']['filter']+'%'};return _0x5f4c65;}})});}_0x406b58=_['merge']({},_0x406b58,_0x330f88[_0xe060('0x47')]);var _0x2593f1={'where':_0x406b58['where']};return db[_0xe060('0x31')][_0xe060('0x23')](_0x2593f1)[_0xe060('0x2b')](function(_0x58c4d1){_0x44c0d1[_0xe060('0x23')]=_0x58c4d1;if(_0x330f88[_0xe060('0x38')][_0xe060('0x48')]){_0x406b58[_0xe060('0x49')]=[{'all':!![]}];}return db[_0xe060('0x31')]['findAll'](_0x406b58);})[_0xe060('0x2b')](function(_0x43e04a){_0x44c0d1[_0xe060('0x4a')]=_0x43e04a;return _0x44c0d1;})['then'](respondWithFilteredResult(_0x47102f,_0x406b58))[_0xe060('0x4b')](handleError(_0x47102f,null));};exports[_0xe060('0x4c')]=function(_0x4f2c90,_0x4c8095){var _0x20872f={'raw':![],'where':{'id':_0x4f2c90[_0xe060('0x4d')]['id']}},_0x98a148={};_0x98a148[_0xe060('0x35')]=_['keys'](db['VtigerAccount'][_0xe060('0x32')]);_0x98a148[_0xe060('0x38')]=_[_0xe060('0x4e')](_0x4f2c90[_0xe060('0x38')]);_0x98a148[_0xe060('0x39')]=_[_0xe060('0x3a')](_0x98a148[_0xe060('0x35')],_0x98a148['query']);_0x20872f['attributes']=_['intersection'](_0x98a148[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x4f2c90[_0xe060('0x38')][_0xe060('0x3c')]));_0x20872f['attributes']=_0x20872f[_0xe060('0x3b')][_0xe060('0x3d')]?_0x20872f[_0xe060('0x3b')]:_0x98a148[_0xe060('0x35')];if(_0x4f2c90[_0xe060('0x38')][_0xe060('0x48')]){_0x20872f['include']=[{'all':!![]}];}_0x20872f=_[_0xe060('0x45')]({},_0x20872f,_0x4f2c90[_0xe060('0x47')]);return db[_0xe060('0x31')]['find'](_0x20872f)[_0xe060('0x2b')](handleEntityNotFound(_0x4c8095,null))[_0xe060('0x2b')](respondWithResult(_0x4c8095,null))[_0xe060('0x4b')](handleError(_0x4c8095,null));};exports[_0xe060('0x4f')]=function(_0x22fa24,_0x5b2518){return db[_0xe060('0x31')][_0xe060('0x4f')](_0x22fa24[_0xe060('0x50')],{})[_0xe060('0x2b')](respondWithResult(_0x5b2518,0xc9))[_0xe060('0x4b')](handleError(_0x5b2518,null));};exports['update']=function(_0x5bf2e3,_0x2e60e5){if(_0x5bf2e3[_0xe060('0x50')]['id']){delete _0x5bf2e3[_0xe060('0x50')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x5bf2e3[_0xe060('0x4d')]['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x2e60e5,null))[_0xe060('0x2b')](saveUpdates(_0x5bf2e3[_0xe060('0x50')],null))[_0xe060('0x2b')](respondWithResult(_0x2e60e5,null))[_0xe060('0x4b')](handleError(_0x2e60e5,null));};exports[_0xe060('0x2c')]=function(_0x466f31,_0x3855f5){return db[_0xe060('0x31')][_0xe060('0x51')]({'where':{'id':_0x466f31[_0xe060('0x4d')]['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x3855f5,null))[_0xe060('0x2b')](removeEntity(_0x3855f5,null))['catch'](handleError(_0x3855f5,null));};exports['getConfigurations']=function(_0x196876,_0x3a0950,_0x5aae16){var _0x54473f={};var _0x2a2e89={};var _0x4e24ee;var _0x12c648;return db[_0xe060('0x31')][_0xe060('0x52')]({'where':{'id':_0x196876['params']['id']}})[_0xe060('0x2b')](handleEntityNotFound(_0x3a0950,null))[_0xe060('0x2b')](function(_0x111c3e){if(_0x111c3e){_0x4e24ee=_0x111c3e;_0x2a2e89[_0xe060('0x35')]=_[_0xe060('0x4e')](db['VtigerConfiguration'][_0xe060('0x32')]);_0x2a2e89[_0xe060('0x38')]=_[_0xe060('0x4e')](_0x196876['query']);_0x2a2e89[_0xe060('0x39')]=_['intersection'](_0x2a2e89[_0xe060('0x35')],_0x2a2e89[_0xe060('0x38')]);_0x54473f[_0xe060('0x3b')]=_['intersection'](_0x2a2e89[_0xe060('0x35')],qs[_0xe060('0x3c')](_0x196876[_0xe060('0x38')][_0xe060('0x3c')]));_0x54473f['attributes']=_0x54473f[_0xe060('0x3b')][_0xe060('0x3d')]?_0x54473f[_0xe060('0x3b')]:_0x2a2e89['model'];_0x54473f[_0xe060('0x40')]=qs[_0xe060('0x41')](_0x196876[_0xe060('0x38')][_0xe060('0x41')]);_0x54473f[_0xe060('0x42')]=qs[_0xe060('0x39')](_[_0xe060('0x43')](_0x196876[_0xe060('0x38')],_0x2a2e89[_0xe060('0x39')]));if(_0x196876[_0xe060('0x38')][_0xe060('0x44')]){_0x54473f[_0xe060('0x42')]=_[_0xe060('0x45')](_0x54473f['where'],{'$or':_[_0xe060('0x36')](_0x54473f[_0xe060('0x3b')],function(_0x1ed542){var _0x26b9f4={};_0x26b9f4[_0x1ed542]={'$like':'%'+_0x196876[_0xe060('0x38')][_0xe060('0x44')]+'%'};return _0x26b9f4;})});}_0x54473f=_['merge']({},_0x54473f,_0x196876['options']);return _0x4e24ee['getConfigurations'](_0x54473f);}})['then'](function(_0x91b8ba){if(_0x91b8ba){_0x12c648=_0x91b8ba[_0xe060('0x3d')];if(!_0x196876[_0xe060('0x38')][_0xe060('0x3e')](_0xe060('0x3f'))){_0x54473f[_0xe060('0x21')]=qs['limit'](_0x196876[_0xe060('0x38')][_0xe060('0x21')]);_0x54473f[_0xe060('0x20')]=qs[_0xe060('0x20')](_0x196876[_0xe060('0x38')][_0xe060('0x20')]);}return _0x4e24ee['getConfigurations'](_0x54473f);}})[_0xe060('0x2b')](function(_0x45e42d){if(_0x45e42d){return _0x45e42d?{'count':_0x12c648,'rows':_0x45e42d}:null;}})[_0xe060('0x2b')](respondWithResult(_0x3a0950,null))[_0xe060('0x4b')](handleError(_0x3a0950,null));};exports[_0xe060('0x53')]=function(_0x2569b0,_0x8493f8,_0x14abf7){if(_0x2569b0[_0xe060('0x50')]['id']){delete _0x2569b0[_0xe060('0x50')]['id'];}return db['VtigerAccount'][_0xe060('0x52')]({'where':{'id':_0x2569b0[_0xe060('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8493f8,null))[_0xe060('0x2b')](function(_0x382374){if(_0x382374){_0x2569b0[_0xe060('0x50')][_0xe060('0x54')]=_0x382374['id'];_0x2569b0[_0xe060('0x50')][_0xe060('0x55')]=integrations[_0xe060('0x56')](_0x2569b0[_0xe060('0x50')][_0xe060('0x57')],_0x2569b0[_0xe060('0x50')][_0xe060('0x58')]);_0x2569b0[_0xe060('0x50')][_0xe060('0x59')]=integrations[_0xe060('0x5a')](_0x2569b0['body'][_0xe060('0x57')],_0x2569b0['body']['type']);return db[_0xe060('0x5b')][_0xe060('0x4f')](_0x2569b0[_0xe060('0x50')],{'include':[{'model':db[_0xe060('0x5c')],'as':'Subjects'},{'model':db[_0xe060('0x5c')],'as':_0xe060('0x59')}]});}return null;})['then'](respondWithResult(_0x8493f8,null))[_0xe060('0x4b')](handleError(_0x8493f8,null));};var md5=require('md5');exports[_0xe060('0x5d')]=function(_0x4efa7d,_0x4bb528,_0x297dbd){var _0x595b06=null;var _0x542843=null;var _0x217c3d=null;var _0x2905b7=null;var _0x2a480a='';return db[_0xe060('0x31')][_0xe060('0x52')]({'where':{'id':_0x4efa7d[_0xe060('0x4d')]['id']},'attributes':['id',_0xe060('0x37'),_0xe060('0x5e'),_0xe060('0x5f'),_0xe060('0x60'),'remoteUri',_0xe060('0x61'),_0xe060('0x62')]})['then'](handleEntityNotFound(_0x4bb528,null))[_0xe060('0x2b')](function(_0x3da2ea){if(_0x3da2ea){_0x595b06=_0x3da2ea[_0xe060('0x5e')];_0x542843=_0x3da2ea[_0xe060('0x62')];_0x217c3d=_0x3da2ea[_0xe060('0x60')];_0x2a480a=_0x3da2ea['remoteUri'];var _0x110b44=_0x2a480a['slice'](-0x1);if(_0x110b44==='/'){_0x2a480a=_0x2a480a['substring'](0x0,_0x2a480a[_0xe060('0x63')](_0x110b44));}_0x2905b7=util[_0xe060('0x64')]('%s/webservice.php',_0x2a480a);var _0x5d0dbd={'method':_0xe060('0x65'),'uri':_0x2905b7,'qs':{'operation':_0xe060('0x66'),'username':_0x3da2ea['username']},'json':!![]};return rp(_0x5d0dbd);}})[_0xe060('0x2b')](function(_0x29adb4){if(_0x29adb4[_0xe060('0x67')]){var _0x45312b={'method':_0xe060('0x68'),'uri':_0x2905b7,'form':{'operation':_0xe060('0x69'),'username':_0x595b06,'accessKey':md5(_0x29adb4[_0xe060('0x6a')][_0xe060('0x6b')]+_0x542843)},'json':!![]};return rp(_0x45312b);}})[_0xe060('0x2b')](function(_0x4ef6f3){if(_0x4ef6f3['success']){var _0x3b3ab0={'method':'GET','uri':_0x2905b7,'qs':{'operation':_0xe060('0x6c'),'username':_0x595b06,'sessionName':_0x4ef6f3[_0xe060('0x6a')]['sessionName'],'elementType':_0x217c3d},'json':!![]};return rp(_0x3b3ab0);}})[_0xe060('0x2b')](function(_0x52efa2){if(_0x52efa2['success']){var _0x3fedbb=['autogenerated',_0xe060('0x6d'),_0xe060('0x6e')];_['remove'](_0x52efa2[_0xe060('0x6a')]['fields'],function(_0x111d97){return _0x3fedbb[_0xe060('0x6f')](_0x111d97[_0xe060('0x58')]['name']);});_[_0xe060('0x70')](_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')],function(_0x2a9d02){return _0x2a9d02[_0xe060('0x71')]===_0xe060('0x72');});return{'count':_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')][_0xe060('0x3d')],'rows':_[_0xe060('0x36')](_0x52efa2[_0xe060('0x6a')][_0xe060('0x3c')],function(_0x34db10){return{'id':_0x34db10[_0xe060('0x37')],'name':_0x34db10[_0xe060('0x73')],'custom':_[_0xe060('0x74')](_0x34db10[_0xe060('0x37')],_0xe060('0x75'))?!![]:![],'options':_0x34db10['type'][_0xe060('0x37')]===_0xe060('0x76')&&_0x34db10[_0xe060('0x58')][_0xe060('0x77')][_0xe060('0x3d')]>0x0?_[_0xe060('0x36')](_0x34db10[_0xe060('0x58')][_0xe060('0x77')],function(_0x5415f4){return{'name':_0x5415f4[_0xe060('0x73')],'value':_0x5415f4[_0xe060('0x78')]};}):[]};})};}})[_0xe060('0x2b')](respondWithResult(_0x4bb528,null))[_0xe060('0x4b')](function(_0x23f46b){console['log'](_0xe060('0x79')+_0x23f46b);var _0x1d22fd=_0x4efa7d['query'][_0xe060('0x7a')]?0x1f4:_0x23f46b[_0xe060('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe060('0x5d'),_0x1d22fd,JSON['stringify'](_0x23f46b));delete _0x23f46b[_0xe060('0x37')];if(_0x1d22fd===0x191){_0x1d22fd=0x190;}_0x4bb528[_0xe060('0x1e')](_0x1d22fd)['send'](_0x4efa7d[_0xe060('0x38')][_0xe060('0x7a')]?{'message':_0xe060('0x7c'),'statusCode':_0x23f46b['statusCode']}:_0x23f46b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4f37581..dcedda4 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 _0x5643=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','util','../../config/logger'];(function(_0x20df9a,_0x5809ea){var _0x3b16f0=function(_0x3c218d){while(--_0x3c218d){_0x20df9a['push'](_0x20df9a['shift']());}};_0x3b16f0(++_0x5809ea);}(_0x5643,0xe5));var _0x3564=function(_0x35cffb,_0x2fe917){_0x35cffb=_0x35cffb-0x0;var _0x352fcb=_0x5643[_0x35cffb];return _0x352fcb;};'use strict';var _=require('lodash');var util=require(_0x3564('0x0'));var logger=require(_0x3564('0x1'))(_0x3564('0x2'));var moment=require(_0x3564('0x3'));var BPromise=require(_0x3564('0x4'));var rp=require(_0x3564('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3564('0x6'));var config=require(_0x3564('0x7'));var attributes=require(_0x3564('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xe39bd1,_0x3c3e5f){return _0xe39bd1[_0x3564('0x9')]('VtigerAccount',attributes,{'tableName':_0x3564('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5915=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount'];(function(_0x4855d7,_0x533b87){var _0x8b0352=function(_0x56b162){while(--_0x56b162){_0x4855d7['push'](_0x4855d7['shift']());}};_0x8b0352(++_0x533b87);}(_0x5915,0x1ec));var _0x5591=function(_0x4cb50c,_0x6f6c27){_0x4cb50c=_0x4cb50c-0x0;var _0x334ed8=_0x5915[_0x4cb50c];return _0x334ed8;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var logger=require(_0x5591('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5591('0x3'));var rp=require(_0x5591('0x4'));var fs=require('fs');var path=require(_0x5591('0x5'));var rimraf=require(_0x5591('0x6'));var config=require(_0x5591('0x7'));var attributes=require(_0x5591('0x8'));var integrations=require(_0x5591('0x9'));module['exports']=function(_0x58d26e,_0x5ba182){return _0x58d26e[_0x5591('0xa')](_0x5591('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index c28661c..23362c9 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 _0x7072=['model','then','ShowVtigerAccount','VtigerAccount','find','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','include'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x7072,0x138));var _0x2707=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x7072[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});}exports[_0x2707('0x15')]=function(_0x4a8b7f){var _0x119ac4=this;return new Promise(function(_0x449a61,_0x4009f3){return db['VtigerAccount']['findAll']({'raw':_0x4a8b7f['options']?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x19')]||null:null,'limit':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1a')]||null:null,'include':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')]?_['map'](_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')],function(_0x46259e){return{'model':db[_0x46259e[_0x2707('0x1c')]],'as':_0x46259e['as'],'attributes':_0x46259e[_0x2707('0x19')],'include':_0x46259e[_0x2707('0x1b')]?_['map'](_0x46259e[_0x2707('0x1b')],function(_0x3f6976){return{'model':db[_0x3f6976[_0x2707('0x1c')]],'as':_0x3f6976['as'],'attributes':_0x3f6976[_0x2707('0x19')],'include':_0x3f6976[_0x2707('0x1b')]?_['map'](_0x3f6976[_0x2707('0x1b')],function(_0x4ca05d){return{'model':db[_0x4ca05d[_0x2707('0x1c')]],'as':_0x4ca05d['as'],'attributes':_0x4ca05d[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x57da26){logger[_0x2707('0xb')](_0x2707('0x15'),_0x4a8b7f);logger[_0x2707('0xe')]('GetVtigerAccount',_0x4a8b7f,JSON[_0x2707('0x10')](_0x57da26));_0x449a61(_0x57da26);})[_0x2707('0x14')](function(_0x4a99ce){logger[_0x2707('0x11')]('GetVtigerAccount',_0x4a99ce['message'],_0x4a8b7f);_0x4009f3(_0x119ac4[_0x2707('0x11')](0x1f4,_0x4a99ce['message']));});});};exports[_0x2707('0x1e')]=function(_0x3f153d){var _0x417a97=this;return new Promise(function(_0x36b2e9,_0x48832b){return db[_0x2707('0x1f')][_0x2707('0x20')]({'raw':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options'][_0x2707('0x19')]||null:null,'include':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options']['include']?_['map'](_0x3f153d['options']['include'],function(_0x137e04){return{'model':db[_0x137e04['model']],'as':_0x137e04['as'],'attributes':_0x137e04['attributes'],'include':_0x137e04[_0x2707('0x1b')]?_[_0x2707('0x21')](_0x137e04['include'],function(_0x473954){return{'model':db[_0x473954[_0x2707('0x1c')]],'as':_0x473954['as'],'attributes':_0x473954['attributes'],'include':_0x473954['include']?_[_0x2707('0x21')](_0x473954[_0x2707('0x1b')],function(_0x521edb){return{'model':db[_0x521edb['model']],'as':_0x521edb['as'],'attributes':_0x521edb[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x5a18b0){logger[_0x2707('0xb')](_0x2707('0x1e'),_0x3f153d);logger[_0x2707('0xe')](_0x2707('0x1e'),_0x3f153d,JSON[_0x2707('0x10')](_0x5a18b0));_0x36b2e9(_0x5a18b0);})[_0x2707('0x14')](function(_0x5bd2e5){logger[_0x2707('0x11')](_0x2707('0x1e'),_0x5bd2e5[_0x2707('0x13')],_0x3f153d);_0x48832b(_0x417a97[_0x2707('0x11')](0x1f4,_0x5bd2e5[_0x2707('0x13')]));});});}; \ No newline at end of file +var _0x36ee=['message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowVtigerAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa8563a,_0x3f4c62){var _0x322a97=function(_0x4fa06f){while(--_0x4fa06f){_0xa8563a['push'](_0xa8563a['shift']());}};_0x322a97(++_0x3f4c62);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')]({'raw':_0x2184ae['options']?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'limit':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')]['limit']||null:null,'include':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x2184ae[_0xe36e('0x1b')]['include'],function(_0x598a7a){return{'model':db[_0x598a7a[_0xe36e('0x21')]],'as':_0x598a7a['as'],'attributes':_0x598a7a[_0xe36e('0x1e')],'include':_0x598a7a[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x598a7a[_0xe36e('0x1f')],function(_0x1507f9){return{'model':db[_0x1507f9[_0xe36e('0x21')]],'as':_0x1507f9['as'],'attributes':_0x1507f9['attributes'],'include':_0x1507f9[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x1507f9[_0xe36e('0x1f')],function(_0x262caa){return{'model':db[_0x262caa['model']],'as':_0x262caa['as'],'attributes':_0x262caa[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf7b02e){logger['info'](_0xe36e('0x18'),_0x2184ae);logger['debug'](_0xe36e('0x18'),_0x2184ae,JSON['stringify'](_0xf7b02e));_0x21d9a3(_0xf7b02e);})[_0xe36e('0x17')](function(_0x59548b){logger['error']('GetVtigerAccount',_0x59548b['message'],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0x59548b[_0xe36e('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4ac819){var _0x1fa1ec=this;return new Promise(function(_0xb8d44e,_0x259e19){return db[_0xe36e('0x19')][_0xe36e('0x22')]({'raw':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'include':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')],function(_0xf808f5){return{'model':db[_0xf808f5['model']],'as':_0xf808f5['as'],'attributes':_0xf808f5[_0xe36e('0x1e')],'include':_0xf808f5['include']?_['map'](_0xf808f5[_0xe36e('0x1f')],function(_0x4f620d){return{'model':db[_0x4f620d[_0xe36e('0x21')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0xe36e('0x1e')],'include':_0x4f620d[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4f620d['include'],function(_0x56135c){return{'model':db[_0x56135c[_0xe36e('0x21')]],'as':_0x56135c['as'],'attributes':_0x56135c[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe36e('0xc')](function(_0x243338){logger['info'](_0xe36e('0x23'),_0x4ac819);logger[_0xe36e('0xe')](_0xe36e('0x23'),_0x4ac819,JSON['stringify'](_0x243338));_0xb8d44e(_0x243338);})[_0xe36e('0x17')](function(_0x2ff8f4){logger['error'](_0xe36e('0x23'),_0x2ff8f4[_0xe36e('0x14')],_0x4ac819);_0x259e19(_0x1fa1ec[_0xe36e('0x12')](0x1f4,_0x2ff8f4[_0xe36e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4f12ce4..498cf21 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 _0xd70d=['/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields'];(function(_0x5e10cd,_0x2f2fc5){var _0x316f09=function(_0x3e9fa7){while(--_0x3e9fa7){_0x5e10cd['push'](_0x5e10cd['shift']());}};_0x316f09(++_0x2f2fc5);}(_0xd70d,0x178));var _0xdd70=function(_0x14f0fd,_0x41d51e){_0x14f0fd=_0x14f0fd-0x0;var _0x128d3e=_0xd70d[_0x14f0fd];return _0x128d3e;};'use strict';var multer=require(_0xdd70('0x0'));var util=require(_0xdd70('0x1'));var path=require('path');var timeout=require(_0xdd70('0x2'));var express=require(_0xdd70('0x3'));var router=express[_0xdd70('0x4')]();var fs_extra=require(_0xdd70('0x5'));var auth=require(_0xdd70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdd70('0x7'));var controller=require(_0xdd70('0x8'));router[_0xdd70('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdd70('0x9')](_0xdd70('0xa'),auth['isAuthenticated'](),controller[_0xdd70('0xb')]);router['get'](_0xdd70('0xc'),auth[_0xdd70('0xd')](),controller[_0xdd70('0xe')]);router[_0xdd70('0x9')](_0xdd70('0xf'),auth['isAuthenticated'](),controller[_0xdd70('0x10')]);router[_0xdd70('0x9')]('/:id/descriptions',auth[_0xdd70('0xd')](),controller[_0xdd70('0x11')]);router[_0xdd70('0x12')]('/',auth['isAuthenticated'](),controller[_0xdd70('0x13')]);router['put'](_0xdd70('0xa'),auth['isAuthenticated'](),controller[_0xdd70('0x14')]);router[_0xdd70('0x15')](_0xdd70('0xa'),auth[_0xdd70('0xd')](),controller[_0xdd70('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb0ef=['/:id/fields','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated'];(function(_0x641eba,_0x534f52){var _0x48abd3=function(_0x15e01e){while(--_0x15e01e){_0x641eba['push'](_0x641eba['shift']());}};_0x48abd3(++_0x534f52);}(_0xb0ef,0x7c));var _0xfb0e=function(_0x14ac92,_0x2be788){_0x14ac92=_0x14ac92-0x0;var _0x5386f2=_0xb0ef[_0x14ac92];return _0x5386f2;};'use strict';var multer=require(_0xfb0e('0x0'));var util=require(_0xfb0e('0x1'));var path=require(_0xfb0e('0x2'));var timeout=require(_0xfb0e('0x3'));var express=require(_0xfb0e('0x4'));var router=express['Router']();var fs_extra=require(_0xfb0e('0x5'));var auth=require(_0xfb0e('0x6'));var interaction=require(_0xfb0e('0x7'));var config=require(_0xfb0e('0x8'));var controller=require(_0xfb0e('0x9'));router[_0xfb0e('0xa')]('/',auth['isAuthenticated'](),controller[_0xfb0e('0xb')]);router[_0xfb0e('0xa')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller['show']);router['get'](_0xfb0e('0xe'),auth[_0xfb0e('0xd')](),controller['getFields']);router[_0xfb0e('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xfb0e('0xf')]);router[_0xfb0e('0xa')](_0xfb0e('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xfb0e('0x11')]);router[_0xfb0e('0x12')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller[_0xfb0e('0x13')]);router[_0xfb0e('0x14')](_0xfb0e('0xc'),auth[_0xfb0e('0xd')](),controller[_0xfb0e('0x15')]);module[_0xfb0e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index a9235b4..98c1c5f 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 _0x216f=['sequelize'];(function(_0x548947,_0x1db601){var _0x3cbdb0=function(_0x4ad962){while(--_0x4ad962){_0x548947['push'](_0x548947['shift']());}};_0x3cbdb0(++_0x1db601);}(_0x216f,0xbb));var _0xf216=function(_0x4afe8e,_0x397670){_0x4afe8e=_0x4afe8e-0x0;var _0x16f1c7=_0x216f[_0x4afe8e];return _0x16f1c7;};'use strict';var Sequelize=require(_0xf216('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa932=['exports','STRING'];(function(_0x2ef4e7,_0x16ff25){var _0x1837f9=function(_0x1b5bfe){while(--_0x1b5bfe){_0x2ef4e7['push'](_0x2ef4e7['shift']());}};_0x1837f9(++_0x16ff25);}(_0xa932,0x1c8));var _0x2a93=function(_0x33de83,_0x5cd14a){_0x33de83=_0x33de83-0x0;var _0x2dc227=_0xa932[_0x33de83];return _0x2dc227;};'use strict';var Sequelize=require('sequelize');module[_0x2a93('0x0')]={'name':{'type':Sequelize[_0x2a93('0x1')]},'description':{'type':Sequelize[_0x2a93('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 748ba6c..35f34f0 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 _0x515d=['show','params','rawAttributes','length','find','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','catch'];(function(_0x50f94c,_0x3073e1){var _0x4fae84=function(_0xe0905){while(--_0xe0905){_0x50f94c['push'](_0x50f94c['shift']());}};_0x4fae84(++_0x3073e1);}(_0x515d,0x104));var _0xd515=function(_0x4e0351,_0x5928ce){_0x4e0351=_0x4e0351-0x0;var _0x8035bc=_0x515d[_0x4e0351];return _0x8035bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd515('0x0'));var zipdir=require(_0xd515('0x1'));var jsonpatch=require(_0xd515('0x2'));var rp=require(_0xd515('0x3'));var moment=require(_0xd515('0x4'));var BPromise=require(_0xd515('0x5'));var Mustache=require(_0xd515('0x6'));var util=require(_0xd515('0x7'));var path=require('path');var sox=require(_0xd515('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd515('0x9'));var _=require(_0xd515('0xa'));var squel=require(_0xd515('0xb'));var crypto=require(_0xd515('0xc'));var jsforce=require(_0xd515('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd515('0xe'));var querystring=require(_0xd515('0xf'));var Papa=require(_0xd515('0x10'));var Redis=require(_0xd515('0x11'));var authService=require(_0xd515('0x12'));var qs=require(_0xd515('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd515('0x14'));var logger=require(_0xd515('0x15'))(_0xd515('0x16'));var utils=require(_0xd515('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd515('0x18'));var db=require(_0xd515('0x19'))['db'];function respondWithStatusCode(_0x29c078,_0x33b905){_0x33b905=_0x33b905||0xcc;return function(_0x1d6bda){if(_0x1d6bda){return _0x29c078[_0xd515('0x1a')](_0x33b905);}return _0x29c078[_0xd515('0x1b')](_0x33b905)[_0xd515('0x1c')]();};}function respondWithResult(_0x1f23b7,_0x43384b){_0x43384b=_0x43384b||0xc8;return function(_0x10620b){if(_0x10620b){return _0x1f23b7[_0xd515('0x1b')](_0x43384b)[_0xd515('0x1d')](_0x10620b);}};}function respondWithFilteredResult(_0x589d04,_0x274550){return function(_0xc41eca){if(_0xc41eca){var _0xc8fbf=typeof _0x274550[_0xd515('0x1e')]===_0xd515('0x1f')&&typeof _0x274550[_0xd515('0x20')]===_0xd515('0x1f');var _0x139e91=_0xc41eca[_0xd515('0x21')];var _0x564c4e=_0xc8fbf?0x0:_0x274550['offset'];var _0x43bb12=_0xc8fbf?_0xc41eca[_0xd515('0x21')]:_0x274550[_0xd515('0x1e')]+_0x274550[_0xd515('0x20')];var _0x1ef858;if(_0x43bb12>=_0x139e91){_0x43bb12=_0x139e91;_0x1ef858=0xc8;}else{_0x1ef858=0xce;}_0x589d04[_0xd515('0x1b')](_0x1ef858);return _0x589d04[_0xd515('0x22')](_0xd515('0x23'),_0x564c4e+'-'+_0x43bb12+'/'+_0x139e91)[_0xd515('0x1d')](_0xc41eca);}return null;};}function patchUpdates(_0x5c7fef){return function(_0x57e1f4){try{jsonpatch[_0xd515('0x24')](_0x57e1f4,_0x5c7fef,!![]);}catch(_0x5b1649){return BPromise[_0xd515('0x25')](_0x5b1649);}return _0x57e1f4[_0xd515('0x26')]();};}function saveUpdates(_0x2b2ed5,_0x4e9d06){return function(_0xb422bc){if(_0xb422bc){return _0xb422bc[_0xd515('0x27')](_0x2b2ed5)[_0xd515('0x28')](function(_0x299b46){return _0x299b46;});}return null;};}function removeEntity(_0x519b7f,_0x430153){return function(_0x11cc9f){if(_0x11cc9f){return _0x11cc9f[_0xd515('0x29')]()[_0xd515('0x28')](function(){_0x519b7f[_0xd515('0x1b')](0xcc)[_0xd515('0x1c')]();});}};}function handleEntityNotFound(_0x130533,_0x84adb){return function(_0x19ce0c){if(!_0x19ce0c){_0x130533['sendStatus'](0x194);}return _0x19ce0c;};}function handleError(_0x5b6a98,_0x2e4455){_0x2e4455=_0x2e4455||0x1f4;return function(_0x2b803a){logger[_0xd515('0x2a')](_0x2b803a[_0xd515('0x2b')]);if(_0x2b803a[_0xd515('0x2c')]){delete _0x2b803a[_0xd515('0x2c')];}_0x5b6a98[_0xd515('0x1b')](_0x2e4455)[_0xd515('0x2d')](_0x2b803a);};}exports['index']=function(_0x38766a,_0x290489){var _0x3c2841={},_0x154c02={},_0x1f10ff={'count':0x0,'rows':[]};var _0x2541da=_[_0xd515('0x2e')](db['VtigerConfiguration']['rawAttributes'],function(_0x5d4f45){return{'name':_0x5d4f45[_0xd515('0x2f')],'type':_0x5d4f45[_0xd515('0x30')][_0xd515('0x31')]};});_0x154c02['model']=_['map'](_0x2541da,'name');_0x154c02[_0xd515('0x32')]=_[_0xd515('0x33')](_0x38766a[_0xd515('0x32')]);_0x154c02[_0xd515('0x34')]=_[_0xd515('0x35')](_0x154c02['model'],_0x154c02[_0xd515('0x32')]);_0x3c2841['attributes']=_[_0xd515('0x35')](_0x154c02[_0xd515('0x36')],qs[_0xd515('0x37')](_0x38766a[_0xd515('0x32')][_0xd515('0x37')]));_0x3c2841[_0xd515('0x38')]=_0x3c2841[_0xd515('0x38')]['length']?_0x3c2841[_0xd515('0x38')]:_0x154c02[_0xd515('0x36')];if(!_0x38766a[_0xd515('0x32')][_0xd515('0x39')](_0xd515('0x3a'))){_0x3c2841['limit']=qs[_0xd515('0x20')](_0x38766a['query'][_0xd515('0x20')]);_0x3c2841[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x38766a[_0xd515('0x32')][_0xd515('0x1e')]);}_0x3c2841[_0xd515('0x3b')]=qs[_0xd515('0x3c')](_0x38766a[_0xd515('0x32')][_0xd515('0x3c')]);_0x3c2841[_0xd515('0x3d')]=qs[_0xd515('0x34')](_[_0xd515('0x3e')](_0x38766a['query'],_0x154c02[_0xd515('0x34')]),_0x2541da);if(_0x38766a[_0xd515('0x32')][_0xd515('0x3f')]){_0x3c2841['where']=_[_0xd515('0x40')](_0x3c2841['where'],{'$or':_['map'](_0x2541da,function(_0x498ab7){if(_0x498ab7['type']!==_0xd515('0x41')){var _0x428c65={};_0x428c65[_0x498ab7['name']]={'$like':'%'+_0x38766a[_0xd515('0x32')]['filter']+'%'};return _0x428c65;}})});}_0x3c2841=_['merge']({},_0x3c2841,_0x38766a[_0xd515('0x42')]);var _0x561332={'where':_0x3c2841['where']};return db[_0xd515('0x43')][_0xd515('0x21')](_0x561332)[_0xd515('0x28')](function(_0x11d1f4){_0x1f10ff[_0xd515('0x21')]=_0x11d1f4;if(_0x38766a[_0xd515('0x32')][_0xd515('0x44')]){_0x3c2841[_0xd515('0x45')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xd515('0x46')](_0x3c2841);})[_0xd515('0x28')](function(_0x45b7b4){_0x1f10ff['rows']=_0x45b7b4;return _0x1f10ff;})[_0xd515('0x28')](respondWithFilteredResult(_0x290489,_0x3c2841))[_0xd515('0x47')](handleError(_0x290489,null));};exports[_0xd515('0x48')]=function(_0x56f186,_0x5d9944){var _0xe92c64={'raw':![],'where':{'id':_0x56f186[_0xd515('0x49')]['id']}},_0x3d752={};_0x3d752[_0xd515('0x36')]=_[_0xd515('0x33')](db[_0xd515('0x43')][_0xd515('0x4a')]);_0x3d752['query']=_['keys'](_0x56f186['query']);_0x3d752[_0xd515('0x34')]=_[_0xd515('0x35')](_0x3d752[_0xd515('0x36')],_0x3d752['query']);_0xe92c64[_0xd515('0x38')]=_[_0xd515('0x35')](_0x3d752[_0xd515('0x36')],qs[_0xd515('0x37')](_0x56f186[_0xd515('0x32')]['fields']));_0xe92c64[_0xd515('0x38')]=_0xe92c64[_0xd515('0x38')][_0xd515('0x4b')]?_0xe92c64[_0xd515('0x38')]:_0x3d752[_0xd515('0x36')];if(_0x56f186[_0xd515('0x32')]['includeAll']){_0xe92c64[_0xd515('0x45')]=[{'all':!![]}];}_0xe92c64=_['merge']({},_0xe92c64,_0x56f186[_0xd515('0x42')]);return db[_0xd515('0x43')][_0xd515('0x4c')](_0xe92c64)['then'](handleEntityNotFound(_0x5d9944,null))[_0xd515('0x28')](respondWithResult(_0x5d9944,null))[_0xd515('0x47')](handleError(_0x5d9944,null));};exports['create']=function(_0x3cead6,_0x438d08){return db[_0xd515('0x43')]['create'](_0x3cead6[_0xd515('0x4d')],{})['then'](respondWithResult(_0x438d08,0xc9))[_0xd515('0x47')](handleError(_0x438d08,null));};exports[_0xd515('0x27')]=function(_0x39ba14,_0x4843fa){if(_0x39ba14[_0xd515('0x4d')]['id']){delete _0x39ba14['body']['id'];}return db[_0xd515('0x43')][_0xd515('0x4c')]({'where':{'id':_0x39ba14[_0xd515('0x49')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x4843fa,null))['then'](saveUpdates(_0x39ba14['body'],null))[_0xd515('0x28')](respondWithResult(_0x4843fa,null))[_0xd515('0x47')](handleError(_0x4843fa,null));};exports[_0xd515('0x29')]=function(_0x3eb60f,_0x572798){return db['VtigerConfiguration'][_0xd515('0x4c')]({'where':{'id':_0x3eb60f['params']['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x572798,null))['then'](removeEntity(_0x572798,null))[_0xd515('0x47')](handleError(_0x572798,null));};exports[_0xd515('0x4e')]=function(_0x1eb3f7,_0x197c7b,_0x482f4e){var _0x47e441={};var _0x3d450d={};var _0xcefd1d;var _0x4b218c;return db[_0xd515('0x43')][_0xd515('0x4f')]({'where':{'id':_0x1eb3f7[_0xd515('0x49')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x197c7b,null))[_0xd515('0x28')](function(_0x30104e){if(_0x30104e){_0xcefd1d=_0x30104e;_0x3d450d['model']=_['keys'](db[_0xd515('0x50')][_0xd515('0x4a')]);_0x3d450d[_0xd515('0x32')]=_['keys'](_0x1eb3f7[_0xd515('0x32')]);_0x3d450d[_0xd515('0x34')]=_['intersection'](_0x3d450d[_0xd515('0x36')],_0x3d450d[_0xd515('0x32')]);_0x47e441['attributes']=_[_0xd515('0x35')](_0x3d450d[_0xd515('0x36')],qs[_0xd515('0x37')](_0x1eb3f7[_0xd515('0x32')][_0xd515('0x37')]));_0x47e441[_0xd515('0x38')]=_0x47e441['attributes'][_0xd515('0x4b')]?_0x47e441['attributes']:_0x3d450d[_0xd515('0x36')];_0x47e441[_0xd515('0x3b')]=qs[_0xd515('0x3c')](_0x1eb3f7['query'][_0xd515('0x3c')]);_0x47e441[_0xd515('0x3d')]=qs[_0xd515('0x34')](_[_0xd515('0x3e')](_0x1eb3f7[_0xd515('0x32')],_0x3d450d[_0xd515('0x34')]));if(_0x1eb3f7[_0xd515('0x32')][_0xd515('0x3f')]){_0x47e441[_0xd515('0x3d')]=_[_0xd515('0x40')](_0x47e441[_0xd515('0x3d')],{'$or':_[_0xd515('0x2e')](_0x47e441[_0xd515('0x38')],function(_0x241ecb){var _0x123284={};_0x123284[_0x241ecb]={'$like':'%'+_0x1eb3f7[_0xd515('0x32')][_0xd515('0x3f')]+'%'};return _0x123284;})});}_0x47e441=_[_0xd515('0x40')]({},_0x47e441,_0x1eb3f7[_0xd515('0x42')]);return _0xcefd1d[_0xd515('0x4e')](_0x47e441);}})[_0xd515('0x28')](function(_0x318684){if(_0x318684){_0x4b218c=_0x318684[_0xd515('0x4b')];if(!_0x1eb3f7[_0xd515('0x32')][_0xd515('0x39')](_0xd515('0x3a'))){_0x47e441[_0xd515('0x20')]=qs['limit'](_0x1eb3f7[_0xd515('0x32')][_0xd515('0x20')]);_0x47e441['offset']=qs[_0xd515('0x1e')](_0x1eb3f7[_0xd515('0x32')][_0xd515('0x1e')]);}return _0xcefd1d[_0xd515('0x4e')](_0x47e441);}})['then'](function(_0x563d05){if(_0x563d05){return _0x563d05?{'count':_0x4b218c,'rows':_0x563d05}:null;}})[_0xd515('0x28')](respondWithResult(_0x197c7b,null))[_0xd515('0x47')](handleError(_0x197c7b,null));};exports[_0xd515('0x51')]=function(_0x5296e1,_0x35eda8,_0x80ac4a){var _0x1d0116={};var _0x17476a={};var _0x20fae4;var _0x394063;return db[_0xd515('0x43')]['findOne']({'where':{'id':_0x5296e1[_0xd515('0x49')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x35eda8,null))[_0xd515('0x28')](function(_0x2dc0a5){if(_0x2dc0a5){_0x20fae4=_0x2dc0a5;_0x17476a['model']=_[_0xd515('0x33')](db[_0xd515('0x50')][_0xd515('0x4a')]);_0x17476a[_0xd515('0x32')]=_[_0xd515('0x33')](_0x5296e1[_0xd515('0x32')]);_0x17476a['filters']=_[_0xd515('0x35')](_0x17476a[_0xd515('0x36')],_0x17476a[_0xd515('0x32')]);_0x1d0116[_0xd515('0x38')]=_[_0xd515('0x35')](_0x17476a[_0xd515('0x36')],qs[_0xd515('0x37')](_0x5296e1['query']['fields']));_0x1d0116[_0xd515('0x38')]=_0x1d0116[_0xd515('0x38')]['length']?_0x1d0116[_0xd515('0x38')]:_0x17476a[_0xd515('0x36')];_0x1d0116[_0xd515('0x3b')]=qs[_0xd515('0x3c')](_0x5296e1[_0xd515('0x32')][_0xd515('0x3c')]);_0x1d0116[_0xd515('0x3d')]=qs['filters'](_[_0xd515('0x3e')](_0x5296e1[_0xd515('0x32')],_0x17476a['filters']));if(_0x5296e1[_0xd515('0x32')][_0xd515('0x3f')]){_0x1d0116[_0xd515('0x3d')]=_['merge'](_0x1d0116[_0xd515('0x3d')],{'$or':_[_0xd515('0x2e')](_0x1d0116[_0xd515('0x38')],function(_0x5f24b4){var _0x2b7f4e={};_0x2b7f4e[_0x5f24b4]={'$like':'%'+_0x5296e1[_0xd515('0x32')][_0xd515('0x3f')]+'%'};return _0x2b7f4e;})});}_0x1d0116=_[_0xd515('0x40')]({},_0x1d0116,_0x5296e1[_0xd515('0x42')]);return _0x20fae4[_0xd515('0x51')](_0x1d0116);}})[_0xd515('0x28')](function(_0x58a6bf){if(_0x58a6bf){_0x394063=_0x58a6bf[_0xd515('0x4b')];if(!_0x5296e1[_0xd515('0x32')]['hasOwnProperty'](_0xd515('0x3a'))){_0x1d0116['limit']=qs[_0xd515('0x20')](_0x5296e1[_0xd515('0x32')][_0xd515('0x20')]);_0x1d0116[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x5296e1[_0xd515('0x32')]['offset']);}return _0x20fae4['getSubjects'](_0x1d0116);}})['then'](function(_0x152dd4){if(_0x152dd4){return _0x152dd4?{'count':_0x394063,'rows':_0x152dd4}:null;}})['then'](respondWithResult(_0x35eda8,null))['catch'](handleError(_0x35eda8,null));};exports[_0xd515('0x52')]=function(_0x35fe5a,_0x35467d,_0x30fbd9){var _0x23da79={};var _0x41b4ef={};var _0x48872d;var _0x44fdee;return db[_0xd515('0x43')]['findOne']({'where':{'id':_0x35fe5a[_0xd515('0x49')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x35467d,null))['then'](function(_0x1e5333){if(_0x1e5333){_0x48872d=_0x1e5333;_0x41b4ef[_0xd515('0x36')]=_['keys'](db[_0xd515('0x50')][_0xd515('0x4a')]);_0x41b4ef[_0xd515('0x32')]=_[_0xd515('0x33')](_0x35fe5a[_0xd515('0x32')]);_0x41b4ef[_0xd515('0x34')]=_[_0xd515('0x35')](_0x41b4ef[_0xd515('0x36')],_0x41b4ef[_0xd515('0x32')]);_0x23da79['attributes']=_[_0xd515('0x35')](_0x41b4ef['model'],qs[_0xd515('0x37')](_0x35fe5a['query']['fields']));_0x23da79['attributes']=_0x23da79[_0xd515('0x38')][_0xd515('0x4b')]?_0x23da79[_0xd515('0x38')]:_0x41b4ef[_0xd515('0x36')];_0x23da79['order']=qs[_0xd515('0x3c')](_0x35fe5a[_0xd515('0x32')][_0xd515('0x3c')]);_0x23da79[_0xd515('0x3d')]=qs[_0xd515('0x34')](_[_0xd515('0x3e')](_0x35fe5a[_0xd515('0x32')],_0x41b4ef[_0xd515('0x34')]));if(_0x35fe5a[_0xd515('0x32')][_0xd515('0x3f')]){_0x23da79['where']=_[_0xd515('0x40')](_0x23da79[_0xd515('0x3d')],{'$or':_['map'](_0x23da79[_0xd515('0x38')],function(_0x4e44d8){var _0x16b810={};_0x16b810[_0x4e44d8]={'$like':'%'+_0x35fe5a['query'][_0xd515('0x3f')]+'%'};return _0x16b810;})});}_0x23da79=_[_0xd515('0x40')]({},_0x23da79,_0x35fe5a[_0xd515('0x42')]);return _0x48872d[_0xd515('0x52')](_0x23da79);}})[_0xd515('0x28')](function(_0x4f0c0d){if(_0x4f0c0d){_0x44fdee=_0x4f0c0d[_0xd515('0x4b')];if(!_0x35fe5a[_0xd515('0x32')][_0xd515('0x39')](_0xd515('0x3a'))){_0x23da79[_0xd515('0x20')]=qs[_0xd515('0x20')](_0x35fe5a[_0xd515('0x32')]['limit']);_0x23da79[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x35fe5a['query'][_0xd515('0x1e')]);}return _0x48872d[_0xd515('0x52')](_0x23da79);}})[_0xd515('0x28')](function(_0x364f7b){if(_0x364f7b){return _0x364f7b?{'count':_0x44fdee,'rows':_0x364f7b}:null;}})[_0xd515('0x28')](respondWithResult(_0x35467d,null))[_0xd515('0x47')](handleError(_0x35467d,null));}; \ No newline at end of file +var _0x9b87=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','options','VtigerConfiguration','includeAll','include','catch','params','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0xd8b7,_0x217ce7){var _0x212bd9=function(_0x5588b2){while(--_0x5588b2){_0xd8b7['push'](_0xd8b7['shift']());}};_0x212bd9(++_0x217ce7);}(_0x9b87,0x8e));var _0x79b8=function(_0x7bb309,_0x528140){_0x7bb309=_0x7bb309-0x0;var _0x3613a4=_0x9b87[_0x7bb309];return _0x3613a4;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x28be4b[_0x79b8('0x1b')](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x9deb6c,_0x4cd38b){return function(_0x35db24){if(!_0x35db24){_0x9deb6c[_0x79b8('0x1a')](0x194);}return _0x35db24;};}function handleError(_0x1e84f3,_0x3ba5ac){_0x3ba5ac=_0x3ba5ac||0x1f4;return function(_0x4bbbf8){logger[_0x79b8('0x28')](_0x4bbbf8[_0x79b8('0x29')]);if(_0x4bbbf8[_0x79b8('0x2a')]){delete _0x4bbbf8['name'];}_0x1e84f3[_0x79b8('0x1b')](_0x3ba5ac)[_0x79b8('0x2b')](_0x4bbbf8);};}exports[_0x79b8('0x2c')]=function(_0x2942e9,_0x3662aa){var _0x23483f={},_0x4f51d1={},_0x434ecd={'count':0x0,'rows':[]};var _0x5a24fd=_[_0x79b8('0x2d')](db['VtigerConfiguration'][_0x79b8('0x2e')],function(_0x1090d2){return{'name':_0x1090d2[_0x79b8('0x2f')],'type':_0x1090d2['type'][_0x79b8('0x30')]};});_0x4f51d1[_0x79b8('0x31')]=_[_0x79b8('0x2d')](_0x5a24fd,_0x79b8('0x2a'));_0x4f51d1['query']=_[_0x79b8('0x32')](_0x2942e9['query']);_0x4f51d1['filters']=_[_0x79b8('0x33')](_0x4f51d1[_0x79b8('0x31')],_0x4f51d1['query']);_0x23483f[_0x79b8('0x34')]=_['intersection'](_0x4f51d1['model'],qs[_0x79b8('0x35')](_0x2942e9['query'][_0x79b8('0x35')]));_0x23483f[_0x79b8('0x34')]=_0x23483f['attributes'][_0x79b8('0x36')]?_0x23483f[_0x79b8('0x34')]:_0x4f51d1[_0x79b8('0x31')];if(!_0x2942e9[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x23483f['limit']=qs[_0x79b8('0x3a')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x23483f[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x1d')]);}_0x23483f[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x23483f['where']=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x2942e9[_0x79b8('0x37')],_0x4f51d1['filters']),_0x5a24fd);if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x23483f[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x23483f[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5a24fd,function(_0x4b6248){if(_0x4b6248[_0x79b8('0x42')]!=='VIRTUAL'){var _0x512d04={};_0x512d04[_0x4b6248[_0x79b8('0x2a')]]={'$like':'%'+_0x2942e9['query']['filter']+'%'};return _0x512d04;}})});}_0x23483f=_[_0x79b8('0x41')]({},_0x23483f,_0x2942e9[_0x79b8('0x43')]);var _0x422c56={'where':_0x23483f[_0x79b8('0x40')]};return db[_0x79b8('0x44')][_0x79b8('0x1f')](_0x422c56)[_0x79b8('0x26')](function(_0x2aac60){_0x434ecd[_0x79b8('0x1f')]=_0x2aac60;if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x45')]){_0x23483f[_0x79b8('0x46')]=[{'all':!![]}];}return db[_0x79b8('0x44')]['findAll'](_0x23483f);})[_0x79b8('0x26')](function(_0x13b041){_0x434ecd['rows']=_0x13b041;return _0x434ecd;})[_0x79b8('0x26')](respondWithFilteredResult(_0x3662aa,_0x23483f))[_0x79b8('0x47')](handleError(_0x3662aa,null));};exports['show']=function(_0x17dd9e,_0x62a011){var _0x2ddad8={'raw':![],'where':{'id':_0x17dd9e[_0x79b8('0x48')]['id']}},_0x28d4e4={};_0x28d4e4[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x44')][_0x79b8('0x2e')]);_0x28d4e4[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x17dd9e[_0x79b8('0x37')]);_0x28d4e4['filters']=_['intersection'](_0x28d4e4[_0x79b8('0x31')],_0x28d4e4[_0x79b8('0x37')]);_0x2ddad8[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x28d4e4['model'],qs[_0x79b8('0x35')](_0x17dd9e[_0x79b8('0x37')][_0x79b8('0x35')]));_0x2ddad8[_0x79b8('0x34')]=_0x2ddad8['attributes'][_0x79b8('0x36')]?_0x2ddad8[_0x79b8('0x34')]:_0x28d4e4[_0x79b8('0x31')];if(_0x17dd9e[_0x79b8('0x37')]['includeAll']){_0x2ddad8[_0x79b8('0x46')]=[{'all':!![]}];}_0x2ddad8=_[_0x79b8('0x41')]({},_0x2ddad8,_0x17dd9e[_0x79b8('0x43')]);return db[_0x79b8('0x44')][_0x79b8('0x49')](_0x2ddad8)[_0x79b8('0x26')](handleEntityNotFound(_0x62a011,null))['then'](respondWithResult(_0x62a011,null))[_0x79b8('0x47')](handleError(_0x62a011,null));};exports[_0x79b8('0x4a')]=function(_0x330051,_0xc89e93){return db['VtigerConfiguration']['create'](_0x330051[_0x79b8('0x4b')],{})[_0x79b8('0x26')](respondWithResult(_0xc89e93,0xc9))[_0x79b8('0x47')](handleError(_0xc89e93,null));};exports[_0x79b8('0x25')]=function(_0x32e7ea,_0x19272d){if(_0x32e7ea[_0x79b8('0x4b')]['id']){delete _0x32e7ea[_0x79b8('0x4b')]['id'];}return db[_0x79b8('0x44')]['find']({'where':{'id':_0x32e7ea[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x19272d,null))[_0x79b8('0x26')](saveUpdates(_0x32e7ea['body'],null))[_0x79b8('0x26')](respondWithResult(_0x19272d,null))['catch'](handleError(_0x19272d,null));};exports['destroy']=function(_0x24ebb2,_0x252c2c){return db[_0x79b8('0x44')][_0x79b8('0x49')]({'where':{'id':_0x24ebb2['params']['id']}})['then'](handleEntityNotFound(_0x252c2c,null))[_0x79b8('0x26')](removeEntity(_0x252c2c,null))[_0x79b8('0x47')](handleError(_0x252c2c,null));};exports[_0x79b8('0x4c')]=function(_0x43f401,_0x2ff973,_0xcfb9c2){var _0x3f3ffc={};var _0x3d1078={};var _0x26d69e;var _0x1571cf;return db[_0x79b8('0x44')][_0x79b8('0x4d')]({'where':{'id':_0x43f401[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x2ff973,null))['then'](function(_0x37e21d){if(_0x37e21d){_0x26d69e=_0x37e21d;_0x3d1078[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x4e')]['rawAttributes']);_0x3d1078['query']=_[_0x79b8('0x32')](_0x43f401[_0x79b8('0x37')]);_0x3d1078[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x3d1078['model'],_0x3d1078[_0x79b8('0x37')]);_0x3f3ffc[_0x79b8('0x34')]=_['intersection'](_0x3d1078[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0x43f401[_0x79b8('0x37')]['fields']));_0x3f3ffc[_0x79b8('0x34')]=_0x3f3ffc['attributes'][_0x79b8('0x36')]?_0x3f3ffc[_0x79b8('0x34')]:_0x3d1078[_0x79b8('0x31')];_0x3f3ffc[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x43f401[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x3f3ffc[_0x79b8('0x40')]=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x43f401['query'],_0x3d1078[_0x79b8('0x3d')]));if(_0x43f401['query'][_0x79b8('0x3f')]){_0x3f3ffc['where']=_[_0x79b8('0x41')](_0x3f3ffc[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x3f3ffc[_0x79b8('0x34')],function(_0x2fcd4e){var _0x5885a3={};_0x5885a3[_0x2fcd4e]={'$like':'%'+_0x43f401[_0x79b8('0x37')]['filter']+'%'};return _0x5885a3;})});}_0x3f3ffc=_[_0x79b8('0x41')]({},_0x3f3ffc,_0x43f401[_0x79b8('0x43')]);return _0x26d69e[_0x79b8('0x4c')](_0x3f3ffc);}})[_0x79b8('0x26')](function(_0x27131e){if(_0x27131e){_0x1571cf=_0x27131e[_0x79b8('0x36')];if(!_0x43f401['query'][_0x79b8('0x38')](_0x79b8('0x39'))){_0x3f3ffc['limit']=qs[_0x79b8('0x3a')](_0x43f401['query'][_0x79b8('0x3a')]);_0x3f3ffc[_0x79b8('0x1d')]=qs['offset'](_0x43f401[_0x79b8('0x37')][_0x79b8('0x1d')]);}return _0x26d69e['getFields'](_0x3f3ffc);}})[_0x79b8('0x26')](function(_0x4b197b){if(_0x4b197b){return _0x4b197b?{'count':_0x1571cf,'rows':_0x4b197b}:null;}})[_0x79b8('0x26')](respondWithResult(_0x2ff973,null))['catch'](handleError(_0x2ff973,null));};exports[_0x79b8('0x4f')]=function(_0x1e101d,_0x41f243,_0x26722c){var _0x17a707={};var _0x234855={};var _0x529129;var _0x291ef1;return db[_0x79b8('0x44')]['findOne']({'where':{'id':_0x1e101d['params']['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x41f243,null))[_0x79b8('0x26')](function(_0x4fb2fd){if(_0x4fb2fd){_0x529129=_0x4fb2fd;_0x234855[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x4e')]['rawAttributes']);_0x234855[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x1e101d[_0x79b8('0x37')]);_0x234855[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x234855[_0x79b8('0x31')],_0x234855['query']);_0x17a707[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x234855[_0x79b8('0x31')],qs['fields'](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x35')]));_0x17a707[_0x79b8('0x34')]=_0x17a707['attributes'][_0x79b8('0x36')]?_0x17a707[_0x79b8('0x34')]:_0x234855['model'];_0x17a707['order']=qs[_0x79b8('0x3c')](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x17a707[_0x79b8('0x40')]=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x1e101d[_0x79b8('0x37')],_0x234855[_0x79b8('0x3d')]));if(_0x1e101d['query'][_0x79b8('0x3f')]){_0x17a707['where']=_['merge'](_0x17a707[_0x79b8('0x40')],{'$or':_['map'](_0x17a707[_0x79b8('0x34')],function(_0x43b067){var _0x151cd5={};_0x151cd5[_0x43b067]={'$like':'%'+_0x1e101d['query'][_0x79b8('0x3f')]+'%'};return _0x151cd5;})});}_0x17a707=_[_0x79b8('0x41')]({},_0x17a707,_0x1e101d[_0x79b8('0x43')]);return _0x529129[_0x79b8('0x4f')](_0x17a707);}})[_0x79b8('0x26')](function(_0x225122){if(_0x225122){_0x291ef1=_0x225122[_0x79b8('0x36')];if(!_0x1e101d[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x17a707[_0x79b8('0x3a')]=qs[_0x79b8('0x3a')](_0x1e101d['query'][_0x79b8('0x3a')]);_0x17a707[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x1e101d[_0x79b8('0x37')][_0x79b8('0x1d')]);}return _0x529129[_0x79b8('0x4f')](_0x17a707);}})[_0x79b8('0x26')](function(_0x33ea25){if(_0x33ea25){return _0x33ea25?{'count':_0x291ef1,'rows':_0x33ea25}:null;}})[_0x79b8('0x26')](respondWithResult(_0x41f243,null))[_0x79b8('0x47')](handleError(_0x41f243,null));};exports[_0x79b8('0x50')]=function(_0x4d116d,_0x43420b,_0x4a8cd0){var _0x5b785b={};var _0x211575={};var _0x275c67;var _0xec6d81;return db[_0x79b8('0x44')][_0x79b8('0x4d')]({'where':{'id':_0x4d116d[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x43420b,null))[_0x79b8('0x26')](function(_0x574191){if(_0x574191){_0x275c67=_0x574191;_0x211575['model']=_['keys'](db[_0x79b8('0x4e')][_0x79b8('0x2e')]);_0x211575[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x4d116d[_0x79b8('0x37')]);_0x211575[_0x79b8('0x3d')]=_[_0x79b8('0x33')](_0x211575[_0x79b8('0x31')],_0x211575[_0x79b8('0x37')]);_0x5b785b[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x211575[_0x79b8('0x31')],qs['fields'](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x35')]));_0x5b785b['attributes']=_0x5b785b[_0x79b8('0x34')][_0x79b8('0x36')]?_0x5b785b[_0x79b8('0x34')]:_0x211575[_0x79b8('0x31')];_0x5b785b[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x5b785b['where']=qs['filters'](_[_0x79b8('0x3e')](_0x4d116d[_0x79b8('0x37')],_0x211575[_0x79b8('0x3d')]));if(_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x5b785b[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x5b785b[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5b785b[_0x79b8('0x34')],function(_0x4912ce){var _0x56f946={};_0x56f946[_0x4912ce]={'$like':'%'+_0x4d116d['query']['filter']+'%'};return _0x56f946;})});}_0x5b785b=_[_0x79b8('0x41')]({},_0x5b785b,_0x4d116d[_0x79b8('0x43')]);return _0x275c67['getDescriptions'](_0x5b785b);}})[_0x79b8('0x26')](function(_0xd6c7e7){if(_0xd6c7e7){_0xec6d81=_0xd6c7e7[_0x79b8('0x36')];if(!_0x4d116d[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x5b785b[_0x79b8('0x3a')]=qs[_0x79b8('0x3a')](_0x4d116d[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x5b785b[_0x79b8('0x1d')]=qs['offset'](_0x4d116d['query'][_0x79b8('0x1d')]);}return _0x275c67[_0x79b8('0x50')](_0x5b785b);}})[_0x79b8('0x26')](function(_0x42915c){if(_0x42915c){return _0x42915c?{'count':_0xec6d81,'rows':_0x42915c}:null;}})[_0x79b8('0x26')](respondWithResult(_0x43420b,null))[_0x79b8('0x47')](handleError(_0x43420b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5c05e1f..10c9dd8 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 _0x9354=['moment','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','api'];(function(_0x37e230,_0x22ba0b){var _0xf6d0f5=function(_0x5c81ff){while(--_0x5c81ff){_0x37e230['push'](_0x37e230['shift']());}};_0xf6d0f5(++_0x22ba0b);}(_0x9354,0x1cb));var _0x4935=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x9354[_0x481df5];return _0x32726e;};'use strict';var _=require(_0x4935('0x0'));var util=require(_0x4935('0x1'));var logger=require('../../config/logger')(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require('bluebird');var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x4982a0,_0x1b6cf5){return _0x4982a0[_0x4935('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x4935('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d0e=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','../../config/logger','api','moment','bluebird'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x4d0e,0x15a));var _0xe4d0=function(_0x2760da,_0x381ef9){_0x2760da=_0x2760da-0x0;var _0x4c20e0=_0x4d0e[_0x2760da];return _0x4c20e0;};'use strict';var _=require(_0xe4d0('0x0'));var util=require('util');var logger=require(_0xe4d0('0x1'))(_0xe4d0('0x2'));var moment=require(_0xe4d0('0x3'));var BPromise=require(_0xe4d0('0x4'));var rp=require(_0xe4d0('0x5'));var fs=require('fs');var path=require(_0xe4d0('0x6'));var rimraf=require(_0xe4d0('0x7'));var config=require(_0xe4d0('0x8'));var attributes=require(_0xe4d0('0x9'));module[_0xe4d0('0xa')]=function(_0x183ccc,_0x4db717){return _0x183ccc[_0xe4d0('0xb')](_0xe4d0('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 985102e..044bb20 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 _0x5118=['request\x20sent','debug','stringify','code','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x5232c6,_0x365c8c){var _0x33c003=function(_0xf3eecf){while(--_0xf3eecf){_0x5232c6['push'](_0x5232c6['shift']());}};_0x33c003(++_0x365c8c);}(_0x5118,0x1e9));var _0x8511=function(_0x45bc9d,_0x10e9c6){_0x45bc9d=_0x45bc9d-0x0;var _0x3cec77=_0x5118[_0x45bc9d];return _0x3cec77;};'use strict';var _=require(_0x8511('0x0'));var util=require(_0x8511('0x1'));var moment=require(_0x8511('0x2'));var BPromise=require(_0x8511('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8511('0x4'));var db=require(_0x8511('0x5'))['db'];var utils=require(_0x8511('0x6'));var logger=require(_0x8511('0x7'))(_0x8511('0x8'));var config=require(_0x8511('0x9'));var jayson=require(_0x8511('0xa'));var client=jayson['client'][_0x8511('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x248afd,_0x4ec156,_0x17ceef){return new BPromise(function(_0x373f0b,_0x10b94e){return client[_0x8511('0xc')](_0x248afd,_0x17ceef)[_0x8511('0xd')](function(_0x56ac12){logger[_0x8511('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ec156,_0x8511('0xf'));logger[_0x8511('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4ec156,'request\x20sent',JSON[_0x8511('0x11')](_0x56ac12));if(_0x56ac12['error']){if(_0x56ac12['error'][_0x8511('0x12')]===0x1f4){logger[_0x8511('0x13')](_0x8511('0x14'),_0x4ec156,_0x56ac12[_0x8511('0x13')][_0x8511('0x15')]);return _0x10b94e(_0x56ac12[_0x8511('0x13')][_0x8511('0x15')]);}logger[_0x8511('0x13')](_0x8511('0x14'),_0x4ec156,_0x56ac12['error'][_0x8511('0x15')]);return _0x373f0b(_0x56ac12[_0x8511('0x13')][_0x8511('0x15')]);}else{logger[_0x8511('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ec156,_0x8511('0xf'));_0x373f0b(_0x56ac12[_0x8511('0x16')][_0x8511('0x15')]);}})[_0x8511('0x17')](function(_0x5516f1){logger[_0x8511('0x13')](_0x8511('0x14'),_0x4ec156,_0x5516f1);_0x10b94e(_0x5516f1);});});} \ No newline at end of file +var _0xc607=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xc607,0x1d5));var _0x7c60=function(_0x1b3eea,_0x4d5733){_0x1b3eea=_0x1b3eea-0x0;var _0x2d59b6=_0xc607[_0x1b3eea];return _0x2d59b6;};'use strict';var _=require(_0x7c60('0x0'));var util=require(_0x7c60('0x1'));var moment=require(_0x7c60('0x2'));var BPromise=require(_0x7c60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c60('0x4'));var db=require(_0x7c60('0x5'))['db'];var utils=require(_0x7c60('0x6'));var logger=require(_0x7c60('0x7'))('rpc');var config=require(_0x7c60('0x8'));var jayson=require(_0x7c60('0x9'));var client=jayson[_0x7c60('0xa')][_0x7c60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a7f26,_0x3f0c88,_0x470902){return new BPromise(function(_0x57f93b,_0x3fc750){return client[_0x7c60('0xc')](_0x1a7f26,_0x470902)[_0x7c60('0xd')](function(_0x15f2ea){logger[_0x7c60('0xe')](_0x7c60('0xf'),_0x3f0c88,_0x7c60('0x10'));logger[_0x7c60('0x11')](_0x7c60('0x12'),_0x3f0c88,_0x7c60('0x10'),JSON[_0x7c60('0x13')](_0x15f2ea));if(_0x15f2ea[_0x7c60('0x14')]){if(_0x15f2ea['error'][_0x7c60('0x15')]===0x1f4){logger[_0x7c60('0x14')](_0x7c60('0xf'),_0x3f0c88,_0x15f2ea['error']['message']);return _0x3fc750(_0x15f2ea[_0x7c60('0x14')][_0x7c60('0x16')]);}logger[_0x7c60('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,_0x15f2ea[_0x7c60('0x14')][_0x7c60('0x16')]);return _0x57f93b(_0x15f2ea['error']['message']);}else{logger[_0x7c60('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,'request\x20sent');_0x57f93b(_0x15f2ea['result'][_0x7c60('0x16')]);}})[_0x7c60('0x17')](function(_0x1aa69d){logger[_0x7c60('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0c88,_0x1aa69d);_0x3fc750(_0x1aa69d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fe1c381..05f8e9d 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 _0xbf05=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbf05,0x161));var _0x5bf0=function(_0x35b8e1,_0x36ca28){_0x35b8e1=_0x35b8e1-0x0;var _0x559db6=_0xbf05[_0x35b8e1];return _0x559db6;};'use strict';var multer=require(_0x5bf0('0x0'));var util=require('util');var path=require(_0x5bf0('0x1'));var timeout=require(_0x5bf0('0x2'));var express=require(_0x5bf0('0x3'));var router=express[_0x5bf0('0x4')]();var fs_extra=require(_0x5bf0('0x5'));var auth=require(_0x5bf0('0x6'));var interaction=require(_0x5bf0('0x7'));var config=require(_0x5bf0('0x8'));var controller=require(_0x5bf0('0x9'));router[_0x5bf0('0xa')]('/',auth[_0x5bf0('0xb')](),controller[_0x5bf0('0xc')]);router[_0x5bf0('0xa')]('/:id',auth[_0x5bf0('0xb')](),controller[_0x5bf0('0xd')]);router['post']('/',auth[_0x5bf0('0xb')](),controller[_0x5bf0('0xe')]);router['put'](_0x5bf0('0xf'),auth[_0x5bf0('0xb')](),controller[_0x5bf0('0x10')]);router[_0x5bf0('0x11')]('/:id',auth[_0x5bf0('0xb')](),controller[_0x5bf0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x86eb=['../../components/auth/service','../../config/environment','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3ef561,_0x31d930){var _0x510796=function(_0x34782e){while(--_0x34782e){_0x3ef561['push'](_0x3ef561['shift']());}};_0x510796(++_0x31d930);}(_0x86eb,0x12a));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var path=require(_0xb86e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb86e('0x3'));var router=express[_0xb86e('0x4')]();var fs_extra=require(_0xb86e('0x5'));var auth=require(_0xb86e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb86e('0x7'));var controller=require('./intVtigerField.controller');router[_0xb86e('0x8')]('/',auth['isAuthenticated'](),controller[_0xb86e('0x9')]);router['get'](_0xb86e('0xa'),auth['isAuthenticated'](),controller[_0xb86e('0xb')]);router['post']('/',auth[_0xb86e('0xc')](),controller[_0xb86e('0xd')]);router[_0xb86e('0xe')](_0xb86e('0xa'),auth[_0xb86e('0xc')](),controller[_0xb86e('0xf')]);router[_0xb86e('0x10')](_0xb86e('0xa'),auth['isAuthenticated'](),controller[_0xb86e('0x11')]);module[_0xb86e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 021fd2b..d020052 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 _0x05ed=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x320890,_0x2cb8fe){var _0x4e732d=function(_0x169e0b){while(--_0x169e0b){_0x320890['push'](_0x320890['shift']());}};_0x4e732d(++_0x2cb8fe);}(_0x05ed,0x1ec));var _0xd05e=function(_0x4e71ac,_0x42aced){_0x4e71ac=_0x4e71ac-0x0;var _0x11d76c=_0x05ed[_0x4e71ac];return _0x11d76c;};'use strict';var Sequelize=require(_0xd05e('0x0'));module[_0xd05e('0x1')]={'type':{'type':Sequelize[_0xd05e('0x2')](_0xd05e('0x3'),_0xd05e('0x4'),_0xd05e('0x5'),_0xd05e('0x6'),_0xd05e('0x7')),'defaultValue':_0xd05e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd05e('0x8')]},'keyType':{'type':Sequelize[_0xd05e('0x2')](_0xd05e('0x3'),_0xd05e('0x4'),_0xd05e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd05e('0x8')]}}; \ No newline at end of file +var _0x2ca5=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2ca5,0x131));var _0x52ca=function(_0x903ca9,_0x2fbc2a){_0x903ca9=_0x903ca9-0x0;var _0x370719=_0x2ca5[_0x903ca9];return _0x370719;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'type':{'type':Sequelize[_0x52ca('0x1')](_0x52ca('0x2'),'variable',_0x52ca('0x3'),_0x52ca('0x4'),_0x52ca('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x52ca('0x6')]},'key':{'type':Sequelize[_0x52ca('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x52ca('0x2'),_0x52ca('0x7'),_0x52ca('0x3'))},'keyContent':{'type':Sequelize[_0x52ca('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x52ca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x52ca('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9cb7313..60aa1e6 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 _0x62ca=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','merge','find','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x62ca,0x83));var _0xa62c=function(_0x4cd2fd,_0xa44ac8){_0x4cd2fd=_0x4cd2fd-0x0;var _0x2aa59c=_0x62ca[_0x4cd2fd];return _0x2aa59c;};'use strict';var emlformat=require(_0xa62c('0x0'));var rimraf=require(_0xa62c('0x1'));var zipdir=require(_0xa62c('0x2'));var jsonpatch=require(_0xa62c('0x3'));var rp=require(_0xa62c('0x4'));var moment=require(_0xa62c('0x5'));var BPromise=require(_0xa62c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa62c('0x7'));var sox=require(_0xa62c('0x8'));var csv=require(_0xa62c('0x9'));var ejs=require(_0xa62c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa62c('0xb'));var squel=require(_0xa62c('0xc'));var crypto=require(_0xa62c('0xd'));var jsforce=require(_0xa62c('0xe'));var deskjs=require(_0xa62c('0xf'));var toCsv=require(_0xa62c('0x9'));var querystring=require(_0xa62c('0x10'));var Papa=require(_0xa62c('0x11'));var Redis=require('ioredis');var authService=require(_0xa62c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa62c('0x13'));var hardwareService=require(_0xa62c('0x14'));var logger=require('../../config/logger')(_0xa62c('0x15'));var utils=require(_0xa62c('0x16'));var config=require(_0xa62c('0x17'));var licenseUtil=require(_0xa62c('0x18'));var db=require(_0xa62c('0x19'))['db'];function respondWithStatusCode(_0x1838ea,_0x4e2c6d){_0x4e2c6d=_0x4e2c6d||0xcc;return function(_0xa3d8d4){if(_0xa3d8d4){return _0x1838ea[_0xa62c('0x1a')](_0x4e2c6d);}return _0x1838ea[_0xa62c('0x1b')](_0x4e2c6d)[_0xa62c('0x1c')]();};}function respondWithResult(_0x5914b8,_0x409ceb){_0x409ceb=_0x409ceb||0xc8;return function(_0x18876f){if(_0x18876f){return _0x5914b8[_0xa62c('0x1b')](_0x409ceb)[_0xa62c('0x1d')](_0x18876f);}};}function respondWithFilteredResult(_0x5a019f,_0x4767d2){return function(_0x1bdbce){if(_0x1bdbce){var _0x113414=typeof _0x4767d2['offset']===_0xa62c('0x1e')&&typeof _0x4767d2[_0xa62c('0x1f')]===_0xa62c('0x1e');var _0x3b7976=_0x1bdbce[_0xa62c('0x20')];var _0x46b011=_0x113414?0x0:_0x4767d2[_0xa62c('0x21')];var _0x2352fd=_0x113414?_0x1bdbce[_0xa62c('0x20')]:_0x4767d2['offset']+_0x4767d2[_0xa62c('0x1f')];var _0x498e28;if(_0x2352fd>=_0x3b7976){_0x2352fd=_0x3b7976;_0x498e28=0xc8;}else{_0x498e28=0xce;}_0x5a019f[_0xa62c('0x1b')](_0x498e28);return _0x5a019f[_0xa62c('0x22')](_0xa62c('0x23'),_0x46b011+'-'+_0x2352fd+'/'+_0x3b7976)['json'](_0x1bdbce);}return null;};}function patchUpdates(_0x10b567){return function(_0x2ca4b1){try{jsonpatch[_0xa62c('0x24')](_0x2ca4b1,_0x10b567,!![]);}catch(_0x224887){return BPromise['reject'](_0x224887);}return _0x2ca4b1[_0xa62c('0x25')]();};}function saveUpdates(_0x60c7a3,_0x139ac2){return function(_0x4d0f86){if(_0x4d0f86){return _0x4d0f86['update'](_0x60c7a3)[_0xa62c('0x26')](function(_0x2ec1ad){return _0x2ec1ad;});}return null;};}function removeEntity(_0x3e9dd0,_0x4a6b52){return function(_0x4652d8){if(_0x4652d8){return _0x4652d8[_0xa62c('0x27')]()[_0xa62c('0x26')](function(){_0x3e9dd0[_0xa62c('0x1b')](0xcc)[_0xa62c('0x1c')]();});}};}function handleEntityNotFound(_0x7263ac,_0x3b90fc){return function(_0xd385f2){if(!_0xd385f2){_0x7263ac[_0xa62c('0x1a')](0x194);}return _0xd385f2;};}function handleError(_0x45c18c,_0x4bca0c){_0x4bca0c=_0x4bca0c||0x1f4;return function(_0x4ddcff){logger[_0xa62c('0x28')](_0x4ddcff[_0xa62c('0x29')]);if(_0x4ddcff[_0xa62c('0x2a')]){delete _0x4ddcff[_0xa62c('0x2a')];}_0x45c18c[_0xa62c('0x1b')](_0x4bca0c)[_0xa62c('0x2b')](_0x4ddcff);};}exports[_0xa62c('0x2c')]=function(_0x6025aa,_0x52e3d6){var _0x3fc4c2={},_0x2380ec={},_0x79dc1f={'count':0x0,'rows':[]};var _0x70f308=_[_0xa62c('0x2d')](db[_0xa62c('0x2e')][_0xa62c('0x2f')],function(_0x4ec596){return{'name':_0x4ec596[_0xa62c('0x30')],'type':_0x4ec596['type'][_0xa62c('0x31')]};});_0x2380ec[_0xa62c('0x32')]=_[_0xa62c('0x2d')](_0x70f308,'name');_0x2380ec[_0xa62c('0x33')]=_['keys'](_0x6025aa[_0xa62c('0x33')]);_0x2380ec['filters']=_[_0xa62c('0x34')](_0x2380ec['model'],_0x2380ec[_0xa62c('0x33')]);_0x3fc4c2[_0xa62c('0x35')]=_[_0xa62c('0x34')](_0x2380ec[_0xa62c('0x32')],qs[_0xa62c('0x36')](_0x6025aa[_0xa62c('0x33')][_0xa62c('0x36')]));_0x3fc4c2[_0xa62c('0x35')]=_0x3fc4c2[_0xa62c('0x35')]['length']?_0x3fc4c2[_0xa62c('0x35')]:_0x2380ec[_0xa62c('0x32')];if(!_0x6025aa['query']['hasOwnProperty'](_0xa62c('0x37'))){_0x3fc4c2[_0xa62c('0x1f')]=qs[_0xa62c('0x1f')](_0x6025aa[_0xa62c('0x33')]['limit']);_0x3fc4c2['offset']=qs[_0xa62c('0x21')](_0x6025aa['query'][_0xa62c('0x21')]);}_0x3fc4c2[_0xa62c('0x38')]=qs['sort'](_0x6025aa[_0xa62c('0x33')][_0xa62c('0x39')]);_0x3fc4c2[_0xa62c('0x3a')]=qs['filters'](_['pick'](_0x6025aa[_0xa62c('0x33')],_0x2380ec[_0xa62c('0x3b')]),_0x70f308);if(_0x6025aa['query'][_0xa62c('0x3c')]){_0x3fc4c2[_0xa62c('0x3a')]=_['merge'](_0x3fc4c2[_0xa62c('0x3a')],{'$or':_[_0xa62c('0x2d')](_0x70f308,function(_0x22270c){if(_0x22270c[_0xa62c('0x3d')]!==_0xa62c('0x3e')){var _0x29cf73={};_0x29cf73[_0x22270c[_0xa62c('0x2a')]]={'$like':'%'+_0x6025aa[_0xa62c('0x33')][_0xa62c('0x3c')]+'%'};return _0x29cf73;}})});}_0x3fc4c2=_['merge']({},_0x3fc4c2,_0x6025aa[_0xa62c('0x3f')]);var _0x529764={'where':_0x3fc4c2[_0xa62c('0x3a')]};return db[_0xa62c('0x2e')][_0xa62c('0x20')](_0x529764)['then'](function(_0xed246){_0x79dc1f[_0xa62c('0x20')]=_0xed246;if(_0x6025aa['query'][_0xa62c('0x40')]){_0x3fc4c2['include']=[{'all':!![]}];}return db[_0xa62c('0x2e')][_0xa62c('0x41')](_0x3fc4c2);})[_0xa62c('0x26')](function(_0x815f6f){_0x79dc1f[_0xa62c('0x42')]=_0x815f6f;return _0x79dc1f;})['then'](respondWithFilteredResult(_0x52e3d6,_0x3fc4c2))[_0xa62c('0x43')](handleError(_0x52e3d6,null));};exports[_0xa62c('0x44')]=function(_0x56b4ef,_0x1c864f){var _0x236c6f={'raw':!![],'where':{'id':_0x56b4ef[_0xa62c('0x45')]['id']}},_0x5dbb25={};_0x5dbb25['model']=_['keys'](db[_0xa62c('0x2e')][_0xa62c('0x2f')]);_0x5dbb25[_0xa62c('0x33')]=_[_0xa62c('0x46')](_0x56b4ef['query']);_0x5dbb25['filters']=_[_0xa62c('0x34')](_0x5dbb25[_0xa62c('0x32')],_0x5dbb25[_0xa62c('0x33')]);_0x236c6f['attributes']=_[_0xa62c('0x34')](_0x5dbb25['model'],qs[_0xa62c('0x36')](_0x56b4ef['query'][_0xa62c('0x36')]));_0x236c6f['attributes']=_0x236c6f[_0xa62c('0x35')][_0xa62c('0x47')]?_0x236c6f[_0xa62c('0x35')]:_0x5dbb25[_0xa62c('0x32')];if(_0x56b4ef[_0xa62c('0x33')][_0xa62c('0x40')]){_0x236c6f[_0xa62c('0x48')]=[{'all':!![]}];}_0x236c6f=_[_0xa62c('0x49')]({},_0x236c6f,_0x56b4ef[_0xa62c('0x3f')]);return db[_0xa62c('0x2e')][_0xa62c('0x4a')](_0x236c6f)['then'](handleEntityNotFound(_0x1c864f,null))['then'](respondWithResult(_0x1c864f,null))[_0xa62c('0x43')](handleError(_0x1c864f,null));};exports['create']=function(_0x117dd9,_0x4c0d8b){return db[_0xa62c('0x2e')]['create'](_0x117dd9['body'],{})[_0xa62c('0x26')](respondWithResult(_0x4c0d8b,0xc9))[_0xa62c('0x43')](handleError(_0x4c0d8b,null));};exports[_0xa62c('0x4b')]=function(_0x449f84,_0x3f323c){if(_0x449f84[_0xa62c('0x4c')]['id']){delete _0x449f84['body']['id'];}return db[_0xa62c('0x2e')][_0xa62c('0x4a')]({'where':{'id':_0x449f84[_0xa62c('0x45')]['id']}})[_0xa62c('0x26')](handleEntityNotFound(_0x3f323c,null))[_0xa62c('0x26')](saveUpdates(_0x449f84[_0xa62c('0x4c')],null))[_0xa62c('0x26')](respondWithResult(_0x3f323c,null))[_0xa62c('0x43')](handleError(_0x3f323c,null));};exports[_0xa62c('0x27')]=function(_0x4a39a2,_0x200a45){return db[_0xa62c('0x2e')][_0xa62c('0x4a')]({'where':{'id':_0x4a39a2['params']['id']}})[_0xa62c('0x26')](handleEntityNotFound(_0x200a45,null))[_0xa62c('0x26')](removeEntity(_0x200a45,null))['catch'](handleError(_0x200a45,null));}; \ No newline at end of file +var _0xecc5=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','eml-format','zip-dir'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xecc5,0x96));var _0x5ecc=function(_0x41fab2,_0x368e80){_0x41fab2=_0x41fab2-0x0;var _0xeb8d59=_0xecc5[_0x41fab2];return _0xeb8d59;};'use strict';var emlformat=require(_0x5ecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ecc('0x1'));var jsonpatch=require(_0x5ecc('0x2'));var rp=require(_0x5ecc('0x3'));var moment=require(_0x5ecc('0x4'));var BPromise=require(_0x5ecc('0x5'));var Mustache=require(_0x5ecc('0x6'));var util=require(_0x5ecc('0x7'));var path=require(_0x5ecc('0x8'));var sox=require(_0x5ecc('0x9'));var csv=require(_0x5ecc('0xa'));var ejs=require(_0x5ecc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ecc('0xc'));var squel=require(_0x5ecc('0xd'));var crypto=require(_0x5ecc('0xe'));var jsforce=require(_0x5ecc('0xf'));var deskjs=require(_0x5ecc('0x10'));var toCsv=require(_0x5ecc('0xa'));var querystring=require('querystring');var Papa=require(_0x5ecc('0x11'));var Redis=require(_0x5ecc('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5ecc('0x13'));var hardwareService=require(_0x5ecc('0x14'));var logger=require(_0x5ecc('0x15'))(_0x5ecc('0x16'));var utils=require(_0x5ecc('0x17'));var config=require(_0x5ecc('0x18'));var licenseUtil=require(_0x5ecc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132784,_0x478bb3){_0x478bb3=_0x478bb3||0xcc;return function(_0x2c4340){if(_0x2c4340){return _0x132784[_0x5ecc('0x1a')](_0x478bb3);}return _0x132784[_0x5ecc('0x1b')](_0x478bb3)[_0x5ecc('0x1c')]();};}function respondWithResult(_0xf30494,_0xd7acfa){_0xd7acfa=_0xd7acfa||0xc8;return function(_0x4f28cc){if(_0x4f28cc){return _0xf30494[_0x5ecc('0x1b')](_0xd7acfa)['json'](_0x4f28cc);}};}function respondWithFilteredResult(_0x366091,_0x135b80){return function(_0x3dec16){if(_0x3dec16){var _0x1df89e=typeof _0x135b80[_0x5ecc('0x1d')]===_0x5ecc('0x1e')&&typeof _0x135b80[_0x5ecc('0x1f')]==='undefined';var _0x74cfcb=_0x3dec16[_0x5ecc('0x20')];var _0x450273=_0x1df89e?0x0:_0x135b80['offset'];var _0x1d2f36=_0x1df89e?_0x3dec16['count']:_0x135b80['offset']+_0x135b80[_0x5ecc('0x1f')];var _0x18c742;if(_0x1d2f36>=_0x74cfcb){_0x1d2f36=_0x74cfcb;_0x18c742=0xc8;}else{_0x18c742=0xce;}_0x366091[_0x5ecc('0x1b')](_0x18c742);return _0x366091[_0x5ecc('0x21')](_0x5ecc('0x22'),_0x450273+'-'+_0x1d2f36+'/'+_0x74cfcb)[_0x5ecc('0x23')](_0x3dec16);}return null;};}function patchUpdates(_0x23952a){return function(_0x45a0c8){try{jsonpatch['apply'](_0x45a0c8,_0x23952a,!![]);}catch(_0x3f6057){return BPromise[_0x5ecc('0x24')](_0x3f6057);}return _0x45a0c8[_0x5ecc('0x25')]();};}function saveUpdates(_0x19c626,_0x17f35f){return function(_0x17d076){if(_0x17d076){return _0x17d076[_0x5ecc('0x26')](_0x19c626)[_0x5ecc('0x27')](function(_0x3bbeaf){return _0x3bbeaf;});}return null;};}function removeEntity(_0x5b0355,_0x346d70){return function(_0x405bf7){if(_0x405bf7){return _0x405bf7['destroy']()[_0x5ecc('0x27')](function(){_0x5b0355[_0x5ecc('0x1b')](0xcc)[_0x5ecc('0x1c')]();});}};}function handleEntityNotFound(_0x46a76c,_0xa7a7ba){return function(_0x4fb6d9){if(!_0x4fb6d9){_0x46a76c['sendStatus'](0x194);}return _0x4fb6d9;};}function handleError(_0x65cc24,_0x47f172){_0x47f172=_0x47f172||0x1f4;return function(_0x4c4bd2){logger[_0x5ecc('0x28')](_0x4c4bd2[_0x5ecc('0x29')]);if(_0x4c4bd2[_0x5ecc('0x2a')]){delete _0x4c4bd2[_0x5ecc('0x2a')];}_0x65cc24[_0x5ecc('0x1b')](_0x47f172)[_0x5ecc('0x2b')](_0x4c4bd2);};}exports['index']=function(_0x181fbb,_0x3ec051){var _0x5c46d5={},_0x6ff5c0={},_0x217f47={'count':0x0,'rows':[]};var _0x95ad7e=_[_0x5ecc('0x2c')](db[_0x5ecc('0x2d')][_0x5ecc('0x2e')],function(_0x1ed13f){return{'name':_0x1ed13f[_0x5ecc('0x2f')],'type':_0x1ed13f[_0x5ecc('0x30')]['key']};});_0x6ff5c0[_0x5ecc('0x31')]=_[_0x5ecc('0x2c')](_0x95ad7e,_0x5ecc('0x2a'));_0x6ff5c0['query']=_['keys'](_0x181fbb[_0x5ecc('0x32')]);_0x6ff5c0[_0x5ecc('0x33')]=_[_0x5ecc('0x34')](_0x6ff5c0[_0x5ecc('0x31')],_0x6ff5c0[_0x5ecc('0x32')]);_0x5c46d5[_0x5ecc('0x35')]=_[_0x5ecc('0x34')](_0x6ff5c0[_0x5ecc('0x31')],qs[_0x5ecc('0x36')](_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x36')]));_0x5c46d5['attributes']=_0x5c46d5['attributes'][_0x5ecc('0x37')]?_0x5c46d5[_0x5ecc('0x35')]:_0x6ff5c0[_0x5ecc('0x31')];if(!_0x181fbb[_0x5ecc('0x32')]['hasOwnProperty'](_0x5ecc('0x38'))){_0x5c46d5[_0x5ecc('0x1f')]=qs[_0x5ecc('0x1f')](_0x181fbb[_0x5ecc('0x32')]['limit']);_0x5c46d5[_0x5ecc('0x1d')]=qs['offset'](_0x181fbb[_0x5ecc('0x32')]['offset']);}_0x5c46d5[_0x5ecc('0x39')]=qs[_0x5ecc('0x3a')](_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3a')]);_0x5c46d5[_0x5ecc('0x3b')]=qs['filters'](_[_0x5ecc('0x3c')](_0x181fbb[_0x5ecc('0x32')],_0x6ff5c0[_0x5ecc('0x33')]),_0x95ad7e);if(_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3d')]){_0x5c46d5[_0x5ecc('0x3b')]=_[_0x5ecc('0x3e')](_0x5c46d5['where'],{'$or':_[_0x5ecc('0x2c')](_0x95ad7e,function(_0x575fb3){if(_0x575fb3[_0x5ecc('0x30')]!==_0x5ecc('0x3f')){var _0x4639eb={};_0x4639eb[_0x575fb3['name']]={'$like':'%'+_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x3d')]+'%'};return _0x4639eb;}})});}_0x5c46d5=_[_0x5ecc('0x3e')]({},_0x5c46d5,_0x181fbb[_0x5ecc('0x40')]);var _0x494860={'where':_0x5c46d5['where']};return db[_0x5ecc('0x2d')][_0x5ecc('0x20')](_0x494860)[_0x5ecc('0x27')](function(_0x38ead6){_0x217f47[_0x5ecc('0x20')]=_0x38ead6;if(_0x181fbb[_0x5ecc('0x32')][_0x5ecc('0x41')]){_0x5c46d5[_0x5ecc('0x42')]=[{'all':!![]}];}return db[_0x5ecc('0x2d')]['findAll'](_0x5c46d5);})['then'](function(_0x147c44){_0x217f47[_0x5ecc('0x43')]=_0x147c44;return _0x217f47;})['then'](respondWithFilteredResult(_0x3ec051,_0x5c46d5))[_0x5ecc('0x44')](handleError(_0x3ec051,null));};exports[_0x5ecc('0x45')]=function(_0x56b460,_0x3583e1){var _0x70ed74={'raw':!![],'where':{'id':_0x56b460[_0x5ecc('0x46')]['id']}},_0x9ff83c={};_0x9ff83c[_0x5ecc('0x31')]=_[_0x5ecc('0x47')](db['VtigerField'][_0x5ecc('0x2e')]);_0x9ff83c['query']=_[_0x5ecc('0x47')](_0x56b460['query']);_0x9ff83c[_0x5ecc('0x33')]=_[_0x5ecc('0x34')](_0x9ff83c['model'],_0x9ff83c['query']);_0x70ed74[_0x5ecc('0x35')]=_[_0x5ecc('0x34')](_0x9ff83c[_0x5ecc('0x31')],qs[_0x5ecc('0x36')](_0x56b460[_0x5ecc('0x32')]['fields']));_0x70ed74[_0x5ecc('0x35')]=_0x70ed74['attributes'][_0x5ecc('0x37')]?_0x70ed74[_0x5ecc('0x35')]:_0x9ff83c['model'];if(_0x56b460[_0x5ecc('0x32')]['includeAll']){_0x70ed74['include']=[{'all':!![]}];}_0x70ed74=_[_0x5ecc('0x3e')]({},_0x70ed74,_0x56b460[_0x5ecc('0x40')]);return db[_0x5ecc('0x2d')]['find'](_0x70ed74)[_0x5ecc('0x27')](handleEntityNotFound(_0x3583e1,null))[_0x5ecc('0x27')](respondWithResult(_0x3583e1,null))['catch'](handleError(_0x3583e1,null));};exports[_0x5ecc('0x48')]=function(_0x554d2b,_0x13f5bf){return db['VtigerField'][_0x5ecc('0x48')](_0x554d2b['body'],{})[_0x5ecc('0x27')](respondWithResult(_0x13f5bf,0xc9))['catch'](handleError(_0x13f5bf,null));};exports['update']=function(_0x2f98b9,_0x33f4f3){if(_0x2f98b9[_0x5ecc('0x49')]['id']){delete _0x2f98b9[_0x5ecc('0x49')]['id'];}return db[_0x5ecc('0x2d')][_0x5ecc('0x4a')]({'where':{'id':_0x2f98b9['params']['id']}})[_0x5ecc('0x27')](handleEntityNotFound(_0x33f4f3,null))[_0x5ecc('0x27')](saveUpdates(_0x2f98b9[_0x5ecc('0x49')],null))[_0x5ecc('0x27')](respondWithResult(_0x33f4f3,null))[_0x5ecc('0x44')](handleError(_0x33f4f3,null));};exports[_0x5ecc('0x4b')]=function(_0x43b359,_0x22309b){return db[_0x5ecc('0x2d')][_0x5ecc('0x4a')]({'where':{'id':_0x43b359[_0x5ecc('0x46')]['id']}})[_0x5ecc('0x27')](handleEntityNotFound(_0x22309b,null))[_0x5ecc('0x27')](removeEntity(_0x22309b,null))[_0x5ecc('0x44')](handleError(_0x22309b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7975ddd..c23d2bc 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 _0x6c9c=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x37e342,_0x160c8f){var _0x1768f9=function(_0x413c98){while(--_0x413c98){_0x37e342['push'](_0x37e342['shift']());}};_0x1768f9(++_0x160c8f);}(_0x6c9c,0x96));var _0xc6c9=function(_0x2bb135,_0x5d1903){_0x2bb135=_0x2bb135-0x0;var _0x5265dd=_0x6c9c[_0x2bb135];return _0x5265dd;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var logger=require(_0xc6c9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6c9('0x3'));var fs=require('fs');var path=require(_0xc6c9('0x4'));var rimraf=require(_0xc6c9('0x5'));var config=require(_0xc6c9('0x6'));var attributes=require(_0xc6c9('0x7'));module[_0xc6c9('0x8')]=function(_0x280a9e,_0x575dca){return _0x280a9e[_0xc6c9('0x9')](_0xc6c9('0xa'),attributes,{'tableName':_0xc6c9('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xc6c9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39c3=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x10c71f,_0xfa6d98){var _0x56b5a4=function(_0x5de344){while(--_0x5de344){_0x10c71f['push'](_0x10c71f['shift']());}};_0x56b5a4(++_0xfa6d98);}(_0x39c3,0x198));var _0x339c=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0x39c3[_0x1778e1];return _0x2bc4c6;};'use strict';var _=require('lodash');var util=require(_0x339c('0x0'));var logger=require(_0x339c('0x1'))(_0x339c('0x2'));var moment=require(_0x339c('0x3'));var BPromise=require(_0x339c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x339c('0x5'));var rimraf=require(_0x339c('0x6'));var config=require(_0x339c('0x7'));var attributes=require(_0x339c('0x8'));module[_0x339c('0x9')]=function(_0x332c69,_0x510835){return _0x332c69[_0x339c('0xa')](_0x339c('0xb'),attributes,{'tableName':_0x339c('0xc'),'paranoid':![],'indexes':[{'name':_0x339c('0xd'),'fields':[_0x339c('0xe'),_0x339c('0xf')],'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 e4d5f6c..1971426 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 _0x62bf=['moment','bluebird','randomstring','../../config/logger','../../config/environment','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x5508d8,_0x5dfded){var _0x105efb=function(_0x674d94){while(--_0x674d94){_0x5508d8['push'](_0x5508d8['shift']());}};_0x105efb(++_0x5dfded);}(_0x62bf,0x1c7));var _0xf62b=function(_0x114e73,_0x1ccb13){_0x114e73=_0x114e73-0x0;var _0x673e28=_0x62bf[_0x114e73];return _0x673e28;};'use strict';var _=require('lodash');var util=require(_0xf62b('0x0'));var moment=require(_0xf62b('0x1'));var BPromise=require(_0xf62b('0x2'));var rs=require(_0xf62b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf62b('0x4'))('rpc');var config=require(_0xf62b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf62b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7deaae,_0x136a85,_0x45007c){return new BPromise(function(_0x1df717,_0x41a927){return client[_0xf62b('0x7')](_0x7deaae,_0x45007c)[_0xf62b('0x8')](function(_0x7f848f){logger[_0xf62b('0x9')](_0xf62b('0xa'),_0x136a85,'request\x20sent');logger[_0xf62b('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x136a85,_0xf62b('0xc'),JSON[_0xf62b('0xd')](_0x7f848f));if(_0x7f848f[_0xf62b('0xe')]){if(_0x7f848f[_0xf62b('0xe')][_0xf62b('0xf')]===0x1f4){logger['error'](_0xf62b('0xa'),_0x136a85,_0x7f848f['error']['message']);return _0x41a927(_0x7f848f['error'][_0xf62b('0x10')]);}logger['error'](_0xf62b('0xa'),_0x136a85,_0x7f848f[_0xf62b('0xe')]['message']);return _0x1df717(_0x7f848f[_0xf62b('0xe')][_0xf62b('0x10')]);}else{logger[_0xf62b('0x9')]('VtigerField,\x20%s,\x20%s',_0x136a85,_0xf62b('0xc'));_0x1df717(_0x7f848f[_0xf62b('0x11')]['message']);}})[_0xf62b('0x12')](function(_0x12c087){logger[_0xf62b('0xe')](_0xf62b('0xa'),_0x136a85,_0x12c087);_0x41a927(_0x12c087);});});} \ No newline at end of file +var _0x3ce4=['../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_0x3ce4,0xcb));var _0x43ce=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x3ce4[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x43ce('0x0'));var util=require('util');var moment=require(_0x43ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x43ce('0x2'));var fs=require('fs');var Redis=require(_0x43ce('0x3'));var db=require(_0x43ce('0x4'))['db'];var utils=require(_0x43ce('0x5'));var logger=require(_0x43ce('0x6'))('rpc');var config=require(_0x43ce('0x7'));var jayson=require(_0x43ce('0x8'));var client=jayson['client'][_0x43ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51e29b,_0x1f93c9,_0x2fd0e2){return new BPromise(function(_0x189654,_0x20c136){return client['request'](_0x51e29b,_0x2fd0e2)[_0x43ce('0xa')](function(_0x13dbc6){logger[_0x43ce('0xb')](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));logger[_0x43ce('0xe')](_0x43ce('0xf'),_0x1f93c9,_0x43ce('0xd'),JSON['stringify'](_0x13dbc6));if(_0x13dbc6[_0x43ce('0x10')]){if(_0x13dbc6['error'][_0x43ce('0x11')]===0x1f4){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);return _0x20c136(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}logger['error'](_0x43ce('0xc'),_0x1f93c9,_0x13dbc6['error'][_0x43ce('0x12')]);return _0x189654(_0x13dbc6[_0x43ce('0x10')][_0x43ce('0x12')]);}else{logger['info'](_0x43ce('0xc'),_0x1f93c9,_0x43ce('0xd'));_0x189654(_0x13dbc6[_0x43ce('0x13')][_0x43ce('0x12')]);}})[_0x43ce('0x14')](function(_0x34b84b){logger[_0x43ce('0x10')](_0x43ce('0xc'),_0x1f93c9,_0x34b84b);_0x20c136(_0x34b84b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8ca08dd..743ce7f 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 _0x2c64=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0x2c64,0x18d));var _0x42c6=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x2c64[_0x81dcac];return _0xc7803b;};'use strict';var multer=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var path=require(_0x42c6('0x2'));var timeout=require(_0x42c6('0x3'));var express=require(_0x42c6('0x4'));var router=express[_0x42c6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var controller=require(_0x42c6('0x8'));router[_0x42c6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x42c6('0x9')](_0x42c6('0xa'),auth[_0x42c6('0xb')](),controller[_0x42c6('0xc')]);router[_0x42c6('0x9')](_0x42c6('0xd'),auth[_0x42c6('0xb')](),controller[_0x42c6('0xe')]);router[_0x42c6('0x9')]('/:id/fields',auth[_0x42c6('0xb')](),controller[_0x42c6('0xf')]);router[_0x42c6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42c6('0x10')](_0x42c6('0xd'),auth['isAuthenticated'](),controller[_0x42c6('0x11')]);router[_0x42c6('0x12')]('/:id',auth[_0x42c6('0xb')](),controller[_0x42c6('0x13')]);router[_0x42c6('0x14')](_0x42c6('0xa'),auth[_0x42c6('0xb')](),controller[_0x42c6('0x15')]);module[_0x42c6('0x16')]=router; \ No newline at end of file +var _0x39e7=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id','isAuthenticated','getConfigurations','getFields','create','post','addConfiguration','put','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2108de,_0x4f503f){var _0x2e0ef9=function(_0x5480c7){while(--_0x5480c7){_0x2108de['push'](_0x2108de['shift']());}};_0x2e0ef9(++_0x4f503f);}(_0x39e7,0x1d4));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x739e('0x0'));var util=require(_0x739e('0x1'));var path=require(_0x739e('0x2'));var timeout=require(_0x739e('0x3'));var express=require(_0x739e('0x4'));var router=express[_0x739e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x739e('0x6'));var interaction=require(_0x739e('0x7'));var config=require(_0x739e('0x8'));var controller=require(_0x739e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x739e('0xa')](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['show']);router['get']('/:id/configurations',auth[_0x739e('0xc')](),controller[_0x739e('0xd')]);router[_0x739e('0xa')]('/:id/fields',auth[_0x739e('0xc')](),controller[_0x739e('0xe')]);router['post']('/',auth[_0x739e('0xc')](),controller[_0x739e('0xf')]);router[_0x739e('0x10')]('/:id/configurations',auth[_0x739e('0xc')](),controller[_0x739e('0x11')]);router[_0x739e('0x12')](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['update']);router['delete'](_0x739e('0xb'),auth[_0x739e('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7ce0a52..1f80bb1 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 _0xa76e=['ENUM','integrationTab','exports','STRING','username','remoteUri','password'];(function(_0x3a5a3d,_0x161408){var _0x337578=function(_0x3022de){while(--_0x3022de){_0x3a5a3d['push'](_0x3a5a3d['shift']());}};_0x337578(++_0x161408);}(_0xa76e,0xfe));var _0xea76=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xa76e[_0x1b5aea];return _0x51cae9;};'use strict';var Sequelize=require('sequelize');module[_0xea76('0x0')]={'name':{'type':Sequelize[_0xea76('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xea76('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xea76('0x1')]},'remoteUri':{'type':Sequelize[_0xea76('0x1')],'unique':_0xea76('0x3')},'authType':{'type':Sequelize['ENUM'](_0xea76('0x4'),'token'),'defaultValue':_0xea76('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xea76('0x5')](_0xea76('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x326f=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x5bfb1b,_0x3e1167){var _0x4e8b51=function(_0x53941b){while(--_0x53941b){_0x5bfb1b['push'](_0x5bfb1b['shift']());}};_0x4e8b51(++_0x3e1167);}(_0x326f,0xd1));var _0xf326=function(_0x11e02a,_0x33ff7d){_0x11e02a=_0x11e02a-0x0;var _0x586512=_0x326f[_0x11e02a];return _0x586512;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf326('0x1')]},'username':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x2')},'password':{'type':Sequelize[_0xf326('0x1')]},'token':{'type':Sequelize[_0xf326('0x1')]},'remoteUri':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x3')},'authType':{'type':Sequelize[_0xf326('0x4')](_0xf326('0x5'),_0xf326('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x4')](_0xf326('0x7'),_0xf326('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 162fec1..c33e62e 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 _0xd914=['channel','ZendeskField','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','group','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','pick','map','options','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd914,0x17f));var _0x4d91=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd914[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];var integrations=require(_0x4d91('0x1b'));function respondWithStatusCode(_0x318e0c,_0x4ea591){_0x4ea591=_0x4ea591||0xcc;return function(_0x577a69){if(_0x577a69){return _0x318e0c[_0x4d91('0x1c')](_0x4ea591);}return _0x318e0c[_0x4d91('0x1d')](_0x4ea591)[_0x4d91('0x1e')]();};}function respondWithResult(_0x3c9fd6,_0x33fbd4){_0x33fbd4=_0x33fbd4||0xc8;return function(_0x25bafc){if(_0x25bafc){return _0x3c9fd6[_0x4d91('0x1d')](_0x33fbd4)['json'](_0x25bafc);}};}function respondWithFilteredResult(_0x3a8ec9,_0x42631a){return function(_0x1e2ef7){if(_0x1e2ef7){var _0xb92681=typeof _0x42631a[_0x4d91('0x1f')]==='undefined'&&typeof _0x42631a[_0x4d91('0x20')]===_0x4d91('0x21');var _0x241564=_0x1e2ef7[_0x4d91('0x22')];var _0x4cfa40=_0xb92681?0x0:_0x42631a[_0x4d91('0x1f')];var _0x3b579b=_0xb92681?_0x1e2ef7[_0x4d91('0x22')]:_0x42631a['offset']+_0x42631a[_0x4d91('0x20')];var _0x127911;if(_0x3b579b>=_0x241564){_0x3b579b=_0x241564;_0x127911=0xc8;}else{_0x127911=0xce;}_0x3a8ec9[_0x4d91('0x1d')](_0x127911);return _0x3a8ec9[_0x4d91('0x23')](_0x4d91('0x24'),_0x4cfa40+'-'+_0x3b579b+'/'+_0x241564)[_0x4d91('0x25')](_0x1e2ef7);}return null;};}function patchUpdates(_0xc1d44f){return function(_0x193ca9){try{jsonpatch[_0x4d91('0x26')](_0x193ca9,_0xc1d44f,!![]);}catch(_0x226d85){return BPromise['reject'](_0x226d85);}return _0x193ca9[_0x4d91('0x27')]();};}function saveUpdates(_0x5f5236,_0x57913e){return function(_0x74a697){if(_0x74a697){return _0x74a697[_0x4d91('0x28')](_0x5f5236)[_0x4d91('0x29')](function(_0x9cb864){return _0x9cb864;});}return null;};}function removeEntity(_0x7d8cbf,_0x12b722){return function(_0x100cd4){if(_0x100cd4){return _0x100cd4[_0x4d91('0x2a')]()['then'](function(){_0x7d8cbf['status'](0xcc)[_0x4d91('0x1e')]();});}};}function handleEntityNotFound(_0x112923,_0x3bed98){return function(_0x45fc91){if(!_0x45fc91){_0x112923[_0x4d91('0x1c')](0x194);}return _0x45fc91;};}function handleError(_0x2c7d7a,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x560966){logger[_0x4d91('0x2b')](_0x560966[_0x4d91('0x2c')]);if(_0x560966[_0x4d91('0x2d')]){delete _0x560966['name'];}_0x2c7d7a['status'](_0x14bdb4)[_0x4d91('0x2e')](_0x560966);};}exports[_0x4d91('0x2f')]=function(_0x5ed948,_0x50fe76){var _0x42d5a0={},_0x2d6981={},_0x43371e={'count':0x0,'rows':[]};var _0x17c7bc=_['map'](db[_0x4d91('0x30')][_0x4d91('0x31')],function(_0x468e95){return{'name':_0x468e95[_0x4d91('0x32')],'type':_0x468e95[_0x4d91('0x33')][_0x4d91('0x34')]};});_0x2d6981[_0x4d91('0x35')]=_['map'](_0x17c7bc,_0x4d91('0x2d'));_0x2d6981['query']=_['keys'](_0x5ed948[_0x4d91('0x36')]);_0x2d6981[_0x4d91('0x37')]=_['intersection'](_0x2d6981[_0x4d91('0x35')],_0x2d6981[_0x4d91('0x36')]);_0x42d5a0[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x2d6981[_0x4d91('0x35')],qs['fields'](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x42d5a0[_0x4d91('0x38')]=_0x42d5a0[_0x4d91('0x38')][_0x4d91('0x3b')]?_0x42d5a0[_0x4d91('0x38')]:_0x2d6981['model'];if(!_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3c')]('nolimit')){_0x42d5a0[_0x4d91('0x20')]=qs[_0x4d91('0x20')](_0x5ed948[_0x4d91('0x36')]['limit']);_0x42d5a0[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x1f')]);}_0x42d5a0['order']=qs[_0x4d91('0x3d')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x42d5a0[_0x4d91('0x3e')]=qs['filters'](_['pick'](_0x5ed948[_0x4d91('0x36')],_0x2d6981[_0x4d91('0x37')]),_0x17c7bc);if(_0x5ed948['query'][_0x4d91('0x3f')]){_0x42d5a0[_0x4d91('0x3e')]=_[_0x4d91('0x40')](_0x42d5a0[_0x4d91('0x3e')],{'$or':_['map'](_0x17c7bc,function(_0x2eb7c7){if(_0x2eb7c7[_0x4d91('0x33')]!=='VIRTUAL'){var _0x1ba6cd={};_0x1ba6cd[_0x2eb7c7['name']]={'$like':'%'+_0x5ed948[_0x4d91('0x36')]['filter']+'%'};return _0x1ba6cd;}})});}_0x42d5a0=_[_0x4d91('0x40')]({},_0x42d5a0,_0x5ed948['options']);var _0x24fc69={'where':_0x42d5a0[_0x4d91('0x3e')]};return db[_0x4d91('0x30')][_0x4d91('0x22')](_0x24fc69)['then'](function(_0x5bcc9b){_0x43371e[_0x4d91('0x22')]=_0x5bcc9b;if(_0x5ed948['query'][_0x4d91('0x41')]){_0x42d5a0[_0x4d91('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4d91('0x43')](_0x42d5a0);})[_0x4d91('0x29')](function(_0x14db37){_0x43371e[_0x4d91('0x44')]=_0x14db37;return _0x43371e;})[_0x4d91('0x29')](respondWithFilteredResult(_0x50fe76,_0x42d5a0))[_0x4d91('0x45')](handleError(_0x50fe76,null));};exports[_0x4d91('0x46')]=function(_0x4f6254,_0x1e4c6d){var _0x4c70af={'raw':![],'where':{'id':_0x4f6254[_0x4d91('0x47')]['id']}},_0x41c06a={};_0x41c06a[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x30')][_0x4d91('0x31')]);_0x41c06a['query']=_['keys'](_0x4f6254[_0x4d91('0x36')]);_0x41c06a[_0x4d91('0x37')]=_['intersection'](_0x41c06a[_0x4d91('0x35')],_0x41c06a[_0x4d91('0x36')]);_0x4c70af[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x41c06a[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x4f6254[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x4c70af[_0x4d91('0x38')]=_0x4c70af['attributes']['length']?_0x4c70af[_0x4d91('0x38')]:_0x41c06a['model'];if(_0x4f6254[_0x4d91('0x36')][_0x4d91('0x41')]){_0x4c70af[_0x4d91('0x42')]=[{'all':!![]}];}_0x4c70af=_[_0x4d91('0x40')]({},_0x4c70af,_0x4f6254['options']);return db[_0x4d91('0x30')]['find'](_0x4c70af)['then'](handleEntityNotFound(_0x1e4c6d,null))[_0x4d91('0x29')](respondWithResult(_0x1e4c6d,null))[_0x4d91('0x45')](handleError(_0x1e4c6d,null));};exports[_0x4d91('0x49')]=function(_0xa03d75,_0x1f91ec){return db[_0x4d91('0x30')]['create'](_0xa03d75[_0x4d91('0x4a')],{})[_0x4d91('0x29')](respondWithResult(_0x1f91ec,0xc9))[_0x4d91('0x45')](handleError(_0x1f91ec,null));};exports[_0x4d91('0x28')]=function(_0x106e5b,_0x44e9ec){if(_0x106e5b[_0x4d91('0x4a')]['id']){delete _0x106e5b[_0x4d91('0x4a')]['id'];}return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x106e5b[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e9ec,null))[_0x4d91('0x29')](saveUpdates(_0x106e5b['body'],null))[_0x4d91('0x29')](respondWithResult(_0x44e9ec,null))[_0x4d91('0x45')](handleError(_0x44e9ec,null));};exports[_0x4d91('0x2a')]=function(_0x386935,_0x436a3d){return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x386935[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x436a3d,null))[_0x4d91('0x29')](removeEntity(_0x436a3d,null))[_0x4d91('0x45')](handleError(_0x436a3d,null));};exports[_0x4d91('0x4c')]=function(_0x2bba43,_0x26ecd7,_0x19e57e){var _0x5765ce={};var _0x4aae23={};var _0x392cc3;var _0x2159e4;return db[_0x4d91('0x30')][_0x4d91('0x4d')]({'where':{'id':_0x2bba43[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x29')](function(_0x4138c5){if(_0x4138c5){_0x392cc3=_0x4138c5;_0x4aae23[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x4e')][_0x4d91('0x31')]);_0x4aae23[_0x4d91('0x36')]=_[_0x4d91('0x48')](_0x2bba43[_0x4d91('0x36')]);_0x4aae23[_0x4d91('0x37')]=_[_0x4d91('0x39')](_0x4aae23['model'],_0x4aae23['query']);_0x5765ce['attributes']=_[_0x4d91('0x39')](_0x4aae23[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x2bba43['query'][_0x4d91('0x3a')]));_0x5765ce[_0x4d91('0x38')]=_0x5765ce[_0x4d91('0x38')]['length']?_0x5765ce['attributes']:_0x4aae23['model'];_0x5765ce[_0x4d91('0x4f')]=qs[_0x4d91('0x3d')](_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x5765ce[_0x4d91('0x3e')]=qs['filters'](_[_0x4d91('0x50')](_0x2bba43[_0x4d91('0x36')],_0x4aae23['filters']));if(_0x2bba43['query'][_0x4d91('0x3f')]){_0x5765ce['where']=_[_0x4d91('0x40')](_0x5765ce[_0x4d91('0x3e')],{'$or':_[_0x4d91('0x51')](_0x5765ce['attributes'],function(_0x2e0bff){var _0x3d6c26={};_0x3d6c26[_0x2e0bff]={'$like':'%'+_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3f')]+'%'};return _0x3d6c26;})});}_0x5765ce=_[_0x4d91('0x40')]({},_0x5765ce,_0x2bba43[_0x4d91('0x52')]);return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})['then'](function(_0x533572){if(_0x533572){_0x2159e4=_0x533572['length'];if(!_0x2bba43['query'][_0x4d91('0x3c')](_0x4d91('0x53'))){_0x5765ce[_0x4d91('0x20')]=qs['limit'](_0x2bba43[_0x4d91('0x36')]['limit']);_0x5765ce[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x2bba43['query']['offset']);}return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})[_0x4d91('0x29')](function(_0x31150f){if(_0x31150f){return _0x31150f?{'count':_0x2159e4,'rows':_0x31150f}:null;}})[_0x4d91('0x29')](respondWithResult(_0x26ecd7,null))[_0x4d91('0x45')](handleError(_0x26ecd7,null));};exports[_0x4d91('0x54')]=function(_0x7a94e2,_0x42e550,_0xd384a9){if(_0x7a94e2[_0x4d91('0x4a')]['id']){delete _0x7a94e2['body']['id'];}return db['ZendeskAccount'][_0x4d91('0x4d')]({'where':{'id':_0x7a94e2[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x42e550,null))[_0x4d91('0x29')](function(_0x16ba26){if(_0x16ba26){_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x55')]=_0x16ba26['id'];_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x56')]=integrations['getSubjects'](_0x7a94e2['body']['channel'],_0x7a94e2['body'][_0x4d91('0x33')]);_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x57')]=integrations[_0x4d91('0x58')](_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x59')],_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x33')]);return db[_0x4d91('0x4e')][_0x4d91('0x49')](_0x7a94e2[_0x4d91('0x4a')],{'include':[{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x56')},{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x57')}]});}return null;})[_0x4d91('0x29')](respondWithResult(_0x42e550,null))[_0x4d91('0x45')](handleError(_0x42e550,null));};exports['getFields']=function(_0x4062c6,_0x1be4b1,_0xc4ef10){var _0x2e2105='';return db[_0x4d91('0x30')]['findOne']({'where':{'id':_0x4062c6[_0x4d91('0x47')]['id']},'attributes':['id',_0x4d91('0x5b'),'password',_0x4d91('0x5c'),_0x4d91('0x5d'),_0x4d91('0x5e')]})[_0x4d91('0x29')](handleEntityNotFound(_0x1be4b1,null))[_0x4d91('0x29')](function(_0x4bc5a0){if(_0x4bc5a0){_0x2e2105=_0x4bc5a0[_0x4d91('0x5e')];var _0x2a5bc0=_0x2e2105['slice'](-0x1);if(_0x2a5bc0==='/'){_0x2e2105=_0x2e2105[_0x4d91('0x5f')](0x0,_0x2e2105[_0x4d91('0x60')](_0x2a5bc0));}var _0xd94b29={'method':'GET','uri':util[_0x4d91('0x61')](_0x4d91('0x62'),_0x2e2105,_0x4d91('0x63')),'json':!![]};switch(_0x4bc5a0[_0x4d91('0x5d')]){case _0x4d91('0x64'):_0xd94b29[_0x4d91('0x65')]={'Authorization':util[_0x4d91('0x61')]('Basic\x20%s',new Buffer(util[_0x4d91('0x61')](_0x4d91('0x66'),_0x4bc5a0['username'],_0x4bc5a0[_0x4d91('0x64')]))['toString']('base64'))};break;case _0x4d91('0x5c'):_0xd94b29['headers']={'Authorization':util[_0x4d91('0x61')](_0x4d91('0x67'),new Buffer(util[_0x4d91('0x61')](_0x4d91('0x68'),_0x4bc5a0[_0x4d91('0x5b')],_0x4bc5a0[_0x4d91('0x5c')]))[_0x4d91('0x69')]('base64'))};break;default:throw new db['Sequelize'][(_0x4d91('0x6a'))](_0x4d91('0x6b'));}return rp(_0xd94b29);}})[_0x4d91('0x29')](function(_0x42164f){if(_0x42164f){var _0x1e3838=['subject','description',_0x4d91('0x6c'),'assignee'];_['remove'](_0x42164f[_0x4d91('0x63')],function(_0x54fea8){return _0x1e3838['includes'](_0x54fea8[_0x4d91('0x33')]);});return{'count':_0x42164f[_0x4d91('0x63')][_0x4d91('0x3b')],'rows':_['map'](_0x42164f['ticket_fields'],function(_0x52604d){return{'id':_0x52604d['id'],'name':_0x52604d[_0x4d91('0x6d')]>0x7?_0x52604d[_0x4d91('0x6e')]:_0x52604d[_0x4d91('0x33')],'custom':_0x52604d[_0x4d91('0x6d')]>0x7?!![]:![],'options':_0x52604d[_0x4d91('0x6f')]?_0x52604d[_0x4d91('0x6f')]:_0x52604d[_0x4d91('0x70')]?_0x52604d[_0x4d91('0x70')]:[]};})};}})[_0x4d91('0x29')](respondWithResult(_0x1be4b1,null))['catch'](function(_0xb9d1ff){var _0x579a9e=_0x4062c6['query'][_0x4d91('0x71')]?0x1f4:_0xb9d1ff[_0x4d91('0x72')]||0x1f4;logger[_0x4d91('0x2b')](_0x4d91('0x73'),'getFields',_0x579a9e,JSON[_0x4d91('0x74')](_0xb9d1ff));delete _0xb9d1ff[_0x4d91('0x2d')];if(_0x579a9e===0x191){_0x579a9e=0x190;}_0x1be4b1[_0x4d91('0x1d')](_0x579a9e)[_0x4d91('0x2e')](_0x4062c6[_0x4d91('0x36')][_0x4d91('0x71')]?{'message':_0x4d91('0x75'),'statusCode':_0xb9d1ff['statusCode']}:_0xb9d1ff);});}; \ No newline at end of file +var _0x6cb4=['getFields','username','password','token','authType','slice','substring','lastIndexOf','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','ZendeskAccount','include','findAll','catch','params','keys','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField'];(function(_0x2821cc,_0x3e5758){var _0x4e2412=function(_0x966800){while(--_0x966800){_0x2821cc['push'](_0x2821cc['shift']());}};_0x4e2412(++_0x3e5758);}(_0x6cb4,0xff));var _0x46cb=function(_0x46ee4e,_0x56aef6){_0x46ee4e=_0x46ee4e-0x0;var _0x56e736=_0x6cb4[_0x46ee4e];return _0x56e736;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];var integrations=require(_0x46cb('0x18'));function respondWithStatusCode(_0x1058a8,_0xf22158){_0xf22158=_0xf22158||0xcc;return function(_0x553440){if(_0x553440){return _0x1058a8[_0x46cb('0x19')](_0xf22158);}return _0x1058a8[_0x46cb('0x1a')](_0xf22158)[_0x46cb('0x1b')]();};}function respondWithResult(_0x3c0071,_0x1f7150){_0x1f7150=_0x1f7150||0xc8;return function(_0x32201f){if(_0x32201f){return _0x3c0071[_0x46cb('0x1a')](_0x1f7150)[_0x46cb('0x1c')](_0x32201f);}};}function respondWithFilteredResult(_0x37d368,_0x41e398){return function(_0x136215){if(_0x136215){var _0x5cdb4b=typeof _0x41e398[_0x46cb('0x1d')]==='undefined'&&typeof _0x41e398[_0x46cb('0x1e')]==='undefined';var _0x4e3d29=_0x136215['count'];var _0x1b6646=_0x5cdb4b?0x0:_0x41e398[_0x46cb('0x1d')];var _0x4df1f0=_0x5cdb4b?_0x136215[_0x46cb('0x1f')]:_0x41e398[_0x46cb('0x1d')]+_0x41e398[_0x46cb('0x1e')];var _0x264497;if(_0x4df1f0>=_0x4e3d29){_0x4df1f0=_0x4e3d29;_0x264497=0xc8;}else{_0x264497=0xce;}_0x37d368[_0x46cb('0x1a')](_0x264497);return _0x37d368[_0x46cb('0x20')](_0x46cb('0x21'),_0x1b6646+'-'+_0x4df1f0+'/'+_0x4e3d29)[_0x46cb('0x1c')](_0x136215);}return null;};}function patchUpdates(_0x46e541){return function(_0x21e72a){try{jsonpatch[_0x46cb('0x22')](_0x21e72a,_0x46e541,!![]);}catch(_0x188c28){return BPromise[_0x46cb('0x23')](_0x188c28);}return _0x21e72a[_0x46cb('0x24')]();};}function saveUpdates(_0x1fb467,_0x41ecd2){return function(_0xfbf576){if(_0xfbf576){return _0xfbf576[_0x46cb('0x25')](_0x1fb467)[_0x46cb('0x26')](function(_0x309e4b){return _0x309e4b;});}return null;};}function removeEntity(_0xadcad6,_0x40e0e5){return function(_0x5a1338){if(_0x5a1338){return _0x5a1338['destroy']()[_0x46cb('0x26')](function(){_0xadcad6[_0x46cb('0x1a')](0xcc)[_0x46cb('0x1b')]();});}};}function handleEntityNotFound(_0xe078a8,_0x6e6d9){return function(_0x589152){if(!_0x589152){_0xe078a8[_0x46cb('0x19')](0x194);}return _0x589152;};}function handleError(_0x578ffd,_0x495886){_0x495886=_0x495886||0x1f4;return function(_0x544465){logger[_0x46cb('0x27')](_0x544465[_0x46cb('0x28')]);if(_0x544465[_0x46cb('0x29')]){delete _0x544465[_0x46cb('0x29')];}_0x578ffd[_0x46cb('0x1a')](_0x495886)[_0x46cb('0x2a')](_0x544465);};}exports[_0x46cb('0x2b')]=function(_0x8c65b2,_0x2b846a){var _0x12e01e={},_0x4620ef={},_0x4a1517={'count':0x0,'rows':[]};var _0x1ce88f=_[_0x46cb('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x15f5cf){return{'name':_0x15f5cf['fieldName'],'type':_0x15f5cf[_0x46cb('0x2d')][_0x46cb('0x2e')]};});_0x4620ef[_0x46cb('0x2f')]=_[_0x46cb('0x2c')](_0x1ce88f,_0x46cb('0x29'));_0x4620ef[_0x46cb('0x30')]=_['keys'](_0x8c65b2[_0x46cb('0x30')]);_0x4620ef['filters']=_[_0x46cb('0x31')](_0x4620ef[_0x46cb('0x2f')],_0x4620ef['query']);_0x12e01e[_0x46cb('0x32')]=_[_0x46cb('0x31')](_0x4620ef[_0x46cb('0x2f')],qs[_0x46cb('0x33')](_0x8c65b2[_0x46cb('0x30')]['fields']));_0x12e01e[_0x46cb('0x32')]=_0x12e01e['attributes'][_0x46cb('0x34')]?_0x12e01e[_0x46cb('0x32')]:_0x4620ef[_0x46cb('0x2f')];if(!_0x8c65b2['query'][_0x46cb('0x35')](_0x46cb('0x36'))){_0x12e01e['limit']=qs[_0x46cb('0x1e')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x1e')]);_0x12e01e[_0x46cb('0x1d')]=qs[_0x46cb('0x1d')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x1d')]);}_0x12e01e[_0x46cb('0x37')]=qs[_0x46cb('0x38')](_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x38')]);_0x12e01e['where']=qs['filters'](_['pick'](_0x8c65b2[_0x46cb('0x30')],_0x4620ef[_0x46cb('0x39')]),_0x1ce88f);if(_0x8c65b2[_0x46cb('0x30')][_0x46cb('0x3a')]){_0x12e01e[_0x46cb('0x3b')]=_[_0x46cb('0x3c')](_0x12e01e['where'],{'$or':_[_0x46cb('0x2c')](_0x1ce88f,function(_0x4ae944){if(_0x4ae944['type']!==_0x46cb('0x3d')){var _0x59bdb0={};_0x59bdb0[_0x4ae944['name']]={'$like':'%'+_0x8c65b2[_0x46cb('0x30')]['filter']+'%'};return _0x59bdb0;}})});}_0x12e01e=_['merge']({},_0x12e01e,_0x8c65b2[_0x46cb('0x3e')]);var _0x10017d={'where':_0x12e01e[_0x46cb('0x3b')]};return db[_0x46cb('0x3f')][_0x46cb('0x1f')](_0x10017d)[_0x46cb('0x26')](function(_0x21f9a6){_0x4a1517['count']=_0x21f9a6;if(_0x8c65b2[_0x46cb('0x30')]['includeAll']){_0x12e01e[_0x46cb('0x40')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x46cb('0x41')](_0x12e01e);})[_0x46cb('0x26')](function(_0x2445a2){_0x4a1517['rows']=_0x2445a2;return _0x4a1517;})[_0x46cb('0x26')](respondWithFilteredResult(_0x2b846a,_0x12e01e))[_0x46cb('0x42')](handleError(_0x2b846a,null));};exports['show']=function(_0x18be96,_0x3d0b83){var _0x1f67af={'raw':![],'where':{'id':_0x18be96[_0x46cb('0x43')]['id']}},_0x66e602={};_0x66e602['model']=_['keys'](db[_0x46cb('0x3f')]['rawAttributes']);_0x66e602[_0x46cb('0x30')]=_[_0x46cb('0x44')](_0x18be96['query']);_0x66e602[_0x46cb('0x39')]=_[_0x46cb('0x31')](_0x66e602[_0x46cb('0x2f')],_0x66e602['query']);_0x1f67af['attributes']=_['intersection'](_0x66e602['model'],qs[_0x46cb('0x33')](_0x18be96[_0x46cb('0x30')][_0x46cb('0x33')]));_0x1f67af[_0x46cb('0x32')]=_0x1f67af[_0x46cb('0x32')]['length']?_0x1f67af['attributes']:_0x66e602[_0x46cb('0x2f')];if(_0x18be96[_0x46cb('0x30')]['includeAll']){_0x1f67af[_0x46cb('0x40')]=[{'all':!![]}];}_0x1f67af=_[_0x46cb('0x3c')]({},_0x1f67af,_0x18be96[_0x46cb('0x3e')]);return db[_0x46cb('0x3f')][_0x46cb('0x45')](_0x1f67af)[_0x46cb('0x26')](handleEntityNotFound(_0x3d0b83,null))[_0x46cb('0x26')](respondWithResult(_0x3d0b83,null))['catch'](handleError(_0x3d0b83,null));};exports['create']=function(_0x449593,_0x52ed52){return db[_0x46cb('0x3f')][_0x46cb('0x46')](_0x449593[_0x46cb('0x47')],{})['then'](respondWithResult(_0x52ed52,0xc9))[_0x46cb('0x42')](handleError(_0x52ed52,null));};exports['update']=function(_0x5c02c9,_0x16c500){if(_0x5c02c9[_0x46cb('0x47')]['id']){delete _0x5c02c9[_0x46cb('0x47')]['id'];}return db[_0x46cb('0x3f')][_0x46cb('0x45')]({'where':{'id':_0x5c02c9[_0x46cb('0x43')]['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x16c500,null))['then'](saveUpdates(_0x5c02c9['body'],null))[_0x46cb('0x26')](respondWithResult(_0x16c500,null))[_0x46cb('0x42')](handleError(_0x16c500,null));};exports['destroy']=function(_0x34399d,_0x33ab2e){return db[_0x46cb('0x3f')][_0x46cb('0x45')]({'where':{'id':_0x34399d[_0x46cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x33ab2e,null))[_0x46cb('0x26')](removeEntity(_0x33ab2e,null))[_0x46cb('0x42')](handleError(_0x33ab2e,null));};exports[_0x46cb('0x48')]=function(_0x52d1a7,_0x1f5c71,_0x56ad38){var _0x48b994={};var _0x1e46cc={};var _0x2cfe6f;var _0x2fe0b1;return db[_0x46cb('0x3f')][_0x46cb('0x49')]({'where':{'id':_0x52d1a7['params']['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x1f5c71,null))[_0x46cb('0x26')](function(_0x5701c0){if(_0x5701c0){_0x2cfe6f=_0x5701c0;_0x1e46cc['model']=_[_0x46cb('0x44')](db[_0x46cb('0x4a')][_0x46cb('0x4b')]);_0x1e46cc['query']=_[_0x46cb('0x44')](_0x52d1a7[_0x46cb('0x30')]);_0x1e46cc[_0x46cb('0x39')]=_[_0x46cb('0x31')](_0x1e46cc[_0x46cb('0x2f')],_0x1e46cc[_0x46cb('0x30')]);_0x48b994[_0x46cb('0x32')]=_[_0x46cb('0x31')](_0x1e46cc[_0x46cb('0x2f')],qs['fields'](_0x52d1a7[_0x46cb('0x30')]['fields']));_0x48b994[_0x46cb('0x32')]=_0x48b994[_0x46cb('0x32')][_0x46cb('0x34')]?_0x48b994[_0x46cb('0x32')]:_0x1e46cc['model'];_0x48b994[_0x46cb('0x37')]=qs[_0x46cb('0x38')](_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x38')]);_0x48b994[_0x46cb('0x3b')]=qs[_0x46cb('0x39')](_[_0x46cb('0x4c')](_0x52d1a7[_0x46cb('0x30')],_0x1e46cc['filters']));if(_0x52d1a7['query']['filter']){_0x48b994['where']=_[_0x46cb('0x3c')](_0x48b994[_0x46cb('0x3b')],{'$or':_['map'](_0x48b994[_0x46cb('0x32')],function(_0xfa28a8){var _0x10c3f9={};_0x10c3f9[_0xfa28a8]={'$like':'%'+_0x52d1a7['query']['filter']+'%'};return _0x10c3f9;})});}_0x48b994=_[_0x46cb('0x3c')]({},_0x48b994,_0x52d1a7['options']);return _0x2cfe6f[_0x46cb('0x48')](_0x48b994);}})[_0x46cb('0x26')](function(_0x1eb392){if(_0x1eb392){_0x2fe0b1=_0x1eb392[_0x46cb('0x34')];if(!_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x35')](_0x46cb('0x36'))){_0x48b994[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x52d1a7[_0x46cb('0x30')][_0x46cb('0x1e')]);_0x48b994[_0x46cb('0x1d')]=qs[_0x46cb('0x1d')](_0x52d1a7['query'][_0x46cb('0x1d')]);}return _0x2cfe6f['getConfigurations'](_0x48b994);}})[_0x46cb('0x26')](function(_0x478ada){if(_0x478ada){return _0x478ada?{'count':_0x2fe0b1,'rows':_0x478ada}:null;}})[_0x46cb('0x26')](respondWithResult(_0x1f5c71,null))[_0x46cb('0x42')](handleError(_0x1f5c71,null));};exports[_0x46cb('0x4d')]=function(_0x3dc4bd,_0x656601,_0x598a41){if(_0x3dc4bd[_0x46cb('0x47')]['id']){delete _0x3dc4bd[_0x46cb('0x47')]['id'];}return db[_0x46cb('0x3f')][_0x46cb('0x49')]({'where':{'id':_0x3dc4bd['params']['id']}})[_0x46cb('0x26')](handleEntityNotFound(_0x656601,null))[_0x46cb('0x26')](function(_0x6dc790){if(_0x6dc790){_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x4e')]=_0x6dc790['id'];_0x3dc4bd['body'][_0x46cb('0x4f')]=integrations[_0x46cb('0x50')](_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x51')],_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x2d')]);_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x52')]=integrations['getDescriptions'](_0x3dc4bd['body']['channel'],_0x3dc4bd[_0x46cb('0x47')][_0x46cb('0x2d')]);return db[_0x46cb('0x4a')][_0x46cb('0x46')](_0x3dc4bd[_0x46cb('0x47')],{'include':[{'model':db[_0x46cb('0x53')],'as':_0x46cb('0x4f')},{'model':db[_0x46cb('0x53')],'as':_0x46cb('0x52')}]});}return null;})[_0x46cb('0x26')](respondWithResult(_0x656601,null))[_0x46cb('0x42')](handleError(_0x656601,null));};exports[_0x46cb('0x54')]=function(_0x140c96,_0x2ea5d0,_0x5c9f3c){var _0x2e23e4='';return db['ZendeskAccount'][_0x46cb('0x49')]({'where':{'id':_0x140c96['params']['id']},'attributes':['id',_0x46cb('0x55'),_0x46cb('0x56'),_0x46cb('0x57'),_0x46cb('0x58'),'remoteUri']})[_0x46cb('0x26')](handleEntityNotFound(_0x2ea5d0,null))[_0x46cb('0x26')](function(_0x55895a){if(_0x55895a){_0x2e23e4=_0x55895a['remoteUri'];var _0x473758=_0x2e23e4[_0x46cb('0x59')](-0x1);if(_0x473758==='/'){_0x2e23e4=_0x2e23e4[_0x46cb('0x5a')](0x0,_0x2e23e4[_0x46cb('0x5b')](_0x473758));}var _0x1ba6ae={'method':'GET','uri':util['format']('%s/%s',_0x2e23e4,_0x46cb('0x5c')),'json':!![]};switch(_0x55895a[_0x46cb('0x58')]){case _0x46cb('0x56'):_0x1ba6ae[_0x46cb('0x5d')]={'Authorization':util[_0x46cb('0x5e')](_0x46cb('0x5f'),new Buffer(util[_0x46cb('0x5e')](_0x46cb('0x60'),_0x55895a[_0x46cb('0x55')],_0x55895a[_0x46cb('0x56')]))[_0x46cb('0x61')]('base64'))};break;case _0x46cb('0x57'):_0x1ba6ae[_0x46cb('0x5d')]={'Authorization':util[_0x46cb('0x5e')](_0x46cb('0x5f'),new Buffer(util['format'](_0x46cb('0x62'),_0x55895a[_0x46cb('0x55')],_0x55895a[_0x46cb('0x57')]))[_0x46cb('0x61')]('base64'))};break;default:throw new db[(_0x46cb('0x63'))][(_0x46cb('0x64'))](_0x46cb('0x65'));}return rp(_0x1ba6ae);}})[_0x46cb('0x26')](function(_0x5eaad6){if(_0x5eaad6){var _0x5775dc=['subject',_0x46cb('0x66'),'group',_0x46cb('0x67')];_['remove'](_0x5eaad6[_0x46cb('0x5c')],function(_0x36a82b){return _0x5775dc[_0x46cb('0x68')](_0x36a82b[_0x46cb('0x2d')]);});return{'count':_0x5eaad6['ticket_fields'][_0x46cb('0x34')],'rows':_[_0x46cb('0x2c')](_0x5eaad6[_0x46cb('0x5c')],function(_0x468d1f){return{'id':_0x468d1f['id'],'name':_0x468d1f['position']>0x7?_0x468d1f['title']:_0x468d1f[_0x46cb('0x2d')],'custom':_0x468d1f[_0x46cb('0x69')]>0x7?!![]:![],'options':_0x468d1f[_0x46cb('0x6a')]?_0x468d1f[_0x46cb('0x6a')]:_0x468d1f[_0x46cb('0x6b')]?_0x468d1f[_0x46cb('0x6b')]:[]};})};}})['then'](respondWithResult(_0x2ea5d0,null))['catch'](function(_0x3089d7){var _0x53eb=_0x140c96['query'][_0x46cb('0x6c')]?0x1f4:_0x3089d7[_0x46cb('0x6d')]||0x1f4;logger[_0x46cb('0x27')](_0x46cb('0x6e'),_0x46cb('0x54'),_0x53eb,JSON[_0x46cb('0x6f')](_0x3089d7));delete _0x3089d7[_0x46cb('0x29')];if(_0x53eb===0x191){_0x53eb=0x190;}_0x2ea5d0['status'](_0x53eb)[_0x46cb('0x2a')](_0x140c96[_0x46cb('0x30')][_0x46cb('0x6c')]?{'message':_0x46cb('0x70'),'statusCode':_0x3089d7[_0x46cb('0x6d')]}:_0x3089d7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index bb931fd..49632fe 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 _0x1526=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x1526,0xc1));var _0x6152=function(_0x482e7a,_0x2fdf84){_0x482e7a=_0x482e7a-0x0;var _0x276dc1=_0x1526[_0x482e7a];return _0x276dc1;};'use strict';var _=require(_0x6152('0x0'));var util=require(_0x6152('0x1'));var logger=require('../../config/logger')(_0x6152('0x2'));var moment=require('moment');var BPromise=require(_0x6152('0x3'));var rp=require(_0x6152('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6152('0x5'));var config=require(_0x6152('0x6'));var attributes=require(_0x6152('0x7'));var integrations=require(_0x6152('0x8'));module['exports']=function(_0x5b293,_0x16403e){return _0x5b293[_0x6152('0x9')]('ZendeskAccount',attributes,{'tableName':_0x6152('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x917a=['path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x588e8a,_0x4502f1){var _0x5976e9=function(_0x49cbf8){while(--_0x49cbf8){_0x588e8a['push'](_0x588e8a['shift']());}};_0x5976e9(++_0x4502f1);}(_0x917a,0x69));var _0xa917=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x917a[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xa917('0x0'));var util=require(_0xa917('0x1'));var logger=require(_0xa917('0x2'))(_0xa917('0x3'));var moment=require(_0xa917('0x4'));var BPromise=require(_0xa917('0x5'));var rp=require(_0xa917('0x6'));var fs=require('fs');var path=require(_0xa917('0x7'));var rimraf=require(_0xa917('0x8'));var config=require(_0xa917('0x9'));var attributes=require(_0xa917('0xa'));var integrations=require(_0xa917('0xb'));module['exports']=function(_0x4247fe,_0x55d6ba){return _0x4247fe['define'](_0xa917('0xc'),attributes,{'tableName':_0xa917('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 ae9843a..8bc9607 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 _0xeb93=['ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','map','include','model','find','where'];(function(_0x54ce42,_0x4198c){var _0x310389=function(_0x2b09e1){while(--_0x2b09e1){_0x54ce42['push'](_0x54ce42['shift']());}};_0x310389(++_0x4198c);}(_0xeb93,0x18d));var _0x3eb9=function(_0xd941d0,_0x483641){_0xd941d0=_0xd941d0-0x0;var _0x458841=_0xeb93[_0xd941d0];return _0x458841;};'use strict';var _=require(_0x3eb9('0x0'));var util=require(_0x3eb9('0x1'));var moment=require('moment');var BPromise=require(_0x3eb9('0x2'));var rs=require(_0x3eb9('0x3'));var fs=require('fs');var Redis=require(_0x3eb9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3eb9('0x5'));var logger=require(_0x3eb9('0x6'))(_0x3eb9('0x7'));var config=require(_0x3eb9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3eb9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b3ae,_0x2eca52,_0x217917){return new BPromise(function(_0x151471,_0x2fb718){return client['request'](_0x51b3ae,_0x217917)[_0x3eb9('0xa')](function(_0x549353){logger[_0x3eb9('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x2eca52,_0x3eb9('0xc'));logger[_0x3eb9('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2eca52,_0x3eb9('0xc'),JSON[_0x3eb9('0xe')](_0x549353));if(_0x549353[_0x3eb9('0xf')]){if(_0x549353[_0x3eb9('0xf')][_0x3eb9('0x10')]===0x1f4){logger[_0x3eb9('0xf')](_0x3eb9('0x11'),_0x2eca52,_0x549353[_0x3eb9('0xf')][_0x3eb9('0x12')]);return _0x2fb718(_0x549353[_0x3eb9('0xf')]['message']);}logger['error'](_0x3eb9('0x11'),_0x2eca52,_0x549353['error']['message']);return _0x151471(_0x549353[_0x3eb9('0xf')][_0x3eb9('0x12')]);}else{logger[_0x3eb9('0xb')](_0x3eb9('0x11'),_0x2eca52,'request\x20sent');_0x151471(_0x549353[_0x3eb9('0x13')][_0x3eb9('0x12')]);}})[_0x3eb9('0x14')](function(_0x156979){logger[_0x3eb9('0xf')](_0x3eb9('0x11'),_0x2eca52,_0x156979);_0x2fb718(_0x156979);});});}exports[_0x3eb9('0x15')]=function(_0x858c38){var _0x2c7c52=this;return new Promise(function(_0xc98bfc,_0x92d26f){return db[_0x3eb9('0x16')][_0x3eb9('0x17')]({'raw':_0x858c38[_0x3eb9('0x18')]?_0x858c38['options'][_0x3eb9('0x19')]===undefined?!![]:![]:!![],'where':_0x858c38[_0x3eb9('0x18')]?_0x858c38[_0x3eb9('0x18')]['where']||null:null,'attributes':_0x858c38['options']?_0x858c38[_0x3eb9('0x18')][_0x3eb9('0x1a')]||null:null,'limit':_0x858c38[_0x3eb9('0x18')]?_0x858c38[_0x3eb9('0x18')]['limit']||null:null,'include':_0x858c38[_0x3eb9('0x18')]?_0x858c38[_0x3eb9('0x18')]['include']?_[_0x3eb9('0x1b')](_0x858c38[_0x3eb9('0x18')][_0x3eb9('0x1c')],function(_0x34e7df){return{'model':db[_0x34e7df[_0x3eb9('0x1d')]],'as':_0x34e7df['as'],'attributes':_0x34e7df[_0x3eb9('0x1a')],'include':_0x34e7df[_0x3eb9('0x1c')]?_['map'](_0x34e7df[_0x3eb9('0x1c')],function(_0x152584){return{'model':db[_0x152584['model']],'as':_0x152584['as'],'attributes':_0x152584[_0x3eb9('0x1a')],'include':_0x152584[_0x3eb9('0x1c')]?_[_0x3eb9('0x1b')](_0x152584[_0x3eb9('0x1c')],function(_0xd28c28){return{'model':db[_0xd28c28[_0x3eb9('0x1d')]],'as':_0xd28c28['as'],'attributes':_0xd28c28[_0x3eb9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3eb9('0xa')](function(_0x59c08f){logger['info']('GetZendeskAccount',_0x858c38);logger[_0x3eb9('0xd')](_0x3eb9('0x15'),_0x858c38,JSON[_0x3eb9('0xe')](_0x59c08f));_0xc98bfc(_0x59c08f);})[_0x3eb9('0x14')](function(_0x11c1b1){logger[_0x3eb9('0xf')](_0x3eb9('0x15'),_0x11c1b1[_0x3eb9('0x12')],_0x858c38);_0x92d26f(_0x2c7c52['error'](0x1f4,_0x11c1b1['message']));});});};exports['ShowZendeskAccount']=function(_0x440593){var _0x1d8da9=this;return new Promise(function(_0x7ff8f7,_0x4c9b02){return db['ZendeskAccount'][_0x3eb9('0x1e')]({'raw':_0x440593[_0x3eb9('0x18')]?_0x440593[_0x3eb9('0x18')][_0x3eb9('0x19')]===undefined?!![]:![]:!![],'where':_0x440593[_0x3eb9('0x18')]?_0x440593[_0x3eb9('0x18')][_0x3eb9('0x1f')]||null:null,'attributes':_0x440593['options']?_0x440593[_0x3eb9('0x18')]['attributes']||null:null,'include':_0x440593[_0x3eb9('0x18')]?_0x440593[_0x3eb9('0x18')][_0x3eb9('0x1c')]?_[_0x3eb9('0x1b')](_0x440593[_0x3eb9('0x18')][_0x3eb9('0x1c')],function(_0x1ca6eb){return{'model':db[_0x1ca6eb[_0x3eb9('0x1d')]],'as':_0x1ca6eb['as'],'attributes':_0x1ca6eb[_0x3eb9('0x1a')],'include':_0x1ca6eb[_0x3eb9('0x1c')]?_[_0x3eb9('0x1b')](_0x1ca6eb[_0x3eb9('0x1c')],function(_0x2abd54){return{'model':db[_0x2abd54[_0x3eb9('0x1d')]],'as':_0x2abd54['as'],'attributes':_0x2abd54[_0x3eb9('0x1a')],'include':_0x2abd54[_0x3eb9('0x1c')]?_['map'](_0x2abd54[_0x3eb9('0x1c')],function(_0xe914c1){return{'model':db[_0xe914c1['model']],'as':_0xe914c1['as'],'attributes':_0xe914c1[_0x3eb9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3eb9('0xa')](function(_0x58406b){logger[_0x3eb9('0xb')](_0x3eb9('0x20'),_0x440593);logger[_0x3eb9('0xd')]('ShowZendeskAccount',_0x440593,JSON[_0x3eb9('0xe')](_0x58406b));_0x7ff8f7(_0x58406b);})['catch'](function(_0x2bf2a1){logger[_0x3eb9('0xf')]('ShowZendeskAccount',_0x2bf2a1[_0x3eb9('0x12')],_0x440593);_0x4c9b02(_0x1d8da9[_0x3eb9('0xf')](0x1f4,_0x2bf2a1[_0x3eb9('0x12')]));});});}; \ No newline at end of file +var _0x664d=['model','then','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x664d,0x1c2));var _0xd664=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x664d[_0x387603];return _0x55ea9e;};'use strict';var _=require(_0xd664('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd664('0x1'));var rs=require(_0xd664('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd664('0x3'))['db'];var utils=require(_0xd664('0x4'));var logger=require(_0xd664('0x5'))(_0xd664('0x6'));var config=require(_0xd664('0x7'));var jayson=require(_0xd664('0x8'));var client=jayson[_0xd664('0x9')][_0xd664('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49905f,_0x3ea009,_0x278423){return new BPromise(function(_0x1920b6,_0x537649){return client[_0xd664('0xb')](_0x49905f,_0x278423)['then'](function(_0x2d39d8){logger['info'](_0xd664('0xc'),_0x3ea009,'request\x20sent');logger['debug'](_0xd664('0xd'),_0x3ea009,_0xd664('0xe'),JSON[_0xd664('0xf')](_0x2d39d8));if(_0x2d39d8[_0xd664('0x10')]){if(_0x2d39d8['error'][_0xd664('0x11')]===0x1f4){logger[_0xd664('0x10')](_0xd664('0xc'),_0x3ea009,_0x2d39d8[_0xd664('0x10')][_0xd664('0x12')]);return _0x537649(_0x2d39d8['error'][_0xd664('0x12')]);}logger[_0xd664('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3ea009,_0x2d39d8[_0xd664('0x10')]['message']);return _0x1920b6(_0x2d39d8[_0xd664('0x10')][_0xd664('0x12')]);}else{logger[_0xd664('0x13')](_0xd664('0xc'),_0x3ea009,_0xd664('0xe'));_0x1920b6(_0x2d39d8[_0xd664('0x14')][_0xd664('0x12')]);}})[_0xd664('0x15')](function(_0x3899e7){logger[_0xd664('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x3ea009,_0x3899e7);_0x537649(_0x3899e7);});});}exports[_0xd664('0x16')]=function(_0x48f73a){var _0x1213f9=this;return new Promise(function(_0x4acbb8,_0x460f65){return db['ZendeskAccount'][_0xd664('0x17')]({'raw':_0x48f73a['options']?_0x48f73a[_0xd664('0x18')][_0xd664('0x19')]===undefined?!![]:![]:!![],'where':_0x48f73a[_0xd664('0x18')]?_0x48f73a[_0xd664('0x18')][_0xd664('0x1a')]||null:null,'attributes':_0x48f73a[_0xd664('0x18')]?_0x48f73a['options'][_0xd664('0x1b')]||null:null,'limit':_0x48f73a['options']?_0x48f73a['options'][_0xd664('0x1c')]||null:null,'include':_0x48f73a[_0xd664('0x18')]?_0x48f73a[_0xd664('0x18')][_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x48f73a[_0xd664('0x18')][_0xd664('0x1d')],function(_0x195aec){return{'model':db[_0x195aec[_0xd664('0x1f')]],'as':_0x195aec['as'],'attributes':_0x195aec[_0xd664('0x1b')],'include':_0x195aec[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x195aec[_0xd664('0x1d')],function(_0x3acae4){return{'model':db[_0x3acae4[_0xd664('0x1f')]],'as':_0x3acae4['as'],'attributes':_0x3acae4[_0xd664('0x1b')],'include':_0x3acae4[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x3acae4[_0xd664('0x1d')],function(_0x381ef2){return{'model':db[_0x381ef2[_0xd664('0x1f')]],'as':_0x381ef2['as'],'attributes':_0x381ef2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd664('0x20')](function(_0x7e4811){logger[_0xd664('0x13')](_0xd664('0x16'),_0x48f73a);logger[_0xd664('0x21')](_0xd664('0x16'),_0x48f73a,JSON[_0xd664('0xf')](_0x7e4811));_0x4acbb8(_0x7e4811);})[_0xd664('0x15')](function(_0x53df4a){logger[_0xd664('0x10')](_0xd664('0x16'),_0x53df4a[_0xd664('0x12')],_0x48f73a);_0x460f65(_0x1213f9[_0xd664('0x10')](0x1f4,_0x53df4a[_0xd664('0x12')]));});});};exports[_0xd664('0x22')]=function(_0x4139e9){var _0x12e9be=this;return new Promise(function(_0x342fd8,_0x65d407){return db[_0xd664('0x23')][_0xd664('0x24')]({'raw':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')][_0xd664('0x19')]===undefined?!![]:![]:!![],'where':_0x4139e9['options']?_0x4139e9[_0xd664('0x18')]['where']||null:null,'attributes':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')]['attributes']||null:null,'include':_0x4139e9[_0xd664('0x18')]?_0x4139e9[_0xd664('0x18')][_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x4139e9[_0xd664('0x18')][_0xd664('0x1d')],function(_0x1ec85b){return{'model':db[_0x1ec85b['model']],'as':_0x1ec85b['as'],'attributes':_0x1ec85b['attributes'],'include':_0x1ec85b[_0xd664('0x1d')]?_[_0xd664('0x1e')](_0x1ec85b['include'],function(_0x3be00e){return{'model':db[_0x3be00e[_0xd664('0x1f')]],'as':_0x3be00e['as'],'attributes':_0x3be00e[_0xd664('0x1b')],'include':_0x3be00e[_0xd664('0x1d')]?_['map'](_0x3be00e[_0xd664('0x1d')],function(_0x327d46){return{'model':db[_0x327d46[_0xd664('0x1f')]],'as':_0x327d46['as'],'attributes':_0x327d46['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1e45){logger['info'](_0xd664('0x22'),_0x4139e9);logger[_0xd664('0x21')](_0xd664('0x22'),_0x4139e9,JSON['stringify'](_0x3d1e45));_0x342fd8(_0x3d1e45);})[_0xd664('0x15')](function(_0x13f5fd){logger[_0xd664('0x10')](_0xd664('0x22'),_0x13f5fd['message'],_0x4139e9);_0x65d407(_0x12e9be[_0xd664('0x10')](0x1f4,_0x13f5fd['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 70a94bf..ba8404a 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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x59096c,_0x1aed81){var _0x2085fb=function(_0x1f8d66){while(--_0x1f8d66){_0x59096c['push'](_0x59096c['shift']());}};_0x2085fb(++_0x1aed81);}(_0x087b,0x11a));var _0xb087=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x087b[_0x172747];return _0x509692;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x21b7c5,_0x3fb56c){var _0x19a38b=function(_0x29920f){while(--_0x29920f){_0x21b7c5['push'](_0x21b7c5['shift']());}};_0x19a38b(++_0x3fb56c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5793335..896ae4c 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 _0x5ef8=['STRING','sequelize','exports'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0x5ef8,0xfd));var _0x85ef=function(_0x4fffcf,_0x49b324){_0x4fffcf=_0x4fffcf-0x0;var _0x544752=_0x5ef8[_0x4fffcf];return _0x544752;};'use strict';var Sequelize=require(_0x85ef('0x0'));module[_0x85ef('0x1')]={'name':{'type':Sequelize[_0x85ef('0x2')]},'description':{'type':Sequelize[_0x85ef('0x2')]}}; \ No newline at end of file +var _0x018f=['sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x018f,0x93));var _0xf018=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x018f[_0x254d9f];return _0x1eedb9;};'use strict';var Sequelize=require(_0xf018('0x0'));module[_0xf018('0x1')]={'name':{'type':Sequelize[_0xf018('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d15698c..0012c22 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 _0x0df8=['fields','includeAll','catch','create','body','find','params','getFields','findOne','ZendeskField','order','pick','options','getSubjects','length','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','destroy','then','error','stack','name','send','ZendeskConfiguration','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','show','rawAttributes'];(function(_0x35b36b,_0x1ca3b9){var _0x3cbf43=function(_0x3d95ab){while(--_0x3d95ab){_0x35b36b['push'](_0x35b36b['shift']());}};_0x3cbf43(++_0x1ca3b9);}(_0x0df8,0x66));var _0x80df=function(_0x5d095f,_0x1b2c96){_0x5d095f=_0x5d095f-0x0;var _0x3cb91c=_0x0df8[_0x5d095f];return _0x3cb91c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80df('0x0'));var zipdir=require(_0x80df('0x1'));var jsonpatch=require(_0x80df('0x2'));var rp=require(_0x80df('0x3'));var moment=require(_0x80df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80df('0x5'));var util=require('util');var path=require(_0x80df('0x6'));var sox=require(_0x80df('0x7'));var csv=require(_0x80df('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x80df('0x9'));var crypto=require(_0x80df('0xa'));var jsforce=require(_0x80df('0xb'));var deskjs=require(_0x80df('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80df('0xd'));var Papa=require('papaparse');var Redis=require(_0x80df('0xe'));var authService=require(_0x80df('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x80df('0x10'));var hardwareService=require(_0x80df('0x11'));var logger=require('../../config/logger')(_0x80df('0x12'));var utils=require(_0x80df('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x80df('0x14'));var db=require(_0x80df('0x15'))['db'];function respondWithStatusCode(_0x1156e9,_0x173b36){_0x173b36=_0x173b36||0xcc;return function(_0x4ccf04){if(_0x4ccf04){return _0x1156e9[_0x80df('0x16')](_0x173b36);}return _0x1156e9[_0x80df('0x17')](_0x173b36)[_0x80df('0x18')]();};}function respondWithResult(_0xb185ee,_0x1c0aaf){_0x1c0aaf=_0x1c0aaf||0xc8;return function(_0x501d38){if(_0x501d38){return _0xb185ee[_0x80df('0x17')](_0x1c0aaf)['json'](_0x501d38);}};}function respondWithFilteredResult(_0x559b01,_0x11b2b5){return function(_0xfc8e19){if(_0xfc8e19){var _0x3cc209=typeof _0x11b2b5[_0x80df('0x19')]==='undefined'&&typeof _0x11b2b5[_0x80df('0x1a')]===_0x80df('0x1b');var _0x582eed=_0xfc8e19[_0x80df('0x1c')];var _0x5e89e4=_0x3cc209?0x0:_0x11b2b5['offset'];var _0x37ae7e=_0x3cc209?_0xfc8e19[_0x80df('0x1c')]:_0x11b2b5[_0x80df('0x19')]+_0x11b2b5[_0x80df('0x1a')];var _0x304bf7;if(_0x37ae7e>=_0x582eed){_0x37ae7e=_0x582eed;_0x304bf7=0xc8;}else{_0x304bf7=0xce;}_0x559b01[_0x80df('0x17')](_0x304bf7);return _0x559b01[_0x80df('0x1d')](_0x80df('0x1e'),_0x5e89e4+'-'+_0x37ae7e+'/'+_0x582eed)[_0x80df('0x1f')](_0xfc8e19);}return null;};}function patchUpdates(_0x276ed0){return function(_0x3525ea){try{jsonpatch['apply'](_0x3525ea,_0x276ed0,!![]);}catch(_0x30e08f){return BPromise['reject'](_0x30e08f);}return _0x3525ea[_0x80df('0x20')]();};}function saveUpdates(_0x31f7ec,_0x180af3){return function(_0x4b9e76){if(_0x4b9e76){return _0x4b9e76[_0x80df('0x21')](_0x31f7ec)['then'](function(_0x3b39f6){return _0x3b39f6;});}return null;};}function removeEntity(_0x57be1d,_0x27c3e3){return function(_0x41dbf3){if(_0x41dbf3){return _0x41dbf3[_0x80df('0x22')]()[_0x80df('0x23')](function(){_0x57be1d[_0x80df('0x17')](0xcc)[_0x80df('0x18')]();});}};}function handleEntityNotFound(_0x1b1d13,_0x34b910){return function(_0x559da7){if(!_0x559da7){_0x1b1d13[_0x80df('0x16')](0x194);}return _0x559da7;};}function handleError(_0x4b2fb6,_0x52056b){_0x52056b=_0x52056b||0x1f4;return function(_0x323b8a){logger[_0x80df('0x24')](_0x323b8a[_0x80df('0x25')]);if(_0x323b8a[_0x80df('0x26')]){delete _0x323b8a['name'];}_0x4b2fb6['status'](_0x52056b)[_0x80df('0x27')](_0x323b8a);};}exports['index']=function(_0x5b6b06,_0x43dc99){var _0x2c947d={},_0x32d1ce={},_0x3d23dd={'count':0x0,'rows':[]};var _0x5cd224=_['map'](db[_0x80df('0x28')]['rawAttributes'],function(_0x4911e){return{'name':_0x4911e['fieldName'],'type':_0x4911e[_0x80df('0x29')][_0x80df('0x2a')]};});_0x32d1ce[_0x80df('0x2b')]=_[_0x80df('0x2c')](_0x5cd224,_0x80df('0x26'));_0x32d1ce[_0x80df('0x2d')]=_[_0x80df('0x2e')](_0x5b6b06[_0x80df('0x2d')]);_0x32d1ce['filters']=_[_0x80df('0x2f')](_0x32d1ce[_0x80df('0x2b')],_0x32d1ce[_0x80df('0x2d')]);_0x2c947d[_0x80df('0x30')]=_[_0x80df('0x2f')](_0x32d1ce[_0x80df('0x2b')],qs['fields'](_0x5b6b06[_0x80df('0x2d')]['fields']));_0x2c947d[_0x80df('0x30')]=_0x2c947d[_0x80df('0x30')]['length']?_0x2c947d[_0x80df('0x30')]:_0x32d1ce['model'];if(!_0x5b6b06[_0x80df('0x2d')][_0x80df('0x31')](_0x80df('0x32'))){_0x2c947d[_0x80df('0x1a')]=qs['limit'](_0x5b6b06[_0x80df('0x2d')][_0x80df('0x1a')]);_0x2c947d[_0x80df('0x19')]=qs[_0x80df('0x19')](_0x5b6b06[_0x80df('0x2d')][_0x80df('0x19')]);}_0x2c947d['order']=qs[_0x80df('0x33')](_0x5b6b06[_0x80df('0x2d')][_0x80df('0x33')]);_0x2c947d[_0x80df('0x34')]=qs['filters'](_['pick'](_0x5b6b06[_0x80df('0x2d')],_0x32d1ce[_0x80df('0x35')]),_0x5cd224);if(_0x5b6b06[_0x80df('0x2d')]['filter']){_0x2c947d['where']=_[_0x80df('0x36')](_0x2c947d[_0x80df('0x34')],{'$or':_[_0x80df('0x2c')](_0x5cd224,function(_0x4fad8a){if(_0x4fad8a[_0x80df('0x29')]!==_0x80df('0x37')){var _0x59ded3={};_0x59ded3[_0x4fad8a[_0x80df('0x26')]]={'$like':'%'+_0x5b6b06[_0x80df('0x2d')][_0x80df('0x38')]+'%'};return _0x59ded3;}})});}_0x2c947d=_[_0x80df('0x36')]({},_0x2c947d,_0x5b6b06['options']);var _0x22cf26={'where':_0x2c947d['where']};return db[_0x80df('0x28')]['count'](_0x22cf26)[_0x80df('0x23')](function(_0x201df7){_0x3d23dd[_0x80df('0x1c')]=_0x201df7;if(_0x5b6b06[_0x80df('0x2d')]['includeAll']){_0x2c947d[_0x80df('0x39')]=[{'all':!![]}];}return db[_0x80df('0x28')][_0x80df('0x3a')](_0x2c947d);})[_0x80df('0x23')](function(_0x466808){_0x3d23dd[_0x80df('0x3b')]=_0x466808;return _0x3d23dd;})[_0x80df('0x23')](respondWithFilteredResult(_0x43dc99,_0x2c947d))['catch'](handleError(_0x43dc99,null));};exports[_0x80df('0x3c')]=function(_0x35478e,_0x2884b3){var _0x4e6414={'raw':![],'where':{'id':_0x35478e['params']['id']}},_0x2ca235={};_0x2ca235[_0x80df('0x2b')]=_[_0x80df('0x2e')](db[_0x80df('0x28')][_0x80df('0x3d')]);_0x2ca235[_0x80df('0x2d')]=_[_0x80df('0x2e')](_0x35478e[_0x80df('0x2d')]);_0x2ca235[_0x80df('0x35')]=_[_0x80df('0x2f')](_0x2ca235['model'],_0x2ca235['query']);_0x4e6414[_0x80df('0x30')]=_[_0x80df('0x2f')](_0x2ca235[_0x80df('0x2b')],qs[_0x80df('0x3e')](_0x35478e[_0x80df('0x2d')][_0x80df('0x3e')]));_0x4e6414[_0x80df('0x30')]=_0x4e6414['attributes']['length']?_0x4e6414[_0x80df('0x30')]:_0x2ca235[_0x80df('0x2b')];if(_0x35478e['query'][_0x80df('0x3f')]){_0x4e6414['include']=[{'all':!![]}];}_0x4e6414=_[_0x80df('0x36')]({},_0x4e6414,_0x35478e['options']);return db[_0x80df('0x28')]['find'](_0x4e6414)['then'](handleEntityNotFound(_0x2884b3,null))['then'](respondWithResult(_0x2884b3,null))[_0x80df('0x40')](handleError(_0x2884b3,null));};exports[_0x80df('0x41')]=function(_0x505c1c,_0x352a61){return db[_0x80df('0x28')][_0x80df('0x41')](_0x505c1c[_0x80df('0x42')],{})[_0x80df('0x23')](respondWithResult(_0x352a61,0xc9))['catch'](handleError(_0x352a61,null));};exports[_0x80df('0x21')]=function(_0x429b5d,_0x4a7d22){if(_0x429b5d['body']['id']){delete _0x429b5d[_0x80df('0x42')]['id'];}return db['ZendeskConfiguration'][_0x80df('0x43')]({'where':{'id':_0x429b5d['params']['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x4a7d22,null))[_0x80df('0x23')](saveUpdates(_0x429b5d[_0x80df('0x42')],null))[_0x80df('0x23')](respondWithResult(_0x4a7d22,null))[_0x80df('0x40')](handleError(_0x4a7d22,null));};exports['destroy']=function(_0x4c13bf,_0x593321){return db[_0x80df('0x28')][_0x80df('0x43')]({'where':{'id':_0x4c13bf[_0x80df('0x44')]['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x593321,null))[_0x80df('0x23')](removeEntity(_0x593321,null))[_0x80df('0x40')](handleError(_0x593321,null));};exports[_0x80df('0x45')]=function(_0x3b51c2,_0x2d24e2,_0x1ee13e){var _0x1b0a74={};var _0x314213={};var _0xadc321;var _0x305dd6;return db['ZendeskConfiguration'][_0x80df('0x46')]({'where':{'id':_0x3b51c2[_0x80df('0x44')]['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x2d24e2,null))['then'](function(_0x3f82cb){if(_0x3f82cb){_0xadc321=_0x3f82cb;_0x314213[_0x80df('0x2b')]=_['keys'](db[_0x80df('0x47')][_0x80df('0x3d')]);_0x314213[_0x80df('0x2d')]=_[_0x80df('0x2e')](_0x3b51c2['query']);_0x314213['filters']=_[_0x80df('0x2f')](_0x314213[_0x80df('0x2b')],_0x314213['query']);_0x1b0a74[_0x80df('0x30')]=_['intersection'](_0x314213['model'],qs[_0x80df('0x3e')](_0x3b51c2['query'][_0x80df('0x3e')]));_0x1b0a74['attributes']=_0x1b0a74['attributes']['length']?_0x1b0a74[_0x80df('0x30')]:_0x314213[_0x80df('0x2b')];_0x1b0a74[_0x80df('0x48')]=qs[_0x80df('0x33')](_0x3b51c2[_0x80df('0x2d')]['sort']);_0x1b0a74[_0x80df('0x34')]=qs[_0x80df('0x35')](_[_0x80df('0x49')](_0x3b51c2['query'],_0x314213[_0x80df('0x35')]));if(_0x3b51c2[_0x80df('0x2d')][_0x80df('0x38')]){_0x1b0a74[_0x80df('0x34')]=_['merge'](_0x1b0a74[_0x80df('0x34')],{'$or':_['map'](_0x1b0a74[_0x80df('0x30')],function(_0x412121){var _0x30912a={};_0x30912a[_0x412121]={'$like':'%'+_0x3b51c2['query'][_0x80df('0x38')]+'%'};return _0x30912a;})});}_0x1b0a74=_[_0x80df('0x36')]({},_0x1b0a74,_0x3b51c2[_0x80df('0x4a')]);return _0xadc321[_0x80df('0x45')](_0x1b0a74);}})[_0x80df('0x23')](function(_0x3fb8d4){if(_0x3fb8d4){_0x305dd6=_0x3fb8d4['length'];if(!_0x3b51c2['query'][_0x80df('0x31')](_0x80df('0x32'))){_0x1b0a74['limit']=qs['limit'](_0x3b51c2[_0x80df('0x2d')][_0x80df('0x1a')]);_0x1b0a74[_0x80df('0x19')]=qs[_0x80df('0x19')](_0x3b51c2['query'][_0x80df('0x19')]);}return _0xadc321[_0x80df('0x45')](_0x1b0a74);}})[_0x80df('0x23')](function(_0x4b03ac){if(_0x4b03ac){return _0x4b03ac?{'count':_0x305dd6,'rows':_0x4b03ac}:null;}})[_0x80df('0x23')](respondWithResult(_0x2d24e2,null))['catch'](handleError(_0x2d24e2,null));};exports['getSubjects']=function(_0x550f25,_0x81e226,_0x46e6bb){var _0x5aa038={};var _0x474dd3={};var _0x1696df;var _0x142e08;return db['ZendeskConfiguration'][_0x80df('0x46')]({'where':{'id':_0x550f25['params']['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x81e226,null))['then'](function(_0x5d6634){if(_0x5d6634){_0x1696df=_0x5d6634;_0x474dd3['model']=_[_0x80df('0x2e')](db[_0x80df('0x47')][_0x80df('0x3d')]);_0x474dd3[_0x80df('0x2d')]=_[_0x80df('0x2e')](_0x550f25['query']);_0x474dd3[_0x80df('0x35')]=_['intersection'](_0x474dd3[_0x80df('0x2b')],_0x474dd3[_0x80df('0x2d')]);_0x5aa038[_0x80df('0x30')]=_[_0x80df('0x2f')](_0x474dd3[_0x80df('0x2b')],qs[_0x80df('0x3e')](_0x550f25['query'][_0x80df('0x3e')]));_0x5aa038[_0x80df('0x30')]=_0x5aa038[_0x80df('0x30')]['length']?_0x5aa038[_0x80df('0x30')]:_0x474dd3[_0x80df('0x2b')];_0x5aa038[_0x80df('0x48')]=qs[_0x80df('0x33')](_0x550f25[_0x80df('0x2d')][_0x80df('0x33')]);_0x5aa038[_0x80df('0x34')]=qs[_0x80df('0x35')](_[_0x80df('0x49')](_0x550f25[_0x80df('0x2d')],_0x474dd3[_0x80df('0x35')]));if(_0x550f25[_0x80df('0x2d')][_0x80df('0x38')]){_0x5aa038['where']=_['merge'](_0x5aa038['where'],{'$or':_['map'](_0x5aa038[_0x80df('0x30')],function(_0x3e7972){var _0x267f38={};_0x267f38[_0x3e7972]={'$like':'%'+_0x550f25['query']['filter']+'%'};return _0x267f38;})});}_0x5aa038=_[_0x80df('0x36')]({},_0x5aa038,_0x550f25[_0x80df('0x4a')]);return _0x1696df[_0x80df('0x4b')](_0x5aa038);}})[_0x80df('0x23')](function(_0x1d6c3f){if(_0x1d6c3f){_0x142e08=_0x1d6c3f[_0x80df('0x4c')];if(!_0x550f25[_0x80df('0x2d')][_0x80df('0x31')](_0x80df('0x32'))){_0x5aa038[_0x80df('0x1a')]=qs[_0x80df('0x1a')](_0x550f25[_0x80df('0x2d')]['limit']);_0x5aa038[_0x80df('0x19')]=qs['offset'](_0x550f25[_0x80df('0x2d')]['offset']);}return _0x1696df[_0x80df('0x4b')](_0x5aa038);}})['then'](function(_0xbe61f1){if(_0xbe61f1){return _0xbe61f1?{'count':_0x142e08,'rows':_0xbe61f1}:null;}})[_0x80df('0x23')](respondWithResult(_0x81e226,null))[_0x80df('0x40')](handleError(_0x81e226,null));};exports['getDescriptions']=function(_0x5f2df6,_0x5dd2bf,_0x10377d){var _0x49f5f7={};var _0x2e1320={};var _0xb44ab4;var _0xc61a12;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5f2df6[_0x80df('0x44')]['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x5dd2bf,null))[_0x80df('0x23')](function(_0x1f32d0){if(_0x1f32d0){_0xb44ab4=_0x1f32d0;_0x2e1320['model']=_['keys'](db[_0x80df('0x47')]['rawAttributes']);_0x2e1320[_0x80df('0x2d')]=_[_0x80df('0x2e')](_0x5f2df6[_0x80df('0x2d')]);_0x2e1320[_0x80df('0x35')]=_[_0x80df('0x2f')](_0x2e1320[_0x80df('0x2b')],_0x2e1320[_0x80df('0x2d')]);_0x49f5f7['attributes']=_['intersection'](_0x2e1320[_0x80df('0x2b')],qs[_0x80df('0x3e')](_0x5f2df6[_0x80df('0x2d')][_0x80df('0x3e')]));_0x49f5f7[_0x80df('0x30')]=_0x49f5f7[_0x80df('0x30')][_0x80df('0x4c')]?_0x49f5f7[_0x80df('0x30')]:_0x2e1320[_0x80df('0x2b')];_0x49f5f7[_0x80df('0x48')]=qs[_0x80df('0x33')](_0x5f2df6[_0x80df('0x2d')][_0x80df('0x33')]);_0x49f5f7['where']=qs[_0x80df('0x35')](_[_0x80df('0x49')](_0x5f2df6['query'],_0x2e1320[_0x80df('0x35')]));if(_0x5f2df6['query'][_0x80df('0x38')]){_0x49f5f7['where']=_[_0x80df('0x36')](_0x49f5f7['where'],{'$or':_[_0x80df('0x2c')](_0x49f5f7['attributes'],function(_0x3c8764){var _0x1b1a3f={};_0x1b1a3f[_0x3c8764]={'$like':'%'+_0x5f2df6[_0x80df('0x2d')][_0x80df('0x38')]+'%'};return _0x1b1a3f;})});}_0x49f5f7=_[_0x80df('0x36')]({},_0x49f5f7,_0x5f2df6[_0x80df('0x4a')]);return _0xb44ab4[_0x80df('0x4d')](_0x49f5f7);}})[_0x80df('0x23')](function(_0x11a7d8){if(_0x11a7d8){_0xc61a12=_0x11a7d8[_0x80df('0x4c')];if(!_0x5f2df6[_0x80df('0x2d')][_0x80df('0x31')](_0x80df('0x32'))){_0x49f5f7[_0x80df('0x1a')]=qs['limit'](_0x5f2df6[_0x80df('0x2d')]['limit']);_0x49f5f7[_0x80df('0x19')]=qs[_0x80df('0x19')](_0x5f2df6[_0x80df('0x2d')]['offset']);}return _0xb44ab4[_0x80df('0x4d')](_0x49f5f7);}})[_0x80df('0x23')](function(_0x5241a7){if(_0x5241a7){return _0x5241a7?{'count':_0xc61a12,'rows':_0x5241a7}:null;}})[_0x80df('0x23')](respondWithResult(_0x5dd2bf,null))['catch'](handleError(_0x5dd2bf,null));};exports[_0x80df('0x4e')]=function(_0x530f39,_0x26669e,_0x49dc36){var _0x32ee55={};var _0x1607fa={};var _0x42bdd1;var _0x3dd6a7;return db['ZendeskConfiguration'][_0x80df('0x46')]({'where':{'id':_0x530f39[_0x80df('0x44')]['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x26669e,null))['then'](function(_0x28e6b1){if(_0x28e6b1){_0x42bdd1=_0x28e6b1;_0x1607fa[_0x80df('0x2b')]=_['keys'](db[_0x80df('0x4f')][_0x80df('0x3d')]);_0x1607fa['query']=_['keys'](_0x530f39['query']);_0x1607fa[_0x80df('0x35')]=_[_0x80df('0x2f')](_0x1607fa[_0x80df('0x2b')],_0x1607fa[_0x80df('0x2d')]);_0x32ee55['attributes']=_[_0x80df('0x2f')](_0x1607fa[_0x80df('0x2b')],qs[_0x80df('0x3e')](_0x530f39[_0x80df('0x2d')]['fields']));_0x32ee55[_0x80df('0x30')]=_0x32ee55['attributes'][_0x80df('0x4c')]?_0x32ee55[_0x80df('0x30')]:_0x1607fa['model'];_0x32ee55['order']=qs[_0x80df('0x33')](_0x530f39[_0x80df('0x2d')]['sort']);_0x32ee55[_0x80df('0x34')]=qs['filters'](_[_0x80df('0x49')](_0x530f39[_0x80df('0x2d')],_0x1607fa[_0x80df('0x35')]));if(_0x530f39['query']['filter']){_0x32ee55[_0x80df('0x34')]=_['merge'](_0x32ee55['where'],{'$or':_[_0x80df('0x2c')](_0x32ee55[_0x80df('0x30')],function(_0x3f6024){var _0x1df986={};_0x1df986[_0x3f6024]={'$like':'%'+_0x530f39[_0x80df('0x2d')][_0x80df('0x38')]+'%'};return _0x1df986;})});}_0x32ee55=_[_0x80df('0x36')]({},_0x32ee55,_0x530f39[_0x80df('0x4a')]);return _0x42bdd1['getTags'](_0x32ee55);}})[_0x80df('0x23')](function(_0x17cf62){if(_0x17cf62){_0x3dd6a7=_0x17cf62[_0x80df('0x4c')];if(!_0x530f39[_0x80df('0x2d')][_0x80df('0x31')](_0x80df('0x32'))){_0x32ee55['limit']=qs['limit'](_0x530f39['query']['limit']);_0x32ee55[_0x80df('0x19')]=qs['offset'](_0x530f39[_0x80df('0x2d')]['offset']);}return _0x42bdd1['getTags'](_0x32ee55);}})[_0x80df('0x23')](function(_0xf1971d){if(_0xf1971d){return _0xf1971d?{'count':_0x3dd6a7,'rows':_0xf1971d}:null;}})[_0x80df('0x23')](respondWithResult(_0x26669e,null))[_0x80df('0x40')](handleError(_0x26669e,null));};exports[_0x80df('0x50')]=function(_0x3ca25c,_0x39aac2,_0x5a8987){if(_0x3ca25c[_0x80df('0x42')]['id']){delete _0x3ca25c[_0x80df('0x42')]['id'];}return db['ZendeskConfiguration'][_0x80df('0x46')]({'where':{'id':_0x3ca25c[_0x80df('0x44')]['id']}})[_0x80df('0x23')](handleEntityNotFound(_0x39aac2,null))[_0x80df('0x23')](function(_0x835323){if(_0x835323){return _0x835323[_0x80df('0x50')](_0x3ca25c[_0x80df('0x42')][_0x80df('0x51')]||[]);}return null;})[_0x80df('0x23')](respondWithResult(_0x39aac2,null))[_0x80df('0x40')](handleError(_0x39aac2,null));}; \ No newline at end of file +var _0xc306=['keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','body','destroy','getFields','findOne','nolimit','getSubjects','ZendeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query'];(function(_0x1b4587,_0x2add59){var _0x771ed4=function(_0x368d5e){while(--_0x368d5e){_0x1b4587['push'](_0x1b4587['shift']());}};_0x771ed4(++_0x2add59);}(_0xc306,0x74));var _0x6c30=function(_0x4bcf93,_0x455f39){_0x4bcf93=_0x4bcf93-0x0;var _0x23f44d=_0xc306[_0x4bcf93];return _0x23f44d;};'use strict';var emlformat=require(_0x6c30('0x0'));var rimraf=require(_0x6c30('0x1'));var zipdir=require(_0x6c30('0x2'));var jsonpatch=require(_0x6c30('0x3'));var rp=require(_0x6c30('0x4'));var moment=require(_0x6c30('0x5'));var BPromise=require(_0x6c30('0x6'));var Mustache=require(_0x6c30('0x7'));var util=require(_0x6c30('0x8'));var path=require(_0x6c30('0x9'));var sox=require(_0x6c30('0xa'));var csv=require(_0x6c30('0xb'));var ejs=require(_0x6c30('0xc'));var fs=require('fs');var fs_extra=require(_0x6c30('0xd'));var _=require(_0x6c30('0xe'));var squel=require(_0x6c30('0xf'));var crypto=require(_0x6c30('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c30('0xb'));var querystring=require('querystring');var Papa=require(_0x6c30('0x11'));var Redis=require(_0x6c30('0x12'));var authService=require(_0x6c30('0x13'));var qs=require(_0x6c30('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c30('0x15'));var logger=require('../../config/logger')(_0x6c30('0x16'));var utils=require(_0x6c30('0x17'));var config=require(_0x6c30('0x18'));var licenseUtil=require(_0x6c30('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321e67,_0x48a35b){_0x48a35b=_0x48a35b||0xcc;return function(_0x741f3c){if(_0x741f3c){return _0x321e67[_0x6c30('0x1a')](_0x48a35b);}return _0x321e67[_0x6c30('0x1b')](_0x48a35b)[_0x6c30('0x1c')]();};}function respondWithResult(_0x44bcc6,_0x557e16){_0x557e16=_0x557e16||0xc8;return function(_0x1ce13b){if(_0x1ce13b){return _0x44bcc6[_0x6c30('0x1b')](_0x557e16)['json'](_0x1ce13b);}};}function respondWithFilteredResult(_0x19d160,_0x3b9b4e){return function(_0x4f773e){if(_0x4f773e){var _0x3d4b24=typeof _0x3b9b4e[_0x6c30('0x1d')]==='undefined'&&typeof _0x3b9b4e[_0x6c30('0x1e')]==='undefined';var _0x2da7fa=_0x4f773e[_0x6c30('0x1f')];var _0x6f20b4=_0x3d4b24?0x0:_0x3b9b4e[_0x6c30('0x1d')];var _0x4da9ae=_0x3d4b24?_0x4f773e[_0x6c30('0x1f')]:_0x3b9b4e['offset']+_0x3b9b4e['limit'];var _0x6c102a;if(_0x4da9ae>=_0x2da7fa){_0x4da9ae=_0x2da7fa;_0x6c102a=0xc8;}else{_0x6c102a=0xce;}_0x19d160[_0x6c30('0x1b')](_0x6c102a);return _0x19d160[_0x6c30('0x20')]('Content-Range',_0x6f20b4+'-'+_0x4da9ae+'/'+_0x2da7fa)['json'](_0x4f773e);}return null;};}function patchUpdates(_0x2c888b){return function(_0x3a94ec){try{jsonpatch[_0x6c30('0x21')](_0x3a94ec,_0x2c888b,!![]);}catch(_0x471ca8){return BPromise[_0x6c30('0x22')](_0x471ca8);}return _0x3a94ec[_0x6c30('0x23')]();};}function saveUpdates(_0x5324e7,_0x1c3ee5){return function(_0x5173e1){if(_0x5173e1){return _0x5173e1[_0x6c30('0x24')](_0x5324e7)['then'](function(_0x497e45){return _0x497e45;});}return null;};}function removeEntity(_0x3cd707,_0x3e5f7d){return function(_0x472bb7){if(_0x472bb7){return _0x472bb7['destroy']()[_0x6c30('0x25')](function(){_0x3cd707[_0x6c30('0x1b')](0xcc)[_0x6c30('0x1c')]();});}};}function handleEntityNotFound(_0x2b5784,_0x105b25){return function(_0x37ec84){if(!_0x37ec84){_0x2b5784[_0x6c30('0x1a')](0x194);}return _0x37ec84;};}function handleError(_0x55ca30,_0x15104b){_0x15104b=_0x15104b||0x1f4;return function(_0x1a62a9){logger[_0x6c30('0x26')](_0x1a62a9[_0x6c30('0x27')]);if(_0x1a62a9[_0x6c30('0x28')]){delete _0x1a62a9[_0x6c30('0x28')];}_0x55ca30['status'](_0x15104b)[_0x6c30('0x29')](_0x1a62a9);};}exports[_0x6c30('0x2a')]=function(_0x18e2a4,_0x2e39aa){var _0x2bf594={},_0x393899={},_0x2392d5={'count':0x0,'rows':[]};var _0x26c9df=_['map'](db[_0x6c30('0x2b')]['rawAttributes'],function(_0x47a29c){return{'name':_0x47a29c[_0x6c30('0x2c')],'type':_0x47a29c[_0x6c30('0x2d')][_0x6c30('0x2e')]};});_0x393899[_0x6c30('0x2f')]=_[_0x6c30('0x30')](_0x26c9df,_0x6c30('0x28'));_0x393899[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x18e2a4['query']);_0x393899[_0x6c30('0x33')]=_['intersection'](_0x393899[_0x6c30('0x2f')],_0x393899['query']);_0x2bf594[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x393899[_0x6c30('0x2f')],qs['fields'](_0x18e2a4[_0x6c30('0x31')]['fields']));_0x2bf594[_0x6c30('0x34')]=_0x2bf594[_0x6c30('0x34')][_0x6c30('0x36')]?_0x2bf594[_0x6c30('0x34')]:_0x393899[_0x6c30('0x2f')];if(!_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x37')]('nolimit')){_0x2bf594[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x18e2a4[_0x6c30('0x31')]['limit']);_0x2bf594[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x1d')]);}_0x2bf594[_0x6c30('0x38')]=qs[_0x6c30('0x39')](_0x18e2a4['query'][_0x6c30('0x39')]);_0x2bf594[_0x6c30('0x3a')]=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x18e2a4[_0x6c30('0x31')],_0x393899['filters']),_0x26c9df);if(_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x2bf594[_0x6c30('0x3a')]=_['merge'](_0x2bf594[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x26c9df,function(_0x505dd1){if(_0x505dd1[_0x6c30('0x2d')]!=='VIRTUAL'){var _0x2da3bd={};_0x2da3bd[_0x505dd1['name']]={'$like':'%'+_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3c')]+'%'};return _0x2da3bd;}})});}_0x2bf594=_[_0x6c30('0x3d')]({},_0x2bf594,_0x18e2a4[_0x6c30('0x3e')]);var _0x43577e={'where':_0x2bf594[_0x6c30('0x3a')]};return db[_0x6c30('0x2b')][_0x6c30('0x1f')](_0x43577e)[_0x6c30('0x25')](function(_0x285733){_0x2392d5[_0x6c30('0x1f')]=_0x285733;if(_0x18e2a4[_0x6c30('0x31')][_0x6c30('0x3f')]){_0x2bf594[_0x6c30('0x40')]=[{'all':!![]}];}return db[_0x6c30('0x2b')][_0x6c30('0x41')](_0x2bf594);})[_0x6c30('0x25')](function(_0x5d2050){_0x2392d5[_0x6c30('0x42')]=_0x5d2050;return _0x2392d5;})[_0x6c30('0x25')](respondWithFilteredResult(_0x2e39aa,_0x2bf594))[_0x6c30('0x43')](handleError(_0x2e39aa,null));};exports[_0x6c30('0x44')]=function(_0x55955a,_0x6c7ae0){var _0x143062={'raw':![],'where':{'id':_0x55955a[_0x6c30('0x45')]['id']}},_0x1ea64f={};_0x1ea64f[_0x6c30('0x2f')]=_['keys'](db['ZendeskConfiguration'][_0x6c30('0x46')]);_0x1ea64f[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x55955a['query']);_0x1ea64f[_0x6c30('0x33')]=_['intersection'](_0x1ea64f[_0x6c30('0x2f')],_0x1ea64f[_0x6c30('0x31')]);_0x143062[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x1ea64f['model'],qs[_0x6c30('0x47')](_0x55955a[_0x6c30('0x31')][_0x6c30('0x47')]));_0x143062[_0x6c30('0x34')]=_0x143062[_0x6c30('0x34')][_0x6c30('0x36')]?_0x143062[_0x6c30('0x34')]:_0x1ea64f[_0x6c30('0x2f')];if(_0x55955a[_0x6c30('0x31')][_0x6c30('0x3f')]){_0x143062[_0x6c30('0x40')]=[{'all':!![]}];}_0x143062=_[_0x6c30('0x3d')]({},_0x143062,_0x55955a['options']);return db[_0x6c30('0x2b')][_0x6c30('0x48')](_0x143062)[_0x6c30('0x25')](handleEntityNotFound(_0x6c7ae0,null))[_0x6c30('0x25')](respondWithResult(_0x6c7ae0,null))[_0x6c30('0x43')](handleError(_0x6c7ae0,null));};exports['create']=function(_0x3db2ac,_0x2a092a){return db[_0x6c30('0x2b')]['create'](_0x3db2ac[_0x6c30('0x49')],{})['then'](respondWithResult(_0x2a092a,0xc9))[_0x6c30('0x43')](handleError(_0x2a092a,null));};exports[_0x6c30('0x24')]=function(_0x981998,_0x100f1d){if(_0x981998[_0x6c30('0x49')]['id']){delete _0x981998[_0x6c30('0x49')]['id'];}return db[_0x6c30('0x2b')]['find']({'where':{'id':_0x981998[_0x6c30('0x45')]['id']}})['then'](handleEntityNotFound(_0x100f1d,null))['then'](saveUpdates(_0x981998['body'],null))[_0x6c30('0x25')](respondWithResult(_0x100f1d,null))['catch'](handleError(_0x100f1d,null));};exports[_0x6c30('0x4a')]=function(_0x489c5e,_0x132101){return db[_0x6c30('0x2b')][_0x6c30('0x48')]({'where':{'id':_0x489c5e[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x132101,null))[_0x6c30('0x25')](removeEntity(_0x132101,null))['catch'](handleError(_0x132101,null));};exports[_0x6c30('0x4b')]=function(_0x46fefa,_0x545ded,_0xe9b0a0){var _0x51de8b={};var _0x5c6e96={};var _0x1c0c6a;var _0x13f7e3;return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x46fefa[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x545ded,null))[_0x6c30('0x25')](function(_0xa9a450){if(_0xa9a450){_0x1c0c6a=_0xa9a450;_0x5c6e96[_0x6c30('0x2f')]=_[_0x6c30('0x32')](db['ZendeskField'][_0x6c30('0x46')]);_0x5c6e96[_0x6c30('0x31')]=_[_0x6c30('0x32')](_0x46fefa[_0x6c30('0x31')]);_0x5c6e96[_0x6c30('0x33')]=_['intersection'](_0x5c6e96[_0x6c30('0x2f')],_0x5c6e96[_0x6c30('0x31')]);_0x51de8b[_0x6c30('0x34')]=_['intersection'](_0x5c6e96[_0x6c30('0x2f')],qs[_0x6c30('0x47')](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x47')]));_0x51de8b[_0x6c30('0x34')]=_0x51de8b[_0x6c30('0x34')][_0x6c30('0x36')]?_0x51de8b[_0x6c30('0x34')]:_0x5c6e96[_0x6c30('0x2f')];_0x51de8b['order']=qs['sort'](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x39')]);_0x51de8b['where']=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x46fefa[_0x6c30('0x31')],_0x5c6e96['filters']));if(_0x46fefa[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x51de8b['where']=_[_0x6c30('0x3d')](_0x51de8b[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x51de8b['attributes'],function(_0x2421aa){var _0x1bc794={};_0x1bc794[_0x2421aa]={'$like':'%'+_0x46fefa['query'][_0x6c30('0x3c')]+'%'};return _0x1bc794;})});}_0x51de8b=_['merge']({},_0x51de8b,_0x46fefa[_0x6c30('0x3e')]);return _0x1c0c6a['getFields'](_0x51de8b);}})[_0x6c30('0x25')](function(_0xf2b375){if(_0xf2b375){_0x13f7e3=_0xf2b375['length'];if(!_0x46fefa['query'][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x51de8b[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x46fefa['query']['limit']);_0x51de8b[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x46fefa[_0x6c30('0x31')][_0x6c30('0x1d')]);}return _0x1c0c6a['getFields'](_0x51de8b);}})[_0x6c30('0x25')](function(_0x1fbc0a){if(_0x1fbc0a){return _0x1fbc0a?{'count':_0x13f7e3,'rows':_0x1fbc0a}:null;}})[_0x6c30('0x25')](respondWithResult(_0x545ded,null))[_0x6c30('0x43')](handleError(_0x545ded,null));};exports[_0x6c30('0x4e')]=function(_0x510107,_0x1a0de3,_0x166a3a){var _0x3ec7e0={};var _0x509bb5={};var _0x386bbf;var _0x5cc0fa;return db['ZendeskConfiguration'][_0x6c30('0x4c')]({'where':{'id':_0x510107[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x1a0de3,null))['then'](function(_0x58d52f){if(_0x58d52f){_0x386bbf=_0x58d52f;_0x509bb5[_0x6c30('0x2f')]=_[_0x6c30('0x32')](db[_0x6c30('0x4f')]['rawAttributes']);_0x509bb5[_0x6c30('0x31')]=_['keys'](_0x510107[_0x6c30('0x31')]);_0x509bb5[_0x6c30('0x33')]=_[_0x6c30('0x35')](_0x509bb5[_0x6c30('0x2f')],_0x509bb5[_0x6c30('0x31')]);_0x3ec7e0['attributes']=_[_0x6c30('0x35')](_0x509bb5[_0x6c30('0x2f')],qs[_0x6c30('0x47')](_0x510107[_0x6c30('0x31')][_0x6c30('0x47')]));_0x3ec7e0[_0x6c30('0x34')]=_0x3ec7e0[_0x6c30('0x34')][_0x6c30('0x36')]?_0x3ec7e0[_0x6c30('0x34')]:_0x509bb5['model'];_0x3ec7e0[_0x6c30('0x38')]=qs['sort'](_0x510107[_0x6c30('0x31')][_0x6c30('0x39')]);_0x3ec7e0[_0x6c30('0x3a')]=qs['filters'](_[_0x6c30('0x3b')](_0x510107[_0x6c30('0x31')],_0x509bb5[_0x6c30('0x33')]));if(_0x510107['query'][_0x6c30('0x3c')]){_0x3ec7e0[_0x6c30('0x3a')]=_['merge'](_0x3ec7e0[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x3ec7e0[_0x6c30('0x34')],function(_0x17052d){var _0x8a46f1={};_0x8a46f1[_0x17052d]={'$like':'%'+_0x510107['query'][_0x6c30('0x3c')]+'%'};return _0x8a46f1;})});}_0x3ec7e0=_[_0x6c30('0x3d')]({},_0x3ec7e0,_0x510107[_0x6c30('0x3e')]);return _0x386bbf[_0x6c30('0x4e')](_0x3ec7e0);}})['then'](function(_0x3ac492){if(_0x3ac492){_0x5cc0fa=_0x3ac492[_0x6c30('0x36')];if(!_0x510107[_0x6c30('0x31')][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x3ec7e0[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x510107[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x3ec7e0['offset']=qs['offset'](_0x510107[_0x6c30('0x31')]['offset']);}return _0x386bbf[_0x6c30('0x4e')](_0x3ec7e0);}})[_0x6c30('0x25')](function(_0x5715eb){if(_0x5715eb){return _0x5715eb?{'count':_0x5cc0fa,'rows':_0x5715eb}:null;}})[_0x6c30('0x25')](respondWithResult(_0x1a0de3,null))[_0x6c30('0x43')](handleError(_0x1a0de3,null));};exports['getDescriptions']=function(_0x24e841,_0x4c8566,_0x4d6c7c){var _0x577789={};var _0x1180be={};var _0x58b2d9;var _0x3d961b;return db['ZendeskConfiguration'][_0x6c30('0x4c')]({'where':{'id':_0x24e841[_0x6c30('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c8566,null))[_0x6c30('0x25')](function(_0x141ed9){if(_0x141ed9){_0x58b2d9=_0x141ed9;_0x1180be['model']=_[_0x6c30('0x32')](db[_0x6c30('0x4f')][_0x6c30('0x46')]);_0x1180be['query']=_['keys'](_0x24e841[_0x6c30('0x31')]);_0x1180be[_0x6c30('0x33')]=_[_0x6c30('0x35')](_0x1180be['model'],_0x1180be[_0x6c30('0x31')]);_0x577789['attributes']=_[_0x6c30('0x35')](_0x1180be['model'],qs[_0x6c30('0x47')](_0x24e841[_0x6c30('0x31')]['fields']));_0x577789['attributes']=_0x577789[_0x6c30('0x34')][_0x6c30('0x36')]?_0x577789[_0x6c30('0x34')]:_0x1180be[_0x6c30('0x2f')];_0x577789[_0x6c30('0x38')]=qs[_0x6c30('0x39')](_0x24e841[_0x6c30('0x31')][_0x6c30('0x39')]);_0x577789[_0x6c30('0x3a')]=qs[_0x6c30('0x33')](_[_0x6c30('0x3b')](_0x24e841[_0x6c30('0x31')],_0x1180be['filters']));if(_0x24e841['query'][_0x6c30('0x3c')]){_0x577789[_0x6c30('0x3a')]=_['merge'](_0x577789[_0x6c30('0x3a')],{'$or':_[_0x6c30('0x30')](_0x577789[_0x6c30('0x34')],function(_0x3a5577){var _0x3928af={};_0x3928af[_0x3a5577]={'$like':'%'+_0x24e841[_0x6c30('0x31')]['filter']+'%'};return _0x3928af;})});}_0x577789=_[_0x6c30('0x3d')]({},_0x577789,_0x24e841[_0x6c30('0x3e')]);return _0x58b2d9['getDescriptions'](_0x577789);}})['then'](function(_0x51d7ce){if(_0x51d7ce){_0x3d961b=_0x51d7ce[_0x6c30('0x36')];if(!_0x24e841[_0x6c30('0x31')][_0x6c30('0x37')](_0x6c30('0x4d'))){_0x577789[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x24e841[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x577789['offset']=qs['offset'](_0x24e841[_0x6c30('0x31')]['offset']);}return _0x58b2d9['getDescriptions'](_0x577789);}})[_0x6c30('0x25')](function(_0x9faf39){if(_0x9faf39){return _0x9faf39?{'count':_0x3d961b,'rows':_0x9faf39}:null;}})[_0x6c30('0x25')](respondWithResult(_0x4c8566,null))[_0x6c30('0x43')](handleError(_0x4c8566,null));};exports[_0x6c30('0x50')]=function(_0x39fe61,_0x5df7f3,_0x14f002){var _0x3f0d7f={};var _0x3b598c={};var _0x33cfbd;var _0x316d7f;return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x39fe61[_0x6c30('0x45')]['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0x5df7f3,null))[_0x6c30('0x25')](function(_0x33744a){if(_0x33744a){_0x33cfbd=_0x33744a;_0x3b598c['model']=_[_0x6c30('0x32')](db[_0x6c30('0x51')][_0x6c30('0x46')]);_0x3b598c[_0x6c30('0x31')]=_['keys'](_0x39fe61['query']);_0x3b598c[_0x6c30('0x33')]=_['intersection'](_0x3b598c['model'],_0x3b598c[_0x6c30('0x31')]);_0x3f0d7f[_0x6c30('0x34')]=_[_0x6c30('0x35')](_0x3b598c['model'],qs['fields'](_0x39fe61['query']['fields']));_0x3f0d7f[_0x6c30('0x34')]=_0x3f0d7f[_0x6c30('0x34')]['length']?_0x3f0d7f[_0x6c30('0x34')]:_0x3b598c[_0x6c30('0x2f')];_0x3f0d7f['order']=qs['sort'](_0x39fe61[_0x6c30('0x31')][_0x6c30('0x39')]);_0x3f0d7f[_0x6c30('0x3a')]=qs['filters'](_[_0x6c30('0x3b')](_0x39fe61[_0x6c30('0x31')],_0x3b598c['filters']));if(_0x39fe61[_0x6c30('0x31')][_0x6c30('0x3c')]){_0x3f0d7f[_0x6c30('0x3a')]=_[_0x6c30('0x3d')](_0x3f0d7f[_0x6c30('0x3a')],{'$or':_['map'](_0x3f0d7f[_0x6c30('0x34')],function(_0x380387){var _0x1ec62f={};_0x1ec62f[_0x380387]={'$like':'%'+_0x39fe61[_0x6c30('0x31')][_0x6c30('0x3c')]+'%'};return _0x1ec62f;})});}_0x3f0d7f=_[_0x6c30('0x3d')]({},_0x3f0d7f,_0x39fe61[_0x6c30('0x3e')]);return _0x33cfbd[_0x6c30('0x50')](_0x3f0d7f);}})[_0x6c30('0x25')](function(_0x1b3c31){if(_0x1b3c31){_0x316d7f=_0x1b3c31[_0x6c30('0x36')];if(!_0x39fe61['query'][_0x6c30('0x37')]('nolimit')){_0x3f0d7f[_0x6c30('0x1e')]=qs[_0x6c30('0x1e')](_0x39fe61[_0x6c30('0x31')][_0x6c30('0x1e')]);_0x3f0d7f[_0x6c30('0x1d')]=qs[_0x6c30('0x1d')](_0x39fe61['query'][_0x6c30('0x1d')]);}return _0x33cfbd['getTags'](_0x3f0d7f);}})[_0x6c30('0x25')](function(_0x44934e){if(_0x44934e){return _0x44934e?{'count':_0x316d7f,'rows':_0x44934e}:null;}})[_0x6c30('0x25')](respondWithResult(_0x5df7f3,null))['catch'](handleError(_0x5df7f3,null));};exports['setTags']=function(_0x477e70,_0xc482d7,_0x794775){if(_0x477e70[_0x6c30('0x49')]['id']){delete _0x477e70[_0x6c30('0x49')]['id'];}return db[_0x6c30('0x2b')][_0x6c30('0x4c')]({'where':{'id':_0x477e70['params']['id']}})[_0x6c30('0x25')](handleEntityNotFound(_0xc482d7,null))[_0x6c30('0x25')](function(_0x1405ed){if(_0x1405ed){return _0x1405ed[_0x6c30('0x52')](_0x477e70[_0x6c30('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0xc482d7,null))['catch'](handleError(_0xc482d7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c8ff8d0..a538250 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 _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x32674b,_0x50cba5){var _0x38d463=function(_0x298ff4){while(--_0x298ff4){_0x32674b['push'](_0x32674b['shift']());}};_0x38d463(++_0x50cba5);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x137ca1,_0x55db7a){_0x137ca1=_0x137ca1-0x0;var _0x2fd145=_0xaebd[_0x137ca1];return _0x2fd145;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb688=['exports','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0xa96a9c,_0x242a1e){var _0x5bda18=function(_0x2177ac){while(--_0x2177ac){_0xa96a9c['push'](_0xa96a9c['shift']());}};_0x5bda18(++_0x242a1e);}(_0xb688,0xcf));var _0x8b68=function(_0x34c134,_0x3912e3){_0x34c134=_0x34c134-0x0;var _0x90c67e=_0xb688[_0x34c134];return _0x90c67e;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('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 cb5a03a..ff9ed39 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 _0x059b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','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','moment','bluebird','randomstring'];(function(_0x26dd31,_0x633be3){var _0x20cd37=function(_0x200b87){while(--_0x200b87){_0x26dd31['push'](_0x26dd31['shift']());}};_0x20cd37(++_0x633be3);}(_0x059b,0x133));var _0xb059=function(_0x3ba69f,_0x25a9d5){_0x3ba69f=_0x3ba69f-0x0;var _0xde4cbf=_0x059b[_0x3ba69f];return _0xde4cbf;};'use strict';var _=require(_0xb059('0x0'));var util=require(_0xb059('0x1'));var moment=require(_0xb059('0x2'));var BPromise=require(_0xb059('0x3'));var rs=require(_0xb059('0x4'));var fs=require('fs');var Redis=require(_0xb059('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb059('0x6'));var logger=require(_0xb059('0x7'))(_0xb059('0x8'));var config=require(_0xb059('0x9'));var jayson=require(_0xb059('0xa'));var client=jayson['client'][_0xb059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8bf3b1,_0x5d7b72,_0x3031bc){return new BPromise(function(_0xc2ee21,_0x2cbf15){return client['request'](_0x8bf3b1,_0x3031bc)[_0xb059('0xc')](function(_0x21d92c){logger[_0xb059('0xd')](_0xb059('0xe'),_0x5d7b72,_0xb059('0xf'));logger[_0xb059('0x10')](_0xb059('0x11'),_0x5d7b72,'request\x20sent',JSON[_0xb059('0x12')](_0x21d92c));if(_0x21d92c[_0xb059('0x13')]){if(_0x21d92c[_0xb059('0x13')][_0xb059('0x14')]===0x1f4){logger[_0xb059('0x13')](_0xb059('0xe'),_0x5d7b72,_0x21d92c[_0xb059('0x13')][_0xb059('0x15')]);return _0x2cbf15(_0x21d92c[_0xb059('0x13')][_0xb059('0x15')]);}logger[_0xb059('0x13')](_0xb059('0xe'),_0x5d7b72,_0x21d92c[_0xb059('0x13')][_0xb059('0x15')]);return _0xc2ee21(_0x21d92c['error']['message']);}else{logger[_0xb059('0xd')](_0xb059('0xe'),_0x5d7b72,_0xb059('0xf'));_0xc2ee21(_0x21d92c[_0xb059('0x16')][_0xb059('0x15')]);}})[_0xb059('0x17')](function(_0x34715c){logger[_0xb059('0x13')](_0xb059('0xe'),_0x5d7b72,_0x34715c);_0x2cbf15(_0x34715c);});});} \ No newline at end of file +var _0x146e=['request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x146e,0xa3));var _0xe146=function(_0x57a17b,_0x9214f){_0x57a17b=_0x57a17b-0x0;var _0x4918cf=_0x146e[_0x57a17b];return _0x4918cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe146('0x0'));var BPromise=require(_0xe146('0x1'));var rs=require(_0xe146('0x2'));var fs=require('fs');var Redis=require(_0xe146('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe146('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe146('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe146('0x6')][_0xe146('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x296c48,_0x7bfd4c,_0x38d1b3){return new BPromise(function(_0x47c564,_0x5496e8){return client[_0xe146('0x8')](_0x296c48,_0x38d1b3)['then'](function(_0x12a4b3){logger[_0xe146('0x9')](_0xe146('0xa'),_0x7bfd4c,_0xe146('0xb'));logger[_0xe146('0xc')](_0xe146('0xd'),_0x7bfd4c,_0xe146('0xb'),JSON['stringify'](_0x12a4b3));if(_0x12a4b3[_0xe146('0xe')]){if(_0x12a4b3[_0xe146('0xe')][_0xe146('0xf')]===0x1f4){logger[_0xe146('0xe')](_0xe146('0xa'),_0x7bfd4c,_0x12a4b3[_0xe146('0xe')]['message']);return _0x5496e8(_0x12a4b3['error'][_0xe146('0x10')]);}logger['error'](_0xe146('0xa'),_0x7bfd4c,_0x12a4b3[_0xe146('0xe')][_0xe146('0x10')]);return _0x47c564(_0x12a4b3[_0xe146('0xe')][_0xe146('0x10')]);}else{logger[_0xe146('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7bfd4c,_0xe146('0xb'));_0x47c564(_0x12a4b3[_0xe146('0x11')]['message']);}})[_0xe146('0x12')](function(_0xce97fb){logger[_0xe146('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7bfd4c,_0xce97fb);_0x5496e8(_0xce97fb);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d609890..4b2b600 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 _0xa603=['/:id','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa603,0xac));var _0x3a60=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa603[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x3a60('0x0'));var util=require(_0x3a60('0x1'));var path=require(_0x3a60('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a60('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3a60('0x4'));var interaction=require(_0x3a60('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x3a60('0x6')](),controller['index']);router[_0x3a60('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3a60('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3a60('0x9')]);router['put'](_0x3a60('0xa'),auth['isAuthenticated'](),controller[_0x3a60('0xb')]);router[_0x3a60('0xc')](_0x3a60('0xa'),auth[_0x3a60('0x6')](),controller[_0x3a60('0xd')]);module['exports']=router; \ No newline at end of file +var _0xaa6c=['../../config/environment','./intZendeskField.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2080f9,_0x42c071){var _0x21ed08=function(_0x36f9de){while(--_0x36f9de){_0x2080f9['push'](_0x2080f9['shift']());}};_0x21ed08(++_0x42c071);}(_0xaa6c,0x19d));var _0xcaa6=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xaa6c[_0xc77819];return _0x1c9434;};'use strict';var multer=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var path=require(_0xcaa6('0x2'));var timeout=require('connect-timeout');var express=require(_0xcaa6('0x3'));var router=express[_0xcaa6('0x4')]();var fs_extra=require(_0xcaa6('0x5'));var auth=require(_0xcaa6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcaa6('0x7'));var controller=require(_0xcaa6('0x8'));router[_0xcaa6('0x9')]('/',auth['isAuthenticated'](),controller[_0xcaa6('0xa')]);router[_0xcaa6('0x9')](_0xcaa6('0xb'),auth['isAuthenticated'](),controller[_0xcaa6('0xc')]);router['post']('/',auth[_0xcaa6('0xd')](),controller[_0xcaa6('0xe')]);router[_0xcaa6('0xf')](_0xcaa6('0xb'),auth['isAuthenticated'](),controller[_0xcaa6('0x10')]);router[_0xcaa6('0x11')](_0xcaa6('0xb'),auth[_0xcaa6('0xd')](),controller[_0xcaa6('0x12')]);module[_0xcaa6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 683111a..9dc75a8 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 _0x54b8=['STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x58617e,_0x2439c4){var _0xfa525d=function(_0x4e5fcf){while(--_0x4e5fcf){_0x58617e['push'](_0x58617e['shift']());}};_0xfa525d(++_0x2439c4);}(_0x54b8,0x1f2));var _0x854b=function(_0x533673,_0xf0d621){_0x533673=_0x533673-0x0;var _0x5971e7=_0x54b8[_0x533673];return _0x5971e7;};'use strict';var Sequelize=require('sequelize');module[_0x854b('0x0')]={'type':{'type':Sequelize[_0x854b('0x1')](_0x854b('0x2'),_0x854b('0x3'),_0x854b('0x4'),_0x854b('0x5'),'picklist'),'defaultValue':_0x854b('0x2')},'content':{'type':Sequelize[_0x854b('0x6')]},'key':{'type':Sequelize[_0x854b('0x6')]},'keyType':{'type':Sequelize[_0x854b('0x1')](_0x854b('0x2'),_0x854b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x854b('0x6')]},'nameField':{'type':Sequelize[_0x854b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0524=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x1c37f4,_0x3a9610){var _0xc0552e=function(_0x2fc63d){while(--_0x2fc63d){_0x1c37f4['push'](_0x1c37f4['shift']());}};_0xc0552e(++_0x3a9610);}(_0x0524,0xeb));var _0x4052=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x0524[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require('sequelize');module[_0x4052('0x0')]={'type':{'type':Sequelize[_0x4052('0x1')](_0x4052('0x2'),_0x4052('0x3'),_0x4052('0x4'),_0x4052('0x5'),'picklist'),'defaultValue':_0x4052('0x2')},'content':{'type':Sequelize[_0x4052('0x6')]},'key':{'type':Sequelize[_0x4052('0x6')]},'keyType':{'type':Sequelize[_0x4052('0x1')](_0x4052('0x2'),_0x4052('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4052('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4052('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4052('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dd7cf91..92bdd95 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 _0x4e0a=['api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b620b,_0x3ebaad){var _0x20575f=function(_0x6d6ca2){while(--_0x6d6ca2){_0x4b620b['push'](_0x4b620b['shift']());}};_0x20575f(++_0x3ebaad);}(_0x4e0a,0x127));var _0xa4e0=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x4e0a[_0x4de877];return _0xb2cfeb;};'use strict';var emlformat=require(_0xa4e0('0x0'));var rimraf=require(_0xa4e0('0x1'));var zipdir=require(_0xa4e0('0x2'));var jsonpatch=require(_0xa4e0('0x3'));var rp=require(_0xa4e0('0x4'));var moment=require(_0xa4e0('0x5'));var BPromise=require(_0xa4e0('0x6'));var Mustache=require(_0xa4e0('0x7'));var util=require('util');var path=require(_0xa4e0('0x8'));var sox=require(_0xa4e0('0x9'));var csv=require(_0xa4e0('0xa'));var ejs=require(_0xa4e0('0xb'));var fs=require('fs');var fs_extra=require(_0xa4e0('0xc'));var _=require(_0xa4e0('0xd'));var squel=require(_0xa4e0('0xe'));var crypto=require(_0xa4e0('0xf'));var jsforce=require(_0xa4e0('0x10'));var deskjs=require(_0xa4e0('0x11'));var toCsv=require(_0xa4e0('0xa'));var querystring=require(_0xa4e0('0x12'));var Papa=require(_0xa4e0('0x13'));var Redis=require('ioredis');var authService=require(_0xa4e0('0x14'));var qs=require(_0xa4e0('0x15'));var as=require(_0xa4e0('0x16'));var hardwareService=require(_0xa4e0('0x17'));var logger=require(_0xa4e0('0x18'))(_0xa4e0('0x19'));var utils=require(_0xa4e0('0x1a'));var config=require(_0xa4e0('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3073a2,_0x122d84){_0x122d84=_0x122d84||0xcc;return function(_0x1d2289){if(_0x1d2289){return _0x3073a2[_0xa4e0('0x1c')](_0x122d84);}return _0x3073a2['status'](_0x122d84)[_0xa4e0('0x1d')]();};}function respondWithResult(_0xb64d93,_0x269b62){_0x269b62=_0x269b62||0xc8;return function(_0x315c53){if(_0x315c53){return _0xb64d93[_0xa4e0('0x1e')](_0x269b62)[_0xa4e0('0x1f')](_0x315c53);}};}function respondWithFilteredResult(_0x33d5cc,_0x676204){return function(_0x1a859e){if(_0x1a859e){var _0x10adc=typeof _0x676204['offset']===_0xa4e0('0x20')&&typeof _0x676204[_0xa4e0('0x21')]===_0xa4e0('0x20');var _0x3c5d36=_0x1a859e[_0xa4e0('0x22')];var _0x3c476d=_0x10adc?0x0:_0x676204[_0xa4e0('0x23')];var _0x23ac38=_0x10adc?_0x1a859e['count']:_0x676204['offset']+_0x676204[_0xa4e0('0x21')];var _0x4f23eb;if(_0x23ac38>=_0x3c5d36){_0x23ac38=_0x3c5d36;_0x4f23eb=0xc8;}else{_0x4f23eb=0xce;}_0x33d5cc['status'](_0x4f23eb);return _0x33d5cc[_0xa4e0('0x24')](_0xa4e0('0x25'),_0x3c476d+'-'+_0x23ac38+'/'+_0x3c5d36)[_0xa4e0('0x1f')](_0x1a859e);}return null;};}function patchUpdates(_0x4012ad){return function(_0x51b96a){try{jsonpatch['apply'](_0x51b96a,_0x4012ad,!![]);}catch(_0x492ab8){return BPromise[_0xa4e0('0x26')](_0x492ab8);}return _0x51b96a[_0xa4e0('0x27')]();};}function saveUpdates(_0x581307,_0x5627f0){return function(_0x16101f){if(_0x16101f){return _0x16101f[_0xa4e0('0x28')](_0x581307)[_0xa4e0('0x29')](function(_0x3db3c9){return _0x3db3c9;});}return null;};}function removeEntity(_0x3d3039,_0x2765d3){return function(_0x330050){if(_0x330050){return _0x330050[_0xa4e0('0x2a')]()[_0xa4e0('0x29')](function(){_0x3d3039[_0xa4e0('0x1e')](0xcc)[_0xa4e0('0x1d')]();});}};}function handleEntityNotFound(_0x57ddc6,_0x2ef866){return function(_0x19d190){if(!_0x19d190){_0x57ddc6[_0xa4e0('0x1c')](0x194);}return _0x19d190;};}function handleError(_0x2e579b,_0x43f4ca){_0x43f4ca=_0x43f4ca||0x1f4;return function(_0x23ca47){logger[_0xa4e0('0x2b')](_0x23ca47[_0xa4e0('0x2c')]);if(_0x23ca47[_0xa4e0('0x2d')]){delete _0x23ca47[_0xa4e0('0x2d')];}_0x2e579b[_0xa4e0('0x1e')](_0x43f4ca)[_0xa4e0('0x2e')](_0x23ca47);};}exports[_0xa4e0('0x2f')]=function(_0x3a68f3,_0x4e5d56){var _0xaf927b={},_0x3e3e1e={},_0x11026d={'count':0x0,'rows':[]};var _0x9d69d5=_[_0xa4e0('0x30')](db[_0xa4e0('0x31')][_0xa4e0('0x32')],function(_0x541d13){return{'name':_0x541d13[_0xa4e0('0x33')],'type':_0x541d13[_0xa4e0('0x34')]['key']};});_0x3e3e1e['model']=_[_0xa4e0('0x30')](_0x9d69d5,'name');_0x3e3e1e[_0xa4e0('0x35')]=_[_0xa4e0('0x36')](_0x3a68f3['query']);_0x3e3e1e[_0xa4e0('0x37')]=_['intersection'](_0x3e3e1e[_0xa4e0('0x38')],_0x3e3e1e[_0xa4e0('0x35')]);_0xaf927b[_0xa4e0('0x39')]=_[_0xa4e0('0x3a')](_0x3e3e1e[_0xa4e0('0x38')],qs[_0xa4e0('0x3b')](_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x3b')]));_0xaf927b['attributes']=_0xaf927b['attributes'][_0xa4e0('0x3c')]?_0xaf927b['attributes']:_0x3e3e1e[_0xa4e0('0x38')];if(!_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x3d')](_0xa4e0('0x3e'))){_0xaf927b[_0xa4e0('0x21')]=qs[_0xa4e0('0x21')](_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x21')]);_0xaf927b[_0xa4e0('0x23')]=qs['offset'](_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x23')]);}_0xaf927b[_0xa4e0('0x3f')]=qs[_0xa4e0('0x40')](_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x40')]);_0xaf927b[_0xa4e0('0x41')]=qs[_0xa4e0('0x37')](_[_0xa4e0('0x42')](_0x3a68f3[_0xa4e0('0x35')],_0x3e3e1e[_0xa4e0('0x37')]),_0x9d69d5);if(_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x43')]){_0xaf927b[_0xa4e0('0x41')]=_['merge'](_0xaf927b['where'],{'$or':_[_0xa4e0('0x30')](_0x9d69d5,function(_0x1175c0){if(_0x1175c0[_0xa4e0('0x34')]!==_0xa4e0('0x44')){var _0x4b04b5={};_0x4b04b5[_0x1175c0[_0xa4e0('0x2d')]]={'$like':'%'+_0x3a68f3[_0xa4e0('0x35')][_0xa4e0('0x43')]+'%'};return _0x4b04b5;}})});}_0xaf927b=_[_0xa4e0('0x45')]({},_0xaf927b,_0x3a68f3[_0xa4e0('0x46')]);var _0x19ea25={'where':_0xaf927b[_0xa4e0('0x41')]};return db['ZendeskField'][_0xa4e0('0x22')](_0x19ea25)[_0xa4e0('0x29')](function(_0x575bfd){_0x11026d[_0xa4e0('0x22')]=_0x575bfd;if(_0x3a68f3['query'][_0xa4e0('0x47')]){_0xaf927b[_0xa4e0('0x48')]=[{'all':!![]}];}return db['ZendeskField'][_0xa4e0('0x49')](_0xaf927b);})[_0xa4e0('0x29')](function(_0xa533aa){_0x11026d['rows']=_0xa533aa;return _0x11026d;})[_0xa4e0('0x29')](respondWithFilteredResult(_0x4e5d56,_0xaf927b))['catch'](handleError(_0x4e5d56,null));};exports[_0xa4e0('0x4a')]=function(_0x5955a1,_0x302c3a){var _0x306d0a={'raw':!![],'where':{'id':_0x5955a1[_0xa4e0('0x4b')]['id']}},_0x448b11={};_0x448b11[_0xa4e0('0x38')]=_[_0xa4e0('0x36')](db['ZendeskField'][_0xa4e0('0x32')]);_0x448b11[_0xa4e0('0x35')]=_[_0xa4e0('0x36')](_0x5955a1[_0xa4e0('0x35')]);_0x448b11[_0xa4e0('0x37')]=_[_0xa4e0('0x3a')](_0x448b11[_0xa4e0('0x38')],_0x448b11[_0xa4e0('0x35')]);_0x306d0a['attributes']=_[_0xa4e0('0x3a')](_0x448b11[_0xa4e0('0x38')],qs[_0xa4e0('0x3b')](_0x5955a1[_0xa4e0('0x35')][_0xa4e0('0x3b')]));_0x306d0a[_0xa4e0('0x39')]=_0x306d0a[_0xa4e0('0x39')]['length']?_0x306d0a[_0xa4e0('0x39')]:_0x448b11['model'];if(_0x5955a1[_0xa4e0('0x35')][_0xa4e0('0x47')]){_0x306d0a[_0xa4e0('0x48')]=[{'all':!![]}];}_0x306d0a=_[_0xa4e0('0x45')]({},_0x306d0a,_0x5955a1[_0xa4e0('0x46')]);return db[_0xa4e0('0x31')][_0xa4e0('0x4c')](_0x306d0a)[_0xa4e0('0x29')](handleEntityNotFound(_0x302c3a,null))[_0xa4e0('0x29')](respondWithResult(_0x302c3a,null))[_0xa4e0('0x4d')](handleError(_0x302c3a,null));};exports[_0xa4e0('0x4e')]=function(_0x4c0b2f,_0x5f0ef4){return db[_0xa4e0('0x31')][_0xa4e0('0x4e')](_0x4c0b2f[_0xa4e0('0x4f')],{})[_0xa4e0('0x29')](respondWithResult(_0x5f0ef4,0xc9))[_0xa4e0('0x4d')](handleError(_0x5f0ef4,null));};exports[_0xa4e0('0x28')]=function(_0x53ece9,_0x43e39c){if(_0x53ece9['body']['id']){delete _0x53ece9[_0xa4e0('0x4f')]['id'];}return db[_0xa4e0('0x31')][_0xa4e0('0x4c')]({'where':{'id':_0x53ece9[_0xa4e0('0x4b')]['id']}})[_0xa4e0('0x29')](handleEntityNotFound(_0x43e39c,null))[_0xa4e0('0x29')](saveUpdates(_0x53ece9[_0xa4e0('0x4f')],null))['then'](respondWithResult(_0x43e39c,null))[_0xa4e0('0x4d')](handleError(_0x43e39c,null));};exports[_0xa4e0('0x2a')]=function(_0x599dbe,_0x520cd7){return db[_0xa4e0('0x31')][_0xa4e0('0x4c')]({'where':{'id':_0x599dbe[_0xa4e0('0x4b')]['id']}})[_0xa4e0('0x29')](handleEntityNotFound(_0x520cd7,null))[_0xa4e0('0x29')](removeEntity(_0x520cd7,null))[_0xa4e0('0x4d')](handleError(_0x520cd7,null));}; \ No newline at end of file +var _0xf951=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZendeskField','includeAll','include','findAll','rows','show','params','catch','create','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api'];(function(_0x5c3444,_0x4bb587){var _0x1d9516=function(_0x4863b8){while(--_0x4863b8){_0x5c3444['push'](_0x5c3444['shift']());}};_0x1d9516(++_0x4bb587);}(_0xf951,0x1f3));var _0x1f95=function(_0x23bf7f,_0x578f6c){_0x23bf7f=_0x23bf7f-0x0;var _0x64b00e=_0xf951[_0x23bf7f];return _0x64b00e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f95('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f95('0x1'));var rp=require(_0x1f95('0x2'));var moment=require('moment');var BPromise=require(_0x1f95('0x3'));var Mustache=require(_0x1f95('0x4'));var util=require(_0x1f95('0x5'));var path=require(_0x1f95('0x6'));var sox=require('sox');var csv=require(_0x1f95('0x7'));var ejs=require(_0x1f95('0x8'));var fs=require('fs');var fs_extra=require(_0x1f95('0x9'));var _=require(_0x1f95('0xa'));var squel=require(_0x1f95('0xb'));var crypto=require(_0x1f95('0xc'));var jsforce=require(_0x1f95('0xd'));var deskjs=require(_0x1f95('0xe'));var toCsv=require(_0x1f95('0x7'));var querystring=require(_0x1f95('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f95('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f95('0x11'));var logger=require('../../config/logger')(_0x1f95('0x12'));var utils=require(_0x1f95('0x13'));var config=require(_0x1f95('0x14'));var licenseUtil=require(_0x1f95('0x15'));var db=require(_0x1f95('0x16'))['db'];function respondWithStatusCode(_0x26911e,_0x7164fc){_0x7164fc=_0x7164fc||0xcc;return function(_0xc664e){if(_0xc664e){return _0x26911e[_0x1f95('0x17')](_0x7164fc);}return _0x26911e[_0x1f95('0x18')](_0x7164fc)['end']();};}function respondWithResult(_0x410076,_0x176c7f){_0x176c7f=_0x176c7f||0xc8;return function(_0x21f802){if(_0x21f802){return _0x410076[_0x1f95('0x18')](_0x176c7f)[_0x1f95('0x19')](_0x21f802);}};}function respondWithFilteredResult(_0x47f57b,_0x3dd511){return function(_0x282757){if(_0x282757){var _0x5799be=typeof _0x3dd511['offset']===_0x1f95('0x1a')&&typeof _0x3dd511[_0x1f95('0x1b')]===_0x1f95('0x1a');var _0x46ca05=_0x282757['count'];var _0x4d1cc2=_0x5799be?0x0:_0x3dd511[_0x1f95('0x1c')];var _0x5b83ee=_0x5799be?_0x282757[_0x1f95('0x1d')]:_0x3dd511[_0x1f95('0x1c')]+_0x3dd511[_0x1f95('0x1b')];var _0x321823;if(_0x5b83ee>=_0x46ca05){_0x5b83ee=_0x46ca05;_0x321823=0xc8;}else{_0x321823=0xce;}_0x47f57b[_0x1f95('0x18')](_0x321823);return _0x47f57b[_0x1f95('0x1e')](_0x1f95('0x1f'),_0x4d1cc2+'-'+_0x5b83ee+'/'+_0x46ca05)[_0x1f95('0x19')](_0x282757);}return null;};}function patchUpdates(_0x3d1471){return function(_0x56d85e){try{jsonpatch[_0x1f95('0x20')](_0x56d85e,_0x3d1471,!![]);}catch(_0x237282){return BPromise['reject'](_0x237282);}return _0x56d85e[_0x1f95('0x21')]();};}function saveUpdates(_0x4f4474,_0x1b2eb8){return function(_0x6be539){if(_0x6be539){return _0x6be539[_0x1f95('0x22')](_0x4f4474)[_0x1f95('0x23')](function(_0x52d7df){return _0x52d7df;});}return null;};}function removeEntity(_0x342d11,_0x53a917){return function(_0x5b9f9f){if(_0x5b9f9f){return _0x5b9f9f[_0x1f95('0x24')]()[_0x1f95('0x23')](function(){_0x342d11['status'](0xcc)[_0x1f95('0x25')]();});}};}function handleEntityNotFound(_0x5a1ca4,_0x1ef0d6){return function(_0x4ddc3f){if(!_0x4ddc3f){_0x5a1ca4[_0x1f95('0x17')](0x194);}return _0x4ddc3f;};}function handleError(_0x2c5461,_0x52ba53){_0x52ba53=_0x52ba53||0x1f4;return function(_0x1936f5){logger[_0x1f95('0x26')](_0x1936f5[_0x1f95('0x27')]);if(_0x1936f5[_0x1f95('0x28')]){delete _0x1936f5[_0x1f95('0x28')];}_0x2c5461[_0x1f95('0x18')](_0x52ba53)['send'](_0x1936f5);};}exports[_0x1f95('0x29')]=function(_0xe8548c,_0x16ccf4){var _0x1eb960={},_0xe59b5b={},_0x3b735b={'count':0x0,'rows':[]};var _0x233a39=_[_0x1f95('0x2a')](db['ZendeskField']['rawAttributes'],function(_0x1de842){return{'name':_0x1de842[_0x1f95('0x2b')],'type':_0x1de842[_0x1f95('0x2c')][_0x1f95('0x2d')]};});_0xe59b5b[_0x1f95('0x2e')]=_[_0x1f95('0x2a')](_0x233a39,'name');_0xe59b5b[_0x1f95('0x2f')]=_[_0x1f95('0x30')](_0xe8548c['query']);_0xe59b5b[_0x1f95('0x31')]=_['intersection'](_0xe59b5b[_0x1f95('0x2e')],_0xe59b5b[_0x1f95('0x2f')]);_0x1eb960[_0x1f95('0x32')]=_[_0x1f95('0x33')](_0xe59b5b['model'],qs[_0x1f95('0x34')](_0xe8548c['query']['fields']));_0x1eb960[_0x1f95('0x32')]=_0x1eb960[_0x1f95('0x32')][_0x1f95('0x35')]?_0x1eb960[_0x1f95('0x32')]:_0xe59b5b['model'];if(!_0xe8548c['query'][_0x1f95('0x36')](_0x1f95('0x37'))){_0x1eb960[_0x1f95('0x1b')]=qs['limit'](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x1b')]);_0x1eb960['offset']=qs[_0x1f95('0x1c')](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x1c')]);}_0x1eb960[_0x1f95('0x38')]=qs['sort'](_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x39')]);_0x1eb960[_0x1f95('0x3a')]=qs[_0x1f95('0x31')](_[_0x1f95('0x3b')](_0xe8548c['query'],_0xe59b5b[_0x1f95('0x31')]),_0x233a39);if(_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x3c')]){_0x1eb960['where']=_[_0x1f95('0x3d')](_0x1eb960['where'],{'$or':_[_0x1f95('0x2a')](_0x233a39,function(_0x5857e9){if(_0x5857e9[_0x1f95('0x2c')]!=='VIRTUAL'){var _0x306c8a={};_0x306c8a[_0x5857e9[_0x1f95('0x28')]]={'$like':'%'+_0xe8548c[_0x1f95('0x2f')][_0x1f95('0x3c')]+'%'};return _0x306c8a;}})});}_0x1eb960=_[_0x1f95('0x3d')]({},_0x1eb960,_0xe8548c[_0x1f95('0x3e')]);var _0xc660e4={'where':_0x1eb960['where']};return db[_0x1f95('0x3f')][_0x1f95('0x1d')](_0xc660e4)[_0x1f95('0x23')](function(_0x5cb611){_0x3b735b['count']=_0x5cb611;if(_0xe8548c['query'][_0x1f95('0x40')]){_0x1eb960[_0x1f95('0x41')]=[{'all':!![]}];}return db[_0x1f95('0x3f')][_0x1f95('0x42')](_0x1eb960);})['then'](function(_0x564682){_0x3b735b[_0x1f95('0x43')]=_0x564682;return _0x3b735b;})[_0x1f95('0x23')](respondWithFilteredResult(_0x16ccf4,_0x1eb960))['catch'](handleError(_0x16ccf4,null));};exports[_0x1f95('0x44')]=function(_0x3e15a0,_0x423f77){var _0x2e3790={'raw':!![],'where':{'id':_0x3e15a0[_0x1f95('0x45')]['id']}},_0x3cfa28={};_0x3cfa28[_0x1f95('0x2e')]=_[_0x1f95('0x30')](db[_0x1f95('0x3f')]['rawAttributes']);_0x3cfa28['query']=_['keys'](_0x3e15a0['query']);_0x3cfa28[_0x1f95('0x31')]=_['intersection'](_0x3cfa28['model'],_0x3cfa28['query']);_0x2e3790[_0x1f95('0x32')]=_[_0x1f95('0x33')](_0x3cfa28[_0x1f95('0x2e')],qs[_0x1f95('0x34')](_0x3e15a0['query'][_0x1f95('0x34')]));_0x2e3790[_0x1f95('0x32')]=_0x2e3790[_0x1f95('0x32')]['length']?_0x2e3790[_0x1f95('0x32')]:_0x3cfa28[_0x1f95('0x2e')];if(_0x3e15a0[_0x1f95('0x2f')]['includeAll']){_0x2e3790[_0x1f95('0x41')]=[{'all':!![]}];}_0x2e3790=_[_0x1f95('0x3d')]({},_0x2e3790,_0x3e15a0[_0x1f95('0x3e')]);return db[_0x1f95('0x3f')]['find'](_0x2e3790)[_0x1f95('0x23')](handleEntityNotFound(_0x423f77,null))[_0x1f95('0x23')](respondWithResult(_0x423f77,null))[_0x1f95('0x46')](handleError(_0x423f77,null));};exports['create']=function(_0x30054a,_0x194797){return db['ZendeskField'][_0x1f95('0x47')](_0x30054a[_0x1f95('0x48')],{})[_0x1f95('0x23')](respondWithResult(_0x194797,0xc9))[_0x1f95('0x46')](handleError(_0x194797,null));};exports[_0x1f95('0x22')]=function(_0x4e23ab,_0x221b16){if(_0x4e23ab['body']['id']){delete _0x4e23ab[_0x1f95('0x48')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x4e23ab[_0x1f95('0x45')]['id']}})[_0x1f95('0x23')](handleEntityNotFound(_0x221b16,null))['then'](saveUpdates(_0x4e23ab[_0x1f95('0x48')],null))[_0x1f95('0x23')](respondWithResult(_0x221b16,null))[_0x1f95('0x46')](handleError(_0x221b16,null));};exports[_0x1f95('0x24')]=function(_0x33f015,_0x221c52){return db[_0x1f95('0x3f')][_0x1f95('0x49')]({'where':{'id':_0x33f015[_0x1f95('0x45')]['id']}})[_0x1f95('0x23')](handleEntityNotFound(_0x221c52,null))[_0x1f95('0x23')](removeEntity(_0x221c52,null))['catch'](handleError(_0x221c52,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5859bbb..6f160f1 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 _0xf5ad=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x408e14,_0x39ec8e){var _0x2faf5e=function(_0xc276c3){while(--_0xc276c3){_0x408e14['push'](_0x408e14['shift']());}};_0x2faf5e(++_0x39ec8e);}(_0xf5ad,0x193));var _0xdf5a=function(_0x526885,_0x331b5a){_0x526885=_0x526885-0x0;var _0xd3dee7=_0xf5ad[_0x526885];return _0xd3dee7;};'use strict';var _=require(_0xdf5a('0x0'));var util=require(_0xdf5a('0x1'));var logger=require(_0xdf5a('0x2'))(_0xdf5a('0x3'));var moment=require(_0xdf5a('0x4'));var BPromise=require(_0xdf5a('0x5'));var rp=require(_0xdf5a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf5a('0x7'));var config=require(_0xdf5a('0x8'));var attributes=require(_0xdf5a('0x9'));module[_0xdf5a('0xa')]=function(_0x2ecaad,_0x40707f){return _0x2ecaad['define']('ZendeskField',attributes,{'tableName':_0xdf5a('0xb'),'paranoid':![],'indexes':[{'name':_0xdf5a('0xc'),'fields':[_0xdf5a('0xd'),_0xdf5a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc816=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util'];(function(_0x27faf2,_0x19a627){var _0x4b6bbe=function(_0x106611){while(--_0x106611){_0x27faf2['push'](_0x27faf2['shift']());}};_0x4b6bbe(++_0x19a627);}(_0xc816,0xb2));var _0x6c81=function(_0x4b375d,_0x54aa7f){_0x4b375d=_0x4b375d-0x0;var _0x2a5c13=_0xc816[_0x4b375d];return _0x2a5c13;};'use strict';var _=require(_0x6c81('0x0'));var util=require(_0x6c81('0x1'));var logger=require(_0x6c81('0x2'))('api');var moment=require(_0x6c81('0x3'));var BPromise=require(_0x6c81('0x4'));var rp=require(_0x6c81('0x5'));var fs=require('fs');var path=require(_0x6c81('0x6'));var rimraf=require(_0x6c81('0x7'));var config=require(_0x6c81('0x8'));var attributes=require(_0x6c81('0x9'));module[_0x6c81('0xa')]=function(_0x587ef1,_0x155128){return _0x587ef1[_0x6c81('0xb')](_0x6c81('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x6c81('0xd'),'fields':[_0x6c81('0xe'),'FieldId'],'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 01b11f5..36d2cfb 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 _0xa8ec=['then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x394f6e,_0x310895){var _0x4f8008=function(_0x438cb0){while(--_0x438cb0){_0x394f6e['push'](_0x394f6e['shift']());}};_0x4f8008(++_0x310895);}(_0xa8ec,0x119));var _0xca8e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa8ec[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xca8e('0x0'));var util=require(_0xca8e('0x1'));var moment=require(_0xca8e('0x2'));var BPromise=require('bluebird');var rs=require(_0xca8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca8e('0x4'))['db'];var utils=require(_0xca8e('0x5'));var logger=require(_0xca8e('0x6'))(_0xca8e('0x7'));var config=require(_0xca8e('0x8'));var jayson=require(_0xca8e('0x9'));var client=jayson[_0xca8e('0xa')][_0xca8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4de491,_0xf00678,_0x5458e2){return new BPromise(function(_0x3a8171,_0x53f5d4){return client[_0xca8e('0xc')](_0x4de491,_0x5458e2)[_0xca8e('0xd')](function(_0x5ddf63){logger[_0xca8e('0xe')](_0xca8e('0xf'),_0xf00678,_0xca8e('0x10'));logger['debug'](_0xca8e('0x11'),_0xf00678,_0xca8e('0x10'),JSON[_0xca8e('0x12')](_0x5ddf63));if(_0x5ddf63[_0xca8e('0x13')]){if(_0x5ddf63[_0xca8e('0x13')]['code']===0x1f4){logger[_0xca8e('0x13')]('ZendeskField,\x20%s,\x20%s',_0xf00678,_0x5ddf63[_0xca8e('0x13')][_0xca8e('0x14')]);return _0x53f5d4(_0x5ddf63[_0xca8e('0x13')]['message']);}logger['error'](_0xca8e('0xf'),_0xf00678,_0x5ddf63[_0xca8e('0x13')][_0xca8e('0x14')]);return _0x3a8171(_0x5ddf63[_0xca8e('0x13')][_0xca8e('0x14')]);}else{logger[_0xca8e('0xe')]('ZendeskField,\x20%s,\x20%s',_0xf00678,_0xca8e('0x10'));_0x3a8171(_0x5ddf63['result']['message']);}})['catch'](function(_0x42cb5d){logger[_0xca8e('0x13')](_0xca8e('0xf'),_0xf00678,_0x42cb5d);_0x53f5d4(_0x42cb5d);});});} \ No newline at end of file +var _0xb1dd=['../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x19f1f7,_0x6e016d){var _0x278971=function(_0x3b1ea3){while(--_0x3b1ea3){_0x19f1f7['push'](_0x19f1f7['shift']());}};_0x278971(++_0x6e016d);}(_0xb1dd,0xc9));var _0xdb1d=function(_0x582e40,_0x4832ee){_0x582e40=_0x582e40-0x0;var _0x3d346c=_0xb1dd[_0x582e40];return _0x3d346c;};'use strict';var _=require(_0xdb1d('0x0'));var util=require(_0xdb1d('0x1'));var moment=require(_0xdb1d('0x2'));var BPromise=require(_0xdb1d('0x3'));var rs=require(_0xdb1d('0x4'));var fs=require('fs');var Redis=require(_0xdb1d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1d('0x6'));var logger=require(_0xdb1d('0x7'))('rpc');var config=require(_0xdb1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb1d('0x9')][_0xdb1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0e0a,_0x2a2004,_0x1e4efd){return new BPromise(function(_0x26d008,_0x4ec165){return client[_0xdb1d('0xb')](_0x2e0e0a,_0x1e4efd)['then'](function(_0x1dee5d){logger[_0xdb1d('0xc')](_0xdb1d('0xd'),_0x2a2004,'request\x20sent');logger[_0xdb1d('0xe')](_0xdb1d('0xf'),_0x2a2004,_0xdb1d('0x10'),JSON[_0xdb1d('0x11')](_0x1dee5d));if(_0x1dee5d['error']){if(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x13')]===0x1f4){logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);return _0x4ec165(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);}logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x1dee5d[_0xdb1d('0x12')]['message']);return _0x26d008(_0x1dee5d[_0xdb1d('0x12')][_0xdb1d('0x14')]);}else{logger[_0xdb1d('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2a2004,_0xdb1d('0x10'));_0x26d008(_0x1dee5d[_0xdb1d('0x15')][_0xdb1d('0x14')]);}})[_0xdb1d('0x16')](function(_0x46400c){logger[_0xdb1d('0x12')](_0xdb1d('0xd'),_0x2a2004,_0x46400c);_0x4ec165(_0x46400c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9d046ff..fc974be 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 _0xf9d2=['getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x312ed9,_0x3d85a2){var _0x44d47c=function(_0x6cbee6){while(--_0x6cbee6){_0x312ed9['push'](_0x312ed9['shift']());}};_0x44d47c(++_0x3d85a2);}(_0xf9d2,0x6a));var _0x2f9d=function(_0x4910d0,_0x556b25){_0x4910d0=_0x4910d0-0x0;var _0x388a2d=_0xf9d2[_0x4910d0];return _0x388a2d;};'use strict';var multer=require('multer');var util=require(_0x2f9d('0x0'));var path=require(_0x2f9d('0x1'));var timeout=require(_0x2f9d('0x2'));var express=require(_0x2f9d('0x3'));var router=express[_0x2f9d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2f9d('0x5'));var interaction=require(_0x2f9d('0x6'));var config=require(_0x2f9d('0x7'));var controller=require('./intZohoAccount.controller');router[_0x2f9d('0x8')]('/',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xa')]);router[_0x2f9d('0x8')](_0x2f9d('0xb'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xc')]);router[_0x2f9d('0x8')](_0x2f9d('0xd'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xe')]);router[_0x2f9d('0x8')]('/:id/fields',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xf')]);router['post']('/',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x10')]);router[_0x2f9d('0x11')](_0x2f9d('0xd'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x12')]);router[_0x2f9d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2f9d('0x14')]);router[_0x2f9d('0x15')](_0x2f9d('0xb'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x16')]);module[_0x2f9d('0x17')]=router; \ No newline at end of file +var _0xf30f=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','index','/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put'];(function(_0x2280c8,_0x46bc76){var _0x696fb0=function(_0x1f1cb0){while(--_0x1f1cb0){_0x2280c8['push'](_0x2280c8['shift']());}};_0x696fb0(++_0x46bc76);}(_0xf30f,0x95));var _0xff30=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf30f[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xff30('0x0'));var util=require(_0xff30('0x1'));var path=require(_0xff30('0x2'));var timeout=require(_0xff30('0x3'));var express=require('express');var router=express[_0xff30('0x4')]();var fs_extra=require(_0xff30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff30('0x6'));var config=require('../../config/environment');var controller=require(_0xff30('0x7'));router[_0xff30('0x8')]('/',auth['isAuthenticated'](),controller[_0xff30('0x9')]);router[_0xff30('0x8')](_0xff30('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xff30('0x8')](_0xff30('0xb'),auth['isAuthenticated'](),controller[_0xff30('0xc')]);router[_0xff30('0x8')](_0xff30('0xd'),auth[_0xff30('0xe')](),controller[_0xff30('0xf')]);router[_0xff30('0x10')]('/',auth[_0xff30('0xe')](),controller['create']);router[_0xff30('0x10')](_0xff30('0xb'),auth[_0xff30('0xe')](),controller[_0xff30('0x11')]);router[_0xff30('0x12')](_0xff30('0xa'),auth['isAuthenticated'](),controller[_0xff30('0x13')]);router[_0xff30('0x14')]('/:id',auth[_0xff30('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a77f2d7..b399d47 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 _0xee5b=['sequelize','STRING'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xee5b,0x1f4));var _0xbee5=function(_0x47333f,_0x526444){_0x47333f=_0x47333f-0x0;var _0x1bcf02=_0xee5b[_0x47333f];return _0x1bcf02;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbec5=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbec5,0xe5));var _0x5bec=function(_0x469ac7,_0x38e416){_0x469ac7=_0x469ac7-0x0;var _0x22f3b0=_0xbec5[_0x469ac7];return _0x22f3b0;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 02b23f0..3a42f44 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 _0x5ad4=['findAll','rows','show','keys','includeAll','options','find','catch','create','body','params','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientSecret','serverUrl','zoho.eu','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include'];(function(_0x4b7c26,_0x431601){var _0x43c38d=function(_0x172e94){while(--_0x172e94){_0x4b7c26['push'](_0x4b7c26['shift']());}};_0x43c38d(++_0x431601);}(_0x5ad4,0x1b6));var _0x45ad=function(_0x4c27c2,_0x3c480f){_0x4c27c2=_0x4c27c2-0x0;var _0x33236c=_0x5ad4[_0x4c27c2];return _0x33236c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x45ad('0x1'));var rp=require(_0x45ad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x45ad('0x3'));var util=require(_0x45ad('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x45ad('0x5'));var ejs=require(_0x45ad('0x6'));var fs=require('fs');var fs_extra=require(_0x45ad('0x7'));var _=require(_0x45ad('0x8'));var squel=require(_0x45ad('0x9'));var crypto=require(_0x45ad('0xa'));var jsforce=require(_0x45ad('0xb'));var deskjs=require(_0x45ad('0xc'));var toCsv=require(_0x45ad('0x5'));var querystring=require(_0x45ad('0xd'));var Papa=require(_0x45ad('0xe'));var Redis=require('ioredis');var authService=require(_0x45ad('0xf'));var qs=require(_0x45ad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45ad('0x11'));var logger=require(_0x45ad('0x12'))('api');var utils=require(_0x45ad('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x45ad('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x45ad('0x15'));function respondWithStatusCode(_0x1fdfc3,_0x34c04b){_0x34c04b=_0x34c04b||0xcc;return function(_0x4d15ab){if(_0x4d15ab){return _0x1fdfc3[_0x45ad('0x16')](_0x34c04b);}return _0x1fdfc3['status'](_0x34c04b)['end']();};}function respondWithResult(_0x31df9a,_0x3c1aa8){_0x3c1aa8=_0x3c1aa8||0xc8;return function(_0x31958c){if(_0x31958c){return _0x31df9a[_0x45ad('0x17')](_0x3c1aa8)[_0x45ad('0x18')](_0x31958c);}};}function respondWithFilteredResult(_0xe1a717,_0x2b25fa){return function(_0x19b144){if(_0x19b144){var _0x34c011=typeof _0x2b25fa['offset']===_0x45ad('0x19')&&typeof _0x2b25fa[_0x45ad('0x1a')]===_0x45ad('0x19');var _0x22773f=_0x19b144[_0x45ad('0x1b')];var _0x4d486f=_0x34c011?0x0:_0x2b25fa[_0x45ad('0x1c')];var _0x3ec476=_0x34c011?_0x19b144[_0x45ad('0x1b')]:_0x2b25fa[_0x45ad('0x1c')]+_0x2b25fa[_0x45ad('0x1a')];var _0x3c0307;if(_0x3ec476>=_0x22773f){_0x3ec476=_0x22773f;_0x3c0307=0xc8;}else{_0x3c0307=0xce;}_0xe1a717[_0x45ad('0x17')](_0x3c0307);return _0xe1a717[_0x45ad('0x1d')](_0x45ad('0x1e'),_0x4d486f+'-'+_0x3ec476+'/'+_0x22773f)[_0x45ad('0x18')](_0x19b144);}return null;};}function patchUpdates(_0x159fda){return function(_0x5dc04d){try{jsonpatch[_0x45ad('0x1f')](_0x5dc04d,_0x159fda,!![]);}catch(_0x41b2bc){return BPromise[_0x45ad('0x20')](_0x41b2bc);}return _0x5dc04d['save']();};}function saveUpdates(_0x5e6855,_0x1a755a){return function(_0x3d497e){if(_0x3d497e){return _0x3d497e[_0x45ad('0x21')](_0x5e6855)[_0x45ad('0x22')](function(_0x124541){return _0x124541;});}return null;};}function removeEntity(_0x5185d7,_0x5c5edd){return function(_0x4145c6){if(_0x4145c6){return _0x4145c6[_0x45ad('0x23')]()['then'](function(){_0x5185d7[_0x45ad('0x17')](0xcc)[_0x45ad('0x24')]();});}};}function handleEntityNotFound(_0x116c7c,_0x24de60){return function(_0x359c4d){if(!_0x359c4d){_0x116c7c[_0x45ad('0x16')](0x194);}return _0x359c4d;};}function handleError(_0x393601,_0x2a46e4){_0x2a46e4=_0x2a46e4||0x1f4;return function(_0x4c7403){logger[_0x45ad('0x25')](_0x4c7403[_0x45ad('0x26')]);if(_0x4c7403[_0x45ad('0x27')]){delete _0x4c7403[_0x45ad('0x27')];}_0x393601['status'](_0x2a46e4)[_0x45ad('0x28')](_0x4c7403);};}exports['index']=function(_0x2838a9,_0x3daf63){var _0x249ee1={},_0x170c8a={},_0x54afbb={'count':0x0,'rows':[]};var _0x3bd6a9=_[_0x45ad('0x29')](db[_0x45ad('0x2a')][_0x45ad('0x2b')],function(_0xebc90b){return{'name':_0xebc90b['fieldName'],'type':_0xebc90b[_0x45ad('0x2c')][_0x45ad('0x2d')]};});_0x170c8a[_0x45ad('0x2e')]=_['map'](_0x3bd6a9,_0x45ad('0x27'));_0x170c8a[_0x45ad('0x2f')]=_['keys'](_0x2838a9[_0x45ad('0x2f')]);_0x170c8a[_0x45ad('0x30')]=_[_0x45ad('0x31')](_0x170c8a[_0x45ad('0x2e')],_0x170c8a[_0x45ad('0x2f')]);_0x249ee1[_0x45ad('0x32')]=_[_0x45ad('0x31')](_0x170c8a[_0x45ad('0x2e')],qs[_0x45ad('0x33')](_0x2838a9[_0x45ad('0x2f')][_0x45ad('0x33')]));_0x249ee1[_0x45ad('0x32')]=_0x249ee1[_0x45ad('0x32')][_0x45ad('0x34')]?_0x249ee1[_0x45ad('0x32')]:_0x170c8a[_0x45ad('0x2e')];if(!_0x2838a9[_0x45ad('0x2f')]['hasOwnProperty'](_0x45ad('0x35'))){_0x249ee1[_0x45ad('0x1a')]=qs['limit'](_0x2838a9[_0x45ad('0x2f')][_0x45ad('0x1a')]);_0x249ee1[_0x45ad('0x1c')]=qs[_0x45ad('0x1c')](_0x2838a9[_0x45ad('0x2f')][_0x45ad('0x1c')]);}_0x249ee1[_0x45ad('0x36')]=qs[_0x45ad('0x37')](_0x2838a9[_0x45ad('0x2f')]['sort']);_0x249ee1[_0x45ad('0x38')]=qs[_0x45ad('0x30')](_[_0x45ad('0x39')](_0x2838a9[_0x45ad('0x2f')],_0x170c8a[_0x45ad('0x30')]),_0x3bd6a9);if(_0x2838a9[_0x45ad('0x2f')][_0x45ad('0x3a')]){_0x249ee1[_0x45ad('0x38')]=_[_0x45ad('0x3b')](_0x249ee1['where'],{'$or':_['map'](_0x3bd6a9,function(_0x3627ba){if(_0x3627ba['type']!==_0x45ad('0x3c')){var _0x52d15e={};_0x52d15e[_0x3627ba['name']]={'$like':'%'+_0x2838a9[_0x45ad('0x2f')][_0x45ad('0x3a')]+'%'};return _0x52d15e;}})});}_0x249ee1=_[_0x45ad('0x3b')]({},_0x249ee1,_0x2838a9['options']);var _0x455614={'where':_0x249ee1['where']};return db[_0x45ad('0x2a')][_0x45ad('0x1b')](_0x455614)[_0x45ad('0x22')](function(_0x244772){_0x54afbb[_0x45ad('0x1b')]=_0x244772;if(_0x2838a9[_0x45ad('0x2f')]['includeAll']){_0x249ee1[_0x45ad('0x3d')]=[{'all':!![]}];}return db['ZohoAccount'][_0x45ad('0x3e')](_0x249ee1);})[_0x45ad('0x22')](function(_0x4f265f){_0x54afbb[_0x45ad('0x3f')]=_0x4f265f;return _0x54afbb;})[_0x45ad('0x22')](respondWithFilteredResult(_0x3daf63,_0x249ee1))['catch'](handleError(_0x3daf63,null));};exports[_0x45ad('0x40')]=function(_0x1e25a3,_0x1865ef){var _0x9232cb={'raw':![],'where':{'id':_0x1e25a3['params']['id']}},_0x583470={};_0x583470[_0x45ad('0x2e')]=_['keys'](db[_0x45ad('0x2a')][_0x45ad('0x2b')]);_0x583470['query']=_[_0x45ad('0x41')](_0x1e25a3[_0x45ad('0x2f')]);_0x583470[_0x45ad('0x30')]=_[_0x45ad('0x31')](_0x583470[_0x45ad('0x2e')],_0x583470[_0x45ad('0x2f')]);_0x9232cb[_0x45ad('0x32')]=_[_0x45ad('0x31')](_0x583470[_0x45ad('0x2e')],qs['fields'](_0x1e25a3[_0x45ad('0x2f')][_0x45ad('0x33')]));_0x9232cb[_0x45ad('0x32')]=_0x9232cb[_0x45ad('0x32')][_0x45ad('0x34')]?_0x9232cb[_0x45ad('0x32')]:_0x583470[_0x45ad('0x2e')];if(_0x1e25a3['query'][_0x45ad('0x42')]){_0x9232cb[_0x45ad('0x3d')]=[{'all':!![]}];}_0x9232cb=_[_0x45ad('0x3b')]({},_0x9232cb,_0x1e25a3[_0x45ad('0x43')]);return db[_0x45ad('0x2a')][_0x45ad('0x44')](_0x9232cb)[_0x45ad('0x22')](handleEntityNotFound(_0x1865ef,null))[_0x45ad('0x22')](respondWithResult(_0x1865ef,null))[_0x45ad('0x45')](handleError(_0x1865ef,null));};exports[_0x45ad('0x46')]=function(_0x25e315,_0x42aff1){return db[_0x45ad('0x2a')][_0x45ad('0x46')](_0x25e315['body'],{})['then'](respondWithResult(_0x42aff1,0xc9))[_0x45ad('0x45')](handleError(_0x42aff1,null));};exports[_0x45ad('0x21')]=function(_0xe9ca87,_0x3491b7){if(_0xe9ca87[_0x45ad('0x47')]['id']){delete _0xe9ca87[_0x45ad('0x47')]['id'];}return db[_0x45ad('0x2a')]['find']({'where':{'id':_0xe9ca87[_0x45ad('0x48')]['id']}})['then'](handleEntityNotFound(_0x3491b7,null))[_0x45ad('0x22')](saveUpdates(_0xe9ca87[_0x45ad('0x47')],null))['then'](respondWithResult(_0x3491b7,null))[_0x45ad('0x45')](handleError(_0x3491b7,null));};exports['destroy']=function(_0x133412,_0x556236){return db['ZohoAccount'][_0x45ad('0x44')]({'where':{'id':_0x133412[_0x45ad('0x48')]['id']}})[_0x45ad('0x22')](handleEntityNotFound(_0x556236,null))[_0x45ad('0x22')](removeEntity(_0x556236,null))['catch'](handleError(_0x556236,null));};exports[_0x45ad('0x49')]=function(_0x2cbbd6,_0x447c3a,_0x19566c){var _0xe4697f={};var _0x36d721={};var _0x33ecd0;var _0x149b13;return db[_0x45ad('0x2a')]['findOne']({'where':{'id':_0x2cbbd6[_0x45ad('0x48')]['id']}})[_0x45ad('0x22')](handleEntityNotFound(_0x447c3a,null))[_0x45ad('0x22')](function(_0x936234){if(_0x936234){_0x33ecd0=_0x936234;_0x36d721[_0x45ad('0x2e')]=_[_0x45ad('0x41')](db['ZohoConfiguration']['rawAttributes']);_0x36d721[_0x45ad('0x2f')]=_['keys'](_0x2cbbd6[_0x45ad('0x2f')]);_0x36d721[_0x45ad('0x30')]=_[_0x45ad('0x31')](_0x36d721['model'],_0x36d721[_0x45ad('0x2f')]);_0xe4697f[_0x45ad('0x32')]=_[_0x45ad('0x31')](_0x36d721['model'],qs[_0x45ad('0x33')](_0x2cbbd6['query']['fields']));_0xe4697f[_0x45ad('0x32')]=_0xe4697f[_0x45ad('0x32')]['length']?_0xe4697f[_0x45ad('0x32')]:_0x36d721['model'];_0xe4697f[_0x45ad('0x36')]=qs[_0x45ad('0x37')](_0x2cbbd6[_0x45ad('0x2f')][_0x45ad('0x37')]);_0xe4697f[_0x45ad('0x38')]=qs[_0x45ad('0x30')](_[_0x45ad('0x39')](_0x2cbbd6['query'],_0x36d721[_0x45ad('0x30')]));if(_0x2cbbd6[_0x45ad('0x2f')]['filter']){_0xe4697f[_0x45ad('0x38')]=_[_0x45ad('0x3b')](_0xe4697f['where'],{'$or':_['map'](_0xe4697f[_0x45ad('0x32')],function(_0x33ae0e){var _0x55f0f1={};_0x55f0f1[_0x33ae0e]={'$like':'%'+_0x2cbbd6[_0x45ad('0x2f')]['filter']+'%'};return _0x55f0f1;})});}_0xe4697f=_[_0x45ad('0x3b')]({},_0xe4697f,_0x2cbbd6[_0x45ad('0x43')]);return _0x33ecd0[_0x45ad('0x49')](_0xe4697f);}})[_0x45ad('0x22')](function(_0x5dd7fd){if(_0x5dd7fd){_0x149b13=_0x5dd7fd[_0x45ad('0x34')];if(!_0x2cbbd6['query'][_0x45ad('0x4a')]('nolimit')){_0xe4697f['limit']=qs[_0x45ad('0x1a')](_0x2cbbd6['query'][_0x45ad('0x1a')]);_0xe4697f[_0x45ad('0x1c')]=qs[_0x45ad('0x1c')](_0x2cbbd6['query'][_0x45ad('0x1c')]);}return _0x33ecd0[_0x45ad('0x49')](_0xe4697f);}})[_0x45ad('0x22')](function(_0x4010a5){if(_0x4010a5){return _0x4010a5?{'count':_0x149b13,'rows':_0x4010a5}:null;}})[_0x45ad('0x22')](respondWithResult(_0x447c3a,null))[_0x45ad('0x45')](handleError(_0x447c3a,null));};exports[_0x45ad('0x4b')]=function(_0x41b1ac,_0x4ec9f1,_0x29cb4d){if(_0x41b1ac['body']['id']){delete _0x41b1ac[_0x45ad('0x47')]['id'];}return db[_0x45ad('0x2a')]['findOne']({'where':{'id':_0x41b1ac[_0x45ad('0x48')]['id']}})[_0x45ad('0x22')](handleEntityNotFound(_0x4ec9f1,null))[_0x45ad('0x22')](function(_0x254283){if(_0x254283){_0x41b1ac[_0x45ad('0x47')][_0x45ad('0x4c')]=_0x254283['id'];_0x41b1ac['body'][_0x45ad('0x4d')]=integrations[_0x45ad('0x4e')](_0x41b1ac[_0x45ad('0x47')][_0x45ad('0x4f')],_0x41b1ac['body'][_0x45ad('0x2c')]);_0x41b1ac[_0x45ad('0x47')][_0x45ad('0x50')]=integrations['getDescriptions'](_0x41b1ac[_0x45ad('0x47')][_0x45ad('0x4f')],_0x41b1ac[_0x45ad('0x47')]['type']);return db['ZohoConfiguration'][_0x45ad('0x46')](_0x41b1ac[_0x45ad('0x47')],{'include':[{'model':db[_0x45ad('0x51')],'as':'Subjects'},{'model':db[_0x45ad('0x51')],'as':_0x45ad('0x50')}]});}return null;})['then'](respondWithResult(_0x4ec9f1,null))['catch'](handleError(_0x4ec9f1,null));};function getAccessToken(_0x22dbcd){return new Promise(function(_0x345a40,_0x54956b){var _0x104440;switch(_0x22dbcd[_0x45ad('0x52')]){case'US':_0x104440=_0x45ad('0x53');break;case'AU':_0x104440=_0x45ad('0x54');break;case'EU':_0x104440=_0x45ad('0x55');break;case'IN':_0x104440=_0x45ad('0x56');break;case'CN':_0x104440='https://accounts.zoho.com.cn';break;default:_0x104440=_0x45ad('0x55');break;}var _0x109ac7={'method':_0x45ad('0x57'),'uri':_0x104440+_0x45ad('0x58'),'qs':{'refresh_token':_0x22dbcd[_0x45ad('0x59')],'client_id':_0x22dbcd[_0x45ad('0x5a')],'client_secret':_0x22dbcd['clientSecret'],'grant_type':_0x45ad('0x5b')},'json':!![]};return rp(_0x109ac7)[_0x45ad('0x22')](function(_0x924654){if(_0x924654[_0x45ad('0x5c')]){_0x345a40(_0x924654[_0x45ad('0x5c')]);}else{_0x54956b(_0x45ad('0x5d'));}})[_0x45ad('0x45')](function(_0x46ec66){_0x54956b(_0x46ec66);});});}exports['getFields']=function(_0x530270,_0x360739,_0x3b4b5f){var _0x3f3e88,_0x175416,_0x3a8b91,_0x1f3a40,_0x138207;return db[_0x45ad('0x2a')]['findOne']({'where':{'id':_0x530270[_0x45ad('0x48')]['id']},'attributes':['id',_0x45ad('0x5e'),'zone',_0x45ad('0x5a'),_0x45ad('0x5f'),_0x45ad('0x60'),'code',_0x45ad('0x59')]})[_0x45ad('0x22')](handleEntityNotFound(_0x360739,null))[_0x45ad('0x22')](function(_0x4832a1){_0x138207=_0x4832a1;_0x3f3e88=_0x138207[_0x45ad('0x5e')];_0x175416=_0x3f3e88===_0x45ad('0x61')?'eu':_0x45ad('0x62');_0x3a8b91=_0x138207[_0x45ad('0x60')];var _0x1a2c8b=_0x3a8b91['slice'](-0x1);if(_0x1a2c8b==='/'||_0x1a2c8b==='\x5c'||_0x1a2c8b===':'){_0x3a8b91=_0x3a8b91[_0x45ad('0x63')](0x0,_0x3a8b91[_0x45ad('0x64')](_0x1a2c8b));}if(!_0x138207[_0x45ad('0x59')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x138207);})[_0x45ad('0x22')](function(_0x124372){if(_0x124372){return rp({'method':_0x45ad('0x65'),'uri':util[_0x45ad('0x66')](_0x45ad('0x67'),_0x175416),'qs':{'module':'Calls'},'headers':{'Authorization':_0x45ad('0x68')+_0x124372},'json':!![]});}})['then'](function(_0x2d5f19){if(_0x2d5f19){if(_0x2d5f19[_0x45ad('0x69')]&&_0x2d5f19[_0x45ad('0x69')][_0x45ad('0x25')]){throw new Error(_0x2d5f19['response']['error'][_0x45ad('0x6a')]);}var _0x230ba7=[];var _0x4317d1=[];var _0x160542=[_0x45ad('0x6b'),_0x45ad('0x6c'),'Description','WhoId',_0x45ad('0x6d'),_0x45ad('0x6e'),_0x45ad('0x6f'),_0x45ad('0x70')];_0x4317d1=_['remove'](_0x2d5f19['fields'],function(_0x4b6edf){return _0x160542['includes'](_0x4b6edf[_0x45ad('0x71')]);});for(var _0x5be874=0x0;_0x5be874<_0x4317d1[_0x45ad('0x34')];_0x5be874++){if(_0x4317d1[_0x5be874][_0x45ad('0x72')]===![]){_0x230ba7[_0x45ad('0x73')]({'id':_0x4317d1[_0x5be874]['id'],'name':_0x4317d1[_0x5be874][_0x45ad('0x74')],'custom':_0x4317d1[_0x5be874][_0x45ad('0x75')],'options':_0x4317d1[_0x5be874][_0x45ad('0x76')]===_0x45ad('0x77')&&_0x4317d1[_0x5be874][_0x45ad('0x78')][_0x45ad('0x34')]>-0x1?_['map'](_0x4317d1[_0x5be874]['pick_list_values'],function(_0x15a9ec){return{'name':_0x15a9ec,'value':_0x15a9ec};}):[]});}}return{'count':_0x230ba7[_0x45ad('0x34')],'rows':_0x230ba7};}else{return{'count':0x0,'rows':[]};}})[_0x45ad('0x22')](respondWithResult(_0x360739,null))[_0x45ad('0x45')](function(_0xbba643){var _0xb70b06=_0x530270[_0x45ad('0x2f')][_0x45ad('0x79')]?0x1f4:_0xbba643[_0x45ad('0x7a')]||0x1f4;logger['error'](_0x45ad('0x7b'),_0x45ad('0x7c'),_0xb70b06,JSON['stringify'](_0xbba643));delete _0xbba643[_0x45ad('0x27')];if(_0xb70b06===0x191){_0xb70b06=0x190;}_0x360739[_0x45ad('0x17')](_0xb70b06)[_0x45ad('0x28')](_0x530270[_0x45ad('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xbba643['statusCode']}:_0xbba643);});}; \ No newline at end of file +var _0x31bc=['display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','set','Content-Range','update','sendStatus','stack','name','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','options','find','catch','body','params','destroy','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push'];(function(_0x22b434,_0x20b70d){var _0x3e6969=function(_0x33d83e){while(--_0x33d83e){_0x22b434['push'](_0x22b434['shift']());}};_0x3e6969(++_0x20b70d);}(_0x31bc,0x10d));var _0xc31b=function(_0x406626,_0x10928e){_0x406626=_0x406626-0x0;var _0x4dc453=_0x31bc[_0x406626];return _0x4dc453;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc31b('0x0'));var zipdir=require(_0xc31b('0x1'));var jsonpatch=require(_0xc31b('0x2'));var rp=require(_0xc31b('0x3'));var moment=require('moment');var BPromise=require(_0xc31b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc31b('0x5'));var sox=require(_0xc31b('0x6'));var csv=require(_0xc31b('0x7'));var ejs=require(_0xc31b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc31b('0x9'));var squel=require('squel');var crypto=require(_0xc31b('0xa'));var jsforce=require(_0xc31b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc31b('0xc'));var Papa=require(_0xc31b('0xd'));var Redis=require(_0xc31b('0xe'));var authService=require(_0xc31b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc31b('0x10'))('api');var utils=require(_0xc31b('0x11'));var config=require(_0xc31b('0x12'));var licenseUtil=require(_0xc31b('0x13'));var db=require(_0xc31b('0x14'))['db'];var integrations=require(_0xc31b('0x15'));function respondWithStatusCode(_0x45dc56,_0x2f74d0){_0x2f74d0=_0x2f74d0||0xcc;return function(_0x15d8ce){if(_0x15d8ce){return _0x45dc56['sendStatus'](_0x2f74d0);}return _0x45dc56[_0xc31b('0x16')](_0x2f74d0)[_0xc31b('0x17')]();};}function respondWithResult(_0x2096f0,_0xa05051){_0xa05051=_0xa05051||0xc8;return function(_0x217400){if(_0x217400){return _0x2096f0[_0xc31b('0x16')](_0xa05051)[_0xc31b('0x18')](_0x217400);}};}function respondWithFilteredResult(_0xc6e94b,_0x3e3a74){return function(_0x349347){if(_0x349347){var _0x3b99ac=typeof _0x3e3a74['offset']===_0xc31b('0x19')&&typeof _0x3e3a74[_0xc31b('0x1a')]===_0xc31b('0x19');var _0x1e9051=_0x349347['count'];var _0x5d143f=_0x3b99ac?0x0:_0x3e3a74[_0xc31b('0x1b')];var _0x53fa45=_0x3b99ac?_0x349347[_0xc31b('0x1c')]:_0x3e3a74['offset']+_0x3e3a74['limit'];var _0xa1d9b4;if(_0x53fa45>=_0x1e9051){_0x53fa45=_0x1e9051;_0xa1d9b4=0xc8;}else{_0xa1d9b4=0xce;}_0xc6e94b[_0xc31b('0x16')](_0xa1d9b4);return _0xc6e94b[_0xc31b('0x1d')](_0xc31b('0x1e'),_0x5d143f+'-'+_0x53fa45+'/'+_0x1e9051)[_0xc31b('0x18')](_0x349347);}return null;};}function patchUpdates(_0x4bbd70){return function(_0x472dc5){try{jsonpatch['apply'](_0x472dc5,_0x4bbd70,!![]);}catch(_0x35d4bb){return BPromise['reject'](_0x35d4bb);}return _0x472dc5['save']();};}function saveUpdates(_0x40b029,_0x41356f){return function(_0x11b2d2){if(_0x11b2d2){return _0x11b2d2[_0xc31b('0x1f')](_0x40b029)['then'](function(_0x18b45c){return _0x18b45c;});}return null;};}function removeEntity(_0x4b6f37,_0x506ce6){return function(_0x2b94d9){if(_0x2b94d9){return _0x2b94d9['destroy']()['then'](function(){_0x4b6f37[_0xc31b('0x16')](0xcc)[_0xc31b('0x17')]();});}};}function handleEntityNotFound(_0x298ea5,_0x47dc14){return function(_0x182545){if(!_0x182545){_0x298ea5[_0xc31b('0x20')](0x194);}return _0x182545;};}function handleError(_0x42a7d1,_0x16ea2d){_0x16ea2d=_0x16ea2d||0x1f4;return function(_0x1655ee){logger['error'](_0x1655ee[_0xc31b('0x21')]);if(_0x1655ee['name']){delete _0x1655ee[_0xc31b('0x22')];}_0x42a7d1[_0xc31b('0x16')](_0x16ea2d)['send'](_0x1655ee);};}exports['index']=function(_0x88b79c,_0x283a8a){var _0x337ef8={},_0x39d50d={},_0x4d17c4={'count':0x0,'rows':[]};var _0x4b2492=_['map'](db[_0xc31b('0x23')][_0xc31b('0x24')],function(_0x3b000f){return{'name':_0x3b000f[_0xc31b('0x25')],'type':_0x3b000f[_0xc31b('0x26')][_0xc31b('0x27')]};});_0x39d50d['model']=_[_0xc31b('0x28')](_0x4b2492,'name');_0x39d50d[_0xc31b('0x29')]=_[_0xc31b('0x2a')](_0x88b79c[_0xc31b('0x29')]);_0x39d50d[_0xc31b('0x2b')]=_['intersection'](_0x39d50d[_0xc31b('0x2c')],_0x39d50d[_0xc31b('0x29')]);_0x337ef8['attributes']=_[_0xc31b('0x2d')](_0x39d50d[_0xc31b('0x2c')],qs[_0xc31b('0x2e')](_0x88b79c[_0xc31b('0x29')]['fields']));_0x337ef8['attributes']=_0x337ef8[_0xc31b('0x2f')][_0xc31b('0x30')]?_0x337ef8['attributes']:_0x39d50d[_0xc31b('0x2c')];if(!_0x88b79c[_0xc31b('0x29')][_0xc31b('0x31')](_0xc31b('0x32'))){_0x337ef8[_0xc31b('0x1a')]=qs[_0xc31b('0x1a')](_0x88b79c['query'][_0xc31b('0x1a')]);_0x337ef8['offset']=qs['offset'](_0x88b79c['query']['offset']);}_0x337ef8[_0xc31b('0x33')]=qs[_0xc31b('0x34')](_0x88b79c[_0xc31b('0x29')]['sort']);_0x337ef8[_0xc31b('0x35')]=qs[_0xc31b('0x2b')](_['pick'](_0x88b79c['query'],_0x39d50d[_0xc31b('0x2b')]),_0x4b2492);if(_0x88b79c[_0xc31b('0x29')][_0xc31b('0x36')]){_0x337ef8[_0xc31b('0x35')]=_[_0xc31b('0x37')](_0x337ef8[_0xc31b('0x35')],{'$or':_[_0xc31b('0x28')](_0x4b2492,function(_0x321b40){if(_0x321b40[_0xc31b('0x26')]!==_0xc31b('0x38')){var _0x20528e={};_0x20528e[_0x321b40[_0xc31b('0x22')]]={'$like':'%'+_0x88b79c[_0xc31b('0x29')]['filter']+'%'};return _0x20528e;}})});}_0x337ef8=_['merge']({},_0x337ef8,_0x88b79c['options']);var _0x28b991={'where':_0x337ef8['where']};return db[_0xc31b('0x23')]['count'](_0x28b991)[_0xc31b('0x39')](function(_0x465745){_0x4d17c4['count']=_0x465745;if(_0x88b79c[_0xc31b('0x29')][_0xc31b('0x3a')]){_0x337ef8[_0xc31b('0x3b')]=[{'all':!![]}];}return db[_0xc31b('0x23')][_0xc31b('0x3c')](_0x337ef8);})[_0xc31b('0x39')](function(_0x3a8d39){_0x4d17c4[_0xc31b('0x3d')]=_0x3a8d39;return _0x4d17c4;})[_0xc31b('0x39')](respondWithFilteredResult(_0x283a8a,_0x337ef8))['catch'](handleError(_0x283a8a,null));};exports['show']=function(_0x50bd83,_0x5a92fa){var _0x5a72d7={'raw':![],'where':{'id':_0x50bd83['params']['id']}},_0x2d94ce={};_0x2d94ce[_0xc31b('0x2c')]=_[_0xc31b('0x2a')](db[_0xc31b('0x23')]['rawAttributes']);_0x2d94ce[_0xc31b('0x29')]=_[_0xc31b('0x2a')](_0x50bd83['query']);_0x2d94ce[_0xc31b('0x2b')]=_[_0xc31b('0x2d')](_0x2d94ce[_0xc31b('0x2c')],_0x2d94ce[_0xc31b('0x29')]);_0x5a72d7['attributes']=_[_0xc31b('0x2d')](_0x2d94ce['model'],qs['fields'](_0x50bd83[_0xc31b('0x29')][_0xc31b('0x2e')]));_0x5a72d7[_0xc31b('0x2f')]=_0x5a72d7['attributes'][_0xc31b('0x30')]?_0x5a72d7[_0xc31b('0x2f')]:_0x2d94ce[_0xc31b('0x2c')];if(_0x50bd83[_0xc31b('0x29')]['includeAll']){_0x5a72d7['include']=[{'all':!![]}];}_0x5a72d7=_['merge']({},_0x5a72d7,_0x50bd83[_0xc31b('0x3e')]);return db['ZohoAccount'][_0xc31b('0x3f')](_0x5a72d7)[_0xc31b('0x39')](handleEntityNotFound(_0x5a92fa,null))['then'](respondWithResult(_0x5a92fa,null))[_0xc31b('0x40')](handleError(_0x5a92fa,null));};exports['create']=function(_0x369b87,_0x3dc4b6){return db[_0xc31b('0x23')]['create'](_0x369b87[_0xc31b('0x41')],{})[_0xc31b('0x39')](respondWithResult(_0x3dc4b6,0xc9))[_0xc31b('0x40')](handleError(_0x3dc4b6,null));};exports[_0xc31b('0x1f')]=function(_0x19c18c,_0x426e2d){if(_0x19c18c[_0xc31b('0x41')]['id']){delete _0x19c18c[_0xc31b('0x41')]['id'];}return db[_0xc31b('0x23')]['find']({'where':{'id':_0x19c18c[_0xc31b('0x42')]['id']}})['then'](handleEntityNotFound(_0x426e2d,null))[_0xc31b('0x39')](saveUpdates(_0x19c18c[_0xc31b('0x41')],null))[_0xc31b('0x39')](respondWithResult(_0x426e2d,null))[_0xc31b('0x40')](handleError(_0x426e2d,null));};exports[_0xc31b('0x43')]=function(_0x1d8877,_0x2bbfb7){return db['ZohoAccount'][_0xc31b('0x3f')]({'where':{'id':_0x1d8877['params']['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x2bbfb7,null))[_0xc31b('0x39')](removeEntity(_0x2bbfb7,null))[_0xc31b('0x40')](handleError(_0x2bbfb7,null));};exports['getConfigurations']=function(_0x56abea,_0x13c7e4,_0x466c2d){var _0x38f652={};var _0x1dea44={};var _0x417493;var _0x440d33;return db['ZohoAccount'][_0xc31b('0x44')]({'where':{'id':_0x56abea[_0xc31b('0x42')]['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x13c7e4,null))[_0xc31b('0x39')](function(_0x5cc530){if(_0x5cc530){_0x417493=_0x5cc530;_0x1dea44['model']=_[_0xc31b('0x2a')](db[_0xc31b('0x45')]['rawAttributes']);_0x1dea44['query']=_[_0xc31b('0x2a')](_0x56abea[_0xc31b('0x29')]);_0x1dea44[_0xc31b('0x2b')]=_['intersection'](_0x1dea44[_0xc31b('0x2c')],_0x1dea44[_0xc31b('0x29')]);_0x38f652['attributes']=_[_0xc31b('0x2d')](_0x1dea44[_0xc31b('0x2c')],qs['fields'](_0x56abea[_0xc31b('0x29')][_0xc31b('0x2e')]));_0x38f652[_0xc31b('0x2f')]=_0x38f652[_0xc31b('0x2f')][_0xc31b('0x30')]?_0x38f652[_0xc31b('0x2f')]:_0x1dea44['model'];_0x38f652[_0xc31b('0x33')]=qs[_0xc31b('0x34')](_0x56abea[_0xc31b('0x29')]['sort']);_0x38f652[_0xc31b('0x35')]=qs[_0xc31b('0x2b')](_['pick'](_0x56abea['query'],_0x1dea44['filters']));if(_0x56abea[_0xc31b('0x29')]['filter']){_0x38f652['where']=_[_0xc31b('0x37')](_0x38f652['where'],{'$or':_['map'](_0x38f652[_0xc31b('0x2f')],function(_0x4bdbb7){var _0x3fb795={};_0x3fb795[_0x4bdbb7]={'$like':'%'+_0x56abea[_0xc31b('0x29')]['filter']+'%'};return _0x3fb795;})});}_0x38f652=_[_0xc31b('0x37')]({},_0x38f652,_0x56abea[_0xc31b('0x3e')]);return _0x417493[_0xc31b('0x46')](_0x38f652);}})[_0xc31b('0x39')](function(_0x56b5a7){if(_0x56b5a7){_0x440d33=_0x56b5a7[_0xc31b('0x30')];if(!_0x56abea[_0xc31b('0x29')][_0xc31b('0x31')](_0xc31b('0x32'))){_0x38f652['limit']=qs['limit'](_0x56abea[_0xc31b('0x29')]['limit']);_0x38f652[_0xc31b('0x1b')]=qs[_0xc31b('0x1b')](_0x56abea[_0xc31b('0x29')][_0xc31b('0x1b')]);}return _0x417493['getConfigurations'](_0x38f652);}})[_0xc31b('0x39')](function(_0x4a8cf3){if(_0x4a8cf3){return _0x4a8cf3?{'count':_0x440d33,'rows':_0x4a8cf3}:null;}})[_0xc31b('0x39')](respondWithResult(_0x13c7e4,null))[_0xc31b('0x40')](handleError(_0x13c7e4,null));};exports[_0xc31b('0x47')]=function(_0x588dd6,_0x2c4e69,_0x57b239){if(_0x588dd6[_0xc31b('0x41')]['id']){delete _0x588dd6['body']['id'];}return db['ZohoAccount'][_0xc31b('0x44')]({'where':{'id':_0x588dd6[_0xc31b('0x42')]['id']}})[_0xc31b('0x39')](handleEntityNotFound(_0x2c4e69,null))[_0xc31b('0x39')](function(_0x490660){if(_0x490660){_0x588dd6['body'][_0xc31b('0x48')]=_0x490660['id'];_0x588dd6[_0xc31b('0x41')][_0xc31b('0x49')]=integrations[_0xc31b('0x4a')](_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4b')],_0x588dd6[_0xc31b('0x41')][_0xc31b('0x26')]);_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4c')]=integrations[_0xc31b('0x4d')](_0x588dd6[_0xc31b('0x41')][_0xc31b('0x4b')],_0x588dd6[_0xc31b('0x41')][_0xc31b('0x26')]);return db[_0xc31b('0x45')]['create'](_0x588dd6[_0xc31b('0x41')],{'include':[{'model':db['ZohoField'],'as':_0xc31b('0x49')},{'model':db[_0xc31b('0x4e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2c4e69,null))[_0xc31b('0x40')](handleError(_0x2c4e69,null));};function getAccessToken(_0x5ab615){return new Promise(function(_0x38bcd9,_0x2cdcd6){var _0x5d2069;switch(_0x5ab615['zone']){case'US':_0x5d2069=_0xc31b('0x4f');break;case'AU':_0x5d2069=_0xc31b('0x50');break;case'EU':_0x5d2069=_0xc31b('0x51');break;case'IN':_0x5d2069=_0xc31b('0x52');break;case'CN':_0x5d2069='https://accounts.zoho.com.cn';break;default:_0x5d2069=_0xc31b('0x51');break;}var _0x23d836={'method':_0xc31b('0x53'),'uri':_0x5d2069+_0xc31b('0x54'),'qs':{'refresh_token':_0x5ab615[_0xc31b('0x55')],'client_id':_0x5ab615[_0xc31b('0x56')],'client_secret':_0x5ab615[_0xc31b('0x57')],'grant_type':_0xc31b('0x58')},'json':!![]};return rp(_0x23d836)[_0xc31b('0x39')](function(_0x3aa2b7){if(_0x3aa2b7[_0xc31b('0x59')]){_0x38bcd9(_0x3aa2b7[_0xc31b('0x59')]);}else{_0x2cdcd6(_0xc31b('0x5a'));}})[_0xc31b('0x40')](function(_0xad1d39){_0x2cdcd6(_0xad1d39);});});}exports[_0xc31b('0x5b')]=function(_0x58380e,_0x1e9401,_0x2dd82c){var _0x36ef18,_0x5f5280,_0x238143,_0x6482a5,_0x274002;return db[_0xc31b('0x23')][_0xc31b('0x44')]({'where':{'id':_0x58380e[_0xc31b('0x42')]['id']},'attributes':['id',_0xc31b('0x5c'),_0xc31b('0x5d'),_0xc31b('0x56'),_0xc31b('0x57'),_0xc31b('0x5e'),_0xc31b('0x5f'),_0xc31b('0x55')]})[_0xc31b('0x39')](handleEntityNotFound(_0x1e9401,null))[_0xc31b('0x39')](function(_0x582300){_0x274002=_0x582300;_0x36ef18=_0x274002[_0xc31b('0x5c')];_0x5f5280=_0x36ef18==='zoho.eu'?'eu':_0xc31b('0x60');_0x238143=_0x274002[_0xc31b('0x5e')];var _0x3037b1=_0x238143[_0xc31b('0x61')](-0x1);if(_0x3037b1==='/'||_0x3037b1==='\x5c'||_0x3037b1===':'){_0x238143=_0x238143['substring'](0x0,_0x238143[_0xc31b('0x62')](_0x3037b1));}if(!_0x274002[_0xc31b('0x55')]){throw new Error(_0xc31b('0x63'));}return getAccessToken(_0x274002);})[_0xc31b('0x39')](function(_0x25ff6a){if(_0x25ff6a){return rp({'method':_0xc31b('0x64'),'uri':util[_0xc31b('0x65')](_0xc31b('0x66'),_0x5f5280),'qs':{'module':_0xc31b('0x67')},'headers':{'Authorization':_0xc31b('0x68')+_0x25ff6a},'json':!![]});}})[_0xc31b('0x39')](function(_0x4414cf){if(_0x4414cf){if(_0x4414cf[_0xc31b('0x69')]&&_0x4414cf[_0xc31b('0x69')][_0xc31b('0x6a')]){throw new Error(_0x4414cf[_0xc31b('0x69')]['error']['message']);}var _0x592486=[];var _0x2ecd7d=[];var _0x163fec=[_0xc31b('0x6b'),_0xc31b('0x6c'),_0xc31b('0x6d'),_0xc31b('0x6e'),_0xc31b('0x6f'),_0xc31b('0x70'),_0xc31b('0x71'),'Call_Type'];_0x2ecd7d=_['remove'](_0x4414cf[_0xc31b('0x2e')],function(_0x5dc32a){return _0x163fec[_0xc31b('0x72')](_0x5dc32a[_0xc31b('0x73')]);});for(var _0x5e28cd=0x0;_0x5e28cd<_0x2ecd7d[_0xc31b('0x30')];_0x5e28cd++){if(_0x2ecd7d[_0x5e28cd][_0xc31b('0x74')]===![]){_0x592486[_0xc31b('0x75')]({'id':_0x2ecd7d[_0x5e28cd]['id'],'name':_0x2ecd7d[_0x5e28cd][_0xc31b('0x76')],'custom':_0x2ecd7d[_0x5e28cd][_0xc31b('0x77')],'options':_0x2ecd7d[_0x5e28cd][_0xc31b('0x78')]===_0xc31b('0x79')&&_0x2ecd7d[_0x5e28cd][_0xc31b('0x7a')][_0xc31b('0x30')]>-0x1?_[_0xc31b('0x28')](_0x2ecd7d[_0x5e28cd]['pick_list_values'],function(_0x106ef8){return{'name':_0x106ef8,'value':_0x106ef8};}):[]});}}return{'count':_0x592486[_0xc31b('0x30')],'rows':_0x592486};}else{return{'count':0x0,'rows':[]};}})[_0xc31b('0x39')](respondWithResult(_0x1e9401,null))[_0xc31b('0x40')](function(_0x26fa87){var _0x6e1f3b=_0x58380e[_0xc31b('0x29')][_0xc31b('0x7b')]?0x1f4:_0x26fa87['statusCode']||0x1f4;logger['error'](_0xc31b('0x7c'),_0xc31b('0x5b'),_0x6e1f3b,JSON[_0xc31b('0x7d')](_0x26fa87));delete _0x26fa87[_0xc31b('0x22')];if(_0x6e1f3b===0x191){_0x6e1f3b=0x190;}_0x1e9401['status'](_0x6e1f3b)[_0xc31b('0x7e')](_0x58380e[_0xc31b('0x29')][_0xc31b('0x7b')]?{'message':_0xc31b('0x7f'),'statusCode':_0x26fa87[_0xc31b('0x80')]}:_0x26fa87);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7e59383..1b04260 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 _0x8da2=['exports','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','host','https://accounts.zoho.in','refreshToken','info','format','catch','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes'];(function(_0x21a022,_0x4b9206){var _0x255fa9=function(_0x3aac30){while(--_0x3aac30){_0x21a022['push'](_0x21a022['shift']());}};_0x255fa9(++_0x4b9206);}(_0x8da2,0x188));var _0x28da=function(_0x22b866,_0x39d07c){_0x22b866=_0x22b866-0x0;var _0x1094d5=_0x8da2[_0x22b866];return _0x1094d5;};'use strict';var _=require(_0x28da('0x0'));var util=require('util');var logger=require(_0x28da('0x1'))(_0x28da('0x2'));var moment=require(_0x28da('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x28da('0x4'));var rimraf=require(_0x28da('0x5'));var config=require(_0x28da('0x6'));var attributes=require(_0x28da('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x28da('0x8')]=function(_0x19903c,_0x1b8fc3){return _0x19903c['define'](_0x28da('0x9'),attributes,{'tableName':_0x28da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b7cdd,_0x35d198,_0x365443){if(_0x3b7cdd['changed'](_0x28da('0xb'))||_0x3b7cdd[_0x28da('0xc')](_0x28da('0xd'))||_0x3b7cdd[_0x28da('0xc')](_0x28da('0xe'))||_0x3b7cdd[_0x28da('0xc')](_0x28da('0xf'))||_0x3b7cdd[_0x28da('0xc')](_0x28da('0x10'))||_0x3b7cdd[_0x28da('0xc')]('host')){var _0x3edf84,_0x3850c6;_0x3edf84=_0x3b7cdd['serverUrl'];var _0xed7130=_0x3edf84[_0x28da('0x11')](-0x1);if(_0xed7130==='/'||_0xed7130==='\x5c'||_0xed7130===':'){_0x3edf84=_0x3edf84[_0x28da('0x12')](0x0,_0x3edf84['lastIndexOf'](_0xed7130));}switch(_0x3b7cdd[_0x28da('0xb')]){case'US':_0x3850c6=_0x28da('0x13');break;case'AU':_0x3850c6=_0x28da('0x14');break;case'IN':_0x3850c6='https://accounts.zoho.in';break;case'CN':_0x3850c6=_0x28da('0x15');break;default:_0x3850c6=_0x28da('0x16');break;}var _0x191f5d={'method':_0x28da('0x17'),'uri':_0x3850c6+_0x28da('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x3b7cdd[_0x28da('0xe')],'client_secret':_0x3b7cdd[_0x28da('0xf')],'redirect_uri':_0x3b7cdd[_0x28da('0xd')],'code':_0x3b7cdd[_0x28da('0x10')]},'headers':{'Content-Type':_0x28da('0x19')}};return rp(_0x191f5d)[_0x28da('0x1a')](function(_0x1f6d10){var _0x5e4f10=JSON[_0x28da('0x1b')](_0x1f6d10);if(_0x5e4f10[_0x28da('0x1c')]){_0x3b7cdd['refreshToken']=_0x5e4f10[_0x28da('0x1c')];logger['info'](util['format'](_0x28da('0x1d'),_0x3b7cdd[_0x28da('0x1e')],_0x3b7cdd['id']));}else{logger['error'](util['format'](_0x28da('0x1f'),_0x3b7cdd[_0x28da('0x1e')],_0x3b7cdd['id']),util[_0x28da('0x20')](_0x5e4f10,{'showHidden':![],'depth':null}));}return _0x365443(null,_0x35d198);})['catch'](function(_0x5014e5){logger[_0x28da('0x21')](util['format'](_0x28da('0x1f'),_0x3b7cdd[_0x28da('0x1e')],_0x3b7cdd['id']),util[_0x28da('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x365443(_0x5014e5);});}else{return _0x365443(null,_0x35d198);}},'beforeUpdate':function(_0x48c4f4,_0x552629,_0x1f0aa5){if(_0x48c4f4['changed'](_0x28da('0xb'))||_0x48c4f4[_0x28da('0xc')](_0x28da('0xd'))||_0x48c4f4[_0x28da('0xc')](_0x28da('0xe'))||_0x48c4f4['changed'](_0x28da('0xf'))||_0x48c4f4['changed']('code')||_0x48c4f4[_0x28da('0xc')](_0x28da('0x22'))){var _0x1ac04a,_0x4bb0ae;_0x1ac04a=_0x48c4f4['serverUrl'];var _0x3195b8=_0x1ac04a[_0x28da('0x11')](-0x1);if(_0x3195b8==='/'||_0x3195b8==='\x5c'||_0x3195b8===':'){_0x1ac04a=_0x1ac04a[_0x28da('0x12')](0x0,_0x1ac04a['lastIndexOf'](_0x3195b8));}switch(_0x48c4f4[_0x28da('0xb')]){case'US':_0x4bb0ae=_0x28da('0x13');break;case'AU':_0x4bb0ae=_0x28da('0x14');break;case'IN':_0x4bb0ae=_0x28da('0x23');break;case'CN':_0x4bb0ae=_0x28da('0x15');break;default:_0x4bb0ae='https://accounts.zoho.eu';break;}var _0x821ed6={'method':_0x28da('0x17'),'uri':_0x4bb0ae+_0x28da('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x48c4f4[_0x28da('0xe')],'client_secret':_0x48c4f4['clientSecret'],'redirect_uri':_0x48c4f4[_0x28da('0xd')],'code':_0x48c4f4[_0x28da('0x10')]},'headers':{'Content-Type':_0x28da('0x19')}};return rp(_0x821ed6)['then'](function(_0x225f6e){var _0x4a55cc=JSON[_0x28da('0x1b')](_0x225f6e);if(_0x4a55cc[_0x28da('0x1c')]){_0x48c4f4[_0x28da('0x24')]=_0x4a55cc[_0x28da('0x1c')];logger[_0x28da('0x25')](util[_0x28da('0x26')](_0x28da('0x1d'),_0x48c4f4['name'],_0x48c4f4['id']));}else{logger[_0x28da('0x21')](util[_0x28da('0x26')](_0x28da('0x1f'),_0x48c4f4[_0x28da('0x1e')],_0x48c4f4['id']),util[_0x28da('0x20')](_0x4a55cc,{'showHidden':![],'depth':null}));}return _0x1f0aa5(null,_0x552629);})[_0x28da('0x27')](function(_0x51c988){logger['error'](util[_0x28da('0x26')](_0x28da('0x1f'),_0x48c4f4[_0x28da('0x1e')],_0x48c4f4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1f0aa5(_0x51c988);});}else{return _0x1f0aa5(null,_0x552629);}}}});}; \ No newline at end of file +var _0x4d23=['parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','authorization_code','application/x-www-form-urlencoded','then','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId'];(function(_0x3722e6,_0x2a63aa){var _0x378a44=function(_0x240d9d){while(--_0x240d9d){_0x3722e6['push'](_0x3722e6['shift']());}};_0x378a44(++_0x2a63aa);}(_0x4d23,0x91));var _0x34d2=function(_0x3afebd,_0x315db2){_0x3afebd=_0x3afebd-0x0;var _0x49858c=_0x4d23[_0x3afebd];return _0x49858c;};'use strict';var _=require('lodash');var util=require(_0x34d2('0x0'));var logger=require(_0x34d2('0x1'))(_0x34d2('0x2'));var moment=require(_0x34d2('0x3'));var BPromise=require(_0x34d2('0x4'));var rp=require(_0x34d2('0x5'));var fs=require('fs');var path=require(_0x34d2('0x6'));var rimraf=require('rimraf');var config=require(_0x34d2('0x7'));var attributes=require(_0x34d2('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x34d2('0x9')]=function(_0x19fc66,_0x1137eb){return _0x19fc66['define'](_0x34d2('0xa'),attributes,{'tableName':_0x34d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbc3c85,_0x198eed,_0xec4632){if(_0xbc3c85[_0x34d2('0xc')](_0x34d2('0xd'))||_0xbc3c85[_0x34d2('0xc')]('serverUrl')||_0xbc3c85[_0x34d2('0xc')]('clientId')||_0xbc3c85['changed'](_0x34d2('0xe'))||_0xbc3c85[_0x34d2('0xc')](_0x34d2('0xf'))||_0xbc3c85['changed']('host')){var _0x900f66,_0x568614;_0x900f66=_0xbc3c85[_0x34d2('0x10')];var _0x3f6bda=_0x900f66[_0x34d2('0x11')](-0x1);if(_0x3f6bda==='/'||_0x3f6bda==='\x5c'||_0x3f6bda===':'){_0x900f66=_0x900f66[_0x34d2('0x12')](0x0,_0x900f66[_0x34d2('0x13')](_0x3f6bda));}switch(_0xbc3c85['zone']){case'US':_0x568614=_0x34d2('0x14');break;case'AU':_0x568614=_0x34d2('0x15');break;case'IN':_0x568614='https://accounts.zoho.in';break;case'CN':_0x568614=_0x34d2('0x16');break;default:_0x568614=_0x34d2('0x17');break;}var _0x13bacd={'method':_0x34d2('0x18'),'uri':_0x568614+_0x34d2('0x19'),'form':{'grant_type':'authorization_code','client_id':_0xbc3c85[_0x34d2('0x1a')],'client_secret':_0xbc3c85['clientSecret'],'redirect_uri':_0xbc3c85[_0x34d2('0x10')],'code':_0xbc3c85[_0x34d2('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x13bacd)['then'](function(_0x4788d0){var _0x1563d8=JSON[_0x34d2('0x1b')](_0x4788d0);if(_0x1563d8[_0x34d2('0x1c')]){_0xbc3c85[_0x34d2('0x1d')]=_0x1563d8[_0x34d2('0x1c')];logger[_0x34d2('0x1e')](util[_0x34d2('0x1f')](_0x34d2('0x20'),_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']));}else{logger[_0x34d2('0x22')](util[_0x34d2('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']),util[_0x34d2('0x23')](_0x1563d8,{'showHidden':![],'depth':null}));}return _0xec4632(null,_0x198eed);})['catch'](function(_0x576840){logger['error'](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0xbc3c85[_0x34d2('0x21')],_0xbc3c85['id']),util[_0x34d2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xec4632(_0x576840);});}else{return _0xec4632(null,_0x198eed);}},'beforeUpdate':function(_0x529131,_0x209b58,_0x4712c1){if(_0x529131[_0x34d2('0xc')](_0x34d2('0xd'))||_0x529131[_0x34d2('0xc')](_0x34d2('0x10'))||_0x529131[_0x34d2('0xc')](_0x34d2('0x1a'))||_0x529131[_0x34d2('0xc')](_0x34d2('0xe'))||_0x529131[_0x34d2('0xc')](_0x34d2('0xf'))||_0x529131['changed'](_0x34d2('0x25'))){var _0x288e1b,_0x52d9d0;_0x288e1b=_0x529131['serverUrl'];var _0x1f0b33=_0x288e1b['slice'](-0x1);if(_0x1f0b33==='/'||_0x1f0b33==='\x5c'||_0x1f0b33===':'){_0x288e1b=_0x288e1b[_0x34d2('0x12')](0x0,_0x288e1b[_0x34d2('0x13')](_0x1f0b33));}switch(_0x529131[_0x34d2('0xd')]){case'US':_0x52d9d0='https://accounts.zoho.com';break;case'AU':_0x52d9d0=_0x34d2('0x15');break;case'IN':_0x52d9d0=_0x34d2('0x26');break;case'CN':_0x52d9d0=_0x34d2('0x16');break;default:_0x52d9d0='https://accounts.zoho.eu';break;}var _0x278d25={'method':_0x34d2('0x18'),'uri':_0x52d9d0+'/oauth/v2/token','form':{'grant_type':_0x34d2('0x27'),'client_id':_0x529131[_0x34d2('0x1a')],'client_secret':_0x529131[_0x34d2('0xe')],'redirect_uri':_0x529131[_0x34d2('0x10')],'code':_0x529131[_0x34d2('0xf')]},'headers':{'Content-Type':_0x34d2('0x28')}};return rp(_0x278d25)[_0x34d2('0x29')](function(_0x59d057){var _0x2880bd=JSON[_0x34d2('0x1b')](_0x59d057);if(_0x2880bd['refresh_token']){_0x529131[_0x34d2('0x1d')]=_0x2880bd['refresh_token'];logger[_0x34d2('0x1e')](util[_0x34d2('0x1f')](_0x34d2('0x20'),_0x529131[_0x34d2('0x21')],_0x529131['id']));}else{logger[_0x34d2('0x22')](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0x529131[_0x34d2('0x21')],_0x529131['id']),util[_0x34d2('0x23')](_0x2880bd,{'showHidden':![],'depth':null}));}return _0x4712c1(null,_0x209b58);})[_0x34d2('0x2a')](function(_0x47db62){logger['error'](util[_0x34d2('0x1f')](_0x34d2('0x24'),_0x529131[_0x34d2('0x21')],_0x529131['id']),util[_0x34d2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4712c1(_0x47db62);});}else{return _0x4712c1(null,_0x209b58);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4a965ea..c9d7f11 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 _0xd906=['where','limit','include','map','model','attributes','then','ShowZohoAccount','find','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetZohoAccount','ZohoAccount','options'];(function(_0x3604b1,_0x31070e){var _0x4f2e67=function(_0x11b70d){while(--_0x11b70d){_0x3604b1['push'](_0x3604b1['shift']());}};_0x4f2e67(++_0x31070e);}(_0xd906,0x6b));var _0x6d90=function(_0x5822f7,_0x37e0da){_0x5822f7=_0x5822f7-0x0;var _0x4ca948=_0xd906[_0x5822f7];return _0x4ca948;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});}exports[_0x6d90('0x12')]=function(_0x352736){var _0x3d37c6=this;return new Promise(function(_0x4e6682,_0x5dd53c){return db[_0x6d90('0x13')]['findAll']({'raw':_0x352736[_0x6d90('0x14')]?_0x352736[_0x6d90('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x352736['options']?_0x352736[_0x6d90('0x14')][_0x6d90('0x15')]||null:null,'attributes':_0x352736[_0x6d90('0x14')]?_0x352736['options']['attributes']||null:null,'limit':_0x352736['options']?_0x352736['options'][_0x6d90('0x16')]||null:null,'include':_0x352736['options']?_0x352736[_0x6d90('0x14')][_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x352736[_0x6d90('0x14')][_0x6d90('0x17')],function(_0x3dcccd){return{'model':db[_0x3dcccd[_0x6d90('0x19')]],'as':_0x3dcccd['as'],'attributes':_0x3dcccd[_0x6d90('0x1a')],'include':_0x3dcccd[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x3dcccd[_0x6d90('0x17')],function(_0x597386){return{'model':db[_0x597386[_0x6d90('0x19')]],'as':_0x597386['as'],'attributes':_0x597386[_0x6d90('0x1a')],'include':_0x597386[_0x6d90('0x17')]?_['map'](_0x597386[_0x6d90('0x17')],function(_0x1fefae){return{'model':db[_0x1fefae[_0x6d90('0x19')]],'as':_0x1fefae['as'],'attributes':_0x1fefae[_0x6d90('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6d90('0x1b')](function(_0x41cdfc){logger[_0x6d90('0xa')](_0x6d90('0x12'),_0x352736);logger[_0x6d90('0xd')](_0x6d90('0x12'),_0x352736,JSON['stringify'](_0x41cdfc));_0x4e6682(_0x41cdfc);})['catch'](function(_0x5e1ab7){logger[_0x6d90('0xf')]('GetZohoAccount',_0x5e1ab7[_0x6d90('0x11')],_0x352736);_0x5dd53c(_0x3d37c6[_0x6d90('0xf')](0x1f4,_0x5e1ab7[_0x6d90('0x11')]));});});};exports[_0x6d90('0x1c')]=function(_0x2cfc62){var _0x1b7790=this;return new Promise(function(_0x196da5,_0x2423c3){return db[_0x6d90('0x13')][_0x6d90('0x1d')]({'raw':_0x2cfc62[_0x6d90('0x14')]?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x15')]||null:null,'attributes':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x1a')]||null:null,'include':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x17')],function(_0x13aa29){return{'model':db[_0x13aa29[_0x6d90('0x19')]],'as':_0x13aa29['as'],'attributes':_0x13aa29[_0x6d90('0x1a')],'include':_0x13aa29[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x13aa29[_0x6d90('0x17')],function(_0x12f20e){return{'model':db[_0x12f20e[_0x6d90('0x19')]],'as':_0x12f20e['as'],'attributes':_0x12f20e[_0x6d90('0x1a')],'include':_0x12f20e[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x12f20e[_0x6d90('0x17')],function(_0x118b03){return{'model':db[_0x118b03['model']],'as':_0x118b03['as'],'attributes':_0x118b03[_0x6d90('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41f8e2){logger[_0x6d90('0xa')]('ShowZohoAccount',_0x2cfc62);logger[_0x6d90('0xd')](_0x6d90('0x1c'),_0x2cfc62,JSON['stringify'](_0x41f8e2));_0x196da5(_0x41f8e2);})[_0x6d90('0x1f')](function(_0x34a3a3){logger[_0x6d90('0xf')](_0x6d90('0x1c'),_0x34a3a3[_0x6d90('0x11')],_0x2cfc62);_0x2423c3(_0x1b7790['error'](0x1f4,_0x34a3a3[_0x6d90('0x11')]));});});}; \ No newline at end of file +var _0x9c1d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','ShowZohoAccount','catch','lodash','util','moment','randomstring'];(function(_0x217e9f,_0x2f0ce3){var _0x504211=function(_0x51842d){while(--_0x51842d){_0x217e9f['push'](_0x217e9f['shift']());}};_0x504211(++_0x2f0ce3);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x559217,_0x24b686){_0x559217=_0x559217-0x0;var _0x370334=_0x9c1d[_0x559217];return _0x370334;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var moment=require(_0xd9c1('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9c1('0x3'));var fs=require('fs');var Redis=require(_0xd9c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9c1('0x5'));var logger=require(_0xd9c1('0x6'))('rpc');var config=require(_0xd9c1('0x7'));var jayson=require(_0xd9c1('0x8'));var client=jayson[_0xd9c1('0x9')][_0xd9c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f729f,_0x3528cc,_0x75aa4b){return new BPromise(function(_0x56e650,_0x3aae47){return client['request'](_0x3f729f,_0x75aa4b)[_0xd9c1('0xb')](function(_0x31c3fb){logger[_0xd9c1('0xc')](_0xd9c1('0xd'),_0x3528cc,_0xd9c1('0xe'));logger[_0xd9c1('0xf')](_0xd9c1('0x10'),_0x3528cc,'request\x20sent',JSON[_0xd9c1('0x11')](_0x31c3fb));if(_0x31c3fb[_0xd9c1('0x12')]){if(_0x31c3fb[_0xd9c1('0x12')]['code']===0x1f4){logger[_0xd9c1('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3528cc,_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);return _0x3aae47(_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);}logger[_0xd9c1('0x12')](_0xd9c1('0xd'),_0x3528cc,_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);return _0x56e650(_0x31c3fb[_0xd9c1('0x12')][_0xd9c1('0x13')]);}else{logger[_0xd9c1('0xc')](_0xd9c1('0xd'),_0x3528cc,_0xd9c1('0xe'));_0x56e650(_0x31c3fb[_0xd9c1('0x14')][_0xd9c1('0x13')]);}})['catch'](function(_0x4bb069){logger[_0xd9c1('0x12')](_0xd9c1('0xd'),_0x3528cc,_0x4bb069);_0x3aae47(_0x4bb069);});});}exports[_0xd9c1('0x15')]=function(_0x1a1542){var _0x10a586=this;return new Promise(function(_0x454559,_0xfe03f8){return db[_0xd9c1('0x16')][_0xd9c1('0x17')]({'raw':_0x1a1542['options']?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x19')]===undefined?!![]:![]:!![],'where':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1a')]||null:null,'attributes':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542['options'][_0xd9c1('0x1b')]||null:null,'limit':_0x1a1542[_0xd9c1('0x18')]?_0x1a1542[_0xd9c1('0x18')]['limit']||null:null,'include':_0x1a1542['options']?_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x1a1542[_0xd9c1('0x18')][_0xd9c1('0x1c')],function(_0x5f6a76){return{'model':db[_0x5f6a76[_0xd9c1('0x1e')]],'as':_0x5f6a76['as'],'attributes':_0x5f6a76['attributes'],'include':_0x5f6a76[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x5f6a76['include'],function(_0x5dc2ee){return{'model':db[_0x5dc2ee[_0xd9c1('0x1e')]],'as':_0x5dc2ee['as'],'attributes':_0x5dc2ee[_0xd9c1('0x1b')],'include':_0x5dc2ee[_0xd9c1('0x1c')]?_['map'](_0x5dc2ee[_0xd9c1('0x1c')],function(_0x282e01){return{'model':db[_0x282e01['model']],'as':_0x282e01['as'],'attributes':_0x282e01['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9c1('0xb')](function(_0x2d2f1c){logger[_0xd9c1('0xc')](_0xd9c1('0x15'),_0x1a1542);logger[_0xd9c1('0xf')](_0xd9c1('0x15'),_0x1a1542,JSON[_0xd9c1('0x11')](_0x2d2f1c));_0x454559(_0x2d2f1c);})['catch'](function(_0x250527){logger[_0xd9c1('0x12')](_0xd9c1('0x15'),_0x250527[_0xd9c1('0x13')],_0x1a1542);_0xfe03f8(_0x10a586[_0xd9c1('0x12')](0x1f4,_0x250527[_0xd9c1('0x13')]));});});};exports[_0xd9c1('0x1f')]=function(_0x313f05){var _0x5a1a5c=this;return new Promise(function(_0x5117d6,_0x5923d9){return db[_0xd9c1('0x16')]['find']({'raw':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1a')]||null:null,'attributes':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1b')]||null:null,'include':_0x313f05[_0xd9c1('0x18')]?_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x313f05[_0xd9c1('0x18')][_0xd9c1('0x1c')],function(_0x4fd94b){return{'model':db[_0x4fd94b['model']],'as':_0x4fd94b['as'],'attributes':_0x4fd94b[_0xd9c1('0x1b')],'include':_0x4fd94b[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x4fd94b['include'],function(_0x6f70be){return{'model':db[_0x6f70be[_0xd9c1('0x1e')]],'as':_0x6f70be['as'],'attributes':_0x6f70be['attributes'],'include':_0x6f70be[_0xd9c1('0x1c')]?_[_0xd9c1('0x1d')](_0x6f70be['include'],function(_0x5805c9){return{'model':db[_0x5805c9[_0xd9c1('0x1e')]],'as':_0x5805c9['as'],'attributes':_0x5805c9[_0xd9c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd9c1('0xb')](function(_0x791234){logger[_0xd9c1('0xc')](_0xd9c1('0x1f'),_0x313f05);logger['debug'](_0xd9c1('0x1f'),_0x313f05,JSON[_0xd9c1('0x11')](_0x791234));_0x5117d6(_0x791234);})[_0xd9c1('0x20')](function(_0x5b062f){logger[_0xd9c1('0x12')](_0xd9c1('0x1f'),_0x5b062f[_0xd9c1('0x13')],_0x313f05);_0x5923d9(_0x5a1a5c[_0xd9c1('0x12')](0x1f4,_0x5b062f[_0xd9c1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 95b8ff7..fb2db91 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 _0xc174=['create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x29cab7,_0x51a00e){var _0x6d17fa=function(_0x10db99){while(--_0x10db99){_0x29cab7['push'](_0x29cab7['shift']());}};_0x6d17fa(++_0x51a00e);}(_0xc174,0x17f));var _0x4c17=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xc174[_0x40d8d7];return _0x3454cc;};'use strict';var multer=require(_0x4c17('0x0'));var util=require(_0x4c17('0x1'));var path=require(_0x4c17('0x2'));var timeout=require(_0x4c17('0x3'));var express=require('express');var router=express[_0x4c17('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c17('0x5'));var interaction=require(_0x4c17('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x4c17('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c17('0x8')]);router[_0x4c17('0x7')]('/:id',auth[_0x4c17('0x9')](),controller[_0x4c17('0xa')]);router[_0x4c17('0x7')]('/:id/fields',auth[_0x4c17('0x9')](),controller[_0x4c17('0xb')]);router[_0x4c17('0x7')](_0x4c17('0xc'),auth[_0x4c17('0x9')](),controller[_0x4c17('0xd')]);router['get'](_0x4c17('0xe'),auth[_0x4c17('0x9')](),controller[_0x4c17('0xf')]);router['post']('/',auth[_0x4c17('0x9')](),controller[_0x4c17('0x10')]);router[_0x4c17('0x11')](_0x4c17('0x12'),auth[_0x4c17('0x9')](),controller[_0x4c17('0x13')]);router[_0x4c17('0x14')](_0x4c17('0x12'),auth[_0x4c17('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d13=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','put','update'];(function(_0x1f30f5,_0x20c31b){var _0x9942af=function(_0x2d2adf){while(--_0x2d2adf){_0x1f30f5['push'](_0x1f30f5['shift']());}};_0x9942af(++_0x20c31b);}(_0x4d13,0x112));var _0x34d1=function(_0x30eea3,_0x92645b){_0x30eea3=_0x30eea3-0x0;var _0x30ccf6=_0x4d13[_0x30eea3];return _0x30ccf6;};'use strict';var multer=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var path=require(_0x34d1('0x2'));var timeout=require(_0x34d1('0x3'));var express=require(_0x34d1('0x4'));var router=express[_0x34d1('0x5')]();var fs_extra=require(_0x34d1('0x6'));var auth=require(_0x34d1('0x7'));var interaction=require(_0x34d1('0x8'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x34d1('0x9')](),controller[_0x34d1('0xa')]);router['get'](_0x34d1('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34d1('0xc')](_0x34d1('0xd'),auth[_0x34d1('0x9')](),controller[_0x34d1('0xe')]);router['get'](_0x34d1('0xf'),auth[_0x34d1('0x9')](),controller[_0x34d1('0x10')]);router['get']('/:id/descriptions',auth[_0x34d1('0x9')](),controller[_0x34d1('0x11')]);router['post']('/',auth[_0x34d1('0x9')](),controller['create']);router[_0x34d1('0x12')](_0x34d1('0xb'),auth[_0x34d1('0x9')](),controller[_0x34d1('0x13')]);router['delete'](_0x34d1('0xb'),auth['isAuthenticated'](),controller[_0x34d1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f314b3a..9d54f9a 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 _0x89d4=['ENUM','lead','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x50d2ba,_0x5a0366){var _0x5f2d7a=function(_0x521717){while(--_0x521717){_0x50d2ba['push'](_0x50d2ba['shift']());}};_0x5f2d7a(++_0x5a0366);}(_0x89d4,0xc1));var _0x489d=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x89d4[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require(_0x489d('0x0'));module[_0x489d('0x1')]={'name':{'type':Sequelize[_0x489d('0x2')]},'moduleCreate':{'type':Sequelize[_0x489d('0x3')](_0x489d('0x4'),'contact',_0x489d('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x489d('0x3')](_0x489d('0x6'),'contact','lead'),'defaultValue':_0x489d('0x6')},'description':{'type':Sequelize[_0x489d('0x2')]}}; \ No newline at end of file +var _0xd7b1=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd7b1,0xd5));var _0x1d7b=function(_0x16a9b7,_0x19a43b){_0x16a9b7=_0x16a9b7-0x0;var _0x24b95d=_0xd7b1[_0x16a9b7];return _0x24b95d;};'use strict';var Sequelize=require('sequelize');module[_0x1d7b('0x0')]={'name':{'type':Sequelize[_0x1d7b('0x1')]},'moduleCreate':{'type':Sequelize[_0x1d7b('0x2')](_0x1d7b('0x3'),_0x1d7b('0x4'),_0x1d7b('0x5')),'defaultValue':_0x1d7b('0x3')},'moduleSearch':{'type':Sequelize[_0x1d7b('0x2')](_0x1d7b('0x6'),_0x1d7b('0x4'),_0x1d7b('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1d7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2eaf272..153d1b9 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 _0x19aa=['create','body','catch','params','getFields','findOne','ZohoField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','map','ZohoConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','find'];(function(_0x2ab952,_0x1fb5a9){var _0x2af809=function(_0x313c72){while(--_0x313c72){_0x2ab952['push'](_0x2ab952['shift']());}};_0x2af809(++_0x1fb5a9);}(_0x19aa,0x147));var _0xa19a=function(_0x577e0f,_0x4f0359){_0x577e0f=_0x577e0f-0x0;var _0x3380e1=_0x19aa[_0x577e0f];return _0x3380e1;};'use strict';var emlformat=require(_0xa19a('0x0'));var rimraf=require(_0xa19a('0x1'));var zipdir=require(_0xa19a('0x2'));var jsonpatch=require(_0xa19a('0x3'));var rp=require(_0xa19a('0x4'));var moment=require(_0xa19a('0x5'));var BPromise=require(_0xa19a('0x6'));var Mustache=require('mustache');var util=require(_0xa19a('0x7'));var path=require(_0xa19a('0x8'));var sox=require(_0xa19a('0x9'));var csv=require(_0xa19a('0xa'));var ejs=require(_0xa19a('0xb'));var fs=require('fs');var fs_extra=require(_0xa19a('0xc'));var _=require(_0xa19a('0xd'));var squel=require(_0xa19a('0xe'));var crypto=require(_0xa19a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa19a('0x10'));var toCsv=require(_0xa19a('0xa'));var querystring=require('querystring');var Papa=require(_0xa19a('0x11'));var Redis=require('ioredis');var authService=require(_0xa19a('0x12'));var qs=require(_0xa19a('0x13'));var as=require(_0xa19a('0x14'));var hardwareService=require(_0xa19a('0x15'));var logger=require(_0xa19a('0x16'))(_0xa19a('0x17'));var utils=require(_0xa19a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa19a('0x19'))['db'];function respondWithStatusCode(_0x1794f4,_0x4b3095){_0x4b3095=_0x4b3095||0xcc;return function(_0x161e88){if(_0x161e88){return _0x1794f4['sendStatus'](_0x4b3095);}return _0x1794f4[_0xa19a('0x1a')](_0x4b3095)['end']();};}function respondWithResult(_0xd60a15,_0x4b1b0a){_0x4b1b0a=_0x4b1b0a||0xc8;return function(_0x63ea57){if(_0x63ea57){return _0xd60a15[_0xa19a('0x1a')](_0x4b1b0a)[_0xa19a('0x1b')](_0x63ea57);}};}function respondWithFilteredResult(_0x329f50,_0x5884fd){return function(_0xde36d){if(_0xde36d){var _0x40444c=typeof _0x5884fd[_0xa19a('0x1c')]===_0xa19a('0x1d')&&typeof _0x5884fd['limit']==='undefined';var _0x195236=_0xde36d['count'];var _0x5459a5=_0x40444c?0x0:_0x5884fd[_0xa19a('0x1c')];var _0x283d55=_0x40444c?_0xde36d['count']:_0x5884fd['offset']+_0x5884fd['limit'];var _0x406e84;if(_0x283d55>=_0x195236){_0x283d55=_0x195236;_0x406e84=0xc8;}else{_0x406e84=0xce;}_0x329f50[_0xa19a('0x1a')](_0x406e84);return _0x329f50['set'](_0xa19a('0x1e'),_0x5459a5+'-'+_0x283d55+'/'+_0x195236)[_0xa19a('0x1b')](_0xde36d);}return null;};}function patchUpdates(_0xbdf8f1){return function(_0x138d2a){try{jsonpatch[_0xa19a('0x1f')](_0x138d2a,_0xbdf8f1,!![]);}catch(_0x241bb0){return BPromise['reject'](_0x241bb0);}return _0x138d2a[_0xa19a('0x20')]();};}function saveUpdates(_0x3cf8d6,_0x7a27c8){return function(_0x28b9eb){if(_0x28b9eb){return _0x28b9eb[_0xa19a('0x21')](_0x3cf8d6)[_0xa19a('0x22')](function(_0x883e5e){return _0x883e5e;});}return null;};}function removeEntity(_0x58d03f,_0x1848c3){return function(_0x484eba){if(_0x484eba){return _0x484eba[_0xa19a('0x23')]()[_0xa19a('0x22')](function(){_0x58d03f[_0xa19a('0x1a')](0xcc)[_0xa19a('0x24')]();});}};}function handleEntityNotFound(_0x5e8094,_0x327fdd){return function(_0x4cebca){if(!_0x4cebca){_0x5e8094[_0xa19a('0x25')](0x194);}return _0x4cebca;};}function handleError(_0x4b0d61,_0xc92978){_0xc92978=_0xc92978||0x1f4;return function(_0x5f2904){logger['error'](_0x5f2904[_0xa19a('0x26')]);if(_0x5f2904[_0xa19a('0x27')]){delete _0x5f2904[_0xa19a('0x27')];}_0x4b0d61['status'](_0xc92978)['send'](_0x5f2904);};}exports['index']=function(_0x39be7d,_0x35669f){var _0x8b0d2e={},_0x1a6493={},_0x3344fd={'count':0x0,'rows':[]};var _0x2663c9=_[_0xa19a('0x28')](db[_0xa19a('0x29')][_0xa19a('0x2a')],function(_0x56ce67){return{'name':_0x56ce67[_0xa19a('0x2b')],'type':_0x56ce67[_0xa19a('0x2c')]['key']};});_0x1a6493['model']=_['map'](_0x2663c9,_0xa19a('0x27'));_0x1a6493[_0xa19a('0x2d')]=_['keys'](_0x39be7d[_0xa19a('0x2d')]);_0x1a6493[_0xa19a('0x2e')]=_[_0xa19a('0x2f')](_0x1a6493[_0xa19a('0x30')],_0x1a6493[_0xa19a('0x2d')]);_0x8b0d2e['attributes']=_[_0xa19a('0x2f')](_0x1a6493['model'],qs[_0xa19a('0x31')](_0x39be7d[_0xa19a('0x2d')][_0xa19a('0x31')]));_0x8b0d2e[_0xa19a('0x32')]=_0x8b0d2e[_0xa19a('0x32')][_0xa19a('0x33')]?_0x8b0d2e[_0xa19a('0x32')]:_0x1a6493[_0xa19a('0x30')];if(!_0x39be7d[_0xa19a('0x2d')]['hasOwnProperty'](_0xa19a('0x34'))){_0x8b0d2e[_0xa19a('0x35')]=qs['limit'](_0x39be7d[_0xa19a('0x2d')][_0xa19a('0x35')]);_0x8b0d2e[_0xa19a('0x1c')]=qs[_0xa19a('0x1c')](_0x39be7d[_0xa19a('0x2d')]['offset']);}_0x8b0d2e[_0xa19a('0x36')]=qs['sort'](_0x39be7d['query'][_0xa19a('0x37')]);_0x8b0d2e[_0xa19a('0x38')]=qs[_0xa19a('0x2e')](_['pick'](_0x39be7d[_0xa19a('0x2d')],_0x1a6493[_0xa19a('0x2e')]),_0x2663c9);if(_0x39be7d[_0xa19a('0x2d')][_0xa19a('0x39')]){_0x8b0d2e[_0xa19a('0x38')]=_[_0xa19a('0x3a')](_0x8b0d2e['where'],{'$or':_[_0xa19a('0x28')](_0x2663c9,function(_0x5a6b5b){if(_0x5a6b5b[_0xa19a('0x2c')]!==_0xa19a('0x3b')){var _0x3af46e={};_0x3af46e[_0x5a6b5b[_0xa19a('0x27')]]={'$like':'%'+_0x39be7d[_0xa19a('0x2d')][_0xa19a('0x39')]+'%'};return _0x3af46e;}})});}_0x8b0d2e=_[_0xa19a('0x3a')]({},_0x8b0d2e,_0x39be7d[_0xa19a('0x3c')]);var _0x18d209={'where':_0x8b0d2e[_0xa19a('0x38')]};return db['ZohoConfiguration'][_0xa19a('0x3d')](_0x18d209)[_0xa19a('0x22')](function(_0xe52260){_0x3344fd['count']=_0xe52260;if(_0x39be7d[_0xa19a('0x2d')][_0xa19a('0x3e')]){_0x8b0d2e[_0xa19a('0x3f')]=[{'all':!![]}];}return db[_0xa19a('0x29')]['findAll'](_0x8b0d2e);})['then'](function(_0x3ab0c5){_0x3344fd[_0xa19a('0x40')]=_0x3ab0c5;return _0x3344fd;})['then'](respondWithFilteredResult(_0x35669f,_0x8b0d2e))['catch'](handleError(_0x35669f,null));};exports[_0xa19a('0x41')]=function(_0x39f0a1,_0x28bd77){var _0x557f2b={'raw':![],'where':{'id':_0x39f0a1['params']['id']}},_0xcab28c={};_0xcab28c[_0xa19a('0x30')]=_[_0xa19a('0x42')](db[_0xa19a('0x29')][_0xa19a('0x2a')]);_0xcab28c['query']=_[_0xa19a('0x42')](_0x39f0a1[_0xa19a('0x2d')]);_0xcab28c['filters']=_[_0xa19a('0x2f')](_0xcab28c[_0xa19a('0x30')],_0xcab28c['query']);_0x557f2b[_0xa19a('0x32')]=_[_0xa19a('0x2f')](_0xcab28c['model'],qs[_0xa19a('0x31')](_0x39f0a1[_0xa19a('0x2d')][_0xa19a('0x31')]));_0x557f2b[_0xa19a('0x32')]=_0x557f2b[_0xa19a('0x32')][_0xa19a('0x33')]?_0x557f2b['attributes']:_0xcab28c[_0xa19a('0x30')];if(_0x39f0a1[_0xa19a('0x2d')][_0xa19a('0x3e')]){_0x557f2b[_0xa19a('0x3f')]=[{'all':!![]}];}_0x557f2b=_[_0xa19a('0x3a')]({},_0x557f2b,_0x39f0a1[_0xa19a('0x3c')]);return db[_0xa19a('0x29')][_0xa19a('0x43')](_0x557f2b)[_0xa19a('0x22')](handleEntityNotFound(_0x28bd77,null))[_0xa19a('0x22')](respondWithResult(_0x28bd77,null))['catch'](handleError(_0x28bd77,null));};exports[_0xa19a('0x44')]=function(_0x5af76f,_0x4dc76a){return db[_0xa19a('0x29')][_0xa19a('0x44')](_0x5af76f[_0xa19a('0x45')],{})[_0xa19a('0x22')](respondWithResult(_0x4dc76a,0xc9))[_0xa19a('0x46')](handleError(_0x4dc76a,null));};exports[_0xa19a('0x21')]=function(_0x2b147c,_0x3d2262){if(_0x2b147c['body']['id']){delete _0x2b147c[_0xa19a('0x45')]['id'];}return db[_0xa19a('0x29')][_0xa19a('0x43')]({'where':{'id':_0x2b147c[_0xa19a('0x47')]['id']}})[_0xa19a('0x22')](handleEntityNotFound(_0x3d2262,null))[_0xa19a('0x22')](saveUpdates(_0x2b147c[_0xa19a('0x45')],null))[_0xa19a('0x22')](respondWithResult(_0x3d2262,null))[_0xa19a('0x46')](handleError(_0x3d2262,null));};exports[_0xa19a('0x23')]=function(_0x3c7231,_0x17b5f5){return db[_0xa19a('0x29')][_0xa19a('0x43')]({'where':{'id':_0x3c7231[_0xa19a('0x47')]['id']}})['then'](handleEntityNotFound(_0x17b5f5,null))[_0xa19a('0x22')](removeEntity(_0x17b5f5,null))['catch'](handleError(_0x17b5f5,null));};exports[_0xa19a('0x48')]=function(_0x659d61,_0x41d8dd,_0x359280){var _0x4bb67b={};var _0xca26db={};var _0x5ca453;var _0x5758b8;return db['ZohoConfiguration'][_0xa19a('0x49')]({'where':{'id':_0x659d61[_0xa19a('0x47')]['id']}})['then'](handleEntityNotFound(_0x41d8dd,null))[_0xa19a('0x22')](function(_0x3aff42){if(_0x3aff42){_0x5ca453=_0x3aff42;_0xca26db[_0xa19a('0x30')]=_[_0xa19a('0x42')](db[_0xa19a('0x4a')][_0xa19a('0x2a')]);_0xca26db[_0xa19a('0x2d')]=_[_0xa19a('0x42')](_0x659d61[_0xa19a('0x2d')]);_0xca26db[_0xa19a('0x2e')]=_['intersection'](_0xca26db[_0xa19a('0x30')],_0xca26db[_0xa19a('0x2d')]);_0x4bb67b[_0xa19a('0x32')]=_[_0xa19a('0x2f')](_0xca26db['model'],qs['fields'](_0x659d61[_0xa19a('0x2d')][_0xa19a('0x31')]));_0x4bb67b[_0xa19a('0x32')]=_0x4bb67b[_0xa19a('0x32')][_0xa19a('0x33')]?_0x4bb67b[_0xa19a('0x32')]:_0xca26db['model'];_0x4bb67b[_0xa19a('0x36')]=qs[_0xa19a('0x37')](_0x659d61[_0xa19a('0x2d')][_0xa19a('0x37')]);_0x4bb67b['where']=qs[_0xa19a('0x2e')](_[_0xa19a('0x4b')](_0x659d61[_0xa19a('0x2d')],_0xca26db[_0xa19a('0x2e')]));if(_0x659d61[_0xa19a('0x2d')][_0xa19a('0x39')]){_0x4bb67b[_0xa19a('0x38')]=_['merge'](_0x4bb67b['where'],{'$or':_[_0xa19a('0x28')](_0x4bb67b['attributes'],function(_0x421db5){var _0x334dbb={};_0x334dbb[_0x421db5]={'$like':'%'+_0x659d61[_0xa19a('0x2d')][_0xa19a('0x39')]+'%'};return _0x334dbb;})});}_0x4bb67b=_[_0xa19a('0x3a')]({},_0x4bb67b,_0x659d61['options']);return _0x5ca453[_0xa19a('0x48')](_0x4bb67b);}})[_0xa19a('0x22')](function(_0x68ad80){if(_0x68ad80){_0x5758b8=_0x68ad80[_0xa19a('0x33')];if(!_0x659d61[_0xa19a('0x2d')][_0xa19a('0x4c')](_0xa19a('0x34'))){_0x4bb67b[_0xa19a('0x35')]=qs[_0xa19a('0x35')](_0x659d61[_0xa19a('0x2d')][_0xa19a('0x35')]);_0x4bb67b[_0xa19a('0x1c')]=qs['offset'](_0x659d61[_0xa19a('0x2d')][_0xa19a('0x1c')]);}return _0x5ca453[_0xa19a('0x48')](_0x4bb67b);}})[_0xa19a('0x22')](function(_0x480aa5){if(_0x480aa5){return _0x480aa5?{'count':_0x5758b8,'rows':_0x480aa5}:null;}})[_0xa19a('0x22')](respondWithResult(_0x41d8dd,null))[_0xa19a('0x46')](handleError(_0x41d8dd,null));};exports[_0xa19a('0x4d')]=function(_0x3a6507,_0x269aaa,_0x17df15){var _0x18decb={};var _0x1e4c80={};var _0x3db8a4;var _0xd17f1;return db['ZohoConfiguration'][_0xa19a('0x49')]({'where':{'id':_0x3a6507[_0xa19a('0x47')]['id']}})[_0xa19a('0x22')](handleEntityNotFound(_0x269aaa,null))[_0xa19a('0x22')](function(_0x5d6d15){if(_0x5d6d15){_0x3db8a4=_0x5d6d15;_0x1e4c80[_0xa19a('0x30')]=_[_0xa19a('0x42')](db['ZohoField']['rawAttributes']);_0x1e4c80[_0xa19a('0x2d')]=_[_0xa19a('0x42')](_0x3a6507[_0xa19a('0x2d')]);_0x1e4c80[_0xa19a('0x2e')]=_['intersection'](_0x1e4c80['model'],_0x1e4c80['query']);_0x18decb['attributes']=_[_0xa19a('0x2f')](_0x1e4c80[_0xa19a('0x30')],qs['fields'](_0x3a6507['query']['fields']));_0x18decb[_0xa19a('0x32')]=_0x18decb['attributes'][_0xa19a('0x33')]?_0x18decb[_0xa19a('0x32')]:_0x1e4c80['model'];_0x18decb[_0xa19a('0x36')]=qs[_0xa19a('0x37')](_0x3a6507[_0xa19a('0x2d')][_0xa19a('0x37')]);_0x18decb[_0xa19a('0x38')]=qs['filters'](_[_0xa19a('0x4b')](_0x3a6507[_0xa19a('0x2d')],_0x1e4c80[_0xa19a('0x2e')]));if(_0x3a6507[_0xa19a('0x2d')][_0xa19a('0x39')]){_0x18decb['where']=_[_0xa19a('0x3a')](_0x18decb[_0xa19a('0x38')],{'$or':_[_0xa19a('0x28')](_0x18decb[_0xa19a('0x32')],function(_0x1687ea){var _0x73d7f2={};_0x73d7f2[_0x1687ea]={'$like':'%'+_0x3a6507['query'][_0xa19a('0x39')]+'%'};return _0x73d7f2;})});}_0x18decb=_['merge']({},_0x18decb,_0x3a6507['options']);return _0x3db8a4[_0xa19a('0x4d')](_0x18decb);}})['then'](function(_0x485f76){if(_0x485f76){_0xd17f1=_0x485f76[_0xa19a('0x33')];if(!_0x3a6507[_0xa19a('0x2d')][_0xa19a('0x4c')]('nolimit')){_0x18decb[_0xa19a('0x35')]=qs[_0xa19a('0x35')](_0x3a6507[_0xa19a('0x2d')][_0xa19a('0x35')]);_0x18decb[_0xa19a('0x1c')]=qs[_0xa19a('0x1c')](_0x3a6507[_0xa19a('0x2d')][_0xa19a('0x1c')]);}return _0x3db8a4['getSubjects'](_0x18decb);}})['then'](function(_0x4bab8b){if(_0x4bab8b){return _0x4bab8b?{'count':_0xd17f1,'rows':_0x4bab8b}:null;}})[_0xa19a('0x22')](respondWithResult(_0x269aaa,null))[_0xa19a('0x46')](handleError(_0x269aaa,null));};exports[_0xa19a('0x4e')]=function(_0x38d9df,_0x11798a,_0xf8455f){var _0x1d98bb={};var _0x534be3={};var _0x131c7c;var _0x2755c7;return db[_0xa19a('0x29')][_0xa19a('0x49')]({'where':{'id':_0x38d9df[_0xa19a('0x47')]['id']}})[_0xa19a('0x22')](handleEntityNotFound(_0x11798a,null))['then'](function(_0x47349a){if(_0x47349a){_0x131c7c=_0x47349a;_0x534be3['model']=_[_0xa19a('0x42')](db['ZohoField'][_0xa19a('0x2a')]);_0x534be3[_0xa19a('0x2d')]=_[_0xa19a('0x42')](_0x38d9df[_0xa19a('0x2d')]);_0x534be3['filters']=_[_0xa19a('0x2f')](_0x534be3[_0xa19a('0x30')],_0x534be3[_0xa19a('0x2d')]);_0x1d98bb['attributes']=_[_0xa19a('0x2f')](_0x534be3['model'],qs[_0xa19a('0x31')](_0x38d9df[_0xa19a('0x2d')][_0xa19a('0x31')]));_0x1d98bb[_0xa19a('0x32')]=_0x1d98bb['attributes'][_0xa19a('0x33')]?_0x1d98bb[_0xa19a('0x32')]:_0x534be3['model'];_0x1d98bb[_0xa19a('0x36')]=qs[_0xa19a('0x37')](_0x38d9df[_0xa19a('0x2d')][_0xa19a('0x37')]);_0x1d98bb['where']=qs[_0xa19a('0x2e')](_[_0xa19a('0x4b')](_0x38d9df[_0xa19a('0x2d')],_0x534be3['filters']));if(_0x38d9df[_0xa19a('0x2d')][_0xa19a('0x39')]){_0x1d98bb[_0xa19a('0x38')]=_[_0xa19a('0x3a')](_0x1d98bb[_0xa19a('0x38')],{'$or':_['map'](_0x1d98bb[_0xa19a('0x32')],function(_0x49825d){var _0x10de76={};_0x10de76[_0x49825d]={'$like':'%'+_0x38d9df['query'][_0xa19a('0x39')]+'%'};return _0x10de76;})});}_0x1d98bb=_['merge']({},_0x1d98bb,_0x38d9df['options']);return _0x131c7c['getDescriptions'](_0x1d98bb);}})[_0xa19a('0x22')](function(_0x2acc2e){if(_0x2acc2e){_0x2755c7=_0x2acc2e[_0xa19a('0x33')];if(!_0x38d9df[_0xa19a('0x2d')][_0xa19a('0x4c')](_0xa19a('0x34'))){_0x1d98bb[_0xa19a('0x35')]=qs[_0xa19a('0x35')](_0x38d9df[_0xa19a('0x2d')]['limit']);_0x1d98bb[_0xa19a('0x1c')]=qs['offset'](_0x38d9df['query']['offset']);}return _0x131c7c[_0xa19a('0x4e')](_0x1d98bb);}})[_0xa19a('0x22')](function(_0x399fab){if(_0x399fab){return _0x399fab?{'count':_0x2755c7,'rows':_0x399fab}:null;}})[_0xa19a('0x22')](respondWithResult(_0x11798a,null))['catch'](handleError(_0x11798a,null));}; \ No newline at end of file +var _0x1c67=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getFields','findOne','ZohoField','length','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x8e1c4d,_0x54e064){var _0x4f18b3=function(_0x33d44b){while(--_0x33d44b){_0x8e1c4d['push'](_0x8e1c4d['shift']());}};_0x4f18b3(++_0x54e064);}(_0x1c67,0x1d8));var _0x71c6=function(_0x5b9465,_0x8cfbc7){_0x5b9465=_0x5b9465-0x0;var _0x24d44d=_0x1c67[_0x5b9465];return _0x24d44d;};'use strict';var emlformat=require(_0x71c6('0x0'));var rimraf=require(_0x71c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71c6('0x2'));var rp=require(_0x71c6('0x3'));var moment=require('moment');var BPromise=require(_0x71c6('0x4'));var Mustache=require(_0x71c6('0x5'));var util=require('util');var path=require(_0x71c6('0x6'));var sox=require('sox');var csv=require(_0x71c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71c6('0x8'));var _=require(_0x71c6('0x9'));var squel=require(_0x71c6('0xa'));var crypto=require(_0x71c6('0xb'));var jsforce=require(_0x71c6('0xc'));var deskjs=require(_0x71c6('0xd'));var toCsv=require(_0x71c6('0x7'));var querystring=require(_0x71c6('0xe'));var Papa=require(_0x71c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x71c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71c6('0x11'));var logger=require(_0x71c6('0x12'))(_0x71c6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x71c6('0x14'));var db=require(_0x71c6('0x15'))['db'];function respondWithStatusCode(_0x15df8d,_0x3e4d60){_0x3e4d60=_0x3e4d60||0xcc;return function(_0x33f465){if(_0x33f465){return _0x15df8d[_0x71c6('0x16')](_0x3e4d60);}return _0x15df8d[_0x71c6('0x17')](_0x3e4d60)[_0x71c6('0x18')]();};}function respondWithResult(_0x703570,_0x4982a0){_0x4982a0=_0x4982a0||0xc8;return function(_0x59eb35){if(_0x59eb35){return _0x703570[_0x71c6('0x17')](_0x4982a0)[_0x71c6('0x19')](_0x59eb35);}};}function respondWithFilteredResult(_0x36d2a6,_0x321904){return function(_0x29b46d){if(_0x29b46d){var _0x5f3bfa=typeof _0x321904[_0x71c6('0x1a')]===_0x71c6('0x1b')&&typeof _0x321904[_0x71c6('0x1c')]===_0x71c6('0x1b');var _0x58bc1d=_0x29b46d[_0x71c6('0x1d')];var _0x373394=_0x5f3bfa?0x0:_0x321904[_0x71c6('0x1a')];var _0x1977de=_0x5f3bfa?_0x29b46d[_0x71c6('0x1d')]:_0x321904[_0x71c6('0x1a')]+_0x321904[_0x71c6('0x1c')];var _0x12a429;if(_0x1977de>=_0x58bc1d){_0x1977de=_0x58bc1d;_0x12a429=0xc8;}else{_0x12a429=0xce;}_0x36d2a6['status'](_0x12a429);return _0x36d2a6[_0x71c6('0x1e')](_0x71c6('0x1f'),_0x373394+'-'+_0x1977de+'/'+_0x58bc1d)[_0x71c6('0x19')](_0x29b46d);}return null;};}function patchUpdates(_0x296414){return function(_0x3a769b){try{jsonpatch[_0x71c6('0x20')](_0x3a769b,_0x296414,!![]);}catch(_0x5a49c7){return BPromise[_0x71c6('0x21')](_0x5a49c7);}return _0x3a769b[_0x71c6('0x22')]();};}function saveUpdates(_0xf98996,_0x20824e){return function(_0x50cac8){if(_0x50cac8){return _0x50cac8[_0x71c6('0x23')](_0xf98996)[_0x71c6('0x24')](function(_0x36daf5){return _0x36daf5;});}return null;};}function removeEntity(_0x311b52,_0x2ccbfb){return function(_0x26dc4b){if(_0x26dc4b){return _0x26dc4b[_0x71c6('0x25')]()['then'](function(){_0x311b52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6358,_0x5525af){return function(_0x22b86d){if(!_0x22b86d){_0x5b6358[_0x71c6('0x16')](0x194);}return _0x22b86d;};}function handleError(_0x4ec5be,_0x47b02a){_0x47b02a=_0x47b02a||0x1f4;return function(_0x828e8a){logger[_0x71c6('0x26')](_0x828e8a[_0x71c6('0x27')]);if(_0x828e8a[_0x71c6('0x28')]){delete _0x828e8a['name'];}_0x4ec5be[_0x71c6('0x17')](_0x47b02a)[_0x71c6('0x29')](_0x828e8a);};}exports[_0x71c6('0x2a')]=function(_0x4194e8,_0x2dd16c){var _0x4a6e91={},_0x94134={},_0x11d653={'count':0x0,'rows':[]};var _0x186fbb=_[_0x71c6('0x2b')](db[_0x71c6('0x2c')][_0x71c6('0x2d')],function(_0x1690c2){return{'name':_0x1690c2[_0x71c6('0x2e')],'type':_0x1690c2[_0x71c6('0x2f')]['key']};});_0x94134[_0x71c6('0x30')]=_[_0x71c6('0x2b')](_0x186fbb,_0x71c6('0x28'));_0x94134[_0x71c6('0x31')]=_[_0x71c6('0x32')](_0x4194e8[_0x71c6('0x31')]);_0x94134[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x94134[_0x71c6('0x30')],_0x94134[_0x71c6('0x31')]);_0x4a6e91[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x94134[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x4194e8[_0x71c6('0x31')]['fields']));_0x4a6e91[_0x71c6('0x35')]=_0x4a6e91[_0x71c6('0x35')]['length']?_0x4a6e91[_0x71c6('0x35')]:_0x94134[_0x71c6('0x30')];if(!_0x4194e8[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x4a6e91['limit']=qs[_0x71c6('0x1c')](_0x4194e8[_0x71c6('0x31')][_0x71c6('0x1c')]);_0x4a6e91['offset']=qs[_0x71c6('0x1a')](_0x4194e8[_0x71c6('0x31')]['offset']);}_0x4a6e91['order']=qs[_0x71c6('0x39')](_0x4194e8[_0x71c6('0x31')][_0x71c6('0x39')]);_0x4a6e91['where']=qs[_0x71c6('0x33')](_[_0x71c6('0x3a')](_0x4194e8[_0x71c6('0x31')],_0x94134[_0x71c6('0x33')]),_0x186fbb);if(_0x4194e8[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x4a6e91[_0x71c6('0x3c')]=_['merge'](_0x4a6e91[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x186fbb,function(_0x2f11f9){if(_0x2f11f9['type']!==_0x71c6('0x3d')){var _0x5bd77e={};_0x5bd77e[_0x2f11f9[_0x71c6('0x28')]]={'$like':'%'+_0x4194e8[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x5bd77e;}})});}_0x4a6e91=_[_0x71c6('0x3e')]({},_0x4a6e91,_0x4194e8['options']);var _0x3676f7={'where':_0x4a6e91[_0x71c6('0x3c')]};return db[_0x71c6('0x2c')][_0x71c6('0x1d')](_0x3676f7)[_0x71c6('0x24')](function(_0x41288e){_0x11d653[_0x71c6('0x1d')]=_0x41288e;if(_0x4194e8['query'][_0x71c6('0x3f')]){_0x4a6e91[_0x71c6('0x40')]=[{'all':!![]}];}return db[_0x71c6('0x2c')][_0x71c6('0x41')](_0x4a6e91);})['then'](function(_0x298a02){_0x11d653[_0x71c6('0x42')]=_0x298a02;return _0x11d653;})[_0x71c6('0x24')](respondWithFilteredResult(_0x2dd16c,_0x4a6e91))['catch'](handleError(_0x2dd16c,null));};exports[_0x71c6('0x43')]=function(_0x4b0c75,_0x241182){var _0x30d9f8={'raw':![],'where':{'id':_0x4b0c75[_0x71c6('0x44')]['id']}},_0x2e036c={};_0x2e036c[_0x71c6('0x30')]=_[_0x71c6('0x32')](db['ZohoConfiguration'][_0x71c6('0x2d')]);_0x2e036c['query']=_['keys'](_0x4b0c75[_0x71c6('0x31')]);_0x2e036c[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x2e036c['model'],_0x2e036c[_0x71c6('0x31')]);_0x30d9f8[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x2e036c[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x4b0c75[_0x71c6('0x31')]['fields']));_0x30d9f8[_0x71c6('0x35')]=_0x30d9f8['attributes']['length']?_0x30d9f8['attributes']:_0x2e036c['model'];if(_0x4b0c75['query'][_0x71c6('0x3f')]){_0x30d9f8[_0x71c6('0x40')]=[{'all':!![]}];}_0x30d9f8=_[_0x71c6('0x3e')]({},_0x30d9f8,_0x4b0c75[_0x71c6('0x45')]);return db[_0x71c6('0x2c')][_0x71c6('0x46')](_0x30d9f8)[_0x71c6('0x24')](handleEntityNotFound(_0x241182,null))[_0x71c6('0x24')](respondWithResult(_0x241182,null))[_0x71c6('0x47')](handleError(_0x241182,null));};exports[_0x71c6('0x48')]=function(_0x1a3a76,_0x245175){return db[_0x71c6('0x2c')]['create'](_0x1a3a76[_0x71c6('0x49')],{})['then'](respondWithResult(_0x245175,0xc9))['catch'](handleError(_0x245175,null));};exports['update']=function(_0x100e47,_0x1c35c7){if(_0x100e47[_0x71c6('0x49')]['id']){delete _0x100e47[_0x71c6('0x49')]['id'];}return db[_0x71c6('0x2c')][_0x71c6('0x46')]({'where':{'id':_0x100e47[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x1c35c7,null))[_0x71c6('0x24')](saveUpdates(_0x100e47['body'],null))[_0x71c6('0x24')](respondWithResult(_0x1c35c7,null))['catch'](handleError(_0x1c35c7,null));};exports[_0x71c6('0x25')]=function(_0x8ed347,_0x5431c4){return db[_0x71c6('0x2c')][_0x71c6('0x46')]({'where':{'id':_0x8ed347[_0x71c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5431c4,null))[_0x71c6('0x24')](removeEntity(_0x5431c4,null))['catch'](handleError(_0x5431c4,null));};exports[_0x71c6('0x4a')]=function(_0x540f85,_0x44e05c,_0x4db2fd){var _0x124a9e={};var _0x220cd2={};var _0x4c0938;var _0x185858;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x540f85[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x44e05c,null))[_0x71c6('0x24')](function(_0x3fbfba){if(_0x3fbfba){_0x4c0938=_0x3fbfba;_0x220cd2[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')]['rawAttributes']);_0x220cd2[_0x71c6('0x31')]=_[_0x71c6('0x32')](_0x540f85['query']);_0x220cd2['filters']=_[_0x71c6('0x34')](_0x220cd2[_0x71c6('0x30')],_0x220cd2[_0x71c6('0x31')]);_0x124a9e[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x220cd2[_0x71c6('0x30')],qs[_0x71c6('0x36')](_0x540f85['query'][_0x71c6('0x36')]));_0x124a9e[_0x71c6('0x35')]=_0x124a9e[_0x71c6('0x35')][_0x71c6('0x4d')]?_0x124a9e['attributes']:_0x220cd2[_0x71c6('0x30')];_0x124a9e[_0x71c6('0x4e')]=qs[_0x71c6('0x39')](_0x540f85[_0x71c6('0x31')]['sort']);_0x124a9e[_0x71c6('0x3c')]=qs['filters'](_[_0x71c6('0x3a')](_0x540f85[_0x71c6('0x31')],_0x220cd2[_0x71c6('0x33')]));if(_0x540f85[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x124a9e[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x124a9e[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x124a9e[_0x71c6('0x35')],function(_0x1f6ed0){var _0x33f3c9={};_0x33f3c9[_0x1f6ed0]={'$like':'%'+_0x540f85[_0x71c6('0x31')]['filter']+'%'};return _0x33f3c9;})});}_0x124a9e=_['merge']({},_0x124a9e,_0x540f85[_0x71c6('0x45')]);return _0x4c0938['getFields'](_0x124a9e);}})[_0x71c6('0x24')](function(_0x314c2c){if(_0x314c2c){_0x185858=_0x314c2c['length'];if(!_0x540f85[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x124a9e['limit']=qs['limit'](_0x540f85[_0x71c6('0x31')][_0x71c6('0x1c')]);_0x124a9e['offset']=qs[_0x71c6('0x1a')](_0x540f85[_0x71c6('0x31')]['offset']);}return _0x4c0938[_0x71c6('0x4a')](_0x124a9e);}})[_0x71c6('0x24')](function(_0x55f402){if(_0x55f402){return _0x55f402?{'count':_0x185858,'rows':_0x55f402}:null;}})[_0x71c6('0x24')](respondWithResult(_0x44e05c,null))[_0x71c6('0x47')](handleError(_0x44e05c,null));};exports[_0x71c6('0x4f')]=function(_0x5ac285,_0x5df839,_0x1f7239){var _0x14b821={};var _0x1230c6={};var _0x317ee4;var _0xe34fea;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x5ac285[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x5df839,null))[_0x71c6('0x24')](function(_0x4c1bc2){if(_0x4c1bc2){_0x317ee4=_0x4c1bc2;_0x1230c6[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')]['rawAttributes']);_0x1230c6['query']=_[_0x71c6('0x32')](_0x5ac285[_0x71c6('0x31')]);_0x1230c6[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x1230c6['model'],_0x1230c6[_0x71c6('0x31')]);_0x14b821['attributes']=_[_0x71c6('0x34')](_0x1230c6['model'],qs[_0x71c6('0x36')](_0x5ac285[_0x71c6('0x31')]['fields']));_0x14b821[_0x71c6('0x35')]=_0x14b821['attributes']['length']?_0x14b821[_0x71c6('0x35')]:_0x1230c6[_0x71c6('0x30')];_0x14b821[_0x71c6('0x4e')]=qs[_0x71c6('0x39')](_0x5ac285['query']['sort']);_0x14b821[_0x71c6('0x3c')]=qs['filters'](_[_0x71c6('0x3a')](_0x5ac285[_0x71c6('0x31')],_0x1230c6[_0x71c6('0x33')]));if(_0x5ac285[_0x71c6('0x31')]['filter']){_0x14b821[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x14b821['where'],{'$or':_[_0x71c6('0x2b')](_0x14b821[_0x71c6('0x35')],function(_0x250fc2){var _0x5e5136={};_0x5e5136[_0x250fc2]={'$like':'%'+_0x5ac285[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x5e5136;})});}_0x14b821=_[_0x71c6('0x3e')]({},_0x14b821,_0x5ac285[_0x71c6('0x45')]);return _0x317ee4[_0x71c6('0x4f')](_0x14b821);}})[_0x71c6('0x24')](function(_0x54be24){if(_0x54be24){_0xe34fea=_0x54be24[_0x71c6('0x4d')];if(!_0x5ac285[_0x71c6('0x31')][_0x71c6('0x37')](_0x71c6('0x38'))){_0x14b821[_0x71c6('0x1c')]=qs['limit'](_0x5ac285[_0x71c6('0x31')]['limit']);_0x14b821[_0x71c6('0x1a')]=qs['offset'](_0x5ac285[_0x71c6('0x31')][_0x71c6('0x1a')]);}return _0x317ee4[_0x71c6('0x4f')](_0x14b821);}})['then'](function(_0x369e15){if(_0x369e15){return _0x369e15?{'count':_0xe34fea,'rows':_0x369e15}:null;}})['then'](respondWithResult(_0x5df839,null))[_0x71c6('0x47')](handleError(_0x5df839,null));};exports[_0x71c6('0x50')]=function(_0x162b48,_0x4038d8,_0x8b018e){var _0x4d71e3={};var _0x414765={};var _0x256ab2;var _0x59217d;return db[_0x71c6('0x2c')][_0x71c6('0x4b')]({'where':{'id':_0x162b48[_0x71c6('0x44')]['id']}})[_0x71c6('0x24')](handleEntityNotFound(_0x4038d8,null))[_0x71c6('0x24')](function(_0x1d4933){if(_0x1d4933){_0x256ab2=_0x1d4933;_0x414765[_0x71c6('0x30')]=_[_0x71c6('0x32')](db[_0x71c6('0x4c')][_0x71c6('0x2d')]);_0x414765[_0x71c6('0x31')]=_['keys'](_0x162b48['query']);_0x414765[_0x71c6('0x33')]=_[_0x71c6('0x34')](_0x414765[_0x71c6('0x30')],_0x414765[_0x71c6('0x31')]);_0x4d71e3[_0x71c6('0x35')]=_[_0x71c6('0x34')](_0x414765['model'],qs[_0x71c6('0x36')](_0x162b48[_0x71c6('0x31')][_0x71c6('0x36')]));_0x4d71e3[_0x71c6('0x35')]=_0x4d71e3[_0x71c6('0x35')][_0x71c6('0x4d')]?_0x4d71e3[_0x71c6('0x35')]:_0x414765[_0x71c6('0x30')];_0x4d71e3[_0x71c6('0x4e')]=qs['sort'](_0x162b48[_0x71c6('0x31')][_0x71c6('0x39')]);_0x4d71e3[_0x71c6('0x3c')]=qs[_0x71c6('0x33')](_[_0x71c6('0x3a')](_0x162b48[_0x71c6('0x31')],_0x414765['filters']));if(_0x162b48[_0x71c6('0x31')][_0x71c6('0x3b')]){_0x4d71e3[_0x71c6('0x3c')]=_[_0x71c6('0x3e')](_0x4d71e3[_0x71c6('0x3c')],{'$or':_[_0x71c6('0x2b')](_0x4d71e3[_0x71c6('0x35')],function(_0x58cb73){var _0x3e6bde={};_0x3e6bde[_0x58cb73]={'$like':'%'+_0x162b48[_0x71c6('0x31')][_0x71c6('0x3b')]+'%'};return _0x3e6bde;})});}_0x4d71e3=_[_0x71c6('0x3e')]({},_0x4d71e3,_0x162b48['options']);return _0x256ab2[_0x71c6('0x50')](_0x4d71e3);}})[_0x71c6('0x24')](function(_0x35524d){if(_0x35524d){_0x59217d=_0x35524d[_0x71c6('0x4d')];if(!_0x162b48[_0x71c6('0x31')]['hasOwnProperty'](_0x71c6('0x38'))){_0x4d71e3['limit']=qs[_0x71c6('0x1c')](_0x162b48['query'][_0x71c6('0x1c')]);_0x4d71e3[_0x71c6('0x1a')]=qs[_0x71c6('0x1a')](_0x162b48['query'][_0x71c6('0x1a')]);}return _0x256ab2[_0x71c6('0x50')](_0x4d71e3);}})[_0x71c6('0x24')](function(_0x25c1b8){if(_0x25c1b8){return _0x25c1b8?{'count':_0x59217d,'rows':_0x25c1b8}:null;}})[_0x71c6('0x24')](respondWithResult(_0x4038d8,null))[_0x71c6('0x47')](handleError(_0x4038d8,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fec9ae2..b29f12a 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 _0x51f1=['../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api'];(function(_0x56889e,_0x27460d){var _0x305ecb=function(_0x198b91){while(--_0x198b91){_0x56889e['push'](_0x56889e['shift']());}};_0x305ecb(++_0x27460d);}(_0x51f1,0xd5));var _0x151f=function(_0x191c34,_0x1fa270){_0x191c34=_0x191c34-0x0;var _0x43433b=_0x51f1[_0x191c34];return _0x43433b;};'use strict';var _=require('lodash');var util=require(_0x151f('0x0'));var logger=require(_0x151f('0x1'))(_0x151f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x151f('0x3'));var attributes=require(_0x151f('0x4'));module[_0x151f('0x5')]=function(_0x72ed2a,_0x164d53){return _0x72ed2a[_0x151f('0x6')](_0x151f('0x7'),attributes,{'tableName':_0x151f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95bb=['define','ZohoConfiguration','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x95bb,0x1e2));var _0xb95b=function(_0xed316,_0x26157a){_0xed316=_0xed316-0x0;var _0x4443a0=_0x95bb[_0xed316];return _0x4443a0;};'use strict';var _=require(_0xb95b('0x0'));var util=require('util');var logger=require(_0xb95b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb95b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb95b('0x3'));var rimraf=require(_0xb95b('0x4'));var config=require(_0xb95b('0x5'));var attributes=require(_0xb95b('0x6'));module[_0xb95b('0x7')]=function(_0x1b06ac,_0x4c9502){return _0x1b06ac[_0xb95b('0x8')](_0xb95b('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 683442f..e13b3cf 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 _0x97bc=['../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5085d2,_0x13cf3f){var _0x188925=function(_0x4a1233){while(--_0x4a1233){_0x5085d2['push'](_0x5085d2['shift']());}};_0x188925(++_0x13cf3f);}(_0x97bc,0xf2));var _0xc97b=function(_0x30ad87,_0x24c92d){_0x30ad87=_0x30ad87-0x0;var _0x3570fd=_0x97bc[_0x30ad87];return _0x3570fd;};'use strict';var _=require(_0xc97b('0x0'));var util=require(_0xc97b('0x1'));var moment=require(_0xc97b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc97b('0x3'));var fs=require('fs');var Redis=require(_0xc97b('0x4'));var db=require(_0xc97b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc97b('0x6'))(_0xc97b('0x7'));var config=require(_0xc97b('0x8'));var jayson=require(_0xc97b('0x9'));var client=jayson[_0xc97b('0xa')][_0xc97b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13202c,_0x379571,_0x3629e8){return new BPromise(function(_0x74a993,_0x444ab9){return client[_0xc97b('0xc')](_0x13202c,_0x3629e8)[_0xc97b('0xd')](function(_0x9d62c1){logger['info'](_0xc97b('0xe'),_0x379571,_0xc97b('0xf'));logger[_0xc97b('0x10')](_0xc97b('0x11'),_0x379571,_0xc97b('0xf'),JSON[_0xc97b('0x12')](_0x9d62c1));if(_0x9d62c1['error']){if(_0x9d62c1['error'][_0xc97b('0x13')]===0x1f4){logger[_0xc97b('0x14')](_0xc97b('0xe'),_0x379571,_0x9d62c1[_0xc97b('0x14')]['message']);return _0x444ab9(_0x9d62c1[_0xc97b('0x14')][_0xc97b('0x15')]);}logger[_0xc97b('0x14')](_0xc97b('0xe'),_0x379571,_0x9d62c1[_0xc97b('0x14')][_0xc97b('0x15')]);return _0x74a993(_0x9d62c1['error'][_0xc97b('0x15')]);}else{logger[_0xc97b('0x16')](_0xc97b('0xe'),_0x379571,_0xc97b('0xf'));_0x74a993(_0x9d62c1[_0xc97b('0x17')]['message']);}})[_0xc97b('0x18')](function(_0x30eb4c){logger[_0xc97b('0x14')](_0xc97b('0xe'),_0x379571,_0x30eb4c);_0x444ab9(_0x30eb4c);});});} \ No newline at end of file +var _0x89b9=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0xe070c5,_0x22f26a){var _0x7bcda2=function(_0x21a991){while(--_0x21a991){_0xe070c5['push'](_0xe070c5['shift']());}};_0x7bcda2(++_0x22f26a);}(_0x89b9,0x127));var _0x989b=function(_0x225795,_0x5f2c5e){_0x225795=_0x225795-0x0;var _0x1da0ea=_0x89b9[_0x225795];return _0x1da0ea;};'use strict';var _=require(_0x989b('0x0'));var util=require(_0x989b('0x1'));var moment=require('moment');var BPromise=require(_0x989b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x989b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x989b('0x4'))(_0x989b('0x5'));var config=require(_0x989b('0x6'));var jayson=require(_0x989b('0x7'));var client=jayson[_0x989b('0x8')][_0x989b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a554,_0x25740e,_0x1fcfcb){return new BPromise(function(_0x1890e4,_0x180907){return client[_0x989b('0xa')](_0x57a554,_0x1fcfcb)['then'](function(_0x556ea5){logger[_0x989b('0xb')](_0x989b('0xc'),_0x25740e,_0x989b('0xd'));logger[_0x989b('0xe')](_0x989b('0xf'),_0x25740e,'request\x20sent',JSON[_0x989b('0x10')](_0x556ea5));if(_0x556ea5[_0x989b('0x11')]){if(_0x556ea5[_0x989b('0x11')][_0x989b('0x12')]===0x1f4){logger['error'](_0x989b('0xc'),_0x25740e,_0x556ea5[_0x989b('0x11')][_0x989b('0x13')]);return _0x180907(_0x556ea5[_0x989b('0x11')]['message']);}logger[_0x989b('0x11')](_0x989b('0xc'),_0x25740e,_0x556ea5['error'][_0x989b('0x13')]);return _0x1890e4(_0x556ea5[_0x989b('0x11')][_0x989b('0x13')]);}else{logger[_0x989b('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x25740e,'request\x20sent');_0x1890e4(_0x556ea5[_0x989b('0x14')][_0x989b('0x13')]);}})[_0x989b('0x15')](function(_0x233349){logger[_0x989b('0x11')](_0x989b('0xc'),_0x25740e,_0x233349);_0x180907(_0x233349);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8196637..942680d 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 _0x7a4a=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7a4a,0x93));var _0xa7a4=function(_0x33d239,_0x24bb87){_0x33d239=_0x33d239-0x0;var _0x6784c2=_0x7a4a[_0x33d239];return _0x6784c2;};'use strict';var multer=require(_0xa7a4('0x0'));var util=require(_0xa7a4('0x1'));var path=require(_0xa7a4('0x2'));var timeout=require(_0xa7a4('0x3'));var express=require(_0xa7a4('0x4'));var router=express[_0xa7a4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa7a4('0x6'));var config=require(_0xa7a4('0x7'));var controller=require(_0xa7a4('0x8'));router[_0xa7a4('0x9')]('/',auth[_0xa7a4('0xa')](),controller['index']);router['get'](_0xa7a4('0xb'),auth[_0xa7a4('0xa')](),controller[_0xa7a4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa7a4('0xd')]);router['put'](_0xa7a4('0xb'),auth[_0xa7a4('0xa')](),controller[_0xa7a4('0xe')]);router['delete'](_0xa7a4('0xb'),auth[_0xa7a4('0xa')](),controller[_0xa7a4('0xf')]);module[_0xa7a4('0x10')]=router; \ No newline at end of file +var _0xbfa3=['put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xbfa3,0xdd));var _0x3bfa=function(_0x5c17e6,_0x24949c){_0x5c17e6=_0x5c17e6-0x0;var _0x16a6b1=_0xbfa3[_0x5c17e6];return _0x16a6b1;};'use strict';var multer=require(_0x3bfa('0x0'));var util=require(_0x3bfa('0x1'));var path=require(_0x3bfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3bfa('0x3')]();var fs_extra=require(_0x3bfa('0x4'));var auth=require(_0x3bfa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x3bfa('0x6')]('/',auth['isAuthenticated'](),controller[_0x3bfa('0x7')]);router[_0x3bfa('0x6')](_0x3bfa('0x8'),auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xa')]);router[_0x3bfa('0xb')]('/',auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xc')]);router[_0x3bfa('0xd')](_0x3bfa('0x8'),auth[_0x3bfa('0x9')](),controller[_0x3bfa('0xe')]);router[_0x3bfa('0xf')](_0x3bfa('0x8'),auth['isAuthenticated'](),controller[_0x3bfa('0x10')]);module[_0x3bfa('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f03e582..de36bfa 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 _0x3897=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x44ac04,_0xddf3a9){var _0x3b5276=function(_0x144e46){while(--_0x144e46){_0x44ac04['push'](_0x44ac04['shift']());}};_0x3b5276(++_0xddf3a9);}(_0x3897,0x92));var _0x7389=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x3897[_0x587ba2];return _0x50ec73;};'use strict';var Sequelize=require('sequelize');module[_0x7389('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7389('0x1'),_0x7389('0x2'),_0x7389('0x3'),_0x7389('0x4'),_0x7389('0x5')),'defaultValue':_0x7389('0x1')},'content':{'type':Sequelize[_0x7389('0x6')]},'key':{'type':Sequelize[_0x7389('0x6')]},'keyType':{'type':Sequelize[_0x7389('0x7')](_0x7389('0x1'),'variable',_0x7389('0x3'))},'keyContent':{'type':Sequelize[_0x7389('0x6')]},'idField':{'type':Sequelize[_0x7389('0x6')]},'nameField':{'type':Sequelize[_0x7389('0x6')]},'customField':{'type':Sequelize[_0x7389('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7389('0x6')]}}; \ No newline at end of file +var _0x8652=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','string','variable','keyValue'];(function(_0x6e2a47,_0x10b0db){var _0x43fd8b=function(_0x17b068){while(--_0x17b068){_0x6e2a47['push'](_0x6e2a47['shift']());}};_0x43fd8b(++_0x10b0db);}(_0x8652,0x190));var _0x2865=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x8652[_0x2a7c2a];return _0x195732;};'use strict';var Sequelize=require(_0x2865('0x0'));module[_0x2865('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2865('0x2'),_0x2865('0x3'),'customVariable',_0x2865('0x4'),_0x2865('0x5')),'defaultValue':_0x2865('0x2')},'content':{'type':Sequelize[_0x2865('0x6')]},'key':{'type':Sequelize[_0x2865('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2865('0x2'),_0x2865('0x3'),_0x2865('0x7'))},'keyContent':{'type':Sequelize[_0x2865('0x6')]},'idField':{'type':Sequelize[_0x2865('0x6')]},'nameField':{'type':Sequelize[_0x2865('0x6')]},'customField':{'type':Sequelize[_0x2865('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2865('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8052802..a6e15e1 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 _0xeec0=['findAll','rows','catch','params','intersection','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xeec0,0x98));var _0x0eec=function(_0x43d301,_0x1d723c){_0x43d301=_0x43d301-0x0;var _0x12a4b3=_0xeec0[_0x43d301];return _0x12a4b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0eec('0x0'));var zipdir=require(_0x0eec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0eec('0x2'));var BPromise=require(_0x0eec('0x3'));var Mustache=require(_0x0eec('0x4'));var util=require(_0x0eec('0x5'));var path=require(_0x0eec('0x6'));var sox=require('sox');var csv=require(_0x0eec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0eec('0x8'));var _=require(_0x0eec('0x9'));var squel=require(_0x0eec('0xa'));var crypto=require(_0x0eec('0xb'));var jsforce=require(_0x0eec('0xc'));var deskjs=require(_0x0eec('0xd'));var toCsv=require(_0x0eec('0x7'));var querystring=require(_0x0eec('0xe'));var Papa=require(_0x0eec('0xf'));var Redis=require(_0x0eec('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0eec('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eec('0x12'))(_0x0eec('0x13'));var utils=require(_0x0eec('0x14'));var config=require(_0x0eec('0x15'));var licenseUtil=require(_0x0eec('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207513,_0x6b29a6){_0x6b29a6=_0x6b29a6||0xcc;return function(_0x464661){if(_0x464661){return _0x207513[_0x0eec('0x17')](_0x6b29a6);}return _0x207513['status'](_0x6b29a6)['end']();};}function respondWithResult(_0x5f0d3f,_0x376e02){_0x376e02=_0x376e02||0xc8;return function(_0xb45dbe){if(_0xb45dbe){return _0x5f0d3f[_0x0eec('0x18')](_0x376e02)[_0x0eec('0x19')](_0xb45dbe);}};}function respondWithFilteredResult(_0x1e14bc,_0x5d5b82){return function(_0x33896d){if(_0x33896d){var _0x2f0c16=typeof _0x5d5b82[_0x0eec('0x1a')]===_0x0eec('0x1b')&&typeof _0x5d5b82[_0x0eec('0x1c')]===_0x0eec('0x1b');var _0xed3eca=_0x33896d[_0x0eec('0x1d')];var _0x1712fc=_0x2f0c16?0x0:_0x5d5b82[_0x0eec('0x1a')];var _0x54a481=_0x2f0c16?_0x33896d[_0x0eec('0x1d')]:_0x5d5b82[_0x0eec('0x1a')]+_0x5d5b82[_0x0eec('0x1c')];var _0x56722b;if(_0x54a481>=_0xed3eca){_0x54a481=_0xed3eca;_0x56722b=0xc8;}else{_0x56722b=0xce;}_0x1e14bc[_0x0eec('0x18')](_0x56722b);return _0x1e14bc['set'](_0x0eec('0x1e'),_0x1712fc+'-'+_0x54a481+'/'+_0xed3eca)[_0x0eec('0x19')](_0x33896d);}return null;};}function patchUpdates(_0x130f05){return function(_0xc49c57){try{jsonpatch[_0x0eec('0x1f')](_0xc49c57,_0x130f05,!![]);}catch(_0x38f3f4){return BPromise[_0x0eec('0x20')](_0x38f3f4);}return _0xc49c57[_0x0eec('0x21')]();};}function saveUpdates(_0x155c70,_0x3ae7ed){return function(_0x255b8e){if(_0x255b8e){return _0x255b8e[_0x0eec('0x22')](_0x155c70)[_0x0eec('0x23')](function(_0x22bada){return _0x22bada;});}return null;};}function removeEntity(_0x16d1c0,_0x175e3d){return function(_0x2aa446){if(_0x2aa446){return _0x2aa446[_0x0eec('0x24')]()['then'](function(){_0x16d1c0[_0x0eec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448707,_0x56c82d){return function(_0x133c65){if(!_0x133c65){_0x448707[_0x0eec('0x17')](0x194);}return _0x133c65;};}function handleError(_0x56388d,_0x383d6a){_0x383d6a=_0x383d6a||0x1f4;return function(_0x129f74){logger['error'](_0x129f74['stack']);if(_0x129f74[_0x0eec('0x25')]){delete _0x129f74[_0x0eec('0x25')];}_0x56388d['status'](_0x383d6a)[_0x0eec('0x26')](_0x129f74);};}exports[_0x0eec('0x27')]=function(_0x33f647,_0x31d293){var _0x254da9={},_0x196502={},_0xe47e96={'count':0x0,'rows':[]};var _0x55fc81=_[_0x0eec('0x28')](db[_0x0eec('0x29')][_0x0eec('0x2a')],function(_0x337107){return{'name':_0x337107['fieldName'],'type':_0x337107[_0x0eec('0x2b')][_0x0eec('0x2c')]};});_0x196502['model']=_['map'](_0x55fc81,'name');_0x196502[_0x0eec('0x2d')]=_[_0x0eec('0x2e')](_0x33f647[_0x0eec('0x2d')]);_0x196502[_0x0eec('0x2f')]=_['intersection'](_0x196502['model'],_0x196502[_0x0eec('0x2d')]);_0x254da9[_0x0eec('0x30')]=_['intersection'](_0x196502['model'],qs[_0x0eec('0x31')](_0x33f647[_0x0eec('0x2d')][_0x0eec('0x31')]));_0x254da9[_0x0eec('0x30')]=_0x254da9[_0x0eec('0x30')][_0x0eec('0x32')]?_0x254da9['attributes']:_0x196502[_0x0eec('0x33')];if(!_0x33f647[_0x0eec('0x2d')][_0x0eec('0x34')](_0x0eec('0x35'))){_0x254da9[_0x0eec('0x1c')]=qs[_0x0eec('0x1c')](_0x33f647[_0x0eec('0x2d')]['limit']);_0x254da9[_0x0eec('0x1a')]=qs[_0x0eec('0x1a')](_0x33f647['query'][_0x0eec('0x1a')]);}_0x254da9[_0x0eec('0x36')]=qs[_0x0eec('0x37')](_0x33f647[_0x0eec('0x2d')]['sort']);_0x254da9['where']=qs[_0x0eec('0x2f')](_[_0x0eec('0x38')](_0x33f647['query'],_0x196502[_0x0eec('0x2f')]),_0x55fc81);if(_0x33f647[_0x0eec('0x2d')][_0x0eec('0x39')]){_0x254da9[_0x0eec('0x3a')]=_[_0x0eec('0x3b')](_0x254da9[_0x0eec('0x3a')],{'$or':_[_0x0eec('0x28')](_0x55fc81,function(_0x44ce84){if(_0x44ce84[_0x0eec('0x2b')]!==_0x0eec('0x3c')){var _0x45669={};_0x45669[_0x44ce84[_0x0eec('0x25')]]={'$like':'%'+_0x33f647[_0x0eec('0x2d')]['filter']+'%'};return _0x45669;}})});}_0x254da9=_['merge']({},_0x254da9,_0x33f647[_0x0eec('0x3d')]);var _0x139672={'where':_0x254da9[_0x0eec('0x3a')]};return db[_0x0eec('0x29')]['count'](_0x139672)[_0x0eec('0x23')](function(_0x19128e){_0xe47e96['count']=_0x19128e;if(_0x33f647['query'][_0x0eec('0x3e')]){_0x254da9[_0x0eec('0x3f')]=[{'all':!![]}];}return db[_0x0eec('0x29')][_0x0eec('0x40')](_0x254da9);})['then'](function(_0x26f9eb){_0xe47e96[_0x0eec('0x41')]=_0x26f9eb;return _0xe47e96;})[_0x0eec('0x23')](respondWithFilteredResult(_0x31d293,_0x254da9))[_0x0eec('0x42')](handleError(_0x31d293,null));};exports['show']=function(_0x531737,_0x2dd9be){var _0x51acb1={'raw':!![],'where':{'id':_0x531737[_0x0eec('0x43')]['id']}},_0x1682a9={};_0x1682a9[_0x0eec('0x33')]=_['keys'](db[_0x0eec('0x29')][_0x0eec('0x2a')]);_0x1682a9[_0x0eec('0x2d')]=_[_0x0eec('0x2e')](_0x531737[_0x0eec('0x2d')]);_0x1682a9[_0x0eec('0x2f')]=_[_0x0eec('0x44')](_0x1682a9[_0x0eec('0x33')],_0x1682a9[_0x0eec('0x2d')]);_0x51acb1['attributes']=_[_0x0eec('0x44')](_0x1682a9[_0x0eec('0x33')],qs[_0x0eec('0x31')](_0x531737[_0x0eec('0x2d')][_0x0eec('0x31')]));_0x51acb1[_0x0eec('0x30')]=_0x51acb1['attributes'][_0x0eec('0x32')]?_0x51acb1['attributes']:_0x1682a9[_0x0eec('0x33')];if(_0x531737[_0x0eec('0x2d')][_0x0eec('0x3e')]){_0x51acb1[_0x0eec('0x3f')]=[{'all':!![]}];}_0x51acb1=_[_0x0eec('0x3b')]({},_0x51acb1,_0x531737['options']);return db['ZohoField'][_0x0eec('0x45')](_0x51acb1)['then'](handleEntityNotFound(_0x2dd9be,null))['then'](respondWithResult(_0x2dd9be,null))[_0x0eec('0x42')](handleError(_0x2dd9be,null));};exports[_0x0eec('0x46')]=function(_0x29ebf5,_0x4d1671){return db[_0x0eec('0x29')][_0x0eec('0x46')](_0x29ebf5['body'],{})[_0x0eec('0x23')](respondWithResult(_0x4d1671,0xc9))[_0x0eec('0x42')](handleError(_0x4d1671,null));};exports[_0x0eec('0x22')]=function(_0x45cdc5,_0x26c112){if(_0x45cdc5[_0x0eec('0x47')]['id']){delete _0x45cdc5[_0x0eec('0x47')]['id'];}return db[_0x0eec('0x29')][_0x0eec('0x45')]({'where':{'id':_0x45cdc5['params']['id']}})['then'](handleEntityNotFound(_0x26c112,null))[_0x0eec('0x23')](saveUpdates(_0x45cdc5[_0x0eec('0x47')],null))[_0x0eec('0x23')](respondWithResult(_0x26c112,null))[_0x0eec('0x42')](handleError(_0x26c112,null));};exports['destroy']=function(_0x4e0e49,_0x3620c0){return db[_0x0eec('0x29')][_0x0eec('0x45')]({'where':{'id':_0x4e0e49[_0x0eec('0x43')]['id']}})[_0x0eec('0x23')](handleEntityNotFound(_0x3620c0,null))[_0x0eec('0x23')](removeEntity(_0x3620c0,null))[_0x0eec('0x42')](handleError(_0x3620c0,null));}; \ No newline at end of file +var _0x1c72=['nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','name','filter','ZohoField','includeAll','findAll','catch','show','length','include','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','send','index','map','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x15dd25,_0x480651){var _0x23696f=function(_0x47048c){while(--_0x47048c){_0x15dd25['push'](_0x15dd25['shift']());}};_0x23696f(++_0x480651);}(_0x1c72,0x13f));var _0x21c7=function(_0x592d86,_0x481594){_0x592d86=_0x592d86-0x0;var _0x142038=_0x1c72[_0x592d86];return _0x142038;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21c7('0x0'));var zipdir=require(_0x21c7('0x1'));var jsonpatch=require(_0x21c7('0x2'));var rp=require(_0x21c7('0x3'));var moment=require(_0x21c7('0x4'));var BPromise=require(_0x21c7('0x5'));var Mustache=require(_0x21c7('0x6'));var util=require('util');var path=require(_0x21c7('0x7'));var sox=require(_0x21c7('0x8'));var csv=require(_0x21c7('0x9'));var ejs=require(_0x21c7('0xa'));var fs=require('fs');var fs_extra=require(_0x21c7('0xb'));var _=require(_0x21c7('0xc'));var squel=require('squel');var crypto=require(_0x21c7('0xd'));var jsforce=require(_0x21c7('0xe'));var deskjs=require(_0x21c7('0xf'));var toCsv=require(_0x21c7('0x9'));var querystring=require(_0x21c7('0x10'));var Papa=require(_0x21c7('0x11'));var Redis=require(_0x21c7('0x12'));var authService=require(_0x21c7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21c7('0x14'));var logger=require(_0x21c7('0x15'))(_0x21c7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19b68f,_0x1ca41c){_0x1ca41c=_0x1ca41c||0xcc;return function(_0x56c744){if(_0x56c744){return _0x19b68f[_0x21c7('0x18')](_0x1ca41c);}return _0x19b68f['status'](_0x1ca41c)[_0x21c7('0x19')]();};}function respondWithResult(_0x479057,_0x544f22){_0x544f22=_0x544f22||0xc8;return function(_0x3e6fdf){if(_0x3e6fdf){return _0x479057[_0x21c7('0x1a')](_0x544f22)[_0x21c7('0x1b')](_0x3e6fdf);}};}function respondWithFilteredResult(_0x4ae6a3,_0x5b5b61){return function(_0x649a5b){if(_0x649a5b){var _0x52b21e=typeof _0x5b5b61[_0x21c7('0x1c')]===_0x21c7('0x1d')&&typeof _0x5b5b61[_0x21c7('0x1e')]===_0x21c7('0x1d');var _0x27ddbd=_0x649a5b[_0x21c7('0x1f')];var _0x1f4294=_0x52b21e?0x0:_0x5b5b61[_0x21c7('0x1c')];var _0x4eac31=_0x52b21e?_0x649a5b[_0x21c7('0x1f')]:_0x5b5b61['offset']+_0x5b5b61[_0x21c7('0x1e')];var _0x4facba;if(_0x4eac31>=_0x27ddbd){_0x4eac31=_0x27ddbd;_0x4facba=0xc8;}else{_0x4facba=0xce;}_0x4ae6a3[_0x21c7('0x1a')](_0x4facba);return _0x4ae6a3[_0x21c7('0x20')](_0x21c7('0x21'),_0x1f4294+'-'+_0x4eac31+'/'+_0x27ddbd)[_0x21c7('0x1b')](_0x649a5b);}return null;};}function patchUpdates(_0xd34e56){return function(_0x539750){try{jsonpatch['apply'](_0x539750,_0xd34e56,!![]);}catch(_0x51cc9d){return BPromise[_0x21c7('0x22')](_0x51cc9d);}return _0x539750['save']();};}function saveUpdates(_0x500291,_0x3ef613){return function(_0x219edd){if(_0x219edd){return _0x219edd[_0x21c7('0x23')](_0x500291)[_0x21c7('0x24')](function(_0x5232d7){return _0x5232d7;});}return null;};}function removeEntity(_0x3063e9,_0x5ac87e){return function(_0x1c9410){if(_0x1c9410){return _0x1c9410['destroy']()[_0x21c7('0x24')](function(){_0x3063e9[_0x21c7('0x1a')](0xcc)[_0x21c7('0x19')]();});}};}function handleEntityNotFound(_0x4ee0d6,_0x19158f){return function(_0xd8f859){if(!_0xd8f859){_0x4ee0d6[_0x21c7('0x18')](0x194);}return _0xd8f859;};}function handleError(_0x449f35,_0x2e0b0d){_0x2e0b0d=_0x2e0b0d||0x1f4;return function(_0x4fd770){logger[_0x21c7('0x25')](_0x4fd770[_0x21c7('0x26')]);if(_0x4fd770['name']){delete _0x4fd770['name'];}_0x449f35[_0x21c7('0x1a')](_0x2e0b0d)[_0x21c7('0x27')](_0x4fd770);};}exports[_0x21c7('0x28')]=function(_0xd98426,_0x2b7e9f){var _0x3f4c1a={},_0x2d3122={},_0x414e9e={'count':0x0,'rows':[]};var _0x730cd2=_[_0x21c7('0x29')](db['ZohoField'][_0x21c7('0x2a')],function(_0x484f14){return{'name':_0x484f14[_0x21c7('0x2b')],'type':_0x484f14['type']['key']};});_0x2d3122['model']=_[_0x21c7('0x29')](_0x730cd2,'name');_0x2d3122['query']=_[_0x21c7('0x2c')](_0xd98426[_0x21c7('0x2d')]);_0x2d3122['filters']=_[_0x21c7('0x2e')](_0x2d3122[_0x21c7('0x2f')],_0x2d3122['query']);_0x3f4c1a[_0x21c7('0x30')]=_[_0x21c7('0x2e')](_0x2d3122[_0x21c7('0x2f')],qs['fields'](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x31')]));_0x3f4c1a[_0x21c7('0x30')]=_0x3f4c1a[_0x21c7('0x30')]['length']?_0x3f4c1a[_0x21c7('0x30')]:_0x2d3122[_0x21c7('0x2f')];if(!_0xd98426[_0x21c7('0x2d')][_0x21c7('0x32')](_0x21c7('0x33'))){_0x3f4c1a[_0x21c7('0x1e')]=qs[_0x21c7('0x1e')](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x1e')]);_0x3f4c1a[_0x21c7('0x1c')]=qs[_0x21c7('0x1c')](_0xd98426[_0x21c7('0x2d')][_0x21c7('0x1c')]);}_0x3f4c1a[_0x21c7('0x34')]=qs['sort'](_0xd98426['query'][_0x21c7('0x35')]);_0x3f4c1a['where']=qs[_0x21c7('0x36')](_[_0x21c7('0x37')](_0xd98426['query'],_0x2d3122[_0x21c7('0x36')]),_0x730cd2);if(_0xd98426[_0x21c7('0x2d')]['filter']){_0x3f4c1a[_0x21c7('0x38')]=_[_0x21c7('0x39')](_0x3f4c1a[_0x21c7('0x38')],{'$or':_[_0x21c7('0x29')](_0x730cd2,function(_0x273b53){if(_0x273b53[_0x21c7('0x3a')]!==_0x21c7('0x3b')){var _0xc5d839={};_0xc5d839[_0x273b53[_0x21c7('0x3c')]]={'$like':'%'+_0xd98426[_0x21c7('0x2d')][_0x21c7('0x3d')]+'%'};return _0xc5d839;}})});}_0x3f4c1a=_[_0x21c7('0x39')]({},_0x3f4c1a,_0xd98426['options']);var _0x48c1cf={'where':_0x3f4c1a[_0x21c7('0x38')]};return db[_0x21c7('0x3e')][_0x21c7('0x1f')](_0x48c1cf)['then'](function(_0x44fb2d){_0x414e9e[_0x21c7('0x1f')]=_0x44fb2d;if(_0xd98426[_0x21c7('0x2d')][_0x21c7('0x3f')]){_0x3f4c1a['include']=[{'all':!![]}];}return db[_0x21c7('0x3e')][_0x21c7('0x40')](_0x3f4c1a);})['then'](function(_0xbb5f26){_0x414e9e['rows']=_0xbb5f26;return _0x414e9e;})[_0x21c7('0x24')](respondWithFilteredResult(_0x2b7e9f,_0x3f4c1a))[_0x21c7('0x41')](handleError(_0x2b7e9f,null));};exports[_0x21c7('0x42')]=function(_0x7d7d15,_0x383f03){var _0x10c468={'raw':!![],'where':{'id':_0x7d7d15['params']['id']}},_0x542423={};_0x542423['model']=_[_0x21c7('0x2c')](db[_0x21c7('0x3e')][_0x21c7('0x2a')]);_0x542423[_0x21c7('0x2d')]=_['keys'](_0x7d7d15['query']);_0x542423[_0x21c7('0x36')]=_[_0x21c7('0x2e')](_0x542423[_0x21c7('0x2f')],_0x542423[_0x21c7('0x2d')]);_0x10c468[_0x21c7('0x30')]=_['intersection'](_0x542423['model'],qs[_0x21c7('0x31')](_0x7d7d15[_0x21c7('0x2d')][_0x21c7('0x31')]));_0x10c468[_0x21c7('0x30')]=_0x10c468[_0x21c7('0x30')][_0x21c7('0x43')]?_0x10c468['attributes']:_0x542423[_0x21c7('0x2f')];if(_0x7d7d15[_0x21c7('0x2d')][_0x21c7('0x3f')]){_0x10c468[_0x21c7('0x44')]=[{'all':!![]}];}_0x10c468=_[_0x21c7('0x39')]({},_0x10c468,_0x7d7d15[_0x21c7('0x45')]);return db[_0x21c7('0x3e')][_0x21c7('0x46')](_0x10c468)[_0x21c7('0x24')](handleEntityNotFound(_0x383f03,null))['then'](respondWithResult(_0x383f03,null))[_0x21c7('0x41')](handleError(_0x383f03,null));};exports['create']=function(_0x4ae190,_0x42fbb6){return db['ZohoField'][_0x21c7('0x47')](_0x4ae190[_0x21c7('0x48')],{})['then'](respondWithResult(_0x42fbb6,0xc9))[_0x21c7('0x41')](handleError(_0x42fbb6,null));};exports['update']=function(_0x59f789,_0x23db7e){if(_0x59f789[_0x21c7('0x48')]['id']){delete _0x59f789[_0x21c7('0x48')]['id'];}return db[_0x21c7('0x3e')]['find']({'where':{'id':_0x59f789[_0x21c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x23db7e,null))['then'](saveUpdates(_0x59f789[_0x21c7('0x48')],null))[_0x21c7('0x24')](respondWithResult(_0x23db7e,null))[_0x21c7('0x41')](handleError(_0x23db7e,null));};exports['destroy']=function(_0x5ba0ee,_0xe41fd2){return db['ZohoField'][_0x21c7('0x46')]({'where':{'id':_0x5ba0ee['params']['id']}})['then'](handleEntityNotFound(_0xe41fd2,null))[_0x21c7('0x24')](removeEntity(_0xe41fd2,null))[_0x21c7('0x41')](handleError(_0xe41fd2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b66c6a3..9d6c4bd 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 _0xb091=['./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xb091,0x16e));var _0x1b09=function(_0x2475f9,_0x30c7d4){_0x2475f9=_0x2475f9-0x0;var _0x434c5c=_0xb091[_0x2475f9];return _0x434c5c;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('ZohoField',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[{'name':_0x1b09('0x9'),'fields':[_0x1b09('0xa'),_0x1b09('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d04=['request-promise','path','../../config/environment','./intZohoField.attributes','exports','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5e822c,_0x5e49c6){var _0x192b6a=function(_0x3ff943){while(--_0x3ff943){_0x5e822c['push'](_0x5e822c['shift']());}};_0x192b6a(++_0x5e49c6);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x43d0('0xb'),'fields':[_0x43d0('0xc'),_0x43d0('0xd')],'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 3d3f9ce..f0e3db1 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 _0xaff8=['jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xaff8,0x1db));var _0x8aff=function(_0x126c0d,_0x1644a5){_0x126c0d=_0x126c0d-0x0;var _0x299c58=_0xaff8[_0x126c0d];return _0x299c58;};'use strict';var _=require('lodash');var util=require(_0x8aff('0x0'));var moment=require(_0x8aff('0x1'));var BPromise=require('bluebird');var rs=require(_0x8aff('0x2'));var fs=require('fs');var Redis=require(_0x8aff('0x3'));var db=require(_0x8aff('0x4'))['db'];var utils=require(_0x8aff('0x5'));var logger=require(_0x8aff('0x6'))('rpc');var config=require(_0x8aff('0x7'));var jayson=require(_0x8aff('0x8'));var client=jayson[_0x8aff('0x9')][_0x8aff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e1414,_0xf24c0c,_0xe2aaa4){return new BPromise(function(_0x1c901c,_0x12f40a){return client[_0x8aff('0xb')](_0x2e1414,_0xe2aaa4)['then'](function(_0x3e2601){logger[_0x8aff('0xc')](_0x8aff('0xd'),_0xf24c0c,_0x8aff('0xe'));logger[_0x8aff('0xf')](_0x8aff('0x10'),_0xf24c0c,_0x8aff('0xe'),JSON[_0x8aff('0x11')](_0x3e2601));if(_0x3e2601['error']){if(_0x3e2601[_0x8aff('0x12')][_0x8aff('0x13')]===0x1f4){logger[_0x8aff('0x12')](_0x8aff('0xd'),_0xf24c0c,_0x3e2601[_0x8aff('0x12')][_0x8aff('0x14')]);return _0x12f40a(_0x3e2601['error'][_0x8aff('0x14')]);}logger[_0x8aff('0x12')](_0x8aff('0xd'),_0xf24c0c,_0x3e2601[_0x8aff('0x12')][_0x8aff('0x14')]);return _0x1c901c(_0x3e2601[_0x8aff('0x12')][_0x8aff('0x14')]);}else{logger[_0x8aff('0xc')]('ZohoField,\x20%s,\x20%s',_0xf24c0c,_0x8aff('0xe'));_0x1c901c(_0x3e2601[_0x8aff('0x15')][_0x8aff('0x14')]);}})[_0x8aff('0x16')](function(_0x361291){logger[_0x8aff('0x12')](_0x8aff('0xd'),_0xf24c0c,_0x361291);_0x12f40a(_0x361291);});});} \ No newline at end of file +var _0x4941=['http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2d5550,_0x3ecc31){var _0x5b4917=function(_0x2a62a8){while(--_0x2a62a8){_0x2d5550['push'](_0x2d5550['shift']());}};_0x5b4917(++_0x3ecc31);}(_0x4941,0x79));var _0x1494=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x4941[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0x1494('0x0'));var util=require(_0x1494('0x1'));var moment=require(_0x1494('0x2'));var BPromise=require(_0x1494('0x3'));var rs=require(_0x1494('0x4'));var fs=require('fs');var Redis=require(_0x1494('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1494('0x6'))(_0x1494('0x7'));var config=require(_0x1494('0x8'));var jayson=require(_0x1494('0x9'));var client=jayson[_0x1494('0xa')][_0x1494('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x501d35,_0x26712e,_0x44ba91){return new BPromise(function(_0x174974,_0x2af55e){return client[_0x1494('0xc')](_0x501d35,_0x44ba91)['then'](function(_0x5f9409){logger[_0x1494('0xd')](_0x1494('0xe'),_0x26712e,_0x1494('0xf'));logger[_0x1494('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x26712e,_0x1494('0xf'),JSON[_0x1494('0x11')](_0x5f9409));if(_0x5f9409[_0x1494('0x12')]){if(_0x5f9409[_0x1494('0x12')][_0x1494('0x13')]===0x1f4){logger[_0x1494('0x12')]('ZohoField,\x20%s,\x20%s',_0x26712e,_0x5f9409['error'][_0x1494('0x14')]);return _0x2af55e(_0x5f9409['error'][_0x1494('0x14')]);}logger[_0x1494('0x12')](_0x1494('0xe'),_0x26712e,_0x5f9409[_0x1494('0x12')]['message']);return _0x174974(_0x5f9409[_0x1494('0x12')]['message']);}else{logger['info'](_0x1494('0xe'),_0x26712e,_0x1494('0xf'));_0x174974(_0x5f9409[_0x1494('0x15')][_0x1494('0x14')]);}})['catch'](function(_0x2747f4){logger[_0x1494('0x12')](_0x1494('0xe'),_0x26712e,_0x2747f4);_0x2af55e(_0x2747f4);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5fa1bc7..ece6767 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3ece68,_0x365fb0){var _0x18c9e4=function(_0x37f51c){while(--_0x37f51c){_0x3ece68['push'](_0x3ece68['shift']());}};_0x18c9e4(++_0x365fb0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xcb91[_0x3712e2];return _0x1faff4;};'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 fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x47a604,_0x24755e){var _0x2b2280=function(_0x1996d9){while(--_0x1996d9){_0x47a604['push'](_0x47a604['shift']());}};_0x2b2280(++_0x24755e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 2fd8408..861f5d0 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 _0x100e=['unique_name_and_version','INTEGER','state','exports','STRING'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x100e,0xdf));var _0xe100=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x100e[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require('sequelize');module[_0xe100('0x0')]={'name':{'type':Sequelize[_0xe100('0x1')],'allowNull':![],'unique':_0xe100('0x2')},'version':{'type':Sequelize[_0xe100('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xe100('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xe100('0x1')]},'type':{'type':Sequelize[_0xe100('0x1')]},'size':{'type':Sequelize[_0xe100('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xe100('0x1')]},'logo':{'type':Sequelize[_0xe100('0x1')]},'state':{'type':Sequelize[_0xe100('0x1')],'unique':_0xe100('0x4')},'description':{'type':Sequelize[_0xe100('0x1')]},'title':{'type':Sequelize[_0xe100('0x1')]},'remoteUri':{'type':Sequelize[_0xe100('0x1')]},'link':{'type':Sequelize[_0xe100('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xccb3=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x1b5d3d,_0x44818e){var _0x15c2ce=function(_0x578a44){while(--_0x578a44){_0x1b5d3d['push'](_0x1b5d3d['shift']());}};_0x15c2ce(++_0x44818e);}(_0xccb3,0x15a));var _0x3ccb=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xccb3[_0x1d8119];return _0x3e30f6;};'use strict';var Sequelize=require('sequelize');module[_0x3ccb('0x0')]={'name':{'type':Sequelize[_0x3ccb('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ccb('0x2')},'main':{'type':Sequelize[_0x3ccb('0x1')],'defaultValue':_0x3ccb('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x3ccb('0x1')]},'type':{'type':Sequelize[_0x3ccb('0x1')]},'size':{'type':Sequelize[_0x3ccb('0x4')]},'active':{'type':Sequelize[_0x3ccb('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x3ccb('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3ccb('0x1')],'unique':_0x3ccb('0x6')},'description':{'type':Sequelize[_0x3ccb('0x1')]},'title':{'type':Sequelize[_0x3ccb('0x1')]},'remoteUri':{'type':Sequelize[_0x3ccb('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 53a4ad3..e7bfa7c 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 _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x294e1d,_0x251247){var _0x16f411=function(_0x27aa28){while(--_0x27aa28){_0x294e1d['push'](_0x294e1d['shift']());}};_0x16f411(++_0x251247);}(_0xba34,0x119));var _0x4ba3=function(_0x57f237,_0x47bb2c){_0x57f237=_0x57f237-0x0;var _0x229093=_0xba34[_0x57f237];return _0x229093;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file +var _0xb016=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','Integration','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body'];(function(_0x5a1477,_0x259b55){var _0x4e838a=function(_0x234610){while(--_0x234610){_0x5a1477['push'](_0x5a1477['shift']());}};_0x4e838a(++_0x259b55);}(_0xb016,0x159));var _0x6b01=function(_0x4d45d6,_0x170171){_0x4d45d6=_0x4d45d6-0x0;var _0x5f0db3=_0xb016[_0x4d45d6];return _0x5f0db3;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['Integration'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b181f95..75316df 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 _0x6460=['exports','define','Integration','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6460,0x1e7));var _0x0646=function(_0x25db26,_0x48f45f){_0x25db26=_0x25db26-0x0;var _0x748fa6=_0x6460[_0x25db26];return _0x748fa6;};'use strict';var _=require('lodash');var util=require(_0x0646('0x0'));var logger=require(_0x0646('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0646('0x2'));var rp=require(_0x0646('0x3'));var fs=require('fs');var path=require(_0x0646('0x4'));var rimraf=require(_0x0646('0x5'));var config=require(_0x0646('0x6'));var attributes=require(_0x0646('0x7'));module[_0x0646('0x8')]=function(_0x2aa446,_0x30c020){return _0x2aa446[_0x0646('0x9')](_0x0646('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x612e=['../../config/logger','api','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','util'];(function(_0x10383f,_0x29dee2){var _0x24acf2=function(_0x561f6c){while(--_0x561f6c){_0x10383f['push'](_0x10383f['shift']());}};_0x24acf2(++_0x29dee2);}(_0x612e,0xbf));var _0xe612=function(_0x367aa7,_0x2bb647){_0x367aa7=_0x367aa7-0x0;var _0x2ad802=_0x612e[_0x367aa7];return _0x2ad802;};'use strict';var _=require('lodash');var util=require(_0xe612('0x0'));var logger=require(_0xe612('0x1'))(_0xe612('0x2'));var moment=require('moment');var BPromise=require(_0xe612('0x3'));var rp=require(_0xe612('0x4'));var fs=require('fs');var path=require(_0xe612('0x5'));var rimraf=require(_0xe612('0x6'));var config=require('../../config/environment');var attributes=require(_0xe612('0x7'));module[_0xe612('0x8')]=function(_0x55a28c,_0x3944e2){return _0x55a28c[_0xe612('0x9')](_0xe612('0xa'),attributes,{'tableName':_0xe612('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a7d517f..e93bbb3 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x1008d1,_0x3c5273){var _0x59f87b=function(_0x1531a3){while(--_0x1531a3){_0x1008d1['push'](_0x1008d1['shift']());}};_0x59f87b(++_0x3c5273);}(_0xba34,0x119));var _0x4ba3=function(_0x528f1e,_0x178239){_0x528f1e=_0x528f1e-0x0;var _0x1fd4b7=_0xba34[_0x528f1e];return _0x1fd4b7;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x31cfe1,_0x3a9de3){var _0x340cc5=function(_0x4295b8){while(--_0x4295b8){_0x31cfe1['push'](_0x31cfe1['shift']());}};_0x340cc5(++_0x3a9de3);}(_0x7880,0x1f4));var _0x0788=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0x7880[_0x292600];return _0x2ef83b;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d079c71..a6f35a9 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 _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3a14ac,_0x55403f){var _0x5e3bc3=function(_0x11f956){while(--_0x11f956){_0x3a14ac['push'](_0x3a14ac['shift']());}};_0x5e3bc3(++_0x55403f);}(_0x66fa,0x117));var _0xa66f=function(_0x5b2ac6,_0xfdffb8){_0x5b2ac6=_0x5b2ac6-0x0;var _0x5cc0cd=_0x66fa[_0x5b2ac6];return _0x5cc0cd;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x8a6ab0,_0x44a78b){var _0x1613ec=function(_0x1f4cbb){while(--_0x1f4cbb){_0x8a6ab0['push'](_0x8a6ab0['shift']());}};_0x1613ec(++_0x44a78b);}(_0x5fab,0x177));var _0xb5fa=function(_0xb4bdb3,_0x48dca0){_0xb4bdb3=_0xb4bdb3-0x0;var _0x4c8c02=_0x5fab[_0xb4bdb3];return _0x4c8c02;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);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 71828ee..a8769aa 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 _0xdda1=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','sequelize','STRING','INTEGER'];(function(_0x416a3c,_0x481c83){var _0x2a055d=function(_0x1095d4){while(--_0x1095d4){_0x416a3c['push'](_0x416a3c['shift']());}};_0x2a055d(++_0x481c83);}(_0xdda1,0x1bf));var _0x1dda=function(_0x15fc25,_0x51a221){_0x15fc25=_0x15fc25-0x0;var _0x25d0ce=_0xdda1[_0x15fc25];return _0x25d0ce;};'use strict';var Sequelize=require(_0x1dda('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1dda('0x1')]},'exitStatus':{'type':Sequelize[_0x1dda('0x1')]},'ticketId':{'type':Sequelize[_0x1dda('0x1')]},'integrationId':{'type':Sequelize[_0x1dda('0x2')]},'contacts':{'type':Sequelize[_0x1dda('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1dda('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1dda('0x1')]},'interface':{'type':Sequelize[_0x1dda('0x1')]},'membername':{'type':Sequelize[_0x1dda('0x1')]},'agentcalledAt':{'type':Sequelize[_0x1dda('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1dda('0x2')]},'agentcomplete':{'type':Sequelize[_0x1dda('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1dda('0x3')]},'talktime':{'type':Sequelize[_0x1dda('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1dda('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x1dda('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1dda('0x3')]},'agentdump':{'type':Sequelize[_0x1dda('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1dda('0x3')]},'lastevent':{'type':Sequelize[_0x1dda('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1dda('0x2')]},'channelstatedesc':{'type':Sequelize[_0x1dda('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1dda('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1dda('0x1')]},'accountcode':{'type':Sequelize[_0x1dda('0x1')]},'context':{'type':Sequelize[_0x1dda('0x1')]},'exten':{'type':Sequelize[_0x1dda('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1dda('0x1')]},'destchannelstate':{'type':Sequelize[_0x1dda('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1dda('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x1dda('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x1dda('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1dda('0x1')]},'destaccountcode':{'type':Sequelize[_0x1dda('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x1dda('0x1')]},'destuniqueid':{'type':Sequelize[_0x1dda('0x1')]},'messageId':{'type':Sequelize[_0x1dda('0x1')]},'inReplyTo':{'type':Sequelize[_0x1dda('0x1')]},'subject':{'type':Sequelize[_0x1dda('0x1')]},'from':{'type':Sequelize[_0x1dda('0x1')]},'to':{'type':Sequelize[_0x1dda('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1dda('0x5')]},'html':{'type':Sequelize[_0x1dda('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x1dda('0x6')](_0x1dda('0x7'),_0x1dda('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x1dda('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x1dda('0x2')]}}; \ No newline at end of file +var _0xfa09=['INTEGER','DATE','BOOLEAN','TEXT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfa09,0x7f));var _0x9fa0=function(_0x190b91,_0x7d84e5){_0x190b91=_0x190b91-0x0;var _0x3d2817=_0xfa09[_0x190b91];return _0x3d2817;};'use strict';var Sequelize=require(_0x9fa0('0x0'));module[_0x9fa0('0x1')]={'integration':{'type':Sequelize[_0x9fa0('0x2')]},'eventChannel':{'type':Sequelize[_0x9fa0('0x2')]},'exitStatus':{'type':Sequelize[_0x9fa0('0x2')]},'ticketId':{'type':Sequelize[_0x9fa0('0x2')]},'integrationId':{'type':Sequelize[_0x9fa0('0x3')]},'contacts':{'type':Sequelize[_0x9fa0('0x2')]},'uniqueid':{'type':Sequelize[_0x9fa0('0x2')]},'calleridnum':{'type':Sequelize[_0x9fa0('0x2')]},'calleridname':{'type':Sequelize[_0x9fa0('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9fa0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9fa0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x9fa0('0x4')]},'holdtime':{'type':Sequelize[_0x9fa0('0x3')]},'agentcomplete':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9fa0('0x4')]},'talktime':{'type':Sequelize[_0x9fa0('0x3')]},'agentacw':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9fa0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x9fa0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9fa0('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9fa0('0x4')]},'lastevent':{'type':Sequelize[_0x9fa0('0x2')]},'channel':{'type':Sequelize[_0x9fa0('0x2')]},'channelstate':{'type':Sequelize[_0x9fa0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9fa0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9fa0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9fa0('0x2')]},'accountcode':{'type':Sequelize[_0x9fa0('0x2')]},'context':{'type':Sequelize[_0x9fa0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9fa0('0x2')]},'destchannel':{'type':Sequelize[_0x9fa0('0x2')]},'destchannelstate':{'type':Sequelize[_0x9fa0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x9fa0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9fa0('0x2')]},'destcalleridname':{'type':Sequelize[_0x9fa0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9fa0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9fa0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9fa0('0x2')]},'destcontext':{'type':Sequelize[_0x9fa0('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9fa0('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x9fa0('0x2')]},'inReplyTo':{'type':Sequelize[_0x9fa0('0x2')]},'subject':{'type':Sequelize[_0x9fa0('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9fa0('0x6')]},'html':{'type':Sequelize[_0x9fa0('0x6')]},'text':{'type':Sequelize[_0x9fa0('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x9fa0('0x7'),_0x9fa0('0x8'),_0x9fa0('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x9fa0('0x2')]},'appdata':{'type':Sequelize[_0x9fa0('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f66cc30..f6b985d 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 _0x92ed=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','IntegrationReport','includeAll','include','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x907c70,_0x20bf89){var _0x479688=function(_0x496a05){while(--_0x496a05){_0x907c70['push'](_0x907c70['shift']());}};_0x479688(++_0x20bf89);}(_0x92ed,0xd3));var _0xd92e=function(_0x3e9bbf,_0x10fe00){_0x3e9bbf=_0x3e9bbf-0x0;var _0x48580a=_0x92ed[_0x3e9bbf];return _0x48580a;};'use strict';var emlformat=require(_0xd92e('0x0'));var rimraf=require(_0xd92e('0x1'));var zipdir=require(_0xd92e('0x2'));var jsonpatch=require(_0xd92e('0x3'));var rp=require(_0xd92e('0x4'));var moment=require('moment');var BPromise=require(_0xd92e('0x5'));var Mustache=require('mustache');var util=require(_0xd92e('0x6'));var path=require(_0xd92e('0x7'));var sox=require(_0xd92e('0x8'));var csv=require(_0xd92e('0x9'));var ejs=require(_0xd92e('0xa'));var fs=require('fs');var fs_extra=require(_0xd92e('0xb'));var _=require(_0xd92e('0xc'));var squel=require(_0xd92e('0xd'));var crypto=require(_0xd92e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd92e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd92e('0x10'));var Papa=require(_0xd92e('0x11'));var Redis=require('ioredis');var authService=require(_0xd92e('0x12'));var qs=require(_0xd92e('0x13'));var as=require(_0xd92e('0x14'));var hardwareService=require(_0xd92e('0x15'));var logger=require('../../config/logger')(_0xd92e('0x16'));var utils=require(_0xd92e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd92e('0x18'));var db=require(_0xd92e('0x19'))['db'];function respondWithStatusCode(_0x1eeeea,_0x4c2580){_0x4c2580=_0x4c2580||0xcc;return function(_0x2f64ee){if(_0x2f64ee){return _0x1eeeea[_0xd92e('0x1a')](_0x4c2580);}return _0x1eeeea['status'](_0x4c2580)[_0xd92e('0x1b')]();};}function respondWithResult(_0x2259bf,_0x522c76){_0x522c76=_0x522c76||0xc8;return function(_0x297f26){if(_0x297f26){return _0x2259bf[_0xd92e('0x1c')](_0x522c76)[_0xd92e('0x1d')](_0x297f26);}};}function respondWithFilteredResult(_0x3b17a3,_0x2e9475){return function(_0x5686b0){if(_0x5686b0){var _0x568bf8=typeof _0x2e9475[_0xd92e('0x1e')]===_0xd92e('0x1f')&&typeof _0x2e9475['limit']===_0xd92e('0x1f');var _0xe9a2a6=_0x5686b0[_0xd92e('0x20')];var _0x42437f=_0x568bf8?0x0:_0x2e9475[_0xd92e('0x1e')];var _0x547d41=_0x568bf8?_0x5686b0[_0xd92e('0x20')]:_0x2e9475[_0xd92e('0x1e')]+_0x2e9475[_0xd92e('0x21')];var _0x48a24f;if(_0x547d41>=_0xe9a2a6){_0x547d41=_0xe9a2a6;_0x48a24f=0xc8;}else{_0x48a24f=0xce;}_0x3b17a3[_0xd92e('0x1c')](_0x48a24f);return _0x3b17a3[_0xd92e('0x22')]('Content-Range',_0x42437f+'-'+_0x547d41+'/'+_0xe9a2a6)[_0xd92e('0x1d')](_0x5686b0);}return null;};}function patchUpdates(_0x557af5){return function(_0x13da43){try{jsonpatch['apply'](_0x13da43,_0x557af5,!![]);}catch(_0x50eb70){return BPromise[_0xd92e('0x23')](_0x50eb70);}return _0x13da43[_0xd92e('0x24')]();};}function saveUpdates(_0x284e6a,_0x15b263){return function(_0x4f1be8){if(_0x4f1be8){return _0x4f1be8['update'](_0x284e6a)[_0xd92e('0x25')](function(_0x3bff8d){return _0x3bff8d;});}return null;};}function removeEntity(_0x5312ba,_0x18b211){return function(_0x495ed8){if(_0x495ed8){return _0x495ed8[_0xd92e('0x26')]()[_0xd92e('0x25')](function(){_0x5312ba[_0xd92e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6741,_0x2700e0){return function(_0x5766af){if(!_0x5766af){_0x2b6741[_0xd92e('0x1a')](0x194);}return _0x5766af;};}function handleError(_0x32047e,_0x363643){_0x363643=_0x363643||0x1f4;return function(_0x569b7f){logger[_0xd92e('0x27')](_0x569b7f[_0xd92e('0x28')]);if(_0x569b7f[_0xd92e('0x29')]){delete _0x569b7f[_0xd92e('0x29')];}_0x32047e['status'](_0x363643)['send'](_0x569b7f);};}exports[_0xd92e('0x2a')]=function(_0x41fda8,_0x5c7799){var _0x174c39={},_0x542538={},_0x1cf2dc={'count':0x0,'rows':[]};var _0x1a1587=_['map'](db['IntegrationReport'][_0xd92e('0x2b')],function(_0x364dc3){return{'name':_0x364dc3[_0xd92e('0x2c')],'type':_0x364dc3[_0xd92e('0x2d')][_0xd92e('0x2e')]};});_0x542538[_0xd92e('0x2f')]=_[_0xd92e('0x30')](_0x1a1587,'name');_0x542538[_0xd92e('0x31')]=_[_0xd92e('0x32')](_0x41fda8[_0xd92e('0x31')]);_0x542538[_0xd92e('0x33')]=_[_0xd92e('0x34')](_0x542538[_0xd92e('0x2f')],_0x542538[_0xd92e('0x31')]);_0x174c39[_0xd92e('0x35')]=_[_0xd92e('0x34')](_0x542538[_0xd92e('0x2f')],qs[_0xd92e('0x36')](_0x41fda8['query'][_0xd92e('0x36')]));_0x174c39[_0xd92e('0x35')]=_0x174c39[_0xd92e('0x35')][_0xd92e('0x37')]?_0x174c39[_0xd92e('0x35')]:_0x542538[_0xd92e('0x2f')];if(!_0x41fda8['query'][_0xd92e('0x38')]('nolimit')){_0x174c39[_0xd92e('0x21')]=qs[_0xd92e('0x21')](_0x41fda8[_0xd92e('0x31')]['limit']);_0x174c39[_0xd92e('0x1e')]=qs['offset'](_0x41fda8[_0xd92e('0x31')][_0xd92e('0x1e')]);}_0x174c39[_0xd92e('0x39')]=qs[_0xd92e('0x3a')](_0x41fda8[_0xd92e('0x31')]['sort']);_0x174c39[_0xd92e('0x3b')]=qs[_0xd92e('0x33')](_[_0xd92e('0x3c')](_0x41fda8[_0xd92e('0x31')],_0x542538['filters']),_0x1a1587);if(_0x41fda8[_0xd92e('0x31')][_0xd92e('0x3d')]){_0x174c39['where']=_['merge'](_0x174c39[_0xd92e('0x3b')],{'$or':_[_0xd92e('0x30')](_0x1a1587,function(_0x5d9117){if(_0x5d9117[_0xd92e('0x2d')]!==_0xd92e('0x3e')){var _0x4ae7b9={};_0x4ae7b9[_0x5d9117['name']]={'$like':'%'+_0x41fda8[_0xd92e('0x31')][_0xd92e('0x3d')]+'%'};return _0x4ae7b9;}})});}_0x174c39=_[_0xd92e('0x3f')]({},_0x174c39,_0x41fda8[_0xd92e('0x40')]);var _0xa0aae2={'where':_0x174c39['where']};return db[_0xd92e('0x41')][_0xd92e('0x20')](_0xa0aae2)[_0xd92e('0x25')](function(_0x35617b){_0x1cf2dc[_0xd92e('0x20')]=_0x35617b;if(_0x41fda8[_0xd92e('0x31')][_0xd92e('0x42')]){_0x174c39[_0xd92e('0x43')]=[{'all':!![]}];}return db[_0xd92e('0x41')]['findAll'](_0x174c39);})[_0xd92e('0x25')](function(_0x2194cc){_0x1cf2dc[_0xd92e('0x44')]=_0x2194cc;return _0x1cf2dc;})[_0xd92e('0x25')](respondWithFilteredResult(_0x5c7799,_0x174c39))[_0xd92e('0x45')](handleError(_0x5c7799,null));};exports[_0xd92e('0x46')]=function(_0x4a98e7,_0xd2e062){var _0x1db006={'raw':![],'where':{'id':_0x4a98e7[_0xd92e('0x47')]['id']}},_0x1f388b={};_0x1f388b[_0xd92e('0x2f')]=_['keys'](db[_0xd92e('0x41')][_0xd92e('0x2b')]);_0x1f388b[_0xd92e('0x31')]=_[_0xd92e('0x32')](_0x4a98e7[_0xd92e('0x31')]);_0x1f388b['filters']=_[_0xd92e('0x34')](_0x1f388b[_0xd92e('0x2f')],_0x1f388b[_0xd92e('0x31')]);_0x1db006[_0xd92e('0x35')]=_[_0xd92e('0x34')](_0x1f388b['model'],qs[_0xd92e('0x36')](_0x4a98e7[_0xd92e('0x31')][_0xd92e('0x36')]));_0x1db006['attributes']=_0x1db006[_0xd92e('0x35')][_0xd92e('0x37')]?_0x1db006['attributes']:_0x1f388b[_0xd92e('0x2f')];if(_0x4a98e7['query'][_0xd92e('0x42')]){_0x1db006[_0xd92e('0x43')]=[{'all':!![]}];}_0x1db006=_[_0xd92e('0x3f')]({},_0x1db006,_0x4a98e7['options']);return db[_0xd92e('0x41')][_0xd92e('0x48')](_0x1db006)[_0xd92e('0x25')](handleEntityNotFound(_0xd2e062,null))[_0xd92e('0x25')](respondWithResult(_0xd2e062,null))[_0xd92e('0x45')](handleError(_0xd2e062,null));};exports[_0xd92e('0x49')]=function(_0xd39eb5,_0x2b92c3){return db['IntegrationReport']['create'](_0xd39eb5['body'],{})[_0xd92e('0x25')](respondWithResult(_0x2b92c3,0xc9))[_0xd92e('0x45')](handleError(_0x2b92c3,null));};exports[_0xd92e('0x4a')]=function(_0x549abd,_0x1304f1){if(_0x549abd['body']['id']){delete _0x549abd[_0xd92e('0x4b')]['id'];}return db[_0xd92e('0x41')][_0xd92e('0x48')]({'where':{'id':_0x549abd[_0xd92e('0x47')]['id']}})[_0xd92e('0x25')](handleEntityNotFound(_0x1304f1,null))[_0xd92e('0x25')](saveUpdates(_0x549abd[_0xd92e('0x4b')],null))[_0xd92e('0x25')](respondWithResult(_0x1304f1,null))[_0xd92e('0x45')](handleError(_0x1304f1,null));};exports[_0xd92e('0x26')]=function(_0x4bcfb8,_0x571e20){return db[_0xd92e('0x41')][_0xd92e('0x48')]({'where':{'id':_0x4bcfb8[_0xd92e('0x47')]['id']}})[_0xd92e('0x25')](handleEntityNotFound(_0x571e20,null))[_0xd92e('0x25')](removeEntity(_0x571e20,null))['catch'](handleError(_0x571e20,null));};exports['describe']=function(_0x54356d,_0x1bc4f7){return db[_0xd92e('0x41')][_0xd92e('0x4c')]()[_0xd92e('0x25')](respondWithResult(_0x1bc4f7,null))[_0xd92e('0x45')](handleError(_0x1bc4f7,null));}; \ No newline at end of file +var _0xed9a=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','error','stack','name','map','IntegrationReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3602be,_0x4d4e43){var _0x41e34b=function(_0x4df124){while(--_0x4df124){_0x3602be['push'](_0x3602be['shift']());}};_0x41e34b(++_0x4d4e43);}(_0xed9a,0x1bb));var _0xaed9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xed9a[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xaed9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaed9('0x1'));var jsonpatch=require(_0xaed9('0x2'));var rp=require(_0xaed9('0x3'));var moment=require(_0xaed9('0x4'));var BPromise=require(_0xaed9('0x5'));var Mustache=require('mustache');var util=require(_0xaed9('0x6'));var path=require(_0xaed9('0x7'));var sox=require('sox');var csv=require(_0xaed9('0x8'));var ejs=require(_0xaed9('0x9'));var fs=require('fs');var fs_extra=require(_0xaed9('0xa'));var _=require(_0xaed9('0xb'));var squel=require(_0xaed9('0xc'));var crypto=require(_0xaed9('0xd'));var jsforce=require(_0xaed9('0xe'));var deskjs=require(_0xaed9('0xf'));var toCsv=require(_0xaed9('0x8'));var querystring=require(_0xaed9('0x10'));var Papa=require(_0xaed9('0x11'));var Redis=require(_0xaed9('0x12'));var authService=require(_0xaed9('0x13'));var qs=require(_0xaed9('0x14'));var as=require(_0xaed9('0x15'));var hardwareService=require(_0xaed9('0x16'));var logger=require(_0xaed9('0x17'))('api');var utils=require(_0xaed9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaed9('0x19'));var db=require(_0xaed9('0x1a'))['db'];function respondWithStatusCode(_0xc744e2,_0x2826d9){_0x2826d9=_0x2826d9||0xcc;return function(_0x50ca05){if(_0x50ca05){return _0xc744e2[_0xaed9('0x1b')](_0x2826d9);}return _0xc744e2[_0xaed9('0x1c')](_0x2826d9)[_0xaed9('0x1d')]();};}function respondWithResult(_0x3ec401,_0x260f25){_0x260f25=_0x260f25||0xc8;return function(_0x5a2761){if(_0x5a2761){return _0x3ec401[_0xaed9('0x1c')](_0x260f25)[_0xaed9('0x1e')](_0x5a2761);}};}function respondWithFilteredResult(_0x555eb1,_0x30f8b4){return function(_0x568573){if(_0x568573){var _0x35122d=typeof _0x30f8b4['offset']==='undefined'&&typeof _0x30f8b4[_0xaed9('0x1f')]===_0xaed9('0x20');var _0x770f42=_0x568573[_0xaed9('0x21')];var _0x55c057=_0x35122d?0x0:_0x30f8b4[_0xaed9('0x22')];var _0x2ade05=_0x35122d?_0x568573['count']:_0x30f8b4['offset']+_0x30f8b4[_0xaed9('0x1f')];var _0x2ad04c;if(_0x2ade05>=_0x770f42){_0x2ade05=_0x770f42;_0x2ad04c=0xc8;}else{_0x2ad04c=0xce;}_0x555eb1[_0xaed9('0x1c')](_0x2ad04c);return _0x555eb1[_0xaed9('0x23')]('Content-Range',_0x55c057+'-'+_0x2ade05+'/'+_0x770f42)[_0xaed9('0x1e')](_0x568573);}return null;};}function patchUpdates(_0x3c3e19){return function(_0x5101c7){try{jsonpatch[_0xaed9('0x24')](_0x5101c7,_0x3c3e19,!![]);}catch(_0x3f10bd){return BPromise[_0xaed9('0x25')](_0x3f10bd);}return _0x5101c7['save']();};}function saveUpdates(_0x33f596,_0x4a54ff){return function(_0x1282a0){if(_0x1282a0){return _0x1282a0[_0xaed9('0x26')](_0x33f596)[_0xaed9('0x27')](function(_0x18a525){return _0x18a525;});}return null;};}function removeEntity(_0x585d7f,_0x253875){return function(_0x2325cc){if(_0x2325cc){return _0x2325cc['destroy']()[_0xaed9('0x27')](function(){_0x585d7f['status'](0xcc)[_0xaed9('0x1d')]();});}};}function handleEntityNotFound(_0x45b148,_0x3cf801){return function(_0x110c52){if(!_0x110c52){_0x45b148[_0xaed9('0x1b')](0x194);}return _0x110c52;};}function handleError(_0x542309,_0x255989){_0x255989=_0x255989||0x1f4;return function(_0x4de671){logger[_0xaed9('0x28')](_0x4de671[_0xaed9('0x29')]);if(_0x4de671[_0xaed9('0x2a')]){delete _0x4de671[_0xaed9('0x2a')];}_0x542309[_0xaed9('0x1c')](_0x255989)['send'](_0x4de671);};}exports['index']=function(_0x41462c,_0xb6e11d){var _0x13362a={},_0x5a947f={},_0x5cb081={'count':0x0,'rows':[]};var _0x50f8fc=_[_0xaed9('0x2b')](db[_0xaed9('0x2c')][_0xaed9('0x2d')],function(_0x4afc3f){return{'name':_0x4afc3f['fieldName'],'type':_0x4afc3f[_0xaed9('0x2e')]['key']};});_0x5a947f['model']=_[_0xaed9('0x2b')](_0x50f8fc,_0xaed9('0x2a'));_0x5a947f[_0xaed9('0x2f')]=_[_0xaed9('0x30')](_0x41462c[_0xaed9('0x2f')]);_0x5a947f[_0xaed9('0x31')]=_[_0xaed9('0x32')](_0x5a947f[_0xaed9('0x33')],_0x5a947f[_0xaed9('0x2f')]);_0x13362a['attributes']=_[_0xaed9('0x32')](_0x5a947f[_0xaed9('0x33')],qs[_0xaed9('0x34')](_0x41462c['query'][_0xaed9('0x34')]));_0x13362a[_0xaed9('0x35')]=_0x13362a['attributes'][_0xaed9('0x36')]?_0x13362a['attributes']:_0x5a947f['model'];if(!_0x41462c[_0xaed9('0x2f')][_0xaed9('0x37')](_0xaed9('0x38'))){_0x13362a[_0xaed9('0x1f')]=qs[_0xaed9('0x1f')](_0x41462c[_0xaed9('0x2f')][_0xaed9('0x1f')]);_0x13362a['offset']=qs[_0xaed9('0x22')](_0x41462c['query'][_0xaed9('0x22')]);}_0x13362a[_0xaed9('0x39')]=qs[_0xaed9('0x3a')](_0x41462c['query']['sort']);_0x13362a[_0xaed9('0x3b')]=qs[_0xaed9('0x31')](_[_0xaed9('0x3c')](_0x41462c[_0xaed9('0x2f')],_0x5a947f[_0xaed9('0x31')]),_0x50f8fc);if(_0x41462c[_0xaed9('0x2f')][_0xaed9('0x3d')]){_0x13362a[_0xaed9('0x3b')]=_['merge'](_0x13362a[_0xaed9('0x3b')],{'$or':_[_0xaed9('0x2b')](_0x50f8fc,function(_0x34ee82){if(_0x34ee82[_0xaed9('0x2e')]!==_0xaed9('0x3e')){var _0x3b65c4={};_0x3b65c4[_0x34ee82[_0xaed9('0x2a')]]={'$like':'%'+_0x41462c[_0xaed9('0x2f')]['filter']+'%'};return _0x3b65c4;}})});}_0x13362a=_[_0xaed9('0x3f')]({},_0x13362a,_0x41462c[_0xaed9('0x40')]);var _0xabb1e7={'where':_0x13362a[_0xaed9('0x3b')]};return db[_0xaed9('0x2c')][_0xaed9('0x21')](_0xabb1e7)[_0xaed9('0x27')](function(_0x73834b){_0x5cb081[_0xaed9('0x21')]=_0x73834b;if(_0x41462c[_0xaed9('0x2f')][_0xaed9('0x41')]){_0x13362a[_0xaed9('0x42')]=[{'all':!![]}];}return db[_0xaed9('0x2c')][_0xaed9('0x43')](_0x13362a);})[_0xaed9('0x27')](function(_0x4280de){_0x5cb081[_0xaed9('0x44')]=_0x4280de;return _0x5cb081;})['then'](respondWithFilteredResult(_0xb6e11d,_0x13362a))[_0xaed9('0x45')](handleError(_0xb6e11d,null));};exports['show']=function(_0x10c847,_0xa7a677){var _0x2ea5e3={'raw':![],'where':{'id':_0x10c847[_0xaed9('0x46')]['id']}},_0x205c6f={};_0x205c6f['model']=_[_0xaed9('0x30')](db[_0xaed9('0x2c')][_0xaed9('0x2d')]);_0x205c6f[_0xaed9('0x2f')]=_['keys'](_0x10c847[_0xaed9('0x2f')]);_0x205c6f[_0xaed9('0x31')]=_[_0xaed9('0x32')](_0x205c6f[_0xaed9('0x33')],_0x205c6f['query']);_0x2ea5e3[_0xaed9('0x35')]=_['intersection'](_0x205c6f[_0xaed9('0x33')],qs['fields'](_0x10c847[_0xaed9('0x2f')][_0xaed9('0x34')]));_0x2ea5e3[_0xaed9('0x35')]=_0x2ea5e3[_0xaed9('0x35')][_0xaed9('0x36')]?_0x2ea5e3[_0xaed9('0x35')]:_0x205c6f[_0xaed9('0x33')];if(_0x10c847[_0xaed9('0x2f')][_0xaed9('0x41')]){_0x2ea5e3['include']=[{'all':!![]}];}_0x2ea5e3=_[_0xaed9('0x3f')]({},_0x2ea5e3,_0x10c847[_0xaed9('0x40')]);return db[_0xaed9('0x2c')][_0xaed9('0x47')](_0x2ea5e3)['then'](handleEntityNotFound(_0xa7a677,null))['then'](respondWithResult(_0xa7a677,null))[_0xaed9('0x45')](handleError(_0xa7a677,null));};exports[_0xaed9('0x48')]=function(_0x4a207b,_0x21ef0c){return db[_0xaed9('0x2c')][_0xaed9('0x48')](_0x4a207b[_0xaed9('0x49')],{})['then'](respondWithResult(_0x21ef0c,0xc9))['catch'](handleError(_0x21ef0c,null));};exports[_0xaed9('0x26')]=function(_0x47f96d,_0x2b01f7){if(_0x47f96d[_0xaed9('0x49')]['id']){delete _0x47f96d['body']['id'];}return db[_0xaed9('0x2c')]['find']({'where':{'id':_0x47f96d[_0xaed9('0x46')]['id']}})[_0xaed9('0x27')](handleEntityNotFound(_0x2b01f7,null))[_0xaed9('0x27')](saveUpdates(_0x47f96d['body'],null))[_0xaed9('0x27')](respondWithResult(_0x2b01f7,null))[_0xaed9('0x45')](handleError(_0x2b01f7,null));};exports['destroy']=function(_0x20f7ac,_0x3739b5){return db[_0xaed9('0x2c')][_0xaed9('0x47')]({'where':{'id':_0x20f7ac[_0xaed9('0x46')]['id']}})[_0xaed9('0x27')](handleEntityNotFound(_0x3739b5,null))[_0xaed9('0x27')](removeEntity(_0x3739b5,null))[_0xaed9('0x45')](handleError(_0x3739b5,null));};exports[_0xaed9('0x4a')]=function(_0x525b2e,_0x4ee749){return db[_0xaed9('0x2c')][_0xaed9('0x4a')]()[_0xaed9('0x27')](respondWithResult(_0x4ee749,null))[_0xaed9('0x45')](handleError(_0x4ee749,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 34fc477..bce97e3 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 _0xfb3a=['exports','define','IntegrationReport','report_integration','lodash','util','api','bluebird','rimraf','./integrationReport.attributes'];(function(_0x1a4bfa,_0x8b706d){var _0x5fb913=function(_0x5d878d){while(--_0x5d878d){_0x1a4bfa['push'](_0x1a4bfa['shift']());}};_0x5fb913(++_0x8b706d);}(_0xfb3a,0x108));var _0xafb3=function(_0x56d7b1,_0x3f61d1){_0x56d7b1=_0x56d7b1-0x0;var _0x3f959d=_0xfb3a[_0x56d7b1];return _0x3f959d;};'use strict';var _=require(_0xafb3('0x0'));var util=require(_0xafb3('0x1'));var logger=require('../../config/logger')(_0xafb3('0x2'));var moment=require('moment');var BPromise=require(_0xafb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafb3('0x4'));var config=require('../../config/environment');var attributes=require(_0xafb3('0x5'));module[_0xafb3('0x6')]=function(_0x1f7653,_0x1e4370){return _0x1f7653[_0xafb3('0x7')](_0xafb3('0x8'),attributes,{'tableName':_0xafb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab2=['api','moment','bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xfab2,0x1d2));var _0x2fab=function(_0x8082a4,_0x5cb597){_0x8082a4=_0x8082a4-0x0;var _0x3c04ad=_0xfab2[_0x8082a4];return _0x3c04ad;};'use strict';var _=require(_0x2fab('0x0'));var util=require(_0x2fab('0x1'));var logger=require('../../config/logger')(_0x2fab('0x2'));var moment=require(_0x2fab('0x3'));var BPromise=require(_0x2fab('0x4'));var rp=require(_0x2fab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fab('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fab('0x7'));module[_0x2fab('0x8')]=function(_0x95277a,_0x5383d0){return _0x95277a[_0x2fab('0x9')](_0x2fab('0xa'),attributes,{'tableName':_0x2fab('0xb'),'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 20fdfca..e1cc00b 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0x5fab,0x177));var _0xb5fa=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x5fab[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x4975,0x86));var _0x5497=function(_0x5d1d2f,_0x3e2f59){_0x5d1d2f=_0x5d1d2f-0x0;var _0x30707c=_0x4975[_0x5d1d2f];return _0x30707c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 6153520..5fff1cc 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 _0x4fda=['../../config/environment','get','/:id','show','getIntervals','post','isAuthenticated','create','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x351331,_0x1d1d7b){var _0x31afc3=function(_0x121153){while(--_0x121153){_0x351331['push'](_0x351331['shift']());}};_0x31afc3(++_0x1d1d7b);}(_0x4fda,0x9a));var _0xa4fd=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x4fda[_0x47cfa0];return _0x386b1d;};'use strict';var multer=require(_0xa4fd('0x0'));var util=require('util');var path=require(_0xa4fd('0x1'));var timeout=require(_0xa4fd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa4fd('0x3'));var auth=require(_0xa4fd('0x4'));var interaction=require(_0xa4fd('0x5'));var config=require(_0xa4fd('0x6'));var controller=require('./interval.controller');router[_0xa4fd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4fd('0x7')](_0xa4fd('0x8'),auth['isAuthenticated'](),controller[_0xa4fd('0x9')]);router[_0xa4fd('0x7')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xa4fd('0xa')]);router[_0xa4fd('0xb')]('/',auth[_0xa4fd('0xc')](),controller[_0xa4fd('0xd')]);router[_0xa4fd('0xb')](_0xa4fd('0xe'),auth[_0xa4fd('0xc')](),controller['addInterval']);router['post'](_0xa4fd('0xf'),auth['isAuthenticated'](),controller[_0xa4fd('0x10')]);router[_0xa4fd('0x11')](_0xa4fd('0x8'),auth[_0xa4fd('0xc')](),controller['update']);router['delete'](_0xa4fd('0x8'),auth['isAuthenticated'](),controller[_0xa4fd('0x12')]);module[_0xa4fd('0x13')]=router; \ No newline at end of file +var _0xba0d=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','isAuthenticated','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba0d,0x8e));var _0xdba0=function(_0x2b7cc7,_0x1ee01a){_0x2b7cc7=_0x2b7cc7-0x0;var _0xb3b5d0=_0xba0d[_0x2b7cc7];return _0xb3b5d0;};'use strict';var multer=require(_0xdba0('0x0'));var util=require('util');var path=require(_0xdba0('0x1'));var timeout=require(_0xdba0('0x2'));var express=require(_0xdba0('0x3'));var router=express['Router']();var fs_extra=require(_0xdba0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdba0('0x5'));var config=require(_0xdba0('0x6'));var controller=require(_0xdba0('0x7'));router[_0xdba0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdba0('0x8')](_0xdba0('0x9'),auth[_0xdba0('0xa')](),controller[_0xdba0('0xb')]);router['get'](_0xdba0('0xc'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xdba0('0xd')]('/',auth['isAuthenticated'](),controller[_0xdba0('0xe')]);router['post'](_0xdba0('0xc'),auth[_0xdba0('0xa')](),controller[_0xdba0('0xf')]);router[_0xdba0('0xd')](_0xdba0('0x10'),auth[_0xdba0('0xa')](),controller[_0xdba0('0x11')]);router[_0xdba0('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdba0('0x13')]);router[_0xdba0('0x14')](_0xdba0('0x9'),auth[_0xdba0('0xa')](),controller[_0xdba0('0x15')]);module[_0xdba0('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5390436..54ebda4 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 _0x1d31=['exports','STRING'];(function(_0x1d4002,_0x51f476){var _0xe5a29a=function(_0x30f071){while(--_0x30f071){_0x1d4002['push'](_0x1d4002['shift']());}};_0xe5a29a(++_0x51f476);}(_0x1d31,0xb8));var _0x11d3=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x1d31[_0x44d9ab];return _0x31485e;};'use strict';var Sequelize=require('sequelize');module[_0x11d3('0x0')]={'name':{'type':Sequelize[_0x11d3('0x1')]},'description':{'type':Sequelize[_0x11d3('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x9b4b=['STRING','sequelize'];(function(_0x5628e5,_0x24b1b5){var _0x5bdadf=function(_0x1c03c9){while(--_0x1c03c9){_0x5628e5['push'](_0x5628e5['shift']());}};_0x5bdadf(++_0x24b1b5);}(_0x9b4b,0x1a5));var _0xb9b4=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x9b4b[_0x14c00f];return _0x19fbda;};'use strict';var Sequelize=require(_0xb9b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb9b4('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb9b4('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b551d30..2920dd5 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 _0x0c83=['type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','nolimit','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','name','send','index','Interval'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x0c83,0x146));var _0x30c8=function(_0x1b3c30,_0xe3f388){_0x1b3c30=_0x1b3c30-0x0;var _0x1ca1b4=_0x0c83[_0x1b3c30];return _0x1ca1b4;};'use strict';var emlformat=require(_0x30c8('0x0'));var rimraf=require(_0x30c8('0x1'));var zipdir=require(_0x30c8('0x2'));var jsonpatch=require(_0x30c8('0x3'));var rp=require(_0x30c8('0x4'));var moment=require(_0x30c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x30c8('0x6'));var util=require(_0x30c8('0x7'));var path=require(_0x30c8('0x8'));var sox=require(_0x30c8('0x9'));var csv=require(_0x30c8('0xa'));var ejs=require(_0x30c8('0xb'));var fs=require('fs');var fs_extra=require(_0x30c8('0xc'));var _=require('lodash');var squel=require(_0x30c8('0xd'));var crypto=require(_0x30c8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x30c8('0xf'));var toCsv=require(_0x30c8('0xa'));var querystring=require(_0x30c8('0x10'));var Papa=require(_0x30c8('0x11'));var Redis=require(_0x30c8('0x12'));var authService=require(_0x30c8('0x13'));var qs=require(_0x30c8('0x14'));var as=require(_0x30c8('0x15'));var hardwareService=require(_0x30c8('0x16'));var logger=require('../../config/logger')(_0x30c8('0x17'));var utils=require('../../config/utils');var config=require(_0x30c8('0x18'));var licenseUtil=require(_0x30c8('0x19'));var db=require(_0x30c8('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x534720,_0x1218a7){_0x1218a7=_0x1218a7||0xcc;return function(_0x5e2a6d){if(_0x5e2a6d){return _0x534720['sendStatus'](_0x1218a7);}return _0x534720[_0x30c8('0x1b')](_0x1218a7)[_0x30c8('0x1c')]();};}function respondWithResult(_0x2b9db1,_0x1e9777){_0x1e9777=_0x1e9777||0xc8;return function(_0x4751da){if(_0x4751da){return _0x2b9db1['status'](_0x1e9777)[_0x30c8('0x1d')](_0x4751da);}};}function respondWithFilteredResult(_0x15119a,_0x33a278){return function(_0x2c7f2f){if(_0x2c7f2f){var _0x27c490=typeof _0x33a278['offset']===_0x30c8('0x1e')&&typeof _0x33a278[_0x30c8('0x1f')]==='undefined';var _0x2b359d=_0x2c7f2f[_0x30c8('0x20')];var _0x28837e=_0x27c490?0x0:_0x33a278['offset'];var _0x583751=_0x27c490?_0x2c7f2f[_0x30c8('0x20')]:_0x33a278[_0x30c8('0x21')]+_0x33a278[_0x30c8('0x1f')];var _0x53fb70;if(_0x583751>=_0x2b359d){_0x583751=_0x2b359d;_0x53fb70=0xc8;}else{_0x53fb70=0xce;}_0x15119a[_0x30c8('0x1b')](_0x53fb70);return _0x15119a[_0x30c8('0x22')]('Content-Range',_0x28837e+'-'+_0x583751+'/'+_0x2b359d)[_0x30c8('0x1d')](_0x2c7f2f);}return null;};}function patchUpdates(_0x53b50b){return function(_0x521c6b){try{jsonpatch[_0x30c8('0x23')](_0x521c6b,_0x53b50b,!![]);}catch(_0x1d580f){return BPromise[_0x30c8('0x24')](_0x1d580f);}return _0x521c6b[_0x30c8('0x25')]();};}function saveUpdates(_0x5c4fff,_0x578b39){return function(_0x347136){if(_0x347136){return _0x347136[_0x30c8('0x26')](_0x5c4fff)[_0x30c8('0x27')](function(_0x5827bc){return _0x5827bc;});}return null;};}function removeEntity(_0x36eab9,_0x292402){return function(_0x4e5b60){if(_0x4e5b60){return _0x4e5b60[_0x30c8('0x28')]()[_0x30c8('0x27')](function(){var _0x3f4fdb=_0x4e5b60[_0x30c8('0x29')]({'plain':!![]});var _0x46ec2b=_0x30c8('0x2a');return db[_0x30c8('0x2b')]['destroy']({'where':{'type':_0x46ec2b,'resourceId':_0x3f4fdb['id']}})['then'](function(){return _0x4e5b60;});})[_0x30c8('0x27')](function(){_0x36eab9[_0x30c8('0x1b')](0xcc)[_0x30c8('0x1c')]();});}};}function handleEntityNotFound(_0x48e0a3,_0xb8ae7){return function(_0x1dc804){if(!_0x1dc804){_0x48e0a3[_0x30c8('0x2c')](0x194);}return _0x1dc804;};}function handleError(_0x525344,_0x1f3dde){_0x1f3dde=_0x1f3dde||0x1f4;return function(_0x4531da){logger[_0x30c8('0x2d')](_0x4531da['stack']);if(_0x4531da[_0x30c8('0x2e')]){delete _0x4531da[_0x30c8('0x2e')];}_0x525344[_0x30c8('0x1b')](_0x1f3dde)[_0x30c8('0x2f')](_0x4531da);};}exports[_0x30c8('0x30')]=function(_0x529721,_0x47ef6f){var _0x48171b={},_0x54b55b={},_0x2f8469={'count':0x0,'rows':[]};var _0x1b1a52=_['map'](db[_0x30c8('0x31')]['rawAttributes'],function(_0xb7a5af){return{'name':_0xb7a5af['fieldName'],'type':_0xb7a5af[_0x30c8('0x32')][_0x30c8('0x33')]};});_0x54b55b[_0x30c8('0x34')]=_[_0x30c8('0x35')](_0x1b1a52,_0x30c8('0x2e'));_0x54b55b[_0x30c8('0x36')]=_['keys'](_0x529721[_0x30c8('0x36')]);_0x54b55b['filters']=_[_0x30c8('0x37')](_0x54b55b[_0x30c8('0x34')],_0x54b55b[_0x30c8('0x36')]);_0x48171b[_0x30c8('0x38')]=_['intersection'](_0x54b55b['model'],qs['fields'](_0x529721[_0x30c8('0x36')][_0x30c8('0x39')]));_0x48171b[_0x30c8('0x38')]=_0x48171b['attributes'][_0x30c8('0x3a')]?_0x48171b['attributes']:_0x54b55b[_0x30c8('0x34')];if(!_0x529721[_0x30c8('0x36')][_0x30c8('0x3b')]('nolimit')){_0x48171b['limit']=qs[_0x30c8('0x1f')](_0x529721['query'][_0x30c8('0x1f')]);_0x48171b[_0x30c8('0x21')]=qs[_0x30c8('0x21')](_0x529721['query'][_0x30c8('0x21')]);}_0x48171b[_0x30c8('0x3c')]=qs[_0x30c8('0x3d')](_0x529721[_0x30c8('0x36')][_0x30c8('0x3d')]);_0x48171b['where']=qs[_0x30c8('0x3e')](_[_0x30c8('0x3f')](_0x529721[_0x30c8('0x36')],_0x54b55b[_0x30c8('0x3e')]),_0x1b1a52);if(_0x529721[_0x30c8('0x36')][_0x30c8('0x40')]){_0x48171b[_0x30c8('0x41')]=_[_0x30c8('0x42')](_0x48171b[_0x30c8('0x41')],{'$or':_[_0x30c8('0x35')](_0x1b1a52,function(_0x1e3a1e){if(_0x1e3a1e['type']!==_0x30c8('0x43')){var _0x504133={};_0x504133[_0x1e3a1e[_0x30c8('0x2e')]]={'$like':'%'+_0x529721[_0x30c8('0x36')][_0x30c8('0x40')]+'%'};return _0x504133;}})});}_0x48171b=_[_0x30c8('0x42')]({},_0x48171b,_0x529721[_0x30c8('0x44')]);var _0x493c53={'where':_0x48171b[_0x30c8('0x41')]};return db[_0x30c8('0x31')][_0x30c8('0x20')](_0x493c53)[_0x30c8('0x27')](function(_0x13b4f5){_0x2f8469[_0x30c8('0x20')]=_0x13b4f5;if(_0x529721[_0x30c8('0x36')][_0x30c8('0x45')]){_0x48171b[_0x30c8('0x46')]=[{'all':!![]}];}return db['Interval'][_0x30c8('0x47')](_0x48171b);})[_0x30c8('0x27')](function(_0x3cf732){_0x2f8469[_0x30c8('0x48')]=_0x3cf732;return _0x2f8469;})[_0x30c8('0x27')](respondWithFilteredResult(_0x47ef6f,_0x48171b))['catch'](handleError(_0x47ef6f,null));};exports[_0x30c8('0x49')]=function(_0x4a69ea,_0x32efc3){var _0x409430={'raw':!![],'where':{'id':_0x4a69ea[_0x30c8('0x4a')]['id']}},_0x30589f={};_0x30589f[_0x30c8('0x34')]=_[_0x30c8('0x4b')](db[_0x30c8('0x31')][_0x30c8('0x4c')]);_0x30589f['query']=_[_0x30c8('0x4b')](_0x4a69ea[_0x30c8('0x36')]);_0x30589f[_0x30c8('0x3e')]=_['intersection'](_0x30589f['model'],_0x30589f[_0x30c8('0x36')]);_0x409430[_0x30c8('0x38')]=_['intersection'](_0x30589f['model'],qs[_0x30c8('0x39')](_0x4a69ea[_0x30c8('0x36')][_0x30c8('0x39')]));_0x409430[_0x30c8('0x38')]=_0x409430[_0x30c8('0x38')]['length']?_0x409430[_0x30c8('0x38')]:_0x30589f[_0x30c8('0x34')];if(_0x4a69ea[_0x30c8('0x36')]['includeAll']){_0x409430[_0x30c8('0x46')]=[{'all':!![]}];}_0x409430=_[_0x30c8('0x42')]({},_0x409430,_0x4a69ea[_0x30c8('0x44')]);return db[_0x30c8('0x31')]['find'](_0x409430)[_0x30c8('0x27')](handleEntityNotFound(_0x32efc3,null))[_0x30c8('0x27')](respondWithResult(_0x32efc3,null))[_0x30c8('0x4d')](handleError(_0x32efc3,null));};exports[_0x30c8('0x4e')]=function(_0x293975,_0x1cc86f){return db[_0x30c8('0x31')][_0x30c8('0x4e')](_0x293975[_0x30c8('0x4f')],{})['then'](function(_0x10a394){var _0x1516d0=_0x293975[_0x30c8('0x50')][_0x30c8('0x29')]({'plain':!![]});if(!_0x1516d0)throw new Error(_0x30c8('0x51'));if(_0x1516d0['role']==='user'){var _0x45b651=_0x10a394[_0x30c8('0x29')]({'plain':!![]});var _0x10ef92=_0x30c8('0x2a');return db[_0x30c8('0x52')][_0x30c8('0x53')]({'where':{'name':_0x10ef92,'userProfileId':_0x1516d0['userProfileId']},'raw':!![]})[_0x30c8('0x27')](function(_0x5a0302){if(_0x5a0302&&_0x5a0302[_0x30c8('0x54')]===0x0){return db['UserProfileResource'][_0x30c8('0x4e')]({'name':_0x45b651[_0x30c8('0x2e')],'resourceId':_0x45b651['id'],'type':_0x5a0302[_0x30c8('0x2e')],'sectionId':_0x5a0302['id']},{})['then'](function(){return _0x10a394;});}else{return _0x10a394;}})['catch'](function(_0x55b143){logger['error'](_0x30c8('0x55'),_0x55b143);throw _0x55b143;});}return _0x10a394;})[_0x30c8('0x27')](respondWithResult(_0x1cc86f,0xc9))[_0x30c8('0x4d')](handleError(_0x1cc86f,null));};exports[_0x30c8('0x26')]=function(_0x43fc75,_0x569f52){if(_0x43fc75[_0x30c8('0x4f')]['id']){delete _0x43fc75['body']['id'];}return db[_0x30c8('0x31')][_0x30c8('0x53')]({'where':{'id':_0x43fc75[_0x30c8('0x4a')]['id']}})[_0x30c8('0x27')](handleEntityNotFound(_0x569f52,null))[_0x30c8('0x27')](saveUpdates(_0x43fc75[_0x30c8('0x4f')],null))['then'](respondWithResult(_0x569f52,null))[_0x30c8('0x4d')](handleError(_0x569f52,null));};exports['destroy']=function(_0x5bf2cc,_0x54da74){return db[_0x30c8('0x31')][_0x30c8('0x53')]({'where':{'id':_0x5bf2cc[_0x30c8('0x4a')]['id']}})[_0x30c8('0x27')](handleEntityNotFound(_0x54da74,null))[_0x30c8('0x27')](removeEntity(_0x54da74,null))[_0x30c8('0x4d')](handleError(_0x54da74,null));};exports[_0x30c8('0x56')]=function(_0x281049,_0x3ae3cd,_0x11a97b){if(_0x281049['body']['id']){delete _0x281049[_0x30c8('0x4f')]['id'];}return db[_0x30c8('0x31')]['find']({'where':{'id':_0x281049[_0x30c8('0x4a')]['id']}})[_0x30c8('0x27')](handleEntityNotFound(_0x3ae3cd,null))[_0x30c8('0x27')](function(_0xd9a798){if(_0xd9a798){_0x281049[_0x30c8('0x4f')][_0x30c8('0x57')]=_0xd9a798['id'];return db[_0x30c8('0x31')]['create'](_0x281049[_0x30c8('0x4f')]);}})[_0x30c8('0x27')](respondWithResult(_0x3ae3cd,null))[_0x30c8('0x4d')](handleError(_0x3ae3cd,null));};exports['getIntervals']=function(_0x18b574,_0x43c7a1,_0x4ad9fe){var _0x45a8e4={};var _0x58b908={};var _0x90d3d8;var _0x1a3e54;return db['Interval'][_0x30c8('0x58')]({'where':{'id':_0x18b574[_0x30c8('0x4a')]['id']}})[_0x30c8('0x27')](handleEntityNotFound(_0x43c7a1,null))[_0x30c8('0x27')](function(_0x2e7ce3){if(_0x2e7ce3){_0x90d3d8=_0x2e7ce3;_0x58b908[_0x30c8('0x34')]=_[_0x30c8('0x4b')](db['Interval'][_0x30c8('0x4c')]);_0x58b908[_0x30c8('0x36')]=_['keys'](_0x18b574[_0x30c8('0x36')]);_0x58b908[_0x30c8('0x3e')]=_[_0x30c8('0x37')](_0x58b908[_0x30c8('0x34')],_0x58b908['query']);_0x45a8e4[_0x30c8('0x38')]=_[_0x30c8('0x37')](_0x58b908[_0x30c8('0x34')],qs[_0x30c8('0x39')](_0x18b574['query'][_0x30c8('0x39')]));_0x45a8e4[_0x30c8('0x38')]=_0x45a8e4[_0x30c8('0x38')]['length']?_0x45a8e4[_0x30c8('0x38')]:_0x58b908[_0x30c8('0x34')];_0x45a8e4[_0x30c8('0x3c')]=qs['sort'](_0x18b574[_0x30c8('0x36')][_0x30c8('0x3d')]);_0x45a8e4[_0x30c8('0x41')]=qs[_0x30c8('0x3e')](_[_0x30c8('0x3f')](_0x18b574[_0x30c8('0x36')],_0x58b908[_0x30c8('0x3e')]));if(_0x18b574['query']['filter']){_0x45a8e4[_0x30c8('0x41')]=_[_0x30c8('0x42')](_0x45a8e4['where'],{'$or':_[_0x30c8('0x35')](_0x45a8e4[_0x30c8('0x38')],function(_0x548efa){var _0x7f3648={};_0x7f3648[_0x548efa]={'$like':'%'+_0x18b574['query']['filter']+'%'};return _0x7f3648;})});}_0x45a8e4=_[_0x30c8('0x42')]({},_0x45a8e4,_0x18b574['options']);return _0x90d3d8[_0x30c8('0x59')](_0x45a8e4);}})[_0x30c8('0x27')](function(_0x279768){if(_0x279768){_0x1a3e54=_0x279768['length'];if(!_0x18b574[_0x30c8('0x36')][_0x30c8('0x3b')](_0x30c8('0x5a'))){_0x45a8e4[_0x30c8('0x1f')]=qs[_0x30c8('0x1f')](_0x18b574[_0x30c8('0x36')][_0x30c8('0x1f')]);_0x45a8e4[_0x30c8('0x21')]=qs[_0x30c8('0x21')](_0x18b574[_0x30c8('0x36')][_0x30c8('0x21')]);}return _0x90d3d8[_0x30c8('0x59')](_0x45a8e4);}})[_0x30c8('0x27')](function(_0x2b93a1){if(_0x2b93a1){return _0x2b93a1?{'count':_0x1a3e54,'rows':_0x2b93a1}:null;}})[_0x30c8('0x27')](respondWithResult(_0x43c7a1,null))[_0x30c8('0x4d')](handleError(_0x43c7a1,null));};exports[_0x30c8('0x5b')]=function(_0x188a54,_0x4ab728,_0x33fcfc){return db['Interval']['findOne']({'where':{'id':_0x188a54[_0x30c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ab728,null))['then'](function(_0x542838){if(_0x542838){return db['sequelize'][_0x30c8('0x5c')](function(_0x4b9cf7){return db[_0x30c8('0x31')][_0x30c8('0x28')]({'where':{'IntervalId':_0x188a54[_0x30c8('0x4a')]['id']},'transaction':_0x4b9cf7})[_0x30c8('0x27')](function(_0x2ed4af){var _0x31e1ea=_['map'](_0x188a54[_0x30c8('0x4f')],function(_0x4e2712){delete _0x4e2712['id'];_0x4e2712[_0x30c8('0x57')]=_0x188a54[_0x30c8('0x4a')]['id'];return _0x4e2712;});return db[_0x30c8('0x31')][_0x30c8('0x5d')](_0x31e1ea,{'transaction':_0x4b9cf7});});})['then'](function(){return db[_0x30c8('0x31')][_0x30c8('0x47')]({'where':{'IntervalId':_0x188a54[_0x30c8('0x4a')]['id']}});});}})['then'](respondWithResult(_0x4ab728,null))[_0x30c8('0x4d')](handleError(_0x4ab728,null));}; \ No newline at end of file +var _0x4c62=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','rows','catch','show','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error'];(function(_0x292688,_0x4ed5d4){var _0x12f117=function(_0x528959){while(--_0x528959){_0x292688['push'](_0x292688['shift']());}};_0x12f117(++_0x4ed5d4);}(_0x4c62,0x1af));var _0x24c6=function(_0x2b6a11,_0x145bd6){_0x2b6a11=_0x2b6a11-0x0;var _0x586a42=_0x4c62[_0x2b6a11];return _0x586a42;};'use strict';var emlformat=require(_0x24c6('0x0'));var rimraf=require(_0x24c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24c6('0x2'));var rp=require('request-promise');var moment=require(_0x24c6('0x3'));var BPromise=require(_0x24c6('0x4'));var Mustache=require(_0x24c6('0x5'));var util=require(_0x24c6('0x6'));var path=require(_0x24c6('0x7'));var sox=require(_0x24c6('0x8'));var csv=require(_0x24c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24c6('0xa'));var _=require(_0x24c6('0xb'));var squel=require(_0x24c6('0xc'));var crypto=require(_0x24c6('0xd'));var jsforce=require(_0x24c6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x24c6('0xf'));var Papa=require(_0x24c6('0x10'));var Redis=require(_0x24c6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x24c6('0x12'));var hardwareService=require(_0x24c6('0x13'));var logger=require('../../config/logger')(_0x24c6('0x14'));var utils=require('../../config/utils');var config=require(_0x24c6('0x15'));var licenseUtil=require(_0x24c6('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x24c6('0x17'));function respondWithStatusCode(_0x317fa9,_0x28bc95){_0x28bc95=_0x28bc95||0xcc;return function(_0x5965a2){if(_0x5965a2){return _0x317fa9[_0x24c6('0x18')](_0x28bc95);}return _0x317fa9[_0x24c6('0x19')](_0x28bc95)[_0x24c6('0x1a')]();};}function respondWithResult(_0x2581c7,_0x51b244){_0x51b244=_0x51b244||0xc8;return function(_0x216edd){if(_0x216edd){return _0x2581c7[_0x24c6('0x19')](_0x51b244)[_0x24c6('0x1b')](_0x216edd);}};}function respondWithFilteredResult(_0x2b044a,_0x14c14d){return function(_0x3d83a3){if(_0x3d83a3){var _0x3220ac=typeof _0x14c14d['offset']===_0x24c6('0x1c')&&typeof _0x14c14d[_0x24c6('0x1d')]===_0x24c6('0x1c');var _0x1d0a6e=_0x3d83a3[_0x24c6('0x1e')];var _0x3a13ca=_0x3220ac?0x0:_0x14c14d[_0x24c6('0x1f')];var _0x7241f2=_0x3220ac?_0x3d83a3[_0x24c6('0x1e')]:_0x14c14d[_0x24c6('0x1f')]+_0x14c14d[_0x24c6('0x1d')];var _0x5d0cc7;if(_0x7241f2>=_0x1d0a6e){_0x7241f2=_0x1d0a6e;_0x5d0cc7=0xc8;}else{_0x5d0cc7=0xce;}_0x2b044a[_0x24c6('0x19')](_0x5d0cc7);return _0x2b044a[_0x24c6('0x20')](_0x24c6('0x21'),_0x3a13ca+'-'+_0x7241f2+'/'+_0x1d0a6e)['json'](_0x3d83a3);}return null;};}function patchUpdates(_0x515f1c){return function(_0x1c1d13){try{jsonpatch[_0x24c6('0x22')](_0x1c1d13,_0x515f1c,!![]);}catch(_0x25e4bb){return BPromise[_0x24c6('0x23')](_0x25e4bb);}return _0x1c1d13[_0x24c6('0x24')]();};}function saveUpdates(_0x24494a,_0xf4de9a){return function(_0x87d75b){if(_0x87d75b){return _0x87d75b[_0x24c6('0x25')](_0x24494a)[_0x24c6('0x26')](function(_0x480a00){return _0x480a00;});}return null;};}function removeEntity(_0x5ca81b,_0x1b3b4b){return function(_0x1430cb){if(_0x1430cb){return _0x1430cb['destroy']()[_0x24c6('0x26')](function(){var _0x5b9d27=_0x1430cb[_0x24c6('0x27')]({'plain':!![]});var _0x5902fc=_0x24c6('0x28');return db[_0x24c6('0x29')][_0x24c6('0x2a')]({'where':{'type':_0x5902fc,'resourceId':_0x5b9d27['id']}})[_0x24c6('0x26')](function(){return _0x1430cb;});})[_0x24c6('0x26')](function(){_0x5ca81b[_0x24c6('0x19')](0xcc)[_0x24c6('0x1a')]();});}};}function handleEntityNotFound(_0x11616f,_0x280179){return function(_0x56ac4a){if(!_0x56ac4a){_0x11616f['sendStatus'](0x194);}return _0x56ac4a;};}function handleError(_0xa13513,_0x1964dd){_0x1964dd=_0x1964dd||0x1f4;return function(_0x38ed21){logger[_0x24c6('0x2b')](_0x38ed21[_0x24c6('0x2c')]);if(_0x38ed21['name']){delete _0x38ed21[_0x24c6('0x2d')];}_0xa13513[_0x24c6('0x19')](_0x1964dd)['send'](_0x38ed21);};}exports[_0x24c6('0x2e')]=function(_0x19604c,_0x2466ac){var _0x2e0b56={},_0x27c714={},_0x1e4e25={'count':0x0,'rows':[]};var _0x3a9f7f=_[_0x24c6('0x2f')](db['Interval'][_0x24c6('0x30')],function(_0x2b8420){return{'name':_0x2b8420[_0x24c6('0x31')],'type':_0x2b8420[_0x24c6('0x32')][_0x24c6('0x33')]};});_0x27c714[_0x24c6('0x34')]=_['map'](_0x3a9f7f,'name');_0x27c714[_0x24c6('0x35')]=_['keys'](_0x19604c[_0x24c6('0x35')]);_0x27c714[_0x24c6('0x36')]=_['intersection'](_0x27c714[_0x24c6('0x34')],_0x27c714[_0x24c6('0x35')]);_0x2e0b56[_0x24c6('0x37')]=_[_0x24c6('0x38')](_0x27c714[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x19604c[_0x24c6('0x35')][_0x24c6('0x39')]));_0x2e0b56[_0x24c6('0x37')]=_0x2e0b56['attributes'][_0x24c6('0x3a')]?_0x2e0b56[_0x24c6('0x37')]:_0x27c714[_0x24c6('0x34')];if(!_0x19604c['query'][_0x24c6('0x3b')](_0x24c6('0x3c'))){_0x2e0b56[_0x24c6('0x1d')]=qs[_0x24c6('0x1d')](_0x19604c['query'][_0x24c6('0x1d')]);_0x2e0b56['offset']=qs[_0x24c6('0x1f')](_0x19604c[_0x24c6('0x35')]['offset']);}_0x2e0b56[_0x24c6('0x3d')]=qs[_0x24c6('0x3e')](_0x19604c[_0x24c6('0x35')][_0x24c6('0x3e')]);_0x2e0b56[_0x24c6('0x3f')]=qs[_0x24c6('0x36')](_[_0x24c6('0x40')](_0x19604c['query'],_0x27c714[_0x24c6('0x36')]),_0x3a9f7f);if(_0x19604c[_0x24c6('0x35')][_0x24c6('0x41')]){_0x2e0b56['where']=_[_0x24c6('0x42')](_0x2e0b56[_0x24c6('0x3f')],{'$or':_[_0x24c6('0x2f')](_0x3a9f7f,function(_0xb07ea6){if(_0xb07ea6[_0x24c6('0x32')]!==_0x24c6('0x43')){var _0x1c150b={};_0x1c150b[_0xb07ea6['name']]={'$like':'%'+_0x19604c['query'][_0x24c6('0x41')]+'%'};return _0x1c150b;}})});}_0x2e0b56=_[_0x24c6('0x42')]({},_0x2e0b56,_0x19604c[_0x24c6('0x44')]);var _0x3a8dde={'where':_0x2e0b56[_0x24c6('0x3f')]};return db[_0x24c6('0x45')][_0x24c6('0x1e')](_0x3a8dde)[_0x24c6('0x26')](function(_0x482b2b){_0x1e4e25[_0x24c6('0x1e')]=_0x482b2b;if(_0x19604c[_0x24c6('0x35')][_0x24c6('0x46')]){_0x2e0b56[_0x24c6('0x47')]=[{'all':!![]}];}return db[_0x24c6('0x45')]['findAll'](_0x2e0b56);})[_0x24c6('0x26')](function(_0x20f812){_0x1e4e25[_0x24c6('0x48')]=_0x20f812;return _0x1e4e25;})[_0x24c6('0x26')](respondWithFilteredResult(_0x2466ac,_0x2e0b56))[_0x24c6('0x49')](handleError(_0x2466ac,null));};exports[_0x24c6('0x4a')]=function(_0x2fd973,_0x1b6fe1){var _0x2ef35a={'raw':!![],'where':{'id':_0x2fd973[_0x24c6('0x4b')]['id']}},_0x796e96={};_0x796e96['model']=_[_0x24c6('0x4c')](db[_0x24c6('0x45')][_0x24c6('0x30')]);_0x796e96[_0x24c6('0x35')]=_['keys'](_0x2fd973[_0x24c6('0x35')]);_0x796e96[_0x24c6('0x36')]=_['intersection'](_0x796e96[_0x24c6('0x34')],_0x796e96['query']);_0x2ef35a[_0x24c6('0x37')]=_[_0x24c6('0x38')](_0x796e96[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x2fd973['query']['fields']));_0x2ef35a[_0x24c6('0x37')]=_0x2ef35a[_0x24c6('0x37')][_0x24c6('0x3a')]?_0x2ef35a[_0x24c6('0x37')]:_0x796e96[_0x24c6('0x34')];if(_0x2fd973[_0x24c6('0x35')][_0x24c6('0x46')]){_0x2ef35a[_0x24c6('0x47')]=[{'all':!![]}];}_0x2ef35a=_[_0x24c6('0x42')]({},_0x2ef35a,_0x2fd973[_0x24c6('0x44')]);return db[_0x24c6('0x45')][_0x24c6('0x4d')](_0x2ef35a)['then'](handleEntityNotFound(_0x1b6fe1,null))[_0x24c6('0x26')](respondWithResult(_0x1b6fe1,null))[_0x24c6('0x49')](handleError(_0x1b6fe1,null));};exports['create']=function(_0x1ce32f,_0xaf4679){return db[_0x24c6('0x45')]['create'](_0x1ce32f[_0x24c6('0x4e')],{})['then'](function(_0x4722eb){var _0x5f2149=_0x1ce32f[_0x24c6('0x4f')]['get']({'plain':!![]});if(!_0x5f2149)throw new Error(_0x24c6('0x50'));if(_0x5f2149[_0x24c6('0x51')]===_0x24c6('0x4f')){var _0x1c8433=_0x4722eb[_0x24c6('0x27')]({'plain':!![]});var _0x28dc16=_0x24c6('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x28dc16,'userProfileId':_0x5f2149[_0x24c6('0x52')]},'raw':!![]})[_0x24c6('0x26')](function(_0x254701){if(_0x254701&&_0x254701[_0x24c6('0x53')]===0x0){return db['UserProfileResource'][_0x24c6('0x54')]({'name':_0x1c8433['name'],'resourceId':_0x1c8433['id'],'type':_0x254701['name'],'sectionId':_0x254701['id']},{})['then'](function(){return _0x4722eb;});}else{return _0x4722eb;}})[_0x24c6('0x49')](function(_0x3b97e0){logger[_0x24c6('0x2b')](_0x24c6('0x55'),_0x3b97e0);throw _0x3b97e0;});}return _0x4722eb;})[_0x24c6('0x26')](respondWithResult(_0xaf4679,0xc9))['catch'](handleError(_0xaf4679,null));};exports[_0x24c6('0x25')]=function(_0x38014e,_0x414f4d){if(_0x38014e[_0x24c6('0x4e')]['id']){delete _0x38014e['body']['id'];}return db['Interval'][_0x24c6('0x4d')]({'where':{'id':_0x38014e['params']['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x414f4d,null))[_0x24c6('0x26')](saveUpdates(_0x38014e[_0x24c6('0x4e')],null))[_0x24c6('0x26')](respondWithResult(_0x414f4d,null))[_0x24c6('0x49')](handleError(_0x414f4d,null));};exports['destroy']=function(_0x150e21,_0x392539){return db[_0x24c6('0x45')][_0x24c6('0x4d')]({'where':{'id':_0x150e21[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x392539,null))['then'](removeEntity(_0x392539,null))['catch'](handleError(_0x392539,null));};exports[_0x24c6('0x56')]=function(_0x3fdfd3,_0x4a07df,_0x54a69d){if(_0x3fdfd3[_0x24c6('0x4e')]['id']){delete _0x3fdfd3[_0x24c6('0x4e')]['id'];}return db['Interval'][_0x24c6('0x4d')]({'where':{'id':_0x3fdfd3[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x4a07df,null))[_0x24c6('0x26')](function(_0x452137){if(_0x452137){_0x3fdfd3[_0x24c6('0x4e')]['IntervalId']=_0x452137['id'];return db[_0x24c6('0x45')][_0x24c6('0x54')](_0x3fdfd3['body']);}})[_0x24c6('0x26')](respondWithResult(_0x4a07df,null))['catch'](handleError(_0x4a07df,null));};exports[_0x24c6('0x57')]=function(_0x23339f,_0x1762af,_0x22860b){var _0x3dc9c3={};var _0x1735b0={};var _0x37dc97;var _0x3204f2;return db[_0x24c6('0x45')][_0x24c6('0x58')]({'where':{'id':_0x23339f['params']['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x1762af,null))[_0x24c6('0x26')](function(_0x24364f){if(_0x24364f){_0x37dc97=_0x24364f;_0x1735b0[_0x24c6('0x34')]=_[_0x24c6('0x4c')](db['Interval']['rawAttributes']);_0x1735b0['query']=_[_0x24c6('0x4c')](_0x23339f[_0x24c6('0x35')]);_0x1735b0[_0x24c6('0x36')]=_[_0x24c6('0x38')](_0x1735b0[_0x24c6('0x34')],_0x1735b0[_0x24c6('0x35')]);_0x3dc9c3['attributes']=_['intersection'](_0x1735b0[_0x24c6('0x34')],qs[_0x24c6('0x39')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x39')]));_0x3dc9c3['attributes']=_0x3dc9c3[_0x24c6('0x37')][_0x24c6('0x3a')]?_0x3dc9c3[_0x24c6('0x37')]:_0x1735b0[_0x24c6('0x34')];_0x3dc9c3[_0x24c6('0x3d')]=qs[_0x24c6('0x3e')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x3e')]);_0x3dc9c3['where']=qs[_0x24c6('0x36')](_[_0x24c6('0x40')](_0x23339f[_0x24c6('0x35')],_0x1735b0[_0x24c6('0x36')]));if(_0x23339f['query'][_0x24c6('0x41')]){_0x3dc9c3[_0x24c6('0x3f')]=_[_0x24c6('0x42')](_0x3dc9c3[_0x24c6('0x3f')],{'$or':_[_0x24c6('0x2f')](_0x3dc9c3['attributes'],function(_0x223622){var _0x28b920={};_0x28b920[_0x223622]={'$like':'%'+_0x23339f[_0x24c6('0x35')]['filter']+'%'};return _0x28b920;})});}_0x3dc9c3=_['merge']({},_0x3dc9c3,_0x23339f[_0x24c6('0x44')]);return _0x37dc97[_0x24c6('0x57')](_0x3dc9c3);}})['then'](function(_0x5b95d9){if(_0x5b95d9){_0x3204f2=_0x5b95d9[_0x24c6('0x3a')];if(!_0x23339f['query'][_0x24c6('0x3b')](_0x24c6('0x3c'))){_0x3dc9c3[_0x24c6('0x1d')]=qs[_0x24c6('0x1d')](_0x23339f[_0x24c6('0x35')][_0x24c6('0x1d')]);_0x3dc9c3[_0x24c6('0x1f')]=qs[_0x24c6('0x1f')](_0x23339f['query'][_0x24c6('0x1f')]);}return _0x37dc97[_0x24c6('0x57')](_0x3dc9c3);}})[_0x24c6('0x26')](function(_0x2d2bae){if(_0x2d2bae){return _0x2d2bae?{'count':_0x3204f2,'rows':_0x2d2bae}:null;}})[_0x24c6('0x26')](respondWithResult(_0x1762af,null))['catch'](handleError(_0x1762af,null));};exports[_0x24c6('0x59')]=function(_0x4a1897,_0x58c66f,_0x16c2cf){return db[_0x24c6('0x45')][_0x24c6('0x58')]({'where':{'id':_0x4a1897[_0x24c6('0x4b')]['id']}})[_0x24c6('0x26')](handleEntityNotFound(_0x58c66f,null))['then'](function(_0x34974a){if(_0x34974a){return db[_0x24c6('0x5a')][_0x24c6('0x5b')](function(_0x20c664){return db[_0x24c6('0x45')][_0x24c6('0x2a')]({'where':{'IntervalId':_0x4a1897['params']['id']},'transaction':_0x20c664})[_0x24c6('0x26')](function(_0x6dbbd4){var _0x290c76=_[_0x24c6('0x2f')](_0x4a1897[_0x24c6('0x4e')],function(_0x3c29f8){delete _0x3c29f8['id'];_0x3c29f8[_0x24c6('0x5c')]=_0x4a1897['params']['id'];return _0x3c29f8;});return db[_0x24c6('0x45')][_0x24c6('0x5d')](_0x290c76,{'transaction':_0x20c664});});})[_0x24c6('0x26')](function(){return db[_0x24c6('0x45')][_0x24c6('0x5e')]({'where':{'IntervalId':_0x4a1897[_0x24c6('0x4b')]['id']}});});}})[_0x24c6('0x26')](respondWithResult(_0x58c66f,null))[_0x24c6('0x49')](handleError(_0x58c66f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7b852fc..dcd4456 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 _0x57de=['rewrite','interval','string','getIntervals','then','all','ifTime','./interval.attributes','../../components/extensions/rewrite','iftime','define','Interval','tools_intervals'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x57de,0x173));var _0xe57d=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x57de[_0x1fcaf1];return _0x55f464;};'use strict';var attributes=require(_0xe57d('0x0'));var extensions=require(_0xe57d('0x1'));var iftime=require('../../utils/iftime')[_0xe57d('0x2')];module['exports']=function(_0xccb4df){return _0xccb4df[_0xe57d('0x3')](_0xe57d('0x4'),attributes,{'tableName':_0xe57d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5403d5){extensions[_0xe57d('0x6')](_0xccb4df,_0x5403d5);},'afterBulkCreate':function(_0x1c3eaf,_0xc07c4d,_0x12561a){_0x12561a();extensions[_0xe57d('0x6')](_0xccb4df,_0x1c3eaf[0x0]);},'afterUpdate':function(_0x4acf7d){extensions[_0xe57d('0x6')](_0xccb4df,_0x4acf7d);},'afterDestroy':function(_0x400dab){extensions[_0xe57d('0x6')](_0xccb4df,_0x400dab);}},'instanceMethods':{'ifTime':function(_0x2d4ee6=undefined,_0x3bef45=new Date()){if(typeof this[_0xe57d('0x7')]===_0xe57d('0x8')){return iftime(this[_0xe57d('0x7')],_0x2d4ee6,_0x3bef45);}else{return this[_0xe57d('0x9')]()[_0xe57d('0xa')](function(_0x14b470){return Promise[_0xe57d('0xb')](_0x14b470['map'](function(_0x3ba0dc){return _0x3ba0dc[_0xe57d('0xc')](_0x2d4ee6,_0x3bef45);}));})['then'](function(_0x58411c){return _0x58411c['reduce'](function(_0x34174f,_0x3f3e3c){return _0x34174f||_0x3f3e3c;},![]);});}}}});}; \ No newline at end of file +var _0x8e59=['../../utils/iftime','iftime','define','Interval','tools_intervals','rewrite','string','getIntervals','then','ifTime','./interval.attributes','../../components/extensions/rewrite'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8e59,0x14e));var _0x98e5=function(_0x27f737,_0x8c15bd){_0x27f737=_0x27f737-0x0;var _0x43abbc=_0x8e59[_0x27f737];return _0x43abbc;};'use strict';var attributes=require(_0x98e5('0x0'));var extensions=require(_0x98e5('0x1'));var iftime=require(_0x98e5('0x2'))[_0x98e5('0x3')];module['exports']=function(_0x46d32e){return _0x46d32e[_0x98e5('0x4')](_0x98e5('0x5'),attributes,{'tableName':_0x98e5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28b3aa){extensions[_0x98e5('0x7')](_0x46d32e,_0x28b3aa);},'afterBulkCreate':function(_0x52c513,_0x4e8888,_0xc5f9fe){_0xc5f9fe();extensions[_0x98e5('0x7')](_0x46d32e,_0x52c513[0x0]);},'afterUpdate':function(_0x5db2f2){extensions[_0x98e5('0x7')](_0x46d32e,_0x5db2f2);},'afterDestroy':function(_0x429554){extensions[_0x98e5('0x7')](_0x46d32e,_0x429554);}},'instanceMethods':{'ifTime':function(_0x3210a9=undefined,_0x1dae15=new Date()){if(typeof this['interval']===_0x98e5('0x8')){return iftime(this['interval'],_0x3210a9,_0x1dae15);}else{return this[_0x98e5('0x9')]()[_0x98e5('0xa')](function(_0x5984a1){return Promise['all'](_0x5984a1['map'](function(_0x5f55ff){return _0x5f55ff[_0x98e5('0xb')](_0x3210a9,_0x1dae15);}));})[_0x98e5('0xa')](function(_0x25ed11){return _0x25ed11['reduce'](function(_0x544fcc,_0x122bd9){return _0x544fcc||_0x122bd9;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b5ce026..2079eee 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 _0xa0c7=['IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','map','model','include','then','info','debug','catch','error','message','ShowInterval','find','raw','stringify','all','ifTime','reduce'];(function(_0xaf365b,_0x3b1ee2){var _0x608a9d=function(_0x2f0ab7){while(--_0x2f0ab7){_0xaf365b['push'](_0xaf365b['shift']());}};_0x608a9d(++_0x3b1ee2);}(_0xa0c7,0x9b));var _0x7a0c=function(_0x35d551,_0x878ef2){_0x35d551=_0x35d551-0x0;var _0x3bec76=_0xa0c7[_0x35d551];return _0x3bec76;};'use strict';var _=require(_0x7a0c('0x0'));var util=require(_0x7a0c('0x1'));var db=require(_0x7a0c('0x2'))['db'];var iftime=require(_0x7a0c('0x3'))['iftime'];var logger=require(_0x7a0c('0x4'))(_0x7a0c('0x5'));exports[_0x7a0c('0x6')]=function(_0x2d5a1d){var _0x33977f=this;return new Promise(function(_0x49c2d4,_0x15741a){return db[_0x7a0c('0x7')][_0x7a0c('0x8')]({'raw':_0x2d5a1d[_0x7a0c('0x9')]?_0x2d5a1d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d5a1d[_0x7a0c('0x9')]?_0x2d5a1d[_0x7a0c('0x9')][_0x7a0c('0xa')]||null:null,'attributes':_0x2d5a1d[_0x7a0c('0x9')]?_0x2d5a1d[_0x7a0c('0x9')][_0x7a0c('0xb')]||null:null,'limit':_0x2d5a1d['options']?_0x2d5a1d[_0x7a0c('0x9')][_0x7a0c('0xc')]||null:null,'include':_0x2d5a1d[_0x7a0c('0x9')]?_0x2d5a1d[_0x7a0c('0x9')]['include']?_[_0x7a0c('0xd')](_0x2d5a1d[_0x7a0c('0x9')]['include'],function(_0x4f4ace){return{'model':db[_0x4f4ace[_0x7a0c('0xe')]],'as':_0x4f4ace['as'],'attributes':_0x4f4ace[_0x7a0c('0xb')],'include':_0x4f4ace[_0x7a0c('0xf')]?_['map'](_0x4f4ace['include'],function(_0x11e8f5){return{'model':db[_0x11e8f5[_0x7a0c('0xe')]],'as':_0x11e8f5['as'],'attributes':_0x11e8f5['attributes'],'include':_0x11e8f5[_0x7a0c('0xf')]?_[_0x7a0c('0xd')](_0x11e8f5['include'],function(_0x25e059){return{'model':db[_0x25e059[_0x7a0c('0xe')]],'as':_0x25e059['as'],'attributes':_0x25e059['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0c('0x10')](function(_0x13c625){logger[_0x7a0c('0x11')](_0x7a0c('0x6'),_0x2d5a1d);logger[_0x7a0c('0x12')](_0x7a0c('0x6'),_0x2d5a1d,JSON['stringify'](_0x13c625));_0x49c2d4(_0x13c625);})[_0x7a0c('0x13')](function(_0x36cc5d){logger[_0x7a0c('0x14')](_0x7a0c('0x6'),_0x36cc5d[_0x7a0c('0x15')],_0x2d5a1d);_0x15741a(_0x33977f['error'](0x1f4,_0x36cc5d[_0x7a0c('0x15')]));});});};exports[_0x7a0c('0x16')]=function(_0x9cb1df){var _0x29538f=this;return new Promise(function(_0xfbfaaa,_0x2db8a0){return db[_0x7a0c('0x7')][_0x7a0c('0x17')]({'raw':_0x9cb1df[_0x7a0c('0x9')]?_0x9cb1df[_0x7a0c('0x9')][_0x7a0c('0x18')]===undefined?!![]:![]:!![],'where':_0x9cb1df[_0x7a0c('0x9')]?_0x9cb1df[_0x7a0c('0x9')]['where']||null:null,'attributes':_0x9cb1df[_0x7a0c('0x9')]?_0x9cb1df[_0x7a0c('0x9')][_0x7a0c('0xb')]||null:null,'include':_0x9cb1df[_0x7a0c('0x9')]?_0x9cb1df['options'][_0x7a0c('0xf')]?_[_0x7a0c('0xd')](_0x9cb1df['options'][_0x7a0c('0xf')],function(_0x1b8542){return{'model':db[_0x1b8542[_0x7a0c('0xe')]],'as':_0x1b8542['as'],'attributes':_0x1b8542[_0x7a0c('0xb')],'include':_0x1b8542['include']?_[_0x7a0c('0xd')](_0x1b8542[_0x7a0c('0xf')],function(_0x470708){return{'model':db[_0x470708['model']],'as':_0x470708['as'],'attributes':_0x470708['attributes'],'include':_0x470708[_0x7a0c('0xf')]?_[_0x7a0c('0xd')](_0x470708['include'],function(_0x516052){return{'model':db[_0x516052[_0x7a0c('0xe')]],'as':_0x516052['as'],'attributes':_0x516052['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0c('0x10')](function(_0x4e96ee){logger['info']('ShowInterval',_0x9cb1df);logger[_0x7a0c('0x12')](_0x7a0c('0x16'),_0x9cb1df,JSON[_0x7a0c('0x19')](_0x4e96ee));_0xfbfaaa(_0x4e96ee);})[_0x7a0c('0x13')](function(_0x2fe782){logger[_0x7a0c('0x14')]('ShowInterval',_0x2fe782[_0x7a0c('0x15')],_0x9cb1df);_0x2db8a0(_0x29538f[_0x7a0c('0x14')](0x1f4,_0x2fe782[_0x7a0c('0x15')]));});});};function checkArrayOfIntervals(_0x8d2026,_0x4cc644){var _0x3e8912=[];return db['Interval'][_0x7a0c('0x8')]({'where':{'id':_0x8d2026}})[_0x7a0c('0x10')](function(_0x3cbd64){_0x3e8912=_0x3cbd64;return Promise[_0x7a0c('0x1a')](_0x3e8912['map'](function(_0x151863){return _0x151863[_0x7a0c('0x1b')](_0x4cc644);}));})['then'](function(_0x3505ad){var _0x35d826=_0x3505ad[_0x7a0c('0x1c')](function(_0x2f1416,_0x19656c){return _0x2f1416||_0x19656c;},![]);logger['info'](util['format'](_0x7a0c('0x1d'),_0x3e8912[_0x7a0c('0xd')](function(_0x9a2e24){return _0x9a2e24[_0x7a0c('0x1e')];})[_0x7a0c('0x1f')](',\x20'),_0x3e8912[_0x7a0c('0xd')](function(_0x2dbfd2){return _0x2dbfd2['id'];})[_0x7a0c('0x1f')](',\x20')));return _0x35d826;});}function checkSingleInterval(_0xc02a72,_0x5e89e1){return db[_0x7a0c('0x7')][_0x7a0c('0x20')](_0xc02a72)[_0x7a0c('0x10')](function(_0x14f9b9){if(_0x14f9b9){logger[_0x7a0c('0x11')](util[_0x7a0c('0x21')](_0x7a0c('0x22'),_0x14f9b9[_0x7a0c('0x1e')],_0x14f9b9['id']));return _0x14f9b9['ifTime'](_0x5e89e1);}});}exports['IntervalIftime']=function(_0x225cac){var _0x181a8d=_0x225cac[_0x7a0c('0x23')];var _0x5a27a6=Array[_0x7a0c('0x24')](_0x225cac[_0x7a0c('0x25')])?_0x225cac[_0x7a0c('0x25')]:typeof _0x225cac['intervals']===_0x7a0c('0x26')?[_0x225cac[_0x7a0c('0x25')]]:[];var _0x2d5d1c=_0x225cac[_0x7a0c('0x27')]||undefined;var _0x4b7cf8=![];if(_0x5a27a6[_0x7a0c('0x28')]){logger[_0x7a0c('0x11')](util[_0x7a0c('0x21')](_0x7a0c('0x29'),_0x5a27a6[_0x7a0c('0x1f')](';\x20')));}if(_0x2d5d1c){logger[_0x7a0c('0x11')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x2d5d1c));}logger[_0x7a0c('0x12')](_0x7a0c('0x2a'),_0x4b7cf8);logger[_0x7a0c('0x2b')](_0x7a0c('0x2c'),_0x225cac);return Promise[_0x7a0c('0x2d')]()[_0x7a0c('0x10')](function(){if(Array[_0x7a0c('0x24')](_0x181a8d)){return checkArrayOfIntervals(_0x181a8d,_0x2d5d1c);}else if(_0x181a8d){return checkSingleInterval(_0x181a8d,_0x2d5d1c);}})[_0x7a0c('0x10')](function(_0x60685e){var _0x3c3361=_0x5a27a6[_0x7a0c('0x1c')](function(_0x5dbd5a,_0xab5215){return _0x5dbd5a||iftime(_0xab5215,_0x2d5d1c);},![]);_0x4b7cf8=_0x60685e||_0x3c3361;return _0x4b7cf8;})[_0x7a0c('0x13')](function(_0x18d920){logger[_0x7a0c('0x14')](_0x7a0c('0x2c'),_0x225cac,_0x18d920);throw this[_0x7a0c('0x14')](0x1f4,_0x18d920[_0x7a0c('0x15')]);});}; \ No newline at end of file +var _0x5cf5=['../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','find','info','ShowInterval','all','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','lodash','util','../../mysqldb'];(function(_0x556f3d,_0xc8deb){var _0x5526d0=function(_0x2c76b5){while(--_0x2c76b5){_0x556f3d['push'](_0x556f3d['shift']());}};_0x5526d0(++_0xc8deb);}(_0x5cf5,0x189));var _0x55cf=function(_0x51f09a,_0x21607f){_0x51f09a=_0x51f09a-0x0;var _0x23aabf=_0x5cf5[_0x51f09a];return _0x23aabf;};'use strict';var _=require(_0x55cf('0x0'));var util=require(_0x55cf('0x1'));var db=require(_0x55cf('0x2'))['db'];var iftime=require(_0x55cf('0x3'))[_0x55cf('0x4')];var logger=require(_0x55cf('0x5'))(_0x55cf('0x6'));exports[_0x55cf('0x7')]=function(_0x5d0956){var _0x4c890b=this;return new Promise(function(_0x5df6cf,_0x2c6c6f){return db[_0x55cf('0x8')][_0x55cf('0x9')]({'raw':_0x5d0956[_0x55cf('0xa')]?_0x5d0956['options'][_0x55cf('0xb')]===undefined?!![]:![]:!![],'where':_0x5d0956[_0x55cf('0xa')]?_0x5d0956[_0x55cf('0xa')][_0x55cf('0xc')]||null:null,'attributes':_0x5d0956[_0x55cf('0xa')]?_0x5d0956['options'][_0x55cf('0xd')]||null:null,'limit':_0x5d0956['options']?_0x5d0956[_0x55cf('0xa')][_0x55cf('0xe')]||null:null,'include':_0x5d0956['options']?_0x5d0956[_0x55cf('0xa')]['include']?_['map'](_0x5d0956[_0x55cf('0xa')][_0x55cf('0xf')],function(_0x4316fa){return{'model':db[_0x4316fa['model']],'as':_0x4316fa['as'],'attributes':_0x4316fa[_0x55cf('0xd')],'include':_0x4316fa['include']?_[_0x55cf('0x10')](_0x4316fa[_0x55cf('0xf')],function(_0x55f42d){return{'model':db[_0x55f42d[_0x55cf('0x11')]],'as':_0x55f42d['as'],'attributes':_0x55f42d[_0x55cf('0xd')],'include':_0x55f42d[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x55f42d[_0x55cf('0xf')],function(_0x1b7a50){return{'model':db[_0x1b7a50[_0x55cf('0x11')]],'as':_0x1b7a50['as'],'attributes':_0x1b7a50[_0x55cf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x55cf('0x12')](function(_0xa98f59){logger['info'](_0x55cf('0x7'),_0x5d0956);logger[_0x55cf('0x13')](_0x55cf('0x7'),_0x5d0956,JSON[_0x55cf('0x14')](_0xa98f59));_0x5df6cf(_0xa98f59);})[_0x55cf('0x15')](function(_0xf03318){logger[_0x55cf('0x16')]('GetInterval',_0xf03318['message'],_0x5d0956);_0x2c6c6f(_0x4c890b[_0x55cf('0x16')](0x1f4,_0xf03318[_0x55cf('0x17')]));});});};exports['ShowInterval']=function(_0x5b59d8){var _0x49910c=this;return new Promise(function(_0x9f3b6d,_0x42109){return db[_0x55cf('0x8')][_0x55cf('0x18')]({'raw':_0x5b59d8[_0x55cf('0xa')]?_0x5b59d8['options'][_0x55cf('0xb')]===undefined?!![]:![]:!![],'where':_0x5b59d8[_0x55cf('0xa')]?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xc')]||null:null,'attributes':_0x5b59d8['options']?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xd')]||null:null,'include':_0x5b59d8['options']?_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x5b59d8[_0x55cf('0xa')][_0x55cf('0xf')],function(_0x6ba921){return{'model':db[_0x6ba921[_0x55cf('0x11')]],'as':_0x6ba921['as'],'attributes':_0x6ba921[_0x55cf('0xd')],'include':_0x6ba921[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x6ba921[_0x55cf('0xf')],function(_0x4d926e){return{'model':db[_0x4d926e[_0x55cf('0x11')]],'as':_0x4d926e['as'],'attributes':_0x4d926e[_0x55cf('0xd')],'include':_0x4d926e[_0x55cf('0xf')]?_[_0x55cf('0x10')](_0x4d926e[_0x55cf('0xf')],function(_0x1dd833){return{'model':db[_0x1dd833[_0x55cf('0x11')]],'as':_0x1dd833['as'],'attributes':_0x1dd833['attributes']};}):[]};}):[]};}):[]:[]})[_0x55cf('0x12')](function(_0x1381b3){logger[_0x55cf('0x19')](_0x55cf('0x1a'),_0x5b59d8);logger[_0x55cf('0x13')](_0x55cf('0x1a'),_0x5b59d8,JSON[_0x55cf('0x14')](_0x1381b3));_0x9f3b6d(_0x1381b3);})[_0x55cf('0x15')](function(_0x214eb0){logger[_0x55cf('0x16')]('ShowInterval',_0x214eb0[_0x55cf('0x17')],_0x5b59d8);_0x42109(_0x49910c[_0x55cf('0x16')](0x1f4,_0x214eb0[_0x55cf('0x17')]));});});};function checkArrayOfIntervals(_0x3470b3,_0x13de2b){var _0x37dc5f=[];return db[_0x55cf('0x8')][_0x55cf('0x9')]({'where':{'id':_0x3470b3}})[_0x55cf('0x12')](function(_0x5e5f15){_0x37dc5f=_0x5e5f15;return Promise[_0x55cf('0x1b')](_0x37dc5f[_0x55cf('0x10')](function(_0x28f427){return _0x28f427[_0x55cf('0x1c')](_0x13de2b);}));})['then'](function(_0x11fefd){var _0xca51b0=_0x11fefd[_0x55cf('0x1d')](function(_0x2bfabe,_0x3f91e6){return _0x2bfabe||_0x3f91e6;},![]);logger[_0x55cf('0x19')](util[_0x55cf('0x1e')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x37dc5f['map'](function(_0x4b39c3){return _0x4b39c3[_0x55cf('0x1f')];})[_0x55cf('0x20')](',\x20'),_0x37dc5f[_0x55cf('0x10')](function(_0x4456f7){return _0x4456f7['id'];})[_0x55cf('0x20')](',\x20')));return _0xca51b0;});}function checkSingleInterval(_0x1e6a94,_0x5458bf){return db[_0x55cf('0x8')][_0x55cf('0x21')](_0x1e6a94)[_0x55cf('0x12')](function(_0x10b265){if(_0x10b265){logger[_0x55cf('0x19')](util['format'](_0x55cf('0x22'),_0x10b265[_0x55cf('0x1f')],_0x10b265['id']));return _0x10b265[_0x55cf('0x1c')](_0x5458bf);}});}exports[_0x55cf('0x23')]=function(_0x2452ae){var _0x1cd7ed=_0x2452ae['intervalIds'];var _0x992443=Array[_0x55cf('0x24')](_0x2452ae[_0x55cf('0x25')])?_0x2452ae[_0x55cf('0x25')]:typeof _0x2452ae[_0x55cf('0x25')]===_0x55cf('0x26')?[_0x2452ae[_0x55cf('0x25')]]:[];var _0x29d51c=_0x2452ae[_0x55cf('0x27')]||undefined;var _0xea2734=![];if(_0x992443[_0x55cf('0x28')]){logger[_0x55cf('0x19')](util[_0x55cf('0x1e')](_0x55cf('0x29'),_0x992443['join'](';\x20')));}if(_0x29d51c){logger[_0x55cf('0x19')](util[_0x55cf('0x1e')](_0x55cf('0x2a'),_0x29d51c));}logger[_0x55cf('0x13')](_0x55cf('0x2b'),_0xea2734);logger['silly']('IntervalIftime',_0x2452ae);return Promise['resolve']()[_0x55cf('0x12')](function(){if(Array[_0x55cf('0x24')](_0x1cd7ed)){return checkArrayOfIntervals(_0x1cd7ed,_0x29d51c);}else if(_0x1cd7ed){return checkSingleInterval(_0x1cd7ed,_0x29d51c);}})[_0x55cf('0x12')](function(_0x564555){var _0x24facb=_0x992443['reduce'](function(_0x56426e,_0x51c5dd){return _0x56426e||iftime(_0x51c5dd,_0x29d51c);},![]);_0xea2734=_0x564555||_0x24facb;return _0xea2734;})[_0x55cf('0x15')](function(_0x21ff7b){logger[_0x55cf('0x16')](_0x55cf('0x23'),_0x2452ae,_0x21ff7b);throw this['error'](0x1f4,_0x21ff7b[_0x55cf('0x17')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 13c8745..690d5e7 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x0b0e[_0x4599b6];return _0x2e014c;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xe208eb,_0x4bdc87){var _0x5d8d28=function(_0x3b73d){while(--_0x3b73d){_0xe208eb['push'](_0xe208eb['shift']());}};_0x5d8d28(++_0x4bdc87);}(_0xdb28,0x106));var _0x8db2=function(_0x4e77c8,_0x1d85ca){_0x4e77c8=_0x4e77c8-0x0;var _0x26c29c=_0xdb28[_0x4e77c8];return _0x26c29c;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3004346..e921fb6 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 _0x5a17=['socket','connection','bluebird','https','../../config/logger','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_10102','/rest/api/2/issue','POST','application/json','stringify','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','remoteAddress'];(function(_0x16896a,_0x1bf61c){var _0x28e995=function(_0x12be65){while(--_0x12be65){_0x16896a['push'](_0x16896a['shift']());}};_0x28e995(++_0x1bf61c);}(_0x5a17,0x1ba));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x75a1('0x0'));var https=require(_0x75a1('0x1'));var logger=require(_0x75a1('0x2'))('api');var USERNAME='support';var PASSWORD=_0x75a1('0x3');function openIssue(_0x1e9c73,_0x10b580){var _0x436be5={'fields':{'project':{'key':_0x1e9c73['key']||_0x75a1('0x4')},'summary':(_0x1e9c73['summary']||_0x75a1('0x5'))+_0x75a1('0x6')+_0x1e9c73['ip'],'description':_0x1e9c73['description']||JSON['stringify'](_0x1e9c73),'issuetype':{'name':_0x1e9c73[_0x75a1('0x7')]||_0x75a1('0x8')}}};_0x436be5[_0x75a1('0x9')][_0x75a1('0xa')]=_0x1e9c73[_0x75a1('0xb')];_0x436be5[_0x75a1('0x9')]['customfield_11501']=_0x1e9c73[_0x75a1('0xc')];_0x436be5[_0x75a1('0x9')][_0x75a1('0xd')]=_0x1e9c73[_0x75a1('0xe')];_0x436be5['fields']['customfield_11503']=_0x1e9c73[_0x75a1('0xf')];_0x436be5[_0x75a1('0x9')]['customfield_11504']=_0x1e9c73['reason'];_0x436be5[_0x75a1('0x9')][_0x75a1('0x10')]=_0x1e9c73['ip'];var _0x5a5ef3={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x75a1('0x11'),'method':_0x75a1('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x75a1('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x1c3d8f=JSON[_0x75a1('0x14')](_0x436be5);var _0x132e45=https[_0x75a1('0x15')](_0x5a5ef3,function(_0x18f01a){_0x18f01a[_0x75a1('0x16')](_0x75a1('0x17'));var _0x1f720f='';_0x18f01a['on']('data',function(_0x4b7a1e){_0x1f720f+=_0x4b7a1e;});_0x18f01a['on'](_0x75a1('0x18'),function(){if(_0x10b580){return _0x10b580[_0x75a1('0x19')](_0x18f01a[_0x75a1('0x1a')])[_0x75a1('0x1b')](JSON[_0x75a1('0x1c')](_0x1f720f));}});});_0x132e45['on'](_0x75a1('0x1d'),function(_0xa1a1ec){if(_0x10b580){return _0x10b580[_0x75a1('0x19')](0x1f4)[_0x75a1('0x1b')]({'errors':[{'message':_0x75a1('0x1e'),'type':_0x75a1('0x1f')}]});}});_0x132e45['write'](_0x1c3d8f);_0x132e45[_0x75a1('0x18')]();}exports[_0x75a1('0x20')]=openIssue;exports[_0x75a1('0x21')]=function(_0x5cc135,_0xe496e9){_0x5cc135[_0x75a1('0x22')]['ip']=_0x5cc135[_0x75a1('0x23')][_0x75a1('0x24')]||_0x5cc135['connection'][_0x75a1('0x25')]||_0x5cc135[_0x75a1('0x26')][_0x75a1('0x25')]||_0x5cc135[_0x75a1('0x27')][_0x75a1('0x26')][_0x75a1('0x25')];return openIssue(_0x5cc135[_0x75a1('0x22')],_0xe496e9);}; \ No newline at end of file +var _0x0543=['newToken','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','setEncoding','utf8','data','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','../../config/logger','key','summary','Report','description','stringify','fields','email','oldToken','customfield_11502'];(function(_0x204a28,_0x359c57){var _0x2d8e3d=function(_0xbfd9b6){while(--_0xbfd9b6){_0x204a28['push'](_0x204a28['shift']());}};_0x2d8e3d(++_0x359c57);}(_0x0543,0x90));var _0x3054=function(_0x34f8b0,_0x41c73c){_0x34f8b0=_0x34f8b0-0x0;var _0x48aaab=_0x0543[_0x34f8b0];return _0x48aaab;};'use strict';var BPromise=require(_0x3054('0x0'));var https=require(_0x3054('0x1'));var logger=require(_0x3054('0x2'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x2b95ef,_0x29d86a){var _0x52bf1d={'fields':{'project':{'key':_0x2b95ef[_0x3054('0x3')]||'MOTGUI'},'summary':(_0x2b95ef[_0x3054('0x4')]||_0x3054('0x5'))+'\x20from\x20'+_0x2b95ef['ip'],'description':_0x2b95ef[_0x3054('0x6')]||JSON[_0x3054('0x7')](_0x2b95ef),'issuetype':{'name':_0x2b95ef['issuetype']||'Bug'}}};_0x52bf1d[_0x3054('0x8')]['customfield_11500']=_0x2b95ef[_0x3054('0x9')];_0x52bf1d[_0x3054('0x8')]['customfield_11501']=_0x2b95ef[_0x3054('0xa')];_0x52bf1d[_0x3054('0x8')][_0x3054('0xb')]=_0x2b95ef[_0x3054('0xc')];_0x52bf1d[_0x3054('0x8')]['customfield_11503']=_0x2b95ef[_0x3054('0xd')];_0x52bf1d[_0x3054('0x8')]['customfield_11504']=_0x2b95ef[_0x3054('0xe')];_0x52bf1d[_0x3054('0x8')][_0x3054('0xf')]=_0x2b95ef['ip'];var _0x447f92={'host':_0x3054('0x10'),'port':0x1bb,'path':_0x3054('0x11'),'method':_0x3054('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x3054('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x3054('0x14'))}};var _0xe9125e=JSON[_0x3054('0x7')](_0x52bf1d);var _0x353017=https[_0x3054('0x15')](_0x447f92,function(_0x120820){_0x120820[_0x3054('0x16')](_0x3054('0x17'));var _0x406b61='';_0x120820['on'](_0x3054('0x18'),function(_0xdd7e3a){_0x406b61+=_0xdd7e3a;});_0x120820['on']('end',function(){if(_0x29d86a){return _0x29d86a[_0x3054('0x19')](_0x120820[_0x3054('0x1a')])[_0x3054('0x1b')](JSON[_0x3054('0x1c')](_0x406b61));}});});_0x353017['on']('error',function(_0x55304e){if(_0x29d86a){return _0x29d86a[_0x3054('0x19')](0x1f4)[_0x3054('0x1b')]({'errors':[{'message':_0x3054('0x1d'),'type':'api.jira'}]});}});_0x353017[_0x3054('0x1e')](_0xe9125e);_0x353017[_0x3054('0x1f')]();}exports[_0x3054('0x20')]=openIssue;exports[_0x3054('0x21')]=function(_0xd2bd53,_0x26474d){_0xd2bd53[_0x3054('0x22')]['ip']=_0xd2bd53[_0x3054('0x23')][_0x3054('0x24')]||_0xd2bd53['connection'][_0x3054('0x25')]||_0xd2bd53[_0x3054('0x26')][_0x3054('0x25')]||_0xd2bd53['connection'][_0x3054('0x26')][_0x3054('0x25')];return openIssue(_0xd2bd53[_0x3054('0x22')],_0x26474d);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ebc07c3..897d535 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 _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x4fa36a,_0xd7c189){var _0x279b13=function(_0x2986dd){while(--_0x2986dd){_0x4fa36a['push'](_0x4fa36a['shift']());}};_0x279b13(++_0xd7c189);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xff93c8,_0x336887){_0xff93c8=_0xff93c8-0x0;var _0xcbbc50=_0x6f0d[_0xff93c8];return _0xcbbc50;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file +var _0xd64b=['../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x196c91,_0x45f8ad){var _0x5268d3=function(_0x2b5215){while(--_0x2b5215){_0x196c91['push'](_0x196c91['shift']());}};_0x5268d3(++_0x45f8ad);}(_0xd64b,0xc1));var _0xbd64=function(_0x24b8ec,_0x3c8c5b){_0x24b8ec=_0x24b8ec-0x0;var _0x1d1b63=_0xd64b[_0x24b8ec];return _0x1d1b63;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0xd')]('/',auth[_0xbd64('0xa')](),controller[_0xbd64('0xe')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xf')]);router[_0xbd64('0x10')]('/:id',auth[_0xbd64('0xa')](),controller['destroy']);module[_0xbd64('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 830afe3..6bce784 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 _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x6ece9f,_0x1e7d89){_0x6ece9f=_0x6ece9f-0x0;var _0x396b12=_0x7a54[_0x6ece9f];return _0x396b12;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x3790cc,_0x25678e){_0x3790cc=_0x3790cc-0x0;var _0x578534=_0x7a54[_0x3790cc];return _0x578534;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 6971f97..55067c7 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 _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x233de7,_0x109f02){var _0x26940c=function(_0x474b79){while(--_0x474b79){_0x233de7['push'](_0x233de7['shift']());}};_0x26940c(++_0x109f02);}(_0x1db9,0x176));var _0x91db=function(_0x242321,_0x49bbc7){_0x242321=_0x242321-0x0;var _0x2ebbc0=_0x1db9[_0x242321];return _0x2ebbc0;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['JscriptyAnswerReport'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file +var _0xb091=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x35d770,_0x4b8b78){var _0x2e1b6f=function(_0x33ef12){while(--_0x33ef12){_0x35d770['push'](_0x35d770['shift']());}};_0x2e1b6f(++_0x4b8b78);}(_0xb091,0x16e));var _0x1b09=function(_0x22bc26,_0xad97de){_0x22bc26=_0x22bc26-0x0;var _0x36fffe=_0xb091[_0x22bc26];return _0x36fffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];function respondWithStatusCode(_0x4284ad,_0x3ae4a0){_0x3ae4a0=_0x3ae4a0||0xcc;return function(_0x1046f8){if(_0x1046f8){return _0x4284ad[_0x1b09('0x18')](_0x3ae4a0);}return _0x4284ad[_0x1b09('0x19')](_0x3ae4a0)[_0x1b09('0x1a')]();};}function respondWithResult(_0x58392d,_0x37fdb2){_0x37fdb2=_0x37fdb2||0xc8;return function(_0x515ade){if(_0x515ade){return _0x58392d[_0x1b09('0x19')](_0x37fdb2)[_0x1b09('0x1b')](_0x515ade);}};}function respondWithFilteredResult(_0x11ab46,_0x37673e){return function(_0x10b7eb){if(_0x10b7eb){var _0x1dc96b=typeof _0x37673e[_0x1b09('0x1c')]===_0x1b09('0x1d')&&typeof _0x37673e[_0x1b09('0x1e')]===_0x1b09('0x1d');var _0x311158=_0x10b7eb[_0x1b09('0x1f')];var _0x646575=_0x1dc96b?0x0:_0x37673e['offset'];var _0x214c6b=_0x1dc96b?_0x10b7eb[_0x1b09('0x1f')]:_0x37673e['offset']+_0x37673e['limit'];var _0xe93ac4;if(_0x214c6b>=_0x311158){_0x214c6b=_0x311158;_0xe93ac4=0xc8;}else{_0xe93ac4=0xce;}_0x11ab46['status'](_0xe93ac4);return _0x11ab46[_0x1b09('0x20')]('Content-Range',_0x646575+'-'+_0x214c6b+'/'+_0x311158)[_0x1b09('0x1b')](_0x10b7eb);}return null;};}function patchUpdates(_0x4b2eab){return function(_0x2d6dba){try{jsonpatch[_0x1b09('0x21')](_0x2d6dba,_0x4b2eab,!![]);}catch(_0x29dd70){return BPromise[_0x1b09('0x22')](_0x29dd70);}return _0x2d6dba[_0x1b09('0x23')]();};}function saveUpdates(_0x39e569,_0x48b803){return function(_0x5e2806){if(_0x5e2806){return _0x5e2806[_0x1b09('0x24')](_0x39e569)[_0x1b09('0x25')](function(_0x4ce7dc){return _0x4ce7dc;});}return null;};}function removeEntity(_0x3c0496,_0x11d0d5){return function(_0x6e132c){if(_0x6e132c){return _0x6e132c[_0x1b09('0x26')]()['then'](function(){_0x3c0496[_0x1b09('0x19')](0xcc)[_0x1b09('0x1a')]();});}};}function handleEntityNotFound(_0x4936d0,_0x2d3b86){return function(_0x472d30){if(!_0x472d30){_0x4936d0['sendStatus'](0x194);}return _0x472d30;};}function handleError(_0x13c89c,_0x108d80){_0x108d80=_0x108d80||0x1f4;return function(_0xa71272){logger[_0x1b09('0x27')](_0xa71272['stack']);if(_0xa71272[_0x1b09('0x28')]){delete _0xa71272[_0x1b09('0x28')];}_0x13c89c['status'](_0x108d80)[_0x1b09('0x29')](_0xa71272);};}exports[_0x1b09('0x2a')]=function(_0x26befb,_0x1cbbd5){var _0x11098e={},_0x1aa179={},_0x34620f={'count':0x0,'rows':[]};var _0x5a503d=_[_0x1b09('0x2b')](db[_0x1b09('0x2c')]['rawAttributes'],function(_0x34d912){return{'name':_0x34d912[_0x1b09('0x2d')],'type':_0x34d912[_0x1b09('0x2e')][_0x1b09('0x2f')]};});_0x1aa179[_0x1b09('0x30')]=_['map'](_0x5a503d,_0x1b09('0x28'));_0x1aa179['query']=_[_0x1b09('0x31')](_0x26befb['query']);_0x1aa179[_0x1b09('0x32')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],_0x1aa179[_0x1b09('0x34')]);_0x11098e[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1aa179[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x36')]));_0x11098e['attributes']=_0x11098e[_0x1b09('0x35')][_0x1b09('0x37')]?_0x11098e[_0x1b09('0x35')]:_0x1aa179['model'];if(!_0x26befb[_0x1b09('0x34')][_0x1b09('0x38')](_0x1b09('0x39'))){_0x11098e[_0x1b09('0x1e')]=qs[_0x1b09('0x1e')](_0x26befb[_0x1b09('0x34')][_0x1b09('0x1e')]);_0x11098e[_0x1b09('0x1c')]=qs['offset'](_0x26befb[_0x1b09('0x34')]['offset']);}_0x11098e[_0x1b09('0x3a')]=qs['sort'](_0x26befb[_0x1b09('0x34')][_0x1b09('0x3b')]);_0x11098e[_0x1b09('0x3c')]=qs[_0x1b09('0x32')](_[_0x1b09('0x3d')](_0x26befb[_0x1b09('0x34')],_0x1aa179[_0x1b09('0x32')]),_0x5a503d);if(_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]){_0x11098e[_0x1b09('0x3c')]=_[_0x1b09('0x3f')](_0x11098e[_0x1b09('0x3c')],{'$or':_[_0x1b09('0x2b')](_0x5a503d,function(_0x4bd6fa){if(_0x4bd6fa['type']!==_0x1b09('0x40')){var _0xb2ef05={};_0xb2ef05[_0x4bd6fa[_0x1b09('0x28')]]={'$like':'%'+_0x26befb[_0x1b09('0x34')][_0x1b09('0x3e')]+'%'};return _0xb2ef05;}})});}_0x11098e=_[_0x1b09('0x3f')]({},_0x11098e,_0x26befb[_0x1b09('0x41')]);var _0x33d697={'where':_0x11098e['where']};return db['JscriptyAnswerReport'][_0x1b09('0x1f')](_0x33d697)['then'](function(_0x966873){_0x34620f[_0x1b09('0x1f')]=_0x966873;if(_0x26befb[_0x1b09('0x34')]['includeAll']){_0x11098e[_0x1b09('0x42')]=[{'all':!![]}];}return db[_0x1b09('0x2c')][_0x1b09('0x43')](_0x11098e);})['then'](function(_0x3edcde){_0x34620f[_0x1b09('0x44')]=_0x3edcde;return _0x34620f;})[_0x1b09('0x25')](respondWithFilteredResult(_0x1cbbd5,_0x11098e))[_0x1b09('0x45')](handleError(_0x1cbbd5,null));};exports['show']=function(_0x36f814,_0x2b2341){var _0x4c0559={'raw':!![],'where':{'id':_0x36f814[_0x1b09('0x46')]['id']}},_0x1c7ec6={};_0x1c7ec6['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x1c7ec6[_0x1b09('0x34')]=_[_0x1b09('0x31')](_0x36f814[_0x1b09('0x34')]);_0x1c7ec6['filters']=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],_0x1c7ec6['query']);_0x4c0559[_0x1b09('0x35')]=_[_0x1b09('0x33')](_0x1c7ec6[_0x1b09('0x30')],qs[_0x1b09('0x36')](_0x36f814[_0x1b09('0x34')][_0x1b09('0x36')]));_0x4c0559[_0x1b09('0x35')]=_0x4c0559[_0x1b09('0x35')][_0x1b09('0x37')]?_0x4c0559[_0x1b09('0x35')]:_0x1c7ec6['model'];if(_0x36f814[_0x1b09('0x34')][_0x1b09('0x47')]){_0x4c0559[_0x1b09('0x42')]=[{'all':!![]}];}_0x4c0559=_['merge']({},_0x4c0559,_0x36f814[_0x1b09('0x41')]);return db['JscriptyAnswerReport'][_0x1b09('0x48')](_0x4c0559)[_0x1b09('0x25')](handleEntityNotFound(_0x2b2341,null))['then'](respondWithResult(_0x2b2341,null))[_0x1b09('0x45')](handleError(_0x2b2341,null));};exports[_0x1b09('0x49')]=function(_0x3732fb,_0x25443a){return db[_0x1b09('0x2c')][_0x1b09('0x49')](_0x3732fb['body'],{})[_0x1b09('0x25')](respondWithResult(_0x25443a,0xc9))['catch'](handleError(_0x25443a,null));};exports[_0x1b09('0x24')]=function(_0x58a158,_0x50a66c){if(_0x58a158[_0x1b09('0x4a')]['id']){delete _0x58a158[_0x1b09('0x4a')]['id'];}return db[_0x1b09('0x2c')][_0x1b09('0x48')]({'where':{'id':_0x58a158[_0x1b09('0x46')]['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x50a66c,null))[_0x1b09('0x25')](saveUpdates(_0x58a158[_0x1b09('0x4a')],null))['then'](respondWithResult(_0x50a66c,null))[_0x1b09('0x45')](handleError(_0x50a66c,null));};exports[_0x1b09('0x26')]=function(_0x21b4c2,_0x481147){return db['JscriptyAnswerReport'][_0x1b09('0x48')]({'where':{'id':_0x21b4c2['params']['id']}})[_0x1b09('0x25')](handleEntityNotFound(_0x481147,null))[_0x1b09('0x25')](removeEntity(_0x481147,null))['catch'](handleError(_0x481147,null));};exports[_0x1b09('0x4b')]=function(_0x6f4589,_0x5941df){return db[_0x1b09('0x2c')][_0x1b09('0x4b')]()[_0x1b09('0x25')](respondWithResult(_0x5941df,null))[_0x1b09('0x45')](handleError(_0x5941df,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cd80bca..2cc58ca 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 _0xd0df=['bluebird','path','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment'];(function(_0x2f6c22,_0xf30682){var _0x5f2a3e=function(_0x866657){while(--_0x866657){_0x2f6c22['push'](_0x2f6c22['shift']());}};_0x5f2a3e(++_0xf30682);}(_0xd0df,0x1a1));var _0xfd0d=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xd0df[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0xfd0d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfd0d('0x1'));var moment=require(_0xfd0d('0x2'));var BPromise=require(_0xfd0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd0d('0x4'));var rimraf=require('rimraf');var config=require(_0xfd0d('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xfd0d('0x6')]=function(_0x341666,_0x1300dc){return _0x341666[_0xfd0d('0x7')](_0xfd0d('0x8'),attributes,{'tableName':_0xfd0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e86=['../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','util','../../config/logger','moment','request-promise'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x8e86,0xbc));var _0x68e8=function(_0x9c53e9,_0x454d0a){_0x9c53e9=_0x9c53e9-0x0;var _0x931e01=_0x8e86[_0x9c53e9];return _0x931e01;};'use strict';var _=require('lodash');var util=require(_0x68e8('0x0'));var logger=require(_0x68e8('0x1'))('api');var moment=require(_0x68e8('0x2'));var BPromise=require('bluebird');var rp=require(_0x68e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x68e8('0x4'));var attributes=require(_0x68e8('0x5'));module[_0x68e8('0x6')]=function(_0x539268,_0x585b0b){return _0x539268['define']('JscriptyAnswerReport',attributes,{'tableName':_0x68e8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 697511c..38aca3b 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 _0x3275=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x37cd38,_0x23a533){var _0x22c9f0=function(_0x5295be){while(--_0x5295be){_0x37cd38['push'](_0x37cd38['shift']());}};_0x22c9f0(++_0x23a533);}(_0x3275,0x1e1));var _0x5327=function(_0x204a28,_0x359c57){_0x204a28=_0x204a28-0x0;var _0x2d8e3d=_0x3275[_0x204a28];return _0x2d8e3d;};'use strict';var _=require(_0x5327('0x0'));var util=require(_0x5327('0x1'));var moment=require('moment');var BPromise=require(_0x5327('0x2'));var rs=require(_0x5327('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5327('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5327('0x5'))(_0x5327('0x6'));var config=require('../../config/environment');var jayson=require(_0x5327('0x7'));var client=jayson[_0x5327('0x8')][_0x5327('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37f7ef,_0x58443b,_0x4d0be0){return new BPromise(function(_0x2d9a3e,_0x5cf8d1){return client[_0x5327('0xa')](_0x37f7ef,_0x4d0be0)[_0x5327('0xb')](function(_0x2b8ef5){logger[_0x5327('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x58443b,_0x5327('0xd'));logger[_0x5327('0xe')](_0x5327('0xf'),_0x58443b,'request\x20sent',JSON[_0x5327('0x10')](_0x2b8ef5));if(_0x2b8ef5['error']){if(_0x2b8ef5[_0x5327('0x11')]['code']===0x1f4){logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x2b8ef5[_0x5327('0x11')][_0x5327('0x13')]);return _0x5cf8d1(_0x2b8ef5['error'][_0x5327('0x13')]);}logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x2b8ef5[_0x5327('0x11')][_0x5327('0x13')]);return _0x2d9a3e(_0x2b8ef5['error'][_0x5327('0x13')]);}else{logger[_0x5327('0xc')](_0x5327('0x12'),_0x58443b,_0x5327('0xd'));_0x2d9a3e(_0x2b8ef5[_0x5327('0x14')][_0x5327('0x13')]);}})['catch'](function(_0x1e04c3){logger[_0x5327('0x11')](_0x5327('0x12'),_0x58443b,_0x1e04c3);_0x5cf8d1(_0x1e04c3);});});} \ No newline at end of file +var _0x4d65=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x28cc28,_0x371d60){var _0x5955a7=function(_0x28a891){while(--_0x28a891){_0x28cc28['push'](_0x28cc28['shift']());}};_0x5955a7(++_0x371d60);}(_0x4d65,0x10a));var _0x54d6=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4d65[_0x521929];return _0x632436;};'use strict';var _=require(_0x54d6('0x0'));var util=require('util');var moment=require(_0x54d6('0x1'));var BPromise=require(_0x54d6('0x2'));var rs=require(_0x54d6('0x3'));var fs=require('fs');var Redis=require(_0x54d6('0x4'));var db=require(_0x54d6('0x5'))['db'];var utils=require(_0x54d6('0x6'));var logger=require('../../config/logger')(_0x54d6('0x7'));var config=require(_0x54d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54d6('0x9')][_0x54d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10a95b,_0x53b65d,_0x15dd9d){return new BPromise(function(_0x2587d6,_0x381caa){return client[_0x54d6('0xb')](_0x10a95b,_0x15dd9d)[_0x54d6('0xc')](function(_0x1e4ba1){logger[_0x54d6('0xd')](_0x54d6('0xe'),_0x53b65d,_0x54d6('0xf'));logger[_0x54d6('0x10')](_0x54d6('0x11'),_0x53b65d,_0x54d6('0xf'),JSON[_0x54d6('0x12')](_0x1e4ba1));if(_0x1e4ba1['error']){if(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x14')]===0x1f4){logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x1e4ba1['error'][_0x54d6('0x15')]);return _0x381caa(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x15')]);}logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x1e4ba1['error'][_0x54d6('0x15')]);return _0x2587d6(_0x1e4ba1[_0x54d6('0x13')][_0x54d6('0x15')]);}else{logger[_0x54d6('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x53b65d,_0x54d6('0xf'));_0x2587d6(_0x1e4ba1[_0x54d6('0x16')][_0x54d6('0x15')]);}})[_0x54d6('0x17')](function(_0x282e89){logger[_0x54d6('0x13')](_0x54d6('0xe'),_0x53b65d,_0x282e89);_0x381caa(_0x282e89);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a592117..eca9c9a 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 _0x901b=['delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update'];(function(_0x521f6f,_0x22711e){var _0x236af4=function(_0x57358e){while(--_0x57358e){_0x521f6f['push'](_0x521f6f['shift']());}};_0x236af4(++_0x22711e);}(_0x901b,0x88));var _0xb901=function(_0x38c401,_0x3b088e){_0x38c401=_0x38c401-0x0;var _0x12ed59=_0x901b[_0x38c401];return _0x12ed59;};'use strict';var multer=require('multer');var util=require(_0xb901('0x0'));var path=require(_0xb901('0x1'));var timeout=require(_0xb901('0x2'));var express=require(_0xb901('0x3'));var router=express[_0xb901('0x4')]();var fs_extra=require(_0xb901('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb901('0x6'));var config=require(_0xb901('0x7'));var controller=require(_0xb901('0x8'));router['get']('/',auth[_0xb901('0x9')](),controller[_0xb901('0xa')]);router[_0xb901('0xb')](_0xb901('0xc'),auth[_0xb901('0x9')](),controller[_0xb901('0xd')]);router['get'](_0xb901('0xe'),auth[_0xb901('0x9')](),controller['getSessions']);router[_0xb901('0xb')](_0xb901('0xf'),auth['isAuthenticated'](),controller[_0xb901('0x10')]);router[_0xb901('0xb')](_0xb901('0x11'),auth['isAuthenticated'](),timeout(_0xb901('0x12')),controller[_0xb901('0x13')]);router['post']('/',auth[_0xb901('0x9')](),controller[_0xb901('0x14')]);router[_0xb901('0x15')](_0xb901('0x16'),auth[_0xb901('0x9')](),controller[_0xb901('0x17')]);router[_0xb901('0x18')]('/:id',auth[_0xb901('0x9')](),controller[_0xb901('0x19')]);router[_0xb901('0x1a')](_0xb901('0xc'),auth[_0xb901('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x04c2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','util','connect-timeout','express','fs-extra'];(function(_0x3c4024,_0x1fb7c9){var _0x20f126=function(_0x572d54){while(--_0x572d54){_0x3c4024['push'](_0x3c4024['shift']());}};_0x20f126(++_0x1fb7c9);}(_0x04c2,0xb2));var _0x204c=function(_0xd8ed58,_0x553238){_0xd8ed58=_0xd8ed58-0x0;var _0x36352b=_0x04c2[_0xd8ed58];return _0x36352b;};'use strict';var multer=require('multer');var util=require(_0x204c('0x0'));var path=require('path');var timeout=require(_0x204c('0x1'));var express=require(_0x204c('0x2'));var router=express['Router']();var fs_extra=require(_0x204c('0x3'));var auth=require(_0x204c('0x4'));var interaction=require(_0x204c('0x5'));var config=require(_0x204c('0x6'));var controller=require(_0x204c('0x7'));router[_0x204c('0x8')]('/',auth[_0x204c('0x9')](),controller[_0x204c('0xa')]);router['get'](_0x204c('0xb'),auth[_0x204c('0x9')](),controller[_0x204c('0xc')]);router[_0x204c('0x8')](_0x204c('0xd'),auth[_0x204c('0x9')](),controller[_0x204c('0xe')]);router[_0x204c('0x8')]('/:id/answers',auth[_0x204c('0x9')](),controller[_0x204c('0xf')]);router['get'](_0x204c('0x10'),auth[_0x204c('0x9')](),timeout(_0x204c('0x11')),controller['getSummary']);router[_0x204c('0x12')]('/',auth[_0x204c('0x9')](),controller[_0x204c('0x13')]);router[_0x204c('0x12')](_0x204c('0x14'),auth['isAuthenticated'](),controller[_0x204c('0x15')]);router[_0x204c('0x16')](_0x204c('0xb'),auth[_0x204c('0x9')](),controller[_0x204c('0x17')]);router[_0x204c('0x18')](_0x204c('0xb'),auth['isAuthenticated'](),controller[_0x204c('0x19')]);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 4778abe..360ad71 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 _0xd79b=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util','exports','STRING','name','TEXT','long','setDataValue','formData','stringify','format'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xd79b,0x1ee));var _0xbd79=function(_0x32f970,_0xd35123){_0x32f970=_0x32f970-0x0;var _0xb884f2=_0xd79b[_0x32f970];return _0xb884f2;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xbd79('0x0'));module[_0xbd79('0x1')]={'name':{'type':Sequelize[_0xbd79('0x2')],'unique':_0xbd79('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xbd79('0x4')](_0xbd79('0x5')),'set':function(_0x5bfc69){if(_['isObjectLike'](_0x5bfc69)){this[_0xbd79('0x6')](_0xbd79('0x7'),JSON[_0xbd79('0x8')](_0x5bfc69));}else if(_['isString'](_0x5bfc69)){this[_0xbd79('0x6')](_0xbd79('0x7'),_0x5bfc69);}else{this[_0xbd79('0x6')](_0xbd79('0x7'),util[_0xbd79('0x9')](_0xbd79('0xa'),this[_0xbd79('0xb')](_0xbd79('0x3'))||'',this[_0xbd79('0xb')](_0xbd79('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbd79('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xc4b6=['formData','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','stringify','isString','setDataValue'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xc4b6,0x90));var _0x6c4b=function(_0x423f85,_0x322a15){_0x423f85=_0x423f85-0x0;var _0x5a4dc=_0xc4b6[_0x423f85];return _0x5a4dc;};'use strict';var Sequelize=require(_0x6c4b('0x0'));var _=require(_0x6c4b('0x1'));var util=require(_0x6c4b('0x2'));module['exports']={'name':{'type':Sequelize[_0x6c4b('0x3')],'unique':_0x6c4b('0x4')},'description':{'type':Sequelize[_0x6c4b('0x3')]},'formData':{'type':Sequelize[_0x6c4b('0x5')](_0x6c4b('0x6')),'set':function(_0x2d4ece){if(_['isObjectLike'](_0x2d4ece)){this['setDataValue']('formData',JSON[_0x6c4b('0x7')](_0x2d4ece));}else if(_[_0x6c4b('0x8')](_0x2d4ece)){this[_0x6c4b('0x9')]('formData',_0x2d4ece);}else{this[_0x6c4b('0x9')](_0x6c4b('0xa'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6c4b('0xb')](_0x6c4b('0x4'))||'',this['getDataValue'](_0x6c4b('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6c4b('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6c4b('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 368c53f..7bdf74a 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 _0x81cb=['params','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','UserProfileSection','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','eml-format','rimraf','fast-json-patch','request-promise','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','JscriptyProject','count','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xb81c('0x0'));var rimraf=require(_0xb81c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb81c('0x2'));var rp=require(_0xb81c('0x3'));var moment=require('moment');var BPromise=require(_0xb81c('0x4'));var Mustache=require(_0xb81c('0x5'));var util=require(_0xb81c('0x6'));var path=require(_0xb81c('0x7'));var sox=require('sox');var csv=require(_0xb81c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0x8'));var querystring=require(_0xb81c('0xe'));var Papa=require(_0xb81c('0xf'));var Redis=require(_0xb81c('0x10'));var authService=require(_0xb81c('0x11'));var qs=require(_0xb81c('0x12'));var as=require(_0xb81c('0x13'));var hardwareService=require(_0xb81c('0x14'));var logger=require(_0xb81c('0x15'))('api');var utils=require(_0xb81c('0x16'));var config=require(_0xb81c('0x17'));var licenseUtil=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];function respondWithStatusCode(_0x2e8242,_0x4b1d98){_0x4b1d98=_0x4b1d98||0xcc;return function(_0x9c3214){if(_0x9c3214){return _0x2e8242['sendStatus'](_0x4b1d98);}return _0x2e8242[_0xb81c('0x1a')](_0x4b1d98)[_0xb81c('0x1b')]();};}function respondWithResult(_0x572945,_0x1bb255){_0x1bb255=_0x1bb255||0xc8;return function(_0x2f50d3){if(_0x2f50d3){return _0x572945['status'](_0x1bb255)[_0xb81c('0x1c')](_0x2f50d3);}};}function respondWithFilteredResult(_0x3942dc,_0x3462bd){return function(_0x56eb92){if(_0x56eb92){var _0x393e11=typeof _0x3462bd[_0xb81c('0x1d')]==='undefined'&&typeof _0x3462bd[_0xb81c('0x1e')]===_0xb81c('0x1f');var _0x32916b=_0x56eb92['count'];var _0x37341d=_0x393e11?0x0:_0x3462bd[_0xb81c('0x1d')];var _0xbcf806=_0x393e11?_0x56eb92['count']:_0x3462bd[_0xb81c('0x1d')]+_0x3462bd[_0xb81c('0x1e')];var _0xfab47b;if(_0xbcf806>=_0x32916b){_0xbcf806=_0x32916b;_0xfab47b=0xc8;}else{_0xfab47b=0xce;}_0x3942dc[_0xb81c('0x1a')](_0xfab47b);return _0x3942dc[_0xb81c('0x20')](_0xb81c('0x21'),_0x37341d+'-'+_0xbcf806+'/'+_0x32916b)[_0xb81c('0x1c')](_0x56eb92);}return null;};}function patchUpdates(_0x4f09d7){return function(_0xc2ba68){try{jsonpatch[_0xb81c('0x22')](_0xc2ba68,_0x4f09d7,!![]);}catch(_0x1aa39a){return BPromise[_0xb81c('0x23')](_0x1aa39a);}return _0xc2ba68['save']();};}function saveUpdates(_0x11a5d3,_0x597547){return function(_0x449ad7){if(_0x449ad7){return _0x449ad7[_0xb81c('0x24')](_0x11a5d3)[_0xb81c('0x25')](function(_0x14650e){return _0x14650e;});}return null;};}function removeEntity(_0x554cc0,_0x5de2ac){return function(_0x12798b){if(_0x12798b){return _0x12798b[_0xb81c('0x26')]()[_0xb81c('0x25')](function(){var _0x43b90f=_0x12798b[_0xb81c('0x27')]({'plain':!![]});var _0x17d176=_0xb81c('0x28');return db[_0xb81c('0x29')][_0xb81c('0x26')]({'where':{'type':_0x17d176,'resourceId':_0x43b90f['id']}})[_0xb81c('0x25')](function(){return _0x12798b;});})[_0xb81c('0x25')](function(){_0x554cc0[_0xb81c('0x1a')](0xcc)[_0xb81c('0x1b')]();});}};}function handleEntityNotFound(_0x20b7ea,_0x183779){return function(_0x201051){if(!_0x201051){_0x20b7ea[_0xb81c('0x2a')](0x194);}return _0x201051;};}function handleError(_0x4ca99e,_0x5c07c0){_0x5c07c0=_0x5c07c0||0x1f4;return function(_0x15f86e){logger[_0xb81c('0x2b')](_0x15f86e['stack']);if(_0x15f86e[_0xb81c('0x2c')]){delete _0x15f86e[_0xb81c('0x2c')];}_0x4ca99e['status'](_0x5c07c0)[_0xb81c('0x2d')](_0x15f86e);};}exports['index']=function(_0xdff705,_0x5df2df){var _0x375fa3={},_0x2c98ed={},_0x2616b4={'count':0x0,'rows':[]};var _0x548fe2=_[_0xb81c('0x2e')](db['JscriptyProject'][_0xb81c('0x2f')],function(_0x317ed5){return{'name':_0x317ed5['fieldName'],'type':_0x317ed5[_0xb81c('0x30')][_0xb81c('0x31')]};});_0x2c98ed[_0xb81c('0x32')]=_['map'](_0x548fe2,_0xb81c('0x2c'));_0x2c98ed[_0xb81c('0x33')]=_[_0xb81c('0x34')](_0xdff705[_0xb81c('0x33')]);_0x2c98ed[_0xb81c('0x35')]=_[_0xb81c('0x36')](_0x2c98ed[_0xb81c('0x32')],_0x2c98ed[_0xb81c('0x33')]);_0x375fa3[_0xb81c('0x37')]=_[_0xb81c('0x36')](_0x2c98ed['model'],qs[_0xb81c('0x38')](_0xdff705['query']['fields']));_0x375fa3[_0xb81c('0x37')]=_0x375fa3['attributes'][_0xb81c('0x39')]?_0x375fa3['attributes']:_0x2c98ed[_0xb81c('0x32')];if(!_0xdff705[_0xb81c('0x33')]['hasOwnProperty'](_0xb81c('0x3a'))){_0x375fa3[_0xb81c('0x1e')]=qs[_0xb81c('0x1e')](_0xdff705['query'][_0xb81c('0x1e')]);_0x375fa3[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0xdff705[_0xb81c('0x33')]['offset']);}_0x375fa3[_0xb81c('0x3b')]=qs[_0xb81c('0x3c')](_0xdff705[_0xb81c('0x33')][_0xb81c('0x3c')]);_0x375fa3[_0xb81c('0x3d')]=qs[_0xb81c('0x35')](_[_0xb81c('0x3e')](_0xdff705[_0xb81c('0x33')],_0x2c98ed['filters']),_0x548fe2);if(_0xdff705['query']['filter']){_0x375fa3['where']=_['merge'](_0x375fa3[_0xb81c('0x3d')],{'$or':_['map'](_0x548fe2,function(_0x38fc63){if(_0x38fc63[_0xb81c('0x30')]!==_0xb81c('0x3f')){var _0x3cefd4={};_0x3cefd4[_0x38fc63[_0xb81c('0x2c')]]={'$like':'%'+_0xdff705['query'][_0xb81c('0x40')]+'%'};return _0x3cefd4;}})});}_0x375fa3=_[_0xb81c('0x41')]({},_0x375fa3,_0xdff705['options']);var _0x597ff9={'where':_0x375fa3['where']};return db[_0xb81c('0x42')][_0xb81c('0x43')](_0x597ff9)[_0xb81c('0x25')](function(_0x1dff58){_0x2616b4[_0xb81c('0x43')]=_0x1dff58;if(_0xdff705[_0xb81c('0x33')]['includeAll']){_0x375fa3[_0xb81c('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xb81c('0x45')](_0x375fa3);})[_0xb81c('0x25')](function(_0x19b752){_0x2616b4[_0xb81c('0x46')]=_0x19b752;return _0x2616b4;})['then'](respondWithFilteredResult(_0x5df2df,_0x375fa3))[_0xb81c('0x47')](handleError(_0x5df2df,null));};exports['show']=function(_0x5c664f,_0x48fe30){var _0x28e76b={'raw':![],'where':{'id':_0x5c664f[_0xb81c('0x48')]['id']}},_0x82e80f={};_0x82e80f['model']=_[_0xb81c('0x34')](db['JscriptyProject'][_0xb81c('0x2f')]);_0x82e80f[_0xb81c('0x33')]=_[_0xb81c('0x34')](_0x5c664f['query']);_0x82e80f[_0xb81c('0x35')]=_[_0xb81c('0x36')](_0x82e80f[_0xb81c('0x32')],_0x82e80f[_0xb81c('0x33')]);_0x28e76b[_0xb81c('0x37')]=_[_0xb81c('0x36')](_0x82e80f[_0xb81c('0x32')],qs[_0xb81c('0x38')](_0x5c664f[_0xb81c('0x33')]['fields']));_0x28e76b[_0xb81c('0x37')]=_0x28e76b[_0xb81c('0x37')][_0xb81c('0x39')]?_0x28e76b[_0xb81c('0x37')]:_0x82e80f[_0xb81c('0x32')];if(_0x5c664f['query'][_0xb81c('0x49')]){_0x28e76b['include']=[{'all':!![]}];}_0x28e76b=_[_0xb81c('0x41')]({},_0x28e76b,_0x5c664f[_0xb81c('0x4a')]);return db[_0xb81c('0x42')][_0xb81c('0x4b')](_0x28e76b)[_0xb81c('0x25')](handleEntityNotFound(_0x48fe30,null))[_0xb81c('0x25')](respondWithResult(_0x48fe30,null))[_0xb81c('0x47')](handleError(_0x48fe30,null));};exports['create']=function(_0x40fbf6,_0x200464){return db['JscriptyProject']['create'](_0x40fbf6[_0xb81c('0x4c')],{})[_0xb81c('0x25')](function(_0x11324c){var _0x3a4bb3=_0x40fbf6[_0xb81c('0x4d')][_0xb81c('0x27')]({'plain':!![]});if(!_0x3a4bb3)throw new Error(_0xb81c('0x4e'));if(_0x3a4bb3[_0xb81c('0x4f')]===_0xb81c('0x4d')){var _0x2e43a1=_0x11324c['get']({'plain':!![]});var _0x4e8b19=_0xb81c('0x28');return db['UserProfileSection'][_0xb81c('0x4b')]({'where':{'name':_0x4e8b19,'userProfileId':_0x3a4bb3[_0xb81c('0x50')]},'raw':!![]})[_0xb81c('0x25')](function(_0x31bd89){if(_0x31bd89&&_0x31bd89[_0xb81c('0x51')]===0x0){return db[_0xb81c('0x29')][_0xb81c('0x52')]({'name':_0x2e43a1[_0xb81c('0x2c')],'resourceId':_0x2e43a1['id'],'type':_0x31bd89[_0xb81c('0x2c')],'sectionId':_0x31bd89['id']},{})['then'](function(){return _0x11324c;});}else{return _0x11324c;}})[_0xb81c('0x47')](function(_0x2e9b29){logger['error'](_0xb81c('0x53'),_0x2e9b29);throw _0x2e9b29;});}return _0x11324c;})[_0xb81c('0x25')](respondWithResult(_0x200464,0xc9))[_0xb81c('0x47')](handleError(_0x200464,null));};exports['clone']=function(_0x281dfe,_0x42b72d){var _0x205f04={'where':{'id':_0x281dfe[_0xb81c('0x48')]['id']}},_0x5a6566={};_0x5a6566[_0xb81c('0x32')]=_[_0xb81c('0x34')](db['JscriptyProject'][_0xb81c('0x2f')]);_0x205f04[_0xb81c('0x37')]=_['intersection'](_0x5a6566[_0xb81c('0x32')],qs[_0xb81c('0x38')](_0x281dfe[_0xb81c('0x33')]['fields']));_0x205f04['attributes']=_0x205f04[_0xb81c('0x37')]['length']?_0x205f04[_0xb81c('0x37')]:_0x5a6566[_0xb81c('0x32')];if(_0x281dfe[_0xb81c('0x33')][_0xb81c('0x49')]){_0x205f04[_0xb81c('0x44')]=[{'all':!![]}];}_0x205f04=_[_0xb81c('0x41')]({},_0x205f04,_0x281dfe[_0xb81c('0x4a')]);return db['JscriptyProject'][_0xb81c('0x4b')](_0x205f04)[_0xb81c('0x25')](handleEntityNotFound(_0x42b72d,null))[_0xb81c('0x25')](function(_0x3b5ed4){if(_0x3b5ed4){var _0xa75aa3=_0x3b5ed4[_0xb81c('0x27')]({'plain':!![]});_0xa75aa3=qs['omit'](_0xa75aa3,['id',_0xb81c('0x54'),_0xb81c('0x55')]);_0x281dfe[_0xb81c('0x4c')]=_[_0xb81c('0x56')](_0x281dfe['body'],['id',_0xb81c('0x54'),_0xb81c('0x55')]);return db[_0xb81c('0x42')][_0xb81c('0x52')](_[_0xb81c('0x41')](_0xa75aa3,_0x281dfe[_0xb81c('0x4c')]),{'include':_0x281dfe['query'][_0xb81c('0x49')]?[{'all':!![]}]:undefined})[_0xb81c('0x25')](function(_0x8c8a71){var _0xfbb212=_0x281dfe[_0xb81c('0x4d')][_0xb81c('0x27')]({'plain':!![]});if(!_0xfbb212)throw new Error(_0xb81c('0x4e'));if(_0xfbb212[_0xb81c('0x4f')]===_0xb81c('0x4d')){var _0x2a42ac=_0x8c8a71[_0xb81c('0x27')]({'plain':!![]});var _0x12e016=_0xb81c('0x28');return db[_0xb81c('0x57')]['find']({'where':{'name':_0x12e016,'userProfileId':_0xfbb212[_0xb81c('0x50')]},'raw':!![]})['then'](function(_0x23e809){if(_0x23e809&&_0x23e809[_0xb81c('0x51')]===0x0){return db[_0xb81c('0x29')][_0xb81c('0x52')]({'name':_0x2a42ac[_0xb81c('0x2c')],'resourceId':_0x2a42ac['id'],'type':_0x23e809[_0xb81c('0x2c')],'sectionId':_0x23e809['id']},{})[_0xb81c('0x25')](function(){return _0x8c8a71;});}else{return _0x8c8a71;}})['catch'](function(_0x43b493){logger[_0xb81c('0x2b')](_0xb81c('0x53'),_0x43b493);throw _0x43b493;});}return _0x8c8a71;});}})[_0xb81c('0x25')](respondWithResult(_0x42b72d,0xc9))[_0xb81c('0x47')](handleError(_0x42b72d,null));};exports['update']=function(_0x5a47a8,_0x5d0d27){if(_0x5a47a8[_0xb81c('0x4c')]['id']){delete _0x5a47a8[_0xb81c('0x4c')]['id'];}return db[_0xb81c('0x42')][_0xb81c('0x4b')]({'where':{'id':_0x5a47a8[_0xb81c('0x48')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x5d0d27,null))[_0xb81c('0x25')](saveUpdates(_0x5a47a8[_0xb81c('0x4c')],null))['then'](respondWithResult(_0x5d0d27,null))[_0xb81c('0x47')](handleError(_0x5d0d27,null));};exports['destroy']=function(_0x1a6545,_0x1c737f){return db[_0xb81c('0x42')][_0xb81c('0x4b')]({'where':{'id':_0x1a6545['params']['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x1c737f,null))['then'](removeEntity(_0x1c737f,null))[_0xb81c('0x47')](handleError(_0x1c737f,null));};exports[_0xb81c('0x58')]=function(_0x46d9fb,_0x20fe72,_0x54c318){var _0x250c5d={'raw':!![],'where':{}};var _0x254c17={};var _0x22fbc7={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb81c('0x59')]({'where':{'id':_0x46d9fb[_0xb81c('0x48')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x20fe72,null))[_0xb81c('0x25')](function(_0x6c3010){if(_0x6c3010){_0x254c17[_0xb81c('0x32')]=_['keys'](db[_0xb81c('0x5a')]['rawAttributes']);_0x254c17['query']=_[_0xb81c('0x34')](_0x46d9fb[_0xb81c('0x33')]);_0x254c17[_0xb81c('0x35')]=_[_0xb81c('0x36')](_0x254c17[_0xb81c('0x32')],_0x254c17[_0xb81c('0x33')]);_0x250c5d[_0xb81c('0x37')]=_[_0xb81c('0x36')](_0x254c17['model'],qs[_0xb81c('0x38')](_0x46d9fb[_0xb81c('0x33')][_0xb81c('0x38')]));_0x250c5d['attributes']=_0x250c5d[_0xb81c('0x37')][_0xb81c('0x39')]?_0x250c5d['attributes']:_0x254c17['model'];if(!_0x46d9fb[_0xb81c('0x33')][_0xb81c('0x5b')](_0xb81c('0x3a'))){_0x250c5d[_0xb81c('0x1e')]=qs[_0xb81c('0x1e')](_0x46d9fb[_0xb81c('0x33')]['limit']);_0x250c5d[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0x46d9fb['query']['offset']);}_0x250c5d[_0xb81c('0x3b')]=qs[_0xb81c('0x3c')](_0x46d9fb['query'][_0xb81c('0x3c')]);_0x250c5d[_0xb81c('0x3d')]=qs[_0xb81c('0x35')](_[_0xb81c('0x3e')](_0x46d9fb['query'],_0x254c17['filters']));_0x250c5d[_0xb81c('0x3d')][_0xb81c('0x5c')]=_0x6c3010['id'];if(_0x46d9fb['query'][_0xb81c('0x40')]){_0x250c5d[_0xb81c('0x3d')]=_[_0xb81c('0x41')](_0x250c5d[_0xb81c('0x3d')],{'$or':_[_0xb81c('0x2e')](_0x250c5d['attributes'],function(_0x42a71c){var _0x3784df={};_0x3784df[_0x42a71c]={'$like':'%'+_0x46d9fb[_0xb81c('0x33')][_0xb81c('0x40')]+'%'};return _0x3784df;})});}_0x250c5d=_['merge']({},_0x250c5d,_0x46d9fb['options']);return db['JscriptySessionReport'][_0xb81c('0x43')]({'where':_0x250c5d[_0xb81c('0x3d')]})['then'](function(_0x2d3048){_0x22fbc7[_0xb81c('0x43')]=_0x2d3048;if(_0x46d9fb[_0xb81c('0x33')][_0xb81c('0x49')]){_0x250c5d[_0xb81c('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb81c('0x45')](_0x250c5d);})[_0xb81c('0x25')](function(_0x3cd72f){_0x22fbc7[_0xb81c('0x46')]=_0x3cd72f;return _0x22fbc7;});}})[_0xb81c('0x25')](respondWithFilteredResult(_0x20fe72,_0x250c5d))[_0xb81c('0x47')](handleError(_0x20fe72,null));};exports[_0xb81c('0x5d')]=function(_0x288736,_0x4989c9,_0x4884ca){var _0x52243b={'raw':!![],'where':{}};var _0x112fe3={};var _0x9bf76a={'count':0x0,'rows':[]};return db[_0xb81c('0x42')][_0xb81c('0x59')]({'where':{'id':_0x288736[_0xb81c('0x48')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x4989c9,null))[_0xb81c('0x25')](function(_0x57ff75){if(_0x57ff75){_0x112fe3['model']=_[_0xb81c('0x34')](db['JscriptyAnswerReport'][_0xb81c('0x2f')]);_0x112fe3[_0xb81c('0x33')]=_[_0xb81c('0x34')](_0x288736[_0xb81c('0x33')]);_0x112fe3[_0xb81c('0x35')]=_['intersection'](_0x112fe3[_0xb81c('0x32')],_0x112fe3[_0xb81c('0x33')]);_0x52243b[_0xb81c('0x37')]=_[_0xb81c('0x36')](_0x112fe3[_0xb81c('0x32')],qs['fields'](_0x288736[_0xb81c('0x33')][_0xb81c('0x38')]));_0x52243b[_0xb81c('0x37')]=_0x52243b[_0xb81c('0x37')]['length']?_0x52243b[_0xb81c('0x37')]:_0x112fe3[_0xb81c('0x32')];if(!_0x288736[_0xb81c('0x33')][_0xb81c('0x5b')](_0xb81c('0x3a'))){_0x52243b[_0xb81c('0x1e')]=qs[_0xb81c('0x1e')](_0x288736[_0xb81c('0x33')][_0xb81c('0x1e')]);_0x52243b[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0x288736[_0xb81c('0x33')][_0xb81c('0x1d')]);}_0x52243b[_0xb81c('0x3b')]=qs[_0xb81c('0x3c')](_0x288736['query']['sort']);_0x52243b[_0xb81c('0x3d')]=qs['filters'](_[_0xb81c('0x3e')](_0x288736[_0xb81c('0x33')],_0x112fe3[_0xb81c('0x35')]));_0x52243b[_0xb81c('0x3d')][_0xb81c('0x5c')]=_0x57ff75['id'];if(_0x288736[_0xb81c('0x33')][_0xb81c('0x40')]){_0x52243b['where']=_[_0xb81c('0x41')](_0x52243b[_0xb81c('0x3d')],{'$or':_[_0xb81c('0x2e')](_0x52243b[_0xb81c('0x37')],function(_0x50336f){var _0x4ed3c4={};_0x4ed3c4[_0x50336f]={'$like':'%'+_0x288736[_0xb81c('0x33')][_0xb81c('0x40')]+'%'};return _0x4ed3c4;})});}_0x52243b=_[_0xb81c('0x41')]({},_0x52243b,_0x288736[_0xb81c('0x4a')]);return db[_0xb81c('0x5e')]['count']({'where':_0x52243b[_0xb81c('0x3d')]})['then'](function(_0x535ba4){_0x9bf76a[_0xb81c('0x43')]=_0x535ba4;if(_0x288736['query'][_0xb81c('0x49')]){_0x52243b[_0xb81c('0x44')]=[{'all':!![]}];}return db[_0xb81c('0x5e')][_0xb81c('0x45')](_0x52243b);})[_0xb81c('0x25')](function(_0x2a1583){_0x9bf76a['rows']=_0x2a1583;return _0x9bf76a;});}})['then'](respondWithFilteredResult(_0x4989c9,_0x52243b))[_0xb81c('0x47')](handleError(_0x4989c9,null));};function char(_0x52016e){return _0xb81c('0x5f')===typeof _0x52016e?String[_0xb81c('0x60')][_0xb81c('0x22')](null,arguments):_0x52016e;}function needsEncapsulation(_0x41a4cd){return!!_0x41a4cd&&(_0x41a4cd[_0xb81c('0x61')]()[_0xb81c('0x62')](char(0xd))>=0x0||_0x41a4cd[_0xb81c('0x61')]()['indexOf'](char(0xa))>=0x0||_0x41a4cd[_0xb81c('0x61')]()[_0xb81c('0x62')](char(0x2c))>=0x0||_0x41a4cd[_0xb81c('0x61')]()[_0xb81c('0x62')](char(0x22))>=0x0);}function encapsulate(_0x4f79c2){var _0x20c4c3=char(0x22),_0x3b2c94='\x5c'+char(0x22),_0x57be6f=_0x4f79c2['toString']()[_0xb81c('0x63')](new RegExp(_0x20c4c3,'g'),_0x3b2c94);return _0x20c4c3+_0x57be6f+_0x20c4c3;}exports[_0xb81c('0x64')]=function(_0x20ab71,_0x383d88,_0x164fcc){var _0x143dec,_0x465131;var _0x2eafcd={'where':{'ProjectId':_0x20ab71[_0xb81c('0x48')]['id']}};if(_0x20ab71[_0xb81c('0x33')][_0xb81c('0x65')]){_0x2eafcd[_0xb81c('0x3d')]['starttime']=JSON[_0xb81c('0x66')](_0x20ab71[_0xb81c('0x33')][_0xb81c('0x65')]);}return db[_0xb81c('0x5a')][_0xb81c('0x45')](_0x2eafcd)[_0xb81c('0x25')](handleEntityNotFound(_0x383d88,null))[_0xb81c('0x25')](function(_0x197d2a){if(_0x197d2a){_0x143dec=_0x197d2a;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xb81c('0x2e')](_0x143dec,'id')},'ProjectId':_0x20ab71['params']['id']},'order':_0xb81c('0x67')});}})[_0xb81c('0x25')](handleEntityNotFound(_0x383d88,null))['then'](function(_0x5ab69a){if(_0x5ab69a){_0x465131=_0x5ab69a;var _0x23a90e={};for(var _0xaf26cf=0x0,_0x1af6cf=_0x465131[_0xb81c('0x39')];_0xaf26cf<_0x1af6cf;_0xaf26cf++){if(!_0x23a90e[_0xb81c('0x5b')](_0x465131[_0xaf26cf][_0xb81c('0x68')])){_0x23a90e[_0x465131[_0xaf26cf]['questionId']]=needsEncapsulation(_0x465131[_0xaf26cf]['question'])?encapsulate(_0x465131[_0xaf26cf]['question']):_0x465131[_0xaf26cf][_0xb81c('0x69')];}}var _0x2cce7e=[],_0x56954f={};for(var _0x20e514=0x0,_0xf72544=_0x143dec[_0xb81c('0x39')];_0x20e514<_0xf72544;_0x20e514++){_0x56954f={'ProjectId':_0x20ab71[_0xb81c('0x48')]['id'],'SessionId':_0x143dec[_0x20e514]['id'],'StartTime':moment(_0x143dec[_0x20e514][_0xb81c('0x6a')])[_0xb81c('0x6b')](_0xb81c('0x6c'))};for(var _0x1a3a3c=0x0,_0x12763d=_0x465131[_0xb81c('0x39')];_0x1a3a3c<_0x12763d;_0x1a3a3c++){if(_0x465131[_0x1a3a3c][_0xb81c('0x6d')]==_0x143dec[_0x20e514]['id']&&_0x23a90e[_0xb81c('0x5b')](_0x465131[_0x1a3a3c]['questionId'])){_0x56954f[_0x23a90e[_0x465131[_0x1a3a3c][_0xb81c('0x68')]]]=_0x465131[_0x1a3a3c][_0xb81c('0x6e')];}}for(var _0x5ae3c9 in _0x23a90e){if(!_0x56954f[_0xb81c('0x5b')](_0x23a90e[_0x5ae3c9])){_0x56954f[_0x23a90e[_0x5ae3c9]]=null;}}_0x2cce7e[_0xb81c('0x6f')](_0x56954f);}return _0x2cce7e;}})[_0xb81c('0x25')](function(_0x21d26c){if(!_[_0xb81c('0x70')](_0x21d26c)){var _0x2a9a52=toCsv(_0x21d26c);var _0x90401d=Date[_0xb81c('0x71')]();fs[_0xb81c('0x72')](util['format'](_0xb81c('0x73'),_0x20ab71[_0xb81c('0x48')]['id'],_0x90401d),_0x2a9a52);_0x383d88[_0xb81c('0x74')](_0xb81c('0x75'),'attachment;\x20filename='+util[_0xb81c('0x6b')]('Jscripty_Project_%d_Summary_%s.csv',_0x20ab71[_0xb81c('0x48')]['id'],_0x90401d));_0x383d88[_0xb81c('0x74')](_0xb81c('0x76'),_0xb81c('0x77'));return _0x383d88[_0xb81c('0x78')](util[_0xb81c('0x6b')](_0xb81c('0x73'),_0x20ab71['params']['id'],_0x90401d));}else{return _0x383d88[_0xb81c('0x2a')](0xcc);}})[_0xb81c('0x47')](handleError(_0x383d88,null));}; \ No newline at end of file +var _0xbc23=['download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','destroy','then','get','Projects','UserProfileResource','end','sendStatus','error','stack','send','map','JscriptyProject','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','autoAssociation','update','getSessions','findOne','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv'];(function(_0x3f8759,_0x3fe6fb){var _0x2d33ca=function(_0x39b5c9){while(--_0x39b5c9){_0x3f8759['push'](_0x3f8759['shift']());}};_0x2d33ca(++_0x3fe6fb);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x5685dc,_0x2dd160){_0x5685dc=_0x5685dc-0x0;var _0x290698=_0xbc23[_0x5685dc];return _0x290698;};'use strict';var emlformat=require(_0x3bc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bc2('0x1'));var rp=require(_0x3bc2('0x2'));var moment=require(_0x3bc2('0x3'));var BPromise=require(_0x3bc2('0x4'));var Mustache=require(_0x3bc2('0x5'));var util=require(_0x3bc2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3bc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3bc2('0x8'));var crypto=require(_0x3bc2('0x9'));var jsforce=require(_0x3bc2('0xa'));var deskjs=require(_0x3bc2('0xb'));var toCsv=require(_0x3bc2('0x7'));var querystring=require(_0x3bc2('0xc'));var Papa=require(_0x3bc2('0xd'));var Redis=require('ioredis');var authService=require(_0x3bc2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3bc2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bc2('0x10'))(_0x3bc2('0x11'));var utils=require(_0x3bc2('0x12'));var config=require(_0x3bc2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bc2('0x14'))['db'];function respondWithStatusCode(_0x2280cd,_0xdfdf63){_0xdfdf63=_0xdfdf63||0xcc;return function(_0x2e9ef5){if(_0x2e9ef5){return _0x2280cd['sendStatus'](_0xdfdf63);}return _0x2280cd[_0x3bc2('0x15')](_0xdfdf63)['end']();};}function respondWithResult(_0x8c87ef,_0x15cbb0){_0x15cbb0=_0x15cbb0||0xc8;return function(_0x4d8f05){if(_0x4d8f05){return _0x8c87ef[_0x3bc2('0x15')](_0x15cbb0)[_0x3bc2('0x16')](_0x4d8f05);}};}function respondWithFilteredResult(_0x173493,_0x552e20){return function(_0x243716){if(_0x243716){var _0x4bedb3=typeof _0x552e20[_0x3bc2('0x17')]==='undefined'&&typeof _0x552e20[_0x3bc2('0x18')]===_0x3bc2('0x19');var _0xe3054c=_0x243716[_0x3bc2('0x1a')];var _0x1f4253=_0x4bedb3?0x0:_0x552e20['offset'];var _0x5ecfe4=_0x4bedb3?_0x243716[_0x3bc2('0x1a')]:_0x552e20[_0x3bc2('0x17')]+_0x552e20[_0x3bc2('0x18')];var _0x1d8b47;if(_0x5ecfe4>=_0xe3054c){_0x5ecfe4=_0xe3054c;_0x1d8b47=0xc8;}else{_0x1d8b47=0xce;}_0x173493[_0x3bc2('0x15')](_0x1d8b47);return _0x173493[_0x3bc2('0x1b')]('Content-Range',_0x1f4253+'-'+_0x5ecfe4+'/'+_0xe3054c)[_0x3bc2('0x16')](_0x243716);}return null;};}function patchUpdates(_0x388cd3){return function(_0x4e6bc9){try{jsonpatch['apply'](_0x4e6bc9,_0x388cd3,!![]);}catch(_0x26bb22){return BPromise['reject'](_0x26bb22);}return _0x4e6bc9['save']();};}function saveUpdates(_0x3015e7,_0x580ee2){return function(_0x5d1e39){if(_0x5d1e39){return _0x5d1e39['update'](_0x3015e7)['then'](function(_0x198908){return _0x198908;});}return null;};}function removeEntity(_0x413999,_0x439649){return function(_0x1b00d0){if(_0x1b00d0){return _0x1b00d0[_0x3bc2('0x1c')]()[_0x3bc2('0x1d')](function(){var _0x591e45=_0x1b00d0[_0x3bc2('0x1e')]({'plain':!![]});var _0x25167e=_0x3bc2('0x1f');return db[_0x3bc2('0x20')][_0x3bc2('0x1c')]({'where':{'type':_0x25167e,'resourceId':_0x591e45['id']}})[_0x3bc2('0x1d')](function(){return _0x1b00d0;});})[_0x3bc2('0x1d')](function(){_0x413999[_0x3bc2('0x15')](0xcc)[_0x3bc2('0x21')]();});}};}function handleEntityNotFound(_0x1ddc73,_0xd6b456){return function(_0xd8d5ba){if(!_0xd8d5ba){_0x1ddc73[_0x3bc2('0x22')](0x194);}return _0xd8d5ba;};}function handleError(_0x3d6ba5,_0x594c6f){_0x594c6f=_0x594c6f||0x1f4;return function(_0x396d76){logger[_0x3bc2('0x23')](_0x396d76[_0x3bc2('0x24')]);if(_0x396d76['name']){delete _0x396d76['name'];}_0x3d6ba5[_0x3bc2('0x15')](_0x594c6f)[_0x3bc2('0x25')](_0x396d76);};}exports['index']=function(_0xc12490,_0x10aaa4){var _0x5ebd0d={},_0xaa2ff3={},_0x323d81={'count':0x0,'rows':[]};var _0x283b91=_[_0x3bc2('0x26')](db[_0x3bc2('0x27')][_0x3bc2('0x28')],function(_0x3d7f3c){return{'name':_0x3d7f3c[_0x3bc2('0x29')],'type':_0x3d7f3c[_0x3bc2('0x2a')]['key']};});_0xaa2ff3[_0x3bc2('0x2b')]=_[_0x3bc2('0x26')](_0x283b91,_0x3bc2('0x2c'));_0xaa2ff3[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0xc12490[_0x3bc2('0x2d')]);_0xaa2ff3[_0x3bc2('0x2f')]=_['intersection'](_0xaa2ff3[_0x3bc2('0x2b')],_0xaa2ff3['query']);_0x5ebd0d[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0xaa2ff3['model'],qs[_0x3bc2('0x32')](_0xc12490[_0x3bc2('0x2d')]['fields']));_0x5ebd0d['attributes']=_0x5ebd0d[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0x5ebd0d[_0x3bc2('0x30')]:_0xaa2ff3['model'];if(!_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x34')](_0x3bc2('0x35'))){_0x5ebd0d['limit']=qs[_0x3bc2('0x18')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x18')]);_0x5ebd0d[_0x3bc2('0x17')]=qs[_0x3bc2('0x17')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x17')]);}_0x5ebd0d[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x37')]);_0x5ebd0d[_0x3bc2('0x38')]=qs[_0x3bc2('0x2f')](_[_0x3bc2('0x39')](_0xc12490[_0x3bc2('0x2d')],_0xaa2ff3[_0x3bc2('0x2f')]),_0x283b91);if(_0xc12490['query']['filter']){_0x5ebd0d[_0x3bc2('0x38')]=_[_0x3bc2('0x3a')](_0x5ebd0d[_0x3bc2('0x38')],{'$or':_[_0x3bc2('0x26')](_0x283b91,function(_0x23bc98){if(_0x23bc98[_0x3bc2('0x2a')]!==_0x3bc2('0x3b')){var _0x3c9e9e={};_0x3c9e9e[_0x23bc98[_0x3bc2('0x2c')]]={'$like':'%'+_0xc12490['query'][_0x3bc2('0x3c')]+'%'};return _0x3c9e9e;}})});}_0x5ebd0d=_['merge']({},_0x5ebd0d,_0xc12490[_0x3bc2('0x3d')]);var _0x6e5a6={'where':_0x5ebd0d[_0x3bc2('0x38')]};return db[_0x3bc2('0x27')][_0x3bc2('0x1a')](_0x6e5a6)[_0x3bc2('0x1d')](function(_0xab2142){_0x323d81['count']=_0xab2142;if(_0xc12490[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x5ebd0d[_0x3bc2('0x3f')]=[{'all':!![]}];}return db[_0x3bc2('0x27')]['findAll'](_0x5ebd0d);})[_0x3bc2('0x1d')](function(_0x331501){_0x323d81[_0x3bc2('0x40')]=_0x331501;return _0x323d81;})[_0x3bc2('0x1d')](respondWithFilteredResult(_0x10aaa4,_0x5ebd0d))['catch'](handleError(_0x10aaa4,null));};exports[_0x3bc2('0x41')]=function(_0x11ae06,_0xd1398f){var _0x109e8c={'raw':![],'where':{'id':_0x11ae06[_0x3bc2('0x42')]['id']}},_0x2d3f54={};_0x2d3f54['model']=_[_0x3bc2('0x2e')](db['JscriptyProject'][_0x3bc2('0x28')]);_0x2d3f54[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x11ae06[_0x3bc2('0x2d')]);_0x2d3f54[_0x3bc2('0x2f')]=_['intersection'](_0x2d3f54['model'],_0x2d3f54['query']);_0x109e8c[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x2d3f54[_0x3bc2('0x2b')],qs[_0x3bc2('0x32')](_0x11ae06[_0x3bc2('0x2d')]['fields']));_0x109e8c[_0x3bc2('0x30')]=_0x109e8c[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0x109e8c[_0x3bc2('0x30')]:_0x2d3f54[_0x3bc2('0x2b')];if(_0x11ae06[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x109e8c['include']=[{'all':!![]}];}_0x109e8c=_['merge']({},_0x109e8c,_0x11ae06[_0x3bc2('0x3d')]);return db[_0x3bc2('0x27')][_0x3bc2('0x43')](_0x109e8c)['then'](handleEntityNotFound(_0xd1398f,null))[_0x3bc2('0x1d')](respondWithResult(_0xd1398f,null))[_0x3bc2('0x44')](handleError(_0xd1398f,null));};exports[_0x3bc2('0x45')]=function(_0x422ca0,_0x26b68b){return db[_0x3bc2('0x27')][_0x3bc2('0x45')](_0x422ca0[_0x3bc2('0x46')],{})[_0x3bc2('0x1d')](function(_0x530037){var _0x372f5d=_0x422ca0[_0x3bc2('0x47')][_0x3bc2('0x1e')]({'plain':!![]});if(!_0x372f5d)throw new Error(_0x3bc2('0x48'));if(_0x372f5d[_0x3bc2('0x49')]===_0x3bc2('0x47')){var _0x513ac6=_0x530037[_0x3bc2('0x1e')]({'plain':!![]});var _0x39dc3f=_0x3bc2('0x1f');return db[_0x3bc2('0x4a')][_0x3bc2('0x43')]({'where':{'name':_0x39dc3f,'userProfileId':_0x372f5d[_0x3bc2('0x4b')]},'raw':!![]})['then'](function(_0x21d4df){if(_0x21d4df&&_0x21d4df['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x513ac6[_0x3bc2('0x2c')],'resourceId':_0x513ac6['id'],'type':_0x21d4df['name'],'sectionId':_0x21d4df['id']},{})[_0x3bc2('0x1d')](function(){return _0x530037;});}else{return _0x530037;}})['catch'](function(_0x1c99a9){logger[_0x3bc2('0x23')](_0x3bc2('0x4c'),_0x1c99a9);throw _0x1c99a9;});}return _0x530037;})['then'](respondWithResult(_0x26b68b,0xc9))[_0x3bc2('0x44')](handleError(_0x26b68b,null));};exports['clone']=function(_0x3db688,_0x4da621){var _0x562932={'where':{'id':_0x3db688[_0x3bc2('0x42')]['id']}},_0x3da87b={};_0x3da87b[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db[_0x3bc2('0x27')][_0x3bc2('0x28')]);_0x562932[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x3da87b[_0x3bc2('0x2b')],qs['fields'](_0x3db688[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0x562932[_0x3bc2('0x30')]=_0x562932['attributes'][_0x3bc2('0x33')]?_0x562932[_0x3bc2('0x30')]:_0x3da87b[_0x3bc2('0x2b')];if(_0x3db688[_0x3bc2('0x2d')]['includeAll']){_0x562932[_0x3bc2('0x3f')]=[{'all':!![]}];}_0x562932=_[_0x3bc2('0x3a')]({},_0x562932,_0x3db688[_0x3bc2('0x3d')]);return db[_0x3bc2('0x27')][_0x3bc2('0x43')](_0x562932)[_0x3bc2('0x1d')](handleEntityNotFound(_0x4da621,null))[_0x3bc2('0x1d')](function(_0x2ef720){if(_0x2ef720){var _0x274ddb=_0x2ef720[_0x3bc2('0x1e')]({'plain':!![]});_0x274ddb=qs['omit'](_0x274ddb,['id',_0x3bc2('0x4d'),_0x3bc2('0x4e')]);_0x3db688[_0x3bc2('0x46')]=_['omit'](_0x3db688[_0x3bc2('0x46')],['id',_0x3bc2('0x4d'),_0x3bc2('0x4e')]);return db[_0x3bc2('0x27')][_0x3bc2('0x45')](_[_0x3bc2('0x3a')](_0x274ddb,_0x3db688['body']),{'include':_0x3db688['query'][_0x3bc2('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x57996e){var _0x5350af=_0x3db688[_0x3bc2('0x47')][_0x3bc2('0x1e')]({'plain':!![]});if(!_0x5350af)throw new Error(_0x3bc2('0x48'));if(_0x5350af['role']===_0x3bc2('0x47')){var _0x3f71ba=_0x57996e['get']({'plain':!![]});var _0x5b6cf2=_0x3bc2('0x1f');return db['UserProfileSection'][_0x3bc2('0x43')]({'where':{'name':_0x5b6cf2,'userProfileId':_0x5350af[_0x3bc2('0x4b')]},'raw':!![]})[_0x3bc2('0x1d')](function(_0x2c4509){if(_0x2c4509&&_0x2c4509[_0x3bc2('0x4f')]===0x0){return db['UserProfileResource'][_0x3bc2('0x45')]({'name':_0x3f71ba[_0x3bc2('0x2c')],'resourceId':_0x3f71ba['id'],'type':_0x2c4509[_0x3bc2('0x2c')],'sectionId':_0x2c4509['id']},{})[_0x3bc2('0x1d')](function(){return _0x57996e;});}else{return _0x57996e;}})[_0x3bc2('0x44')](function(_0x226a99){logger['error'](_0x3bc2('0x4c'),_0x226a99);throw _0x226a99;});}return _0x57996e;});}})['then'](respondWithResult(_0x4da621,0xc9))[_0x3bc2('0x44')](handleError(_0x4da621,null));};exports[_0x3bc2('0x50')]=function(_0x597b69,_0x2ff71d){if(_0x597b69[_0x3bc2('0x46')]['id']){delete _0x597b69[_0x3bc2('0x46')]['id'];}return db[_0x3bc2('0x27')][_0x3bc2('0x43')]({'where':{'id':_0x597b69[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x2ff71d,null))[_0x3bc2('0x1d')](saveUpdates(_0x597b69[_0x3bc2('0x46')],null))[_0x3bc2('0x1d')](respondWithResult(_0x2ff71d,null))[_0x3bc2('0x44')](handleError(_0x2ff71d,null));};exports['destroy']=function(_0x82411f,_0x52f524){return db[_0x3bc2('0x27')][_0x3bc2('0x43')]({'where':{'id':_0x82411f[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x52f524,null))[_0x3bc2('0x1d')](removeEntity(_0x52f524,null))[_0x3bc2('0x44')](handleError(_0x52f524,null));};exports[_0x3bc2('0x51')]=function(_0x4e6501,_0x28aab8,_0x515ced){var _0x5e319c={'raw':!![],'where':{}};var _0x5cb5eb={};var _0x528a2e={'count':0x0,'rows':[]};return db[_0x3bc2('0x27')][_0x3bc2('0x52')]({'where':{'id':_0x4e6501['params']['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x28aab8,null))[_0x3bc2('0x1d')](function(_0x57e635){if(_0x57e635){_0x5cb5eb[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x5cb5eb[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x4e6501[_0x3bc2('0x2d')]);_0x5cb5eb['filters']=_[_0x3bc2('0x31')](_0x5cb5eb[_0x3bc2('0x2b')],_0x5cb5eb[_0x3bc2('0x2d')]);_0x5e319c[_0x3bc2('0x30')]=_[_0x3bc2('0x31')](_0x5cb5eb['model'],qs[_0x3bc2('0x32')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0x5e319c['attributes']=_0x5e319c[_0x3bc2('0x30')]['length']?_0x5e319c['attributes']:_0x5cb5eb[_0x3bc2('0x2b')];if(!_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x34')](_0x3bc2('0x35'))){_0x5e319c[_0x3bc2('0x18')]=qs[_0x3bc2('0x18')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x18')]);_0x5e319c[_0x3bc2('0x17')]=qs['offset'](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x17')]);}_0x5e319c[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x37')]);_0x5e319c[_0x3bc2('0x38')]=qs[_0x3bc2('0x2f')](_[_0x3bc2('0x39')](_0x4e6501[_0x3bc2('0x2d')],_0x5cb5eb[_0x3bc2('0x2f')]));_0x5e319c[_0x3bc2('0x38')][_0x3bc2('0x53')]=_0x57e635['id'];if(_0x4e6501['query'][_0x3bc2('0x3c')]){_0x5e319c[_0x3bc2('0x38')]=_[_0x3bc2('0x3a')](_0x5e319c[_0x3bc2('0x38')],{'$or':_[_0x3bc2('0x26')](_0x5e319c[_0x3bc2('0x30')],function(_0x182ad8){var _0x3e935c={};_0x3e935c[_0x182ad8]={'$like':'%'+_0x4e6501['query'][_0x3bc2('0x3c')]+'%'};return _0x3e935c;})});}_0x5e319c=_[_0x3bc2('0x3a')]({},_0x5e319c,_0x4e6501[_0x3bc2('0x3d')]);return db[_0x3bc2('0x54')][_0x3bc2('0x1a')]({'where':_0x5e319c[_0x3bc2('0x38')]})[_0x3bc2('0x1d')](function(_0x374a39){_0x528a2e['count']=_0x374a39;if(_0x4e6501[_0x3bc2('0x2d')][_0x3bc2('0x3e')]){_0x5e319c[_0x3bc2('0x3f')]=[{'all':!![]}];}return db[_0x3bc2('0x54')][_0x3bc2('0x55')](_0x5e319c);})[_0x3bc2('0x1d')](function(_0x3e7eb0){_0x528a2e[_0x3bc2('0x40')]=_0x3e7eb0;return _0x528a2e;});}})[_0x3bc2('0x1d')](respondWithFilteredResult(_0x28aab8,_0x5e319c))[_0x3bc2('0x44')](handleError(_0x28aab8,null));};exports[_0x3bc2('0x56')]=function(_0x55dbb3,_0x57c68f,_0x312db8){var _0xd8907e={'raw':!![],'where':{}};var _0x58d54b={};var _0x19c273={'count':0x0,'rows':[]};return db[_0x3bc2('0x27')][_0x3bc2('0x52')]({'where':{'id':_0x55dbb3[_0x3bc2('0x42')]['id']}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x57c68f,null))[_0x3bc2('0x1d')](function(_0x2b6ec7){if(_0x2b6ec7){_0x58d54b[_0x3bc2('0x2b')]=_[_0x3bc2('0x2e')](db[_0x3bc2('0x57')][_0x3bc2('0x28')]);_0x58d54b[_0x3bc2('0x2d')]=_[_0x3bc2('0x2e')](_0x55dbb3[_0x3bc2('0x2d')]);_0x58d54b[_0x3bc2('0x2f')]=_['intersection'](_0x58d54b[_0x3bc2('0x2b')],_0x58d54b[_0x3bc2('0x2d')]);_0xd8907e[_0x3bc2('0x30')]=_['intersection'](_0x58d54b['model'],qs['fields'](_0x55dbb3[_0x3bc2('0x2d')][_0x3bc2('0x32')]));_0xd8907e[_0x3bc2('0x30')]=_0xd8907e[_0x3bc2('0x30')][_0x3bc2('0x33')]?_0xd8907e[_0x3bc2('0x30')]:_0x58d54b[_0x3bc2('0x2b')];if(!_0x55dbb3['query'][_0x3bc2('0x34')]('nolimit')){_0xd8907e[_0x3bc2('0x18')]=qs['limit'](_0x55dbb3['query']['limit']);_0xd8907e[_0x3bc2('0x17')]=qs[_0x3bc2('0x17')](_0x55dbb3['query']['offset']);}_0xd8907e[_0x3bc2('0x36')]=qs[_0x3bc2('0x37')](_0x55dbb3['query'][_0x3bc2('0x37')]);_0xd8907e['where']=qs['filters'](_[_0x3bc2('0x39')](_0x55dbb3[_0x3bc2('0x2d')],_0x58d54b['filters']));_0xd8907e[_0x3bc2('0x38')][_0x3bc2('0x53')]=_0x2b6ec7['id'];if(_0x55dbb3['query'][_0x3bc2('0x3c')]){_0xd8907e[_0x3bc2('0x38')]=_['merge'](_0xd8907e['where'],{'$or':_[_0x3bc2('0x26')](_0xd8907e['attributes'],function(_0x21fdc1){var _0x1d8ed3={};_0x1d8ed3[_0x21fdc1]={'$like':'%'+_0x55dbb3['query'][_0x3bc2('0x3c')]+'%'};return _0x1d8ed3;})});}_0xd8907e=_['merge']({},_0xd8907e,_0x55dbb3[_0x3bc2('0x3d')]);return db[_0x3bc2('0x57')][_0x3bc2('0x1a')]({'where':_0xd8907e[_0x3bc2('0x38')]})[_0x3bc2('0x1d')](function(_0x44d5b4){_0x19c273['count']=_0x44d5b4;if(_0x55dbb3[_0x3bc2('0x2d')]['includeAll']){_0xd8907e['include']=[{'all':!![]}];}return db[_0x3bc2('0x57')][_0x3bc2('0x55')](_0xd8907e);})[_0x3bc2('0x1d')](function(_0x20e156){_0x19c273[_0x3bc2('0x40')]=_0x20e156;return _0x19c273;});}})['then'](respondWithFilteredResult(_0x57c68f,_0xd8907e))['catch'](handleError(_0x57c68f,null));};function char(_0x1c4fb0){return'number'===typeof _0x1c4fb0?String[_0x3bc2('0x58')][_0x3bc2('0x59')](null,arguments):_0x1c4fb0;}function needsEncapsulation(_0x4a44be){return!!_0x4a44be&&(_0x4a44be[_0x3bc2('0x5a')]()[_0x3bc2('0x5b')](char(0xd))>=0x0||_0x4a44be['toString']()[_0x3bc2('0x5b')](char(0xa))>=0x0||_0x4a44be['toString']()[_0x3bc2('0x5b')](char(0x2c))>=0x0||_0x4a44be[_0x3bc2('0x5a')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x28b9fc){var _0xf9d09f=char(0x22),_0x4137c7='\x5c'+char(0x22),_0x411cfa=_0x28b9fc[_0x3bc2('0x5a')]()[_0x3bc2('0x5c')](new RegExp(_0xf9d09f,'g'),_0x4137c7);return _0xf9d09f+_0x411cfa+_0xf9d09f;}exports['getSummary']=function(_0x300dd7,_0x491a93,_0x3e6575){var _0x90a9a0,_0x1ad305;var _0x1d1aed={'where':{'ProjectId':_0x300dd7[_0x3bc2('0x42')]['id']}};if(_0x300dd7[_0x3bc2('0x2d')][_0x3bc2('0x5d')]){_0x1d1aed[_0x3bc2('0x38')][_0x3bc2('0x5e')]=JSON[_0x3bc2('0x5f')](_0x300dd7[_0x3bc2('0x2d')]['startTime']);}return db[_0x3bc2('0x54')][_0x3bc2('0x55')](_0x1d1aed)[_0x3bc2('0x1d')](handleEntityNotFound(_0x491a93,null))[_0x3bc2('0x1d')](function(_0x4eab13){if(_0x4eab13){_0x90a9a0=_0x4eab13;return db[_0x3bc2('0x60')]['findAll']({'where':{'SessionId':{'$in':_[_0x3bc2('0x26')](_0x90a9a0,'id')},'ProjectId':_0x300dd7['params']['id']},'order':'-createdAt'});}})[_0x3bc2('0x1d')](handleEntityNotFound(_0x491a93,null))[_0x3bc2('0x1d')](function(_0x118c9d){if(_0x118c9d){_0x1ad305=_0x118c9d;var _0x2f7538={};for(var _0x40a31a=0x0,_0x449f04=_0x1ad305['length'];_0x40a31a<_0x449f04;_0x40a31a++){if(!_0x2f7538[_0x3bc2('0x34')](_0x1ad305[_0x40a31a]['questionId'])){_0x2f7538[_0x1ad305[_0x40a31a][_0x3bc2('0x61')]]=needsEncapsulation(_0x1ad305[_0x40a31a][_0x3bc2('0x62')])?encapsulate(_0x1ad305[_0x40a31a][_0x3bc2('0x62')]):_0x1ad305[_0x40a31a]['question'];}}var _0x17e37e=[],_0x4b0040={};for(var _0x6357f1=0x0,_0x5d31c2=_0x90a9a0[_0x3bc2('0x33')];_0x6357f1<_0x5d31c2;_0x6357f1++){_0x4b0040={'ProjectId':_0x300dd7[_0x3bc2('0x42')]['id'],'SessionId':_0x90a9a0[_0x6357f1]['id'],'StartTime':moment(_0x90a9a0[_0x6357f1][_0x3bc2('0x5e')])[_0x3bc2('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4157f2=0x0,_0x4ab670=_0x1ad305[_0x3bc2('0x33')];_0x4157f2<_0x4ab670;_0x4157f2++){if(_0x1ad305[_0x4157f2][_0x3bc2('0x64')]==_0x90a9a0[_0x6357f1]['id']&&_0x2f7538[_0x3bc2('0x34')](_0x1ad305[_0x4157f2]['questionId'])){_0x4b0040[_0x2f7538[_0x1ad305[_0x4157f2][_0x3bc2('0x61')]]]=_0x1ad305[_0x4157f2]['answer'];}}for(var _0x22b469 in _0x2f7538){if(!_0x4b0040[_0x3bc2('0x34')](_0x2f7538[_0x22b469])){_0x4b0040[_0x2f7538[_0x22b469]]=null;}}_0x17e37e[_0x3bc2('0x65')](_0x4b0040);}return _0x17e37e;}})[_0x3bc2('0x1d')](function(_0xd49664){if(!_[_0x3bc2('0x66')](_0xd49664)){var _0x3ba454=toCsv(_0xd49664);var _0x1cc7df=Date[_0x3bc2('0x67')]();fs[_0x3bc2('0x68')](util[_0x3bc2('0x63')](_0x3bc2('0x69'),_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df),_0x3ba454);_0x491a93[_0x3bc2('0x6a')](_0x3bc2('0x6b'),'attachment;\x20filename='+util[_0x3bc2('0x63')]('Jscripty_Project_%d_Summary_%s.csv',_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df));_0x491a93[_0x3bc2('0x6a')](_0x3bc2('0x6c'),_0x3bc2('0x6d'));return _0x491a93[_0x3bc2('0x6e')](util[_0x3bc2('0x63')](_0x3bc2('0x69'),_0x300dd7[_0x3bc2('0x42')]['id'],_0x1cc7df));}else{return _0x491a93[_0x3bc2('0x22')](0xcc);}})[_0x3bc2('0x44')](handleError(_0x491a93,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 77bd9b7..7f711b9 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 _0xafca=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x4fe649,_0x336e11){var _0x16f336=function(_0x2b52c9){while(--_0x2b52c9){_0x4fe649['push'](_0x4fe649['shift']());}};_0x16f336(++_0x336e11);}(_0xafca,0x1ef));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaafc('0x0'));var util=require('util');var logger=require(_0xaafc('0x1'))(_0xaafc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaafc('0x3'));var fs=require('fs');var path=require(_0xaafc('0x4'));var rimraf=require(_0xaafc('0x5'));var config=require(_0xaafc('0x6'));var attributes=require(_0xaafc('0x7'));module['exports']=function(_0x3db4ed,_0x418fca){return _0x3db4ed[_0xaafc('0x8')](_0xaafc('0x9'),attributes,{'tableName':_0xaafc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0738=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0x33a21a,_0x22d1a8){var _0x4c628e=function(_0x59edab){while(--_0x59edab){_0x33a21a['push'](_0x33a21a['shift']());}};_0x4c628e(++_0x22d1a8);}(_0x0738,0x6e));var _0x8073=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x0738[_0x21c601];return _0xd423f;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var logger=require(_0x8073('0x1'))(_0x8073('0x2'));var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require(_0x8073('0x6'));var rimraf=require(_0x8073('0x7'));var config=require(_0x8073('0x8'));var attributes=require(_0x8073('0x9'));module[_0x8073('0xa')]=function(_0x2f90b9,_0x588057){return _0x2f90b9[_0x8073('0xb')](_0x8073('0xc'),attributes,{'tableName':_0x8073('0xd'),'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 3d36385..82e3909 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xcff7fc,_0xbedc0a){var _0x368ad2=function(_0x57978a){while(--_0x57978a){_0xcff7fc['push'](_0xcff7fc['shift']());}};_0x368ad2(++_0xbedc0a);}(_0x70e0,0x17b));var _0x070e=function(_0x3eb641,_0x386a08){_0x3eb641=_0x3eb641-0x0;var _0x57b3c1=_0x70e0[_0x3eb641];return _0x57b3c1;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xbdb7[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 926daae..b74531e 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 _0x00a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00a4,0x19e));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x400a('0x0'));var util=require(_0x400a('0x1'));var path=require(_0x400a('0x2'));var timeout=require(_0x400a('0x3'));var express=require(_0x400a('0x4'));var router=express['Router']();var fs_extra=require(_0x400a('0x5'));var auth=require(_0x400a('0x6'));var interaction=require(_0x400a('0x7'));var config=require(_0x400a('0x8'));var controller=require(_0x400a('0x9'));router[_0x400a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x400a('0xa')](_0x400a('0xb'),auth[_0x400a('0xc')](),controller[_0x400a('0xd')]);router[_0x400a('0xa')](_0x400a('0xe'),auth[_0x400a('0xc')](),controller[_0x400a('0xf')]);router['post']('/',auth[_0x400a('0xc')](),controller[_0x400a('0x10')]);router['put'](_0x400a('0xe'),auth['isAuthenticated'](),controller[_0x400a('0x11')]);router[_0x400a('0x12')]('/:id',auth[_0x400a('0xc')](),controller[_0x400a('0x13')]);module[_0x400a('0x14')]=router; \ No newline at end of file +var _0xf467=['delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','/:id','update'];(function(_0x53ae6f,_0x50cb80){var _0x472e18=function(_0x87bbe0){while(--_0x87bbe0){_0x53ae6f['push'](_0x53ae6f['shift']());}};_0x472e18(++_0x50cb80);}(_0xf467,0xae));var _0x7f46=function(_0x508748,_0x1e2240){_0x508748=_0x508748-0x0;var _0x45b366=_0xf467[_0x508748];return _0x45b366;};'use strict';var multer=require(_0x7f46('0x0'));var util=require(_0x7f46('0x1'));var path=require(_0x7f46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f46('0x3'));var auth=require(_0x7f46('0x4'));var interaction=require(_0x7f46('0x5'));var config=require(_0x7f46('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x7f46('0x7')]('/',auth[_0x7f46('0x8')](),controller[_0x7f46('0x9')]);router[_0x7f46('0x7')](_0x7f46('0xa'),auth['isAuthenticated'](),controller[_0x7f46('0xb')]);router[_0x7f46('0x7')]('/:id',auth[_0x7f46('0x8')](),controller[_0x7f46('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f46('0xd')]);router['put'](_0x7f46('0xe'),auth[_0x7f46('0x8')](),controller[_0x7f46('0xf')]);router[_0x7f46('0x10')](_0x7f46('0xe'),auth[_0x7f46('0x8')](),controller[_0x7f46('0x11')]);module[_0x7f46('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5e65563..c2638de 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 _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x363779,_0x51d41e){_0x363779=_0x363779-0x0;var _0x1b00bd=_0x7a54[_0x363779];return _0x1b00bd;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x371690,_0x173be6){_0x371690=_0x371690-0x0;var _0x5be647=_0x7a54[_0x371690];return _0x5be647;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index ad44d10..f6e3e5f 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 _0xc322=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','keys','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc322,0x17d));var _0x2c32=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xc322[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x2c32('0x0'));var rimraf=require(_0x2c32('0x1'));var zipdir=require(_0x2c32('0x2'));var jsonpatch=require(_0x2c32('0x3'));var rp=require(_0x2c32('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c32('0x5'));var util=require('util');var path=require(_0x2c32('0x6'));var sox=require(_0x2c32('0x7'));var csv=require(_0x2c32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c32('0x9'));var _=require(_0x2c32('0xa'));var squel=require('squel');var crypto=require(_0x2c32('0xb'));var jsforce=require(_0x2c32('0xc'));var deskjs=require(_0x2c32('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c32('0xe'));var Papa=require(_0x2c32('0xf'));var Redis=require(_0x2c32('0x10'));var authService=require(_0x2c32('0x11'));var qs=require(_0x2c32('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c32('0x13'));var logger=require(_0x2c32('0x14'))(_0x2c32('0x15'));var utils=require(_0x2c32('0x16'));var config=require(_0x2c32('0x17'));var licenseUtil=require(_0x2c32('0x18'));var db=require(_0x2c32('0x19'))['db'];function respondWithStatusCode(_0x47383c,_0x1a17e3){_0x1a17e3=_0x1a17e3||0xcc;return function(_0x350eb4){if(_0x350eb4){return _0x47383c[_0x2c32('0x1a')](_0x1a17e3);}return _0x47383c['status'](_0x1a17e3)[_0x2c32('0x1b')]();};}function respondWithResult(_0x45cb08,_0x31fe93){_0x31fe93=_0x31fe93||0xc8;return function(_0x1478d3){if(_0x1478d3){return _0x45cb08['status'](_0x31fe93)[_0x2c32('0x1c')](_0x1478d3);}};}function respondWithFilteredResult(_0x48e35c,_0x1688cc){return function(_0x1667f2){if(_0x1667f2){var _0x103246=typeof _0x1688cc[_0x2c32('0x1d')]===_0x2c32('0x1e')&&typeof _0x1688cc[_0x2c32('0x1f')]===_0x2c32('0x1e');var _0x4bf484=_0x1667f2['count'];var _0x5d1952=_0x103246?0x0:_0x1688cc['offset'];var _0x2b701e=_0x103246?_0x1667f2['count']:_0x1688cc[_0x2c32('0x1d')]+_0x1688cc[_0x2c32('0x1f')];var _0x2c37ff;if(_0x2b701e>=_0x4bf484){_0x2b701e=_0x4bf484;_0x2c37ff=0xc8;}else{_0x2c37ff=0xce;}_0x48e35c[_0x2c32('0x20')](_0x2c37ff);return _0x48e35c[_0x2c32('0x21')](_0x2c32('0x22'),_0x5d1952+'-'+_0x2b701e+'/'+_0x4bf484)[_0x2c32('0x1c')](_0x1667f2);}return null;};}function patchUpdates(_0x1ca7fe){return function(_0x2315da){try{jsonpatch[_0x2c32('0x23')](_0x2315da,_0x1ca7fe,!![]);}catch(_0x24113d){return BPromise[_0x2c32('0x24')](_0x24113d);}return _0x2315da[_0x2c32('0x25')]();};}function saveUpdates(_0xb5579a,_0x1f5fc5){return function(_0x297922){if(_0x297922){return _0x297922['update'](_0xb5579a)[_0x2c32('0x26')](function(_0x43a4fb){return _0x43a4fb;});}return null;};}function removeEntity(_0x4d87a8,_0x2afc2a){return function(_0x59810d){if(_0x59810d){return _0x59810d[_0x2c32('0x27')]()['then'](function(){_0x4d87a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ceca,_0x3dd4e8){return function(_0x22f896){if(!_0x22f896){_0x17ceca[_0x2c32('0x1a')](0x194);}return _0x22f896;};}function handleError(_0x74f500,_0x25f00e){_0x25f00e=_0x25f00e||0x1f4;return function(_0xfb8e12){logger[_0x2c32('0x28')](_0xfb8e12[_0x2c32('0x29')]);if(_0xfb8e12[_0x2c32('0x2a')]){delete _0xfb8e12[_0x2c32('0x2a')];}_0x74f500[_0x2c32('0x20')](_0x25f00e)[_0x2c32('0x2b')](_0xfb8e12);};}exports[_0x2c32('0x2c')]=function(_0x38b90a,_0x2a3b83){var _0x119da0={},_0x5492e7={},_0x331f2e={'count':0x0,'rows':[]};var _0x459d31=_[_0x2c32('0x2d')](db[_0x2c32('0x2e')][_0x2c32('0x2f')],function(_0xa75bd3){return{'name':_0xa75bd3[_0x2c32('0x30')],'type':_0xa75bd3['type']['key']};});_0x5492e7[_0x2c32('0x31')]=_[_0x2c32('0x2d')](_0x459d31,_0x2c32('0x2a'));_0x5492e7[_0x2c32('0x32')]=_['keys'](_0x38b90a[_0x2c32('0x32')]);_0x5492e7['filters']=_[_0x2c32('0x33')](_0x5492e7[_0x2c32('0x31')],_0x5492e7[_0x2c32('0x32')]);_0x119da0['attributes']=_[_0x2c32('0x33')](_0x5492e7[_0x2c32('0x31')],qs['fields'](_0x38b90a[_0x2c32('0x32')][_0x2c32('0x34')]));_0x119da0[_0x2c32('0x35')]=_0x119da0[_0x2c32('0x35')][_0x2c32('0x36')]?_0x119da0['attributes']:_0x5492e7[_0x2c32('0x31')];if(!_0x38b90a[_0x2c32('0x32')][_0x2c32('0x37')](_0x2c32('0x38'))){_0x119da0[_0x2c32('0x1f')]=qs[_0x2c32('0x1f')](_0x38b90a[_0x2c32('0x32')][_0x2c32('0x1f')]);_0x119da0['offset']=qs[_0x2c32('0x1d')](_0x38b90a[_0x2c32('0x32')][_0x2c32('0x1d')]);}_0x119da0[_0x2c32('0x39')]=qs[_0x2c32('0x3a')](_0x38b90a[_0x2c32('0x32')][_0x2c32('0x3a')]);_0x119da0[_0x2c32('0x3b')]=qs[_0x2c32('0x3c')](_[_0x2c32('0x3d')](_0x38b90a[_0x2c32('0x32')],_0x5492e7['filters']),_0x459d31);if(_0x38b90a[_0x2c32('0x32')]['filter']){_0x119da0[_0x2c32('0x3b')]=_['merge'](_0x119da0[_0x2c32('0x3b')],{'$or':_[_0x2c32('0x2d')](_0x459d31,function(_0x14700d){if(_0x14700d['type']!==_0x2c32('0x3e')){var _0x3102f1={};_0x3102f1[_0x14700d[_0x2c32('0x2a')]]={'$like':'%'+_0x38b90a[_0x2c32('0x32')][_0x2c32('0x3f')]+'%'};return _0x3102f1;}})});}_0x119da0=_[_0x2c32('0x40')]({},_0x119da0,_0x38b90a[_0x2c32('0x41')]);var _0x22acda={'where':_0x119da0[_0x2c32('0x3b')]};return db[_0x2c32('0x2e')][_0x2c32('0x42')](_0x22acda)[_0x2c32('0x26')](function(_0x274354){_0x331f2e[_0x2c32('0x42')]=_0x274354;if(_0x38b90a[_0x2c32('0x32')]['includeAll']){_0x119da0[_0x2c32('0x43')]=[{'all':!![]}];}return db[_0x2c32('0x2e')][_0x2c32('0x44')](_0x119da0);})['then'](function(_0x903560){_0x331f2e[_0x2c32('0x45')]=_0x903560;return _0x331f2e;})['then'](respondWithFilteredResult(_0x2a3b83,_0x119da0))[_0x2c32('0x46')](handleError(_0x2a3b83,null));};exports[_0x2c32('0x47')]=function(_0x162afc,_0x746713){var _0x5b2b3e={'raw':!![],'where':{'id':_0x162afc[_0x2c32('0x48')]['id']}},_0x53d980={};_0x53d980[_0x2c32('0x31')]=_[_0x2c32('0x49')](db[_0x2c32('0x2e')][_0x2c32('0x2f')]);_0x53d980['query']=_[_0x2c32('0x49')](_0x162afc[_0x2c32('0x32')]);_0x53d980[_0x2c32('0x3c')]=_['intersection'](_0x53d980[_0x2c32('0x31')],_0x53d980[_0x2c32('0x32')]);_0x5b2b3e[_0x2c32('0x35')]=_['intersection'](_0x53d980['model'],qs[_0x2c32('0x34')](_0x162afc['query'][_0x2c32('0x34')]));_0x5b2b3e[_0x2c32('0x35')]=_0x5b2b3e[_0x2c32('0x35')][_0x2c32('0x36')]?_0x5b2b3e['attributes']:_0x53d980[_0x2c32('0x31')];if(_0x162afc[_0x2c32('0x32')]['includeAll']){_0x5b2b3e[_0x2c32('0x43')]=[{'all':!![]}];}_0x5b2b3e=_['merge']({},_0x5b2b3e,_0x162afc[_0x2c32('0x41')]);return db[_0x2c32('0x2e')][_0x2c32('0x4a')](_0x5b2b3e)['then'](handleEntityNotFound(_0x746713,null))[_0x2c32('0x26')](respondWithResult(_0x746713,null))[_0x2c32('0x46')](handleError(_0x746713,null));};exports[_0x2c32('0x4b')]=function(_0x4540a7,_0x142f17){return db[_0x2c32('0x2e')]['create'](_0x4540a7['body'],{})['then'](respondWithResult(_0x142f17,0xc9))['catch'](handleError(_0x142f17,null));};exports[_0x2c32('0x4c')]=function(_0x597b0f,_0x282ce6){if(_0x597b0f[_0x2c32('0x4d')]['id']){delete _0x597b0f[_0x2c32('0x4d')]['id'];}return db['JscriptyQuestionReport'][_0x2c32('0x4a')]({'where':{'id':_0x597b0f[_0x2c32('0x48')]['id']}})['then'](handleEntityNotFound(_0x282ce6,null))[_0x2c32('0x26')](saveUpdates(_0x597b0f['body'],null))['then'](respondWithResult(_0x282ce6,null))[_0x2c32('0x46')](handleError(_0x282ce6,null));};exports[_0x2c32('0x27')]=function(_0x53c435,_0x3a155c){return db[_0x2c32('0x2e')]['find']({'where':{'id':_0x53c435[_0x2c32('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a155c,null))[_0x2c32('0x26')](removeEntity(_0x3a155c,null))[_0x2c32('0x46')](handleError(_0x3a155c,null));};exports['describe']=function(_0x167a61,_0xa70b30){return db[_0x2c32('0x2e')]['describe']()[_0x2c32('0x26')](respondWithResult(_0xa70b30,null))[_0x2c32('0x46')](handleError(_0xa70b30,null));}; \ No newline at end of file +var _0x4cb1=['bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x580fb7,_0x3d6fc8){var _0xcedb1c=function(_0x214810){while(--_0x214810){_0x580fb7['push'](_0x580fb7['shift']());}};_0xcedb1c(++_0x3d6fc8);}(_0x4cb1,0x1ca));var _0x14cb=function(_0x4b19a2,_0x3279fe){_0x4b19a2=_0x4b19a2-0x0;var _0x44f28e=_0x4cb1[_0x4b19a2];return _0x44f28e;};'use strict';var emlformat=require(_0x14cb('0x0'));var rimraf=require(_0x14cb('0x1'));var zipdir=require(_0x14cb('0x2'));var jsonpatch=require(_0x14cb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14cb('0x4'));var Mustache=require(_0x14cb('0x5'));var util=require(_0x14cb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x14cb('0x7'));var ejs=require(_0x14cb('0x8'));var fs=require('fs');var fs_extra=require(_0x14cb('0x9'));var _=require(_0x14cb('0xa'));var squel=require(_0x14cb('0xb'));var crypto=require(_0x14cb('0xc'));var jsforce=require(_0x14cb('0xd'));var deskjs=require(_0x14cb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x14cb('0xf'));var Papa=require('papaparse');var Redis=require(_0x14cb('0x10'));var authService=require(_0x14cb('0x11'));var qs=require(_0x14cb('0x12'));var as=require(_0x14cb('0x13'));var hardwareService=require(_0x14cb('0x14'));var logger=require(_0x14cb('0x15'))(_0x14cb('0x16'));var utils=require(_0x14cb('0x17'));var config=require(_0x14cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x14cb('0x19'))['db'];function respondWithStatusCode(_0x4e7e0e,_0x50c97d){_0x50c97d=_0x50c97d||0xcc;return function(_0x470548){if(_0x470548){return _0x4e7e0e['sendStatus'](_0x50c97d);}return _0x4e7e0e[_0x14cb('0x1a')](_0x50c97d)['end']();};}function respondWithResult(_0x40a6f4,_0x361736){_0x361736=_0x361736||0xc8;return function(_0x307696){if(_0x307696){return _0x40a6f4['status'](_0x361736)[_0x14cb('0x1b')](_0x307696);}};}function respondWithFilteredResult(_0x391579,_0x29d55c){return function(_0x2ba19c){if(_0x2ba19c){var _0x41c041=typeof _0x29d55c[_0x14cb('0x1c')]===_0x14cb('0x1d')&&typeof _0x29d55c['limit']===_0x14cb('0x1d');var _0x3274c6=_0x2ba19c[_0x14cb('0x1e')];var _0x1411fa=_0x41c041?0x0:_0x29d55c[_0x14cb('0x1c')];var _0x40c4d3=_0x41c041?_0x2ba19c[_0x14cb('0x1e')]:_0x29d55c[_0x14cb('0x1c')]+_0x29d55c[_0x14cb('0x1f')];var _0x2b3885;if(_0x40c4d3>=_0x3274c6){_0x40c4d3=_0x3274c6;_0x2b3885=0xc8;}else{_0x2b3885=0xce;}_0x391579['status'](_0x2b3885);return _0x391579[_0x14cb('0x20')](_0x14cb('0x21'),_0x1411fa+'-'+_0x40c4d3+'/'+_0x3274c6)['json'](_0x2ba19c);}return null;};}function patchUpdates(_0xfdcc43){return function(_0x2057fc){try{jsonpatch['apply'](_0x2057fc,_0xfdcc43,!![]);}catch(_0x4d746e){return BPromise[_0x14cb('0x22')](_0x4d746e);}return _0x2057fc[_0x14cb('0x23')]();};}function saveUpdates(_0x9342c4,_0x2105db){return function(_0xcd5df0){if(_0xcd5df0){return _0xcd5df0[_0x14cb('0x24')](_0x9342c4)[_0x14cb('0x25')](function(_0x51cf96){return _0x51cf96;});}return null;};}function removeEntity(_0x378726,_0x4e2ab1){return function(_0x4271eb){if(_0x4271eb){return _0x4271eb['destroy']()[_0x14cb('0x25')](function(){_0x378726[_0x14cb('0x1a')](0xcc)[_0x14cb('0x26')]();});}};}function handleEntityNotFound(_0x4b2538,_0x13855b){return function(_0x49123d){if(!_0x49123d){_0x4b2538[_0x14cb('0x27')](0x194);}return _0x49123d;};}function handleError(_0x3a6405,_0x1d9790){_0x1d9790=_0x1d9790||0x1f4;return function(_0x4eaddb){logger['error'](_0x4eaddb[_0x14cb('0x28')]);if(_0x4eaddb[_0x14cb('0x29')]){delete _0x4eaddb[_0x14cb('0x29')];}_0x3a6405[_0x14cb('0x1a')](_0x1d9790)[_0x14cb('0x2a')](_0x4eaddb);};}exports['index']=function(_0x511f9f,_0x2a898c){var _0x60b045={},_0x17f049={},_0x786f1f={'count':0x0,'rows':[]};var _0x5f5084=_[_0x14cb('0x2b')](db[_0x14cb('0x2c')][_0x14cb('0x2d')],function(_0x11e7ab){return{'name':_0x11e7ab[_0x14cb('0x2e')],'type':_0x11e7ab['type'][_0x14cb('0x2f')]};});_0x17f049[_0x14cb('0x30')]=_['map'](_0x5f5084,_0x14cb('0x29'));_0x17f049[_0x14cb('0x31')]=_[_0x14cb('0x32')](_0x511f9f[_0x14cb('0x31')]);_0x17f049[_0x14cb('0x33')]=_[_0x14cb('0x34')](_0x17f049[_0x14cb('0x30')],_0x17f049[_0x14cb('0x31')]);_0x60b045[_0x14cb('0x35')]=_['intersection'](_0x17f049['model'],qs['fields'](_0x511f9f['query'][_0x14cb('0x36')]));_0x60b045[_0x14cb('0x35')]=_0x60b045[_0x14cb('0x35')][_0x14cb('0x37')]?_0x60b045[_0x14cb('0x35')]:_0x17f049[_0x14cb('0x30')];if(!_0x511f9f[_0x14cb('0x31')]['hasOwnProperty'](_0x14cb('0x38'))){_0x60b045[_0x14cb('0x1f')]=qs[_0x14cb('0x1f')](_0x511f9f[_0x14cb('0x31')][_0x14cb('0x1f')]);_0x60b045['offset']=qs[_0x14cb('0x1c')](_0x511f9f[_0x14cb('0x31')]['offset']);}_0x60b045[_0x14cb('0x39')]=qs[_0x14cb('0x3a')](_0x511f9f[_0x14cb('0x31')][_0x14cb('0x3a')]);_0x60b045[_0x14cb('0x3b')]=qs[_0x14cb('0x33')](_['pick'](_0x511f9f[_0x14cb('0x31')],_0x17f049['filters']),_0x5f5084);if(_0x511f9f['query'][_0x14cb('0x3c')]){_0x60b045[_0x14cb('0x3b')]=_[_0x14cb('0x3d')](_0x60b045['where'],{'$or':_[_0x14cb('0x2b')](_0x5f5084,function(_0x4bc0aa){if(_0x4bc0aa[_0x14cb('0x3e')]!==_0x14cb('0x3f')){var _0x1ed209={};_0x1ed209[_0x4bc0aa['name']]={'$like':'%'+_0x511f9f[_0x14cb('0x31')][_0x14cb('0x3c')]+'%'};return _0x1ed209;}})});}_0x60b045=_[_0x14cb('0x3d')]({},_0x60b045,_0x511f9f[_0x14cb('0x40')]);var _0x409d9b={'where':_0x60b045[_0x14cb('0x3b')]};return db[_0x14cb('0x2c')]['count'](_0x409d9b)[_0x14cb('0x25')](function(_0x565383){_0x786f1f[_0x14cb('0x1e')]=_0x565383;if(_0x511f9f[_0x14cb('0x31')][_0x14cb('0x41')]){_0x60b045[_0x14cb('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x14cb('0x43')](_0x60b045);})[_0x14cb('0x25')](function(_0x230d8f){_0x786f1f[_0x14cb('0x44')]=_0x230d8f;return _0x786f1f;})[_0x14cb('0x25')](respondWithFilteredResult(_0x2a898c,_0x60b045))[_0x14cb('0x45')](handleError(_0x2a898c,null));};exports[_0x14cb('0x46')]=function(_0x58890b,_0x19ac56){var _0x5ad5f5={'raw':!![],'where':{'id':_0x58890b[_0x14cb('0x47')]['id']}},_0x447281={};_0x447281[_0x14cb('0x30')]=_[_0x14cb('0x32')](db[_0x14cb('0x2c')][_0x14cb('0x2d')]);_0x447281[_0x14cb('0x31')]=_[_0x14cb('0x32')](_0x58890b['query']);_0x447281[_0x14cb('0x33')]=_['intersection'](_0x447281[_0x14cb('0x30')],_0x447281['query']);_0x5ad5f5['attributes']=_[_0x14cb('0x34')](_0x447281[_0x14cb('0x30')],qs[_0x14cb('0x36')](_0x58890b[_0x14cb('0x31')][_0x14cb('0x36')]));_0x5ad5f5['attributes']=_0x5ad5f5[_0x14cb('0x35')][_0x14cb('0x37')]?_0x5ad5f5[_0x14cb('0x35')]:_0x447281['model'];if(_0x58890b[_0x14cb('0x31')][_0x14cb('0x41')]){_0x5ad5f5[_0x14cb('0x42')]=[{'all':!![]}];}_0x5ad5f5=_[_0x14cb('0x3d')]({},_0x5ad5f5,_0x58890b[_0x14cb('0x40')]);return db[_0x14cb('0x2c')]['find'](_0x5ad5f5)[_0x14cb('0x25')](handleEntityNotFound(_0x19ac56,null))[_0x14cb('0x25')](respondWithResult(_0x19ac56,null))[_0x14cb('0x45')](handleError(_0x19ac56,null));};exports[_0x14cb('0x48')]=function(_0x477978,_0x519733){return db[_0x14cb('0x2c')][_0x14cb('0x48')](_0x477978[_0x14cb('0x49')],{})[_0x14cb('0x25')](respondWithResult(_0x519733,0xc9))[_0x14cb('0x45')](handleError(_0x519733,null));};exports[_0x14cb('0x24')]=function(_0x5b1e6f,_0x537b40){if(_0x5b1e6f[_0x14cb('0x49')]['id']){delete _0x5b1e6f[_0x14cb('0x49')]['id'];}return db['JscriptyQuestionReport'][_0x14cb('0x4a')]({'where':{'id':_0x5b1e6f[_0x14cb('0x47')]['id']}})[_0x14cb('0x25')](handleEntityNotFound(_0x537b40,null))[_0x14cb('0x25')](saveUpdates(_0x5b1e6f['body'],null))[_0x14cb('0x25')](respondWithResult(_0x537b40,null))[_0x14cb('0x45')](handleError(_0x537b40,null));};exports[_0x14cb('0x4b')]=function(_0x17439b,_0x4df4cf){return db[_0x14cb('0x2c')]['find']({'where':{'id':_0x17439b['params']['id']}})[_0x14cb('0x25')](handleEntityNotFound(_0x4df4cf,null))[_0x14cb('0x25')](removeEntity(_0x4df4cf,null))['catch'](handleError(_0x4df4cf,null));};exports[_0x14cb('0x4c')]=function(_0x1b85c1,_0x5f2500){return db['JscriptyQuestionReport'][_0x14cb('0x4c')]()[_0x14cb('0x25')](respondWithResult(_0x5f2500,null))[_0x14cb('0x45')](handleError(_0x5f2500,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 372a1d0..f8d1c03 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 _0x40ae=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment'];(function(_0x263028,_0x19a701){var _0x5daa45=function(_0x19b7fe){while(--_0x19b7fe){_0x263028['push'](_0x263028['shift']());}};_0x5daa45(++_0x19a701);}(_0x40ae,0x1d0));var _0xe40a=function(_0x491090,_0x23b5d6){_0x491090=_0x491090-0x0;var _0xc5d386=_0x40ae[_0x491090];return _0xc5d386;};'use strict';var _=require(_0xe40a('0x0'));var util=require('util');var logger=require(_0xe40a('0x1'))(_0xe40a('0x2'));var moment=require(_0xe40a('0x3'));var BPromise=require(_0xe40a('0x4'));var rp=require(_0xe40a('0x5'));var fs=require('fs');var path=require(_0xe40a('0x6'));var rimraf=require(_0xe40a('0x7'));var config=require(_0xe40a('0x8'));var attributes=require(_0xe40a('0x9'));module['exports']=function(_0x569f1b,_0x14532c){return _0x569f1b[_0xe40a('0xa')](_0xe40a('0xb'),attributes,{'tableName':_0xe40a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8313=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3da558,_0x45dab3){var _0x5d3e24=function(_0x53c26f){while(--_0x53c26f){_0x3da558['push'](_0x3da558['shift']());}};_0x5d3e24(++_0x45dab3);}(_0x8313,0x123));var _0x3831=function(_0x3cb61e,_0x73fe2c){_0x3cb61e=_0x3cb61e-0x0;var _0x3e5210=_0x8313[_0x3cb61e];return _0x3e5210;};'use strict';var _=require(_0x3831('0x0'));var util=require('util');var logger=require(_0x3831('0x1'))(_0x3831('0x2'));var moment=require('moment');var BPromise=require(_0x3831('0x3'));var rp=require(_0x3831('0x4'));var fs=require('fs');var path=require(_0x3831('0x5'));var rimraf=require(_0x3831('0x6'));var config=require(_0x3831('0x7'));var attributes=require(_0x3831('0x8'));module[_0x3831('0x9')]=function(_0x5ee374,_0x207dd9){return _0x5ee374['define']('JscriptyQuestionReport',attributes,{'tableName':_0x3831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ec653a9..405695a 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 _0x5f56=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3521a4,_0x130479){var _0x544301=function(_0x7c8606){while(--_0x7c8606){_0x3521a4['push'](_0x3521a4['shift']());}};_0x544301(++_0x130479);}(_0x5f56,0x11c));var _0x65f5=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0x5f56[_0x1e8c4e];return _0x19088a;};'use strict';var _=require(_0x65f5('0x0'));var util=require(_0x65f5('0x1'));var moment=require(_0x65f5('0x2'));var BPromise=require(_0x65f5('0x3'));var rs=require(_0x65f5('0x4'));var fs=require('fs');var Redis=require(_0x65f5('0x5'));var db=require(_0x65f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x65f5('0x7'))('rpc');var config=require(_0x65f5('0x8'));var jayson=require(_0x65f5('0x9'));var client=jayson[_0x65f5('0xa')][_0x65f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48591e,_0x38851d,_0x7cce99){return new BPromise(function(_0x5a16e1,_0xe96fc4){return client[_0x65f5('0xc')](_0x48591e,_0x7cce99)[_0x65f5('0xd')](function(_0x18fd5e){logger[_0x65f5('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38851d,_0x65f5('0xf'));logger['debug'](_0x65f5('0x10'),_0x38851d,_0x65f5('0xf'),JSON[_0x65f5('0x11')](_0x18fd5e));if(_0x18fd5e[_0x65f5('0x12')]){if(_0x18fd5e[_0x65f5('0x12')][_0x65f5('0x13')]===0x1f4){logger['error'](_0x65f5('0x14'),_0x38851d,_0x18fd5e[_0x65f5('0x12')]['message']);return _0xe96fc4(_0x18fd5e['error'][_0x65f5('0x15')]);}logger['error'](_0x65f5('0x14'),_0x38851d,_0x18fd5e[_0x65f5('0x12')][_0x65f5('0x15')]);return _0x5a16e1(_0x18fd5e[_0x65f5('0x12')][_0x65f5('0x15')]);}else{logger[_0x65f5('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x38851d,'request\x20sent');_0x5a16e1(_0x18fd5e[_0x65f5('0x16')][_0x65f5('0x15')]);}})[_0x65f5('0x17')](function(_0x208129){logger[_0x65f5('0x12')](_0x65f5('0x14'),_0x38851d,_0x208129);_0xe96fc4(_0x208129);});});} \ No newline at end of file +var _0x782b=['rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52533c,_0x5af53e){var _0xaaedca=function(_0x596aa5){while(--_0x596aa5){_0x52533c['push'](_0x52533c['shift']());}};_0xaaedca(++_0x5af53e);}(_0x782b,0x1c0));var _0xb782=function(_0x456b45,_0x273834){_0x456b45=_0x456b45-0x0;var _0xe3627d=_0x782b[_0x456b45];return _0xe3627d;};'use strict';var _=require(_0xb782('0x0'));var util=require(_0xb782('0x1'));var moment=require(_0xb782('0x2'));var BPromise=require(_0xb782('0x3'));var rs=require(_0xb782('0x4'));var fs=require('fs');var Redis=require(_0xb782('0x5'));var db=require(_0xb782('0x6'))['db'];var utils=require(_0xb782('0x7'));var logger=require('../../config/logger')(_0xb782('0x8'));var config=require(_0xb782('0x9'));var jayson=require(_0xb782('0xa'));var client=jayson[_0xb782('0xb')][_0xb782('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x405e11,_0x3de0ad,_0x3f9eaa){return new BPromise(function(_0x2a0229,_0x7be82){return client[_0xb782('0xd')](_0x405e11,_0x3f9eaa)[_0xb782('0xe')](function(_0x174a83){logger['info'](_0xb782('0xf'),_0x3de0ad,_0xb782('0x10'));logger[_0xb782('0x11')](_0xb782('0x12'),_0x3de0ad,_0xb782('0x10'),JSON['stringify'](_0x174a83));if(_0x174a83[_0xb782('0x13')]){if(_0x174a83[_0xb782('0x13')][_0xb782('0x14')]===0x1f4){logger['error'](_0xb782('0xf'),_0x3de0ad,_0x174a83['error'][_0xb782('0x15')]);return _0x7be82(_0x174a83[_0xb782('0x13')][_0xb782('0x15')]);}logger[_0xb782('0x13')](_0xb782('0xf'),_0x3de0ad,_0x174a83[_0xb782('0x13')]['message']);return _0x2a0229(_0x174a83[_0xb782('0x13')][_0xb782('0x15')]);}else{logger[_0xb782('0x16')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3de0ad,'request\x20sent');_0x2a0229(_0x174a83['result'][_0xb782('0x15')]);}})[_0xb782('0x17')](function(_0x1543ae){logger[_0xb782('0x13')](_0xb782('0xf'),_0x3de0ad,_0x1543ae);_0x7be82(_0x1543ae);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b5c5bd5..2e58b07 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 _0x5198=['getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions'];(function(_0xe159d9,_0x36d09f){var _0x598172=function(_0x270ee6){while(--_0x270ee6){_0xe159d9['push'](_0xe159d9['shift']());}};_0x598172(++_0x36d09f);}(_0x5198,0xb8));var _0x8519=function(_0x107883,_0x1c248a){_0x107883=_0x107883-0x0;var _0x5d9bda=_0x5198[_0x107883];return _0x5d9bda;};'use strict';var multer=require(_0x8519('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8519('0x1'));var express=require(_0x8519('0x2'));var router=express[_0x8519('0x3')]();var fs_extra=require(_0x8519('0x4'));var auth=require(_0x8519('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8519('0x6'));router[_0x8519('0x7')]('/',auth[_0x8519('0x8')](),controller[_0x8519('0x9')]);router[_0x8519('0x7')](_0x8519('0xa'),auth[_0x8519('0x8')](),controller[_0x8519('0xb')]);router['get'](_0x8519('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8519('0x7')](_0x8519('0xd'),auth[_0x8519('0x8')](),controller[_0x8519('0xe')]);router[_0x8519('0xf')]('/',auth[_0x8519('0x8')](),controller[_0x8519('0x10')]);router[_0x8519('0x11')](_0x8519('0xc'),auth['isAuthenticated'](),controller[_0x8519('0x12')]);router[_0x8519('0x13')]('/:id',auth[_0x8519('0x8')](),controller[_0x8519('0x14')]);module[_0x8519('0x15')]=router; \ No newline at end of file +var _0x2019=['/:id/questions','getQuestions','post','create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0xc4d7de,_0x261f1f){var _0x3755e9=function(_0x1d4925){while(--_0x1d4925){_0xc4d7de['push'](_0xc4d7de['shift']());}};_0x3755e9(++_0x261f1f);}(_0x2019,0x8a));var _0x9201=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2019[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9201('0x0'));var util=require(_0x9201('0x1'));var path=require('path');var timeout=require(_0x9201('0x2'));var express=require(_0x9201('0x3'));var router=express[_0x9201('0x4')]();var fs_extra=require(_0x9201('0x5'));var auth=require(_0x9201('0x6'));var interaction=require(_0x9201('0x7'));var config=require(_0x9201('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x9201('0x9')](),controller[_0x9201('0xa')]);router[_0x9201('0xb')](_0x9201('0xc'),auth['isAuthenticated'](),controller[_0x9201('0xd')]);router[_0x9201('0xb')](_0x9201('0xe'),auth[_0x9201('0x9')](),controller[_0x9201('0xf')]);router['get'](_0x9201('0x10'),auth['isAuthenticated'](),controller[_0x9201('0x11')]);router[_0x9201('0x12')]('/',auth[_0x9201('0x9')](),controller[_0x9201('0x13')]);router['put'](_0x9201('0xe'),auth[_0x9201('0x9')](),controller['update']);router['delete'](_0x9201('0xe'),auth['isAuthenticated'](),controller[_0x9201('0x14')]);module[_0x9201('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4fd039b..b08e807 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 _0xf6eb=['moment','sequelize','exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf6eb,0x1a7));var _0xbf6e=function(_0x45b612,_0x4627b2){_0x45b612=_0x45b612-0x0;var _0x24c453=_0xf6eb[_0x45b612];return _0x24c453;};'use strict';var moment=require(_0xbf6e('0x0'));var Sequelize=require(_0xbf6e('0x1'));module[_0xbf6e('0x2')]={'starttime':{'type':Sequelize[_0xbf6e('0x3')],'set':function(_0x490577){this[_0xbf6e('0x4')]('starttime',_0x490577);this['setDataValue'](_0xbf6e('0x5'),moment()['format'](_0xbf6e('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xbf6e('0x7')]},'projectname':{'type':Sequelize[_0xbf6e('0x7')]},'queue':{'type':Sequelize[_0xbf6e('0x7')]},'uniqueid':{'type':Sequelize[_0xbf6e('0x7')]},'calleridname':{'type':Sequelize[_0xbf6e('0x7')]},'calleridnum':{'type':Sequelize[_0xbf6e('0x7')]},'completed':{'type':Sequelize[_0xbf6e('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xf5da=['sequelize','exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN','moment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0xf5da[_0x323c7e];return _0x2b0f72;};'use strict';var moment=require(_0xaf5d('0x0'));var Sequelize=require(_0xaf5d('0x1'));module[_0xaf5d('0x2')]={'starttime':{'type':Sequelize[_0xaf5d('0x3')],'set':function(_0x2e8f18){this[_0xaf5d('0x4')]('starttime',_0x2e8f18);this[_0xaf5d('0x4')](_0xaf5d('0x5'),moment()[_0xaf5d('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xaf5d('0x7')]},'uniqueid':{'type':Sequelize[_0xaf5d('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaf5d('0x7')]},'completed':{'type':Sequelize[_0xaf5d('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6931c6a..c6febed 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 _0x3364=['length','create','body','find','destroy','params','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','save','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','count','include','rows','catch','show'];(function(_0x9032ed,_0x73f95f){var _0x1eb92f=function(_0x4ae7bd){while(--_0x4ae7bd){_0x9032ed['push'](_0x9032ed['shift']());}};_0x1eb92f(++_0x73f95f);}(_0x3364,0xfb));var _0x4336=function(_0x183dd9,_0x55bfe0){_0x183dd9=_0x183dd9-0x0;var _0x52e6c7=_0x3364[_0x183dd9];return _0x52e6c7;};'use strict';var emlformat=require(_0x4336('0x0'));var rimraf=require(_0x4336('0x1'));var zipdir=require(_0x4336('0x2'));var jsonpatch=require(_0x4336('0x3'));var rp=require(_0x4336('0x4'));var moment=require(_0x4336('0x5'));var BPromise=require(_0x4336('0x6'));var Mustache=require(_0x4336('0x7'));var util=require(_0x4336('0x8'));var path=require(_0x4336('0x9'));var sox=require(_0x4336('0xa'));var csv=require(_0x4336('0xb'));var ejs=require(_0x4336('0xc'));var fs=require('fs');var fs_extra=require(_0x4336('0xd'));var _=require(_0x4336('0xe'));var squel=require(_0x4336('0xf'));var crypto=require(_0x4336('0x10'));var jsforce=require(_0x4336('0x11'));var deskjs=require(_0x4336('0x12'));var toCsv=require(_0x4336('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4336('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4336('0x14'));var hardwareService=require(_0x4336('0x15'));var logger=require(_0x4336('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x4336('0x17'));var licenseUtil=require(_0x4336('0x18'));var db=require(_0x4336('0x19'))['db'];function respondWithStatusCode(_0x133c13,_0x3805e5){_0x3805e5=_0x3805e5||0xcc;return function(_0x1c018c){if(_0x1c018c){return _0x133c13['sendStatus'](_0x3805e5);}return _0x133c13[_0x4336('0x1a')](_0x3805e5)[_0x4336('0x1b')]();};}function respondWithResult(_0x49409f,_0x5b6f35){_0x5b6f35=_0x5b6f35||0xc8;return function(_0xf7057a){if(_0xf7057a){return _0x49409f['status'](_0x5b6f35)[_0x4336('0x1c')](_0xf7057a);}};}function respondWithFilteredResult(_0x131a6e,_0x3c3048){return function(_0x3e2840){if(_0x3e2840){var _0x925d88=typeof _0x3c3048[_0x4336('0x1d')]==='undefined'&&typeof _0x3c3048['limit']===_0x4336('0x1e');var _0x4bfde2=_0x3e2840['count'];var _0x3a720b=_0x925d88?0x0:_0x3c3048[_0x4336('0x1d')];var _0x30fa93=_0x925d88?_0x3e2840['count']:_0x3c3048[_0x4336('0x1d')]+_0x3c3048[_0x4336('0x1f')];var _0x27d0b7;if(_0x30fa93>=_0x4bfde2){_0x30fa93=_0x4bfde2;_0x27d0b7=0xc8;}else{_0x27d0b7=0xce;}_0x131a6e[_0x4336('0x1a')](_0x27d0b7);return _0x131a6e[_0x4336('0x20')]('Content-Range',_0x3a720b+'-'+_0x30fa93+'/'+_0x4bfde2)[_0x4336('0x1c')](_0x3e2840);}return null;};}function patchUpdates(_0x53f77f){return function(_0xfff6bb){try{jsonpatch[_0x4336('0x21')](_0xfff6bb,_0x53f77f,!![]);}catch(_0x143190){return BPromise[_0x4336('0x22')](_0x143190);}return _0xfff6bb[_0x4336('0x23')]();};}function saveUpdates(_0x50f185,_0x2bf3af){return function(_0x4de110){if(_0x4de110){return _0x4de110['update'](_0x50f185)[_0x4336('0x24')](function(_0x3d2f05){return _0x3d2f05;});}return null;};}function removeEntity(_0x53ffbb,_0x330eae){return function(_0x1b52fa){if(_0x1b52fa){return _0x1b52fa['destroy']()[_0x4336('0x24')](function(){_0x53ffbb[_0x4336('0x1a')](0xcc)[_0x4336('0x1b')]();});}};}function handleEntityNotFound(_0xd8e05d,_0x2fefc3){return function(_0x4e0d02){if(!_0x4e0d02){_0xd8e05d['sendStatus'](0x194);}return _0x4e0d02;};}function handleError(_0x56130c,_0x53f3a7){_0x53f3a7=_0x53f3a7||0x1f4;return function(_0x1e9bce){logger[_0x4336('0x25')](_0x1e9bce[_0x4336('0x26')]);if(_0x1e9bce['name']){delete _0x1e9bce[_0x4336('0x27')];}_0x56130c[_0x4336('0x1a')](_0x53f3a7)[_0x4336('0x28')](_0x1e9bce);};}exports[_0x4336('0x29')]=function(_0x180240,_0x2de6e1){var _0x50084d={},_0x308d14={},_0x5b3e35={'count':0x0,'rows':[]};var _0x1a2c1a=_[_0x4336('0x2a')](db[_0x4336('0x2b')][_0x4336('0x2c')],function(_0x54d4b6){return{'name':_0x54d4b6[_0x4336('0x2d')],'type':_0x54d4b6['type'][_0x4336('0x2e')]};});_0x308d14[_0x4336('0x2f')]=_[_0x4336('0x2a')](_0x1a2c1a,'name');_0x308d14['query']=_[_0x4336('0x30')](_0x180240['query']);_0x308d14[_0x4336('0x31')]=_[_0x4336('0x32')](_0x308d14[_0x4336('0x2f')],_0x308d14[_0x4336('0x33')]);_0x50084d[_0x4336('0x34')]=_['intersection'](_0x308d14[_0x4336('0x2f')],qs[_0x4336('0x35')](_0x180240[_0x4336('0x33')][_0x4336('0x35')]));_0x50084d[_0x4336('0x34')]=_0x50084d[_0x4336('0x34')]['length']?_0x50084d[_0x4336('0x34')]:_0x308d14[_0x4336('0x2f')];if(!_0x180240['query'][_0x4336('0x36')](_0x4336('0x37'))){_0x50084d[_0x4336('0x1f')]=qs['limit'](_0x180240[_0x4336('0x33')][_0x4336('0x1f')]);_0x50084d[_0x4336('0x1d')]=qs[_0x4336('0x1d')](_0x180240[_0x4336('0x33')][_0x4336('0x1d')]);}_0x50084d[_0x4336('0x38')]=qs[_0x4336('0x39')](_0x180240[_0x4336('0x33')][_0x4336('0x39')]);_0x50084d[_0x4336('0x3a')]=qs[_0x4336('0x31')](_[_0x4336('0x3b')](_0x180240[_0x4336('0x33')],_0x308d14[_0x4336('0x31')]),_0x1a2c1a);if(_0x180240[_0x4336('0x33')][_0x4336('0x3c')]){_0x50084d['where']=_['merge'](_0x50084d['where'],{'$or':_[_0x4336('0x2a')](_0x1a2c1a,function(_0x249fd8){if(_0x249fd8[_0x4336('0x3d')]!=='VIRTUAL'){var _0x269353={};_0x269353[_0x249fd8[_0x4336('0x27')]]={'$like':'%'+_0x180240['query']['filter']+'%'};return _0x269353;}})});}_0x50084d=_[_0x4336('0x3e')]({},_0x50084d,_0x180240[_0x4336('0x3f')]);var _0x494875={'where':_0x50084d['where']};return db[_0x4336('0x2b')]['count'](_0x494875)[_0x4336('0x24')](function(_0x2d8df4){_0x5b3e35[_0x4336('0x40')]=_0x2d8df4;if(_0x180240[_0x4336('0x33')]['includeAll']){_0x50084d[_0x4336('0x41')]=[{'all':!![]}];}return db[_0x4336('0x2b')]['findAll'](_0x50084d);})[_0x4336('0x24')](function(_0x1d60fa){_0x5b3e35[_0x4336('0x42')]=_0x1d60fa;return _0x5b3e35;})[_0x4336('0x24')](respondWithFilteredResult(_0x2de6e1,_0x50084d))[_0x4336('0x43')](handleError(_0x2de6e1,null));};exports[_0x4336('0x44')]=function(_0x3b09a4,_0x38a989){var _0x1220f2={'raw':!![],'where':{'id':_0x3b09a4['params']['id']}},_0x4ffedf={};_0x4ffedf['model']=_[_0x4336('0x30')](db[_0x4336('0x2b')][_0x4336('0x2c')]);_0x4ffedf[_0x4336('0x33')]=_[_0x4336('0x30')](_0x3b09a4[_0x4336('0x33')]);_0x4ffedf[_0x4336('0x31')]=_['intersection'](_0x4ffedf[_0x4336('0x2f')],_0x4ffedf[_0x4336('0x33')]);_0x1220f2[_0x4336('0x34')]=_[_0x4336('0x32')](_0x4ffedf[_0x4336('0x2f')],qs['fields'](_0x3b09a4['query']['fields']));_0x1220f2[_0x4336('0x34')]=_0x1220f2[_0x4336('0x34')][_0x4336('0x45')]?_0x1220f2['attributes']:_0x4ffedf[_0x4336('0x2f')];if(_0x3b09a4[_0x4336('0x33')]['includeAll']){_0x1220f2[_0x4336('0x41')]=[{'all':!![]}];}_0x1220f2=_['merge']({},_0x1220f2,_0x3b09a4[_0x4336('0x3f')]);return db[_0x4336('0x2b')]['find'](_0x1220f2)[_0x4336('0x24')](handleEntityNotFound(_0x38a989,null))[_0x4336('0x24')](respondWithResult(_0x38a989,null))[_0x4336('0x43')](handleError(_0x38a989,null));};exports[_0x4336('0x46')]=function(_0x57ddc7,_0x2257b3){return db[_0x4336('0x2b')][_0x4336('0x46')](_0x57ddc7[_0x4336('0x47')],{})[_0x4336('0x24')](respondWithResult(_0x2257b3,0xc9))[_0x4336('0x43')](handleError(_0x2257b3,null));};exports['update']=function(_0x4f8b90,_0x580d2d){if(_0x4f8b90[_0x4336('0x47')]['id']){delete _0x4f8b90[_0x4336('0x47')]['id'];}return db[_0x4336('0x2b')][_0x4336('0x48')]({'where':{'id':_0x4f8b90['params']['id']}})['then'](handleEntityNotFound(_0x580d2d,null))[_0x4336('0x24')](saveUpdates(_0x4f8b90['body'],null))[_0x4336('0x24')](respondWithResult(_0x580d2d,null))[_0x4336('0x43')](handleError(_0x580d2d,null));};exports[_0x4336('0x49')]=function(_0x251013,_0x3ce5cd){return db[_0x4336('0x2b')][_0x4336('0x48')]({'where':{'id':_0x251013[_0x4336('0x4a')]['id']}})[_0x4336('0x24')](handleEntityNotFound(_0x3ce5cd,null))['then'](removeEntity(_0x3ce5cd,null))[_0x4336('0x43')](handleError(_0x3ce5cd,null));};exports['describe']=function(_0xc23b94,_0x5d1791){return db['JscriptySessionReport']['describe']()[_0x4336('0x24')](respondWithResult(_0x5d1791,null))[_0x4336('0x43')](handleError(_0x5d1791,null));};exports[_0x4336('0x4b')]=function(_0x485f13,_0x441c86,_0x6510a1){var _0x579607={'raw':!![],'where':{}};var _0x33472a={};var _0x3ba6e4={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x4336('0x4c')]({'where':{'id':_0x485f13[_0x4336('0x4a')]['id']}})[_0x4336('0x24')](handleEntityNotFound(_0x441c86,null))[_0x4336('0x24')](function(_0x72ee19){if(_0x72ee19){_0x33472a['model']=_[_0x4336('0x30')](db[_0x4336('0x4d')][_0x4336('0x2c')]);_0x33472a['query']=_[_0x4336('0x30')](_0x485f13[_0x4336('0x33')]);_0x33472a[_0x4336('0x31')]=_[_0x4336('0x32')](_0x33472a[_0x4336('0x2f')],_0x33472a[_0x4336('0x33')]);_0x579607[_0x4336('0x34')]=_[_0x4336('0x32')](_0x33472a[_0x4336('0x2f')],qs['fields'](_0x485f13[_0x4336('0x33')][_0x4336('0x35')]));_0x579607[_0x4336('0x34')]=_0x579607[_0x4336('0x34')]['length']?_0x579607[_0x4336('0x34')]:_0x33472a[_0x4336('0x2f')];if(!_0x485f13[_0x4336('0x33')]['hasOwnProperty'](_0x4336('0x37'))){_0x579607['limit']=qs[_0x4336('0x1f')](_0x485f13[_0x4336('0x33')][_0x4336('0x1f')]);_0x579607['offset']=qs[_0x4336('0x1d')](_0x485f13[_0x4336('0x33')]['offset']);}_0x579607[_0x4336('0x38')]=qs['sort'](_0x485f13[_0x4336('0x33')][_0x4336('0x39')]);_0x579607[_0x4336('0x3a')]=qs['filters'](_[_0x4336('0x3b')](_0x485f13[_0x4336('0x33')],_0x33472a[_0x4336('0x31')]));_0x579607[_0x4336('0x3a')][_0x4336('0x4e')]=_0x72ee19['id'];if(_0x485f13['query'][_0x4336('0x3c')]){_0x579607[_0x4336('0x3a')]=_[_0x4336('0x3e')](_0x579607['where'],{'$or':_['map'](_0x579607[_0x4336('0x34')],function(_0x471f6d){var _0x3a1c3c={};_0x3a1c3c[_0x471f6d]={'$like':'%'+_0x485f13[_0x4336('0x33')][_0x4336('0x3c')]+'%'};return _0x3a1c3c;})});}_0x579607=_[_0x4336('0x3e')]({},_0x579607,_0x485f13[_0x4336('0x3f')]);return db[_0x4336('0x4d')][_0x4336('0x40')]({'where':_0x579607[_0x4336('0x3a')]})[_0x4336('0x24')](function(_0x2777c6){_0x3ba6e4[_0x4336('0x40')]=_0x2777c6;if(_0x485f13[_0x4336('0x33')]['includeAll']){_0x579607[_0x4336('0x41')]=[{'all':!![]}];}return db[_0x4336('0x4d')][_0x4336('0x4f')](_0x579607);})['then'](function(_0x43ba45){_0x3ba6e4[_0x4336('0x42')]=_0x43ba45;return _0x3ba6e4;});}})[_0x4336('0x24')](respondWithFilteredResult(_0x441c86,_0x579607))[_0x4336('0x43')](handleError(_0x441c86,null));}; \ No newline at end of file +var _0xf141=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','update','then','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x5f10c3,_0x420d0e){var _0x355368=function(_0x3fd315){while(--_0x3fd315){_0x5f10c3['push'](_0x5f10c3['shift']());}};_0x355368(++_0x420d0e);}(_0xf141,0x115));var _0x1f14=function(_0x533fe7,_0x5aac33){_0x533fe7=_0x533fe7-0x0;var _0x4d5d63=_0xf141[_0x533fe7];return _0x4d5d63;};'use strict';var emlformat=require(_0x1f14('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f14('0x1'));var Mustache=require(_0x1f14('0x2'));var util=require('util');var path=require(_0x1f14('0x3'));var sox=require(_0x1f14('0x4'));var csv=require(_0x1f14('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f14('0x6'));var _=require('lodash');var squel=require(_0x1f14('0x7'));var crypto=require(_0x1f14('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1f14('0x9'));var toCsv=require(_0x1f14('0x5'));var querystring=require(_0x1f14('0xa'));var Papa=require(_0x1f14('0xb'));var Redis=require(_0x1f14('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1f14('0xd'));var as=require(_0x1f14('0xe'));var hardwareService=require(_0x1f14('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x1f14('0x10'));var config=require(_0x1f14('0x11'));var licenseUtil=require(_0x1f14('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f50be,_0x44fa54){_0x44fa54=_0x44fa54||0xcc;return function(_0x1ce4dd){if(_0x1ce4dd){return _0x5f50be[_0x1f14('0x13')](_0x44fa54);}return _0x5f50be[_0x1f14('0x14')](_0x44fa54)[_0x1f14('0x15')]();};}function respondWithResult(_0x4f1f0f,_0x4cd7c5){_0x4cd7c5=_0x4cd7c5||0xc8;return function(_0x441eeb){if(_0x441eeb){return _0x4f1f0f['status'](_0x4cd7c5)[_0x1f14('0x16')](_0x441eeb);}};}function respondWithFilteredResult(_0x222f15,_0x177dc6){return function(_0x476dbd){if(_0x476dbd){var _0x44491e=typeof _0x177dc6['offset']==='undefined'&&typeof _0x177dc6[_0x1f14('0x17')]===_0x1f14('0x18');var _0x5d4956=_0x476dbd['count'];var _0x5607ce=_0x44491e?0x0:_0x177dc6[_0x1f14('0x19')];var _0x2d521c=_0x44491e?_0x476dbd[_0x1f14('0x1a')]:_0x177dc6[_0x1f14('0x19')]+_0x177dc6['limit'];var _0xb854b5;if(_0x2d521c>=_0x5d4956){_0x2d521c=_0x5d4956;_0xb854b5=0xc8;}else{_0xb854b5=0xce;}_0x222f15[_0x1f14('0x14')](_0xb854b5);return _0x222f15['set'](_0x1f14('0x1b'),_0x5607ce+'-'+_0x2d521c+'/'+_0x5d4956)['json'](_0x476dbd);}return null;};}function patchUpdates(_0x193e6c){return function(_0x1cb529){try{jsonpatch[_0x1f14('0x1c')](_0x1cb529,_0x193e6c,!![]);}catch(_0x3834f5){return BPromise[_0x1f14('0x1d')](_0x3834f5);}return _0x1cb529['save']();};}function saveUpdates(_0x41cf81,_0xfde27a){return function(_0x375cbe){if(_0x375cbe){return _0x375cbe[_0x1f14('0x1e')](_0x41cf81)[_0x1f14('0x1f')](function(_0x2b6b8f){return _0x2b6b8f;});}return null;};}function removeEntity(_0x1927f0,_0x357379){return function(_0x5cca9f){if(_0x5cca9f){return _0x5cca9f['destroy']()[_0x1f14('0x1f')](function(){_0x1927f0['status'](0xcc)[_0x1f14('0x15')]();});}};}function handleEntityNotFound(_0x5ebdce,_0x28c0d2){return function(_0x15945c){if(!_0x15945c){_0x5ebdce[_0x1f14('0x13')](0x194);}return _0x15945c;};}function handleError(_0x6a4c34,_0x45cdcc){_0x45cdcc=_0x45cdcc||0x1f4;return function(_0x5388e4){logger['error'](_0x5388e4[_0x1f14('0x20')]);if(_0x5388e4[_0x1f14('0x21')]){delete _0x5388e4[_0x1f14('0x21')];}_0x6a4c34[_0x1f14('0x14')](_0x45cdcc)['send'](_0x5388e4);};}exports[_0x1f14('0x22')]=function(_0x1946f0,_0x5b5422){var _0xf0ffcb={},_0x2350e9={},_0x80f087={'count':0x0,'rows':[]};var _0x5880a5=_[_0x1f14('0x23')](db[_0x1f14('0x24')][_0x1f14('0x25')],function(_0x475fa7){return{'name':_0x475fa7[_0x1f14('0x26')],'type':_0x475fa7['type']['key']};});_0x2350e9[_0x1f14('0x27')]=_['map'](_0x5880a5,'name');_0x2350e9[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x1946f0[_0x1f14('0x28')]);_0x2350e9[_0x1f14('0x2a')]=_['intersection'](_0x2350e9[_0x1f14('0x27')],_0x2350e9['query']);_0xf0ffcb[_0x1f14('0x2b')]=_['intersection'](_0x2350e9[_0x1f14('0x27')],qs[_0x1f14('0x2c')](_0x1946f0[_0x1f14('0x28')]['fields']));_0xf0ffcb['attributes']=_0xf0ffcb['attributes'][_0x1f14('0x2d')]?_0xf0ffcb[_0x1f14('0x2b')]:_0x2350e9[_0x1f14('0x27')];if(!_0x1946f0[_0x1f14('0x28')][_0x1f14('0x2e')](_0x1f14('0x2f'))){_0xf0ffcb[_0x1f14('0x17')]=qs['limit'](_0x1946f0[_0x1f14('0x28')][_0x1f14('0x17')]);_0xf0ffcb[_0x1f14('0x19')]=qs[_0x1f14('0x19')](_0x1946f0[_0x1f14('0x28')][_0x1f14('0x19')]);}_0xf0ffcb[_0x1f14('0x30')]=qs[_0x1f14('0x31')](_0x1946f0[_0x1f14('0x28')]['sort']);_0xf0ffcb['where']=qs[_0x1f14('0x2a')](_[_0x1f14('0x32')](_0x1946f0[_0x1f14('0x28')],_0x2350e9[_0x1f14('0x2a')]),_0x5880a5);if(_0x1946f0[_0x1f14('0x28')][_0x1f14('0x33')]){_0xf0ffcb[_0x1f14('0x34')]=_['merge'](_0xf0ffcb[_0x1f14('0x34')],{'$or':_['map'](_0x5880a5,function(_0x2c8476){if(_0x2c8476[_0x1f14('0x35')]!==_0x1f14('0x36')){var _0x210052={};_0x210052[_0x2c8476[_0x1f14('0x21')]]={'$like':'%'+_0x1946f0['query']['filter']+'%'};return _0x210052;}})});}_0xf0ffcb=_[_0x1f14('0x37')]({},_0xf0ffcb,_0x1946f0[_0x1f14('0x38')]);var _0x114262={'where':_0xf0ffcb[_0x1f14('0x34')]};return db[_0x1f14('0x24')][_0x1f14('0x1a')](_0x114262)[_0x1f14('0x1f')](function(_0x132353){_0x80f087[_0x1f14('0x1a')]=_0x132353;if(_0x1946f0[_0x1f14('0x28')][_0x1f14('0x39')]){_0xf0ffcb[_0x1f14('0x3a')]=[{'all':!![]}];}return db[_0x1f14('0x24')][_0x1f14('0x3b')](_0xf0ffcb);})[_0x1f14('0x1f')](function(_0x3ce635){_0x80f087[_0x1f14('0x3c')]=_0x3ce635;return _0x80f087;})[_0x1f14('0x1f')](respondWithFilteredResult(_0x5b5422,_0xf0ffcb))[_0x1f14('0x3d')](handleError(_0x5b5422,null));};exports['show']=function(_0x3977f1,_0x4c5f99){var _0x26a914={'raw':!![],'where':{'id':_0x3977f1[_0x1f14('0x3e')]['id']}},_0x57318a={};_0x57318a[_0x1f14('0x27')]=_[_0x1f14('0x29')](db['JscriptySessionReport'][_0x1f14('0x25')]);_0x57318a[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x3977f1['query']);_0x57318a['filters']=_[_0x1f14('0x3f')](_0x57318a['model'],_0x57318a[_0x1f14('0x28')]);_0x26a914[_0x1f14('0x2b')]=_['intersection'](_0x57318a['model'],qs[_0x1f14('0x2c')](_0x3977f1[_0x1f14('0x28')][_0x1f14('0x2c')]));_0x26a914['attributes']=_0x26a914[_0x1f14('0x2b')][_0x1f14('0x2d')]?_0x26a914[_0x1f14('0x2b')]:_0x57318a[_0x1f14('0x27')];if(_0x3977f1[_0x1f14('0x28')][_0x1f14('0x39')]){_0x26a914[_0x1f14('0x3a')]=[{'all':!![]}];}_0x26a914=_['merge']({},_0x26a914,_0x3977f1[_0x1f14('0x38')]);return db[_0x1f14('0x24')]['find'](_0x26a914)[_0x1f14('0x1f')](handleEntityNotFound(_0x4c5f99,null))[_0x1f14('0x1f')](respondWithResult(_0x4c5f99,null))['catch'](handleError(_0x4c5f99,null));};exports[_0x1f14('0x40')]=function(_0xbfa65f,_0xeda94b){return db[_0x1f14('0x24')][_0x1f14('0x40')](_0xbfa65f['body'],{})[_0x1f14('0x1f')](respondWithResult(_0xeda94b,0xc9))['catch'](handleError(_0xeda94b,null));};exports[_0x1f14('0x1e')]=function(_0x77bc96,_0x4d0f51){if(_0x77bc96['body']['id']){delete _0x77bc96['body']['id'];}return db[_0x1f14('0x24')]['find']({'where':{'id':_0x77bc96[_0x1f14('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4d0f51,null))[_0x1f14('0x1f')](saveUpdates(_0x77bc96[_0x1f14('0x41')],null))[_0x1f14('0x1f')](respondWithResult(_0x4d0f51,null))['catch'](handleError(_0x4d0f51,null));};exports['destroy']=function(_0x455712,_0x134d72){return db[_0x1f14('0x24')][_0x1f14('0x42')]({'where':{'id':_0x455712[_0x1f14('0x3e')]['id']}})['then'](handleEntityNotFound(_0x134d72,null))[_0x1f14('0x1f')](removeEntity(_0x134d72,null))[_0x1f14('0x3d')](handleError(_0x134d72,null));};exports[_0x1f14('0x43')]=function(_0x32fe2d,_0x21a739){return db[_0x1f14('0x24')][_0x1f14('0x43')]()[_0x1f14('0x1f')](respondWithResult(_0x21a739,null))[_0x1f14('0x3d')](handleError(_0x21a739,null));};exports[_0x1f14('0x44')]=function(_0x4e9ee1,_0x3db9ae,_0x5d0863){var _0x4eceec={'raw':!![],'where':{}};var _0x295f07={};var _0x127a4f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1f14('0x45')]({'where':{'id':_0x4e9ee1['params']['id']}})[_0x1f14('0x1f')](handleEntityNotFound(_0x3db9ae,null))[_0x1f14('0x1f')](function(_0x320003){if(_0x320003){_0x295f07[_0x1f14('0x27')]=_[_0x1f14('0x29')](db[_0x1f14('0x46')]['rawAttributes']);_0x295f07[_0x1f14('0x28')]=_[_0x1f14('0x29')](_0x4e9ee1[_0x1f14('0x28')]);_0x295f07[_0x1f14('0x2a')]=_[_0x1f14('0x3f')](_0x295f07['model'],_0x295f07[_0x1f14('0x28')]);_0x4eceec[_0x1f14('0x2b')]=_[_0x1f14('0x3f')](_0x295f07[_0x1f14('0x27')],qs[_0x1f14('0x2c')](_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x2c')]));_0x4eceec[_0x1f14('0x2b')]=_0x4eceec[_0x1f14('0x2b')]['length']?_0x4eceec['attributes']:_0x295f07[_0x1f14('0x27')];if(!_0x4e9ee1['query']['hasOwnProperty'](_0x1f14('0x2f'))){_0x4eceec[_0x1f14('0x17')]=qs[_0x1f14('0x17')](_0x4e9ee1[_0x1f14('0x28')]['limit']);_0x4eceec[_0x1f14('0x19')]=qs[_0x1f14('0x19')](_0x4e9ee1[_0x1f14('0x28')]['offset']);}_0x4eceec[_0x1f14('0x30')]=qs['sort'](_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x31')]);_0x4eceec[_0x1f14('0x34')]=qs[_0x1f14('0x2a')](_[_0x1f14('0x32')](_0x4e9ee1['query'],_0x295f07[_0x1f14('0x2a')]));_0x4eceec['where'][_0x1f14('0x47')]=_0x320003['id'];if(_0x4e9ee1[_0x1f14('0x28')]['filter']){_0x4eceec['where']=_[_0x1f14('0x37')](_0x4eceec['where'],{'$or':_[_0x1f14('0x23')](_0x4eceec[_0x1f14('0x2b')],function(_0xbab7e1){var _0x5ca1cb={};_0x5ca1cb[_0xbab7e1]={'$like':'%'+_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x33')]+'%'};return _0x5ca1cb;})});}_0x4eceec=_[_0x1f14('0x37')]({},_0x4eceec,_0x4e9ee1[_0x1f14('0x38')]);return db['JscriptyQuestionReport'][_0x1f14('0x1a')]({'where':_0x4eceec[_0x1f14('0x34')]})[_0x1f14('0x1f')](function(_0x5cab7e){_0x127a4f[_0x1f14('0x1a')]=_0x5cab7e;if(_0x4e9ee1[_0x1f14('0x28')][_0x1f14('0x39')]){_0x4eceec[_0x1f14('0x3a')]=[{'all':!![]}];}return db[_0x1f14('0x46')][_0x1f14('0x3b')](_0x4eceec);})[_0x1f14('0x1f')](function(_0x2b083b){_0x127a4f[_0x1f14('0x3c')]=_0x2b083b;return _0x127a4f;});}})[_0x1f14('0x1f')](respondWithFilteredResult(_0x3db9ae,_0x4eceec))['catch'](handleError(_0x3db9ae,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ac87615..f16dc2e 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 _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x3aae33,_0x2a1786){var _0x2b71ff=function(_0x467504){while(--_0x467504){_0x3aae33['push'](_0x3aae33['shift']());}};_0x2b71ff(++_0x2a1786);}(_0x2d72,0xa8));var _0x22d7=function(_0x31556b,_0x537f2f){_0x31556b=_0x31556b-0x0;var _0x4ce02f=_0x2d72[_0x31556b];return _0x4ce02f;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x26e3cb,_0x3e38c3){var _0x15e990=function(_0xc620fe){while(--_0xc620fe){_0x26e3cb['push'](_0x26e3cb['shift']());}};_0x15e990(++_0x3e38c3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4b2251,_0x393f10){_0x4b2251=_0x4b2251-0x0;var _0x5d22fb=_0xfcf0[_0x4b2251];return _0x5d22fb;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ea86370..887641d 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 _0x1a37=['rpc','jayson/promise','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1be5de,_0x125e11){var _0x35d1ae=function(_0x64b221){while(--_0x64b221){_0x1be5de['push'](_0x1be5de['shift']());}};_0x35d1ae(++_0x125e11);}(_0x1a37,0xb4));var _0x71a3=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1a37[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45050a,_0x231ea7,_0x2bb6a2){return new BPromise(function(_0x4a9ab2,_0x53b893){return client['request'](_0x45050a,_0x2bb6a2)['then'](function(_0x89da86){logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,_0x71a3('0xe'));logger[_0x71a3('0xf')](_0x71a3('0x10'),_0x231ea7,_0x71a3('0xe'),JSON[_0x71a3('0x11')](_0x89da86));if(_0x89da86['error']){if(_0x89da86['error']['code']===0x1f4){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x53b893(_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);}logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x4a9ab2(_0x89da86[_0x71a3('0x12')]['message']);}else{logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,'request\x20sent');_0x4a9ab2(_0x89da86['result'][_0x71a3('0x13')]);}})[_0x71a3('0x14')](function(_0xee797f){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0xee797f);_0x53b893(_0xee797f);});});} \ No newline at end of file +var _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0x47c5,0x165));var _0x547c=function(_0x3ecd7d,_0x52140d){_0x3ecd7d=_0x3ecd7d-0x0;var _0x38ea7a=_0x47c5[_0x3ecd7d];return _0x38ea7a;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f58e379..8c8da7c 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 _0x81fa=['../../components/auth/service','../../config/environment','./license.controller','get','index','put','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2142ea,_0x5a8f39){var _0x53e2a9=function(_0xd6a441){while(--_0xd6a441){_0x2142ea['push'](_0x2142ea['shift']());}};_0x53e2a9(++_0x5a8f39);}(_0x81fa,0x14a));var _0xa81f=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0x81fa[_0x216428];return _0x313dd4;};'use strict';var multer=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var path=require(_0xa81f('0x2'));var timeout=require(_0xa81f('0x3'));var express=require(_0xa81f('0x4'));var router=express[_0xa81f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa81f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa81f('0x7'));var controller=require(_0xa81f('0x8'));router[_0xa81f('0x9')]('/',controller[_0xa81f('0xa')]);router[_0xa81f('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router['get'](_0xa81f('0xc'),auth[_0xa81f('0xd')](),controller[_0xa81f('0xe')]);module[_0xa81f('0xf')]=router; \ No newline at end of file +var _0x4b5f=['fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x4b5f,0x14f));var _0xf4b5=function(_0x151b2a,_0x2b88b8){_0x151b2a=_0x151b2a-0x0;var _0x5c2c04=_0x4b5f[_0x151b2a];return _0x5c2c04;};'use strict';var multer=require(_0xf4b5('0x0'));var util=require(_0xf4b5('0x1'));var path=require(_0xf4b5('0x2'));var timeout=require(_0xf4b5('0x3'));var express=require(_0xf4b5('0x4'));var router=express['Router']();var fs_extra=require(_0xf4b5('0x5'));var auth=require(_0xf4b5('0x6'));var interaction=require(_0xf4b5('0x7'));var config=require('../../config/environment');var controller=require(_0xf4b5('0x8'));router[_0xf4b5('0x9')]('/',controller[_0xf4b5('0xa')]);router[_0xf4b5('0xb')](_0xf4b5('0xc'),auth['isAuthenticated'](),controller[_0xf4b5('0xd')]);router['get'](_0xf4b5('0xe'),auth['isAuthenticated'](),controller[_0xf4b5('0xf')]);module[_0xf4b5('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b2e1c35..a9828bf 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 _0xf99e=['STRING','sequelize','TEXT'];(function(_0x136efe,_0x4da759){var _0x51f311=function(_0x5428d2){while(--_0x5428d2){_0x136efe['push'](_0x136efe['shift']());}};_0x51f311(++_0x4da759);}(_0xf99e,0x97));var _0xef99=function(_0x43b4b5,_0x3efc1b){_0x43b4b5=_0x43b4b5-0x0;var _0x2df432=_0xf99e[_0x43b4b5];return _0x2df432;};'use strict';var Sequelize=require(_0xef99('0x0'));module['exports']={'license':{'type':Sequelize[_0xef99('0x1')]},'data1':{'type':Sequelize[_0xef99('0x2')]},'data2':{'type':Sequelize[_0xef99('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e54=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x35561d,_0x59a5cf){var _0x2ccc5b=function(_0x6d37d2){while(--_0x6d37d2){_0x35561d['push'](_0x35561d['shift']());}};_0x2ccc5b(++_0x59a5cf);}(_0x7e54,0x67));var _0x47e5=function(_0x4b224d,_0x3b7195){_0x4b224d=_0x4b224d-0x0;var _0x3d7a9a=_0x7e54[_0x4b224d];return _0x3d7a9a;};'use strict';var Sequelize=require(_0x47e5('0x0'));module[_0x47e5('0x1')]={'license':{'type':Sequelize[_0x47e5('0x2')]},'data1':{'type':Sequelize[_0x47e5('0x3')]},'data2':{'type':Sequelize[_0x47e5('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x47e5('0x4')],'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 1ef8036..207681d 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 _0xd12f=['fields','length','merge','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','../../config/license/util','keys','License','rawAttributes','query','filters','model','attributes'];(function(_0xd7b37d,_0x8ab7e9){var _0x294477=function(_0x2980cc){while(--_0x2980cc){_0xd7b37d['push'](_0xd7b37d['shift']());}};_0x294477(++_0x8ab7e9);}(_0xd12f,0xa6));var _0xfd12=function(_0x5a5028,_0x49d56d){_0x5a5028=_0x5a5028-0x0;var _0x3e58f8=_0xd12f[_0x5a5028];return _0x3e58f8;};'use strict';var emlformat=require(_0xfd12('0x0'));var rimraf=require(_0xfd12('0x1'));var zipdir=require(_0xfd12('0x2'));var jsonpatch=require(_0xfd12('0x3'));var rp=require('request-promise');var moment=require(_0xfd12('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfd12('0x5'));var util=require(_0xfd12('0x6'));var path=require(_0xfd12('0x7'));var sox=require(_0xfd12('0x8'));var csv=require(_0xfd12('0x9'));var ejs=require(_0xfd12('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd12('0xb'));var squel=require('squel');var crypto=require(_0xfd12('0xc'));var jsforce=require(_0xfd12('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd12('0xe'));var Papa=require(_0xfd12('0xf'));var Redis=require(_0xfd12('0x10'));var authService=require(_0xfd12('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd12('0x12'));var hardwareService=require(_0xfd12('0x13'));var logger=require(_0xfd12('0x14'))(_0xfd12('0x15'));var utils=require(_0xfd12('0x16'));var config=require(_0xfd12('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd12('0x18'))['db'];function respondWithStatusCode(_0x49c34d,_0x1a2c66){_0x1a2c66=_0x1a2c66||0xcc;return function(_0x4fa43d){if(_0x4fa43d){return _0x49c34d[_0xfd12('0x19')](_0x1a2c66);}return _0x49c34d[_0xfd12('0x1a')](_0x1a2c66)[_0xfd12('0x1b')]();};}function respondWithResult(_0x1dd0b9,_0x3c81b5){_0x3c81b5=_0x3c81b5||0xc8;return function(_0x43e247){if(_0x43e247){return _0x1dd0b9['status'](_0x3c81b5)[_0xfd12('0x1c')](_0x43e247);}};}function respondWithFilteredResult(_0x1d7d24,_0x1131aa){return function(_0x11ea11){if(_0x11ea11){var _0x24da86=typeof _0x1131aa[_0xfd12('0x1d')]==='undefined'&&typeof _0x1131aa['limit']===_0xfd12('0x1e');var _0x1bb636=_0x11ea11[_0xfd12('0x1f')];var _0x592d14=_0x24da86?0x0:_0x1131aa['offset'];var _0x10fa25=_0x24da86?_0x11ea11[_0xfd12('0x1f')]:_0x1131aa['offset']+_0x1131aa['limit'];var _0x3db746;if(_0x10fa25>=_0x1bb636){_0x10fa25=_0x1bb636;_0x3db746=0xc8;}else{_0x3db746=0xce;}_0x1d7d24[_0xfd12('0x1a')](_0x3db746);return _0x1d7d24[_0xfd12('0x20')]('Content-Range',_0x592d14+'-'+_0x10fa25+'/'+_0x1bb636)[_0xfd12('0x1c')](_0x11ea11);}return null;};}function patchUpdates(_0x581ad0){return function(_0x2ee1bc){try{jsonpatch[_0xfd12('0x21')](_0x2ee1bc,_0x581ad0,!![]);}catch(_0x1829d4){return BPromise[_0xfd12('0x22')](_0x1829d4);}return _0x2ee1bc[_0xfd12('0x23')]();};}function saveUpdates(_0x116efd,_0x596883){return function(_0x43bb4c){if(_0x43bb4c){return _0x43bb4c[_0xfd12('0x24')](_0x116efd)['then'](function(_0x287ba9){return _0x287ba9;});}return null;};}function removeEntity(_0x268624,_0x37670f){return function(_0x30b7e){if(_0x30b7e){return _0x30b7e[_0xfd12('0x25')]()[_0xfd12('0x26')](function(){_0x268624[_0xfd12('0x1a')](0xcc)[_0xfd12('0x1b')]();});}};}function handleEntityNotFound(_0x4afa8d,_0x68bf2a){return function(_0x521534){if(!_0x521534){_0x4afa8d[_0xfd12('0x19')](0x194);}return _0x521534;};}function handleError(_0xc39885,_0x1a3936){_0x1a3936=_0x1a3936||0x1f4;return function(_0xddf702){logger[_0xfd12('0x27')](_0xddf702[_0xfd12('0x28')]);if(_0xddf702['name']){delete _0xddf702[_0xfd12('0x29')];}_0xc39885[_0xfd12('0x1a')](_0x1a3936)['send'](_0xddf702);};}var utilLicense=require(_0xfd12('0x2a'));exports['index']=function(_0x5f1934,_0x2f4b26){var _0x4d48a7={'raw':!![],'where':{'id':0x1}},_0x2e9120={};_0x2e9120['model']=_[_0xfd12('0x2b')](db[_0xfd12('0x2c')][_0xfd12('0x2d')]);_0x2e9120[_0xfd12('0x2e')]=_[_0xfd12('0x2b')](_0x5f1934[_0xfd12('0x2e')]);_0x2e9120[_0xfd12('0x2f')]=_['intersection'](_0x2e9120[_0xfd12('0x30')],_0x2e9120['query']);_0x4d48a7[_0xfd12('0x31')]=_['intersection'](_0x2e9120[_0xfd12('0x30')],qs[_0xfd12('0x32')](_0x5f1934[_0xfd12('0x2e')]['fields']));_0x4d48a7[_0xfd12('0x31')]=_0x4d48a7[_0xfd12('0x31')][_0xfd12('0x33')]?_0x4d48a7[_0xfd12('0x31')]:_0x2e9120[_0xfd12('0x30')];_0x4d48a7=_[_0xfd12('0x34')]({},_0x4d48a7,_0x5f1934['options']);return utilLicense[_0xfd12('0x35')](_0x4d48a7)[_0xfd12('0x26')](respondWithResult(_0x2f4b26,null))[_0xfd12('0x36')](handleError(_0x2f4b26,null));};exports[_0xfd12('0x24')]=function(_0x51cbfd,_0x5bb6bb){if(_0x51cbfd[_0xfd12('0x37')]['id']){delete _0x51cbfd[_0xfd12('0x37')]['id'];}return db[_0xfd12('0x2c')][_0xfd12('0x38')]({'where':{'id':_0x51cbfd['params']['id']}})['then'](handleEntityNotFound(_0x5bb6bb,null))[_0xfd12('0x26')](function(_0x4cd70b){var _0x56fbc8=_0x4cd70b[_0xfd12('0x39')]({'plain':!![]});return utilLicense[_0xfd12('0x3a')](_0x56fbc8,_0x51cbfd[_0xfd12('0x37')][_0xfd12('0x3b')]);})[_0xfd12('0x26')](function(_0x5d8d4c){if(!_0x5d8d4c[_0xfd12('0x3c')]){return saveUpdates(_0x51cbfd[_0xfd12('0x37')],null);}return _0x5d8d4c;})[_0xfd12('0x26')](respondWithResult(_0x5bb6bb,null))['catch'](handleError(_0x5bb6bb,null));};exports[_0xfd12('0x3d')]=function(_0x24c21f,_0x3ab812){var _0x5545d0=_0xfd12('0x3e');var _0x45ad71=path[_0xfd12('0x3f')](_0xfd12('0x40'),_0xfd12('0x41'),_0xfd12('0x42'),_0x5545d0);_0x3ab812[_0xfd12('0x43')](_0xfd12('0x44'),_0xfd12('0x45')+_0x5545d0);_0x3ab812['set'](_0xfd12('0x46'),_0xfd12('0x47'));_0x3ab812['download'](_0x45ad71);}; \ No newline at end of file +var _0x7335=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','License','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0xbaa13a,_0x1bebea){var _0x3a3642=function(_0x234fc7){while(--_0x234fc7){_0xbaa13a['push'](_0xbaa13a['shift']());}};_0x3a3642(++_0x1bebea);}(_0x7335,0x1cc));var _0x5733=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7335[_0x1203f];return _0x365f0a;};'use strict';var emlformat=require(_0x5733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5733('0x1'));var jsonpatch=require(_0x5733('0x2'));var rp=require(_0x5733('0x3'));var moment=require(_0x5733('0x4'));var BPromise=require(_0x5733('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5733('0x6'));var sox=require(_0x5733('0x7'));var csv=require(_0x5733('0x8'));var ejs=require(_0x5733('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5733('0xa'));var squel=require(_0x5733('0xb'));var crypto=require('crypto');var jsforce=require(_0x5733('0xc'));var deskjs=require(_0x5733('0xd'));var toCsv=require(_0x5733('0x8'));var querystring=require(_0x5733('0xe'));var Papa=require(_0x5733('0xf'));var Redis=require('ioredis');var authService=require(_0x5733('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5733('0x11'));var hardwareService=require(_0x5733('0x12'));var logger=require(_0x5733('0x13'))('api');var utils=require(_0x5733('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5733('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c4fcc,_0x154ab6){_0x154ab6=_0x154ab6||0xcc;return function(_0x352004){if(_0x352004){return _0x4c4fcc[_0x5733('0x16')](_0x154ab6);}return _0x4c4fcc[_0x5733('0x17')](_0x154ab6)[_0x5733('0x18')]();};}function respondWithResult(_0x286a7e,_0x2b0a1d){_0x2b0a1d=_0x2b0a1d||0xc8;return function(_0x14316d){if(_0x14316d){return _0x286a7e['status'](_0x2b0a1d)[_0x5733('0x19')](_0x14316d);}};}function respondWithFilteredResult(_0x2f9410,_0x44a1fd){return function(_0xce15f2){if(_0xce15f2){var _0x4dbe13=typeof _0x44a1fd['offset']===_0x5733('0x1a')&&typeof _0x44a1fd['limit']==='undefined';var _0x4738fc=_0xce15f2[_0x5733('0x1b')];var _0x1b625d=_0x4dbe13?0x0:_0x44a1fd[_0x5733('0x1c')];var _0xe17ddd=_0x4dbe13?_0xce15f2[_0x5733('0x1b')]:_0x44a1fd['offset']+_0x44a1fd[_0x5733('0x1d')];var _0x2087b0;if(_0xe17ddd>=_0x4738fc){_0xe17ddd=_0x4738fc;_0x2087b0=0xc8;}else{_0x2087b0=0xce;}_0x2f9410[_0x5733('0x17')](_0x2087b0);return _0x2f9410[_0x5733('0x1e')](_0x5733('0x1f'),_0x1b625d+'-'+_0xe17ddd+'/'+_0x4738fc)[_0x5733('0x19')](_0xce15f2);}return null;};}function patchUpdates(_0x14c2a8){return function(_0x3b091b){try{jsonpatch['apply'](_0x3b091b,_0x14c2a8,!![]);}catch(_0x2154e8){return BPromise[_0x5733('0x20')](_0x2154e8);}return _0x3b091b['save']();};}function saveUpdates(_0x5d791d,_0x268b73){return function(_0x55b309){if(_0x55b309){return _0x55b309[_0x5733('0x21')](_0x5d791d)['then'](function(_0x546de2){return _0x546de2;});}return null;};}function removeEntity(_0x466d42,_0x118206){return function(_0x4fe10f){if(_0x4fe10f){return _0x4fe10f[_0x5733('0x22')]()[_0x5733('0x23')](function(){_0x466d42[_0x5733('0x17')](0xcc)[_0x5733('0x18')]();});}};}function handleEntityNotFound(_0x5a44d4,_0x186ce7){return function(_0x4c6256){if(!_0x4c6256){_0x5a44d4['sendStatus'](0x194);}return _0x4c6256;};}function handleError(_0x105bb6,_0x3f8d21){_0x3f8d21=_0x3f8d21||0x1f4;return function(_0x23e054){logger[_0x5733('0x24')](_0x23e054[_0x5733('0x25')]);if(_0x23e054[_0x5733('0x26')]){delete _0x23e054[_0x5733('0x26')];}_0x105bb6[_0x5733('0x17')](_0x3f8d21)[_0x5733('0x27')](_0x23e054);};}var utilLicense=require(_0x5733('0x15'));exports[_0x5733('0x28')]=function(_0x284bde,_0x33c727){var _0x127ae7={'raw':!![],'where':{'id':0x1}},_0x318702={};_0x318702[_0x5733('0x29')]=_[_0x5733('0x2a')](db['License'][_0x5733('0x2b')]);_0x318702[_0x5733('0x2c')]=_[_0x5733('0x2a')](_0x284bde[_0x5733('0x2c')]);_0x318702[_0x5733('0x2d')]=_[_0x5733('0x2e')](_0x318702['model'],_0x318702[_0x5733('0x2c')]);_0x127ae7[_0x5733('0x2f')]=_[_0x5733('0x2e')](_0x318702[_0x5733('0x29')],qs['fields'](_0x284bde[_0x5733('0x2c')][_0x5733('0x30')]));_0x127ae7[_0x5733('0x2f')]=_0x127ae7[_0x5733('0x2f')][_0x5733('0x31')]?_0x127ae7[_0x5733('0x2f')]:_0x318702[_0x5733('0x29')];_0x127ae7=_[_0x5733('0x32')]({},_0x127ae7,_0x284bde['options']);return utilLicense[_0x5733('0x33')](_0x127ae7)[_0x5733('0x23')](respondWithResult(_0x33c727,null))[_0x5733('0x34')](handleError(_0x33c727,null));};exports[_0x5733('0x21')]=function(_0x272180,_0x2df1f8){if(_0x272180[_0x5733('0x35')]['id']){delete _0x272180[_0x5733('0x35')]['id'];}return db[_0x5733('0x36')][_0x5733('0x37')]({'where':{'id':_0x272180[_0x5733('0x38')]['id']}})[_0x5733('0x23')](handleEntityNotFound(_0x2df1f8,null))[_0x5733('0x23')](function(_0x479bdf){var _0x4ae875=_0x479bdf[_0x5733('0x39')]({'plain':!![]});return utilLicense[_0x5733('0x3a')](_0x4ae875,_0x272180['body'][_0x5733('0x3b')]);})[_0x5733('0x23')](function(_0x1086e1){if(!_0x1086e1['demo']){return saveUpdates(_0x272180[_0x5733('0x35')],null);}return _0x1086e1;})[_0x5733('0x23')](respondWithResult(_0x2df1f8,null))[_0x5733('0x34')](handleError(_0x2df1f8,null));};exports[_0x5733('0x3c')]=function(_0x57eaab,_0x5ce311){var _0x4773b6=_0x5733('0x3d');var _0x2d6c6a=path[_0x5733('0x3e')](_0x5733('0x3f'),_0x5733('0x40'),'xcally',_0x4773b6);_0x5ce311[_0x5733('0x41')]('Content-disposition',_0x5733('0x42')+_0x4773b6);_0x5ce311['set']('Content-Type','text/plain');_0x5ce311[_0x5733('0x43')](_0x2d6c6a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4cd8fdc..5247381 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 _0x4a8b=['rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','request-promise'];(function(_0x3364a2,_0x3dd4a3){var _0x4b0c9b=function(_0x4b6ca4){while(--_0x4b6ca4){_0x3364a2['push'](_0x3364a2['shift']());}};_0x4b0c9b(++_0x3dd4a3);}(_0x4a8b,0x8b));var _0xb4a8=function(_0x502285,_0x1b9c03){_0x502285=_0x502285-0x0;var _0xc4d4c2=_0x4a8b[_0x502285];return _0xc4d4c2;};'use strict';var _=require(_0xb4a8('0x0'));var util=require(_0xb4a8('0x1'));var logger=require(_0xb4a8('0x2'))(_0xb4a8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4a8('0x5'));var config=require(_0xb4a8('0x6'));var attributes=require(_0xb4a8('0x7'));module[_0xb4a8('0x8')]=function(_0x589ce8,_0x281bb3){return _0x589ce8[_0xb4a8('0x9')](_0xb4a8('0xa'),attributes,{'tableName':_0xb4a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb180=['./license.attributes','define','License','license','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb180,0x184));var _0x0b18=function(_0x124381,_0x3e93cd){_0x124381=_0x124381-0x0;var _0x1fbff8=_0xb180[_0x124381];return _0x1fbff8;};'use strict';var _=require(_0x0b18('0x0'));var util=require(_0x0b18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0b18('0x2'));var BPromise=require(_0x0b18('0x3'));var rp=require(_0x0b18('0x4'));var fs=require('fs');var path=require(_0x0b18('0x5'));var rimraf=require(_0x0b18('0x6'));var config=require(_0x0b18('0x7'));var attributes=require(_0x0b18('0x8'));module['exports']=function(_0x1c8169,_0x12a24a){return _0x1c8169[_0x0b18('0x9')](_0x0b18('0xa'),attributes,{'tableName':_0x0b18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2ed37fa..fb6c095 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 _0x1ce7=['rpc','client','then','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4256c5,_0x288cee){var _0x3c8bfd=function(_0x5471f1){while(--_0x5471f1){_0x4256c5['push'](_0x4256c5['shift']());}};_0x3c8bfd(++_0x288cee);}(_0x1ce7,0x76));var _0x71ce=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x1ce7[_0x2cef86];return _0x46dfd6;};'use strict';var _=require('lodash');var util=require(_0x71ce('0x0'));var moment=require(_0x71ce('0x1'));var BPromise=require(_0x71ce('0x2'));var rs=require(_0x71ce('0x3'));var fs=require('fs');var Redis=require(_0x71ce('0x4'));var db=require(_0x71ce('0x5'))['db'];var utils=require(_0x71ce('0x6'));var logger=require(_0x71ce('0x7'))(_0x71ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x291f39,_0x348e2a,_0x14fed7){return new BPromise(function(_0x1753a9,_0x470328){return client['request'](_0x291f39,_0x14fed7)[_0x71ce('0xa')](function(_0xe553e8){logger['info']('License,\x20%s,\x20%s',_0x348e2a,_0x71ce('0xb'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x348e2a,_0x71ce('0xb'),JSON[_0x71ce('0xc')](_0xe553e8));if(_0xe553e8[_0x71ce('0xd')]){if(_0xe553e8[_0x71ce('0xd')][_0x71ce('0xe')]===0x1f4){logger[_0x71ce('0xd')](_0x71ce('0xf'),_0x348e2a,_0xe553e8[_0x71ce('0xd')][_0x71ce('0x10')]);return _0x470328(_0xe553e8['error']['message']);}logger[_0x71ce('0xd')](_0x71ce('0xf'),_0x348e2a,_0xe553e8[_0x71ce('0xd')][_0x71ce('0x10')]);return _0x1753a9(_0xe553e8[_0x71ce('0xd')][_0x71ce('0x10')]);}else{logger['info'](_0x71ce('0xf'),_0x348e2a,'request\x20sent');_0x1753a9(_0xe553e8['result'][_0x71ce('0x10')]);}})[_0x71ce('0x11')](function(_0x55216f){logger[_0x71ce('0xd')](_0x71ce('0xf'),_0x348e2a,_0x55216f);_0x470328(_0x55216f);});});} \ No newline at end of file +var _0xf093=['result','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4ba861,_0x2518c5){var _0x3dea9f=function(_0x2fcc91){while(--_0x2fcc91){_0x4ba861['push'](_0x4ba861['shift']());}};_0x3dea9f(++_0x2518c5);}(_0xf093,0x13d));var _0x3f09=function(_0x4cb135,_0x2ab5ca){_0x4cb135=_0x4cb135-0x0;var _0x1a8c84=_0xf093[_0x4cb135];return _0x1a8c84;};'use strict';var _=require('lodash');var util=require(_0x3f09('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f09('0x1'))['db'];var utils=require(_0x3f09('0x2'));var logger=require(_0x3f09('0x3'))(_0x3f09('0x4'));var config=require(_0x3f09('0x5'));var jayson=require(_0x3f09('0x6'));var client=jayson[_0x3f09('0x7')][_0x3f09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c8354,_0x5c82d5,_0x3fb755){return new BPromise(function(_0x3dca03,_0x887b5d){return client[_0x3f09('0x9')](_0x1c8354,_0x3fb755)[_0x3f09('0xa')](function(_0x7ebcaa){logger[_0x3f09('0xb')](_0x3f09('0xc'),_0x5c82d5,_0x3f09('0xd'));logger[_0x3f09('0xe')](_0x3f09('0xf'),_0x5c82d5,'request\x20sent',JSON[_0x3f09('0x10')](_0x7ebcaa));if(_0x7ebcaa['error']){if(_0x7ebcaa[_0x3f09('0x11')]['code']===0x1f4){logger[_0x3f09('0x11')](_0x3f09('0xc'),_0x5c82d5,_0x7ebcaa[_0x3f09('0x11')]['message']);return _0x887b5d(_0x7ebcaa[_0x3f09('0x11')][_0x3f09('0x12')]);}logger[_0x3f09('0x11')](_0x3f09('0xc'),_0x5c82d5,_0x7ebcaa['error'][_0x3f09('0x12')]);return _0x3dca03(_0x7ebcaa[_0x3f09('0x11')][_0x3f09('0x12')]);}else{logger['info'](_0x3f09('0xc'),_0x5c82d5,_0x3f09('0xd'));_0x3dca03(_0x7ebcaa[_0x3f09('0x13')][_0x3f09('0x12')]);}})[_0x3f09('0x14')](function(_0x1be622){logger['error'](_0x3f09('0xc'),_0x5c82d5,_0x1be622);_0x887b5d(_0x1be622);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 79822b3..378e988 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 _0x7ccf=['/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0xb4d244,_0x91bb13){var _0x485e06=function(_0x175147){while(--_0x175147){_0xb4d244['push'](_0xb4d244['shift']());}};_0x485e06(++_0x91bb13);}(_0x7ccf,0x1ef));var _0xf7cc=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x7ccf[_0x3dc538];return _0x72c2fd;};'use strict';var multer=require(_0xf7cc('0x0'));var util=require(_0xf7cc('0x1'));var path=require(_0xf7cc('0x2'));var timeout=require(_0xf7cc('0x3'));var express=require(_0xf7cc('0x4'));var router=express[_0xf7cc('0x5')]();var fs_extra=require(_0xf7cc('0x6'));var auth=require(_0xf7cc('0x7'));var interaction=require(_0xf7cc('0x8'));var config=require(_0xf7cc('0x9'));var controller=require(_0xf7cc('0xa'));router[_0xf7cc('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf7cc('0xb')](_0xf7cc('0xc'),auth['isAuthenticated'](),controller[_0xf7cc('0xd')]);router['get'](_0xf7cc('0xe'),auth['isAuthenticated'](),controller[_0xf7cc('0xf')]);router[_0xf7cc('0xb')](_0xf7cc('0x10'),auth[_0xf7cc('0x11')](),controller['getDispositions']);router[_0xf7cc('0xb')](_0xf7cc('0x12'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x13')]);router[_0xf7cc('0xb')]('/:id/in_servers',auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x14')]);router['get'](_0xf7cc('0x15'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x16')]);router[_0xf7cc('0xb')](_0xf7cc('0x17'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x18')]);router[_0xf7cc('0xb')](_0xf7cc('0x19'),auth[_0xf7cc('0x11')](),controller['getApplications']);router[_0xf7cc('0xb')](_0xf7cc('0x1a'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x1b')]);router['get'](_0xf7cc('0x1c'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x1d')]);router[_0xf7cc('0xb')](_0xf7cc('0x1e'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x1f')]);router[_0xf7cc('0x20')]('/:id/dispositions',auth[_0xf7cc('0x11')](),controller['addDisposition']);router[_0xf7cc('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf7cc('0x21')]);router[_0xf7cc('0x20')]('/',auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x22')]);router[_0xf7cc('0x20')](_0xf7cc('0x23'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x24')]);router[_0xf7cc('0x20')](_0xf7cc('0x15'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x25')]);router['post'](_0xf7cc('0x17'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x26')]);router[_0xf7cc('0x20')](_0xf7cc('0x19'),auth['isAuthenticated'](),controller[_0xf7cc('0x27')]);router['post'](_0xf7cc('0x28'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x29')]);router[_0xf7cc('0x20')](_0xf7cc('0x1e'),auth[_0xf7cc('0x11')](),controller['addAgents']);router[_0xf7cc('0x2a')](_0xf7cc('0xe'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x2b')]);router[_0xf7cc('0x2c')](_0xf7cc('0x10'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x2d')]);router[_0xf7cc('0x2c')](_0xf7cc('0x12'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x2e')]);router[_0xf7cc('0x2c')](_0xf7cc('0x23'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x2f')]);router[_0xf7cc('0x2c')]('/:id/out_servers',auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x30')]);router[_0xf7cc('0x2c')]('/:id',auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x31')]);router[_0xf7cc('0x2c')](_0xf7cc('0x1e'),auth[_0xf7cc('0x11')](),controller[_0xf7cc('0x32')]);module[_0xf7cc('0x33')]=router; \ No newline at end of file +var _0xea24=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','post','create','addImap','/:id/send','send','addAgents','update','removeDispositions','delete','/:id/canned_answers','removeAnswers','removeSmtp','destroy','removeAgents','exports','util'];(function(_0x259c7f,_0x22e2d9){var _0x8c2ff5=function(_0x16a336){while(--_0x16a336){_0x259c7f['push'](_0x259c7f['shift']());}};_0x8c2ff5(++_0x22e2d9);}(_0xea24,0x147));var _0x4ea2=function(_0xe5256e,_0x144410){_0xe5256e=_0xe5256e-0x0;var _0x17cf68=_0xea24[_0xe5256e];return _0x17cf68;};'use strict';var multer=require('multer');var util=require(_0x4ea2('0x0'));var path=require('path');var timeout=require(_0x4ea2('0x1'));var express=require(_0x4ea2('0x2'));var router=express[_0x4ea2('0x3')]();var fs_extra=require(_0x4ea2('0x4'));var auth=require(_0x4ea2('0x5'));var interaction=require(_0x4ea2('0x6'));var config=require(_0x4ea2('0x7'));var controller=require(_0x4ea2('0x8'));router[_0x4ea2('0x9')]('/',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xb')]);router[_0x4ea2('0x9')](_0x4ea2('0xc'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xd')]);router[_0x4ea2('0x9')](_0x4ea2('0xe'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0xf')]);router[_0x4ea2('0x9')]('/:id/dispositions',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x10')]);router[_0x4ea2('0x9')]('/:id/canned_answers',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x11')]);router[_0x4ea2('0x9')](_0x4ea2('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0x4ea2('0x9')](_0x4ea2('0x13'),auth[_0x4ea2('0xa')](),controller['getSmtp']);router[_0x4ea2('0x9')](_0x4ea2('0x14'),auth[_0x4ea2('0xa')](),controller['getInteractions']);router['get'](_0x4ea2('0x15'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x16')]);router[_0x4ea2('0x9')](_0x4ea2('0x17'),auth[_0x4ea2('0xa')](),controller['getMessages']);router[_0x4ea2('0x9')](_0x4ea2('0x18'),auth[_0x4ea2('0xa')](),controller['verifySmtp']);router[_0x4ea2('0x9')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller['getAgents']);router[_0x4ea2('0x1a')]('/:id/dispositions',auth[_0x4ea2('0xa')](),controller['addDisposition']);router[_0x4ea2('0x1a')]('/:id/canned_answers',auth[_0x4ea2('0xa')](),controller['addAnswer']);router[_0x4ea2('0x1a')]('/',auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1b')]);router[_0x4ea2('0x1a')](_0x4ea2('0x12'),auth['isAuthenticated'](),controller[_0x4ea2('0x1c')]);router[_0x4ea2('0x1a')](_0x4ea2('0x13'),auth[_0x4ea2('0xa')](),controller['addSmtp']);router['post']('/:id/interactions',auth[_0x4ea2('0xa')](),controller['addInteraction']);router[_0x4ea2('0x1a')](_0x4ea2('0x15'),auth[_0x4ea2('0xa')](),controller['addApplications']);router['post'](_0x4ea2('0x1d'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1e')]);router[_0x4ea2('0x1a')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x1f')]);router['put'](_0x4ea2('0xe'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x20')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4ea2('0x21')]);router[_0x4ea2('0x22')](_0x4ea2('0x23'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x24')]);router[_0x4ea2('0x22')](_0x4ea2('0x12'),auth[_0x4ea2('0xa')](),controller['removeImap']);router[_0x4ea2('0x22')](_0x4ea2('0x13'),auth['isAuthenticated'](),controller[_0x4ea2('0x25')]);router[_0x4ea2('0x22')](_0x4ea2('0xe'),auth['isAuthenticated'](),controller[_0x4ea2('0x26')]);router[_0x4ea2('0x22')](_0x4ea2('0x19'),auth[_0x4ea2('0xa')](),controller[_0x4ea2('0x27')]);module[_0x4ea2('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0b72739..582f54b 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 _0x6b7c=['provider','custom','getDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','hotmail','yahoo','outlook365'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6b7c,0x123));var _0xc6b7=function(_0x18ca32,_0x136bd4){_0x18ca32=_0x18ca32-0x0;var _0x23761a=_0x6b7c[_0x18ca32];return _0x23761a;};'use strict';var Sequelize=require(_0xc6b7('0x0'));module[_0xc6b7('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc6b7('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc6b7('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xc6b7('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc6b7('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xc6b7('0x5')](0x2)[_0xc6b7('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc6b7('0x4')],'defaultValue':function(){return _0xc6b7('0x7');}},'notificationSound':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc6b7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc6b7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc6b7('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc6b7('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc6b7('0x3')],'defaultValue':![],'comment':_0xc6b7('0x8'),'set':function(_0x4550d0){if(!_0x4550d0)this[_0xc6b7('0x9')]('mandatoryDispositionPauseId',null);this[_0xc6b7('0x9')]('mandatoryDisposition',_0x4550d0);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xc6b7('0xa'),_0xc6b7('0xb'),_0xc6b7('0xc')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xc6b7('0xd')))return _0xc6b7('0xe');return this[_0xc6b7('0xf')](_0xc6b7('0xd'));},'set':function(_0x46f581){if(_0x46f581===_0xc6b7('0xe'))_0x46f581=null;return this[_0xc6b7('0x9')](_0xc6b7('0xd'),_0x46f581);}}}; \ No newline at end of file +var _0x4ab0=['yahoo','getDataValue','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','gmail','hotmail'];(function(_0x2df7a1,_0x4e4751){var _0x5c0460=function(_0x3cd734){while(--_0x3cd734){_0x2df7a1['push'](_0x2df7a1['shift']());}};_0x5c0460(++_0x4e4751);}(_0x4ab0,0x147));var _0x04ab=function(_0x308204,_0x286453){_0x308204=_0x308204-0x0;var _0x34227e=_0x4ab0[_0x308204];return _0x34227e;};'use strict';var Sequelize=require('sequelize');module[_0x04ab('0x0')]={'description':{'type':Sequelize[_0x04ab('0x1')]},'name':{'type':Sequelize[_0x04ab('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x04ab('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x04ab('0x3')]},'markAsUnread':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04ab('0x4')},'fontSize':{'type':Sequelize[_0x04ab('0x5')](0x2)[_0x04ab('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x04ab('0x7');}},'notificationSound':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04ab('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04ab('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x04ab('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x04ab('0x2')],'defaultValue':![],'comment':_0x04ab('0x9'),'set':function(_0x48668c){if(!_0x48668c)this['setDataValue'](_0x04ab('0xa'),null);this[_0x04ab('0xb')](_0x04ab('0xc'),_0x48668c);}},'provider':{'type':Sequelize['ENUM'](_0x04ab('0xd'),_0x04ab('0xe'),_0x04ab('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x04ab('0x10')]('provider'))return'custom';return this[_0x04ab('0x10')](_0x04ab('0x11'));},'set':function(_0x424e0a){if(_0x424e0a==='custom')_0x424e0a=null;return this[_0x04ab('0xb')](_0x04ab('0x11'),_0x424e0a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 8765080..0366146 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 _0x07af=['filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','fields','include','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','getDispositions','Disposition','hasOwnProperty','order','sort','pick','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','removeAnswers','key','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','format','email','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','getSmtpOptions','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','count','Content-Range','json','update','MailAccounts','UserProfileResource','destroy','stack','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','model','name','query','keys','filters','attributes','length','nolimit','limit','where'];(function(_0x4a328d,_0x4c62d6){var _0x4410d9=function(_0x18243d){while(--_0x18243d){_0x4a328d['push'](_0x4a328d['shift']());}};_0x4410d9(++_0x4c62d6);}(_0x07af,0x137));var _0xf07a=function(_0x434624,_0x1e2d41){_0x434624=_0x434624-0x0;var _0x49a80f=_0x07af[_0x434624];return _0x49a80f;};'use strict';var moment=require('moment');var BPromise=require(_0xf07a('0x0'));var util=require(_0xf07a('0x1'));var path=require(_0xf07a('0x2'));var _=require(_0xf07a('0x3'));var juice=require(_0xf07a('0x4'));var Redis=require(_0xf07a('0x5'));var qs=require(_0xf07a('0x6'));var logger=require(_0xf07a('0x7'))(_0xf07a('0x8'));var config=require(_0xf07a('0x9'));var db=require(_0xf07a('0xa'))['db'];config[_0xf07a('0xb')]=_['defaults'](config[_0xf07a('0xb')],{'host':_0xf07a('0xc'),'port':0x18eb});var socket=require(_0xf07a('0xd'))(new Redis(config[_0xf07a('0xb')]));require(_0xf07a('0xe'))[_0xf07a('0xf')](socket);var jayson=require(_0xf07a('0x10'));var client=jayson[_0xf07a('0x11')][_0xf07a('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x5751a7,_0x3acbf3,_0x3379e7,_0x2267fd){return new BPromise(function(_0x5c9c99,_0x38a492){var _0x5bc2be=_0x2267fd||client;return _0x5bc2be[_0xf07a('0x13')](_0x5751a7,_0x3379e7)[_0xf07a('0x14')](function(_0xa16249){logger[_0xf07a('0x15')]('MailAccount,\x20%s,\x20%s',_0x3acbf3,_0xf07a('0x16'));logger['debug'](_0xf07a('0x17'),_0x3acbf3,'request\x20sent',JSON[_0xf07a('0x18')](_0xa16249));if(_0xa16249[_0xf07a('0x19')]){if(_0xa16249[_0xf07a('0x19')][_0xf07a('0x1a')]===0x1f4){logger[_0xf07a('0x19')](_0xf07a('0x1b'),_0x3acbf3,_0xa16249[_0xf07a('0x19')][_0xf07a('0x1c')]);return _0x38a492(_0xa16249[_0xf07a('0x19')][_0xf07a('0x1c')]);}logger['error'](_0xf07a('0x1b'),_0x3acbf3,_0xa16249['error']['message']);return _0x5c9c99(_0xa16249[_0xf07a('0x19')]['message']);}else{logger[_0xf07a('0x15')]('MailAccount,\x20%s,\x20%s',_0x3acbf3,_0xf07a('0x16'));_0x5c9c99(_0xa16249[_0xf07a('0x1d')][_0xf07a('0x1c')]);}})[_0xf07a('0x1e')](function(_0x3a4929){logger['error']('MailAccount,\x20%s,\x20%s',_0x3acbf3,_0x3a4929);_0x38a492(_0x3a4929);});});}function respondWithStatusCode(_0x3335dd,_0x1b3ca9){_0x1b3ca9=_0x1b3ca9||0xcc;return function(_0x3e1021){if(_0x3e1021){return _0x3335dd[_0xf07a('0x1f')](_0x1b3ca9);}return _0x3335dd[_0xf07a('0x20')](_0x1b3ca9)['end']();};}function respondWithResult(_0xd39924,_0xb9653a){_0xb9653a=_0xb9653a||0xc8;return function(_0x23bdef){if(_0x23bdef){return _0xd39924[_0xf07a('0x20')](_0xb9653a)['json'](_0x23bdef);}};}function respondWithFilteredResult(_0x25a60e,_0x1c47d4){return function(_0x4a599d){if(_0x4a599d){var _0x427d77=typeof _0x1c47d4[_0xf07a('0x21')]==='undefined'&&typeof _0x1c47d4['limit']===_0xf07a('0x22');var _0x372227=_0x4a599d[_0xf07a('0x23')];var _0x113120=_0x427d77?0x0:_0x1c47d4[_0xf07a('0x21')];var _0x518f97=_0x427d77?_0x4a599d[_0xf07a('0x23')]:_0x1c47d4['offset']+_0x1c47d4['limit'];var _0xc2165d;if(_0x518f97>=_0x372227){_0x518f97=_0x372227;_0xc2165d=0xc8;}else{_0xc2165d=0xce;}_0x25a60e[_0xf07a('0x20')](_0xc2165d);return _0x25a60e['set'](_0xf07a('0x24'),_0x113120+'-'+_0x518f97+'/'+_0x372227)[_0xf07a('0x25')](_0x4a599d);}return null;};}function saveUpdates(_0x1dc639){return function(_0x59d9f4){if(_0x59d9f4){return _0x59d9f4[_0xf07a('0x26')](_0x1dc639)['then'](function(_0x4af0c7){return _0x4af0c7;});}return null;};}function removeEntity(_0x5f216a){return function(_0x496e14){if(_0x496e14){return _0x496e14['destroy']()[_0xf07a('0x14')](function(){var _0x40f306=_0x496e14['get']({'plain':!![]});var _0x41a9f2=_0xf07a('0x27');return db[_0xf07a('0x28')][_0xf07a('0x29')]({'where':{'type':_0x41a9f2,'resourceId':_0x40f306['id']}})[_0xf07a('0x14')](function(){return _0x496e14;});})[_0xf07a('0x14')](function(){_0x5f216a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4238){return function(_0x130f7b){if(!_0x130f7b){_0x4f4238['sendStatus'](0x194);}return _0x130f7b;};}function handleError(_0x560000,_0x4fe659){_0x4fe659=_0x4fe659||0x1f4;return function(_0x3c9576){logger['error'](_0x3c9576[_0xf07a('0x2a')]);if(_0x3c9576['name']){delete _0x3c9576['name'];}_0x560000[_0xf07a('0x20')](_0x4fe659)['send'](_0x3c9576);};}function getImapHost(_0x259865){switch(_0x259865){case _0xf07a('0x2b'):return _0xf07a('0x2c');case _0xf07a('0x2d'):return _0xf07a('0x2e');case _0xf07a('0x2f'):return'imap-mail.outlook.com';case'outlook365':return'outlook.office365.com';}throw new Error(_0xf07a('0x30'),_0x259865);}function getSmtpHost(_0x4c35f9){switch(_0x4c35f9){case'gmail':return'smtp.gmail.com';case'yahoo':return _0xf07a('0x31');case _0xf07a('0x2f'):return _0xf07a('0x32');case _0xf07a('0x33'):return _0xf07a('0x34');}throw new Error(_0xf07a('0x30'),_0x4c35f9);}function getAuthenticationOptions(_0x47dc7e,_0x122721){var _0x1a5deb={};var _0x37fb1e={};if(_0x47dc7e){_0x1a5deb[_0xf07a('0x35')]=_0x37fb1e['user']=_0x122721[_0xf07a('0x36')];_0x1a5deb[_0xf07a('0x37')]=_0x37fb1e['pass']=_0x122721['password'];if(_0x122721['modernAuthentication']){_0x1a5deb['modernAuthentication']=_0x37fb1e[_0xf07a('0x38')]=!![];_0x1a5deb[_0xf07a('0x39')]=_0x37fb1e['CloudProviderId']=_0x122721['CloudProviderId'];_0x1a5deb[_0xf07a('0x37')]=_0x37fb1e[_0xf07a('0x3a')]=null;}else{_0x1a5deb['CloudProviderId']=_0x37fb1e[_0xf07a('0x39')]=null;}_0x1a5deb[_0xf07a('0x3b')]=getImapHost(_0x47dc7e);_0x1a5deb[_0xf07a('0x3c')]=0x3e1;_0x37fb1e['host']=getSmtpHost(_0x47dc7e);_0x37fb1e['port']=0x24b;_0x37fb1e[_0xf07a('0x3d')]=![];_0x1a5deb[_0xf07a('0x3e')]=_0x37fb1e[_0xf07a('0x3e')]=null;}else{if(_0x122721[_0xf07a('0x3f')]){_0x1a5deb[_0xf07a('0x35')]=_0x37fb1e[_0xf07a('0x35')]=_0x122721[_0xf07a('0x36')];_0x1a5deb[_0xf07a('0x37')]=_0x37fb1e[_0xf07a('0x3a')]=_0x122721[_0xf07a('0x37')];}else{_0x1a5deb['authentication']=_0x37fb1e['authentication']=![];_0x1a5deb[_0xf07a('0x35')]=_0x37fb1e[_0xf07a('0x35')]=null;_0x1a5deb[_0xf07a('0x37')]=_0x37fb1e[_0xf07a('0x3a')]=null;}_0x1a5deb[_0xf07a('0x3b')]=_0x122721[_0xf07a('0x40')][_0xf07a('0x3b')];_0x1a5deb[_0xf07a('0x3c')]=_0x122721[_0xf07a('0x40')][_0xf07a('0x3c')];_0x37fb1e[_0xf07a('0x3b')]=_0x122721[_0xf07a('0x41')]['host'];_0x37fb1e[_0xf07a('0x3c')]=_0x122721[_0xf07a('0x41')][_0xf07a('0x3c')];}return{'Imap':_0x1a5deb,'Smtp':_0x37fb1e};}exports[_0xf07a('0x42')]=function(_0x2e2cbe,_0x2cde91){var _0x3745ed={'include':[{'model':db[_0xf07a('0x43')],'as':_0xf07a('0x40')},{'model':db[_0xf07a('0x44')],'as':_0xf07a('0x41')},{'model':db[_0xf07a('0x45')],'as':'mandatoryDispositionPause'}]},_0x1b59f4={},_0x52b6b9={'count':0x0,'rows':[]};var _0x930c05=_[_0xf07a('0x46')](db[_0xf07a('0x47')][_0xf07a('0x48')],function(_0x5b3cef){return{'name':_0x5b3cef['fieldName'],'type':_0x5b3cef['type']['key']};});_0x1b59f4[_0xf07a('0x49')]=_[_0xf07a('0x46')](_0x930c05,_0xf07a('0x4a'));_0x1b59f4[_0xf07a('0x4b')]=_[_0xf07a('0x4c')](_0x2e2cbe[_0xf07a('0x4b')]);_0x1b59f4[_0xf07a('0x4d')]=_['intersection'](_0x1b59f4[_0xf07a('0x49')],_0x1b59f4[_0xf07a('0x4b')]);_0x3745ed['attributes']=_['intersection'](_0x1b59f4[_0xf07a('0x49')],qs['fields'](_0x2e2cbe[_0xf07a('0x4b')]['fields']));_0x3745ed['attributes']=_0x3745ed[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x3745ed[_0xf07a('0x4e')]:_0x1b59f4[_0xf07a('0x49')];if(!_0x2e2cbe[_0xf07a('0x4b')]['hasOwnProperty'](_0xf07a('0x50'))){_0x3745ed[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x2e2cbe[_0xf07a('0x4b')]['limit']);_0x3745ed['offset']=qs[_0xf07a('0x21')](_0x2e2cbe[_0xf07a('0x4b')]['offset']);}_0x3745ed['order']=qs['sort'](_0x2e2cbe['query']['sort']);_0x3745ed[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_['pick'](_0x2e2cbe[_0xf07a('0x4b')],_0x1b59f4['filters']),_0x930c05);if(_0x2e2cbe[_0xf07a('0x4b')][_0xf07a('0x53')]){_0x3745ed[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x3745ed[_0xf07a('0x52')],{'$or':_[_0xf07a('0x46')](_0x930c05,function(_0x137b40){if(_0x137b40[_0xf07a('0x55')]!==_0xf07a('0x56')){var _0x48f497={};_0x48f497[_0x137b40[_0xf07a('0x4a')]]={'$like':'%'+_0x2e2cbe[_0xf07a('0x4b')][_0xf07a('0x53')]+'%'};return _0x48f497;}})});}_0x3745ed=_[_0xf07a('0x54')]({},_0x3745ed,_0x2e2cbe[_0xf07a('0x57')]);var _0x41fba9={'where':_0x3745ed[_0xf07a('0x52')]};return db[_0xf07a('0x47')]['count'](_0x41fba9)[_0xf07a('0x14')](function(_0x568bc7){_0x52b6b9[_0xf07a('0x23')]=_0x568bc7;if(_0x2e2cbe[_0xf07a('0x4b')][_0xf07a('0x58')]){_0x3745ed['include']=[{'all':!![]}];}return db[_0xf07a('0x47')][_0xf07a('0x59')](_0x3745ed);})[_0xf07a('0x14')](function(_0x1f64f7){_0x52b6b9[_0xf07a('0x5a')]=_0x1f64f7;return _0x52b6b9;})[_0xf07a('0x14')](respondWithFilteredResult(_0x2cde91,_0x3745ed))['catch'](handleError(_0x2cde91,null));};exports[_0xf07a('0x5b')]=function(_0x342b6d,_0x1239e6){var _0x28d61e={'raw':![],'where':{'id':_0x342b6d[_0xf07a('0x5c')]['id']},'include':[{'model':db[_0xf07a('0x43')],'as':_0xf07a('0x40')},{'model':db[_0xf07a('0x44')],'as':_0xf07a('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x474105={};_0x474105[_0xf07a('0x49')]=_['keys'](db['MailAccount'][_0xf07a('0x48')]);_0x474105[_0xf07a('0x4b')]=_[_0xf07a('0x4c')](_0x342b6d[_0xf07a('0x4b')]);_0x474105[_0xf07a('0x4d')]=_[_0xf07a('0x5d')](_0x474105[_0xf07a('0x49')],_0x474105['query']);_0x28d61e[_0xf07a('0x4e')]=_[_0xf07a('0x5d')](_0x474105[_0xf07a('0x49')],qs[_0xf07a('0x5e')](_0x342b6d['query'][_0xf07a('0x5e')]));_0x28d61e['attributes']=_0x28d61e['attributes']['length']?_0x28d61e[_0xf07a('0x4e')]:_0x474105[_0xf07a('0x49')];if(_0x342b6d[_0xf07a('0x4b')][_0xf07a('0x58')]){_0x28d61e[_0xf07a('0x5f')]=[{'all':!![]}];}_0x28d61e=_[_0xf07a('0x54')]({},_0x28d61e,_0x342b6d[_0xf07a('0x57')]);return db[_0xf07a('0x47')]['find'](_0x28d61e)[_0xf07a('0x14')](handleEntityNotFound(_0x1239e6,null))[_0xf07a('0x14')](respondWithResult(_0x1239e6,null))[_0xf07a('0x1e')](handleError(_0x1239e6,null));};exports['update']=function(_0x4ac46a,_0x373ed6){if(_0x4ac46a[_0xf07a('0x60')]['id']){delete _0x4ac46a[_0xf07a('0x60')]['id'];}var _0xd97857=_0x4ac46a['body'][_0xf07a('0x61')]===_0xf07a('0x62')?null:_0x4ac46a['body'][_0xf07a('0x61')];var _0x6e5199=_0x4ac46a[_0xf07a('0x60')][_0xf07a('0x40')]||{};var _0x4c1f59=_0x4ac46a[_0xf07a('0x60')][_0xf07a('0x41')]||{};if(_0xd97857){_0x6e5199['host']=getImapHost(_0xd97857);_0x6e5199[_0xf07a('0x3c')]=0x3e1;_0x4c1f59[_0xf07a('0x3b')]=getSmtpHost(_0xd97857);_0x4c1f59['port']=0x24b;_0x4c1f59['secure']=![];}if(_0x4c1f59[_0xf07a('0x38')]){_0x4c1f59[_0xf07a('0x3d')]=![];}else{_0x4c1f59[_0xf07a('0x39')]=null;}if(!_0x6e5199['modernAuthentication'])_0x6e5199[_0xf07a('0x39')]=null;_0x4ac46a['body'][_0xf07a('0x40')]=_0x6e5199;_0x4ac46a[_0xf07a('0x60')][_0xf07a('0x41')]=_0x4c1f59;return db['MailAccount'][_0xf07a('0x63')]({'where':{'id':_0x4ac46a['params']['id']},'include':[{'model':db[_0xf07a('0x43')],'as':_0xf07a('0x40')},{'model':db[_0xf07a('0x44')],'as':_0xf07a('0x41')},{'model':db[_0xf07a('0x45')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x373ed6,null))['then'](function(_0x4b2a40){if(!_0x4b2a40)throw new Error(_0xf07a('0x64'));if(_0x4b2a40[_0xf07a('0x3e')])delete _0x4ac46a[_0xf07a('0x60')][_0xf07a('0x40')];return _0x4b2a40;})[_0xf07a('0x14')](saveUpdates(_0x4ac46a['body'],null))[_0xf07a('0x14')](function(_0x124112){if(!_0x4ac46a[_0xf07a('0x60')][_0xf07a('0x40')])return _0x124112;return db[_0xf07a('0x43')][_0xf07a('0x26')](_0x4ac46a['body'][_0xf07a('0x40')],{'where':{'MailAccountId':_0x124112['id']}})[_0xf07a('0x14')](function(){return _0x124112;});})[_0xf07a('0x14')](function(_0x101804){if(!_0x4ac46a['body'][_0xf07a('0x41')])return _0x101804;return db[_0xf07a('0x44')][_0xf07a('0x26')](_0x4ac46a[_0xf07a('0x60')][_0xf07a('0x41')],{'where':{'MailAccountId':_0x101804['id']}})[_0xf07a('0x14')](function(){return _0x101804;});})['then'](respondWithResult(_0x373ed6,null))[_0xf07a('0x1e')](handleError(_0x373ed6,null));};exports[_0xf07a('0x65')]=function(_0x47c50a,_0x5a571c){return db['MailAccount'][_0xf07a('0x65')]()['then'](respondWithResult(_0x5a571c,null))[_0xf07a('0x1e')](handleError(_0x5a571c,null));};exports[_0xf07a('0x66')]=function(_0x1bf1b9,_0x1ad47a){if(_0x1bf1b9[_0xf07a('0x60')]['id']){delete _0x1bf1b9['body']['id'];}return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x1bf1b9[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x1ad47a,null))['then'](function(_0x23a647){if(_0x23a647){_0x1bf1b9[_0xf07a('0x60')][_0xf07a('0x67')]=_0x23a647['id'];return db['Disposition']['create'](_0x1bf1b9[_0xf07a('0x60')]);}})[_0xf07a('0x14')](respondWithResult(_0x1ad47a,null))[_0xf07a('0x1e')](handleError(_0x1ad47a,null));};exports[_0xf07a('0x68')]=function(_0x15fd19,_0x57c991){var _0x21638b={'raw':![],'where':{}};var _0x1461af={};var _0x2a4094={'count':0x0,'rows':[]};return db[_0xf07a('0x47')]['findOne']({'where':{'id':_0x15fd19[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x57c991,null))[_0xf07a('0x14')](function(_0x3268b2){if(_0x3268b2){_0x1461af[_0xf07a('0x49')]=_['keys'](db[_0xf07a('0x69')]['rawAttributes']);_0x1461af['query']=_[_0xf07a('0x4c')](_0x15fd19[_0xf07a('0x4b')]);_0x1461af['filters']=_[_0xf07a('0x5d')](_0x1461af['model'],_0x1461af[_0xf07a('0x4b')]);_0x21638b[_0xf07a('0x4e')]=_[_0xf07a('0x5d')](_0x1461af[_0xf07a('0x49')],qs[_0xf07a('0x5e')](_0x15fd19[_0xf07a('0x4b')][_0xf07a('0x5e')]));_0x21638b[_0xf07a('0x4e')]=_0x21638b[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x21638b['attributes']:_0x1461af[_0xf07a('0x49')];if(!_0x15fd19[_0xf07a('0x4b')][_0xf07a('0x6a')](_0xf07a('0x50'))){_0x21638b[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x15fd19[_0xf07a('0x4b')]['limit']);_0x21638b[_0xf07a('0x21')]=qs[_0xf07a('0x21')](_0x15fd19[_0xf07a('0x4b')][_0xf07a('0x21')]);}_0x21638b[_0xf07a('0x6b')]=qs['sort'](_0x15fd19[_0xf07a('0x4b')][_0xf07a('0x6c')]);_0x21638b[_0xf07a('0x52')]=qs['filters'](_[_0xf07a('0x6d')](_0x15fd19['query'],_0x1461af[_0xf07a('0x4d')]));_0x21638b['where']['MailAccountId']=_0x3268b2['id'];if(_0x15fd19[_0xf07a('0x4b')]['filter']){_0x21638b[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x21638b[_0xf07a('0x52')],{'$or':_[_0xf07a('0x46')](_0x21638b[_0xf07a('0x4e')],function(_0x36970a){var _0x1d1a56={};_0x1d1a56[_0x36970a]={'$like':'%'+_0x15fd19['query'][_0xf07a('0x53')]+'%'};return _0x1d1a56;})});}_0x21638b=_[_0xf07a('0x54')]({},_0x21638b,_0x15fd19[_0xf07a('0x57')]);return db[_0xf07a('0x69')][_0xf07a('0x23')]({'where':_0x21638b[_0xf07a('0x52')]})['then'](function(_0x944c38){_0x2a4094[_0xf07a('0x23')]=_0x944c38;if(_0x15fd19[_0xf07a('0x4b')][_0xf07a('0x58')]){_0x21638b['include']=[{'all':!![]}];}return db['Disposition'][_0xf07a('0x59')](_0x21638b);})[_0xf07a('0x14')](function(_0xc9cab0){_0x2a4094[_0xf07a('0x5a')]=_0xc9cab0;return _0x2a4094;});}})[_0xf07a('0x14')](respondWithFilteredResult(_0x57c991,_0x21638b))[_0xf07a('0x1e')](handleError(_0x57c991,null));};exports[_0xf07a('0x6e')]=function(_0x438b87,_0xa3d7aa){return db['MailAccount'][_0xf07a('0x63')]({'where':{'id':_0x438b87[_0xf07a('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa3d7aa,null))[_0xf07a('0x14')](function(_0x20a8d8){if(_0x20a8d8){return _0x20a8d8[_0xf07a('0x6e')](_0x438b87[_0xf07a('0x4b')][_0xf07a('0x6f')]);}})[_0xf07a('0x14')](respondWithStatusCode(_0xa3d7aa,null))['catch'](handleError(_0xa3d7aa,null));};exports['addAnswer']=function(_0x567887,_0x58d90b){if(_0x567887[_0xf07a('0x60')]['id']){delete _0x567887[_0xf07a('0x60')]['id'];}return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x567887[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x58d90b,null))['then'](function(_0x49e495){if(_0x49e495){_0x567887['body']['MailAccountId']=_0x49e495['id'];return db[_0xf07a('0x70')][_0xf07a('0x71')](_0x567887[_0xf07a('0x60')]);}})[_0xf07a('0x14')](respondWithResult(_0x58d90b,null))[_0xf07a('0x1e')](handleError(_0x58d90b,null));};exports[_0xf07a('0x72')]=function(_0x476fc7,_0x573f6b){var _0x4bde6f={'raw':![],'where':{}};var _0x32603c={};var _0x74056e={'count':0x0,'rows':[]};return db['MailAccount'][_0xf07a('0x73')]({'where':{'id':_0x476fc7[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x573f6b,null))['then'](function(_0x25b533){if(_0x25b533){_0x32603c[_0xf07a('0x49')]=_[_0xf07a('0x4c')](db[_0xf07a('0x70')][_0xf07a('0x48')]);_0x32603c[_0xf07a('0x4b')]=_[_0xf07a('0x4c')](_0x476fc7[_0xf07a('0x4b')]);_0x32603c[_0xf07a('0x4d')]=_['intersection'](_0x32603c[_0xf07a('0x49')],_0x32603c['query']);_0x4bde6f[_0xf07a('0x4e')]=_[_0xf07a('0x5d')](_0x32603c[_0xf07a('0x49')],qs[_0xf07a('0x5e')](_0x476fc7['query']['fields']));_0x4bde6f[_0xf07a('0x4e')]=_0x4bde6f[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x4bde6f[_0xf07a('0x4e')]:_0x32603c[_0xf07a('0x49')];if(!_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x6a')](_0xf07a('0x50'))){_0x4bde6f[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x51')]);_0x4bde6f[_0xf07a('0x21')]=qs[_0xf07a('0x21')](_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x21')]);}_0x4bde6f[_0xf07a('0x6b')]=qs[_0xf07a('0x6c')](_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x6c')]);_0x4bde6f[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_[_0xf07a('0x6d')](_0x476fc7[_0xf07a('0x4b')],_0x32603c['filters']));_0x4bde6f[_0xf07a('0x52')][_0xf07a('0x67')]=_0x25b533['id'];if(_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x53')]){_0x4bde6f[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x4bde6f[_0xf07a('0x52')],{'$or':_[_0xf07a('0x46')](_0x4bde6f['attributes'],function(_0x193747){var _0x32460a={};_0x32460a[_0x193747]={'$like':'%'+_0x476fc7[_0xf07a('0x4b')][_0xf07a('0x53')]+'%'};return _0x32460a;})});}_0x4bde6f=_[_0xf07a('0x54')]({},_0x4bde6f,_0x476fc7[_0xf07a('0x57')]);return db[_0xf07a('0x70')]['count']({'where':_0x4bde6f['where']})['then'](function(_0x3572e5){_0x74056e[_0xf07a('0x23')]=_0x3572e5;if(_0x476fc7['query']['includeAll']){_0x4bde6f['include']=[{'all':!![]}];}return db[_0xf07a('0x70')][_0xf07a('0x59')](_0x4bde6f);})['then'](function(_0x45adf4){_0x74056e['rows']=_0x45adf4;return _0x74056e;});}})[_0xf07a('0x14')](respondWithFilteredResult(_0x573f6b,_0x4bde6f))['catch'](handleError(_0x573f6b,null));};exports[_0xf07a('0x74')]=function(_0x1fe970,_0x136373){return db[_0xf07a('0x47')]['find']({'where':{'id':_0x1fe970[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x136373,null))[_0xf07a('0x14')](function(_0x13ca6e){if(_0x13ca6e){return _0x13ca6e[_0xf07a('0x74')](_0x1fe970[_0xf07a('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x136373,null))['catch'](handleError(_0x136373,null));};exports[_0xf07a('0x71')]=function(_0x253e96,_0x4cacec){var _0x4f00e1={'name':_0x253e96[_0xf07a('0x60')][_0xf07a('0x4a')],'key':_0x253e96[_0xf07a('0x60')][_0xf07a('0x75')],'provider':_0x253e96[_0xf07a('0x60')][_0xf07a('0x61')]===_0xf07a('0x62')?null:_0x253e96[_0xf07a('0x60')][_0xf07a('0x61')],'email':_0x253e96['body']['email'],'ListId':_0x253e96[_0xf07a('0x60')][_0xf07a('0x76')],'active':!_['isNil'](_0x253e96[_0xf07a('0x60')][_0xf07a('0x77')])?_0x253e96[_0xf07a('0x60')][_0xf07a('0x77')]:!![],'description':_0x253e96[_0xf07a('0x60')][_0xf07a('0x78')]||null};var _0x1a4ef1=getAuthenticationOptions(_0x4f00e1['provider'],_0x253e96['body']);_0x4f00e1['Imap']=_0x1a4ef1[_0xf07a('0x40')];_0x4f00e1[_0xf07a('0x41')]=_0x1a4ef1['Smtp'];return db['MailAccount']['create'](_0x4f00e1,{'include':[{'model':db[_0xf07a('0x44')],'as':'Smtp'},{'model':db[_0xf07a('0x43')],'as':'Imap'}]})[_0xf07a('0x14')](function(_0x44c9e2){var _0x38b5a0=_0x253e96[_0xf07a('0x35')][_0xf07a('0x79')]({'plain':!![]});if(!_0x38b5a0)throw new Error(_0xf07a('0x7a'));if(_0x38b5a0[_0xf07a('0x7b')]===_0xf07a('0x35')){var _0x18667e=_0x44c9e2['get']({'plain':!![]});return db[_0xf07a('0x7c')][_0xf07a('0x63')]({'where':{'name':_0xf07a('0x27'),'userProfileId':_0x38b5a0[_0xf07a('0x7d')]},'raw':!![]})[_0xf07a('0x14')](function(_0x3de01d){if(_0x3de01d&&_0x3de01d[_0xf07a('0x7e')]===0x0){return db[_0xf07a('0x28')]['create']({'name':_0x18667e[_0xf07a('0x4a')],'resourceId':_0x18667e['id'],'type':_0x3de01d[_0xf07a('0x4a')],'sectionId':_0x3de01d['id']},{})[_0xf07a('0x14')](function(){return _0x44c9e2;});}else{return _0x44c9e2;}})[_0xf07a('0x1e')](function(_0x29ceca){logger['error'](_0xf07a('0x7f'),_0x29ceca);throw _0x29ceca;});}return _0x44c9e2;})[_0xf07a('0x14')](respondWithResult(_0x4cacec,0xc9))[_0xf07a('0x1e')](handleError(_0x4cacec,null));};exports['getImap']=function(_0x109dd9,_0x21feea){return db[_0xf07a('0x47')][_0xf07a('0x73')]({'where':{'id':_0x109dd9[_0xf07a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x21feea,null))[_0xf07a('0x14')](function(_0x309179){if(_0x309179){return _0x309179[_0xf07a('0x80')]();}return null;})[_0xf07a('0x14')](respondWithResult(_0x21feea,null))[_0xf07a('0x1e')](handleError(_0x21feea,null));};exports[_0xf07a('0x81')]=function(_0x27e3a3,_0x1db70d){if(_0x27e3a3[_0xf07a('0x60')]['id']){delete _0x27e3a3['body']['id'];}return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x27e3a3[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x1db70d,null))[_0xf07a('0x14')](function(_0x1def45){if(_0x1def45){_0x27e3a3[_0xf07a('0x60')][_0xf07a('0x67')]=_0x1def45['id'];return db['MailServerIn'][_0xf07a('0x71')](_0x27e3a3['body']);}})[_0xf07a('0x14')](respondWithResult(_0x1db70d,null))[_0xf07a('0x1e')](handleError(_0x1db70d,null));};exports[_0xf07a('0x82')]=function(_0x4c6ced,_0x24b6e){return db['MailAccount'][_0xf07a('0x73')]({'where':{'id':_0x4c6ced[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x24b6e,null))[_0xf07a('0x14')](function(_0x2869c3){if(_0x2869c3){return _0x2869c3[_0xf07a('0x83')](null);}return null;})[_0xf07a('0x14')](respondWithStatusCode(_0x24b6e,null))[_0xf07a('0x1e')](handleError(_0x24b6e,null));};exports[_0xf07a('0x84')]=function(_0x2e6b8c,_0x3e88fa){return db['MailAccount'][_0xf07a('0x73')]({'where':{'id':_0x2e6b8c[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x3e88fa,null))['then'](function(_0x835e58){if(_0x835e58){return _0x835e58[_0xf07a('0x84')]();}return null;})[_0xf07a('0x14')](respondWithResult(_0x3e88fa,null))['catch'](handleError(_0x3e88fa,null));};exports['addSmtp']=function(_0x502bb9,_0x186c63){if(_0x502bb9['body']['id']){delete _0x502bb9[_0xf07a('0x60')]['id'];}return db[_0xf07a('0x47')]['find']({'where':{'id':_0x502bb9[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x186c63,null))[_0xf07a('0x14')](function(_0x537058){if(_0x537058){_0x502bb9[_0xf07a('0x60')][_0xf07a('0x67')]=_0x537058['id'];return db[_0xf07a('0x44')]['create'](_0x502bb9[_0xf07a('0x60')]);}})['then'](respondWithResult(_0x186c63,null))['catch'](handleError(_0x186c63,null));};exports[_0xf07a('0x85')]=function(_0x35510e,_0x36447a){return db['MailAccount'][_0xf07a('0x73')]({'where':{'id':_0x35510e[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x36447a,null))[_0xf07a('0x14')](function(_0x4d2685){if(_0x4d2685){return _0x4d2685[_0xf07a('0x86')](null);}return null;})[_0xf07a('0x14')](respondWithStatusCode(_0x36447a,null))[_0xf07a('0x1e')](handleError(_0x36447a,null));};exports[_0xf07a('0x87')]=function(_0x521c25,_0x65f904){return db[_0xf07a('0x88')][_0xf07a('0x63')]({'where':{'id':_0x521c25[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x65f904,null))['then'](function(_0x2d983b){if(_0x2d983b){return _0x2d983b[_0xf07a('0x87')](_0x521c25[_0xf07a('0x60')][_0xf07a('0x6f')],_[_0xf07a('0x89')](_0x521c25[_0xf07a('0x60')],[_0xf07a('0x6f'),'id'])||{});}})[_0xf07a('0x14')](respondWithResult(_0x65f904,null))[_0xf07a('0x1e')](handleError(_0x65f904,null));};exports[_0xf07a('0x8a')]=function(_0x28f876,_0x1ba491){var _0x3a2f04={'raw':![],'where':{}};var _0x28c77f={};var _0x5e53b1={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x28f876['params']['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x1ba491,null))[_0xf07a('0x14')](function(_0x3cd3c4){if(_0x3cd3c4){_0x28c77f[_0xf07a('0x49')]=_[_0xf07a('0x4c')](db[_0xf07a('0x88')][_0xf07a('0x48')]);_0x28c77f[_0xf07a('0x4b')]=_[_0xf07a('0x4c')](_0x28f876['query']);_0x28c77f[_0xf07a('0x4d')]=_[_0xf07a('0x5d')](_0x28c77f[_0xf07a('0x49')],_0x28c77f[_0xf07a('0x4b')]);_0x3a2f04['attributes']=_['intersection'](_0x28c77f[_0xf07a('0x49')],qs[_0xf07a('0x5e')](_0x28f876[_0xf07a('0x4b')][_0xf07a('0x5e')]));_0x3a2f04['attributes']=_0x3a2f04[_0xf07a('0x4e')]['length']?_0x3a2f04['attributes']:_0x28c77f[_0xf07a('0x49')];if(!_0x28f876[_0xf07a('0x4b')][_0xf07a('0x6a')]('nolimit')){_0x3a2f04[_0xf07a('0x51')]=qs['limit'](_0x28f876[_0xf07a('0x4b')][_0xf07a('0x51')]);_0x3a2f04[_0xf07a('0x21')]=qs[_0xf07a('0x21')](_0x28f876['query'][_0xf07a('0x21')]);}_0x3a2f04['order']=qs[_0xf07a('0x6c')](_0x28f876['query'][_0xf07a('0x6c')]);_0x3a2f04[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_[_0xf07a('0x6d')](_0x28f876['query'],_0x28c77f[_0xf07a('0x4d')]));_0x3a2f04[_0xf07a('0x52')][_0xf07a('0x67')]=_0x3cd3c4['id'];if(_0x28f876[_0xf07a('0x4b')]['filter']){_0x3a2f04['where']=_[_0xf07a('0x54')](_0x3a2f04['where'],{'$or':_[_0xf07a('0x46')](_0x3a2f04[_0xf07a('0x4e')],function(_0x1fe2aa){var _0x524069={};_0x524069[_0x1fe2aa]={'$like':'%'+_0x28f876[_0xf07a('0x4b')][_0xf07a('0x53')]+'%'};return _0x524069;})});}_0x3a2f04=_[_0xf07a('0x54')]({},_0x3a2f04,_0x28f876[_0xf07a('0x57')]);return db[_0xf07a('0x88')]['count']({'where':_0x3a2f04[_0xf07a('0x52')]})['then'](function(_0x40583c){_0x5e53b1[_0xf07a('0x23')]=_0x40583c;if(_0x28f876[_0xf07a('0x4b')][_0xf07a('0x58')]){_0x3a2f04[_0xf07a('0x5f')]=[{'model':db[_0xf07a('0x8b')],'as':'Contact','required':![]},{'model':db[_0xf07a('0x8c')],'as':_0xf07a('0x8d'),'attributes':['name',_0xf07a('0x8e'),_0xf07a('0x8f')],'required':![]},{'model':db[_0xf07a('0x90')],'as':_0xf07a('0x91'),'attributes':['id',_0xf07a('0x4a'),_0xf07a('0x92')],'where':_0x28f876[_0xf07a('0x4b')][_0xf07a('0x93')]?{'id':_0x28f876[_0xf07a('0x4b')][_0xf07a('0x93')]}:undefined,'required':_0x28f876[_0xf07a('0x4b')][_0xf07a('0x93')]?!![]:![]}];}return db[_0xf07a('0x88')][_0xf07a('0x59')](_0x3a2f04);})[_0xf07a('0x14')](function(_0xa7df05){_0x5e53b1['rows']=_0xa7df05;return _0x5e53b1;});}})['then'](respondWithFilteredResult(_0x1ba491,_0x3a2f04))[_0xf07a('0x1e')](handleError(_0x1ba491,null));};exports['addApplications']=function addApplications(_0x888af9,_0x3b0f70){var _0x5b0b6f=_0x888af9[_0xf07a('0x5c')]['id'];var _0x1ad948=_0x888af9[_0xf07a('0x60')];var _0x325955=0xc8;var _0xa61e79=null;return db[_0xf07a('0x94')][_0xf07a('0x95')]({'isolationLevel':db['sequelize'][_0xf07a('0x96')]['ISOLATION_LEVELS'][_0xf07a('0x97')]},function(_0x16cbf6){return db[_0xf07a('0x47')]['findOne']({'where':{'id':_0x5b0b6f},'transaction':_0x16cbf6})[_0xf07a('0x14')](function(_0x5424e2){if(_0x5424e2){return db[_0xf07a('0x98')][_0xf07a('0x29')]({'where':{'MailAccountId':_0x5b0b6f},'transaction':_0x16cbf6})['then'](function(){var _0x495786=_[_0xf07a('0x46')](_0x1ad948,function(_0x4484d9){_0x4484d9[_0xf07a('0x67')]=_0x5b0b6f;return _0x4484d9;});return db[_0xf07a('0x98')][_0xf07a('0x99')](_0x495786,{'transaction':_0x16cbf6});});}else{_0x325955=0x194;_0xa61e79=[];}});})[_0xf07a('0x14')](function(){if(_0x325955!==0x194){return db[_0xf07a('0x98')][_0xf07a('0x9a')]({'where':{'MailAccountId':_0x5b0b6f},'order':_0xf07a('0x9b')})[_0xf07a('0x14')](function(_0x4c6989){_0xa61e79=_0x4c6989;});}})[_0xf07a('0x1e')](function(_0x554daf){_0x325955=0x1f4;logger[_0xf07a('0x19')](_0x554daf['stack']);if(_0x554daf[_0xf07a('0x4a')]){delete _0x554daf[_0xf07a('0x4a')];}_0xa61e79=_0x554daf;})['finally'](function(){if(_0xa61e79===null){_0x3b0f70[_0xf07a('0x1f')](_0x325955);}else{if(_0x325955===0x1f4){_0x3b0f70[_0xf07a('0x20')](_0x325955)['send'](_0xa61e79);}else{_0x3b0f70['status'](_0x325955)[_0xf07a('0x25')](_0xa61e79);}}});};exports[_0xf07a('0x9c')]=function(_0x15b60a,_0x3833dd){var _0x25ea9b={};var _0x238856={};var _0x360eb5;var _0x1162cd;return db[_0xf07a('0x47')]['findOne']({'where':{'id':_0x15b60a['params']['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x3833dd,null))[_0xf07a('0x14')](function(_0x2a0510){if(_0x2a0510){_0x360eb5=_0x2a0510;_0x238856[_0xf07a('0x49')]=_['keys'](db[_0xf07a('0x98')]['rawAttributes']);_0x238856[_0xf07a('0x4b')]=_[_0xf07a('0x4c')](_0x15b60a[_0xf07a('0x4b')]);_0x238856['filters']=_['intersection'](_0x238856[_0xf07a('0x49')],_0x238856[_0xf07a('0x4b')]);_0x25ea9b[_0xf07a('0x4e')]=_[_0xf07a('0x5d')](_0x238856['model'],qs[_0xf07a('0x5e')](_0x15b60a[_0xf07a('0x4b')][_0xf07a('0x5e')]));_0x25ea9b[_0xf07a('0x4e')]=_0x25ea9b[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x25ea9b['attributes']:_0x238856[_0xf07a('0x49')];_0x25ea9b[_0xf07a('0x6b')]=qs[_0xf07a('0x6c')](_0x15b60a[_0xf07a('0x4b')][_0xf07a('0x6c')]);_0x25ea9b[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_['pick'](_0x15b60a['query'],_0x238856[_0xf07a('0x4d')]));if(_0x15b60a['query'][_0xf07a('0x53')]){_0x25ea9b[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x25ea9b[_0xf07a('0x52')],{'$or':_[_0xf07a('0x46')](_0x25ea9b['attributes'],function(_0x2e4ad1){var _0xa727a4={};_0xa727a4[_0x2e4ad1]={'$like':'%'+_0x15b60a['query'][_0xf07a('0x53')]+'%'};return _0xa727a4;})});}_0x25ea9b=_[_0xf07a('0x54')]({},_0x25ea9b,_0x15b60a['options']);return _0x360eb5[_0xf07a('0x9c')](_0x25ea9b);}})[_0xf07a('0x14')](function(_0x232645){if(_0x232645){_0x1162cd=_0x232645[_0xf07a('0x4f')];if(!_0x15b60a[_0xf07a('0x4b')][_0xf07a('0x6a')]('nolimit')){_0x25ea9b[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x15b60a[_0xf07a('0x4b')]['limit']);_0x25ea9b[_0xf07a('0x21')]=qs['offset'](_0x15b60a[_0xf07a('0x4b')][_0xf07a('0x21')]);}return _0x360eb5[_0xf07a('0x9c')](_0x25ea9b);}})[_0xf07a('0x14')](function(_0x44e325){if(_0x44e325){return _0x44e325?{'count':_0x1162cd,'rows':_0x44e325}:null;}})[_0xf07a('0x14')](respondWithResult(_0x3833dd,null))[_0xf07a('0x1e')](handleError(_0x3833dd,null));};exports[_0xf07a('0x9d')]=function(_0x441e46,_0x22c6d4){var _0x25d88b={'raw':!![],'where':{}};var _0x569671={};var _0x541b03={'count':0x0,'rows':[]};return db['MailAccount'][_0xf07a('0x73')]({'where':{'id':_0x441e46['params']['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x22c6d4,null))[_0xf07a('0x14')](function(_0x1611df){if(_0x1611df){_0x569671[_0xf07a('0x49')]=_[_0xf07a('0x4c')](db[_0xf07a('0x9e')][_0xf07a('0x48')]);_0x569671[_0xf07a('0x4b')]=_['keys'](_0x441e46[_0xf07a('0x4b')]);_0x569671[_0xf07a('0x4d')]=_['intersection'](_0x569671['model'],_0x569671[_0xf07a('0x4b')]);_0x25d88b['attributes']=_[_0xf07a('0x5d')](_0x569671[_0xf07a('0x49')],qs[_0xf07a('0x5e')](_0x441e46['query'][_0xf07a('0x5e')]));_0x25d88b[_0xf07a('0x4e')]=_0x25d88b[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x25d88b[_0xf07a('0x4e')]:_0x569671[_0xf07a('0x49')];if(!_0x441e46[_0xf07a('0x4b')][_0xf07a('0x6a')](_0xf07a('0x50'))){_0x25d88b[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x441e46['query'][_0xf07a('0x51')]);_0x25d88b[_0xf07a('0x21')]=qs['offset'](_0x441e46['query'][_0xf07a('0x21')]);}_0x25d88b[_0xf07a('0x6b')]=qs[_0xf07a('0x6c')](_0x441e46['query'][_0xf07a('0x6c')]);_0x25d88b[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_[_0xf07a('0x6d')](_0x441e46['query'],_0x569671[_0xf07a('0x4d')]));_0x25d88b[_0xf07a('0x52')]['MailAccountId']=_0x1611df['id'];if(_0x441e46['query'][_0xf07a('0x53')]){_0x25d88b[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x25d88b[_0xf07a('0x52')],{'$or':_[_0xf07a('0x46')](_0x25d88b['attributes'],function(_0xf6a6da){var _0x146169={};_0x146169[_0xf6a6da]={'$like':'%'+_0x441e46[_0xf07a('0x4b')]['filter']+'%'};return _0x146169;})});}if(_0x441e46[_0xf07a('0x4b')][_0xf07a('0x9f')]){var _0x6a4ece=_0x441e46[_0xf07a('0x4b')]['$gte']['split'](',');var _0x3735b7={};_0x3735b7[_0x6a4ece[0x0]]={'$gte':moment(_0x6a4ece[0x1])['format'](_0xf07a('0xa0'))};_0x25d88b[_0xf07a('0x52')]=_[_0xf07a('0x54')](_0x25d88b[_0xf07a('0x52')],_0x3735b7);}_0x25d88b=_[_0xf07a('0x54')]({},_0x25d88b,_0x441e46[_0xf07a('0x57')]);return db['MailMessage'][_0xf07a('0x23')]({'where':_0x25d88b['where']})[_0xf07a('0x14')](function(_0x3f2c0b){_0x541b03[_0xf07a('0x23')]=_0x3f2c0b;if(_0x441e46[_0xf07a('0x4b')][_0xf07a('0x58')]){_0x25d88b['include']=[{'all':!![]}];}return db[_0xf07a('0x9e')][_0xf07a('0x59')](_0x25d88b);})[_0xf07a('0x14')](function(_0x342372){if(_0x441e46['query']['inlineCss']===_0xf07a('0xa1')){for(var _0x380603=0x0;_0x380603<_0x342372['length'];_0x380603++){_0x342372[_0x380603][_0xf07a('0x60')]=juice(_0x342372[_0x380603][_0xf07a('0x60')]);}}_0x541b03[_0xf07a('0x5a')]=_0x342372;return _0x541b03;});}})[_0xf07a('0x14')](respondWithFilteredResult(_0x22c6d4,_0x25d88b))['catch'](handleError(_0x22c6d4,null));};exports['send']=function(_0xae5911,_0x3bacba){var _0x3cc73f,_0x3f59c6={},_0x52b9c5;if(_0xae5911['body']['to']){_0x52b9c5=_0xae5911[_0xf07a('0x60')]['to']['split'](',')[0x0];}return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0xae5911[_0xf07a('0x5c')]['id']},'include':[{'model':db[_0xf07a('0xa2')],'as':_0xf07a('0xa3'),'include':[{'model':db[_0xf07a('0x8b')],'as':_0xf07a('0xa4'),'where':{'email':_0x52b9c5},'limit':0x1,'order':[[_0xf07a('0xa5'),_0xf07a('0xa6')]]}]},{'model':db[_0xf07a('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf07a('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xf07a('0x14')](handleEntityNotFound(_0x3bacba,null))[_0xf07a('0x14')](function(_0x34dbeb){if(!_0x34dbeb)return;_0x3cc73f=_0x34dbeb;if(!_0x34dbeb[_0xf07a('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0xae5911[_0xf07a('0x60')][_0xf07a('0xa8')])){_0xae5911[_0xf07a('0x60')][_0xf07a('0xa8')]=util[_0xf07a('0xa9')]('%s\x20<%s>',_0x34dbeb[_0xf07a('0x4a')],_0x34dbeb[_0xf07a('0xaa')]||_0x34dbeb[_0xf07a('0x41')]['user']);}if(_0xae5911[_0xf07a('0x60')][_0xf07a('0xab')]&&_0xae5911[_0xf07a('0x60')]['attachments'][_0xf07a('0x4f')]){for(var _0x2f29ea=0x0;_0x2f29ea<_0xae5911[_0xf07a('0x60')]['attachments'][_0xf07a('0x4f')];_0x2f29ea+=0x1){_0xae5911['body']['attachments'][_0x2f29ea]={'filename':_0xae5911[_0xf07a('0x60')][_0xf07a('0xab')][_0x2f29ea][_0xf07a('0x4a')],'path':path[_0xf07a('0xac')](config['root'],_0xf07a('0xad'),_0xae5911[_0xf07a('0x60')][_0xf07a('0xab')][_0x2f29ea][_0xf07a('0xae')])};}}var _0x16b113=_0x34dbeb['getSmtpOptions']();return respondWithRpcPromise(_0xf07a('0xaf'),_0xf07a('0xb0'),{'account':_0x16b113,'message':_0xae5911['body']});})[_0xf07a('0x14')](function(_0x201373){if(!_0x201373)return;_0x3f59c6=_0x201373;if(!_0x3cc73f[_0xf07a('0xa3')])throw new Error(_0xf07a('0xb1'));if(_0x3cc73f[_0xf07a('0xa3')]['Contacts'][_0xf07a('0x4f')])return _0x3cc73f['List'][_0xf07a('0xa4')][0x0];return db[_0xf07a('0x8b')][_0xf07a('0x71')](_[_0xf07a('0xb2')](_0xae5911[_0xf07a('0x60')],{'firstName':_0xae5911['body']['to'],'email':_0xae5911[_0xf07a('0x60')]['to'],'phone':_0xae5911[_0xf07a('0x60')]['to'],'ListId':_0x3cc73f[_0xf07a('0x76')]}));})[_0xf07a('0x14')](function(_0x4e9d18){if(!_0x4e9d18)return;var _0x141f27={'UserId':_0xae5911[_0xf07a('0x35')]['id'],'ContactId':_0x4e9d18['id'],'MailAccountId':_0x3cc73f['id'],'inReplyTo':_0x3f59c6[_0xf07a('0xb3')],'to':_0xae5911[_0xf07a('0x60')][_0xf07a('0xa8')],'cc':_0xae5911['body']['cc'],'subject':_0xae5911[_0xf07a('0x60')][_0xf07a('0xb4')],'attach':_0xae5911['body'][_0xf07a('0xb5')],'firstMsgDirection':_0xf07a('0xb6'),'lastMsgAt':moment()[_0xf07a('0xa9')](_0xf07a('0xa0')),'lastMsgDirection':_0xf07a('0xb6'),'Messages':[_[_0xf07a('0x54')](_0xae5911[_0xf07a('0x60')],{'messageId':_0x3f59c6['messageId'],'sentAt':moment()[_0xf07a('0xa9')](_0xf07a('0xa0')),'read':!![],'MailAccountId':_0x3cc73f['id'],'UserId':_0xae5911[_0xf07a('0x35')]['id'],'ContactId':_0x4e9d18['id']})]};if(_0xae5911[_0xf07a('0x60')][_0xf07a('0xb7')]){_0x141f27=_[_0xf07a('0x54')](_0x141f27,_0xae5911[_0xf07a('0x60')][_0xf07a('0xb7')]);}return db[_0xf07a('0x88')]['create'](_0x141f27,{'include':[{'model':db[_0xf07a('0x9e')],'as':_0xf07a('0xb8')}]});})[_0xf07a('0x14')](respondWithResult(_0x3bacba,null))[_0xf07a('0x1e')](handleError(_0x3bacba,null));};exports['verifySmtp']=function(_0x4d074e,_0x38bbbc){return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x4d074e[_0xf07a('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xf07a('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xf07a('0xa7'),'raw':!![]}]}]})[_0xf07a('0x14')](handleEntityNotFound(_0x38bbbc,null))[_0xf07a('0x14')](function(_0xc1df2e){if(!_0xc1df2e[_0xf07a('0x41')])return;var _0x54d9ca=_0xc1df2e[_0xf07a('0xb9')]();return respondWithRpcPromise('VerifySmtp',_0xf07a('0xba'),{'account':_0x54d9ca});})['then'](respondWithResult(_0x38bbbc,null))['catch'](handleError(_0x38bbbc,null));};exports[_0xf07a('0x29')]=function(_0x54e3a0,_0x135274){return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x54e3a0[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x135274,null))['then'](function(_0x19dc51){if(_0x19dc51&&_0x19dc51[_0xf07a('0x3e')]){throw new db[(_0xf07a('0xbb'))][(_0xf07a('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x19dc51;})[_0xf07a('0x14')](removeEntity(_0x135274,null))[_0xf07a('0x1e')](handleError(_0x135274,null));};exports[_0xf07a('0xbd')]=function(_0x44c34e,_0x5d71b6){return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x44c34e['params']['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x5d71b6,null))[_0xf07a('0x14')](function(_0x120667){if(_0x120667){return _0x120667['addAgents'](_0x44c34e[_0xf07a('0x60')]['ids'],_['omit'](_0x44c34e['body'],[_0xf07a('0x6f'),'id'])||{})[_0xf07a('0xbe')](function(_0xaa15f9){for(var _0x92d491=0x0;_0x92d491<_0x44c34e[_0xf07a('0x60')][_0xf07a('0x6f')][_0xf07a('0x4f')];_0x92d491+=0x1){socket[_0xf07a('0xbf')](_0xf07a('0xc0'),{'UserId':Number(_0x44c34e[_0xf07a('0x60')][_0xf07a('0x6f')][_0x92d491]),'MailAccountId':Number(_0x44c34e[_0xf07a('0x5c')]['id'])});}return _0xaa15f9;});}})[_0xf07a('0x14')](respondWithResult(_0x5d71b6,null))[_0xf07a('0x1e')](handleError(_0x5d71b6,null));};exports['removeAgents']=function(_0x1b4985,_0x1c0c48){return db[_0xf07a('0x47')][_0xf07a('0x63')]({'where':{'id':_0x1b4985[_0xf07a('0x5c')]['id']}})[_0xf07a('0x14')](handleEntityNotFound(_0x1c0c48,null))['then'](function(_0x2eead1){if(_0x2eead1){return _0x2eead1[_0xf07a('0xc1')](_0x1b4985[_0xf07a('0x4b')]['ids'])[_0xf07a('0x14')](function(){if(_[_0xf07a('0xc2')](_0x1b4985[_0xf07a('0x4b')][_0xf07a('0x6f')])){for(var _0x4847f3=0x0;_0x4847f3<_0x1b4985[_0xf07a('0x4b')][_0xf07a('0x6f')][_0xf07a('0x4f')];_0x4847f3+=0x1){socket[_0xf07a('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x1b4985[_0xf07a('0x4b')][_0xf07a('0x6f')][_0x4847f3]),'MailAccountId':Number(_0x1b4985[_0xf07a('0x5c')]['id'])});}}else{socket['emit'](_0xf07a('0xc3'),{'UserId':Number(_0x1b4985[_0xf07a('0x4b')][_0xf07a('0x6f')]),'MailAccountId':Number(_0x1b4985[_0xf07a('0x5c')]['id'])});}});}})[_0xf07a('0x14')](respondWithStatusCode(_0x1c0c48,null))[_0xf07a('0x1e')](handleError(_0x1c0c48,null));};exports[_0xf07a('0xc4')]=function(_0x5406d8,_0x3a1391){var _0x3d9114={};var _0x19aca3={};var _0x2492b5;var _0x4b64bb;return db[_0xf07a('0x47')][_0xf07a('0x73')]({'where':{'id':_0x5406d8[_0xf07a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a1391,null))[_0xf07a('0x14')](function(_0x404204){if(_0x404204){_0x2492b5=_0x404204;_0x19aca3['model']=_[_0xf07a('0x4c')](db[_0xf07a('0x8c')][_0xf07a('0x48')]);_0x19aca3['query']=_[_0xf07a('0x4c')](_0x5406d8['query']);_0x19aca3[_0xf07a('0x4d')]=_['intersection'](_0x19aca3[_0xf07a('0x49')],_0x19aca3[_0xf07a('0x4b')]);_0x3d9114['attributes']=_['intersection'](_0x19aca3['model'],qs[_0xf07a('0x5e')](_0x5406d8[_0xf07a('0x4b')]['fields']));_0x3d9114[_0xf07a('0x4e')]=_0x3d9114[_0xf07a('0x4e')][_0xf07a('0x4f')]?_0x3d9114[_0xf07a('0x4e')]:_0x19aca3[_0xf07a('0x49')];_0x3d9114['order']=qs[_0xf07a('0x6c')](_0x5406d8['query']['sort']);_0x3d9114[_0xf07a('0x52')]=qs[_0xf07a('0x4d')](_[_0xf07a('0x6d')](_0x5406d8[_0xf07a('0x4b')],_0x19aca3['filters']));if(_0x5406d8[_0xf07a('0x4b')][_0xf07a('0x53')]){_0x3d9114[_0xf07a('0x52')]=_['merge'](_0x3d9114[_0xf07a('0x52')],{'$or':_['map'](_0x3d9114['attributes'],function(_0x19da1e){var _0x396c0e={};_0x396c0e[_0x19da1e]={'$like':'%'+_0x5406d8[_0xf07a('0x4b')][_0xf07a('0x53')]+'%'};return _0x396c0e;})});}_0x3d9114=_[_0xf07a('0x54')]({},_0x3d9114,_0x5406d8['options']);return _0x2492b5['getAgents'](_0x3d9114);}})[_0xf07a('0x14')](function(_0x539af2){if(_0x539af2){_0x4b64bb=_0x539af2['length'];if(!_0x5406d8[_0xf07a('0x4b')]['hasOwnProperty'](_0xf07a('0x50'))){_0x3d9114[_0xf07a('0x51')]=qs[_0xf07a('0x51')](_0x5406d8['query'][_0xf07a('0x51')]);_0x3d9114[_0xf07a('0x21')]=qs[_0xf07a('0x21')](_0x5406d8['query'][_0xf07a('0x21')]);}return _0x2492b5[_0xf07a('0xc4')](_0x3d9114);}})[_0xf07a('0x14')](function(_0x21add8){if(_0x21add8){return _0x21add8?{'count':_0x4b64bb,'rows':_0x21add8}:null;}})['then'](respondWithResult(_0x3a1391,null))['catch'](handleError(_0x3a1391,null));}; \ No newline at end of file +var _0x89d6=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','attach','format','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','getAgents','moment','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','port','Imap','Smtp','index','MailServerOut','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','params','MailServerIn','Pause','mandatoryDispositionPause','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','rawAttributes','hasOwnProperty','MailAccountId','includeAll','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','Tag','color','tag','addApplications','transaction'];(function(_0x4c67db,_0x2d99d9){var _0x563b5f=function(_0x2c198a){while(--_0x2c198a){_0x4c67db['push'](_0x4c67db['shift']());}};_0x563b5f(++_0x2d99d9);}(_0x89d6,0x1b4));var _0x689d=function(_0x1b1af9,_0x3d783d){_0x1b1af9=_0x1b1af9-0x0;var _0x53f68c=_0x89d6[_0x1b1af9];return _0x53f68c;};'use strict';var moment=require(_0x689d('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x689d('0x1'));var _=require(_0x689d('0x2'));var juice=require(_0x689d('0x3'));var Redis=require(_0x689d('0x4'));var qs=require(_0x689d('0x5'));var logger=require(_0x689d('0x6'))(_0x689d('0x7'));var config=require(_0x689d('0x8'));var db=require(_0x689d('0x9'))['db'];config['redis']=_[_0x689d('0xa')](config[_0x689d('0xb')],{'host':_0x689d('0xc'),'port':0x18eb});var socket=require(_0x689d('0xd'))(new Redis(config[_0x689d('0xb')]));require('./mailAccount.socket')[_0x689d('0xe')](socket);var jayson=require(_0x689d('0xf'));var client=jayson[_0x689d('0x10')][_0x689d('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x150c8e,_0x127561,_0x38eef4,_0x50b464){return new BPromise(function(_0xeb1f8,_0x55f475){var _0x55eaa1=_0x50b464||client;return _0x55eaa1[_0x689d('0x12')](_0x150c8e,_0x38eef4)[_0x689d('0x13')](function(_0x392755){logger[_0x689d('0x14')]('MailAccount,\x20%s,\x20%s',_0x127561,_0x689d('0x15'));logger[_0x689d('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x127561,'request\x20sent',JSON[_0x689d('0x17')](_0x392755));if(_0x392755[_0x689d('0x18')]){if(_0x392755['error']['code']===0x1f4){logger[_0x689d('0x18')]('MailAccount,\x20%s,\x20%s',_0x127561,_0x392755[_0x689d('0x18')][_0x689d('0x19')]);return _0x55f475(_0x392755[_0x689d('0x18')][_0x689d('0x19')]);}logger[_0x689d('0x18')](_0x689d('0x1a'),_0x127561,_0x392755[_0x689d('0x18')][_0x689d('0x19')]);return _0xeb1f8(_0x392755[_0x689d('0x18')][_0x689d('0x19')]);}else{logger[_0x689d('0x14')](_0x689d('0x1a'),_0x127561,'request\x20sent');_0xeb1f8(_0x392755[_0x689d('0x1b')]['message']);}})[_0x689d('0x1c')](function(_0xab3f53){logger[_0x689d('0x18')](_0x689d('0x1a'),_0x127561,_0xab3f53);_0x55f475(_0xab3f53);});});}function respondWithStatusCode(_0x3b0ba8,_0xd8bb94){_0xd8bb94=_0xd8bb94||0xcc;return function(_0x9fba1c){if(_0x9fba1c){return _0x3b0ba8[_0x689d('0x1d')](_0xd8bb94);}return _0x3b0ba8[_0x689d('0x1e')](_0xd8bb94)[_0x689d('0x1f')]();};}function respondWithResult(_0x47ab41,_0x5b1a45){_0x5b1a45=_0x5b1a45||0xc8;return function(_0x2c66b5){if(_0x2c66b5){return _0x47ab41[_0x689d('0x1e')](_0x5b1a45)[_0x689d('0x20')](_0x2c66b5);}};}function respondWithFilteredResult(_0x29953c,_0x1edbe1){return function(_0x4a2130){if(_0x4a2130){var _0xee75c1=typeof _0x1edbe1['offset']===_0x689d('0x21')&&typeof _0x1edbe1['limit']==='undefined';var _0x3a99b3=_0x4a2130[_0x689d('0x22')];var _0x3d0b28=_0xee75c1?0x0:_0x1edbe1[_0x689d('0x23')];var _0x1551d7=_0xee75c1?_0x4a2130['count']:_0x1edbe1[_0x689d('0x23')]+_0x1edbe1[_0x689d('0x24')];var _0x459bdd;if(_0x1551d7>=_0x3a99b3){_0x1551d7=_0x3a99b3;_0x459bdd=0xc8;}else{_0x459bdd=0xce;}_0x29953c[_0x689d('0x1e')](_0x459bdd);return _0x29953c[_0x689d('0x25')]('Content-Range',_0x3d0b28+'-'+_0x1551d7+'/'+_0x3a99b3)[_0x689d('0x20')](_0x4a2130);}return null;};}function saveUpdates(_0x5b27d7){return function(_0x4ca7a4){if(_0x4ca7a4){return _0x4ca7a4[_0x689d('0x26')](_0x5b27d7)['then'](function(_0xdd6731){return _0xdd6731;});}return null;};}function removeEntity(_0x2f770c){return function(_0x24709d){if(_0x24709d){return _0x24709d[_0x689d('0x27')]()[_0x689d('0x13')](function(){var _0x471272=_0x24709d[_0x689d('0x28')]({'plain':!![]});var _0x476b61=_0x689d('0x29');return db[_0x689d('0x2a')][_0x689d('0x27')]({'where':{'type':_0x476b61,'resourceId':_0x471272['id']}})['then'](function(){return _0x24709d;});})[_0x689d('0x13')](function(){_0x2f770c[_0x689d('0x1e')](0xcc)[_0x689d('0x1f')]();});}};}function handleEntityNotFound(_0x534238){return function(_0x243bc3){if(!_0x243bc3){_0x534238['sendStatus'](0x194);}return _0x243bc3;};}function handleError(_0x320a1b,_0x2a50d7){_0x2a50d7=_0x2a50d7||0x1f4;return function(_0x3c7b09){logger[_0x689d('0x18')](_0x3c7b09['stack']);if(_0x3c7b09['name']){delete _0x3c7b09[_0x689d('0x2b')];}_0x320a1b[_0x689d('0x1e')](_0x2a50d7)[_0x689d('0x2c')](_0x3c7b09);};}function getImapHost(_0x543f36){switch(_0x543f36){case _0x689d('0x2d'):return _0x689d('0x2e');case _0x689d('0x2f'):return _0x689d('0x30');case _0x689d('0x31'):return'imap-mail.outlook.com';case'outlook365':return _0x689d('0x32');}throw new Error(_0x689d('0x33'),_0x543f36);}function getSmtpHost(_0x2101a5){switch(_0x2101a5){case _0x689d('0x2d'):return _0x689d('0x34');case _0x689d('0x2f'):return _0x689d('0x35');case'hotmail':return _0x689d('0x36');case'outlook365':return _0x689d('0x37');}throw new Error(_0x689d('0x33'),_0x2101a5);}function getAuthenticationOptions(_0x34ad28,_0x5ec0c3){var _0x5bea58={};var _0x45d39b={};if(_0x34ad28){_0x5bea58['user']=_0x45d39b[_0x689d('0x38')]=_0x5ec0c3[_0x689d('0x39')];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=_0x5ec0c3[_0x689d('0x3a')];if(_0x5ec0c3[_0x689d('0x3c')]){_0x5bea58[_0x689d('0x3c')]=_0x45d39b[_0x689d('0x3c')]=!![];_0x5bea58[_0x689d('0x3d')]=_0x45d39b[_0x689d('0x3d')]=_0x5ec0c3['CloudProviderId'];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=null;}else{_0x5bea58[_0x689d('0x3d')]=_0x45d39b['CloudProviderId']=null;}_0x5bea58[_0x689d('0x3e')]=getImapHost(_0x34ad28);_0x5bea58['port']=0x3e1;_0x45d39b[_0x689d('0x3e')]=getSmtpHost(_0x34ad28);_0x45d39b['port']=0x24b;_0x45d39b[_0x689d('0x3f')]=![];_0x5bea58[_0x689d('0x40')]=_0x45d39b[_0x689d('0x40')]=null;}else{if(_0x5ec0c3[_0x689d('0x41')]){_0x5bea58[_0x689d('0x38')]=_0x45d39b[_0x689d('0x38')]=_0x5ec0c3[_0x689d('0x39')];_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=_0x5ec0c3['password'];}else{_0x5bea58[_0x689d('0x41')]=_0x45d39b[_0x689d('0x41')]=![];_0x5bea58[_0x689d('0x38')]=_0x45d39b['user']=null;_0x5bea58[_0x689d('0x3a')]=_0x45d39b[_0x689d('0x3b')]=null;}_0x5bea58[_0x689d('0x3e')]=_0x5ec0c3['Imap'][_0x689d('0x3e')];_0x5bea58[_0x689d('0x42')]=_0x5ec0c3[_0x689d('0x43')][_0x689d('0x42')];_0x45d39b[_0x689d('0x3e')]=_0x5ec0c3[_0x689d('0x44')]['host'];_0x45d39b[_0x689d('0x42')]=_0x5ec0c3[_0x689d('0x44')][_0x689d('0x42')];}return{'Imap':_0x5bea58,'Smtp':_0x45d39b};}exports[_0x689d('0x45')]=function(_0x44deb3,_0x26bf6d){var _0x1d98ed={'include':[{'model':db['MailServerIn'],'as':_0x689d('0x43')},{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xbb816b={},_0x4de041={'count':0x0,'rows':[]};var _0x42e58b=_['map'](db[_0x689d('0x47')]['rawAttributes'],function(_0x398f2b){return{'name':_0x398f2b[_0x689d('0x48')],'type':_0x398f2b[_0x689d('0x49')][_0x689d('0x4a')]};});_0xbb816b[_0x689d('0x4b')]=_['map'](_0x42e58b,'name');_0xbb816b[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x44deb3[_0x689d('0x4c')]);_0xbb816b[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0xbb816b[_0x689d('0x4b')],_0xbb816b['query']);_0x1d98ed[_0x689d('0x50')]=_[_0x689d('0x4f')](_0xbb816b[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x51')]));_0x1d98ed[_0x689d('0x50')]=_0x1d98ed[_0x689d('0x50')][_0x689d('0x52')]?_0x1d98ed['attributes']:_0xbb816b[_0x689d('0x4b')];if(!_0x44deb3[_0x689d('0x4c')]['hasOwnProperty'](_0x689d('0x53'))){_0x1d98ed[_0x689d('0x24')]=qs[_0x689d('0x24')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x24')]);_0x1d98ed['offset']=qs[_0x689d('0x23')](_0x44deb3[_0x689d('0x4c')][_0x689d('0x23')]);}_0x1d98ed[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x44deb3['query'][_0x689d('0x55')]);_0x1d98ed[_0x689d('0x56')]=qs['filters'](_[_0x689d('0x57')](_0x44deb3['query'],_0xbb816b[_0x689d('0x4e')]),_0x42e58b);if(_0x44deb3[_0x689d('0x4c')][_0x689d('0x58')]){_0x1d98ed['where']=_[_0x689d('0x59')](_0x1d98ed[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x42e58b,function(_0x4240d8){if(_0x4240d8[_0x689d('0x49')]!==_0x689d('0x5b')){var _0x33df2d={};_0x33df2d[_0x4240d8[_0x689d('0x2b')]]={'$like':'%'+_0x44deb3['query'][_0x689d('0x58')]+'%'};return _0x33df2d;}})});}_0x1d98ed=_[_0x689d('0x59')]({},_0x1d98ed,_0x44deb3['options']);var _0x47c106={'where':_0x1d98ed[_0x689d('0x56')]};return db[_0x689d('0x47')][_0x689d('0x22')](_0x47c106)[_0x689d('0x13')](function(_0xdaa25e){_0x4de041[_0x689d('0x22')]=_0xdaa25e;if(_0x44deb3[_0x689d('0x4c')]['includeAll']){_0x1d98ed[_0x689d('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1d98ed);})['then'](function(_0x50e1ed){_0x4de041['rows']=_0x50e1ed;return _0x4de041;})[_0x689d('0x13')](respondWithFilteredResult(_0x26bf6d,_0x1d98ed))[_0x689d('0x1c')](handleError(_0x26bf6d,null));};exports['show']=function(_0x5ab620,_0xbc09d1){var _0x1ef671={'raw':![],'where':{'id':_0x5ab620[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0x5e')],'as':_0x689d('0x43')},{'model':db[_0x689d('0x46')],'as':'Smtp'},{'model':db[_0x689d('0x5f')],'as':_0x689d('0x60')}]},_0xd073d7={};_0xd073d7[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x47')]['rawAttributes']);_0xd073d7[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x5ab620[_0x689d('0x4c')]);_0xd073d7['filters']=_[_0x689d('0x4f')](_0xd073d7[_0x689d('0x4b')],_0xd073d7[_0x689d('0x4c')]);_0x1ef671[_0x689d('0x50')]=_['intersection'](_0xd073d7[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x5ab620[_0x689d('0x4c')]['fields']));_0x1ef671['attributes']=_0x1ef671[_0x689d('0x50')]['length']?_0x1ef671[_0x689d('0x50')]:_0xd073d7[_0x689d('0x4b')];if(_0x5ab620['query']['includeAll']){_0x1ef671['include']=[{'all':!![]}];}_0x1ef671=_[_0x689d('0x59')]({},_0x1ef671,_0x5ab620[_0x689d('0x61')]);return db['MailAccount'][_0x689d('0x62')](_0x1ef671)[_0x689d('0x13')](handleEntityNotFound(_0xbc09d1,null))[_0x689d('0x13')](respondWithResult(_0xbc09d1,null))['catch'](handleError(_0xbc09d1,null));};exports[_0x689d('0x26')]=function(_0x3dd750,_0x41f295){if(_0x3dd750['body']['id']){delete _0x3dd750[_0x689d('0x63')]['id'];}var _0x542dd8=_0x3dd750[_0x689d('0x63')][_0x689d('0x64')]==='custom'?null:_0x3dd750[_0x689d('0x63')][_0x689d('0x64')];var _0x4aad49=_0x3dd750[_0x689d('0x63')][_0x689d('0x43')]||{};var _0x547ec3=_0x3dd750[_0x689d('0x63')][_0x689d('0x44')]||{};if(_0x542dd8){_0x4aad49[_0x689d('0x3e')]=getImapHost(_0x542dd8);_0x4aad49[_0x689d('0x42')]=0x3e1;_0x547ec3[_0x689d('0x3e')]=getSmtpHost(_0x542dd8);_0x547ec3['port']=0x24b;_0x547ec3[_0x689d('0x3f')]=![];}if(_0x547ec3[_0x689d('0x3c')]){_0x547ec3[_0x689d('0x3f')]=![];}else{_0x547ec3['CloudProviderId']=null;}if(!_0x4aad49[_0x689d('0x3c')])_0x4aad49['CloudProviderId']=null;_0x3dd750[_0x689d('0x63')][_0x689d('0x43')]=_0x4aad49;_0x3dd750['body'][_0x689d('0x44')]=_0x547ec3;return db[_0x689d('0x47')]['find']({'where':{'id':_0x3dd750['params']['id']},'include':[{'model':db[_0x689d('0x5e')],'as':'Imap'},{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db[_0x689d('0x5f')],'as':_0x689d('0x60')}]})[_0x689d('0x13')](handleEntityNotFound(_0x41f295,null))[_0x689d('0x13')](function(_0x5dfa48){if(!_0x5dfa48)throw new Error(_0x689d('0x65'));if(_0x5dfa48[_0x689d('0x40')])delete _0x3dd750[_0x689d('0x63')]['Imap'];return _0x5dfa48;})[_0x689d('0x13')](saveUpdates(_0x3dd750[_0x689d('0x63')],null))[_0x689d('0x13')](function(_0x3bb37e){if(!_0x3dd750['body'][_0x689d('0x43')])return _0x3bb37e;return db[_0x689d('0x5e')][_0x689d('0x26')](_0x3dd750[_0x689d('0x63')][_0x689d('0x43')],{'where':{'MailAccountId':_0x3bb37e['id']}})[_0x689d('0x13')](function(){return _0x3bb37e;});})[_0x689d('0x13')](function(_0xd0156){if(!_0x3dd750['body'][_0x689d('0x44')])return _0xd0156;return db[_0x689d('0x46')][_0x689d('0x26')](_0x3dd750['body'][_0x689d('0x44')],{'where':{'MailAccountId':_0xd0156['id']}})[_0x689d('0x13')](function(){return _0xd0156;});})[_0x689d('0x13')](respondWithResult(_0x41f295,null))[_0x689d('0x1c')](handleError(_0x41f295,null));};exports[_0x689d('0x66')]=function(_0x3b9ad8,_0x3f8d58){return db[_0x689d('0x47')]['describe']()[_0x689d('0x13')](respondWithResult(_0x3f8d58,null))[_0x689d('0x1c')](handleError(_0x3f8d58,null));};exports['addDisposition']=function(_0x42afe8,_0x270a9b){if(_0x42afe8[_0x689d('0x63')]['id']){delete _0x42afe8[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')]['find']({'where':{'id':_0x42afe8[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x270a9b,null))[_0x689d('0x13')](function(_0x403a32){if(_0x403a32){_0x42afe8[_0x689d('0x63')]['MailAccountId']=_0x403a32['id'];return db[_0x689d('0x67')][_0x689d('0x68')](_0x42afe8[_0x689d('0x63')]);}})[_0x689d('0x13')](respondWithResult(_0x270a9b,null))[_0x689d('0x1c')](handleError(_0x270a9b,null));};exports[_0x689d('0x69')]=function(_0x5ba7a7,_0x258969){var _0x4b2240={'raw':![],'where':{}};var _0x18f39d={};var _0x148cf0={'count':0x0,'rows':[]};return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x5ba7a7['params']['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x258969,null))[_0x689d('0x13')](function(_0x5f3bb0){if(_0x5f3bb0){_0x18f39d['model']=_[_0x689d('0x4d')](db[_0x689d('0x67')][_0x689d('0x6a')]);_0x18f39d['query']=_[_0x689d('0x4d')](_0x5ba7a7[_0x689d('0x4c')]);_0x18f39d[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x18f39d['model'],_0x18f39d['query']);_0x4b2240['attributes']=_[_0x689d('0x4f')](_0x18f39d[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x51')]));_0x4b2240['attributes']=_0x4b2240[_0x689d('0x50')][_0x689d('0x52')]?_0x4b2240[_0x689d('0x50')]:_0x18f39d[_0x689d('0x4b')];if(!_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x4b2240[_0x689d('0x24')]=qs['limit'](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x24')]);_0x4b2240[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x23')]);}_0x4b2240[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x5ba7a7['query'][_0x689d('0x55')]);_0x4b2240['where']=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x5ba7a7[_0x689d('0x4c')],_0x18f39d[_0x689d('0x4e')]));_0x4b2240[_0x689d('0x56')][_0x689d('0x6c')]=_0x5f3bb0['id'];if(_0x5ba7a7['query']['filter']){_0x4b2240['where']=_[_0x689d('0x59')](_0x4b2240['where'],{'$or':_[_0x689d('0x5a')](_0x4b2240['attributes'],function(_0x5a057a){var _0x130b76={};_0x130b76[_0x5a057a]={'$like':'%'+_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x130b76;})});}_0x4b2240=_[_0x689d('0x59')]({},_0x4b2240,_0x5ba7a7[_0x689d('0x61')]);return db[_0x689d('0x67')][_0x689d('0x22')]({'where':_0x4b2240[_0x689d('0x56')]})[_0x689d('0x13')](function(_0x38a78c){_0x148cf0[_0x689d('0x22')]=_0x38a78c;if(_0x5ba7a7[_0x689d('0x4c')][_0x689d('0x6d')]){_0x4b2240[_0x689d('0x5c')]=[{'all':!![]}];}return db[_0x689d('0x67')][_0x689d('0x6e')](_0x4b2240);})[_0x689d('0x13')](function(_0x2723f8){_0x148cf0[_0x689d('0x6f')]=_0x2723f8;return _0x148cf0;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x258969,_0x4b2240))[_0x689d('0x1c')](handleError(_0x258969,null));};exports[_0x689d('0x70')]=function(_0x50f88c,_0x570fcc){return db[_0x689d('0x47')]['find']({'where':{'id':_0x50f88c['params']['id']}})['then'](handleEntityNotFound(_0x570fcc,null))['then'](function(_0x515aca){if(_0x515aca){return _0x515aca[_0x689d('0x70')](_0x50f88c[_0x689d('0x4c')][_0x689d('0x71')]);}})[_0x689d('0x13')](respondWithStatusCode(_0x570fcc,null))[_0x689d('0x1c')](handleError(_0x570fcc,null));};exports[_0x689d('0x72')]=function(_0x5d7f91,_0x3a7f4a){if(_0x5d7f91[_0x689d('0x63')]['id']){delete _0x5d7f91[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x5d7f91['params']['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x3a7f4a,null))[_0x689d('0x13')](function(_0x1d4caf){if(_0x1d4caf){_0x5d7f91[_0x689d('0x63')][_0x689d('0x6c')]=_0x1d4caf['id'];return db['CannedAnswer']['create'](_0x5d7f91[_0x689d('0x63')]);}})[_0x689d('0x13')](respondWithResult(_0x3a7f4a,null))['catch'](handleError(_0x3a7f4a,null));};exports[_0x689d('0x73')]=function(_0x134d1f,_0x19a1e6){var _0x499413={'raw':![],'where':{}};var _0x3a4ac8={};var _0x2051d2={'count':0x0,'rows':[]};return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x134d1f[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x19a1e6,null))[_0x689d('0x13')](function(_0x2cd531){if(_0x2cd531){_0x3a4ac8[_0x689d('0x4b')]=_['keys'](db[_0x689d('0x75')][_0x689d('0x6a')]);_0x3a4ac8[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x134d1f[_0x689d('0x4c')]);_0x3a4ac8[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x3a4ac8[_0x689d('0x4b')],_0x3a4ac8[_0x689d('0x4c')]);_0x499413[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x3a4ac8[_0x689d('0x4b')],qs['fields'](_0x134d1f['query'][_0x689d('0x51')]));_0x499413[_0x689d('0x50')]=_0x499413[_0x689d('0x50')][_0x689d('0x52')]?_0x499413[_0x689d('0x50')]:_0x3a4ac8[_0x689d('0x4b')];if(!_0x134d1f[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x499413[_0x689d('0x24')]=qs['limit'](_0x134d1f[_0x689d('0x4c')][_0x689d('0x24')]);_0x499413['offset']=qs[_0x689d('0x23')](_0x134d1f[_0x689d('0x4c')][_0x689d('0x23')]);}_0x499413[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x134d1f[_0x689d('0x4c')][_0x689d('0x55')]);_0x499413[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x134d1f['query'],_0x3a4ac8[_0x689d('0x4e')]));_0x499413[_0x689d('0x56')][_0x689d('0x6c')]=_0x2cd531['id'];if(_0x134d1f[_0x689d('0x4c')][_0x689d('0x58')]){_0x499413[_0x689d('0x56')]=_['merge'](_0x499413[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x499413['attributes'],function(_0x5961ea){var _0x130972={};_0x130972[_0x5961ea]={'$like':'%'+_0x134d1f[_0x689d('0x4c')]['filter']+'%'};return _0x130972;})});}_0x499413=_['merge']({},_0x499413,_0x134d1f[_0x689d('0x61')]);return db[_0x689d('0x75')][_0x689d('0x22')]({'where':_0x499413[_0x689d('0x56')]})['then'](function(_0x4732a3){_0x2051d2['count']=_0x4732a3;if(_0x134d1f[_0x689d('0x4c')]['includeAll']){_0x499413[_0x689d('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x689d('0x6e')](_0x499413);})[_0x689d('0x13')](function(_0x24a7bd){_0x2051d2['rows']=_0x24a7bd;return _0x2051d2;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x19a1e6,_0x499413))['catch'](handleError(_0x19a1e6,null));};exports['removeAnswers']=function(_0x2d4b81,_0x1892d8){return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x2d4b81[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x1892d8,null))[_0x689d('0x13')](function(_0x75daf6){if(_0x75daf6){return _0x75daf6['removeAnswers'](_0x2d4b81[_0x689d('0x4c')][_0x689d('0x71')]);}})[_0x689d('0x13')](respondWithStatusCode(_0x1892d8,null))[_0x689d('0x1c')](handleError(_0x1892d8,null));};exports[_0x689d('0x68')]=function(_0x39bb4a,_0x226054){var _0x427c26={'name':_0x39bb4a['body'][_0x689d('0x2b')],'key':_0x39bb4a[_0x689d('0x63')][_0x689d('0x4a')],'provider':_0x39bb4a[_0x689d('0x63')][_0x689d('0x64')]==='custom'?null:_0x39bb4a[_0x689d('0x63')]['provider'],'email':_0x39bb4a['body']['email'],'ListId':_0x39bb4a[_0x689d('0x63')][_0x689d('0x76')],'active':!_[_0x689d('0x77')](_0x39bb4a[_0x689d('0x63')]['active'])?_0x39bb4a[_0x689d('0x63')][_0x689d('0x78')]:!![],'description':_0x39bb4a[_0x689d('0x63')][_0x689d('0x79')]||null};var _0x7dfcb1=getAuthenticationOptions(_0x427c26[_0x689d('0x64')],_0x39bb4a['body']);_0x427c26[_0x689d('0x43')]=_0x7dfcb1[_0x689d('0x43')];_0x427c26['Smtp']=_0x7dfcb1[_0x689d('0x44')];return db['MailAccount'][_0x689d('0x68')](_0x427c26,{'include':[{'model':db[_0x689d('0x46')],'as':_0x689d('0x44')},{'model':db[_0x689d('0x5e')],'as':'Imap'}]})[_0x689d('0x13')](function(_0x7f93dc){var _0x28e259=_0x39bb4a[_0x689d('0x38')][_0x689d('0x28')]({'plain':!![]});if(!_0x28e259)throw new Error(_0x689d('0x7a'));if(_0x28e259['role']===_0x689d('0x38')){var _0x5c061a=_0x7f93dc[_0x689d('0x28')]({'plain':!![]});return db[_0x689d('0x7b')][_0x689d('0x62')]({'where':{'name':_0x689d('0x29'),'userProfileId':_0x28e259['userProfileId']},'raw':!![]})['then'](function(_0x4f9cc2){if(_0x4f9cc2&&_0x4f9cc2[_0x689d('0x7c')]===0x0){return db[_0x689d('0x2a')]['create']({'name':_0x5c061a[_0x689d('0x2b')],'resourceId':_0x5c061a['id'],'type':_0x4f9cc2[_0x689d('0x2b')],'sectionId':_0x4f9cc2['id']},{})[_0x689d('0x13')](function(){return _0x7f93dc;});}else{return _0x7f93dc;}})['catch'](function(_0x71a5d){logger[_0x689d('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x71a5d);throw _0x71a5d;});}return _0x7f93dc;})[_0x689d('0x13')](respondWithResult(_0x226054,0xc9))[_0x689d('0x1c')](handleError(_0x226054,null));};exports['getImap']=function(_0x2b4131,_0x275f3a){return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x2b4131[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x275f3a,null))['then'](function(_0x352db6){if(_0x352db6){return _0x352db6[_0x689d('0x7d')]();}return null;})[_0x689d('0x13')](respondWithResult(_0x275f3a,null))[_0x689d('0x1c')](handleError(_0x275f3a,null));};exports[_0x689d('0x7e')]=function(_0xd6bcc0,_0x248468){if(_0xd6bcc0[_0x689d('0x63')]['id']){delete _0xd6bcc0[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0xd6bcc0[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x248468,null))[_0x689d('0x13')](function(_0xbc252e){if(_0xbc252e){_0xd6bcc0[_0x689d('0x63')]['MailAccountId']=_0xbc252e['id'];return db[_0x689d('0x5e')]['create'](_0xd6bcc0['body']);}})[_0x689d('0x13')](respondWithResult(_0x248468,null))['catch'](handleError(_0x248468,null));};exports[_0x689d('0x7f')]=function(_0x323411,_0x4593d2){return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x323411[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x4593d2,null))[_0x689d('0x13')](function(_0x2b6859){if(_0x2b6859){return _0x2b6859[_0x689d('0x80')](null);}return null;})[_0x689d('0x13')](respondWithStatusCode(_0x4593d2,null))[_0x689d('0x1c')](handleError(_0x4593d2,null));};exports[_0x689d('0x81')]=function(_0x50e533,_0x5e12a3){return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x50e533[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x5e12a3,null))[_0x689d('0x13')](function(_0x12b1d5){if(_0x12b1d5){return _0x12b1d5[_0x689d('0x81')]();}return null;})[_0x689d('0x13')](respondWithResult(_0x5e12a3,null))[_0x689d('0x1c')](handleError(_0x5e12a3,null));};exports[_0x689d('0x82')]=function(_0x3a56a1,_0x30ae80){if(_0x3a56a1[_0x689d('0x63')]['id']){delete _0x3a56a1[_0x689d('0x63')]['id'];}return db[_0x689d('0x47')]['find']({'where':{'id':_0x3a56a1[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x30ae80,null))['then'](function(_0x52d76c){if(_0x52d76c){_0x3a56a1[_0x689d('0x63')][_0x689d('0x6c')]=_0x52d76c['id'];return db[_0x689d('0x46')][_0x689d('0x68')](_0x3a56a1['body']);}})[_0x689d('0x13')](respondWithResult(_0x30ae80,null))[_0x689d('0x1c')](handleError(_0x30ae80,null));};exports[_0x689d('0x83')]=function(_0x471623,_0x39836d){return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x471623[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x39836d,null))[_0x689d('0x13')](function(_0x2cff10){if(_0x2cff10){return _0x2cff10[_0x689d('0x84')](null);}return null;})[_0x689d('0x13')](respondWithStatusCode(_0x39836d,null))[_0x689d('0x1c')](handleError(_0x39836d,null));};exports[_0x689d('0x85')]=function(_0x1b0d76,_0x3b03b9){return db[_0x689d('0x86')][_0x689d('0x62')]({'where':{'id':_0x1b0d76[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x3b03b9,null))[_0x689d('0x13')](function(_0x5021bb){if(_0x5021bb){return _0x5021bb[_0x689d('0x85')](_0x1b0d76[_0x689d('0x63')][_0x689d('0x71')],_[_0x689d('0x87')](_0x1b0d76[_0x689d('0x63')],['ids','id'])||{});}})[_0x689d('0x13')](respondWithResult(_0x3b03b9,null))[_0x689d('0x1c')](handleError(_0x3b03b9,null));};exports[_0x689d('0x88')]=function(_0x558b71,_0x5dd35d){var _0x199a0a={'raw':![],'where':{}};var _0x4603c5={};var _0x17821d={'count':0x0,'rows':[]};return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x558b71[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x5dd35d,null))[_0x689d('0x13')](function(_0x4dd479){if(_0x4dd479){_0x4603c5[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x86')][_0x689d('0x6a')]);_0x4603c5[_0x689d('0x4c')]=_[_0x689d('0x4d')](_0x558b71['query']);_0x4603c5[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x4603c5['model'],_0x4603c5[_0x689d('0x4c')]);_0x199a0a['attributes']=_[_0x689d('0x4f')](_0x4603c5[_0x689d('0x4b')],qs['fields'](_0x558b71[_0x689d('0x4c')]['fields']));_0x199a0a[_0x689d('0x50')]=_0x199a0a[_0x689d('0x50')][_0x689d('0x52')]?_0x199a0a[_0x689d('0x50')]:_0x4603c5[_0x689d('0x4b')];if(!_0x558b71[_0x689d('0x4c')]['hasOwnProperty'](_0x689d('0x53'))){_0x199a0a[_0x689d('0x24')]=qs['limit'](_0x558b71[_0x689d('0x4c')][_0x689d('0x24')]);_0x199a0a[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x558b71['query'][_0x689d('0x23')]);}_0x199a0a[_0x689d('0x54')]=qs['sort'](_0x558b71[_0x689d('0x4c')][_0x689d('0x55')]);_0x199a0a['where']=qs[_0x689d('0x4e')](_['pick'](_0x558b71['query'],_0x4603c5[_0x689d('0x4e')]));_0x199a0a[_0x689d('0x56')][_0x689d('0x6c')]=_0x4dd479['id'];if(_0x558b71[_0x689d('0x4c')][_0x689d('0x58')]){_0x199a0a[_0x689d('0x56')]=_[_0x689d('0x59')](_0x199a0a[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x199a0a[_0x689d('0x50')],function(_0xc91625){var _0x4c1c82={};_0x4c1c82[_0xc91625]={'$like':'%'+_0x558b71[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x4c1c82;})});}_0x199a0a=_[_0x689d('0x59')]({},_0x199a0a,_0x558b71[_0x689d('0x61')]);return db[_0x689d('0x86')]['count']({'where':_0x199a0a[_0x689d('0x56')]})['then'](function(_0x11d084){_0x17821d[_0x689d('0x22')]=_0x11d084;if(_0x558b71[_0x689d('0x4c')]['includeAll']){_0x199a0a[_0x689d('0x5c')]=[{'model':db[_0x689d('0x89')],'as':_0x689d('0x8a'),'required':![]},{'model':db[_0x689d('0x8b')],'as':_0x689d('0x8c'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x689d('0x8d')],'as':'Tags','attributes':['id',_0x689d('0x2b'),_0x689d('0x8e')],'where':_0x558b71[_0x689d('0x4c')]['tag']?{'id':_0x558b71['query'][_0x689d('0x8f')]}:undefined,'required':_0x558b71['query'][_0x689d('0x8f')]?!![]:![]}];}return db[_0x689d('0x86')][_0x689d('0x6e')](_0x199a0a);})[_0x689d('0x13')](function(_0xfa3e98){_0x17821d[_0x689d('0x6f')]=_0xfa3e98;return _0x17821d;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x5dd35d,_0x199a0a))[_0x689d('0x1c')](handleError(_0x5dd35d,null));};exports[_0x689d('0x90')]=function addApplications(_0x5b86c0,_0x310948){var _0x22d02f=_0x5b86c0['params']['id'];var _0x1b40ff=_0x5b86c0[_0x689d('0x63')];var _0xcd55b9=0xc8;var _0x286886=null;return db['sequelize'][_0x689d('0x91')]({'isolationLevel':db[_0x689d('0x92')][_0x689d('0x93')][_0x689d('0x94')][_0x689d('0x95')]},function(_0x375ebe){return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x22d02f},'transaction':_0x375ebe})[_0x689d('0x13')](function(_0x422c42){if(_0x422c42){return db['MailApplication'][_0x689d('0x27')]({'where':{'MailAccountId':_0x22d02f},'transaction':_0x375ebe})[_0x689d('0x13')](function(){var _0x49289c=_[_0x689d('0x5a')](_0x1b40ff,function(_0x3a822b){_0x3a822b[_0x689d('0x6c')]=_0x22d02f;return _0x3a822b;});return db['MailApplication'][_0x689d('0x96')](_0x49289c,{'transaction':_0x375ebe});});}else{_0xcd55b9=0x194;_0x286886=[];}});})[_0x689d('0x13')](function(){if(_0xcd55b9!==0x194){return db[_0x689d('0x97')][_0x689d('0x98')]({'where':{'MailAccountId':_0x22d02f},'order':_0x689d('0x99')})[_0x689d('0x13')](function(_0x34cefe){_0x286886=_0x34cefe;});}})[_0x689d('0x1c')](function(_0x50f135){_0xcd55b9=0x1f4;logger['error'](_0x50f135[_0x689d('0x9a')]);if(_0x50f135[_0x689d('0x2b')]){delete _0x50f135[_0x689d('0x2b')];}_0x286886=_0x50f135;})[_0x689d('0x9b')](function(){if(_0x286886===null){_0x310948[_0x689d('0x1d')](_0xcd55b9);}else{if(_0xcd55b9===0x1f4){_0x310948['status'](_0xcd55b9)[_0x689d('0x2c')](_0x286886);}else{_0x310948[_0x689d('0x1e')](_0xcd55b9)[_0x689d('0x20')](_0x286886);}}});};exports[_0x689d('0x9c')]=function(_0x81a687,_0x562507){var _0x3fa08e={};var _0x1ad1b3={};var _0x2eba9f;var _0x5270ea;return db[_0x689d('0x47')]['findOne']({'where':{'id':_0x81a687[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x562507,null))[_0x689d('0x13')](function(_0x1c929a){if(_0x1c929a){_0x2eba9f=_0x1c929a;_0x1ad1b3['model']=_[_0x689d('0x4d')](db[_0x689d('0x97')][_0x689d('0x6a')]);_0x1ad1b3[_0x689d('0x4c')]=_['keys'](_0x81a687[_0x689d('0x4c')]);_0x1ad1b3[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x1ad1b3[_0x689d('0x4b')],_0x1ad1b3['query']);_0x3fa08e[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x1ad1b3[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x81a687[_0x689d('0x4c')][_0x689d('0x51')]));_0x3fa08e[_0x689d('0x50')]=_0x3fa08e[_0x689d('0x50')][_0x689d('0x52')]?_0x3fa08e[_0x689d('0x50')]:_0x1ad1b3[_0x689d('0x4b')];_0x3fa08e[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x81a687['query'][_0x689d('0x55')]);_0x3fa08e[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x81a687[_0x689d('0x4c')],_0x1ad1b3[_0x689d('0x4e')]));if(_0x81a687[_0x689d('0x4c')][_0x689d('0x58')]){_0x3fa08e[_0x689d('0x56')]=_[_0x689d('0x59')](_0x3fa08e[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x3fa08e['attributes'],function(_0x270c43){var _0x571380={};_0x571380[_0x270c43]={'$like':'%'+_0x81a687['query'][_0x689d('0x58')]+'%'};return _0x571380;})});}_0x3fa08e=_[_0x689d('0x59')]({},_0x3fa08e,_0x81a687['options']);return _0x2eba9f['getApplications'](_0x3fa08e);}})[_0x689d('0x13')](function(_0x441d04){if(_0x441d04){_0x5270ea=_0x441d04[_0x689d('0x52')];if(!_0x81a687[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x3fa08e['limit']=qs[_0x689d('0x24')](_0x81a687[_0x689d('0x4c')]['limit']);_0x3fa08e[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x81a687['query']['offset']);}return _0x2eba9f[_0x689d('0x9c')](_0x3fa08e);}})[_0x689d('0x13')](function(_0x3535f2){if(_0x3535f2){return _0x3535f2?{'count':_0x5270ea,'rows':_0x3535f2}:null;}})[_0x689d('0x13')](respondWithResult(_0x562507,null))['catch'](handleError(_0x562507,null));};exports[_0x689d('0x9d')]=function(_0x1943f8,_0x793813){var _0x4e9102={'raw':!![],'where':{}};var _0x26c851={};var _0x2a1e75={'count':0x0,'rows':[]};return db['MailAccount'][_0x689d('0x74')]({'where':{'id':_0x1943f8[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x793813,null))[_0x689d('0x13')](function(_0x390925){if(_0x390925){_0x26c851['model']=_[_0x689d('0x4d')](db[_0x689d('0x9e')][_0x689d('0x6a')]);_0x26c851[_0x689d('0x4c')]=_['keys'](_0x1943f8[_0x689d('0x4c')]);_0x26c851['filters']=_[_0x689d('0x4f')](_0x26c851['model'],_0x26c851[_0x689d('0x4c')]);_0x4e9102[_0x689d('0x50')]=_[_0x689d('0x4f')](_0x26c851[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x1943f8[_0x689d('0x4c')][_0x689d('0x51')]));_0x4e9102[_0x689d('0x50')]=_0x4e9102[_0x689d('0x50')][_0x689d('0x52')]?_0x4e9102[_0x689d('0x50')]:_0x26c851[_0x689d('0x4b')];if(!_0x1943f8[_0x689d('0x4c')][_0x689d('0x6b')](_0x689d('0x53'))){_0x4e9102[_0x689d('0x24')]=qs['limit'](_0x1943f8[_0x689d('0x4c')][_0x689d('0x24')]);_0x4e9102[_0x689d('0x23')]=qs[_0x689d('0x23')](_0x1943f8['query'][_0x689d('0x23')]);}_0x4e9102[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x1943f8[_0x689d('0x4c')][_0x689d('0x55')]);_0x4e9102[_0x689d('0x56')]=qs[_0x689d('0x4e')](_[_0x689d('0x57')](_0x1943f8[_0x689d('0x4c')],_0x26c851[_0x689d('0x4e')]));_0x4e9102['where'][_0x689d('0x6c')]=_0x390925['id'];if(_0x1943f8['query']['filter']){_0x4e9102['where']=_[_0x689d('0x59')](_0x4e9102[_0x689d('0x56')],{'$or':_[_0x689d('0x5a')](_0x4e9102[_0x689d('0x50')],function(_0x1af483){var _0x33928c={};_0x33928c[_0x1af483]={'$like':'%'+_0x1943f8[_0x689d('0x4c')][_0x689d('0x58')]+'%'};return _0x33928c;})});}if(_0x1943f8[_0x689d('0x4c')][_0x689d('0x9f')]){var _0x1da041=_0x1943f8['query'][_0x689d('0x9f')][_0x689d('0xa0')](',');var _0x327f7e={};_0x327f7e[_0x1da041[0x0]]={'$gte':moment(_0x1da041[0x1])['format'](_0x689d('0xa1'))};_0x4e9102['where']=_[_0x689d('0x59')](_0x4e9102['where'],_0x327f7e);}_0x4e9102=_[_0x689d('0x59')]({},_0x4e9102,_0x1943f8[_0x689d('0x61')]);return db['MailMessage'][_0x689d('0x22')]({'where':_0x4e9102['where']})[_0x689d('0x13')](function(_0x43f9fa){_0x2a1e75[_0x689d('0x22')]=_0x43f9fa;if(_0x1943f8[_0x689d('0x4c')][_0x689d('0x6d')]){_0x4e9102[_0x689d('0x5c')]=[{'all':!![]}];}return db[_0x689d('0x9e')]['findAll'](_0x4e9102);})[_0x689d('0x13')](function(_0x1b8cf8){if(_0x1943f8[_0x689d('0x4c')][_0x689d('0xa2')]==='true'){for(var _0x31af15=0x0;_0x31af15<_0x1b8cf8[_0x689d('0x52')];_0x31af15++){_0x1b8cf8[_0x31af15][_0x689d('0x63')]=juice(_0x1b8cf8[_0x31af15][_0x689d('0x63')]);}}_0x2a1e75[_0x689d('0x6f')]=_0x1b8cf8;return _0x2a1e75;});}})[_0x689d('0x13')](respondWithFilteredResult(_0x793813,_0x4e9102))['catch'](handleError(_0x793813,null));};exports['send']=function(_0x1af481,_0x45497a){var _0x25ce52,_0x3cdc08={},_0x5890d6;if(_0x1af481[_0x689d('0x63')]['to']){_0x5890d6=_0x1af481[_0x689d('0x63')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x1af481[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0xa3')],'as':_0x689d('0xa4'),'include':[{'model':db[_0x689d('0x89')],'as':_0x689d('0xa5'),'where':{'email':_0x5890d6},'limit':0x1,'order':[[_0x689d('0xa6'),_0x689d('0xa7')]]}]},{'model':db['MailServerOut'],'as':_0x689d('0x44'),'raw':!![],'include':[{'model':db[_0x689d('0xa8')],'as':_0x689d('0xa8'),'raw':!![]}]}]})[_0x689d('0x13')](handleEntityNotFound(_0x45497a,null))[_0x689d('0x13')](function(_0x4bb4d3){if(!_0x4bb4d3)return;_0x25ce52=_0x4bb4d3;if(!_0x4bb4d3[_0x689d('0x44')])throw new Error(_0x689d('0xa9'));if(_['isNil'](_0x1af481[_0x689d('0x63')]['from'])){_0x1af481[_0x689d('0x63')][_0x689d('0xaa')]=util['format'](_0x689d('0xab'),_0x4bb4d3[_0x689d('0x2b')],_0x4bb4d3[_0x689d('0xac')]||_0x4bb4d3['Smtp'][_0x689d('0x38')]);}if(_0x1af481[_0x689d('0x63')][_0x689d('0xad')]&&_0x1af481[_0x689d('0x63')][_0x689d('0xad')][_0x689d('0x52')]){for(var _0x44bac7=0x0;_0x44bac7<_0x1af481[_0x689d('0x63')]['attachments'][_0x689d('0x52')];_0x44bac7+=0x1){_0x1af481['body'][_0x689d('0xad')][_0x44bac7]={'filename':_0x1af481[_0x689d('0x63')]['attachments'][_0x44bac7]['name'],'path':path['join'](config['root'],'server/files/attachments',_0x1af481['body'][_0x689d('0xad')][_0x44bac7][_0x689d('0xae')])};}}var _0x18a838=_0x4bb4d3[_0x689d('0xaf')]();return respondWithRpcPromise(_0x689d('0xb0'),_0x689d('0xb1'),{'account':_0x18a838,'message':_0x1af481[_0x689d('0x63')]});})[_0x689d('0x13')](function(_0x4c539c){if(!_0x4c539c)return;_0x3cdc08=_0x4c539c;if(!_0x25ce52[_0x689d('0xa4')])throw new Error(_0x689d('0xb2'));if(_0x25ce52[_0x689d('0xa4')]['Contacts'][_0x689d('0x52')])return _0x25ce52[_0x689d('0xa4')][_0x689d('0xa5')][0x0];return db['CmContact']['create'](_[_0x689d('0xa')](_0x1af481['body'],{'firstName':_0x1af481[_0x689d('0x63')]['to'],'email':_0x1af481[_0x689d('0x63')]['to'],'phone':_0x1af481[_0x689d('0x63')]['to'],'ListId':_0x25ce52['ListId']}));})[_0x689d('0x13')](function(_0x2b1932){if(!_0x2b1932)return;var _0x3285fe={'UserId':_0x1af481[_0x689d('0x38')]['id'],'ContactId':_0x2b1932['id'],'MailAccountId':_0x25ce52['id'],'inReplyTo':_0x3cdc08[_0x689d('0xb3')],'to':_0x1af481[_0x689d('0x63')][_0x689d('0xaa')],'cc':_0x1af481[_0x689d('0x63')]['cc'],'subject':_0x1af481[_0x689d('0x63')]['subject'],'attach':_0x1af481['body'][_0x689d('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x689d('0xa1')),'lastMsgDirection':'out','Messages':[_[_0x689d('0x59')](_0x1af481[_0x689d('0x63')],{'messageId':_0x3cdc08[_0x689d('0xb3')],'sentAt':moment()[_0x689d('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x25ce52['id'],'UserId':_0x1af481[_0x689d('0x38')]['id'],'ContactId':_0x2b1932['id']})]};if(_0x1af481[_0x689d('0x63')][_0x689d('0xb6')]){_0x3285fe=_[_0x689d('0x59')](_0x3285fe,_0x1af481['body'][_0x689d('0xb6')]);}return db[_0x689d('0x86')][_0x689d('0x68')](_0x3285fe,{'include':[{'model':db['MailMessage'],'as':_0x689d('0xb7')}]});})[_0x689d('0x13')](respondWithResult(_0x45497a,null))['catch'](handleError(_0x45497a,null));};exports[_0x689d('0xb8')]=function(_0x46a960,_0x39c352){return db[_0x689d('0x47')]['find']({'where':{'id':_0x46a960[_0x689d('0x5d')]['id']},'include':[{'model':db[_0x689d('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x689d('0x13')](handleEntityNotFound(_0x39c352,null))[_0x689d('0x13')](function(_0x5edc47){if(!_0x5edc47[_0x689d('0x44')])return;var _0x8550af=_0x5edc47[_0x689d('0xaf')]();return respondWithRpcPromise('VerifySmtp',_0x689d('0xb8'),{'account':_0x8550af});})['then'](respondWithResult(_0x39c352,null))[_0x689d('0x1c')](handleError(_0x39c352,null));};exports[_0x689d('0x27')]=function(_0x2dda93,_0x461b4e){return db[_0x689d('0x47')][_0x689d('0x62')]({'where':{'id':_0x2dda93[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x461b4e,null))[_0x689d('0x13')](function(_0x5c569a){if(_0x5c569a&&_0x5c569a[_0x689d('0x40')]){throw new db[(_0x689d('0xb9'))][(_0x689d('0xba'))](_0x689d('0xbb'));}return _0x5c569a;})['then'](removeEntity(_0x461b4e,null))[_0x689d('0x1c')](handleError(_0x461b4e,null));};exports[_0x689d('0xbc')]=function(_0x40e8db,_0x4d92f5){return db['MailAccount']['find']({'where':{'id':_0x40e8db[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4d92f5,null))[_0x689d('0x13')](function(_0x32df76){if(_0x32df76){return _0x32df76[_0x689d('0xbc')](_0x40e8db[_0x689d('0x63')][_0x689d('0x71')],_[_0x689d('0x87')](_0x40e8db[_0x689d('0x63')],[_0x689d('0x71'),'id'])||{})[_0x689d('0xbd')](function(_0x3e29d3){for(var _0x8862bd=0x0;_0x8862bd<_0x40e8db['body'][_0x689d('0x71')][_0x689d('0x52')];_0x8862bd+=0x1){socket[_0x689d('0xbe')]('userMailAccount:save',{'UserId':Number(_0x40e8db[_0x689d('0x63')][_0x689d('0x71')][_0x8862bd]),'MailAccountId':Number(_0x40e8db[_0x689d('0x5d')]['id'])});}return _0x3e29d3;});}})[_0x689d('0x13')](respondWithResult(_0x4d92f5,null))[_0x689d('0x1c')](handleError(_0x4d92f5,null));};exports[_0x689d('0xbf')]=function(_0x1dc8d8,_0x53a205){return db[_0x689d('0x47')]['find']({'where':{'id':_0x1dc8d8[_0x689d('0x5d')]['id']}})[_0x689d('0x13')](handleEntityNotFound(_0x53a205,null))[_0x689d('0x13')](function(_0x5a1523){if(_0x5a1523){return _0x5a1523[_0x689d('0xbf')](_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')])['then'](function(){if(_[_0x689d('0xc0')](_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')])){for(var _0x219cf2=0x0;_0x219cf2<_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')]['length'];_0x219cf2+=0x1){socket[_0x689d('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x1dc8d8[_0x689d('0x4c')][_0x689d('0x71')][_0x219cf2]),'MailAccountId':Number(_0x1dc8d8[_0x689d('0x5d')]['id'])});}}else{socket[_0x689d('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x1dc8d8[_0x689d('0x4c')]['ids']),'MailAccountId':Number(_0x1dc8d8[_0x689d('0x5d')]['id'])});}});}})[_0x689d('0x13')](respondWithStatusCode(_0x53a205,null))[_0x689d('0x1c')](handleError(_0x53a205,null));};exports[_0x689d('0xc1')]=function(_0x35dc8f,_0x22aa09){var _0x17fb38={};var _0x18e807={};var _0x5dd723;var _0x299424;return db[_0x689d('0x47')][_0x689d('0x74')]({'where':{'id':_0x35dc8f[_0x689d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x22aa09,null))[_0x689d('0x13')](function(_0x155262){if(_0x155262){_0x5dd723=_0x155262;_0x18e807[_0x689d('0x4b')]=_[_0x689d('0x4d')](db[_0x689d('0x8b')]['rawAttributes']);_0x18e807['query']=_[_0x689d('0x4d')](_0x35dc8f[_0x689d('0x4c')]);_0x18e807[_0x689d('0x4e')]=_[_0x689d('0x4f')](_0x18e807[_0x689d('0x4b')],_0x18e807['query']);_0x17fb38['attributes']=_[_0x689d('0x4f')](_0x18e807[_0x689d('0x4b')],qs[_0x689d('0x51')](_0x35dc8f['query'][_0x689d('0x51')]));_0x17fb38['attributes']=_0x17fb38[_0x689d('0x50')][_0x689d('0x52')]?_0x17fb38[_0x689d('0x50')]:_0x18e807['model'];_0x17fb38[_0x689d('0x54')]=qs[_0x689d('0x55')](_0x35dc8f[_0x689d('0x4c')][_0x689d('0x55')]);_0x17fb38['where']=qs['filters'](_['pick'](_0x35dc8f[_0x689d('0x4c')],_0x18e807['filters']));if(_0x35dc8f['query'][_0x689d('0x58')]){_0x17fb38['where']=_[_0x689d('0x59')](_0x17fb38[_0x689d('0x56')],{'$or':_['map'](_0x17fb38['attributes'],function(_0x44f385){var _0x1369d7={};_0x1369d7[_0x44f385]={'$like':'%'+_0x35dc8f['query'][_0x689d('0x58')]+'%'};return _0x1369d7;})});}_0x17fb38=_[_0x689d('0x59')]({},_0x17fb38,_0x35dc8f[_0x689d('0x61')]);return _0x5dd723['getAgents'](_0x17fb38);}})[_0x689d('0x13')](function(_0x4300ac){if(_0x4300ac){_0x299424=_0x4300ac[_0x689d('0x52')];if(!_0x35dc8f['query'][_0x689d('0x6b')]('nolimit')){_0x17fb38[_0x689d('0x24')]=qs['limit'](_0x35dc8f['query'][_0x689d('0x24')]);_0x17fb38['offset']=qs[_0x689d('0x23')](_0x35dc8f[_0x689d('0x4c')][_0x689d('0x23')]);}return _0x5dd723['getAgents'](_0x17fb38);}})[_0x689d('0x13')](function(_0x37b504){if(_0x37b504){return _0x37b504?{'count':_0x299424,'rows':_0x37b504}:null;}})[_0x689d('0x13')](respondWithResult(_0x22aa09,null))[_0x689d('0x1c')](handleError(_0x22aa09,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b82ba64..4d77be2 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 _0x0eb2=['update','remove','emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners','save'];(function(_0x13d0dc,_0x43fcd9){var _0x95bb8f=function(_0x6734c2){while(--_0x6734c2){_0x13d0dc['push'](_0x13d0dc['shift']());}};_0x95bb8f(++_0x43fcd9);}(_0x0eb2,0x11c));var _0x20eb=function(_0x4cc860,_0xf7eea3){_0x4cc860=_0x4cc860-0x0;var _0x1d01ff=_0x0eb2[_0x4cc860];return _0x1d01ff;};'use strict';var EventEmitter=require(_0x20eb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x20eb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x20eb('0x2')](0x0);var events={'afterCreate':_0x20eb('0x3'),'afterUpdate':_0x20eb('0x4'),'afterDestroy':_0x20eb('0x5')};function emitEvent(_0x525ecf){return function(_0x118292,_0x59e891,_0x48d831){MailAccountEvents['emit'](_0x525ecf+':'+_0x118292['id'],_0x118292);MailAccountEvents[_0x20eb('0x6')](_0x525ecf,_0x118292);_0x48d831(null);};}for(var e in events){if(events[_0x20eb('0x7')](e)){var event=events[e];MailAccount[_0x20eb('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x302e=['exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0x302e,0x1eb));var _0xe302=function(_0x1b8061,_0x45685a){_0x1b8061=_0x1b8061-0x0;var _0x249437=_0x302e[_0x1b8061];return _0x249437;};'use strict';var EventEmitter=require(_0xe302('0x0'));var MailAccount=require(_0xe302('0x1'))['db'][_0xe302('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe302('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe302('0x4'),'afterDestroy':_0xe302('0x5')};function emitEvent(_0x3e965){return function(_0x5151d8,_0x321c8a,_0x1647a7){MailAccountEvents['emit'](_0x3e965+':'+_0x5151d8['id'],_0x5151d8);MailAccountEvents[_0xe302('0x6')](_0x3e965,_0x5151d8);_0x1647a7(null);};}for(var e in events){if(events[_0xe302('0x7')](e)){var event=events[e];MailAccount[_0xe302('0x8')](e,emitEvent(event));}}module[_0xe302('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3bc8027..a680e9a 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 _0x8f24=['data5','pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom','service','host','Smtp','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user'];(function(_0x206e87,_0x25273d){var _0x25cc8d=function(_0x45601c){while(--_0x45601c){_0x206e87['push'](_0x206e87['shift']());}};_0x25cc8d(++_0x25273d);}(_0x8f24,0x68));var _0x48f2=function(_0x29068e,_0x599ac0){_0x29068e=_0x29068e-0x0;var _0x1cda11=_0x8f24[_0x29068e];return _0x1cda11;};'use strict';var attributes=require(_0x48f2('0x0'));module[_0x48f2('0x1')]=function(_0x488c27){return _0x488c27[_0x48f2('0x2')](_0x48f2('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x523be5=this;var _0x4ae0b3={'id':_0x523be5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x523be5[_0x48f2('0x4')]!==_0x48f2('0x5')){_0x4ae0b3[_0x48f2('0x6')]=_0x523be5[_0x48f2('0x4')];}else{_0x4ae0b3[_0x48f2('0x7')]=_0x523be5[_0x48f2('0x8')][_0x48f2('0x7')];_0x4ae0b3[_0x48f2('0x9')]=_0x523be5['Smtp'][_0x48f2('0x9')];_0x4ae0b3[_0x48f2('0xa')]=_0x523be5['Smtp'][_0x48f2('0xa')];}if(_0x523be5['Smtp'][_0x48f2('0xb')]){if(_0x523be5[_0x48f2('0x8')]['modernAuthentication']){if(!_0x523be5['Smtp']['CloudProvider'])throw new Error(_0x48f2('0xc'));_0x4ae0b3['auth']={'type':_0x48f2('0xd'),'user':_0x523be5[_0x48f2('0x8')][_0x48f2('0xe')],'accessToken':_0x523be5[_0x48f2('0x8')]['CloudProvider'][_0x48f2('0xf')]};}else{_0x4ae0b3['auth']={'user':_0x523be5[_0x48f2('0x8')]['user'],'pass':_0x523be5[_0x48f2('0x8')][_0x48f2('0x10')]};}}return _0x4ae0b3;}}});}; \ No newline at end of file +var _0xa121=['modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','provider','service','host','Smtp','port','secure','authentication'];(function(_0xc8e9ec,_0x2e8176){var _0x457706=function(_0x3684e9){while(--_0x3684e9){_0xc8e9ec['push'](_0xc8e9ec['shift']());}};_0x457706(++_0x2e8176);}(_0xa121,0xb3));var _0x1a12=function(_0x25198d,_0x5e2bce){_0x25198d=_0x25198d-0x0;var _0x273fd2=_0xa121[_0x25198d];return _0x273fd2;};'use strict';var attributes=require(_0x1a12('0x0'));module[_0x1a12('0x1')]=function(_0x3d1af6){return _0x3d1af6[_0x1a12('0x2')](_0x1a12('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58ffa1=this;var _0x559ebb={'id':_0x58ffa1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58ffa1[_0x1a12('0x4')]!=='custom'){_0x559ebb[_0x1a12('0x5')]=_0x58ffa1[_0x1a12('0x4')];}else{_0x559ebb[_0x1a12('0x6')]=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x6')];_0x559ebb['port']=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x8')];_0x559ebb[_0x1a12('0x9')]=_0x58ffa1[_0x1a12('0x7')][_0x1a12('0x9')];}if(_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xa')]){if(_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xb')]){if(!_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xc')])throw new Error(_0x1a12('0xd'));_0x559ebb['auth']={'type':_0x1a12('0xe'),'user':_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xf')],'accessToken':_0x58ffa1[_0x1a12('0x7')]['CloudProvider'][_0x1a12('0x10')]};}else{_0x559ebb[_0x1a12('0x11')]={'user':_0x58ffa1[_0x1a12('0x7')][_0x1a12('0xf')],'pass':_0x58ffa1['Smtp'][_0x1a12('0x12')]};}}return _0x559ebb;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 34bfedd..e4fe778 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 _0xabce=['Smtp','CloudProvider','get','omit','smtpOptions','getSmtpOptions','list','applications','asc','autoclose','push','length','close','defaults','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','originTo','originCc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','map','include','model','ShowMailAccount','find','where','smtp','NotifyMailAccount','body','difference','keys','rawAttributes','updatedAt','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','CmContact','Contacts','MailApplication','Applications','MailServerOut'];(function(_0x15f5dd,_0x517df5){var _0x40b3d1=function(_0x1f29fe){while(--_0x1f29fe){_0x15f5dd['push'](_0x15f5dd['shift']());}};_0x40b3d1(++_0x517df5);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var BPromise=require(_0xeabc('0x2'));var rs=require(_0xeabc('0x3'));var Redis=require(_0xeabc('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var jayson=require(_0xeabc('0x7'));var client=jayson['client']['http']({'port':0x232c});config[_0xeabc('0x8')]=_['defaults'](config[_0xeabc('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x9'))(new Redis(config[_0xeabc('0x8')]));require(_0xeabc('0xa'))['register'](socket);function respondWithRpcPromise(_0x438ccf,_0x341f16,_0x2f73e9){return new BPromise(function(_0x1b4d1b,_0x4301e4){return client[_0xeabc('0xb')](_0x438ccf,_0x2f73e9)[_0xeabc('0xc')](function(_0x28292c){logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x341f16,_0xeabc('0xf'));logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x341f16,_0xeabc('0xf'),JSON[_0xeabc('0x12')](_0x28292c));if(_0x28292c[_0xeabc('0x13')]){if(_0x28292c['error'][_0xeabc('0x14')]===0x1f4){logger[_0xeabc('0x13')](_0xeabc('0xe'),_0x341f16,_0x28292c['error']['message']);return _0x4301e4(_0x28292c[_0xeabc('0x13')][_0xeabc('0x15')]);}logger[_0xeabc('0x13')]('MailAccount,\x20%s,\x20%s',_0x341f16,_0x28292c[_0xeabc('0x13')][_0xeabc('0x15')]);return _0x1b4d1b(_0x28292c['error']['message']);}else{logger[_0xeabc('0xd')]('MailAccount,\x20%s,\x20%s',_0x341f16,_0xeabc('0xf'));_0x1b4d1b(_0x28292c[_0xeabc('0x16')][_0xeabc('0x15')]);}})[_0xeabc('0x17')](function(_0x31dd53){logger[_0xeabc('0x13')](_0xeabc('0xe'),_0x341f16,_0x31dd53);_0x4301e4(_0x31dd53);});});}exports[_0xeabc('0x18')]=function(_0x5d92e5){var _0x1253e4=this;return new Promise(function(_0x4d68ea,_0x31201a){return db[_0xeabc('0x19')]['findAll']({'raw':_0x5d92e5[_0xeabc('0x1a')]?_0x5d92e5[_0xeabc('0x1a')][_0xeabc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d92e5[_0xeabc('0x1a')]?_0x5d92e5[_0xeabc('0x1a')]['where']||null:null,'attributes':_0x5d92e5[_0xeabc('0x1a')]?_0x5d92e5[_0xeabc('0x1a')][_0xeabc('0x1c')]||null:null,'limit':_0x5d92e5['options']?_0x5d92e5[_0xeabc('0x1a')][_0xeabc('0x1d')]||null:null,'include':_0x5d92e5[_0xeabc('0x1a')]?_0x5d92e5[_0xeabc('0x1a')]['include']?_[_0xeabc('0x1e')](_0x5d92e5['options'][_0xeabc('0x1f')],function(_0x4d4e29){return{'model':db[_0x4d4e29[_0xeabc('0x20')]],'as':_0x4d4e29['as'],'attributes':_0x4d4e29[_0xeabc('0x1c')],'include':_0x4d4e29[_0xeabc('0x1f')]?_[_0xeabc('0x1e')](_0x4d4e29[_0xeabc('0x1f')],function(_0x137293){return{'model':db[_0x137293[_0xeabc('0x20')]],'as':_0x137293['as'],'attributes':_0x137293['attributes'],'include':_0x137293['include']?_[_0xeabc('0x1e')](_0x137293['include'],function(_0x3c1b5b){return{'model':db[_0x3c1b5b[_0xeabc('0x20')]],'as':_0x3c1b5b['as'],'attributes':_0x3c1b5b['attributes']};}):[]};}):[]};}):[]:[]})[_0xeabc('0xc')](function(_0x38572d){logger[_0xeabc('0xd')](_0xeabc('0x18'),_0x5d92e5);logger[_0xeabc('0x10')](_0xeabc('0x18'),_0x5d92e5,JSON[_0xeabc('0x12')](_0x38572d));_0x4d68ea(_0x38572d);})[_0xeabc('0x17')](function(_0x2915c1){logger['error'](_0xeabc('0x18'),_0x2915c1['message'],_0x5d92e5);_0x31201a(_0x1253e4[_0xeabc('0x13')](0x1f4,_0x2915c1[_0xeabc('0x15')]));});});};exports[_0xeabc('0x21')]=function(_0x3c606a){var _0x73c8d4=this;return new Promise(function(_0x368b8a,_0x61c0af){return db['MailAccount'][_0xeabc('0x22')]({'raw':_0x3c606a[_0xeabc('0x1a')]?_0x3c606a[_0xeabc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3c606a[_0xeabc('0x1a')]?_0x3c606a[_0xeabc('0x1a')][_0xeabc('0x23')]||null:null,'attributes':_0x3c606a['options']?_0x3c606a[_0xeabc('0x1a')][_0xeabc('0x1c')]||null:null,'include':_0x3c606a[_0xeabc('0x1a')]?_0x3c606a['options'][_0xeabc('0x1f')]?_[_0xeabc('0x1e')](_0x3c606a['options']['include'],function(_0x254568){return{'model':db[_0x254568[_0xeabc('0x20')]],'as':_0x254568['as'],'attributes':_0x254568['attributes'],'include':_0x254568[_0xeabc('0x1f')]?_[_0xeabc('0x1e')](_0x254568[_0xeabc('0x1f')],function(_0x10434e){return{'model':db[_0x10434e[_0xeabc('0x20')]],'as':_0x10434e['as'],'attributes':_0x10434e['attributes'],'include':_0x10434e[_0xeabc('0x1f')]?_['map'](_0x10434e[_0xeabc('0x1f')],function(_0x2bda29){return{'model':db[_0x2bda29[_0xeabc('0x20')]],'as':_0x2bda29['as'],'attributes':_0x2bda29['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x452580){if(_0x3c606a['options'][_0xeabc('0x24')]===!![])_0x452580['setDataValue']('smtpOptions',_0x452580['getSmtpOptions']());logger['info'](_0xeabc('0x21'),_0x3c606a);logger['debug'](_0xeabc('0x21'),_0x3c606a,JSON[_0xeabc('0x12')](_0x452580));_0x368b8a(_0x452580);})['catch'](function(_0xe8fa6e){logger['error'](_0xeabc('0x21'),_0xe8fa6e['message'],_0x3c606a);_0x61c0af(_0x73c8d4[_0xeabc('0x13')](0x1f4,_0xe8fa6e[_0xeabc('0x15')]));});});};exports[_0xeabc('0x25')]=function(_0x5d8ae4){var _0x5a00d0=this;return new Promise(function(_0x54a3ae,_0x46056c){var _0x23fb33={'body':_0x5d8ae4[_0xeabc('0x26')],'channel':'mail'};var _0x4f1897=_[_0xeabc('0x27')](_[_0xeabc('0x28')](db['CmContact'][_0xeabc('0x29')]),['createdAt',_0xeabc('0x2a'),'CompanyId','ListId']);var _0x5cd04d=![];if(_0x5d8ae4[_0xeabc('0x26')]['id']){delete _0x5d8ae4[_0xeabc('0x26')]['id'];}if(_[_0xeabc('0x2b')](_0x5d8ae4[_0xeabc('0x26')]['from'])){return _0x46056c(_0x5a00d0[_0xeabc('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xeabc('0x2b')](_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x26')])||_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x26')]===''){return _0x46056c(_0x5a00d0['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xeabc('0x2b')](_0x5d8ae4['body'][_0xeabc('0x2c')])){return _0x46056c(_0x5a00d0[_0xeabc('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f1897));}if(!_[_0xeabc('0x2d')](_0x4f1897,_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x2c')])){return _0x46056c(_0x5a00d0[_0xeabc('0x13')](0x1f4,_0xeabc('0x2e')+_0x4f1897));}var _0xcaa5b9={};_0xcaa5b9[_0x5d8ae4[_0xeabc('0x26')]['mapKey']]=_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x2f')];return db[_0xeabc('0x19')][_0xeabc('0x22')]({'where':{'id':_0x5d8ae4[_0xeabc('0x30')]['id']},'include':[{'model':db[_0xeabc('0x31')],'as':_0xeabc('0x32'),'include':[{'model':db[_0xeabc('0x33')],'as':_0xeabc('0x34'),'where':_0xcaa5b9,'limit':0x1,'order':[[_0xeabc('0x2a'),'DESC']]}]},{'model':db[_0xeabc('0x35')],'as':_0xeabc('0x36')},{'model':db[_0xeabc('0x37')],'as':_0xeabc('0x38'),'include':[{'model':db[_0xeabc('0x39')],'as':_0xeabc('0x39')}]}]})[_0xeabc('0xc')](function(_0x48df43){if(_0x48df43&&_0x48df43[_0xeabc('0x32')]){var _0x32e09b=_0x48df43[_0xeabc('0x3a')]({'plain':!![]});_0x23fb33[_0xeabc('0x30')]=_[_0xeabc('0x3b')](_0x32e09b,['Applications',_0xeabc('0x32')]);_0x23fb33[_0xeabc('0x30')][_0xeabc('0x3c')]=_0x48df43[_0xeabc('0x3d')]();_0x23fb33['applications']=_0x32e09b[_0xeabc('0x36')];_0x23fb33[_0xeabc('0x3e')]=_0x32e09b['List'];_0x23fb33[_0xeabc('0x3f')]=_['orderBy'](_0x23fb33[_0xeabc('0x3f')],['priority'],[_0xeabc('0x40')]);if(_0x23fb33[_0xeabc('0x30')]&&_0x23fb33[_0xeabc('0x30')][_0xeabc('0x41')]){_0x23fb33[_0xeabc('0x3f')][_0xeabc('0x42')]({'id':0x0,'priority':_0x23fb33[_0xeabc('0x3f')][_0xeabc('0x43')]+0x1,'app':_0xeabc('0x44'),'appdata':_0xeabc('0x41'),'interval':'*,*,*,*'});}if(_0x23fb33[_0xeabc('0x30')][_0xeabc('0x36')]){delete _0x23fb33[_0xeabc('0x30')][_0xeabc('0x36')];}if(_0x23fb33['account'][_0xeabc('0x32')]){delete _0x23fb33[_0xeabc('0x30')][_0xeabc('0x32')];}if(_0x32e09b[_0xeabc('0x32')]['Contacts'][_0xeabc('0x43')]){return _0x32e09b[_0xeabc('0x32')][_0xeabc('0x34')][0x0];}var _0xa55cce=_[_0xeabc('0x45')](_0x5d8ae4[_0xeabc('0x26')],{'firstName':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x2f')],'ListId':_0x32e09b[_0xeabc('0x46')]});_0xa55cce[_0x5d8ae4['body'][_0xeabc('0x2c')]]=_0x5d8ae4['body']['from'];return db['CmContact'][_0xeabc('0x47')](_0xa55cce);}else{throw new Error(_0xeabc('0x48'));}})[_0xeabc('0xc')](function(_0xb35103){_0x23fb33[_0xeabc('0x49')]=_0xb35103;if(_0xb35103){if(!_0x5d8ae4[_0xeabc('0x26')]['message'][_0xeabc('0x4a')]){_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x4a')]=rs[_0xeabc('0x4b')]()+'\x20'+_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x2f')];}var _0x5820ca={'ContactId':_0xb35103['id'],'MailAccountId':_0x5d8ae4['account']['id'],'inReplyTo':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x4a')],'to':_0x5d8ae4['body'][_0xeabc('0x15')]['from'],'cc':_0x5d8ae4['body'][_0xeabc('0x15')]['cc'],'subject':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x4c')],'attach':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')]['attach'],'lastMsgAt':moment()[_0xeabc('0x4d')](_0xeabc('0x4e')),'lastMsgDirection':'in'};return db[_0xeabc('0x4f')][_0xeabc('0x22')]({'where':{'closed':![],'MailAccountId':_0x5d8ae4[_0xeabc('0x30')]['id']},'include':[{'model':db[_0xeabc('0x50')],'as':'Messages','attributes':[_0xeabc('0x4a')],'where':{'messageId':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x51')]}}]})[_0xeabc('0xc')](function(_0x19faa4){if(_0x19faa4){return[_0x19faa4,![]];}return db[_0xeabc('0x4f')][_0xeabc('0x47')](_0x5820ca)[_0xeabc('0xc')](function(_0x54d2b3){return[_0x54d2b3,!![]];});});}else{throw new Error(_0xeabc('0x52'));}})['spread'](function(_0x404846,_0x2c389d){if(_0x404846){_0x5cd04d=_0x2c389d;if(!_0x2c389d){return _0x404846[_0xeabc('0x53')]({'inReplyTo':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x4a')],'to':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x2f')],'cc':_0x5d8ae4[_0xeabc('0x26')]['message']['cc'],'subject':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x4c')],'attach':_0x404846[_0xeabc('0x54')]?_0x404846['attach']:_0x5d8ae4[_0xeabc('0x26')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0xeabc('0x4d')](_0xeabc('0x4e')),'lastMsgAt':moment()[_0xeabc('0x4d')](_0xeabc('0x4e')),'lastMsgDirection':'in'});}else{return _0x404846;}}})['then'](function(_0x51a0c7){_0x23fb33[_0xeabc('0x55')]=_0x51a0c7['get']({'plain':!![]});_0x23fb33['interaction'][_0xeabc('0x56')]=_0x5cd04d;return db['MailMessage']['create']({'body':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x26')],'MailAccountId':_0x5d8ae4['account']['id'],'MailInteractionId':_0x51a0c7['id'],'direction':'in','ContactId':_0x23fb33['contact']['id'],'messageId':_0x5d8ae4[_0xeabc('0x26')]['message'][_0xeabc('0x4a')],'from':_0x5d8ae4[_0xeabc('0x26')]['message']['from'],'to':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')]['to'],'cc':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')]['cc'],'subject':_0x5d8ae4[_0xeabc('0x26')]['message']['subject'],'attach':_0x5d8ae4[_0xeabc('0x26')]['message'][_0xeabc('0x54')],'Attachments':_0x5d8ae4['body'][_0xeabc('0x15')]['attachments'],'originTo':_0x5d8ae4[_0xeabc('0x26')]['message'][_0xeabc('0x57')],'originCc':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x58')],'bcc':_0x5d8ae4['body'][_0xeabc('0x15')]['bcc'],'ChatWebsiteId':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x59')]||null,'originChannel':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')]['originChannel']||_0xeabc('0x5a'),'ChatOfflineMessageId':_0x5d8ae4[_0xeabc('0x26')][_0xeabc('0x15')][_0xeabc('0x5b')]||null},{'include':[{'model':db['Attachment'],'as':_0xeabc('0x5c')}]});})[_0xeabc('0xc')](function(_0xe60b11){_0x23fb33[_0xeabc('0x15')]=_0xe60b11;if(!_0x23fb33['interaction'][_0xeabc('0x5d')]){return;}return db[_0xeabc('0x5e')][_0xeabc('0x22')]({'attributes':['id',_0xeabc('0x5f')],'where':{'id':_0x23fb33['interaction']['UserId']}});})[_0xeabc('0xc')](function(_0x4f406b){if(_0x4f406b){_0x23fb33['applications'][_0xeabc('0x60')]({'id':0x0,'priority':0x0,'app':_0xeabc('0x61'),'appdata':_0x4f406b[_0xeabc('0x5f')]+','+(_0x23fb33['account'][_0xeabc('0x62')]||0xa),'interval':_0xeabc('0x63')});}if(!_0x23fb33['interaction'][_0xeabc('0x64')]){return;}return db[_0xeabc('0x65')][_0xeabc('0x22')]({'attributes':['id',_0xeabc('0x5f')],'where':{'id':_0x23fb33[_0xeabc('0x55')]['queueId']}});})[_0xeabc('0xc')](function(_0x523496){if(_0x523496){_0x23fb33['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xeabc('0x66'),'appdata':_0x523496[_0xeabc('0x5f')]+','+(_0x23fb33[_0xeabc('0x30')][_0xeabc('0x67')]||0x12c),'interval':_0xeabc('0x63')});}return respondWithRpcPromise('Start',_0xeabc('0x68'),_0x23fb33);})['then'](function(_0x1795fe){_0x54a3ae(_0x1795fe);})[_0xeabc('0x17')](function(_0x4dac49){_0x46056c(_0x5a00d0[_0xeabc('0x13')](0x1f4,_0x4dac49['message']));});});}; \ No newline at end of file +var _0x3831=['Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetMailAccount','stringify','catch','ShowMailAccount','smtp','smtpOptions','NotifyMailAccount','mail','rawAttributes','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','List','CmContact','Contacts','DESC','Applications','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','close','length','defaults','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','interaction','created','contact','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','*,*,*,*','MailQueue','queueId','queue','waitForTheAssignedQueue'];(function(_0x3d4f05,_0x3a1e88){var _0x227017=function(_0x56b6f8){while(--_0x56b6f8){_0x3d4f05['push'](_0x3d4f05['shift']());}};_0x227017(++_0x3a1e88);}(_0x3831,0x14c));var _0x1383=function(_0x4c1c6a,_0x4c1ef5){_0x4c1c6a=_0x4c1c6a-0x0;var _0x59a9df=_0x3831[_0x4c1c6a];return _0x59a9df;};'use strict';var _=require(_0x1383('0x0'));var moment=require('moment');var BPromise=require(_0x1383('0x1'));var rs=require(_0x1383('0x2'));var Redis=require(_0x1383('0x3'));var db=require(_0x1383('0x4'))['db'];var logger=require(_0x1383('0x5'))('rpc');var config=require(_0x1383('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1383('0x7')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x1383('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1383('0x9'))(new Redis(config[_0x1383('0x8')]));require(_0x1383('0xa'))[_0x1383('0xb')](socket);function respondWithRpcPromise(_0xd6be3b,_0x7cb670,_0x3ca0e6){return new BPromise(function(_0xe0ee2f,_0x47ba84){return client[_0x1383('0xc')](_0xd6be3b,_0x3ca0e6)[_0x1383('0xd')](function(_0x627ec3){logger[_0x1383('0xe')](_0x1383('0xf'),_0x7cb670,'request\x20sent');logger[_0x1383('0x10')](_0x1383('0x11'),_0x7cb670,_0x1383('0x12'),JSON['stringify'](_0x627ec3));if(_0x627ec3['error']){if(_0x627ec3[_0x1383('0x13')][_0x1383('0x14')]===0x1f4){logger[_0x1383('0x13')](_0x1383('0xf'),_0x7cb670,_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);return _0x47ba84(_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);}logger['error'](_0x1383('0xf'),_0x7cb670,_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);return _0xe0ee2f(_0x627ec3[_0x1383('0x13')][_0x1383('0x15')]);}else{logger[_0x1383('0xe')](_0x1383('0xf'),_0x7cb670,'request\x20sent');_0xe0ee2f(_0x627ec3['result'][_0x1383('0x15')]);}})['catch'](function(_0x236b29){logger['error']('MailAccount,\x20%s,\x20%s',_0x7cb670,_0x236b29);_0x47ba84(_0x236b29);});});}exports['GetMailAccount']=function(_0x1c8fe7){var _0x598d09=this;return new Promise(function(_0x2aa3b6,_0x57a840){return db[_0x1383('0x16')][_0x1383('0x17')]({'raw':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x19')]===undefined?!![]:![]:!![],'where':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1a')]||null:null,'attributes':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7['options'][_0x1383('0x1b')]||null:null,'limit':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1c')]||null:null,'include':_0x1c8fe7[_0x1383('0x18')]?_0x1c8fe7[_0x1383('0x18')][_0x1383('0x1d')]?_['map'](_0x1c8fe7['options'][_0x1383('0x1d')],function(_0x160497){return{'model':db[_0x160497[_0x1383('0x1e')]],'as':_0x160497['as'],'attributes':_0x160497[_0x1383('0x1b')],'include':_0x160497[_0x1383('0x1d')]?_['map'](_0x160497['include'],function(_0x4a8b6e){return{'model':db[_0x4a8b6e[_0x1383('0x1e')]],'as':_0x4a8b6e['as'],'attributes':_0x4a8b6e[_0x1383('0x1b')],'include':_0x4a8b6e[_0x1383('0x1d')]?_[_0x1383('0x1f')](_0x4a8b6e['include'],function(_0x1f7688){return{'model':db[_0x1f7688['model']],'as':_0x1f7688['as'],'attributes':_0x1f7688[_0x1383('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1383('0xd')](function(_0x42d63f){logger[_0x1383('0xe')](_0x1383('0x20'),_0x1c8fe7);logger[_0x1383('0x10')](_0x1383('0x20'),_0x1c8fe7,JSON[_0x1383('0x21')](_0x42d63f));_0x2aa3b6(_0x42d63f);})[_0x1383('0x22')](function(_0x29ca05){logger[_0x1383('0x13')](_0x1383('0x20'),_0x29ca05[_0x1383('0x15')],_0x1c8fe7);_0x57a840(_0x598d09[_0x1383('0x13')](0x1f4,_0x29ca05['message']));});});};exports[_0x1383('0x23')]=function(_0xadfc34){var _0xb8d058=this;return new Promise(function(_0x343f22,_0x64c8ce){return db[_0x1383('0x16')]['find']({'raw':_0xadfc34[_0x1383('0x18')]?_0xadfc34[_0x1383('0x18')][_0x1383('0x19')]===undefined?!![]:![]:!![],'where':_0xadfc34[_0x1383('0x18')]?_0xadfc34[_0x1383('0x18')][_0x1383('0x1a')]||null:null,'attributes':_0xadfc34['options']?_0xadfc34[_0x1383('0x18')]['attributes']||null:null,'include':_0xadfc34['options']?_0xadfc34[_0x1383('0x18')][_0x1383('0x1d')]?_[_0x1383('0x1f')](_0xadfc34['options']['include'],function(_0x5bca56){return{'model':db[_0x5bca56[_0x1383('0x1e')]],'as':_0x5bca56['as'],'attributes':_0x5bca56[_0x1383('0x1b')],'include':_0x5bca56[_0x1383('0x1d')]?_['map'](_0x5bca56['include'],function(_0x3ab8fe){return{'model':db[_0x3ab8fe[_0x1383('0x1e')]],'as':_0x3ab8fe['as'],'attributes':_0x3ab8fe[_0x1383('0x1b')],'include':_0x3ab8fe[_0x1383('0x1d')]?_['map'](_0x3ab8fe['include'],function(_0x2eea78){return{'model':db[_0x2eea78[_0x1383('0x1e')]],'as':_0x2eea78['as'],'attributes':_0x2eea78[_0x1383('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1383('0xd')](function(_0x2afb4a){if(_0xadfc34[_0x1383('0x18')][_0x1383('0x24')]===!![])_0x2afb4a['setDataValue'](_0x1383('0x25'),_0x2afb4a['getSmtpOptions']());logger[_0x1383('0xe')](_0x1383('0x23'),_0xadfc34);logger[_0x1383('0x10')]('ShowMailAccount',_0xadfc34,JSON[_0x1383('0x21')](_0x2afb4a));_0x343f22(_0x2afb4a);})['catch'](function(_0x592633){logger[_0x1383('0x13')](_0x1383('0x23'),_0x592633[_0x1383('0x15')],_0xadfc34);_0x64c8ce(_0xb8d058['error'](0x1f4,_0x592633[_0x1383('0x15')]));});});};exports[_0x1383('0x26')]=function(_0x11ada6){var _0x3d6122=this;return new Promise(function(_0x56c269,_0x1ea73e){var _0x4c465e={'body':_0x11ada6['body'],'channel':_0x1383('0x27')};var _0x2f61fb=_['difference'](_['keys'](db['CmContact'][_0x1383('0x28')]),[_0x1383('0x29'),_0x1383('0x2a'),_0x1383('0x2b'),_0x1383('0x2c')]);var _0x3e737a=![];if(_0x11ada6[_0x1383('0x2d')]['id']){delete _0x11ada6[_0x1383('0x2d')]['id'];}if(_[_0x1383('0x2e')](_0x11ada6['body'][_0x1383('0x2f')])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x30')));}if(_['isNil'](_0x11ada6[_0x1383('0x2d')]['body'])||_0x11ada6[_0x1383('0x2d')][_0x1383('0x2d')]===''){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x31')));}if(_[_0x1383('0x2e')](_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x33')+_0x2f61fb));}if(!_['includes'](_0x2f61fb,_0x11ada6['body']['mapKey'])){return _0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x1383('0x34')+_0x2f61fb));}var _0x3a8f5f={};_0x3a8f5f[_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')]]=_0x11ada6[_0x1383('0x2d')]['from'];return db[_0x1383('0x16')][_0x1383('0x35')]({'where':{'id':_0x11ada6[_0x1383('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x1383('0x37'),'include':[{'model':db[_0x1383('0x38')],'as':_0x1383('0x39'),'where':_0x3a8f5f,'limit':0x1,'order':[[_0x1383('0x2a'),_0x1383('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x1383('0x3b')},{'model':db['MailServerOut'],'as':_0x1383('0x3c'),'include':[{'model':db[_0x1383('0x3d')],'as':'CloudProvider'}]}]})[_0x1383('0xd')](function(_0x2e41c3){if(_0x2e41c3&&_0x2e41c3[_0x1383('0x37')]){var _0x1a2836=_0x2e41c3[_0x1383('0x3e')]({'plain':!![]});_0x4c465e[_0x1383('0x36')]=_[_0x1383('0x3f')](_0x1a2836,[_0x1383('0x3b'),_0x1383('0x37')]);_0x4c465e[_0x1383('0x36')]['smtpOptions']=_0x2e41c3[_0x1383('0x40')]();_0x4c465e[_0x1383('0x41')]=_0x1a2836[_0x1383('0x3b')];_0x4c465e[_0x1383('0x42')]=_0x1a2836[_0x1383('0x37')];_0x4c465e[_0x1383('0x41')]=_[_0x1383('0x43')](_0x4c465e[_0x1383('0x41')],[_0x1383('0x44')],['asc']);if(_0x4c465e[_0x1383('0x36')]&&_0x4c465e[_0x1383('0x36')][_0x1383('0x45')]){_0x4c465e['applications'][_0x1383('0x46')]({'id':0x0,'priority':_0x4c465e[_0x1383('0x41')]['length']+0x1,'app':_0x1383('0x47'),'appdata':_0x1383('0x45'),'interval':'*,*,*,*'});}if(_0x4c465e['account'][_0x1383('0x3b')]){delete _0x4c465e[_0x1383('0x36')][_0x1383('0x3b')];}if(_0x4c465e['account'][_0x1383('0x37')]){delete _0x4c465e[_0x1383('0x36')]['List'];}if(_0x1a2836[_0x1383('0x37')]['Contacts'][_0x1383('0x48')]){return _0x1a2836[_0x1383('0x37')][_0x1383('0x39')][0x0];}var _0x2bfcdd=_[_0x1383('0x49')](_0x11ada6[_0x1383('0x2d')],{'firstName':_0x11ada6[_0x1383('0x2d')][_0x1383('0x2f')],'ListId':_0x1a2836[_0x1383('0x2c')]});_0x2bfcdd[_0x11ada6[_0x1383('0x2d')][_0x1383('0x32')]]=_0x11ada6[_0x1383('0x2d')][_0x1383('0x2f')];return db[_0x1383('0x38')][_0x1383('0x4a')](_0x2bfcdd);}else{throw new Error(_0x1383('0x4b'));}})[_0x1383('0xd')](function(_0x3bd569){_0x4c465e['contact']=_0x3bd569;if(_0x3bd569){if(!_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')]){_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')]=rs[_0x1383('0x4d')]()+'\x20'+_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x2f')];}var _0x3ff9bc={'ContactId':_0x3bd569['id'],'MailAccountId':_0x11ada6[_0x1383('0x36')]['id'],'inReplyTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['messageId'],'to':_0x11ada6[_0x1383('0x2d')]['message'][_0x1383('0x2f')],'cc':_0x11ada6[_0x1383('0x2d')]['message']['cc'],'subject':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4e')],'attach':_0x11ada6[_0x1383('0x2d')]['message']['attach'],'lastMsgAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgDirection':'in'};return db[_0x1383('0x51')][_0x1383('0x35')]({'where':{'closed':![],'MailAccountId':_0x11ada6['account']['id']},'include':[{'model':db[_0x1383('0x52')],'as':_0x1383('0x53'),'attributes':[_0x1383('0x4c')],'where':{'messageId':_0x11ada6['body'][_0x1383('0x15')]['inReplyTo']}}]})[_0x1383('0xd')](function(_0x4ae832){if(_0x4ae832){return[_0x4ae832,![]];}return db[_0x1383('0x51')][_0x1383('0x4a')](_0x3ff9bc)[_0x1383('0xd')](function(_0x1cd59b){return[_0x1cd59b,!![]];});});}else{throw new Error(_0x1383('0x54'));}})[_0x1383('0x55')](function(_0x15a08e,_0x1bce05){if(_0x15a08e){_0x3e737a=_0x1bce05;if(!_0x1bce05){return _0x15a08e[_0x1383('0x56')]({'inReplyTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x4c')],'to':_0x11ada6[_0x1383('0x2d')]['message'][_0x1383('0x2f')],'cc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['cc'],'subject':_0x11ada6[_0x1383('0x2d')]['message']['subject'],'attach':_0x15a08e[_0x1383('0x57')]?_0x15a08e[_0x1383('0x57')]:_0x11ada6['body']['message'][_0x1383('0x57')],'substatus':null,'substatusAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgAt':moment()[_0x1383('0x4f')](_0x1383('0x50')),'lastMsgDirection':'in'});}else{return _0x15a08e;}}})['then'](function(_0x3fcc3f){_0x4c465e[_0x1383('0x58')]=_0x3fcc3f[_0x1383('0x3e')]({'plain':!![]});_0x4c465e[_0x1383('0x58')][_0x1383('0x59')]=_0x3e737a;return db[_0x1383('0x52')][_0x1383('0x4a')]({'body':_0x11ada6['body'][_0x1383('0x2d')],'MailAccountId':_0x11ada6['account']['id'],'MailInteractionId':_0x3fcc3f['id'],'direction':'in','ContactId':_0x4c465e[_0x1383('0x5a')]['id'],'messageId':_0x11ada6['body'][_0x1383('0x15')]['messageId'],'from':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x2f')],'to':_0x11ada6['body'][_0x1383('0x15')]['to'],'cc':_0x11ada6['body'][_0x1383('0x15')]['cc'],'subject':_0x11ada6['body'][_0x1383('0x15')]['subject'],'attach':_0x11ada6['body'][_0x1383('0x15')][_0x1383('0x57')],'Attachments':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5b')],'originTo':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5c')],'originCc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5d')],'bcc':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')]['bcc'],'ChatWebsiteId':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5e')]||null,'originChannel':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x5f')]||_0x1383('0x60'),'ChatOfflineMessageId':_0x11ada6[_0x1383('0x2d')][_0x1383('0x15')][_0x1383('0x61')]||null},{'include':[{'model':db[_0x1383('0x62')],'as':_0x1383('0x63')}]});})[_0x1383('0xd')](function(_0x4b803d){_0x4c465e[_0x1383('0x15')]=_0x4b803d;if(!_0x4c465e['interaction'][_0x1383('0x64')]){return;}return db['User']['find']({'attributes':['id',_0x1383('0x65')],'where':{'id':_0x4c465e[_0x1383('0x58')]['UserId']}});})['then'](function(_0x817877){if(_0x817877){_0x4c465e[_0x1383('0x41')][_0x1383('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x817877[_0x1383('0x65')]+','+(_0x4c465e[_0x1383('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x1383('0x67')});}if(!_0x4c465e[_0x1383('0x58')]['queueId']){return;}return db[_0x1383('0x68')][_0x1383('0x35')]({'attributes':['id',_0x1383('0x65')],'where':{'id':_0x4c465e[_0x1383('0x58')][_0x1383('0x69')]}});})[_0x1383('0xd')](function(_0x452dc9){if(_0x452dc9){_0x4c465e['applications'][_0x1383('0x66')]({'id':0x0,'priority':0x1,'app':_0x1383('0x6a'),'appdata':_0x452dc9['name']+','+(_0x4c465e['account'][_0x1383('0x6b')]||0x12c),'interval':_0x1383('0x67')});}return respondWithRpcPromise(_0x1383('0x6c'),_0x1383('0x6d'),_0x4c465e);})['then'](function(_0x3f8250){_0x56c269(_0x3f8250);})[_0x1383('0x22')](function(_0x386f1e){_0x1ea73e(_0x3d6122[_0x1383('0x13')](0x1f4,_0x386f1e[_0x1383('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 469d1cc..63e3ff2 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 _0x7d74=['register','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0xc498b3,_0x5610b4){var _0x1e2530=function(_0x5c6e08){while(--_0x5c6e08){_0xc498b3['push'](_0xc498b3['shift']());}};_0x1e2530(++_0x5610b4);}(_0x7d74,0x1e2));var _0x47d7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7d74[_0x3e5086];return _0xfeb102;};'use strict';var MailAccountEvents=require(_0x47d7('0x0'));var events=[_0x47d7('0x1'),_0x47d7('0x2'),_0x47d7('0x3')];function createListener(_0x3d569e,_0x6bb9ec){return function(_0x3dff58){_0x6bb9ec[_0x47d7('0x4')](_0x3d569e,_0x3dff58);};}function removeListener(_0x403bce,_0x4a0b60){return function(){MailAccountEvents[_0x47d7('0x5')](_0x403bce,_0x4a0b60);};}exports[_0x47d7('0x6')]=function(_0x28edc3){for(var _0x5df007=0x0,_0x1721d5=events['length'];_0x5df007<_0x1721d5;_0x5df007++){var _0xa33e73=events[_0x5df007];var _0xb92214=createListener(_0x47d7('0x7')+_0xa33e73,_0x28edc3);MailAccountEvents['on'](_0xa33e73,_0xb92214);}}; \ No newline at end of file +var _0x291e=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x291e,0xeb));var _0xe291=function(_0x2952e8,_0x39c1f6){_0x2952e8=_0x2952e8-0x0;var _0x1ae924=_0x291e[_0x2952e8];return _0x1ae924;};'use strict';var MailAccountEvents=require(_0xe291('0x0'));var events=[_0xe291('0x1'),_0xe291('0x2'),_0xe291('0x3')];function createListener(_0x28a4aa,_0x13ce09){return function(_0x809365){_0x13ce09[_0xe291('0x4')](_0x28a4aa,_0x809365);};}function removeListener(_0x5c9563,_0x282071){return function(){MailAccountEvents[_0xe291('0x5')](_0x5c9563,_0x282071);};}exports['register']=function(_0x40b7d9){for(var _0x572632=0x0,_0x5864d1=events[_0xe291('0x6')];_0x572632<_0x5864d1;_0x572632++){var _0xeb6daf=events[_0x572632];var _0x50537a=createListener(_0xe291('0x7')+_0xeb6daf,_0x40b7d9);MailAccountEvents['on'](_0xeb6daf,_0x50537a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ec81acc..e0a5a41 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 _0xc46a=['delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','put','/:id','update'];(function(_0x41cfac,_0x4d8535){var _0x244e2c=function(_0x2a4dd6){while(--_0x2a4dd6){_0x41cfac['push'](_0x41cfac['shift']());}};_0x244e2c(++_0x4d8535);}(_0xc46a,0x162));var _0xac46=function(_0x361bd6,_0x3c03ee){_0x361bd6=_0x361bd6-0x0;var _0x56956f=_0xc46a[_0x361bd6];return _0x56956f;};'use strict';var multer=require(_0xac46('0x0'));var util=require(_0xac46('0x1'));var path=require(_0xac46('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac46('0x3')]();var fs_extra=require(_0xac46('0x4'));var auth=require(_0xac46('0x5'));var interaction=require(_0xac46('0x6'));var config=require(_0xac46('0x7'));var controller=require('./mailApplication.controller');router[_0xac46('0x8')]('/:id',auth[_0xac46('0x9')](),controller[_0xac46('0xa')]);router[_0xac46('0xb')](_0xac46('0xc'),auth['isAuthenticated'](),controller[_0xac46('0xd')]);router[_0xac46('0xe')](_0xac46('0xc'),auth[_0xac46('0x9')](),controller[_0xac46('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf548=['show','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x2aa26d,_0x426cfb){var _0xef6f9e=function(_0x140b09){while(--_0x140b09){_0x2aa26d['push'](_0x2aa26d['shift']());}};_0xef6f9e(++_0x426cfb);}(_0xf548,0x1e1));var _0x8f54=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xf548[_0x365e54];return _0x13317a;};'use strict';var multer=require(_0x8f54('0x0'));var util=require(_0x8f54('0x1'));var path=require(_0x8f54('0x2'));var timeout=require(_0x8f54('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f54('0x4'));var auth=require(_0x8f54('0x5'));var interaction=require(_0x8f54('0x6'));var config=require(_0x8f54('0x7'));var controller=require(_0x8f54('0x8'));router[_0x8f54('0x9')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller[_0x8f54('0xc')]);router[_0x8f54('0xd')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller['update']);router[_0x8f54('0xe')](_0x8f54('0xa'),auth[_0x8f54('0xb')](),controller[_0x8f54('0xf')]);module[_0x8f54('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e1a668a..8fdd5c3 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 _0x5fc2=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x5979e7,_0x2a8391){var _0x5b08be=function(_0x524d1c){while(--_0x524d1c){_0x5979e7['push'](_0x5979e7['shift']());}};_0x5b08be(++_0x2a8391);}(_0x5fc2,0x188));var _0x25fc=function(_0x28a8c2,_0x494d5){_0x28a8c2=_0x28a8c2-0x0;var _0x37ac3c=_0x5fc2[_0x28a8c2];return _0x37ac3c;};'use strict';var Sequelize=require(_0x25fc('0x0'));module['exports']={'priority':{'type':Sequelize[_0x25fc('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x25fc('0x2')]()},'description':{'type':Sequelize[_0x25fc('0x3')]},'interval':{'type':Sequelize[_0x25fc('0x3')],'defaultValue':_0x25fc('0x4')}}; \ No newline at end of file +var _0xa6fd=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x1faae2,_0x1d0a07){var _0xdcf8f2=function(_0x5bf596){while(--_0x5bf596){_0x1faae2['push'](_0x1faae2['shift']());}};_0xdcf8f2(++_0x1d0a07);}(_0xa6fd,0x145));var _0xda6f=function(_0x36888d,_0x22988e){_0x36888d=_0x36888d-0x0;var _0x14f524=_0xa6fd[_0x36888d];return _0x14f524;};'use strict';var Sequelize=require(_0xda6f('0x0'));module[_0xda6f('0x1')]={'priority':{'type':Sequelize[_0xda6f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xda6f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xda6f('0x4')]()},'description':{'type':Sequelize[_0xda6f('0x3')]},'interval':{'type':Sequelize[_0xda6f('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 e74862f..b03fd03 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x203fb0,_0x579c63){var _0x2c0198=function(_0xef3b5a){while(--_0xef3b5a){_0x203fb0['push'](_0x203fb0['shift']());}};_0x2c0198(++_0x579c63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x5ba320,_0x48008a){var _0x571b66=function(_0x29e2ca){while(--_0x29e2ca){_0x5ba320['push'](_0x5ba320['shift']());}};_0x571b66(++_0x48008a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xcb91[_0xf31767];return _0x24bd0c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e9e4dd9..ead4246 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 _0xd13a=['moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','lodash','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd13a,0xae));var _0xad13=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd13a[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xad13('0x0'));var util=require(_0xad13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad13('0x2'));var BPromise=require('bluebird');var rp=require(_0xad13('0x3'));var fs=require('fs');var path=require(_0xad13('0x4'));var rimraf=require(_0xad13('0x5'));var config=require(_0xad13('0x6'));var attributes=require(_0xad13('0x7'));module['exports']=function(_0x9ff998,_0x2f2183){return _0x9ff998[_0xad13('0x8')](_0xad13('0x9'),attributes,{'tableName':_0xad13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf038=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x411416,_0x35923a){var _0x395e39=function(_0x4bd401){while(--_0x4bd401){_0x411416['push'](_0x411416['shift']());}};_0x395e39(++_0x35923a);}(_0xf038,0xfc));var _0x8f03=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xf038[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0x8f03('0x0'));var util=require(_0x8f03('0x1'));var logger=require(_0x8f03('0x2'))(_0x8f03('0x3'));var moment=require(_0x8f03('0x4'));var BPromise=require(_0x8f03('0x5'));var rp=require(_0x8f03('0x6'));var fs=require('fs');var path=require(_0x8f03('0x7'));var rimraf=require(_0x8f03('0x8'));var config=require(_0x8f03('0x9'));var attributes=require(_0x8f03('0xa'));module[_0x8f03('0xb')]=function(_0x1bdd71,_0x201cba){return _0x1bdd71['define'](_0x8f03('0xc'),attributes,{'tableName':_0x8f03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8f03('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 974f5f8..702a39f 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 _0x2234=['message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0xe3b77f,_0x25f221){var _0x19d719=function(_0x18b339){while(--_0x18b339){_0xe3b77f['push'](_0xe3b77f['shift']());}};_0x19d719(++_0x25f221);}(_0x2234,0x18c));var _0x4223=function(_0x3e2c33,_0x579090){_0x3e2c33=_0x3e2c33-0x0;var _0x533aa0=_0x2234[_0x3e2c33];return _0x533aa0;};'use strict';var _=require('lodash');var util=require(_0x4223('0x0'));var moment=require(_0x4223('0x1'));var BPromise=require(_0x4223('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4223('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4223('0x4'));var logger=require(_0x4223('0x5'))(_0x4223('0x6'));var config=require(_0x4223('0x7'));var jayson=require(_0x4223('0x8'));var client=jayson[_0x4223('0x9')][_0x4223('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41bd41,_0x3183b3,_0x44f3c8){return new BPromise(function(_0x4127af,_0x3059f1){return client[_0x4223('0xb')](_0x41bd41,_0x44f3c8)[_0x4223('0xc')](function(_0x18cf96){logger[_0x4223('0xd')](_0x4223('0xe'),_0x3183b3,'request\x20sent');logger[_0x4223('0xf')](_0x4223('0x10'),_0x3183b3,_0x4223('0x11'),JSON['stringify'](_0x18cf96));if(_0x18cf96[_0x4223('0x12')]){if(_0x18cf96[_0x4223('0x12')][_0x4223('0x13')]===0x1f4){logger[_0x4223('0x12')](_0x4223('0xe'),_0x3183b3,_0x18cf96['error'][_0x4223('0x14')]);return _0x3059f1(_0x18cf96['error'][_0x4223('0x14')]);}logger[_0x4223('0x12')](_0x4223('0xe'),_0x3183b3,_0x18cf96[_0x4223('0x12')][_0x4223('0x14')]);return _0x4127af(_0x18cf96[_0x4223('0x12')][_0x4223('0x14')]);}else{logger[_0x4223('0xd')](_0x4223('0xe'),_0x3183b3,_0x4223('0x11'));_0x4127af(_0x18cf96[_0x4223('0x15')][_0x4223('0x14')]);}})[_0x4223('0x16')](function(_0x2f645f){logger[_0x4223('0x12')](_0x4223('0xe'),_0x3183b3,_0x2f645f);_0x3059f1(_0x2f645f);});});}exports[_0x4223('0x17')]=function(_0x43dda4){var _0x50c619=this;return new Promise(function(_0x1dcfa1,_0x44dcc9){return db[_0x4223('0x18')][_0x4223('0x19')](_0x43dda4[_0x4223('0x1a')],{'raw':_0x43dda4[_0x4223('0x1b')]?_0x43dda4[_0x4223('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43dda4[_0x4223('0x1b')]?_0x43dda4[_0x4223('0x1b')][_0x4223('0x1c')]||null:null,'attributes':_0x43dda4[_0x4223('0x1b')]?_0x43dda4[_0x4223('0x1b')][_0x4223('0x1d')]||null:null,'limit':_0x43dda4['options']?_0x43dda4[_0x4223('0x1b')][_0x4223('0x1e')]||null:null})[_0x4223('0xc')](function(_0x311b4d){logger[_0x4223('0xd')](_0x4223('0x17'),_0x43dda4);logger[_0x4223('0xf')](_0x4223('0x17'),_0x43dda4,JSON[_0x4223('0x1f')](_0x311b4d));_0x1dcfa1(_0x311b4d);})[_0x4223('0x16')](function(_0x46277f){logger[_0x4223('0x12')]('UpdateMailApplication',_0x46277f['message'],_0x43dda4);_0x44dcc9(_0x50c619[_0x4223('0x12')](0x1f4,_0x46277f['message']));});});}; \ No newline at end of file +var _0xf884=['then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d4224,_0x394591){var _0x2246fe=function(_0x58793e){while(--_0x58793e){_0x2d4224['push'](_0x2d4224['shift']());}};_0x2246fe(++_0x394591);}(_0xf884,0x15b));var _0x4f88=function(_0x506e7b,_0x51e387){_0x506e7b=_0x506e7b-0x0;var _0x16b51b=_0xf884[_0x506e7b];return _0x16b51b;};'use strict';var _=require(_0x4f88('0x0'));var util=require(_0x4f88('0x1'));var moment=require(_0x4f88('0x2'));var BPromise=require(_0x4f88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f88('0x4'))['db'];var utils=require(_0x4f88('0x5'));var logger=require(_0x4f88('0x6'))(_0x4f88('0x7'));var config=require(_0x4f88('0x8'));var jayson=require(_0x4f88('0x9'));var client=jayson[_0x4f88('0xa')][_0x4f88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca0db,_0x16cbc4,_0x225936){return new BPromise(function(_0x4b5980,_0x178998){return client[_0x4f88('0xc')](_0x5ca0db,_0x225936)[_0x4f88('0xd')](function(_0x24a64c){logger[_0x4f88('0xe')](_0x4f88('0xf'),_0x16cbc4,'request\x20sent');logger[_0x4f88('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x16cbc4,_0x4f88('0x11'),JSON[_0x4f88('0x12')](_0x24a64c));if(_0x24a64c['error']){if(_0x24a64c[_0x4f88('0x13')][_0x4f88('0x14')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x16cbc4,_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);return _0x178998(_0x24a64c['error']['message']);}logger[_0x4f88('0x13')]('MailApplication,\x20%s,\x20%s',_0x16cbc4,_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);return _0x4b5980(_0x24a64c[_0x4f88('0x13')][_0x4f88('0x15')]);}else{logger[_0x4f88('0xe')](_0x4f88('0xf'),_0x16cbc4,_0x4f88('0x11'));_0x4b5980(_0x24a64c[_0x4f88('0x16')][_0x4f88('0x15')]);}})[_0x4f88('0x17')](function(_0x5773f7){logger[_0x4f88('0x13')](_0x4f88('0xf'),_0x16cbc4,_0x5773f7);_0x178998(_0x5773f7);});});}exports[_0x4f88('0x18')]=function(_0x2d58fb){var _0x520e48=this;return new Promise(function(_0x5bdfe1,_0x19acdc){return db[_0x4f88('0x19')][_0x4f88('0x1a')](_0x2d58fb[_0x4f88('0x1b')],{'raw':_0x2d58fb['options']?_0x2d58fb[_0x4f88('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')]['where']||null:null,'attributes':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')][_0x4f88('0x1d')]||null:null,'limit':_0x2d58fb[_0x4f88('0x1c')]?_0x2d58fb[_0x4f88('0x1c')]['limit']||null:null})['then'](function(_0x42c2c1){logger['info'](_0x4f88('0x18'),_0x2d58fb);logger[_0x4f88('0x10')](_0x4f88('0x18'),_0x2d58fb,JSON[_0x4f88('0x12')](_0x42c2c1));_0x5bdfe1(_0x42c2c1);})[_0x4f88('0x17')](function(_0x4321a8){logger[_0x4f88('0x13')](_0x4f88('0x18'),_0x4321a8[_0x4f88('0x15')],_0x2d58fb);_0x19acdc(_0x520e48[_0x4f88('0x13')](0x1f4,_0x4321a8[_0x4f88('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index de3025e..bb873e5 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 _0x7baa=['exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','update','delete','mailinteraction:destroy','destroy'];(function(_0x5544f4,_0x48f88f){var _0x41df25=function(_0x2c9486){while(--_0x2c9486){_0x5544f4['push'](_0x5544f4['shift']());}};_0x41df25(++_0x48f88f);}(_0x7baa,0x83));var _0xa7ba=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7baa[_0x484e36];return _0xafc85d;};'use strict';var express=require(_0xa7ba('0x0'));var router=express[_0xa7ba('0x1')]();var auth=require(_0xa7ba('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xa7ba('0x3'));router[_0xa7ba('0x4')]('/',auth[_0xa7ba('0x5')](),controller[_0xa7ba('0x6')]);router[_0xa7ba('0x4')]('/describe',auth[_0xa7ba('0x5')](),controller[_0xa7ba('0x7')]);router['get'](_0xa7ba('0x8'),auth['isAuthenticated'](),controller[_0xa7ba('0x9')]);router[_0xa7ba('0x4')](_0xa7ba('0xa'),auth[_0xa7ba('0x5')](),controller[_0xa7ba('0xb')]);router['get']('/:id/download',auth[_0xa7ba('0x5')](),controller[_0xa7ba('0xc')]);router['post']('/',auth[_0xa7ba('0x5')](),controller[_0xa7ba('0xd')]);router[_0xa7ba('0xe')](_0xa7ba('0xa'),auth[_0xa7ba('0x5')](),controller[_0xa7ba('0xf')]);router['post'](_0xa7ba('0x10'),auth['isAuthenticated'](),interaction[_0xa7ba('0x11')]('mail',_0xa7ba('0x12')),controller[_0xa7ba('0x13')]);router['put'](_0xa7ba('0x8'),auth[_0xa7ba('0x5')](),interaction['tracked'](_0xa7ba('0x14'),'mailinteraction:update'),controller[_0xa7ba('0x15')]);router[_0xa7ba('0x16')](_0xa7ba('0x8'),auth['isAuthenticated'](),interaction[_0xa7ba('0x11')](_0xa7ba('0x14'),_0xa7ba('0x17')),controller[_0xa7ba('0x18')]);router[_0xa7ba('0x16')](_0xa7ba('0x10'),auth[_0xa7ba('0x5')](),controller['removeTags']);module[_0xa7ba('0x19')]=router; \ No newline at end of file +var _0x4582=['index','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x53b324,_0x11d447){var _0x19fd66=function(_0x7c63a7){while(--_0x7c63a7){_0x53b324['push'](_0x53b324['shift']());}};_0x19fd66(++_0x11d447);}(_0x4582,0x199));var _0x2458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4582[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x2458('0x0'));var router=express['Router']();var auth=require(_0x2458('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x2458('0x2'));router[_0x2458('0x3')]('/',auth[_0x2458('0x4')](),controller[_0x2458('0x5')]);router['get']('/describe',auth[_0x2458('0x4')](),controller[_0x2458('0x6')]);router[_0x2458('0x3')](_0x2458('0x7'),auth[_0x2458('0x4')](),controller[_0x2458('0x8')]);router['get'](_0x2458('0x9'),auth['isAuthenticated'](),controller[_0x2458('0xa')]);router[_0x2458('0x3')]('/:id/download',auth[_0x2458('0x4')](),controller['download']);router[_0x2458('0xb')]('/',auth['isAuthenticated'](),controller[_0x2458('0xc')]);router[_0x2458('0xb')](_0x2458('0x9'),auth[_0x2458('0x4')](),controller[_0x2458('0xd')]);router['post'](_0x2458('0xe'),auth[_0x2458('0x4')](),interaction['tracked'](_0x2458('0xf'),_0x2458('0x10')),controller[_0x2458('0x11')]);router[_0x2458('0x12')](_0x2458('0x7'),auth['isAuthenticated'](),interaction[_0x2458('0x13')](_0x2458('0xf'),_0x2458('0x14')),controller[_0x2458('0x15')]);router[_0x2458('0x16')](_0x2458('0x7'),auth['isAuthenticated'](),interaction[_0x2458('0x13')]('mail','mailinteraction:destroy'),controller['destroy']);router[_0x2458('0x16')](_0x2458('0xe'),auth['isAuthenticated'](),controller['removeTags']);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 15fade2..bc1368d 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 _0x3e99=['exports','BOOLEAN','STRING','TEXT','DATE','out','ENUM','INTEGER'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x3e99,0x88));var _0x93e9=function(_0x35b481,_0x311d36){_0x35b481=_0x35b481-0x0;var _0x304a54=_0x3e99[_0x35b481];return _0x304a54;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x93e9('0x0')]={'closed':{'type':Sequelize[_0x93e9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x93e9('0x2')]},'secondDisposition':{'type':Sequelize[_0x93e9('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x93e9('0x2')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x93e9('0x2')]},'cc':{'type':Sequelize[_0x93e9('0x3')]('long')},'subject':{'type':Sequelize[_0x93e9('0x3')]()},'attach':{'type':Sequelize[_0x93e9('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x93e9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x93e9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x93e9('0x6')]('in',_0x93e9('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x93e9('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x93e9('0x7')]}}; \ No newline at end of file +var _0x18bb=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN'];(function(_0x15293a,_0x4fcce9){var _0x384a40=function(_0x4ed87b){while(--_0x4ed87b){_0x15293a['push'](_0x15293a['shift']());}};_0x384a40(++_0x4fcce9);}(_0x18bb,0x15c));var _0xb18b=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x18bb[_0x53b53e];return _0xbb6179;};'use strict';var Sequelize=require(_0xb18b('0x0'));var iconv=require(_0xb18b('0x1'));module[_0xb18b('0x2')]={'closed':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb18b('0x4')]},'disposition':{'type':Sequelize[_0xb18b('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb18b('0x5')]},'note':{'type':Sequelize[_0xb18b('0x5')]},'inReplyTo':{'type':Sequelize[_0xb18b('0x5')](0x1fe)},'to':{'type':Sequelize[_0xb18b('0x5')]},'cc':{'type':Sequelize[_0xb18b('0x6')](_0xb18b('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb18b('0x4')]},'substatus':{'type':Sequelize[_0xb18b('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb18b('0x8')]('in',_0xb18b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb18b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb18b('0x8')]('in',_0xb18b('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb18b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb18b('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 7978338..e18828c 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 _0xf387=['defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','show','model','keys','filters','intersection','attributes','fields','includeAll','merge','find','catch','create','body','params','destroy','describe','addMessage','ids','getMessages','findOne','MailMessage','length','hasOwnProperty','order','sort','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','omit','spread','Tag','color','emit','removeTags','download','toString','join','root','server','tmp','files','transcript-%d-%s.zip','attachments','push','Attachments','Messages','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','headers','bcc','Bcc','basename','type','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis'];(function(_0x2b950c,_0x57cc37){var _0x592648=function(_0x20b1f6){while(--_0x20b1f6){_0x2b950c['push'](_0x2b950c['shift']());}};_0x592648(++_0x57cc37);}(_0xf387,0xcd));var _0x7f38=function(_0x7441bd,_0x179387){_0x7441bd=_0x7441bd-0x0;var _0x44d283=_0xf387[_0x7441bd];return _0x44d283;};'use strict';var emlformat=require(_0x7f38('0x0'));var rimraf=require(_0x7f38('0x1'));var zipdir=require(_0x7f38('0x2'));var moment=require(_0x7f38('0x3'));var BPromise=require(_0x7f38('0x4'));var util=require(_0x7f38('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x7f38('0x6'));var juice=require('juice');var Redis=require(_0x7f38('0x7'));var interaction=require(_0x7f38('0x8'));var qs=require(_0x7f38('0x9'));var logger=require(_0x7f38('0xa'))('api');var config=require('../../config/environment');var db=require(_0x7f38('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x7f38('0xc')]=_[_0x7f38('0xd')](config[_0x7f38('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f38('0xe'))(new Redis(config[_0x7f38('0xc')]));require('./mailInteraction.socket')[_0x7f38('0xf')](socket);function respondWithStatusCode(_0x33f93b,_0x47c0f7){_0x47c0f7=_0x47c0f7||0xcc;return function(_0x6c10d7){if(_0x6c10d7){return _0x33f93b[_0x7f38('0x10')](_0x47c0f7);}return _0x33f93b[_0x7f38('0x11')](_0x47c0f7)['end']();};}function respondWithResult(_0x21d044,_0x30ff84){_0x30ff84=_0x30ff84||0xc8;return function(_0xdc9610){if(_0xdc9610){return _0x21d044[_0x7f38('0x11')](_0x30ff84)[_0x7f38('0x12')](_0xdc9610);}};}function respondWithFilteredResult(_0x2467bd,_0xceaba4){return function(_0x233fee){if(_0x233fee){var _0x4f973=typeof _0xceaba4[_0x7f38('0x13')]==='undefined'&&typeof _0xceaba4[_0x7f38('0x14')]==='undefined';var _0x5bdfae=_0x233fee[_0x7f38('0x15')];var _0x339c91=_0x4f973?0x0:_0xceaba4[_0x7f38('0x13')];var _0x8f604d=_0x4f973?_0x233fee[_0x7f38('0x15')]:_0xceaba4['offset']+_0xceaba4[_0x7f38('0x14')];var _0xc4b337;if(_0x8f604d>=_0x5bdfae){_0x8f604d=_0x5bdfae;_0xc4b337=0xc8;}else{_0xc4b337=0xce;}_0x2467bd[_0x7f38('0x11')](_0xc4b337);return _0x2467bd[_0x7f38('0x16')](_0x7f38('0x17'),_0x339c91+'-'+_0x8f604d+'/'+_0x5bdfae)[_0x7f38('0x12')](_0x233fee);}return null;};}function saveUpdates(_0x385271){return function(_0xfb91a3){if(_0xfb91a3){return _0xfb91a3[_0x7f38('0x18')](_0x385271)['then'](function(_0xcecee4){return _0xcecee4;});}return null;};}function removeEntity(_0x20d766){return function(_0x2dcb19){if(_0x2dcb19){return _0x2dcb19['destroy']()[_0x7f38('0x19')](function(){_0x20d766[_0x7f38('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19fa1d){return function(_0x41f4c8){if(!_0x41f4c8){_0x19fa1d['sendStatus'](0x194);}return _0x41f4c8;};}function handleError(_0x3329cd,_0x25ad5c){_0x25ad5c=_0x25ad5c||0x1f4;return function(_0x3a5fd6){logger[_0x7f38('0x1a')](_0x3a5fd6[_0x7f38('0x1b')]);if(_0x3a5fd6[_0x7f38('0x1c')]){delete _0x3a5fd6[_0x7f38('0x1c')];}_0x3329cd[_0x7f38('0x11')](_0x25ad5c)[_0x7f38('0x1d')](_0x3a5fd6);};}exports[_0x7f38('0x1e')]=function(_0x372522,_0x3da23a){var _0x2e4ccb={};var _0x541e3e=_[_0x7f38('0x1f')](db[_0x7f38('0x20')][_0x7f38('0x21')],function(_0x54cee7){return{'name':_0x54cee7[_0x7f38('0x22')],'type':_0x54cee7['type'][_0x7f38('0x23')]};});_0x2e4ccb=qs[_0x7f38('0x24')](_0x541e3e,_0x372522);return interaction[_0x7f38('0x25')]('mail',_0x372522[_0x7f38('0x26')],_0x372522['user'],_0x2e4ccb,_0x541e3e)[_0x7f38('0x19')](respondWithFilteredResult(_0x3da23a,_0x2e4ccb))['catch'](handleError(_0x3da23a,null));};exports[_0x7f38('0x27')]=function(_0x51d758,_0x3eb055){var _0x5e4cae={'raw':![],'where':{'id':_0x51d758['params']['id']}},_0x546aca={};_0x546aca[_0x7f38('0x28')]=_[_0x7f38('0x29')](db[_0x7f38('0x20')][_0x7f38('0x21')]);_0x546aca[_0x7f38('0x26')]=_['keys'](_0x51d758[_0x7f38('0x26')]);_0x546aca[_0x7f38('0x2a')]=_[_0x7f38('0x2b')](_0x546aca['model'],_0x546aca[_0x7f38('0x26')]);_0x5e4cae[_0x7f38('0x2c')]=_['intersection'](_0x546aca[_0x7f38('0x28')],qs[_0x7f38('0x2d')](_0x51d758[_0x7f38('0x26')][_0x7f38('0x2d')]));_0x5e4cae['attributes']=_0x5e4cae['attributes']['length']?_0x5e4cae[_0x7f38('0x2c')]:_0x546aca[_0x7f38('0x28')];if(_0x51d758['query'][_0x7f38('0x2e')]){_0x5e4cae['include']=[{'all':!![]}];}_0x5e4cae=_[_0x7f38('0x2f')]({},_0x5e4cae,_0x51d758['options']);return db[_0x7f38('0x20')][_0x7f38('0x30')](_0x5e4cae)[_0x7f38('0x19')](handleEntityNotFound(_0x3eb055,null))[_0x7f38('0x19')](respondWithResult(_0x3eb055,null))[_0x7f38('0x31')](handleError(_0x3eb055,null));};exports[_0x7f38('0x32')]=function(_0x255f73,_0x3784d3){return db[_0x7f38('0x20')][_0x7f38('0x32')](_0x255f73[_0x7f38('0x33')],{})[_0x7f38('0x19')](respondWithResult(_0x3784d3,0xc9))[_0x7f38('0x31')](handleError(_0x3784d3,null));};exports[_0x7f38('0x18')]=function(_0x460875,_0x5f3025){if(_0x460875[_0x7f38('0x33')]['id']){delete _0x460875[_0x7f38('0x33')]['id'];}return db['MailInteraction'][_0x7f38('0x30')]({'where':{'id':_0x460875[_0x7f38('0x34')]['id']}})[_0x7f38('0x19')](handleEntityNotFound(_0x5f3025,null))['then'](saveUpdates(_0x460875[_0x7f38('0x33')],null))[_0x7f38('0x19')](respondWithResult(_0x5f3025,null))[_0x7f38('0x31')](handleError(_0x5f3025,null));};exports[_0x7f38('0x35')]=function(_0x563320,_0xcd1b30){return db[_0x7f38('0x20')][_0x7f38('0x30')]({'where':{'id':_0x563320[_0x7f38('0x34')]['id']}})[_0x7f38('0x19')](handleEntityNotFound(_0xcd1b30,null))[_0x7f38('0x19')](removeEntity(_0xcd1b30,null))['catch'](handleError(_0xcd1b30,null));};exports[_0x7f38('0x36')]=function(_0x78106f,_0x540392){return db[_0x7f38('0x20')][_0x7f38('0x36')]()[_0x7f38('0x19')](respondWithResult(_0x540392,null))['catch'](handleError(_0x540392,null));};exports[_0x7f38('0x37')]=function(_0x192cce,_0x8d47e3){return db['MailMessage'][_0x7f38('0x30')]({'where':{'id':_0x192cce[_0x7f38('0x34')]['id']}})[_0x7f38('0x19')](handleEntityNotFound(_0x8d47e3,null))[_0x7f38('0x19')](function(_0x15cb94){if(_0x15cb94){return _0x15cb94[_0x7f38('0x37')](_0x192cce[_0x7f38('0x33')][_0x7f38('0x38')],_['omit'](_0x192cce[_0x7f38('0x33')],['ids','id'])||{});}})[_0x7f38('0x19')](respondWithResult(_0x8d47e3,null))[_0x7f38('0x31')](handleError(_0x8d47e3,null));};exports[_0x7f38('0x39')]=function(_0x3722b9,_0x80a3c4){var _0x1e6121={'raw':![],'where':{}};var _0x451c8c={};var _0x4908dd={'count':0x0,'rows':[]};return db[_0x7f38('0x20')][_0x7f38('0x3a')]({'where':{'id':_0x3722b9[_0x7f38('0x34')]['id']}})[_0x7f38('0x19')](handleEntityNotFound(_0x80a3c4,null))[_0x7f38('0x19')](function(_0x2cfde7){if(_0x2cfde7){_0x451c8c[_0x7f38('0x28')]=_[_0x7f38('0x29')](db[_0x7f38('0x3b')][_0x7f38('0x21')]);_0x451c8c[_0x7f38('0x26')]=_[_0x7f38('0x29')](_0x3722b9[_0x7f38('0x26')]);_0x451c8c['filters']=_[_0x7f38('0x2b')](_0x451c8c[_0x7f38('0x28')],_0x451c8c[_0x7f38('0x26')]);_0x1e6121['attributes']=_[_0x7f38('0x2b')](_0x451c8c[_0x7f38('0x28')],qs[_0x7f38('0x2d')](_0x3722b9[_0x7f38('0x26')][_0x7f38('0x2d')]));_0x1e6121[_0x7f38('0x2c')]=_0x1e6121[_0x7f38('0x2c')][_0x7f38('0x3c')]?_0x1e6121[_0x7f38('0x2c')]:_0x451c8c['model'];if(!_0x3722b9[_0x7f38('0x26')][_0x7f38('0x3d')]('nolimit')){_0x1e6121['limit']=qs['limit'](_0x3722b9['query'][_0x7f38('0x14')]);_0x1e6121['offset']=qs[_0x7f38('0x13')](_0x3722b9[_0x7f38('0x26')][_0x7f38('0x13')]);}_0x1e6121[_0x7f38('0x3e')]=qs['sort'](_0x3722b9[_0x7f38('0x26')][_0x7f38('0x3f')]);_0x1e6121[_0x7f38('0x40')]=qs[_0x7f38('0x2a')](_['pick'](_0x3722b9[_0x7f38('0x26')],_0x451c8c[_0x7f38('0x2a')]));_0x1e6121[_0x7f38('0x40')][_0x7f38('0x41')]=_0x2cfde7['id'];if(_0x3722b9[_0x7f38('0x26')][_0x7f38('0x42')]){_0x1e6121[_0x7f38('0x40')]=_[_0x7f38('0x2f')](_0x1e6121[_0x7f38('0x40')],{'$or':_[_0x7f38('0x1f')](_0x1e6121[_0x7f38('0x2c')],function(_0x21936b){var _0x3ede2d={};_0x3ede2d[_0x21936b]={'$like':'%'+_0x3722b9[_0x7f38('0x26')][_0x7f38('0x42')]+'%'};return _0x3ede2d;})});}if(_0x3722b9[_0x7f38('0x26')][_0x7f38('0x43')]){var _0x13b32f=_0x3722b9['query'][_0x7f38('0x43')]['split'](',');var _0x1341c9={};_0x1341c9[_0x13b32f[0x0]]={'$gte':moment(_0x13b32f[0x1])[_0x7f38('0x44')](_0x7f38('0x45'))};_0x1e6121[_0x7f38('0x40')]=_[_0x7f38('0x2f')](_0x1e6121[_0x7f38('0x40')],_0x1341c9);}_0x1e6121=_[_0x7f38('0x2f')]({},_0x1e6121,_0x3722b9[_0x7f38('0x46')]);return db[_0x7f38('0x3b')][_0x7f38('0x15')]({'where':_0x1e6121['where']})[_0x7f38('0x19')](function(_0x32f427){_0x4908dd[_0x7f38('0x15')]=_0x32f427;if(_0x3722b9[_0x7f38('0x26')][_0x7f38('0x2e')]){_0x1e6121['include']=[{'all':!![]}];}return db[_0x7f38('0x3b')][_0x7f38('0x25')](_0x1e6121);})['then'](function(_0x1b3b88){if(_0x3722b9[_0x7f38('0x26')]['inlineCss']==='true'){for(var _0x5c72dc=0x0;_0x5c72dc<_0x1b3b88[_0x7f38('0x3c')];_0x5c72dc++){_0x1b3b88[_0x5c72dc]['body']=juice(_0x1b3b88[_0x5c72dc][_0x7f38('0x33')]);}}_0x4908dd[_0x7f38('0x47')]=_0x1b3b88;return _0x4908dd;});}})['then'](respondWithFilteredResult(_0x80a3c4,_0x1e6121))['catch'](handleError(_0x80a3c4,null));};exports['addTags']=function(_0x2bbb6f,_0x19abad){return db[_0x7f38('0x20')][_0x7f38('0x30')]({'where':{'id':_0x2bbb6f['params']['id']}})['then'](handleEntityNotFound(_0x19abad,null))['then'](function(_0x54abd5){if(_0x54abd5){return _0x54abd5[_0x7f38('0x48')](_0x2bbb6f['body'][_0x7f38('0x38')],_[_0x7f38('0x49')](_0x2bbb6f[_0x7f38('0x33')],['ids','id'])||{})[_0x7f38('0x4a')](function(){return db[_0x7f38('0x4b')][_0x7f38('0x25')]({'attributes':['id',_0x7f38('0x1c'),_0x7f38('0x4c')],'where':{'id':_0x2bbb6f[_0x7f38('0x33')][_0x7f38('0x38')]}});})['then'](function(_0x4979db){socket[_0x7f38('0x4d')]('mailInteractionTags:save',{'id':Number(_0x2bbb6f[_0x7f38('0x34')]['id']),'tags':_0x4979db||[]});return{'id':Number(_0x2bbb6f['params']['id']),'tags':_0x4979db||[]};});}})['then'](respondWithResult(_0x19abad,null))['catch'](handleError(_0x19abad,null));};exports[_0x7f38('0x4e')]=function(_0xe011a1,_0x475ef3){return db[_0x7f38('0x20')][_0x7f38('0x30')]({'where':{'id':_0xe011a1[_0x7f38('0x34')]['id']}})[_0x7f38('0x19')](handleEntityNotFound(_0x475ef3,null))['then'](function(_0x5343fd){if(_0x5343fd){return _0x5343fd['removeTags'](_0xe011a1['query'][_0x7f38('0x38')]);}})[_0x7f38('0x19')](respondWithStatusCode(_0x475ef3,null))['catch'](handleError(_0x475ef3,null));};exports[_0x7f38('0x4f')]=function(_0x13f607,_0x24489f){var _0x33d267=moment()['unix']()[_0x7f38('0x50')]();var _0x13b6ae=path[_0x7f38('0x51')](config[_0x7f38('0x52')],_0x7f38('0x53'),'files',_0x7f38('0x54'));var _0x28c215=path['join'](config[_0x7f38('0x52')],_0x7f38('0x53'),_0x7f38('0x55'),'attachments');var _0x5241c=path[_0x7f38('0x51')](_0x13b6ae,_0x33d267);var _0x7ba78a=util['format'](_0x7f38('0x56'),_0x13f607[_0x7f38('0x34')]['id'],_0x33d267);var _0x27764=path['join'](_0x13b6ae,_0x7ba78a);var _0x36e59c=[];if(_0x13f607[_0x7f38('0x26')][_0x7f38('0x57')]){_0x36e59c[_0x7f38('0x58')]({'model':db['Attachment'],'as':_0x7f38('0x59'),'raw':!![]});}var _0x54a092=[{'model':db[_0x7f38('0x3b')],'as':_0x7f38('0x5a'),'attributes':['id',_0x7f38('0x33'),'from','to','cc','bcc',_0x7f38('0x5b'),_0x7f38('0x5c')],'where':{'secret':![]},'order':qs[_0x7f38('0x3f')]('id'),'include':_0x36e59c}];return db[_0x7f38('0x20')]['find']({'where':{'id':_0x13f607[_0x7f38('0x34')]['id']},'include':_0x54a092})['then'](handleEntityNotFound(_0x24489f,null))[_0x7f38('0x19')](function(_0x3c3b3b){if(_0x3c3b3b&&_0x3c3b3b[_0x7f38('0x5a')]){var _0x178224=_0x3c3b3b[_0x7f38('0x5d')]({'plain':!![]});fs[_0x7f38('0x5e')](_0x5241c);return BPromise[_0x7f38('0x5f')](_0x178224['Messages'],function(_0x45cbb5,_0x9b4a56){var _0xf84dc1={'from':_0x45cbb5[_0x7f38('0x60')],'to':_0x45cbb5['to']||_0x7f38('0x61'),'subject':_0x45cbb5[_0x7f38('0x5b')],'html':htmlEntities[_0x7f38('0x62')](_0x45cbb5[_0x7f38('0x33')]),'headers':{'Date':moment(_0x45cbb5['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x45cbb5['cc']){_0xf84dc1[_0x7f38('0x63')]['Cc']=_0x45cbb5['cc'];}if(_0x45cbb5[_0x7f38('0x64')]){_0xf84dc1[_0x7f38('0x63')][_0x7f38('0x65')]=_0x45cbb5[_0x7f38('0x64')];}return new BPromise(function(_0x3c03b2,_0x2a5e37){if(_0x45cbb5['Attachments']){for(var _0xc0980b=0x0;_0xc0980b<_0x45cbb5[_0x7f38('0x59')][_0x7f38('0x3c')];_0xc0980b++){var _0x47ffb5=_0x45cbb5[_0x7f38('0x59')][_0xc0980b];var _0x20dca3=path[_0x7f38('0x51')](_0x28c215,_0x47ffb5[_0x7f38('0x66')]);if(fs['existsSync'](_0x20dca3)){_0xf84dc1[_0x7f38('0x57')][_0x7f38('0x58')]({'name':_0x47ffb5['name'],'contentType':_0x47ffb5[_0x7f38('0x67')],'data':fs[_0x7f38('0x68')](_0x20dca3)});}}}emlformat[_0x7f38('0x69')](_0xf84dc1,function(_0x4966ce,_0x4a0d01){if(_0x4966ce)return _0x2a5e37(_0x4966ce);fs[_0x7f38('0x6a')](path[_0x7f38('0x51')](_0x5241c,util['format'](_0x7f38('0x6b'),_0x9b4a56)),_0x4a0d01);return _0x3c03b2(_0x4a0d01);});});})[_0x7f38('0x19')](function(){return new BPromise(function(_0x17d3dc,_0x36d17e){zipdir(_0x5241c,{'saveTo':_0x27764},function(_0x59a001,_0x5d4549){if(_0x59a001)return _0x36d17e(_0x59a001);return _0x17d3dc(_0x5d4549);});})['then'](function(){return new BPromise(function(_0x1bcf69,_0x1f9c26){rimraf(_0x5241c,function(_0x5cd6d7){if(_0x5cd6d7)_0x1f9c26(_0x5cd6d7);return _0x1bcf69();});});})[_0x7f38('0x19')](function(){return _0x24489f[_0x7f38('0x4f')](_0x27764,_0x7ba78a,function(_0x1af73e){if(!_0x1af73e)fs[_0x7f38('0x6c')](_0x27764);});});});}else{return _0x24489f[_0x7f38('0x10')](0xc8);}})[_0x7f38('0x31')](handleError(_0x24489f,null));}; \ No newline at end of file +var _0x3f2c=['mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','type','getOptions','findAll','mail','query','user','catch','params','model','keys','MailInteraction','rawAttributes','filters','fields','attributes','length','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','format','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages'];(function(_0x34ef59,_0x1be11b){var _0x285cb5=function(_0x58c45a){while(--_0x58c45a){_0x34ef59['push'](_0x34ef59['shift']());}};_0x285cb5(++_0x1be11b);}(_0x3f2c,0xe9));var _0xc3f2=function(_0x42f740,_0x597b3c){_0x42f740=_0x42f740-0x0;var _0x51cd29=_0x3f2c[_0x42f740];return _0x51cd29;};'use strict';var emlformat=require(_0xc3f2('0x0'));var rimraf=require(_0xc3f2('0x1'));var zipdir=require(_0xc3f2('0x2'));var moment=require(_0xc3f2('0x3'));var BPromise=require(_0xc3f2('0x4'));var util=require(_0xc3f2('0x5'));var path=require('path');var fs=require('fs');var _=require(_0xc3f2('0x6'));var juice=require(_0xc3f2('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xc3f2('0x8'))(_0xc3f2('0x9'));var config=require(_0xc3f2('0xa'));var db=require(_0xc3f2('0xb'))['db'];var htmlEntities=require(_0xc3f2('0xc'));config['redis']=_[_0xc3f2('0xd')](config[_0xc3f2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3f2('0xf'))(new Redis(config['redis']));require(_0xc3f2('0x10'))[_0xc3f2('0x11')](socket);function respondWithStatusCode(_0x288adf,_0x369bb4){_0x369bb4=_0x369bb4||0xcc;return function(_0x19de1b){if(_0x19de1b){return _0x288adf[_0xc3f2('0x12')](_0x369bb4);}return _0x288adf[_0xc3f2('0x13')](_0x369bb4)[_0xc3f2('0x14')]();};}function respondWithResult(_0x2f075e,_0x4df118){_0x4df118=_0x4df118||0xc8;return function(_0x3e8bbf){if(_0x3e8bbf){return _0x2f075e[_0xc3f2('0x13')](_0x4df118)[_0xc3f2('0x15')](_0x3e8bbf);}};}function respondWithFilteredResult(_0x5b64aa,_0x116a07){return function(_0x46fc56){if(_0x46fc56){var _0x1bca08=typeof _0x116a07[_0xc3f2('0x16')]===_0xc3f2('0x17')&&typeof _0x116a07[_0xc3f2('0x18')]==='undefined';var _0x45b1ce=_0x46fc56['count'];var _0x4f64d8=_0x1bca08?0x0:_0x116a07[_0xc3f2('0x16')];var _0x110720=_0x1bca08?_0x46fc56[_0xc3f2('0x19')]:_0x116a07['offset']+_0x116a07[_0xc3f2('0x18')];var _0x174679;if(_0x110720>=_0x45b1ce){_0x110720=_0x45b1ce;_0x174679=0xc8;}else{_0x174679=0xce;}_0x5b64aa[_0xc3f2('0x13')](_0x174679);return _0x5b64aa[_0xc3f2('0x1a')](_0xc3f2('0x1b'),_0x4f64d8+'-'+_0x110720+'/'+_0x45b1ce)[_0xc3f2('0x15')](_0x46fc56);}return null;};}function saveUpdates(_0x163515){return function(_0x4c242c){if(_0x4c242c){return _0x4c242c[_0xc3f2('0x1c')](_0x163515)[_0xc3f2('0x1d')](function(_0x3d8381){return _0x3d8381;});}return null;};}function removeEntity(_0x2df274){return function(_0x2c7aeb){if(_0x2c7aeb){return _0x2c7aeb['destroy']()[_0xc3f2('0x1d')](function(){_0x2df274['status'](0xcc)[_0xc3f2('0x14')]();});}};}function handleEntityNotFound(_0x52efc7){return function(_0x11877e){if(!_0x11877e){_0x52efc7['sendStatus'](0x194);}return _0x11877e;};}function handleError(_0x55f4f0,_0x31f0d8){_0x31f0d8=_0x31f0d8||0x1f4;return function(_0x4d22fa){logger[_0xc3f2('0x1e')](_0x4d22fa['stack']);if(_0x4d22fa[_0xc3f2('0x1f')]){delete _0x4d22fa[_0xc3f2('0x1f')];}_0x55f4f0[_0xc3f2('0x13')](_0x31f0d8)[_0xc3f2('0x20')](_0x4d22fa);};}exports[_0xc3f2('0x21')]=function(_0x1953d9,_0x3aa371){var _0x235043={};var _0x687b97=_['map'](db['MailInteraction']['rawAttributes'],function(_0x639558){return{'name':_0x639558['fieldName'],'type':_0x639558[_0xc3f2('0x22')]['key']};});_0x235043=qs[_0xc3f2('0x23')](_0x687b97,_0x1953d9);return interaction[_0xc3f2('0x24')](_0xc3f2('0x25'),_0x1953d9[_0xc3f2('0x26')],_0x1953d9[_0xc3f2('0x27')],_0x235043,_0x687b97)[_0xc3f2('0x1d')](respondWithFilteredResult(_0x3aa371,_0x235043))[_0xc3f2('0x28')](handleError(_0x3aa371,null));};exports['show']=function(_0x4a2c72,_0x48e3ba){var _0x1ee4c7={'raw':![],'where':{'id':_0x4a2c72[_0xc3f2('0x29')]['id']}},_0x1f5d01={};_0x1f5d01[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](db[_0xc3f2('0x2c')][_0xc3f2('0x2d')]);_0x1f5d01[_0xc3f2('0x26')]=_[_0xc3f2('0x2b')](_0x4a2c72['query']);_0x1f5d01[_0xc3f2('0x2e')]=_['intersection'](_0x1f5d01[_0xc3f2('0x2a')],_0x1f5d01['query']);_0x1ee4c7['attributes']=_['intersection'](_0x1f5d01[_0xc3f2('0x2a')],qs[_0xc3f2('0x2f')](_0x4a2c72[_0xc3f2('0x26')][_0xc3f2('0x2f')]));_0x1ee4c7[_0xc3f2('0x30')]=_0x1ee4c7[_0xc3f2('0x30')][_0xc3f2('0x31')]?_0x1ee4c7['attributes']:_0x1f5d01[_0xc3f2('0x2a')];if(_0x4a2c72['query']['includeAll']){_0x1ee4c7[_0xc3f2('0x32')]=[{'all':!![]}];}_0x1ee4c7=_[_0xc3f2('0x33')]({},_0x1ee4c7,_0x4a2c72[_0xc3f2('0x34')]);return db[_0xc3f2('0x2c')][_0xc3f2('0x35')](_0x1ee4c7)[_0xc3f2('0x1d')](handleEntityNotFound(_0x48e3ba,null))[_0xc3f2('0x1d')](respondWithResult(_0x48e3ba,null))['catch'](handleError(_0x48e3ba,null));};exports[_0xc3f2('0x36')]=function(_0x18c57d,_0x2dd1df){return db[_0xc3f2('0x2c')][_0xc3f2('0x36')](_0x18c57d[_0xc3f2('0x37')],{})[_0xc3f2('0x1d')](respondWithResult(_0x2dd1df,0xc9))[_0xc3f2('0x28')](handleError(_0x2dd1df,null));};exports[_0xc3f2('0x1c')]=function(_0x88ed45,_0x539dd7){if(_0x88ed45[_0xc3f2('0x37')]['id']){delete _0x88ed45['body']['id'];}return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x88ed45[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x539dd7,null))['then'](saveUpdates(_0x88ed45[_0xc3f2('0x37')],null))[_0xc3f2('0x1d')](respondWithResult(_0x539dd7,null))[_0xc3f2('0x28')](handleError(_0x539dd7,null));};exports['destroy']=function(_0x9bca15,_0x523217){return db[_0xc3f2('0x2c')][_0xc3f2('0x35')]({'where':{'id':_0x9bca15[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x523217,null))['then'](removeEntity(_0x523217,null))['catch'](handleError(_0x523217,null));};exports[_0xc3f2('0x38')]=function(_0x4014e4,_0x4021ac){return db[_0xc3f2('0x2c')]['describe']()[_0xc3f2('0x1d')](respondWithResult(_0x4021ac,null))[_0xc3f2('0x28')](handleError(_0x4021ac,null));};exports[_0xc3f2('0x39')]=function(_0x95233f,_0x4aabf2){return db[_0xc3f2('0x3a')][_0xc3f2('0x35')]({'where':{'id':_0x95233f[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x4aabf2,null))[_0xc3f2('0x1d')](function(_0x495617){if(_0x495617){return _0x495617[_0xc3f2('0x39')](_0x95233f[_0xc3f2('0x37')][_0xc3f2('0x3b')],_['omit'](_0x95233f[_0xc3f2('0x37')],[_0xc3f2('0x3b'),'id'])||{});}})[_0xc3f2('0x1d')](respondWithResult(_0x4aabf2,null))['catch'](handleError(_0x4aabf2,null));};exports['getMessages']=function(_0x404f7b,_0x3fc136){var _0x2452bc={'raw':![],'where':{}};var _0x55bda1={};var _0x5978bc={'count':0x0,'rows':[]};return db[_0xc3f2('0x2c')][_0xc3f2('0x3c')]({'where':{'id':_0x404f7b['params']['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x3fc136,null))[_0xc3f2('0x1d')](function(_0x3f34ff){if(_0x3f34ff){_0x55bda1[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](db['MailMessage'][_0xc3f2('0x2d')]);_0x55bda1[_0xc3f2('0x26')]=_[_0xc3f2('0x2b')](_0x404f7b[_0xc3f2('0x26')]);_0x55bda1['filters']=_[_0xc3f2('0x3d')](_0x55bda1[_0xc3f2('0x2a')],_0x55bda1[_0xc3f2('0x26')]);_0x2452bc[_0xc3f2('0x30')]=_[_0xc3f2('0x3d')](_0x55bda1[_0xc3f2('0x2a')],qs[_0xc3f2('0x2f')](_0x404f7b[_0xc3f2('0x26')]['fields']));_0x2452bc[_0xc3f2('0x30')]=_0x2452bc[_0xc3f2('0x30')][_0xc3f2('0x31')]?_0x2452bc['attributes']:_0x55bda1[_0xc3f2('0x2a')];if(!_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x3e')](_0xc3f2('0x3f'))){_0x2452bc[_0xc3f2('0x18')]=qs['limit'](_0x404f7b[_0xc3f2('0x26')]['limit']);_0x2452bc[_0xc3f2('0x16')]=qs[_0xc3f2('0x16')](_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x16')]);}_0x2452bc[_0xc3f2('0x40')]=qs['sort'](_0x404f7b['query'][_0xc3f2('0x41')]);_0x2452bc[_0xc3f2('0x42')]=qs[_0xc3f2('0x2e')](_[_0xc3f2('0x43')](_0x404f7b[_0xc3f2('0x26')],_0x55bda1[_0xc3f2('0x2e')]));_0x2452bc[_0xc3f2('0x42')]['MailInteractionId']=_0x3f34ff['id'];if(_0x404f7b['query'][_0xc3f2('0x44')]){_0x2452bc['where']=_['merge'](_0x2452bc[_0xc3f2('0x42')],{'$or':_[_0xc3f2('0x45')](_0x2452bc['attributes'],function(_0x393e5b){var _0x586948={};_0x586948[_0x393e5b]={'$like':'%'+_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x44')]+'%'};return _0x586948;})});}if(_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x46')]){var _0x328786=_0x404f7b[_0xc3f2('0x26')]['$gte']['split'](',');var _0x18b81f={};_0x18b81f[_0x328786[0x0]]={'$gte':moment(_0x328786[0x1])['format'](_0xc3f2('0x47'))};_0x2452bc[_0xc3f2('0x42')]=_[_0xc3f2('0x33')](_0x2452bc[_0xc3f2('0x42')],_0x18b81f);}_0x2452bc=_[_0xc3f2('0x33')]({},_0x2452bc,_0x404f7b['options']);return db[_0xc3f2('0x3a')][_0xc3f2('0x19')]({'where':_0x2452bc['where']})[_0xc3f2('0x1d')](function(_0x5a1d15){_0x5978bc['count']=_0x5a1d15;if(_0x404f7b[_0xc3f2('0x26')][_0xc3f2('0x48')]){_0x2452bc[_0xc3f2('0x32')]=[{'all':!![]}];}return db[_0xc3f2('0x3a')][_0xc3f2('0x24')](_0x2452bc);})['then'](function(_0x135433){if(_0x404f7b['query']['inlineCss']==='true'){for(var _0x4078a9=0x0;_0x4078a9<_0x135433[_0xc3f2('0x31')];_0x4078a9++){_0x135433[_0x4078a9]['body']=juice(_0x135433[_0x4078a9][_0xc3f2('0x37')]);}}_0x5978bc[_0xc3f2('0x49')]=_0x135433;return _0x5978bc;});}})[_0xc3f2('0x1d')](respondWithFilteredResult(_0x3fc136,_0x2452bc))['catch'](handleError(_0x3fc136,null));};exports['addTags']=function(_0x179af2,_0x53c5e2){return db[_0xc3f2('0x2c')][_0xc3f2('0x35')]({'where':{'id':_0x179af2[_0xc3f2('0x29')]['id']}})['then'](handleEntityNotFound(_0x53c5e2,null))[_0xc3f2('0x1d')](function(_0x16f0ac){if(_0x16f0ac){return _0x16f0ac['setTags'](_0x179af2[_0xc3f2('0x37')][_0xc3f2('0x3b')],_['omit'](_0x179af2[_0xc3f2('0x37')],['ids','id'])||{})[_0xc3f2('0x4a')](function(){return db[_0xc3f2('0x4b')][_0xc3f2('0x24')]({'attributes':['id',_0xc3f2('0x1f'),_0xc3f2('0x4c')],'where':{'id':_0x179af2[_0xc3f2('0x37')]['ids']}});})['then'](function(_0x54100f){socket[_0xc3f2('0x4d')](_0xc3f2('0x4e'),{'id':Number(_0x179af2[_0xc3f2('0x29')]['id']),'tags':_0x54100f||[]});return{'id':Number(_0x179af2[_0xc3f2('0x29')]['id']),'tags':_0x54100f||[]};});}})[_0xc3f2('0x1d')](respondWithResult(_0x53c5e2,null))['catch'](handleError(_0x53c5e2,null));};exports[_0xc3f2('0x4f')]=function(_0x11c1ef,_0x5ada72){return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x11c1ef[_0xc3f2('0x29')]['id']}})[_0xc3f2('0x1d')](handleEntityNotFound(_0x5ada72,null))[_0xc3f2('0x1d')](function(_0x318887){if(_0x318887){return _0x318887[_0xc3f2('0x4f')](_0x11c1ef['query'][_0xc3f2('0x3b')]);}})[_0xc3f2('0x1d')](respondWithStatusCode(_0x5ada72,null))[_0xc3f2('0x28')](handleError(_0x5ada72,null));};exports['download']=function(_0x3bbef7,_0x586dd0){var _0x5ae391=moment()[_0xc3f2('0x50')]()[_0xc3f2('0x51')]();var _0x475a3e=path[_0xc3f2('0x52')](config[_0xc3f2('0x53')],_0xc3f2('0x54'),_0xc3f2('0x55'),_0xc3f2('0x56'));var _0xb67029=path[_0xc3f2('0x52')](config['root'],_0xc3f2('0x54'),'files',_0xc3f2('0x57'));var _0x8b12f9=path[_0xc3f2('0x52')](_0x475a3e,_0x5ae391);var _0x172705=util[_0xc3f2('0x58')]('transcript-%d-%s.zip',_0x3bbef7[_0xc3f2('0x29')]['id'],_0x5ae391);var _0x3420be=path['join'](_0x475a3e,_0x172705);var _0x44f2c8=[];if(_0x3bbef7['query'][_0xc3f2('0x57')]){_0x44f2c8[_0xc3f2('0x59')]({'model':db[_0xc3f2('0x5a')],'as':_0xc3f2('0x5b'),'raw':!![]});}var _0x562653=[{'model':db[_0xc3f2('0x3a')],'as':'Messages','attributes':['id',_0xc3f2('0x37'),_0xc3f2('0x5c'),'to','cc',_0xc3f2('0x5d'),_0xc3f2('0x5e'),_0xc3f2('0x5f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x44f2c8}];return db['MailInteraction'][_0xc3f2('0x35')]({'where':{'id':_0x3bbef7[_0xc3f2('0x29')]['id']},'include':_0x562653})[_0xc3f2('0x1d')](handleEntityNotFound(_0x586dd0,null))[_0xc3f2('0x1d')](function(_0x1d1d92){if(_0x1d1d92&&_0x1d1d92[_0xc3f2('0x60')]){var _0x3e0a3e=_0x1d1d92['get']({'plain':!![]});fs[_0xc3f2('0x61')](_0x8b12f9);return BPromise[_0xc3f2('0x62')](_0x3e0a3e[_0xc3f2('0x60')],function(_0xca98d2,_0x4c6d67){var _0x467929={'from':_0xca98d2[_0xc3f2('0x5c')],'to':_0xca98d2['to']||_0xc3f2('0x63'),'subject':_0xca98d2[_0xc3f2('0x5e')],'html':htmlEntities[_0xc3f2('0x64')](_0xca98d2[_0xc3f2('0x37')]),'headers':{'Date':moment(_0xca98d2[_0xc3f2('0x5f')])[_0xc3f2('0x58')](_0xc3f2('0x65'))},'attachments':[]};if(_0xca98d2['cc']){_0x467929[_0xc3f2('0x66')]['Cc']=_0xca98d2['cc'];}if(_0xca98d2[_0xc3f2('0x5d')]){_0x467929['headers'][_0xc3f2('0x67')]=_0xca98d2[_0xc3f2('0x5d')];}return new BPromise(function(_0x253c40,_0x5aa6d9){if(_0xca98d2[_0xc3f2('0x5b')]){for(var _0x51d29c=0x0;_0x51d29c<_0xca98d2['Attachments']['length'];_0x51d29c++){var _0x34768f=_0xca98d2[_0xc3f2('0x5b')][_0x51d29c];var _0x546f1e=path[_0xc3f2('0x52')](_0xb67029,_0x34768f['basename']);if(fs[_0xc3f2('0x68')](_0x546f1e)){_0x467929[_0xc3f2('0x57')][_0xc3f2('0x59')]({'name':_0x34768f[_0xc3f2('0x1f')],'contentType':_0x34768f[_0xc3f2('0x22')],'data':fs[_0xc3f2('0x69')](_0x546f1e)});}}}emlformat[_0xc3f2('0x6a')](_0x467929,function(_0x502a5a,_0x72e1c4){if(_0x502a5a)return _0x5aa6d9(_0x502a5a);fs['writeFileSync'](path[_0xc3f2('0x52')](_0x8b12f9,util[_0xc3f2('0x58')](_0xc3f2('0x6b'),_0x4c6d67)),_0x72e1c4);return _0x253c40(_0x72e1c4);});});})[_0xc3f2('0x1d')](function(){return new BPromise(function(_0x263e86,_0x58ff10){zipdir(_0x8b12f9,{'saveTo':_0x3420be},function(_0x30f1bb,_0x448254){if(_0x30f1bb)return _0x58ff10(_0x30f1bb);return _0x263e86(_0x448254);});})[_0xc3f2('0x1d')](function(){return new BPromise(function(_0x541d44,_0x4b2a37){rimraf(_0x8b12f9,function(_0x265d31){if(_0x265d31)_0x4b2a37(_0x265d31);return _0x541d44();});});})[_0xc3f2('0x1d')](function(){return _0x586dd0[_0xc3f2('0x6c')](_0x3420be,_0x172705,function(_0xce9e0b){if(!_0xce9e0b)fs[_0xc3f2('0x6d')](_0x3420be);});});});}else{return _0x586dd0[_0xc3f2('0x12')](0xc8);}})['catch'](handleError(_0x586dd0,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e5895f0..2b74500 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 _0x843b=['catch','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x843b,0x102));var _0xb843=function(_0xcc3e02,_0x1ec410){_0xcc3e02=_0xcc3e02-0x0;var _0x580fed=_0x843b[_0xcc3e02];return _0x580fed;};'use strict';var EventEmitter=require(_0xb843('0x0'));var MailInteraction=require(_0xb843('0x1'))['db'][_0xb843('0x2')];var MailMessage=require(_0xb843('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb843('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb843('0x4')};function emitEvent(_0x5e510f){return function(_0x3937d5,_0x4c9a20,_0x2548a3){_0x3937d5[_0xb843('0x5')]({'attributes':['id'],'raw':!![]})[_0xb843('0x6')](function(_0x4acf33){_0x3937d5[_0xb843('0x7')]('Users',_0x4acf33[_0xb843('0x8')](function(_0x48162a){return{'id':_0x48162a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3937d5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb843('0x6')](function(_0x47016c){_0x3937d5[_0xb843('0x7')](_0xb843('0x9'),_0x47016c[_0xb843('0xa')]);MailInteractionEvents[_0xb843('0xb')](_0x5e510f+':'+_0x3937d5['id'],_0x3937d5);MailInteractionEvents[_0xb843('0xb')](_0x5e510f,_0x3937d5);_0x2548a3(null);})[_0xb843('0xc')](_0x2548a3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb843('0xd')](e,emitEvent(event));}}module[_0xb843('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x4780=['getUsers','then','setDataValue','map','findAll','length','emit','exports','events','../../mysqldb','MailMessage','save','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4780,0xbe));var _0x0478=function(_0x20865e,_0x8c725b){_0x20865e=_0x20865e-0x0;var _0x571d3f=_0x4780[_0x20865e];return _0x571d3f;};'use strict';var EventEmitter=require(_0x0478('0x0'));var MailInteraction=require(_0x0478('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x0478('0x1'))['db'][_0x0478('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0478('0x3'),'afterUpdate':'update','afterDestroy':_0x0478('0x4')};function emitEvent(_0x2ab6f5){return function(_0x40b8ed,_0x404483,_0x26200c){_0x40b8ed[_0x0478('0x5')]({'attributes':['id'],'raw':!![]})[_0x0478('0x6')](function(_0x50f5db){_0x40b8ed[_0x0478('0x7')]('Users',_0x50f5db[_0x0478('0x8')](function(_0x21f74){return{'id':_0x21f74['id']};}));return MailMessage[_0x0478('0x9')]({'where':{'MailInteractionId':_0x40b8ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0478('0x6')](function(_0x4f9a8f){_0x40b8ed['setDataValue']('unreadMessages',_0x4f9a8f[_0x0478('0xa')]);MailInteractionEvents[_0x0478('0xb')](_0x2ab6f5+':'+_0x40b8ed['id'],_0x40b8ed);MailInteractionEvents[_0x0478('0xb')](_0x2ab6f5,_0x40b8ed);_0x26200c(null);})['catch'](_0x26200c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x0478('0xc')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6dfefe3..a192660 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 _0xabcc=['fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','MailMessage','catch','utf8mb4','lodash','api','moment','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x1d26d3,_0x87af2f){var _0x82e3fb=function(_0x2ef64a){while(--_0x2ef64a){_0x1d26d3['push'](_0x1d26d3['shift']());}};_0x82e3fb(++_0x87af2f);}(_0xabcc,0x8b));var _0xcabc=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xabcc[_0x5712f8];return _0x14a364;};'use strict';var _=require(_0xcabc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcabc('0x1'));var moment=require(_0xcabc('0x2'));var BPromise=require('bluebird');var rp=require(_0xcabc('0x3'));var fs=require('fs');var path=require(_0xcabc('0x4'));var rimraf=require(_0xcabc('0x5'));var config=require('../../config/environment');var attributes=require(_0xcabc('0x6'));module[_0xcabc('0x7')]=function(_0x59651c,_0x3f5ebc){return _0x59651c[_0xcabc('0x8')](_0xcabc('0x9'),attributes,{'tableName':_0xcabc('0xa'),'paranoid':![],'indexes':[{'name':_0xcabc('0xb'),'fields':[_0xcabc('0xc'),'to'],'type':_0xcabc('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x54d821,_0xfb20ac,_0x268de8){if(_0x54d821[_0xcabc('0xe')]){_0x54d821[_0xcabc('0xf')]=moment()[_0xcabc('0x10')](_0xcabc('0x11'));}if(_0x54d821[_0xcabc('0x12')]){_0x54d821['closedAt']=moment()[_0xcabc('0x10')](_0xcabc('0x11'));}_0x268de8(null,_0xfb20ac);},'beforeUpdate':function(_0x123081,_0x4b5e7c,_0x3bb3a9){if(_0x123081[_0xcabc('0x13')](_0xcabc('0xe'))){_0x123081[_0xcabc('0xf')]=_0x123081['substatus']?moment()[_0xcabc('0x10')](_0xcabc('0x11')):null;}if(_0x123081[_0xcabc('0x13')](_0xcabc('0x12'))){_0x123081[_0xcabc('0x14')]=moment()['format'](_0xcabc('0x11'));_0x123081[_0xcabc('0xe')]=null;_0x123081[_0xcabc('0xf')]=null;}_0x3bb3a9(null,_0x123081);},'afterUpdate':function(_0x561ecb,_0x4f764c,_0x10b3fc){var _0x5b1213=_0x59651c[_0xcabc('0x15')];var _0x390483=_0x561ecb['get']({'plain':!![]});if(_0x390483[_0xcabc('0x12')]){return _0x5b1213[_0xcabc('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x390483['id']}})['then'](function(){_0x10b3fc();})[_0xcabc('0x17')](function(_0x129395){_0x10b3fc(_0x129395);});}else{_0x10b3fc();}}},'charset':_0xcabc('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd8a0=['FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','then','catch','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x2f8fef,_0x558b68){var _0x5c9a8d=function(_0x58d687){while(--_0x58d687){_0x2f8fef['push'](_0x2f8fef['shift']());}};_0x5c9a8d(++_0x558b68);}(_0xd8a0,0x153));var _0x0d8a=function(_0x301052,_0x5c2161){_0x301052=_0x301052-0x0;var _0x212047=_0xd8a0[_0x301052];return _0x212047;};'use strict';var _=require('lodash');var util=require(_0x0d8a('0x0'));var logger=require(_0x0d8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d8a('0x3'));var rimraf=require(_0x0d8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x0d8a('0x5'));module[_0x0d8a('0x6')]=function(_0x2d0026,_0x1c4a7f){return _0x2d0026[_0x0d8a('0x7')](_0x0d8a('0x8'),attributes,{'tableName':_0x0d8a('0x9'),'paranoid':![],'indexes':[{'name':_0x0d8a('0xa'),'fields':['subject','to'],'type':_0x0d8a('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4960dc,_0x32ef93,_0x4607b9){if(_0x4960dc['substatus']){_0x4960dc[_0x0d8a('0xc')]=moment()[_0x0d8a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4960dc[_0x0d8a('0xe')]){_0x4960dc[_0x0d8a('0xf')]=moment()[_0x0d8a('0xd')](_0x0d8a('0x10'));}_0x4607b9(null,_0x32ef93);},'beforeUpdate':function(_0x3049ef,_0x3a25af,_0x55e10a){if(_0x3049ef[_0x0d8a('0x11')]('substatus')){_0x3049ef[_0x0d8a('0xc')]=_0x3049ef[_0x0d8a('0x12')]?moment()[_0x0d8a('0xd')](_0x0d8a('0x10')):null;}if(_0x3049ef['changed'](_0x0d8a('0xe'))){_0x3049ef['closedAt']=moment()['format'](_0x0d8a('0x10'));_0x3049ef[_0x0d8a('0x12')]=null;_0x3049ef[_0x0d8a('0xc')]=null;}_0x55e10a(null,_0x3049ef);},'afterUpdate':function(_0x5acc1a,_0x1dbeb7,_0x2b8d94){var _0x185340=_0x2d0026[_0x0d8a('0x13')];var _0x17f1d4=_0x5acc1a[_0x0d8a('0x14')]({'plain':!![]});if(_0x17f1d4[_0x0d8a('0xe')]){return _0x185340[_0x0d8a('0x15')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x17f1d4['id']}})[_0x0d8a('0x16')](function(){_0x2b8d94();})[_0x0d8a('0x17')](function(_0x3d0d76){_0x2b8d94(_0x3d0d76);});}else{_0x2b8d94();}}},'charset':'utf8mb4','collate':_0x0d8a('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 976f26f..6ba99d0 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 _0x9802=['../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','then','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x13fa8b,_0x25b6c8){var _0x53243a=function(_0x5261ce){while(--_0x5261ce){_0x13fa8b['push'](_0x13fa8b['shift']());}};_0x53243a(++_0x25b6c8);}(_0x9802,0xf6));var _0x2980=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x9802[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x2980('0x0'));var util=require(_0x2980('0x1'));var moment=require(_0x2980('0x2'));var BPromise=require('bluebird');var rs=require(_0x2980('0x3'));var fs=require('fs');var Redis=require(_0x2980('0x4'));var db=require(_0x2980('0x5'))['db'];var utils=require(_0x2980('0x6'));var logger=require(_0x2980('0x7'))('rpc');var config=require(_0x2980('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2980('0x9')]=_[_0x2980('0xa')](config[_0x2980('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2980('0xb'))(new Redis(config[_0x2980('0x9')]));require(_0x2980('0xc'))[_0x2980('0xd')](socket);function respondWithRpcPromise(_0x3cbaa9,_0x222f2f,_0x893aa0){return new BPromise(function(_0x2e7da9,_0x5a4ec8){return client['request'](_0x3cbaa9,_0x893aa0)['then'](function(_0x13e50b){logger[_0x2980('0xe')](_0x2980('0xf'),_0x222f2f,_0x2980('0x10'));logger[_0x2980('0x11')](_0x2980('0x12'),_0x222f2f,'request\x20sent',JSON[_0x2980('0x13')](_0x13e50b));if(_0x13e50b['error']){if(_0x13e50b[_0x2980('0x14')][_0x2980('0x15')]===0x1f4){logger[_0x2980('0x14')](_0x2980('0xf'),_0x222f2f,_0x13e50b[_0x2980('0x14')][_0x2980('0x16')]);return _0x5a4ec8(_0x13e50b['error'][_0x2980('0x16')]);}logger[_0x2980('0x14')](_0x2980('0xf'),_0x222f2f,_0x13e50b['error'][_0x2980('0x16')]);return _0x2e7da9(_0x13e50b['error'][_0x2980('0x16')]);}else{logger[_0x2980('0xe')](_0x2980('0xf'),_0x222f2f,_0x2980('0x10'));_0x2e7da9(_0x13e50b[_0x2980('0x17')][_0x2980('0x16')]);}})[_0x2980('0x18')](function(_0x5d6455){logger['error'](_0x2980('0xf'),_0x222f2f,_0x5d6455);_0x5a4ec8(_0x5d6455);});});}exports[_0x2980('0x19')]=function(_0x5e9bbf){var _0xb0d58a=this;return new Promise(function(_0x1bc158,_0x7f719f){return db[_0x2980('0x1a')][_0x2980('0x1b')](_0x5e9bbf[_0x2980('0x1c')],{'raw':_0x5e9bbf[_0x2980('0x1d')]?_0x5e9bbf[_0x2980('0x1d')][_0x2980('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e9bbf['options']?_0x5e9bbf[_0x2980('0x1d')]['where']||null:null,'attributes':_0x5e9bbf[_0x2980('0x1d')]?_0x5e9bbf['options'][_0x2980('0x1f')]||null:null,'limit':_0x5e9bbf['options']?_0x5e9bbf['options'][_0x2980('0x20')]||null:null})[_0x2980('0x21')](function(_0x1bc4a2){logger['info'](_0x2980('0x19'),_0x5e9bbf);logger[_0x2980('0x11')]('UpdateMailInteraction',_0x5e9bbf,JSON[_0x2980('0x13')](_0x1bc4a2));_0x1bc158(_0x1bc4a2);})[_0x2980('0x18')](function(_0x2c54cb){logger[_0x2980('0x14')](_0x2980('0x19'),_0x2c54cb[_0x2980('0x16')],_0x5e9bbf);_0x7f719f(_0xb0d58a[_0x2980('0x14')](0x1f4,_0x2c54cb[_0x2980('0x16')]));});});};exports[_0x2980('0x22')]=function(_0x51de87){return new Promise(function(_0x43e092,_0x2e0f4d){return db[_0x2980('0x1a')][_0x2980('0x23')]({'where':_0x51de87[_0x2980('0x1d')]?_0x51de87[_0x2980('0x1d')][_0x2980('0x24')]||null:null})[_0x2980('0x21')](function(_0x44689e){if(_0x44689e){return _0x44689e[_0x2980('0x25')](_0x51de87[_0x2980('0x1c')][_0x2980('0x26')],_[_0x2980('0x27')](_0x51de87['body'],[_0x2980('0x26'),'id'])||{});}})[_0x2980('0x28')](function(_0x21f382){logger['info']('AddTags',_0x51de87);logger['debug'](_0x2980('0x29'),_0x51de87,JSON[_0x2980('0x13')](_0x21f382));_0x43e092(_0x21f382);})[_0x2980('0x18')](function(_0x440304){logger['error'](_0x2980('0x29'),_0x440304[_0x2980('0x16')],_0x51de87);_0x2e0f4d(_this[_0x2980('0x14')](0x1f4,_0x440304['message']));});});}; \ No newline at end of file +var _0x1eae=['catch','MailInteraction','update','body','options','raw','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2df56c,_0x26b29e){var _0x3ab486=function(_0x44cada){while(--_0x44cada){_0x2df56c['push'](_0x2df56c['shift']());}};_0x3ab486(++_0x26b29e);}(_0x1eae,0x12e));var _0xe1ea=function(_0x1dc89c,_0x257577){_0x1dc89c=_0x1dc89c-0x0;var _0x32ff3e=_0x1eae[_0x1dc89c];return _0x32ff3e;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require(_0xe1ea('0x6'))['db'];var utils=require(_0xe1ea('0x7'));var logger=require('../../config/logger')(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require(_0xe1ea('0xa'));var client=jayson['client'][_0xe1ea('0xb')]({'port':0x232a});config[_0xe1ea('0xc')]=_['defaults'](config[_0xe1ea('0xc')],{'host':_0xe1ea('0xd'),'port':0x18eb});var socket=require(_0xe1ea('0xe'))(new Redis(config[_0xe1ea('0xc')]));require(_0xe1ea('0xf'))[_0xe1ea('0x10')](socket);function respondWithRpcPromise(_0x1e01a2,_0x88943e,_0x32a16e){return new BPromise(function(_0x4edf43,_0x5e3eed){return client[_0xe1ea('0x11')](_0x1e01a2,_0x32a16e)[_0xe1ea('0x12')](function(_0x1f0a0e){logger[_0xe1ea('0x13')](_0xe1ea('0x14'),_0x88943e,_0xe1ea('0x15'));logger[_0xe1ea('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x88943e,_0xe1ea('0x15'),JSON[_0xe1ea('0x17')](_0x1f0a0e));if(_0x1f0a0e[_0xe1ea('0x18')]){if(_0x1f0a0e[_0xe1ea('0x18')]['code']===0x1f4){logger['error'](_0xe1ea('0x14'),_0x88943e,_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);return _0x5e3eed(_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);}logger['error'](_0xe1ea('0x14'),_0x88943e,_0x1f0a0e[_0xe1ea('0x18')]['message']);return _0x4edf43(_0x1f0a0e[_0xe1ea('0x18')][_0xe1ea('0x19')]);}else{logger[_0xe1ea('0x13')](_0xe1ea('0x14'),_0x88943e,_0xe1ea('0x15'));_0x4edf43(_0x1f0a0e['result'][_0xe1ea('0x19')]);}})[_0xe1ea('0x1a')](function(_0x4cff2c){logger['error'](_0xe1ea('0x14'),_0x88943e,_0x4cff2c);_0x5e3eed(_0x4cff2c);});});}exports['UpdateMailInteraction']=function(_0x1936fa){var _0x13ff12=this;return new Promise(function(_0x4b1e86,_0x211274){return db[_0xe1ea('0x1b')][_0xe1ea('0x1c')](_0x1936fa[_0xe1ea('0x1d')],{'raw':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')]['where']||null:null,'attributes':_0x1936fa['options']?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x20')]||null:null,'limit':_0x1936fa[_0xe1ea('0x1e')]?_0x1936fa[_0xe1ea('0x1e')][_0xe1ea('0x21')]||null:null})[_0xe1ea('0x12')](function(_0x555b5f){logger[_0xe1ea('0x13')](_0xe1ea('0x22'),_0x1936fa);logger[_0xe1ea('0x16')]('UpdateMailInteraction',_0x1936fa,JSON[_0xe1ea('0x17')](_0x555b5f));_0x4b1e86(_0x555b5f);})['catch'](function(_0x35a503){logger['error'](_0xe1ea('0x22'),_0x35a503[_0xe1ea('0x19')],_0x1936fa);_0x211274(_0x13ff12[_0xe1ea('0x18')](0x1f4,_0x35a503[_0xe1ea('0x19')]));});});};exports[_0xe1ea('0x23')]=function(_0x58f1df){return new Promise(function(_0x3ee4f8,_0x4a78e9){return db[_0xe1ea('0x1b')][_0xe1ea('0x24')]({'where':_0x58f1df[_0xe1ea('0x1e')]?_0x58f1df[_0xe1ea('0x1e')]['where']||null:null})[_0xe1ea('0x12')](function(_0x340316){if(_0x340316){return _0x340316[_0xe1ea('0x25')](_0x58f1df[_0xe1ea('0x1d')][_0xe1ea('0x26')],_[_0xe1ea('0x27')](_0x58f1df[_0xe1ea('0x1d')],[_0xe1ea('0x26'),'id'])||{});}})[_0xe1ea('0x28')](function(_0x20942b){logger[_0xe1ea('0x13')]('AddTags',_0x58f1df);logger[_0xe1ea('0x16')]('AddTags',_0x58f1df,JSON[_0xe1ea('0x17')](_0x20942b));_0x3ee4f8(_0x20942b);})[_0xe1ea('0x1a')](function(_0x9e0d4e){logger[_0xe1ea('0x18')]('AddTags',_0x9e0d4e[_0xe1ea('0x19')],_0x58f1df);_0x4a78e9(_this[_0xe1ea('0x18')](0x1f4,_0x9e0d4e[_0xe1ea('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 172f678..36eb38f 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 _0x1715=['./mailInteraction.events','save','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x1e2c04,_0x7d2021){var _0x1b596f=function(_0x2ae1a2){while(--_0x2ae1a2){_0x1e2c04['push'](_0x1e2c04['shift']());}};_0x1b596f(++_0x7d2021);}(_0x1715,0xbd));var _0x5171=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1715[_0x2dafbe];return _0x58a45a;};'use strict';var MailInteractionEvents=require(_0x5171('0x0'));var events=[_0x5171('0x1'),_0x5171('0x2'),_0x5171('0x3')];function createListener(_0xbbaf8d,_0x43539b){return function(_0x22d22a){_0x43539b[_0x5171('0x4')](_0xbbaf8d,_0x22d22a);};}function removeListener(_0x213120,_0x5a036c){return function(){MailInteractionEvents[_0x5171('0x5')](_0x213120,_0x5a036c);};}exports[_0x5171('0x6')]=function(_0xc9b63){for(var _0x3eabba=0x0,_0x20de43=events[_0x5171('0x7')];_0x3eabba<_0x20de43;_0x3eabba++){var _0x32df0f=events[_0x3eabba];var _0x56f624=createListener(_0x5171('0x8')+_0x32df0f,_0xc9b63);MailInteractionEvents['on'](_0x32df0f,_0x56f624);}}; \ No newline at end of file +var _0x766f=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4f7a17,_0x237ece){var _0x459fae=function(_0x4de820){while(--_0x4de820){_0x4f7a17['push'](_0x4f7a17['shift']());}};_0x459fae(++_0x237ece);}(_0x766f,0xa1));var _0xf766=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x766f[_0x26462c];return _0x509a42;};'use strict';var MailInteractionEvents=require(_0xf766('0x0'));var events=[_0xf766('0x1'),_0xf766('0x2'),_0xf766('0x3')];function createListener(_0x38db75,_0x2fe82d){return function(_0x95bacd){_0x2fe82d[_0xf766('0x4')](_0x38db75,_0x95bacd);};}function removeListener(_0x47cbaa,_0x311f7d){return function(){MailInteractionEvents[_0xf766('0x5')](_0x47cbaa,_0x311f7d);};}exports[_0xf766('0x6')]=function(_0x39f1c5){for(var _0x4e81f8=0x0,_0x4ffb48=events[_0xf766('0x7')];_0x4e81f8<_0x4ffb48;_0x4e81f8++){var _0x4582c5=events[_0x4e81f8];var _0x29f9bd=createListener(_0xf766('0x8')+_0x4582c5,_0x39f1c5);MailInteractionEvents['on'](_0x4582c5,_0x29f9bd);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a2334c4..1823add 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 _0x7229=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x7229,0x76));var _0x9722=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x7229[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var path=require(_0x9722('0x2'));var timeout=require(_0x9722('0x3'));var express=require(_0x9722('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9722('0x5'));var interaction=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var controller=require(_0x9722('0x8'));router[_0x9722('0x9')]('/',auth[_0x9722('0xa')](),controller[_0x9722('0xb')]);router['get'](_0x9722('0xc'),auth['isAuthenticated'](),controller[_0x9722('0xd')]);router[_0x9722('0x9')](_0x9722('0xe'),auth[_0x9722('0xa')](),controller[_0x9722('0xf')]);router[_0x9722('0x9')](_0x9722('0x10'),auth[_0x9722('0xa')](),controller['download']);router['post']('/',auth[_0x9722('0xa')](),interaction[_0x9722('0x11')](_0x9722('0x12'),_0x9722('0x13')),controller['create']);router[_0x9722('0x14')](_0x9722('0xe'),auth[_0x9722('0xa')](),controller[_0x9722('0x15')]);router['put'](_0x9722('0x16'),auth[_0x9722('0xa')](),controller[_0x9722('0x17')]);router[_0x9722('0x14')](_0x9722('0x18'),auth['isAuthenticated'](),controller[_0x9722('0x19')]);router[_0x9722('0x1a')](_0x9722('0xe'),auth['isAuthenticated'](),controller[_0x9722('0x1b')]);module[_0x9722('0x1c')]=router; \ No newline at end of file +var _0x1eaa=['index','get','/:id','show','/:id/download','download','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','isAuthenticated'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1eaa,0x1c7));var _0xa1ea=function(_0x4029ae,_0x423d8d){_0x4029ae=_0x4029ae-0x0;var _0x5a6db8=_0x1eaa[_0x4029ae];return _0x5a6db8;};'use strict';var multer=require(_0xa1ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa1ea('0x1'));var express=require(_0xa1ea('0x2'));var router=express['Router']();var fs_extra=require(_0xa1ea('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa1ea('0x4'));var controller=require(_0xa1ea('0x5'));router['get']('/',auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x7')]);router[_0xa1ea('0x8')]('/describe',auth[_0xa1ea('0x6')](),controller['describe']);router['get'](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xa')]);router[_0xa1ea('0x8')](_0xa1ea('0xb'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xc')]);router['post']('/',auth[_0xa1ea('0x6')](),interaction['tracked']('mail',_0xa1ea('0xd')),controller['create']);router[_0xa1ea('0xe')](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0xf')]);router[_0xa1ea('0xe')](_0xa1ea('0x10'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x11')]);router['put'](_0xa1ea('0x12'),auth[_0xa1ea('0x6')](),controller['reject']);router[_0xa1ea('0x13')](_0xa1ea('0x9'),auth[_0xa1ea('0x6')](),controller[_0xa1ea('0x14')]);module[_0xa1ea('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e29808c..bf93cdf 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 _0xa3e2=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','Chat','sequelize','lodash'];(function(_0x182f48,_0x2b51fc){var _0x5197b3=function(_0x48c3ff){while(--_0x48c3ff){_0x182f48['push'](_0x182f48['shift']());}};_0x5197b3(++_0x2b51fc);}(_0xa3e2,0x150));var _0x2a3e=function(_0x4a1412,_0x2b6ee8){_0x4a1412=_0x4a1412-0x0;var _0x2cc456=_0xa3e2[_0x4a1412];return _0x2cc456;};'use strict';var Sequelize=require(_0x2a3e('0x0'));var _=require(_0x2a3e('0x1'));module[_0x2a3e('0x2')]={'body':{'type':Sequelize[_0x2a3e('0x3')](_0x2a3e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2a3e('0x3')](_0x2a3e('0x5'))},'read':{'type':Sequelize[_0x2a3e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a3e('0x7')]('in',_0x2a3e('0x8')),'defaultValue':_0x2a3e('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2a3e('0x9')]},'to':{'type':Sequelize[_0x2a3e('0x3')]('long')},'cc':{'type':Sequelize[_0x2a3e('0x3')](_0x2a3e('0x4'))},'bcc':{'type':Sequelize[_0x2a3e('0x3')](_0x2a3e('0x4'))},'subject':{'type':Sequelize[_0x2a3e('0x3')]},'sentAt':{'type':Sequelize[_0x2a3e('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2a3e('0xa')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x2a3e('0x3')](_0x2a3e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x2a3e('0xb'),_0x2a3e('0xc')),'defaultValue':_0x2a3e('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xfd2e=['INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x2a8d56,_0x15ecd6){var _0x49b237=function(_0x42df46){while(--_0x42df46){_0x2a8d56['push'](_0x2a8d56['shift']());}};_0x49b237(++_0x15ecd6);}(_0xfd2e,0x1a3));var _0xefd2=function(_0x18cebb,_0x5b75eb){_0x18cebb=_0x18cebb-0x0;var _0x1e060e=_0xfd2e[_0x18cebb];return _0x1e060e;};'use strict';var Sequelize=require(_0xefd2('0x0'));var _=require(_0xefd2('0x1'));module[_0xefd2('0x2')]={'body':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x5'))},'read':{'type':Sequelize[_0xefd2('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xefd2('0x7')]('in','out'),'defaultValue':_0xefd2('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xefd2('0x9')](0x1fe)},'from':{'type':Sequelize[_0xefd2('0x9')]},'to':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'cc':{'type':Sequelize[_0xefd2('0x3')]('long')},'bcc':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'subject':{'type':Sequelize[_0xefd2('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xefd2('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xefd2('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'originCc':{'type':Sequelize[_0xefd2('0x3')](_0xefd2('0x4'))},'originChannel':{'type':Sequelize[_0xefd2('0x7')](_0xefd2('0xb'),_0xefd2('0xc')),'defaultValue':_0xefd2('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1f5ddfb..0047a31 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 _0xd4ce=['hasOwnProperty','limit','order','sort','pick','filter','merge','where','type','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','create','out','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','root','server','tmp','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','status','json','undefined','offset','set','update','destroy','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x28f5fa,_0x389b71){var _0x3b67d3=function(_0x3c5ca4){while(--_0x3c5ca4){_0x28f5fa['push'](_0x28f5fa['shift']());}};_0x3b67d3(++_0x389b71);}(_0xd4ce,0x6b));var _0xed4c=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd4ce[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var moment=require(_0xed4c('0x0'));var BPromise=require(_0xed4c('0x1'));var util=require(_0xed4c('0x2'));var path=require(_0xed4c('0x3'));var fs=require('fs');var _=require(_0xed4c('0x4'));var Redis=require(_0xed4c('0x5'));var htmlToText=require(_0xed4c('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xed4c('0x7'))('api');var interaction_log=require(_0xed4c('0x7'))(_0xed4c('0x8'));var config=require(_0xed4c('0x9'));var db=require(_0xed4c('0xa'))['db'];config[_0xed4c('0xb')]=_[_0xed4c('0xc')](config[_0xed4c('0xb')],{'host':_0xed4c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed4c('0xb')]));var htmlEntities=require('html-entities');require(_0xed4c('0xe'))[_0xed4c('0xf')](socket);var jayson=require(_0xed4c('0x10'));var client=jayson[_0xed4c('0x11')][_0xed4c('0x12')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson['client'][_0xed4c('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x3dbe03,_0x48cb50,_0x51d58d,_0x19ac43){return new BPromise(function(_0x4ad52b,_0x1e1225){var _0x499a21=_0x19ac43||client;return _0x499a21['request'](_0x3dbe03,_0x51d58d)[_0xed4c('0x13')](function(_0x1b2bac){logger[_0xed4c('0x14')](_0xed4c('0x15'),_0x48cb50,'request\x20sent');logger[_0xed4c('0x16')](_0xed4c('0x17'),_0x48cb50,_0xed4c('0x18'),JSON['stringify'](_0x1b2bac));if(_0x1b2bac[_0xed4c('0x19')]){if(_0x1b2bac[_0xed4c('0x19')][_0xed4c('0x1a')]===0x1f4){logger['error'](_0xed4c('0x15'),_0x48cb50,_0x1b2bac[_0xed4c('0x19')][_0xed4c('0x1b')]);return _0x1e1225(_0x1b2bac[_0xed4c('0x19')]['message']);}logger[_0xed4c('0x19')](_0xed4c('0x15'),_0x48cb50,_0x1b2bac[_0xed4c('0x19')][_0xed4c('0x1b')]);return _0x4ad52b(_0x1b2bac['error'][_0xed4c('0x1b')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48cb50,_0xed4c('0x18'));_0x4ad52b(_0x1b2bac['result'][_0xed4c('0x1b')]);}})['catch'](function(_0x5675c6){logger[_0xed4c('0x19')](_0xed4c('0x15'),_0x48cb50,_0x5675c6);_0x1e1225(_0x5675c6);});});}function respondWithResult(_0x4d4d15,_0x1900f4){_0x1900f4=_0x1900f4||0xc8;return function(_0x36d814){if(_0x36d814){return _0x4d4d15[_0xed4c('0x1c')](_0x1900f4)[_0xed4c('0x1d')](_0x36d814);}};}function respondWithFilteredResult(_0x19c490,_0x19b4bc){return function(_0x5027b0){if(_0x5027b0){var _0x171889=typeof _0x19b4bc['offset']===_0xed4c('0x1e')&&typeof _0x19b4bc['limit']===_0xed4c('0x1e');var _0x4af6b2=_0x5027b0['count'];var _0x363bf8=_0x171889?0x0:_0x19b4bc[_0xed4c('0x1f')];var _0x328340=_0x171889?_0x5027b0['count']:_0x19b4bc[_0xed4c('0x1f')]+_0x19b4bc['limit'];var _0x3872d1;if(_0x328340>=_0x4af6b2){_0x328340=_0x4af6b2;_0x3872d1=0xc8;}else{_0x3872d1=0xce;}_0x19c490[_0xed4c('0x1c')](_0x3872d1);return _0x19c490[_0xed4c('0x20')]('Content-Range',_0x363bf8+'-'+_0x328340+'/'+_0x4af6b2)[_0xed4c('0x1d')](_0x5027b0);}return null;};}function saveUpdates(_0x1ce7ed){return function(_0x417ca2){if(_0x417ca2){return _0x417ca2[_0xed4c('0x21')](_0x1ce7ed)[_0xed4c('0x13')](function(_0xf52a9a){return _0xf52a9a;});}return null;};}function removeEntity(_0x597068){return function(_0x5abf63){if(_0x5abf63){return _0x5abf63[_0xed4c('0x22')]()['then'](function(){_0x597068[_0xed4c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2401d4){return function(_0x2bbe25){if(!_0x2bbe25){_0x2401d4[_0xed4c('0x23')](0x194);}return _0x2bbe25;};}function handleError(_0x457105,_0x54f0eb){_0x54f0eb=_0x54f0eb||0x1f4;return function(_0x247f3a){logger[_0xed4c('0x19')](_0x247f3a[_0xed4c('0x24')]);if(_0x247f3a[_0xed4c('0x25')]){delete _0x247f3a[_0xed4c('0x25')];}_0x457105[_0xed4c('0x1c')](_0x54f0eb)[_0xed4c('0x26')](_0x247f3a);};}exports[_0xed4c('0x27')]=function(_0x2662e6,_0xd6a642){var _0x132ddf={},_0x4981da={},_0x218186={'count':0x0,'rows':[]};var _0x59be19=_[_0xed4c('0x28')](db[_0xed4c('0x29')][_0xed4c('0x2a')],function(_0x1f59b7){return{'name':_0x1f59b7['fieldName'],'type':_0x1f59b7['type'][_0xed4c('0x2b')]};});_0x4981da['model']=_[_0xed4c('0x28')](_0x59be19,'name');_0x4981da[_0xed4c('0x2c')]=_['keys'](_0x2662e6[_0xed4c('0x2c')]);_0x4981da[_0xed4c('0x2d')]=_[_0xed4c('0x2e')](_0x4981da[_0xed4c('0x2f')],_0x4981da[_0xed4c('0x2c')]);_0x132ddf[_0xed4c('0x30')]=_['intersection'](_0x4981da[_0xed4c('0x2f')],qs['fields'](_0x2662e6['query'][_0xed4c('0x31')]));_0x132ddf[_0xed4c('0x30')]=_0x132ddf[_0xed4c('0x30')][_0xed4c('0x32')]?_0x132ddf[_0xed4c('0x30')]:_0x4981da[_0xed4c('0x2f')];if(!_0x2662e6[_0xed4c('0x2c')][_0xed4c('0x33')]('nolimit')){_0x132ddf['limit']=qs[_0xed4c('0x34')](_0x2662e6[_0xed4c('0x2c')]['limit']);_0x132ddf[_0xed4c('0x1f')]=qs['offset'](_0x2662e6['query'][_0xed4c('0x1f')]);}_0x132ddf[_0xed4c('0x35')]=qs[_0xed4c('0x36')](_0x2662e6['query'][_0xed4c('0x36')]);_0x132ddf['where']=qs[_0xed4c('0x2d')](_[_0xed4c('0x37')](_0x2662e6[_0xed4c('0x2c')],_0x4981da[_0xed4c('0x2d')]),_0x59be19);if(_0x2662e6[_0xed4c('0x2c')][_0xed4c('0x38')]){_0x132ddf['where']=_[_0xed4c('0x39')](_0x132ddf[_0xed4c('0x3a')],{'$or':_[_0xed4c('0x28')](_0x59be19,function(_0x156160){if(_0x156160[_0xed4c('0x3b')]!=='VIRTUAL'){var _0x27cae3={};_0x27cae3[_0x156160['name']]={'$like':'%'+_0x2662e6[_0xed4c('0x2c')][_0xed4c('0x38')]+'%'};return _0x27cae3;}})});}_0x132ddf=_[_0xed4c('0x39')]({},_0x132ddf,_0x2662e6[_0xed4c('0x3c')]);var _0x5d3816={'where':_0x132ddf[_0xed4c('0x3a')]};return db['MailMessage'][_0xed4c('0x3d')](_0x5d3816)['then'](function(_0x5305f0){_0x218186[_0xed4c('0x3d')]=_0x5305f0;if(_0x2662e6[_0xed4c('0x2c')][_0xed4c('0x3e')]){_0x132ddf[_0xed4c('0x3f')]=[{'all':!![]}];}return db[_0xed4c('0x29')][_0xed4c('0x40')](_0x132ddf);})[_0xed4c('0x13')](function(_0xc451bb){_0x218186[_0xed4c('0x41')]=_0xc451bb;return _0x218186;})[_0xed4c('0x13')](respondWithFilteredResult(_0xd6a642,_0x132ddf))[_0xed4c('0x42')](handleError(_0xd6a642,null));};exports[_0xed4c('0x43')]=function(_0x2753ee,_0x170585){var _0x2fb679={'raw':!![],'where':{'id':_0x2753ee[_0xed4c('0x44')]['id']}},_0x2b8262={};_0x2b8262[_0xed4c('0x2f')]=_[_0xed4c('0x45')](db['MailMessage'][_0xed4c('0x2a')]);_0x2b8262['query']=_[_0xed4c('0x45')](_0x2753ee[_0xed4c('0x2c')]);_0x2b8262[_0xed4c('0x2d')]=_['intersection'](_0x2b8262[_0xed4c('0x2f')],_0x2b8262[_0xed4c('0x2c')]);_0x2fb679[_0xed4c('0x30')]=_[_0xed4c('0x2e')](_0x2b8262['model'],qs[_0xed4c('0x31')](_0x2753ee[_0xed4c('0x2c')][_0xed4c('0x31')]));_0x2fb679[_0xed4c('0x30')]=_0x2fb679['attributes']['length']?_0x2fb679[_0xed4c('0x30')]:_0x2b8262['model'];if(_0x2753ee[_0xed4c('0x2c')][_0xed4c('0x3e')]){_0x2fb679[_0xed4c('0x3f')]=[{'all':!![]}];}_0x2fb679=_[_0xed4c('0x39')]({},_0x2fb679,_0x2753ee[_0xed4c('0x3c')]);return db[_0xed4c('0x29')][_0xed4c('0x46')](_0x2fb679)['then'](handleEntityNotFound(_0x170585,null))[_0xed4c('0x13')](respondWithResult(_0x170585,null))[_0xed4c('0x42')](handleError(_0x170585,null));};exports[_0xed4c('0x21')]=function(_0x3b4657,_0xa8473e){if(_0x3b4657[_0xed4c('0x47')]['id']){delete _0x3b4657[_0xed4c('0x47')]['id'];}return db[_0xed4c('0x29')][_0xed4c('0x46')]({'where':{'id':_0x3b4657[_0xed4c('0x44')]['id']}})[_0xed4c('0x13')](handleEntityNotFound(_0xa8473e,null))['then'](saveUpdates(_0x3b4657[_0xed4c('0x47')],null))[_0xed4c('0x13')](respondWithResult(_0xa8473e,null))['catch'](handleError(_0xa8473e,null));};exports[_0xed4c('0x22')]=function(_0x5efcbc,_0x349ce6){return db[_0xed4c('0x29')][_0xed4c('0x46')]({'where':{'id':_0x5efcbc[_0xed4c('0x44')]['id']}})[_0xed4c('0x13')](handleEntityNotFound(_0x349ce6,null))[_0xed4c('0x13')](removeEntity(_0x349ce6,null))[_0xed4c('0x42')](handleError(_0x349ce6,null));};exports[_0xed4c('0x48')]=function(_0x4ec5ae,_0x2fc68b){return db['MailMessage'][_0xed4c('0x48')]()[_0xed4c('0x13')](respondWithResult(_0x2fc68b,null))[_0xed4c('0x42')](handleError(_0x2fc68b,null));};exports[_0xed4c('0x49')]=function(_0x64877d,_0x2f3cc4){return db[_0xed4c('0x29')]['create'](_0x64877d[_0xed4c('0x47')])[_0xed4c('0x13')](function(_0x1c3289){if(_0x1c3289){if(_0x1c3289['direction']===_0xed4c('0x4a')&&!_0x1c3289['secret']){var _0x36f14a,_0x55ae26,_0x48f2b2;if(_0x64877d[_0xed4c('0x47')]['to']){_0x55ae26=_0x64877d[_0xed4c('0x47')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xed4c('0x4b')]({'where':{'id':_0x1c3289['MailAccountId']},'include':[{'model':db[_0xed4c('0x4c')],'as':_0xed4c('0x4d'),'include':[{'model':db[_0xed4c('0x4e')],'as':_0xed4c('0x4f'),'where':{'email':_0x55ae26},'limit':0x1,'order':[['updatedAt',_0xed4c('0x50')]]}]},{'model':db[_0xed4c('0x51')],'as':_0xed4c('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xed4c('0x53'),'raw':!![]}]}]})['then'](function(_0xd9af1e){_0x36f14a=_0xd9af1e;if(!_0x36f14a||!_0x36f14a[_0xed4c('0x52')])return;var _0x1d054b=_0x36f14a[_0xed4c('0x54')]();if(_0x64877d[_0xed4c('0x47')]['attachments']&&_0x64877d['body'][_0xed4c('0x55')][_0xed4c('0x32')]){for(var _0x3e04e3=0x0;_0x3e04e3<_0x64877d[_0xed4c('0x47')]['attachments'][_0xed4c('0x32')];_0x3e04e3+=0x1){_0x64877d[_0xed4c('0x47')]['attachments'][_0x3e04e3]={'filename':_0x64877d['body'][_0xed4c('0x55')][_0x3e04e3][_0xed4c('0x25')],'path':path[_0xed4c('0x56')](config['root'],_0xed4c('0x57'),_0x64877d[_0xed4c('0x47')][_0xed4c('0x55')][_0x3e04e3]['basename'])};}}_0x48f2b2={'account':_0x1d054b,'message':_0x64877d['body']};return;})[_0xed4c('0x13')](function(){if(_0x36f14a['List']){if(_0x36f14a[_0xed4c('0x4d')][_0xed4c('0x4f')][_0xed4c('0x32')]){return _0x36f14a[_0xed4c('0x4d')][_0xed4c('0x4f')][0x0];}else{return db[_0xed4c('0x4e')][_0xed4c('0x49')](_[_0xed4c('0xc')](_0x64877d[_0xed4c('0x47')],{'firstName':_0x64877d['body']['to'],'email':_0x64877d['body']['to'],'phone':_0x64877d[_0xed4c('0x47')]['to'],'ListId':_0x36f14a['ListId']}));}}else{throw new Error(_0xed4c('0x58'));}})['then'](function(){if(_0x48f2b2){return respondWithRpcPromise(_0xed4c('0x59'),_0xed4c('0x5a'),_0x48f2b2,client9003)['then'](function(_0x4f98bb){return _0x1c3289[_0xed4c('0x21')]({'read':!![],'messageId':_0x4f98bb[_0xed4c('0x5b')],'sentAt':moment()[_0xed4c('0x5c')](_0xed4c('0x5d'))});})[_0xed4c('0x42')](function(_0x1109ef){logger['error']('%s',JSON['stringify'](_0x1109ef));return _0x1c3289;});}return _0x1c3289;});}return _0x1c3289;}})['then'](respondWithResult(_0x2f3cc4,0xc9))[_0xed4c('0x42')](handleError(_0x2f3cc4,null));};exports[_0xed4c('0x5e')]=function(_0x199381,_0x238835){var _0x513a58={'agent':{},'channel':_0xed4c('0x5f')};if(_0x199381[_0xed4c('0x47')]['id']){delete _0x199381[_0xed4c('0x47')]['id'];}_0x199381['body'][_0xed4c('0x60')]=!![];_0x199381['body']['readAt']=moment()[_0xed4c('0x5c')](_0xed4c('0x5d'));_0x199381[_0xed4c('0x47')]['UserId']=_0x199381['body'][_0xed4c('0x61')]||_0x199381[_0xed4c('0x62')]['id'];_0x513a58[_0xed4c('0x63')]['id']=_0x199381[_0xed4c('0x47')][_0xed4c('0x61')];return db['MailMessage']['find']({'where':{'id':_0x199381[_0xed4c('0x44')]['id'],'UserId':null}})[_0xed4c('0x13')](handleEntityNotFound(_0x238835,null))[_0xed4c('0x13')](saveUpdates(_0x199381[_0xed4c('0x47')],null))[_0xed4c('0x13')](function(_0xa61365){if(_0xa61365){_0x513a58['message']=_0xa61365[_0xed4c('0x64')]({'plain':!![]});return db[_0xed4c('0x65')][_0xed4c('0x46')]({'where':{'id':_0xa61365[_0xed4c('0x66')]}});}return null;})[_0xed4c('0x13')](handleEntityNotFound(_0x238835,null))[_0xed4c('0x13')](function(_0x554059){if(_0x554059){return _0x554059[_0xed4c('0x21')]({'UserId':_0x199381['body'][_0xed4c('0x61')],'read1stAt':_[_0xed4c('0x67')](_0x554059[_0xed4c('0x68')])?moment()['format'](_0xed4c('0x5d')):undefined});}return null;})[_0xed4c('0x13')](function(_0xcde11f){if(_0xcde11f){_0x513a58[_0xed4c('0x69')]=_0xcde11f[_0xed4c('0x64')]({'plain':!![]});interaction_log[_0xed4c('0x14')](_0xed4c('0x6a'),_0x199381['user']['id'],_0x199381[_0xed4c('0x62')]['name'],_0x199381['user'][_0xed4c('0x6b')],_0x513a58[_0xed4c('0x69')]['id'],_0x199381[_0xed4c('0x47')]?JSON[_0xed4c('0x6c')](_0x199381['body']):_0xed4c('0x6d'));return respondWithRpcPromise(_0xed4c('0x6e'),_0xed4c('0x6f'),_0x513a58);}return null;})[_0xed4c('0x13')](function(_0x4b7684){var _0x3a379f=_0xed4c('0x70')+_0x4b7684[_0xed4c('0x1b')][_0xed4c('0x71')];return db[_0xed4c('0x72')][_0xed4c('0x2c')](_0x3a379f,{'type':db[_0xed4c('0x73')][_0xed4c('0x74')][_0xed4c('0x75')],'raw':!![]})[_0xed4c('0x13')](function(_0x15ec26){return _0x15ec26;});})[_0xed4c('0x13')](function(_0x3a942f){if(_0x3a942f){_0x513a58['message'][_0xed4c('0x76')]=_0x3a942f[0x0];if(!_0x199381['body'][_0xed4c('0x61')])return;return db[_0xed4c('0x77')][_0xed4c('0x46')]({'where':{'id':_0x199381[_0xed4c('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0xed4c('0x25'),_0xed4c('0x78'),_0xed4c('0x79'),_0xed4c('0x7a')],'raw':!![]});}return null;})['then'](function(_0x2dbb18){if(!_0x2dbb18)return null;_0x513a58[_0xed4c('0x1b')][_0xed4c('0x63')]=_0x2dbb18;return _0x513a58;})[_0xed4c('0x13')](function(_0x3a84af){if(_0x3a84af){if(_0x199381[_0xed4c('0x47')][_0xed4c('0x7b')]){_0x513a58[_0xed4c('0x1b')][_0xed4c('0x7c')]=util['format'](_0xed4c('0x7d'),_0x199381[_0xed4c('0x62')][_0xed4c('0x25')]);_0x513a58[_0xed4c('0x1b')][_0xed4c('0x7e')]=_0x513a58[_0xed4c('0x7e')];_0x513a58[_0xed4c('0x1b')][_0xed4c('0x7f')]=_0x513a58['channel'];_0x513a58[_0xed4c('0x1b')]['event']='accept';_0x513a58['message']['body']=htmlToText[_0xed4c('0x80')](_0x513a58[_0xed4c('0x1b')][_0xed4c('0x47')]);return respondWithRpcPromise(_0xed4c('0x81'),_0xed4c('0x81'),{'event':'acceptmessage','message':_0x513a58['message']},client9002)['then'](function(){return _0x513a58;});}return _0x513a58;}return null;})[_0xed4c('0x13')](respondWithResult(_0x238835,null))[_0xed4c('0x42')](handleError(_0x238835,null));};exports[_0xed4c('0x82')]=function(_0x179557,_0x3a734f){var _0x190953={'agent':{},'channel':_0xed4c('0x5f')};if(_0x179557[_0xed4c('0x47')]['id']){delete _0x179557[_0xed4c('0x47')]['id'];}_0x179557['body'][_0xed4c('0x61')]=_0x179557[_0xed4c('0x47')][_0xed4c('0x61')]||_0x179557[_0xed4c('0x62')]['id'];_0x190953[_0xed4c('0x63')]['id']=_0x179557[_0xed4c('0x47')][_0xed4c('0x61')];return db[_0xed4c('0x29')]['find']({'where':{'id':_0x179557[_0xed4c('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a734f,null))[_0xed4c('0x13')](function(_0x37bde0){if(_0x37bde0){_0x190953[_0xed4c('0x1b')]=_0x37bde0['get']({'plain':!![]});return db[_0xed4c('0x65')][_0xed4c('0x46')]({'where':{'id':_0x37bde0[_0xed4c('0x66')]}});}return null;})[_0xed4c('0x13')](handleEntityNotFound(_0x3a734f,null))[_0xed4c('0x13')](function(_0x33775f){if(_0x33775f){_0x190953[_0xed4c('0x69')]=_0x33775f[_0xed4c('0x64')]({'plain':!![]});interaction_log[_0xed4c('0x14')](_0xed4c('0x83'),_0x179557[_0xed4c('0x62')]['id'],_0x179557[_0xed4c('0x62')][_0xed4c('0x25')],_0x179557['user'][_0xed4c('0x6b')],_0x190953[_0xed4c('0x69')]['id'],_0x179557[_0xed4c('0x47')]?JSON['stringify'](_0x179557[_0xed4c('0x47')]):_0xed4c('0x6d'));return respondWithRpcPromise(_0xed4c('0x84'),_0xed4c('0x85'),_0x190953);}return null;})['then'](function(_0x4eb879){var _0xcc8ab3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4eb879[_0xed4c('0x1b')][_0xed4c('0x71')];return db[_0xed4c('0x72')][_0xed4c('0x2c')](_0xcc8ab3,{'type':db[_0xed4c('0x73')][_0xed4c('0x74')][_0xed4c('0x75')],'raw':!![]})[_0xed4c('0x13')](function(_0xdaeb2b){return _0xdaeb2b;});})['then'](function(_0x4df0f6){if(_0x4df0f6){_0x190953['message'][_0xed4c('0x76')]=_0x4df0f6[0x0];if(!_0x179557['body'][_0xed4c('0x61')])return;return db[_0xed4c('0x77')]['find']({'where':{'id':_0x179557[_0xed4c('0x47')]['UserId'],'role':_0xed4c('0x63')},'attributes':['id',_0xed4c('0x25'),'fullname','email',_0xed4c('0x7a')],'raw':!![]});}return null;})[_0xed4c('0x13')](function(_0x217370){if(!_0x217370)return null;_0x190953[_0xed4c('0x1b')]['agent']=_0x217370;return _0x190953;})[_0xed4c('0x13')](function(_0x512e61){if(_0x512e61){_0x512e61[_0xed4c('0x1b')]['interface']=util[_0xed4c('0x5c')](_0xed4c('0x7d'),_0x179557[_0xed4c('0x62')][_0xed4c('0x25')]);_0x512e61[_0xed4c('0x1b')]['channel']=_0x190953[_0xed4c('0x7e')];_0x512e61[_0xed4c('0x1b')]['motionChannel']=_0x190953[_0xed4c('0x7e')];_0x512e61[_0xed4c('0x1b')]['event']=_0xed4c('0x82');_0x512e61[_0xed4c('0x1b')][_0xed4c('0x47')]=htmlToText[_0xed4c('0x80')](_0x190953[_0xed4c('0x1b')][_0xed4c('0x47')]);respondWithRpcPromise(_0xed4c('0x81'),_0xed4c('0x81'),{'event':_0xed4c('0x86'),'message':_0x512e61[_0xed4c('0x1b')]},client9002);return _0x190953;}return null;})['then'](respondWithResult(_0x3a734f,null))[_0xed4c('0x42')](handleError(_0x3a734f,null));};exports[_0xed4c('0x87')]=function(_0x4f7618,_0x1eb1ca){var _0x4737ea=moment()[_0xed4c('0x88')]()[_0xed4c('0x89')]();var _0x16a8b7=path['join'](config[_0xed4c('0x8a')],_0xed4c('0x8b'),'files',_0xed4c('0x8c'));var _0x55d829=path[_0xed4c('0x56')](config[_0xed4c('0x8a')],'server',_0xed4c('0x8d'),'attachments');var _0x24b111=util[_0xed4c('0x5c')](_0xed4c('0x8e'),_0x4737ea);return db[_0xed4c('0x29')][_0xed4c('0x46')]({'where':{'id':_0x4f7618[_0xed4c('0x44')]['id']},'attributes':['id',_0xed4c('0x47'),_0xed4c('0x8f'),'to','cc','bcc',_0xed4c('0x90'),_0xed4c('0x91')],'include':_0x4f7618[_0xed4c('0x2c')][_0xed4c('0x55')]?[{'model':db[_0xed4c('0x92')],'as':_0xed4c('0x93')}]:undefined})[_0xed4c('0x13')](handleEntityNotFound(_0x1eb1ca,null))['then'](function(_0x2bfb5e){if(_0x2bfb5e){var _0x1d52e0=_0x2bfb5e;var _0x57eb5e={'from':_0x1d52e0[_0xed4c('0x8f')],'to':_0x1d52e0['to'],'subject':_0x1d52e0['subject'],'html':htmlEntities['decode'](_0x1d52e0[_0xed4c('0x47')]),'headers':{'Date':moment(_0x1d52e0[_0xed4c('0x91')])['format'](_0xed4c('0x94'))},'attachments':[]};if(_0x2bfb5e['cc']){_0x57eb5e[_0xed4c('0x95')]['Cc']=_0x2bfb5e['cc'];}if(_0x2bfb5e[_0xed4c('0x96')]){_0x57eb5e[_0xed4c('0x95')][_0xed4c('0x97')]=_0x2bfb5e[_0xed4c('0x96')];}return new BPromise(function(_0xc67247,_0xfd9fd3){if(_0x2bfb5e[_0xed4c('0x93')]){for(var _0x121129=0x0;_0x121129<_0x2bfb5e[_0xed4c('0x93')][_0xed4c('0x32')];_0x121129++){var _0xef3178=_0x2bfb5e[_0xed4c('0x93')][_0x121129];var _0x55f5b3=path[_0xed4c('0x56')](_0x55d829,_0xef3178[_0xed4c('0x98')]);if(fs[_0xed4c('0x99')](_0x55f5b3)){_0x57eb5e[_0xed4c('0x55')]['push']({'name':_0xef3178['name'],'contentType':_0xef3178[_0xed4c('0x3b')],'data':fs[_0xed4c('0x9a')](_0x55f5b3)});}}}emlformat[_0xed4c('0x9b')](_0x57eb5e,function(_0x3a9c17,_0x9eb07){if(_0x3a9c17)return _0xfd9fd3(_0x3a9c17);fs[_0xed4c('0x9c')](path[_0xed4c('0x56')](_0x16a8b7,_0x24b111),_0x9eb07);return _0xc67247(_0x9eb07);});});}})['then'](function(_0x3435a0){if(_0x3435a0){return _0x1eb1ca[_0xed4c('0x87')](path[_0xed4c('0x56')](_0x16a8b7,_0x24b111),_0x24b111,function(_0x1e3772){if(!_0x1e3772)fs[_0xed4c('0x9d')](path[_0xed4c('0x56')](_0x16a8b7,_0x24b111));});}})[_0xed4c('0x42')](handleError(_0x1eb1ca,null));}; \ No newline at end of file +var _0x60b5=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','User','fullname','email','event','fromString','EventManager','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','offset','undefined','limit','set','Content-Range','update','destroy','end','sendStatus','stack','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','name','filter','options','MailMessage','count','includeAll','include','findAll','rows','catch','show','params','merge','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','Contacts','CmContact','defaults','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','user','role','interaction','stringify','null','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','SIP/%s','channel','motionChannel','acceptmessage','reject','mail'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x60b5,0x157));var _0x560b=function(_0xe69093,_0x17e931){_0xe69093=_0xe69093-0x0;var _0x48bd96=_0x60b5[_0xe69093];return _0x48bd96;};'use strict';var emlformat=require(_0x560b('0x0'));var moment=require(_0x560b('0x1'));var BPromise=require(_0x560b('0x2'));var util=require('util');var path=require(_0x560b('0x3'));var fs=require('fs');var _=require(_0x560b('0x4'));var Redis=require(_0x560b('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x560b('0x6'))('api');var interaction_log=require(_0x560b('0x6'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x560b('0x7'))['db'];config[_0x560b('0x8')]=_['defaults'](config[_0x560b('0x8')],{'host':_0x560b('0x9'),'port':0x18eb});var socket=require(_0x560b('0xa'))(new Redis(config[_0x560b('0x8')]));var htmlEntities=require(_0x560b('0xb'));require(_0x560b('0xc'))[_0x560b('0xd')](socket);var jayson=require(_0x560b('0xe'));var client=jayson['client'][_0x560b('0xf')]({'port':0x232c});var client9003=jayson[_0x560b('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x560b('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38339b,_0x1a9fd9,_0x392396,_0x2c8d1f){return new BPromise(function(_0x216130,_0x129fd6){var _0x145125=_0x2c8d1f||client;return _0x145125['request'](_0x38339b,_0x392396)[_0x560b('0x11')](function(_0x3928c1){logger[_0x560b('0x12')]('MailMessage,\x20%s,\x20%s',_0x1a9fd9,_0x560b('0x13'));logger[_0x560b('0x14')](_0x560b('0x15'),_0x1a9fd9,'request\x20sent',JSON['stringify'](_0x3928c1));if(_0x3928c1['error']){if(_0x3928c1[_0x560b('0x16')][_0x560b('0x17')]===0x1f4){logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);return _0x129fd6(_0x3928c1[_0x560b('0x16')]['message']);}logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);return _0x216130(_0x3928c1[_0x560b('0x16')][_0x560b('0x19')]);}else{logger[_0x560b('0x12')]('MailMessage,\x20%s,\x20%s',_0x1a9fd9,_0x560b('0x13'));_0x216130(_0x3928c1['result'][_0x560b('0x19')]);}})['catch'](function(_0x40d494){logger[_0x560b('0x16')](_0x560b('0x18'),_0x1a9fd9,_0x40d494);_0x129fd6(_0x40d494);});});}function respondWithResult(_0x5351e0,_0x3eb870){_0x3eb870=_0x3eb870||0xc8;return function(_0x5d056d){if(_0x5d056d){return _0x5351e0['status'](_0x3eb870)['json'](_0x5d056d);}};}function respondWithFilteredResult(_0x384272,_0x4fd7be){return function(_0x3d956f){if(_0x3d956f){var _0x3c9826=typeof _0x4fd7be[_0x560b('0x1a')]===_0x560b('0x1b')&&typeof _0x4fd7be[_0x560b('0x1c')]===_0x560b('0x1b');var _0x51b4ca=_0x3d956f['count'];var _0x336235=_0x3c9826?0x0:_0x4fd7be[_0x560b('0x1a')];var _0x41e490=_0x3c9826?_0x3d956f['count']:_0x4fd7be['offset']+_0x4fd7be[_0x560b('0x1c')];var _0x3d4cb2;if(_0x41e490>=_0x51b4ca){_0x41e490=_0x51b4ca;_0x3d4cb2=0xc8;}else{_0x3d4cb2=0xce;}_0x384272['status'](_0x3d4cb2);return _0x384272[_0x560b('0x1d')](_0x560b('0x1e'),_0x336235+'-'+_0x41e490+'/'+_0x51b4ca)['json'](_0x3d956f);}return null;};}function saveUpdates(_0x5b03df){return function(_0x44046f){if(_0x44046f){return _0x44046f[_0x560b('0x1f')](_0x5b03df)['then'](function(_0x37eb65){return _0x37eb65;});}return null;};}function removeEntity(_0x3d1658){return function(_0x3b89c5){if(_0x3b89c5){return _0x3b89c5[_0x560b('0x20')]()['then'](function(){_0x3d1658['status'](0xcc)[_0x560b('0x21')]();});}};}function handleEntityNotFound(_0x4c857f){return function(_0x117df5){if(!_0x117df5){_0x4c857f[_0x560b('0x22')](0x194);}return _0x117df5;};}function handleError(_0xa4f731,_0x27fbb5){_0x27fbb5=_0x27fbb5||0x1f4;return function(_0x1067bd){logger['error'](_0x1067bd[_0x560b('0x23')]);if(_0x1067bd['name']){delete _0x1067bd['name'];}_0xa4f731['status'](_0x27fbb5)['send'](_0x1067bd);};}exports[_0x560b('0x24')]=function(_0x470ba3,_0x21bd92){var _0x2ca6ff={},_0x1681e8={},_0x2f7822={'count':0x0,'rows':[]};var _0x2936d1=_[_0x560b('0x25')](db['MailMessage'][_0x560b('0x26')],function(_0x4c27f3){return{'name':_0x4c27f3['fieldName'],'type':_0x4c27f3[_0x560b('0x27')][_0x560b('0x28')]};});_0x1681e8[_0x560b('0x29')]=_[_0x560b('0x25')](_0x2936d1,'name');_0x1681e8[_0x560b('0x2a')]=_[_0x560b('0x2b')](_0x470ba3['query']);_0x1681e8[_0x560b('0x2c')]=_[_0x560b('0x2d')](_0x1681e8[_0x560b('0x29')],_0x1681e8[_0x560b('0x2a')]);_0x2ca6ff[_0x560b('0x2e')]=_['intersection'](_0x1681e8[_0x560b('0x29')],qs[_0x560b('0x2f')](_0x470ba3[_0x560b('0x2a')][_0x560b('0x2f')]));_0x2ca6ff[_0x560b('0x2e')]=_0x2ca6ff[_0x560b('0x2e')][_0x560b('0x30')]?_0x2ca6ff['attributes']:_0x1681e8['model'];if(!_0x470ba3[_0x560b('0x2a')]['hasOwnProperty'](_0x560b('0x31'))){_0x2ca6ff[_0x560b('0x1c')]=qs[_0x560b('0x1c')](_0x470ba3[_0x560b('0x2a')][_0x560b('0x1c')]);_0x2ca6ff[_0x560b('0x1a')]=qs['offset'](_0x470ba3[_0x560b('0x2a')][_0x560b('0x1a')]);}_0x2ca6ff[_0x560b('0x32')]=qs[_0x560b('0x33')](_0x470ba3['query'][_0x560b('0x33')]);_0x2ca6ff['where']=qs[_0x560b('0x2c')](_[_0x560b('0x34')](_0x470ba3[_0x560b('0x2a')],_0x1681e8['filters']),_0x2936d1);if(_0x470ba3[_0x560b('0x2a')]['filter']){_0x2ca6ff[_0x560b('0x35')]=_['merge'](_0x2ca6ff['where'],{'$or':_[_0x560b('0x25')](_0x2936d1,function(_0x140652){if(_0x140652[_0x560b('0x27')]!==_0x560b('0x36')){var _0x5ab391={};_0x5ab391[_0x140652[_0x560b('0x37')]]={'$like':'%'+_0x470ba3[_0x560b('0x2a')][_0x560b('0x38')]+'%'};return _0x5ab391;}})});}_0x2ca6ff=_['merge']({},_0x2ca6ff,_0x470ba3[_0x560b('0x39')]);var _0x1a9539={'where':_0x2ca6ff['where']};return db[_0x560b('0x3a')][_0x560b('0x3b')](_0x1a9539)[_0x560b('0x11')](function(_0x5a3eeb){_0x2f7822[_0x560b('0x3b')]=_0x5a3eeb;if(_0x470ba3[_0x560b('0x2a')][_0x560b('0x3c')]){_0x2ca6ff[_0x560b('0x3d')]=[{'all':!![]}];}return db['MailMessage'][_0x560b('0x3e')](_0x2ca6ff);})[_0x560b('0x11')](function(_0xee1eda){_0x2f7822[_0x560b('0x3f')]=_0xee1eda;return _0x2f7822;})['then'](respondWithFilteredResult(_0x21bd92,_0x2ca6ff))[_0x560b('0x40')](handleError(_0x21bd92,null));};exports[_0x560b('0x41')]=function(_0x5ecc81,_0x19a292){var _0xcb607={'raw':!![],'where':{'id':_0x5ecc81[_0x560b('0x42')]['id']}},_0x5809f6={};_0x5809f6['model']=_['keys'](db[_0x560b('0x3a')][_0x560b('0x26')]);_0x5809f6['query']=_[_0x560b('0x2b')](_0x5ecc81['query']);_0x5809f6[_0x560b('0x2c')]=_[_0x560b('0x2d')](_0x5809f6[_0x560b('0x29')],_0x5809f6['query']);_0xcb607[_0x560b('0x2e')]=_[_0x560b('0x2d')](_0x5809f6['model'],qs[_0x560b('0x2f')](_0x5ecc81[_0x560b('0x2a')][_0x560b('0x2f')]));_0xcb607[_0x560b('0x2e')]=_0xcb607[_0x560b('0x2e')]['length']?_0xcb607[_0x560b('0x2e')]:_0x5809f6['model'];if(_0x5ecc81['query'][_0x560b('0x3c')]){_0xcb607[_0x560b('0x3d')]=[{'all':!![]}];}_0xcb607=_[_0x560b('0x43')]({},_0xcb607,_0x5ecc81[_0x560b('0x39')]);return db[_0x560b('0x3a')][_0x560b('0x44')](_0xcb607)[_0x560b('0x11')](handleEntityNotFound(_0x19a292,null))[_0x560b('0x11')](respondWithResult(_0x19a292,null))['catch'](handleError(_0x19a292,null));};exports['update']=function(_0x5daa7e,_0x1e7d39){if(_0x5daa7e[_0x560b('0x45')]['id']){delete _0x5daa7e[_0x560b('0x45')]['id'];}return db[_0x560b('0x3a')][_0x560b('0x44')]({'where':{'id':_0x5daa7e[_0x560b('0x42')]['id']}})[_0x560b('0x11')](handleEntityNotFound(_0x1e7d39,null))[_0x560b('0x11')](saveUpdates(_0x5daa7e['body'],null))[_0x560b('0x11')](respondWithResult(_0x1e7d39,null))[_0x560b('0x40')](handleError(_0x1e7d39,null));};exports['destroy']=function(_0x52d77d,_0x32bddb){return db['MailMessage'][_0x560b('0x44')]({'where':{'id':_0x52d77d['params']['id']}})[_0x560b('0x11')](handleEntityNotFound(_0x32bddb,null))['then'](removeEntity(_0x32bddb,null))['catch'](handleError(_0x32bddb,null));};exports[_0x560b('0x46')]=function(_0x21a951,_0x1bb823){return db[_0x560b('0x3a')][_0x560b('0x46')]()[_0x560b('0x11')](respondWithResult(_0x1bb823,null))[_0x560b('0x40')](handleError(_0x1bb823,null));};exports[_0x560b('0x47')]=function(_0x68bf7d,_0x4727f9){return db[_0x560b('0x3a')]['create'](_0x68bf7d[_0x560b('0x45')])[_0x560b('0x11')](function(_0x1e6154){if(_0x1e6154){if(_0x1e6154[_0x560b('0x48')]===_0x560b('0x49')&&!_0x1e6154[_0x560b('0x4a')]){var _0x236a81,_0x5a0048,_0x3b5d3c;if(_0x68bf7d[_0x560b('0x45')]['to']){_0x5a0048=_0x68bf7d[_0x560b('0x45')]['to'][_0x560b('0x4b')](',')[0x0];}return db[_0x560b('0x4c')][_0x560b('0x4d')]({'where':{'id':_0x1e6154[_0x560b('0x4e')]},'include':[{'model':db['CmList'],'as':_0x560b('0x4f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5a0048},'limit':0x1,'order':[[_0x560b('0x50'),'DESC']]}]},{'model':db[_0x560b('0x51')],'as':_0x560b('0x52'),'raw':!![],'include':[{'model':db[_0x560b('0x53')],'as':_0x560b('0x53'),'raw':!![]}]}]})[_0x560b('0x11')](function(_0x102bb5){_0x236a81=_0x102bb5;if(!_0x236a81||!_0x236a81[_0x560b('0x52')])return;var _0x4b8bc9=_0x236a81[_0x560b('0x54')]();if(_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')]&&_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x560b('0x30')]){for(var _0x15173c=0x0;_0x15173c<_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x560b('0x30')];_0x15173c+=0x1){_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c]={'filename':_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c]['name'],'path':path[_0x560b('0x56')](config[_0x560b('0x57')],'server/files/attachments',_0x68bf7d[_0x560b('0x45')][_0x560b('0x55')][_0x15173c][_0x560b('0x58')])};}}_0x3b5d3c={'account':_0x4b8bc9,'message':_0x68bf7d[_0x560b('0x45')]};return;})[_0x560b('0x11')](function(){if(_0x236a81['List']){if(_0x236a81[_0x560b('0x4f')][_0x560b('0x59')][_0x560b('0x30')]){return _0x236a81[_0x560b('0x4f')][_0x560b('0x59')][0x0];}else{return db[_0x560b('0x5a')][_0x560b('0x47')](_[_0x560b('0x5b')](_0x68bf7d[_0x560b('0x45')],{'firstName':_0x68bf7d[_0x560b('0x45')]['to'],'email':_0x68bf7d[_0x560b('0x45')]['to'],'phone':_0x68bf7d[_0x560b('0x45')]['to'],'ListId':_0x236a81['ListId']}));}}else{throw new Error(_0x560b('0x5c'));}})[_0x560b('0x11')](function(){if(_0x3b5d3c){return respondWithRpcPromise(_0x560b('0x5d'),_0x560b('0x5e'),_0x3b5d3c,client9003)[_0x560b('0x11')](function(_0x4ddc77){return _0x1e6154['update']({'read':!![],'messageId':_0x4ddc77[_0x560b('0x5f')],'sentAt':moment()[_0x560b('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x560b('0x40')](function(_0x5222d5){logger[_0x560b('0x16')]('%s',JSON['stringify'](_0x5222d5));return _0x1e6154;});}return _0x1e6154;});}return _0x1e6154;}})['then'](respondWithResult(_0x4727f9,0xc9))[_0x560b('0x40')](handleError(_0x4727f9,null));};exports[_0x560b('0x61')]=function(_0x43df6c,_0x5d36f0){var _0x135acc={'agent':{},'channel':'mail'};if(_0x43df6c[_0x560b('0x45')]['id']){delete _0x43df6c[_0x560b('0x45')]['id'];}_0x43df6c['body'][_0x560b('0x62')]=!![];_0x43df6c['body']['readAt']=moment()[_0x560b('0x60')](_0x560b('0x63'));_0x43df6c[_0x560b('0x45')][_0x560b('0x64')]=_0x43df6c[_0x560b('0x45')][_0x560b('0x64')]||_0x43df6c['user']['id'];_0x135acc[_0x560b('0x65')]['id']=_0x43df6c[_0x560b('0x45')]['UserId'];return db[_0x560b('0x3a')][_0x560b('0x44')]({'where':{'id':_0x43df6c[_0x560b('0x42')]['id'],'UserId':null}})[_0x560b('0x11')](handleEntityNotFound(_0x5d36f0,null))['then'](saveUpdates(_0x43df6c['body'],null))[_0x560b('0x11')](function(_0x596eb8){if(_0x596eb8){_0x135acc[_0x560b('0x19')]=_0x596eb8[_0x560b('0x66')]({'plain':!![]});return db[_0x560b('0x67')][_0x560b('0x44')]({'where':{'id':_0x596eb8[_0x560b('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x5d36f0,null))['then'](function(_0x1cc319){if(_0x1cc319){return _0x1cc319[_0x560b('0x1f')]({'UserId':_0x43df6c[_0x560b('0x45')]['UserId'],'read1stAt':_[_0x560b('0x69')](_0x1cc319[_0x560b('0x6a')])?moment()[_0x560b('0x60')](_0x560b('0x63')):undefined});}return null;})['then'](function(_0x35d0ef){if(_0x35d0ef){_0x135acc['interaction']=_0x35d0ef[_0x560b('0x66')]({'plain':!![]});interaction_log[_0x560b('0x12')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43df6c[_0x560b('0x6b')]['id'],_0x43df6c['user']['name'],_0x43df6c['user'][_0x560b('0x6c')],_0x135acc[_0x560b('0x6d')]['id'],_0x43df6c[_0x560b('0x45')]?JSON[_0x560b('0x6e')](_0x43df6c['body']):_0x560b('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x135acc);}return null;})[_0x560b('0x11')](function(_0x5f2b58){var _0x3ac6af='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f2b58[_0x560b('0x19')]['ContactId'];return db['sequelize'][_0x560b('0x2a')](_0x3ac6af,{'type':db[_0x560b('0x70')][_0x560b('0x71')][_0x560b('0x72')],'raw':!![]})['then'](function(_0x42f5de){return _0x42f5de;});})[_0x560b('0x11')](function(_0x27dd8b){if(_0x27dd8b){_0x135acc[_0x560b('0x19')][_0x560b('0x73')]=_0x27dd8b[0x0];if(!_0x43df6c[_0x560b('0x45')][_0x560b('0x64')])return;return db['User'][_0x560b('0x44')]({'where':{'id':_0x43df6c[_0x560b('0x45')][_0x560b('0x64')],'role':'agent'},'attributes':['id','name','fullname','email',_0x560b('0x74')],'raw':!![]});}return null;})[_0x560b('0x11')](function(_0xc2da9d){if(!_0xc2da9d)return null;_0x135acc[_0x560b('0x19')][_0x560b('0x65')]=_0xc2da9d;return _0x135acc;})[_0x560b('0x11')](function(_0x557de3){if(_0x557de3){if(_0x43df6c[_0x560b('0x45')][_0x560b('0x75')]){_0x135acc[_0x560b('0x19')][_0x560b('0x76')]=util[_0x560b('0x60')](_0x560b('0x77'),_0x43df6c[_0x560b('0x6b')][_0x560b('0x37')]);_0x135acc[_0x560b('0x19')][_0x560b('0x78')]=_0x135acc['channel'];_0x135acc['message'][_0x560b('0x79')]=_0x135acc[_0x560b('0x78')];_0x135acc[_0x560b('0x19')]['event']='accept';_0x135acc[_0x560b('0x19')][_0x560b('0x45')]=htmlToText['fromString'](_0x135acc[_0x560b('0x19')][_0x560b('0x45')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x560b('0x7a'),'message':_0x135acc[_0x560b('0x19')]},client9002)[_0x560b('0x11')](function(){return _0x135acc;});}return _0x135acc;}return null;})[_0x560b('0x11')](respondWithResult(_0x5d36f0,null))[_0x560b('0x40')](handleError(_0x5d36f0,null));};exports[_0x560b('0x7b')]=function(_0x1d322d,_0x5cc680){var _0x4326c4={'agent':{},'channel':_0x560b('0x7c')};if(_0x1d322d[_0x560b('0x45')]['id']){delete _0x1d322d[_0x560b('0x45')]['id'];}_0x1d322d[_0x560b('0x45')][_0x560b('0x64')]=_0x1d322d[_0x560b('0x45')][_0x560b('0x64')]||_0x1d322d[_0x560b('0x6b')]['id'];_0x4326c4['agent']['id']=_0x1d322d[_0x560b('0x45')][_0x560b('0x64')];return db['MailMessage']['find']({'where':{'id':_0x1d322d[_0x560b('0x42')]['id'],'UserId':null}})[_0x560b('0x11')](handleEntityNotFound(_0x5cc680,null))[_0x560b('0x11')](function(_0x538b50){if(_0x538b50){_0x4326c4['message']=_0x538b50[_0x560b('0x66')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x538b50[_0x560b('0x68')]}});}return null;})[_0x560b('0x11')](handleEntityNotFound(_0x5cc680,null))[_0x560b('0x11')](function(_0x38df0b){if(_0x38df0b){_0x4326c4[_0x560b('0x6d')]=_0x38df0b[_0x560b('0x66')]({'plain':!![]});interaction_log['info'](_0x560b('0x7d'),_0x1d322d[_0x560b('0x6b')]['id'],_0x1d322d[_0x560b('0x6b')]['name'],_0x1d322d[_0x560b('0x6b')][_0x560b('0x6c')],_0x4326c4[_0x560b('0x6d')]['id'],_0x1d322d[_0x560b('0x45')]?JSON[_0x560b('0x6e')](_0x1d322d['body']):_0x560b('0x6f'));return respondWithRpcPromise('RejectMessage',_0x560b('0x7e'),_0x4326c4);}return null;})[_0x560b('0x11')](function(_0x2f659c){var _0x163588=_0x560b('0x7f')+_0x2f659c['message'][_0x560b('0x80')];return db[_0x560b('0x81')][_0x560b('0x2a')](_0x163588,{'type':db[_0x560b('0x70')]['QueryTypes'][_0x560b('0x72')],'raw':!![]})[_0x560b('0x11')](function(_0x16419a){return _0x16419a;});})[_0x560b('0x11')](function(_0x494e33){if(_0x494e33){_0x4326c4[_0x560b('0x19')][_0x560b('0x73')]=_0x494e33[0x0];if(!_0x1d322d['body'][_0x560b('0x64')])return;return db[_0x560b('0x82')][_0x560b('0x44')]({'where':{'id':_0x1d322d[_0x560b('0x45')]['UserId'],'role':_0x560b('0x65')},'attributes':['id',_0x560b('0x37'),_0x560b('0x83'),_0x560b('0x84'),_0x560b('0x74')],'raw':!![]});}return null;})[_0x560b('0x11')](function(_0x3084f0){if(!_0x3084f0)return null;_0x4326c4['message']['agent']=_0x3084f0;return _0x4326c4;})[_0x560b('0x11')](function(_0x17a1e2){if(_0x17a1e2){_0x17a1e2['message'][_0x560b('0x76')]=util[_0x560b('0x60')](_0x560b('0x77'),_0x1d322d[_0x560b('0x6b')]['name']);_0x17a1e2['message'][_0x560b('0x78')]=_0x4326c4[_0x560b('0x78')];_0x17a1e2[_0x560b('0x19')]['motionChannel']=_0x4326c4[_0x560b('0x78')];_0x17a1e2[_0x560b('0x19')][_0x560b('0x85')]=_0x560b('0x7b');_0x17a1e2[_0x560b('0x19')][_0x560b('0x45')]=htmlToText[_0x560b('0x86')](_0x4326c4['message']['body']);respondWithRpcPromise(_0x560b('0x87'),_0x560b('0x87'),{'event':_0x560b('0x88'),'message':_0x17a1e2[_0x560b('0x19')]},client9002);return _0x4326c4;}return null;})[_0x560b('0x11')](respondWithResult(_0x5cc680,null))[_0x560b('0x40')](handleError(_0x5cc680,null));};exports['download']=function(_0x5d58e1,_0x45c626){var _0x7a59ea=moment()[_0x560b('0x89')]()[_0x560b('0x8a')]();var _0x1dd1ab=path[_0x560b('0x56')](config[_0x560b('0x57')],_0x560b('0x8b'),_0x560b('0x8c'),_0x560b('0x8d'));var _0x2d2bba=path[_0x560b('0x56')](config[_0x560b('0x57')],_0x560b('0x8b'),_0x560b('0x8c'),_0x560b('0x55'));var _0x35c2a5=util['format'](_0x560b('0x8e'),_0x7a59ea);return db[_0x560b('0x3a')]['find']({'where':{'id':_0x5d58e1[_0x560b('0x42')]['id']},'attributes':['id',_0x560b('0x45'),_0x560b('0x8f'),'to','cc',_0x560b('0x90'),_0x560b('0x91'),_0x560b('0x92')],'include':_0x5d58e1[_0x560b('0x2a')][_0x560b('0x55')]?[{'model':db[_0x560b('0x93')],'as':_0x560b('0x94')}]:undefined})[_0x560b('0x11')](handleEntityNotFound(_0x45c626,null))[_0x560b('0x11')](function(_0x7cfdce){if(_0x7cfdce){var _0x5daa46=_0x7cfdce;var _0x424641={'from':_0x5daa46[_0x560b('0x8f')],'to':_0x5daa46['to'],'subject':_0x5daa46[_0x560b('0x91')],'html':htmlEntities['decode'](_0x5daa46[_0x560b('0x45')]),'headers':{'Date':moment(_0x5daa46[_0x560b('0x92')])[_0x560b('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7cfdce['cc']){_0x424641[_0x560b('0x95')]['Cc']=_0x7cfdce['cc'];}if(_0x7cfdce['bcc']){_0x424641['headers'][_0x560b('0x96')]=_0x7cfdce[_0x560b('0x90')];}return new BPromise(function(_0x18021e,_0x2d7895){if(_0x7cfdce[_0x560b('0x94')]){for(var _0x361b44=0x0;_0x361b44<_0x7cfdce[_0x560b('0x94')]['length'];_0x361b44++){var _0x586754=_0x7cfdce['Attachments'][_0x361b44];var _0x5e8db2=path[_0x560b('0x56')](_0x2d2bba,_0x586754[_0x560b('0x58')]);if(fs[_0x560b('0x97')](_0x5e8db2)){_0x424641[_0x560b('0x55')][_0x560b('0x98')]({'name':_0x586754[_0x560b('0x37')],'contentType':_0x586754[_0x560b('0x27')],'data':fs[_0x560b('0x99')](_0x5e8db2)});}}}emlformat['build'](_0x424641,function(_0x18226f,_0x1013b3){if(_0x18226f)return _0x2d7895(_0x18226f);fs[_0x560b('0x9a')](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5),_0x1013b3);return _0x18021e(_0x1013b3);});});}})[_0x560b('0x11')](function(_0x4c9fa4){if(_0x4c9fa4){return _0x45c626['download'](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5),_0x35c2a5,function(_0x2bce37){if(!_0x2bce37)fs[_0x560b('0x9b')](path[_0x560b('0x56')](_0x1dd1ab,_0x35c2a5));});}})['catch'](handleError(_0x45c626,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4efb3cd..bb2ca42 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 _0x42c6=['hasOwnProperty','hook','exports','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x42c6,0x8a));var _0x642c=function(_0x14980c,_0x4c4e6c){_0x14980c=_0x14980c-0x0;var _0x5da4ac=_0x42c6[_0x14980c];return _0x5da4ac;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x642c('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x642c('0x1')](0x0);var events={'afterCreate':_0x642c('0x2'),'afterUpdate':_0x642c('0x3'),'afterDestroy':_0x642c('0x4')};function emitEvent(_0x326e38){return function(_0x2477f5,_0x265d46,_0x2bc1a5){MailMessageEvents[_0x642c('0x5')](_0x326e38+':'+_0x2477f5['id'],_0x2477f5);MailMessageEvents['emit'](_0x326e38,_0x2477f5);_0x2bc1a5(null);};}for(var e in events){if(events[_0x642c('0x6')](e)){var event=events[e];MailMessage[_0x642c('0x7')](e,emitEvent(event));}}module[_0x642c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xe88a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1f2b50,_0x20b570){var _0x5675c1=function(_0x1745df){while(--_0x1745df){_0x1f2b50['push'](_0x1f2b50['shift']());}};_0x5675c1(++_0x20b570);}(_0xe88a,0x146));var _0xae88=function(_0x5b0cc1,_0x4d668d){_0x5b0cc1=_0x5b0cc1-0x0;var _0x2e379b=_0xe88a[_0x5b0cc1];return _0x2e379b;};'use strict';var EventEmitter=require(_0xae88('0x0'));var MailMessage=require(_0xae88('0x1'))['db'][_0xae88('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xae88('0x3')](0x0);var events={'afterCreate':_0xae88('0x4'),'afterUpdate':_0xae88('0x5'),'afterDestroy':_0xae88('0x6')};function emitEvent(_0x58be3f){return function(_0x2ea811,_0x54ebd6,_0x55fabc){MailMessageEvents[_0xae88('0x7')](_0x58be3f+':'+_0x2ea811['id'],_0x2ea811);MailMessageEvents['emit'](_0x58be3f,_0x2ea811);_0x55fabc(null);};}for(var e in events){if(events[_0xae88('0x8')](e)){var event=events[e];MailMessage[_0xae88('0x9')](e,emitEvent(event));}}module[_0xae88('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 4a94681..1218ed8 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 _0x2385=['messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage'];(function(_0x407d22,_0x4847b6){var _0x480e7f=function(_0x5501d2){while(--_0x5501d2){_0x407d22['push'](_0x407d22['shift']());}};_0x480e7f(++_0x4847b6);}(_0x2385,0x1cf));var _0x5238=function(_0x302a78,_0x557e44){_0x302a78=_0x302a78-0x0;var _0xdabe42=_0x2385[_0x302a78];return _0xdabe42;};'use strict';var _=require(_0x5238('0x0'));var util=require(_0x5238('0x1'));var logger=require('../../config/logger')(_0x5238('0x2'));var moment=require(_0x5238('0x3'));var BPromise=require(_0x5238('0x4'));var rp=require('request-promise');var htmlToText=require(_0x5238('0x5'));var fs=require('fs');var path=require(_0x5238('0x6'));var rimraf=require(_0x5238('0x7'));var config=require(_0x5238('0x8'));var attributes=require(_0x5238('0x9'));module[_0x5238('0xa')]=function(_0x37c54b,_0x237048){return _0x37c54b[_0x5238('0xb')](_0x5238('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5238('0xd')]},{'name':_0x5238('0xe'),'fields':[_0x5238('0xf'),_0x5238('0x10')],'type':_0x5238('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43befd,_0x161559,_0x5ab7ff){if(_0x43befd[_0x5238('0x12')]){_0x43befd[_0x5238('0xf')]=htmlToText[_0x5238('0x13')](_0x43befd['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5ab7ff(null,_0x161559);},'afterCreate':function(_0x149913,_0x4f3036,_0x3bb8fb){var _0x493dfb=_0x37c54b[_0x5238('0x14')];var _0x1643ec=_0x149913[_0x5238('0x15')]({'plain':!![]});if(_0x1643ec[_0x5238('0x16')]['toLowerCase']()==='in'||_0x1643ec[_0x5238('0x16')]['toLowerCase']()===_0x5238('0x17')&&!_0x1643ec[_0x5238('0x18')]&&!_[_0x5238('0x19')](_0x1643ec[_0x5238('0x1a')])){_0x493dfb[_0x5238('0x1b')]['findOne']({'where':{'id':_0x1643ec[_0x5238('0x1c')]}})[_0x5238('0x1d')](function(_0xca1815){if(_0xca1815){_0xca1815[_0x5238('0x1e')]({'lastMsgAt':_0x1643ec[_0x5238('0x1f')],'lastMsgDirection':_0x1643ec[_0x5238('0x16')]['toLowerCase']()});}})['catch'](function(_0x454ace){console[_0x5238('0x20')](_0x454ace);});}_0x3bb8fb();}},'charset':_0x5238('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x26ad=['path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x26ad,0x179));var _0xd26a=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x26ad[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require(_0xd26a('0x0'));var util=require(_0xd26a('0x1'));var logger=require(_0xd26a('0x2'))(_0xd26a('0x3'));var moment=require(_0xd26a('0x4'));var BPromise=require(_0xd26a('0x5'));var rp=require(_0xd26a('0x6'));var htmlToText=require(_0xd26a('0x7'));var fs=require('fs');var path=require(_0xd26a('0x8'));var rimraf=require(_0xd26a('0x9'));var config=require(_0xd26a('0xa'));var attributes=require('./mailMessage.attributes');module[_0xd26a('0xb')]=function(_0x35db74,_0x3b6d34){return _0x35db74[_0xd26a('0xc')](_0xd26a('0xd'),attributes,{'tableName':_0xd26a('0xe'),'paranoid':![],'indexes':[{'name':_0xd26a('0xf'),'fields':[_0xd26a('0xf')]},{'name':_0xd26a('0x10'),'fields':[_0xd26a('0x11'),_0xd26a('0x12')],'type':_0xd26a('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a6e28,_0x4eda42,_0x3a3058){if(_0x1a6e28[_0xd26a('0x14')]){_0x1a6e28[_0xd26a('0x11')]=htmlToText['fromString'](_0x1a6e28[_0xd26a('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3a3058(null,_0x4eda42);},'afterCreate':function(_0x52b407,_0xf57160,_0x26dd38){var _0x49e364=_0x35db74[_0xd26a('0x15')];var _0x419059=_0x52b407['get']({'plain':!![]});if(_0x419059[_0xd26a('0x16')]['toLowerCase']()==='in'||_0x419059['direction'][_0xd26a('0x17')]()===_0xd26a('0x18')&&!_0x419059[_0xd26a('0x19')]&&!_[_0xd26a('0x1a')](_0x419059[_0xd26a('0x1b')])){_0x49e364[_0xd26a('0x1c')][_0xd26a('0x1d')]({'where':{'id':_0x419059[_0xd26a('0x1e')]}})['then'](function(_0x5c1f13){if(_0x5c1f13){_0x5c1f13['update']({'lastMsgAt':_0x419059['createdAt'],'lastMsgDirection':_0x419059[_0xd26a('0x16')][_0xd26a('0x17')]()});}})[_0xd26a('0x1f')](function(_0x93cda9){console[_0xd26a('0x20')](_0x93cda9);});}_0x26dd38();}},'charset':_0xd26a('0x21'),'collate':_0xd26a('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ca9e927..105bda9 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 _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x56d802,_0x3e8e08){var _0x3d196a=function(_0x5105a7){while(--_0x5105a7){_0x56d802['push'](_0x56d802['shift']());}};_0x3d196a(++_0x3e8e08);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf2e3[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file +var _0x4e2e=['socket.io-emitter','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x25fcc7,_0x413ac0){_0x25fcc7=_0x25fcc7-0x0;var _0x415341=_0x4e2e[_0x25fcc7];return _0x415341;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});config[_0xe4e2('0xb')]=_[_0xe4e2('0xc')](config[_0xe4e2('0xb')],{'host':_0xe4e2('0xd'),'port':0x18eb});var socket=require(_0xe4e2('0xe'))(new Redis(config[_0xe4e2('0xb')]));require(_0xe4e2('0xf'))['register'](socket);function respondWithRpcPromise(_0xd81011,_0x14fe0d,_0xa4df88){return new BPromise(function(_0x5b7889,_0x1954f8){return client[_0xe4e2('0x10')](_0xd81011,_0xa4df88)[_0xe4e2('0x11')](function(_0x107816){logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));logger[_0xe4e2('0x14')](_0xe4e2('0x15'),_0x14fe0d,_0xe4e2('0x13'),JSON['stringify'](_0x107816));if(_0x107816[_0xe4e2('0x16')]){if(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x17')]===0x1f4){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816['error']['message']);return _0x1954f8(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x107816[_0xe4e2('0x16')]['message']);return _0x5b7889(_0x107816[_0xe4e2('0x16')][_0xe4e2('0x19')]);}else{logger[_0xe4e2('0x12')]('MailMessage,\x20%s,\x20%s',_0x14fe0d,_0xe4e2('0x13'));_0x5b7889(_0x107816['result'][_0xe4e2('0x19')]);}})[_0xe4e2('0x1a')](function(_0x7a47c3){logger[_0xe4e2('0x16')](_0xe4e2('0x18'),_0x14fe0d,_0x7a47c3);_0x1954f8(_0x7a47c3);});});}exports[_0xe4e2('0x1b')]=function(_0x339d00){var _0x3c4e90=this;return new Promise(function(_0x4769dd,_0x362741){return db['MailMessage'][_0xe4e2('0x1c')](_0x339d00[_0xe4e2('0x1d')],{'raw':_0x339d00[_0xe4e2('0x1e')]?_0x339d00[_0xe4e2('0x1e')][_0xe4e2('0x1f')]===undefined?!![]:![]:!![]})[_0xe4e2('0x11')](function(_0x16f14b){logger['info'](_0xe4e2('0x1b'),_0x339d00);logger[_0xe4e2('0x14')](_0xe4e2('0x1b'),_0x339d00,JSON['stringify'](_0x16f14b));_0x4769dd(_0x16f14b);})[_0xe4e2('0x1a')](function(_0x12ad33){logger['error'](_0xe4e2('0x1b'),_0x12ad33[_0xe4e2('0x19')],_0x339d00);_0x362741(_0x3c4e90[_0xe4e2('0x16')](0x1f4,_0x12ad33[_0xe4e2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 659ffe9..c87be15 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 _0xb2d5=['removeListener','register','length','mailMessage:','./mailMessage.events','remove','update','emit'];(function(_0x3bae51,_0x25e192){var _0xee8c63=function(_0x1e8c1b){while(--_0x1e8c1b){_0x3bae51['push'](_0x3bae51['shift']());}};_0xee8c63(++_0x25e192);}(_0xb2d5,0x11c));var _0x5b2d=function(_0x2c09a6,_0x17ff59){_0x2c09a6=_0x2c09a6-0x0;var _0x337cf6=_0xb2d5[_0x2c09a6];return _0x337cf6;};'use strict';var MailMessageEvents=require(_0x5b2d('0x0'));var events=['save',_0x5b2d('0x1'),_0x5b2d('0x2')];function createListener(_0x58d924,_0x3d8bbf){return function(_0x3c7d3f){_0x3d8bbf[_0x5b2d('0x3')](_0x58d924,_0x3c7d3f);};}function removeListener(_0x544d73,_0x17f594){return function(){MailMessageEvents[_0x5b2d('0x4')](_0x544d73,_0x17f594);};}exports[_0x5b2d('0x5')]=function(_0x2f6446){for(var _0x2ef786=0x0,_0x1c9bdc=events[_0x5b2d('0x6')];_0x2ef786<_0x1c9bdc;_0x2ef786++){var _0x11fd58=events[_0x2ef786];var _0xbd6dd7=createListener(_0x5b2d('0x7')+_0x11fd58,_0x2f6446);MailMessageEvents['on'](_0x11fd58,_0xbd6dd7);}}; \ No newline at end of file +var _0x6cba=['length','mailMessage:','register'];(function(_0x42b21d,_0x466185){var _0x444319=function(_0x2cadbf){while(--_0x2cadbf){_0x42b21d['push'](_0x42b21d['shift']());}};_0x444319(++_0x466185);}(_0x6cba,0x17c));var _0xa6cb=function(_0x48f832,_0x1d6e77){_0x48f832=_0x48f832-0x0;var _0x206ae5=_0x6cba[_0x48f832];return _0x206ae5;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save','remove','update'];function createListener(_0x4b988b,_0x55085a){return function(_0x4d1b83){_0x55085a['emit'](_0x4b988b,_0x4d1b83);};}function removeListener(_0x463cec,_0x3774a7){return function(){MailMessageEvents['removeListener'](_0x463cec,_0x3774a7);};}exports[_0xa6cb('0x0')]=function(_0x31ea5d){for(var _0x891bca=0x0,_0x4b955e=events[_0xa6cb('0x1')];_0x891bca<_0x4b955e;_0x891bca++){var _0x508ae0=events[_0x891bca];var _0x5411b6=createListener(_0xa6cb('0x2')+_0x508ae0,_0x31ea5d);MailMessageEvents['on'](_0x508ae0,_0x5411b6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index cba4a7a..d5dd2f8 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 _0x12c3=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','update','delete'];(function(_0x6be880,_0x5a8b34){var _0x49cc35=function(_0x4478c3){while(--_0x4478c3){_0x6be880['push'](_0x6be880['shift']());}};_0x49cc35(++_0x5a8b34);}(_0x12c3,0x17c));var _0x312c=function(_0x23a818,_0x36fc92){_0x23a818=_0x23a818-0x0;var _0x66df32=_0x12c3[_0x23a818];return _0x66df32;};'use strict';var multer=require(_0x312c('0x0'));var util=require(_0x312c('0x1'));var path=require(_0x312c('0x2'));var timeout=require(_0x312c('0x3'));var express=require(_0x312c('0x4'));var router=express[_0x312c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x312c('0x6'));var config=require('../../config/environment');var controller=require(_0x312c('0x7'));router['get']('/',auth[_0x312c('0x8')](),controller[_0x312c('0x9')]);router[_0x312c('0xa')](_0x312c('0xb'),auth['isAuthenticated'](),controller[_0x312c('0xc')]);router[_0x312c('0xa')](_0x312c('0xd'),auth['isAuthenticated'](),controller[_0x312c('0xe')]);router['get'](_0x312c('0xf'),auth[_0x312c('0x8')](),controller['getMembers']);router[_0x312c('0xa')](_0x312c('0x10'),auth[_0x312c('0x8')](),controller[_0x312c('0x11')]);router['get'](_0x312c('0x12'),auth[_0x312c('0x8')](),controller['getAgents']);router['post']('/',auth[_0x312c('0x8')](),controller[_0x312c('0x13')]);router[_0x312c('0x14')](_0x312c('0x10'),auth[_0x312c('0x8')](),controller[_0x312c('0x15')]);router[_0x312c('0x14')](_0x312c('0x12'),auth[_0x312c('0x8')](),controller[_0x312c('0x16')]);router[_0x312c('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x312c('0x18')]);router[_0x312c('0x19')](_0x312c('0xd'),auth[_0x312c('0x8')](),controller[_0x312c('0x1a')]);router[_0x312c('0x19')]('/:id/teams',auth[_0x312c('0x8')](),controller['removeTeams']);router[_0x312c('0x19')]('/:id/users',auth[_0x312c('0x8')](),controller[_0x312c('0x1b')]);module[_0x312c('0x1c')]=router; \ No newline at end of file +var _0x1adb=['./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x234429,_0x17fdb6){var _0x4ee615=function(_0x31df3f){while(--_0x31df3f){_0x234429['push'](_0x234429['shift']());}};_0x4ee615(++_0x17fdb6);}(_0x1adb,0x9d));var _0xb1ad=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1adb[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xb1ad('0x0'));var util=require('util');var path=require(_0xb1ad('0x1'));var timeout=require(_0xb1ad('0x2'));var express=require(_0xb1ad('0x3'));var router=express[_0xb1ad('0x4')]();var fs_extra=require(_0xb1ad('0x5'));var auth=require(_0xb1ad('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb1ad('0x7'));var controller=require(_0xb1ad('0x8'));router['get']('/',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xa')]);router[_0xb1ad('0xb')](_0xb1ad('0xc'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xd')]);router['get'](_0xb1ad('0xe'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0xf')]);router['get'](_0xb1ad('0x10'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x11')]);router[_0xb1ad('0xb')](_0xb1ad('0x12'),auth['isAuthenticated'](),controller[_0xb1ad('0x13')]);router['get'](_0xb1ad('0x14'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x15')]);router[_0xb1ad('0x16')]('/',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x17')]);router[_0xb1ad('0x16')](_0xb1ad('0x12'),auth['isAuthenticated'](),controller[_0xb1ad('0x18')]);router[_0xb1ad('0x16')](_0xb1ad('0x14'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x19')]);router[_0xb1ad('0x1a')]('/:id',auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1b')]);router[_0xb1ad('0x1c')](_0xb1ad('0xe'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1d')]);router[_0xb1ad('0x1c')](_0xb1ad('0x12'),auth[_0xb1ad('0x9')](),controller[_0xb1ad('0x1e')]);router[_0xb1ad('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xb1ad('0x1f')]);module[_0xb1ad('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2eb3ce6..88d9a0f 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 _0x9f84=['name','INTEGER','beepall','roundrobin','sequelize','STRING'];(function(_0x32708c,_0x5902b6){var _0x1cd526=function(_0x16a3ac){while(--_0x16a3ac){_0x32708c['push'](_0x32708c['shift']());}};_0x1cd526(++_0x5902b6);}(_0x9f84,0x6a));var _0x49f8=function(_0x3e385c,_0x24e848){_0x3e385c=_0x3e385c-0x0;var _0x4c6171=_0x9f84[_0x3e385c];return _0x4c6171;};'use strict';var Sequelize=require(_0x49f8('0x0'));module['exports']={'name':{'type':Sequelize[_0x49f8('0x1')],'unique':_0x49f8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x49f8('0x1')]},'timeout':{'type':Sequelize[_0x49f8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x49f8('0x4'),_0x49f8('0x5'))}}; \ No newline at end of file +var _0x8703=['INTEGER','beepall','roundrobin','exports','STRING','name'];(function(_0x149ead,_0x32f966){var _0x313104=function(_0x23584e){while(--_0x23584e){_0x149ead['push'](_0x149ead['shift']());}};_0x313104(++_0x32f966);}(_0x8703,0xd5));var _0x3870=function(_0x574deb,_0x156e6f){_0x574deb=_0x574deb-0x0;var _0x3c741a=_0x8703[_0x574deb];return _0x3c741a;};'use strict';var Sequelize=require('sequelize');module[_0x3870('0x0')]={'name':{'type':Sequelize[_0x3870('0x1')],'unique':_0x3870('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3870('0x1')]},'timeout':{'type':Sequelize[_0x3870('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3870('0x4'),_0x3870('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 882e9b5..0d86855 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 _0x2950=['userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','lodash','../../components/parsers/qs','api','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','findAll','rows','catch','show','params','model','keys','MailQueue','query','filters','intersection','attributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','fields','pick','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x38a2bf,_0x3a181d){var _0x21fa88=function(_0x1da1ca){while(--_0x1da1ca){_0x38a2bf['push'](_0x38a2bf['shift']());}};_0x21fa88(++_0x3a181d);}(_0x2950,0x90));var _0x0295=function(_0x2f81dc,_0x4e6a49){_0x2f81dc=_0x2f81dc-0x0;var _0xb231a=_0x2950[_0x2f81dc];return _0xb231a;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x0295('0x0'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x0295('0x1'));var logger=require('../../config/logger')(_0x0295('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0295('0x3')](config[_0x0295('0x4')],{'host':_0x0295('0x5'),'port':0x18eb});var socket=require(_0x0295('0x6'))(new Redis(config['redis']));require(_0x0295('0x7'))[_0x0295('0x8')](socket);function respondWithStatusCode(_0x413130,_0x396725){_0x396725=_0x396725||0xcc;return function(_0x1dbce6){if(_0x1dbce6){return _0x413130[_0x0295('0x9')](_0x396725);}return _0x413130[_0x0295('0xa')](_0x396725)[_0x0295('0xb')]();};}function respondWithResult(_0xd3d081,_0x39dcdb){_0x39dcdb=_0x39dcdb||0xc8;return function(_0x556491){if(_0x556491){return _0xd3d081[_0x0295('0xa')](_0x39dcdb)[_0x0295('0xc')](_0x556491);}};}function respondWithFilteredResult(_0x2bfa57,_0x3d420c){return function(_0x588f33){if(_0x588f33){var _0x9fe9c8=typeof _0x3d420c[_0x0295('0xd')]===_0x0295('0xe')&&typeof _0x3d420c[_0x0295('0xf')]===_0x0295('0xe');var _0x3b817f=_0x588f33['count'];var _0x185c1a=_0x9fe9c8?0x0:_0x3d420c['offset'];var _0x24b2a1=_0x9fe9c8?_0x588f33[_0x0295('0x10')]:_0x3d420c['offset']+_0x3d420c[_0x0295('0xf')];var _0x22d852;if(_0x24b2a1>=_0x3b817f){_0x24b2a1=_0x3b817f;_0x22d852=0xc8;}else{_0x22d852=0xce;}_0x2bfa57[_0x0295('0xa')](_0x22d852);return _0x2bfa57[_0x0295('0x11')](_0x0295('0x12'),_0x185c1a+'-'+_0x24b2a1+'/'+_0x3b817f)[_0x0295('0xc')](_0x588f33);}return null;};}function saveUpdates(_0x22d767){return function(_0x41259f){if(_0x41259f){return _0x41259f['update'](_0x22d767)['then'](function(_0x2e7509){return _0x2e7509;});}return null;};}function removeEntity(_0x6d9274){return function(_0x5a8bdd){if(_0x5a8bdd){return _0x5a8bdd['destroy']()[_0x0295('0x13')](function(){var _0x5ac43e=_0x5a8bdd[_0x0295('0x14')]({'plain':!![]});var _0x51f49f=_0x0295('0x15');return db[_0x0295('0x16')][_0x0295('0x17')]({'where':{'type':_0x51f49f,'resourceId':_0x5ac43e['id']}})[_0x0295('0x13')](function(){return _0x5a8bdd;});})[_0x0295('0x13')](function(){_0x6d9274['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24362f){return function(_0x1b3936){if(!_0x1b3936){_0x24362f[_0x0295('0x9')](0x194);}return _0x1b3936;};}function handleError(_0x173650,_0x29fb58){_0x29fb58=_0x29fb58||0x1f4;return function(_0x454967){logger[_0x0295('0x18')](_0x454967[_0x0295('0x19')]);if(_0x454967[_0x0295('0x1a')]){delete _0x454967['name'];}_0x173650[_0x0295('0xa')](_0x29fb58)[_0x0295('0x1b')](_0x454967);};}exports[_0x0295('0x1c')]=function(_0x12908e,_0x545c2a){var _0x203446={};var _0x430c35={'count':0x0,'rows':[]};var _0xb3c410=_[_0x0295('0x1d')](db['MailQueue'][_0x0295('0x1e')],function(_0x1bf063){return{'name':_0x1bf063[_0x0295('0x1f')],'type':_0x1bf063[_0x0295('0x20')][_0x0295('0x21')]};});_0x203446=qs[_0x0295('0x22')](_0xb3c410,_0x12908e);var _0x380bd0={'where':_0x203446[_0x0295('0x23')]};return db['MailQueue'][_0x0295('0x10')](_0x380bd0)['then'](function(_0x14d832){_0x430c35['count']=_0x14d832;_0x203446['include']=qs['include'](_0x12908e['query']);return db['MailQueue'][_0x0295('0x24')](_0x203446);})[_0x0295('0x13')](function(_0x17b55a){_0x430c35[_0x0295('0x25')]=_0x17b55a;return _0x430c35;})[_0x0295('0x13')](respondWithFilteredResult(_0x545c2a,_0x203446))[_0x0295('0x26')](handleError(_0x545c2a,null));};exports[_0x0295('0x27')]=function(_0x1f31ad,_0x110fbd){var _0x48e695={'raw':!![],'where':{'id':_0x1f31ad[_0x0295('0x28')]['id']}},_0x270e6d={};_0x270e6d[_0x0295('0x29')]=_[_0x0295('0x2a')](db[_0x0295('0x2b')][_0x0295('0x1e')]);_0x270e6d[_0x0295('0x2c')]=_[_0x0295('0x2a')](_0x1f31ad[_0x0295('0x2c')]);_0x270e6d[_0x0295('0x2d')]=_[_0x0295('0x2e')](_0x270e6d['model'],_0x270e6d['query']);_0x48e695[_0x0295('0x2f')]=_['intersection'](_0x270e6d[_0x0295('0x29')],qs['fields'](_0x1f31ad[_0x0295('0x2c')]['fields']));_0x48e695['attributes']=_0x48e695['attributes'][_0x0295('0x30')]?_0x48e695[_0x0295('0x2f')]:_0x270e6d['model'];if(_0x1f31ad[_0x0295('0x2c')]['includeAll']){_0x48e695['include']=[{'all':!![]}];}_0x48e695=_[_0x0295('0x31')]({},_0x48e695,_0x1f31ad[_0x0295('0x32')]);return db[_0x0295('0x2b')]['find'](_0x48e695)['then'](handleEntityNotFound(_0x110fbd,null))[_0x0295('0x13')](respondWithResult(_0x110fbd,null))[_0x0295('0x26')](handleError(_0x110fbd,null));};exports[_0x0295('0x33')]=function(_0x432799,_0x3a990e){return db[_0x0295('0x2b')][_0x0295('0x33')](_0x432799[_0x0295('0x34')],{})['then'](function(_0x48892e){var _0x17b85a=_0x432799[_0x0295('0x35')][_0x0295('0x14')]({'plain':!![]});if(!_0x17b85a)throw new Error(_0x0295('0x36'));if(_0x17b85a[_0x0295('0x37')]==='user'){var _0x2dadcb=_0x48892e[_0x0295('0x14')]({'plain':!![]});var _0x564134=_0x0295('0x15');return db[_0x0295('0x38')][_0x0295('0x39')]({'where':{'name':_0x564134,'userProfileId':_0x17b85a[_0x0295('0x3a')]},'raw':!![]})[_0x0295('0x13')](function(_0x1ca526){if(_0x1ca526&&_0x1ca526[_0x0295('0x3b')]===0x0){return db[_0x0295('0x16')][_0x0295('0x33')]({'name':_0x2dadcb['name'],'resourceId':_0x2dadcb['id'],'type':_0x1ca526[_0x0295('0x1a')],'sectionId':_0x1ca526['id']},{})['then'](function(){return _0x48892e;});}else{return _0x48892e;}})[_0x0295('0x26')](function(_0x1d124e){logger[_0x0295('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d124e);throw _0x1d124e;});}return _0x48892e;})[_0x0295('0x13')](respondWithResult(_0x3a990e,0xc9))['catch'](handleError(_0x3a990e,null));};exports['update']=function(_0x12883d,_0x21be68){if(_0x12883d[_0x0295('0x34')]['id']){delete _0x12883d['body']['id'];}return db[_0x0295('0x2b')][_0x0295('0x39')]({'where':{'id':_0x12883d['params']['id']}})[_0x0295('0x13')](handleEntityNotFound(_0x21be68,null))[_0x0295('0x13')](saveUpdates(_0x12883d[_0x0295('0x34')],null))[_0x0295('0x13')](respondWithResult(_0x21be68,null))[_0x0295('0x26')](handleError(_0x21be68,null));};exports[_0x0295('0x17')]=function(_0x329498,_0x20d7d5){return db[_0x0295('0x2b')][_0x0295('0x39')]({'where':{'id':_0x329498[_0x0295('0x28')]['id']}})['then'](handleEntityNotFound(_0x20d7d5,null))[_0x0295('0x13')](removeEntity(_0x20d7d5,null))[_0x0295('0x26')](handleError(_0x20d7d5,null));};exports[_0x0295('0x3c')]=function(_0x50b655,_0x3cbc01){return db[_0x0295('0x2b')][_0x0295('0x3c')]()['then'](respondWithResult(_0x3cbc01,null))[_0x0295('0x26')](handleError(_0x3cbc01,null));};exports['getMembers']=function(_0x5cef1b,_0x6a7d4){var _0x389a8f={'raw':!![],'where':{}},_0x5f2d69={},_0x5196f9;return db[_0x0295('0x2b')][_0x0295('0x3d')]({'where':{'id':_0x5cef1b['params']['id']}})['then'](handleEntityNotFound(_0x6a7d4,null))[_0x0295('0x13')](function(_0x226f9f){if(_0x226f9f){_0x5196f9=_0x226f9f[_0x0295('0x14')]({'plain':!![]});_0x5f2d69['model']=_[_0x0295('0x2a')](db[_0x0295('0x3e')][_0x0295('0x1e')]);_0x5f2d69['query']=_[_0x0295('0x2a')](_0x5cef1b[_0x0295('0x2c')]);_0x5f2d69[_0x0295('0x2d')]=_[_0x0295('0x2e')](_0x5f2d69['model'],_0x5f2d69[_0x0295('0x2c')]);_0x389a8f[_0x0295('0x2f')]=_[_0x0295('0x2e')](_0x5f2d69[_0x0295('0x29')],qs['fields'](_0x5cef1b[_0x0295('0x2c')]['fields']));_0x389a8f['attributes']=_0x389a8f[_0x0295('0x2f')][_0x0295('0x30')]?_0x389a8f[_0x0295('0x2f')]:_0x5f2d69[_0x0295('0x29')];if(!_0x5cef1b['query'][_0x0295('0x3f')](_0x0295('0x40'))){_0x389a8f[_0x0295('0xf')]=qs['limit'](_0x5cef1b[_0x0295('0x2c')][_0x0295('0xf')]);_0x389a8f[_0x0295('0xd')]=qs[_0x0295('0xd')](_0x5cef1b[_0x0295('0x2c')][_0x0295('0xd')]);}_0x389a8f[_0x0295('0x41')]=qs[_0x0295('0x42')](_0x5cef1b[_0x0295('0x2c')][_0x0295('0x42')]);_0x389a8f[_0x0295('0x23')]=qs[_0x0295('0x2d')](_['pick'](_0x5cef1b['query'],_0x5f2d69['filters']));_0x389a8f[_0x0295('0x23')][_0x0295('0x43')]=_0x226f9f['id'];if(_0x5cef1b[_0x0295('0x2c')][_0x0295('0x44')]){_0x389a8f['where']=_[_0x0295('0x31')](_0x389a8f[_0x0295('0x23')],{'$or':_[_0x0295('0x1d')](_0x389a8f[_0x0295('0x2f')],function(_0x2c851a){var _0x2447cd={};_0x2447cd[_0x2c851a]={'$like':'%'+_0x5cef1b['query'][_0x0295('0x44')]+'%'};return _0x2447cd;})});}_0x389a8f=_[_0x0295('0x31')]({},_0x389a8f,_0x5cef1b[_0x0295('0x32')]);return db['UserMailQueue'][_0x0295('0x24')](_0x389a8f);}})['then'](function(_0x12e7ef){if(_0x12e7ef){return db['User']['findAndCountAll']({'where':{'id':_[_0x0295('0x1d')](_0x12e7ef,_0x0295('0x45')),'role':'agent'},'attributes':['id',_0x0295('0x1a'),_0x0295('0x46'),_0x0295('0x47'),_0x0295('0x48')]});}})['then'](function(_0x5ad94a){if(_0x5ad94a){return{'count':_0x5ad94a[_0x0295('0x10')],'rows':_[_0x0295('0x1d')](_0x5ad94a[_0x0295('0x25')],function(_0x3b72fd){return{'membername':_0x3b72fd[_0x0295('0x1a')],'UserId':_0x3b72fd['id'],'queue_name':_0x5196f9[_0x0295('0x1a')],'MailQueueId':_0x5196f9['id'],'interface':util[_0x0295('0x49')](_0x0295('0x4a'),_0x0295('0x4b'),_0x3b72fd[_0x0295('0x1a')]),'penalty':0x0,'paused':_0x3b72fd[_0x0295('0x46')],'createdAt':_0x3b72fd[_0x0295('0x48')],'updatedAt':_0x3b72fd[_0x0295('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0295('0x13')](respondWithFilteredResult(_0x6a7d4,_0x389a8f))['catch'](handleError(_0x6a7d4,null));};exports[_0x0295('0x4c')]=function(_0x1490dc,_0x2986bc){var _0x1fc76a={};var _0x5ec623={};var _0x7096a;var _0x360840;return db['MailQueue'][_0x0295('0x3d')]({'where':{'id':_0x1490dc['params']['id']}})[_0x0295('0x13')](handleEntityNotFound(_0x2986bc,null))[_0x0295('0x13')](function(_0x3f8f9b){if(_0x3f8f9b){_0x7096a=_0x3f8f9b;_0x5ec623[_0x0295('0x29')]=_[_0x0295('0x2a')](db[_0x0295('0x4d')][_0x0295('0x1e')]);_0x5ec623[_0x0295('0x2c')]=_[_0x0295('0x2a')](_0x1490dc['query']);_0x5ec623['filters']=_['intersection'](_0x5ec623[_0x0295('0x29')],_0x5ec623[_0x0295('0x2c')]);_0x1fc76a[_0x0295('0x2f')]=_[_0x0295('0x2e')](_0x5ec623[_0x0295('0x29')],qs['fields'](_0x1490dc[_0x0295('0x2c')][_0x0295('0x4e')]));_0x1fc76a[_0x0295('0x2f')]=_0x1fc76a[_0x0295('0x2f')][_0x0295('0x30')]?_0x1fc76a[_0x0295('0x2f')]:_0x5ec623[_0x0295('0x29')];_0x1fc76a[_0x0295('0x41')]=qs[_0x0295('0x42')](_0x1490dc[_0x0295('0x2c')]['sort']);_0x1fc76a[_0x0295('0x23')]=qs['filters'](_[_0x0295('0x4f')](_0x1490dc[_0x0295('0x2c')],_0x5ec623[_0x0295('0x2d')]));if(_0x1490dc[_0x0295('0x2c')][_0x0295('0x44')]){_0x1fc76a[_0x0295('0x23')]=_[_0x0295('0x31')](_0x1fc76a['where'],{'$or':_['map'](_0x1fc76a[_0x0295('0x2f')],function(_0x2fbd24){var _0x980d5={};_0x980d5[_0x2fbd24]={'$like':'%'+_0x1490dc[_0x0295('0x2c')][_0x0295('0x44')]+'%'};return _0x980d5;})});}_0x1fc76a=_['merge']({},_0x1fc76a,_0x1490dc[_0x0295('0x32')]);return _0x7096a[_0x0295('0x4c')](_0x1fc76a);}})[_0x0295('0x13')](function(_0x2f9de7){if(_0x2f9de7){_0x360840=_0x2f9de7[_0x0295('0x30')];if(!_0x1490dc['query']['hasOwnProperty'](_0x0295('0x40'))){_0x1fc76a[_0x0295('0xf')]=qs[_0x0295('0xf')](_0x1490dc['query'][_0x0295('0xf')]);_0x1fc76a[_0x0295('0xd')]=qs[_0x0295('0xd')](_0x1490dc['query']['offset']);}return _0x7096a[_0x0295('0x4c')](_0x1fc76a);}})[_0x0295('0x13')](function(_0x2df4ea){if(_0x2df4ea){return _0x2df4ea?{'count':_0x360840,'rows':_0x2df4ea}:null;}})['then'](respondWithResult(_0x2986bc,null))[_0x0295('0x26')](handleError(_0x2986bc,null));};exports[_0x0295('0x50')]=function(_0x71ac3b,_0x1cc66c){var _0x48be9d=_0x71ac3b[_0x0295('0x34')][_0x0295('0x51')];return db[_0x0295('0x4d')][_0x0295('0x24')]({'where':{'id':_0x48be9d},'attributes':['id'],'include':[{'model':db[_0x0295('0x52')],'as':_0x0295('0x53'),'attributes':['id','name',_0x0295('0x54'),_0x0295('0x55'),_0x0295('0x56')],'raw':!![]}]})['then'](function(_0x471fd5){if(_0x471fd5){var _0x2592d9=_[_0x0295('0x57')](_0x471fd5,function(_0x114535){var _0x2a0b58=_0x114535[_0x0295('0x14')]({'plain':!![]});return _0x2a0b58['Agents'];});return db[_0x0295('0x2b')]['find']({'where':{'id':_0x71ac3b[_0x0295('0x28')]['id']}})['then'](function(_0x3556b8){return db[_0x0295('0x58')][_0x0295('0x59')](function(_0x5bc286){return _0x3556b8[_0x0295('0x50')](_0x48be9d,{'transaction':_0x5bc286})[_0x0295('0x13')](function(){return BPromise[_0x0295('0x5a')](_0x2592d9,function(_0x58022c){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x58022c['id'],'MailQueueId':_0x71ac3b[_0x0295('0x28')]['id']},'transaction':_0x5bc286});});})[_0x0295('0x13')](function(){_0x2592d9['forEach'](function(_0x2db260){socket[_0x0295('0x5b')](_0x0295('0x5c'),{'UserId':_0x2db260['id'],'MailQueueId':_0x3556b8['id']});});});});});}})['then'](respondWithStatusCode(_0x1cc66c,null))[_0x0295('0x26')](handleError(_0x1cc66c,null));};exports[_0x0295('0x5d')]=function(_0x2244c8,_0x401a7a){return db[_0x0295('0x4d')]['findAll']({'where':{'id':_0x2244c8['query'][_0x0295('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0295('0x53'),'attributes':['id'],'raw':!![]}]})[_0x0295('0x13')](handleEntityNotFound(_0x401a7a,null))[_0x0295('0x13')](function(_0x5a7f7f){var _0x24ce9e=_['map'](_0x5a7f7f,'id');var _0x5efae0=[];var _0xaabb6f=[];var _0x4ac2ad=squel[_0x0295('0x5e')]();_0x4ac2ad['field'](_0x0295('0x5f'))[_0x0295('0x60')](_0x0295('0x61'),'tq')['join'](_0x0295('0x62'),'ut',_0x0295('0x63'))[_0x0295('0x23')](_0x0295('0x64'),_0x2244c8[_0x0295('0x28')]['id']);for(var _0x3922b5=0x0;_0x3922b5<_0x5a7f7f[_0x0295('0x30')];_0x3922b5+=0x1){let _0xa727e8=_0x5a7f7f[_0x3922b5];for(var _0x55009e=0x0;_0x55009e<_0xa727e8[_0x0295('0x53')]['length'];_0x55009e+=0x1){let _0x490595=_0xa727e8[_0x0295('0x53')][_0x55009e];var _0xdd9ca3=_0x4ac2ad['clone']();_0xdd9ca3['where'](_0x0295('0x65'),_0x490595['id']);_0xaabb6f[_0x0295('0x66')](db[_0x0295('0x58')][_0x0295('0x2c')](_0xdd9ca3[_0x0295('0x67')](),{'type':db[_0x0295('0x58')][_0x0295('0x68')][_0x0295('0x69')]})[_0x0295('0x13')](function(_0x41b846){if(_0x41b846['length']===0x1){return _0x490595['id'];}else{var _0x30a603=_[_0x0295('0x6a')](_[_0x0295('0x1d')](_0x41b846,'TeamId'),function(_0x130966){return _[_0x0295('0x6b')](_0x24ce9e,_0x130966);});if(_0x30a603){return _0x490595['id'];}}}));}}return BPromise['all'](_0xaabb6f)[_0x0295('0x13')](function(_0x4463a2){_0x5efae0=_(_0x5efae0)['union'](_0x4463a2)[_0x0295('0x6c')]()[_0x0295('0x6d')]();return db[_0x0295('0x2b')][_0x0295('0x39')]({'where':{'id':_0x2244c8[_0x0295('0x28')]['id']}})[_0x0295('0x13')](function(_0x187594){return db['sequelize'][_0x0295('0x59')](function(_0x2b54ca){return _0x187594[_0x0295('0x5d')](_0x2244c8[_0x0295('0x2c')][_0x0295('0x51')],{'transaction':_0x2b54ca})[_0x0295('0x13')](function(){if(!_[_0x0295('0x6e')](_0x5efae0)){return _0x187594['removeAgents'](_0x5efae0,{'transaction':_0x2b54ca});}})[_0x0295('0x13')](function(){_0x5efae0['forEach'](function(_0x2ec9f4){socket[_0x0295('0x5b')](_0x0295('0x6f'),{'UserId':_0x2ec9f4,'MailQueueId':_0x187594['id']});});});});});});})[_0x0295('0x13')](respondWithStatusCode(_0x401a7a,null))[_0x0295('0x26')](handleError(_0x401a7a,null));};exports['addAgents']=function(_0x2da8f7,_0x1d9fce){return db['MailQueue']['find']({'where':{'id':_0x2da8f7['params']['id']}})[_0x0295('0x13')](handleEntityNotFound(_0x1d9fce,null))['then'](function(_0x3590a1){if(_0x3590a1){return _0x3590a1[_0x0295('0x70')](_0x2da8f7[_0x0295('0x34')][_0x0295('0x51')],_[_0x0295('0x71')](_0x2da8f7[_0x0295('0x34')],['ids','id'])||{})[_0x0295('0x72')](function(_0x3e3f71){for(var _0x2343b5=0x0;_0x2343b5<_0x2da8f7[_0x0295('0x34')]['ids']['length'];_0x2343b5+=0x1){socket['emit'](_0x0295('0x5c'),{'UserId':Number(_0x2da8f7[_0x0295('0x34')][_0x0295('0x51')][_0x2343b5]),'MailQueueId':Number(_0x2da8f7[_0x0295('0x28')]['id'])});}return _0x3e3f71;});}})[_0x0295('0x13')](respondWithResult(_0x1d9fce,null))['catch'](handleError(_0x1d9fce,null));};exports[_0x0295('0x73')]=function(_0x502849,_0x4fa6ef){return db[_0x0295('0x2b')]['find']({'where':{'id':_0x502849[_0x0295('0x28')]['id']}})[_0x0295('0x13')](handleEntityNotFound(_0x4fa6ef,null))[_0x0295('0x13')](function(_0x1b70ac){if(_0x1b70ac){return _0x1b70ac['removeAgents'](_0x502849[_0x0295('0x2c')][_0x0295('0x51')])[_0x0295('0x13')](function(){if(_[_0x0295('0x74')](_0x502849['query'][_0x0295('0x51')])){for(var _0x59dec6=0x0;_0x59dec6<_0x502849[_0x0295('0x2c')]['ids'][_0x0295('0x30')];_0x59dec6+=0x1){socket['emit'](_0x0295('0x6f'),{'UserId':Number(_0x502849['query'][_0x0295('0x51')][_0x59dec6]),'MailQueueId':Number(_0x502849[_0x0295('0x28')]['id'])});}}else{socket[_0x0295('0x5b')](_0x0295('0x6f'),{'UserId':Number(_0x502849['query'][_0x0295('0x51')]),'MailQueueId':Number(_0x502849[_0x0295('0x28')]['id'])});}});}})[_0x0295('0x13')](respondWithStatusCode(_0x4fa6ef,null))[_0x0295('0x26')](handleError(_0x4fa6ef,null));};exports[_0x0295('0x75')]=function(_0x21aa52,_0x35c038){var _0x377de7={};var _0x54e72e={};var _0x6ccfc;var _0x4b8f0a;return db[_0x0295('0x2b')]['findOne']({'where':{'id':_0x21aa52[_0x0295('0x28')]['id']}})[_0x0295('0x13')](handleEntityNotFound(_0x35c038,null))[_0x0295('0x13')](function(_0x106a6d){if(_0x106a6d){_0x6ccfc=_0x106a6d;_0x54e72e[_0x0295('0x29')]=_[_0x0295('0x2a')](db[_0x0295('0x52')][_0x0295('0x1e')]);_0x54e72e[_0x0295('0x2c')]=_['keys'](_0x21aa52[_0x0295('0x2c')]);_0x54e72e['filters']=_[_0x0295('0x2e')](_0x54e72e[_0x0295('0x29')],_0x54e72e[_0x0295('0x2c')]);_0x377de7['attributes']=_[_0x0295('0x2e')](_0x54e72e['model'],qs[_0x0295('0x4e')](_0x21aa52[_0x0295('0x2c')][_0x0295('0x4e')]));_0x377de7[_0x0295('0x2f')]=_0x377de7[_0x0295('0x2f')]['length']?_0x377de7[_0x0295('0x2f')]:_0x54e72e[_0x0295('0x29')];_0x377de7['order']=qs[_0x0295('0x42')](_0x21aa52[_0x0295('0x2c')][_0x0295('0x42')]);_0x377de7['where']=qs[_0x0295('0x2d')](_[_0x0295('0x4f')](_0x21aa52[_0x0295('0x2c')],_0x54e72e['filters']));if(_0x21aa52[_0x0295('0x2c')][_0x0295('0x44')]){_0x377de7['where']=_['merge'](_0x377de7['where'],{'$or':_[_0x0295('0x1d')](_0x377de7[_0x0295('0x2f')],function(_0x15a624){var _0x3cc6d5={};_0x3cc6d5[_0x15a624]={'$like':'%'+_0x21aa52[_0x0295('0x2c')]['filter']+'%'};return _0x3cc6d5;})});}_0x377de7=_[_0x0295('0x31')]({},_0x377de7,_0x21aa52[_0x0295('0x32')]);return _0x6ccfc[_0x0295('0x75')](_0x377de7);}})[_0x0295('0x13')](function(_0x222044){if(_0x222044){_0x4b8f0a=_0x222044[_0x0295('0x30')];if(!_0x21aa52['query'][_0x0295('0x3f')](_0x0295('0x40'))){_0x377de7[_0x0295('0xf')]=qs[_0x0295('0xf')](_0x21aa52[_0x0295('0x2c')][_0x0295('0xf')]);_0x377de7['offset']=qs[_0x0295('0xd')](_0x21aa52[_0x0295('0x2c')]['offset']);}return _0x6ccfc[_0x0295('0x75')](_0x377de7);}})[_0x0295('0x13')](function(_0x214fb0){if(_0x214fb0){return _0x214fb0?{'count':_0x4b8f0a,'rows':_0x214fb0}:null;}})['then'](respondWithResult(_0x35c038,null))[_0x0295('0x26')](handleError(_0x35c038,null));}; \ No newline at end of file +var _0x1dfa=['getMembers','findOne','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','where','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','forEach','userMailQueue:save','Team','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','emit','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','pick','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','limit','count','offset','set','Content-Range','then','MailQueues','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','key','getOptions','include','findAll','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe'];(function(_0x2e8f7b,_0x492255){var _0x1741f9=function(_0x1f23ae){while(--_0x1f23ae){_0x2e8f7b['push'](_0x2e8f7b['shift']());}};_0x1741f9(++_0x492255);}(_0x1dfa,0xb8));var _0xa1df=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1dfa[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0xa1df('0x0'));var util=require('util');var _=require(_0xa1df('0x1'));var squel=require(_0xa1df('0x2'));var Redis=require('ioredis');var qs=require(_0xa1df('0x3'));var logger=require(_0xa1df('0x4'))(_0xa1df('0x5'));var config=require(_0xa1df('0x6'));var db=require(_0xa1df('0x7'))['db'];config[_0xa1df('0x8')]=_['defaults'](config[_0xa1df('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1df('0x9'))(new Redis(config[_0xa1df('0x8')]));require(_0xa1df('0xa'))['register'](socket);function respondWithStatusCode(_0x3ab27e,_0xefce8b){_0xefce8b=_0xefce8b||0xcc;return function(_0xc2e903){if(_0xc2e903){return _0x3ab27e[_0xa1df('0xb')](_0xefce8b);}return _0x3ab27e[_0xa1df('0xc')](_0xefce8b)[_0xa1df('0xd')]();};}function respondWithResult(_0x292f8a,_0x1751f0){_0x1751f0=_0x1751f0||0xc8;return function(_0x56f38e){if(_0x56f38e){return _0x292f8a['status'](_0x1751f0)[_0xa1df('0xe')](_0x56f38e);}};}function respondWithFilteredResult(_0x5c456f,_0x14c342){return function(_0x2db871){if(_0x2db871){var _0x5d0c07=typeof _0x14c342['offset']==='undefined'&&typeof _0x14c342[_0xa1df('0xf')]==='undefined';var _0x1e93e0=_0x2db871[_0xa1df('0x10')];var _0x1bf858=_0x5d0c07?0x0:_0x14c342[_0xa1df('0x11')];var _0x4be7d6=_0x5d0c07?_0x2db871['count']:_0x14c342['offset']+_0x14c342['limit'];var _0x79f1a5;if(_0x4be7d6>=_0x1e93e0){_0x4be7d6=_0x1e93e0;_0x79f1a5=0xc8;}else{_0x79f1a5=0xce;}_0x5c456f['status'](_0x79f1a5);return _0x5c456f[_0xa1df('0x12')](_0xa1df('0x13'),_0x1bf858+'-'+_0x4be7d6+'/'+_0x1e93e0)['json'](_0x2db871);}return null;};}function saveUpdates(_0xe4bfc1){return function(_0x22e022){if(_0x22e022){return _0x22e022['update'](_0xe4bfc1)[_0xa1df('0x14')](function(_0x378180){return _0x378180;});}return null;};}function removeEntity(_0x571ad7){return function(_0x31b2a0){if(_0x31b2a0){return _0x31b2a0['destroy']()['then'](function(){var _0x1993aa=_0x31b2a0['get']({'plain':!![]});var _0x392b4e=_0xa1df('0x15');return db[_0xa1df('0x16')][_0xa1df('0x17')]({'where':{'type':_0x392b4e,'resourceId':_0x1993aa['id']}})[_0xa1df('0x14')](function(){return _0x31b2a0;});})[_0xa1df('0x14')](function(){_0x571ad7[_0xa1df('0xc')](0xcc)[_0xa1df('0xd')]();});}};}function handleEntityNotFound(_0x21c1d2){return function(_0x11fe58){if(!_0x11fe58){_0x21c1d2[_0xa1df('0xb')](0x194);}return _0x11fe58;};}function handleError(_0x323f4a,_0x1a87e0){_0x1a87e0=_0x1a87e0||0x1f4;return function(_0x34f8c6){logger[_0xa1df('0x18')](_0x34f8c6['stack']);if(_0x34f8c6[_0xa1df('0x19')]){delete _0x34f8c6[_0xa1df('0x19')];}_0x323f4a[_0xa1df('0xc')](_0x1a87e0)[_0xa1df('0x1a')](_0x34f8c6);};}exports[_0xa1df('0x1b')]=function(_0x175112,_0x5932c9){var _0x5d34fa={};var _0x4a68b1={'count':0x0,'rows':[]};var _0x301a45=_[_0xa1df('0x1c')](db[_0xa1df('0x1d')][_0xa1df('0x1e')],function(_0x4913de){return{'name':_0x4913de['fieldName'],'type':_0x4913de['type'][_0xa1df('0x1f')]};});_0x5d34fa=qs[_0xa1df('0x20')](_0x301a45,_0x175112);var _0x450dc7={'where':_0x5d34fa['where']};return db['MailQueue'][_0xa1df('0x10')](_0x450dc7)[_0xa1df('0x14')](function(_0x3973ef){_0x4a68b1[_0xa1df('0x10')]=_0x3973ef;_0x5d34fa['include']=qs[_0xa1df('0x21')](_0x175112['query']);return db[_0xa1df('0x1d')][_0xa1df('0x22')](_0x5d34fa);})['then'](function(_0x4f1367){_0x4a68b1['rows']=_0x4f1367;return _0x4a68b1;})[_0xa1df('0x14')](respondWithFilteredResult(_0x5932c9,_0x5d34fa))['catch'](handleError(_0x5932c9,null));};exports[_0xa1df('0x23')]=function(_0x3c1e76,_0x147d13){var _0x1734d6={'raw':!![],'where':{'id':_0x3c1e76[_0xa1df('0x24')]['id']}},_0x704b76={};_0x704b76[_0xa1df('0x25')]=_[_0xa1df('0x26')](db[_0xa1df('0x1d')][_0xa1df('0x1e')]);_0x704b76[_0xa1df('0x27')]=_[_0xa1df('0x26')](_0x3c1e76[_0xa1df('0x27')]);_0x704b76[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x704b76['model'],_0x704b76['query']);_0x1734d6[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x704b76['model'],qs['fields'](_0x3c1e76['query'][_0xa1df('0x2b')]));_0x1734d6[_0xa1df('0x2a')]=_0x1734d6[_0xa1df('0x2a')]['length']?_0x1734d6[_0xa1df('0x2a')]:_0x704b76[_0xa1df('0x25')];if(_0x3c1e76[_0xa1df('0x27')][_0xa1df('0x2c')]){_0x1734d6[_0xa1df('0x21')]=[{'all':!![]}];}_0x1734d6=_[_0xa1df('0x2d')]({},_0x1734d6,_0x3c1e76[_0xa1df('0x2e')]);return db[_0xa1df('0x1d')][_0xa1df('0x2f')](_0x1734d6)['then'](handleEntityNotFound(_0x147d13,null))[_0xa1df('0x14')](respondWithResult(_0x147d13,null))[_0xa1df('0x30')](handleError(_0x147d13,null));};exports[_0xa1df('0x31')]=function(_0x10b5fc,_0x449355){return db['MailQueue'][_0xa1df('0x31')](_0x10b5fc['body'],{})[_0xa1df('0x14')](function(_0x19bde8){var _0x26c4ef=_0x10b5fc['user']['get']({'plain':!![]});if(!_0x26c4ef)throw new Error(_0xa1df('0x32'));if(_0x26c4ef[_0xa1df('0x33')]===_0xa1df('0x34')){var _0x20350b=_0x19bde8[_0xa1df('0x35')]({'plain':!![]});var _0x3bd134='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x3bd134,'userProfileId':_0x26c4ef[_0xa1df('0x36')]},'raw':!![]})[_0xa1df('0x14')](function(_0x3cbf31){if(_0x3cbf31&&_0x3cbf31[_0xa1df('0x37')]===0x0){return db[_0xa1df('0x16')]['create']({'name':_0x20350b[_0xa1df('0x19')],'resourceId':_0x20350b['id'],'type':_0x3cbf31['name'],'sectionId':_0x3cbf31['id']},{})[_0xa1df('0x14')](function(){return _0x19bde8;});}else{return _0x19bde8;}})[_0xa1df('0x30')](function(_0x5af0a7){logger[_0xa1df('0x18')](_0xa1df('0x38'),_0x5af0a7);throw _0x5af0a7;});}return _0x19bde8;})['then'](respondWithResult(_0x449355,0xc9))[_0xa1df('0x30')](handleError(_0x449355,null));};exports[_0xa1df('0x39')]=function(_0x1181e6,_0x182a0b){if(_0x1181e6[_0xa1df('0x3a')]['id']){delete _0x1181e6[_0xa1df('0x3a')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x1181e6['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x182a0b,null))[_0xa1df('0x14')](saveUpdates(_0x1181e6[_0xa1df('0x3a')],null))['then'](respondWithResult(_0x182a0b,null))[_0xa1df('0x30')](handleError(_0x182a0b,null));};exports['destroy']=function(_0x4529b9,_0x18cd26){return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x4529b9['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x18cd26,null))['then'](removeEntity(_0x18cd26,null))[_0xa1df('0x30')](handleError(_0x18cd26,null));};exports[_0xa1df('0x3b')]=function(_0x325c99,_0x50cd6d){return db['MailQueue'][_0xa1df('0x3b')]()[_0xa1df('0x14')](respondWithResult(_0x50cd6d,null))[_0xa1df('0x30')](handleError(_0x50cd6d,null));};exports[_0xa1df('0x3c')]=function(_0x55490d,_0x55ff2e){var _0x5cd484={'raw':!![],'where':{}},_0x2a5a81={},_0x5cfbb2;return db['MailQueue'][_0xa1df('0x3d')]({'where':{'id':_0x55490d[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x55ff2e,null))[_0xa1df('0x14')](function(_0x447f1c){if(_0x447f1c){_0x5cfbb2=_0x447f1c[_0xa1df('0x35')]({'plain':!![]});_0x2a5a81[_0xa1df('0x25')]=_[_0xa1df('0x26')](db[_0xa1df('0x3e')][_0xa1df('0x1e')]);_0x2a5a81['query']=_[_0xa1df('0x26')](_0x55490d[_0xa1df('0x27')]);_0x2a5a81[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x2a5a81[_0xa1df('0x25')],_0x2a5a81[_0xa1df('0x27')]);_0x5cd484[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x2a5a81[_0xa1df('0x25')],qs[_0xa1df('0x2b')](_0x55490d[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x5cd484['attributes']=_0x5cd484[_0xa1df('0x2a')][_0xa1df('0x3f')]?_0x5cd484[_0xa1df('0x2a')]:_0x2a5a81[_0xa1df('0x25')];if(!_0x55490d['query'][_0xa1df('0x40')](_0xa1df('0x41'))){_0x5cd484[_0xa1df('0xf')]=qs[_0xa1df('0xf')](_0x55490d['query'][_0xa1df('0xf')]);_0x5cd484[_0xa1df('0x11')]=qs[_0xa1df('0x11')](_0x55490d['query'][_0xa1df('0x11')]);}_0x5cd484[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x55490d[_0xa1df('0x27')]['sort']);_0x5cd484['where']=qs[_0xa1df('0x28')](_['pick'](_0x55490d[_0xa1df('0x27')],_0x2a5a81[_0xa1df('0x28')]));_0x5cd484[_0xa1df('0x44')][_0xa1df('0x45')]=_0x447f1c['id'];if(_0x55490d[_0xa1df('0x27')][_0xa1df('0x46')]){_0x5cd484[_0xa1df('0x44')]=_['merge'](_0x5cd484[_0xa1df('0x44')],{'$or':_['map'](_0x5cd484[_0xa1df('0x2a')],function(_0x15e7d4){var _0x193a0b={};_0x193a0b[_0x15e7d4]={'$like':'%'+_0x55490d[_0xa1df('0x27')]['filter']+'%'};return _0x193a0b;})});}_0x5cd484=_['merge']({},_0x5cd484,_0x55490d['options']);return db['UserMailQueue']['findAll'](_0x5cd484);}})[_0xa1df('0x14')](function(_0x3595f7){if(_0x3595f7){return db[_0xa1df('0x47')][_0xa1df('0x48')]({'where':{'id':_[_0xa1df('0x1c')](_0x3595f7,_0xa1df('0x49')),'role':_0xa1df('0x4a')},'attributes':['id',_0xa1df('0x19'),_0xa1df('0x4b'),_0xa1df('0x4c'),_0xa1df('0x4d')]});}})[_0xa1df('0x14')](function(_0x56e3a7){if(_0x56e3a7){return{'count':_0x56e3a7[_0xa1df('0x10')],'rows':_[_0xa1df('0x1c')](_0x56e3a7[_0xa1df('0x4e')],function(_0x1e6aa9){return{'membername':_0x1e6aa9[_0xa1df('0x19')],'UserId':_0x1e6aa9['id'],'queue_name':_0x5cfbb2[_0xa1df('0x19')],'MailQueueId':_0x5cfbb2['id'],'interface':util[_0xa1df('0x4f')](_0xa1df('0x50'),_0xa1df('0x51'),_0x1e6aa9[_0xa1df('0x19')]),'penalty':0x0,'paused':_0x1e6aa9['mailPause'],'createdAt':_0x1e6aa9[_0xa1df('0x4d')],'updatedAt':_0x1e6aa9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa1df('0x14')](respondWithFilteredResult(_0x55ff2e,_0x5cd484))[_0xa1df('0x30')](handleError(_0x55ff2e,null));};exports[_0xa1df('0x52')]=function(_0x1106ac,_0x599303){var _0x2e98a3={};var _0x46611d={};var _0xf48fbe;var _0x330c10;return db['MailQueue'][_0xa1df('0x3d')]({'where':{'id':_0x1106ac[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x599303,null))[_0xa1df('0x14')](function(_0x56a6a8){if(_0x56a6a8){_0xf48fbe=_0x56a6a8;_0x46611d[_0xa1df('0x25')]=_[_0xa1df('0x26')](db['Team'][_0xa1df('0x1e')]);_0x46611d['query']=_[_0xa1df('0x26')](_0x1106ac[_0xa1df('0x27')]);_0x46611d[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0x46611d[_0xa1df('0x25')],_0x46611d['query']);_0x2e98a3[_0xa1df('0x2a')]=_[_0xa1df('0x29')](_0x46611d[_0xa1df('0x25')],qs['fields'](_0x1106ac[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x2e98a3[_0xa1df('0x2a')]=_0x2e98a3['attributes'][_0xa1df('0x3f')]?_0x2e98a3[_0xa1df('0x2a')]:_0x46611d[_0xa1df('0x25')];_0x2e98a3[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x1106ac['query']['sort']);_0x2e98a3[_0xa1df('0x44')]=qs['filters'](_['pick'](_0x1106ac['query'],_0x46611d['filters']));if(_0x1106ac[_0xa1df('0x27')][_0xa1df('0x46')]){_0x2e98a3[_0xa1df('0x44')]=_[_0xa1df('0x2d')](_0x2e98a3[_0xa1df('0x44')],{'$or':_['map'](_0x2e98a3['attributes'],function(_0x3e5a0c){var _0x19537b={};_0x19537b[_0x3e5a0c]={'$like':'%'+_0x1106ac[_0xa1df('0x27')][_0xa1df('0x46')]+'%'};return _0x19537b;})});}_0x2e98a3=_['merge']({},_0x2e98a3,_0x1106ac[_0xa1df('0x2e')]);return _0xf48fbe[_0xa1df('0x52')](_0x2e98a3);}})[_0xa1df('0x14')](function(_0x342494){if(_0x342494){_0x330c10=_0x342494[_0xa1df('0x3f')];if(!_0x1106ac[_0xa1df('0x27')]['hasOwnProperty']('nolimit')){_0x2e98a3[_0xa1df('0xf')]=qs['limit'](_0x1106ac['query'][_0xa1df('0xf')]);_0x2e98a3[_0xa1df('0x11')]=qs['offset'](_0x1106ac[_0xa1df('0x27')]['offset']);}return _0xf48fbe[_0xa1df('0x52')](_0x2e98a3);}})['then'](function(_0x270888){if(_0x270888){return _0x270888?{'count':_0x330c10,'rows':_0x270888}:null;}})[_0xa1df('0x14')](respondWithResult(_0x599303,null))[_0xa1df('0x30')](handleError(_0x599303,null));};exports[_0xa1df('0x53')]=function(_0x1b1872,_0x1c2b3f){var _0x404a6b=_0x1b1872[_0xa1df('0x3a')][_0xa1df('0x54')];return db['Team']['findAll']({'where':{'id':_0x404a6b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa1df('0x55'),'attributes':['id',_0xa1df('0x19'),_0xa1df('0x56'),'voicePause',_0xa1df('0x57')],'raw':!![]}]})['then'](function(_0x1f1230){if(_0x1f1230){var _0x10ebac=_[_0xa1df('0x58')](_0x1f1230,function(_0x19599a){var _0x424092=_0x19599a[_0xa1df('0x35')]({'plain':!![]});return _0x424092[_0xa1df('0x55')];});return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x1b1872[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](function(_0x3d75c4){return db[_0xa1df('0x59')][_0xa1df('0x5a')](function(_0x525ed4){return _0x3d75c4[_0xa1df('0x53')](_0x404a6b,{'transaction':_0x525ed4})[_0xa1df('0x14')](function(){return BPromise['each'](_0x10ebac,function(_0x362be4){return db[_0xa1df('0x3e')]['findOrCreate']({'where':{'UserId':_0x362be4['id'],'MailQueueId':_0x1b1872[_0xa1df('0x24')]['id']},'transaction':_0x525ed4});});})['then'](function(){_0x10ebac[_0xa1df('0x5b')](function(_0x1eb074){socket['emit'](_0xa1df('0x5c'),{'UserId':_0x1eb074['id'],'MailQueueId':_0x3d75c4['id']});});});});});}})[_0xa1df('0x14')](respondWithStatusCode(_0x1c2b3f,null))[_0xa1df('0x30')](handleError(_0x1c2b3f,null));};exports['removeTeams']=function(_0x561c64,_0x6274c2){return db[_0xa1df('0x5d')]['findAll']({'where':{'id':_0x561c64['query'][_0xa1df('0x54')]},'attributes':['id'],'include':[{'model':db[_0xa1df('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa1df('0x14')](handleEntityNotFound(_0x6274c2,null))[_0xa1df('0x14')](function(_0x229c17){var _0xca19d0=_[_0xa1df('0x1c')](_0x229c17,'id');var _0x469dbf=[];var _0x37f76f=[];var _0x25d367=squel[_0xa1df('0x5e')]();_0x25d367[_0xa1df('0x5f')](_0xa1df('0x60'))[_0xa1df('0x61')]('team_has_mail_queues','tq')[_0xa1df('0x62')](_0xa1df('0x63'),'ut',_0xa1df('0x64'))[_0xa1df('0x44')]('MailQueueId\x20=\x20?',_0x561c64[_0xa1df('0x24')]['id']);for(var _0x46c432=0x0;_0x46c432<_0x229c17['length'];_0x46c432+=0x1){let _0x4b3521=_0x229c17[_0x46c432];for(var _0x273d0a=0x0;_0x273d0a<_0x4b3521['Agents'][_0xa1df('0x3f')];_0x273d0a+=0x1){let _0xf82a61=_0x4b3521[_0xa1df('0x55')][_0x273d0a];var _0x23c933=_0x25d367[_0xa1df('0x65')]();_0x23c933['where'](_0xa1df('0x66'),_0xf82a61['id']);_0x37f76f['push'](db[_0xa1df('0x59')][_0xa1df('0x27')](_0x23c933['toString'](),{'type':db[_0xa1df('0x59')][_0xa1df('0x67')][_0xa1df('0x68')]})[_0xa1df('0x14')](function(_0x4c3710){if(_0x4c3710['length']===0x1){return _0xf82a61['id'];}else{var _0xb9ca44=_[_0xa1df('0x69')](_[_0xa1df('0x1c')](_0x4c3710,_0xa1df('0x6a')),function(_0x43e7fe){return _[_0xa1df('0x6b')](_0xca19d0,_0x43e7fe);});if(_0xb9ca44){return _0xf82a61['id'];}}}));}}return BPromise[_0xa1df('0x6c')](_0x37f76f)[_0xa1df('0x14')](function(_0x1faab2){_0x469dbf=_(_0x469dbf)[_0xa1df('0x6d')](_0x1faab2)[_0xa1df('0x6e')]()[_0xa1df('0x6f')]();return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x561c64[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](function(_0x22ba61){return db['sequelize'][_0xa1df('0x5a')](function(_0xf383fe){return _0x22ba61[_0xa1df('0x70')](_0x561c64[_0xa1df('0x27')]['ids'],{'transaction':_0xf383fe})[_0xa1df('0x14')](function(){if(!_['isEmpty'](_0x469dbf)){return _0x22ba61['removeAgents'](_0x469dbf,{'transaction':_0xf383fe});}})[_0xa1df('0x14')](function(){_0x469dbf['forEach'](function(_0xf902ef){socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':_0xf902ef,'MailQueueId':_0x22ba61['id']});});});});});});})['then'](respondWithStatusCode(_0x6274c2,null))[_0xa1df('0x30')](handleError(_0x6274c2,null));};exports['addAgents']=function(_0x5d10be,_0x150aa1){return db[_0xa1df('0x1d')][_0xa1df('0x2f')]({'where':{'id':_0x5d10be['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x150aa1,null))[_0xa1df('0x14')](function(_0x16a850){if(_0x16a850){return _0x16a850[_0xa1df('0x73')](_0x5d10be['body'][_0xa1df('0x54')],_[_0xa1df('0x74')](_0x5d10be[_0xa1df('0x3a')],[_0xa1df('0x54'),'id'])||{})[_0xa1df('0x75')](function(_0x292d03){for(var _0x4ccb35=0x0;_0x4ccb35<_0x5d10be['body'][_0xa1df('0x54')][_0xa1df('0x3f')];_0x4ccb35+=0x1){socket[_0xa1df('0x71')](_0xa1df('0x5c'),{'UserId':Number(_0x5d10be[_0xa1df('0x3a')][_0xa1df('0x54')][_0x4ccb35]),'MailQueueId':Number(_0x5d10be[_0xa1df('0x24')]['id'])});}return _0x292d03;});}})[_0xa1df('0x14')](respondWithResult(_0x150aa1,null))['catch'](handleError(_0x150aa1,null));};exports['removeAgents']=function(_0x240bf1,_0x286457){return db['MailQueue']['find']({'where':{'id':_0x240bf1['params']['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x286457,null))[_0xa1df('0x14')](function(_0x512159){if(_0x512159){return _0x512159[_0xa1df('0x76')](_0x240bf1['query'][_0xa1df('0x54')])[_0xa1df('0x14')](function(){if(_[_0xa1df('0x77')](_0x240bf1[_0xa1df('0x27')][_0xa1df('0x54')])){for(var _0x428841=0x0;_0x428841<_0x240bf1['query'][_0xa1df('0x54')]['length'];_0x428841+=0x1){socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':Number(_0x240bf1[_0xa1df('0x27')][_0xa1df('0x54')][_0x428841]),'MailQueueId':Number(_0x240bf1[_0xa1df('0x24')]['id'])});}}else{socket[_0xa1df('0x71')](_0xa1df('0x72'),{'UserId':Number(_0x240bf1['query'][_0xa1df('0x54')]),'MailQueueId':Number(_0x240bf1['params']['id'])});}});}})[_0xa1df('0x14')](respondWithStatusCode(_0x286457,null))[_0xa1df('0x30')](handleError(_0x286457,null));};exports[_0xa1df('0x78')]=function(_0x403f65,_0x1b4881){var _0x99a363={};var _0xa546e3={};var _0x19769b;var _0x5d90d4;return db[_0xa1df('0x1d')]['findOne']({'where':{'id':_0x403f65[_0xa1df('0x24')]['id']}})[_0xa1df('0x14')](handleEntityNotFound(_0x1b4881,null))[_0xa1df('0x14')](function(_0x3d1dcb){if(_0x3d1dcb){_0x19769b=_0x3d1dcb;_0xa546e3[_0xa1df('0x25')]=_[_0xa1df('0x26')](db['User']['rawAttributes']);_0xa546e3[_0xa1df('0x27')]=_[_0xa1df('0x26')](_0x403f65[_0xa1df('0x27')]);_0xa546e3[_0xa1df('0x28')]=_[_0xa1df('0x29')](_0xa546e3[_0xa1df('0x25')],_0xa546e3[_0xa1df('0x27')]);_0x99a363['attributes']=_[_0xa1df('0x29')](_0xa546e3['model'],qs['fields'](_0x403f65[_0xa1df('0x27')][_0xa1df('0x2b')]));_0x99a363[_0xa1df('0x2a')]=_0x99a363[_0xa1df('0x2a')]['length']?_0x99a363[_0xa1df('0x2a')]:_0xa546e3['model'];_0x99a363[_0xa1df('0x42')]=qs[_0xa1df('0x43')](_0x403f65['query'][_0xa1df('0x43')]);_0x99a363[_0xa1df('0x44')]=qs[_0xa1df('0x28')](_[_0xa1df('0x79')](_0x403f65['query'],_0xa546e3['filters']));if(_0x403f65['query']['filter']){_0x99a363[_0xa1df('0x44')]=_[_0xa1df('0x2d')](_0x99a363[_0xa1df('0x44')],{'$or':_['map'](_0x99a363[_0xa1df('0x2a')],function(_0x3681c0){var _0x166f29={};_0x166f29[_0x3681c0]={'$like':'%'+_0x403f65[_0xa1df('0x27')]['filter']+'%'};return _0x166f29;})});}_0x99a363=_['merge']({},_0x99a363,_0x403f65[_0xa1df('0x2e')]);return _0x19769b[_0xa1df('0x78')](_0x99a363);}})[_0xa1df('0x14')](function(_0x47d825){if(_0x47d825){_0x5d90d4=_0x47d825[_0xa1df('0x3f')];if(!_0x403f65[_0xa1df('0x27')][_0xa1df('0x40')]('nolimit')){_0x99a363['limit']=qs['limit'](_0x403f65[_0xa1df('0x27')][_0xa1df('0xf')]);_0x99a363[_0xa1df('0x11')]=qs[_0xa1df('0x11')](_0x403f65[_0xa1df('0x27')][_0xa1df('0x11')]);}return _0x19769b['getAgents'](_0x99a363);}})[_0xa1df('0x14')](function(_0x24a1dc){if(_0x24a1dc){return _0x24a1dc?{'count':_0x5d90d4,'rows':_0x24a1dc}:null;}})['then'](respondWithResult(_0x1b4881,null))['catch'](handleError(_0x1b4881,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index efad9eb..7867c11 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 _0xf1d6=['save','remove','emit','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1d6,0x100));var _0x6f1d=function(_0x1d7c02,_0x470ef0){_0x1d7c02=_0x1d7c02-0x0;var _0x35f733=_0xf1d6[_0x1d7c02];return _0x35f733;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x6f1d('0x0'))['db'][_0x6f1d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6f1d('0x2')](0x0);var events={'afterCreate':_0x6f1d('0x3'),'afterUpdate':'update','afterDestroy':_0x6f1d('0x4')};function emitEvent(_0x6f46fc){return function(_0x2321d6,_0x39c3fb,_0x206683){MailQueueEvents[_0x6f1d('0x5')](_0x6f46fc+':'+_0x2321d6['id'],_0x2321d6);MailQueueEvents['emit'](_0x6f46fc,_0x2321d6);_0x206683(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x6f1d('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xd9b2=['MailQueue','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5bdb15,_0x8b3fc0){var _0x12270d=function(_0x3e315b){while(--_0x3e315b){_0x5bdb15['push'](_0x5bdb15['shift']());}};_0x12270d(++_0x8b3fc0);}(_0xd9b2,0x179));var _0x2d9b=function(_0x5a31ad,_0x30d5ec){_0x5a31ad=_0x5a31ad-0x0;var _0x460f7b=_0xd9b2[_0x5a31ad];return _0x460f7b;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2d9b('0x0'))['db'][_0x2d9b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d9b('0x2'),'afterUpdate':_0x2d9b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2c4ed7){return function(_0x1c8225,_0x391fab,_0x130ce1){MailQueueEvents[_0x2d9b('0x4')](_0x2c4ed7+':'+_0x1c8225['id'],_0x1c8225);MailQueueEvents[_0x2d9b('0x4')](_0x2c4ed7,_0x1c8225);_0x130ce1(null);};}for(var e in events){if(events[_0x2d9b('0x5')](e)){var event=events[e];MailQueue[_0x2d9b('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6fcfc97..6c3a307 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 _0x9e61=['mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailQueue.attributes','MailQueue'];(function(_0x5da2a0,_0x3f6810){var _0xc7bb12=function(_0x35615b){while(--_0x35615b){_0x5da2a0['push'](_0x5da2a0['shift']());}};_0xc7bb12(++_0x3f6810);}(_0x9e61,0xe7));var _0x19e6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9e61[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x19e6('0x0'));var util=require(_0x19e6('0x1'));var logger=require(_0x19e6('0x2'))(_0x19e6('0x3'));var moment=require('moment');var BPromise=require(_0x19e6('0x4'));var rp=require(_0x19e6('0x5'));var fs=require('fs');var path=require(_0x19e6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x19e6('0x7'));module['exports']=function(_0x459c0d,_0x736aba){return _0x459c0d['define'](_0x19e6('0x8'),attributes,{'tableName':_0x19e6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88d3=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88d3,0x10f));var _0x388d=function(_0x5e0550,_0x425c1d){_0x5e0550=_0x5e0550-0x0;var _0xa3179f=_0x88d3[_0x5e0550];return _0xa3179f;};'use strict';var _=require(_0x388d('0x0'));var util=require(_0x388d('0x1'));var logger=require(_0x388d('0x2'))(_0x388d('0x3'));var moment=require('moment');var BPromise=require(_0x388d('0x4'));var rp=require(_0x388d('0x5'));var fs=require('fs');var path=require(_0x388d('0x6'));var rimraf=require(_0x388d('0x7'));var config=require(_0x388d('0x8'));var attributes=require(_0x388d('0x9'));module['exports']=function(_0x881ba4,_0x2e953b){return _0x881ba4[_0x388d('0xa')](_0x388d('0xb'),attributes,{'tableName':_0x388d('0xc'),'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 caca290..1786c11 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 _0xfbd5=['GetMailQueue','ShowMailQueue','debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x2feee8,_0x3df2e9){_0x2feee8=_0x2feee8-0x0;var _0x5d817a=_0xfbd5[_0x2feee8];return _0x5d817a;};'use strict';var _=require('lodash');var util=require(_0x5fbd('0x0'));var moment=require('moment');var BPromise=require(_0x5fbd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fbd('0x2'));var db=require(_0x5fbd('0x3'))['db'];var utils=require(_0x5fbd('0x4'));var logger=require(_0x5fbd('0x5'))(_0x5fbd('0x6'));var config=require(_0x5fbd('0x7'));var jayson=require(_0x5fbd('0x8'));var client=jayson[_0x5fbd('0x9')]['http']({'port':0x232a});config[_0x5fbd('0xa')]=_[_0x5fbd('0xb')](config['redis'],{'host':_0x5fbd('0xc'),'port':0x18eb});var socket=require(_0x5fbd('0xd'))(new Redis(config[_0x5fbd('0xa')]));require(_0x5fbd('0xe'))[_0x5fbd('0xf')](socket);function respondWithRpcPromise(_0xf95fa8,_0x53a403,_0x5c7f0a){return new BPromise(function(_0xab8e99,_0xa341bb){return client[_0x5fbd('0x10')](_0xf95fa8,_0x5c7f0a)[_0x5fbd('0x11')](function(_0x472f82){logger['info']('MailQueue,\x20%s,\x20%s',_0x53a403,_0x5fbd('0x12'));logger['debug'](_0x5fbd('0x13'),_0x53a403,_0x5fbd('0x12'),JSON[_0x5fbd('0x14')](_0x472f82));if(_0x472f82[_0x5fbd('0x15')]){if(_0x472f82[_0x5fbd('0x15')][_0x5fbd('0x16')]===0x1f4){logger[_0x5fbd('0x15')](_0x5fbd('0x17'),_0x53a403,_0x472f82[_0x5fbd('0x15')][_0x5fbd('0x18')]);return _0xa341bb(_0x472f82[_0x5fbd('0x15')][_0x5fbd('0x18')]);}logger['error'](_0x5fbd('0x17'),_0x53a403,_0x472f82[_0x5fbd('0x15')]['message']);return _0xab8e99(_0x472f82['error'][_0x5fbd('0x18')]);}else{logger[_0x5fbd('0x19')](_0x5fbd('0x17'),_0x53a403,_0x5fbd('0x12'));_0xab8e99(_0x472f82[_0x5fbd('0x1a')][_0x5fbd('0x18')]);}})[_0x5fbd('0x1b')](function(_0x86d0ad){logger[_0x5fbd('0x15')](_0x5fbd('0x17'),_0x53a403,_0x86d0ad);_0xa341bb(_0x86d0ad);});});}exports['GetMailQueue']=function(_0x46f369){var _0x2aeb9e=this;return new Promise(function(_0x4f2245,_0x148902){return db[_0x5fbd('0x1c')][_0x5fbd('0x1d')]({'raw':_0x46f369['options']?_0x46f369[_0x5fbd('0x1e')][_0x5fbd('0x1f')]===undefined?!![]:![]:!![],'where':_0x46f369['options']?_0x46f369[_0x5fbd('0x1e')][_0x5fbd('0x20')]||null:null,'attributes':_0x46f369[_0x5fbd('0x1e')]?_0x46f369[_0x5fbd('0x1e')][_0x5fbd('0x21')]||null:null,'limit':_0x46f369[_0x5fbd('0x1e')]?_0x46f369['options'][_0x5fbd('0x22')]||null:null,'include':_0x46f369[_0x5fbd('0x1e')]?_0x46f369[_0x5fbd('0x1e')]['include']?_[_0x5fbd('0x23')](_0x46f369[_0x5fbd('0x1e')][_0x5fbd('0x24')],function(_0x58357a){return{'model':db[_0x58357a[_0x5fbd('0x25')]],'as':_0x58357a['as'],'attributes':_0x58357a[_0x5fbd('0x21')],'include':_0x58357a['include']?_[_0x5fbd('0x23')](_0x58357a[_0x5fbd('0x24')],function(_0x3cf070){return{'model':db[_0x3cf070[_0x5fbd('0x25')]],'as':_0x3cf070['as'],'attributes':_0x3cf070[_0x5fbd('0x21')],'include':_0x3cf070[_0x5fbd('0x24')]?_[_0x5fbd('0x23')](_0x3cf070[_0x5fbd('0x24')],function(_0x25ba65){return{'model':db[_0x25ba65['model']],'as':_0x25ba65['as'],'attributes':_0x25ba65[_0x5fbd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fbd('0x11')](function(_0x5a99b3){logger[_0x5fbd('0x19')](_0x5fbd('0x26'),_0x46f369);logger['debug']('GetMailQueue',_0x46f369,JSON[_0x5fbd('0x14')](_0x5a99b3));_0x4f2245(_0x5a99b3);})[_0x5fbd('0x1b')](function(_0x28b5cb){logger[_0x5fbd('0x15')](_0x5fbd('0x26'),_0x28b5cb[_0x5fbd('0x18')],_0x46f369);_0x148902(_0x2aeb9e[_0x5fbd('0x15')](0x1f4,_0x28b5cb['message']));});});};exports[_0x5fbd('0x27')]=function(_0x37ea89){var _0x5beae4=this;return new Promise(function(_0x33a49f,_0x5e0fa3){return db[_0x5fbd('0x1c')]['find']({'raw':_0x37ea89[_0x5fbd('0x1e')]?_0x37ea89[_0x5fbd('0x1e')][_0x5fbd('0x1f')]===undefined?!![]:![]:!![],'where':_0x37ea89[_0x5fbd('0x1e')]?_0x37ea89[_0x5fbd('0x1e')][_0x5fbd('0x20')]||null:null,'attributes':_0x37ea89[_0x5fbd('0x1e')]?_0x37ea89[_0x5fbd('0x1e')][_0x5fbd('0x21')]||null:null,'include':_0x37ea89[_0x5fbd('0x1e')]?_0x37ea89[_0x5fbd('0x1e')][_0x5fbd('0x24')]?_[_0x5fbd('0x23')](_0x37ea89[_0x5fbd('0x1e')][_0x5fbd('0x24')],function(_0x53e4c6){return{'model':db[_0x53e4c6[_0x5fbd('0x25')]],'as':_0x53e4c6['as'],'attributes':_0x53e4c6[_0x5fbd('0x21')],'include':_0x53e4c6[_0x5fbd('0x24')]?_[_0x5fbd('0x23')](_0x53e4c6[_0x5fbd('0x24')],function(_0xe6bfd4){return{'model':db[_0xe6bfd4['model']],'as':_0xe6bfd4['as'],'attributes':_0xe6bfd4['attributes'],'include':_0xe6bfd4[_0x5fbd('0x24')]?_[_0x5fbd('0x23')](_0xe6bfd4[_0x5fbd('0x24')],function(_0x56f34b){return{'model':db[_0x56f34b['model']],'as':_0x56f34b['as'],'attributes':_0x56f34b[_0x5fbd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fbd('0x11')](function(_0x5cfd72){logger[_0x5fbd('0x19')](_0x5fbd('0x27'),_0x37ea89);logger[_0x5fbd('0x28')]('ShowMailQueue',_0x37ea89,JSON[_0x5fbd('0x14')](_0x5cfd72));_0x33a49f(_0x5cfd72);})[_0x5fbd('0x1b')](function(_0x55db0e){logger[_0x5fbd('0x15')](_0x5fbd('0x27'),_0x55db0e['message'],_0x37ea89);_0x5e0fa3(_0x5beae4[_0x5fbd('0x15')](0x1f4,_0x55db0e[_0x5fbd('0x18')]));});});}; \ No newline at end of file +var _0x67da=['options','raw','where','attributes','limit','map','include','model','info','debug','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailQueue','MailQueue'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x67da,0x192));var _0xa67d=function(_0x8d5c87,_0x6b47cd){_0x8d5c87=_0x8d5c87-0x0;var _0x327361=_0x67da[_0x8d5c87];return _0x327361;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});config['redis']=_[_0xa67d('0xb')](config[_0xa67d('0xc')],{'host':_0xa67d('0xd'),'port':0x18eb});var socket=require(_0xa67d('0xe'))(new Redis(config[_0xa67d('0xc')]));require(_0xa67d('0xf'))[_0xa67d('0x10')](socket);function respondWithRpcPromise(_0x3e58e0,_0x1e1ef6,_0x3d9b30){return new BPromise(function(_0x52a024,_0x284d90){return client[_0xa67d('0x11')](_0x3e58e0,_0x3d9b30)[_0xa67d('0x12')](function(_0x2796ee){logger['info'](_0xa67d('0x13'),_0x1e1ef6,_0xa67d('0x14'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x1e1ef6,_0xa67d('0x14'),JSON['stringify'](_0x2796ee));if(_0x2796ee[_0xa67d('0x15')]){if(_0x2796ee['error']['code']===0x1f4){logger[_0xa67d('0x15')](_0xa67d('0x13'),_0x1e1ef6,_0x2796ee['error'][_0xa67d('0x16')]);return _0x284d90(_0x2796ee[_0xa67d('0x15')][_0xa67d('0x16')]);}logger[_0xa67d('0x15')]('MailQueue,\x20%s,\x20%s',_0x1e1ef6,_0x2796ee['error']['message']);return _0x52a024(_0x2796ee['error'][_0xa67d('0x16')]);}else{logger['info'](_0xa67d('0x13'),_0x1e1ef6,_0xa67d('0x14'));_0x52a024(_0x2796ee[_0xa67d('0x17')][_0xa67d('0x16')]);}})[_0xa67d('0x18')](function(_0xb1ea04){logger[_0xa67d('0x15')]('MailQueue,\x20%s,\x20%s',_0x1e1ef6,_0xb1ea04);_0x284d90(_0xb1ea04);});});}exports[_0xa67d('0x19')]=function(_0x75055b){var _0x42f3d5=this;return new Promise(function(_0x45c57e,_0x28f38b){return db[_0xa67d('0x1a')]['findAll']({'raw':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1c')]===undefined?!![]:![]:!![],'where':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1d')]||null:null,'attributes':_0x75055b['options']?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1e')]||null:null,'limit':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')][_0xa67d('0x1f')]||null:null,'include':_0x75055b[_0xa67d('0x1b')]?_0x75055b[_0xa67d('0x1b')]['include']?_[_0xa67d('0x20')](_0x75055b[_0xa67d('0x1b')][_0xa67d('0x21')],function(_0xe0c7b2){return{'model':db[_0xe0c7b2[_0xa67d('0x22')]],'as':_0xe0c7b2['as'],'attributes':_0xe0c7b2[_0xa67d('0x1e')],'include':_0xe0c7b2['include']?_[_0xa67d('0x20')](_0xe0c7b2[_0xa67d('0x21')],function(_0x4e730e){return{'model':db[_0x4e730e[_0xa67d('0x22')]],'as':_0x4e730e['as'],'attributes':_0x4e730e[_0xa67d('0x1e')],'include':_0x4e730e[_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x4e730e[_0xa67d('0x21')],function(_0x8793cf){return{'model':db[_0x8793cf[_0xa67d('0x22')]],'as':_0x8793cf['as'],'attributes':_0x8793cf[_0xa67d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa67d('0x12')](function(_0x152d94){logger[_0xa67d('0x23')](_0xa67d('0x19'),_0x75055b);logger[_0xa67d('0x24')](_0xa67d('0x19'),_0x75055b,JSON['stringify'](_0x152d94));_0x45c57e(_0x152d94);})[_0xa67d('0x18')](function(_0x20c751){logger[_0xa67d('0x15')](_0xa67d('0x19'),_0x20c751[_0xa67d('0x16')],_0x75055b);_0x28f38b(_0x42f3d5['error'](0x1f4,_0x20c751[_0xa67d('0x16')]));});});};exports[_0xa67d('0x25')]=function(_0x3f57ed){var _0x318090=this;return new Promise(function(_0x39faa1,_0x38e0b5){return db[_0xa67d('0x1a')][_0xa67d('0x26')]({'raw':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed['options'][_0xa67d('0x1d')]||null:null,'attributes':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')]['attributes']||null:null,'include':_0x3f57ed[_0xa67d('0x1b')]?_0x3f57ed[_0xa67d('0x1b')][_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x3f57ed[_0xa67d('0x1b')][_0xa67d('0x21')],function(_0x4ded76){return{'model':db[_0x4ded76[_0xa67d('0x22')]],'as':_0x4ded76['as'],'attributes':_0x4ded76[_0xa67d('0x1e')],'include':_0x4ded76['include']?_['map'](_0x4ded76['include'],function(_0x1bbc6f){return{'model':db[_0x1bbc6f['model']],'as':_0x1bbc6f['as'],'attributes':_0x1bbc6f[_0xa67d('0x1e')],'include':_0x1bbc6f[_0xa67d('0x21')]?_[_0xa67d('0x20')](_0x1bbc6f[_0xa67d('0x21')],function(_0x35a0a0){return{'model':db[_0x35a0a0[_0xa67d('0x22')]],'as':_0x35a0a0['as'],'attributes':_0x35a0a0[_0xa67d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa67d('0x12')](function(_0x1d278f){logger[_0xa67d('0x23')](_0xa67d('0x25'),_0x3f57ed);logger[_0xa67d('0x24')](_0xa67d('0x25'),_0x3f57ed,JSON['stringify'](_0x1d278f));_0x39faa1(_0x1d278f);})['catch'](function(_0x4f32fb){logger[_0xa67d('0x15')]('ShowMailQueue',_0x4f32fb[_0xa67d('0x16')],_0x3f57ed);_0x38e0b5(_0x318090[_0xa67d('0x15')](0x1f4,_0x4f32fb[_0xa67d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ba27561..38b8a71 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 _0xc859=['register','length','mailQueue:','save','remove','update','emit','removeListener'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xc859,0x17b));var _0x9c85=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc859[_0x134c2e];return _0x2825db;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9c85('0x0'),_0x9c85('0x1'),_0x9c85('0x2')];function createListener(_0x3934f1,_0x220408){return function(_0x41035f){_0x220408[_0x9c85('0x3')](_0x3934f1,_0x41035f);};}function removeListener(_0x4f41ef,_0x590efe){return function(){MailQueueEvents[_0x9c85('0x4')](_0x4f41ef,_0x590efe);};}exports[_0x9c85('0x5')]=function(_0x355518){for(var _0x35c7af=0x0,_0x1925a4=events[_0x9c85('0x6')];_0x35c7af<_0x1925a4;_0x35c7af++){var _0x904224=events[_0x35c7af];var _0x2a7105=createListener(_0x9c85('0x7')+_0x904224,_0x355518);MailQueueEvents['on'](_0x904224,_0x2a7105);}}; \ No newline at end of file +var _0xaa89=['length','mailQueue:','./mailQueue.events','save','remove','update','removeListener'];(function(_0x1819df,_0x18d901){var _0x50cd92=function(_0x4dfbd0){while(--_0x4dfbd0){_0x1819df['push'](_0x1819df['shift']());}};_0x50cd92(++_0x18d901);}(_0xaa89,0x18a));var _0x9aa8=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xaa89[_0x4fdc46];return _0x2c178a;};'use strict';var MailQueueEvents=require(_0x9aa8('0x0'));var events=[_0x9aa8('0x1'),_0x9aa8('0x2'),_0x9aa8('0x3')];function createListener(_0x4b67e1,_0x4035bc){return function(_0x2d3a3d){_0x4035bc['emit'](_0x4b67e1,_0x2d3a3d);};}function removeListener(_0x3d04fb,_0x52b8b9){return function(){MailQueueEvents[_0x9aa8('0x4')](_0x3d04fb,_0x52b8b9);};}exports['register']=function(_0xa3935c){for(var _0x47de3b=0x0,_0x327c04=events[_0x9aa8('0x5')];_0x47de3b<_0x327c04;_0x47de3b++){var _0x40fc33=events[_0x47de3b];var _0x4075ac=createListener(_0x9aa8('0x6')+_0x40fc33,_0xa3935c);MailQueueEvents['on'](_0x40fc33,_0x4075ac);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 090be42..46e8e2c 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 _0x02b3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express'];(function(_0x182c3d,_0x4aa188){var _0x12d91a=function(_0x3cae91){while(--_0x3cae91){_0x182c3d['push'](_0x182c3d['shift']());}};_0x12d91a(++_0x4aa188);}(_0x02b3,0x18a));var _0x302b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x02b3[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x302b('0x0'));var util=require(_0x302b('0x1'));var path=require(_0x302b('0x2'));var timeout=require(_0x302b('0x3'));var express=require(_0x302b('0x4'));var router=express[_0x302b('0x5')]();var fs_extra=require(_0x302b('0x6'));var auth=require(_0x302b('0x7'));var interaction=require(_0x302b('0x8'));var config=require(_0x302b('0x9'));var controller=require(_0x302b('0xa'));router['get']('/',auth[_0x302b('0xb')](),controller[_0x302b('0xc')]);router[_0x302b('0xd')]('/describe',auth[_0x302b('0xb')](),controller[_0x302b('0xe')]);router[_0x302b('0xd')](_0x302b('0xf'),auth['isAuthenticated'](),controller[_0x302b('0x10')]);router[_0x302b('0x11')]('/',auth['isAuthenticated'](),controller[_0x302b('0x12')]);router[_0x302b('0x13')](_0x302b('0xf'),auth[_0x302b('0xb')](),controller['update']);router['delete'](_0x302b('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x302b('0x14')]=router; \ No newline at end of file +var _0x96b8=['isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','/:id'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x96b8,0x170));var _0x896b=function(_0x1fae35,_0x385d6a){_0x1fae35=_0x1fae35-0x0;var _0x22f1a7=_0x96b8[_0x1fae35];return _0x22f1a7;};'use strict';var multer=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var path=require(_0x896b('0x2'));var timeout=require(_0x896b('0x3'));var express=require(_0x896b('0x4'));var router=express['Router']();var fs_extra=require(_0x896b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x896b('0x6'));var config=require('../../config/environment');var controller=require(_0x896b('0x7'));router[_0x896b('0x8')]('/',auth['isAuthenticated'](),controller[_0x896b('0x9')]);router['get'](_0x896b('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0xd')]);router[_0x896b('0xe')]('/',auth['isAuthenticated'](),controller[_0x896b('0xf')]);router[_0x896b('0x10')](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0x11')]);router[_0x896b('0x12')](_0x896b('0xb'),auth[_0x896b('0xc')](),controller[_0x896b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3d8a5ce..88c0578 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 _0x872a=['DATE','moment','sequelize','exports','STRING'];(function(_0x103180,_0x423902){var _0xd5829e=function(_0xaaf30a){while(--_0xaaf30a){_0x103180['push'](_0x103180['shift']());}};_0xd5829e(++_0x423902);}(_0x872a,0x100));var _0xa872=function(_0x3b047f,_0x38e7ed){_0x3b047f=_0x3b047f-0x0;var _0x500e02=_0x872a[_0x3b047f];return _0x500e02;};'use strict';var moment=require(_0xa872('0x0'));var Sequelize=require(_0xa872('0x1'));module[_0xa872('0x2')]={'uniqueid':{'type':Sequelize[_0xa872('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa872('0x4')]},'exitAt':{'type':Sequelize[_0xa872('0x4')]},'reason':{'type':Sequelize[_0xa872('0x3')]}}; \ No newline at end of file +var _0xd83c=['STRING','DATE'];(function(_0x617fd5,_0x1d0f93){var _0x54545f=function(_0x4f6b50){while(--_0x4f6b50){_0x617fd5['push'](_0x617fd5['shift']());}};_0x54545f(++_0x1d0f93);}(_0xd83c,0x8c));var _0xcd83=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0xd83c[_0x1e9d62];return _0x56c490;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcd83('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcd83('0x1')]},'leaveAt':{'type':Sequelize[_0xcd83('0x1')]},'acceptAt':{'type':Sequelize[_0xcd83('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 401c988..4be14f5 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0xacf4,0xe7));var _0x4acf=function(_0x5be0cf,_0x4cfe44){_0x5be0cf=_0x5be0cf-0x0;var _0xecd17a=_0xacf4[_0x5be0cf];return _0xecd17a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['MailQueueReport'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['MailQueueReport']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x583c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format'];(function(_0x510fb4,_0x526e9e){var _0x1c0b2d=function(_0xe8f161){while(--_0xe8f161){_0x510fb4['push'](_0x510fb4['shift']());}};_0x1c0b2d(++_0x526e9e);}(_0x583c,0x12b));var _0xc583=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x583c[_0x1b1a3b];return _0x385347;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['MailQueueReport'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['MailQueueReport']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));};exports[_0xc583('0x4a')]=function(_0xa03d53,_0x1a0f91){return db[_0xc583('0x2c')][_0xc583('0x4a')]()['then'](respondWithResult(_0x1a0f91,null))[_0xc583('0x42')](handleError(_0x1a0f91,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 610cfab..49ad0d2 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 _0xd600=['report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MailQueueReport'];(function(_0x381444,_0x70594e){var _0x1e0844=function(_0x4f4908){while(--_0x4f4908){_0x381444['push'](_0x381444['shift']());}};_0x1e0844(++_0x70594e);}(_0xd600,0x1d6));var _0x0d60=function(_0x12105f,_0x5c9738){_0x12105f=_0x12105f-0x0;var _0x307076=_0xd600[_0x12105f];return _0x307076;};'use strict';var _=require('lodash');var util=require(_0x0d60('0x0'));var logger=require(_0x0d60('0x1'))(_0x0d60('0x2'));var moment=require(_0x0d60('0x3'));var BPromise=require(_0x0d60('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d60('0x5'));var rimraf=require(_0x0d60('0x6'));var config=require(_0x0d60('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x0d60('0x8')]=function(_0x584be1,_0x59699a){return _0x584be1[_0x0d60('0x9')](_0x0d60('0xa'),attributes,{'tableName':_0x0d60('0xb'),'paranoid':![],'indexes':[{'name':_0x0d60('0xc'),'fields':[_0x0d60('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x072e=['api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x58ac34,_0x5b5bfb){var _0x3921ab=function(_0x172dd5){while(--_0x172dd5){_0x58ac34['push'](_0x58ac34['shift']());}};_0x3921ab(++_0x5b5bfb);}(_0x072e,0x1aa));var _0xe072=function(_0x225fbc,_0x44c645){_0x225fbc=_0x225fbc-0x0;var _0x35d151=_0x072e[_0x225fbc];return _0x35d151;};'use strict';var _=require(_0xe072('0x0'));var util=require(_0xe072('0x1'));var logger=require(_0xe072('0x2'))(_0xe072('0x3'));var moment=require(_0xe072('0x4'));var BPromise=require('bluebird');var rp=require(_0xe072('0x5'));var fs=require('fs');var path=require(_0xe072('0x6'));var rimraf=require(_0xe072('0x7'));var config=require('../../config/environment');var attributes=require(_0xe072('0x8'));module['exports']=function(_0x4446ae,_0x2d03a5){return _0x4446ae[_0xe072('0x9')](_0xe072('0xa'),attributes,{'tableName':_0xe072('0xb'),'paranoid':![],'indexes':[{'name':_0xe072('0xc'),'fields':[_0xe072('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a0b05e2..3655474 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x233fa0,_0x549395){var _0x2df341=function(_0x25f270){while(--_0x25f270){_0x233fa0['push'](_0x233fa0['shift']());}};_0x2df341(++_0x549395);}(_0x1261,0x144));var _0x1126=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x1261[_0x119280];return _0x481797;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x4fc29f,_0x338677){var _0x2b55e8=function(_0x5846a8){while(--_0x5846a8){_0x4fc29f['push'](_0x4fc29f['shift']());}};_0x2b55e8(++_0x338677);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0551879..300377b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45d952,_0x507170){var _0x12d857=function(_0x21ed2d){while(--_0x21ed2d){_0x45d952['push'](_0x45d952['shift']());}};_0x12d857(++_0x507170);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d235db6..4a69d36 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 _0x3de9=['sequelize','exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x3de9,0x192));var _0x93de=function(_0x110538,_0x267367){_0x110538=_0x110538-0x0;var _0x1601f3=_0x3de9[_0x110538];return _0x1601f3;};'use strict';var Sequelize=require(_0x93de('0x0'));module[_0x93de('0x1')]={'description':{'type':Sequelize[_0x93de('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x93de('0x2')]},'port':{'type':Sequelize[_0x93de('0x3')]},'tls':{'type':Sequelize[_0x93de('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x93de('0x2')],'defaultValue':_0x93de('0x5')},'connTimeout':{'type':Sequelize[_0x93de('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x93de('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x93de('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfc33=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x523841,_0x42f4ca){var _0x52c669=function(_0x22b29d){while(--_0x22b29d){_0x523841['push'](_0x523841['shift']());}};_0x52c669(++_0x42f4ca);}(_0xfc33,0xf0));var _0x3fc3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xfc33[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x3fc3('0x0'));module[_0x3fc3('0x1')]={'description':{'type':Sequelize[_0x3fc3('0x2')]},'host':{'type':Sequelize[_0x3fc3('0x2')]},'authentication':{'type':Sequelize[_0x3fc3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3fc3('0x2')]},'password':{'type':Sequelize[_0x3fc3('0x2')]},'port':{'type':Sequelize[_0x3fc3('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3fc3('0x2')],'defaultValue':_0x3fc3('0x5')},'connTimeout':{'type':Sequelize[_0x3fc3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3fc3('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3fc3('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3fc3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index dbcc65f..a0600c0 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 _0x621f=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x2cdfd8,_0x17c448){var _0x37d81f=function(_0x5424c8){while(--_0x5424c8){_0x2cdfd8['push'](_0x2cdfd8['shift']());}};_0x37d81f(++_0x17c448);}(_0x621f,0x1a8));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var logger=require(_0xf621('0x2'))(_0xf621('0x3'));var moment=require(_0xf621('0x4'));var BPromise=require(_0xf621('0x5'));var rp=require(_0xf621('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf621('0x7'));var config=require(_0xf621('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xf621('0x9')]=function(_0x161d74,_0x1f49c5){return _0x161d74[_0xf621('0xa')](_0xf621('0xb'),attributes,{'tableName':_0xf621('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8b0=['define','MailServerIn','mail_servers_in','lodash','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0xe8b0,0x121));var _0x0e8b=function(_0x47ce4a,_0x3c5aa3){_0x47ce4a=_0x47ce4a-0x0;var _0x18f1dc=_0xe8b0[_0x47ce4a];return _0x18f1dc;};'use strict';var _=require(_0x0e8b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0e8b('0x1'));var BPromise=require('bluebird');var rp=require(_0x0e8b('0x2'));var fs=require('fs');var path=require(_0x0e8b('0x3'));var rimraf=require(_0x0e8b('0x4'));var config=require(_0x0e8b('0x5'));var attributes=require(_0x0e8b('0x6'));module[_0x0e8b('0x7')]=function(_0x35aa57,_0xc461f4){return _0x35aa57[_0x0e8b('0x8')](_0x0e8b('0x9'),attributes,{'tableName':_0x0e8b('0xa'),'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 7108b29..cb6dc06 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 _0x5099=['GetMailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x5099,0x147));var _0x9509=function(_0x4c3d72,_0x382039){_0x4c3d72=_0x4c3d72-0x0;var _0x1083f2=_0x5099[_0x4c3d72];return _0x1083f2;};'use strict';var _=require(_0x9509('0x0'));var util=require(_0x9509('0x1'));var moment=require(_0x9509('0x2'));var BPromise=require(_0x9509('0x3'));var rs=require(_0x9509('0x4'));var fs=require('fs');var Redis=require(_0x9509('0x5'));var db=require(_0x9509('0x6'))['db'];var utils=require(_0x9509('0x7'));var logger=require(_0x9509('0x8'))(_0x9509('0x9'));var config=require(_0x9509('0xa'));var jayson=require(_0x9509('0xb'));var client=jayson[_0x9509('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa23aa,_0x3e6c45,_0x43f679){return new BPromise(function(_0x9d34c,_0x44bb40){return client[_0x9509('0xd')](_0xa23aa,_0x43f679)['then'](function(_0x1c4452){logger['info'](_0x9509('0xe'),_0x3e6c45,_0x9509('0xf'));logger[_0x9509('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3e6c45,_0x9509('0xf'),JSON[_0x9509('0x11')](_0x1c4452));if(_0x1c4452[_0x9509('0x12')]){if(_0x1c4452['error'][_0x9509('0x13')]===0x1f4){logger[_0x9509('0x12')](_0x9509('0xe'),_0x3e6c45,_0x1c4452[_0x9509('0x12')][_0x9509('0x14')]);return _0x44bb40(_0x1c4452[_0x9509('0x12')][_0x9509('0x14')]);}logger['error'](_0x9509('0xe'),_0x3e6c45,_0x1c4452[_0x9509('0x12')][_0x9509('0x14')]);return _0x9d34c(_0x1c4452['error'][_0x9509('0x14')]);}else{logger['info'](_0x9509('0xe'),_0x3e6c45,_0x9509('0xf'));_0x9d34c(_0x1c4452[_0x9509('0x15')][_0x9509('0x14')]);}})[_0x9509('0x16')](function(_0x4d66ed){logger[_0x9509('0x12')](_0x9509('0xe'),_0x3e6c45,_0x4d66ed);_0x44bb40(_0x4d66ed);});});}exports[_0x9509('0x17')]=function(_0x5baff0){var _0x4c3371=this;return new Promise(function(_0x5e3bb0,_0x169dbd){return db['MailServerIn'][_0x9509('0x18')]({'raw':_0x5baff0[_0x9509('0x19')]?_0x5baff0[_0x9509('0x19')][_0x9509('0x1a')]===undefined?!![]:![]:!![],'where':_0x5baff0['options']?_0x5baff0[_0x9509('0x19')][_0x9509('0x1b')]||null:null,'attributes':_0x5baff0[_0x9509('0x19')]?_0x5baff0['options'][_0x9509('0x1c')]||null:null,'limit':_0x5baff0['options']?_0x5baff0[_0x9509('0x19')][_0x9509('0x1d')]||null:null,'include':_0x5baff0[_0x9509('0x19')]?_0x5baff0[_0x9509('0x19')]['include']?_['map'](_0x5baff0[_0x9509('0x19')][_0x9509('0x1e')],function(_0x4d0b13){return{'model':db[_0x4d0b13['model']],'as':_0x4d0b13['as'],'attributes':_0x4d0b13[_0x9509('0x1c')],'include':_0x4d0b13['include']?_[_0x9509('0x1f')](_0x4d0b13[_0x9509('0x1e')],function(_0xf4a83f){return{'model':db[_0xf4a83f[_0x9509('0x20')]],'as':_0xf4a83f['as'],'attributes':_0xf4a83f[_0x9509('0x1c')],'include':_0xf4a83f[_0x9509('0x1e')]?_[_0x9509('0x1f')](_0xf4a83f[_0x9509('0x1e')],function(_0x10793a){return{'model':db[_0x10793a['model']],'as':_0x10793a['as'],'attributes':_0x10793a[_0x9509('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9509('0x21')](function(_0x4c8e61){logger[_0x9509('0x22')]('GetMailServerIn',_0x5baff0);logger[_0x9509('0x10')](_0x9509('0x17'),_0x5baff0,JSON[_0x9509('0x11')](_0x4c8e61));_0x5e3bb0(_0x4c8e61);})[_0x9509('0x16')](function(_0x4dba01){logger[_0x9509('0x12')](_0x9509('0x17'),_0x4dba01[_0x9509('0x14')],_0x5baff0);_0x169dbd(_0x4c3371[_0x9509('0x12')](0x1f4,_0x4dba01['message']));});});}; \ No newline at end of file +var _0x5974=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','message','lodash','util','bluebird','ioredis'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x5974,0x1d8));var _0x4597=function(_0x520ce8,_0x445e56){_0x520ce8=_0x520ce8-0x0;var _0x64369e=_0x5974[_0x520ce8];return _0x64369e;};'use strict';var _=require(_0x4597('0x0'));var util=require(_0x4597('0x1'));var moment=require('moment');var BPromise=require(_0x4597('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4597('0x3'));var db=require(_0x4597('0x4'))['db'];var utils=require(_0x4597('0x5'));var logger=require(_0x4597('0x6'))(_0x4597('0x7'));var config=require(_0x4597('0x8'));var jayson=require(_0x4597('0x9'));var client=jayson[_0x4597('0xa')][_0x4597('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd44,_0x3f9bb2,_0x356491){return new BPromise(function(_0x31479f,_0x4ee387){return client['request'](_0x50fd44,_0x356491)[_0x4597('0xc')](function(_0x85065b){logger[_0x4597('0xd')]('MailServerIn,\x20%s,\x20%s',_0x3f9bb2,_0x4597('0xe'));logger[_0x4597('0xf')](_0x4597('0x10'),_0x3f9bb2,_0x4597('0xe'),JSON[_0x4597('0x11')](_0x85065b));if(_0x85065b[_0x4597('0x12')]){if(_0x85065b[_0x4597('0x12')]['code']===0x1f4){logger[_0x4597('0x12')](_0x4597('0x13'),_0x3f9bb2,_0x85065b['error']['message']);return _0x4ee387(_0x85065b[_0x4597('0x12')]['message']);}logger[_0x4597('0x12')]('MailServerIn,\x20%s,\x20%s',_0x3f9bb2,_0x85065b[_0x4597('0x12')]['message']);return _0x31479f(_0x85065b['error']['message']);}else{logger[_0x4597('0xd')](_0x4597('0x13'),_0x3f9bb2,_0x4597('0xe'));_0x31479f(_0x85065b[_0x4597('0x14')]['message']);}})[_0x4597('0x15')](function(_0x512e9c){logger['error'](_0x4597('0x13'),_0x3f9bb2,_0x512e9c);_0x4ee387(_0x512e9c);});});}exports[_0x4597('0x16')]=function(_0x589c81){var _0xceb374=this;return new Promise(function(_0x2e8288,_0x523546){return db[_0x4597('0x17')][_0x4597('0x18')]({'raw':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')][_0x4597('0x1a')]===undefined?!![]:![]:!![],'where':_0x589c81[_0x4597('0x19')]?_0x589c81['options'][_0x4597('0x1b')]||null:null,'attributes':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')]['attributes']||null:null,'limit':_0x589c81[_0x4597('0x19')]?_0x589c81['options'][_0x4597('0x1c')]||null:null,'include':_0x589c81[_0x4597('0x19')]?_0x589c81[_0x4597('0x19')][_0x4597('0x1d')]?_[_0x4597('0x1e')](_0x589c81[_0x4597('0x19')][_0x4597('0x1d')],function(_0x4a4454){return{'model':db[_0x4a4454[_0x4597('0x1f')]],'as':_0x4a4454['as'],'attributes':_0x4a4454[_0x4597('0x20')],'include':_0x4a4454[_0x4597('0x1d')]?_['map'](_0x4a4454[_0x4597('0x1d')],function(_0xa9fe87){return{'model':db[_0xa9fe87[_0x4597('0x1f')]],'as':_0xa9fe87['as'],'attributes':_0xa9fe87[_0x4597('0x20')],'include':_0xa9fe87['include']?_['map'](_0xa9fe87[_0x4597('0x1d')],function(_0x230f28){return{'model':db[_0x230f28['model']],'as':_0x230f28['as'],'attributes':_0x230f28[_0x4597('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff809){logger[_0x4597('0xd')](_0x4597('0x16'),_0x589c81);logger[_0x4597('0xf')](_0x4597('0x16'),_0x589c81,JSON[_0x4597('0x11')](_0x1ff809));_0x2e8288(_0x1ff809);})['catch'](function(_0x11c1a3){logger[_0x4597('0x12')](_0x4597('0x16'),_0x11c1a3['message'],_0x589c81);_0x523546(_0xceb374['error'](0x1f4,_0x11c1a3[_0x4597('0x21')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index deb7a04..53176c9 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x3fd403,_0x20c8a2){_0x3fd403=_0x3fd403-0x0;var _0x4c2b2a=_0x7a54[_0x3fd403];return _0x4c2b2a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 70a318f..cdc1e52 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 _0xe1e3=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5ea49d,_0x8acf6e){var _0x335d20=function(_0x1c5552){while(--_0x1c5552){_0x5ea49d['push'](_0x5ea49d['shift']());}};_0x335d20(++_0x8acf6e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x64133d,_0x215116){_0x64133d=_0x64133d-0x0;var _0x1e89cd=_0xe1e3[_0x64133d];return _0x1e89cd;};'use strict';var Sequelize=require(_0x3e1e('0x0'));module[_0x3e1e('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3e1e('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3e1e('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3e1e('0x2')]},'authentication':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3e1e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xb10b=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xb10b,0x12a));var _0xbb10=function(_0x5079f0,_0x2e0ae4){_0x5079f0=_0x5079f0-0x0;var _0x182bce=_0xb10b[_0x5079f0];return _0x182bce;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'description':{'type':Sequelize[_0xbb10('0x1')]},'host':{'type':Sequelize[_0xbb10('0x1')]},'user':{'type':Sequelize[_0xbb10('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbb10('0x2')]},'secure':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xbb10('0x1')]},'authentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3c7ffb3..8e894ea 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 _0x9c35=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9c35,0x78));var _0x59c3=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x9c35[_0x5e6bec];return _0x5dc5cf;};'use strict';var emlformat=require(_0x59c3('0x0'));var rimraf=require(_0x59c3('0x1'));var zipdir=require(_0x59c3('0x2'));var jsonpatch=require(_0x59c3('0x3'));var rp=require(_0x59c3('0x4'));var moment=require(_0x59c3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x59c3('0x6'));var sox=require('sox');var csv=require(_0x59c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x59c3('0x8'));var _=require('lodash');var squel=require(_0x59c3('0x9'));var crypto=require(_0x59c3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x59c3('0xb'));var Papa=require(_0x59c3('0xc'));var Redis=require(_0x59c3('0xd'));var authService=require(_0x59c3('0xe'));var qs=require(_0x59c3('0xf'));var as=require(_0x59c3('0x10'));var hardwareService=require(_0x59c3('0x11'));var logger=require(_0x59c3('0x12'))(_0x59c3('0x13'));var utils=require(_0x59c3('0x14'));var config=require(_0x59c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x59c3('0x16'))['db'];function respondWithStatusCode(_0x317f1d,_0x2fada9){_0x2fada9=_0x2fada9||0xcc;return function(_0xb409ec){if(_0xb409ec){return _0x317f1d[_0x59c3('0x17')](_0x2fada9);}return _0x317f1d[_0x59c3('0x18')](_0x2fada9)[_0x59c3('0x19')]();};}function respondWithResult(_0x1bd95f,_0x46e289){_0x46e289=_0x46e289||0xc8;return function(_0x19a677){if(_0x19a677){return _0x1bd95f[_0x59c3('0x18')](_0x46e289)[_0x59c3('0x1a')](_0x19a677);}};}function respondWithFilteredResult(_0x5e7634,_0x3ce301){return function(_0x4b0ae4){if(_0x4b0ae4){var _0x551d4d=typeof _0x3ce301[_0x59c3('0x1b')]===_0x59c3('0x1c')&&typeof _0x3ce301[_0x59c3('0x1d')]===_0x59c3('0x1c');var _0x5f408f=_0x4b0ae4[_0x59c3('0x1e')];var _0x417b07=_0x551d4d?0x0:_0x3ce301[_0x59c3('0x1b')];var _0x1dc9f3=_0x551d4d?_0x4b0ae4[_0x59c3('0x1e')]:_0x3ce301[_0x59c3('0x1b')]+_0x3ce301[_0x59c3('0x1d')];var _0x26a04b;if(_0x1dc9f3>=_0x5f408f){_0x1dc9f3=_0x5f408f;_0x26a04b=0xc8;}else{_0x26a04b=0xce;}_0x5e7634[_0x59c3('0x18')](_0x26a04b);return _0x5e7634[_0x59c3('0x1f')](_0x59c3('0x20'),_0x417b07+'-'+_0x1dc9f3+'/'+_0x5f408f)[_0x59c3('0x1a')](_0x4b0ae4);}return null;};}function patchUpdates(_0x280c34){return function(_0x3bb1fa){try{jsonpatch[_0x59c3('0x21')](_0x3bb1fa,_0x280c34,!![]);}catch(_0x1e1618){return BPromise[_0x59c3('0x22')](_0x1e1618);}return _0x3bb1fa[_0x59c3('0x23')]();};}function saveUpdates(_0x18c72e,_0x10df68){return function(_0x5b0077){if(_0x5b0077){return _0x5b0077[_0x59c3('0x24')](_0x18c72e)[_0x59c3('0x25')](function(_0x405d6f){return _0x405d6f;});}return null;};}function removeEntity(_0x43b4f0,_0x766140){return function(_0x5c294f){if(_0x5c294f){return _0x5c294f[_0x59c3('0x26')]()[_0x59c3('0x25')](function(){_0x43b4f0['status'](0xcc)[_0x59c3('0x19')]();});}};}function handleEntityNotFound(_0x89388b,_0x208b2d){return function(_0x3c1ad8){if(!_0x3c1ad8){_0x89388b[_0x59c3('0x17')](0x194);}return _0x3c1ad8;};}function handleError(_0x329d68,_0x490b3c){_0x490b3c=_0x490b3c||0x1f4;return function(_0x5cf29c){logger[_0x59c3('0x27')](_0x5cf29c[_0x59c3('0x28')]);if(_0x5cf29c[_0x59c3('0x29')]){delete _0x5cf29c[_0x59c3('0x29')];}_0x329d68[_0x59c3('0x18')](_0x490b3c)[_0x59c3('0x2a')](_0x5cf29c);};}exports[_0x59c3('0x2b')]=function(_0x2f5cee,_0x3bca18){var _0x27597d={},_0x43f830={},_0x14f2b5={'count':0x0,'rows':[]};var _0x2673a4=_['map'](db[_0x59c3('0x2c')]['rawAttributes'],function(_0x5f4c33){return{'name':_0x5f4c33['fieldName'],'type':_0x5f4c33[_0x59c3('0x2d')][_0x59c3('0x2e')]};});_0x43f830['model']=_['map'](_0x2673a4,_0x59c3('0x29'));_0x43f830[_0x59c3('0x2f')]=_['keys'](_0x2f5cee[_0x59c3('0x2f')]);_0x43f830['filters']=_[_0x59c3('0x30')](_0x43f830[_0x59c3('0x31')],_0x43f830['query']);_0x27597d[_0x59c3('0x32')]=_[_0x59c3('0x30')](_0x43f830[_0x59c3('0x31')],qs[_0x59c3('0x33')](_0x2f5cee['query'][_0x59c3('0x33')]));_0x27597d[_0x59c3('0x32')]=_0x27597d[_0x59c3('0x32')][_0x59c3('0x34')]?_0x27597d[_0x59c3('0x32')]:_0x43f830[_0x59c3('0x31')];if(!_0x2f5cee['query'][_0x59c3('0x35')](_0x59c3('0x36'))){_0x27597d['limit']=qs[_0x59c3('0x1d')](_0x2f5cee['query']['limit']);_0x27597d[_0x59c3('0x1b')]=qs[_0x59c3('0x1b')](_0x2f5cee[_0x59c3('0x2f')]['offset']);}_0x27597d[_0x59c3('0x37')]=qs[_0x59c3('0x38')](_0x2f5cee[_0x59c3('0x2f')][_0x59c3('0x38')]);_0x27597d[_0x59c3('0x39')]=qs[_0x59c3('0x3a')](_[_0x59c3('0x3b')](_0x2f5cee[_0x59c3('0x2f')],_0x43f830[_0x59c3('0x3a')]),_0x2673a4);if(_0x2f5cee[_0x59c3('0x2f')][_0x59c3('0x3c')]){_0x27597d[_0x59c3('0x39')]=_[_0x59c3('0x3d')](_0x27597d[_0x59c3('0x39')],{'$or':_[_0x59c3('0x3e')](_0x2673a4,function(_0x2d8344){if(_0x2d8344[_0x59c3('0x2d')]!==_0x59c3('0x3f')){var _0x890639={};_0x890639[_0x2d8344['name']]={'$like':'%'+_0x2f5cee['query']['filter']+'%'};return _0x890639;}})});}_0x27597d=_[_0x59c3('0x3d')]({},_0x27597d,_0x2f5cee[_0x59c3('0x40')]);var _0x69f8a8={'where':_0x27597d['where']};return db['MailServerOut'][_0x59c3('0x1e')](_0x69f8a8)['then'](function(_0x3a093b){_0x14f2b5[_0x59c3('0x1e')]=_0x3a093b;if(_0x2f5cee[_0x59c3('0x2f')][_0x59c3('0x41')]){_0x27597d['include']=[{'all':!![]}];}return db[_0x59c3('0x2c')][_0x59c3('0x42')](_0x27597d);})[_0x59c3('0x25')](function(_0xdfe093){_0x14f2b5[_0x59c3('0x43')]=_0xdfe093;return _0x14f2b5;})[_0x59c3('0x25')](respondWithFilteredResult(_0x3bca18,_0x27597d))[_0x59c3('0x44')](handleError(_0x3bca18,null));};exports[_0x59c3('0x45')]=function(_0x4bdc1c,_0x3b8b45){var _0xde97f3={'raw':!![],'where':{'id':_0x4bdc1c[_0x59c3('0x46')]['id']}},_0x2e7b00={};_0x2e7b00[_0x59c3('0x31')]=_[_0x59c3('0x47')](db[_0x59c3('0x2c')]['rawAttributes']);_0x2e7b00[_0x59c3('0x2f')]=_[_0x59c3('0x47')](_0x4bdc1c[_0x59c3('0x2f')]);_0x2e7b00[_0x59c3('0x3a')]=_[_0x59c3('0x30')](_0x2e7b00[_0x59c3('0x31')],_0x2e7b00['query']);_0xde97f3['attributes']=_[_0x59c3('0x30')](_0x2e7b00['model'],qs[_0x59c3('0x33')](_0x4bdc1c[_0x59c3('0x2f')][_0x59c3('0x33')]));_0xde97f3['attributes']=_0xde97f3[_0x59c3('0x32')][_0x59c3('0x34')]?_0xde97f3[_0x59c3('0x32')]:_0x2e7b00[_0x59c3('0x31')];if(_0x4bdc1c[_0x59c3('0x2f')][_0x59c3('0x41')]){_0xde97f3[_0x59c3('0x48')]=[{'all':!![]}];}_0xde97f3=_[_0x59c3('0x3d')]({},_0xde97f3,_0x4bdc1c[_0x59c3('0x40')]);return db[_0x59c3('0x2c')][_0x59c3('0x49')](_0xde97f3)[_0x59c3('0x25')](handleEntityNotFound(_0x3b8b45,null))['then'](respondWithResult(_0x3b8b45,null))[_0x59c3('0x44')](handleError(_0x3b8b45,null));};exports['create']=function(_0x40798f,_0x1bcf36){return db[_0x59c3('0x2c')][_0x59c3('0x4a')](_0x40798f[_0x59c3('0x4b')],{})['then'](respondWithResult(_0x1bcf36,0xc9))[_0x59c3('0x44')](handleError(_0x1bcf36,null));};exports[_0x59c3('0x24')]=function(_0x532d0b,_0x24d070){if(_0x532d0b[_0x59c3('0x4b')]['id']){delete _0x532d0b[_0x59c3('0x4b')]['id'];}return db[_0x59c3('0x2c')][_0x59c3('0x49')]({'where':{'id':_0x532d0b[_0x59c3('0x46')]['id']}})[_0x59c3('0x25')](handleEntityNotFound(_0x24d070,null))['then'](saveUpdates(_0x532d0b[_0x59c3('0x4b')],null))[_0x59c3('0x25')](respondWithResult(_0x24d070,null))[_0x59c3('0x44')](handleError(_0x24d070,null));};exports[_0x59c3('0x26')]=function(_0x167ff8,_0x2c51fe){return db['MailServerOut'][_0x59c3('0x49')]({'where':{'id':_0x167ff8['params']['id']}})['then'](handleEntityNotFound(_0x2c51fe,null))[_0x59c3('0x25')](removeEntity(_0x2c51fe,null))[_0x59c3('0x44')](handleError(_0x2c51fe,null));}; \ No newline at end of file +var _0x1c1c=['filters','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','MailServerOut','fields','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query'];(function(_0x21dea6,_0x42306c){var _0xe2f95=function(_0x48def5){while(--_0x48def5){_0x21dea6['push'](_0x21dea6['shift']());}};_0xe2f95(++_0x42306c);}(_0x1c1c,0x14e));var _0xc1c1=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1c1c[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require(_0xc1c1('0x0'));var rimraf=require(_0xc1c1('0x1'));var zipdir=require(_0xc1c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c1('0x3'));var moment=require(_0xc1c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1c1('0x5'));var path=require(_0xc1c1('0x6'));var sox=require(_0xc1c1('0x7'));var csv=require(_0xc1c1('0x8'));var ejs=require(_0xc1c1('0x9'));var fs=require('fs');var fs_extra=require(_0xc1c1('0xa'));var _=require(_0xc1c1('0xb'));var squel=require(_0xc1c1('0xc'));var crypto=require(_0xc1c1('0xd'));var jsforce=require(_0xc1c1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1c1('0xf'));var Redis=require(_0xc1c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc1c1('0x11'));var as=require(_0xc1c1('0x12'));var hardwareService=require(_0xc1c1('0x13'));var logger=require(_0xc1c1('0x14'))(_0xc1c1('0x15'));var utils=require(_0xc1c1('0x16'));var config=require(_0xc1c1('0x17'));var licenseUtil=require(_0xc1c1('0x18'));var db=require(_0xc1c1('0x19'))['db'];function respondWithStatusCode(_0x2fb1f0,_0x23f072){_0x23f072=_0x23f072||0xcc;return function(_0x7fab1f){if(_0x7fab1f){return _0x2fb1f0[_0xc1c1('0x1a')](_0x23f072);}return _0x2fb1f0['status'](_0x23f072)[_0xc1c1('0x1b')]();};}function respondWithResult(_0x23a213,_0xbc0c6){_0xbc0c6=_0xbc0c6||0xc8;return function(_0x2b6635){if(_0x2b6635){return _0x23a213[_0xc1c1('0x1c')](_0xbc0c6)[_0xc1c1('0x1d')](_0x2b6635);}};}function respondWithFilteredResult(_0x43935e,_0x54933b){return function(_0x4494f2){if(_0x4494f2){var _0x1e18cc=typeof _0x54933b[_0xc1c1('0x1e')]==='undefined'&&typeof _0x54933b['limit']===_0xc1c1('0x1f');var _0x134165=_0x4494f2[_0xc1c1('0x20')];var _0x262371=_0x1e18cc?0x0:_0x54933b[_0xc1c1('0x1e')];var _0xa09a27=_0x1e18cc?_0x4494f2[_0xc1c1('0x20')]:_0x54933b['offset']+_0x54933b['limit'];var _0x17eaba;if(_0xa09a27>=_0x134165){_0xa09a27=_0x134165;_0x17eaba=0xc8;}else{_0x17eaba=0xce;}_0x43935e[_0xc1c1('0x1c')](_0x17eaba);return _0x43935e[_0xc1c1('0x21')](_0xc1c1('0x22'),_0x262371+'-'+_0xa09a27+'/'+_0x134165)['json'](_0x4494f2);}return null;};}function patchUpdates(_0x4b2128){return function(_0x3cfa22){try{jsonpatch[_0xc1c1('0x23')](_0x3cfa22,_0x4b2128,!![]);}catch(_0x5b1a9e){return BPromise[_0xc1c1('0x24')](_0x5b1a9e);}return _0x3cfa22[_0xc1c1('0x25')]();};}function saveUpdates(_0x4a676d,_0x36ff7c){return function(_0x6f9975){if(_0x6f9975){return _0x6f9975[_0xc1c1('0x26')](_0x4a676d)[_0xc1c1('0x27')](function(_0x39922f){return _0x39922f;});}return null;};}function removeEntity(_0x461499,_0xda887e){return function(_0x3e6af4){if(_0x3e6af4){return _0x3e6af4['destroy']()['then'](function(){_0x461499[_0xc1c1('0x1c')](0xcc)[_0xc1c1('0x1b')]();});}};}function handleEntityNotFound(_0xdc0b9a,_0x325c46){return function(_0x54f43c){if(!_0x54f43c){_0xdc0b9a[_0xc1c1('0x1a')](0x194);}return _0x54f43c;};}function handleError(_0x1addb6,_0x2cf551){_0x2cf551=_0x2cf551||0x1f4;return function(_0x3dd6ca){logger[_0xc1c1('0x28')](_0x3dd6ca[_0xc1c1('0x29')]);if(_0x3dd6ca[_0xc1c1('0x2a')]){delete _0x3dd6ca[_0xc1c1('0x2a')];}_0x1addb6[_0xc1c1('0x1c')](_0x2cf551)['send'](_0x3dd6ca);};}exports[_0xc1c1('0x2b')]=function(_0x325c39,_0x594a71){var _0xc06042={},_0xa861b7={},_0x17fd70={'count':0x0,'rows':[]};var _0x2a3eb6=_[_0xc1c1('0x2c')](db['MailServerOut'][_0xc1c1('0x2d')],function(_0x4b03b9){return{'name':_0x4b03b9[_0xc1c1('0x2e')],'type':_0x4b03b9[_0xc1c1('0x2f')][_0xc1c1('0x30')]};});_0xa861b7['model']=_[_0xc1c1('0x2c')](_0x2a3eb6,_0xc1c1('0x2a'));_0xa861b7['query']=_[_0xc1c1('0x31')](_0x325c39[_0xc1c1('0x32')]);_0xa861b7[_0xc1c1('0x33')]=_[_0xc1c1('0x34')](_0xa861b7[_0xc1c1('0x35')],_0xa861b7[_0xc1c1('0x32')]);_0xc06042[_0xc1c1('0x36')]=_['intersection'](_0xa861b7[_0xc1c1('0x35')],qs['fields'](_0x325c39[_0xc1c1('0x32')]['fields']));_0xc06042[_0xc1c1('0x36')]=_0xc06042[_0xc1c1('0x36')][_0xc1c1('0x37')]?_0xc06042[_0xc1c1('0x36')]:_0xa861b7['model'];if(!_0x325c39[_0xc1c1('0x32')]['hasOwnProperty'](_0xc1c1('0x38'))){_0xc06042['limit']=qs[_0xc1c1('0x39')](_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x39')]);_0xc06042[_0xc1c1('0x1e')]=qs[_0xc1c1('0x1e')](_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x1e')]);}_0xc06042[_0xc1c1('0x3a')]=qs[_0xc1c1('0x3b')](_0x325c39['query'][_0xc1c1('0x3b')]);_0xc06042[_0xc1c1('0x3c')]=qs[_0xc1c1('0x33')](_[_0xc1c1('0x3d')](_0x325c39[_0xc1c1('0x32')],_0xa861b7[_0xc1c1('0x33')]),_0x2a3eb6);if(_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x3e')]){_0xc06042['where']=_[_0xc1c1('0x3f')](_0xc06042[_0xc1c1('0x3c')],{'$or':_[_0xc1c1('0x2c')](_0x2a3eb6,function(_0x291f7d){if(_0x291f7d[_0xc1c1('0x2f')]!=='VIRTUAL'){var _0x308eec={};_0x308eec[_0x291f7d['name']]={'$like':'%'+_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x3e')]+'%'};return _0x308eec;}})});}_0xc06042=_[_0xc1c1('0x3f')]({},_0xc06042,_0x325c39['options']);var _0x280c73={'where':_0xc06042[_0xc1c1('0x3c')]};return db['MailServerOut'][_0xc1c1('0x20')](_0x280c73)[_0xc1c1('0x27')](function(_0x45b0ca){_0x17fd70['count']=_0x45b0ca;if(_0x325c39[_0xc1c1('0x32')][_0xc1c1('0x40')]){_0xc06042[_0xc1c1('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xc1c1('0x42')](_0xc06042);})[_0xc1c1('0x27')](function(_0x4af215){_0x17fd70['rows']=_0x4af215;return _0x17fd70;})[_0xc1c1('0x27')](respondWithFilteredResult(_0x594a71,_0xc06042))[_0xc1c1('0x43')](handleError(_0x594a71,null));};exports[_0xc1c1('0x44')]=function(_0x16216d,_0x17e753){var _0x4cf174={'raw':!![],'where':{'id':_0x16216d['params']['id']}},_0x68dbb4={};_0x68dbb4[_0xc1c1('0x35')]=_[_0xc1c1('0x31')](db[_0xc1c1('0x45')]['rawAttributes']);_0x68dbb4['query']=_[_0xc1c1('0x31')](_0x16216d[_0xc1c1('0x32')]);_0x68dbb4[_0xc1c1('0x33')]=_[_0xc1c1('0x34')](_0x68dbb4['model'],_0x68dbb4['query']);_0x4cf174[_0xc1c1('0x36')]=_[_0xc1c1('0x34')](_0x68dbb4[_0xc1c1('0x35')],qs[_0xc1c1('0x46')](_0x16216d[_0xc1c1('0x32')][_0xc1c1('0x46')]));_0x4cf174['attributes']=_0x4cf174[_0xc1c1('0x36')][_0xc1c1('0x37')]?_0x4cf174[_0xc1c1('0x36')]:_0x68dbb4[_0xc1c1('0x35')];if(_0x16216d[_0xc1c1('0x32')]['includeAll']){_0x4cf174[_0xc1c1('0x41')]=[{'all':!![]}];}_0x4cf174=_[_0xc1c1('0x3f')]({},_0x4cf174,_0x16216d[_0xc1c1('0x47')]);return db[_0xc1c1('0x45')][_0xc1c1('0x48')](_0x4cf174)[_0xc1c1('0x27')](handleEntityNotFound(_0x17e753,null))[_0xc1c1('0x27')](respondWithResult(_0x17e753,null))[_0xc1c1('0x43')](handleError(_0x17e753,null));};exports[_0xc1c1('0x49')]=function(_0x5e2681,_0x452dbe){return db[_0xc1c1('0x45')][_0xc1c1('0x49')](_0x5e2681[_0xc1c1('0x4a')],{})[_0xc1c1('0x27')](respondWithResult(_0x452dbe,0xc9))[_0xc1c1('0x43')](handleError(_0x452dbe,null));};exports[_0xc1c1('0x26')]=function(_0x20b95f,_0x412e09){if(_0x20b95f['body']['id']){delete _0x20b95f[_0xc1c1('0x4a')]['id'];}return db[_0xc1c1('0x45')]['find']({'where':{'id':_0x20b95f[_0xc1c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x412e09,null))[_0xc1c1('0x27')](saveUpdates(_0x20b95f[_0xc1c1('0x4a')],null))[_0xc1c1('0x27')](respondWithResult(_0x412e09,null))[_0xc1c1('0x43')](handleError(_0x412e09,null));};exports[_0xc1c1('0x4c')]=function(_0x312dab,_0x17ab0e){return db[_0xc1c1('0x45')][_0xc1c1('0x48')]({'where':{'id':_0x312dab[_0xc1c1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17ab0e,null))[_0xc1c1('0x27')](removeEntity(_0x17ab0e,null))[_0xc1c1('0x43')](handleError(_0x17ab0e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3437d06..58dffb2 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 _0xcd88=['request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','api','bluebird'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcd88,0xd4));var _0x8cd8=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xcd88[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var logger=require('../../config/logger')(_0x8cd8('0x2'));var moment=require('moment');var BPromise=require(_0x8cd8('0x3'));var rp=require(_0x8cd8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cd8('0x5'));var config=require(_0x8cd8('0x6'));var attributes=require(_0x8cd8('0x7'));module[_0x8cd8('0x8')]=function(_0x3d102b,_0x32ffd1){return _0x3d102b[_0x8cd8('0x9')](_0x8cd8('0xa'),attributes,{'tableName':_0x8cd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5084=['path','rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','api','moment','request-promise'];(function(_0x552900,_0x3a1d5f){var _0x26fe96=function(_0x5e26a9){while(--_0x5e26a9){_0x552900['push'](_0x552900['shift']());}};_0x26fe96(++_0x3a1d5f);}(_0x5084,0x8d));var _0x4508=function(_0x1994f9,_0x1f4261){_0x1994f9=_0x1994f9-0x0;var _0x241348=_0x5084[_0x1994f9];return _0x241348;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4508('0x0'));var moment=require(_0x4508('0x1'));var BPromise=require('bluebird');var rp=require(_0x4508('0x2'));var fs=require('fs');var path=require(_0x4508('0x3'));var rimraf=require(_0x4508('0x4'));var config=require(_0x4508('0x5'));var attributes=require(_0x4508('0x6'));module['exports']=function(_0xb11e78,_0x1eb503){return _0xb11e78['define'](_0x4508('0x7'),attributes,{'tableName':_0x4508('0x8'),'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 ed304ac..2e9ae94 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5cfe37,_0x4644cf){var _0x3ca508=function(_0x4e4883){while(--_0x4e4883){_0x5cfe37['push'](_0x5cfe37['shift']());}};_0x3ca508(++_0x4644cf);}(_0x1261,0x144));var _0x1126=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x1261[_0x4186fa];return _0x136990;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23c698,_0xd1b961){var _0x2df0fc=function(_0x26a823){while(--_0x26a823){_0x23c698['push'](_0x23c698['shift']());}};_0x2df0fc(++_0xd1b961);}(_0xadb5,0xad));var _0x5adb=function(_0x161d44,_0x48f259){_0x161d44=_0x161d44-0x0;var _0xcf1a5e=_0xadb5[_0x161d44];return _0xcf1a5e;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dab1504..f47893e 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 _0xc45d=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','get','show','post','create','put','/:id','update','destroy'];(function(_0x449123,_0x2696c0){var _0x4151c0=function(_0x5ad137){while(--_0x5ad137){_0x449123['push'](_0x449123['shift']());}};_0x4151c0(++_0x2696c0);}(_0xc45d,0x6a));var _0xdc45=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xc45d[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var path=require('path');var timeout=require(_0xdc45('0x2'));var express=require(_0xdc45('0x3'));var router=express[_0xdc45('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdc45('0x5'));var interaction=require(_0xdc45('0x6'));var config=require(_0xdc45('0x7'));var controller=require(_0xdc45('0x8'));router['get']('/',auth[_0xdc45('0x9')](),controller[_0xdc45('0xa')]);router['get'](_0xdc45('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xdc45('0xc')]('/:id',auth[_0xdc45('0x9')](),controller[_0xdc45('0xd')]);router[_0xdc45('0xe')]('/',auth[_0xdc45('0x9')](),controller[_0xdc45('0xf')]);router[_0xdc45('0x10')](_0xdc45('0x11'),auth['isAuthenticated'](),controller[_0xdc45('0x12')]);router['delete']('/:id',auth[_0xdc45('0x9')](),controller[_0xdc45('0x13')]);module[_0xdc45('0x14')]=router; \ No newline at end of file +var _0x23b5=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer'];(function(_0x473a38,_0x1c0e5e){var _0x569d43=function(_0x4add6d){while(--_0x4add6d){_0x473a38['push'](_0x473a38['shift']());}};_0x569d43(++_0x1c0e5e);}(_0x23b5,0x18e));var _0x523b=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x23b5[_0x297eea];return _0x1c42d2;};'use strict';var multer=require(_0x523b('0x0'));var util=require(_0x523b('0x1'));var path=require(_0x523b('0x2'));var timeout=require(_0x523b('0x3'));var express=require(_0x523b('0x4'));var router=express[_0x523b('0x5')]();var fs_extra=require(_0x523b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x523b('0x7'));var config=require('../../config/environment');var controller=require(_0x523b('0x8'));router[_0x523b('0x9')]('/',auth['isAuthenticated'](),controller[_0x523b('0xa')]);router[_0x523b('0x9')](_0x523b('0xb'),auth['isAuthenticated'](),controller[_0x523b('0xc')]);router['get'](_0x523b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x523b('0xe')]('/',auth[_0x523b('0xf')](),controller[_0x523b('0x10')]);router[_0x523b('0x11')](_0x523b('0xd'),auth[_0x523b('0xf')](),controller[_0x523b('0x12')]);router['delete']('/:id',auth[_0x523b('0xf')](),controller[_0x523b('0x13')]);module[_0x523b('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a1931c5..770c1ca 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 _0x444e=['sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x444e,0xe8));var _0xe444=function(_0xebd774,_0x4a9d6e){_0xebd774=_0xebd774-0x0;var _0x47a32a=_0x444e[_0xebd774];return _0x47a32a;};'use strict';var Sequelize=require(_0xe444('0x0'));module['exports']={'name':{'type':Sequelize[_0xe444('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe444('0x1')]}}; \ No newline at end of file +var _0xa46e=['name','STRING','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa46e,0x8a));var _0xea46=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xa46e[_0x10852d];return _0x13a8d6;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7066a0d..ce61905 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 _0x4941=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','options','where','includeAll','show','MailSubstatus','length','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x54ab1f,_0x1585d6){var _0x24c869=function(_0x5e8ce0){while(--_0x5e8ce0){_0x54ab1f['push'](_0x54ab1f['shift']());}};_0x24c869(++_0x1585d6);}(_0x4941,0x16d));var _0x1494=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x4941[_0x303c30];return _0x43161b;};'use strict';var emlformat=require(_0x1494('0x0'));var rimraf=require(_0x1494('0x1'));var zipdir=require(_0x1494('0x2'));var jsonpatch=require(_0x1494('0x3'));var rp=require(_0x1494('0x4'));var moment=require('moment');var BPromise=require(_0x1494('0x5'));var Mustache=require(_0x1494('0x6'));var util=require('util');var path=require(_0x1494('0x7'));var sox=require(_0x1494('0x8'));var csv=require(_0x1494('0x9'));var ejs=require(_0x1494('0xa'));var fs=require('fs');var fs_extra=require(_0x1494('0xb'));var _=require('lodash');var squel=require(_0x1494('0xc'));var crypto=require(_0x1494('0xd'));var jsforce=require(_0x1494('0xe'));var deskjs=require(_0x1494('0xf'));var toCsv=require(_0x1494('0x9'));var querystring=require(_0x1494('0x10'));var Papa=require(_0x1494('0x11'));var Redis=require(_0x1494('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1494('0x13'));var hardwareService=require(_0x1494('0x14'));var logger=require(_0x1494('0x15'))(_0x1494('0x16'));var utils=require(_0x1494('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1494('0x18'));var db=require(_0x1494('0x19'))['db'];function respondWithStatusCode(_0x4c9e6d,_0x538592){_0x538592=_0x538592||0xcc;return function(_0x19935f){if(_0x19935f){return _0x4c9e6d[_0x1494('0x1a')](_0x538592);}return _0x4c9e6d[_0x1494('0x1b')](_0x538592)[_0x1494('0x1c')]();};}function respondWithResult(_0x1c48ee,_0x56cae6){_0x56cae6=_0x56cae6||0xc8;return function(_0x5d5408){if(_0x5d5408){return _0x1c48ee[_0x1494('0x1b')](_0x56cae6)[_0x1494('0x1d')](_0x5d5408);}};}function respondWithFilteredResult(_0x1ddfd9,_0x42478e){return function(_0xe0494c){if(_0xe0494c){var _0x2225d5=typeof _0x42478e[_0x1494('0x1e')]===_0x1494('0x1f')&&typeof _0x42478e['limit']===_0x1494('0x1f');var _0x4807f5=_0xe0494c[_0x1494('0x20')];var _0x6d6199=_0x2225d5?0x0:_0x42478e[_0x1494('0x1e')];var _0x1fecac=_0x2225d5?_0xe0494c[_0x1494('0x20')]:_0x42478e[_0x1494('0x1e')]+_0x42478e[_0x1494('0x21')];var _0x92d1e8;if(_0x1fecac>=_0x4807f5){_0x1fecac=_0x4807f5;_0x92d1e8=0xc8;}else{_0x92d1e8=0xce;}_0x1ddfd9['status'](_0x92d1e8);return _0x1ddfd9['set'](_0x1494('0x22'),_0x6d6199+'-'+_0x1fecac+'/'+_0x4807f5)[_0x1494('0x1d')](_0xe0494c);}return null;};}function patchUpdates(_0x3e3217){return function(_0xd01dfb){try{jsonpatch[_0x1494('0x23')](_0xd01dfb,_0x3e3217,!![]);}catch(_0x3da936){return BPromise['reject'](_0x3da936);}return _0xd01dfb[_0x1494('0x24')]();};}function saveUpdates(_0x246bb7,_0x4e622d){return function(_0x227255){if(_0x227255){return _0x227255[_0x1494('0x25')](_0x246bb7)[_0x1494('0x26')](function(_0x2d6710){return _0x2d6710;});}return null;};}function removeEntity(_0x5bfe15,_0x20f826){return function(_0x5464c5){if(_0x5464c5){return _0x5464c5[_0x1494('0x27')]()[_0x1494('0x26')](function(){_0x5bfe15['status'](0xcc)[_0x1494('0x1c')]();});}};}function handleEntityNotFound(_0x29ee85,_0x31bb0f){return function(_0x40e5a3){if(!_0x40e5a3){_0x29ee85[_0x1494('0x1a')](0x194);}return _0x40e5a3;};}function handleError(_0x4df89d,_0x5407a6){_0x5407a6=_0x5407a6||0x1f4;return function(_0x4b569f){logger[_0x1494('0x28')](_0x4b569f[_0x1494('0x29')]);if(_0x4b569f[_0x1494('0x2a')]){delete _0x4b569f['name'];}_0x4df89d[_0x1494('0x1b')](_0x5407a6)[_0x1494('0x2b')](_0x4b569f);};}exports[_0x1494('0x2c')]=function(_0x6fdf46,_0x52752e){var _0x3cd98c={},_0x40558a={},_0x17cca0={'count':0x0,'rows':[]};var _0x108c91=_[_0x1494('0x2d')](db['MailSubstatus'][_0x1494('0x2e')],function(_0x34f4e9){return{'name':_0x34f4e9[_0x1494('0x2f')],'type':_0x34f4e9[_0x1494('0x30')][_0x1494('0x31')]};});_0x40558a[_0x1494('0x32')]=_['map'](_0x108c91,_0x1494('0x2a'));_0x40558a['query']=_[_0x1494('0x33')](_0x6fdf46[_0x1494('0x34')]);_0x40558a[_0x1494('0x35')]=_[_0x1494('0x36')](_0x40558a[_0x1494('0x32')],_0x40558a['query']);_0x3cd98c[_0x1494('0x37')]=_['intersection'](_0x40558a['model'],qs[_0x1494('0x38')](_0x6fdf46[_0x1494('0x34')]['fields']));_0x3cd98c[_0x1494('0x37')]=_0x3cd98c[_0x1494('0x37')]['length']?_0x3cd98c[_0x1494('0x37')]:_0x40558a[_0x1494('0x32')];if(!_0x6fdf46['query'][_0x1494('0x39')]('nolimit')){_0x3cd98c['limit']=qs['limit'](_0x6fdf46['query']['limit']);_0x3cd98c[_0x1494('0x1e')]=qs[_0x1494('0x1e')](_0x6fdf46['query']['offset']);}_0x3cd98c['order']=qs[_0x1494('0x3a')](_0x6fdf46[_0x1494('0x34')][_0x1494('0x3a')]);_0x3cd98c['where']=qs['filters'](_[_0x1494('0x3b')](_0x6fdf46['query'],_0x40558a[_0x1494('0x35')]),_0x108c91);if(_0x6fdf46[_0x1494('0x34')][_0x1494('0x3c')]){_0x3cd98c['where']=_[_0x1494('0x3d')](_0x3cd98c['where'],{'$or':_[_0x1494('0x2d')](_0x108c91,function(_0x2864a9){if(_0x2864a9[_0x1494('0x30')]!=='VIRTUAL'){var _0x166eae={};_0x166eae[_0x2864a9[_0x1494('0x2a')]]={'$like':'%'+_0x6fdf46[_0x1494('0x34')]['filter']+'%'};return _0x166eae;}})});}_0x3cd98c=_[_0x1494('0x3d')]({},_0x3cd98c,_0x6fdf46[_0x1494('0x3e')]);var _0x410b3f={'where':_0x3cd98c[_0x1494('0x3f')]};return db['MailSubstatus']['count'](_0x410b3f)[_0x1494('0x26')](function(_0xde5b74){_0x17cca0['count']=_0xde5b74;if(_0x6fdf46[_0x1494('0x34')][_0x1494('0x40')]){_0x3cd98c['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3cd98c);})['then'](function(_0x555cf6){_0x17cca0['rows']=_0x555cf6;return _0x17cca0;})[_0x1494('0x26')](respondWithFilteredResult(_0x52752e,_0x3cd98c))['catch'](handleError(_0x52752e,null));};exports[_0x1494('0x41')]=function(_0x5be9a0,_0xa0dd98){var _0x48aff0={'raw':!![],'where':{'id':_0x5be9a0['params']['id']}},_0x45d5ea={};_0x45d5ea[_0x1494('0x32')]=_[_0x1494('0x33')](db[_0x1494('0x42')][_0x1494('0x2e')]);_0x45d5ea['query']=_[_0x1494('0x33')](_0x5be9a0[_0x1494('0x34')]);_0x45d5ea[_0x1494('0x35')]=_[_0x1494('0x36')](_0x45d5ea[_0x1494('0x32')],_0x45d5ea[_0x1494('0x34')]);_0x48aff0[_0x1494('0x37')]=_['intersection'](_0x45d5ea[_0x1494('0x32')],qs[_0x1494('0x38')](_0x5be9a0[_0x1494('0x34')][_0x1494('0x38')]));_0x48aff0['attributes']=_0x48aff0[_0x1494('0x37')][_0x1494('0x43')]?_0x48aff0[_0x1494('0x37')]:_0x45d5ea['model'];if(_0x5be9a0['query'][_0x1494('0x40')]){_0x48aff0[_0x1494('0x44')]=[{'all':!![]}];}_0x48aff0=_[_0x1494('0x3d')]({},_0x48aff0,_0x5be9a0[_0x1494('0x3e')]);return db[_0x1494('0x42')][_0x1494('0x45')](_0x48aff0)[_0x1494('0x26')](handleEntityNotFound(_0xa0dd98,null))[_0x1494('0x26')](respondWithResult(_0xa0dd98,null))[_0x1494('0x46')](handleError(_0xa0dd98,null));};exports[_0x1494('0x47')]=function(_0x1aad31,_0x425380){return db[_0x1494('0x42')]['create'](_0x1aad31['body'],{})[_0x1494('0x26')](respondWithResult(_0x425380,0xc9))[_0x1494('0x46')](handleError(_0x425380,null));};exports[_0x1494('0x25')]=function(_0x4434a2,_0x571029){if(_0x4434a2[_0x1494('0x48')]['id']){delete _0x4434a2[_0x1494('0x48')]['id'];}return db[_0x1494('0x42')][_0x1494('0x45')]({'where':{'id':_0x4434a2[_0x1494('0x49')]['id']}})['then'](handleEntityNotFound(_0x571029,null))[_0x1494('0x26')](saveUpdates(_0x4434a2[_0x1494('0x48')],null))[_0x1494('0x26')](respondWithResult(_0x571029,null))[_0x1494('0x46')](handleError(_0x571029,null));};exports[_0x1494('0x27')]=function(_0x132d65,_0x23e406){return db[_0x1494('0x42')][_0x1494('0x45')]({'where':{'id':_0x132d65[_0x1494('0x49')]['id']}})['then'](handleEntityNotFound(_0x23e406,null))[_0x1494('0x26')](removeEntity(_0x23e406,null))['catch'](handleError(_0x23e406,null));};exports[_0x1494('0x4a')]=function(_0x9b864f,_0x1803a9){return db[_0x1494('0x42')][_0x1494('0x4a')]()['then'](respondWithResult(_0x1803a9,null))[_0x1494('0x46')](handleError(_0x1803a9,null));}; \ No newline at end of file +var _0x3d50=['desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','offset','undefined','limit','status','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','index','map','MailSubstatus','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','then','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3d50,0x7e));var _0x03d5=function(_0x17da5e,_0xc7ecac){_0x17da5e=_0x17da5e-0x0;var _0x22df6d=_0x3d50[_0x17da5e];return _0x22df6d;};'use strict';var emlformat=require(_0x03d5('0x0'));var rimraf=require(_0x03d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03d5('0x2'));var rp=require(_0x03d5('0x3'));var moment=require(_0x03d5('0x4'));var BPromise=require(_0x03d5('0x5'));var Mustache=require(_0x03d5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x03d5('0x7'));var ejs=require(_0x03d5('0x8'));var fs=require('fs');var fs_extra=require(_0x03d5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x03d5('0xa'));var jsforce=require(_0x03d5('0xb'));var deskjs=require(_0x03d5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x03d5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03d5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03d5('0xf'))(_0x03d5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03d5('0x11'));var db=require(_0x03d5('0x12'))['db'];function respondWithStatusCode(_0x1f288c,_0xa092e1){_0xa092e1=_0xa092e1||0xcc;return function(_0x15dc39){if(_0x15dc39){return _0x1f288c['sendStatus'](_0xa092e1);}return _0x1f288c['status'](_0xa092e1)[_0x03d5('0x13')]();};}function respondWithResult(_0x3fe6e5,_0x1e9eb0){_0x1e9eb0=_0x1e9eb0||0xc8;return function(_0x303712){if(_0x303712){return _0x3fe6e5['status'](_0x1e9eb0)['json'](_0x303712);}};}function respondWithFilteredResult(_0x1b46ae,_0x2bf833){return function(_0x21fa1f){if(_0x21fa1f){var _0x1428fc=typeof _0x2bf833[_0x03d5('0x14')]===_0x03d5('0x15')&&typeof _0x2bf833[_0x03d5('0x16')]===_0x03d5('0x15');var _0x8c6f01=_0x21fa1f['count'];var _0x46e585=_0x1428fc?0x0:_0x2bf833[_0x03d5('0x14')];var _0x2adb63=_0x1428fc?_0x21fa1f['count']:_0x2bf833[_0x03d5('0x14')]+_0x2bf833[_0x03d5('0x16')];var _0x5b36a4;if(_0x2adb63>=_0x8c6f01){_0x2adb63=_0x8c6f01;_0x5b36a4=0xc8;}else{_0x5b36a4=0xce;}_0x1b46ae[_0x03d5('0x17')](_0x5b36a4);return _0x1b46ae[_0x03d5('0x18')](_0x03d5('0x19'),_0x46e585+'-'+_0x2adb63+'/'+_0x8c6f01)['json'](_0x21fa1f);}return null;};}function patchUpdates(_0x4dadf1){return function(_0x4ddaa2){try{jsonpatch[_0x03d5('0x1a')](_0x4ddaa2,_0x4dadf1,!![]);}catch(_0x285216){return BPromise['reject'](_0x285216);}return _0x4ddaa2[_0x03d5('0x1b')]();};}function saveUpdates(_0x32c52f,_0x5f0788){return function(_0x2c036e){if(_0x2c036e){return _0x2c036e[_0x03d5('0x1c')](_0x32c52f)['then'](function(_0x18ffa9){return _0x18ffa9;});}return null;};}function removeEntity(_0x4c4df1,_0x41ba6e){return function(_0x5e749d){if(_0x5e749d){return _0x5e749d[_0x03d5('0x1d')]()['then'](function(){_0x4c4df1[_0x03d5('0x17')](0xcc)[_0x03d5('0x13')]();});}};}function handleEntityNotFound(_0x46a619,_0x3a9855){return function(_0x5423e2){if(!_0x5423e2){_0x46a619[_0x03d5('0x1e')](0x194);}return _0x5423e2;};}function handleError(_0x29b911,_0x58156a){_0x58156a=_0x58156a||0x1f4;return function(_0x3a678a){logger[_0x03d5('0x1f')](_0x3a678a[_0x03d5('0x20')]);if(_0x3a678a['name']){delete _0x3a678a[_0x03d5('0x21')];}_0x29b911[_0x03d5('0x17')](_0x58156a)['send'](_0x3a678a);};}exports[_0x03d5('0x22')]=function(_0x504ffc,_0x4ee561){var _0x32d711={},_0x4e2ce8={},_0x46560c={'count':0x0,'rows':[]};var _0x1bc4e1=_[_0x03d5('0x23')](db[_0x03d5('0x24')]['rawAttributes'],function(_0x565858){return{'name':_0x565858['fieldName'],'type':_0x565858[_0x03d5('0x25')][_0x03d5('0x26')]};});_0x4e2ce8[_0x03d5('0x27')]=_[_0x03d5('0x23')](_0x1bc4e1,_0x03d5('0x21'));_0x4e2ce8['query']=_[_0x03d5('0x28')](_0x504ffc[_0x03d5('0x29')]);_0x4e2ce8[_0x03d5('0x2a')]=_[_0x03d5('0x2b')](_0x4e2ce8['model'],_0x4e2ce8[_0x03d5('0x29')]);_0x32d711['attributes']=_['intersection'](_0x4e2ce8[_0x03d5('0x27')],qs[_0x03d5('0x2c')](_0x504ffc['query']['fields']));_0x32d711[_0x03d5('0x2d')]=_0x32d711[_0x03d5('0x2d')][_0x03d5('0x2e')]?_0x32d711[_0x03d5('0x2d')]:_0x4e2ce8['model'];if(!_0x504ffc[_0x03d5('0x29')][_0x03d5('0x2f')](_0x03d5('0x30'))){_0x32d711[_0x03d5('0x16')]=qs[_0x03d5('0x16')](_0x504ffc[_0x03d5('0x29')][_0x03d5('0x16')]);_0x32d711[_0x03d5('0x14')]=qs[_0x03d5('0x14')](_0x504ffc[_0x03d5('0x29')][_0x03d5('0x14')]);}_0x32d711[_0x03d5('0x31')]=qs[_0x03d5('0x32')](_0x504ffc['query'][_0x03d5('0x32')]);_0x32d711['where']=qs[_0x03d5('0x2a')](_[_0x03d5('0x33')](_0x504ffc[_0x03d5('0x29')],_0x4e2ce8[_0x03d5('0x2a')]),_0x1bc4e1);if(_0x504ffc['query'][_0x03d5('0x34')]){_0x32d711[_0x03d5('0x35')]=_[_0x03d5('0x36')](_0x32d711['where'],{'$or':_['map'](_0x1bc4e1,function(_0x5c6367){if(_0x5c6367[_0x03d5('0x25')]!==_0x03d5('0x37')){var _0x2a9258={};_0x2a9258[_0x5c6367[_0x03d5('0x21')]]={'$like':'%'+_0x504ffc[_0x03d5('0x29')]['filter']+'%'};return _0x2a9258;}})});}_0x32d711=_[_0x03d5('0x36')]({},_0x32d711,_0x504ffc['options']);var _0x7ce777={'where':_0x32d711[_0x03d5('0x35')]};return db[_0x03d5('0x24')][_0x03d5('0x38')](_0x7ce777)[_0x03d5('0x39')](function(_0x12947f){_0x46560c[_0x03d5('0x38')]=_0x12947f;if(_0x504ffc[_0x03d5('0x29')][_0x03d5('0x3a')]){_0x32d711[_0x03d5('0x3b')]=[{'all':!![]}];}return db[_0x03d5('0x24')][_0x03d5('0x3c')](_0x32d711);})[_0x03d5('0x39')](function(_0x13dcb7){_0x46560c['rows']=_0x13dcb7;return _0x46560c;})[_0x03d5('0x39')](respondWithFilteredResult(_0x4ee561,_0x32d711))[_0x03d5('0x3d')](handleError(_0x4ee561,null));};exports['show']=function(_0x27b869,_0x114ccb){var _0x5e2f06={'raw':!![],'where':{'id':_0x27b869[_0x03d5('0x3e')]['id']}},_0x4e4d76={};_0x4e4d76[_0x03d5('0x27')]=_[_0x03d5('0x28')](db['MailSubstatus'][_0x03d5('0x3f')]);_0x4e4d76[_0x03d5('0x29')]=_[_0x03d5('0x28')](_0x27b869['query']);_0x4e4d76[_0x03d5('0x2a')]=_[_0x03d5('0x2b')](_0x4e4d76[_0x03d5('0x27')],_0x4e4d76[_0x03d5('0x29')]);_0x5e2f06[_0x03d5('0x2d')]=_[_0x03d5('0x2b')](_0x4e4d76['model'],qs[_0x03d5('0x2c')](_0x27b869[_0x03d5('0x29')][_0x03d5('0x2c')]));_0x5e2f06['attributes']=_0x5e2f06[_0x03d5('0x2d')][_0x03d5('0x2e')]?_0x5e2f06['attributes']:_0x4e4d76['model'];if(_0x27b869['query'][_0x03d5('0x3a')]){_0x5e2f06[_0x03d5('0x3b')]=[{'all':!![]}];}_0x5e2f06=_[_0x03d5('0x36')]({},_0x5e2f06,_0x27b869[_0x03d5('0x40')]);return db['MailSubstatus']['find'](_0x5e2f06)[_0x03d5('0x39')](handleEntityNotFound(_0x114ccb,null))['then'](respondWithResult(_0x114ccb,null))[_0x03d5('0x3d')](handleError(_0x114ccb,null));};exports[_0x03d5('0x41')]=function(_0x4e4cbe,_0x845ec9){return db[_0x03d5('0x24')][_0x03d5('0x41')](_0x4e4cbe[_0x03d5('0x42')],{})[_0x03d5('0x39')](respondWithResult(_0x845ec9,0xc9))['catch'](handleError(_0x845ec9,null));};exports[_0x03d5('0x1c')]=function(_0x525de4,_0x531ceb){if(_0x525de4['body']['id']){delete _0x525de4['body']['id'];}return db[_0x03d5('0x24')][_0x03d5('0x43')]({'where':{'id':_0x525de4[_0x03d5('0x3e')]['id']}})[_0x03d5('0x39')](handleEntityNotFound(_0x531ceb,null))[_0x03d5('0x39')](saveUpdates(_0x525de4['body'],null))[_0x03d5('0x39')](respondWithResult(_0x531ceb,null))[_0x03d5('0x3d')](handleError(_0x531ceb,null));};exports['destroy']=function(_0x5ec9d6,_0x323f76){return db[_0x03d5('0x24')][_0x03d5('0x43')]({'where':{'id':_0x5ec9d6['params']['id']}})[_0x03d5('0x39')](handleEntityNotFound(_0x323f76,null))[_0x03d5('0x39')](removeEntity(_0x323f76,null))[_0x03d5('0x3d')](handleError(_0x323f76,null));};exports[_0x03d5('0x44')]=function(_0x199f2a,_0x3c3f8c){return db[_0x03d5('0x24')][_0x03d5('0x44')]()[_0x03d5('0x39')](respondWithResult(_0x3c3f8c,null))['catch'](handleError(_0x3c3f8c,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 38a3414..fb9dbc3 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5c5=['hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','update'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf5c5,0x11c));var _0x5f5c=function(_0x440685,_0x14e402){_0x440685=_0x440685-0x0;var _0x3d84a9=_0xf5c5[_0x440685];return _0x3d84a9;};'use strict';var EventEmitter=require(_0x5f5c('0x0'));var MailSubstatus=require(_0x5f5c('0x1'))['db'][_0x5f5c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x5f5c('0x3')};function emitEvent(_0x231468){return function(_0x1702e5,_0x4d766c,_0x35a149){MailSubstatusEvents['emit'](_0x231468+':'+_0x1702e5['id'],_0x1702e5);MailSubstatusEvents['emit'](_0x231468,_0x1702e5);_0x35a149(null);};}for(var e in events){if(events[_0x5f5c('0x4')](e)){var event=events[e];MailSubstatus[_0x5f5c('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xf39f=['emit','exports','MailSubstatus','setMaxListeners','update'];(function(_0x4f99af,_0x209b68){var _0x535846=function(_0x4073e5){while(--_0x4073e5){_0x4f99af['push'](_0x4f99af['shift']());}};_0x535846(++_0x209b68);}(_0xf39f,0x9d));var _0xff39=function(_0x39afb5,_0x11e514){_0x39afb5=_0x39afb5-0x0;var _0x519fed=_0xf39f[_0x39afb5];return _0x519fed;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xff39('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xff39('0x1')](0x0);var events={'afterUpdate':_0xff39('0x2')};function emitEvent(_0x18d3b5){return function(_0x4d4e84,_0x55ea19,_0x162659){MailSubstatusEvents[_0xff39('0x3')](_0x18d3b5+':'+_0x4d4e84['id'],_0x4d4e84);MailSubstatusEvents[_0xff39('0x3')](_0x18d3b5,_0x4d4e84);_0x162659(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xff39('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index be85a9f..e7d66c7 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 _0x71a3=['Condition','update','name','_previousDataValues','catch','exports','models','MailSubstatus','mail_substatuses'];(function(_0x1631b4,_0x27c970){var _0x45f58f=function(_0x3307bb){while(--_0x3307bb){_0x1631b4['push'](_0x1631b4['shift']());}};_0x45f58f(++_0x27c970);}(_0x71a3,0xd4));var _0x371a=function(_0x469a3c,_0xd98a90){_0x469a3c=_0x469a3c-0x0;var _0x5ab822=_0x71a3[_0x469a3c];return _0x5ab822;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x371a('0x0')]=function(_0x452abd){var _0x4e696a=_0x452abd[_0x371a('0x1')];return _0x452abd['define'](_0x371a('0x2'),attributes,{'tableName':_0x371a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3ed7a5,_0x335f7b,_0xe0cc45){return _0x4e696a[_0x371a('0x4')][_0x371a('0x5')]({'value':_0x3ed7a5[_0x371a('0x6')]},{'where':{'field':'mailSubstatus','value':_0x3ed7a5[_0x371a('0x7')]['name']}})['then'](function(){_0xe0cc45();})[_0x371a('0x8')](function(_0x5cb3ef){_0xe0cc45(_0x5cb3ef);});}}});}; \ No newline at end of file +var _0xb216=['exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes'];(function(_0x56b6ff,_0x57f10e){var _0x499c91=function(_0x4e11ac){while(--_0x4e11ac){_0x56b6ff['push'](_0x56b6ff['shift']());}};_0x499c91(++_0x57f10e);}(_0xb216,0x78));var _0x6b21=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb216[_0x11005e];return _0x29338f;};'use strict';var attributes=require(_0x6b21('0x0'));module[_0x6b21('0x1')]=function(_0x294dc3){var _0x29d60b=_0x294dc3[_0x6b21('0x2')];return _0x294dc3[_0x6b21('0x3')](_0x6b21('0x4'),attributes,{'tableName':_0x6b21('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2ea95b,_0x43bd6b,_0x4a61b2){return _0x29d60b[_0x6b21('0x6')][_0x6b21('0x7')]({'value':_0x2ea95b[_0x6b21('0x8')]},{'where':{'field':_0x6b21('0x9'),'value':_0x2ea95b[_0x6b21('0xa')][_0x6b21('0x8')]}})['then'](function(){_0x4a61b2();})['catch'](function(_0x23e6de){_0x4a61b2(_0x23e6de);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8f6a783..f460f0d 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 _0x1236=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x1236,0xab));var _0x6123=function(_0x208355,_0x28f1e6){_0x208355=_0x208355-0x0;var _0x596452=_0x1236[_0x208355];return _0x596452;};'use strict';var _=require(_0x6123('0x0'));var util=require(_0x6123('0x1'));var moment=require(_0x6123('0x2'));var BPromise=require(_0x6123('0x3'));var rs=require(_0x6123('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6123('0x5'))['db'];var utils=require(_0x6123('0x6'));var logger=require(_0x6123('0x7'))('rpc');var config=require(_0x6123('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6123('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c1f92,_0x32e6c4,_0x183983){return new BPromise(function(_0x5edf43,_0x589c1b){return client[_0x6123('0xa')](_0x3c1f92,_0x183983)[_0x6123('0xb')](function(_0x578706){logger[_0x6123('0xc')](_0x6123('0xd'),_0x32e6c4,_0x6123('0xe'));logger[_0x6123('0xf')](_0x6123('0x10'),_0x32e6c4,_0x6123('0xe'),JSON[_0x6123('0x11')](_0x578706));if(_0x578706[_0x6123('0x12')]){if(_0x578706['error']['code']===0x1f4){logger[_0x6123('0x12')](_0x6123('0xd'),_0x32e6c4,_0x578706[_0x6123('0x12')][_0x6123('0x13')]);return _0x589c1b(_0x578706[_0x6123('0x12')]['message']);}logger[_0x6123('0x12')](_0x6123('0xd'),_0x32e6c4,_0x578706[_0x6123('0x12')][_0x6123('0x13')]);return _0x5edf43(_0x578706[_0x6123('0x12')]['message']);}else{logger[_0x6123('0xc')](_0x6123('0xd'),_0x32e6c4,_0x6123('0xe'));_0x5edf43(_0x578706['result'][_0x6123('0x13')]);}})['catch'](function(_0x5ea206){logger[_0x6123('0x12')](_0x6123('0xd'),_0x32e6c4,_0x5ea206);_0x589c1b(_0x5ea206);});});} \ No newline at end of file +var _0xc083=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x177e78,_0x3b3120){var _0x276ad9=function(_0x1b2818){while(--_0x1b2818){_0x177e78['push'](_0x177e78['shift']());}};_0x276ad9(++_0x3b3120);}(_0xc083,0x1aa));var _0x3c08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc083[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3c08('0x0'));var util=require(_0x3c08('0x1'));var moment=require(_0x3c08('0x2'));var BPromise=require(_0x3c08('0x3'));var rs=require(_0x3c08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c08('0x5'));var logger=require(_0x3c08('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c08('0x7')][_0x3c08('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43aa3d,_0x286105,_0x4130a3){return new BPromise(function(_0x42f1fe,_0x5a4393){return client[_0x3c08('0x9')](_0x43aa3d,_0x4130a3)[_0x3c08('0xa')](function(_0x18ca4c){logger[_0x3c08('0xb')](_0x3c08('0xc'),_0x286105,_0x3c08('0xd'));logger['debug'](_0x3c08('0xe'),_0x286105,'request\x20sent',JSON[_0x3c08('0xf')](_0x18ca4c));if(_0x18ca4c[_0x3c08('0x10')]){if(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x11')]===0x1f4){logger[_0x3c08('0x10')](_0x3c08('0xc'),_0x286105,_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);return _0x5a4393(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);}logger['error'](_0x3c08('0xc'),_0x286105,_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);return _0x42f1fe(_0x18ca4c[_0x3c08('0x10')][_0x3c08('0x12')]);}else{logger[_0x3c08('0xb')](_0x3c08('0xc'),_0x286105,_0x3c08('0xd'));_0x42f1fe(_0x18ca4c[_0x3c08('0x13')]['message']);}})[_0x3c08('0x14')](function(_0x1ebe64){logger[_0x3c08('0x10')](_0x3c08('0xc'),_0x286105,_0x1ebe64);_0x5a4393(_0x1ebe64);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 64c9ba5..30d6d9d 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 _0x6eaf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x32edf4,_0x5cf90e){var _0x2a57ba=function(_0x7c431e){while(--_0x7c431e){_0x32edf4['push'](_0x32edf4['shift']());}};_0x2a57ba(++_0x5cf90e);}(_0x6eaf,0x96));var _0xf6ea=function(_0x5d2f09,_0xd5a2c9){_0x5d2f09=_0x5d2f09-0x0;var _0x34963c=_0x6eaf[_0x5d2f09];return _0x34963c;};'use strict';var multer=require(_0xf6ea('0x0'));var util=require(_0xf6ea('0x1'));var path=require('path');var timeout=require(_0xf6ea('0x2'));var express=require(_0xf6ea('0x3'));var router=express[_0xf6ea('0x4')]();var fs_extra=require(_0xf6ea('0x5'));var auth=require(_0xf6ea('0x6'));var interaction=require(_0xf6ea('0x7'));var config=require(_0xf6ea('0x8'));var controller=require(_0xf6ea('0x9'));router[_0xf6ea('0xa')]('/',auth[_0xf6ea('0xb')](),controller[_0xf6ea('0xc')]);router[_0xf6ea('0xa')](_0xf6ea('0xd'),auth[_0xf6ea('0xb')](),controller[_0xf6ea('0xe')]);router[_0xf6ea('0xa')](_0xf6ea('0xf'),auth[_0xf6ea('0xb')](),controller[_0xf6ea('0x10')]);router['post']('/',auth[_0xf6ea('0xb')](),controller[_0xf6ea('0x11')]);router[_0xf6ea('0x12')](_0xf6ea('0xf'),auth[_0xf6ea('0xb')](),controller[_0xf6ea('0x13')]);router[_0xf6ea('0x14')](_0xf6ea('0xf'),auth[_0xf6ea('0xb')](),controller['destroy']);module[_0xf6ea('0x15')]=router; \ No newline at end of file +var _0xd803=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd803,0x145));var _0x3d80=function(_0x4fbed5,_0x54903d){_0x4fbed5=_0x4fbed5-0x0;var _0x5242d0=_0xd803[_0x4fbed5];return _0x5242d0;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require(_0x3d80('0x4'));var router=express['Router']();var fs_extra=require(_0x3d80('0x5'));var auth=require(_0x3d80('0x6'));var interaction=require(_0x3d80('0x7'));var config=require('../../config/environment');var controller=require(_0x3d80('0x8'));router[_0x3d80('0x9')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3d80('0xc')]);router[_0x3d80('0x9')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0xe')]);router[_0x3d80('0xf')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0x10')]);router[_0x3d80('0x11')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x12')]);router[_0x3d80('0x13')](_0x3d80('0xd'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x14')]);module[_0x3d80('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3e94339..bdb80d1 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x9cfae2,_0x3f287a){var _0x54d4c2=function(_0xec7d37){while(--_0xec7d37){_0x9cfae2['push'](_0x9cfae2['shift']());}};_0x54d4c2(++_0x3f287a);}(_0xaa88,0x137));var _0x8aa8=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xaa88[_0x31a37b];return _0x49ae16;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x42d28c,_0xacda0d){var _0x19feb3=function(_0x5134e4){while(--_0x5134e4){_0x42d28c['push'](_0x42d28c['shift']());}};_0x19feb3(++_0xacda0d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x4b84[_0x2c3a88];return _0x4a7925;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0cda640..dc93e3b 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 _0xc37a=['sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','find','create','body','describe','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0xc37a,0xc4));var _0xac37=function(_0x1853cf,_0x3b9893){_0x1853cf=_0x1853cf-0x0;var _0x5af0d2=_0xc37a[_0x1853cf];return _0x5af0d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac37('0x1'));var rp=require(_0xac37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac37('0x3'));var path=require(_0xac37('0x4'));var sox=require(_0xac37('0x5'));var csv=require(_0xac37('0x6'));var ejs=require(_0xac37('0x7'));var fs=require('fs');var fs_extra=require(_0xac37('0x8'));var _=require('lodash');var squel=require(_0xac37('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac37('0xa'));var toCsv=require(_0xac37('0x6'));var querystring=require('querystring');var Papa=require(_0xac37('0xb'));var Redis=require('ioredis');var authService=require(_0xac37('0xc'));var qs=require(_0xac37('0xd'));var as=require(_0xac37('0xe'));var hardwareService=require(_0xac37('0xf'));var logger=require('../../config/logger')(_0xac37('0x10'));var utils=require(_0xac37('0x11'));var config=require(_0xac37('0x12'));var licenseUtil=require(_0xac37('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37107e,_0x3ab06a){_0x3ab06a=_0x3ab06a||0xcc;return function(_0x43d24d){if(_0x43d24d){return _0x37107e[_0xac37('0x14')](_0x3ab06a);}return _0x37107e['status'](_0x3ab06a)[_0xac37('0x15')]();};}function respondWithResult(_0x3dd200,_0x12e9df){_0x12e9df=_0x12e9df||0xc8;return function(_0xbafffd){if(_0xbafffd){return _0x3dd200[_0xac37('0x16')](_0x12e9df)[_0xac37('0x17')](_0xbafffd);}};}function respondWithFilteredResult(_0x5cd93d,_0x5f3c46){return function(_0x4b8b0a){if(_0x4b8b0a){var _0x3ac2c2=typeof _0x5f3c46[_0xac37('0x18')]===_0xac37('0x19')&&typeof _0x5f3c46['limit']===_0xac37('0x19');var _0x4970bf=_0x4b8b0a[_0xac37('0x1a')];var _0x536096=_0x3ac2c2?0x0:_0x5f3c46[_0xac37('0x18')];var _0x4b6e54=_0x3ac2c2?_0x4b8b0a[_0xac37('0x1a')]:_0x5f3c46[_0xac37('0x18')]+_0x5f3c46[_0xac37('0x1b')];var _0xea7c3d;if(_0x4b6e54>=_0x4970bf){_0x4b6e54=_0x4970bf;_0xea7c3d=0xc8;}else{_0xea7c3d=0xce;}_0x5cd93d[_0xac37('0x16')](_0xea7c3d);return _0x5cd93d[_0xac37('0x1c')](_0xac37('0x1d'),_0x536096+'-'+_0x4b6e54+'/'+_0x4970bf)[_0xac37('0x17')](_0x4b8b0a);}return null;};}function patchUpdates(_0x3971db){return function(_0xdb595e){try{jsonpatch[_0xac37('0x1e')](_0xdb595e,_0x3971db,!![]);}catch(_0x508960){return BPromise[_0xac37('0x1f')](_0x508960);}return _0xdb595e[_0xac37('0x20')]();};}function saveUpdates(_0x2d29f0,_0x47cf7a){return function(_0x2619df){if(_0x2619df){return _0x2619df[_0xac37('0x21')](_0x2d29f0)[_0xac37('0x22')](function(_0x1fc544){return _0x1fc544;});}return null;};}function removeEntity(_0x52f58c,_0xf01f46){return function(_0xcfabd0){if(_0xcfabd0){return _0xcfabd0[_0xac37('0x23')]()[_0xac37('0x22')](function(){_0x52f58c[_0xac37('0x16')](0xcc)[_0xac37('0x15')]();});}};}function handleEntityNotFound(_0x47af9d,_0x24e497){return function(_0x458e95){if(!_0x458e95){_0x47af9d[_0xac37('0x14')](0x194);}return _0x458e95;};}function handleError(_0x4fb8c0,_0x60eedc){_0x60eedc=_0x60eedc||0x1f4;return function(_0x2776e3){logger[_0xac37('0x24')](_0x2776e3['stack']);if(_0x2776e3[_0xac37('0x25')]){delete _0x2776e3['name'];}_0x4fb8c0[_0xac37('0x16')](_0x60eedc)[_0xac37('0x26')](_0x2776e3);};}exports[_0xac37('0x27')]=function(_0x5e7739,_0x58ee40){var _0x3fba21={},_0x5eec7f={},_0x1a11d9={'count':0x0,'rows':[]};var _0x23a779=_[_0xac37('0x28')](db[_0xac37('0x29')][_0xac37('0x2a')],function(_0x269bf1){return{'name':_0x269bf1['fieldName'],'type':_0x269bf1[_0xac37('0x2b')][_0xac37('0x2c')]};});_0x5eec7f[_0xac37('0x2d')]=_[_0xac37('0x28')](_0x23a779,_0xac37('0x25'));_0x5eec7f[_0xac37('0x2e')]=_[_0xac37('0x2f')](_0x5e7739[_0xac37('0x2e')]);_0x5eec7f[_0xac37('0x30')]=_[_0xac37('0x31')](_0x5eec7f[_0xac37('0x2d')],_0x5eec7f['query']);_0x3fba21[_0xac37('0x32')]=_[_0xac37('0x31')](_0x5eec7f[_0xac37('0x2d')],qs['fields'](_0x5e7739[_0xac37('0x2e')][_0xac37('0x33')]));_0x3fba21[_0xac37('0x32')]=_0x3fba21[_0xac37('0x32')]['length']?_0x3fba21[_0xac37('0x32')]:_0x5eec7f[_0xac37('0x2d')];if(!_0x5e7739[_0xac37('0x2e')][_0xac37('0x34')](_0xac37('0x35'))){_0x3fba21['limit']=qs[_0xac37('0x1b')](_0x5e7739[_0xac37('0x2e')][_0xac37('0x1b')]);_0x3fba21[_0xac37('0x18')]=qs[_0xac37('0x18')](_0x5e7739['query'][_0xac37('0x18')]);}_0x3fba21[_0xac37('0x36')]=qs[_0xac37('0x37')](_0x5e7739[_0xac37('0x2e')][_0xac37('0x37')]);_0x3fba21[_0xac37('0x38')]=qs[_0xac37('0x30')](_[_0xac37('0x39')](_0x5e7739[_0xac37('0x2e')],_0x5eec7f['filters']),_0x23a779);if(_0x5e7739[_0xac37('0x2e')]['filter']){_0x3fba21[_0xac37('0x38')]=_[_0xac37('0x3a')](_0x3fba21[_0xac37('0x38')],{'$or':_[_0xac37('0x28')](_0x23a779,function(_0xce28a3){if(_0xce28a3['type']!==_0xac37('0x3b')){var _0x5873a2={};_0x5873a2[_0xce28a3[_0xac37('0x25')]]={'$like':'%'+_0x5e7739[_0xac37('0x2e')][_0xac37('0x3c')]+'%'};return _0x5873a2;}})});}_0x3fba21=_[_0xac37('0x3a')]({},_0x3fba21,_0x5e7739[_0xac37('0x3d')]);var _0x52e09a={'where':_0x3fba21[_0xac37('0x38')]};return db[_0xac37('0x29')][_0xac37('0x1a')](_0x52e09a)[_0xac37('0x22')](function(_0x384d0a){_0x1a11d9[_0xac37('0x1a')]=_0x384d0a;if(_0x5e7739['query'][_0xac37('0x3e')]){_0x3fba21['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x3fba21);})[_0xac37('0x22')](function(_0x5073aa){_0x1a11d9[_0xac37('0x3f')]=_0x5073aa;return _0x1a11d9;})[_0xac37('0x22')](respondWithFilteredResult(_0x58ee40,_0x3fba21))[_0xac37('0x40')](handleError(_0x58ee40,null));};exports[_0xac37('0x41')]=function(_0x9228d8,_0x4bd340){var _0x17afd0={'raw':!![],'where':{'id':_0x9228d8[_0xac37('0x42')]['id']}},_0x562f11={};_0x562f11[_0xac37('0x2d')]=_[_0xac37('0x2f')](db[_0xac37('0x29')][_0xac37('0x2a')]);_0x562f11[_0xac37('0x2e')]=_['keys'](_0x9228d8['query']);_0x562f11[_0xac37('0x30')]=_[_0xac37('0x31')](_0x562f11[_0xac37('0x2d')],_0x562f11[_0xac37('0x2e')]);_0x17afd0['attributes']=_[_0xac37('0x31')](_0x562f11['model'],qs[_0xac37('0x33')](_0x9228d8[_0xac37('0x2e')][_0xac37('0x33')]));_0x17afd0[_0xac37('0x32')]=_0x17afd0[_0xac37('0x32')][_0xac37('0x43')]?_0x17afd0['attributes']:_0x562f11[_0xac37('0x2d')];if(_0x9228d8[_0xac37('0x2e')]['includeAll']){_0x17afd0['include']=[{'all':!![]}];}_0x17afd0=_['merge']({},_0x17afd0,_0x9228d8[_0xac37('0x3d')]);return db['MailTransferReport'][_0xac37('0x44')](_0x17afd0)[_0xac37('0x22')](handleEntityNotFound(_0x4bd340,null))[_0xac37('0x22')](respondWithResult(_0x4bd340,null))[_0xac37('0x40')](handleError(_0x4bd340,null));};exports[_0xac37('0x45')]=function(_0x40e3fc,_0x576a2c){return db[_0xac37('0x29')][_0xac37('0x45')](_0x40e3fc[_0xac37('0x46')],{})[_0xac37('0x22')](respondWithResult(_0x576a2c,0xc9))[_0xac37('0x40')](handleError(_0x576a2c,null));};exports['update']=function(_0x261e47,_0x5f3826){if(_0x261e47['body']['id']){delete _0x261e47[_0xac37('0x46')]['id'];}return db[_0xac37('0x29')][_0xac37('0x44')]({'where':{'id':_0x261e47['params']['id']}})['then'](handleEntityNotFound(_0x5f3826,null))[_0xac37('0x22')](saveUpdates(_0x261e47[_0xac37('0x46')],null))[_0xac37('0x22')](respondWithResult(_0x5f3826,null))[_0xac37('0x40')](handleError(_0x5f3826,null));};exports['destroy']=function(_0x2865a2,_0x3c9ecd){return db[_0xac37('0x29')][_0xac37('0x44')]({'where':{'id':_0x2865a2[_0xac37('0x42')]['id']}})[_0xac37('0x22')](handleEntityNotFound(_0x3c9ecd,null))[_0xac37('0x22')](removeEntity(_0x3c9ecd,null))[_0xac37('0x40')](handleError(_0x3c9ecd,null));};exports['describe']=function(_0x2efe79,_0x13c8b7){return db[_0xac37('0x29')][_0xac37('0x47')]()[_0xac37('0x22')](respondWithResult(_0x13c8b7,null))[_0xac37('0x40')](handleError(_0x13c8b7,null));}; \ No newline at end of file +var _0x48ca=['fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','catch','create','body','find','destroy','describe','eml-format','zip-dir'];(function(_0x2cf87f,_0x1ddef4){var _0x10455c=function(_0x178742){while(--_0x178742){_0x2cf87f['push'](_0x2cf87f['shift']());}};_0x10455c(++_0x1ddef4);}(_0x48ca,0x94));var _0xa48c=function(_0xd4541b,_0x178e59){_0xd4541b=_0xd4541b-0x0;var _0x502c8c=_0x48ca[_0xd4541b];return _0x502c8c;};'use strict';var emlformat=require(_0xa48c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa48c('0x1'));var jsonpatch=require(_0xa48c('0x2'));var rp=require('request-promise');var moment=require(_0xa48c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa48c('0x4'));var util=require('util');var path=require(_0xa48c('0x5'));var sox=require(_0xa48c('0x6'));var csv=require(_0xa48c('0x7'));var ejs=require(_0xa48c('0x8'));var fs=require('fs');var fs_extra=require(_0xa48c('0x9'));var _=require(_0xa48c('0xa'));var squel=require('squel');var crypto=require(_0xa48c('0xb'));var jsforce=require(_0xa48c('0xc'));var deskjs=require(_0xa48c('0xd'));var toCsv=require(_0xa48c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa48c('0xe'));var qs=require(_0xa48c('0xf'));var as=require(_0xa48c('0x10'));var hardwareService=require(_0xa48c('0x11'));var logger=require(_0xa48c('0x12'))(_0xa48c('0x13'));var utils=require(_0xa48c('0x14'));var config=require(_0xa48c('0x15'));var licenseUtil=require(_0xa48c('0x16'));var db=require(_0xa48c('0x17'))['db'];function respondWithStatusCode(_0x3135d1,_0x9a23b6){_0x9a23b6=_0x9a23b6||0xcc;return function(_0x363fab){if(_0x363fab){return _0x3135d1[_0xa48c('0x18')](_0x9a23b6);}return _0x3135d1[_0xa48c('0x19')](_0x9a23b6)[_0xa48c('0x1a')]();};}function respondWithResult(_0x26d9bd,_0x44747c){_0x44747c=_0x44747c||0xc8;return function(_0xab9f5d){if(_0xab9f5d){return _0x26d9bd[_0xa48c('0x19')](_0x44747c)[_0xa48c('0x1b')](_0xab9f5d);}};}function respondWithFilteredResult(_0x25e4ef,_0xed3720){return function(_0x3df17c){if(_0x3df17c){var _0x5bab67=typeof _0xed3720[_0xa48c('0x1c')]==='undefined'&&typeof _0xed3720[_0xa48c('0x1d')]===_0xa48c('0x1e');var _0x516fa9=_0x3df17c[_0xa48c('0x1f')];var _0x7f6532=_0x5bab67?0x0:_0xed3720[_0xa48c('0x1c')];var _0x4d0a43=_0x5bab67?_0x3df17c[_0xa48c('0x1f')]:_0xed3720[_0xa48c('0x1c')]+_0xed3720[_0xa48c('0x1d')];var _0x3ce42e;if(_0x4d0a43>=_0x516fa9){_0x4d0a43=_0x516fa9;_0x3ce42e=0xc8;}else{_0x3ce42e=0xce;}_0x25e4ef[_0xa48c('0x19')](_0x3ce42e);return _0x25e4ef[_0xa48c('0x20')]('Content-Range',_0x7f6532+'-'+_0x4d0a43+'/'+_0x516fa9)[_0xa48c('0x1b')](_0x3df17c);}return null;};}function patchUpdates(_0x23ca8c){return function(_0x43ce12){try{jsonpatch[_0xa48c('0x21')](_0x43ce12,_0x23ca8c,!![]);}catch(_0x36f924){return BPromise[_0xa48c('0x22')](_0x36f924);}return _0x43ce12[_0xa48c('0x23')]();};}function saveUpdates(_0x457303,_0x2054a1){return function(_0x2600b0){if(_0x2600b0){return _0x2600b0[_0xa48c('0x24')](_0x457303)[_0xa48c('0x25')](function(_0x152f6a){return _0x152f6a;});}return null;};}function removeEntity(_0x959656,_0x2d63fb){return function(_0x4c5030){if(_0x4c5030){return _0x4c5030['destroy']()['then'](function(){_0x959656[_0xa48c('0x19')](0xcc)[_0xa48c('0x1a')]();});}};}function handleEntityNotFound(_0x50a7ba,_0xed15e2){return function(_0x460f86){if(!_0x460f86){_0x50a7ba['sendStatus'](0x194);}return _0x460f86;};}function handleError(_0x25a233,_0x1ab5e5){_0x1ab5e5=_0x1ab5e5||0x1f4;return function(_0x522ca1){logger[_0xa48c('0x26')](_0x522ca1[_0xa48c('0x27')]);if(_0x522ca1[_0xa48c('0x28')]){delete _0x522ca1[_0xa48c('0x28')];}_0x25a233[_0xa48c('0x19')](_0x1ab5e5)['send'](_0x522ca1);};}exports[_0xa48c('0x29')]=function(_0x50be34,_0x4a3591){var _0x2895a2={},_0x42453f={},_0x118924={'count':0x0,'rows':[]};var _0x55a1bb=_[_0xa48c('0x2a')](db[_0xa48c('0x2b')][_0xa48c('0x2c')],function(_0x4301f2){return{'name':_0x4301f2[_0xa48c('0x2d')],'type':_0x4301f2['type']['key']};});_0x42453f[_0xa48c('0x2e')]=_['map'](_0x55a1bb,'name');_0x42453f[_0xa48c('0x2f')]=_[_0xa48c('0x30')](_0x50be34[_0xa48c('0x2f')]);_0x42453f[_0xa48c('0x31')]=_[_0xa48c('0x32')](_0x42453f[_0xa48c('0x2e')],_0x42453f[_0xa48c('0x2f')]);_0x2895a2['attributes']=_['intersection'](_0x42453f[_0xa48c('0x2e')],qs['fields'](_0x50be34[_0xa48c('0x2f')][_0xa48c('0x33')]));_0x2895a2[_0xa48c('0x34')]=_0x2895a2['attributes'][_0xa48c('0x35')]?_0x2895a2[_0xa48c('0x34')]:_0x42453f[_0xa48c('0x2e')];if(!_0x50be34[_0xa48c('0x2f')][_0xa48c('0x36')](_0xa48c('0x37'))){_0x2895a2[_0xa48c('0x1d')]=qs['limit'](_0x50be34['query'][_0xa48c('0x1d')]);_0x2895a2[_0xa48c('0x1c')]=qs[_0xa48c('0x1c')](_0x50be34['query'][_0xa48c('0x1c')]);}_0x2895a2[_0xa48c('0x38')]=qs[_0xa48c('0x39')](_0x50be34[_0xa48c('0x2f')][_0xa48c('0x39')]);_0x2895a2[_0xa48c('0x3a')]=qs[_0xa48c('0x31')](_[_0xa48c('0x3b')](_0x50be34[_0xa48c('0x2f')],_0x42453f[_0xa48c('0x31')]),_0x55a1bb);if(_0x50be34[_0xa48c('0x2f')][_0xa48c('0x3c')]){_0x2895a2[_0xa48c('0x3a')]=_[_0xa48c('0x3d')](_0x2895a2[_0xa48c('0x3a')],{'$or':_[_0xa48c('0x2a')](_0x55a1bb,function(_0x410bbc){if(_0x410bbc[_0xa48c('0x3e')]!==_0xa48c('0x3f')){var _0xaf9e84={};_0xaf9e84[_0x410bbc[_0xa48c('0x28')]]={'$like':'%'+_0x50be34[_0xa48c('0x2f')][_0xa48c('0x3c')]+'%'};return _0xaf9e84;}})});}_0x2895a2=_[_0xa48c('0x3d')]({},_0x2895a2,_0x50be34[_0xa48c('0x40')]);var _0x30b4d8={'where':_0x2895a2[_0xa48c('0x3a')]};return db[_0xa48c('0x2b')][_0xa48c('0x1f')](_0x30b4d8)[_0xa48c('0x25')](function(_0x965ec8){_0x118924['count']=_0x965ec8;if(_0x50be34[_0xa48c('0x2f')][_0xa48c('0x41')]){_0x2895a2[_0xa48c('0x42')]=[{'all':!![]}];}return db[_0xa48c('0x2b')]['findAll'](_0x2895a2);})[_0xa48c('0x25')](function(_0x3934a6){_0x118924['rows']=_0x3934a6;return _0x118924;})[_0xa48c('0x25')](respondWithFilteredResult(_0x4a3591,_0x2895a2))['catch'](handleError(_0x4a3591,null));};exports[_0xa48c('0x43')]=function(_0x309931,_0x5b9ab7){var _0x26f947={'raw':!![],'where':{'id':_0x309931[_0xa48c('0x44')]['id']}},_0x5abbcd={};_0x5abbcd[_0xa48c('0x2e')]=_[_0xa48c('0x30')](db['MailTransferReport'][_0xa48c('0x2c')]);_0x5abbcd[_0xa48c('0x2f')]=_[_0xa48c('0x30')](_0x309931[_0xa48c('0x2f')]);_0x5abbcd[_0xa48c('0x31')]=_['intersection'](_0x5abbcd['model'],_0x5abbcd[_0xa48c('0x2f')]);_0x26f947[_0xa48c('0x34')]=_[_0xa48c('0x32')](_0x5abbcd['model'],qs[_0xa48c('0x33')](_0x309931['query'][_0xa48c('0x33')]));_0x26f947[_0xa48c('0x34')]=_0x26f947[_0xa48c('0x34')][_0xa48c('0x35')]?_0x26f947[_0xa48c('0x34')]:_0x5abbcd[_0xa48c('0x2e')];if(_0x309931['query'][_0xa48c('0x41')]){_0x26f947[_0xa48c('0x42')]=[{'all':!![]}];}_0x26f947=_[_0xa48c('0x3d')]({},_0x26f947,_0x309931[_0xa48c('0x40')]);return db[_0xa48c('0x2b')]['find'](_0x26f947)[_0xa48c('0x25')](handleEntityNotFound(_0x5b9ab7,null))[_0xa48c('0x25')](respondWithResult(_0x5b9ab7,null))[_0xa48c('0x45')](handleError(_0x5b9ab7,null));};exports[_0xa48c('0x46')]=function(_0x2c6774,_0x64271f){return db[_0xa48c('0x2b')][_0xa48c('0x46')](_0x2c6774[_0xa48c('0x47')],{})[_0xa48c('0x25')](respondWithResult(_0x64271f,0xc9))[_0xa48c('0x45')](handleError(_0x64271f,null));};exports['update']=function(_0x137df8,_0x2f9205){if(_0x137df8[_0xa48c('0x47')]['id']){delete _0x137df8[_0xa48c('0x47')]['id'];}return db['MailTransferReport'][_0xa48c('0x48')]({'where':{'id':_0x137df8['params']['id']}})[_0xa48c('0x25')](handleEntityNotFound(_0x2f9205,null))[_0xa48c('0x25')](saveUpdates(_0x137df8['body'],null))[_0xa48c('0x25')](respondWithResult(_0x2f9205,null))['catch'](handleError(_0x2f9205,null));};exports[_0xa48c('0x49')]=function(_0x418720,_0x5f5f8f){return db['MailTransferReport']['find']({'where':{'id':_0x418720[_0xa48c('0x44')]['id']}})[_0xa48c('0x25')](handleEntityNotFound(_0x5f5f8f,null))['then'](removeEntity(_0x5f5f8f,null))[_0xa48c('0x45')](handleError(_0x5f5f8f,null));};exports[_0xa48c('0x4a')]=function(_0x2ccb9d,_0x3b3df0){return db[_0xa48c('0x2b')]['describe']()[_0xa48c('0x25')](respondWithResult(_0x3b3df0,null))[_0xa48c('0x45')](handleError(_0x3b3df0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 94f8609..f449c55 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 _0xf006=['report_mail_transfer','uniqueid','../../config/logger','api','bluebird','path','./mailTransferReport.attributes','exports','define'];(function(_0x1fb660,_0x5b99e0){var _0x24cf5a=function(_0x3fb9bd){while(--_0x3fb9bd){_0x1fb660['push'](_0x1fb660['shift']());}};_0x24cf5a(++_0x5b99e0);}(_0xf006,0x146));var _0x6f00=function(_0x271ed7,_0x16cf20){_0x271ed7=_0x271ed7-0x0;var _0x3bbec6=_0xf006[_0x271ed7];return _0x3bbec6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('MailTransferReport',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[{'name':_0x6f00('0x8'),'fields':[_0x6f00('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40c2=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x180d23,_0x5575f5){var _0xce5fa8=function(_0x343755){while(--_0x343755){_0x180d23['push'](_0x180d23['shift']());}};_0xce5fa8(++_0x5575f5);}(_0x40c2,0x10d));var _0x240c=function(_0xa5caf7,_0x3ec2fe){_0xa5caf7=_0xa5caf7-0x0;var _0x14eca9=_0x40c2[_0xa5caf7];return _0x14eca9;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var logger=require(_0x240c('0x1'))(_0x240c('0x2'));var moment=require(_0x240c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x240c('0x4'));var rimraf=require(_0x240c('0x5'));var config=require(_0x240c('0x6'));var attributes=require(_0x240c('0x7'));module[_0x240c('0x8')]=function(_0xf776b7,_0x2d597f){return _0xf776b7['define'](_0x240c('0x9'),attributes,{'tableName':_0x240c('0xa'),'paranoid':![],'indexes':[{'name':_0x240c('0xb'),'fields':[_0x240c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 46fe825..06bf9ea 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 _0x7c15=['http','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7c15,0x1ae));var _0x57c1=function(_0xa880d4,_0x1c7876){_0xa880d4=_0xa880d4-0x0;var _0x498c76=_0x7c15[_0xa880d4];return _0x498c76;};'use strict';var _=require(_0x57c1('0x0'));var util=require(_0x57c1('0x1'));var moment=require(_0x57c1('0x2'));var BPromise=require(_0x57c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57c1('0x4'));var db=require(_0x57c1('0x5'))['db'];var utils=require(_0x57c1('0x6'));var logger=require(_0x57c1('0x7'))(_0x57c1('0x8'));var config=require(_0x57c1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x57c1('0xa')][_0x57c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42fa19,_0x57c7b2,_0x44bfdb){return new BPromise(function(_0x293105,_0x180402){return client['request'](_0x42fa19,_0x44bfdb)['then'](function(_0xe0d362){logger[_0x57c1('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x57c7b2,_0x57c1('0xd'));logger[_0x57c1('0xe')](_0x57c1('0xf'),_0x57c7b2,'request\x20sent',JSON[_0x57c1('0x10')](_0xe0d362));if(_0xe0d362[_0x57c1('0x11')]){if(_0xe0d362[_0x57c1('0x11')]['code']===0x1f4){logger['error'](_0x57c1('0x12'),_0x57c7b2,_0xe0d362[_0x57c1('0x11')][_0x57c1('0x13')]);return _0x180402(_0xe0d362[_0x57c1('0x11')][_0x57c1('0x13')]);}logger[_0x57c1('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x57c7b2,_0xe0d362[_0x57c1('0x11')][_0x57c1('0x13')]);return _0x293105(_0xe0d362['error']['message']);}else{logger[_0x57c1('0xc')](_0x57c1('0x12'),_0x57c7b2,'request\x20sent');_0x293105(_0xe0d362['result']['message']);}})[_0x57c1('0x14')](function(_0x4a2c5a){logger[_0x57c1('0x11')](_0x57c1('0x12'),_0x57c7b2,_0x4a2c5a);_0x180402(_0x4a2c5a);});});} \ No newline at end of file +var _0x1c34=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x10c69e,_0x5cad96){var _0x26da29=function(_0x4d3b33){while(--_0x4d3b33){_0x10c69e['push'](_0x10c69e['shift']());}};_0x26da29(++_0x5cad96);}(_0x1c34,0x161));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41c3('0x0'));var util=require(_0x41c3('0x1'));var moment=require(_0x41c3('0x2'));var BPromise=require(_0x41c3('0x3'));var rs=require(_0x41c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41c3('0x5'))['db'];var utils=require(_0x41c3('0x6'));var logger=require('../../config/logger')(_0x41c3('0x7'));var config=require('../../config/environment');var jayson=require(_0x41c3('0x8'));var client=jayson['client'][_0x41c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17f187,_0x43e13e,_0x4cf1e8){return new BPromise(function(_0xd552ca,_0x59e2e0){return client[_0x41c3('0xa')](_0x17f187,_0x4cf1e8)[_0x41c3('0xb')](function(_0x1617ad){logger[_0x41c3('0xc')](_0x41c3('0xd'),_0x43e13e,_0x41c3('0xe'));logger['debug'](_0x41c3('0xf'),_0x43e13e,_0x41c3('0xe'),JSON[_0x41c3('0x10')](_0x1617ad));if(_0x1617ad['error']){if(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x12')]===0x1f4){logger['error'](_0x41c3('0xd'),_0x43e13e,_0x1617ad[_0x41c3('0x11')]['message']);return _0x59e2e0(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x13')]);}logger['error'](_0x41c3('0xd'),_0x43e13e,_0x1617ad['error']['message']);return _0xd552ca(_0x1617ad[_0x41c3('0x11')][_0x41c3('0x13')]);}else{logger[_0x41c3('0xc')](_0x41c3('0xd'),_0x43e13e,'request\x20sent');_0xd552ca(_0x1617ad[_0x41c3('0x14')]['message']);}})['catch'](function(_0x204bf8){logger[_0x41c3('0x11')](_0x41c3('0xd'),_0x43e13e,_0x204bf8);_0x59e2e0(_0x204bf8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0ef6cbf..31e6c6b 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 _0x5ef0=['../../components/interaction/service','isAuthenticated','index','/describe','get','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout'];(function(_0xf0ee5a,_0x4a34a3){var _0x342638=function(_0x574fbe){while(--_0x574fbe){_0xf0ee5a['push'](_0xf0ee5a['shift']());}};_0x342638(++_0x4a34a3);}(_0x5ef0,0x128));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x05ef('0x0'));var util=require(_0x05ef('0x1'));var path=require(_0x05ef('0x2'));var timeout=require(_0x05ef('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x05ef('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x05ef('0x5')](),controller[_0x05ef('0x6')]);router['get'](_0x05ef('0x7'),auth[_0x05ef('0x5')](),controller['describe']);router[_0x05ef('0x8')](_0x05ef('0x9'),auth[_0x05ef('0x5')](),controller[_0x05ef('0xa')]);router[_0x05ef('0xb')]('/',auth[_0x05ef('0x5')](),controller['create']);router[_0x05ef('0xc')](_0x05ef('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x05ef('0xd')]('/:id',auth[_0x05ef('0x5')](),controller['destroy']);module[_0x05ef('0xe')]=router; \ No newline at end of file +var _0x39be=['/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index'];(function(_0x2a403a,_0x4ec334){var _0x3a0f0d=function(_0x5b586f){while(--_0x5b586f){_0x2a403a['push'](_0x2a403a['shift']());}};_0x3a0f0d(++_0x4ec334);}(_0x39be,0x95));var _0xe39b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x39be[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xe39b('0x0'));var util=require(_0xe39b('0x1'));var path=require(_0xe39b('0x2'));var timeout=require(_0xe39b('0x3'));var express=require('express');var router=express[_0xe39b('0x4')]();var fs_extra=require(_0xe39b('0x5'));var auth=require(_0xe39b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe39b('0x7'));router[_0xe39b('0x8')]('/',auth[_0xe39b('0x9')](),controller[_0xe39b('0xa')]);router[_0xe39b('0x8')](_0xe39b('0xb'),auth[_0xe39b('0x9')](),controller['describe']);router[_0xe39b('0x8')](_0xe39b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe39b('0xd')]('/',auth[_0xe39b('0x9')](),controller[_0xe39b('0xe')]);router[_0xe39b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe39b('0x10')]);router[_0xe39b('0x11')]('/:id',auth[_0xe39b('0x9')](),controller[_0xe39b('0x12')]);module[_0xe39b('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f4c0eba..9d6af6a 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 _0x70eb=['setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','DATE','enterAt','diff','seconds'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x70eb,0x1cc));var _0xb70e=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x70eb[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0xb70e('0x0'));var moment=require('moment');module[_0xb70e('0x1')]={'channel':{'type':Sequelize[_0xb70e('0x2')]},'membername':{'type':Sequelize[_0xb70e('0x2')]},'interface':{'type':Sequelize[_0xb70e('0x2')]},'type':{'type':Sequelize[_0xb70e('0x2')],'defaultValue':_0xb70e('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xb70e('0x4')]},'exitAt':{'type':Sequelize[_0xb70e('0x4')],'set':function(_0xcecce5){var _0x4d9f1b=moment(_0xcecce5);var _0x5049d6=moment(this['getDataValue'](_0xb70e('0x5')));var _0x1fa45c=_0x4d9f1b[_0xb70e('0x6')](_0x5049d6,_0xb70e('0x7'));this[_0xb70e('0x8')]('exitAt',_0xcecce5);this[_0xb70e('0x8')](_0xb70e('0x9'),_0x1fa45c>=0x0?_0x1fa45c:null);}},'data1':{'type':Sequelize[_0xb70e('0x2')],'comment':_0xb70e('0xa')},'data2':{'type':Sequelize[_0xb70e('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb70e('0x2')],'comment':_0xb70e('0xb')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xb70e('0x2')],'comment':_0xb70e('0xc')},'role':{'type':Sequelize[_0xb70e('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb70e('0x2')]}}; \ No newline at end of file +var _0xf0d8=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x3ca198,_0x2be2b9){var _0x29ce0d=function(_0x58334a){while(--_0x58334a){_0x3ca198['push'](_0x3ca198['shift']());}};_0x29ce0d(++_0x2be2b9);}(_0xf0d8,0x111));var _0x8f0d=function(_0xc981a4,_0x18ba78){_0xc981a4=_0xc981a4-0x0;var _0x2fe137=_0xf0d8[_0xc981a4];return _0x2fe137;};'use strict';var Sequelize=require(_0x8f0d('0x0'));var moment=require(_0x8f0d('0x1'));module[_0x8f0d('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8f0d('0x3')]},'interface':{'type':Sequelize[_0x8f0d('0x3')]},'type':{'type':Sequelize[_0x8f0d('0x3')],'defaultValue':_0x8f0d('0x4'),'comment':_0x8f0d('0x5')},'duration':{'type':Sequelize[_0x8f0d('0x6')]},'enterAt':{'type':Sequelize[_0x8f0d('0x7')]},'exitAt':{'type':Sequelize[_0x8f0d('0x7')],'set':function(_0x4a3784){var _0x25af71=moment(_0x4a3784);var _0x44003f=moment(this[_0x8f0d('0x8')](_0x8f0d('0x9')));var _0x3d727e=_0x25af71['diff'](_0x44003f,'seconds');this[_0x8f0d('0xa')](_0x8f0d('0xb'),_0x4a3784);this[_0x8f0d('0xa')](_0x8f0d('0xc'),_0x3d727e>=0x0?_0x3d727e:null);}},'data1':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xd')},'data2':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xe')},'data3':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0xf')},'data4':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0x10')},'data5':{'type':Sequelize[_0x8f0d('0x3')],'comment':_0x8f0d('0x11')},'role':{'type':Sequelize[_0x8f0d('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8f0d('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 917dc8d..1552633 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];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=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x37b599,_0x8e26cc){var _0x123314=function(_0x48a619){while(--_0x48a619){_0x37b599['push'](_0x37b599['shift']());}};_0x123314(++_0x8e26cc);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];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=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6b59db2..c7f72a6 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 _0xb1fc=['membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0xb1fc,0xb3));var _0xcb1f=function(_0x506422,_0x4fd290){_0x506422=_0x506422-0x0;var _0xd3f881=_0xb1fc[_0x506422];return _0xd3f881;};'use strict';var _=require(_0xcb1f('0x0'));var util=require(_0xcb1f('0x1'));var logger=require('../../config/logger')(_0xcb1f('0x2'));var moment=require(_0xcb1f('0x3'));var BPromise=require(_0xcb1f('0x4'));var rp=require(_0xcb1f('0x5'));var fs=require('fs');var path=require(_0xcb1f('0x6'));var rimraf=require(_0xcb1f('0x7'));var config=require(_0xcb1f('0x8'));var attributes=require(_0xcb1f('0x9'));module['exports']=function(_0x3b9740,_0x4291a9){return _0x3b9740[_0xcb1f('0xa')](_0xcb1f('0xb'),attributes,{'tableName':_0xcb1f('0xc'),'paranoid':![],'indexes':[{'name':_0xcb1f('0xd'),'fields':[_0xcb1f('0xe'),_0xcb1f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7212=['report_member','membername_interface','membername','lodash','moment','rimraf','exports','MemberReport'];(function(_0x13588c,_0x289580){var _0x53a0d0=function(_0x627cce){while(--_0x627cce){_0x13588c['push'](_0x13588c['shift']());}};_0x53a0d0(++_0x289580);}(_0x7212,0x1e3));var _0x2721=function(_0x581456,_0x6023e5){_0x581456=_0x581456-0x0;var _0x331eb6=_0x7212[_0x581456];return _0x331eb6;};'use strict';var _=require(_0x2721('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2721('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2721('0x2'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x2721('0x3')]=function(_0x3e584a,_0x3673ce){return _0x3e584a['define'](_0x2721('0x4'),attributes,{'tableName':_0x2721('0x5'),'paranoid':![],'indexes':[{'name':_0x2721('0x6'),'fields':[_0x2721('0x7'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d6621d2..494adb5 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 _0x4ce6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','map','model','include','catch','CreateMemberReport','create','raw','UpdateMemberReport','update','debug','lodash','moment'];(function(_0x596684,_0x3e7a0a){var _0x21d272=function(_0x1223f2){while(--_0x1223f2){_0x596684['push'](_0x596684['shift']());}};_0x21d272(++_0x3e7a0a);}(_0x4ce6,0x108));var _0x64ce=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x4ce6[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8f2d,_0x538b74,_0x3c279f){return new BPromise(function(_0x134230,_0x1b253e){return client[_0x64ce('0xa')](_0x5b8f2d,_0x3c279f)[_0x64ce('0xb')](function(_0x135482){logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));logger['debug'](_0x64ce('0xf'),_0x538b74,_0x64ce('0xe'),JSON[_0x64ce('0x10')](_0x135482));if(_0x135482[_0x64ce('0x11')]){if(_0x135482[_0x64ce('0x11')][_0x64ce('0x12')]===0x1f4){logger[_0x64ce('0x11')](_0x64ce('0xd'),_0x538b74,_0x135482['error'][_0x64ce('0x13')]);return _0x1b253e(_0x135482['error']['message']);}logger[_0x64ce('0x11')]('MemberReport,\x20%s,\x20%s',_0x538b74,_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);return _0x134230(_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);}else{logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));_0x134230(_0x135482[_0x64ce('0x14')][_0x64ce('0x13')]);}})['catch'](function(_0x4b49be){logger['error'](_0x64ce('0xd'),_0x538b74,_0x4b49be);_0x1b253e(_0x4b49be);});});}exports[_0x64ce('0x15')]=function(_0x1f6fd4){var _0x9cb092=this;return new Promise(function(_0x38d441,_0x3742c0){return db[_0x64ce('0x16')][_0x64ce('0x17')]({'raw':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f6fd4['options']?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x19')]||null:null,'attributes':_0x1f6fd4['options']?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x1a')]||null:null,'limit':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x1b')]||null:null,'include':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')]['include']?_[_0x64ce('0x1c')](_0x1f6fd4[_0x64ce('0x18')]['include'],function(_0x1aec1f){return{'model':db[_0x1aec1f[_0x64ce('0x1d')]],'as':_0x1aec1f['as'],'attributes':_0x1aec1f['attributes'],'include':_0x1aec1f[_0x64ce('0x1e')]?_[_0x64ce('0x1c')](_0x1aec1f[_0x64ce('0x1e')],function(_0x33feb3){return{'model':db[_0x33feb3[_0x64ce('0x1d')]],'as':_0x33feb3['as'],'attributes':_0x33feb3[_0x64ce('0x1a')],'include':_0x33feb3['include']?_[_0x64ce('0x1c')](_0x33feb3[_0x64ce('0x1e')],function(_0x5415de){return{'model':db[_0x5415de[_0x64ce('0x1d')]],'as':_0x5415de['as'],'attributes':_0x5415de[_0x64ce('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34957c){logger[_0x64ce('0xc')](_0x64ce('0x15'),_0x1f6fd4);logger['debug'](_0x64ce('0x15'),_0x1f6fd4,JSON[_0x64ce('0x10')](_0x34957c));_0x38d441(_0x34957c);})[_0x64ce('0x1f')](function(_0x3e7a52){logger[_0x64ce('0x11')](_0x64ce('0x15'),_0x3e7a52[_0x64ce('0x13')],_0x1f6fd4);_0x3742c0(_0x9cb092[_0x64ce('0x11')](0x1f4,_0x3e7a52[_0x64ce('0x13')]));});});};exports[_0x64ce('0x20')]=function(_0x30d688){var _0xba6e8b=this;return new Promise(function(_0x531378,_0x14c100){return db['MemberReport'][_0x64ce('0x21')](_0x30d688['body'],{'raw':_0x30d688[_0x64ce('0x18')]?_0x30d688['options'][_0x64ce('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x563407){logger['info'](_0x64ce('0x20'),_0x30d688);logger['debug']('CreateMemberReport',_0x30d688,JSON[_0x64ce('0x10')](_0x563407));_0x531378(_0x563407);})[_0x64ce('0x1f')](function(_0x1e8ea8){logger[_0x64ce('0x11')](_0x64ce('0x20'),_0x1e8ea8['message'],_0x30d688);_0x14c100(_0xba6e8b[_0x64ce('0x11')](0x1f4,_0x1e8ea8[_0x64ce('0x13')]));});});};exports[_0x64ce('0x23')]=function(_0x3a0448){var _0x3a2389=this;return new Promise(function(_0x505db6,_0x3b9d90){return db[_0x64ce('0x16')][_0x64ce('0x24')](_0x3a0448['body'],{'raw':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')][_0x64ce('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')][_0x64ce('0x19')]||null:null,'attributes':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')]['attributes']||null:null,'limit':_0x3a0448[_0x64ce('0x18')]?_0x3a0448['options']['limit']||null:null})[_0x64ce('0xb')](function(_0x4e8d70){logger[_0x64ce('0xc')](_0x64ce('0x23'),_0x3a0448);logger[_0x64ce('0x25')]('UpdateMemberReport',_0x3a0448,JSON[_0x64ce('0x10')](_0x4e8d70));_0x505db6(_0x4e8d70);})[_0x64ce('0x1f')](function(_0x5dd007){logger[_0x64ce('0x11')]('UpdateMemberReport',_0x5dd007[_0x64ce('0x13')],_0x3a0448);_0x3b9d90(_0x3a2389[_0x64ce('0x11')](0x1f4,_0x5dd007[_0x64ce('0x13')]));});});}; \ No newline at end of file +var _0xd2f5=['raw','attributes','map','include','model','stringify','CreateMemberReport','create','body','UpdateMemberReport','where','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2f5,0x144));var _0x5d2f=function(_0x252478,_0x50c9ae){_0x252478=_0x252478-0x0;var _0x3bb47f=_0xd2f5[_0x252478];return _0x3bb47f;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});}exports[_0x5d2f('0x17')]=function(_0x454782){var _0x5a79f1=this;return new Promise(function(_0x27e16d,_0x38a958){return db[_0x5d2f('0x18')][_0x5d2f('0x19')]({'raw':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x454782['options']?_0x454782['options']['where']||null:null,'attributes':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1c')]||null:null,'limit':_0x454782[_0x5d2f('0x1a')]?_0x454782[_0x5d2f('0x1a')]['limit']||null:null,'include':_0x454782['options']?_0x454782[_0x5d2f('0x1a')]['include']?_[_0x5d2f('0x1d')](_0x454782[_0x5d2f('0x1a')][_0x5d2f('0x1e')],function(_0x6d8859){return{'model':db[_0x6d8859[_0x5d2f('0x1f')]],'as':_0x6d8859['as'],'attributes':_0x6d8859[_0x5d2f('0x1c')],'include':_0x6d8859[_0x5d2f('0x1e')]?_[_0x5d2f('0x1d')](_0x6d8859['include'],function(_0x3e5ef5){return{'model':db[_0x3e5ef5[_0x5d2f('0x1f')]],'as':_0x3e5ef5['as'],'attributes':_0x3e5ef5[_0x5d2f('0x1c')],'include':_0x3e5ef5[_0x5d2f('0x1e')]?_[_0x5d2f('0x1d')](_0x3e5ef5[_0x5d2f('0x1e')],function(_0x2ff7cc){return{'model':db[_0x2ff7cc[_0x5d2f('0x1f')]],'as':_0x2ff7cc['as'],'attributes':_0x2ff7cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d2f('0xc')](function(_0xa95a71){logger[_0x5d2f('0xd')](_0x5d2f('0x17'),_0x454782);logger[_0x5d2f('0xf')]('GetMemberReport',_0x454782,JSON[_0x5d2f('0x20')](_0xa95a71));_0x27e16d(_0xa95a71);})[_0x5d2f('0x16')](function(_0x102977){logger[_0x5d2f('0x12')]('GetMemberReport',_0x102977[_0x5d2f('0x14')],_0x454782);_0x38a958(_0x5a79f1[_0x5d2f('0x12')](0x1f4,_0x102977['message']));});});};exports[_0x5d2f('0x21')]=function(_0x2f881d){var _0x26e988=this;return new Promise(function(_0x4ff711,_0x3391b1){return db[_0x5d2f('0x18')][_0x5d2f('0x22')](_0x2f881d[_0x5d2f('0x23')],{'raw':_0x2f881d[_0x5d2f('0x1a')]?_0x2f881d[_0x5d2f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5d2f('0xc')](function(_0x9bb510){logger[_0x5d2f('0xd')]('CreateMemberReport',_0x2f881d);logger['debug'](_0x5d2f('0x21'),_0x2f881d,JSON[_0x5d2f('0x20')](_0x9bb510));_0x4ff711(_0x9bb510);})[_0x5d2f('0x16')](function(_0x24ea6a){logger[_0x5d2f('0x12')](_0x5d2f('0x21'),_0x24ea6a[_0x5d2f('0x14')],_0x2f881d);_0x3391b1(_0x26e988[_0x5d2f('0x12')](0x1f4,_0x24ea6a[_0x5d2f('0x14')]));});});};exports[_0x5d2f('0x24')]=function(_0xfdd81){var _0x68ee1=this;return new Promise(function(_0x34534b,_0x24e512){return db[_0x5d2f('0x18')]['update'](_0xfdd81[_0x5d2f('0x23')],{'raw':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x25')]||null:null,'attributes':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')]['attributes']||null:null,'limit':_0xfdd81[_0x5d2f('0x1a')]?_0xfdd81[_0x5d2f('0x1a')][_0x5d2f('0x26')]||null:null})[_0x5d2f('0xc')](function(_0x14c319){logger[_0x5d2f('0xd')](_0x5d2f('0x24'),_0xfdd81);logger[_0x5d2f('0xf')]('UpdateMemberReport',_0xfdd81,JSON[_0x5d2f('0x20')](_0x14c319));_0x34534b(_0x14c319);})['catch'](function(_0x2c5ba8){logger[_0x5d2f('0x12')](_0x5d2f('0x24'),_0x2c5ba8[_0x5d2f('0x14')],_0xfdd81);_0x24e512(_0x68ee1[_0x5d2f('0x12')](0x1f4,_0x2c5ba8[_0x5d2f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c34f308..b7fc99c 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 _0x1530=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','exports','multer','path','connect-timeout','express','Router'];(function(_0x49870c,_0x4d2e2b){var _0x2c98f5=function(_0x32d62b){while(--_0x32d62b){_0x49870c['push'](_0x49870c['shift']());}};_0x2c98f5(++_0x4d2e2b);}(_0x1530,0x103));var _0x0153=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1530[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x0153('0x0'));var util=require('util');var path=require(_0x0153('0x1'));var timeout=require(_0x0153('0x2'));var express=require(_0x0153('0x3'));var router=express[_0x0153('0x4')]();var fs_extra=require(_0x0153('0x5'));var auth=require(_0x0153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0153('0x7'));var controller=require(_0x0153('0x8'));router['get']('/',controller[_0x0153('0x9')]);module[_0x0153('0xa')]=router; \ No newline at end of file +var _0x5e61=['../../components/interaction/service','./migration.controller','get','index','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x24117c,_0x2f30ec){var _0x4f2f1b=function(_0x321700){while(--_0x321700){_0x24117c['push'](_0x24117c['shift']());}};_0x4f2f1b(++_0x2f30ec);}(_0x5e61,0x126));var _0x15e6=function(_0x3df314,_0x1e108a){_0x3df314=_0x3df314-0x0;var _0x13a167=_0x5e61[_0x3df314];return _0x13a167;};'use strict';var multer=require(_0x15e6('0x0'));var util=require('util');var path=require(_0x15e6('0x1'));var timeout=require(_0x15e6('0x2'));var express=require('express');var router=express[_0x15e6('0x3')]();var fs_extra=require(_0x15e6('0x4'));var auth=require(_0x15e6('0x5'));var interaction=require(_0x15e6('0x6'));var config=require('../../config/environment');var controller=require(_0x15e6('0x7'));router[_0x15e6('0x8')]('/',controller[_0x15e6('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 873873b..b1f82ee 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 _0x8093=['exports','sequelize'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x8093,0x1d7));var _0x3809=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0x8093[_0x53b133];return _0x5647e0;};'use strict';var Sequelize=require(_0x3809('0x0'));module[_0x3809('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x4720=['exports','STRING'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x4720,0x6e));var _0x0472=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x4720[_0x3ba566];return _0x480317;};'use strict';var Sequelize=require('sequelize');module[_0x0472('0x0')]={'version':{'type':Sequelize[_0x0472('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f0ef90f..5e35b45 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 _0x5a08=['index','map','Migration','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0x5a08,0x97));var _0x85a0=function(_0x442845,_0xb70932){_0x442845=_0x442845-0x0;var _0x5c88e0=_0x5a08[_0x442845];return _0x5c88e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85a0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85a0('0x1'));var rp=require(_0x85a0('0x2'));var moment=require(_0x85a0('0x3'));var BPromise=require(_0x85a0('0x4'));var Mustache=require(_0x85a0('0x5'));var util=require('util');var path=require(_0x85a0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85a0('0x7'));var fs=require('fs');var fs_extra=require(_0x85a0('0x8'));var _=require('lodash');var squel=require(_0x85a0('0x9'));var crypto=require(_0x85a0('0xa'));var jsforce=require(_0x85a0('0xb'));var deskjs=require(_0x85a0('0xc'));var toCsv=require(_0x85a0('0xd'));var querystring=require('querystring');var Papa=require(_0x85a0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85a0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85a0('0x10'))(_0x85a0('0x11'));var utils=require(_0x85a0('0x12'));var config=require(_0x85a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe735d7,_0x50f76d){_0x50f76d=_0x50f76d||0xcc;return function(_0x14cfa9){if(_0x14cfa9){return _0xe735d7[_0x85a0('0x14')](_0x50f76d);}return _0xe735d7[_0x85a0('0x15')](_0x50f76d)[_0x85a0('0x16')]();};}function respondWithResult(_0x4aa8d8,_0x55581f){_0x55581f=_0x55581f||0xc8;return function(_0x9d81b1){if(_0x9d81b1){return _0x4aa8d8[_0x85a0('0x15')](_0x55581f)[_0x85a0('0x17')](_0x9d81b1);}};}function respondWithFilteredResult(_0x2a5b8d,_0x5fe5b5){return function(_0x39f447){if(_0x39f447){var _0x177722=typeof _0x5fe5b5['offset']===_0x85a0('0x18')&&typeof _0x5fe5b5[_0x85a0('0x19')]===_0x85a0('0x18');var _0x4eef34=_0x39f447[_0x85a0('0x1a')];var _0x3e7200=_0x177722?0x0:_0x5fe5b5[_0x85a0('0x1b')];var _0x2f2830=_0x177722?_0x39f447[_0x85a0('0x1a')]:_0x5fe5b5[_0x85a0('0x1b')]+_0x5fe5b5[_0x85a0('0x19')];var _0x329b0a;if(_0x2f2830>=_0x4eef34){_0x2f2830=_0x4eef34;_0x329b0a=0xc8;}else{_0x329b0a=0xce;}_0x2a5b8d[_0x85a0('0x15')](_0x329b0a);return _0x2a5b8d[_0x85a0('0x1c')](_0x85a0('0x1d'),_0x3e7200+'-'+_0x2f2830+'/'+_0x4eef34)[_0x85a0('0x17')](_0x39f447);}return null;};}function patchUpdates(_0x2ec141){return function(_0x31a3e2){try{jsonpatch['apply'](_0x31a3e2,_0x2ec141,!![]);}catch(_0x35f629){return BPromise[_0x85a0('0x1e')](_0x35f629);}return _0x31a3e2[_0x85a0('0x1f')]();};}function saveUpdates(_0x414832,_0x523d41){return function(_0x3852c6){if(_0x3852c6){return _0x3852c6[_0x85a0('0x20')](_0x414832)[_0x85a0('0x21')](function(_0x22101e){return _0x22101e;});}return null;};}function removeEntity(_0x52e8ef,_0x5c463){return function(_0x1db61e){if(_0x1db61e){return _0x1db61e[_0x85a0('0x22')]()[_0x85a0('0x21')](function(){_0x52e8ef[_0x85a0('0x15')](0xcc)[_0x85a0('0x16')]();});}};}function handleEntityNotFound(_0x14e8e7,_0x6c2373){return function(_0x152482){if(!_0x152482){_0x14e8e7[_0x85a0('0x14')](0x194);}return _0x152482;};}function handleError(_0x5554a7,_0x398e2d){_0x398e2d=_0x398e2d||0x1f4;return function(_0x520bbe){logger[_0x85a0('0x23')](_0x520bbe['stack']);if(_0x520bbe[_0x85a0('0x24')]){delete _0x520bbe['name'];}_0x5554a7[_0x85a0('0x15')](_0x398e2d)[_0x85a0('0x25')](_0x520bbe);};}exports[_0x85a0('0x26')]=function(_0x4baaa2,_0x58fb3f){var _0x14b5c1={},_0x464b6e={},_0x382eca={'count':0x0,'rows':[]};var _0x2ffc1e=_[_0x85a0('0x27')](db[_0x85a0('0x28')]['rawAttributes'],function(_0x4b7541){return{'name':_0x4b7541[_0x85a0('0x29')],'type':_0x4b7541[_0x85a0('0x2a')][_0x85a0('0x2b')]};});_0x464b6e[_0x85a0('0x2c')]=_[_0x85a0('0x27')](_0x2ffc1e,'name');_0x464b6e[_0x85a0('0x2d')]=_['keys'](_0x4baaa2[_0x85a0('0x2d')]);_0x464b6e[_0x85a0('0x2e')]=_[_0x85a0('0x2f')](_0x464b6e['model'],_0x464b6e[_0x85a0('0x2d')]);_0x14b5c1[_0x85a0('0x30')]=_['intersection'](_0x464b6e[_0x85a0('0x2c')],qs[_0x85a0('0x31')](_0x4baaa2['query'][_0x85a0('0x31')]));_0x14b5c1[_0x85a0('0x30')]=_0x14b5c1['attributes']['length']?_0x14b5c1['attributes']:_0x464b6e['model'];if(!_0x4baaa2[_0x85a0('0x2d')]['hasOwnProperty'](_0x85a0('0x32'))){_0x14b5c1[_0x85a0('0x19')]=qs[_0x85a0('0x19')](_0x4baaa2[_0x85a0('0x2d')][_0x85a0('0x19')]);_0x14b5c1[_0x85a0('0x1b')]=qs[_0x85a0('0x1b')](_0x4baaa2['query'][_0x85a0('0x1b')]);}_0x14b5c1[_0x85a0('0x33')]=qs['sort'](_0x4baaa2[_0x85a0('0x2d')][_0x85a0('0x34')]);_0x14b5c1[_0x85a0('0x35')]=qs[_0x85a0('0x2e')](_[_0x85a0('0x36')](_0x4baaa2['query'],_0x464b6e['filters']),_0x2ffc1e);if(_0x4baaa2[_0x85a0('0x2d')][_0x85a0('0x37')]){_0x14b5c1[_0x85a0('0x35')]=_['merge'](_0x14b5c1[_0x85a0('0x35')],{'$or':_['map'](_0x2ffc1e,function(_0x1d6c04){if(_0x1d6c04['type']!=='VIRTUAL'){var _0x234e10={};_0x234e10[_0x1d6c04[_0x85a0('0x24')]]={'$like':'%'+_0x4baaa2[_0x85a0('0x2d')][_0x85a0('0x37')]+'%'};return _0x234e10;}})});}_0x14b5c1=_[_0x85a0('0x38')]({},_0x14b5c1,_0x4baaa2[_0x85a0('0x39')]);var _0xc0a2d0={'where':_0x14b5c1['where']};return db[_0x85a0('0x28')]['count'](_0xc0a2d0)[_0x85a0('0x21')](function(_0x3f715b){_0x382eca[_0x85a0('0x1a')]=_0x3f715b;if(_0x4baaa2[_0x85a0('0x2d')][_0x85a0('0x3a')]){_0x14b5c1[_0x85a0('0x3b')]=[{'all':!![]}];}return db[_0x85a0('0x28')][_0x85a0('0x3c')](_0x14b5c1);})[_0x85a0('0x21')](function(_0x53abf7){_0x382eca[_0x85a0('0x3d')]=_0x53abf7;return _0x382eca;})['then'](respondWithFilteredResult(_0x58fb3f,_0x14b5c1))[_0x85a0('0x3e')](handleError(_0x58fb3f,null));}; \ No newline at end of file +var _0x24f8=['name','send','index','map','Migration','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','then','destroy','sendStatus','error'];(function(_0x5341d2,_0x2da6d6){var _0x3a4d6a=function(_0x254688){while(--_0x254688){_0x5341d2['push'](_0x5341d2['shift']());}};_0x3a4d6a(++_0x2da6d6);}(_0x24f8,0x1bb));var _0x824f=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x24f8[_0x12b683];return _0xfb150b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x824f('0x0'));var zipdir=require(_0x824f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x824f('0x2'));var moment=require(_0x824f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x824f('0x4'));var util=require(_0x824f('0x5'));var path=require('path');var sox=require(_0x824f('0x6'));var csv=require(_0x824f('0x7'));var ejs=require(_0x824f('0x8'));var fs=require('fs');var fs_extra=require(_0x824f('0x9'));var _=require(_0x824f('0xa'));var squel=require(_0x824f('0xb'));var crypto=require(_0x824f('0xc'));var jsforce=require(_0x824f('0xd'));var deskjs=require(_0x824f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x824f('0xf'));var Papa=require(_0x824f('0x10'));var Redis=require(_0x824f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x824f('0x12'));var as=require(_0x824f('0x13'));var hardwareService=require(_0x824f('0x14'));var logger=require(_0x824f('0x15'))(_0x824f('0x16'));var utils=require(_0x824f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x824f('0x18'));var db=require(_0x824f('0x19'))['db'];function respondWithStatusCode(_0x26cd15,_0x1e9d60){_0x1e9d60=_0x1e9d60||0xcc;return function(_0x27c25a){if(_0x27c25a){return _0x26cd15['sendStatus'](_0x1e9d60);}return _0x26cd15['status'](_0x1e9d60)[_0x824f('0x1a')]();};}function respondWithResult(_0x24be29,_0x3a9fe1){_0x3a9fe1=_0x3a9fe1||0xc8;return function(_0x370be7){if(_0x370be7){return _0x24be29[_0x824f('0x1b')](_0x3a9fe1)[_0x824f('0x1c')](_0x370be7);}};}function respondWithFilteredResult(_0x4243e2,_0x453054){return function(_0x408cdf){if(_0x408cdf){var _0x17db35=typeof _0x453054[_0x824f('0x1d')]==='undefined'&&typeof _0x453054['limit']===_0x824f('0x1e');var _0x30849b=_0x408cdf[_0x824f('0x1f')];var _0x441692=_0x17db35?0x0:_0x453054[_0x824f('0x1d')];var _0x99996=_0x17db35?_0x408cdf[_0x824f('0x1f')]:_0x453054[_0x824f('0x1d')]+_0x453054[_0x824f('0x20')];var _0x317e54;if(_0x99996>=_0x30849b){_0x99996=_0x30849b;_0x317e54=0xc8;}else{_0x317e54=0xce;}_0x4243e2[_0x824f('0x1b')](_0x317e54);return _0x4243e2[_0x824f('0x21')]('Content-Range',_0x441692+'-'+_0x99996+'/'+_0x30849b)[_0x824f('0x1c')](_0x408cdf);}return null;};}function patchUpdates(_0x2a724a){return function(_0x571e66){try{jsonpatch[_0x824f('0x22')](_0x571e66,_0x2a724a,!![]);}catch(_0x24b792){return BPromise['reject'](_0x24b792);}return _0x571e66[_0x824f('0x23')]();};}function saveUpdates(_0x18ec24,_0x26c55d){return function(_0x1ece63){if(_0x1ece63){return _0x1ece63['update'](_0x18ec24)[_0x824f('0x24')](function(_0x157670){return _0x157670;});}return null;};}function removeEntity(_0x240a5e,_0x18ce1e){return function(_0x2e2f6f){if(_0x2e2f6f){return _0x2e2f6f[_0x824f('0x25')]()['then'](function(){_0x240a5e[_0x824f('0x1b')](0xcc)[_0x824f('0x1a')]();});}};}function handleEntityNotFound(_0x5aec80,_0x3b2691){return function(_0x218d16){if(!_0x218d16){_0x5aec80[_0x824f('0x26')](0x194);}return _0x218d16;};}function handleError(_0x1c6fca,_0x5b783c){_0x5b783c=_0x5b783c||0x1f4;return function(_0x583d66){logger[_0x824f('0x27')](_0x583d66['stack']);if(_0x583d66[_0x824f('0x28')]){delete _0x583d66['name'];}_0x1c6fca[_0x824f('0x1b')](_0x5b783c)[_0x824f('0x29')](_0x583d66);};}exports[_0x824f('0x2a')]=function(_0x5c433e,_0x305c9a){var _0x4e41bd={},_0x14eb70={},_0x314940={'count':0x0,'rows':[]};var _0x49f2bf=_[_0x824f('0x2b')](db[_0x824f('0x2c')]['rawAttributes'],function(_0x276967){return{'name':_0x276967[_0x824f('0x2d')],'type':_0x276967[_0x824f('0x2e')][_0x824f('0x2f')]};});_0x14eb70[_0x824f('0x30')]=_['map'](_0x49f2bf,_0x824f('0x28'));_0x14eb70['query']=_['keys'](_0x5c433e[_0x824f('0x31')]);_0x14eb70['filters']=_[_0x824f('0x32')](_0x14eb70[_0x824f('0x30')],_0x14eb70[_0x824f('0x31')]);_0x4e41bd['attributes']=_[_0x824f('0x32')](_0x14eb70[_0x824f('0x30')],qs[_0x824f('0x33')](_0x5c433e['query']['fields']));_0x4e41bd[_0x824f('0x34')]=_0x4e41bd[_0x824f('0x34')]['length']?_0x4e41bd[_0x824f('0x34')]:_0x14eb70[_0x824f('0x30')];if(!_0x5c433e[_0x824f('0x31')][_0x824f('0x35')](_0x824f('0x36'))){_0x4e41bd[_0x824f('0x20')]=qs[_0x824f('0x20')](_0x5c433e[_0x824f('0x31')][_0x824f('0x20')]);_0x4e41bd['offset']=qs[_0x824f('0x1d')](_0x5c433e['query'][_0x824f('0x1d')]);}_0x4e41bd[_0x824f('0x37')]=qs[_0x824f('0x38')](_0x5c433e[_0x824f('0x31')][_0x824f('0x38')]);_0x4e41bd[_0x824f('0x39')]=qs[_0x824f('0x3a')](_[_0x824f('0x3b')](_0x5c433e['query'],_0x14eb70[_0x824f('0x3a')]),_0x49f2bf);if(_0x5c433e[_0x824f('0x31')][_0x824f('0x3c')]){_0x4e41bd['where']=_[_0x824f('0x3d')](_0x4e41bd[_0x824f('0x39')],{'$or':_['map'](_0x49f2bf,function(_0x310666){if(_0x310666['type']!==_0x824f('0x3e')){var _0x2a600e={};_0x2a600e[_0x310666[_0x824f('0x28')]]={'$like':'%'+_0x5c433e[_0x824f('0x31')][_0x824f('0x3c')]+'%'};return _0x2a600e;}})});}_0x4e41bd=_[_0x824f('0x3d')]({},_0x4e41bd,_0x5c433e[_0x824f('0x3f')]);var _0x284ef1={'where':_0x4e41bd['where']};return db[_0x824f('0x2c')][_0x824f('0x1f')](_0x284ef1)['then'](function(_0x50abe3){_0x314940[_0x824f('0x1f')]=_0x50abe3;if(_0x5c433e[_0x824f('0x31')][_0x824f('0x40')]){_0x4e41bd[_0x824f('0x41')]=[{'all':!![]}];}return db['Migration'][_0x824f('0x42')](_0x4e41bd);})['then'](function(_0x28e2b6){_0x314940[_0x824f('0x43')]=_0x28e2b6;return _0x314940;})[_0x824f('0x24')](respondWithFilteredResult(_0x305c9a,_0x4e41bd))[_0x824f('0x44')](handleError(_0x305c9a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 17d3d1a..82d9b77 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 _0x3df6=['path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','bluebird','request-promise'];(function(_0x1b617a,_0x5ec7ed){var _0x3a6d8a=function(_0x264dc5){while(--_0x264dc5){_0x1b617a['push'](_0x1b617a['shift']());}};_0x3a6d8a(++_0x5ec7ed);}(_0x3df6,0x15b));var _0x63df=function(_0x41b658,_0x89f22c){_0x41b658=_0x41b658-0x0;var _0x2a7319=_0x3df6[_0x41b658];return _0x2a7319;};'use strict';var _=require(_0x63df('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x63df('0x1'));var rp=require(_0x63df('0x2'));var fs=require('fs');var path=require(_0x63df('0x3'));var rimraf=require(_0x63df('0x4'));var config=require(_0x63df('0x5'));var attributes=require(_0x63df('0x6'));module[_0x63df('0x7')]=function(_0x2c113d,_0x246cc4){return _0x2c113d[_0x63df('0x8')]('Migration',attributes,{'tableName':_0x63df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c4d=['exports','define','Migration','migrations','util','../../config/logger','moment','request-promise','path','../../config/environment','./migration.attributes'];(function(_0x24ae68,_0x2ecc4c){var _0x37ab49=function(_0x318f00){while(--_0x318f00){_0x24ae68['push'](_0x24ae68['shift']());}};_0x37ab49(++_0x2ecc4c);}(_0x6c4d,0x1d2));var _0xd6c4=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6c4d[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var util=require(_0xd6c4('0x0'));var logger=require(_0xd6c4('0x1'))('api');var moment=require(_0xd6c4('0x2'));var BPromise=require('bluebird');var rp=require(_0xd6c4('0x3'));var fs=require('fs');var path=require(_0xd6c4('0x4'));var rimraf=require('rimraf');var config=require(_0xd6c4('0x5'));var attributes=require(_0xd6c4('0x6'));module[_0xd6c4('0x7')]=function(_0x1dcfb7,_0x3becf5){return _0x1dcfb7[_0xd6c4('0x8')](_0xd6c4('0x9'),attributes,{'tableName':_0xd6c4('0xa'),'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 5924c37..0272f6a 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 _0x4f6f=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x2eda56,_0xdf38b1){var _0x514033=function(_0x42b7e5){while(--_0x42b7e5){_0x2eda56['push'](_0x2eda56['shift']());}};_0x514033(++_0xdf38b1);}(_0x4f6f,0x157));var _0xf4f6=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x4f6f[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc7b9,_0x4fa106,_0x106455){return new BPromise(function(_0x592fa6,_0x483c82){return client[_0xf4f6('0xa')](_0x2dc7b9,_0x106455)[_0xf4f6('0xb')](function(_0x34bc5d){logger[_0xf4f6('0xc')](_0xf4f6('0xd'),_0x4fa106,_0xf4f6('0xe'));logger['debug'](_0xf4f6('0xf'),_0x4fa106,_0xf4f6('0xe'),JSON[_0xf4f6('0x10')](_0x34bc5d));if(_0x34bc5d[_0xf4f6('0x11')]){if(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x12')]===0x1f4){logger['error'](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d[_0xf4f6('0x11')]['message']);return _0x483c82(_0x34bc5d['error'][_0xf4f6('0x13')]);}logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d['error'][_0xf4f6('0x13')]);return _0x592fa6(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x13')]);}else{logger['info'](_0xf4f6('0xd'),_0x4fa106,'request\x20sent');_0x592fa6(_0x34bc5d[_0xf4f6('0x14')][_0xf4f6('0x13')]);}})[_0xf4f6('0x15')](function(_0x522af3){logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x522af3);_0x483c82(_0x522af3);});});} \ No newline at end of file +var _0x4a3c=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xf11b27,_0x12692e){var _0x53a633=function(_0x5bbb4d){while(--_0x5bbb4d){_0xf11b27['push'](_0xf11b27['shift']());}};_0x53a633(++_0x12692e);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x511457,_0x2713a9){_0x511457=_0x511457-0x0;var _0x112c44=_0x4a3c[_0x511457];return _0x112c44;};'use strict';var _=require(_0xc4a3('0x0'));var util=require('util');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var rs=require(_0xc4a3('0x3'));var fs=require('fs');var Redis=require(_0xc4a3('0x4'));var db=require(_0xc4a3('0x5'))['db'];var utils=require(_0xc4a3('0x6'));var logger=require(_0xc4a3('0x7'))('rpc');var config=require(_0xc4a3('0x8'));var jayson=require(_0xc4a3('0x9'));var client=jayson[_0xc4a3('0xa')][_0xc4a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1c84,_0x49fa26,_0x596b01){return new BPromise(function(_0xc11c29,_0x58bdcd){return client[_0xc4a3('0xc')](_0x4b1c84,_0x596b01)[_0xc4a3('0xd')](function(_0x1e7f27){logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));logger[_0xc4a3('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x49fa26,'request\x20sent',JSON['stringify'](_0x1e7f27));if(_0x1e7f27['error']){if(_0x1e7f27['error']['code']===0x1f4){logger['error'](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);return _0x58bdcd(_0x1e7f27[_0xc4a3('0x12')]['message']);}logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x1e7f27['error'][_0xc4a3('0x13')]);return _0xc11c29(_0x1e7f27[_0xc4a3('0x12')][_0xc4a3('0x13')]);}else{logger[_0xc4a3('0xe')](_0xc4a3('0xf'),_0x49fa26,_0xc4a3('0x10'));_0xc11c29(_0x1e7f27[_0xc4a3('0x14')][_0xc4a3('0x13')]);}})[_0xc4a3('0x15')](function(_0x584b6d){logger[_0xc4a3('0x12')](_0xc4a3('0xf'),_0x49fa26,_0x584b6d);_0x58bdcd(_0x584b6d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2e798c5..85463dd 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 _0x228b=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','post','put','update'];(function(_0x40d214,_0x98e1d4){var _0x588ccd=function(_0x228e5e){while(--_0x228e5e){_0x40d214['push'](_0x40d214['shift']());}};_0x588ccd(++_0x98e1d4);}(_0x228b,0x1f3));var _0xb228=function(_0x44c090,_0x1c5b1e){_0x44c090=_0x44c090-0x0;var _0x48be03=_0x228b[_0x44c090];return _0x48be03;};'use strict';var multer=require('multer');var util=require(_0xb228('0x0'));var path=require('path');var timeout=require(_0xb228('0x1'));var express=require(_0xb228('0x2'));var router=express[_0xb228('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb228('0x4'));var interaction=require(_0xb228('0x5'));var config=require(_0xb228('0x6'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb228('0x7')]);router['get'](_0xb228('0x8'),auth[_0xb228('0x9')](),controller['show']);router[_0xb228('0xa')]('/',auth[_0xb228('0x9')](),controller['create']);router[_0xb228('0xb')]('/:id',auth[_0xb228('0x9')](),controller[_0xb228('0xc')]);router[_0xb228('0xd')]('/:id',auth[_0xb228('0x9')](),controller[_0xb228('0xe')]);module[_0xb228('0xf')]=router; \ No newline at end of file +var _0x0913=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service'];(function(_0x1f1f6e,_0x5a3545){var _0xe9d294=function(_0x1f41a7){while(--_0x1f41a7){_0x1f1f6e['push'](_0x1f1f6e['shift']());}};_0xe9d294(++_0x5a3545);}(_0x0913,0x1a5));var _0x3091=function(_0x185235,_0x5cef89){_0x185235=_0x185235-0x0;var _0x196f9d=_0x0913[_0x185235];return _0x196f9d;};'use strict';var multer=require(_0x3091('0x0'));var util=require(_0x3091('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3091('0x2'));var auth=require(_0x3091('0x3'));var interaction=require(_0x3091('0x4'));var config=require(_0x3091('0x5'));var controller=require('./network.controller');router[_0x3091('0x6')]('/',auth[_0x3091('0x7')](),controller[_0x3091('0x8')]);router[_0x3091('0x6')](_0x3091('0x9'),auth['isAuthenticated'](),controller[_0x3091('0xa')]);router[_0x3091('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3091('0xc')]('/:id',auth[_0x3091('0x7')](),controller[_0x3091('0xd')]);router[_0x3091('0xe')](_0x3091('0x9'),auth[_0x3091('0x7')](),controller[_0x3091('0xf')]);module[_0x3091('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5448f34..8577a93 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 _0xb766=['externip','turn','STRING','sequelize','exports','localnet'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb766,0x111));var _0x6b76=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb766[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6b76('0x0'));module[_0x6b76('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6b76('0x2'),_0x6b76('0x3'),'stun',_0x6b76('0x4'))},'value':{'type':Sequelize[_0x6b76('0x5')]},'username':{'type':Sequelize[_0x6b76('0x5')]},'password':{'type':Sequelize[_0x6b76('0x5')]}}; \ No newline at end of file +var _0x7c82=['externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c82,0x193));var _0x27c8=function(_0x22cf70,_0x52ded0){_0x22cf70=_0x22cf70-0x0;var _0x5dc166=_0x7c82[_0x22cf70];return _0x5dc166;};'use strict';var Sequelize=require(_0x27c8('0x0'));module[_0x27c8('0x1')]={'type':{'type':Sequelize[_0x27c8('0x2')]('localnet',_0x27c8('0x3'),_0x27c8('0x4'),_0x27c8('0x5'))},'value':{'type':Sequelize[_0x27c8('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x27c8('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8a3bf4f..36e656c 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 _0x7fee=['VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','toUpperCase','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','chan_sip.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','Network','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5ba9a3,_0x53fb84){var _0xfafa57=function(_0x22b579){while(--_0x22b579){_0x5ba9a3['push'](_0x5ba9a3['shift']());}};_0xfafa57(++_0x53fb84);}(_0x7fee,0x1d2));var _0xe7fe=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x7fee[_0x2a67fe];return _0x57e726;};'use strict';var util=require(_0xe7fe('0x0'));var path=require(_0xe7fe('0x1'));var ejs=require(_0xe7fe('0x2'));var fs=require('fs');var _=require(_0xe7fe('0x3'));var qs=require(_0xe7fe('0x4'));var logger=require(_0xe7fe('0x5'))(_0xe7fe('0x6'));var config=require(_0xe7fe('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe7fe('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3afb98,_0x510d33,_0x3836c8,_0x1b1da0){return new Promise(function(_0x2c61e8,_0x3c1468){var _0x4bf80a=_0x1b1da0||client;return _0x4bf80a[_0xe7fe('0x9')](_0x3afb98,_0x3836c8)[_0xe7fe('0xa')](function(_0x3b0e62){logger[_0xe7fe('0xb')]('Network,\x20%s,\x20%s',_0x510d33,_0xe7fe('0xc'));logger[_0xe7fe('0xd')](_0xe7fe('0xe'),_0x510d33,_0xe7fe('0xc'),JSON[_0xe7fe('0xf')](_0x3b0e62));if(_0x3b0e62[_0xe7fe('0x10')]){if(_0x3b0e62['error'][_0xe7fe('0x11')]===0x1f4){logger['error'](_0xe7fe('0x12'),_0x510d33,_0x3b0e62[_0xe7fe('0x10')][_0xe7fe('0x13')]);return _0x3c1468(_0x3b0e62[_0xe7fe('0x10')]['message']);}logger['error'](_0xe7fe('0x12'),_0x510d33,_0x3b0e62[_0xe7fe('0x10')]['message']);return _0x2c61e8(_0x3b0e62[_0xe7fe('0x10')]['message']);}else{logger[_0xe7fe('0xb')]('Network,\x20%s,\x20%s',_0x510d33,_0xe7fe('0xc'));_0x2c61e8(_0x3b0e62['result']['message']);}})[_0xe7fe('0x14')](function(_0x36e255){logger[_0xe7fe('0x10')](_0xe7fe('0x12'),_0x510d33,_0x36e255);_0x3c1468(_0x36e255);});});}function respondWithResult(_0x174c0d,_0x522b55){_0x522b55=_0x522b55||0xc8;return function(_0x21919a){if(_0x21919a){return _0x174c0d[_0xe7fe('0x15')](_0x522b55)[_0xe7fe('0x16')](_0x21919a);}};}function respondWithFilteredResult(_0x4526b8,_0x468a20){return function(_0x510c07){if(_0x510c07){var _0xcaec30=typeof _0x468a20[_0xe7fe('0x17')]===_0xe7fe('0x18')&&typeof _0x468a20['limit']===_0xe7fe('0x18');var _0x5aed16=_0x510c07[_0xe7fe('0x19')];var _0x5a9c22=_0xcaec30?0x0:_0x468a20[_0xe7fe('0x17')];var _0x13578d=_0xcaec30?_0x510c07[_0xe7fe('0x19')]:_0x468a20[_0xe7fe('0x17')]+_0x468a20[_0xe7fe('0x1a')];var _0x4d3ba0;if(_0x13578d>=_0x5aed16){_0x13578d=_0x5aed16;_0x4d3ba0=0xc8;}else{_0x4d3ba0=0xce;}_0x4526b8['status'](_0x4d3ba0);return _0x4526b8[_0xe7fe('0x1b')](_0xe7fe('0x1c'),_0x5a9c22+'-'+_0x13578d+'/'+_0x5aed16)[_0xe7fe('0x16')](_0x510c07);}return null;};}function saveUpdates(_0x5770dd){return function(_0xbbcc13){if(_0xbbcc13){return _0xbbcc13[_0xe7fe('0x1d')](_0x5770dd)[_0xe7fe('0xa')](function(_0x3b7ac4){return _0x3b7ac4;});}return null;};}function removeEntity(_0x2a8d33){return function(_0x358e56){if(_0x358e56){return _0x358e56[_0xe7fe('0x1e')]()[_0xe7fe('0xa')](function(){_0x2a8d33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x215a68){return function(_0x2747b0){if(!_0x2747b0){_0x215a68[_0xe7fe('0x1f')](0x194);}return _0x2747b0;};}function handleError(_0x57ba05,_0x1f2485){_0x1f2485=_0x1f2485||0x1f4;return function(_0x18496c){logger[_0xe7fe('0x10')](_0x18496c[_0xe7fe('0x20')]);if(_0x18496c[_0xe7fe('0x21')]){delete _0x18496c[_0xe7fe('0x21')];}_0x57ba05[_0xe7fe('0x15')](_0x1f2485)[_0xe7fe('0x22')](_0x18496c);};}exports['index']=function(_0x4edc15,_0xa05105){var _0x3d007a={},_0x4bb43d={},_0x35aab3={'count':0x0,'rows':[]};var _0x321f63=_['map'](db[_0xe7fe('0x23')][_0xe7fe('0x24')],function(_0x5c882b){return{'name':_0x5c882b[_0xe7fe('0x25')],'type':_0x5c882b[_0xe7fe('0x26')][_0xe7fe('0x27')]};});_0x4bb43d[_0xe7fe('0x28')]=_[_0xe7fe('0x29')](_0x321f63,_0xe7fe('0x21'));_0x4bb43d[_0xe7fe('0x2a')]=_[_0xe7fe('0x2b')](_0x4edc15['query']);_0x4bb43d[_0xe7fe('0x2c')]=_[_0xe7fe('0x2d')](_0x4bb43d[_0xe7fe('0x28')],_0x4bb43d[_0xe7fe('0x2a')]);_0x3d007a[_0xe7fe('0x2e')]=_[_0xe7fe('0x2d')](_0x4bb43d['model'],qs['fields'](_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x2f')]));_0x3d007a[_0xe7fe('0x2e')]=_0x3d007a[_0xe7fe('0x2e')][_0xe7fe('0x30')]?_0x3d007a[_0xe7fe('0x2e')]:_0x4bb43d[_0xe7fe('0x28')];if(!_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x31')](_0xe7fe('0x32'))){_0x3d007a[_0xe7fe('0x1a')]=qs[_0xe7fe('0x1a')](_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x1a')]);_0x3d007a[_0xe7fe('0x17')]=qs[_0xe7fe('0x17')](_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x17')]);}_0x3d007a[_0xe7fe('0x33')]=qs['sort'](_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x34')]);_0x3d007a[_0xe7fe('0x35')]=qs[_0xe7fe('0x2c')](_[_0xe7fe('0x36')](_0x4edc15[_0xe7fe('0x2a')],_0x4bb43d[_0xe7fe('0x2c')]),_0x321f63);if(_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x37')]){_0x3d007a[_0xe7fe('0x35')]=_['merge'](_0x3d007a[_0xe7fe('0x35')],{'$or':_[_0xe7fe('0x29')](_0x321f63,function(_0xb10ca0){if(_0xb10ca0['type']!==_0xe7fe('0x38')){var _0x33c96e={};_0x33c96e[_0xb10ca0[_0xe7fe('0x21')]]={'$like':'%'+_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x37')]+'%'};return _0x33c96e;}})});}_0x3d007a=_[_0xe7fe('0x39')]({},_0x3d007a,_0x4edc15['options']);var _0xb02644={'where':_0x3d007a[_0xe7fe('0x35')]};return db['Network'][_0xe7fe('0x19')](_0xb02644)[_0xe7fe('0xa')](function(_0x58c517){_0x35aab3['count']=_0x58c517;if(_0x4edc15[_0xe7fe('0x2a')][_0xe7fe('0x3a')]){_0x3d007a[_0xe7fe('0x3b')]=[{'all':!![]}];}return db[_0xe7fe('0x23')][_0xe7fe('0x3c')](_0x3d007a);})[_0xe7fe('0xa')](function(_0x2fb254){_0x35aab3[_0xe7fe('0x3d')]=_0x2fb254;return _0x35aab3;})[_0xe7fe('0xa')](respondWithFilteredResult(_0xa05105,_0x3d007a))['catch'](handleError(_0xa05105,null));};exports[_0xe7fe('0x3e')]=function(_0x4203e3,_0x2c4201){var _0x25053f={'raw':!![],'where':{'id':_0x4203e3[_0xe7fe('0x3f')]['id']}},_0x37a1d6={};_0x37a1d6[_0xe7fe('0x28')]=_['keys'](db[_0xe7fe('0x23')][_0xe7fe('0x24')]);_0x37a1d6[_0xe7fe('0x2a')]=_['keys'](_0x4203e3['query']);_0x37a1d6[_0xe7fe('0x2c')]=_[_0xe7fe('0x2d')](_0x37a1d6[_0xe7fe('0x28')],_0x37a1d6[_0xe7fe('0x2a')]);_0x25053f[_0xe7fe('0x2e')]=_[_0xe7fe('0x2d')](_0x37a1d6[_0xe7fe('0x28')],qs[_0xe7fe('0x2f')](_0x4203e3[_0xe7fe('0x2a')][_0xe7fe('0x2f')]));_0x25053f[_0xe7fe('0x2e')]=_0x25053f[_0xe7fe('0x2e')][_0xe7fe('0x30')]?_0x25053f[_0xe7fe('0x2e')]:_0x37a1d6[_0xe7fe('0x28')];if(_0x4203e3[_0xe7fe('0x2a')][_0xe7fe('0x3a')]){_0x25053f['include']=[{'all':!![]}];}_0x25053f=_[_0xe7fe('0x39')]({},_0x25053f,_0x4203e3[_0xe7fe('0x40')]);return db['Network'][_0xe7fe('0x41')](_0x25053f)['then'](handleEntityNotFound(_0x2c4201,null))[_0xe7fe('0xa')](respondWithResult(_0x2c4201,null))[_0xe7fe('0x14')](handleError(_0x2c4201,null));};exports[_0xe7fe('0x42')]=function(_0x9aa742,_0x2126f4){var _0x57dc19;return db['Network']['create'](_0x9aa742[_0xe7fe('0x43')],{'raw':!![]})['then'](function(_0x399704){_0x57dc19=_0x399704;return db[_0xe7fe('0x23')][_0xe7fe('0x3c')]({'where':{'type':_0x9aa742[_0xe7fe('0x43')]['type']},'raw':!![]});})['then'](function(_0x3a382c){if(_0x57dc19[_0xe7fe('0x26')][_0xe7fe('0x44')]()==_0xe7fe('0x45')){var _0x4645ac=fs['readFileSync'](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],'server/files/templates/stun_multiple.ejs'),_0xe7fe('0x48'));var _0x5c0e88=ejs[_0xe7fe('0x49')](_0x4645ac,{'networks':_0x3a382c||[]});fs[_0xe7fe('0x4a')](_0xe7fe('0x4b'),_0x5c0e88);return respondWithRpcPromise(_0xe7fe('0x4c'),_0xe7fe('0x42'),{'module':_0xe7fe('0x4d')});}else if(_0x57dc19[_0xe7fe('0x26')][_0xe7fe('0x44')]()==_0xe7fe('0x4e')){var _0x5838d2=fs[_0xe7fe('0x4f')](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],_0xe7fe('0x50')),_0xe7fe('0x48'));var _0x28ce47=ejs[_0xe7fe('0x49')](_0x5838d2,{'networks':_0x3a382c||[]});fs[_0xe7fe('0x4a')](_0xe7fe('0x51'),_0x28ce47);return respondWithRpcPromise(_0xe7fe('0x4c'),_0xe7fe('0x42'),{'module':_0xe7fe('0x4d')});}else{var _0x169af2=fs[_0xe7fe('0x4f')](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],'server/files/templates/network.ejs'),_0xe7fe('0x48'));var _0x2dd820=ejs[_0xe7fe('0x49')](_0x169af2,{'networks':_0x3a382c||[]});fs['writeFileSync'](util[_0xe7fe('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x9aa742[_0xe7fe('0x43')][_0xe7fe('0x26')][_0xe7fe('0x53')]()),_0x2dd820);return respondWithRpcPromise('Reload',_0xe7fe('0x42'),{'module':_0xe7fe('0x54')});}})['then'](function(){return _0x57dc19;})[_0xe7fe('0xa')](respondWithResult(_0x2126f4,0xc9))[_0xe7fe('0x14')](handleError(_0x2126f4,null));};exports[_0xe7fe('0x1d')]=function(_0x29c45b,_0x12c4a3){var _0x5265b0;return db[_0xe7fe('0x23')][_0xe7fe('0x41')]({'where':{'id':_0x29c45b[_0xe7fe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12c4a3,null))['then'](saveUpdates(_0x29c45b[_0xe7fe('0x43')],null))[_0xe7fe('0xa')](function(_0xec2fb9){if(_0xec2fb9){_0x5265b0=_0xec2fb9;return db[_0xe7fe('0x23')][_0xe7fe('0x3c')]({'where':{'type':_0x5265b0[_0xe7fe('0x26')]},'raw':!![]});}return null;})['then'](function(_0x49533f){if(_0x5265b0[_0xe7fe('0x26')][_0xe7fe('0x44')]()=='STUN'){var _0x4afb9a=fs['readFileSync'](path[_0xe7fe('0x46')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe7fe('0x48'));var _0x92f443=ejs[_0xe7fe('0x49')](_0x4afb9a,{'networks':_0x49533f||[]});fs['writeFileSync'](_0xe7fe('0x4b'),_0x92f443);return respondWithRpcPromise(_0xe7fe('0x4c'),_0xe7fe('0x1d'),{'module':_0xe7fe('0x4d')});}else if(_0x5265b0[_0xe7fe('0x26')][_0xe7fe('0x44')]()==_0xe7fe('0x4e')){var _0x29ebd5=fs[_0xe7fe('0x4f')](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],_0xe7fe('0x50')),'utf8');var _0x571be5=ejs[_0xe7fe('0x49')](_0x29ebd5,{'networks':_0x49533f||[]});fs[_0xe7fe('0x4a')](_0xe7fe('0x51'),_0x571be5);return respondWithRpcPromise(_0xe7fe('0x4c'),_0xe7fe('0x1d'),{'module':_0xe7fe('0x4d')});}else{var _0x16b116=fs['readFileSync'](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],_0xe7fe('0x55')),_0xe7fe('0x48'));var _0x2f0dd9=ejs['render'](_0x16b116,{'networks':_0x49533f||[]});fs[_0xe7fe('0x4a')](util[_0xe7fe('0x52')](_0xe7fe('0x56'),_0x29c45b[_0xe7fe('0x43')][_0xe7fe('0x26')]['toLowerCase']()),_0x2f0dd9);return respondWithRpcPromise(_0xe7fe('0x4c'),'update',{'module':_0xe7fe('0x54')});}})[_0xe7fe('0xa')](function(_0x249d7c){if(_0x249d7c){return _0x5265b0;}return null;})[_0xe7fe('0xa')](respondWithResult(_0x12c4a3,null))[_0xe7fe('0x14')](handleError(_0x12c4a3,null));};exports[_0xe7fe('0x1e')]=function(_0x26f11e,_0x3f5da4){var _0x5f5878;return db['Network']['find']({'where':{'id':_0x26f11e[_0xe7fe('0x3f')]['id']}})[_0xe7fe('0xa')](function(_0x2123a7){_0x5f5878=_0x2123a7;return _0x2123a7;})['then'](handleEntityNotFound(_0x3f5da4,null))[_0xe7fe('0xa')](removeEntity(_0x3f5da4,null))[_0xe7fe('0xa')](function(){if(_0x5f5878){return db[_0xe7fe('0x23')][_0xe7fe('0x3c')]({'where':{'type':_0x5f5878[_0xe7fe('0x26')]},'raw':!![]});}})[_0xe7fe('0xa')](function(_0x576d8f){if(_0x5f5878[_0xe7fe('0x26')]['toUpperCase']()==_0xe7fe('0x45')){var _0x160690=fs[_0xe7fe('0x4f')](path[_0xe7fe('0x46')](config[_0xe7fe('0x47')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x38b0dc=ejs['render'](_0x160690,{'networks':_0x576d8f||[]});fs['writeFileSync'](_0xe7fe('0x4b'),_0x38b0dc);return respondWithRpcPromise(_0xe7fe('0x4c'),_0xe7fe('0x1e'),{'module':_0xe7fe('0x4d')});}else if(_0x5f5878['type']['toUpperCase']()=='TURN'){var _0xdd77fa=fs[_0xe7fe('0x4f')](path['join'](config[_0xe7fe('0x47')],_0xe7fe('0x50')),_0xe7fe('0x48'));var _0x1a9d10=ejs[_0xe7fe('0x49')](_0xdd77fa,{'networks':_0x576d8f||[]});fs[_0xe7fe('0x4a')](_0xe7fe('0x51'),_0x1a9d10);return respondWithRpcPromise(_0xe7fe('0x4c'),'destroy',{'module':_0xe7fe('0x4d')});}else{var _0x10f385=fs['readFileSync'](path[_0xe7fe('0x46')](config['root'],_0xe7fe('0x55')),'utf8');var _0xe4aebb=ejs[_0xe7fe('0x49')](_0x10f385,{'networks':_0x576d8f||[]});fs[_0xe7fe('0x4a')](util[_0xe7fe('0x52')](_0xe7fe('0x56'),_0x5f5878[_0xe7fe('0x26')]['toLowerCase']()),_0xe4aebb);return respondWithRpcPromise('Reload',_0xe7fe('0x1e'),{'module':_0xe7fe('0x54')});}})['catch'](handleError(_0x3f5da4,null));}; \ No newline at end of file +var _0x75cf=['pick','filter','where','merge','type','include','rows','show','params','includeAll','options','find','create','findAll','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','status','json','undefined','count','offset','limit','update','destroy','end','sendStatus','name','index','Network','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x27ddff,_0x3adbce){var _0x537313=function(_0x574c50){while(--_0x574c50){_0x27ddff['push'](_0x27ddff['shift']());}};_0x537313(++_0x3adbce);}(_0x75cf,0x1cc));var _0xf75c=function(_0x878790,_0x20cf02){_0x878790=_0x878790-0x0;var _0xa07f7b=_0x75cf[_0x878790];return _0xa07f7b;};'use strict';var util=require(_0xf75c('0x0'));var path=require(_0xf75c('0x1'));var ejs=require(_0xf75c('0x2'));var fs=require('fs');var _=require(_0xf75c('0x3'));var qs=require(_0xf75c('0x4'));var logger=require(_0xf75c('0x5'))(_0xf75c('0x6'));var config=require('../../config/environment');var db=require(_0xf75c('0x7'))['db'];var jayson=require(_0xf75c('0x8'));var client=jayson['client'][_0xf75c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20c400,_0x56e4fe,_0x5783bb,_0x3dae99){return new Promise(function(_0x353908,_0x535b66){var _0x53e85f=_0x3dae99||client;return _0x53e85f[_0xf75c('0xa')](_0x20c400,_0x5783bb)[_0xf75c('0xb')](function(_0x441f0e){logger['info']('Network,\x20%s,\x20%s',_0x56e4fe,_0xf75c('0xc'));logger['debug'](_0xf75c('0xd'),_0x56e4fe,_0xf75c('0xc'),JSON[_0xf75c('0xe')](_0x441f0e));if(_0x441f0e[_0xf75c('0xf')]){if(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x10')]===0x1f4){logger[_0xf75c('0xf')](_0xf75c('0x11'),_0x56e4fe,_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);return _0x535b66(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);}logger[_0xf75c('0xf')](_0xf75c('0x11'),_0x56e4fe,_0x441f0e['error'][_0xf75c('0x12')]);return _0x353908(_0x441f0e[_0xf75c('0xf')][_0xf75c('0x12')]);}else{logger[_0xf75c('0x13')]('Network,\x20%s,\x20%s',_0x56e4fe,'request\x20sent');_0x353908(_0x441f0e[_0xf75c('0x14')][_0xf75c('0x12')]);}})[_0xf75c('0x15')](function(_0x38b611){logger['error'](_0xf75c('0x11'),_0x56e4fe,_0x38b611);_0x535b66(_0x38b611);});});}function respondWithResult(_0x12f7b0,_0x38254){_0x38254=_0x38254||0xc8;return function(_0x16b014){if(_0x16b014){return _0x12f7b0[_0xf75c('0x16')](_0x38254)[_0xf75c('0x17')](_0x16b014);}};}function respondWithFilteredResult(_0x370ea4,_0x19350b){return function(_0x239267){if(_0x239267){var _0x8c2d76=typeof _0x19350b['offset']===_0xf75c('0x18')&&typeof _0x19350b['limit']===_0xf75c('0x18');var _0x5d2f5c=_0x239267[_0xf75c('0x19')];var _0x8dc775=_0x8c2d76?0x0:_0x19350b['offset'];var _0x4259d7=_0x8c2d76?_0x239267[_0xf75c('0x19')]:_0x19350b[_0xf75c('0x1a')]+_0x19350b[_0xf75c('0x1b')];var _0x579664;if(_0x4259d7>=_0x5d2f5c){_0x4259d7=_0x5d2f5c;_0x579664=0xc8;}else{_0x579664=0xce;}_0x370ea4['status'](_0x579664);return _0x370ea4['set']('Content-Range',_0x8dc775+'-'+_0x4259d7+'/'+_0x5d2f5c)[_0xf75c('0x17')](_0x239267);}return null;};}function saveUpdates(_0x56f24b){return function(_0x108a23){if(_0x108a23){return _0x108a23[_0xf75c('0x1c')](_0x56f24b)[_0xf75c('0xb')](function(_0xb04bb3){return _0xb04bb3;});}return null;};}function removeEntity(_0x418d49){return function(_0x39f24c){if(_0x39f24c){return _0x39f24c[_0xf75c('0x1d')]()['then'](function(){_0x418d49[_0xf75c('0x16')](0xcc)[_0xf75c('0x1e')]();});}};}function handleEntityNotFound(_0x49cb0f){return function(_0x1d1e39){if(!_0x1d1e39){_0x49cb0f[_0xf75c('0x1f')](0x194);}return _0x1d1e39;};}function handleError(_0xb76336,_0x2afb04){_0x2afb04=_0x2afb04||0x1f4;return function(_0x21417c){logger[_0xf75c('0xf')](_0x21417c['stack']);if(_0x21417c[_0xf75c('0x20')]){delete _0x21417c['name'];}_0xb76336['status'](_0x2afb04)['send'](_0x21417c);};}exports[_0xf75c('0x21')]=function(_0x87db08,_0xa06f1f){var _0x30582e={},_0x224d45={},_0x1c2077={'count':0x0,'rows':[]};var _0x2ce23c=_['map'](db[_0xf75c('0x22')][_0xf75c('0x23')],function(_0x18a7cc){return{'name':_0x18a7cc[_0xf75c('0x24')],'type':_0x18a7cc['type'][_0xf75c('0x25')]};});_0x224d45[_0xf75c('0x26')]=_[_0xf75c('0x27')](_0x2ce23c,'name');_0x224d45[_0xf75c('0x28')]=_[_0xf75c('0x29')](_0x87db08[_0xf75c('0x28')]);_0x224d45[_0xf75c('0x2a')]=_['intersection'](_0x224d45['model'],_0x224d45[_0xf75c('0x28')]);_0x30582e[_0xf75c('0x2b')]=_[_0xf75c('0x2c')](_0x224d45[_0xf75c('0x26')],qs[_0xf75c('0x2d')](_0x87db08[_0xf75c('0x28')][_0xf75c('0x2d')]));_0x30582e['attributes']=_0x30582e['attributes'][_0xf75c('0x2e')]?_0x30582e[_0xf75c('0x2b')]:_0x224d45[_0xf75c('0x26')];if(!_0x87db08[_0xf75c('0x28')][_0xf75c('0x2f')](_0xf75c('0x30'))){_0x30582e[_0xf75c('0x1b')]=qs['limit'](_0x87db08[_0xf75c('0x28')][_0xf75c('0x1b')]);_0x30582e[_0xf75c('0x1a')]=qs['offset'](_0x87db08['query'][_0xf75c('0x1a')]);}_0x30582e['order']=qs[_0xf75c('0x31')](_0x87db08[_0xf75c('0x28')][_0xf75c('0x31')]);_0x30582e['where']=qs['filters'](_[_0xf75c('0x32')](_0x87db08[_0xf75c('0x28')],_0x224d45[_0xf75c('0x2a')]),_0x2ce23c);if(_0x87db08[_0xf75c('0x28')][_0xf75c('0x33')]){_0x30582e[_0xf75c('0x34')]=_[_0xf75c('0x35')](_0x30582e[_0xf75c('0x34')],{'$or':_[_0xf75c('0x27')](_0x2ce23c,function(_0x5949de){if(_0x5949de[_0xf75c('0x36')]!=='VIRTUAL'){var _0x42ecbc={};_0x42ecbc[_0x5949de[_0xf75c('0x20')]]={'$like':'%'+_0x87db08[_0xf75c('0x28')][_0xf75c('0x33')]+'%'};return _0x42ecbc;}})});}_0x30582e=_[_0xf75c('0x35')]({},_0x30582e,_0x87db08['options']);var _0x51359b={'where':_0x30582e['where']};return db['Network'][_0xf75c('0x19')](_0x51359b)[_0xf75c('0xb')](function(_0x1c379e){_0x1c2077['count']=_0x1c379e;if(_0x87db08[_0xf75c('0x28')]['includeAll']){_0x30582e[_0xf75c('0x37')]=[{'all':!![]}];}return db[_0xf75c('0x22')]['findAll'](_0x30582e);})[_0xf75c('0xb')](function(_0x57d500){_0x1c2077[_0xf75c('0x38')]=_0x57d500;return _0x1c2077;})['then'](respondWithFilteredResult(_0xa06f1f,_0x30582e))[_0xf75c('0x15')](handleError(_0xa06f1f,null));};exports[_0xf75c('0x39')]=function(_0x491c14,_0x4625c2){var _0x47ddb5={'raw':!![],'where':{'id':_0x491c14[_0xf75c('0x3a')]['id']}},_0x1d9744={};_0x1d9744[_0xf75c('0x26')]=_['keys'](db[_0xf75c('0x22')][_0xf75c('0x23')]);_0x1d9744[_0xf75c('0x28')]=_[_0xf75c('0x29')](_0x491c14[_0xf75c('0x28')]);_0x1d9744[_0xf75c('0x2a')]=_[_0xf75c('0x2c')](_0x1d9744['model'],_0x1d9744['query']);_0x47ddb5['attributes']=_[_0xf75c('0x2c')](_0x1d9744[_0xf75c('0x26')],qs[_0xf75c('0x2d')](_0x491c14[_0xf75c('0x28')]['fields']));_0x47ddb5[_0xf75c('0x2b')]=_0x47ddb5[_0xf75c('0x2b')][_0xf75c('0x2e')]?_0x47ddb5[_0xf75c('0x2b')]:_0x1d9744[_0xf75c('0x26')];if(_0x491c14[_0xf75c('0x28')][_0xf75c('0x3b')]){_0x47ddb5[_0xf75c('0x37')]=[{'all':!![]}];}_0x47ddb5=_['merge']({},_0x47ddb5,_0x491c14[_0xf75c('0x3c')]);return db[_0xf75c('0x22')][_0xf75c('0x3d')](_0x47ddb5)['then'](handleEntityNotFound(_0x4625c2,null))['then'](respondWithResult(_0x4625c2,null))[_0xf75c('0x15')](handleError(_0x4625c2,null));};exports[_0xf75c('0x3e')]=function(_0x4b24c6,_0x53b2c8){var _0x7fdd11;return db[_0xf75c('0x22')]['create'](_0x4b24c6['body'],{'raw':!![]})[_0xf75c('0xb')](function(_0x2142ad){_0x7fdd11=_0x2142ad;return db[_0xf75c('0x22')][_0xf75c('0x3f')]({'where':{'type':_0x4b24c6[_0xf75c('0x40')][_0xf75c('0x36')]},'raw':!![]});})[_0xf75c('0xb')](function(_0x3753cc){if(_0x7fdd11['type'][_0xf75c('0x41')]()==_0xf75c('0x42')){var _0x1e66c2=fs[_0xf75c('0x43')](path['join'](config[_0xf75c('0x44')],_0xf75c('0x45')),'utf8');var _0x7ebeac=ejs[_0xf75c('0x46')](_0x1e66c2,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')]('/etc/asterisk/stun_xcally.conf',_0x7ebeac);return respondWithRpcPromise('Reload','create',{'module':_0xf75c('0x48')});}else if(_0x7fdd11[_0xf75c('0x36')][_0xf75c('0x41')]()==_0xf75c('0x49')){var _0x12245a=fs[_0xf75c('0x43')](path['join'](config[_0xf75c('0x44')],_0xf75c('0x4a')),_0xf75c('0x4b'));var _0x48c724=ejs[_0xf75c('0x46')](_0x12245a,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')](_0xf75c('0x4c'),_0x48c724);return respondWithRpcPromise('Reload','create',{'module':_0xf75c('0x48')});}else{var _0x550736=fs['readFileSync'](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4e')),'utf8');var _0x12fa2a=ejs[_0xf75c('0x46')](_0x550736,{'networks':_0x3753cc||[]});fs[_0xf75c('0x47')](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x4b24c6[_0xf75c('0x40')][_0xf75c('0x36')]['toLowerCase']()),_0x12fa2a);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x3e'),{'module':_0xf75c('0x52')});}})[_0xf75c('0xb')](function(){return _0x7fdd11;})[_0xf75c('0xb')](respondWithResult(_0x53b2c8,0xc9))[_0xf75c('0x15')](handleError(_0x53b2c8,null));};exports[_0xf75c('0x1c')]=function(_0x380050,_0x4e3b13){var _0x882148;return db[_0xf75c('0x22')][_0xf75c('0x3d')]({'where':{'id':_0x380050[_0xf75c('0x3a')]['id']}})[_0xf75c('0xb')](handleEntityNotFound(_0x4e3b13,null))[_0xf75c('0xb')](saveUpdates(_0x380050['body'],null))[_0xf75c('0xb')](function(_0x370188){if(_0x370188){_0x882148=_0x370188;return db[_0xf75c('0x22')][_0xf75c('0x3f')]({'where':{'type':_0x882148[_0xf75c('0x36')]},'raw':!![]});}return null;})[_0xf75c('0xb')](function(_0x55219f){if(_0x882148['type']['toUpperCase']()==_0xf75c('0x42')){var _0x4fec25=fs['readFileSync'](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x45')),_0xf75c('0x4b'));var _0x4d43ea=ejs[_0xf75c('0x46')](_0x4fec25,{'networks':_0x55219f||[]});fs[_0xf75c('0x47')]('/etc/asterisk/stun_xcally.conf',_0x4d43ea);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x48')});}else if(_0x882148['type'][_0xf75c('0x41')]()==_0xf75c('0x49')){var _0x20977c=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4a')),'utf8');var _0x15bfbc=ejs[_0xf75c('0x46')](_0x20977c,{'networks':_0x55219f||[]});fs['writeFileSync'](_0xf75c('0x4c'),_0x15bfbc);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x48')});}else{var _0xf23604=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x4e')),_0xf75c('0x4b'));var _0x420dfa=ejs[_0xf75c('0x46')](_0xf23604,{'networks':_0x55219f||[]});fs['writeFileSync'](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x380050[_0xf75c('0x40')][_0xf75c('0x36')]['toLowerCase']()),_0x420dfa);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1c'),{'module':_0xf75c('0x52')});}})[_0xf75c('0xb')](function(_0x38e2cb){if(_0x38e2cb){return _0x882148;}return null;})[_0xf75c('0xb')](respondWithResult(_0x4e3b13,null))[_0xf75c('0x15')](handleError(_0x4e3b13,null));};exports[_0xf75c('0x1d')]=function(_0x559b2e,_0x2b6879){var _0x2d6786;return db[_0xf75c('0x22')]['find']({'where':{'id':_0x559b2e['params']['id']}})['then'](function(_0x4f3e1b){_0x2d6786=_0x4f3e1b;return _0x4f3e1b;})[_0xf75c('0xb')](handleEntityNotFound(_0x2b6879,null))['then'](removeEntity(_0x2b6879,null))[_0xf75c('0xb')](function(){if(_0x2d6786){return db['Network'][_0xf75c('0x3f')]({'where':{'type':_0x2d6786[_0xf75c('0x36')]},'raw':!![]});}})[_0xf75c('0xb')](function(_0x1e4982){if(_0x2d6786[_0xf75c('0x36')][_0xf75c('0x41')]()==_0xf75c('0x42')){var _0x258d64=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x45')),'utf8');var _0x37359d=ejs[_0xf75c('0x46')](_0x258d64,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')](_0xf75c('0x53'),_0x37359d);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1d'),{'module':_0xf75c('0x48')});}else if(_0x2d6786[_0xf75c('0x36')]['toUpperCase']()=='TURN'){var _0x1b016e=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config['root'],_0xf75c('0x4a')),_0xf75c('0x4b'));var _0x38db11=ejs['render'](_0x1b016e,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')]('/etc/asterisk/turn_xcally.conf',_0x38db11);return respondWithRpcPromise('Reload',_0xf75c('0x1d'),{'module':_0xf75c('0x48')});}else{var _0x40c97e=fs[_0xf75c('0x43')](path[_0xf75c('0x4d')](config[_0xf75c('0x44')],_0xf75c('0x4e')),_0xf75c('0x4b'));var _0x1e14ca=ejs[_0xf75c('0x46')](_0x40c97e,{'networks':_0x1e4982||[]});fs[_0xf75c('0x47')](util[_0xf75c('0x4f')](_0xf75c('0x50'),_0x2d6786['type'][_0xf75c('0x54')]()),_0x1e14ca);return respondWithRpcPromise(_0xf75c('0x51'),_0xf75c('0x1d'),{'module':'chan_sip.so'});}})[_0xf75c('0x15')](handleError(_0x2b6879,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f5bc7a3..df6ee20 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 _0x55ea=['./network.attributes','Network','network','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x26531f,_0xfb809){var _0x42d429=function(_0x2e0f09){while(--_0x2e0f09){_0x26531f['push'](_0x26531f['shift']());}};_0x42d429(++_0xfb809);}(_0x55ea,0xc9));var _0xa55e=function(_0x37a364,_0x13d115){_0x37a364=_0x37a364-0x0;var _0x3e7ce0=_0x55ea[_0x37a364];return _0x3e7ce0;};'use strict';var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var logger=require(_0xa55e('0x2'))('api');var moment=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var rp=require(_0xa55e('0x5'));var fs=require('fs');var path=require(_0xa55e('0x6'));var rimraf=require(_0xa55e('0x7'));var config=require('../../config/environment');var attributes=require(_0xa55e('0x8'));module['exports']=function(_0x515646,_0x588751){return _0x515646['define'](_0xa55e('0x9'),attributes,{'tableName':_0xa55e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./network.attributes','Network','network','lodash','util','api','moment','bluebird','path'];(function(_0x2b8aec,_0x1953a8){var _0x4b2e10=function(_0x1efb6b){while(--_0x1efb6b){_0x2b8aec['push'](_0x2b8aec['shift']());}};_0x4b2e10(++_0x1953a8);}(_0xb43b,0x1b2));var _0xbb43=function(_0x329553,_0x156ce7){_0x329553=_0x329553-0x0;var _0x24e79e=_0xb43b[_0x329553];return _0x24e79e;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'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 74578b7..9cced17 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c7ca0,_0x45f6bd){var _0x8cbd5d=function(_0x201974){while(--_0x201974){_0x3c7ca0['push'](_0x3c7ca0['shift']());}};_0x8cbd5d(++_0x45f6bd);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d3b9d,_0x351d0f){var _0x207f62=function(_0x11e5b1){while(--_0x11e5b1){_0x3d3b9d['push'](_0x3d3b9d['shift']());}};_0x207f62(++_0x351d0f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7bd060c..dfdd59a 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 _0xc76c=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','create','post','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeAnswers','removeAgents','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x101a83,_0x554fb9){var _0x14d785=function(_0x326f94){while(--_0x326f94){_0x101a83['push'](_0x101a83['shift']());}};_0x14d785(++_0x554fb9);}(_0xc76c,0xc8));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xcc76('0x0'));var path=require('path');var timeout=require(_0xcc76('0x1'));var express=require('express');var router=express[_0xcc76('0x2')]();var fs_extra=require(_0xcc76('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcc76('0x4'));var config=require(_0xcc76('0x5'));var controller=require(_0xcc76('0x6'));router[_0xcc76('0x7')]('/',auth[_0xcc76('0x8')](),controller['index']);router[_0xcc76('0x7')](_0xcc76('0x9'),auth[_0xcc76('0x8')](),controller[_0xcc76('0xa')]);router[_0xcc76('0x7')](_0xcc76('0xb'),auth[_0xcc76('0x8')](),controller[_0xcc76('0xc')]);router[_0xcc76('0x7')](_0xcc76('0xd'),auth[_0xcc76('0x8')](),controller[_0xcc76('0xe')]);router['get'](_0xcc76('0xf'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x10')]);router['get'](_0xcc76('0x11'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x12')]);router['get'](_0xcc76('0x13'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x14')]);router[_0xcc76('0x7')](_0xcc76('0x15'),auth[_0xcc76('0x8')](),controller['getAgents']);router['post']('/',auth[_0xcc76('0x8')](),controller[_0xcc76('0x16')]);router[_0xcc76('0x17')]('/:id/dispositions',auth[_0xcc76('0x8')](),controller[_0xcc76('0x18')]);router['post']('/:id/canned_answers',auth[_0xcc76('0x8')](),controller[_0xcc76('0x19')]);router[_0xcc76('0x17')](_0xcc76('0x1a'),controller['notify']);router['post'](_0xcc76('0x11'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x1b')]);router['post']('/:id/users',auth[_0xcc76('0x8')](),controller[_0xcc76('0x1c')]);router[_0xcc76('0x17')](_0xcc76('0x1d'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x1e')]);router['put'](_0xcc76('0xb'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x1f')]);router[_0xcc76('0x20')](_0xcc76('0xb'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x21')]);router[_0xcc76('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xcc76('0x20')](_0xcc76('0xf'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x22')]);router[_0xcc76('0x20')](_0xcc76('0x15'),auth[_0xcc76('0x8')](),controller[_0xcc76('0x23')]);module['exports']=router; \ No newline at end of file +var _0xcefe=['create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','getInteractions','/:id/users','getAgents','post'];(function(_0x5da789,_0x12e256){var _0x35495d=function(_0x1869f3){while(--_0x1869f3){_0x5da789['push'](_0x5da789['shift']());}};_0x35495d(++_0x12e256);}(_0xcefe,0xce));var _0xecef=function(_0x2ccfc4,_0x521080){_0x2ccfc4=_0x2ccfc4-0x0;var _0x3e573a=_0xcefe[_0x2ccfc4];return _0x3e573a;};'use strict';var multer=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var path=require(_0xecef('0x2'));var timeout=require('connect-timeout');var express=require(_0xecef('0x3'));var router=express['Router']();var fs_extra=require(_0xecef('0x4'));var auth=require(_0xecef('0x5'));var interaction=require(_0xecef('0x6'));var config=require(_0xecef('0x7'));var controller=require(_0xecef('0x8'));router[_0xecef('0x9')]('/',auth[_0xecef('0xa')](),controller[_0xecef('0xb')]);router[_0xecef('0x9')](_0xecef('0xc'),auth[_0xecef('0xa')](),controller['describe']);router[_0xecef('0x9')]('/:id',auth[_0xecef('0xa')](),controller[_0xecef('0xd')]);router[_0xecef('0x9')](_0xecef('0xe'),auth[_0xecef('0xa')](),controller[_0xecef('0xf')]);router[_0xecef('0x9')](_0xecef('0x10'),auth[_0xecef('0xa')](),controller['getAnswers']);router[_0xecef('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xecef('0x11')]);router[_0xecef('0x9')]('/:id/interactions',auth[_0xecef('0xa')](),controller[_0xecef('0x12')]);router[_0xecef('0x9')](_0xecef('0x13'),auth['isAuthenticated'](),controller[_0xecef('0x14')]);router[_0xecef('0x15')]('/',auth['isAuthenticated'](),controller[_0xecef('0x16')]);router['post'](_0xecef('0xe'),auth[_0xecef('0xa')](),controller[_0xecef('0x17')]);router[_0xecef('0x15')](_0xecef('0x10'),auth['isAuthenticated'](),controller[_0xecef('0x18')]);router['post'](_0xecef('0x19'),controller[_0xecef('0x1a')]);router[_0xecef('0x15')](_0xecef('0x1b'),auth[_0xecef('0xa')](),controller[_0xecef('0x1c')]);router[_0xecef('0x15')]('/:id/users',auth[_0xecef('0xa')](),controller[_0xecef('0x1d')]);router[_0xecef('0x15')](_0xecef('0x1e'),auth[_0xecef('0xa')](),controller[_0xecef('0x1f')]);router['put'](_0xecef('0x20'),auth[_0xecef('0xa')](),controller[_0xecef('0x21')]);router['delete'](_0xecef('0x20'),auth[_0xecef('0xa')](),controller[_0xecef('0x22')]);router[_0xecef('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xecef('0x23')](_0xecef('0x10'),auth[_0xecef('0xa')](),controller['removeAnswers']);router[_0xecef('0x23')]('/:id/users',auth[_0xecef('0xa')](),controller[_0xecef('0x24')]);module[_0xecef('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a337665..8df34ae 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 _0x22aa=['STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x1fe921,_0x13b0a5){var _0x40a50c=function(_0x1c9150){while(--_0x1c9150){_0x1fe921['push'](_0x1fe921['shift']());}};_0x40a50c(++_0x13b0a5);}(_0x22aa,0xeb));var _0xa22a=function(_0x29f8e2,_0x9bbbeb){_0x29f8e2=_0x29f8e2-0x0;var _0x5adf03=_0x22aa[_0x29f8e2];return _0x5adf03;};'use strict';var Sequelize=require(_0xa22a('0x0'));var rs=require(_0xa22a('0x1'));module[_0xa22a('0x2')]={'name':{'type':Sequelize[_0xa22a('0x3')],'unique':_0xa22a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa22a('0x3')]},'token':{'type':Sequelize[_0xa22a('0x3')],'defaultValue':function(){return rs[_0xa22a('0x5')]();}},'replyUri':{'type':Sequelize[_0xa22a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa22a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa22a('0x6')],'defaultValue':function(){return _0xa22a('0x7');}},'notificationSound':{'type':Sequelize[_0xa22a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa22a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa22a('0x3')]},'queueTransfer':{'type':Sequelize[_0xa22a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa22a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa22a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa22a('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xa22a('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa22a('0x8')],'defaultValue':![],'comment':_0xa22a('0xb'),'set':function(_0x51b749){if(!_0x51b749)this[_0xa22a('0xc')]('mandatoryDispositionPauseId',null);this[_0xa22a('0xc')](_0xa22a('0xd'),_0x51b749);}}}; \ No newline at end of file +var _0x3964=['sequelize','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1318e7,_0x21edcc){var _0x664d8f=function(_0x1bb3fa){while(--_0x1bb3fa){_0x1318e7['push'](_0x1318e7['shift']());}};_0x664d8f(++_0x21edcc);}(_0x3964,0x186));var _0x4396=function(_0x159fa3,_0x1af810){_0x159fa3=_0x159fa3-0x0;var _0x296a62=_0x3964[_0x159fa3];return _0x296a62;};'use strict';var Sequelize=require(_0x4396('0x0'));var rs=require('randomstring');module[_0x4396('0x1')]={'name':{'type':Sequelize[_0x4396('0x2')],'unique':_0x4396('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4396('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4396('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4396('0x5');}},'notificationSound':{'type':Sequelize[_0x4396('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4396('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4396('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4396('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4396('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4396('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4396('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x4396('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4396('0x9'),'set':function(_0x550d9c){if(!_0x550d9c)this[_0x4396('0xa')](_0x4396('0xb'),null);this[_0x4396('0xa')](_0x4396('0xc'),_0x550d9c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 13438d5..c8cbf1f 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 _0x06f4=['keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','list','applications','priority','asc','account','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','sendStatus','getApplications','getInteractions','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','query'];(function(_0x52cbec,_0x537390){var _0x5c7d26=function(_0x31cfbb){while(--_0x31cfbb){_0x52cbec['push'](_0x52cbec['shift']());}};_0x5c7d26(++_0x537390);}(_0x06f4,0x136));var _0x406f=function(_0x3674f8,_0x2dc79b){_0x3674f8=_0x3674f8-0x0;var _0x1aac00=_0x06f4[_0x3674f8];return _0x1aac00;};'use strict';var emlformat=require(_0x406f('0x0'));var rimraf=require(_0x406f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x406f('0x2'));var rp=require(_0x406f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x406f('0x4'));var util=require('util');var path=require(_0x406f('0x5'));var sox=require(_0x406f('0x6'));var csv=require(_0x406f('0x7'));var ejs=require(_0x406f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x406f('0x9'));var squel=require('squel');var crypto=require(_0x406f('0xa'));var jsforce=require(_0x406f('0xb'));var deskjs=require(_0x406f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x406f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x406f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x406f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x406f('0x10'))('api');var utils=require(_0x406f('0x11'));var config=require(_0x406f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x406f('0x13'))['db'];config[_0x406f('0x14')]=_[_0x406f('0x15')](config[_0x406f('0x14')],{'host':_0x406f('0x16'),'port':0x18eb});var socket=require(_0x406f('0x17'))(new Redis(config[_0x406f('0x14')]));require(_0x406f('0x18'))[_0x406f('0x19')](socket);var jayson=require(_0x406f('0x1a'));var client=jayson[_0x406f('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x406f('0x1b')][_0x406f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4498d9,_0x5c80af,_0x18ffbb,_0x14b838){return new BPromise(function(_0x4dfbc1,_0x4a4da9){var _0x11c759=_0x14b838||client;return _0x11c759[_0x406f('0x1d')](_0x4498d9,_0x18ffbb)['then'](function(_0x2e4409){logger['info'](_0x406f('0x1e'),_0x5c80af,_0x406f('0x1f'));logger[_0x406f('0x20')](_0x406f('0x21'),_0x5c80af,'request\x20sent',JSON['stringify'](_0x2e4409));if(_0x2e4409[_0x406f('0x22')]){if(_0x2e4409['error'][_0x406f('0x23')]===0x1f4){logger['error'](_0x406f('0x1e'),_0x5c80af,_0x2e4409[_0x406f('0x22')][_0x406f('0x24')]);return _0x4a4da9(_0x2e4409['error']['message']);}logger['error'](_0x406f('0x1e'),_0x5c80af,_0x2e4409[_0x406f('0x22')][_0x406f('0x24')]);return _0x4dfbc1(_0x2e4409['error'][_0x406f('0x24')]);}else{logger['info'](_0x406f('0x1e'),_0x5c80af,_0x406f('0x1f'));_0x4dfbc1(_0x2e4409[_0x406f('0x25')][_0x406f('0x24')]);}})[_0x406f('0x26')](function(_0x51ac15){logger['error'](_0x406f('0x1e'),_0x5c80af,_0x51ac15);_0x4a4da9(_0x51ac15);});});}function respondWithStatusCode(_0x58501f,_0x467a3a){_0x467a3a=_0x467a3a||0xcc;return function(_0xa240d8){if(_0xa240d8){return _0x58501f['sendStatus'](_0x467a3a);}return _0x58501f['status'](_0x467a3a)[_0x406f('0x27')]();};}function respondWithResult(_0x484f7c,_0x377cb9){_0x377cb9=_0x377cb9||0xc8;return function(_0x394430){if(_0x394430){return _0x484f7c[_0x406f('0x28')](_0x377cb9)[_0x406f('0x29')](_0x394430);}};}function respondWithFilteredResult(_0x2c439b,_0x174e47){return function(_0x224bd0){if(_0x224bd0){var _0x2b41dd=typeof _0x174e47['offset']==='undefined'&&typeof _0x174e47[_0x406f('0x2a')]===_0x406f('0x2b');var _0x1ae022=_0x224bd0[_0x406f('0x2c')];var _0x4a60e3=_0x2b41dd?0x0:_0x174e47['offset'];var _0x504ce9=_0x2b41dd?_0x224bd0[_0x406f('0x2c')]:_0x174e47['offset']+_0x174e47['limit'];var _0x4430c5;if(_0x504ce9>=_0x1ae022){_0x504ce9=_0x1ae022;_0x4430c5=0xc8;}else{_0x4430c5=0xce;}_0x2c439b[_0x406f('0x28')](_0x4430c5);return _0x2c439b[_0x406f('0x2d')](_0x406f('0x2e'),_0x4a60e3+'-'+_0x504ce9+'/'+_0x1ae022)[_0x406f('0x29')](_0x224bd0);}return null;};}function patchUpdates(_0x3e0683){return function(_0x1d7230){try{jsonpatch[_0x406f('0x2f')](_0x1d7230,_0x3e0683,!![]);}catch(_0x29360b){return BPromise[_0x406f('0x30')](_0x29360b);}return _0x1d7230[_0x406f('0x31')]();};}function saveUpdates(_0x449c79,_0x23efaa){return function(_0x48bf35){if(_0x48bf35){return _0x48bf35[_0x406f('0x32')](_0x449c79)[_0x406f('0x33')](function(_0x13fb61){return _0x13fb61;});}return null;};}function removeEntity(_0x235c1c,_0x29352b){return function(_0x137f62){if(_0x137f62){return _0x137f62[_0x406f('0x34')]()[_0x406f('0x33')](function(){var _0x3dc67b=_0x137f62[_0x406f('0x35')]({'plain':!![]});var _0x52b465=_0x406f('0x36');return db[_0x406f('0x37')][_0x406f('0x34')]({'where':{'type':_0x52b465,'resourceId':_0x3dc67b['id']}})[_0x406f('0x33')](function(){return _0x137f62;});})[_0x406f('0x33')](function(){_0x235c1c[_0x406f('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f878,_0x44c63a){return function(_0x17af33){if(!_0x17af33){_0x52f878['sendStatus'](0x194);}return _0x17af33;};}function handleError(_0x2b483d,_0x52b737){_0x52b737=_0x52b737||0x1f4;return function(_0x43fb4f){logger[_0x406f('0x22')](_0x43fb4f[_0x406f('0x38')]);if(_0x43fb4f['name']){delete _0x43fb4f[_0x406f('0x39')];}_0x2b483d[_0x406f('0x28')](_0x52b737)[_0x406f('0x3a')](_0x43fb4f);};}exports[_0x406f('0x3b')]=function(_0x224e9d,_0x2666f1){var _0x7bcff3={'include':[{'model':db[_0x406f('0x3c')],'as':_0x406f('0x3d')}]},_0x2547c7={},_0x39122d={'count':0x0,'rows':[]};var _0x37c4d2=_[_0x406f('0x3e')](db[_0x406f('0x3f')][_0x406f('0x40')],function(_0x4cea4a){return{'name':_0x4cea4a['fieldName'],'type':_0x4cea4a['type'][_0x406f('0x41')]};});_0x2547c7[_0x406f('0x42')]=_[_0x406f('0x3e')](_0x37c4d2,'name');_0x2547c7[_0x406f('0x43')]=_[_0x406f('0x44')](_0x224e9d[_0x406f('0x43')]);_0x2547c7[_0x406f('0x45')]=_[_0x406f('0x46')](_0x2547c7[_0x406f('0x42')],_0x2547c7['query']);_0x7bcff3[_0x406f('0x47')]=_[_0x406f('0x46')](_0x2547c7['model'],qs[_0x406f('0x48')](_0x224e9d['query']['fields']));_0x7bcff3[_0x406f('0x47')]=_0x7bcff3[_0x406f('0x47')][_0x406f('0x49')]?_0x7bcff3[_0x406f('0x47')]:_0x2547c7[_0x406f('0x42')];if(!_0x224e9d[_0x406f('0x43')]['hasOwnProperty']('nolimit')){_0x7bcff3[_0x406f('0x2a')]=qs[_0x406f('0x2a')](_0x224e9d[_0x406f('0x43')][_0x406f('0x2a')]);_0x7bcff3[_0x406f('0x4a')]=qs[_0x406f('0x4a')](_0x224e9d[_0x406f('0x43')]['offset']);}_0x7bcff3[_0x406f('0x4b')]=qs[_0x406f('0x4c')](_0x224e9d[_0x406f('0x43')][_0x406f('0x4c')]);_0x7bcff3[_0x406f('0x4d')]=qs[_0x406f('0x45')](_[_0x406f('0x4e')](_0x224e9d[_0x406f('0x43')],_0x2547c7[_0x406f('0x45')]),_0x37c4d2);if(_0x224e9d[_0x406f('0x43')][_0x406f('0x4f')]){_0x7bcff3['where']=_[_0x406f('0x50')](_0x7bcff3[_0x406f('0x4d')],{'$or':_['map'](_0x37c4d2,function(_0x530594){if(_0x530594[_0x406f('0x51')]!==_0x406f('0x52')){var _0x2a13c3={};_0x2a13c3[_0x530594[_0x406f('0x39')]]={'$like':'%'+_0x224e9d['query'][_0x406f('0x4f')]+'%'};return _0x2a13c3;}})});}_0x7bcff3=_['merge']({},_0x7bcff3,_0x224e9d[_0x406f('0x53')]);var _0x351d2f={'where':_0x7bcff3['where']};return db['OpenchannelAccount'][_0x406f('0x2c')](_0x351d2f)[_0x406f('0x33')](function(_0x382482){_0x39122d[_0x406f('0x2c')]=_0x382482;if(_0x224e9d['query'][_0x406f('0x54')]){_0x7bcff3[_0x406f('0x55')]=[{'all':!![]}];}return db[_0x406f('0x3f')][_0x406f('0x56')](_0x7bcff3);})['then'](function(_0x5d4041){_0x39122d[_0x406f('0x57')]=_0x5d4041;return _0x39122d;})[_0x406f('0x33')](respondWithFilteredResult(_0x2666f1,_0x7bcff3))[_0x406f('0x26')](handleError(_0x2666f1,null));};exports[_0x406f('0x58')]=function(_0x2a9a61,_0x50ed52){var _0x2bb232={'raw':![],'where':{'id':_0x2a9a61['params']['id']},'include':[{'model':db['Pause'],'as':_0x406f('0x3d')}]},_0x23026d={};_0x23026d[_0x406f('0x42')]=_[_0x406f('0x44')](db['OpenchannelAccount'][_0x406f('0x40')]);_0x23026d[_0x406f('0x43')]=_[_0x406f('0x44')](_0x2a9a61[_0x406f('0x43')]);_0x23026d[_0x406f('0x45')]=_[_0x406f('0x46')](_0x23026d[_0x406f('0x42')],_0x23026d[_0x406f('0x43')]);_0x2bb232[_0x406f('0x47')]=_['intersection'](_0x23026d['model'],qs[_0x406f('0x48')](_0x2a9a61[_0x406f('0x43')][_0x406f('0x48')]));_0x2bb232[_0x406f('0x47')]=_0x2bb232[_0x406f('0x47')][_0x406f('0x49')]?_0x2bb232[_0x406f('0x47')]:_0x23026d[_0x406f('0x42')];if(_0x2a9a61[_0x406f('0x43')][_0x406f('0x54')]){_0x2bb232['include']=[{'all':!![]}];}_0x2bb232=_['merge']({},_0x2bb232,_0x2a9a61[_0x406f('0x53')]);return db[_0x406f('0x3f')][_0x406f('0x59')](_0x2bb232)[_0x406f('0x33')](handleEntityNotFound(_0x50ed52,null))[_0x406f('0x33')](respondWithResult(_0x50ed52,null))[_0x406f('0x26')](handleError(_0x50ed52,null));};exports['create']=function(_0x1faac1,_0x2b59ae){return db[_0x406f('0x3f')][_0x406f('0x5a')](_0x1faac1[_0x406f('0x5b')],{})[_0x406f('0x33')](function(_0x14d61c){var _0x10db69=_0x1faac1[_0x406f('0x5c')][_0x406f('0x35')]({'plain':!![]});if(!_0x10db69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10db69[_0x406f('0x5d')]===_0x406f('0x5c')){var _0x22e081=_0x14d61c['get']({'plain':!![]});var _0x177c23='OpenchannelAccounts';return db['UserProfileSection'][_0x406f('0x59')]({'where':{'name':_0x177c23,'userProfileId':_0x10db69[_0x406f('0x5e')]},'raw':!![]})['then'](function(_0x30e4eb){if(_0x30e4eb&&_0x30e4eb['autoAssociation']===0x0){return db[_0x406f('0x37')]['create']({'name':_0x22e081[_0x406f('0x39')],'resourceId':_0x22e081['id'],'type':_0x30e4eb['name'],'sectionId':_0x30e4eb['id']},{})[_0x406f('0x33')](function(){return _0x14d61c;});}else{return _0x14d61c;}})[_0x406f('0x26')](function(_0x5cd209){logger['error'](_0x406f('0x5f'),_0x5cd209);throw _0x5cd209;});}return _0x14d61c;})[_0x406f('0x33')](respondWithResult(_0x2b59ae,0xc9))[_0x406f('0x26')](handleError(_0x2b59ae,null));};exports[_0x406f('0x32')]=function(_0x592eb3,_0x1bfcf6){if(_0x592eb3[_0x406f('0x5b')]['id']){delete _0x592eb3[_0x406f('0x5b')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x59')]({'where':{'id':_0x592eb3[_0x406f('0x60')]['id']},'include':[{'model':db[_0x406f('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x406f('0x33')](handleEntityNotFound(_0x1bfcf6,null))['then'](saveUpdates(_0x592eb3[_0x406f('0x5b')],null))[_0x406f('0x33')](respondWithResult(_0x1bfcf6,null))[_0x406f('0x26')](handleError(_0x1bfcf6,null));};exports['destroy']=function(_0x3b2bff,_0x180b82){return db['OpenchannelAccount']['find']({'where':{'id':_0x3b2bff[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x180b82,null))['then'](removeEntity(_0x180b82,null))['catch'](handleError(_0x180b82,null));};exports['describe']=function(_0x1b3935,_0xef3d60){return db[_0x406f('0x3f')]['describe']()['then'](respondWithResult(_0xef3d60,null))[_0x406f('0x26')](handleError(_0xef3d60,null));};exports[_0x406f('0x61')]=function(_0x21a173,_0x35306a,_0x2b97ad){if(_0x21a173['body']['id']){delete _0x21a173[_0x406f('0x5b')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x59')]({'where':{'id':_0x21a173[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x35306a,null))[_0x406f('0x33')](function(_0x62f317){if(_0x62f317){_0x21a173[_0x406f('0x5b')][_0x406f('0x62')]=_0x62f317['id'];return db[_0x406f('0x63')][_0x406f('0x5a')](_0x21a173[_0x406f('0x5b')]);}})[_0x406f('0x33')](respondWithResult(_0x35306a,null))[_0x406f('0x26')](handleError(_0x35306a,null));};exports[_0x406f('0x64')]=function(_0x230267,_0x2cac38,_0x4f6dcf){var _0x1d857a={'raw':![],'where':{}};var _0x13ba46={};var _0x2c7971={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x406f('0x65')]({'where':{'id':_0x230267[_0x406f('0x60')]['id']}})['then'](handleEntityNotFound(_0x2cac38,null))[_0x406f('0x33')](function(_0x5546c0){if(_0x5546c0){_0x13ba46['model']=_[_0x406f('0x44')](db[_0x406f('0x63')]['rawAttributes']);_0x13ba46[_0x406f('0x43')]=_['keys'](_0x230267[_0x406f('0x43')]);_0x13ba46[_0x406f('0x45')]=_[_0x406f('0x46')](_0x13ba46[_0x406f('0x42')],_0x13ba46[_0x406f('0x43')]);_0x1d857a[_0x406f('0x47')]=_[_0x406f('0x46')](_0x13ba46[_0x406f('0x42')],qs[_0x406f('0x48')](_0x230267['query'][_0x406f('0x48')]));_0x1d857a['attributes']=_0x1d857a[_0x406f('0x47')]['length']?_0x1d857a['attributes']:_0x13ba46['model'];if(!_0x230267[_0x406f('0x43')][_0x406f('0x66')](_0x406f('0x67'))){_0x1d857a[_0x406f('0x2a')]=qs[_0x406f('0x2a')](_0x230267['query']['limit']);_0x1d857a['offset']=qs[_0x406f('0x4a')](_0x230267['query'][_0x406f('0x4a')]);}_0x1d857a[_0x406f('0x4b')]=qs[_0x406f('0x4c')](_0x230267[_0x406f('0x43')][_0x406f('0x4c')]);_0x1d857a[_0x406f('0x4d')]=qs['filters'](_['pick'](_0x230267[_0x406f('0x43')],_0x13ba46[_0x406f('0x45')]));_0x1d857a[_0x406f('0x4d')]['OpenchannelAccountId']=_0x5546c0['id'];if(_0x230267[_0x406f('0x43')][_0x406f('0x4f')]){_0x1d857a[_0x406f('0x4d')]=_[_0x406f('0x50')](_0x1d857a[_0x406f('0x4d')],{'$or':_['map'](_0x1d857a[_0x406f('0x47')],function(_0x427269){var _0x67200a={};_0x67200a[_0x427269]={'$like':'%'+_0x230267[_0x406f('0x43')][_0x406f('0x4f')]+'%'};return _0x67200a;})});}_0x1d857a=_[_0x406f('0x50')]({},_0x1d857a,_0x230267[_0x406f('0x53')]);return db[_0x406f('0x63')]['count']({'where':_0x1d857a['where']})['then'](function(_0x1fec4c){_0x2c7971['count']=_0x1fec4c;if(_0x230267['query'][_0x406f('0x54')]){_0x1d857a[_0x406f('0x55')]=[{'all':!![]}];}return db[_0x406f('0x63')][_0x406f('0x56')](_0x1d857a);})[_0x406f('0x33')](function(_0x55ddec){_0x2c7971['rows']=_0x55ddec;return _0x2c7971;});}})[_0x406f('0x33')](respondWithFilteredResult(_0x2cac38,_0x1d857a))[_0x406f('0x26')](handleError(_0x2cac38,null));};exports['removeDispositions']=function(_0x3acdf3,_0x4fbc53,_0x101b16){return db[_0x406f('0x3f')]['find']({'where':{'id':_0x3acdf3[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x4fbc53,null))[_0x406f('0x33')](function(_0x1168bc){if(_0x1168bc){return _0x1168bc[_0x406f('0x68')](_0x3acdf3[_0x406f('0x43')][_0x406f('0x69')]);}})[_0x406f('0x33')](respondWithStatusCode(_0x4fbc53,null))[_0x406f('0x26')](handleError(_0x4fbc53,null));};exports[_0x406f('0x6a')]=function(_0x5469b5,_0x5c08c1,_0x35968c){if(_0x5469b5[_0x406f('0x5b')]['id']){delete _0x5469b5[_0x406f('0x5b')]['id'];}return db[_0x406f('0x3f')][_0x406f('0x59')]({'where':{'id':_0x5469b5[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x5c08c1,null))[_0x406f('0x33')](function(_0x22373b){if(_0x22373b){_0x5469b5['body'][_0x406f('0x62')]=_0x22373b['id'];return db[_0x406f('0x6b')]['create'](_0x5469b5[_0x406f('0x5b')]);}})[_0x406f('0x33')](respondWithResult(_0x5c08c1,null))[_0x406f('0x26')](handleError(_0x5c08c1,null));};exports[_0x406f('0x6c')]=function(_0xf03d5f,_0x2178ac,_0x53075b){var _0x2e4663={'raw':![],'where':{}};var _0x25673e={};var _0x5f3e2e={'count':0x0,'rows':[]};return db[_0x406f('0x3f')]['findOne']({'where':{'id':_0xf03d5f[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x2178ac,null))[_0x406f('0x33')](function(_0x24f19f){if(_0x24f19f){_0x25673e[_0x406f('0x42')]=_[_0x406f('0x44')](db[_0x406f('0x6b')][_0x406f('0x40')]);_0x25673e['query']=_[_0x406f('0x44')](_0xf03d5f[_0x406f('0x43')]);_0x25673e['filters']=_[_0x406f('0x46')](_0x25673e['model'],_0x25673e[_0x406f('0x43')]);_0x2e4663['attributes']=_[_0x406f('0x46')](_0x25673e[_0x406f('0x42')],qs[_0x406f('0x48')](_0xf03d5f[_0x406f('0x43')]['fields']));_0x2e4663[_0x406f('0x47')]=_0x2e4663[_0x406f('0x47')][_0x406f('0x49')]?_0x2e4663[_0x406f('0x47')]:_0x25673e[_0x406f('0x42')];if(!_0xf03d5f['query'][_0x406f('0x66')](_0x406f('0x67'))){_0x2e4663[_0x406f('0x2a')]=qs['limit'](_0xf03d5f[_0x406f('0x43')][_0x406f('0x2a')]);_0x2e4663['offset']=qs['offset'](_0xf03d5f[_0x406f('0x43')][_0x406f('0x4a')]);}_0x2e4663[_0x406f('0x4b')]=qs[_0x406f('0x4c')](_0xf03d5f[_0x406f('0x43')][_0x406f('0x4c')]);_0x2e4663[_0x406f('0x4d')]=qs['filters'](_[_0x406f('0x4e')](_0xf03d5f[_0x406f('0x43')],_0x25673e[_0x406f('0x45')]));_0x2e4663[_0x406f('0x4d')][_0x406f('0x62')]=_0x24f19f['id'];if(_0xf03d5f[_0x406f('0x43')]['filter']){_0x2e4663[_0x406f('0x4d')]=_[_0x406f('0x50')](_0x2e4663[_0x406f('0x4d')],{'$or':_[_0x406f('0x3e')](_0x2e4663[_0x406f('0x47')],function(_0x205c23){var _0x187608={};_0x187608[_0x205c23]={'$like':'%'+_0xf03d5f[_0x406f('0x43')]['filter']+'%'};return _0x187608;})});}_0x2e4663=_[_0x406f('0x50')]({},_0x2e4663,_0xf03d5f[_0x406f('0x53')]);return db[_0x406f('0x6b')][_0x406f('0x2c')]({'where':_0x2e4663['where']})[_0x406f('0x33')](function(_0x593860){_0x5f3e2e['count']=_0x593860;if(_0xf03d5f[_0x406f('0x43')][_0x406f('0x54')]){_0x2e4663[_0x406f('0x55')]=[{'all':!![]}];}return db[_0x406f('0x6b')][_0x406f('0x56')](_0x2e4663);})['then'](function(_0x3ccf6e){_0x5f3e2e['rows']=_0x3ccf6e;return _0x5f3e2e;});}})['then'](respondWithFilteredResult(_0x2178ac,_0x2e4663))[_0x406f('0x26')](handleError(_0x2178ac,null));};exports['removeAnswers']=function(_0x22dbda,_0x169e25,_0x38dc34){return db['OpenchannelAccount']['find']({'where':{'id':_0x22dbda[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x169e25,null))['then'](function(_0x7109bc){if(_0x7109bc){return _0x7109bc['removeAnswers'](_0x22dbda['query'][_0x406f('0x69')]);}})['then'](respondWithStatusCode(_0x169e25,null))[_0x406f('0x26')](handleError(_0x169e25,null));};exports[_0x406f('0x6d')]=function(_0x35d17d,_0x708018,_0x27e063){var _0xad33fc={'body':_0x35d17d[_0x406f('0x5b')],'channel':_0x406f('0x6e')};var _0x2cbc99=[];var _0x5acfca=[];var _0x3ed48a={};var _0x133504=![];return db[_0x406f('0x6f')][_0x406f('0x70')]()[_0x406f('0x33')](function(_0x12f400){if(!_0x12f400){throw new db[(_0x406f('0x71'))][(_0x406f('0x72'))](_0x406f('0x73'));}_0x2cbc99=_[_0x406f('0x74')](_['keys'](_0x12f400),['createdAt',_0x406f('0x75')]);_0x5acfca=_[_0x406f('0x74')](_[_0x406f('0x44')](_0x12f400),[_0x406f('0x76'),_0x406f('0x75'),_0x406f('0x77'),_0x406f('0x78')]);if(_0x35d17d['body']['id']){delete _0x35d17d['body']['id'];}if(_['isNil'](_0x35d17d[_0x406f('0x5b')][_0x406f('0x79')])){throw new db[(_0x406f('0x71'))][(_0x406f('0x72'))](_0x406f('0x7a'));}if(_[_0x406f('0x7b')](_0x35d17d[_0x406f('0x5b')][_0x406f('0x5b')])||_0x35d17d[_0x406f('0x5b')][_0x406f('0x5b')]===''){throw new db[(_0x406f('0x71'))][(_0x406f('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x406f('0x7b')](_0x35d17d['body'][_0x406f('0x7c')])){throw new db['Sequelize'][(_0x406f('0x72'))](_0x406f('0x7d')+_0x5acfca);}if(!_[_0x406f('0x7e')](_0x5acfca,_0x35d17d[_0x406f('0x5b')][_0x406f('0x7c')])){throw new db[(_0x406f('0x71'))][(_0x406f('0x72'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5acfca);}_0x3ed48a[_0x35d17d[_0x406f('0x5b')][_0x406f('0x7c')]]=_0x35d17d['body'][_0x406f('0x79')];})[_0x406f('0x33')](function(){return db[_0x406f('0x3f')][_0x406f('0x59')]({'where':{'id':_0x35d17d['params']['id']},'include':[{'model':db[_0x406f('0x7f')],'as':_0x406f('0x80'),'include':[{'model':db[_0x406f('0x6f')],'as':'Contacts','where':_0x3ed48a,'limit':0x1,'order':[[_0x406f('0x75'),_0x406f('0x81')]]}]},{'model':db[_0x406f('0x82')],'as':_0x406f('0x83')}]});})[_0x406f('0x33')](handleEntityNotFound(_0x708018,null))[_0x406f('0x33')](function(_0xdd7590){if(_0xdd7590&&_0xdd7590[_0x406f('0x80')]){_0xad33fc['account']=_0xdd7590;_0xad33fc['applications']=_0xdd7590[_0x406f('0x83')];_0xad33fc[_0x406f('0x84')]=_0xdd7590[_0x406f('0x80')];_0xad33fc[_0x406f('0x85')]=_['orderBy'](_0xad33fc[_0x406f('0x85')],[_0x406f('0x86')],[_0x406f('0x87')]);if(_0xad33fc[_0x406f('0x88')][_0x406f('0x83')]){delete _0xad33fc[_0x406f('0x88')][_0x406f('0x83')];}if(_0xad33fc[_0x406f('0x88')][_0x406f('0x80')]&&_0xad33fc['account'][_0x406f('0x80')][_0x406f('0x89')][_0x406f('0x49')]){return _0xad33fc[_0x406f('0x88')][_0x406f('0x80')][_0x406f('0x89')][0x0];}var _0x3194bb=_[_0x406f('0x15')](_0x35d17d[_0x406f('0x5b')],{'firstName':_0x35d17d['body'][_0x406f('0x79')],'ListId':_0xdd7590['ListId']});_0x3194bb[_0x35d17d[_0x406f('0x5b')][_0x406f('0x7c')]]=_0x35d17d[_0x406f('0x5b')][_0x406f('0x79')];return db[_0x406f('0x6f')][_0x406f('0x5a')](_0x3194bb,{'fields':_0x2cbc99,'raw':!![]});}})['then'](handleEntityNotFound(_0x708018,null))[_0x406f('0x33')](function(_0x422adc){_0xad33fc[_0x406f('0x8a')]=_0x422adc;if(_0x422adc){var _0x4798fa={'ContactId':_0x422adc['id'],'OpenchannelAccountId':_0x35d17d[_0x406f('0x60')]['id'],'from':(_0x422adc[_0x406f('0x8b')]||'')+'\x20'+(_0x422adc[_0x406f('0x8c')]||'')};var _0x29b0ad={'OpenchannelAccountId':_0x35d17d[_0x406f('0x60')]['id'],'closed':![]};if(_0x35d17d[_0x406f('0x5b')][_0x406f('0x8d')]){_0x29b0ad[_0x406f('0x8d')]=_0x35d17d[_0x406f('0x5b')][_0x406f('0x8d')];return db[_0x406f('0x8e')][_0x406f('0x59')]({'where':_0x29b0ad})[_0x406f('0x33')](function(_0x4b4bc8){if(_0x4b4bc8){return[_0x4b4bc8,![]];}_0x4798fa['threadId']=_0x35d17d[_0x406f('0x5b')][_0x406f('0x8d')];_0x4798fa[_0x406f('0x8f')]=_0x35d17d[_0x406f('0x5b')][_0x406f('0x8f')];return db['OpenchannelInteraction'][_0x406f('0x5a')](_0x4798fa)[_0x406f('0x33')](function(_0x5be2e9){return[_0x5be2e9,!![]];});});}else{_0x29b0ad[_0x406f('0x8d')]=null;}_0x29b0ad[_0x406f('0x90')]=_0x422adc['id'];return db[_0x406f('0x8e')][_0x406f('0x59')]({'where':_0x29b0ad})[_0x406f('0x33')](function(_0xcbf70d){if(_0xcbf70d){return[_0xcbf70d,![]];}return db['OpenchannelInteraction'][_0x406f('0x5a')](_0x4798fa)[_0x406f('0x33')](function(_0x55b3a7){return[_0x55b3a7,!![]];});});}})[_0x406f('0x91')](function(_0x3653df,_0x2394c2){if(_0x3653df){_0x133504=_0x2394c2;if(!_0x2394c2){var _0x3aaa13={'from':(_0xad33fc[_0x406f('0x8a')]['firstName']||'')+'\x20'+(_0xad33fc[_0x406f('0x8a')][_0x406f('0x8c')]||'')};if(_0x35d17d[_0x406f('0x5b')]['threadId']&&_0x35d17d['body'][_0x406f('0x92')]&&_0x35d17d[_0x406f('0x5b')][_0x406f('0x8d')]!=_0x35d17d[_0x406f('0x5b')][_0x406f('0x92')]){_0x3aaa13['threadId']=_0x35d17d['body']['messageId'];}return _0x3653df['update'](_0x3aaa13);}else{return _0x3653df;}}})[_0x406f('0x33')](function(_0x48f755){_0xad33fc[_0x406f('0x93')]=_0x48f755[_0x406f('0x35')]({'plain':!![]});_0xad33fc[_0x406f('0x93')]['created']=_0x133504;if(_0xad33fc[_0x406f('0x93')][_0x406f('0x94')]){if(_0xad33fc[_0x406f('0x88')]['autoclose']){_0xad33fc[_0x406f('0x85')][_0x406f('0x95')]({'id':0x0,'priority':_0xad33fc[_0x406f('0x85')]['length']+0x1,'app':_0x406f('0x96'),'appdata':'unmanaged','interval':_0x406f('0x97')});}}return db['OpenchannelMessage'][_0x406f('0x5a')]({'body':_0x35d17d[_0x406f('0x5b')][_0x406f('0x5b')],'OpenchannelAccountId':_0x35d17d[_0x406f('0x60')]['id'],'OpenchannelInteractionId':_0x48f755['id'],'direction':'in','ContactId':_0xad33fc[_0x406f('0x8a')]['id'],'AttachmentId':_0x35d17d[_0x406f('0x5b')][_0x406f('0x98')]});})[_0x406f('0x33')](function(_0xd8ffc1){_0xad33fc[_0x406f('0x24')]=_0xd8ffc1;if(!_0xad33fc[_0x406f('0x93')][_0x406f('0x99')])return;return db[_0x406f('0x9a')][_0x406f('0x59')]({'attributes':['id',_0x406f('0x39')],'where':{'id':_0xad33fc['interaction']['UserId']}});})[_0x406f('0x33')](function(_0x34baa7){if(_0x34baa7){_0xad33fc[_0x406f('0x85')][_0x406f('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x34baa7[_0x406f('0x39')]+','+(_0xad33fc[_0x406f('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x406f('0x97')});}if(!_0xad33fc[_0x406f('0x93')][_0x406f('0x9c')])return;return db[_0x406f('0x9d')]['find']({'attributes':['id',_0x406f('0x39')],'where':{'id':_0xad33fc[_0x406f('0x93')]['queueId']}});})['then'](function(_0x6ab589){if(_0x6ab589){_0xad33fc[_0x406f('0x85')][_0x406f('0x9b')]({'id':0x0,'priority':0x1,'app':_0x406f('0x9e'),'appdata':_0x6ab589[_0x406f('0x39')]+','+(_0xad33fc[_0x406f('0x88')][_0x406f('0x9f')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x406f('0xa0'),'startRouting',_0xad33fc);})['then'](function(_0x3cd8e7){respondWithRpcPromise(_0x406f('0xa1'),_0x406f('0xa1'),{'event':_0x406f('0x6d'),'message':_0x3cd8e7},client9002);return _0x3cd8e7;})[_0x406f('0x33')](respondWithResult(_0x708018,null))[_0x406f('0x26')](handleError(_0x708018,null));};exports[_0x406f('0xa2')]=function(_0x35822c,_0x41feb2){var _0x1439d8=_0x35822c['params']['id'];var _0x4a30eb=_0x35822c[_0x406f('0x5b')];var _0x2e0169=0xc8;var _0x297fa6=null;return db['sequelize'][_0x406f('0xa3')]({'isolationLevel':db['sequelize'][_0x406f('0xa4')][_0x406f('0xa5')][_0x406f('0xa6')]},function(_0x19d92f){return db[_0x406f('0x3f')]['findOne']({'where':{'id':_0x1439d8},'transaction':_0x19d92f})['then'](function(_0x2b2fc3){if(_0x2b2fc3){return db[_0x406f('0x82')][_0x406f('0x34')]({'where':{'OpenchannelAccountId':_0x1439d8},'transaction':_0x19d92f})['then'](function(){var _0x3acbd5=_['map'](_0x4a30eb,function(_0x3c3f76){_0x3c3f76[_0x406f('0x62')]=_0x1439d8;return _0x3c3f76;});return db['OpenchannelApplication'][_0x406f('0xa7')](_0x3acbd5,{'transaction':_0x19d92f});});}else{_0x2e0169=0x194;_0x297fa6=[];}});})[_0x406f('0x33')](function(){if(_0x2e0169!==0x194){return db[_0x406f('0x82')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1439d8},'order':_0x406f('0x86')})['then'](function(_0x4fba49){_0x297fa6=_0x4fba49;});}})[_0x406f('0x26')](function(_0x3eabdd){_0x2e0169=0x1f4;logger[_0x406f('0x22')](_0x3eabdd[_0x406f('0x38')]);if(_0x3eabdd[_0x406f('0x39')]){delete _0x3eabdd['name'];}_0x297fa6=_0x3eabdd;})[_0x406f('0xa8')](function(){if(_0x297fa6===null){_0x41feb2[_0x406f('0xa9')](_0x2e0169);}else{if(_0x2e0169===0x1f4){_0x41feb2[_0x406f('0x28')](_0x2e0169)[_0x406f('0x3a')](_0x297fa6);}else{_0x41feb2[_0x406f('0x28')](_0x2e0169)[_0x406f('0x29')](_0x297fa6);}}});};exports[_0x406f('0xaa')]=function(_0xf6e4b1,_0x43488f,_0x3ce235){var _0x2a1262={};var _0x2e154b={};var _0x4355a0;var _0x256d0e;return db[_0x406f('0x3f')][_0x406f('0x65')]({'where':{'id':_0xf6e4b1[_0x406f('0x60')]['id']}})['then'](handleEntityNotFound(_0x43488f,null))[_0x406f('0x33')](function(_0x33fe37){if(_0x33fe37){_0x4355a0=_0x33fe37;_0x2e154b[_0x406f('0x42')]=_[_0x406f('0x44')](db[_0x406f('0x82')][_0x406f('0x40')]);_0x2e154b[_0x406f('0x43')]=_[_0x406f('0x44')](_0xf6e4b1['query']);_0x2e154b[_0x406f('0x45')]=_[_0x406f('0x46')](_0x2e154b['model'],_0x2e154b[_0x406f('0x43')]);_0x2a1262['attributes']=_[_0x406f('0x46')](_0x2e154b['model'],qs['fields'](_0xf6e4b1[_0x406f('0x43')][_0x406f('0x48')]));_0x2a1262[_0x406f('0x47')]=_0x2a1262['attributes'][_0x406f('0x49')]?_0x2a1262[_0x406f('0x47')]:_0x2e154b['model'];_0x2a1262[_0x406f('0x4b')]=qs[_0x406f('0x4c')](_0xf6e4b1['query'][_0x406f('0x4c')]);_0x2a1262[_0x406f('0x4d')]=qs[_0x406f('0x45')](_[_0x406f('0x4e')](_0xf6e4b1['query'],_0x2e154b['filters']));if(_0xf6e4b1['query'][_0x406f('0x4f')]){_0x2a1262['where']=_[_0x406f('0x50')](_0x2a1262[_0x406f('0x4d')],{'$or':_['map'](_0x2a1262['attributes'],function(_0x59ac33){var _0x34f36d={};_0x34f36d[_0x59ac33]={'$like':'%'+_0xf6e4b1[_0x406f('0x43')][_0x406f('0x4f')]+'%'};return _0x34f36d;})});}_0x2a1262=_['merge']({},_0x2a1262,_0xf6e4b1[_0x406f('0x53')]);return _0x4355a0[_0x406f('0xaa')](_0x2a1262);}})[_0x406f('0x33')](function(_0x416ea4){if(_0x416ea4){_0x256d0e=_0x416ea4['length'];if(!_0xf6e4b1[_0x406f('0x43')][_0x406f('0x66')](_0x406f('0x67'))){_0x2a1262[_0x406f('0x2a')]=qs[_0x406f('0x2a')](_0xf6e4b1[_0x406f('0x43')][_0x406f('0x2a')]);_0x2a1262[_0x406f('0x4a')]=qs['offset'](_0xf6e4b1[_0x406f('0x43')][_0x406f('0x4a')]);}return _0x4355a0[_0x406f('0xaa')](_0x2a1262);}})[_0x406f('0x33')](function(_0x19fb37){if(_0x19fb37){return _0x19fb37?{'count':_0x256d0e,'rows':_0x19fb37}:null;}})['then'](respondWithResult(_0x43488f,null))[_0x406f('0x26')](handleError(_0x43488f,null));};exports[_0x406f('0xab')]=function(_0x2bb202,_0x5ef5fb,_0x253c2e){var _0x44c61e={'raw':![],'where':{}};var _0x5d873d={};var _0x172e9f={'count':0x0,'rows':[]};return db[_0x406f('0x3f')][_0x406f('0x65')]({'where':{'id':_0x2bb202[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x5ef5fb,null))[_0x406f('0x33')](function(_0x3f0439){if(_0x3f0439){_0x5d873d['model']=_[_0x406f('0x44')](db[_0x406f('0x8e')]['rawAttributes']);_0x5d873d[_0x406f('0x43')]=_[_0x406f('0x44')](_0x2bb202['query']);_0x5d873d[_0x406f('0x45')]=_[_0x406f('0x46')](_0x5d873d[_0x406f('0x42')],_0x5d873d[_0x406f('0x43')]);_0x44c61e[_0x406f('0x47')]=_[_0x406f('0x46')](_0x5d873d['model'],qs[_0x406f('0x48')](_0x2bb202[_0x406f('0x43')][_0x406f('0x48')]));_0x44c61e[_0x406f('0x47')]=_0x44c61e[_0x406f('0x47')][_0x406f('0x49')]?_0x44c61e[_0x406f('0x47')]:_0x5d873d['model'];if(!_0x2bb202[_0x406f('0x43')][_0x406f('0x66')](_0x406f('0x67'))){_0x44c61e['limit']=qs['limit'](_0x2bb202[_0x406f('0x43')][_0x406f('0x2a')]);_0x44c61e[_0x406f('0x4a')]=qs[_0x406f('0x4a')](_0x2bb202[_0x406f('0x43')][_0x406f('0x4a')]);}_0x44c61e['order']=qs[_0x406f('0x4c')](_0x2bb202[_0x406f('0x43')]['sort']);_0x44c61e['where']=qs[_0x406f('0x45')](_[_0x406f('0x4e')](_0x2bb202[_0x406f('0x43')],_0x5d873d[_0x406f('0x45')]));_0x44c61e[_0x406f('0x4d')][_0x406f('0x62')]=_0x3f0439['id'];if(_0x2bb202['query'][_0x406f('0x4f')]){_0x44c61e['where']=_['merge'](_0x44c61e['where'],{'$or':_['map'](_0x44c61e[_0x406f('0x47')],function(_0x4f5afb){var _0x3219c1={};_0x3219c1[_0x4f5afb]={'$like':'%'+_0x2bb202[_0x406f('0x43')][_0x406f('0x4f')]+'%'};return _0x3219c1;})});}_0x44c61e=_[_0x406f('0x50')]({},_0x44c61e,_0x2bb202[_0x406f('0x53')]);return db[_0x406f('0x8e')][_0x406f('0x2c')]({'where':_0x44c61e[_0x406f('0x4d')]})[_0x406f('0x33')](function(_0x5ee4db){_0x172e9f[_0x406f('0x2c')]=_0x5ee4db;if(_0x2bb202[_0x406f('0x43')][_0x406f('0x54')]){_0x44c61e[_0x406f('0x55')]=[{'model':db[_0x406f('0x6f')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x406f('0x39'),_0x406f('0xac'),_0x406f('0xad')],'required':![]},{'model':db[_0x406f('0xae')],'as':'Tags','attributes':['id',_0x406f('0x39'),_0x406f('0xaf')],'where':_0x2bb202['query'][_0x406f('0xb0')]?{'id':_0x2bb202['query'][_0x406f('0xb0')]}:undefined,'required':_0x2bb202[_0x406f('0x43')][_0x406f('0xb0')]?!![]:![]}];}return db[_0x406f('0x8e')]['findAll'](_0x44c61e);})[_0x406f('0x33')](function(_0x5e11be){_0x172e9f[_0x406f('0x57')]=_0x5e11be;return _0x172e9f;});}})['then'](respondWithFilteredResult(_0x5ef5fb,_0x44c61e))[_0x406f('0x26')](handleError(_0x5ef5fb,null));};exports[_0x406f('0xb1')]=function(_0x429648,_0xcb9a47,_0x3f9440){return db['OpenchannelAccount'][_0x406f('0x59')]({'where':{'id':_0x429648[_0x406f('0x60')]['id']}})['then'](handleEntityNotFound(_0xcb9a47,null))['then'](function(_0x20231a){if(_0x20231a){return _0x20231a['addAgents'](_0x429648[_0x406f('0x5b')][_0x406f('0x69')],_[_0x406f('0xb2')](_0x429648['body'],['ids','id'])||{})['spread'](function(_0x2cb282){for(var _0x5285f5=0x0;_0x5285f5<_0x429648[_0x406f('0x5b')][_0x406f('0x69')][_0x406f('0x49')];_0x5285f5+=0x1){socket[_0x406f('0xb3')]('userOpenchannelAccount:save',{'UserId':Number(_0x429648[_0x406f('0x5b')][_0x406f('0x69')][_0x5285f5]),'OpenchannelAccountId':Number(_0x429648[_0x406f('0x60')]['id'])});}return _0x2cb282;});}})[_0x406f('0x33')](respondWithResult(_0xcb9a47,null))[_0x406f('0x26')](handleError(_0xcb9a47,null));};exports[_0x406f('0xb4')]=function(_0x10c8b7,_0x448931,_0x3cda11){return db['OpenchannelAccount'][_0x406f('0x59')]({'where':{'id':_0x10c8b7[_0x406f('0x60')]['id']}})['then'](handleEntityNotFound(_0x448931,null))[_0x406f('0x33')](function(_0xdbc031){if(_0xdbc031){return _0xdbc031['removeAgents'](_0x10c8b7[_0x406f('0x43')][_0x406f('0x69')])['then'](function(){if(_[_0x406f('0xb5')](_0x10c8b7[_0x406f('0x43')]['ids'])){for(var _0x450fc5=0x0;_0x450fc5<_0x10c8b7['query'][_0x406f('0x69')][_0x406f('0x49')];_0x450fc5+=0x1){socket[_0x406f('0xb3')](_0x406f('0xb6'),{'UserId':Number(_0x10c8b7['query'][_0x406f('0x69')][_0x450fc5]),'OpenchannelAccountId':Number(_0x10c8b7[_0x406f('0x60')]['id'])});}}else{socket[_0x406f('0xb3')](_0x406f('0xb6'),{'UserId':Number(_0x10c8b7[_0x406f('0x43')][_0x406f('0x69')]),'OpenchannelAccountId':Number(_0x10c8b7[_0x406f('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x448931,null))['catch'](handleError(_0x448931,null));};exports['getAgents']=function(_0x3b4467,_0x1a5725,_0x2502dd){var _0x3625de={};var _0xc87f82={};var _0x380675;var _0x4d0170;return db[_0x406f('0x3f')][_0x406f('0x65')]({'where':{'id':_0x3b4467[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x1a5725,null))[_0x406f('0x33')](function(_0x992bcd){if(_0x992bcd){_0x380675=_0x992bcd;_0xc87f82['model']=_[_0x406f('0x44')](db[_0x406f('0x9a')][_0x406f('0x40')]);_0xc87f82[_0x406f('0x43')]=_[_0x406f('0x44')](_0x3b4467[_0x406f('0x43')]);_0xc87f82['filters']=_[_0x406f('0x46')](_0xc87f82['model'],_0xc87f82['query']);_0x3625de[_0x406f('0x47')]=_[_0x406f('0x46')](_0xc87f82[_0x406f('0x42')],qs[_0x406f('0x48')](_0x3b4467[_0x406f('0x43')][_0x406f('0x48')]));_0x3625de['attributes']=_0x3625de[_0x406f('0x47')]['length']?_0x3625de['attributes']:_0xc87f82['model'];_0x3625de[_0x406f('0x4b')]=qs['sort'](_0x3b4467[_0x406f('0x43')][_0x406f('0x4c')]);_0x3625de[_0x406f('0x4d')]=qs['filters'](_[_0x406f('0x4e')](_0x3b4467[_0x406f('0x43')],_0xc87f82[_0x406f('0x45')]));if(_0x3b4467[_0x406f('0x43')]['filter']){_0x3625de[_0x406f('0x4d')]=_[_0x406f('0x50')](_0x3625de[_0x406f('0x4d')],{'$or':_[_0x406f('0x3e')](_0x3625de[_0x406f('0x47')],function(_0x53f036){var _0x295828={};_0x295828[_0x53f036]={'$like':'%'+_0x3b4467[_0x406f('0x43')]['filter']+'%'};return _0x295828;})});}_0x3625de=_[_0x406f('0x50')]({},_0x3625de,_0x3b4467[_0x406f('0x53')]);return _0x380675[_0x406f('0xb7')](_0x3625de);}})[_0x406f('0x33')](function(_0x4e7d02){if(_0x4e7d02){_0x4d0170=_0x4e7d02[_0x406f('0x49')];if(!_0x3b4467['query'][_0x406f('0x66')]('nolimit')){_0x3625de[_0x406f('0x2a')]=qs[_0x406f('0x2a')](_0x3b4467[_0x406f('0x43')][_0x406f('0x2a')]);_0x3625de[_0x406f('0x4a')]=qs[_0x406f('0x4a')](_0x3b4467[_0x406f('0x43')][_0x406f('0x4a')]);}return _0x380675[_0x406f('0xb7')](_0x3625de);}})['then'](function(_0x3c3334){if(_0x3c3334){return _0x3c3334?{'count':_0x4d0170,'rows':_0x3c3334}:null;}})[_0x406f('0x33')](respondWithResult(_0x1a5725,null))[_0x406f('0x26')](handleError(_0x1a5725,null));};exports['send']=function(_0x19ccfa,_0x6ae1bd,_0x180f9c){var _0x5238a7,_0x4fbc0d,_0x41a6f1;if(_[_0x406f('0x7b')](_0x19ccfa[_0x406f('0x5b')][_0x406f('0x5b')])||_0x19ccfa[_0x406f('0x5b')][_0x406f('0x5b')]===''){throw new db[(_0x406f('0x71'))][(_0x406f('0x72'))](_0x406f('0xb8'));}if(_[_0x406f('0x7b')](_0x19ccfa[_0x406f('0x5b')]['to'])){}_0x5238a7=_0x19ccfa['body']['to'];return db[_0x406f('0x3f')][_0x406f('0x65')]({'where':{'id':_0x19ccfa[_0x406f('0x60')]['id']}})[_0x406f('0x33')](handleEntityNotFound(_0x6ae1bd,null))[_0x406f('0x33')](function(_0xcca0f6){if(_0xcca0f6){return db[_0x406f('0x3f')][_0x406f('0x59')]({'where':{'id':_0xcca0f6['id']},'include':[{'model':db[_0x406f('0x7f')],'as':_0x406f('0x80'),'include':[{'model':db[_0x406f('0x6f')],'as':_0x406f('0x89'),'where':{[_0xcca0f6[_0x406f('0x7c')]]:_0x5238a7},'limit':0x1,'order':[[_0x406f('0x75'),_0x406f('0x81')]]}]}]})[_0x406f('0x33')](handleEntityNotFound(_0x6ae1bd,null))[_0x406f('0x33')](function(_0x3671d2){if(_0x3671d2&&_0x3671d2['List']){_0x4fbc0d=_0x3671d2['get']({'plain':!![]});if(_0x4fbc0d[_0x406f('0x80')]&&_0x4fbc0d[_0x406f('0x80')][_0x406f('0x89')][_0x406f('0x49')]){return _0x4fbc0d['List'][_0x406f('0x89')][0x0];}return db[_0x406f('0x6f')][_0x406f('0x5a')](_[_0x406f('0x15')](_0x19ccfa[_0x406f('0x5b')],{'firstName':_0x5238a7,[_0x3671d2['mapKey']]:_0x5238a7,'phone':_0x5238a7,'ListId':_0x4fbc0d[_0x406f('0x78')]}));}})[_0x406f('0x33')](handleEntityNotFound(_0x6ae1bd,null))['then'](function(_0x4b2689){if(_0x4b2689){_0x41a6f1=_0x4b2689;return db[_0x406f('0x8e')][_0x406f('0x59')]({'where':{'ContactId':_0x41a6f1['id'],'closed':![],'OpenchannelAccountId':_0x4fbc0d['id']}})[_0x406f('0x33')](function(_0x2226d4){if(_0x2226d4){return[_0x2226d4,![]];}return db[_0x406f('0x8e')]['create']({'UserId':_0x19ccfa[_0x406f('0x5c')]['id'],'ContactId':_0x41a6f1['id'],'OpenchannelAccountId':_0x4fbc0d['id'],'lastMsgDirection':_0x406f('0xb9'),'firstMsgDirection':_0x406f('0xb9'),'Messages':[_[_0x406f('0x50')](_0x19ccfa['body'],{'read':![],'body':_0x19ccfa[_0x406f('0x5b')][_0x406f('0x5b')],'OpenchannelAccountId':_0x4fbc0d['id'],'UserId':_0x19ccfa['user']['id'],'ContactId':_0x41a6f1['id']})]},{'include':[{'model':db[_0x406f('0xba')],'as':_0x406f('0xbb')}]})[_0x406f('0x33')](function(_0xc5f51e){return[_0xc5f51e,!![]];});});}})[_0x406f('0x91')](function(_0x187825,_0x45736f){if(_0x45736f){return _0x187825;}return db[_0x406f('0xba')][_0x406f('0x5a')](_['merge'](_0x19ccfa['body'],{'read':![],'body':_0x19ccfa[_0x406f('0x5b')][_0x406f('0x5b')],'OpenchannelAccountId':_0x4fbc0d['id'],'OpenchannelInteractionId':_0x187825['id'],'UserId':_0x19ccfa[_0x406f('0x5c')]['id'],'ContactId':_0x41a6f1['id']}))[_0x406f('0x33')](function(_0x2c678b){_0x187825[_0x406f('0xbc')]['Messages']=[];_0x187825[_0x406f('0xbc')][_0x406f('0xbb')]['push'](_0x2c678b[_0x406f('0xbc')]);return _0x187825;});});}})[_0x406f('0x33')](respondWithResult(_0x6ae1bd,null))[_0x406f('0x26')](handleError(_0x6ae1bd,null));}; \ No newline at end of file +var _0x289e=['Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','CmList','out','dataValues','Messages','push','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','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','offset','undefined','limit','count','Content-Range','apply','update','then','OpenchannelAccounts','UserProfileResource','destroy','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue'];(function(_0x585876,_0x1e5db0){var _0x3f453a=function(_0x259e1e){while(--_0x259e1e){_0x585876['push'](_0x585876['shift']());}};_0x3f453a(++_0x1e5db0);}(_0x289e,0xea));var _0xe289=function(_0x1a160d,_0x57fd51){_0x1a160d=_0x1a160d-0x0;var _0x3be03b=_0x289e[_0x1a160d];return _0x3be03b;};'use strict';var emlformat=require(_0xe289('0x0'));var rimraf=require(_0xe289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe289('0x2'));var rp=require(_0xe289('0x3'));var moment=require('moment');var BPromise=require(_0xe289('0x4'));var Mustache=require(_0xe289('0x5'));var util=require('util');var path=require(_0xe289('0x6'));var sox=require(_0xe289('0x7'));var csv=require(_0xe289('0x8'));var ejs=require(_0xe289('0x9'));var fs=require('fs');var fs_extra=require(_0xe289('0xa'));var _=require(_0xe289('0xb'));var squel=require(_0xe289('0xc'));var crypto=require(_0xe289('0xd'));var jsforce=require(_0xe289('0xe'));var deskjs=require(_0xe289('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe289('0x10'));var Papa=require(_0xe289('0x11'));var Redis=require(_0xe289('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe289('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe289('0x14'));var logger=require(_0xe289('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe289('0x16'));var db=require(_0xe289('0x17'))['db'];config[_0xe289('0x18')]=_[_0xe289('0x19')](config['redis'],{'host':_0xe289('0x1a'),'port':0x18eb});var socket=require(_0xe289('0x1b'))(new Redis(config[_0xe289('0x18')]));require(_0xe289('0x1c'))['register'](socket);var jayson=require(_0xe289('0x1d'));var client=jayson['client'][_0xe289('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xe289('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b61b8,_0x253fd6,_0x2efcfa,_0x1b9091){return new BPromise(function(_0x3ceb3e,_0x26311b){var _0x41f5c8=_0x1b9091||client;return _0x41f5c8[_0xe289('0x1f')](_0x4b61b8,_0x2efcfa)['then'](function(_0x1a9624){logger[_0xe289('0x20')](_0xe289('0x21'),_0x253fd6,_0xe289('0x22'));logger[_0xe289('0x23')](_0xe289('0x24'),_0x253fd6,_0xe289('0x22'),JSON[_0xe289('0x25')](_0x1a9624));if(_0x1a9624[_0xe289('0x26')]){if(_0x1a9624[_0xe289('0x26')][_0xe289('0x27')]===0x1f4){logger['error'](_0xe289('0x21'),_0x253fd6,_0x1a9624['error']['message']);return _0x26311b(_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);}logger[_0xe289('0x26')](_0xe289('0x21'),_0x253fd6,_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);return _0x3ceb3e(_0x1a9624[_0xe289('0x26')][_0xe289('0x28')]);}else{logger[_0xe289('0x20')](_0xe289('0x21'),_0x253fd6,'request\x20sent');_0x3ceb3e(_0x1a9624[_0xe289('0x29')][_0xe289('0x28')]);}})[_0xe289('0x2a')](function(_0x3cc28f){logger[_0xe289('0x26')](_0xe289('0x21'),_0x253fd6,_0x3cc28f);_0x26311b(_0x3cc28f);});});}function respondWithStatusCode(_0x23a0be,_0x47c755){_0x47c755=_0x47c755||0xcc;return function(_0x5e4ea1){if(_0x5e4ea1){return _0x23a0be[_0xe289('0x2b')](_0x47c755);}return _0x23a0be[_0xe289('0x2c')](_0x47c755)[_0xe289('0x2d')]();};}function respondWithResult(_0x52867c,_0x46c273){_0x46c273=_0x46c273||0xc8;return function(_0x348a6c){if(_0x348a6c){return _0x52867c[_0xe289('0x2c')](_0x46c273)[_0xe289('0x2e')](_0x348a6c);}};}function respondWithFilteredResult(_0x2d0e14,_0x3f22c7){return function(_0x56f298){if(_0x56f298){var _0xc4c7c6=typeof _0x3f22c7[_0xe289('0x2f')]===_0xe289('0x30')&&typeof _0x3f22c7[_0xe289('0x31')]===_0xe289('0x30');var _0x463152=_0x56f298['count'];var _0x58e89e=_0xc4c7c6?0x0:_0x3f22c7[_0xe289('0x2f')];var _0x2decae=_0xc4c7c6?_0x56f298[_0xe289('0x32')]:_0x3f22c7[_0xe289('0x2f')]+_0x3f22c7[_0xe289('0x31')];var _0x4d704;if(_0x2decae>=_0x463152){_0x2decae=_0x463152;_0x4d704=0xc8;}else{_0x4d704=0xce;}_0x2d0e14[_0xe289('0x2c')](_0x4d704);return _0x2d0e14['set'](_0xe289('0x33'),_0x58e89e+'-'+_0x2decae+'/'+_0x463152)[_0xe289('0x2e')](_0x56f298);}return null;};}function patchUpdates(_0x5e683b){return function(_0xf3a935){try{jsonpatch[_0xe289('0x34')](_0xf3a935,_0x5e683b,!![]);}catch(_0x63e4ff){return BPromise['reject'](_0x63e4ff);}return _0xf3a935['save']();};}function saveUpdates(_0x215024,_0x27be52){return function(_0x10656a){if(_0x10656a){return _0x10656a[_0xe289('0x35')](_0x215024)['then'](function(_0x3ce8f4){return _0x3ce8f4;});}return null;};}function removeEntity(_0x1fccbb,_0x3b217e){return function(_0x14e6f4){if(_0x14e6f4){return _0x14e6f4['destroy']()[_0xe289('0x36')](function(){var _0x439850=_0x14e6f4['get']({'plain':!![]});var _0x4e5796=_0xe289('0x37');return db[_0xe289('0x38')][_0xe289('0x39')]({'where':{'type':_0x4e5796,'resourceId':_0x439850['id']}})['then'](function(){return _0x14e6f4;});})[_0xe289('0x36')](function(){_0x1fccbb['status'](0xcc)[_0xe289('0x2d')]();});}};}function handleEntityNotFound(_0x1769c1,_0x54ac8b){return function(_0xd00fe3){if(!_0xd00fe3){_0x1769c1['sendStatus'](0x194);}return _0xd00fe3;};}function handleError(_0x38efc1,_0x471efe){_0x471efe=_0x471efe||0x1f4;return function(_0x1b9d93){logger['error'](_0x1b9d93['stack']);if(_0x1b9d93[_0xe289('0x3a')]){delete _0x1b9d93[_0xe289('0x3a')];}_0x38efc1['status'](_0x471efe)['send'](_0x1b9d93);};}exports['index']=function(_0x22a6dc,_0x557409){var _0x34b648={'include':[{'model':db[_0xe289('0x3b')],'as':_0xe289('0x3c')}]},_0x1a04a2={},_0x1ef453={'count':0x0,'rows':[]};var _0x1f58cf=_[_0xe289('0x3d')](db[_0xe289('0x3e')]['rawAttributes'],function(_0x22459d){return{'name':_0x22459d[_0xe289('0x3f')],'type':_0x22459d[_0xe289('0x40')][_0xe289('0x41')]};});_0x1a04a2['model']=_[_0xe289('0x3d')](_0x1f58cf,'name');_0x1a04a2['query']=_[_0xe289('0x42')](_0x22a6dc[_0xe289('0x43')]);_0x1a04a2['filters']=_[_0xe289('0x44')](_0x1a04a2['model'],_0x1a04a2[_0xe289('0x43')]);_0x34b648[_0xe289('0x45')]=_[_0xe289('0x44')](_0x1a04a2[_0xe289('0x46')],qs[_0xe289('0x47')](_0x22a6dc['query']['fields']));_0x34b648[_0xe289('0x45')]=_0x34b648[_0xe289('0x45')][_0xe289('0x48')]?_0x34b648['attributes']:_0x1a04a2[_0xe289('0x46')];if(!_0x22a6dc[_0xe289('0x43')][_0xe289('0x49')](_0xe289('0x4a'))){_0x34b648[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x22a6dc['query'][_0xe289('0x31')]);_0x34b648[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0x22a6dc[_0xe289('0x43')]['offset']);}_0x34b648[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0x22a6dc[_0xe289('0x43')][_0xe289('0x4c')]);_0x34b648[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0x22a6dc[_0xe289('0x43')],_0x1a04a2[_0xe289('0x4e')]),_0x1f58cf);if(_0x22a6dc[_0xe289('0x43')]['filter']){_0x34b648[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x34b648[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x1f58cf,function(_0x26d7ea){if(_0x26d7ea[_0xe289('0x40')]!==_0xe289('0x51')){var _0x23dea0={};_0x23dea0[_0x26d7ea[_0xe289('0x3a')]]={'$like':'%'+_0x22a6dc[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x23dea0;}})});}_0x34b648=_[_0xe289('0x50')]({},_0x34b648,_0x22a6dc[_0xe289('0x53')]);var _0x30e138={'where':_0x34b648[_0xe289('0x4d')]};return db[_0xe289('0x3e')][_0xe289('0x32')](_0x30e138)[_0xe289('0x36')](function(_0x1f46da){_0x1ef453[_0xe289('0x32')]=_0x1f46da;if(_0x22a6dc[_0xe289('0x43')][_0xe289('0x54')]){_0x34b648['include']=[{'all':!![]}];}return db[_0xe289('0x3e')][_0xe289('0x55')](_0x34b648);})[_0xe289('0x36')](function(_0x50df65){_0x1ef453[_0xe289('0x56')]=_0x50df65;return _0x1ef453;})['then'](respondWithFilteredResult(_0x557409,_0x34b648))['catch'](handleError(_0x557409,null));};exports[_0xe289('0x57')]=function(_0x529c28,_0x1a16b0){var _0x8ec96c={'raw':![],'where':{'id':_0x529c28[_0xe289('0x58')]['id']},'include':[{'model':db[_0xe289('0x3b')],'as':_0xe289('0x3c')}]},_0x3e6400={};_0x3e6400[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0x3e')][_0xe289('0x59')]);_0x3e6400['query']=_['keys'](_0x529c28[_0xe289('0x43')]);_0x3e6400[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x3e6400[_0xe289('0x46')],_0x3e6400[_0xe289('0x43')]);_0x8ec96c[_0xe289('0x45')]=_['intersection'](_0x3e6400[_0xe289('0x46')],qs['fields'](_0x529c28['query']['fields']));_0x8ec96c[_0xe289('0x45')]=_0x8ec96c['attributes']['length']?_0x8ec96c['attributes']:_0x3e6400[_0xe289('0x46')];if(_0x529c28[_0xe289('0x43')]['includeAll']){_0x8ec96c[_0xe289('0x5a')]=[{'all':!![]}];}_0x8ec96c=_[_0xe289('0x50')]({},_0x8ec96c,_0x529c28[_0xe289('0x53')]);return db[_0xe289('0x3e')][_0xe289('0x5b')](_0x8ec96c)[_0xe289('0x36')](handleEntityNotFound(_0x1a16b0,null))['then'](respondWithResult(_0x1a16b0,null))[_0xe289('0x2a')](handleError(_0x1a16b0,null));};exports[_0xe289('0x5c')]=function(_0x32c193,_0x3e19be){return db[_0xe289('0x3e')][_0xe289('0x5c')](_0x32c193[_0xe289('0x5d')],{})['then'](function(_0x463a03){var _0x40e59e=_0x32c193[_0xe289('0x5e')][_0xe289('0x5f')]({'plain':!![]});if(!_0x40e59e)throw new Error(_0xe289('0x60'));if(_0x40e59e[_0xe289('0x61')]===_0xe289('0x5e')){var _0x1e26c9=_0x463a03[_0xe289('0x5f')]({'plain':!![]});var _0x5d53d2=_0xe289('0x37');return db[_0xe289('0x62')]['find']({'where':{'name':_0x5d53d2,'userProfileId':_0x40e59e[_0xe289('0x63')]},'raw':!![]})['then'](function(_0x410d4a){if(_0x410d4a&&_0x410d4a[_0xe289('0x64')]===0x0){return db['UserProfileResource'][_0xe289('0x5c')]({'name':_0x1e26c9[_0xe289('0x3a')],'resourceId':_0x1e26c9['id'],'type':_0x410d4a[_0xe289('0x3a')],'sectionId':_0x410d4a['id']},{})[_0xe289('0x36')](function(){return _0x463a03;});}else{return _0x463a03;}})['catch'](function(_0x3466c0){logger[_0xe289('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3466c0);throw _0x3466c0;});}return _0x463a03;})[_0xe289('0x36')](respondWithResult(_0x3e19be,0xc9))['catch'](handleError(_0x3e19be,null));};exports['update']=function(_0x4d36bb,_0x526c6f){if(_0x4d36bb[_0xe289('0x5d')]['id']){delete _0x4d36bb['body']['id'];}return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x4d36bb[_0xe289('0x58')]['id']},'include':[{'model':db[_0xe289('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xe289('0x36')](handleEntityNotFound(_0x526c6f,null))[_0xe289('0x36')](saveUpdates(_0x4d36bb[_0xe289('0x5d')],null))[_0xe289('0x36')](respondWithResult(_0x526c6f,null))[_0xe289('0x2a')](handleError(_0x526c6f,null));};exports[_0xe289('0x39')]=function(_0x537dfd,_0x40e9c7){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x537dfd[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x40e9c7,null))[_0xe289('0x36')](removeEntity(_0x40e9c7,null))['catch'](handleError(_0x40e9c7,null));};exports[_0xe289('0x65')]=function(_0xdd829d,_0x1be36e){return db['OpenchannelAccount']['describe']()[_0xe289('0x36')](respondWithResult(_0x1be36e,null))[_0xe289('0x2a')](handleError(_0x1be36e,null));};exports['addDisposition']=function(_0x57a8b9,_0x2bbe98,_0x2d6dba){if(_0x57a8b9[_0xe289('0x5d')]['id']){delete _0x57a8b9[_0xe289('0x5d')]['id'];}return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x57a8b9[_0xe289('0x58')]['id']}})['then'](handleEntityNotFound(_0x2bbe98,null))['then'](function(_0x598d4a){if(_0x598d4a){_0x57a8b9['body'][_0xe289('0x66')]=_0x598d4a['id'];return db[_0xe289('0x67')][_0xe289('0x5c')](_0x57a8b9[_0xe289('0x5d')]);}})[_0xe289('0x36')](respondWithResult(_0x2bbe98,null))[_0xe289('0x2a')](handleError(_0x2bbe98,null));};exports[_0xe289('0x68')]=function(_0xf85573,_0x5bad2c,_0x1189d3){var _0x59be2d={'raw':![],'where':{}};var _0x4d594b={};var _0x4492cb={'count':0x0,'rows':[]};return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0xf85573['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x5bad2c,null))[_0xe289('0x36')](function(_0x27cc32){if(_0x27cc32){_0x4d594b[_0xe289('0x46')]=_['keys'](db[_0xe289('0x67')][_0xe289('0x59')]);_0x4d594b[_0xe289('0x43')]=_[_0xe289('0x42')](_0xf85573['query']);_0x4d594b[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x4d594b[_0xe289('0x46')],_0x4d594b[_0xe289('0x43')]);_0x59be2d[_0xe289('0x45')]=_[_0xe289('0x44')](_0x4d594b['model'],qs[_0xe289('0x47')](_0xf85573[_0xe289('0x43')][_0xe289('0x47')]));_0x59be2d[_0xe289('0x45')]=_0x59be2d[_0xe289('0x45')][_0xe289('0x48')]?_0x59be2d['attributes']:_0x4d594b[_0xe289('0x46')];if(!_0xf85573[_0xe289('0x43')][_0xe289('0x49')](_0xe289('0x4a'))){_0x59be2d[_0xe289('0x31')]=qs[_0xe289('0x31')](_0xf85573['query'][_0xe289('0x31')]);_0x59be2d[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0xf85573[_0xe289('0x43')][_0xe289('0x2f')]);}_0x59be2d[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0xf85573[_0xe289('0x43')][_0xe289('0x4c')]);_0x59be2d[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0xf85573[_0xe289('0x43')],_0x4d594b[_0xe289('0x4e')]));_0x59be2d['where'][_0xe289('0x66')]=_0x27cc32['id'];if(_0xf85573[_0xe289('0x43')][_0xe289('0x52')]){_0x59be2d[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x59be2d['where'],{'$or':_[_0xe289('0x3d')](_0x59be2d[_0xe289('0x45')],function(_0x2a7f5f){var _0x598f42={};_0x598f42[_0x2a7f5f]={'$like':'%'+_0xf85573['query'][_0xe289('0x52')]+'%'};return _0x598f42;})});}_0x59be2d=_[_0xe289('0x50')]({},_0x59be2d,_0xf85573[_0xe289('0x53')]);return db[_0xe289('0x67')][_0xe289('0x32')]({'where':_0x59be2d[_0xe289('0x4d')]})[_0xe289('0x36')](function(_0x19298b){_0x4492cb[_0xe289('0x32')]=_0x19298b;if(_0xf85573[_0xe289('0x43')]['includeAll']){_0x59be2d['include']=[{'all':!![]}];}return db[_0xe289('0x67')][_0xe289('0x55')](_0x59be2d);})[_0xe289('0x36')](function(_0x1e3de7){_0x4492cb[_0xe289('0x56')]=_0x1e3de7;return _0x4492cb;});}})[_0xe289('0x36')](respondWithFilteredResult(_0x5bad2c,_0x59be2d))[_0xe289('0x2a')](handleError(_0x5bad2c,null));};exports[_0xe289('0x6a')]=function(_0x417c2e,_0x51251a,_0x2c6013){return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x417c2e[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x51251a,null))['then'](function(_0x1190c9){if(_0x1190c9){return _0x1190c9[_0xe289('0x6a')](_0x417c2e['query']['ids']);}})['then'](respondWithStatusCode(_0x51251a,null))[_0xe289('0x2a')](handleError(_0x51251a,null));};exports[_0xe289('0x6b')]=function(_0x23d5b4,_0x434628,_0x453a70){if(_0x23d5b4[_0xe289('0x5d')]['id']){delete _0x23d5b4[_0xe289('0x5d')]['id'];}return db['OpenchannelAccount'][_0xe289('0x5b')]({'where':{'id':_0x23d5b4[_0xe289('0x58')]['id']}})['then'](handleEntityNotFound(_0x434628,null))[_0xe289('0x36')](function(_0x45d1da){if(_0x45d1da){_0x23d5b4[_0xe289('0x5d')]['OpenchannelAccountId']=_0x45d1da['id'];return db[_0xe289('0x6c')]['create'](_0x23d5b4[_0xe289('0x5d')]);}})[_0xe289('0x36')](respondWithResult(_0x434628,null))['catch'](handleError(_0x434628,null));};exports[_0xe289('0x6d')]=function(_0x143f6c,_0xa7d956,_0x424235){var _0x23b8cd={'raw':![],'where':{}};var _0x5bf492={};var _0x17efa3={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x143f6c['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0xa7d956,null))['then'](function(_0x5e8c95){if(_0x5e8c95){_0x5bf492[_0xe289('0x46')]=_['keys'](db['CannedAnswer'][_0xe289('0x59')]);_0x5bf492[_0xe289('0x43')]=_[_0xe289('0x42')](_0x143f6c[_0xe289('0x43')]);_0x5bf492['filters']=_[_0xe289('0x44')](_0x5bf492['model'],_0x5bf492[_0xe289('0x43')]);_0x23b8cd[_0xe289('0x45')]=_['intersection'](_0x5bf492[_0xe289('0x46')],qs[_0xe289('0x47')](_0x143f6c[_0xe289('0x43')][_0xe289('0x47')]));_0x23b8cd[_0xe289('0x45')]=_0x23b8cd[_0xe289('0x45')][_0xe289('0x48')]?_0x23b8cd['attributes']:_0x5bf492['model'];if(!_0x143f6c[_0xe289('0x43')]['hasOwnProperty'](_0xe289('0x4a'))){_0x23b8cd[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x143f6c[_0xe289('0x43')][_0xe289('0x31')]);_0x23b8cd[_0xe289('0x2f')]=qs[_0xe289('0x2f')](_0x143f6c[_0xe289('0x43')][_0xe289('0x2f')]);}_0x23b8cd[_0xe289('0x4b')]=qs['sort'](_0x143f6c['query']['sort']);_0x23b8cd[_0xe289('0x4d')]=qs['filters'](_['pick'](_0x143f6c[_0xe289('0x43')],_0x5bf492[_0xe289('0x4e')]));_0x23b8cd[_0xe289('0x4d')]['OpenchannelAccountId']=_0x5e8c95['id'];if(_0x143f6c[_0xe289('0x43')][_0xe289('0x52')]){_0x23b8cd[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x23b8cd[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x23b8cd[_0xe289('0x45')],function(_0x3296ad){var _0x43d8ad={};_0x43d8ad[_0x3296ad]={'$like':'%'+_0x143f6c[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x43d8ad;})});}_0x23b8cd=_[_0xe289('0x50')]({},_0x23b8cd,_0x143f6c['options']);return db[_0xe289('0x6c')][_0xe289('0x32')]({'where':_0x23b8cd[_0xe289('0x4d')]})[_0xe289('0x36')](function(_0x3442aa){_0x17efa3[_0xe289('0x32')]=_0x3442aa;if(_0x143f6c[_0xe289('0x43')][_0xe289('0x54')]){_0x23b8cd['include']=[{'all':!![]}];}return db[_0xe289('0x6c')][_0xe289('0x55')](_0x23b8cd);})['then'](function(_0x350bf5){_0x17efa3['rows']=_0x350bf5;return _0x17efa3;});}})[_0xe289('0x36')](respondWithFilteredResult(_0xa7d956,_0x23b8cd))['catch'](handleError(_0xa7d956,null));};exports[_0xe289('0x6e')]=function(_0x2356df,_0x1d653e,_0x1d202b){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x2356df['params']['id']}})['then'](handleEntityNotFound(_0x1d653e,null))['then'](function(_0x355d6f){if(_0x355d6f){return _0x355d6f['removeAnswers'](_0x2356df[_0xe289('0x43')][_0xe289('0x6f')]);}})[_0xe289('0x36')](respondWithStatusCode(_0x1d653e,null))[_0xe289('0x2a')](handleError(_0x1d653e,null));};exports[_0xe289('0x70')]=function(_0x3ed91b,_0x2e5bb8,_0x501848){var _0x5de9f2={'body':_0x3ed91b['body'],'channel':_0xe289('0x71')};var _0x171584=[];var _0x597b11=[];var _0x5832af={};var _0x3a9ece=![];return db[_0xe289('0x72')][_0xe289('0x65')]()[_0xe289('0x36')](function(_0xa870f1){if(!_0xa870f1){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x75'));}_0x171584=_['difference'](_[_0xe289('0x42')](_0xa870f1),[_0xe289('0x76'),_0xe289('0x77')]);_0x597b11=_[_0xe289('0x78')](_[_0xe289('0x42')](_0xa870f1),[_0xe289('0x76'),'updatedAt',_0xe289('0x79'),'ListId']);if(_0x3ed91b['body']['id']){delete _0x3ed91b['body']['id'];}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')])){throw new db['Sequelize'][(_0xe289('0x74'))](_0xe289('0x7c'));}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')]['body'])||_0x3ed91b['body'][_0xe289('0x5d')]===''){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x7d'));}if(_[_0xe289('0x7a')](_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')])){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x597b11);}if(!_[_0xe289('0x7f')](_0x597b11,_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')])){throw new db[(_0xe289('0x73'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x597b11);}_0x5832af[_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')]]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')];})[_0xe289('0x36')](function(){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x3ed91b[_0xe289('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xe289('0x80'),'include':[{'model':db[_0xe289('0x72')],'as':_0xe289('0x81'),'where':_0x5832af,'limit':0x1,'order':[['updatedAt',_0xe289('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0xe289('0x83')}]});})[_0xe289('0x36')](handleEntityNotFound(_0x2e5bb8,null))[_0xe289('0x36')](function(_0x2a975a){if(_0x2a975a&&_0x2a975a['List']){_0x5de9f2[_0xe289('0x84')]=_0x2a975a;_0x5de9f2[_0xe289('0x85')]=_0x2a975a[_0xe289('0x83')];_0x5de9f2[_0xe289('0x86')]=_0x2a975a[_0xe289('0x80')];_0x5de9f2[_0xe289('0x85')]=_[_0xe289('0x87')](_0x5de9f2[_0xe289('0x85')],['priority'],[_0xe289('0x88')]);if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x83')]){delete _0x5de9f2[_0xe289('0x84')]['Applications'];}if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x80')]&&_0x5de9f2[_0xe289('0x84')][_0xe289('0x80')]['Contacts'][_0xe289('0x48')]){return _0x5de9f2[_0xe289('0x84')]['List'][_0xe289('0x81')][0x0];}var _0x76386b=_['defaults'](_0x3ed91b[_0xe289('0x5d')],{'firstName':_0x3ed91b[_0xe289('0x5d')]['from'],'ListId':_0x2a975a['ListId']});_0x76386b[_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7e')]]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x7b')];return db[_0xe289('0x72')][_0xe289('0x5c')](_0x76386b,{'fields':_0x171584,'raw':!![]});}})[_0xe289('0x36')](handleEntityNotFound(_0x2e5bb8,null))['then'](function(_0x749460){_0x5de9f2[_0xe289('0x89')]=_0x749460;if(_0x749460){var _0x1ee99b={'ContactId':_0x749460['id'],'OpenchannelAccountId':_0x3ed91b['params']['id'],'from':(_0x749460[_0xe289('0x8a')]||'')+'\x20'+(_0x749460[_0xe289('0x8b')]||'')};var _0x1226c5={'OpenchannelAccountId':_0x3ed91b[_0xe289('0x58')]['id'],'closed':![]};if(_0x3ed91b['body']['threadId']){_0x1226c5[_0xe289('0x8c')]=_0x3ed91b['body'][_0xe289('0x8c')];return db[_0xe289('0x8d')][_0xe289('0x5b')]({'where':_0x1226c5})['then'](function(_0x16ff0a){if(_0x16ff0a){return[_0x16ff0a,![]];}_0x1ee99b[_0xe289('0x8c')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')];_0x1ee99b[_0xe289('0x8e')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8e')];return db[_0xe289('0x8d')]['create'](_0x1ee99b)['then'](function(_0x74f97b){return[_0x74f97b,!![]];});});}else{_0x1226c5[_0xe289('0x8c')]=null;}_0x1226c5[_0xe289('0x8f')]=_0x749460['id'];return db[_0xe289('0x8d')]['find']({'where':_0x1226c5})[_0xe289('0x36')](function(_0xa27e26){if(_0xa27e26){return[_0xa27e26,![]];}return db[_0xe289('0x8d')]['create'](_0x1ee99b)['then'](function(_0x379524){return[_0x379524,!![]];});});}})[_0xe289('0x90')](function(_0x545ab1,_0x18985a){if(_0x545ab1){_0x3a9ece=_0x18985a;if(!_0x18985a){var _0x4f8e4f={'from':(_0x5de9f2[_0xe289('0x89')][_0xe289('0x8a')]||'')+'\x20'+(_0x5de9f2['contact']['lastName']||'')};if(_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')]&&_0x3ed91b[_0xe289('0x5d')][_0xe289('0x91')]&&_0x3ed91b[_0xe289('0x5d')][_0xe289('0x8c')]!=_0x3ed91b['body']['messageId']){_0x4f8e4f[_0xe289('0x8c')]=_0x3ed91b[_0xe289('0x5d')][_0xe289('0x91')];}return _0x545ab1[_0xe289('0x35')](_0x4f8e4f);}else{return _0x545ab1;}}})[_0xe289('0x36')](function(_0x201061){_0x5de9f2[_0xe289('0x92')]=_0x201061[_0xe289('0x5f')]({'plain':!![]});_0x5de9f2[_0xe289('0x92')][_0xe289('0x93')]=_0x3a9ece;if(_0x5de9f2['interaction']['created']){if(_0x5de9f2[_0xe289('0x84')][_0xe289('0x94')]){_0x5de9f2[_0xe289('0x85')]['push']({'id':0x0,'priority':_0x5de9f2[_0xe289('0x85')][_0xe289('0x48')]+0x1,'app':'close','appdata':_0xe289('0x95'),'interval':_0xe289('0x96')});}}return db[_0xe289('0x97')][_0xe289('0x5c')]({'body':_0x3ed91b['body'][_0xe289('0x5d')],'OpenchannelAccountId':_0x3ed91b[_0xe289('0x58')]['id'],'OpenchannelInteractionId':_0x201061['id'],'direction':'in','ContactId':_0x5de9f2['contact']['id'],'AttachmentId':_0x3ed91b[_0xe289('0x5d')][_0xe289('0x98')]});})[_0xe289('0x36')](function(_0x55d609){_0x5de9f2['message']=_0x55d609;if(!_0x5de9f2['interaction'][_0xe289('0x99')])return;return db['User'][_0xe289('0x5b')]({'attributes':['id',_0xe289('0x3a')],'where':{'id':_0x5de9f2[_0xe289('0x92')][_0xe289('0x99')]}});})['then'](function(_0x16b603){if(_0x16b603){_0x5de9f2[_0xe289('0x85')][_0xe289('0x9a')]({'id':0x0,'priority':0x0,'app':_0xe289('0x9b'),'appdata':_0x16b603[_0xe289('0x3a')]+','+(_0x5de9f2[_0xe289('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0xe289('0x96')});}if(!_0x5de9f2[_0xe289('0x92')][_0xe289('0x9c')])return;return db[_0xe289('0x9d')][_0xe289('0x5b')]({'attributes':['id',_0xe289('0x3a')],'where':{'id':_0x5de9f2[_0xe289('0x92')]['queueId']}});})[_0xe289('0x36')](function(_0x4d8f8a){if(_0x4d8f8a){_0x5de9f2[_0xe289('0x85')][_0xe289('0x9a')]({'id':0x0,'priority':0x1,'app':_0xe289('0x9e'),'appdata':_0x4d8f8a['name']+','+(_0x5de9f2['account'][_0xe289('0x9f')]||0x12c),'interval':_0xe289('0x96')});}return respondWithRpcPromise(_0xe289('0xa0'),'startRouting',_0x5de9f2);})[_0xe289('0x36')](function(_0x44b7dc){respondWithRpcPromise(_0xe289('0xa1'),_0xe289('0xa1'),{'event':_0xe289('0x70'),'message':_0x44b7dc},client9002);return _0x44b7dc;})[_0xe289('0x36')](respondWithResult(_0x2e5bb8,null))[_0xe289('0x2a')](handleError(_0x2e5bb8,null));};exports[_0xe289('0xa2')]=function(_0x18521d,_0x4af4eb){var _0x507c29=_0x18521d[_0xe289('0x58')]['id'];var _0x13b85b=_0x18521d['body'];var _0x42e478=0xc8;var _0x358a8=null;return db[_0xe289('0xa3')][_0xe289('0xa4')]({'isolationLevel':db[_0xe289('0xa3')][_0xe289('0xa5')][_0xe289('0xa6')][_0xe289('0xa7')]},function(_0x49c8b2){return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x507c29},'transaction':_0x49c8b2})[_0xe289('0x36')](function(_0x4b37e8){if(_0x4b37e8){return db[_0xe289('0xa8')][_0xe289('0x39')]({'where':{'OpenchannelAccountId':_0x507c29},'transaction':_0x49c8b2})[_0xe289('0x36')](function(){var _0x59aafa=_['map'](_0x13b85b,function(_0x320c7c){_0x320c7c['OpenchannelAccountId']=_0x507c29;return _0x320c7c;});return db[_0xe289('0xa8')][_0xe289('0xa9')](_0x59aafa,{'transaction':_0x49c8b2});});}else{_0x42e478=0x194;_0x358a8=[];}});})[_0xe289('0x36')](function(){if(_0x42e478!==0x194){return db[_0xe289('0xa8')][_0xe289('0xaa')]({'where':{'OpenchannelAccountId':_0x507c29},'order':_0xe289('0xab')})[_0xe289('0x36')](function(_0x174af9){_0x358a8=_0x174af9;});}})[_0xe289('0x2a')](function(_0xfd3816){_0x42e478=0x1f4;logger[_0xe289('0x26')](_0xfd3816['stack']);if(_0xfd3816[_0xe289('0x3a')]){delete _0xfd3816['name'];}_0x358a8=_0xfd3816;})[_0xe289('0xac')](function(){if(_0x358a8===null){_0x4af4eb[_0xe289('0x2b')](_0x42e478);}else{if(_0x42e478===0x1f4){_0x4af4eb[_0xe289('0x2c')](_0x42e478)['send'](_0x358a8);}else{_0x4af4eb[_0xe289('0x2c')](_0x42e478)[_0xe289('0x2e')](_0x358a8);}}});};exports[_0xe289('0xad')]=function(_0x1896e8,_0x221b55,_0x632c67){var _0x417418={};var _0x323a6d={};var _0x4ee1e2;var _0x439961;return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x1896e8[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x221b55,null))[_0xe289('0x36')](function(_0x7ee891){if(_0x7ee891){_0x4ee1e2=_0x7ee891;_0x323a6d['model']=_[_0xe289('0x42')](db[_0xe289('0xa8')][_0xe289('0x59')]);_0x323a6d[_0xe289('0x43')]=_[_0xe289('0x42')](_0x1896e8[_0xe289('0x43')]);_0x323a6d['filters']=_['intersection'](_0x323a6d[_0xe289('0x46')],_0x323a6d[_0xe289('0x43')]);_0x417418[_0xe289('0x45')]=_[_0xe289('0x44')](_0x323a6d[_0xe289('0x46')],qs[_0xe289('0x47')](_0x1896e8['query'][_0xe289('0x47')]));_0x417418[_0xe289('0x45')]=_0x417418[_0xe289('0x45')][_0xe289('0x48')]?_0x417418[_0xe289('0x45')]:_0x323a6d[_0xe289('0x46')];_0x417418[_0xe289('0x4b')]=qs[_0xe289('0x4c')](_0x1896e8[_0xe289('0x43')][_0xe289('0x4c')]);_0x417418[_0xe289('0x4d')]=qs['filters'](_['pick'](_0x1896e8[_0xe289('0x43')],_0x323a6d['filters']));if(_0x1896e8[_0xe289('0x43')][_0xe289('0x52')]){_0x417418[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x417418[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x417418[_0xe289('0x45')],function(_0x44f021){var _0xb21745={};_0xb21745[_0x44f021]={'$like':'%'+_0x1896e8[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0xb21745;})});}_0x417418=_[_0xe289('0x50')]({},_0x417418,_0x1896e8[_0xe289('0x53')]);return _0x4ee1e2[_0xe289('0xad')](_0x417418);}})['then'](function(_0x1f8187){if(_0x1f8187){_0x439961=_0x1f8187[_0xe289('0x48')];if(!_0x1896e8['query'][_0xe289('0x49')](_0xe289('0x4a'))){_0x417418[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x1896e8['query'][_0xe289('0x31')]);_0x417418['offset']=qs[_0xe289('0x2f')](_0x1896e8[_0xe289('0x43')][_0xe289('0x2f')]);}return _0x4ee1e2['getApplications'](_0x417418);}})[_0xe289('0x36')](function(_0x482b6d){if(_0x482b6d){return _0x482b6d?{'count':_0x439961,'rows':_0x482b6d}:null;}})['then'](respondWithResult(_0x221b55,null))[_0xe289('0x2a')](handleError(_0x221b55,null));};exports[_0xe289('0xae')]=function(_0x4b9b6d,_0x4e4cfa,_0x44351a){var _0x161a39={'raw':![],'where':{}};var _0x50de19={};var _0x3fe909={'count':0x0,'rows':[]};return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x4b9b6d[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x4e4cfa,null))[_0xe289('0x36')](function(_0x1ba550){if(_0x1ba550){_0x50de19[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0x8d')][_0xe289('0x59')]);_0x50de19[_0xe289('0x43')]=_['keys'](_0x4b9b6d[_0xe289('0x43')]);_0x50de19['filters']=_['intersection'](_0x50de19['model'],_0x50de19[_0xe289('0x43')]);_0x161a39[_0xe289('0x45')]=_[_0xe289('0x44')](_0x50de19[_0xe289('0x46')],qs[_0xe289('0x47')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x47')]));_0x161a39[_0xe289('0x45')]=_0x161a39[_0xe289('0x45')]['length']?_0x161a39['attributes']:_0x50de19[_0xe289('0x46')];if(!_0x4b9b6d['query']['hasOwnProperty'](_0xe289('0x4a'))){_0x161a39[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x31')]);_0x161a39['offset']=qs[_0xe289('0x2f')](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x2f')]);}_0x161a39[_0xe289('0x4b')]=qs['sort'](_0x4b9b6d[_0xe289('0x43')][_0xe289('0x4c')]);_0x161a39['where']=qs[_0xe289('0x4e')](_[_0xe289('0x4f')](_0x4b9b6d[_0xe289('0x43')],_0x50de19['filters']));_0x161a39[_0xe289('0x4d')][_0xe289('0x66')]=_0x1ba550['id'];if(_0x4b9b6d[_0xe289('0x43')][_0xe289('0x52')]){_0x161a39[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x161a39[_0xe289('0x4d')],{'$or':_['map'](_0x161a39[_0xe289('0x45')],function(_0x372603){var _0x53a50b={};_0x53a50b[_0x372603]={'$like':'%'+_0x4b9b6d[_0xe289('0x43')][_0xe289('0x52')]+'%'};return _0x53a50b;})});}_0x161a39=_[_0xe289('0x50')]({},_0x161a39,_0x4b9b6d[_0xe289('0x53')]);return db[_0xe289('0x8d')][_0xe289('0x32')]({'where':_0x161a39[_0xe289('0x4d')]})['then'](function(_0x1be70d){_0x3fe909[_0xe289('0x32')]=_0x1be70d;if(_0x4b9b6d[_0xe289('0x43')]['includeAll']){_0x161a39[_0xe289('0x5a')]=[{'model':db[_0xe289('0x72')],'as':_0xe289('0xaf'),'required':![]},{'model':db[_0xe289('0xb0')],'as':_0xe289('0xb1'),'attributes':[_0xe289('0x3a'),_0xe289('0xb2'),_0xe289('0xb3')],'required':![]},{'model':db[_0xe289('0xb4')],'as':_0xe289('0xb5'),'attributes':['id',_0xe289('0x3a'),_0xe289('0xb6')],'where':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]?{'id':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]}:undefined,'required':_0x4b9b6d[_0xe289('0x43')][_0xe289('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xe289('0x55')](_0x161a39);})[_0xe289('0x36')](function(_0x21d16e){_0x3fe909['rows']=_0x21d16e;return _0x3fe909;});}})[_0xe289('0x36')](respondWithFilteredResult(_0x4e4cfa,_0x161a39))[_0xe289('0x2a')](handleError(_0x4e4cfa,null));};exports[_0xe289('0xb8')]=function(_0x6173e2,_0x2c0b92,_0x18fe49){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x6173e2[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x2c0b92,null))[_0xe289('0x36')](function(_0x44e86d){if(_0x44e86d){return _0x44e86d[_0xe289('0xb8')](_0x6173e2[_0xe289('0x5d')][_0xe289('0x6f')],_[_0xe289('0xb9')](_0x6173e2[_0xe289('0x5d')],[_0xe289('0x6f'),'id'])||{})[_0xe289('0x90')](function(_0x7026c9){for(var _0x573f68=0x0;_0x573f68<_0x6173e2[_0xe289('0x5d')]['ids'][_0xe289('0x48')];_0x573f68+=0x1){socket[_0xe289('0xba')](_0xe289('0xbb'),{'UserId':Number(_0x6173e2[_0xe289('0x5d')][_0xe289('0x6f')][_0x573f68]),'OpenchannelAccountId':Number(_0x6173e2[_0xe289('0x58')]['id'])});}return _0x7026c9;});}})['then'](respondWithResult(_0x2c0b92,null))['catch'](handleError(_0x2c0b92,null));};exports['removeAgents']=function(_0x103fa3,_0x151c17,_0x1a6e3f){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x103fa3[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x151c17,null))['then'](function(_0x2fd023){if(_0x2fd023){return _0x2fd023[_0xe289('0xbc')](_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')])[_0xe289('0x36')](function(){if(_['isArray'](_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')])){for(var _0x20ac8d=0x0;_0x20ac8d<_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')][_0xe289('0x48')];_0x20ac8d+=0x1){socket[_0xe289('0xba')](_0xe289('0xbd'),{'UserId':Number(_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')][_0x20ac8d]),'OpenchannelAccountId':Number(_0x103fa3[_0xe289('0x58')]['id'])});}}else{socket[_0xe289('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x103fa3[_0xe289('0x43')][_0xe289('0x6f')]),'OpenchannelAccountId':Number(_0x103fa3[_0xe289('0x58')]['id'])});}});}})[_0xe289('0x36')](respondWithStatusCode(_0x151c17,null))[_0xe289('0x2a')](handleError(_0x151c17,null));};exports[_0xe289('0xbe')]=function(_0x491aa1,_0x1f9f49,_0xa543b0){var _0x55debb={};var _0x3a7016={};var _0x413672;var _0x52c48e;return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x491aa1['params']['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x1f9f49,null))['then'](function(_0x14ef7c){if(_0x14ef7c){_0x413672=_0x14ef7c;_0x3a7016[_0xe289('0x46')]=_[_0xe289('0x42')](db[_0xe289('0xb0')][_0xe289('0x59')]);_0x3a7016['query']=_[_0xe289('0x42')](_0x491aa1[_0xe289('0x43')]);_0x3a7016[_0xe289('0x4e')]=_[_0xe289('0x44')](_0x3a7016[_0xe289('0x46')],_0x3a7016[_0xe289('0x43')]);_0x55debb['attributes']=_['intersection'](_0x3a7016['model'],qs[_0xe289('0x47')](_0x491aa1['query'][_0xe289('0x47')]));_0x55debb[_0xe289('0x45')]=_0x55debb[_0xe289('0x45')][_0xe289('0x48')]?_0x55debb[_0xe289('0x45')]:_0x3a7016[_0xe289('0x46')];_0x55debb[_0xe289('0x4b')]=qs['sort'](_0x491aa1[_0xe289('0x43')]['sort']);_0x55debb[_0xe289('0x4d')]=qs[_0xe289('0x4e')](_['pick'](_0x491aa1[_0xe289('0x43')],_0x3a7016[_0xe289('0x4e')]));if(_0x491aa1[_0xe289('0x43')][_0xe289('0x52')]){_0x55debb[_0xe289('0x4d')]=_[_0xe289('0x50')](_0x55debb[_0xe289('0x4d')],{'$or':_[_0xe289('0x3d')](_0x55debb[_0xe289('0x45')],function(_0x23e649){var _0xc3aa49={};_0xc3aa49[_0x23e649]={'$like':'%'+_0x491aa1[_0xe289('0x43')]['filter']+'%'};return _0xc3aa49;})});}_0x55debb=_[_0xe289('0x50')]({},_0x55debb,_0x491aa1[_0xe289('0x53')]);return _0x413672['getAgents'](_0x55debb);}})[_0xe289('0x36')](function(_0x227a33){if(_0x227a33){_0x52c48e=_0x227a33[_0xe289('0x48')];if(!_0x491aa1[_0xe289('0x43')][_0xe289('0x49')]('nolimit')){_0x55debb[_0xe289('0x31')]=qs[_0xe289('0x31')](_0x491aa1[_0xe289('0x43')][_0xe289('0x31')]);_0x55debb['offset']=qs['offset'](_0x491aa1['query'][_0xe289('0x2f')]);}return _0x413672[_0xe289('0xbe')](_0x55debb);}})[_0xe289('0x36')](function(_0x261619){if(_0x261619){return _0x261619?{'count':_0x52c48e,'rows':_0x261619}:null;}})['then'](respondWithResult(_0x1f9f49,null))['catch'](handleError(_0x1f9f49,null));};exports[_0xe289('0xbf')]=function(_0x1c47e8,_0x341153,_0x54b04f){var _0x51acc2,_0xe05e30,_0x3bf1de;if(_[_0xe289('0x7a')](_0x1c47e8[_0xe289('0x5d')]['body'])||_0x1c47e8['body'][_0xe289('0x5d')]===''){throw new db[(_0xe289('0x73'))][(_0xe289('0x74'))](_0xe289('0x7d'));}if(_[_0xe289('0x7a')](_0x1c47e8['body']['to'])){}_0x51acc2=_0x1c47e8[_0xe289('0x5d')]['to'];return db[_0xe289('0x3e')][_0xe289('0x69')]({'where':{'id':_0x1c47e8[_0xe289('0x58')]['id']}})[_0xe289('0x36')](handleEntityNotFound(_0x341153,null))['then'](function(_0x4bbd5d){if(_0x4bbd5d){return db[_0xe289('0x3e')][_0xe289('0x5b')]({'where':{'id':_0x4bbd5d['id']},'include':[{'model':db[_0xe289('0xc0')],'as':_0xe289('0x80'),'include':[{'model':db[_0xe289('0x72')],'as':'Contacts','where':{[_0x4bbd5d[_0xe289('0x7e')]]:_0x51acc2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xe289('0x36')](handleEntityNotFound(_0x341153,null))[_0xe289('0x36')](function(_0x2d881b){if(_0x2d881b&&_0x2d881b[_0xe289('0x80')]){_0xe05e30=_0x2d881b['get']({'plain':!![]});if(_0xe05e30[_0xe289('0x80')]&&_0xe05e30[_0xe289('0x80')][_0xe289('0x81')][_0xe289('0x48')]){return _0xe05e30[_0xe289('0x80')][_0xe289('0x81')][0x0];}return db[_0xe289('0x72')][_0xe289('0x5c')](_[_0xe289('0x19')](_0x1c47e8[_0xe289('0x5d')],{'firstName':_0x51acc2,[_0x2d881b[_0xe289('0x7e')]]:_0x51acc2,'phone':_0x51acc2,'ListId':_0xe05e30['ListId']}));}})['then'](handleEntityNotFound(_0x341153,null))[_0xe289('0x36')](function(_0x5b418c){if(_0x5b418c){_0x3bf1de=_0x5b418c;return db[_0xe289('0x8d')]['find']({'where':{'ContactId':_0x3bf1de['id'],'closed':![],'OpenchannelAccountId':_0xe05e30['id']}})['then'](function(_0x4eb24c){if(_0x4eb24c){return[_0x4eb24c,![]];}return db['OpenchannelInteraction'][_0xe289('0x5c')]({'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id'],'OpenchannelAccountId':_0xe05e30['id'],'lastMsgDirection':_0xe289('0xc1'),'firstMsgDirection':_0xe289('0xc1'),'Messages':[_[_0xe289('0x50')](_0x1c47e8['body'],{'read':![],'body':_0x1c47e8[_0xe289('0x5d')][_0xe289('0x5d')],'OpenchannelAccountId':_0xe05e30['id'],'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xe289('0x36')](function(_0x10fa4f){return[_0x10fa4f,!![]];});});}})['spread'](function(_0x1bf932,_0x16e1a7){if(_0x16e1a7){return _0x1bf932;}return db[_0xe289('0x97')][_0xe289('0x5c')](_[_0xe289('0x50')](_0x1c47e8[_0xe289('0x5d')],{'read':![],'body':_0x1c47e8[_0xe289('0x5d')][_0xe289('0x5d')],'OpenchannelAccountId':_0xe05e30['id'],'OpenchannelInteractionId':_0x1bf932['id'],'UserId':_0x1c47e8[_0xe289('0x5e')]['id'],'ContactId':_0x3bf1de['id']}))[_0xe289('0x36')](function(_0x4047c9){_0x1bf932[_0xe289('0xc2')]['Messages']=[];_0x1bf932[_0xe289('0xc2')][_0xe289('0xc3')][_0xe289('0xc4')](_0x4047c9['dataValues']);return _0x1bf932;});});}})['then'](respondWithResult(_0x341153,null))[_0xe289('0x2a')](handleError(_0x341153,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1ac8c93..b2d298f 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 _0x55e0=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x54cd98,_0x3029e6){var _0x4abd09=function(_0x10e689){while(--_0x10e689){_0x54cd98['push'](_0x54cd98['shift']());}};_0x4abd09(++_0x3029e6);}(_0x55e0,0xdc));var _0x055e=function(_0x3a50de,_0x1654be){_0x3a50de=_0x3a50de-0x0;var _0x5b205f=_0x55e0[_0x3a50de];return _0x5b205f;};'use strict';var EventEmitter=require(_0x055e('0x0'));var OpenchannelAccount=require(_0x055e('0x1'))['db'][_0x055e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x055e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x055e('0x4')};function emitEvent(_0x2d9bd5){return function(_0x33cd7b,_0x2773e4,_0x157473){OpenchannelAccountEvents[_0x055e('0x5')](_0x2d9bd5+':'+_0x33cd7b['id'],_0x33cd7b);OpenchannelAccountEvents['emit'](_0x2d9bd5,_0x33cd7b);_0x157473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x055e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x542ff6,_0xa0f401){var _0x40df45=function(_0x7ba286){while(--_0x7ba286){_0x542ff6['push'](_0x542ff6['shift']());}};_0x40df45(++_0xa0f401);}(_0x54ef,0x112));var _0xf54e=function(_0xdfac76,_0x4e2a7a){_0xdfac76=_0xdfac76-0x0;var _0x41d185=_0x54ef[_0xdfac76];return _0x41d185;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 57e076c..2147fd1 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 _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1f84b5,_0xc2dce1){var _0xd830e9=function(_0x4419f3){while(--_0x4419f3){_0x1f84b5['push'](_0x1f84b5['shift']());}};_0xd830e9(++_0xc2dce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x308998,_0x5e324b){var _0x3d90e6=function(_0x3f988f){while(--_0x3f988f){_0x308998['push'](_0x308998['shift']());}};_0x3d90e6(++_0x5e324b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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':'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 758bb74..278d335 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 _0x26f9=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57dbc3,_0x546311){var _0x2133e4=function(_0x462ed5){while(--_0x462ed5){_0x57dbc3['push'](_0x57dbc3['shift']());}};_0x2133e4(++_0x546311);}(_0x26f9,0x16f));var _0x926f=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x26f9[_0x21f9c2];return _0x3da17f;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});config[_0x926f('0xa')]=_[_0x926f('0xb')](config[_0x926f('0xa')],{'host':_0x926f('0xc'),'port':0x18eb});var socket=require(_0x926f('0xd'))(new Redis(config['redis']));require(_0x926f('0xe'))['register'](socket);function respondWithRpcPromise(_0x12fbd4,_0x43cd93,_0x4f7d2c){return new BPromise(function(_0x3d3802,_0x2ae81c){return client[_0x926f('0xf')](_0x12fbd4,_0x4f7d2c)[_0x926f('0x10')](function(_0x13ef84){logger['info'](_0x926f('0x11'),_0x43cd93,_0x926f('0x12'));logger[_0x926f('0x13')](_0x926f('0x14'),_0x43cd93,_0x926f('0x12'),JSON[_0x926f('0x15')](_0x13ef84));if(_0x13ef84[_0x926f('0x16')]){if(_0x13ef84['error']['code']===0x1f4){logger['error'](_0x926f('0x11'),_0x43cd93,_0x13ef84[_0x926f('0x16')][_0x926f('0x17')]);return _0x2ae81c(_0x13ef84[_0x926f('0x16')]['message']);}logger[_0x926f('0x16')](_0x926f('0x11'),_0x43cd93,_0x13ef84['error'][_0x926f('0x17')]);return _0x3d3802(_0x13ef84['error'][_0x926f('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x43cd93,_0x926f('0x12'));_0x3d3802(_0x13ef84[_0x926f('0x18')]['message']);}})[_0x926f('0x19')](function(_0x386498){logger[_0x926f('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x43cd93,_0x386498);_0x2ae81c(_0x386498);});});} \ No newline at end of file +var _0x6f2f=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0x1a2a50,_0x1cdd3c){var _0x49df88=function(_0x44b07e){while(--_0x44b07e){_0x1a2a50['push'](_0x1a2a50['shift']());}};_0x49df88(++_0x1cdd3c);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x6f2f[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6f2('0x3'))(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6f2('0x6')]({'port':0x232a});config[_0xf6f2('0x7')]=_[_0xf6f2('0x8')](config[_0xf6f2('0x7')],{'host':_0xf6f2('0x9'),'port':0x18eb});var socket=require(_0xf6f2('0xa'))(new Redis(config[_0xf6f2('0x7')]));require(_0xf6f2('0xb'))[_0xf6f2('0xc')](socket);function respondWithRpcPromise(_0x17ffd2,_0x55a260,_0x109271){return new BPromise(function(_0x266c6e,_0x2a4325){return client[_0xf6f2('0xd')](_0x17ffd2,_0x109271)['then'](function(_0x4ca76a){logger['info'](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));logger[_0xf6f2('0x10')](_0xf6f2('0x11'),_0x55a260,_0xf6f2('0xf'),JSON[_0xf6f2('0x12')](_0x4ca76a));if(_0x4ca76a['error']){if(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x14')]===0x1f4){logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')]['message']);return _0x2a4325(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}logger[_0xf6f2('0x13')](_0xf6f2('0xe'),_0x55a260,_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);return _0x266c6e(_0x4ca76a[_0xf6f2('0x13')][_0xf6f2('0x15')]);}else{logger[_0xf6f2('0x16')](_0xf6f2('0xe'),_0x55a260,_0xf6f2('0xf'));_0x266c6e(_0x4ca76a[_0xf6f2('0x17')][_0xf6f2('0x15')]);}})[_0xf6f2('0x18')](function(_0xb05611){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x55a260,_0xb05611);_0x2a4325(_0xb05611);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0372069..18d4324 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 _0x0f69=['openchannelAccount:','remove','emit','removeListener','length'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0f69,0x173));var _0x90f6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0f69[_0x2070da];return _0x4f9fe1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x90f6('0x0'),'update'];function createListener(_0x3716f4,_0xac4ba6){return function(_0x4a1481){_0xac4ba6[_0x90f6('0x1')](_0x3716f4,_0x4a1481);};}function removeListener(_0x86022b,_0x4adecb){return function(){OpenchannelAccountEvents[_0x90f6('0x2')](_0x86022b,_0x4adecb);};}exports['register']=function(_0x1840a5){for(var _0x3dfd95=0x0,_0x45657d=events[_0x90f6('0x3')];_0x3dfd95<_0x45657d;_0x3dfd95++){var _0x3bc2eb=events[_0x3dfd95];var _0x42044f=createListener(_0x90f6('0x4')+_0x3bc2eb,_0x1840a5);OpenchannelAccountEvents['on'](_0x3bc2eb,_0x42044f);}}; \ No newline at end of file +var _0x902b=['register','./openchannelAccount.events','remove','update','emit'];(function(_0x57c1c7,_0x5f0cde){var _0x5b2f7d=function(_0x46fe04){while(--_0x46fe04){_0x57c1c7['push'](_0x57c1c7['shift']());}};_0x5b2f7d(++_0x5f0cde);}(_0x902b,0x6a));var _0xb902=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x902b[_0x500419];return _0x241c1a;};'use strict';var OpenchannelAccountEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){OpenchannelAccountEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('openchannelAccount:'+_0x5b0b74,_0x5d38bb);OpenchannelAccountEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index eaf67da..39eda93 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 _0xa259=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x305546,_0x57ec85){var _0x528d83=function(_0x26ddd2){while(--_0x26ddd2){_0x305546['push'](_0x305546['shift']());}};_0x528d83(++_0x57ec85);}(_0xa259,0x94));var _0x9a25=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xa259[_0x5a6644];return _0x3a2a5d;};'use strict';var multer=require('multer');var util=require(_0x9a25('0x0'));var path=require(_0x9a25('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a25('0x2'));var router=express[_0x9a25('0x3')]();var fs_extra=require(_0x9a25('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a25('0x5'));var controller=require('./openchannelApplication.controller');router[_0x9a25('0x6')]('/',auth[_0x9a25('0x7')](),controller[_0x9a25('0x8')]);router['get'](_0x9a25('0x9'),auth[_0x9a25('0x7')](),controller[_0x9a25('0xa')]);router[_0x9a25('0xb')]('/',auth[_0x9a25('0x7')](),controller[_0x9a25('0xc')]);router['put'](_0x9a25('0x9'),auth[_0x9a25('0x7')](),controller['update']);router[_0x9a25('0xd')](_0x9a25('0x9'),auth[_0x9a25('0x7')](),controller[_0x9a25('0xe')]);module[_0x9a25('0xf')]=router; \ No newline at end of file +var _0x3c70=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','post','create','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x3c70,0xb1));var _0x03c7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3c70[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var path=require('path');var timeout=require(_0x03c7('0x2'));var express=require('express');var router=express[_0x03c7('0x3')]();var fs_extra=require(_0x03c7('0x4'));var auth=require(_0x03c7('0x5'));var interaction=require(_0x03c7('0x6'));var config=require(_0x03c7('0x7'));var controller=require(_0x03c7('0x8'));router[_0x03c7('0x9')]('/',auth[_0x03c7('0xa')](),controller[_0x03c7('0xb')]);router['get']('/:id',auth[_0x03c7('0xa')](),controller['show']);router[_0x03c7('0xc')]('/',auth[_0x03c7('0xa')](),controller[_0x03c7('0xd')]);router[_0x03c7('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x03c7('0xf'),auth[_0x03c7('0xa')](),controller[_0x03c7('0x10')]);module[_0x03c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 949e317..63b0d54 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 _0xf005=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x28f492,_0x2cd381){var _0x26ceee=function(_0x338b45){while(--_0x338b45){_0x28f492['push'](_0x28f492['shift']());}};_0x26ceee(++_0x2cd381);}(_0xf005,0xb0));var _0x5f00=function(_0x133e43,_0x1e452d){_0x133e43=_0x133e43-0x0;var _0xa1b744=_0xf005[_0x133e43];return _0xa1b744;};'use strict';var Sequelize=require(_0x5f00('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5f00('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5f00('0x2')],'allowNull':![],'defaultValue':_0x5f00('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5f00('0x2')]},'interval':{'type':Sequelize[_0x5f00('0x2')],'defaultValue':_0x5f00('0x4')}}; \ No newline at end of file +var _0x1fe0=['STRING','*,*,*,*','sequelize'];(function(_0x72da07,_0x45bf5d){var _0x2415fc=function(_0x4a39b2){while(--_0x4a39b2){_0x72da07['push'](_0x72da07['shift']());}};_0x2415fc(++_0x45bf5d);}(_0x1fe0,0xfe));var _0x01fe=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x1fe0[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x01fe('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x01fe('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x01fe('0x1')]},'interval':{'type':Sequelize[_0x01fe('0x1')],'defaultValue':_0x01fe('0x2')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 8bd5495..0d3c9cc 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 _0xcf42=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','set','apply','reject','update','then','destroy','sendStatus','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','fast-json-patch','bluebird','util'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xcf42,0x164));var _0x2cf4=function(_0x29d2b7,_0x2b20b8){_0x29d2b7=_0x29d2b7-0x0;var _0x5edc7f=_0xcf42[_0x29d2b7];return _0x5edc7f;};'use strict';var emlformat=require(_0x2cf4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2cf4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2cf4('0x2'));var Mustache=require('mustache');var util=require(_0x2cf4('0x3'));var path=require(_0x2cf4('0x4'));var sox=require(_0x2cf4('0x5'));var csv=require(_0x2cf4('0x6'));var ejs=require(_0x2cf4('0x7'));var fs=require('fs');var fs_extra=require(_0x2cf4('0x8'));var _=require(_0x2cf4('0x9'));var squel=require('squel');var crypto=require(_0x2cf4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2cf4('0xb'));var toCsv=require(_0x2cf4('0x6'));var querystring=require(_0x2cf4('0xc'));var Papa=require(_0x2cf4('0xd'));var Redis=require(_0x2cf4('0xe'));var authService=require(_0x2cf4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cf4('0x10'))(_0x2cf4('0x11'));var utils=require(_0x2cf4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2cf4('0x13'));var db=require(_0x2cf4('0x14'))['db'];function respondWithStatusCode(_0xc33db6,_0x448272){_0x448272=_0x448272||0xcc;return function(_0x186fd7){if(_0x186fd7){return _0xc33db6['sendStatus'](_0x448272);}return _0xc33db6['status'](_0x448272)[_0x2cf4('0x15')]();};}function respondWithResult(_0x2814a6,_0x5efa7f){_0x5efa7f=_0x5efa7f||0xc8;return function(_0x203861){if(_0x203861){return _0x2814a6[_0x2cf4('0x16')](_0x5efa7f)[_0x2cf4('0x17')](_0x203861);}};}function respondWithFilteredResult(_0x1a96c4,_0x449f55){return function(_0x5eda88){if(_0x5eda88){var _0x1c1dec=typeof _0x449f55['offset']===_0x2cf4('0x18')&&typeof _0x449f55['limit']===_0x2cf4('0x18');var _0x5df0da=_0x5eda88[_0x2cf4('0x19')];var _0x1d0e56=_0x1c1dec?0x0:_0x449f55['offset'];var _0x60c5fd=_0x1c1dec?_0x5eda88[_0x2cf4('0x19')]:_0x449f55[_0x2cf4('0x1a')]+_0x449f55['limit'];var _0x2563d2;if(_0x60c5fd>=_0x5df0da){_0x60c5fd=_0x5df0da;_0x2563d2=0xc8;}else{_0x2563d2=0xce;}_0x1a96c4[_0x2cf4('0x16')](_0x2563d2);return _0x1a96c4[_0x2cf4('0x1b')]('Content-Range',_0x1d0e56+'-'+_0x60c5fd+'/'+_0x5df0da)[_0x2cf4('0x17')](_0x5eda88);}return null;};}function patchUpdates(_0x12c2d7){return function(_0x38e74b){try{jsonpatch[_0x2cf4('0x1c')](_0x38e74b,_0x12c2d7,!![]);}catch(_0x290419){return BPromise[_0x2cf4('0x1d')](_0x290419);}return _0x38e74b['save']();};}function saveUpdates(_0xe5d7f7,_0x2462b6){return function(_0x29e335){if(_0x29e335){return _0x29e335[_0x2cf4('0x1e')](_0xe5d7f7)[_0x2cf4('0x1f')](function(_0x591205){return _0x591205;});}return null;};}function removeEntity(_0x4f3bb5,_0x379f96){return function(_0x1c6b25){if(_0x1c6b25){return _0x1c6b25[_0x2cf4('0x20')]()['then'](function(){_0x4f3bb5['status'](0xcc)[_0x2cf4('0x15')]();});}};}function handleEntityNotFound(_0x115849,_0x2c80f3){return function(_0x239128){if(!_0x239128){_0x115849[_0x2cf4('0x21')](0x194);}return _0x239128;};}function handleError(_0xb8d0be,_0x203286){_0x203286=_0x203286||0x1f4;return function(_0x4793c6){logger['error'](_0x4793c6[_0x2cf4('0x22')]);if(_0x4793c6[_0x2cf4('0x23')]){delete _0x4793c6[_0x2cf4('0x23')];}_0xb8d0be[_0x2cf4('0x16')](_0x203286)['send'](_0x4793c6);};}exports[_0x2cf4('0x24')]=function(_0x3b3466,_0x4869a6){var _0x4b8356={},_0x346ab7={},_0x1f091d={'count':0x0,'rows':[]};var _0x45bda4=_['map'](db[_0x2cf4('0x25')][_0x2cf4('0x26')],function(_0x2e2708){return{'name':_0x2e2708[_0x2cf4('0x27')],'type':_0x2e2708[_0x2cf4('0x28')][_0x2cf4('0x29')]};});_0x346ab7[_0x2cf4('0x2a')]=_[_0x2cf4('0x2b')](_0x45bda4,_0x2cf4('0x23'));_0x346ab7[_0x2cf4('0x2c')]=_[_0x2cf4('0x2d')](_0x3b3466['query']);_0x346ab7[_0x2cf4('0x2e')]=_[_0x2cf4('0x2f')](_0x346ab7[_0x2cf4('0x2a')],_0x346ab7[_0x2cf4('0x2c')]);_0x4b8356[_0x2cf4('0x30')]=_[_0x2cf4('0x2f')](_0x346ab7[_0x2cf4('0x2a')],qs[_0x2cf4('0x31')](_0x3b3466[_0x2cf4('0x2c')]['fields']));_0x4b8356[_0x2cf4('0x30')]=_0x4b8356[_0x2cf4('0x30')][_0x2cf4('0x32')]?_0x4b8356[_0x2cf4('0x30')]:_0x346ab7[_0x2cf4('0x2a')];if(!_0x3b3466['query'][_0x2cf4('0x33')](_0x2cf4('0x34'))){_0x4b8356['limit']=qs[_0x2cf4('0x35')](_0x3b3466[_0x2cf4('0x2c')][_0x2cf4('0x35')]);_0x4b8356[_0x2cf4('0x1a')]=qs[_0x2cf4('0x1a')](_0x3b3466[_0x2cf4('0x2c')]['offset']);}_0x4b8356[_0x2cf4('0x36')]=qs[_0x2cf4('0x37')](_0x3b3466[_0x2cf4('0x2c')][_0x2cf4('0x37')]);_0x4b8356['where']=qs[_0x2cf4('0x2e')](_[_0x2cf4('0x38')](_0x3b3466['query'],_0x346ab7[_0x2cf4('0x2e')]),_0x45bda4);if(_0x3b3466['query'][_0x2cf4('0x39')]){_0x4b8356['where']=_[_0x2cf4('0x3a')](_0x4b8356[_0x2cf4('0x3b')],{'$or':_[_0x2cf4('0x2b')](_0x45bda4,function(_0x7eca45){if(_0x7eca45['type']!==_0x2cf4('0x3c')){var _0x45a964={};_0x45a964[_0x7eca45['name']]={'$like':'%'+_0x3b3466[_0x2cf4('0x2c')]['filter']+'%'};return _0x45a964;}})});}_0x4b8356=_[_0x2cf4('0x3a')]({},_0x4b8356,_0x3b3466[_0x2cf4('0x3d')]);var _0xce6d5a={'where':_0x4b8356[_0x2cf4('0x3b')]};return db[_0x2cf4('0x25')][_0x2cf4('0x19')](_0xce6d5a)[_0x2cf4('0x1f')](function(_0x11265c){_0x1f091d[_0x2cf4('0x19')]=_0x11265c;if(_0x3b3466[_0x2cf4('0x2c')][_0x2cf4('0x3e')]){_0x4b8356[_0x2cf4('0x3f')]=[{'all':!![]}];}return db[_0x2cf4('0x25')][_0x2cf4('0x40')](_0x4b8356);})[_0x2cf4('0x1f')](function(_0xfd5554){_0x1f091d[_0x2cf4('0x41')]=_0xfd5554;return _0x1f091d;})[_0x2cf4('0x1f')](respondWithFilteredResult(_0x4869a6,_0x4b8356))['catch'](handleError(_0x4869a6,null));};exports[_0x2cf4('0x42')]=function(_0x837b2f,_0x4dfd27){var _0x5ca12e={'raw':!![],'where':{'id':_0x837b2f[_0x2cf4('0x43')]['id']}},_0x35006e={};_0x35006e['model']=_[_0x2cf4('0x2d')](db[_0x2cf4('0x25')][_0x2cf4('0x26')]);_0x35006e[_0x2cf4('0x2c')]=_[_0x2cf4('0x2d')](_0x837b2f[_0x2cf4('0x2c')]);_0x35006e[_0x2cf4('0x2e')]=_[_0x2cf4('0x2f')](_0x35006e[_0x2cf4('0x2a')],_0x35006e[_0x2cf4('0x2c')]);_0x5ca12e['attributes']=_[_0x2cf4('0x2f')](_0x35006e[_0x2cf4('0x2a')],qs[_0x2cf4('0x31')](_0x837b2f['query']['fields']));_0x5ca12e[_0x2cf4('0x30')]=_0x5ca12e[_0x2cf4('0x30')]['length']?_0x5ca12e[_0x2cf4('0x30')]:_0x35006e['model'];if(_0x837b2f['query'][_0x2cf4('0x3e')]){_0x5ca12e[_0x2cf4('0x3f')]=[{'all':!![]}];}_0x5ca12e=_[_0x2cf4('0x3a')]({},_0x5ca12e,_0x837b2f[_0x2cf4('0x3d')]);return db[_0x2cf4('0x25')][_0x2cf4('0x44')](_0x5ca12e)[_0x2cf4('0x1f')](handleEntityNotFound(_0x4dfd27,null))['then'](respondWithResult(_0x4dfd27,null))[_0x2cf4('0x45')](handleError(_0x4dfd27,null));};exports[_0x2cf4('0x46')]=function(_0x3b9a25,_0xaabc8e){return db[_0x2cf4('0x25')][_0x2cf4('0x46')](_0x3b9a25['body'],{})[_0x2cf4('0x1f')](respondWithResult(_0xaabc8e,0xc9))['catch'](handleError(_0xaabc8e,null));};exports[_0x2cf4('0x1e')]=function(_0xa92bbd,_0x242589){if(_0xa92bbd[_0x2cf4('0x47')]['id']){delete _0xa92bbd[_0x2cf4('0x47')]['id'];}return db[_0x2cf4('0x25')][_0x2cf4('0x44')]({'where':{'id':_0xa92bbd['params']['id']}})[_0x2cf4('0x1f')](handleEntityNotFound(_0x242589,null))[_0x2cf4('0x1f')](saveUpdates(_0xa92bbd[_0x2cf4('0x47')],null))[_0x2cf4('0x1f')](respondWithResult(_0x242589,null))[_0x2cf4('0x45')](handleError(_0x242589,null));};exports[_0x2cf4('0x20')]=function(_0xf98a40,_0x134686){return db[_0x2cf4('0x25')][_0x2cf4('0x44')]({'where':{'id':_0xf98a40[_0x2cf4('0x43')]['id']}})['then'](handleEntityNotFound(_0x134686,null))[_0x2cf4('0x1f')](removeEntity(_0x134686,null))['catch'](handleError(_0x134686,null));}; \ No newline at end of file +var _0x15ad=['VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','error','stack','send','map','OpenchannelApplication','fieldName','type','key','model','name','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x255f64,_0x3e2d77){var _0x23934e=function(_0x29d24c){while(--_0x29d24c){_0x255f64['push'](_0x255f64['shift']());}};_0x23934e(++_0x3e2d77);}(_0x15ad,0xa2));var _0xd15a=function(_0x2bad7e,_0x147afd){_0x2bad7e=_0x2bad7e-0x0;var _0x4ba8c0=_0x15ad[_0x2bad7e];return _0x4ba8c0;};'use strict';var emlformat=require(_0xd15a('0x0'));var rimraf=require(_0xd15a('0x1'));var zipdir=require(_0xd15a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd15a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd15a('0x4'));var util=require(_0xd15a('0x5'));var path=require(_0xd15a('0x6'));var sox=require('sox');var csv=require(_0xd15a('0x7'));var ejs=require(_0xd15a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd15a('0x9'));var crypto=require(_0xd15a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd15a('0xb'));var toCsv=require(_0xd15a('0x7'));var querystring=require(_0xd15a('0xc'));var Papa=require(_0xd15a('0xd'));var Redis=require(_0xd15a('0xe'));var authService=require(_0xd15a('0xf'));var qs=require(_0xd15a('0x10'));var as=require(_0xd15a('0x11'));var hardwareService=require(_0xd15a('0x12'));var logger=require(_0xd15a('0x13'))(_0xd15a('0x14'));var utils=require(_0xd15a('0x15'));var config=require(_0xd15a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd15a('0x17'))['db'];function respondWithStatusCode(_0x1c5dd2,_0x2f0855){_0x2f0855=_0x2f0855||0xcc;return function(_0x3811ed){if(_0x3811ed){return _0x1c5dd2[_0xd15a('0x18')](_0x2f0855);}return _0x1c5dd2[_0xd15a('0x19')](_0x2f0855)[_0xd15a('0x1a')]();};}function respondWithResult(_0xf269a6,_0x4b3fef){_0x4b3fef=_0x4b3fef||0xc8;return function(_0x4d91b2){if(_0x4d91b2){return _0xf269a6['status'](_0x4b3fef)[_0xd15a('0x1b')](_0x4d91b2);}};}function respondWithFilteredResult(_0x47c1dd,_0x29e529){return function(_0x7f4e33){if(_0x7f4e33){var _0x41f4aa=typeof _0x29e529['offset']===_0xd15a('0x1c')&&typeof _0x29e529[_0xd15a('0x1d')]==='undefined';var _0x56aea5=_0x7f4e33['count'];var _0x33a473=_0x41f4aa?0x0:_0x29e529[_0xd15a('0x1e')];var _0x4233ba=_0x41f4aa?_0x7f4e33[_0xd15a('0x1f')]:_0x29e529['offset']+_0x29e529['limit'];var _0x517856;if(_0x4233ba>=_0x56aea5){_0x4233ba=_0x56aea5;_0x517856=0xc8;}else{_0x517856=0xce;}_0x47c1dd[_0xd15a('0x19')](_0x517856);return _0x47c1dd[_0xd15a('0x20')](_0xd15a('0x21'),_0x33a473+'-'+_0x4233ba+'/'+_0x56aea5)[_0xd15a('0x1b')](_0x7f4e33);}return null;};}function patchUpdates(_0x2db901){return function(_0xa18d76){try{jsonpatch['apply'](_0xa18d76,_0x2db901,!![]);}catch(_0x4f9f59){return BPromise[_0xd15a('0x22')](_0x4f9f59);}return _0xa18d76[_0xd15a('0x23')]();};}function saveUpdates(_0x2f4827,_0x5c1388){return function(_0x1accc2){if(_0x1accc2){return _0x1accc2['update'](_0x2f4827)[_0xd15a('0x24')](function(_0x10371b){return _0x10371b;});}return null;};}function removeEntity(_0x19ab86,_0x45cac6){return function(_0x5637cf){if(_0x5637cf){return _0x5637cf['destroy']()[_0xd15a('0x24')](function(){_0x19ab86[_0xd15a('0x19')](0xcc)[_0xd15a('0x1a')]();});}};}function handleEntityNotFound(_0x177595,_0x5e215d){return function(_0x3ed4a6){if(!_0x3ed4a6){_0x177595[_0xd15a('0x18')](0x194);}return _0x3ed4a6;};}function handleError(_0xf933bb,_0x3bf1c7){_0x3bf1c7=_0x3bf1c7||0x1f4;return function(_0x2512e3){logger[_0xd15a('0x25')](_0x2512e3[_0xd15a('0x26')]);if(_0x2512e3['name']){delete _0x2512e3['name'];}_0xf933bb[_0xd15a('0x19')](_0x3bf1c7)[_0xd15a('0x27')](_0x2512e3);};}exports['index']=function(_0x1bbdc1,_0x5730ed){var _0x5cd1ff={},_0xf51a7a={},_0x48b201={'count':0x0,'rows':[]};var _0x2c5db7=_[_0xd15a('0x28')](db[_0xd15a('0x29')]['rawAttributes'],function(_0xe4f25c){return{'name':_0xe4f25c[_0xd15a('0x2a')],'type':_0xe4f25c[_0xd15a('0x2b')][_0xd15a('0x2c')]};});_0xf51a7a[_0xd15a('0x2d')]=_[_0xd15a('0x28')](_0x2c5db7,_0xd15a('0x2e'));_0xf51a7a['query']=_['keys'](_0x1bbdc1[_0xd15a('0x2f')]);_0xf51a7a['filters']=_['intersection'](_0xf51a7a[_0xd15a('0x2d')],_0xf51a7a[_0xd15a('0x2f')]);_0x5cd1ff[_0xd15a('0x30')]=_[_0xd15a('0x31')](_0xf51a7a[_0xd15a('0x2d')],qs[_0xd15a('0x32')](_0x1bbdc1['query'][_0xd15a('0x32')]));_0x5cd1ff[_0xd15a('0x30')]=_0x5cd1ff[_0xd15a('0x30')][_0xd15a('0x33')]?_0x5cd1ff[_0xd15a('0x30')]:_0xf51a7a['model'];if(!_0x1bbdc1[_0xd15a('0x2f')]['hasOwnProperty'](_0xd15a('0x34'))){_0x5cd1ff[_0xd15a('0x1d')]=qs[_0xd15a('0x1d')](_0x1bbdc1['query'][_0xd15a('0x1d')]);_0x5cd1ff['offset']=qs['offset'](_0x1bbdc1[_0xd15a('0x2f')]['offset']);}_0x5cd1ff[_0xd15a('0x35')]=qs[_0xd15a('0x36')](_0x1bbdc1[_0xd15a('0x2f')][_0xd15a('0x36')]);_0x5cd1ff[_0xd15a('0x37')]=qs[_0xd15a('0x38')](_[_0xd15a('0x39')](_0x1bbdc1[_0xd15a('0x2f')],_0xf51a7a[_0xd15a('0x38')]),_0x2c5db7);if(_0x1bbdc1[_0xd15a('0x2f')][_0xd15a('0x3a')]){_0x5cd1ff[_0xd15a('0x37')]=_[_0xd15a('0x3b')](_0x5cd1ff[_0xd15a('0x37')],{'$or':_[_0xd15a('0x28')](_0x2c5db7,function(_0x5ed9c2){if(_0x5ed9c2[_0xd15a('0x2b')]!==_0xd15a('0x3c')){var _0x167037={};_0x167037[_0x5ed9c2[_0xd15a('0x2e')]]={'$like':'%'+_0x1bbdc1[_0xd15a('0x2f')]['filter']+'%'};return _0x167037;}})});}_0x5cd1ff=_[_0xd15a('0x3b')]({},_0x5cd1ff,_0x1bbdc1[_0xd15a('0x3d')]);var _0x4c37fa={'where':_0x5cd1ff[_0xd15a('0x37')]};return db[_0xd15a('0x29')][_0xd15a('0x1f')](_0x4c37fa)[_0xd15a('0x24')](function(_0x2e9221){_0x48b201[_0xd15a('0x1f')]=_0x2e9221;if(_0x1bbdc1['query'][_0xd15a('0x3e')]){_0x5cd1ff['include']=[{'all':!![]}];}return db[_0xd15a('0x29')][_0xd15a('0x3f')](_0x5cd1ff);})[_0xd15a('0x24')](function(_0x1c677c){_0x48b201[_0xd15a('0x40')]=_0x1c677c;return _0x48b201;})[_0xd15a('0x24')](respondWithFilteredResult(_0x5730ed,_0x5cd1ff))[_0xd15a('0x41')](handleError(_0x5730ed,null));};exports[_0xd15a('0x42')]=function(_0x52492c,_0x597a97){var _0x18303f={'raw':!![],'where':{'id':_0x52492c[_0xd15a('0x43')]['id']}},_0xe1499b={};_0xe1499b[_0xd15a('0x2d')]=_['keys'](db[_0xd15a('0x29')][_0xd15a('0x44')]);_0xe1499b[_0xd15a('0x2f')]=_['keys'](_0x52492c['query']);_0xe1499b[_0xd15a('0x38')]=_[_0xd15a('0x31')](_0xe1499b['model'],_0xe1499b[_0xd15a('0x2f')]);_0x18303f['attributes']=_[_0xd15a('0x31')](_0xe1499b[_0xd15a('0x2d')],qs[_0xd15a('0x32')](_0x52492c['query'][_0xd15a('0x32')]));_0x18303f[_0xd15a('0x30')]=_0x18303f['attributes'][_0xd15a('0x33')]?_0x18303f[_0xd15a('0x30')]:_0xe1499b[_0xd15a('0x2d')];if(_0x52492c[_0xd15a('0x2f')][_0xd15a('0x3e')]){_0x18303f[_0xd15a('0x45')]=[{'all':!![]}];}_0x18303f=_[_0xd15a('0x3b')]({},_0x18303f,_0x52492c[_0xd15a('0x3d')]);return db['OpenchannelApplication'][_0xd15a('0x46')](_0x18303f)[_0xd15a('0x24')](handleEntityNotFound(_0x597a97,null))['then'](respondWithResult(_0x597a97,null))[_0xd15a('0x41')](handleError(_0x597a97,null));};exports['create']=function(_0x23d4f3,_0x3d5612){return db['OpenchannelApplication'][_0xd15a('0x47')](_0x23d4f3[_0xd15a('0x48')],{})[_0xd15a('0x24')](respondWithResult(_0x3d5612,0xc9))[_0xd15a('0x41')](handleError(_0x3d5612,null));};exports[_0xd15a('0x49')]=function(_0x34c6d2,_0x18ded8){if(_0x34c6d2[_0xd15a('0x48')]['id']){delete _0x34c6d2['body']['id'];}return db[_0xd15a('0x29')]['find']({'where':{'id':_0x34c6d2[_0xd15a('0x43')]['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x18ded8,null))[_0xd15a('0x24')](saveUpdates(_0x34c6d2[_0xd15a('0x48')],null))[_0xd15a('0x24')](respondWithResult(_0x18ded8,null))['catch'](handleError(_0x18ded8,null));};exports['destroy']=function(_0x5555ca,_0x8fb6e0){return db[_0xd15a('0x29')][_0xd15a('0x46')]({'where':{'id':_0x5555ca['params']['id']}})[_0xd15a('0x24')](handleEntityNotFound(_0x8fb6e0,null))['then'](removeEntity(_0x8fb6e0,null))[_0xd15a('0x41')](handleError(_0x8fb6e0,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2ebb727..7ac3a05 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 _0xfabe=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1c079a,_0x252619){var _0x50d0d2=function(_0x5f26a6){while(--_0x5f26a6){_0x1c079a['push'](_0x1c079a['shift']());}};_0x50d0d2(++_0x252619);}(_0xfabe,0x187));var _0xefab=function(_0x242cd8,_0x476de5){_0x242cd8=_0x242cd8-0x0;var _0x5d0251=_0xfabe[_0x242cd8];return _0x5d0251;};'use strict';var _=require(_0xefab('0x0'));var util=require(_0xefab('0x1'));var logger=require(_0xefab('0x2'))('api');var moment=require(_0xefab('0x3'));var BPromise=require(_0xefab('0x4'));var rp=require(_0xefab('0x5'));var fs=require('fs');var path=require(_0xefab('0x6'));var rimraf=require('rimraf');var config=require(_0xefab('0x7'));var attributes=require(_0xefab('0x8'));module[_0xefab('0x9')]=function(_0x560db6,_0x1806c7){return _0x560db6[_0xefab('0xa')](_0xefab('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefab('0xc'),'collate':_0xefab('0xd')});}; \ No newline at end of file +var _0xf845=['exports','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x4e1e2b,_0x1d9b58){var _0x535ab1=function(_0x2f73ea){while(--_0x2f73ea){_0x4e1e2b['push'](_0x4e1e2b['shift']());}};_0x535ab1(++_0x1d9b58);}(_0xf845,0x178));var _0x5f84=function(_0x36e93b,_0x3b9e91){_0x36e93b=_0x36e93b-0x0;var _0xb24066=_0xf845[_0x36e93b];return _0xb24066;};'use strict';var _=require('lodash');var util=require(_0x5f84('0x0'));var logger=require(_0x5f84('0x1'))(_0x5f84('0x2'));var moment=require('moment');var BPromise=require(_0x5f84('0x3'));var rp=require(_0x5f84('0x4'));var fs=require('fs');var path=require(_0x5f84('0x5'));var rimraf=require('rimraf');var config=require(_0x5f84('0x6'));var attributes=require(_0x5f84('0x7'));module[_0x5f84('0x8')]=function(_0x46b7ca,_0x352fe5){return _0x46b7ca['define'](_0x5f84('0x9'),attributes,{'tableName':_0x5f84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f84('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e8b328d..b83177e 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 _0xe2d7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','limit','stringify','catch','lodash','util','moment'];(function(_0x2e6545,_0x2f1a57){var _0x100804=function(_0x2772cb){while(--_0x2772cb){_0x2e6545['push'](_0x2e6545['shift']());}};_0x100804(++_0x2f1a57);}(_0xe2d7,0x147));var _0x7e2d=function(_0x2bb5ad,_0x48f6c6){_0x2bb5ad=_0x2bb5ad-0x0;var _0x589179=_0xe2d7[_0x2bb5ad];return _0x589179;};'use strict';var _=require(_0x7e2d('0x0'));var util=require(_0x7e2d('0x1'));var moment=require(_0x7e2d('0x2'));var BPromise=require(_0x7e2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e2d('0x4'));var db=require(_0x7e2d('0x5'))['db'];var utils=require(_0x7e2d('0x6'));var logger=require(_0x7e2d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e2d('0x8'));var client=jayson[_0x7e2d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dfad0,_0x394c76,_0x2b641c){return new BPromise(function(_0x144e92,_0x554c97){return client[_0x7e2d('0xa')](_0x3dfad0,_0x2b641c)[_0x7e2d('0xb')](function(_0x5e27f7){logger[_0x7e2d('0xc')](_0x7e2d('0xd'),_0x394c76,_0x7e2d('0xe'));logger[_0x7e2d('0xf')](_0x7e2d('0x10'),_0x394c76,_0x7e2d('0xe'),JSON['stringify'](_0x5e27f7));if(_0x5e27f7['error']){if(_0x5e27f7[_0x7e2d('0x11')][_0x7e2d('0x12')]===0x1f4){logger[_0x7e2d('0x11')](_0x7e2d('0xd'),_0x394c76,_0x5e27f7[_0x7e2d('0x11')][_0x7e2d('0x13')]);return _0x554c97(_0x5e27f7[_0x7e2d('0x11')][_0x7e2d('0x13')]);}logger[_0x7e2d('0x11')](_0x7e2d('0xd'),_0x394c76,_0x5e27f7[_0x7e2d('0x11')][_0x7e2d('0x13')]);return _0x144e92(_0x5e27f7[_0x7e2d('0x11')]['message']);}else{logger[_0x7e2d('0xc')](_0x7e2d('0xd'),_0x394c76,_0x7e2d('0xe'));_0x144e92(_0x5e27f7[_0x7e2d('0x14')][_0x7e2d('0x13')]);}})['catch'](function(_0x5ef34c){logger['error'](_0x7e2d('0xd'),_0x394c76,_0x5ef34c);_0x554c97(_0x5ef34c);});});}exports[_0x7e2d('0x15')]=function(_0x4fa077){var _0x5a327f=this;return new Promise(function(_0x2a7136,_0x1a6133){return db[_0x7e2d('0x16')]['update'](_0x4fa077[_0x7e2d('0x17')],{'raw':_0x4fa077[_0x7e2d('0x18')]?_0x4fa077[_0x7e2d('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fa077[_0x7e2d('0x18')]?_0x4fa077[_0x7e2d('0x18')][_0x7e2d('0x19')]||null:null,'attributes':_0x4fa077[_0x7e2d('0x18')]?_0x4fa077[_0x7e2d('0x18')][_0x7e2d('0x1a')]||null:null,'limit':_0x4fa077[_0x7e2d('0x18')]?_0x4fa077[_0x7e2d('0x18')][_0x7e2d('0x1b')]||null:null})['then'](function(_0x5aa92d){logger['info']('UpdateOpenchannelApplication',_0x4fa077);logger['debug'](_0x7e2d('0x15'),_0x4fa077,JSON[_0x7e2d('0x1c')](_0x5aa92d));_0x2a7136(_0x5aa92d);})[_0x7e2d('0x1d')](function(_0x437184){logger[_0x7e2d('0x11')](_0x7e2d('0x15'),_0x437184[_0x7e2d('0x13')],_0x4fa077);_0x1a6133(_0x5a327f[_0x7e2d('0x11')](0x1f4,_0x437184['message']));});});}; \ No newline at end of file +var _0xc479=['body','options','raw','where','attributes','limit','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','catch','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x464d29,_0x43bceb){var _0x5dd094=function(_0x16ab4b){while(--_0x16ab4b){_0x464d29['push'](_0x464d29['shift']());}};_0x5dd094(++_0x43bceb);}(_0xc479,0xc7));var _0x9c47=function(_0x261355,_0x5dabff){_0x261355=_0x261355-0x0;var _0x4f8c06=_0xc479[_0x261355];return _0x4f8c06;};'use strict';var _=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));var moment=require(_0x9c47('0x2'));var BPromise=require(_0x9c47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c47('0x4'));var db=require(_0x9c47('0x5'))['db'];var utils=require(_0x9c47('0x6'));var logger=require(_0x9c47('0x7'))('rpc');var config=require(_0x9c47('0x8'));var jayson=require(_0x9c47('0x9'));var client=jayson[_0x9c47('0xa')][_0x9c47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4afc60,_0x43a9e9,_0x3edddb){return new BPromise(function(_0xef238e,_0x38ee9c){return client[_0x9c47('0xc')](_0x4afc60,_0x3edddb)[_0x9c47('0xd')](function(_0x77407b){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x43a9e9,_0x9c47('0xe'));logger[_0x9c47('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x43a9e9,_0x9c47('0xe'),JSON[_0x9c47('0x10')](_0x77407b));if(_0x77407b[_0x9c47('0x11')]){if(_0x77407b['error'][_0x9c47('0x12')]===0x1f4){logger[_0x9c47('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x43a9e9,_0x77407b[_0x9c47('0x11')]['message']);return _0x38ee9c(_0x77407b[_0x9c47('0x11')][_0x9c47('0x13')]);}logger[_0x9c47('0x11')](_0x9c47('0x14'),_0x43a9e9,_0x77407b[_0x9c47('0x11')][_0x9c47('0x13')]);return _0xef238e(_0x77407b['error']['message']);}else{logger['info'](_0x9c47('0x14'),_0x43a9e9,'request\x20sent');_0xef238e(_0x77407b['result'][_0x9c47('0x13')]);}})[_0x9c47('0x15')](function(_0x3a4db7){logger[_0x9c47('0x11')](_0x9c47('0x14'),_0x43a9e9,_0x3a4db7);_0x38ee9c(_0x3a4db7);});});}exports[_0x9c47('0x16')]=function(_0x104a1d){var _0x452c43=this;return new Promise(function(_0x1f015b,_0x4cd459){return db[_0x9c47('0x17')][_0x9c47('0x18')](_0x104a1d[_0x9c47('0x19')],{'raw':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1c')]||null:null,'attributes':_0x104a1d[_0x9c47('0x1a')]?_0x104a1d[_0x9c47('0x1a')][_0x9c47('0x1d')]||null:null,'limit':_0x104a1d['options']?_0x104a1d['options'][_0x9c47('0x1e')]||null:null})[_0x9c47('0xd')](function(_0x179441){logger[_0x9c47('0x1f')](_0x9c47('0x16'),_0x104a1d);logger['debug']('UpdateOpenchannelApplication',_0x104a1d,JSON[_0x9c47('0x10')](_0x179441));_0x1f015b(_0x179441);})['catch'](function(_0x126724){logger[_0x9c47('0x11')](_0x9c47('0x16'),_0x126724[_0x9c47('0x13')],_0x104a1d);_0x4cd459(_0x452c43['error'](0x1f4,_0x126724[_0x9c47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 19280e1..97fff69 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 _0x3ae9=['removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete'];(function(_0x11ae64,_0x4cc76d){var _0x4a82ac=function(_0x385793){while(--_0x385793){_0x11ae64['push'](_0x11ae64['shift']());}};_0x4a82ac(++_0x4cc76d);}(_0x3ae9,0xc8));var _0x93ae=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3ae9[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x93ae('0x0'));var util=require(_0x93ae('0x1'));var path=require('path');var timeout=require(_0x93ae('0x2'));var express=require(_0x93ae('0x3'));var router=express[_0x93ae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93ae('0x6'));var controller=require(_0x93ae('0x7'));router[_0x93ae('0x8')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xa')]);router[_0x93ae('0x8')](_0x93ae('0xb'),auth[_0x93ae('0x9')](),controller[_0x93ae('0xc')]);router[_0x93ae('0x8')](_0x93ae('0xd'),auth[_0x93ae('0x9')](),controller[_0x93ae('0xe')]);router[_0x93ae('0x8')](_0x93ae('0xf'),auth[_0x93ae('0x9')](),controller['getMessages']);router['get'](_0x93ae('0x10'),auth[_0x93ae('0x9')](),controller[_0x93ae('0x11')]);router['post']('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0x12')]);router[_0x93ae('0x13')](_0x93ae('0xf'),auth[_0x93ae('0x9')](),controller[_0x93ae('0x14')]);router['post']('/:id/tags',auth[_0x93ae('0x9')](),interaction[_0x93ae('0x15')](_0x93ae('0x16'),_0x93ae('0x17')),controller[_0x93ae('0x18')]);router[_0x93ae('0x19')](_0x93ae('0xd'),auth['isAuthenticated'](),interaction[_0x93ae('0x15')]('openchannel',_0x93ae('0x1a')),controller[_0x93ae('0x1b')]);router['delete']('/:id',auth[_0x93ae('0x9')](),interaction[_0x93ae('0x15')](_0x93ae('0x16'),_0x93ae('0x1c')),controller[_0x93ae('0x1d')]);router[_0x93ae('0x1e')]('/:id/tags',auth[_0x93ae('0x9')](),controller[_0x93ae('0x1f')]);module[_0x93ae('0x20')]=router; \ No newline at end of file +var _0xde54=['addMessage','/:id/tags','tracked','openchannel','addTags','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x572b5d,_0x517b9e){var _0x31a9f8=function(_0x45ee7c){while(--_0x45ee7c){_0x572b5d['push'](_0x572b5d['shift']());}};_0x31a9f8(++_0x517b9e);}(_0xde54,0xe4));var _0x4de5=function(_0x18e9e3,_0x33ec06){_0x18e9e3=_0x18e9e3-0x0;var _0xcee7dc=_0xde54[_0x18e9e3];return _0xcee7dc;};'use strict';var multer=require(_0x4de5('0x0'));var util=require(_0x4de5('0x1'));var path=require(_0x4de5('0x2'));var timeout=require(_0x4de5('0x3'));var express=require(_0x4de5('0x4'));var router=express[_0x4de5('0x5')]();var fs_extra=require(_0x4de5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4de5('0x7'));var config=require('../../config/environment');var controller=require(_0x4de5('0x8'));router['get']('/',auth[_0x4de5('0x9')](),controller[_0x4de5('0xa')]);router[_0x4de5('0xb')](_0x4de5('0xc'),auth[_0x4de5('0x9')](),controller['describe']);router[_0x4de5('0xb')](_0x4de5('0xd'),auth[_0x4de5('0x9')](),controller[_0x4de5('0xe')]);router[_0x4de5('0xb')](_0x4de5('0xf'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x10')]);router[_0x4de5('0xb')]('/:id/download',auth[_0x4de5('0x9')](),controller[_0x4de5('0x11')]);router[_0x4de5('0x12')]('/',auth['isAuthenticated'](),controller[_0x4de5('0x13')]);router[_0x4de5('0x12')](_0x4de5('0xf'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x14')]);router[_0x4de5('0x12')](_0x4de5('0x15'),auth[_0x4de5('0x9')](),interaction[_0x4de5('0x16')](_0x4de5('0x17'),'openchannelinteraction:addtags'),controller[_0x4de5('0x18')]);router['put'](_0x4de5('0xd'),auth[_0x4de5('0x9')](),interaction[_0x4de5('0x16')](_0x4de5('0x17'),_0x4de5('0x19')),controller[_0x4de5('0x1a')]);router['delete'](_0x4de5('0xd'),auth[_0x4de5('0x9')](),interaction['tracked'](_0x4de5('0x17'),'openchannelinteraction:destroy'),controller[_0x4de5('0x1b')]);router[_0x4de5('0x1c')](_0x4de5('0x15'),auth[_0x4de5('0x9')](),controller[_0x4de5('0x1d')]);module[_0x4de5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c8497f4..4568433 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 _0xb7aa=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x183ab8,_0x4cb72d){_0x183ab8=_0x183ab8-0x0;var _0x40ef93=_0xb7aa[_0x183ab8];return _0x40ef93;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'closed':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab7a('0x3')]},'disposition':{'type':Sequelize[_0xab7a('0x4')]},'secondDisposition':{'type':Sequelize[_0xab7a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xab7a('0x4')]},'note':{'type':Sequelize[_0xab7a('0x4')]},'read1stAt':{'type':Sequelize[_0xab7a('0x3')]},'threadId':{'type':Sequelize[_0xab7a('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xab7a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xab7a('0x5')]('in',_0xab7a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xab7a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xab7a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xab7a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbac2=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x2f2adf,_0x1ff667){var _0xc14a2=function(_0xe22e14){while(--_0xe22e14){_0x2f2adf['push'](_0x2f2adf['shift']());}};_0xc14a2(++_0x1ff667);}(_0xbac2,0xc6));var _0x2bac=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xbac2[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x2bac('0x0'));module[_0x2bac('0x1')]={'closed':{'type':Sequelize[_0x2bac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2bac('0x3')]},'disposition':{'type':Sequelize[_0x2bac('0x4')]},'secondDisposition':{'type':Sequelize[_0x2bac('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2bac('0x4')]},'note':{'type':Sequelize[_0x2bac('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x2bac('0x4')]},'externalUrl':{'type':Sequelize[_0x2bac('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2bac('0x5')]('in',_0x2bac('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2bac('0x5')]('in',_0x2bac('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2bac('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x2bac('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2bac('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ef5effd..3b1009b 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 _0xfc47=['moment','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','destroy','then','end','error','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','where','OpenchannelInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','toString','root','tmp','join','server','files','format','transcript-%d-%s.zip','User','fullname','Contact','attachments','push','Attachment','createdAt','secret','read','Account','get','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','firstName','lastName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','unlinkSync','zip-dir'];(function(_0x14ee13,_0x40b869){var _0x48fc9c=function(_0x593169){while(--_0x593169){_0x14ee13['push'](_0x14ee13['shift']());}};_0x48fc9c(++_0x40b869);}(_0xfc47,0x80));var _0x7fc4=function(_0x2a5b82,_0xc61f63){_0x2a5b82=_0x2a5b82-0x0;var _0x322e1a=_0xfc47[_0x2a5b82];return _0x322e1a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7fc4('0x0'));var moment=require(_0x7fc4('0x1'));var util=require(_0x7fc4('0x2'));var path=require(_0x7fc4('0x3'));var ejs=require(_0x7fc4('0x4'));var fs=require('fs');var _=require(_0x7fc4('0x5'));var Redis=require('ioredis');var interaction=require(_0x7fc4('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7fc4('0x7'));var logger=require(_0x7fc4('0x8'))(_0x7fc4('0x9'));var config=require(_0x7fc4('0xa'));var db=require('../../mysqldb')['db'];config[_0x7fc4('0xb')]=_[_0x7fc4('0xc')](config['redis'],{'host':_0x7fc4('0xd'),'port':0x18eb});var socket=require(_0x7fc4('0xe'))(new Redis(config[_0x7fc4('0xb')]));require(_0x7fc4('0xf'))[_0x7fc4('0x10')](socket);function respondWithStatusCode(_0x4c8cc9,_0xddf418){_0xddf418=_0xddf418||0xcc;return function(_0x1f5df5){if(_0x1f5df5){return _0x4c8cc9[_0x7fc4('0x11')](_0xddf418);}return _0x4c8cc9[_0x7fc4('0x12')](_0xddf418)['end']();};}function respondWithResult(_0x50ef37,_0x595ed1){_0x595ed1=_0x595ed1||0xc8;return function(_0x451dbc){if(_0x451dbc){return _0x50ef37['status'](_0x595ed1)[_0x7fc4('0x13')](_0x451dbc);}};}function respondWithFilteredResult(_0x37193d,_0x417ef5){return function(_0x54f0c9){if(_0x54f0c9){var _0x1a3371=typeof _0x417ef5['offset']===_0x7fc4('0x14')&&typeof _0x417ef5[_0x7fc4('0x15')]===_0x7fc4('0x14');var _0x56098b=_0x54f0c9[_0x7fc4('0x16')];var _0x7078f6=_0x1a3371?0x0:_0x417ef5[_0x7fc4('0x17')];var _0x3e7b13=_0x1a3371?_0x54f0c9[_0x7fc4('0x16')]:_0x417ef5['offset']+_0x417ef5['limit'];var _0xc82e6;if(_0x3e7b13>=_0x56098b){_0x3e7b13=_0x56098b;_0xc82e6=0xc8;}else{_0xc82e6=0xce;}_0x37193d[_0x7fc4('0x12')](_0xc82e6);return _0x37193d['set']('Content-Range',_0x7078f6+'-'+_0x3e7b13+'/'+_0x56098b)[_0x7fc4('0x13')](_0x54f0c9);}return null;};}function saveUpdates(_0x143056){return function(_0x120f30){if(_0x120f30){return _0x120f30['update'](_0x143056)['then'](function(_0x475e4b){return _0x475e4b;});}return null;};}function removeEntity(_0x5be62d){return function(_0x225e7d){if(_0x225e7d){return _0x225e7d[_0x7fc4('0x18')]()[_0x7fc4('0x19')](function(){_0x5be62d[_0x7fc4('0x12')](0xcc)[_0x7fc4('0x1a')]();});}};}function handleEntityNotFound(_0x14f3c7){return function(_0x36c593){if(!_0x36c593){_0x14f3c7[_0x7fc4('0x11')](0x194);}return _0x36c593;};}function handleError(_0x5b9015,_0x5dc282){_0x5dc282=_0x5dc282||0x1f4;return function(_0x165f25){logger[_0x7fc4('0x1b')](_0x165f25[_0x7fc4('0x1c')]);if(_0x165f25[_0x7fc4('0x1d')]){delete _0x165f25[_0x7fc4('0x1d')];}_0x5b9015[_0x7fc4('0x12')](_0x5dc282)[_0x7fc4('0x1e')](_0x165f25);};}exports['index']=function(_0x471eac,_0x2e30cf){var _0x1e3c61={};var _0x23c0a5=_[_0x7fc4('0x1f')](db[_0x7fc4('0x20')][_0x7fc4('0x21')],function(_0x3b8403){return{'name':_0x3b8403[_0x7fc4('0x22')],'type':_0x3b8403[_0x7fc4('0x23')][_0x7fc4('0x24')]};});_0x1e3c61=qs['getOptions'](_0x23c0a5,_0x471eac);return interaction[_0x7fc4('0x25')]('openchannel',_0x471eac[_0x7fc4('0x26')],_0x471eac[_0x7fc4('0x27')],_0x1e3c61,_0x23c0a5)[_0x7fc4('0x19')](respondWithFilteredResult(_0x2e30cf,_0x1e3c61))[_0x7fc4('0x28')](handleError(_0x2e30cf,null));};exports[_0x7fc4('0x29')]=function(_0x432fad,_0x42caad){var _0x5599b3={};if(_0x432fad[_0x7fc4('0x26')][_0x7fc4('0x23')]&&_0x432fad['query']['type']===_0x7fc4('0x2a')){_0x5599b3[_0x7fc4('0x2a')]=_0x432fad[_0x7fc4('0x2b')]['id'];}else{_0x5599b3['id']=_0x432fad['params']['id'];}var _0x29f178={'raw':![],'where':_0x5599b3},_0x21bf50={};_0x21bf50[_0x7fc4('0x2c')]=_[_0x7fc4('0x2d')](db['OpenchannelInteraction'][_0x7fc4('0x21')]);_0x21bf50[_0x7fc4('0x26')]=_[_0x7fc4('0x2d')](_0x432fad[_0x7fc4('0x26')]);_0x21bf50[_0x7fc4('0x2e')]=_[_0x7fc4('0x2f')](_0x21bf50['model'],_0x21bf50[_0x7fc4('0x26')]);_0x29f178[_0x7fc4('0x30')]=_[_0x7fc4('0x2f')](_0x21bf50['model'],qs[_0x7fc4('0x31')](_0x432fad[_0x7fc4('0x26')]['fields']));_0x29f178[_0x7fc4('0x30')]=_0x29f178[_0x7fc4('0x30')]['length']?_0x29f178[_0x7fc4('0x30')]:_0x21bf50[_0x7fc4('0x2c')];if(_0x432fad['query'][_0x7fc4('0x32')]){_0x29f178[_0x7fc4('0x33')]=[{'all':!![]}];}_0x29f178=_['merge']({},_0x29f178,_0x432fad[_0x7fc4('0x34')]);return db['OpenchannelInteraction'][_0x7fc4('0x35')](_0x29f178)[_0x7fc4('0x19')](handleEntityNotFound(_0x42caad,null))['then'](respondWithResult(_0x42caad,null))[_0x7fc4('0x28')](handleError(_0x42caad,null));};exports['create']=function(_0x105d5a,_0x179abd){return db[_0x7fc4('0x20')][_0x7fc4('0x36')](_0x105d5a[_0x7fc4('0x37')],{})[_0x7fc4('0x19')](respondWithResult(_0x179abd,0xc9))[_0x7fc4('0x28')](handleError(_0x179abd,null));};exports['update']=function(_0xf9f7b7,_0x1d4491){if(_0xf9f7b7['body']['id']){delete _0xf9f7b7[_0x7fc4('0x37')]['id'];}return db[_0x7fc4('0x20')]['find']({'where':{'id':_0xf9f7b7['params']['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x1d4491,null))[_0x7fc4('0x19')](saveUpdates(_0xf9f7b7[_0x7fc4('0x37')],null))[_0x7fc4('0x19')](respondWithResult(_0x1d4491,null))[_0x7fc4('0x28')](handleError(_0x1d4491,null));};exports[_0x7fc4('0x18')]=function(_0x4cb999,_0x4f7157){return db['OpenchannelInteraction']['find']({'where':{'id':_0x4cb999['params']['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x4f7157,null))[_0x7fc4('0x19')](removeEntity(_0x4f7157,null))[_0x7fc4('0x28')](handleError(_0x4f7157,null));};exports[_0x7fc4('0x38')]=function(_0x5d9e22,_0x5d8702){return db[_0x7fc4('0x20')]['describe']()[_0x7fc4('0x19')](respondWithResult(_0x5d8702,null))[_0x7fc4('0x28')](handleError(_0x5d8702,null));};exports[_0x7fc4('0x39')]=function(_0x1161d2,_0x70abbc){return db[_0x7fc4('0x3a')]['find']({'where':{'id':_0x1161d2[_0x7fc4('0x2b')]['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x70abbc,null))[_0x7fc4('0x19')](function(_0x5f5aeb){if(_0x5f5aeb){return _0x5f5aeb['addMessage'](_0x1161d2[_0x7fc4('0x37')][_0x7fc4('0x3b')],_[_0x7fc4('0x3c')](_0x1161d2[_0x7fc4('0x37')],[_0x7fc4('0x3b'),'id'])||{});}})[_0x7fc4('0x19')](respondWithResult(_0x70abbc,null))[_0x7fc4('0x28')](handleError(_0x70abbc,null));};exports[_0x7fc4('0x3d')]=function(_0x41a347,_0x55fa8a){var _0x7a76c6={'raw':![],'where':{}};var _0x2749a8={};var _0x30d4e5={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7fc4('0x3e')]({'where':{'id':_0x41a347[_0x7fc4('0x2b')]['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x55fa8a,null))[_0x7fc4('0x19')](function(_0x315ace){if(_0x315ace){_0x2749a8[_0x7fc4('0x2c')]=_[_0x7fc4('0x2d')](db[_0x7fc4('0x3a')][_0x7fc4('0x21')]);_0x2749a8['query']=_[_0x7fc4('0x2d')](_0x41a347[_0x7fc4('0x26')]);_0x2749a8[_0x7fc4('0x2e')]=_[_0x7fc4('0x2f')](_0x2749a8[_0x7fc4('0x2c')],_0x2749a8[_0x7fc4('0x26')]);_0x7a76c6[_0x7fc4('0x30')]=_['intersection'](_0x2749a8[_0x7fc4('0x2c')],qs[_0x7fc4('0x31')](_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x31')]));_0x7a76c6[_0x7fc4('0x30')]=_0x7a76c6['attributes'][_0x7fc4('0x3f')]?_0x7a76c6[_0x7fc4('0x30')]:_0x2749a8[_0x7fc4('0x2c')];if(!_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x40')](_0x7fc4('0x41'))){_0x7a76c6['limit']=qs['limit'](_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x15')]);_0x7a76c6[_0x7fc4('0x17')]=qs[_0x7fc4('0x17')](_0x41a347[_0x7fc4('0x26')]['offset']);}_0x7a76c6[_0x7fc4('0x42')]=qs['sort'](_0x41a347['query']['sort']);_0x7a76c6['where']=qs[_0x7fc4('0x2e')](_['pick'](_0x41a347[_0x7fc4('0x26')],_0x2749a8[_0x7fc4('0x2e')]));_0x7a76c6[_0x7fc4('0x43')][_0x7fc4('0x44')]=_0x315ace['id'];if(_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x45')]){_0x7a76c6[_0x7fc4('0x43')]=_[_0x7fc4('0x46')](_0x7a76c6['where'],{'$or':_[_0x7fc4('0x1f')](_0x7a76c6[_0x7fc4('0x30')],function(_0x926341){var _0x5b6cc9={};_0x5b6cc9[_0x926341]={'$like':'%'+_0x41a347['query']['filter']+'%'};return _0x5b6cc9;})});}if(_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x47')]){var _0x381ef5=_0x41a347[_0x7fc4('0x26')][_0x7fc4('0x47')][_0x7fc4('0x48')](',');var _0x2ec1e6={};_0x2ec1e6[_0x381ef5[0x0]]={'$gte':moment(_0x381ef5[0x1])['format'](_0x7fc4('0x49'))};_0x7a76c6[_0x7fc4('0x43')]=_[_0x7fc4('0x46')](_0x7a76c6[_0x7fc4('0x43')],_0x2ec1e6);}_0x7a76c6=_[_0x7fc4('0x46')]({},_0x7a76c6,_0x41a347[_0x7fc4('0x34')]);return db[_0x7fc4('0x3a')][_0x7fc4('0x16')]({'where':_0x7a76c6[_0x7fc4('0x43')]})[_0x7fc4('0x19')](function(_0x15521e){_0x30d4e5[_0x7fc4('0x16')]=_0x15521e;if(_0x41a347['query'][_0x7fc4('0x32')]){_0x7a76c6['include']=[{'all':!![]}];}return db[_0x7fc4('0x3a')][_0x7fc4('0x25')](_0x7a76c6);})[_0x7fc4('0x19')](function(_0x4bfd24){_0x30d4e5[_0x7fc4('0x4a')]=_0x4bfd24;return _0x30d4e5;});}})[_0x7fc4('0x19')](respondWithFilteredResult(_0x55fa8a,_0x7a76c6))['catch'](handleError(_0x55fa8a,null));};exports[_0x7fc4('0x4b')]=function(_0x43a77f,_0x3f2ba7){return db[_0x7fc4('0x20')][_0x7fc4('0x35')]({'where':{'id':_0x43a77f[_0x7fc4('0x2b')]['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x3f2ba7,null))[_0x7fc4('0x19')](function(_0x2ba2d6){if(_0x2ba2d6){return _0x2ba2d6[_0x7fc4('0x4c')](_0x43a77f[_0x7fc4('0x37')]['ids'],_[_0x7fc4('0x3c')](_0x43a77f[_0x7fc4('0x37')],[_0x7fc4('0x3b'),'id'])||{})['spread'](function(){return db[_0x7fc4('0x4d')][_0x7fc4('0x25')]({'attributes':['id',_0x7fc4('0x1d'),'color'],'where':{'id':_0x43a77f[_0x7fc4('0x37')][_0x7fc4('0x3b')]}});})[_0x7fc4('0x19')](function(_0x42c4ff){socket[_0x7fc4('0x4e')](_0x7fc4('0x4f'),{'id':Number(_0x43a77f[_0x7fc4('0x2b')]['id']),'tags':_0x42c4ff||[]});return{'id':Number(_0x43a77f['params']['id']),'tags':_0x42c4ff||[]};});}})['then'](respondWithResult(_0x3f2ba7,null))[_0x7fc4('0x28')](handleError(_0x3f2ba7,null));};exports[_0x7fc4('0x50')]=function(_0x3e920d,_0x356faf){return db[_0x7fc4('0x20')][_0x7fc4('0x35')]({'where':{'id':_0x3e920d['params']['id']}})[_0x7fc4('0x19')](handleEntityNotFound(_0x356faf,null))[_0x7fc4('0x19')](function(_0xe74907){if(_0xe74907){return _0xe74907[_0x7fc4('0x50')](_0x3e920d['query']['ids']);}})[_0x7fc4('0x19')](respondWithStatusCode(_0x356faf,null))[_0x7fc4('0x28')](handleError(_0x356faf,null));};exports['download']=function(_0x2155c3,_0x180677){var _0x3bb6a2=moment()[_0x7fc4('0x51')]()[_0x7fc4('0x52')]();var _0x45fe51=path['join'](config[_0x7fc4('0x53')],'server','files',_0x7fc4('0x54'));var _0x29ffdd=path[_0x7fc4('0x55')](config[_0x7fc4('0x53')],_0x7fc4('0x56'),_0x7fc4('0x57'),'attachments');var _0x5ceae9=path[_0x7fc4('0x55')](_0x45fe51,_0x3bb6a2);var _0x583fd6=util[_0x7fc4('0x58')](_0x7fc4('0x59'),_0x2155c3[_0x7fc4('0x2b')]['id'],_0x3bb6a2);var _0x272f9a=path[_0x7fc4('0x55')](_0x45fe51,_0x583fd6);var _0x1309e0=[];_0x1309e0['push']({'model':db[_0x7fc4('0x5a')],'as':'User','attributes':['id',_0x7fc4('0x5b')],'raw':!![]});_0x1309e0['push']({'model':db['CmContact'],'as':_0x7fc4('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2155c3[_0x7fc4('0x26')][_0x7fc4('0x5d')]){_0x1309e0[_0x7fc4('0x5e')]({'model':db[_0x7fc4('0x5f')],'as':_0x7fc4('0x5f'),'raw':!![]});}var _0x164539=[{'model':db[_0x7fc4('0x3a')],'as':'Messages','attributes':['id',_0x7fc4('0x37'),_0x7fc4('0x60'),'direction',_0x7fc4('0x61'),_0x7fc4('0x62')],'include':_0x1309e0}];_0x164539[_0x7fc4('0x5e')]({'model':db['OpenchannelAccount'],'as':_0x7fc4('0x63'),'attributes':['id','name']});_0x164539[_0x7fc4('0x5e')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x7fc4('0x35')]({'where':{'id':_0x2155c3[_0x7fc4('0x2b')]['id']},'include':_0x164539})[_0x7fc4('0x19')](handleEntityNotFound(_0x180677,null))[_0x7fc4('0x19')](function(_0x3846fc){if(_0x3846fc){var _0x4c8cf1=_0x3846fc[_0x7fc4('0x64')]({'plain':!![]});fs[_0x7fc4('0x65')](_0x5ceae9);var _0x2709a0={'channel':_0x7fc4('0x66'),'account':_0x4c8cf1[_0x7fc4('0x63')]['name'],'agent':_0x4c8cf1[_0x7fc4('0x67')]?_0x4c8cf1[_0x7fc4('0x67')][_0x7fc4('0x5b')]:'N.A.','createdAt':moment(_0x4c8cf1['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7fc4('0x52')](),'closedAt':_0x4c8cf1[_0x7fc4('0x68')]?moment(_0x4c8cf1[_0x7fc4('0x69')])[_0x7fc4('0x58')](_0x7fc4('0x49'))[_0x7fc4('0x52')]():'','disposition':_0x4c8cf1[_0x7fc4('0x6a')],'visibility':_0x4c8cf1[_0x7fc4('0x6b')]?_0x7fc4('0x6c'):_0x7fc4('0x6d'),'messages':_(_0x4c8cf1[_0x7fc4('0x6e')])['filter']({'secret':![]})[_0x7fc4('0x1f')](function(_0x4f0bf1){if(_0x4f0bf1[_0x7fc4('0x5f')]){var _0x1e3de0=path[_0x7fc4('0x55')](_0x29ffdd,_0x4f0bf1[_0x7fc4('0x5f')][_0x7fc4('0x6f')]);if(fs[_0x7fc4('0x70')](_0x1e3de0)){fs[_0x7fc4('0x71')](_0x1e3de0)[_0x7fc4('0x72')](fs[_0x7fc4('0x73')](path['join'](_0x5ceae9,_0x4f0bf1[_0x7fc4('0x5f')]['basename'])));}}return{'date':moment(_0x4f0bf1[_0x7fc4('0x60')])[_0x7fc4('0x58')](_0x7fc4('0x49'))[_0x7fc4('0x52')](),'sender':_0x4f0bf1[_0x7fc4('0x74')]===_0x7fc4('0x75')?_0x4f0bf1[_0x7fc4('0x5a')]?_0x4f0bf1['User'][_0x7fc4('0x5b')]:_0x7fc4('0x76'):_0x4f0bf1[_0x7fc4('0x5c')][_0x7fc4('0x77')]+(_0x4f0bf1[_0x7fc4('0x5c')][_0x7fc4('0x78')]?'\x20'+_0x4f0bf1[_0x7fc4('0x5c')][_0x7fc4('0x78')]:''),'body':_0x4f0bf1[_0x7fc4('0x5f')]?_0x4f0bf1['Attachment'][_0x7fc4('0x6f')]:_0x4f0bf1[_0x7fc4('0x37')],'direction':_0x4f0bf1['direction']===_0x7fc4('0x75')?'A':'C','secret':_0x4f0bf1[_0x7fc4('0x61')],'read':_0x4f0bf1['read'],'attachment':_0x4f0bf1['Attachment']};})[_0x7fc4('0x79')]()};return ejs['renderFile'](path[_0x7fc4('0x55')](config[_0x7fc4('0x53')],'server',_0x7fc4('0x7a'),_0x7fc4('0x7b')),{'interaction':_0x2709a0})[_0x7fc4('0x19')](function(_0x3274d7){var _0x31a4ea=path[_0x7fc4('0x55')](_0x5ceae9,_0x7fc4('0x7c')+_0x4c8cf1['id']+'-'+_0x3bb6a2+_0x7fc4('0x7d'));var _0x5d784e={'path':_0x31a4ea,'channel':_0x7fc4('0x66'),'interactionId':_0x4c8cf1['id']};return pdf[_0x7fc4('0x7e')](_0x3274d7,_0x5d784e);})[_0x7fc4('0x19')](function(){return new Promise(function(_0x554ff8,_0x92d835){zipdir(_0x5ceae9,{'saveTo':_0x272f9a},function(_0x543b79,_0x380450){if(_0x543b79)return _0x92d835(_0x543b79);return _0x554ff8(_0x380450);});})['then'](function(){return new Promise(function(_0x29b373,_0x148706){rimraf(_0x5ceae9,function(_0x4c4fac){if(_0x4c4fac)_0x148706(_0x4c4fac);return _0x29b373();});});})[_0x7fc4('0x19')](function(){return _0x180677[_0x7fc4('0x7f')](_0x272f9a,_0x583fd6,function(_0x414f5c){if(_0x414f5c){logger[_0x7fc4('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x414f5c);}else{fs[_0x7fc4('0x80')](_0x272f9a);}});});});}else{return _0x180677[_0x7fc4('0x11')](0xc8);}})[_0x7fc4('0x28')](handleError(_0x180677,null));}; \ No newline at end of file +var _0x237d=['where','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','ids','omit','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','direction','secret','Account','Owner','get','Openchannel','N.A.','createdAt','toString','closed','closedAt','threadId','Public','Private','existsSync','createReadStream','createWriteStream','out','System','firstName','lastName','basename','read','renderFile','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','find','catch','create','body','destroy','describe','OpenchannelMessage','addMessage','getMessages','findOne','nolimit','order','sort'];(function(_0x147d0f,_0x5c7064){var _0x3642ad=function(_0x3435d1){while(--_0x3435d1){_0x147d0f['push'](_0x147d0f['shift']());}};_0x3642ad(++_0x5c7064);}(_0x237d,0xb2));var _0xd237=function(_0x17582f,_0x54d18e){_0x17582f=_0x17582f-0x0;var _0x5a0fee=_0x237d[_0x17582f];return _0x5a0fee;};'use strict';var rimraf=require(_0xd237('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd237('0x1'));var util=require('util');var path=require(_0xd237('0x2'));var ejs=require(_0xd237('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd237('0x4'));var interaction=require(_0xd237('0x5'));var qs=require(_0xd237('0x6'));var pdf=require(_0xd237('0x7'));var logger=require(_0xd237('0x8'))(_0xd237('0x9'));var config=require(_0xd237('0xa'));var db=require('../../mysqldb')['db'];config[_0xd237('0xb')]=_[_0xd237('0xc')](config[_0xd237('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd237('0xd'))(new Redis(config[_0xd237('0xb')]));require(_0xd237('0xe'))[_0xd237('0xf')](socket);function respondWithStatusCode(_0x2cd691,_0x4fda52){_0x4fda52=_0x4fda52||0xcc;return function(_0x54c2f1){if(_0x54c2f1){return _0x2cd691[_0xd237('0x10')](_0x4fda52);}return _0x2cd691[_0xd237('0x11')](_0x4fda52)[_0xd237('0x12')]();};}function respondWithResult(_0x2c2b2b,_0x5bb021){_0x5bb021=_0x5bb021||0xc8;return function(_0x3e2593){if(_0x3e2593){return _0x2c2b2b[_0xd237('0x11')](_0x5bb021)[_0xd237('0x13')](_0x3e2593);}};}function respondWithFilteredResult(_0x23a653,_0x34ce11){return function(_0x22c08c){if(_0x22c08c){var _0x7b5f6c=typeof _0x34ce11[_0xd237('0x14')]===_0xd237('0x15')&&typeof _0x34ce11[_0xd237('0x16')]==='undefined';var _0x1eb8ec=_0x22c08c[_0xd237('0x17')];var _0x25bcfe=_0x7b5f6c?0x0:_0x34ce11[_0xd237('0x14')];var _0x4d1c52=_0x7b5f6c?_0x22c08c[_0xd237('0x17')]:_0x34ce11[_0xd237('0x14')]+_0x34ce11[_0xd237('0x16')];var _0x43ed7d;if(_0x4d1c52>=_0x1eb8ec){_0x4d1c52=_0x1eb8ec;_0x43ed7d=0xc8;}else{_0x43ed7d=0xce;}_0x23a653[_0xd237('0x11')](_0x43ed7d);return _0x23a653[_0xd237('0x18')]('Content-Range',_0x25bcfe+'-'+_0x4d1c52+'/'+_0x1eb8ec)[_0xd237('0x13')](_0x22c08c);}return null;};}function saveUpdates(_0x283c7d){return function(_0x5b0851){if(_0x5b0851){return _0x5b0851[_0xd237('0x19')](_0x283c7d)['then'](function(_0x1b0ffa){return _0x1b0ffa;});}return null;};}function removeEntity(_0x427d58){return function(_0x3841d4){if(_0x3841d4){return _0x3841d4['destroy']()[_0xd237('0x1a')](function(){_0x427d58['status'](0xcc)[_0xd237('0x12')]();});}};}function handleEntityNotFound(_0xd8e21d){return function(_0x22acc8){if(!_0x22acc8){_0xd8e21d['sendStatus'](0x194);}return _0x22acc8;};}function handleError(_0x4da660,_0x46ace9){_0x46ace9=_0x46ace9||0x1f4;return function(_0xcecdf0){logger['error'](_0xcecdf0[_0xd237('0x1b')]);if(_0xcecdf0[_0xd237('0x1c')]){delete _0xcecdf0[_0xd237('0x1c')];}_0x4da660[_0xd237('0x11')](_0x46ace9)['send'](_0xcecdf0);};}exports['index']=function(_0x50d4ac,_0x4a492e){var _0x42da16={};var _0x513760=_['map'](db[_0xd237('0x1d')][_0xd237('0x1e')],function(_0x445dc2){return{'name':_0x445dc2[_0xd237('0x1f')],'type':_0x445dc2[_0xd237('0x20')][_0xd237('0x21')]};});_0x42da16=qs[_0xd237('0x22')](_0x513760,_0x50d4ac);return interaction[_0xd237('0x23')](_0xd237('0x24'),_0x50d4ac[_0xd237('0x25')],_0x50d4ac[_0xd237('0x26')],_0x42da16,_0x513760)[_0xd237('0x1a')](respondWithFilteredResult(_0x4a492e,_0x42da16))['catch'](handleError(_0x4a492e,null));};exports['show']=function(_0x5177cb,_0x792ce1){var _0x3f3fd4={};if(_0x5177cb['query']['type']&&_0x5177cb[_0xd237('0x25')][_0xd237('0x20')]===_0xd237('0x27')){_0x3f3fd4[_0xd237('0x27')]=_0x5177cb[_0xd237('0x28')]['id'];}else{_0x3f3fd4['id']=_0x5177cb[_0xd237('0x28')]['id'];}var _0x1d36ff={'raw':![],'where':_0x3f3fd4},_0x48bbe7={};_0x48bbe7[_0xd237('0x29')]=_[_0xd237('0x2a')](db['OpenchannelInteraction'][_0xd237('0x1e')]);_0x48bbe7[_0xd237('0x25')]=_[_0xd237('0x2a')](_0x5177cb['query']);_0x48bbe7[_0xd237('0x2b')]=_[_0xd237('0x2c')](_0x48bbe7[_0xd237('0x29')],_0x48bbe7[_0xd237('0x25')]);_0x1d36ff[_0xd237('0x2d')]=_[_0xd237('0x2c')](_0x48bbe7[_0xd237('0x29')],qs[_0xd237('0x2e')](_0x5177cb[_0xd237('0x25')][_0xd237('0x2e')]));_0x1d36ff[_0xd237('0x2d')]=_0x1d36ff[_0xd237('0x2d')][_0xd237('0x2f')]?_0x1d36ff[_0xd237('0x2d')]:_0x48bbe7[_0xd237('0x29')];if(_0x5177cb[_0xd237('0x25')][_0xd237('0x30')]){_0x1d36ff['include']=[{'all':!![]}];}_0x1d36ff=_['merge']({},_0x1d36ff,_0x5177cb['options']);return db[_0xd237('0x1d')][_0xd237('0x31')](_0x1d36ff)[_0xd237('0x1a')](handleEntityNotFound(_0x792ce1,null))['then'](respondWithResult(_0x792ce1,null))[_0xd237('0x32')](handleError(_0x792ce1,null));};exports['create']=function(_0x4c1e69,_0x44fa59){return db['OpenchannelInteraction'][_0xd237('0x33')](_0x4c1e69[_0xd237('0x34')],{})[_0xd237('0x1a')](respondWithResult(_0x44fa59,0xc9))[_0xd237('0x32')](handleError(_0x44fa59,null));};exports[_0xd237('0x19')]=function(_0x192db0,_0x346d5a){if(_0x192db0[_0xd237('0x34')]['id']){delete _0x192db0['body']['id'];}return db[_0xd237('0x1d')]['find']({'where':{'id':_0x192db0['params']['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x346d5a,null))[_0xd237('0x1a')](saveUpdates(_0x192db0['body'],null))[_0xd237('0x1a')](respondWithResult(_0x346d5a,null))[_0xd237('0x32')](handleError(_0x346d5a,null));};exports[_0xd237('0x35')]=function(_0x420311,_0x5afb1b){return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x420311[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x5afb1b,null))['then'](removeEntity(_0x5afb1b,null))['catch'](handleError(_0x5afb1b,null));};exports[_0xd237('0x36')]=function(_0x384373,_0x28ee1c){return db[_0xd237('0x1d')][_0xd237('0x36')]()[_0xd237('0x1a')](respondWithResult(_0x28ee1c,null))[_0xd237('0x32')](handleError(_0x28ee1c,null));};exports['addMessage']=function(_0xb0475c,_0x17cb50){return db[_0xd237('0x37')][_0xd237('0x31')]({'where':{'id':_0xb0475c['params']['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x17cb50,null))[_0xd237('0x1a')](function(_0x877f62){if(_0x877f62){return _0x877f62[_0xd237('0x38')](_0xb0475c[_0xd237('0x34')]['ids'],_['omit'](_0xb0475c['body'],['ids','id'])||{});}})[_0xd237('0x1a')](respondWithResult(_0x17cb50,null))['catch'](handleError(_0x17cb50,null));};exports[_0xd237('0x39')]=function(_0x1f3f11,_0x38bee5){var _0x2b7773={'raw':![],'where':{}};var _0x3f82dc={};var _0x295b8e={'count':0x0,'rows':[]};return db[_0xd237('0x1d')][_0xd237('0x3a')]({'where':{'id':_0x1f3f11[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x38bee5,null))[_0xd237('0x1a')](function(_0x131021){if(_0x131021){_0x3f82dc[_0xd237('0x29')]=_[_0xd237('0x2a')](db[_0xd237('0x37')][_0xd237('0x1e')]);_0x3f82dc[_0xd237('0x25')]=_[_0xd237('0x2a')](_0x1f3f11[_0xd237('0x25')]);_0x3f82dc[_0xd237('0x2b')]=_[_0xd237('0x2c')](_0x3f82dc['model'],_0x3f82dc[_0xd237('0x25')]);_0x2b7773['attributes']=_[_0xd237('0x2c')](_0x3f82dc['model'],qs[_0xd237('0x2e')](_0x1f3f11['query'][_0xd237('0x2e')]));_0x2b7773[_0xd237('0x2d')]=_0x2b7773['attributes'][_0xd237('0x2f')]?_0x2b7773['attributes']:_0x3f82dc[_0xd237('0x29')];if(!_0x1f3f11[_0xd237('0x25')]['hasOwnProperty'](_0xd237('0x3b'))){_0x2b7773[_0xd237('0x16')]=qs['limit'](_0x1f3f11[_0xd237('0x25')][_0xd237('0x16')]);_0x2b7773[_0xd237('0x14')]=qs[_0xd237('0x14')](_0x1f3f11['query'][_0xd237('0x14')]);}_0x2b7773[_0xd237('0x3c')]=qs[_0xd237('0x3d')](_0x1f3f11[_0xd237('0x25')]['sort']);_0x2b7773[_0xd237('0x3e')]=qs[_0xd237('0x2b')](_['pick'](_0x1f3f11[_0xd237('0x25')],_0x3f82dc[_0xd237('0x2b')]));_0x2b7773[_0xd237('0x3e')]['OpenchannelInteractionId']=_0x131021['id'];if(_0x1f3f11['query'][_0xd237('0x3f')]){_0x2b7773['where']=_[_0xd237('0x40')](_0x2b7773[_0xd237('0x3e')],{'$or':_['map'](_0x2b7773[_0xd237('0x2d')],function(_0x4f7b10){var _0x2921c3={};_0x2921c3[_0x4f7b10]={'$like':'%'+_0x1f3f11[_0xd237('0x25')][_0xd237('0x3f')]+'%'};return _0x2921c3;})});}if(_0x1f3f11[_0xd237('0x25')][_0xd237('0x41')]){var _0x141aec=_0x1f3f11['query'][_0xd237('0x41')][_0xd237('0x42')](',');var _0x3d8d7f={};_0x3d8d7f[_0x141aec[0x0]]={'$gte':moment(_0x141aec[0x1])[_0xd237('0x43')](_0xd237('0x44'))};_0x2b7773['where']=_[_0xd237('0x40')](_0x2b7773['where'],_0x3d8d7f);}_0x2b7773=_[_0xd237('0x40')]({},_0x2b7773,_0x1f3f11['options']);return db[_0xd237('0x37')][_0xd237('0x17')]({'where':_0x2b7773[_0xd237('0x3e')]})['then'](function(_0x2271d9){_0x295b8e[_0xd237('0x17')]=_0x2271d9;if(_0x1f3f11['query']['includeAll']){_0x2b7773['include']=[{'all':!![]}];}return db[_0xd237('0x37')][_0xd237('0x23')](_0x2b7773);})[_0xd237('0x1a')](function(_0x34b1bf){_0x295b8e[_0xd237('0x45')]=_0x34b1bf;return _0x295b8e;});}})[_0xd237('0x1a')](respondWithFilteredResult(_0x38bee5,_0x2b7773))[_0xd237('0x32')](handleError(_0x38bee5,null));};exports['addTags']=function(_0x5eeeb2,_0x3dd1e1){return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x5eeeb2[_0xd237('0x28')]['id']}})[_0xd237('0x1a')](handleEntityNotFound(_0x3dd1e1,null))[_0xd237('0x1a')](function(_0x57db98){if(_0x57db98){return _0x57db98['setTags'](_0x5eeeb2[_0xd237('0x34')][_0xd237('0x46')],_[_0xd237('0x47')](_0x5eeeb2[_0xd237('0x34')],[_0xd237('0x46'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xd237('0x48')],'where':{'id':_0x5eeeb2['body']['ids']}});})[_0xd237('0x1a')](function(_0xc3c74){socket[_0xd237('0x49')]('openchannelInteractionTags:save',{'id':Number(_0x5eeeb2[_0xd237('0x28')]['id']),'tags':_0xc3c74||[]});return{'id':Number(_0x5eeeb2[_0xd237('0x28')]['id']),'tags':_0xc3c74||[]};});}})[_0xd237('0x1a')](respondWithResult(_0x3dd1e1,null))[_0xd237('0x32')](handleError(_0x3dd1e1,null));};exports[_0xd237('0x4a')]=function(_0x23079e,_0x1352bc){return db[_0xd237('0x1d')]['find']({'where':{'id':_0x23079e[_0xd237('0x28')]['id']}})['then'](handleEntityNotFound(_0x1352bc,null))[_0xd237('0x1a')](function(_0x63f601){if(_0x63f601){return _0x63f601[_0xd237('0x4a')](_0x23079e['query'][_0xd237('0x46')]);}})[_0xd237('0x1a')](respondWithStatusCode(_0x1352bc,null))['catch'](handleError(_0x1352bc,null));};exports[_0xd237('0x4b')]=function(_0x23267d,_0x529565){var _0x1c93ba=moment()[_0xd237('0x4c')]()['toString']();var _0x48b457=path['join'](config[_0xd237('0x4d')],_0xd237('0x4e'),_0xd237('0x4f'),_0xd237('0x50'));var _0x197a1b=path[_0xd237('0x51')](config[_0xd237('0x4d')],_0xd237('0x4e'),_0xd237('0x4f'),_0xd237('0x52'));var _0x3dd38d=path[_0xd237('0x51')](_0x48b457,_0x1c93ba);var _0x192453=util[_0xd237('0x43')](_0xd237('0x53'),_0x23267d[_0xd237('0x28')]['id'],_0x1c93ba);var _0x275c8d=path[_0xd237('0x51')](_0x48b457,_0x192453);var _0x3ac8b4=[];_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x55')],'as':_0xd237('0x55'),'attributes':['id',_0xd237('0x56')],'raw':!![]});_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x57')],'as':_0xd237('0x58'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x23267d[_0xd237('0x25')][_0xd237('0x52')]){_0x3ac8b4[_0xd237('0x54')]({'model':db[_0xd237('0x59')],'as':_0xd237('0x59'),'raw':!![]});}var _0x35c5bc=[{'model':db[_0xd237('0x37')],'as':_0xd237('0x5a'),'attributes':['id',_0xd237('0x34'),'createdAt',_0xd237('0x5b'),_0xd237('0x5c'),'read'],'include':_0x3ac8b4}];_0x35c5bc[_0xd237('0x54')]({'model':db['OpenchannelAccount'],'as':_0xd237('0x5d'),'attributes':['id','name']});_0x35c5bc[_0xd237('0x54')]({'model':db[_0xd237('0x55')],'as':_0xd237('0x5e'),'attributes':['id',_0xd237('0x56')]});return db['OpenchannelInteraction'][_0xd237('0x31')]({'where':{'id':_0x23267d[_0xd237('0x28')]['id']},'include':_0x35c5bc})['then'](handleEntityNotFound(_0x529565,null))[_0xd237('0x1a')](function(_0x13202e){if(_0x13202e){var _0x16a42b=_0x13202e[_0xd237('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3dd38d);var _0x28181f={'channel':_0xd237('0x60'),'account':_0x16a42b[_0xd237('0x5d')][_0xd237('0x1c')],'agent':_0x16a42b['Owner']?_0x16a42b[_0xd237('0x5e')][_0xd237('0x56')]:_0xd237('0x61'),'createdAt':moment(_0x16a42b[_0xd237('0x62')])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')](),'closedAt':_0x16a42b[_0xd237('0x64')]?moment(_0x16a42b[_0xd237('0x65')])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')]():'','disposition':_0x16a42b['disposition'],'visibility':_0x16a42b[_0xd237('0x66')]?_0xd237('0x67'):_0xd237('0x68'),'messages':_(_0x16a42b['Messages'])[_0xd237('0x3f')]({'secret':![]})['map'](function(_0x195a44){if(_0x195a44['Attachment']){var _0x2b737c=path['join'](_0x197a1b,_0x195a44[_0xd237('0x59')]['basename']);if(fs[_0xd237('0x69')](_0x2b737c)){fs[_0xd237('0x6a')](_0x2b737c)['pipe'](fs[_0xd237('0x6b')](path[_0xd237('0x51')](_0x3dd38d,_0x195a44['Attachment']['basename'])));}}return{'date':moment(_0x195a44['createdAt'])[_0xd237('0x43')](_0xd237('0x44'))[_0xd237('0x63')](),'sender':_0x195a44[_0xd237('0x5b')]===_0xd237('0x6c')?_0x195a44[_0xd237('0x55')]?_0x195a44[_0xd237('0x55')]['fullname']:_0xd237('0x6d'):_0x195a44[_0xd237('0x58')][_0xd237('0x6e')]+(_0x195a44[_0xd237('0x58')][_0xd237('0x6f')]?'\x20'+_0x195a44[_0xd237('0x58')][_0xd237('0x6f')]:''),'body':_0x195a44[_0xd237('0x59')]?_0x195a44['Attachment'][_0xd237('0x70')]:_0x195a44[_0xd237('0x34')],'direction':_0x195a44[_0xd237('0x5b')]===_0xd237('0x6c')?'A':'C','secret':_0x195a44[_0xd237('0x5c')],'read':_0x195a44[_0xd237('0x71')],'attachment':_0x195a44[_0xd237('0x59')]};})['value']()};return ejs[_0xd237('0x72')](path[_0xd237('0x51')](config[_0xd237('0x4d')],_0xd237('0x4e'),'views','downloadInteraction.ejs'),{'interaction':_0x28181f})['then'](function(_0x8ad119){var _0x2ef70f=path[_0xd237('0x51')](_0x3dd38d,'transcript-'+_0x16a42b['id']+'-'+_0x1c93ba+_0xd237('0x73'));var _0x107ad1={'path':_0x2ef70f,'channel':_0xd237('0x60'),'interactionId':_0x16a42b['id']};return pdf[_0xd237('0x74')](_0x8ad119,_0x107ad1);})['then'](function(){return new Promise(function(_0x1f3a2a,_0x50c408){zipdir(_0x3dd38d,{'saveTo':_0x275c8d},function(_0x34a7aa,_0x2ae232){if(_0x34a7aa)return _0x50c408(_0x34a7aa);return _0x1f3a2a(_0x2ae232);});})[_0xd237('0x1a')](function(){return new Promise(function(_0xa665ca,_0x2a3f54){rimraf(_0x3dd38d,function(_0x3e9553){if(_0x3e9553)_0x2a3f54(_0x3e9553);return _0xa665ca();});});})[_0xd237('0x1a')](function(){return _0x529565['download'](_0x275c8d,_0x192453,function(_0x6170f7){if(_0x6170f7){logger[_0xd237('0x75')](_0xd237('0x76'),_0x6170f7);}else{fs[_0xd237('0x77')](_0x275c8d);}});});});}else{return _0x529565[_0xd237('0x10')](0xc8);}})[_0xd237('0x32')](handleError(_0x529565,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cef8185..7be58ff 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 _0xa7b7=['length','emit','hasOwnProperty','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','map','setDataValue'];(function(_0x33de4a,_0x1bb02b){var _0x5dd53f=function(_0x2855c7){while(--_0x2855c7){_0x33de4a['push'](_0x33de4a['shift']());}};_0x5dd53f(++_0x1bb02b);}(_0xa7b7,0x117));var _0x7a7b=function(_0x3586ea,_0x3f5a2c){_0x3586ea=_0x3586ea-0x0;var _0x184f54=_0xa7b7[_0x3586ea];return _0x184f54;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7a7b('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x7a7b('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7a7b('0x2')](0x0);var events={'afterCreate':_0x7a7b('0x3'),'afterUpdate':_0x7a7b('0x4'),'afterDestroy':_0x7a7b('0x5')};function emitEvent(_0xb36b5a){return function(_0x507b1c,_0x52fc18,_0x3278f0){_0x507b1c['getUsers']({'attributes':['id'],'raw':!![]})[_0x7a7b('0x6')](function(_0x20b709){_0x507b1c['setDataValue']('Users',_0x20b709[_0x7a7b('0x7')](function(_0x4e86d2){return{'id':_0x4e86d2['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x507b1c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7a7b('0x6')](function(_0x33c241){_0x507b1c[_0x7a7b('0x8')]('unreadMessages',_0x33c241[_0x7a7b('0x9')]);OpenchannelInteractionEvents[_0x7a7b('0xa')](_0xb36b5a+':'+_0x507b1c['id'],_0x507b1c);OpenchannelInteractionEvents[_0x7a7b('0xa')](_0xb36b5a,_0x507b1c);_0x3278f0(null);})['catch'](_0x3278f0(null));};}for(var e in events){if(events[_0x7a7b('0xb')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x41f2=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0xe8d4c2,_0x213b9f){var _0x348cd7=function(_0x37b5b8){while(--_0x37b5b8){_0xe8d4c2['push'](_0xe8d4c2['shift']());}};_0x348cd7(++_0x213b9f);}(_0x41f2,0x1ac));var _0x241f=function(_0x3d50f6,_0x56fac5){_0x3d50f6=_0x3d50f6-0x0;var _0xde0922=_0x41f2[_0x3d50f6];return _0xde0922;};'use strict';var EventEmitter=require(_0x241f('0x0'));var OpenchannelInteraction=require(_0x241f('0x1'))['db'][_0x241f('0x2')];var OpenchannelMessage=require(_0x241f('0x1'))['db'][_0x241f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x241f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x241f('0x5'),'afterDestroy':_0x241f('0x6')};function emitEvent(_0x212d96){return function(_0x34260e,_0x26f3f4,_0x28a09f){_0x34260e[_0x241f('0x7')]({'attributes':['id'],'raw':!![]})[_0x241f('0x8')](function(_0x3e4188){_0x34260e[_0x241f('0x9')](_0x241f('0xa'),_0x3e4188['map'](function(_0x2495b9){return{'id':_0x2495b9['id']};}));return OpenchannelMessage[_0x241f('0xb')]({'where':{'OpenchannelInteractionId':_0x34260e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x756077){_0x34260e[_0x241f('0x9')](_0x241f('0xc'),_0x756077[_0x241f('0xd')]);OpenchannelInteractionEvents['emit'](_0x212d96+':'+_0x34260e['id'],_0x34260e);OpenchannelInteractionEvents[_0x241f('0xe')](_0x212d96,_0x34260e);_0x28a09f(null);})['catch'](_0x28a09f(null));};}for(var e in events){if(events[_0x241f('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x241f('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dc1f4e7..88601b1 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 _0x49cc=['moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','lodash'];(function(_0x5ae4cf,_0x273ae1){var _0x807ce8=function(_0xdccd20){while(--_0xdccd20){_0x5ae4cf['push'](_0x5ae4cf['shift']());}};_0x807ce8(++_0x273ae1);}(_0x49cc,0xc3));var _0xc49c=function(_0x235f7f,_0x4cc112){_0x235f7f=_0x235f7f-0x0;var _0x3bf31e=_0x49cc[_0x235f7f];return _0x3bf31e;};'use strict';var _=require(_0xc49c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc49c('0x1'));var BPromise=require(_0xc49c('0x2'));var rp=require(_0xc49c('0x3'));var fs=require('fs');var path=require(_0xc49c('0x4'));var rimraf=require(_0xc49c('0x5'));var config=require('../../config/environment');var attributes=require(_0xc49c('0x6'));module[_0xc49c('0x7')]=function(_0x2170b8,_0x228fcf){return _0x2170b8[_0xc49c('0x8')](_0xc49c('0x9'),attributes,{'tableName':_0xc49c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc49c('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x530952,_0x32c44c,_0x699a70){if(_0x530952[_0xc49c('0xc')]('closed')){_0x530952[_0xc49c('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x699a70(null,_0x530952);}}});}; \ No newline at end of file +var _0x21e5=['bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','lodash','util','../../config/logger','api'];(function(_0x4e565f,_0x550d88){var _0x7e1c96=function(_0x4412c6){while(--_0x4412c6){_0x4e565f['push'](_0x4e565f['shift']());}};_0x7e1c96(++_0x550d88);}(_0x21e5,0x1a5));var _0x521e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x21e5[_0x32d457];return _0x338386;};'use strict';var _=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var logger=require(_0x521e('0x2'))(_0x521e('0x3'));var moment=require('moment');var BPromise=require(_0x521e('0x4'));var rp=require(_0x521e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x521e('0x6'));var config=require(_0x521e('0x7'));var attributes=require(_0x521e('0x8'));module[_0x521e('0x9')]=function(_0x127110,_0x1535a5){return _0x127110[_0x521e('0xa')](_0x521e('0xb'),attributes,{'tableName':_0x521e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x521e('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x55d4fa,_0x36dd24,_0x48f83a){if(_0x55d4fa[_0x521e('0xe')](_0x521e('0xf'))){_0x55d4fa[_0x521e('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x48f83a(null,_0x55d4fa);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e74c564..1b61758 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 _0xeef5=['code','message','result','catch','OpenchannelInteraction','body','options','where','attributes','limit','UpdateOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x59e710,_0x364bb4){var _0x9812bf=function(_0x412ee9){while(--_0x412ee9){_0x59e710['push'](_0x59e710['shift']());}};_0x9812bf(++_0x364bb4);}(_0xeef5,0x150));var _0x5eef=function(_0x1f89da,_0x1fc71e){_0x1f89da=_0x1f89da-0x0;var _0x5df2cf=_0xeef5[_0x1f89da];return _0x5df2cf;};'use strict';var _=require(_0x5eef('0x0'));var util=require(_0x5eef('0x1'));var moment=require(_0x5eef('0x2'));var BPromise=require(_0x5eef('0x3'));var rs=require(_0x5eef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5eef('0x5'))['db'];var utils=require(_0x5eef('0x6'));var logger=require('../../config/logger')(_0x5eef('0x7'));var config=require(_0x5eef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5eef('0x9')][_0x5eef('0xa')]({'port':0x232a});config[_0x5eef('0xb')]=_[_0x5eef('0xc')](config[_0x5eef('0xb')],{'host':_0x5eef('0xd'),'port':0x18eb});var socket=require(_0x5eef('0xe'))(new Redis(config[_0x5eef('0xb')]));require('./openchannelInteraction.socket')[_0x5eef('0xf')](socket);function respondWithRpcPromise(_0x256f40,_0x2625d3,_0xfb055d){return new BPromise(function(_0x1298b7,_0x1c95a6){return client[_0x5eef('0x10')](_0x256f40,_0xfb055d)[_0x5eef('0x11')](function(_0x547f24){logger[_0x5eef('0x12')](_0x5eef('0x13'),_0x2625d3,_0x5eef('0x14'));logger[_0x5eef('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2625d3,'request\x20sent',JSON[_0x5eef('0x16')](_0x547f24));if(_0x547f24[_0x5eef('0x17')]){if(_0x547f24[_0x5eef('0x17')][_0x5eef('0x18')]===0x1f4){logger[_0x5eef('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2625d3,_0x547f24[_0x5eef('0x17')]['message']);return _0x1c95a6(_0x547f24['error'][_0x5eef('0x19')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2625d3,_0x547f24[_0x5eef('0x17')][_0x5eef('0x19')]);return _0x1298b7(_0x547f24[_0x5eef('0x17')][_0x5eef('0x19')]);}else{logger['info'](_0x5eef('0x13'),_0x2625d3,'request\x20sent');_0x1298b7(_0x547f24[_0x5eef('0x1a')][_0x5eef('0x19')]);}})[_0x5eef('0x1b')](function(_0xe80195){logger[_0x5eef('0x17')](_0x5eef('0x13'),_0x2625d3,_0xe80195);_0x1c95a6(_0xe80195);});});}exports['UpdateOpenchannelInteraction']=function(_0x430cad){var _0x1403c4=this;return new Promise(function(_0x4da279,_0x9e3424){return db[_0x5eef('0x1c')]['update'](_0x430cad[_0x5eef('0x1d')],{'raw':_0x430cad[_0x5eef('0x1e')]?_0x430cad[_0x5eef('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430cad[_0x5eef('0x1e')]?_0x430cad[_0x5eef('0x1e')][_0x5eef('0x1f')]||null:null,'attributes':_0x430cad[_0x5eef('0x1e')]?_0x430cad[_0x5eef('0x1e')][_0x5eef('0x20')]||null:null,'limit':_0x430cad['options']?_0x430cad[_0x5eef('0x1e')][_0x5eef('0x21')]||null:null})[_0x5eef('0x11')](function(_0x1a5851){logger[_0x5eef('0x12')](_0x5eef('0x22'),_0x430cad);logger[_0x5eef('0x15')](_0x5eef('0x22'),_0x430cad,JSON['stringify'](_0x1a5851));_0x4da279(_0x1a5851);})[_0x5eef('0x1b')](function(_0xff441d){logger[_0x5eef('0x17')](_0x5eef('0x22'),_0xff441d[_0x5eef('0x19')],_0x430cad);_0x9e3424(_0x1403c4[_0x5eef('0x17')](0x1f4,_0xff441d[_0x5eef('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x132ce6){return new Promise(function(_0x257aed,_0x15e766){return db[_0x5eef('0x1c')][_0x5eef('0x23')]({'where':_0x132ce6[_0x5eef('0x1e')]?_0x132ce6[_0x5eef('0x1e')][_0x5eef('0x1f')]||null:null})['then'](function(_0x497458){if(_0x497458){return _0x497458['addTags'](_0x132ce6['body'][_0x5eef('0x24')],_[_0x5eef('0x25')](_0x132ce6[_0x5eef('0x1d')],[_0x5eef('0x24'),'id'])||{});}})[_0x5eef('0x26')](function(_0x1f6763){logger[_0x5eef('0x12')](_0x5eef('0x27'),_0x132ce6);logger['debug'](_0x5eef('0x27'),_0x132ce6,JSON['stringify'](_0x1f6763));_0x257aed(_0x1f6763);})[_0x5eef('0x1b')](function(_0x2f9571){logger['error']('AddTags',_0x2f9571[_0x5eef('0x19')],_0x132ce6);_0x15e766(_this['error'](0x1f4,_0x2f9571['message']));});});}; \ No newline at end of file +var _0x4b75=['redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','then','addTags','omit','ids','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xec5148,_0x40b222){var _0x5bd062=function(_0x372e52){while(--_0x372e52){_0xec5148['push'](_0xec5148['shift']());}};_0x5bd062(++_0x40b222);}(_0x4b75,0x1e1));var _0x54b7=function(_0x4a0e04,_0x1231ed){_0x4a0e04=_0x4a0e04-0x0;var _0x3126f0=_0x4b75[_0x4a0e04];return _0x3126f0;};'use strict';var _=require('lodash');var util=require(_0x54b7('0x0'));var moment=require('moment');var BPromise=require(_0x54b7('0x1'));var rs=require(_0x54b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54b7('0x3'))['db'];var utils=require(_0x54b7('0x4'));var logger=require(_0x54b7('0x5'))(_0x54b7('0x6'));var config=require(_0x54b7('0x7'));var jayson=require(_0x54b7('0x8'));var client=jayson[_0x54b7('0x9')][_0x54b7('0xa')]({'port':0x232a});config[_0x54b7('0xb')]=_[_0x54b7('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x54b7('0xd'))(new Redis(config['redis']));require(_0x54b7('0xe'))[_0x54b7('0xf')](socket);function respondWithRpcPromise(_0x4aeb23,_0x146c49,_0x2bb2b3){return new BPromise(function(_0x2c4be8,_0x118a84){return client[_0x54b7('0x10')](_0x4aeb23,_0x2bb2b3)['then'](function(_0x271e17){logger[_0x54b7('0x11')](_0x54b7('0x12'),_0x146c49,_0x54b7('0x13'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x146c49,_0x54b7('0x13'),JSON[_0x54b7('0x14')](_0x271e17));if(_0x271e17[_0x54b7('0x15')]){if(_0x271e17['error'][_0x54b7('0x16')]===0x1f4){logger[_0x54b7('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x146c49,_0x271e17['error'][_0x54b7('0x17')]);return _0x118a84(_0x271e17[_0x54b7('0x15')][_0x54b7('0x17')]);}logger[_0x54b7('0x15')](_0x54b7('0x12'),_0x146c49,_0x271e17['error'][_0x54b7('0x17')]);return _0x2c4be8(_0x271e17[_0x54b7('0x15')][_0x54b7('0x17')]);}else{logger[_0x54b7('0x11')](_0x54b7('0x12'),_0x146c49,'request\x20sent');_0x2c4be8(_0x271e17[_0x54b7('0x18')]['message']);}})[_0x54b7('0x19')](function(_0x3b4576){logger['error'](_0x54b7('0x12'),_0x146c49,_0x3b4576);_0x118a84(_0x3b4576);});});}exports[_0x54b7('0x1a')]=function(_0x2d6b00){var _0x5b0682=this;return new Promise(function(_0x393544,_0x41f0cb){return db['OpenchannelInteraction']['update'](_0x2d6b00[_0x54b7('0x1b')],{'raw':_0x2d6b00['options']?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b00[_0x54b7('0x1c')]?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1e')]||null:null,'attributes':_0x2d6b00[_0x54b7('0x1c')]?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x1f')]||null:null,'limit':_0x2d6b00['options']?_0x2d6b00[_0x54b7('0x1c')][_0x54b7('0x20')]||null:null})['then'](function(_0x236a47){logger['info']('UpdateOpenchannelInteraction',_0x2d6b00);logger[_0x54b7('0x21')](_0x54b7('0x1a'),_0x2d6b00,JSON['stringify'](_0x236a47));_0x393544(_0x236a47);})[_0x54b7('0x19')](function(_0x286770){logger['error'](_0x54b7('0x1a'),_0x286770[_0x54b7('0x17')],_0x2d6b00);_0x41f0cb(_0x5b0682[_0x54b7('0x15')](0x1f4,_0x286770[_0x54b7('0x17')]));});});};exports[_0x54b7('0x22')]=function(_0x258ccc){return new Promise(function(_0x5200b8,_0x853a0c){return db[_0x54b7('0x23')]['find']({'where':_0x258ccc[_0x54b7('0x1c')]?_0x258ccc[_0x54b7('0x1c')][_0x54b7('0x1e')]||null:null})[_0x54b7('0x24')](function(_0x88ad46){if(_0x88ad46){return _0x88ad46[_0x54b7('0x25')](_0x258ccc['body']['ids'],_[_0x54b7('0x26')](_0x258ccc[_0x54b7('0x1b')],[_0x54b7('0x27'),'id'])||{});}})['spread'](function(_0x23c7b4){logger[_0x54b7('0x11')]('AddTags',_0x258ccc);logger[_0x54b7('0x21')](_0x54b7('0x28'),_0x258ccc,JSON[_0x54b7('0x14')](_0x23c7b4));_0x5200b8(_0x23c7b4);})[_0x54b7('0x19')](function(_0xe83a9e){logger[_0x54b7('0x15')](_0x54b7('0x28'),_0xe83a9e[_0x54b7('0x17')],_0x258ccc);_0x853a0c(_this[_0x54b7('0x15')](0x1f4,_0xe83a9e[_0x54b7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 95b3140..ab14404 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 _0xb27e=['length','./openchannelInteraction.events','remove','update','emit','removeListener','register'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb27e,0x1dd));var _0xeb27=function(_0x499f71,_0x5d81b3){_0x499f71=_0x499f71-0x0;var _0x101fc0=_0xb27e[_0x499f71];return _0x101fc0;};'use strict';var OpenchannelInteractionEvents=require(_0xeb27('0x0'));var events=['save',_0xeb27('0x1'),_0xeb27('0x2')];function createListener(_0x7c5142,_0x1224a4){return function(_0x35657e){_0x1224a4[_0xeb27('0x3')](_0x7c5142,_0x35657e);};}function removeListener(_0x46f390,_0x1194ab){return function(){OpenchannelInteractionEvents[_0xeb27('0x4')](_0x46f390,_0x1194ab);};}exports[_0xeb27('0x5')]=function(_0x3d39ca){for(var _0x44ff99=0x0,_0x2f9207=events[_0xeb27('0x6')];_0x44ff99<_0x2f9207;_0x44ff99++){var _0x44040f=events[_0x44ff99];var _0x78c853=createListener('openchannelInteraction:'+_0x44040f,_0x3d39ca);OpenchannelInteractionEvents['on'](_0x44040f,_0x78c853);}}; \ No newline at end of file +var _0xbe59=['./openchannelInteraction.events','save','update','register','openchannelInteraction:'];(function(_0x3d26b7,_0xd960b){var _0xbe0757=function(_0x30b5e1){while(--_0x30b5e1){_0x3d26b7['push'](_0x3d26b7['shift']());}};_0xbe0757(++_0xd960b);}(_0xbe59,0xaa));var _0x9be5=function(_0x13034b,_0xf7406f){_0x13034b=_0x13034b-0x0;var _0x2deaae=_0xbe59[_0x13034b];return _0x2deaae;};'use strict';var OpenchannelInteractionEvents=require(_0x9be5('0x0'));var events=[_0x9be5('0x1'),'remove',_0x9be5('0x2')];function createListener(_0x496969,_0x1f28ba){return function(_0x458f97){_0x1f28ba['emit'](_0x496969,_0x458f97);};}function removeListener(_0xde2884,_0x1a5bd4){return function(){OpenchannelInteractionEvents['removeListener'](_0xde2884,_0x1a5bd4);};}exports[_0x9be5('0x3')]=function(_0x4013bb){for(var _0x3eae1b=0x0,_0xfdd474=events['length'];_0x3eae1b<_0xfdd474;_0x3eae1b++){var _0x376f92=events[_0x3eae1b];var _0x132d06=createListener(_0x9be5('0x4')+_0x376f92,_0x4013bb);OpenchannelInteractionEvents['on'](_0x376f92,_0x132d06);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d365e5c..7e66f81 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xbefd3c,_0xbc56f0){var _0x253ad5=function(_0x284b82){while(--_0x284b82){_0xbefd3c['push'](_0xbefd3c['shift']());}};_0x253ad5(++_0xbc56f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);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 39eeffc..702c28e 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 _0xf3aa=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x11a172,_0x1165ca){var _0x3d8d96=function(_0x456763){while(--_0x456763){_0x11a172['push'](_0x11a172['shift']());}};_0x3d8d96(++_0x1165ca);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0xf3aa[_0x6d394d];return _0x1f0621;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'body':{'type':Sequelize[_0xaf3a('0x2')](_0xaf3a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xaf3a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaf3a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaf3a('0x6')]},'providerName':{'type':Sequelize[_0xaf3a('0x7')]},'providerResponse':{'type':Sequelize[_0xaf3a('0x2')]}}; \ No newline at end of file +var _0xee4f=['BOOLEAN','out','DATE','sequelize','medium'];(function(_0x3609af,_0x3d20ea){var _0x438412=function(_0x3bc2a4){while(--_0x3bc2a4){_0x3609af['push'](_0x3609af['shift']());}};_0x438412(++_0x3d20ea);}(_0xee4f,0xad));var _0xfee4=function(_0x310342,_0x189cdd){_0x310342=_0x310342-0x0;var _0x3cc7ba=_0xee4f[_0x310342];return _0x3cc7ba;};'use strict';var Sequelize=require(_0xfee4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xfee4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfee4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfee4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfee4('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfee4('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 00bde99..c1af9f8 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 _0x1c8a=['./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','name','send','index','OpenchannelMessage','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','describe','../../config/logger','accept','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','get','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x1fb5d1,_0x95dbe6){var _0x38611d=function(_0x227056){while(--_0x227056){_0x1fb5d1['push'](_0x1fb5d1['shift']());}};_0x38611d(++_0x95dbe6);}(_0x1c8a,0x1f0));var _0xa1c8=function(_0x1e4ec0,_0xac7bca){_0x1e4ec0=_0x1e4ec0-0x0;var _0x5579dd=_0x1c8a[_0x1e4ec0];return _0x5579dd;};'use strict';var emlformat=require(_0xa1c8('0x0'));var rimraf=require(_0xa1c8('0x1'));var zipdir=require(_0xa1c8('0x2'));var jsonpatch=require(_0xa1c8('0x3'));var rp=require(_0xa1c8('0x4'));var moment=require(_0xa1c8('0x5'));var BPromise=require(_0xa1c8('0x6'));var Mustache=require(_0xa1c8('0x7'));var util=require(_0xa1c8('0x8'));var path=require(_0xa1c8('0x9'));var sox=require(_0xa1c8('0xa'));var csv=require(_0xa1c8('0xb'));var ejs=require(_0xa1c8('0xc'));var fs=require('fs');var fs_extra=require(_0xa1c8('0xd'));var _=require(_0xa1c8('0xe'));var squel=require('squel');var crypto=require(_0xa1c8('0xf'));var jsforce=require(_0xa1c8('0x10'));var deskjs=require(_0xa1c8('0x11'));var toCsv=require(_0xa1c8('0xb'));var querystring=require(_0xa1c8('0x12'));var Papa=require(_0xa1c8('0x13'));var Redis=require('ioredis');var authService=require(_0xa1c8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1c8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa1c8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x17'));var db=require(_0xa1c8('0x18'))['db'];config[_0xa1c8('0x19')]=_[_0xa1c8('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa1c8('0x1b'))(new Redis(config[_0xa1c8('0x19')]));require(_0xa1c8('0x1c'))[_0xa1c8('0x1d')](socket);var jayson=require(_0xa1c8('0x1e'));var client=jayson[_0xa1c8('0x1f')][_0xa1c8('0x20')]({'port':0x232c});var client9002=jayson[_0xa1c8('0x1f')][_0xa1c8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xeeaf4c,_0x58e7c6,_0x427dca,_0x2ebabd){return new BPromise(function(_0x52dce8,_0x7dcbbd){var _0x20cbd3=_0x2ebabd||client;return _0x20cbd3[_0xa1c8('0x21')](_0xeeaf4c,_0x427dca)[_0xa1c8('0x22')](function(_0x5a5a67){logger['info'](_0xa1c8('0x23'),_0x58e7c6,_0xa1c8('0x24'));logger[_0xa1c8('0x25')](_0xa1c8('0x26'),_0x58e7c6,_0xa1c8('0x24'),JSON[_0xa1c8('0x27')](_0x5a5a67));if(_0x5a5a67[_0xa1c8('0x28')]){if(_0x5a5a67[_0xa1c8('0x28')][_0xa1c8('0x29')]===0x1f4){logger[_0xa1c8('0x28')](_0xa1c8('0x23'),_0x58e7c6,_0x5a5a67['error'][_0xa1c8('0x2a')]);return _0x7dcbbd(_0x5a5a67['error'][_0xa1c8('0x2a')]);}logger[_0xa1c8('0x28')](_0xa1c8('0x23'),_0x58e7c6,_0x5a5a67[_0xa1c8('0x28')][_0xa1c8('0x2a')]);return _0x52dce8(_0x5a5a67[_0xa1c8('0x28')][_0xa1c8('0x2a')]);}else{logger[_0xa1c8('0x2b')](_0xa1c8('0x23'),_0x58e7c6,'request\x20sent');_0x52dce8(_0x5a5a67['result']['message']);}})[_0xa1c8('0x2c')](function(_0x507d86){logger[_0xa1c8('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x58e7c6,_0x507d86);_0x7dcbbd(_0x507d86);});});}function respondWithStatusCode(_0x4b2099,_0x1e9aa4){_0x1e9aa4=_0x1e9aa4||0xcc;return function(_0x55edbc){if(_0x55edbc){return _0x4b2099[_0xa1c8('0x2d')](_0x1e9aa4);}return _0x4b2099[_0xa1c8('0x2e')](_0x1e9aa4)[_0xa1c8('0x2f')]();};}function respondWithResult(_0x3d5c80,_0x17c22d){_0x17c22d=_0x17c22d||0xc8;return function(_0x5215e2){if(_0x5215e2){return _0x3d5c80[_0xa1c8('0x2e')](_0x17c22d)['json'](_0x5215e2);}};}function respondWithFilteredResult(_0x444a90,_0x60466){return function(_0x1f71ee){if(_0x1f71ee){var _0x1d585d=typeof _0x60466[_0xa1c8('0x30')]===_0xa1c8('0x31')&&typeof _0x60466[_0xa1c8('0x32')]===_0xa1c8('0x31');var _0x277675=_0x1f71ee[_0xa1c8('0x33')];var _0x4de089=_0x1d585d?0x0:_0x60466[_0xa1c8('0x30')];var _0x27a14b=_0x1d585d?_0x1f71ee[_0xa1c8('0x33')]:_0x60466[_0xa1c8('0x30')]+_0x60466['limit'];var _0x4917ae;if(_0x27a14b>=_0x277675){_0x27a14b=_0x277675;_0x4917ae=0xc8;}else{_0x4917ae=0xce;}_0x444a90[_0xa1c8('0x2e')](_0x4917ae);return _0x444a90[_0xa1c8('0x34')]('Content-Range',_0x4de089+'-'+_0x27a14b+'/'+_0x277675)[_0xa1c8('0x35')](_0x1f71ee);}return null;};}function patchUpdates(_0x468007){return function(_0x51d4e9){try{jsonpatch[_0xa1c8('0x36')](_0x51d4e9,_0x468007,!![]);}catch(_0x585a8c){return BPromise[_0xa1c8('0x37')](_0x585a8c);}return _0x51d4e9[_0xa1c8('0x38')]();};}function saveUpdates(_0xfd6b71,_0x507285){return function(_0x20bc68){if(_0x20bc68){return _0x20bc68[_0xa1c8('0x39')](_0xfd6b71)['then'](function(_0x37e4df){return _0x37e4df;});}return null;};}function removeEntity(_0x31b0a9,_0x1c3fc5){return function(_0x2d3c3d){if(_0x2d3c3d){return _0x2d3c3d[_0xa1c8('0x3a')]()[_0xa1c8('0x22')](function(){_0x31b0a9[_0xa1c8('0x2e')](0xcc)[_0xa1c8('0x2f')]();});}};}function handleEntityNotFound(_0x2741f2,_0x7341a9){return function(_0x714cc5){if(!_0x714cc5){_0x2741f2[_0xa1c8('0x2d')](0x194);}return _0x714cc5;};}function handleError(_0x143d7d,_0x2beaf6){_0x2beaf6=_0x2beaf6||0x1f4;return function(_0x19bbb1){logger[_0xa1c8('0x28')](_0x19bbb1['stack']);if(_0x19bbb1[_0xa1c8('0x3b')]){delete _0x19bbb1['name'];}_0x143d7d['status'](_0x2beaf6)[_0xa1c8('0x3c')](_0x19bbb1);};}exports[_0xa1c8('0x3d')]=function(_0x5a8056,_0x4b2bc2){var _0x1ad82d={},_0x1a77f4={},_0x63d53f={'count':0x0,'rows':[]};var _0x4b9536=_['map'](db[_0xa1c8('0x3e')]['rawAttributes'],function(_0x34fd95){return{'name':_0x34fd95['fieldName'],'type':_0x34fd95[_0xa1c8('0x3f')][_0xa1c8('0x40')]};});_0x1a77f4[_0xa1c8('0x41')]=_[_0xa1c8('0x42')](_0x4b9536,'name');_0x1a77f4[_0xa1c8('0x43')]=_[_0xa1c8('0x44')](_0x5a8056[_0xa1c8('0x43')]);_0x1a77f4[_0xa1c8('0x45')]=_['intersection'](_0x1a77f4[_0xa1c8('0x41')],_0x1a77f4[_0xa1c8('0x43')]);_0x1ad82d[_0xa1c8('0x46')]=_[_0xa1c8('0x47')](_0x1a77f4[_0xa1c8('0x41')],qs[_0xa1c8('0x48')](_0x5a8056[_0xa1c8('0x43')]['fields']));_0x1ad82d['attributes']=_0x1ad82d[_0xa1c8('0x46')]['length']?_0x1ad82d[_0xa1c8('0x46')]:_0x1a77f4[_0xa1c8('0x41')];if(!_0x5a8056['query'][_0xa1c8('0x49')](_0xa1c8('0x4a'))){_0x1ad82d[_0xa1c8('0x32')]=qs[_0xa1c8('0x32')](_0x5a8056[_0xa1c8('0x43')][_0xa1c8('0x32')]);_0x1ad82d[_0xa1c8('0x30')]=qs[_0xa1c8('0x30')](_0x5a8056[_0xa1c8('0x43')]['offset']);}_0x1ad82d[_0xa1c8('0x4b')]=qs[_0xa1c8('0x4c')](_0x5a8056[_0xa1c8('0x43')][_0xa1c8('0x4c')]);_0x1ad82d[_0xa1c8('0x4d')]=qs[_0xa1c8('0x45')](_['pick'](_0x5a8056[_0xa1c8('0x43')],_0x1a77f4[_0xa1c8('0x45')]),_0x4b9536);if(_0x5a8056[_0xa1c8('0x43')][_0xa1c8('0x4e')]){_0x1ad82d[_0xa1c8('0x4d')]=_[_0xa1c8('0x4f')](_0x1ad82d[_0xa1c8('0x4d')],{'$or':_[_0xa1c8('0x42')](_0x4b9536,function(_0x370e31){if(_0x370e31[_0xa1c8('0x3f')]!==_0xa1c8('0x50')){var _0x271325={};_0x271325[_0x370e31[_0xa1c8('0x3b')]]={'$like':'%'+_0x5a8056[_0xa1c8('0x43')]['filter']+'%'};return _0x271325;}})});}_0x1ad82d=_[_0xa1c8('0x4f')]({},_0x1ad82d,_0x5a8056[_0xa1c8('0x51')]);var _0x1f5e2b={'where':_0x1ad82d[_0xa1c8('0x4d')]};return db[_0xa1c8('0x3e')]['count'](_0x1f5e2b)[_0xa1c8('0x22')](function(_0x3c6dbb){_0x63d53f[_0xa1c8('0x33')]=_0x3c6dbb;if(_0x5a8056['query'][_0xa1c8('0x52')]){_0x1ad82d[_0xa1c8('0x53')]=[{'all':!![]}];}return db[_0xa1c8('0x3e')][_0xa1c8('0x54')](_0x1ad82d);})['then'](function(_0xca6fd0){_0x63d53f[_0xa1c8('0x55')]=_0xca6fd0;return _0x63d53f;})[_0xa1c8('0x22')](respondWithFilteredResult(_0x4b2bc2,_0x1ad82d))[_0xa1c8('0x2c')](handleError(_0x4b2bc2,null));};exports[_0xa1c8('0x56')]=function(_0x543297,_0x2db709){var _0x32cfb6={'raw':!![],'where':{'id':_0x543297[_0xa1c8('0x57')]['id']}},_0x457974={};_0x457974['model']=_[_0xa1c8('0x44')](db[_0xa1c8('0x3e')][_0xa1c8('0x58')]);_0x457974[_0xa1c8('0x43')]=_[_0xa1c8('0x44')](_0x543297[_0xa1c8('0x43')]);_0x457974[_0xa1c8('0x45')]=_[_0xa1c8('0x47')](_0x457974['model'],_0x457974[_0xa1c8('0x43')]);_0x32cfb6[_0xa1c8('0x46')]=_[_0xa1c8('0x47')](_0x457974['model'],qs[_0xa1c8('0x48')](_0x543297[_0xa1c8('0x43')][_0xa1c8('0x48')]));_0x32cfb6[_0xa1c8('0x46')]=_0x32cfb6[_0xa1c8('0x46')][_0xa1c8('0x59')]?_0x32cfb6[_0xa1c8('0x46')]:_0x457974[_0xa1c8('0x41')];if(_0x543297[_0xa1c8('0x43')][_0xa1c8('0x52')]){_0x32cfb6[_0xa1c8('0x53')]=[{'all':!![]}];}_0x32cfb6=_[_0xa1c8('0x4f')]({},_0x32cfb6,_0x543297[_0xa1c8('0x51')]);return db['OpenchannelMessage'][_0xa1c8('0x5a')](_0x32cfb6)[_0xa1c8('0x22')](handleEntityNotFound(_0x2db709,null))[_0xa1c8('0x22')](respondWithResult(_0x2db709,null))[_0xa1c8('0x2c')](handleError(_0x2db709,null));};exports[_0xa1c8('0x5b')]=function(_0x48c8a1,_0x236eaf){return db[_0xa1c8('0x3e')][_0xa1c8('0x5b')](_0x48c8a1[_0xa1c8('0x5c')],{})[_0xa1c8('0x22')](respondWithResult(_0x236eaf,0xc9))[_0xa1c8('0x2c')](handleError(_0x236eaf,null));};exports[_0xa1c8('0x39')]=function(_0x25120b,_0x511380){if(_0x25120b[_0xa1c8('0x5c')]['id']){delete _0x25120b[_0xa1c8('0x5c')]['id'];}return db[_0xa1c8('0x3e')][_0xa1c8('0x5a')]({'where':{'id':_0x25120b[_0xa1c8('0x57')]['id']}})['then'](handleEntityNotFound(_0x511380,null))[_0xa1c8('0x22')](saveUpdates(_0x25120b['body'],null))[_0xa1c8('0x22')](respondWithResult(_0x511380,null))[_0xa1c8('0x2c')](handleError(_0x511380,null));};exports[_0xa1c8('0x3a')]=function(_0x182767,_0xf4e346){return db[_0xa1c8('0x3e')][_0xa1c8('0x5a')]({'where':{'id':_0x182767[_0xa1c8('0x57')]['id']}})[_0xa1c8('0x22')](handleEntityNotFound(_0xf4e346,null))[_0xa1c8('0x22')](removeEntity(_0xf4e346,null))[_0xa1c8('0x2c')](handleError(_0xf4e346,null));};exports[_0xa1c8('0x5d')]=function(_0x497f2f,_0x2ce4ea){return db[_0xa1c8('0x3e')][_0xa1c8('0x5d')]()[_0xa1c8('0x22')](respondWithResult(_0x2ce4ea,null))[_0xa1c8('0x2c')](handleError(_0x2ce4ea,null));};var interaction_log=require(_0xa1c8('0x5e'))('openchannel-interactions');exports[_0xa1c8('0x5f')]=function(_0x5b600f,_0x41d509,_0x537f2d){var _0x31170c={'agent':{},'channel':_0xa1c8('0x60')};if(_0x5b600f[_0xa1c8('0x5c')]['id']){delete _0x5b600f['body']['id'];}_0x5b600f['body']['read']=!![];_0x5b600f[_0xa1c8('0x5c')][_0xa1c8('0x61')]=moment()['format'](_0xa1c8('0x62'));_0x5b600f[_0xa1c8('0x5c')][_0xa1c8('0x63')]=_0x5b600f['body'][_0xa1c8('0x63')]||_0x5b600f['user']['id'];_0x31170c[_0xa1c8('0x64')]['id']=_0x5b600f[_0xa1c8('0x5c')]['UserId'];return db[_0xa1c8('0x3e')][_0xa1c8('0x5a')]({'where':{'id':_0x5b600f[_0xa1c8('0x57')]['id'],'UserId':null}})[_0xa1c8('0x22')](handleEntityNotFound(_0x41d509,null))[_0xa1c8('0x22')](saveUpdates(_0x5b600f[_0xa1c8('0x5c')],null))[_0xa1c8('0x22')](function(_0x399180){if(_0x399180){_0x31170c['message']=_0x399180['get']({'plain':!![]});return db[_0xa1c8('0x65')][_0xa1c8('0x5a')]({'where':{'id':_0x399180['OpenchannelInteractionId']}});}return null;})[_0xa1c8('0x22')](handleEntityNotFound(_0x41d509,null))[_0xa1c8('0x22')](function(_0x14a77f){if(_0x14a77f){return _0x14a77f[_0xa1c8('0x39')]({'UserId':_0x5b600f[_0xa1c8('0x5c')][_0xa1c8('0x63')],'read1stAt':_[_0xa1c8('0x66')](_0x14a77f[_0xa1c8('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa1c8('0x22')](function(_0x1d97e0){if(_0x1d97e0){_0x31170c[_0xa1c8('0x68')]=_0x1d97e0['get']({'plain':!![]});interaction_log[_0xa1c8('0x2b')](_0xa1c8('0x69'),_0x5b600f[_0xa1c8('0x6a')]['id'],_0x5b600f[_0xa1c8('0x6a')]['name'],_0x5b600f[_0xa1c8('0x6a')][_0xa1c8('0x6b')],_0x31170c['interaction']['id'],_0x5b600f[_0xa1c8('0x5c')]?JSON[_0xa1c8('0x27')](_0x5b600f[_0xa1c8('0x5c')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x31170c);}return null;})[_0xa1c8('0x22')](function(_0xe488c){var _0x3a7954=_0xa1c8('0x6c')+_0xe488c[_0xa1c8('0x2a')][_0xa1c8('0x6d')];return db['sequelize']['query'](_0x3a7954,{'type':db[_0xa1c8('0x6e')][_0xa1c8('0x6f')]['SELECT'],'raw':!![]})[_0xa1c8('0x22')](function(_0x8f03bc){return _0x8f03bc;});})[_0xa1c8('0x22')](function(_0x5f460c){if(_0x5f460c){_0x31170c['message'][_0xa1c8('0x70')]=_0x5f460c[0x0];if(!_0x5b600f[_0xa1c8('0x5c')]['UserId'])return;return db['User'][_0xa1c8('0x5a')]({'where':{'id':_0x5b600f[_0xa1c8('0x5c')]['UserId'],'role':_0xa1c8('0x64')},'attributes':['id',_0xa1c8('0x3b'),_0xa1c8('0x71'),'email',_0xa1c8('0x72')],'raw':!![]});}return null;})[_0xa1c8('0x22')](function(_0x5823d8){if(!_0x5823d8)return null;_0x31170c[_0xa1c8('0x2a')]['agent']=_0x5823d8;return _0x31170c;})[_0xa1c8('0x22')](function(_0x3e75c2){if(_0x3e75c2){if(_0x5b600f[_0xa1c8('0x5c')][_0xa1c8('0x73')]){_0x31170c['message'][_0xa1c8('0x74')]=util['format'](_0xa1c8('0x75'),_0x5b600f[_0xa1c8('0x6a')][_0xa1c8('0x3b')]);_0x31170c['message'][_0xa1c8('0x76')]=_0x31170c['channel'];_0x31170c[_0xa1c8('0x2a')][_0xa1c8('0x77')]=_0x31170c['channel'];_0x31170c[_0xa1c8('0x2a')][_0xa1c8('0x78')]=_0xa1c8('0x5f');return respondWithRpcPromise(_0xa1c8('0x79'),'EventManager',{'event':_0xa1c8('0x7a'),'message':_0x31170c[_0xa1c8('0x2a')]},client9002)[_0xa1c8('0x22')](function(){return _0x31170c;});}return _0x31170c;}return null;})[_0xa1c8('0x22')](respondWithResult(_0x41d509,null))[_0xa1c8('0x2c')](handleError(_0x41d509,null));};var interaction_log=require('../../config/logger')(_0xa1c8('0x7b'));exports[_0xa1c8('0x37')]=function(_0x23925d,_0x1aa2cf,_0x4dfdc3){var _0x53cf89={'agent':{},'channel':_0xa1c8('0x60')};if(_0x23925d[_0xa1c8('0x5c')]['id']){delete _0x23925d['body']['id'];}_0x23925d[_0xa1c8('0x5c')]['UserId']=_0x23925d['body'][_0xa1c8('0x63')]||_0x23925d[_0xa1c8('0x6a')]['id'];_0x53cf89[_0xa1c8('0x64')]['id']=_0x23925d[_0xa1c8('0x5c')][_0xa1c8('0x63')];return db[_0xa1c8('0x3e')][_0xa1c8('0x5a')]({'where':{'id':_0x23925d[_0xa1c8('0x57')]['id'],'UserId':null}})[_0xa1c8('0x22')](handleEntityNotFound(_0x1aa2cf,null))[_0xa1c8('0x22')](function(_0x501dc1){if(_0x501dc1){_0x53cf89['message']=_0x501dc1[_0xa1c8('0x7c')]({'plain':!![]});return db[_0xa1c8('0x65')][_0xa1c8('0x5a')]({'where':{'id':_0x501dc1[_0xa1c8('0x7d')]}});}return null;})[_0xa1c8('0x22')](handleEntityNotFound(_0x1aa2cf,null))['then'](function(_0x567cf5){if(_0x567cf5){_0x53cf89['interaction']=_0x567cf5[_0xa1c8('0x7c')]({'plain':!![]});interaction_log['info'](_0xa1c8('0x7e'),_0x23925d['user']['id'],_0x23925d['user']['name'],_0x23925d[_0xa1c8('0x6a')]['role'],_0x53cf89[_0xa1c8('0x68')]['id'],_0x23925d[_0xa1c8('0x5c')]?JSON[_0xa1c8('0x27')](_0x23925d['body']):_0xa1c8('0x7f'));return respondWithRpcPromise('RejectMessage',_0xa1c8('0x80'),_0x53cf89);}return null;})[_0xa1c8('0x22')](function(_0x21837a){var _0x389c11=_0xa1c8('0x6c')+_0x21837a[_0xa1c8('0x2a')][_0xa1c8('0x6d')];return db[_0xa1c8('0x81')]['query'](_0x389c11,{'type':db[_0xa1c8('0x6e')][_0xa1c8('0x6f')]['SELECT'],'raw':!![]})[_0xa1c8('0x22')](function(_0x29057c){return _0x29057c;});})[_0xa1c8('0x22')](function(_0x297c66){if(_0x297c66){_0x53cf89[_0xa1c8('0x2a')][_0xa1c8('0x70')]=_0x297c66[0x0];if(!_0x23925d[_0xa1c8('0x5c')][_0xa1c8('0x63')])return;return db['User'][_0xa1c8('0x5a')]({'where':{'id':_0x23925d[_0xa1c8('0x5c')]['UserId'],'role':'agent'},'attributes':['id','name','fullname','email',_0xa1c8('0x72')],'raw':!![]});}return null;})[_0xa1c8('0x22')](function(_0x159fc7){if(!_0x159fc7)return null;_0x53cf89[_0xa1c8('0x2a')][_0xa1c8('0x64')]=_0x159fc7;return _0x53cf89;})['then'](function(_0x2f0c5a){if(_0x2f0c5a){_0x2f0c5a['message'][_0xa1c8('0x74')]=util['format'](_0xa1c8('0x75'),_0x23925d[_0xa1c8('0x6a')][_0xa1c8('0x3b')]);_0x2f0c5a[_0xa1c8('0x2a')][_0xa1c8('0x76')]=_0x53cf89[_0xa1c8('0x76')];_0x2f0c5a[_0xa1c8('0x2a')][_0xa1c8('0x77')]=_0x53cf89[_0xa1c8('0x76')];_0x2f0c5a['message']['event']=_0xa1c8('0x37');respondWithRpcPromise(_0xa1c8('0x79'),_0xa1c8('0x79'),{'event':_0xa1c8('0x82'),'message':_0x2f0c5a[_0xa1c8('0x2a')]},client9002);return _0x53cf89;}return null;})['then'](respondWithResult(_0x1aa2cf,null))[_0xa1c8('0x2c')](handleError(_0x1aa2cf,null));}; \ No newline at end of file +var _0x6ca2=['stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','channel','EventManager','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','SIP/%s','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','destroy'];(function(_0x10dbba,_0x3147ea){var _0x19bcda=function(_0x5e01e7){while(--_0x5e01e7){_0x10dbba['push'](_0x10dbba['shift']());}};_0x19bcda(++_0x3147ea);}(_0x6ca2,0xc8));var _0x26ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6ca2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ca('0x0'));var zipdir=require(_0x26ca('0x1'));var jsonpatch=require(_0x26ca('0x2'));var rp=require(_0x26ca('0x3'));var moment=require(_0x26ca('0x4'));var BPromise=require(_0x26ca('0x5'));var Mustache=require(_0x26ca('0x6'));var util=require(_0x26ca('0x7'));var path=require(_0x26ca('0x8'));var sox=require(_0x26ca('0x9'));var csv=require('to-csv');var ejs=require(_0x26ca('0xa'));var fs=require('fs');var fs_extra=require(_0x26ca('0xb'));var _=require('lodash');var squel=require(_0x26ca('0xc'));var crypto=require(_0x26ca('0xd'));var jsforce=require(_0x26ca('0xe'));var deskjs=require(_0x26ca('0xf'));var toCsv=require(_0x26ca('0x10'));var querystring=require(_0x26ca('0x11'));var Papa=require(_0x26ca('0x12'));var Redis=require(_0x26ca('0x13'));var authService=require(_0x26ca('0x14'));var qs=require(_0x26ca('0x15'));var as=require(_0x26ca('0x16'));var hardwareService=require(_0x26ca('0x17'));var logger=require(_0x26ca('0x18'))('api');var utils=require(_0x26ca('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x26ca('0x1a'));var db=require(_0x26ca('0x1b'))['db'];config[_0x26ca('0x1c')]=_[_0x26ca('0x1d')](config[_0x26ca('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x26ca('0x1e')][_0x26ca('0x1f')]({'port':0x232c});var client9002=jayson[_0x26ca('0x1e')][_0x26ca('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2be192,_0x32aaef,_0x5b49ea,_0x339d48){return new BPromise(function(_0x478208,_0x684dba){var _0x2972e9=_0x339d48||client;return _0x2972e9[_0x26ca('0x20')](_0x2be192,_0x5b49ea)[_0x26ca('0x21')](function(_0x3963e4){logger[_0x26ca('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x32aaef,_0x26ca('0x23'));logger[_0x26ca('0x24')](_0x26ca('0x25'),_0x32aaef,_0x26ca('0x23'),JSON[_0x26ca('0x26')](_0x3963e4));if(_0x3963e4[_0x26ca('0x27')]){if(_0x3963e4[_0x26ca('0x27')][_0x26ca('0x28')]===0x1f4){logger[_0x26ca('0x27')](_0x26ca('0x29'),_0x32aaef,_0x3963e4['error'][_0x26ca('0x2a')]);return _0x684dba(_0x3963e4[_0x26ca('0x27')][_0x26ca('0x2a')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x32aaef,_0x3963e4[_0x26ca('0x27')][_0x26ca('0x2a')]);return _0x478208(_0x3963e4['error'][_0x26ca('0x2a')]);}else{logger[_0x26ca('0x22')](_0x26ca('0x29'),_0x32aaef,'request\x20sent');_0x478208(_0x3963e4[_0x26ca('0x2b')][_0x26ca('0x2a')]);}})[_0x26ca('0x2c')](function(_0x1b6971){logger['error'](_0x26ca('0x29'),_0x32aaef,_0x1b6971);_0x684dba(_0x1b6971);});});}function respondWithStatusCode(_0x45e34e,_0x40d0d9){_0x40d0d9=_0x40d0d9||0xcc;return function(_0x5d1e59){if(_0x5d1e59){return _0x45e34e[_0x26ca('0x2d')](_0x40d0d9);}return _0x45e34e[_0x26ca('0x2e')](_0x40d0d9)[_0x26ca('0x2f')]();};}function respondWithResult(_0x4c33bb,_0x14db9d){_0x14db9d=_0x14db9d||0xc8;return function(_0x3df62b){if(_0x3df62b){return _0x4c33bb['status'](_0x14db9d)[_0x26ca('0x30')](_0x3df62b);}};}function respondWithFilteredResult(_0x1ee4ca,_0x40601e){return function(_0x4302ca){if(_0x4302ca){var _0xa51f8d=typeof _0x40601e[_0x26ca('0x31')]===_0x26ca('0x32')&&typeof _0x40601e[_0x26ca('0x33')]===_0x26ca('0x32');var _0x20adea=_0x4302ca[_0x26ca('0x34')];var _0x1d4acb=_0xa51f8d?0x0:_0x40601e[_0x26ca('0x31')];var _0x32b703=_0xa51f8d?_0x4302ca[_0x26ca('0x34')]:_0x40601e[_0x26ca('0x31')]+_0x40601e[_0x26ca('0x33')];var _0x47e76b;if(_0x32b703>=_0x20adea){_0x32b703=_0x20adea;_0x47e76b=0xc8;}else{_0x47e76b=0xce;}_0x1ee4ca[_0x26ca('0x2e')](_0x47e76b);return _0x1ee4ca['set']('Content-Range',_0x1d4acb+'-'+_0x32b703+'/'+_0x20adea)[_0x26ca('0x30')](_0x4302ca);}return null;};}function patchUpdates(_0x1b1feb){return function(_0x4ad04e){try{jsonpatch[_0x26ca('0x35')](_0x4ad04e,_0x1b1feb,!![]);}catch(_0xdc785b){return BPromise['reject'](_0xdc785b);}return _0x4ad04e['save']();};}function saveUpdates(_0x2d3bb1,_0x687f21){return function(_0x245dd7){if(_0x245dd7){return _0x245dd7[_0x26ca('0x36')](_0x2d3bb1)['then'](function(_0x235b3e){return _0x235b3e;});}return null;};}function removeEntity(_0x41994e,_0x3e9197){return function(_0x1821ea){if(_0x1821ea){return _0x1821ea[_0x26ca('0x37')]()[_0x26ca('0x21')](function(){_0x41994e[_0x26ca('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49bb65,_0x138f31){return function(_0x1d1ec5){if(!_0x1d1ec5){_0x49bb65[_0x26ca('0x2d')](0x194);}return _0x1d1ec5;};}function handleError(_0x41da1b,_0x28c400){_0x28c400=_0x28c400||0x1f4;return function(_0x1d67f3){logger[_0x26ca('0x27')](_0x1d67f3[_0x26ca('0x38')]);if(_0x1d67f3[_0x26ca('0x39')]){delete _0x1d67f3[_0x26ca('0x39')];}_0x41da1b[_0x26ca('0x2e')](_0x28c400)[_0x26ca('0x3a')](_0x1d67f3);};}exports[_0x26ca('0x3b')]=function(_0x6d0eea,_0x53aacc){var _0x57423d={},_0x8239ec={},_0x48437f={'count':0x0,'rows':[]};var _0x212ba2=_['map'](db[_0x26ca('0x3c')][_0x26ca('0x3d')],function(_0x4bebc2){return{'name':_0x4bebc2[_0x26ca('0x3e')],'type':_0x4bebc2[_0x26ca('0x3f')]['key']};});_0x8239ec['model']=_[_0x26ca('0x40')](_0x212ba2,_0x26ca('0x39'));_0x8239ec[_0x26ca('0x41')]=_[_0x26ca('0x42')](_0x6d0eea['query']);_0x8239ec[_0x26ca('0x43')]=_[_0x26ca('0x44')](_0x8239ec[_0x26ca('0x45')],_0x8239ec[_0x26ca('0x41')]);_0x57423d[_0x26ca('0x46')]=_[_0x26ca('0x44')](_0x8239ec[_0x26ca('0x45')],qs[_0x26ca('0x47')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x47')]));_0x57423d[_0x26ca('0x46')]=_0x57423d[_0x26ca('0x46')]['length']?_0x57423d['attributes']:_0x8239ec[_0x26ca('0x45')];if(!_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x48')](_0x26ca('0x49'))){_0x57423d[_0x26ca('0x33')]=qs[_0x26ca('0x33')](_0x6d0eea['query'][_0x26ca('0x33')]);_0x57423d[_0x26ca('0x31')]=qs[_0x26ca('0x31')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x31')]);}_0x57423d['order']=qs[_0x26ca('0x4a')](_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x4a')]);_0x57423d['where']=qs[_0x26ca('0x43')](_[_0x26ca('0x4b')](_0x6d0eea[_0x26ca('0x41')],_0x8239ec[_0x26ca('0x43')]),_0x212ba2);if(_0x6d0eea[_0x26ca('0x41')]['filter']){_0x57423d[_0x26ca('0x4c')]=_[_0x26ca('0x4d')](_0x57423d['where'],{'$or':_[_0x26ca('0x40')](_0x212ba2,function(_0x2e916f){if(_0x2e916f[_0x26ca('0x3f')]!==_0x26ca('0x4e')){var _0x47168f={};_0x47168f[_0x2e916f[_0x26ca('0x39')]]={'$like':'%'+_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x4f')]+'%'};return _0x47168f;}})});}_0x57423d=_[_0x26ca('0x4d')]({},_0x57423d,_0x6d0eea['options']);var _0x3004a0={'where':_0x57423d[_0x26ca('0x4c')]};return db[_0x26ca('0x3c')][_0x26ca('0x34')](_0x3004a0)['then'](function(_0x327d1a){_0x48437f['count']=_0x327d1a;if(_0x6d0eea[_0x26ca('0x41')][_0x26ca('0x50')]){_0x57423d[_0x26ca('0x51')]=[{'all':!![]}];}return db[_0x26ca('0x3c')][_0x26ca('0x52')](_0x57423d);})[_0x26ca('0x21')](function(_0x84524c){_0x48437f[_0x26ca('0x53')]=_0x84524c;return _0x48437f;})['then'](respondWithFilteredResult(_0x53aacc,_0x57423d))['catch'](handleError(_0x53aacc,null));};exports[_0x26ca('0x54')]=function(_0x22ecf1,_0x1243a5){var _0x13abeb={'raw':!![],'where':{'id':_0x22ecf1[_0x26ca('0x55')]['id']}},_0x117db9={};_0x117db9['model']=_[_0x26ca('0x42')](db[_0x26ca('0x3c')]['rawAttributes']);_0x117db9['query']=_['keys'](_0x22ecf1['query']);_0x117db9[_0x26ca('0x43')]=_['intersection'](_0x117db9[_0x26ca('0x45')],_0x117db9[_0x26ca('0x41')]);_0x13abeb[_0x26ca('0x46')]=_['intersection'](_0x117db9['model'],qs['fields'](_0x22ecf1[_0x26ca('0x41')][_0x26ca('0x47')]));_0x13abeb['attributes']=_0x13abeb[_0x26ca('0x46')][_0x26ca('0x56')]?_0x13abeb['attributes']:_0x117db9[_0x26ca('0x45')];if(_0x22ecf1[_0x26ca('0x41')][_0x26ca('0x50')]){_0x13abeb[_0x26ca('0x51')]=[{'all':!![]}];}_0x13abeb=_['merge']({},_0x13abeb,_0x22ecf1['options']);return db[_0x26ca('0x3c')][_0x26ca('0x57')](_0x13abeb)['then'](handleEntityNotFound(_0x1243a5,null))[_0x26ca('0x21')](respondWithResult(_0x1243a5,null))[_0x26ca('0x2c')](handleError(_0x1243a5,null));};exports['create']=function(_0x58b02d,_0x5931e7){return db[_0x26ca('0x3c')][_0x26ca('0x58')](_0x58b02d[_0x26ca('0x59')],{})[_0x26ca('0x21')](respondWithResult(_0x5931e7,0xc9))[_0x26ca('0x2c')](handleError(_0x5931e7,null));};exports[_0x26ca('0x36')]=function(_0x5d4bce,_0x2b820f){if(_0x5d4bce['body']['id']){delete _0x5d4bce[_0x26ca('0x59')]['id'];}return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x5d4bce[_0x26ca('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b820f,null))['then'](saveUpdates(_0x5d4bce[_0x26ca('0x59')],null))[_0x26ca('0x21')](respondWithResult(_0x2b820f,null))[_0x26ca('0x2c')](handleError(_0x2b820f,null));};exports[_0x26ca('0x37')]=function(_0x10057c,_0x4fd6ef){return db[_0x26ca('0x3c')][_0x26ca('0x57')]({'where':{'id':_0x10057c['params']['id']}})[_0x26ca('0x21')](handleEntityNotFound(_0x4fd6ef,null))[_0x26ca('0x21')](removeEntity(_0x4fd6ef,null))[_0x26ca('0x2c')](handleError(_0x4fd6ef,null));};exports[_0x26ca('0x5a')]=function(_0x2fe2af,_0xd93b07){return db[_0x26ca('0x3c')]['describe']()[_0x26ca('0x21')](respondWithResult(_0xd93b07,null))[_0x26ca('0x2c')](handleError(_0xd93b07,null));};var interaction_log=require(_0x26ca('0x18'))(_0x26ca('0x5b'));exports[_0x26ca('0x5c')]=function(_0x220006,_0x329d2b,_0x17e412){var _0x550302={'agent':{},'channel':_0x26ca('0x5d')};if(_0x220006[_0x26ca('0x59')]['id']){delete _0x220006[_0x26ca('0x59')]['id'];}_0x220006['body']['read']=!![];_0x220006[_0x26ca('0x59')][_0x26ca('0x5e')]=moment()[_0x26ca('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x220006[_0x26ca('0x59')]['UserId']=_0x220006[_0x26ca('0x59')][_0x26ca('0x60')]||_0x220006[_0x26ca('0x61')]['id'];_0x550302['agent']['id']=_0x220006[_0x26ca('0x59')][_0x26ca('0x60')];return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x220006[_0x26ca('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x329d2b,null))['then'](saveUpdates(_0x220006[_0x26ca('0x59')],null))[_0x26ca('0x21')](function(_0x3cd7a7){if(_0x3cd7a7){_0x550302[_0x26ca('0x2a')]=_0x3cd7a7[_0x26ca('0x62')]({'plain':!![]});return db[_0x26ca('0x63')][_0x26ca('0x57')]({'where':{'id':_0x3cd7a7[_0x26ca('0x64')]}});}return null;})[_0x26ca('0x21')](handleEntityNotFound(_0x329d2b,null))[_0x26ca('0x21')](function(_0x17600c){if(_0x17600c){return _0x17600c[_0x26ca('0x36')]({'UserId':_0x220006[_0x26ca('0x59')][_0x26ca('0x60')],'read1stAt':_[_0x26ca('0x65')](_0x17600c[_0x26ca('0x66')])?moment()[_0x26ca('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x26ca('0x21')](function(_0x213b10){if(_0x213b10){_0x550302[_0x26ca('0x67')]=_0x213b10['get']({'plain':!![]});interaction_log[_0x26ca('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x220006[_0x26ca('0x61')]['id'],_0x220006['user'][_0x26ca('0x39')],_0x220006[_0x26ca('0x61')][_0x26ca('0x68')],_0x550302[_0x26ca('0x67')]['id'],_0x220006[_0x26ca('0x59')]?JSON[_0x26ca('0x26')](_0x220006[_0x26ca('0x59')]):_0x26ca('0x69'));return respondWithRpcPromise(_0x26ca('0x6a'),'acceptMessage',_0x550302);}return null;})[_0x26ca('0x21')](function(_0xb27c0d){var _0x41de04=_0x26ca('0x6b')+_0xb27c0d[_0x26ca('0x2a')][_0x26ca('0x6c')];return db['sequelize'][_0x26ca('0x41')](_0x41de04,{'type':db[_0x26ca('0x6d')][_0x26ca('0x6e')][_0x26ca('0x6f')],'raw':!![]})[_0x26ca('0x21')](function(_0x42c219){return _0x42c219;});})['then'](function(_0x2bca53){if(_0x2bca53){_0x550302[_0x26ca('0x2a')]['contact']=_0x2bca53[0x0];if(!_0x220006[_0x26ca('0x59')][_0x26ca('0x60')])return;return db[_0x26ca('0x70')][_0x26ca('0x57')]({'where':{'id':_0x220006[_0x26ca('0x59')][_0x26ca('0x60')],'role':_0x26ca('0x71')},'attributes':['id',_0x26ca('0x39'),_0x26ca('0x72'),_0x26ca('0x73'),_0x26ca('0x74')],'raw':!![]});}return null;})['then'](function(_0xa6a1a1){if(!_0xa6a1a1)return null;_0x550302['message'][_0x26ca('0x71')]=_0xa6a1a1;return _0x550302;})[_0x26ca('0x21')](function(_0x191aa5){if(_0x191aa5){if(_0x220006['body']['manual']){_0x550302[_0x26ca('0x2a')][_0x26ca('0x75')]=util[_0x26ca('0x5f')]('SIP/%s',_0x220006[_0x26ca('0x61')][_0x26ca('0x39')]);_0x550302['message'][_0x26ca('0x76')]=_0x550302[_0x26ca('0x76')];_0x550302[_0x26ca('0x2a')]['motionChannel']=_0x550302[_0x26ca('0x76')];_0x550302[_0x26ca('0x2a')]['event']=_0x26ca('0x5c');return respondWithRpcPromise(_0x26ca('0x77'),_0x26ca('0x77'),{'event':'acceptmessage','message':_0x550302[_0x26ca('0x2a')]},client9002)[_0x26ca('0x21')](function(){return _0x550302;});}return _0x550302;}return null;})[_0x26ca('0x21')](respondWithResult(_0x329d2b,null))[_0x26ca('0x2c')](handleError(_0x329d2b,null));};var interaction_log=require('../../config/logger')(_0x26ca('0x5b'));exports[_0x26ca('0x78')]=function(_0x4d66af,_0x423456,_0x196543){var _0x27b230={'agent':{},'channel':_0x26ca('0x5d')};if(_0x4d66af[_0x26ca('0x59')]['id']){delete _0x4d66af[_0x26ca('0x59')]['id'];}_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')]=_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')]||_0x4d66af['user']['id'];_0x27b230[_0x26ca('0x71')]['id']=_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')];return db[_0x26ca('0x3c')]['find']({'where':{'id':_0x4d66af['params']['id'],'UserId':null}})[_0x26ca('0x21')](handleEntityNotFound(_0x423456,null))[_0x26ca('0x21')](function(_0x56bde9){if(_0x56bde9){_0x27b230[_0x26ca('0x2a')]=_0x56bde9[_0x26ca('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x26ca('0x57')]({'where':{'id':_0x56bde9[_0x26ca('0x64')]}});}return null;})[_0x26ca('0x21')](handleEntityNotFound(_0x423456,null))[_0x26ca('0x21')](function(_0x364844){if(_0x364844){_0x27b230['interaction']=_0x364844[_0x26ca('0x62')]({'plain':!![]});interaction_log['info'](_0x26ca('0x79'),_0x4d66af[_0x26ca('0x61')]['id'],_0x4d66af[_0x26ca('0x61')][_0x26ca('0x39')],_0x4d66af[_0x26ca('0x61')][_0x26ca('0x68')],_0x27b230[_0x26ca('0x67')]['id'],_0x4d66af[_0x26ca('0x59')]?JSON[_0x26ca('0x26')](_0x4d66af[_0x26ca('0x59')]):_0x26ca('0x69'));return respondWithRpcPromise(_0x26ca('0x7a'),_0x26ca('0x7b'),_0x27b230);}return null;})[_0x26ca('0x21')](function(_0x3b59f4){var _0x4e5b1f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3b59f4[_0x26ca('0x2a')]['ContactId'];return db[_0x26ca('0x7c')]['query'](_0x4e5b1f,{'type':db[_0x26ca('0x6d')][_0x26ca('0x6e')][_0x26ca('0x6f')],'raw':!![]})[_0x26ca('0x21')](function(_0x285648){return _0x285648;});})[_0x26ca('0x21')](function(_0x12af1a){if(_0x12af1a){_0x27b230[_0x26ca('0x2a')][_0x26ca('0x7d')]=_0x12af1a[0x0];if(!_0x4d66af[_0x26ca('0x59')][_0x26ca('0x60')])return;return db[_0x26ca('0x70')][_0x26ca('0x57')]({'where':{'id':_0x4d66af['body'][_0x26ca('0x60')],'role':'agent'},'attributes':['id',_0x26ca('0x39'),_0x26ca('0x72'),_0x26ca('0x73'),_0x26ca('0x74')],'raw':!![]});}return null;})[_0x26ca('0x21')](function(_0x5ead2f){if(!_0x5ead2f)return null;_0x27b230[_0x26ca('0x2a')][_0x26ca('0x71')]=_0x5ead2f;return _0x27b230;})[_0x26ca('0x21')](function(_0x2d4f0e){if(_0x2d4f0e){_0x2d4f0e[_0x26ca('0x2a')][_0x26ca('0x75')]=util[_0x26ca('0x5f')](_0x26ca('0x7e'),_0x4d66af[_0x26ca('0x61')][_0x26ca('0x39')]);_0x2d4f0e['message'][_0x26ca('0x76')]=_0x27b230[_0x26ca('0x76')];_0x2d4f0e[_0x26ca('0x2a')][_0x26ca('0x7f')]=_0x27b230[_0x26ca('0x76')];_0x2d4f0e[_0x26ca('0x2a')]['event']=_0x26ca('0x78');respondWithRpcPromise(_0x26ca('0x77'),_0x26ca('0x77'),{'event':'rejectmessage','message':_0x2d4f0e['message']},client9002);return _0x27b230;}return null;})[_0x26ca('0x21')](respondWithResult(_0x423456,null))['catch'](handleError(_0x423456,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index eeda206..0bc4812 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 _0x4529=['../../mysqldb','OpenchannelMessage','setMaxListeners','remove','emit','hook','events'];(function(_0xe023d0,_0x302e91){var _0xdfdaf2=function(_0x12cc48){while(--_0x12cc48){_0xe023d0['push'](_0xe023d0['shift']());}};_0xdfdaf2(++_0x302e91);}(_0x4529,0x148));var _0x9452=function(_0x14cd0f,_0x5d2887){_0x14cd0f=_0x14cd0f-0x0;var _0x34ada9=_0x4529[_0x14cd0f];return _0x34ada9;};'use strict';var EventEmitter=require(_0x9452('0x0'));var OpenchannelMessage=require(_0x9452('0x1'))['db'][_0x9452('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9452('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9452('0x4')};function emitEvent(_0x5101b0){return function(_0x861c45,_0x832d36,_0x7ab548){OpenchannelMessageEvents[_0x9452('0x5')](_0x5101b0+':'+_0x861c45['id'],_0x861c45);OpenchannelMessageEvents[_0x9452('0x5')](_0x5101b0,_0x861c45);_0x7ab548(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9452('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xb195=['emit','hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0xd8403a,_0x567163){var _0x3a52ac=function(_0x3dfb0d){while(--_0x3dfb0d){_0xd8403a['push'](_0xd8403a['shift']());}};_0x3a52ac(++_0x567163);}(_0xb195,0x12b));var _0x5b19=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xb195[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0x5b19('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5b19('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5b19('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b19('0x3'),'afterDestroy':_0x5b19('0x4')};function emitEvent(_0xcf0ac2){return function(_0x2fb602,_0x24c018,_0x2e7164){OpenchannelMessageEvents[_0x5b19('0x5')](_0xcf0ac2+':'+_0x2fb602['id'],_0x2fb602);OpenchannelMessageEvents['emit'](_0xcf0ac2,_0x2fb602);_0x2e7164(null);};}for(var e in events){if(events[_0x5b19('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5b19('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c08aa7b..91dcdef 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 _0x9160=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interactions','Interaction','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','info'];(function(_0x241b94,_0x1bc93f){var _0x471a9b=function(_0x138f54){while(--_0x138f54){_0x241b94['push'](_0x241b94['shift']());}};_0x471a9b(++_0x1bc93f);}(_0x9160,0x1d7));var _0x0916=function(_0x51f1cd,_0x2c53f1){_0x51f1cd=_0x51f1cd-0x0;var _0x197ad2=_0x9160[_0x51f1cd];return _0x197ad2;};'use strict';var _=require(_0x0916('0x0'));var util=require(_0x0916('0x1'));var logger=require(_0x0916('0x2'))(_0x0916('0x3'));var moment=require(_0x0916('0x4'));var BPromise=require(_0x0916('0x5'));var rp=require(_0x0916('0x6'));var fs=require('fs');var path=require(_0x0916('0x7'));var rimraf=require(_0x0916('0x8'));var config=require('../../config/environment');var attributes=require(_0x0916('0x9'));module[_0x0916('0xa')]=function(_0x20586c,_0x5dd18c){return _0x20586c[_0x0916('0xb')](_0x0916('0xc'),attributes,{'tableName':_0x0916('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x0916('0xe')],'type':_0x0916('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x330fc5,_0x279f44,_0x3b061c){var _0x585324=_0x20586c['models'];var _0x5c542e=_0x330fc5[_0x0916('0x10')]({'plain':!![]});if(_0x5c542e[_0x0916('0x11')][_0x0916('0x12')]()==='in'||_0x5c542e['direction'][_0x0916('0x12')]()===_0x0916('0x13')&&!_0x5c542e['secret']&&!_['isNil'](_0x5c542e[_0x0916('0x14')])){_0x585324[_0x0916('0x15')][_0x0916('0x16')]({'where':{'id':_0x5c542e[_0x0916('0x17')]}})[_0x0916('0x18')](function(_0x24bc6e){if(_0x24bc6e){_0x24bc6e[_0x0916('0x19')]({'lastMsgAt':_0x5c542e[_0x0916('0x1a')],'lastMsgDirection':_0x5c542e[_0x0916('0x11')][_0x0916('0x12')]()});}})[_0x0916('0x1b')](function(_0xf49308){console[_0x0916('0x1c')](_0xf49308);});}if(_0x5c542e[_0x0916('0x11')]===_0x0916('0x13')&&!_0x5c542e[_0x0916('0x1d')]){var _0x18a87c;_0x585324[_0x0916('0x1e')][_0x0916('0x1f')]()['then'](function(_0x3e068f){return _0x585324[_0x0916('0x20')][_0x0916('0x21')]({'where':{'id':_0x5c542e[_0x0916('0x22')]},'include':[{'model':_0x585324['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x5c542e[_0x0916('0x17')]},'limit':0x1,'include':[{'model':_0x585324['CmContact'],'as':_0x0916('0x23'),'attributes':_[_0x0916('0x24')](_0x3e068f)}]}]});})[_0x0916('0x18')](function(_0x5e43ad){_0x18a87c=_0x5e43ad[_0x0916('0x10')]({'plain':!![]});if(_0x18a87c&&_0x18a87c[_0x0916('0x25')]){logger[_0x0916('0x26')](_0x0916('0x27'),_0x0916('0x28'),util[_0x0916('0x29')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5c542e['id'],_0x18a87c[_0x0916('0x25')]));if(_0x18a87c[_0x0916('0x2a')]&&_0x18a87c[_0x0916('0x2a')]['length']){_0x5c542e[_0x0916('0x2b')]=_[_0x0916('0x2c')](_0x18a87c[_0x0916('0x2a')][0x0],_0x0916('0x23'));_0x5c542e[_0x0916('0x23')]=_0x18a87c['Interactions'][0x0][_0x0916('0x23')];}var _0x279f44={'method':_0x0916('0x2d'),'uri':encodeURI(_0x18a87c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x279f44[_0x0916('0x2e')]){case'GET':_0x279f44['qs']=_0x5c542e;break;case _0x0916('0x2d'):_0x279f44['body']=_0x5c542e;break;}return rp(_0x279f44)['then'](function(_0x201185){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x0916('0x28'),util['format'](_0x0916('0x2f'),_0x5c542e['id'],_0x18a87c['replyUri']));if(_0x201185['body'][_0x0916('0x30')]&&_0x201185[_0x0916('0xe')][_0x0916('0x30')]!=_0x5c542e[_0x0916('0x2b')][_0x0916('0x30')]){return _0x585324[_0x0916('0x15')][_0x0916('0x19')]({'threadId':_0x201185[_0x0916('0xe')][_0x0916('0x30')]},{'where':{'id':_0x5c542e[_0x0916('0x2b')]['id']}});}else{return;}})[_0x0916('0x18')](function(){return _0x330fc5[_0x0916('0x19')]({'read':!![]});})[_0x0916('0x1b')](function(_0x4d3acb){logger[_0x0916('0x1c')](_0x0916('0x27'),_0x0916('0x28'),util['inspect'](_0x4d3acb,{'showHidden':![],'depth':null}));_0x3b061c();});}else{_0x3b061c();}})['finally'](function(){_0x3b061c();});}else{_0x3b061c();}}},'charset':_0x0916('0x31'),'collate':_0x0916('0x32')});}; \ No newline at end of file +var _0x690c=['define','OpenchannelMessage','models','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','error','describe','then','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','body','threadId','update','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x47aaff,_0x98b0c6){var _0x4673f6=function(_0xaa984f){while(--_0xaa984f){_0x47aaff['push'](_0x47aaff['shift']());}};_0x4673f6(++_0x98b0c6);}(_0x690c,0x167));var _0xc690=function(_0xa2743e,_0x18fddc){_0xa2743e=_0xa2743e-0x0;var _0x1b8ba6=_0x690c[_0xa2743e];return _0x1b8ba6;};'use strict';var _=require(_0xc690('0x0'));var util=require(_0xc690('0x1'));var logger=require(_0xc690('0x2'))(_0xc690('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc690('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc690('0x5'));var config=require(_0xc690('0x6'));var attributes=require(_0xc690('0x7'));module[_0xc690('0x8')]=function(_0x183409,_0x49e73f){return _0x183409[_0xc690('0x9')](_0xc690('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16da22,_0x39a0a3,_0x28afb4){var _0x461eb1=_0x183409[_0xc690('0xb')];var _0x3b2c2b=_0x16da22[_0xc690('0xc')]({'plain':!![]});if(_0x3b2c2b[_0xc690('0xd')][_0xc690('0xe')]()==='in'||_0x3b2c2b[_0xc690('0xd')]['toLowerCase']()===_0xc690('0xf')&&!_0x3b2c2b[_0xc690('0x10')]&&!_['isNil'](_0x3b2c2b['UserId'])){_0x461eb1[_0xc690('0x11')][_0xc690('0x12')]({'where':{'id':_0x3b2c2b[_0xc690('0x13')]}})['then'](function(_0x73986f){if(_0x73986f){_0x73986f['update']({'lastMsgAt':_0x3b2c2b[_0xc690('0x14')],'lastMsgDirection':_0x3b2c2b['direction'][_0xc690('0xe')]()});}})['catch'](function(_0x23af9f){console[_0xc690('0x15')](_0x23af9f);});}if(_0x3b2c2b[_0xc690('0xd')]==='out'&&!_0x3b2c2b[_0xc690('0x10')]){var _0x1ed083;_0x461eb1['CmContact'][_0xc690('0x16')]()[_0xc690('0x17')](function(_0x554ce5){return _0x461eb1['OpenchannelAccount'][_0xc690('0x18')]({'where':{'id':_0x3b2c2b[_0xc690('0x19')]},'include':[{'model':_0x461eb1[_0xc690('0x11')],'as':_0xc690('0x1a'),'where':{'id':_0x3b2c2b[_0xc690('0x13')]},'limit':0x1,'include':[{'model':_0x461eb1[_0xc690('0x1b')],'as':_0xc690('0x1c'),'attributes':_[_0xc690('0x1d')](_0x554ce5)}]}]});})[_0xc690('0x17')](function(_0x40e216){_0x1ed083=_0x40e216['get']({'plain':!![]});if(_0x1ed083&&_0x1ed083[_0xc690('0x1e')]){logger[_0xc690('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util[_0xc690('0x21')](_0xc690('0x22'),_0x3b2c2b['id'],_0x1ed083[_0xc690('0x1e')]));if(_0x1ed083[_0xc690('0x1a')]&&_0x1ed083['Interactions'][_0xc690('0x23')]){_0x3b2c2b['Interaction']=_['omit'](_0x1ed083['Interactions'][0x0],_0xc690('0x1c'));_0x3b2c2b[_0xc690('0x1c')]=_0x1ed083[_0xc690('0x1a')][0x0][_0xc690('0x1c')];}var _0x39a0a3={'method':_0xc690('0x24'),'uri':encodeURI(_0x1ed083[_0xc690('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39a0a3[_0xc690('0x25')]){case _0xc690('0x26'):_0x39a0a3['qs']=_0x3b2c2b;break;case _0xc690('0x24'):_0x39a0a3[_0xc690('0x27')]=_0x3b2c2b;break;}return rp(_0x39a0a3)[_0xc690('0x17')](function(_0xe9637b){logger[_0xc690('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b2c2b['id'],_0x1ed083[_0xc690('0x1e')]));if(_0xe9637b['body'][_0xc690('0x28')]&&_0xe9637b[_0xc690('0x27')][_0xc690('0x28')]!=_0x3b2c2b['Interaction'][_0xc690('0x28')]){return _0x461eb1[_0xc690('0x11')][_0xc690('0x29')]({'threadId':_0xe9637b['body'][_0xc690('0x28')]},{'where':{'id':_0x3b2c2b[_0xc690('0x2a')]['id']}});}else{return;}})[_0xc690('0x17')](function(){return _0x16da22[_0xc690('0x29')]({'read':!![]});})['catch'](function(_0x387b82){logger[_0xc690('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0xc690('0x20'),util[_0xc690('0x2b')](_0x387b82,{'showHidden':![],'depth':null}));_0x28afb4();});}else{_0x28afb4();}})['finally'](function(){_0x28afb4();});}else{_0x28afb4();}}},'charset':_0xc690('0x2c'),'collate':_0xc690('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e244069..ee92064 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x17690a,_0x5bf399){var _0x3dd00e=function(_0x1906cc){while(--_0x1906cc){_0x17690a['push'](_0x17690a['shift']());}};_0x3dd00e(++_0x5bf399);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x0b0e[_0x55af86];return _0x58df3b;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x184176,_0x55afa9){var _0x3d257e=function(_0x574f77){while(--_0x574f77){_0x184176['push'](_0x184176['shift']());}};_0x3d257e(++_0x55afa9);}(_0x7a54,0x106));var _0x47a5=function(_0x2276d9,_0x56cd0f){_0x2276d9=_0x2276d9-0x0;var _0x5cc6bc=_0x7a54[_0x2276d9];return _0x5cc6bc;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1004903..5f1e279 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 _0xcafb=['save','remove','update','emit','removeListener','register','openchannelMessage:'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xcafb,0x188));var _0xbcaf=function(_0x1c8784,_0x154b97){_0x1c8784=_0x1c8784-0x0;var _0x566830=_0xcafb[_0x1c8784];return _0x566830;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xbcaf('0x0'),_0xbcaf('0x1'),_0xbcaf('0x2')];function createListener(_0x107afb,_0x1c0854){return function(_0x75c9e3){_0x1c0854[_0xbcaf('0x3')](_0x107afb,_0x75c9e3);};}function removeListener(_0x4ec065,_0x36c3ac){return function(){OpenchannelMessageEvents[_0xbcaf('0x4')](_0x4ec065,_0x36c3ac);};}exports[_0xbcaf('0x5')]=function(_0x28eb65){for(var _0x179879=0x0,_0x521eed=events['length'];_0x179879<_0x521eed;_0x179879++){var _0x170de8=events[_0x179879];var _0x52ed89=createListener(_0xbcaf('0x6')+_0x170de8,_0x28eb65);OpenchannelMessageEvents['on'](_0x170de8,_0x52ed89);}}; \ No newline at end of file +var _0x50d8=['update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x149d7f,_0x543c48){var _0x49920a=function(_0x33360e){while(--_0x33360e){_0x149d7f['push'](_0x149d7f['shift']());}};_0x49920a(++_0x543c48);}(_0x50d8,0x12b));var _0x850d=function(_0x777e9b,_0x5c9657){_0x777e9b=_0x777e9b-0x0;var _0x557da7=_0x50d8[_0x777e9b];return _0x557da7;};'use strict';var OpenchannelMessageEvents=require(_0x850d('0x0'));var events=['save',_0x850d('0x1'),_0x850d('0x2')];function createListener(_0x4b90e2,_0x1bc032){return function(_0x53ea5e){_0x1bc032['emit'](_0x4b90e2,_0x53ea5e);};}function removeListener(_0x3c91c1,_0x10858c){return function(){OpenchannelMessageEvents[_0x850d('0x3')](_0x3c91c1,_0x10858c);};}exports[_0x850d('0x4')]=function(_0x54470c){for(var _0x5e7c62=0x0,_0x9dd636=events[_0x850d('0x5')];_0x5e7c62<_0x9dd636;_0x5e7c62++){var _0x1cce5c=events[_0x5e7c62];var _0x1f443a=createListener(_0x850d('0x6')+_0x1cce5c,_0x54470c);OpenchannelMessageEvents['on'](_0x1cce5c,_0x1f443a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 58f657b..8d308c6 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 _0xed0b=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x4f8972,_0x4fd9a6){var _0x568e87=function(_0x2148e2){while(--_0x2148e2){_0x4f8972['push'](_0x4f8972['shift']());}};_0x568e87(++_0x4fd9a6);}(_0xed0b,0xed));var _0xbed0=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xed0b[_0x38b14f];return _0x22a324;};'use strict';var multer=require(_0xbed0('0x0'));var util=require(_0xbed0('0x1'));var path=require(_0xbed0('0x2'));var timeout=require(_0xbed0('0x3'));var express=require(_0xbed0('0x4'));var router=express[_0xbed0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbed0('0x6'));var interaction=require(_0xbed0('0x7'));var config=require(_0xbed0('0x8'));var controller=require(_0xbed0('0x9'));router[_0xbed0('0xa')]('/',auth[_0xbed0('0xb')](),controller[_0xbed0('0xc')]);router[_0xbed0('0xa')](_0xbed0('0xd'),auth[_0xbed0('0xb')](),controller[_0xbed0('0xe')]);router[_0xbed0('0xa')](_0xbed0('0xf'),auth['isAuthenticated'](),controller[_0xbed0('0x10')]);router[_0xbed0('0xa')](_0xbed0('0x11'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xbed0('0x12'),auth[_0xbed0('0xb')](),controller[_0xbed0('0x13')]);router[_0xbed0('0xa')]('/:id/users',auth[_0xbed0('0xb')](),controller[_0xbed0('0x14')]);router[_0xbed0('0x15')]('/',auth[_0xbed0('0xb')](),controller[_0xbed0('0x16')]);router[_0xbed0('0x15')](_0xbed0('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0xbed0('0x15')](_0xbed0('0x17'),auth[_0xbed0('0xb')](),controller['addAgents']);router[_0xbed0('0x18')](_0xbed0('0xf'),auth[_0xbed0('0xb')](),controller[_0xbed0('0x19')]);router[_0xbed0('0x1a')](_0xbed0('0xf'),auth[_0xbed0('0xb')](),controller[_0xbed0('0x1b')]);router[_0xbed0('0x1a')]('/:id/teams',auth[_0xbed0('0xb')](),controller[_0xbed0('0x1c')]);router['delete'](_0xbed0('0x17'),auth[_0xbed0('0xb')](),controller[_0xbed0('0x1d')]);module[_0xbed0('0x1e')]=router; \ No newline at end of file +var _0xc12d=['../../config/environment','get','isAuthenticated','index','/describe','describe','getMembers','getTeams','getAgents','post','/:id/teams','addAgents','/:id','delete','destroy','removeTeams','/:id/users','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc12d,0xc1));var _0xdc12=function(_0x283ed6,_0xbb5d01){_0x283ed6=_0x283ed6-0x0;var _0x227db6=_0xc12d[_0x283ed6];return _0x227db6;};'use strict';var multer=require(_0xdc12('0x0'));var util=require(_0xdc12('0x1'));var path=require(_0xdc12('0x2'));var timeout=require(_0xdc12('0x3'));var express=require('express');var router=express[_0xdc12('0x4')]();var fs_extra=require(_0xdc12('0x5'));var auth=require(_0xdc12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc12('0x7'));var controller=require('./openchannelQueue.controller');router[_0xdc12('0x8')]('/',auth[_0xdc12('0x9')](),controller[_0xdc12('0xa')]);router[_0xdc12('0x8')](_0xdc12('0xb'),auth['isAuthenticated'](),controller[_0xdc12('0xc')]);router['get']('/:id',auth[_0xdc12('0x9')](),controller['show']);router[_0xdc12('0x8')]('/:id/members',auth[_0xdc12('0x9')](),controller[_0xdc12('0xd')]);router['get']('/:id/teams',auth[_0xdc12('0x9')](),controller[_0xdc12('0xe')]);router['get']('/:id/users',auth[_0xdc12('0x9')](),controller[_0xdc12('0xf')]);router['post']('/',auth[_0xdc12('0x9')](),controller['create']);router[_0xdc12('0x10')](_0xdc12('0x11'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0xdc12('0x9')](),controller[_0xdc12('0x12')]);router['put'](_0xdc12('0x13'),auth[_0xdc12('0x9')](),controller['update']);router[_0xdc12('0x14')](_0xdc12('0x13'),auth[_0xdc12('0x9')](),controller[_0xdc12('0x15')]);router[_0xdc12('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdc12('0x16')]);router[_0xdc12('0x14')](_0xdc12('0x17'),auth['isAuthenticated'](),controller[_0xdc12('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 565c76e..6a5758d 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 _0x9a07=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x481b25,_0x194f61){var _0x14e334=function(_0x28e528){while(--_0x28e528){_0x481b25['push'](_0x481b25['shift']());}};_0x14e334(++_0x194f61);}(_0x9a07,0xf7));var _0x79a0=function(_0x5dd50f,_0x4f68ca){_0x5dd50f=_0x5dd50f-0x0;var _0x312a34=_0x9a07[_0x5dd50f];return _0x312a34;};'use strict';var Sequelize=require(_0x79a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x79a0('0x1')],'unique':_0x79a0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79a0('0x1')]},'timeout':{'type':Sequelize[_0x79a0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79a0('0x4')](_0x79a0('0x5'),_0x79a0('0x6'),_0x79a0('0x7'))}}; \ No newline at end of file +var _0xf045=['INTEGER','ENUM','beepall','roundrobin','sequelize','STRING','name'];(function(_0x292fc8,_0x432137){var _0x478e76=function(_0x4c7a0a){while(--_0x4c7a0a){_0x292fc8['push'](_0x292fc8['shift']());}};_0x478e76(++_0x432137);}(_0xf045,0x13f));var _0x5f04=function(_0x474f3c,_0x366ca7){_0x474f3c=_0x474f3c-0x0;var _0x24c780=_0xf045[_0x474f3c];return _0x24c780;};'use strict';var Sequelize=require(_0x5f04('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f04('0x1')],'unique':_0x5f04('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f04('0x1')]},'timeout':{'type':Sequelize[_0x5f04('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f04('0x4')]('rrmemory',_0x5f04('0x5'),_0x5f04('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4d5185d..8ac5f50 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 _0x23bf=['count','include','query','findAll','rows','catch','show','model','keys','rawAttributes','filters','attributes','fields','length','includeAll','merge','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserOpenchannelQueue','intersection','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','map','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','findOne','Team','getTeams','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','set','Content-Range','destroy','then','get','UserProfileResource','error','name','send','index','OpenchannelQueue','fieldName','type','getOptions','where'];(function(_0x5ca070,_0x262392){var _0x51aa78=function(_0x171338){while(--_0x171338){_0x5ca070['push'](_0x5ca070['shift']());}};_0x51aa78(++_0x262392);}(_0x23bf,0x1ae));var _0xf23b=function(_0x181b89,_0x454682){_0x181b89=_0x181b89-0x0;var _0x13198d=_0x23bf[_0x181b89];return _0x13198d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xf23b('0x0'));var squel=require(_0xf23b('0x1'));var Redis=require(_0xf23b('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xf23b('0x3'));var db=require(_0xf23b('0x4'))['db'];config[_0xf23b('0x5')]=_[_0xf23b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf23b('0x7'))(new Redis(config[_0xf23b('0x5')]));require(_0xf23b('0x8'))[_0xf23b('0x9')](socket);function respondWithStatusCode(_0x5624fc,_0x425af9){_0x425af9=_0x425af9||0xcc;return function(_0x546845){if(_0x546845){return _0x5624fc['sendStatus'](_0x425af9);}return _0x5624fc[_0xf23b('0xa')](_0x425af9)[_0xf23b('0xb')]();};}function respondWithResult(_0x1e2817,_0xb9922d){_0xb9922d=_0xb9922d||0xc8;return function(_0x879e25){if(_0x879e25){return _0x1e2817['status'](_0xb9922d)[_0xf23b('0xc')](_0x879e25);}};}function respondWithFilteredResult(_0x906950,_0x738a9a){return function(_0x2aec89){if(_0x2aec89){var _0x972e43=typeof _0x738a9a[_0xf23b('0xd')]==='undefined'&&typeof _0x738a9a[_0xf23b('0xe')]==='undefined';var _0x5492a7=_0x2aec89['count'];var _0x1b9a83=_0x972e43?0x0:_0x738a9a[_0xf23b('0xd')];var _0x58acf8=_0x972e43?_0x2aec89['count']:_0x738a9a[_0xf23b('0xd')]+_0x738a9a[_0xf23b('0xe')];var _0x43e2e3;if(_0x58acf8>=_0x5492a7){_0x58acf8=_0x5492a7;_0x43e2e3=0xc8;}else{_0x43e2e3=0xce;}_0x906950[_0xf23b('0xa')](_0x43e2e3);return _0x906950[_0xf23b('0xf')](_0xf23b('0x10'),_0x1b9a83+'-'+_0x58acf8+'/'+_0x5492a7)['json'](_0x2aec89);}return null;};}function saveUpdates(_0x165410){return function(_0x3b64fd){if(_0x3b64fd){return _0x3b64fd['update'](_0x165410)['then'](function(_0x2c60e4){return _0x2c60e4;});}return null;};}function removeEntity(_0x30d369){return function(_0x989883){if(_0x989883){return _0x989883[_0xf23b('0x11')]()[_0xf23b('0x12')](function(){var _0x8cfd7f=_0x989883[_0xf23b('0x13')]({'plain':!![]});var _0x4beb19='OpenchannelQueues';return db[_0xf23b('0x14')]['destroy']({'where':{'type':_0x4beb19,'resourceId':_0x8cfd7f['id']}})[_0xf23b('0x12')](function(){return _0x989883;});})[_0xf23b('0x12')](function(){_0x30d369[_0xf23b('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a933a){return function(_0x1c93de){if(!_0x1c93de){_0x4a933a['sendStatus'](0x194);}return _0x1c93de;};}function handleError(_0x32a6db,_0xa49d9c){_0xa49d9c=_0xa49d9c||0x1f4;return function(_0x138597){logger[_0xf23b('0x15')](_0x138597['stack']);if(_0x138597[_0xf23b('0x16')]){delete _0x138597[_0xf23b('0x16')];}_0x32a6db[_0xf23b('0xa')](_0xa49d9c)[_0xf23b('0x17')](_0x138597);};}exports[_0xf23b('0x18')]=function(_0x34855f,_0x2febda){var _0x184fa4={};var _0x8a04a3={'count':0x0,'rows':[]};var _0x5209fa=_['map'](db[_0xf23b('0x19')]['rawAttributes'],function(_0x31154d){return{'name':_0x31154d[_0xf23b('0x1a')],'type':_0x31154d[_0xf23b('0x1b')]['key']};});_0x184fa4=qs[_0xf23b('0x1c')](_0x5209fa,_0x34855f);var _0xf34970={'where':_0x184fa4[_0xf23b('0x1d')]};return db[_0xf23b('0x19')][_0xf23b('0x1e')](_0xf34970)['then'](function(_0x562dbb){_0x8a04a3[_0xf23b('0x1e')]=_0x562dbb;_0x184fa4[_0xf23b('0x1f')]=qs[_0xf23b('0x1f')](_0x34855f[_0xf23b('0x20')]);return db[_0xf23b('0x19')][_0xf23b('0x21')](_0x184fa4);})['then'](function(_0x4cfd22){_0x8a04a3[_0xf23b('0x22')]=_0x4cfd22;return _0x8a04a3;})[_0xf23b('0x12')](respondWithFilteredResult(_0x2febda,_0x184fa4))[_0xf23b('0x23')](handleError(_0x2febda,null));};exports[_0xf23b('0x24')]=function(_0x9fca66,_0x4e0ec3){var _0xe6bb67={'raw':!![],'where':{'id':_0x9fca66['params']['id']}},_0x1099c3={};_0x1099c3[_0xf23b('0x25')]=_[_0xf23b('0x26')](db['OpenchannelQueue'][_0xf23b('0x27')]);_0x1099c3[_0xf23b('0x20')]=_['keys'](_0x9fca66[_0xf23b('0x20')]);_0x1099c3[_0xf23b('0x28')]=_['intersection'](_0x1099c3['model'],_0x1099c3['query']);_0xe6bb67[_0xf23b('0x29')]=_['intersection'](_0x1099c3[_0xf23b('0x25')],qs['fields'](_0x9fca66[_0xf23b('0x20')][_0xf23b('0x2a')]));_0xe6bb67['attributes']=_0xe6bb67['attributes'][_0xf23b('0x2b')]?_0xe6bb67[_0xf23b('0x29')]:_0x1099c3[_0xf23b('0x25')];if(_0x9fca66[_0xf23b('0x20')][_0xf23b('0x2c')]){_0xe6bb67[_0xf23b('0x1f')]=[{'all':!![]}];}_0xe6bb67=_[_0xf23b('0x2d')]({},_0xe6bb67,_0x9fca66[_0xf23b('0x2e')]);return db['OpenchannelQueue']['find'](_0xe6bb67)['then'](handleEntityNotFound(_0x4e0ec3,null))[_0xf23b('0x12')](respondWithResult(_0x4e0ec3,null))['catch'](handleError(_0x4e0ec3,null));};exports[_0xf23b('0x2f')]=function(_0x5ea156,_0x4cd0e1){return db['OpenchannelQueue'][_0xf23b('0x2f')](_0x5ea156['body'],{})[_0xf23b('0x12')](function(_0x165a7b){var _0x652654=_0x5ea156[_0xf23b('0x30')][_0xf23b('0x13')]({'plain':!![]});if(!_0x652654)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x652654[_0xf23b('0x31')]===_0xf23b('0x30')){var _0x55c2cb=_0x165a7b[_0xf23b('0x13')]({'plain':!![]});var _0x19c6cf='OpenchannelQueues';return db[_0xf23b('0x32')][_0xf23b('0x33')]({'where':{'name':_0x19c6cf,'userProfileId':_0x652654[_0xf23b('0x34')]},'raw':!![]})[_0xf23b('0x12')](function(_0x162d17){if(_0x162d17&&_0x162d17[_0xf23b('0x35')]===0x0){return db['UserProfileResource'][_0xf23b('0x2f')]({'name':_0x55c2cb[_0xf23b('0x16')],'resourceId':_0x55c2cb['id'],'type':_0x162d17['name'],'sectionId':_0x162d17['id']},{})[_0xf23b('0x12')](function(){return _0x165a7b;});}else{return _0x165a7b;}})[_0xf23b('0x23')](function(_0x5b07c8){logger[_0xf23b('0x15')](_0xf23b('0x36'),_0x5b07c8);throw _0x5b07c8;});}return _0x165a7b;})[_0xf23b('0x12')](respondWithResult(_0x4cd0e1,0xc9))[_0xf23b('0x23')](handleError(_0x4cd0e1,null));};exports['update']=function(_0x8f1cab,_0x397089){if(_0x8f1cab[_0xf23b('0x37')]['id']){delete _0x8f1cab[_0xf23b('0x37')]['id'];}return db[_0xf23b('0x19')]['find']({'where':{'id':_0x8f1cab[_0xf23b('0x38')]['id']}})[_0xf23b('0x12')](handleEntityNotFound(_0x397089,null))[_0xf23b('0x12')](saveUpdates(_0x8f1cab[_0xf23b('0x37')],null))[_0xf23b('0x12')](respondWithResult(_0x397089,null))[_0xf23b('0x23')](handleError(_0x397089,null));};exports['destroy']=function(_0x3fcca5,_0x1d5d77){return db[_0xf23b('0x19')]['find']({'where':{'id':_0x3fcca5[_0xf23b('0x38')]['id']}})['then'](handleEntityNotFound(_0x1d5d77,null))[_0xf23b('0x12')](removeEntity(_0x1d5d77,null))['catch'](handleError(_0x1d5d77,null));};exports[_0xf23b('0x39')]=function(_0x1e4f21,_0x576aa1){return db[_0xf23b('0x19')]['describe']()['then'](respondWithResult(_0x576aa1,null))[_0xf23b('0x23')](handleError(_0x576aa1,null));};exports[_0xf23b('0x3a')]=function(_0x86742f,_0x33bec9){var _0x28534e={'raw':!![],'where':{}},_0x249ac7={},_0x32b97b;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x86742f[_0xf23b('0x38')]['id']}})[_0xf23b('0x12')](handleEntityNotFound(_0x33bec9,null))[_0xf23b('0x12')](function(_0x2d4def){if(_0x2d4def){_0x32b97b=_0x2d4def[_0xf23b('0x13')]({'plain':!![]});_0x249ac7['model']=_[_0xf23b('0x26')](db[_0xf23b('0x3b')][_0xf23b('0x27')]);_0x249ac7['query']=_[_0xf23b('0x26')](_0x86742f[_0xf23b('0x20')]);_0x249ac7[_0xf23b('0x28')]=_['intersection'](_0x249ac7[_0xf23b('0x25')],_0x249ac7['query']);_0x28534e[_0xf23b('0x29')]=_[_0xf23b('0x3c')](_0x249ac7[_0xf23b('0x25')],qs['fields'](_0x86742f[_0xf23b('0x20')][_0xf23b('0x2a')]));_0x28534e[_0xf23b('0x29')]=_0x28534e[_0xf23b('0x29')]['length']?_0x28534e[_0xf23b('0x29')]:_0x249ac7[_0xf23b('0x25')];if(!_0x86742f[_0xf23b('0x20')]['hasOwnProperty'](_0xf23b('0x3d'))){_0x28534e[_0xf23b('0xe')]=qs[_0xf23b('0xe')](_0x86742f[_0xf23b('0x20')]['limit']);_0x28534e[_0xf23b('0xd')]=qs[_0xf23b('0xd')](_0x86742f[_0xf23b('0x20')]['offset']);}_0x28534e[_0xf23b('0x3e')]=qs[_0xf23b('0x3f')](_0x86742f[_0xf23b('0x20')][_0xf23b('0x3f')]);_0x28534e[_0xf23b('0x1d')]=qs[_0xf23b('0x28')](_[_0xf23b('0x40')](_0x86742f[_0xf23b('0x20')],_0x249ac7[_0xf23b('0x28')]));_0x28534e[_0xf23b('0x1d')][_0xf23b('0x41')]=_0x2d4def['id'];if(_0x86742f[_0xf23b('0x20')][_0xf23b('0x42')]){_0x28534e[_0xf23b('0x1d')]=_[_0xf23b('0x2d')](_0x28534e[_0xf23b('0x1d')],{'$or':_['map'](_0x28534e[_0xf23b('0x29')],function(_0x3b0c8e){var _0x30bfcc={};_0x30bfcc[_0x3b0c8e]={'$like':'%'+_0x86742f[_0xf23b('0x20')]['filter']+'%'};return _0x30bfcc;})});}_0x28534e=_['merge']({},_0x28534e,_0x86742f[_0xf23b('0x2e')]);return db[_0xf23b('0x3b')][_0xf23b('0x21')](_0x28534e);}})[_0xf23b('0x12')](function(_0x15d96f){if(_0x15d96f){return db[_0xf23b('0x43')][_0xf23b('0x44')]({'where':{'id':_[_0xf23b('0x45')](_0x15d96f,'UserId'),'role':_0xf23b('0x46')},'attributes':['id',_0xf23b('0x16'),'openchannelPause',_0xf23b('0x47'),_0xf23b('0x48')]});}})[_0xf23b('0x12')](function(_0x395319){if(_0x395319){return{'count':_0x395319['count'],'rows':_[_0xf23b('0x45')](_0x395319['rows'],function(_0x34a8d4){return{'membername':_0x34a8d4[_0xf23b('0x16')],'UserId':_0x34a8d4['id'],'queue_name':_0x32b97b[_0xf23b('0x16')],'OpenchannelQueueId':_0x32b97b['id'],'interface':util[_0xf23b('0x49')](_0xf23b('0x4a'),_0xf23b('0x4b'),_0x34a8d4[_0xf23b('0x16')]),'penalty':0x0,'paused':_0x34a8d4[_0xf23b('0x4c')],'createdAt':_0x34a8d4[_0xf23b('0x48')],'updatedAt':_0x34a8d4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf23b('0x12')](respondWithFilteredResult(_0x33bec9,_0x28534e))[_0xf23b('0x23')](handleError(_0x33bec9,null));};exports['getTeams']=function(_0x22a318,_0x27edd7){var _0x4cae10={};var _0x46dcde={};var _0x38760;var _0x115d62;return db[_0xf23b('0x19')][_0xf23b('0x4d')]({'where':{'id':_0x22a318['params']['id']}})[_0xf23b('0x12')](handleEntityNotFound(_0x27edd7,null))[_0xf23b('0x12')](function(_0x18eac9){if(_0x18eac9){_0x38760=_0x18eac9;_0x46dcde[_0xf23b('0x25')]=_[_0xf23b('0x26')](db[_0xf23b('0x4e')][_0xf23b('0x27')]);_0x46dcde[_0xf23b('0x20')]=_[_0xf23b('0x26')](_0x22a318[_0xf23b('0x20')]);_0x46dcde[_0xf23b('0x28')]=_[_0xf23b('0x3c')](_0x46dcde[_0xf23b('0x25')],_0x46dcde[_0xf23b('0x20')]);_0x4cae10[_0xf23b('0x29')]=_[_0xf23b('0x3c')](_0x46dcde[_0xf23b('0x25')],qs[_0xf23b('0x2a')](_0x22a318[_0xf23b('0x20')][_0xf23b('0x2a')]));_0x4cae10[_0xf23b('0x29')]=_0x4cae10['attributes'][_0xf23b('0x2b')]?_0x4cae10[_0xf23b('0x29')]:_0x46dcde[_0xf23b('0x25')];_0x4cae10['order']=qs[_0xf23b('0x3f')](_0x22a318['query'][_0xf23b('0x3f')]);_0x4cae10[_0xf23b('0x1d')]=qs[_0xf23b('0x28')](_['pick'](_0x22a318[_0xf23b('0x20')],_0x46dcde['filters']));if(_0x22a318[_0xf23b('0x20')][_0xf23b('0x42')]){_0x4cae10[_0xf23b('0x1d')]=_[_0xf23b('0x2d')](_0x4cae10['where'],{'$or':_[_0xf23b('0x45')](_0x4cae10[_0xf23b('0x29')],function(_0xb2a23f){var _0x3c6323={};_0x3c6323[_0xb2a23f]={'$like':'%'+_0x22a318[_0xf23b('0x20')]['filter']+'%'};return _0x3c6323;})});}_0x4cae10=_[_0xf23b('0x2d')]({},_0x4cae10,_0x22a318[_0xf23b('0x2e')]);return _0x38760[_0xf23b('0x4f')](_0x4cae10);}})[_0xf23b('0x12')](function(_0x4ea42d){if(_0x4ea42d){_0x115d62=_0x4ea42d[_0xf23b('0x2b')];if(!_0x22a318[_0xf23b('0x20')][_0xf23b('0x50')](_0xf23b('0x3d'))){_0x4cae10['limit']=qs[_0xf23b('0xe')](_0x22a318[_0xf23b('0x20')][_0xf23b('0xe')]);_0x4cae10[_0xf23b('0xd')]=qs[_0xf23b('0xd')](_0x22a318[_0xf23b('0x20')]['offset']);}return _0x38760[_0xf23b('0x4f')](_0x4cae10);}})[_0xf23b('0x12')](function(_0xfc3e64){if(_0xfc3e64){return _0xfc3e64?{'count':_0x115d62,'rows':_0xfc3e64}:null;}})['then'](respondWithResult(_0x27edd7,null))[_0xf23b('0x23')](handleError(_0x27edd7,null));};exports[_0xf23b('0x51')]=function(_0x34a4bc,_0x634920){var _0xbf8d2c=_0x34a4bc[_0xf23b('0x37')][_0xf23b('0x52')];return db[_0xf23b('0x4e')]['findAll']({'where':{'id':_0xbf8d2c},'attributes':['id'],'include':[{'model':db[_0xf23b('0x43')],'as':_0xf23b('0x53'),'attributes':['id','name',_0xf23b('0x54'),_0xf23b('0x55'),'interface'],'raw':!![]}]})[_0xf23b('0x12')](function(_0x1b551b){if(_0x1b551b){var _0x2d5d62=_[_0xf23b('0x56')](_0x1b551b,function(_0x491e7d){var _0x9265ef=_0x491e7d[_0xf23b('0x13')]({'plain':!![]});return _0x9265ef[_0xf23b('0x53')];});return db[_0xf23b('0x19')][_0xf23b('0x33')]({'where':{'id':_0x34a4bc[_0xf23b('0x38')]['id']}})[_0xf23b('0x12')](function(_0x1a6114){return db[_0xf23b('0x57')][_0xf23b('0x58')](function(_0x2b6dbc){return _0x1a6114[_0xf23b('0x51')](_0xbf8d2c,{'transaction':_0x2b6dbc})['then'](function(){return BPromise['each'](_0x2d5d62,function(_0x79f275){return db[_0xf23b('0x3b')][_0xf23b('0x59')]({'where':{'UserId':_0x79f275['id'],'OpenchannelQueueId':_0x34a4bc[_0xf23b('0x38')]['id']},'transaction':_0x2b6dbc});});})[_0xf23b('0x12')](function(){_0x2d5d62[_0xf23b('0x5a')](function(_0x125166){socket['emit'](_0xf23b('0x5b'),{'UserId':_0x125166['id'],'OpenchannelQueueId':_0x1a6114['id']});});});});});}})[_0xf23b('0x12')](respondWithStatusCode(_0x634920,null))[_0xf23b('0x23')](handleError(_0x634920,null));};exports[_0xf23b('0x5c')]=function(_0x1b3f5e,_0x1457aa){return db[_0xf23b('0x4e')][_0xf23b('0x21')]({'where':{'id':_0x1b3f5e[_0xf23b('0x20')][_0xf23b('0x52')]},'attributes':['id'],'include':[{'model':db[_0xf23b('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf23b('0x12')](handleEntityNotFound(_0x1457aa,null))[_0xf23b('0x12')](function(_0x4e2c23){var _0x286d1a=_['map'](_0x4e2c23,'id');var _0x5dbcc0=[];var _0x585a48=[];var _0x501f70=squel['select']();_0x501f70[_0xf23b('0x5d')](_0xf23b('0x5e'))['from'](_0xf23b('0x5f'),'tq')[_0xf23b('0x60')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf23b('0x1d')](_0xf23b('0x61'),_0x1b3f5e[_0xf23b('0x38')]['id']);for(var _0x33d213=0x0;_0x33d213<_0x4e2c23[_0xf23b('0x2b')];_0x33d213+=0x1){let _0x5b2118=_0x4e2c23[_0x33d213];for(var _0x50b759=0x0;_0x50b759<_0x5b2118[_0xf23b('0x53')][_0xf23b('0x2b')];_0x50b759+=0x1){let _0x4c4dcd=_0x5b2118[_0xf23b('0x53')][_0x50b759];var _0x1ec71b=_0x501f70['clone']();_0x1ec71b['where'](_0xf23b('0x62'),_0x4c4dcd['id']);_0x585a48[_0xf23b('0x63')](db[_0xf23b('0x57')]['query'](_0x1ec71b['toString'](),{'type':db[_0xf23b('0x57')][_0xf23b('0x64')]['SELECT']})['then'](function(_0x3af8ed){if(_0x3af8ed[_0xf23b('0x2b')]===0x1){return _0x4c4dcd['id'];}else{var _0x420488=_[_0xf23b('0x65')](_['map'](_0x3af8ed,_0xf23b('0x66')),function(_0x511433){return _[_0xf23b('0x67')](_0x286d1a,_0x511433);});if(_0x420488){return _0x4c4dcd['id'];}}}));}}return BPromise[_0xf23b('0x68')](_0x585a48)[_0xf23b('0x12')](function(_0x5e6162){_0x5dbcc0=_(_0x5dbcc0)[_0xf23b('0x69')](_0x5e6162)[_0xf23b('0x6a')]()['value']();return db[_0xf23b('0x19')][_0xf23b('0x33')]({'where':{'id':_0x1b3f5e[_0xf23b('0x38')]['id']}})['then'](function(_0x3a188a){return db[_0xf23b('0x57')][_0xf23b('0x58')](function(_0x48cab0){return _0x3a188a[_0xf23b('0x5c')](_0x1b3f5e['query'][_0xf23b('0x52')],{'transaction':_0x48cab0})[_0xf23b('0x12')](function(){if(!_['isEmpty'](_0x5dbcc0)){return _0x3a188a[_0xf23b('0x6b')](_0x5dbcc0,{'transaction':_0x48cab0});}})[_0xf23b('0x12')](function(){_0x5dbcc0[_0xf23b('0x5a')](function(_0x346bdf){socket[_0xf23b('0x6c')](_0xf23b('0x6d'),{'UserId':_0x346bdf,'OpenchannelQueueId':_0x3a188a['id']});});});});});});})[_0xf23b('0x12')](respondWithStatusCode(_0x1457aa,null))[_0xf23b('0x23')](handleError(_0x1457aa,null));};exports[_0xf23b('0x6e')]=function(_0x1623fd,_0x5a0ade){return db[_0xf23b('0x19')][_0xf23b('0x33')]({'where':{'id':_0x1623fd[_0xf23b('0x38')]['id']}})['then'](handleEntityNotFound(_0x5a0ade,null))['then'](function(_0x27bb89){if(_0x27bb89){return _0x27bb89[_0xf23b('0x6e')](_0x1623fd[_0xf23b('0x37')][_0xf23b('0x52')],_[_0xf23b('0x6f')](_0x1623fd[_0xf23b('0x37')],[_0xf23b('0x52'),'id'])||{})[_0xf23b('0x70')](function(_0x879bf1){for(var _0x11ee95=0x0;_0x11ee95<_0x1623fd[_0xf23b('0x37')][_0xf23b('0x52')]['length'];_0x11ee95+=0x1){socket[_0xf23b('0x6c')](_0xf23b('0x5b'),{'UserId':Number(_0x1623fd[_0xf23b('0x37')][_0xf23b('0x52')][_0x11ee95]),'OpenchannelQueueId':Number(_0x1623fd[_0xf23b('0x38')]['id'])});}return _0x879bf1;});}})['then'](respondWithResult(_0x5a0ade,null))['catch'](handleError(_0x5a0ade,null));};exports[_0xf23b('0x6b')]=function(_0x541f26,_0x13e819){return db[_0xf23b('0x19')][_0xf23b('0x33')]({'where':{'id':_0x541f26['params']['id']}})[_0xf23b('0x12')](handleEntityNotFound(_0x13e819,null))['then'](function(_0x4805f7){if(_0x4805f7){return _0x4805f7[_0xf23b('0x6b')](_0x541f26[_0xf23b('0x20')]['ids'])[_0xf23b('0x12')](function(){if(_[_0xf23b('0x71')](_0x541f26[_0xf23b('0x20')][_0xf23b('0x52')])){for(var _0x3860f9=0x0;_0x3860f9<_0x541f26[_0xf23b('0x20')][_0xf23b('0x52')][_0xf23b('0x2b')];_0x3860f9+=0x1){socket[_0xf23b('0x6c')](_0xf23b('0x6d'),{'UserId':Number(_0x541f26[_0xf23b('0x20')]['ids'][_0x3860f9]),'OpenchannelQueueId':Number(_0x541f26[_0xf23b('0x38')]['id'])});}}else{socket[_0xf23b('0x6c')](_0xf23b('0x6d'),{'UserId':Number(_0x541f26[_0xf23b('0x20')][_0xf23b('0x52')]),'OpenchannelQueueId':Number(_0x541f26[_0xf23b('0x38')]['id'])});}});}})[_0xf23b('0x12')](respondWithStatusCode(_0x13e819,null))['catch'](handleError(_0x13e819,null));};exports[_0xf23b('0x72')]=function(_0x455bba,_0x3cd55f){var _0x5682a6={};var _0x35d4c7={};var _0x20509f;var _0x503dcf;return db[_0xf23b('0x19')][_0xf23b('0x4d')]({'where':{'id':_0x455bba['params']['id']}})['then'](handleEntityNotFound(_0x3cd55f,null))['then'](function(_0xf38900){if(_0xf38900){_0x20509f=_0xf38900;_0x35d4c7[_0xf23b('0x25')]=_[_0xf23b('0x26')](db[_0xf23b('0x43')][_0xf23b('0x27')]);_0x35d4c7[_0xf23b('0x20')]=_[_0xf23b('0x26')](_0x455bba[_0xf23b('0x20')]);_0x35d4c7[_0xf23b('0x28')]=_[_0xf23b('0x3c')](_0x35d4c7[_0xf23b('0x25')],_0x35d4c7[_0xf23b('0x20')]);_0x5682a6[_0xf23b('0x29')]=_[_0xf23b('0x3c')](_0x35d4c7[_0xf23b('0x25')],qs[_0xf23b('0x2a')](_0x455bba[_0xf23b('0x20')][_0xf23b('0x2a')]));_0x5682a6[_0xf23b('0x29')]=_0x5682a6[_0xf23b('0x29')][_0xf23b('0x2b')]?_0x5682a6[_0xf23b('0x29')]:_0x35d4c7[_0xf23b('0x25')];_0x5682a6[_0xf23b('0x3e')]=qs[_0xf23b('0x3f')](_0x455bba[_0xf23b('0x20')][_0xf23b('0x3f')]);_0x5682a6[_0xf23b('0x1d')]=qs[_0xf23b('0x28')](_[_0xf23b('0x40')](_0x455bba[_0xf23b('0x20')],_0x35d4c7['filters']));if(_0x455bba['query'][_0xf23b('0x42')]){_0x5682a6[_0xf23b('0x1d')]=_[_0xf23b('0x2d')](_0x5682a6['where'],{'$or':_[_0xf23b('0x45')](_0x5682a6[_0xf23b('0x29')],function(_0x130165){var _0x3c0087={};_0x3c0087[_0x130165]={'$like':'%'+_0x455bba[_0xf23b('0x20')][_0xf23b('0x42')]+'%'};return _0x3c0087;})});}_0x5682a6=_['merge']({},_0x5682a6,_0x455bba[_0xf23b('0x2e')]);return _0x20509f[_0xf23b('0x72')](_0x5682a6);}})[_0xf23b('0x12')](function(_0x2b612b){if(_0x2b612b){_0x503dcf=_0x2b612b[_0xf23b('0x2b')];if(!_0x455bba[_0xf23b('0x20')][_0xf23b('0x50')](_0xf23b('0x3d'))){_0x5682a6[_0xf23b('0xe')]=qs['limit'](_0x455bba[_0xf23b('0x20')][_0xf23b('0xe')]);_0x5682a6[_0xf23b('0xd')]=qs['offset'](_0x455bba[_0xf23b('0x20')]['offset']);}return _0x20509f[_0xf23b('0x72')](_0x5682a6);}})[_0xf23b('0x12')](function(_0x1cd258){if(_0x1cd258){return _0x1cd258?{'count':_0x503dcf,'rows':_0x1cd258}:null;}})[_0xf23b('0x12')](respondWithResult(_0x3cd55f,null))['catch'](handleError(_0x3cd55f,null));}; \ No newline at end of file +var _0x249e=['pick','map','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','emit','removeTeams','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','findOne','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','name','send','index','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','get','OpenchannelQueues','autoAssociation','body','params','describe','getMembers','UserOpenchannelQueue','nolimit','order','sort'];(function(_0x8c553b,_0x3ccb72){var _0x5a3bf8=function(_0x19068e){while(--_0x19068e){_0x8c553b['push'](_0x8c553b['shift']());}};_0x5a3bf8(++_0x3ccb72);}(_0x249e,0x119));var _0xe249=function(_0x30e6c8,_0x4fb6b8){_0x30e6c8=_0x30e6c8-0x0;var _0x2da47d=_0x249e[_0x30e6c8];return _0x2da47d;};'use strict';var BPromise=require(_0xe249('0x0'));var util=require(_0xe249('0x1'));var _=require(_0xe249('0x2'));var squel=require(_0xe249('0x3'));var Redis=require(_0xe249('0x4'));var qs=require(_0xe249('0x5'));var logger=require('../../config/logger')(_0xe249('0x6'));var config=require(_0xe249('0x7'));var db=require(_0xe249('0x8'))['db'];config[_0xe249('0x9')]=_['defaults'](config[_0xe249('0x9')],{'host':_0xe249('0xa'),'port':0x18eb});var socket=require(_0xe249('0xb'))(new Redis(config[_0xe249('0x9')]));require(_0xe249('0xc'))[_0xe249('0xd')](socket);function respondWithStatusCode(_0xa1bb4b,_0xeaa3ae){_0xeaa3ae=_0xeaa3ae||0xcc;return function(_0x372868){if(_0x372868){return _0xa1bb4b['sendStatus'](_0xeaa3ae);}return _0xa1bb4b[_0xe249('0xe')](_0xeaa3ae)['end']();};}function respondWithResult(_0x14eab0,_0x21a140){_0x21a140=_0x21a140||0xc8;return function(_0x223269){if(_0x223269){return _0x14eab0['status'](_0x21a140)['json'](_0x223269);}};}function respondWithFilteredResult(_0x12c208,_0x25d49b){return function(_0x28ef97){if(_0x28ef97){var _0x425ac1=typeof _0x25d49b[_0xe249('0xf')]===_0xe249('0x10')&&typeof _0x25d49b[_0xe249('0x11')]===_0xe249('0x10');var _0x1e8bdd=_0x28ef97[_0xe249('0x12')];var _0x501873=_0x425ac1?0x0:_0x25d49b[_0xe249('0xf')];var _0x5eeddf=_0x425ac1?_0x28ef97['count']:_0x25d49b[_0xe249('0xf')]+_0x25d49b[_0xe249('0x11')];var _0xddde73;if(_0x5eeddf>=_0x1e8bdd){_0x5eeddf=_0x1e8bdd;_0xddde73=0xc8;}else{_0xddde73=0xce;}_0x12c208[_0xe249('0xe')](_0xddde73);return _0x12c208[_0xe249('0x13')](_0xe249('0x14'),_0x501873+'-'+_0x5eeddf+'/'+_0x1e8bdd)[_0xe249('0x15')](_0x28ef97);}return null;};}function saveUpdates(_0x12db23){return function(_0x35026b){if(_0x35026b){return _0x35026b[_0xe249('0x16')](_0x12db23)[_0xe249('0x17')](function(_0x5df417){return _0x5df417;});}return null;};}function removeEntity(_0x36bd16){return function(_0x5e5a1e){if(_0x5e5a1e){return _0x5e5a1e['destroy']()[_0xe249('0x17')](function(){var _0x2ec519=_0x5e5a1e['get']({'plain':!![]});var _0x44918c='OpenchannelQueues';return db['UserProfileResource'][_0xe249('0x18')]({'where':{'type':_0x44918c,'resourceId':_0x2ec519['id']}})['then'](function(){return _0x5e5a1e;});})[_0xe249('0x17')](function(){_0x36bd16[_0xe249('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x443a68){return function(_0x577e6d){if(!_0x577e6d){_0x443a68['sendStatus'](0x194);}return _0x577e6d;};}function handleError(_0xfb66a4,_0x270f49){_0x270f49=_0x270f49||0x1f4;return function(_0x557a01){logger[_0xe249('0x19')](_0x557a01['stack']);if(_0x557a01[_0xe249('0x1a')]){delete _0x557a01[_0xe249('0x1a')];}_0xfb66a4[_0xe249('0xe')](_0x270f49)[_0xe249('0x1b')](_0x557a01);};}exports[_0xe249('0x1c')]=function(_0x15ed30,_0x5e16cd){var _0x3d98a8={};var _0xdb953a={'count':0x0,'rows':[]};var _0x2d9591=_['map'](db[_0xe249('0x1d')][_0xe249('0x1e')],function(_0x26a781){return{'name':_0x26a781['fieldName'],'type':_0x26a781[_0xe249('0x1f')][_0xe249('0x20')]};});_0x3d98a8=qs[_0xe249('0x21')](_0x2d9591,_0x15ed30);var _0x58111c={'where':_0x3d98a8[_0xe249('0x22')]};return db[_0xe249('0x1d')]['count'](_0x58111c)[_0xe249('0x17')](function(_0x41ef0c){_0xdb953a[_0xe249('0x12')]=_0x41ef0c;_0x3d98a8['include']=qs[_0xe249('0x23')](_0x15ed30[_0xe249('0x24')]);return db['OpenchannelQueue'][_0xe249('0x25')](_0x3d98a8);})[_0xe249('0x17')](function(_0x4d8170){_0xdb953a['rows']=_0x4d8170;return _0xdb953a;})['then'](respondWithFilteredResult(_0x5e16cd,_0x3d98a8))[_0xe249('0x26')](handleError(_0x5e16cd,null));};exports[_0xe249('0x27')]=function(_0xfd1e33,_0x4f1c43){var _0xd116ef={'raw':!![],'where':{'id':_0xfd1e33['params']['id']}},_0x5216cb={};_0x5216cb[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x1d')][_0xe249('0x1e')]);_0x5216cb[_0xe249('0x24')]=_['keys'](_0xfd1e33[_0xe249('0x24')]);_0x5216cb[_0xe249('0x2a')]=_[_0xe249('0x2b')](_0x5216cb[_0xe249('0x28')],_0x5216cb['query']);_0xd116ef[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0x5216cb[_0xe249('0x28')],qs['fields'](_0xfd1e33[_0xe249('0x24')][_0xe249('0x2d')]));_0xd116ef[_0xe249('0x2c')]=_0xd116ef[_0xe249('0x2c')][_0xe249('0x2e')]?_0xd116ef[_0xe249('0x2c')]:_0x5216cb[_0xe249('0x28')];if(_0xfd1e33['query'][_0xe249('0x2f')]){_0xd116ef[_0xe249('0x23')]=[{'all':!![]}];}_0xd116ef=_[_0xe249('0x30')]({},_0xd116ef,_0xfd1e33[_0xe249('0x31')]);return db[_0xe249('0x1d')][_0xe249('0x32')](_0xd116ef)[_0xe249('0x17')](handleEntityNotFound(_0x4f1c43,null))[_0xe249('0x17')](respondWithResult(_0x4f1c43,null))['catch'](handleError(_0x4f1c43,null));};exports[_0xe249('0x33')]=function(_0x15454b,_0x494f49){return db[_0xe249('0x1d')][_0xe249('0x33')](_0x15454b['body'],{})['then'](function(_0x406f16){var _0x2fe125=_0x15454b[_0xe249('0x34')][_0xe249('0x35')]({'plain':!![]});if(!_0x2fe125)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe125['role']===_0xe249('0x34')){var _0x5ac837=_0x406f16[_0xe249('0x35')]({'plain':!![]});var _0x57db31=_0xe249('0x36');return db['UserProfileSection']['find']({'where':{'name':_0x57db31,'userProfileId':_0x2fe125['userProfileId']},'raw':!![]})[_0xe249('0x17')](function(_0x37e92b){if(_0x37e92b&&_0x37e92b[_0xe249('0x37')]===0x0){return db['UserProfileResource'][_0xe249('0x33')]({'name':_0x5ac837[_0xe249('0x1a')],'resourceId':_0x5ac837['id'],'type':_0x37e92b[_0xe249('0x1a')],'sectionId':_0x37e92b['id']},{})[_0xe249('0x17')](function(){return _0x406f16;});}else{return _0x406f16;}})['catch'](function(_0x8cc092){logger[_0xe249('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8cc092);throw _0x8cc092;});}return _0x406f16;})[_0xe249('0x17')](respondWithResult(_0x494f49,0xc9))[_0xe249('0x26')](handleError(_0x494f49,null));};exports[_0xe249('0x16')]=function(_0x5e1927,_0x449825){if(_0x5e1927[_0xe249('0x38')]['id']){delete _0x5e1927[_0xe249('0x38')]['id'];}return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x5e1927[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x449825,null))[_0xe249('0x17')](saveUpdates(_0x5e1927[_0xe249('0x38')],null))['then'](respondWithResult(_0x449825,null))[_0xe249('0x26')](handleError(_0x449825,null));};exports[_0xe249('0x18')]=function(_0x52d890,_0x1e296e){return db['OpenchannelQueue'][_0xe249('0x32')]({'where':{'id':_0x52d890[_0xe249('0x39')]['id']}})['then'](handleEntityNotFound(_0x1e296e,null))[_0xe249('0x17')](removeEntity(_0x1e296e,null))['catch'](handleError(_0x1e296e,null));};exports[_0xe249('0x3a')]=function(_0x5829be,_0x3881b0){return db['OpenchannelQueue'][_0xe249('0x3a')]()[_0xe249('0x17')](respondWithResult(_0x3881b0,null))[_0xe249('0x26')](handleError(_0x3881b0,null));};exports[_0xe249('0x3b')]=function(_0x190695,_0x4891e1){var _0x4feb44={'raw':!![],'where':{}},_0x447f8f={},_0x1ad206;return db[_0xe249('0x1d')]['findOne']({'where':{'id':_0x190695['params']['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x4891e1,null))['then'](function(_0x234aab){if(_0x234aab){_0x1ad206=_0x234aab[_0xe249('0x35')]({'plain':!![]});_0x447f8f[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x3c')][_0xe249('0x1e')]);_0x447f8f[_0xe249('0x24')]=_[_0xe249('0x29')](_0x190695['query']);_0x447f8f['filters']=_[_0xe249('0x2b')](_0x447f8f[_0xe249('0x28')],_0x447f8f[_0xe249('0x24')]);_0x4feb44[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0x447f8f[_0xe249('0x28')],qs[_0xe249('0x2d')](_0x190695[_0xe249('0x24')]['fields']));_0x4feb44[_0xe249('0x2c')]=_0x4feb44[_0xe249('0x2c')][_0xe249('0x2e')]?_0x4feb44['attributes']:_0x447f8f[_0xe249('0x28')];if(!_0x190695[_0xe249('0x24')]['hasOwnProperty'](_0xe249('0x3d'))){_0x4feb44[_0xe249('0x11')]=qs['limit'](_0x190695['query'][_0xe249('0x11')]);_0x4feb44[_0xe249('0xf')]=qs['offset'](_0x190695[_0xe249('0x24')][_0xe249('0xf')]);}_0x4feb44[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x190695[_0xe249('0x24')]['sort']);_0x4feb44[_0xe249('0x22')]=qs['filters'](_[_0xe249('0x40')](_0x190695['query'],_0x447f8f['filters']));_0x4feb44[_0xe249('0x22')]['OpenchannelQueueId']=_0x234aab['id'];if(_0x190695[_0xe249('0x24')]['filter']){_0x4feb44['where']=_['merge'](_0x4feb44[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0x4feb44[_0xe249('0x2c')],function(_0x1436fb){var _0x5d7747={};_0x5d7747[_0x1436fb]={'$like':'%'+_0x190695[_0xe249('0x24')][_0xe249('0x42')]+'%'};return _0x5d7747;})});}_0x4feb44=_[_0xe249('0x30')]({},_0x4feb44,_0x190695[_0xe249('0x31')]);return db[_0xe249('0x3c')][_0xe249('0x25')](_0x4feb44);}})['then'](function(_0x54e409){if(_0x54e409){return db[_0xe249('0x43')][_0xe249('0x44')]({'where':{'id':_['map'](_0x54e409,_0xe249('0x45')),'role':_0xe249('0x46')},'attributes':['id',_0xe249('0x1a'),_0xe249('0x47'),_0xe249('0x48'),_0xe249('0x49')]});}})[_0xe249('0x17')](function(_0x346c8c){if(_0x346c8c){return{'count':_0x346c8c[_0xe249('0x12')],'rows':_['map'](_0x346c8c[_0xe249('0x4a')],function(_0x488d05){return{'membername':_0x488d05[_0xe249('0x1a')],'UserId':_0x488d05['id'],'queue_name':_0x1ad206[_0xe249('0x1a')],'OpenchannelQueueId':_0x1ad206['id'],'interface':util['format'](_0xe249('0x4b'),'SIP',_0x488d05['name']),'penalty':0x0,'paused':_0x488d05[_0xe249('0x47')],'createdAt':_0x488d05[_0xe249('0x49')],'updatedAt':_0x488d05[_0xe249('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4891e1,_0x4feb44))['catch'](handleError(_0x4891e1,null));};exports[_0xe249('0x4c')]=function(_0x2507ea,_0x452bce){var _0xf8ab2e={};var _0xadcd1e={};var _0x50a020;var _0x11ac64;return db[_0xe249('0x1d')]['findOne']({'where':{'id':_0x2507ea[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x452bce,null))[_0xe249('0x17')](function(_0x2eca6d){if(_0x2eca6d){_0x50a020=_0x2eca6d;_0xadcd1e[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x4d')][_0xe249('0x1e')]);_0xadcd1e['query']=_[_0xe249('0x29')](_0x2507ea[_0xe249('0x24')]);_0xadcd1e['filters']=_[_0xe249('0x2b')](_0xadcd1e[_0xe249('0x28')],_0xadcd1e['query']);_0xf8ab2e[_0xe249('0x2c')]=_[_0xe249('0x2b')](_0xadcd1e['model'],qs[_0xe249('0x2d')](_0x2507ea['query'][_0xe249('0x2d')]));_0xf8ab2e['attributes']=_0xf8ab2e['attributes'][_0xe249('0x2e')]?_0xf8ab2e[_0xe249('0x2c')]:_0xadcd1e[_0xe249('0x28')];_0xf8ab2e[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x2507ea[_0xe249('0x24')][_0xe249('0x3f')]);_0xf8ab2e[_0xe249('0x22')]=qs['filters'](_[_0xe249('0x40')](_0x2507ea[_0xe249('0x24')],_0xadcd1e[_0xe249('0x2a')]));if(_0x2507ea[_0xe249('0x24')][_0xe249('0x42')]){_0xf8ab2e[_0xe249('0x22')]=_[_0xe249('0x30')](_0xf8ab2e[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0xf8ab2e[_0xe249('0x2c')],function(_0x5d94){var _0x5088ab={};_0x5088ab[_0x5d94]={'$like':'%'+_0x2507ea[_0xe249('0x24')]['filter']+'%'};return _0x5088ab;})});}_0xf8ab2e=_[_0xe249('0x30')]({},_0xf8ab2e,_0x2507ea['options']);return _0x50a020[_0xe249('0x4c')](_0xf8ab2e);}})['then'](function(_0x4ff6d6){if(_0x4ff6d6){_0x11ac64=_0x4ff6d6[_0xe249('0x2e')];if(!_0x2507ea[_0xe249('0x24')][_0xe249('0x4e')](_0xe249('0x3d'))){_0xf8ab2e[_0xe249('0x11')]=qs[_0xe249('0x11')](_0x2507ea[_0xe249('0x24')][_0xe249('0x11')]);_0xf8ab2e['offset']=qs[_0xe249('0xf')](_0x2507ea[_0xe249('0x24')][_0xe249('0xf')]);}return _0x50a020[_0xe249('0x4c')](_0xf8ab2e);}})['then'](function(_0xf19d57){if(_0xf19d57){return _0xf19d57?{'count':_0x11ac64,'rows':_0xf19d57}:null;}})[_0xe249('0x17')](respondWithResult(_0x452bce,null))[_0xe249('0x26')](handleError(_0x452bce,null));};exports[_0xe249('0x4f')]=function(_0x221997,_0x20d79b){var _0x14b605=_0x221997[_0xe249('0x38')][_0xe249('0x50')];return db[_0xe249('0x4d')]['findAll']({'where':{'id':_0x14b605},'attributes':['id'],'include':[{'model':db[_0xe249('0x43')],'as':_0xe249('0x51'),'attributes':['id',_0xe249('0x1a'),'online',_0xe249('0x52'),_0xe249('0x53')],'raw':!![]}]})['then'](function(_0x4aa407){if(_0x4aa407){var _0x3e4f9c=_[_0xe249('0x54')](_0x4aa407,function(_0x34dfd8){var _0x33c880=_0x34dfd8[_0xe249('0x35')]({'plain':!![]});return _0x33c880[_0xe249('0x51')];});return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x221997[_0xe249('0x39')]['id']}})['then'](function(_0x111d1b){return db[_0xe249('0x55')][_0xe249('0x56')](function(_0x34022b){return _0x111d1b['addTeams'](_0x14b605,{'transaction':_0x34022b})[_0xe249('0x17')](function(){return BPromise['each'](_0x3e4f9c,function(_0x1dd249){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x1dd249['id'],'OpenchannelQueueId':_0x221997[_0xe249('0x39')]['id']},'transaction':_0x34022b});});})['then'](function(){_0x3e4f9c['forEach'](function(_0x100719){socket[_0xe249('0x57')]('userOpenchannelQueue:save',{'UserId':_0x100719['id'],'OpenchannelQueueId':_0x111d1b['id']});});});});});}})[_0xe249('0x17')](respondWithStatusCode(_0x20d79b,null))['catch'](handleError(_0x20d79b,null));};exports[_0xe249('0x58')]=function(_0x596166,_0x66945){return db[_0xe249('0x4d')][_0xe249('0x25')]({'where':{'id':_0x596166[_0xe249('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe249('0x43')],'as':_0xe249('0x51'),'attributes':['id'],'raw':!![]}]})[_0xe249('0x17')](handleEntityNotFound(_0x66945,null))['then'](function(_0x2b94af){var _0x4af6fd=_[_0xe249('0x41')](_0x2b94af,'id');var _0x298d40=[];var _0xaa74c4=[];var _0x2d2e0a=squel[_0xe249('0x59')]();_0x2d2e0a['field'](_0xe249('0x5a'))['from'](_0xe249('0x5b'),'tq')[_0xe249('0x5c')]('user_has_teams','ut',_0xe249('0x5d'))[_0xe249('0x22')](_0xe249('0x5e'),_0x596166[_0xe249('0x39')]['id']);for(var _0x5713d8=0x0;_0x5713d8<_0x2b94af['length'];_0x5713d8+=0x1){let _0x503db7=_0x2b94af[_0x5713d8];for(var _0x5c84d5=0x0;_0x5c84d5<_0x503db7[_0xe249('0x51')][_0xe249('0x2e')];_0x5c84d5+=0x1){let _0x4186fe=_0x503db7[_0xe249('0x51')][_0x5c84d5];var _0x42eddb=_0x2d2e0a[_0xe249('0x5f')]();_0x42eddb[_0xe249('0x22')](_0xe249('0x60'),_0x4186fe['id']);_0xaa74c4[_0xe249('0x61')](db['sequelize'][_0xe249('0x24')](_0x42eddb[_0xe249('0x62')](),{'type':db['sequelize']['QueryTypes'][_0xe249('0x63')]})['then'](function(_0x9349e5){if(_0x9349e5[_0xe249('0x2e')]===0x1){return _0x4186fe['id'];}else{var _0x4905f8=_[_0xe249('0x64')](_[_0xe249('0x41')](_0x9349e5,'TeamId'),function(_0x2261bf){return _[_0xe249('0x65')](_0x4af6fd,_0x2261bf);});if(_0x4905f8){return _0x4186fe['id'];}}}));}}return BPromise[_0xe249('0x66')](_0xaa74c4)['then'](function(_0x58f2c7){_0x298d40=_(_0x298d40)[_0xe249('0x67')](_0x58f2c7)['compact']()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x596166[_0xe249('0x39')]['id']}})[_0xe249('0x17')](function(_0x4c4aff){return db[_0xe249('0x55')]['transaction'](function(_0x281c6b){return _0x4c4aff[_0xe249('0x58')](_0x596166['query'][_0xe249('0x50')],{'transaction':_0x281c6b})[_0xe249('0x17')](function(){if(!_[_0xe249('0x68')](_0x298d40)){return _0x4c4aff[_0xe249('0x69')](_0x298d40,{'transaction':_0x281c6b});}})[_0xe249('0x17')](function(){_0x298d40[_0xe249('0x6a')](function(_0x57281b){socket['emit'](_0xe249('0x6b'),{'UserId':_0x57281b,'OpenchannelQueueId':_0x4c4aff['id']});});});});});});})['then'](respondWithStatusCode(_0x66945,null))[_0xe249('0x26')](handleError(_0x66945,null));};exports[_0xe249('0x6c')]=function(_0x28c14d,_0x1fc6b9){return db['OpenchannelQueue']['find']({'where':{'id':_0x28c14d[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x1fc6b9,null))[_0xe249('0x17')](function(_0x3e7521){if(_0x3e7521){return _0x3e7521['addAgents'](_0x28c14d[_0xe249('0x38')][_0xe249('0x50')],_[_0xe249('0x6d')](_0x28c14d[_0xe249('0x38')],[_0xe249('0x50'),'id'])||{})[_0xe249('0x6e')](function(_0x5bfb7e){for(var _0x26497f=0x0;_0x26497f<_0x28c14d['body'][_0xe249('0x50')][_0xe249('0x2e')];_0x26497f+=0x1){socket[_0xe249('0x57')](_0xe249('0x6f'),{'UserId':Number(_0x28c14d['body'][_0xe249('0x50')][_0x26497f]),'OpenchannelQueueId':Number(_0x28c14d['params']['id'])});}return _0x5bfb7e;});}})[_0xe249('0x17')](respondWithResult(_0x1fc6b9,null))[_0xe249('0x26')](handleError(_0x1fc6b9,null));};exports['removeAgents']=function(_0x593503,_0x5630e4){return db[_0xe249('0x1d')][_0xe249('0x32')]({'where':{'id':_0x593503[_0xe249('0x39')]['id']}})['then'](handleEntityNotFound(_0x5630e4,null))['then'](function(_0x22f36e){if(_0x22f36e){return _0x22f36e['removeAgents'](_0x593503['query'][_0xe249('0x50')])[_0xe249('0x17')](function(){if(_[_0xe249('0x70')](_0x593503[_0xe249('0x24')][_0xe249('0x50')])){for(var _0x4b13b1=0x0;_0x4b13b1<_0x593503['query'][_0xe249('0x50')][_0xe249('0x2e')];_0x4b13b1+=0x1){socket[_0xe249('0x57')]('userOpenchannelQueue:remove',{'UserId':Number(_0x593503[_0xe249('0x24')][_0xe249('0x50')][_0x4b13b1]),'OpenchannelQueueId':Number(_0x593503[_0xe249('0x39')]['id'])});}}else{socket[_0xe249('0x57')](_0xe249('0x6b'),{'UserId':Number(_0x593503[_0xe249('0x24')]['ids']),'OpenchannelQueueId':Number(_0x593503['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5630e4,null))[_0xe249('0x26')](handleError(_0x5630e4,null));};exports[_0xe249('0x71')]=function(_0x90e6f9,_0x2bcfce){var _0x54c438={};var _0x2d1230={};var _0x47d71b;var _0x3a97b6;return db['OpenchannelQueue'][_0xe249('0x72')]({'where':{'id':_0x90e6f9[_0xe249('0x39')]['id']}})[_0xe249('0x17')](handleEntityNotFound(_0x2bcfce,null))['then'](function(_0x222429){if(_0x222429){_0x47d71b=_0x222429;_0x2d1230[_0xe249('0x28')]=_[_0xe249('0x29')](db[_0xe249('0x43')]['rawAttributes']);_0x2d1230['query']=_[_0xe249('0x29')](_0x90e6f9[_0xe249('0x24')]);_0x2d1230[_0xe249('0x2a')]=_[_0xe249('0x2b')](_0x2d1230[_0xe249('0x28')],_0x2d1230['query']);_0x54c438['attributes']=_['intersection'](_0x2d1230[_0xe249('0x28')],qs['fields'](_0x90e6f9['query'][_0xe249('0x2d')]));_0x54c438[_0xe249('0x2c')]=_0x54c438[_0xe249('0x2c')]['length']?_0x54c438[_0xe249('0x2c')]:_0x2d1230[_0xe249('0x28')];_0x54c438[_0xe249('0x3e')]=qs[_0xe249('0x3f')](_0x90e6f9['query'][_0xe249('0x3f')]);_0x54c438['where']=qs[_0xe249('0x2a')](_['pick'](_0x90e6f9[_0xe249('0x24')],_0x2d1230[_0xe249('0x2a')]));if(_0x90e6f9[_0xe249('0x24')][_0xe249('0x42')]){_0x54c438['where']=_[_0xe249('0x30')](_0x54c438[_0xe249('0x22')],{'$or':_[_0xe249('0x41')](_0x54c438['attributes'],function(_0xb06e58){var _0x22807f={};_0x22807f[_0xb06e58]={'$like':'%'+_0x90e6f9[_0xe249('0x24')]['filter']+'%'};return _0x22807f;})});}_0x54c438=_[_0xe249('0x30')]({},_0x54c438,_0x90e6f9[_0xe249('0x31')]);return _0x47d71b[_0xe249('0x71')](_0x54c438);}})[_0xe249('0x17')](function(_0x4e4a13){if(_0x4e4a13){_0x3a97b6=_0x4e4a13['length'];if(!_0x90e6f9[_0xe249('0x24')]['hasOwnProperty'](_0xe249('0x3d'))){_0x54c438[_0xe249('0x11')]=qs[_0xe249('0x11')](_0x90e6f9['query'][_0xe249('0x11')]);_0x54c438[_0xe249('0xf')]=qs['offset'](_0x90e6f9[_0xe249('0x24')][_0xe249('0xf')]);}return _0x47d71b[_0xe249('0x71')](_0x54c438);}})[_0xe249('0x17')](function(_0x1118b9){if(_0x1118b9){return _0x1118b9?{'count':_0x3a97b6,'rows':_0x1118b9}:null;}})[_0xe249('0x17')](respondWithResult(_0x2bcfce,null))['catch'](handleError(_0x2bcfce,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 34594b9..4c2dde8 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 _0x6fa2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x6fa2,0xf6));var _0x26fa=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6fa2[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x26fa('0x0'));var OpenchannelQueue=require(_0x26fa('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x26fa('0x2')](0x0);var events={'afterCreate':_0x26fa('0x3'),'afterUpdate':_0x26fa('0x4'),'afterDestroy':_0x26fa('0x5')};function emitEvent(_0x3aef0f){return function(_0x4458d9,_0x5b91ed,_0x95bcdf){OpenchannelQueueEvents[_0x26fa('0x6')](_0x3aef0f+':'+_0x4458d9['id'],_0x4458d9);OpenchannelQueueEvents[_0x26fa('0x6')](_0x3aef0f,_0x4458d9);_0x95bcdf(null);};}for(var e in events){if(events[_0x26fa('0x7')](e)){var event=events[e];OpenchannelQueue[_0x26fa('0x8')](e,emitEvent(event));}}module[_0x26fa('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xcdcc=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xe6c335,_0x276ffe){var _0x86836b=function(_0x508fd2){while(--_0x508fd2){_0xe6c335['push'](_0xe6c335['shift']());}};_0x86836b(++_0x276ffe);}(_0xcdcc,0xa3));var _0xccdc=function(_0x2cc649,_0x3b9b41){_0x2cc649=_0x2cc649-0x0;var _0x6bac75=_0xcdcc[_0x2cc649];return _0x6bac75;};'use strict';var EventEmitter=require(_0xccdc('0x0'));var OpenchannelQueue=require(_0xccdc('0x1'))['db'][_0xccdc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xccdc('0x3')](0x0);var events={'afterCreate':_0xccdc('0x4'),'afterUpdate':_0xccdc('0x5'),'afterDestroy':_0xccdc('0x6')};function emitEvent(_0xae08c8){return function(_0x1bed40,_0x3444af,_0x120a6b){OpenchannelQueueEvents[_0xccdc('0x7')](_0xae08c8+':'+_0x1bed40['id'],_0x1bed40);OpenchannelQueueEvents[_0xccdc('0x7')](_0xae08c8,_0x1bed40);_0x120a6b(null);};}for(var e in events){if(events[_0xccdc('0x8')](e)){var event=events[e];OpenchannelQueue[_0xccdc('0x9')](e,emitEvent(event));}}module[_0xccdc('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 159bf4a..168291f 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 _0x44ee=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','api','moment','request-promise'];(function(_0x34e481,_0x1f0d05){var _0x195d01=function(_0x4e3fae){while(--_0x4e3fae){_0x34e481['push'](_0x34e481['shift']());}};_0x195d01(++_0x1f0d05);}(_0x44ee,0x68));var _0xe44e=function(_0x5de8b5,_0x804bcd){_0x5de8b5=_0x5de8b5-0x0;var _0x23dd32=_0x44ee[_0x5de8b5];return _0x23dd32;};'use strict';var _=require('lodash');var util=require(_0xe44e('0x0'));var logger=require('../../config/logger')(_0xe44e('0x1'));var moment=require(_0xe44e('0x2'));var BPromise=require('bluebird');var rp=require(_0xe44e('0x3'));var fs=require('fs');var path=require(_0xe44e('0x4'));var rimraf=require(_0xe44e('0x5'));var config=require(_0xe44e('0x6'));var attributes=require(_0xe44e('0x7'));module[_0xe44e('0x8')]=function(_0x40100f,_0x1c2974){return _0x40100f[_0xe44e('0x9')](_0xe44e('0xa'),attributes,{'tableName':_0xe44e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff6=['./openchannelQueue.attributes','exports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3672a8,_0x547725){var _0x470ed6=function(_0x5c30b9){while(--_0x5c30b9){_0x3672a8['push'](_0x3672a8['shift']());}};_0x470ed6(++_0x547725);}(_0xaff6,0xf2));var _0x6aff=function(_0x487289,_0xced20b){_0x487289=_0x487289-0x0;var _0x2d6d1a=_0xaff6[_0x487289];return _0x2d6d1a;};'use strict';var _=require(_0x6aff('0x0'));var util=require(_0x6aff('0x1'));var logger=require(_0x6aff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6aff('0x3'));var rp=require(_0x6aff('0x4'));var fs=require('fs');var path=require(_0x6aff('0x5'));var rimraf=require(_0x6aff('0x6'));var config=require(_0x6aff('0x7'));var attributes=require(_0x6aff('0x8'));module[_0x6aff('0x9')]=function(_0x4ed676,_0x42b347){return _0x4ed676['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 c17f84b..67e4e93 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 _0x8d15=['options','where','attributes','include','map','model','then','catch','ShowOpenchannelQueue','find','raw','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0x8d15,0x16a));var _0x58d1=function(_0x4295c0,_0x3f178d){_0x4295c0=_0x4295c0-0x0;var _0xc8dd68=_0x8d15[_0x4295c0];return _0xc8dd68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x58d1('0x0'));var rs=require(_0x58d1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58d1('0x2'))['db'];var utils=require(_0x58d1('0x3'));var logger=require(_0x58d1('0x4'))(_0x58d1('0x5'));var config=require(_0x58d1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x58d1('0x7')][_0x58d1('0x8')]({'port':0x232a});config[_0x58d1('0x9')]=_[_0x58d1('0xa')](config[_0x58d1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x58d1('0xb'))(new Redis(config[_0x58d1('0x9')]));require(_0x58d1('0xc'))[_0x58d1('0xd')](socket);function respondWithRpcPromise(_0x5de966,_0x41289b,_0x4185a6){return new BPromise(function(_0x5c5c36,_0x313253){return client[_0x58d1('0xe')](_0x5de966,_0x4185a6)['then'](function(_0x5eb910){logger[_0x58d1('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x41289b,'request\x20sent');logger[_0x58d1('0x10')](_0x58d1('0x11'),_0x41289b,_0x58d1('0x12'),JSON[_0x58d1('0x13')](_0x5eb910));if(_0x5eb910['error']){if(_0x5eb910[_0x58d1('0x14')][_0x58d1('0x15')]===0x1f4){logger[_0x58d1('0x14')](_0x58d1('0x16'),_0x41289b,_0x5eb910['error'][_0x58d1('0x17')]);return _0x313253(_0x5eb910[_0x58d1('0x14')][_0x58d1('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x41289b,_0x5eb910['error']['message']);return _0x5c5c36(_0x5eb910[_0x58d1('0x14')][_0x58d1('0x17')]);}else{logger[_0x58d1('0xf')](_0x58d1('0x16'),_0x41289b,_0x58d1('0x12'));_0x5c5c36(_0x5eb910[_0x58d1('0x18')][_0x58d1('0x17')]);}})['catch'](function(_0x361d4c){logger['error'](_0x58d1('0x16'),_0x41289b,_0x361d4c);_0x313253(_0x361d4c);});});}exports[_0x58d1('0x19')]=function(_0x1923b8){var _0x485887=this;return new Promise(function(_0x779333,_0x13ade4){return db[_0x58d1('0x1a')][_0x58d1('0x1b')]({'raw':_0x1923b8[_0x58d1('0x1c')]?_0x1923b8[_0x58d1('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1923b8[_0x58d1('0x1c')]?_0x1923b8[_0x58d1('0x1c')][_0x58d1('0x1d')]||null:null,'attributes':_0x1923b8[_0x58d1('0x1c')]?_0x1923b8['options'][_0x58d1('0x1e')]||null:null,'limit':_0x1923b8['options']?_0x1923b8[_0x58d1('0x1c')]['limit']||null:null,'include':_0x1923b8[_0x58d1('0x1c')]?_0x1923b8[_0x58d1('0x1c')][_0x58d1('0x1f')]?_[_0x58d1('0x20')](_0x1923b8[_0x58d1('0x1c')][_0x58d1('0x1f')],function(_0x3abe02){return{'model':db[_0x3abe02[_0x58d1('0x21')]],'as':_0x3abe02['as'],'attributes':_0x3abe02[_0x58d1('0x1e')],'include':_0x3abe02['include']?_[_0x58d1('0x20')](_0x3abe02[_0x58d1('0x1f')],function(_0x3bdca9){return{'model':db[_0x3bdca9[_0x58d1('0x21')]],'as':_0x3bdca9['as'],'attributes':_0x3bdca9[_0x58d1('0x1e')],'include':_0x3bdca9[_0x58d1('0x1f')]?_[_0x58d1('0x20')](_0x3bdca9[_0x58d1('0x1f')],function(_0x14190b){return{'model':db[_0x14190b[_0x58d1('0x21')]],'as':_0x14190b['as'],'attributes':_0x14190b['attributes']};}):[]};}):[]};}):[]:[]})[_0x58d1('0x22')](function(_0x403f07){logger[_0x58d1('0xf')]('GetOpenchannelQueue',_0x1923b8);logger[_0x58d1('0x10')](_0x58d1('0x19'),_0x1923b8,JSON[_0x58d1('0x13')](_0x403f07));_0x779333(_0x403f07);})[_0x58d1('0x23')](function(_0x20e7d4){logger[_0x58d1('0x14')](_0x58d1('0x19'),_0x20e7d4[_0x58d1('0x17')],_0x1923b8);_0x13ade4(_0x485887[_0x58d1('0x14')](0x1f4,_0x20e7d4['message']));});});};exports[_0x58d1('0x24')]=function(_0x1c8f26){var _0x4cca81=this;return new Promise(function(_0x54719d,_0x15938d){return db['OpenchannelQueue'][_0x58d1('0x25')]({'raw':_0x1c8f26[_0x58d1('0x1c')]?_0x1c8f26['options'][_0x58d1('0x26')]===undefined?!![]:![]:!![],'where':_0x1c8f26['options']?_0x1c8f26['options'][_0x58d1('0x1d')]||null:null,'attributes':_0x1c8f26['options']?_0x1c8f26[_0x58d1('0x1c')]['attributes']||null:null,'include':_0x1c8f26[_0x58d1('0x1c')]?_0x1c8f26[_0x58d1('0x1c')][_0x58d1('0x1f')]?_[_0x58d1('0x20')](_0x1c8f26[_0x58d1('0x1c')][_0x58d1('0x1f')],function(_0x5f43f7){return{'model':db[_0x5f43f7[_0x58d1('0x21')]],'as':_0x5f43f7['as'],'attributes':_0x5f43f7[_0x58d1('0x1e')],'include':_0x5f43f7['include']?_[_0x58d1('0x20')](_0x5f43f7['include'],function(_0x512535){return{'model':db[_0x512535[_0x58d1('0x21')]],'as':_0x512535['as'],'attributes':_0x512535[_0x58d1('0x1e')],'include':_0x512535[_0x58d1('0x1f')]?_[_0x58d1('0x20')](_0x512535[_0x58d1('0x1f')],function(_0x38c6ce){return{'model':db[_0x38c6ce[_0x58d1('0x21')]],'as':_0x38c6ce['as'],'attributes':_0x38c6ce[_0x58d1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x58d1('0x22')](function(_0x10c0f7){logger[_0x58d1('0xf')](_0x58d1('0x24'),_0x1c8f26);logger[_0x58d1('0x10')](_0x58d1('0x24'),_0x1c8f26,JSON[_0x58d1('0x13')](_0x10c0f7));_0x54719d(_0x10c0f7);})[_0x58d1('0x23')](function(_0x4d0a4d){logger[_0x58d1('0x14')](_0x58d1('0x24'),_0x4d0a4d[_0x58d1('0x17')],_0x1c8f26);_0x15938d(_0x4cca81[_0x58d1('0x14')](0x1f4,_0x4d0a4d[_0x58d1('0x17')]));});});}; \ No newline at end of file +var _0x0ee1=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','model','map','include','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b2779,_0x181d22){var _0x162929=function(_0x2d0083){while(--_0x2d0083){_0x1b2779['push'](_0x1b2779['shift']());}};_0x162929(++_0x181d22);}(_0x0ee1,0x7c));var _0x10ee=function(_0x19fc3e,_0x1a060e){_0x19fc3e=_0x19fc3e-0x0;var _0x56a220=_0x0ee1[_0x19fc3e];return _0x56a220;};'use strict';var _=require(_0x10ee('0x0'));var util=require(_0x10ee('0x1'));var moment=require(_0x10ee('0x2'));var BPromise=require('bluebird');var rs=require(_0x10ee('0x3'));var fs=require('fs');var Redis=require(_0x10ee('0x4'));var db=require(_0x10ee('0x5'))['db'];var utils=require(_0x10ee('0x6'));var logger=require(_0x10ee('0x7'))(_0x10ee('0x8'));var config=require(_0x10ee('0x9'));var jayson=require(_0x10ee('0xa'));var client=jayson[_0x10ee('0xb')][_0x10ee('0xc')]({'port':0x232a});config[_0x10ee('0xd')]=_[_0x10ee('0xe')](config[_0x10ee('0xd')],{'host':_0x10ee('0xf'),'port':0x18eb});var socket=require(_0x10ee('0x10'))(new Redis(config['redis']));require(_0x10ee('0x11'))[_0x10ee('0x12')](socket);function respondWithRpcPromise(_0x5056b3,_0x4c7c9d,_0x5bf6cb){return new BPromise(function(_0x3a1828,_0x2d3381){return client[_0x10ee('0x13')](_0x5056b3,_0x5bf6cb)[_0x10ee('0x14')](function(_0x43d081){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x10ee('0x15'));logger[_0x10ee('0x16')](_0x10ee('0x17'),_0x4c7c9d,_0x10ee('0x15'),JSON[_0x10ee('0x18')](_0x43d081));if(_0x43d081[_0x10ee('0x19')]){if(_0x43d081[_0x10ee('0x19')][_0x10ee('0x1a')]===0x1f4){logger[_0x10ee('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);return _0x2d3381(_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);}logger[_0x10ee('0x19')](_0x10ee('0x1c'),_0x4c7c9d,_0x43d081[_0x10ee('0x19')][_0x10ee('0x1b')]);return _0x3a1828(_0x43d081[_0x10ee('0x19')]['message']);}else{logger[_0x10ee('0x1d')](_0x10ee('0x1c'),_0x4c7c9d,_0x10ee('0x15'));_0x3a1828(_0x43d081['result'][_0x10ee('0x1b')]);}})[_0x10ee('0x1e')](function(_0x1c4d57){logger[_0x10ee('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4c7c9d,_0x1c4d57);_0x2d3381(_0x1c4d57);});});}exports[_0x10ee('0x1f')]=function(_0x1ea4a5){var _0x541152=this;return new Promise(function(_0x466609,_0xc568da){return db[_0x10ee('0x20')][_0x10ee('0x21')]({'raw':_0x1ea4a5['options']?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x23')]===undefined?!![]:![]:!![],'where':_0x1ea4a5['options']?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x24')]||null:null,'attributes':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5[_0x10ee('0x22')][_0x10ee('0x25')]||null:null,'limit':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5['options'][_0x10ee('0x26')]||null:null,'include':_0x1ea4a5[_0x10ee('0x22')]?_0x1ea4a5[_0x10ee('0x22')]['include']?_['map'](_0x1ea4a5[_0x10ee('0x22')]['include'],function(_0x3d9010){return{'model':db[_0x3d9010[_0x10ee('0x27')]],'as':_0x3d9010['as'],'attributes':_0x3d9010['attributes'],'include':_0x3d9010['include']?_[_0x10ee('0x28')](_0x3d9010[_0x10ee('0x29')],function(_0x41fe6f){return{'model':db[_0x41fe6f[_0x10ee('0x27')]],'as':_0x41fe6f['as'],'attributes':_0x41fe6f[_0x10ee('0x25')],'include':_0x41fe6f[_0x10ee('0x29')]?_['map'](_0x41fe6f[_0x10ee('0x29')],function(_0x1c9bd9){return{'model':db[_0x1c9bd9[_0x10ee('0x27')]],'as':_0x1c9bd9['as'],'attributes':_0x1c9bd9[_0x10ee('0x25')]};}):[]};}):[]};}):[]:[]})[_0x10ee('0x14')](function(_0x142431){logger[_0x10ee('0x1d')](_0x10ee('0x1f'),_0x1ea4a5);logger[_0x10ee('0x16')](_0x10ee('0x1f'),_0x1ea4a5,JSON[_0x10ee('0x18')](_0x142431));_0x466609(_0x142431);})[_0x10ee('0x1e')](function(_0x4b6154){logger[_0x10ee('0x19')](_0x10ee('0x1f'),_0x4b6154[_0x10ee('0x1b')],_0x1ea4a5);_0xc568da(_0x541152[_0x10ee('0x19')](0x1f4,_0x4b6154['message']));});});};exports[_0x10ee('0x2a')]=function(_0x493df8){var _0x1c83f7=this;return new Promise(function(_0xfb7dde,_0x250fd2){return db[_0x10ee('0x20')][_0x10ee('0x2b')]({'raw':_0x493df8['options']?_0x493df8[_0x10ee('0x22')][_0x10ee('0x23')]===undefined?!![]:![]:!![],'where':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x24')]||null:null,'attributes':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x25')]||null:null,'include':_0x493df8[_0x10ee('0x22')]?_0x493df8[_0x10ee('0x22')][_0x10ee('0x29')]?_['map'](_0x493df8[_0x10ee('0x22')]['include'],function(_0x5c0476){return{'model':db[_0x5c0476['model']],'as':_0x5c0476['as'],'attributes':_0x5c0476[_0x10ee('0x25')],'include':_0x5c0476[_0x10ee('0x29')]?_[_0x10ee('0x28')](_0x5c0476['include'],function(_0x1bafcb){return{'model':db[_0x1bafcb[_0x10ee('0x27')]],'as':_0x1bafcb['as'],'attributes':_0x1bafcb[_0x10ee('0x25')],'include':_0x1bafcb[_0x10ee('0x29')]?_[_0x10ee('0x28')](_0x1bafcb['include'],function(_0x22ef99){return{'model':db[_0x22ef99[_0x10ee('0x27')]],'as':_0x22ef99['as'],'attributes':_0x22ef99['attributes']};}):[]};}):[]};}):[]:[]})[_0x10ee('0x14')](function(_0x2c47c9){logger[_0x10ee('0x1d')](_0x10ee('0x2a'),_0x493df8);logger[_0x10ee('0x16')]('ShowOpenchannelQueue',_0x493df8,JSON[_0x10ee('0x18')](_0x2c47c9));_0xfb7dde(_0x2c47c9);})[_0x10ee('0x1e')](function(_0x2b1bc2){logger[_0x10ee('0x19')]('ShowOpenchannelQueue',_0x2b1bc2[_0x10ee('0x1b')],_0x493df8);_0x250fd2(_0x1c83f7[_0x10ee('0x19')](0x1f4,_0x2b1bc2[_0x10ee('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 01922d9..b345ced 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 _0xeb11=['register','length','openchannelQueue:','save','remove'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0xeb11,0x143));var _0x1eb1=function(_0x3ac5a4,_0x34db8f){_0x3ac5a4=_0x3ac5a4-0x0;var _0x97fc84=_0xeb11[_0x3ac5a4];return _0x97fc84;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x1eb1('0x0'),_0x1eb1('0x1'),'update'];function createListener(_0x14a577,_0x398c71){return function(_0x2758e1){_0x398c71['emit'](_0x14a577,_0x2758e1);};}function removeListener(_0x1249a0,_0x4ec53d){return function(){OpenchannelQueueEvents['removeListener'](_0x1249a0,_0x4ec53d);};}exports[_0x1eb1('0x2')]=function(_0x4b24a2){for(var _0x357509=0x0,_0x59f02c=events[_0x1eb1('0x3')];_0x357509<_0x59f02c;_0x357509++){var _0x42e614=events[_0x357509];var _0x24661e=createListener(_0x1eb1('0x4')+_0x42e614,_0x4b24a2);OpenchannelQueueEvents['on'](_0x42e614,_0x24661e);}}; \ No newline at end of file +var _0x49a3=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x1c3f75,_0x4d4b16){var _0xbc1b96=function(_0x56c839){while(--_0x56c839){_0x1c3f75['push'](_0x1c3f75['shift']());}};_0xbc1b96(++_0x4d4b16);}(_0x49a3,0x16b));var _0x349a=function(_0x4d0631,_0x16de84){_0x4d0631=_0x4d0631-0x0;var _0x34c864=_0x49a3[_0x4d0631];return _0x34c864;};'use strict';var OpenchannelQueueEvents=require(_0x349a('0x0'));var events=[_0x349a('0x1'),_0x349a('0x2'),_0x349a('0x3')];function createListener(_0x21beb4,_0x1a4ba4){return function(_0xf102e8){_0x1a4ba4[_0x349a('0x4')](_0x21beb4,_0xf102e8);};}function removeListener(_0x314616,_0x2136d6){return function(){OpenchannelQueueEvents[_0x349a('0x5')](_0x314616,_0x2136d6);};}exports[_0x349a('0x6')]=function(_0x3f2fdf){for(var _0x29d2d1=0x0,_0x187b9f=events[_0x349a('0x7')];_0x29d2d1<_0x187b9f;_0x29d2d1++){var _0x142b5d=events[_0x29d2d1];var _0x1f401b=createListener(_0x349a('0x8')+_0x142b5d,_0x3f2fdf);OpenchannelQueueEvents['on'](_0x142b5d,_0x1f401b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 28d986b..06658b6 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 _0x527b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x527b,0x167));var _0xb527=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x527b[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xb527('0x0'));var util=require(_0xb527('0x1'));var path=require(_0xb527('0x2'));var timeout=require(_0xb527('0x3'));var express=require(_0xb527('0x4'));var router=express[_0xb527('0x5')]();var fs_extra=require(_0xb527('0x6'));var auth=require(_0xb527('0x7'));var interaction=require(_0xb527('0x8'));var config=require('../../config/environment');var controller=require(_0xb527('0x9'));router[_0xb527('0xa')]('/',auth[_0xb527('0xb')](),controller[_0xb527('0xc')]);router[_0xb527('0xa')](_0xb527('0xd'),auth[_0xb527('0xb')](),controller['describe']);router[_0xb527('0xa')](_0xb527('0xe'),auth[_0xb527('0xb')](),controller['show']);router[_0xb527('0xf')]('/',auth[_0xb527('0xb')](),controller['create']);router[_0xb527('0x10')](_0xb527('0xe'),auth[_0xb527('0xb')](),controller[_0xb527('0x11')]);router[_0xb527('0x12')](_0xb527('0xe'),auth[_0xb527('0xb')](),controller[_0xb527('0x13')]);module[_0xb527('0x14')]=router; \ No newline at end of file +var _0x34a3=['get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','./openchannelQueueReport.controller'];(function(_0x291fff,_0xdc5e25){var _0x30e35c=function(_0x51565c){while(--_0x51565c){_0x291fff['push'](_0x291fff['shift']());}};_0x30e35c(++_0xdc5e25);}(_0x34a3,0x1ae));var _0x334a=function(_0x5e58b2,_0x1b7ed4){_0x5e58b2=_0x5e58b2-0x0;var _0x4facd0=_0x34a3[_0x5e58b2];return _0x4facd0;};'use strict';var multer=require(_0x334a('0x0'));var util=require(_0x334a('0x1'));var path=require(_0x334a('0x2'));var timeout=require('connect-timeout');var express=require(_0x334a('0x3'));var router=express[_0x334a('0x4')]();var fs_extra=require(_0x334a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x334a('0x6'));router[_0x334a('0x7')]('/',auth[_0x334a('0x8')](),controller[_0x334a('0x9')]);router[_0x334a('0x7')](_0x334a('0xa'),auth[_0x334a('0x8')](),controller[_0x334a('0xb')]);router[_0x334a('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x334a('0xc')]('/',auth[_0x334a('0x8')](),controller[_0x334a('0xd')]);router[_0x334a('0xe')](_0x334a('0xf'),auth[_0x334a('0x8')](),controller[_0x334a('0x10')]);router[_0x334a('0x11')](_0x334a('0xf'),auth[_0x334a('0x8')](),controller['destroy']);module[_0x334a('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 416806e..d4713b9 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 _0x98a8=['moment','sequelize','exports','STRING','DATE'];(function(_0x518ed3,_0x1d21fc){var _0x4bbde8=function(_0x5292ff){while(--_0x5292ff){_0x518ed3['push'](_0x518ed3['shift']());}};_0x4bbde8(++_0x1d21fc);}(_0x98a8,0x12c));var _0x898a=function(_0x3e37ae,_0x44b543){_0x3e37ae=_0x3e37ae-0x0;var _0x48aaca=_0x98a8[_0x3e37ae];return _0x48aaca;};'use strict';var moment=require(_0x898a('0x0'));var Sequelize=require(_0x898a('0x1'));module[_0x898a('0x2')]={'uniqueid':{'type':Sequelize[_0x898a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x898a('0x3')]},'joinAt':{'type':Sequelize[_0x898a('0x4')]},'leaveAt':{'type':Sequelize[_0x898a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x898a('0x4')]},'reason':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0xe3e3=['exports','STRING','DATE'];(function(_0x315db5,_0x5ae123){var _0x294278=function(_0x4008a3){while(--_0x4008a3){_0x315db5['push'](_0x315db5['shift']());}};_0x294278(++_0x5ae123);}(_0xe3e3,0x9c));var _0x3e3e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe3e3[_0x618414];return _0x21c19a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3e3e('0x0')]={'uniqueid':{'type':Sequelize[_0x3e3e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3e3e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3e3e('0x2')]},'acceptAt':{'type':Sequelize[_0x3e3e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 04c0b00..795671b 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 _0x418e=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','update','body','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type'];(function(_0x400abd,_0x42ea79){var _0x3320a6=function(_0x49e13c){while(--_0x49e13c){_0x400abd['push'](_0x400abd['shift']());}};_0x3320a6(++_0x42ea79);}(_0x418e,0x1d9));var _0xe418=function(_0x18aae1,_0x4c18cf){_0x18aae1=_0x18aae1-0x0;var _0x58f4c2=_0x418e[_0x18aae1];return _0x58f4c2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe418('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe418('0x1'));var moment=require('moment');var BPromise=require(_0xe418('0x2'));var Mustache=require(_0xe418('0x3'));var util=require(_0xe418('0x4'));var path=require(_0xe418('0x5'));var sox=require(_0xe418('0x6'));var csv=require(_0xe418('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe418('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe418('0x9'));var jsforce=require(_0xe418('0xa'));var deskjs=require(_0xe418('0xb'));var toCsv=require(_0xe418('0x7'));var querystring=require(_0xe418('0xc'));var Papa=require(_0xe418('0xd'));var Redis=require('ioredis');var authService=require(_0xe418('0xe'));var qs=require(_0xe418('0xf'));var as=require(_0xe418('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe418('0x11'))('api');var utils=require(_0xe418('0x12'));var config=require(_0xe418('0x13'));var licenseUtil=require(_0xe418('0x14'));var db=require(_0xe418('0x15'))['db'];function respondWithStatusCode(_0x4023cf,_0x1dde1f){_0x1dde1f=_0x1dde1f||0xcc;return function(_0x100766){if(_0x100766){return _0x4023cf[_0xe418('0x16')](_0x1dde1f);}return _0x4023cf['status'](_0x1dde1f)[_0xe418('0x17')]();};}function respondWithResult(_0x3ab8d4,_0x486804){_0x486804=_0x486804||0xc8;return function(_0x19da13){if(_0x19da13){return _0x3ab8d4[_0xe418('0x18')](_0x486804)[_0xe418('0x19')](_0x19da13);}};}function respondWithFilteredResult(_0x1bb844,_0x3589fe){return function(_0x31b649){if(_0x31b649){var _0x4d2ea6=typeof _0x3589fe['offset']==='undefined'&&typeof _0x3589fe['limit']===_0xe418('0x1a');var _0x12b2ba=_0x31b649[_0xe418('0x1b')];var _0x42d595=_0x4d2ea6?0x0:_0x3589fe[_0xe418('0x1c')];var _0x1d96de=_0x4d2ea6?_0x31b649[_0xe418('0x1b')]:_0x3589fe[_0xe418('0x1c')]+_0x3589fe[_0xe418('0x1d')];var _0x31a32f;if(_0x1d96de>=_0x12b2ba){_0x1d96de=_0x12b2ba;_0x31a32f=0xc8;}else{_0x31a32f=0xce;}_0x1bb844[_0xe418('0x18')](_0x31a32f);return _0x1bb844[_0xe418('0x1e')](_0xe418('0x1f'),_0x42d595+'-'+_0x1d96de+'/'+_0x12b2ba)[_0xe418('0x19')](_0x31b649);}return null;};}function patchUpdates(_0x4bb247){return function(_0x3d4526){try{jsonpatch[_0xe418('0x20')](_0x3d4526,_0x4bb247,!![]);}catch(_0x2de44a){return BPromise['reject'](_0x2de44a);}return _0x3d4526[_0xe418('0x21')]();};}function saveUpdates(_0x17bd6f,_0x53bdb0){return function(_0x148104){if(_0x148104){return _0x148104['update'](_0x17bd6f)['then'](function(_0x445e72){return _0x445e72;});}return null;};}function removeEntity(_0x1b6d82,_0x53381c){return function(_0x39b510){if(_0x39b510){return _0x39b510[_0xe418('0x22')]()[_0xe418('0x23')](function(){_0x1b6d82[_0xe418('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191b09,_0xdffed1){return function(_0xa67f87){if(!_0xa67f87){_0x191b09[_0xe418('0x16')](0x194);}return _0xa67f87;};}function handleError(_0x56a0c8,_0x343dd9){_0x343dd9=_0x343dd9||0x1f4;return function(_0x14d5fe){logger[_0xe418('0x24')](_0x14d5fe[_0xe418('0x25')]);if(_0x14d5fe['name']){delete _0x14d5fe[_0xe418('0x26')];}_0x56a0c8[_0xe418('0x18')](_0x343dd9)[_0xe418('0x27')](_0x14d5fe);};}exports['index']=function(_0x45f94d,_0x5897d8){var _0xc891e4={},_0x17a1bf={},_0xc29ee1={'count':0x0,'rows':[]};var _0x194206=_[_0xe418('0x28')](db[_0xe418('0x29')][_0xe418('0x2a')],function(_0x5e3018){return{'name':_0x5e3018[_0xe418('0x2b')],'type':_0x5e3018[_0xe418('0x2c')][_0xe418('0x2d')]};});_0x17a1bf[_0xe418('0x2e')]=_[_0xe418('0x28')](_0x194206,_0xe418('0x26'));_0x17a1bf[_0xe418('0x2f')]=_[_0xe418('0x30')](_0x45f94d['query']);_0x17a1bf[_0xe418('0x31')]=_[_0xe418('0x32')](_0x17a1bf['model'],_0x17a1bf[_0xe418('0x2f')]);_0xc891e4['attributes']=_[_0xe418('0x32')](_0x17a1bf['model'],qs[_0xe418('0x33')](_0x45f94d[_0xe418('0x2f')][_0xe418('0x33')]));_0xc891e4[_0xe418('0x34')]=_0xc891e4[_0xe418('0x34')][_0xe418('0x35')]?_0xc891e4[_0xe418('0x34')]:_0x17a1bf['model'];if(!_0x45f94d[_0xe418('0x2f')][_0xe418('0x36')](_0xe418('0x37'))){_0xc891e4[_0xe418('0x1d')]=qs[_0xe418('0x1d')](_0x45f94d[_0xe418('0x2f')][_0xe418('0x1d')]);_0xc891e4[_0xe418('0x1c')]=qs['offset'](_0x45f94d[_0xe418('0x2f')][_0xe418('0x1c')]);}_0xc891e4[_0xe418('0x38')]=qs[_0xe418('0x39')](_0x45f94d[_0xe418('0x2f')][_0xe418('0x39')]);_0xc891e4[_0xe418('0x3a')]=qs['filters'](_[_0xe418('0x3b')](_0x45f94d[_0xe418('0x2f')],_0x17a1bf[_0xe418('0x31')]),_0x194206);if(_0x45f94d[_0xe418('0x2f')][_0xe418('0x3c')]){_0xc891e4[_0xe418('0x3a')]=_['merge'](_0xc891e4['where'],{'$or':_[_0xe418('0x28')](_0x194206,function(_0x32d6e6){if(_0x32d6e6[_0xe418('0x2c')]!==_0xe418('0x3d')){var _0x33d0e8={};_0x33d0e8[_0x32d6e6[_0xe418('0x26')]]={'$like':'%'+_0x45f94d[_0xe418('0x2f')][_0xe418('0x3c')]+'%'};return _0x33d0e8;}})});}_0xc891e4=_[_0xe418('0x3e')]({},_0xc891e4,_0x45f94d[_0xe418('0x3f')]);var _0x2e246c={'where':_0xc891e4['where']};return db[_0xe418('0x29')][_0xe418('0x1b')](_0x2e246c)['then'](function(_0x43bfe4){_0xc29ee1[_0xe418('0x1b')]=_0x43bfe4;if(_0x45f94d['query'][_0xe418('0x40')]){_0xc891e4[_0xe418('0x41')]=[{'all':!![]}];}return db[_0xe418('0x29')][_0xe418('0x42')](_0xc891e4);})['then'](function(_0x590fe2){_0xc29ee1['rows']=_0x590fe2;return _0xc29ee1;})['then'](respondWithFilteredResult(_0x5897d8,_0xc891e4))[_0xe418('0x43')](handleError(_0x5897d8,null));};exports[_0xe418('0x44')]=function(_0x45ca86,_0x13ff90){var _0x42d9dd={'raw':!![],'where':{'id':_0x45ca86[_0xe418('0x45')]['id']}},_0x3619f1={};_0x3619f1['model']=_[_0xe418('0x30')](db[_0xe418('0x29')][_0xe418('0x2a')]);_0x3619f1[_0xe418('0x2f')]=_[_0xe418('0x30')](_0x45ca86[_0xe418('0x2f')]);_0x3619f1['filters']=_[_0xe418('0x32')](_0x3619f1[_0xe418('0x2e')],_0x3619f1[_0xe418('0x2f')]);_0x42d9dd['attributes']=_['intersection'](_0x3619f1[_0xe418('0x2e')],qs['fields'](_0x45ca86['query'][_0xe418('0x33')]));_0x42d9dd[_0xe418('0x34')]=_0x42d9dd[_0xe418('0x34')][_0xe418('0x35')]?_0x42d9dd[_0xe418('0x34')]:_0x3619f1['model'];if(_0x45ca86[_0xe418('0x2f')][_0xe418('0x40')]){_0x42d9dd[_0xe418('0x41')]=[{'all':!![]}];}_0x42d9dd=_[_0xe418('0x3e')]({},_0x42d9dd,_0x45ca86[_0xe418('0x3f')]);return db[_0xe418('0x29')][_0xe418('0x46')](_0x42d9dd)[_0xe418('0x23')](handleEntityNotFound(_0x13ff90,null))[_0xe418('0x23')](respondWithResult(_0x13ff90,null))[_0xe418('0x43')](handleError(_0x13ff90,null));};exports['create']=function(_0x1398a1,_0x3fe492){return db['OpenchannelQueueReport'][_0xe418('0x47')](_0x1398a1['body'],{})[_0xe418('0x23')](respondWithResult(_0x3fe492,0xc9))[_0xe418('0x43')](handleError(_0x3fe492,null));};exports[_0xe418('0x48')]=function(_0x12f815,_0x32caa6){if(_0x12f815[_0xe418('0x49')]['id']){delete _0x12f815[_0xe418('0x49')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x12f815[_0xe418('0x45')]['id']}})[_0xe418('0x23')](handleEntityNotFound(_0x32caa6,null))[_0xe418('0x23')](saveUpdates(_0x12f815[_0xe418('0x49')],null))[_0xe418('0x23')](respondWithResult(_0x32caa6,null))[_0xe418('0x43')](handleError(_0x32caa6,null));};exports[_0xe418('0x22')]=function(_0x4eeaa6,_0x2aa07d){return db['OpenchannelQueueReport'][_0xe418('0x46')]({'where':{'id':_0x4eeaa6[_0xe418('0x45')]['id']}})[_0xe418('0x23')](handleEntityNotFound(_0x2aa07d,null))[_0xe418('0x23')](removeEntity(_0x2aa07d,null))[_0xe418('0x43')](handleError(_0x2aa07d,null));};exports['describe']=function(_0x3f276d,_0x2335e1){return db['OpenchannelQueueReport']['describe']()[_0xe418('0x23')](respondWithResult(_0x2335e1,null))[_0xe418('0x43')](handleError(_0x2335e1,null));}; \ No newline at end of file +var _0x54fa=['send','map','OpenchannelQueueReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x54fa,0x1a2));var _0xa54f=function(_0x2e7087,_0x112eec){_0x2e7087=_0x2e7087-0x0;var _0xb5b3a6=_0x54fa[_0x2e7087];return _0xb5b3a6;};'use strict';var emlformat=require(_0xa54f('0x0'));var rimraf=require(_0xa54f('0x1'));var zipdir=require(_0xa54f('0x2'));var jsonpatch=require(_0xa54f('0x3'));var rp=require('request-promise');var moment=require(_0xa54f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa54f('0x5'));var util=require(_0xa54f('0x6'));var path=require(_0xa54f('0x7'));var sox=require('sox');var csv=require(_0xa54f('0x8'));var ejs=require(_0xa54f('0x9'));var fs=require('fs');var fs_extra=require(_0xa54f('0xa'));var _=require('lodash');var squel=require(_0xa54f('0xb'));var crypto=require(_0xa54f('0xc'));var jsforce=require(_0xa54f('0xd'));var deskjs=require(_0xa54f('0xe'));var toCsv=require(_0xa54f('0x8'));var querystring=require(_0xa54f('0xf'));var Papa=require(_0xa54f('0x10'));var Redis=require(_0xa54f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa54f('0x12'));var as=require(_0xa54f('0x13'));var hardwareService=require(_0xa54f('0x14'));var logger=require('../../config/logger')(_0xa54f('0x15'));var utils=require(_0xa54f('0x16'));var config=require(_0xa54f('0x17'));var licenseUtil=require(_0xa54f('0x18'));var db=require(_0xa54f('0x19'))['db'];function respondWithStatusCode(_0x4aab72,_0x45efc9){_0x45efc9=_0x45efc9||0xcc;return function(_0x342202){if(_0x342202){return _0x4aab72[_0xa54f('0x1a')](_0x45efc9);}return _0x4aab72['status'](_0x45efc9)[_0xa54f('0x1b')]();};}function respondWithResult(_0xa009f5,_0xe45998){_0xe45998=_0xe45998||0xc8;return function(_0x45ef67){if(_0x45ef67){return _0xa009f5[_0xa54f('0x1c')](_0xe45998)[_0xa54f('0x1d')](_0x45ef67);}};}function respondWithFilteredResult(_0xede73a,_0x3f8ce5){return function(_0x22b6f8){if(_0x22b6f8){var _0x44bee3=typeof _0x3f8ce5[_0xa54f('0x1e')]===_0xa54f('0x1f')&&typeof _0x3f8ce5[_0xa54f('0x20')]==='undefined';var _0x14be4e=_0x22b6f8[_0xa54f('0x21')];var _0x20bc78=_0x44bee3?0x0:_0x3f8ce5[_0xa54f('0x1e')];var _0x2dad05=_0x44bee3?_0x22b6f8[_0xa54f('0x21')]:_0x3f8ce5['offset']+_0x3f8ce5[_0xa54f('0x20')];var _0x5b2d75;if(_0x2dad05>=_0x14be4e){_0x2dad05=_0x14be4e;_0x5b2d75=0xc8;}else{_0x5b2d75=0xce;}_0xede73a[_0xa54f('0x1c')](_0x5b2d75);return _0xede73a['set'](_0xa54f('0x22'),_0x20bc78+'-'+_0x2dad05+'/'+_0x14be4e)['json'](_0x22b6f8);}return null;};}function patchUpdates(_0x20a74c){return function(_0xdacc2d){try{jsonpatch[_0xa54f('0x23')](_0xdacc2d,_0x20a74c,!![]);}catch(_0xc709aa){return BPromise[_0xa54f('0x24')](_0xc709aa);}return _0xdacc2d[_0xa54f('0x25')]();};}function saveUpdates(_0x578b3f,_0x48729a){return function(_0xb5017){if(_0xb5017){return _0xb5017[_0xa54f('0x26')](_0x578b3f)[_0xa54f('0x27')](function(_0x321f66){return _0x321f66;});}return null;};}function removeEntity(_0x5e4f7d,_0x4b18a5){return function(_0x3a9b01){if(_0x3a9b01){return _0x3a9b01[_0xa54f('0x28')]()[_0xa54f('0x27')](function(){_0x5e4f7d[_0xa54f('0x1c')](0xcc)[_0xa54f('0x1b')]();});}};}function handleEntityNotFound(_0x2562f1,_0x3f2b2d){return function(_0x1fb2d6){if(!_0x1fb2d6){_0x2562f1['sendStatus'](0x194);}return _0x1fb2d6;};}function handleError(_0x3f497c,_0xce9b5c){_0xce9b5c=_0xce9b5c||0x1f4;return function(_0x437ff8){logger[_0xa54f('0x29')](_0x437ff8[_0xa54f('0x2a')]);if(_0x437ff8[_0xa54f('0x2b')]){delete _0x437ff8[_0xa54f('0x2b')];}_0x3f497c[_0xa54f('0x1c')](_0xce9b5c)[_0xa54f('0x2c')](_0x437ff8);};}exports['index']=function(_0xdf5fdc,_0x2d74d8){var _0x41bf9a={},_0x3aea58={},_0xae552a={'count':0x0,'rows':[]};var _0x3374df=_[_0xa54f('0x2d')](db[_0xa54f('0x2e')]['rawAttributes'],function(_0x3bb638){return{'name':_0x3bb638[_0xa54f('0x2f')],'type':_0x3bb638['type'][_0xa54f('0x30')]};});_0x3aea58[_0xa54f('0x31')]=_[_0xa54f('0x2d')](_0x3374df,_0xa54f('0x2b'));_0x3aea58[_0xa54f('0x32')]=_['keys'](_0xdf5fdc[_0xa54f('0x32')]);_0x3aea58[_0xa54f('0x33')]=_[_0xa54f('0x34')](_0x3aea58[_0xa54f('0x31')],_0x3aea58[_0xa54f('0x32')]);_0x41bf9a[_0xa54f('0x35')]=_[_0xa54f('0x34')](_0x3aea58['model'],qs[_0xa54f('0x36')](_0xdf5fdc[_0xa54f('0x32')]['fields']));_0x41bf9a[_0xa54f('0x35')]=_0x41bf9a['attributes'][_0xa54f('0x37')]?_0x41bf9a[_0xa54f('0x35')]:_0x3aea58[_0xa54f('0x31')];if(!_0xdf5fdc['query'][_0xa54f('0x38')]('nolimit')){_0x41bf9a[_0xa54f('0x20')]=qs['limit'](_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x20')]);_0x41bf9a[_0xa54f('0x1e')]=qs[_0xa54f('0x1e')](_0xdf5fdc['query'][_0xa54f('0x1e')]);}_0x41bf9a[_0xa54f('0x39')]=qs[_0xa54f('0x3a')](_0xdf5fdc[_0xa54f('0x32')]['sort']);_0x41bf9a[_0xa54f('0x3b')]=qs[_0xa54f('0x33')](_[_0xa54f('0x3c')](_0xdf5fdc[_0xa54f('0x32')],_0x3aea58['filters']),_0x3374df);if(_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x3d')]){_0x41bf9a['where']=_[_0xa54f('0x3e')](_0x41bf9a[_0xa54f('0x3b')],{'$or':_[_0xa54f('0x2d')](_0x3374df,function(_0x986fa8){if(_0x986fa8['type']!==_0xa54f('0x3f')){var _0x2a5246={};_0x2a5246[_0x986fa8['name']]={'$like':'%'+_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x3d')]+'%'};return _0x2a5246;}})});}_0x41bf9a=_[_0xa54f('0x3e')]({},_0x41bf9a,_0xdf5fdc[_0xa54f('0x40')]);var _0x1569aa={'where':_0x41bf9a[_0xa54f('0x3b')]};return db[_0xa54f('0x2e')][_0xa54f('0x21')](_0x1569aa)['then'](function(_0x299050){_0xae552a['count']=_0x299050;if(_0xdf5fdc[_0xa54f('0x32')][_0xa54f('0x41')]){_0x41bf9a[_0xa54f('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xa54f('0x43')](_0x41bf9a);})[_0xa54f('0x27')](function(_0x2e0b2e){_0xae552a[_0xa54f('0x44')]=_0x2e0b2e;return _0xae552a;})[_0xa54f('0x27')](respondWithFilteredResult(_0x2d74d8,_0x41bf9a))[_0xa54f('0x45')](handleError(_0x2d74d8,null));};exports[_0xa54f('0x46')]=function(_0x529450,_0xc5fcbc){var _0x3cc5d5={'raw':!![],'where':{'id':_0x529450['params']['id']}},_0x56b0d0={};_0x56b0d0[_0xa54f('0x31')]=_[_0xa54f('0x47')](db[_0xa54f('0x2e')]['rawAttributes']);_0x56b0d0[_0xa54f('0x32')]=_[_0xa54f('0x47')](_0x529450['query']);_0x56b0d0['filters']=_[_0xa54f('0x34')](_0x56b0d0[_0xa54f('0x31')],_0x56b0d0[_0xa54f('0x32')]);_0x3cc5d5['attributes']=_['intersection'](_0x56b0d0[_0xa54f('0x31')],qs['fields'](_0x529450['query']['fields']));_0x3cc5d5[_0xa54f('0x35')]=_0x3cc5d5[_0xa54f('0x35')][_0xa54f('0x37')]?_0x3cc5d5[_0xa54f('0x35')]:_0x56b0d0[_0xa54f('0x31')];if(_0x529450[_0xa54f('0x32')][_0xa54f('0x41')]){_0x3cc5d5[_0xa54f('0x42')]=[{'all':!![]}];}_0x3cc5d5=_[_0xa54f('0x3e')]({},_0x3cc5d5,_0x529450[_0xa54f('0x40')]);return db['OpenchannelQueueReport'][_0xa54f('0x48')](_0x3cc5d5)[_0xa54f('0x27')](handleEntityNotFound(_0xc5fcbc,null))[_0xa54f('0x27')](respondWithResult(_0xc5fcbc,null))['catch'](handleError(_0xc5fcbc,null));};exports[_0xa54f('0x49')]=function(_0x3604e6,_0x46a4f6){return db[_0xa54f('0x2e')][_0xa54f('0x49')](_0x3604e6[_0xa54f('0x4a')],{})[_0xa54f('0x27')](respondWithResult(_0x46a4f6,0xc9))[_0xa54f('0x45')](handleError(_0x46a4f6,null));};exports[_0xa54f('0x26')]=function(_0x5aed94,_0x33d191){if(_0x5aed94[_0xa54f('0x4a')]['id']){delete _0x5aed94[_0xa54f('0x4a')]['id'];}return db[_0xa54f('0x2e')][_0xa54f('0x48')]({'where':{'id':_0x5aed94['params']['id']}})[_0xa54f('0x27')](handleEntityNotFound(_0x33d191,null))['then'](saveUpdates(_0x5aed94[_0xa54f('0x4a')],null))[_0xa54f('0x27')](respondWithResult(_0x33d191,null))['catch'](handleError(_0x33d191,null));};exports[_0xa54f('0x28')]=function(_0x5f5293,_0x11be6b){return db[_0xa54f('0x2e')]['find']({'where':{'id':_0x5f5293[_0xa54f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11be6b,null))['then'](removeEntity(_0x11be6b,null))[_0xa54f('0x45')](handleError(_0x11be6b,null));};exports['describe']=function(_0x3a1ab4,_0x5dee6b){return db['OpenchannelQueueReport'][_0xa54f('0x4c')]()[_0xa54f('0x27')](respondWithResult(_0x5dee6b,null))['catch'](handleError(_0x5dee6b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 5129772..69b4f5b 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x4807ee,_0x4b09e8){var _0x1fd9ba=function(_0x1c1e3a){while(--_0x1c1e3a){_0x4807ee['push'](_0x4807ee['shift']());}};_0x1fd9ba(++_0x4b09e8);}(_0x7a54,0x106));var _0x47a5=function(_0xdee62c,_0x185f6e){_0xdee62c=_0xdee62c-0x0;var _0x4d854e=_0x7a54[_0xdee62c];return _0x4d854e;};'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':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x5fc3[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 60bb750..2c211d9 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 _0x93e9=['UpdateOpenchannelQueueReport','update','where','attributes','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw'];(function(_0x437843,_0xb94566){var _0x2db19b=function(_0x27b396){while(--_0x27b396){_0x437843['push'](_0x437843['shift']());}};_0x2db19b(++_0xb94566);}(_0x93e9,0xcc));var _0x993e=function(_0x1aed95,_0x1de484){_0x1aed95=_0x1aed95-0x0;var _0x31cbda=_0x93e9[_0x1aed95];return _0x31cbda;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2366d9,_0x12ac94,_0x1aef74){return new BPromise(function(_0x53d0ce,_0x4701d3){return client[_0x993e('0xc')](_0x2366d9,_0x1aef74)[_0x993e('0xd')](function(_0x280291){logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));logger['debug'](_0x993e('0x11'),_0x12ac94,_0x993e('0x10'),JSON['stringify'](_0x280291));if(_0x280291['error']){if(_0x280291[_0x993e('0x12')]['code']===0x1f4){logger[_0x993e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12ac94,_0x280291['error'][_0x993e('0x13')]);return _0x4701d3(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}logger[_0x993e('0x12')](_0x993e('0xf'),_0x12ac94,_0x280291[_0x993e('0x12')][_0x993e('0x13')]);return _0x53d0ce(_0x280291[_0x993e('0x12')][_0x993e('0x13')]);}else{logger[_0x993e('0xe')](_0x993e('0xf'),_0x12ac94,_0x993e('0x10'));_0x53d0ce(_0x280291[_0x993e('0x14')][_0x993e('0x13')]);}})[_0x993e('0x15')](function(_0x454475){logger[_0x993e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12ac94,_0x454475);_0x4701d3(_0x454475);});});}exports[_0x993e('0x16')]=function(_0x1acd21){var _0x3cc2b9=this;return new Promise(function(_0x3d6109,_0xfc2cbb){return db[_0x993e('0x17')]['create'](_0x1acd21[_0x993e('0x18')],{'raw':_0x1acd21[_0x993e('0x19')]?_0x1acd21[_0x993e('0x19')][_0x993e('0x1a')]===undefined?!![]:![]:!![]})[_0x993e('0xd')](function(_0x425ab4){logger[_0x993e('0xe')](_0x993e('0x16'),_0x1acd21);logger['debug'](_0x993e('0x16'),_0x1acd21,JSON['stringify'](_0x425ab4));_0x3d6109(_0x425ab4);})[_0x993e('0x15')](function(_0x37ff57){logger[_0x993e('0x12')]('CreateOpenchannelQueueReport',_0x37ff57[_0x993e('0x13')],_0x1acd21);_0xfc2cbb(_0x3cc2b9[_0x993e('0x12')](0x1f4,_0x37ff57[_0x993e('0x13')]));});});};exports[_0x993e('0x1b')]=function(_0x3b45ef){var _0x328d22=this;return new Promise(function(_0xa1c83e,_0x3ad96f){return db[_0x993e('0x17')][_0x993e('0x1c')](_0x3b45ef[_0x993e('0x18')],{'raw':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef['options'][_0x993e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef['options'][_0x993e('0x1d')]||null:null,'attributes':_0x3b45ef['options']?_0x3b45ef[_0x993e('0x19')][_0x993e('0x1e')]||null:null,'limit':_0x3b45ef[_0x993e('0x19')]?_0x3b45ef[_0x993e('0x19')]['limit']||null:null})['then'](function(_0x32e332){logger[_0x993e('0xe')]('UpdateOpenchannelQueueReport',_0x3b45ef);logger[_0x993e('0x1f')](_0x993e('0x1b'),_0x3b45ef,JSON[_0x993e('0x20')](_0x32e332));_0xa1c83e(_0x32e332);})['catch'](function(_0x2495b7){logger[_0x993e('0x12')](_0x993e('0x1b'),_0x2495b7[_0x993e('0x13')],_0x3b45ef);_0x3ad96f(_0x328d22[_0x993e('0x12')](0x1f4,_0x2495b7['message']));});});}; \ No newline at end of file +var _0x7916=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','moment','bluebird','ioredis'];(function(_0xadc03d,_0x4164f6){var _0x30b870=function(_0x27430e){while(--_0x27430e){_0xadc03d['push'](_0xadc03d['shift']());}};_0x30b870(++_0x4164f6);}(_0x7916,0x128));var _0x6791=function(_0x2f92d1,_0x4e6aa2){_0x2f92d1=_0x2f92d1-0x0;var _0x2b0c0d=_0x7916[_0x2f92d1];return _0x2b0c0d;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateOpenchannelQueueReport',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x53bb44){var _0x4b23bc=this;return new Promise(function(_0x372dae,_0x502043){return db[_0x6791('0x16')]['update'](_0x53bb44['body'],{'raw':_0x53bb44['options']?_0x53bb44[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bb44[_0x6791('0x19')]?_0x53bb44['options'][_0x6791('0x1b')]||null:null,'attributes':_0x53bb44[_0x6791('0x19')]?_0x53bb44['options'][_0x6791('0x1c')]||null:null,'limit':_0x53bb44['options']?_0x53bb44[_0x6791('0x19')]['limit']||null:null})['then'](function(_0x270a1d){logger['info'](_0x6791('0x1d'),_0x53bb44);logger[_0x6791('0xd')]('UpdateOpenchannelQueueReport',_0x53bb44,JSON[_0x6791('0xe')](_0x270a1d));_0x372dae(_0x270a1d);})[_0x6791('0x14')](function(_0x234c5e){logger[_0x6791('0xf')]('UpdateOpenchannelQueueReport',_0x234c5e['message'],_0x53bb44);_0x502043(_0x4b23bc[_0x6791('0xf')](0x1f4,_0x234c5e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 405900e..b5c6d83 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 _0x85fe=['/describe','describe','/:id','show','post','put','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x85fe,0xb2));var _0xe85f=function(_0x5ae33c,_0x2e2071){_0x5ae33c=_0x5ae33c-0x0;var _0x4f4021=_0x85fe[_0x5ae33c];return _0x4f4021;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe85f('0x0'));var timeout=require(_0xe85f('0x1'));var express=require('express');var router=express[_0xe85f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe85f('0x3'));var config=require(_0xe85f('0x4'));var controller=require(_0xe85f('0x5'));router['get']('/',auth[_0xe85f('0x6')](),controller[_0xe85f('0x7')]);router[_0xe85f('0x8')](_0xe85f('0x9'),auth[_0xe85f('0x6')](),controller[_0xe85f('0xa')]);router[_0xe85f('0x8')](_0xe85f('0xb'),auth[_0xe85f('0x6')](),controller[_0xe85f('0xc')]);router[_0xe85f('0xd')]('/',auth[_0xe85f('0x6')](),controller['create']);router[_0xe85f('0xe')](_0xe85f('0xb'),auth[_0xe85f('0x6')](),controller['update']);router['delete'](_0xe85f('0xb'),auth[_0xe85f('0x6')](),controller[_0xe85f('0xf')]);module[_0xe85f('0x10')]=router; \ No newline at end of file +var _0x429e=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update'];(function(_0x36210e,_0x9a09b7){var _0xc07bc7=function(_0x1377f6){while(--_0x1377f6){_0x36210e['push'](_0x36210e['shift']());}};_0xc07bc7(++_0x9a09b7);}(_0x429e,0x17e));var _0xe429=function(_0x43d605,_0x51a25d){_0x43d605=_0x43d605-0x0;var _0xce65e0=_0x429e[_0x43d605];return _0xce65e0;};'use strict';var multer=require(_0xe429('0x0'));var util=require(_0xe429('0x1'));var path=require(_0xe429('0x2'));var timeout=require(_0xe429('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe429('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe429('0x5'));var config=require(_0xe429('0x6'));var controller=require(_0xe429('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe429('0x8')]);router[_0xe429('0x9')](_0xe429('0xa'),auth[_0xe429('0xb')](),controller[_0xe429('0xc')]);router[_0xe429('0x9')](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0xe')]);router[_0xe429('0xf')]('/',auth[_0xe429('0xb')](),controller[_0xe429('0x10')]);router['put'](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0x11')]);router['delete'](_0xe429('0xd'),auth[_0xe429('0xb')](),controller[_0xe429('0x12')]);module[_0xe429('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e4afa34..9c3e922 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2aeffd,_0x5e0ce5){var _0x5ae8bb=function(_0x1b7648){while(--_0x1b7648){_0x2aeffd['push'](_0x2aeffd['shift']());}};_0x5ae8bb(++_0x5e0ce5);}(_0x34e8,0x12c));var _0x834e=function(_0x43dc02,_0x50c8c0){_0x43dc02=_0x43dc02-0x0;var _0x2d9d52=_0x34e8[_0x43dc02];return _0x2d9d52;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 25b457d..c63a3a6 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 _0x0c6b=['includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xd94585,_0x33dc8d){var _0x2a0422=function(_0xfd07){while(--_0xfd07){_0xd94585['push'](_0xd94585['shift']());}};_0x2a0422(++_0x33dc8d);}(_0x0c6b,0x190));var _0xb0c6=function(_0x3ff710,_0x270f1f){_0x3ff710=_0x3ff710-0x0;var _0x5bd3bd=_0x0c6b[_0x3ff710];return _0x5bd3bd;};'use strict';var emlformat=require(_0xb0c6('0x0'));var rimraf=require(_0xb0c6('0x1'));var zipdir=require(_0xb0c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb0c6('0x3'));var BPromise=require(_0xb0c6('0x4'));var Mustache=require('mustache');var util=require(_0xb0c6('0x5'));var path=require(_0xb0c6('0x6'));var sox=require(_0xb0c6('0x7'));var csv=require(_0xb0c6('0x8'));var ejs=require(_0xb0c6('0x9'));var fs=require('fs');var fs_extra=require(_0xb0c6('0xa'));var _=require('lodash');var squel=require(_0xb0c6('0xb'));var crypto=require(_0xb0c6('0xc'));var jsforce=require(_0xb0c6('0xd'));var deskjs=require(_0xb0c6('0xe'));var toCsv=require(_0xb0c6('0x8'));var querystring=require(_0xb0c6('0xf'));var Papa=require(_0xb0c6('0x10'));var Redis=require(_0xb0c6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb0c6('0x12'));var as=require(_0xb0c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0c6('0x14'))('api');var utils=require(_0xb0c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb0c6('0x16'));var db=require(_0xb0c6('0x17'))['db'];function respondWithStatusCode(_0xfe3524,_0x2eb42e){_0x2eb42e=_0x2eb42e||0xcc;return function(_0x49ede1){if(_0x49ede1){return _0xfe3524[_0xb0c6('0x18')](_0x2eb42e);}return _0xfe3524[_0xb0c6('0x19')](_0x2eb42e)[_0xb0c6('0x1a')]();};}function respondWithResult(_0x217a07,_0x2e32a3){_0x2e32a3=_0x2e32a3||0xc8;return function(_0xee5d48){if(_0xee5d48){return _0x217a07[_0xb0c6('0x19')](_0x2e32a3)[_0xb0c6('0x1b')](_0xee5d48);}};}function respondWithFilteredResult(_0x3c1bda,_0x2b4107){return function(_0x1bb573){if(_0x1bb573){var _0x113e06=typeof _0x2b4107[_0xb0c6('0x1c')]==='undefined'&&typeof _0x2b4107[_0xb0c6('0x1d')]===_0xb0c6('0x1e');var _0x5324fc=_0x1bb573[_0xb0c6('0x1f')];var _0x2a10b6=_0x113e06?0x0:_0x2b4107[_0xb0c6('0x1c')];var _0xa8c716=_0x113e06?_0x1bb573[_0xb0c6('0x1f')]:_0x2b4107[_0xb0c6('0x1c')]+_0x2b4107[_0xb0c6('0x1d')];var _0x252747;if(_0xa8c716>=_0x5324fc){_0xa8c716=_0x5324fc;_0x252747=0xc8;}else{_0x252747=0xce;}_0x3c1bda[_0xb0c6('0x19')](_0x252747);return _0x3c1bda[_0xb0c6('0x20')](_0xb0c6('0x21'),_0x2a10b6+'-'+_0xa8c716+'/'+_0x5324fc)['json'](_0x1bb573);}return null;};}function patchUpdates(_0x5b63e8){return function(_0x11e44a){try{jsonpatch[_0xb0c6('0x22')](_0x11e44a,_0x5b63e8,!![]);}catch(_0x5da68c){return BPromise[_0xb0c6('0x23')](_0x5da68c);}return _0x11e44a['save']();};}function saveUpdates(_0x3ed6e9,_0x480e75){return function(_0x28e9ac){if(_0x28e9ac){return _0x28e9ac[_0xb0c6('0x24')](_0x3ed6e9)[_0xb0c6('0x25')](function(_0x47eec7){return _0x47eec7;});}return null;};}function removeEntity(_0x406974,_0x2c11da){return function(_0x496c49){if(_0x496c49){return _0x496c49[_0xb0c6('0x26')]()[_0xb0c6('0x25')](function(){_0x406974['status'](0xcc)[_0xb0c6('0x1a')]();});}};}function handleEntityNotFound(_0x229f32,_0x2b7f18){return function(_0x54b9b3){if(!_0x54b9b3){_0x229f32[_0xb0c6('0x18')](0x194);}return _0x54b9b3;};}function handleError(_0xbaa421,_0x231951){_0x231951=_0x231951||0x1f4;return function(_0x2bf4f4){logger[_0xb0c6('0x27')](_0x2bf4f4[_0xb0c6('0x28')]);if(_0x2bf4f4[_0xb0c6('0x29')]){delete _0x2bf4f4[_0xb0c6('0x29')];}_0xbaa421['status'](_0x231951)[_0xb0c6('0x2a')](_0x2bf4f4);};}exports[_0xb0c6('0x2b')]=function(_0x4ce535,_0x290ed1){var _0x284bcd={},_0x13c6c7={},_0x1fc225={'count':0x0,'rows':[]};var _0x2f7409=_[_0xb0c6('0x2c')](db[_0xb0c6('0x2d')][_0xb0c6('0x2e')],function(_0xd243c6){return{'name':_0xd243c6[_0xb0c6('0x2f')],'type':_0xd243c6[_0xb0c6('0x30')][_0xb0c6('0x31')]};});_0x13c6c7[_0xb0c6('0x32')]=_[_0xb0c6('0x2c')](_0x2f7409,_0xb0c6('0x29'));_0x13c6c7[_0xb0c6('0x33')]=_[_0xb0c6('0x34')](_0x4ce535[_0xb0c6('0x33')]);_0x13c6c7[_0xb0c6('0x35')]=_[_0xb0c6('0x36')](_0x13c6c7['model'],_0x13c6c7[_0xb0c6('0x33')]);_0x284bcd['attributes']=_[_0xb0c6('0x36')](_0x13c6c7[_0xb0c6('0x32')],qs[_0xb0c6('0x37')](_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x37')]));_0x284bcd['attributes']=_0x284bcd[_0xb0c6('0x38')][_0xb0c6('0x39')]?_0x284bcd[_0xb0c6('0x38')]:_0x13c6c7['model'];if(!_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x3a')](_0xb0c6('0x3b'))){_0x284bcd[_0xb0c6('0x1d')]=qs[_0xb0c6('0x1d')](_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x1d')]);_0x284bcd[_0xb0c6('0x1c')]=qs['offset'](_0x4ce535[_0xb0c6('0x33')]['offset']);}_0x284bcd[_0xb0c6('0x3c')]=qs['sort'](_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x3d')]);_0x284bcd[_0xb0c6('0x3e')]=qs[_0xb0c6('0x35')](_[_0xb0c6('0x3f')](_0x4ce535[_0xb0c6('0x33')],_0x13c6c7[_0xb0c6('0x35')]),_0x2f7409);if(_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x40')]){_0x284bcd[_0xb0c6('0x3e')]=_[_0xb0c6('0x41')](_0x284bcd[_0xb0c6('0x3e')],{'$or':_[_0xb0c6('0x2c')](_0x2f7409,function(_0x5d5908){if(_0x5d5908[_0xb0c6('0x30')]!==_0xb0c6('0x42')){var _0x2301ed={};_0x2301ed[_0x5d5908[_0xb0c6('0x29')]]={'$like':'%'+_0x4ce535[_0xb0c6('0x33')][_0xb0c6('0x40')]+'%'};return _0x2301ed;}})});}_0x284bcd=_['merge']({},_0x284bcd,_0x4ce535[_0xb0c6('0x43')]);var _0x362e72={'where':_0x284bcd[_0xb0c6('0x3e')]};return db[_0xb0c6('0x2d')][_0xb0c6('0x1f')](_0x362e72)[_0xb0c6('0x25')](function(_0x5a01a1){_0x1fc225['count']=_0x5a01a1;if(_0x4ce535['query'][_0xb0c6('0x44')]){_0x284bcd['include']=[{'all':!![]}];}return db[_0xb0c6('0x2d')][_0xb0c6('0x45')](_0x284bcd);})[_0xb0c6('0x25')](function(_0x3125cf){_0x1fc225[_0xb0c6('0x46')]=_0x3125cf;return _0x1fc225;})[_0xb0c6('0x25')](respondWithFilteredResult(_0x290ed1,_0x284bcd))[_0xb0c6('0x47')](handleError(_0x290ed1,null));};exports[_0xb0c6('0x48')]=function(_0x56ba38,_0x210c53){var _0xf9917e={'raw':!![],'where':{'id':_0x56ba38[_0xb0c6('0x49')]['id']}},_0x28d29b={};_0x28d29b[_0xb0c6('0x32')]=_[_0xb0c6('0x34')](db['OpenchannelTransferReport'][_0xb0c6('0x2e')]);_0x28d29b['query']=_[_0xb0c6('0x34')](_0x56ba38[_0xb0c6('0x33')]);_0x28d29b[_0xb0c6('0x35')]=_[_0xb0c6('0x36')](_0x28d29b['model'],_0x28d29b['query']);_0xf9917e[_0xb0c6('0x38')]=_[_0xb0c6('0x36')](_0x28d29b[_0xb0c6('0x32')],qs['fields'](_0x56ba38['query']['fields']));_0xf9917e[_0xb0c6('0x38')]=_0xf9917e[_0xb0c6('0x38')]['length']?_0xf9917e['attributes']:_0x28d29b[_0xb0c6('0x32')];if(_0x56ba38['query'][_0xb0c6('0x44')]){_0xf9917e['include']=[{'all':!![]}];}_0xf9917e=_[_0xb0c6('0x41')]({},_0xf9917e,_0x56ba38[_0xb0c6('0x43')]);return db[_0xb0c6('0x2d')][_0xb0c6('0x4a')](_0xf9917e)[_0xb0c6('0x25')](handleEntityNotFound(_0x210c53,null))['then'](respondWithResult(_0x210c53,null))['catch'](handleError(_0x210c53,null));};exports[_0xb0c6('0x4b')]=function(_0x211b26,_0x4d3a71){return db[_0xb0c6('0x2d')][_0xb0c6('0x4b')](_0x211b26[_0xb0c6('0x4c')],{})['then'](respondWithResult(_0x4d3a71,0xc9))['catch'](handleError(_0x4d3a71,null));};exports['update']=function(_0x3e9afe,_0x4e8025){if(_0x3e9afe[_0xb0c6('0x4c')]['id']){delete _0x3e9afe[_0xb0c6('0x4c')]['id'];}return db['OpenchannelTransferReport'][_0xb0c6('0x4a')]({'where':{'id':_0x3e9afe['params']['id']}})[_0xb0c6('0x25')](handleEntityNotFound(_0x4e8025,null))[_0xb0c6('0x25')](saveUpdates(_0x3e9afe[_0xb0c6('0x4c')],null))[_0xb0c6('0x25')](respondWithResult(_0x4e8025,null))[_0xb0c6('0x47')](handleError(_0x4e8025,null));};exports[_0xb0c6('0x26')]=function(_0x1aea73,_0x51b662){return db[_0xb0c6('0x2d')][_0xb0c6('0x4a')]({'where':{'id':_0x1aea73[_0xb0c6('0x49')]['id']}})[_0xb0c6('0x25')](handleEntityNotFound(_0x51b662,null))[_0xb0c6('0x25')](removeEntity(_0x51b662,null))[_0xb0c6('0x47')](handleError(_0x51b662,null));};exports[_0xb0c6('0x4d')]=function(_0x2675ee,_0x531098){return db[_0xb0c6('0x2d')][_0xb0c6('0x4d')]()[_0xb0c6('0x25')](respondWithResult(_0x531098,null))['catch'](handleError(_0x531098,null));}; \ No newline at end of file +var _0x1989=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x493364,_0x1b5060){var _0x5bbd22=function(_0x28a25c){while(--_0x28a25c){_0x493364['push'](_0x493364['shift']());}};_0x5bbd22(++_0x1b5060);}(_0x1989,0x119));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9198('0x0'));var rimraf=require(_0x9198('0x1'));var zipdir=require(_0x9198('0x2'));var jsonpatch=require(_0x9198('0x3'));var rp=require(_0x9198('0x4'));var moment=require(_0x9198('0x5'));var BPromise=require(_0x9198('0x6'));var Mustache=require('mustache');var util=require(_0x9198('0x7'));var path=require('path');var sox=require(_0x9198('0x8'));var csv=require(_0x9198('0x9'));var ejs=require(_0x9198('0xa'));var fs=require('fs');var fs_extra=require(_0x9198('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9198('0xc'));var jsforce=require(_0x9198('0xd'));var deskjs=require(_0x9198('0xe'));var toCsv=require(_0x9198('0x9'));var querystring=require(_0x9198('0xf'));var Papa=require(_0x9198('0x10'));var Redis=require(_0x9198('0x11'));var authService=require(_0x9198('0x12'));var qs=require(_0x9198('0x13'));var as=require(_0x9198('0x14'));var hardwareService=require(_0x9198('0x15'));var logger=require(_0x9198('0x16'))(_0x9198('0x17'));var utils=require('../../config/utils');var config=require(_0x9198('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38e2f4,_0x3d1b34){_0x3d1b34=_0x3d1b34||0xcc;return function(_0x2f131f){if(_0x2f131f){return _0x38e2f4[_0x9198('0x19')](_0x3d1b34);}return _0x38e2f4[_0x9198('0x1a')](_0x3d1b34)[_0x9198('0x1b')]();};}function respondWithResult(_0x4e43b9,_0xd22e2a){_0xd22e2a=_0xd22e2a||0xc8;return function(_0x18da1f){if(_0x18da1f){return _0x4e43b9[_0x9198('0x1a')](_0xd22e2a)['json'](_0x18da1f);}};}function respondWithFilteredResult(_0x3454c9,_0x5dbd76){return function(_0x297152){if(_0x297152){var _0x1a3f52=typeof _0x5dbd76['offset']==='undefined'&&typeof _0x5dbd76[_0x9198('0x1c')]===_0x9198('0x1d');var _0x190942=_0x297152[_0x9198('0x1e')];var _0x1461b1=_0x1a3f52?0x0:_0x5dbd76[_0x9198('0x1f')];var _0x46baf8=_0x1a3f52?_0x297152[_0x9198('0x1e')]:_0x5dbd76[_0x9198('0x1f')]+_0x5dbd76[_0x9198('0x1c')];var _0x1bacc1;if(_0x46baf8>=_0x190942){_0x46baf8=_0x190942;_0x1bacc1=0xc8;}else{_0x1bacc1=0xce;}_0x3454c9[_0x9198('0x1a')](_0x1bacc1);return _0x3454c9[_0x9198('0x20')](_0x9198('0x21'),_0x1461b1+'-'+_0x46baf8+'/'+_0x190942)[_0x9198('0x22')](_0x297152);}return null;};}function patchUpdates(_0x4ef7b1){return function(_0x24efd1){try{jsonpatch['apply'](_0x24efd1,_0x4ef7b1,!![]);}catch(_0x51c19a){return BPromise['reject'](_0x51c19a);}return _0x24efd1[_0x9198('0x23')]();};}function saveUpdates(_0x319e55,_0x25f7c2){return function(_0x16d699){if(_0x16d699){return _0x16d699['update'](_0x319e55)[_0x9198('0x24')](function(_0xb66360){return _0xb66360;});}return null;};}function removeEntity(_0xb8e2a5,_0x215e9f){return function(_0x4b90bf){if(_0x4b90bf){return _0x4b90bf[_0x9198('0x25')]()[_0x9198('0x24')](function(){_0xb8e2a5['status'](0xcc)[_0x9198('0x1b')]();});}};}function handleEntityNotFound(_0x380f46,_0x3cb289){return function(_0x24b5f4){if(!_0x24b5f4){_0x380f46[_0x9198('0x19')](0x194);}return _0x24b5f4;};}function handleError(_0x592973,_0x4a3109){_0x4a3109=_0x4a3109||0x1f4;return function(_0x59629c){logger[_0x9198('0x26')](_0x59629c[_0x9198('0x27')]);if(_0x59629c[_0x9198('0x28')]){delete _0x59629c[_0x9198('0x28')];}_0x592973[_0x9198('0x1a')](_0x4a3109)[_0x9198('0x29')](_0x59629c);};}exports[_0x9198('0x2a')]=function(_0x412252,_0x4c601e){var _0x3b8656={},_0x59aeab={},_0x5d8b4f={'count':0x0,'rows':[]};var _0x123b22=_[_0x9198('0x2b')](db[_0x9198('0x2c')]['rawAttributes'],function(_0x504405){return{'name':_0x504405[_0x9198('0x2d')],'type':_0x504405[_0x9198('0x2e')][_0x9198('0x2f')]};});_0x59aeab[_0x9198('0x30')]=_['map'](_0x123b22,_0x9198('0x28'));_0x59aeab[_0x9198('0x31')]=_[_0x9198('0x32')](_0x412252[_0x9198('0x31')]);_0x59aeab['filters']=_['intersection'](_0x59aeab[_0x9198('0x30')],_0x59aeab[_0x9198('0x31')]);_0x3b8656[_0x9198('0x33')]=_[_0x9198('0x34')](_0x59aeab['model'],qs['fields'](_0x412252[_0x9198('0x31')][_0x9198('0x35')]));_0x3b8656['attributes']=_0x3b8656[_0x9198('0x33')][_0x9198('0x36')]?_0x3b8656[_0x9198('0x33')]:_0x59aeab['model'];if(!_0x412252[_0x9198('0x31')][_0x9198('0x37')]('nolimit')){_0x3b8656[_0x9198('0x1c')]=qs[_0x9198('0x1c')](_0x412252[_0x9198('0x31')]['limit']);_0x3b8656[_0x9198('0x1f')]=qs[_0x9198('0x1f')](_0x412252['query'][_0x9198('0x1f')]);}_0x3b8656['order']=qs[_0x9198('0x38')](_0x412252[_0x9198('0x31')]['sort']);_0x3b8656[_0x9198('0x39')]=qs['filters'](_[_0x9198('0x3a')](_0x412252[_0x9198('0x31')],_0x59aeab[_0x9198('0x3b')]),_0x123b22);if(_0x412252[_0x9198('0x31')][_0x9198('0x3c')]){_0x3b8656[_0x9198('0x39')]=_['merge'](_0x3b8656[_0x9198('0x39')],{'$or':_[_0x9198('0x2b')](_0x123b22,function(_0x5e7048){if(_0x5e7048[_0x9198('0x2e')]!==_0x9198('0x3d')){var _0x5df39b={};_0x5df39b[_0x5e7048[_0x9198('0x28')]]={'$like':'%'+_0x412252[_0x9198('0x31')]['filter']+'%'};return _0x5df39b;}})});}_0x3b8656=_[_0x9198('0x3e')]({},_0x3b8656,_0x412252[_0x9198('0x3f')]);var _0x33a02d={'where':_0x3b8656[_0x9198('0x39')]};return db[_0x9198('0x2c')]['count'](_0x33a02d)[_0x9198('0x24')](function(_0x360bca){_0x5d8b4f[_0x9198('0x1e')]=_0x360bca;if(_0x412252['query']['includeAll']){_0x3b8656[_0x9198('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x3b8656);})['then'](function(_0x3b8aa8){_0x5d8b4f[_0x9198('0x41')]=_0x3b8aa8;return _0x5d8b4f;})['then'](respondWithFilteredResult(_0x4c601e,_0x3b8656))['catch'](handleError(_0x4c601e,null));};exports[_0x9198('0x42')]=function(_0x13f81e,_0x45a6df){var _0x2887cf={'raw':!![],'where':{'id':_0x13f81e[_0x9198('0x43')]['id']}},_0x1d324d={};_0x1d324d['model']=_[_0x9198('0x32')](db[_0x9198('0x2c')][_0x9198('0x44')]);_0x1d324d['query']=_[_0x9198('0x32')](_0x13f81e[_0x9198('0x31')]);_0x1d324d[_0x9198('0x3b')]=_[_0x9198('0x34')](_0x1d324d[_0x9198('0x30')],_0x1d324d[_0x9198('0x31')]);_0x2887cf['attributes']=_[_0x9198('0x34')](_0x1d324d['model'],qs[_0x9198('0x35')](_0x13f81e[_0x9198('0x31')][_0x9198('0x35')]));_0x2887cf[_0x9198('0x33')]=_0x2887cf[_0x9198('0x33')][_0x9198('0x36')]?_0x2887cf[_0x9198('0x33')]:_0x1d324d[_0x9198('0x30')];if(_0x13f81e[_0x9198('0x31')]['includeAll']){_0x2887cf[_0x9198('0x40')]=[{'all':!![]}];}_0x2887cf=_[_0x9198('0x3e')]({},_0x2887cf,_0x13f81e[_0x9198('0x3f')]);return db[_0x9198('0x2c')][_0x9198('0x45')](_0x2887cf)[_0x9198('0x24')](handleEntityNotFound(_0x45a6df,null))[_0x9198('0x24')](respondWithResult(_0x45a6df,null))['catch'](handleError(_0x45a6df,null));};exports[_0x9198('0x46')]=function(_0x4b4e3b,_0xd1562){return db[_0x9198('0x2c')][_0x9198('0x46')](_0x4b4e3b[_0x9198('0x47')],{})['then'](respondWithResult(_0xd1562,0xc9))[_0x9198('0x48')](handleError(_0xd1562,null));};exports[_0x9198('0x49')]=function(_0x4652ed,_0x4bba35){if(_0x4652ed[_0x9198('0x47')]['id']){delete _0x4652ed[_0x9198('0x47')]['id'];}return db[_0x9198('0x2c')]['find']({'where':{'id':_0x4652ed[_0x9198('0x43')]['id']}})[_0x9198('0x24')](handleEntityNotFound(_0x4bba35,null))[_0x9198('0x24')](saveUpdates(_0x4652ed[_0x9198('0x47')],null))[_0x9198('0x24')](respondWithResult(_0x4bba35,null))[_0x9198('0x48')](handleError(_0x4bba35,null));};exports[_0x9198('0x25')]=function(_0x116f5b,_0x5bcd27){return db[_0x9198('0x2c')][_0x9198('0x45')]({'where':{'id':_0x116f5b[_0x9198('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bcd27,null))[_0x9198('0x24')](removeEntity(_0x5bcd27,null))[_0x9198('0x48')](handleError(_0x5bcd27,null));};exports['describe']=function(_0x111072,_0x3b8bb7){return db[_0x9198('0x2c')]['describe']()[_0x9198('0x24')](respondWithResult(_0x3b8bb7,null))[_0x9198('0x48')](handleError(_0x3b8bb7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f7b5807..bd0be36 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 _0x20f7=['rimraf','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x425d6a,_0x508bed){var _0x5d81b9=function(_0x19f774){while(--_0x19f774){_0x425d6a['push'](_0x425d6a['shift']());}};_0x5d81b9(++_0x508bed);}(_0x20f7,0x16f));var _0x720f=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x20f7[_0x43e97d];return _0x424cd9;};'use strict';var _=require(_0x720f('0x0'));var util=require(_0x720f('0x1'));var logger=require(_0x720f('0x2'))(_0x720f('0x3'));var moment=require(_0x720f('0x4'));var BPromise=require(_0x720f('0x5'));var rp=require(_0x720f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x720f('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x2cd415,_0x1b33b2){return _0x2cd415[_0x720f('0x8')](_0x720f('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x720f('0xa'),'fields':[_0x720f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29cc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x29cc,0x1ec));var _0xc29c=function(_0x45ad2e,_0x574050){_0x45ad2e=_0x45ad2e-0x0;var _0x5dd087=_0x29cc[_0x45ad2e];return _0x5dd087;};'use strict';var _=require(_0xc29c('0x0'));var util=require(_0xc29c('0x1'));var logger=require(_0xc29c('0x2'))(_0xc29c('0x3'));var moment=require(_0xc29c('0x4'));var BPromise=require(_0xc29c('0x5'));var rp=require(_0xc29c('0x6'));var fs=require('fs');var path=require(_0xc29c('0x7'));var rimraf=require(_0xc29c('0x8'));var config=require(_0xc29c('0x9'));var attributes=require(_0xc29c('0xa'));module[_0xc29c('0xb')]=function(_0x2e2c0a,_0x37a32c){return _0x2e2c0a[_0xc29c('0xc')]('OpenchannelTransferReport',attributes,{'tableName':_0xc29c('0xd'),'paranoid':![],'indexes':[{'name':_0xc29c('0xe'),'fields':[_0xc29c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 580e7ac..a937c3c 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 _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x177f88,_0x25a0f5){var _0x583584=function(_0x5b6217){while(--_0x5b6217){_0x177f88['push'](_0x177f88['shift']());}};_0x583584(++_0x25a0f5);}(_0x2bd8,0x130));var _0x82bd=function(_0x2237b7,_0x2032cc){_0x2237b7=_0x2237b7-0x0;var _0x5a3943=_0x2bd8[_0x2237b7];return _0x5a3943;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file +var _0x78d3=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xe97b8,_0x3437b6){var _0x191ebe=function(_0x555926){while(--_0x555926){_0xe97b8['push'](_0xe97b8['shift']());}};_0x191ebe(++_0x3437b6);}(_0x78d3,0x73));var _0x378d=function(_0x48d68b,_0x231241){_0x48d68b=_0x48d68b-0x0;var _0x199ae0=_0x78d3[_0x48d68b];return _0x199ae0;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47a99f,_0x4fef30,_0x1c880e){return new BPromise(function(_0x4b3ef5,_0x14112d){return client[_0x378d('0xe')](_0x47a99f,_0x1c880e)[_0x378d('0xf')](function(_0x4698d9){logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');logger[_0x378d('0x12')](_0x378d('0x13'),_0x4fef30,_0x378d('0x14'),JSON['stringify'](_0x4698d9));if(_0x4698d9[_0x378d('0x15')]){if(_0x4698d9['error']['code']===0x1f4){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x14112d(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}logger['error'](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x4b3ef5(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}else{logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');_0x4b3ef5(_0x4698d9[_0x378d('0x17')]['message']);}})[_0x378d('0x18')](function(_0x1602f9){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x1602f9);_0x14112d(_0x1602f9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 189fd29..3d6d561 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 _0x3856=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put'];(function(_0x284d53,_0x809420){var _0xa575ed=function(_0x330e5e){while(--_0x330e5e){_0x284d53['push'](_0x284d53['shift']());}};_0xa575ed(++_0x809420);}(_0x3856,0xfb));var _0x6385=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x3856[_0x4409e7];return _0x24c751;};'use strict';var multer=require(_0x6385('0x0'));var util=require('util');var path=require(_0x6385('0x1'));var timeout=require(_0x6385('0x2'));var express=require(_0x6385('0x3'));var router=express[_0x6385('0x4')]();var fs_extra=require(_0x6385('0x5'));var auth=require(_0x6385('0x6'));var interaction=require(_0x6385('0x7'));var config=require(_0x6385('0x8'));var controller=require('./pause.controller');router[_0x6385('0x9')]('/',auth[_0x6385('0xa')](),controller['index']);router[_0x6385('0x9')](_0x6385('0xb'),auth[_0x6385('0xa')](),controller[_0x6385('0xc')]);router[_0x6385('0xd')]('/',auth[_0x6385('0xa')](),controller['create']);router[_0x6385('0xe')](_0x6385('0xb'),auth[_0x6385('0xa')](),controller[_0x6385('0xf')]);router[_0x6385('0x10')](_0x6385('0xb'),auth['isAuthenticated'](),controller[_0x6385('0x11')]);module[_0x6385('0x12')]=router; \ No newline at end of file +var _0xd763=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x3b7cde,_0x13428a){var _0x361ee4=function(_0x246c6c){while(--_0x246c6c){_0x3b7cde['push'](_0x3b7cde['shift']());}};_0x361ee4(++_0x13428a);}(_0xd763,0x17e));var _0x3d76=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd763[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3d76('0x0'));var express=require(_0x3d76('0x1'));var router=express[_0x3d76('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3d76('0x3'));var interaction=require(_0x3d76('0x4'));var config=require(_0x3d76('0x5'));var controller=require(_0x3d76('0x6'));router[_0x3d76('0x7')]('/',auth[_0x3d76('0x8')](),controller[_0x3d76('0x9')]);router[_0x3d76('0x7')](_0x3d76('0xa'),auth[_0x3d76('0x8')](),controller['show']);router['post']('/',auth[_0x3d76('0x8')](),controller['create']);router[_0x3d76('0xb')]('/:id',auth[_0x3d76('0x8')](),controller[_0x3d76('0xc')]);router[_0x3d76('0xd')](_0x3d76('0xa'),auth[_0x3d76('0x8')](),controller[_0x3d76('0xe')]);module[_0x3d76('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 dc9e2a8..686733b 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 _0x9c2f=['STRING','name','sequelize'];(function(_0x1cc040,_0x40e0d7){var _0x3cd89e=function(_0x523e80){while(--_0x523e80){_0x1cc040['push'](_0x1cc040['shift']());}};_0x3cd89e(++_0x40e0d7);}(_0x9c2f,0x11f));var _0xf9c2=function(_0x576fbd,_0x9ae60a){_0x576fbd=_0x576fbd-0x0;var _0x39b0e4=_0x9c2f[_0x576fbd];return _0x39b0e4;};'use strict';var Sequelize=require(_0xf9c2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf9c2('0x1')],'unique':_0xf9c2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf9c2('0x1')]}}; \ No newline at end of file +var _0x14f7=['STRING','name','sequelize','exports'];(function(_0x198afa,_0x18d8d8){var _0x173f1d=function(_0x12e58a){while(--_0x12e58a){_0x198afa['push'](_0x198afa['shift']());}};_0x173f1d(++_0x18d8d8);}(_0x14f7,0x1b2));var _0x714f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x14f7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x714f('0x0'));module[_0x714f('0x1')]={'name':{'type':Sequelize[_0x714f('0x2')],'unique':_0x714f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x714f('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ee74c18..79c611a 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 _0x4c06=['sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','options','find','catch','create','body','user','UserProfileSection','userProfileId','UserProfileResource','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x4c06,0x87));var _0x64c0=function(_0x22b6e5,_0x2819c8){_0x22b6e5=_0x22b6e5-0x0;var _0x1c21e5=_0x4c06[_0x22b6e5];return _0x1c21e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64c0('0x0'));var jsonpatch=require(_0x64c0('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x64c0('0x2'));var Mustache=require(_0x64c0('0x3'));var util=require('util');var path=require('path');var sox=require(_0x64c0('0x4'));var csv=require(_0x64c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64c0('0x6'));var _=require('lodash');var squel=require(_0x64c0('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x64c0('0x5'));var querystring=require(_0x64c0('0x8'));var Papa=require(_0x64c0('0x9'));var Redis=require(_0x64c0('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x64c0('0xb'));var as=require(_0x64c0('0xc'));var hardwareService=require(_0x64c0('0xd'));var logger=require(_0x64c0('0xe'))(_0x64c0('0xf'));var utils=require(_0x64c0('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19a626,_0x207d7b){_0x207d7b=_0x207d7b||0xcc;return function(_0x273229){if(_0x273229){return _0x19a626[_0x64c0('0x11')](_0x207d7b);}return _0x19a626['status'](_0x207d7b)[_0x64c0('0x12')]();};}function respondWithResult(_0x549f6a,_0x4904fc){_0x4904fc=_0x4904fc||0xc8;return function(_0x44e68d){if(_0x44e68d){return _0x549f6a[_0x64c0('0x13')](_0x4904fc)['json'](_0x44e68d);}};}function respondWithFilteredResult(_0x4aacb4,_0x3cb7a7){return function(_0x2d6c37){if(_0x2d6c37){var _0x1b5c8f=typeof _0x3cb7a7[_0x64c0('0x14')]==='undefined'&&typeof _0x3cb7a7[_0x64c0('0x15')]===_0x64c0('0x16');var _0x1efb0d=_0x2d6c37[_0x64c0('0x17')];var _0x328d1d=_0x1b5c8f?0x0:_0x3cb7a7['offset'];var _0x3400a2=_0x1b5c8f?_0x2d6c37['count']:_0x3cb7a7[_0x64c0('0x14')]+_0x3cb7a7[_0x64c0('0x15')];var _0x35d84d;if(_0x3400a2>=_0x1efb0d){_0x3400a2=_0x1efb0d;_0x35d84d=0xc8;}else{_0x35d84d=0xce;}_0x4aacb4[_0x64c0('0x13')](_0x35d84d);return _0x4aacb4[_0x64c0('0x18')](_0x64c0('0x19'),_0x328d1d+'-'+_0x3400a2+'/'+_0x1efb0d)[_0x64c0('0x1a')](_0x2d6c37);}return null;};}function patchUpdates(_0x1e2a4e){return function(_0x73f7c7){try{jsonpatch[_0x64c0('0x1b')](_0x73f7c7,_0x1e2a4e,!![]);}catch(_0x335de4){return BPromise[_0x64c0('0x1c')](_0x335de4);}return _0x73f7c7[_0x64c0('0x1d')]();};}function saveUpdates(_0x231383,_0x1ee6c8){return function(_0x43b1e9){if(_0x43b1e9){return _0x43b1e9[_0x64c0('0x1e')](_0x231383)[_0x64c0('0x1f')](function(_0x225d00){return _0x225d00;});}return null;};}function removeEntity(_0x26ccb9,_0x49f72e){return function(_0x38888b){if(_0x38888b){return _0x38888b[_0x64c0('0x20')]()[_0x64c0('0x1f')](function(){var _0x4234cc=_0x38888b[_0x64c0('0x21')]({'plain':!![]});var _0x2a028a=_0x64c0('0x22');return db['UserProfileResource'][_0x64c0('0x20')]({'where':{'type':_0x2a028a,'resourceId':_0x4234cc['id']}})['then'](function(){return _0x38888b;});})[_0x64c0('0x1f')](function(){_0x26ccb9[_0x64c0('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4456dd,_0x1b032e){return function(_0x23bcfc){if(!_0x23bcfc){_0x4456dd[_0x64c0('0x11')](0x194);}return _0x23bcfc;};}function handleError(_0x203180,_0x23ec8b){_0x23ec8b=_0x23ec8b||0x1f4;return function(_0x4db424){logger[_0x64c0('0x23')](_0x4db424[_0x64c0('0x24')]);if(_0x4db424[_0x64c0('0x25')]){delete _0x4db424[_0x64c0('0x25')];}_0x203180[_0x64c0('0x13')](_0x23ec8b)['send'](_0x4db424);};}exports[_0x64c0('0x26')]=function(_0x5b6259,_0x4fe8ab){var _0x1703ab={},_0x4042eb={},_0x158617={'count':0x0,'rows':[]};var _0x1f0ab6=_['map'](db['Pause'][_0x64c0('0x27')],function(_0x46fd47){return{'name':_0x46fd47[_0x64c0('0x28')],'type':_0x46fd47[_0x64c0('0x29')][_0x64c0('0x2a')]};});_0x4042eb['model']=_[_0x64c0('0x2b')](_0x1f0ab6,_0x64c0('0x25'));_0x4042eb[_0x64c0('0x2c')]=_[_0x64c0('0x2d')](_0x5b6259[_0x64c0('0x2c')]);_0x4042eb[_0x64c0('0x2e')]=_[_0x64c0('0x2f')](_0x4042eb[_0x64c0('0x30')],_0x4042eb[_0x64c0('0x2c')]);_0x1703ab['attributes']=_[_0x64c0('0x2f')](_0x4042eb[_0x64c0('0x30')],qs[_0x64c0('0x31')](_0x5b6259['query'][_0x64c0('0x31')]));_0x1703ab['attributes']=_0x1703ab[_0x64c0('0x32')][_0x64c0('0x33')]?_0x1703ab[_0x64c0('0x32')]:_0x4042eb[_0x64c0('0x30')];if(!_0x5b6259[_0x64c0('0x2c')][_0x64c0('0x34')](_0x64c0('0x35'))){_0x1703ab[_0x64c0('0x15')]=qs[_0x64c0('0x15')](_0x5b6259[_0x64c0('0x2c')][_0x64c0('0x15')]);_0x1703ab[_0x64c0('0x14')]=qs['offset'](_0x5b6259[_0x64c0('0x2c')][_0x64c0('0x14')]);}_0x1703ab['order']=qs[_0x64c0('0x36')](_0x5b6259['query'][_0x64c0('0x36')]);_0x1703ab[_0x64c0('0x37')]=qs[_0x64c0('0x2e')](_[_0x64c0('0x38')](_0x5b6259['query'],_0x4042eb[_0x64c0('0x2e')]),_0x1f0ab6);if(_0x5b6259[_0x64c0('0x2c')][_0x64c0('0x39')]){_0x1703ab[_0x64c0('0x37')]=_[_0x64c0('0x3a')](_0x1703ab[_0x64c0('0x37')],{'$or':_['map'](_0x1f0ab6,function(_0x4d722e){if(_0x4d722e[_0x64c0('0x29')]!==_0x64c0('0x3b')){var _0x3649c5={};_0x3649c5[_0x4d722e[_0x64c0('0x25')]]={'$like':'%'+_0x5b6259['query'][_0x64c0('0x39')]+'%'};return _0x3649c5;}})});}_0x1703ab=_[_0x64c0('0x3a')]({},_0x1703ab,_0x5b6259['options']);var _0x58f35f={'where':_0x1703ab[_0x64c0('0x37')]};return db['Pause'][_0x64c0('0x17')](_0x58f35f)['then'](function(_0x28cc0e){_0x158617['count']=_0x28cc0e;if(_0x5b6259[_0x64c0('0x2c')][_0x64c0('0x3c')]){_0x1703ab[_0x64c0('0x3d')]=[{'all':!![]}];}return db['Pause'][_0x64c0('0x3e')](_0x1703ab);})['then'](function(_0x24a293){_0x158617[_0x64c0('0x3f')]=_0x24a293;return _0x158617;})[_0x64c0('0x1f')](respondWithFilteredResult(_0x4fe8ab,_0x1703ab))['catch'](handleError(_0x4fe8ab,null));};exports[_0x64c0('0x40')]=function(_0x46005f,_0x46bb27){var _0x1b8e7b={'raw':!![],'where':{'id':_0x46005f[_0x64c0('0x41')]['id']}},_0x523bd7={};_0x523bd7[_0x64c0('0x30')]=_['keys'](db[_0x64c0('0x42')]['rawAttributes']);_0x523bd7[_0x64c0('0x2c')]=_['keys'](_0x46005f[_0x64c0('0x2c')]);_0x523bd7[_0x64c0('0x2e')]=_[_0x64c0('0x2f')](_0x523bd7[_0x64c0('0x30')],_0x523bd7[_0x64c0('0x2c')]);_0x1b8e7b[_0x64c0('0x32')]=_[_0x64c0('0x2f')](_0x523bd7[_0x64c0('0x30')],qs['fields'](_0x46005f[_0x64c0('0x2c')][_0x64c0('0x31')]));_0x1b8e7b[_0x64c0('0x32')]=_0x1b8e7b[_0x64c0('0x32')][_0x64c0('0x33')]?_0x1b8e7b[_0x64c0('0x32')]:_0x523bd7['model'];if(_0x46005f[_0x64c0('0x2c')][_0x64c0('0x3c')]){_0x1b8e7b[_0x64c0('0x3d')]=[{'all':!![]}];}_0x1b8e7b=_[_0x64c0('0x3a')]({},_0x1b8e7b,_0x46005f[_0x64c0('0x43')]);return db[_0x64c0('0x42')][_0x64c0('0x44')](_0x1b8e7b)[_0x64c0('0x1f')](handleEntityNotFound(_0x46bb27,null))['then'](respondWithResult(_0x46bb27,null))[_0x64c0('0x45')](handleError(_0x46bb27,null));};exports[_0x64c0('0x46')]=function(_0x57005e,_0x3dac7e){return db['Pause'][_0x64c0('0x46')](_0x57005e[_0x64c0('0x47')],{})['then'](function(_0x5e51f0){var _0x136702=_0x57005e[_0x64c0('0x48')][_0x64c0('0x21')]({'plain':!![]});if(!_0x136702)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x136702['role']==='user'){var _0x4eb339=_0x5e51f0[_0x64c0('0x21')]({'plain':!![]});var _0xdadb3e=_0x64c0('0x22');return db[_0x64c0('0x49')][_0x64c0('0x44')]({'where':{'name':_0xdadb3e,'userProfileId':_0x136702[_0x64c0('0x4a')]},'raw':!![]})[_0x64c0('0x1f')](function(_0x5d5ba5){if(_0x5d5ba5&&_0x5d5ba5['autoAssociation']===0x0){return db[_0x64c0('0x4b')][_0x64c0('0x46')]({'name':_0x4eb339[_0x64c0('0x25')],'resourceId':_0x4eb339['id'],'type':_0x5d5ba5[_0x64c0('0x25')],'sectionId':_0x5d5ba5['id']},{})[_0x64c0('0x1f')](function(){return _0x5e51f0;});}else{return _0x5e51f0;}})[_0x64c0('0x45')](function(_0x48a187){logger[_0x64c0('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a187);throw _0x48a187;});}return _0x5e51f0;})[_0x64c0('0x1f')](respondWithResult(_0x3dac7e,0xc9))[_0x64c0('0x45')](handleError(_0x3dac7e,null));};exports[_0x64c0('0x1e')]=function(_0x4fa696,_0x41eedd){if(_0x4fa696['body']['id']){delete _0x4fa696['body']['id'];}return db['Pause'][_0x64c0('0x44')]({'where':{'id':_0x4fa696[_0x64c0('0x41')]['id']}})[_0x64c0('0x1f')](handleEntityNotFound(_0x41eedd,null))[_0x64c0('0x1f')](saveUpdates(_0x4fa696[_0x64c0('0x47')],null))[_0x64c0('0x1f')](respondWithResult(_0x41eedd,null))[_0x64c0('0x45')](handleError(_0x41eedd,null));};exports[_0x64c0('0x20')]=function(_0x3c79ea,_0x5eec77){return db[_0x64c0('0x42')][_0x64c0('0x44')]({'where':{'id':_0x3c79ea[_0x64c0('0x41')]['id']}})[_0x64c0('0x1f')](handleEntityNotFound(_0x5eec77,null))['then'](removeEntity(_0x5eec77,null))[_0x64c0('0x45')](handleError(_0x5eec77,null));}; \ No newline at end of file +var _0xd95d=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','autoAssociation','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map','Pause','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','intersection','include','find','catch'];(function(_0x4ed838,_0x1446cd){var _0x2a5ecb=function(_0x23b6ed){while(--_0x23b6ed){_0x4ed838['push'](_0x4ed838['shift']());}};_0x2a5ecb(++_0x1446cd);}(_0xd95d,0x198));var _0xdd95=function(_0x496a3e,_0x55f6a5){_0x496a3e=_0x496a3e-0x0;var _0x181149=_0xd95d[_0x496a3e];return _0x181149;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd95('0x0'));var zipdir=require(_0xdd95('0x1'));var jsonpatch=require(_0xdd95('0x2'));var rp=require(_0xdd95('0x3'));var moment=require(_0xdd95('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd95('0x5'));var util=require('util');var path=require(_0xdd95('0x6'));var sox=require(_0xdd95('0x7'));var csv=require(_0xdd95('0x8'));var ejs=require(_0xdd95('0x9'));var fs=require('fs');var fs_extra=require(_0xdd95('0xa'));var _=require('lodash');var squel=require(_0xdd95('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd95('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdd95('0x8'));var querystring=require('querystring');var Papa=require(_0xdd95('0xd'));var Redis=require(_0xdd95('0xe'));var authService=require(_0xdd95('0xf'));var qs=require(_0xdd95('0x10'));var as=require(_0xdd95('0x11'));var hardwareService=require(_0xdd95('0x12'));var logger=require('../../config/logger')(_0xdd95('0x13'));var utils=require(_0xdd95('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdd95('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579cd9,_0x26c1e2){_0x26c1e2=_0x26c1e2||0xcc;return function(_0x5c83f8){if(_0x5c83f8){return _0x579cd9[_0xdd95('0x16')](_0x26c1e2);}return _0x579cd9[_0xdd95('0x17')](_0x26c1e2)[_0xdd95('0x18')]();};}function respondWithResult(_0x34f547,_0x18c280){_0x18c280=_0x18c280||0xc8;return function(_0x2072a1){if(_0x2072a1){return _0x34f547['status'](_0x18c280)['json'](_0x2072a1);}};}function respondWithFilteredResult(_0x22e78d,_0x188b93){return function(_0x564b21){if(_0x564b21){var _0x4d5906=typeof _0x188b93[_0xdd95('0x19')]===_0xdd95('0x1a')&&typeof _0x188b93[_0xdd95('0x1b')]===_0xdd95('0x1a');var _0x136071=_0x564b21[_0xdd95('0x1c')];var _0x57ecde=_0x4d5906?0x0:_0x188b93[_0xdd95('0x19')];var _0x45fbdf=_0x4d5906?_0x564b21[_0xdd95('0x1c')]:_0x188b93[_0xdd95('0x19')]+_0x188b93['limit'];var _0x7a3a02;if(_0x45fbdf>=_0x136071){_0x45fbdf=_0x136071;_0x7a3a02=0xc8;}else{_0x7a3a02=0xce;}_0x22e78d[_0xdd95('0x17')](_0x7a3a02);return _0x22e78d[_0xdd95('0x1d')](_0xdd95('0x1e'),_0x57ecde+'-'+_0x45fbdf+'/'+_0x136071)[_0xdd95('0x1f')](_0x564b21);}return null;};}function patchUpdates(_0x339730){return function(_0x29a130){try{jsonpatch[_0xdd95('0x20')](_0x29a130,_0x339730,!![]);}catch(_0xecd9db){return BPromise[_0xdd95('0x21')](_0xecd9db);}return _0x29a130[_0xdd95('0x22')]();};}function saveUpdates(_0x567269,_0x508213){return function(_0x1faa15){if(_0x1faa15){return _0x1faa15[_0xdd95('0x23')](_0x567269)[_0xdd95('0x24')](function(_0x67efcb){return _0x67efcb;});}return null;};}function removeEntity(_0x4d0a19,_0x5c9411){return function(_0xf1dba6){if(_0xf1dba6){return _0xf1dba6['destroy']()[_0xdd95('0x24')](function(){var _0x79efbd=_0xf1dba6[_0xdd95('0x25')]({'plain':!![]});var _0x22b5b7='Pauses';return db['UserProfileResource'][_0xdd95('0x26')]({'where':{'type':_0x22b5b7,'resourceId':_0x79efbd['id']}})[_0xdd95('0x24')](function(){return _0xf1dba6;});})[_0xdd95('0x24')](function(){_0x4d0a19['status'](0xcc)[_0xdd95('0x18')]();});}};}function handleEntityNotFound(_0x380f4c,_0x518f78){return function(_0x2fdc74){if(!_0x2fdc74){_0x380f4c[_0xdd95('0x16')](0x194);}return _0x2fdc74;};}function handleError(_0x58075c,_0x340498){_0x340498=_0x340498||0x1f4;return function(_0x4e5546){logger[_0xdd95('0x27')](_0x4e5546[_0xdd95('0x28')]);if(_0x4e5546['name']){delete _0x4e5546[_0xdd95('0x29')];}_0x58075c[_0xdd95('0x17')](_0x340498)[_0xdd95('0x2a')](_0x4e5546);};}exports['index']=function(_0x4fb2a0,_0xe04600){var _0x133642={},_0x5f13c9={},_0x5abd0a={'count':0x0,'rows':[]};var _0x4f01fe=_[_0xdd95('0x2b')](db[_0xdd95('0x2c')]['rawAttributes'],function(_0x1a088b){return{'name':_0x1a088b[_0xdd95('0x2d')],'type':_0x1a088b[_0xdd95('0x2e')][_0xdd95('0x2f')]};});_0x5f13c9[_0xdd95('0x30')]=_[_0xdd95('0x2b')](_0x4f01fe,_0xdd95('0x29'));_0x5f13c9[_0xdd95('0x31')]=_[_0xdd95('0x32')](_0x4fb2a0[_0xdd95('0x31')]);_0x5f13c9[_0xdd95('0x33')]=_['intersection'](_0x5f13c9['model'],_0x5f13c9[_0xdd95('0x31')]);_0x133642['attributes']=_['intersection'](_0x5f13c9[_0xdd95('0x30')],qs[_0xdd95('0x34')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x34')]));_0x133642[_0xdd95('0x35')]=_0x133642['attributes'][_0xdd95('0x36')]?_0x133642[_0xdd95('0x35')]:_0x5f13c9[_0xdd95('0x30')];if(!_0x4fb2a0['query'][_0xdd95('0x37')](_0xdd95('0x38'))){_0x133642[_0xdd95('0x1b')]=qs[_0xdd95('0x1b')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x1b')]);_0x133642[_0xdd95('0x19')]=qs[_0xdd95('0x19')](_0x4fb2a0[_0xdd95('0x31')]['offset']);}_0x133642['order']=qs[_0xdd95('0x39')](_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x39')]);_0x133642[_0xdd95('0x3a')]=qs[_0xdd95('0x33')](_[_0xdd95('0x3b')](_0x4fb2a0[_0xdd95('0x31')],_0x5f13c9[_0xdd95('0x33')]),_0x4f01fe);if(_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x3c')]){_0x133642['where']=_[_0xdd95('0x3d')](_0x133642[_0xdd95('0x3a')],{'$or':_[_0xdd95('0x2b')](_0x4f01fe,function(_0x2216c0){if(_0x2216c0['type']!==_0xdd95('0x3e')){var _0x3edcb2={};_0x3edcb2[_0x2216c0[_0xdd95('0x29')]]={'$like':'%'+_0x4fb2a0['query'][_0xdd95('0x3c')]+'%'};return _0x3edcb2;}})});}_0x133642=_[_0xdd95('0x3d')]({},_0x133642,_0x4fb2a0[_0xdd95('0x3f')]);var _0x5bd38e={'where':_0x133642[_0xdd95('0x3a')]};return db[_0xdd95('0x2c')][_0xdd95('0x1c')](_0x5bd38e)[_0xdd95('0x24')](function(_0x23101e){_0x5abd0a['count']=_0x23101e;if(_0x4fb2a0[_0xdd95('0x31')][_0xdd95('0x40')]){_0x133642['include']=[{'all':!![]}];}return db['Pause'][_0xdd95('0x41')](_0x133642);})[_0xdd95('0x24')](function(_0x30a715){_0x5abd0a['rows']=_0x30a715;return _0x5abd0a;})[_0xdd95('0x24')](respondWithFilteredResult(_0xe04600,_0x133642))['catch'](handleError(_0xe04600,null));};exports[_0xdd95('0x42')]=function(_0x153d6c,_0x3df966){var _0x432a8e={'raw':!![],'where':{'id':_0x153d6c['params']['id']}},_0x1b18bf={};_0x1b18bf[_0xdd95('0x30')]=_[_0xdd95('0x32')](db[_0xdd95('0x2c')][_0xdd95('0x43')]);_0x1b18bf[_0xdd95('0x31')]=_[_0xdd95('0x32')](_0x153d6c[_0xdd95('0x31')]);_0x1b18bf[_0xdd95('0x33')]=_[_0xdd95('0x44')](_0x1b18bf[_0xdd95('0x30')],_0x1b18bf[_0xdd95('0x31')]);_0x432a8e[_0xdd95('0x35')]=_['intersection'](_0x1b18bf[_0xdd95('0x30')],qs[_0xdd95('0x34')](_0x153d6c[_0xdd95('0x31')][_0xdd95('0x34')]));_0x432a8e[_0xdd95('0x35')]=_0x432a8e['attributes']['length']?_0x432a8e[_0xdd95('0x35')]:_0x1b18bf[_0xdd95('0x30')];if(_0x153d6c[_0xdd95('0x31')]['includeAll']){_0x432a8e[_0xdd95('0x45')]=[{'all':!![]}];}_0x432a8e=_[_0xdd95('0x3d')]({},_0x432a8e,_0x153d6c[_0xdd95('0x3f')]);return db['Pause'][_0xdd95('0x46')](_0x432a8e)[_0xdd95('0x24')](handleEntityNotFound(_0x3df966,null))[_0xdd95('0x24')](respondWithResult(_0x3df966,null))[_0xdd95('0x47')](handleError(_0x3df966,null));};exports[_0xdd95('0x48')]=function(_0x325e2a,_0x57c76c){return db['Pause'][_0xdd95('0x48')](_0x325e2a['body'],{})['then'](function(_0xe44f0c){var _0x382b38=_0x325e2a[_0xdd95('0x49')][_0xdd95('0x25')]({'plain':!![]});if(!_0x382b38)throw new Error(_0xdd95('0x4a'));if(_0x382b38['role']===_0xdd95('0x49')){var _0xf9b53=_0xe44f0c[_0xdd95('0x25')]({'plain':!![]});var _0x3cb6c6=_0xdd95('0x4b');return db[_0xdd95('0x4c')]['find']({'where':{'name':_0x3cb6c6,'userProfileId':_0x382b38['userProfileId']},'raw':!![]})['then'](function(_0x49716a){if(_0x49716a&&_0x49716a[_0xdd95('0x4d')]===0x0){return db['UserProfileResource'][_0xdd95('0x48')]({'name':_0xf9b53[_0xdd95('0x29')],'resourceId':_0xf9b53['id'],'type':_0x49716a[_0xdd95('0x29')],'sectionId':_0x49716a['id']},{})[_0xdd95('0x24')](function(){return _0xe44f0c;});}else{return _0xe44f0c;}})[_0xdd95('0x47')](function(_0x329b46){logger[_0xdd95('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x329b46);throw _0x329b46;});}return _0xe44f0c;})['then'](respondWithResult(_0x57c76c,0xc9))['catch'](handleError(_0x57c76c,null));};exports['update']=function(_0x1c089d,_0x1ca90){if(_0x1c089d[_0xdd95('0x4e')]['id']){delete _0x1c089d['body']['id'];}return db['Pause'][_0xdd95('0x46')]({'where':{'id':_0x1c089d[_0xdd95('0x4f')]['id']}})[_0xdd95('0x24')](handleEntityNotFound(_0x1ca90,null))[_0xdd95('0x24')](saveUpdates(_0x1c089d[_0xdd95('0x4e')],null))[_0xdd95('0x24')](respondWithResult(_0x1ca90,null))['catch'](handleError(_0x1ca90,null));};exports['destroy']=function(_0x4380db,_0x2b358e){return db[_0xdd95('0x2c')]['find']({'where':{'id':_0x4380db[_0xdd95('0x4f')]['id']}})[_0xdd95('0x24')](handleEntityNotFound(_0x2b358e,null))['then'](removeEntity(_0x2b358e,null))[_0xdd95('0x47')](handleError(_0x2b358e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3ee7e43..36f86df 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x4c4b0e,_0x4dd3d1){var _0x80339=function(_0x24f4b3){while(--_0x24f4b3){_0x4c4b0e['push'](_0x4c4b0e['shift']());}};_0x80339(++_0x4dd3d1);}(_0xf494,0x1c6));var _0x4f49=function(_0x35ebdb,_0x5ae7f6){_0x35ebdb=_0x35ebdb-0x0;var _0x43ec97=_0xf494[_0x35ebdb];return _0x43ec97;};'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')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x7fbe[_0xd6fcb5];return _0x278ac7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),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 683fa49..35e0455 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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5ce68c,_0x25eaa0){var _0x4e5d8f=function(_0x45f08d){while(--_0x45f08d){_0x5ce68c['push'](_0x5ce68c['shift']());}};_0x4e5d8f(++_0x25eaa0);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f8ca7,_0x1cfd75){_0x3f8ca7=_0x3f8ca7-0x0;var _0x2ef97e=_0xb10b[_0x3f8ca7];return _0x2ef97e;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5626f4,_0x3fabf3){var _0x55dd99=function(_0x4bb422){while(--_0x4bb422){_0x5626f4['push'](_0x5626f4['shift']());}};_0x55dd99(++_0x3fabf3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4dd4a1,_0x5ca922){_0x4dd4a1=_0x4dd4a1-0x0;var _0x168d0f=_0xb10b[_0x4dd4a1];return _0x168d0f;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2b9b822..53fd0d5 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 _0x4b84=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/webhook','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','upload','webhookPost','/:id','isAuthenticated','delete'];(function(_0x2f3d73,_0x2e35ac){var _0x2b5fb7=function(_0x427d46){while(--_0x427d46){_0x2f3d73['push'](_0x2f3d73['shift']());}};_0x2b5fb7(++_0x2e35ac);}(_0x4b84,0x1cc));var _0x44b8=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x4b84[_0xad57ee];return _0x3eaea9;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),controller['webhookGet']);router[_0x44b8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);var upload=multer({'storage':multer[_0x44b8('0xc')]({'destination':function(_0x4315f6,_0x9b6048,_0x24dd10){_0x24dd10(null,path[_0x44b8('0xd')](config[_0x44b8('0xe')],'server/files/plugins'));},'filename':function(_0x147529,_0x4301a6,_0x4bcc43){_0x4301a6[_0x44b8('0xf')]=_0x4301a6['originalname'][_0x44b8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcc43(null,util[_0x44b8('0x11')]('%s-%s%s',path[_0x44b8('0x12')](_0x4301a6['originalname'],path['extname'](_0x4301a6[_0x44b8('0xf')])),Date[_0x44b8('0x13')](),path[_0x44b8('0x14')](_0x4301a6[_0x44b8('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0x44b8('0x15')]);router['post'](_0x44b8('0x7'),controller[_0x44b8('0x16')]);router['put'](_0x44b8('0x17'),auth[_0x44b8('0x18')](),controller['update']);router[_0x44b8('0x19')](_0x44b8('0x17'),auth['isAuthenticated'](),controller[_0x44b8('0x19')]);module[_0x44b8('0x1a')]=router; \ No newline at end of file +var _0xedd9=['/webhook','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index'];(function(_0x2e8ee9,_0xcec846){var _0x2bd44b=function(_0x403bcf){while(--_0x403bcf){_0x2e8ee9['push'](_0x2e8ee9['shift']());}};_0x2bd44b(++_0xcec846);}(_0xedd9,0xfc));var _0x9edd=function(_0x11abd3,_0x19cb1f){_0x11abd3=_0x11abd3-0x0;var _0x4c677f=_0xedd9[_0x11abd3];return _0x4c677f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),controller['webhookGet']);router[_0x9edd('0x9')](_0x9edd('0xd'),auth[_0x9edd('0xa')](),controller[_0x9edd('0xe')]);router['get'](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);var upload=multer({'storage':multer[_0x9edd('0x11')]({'destination':function(_0x523026,_0xbf9da6,_0x13dc4f){_0x13dc4f(null,path['join'](config[_0x9edd('0x12')],_0x9edd('0x13')));},'filename':function(_0x25e64c,_0xfd544a,_0x287ddd){_0xfd544a[_0x9edd('0x14')]=_0xfd544a[_0x9edd('0x14')][_0x9edd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x287ddd(null,util['format'](_0x9edd('0x16'),path[_0x9edd('0x17')](_0xfd544a[_0x9edd('0x14')],path[_0x9edd('0x18')](_0xfd544a[_0x9edd('0x14')])),Date[_0x9edd('0x19')](),path[_0x9edd('0x18')](_0xfd544a[_0x9edd('0x14')])));}})});router['post']('/',upload[_0x9edd('0x1a')](_0x9edd('0x1b')),controller[_0x9edd('0x1c')]);router['post'](_0x9edd('0xc'),controller[_0x9edd('0x1d')]);router[_0x9edd('0x1e')]('/:id',auth[_0x9edd('0xa')](),controller['update']);router[_0x9edd('0x1f')](_0x9edd('0xd'),auth['isAuthenticated'](),controller['delete']);module[_0x9edd('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5fa4b9e..980a7d4 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 _0x9859=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x6f357,_0x3ce0ee){var _0x1bc6f4=function(_0x170ec2){while(--_0x170ec2){_0x6f357['push'](_0x6f357['shift']());}};_0x1bc6f4(++_0x3ce0ee);}(_0x9859,0x95));var _0x9985=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x9859[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require('sequelize');module[_0x9985('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9985('0x1')](_0x9985('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x9985('0x3')]},'path':{'type':Sequelize[_0x9985('0x4')],'comment':_0x9985('0x5')},'active':{'type':Sequelize[_0x9985('0x6')],'defaultValue':0x0,'comment':_0x9985('0x7')},'sidebar':{'type':Sequelize[_0x9985('0x1')](_0x9985('0x8'),_0x9985('0x9'),'always',_0x9985('0xa')),'defaultValue':_0x9985('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x9985('0x4')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x9985('0x4')]},'scriptPath':{'type':Sequelize[_0x9985('0x4')]}}; \ No newline at end of file +var _0x77c5=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x77c5,0x148));var _0x577c=function(_0x3b2dbd,_0x49dadd){_0x3b2dbd=_0x3b2dbd-0x0;var _0x2a680f=_0x77c5[_0x3b2dbd];return _0x2a680f;};'use strict';var Sequelize=require(_0x577c('0x0'));module[_0x577c('0x1')]={'name':{'type':Sequelize[_0x577c('0x2')]},'type':{'type':Sequelize[_0x577c('0x3')](_0x577c('0x4'),_0x577c('0x5'))},'description':{'type':Sequelize[_0x577c('0x6')]},'version':{'type':Sequelize[_0x577c('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0x577c('0x7')},'active':{'type':Sequelize[_0x577c('0x8')],'defaultValue':0x0,'comment':_0x577c('0x9')},'sidebar':{'type':Sequelize[_0x577c('0x3')]('adminOnly','agentOnly',_0x577c('0xa'),_0x577c('0xb')),'defaultValue':_0x577c('0xa'),'comment':_0x577c('0xc')},'icon':{'type':Sequelize[_0x577c('0x2')]},'adminUrl':{'type':Sequelize[_0x577c('0x2')]},'agentUrl':{'type':Sequelize[_0x577c('0x2')]},'scriptName':{'type':Sequelize[_0x577c('0x2')]},'scriptPath':{'type':Sequelize[_0x577c('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2dcdb98..e07311d 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 _0xfba7=['fs-extra','lodash','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./plugin.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','get','Plugins','UserProfileResource','end','error','name','send','map','Plugin','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','merge','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','icon','icon-apps','test','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Extracted\x20folder\x20removed','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','sendStatus','webhookPost','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x125c6f,_0x2c21c6){var _0x10d168=function(_0x22c69b){while(--_0x22c69b){_0x125c6f['push'](_0x125c6f['shift']());}};_0x10d168(++_0x2c21c6);}(_0xfba7,0x13c));var _0x7fba=function(_0x17888a,_0x5e6c40){_0x17888a=_0x17888a-0x0;var _0x55115a=_0xfba7[_0x17888a];return _0x55115a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fba('0x0'));var zipdir=require(_0x7fba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fba('0x2'));var moment=require(_0x7fba('0x3'));var BPromise=require(_0x7fba('0x4'));var Mustache=require(_0x7fba('0x5'));var util=require(_0x7fba('0x6'));var path=require(_0x7fba('0x7'));var sox=require(_0x7fba('0x8'));var csv=require('to-csv');var ejs=require(_0x7fba('0x9'));var fs=require('fs');var fs_extra=require(_0x7fba('0xa'));var _=require(_0x7fba('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7fba('0xc'));var toCsv=require(_0x7fba('0xd'));var querystring=require(_0x7fba('0xe'));var Papa=require(_0x7fba('0xf'));var extract=require(_0x7fba('0x10'));var rimraf=require(_0x7fba('0x0'));var archiver=require(_0x7fba('0x11'));var Redis=require(_0x7fba('0x12'));var authService=require(_0x7fba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7fba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fba('0x15'))(_0x7fba('0x16'));var utils=require(_0x7fba('0x17'));var config=require(_0x7fba('0x18'));var licenseUtil=require(_0x7fba('0x19'));var db=require('../../mysqldb')['db'];config[_0x7fba('0x1a')]=_['defaults'](config[_0x7fba('0x1a')],{'host':_0x7fba('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fba('0x1a')]));require(_0x7fba('0x1c'))[_0x7fba('0x1d')](socket);function respondWithStatusCode(_0x13d635,_0x39b029){_0x39b029=_0x39b029||0xcc;return function(_0x243cc2){if(_0x243cc2){return _0x13d635['sendStatus'](_0x39b029);}return _0x13d635[_0x7fba('0x1e')](_0x39b029)['end']();};}function respondWithResult(_0x3605a5,_0x326c34){_0x326c34=_0x326c34||0xc8;return function(_0x334504){if(_0x334504){return _0x3605a5[_0x7fba('0x1e')](_0x326c34)['json'](_0x334504);}};}function respondWithFilteredResult(_0xc294f5,_0x616760){return function(_0x355ff8){if(_0x355ff8){var _0x5384de=typeof _0x616760['offset']===_0x7fba('0x1f')&&typeof _0x616760[_0x7fba('0x20')]==='undefined';var _0x2c050e=_0x355ff8[_0x7fba('0x21')];var _0x2e4d13=_0x5384de?0x0:_0x616760[_0x7fba('0x22')];var _0x22244b=_0x5384de?_0x355ff8[_0x7fba('0x21')]:_0x616760[_0x7fba('0x22')]+_0x616760[_0x7fba('0x20')];var _0x503349;if(_0x22244b>=_0x2c050e){_0x22244b=_0x2c050e;_0x503349=0xc8;}else{_0x503349=0xce;}_0xc294f5[_0x7fba('0x1e')](_0x503349);return _0xc294f5[_0x7fba('0x23')](_0x7fba('0x24'),_0x2e4d13+'-'+_0x22244b+'/'+_0x2c050e)[_0x7fba('0x25')](_0x355ff8);}return null;};}function patchUpdates(_0x227b1f){return function(_0x28885d){try{jsonpatch[_0x7fba('0x26')](_0x28885d,_0x227b1f,!![]);}catch(_0x2a1e09){return BPromise['reject'](_0x2a1e09);}return _0x28885d['save']();};}function saveUpdates(_0x563c3e,_0x208189){return function(_0x4acdc6){if(_0x4acdc6){return _0x4acdc6[_0x7fba('0x27')](_0x563c3e)['then'](function(_0x25cb8d){return _0x25cb8d;});}return null;};}function removeEntity(_0x1cc718,_0x511bde){return function(_0x5dfc21){if(_0x5dfc21){return _0x5dfc21['destroy']()[_0x7fba('0x28')](function(){var _0x14b595=_0x5dfc21[_0x7fba('0x29')]({'plain':!![]});var _0x29e1ad=_0x7fba('0x2a');return db[_0x7fba('0x2b')]['destroy']({'where':{'type':_0x29e1ad,'resourceId':_0x14b595['id']}})[_0x7fba('0x28')](function(){return _0x5dfc21;});})[_0x7fba('0x28')](function(){_0x1cc718['status'](0xcc)[_0x7fba('0x2c')]();});}};}function handleEntityNotFound(_0x72bc51,_0x17ce0a){return function(_0x29062b){if(!_0x29062b){_0x72bc51['sendStatus'](0x194);}return _0x29062b;};}function handleError(_0x5093a7,_0x248bb7){_0x248bb7=_0x248bb7||0x1f4;return function(_0xef2fe3){logger[_0x7fba('0x2d')](_0xef2fe3['stack']);if(_0xef2fe3[_0x7fba('0x2e')]){delete _0xef2fe3[_0x7fba('0x2e')];}_0x5093a7[_0x7fba('0x1e')](_0x248bb7)[_0x7fba('0x2f')](_0xef2fe3);};}exports['index']=function(_0x28cc8f,_0x11a022){var _0xbaee44={},_0x54dc02={},_0x1e7259={'count':0x0,'rows':[]};var _0x559364=_[_0x7fba('0x30')](db[_0x7fba('0x31')]['rawAttributes'],function(_0x36fb57){return{'name':_0x36fb57[_0x7fba('0x32')],'type':_0x36fb57[_0x7fba('0x33')][_0x7fba('0x34')]};});_0x54dc02[_0x7fba('0x35')]=_['map'](_0x559364,_0x7fba('0x2e'));_0x54dc02[_0x7fba('0x36')]=_[_0x7fba('0x37')](_0x28cc8f['query']);_0x54dc02[_0x7fba('0x38')]=_['intersection'](_0x54dc02[_0x7fba('0x35')],_0x54dc02['query']);_0xbaee44[_0x7fba('0x39')]=_[_0x7fba('0x3a')](_0x54dc02[_0x7fba('0x35')],qs[_0x7fba('0x3b')](_0x28cc8f[_0x7fba('0x36')]['fields']));_0xbaee44[_0x7fba('0x39')]=_0xbaee44[_0x7fba('0x39')][_0x7fba('0x3c')]?_0xbaee44[_0x7fba('0x39')]:_0x54dc02[_0x7fba('0x35')];if(!_0x28cc8f['query']['hasOwnProperty'](_0x7fba('0x3d'))){_0xbaee44[_0x7fba('0x20')]=qs['limit'](_0x28cc8f[_0x7fba('0x36')][_0x7fba('0x20')]);_0xbaee44[_0x7fba('0x22')]=qs[_0x7fba('0x22')](_0x28cc8f[_0x7fba('0x36')][_0x7fba('0x22')]);}_0xbaee44[_0x7fba('0x3e')]=qs[_0x7fba('0x3f')](_0x28cc8f[_0x7fba('0x36')][_0x7fba('0x3f')]);_0xbaee44[_0x7fba('0x40')]=qs['filters'](_['pick'](_0x28cc8f[_0x7fba('0x36')],_0x54dc02[_0x7fba('0x38')]),_0x559364);if(_0x28cc8f[_0x7fba('0x36')][_0x7fba('0x41')]){_0xbaee44['where']=_['merge'](_0xbaee44[_0x7fba('0x40')],{'$or':_[_0x7fba('0x30')](_0x559364,function(_0x12ed1c){if(_0x12ed1c[_0x7fba('0x33')]!==_0x7fba('0x42')){var _0x12b591={};_0x12b591[_0x12ed1c[_0x7fba('0x2e')]]={'$like':'%'+_0x28cc8f[_0x7fba('0x36')][_0x7fba('0x41')]+'%'};return _0x12b591;}})});}_0xbaee44=_['merge']({},_0xbaee44,_0x28cc8f[_0x7fba('0x43')]);var _0x5a6e92={'where':_0xbaee44[_0x7fba('0x40')]};return db[_0x7fba('0x31')][_0x7fba('0x21')](_0x5a6e92)[_0x7fba('0x28')](function(_0x3ae4dc){_0x1e7259[_0x7fba('0x21')]=_0x3ae4dc;if(_0x28cc8f['query'][_0x7fba('0x44')]){_0xbaee44['include']=[{'all':!![]}];}return db['Plugin'][_0x7fba('0x45')](_0xbaee44);})[_0x7fba('0x28')](function(_0x1f5fac){_0x1e7259[_0x7fba('0x46')]=_0x1f5fac;return _0x1e7259;})[_0x7fba('0x28')](respondWithFilteredResult(_0x11a022,_0xbaee44))[_0x7fba('0x47')](handleError(_0x11a022,null));};exports['show']=function(_0xb4cc7c,_0x1b2b0c){var _0xe22bbb={'raw':!![],'where':{'id':_0xb4cc7c[_0x7fba('0x48')]['id']}},_0x53ce6c={};_0x53ce6c[_0x7fba('0x35')]=_['keys'](db[_0x7fba('0x31')][_0x7fba('0x49')]);_0x53ce6c[_0x7fba('0x36')]=_['keys'](_0xb4cc7c[_0x7fba('0x36')]);_0x53ce6c[_0x7fba('0x38')]=_[_0x7fba('0x3a')](_0x53ce6c[_0x7fba('0x35')],_0x53ce6c[_0x7fba('0x36')]);_0xe22bbb[_0x7fba('0x39')]=_[_0x7fba('0x3a')](_0x53ce6c[_0x7fba('0x35')],qs['fields'](_0xb4cc7c[_0x7fba('0x36')][_0x7fba('0x3b')]));_0xe22bbb[_0x7fba('0x39')]=_0xe22bbb[_0x7fba('0x39')][_0x7fba('0x3c')]?_0xe22bbb[_0x7fba('0x39')]:_0x53ce6c[_0x7fba('0x35')];if(_0xb4cc7c[_0x7fba('0x36')][_0x7fba('0x44')]){_0xe22bbb[_0x7fba('0x4a')]=[{'all':!![]}];}_0xe22bbb=_[_0x7fba('0x4b')]({},_0xe22bbb,_0xb4cc7c[_0x7fba('0x43')]);return db[_0x7fba('0x31')]['find'](_0xe22bbb)[_0x7fba('0x28')](handleEntityNotFound(_0x1b2b0c,null))[_0x7fba('0x28')](respondWithResult(_0x1b2b0c,null))[_0x7fba('0x47')](handleError(_0x1b2b0c,null));};exports[_0x7fba('0x4c')]=function(_0xd3145b,_0x1bd419,_0x544d2d){return db[_0x7fba('0x31')][_0x7fba('0x4d')]({'where':{'id':_0xd3145b[_0x7fba('0x48')]['id']},'attributes':[_0x7fba('0x2e'),'path'],'raw':!![]})[_0x7fba('0x28')](handleEntityNotFound(_0x1bd419,null))[_0x7fba('0x28')](function(_0x1d32a2){if(_0x1d32a2){var _0x4e87ae=path[_0x7fba('0x4e')](config[_0x7fba('0x4f')],_0x7fba('0x50'),util[_0x7fba('0x51')](_0x7fba('0x52'),path[_0x7fba('0x53')](_0x1d32a2[_0x7fba('0x7')])));var _0x3cf588=fs[_0x7fba('0x54')](_0x4e87ae);var _0x12b538=archiver(_0x7fba('0x55'),{'zlib':{'level':0x9}});_0x12b538['on']('warning',function(_0x2cdb2e){if(_0x2cdb2e[_0x7fba('0x56')]==='ENOENT'){logger['error'](_0x2cdb2e);}else{throw new db['Sequelize'][(_0x7fba('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x12b538['on'](_0x7fba('0x2d'),function(_0x3832d0){throw new db[(_0x7fba('0x58'))][(_0x7fba('0x57'))](_0x7fba('0x59'));});_0x12b538[_0x7fba('0x5a')](_0x3cf588);_0x12b538[_0x7fba('0x5b')](_0x7fba('0x5c'),{'cwd':path[_0x7fba('0x4e')](config['root'],_0x7fba('0x50'),path[_0x7fba('0x5d')](_0x1d32a2[_0x7fba('0x7')])),'ignore':[path[_0x7fba('0x4e')](path[_0x7fba('0x53')](_0x1d32a2[_0x7fba('0x7')]),'node_modules/**/*'),path['join'](path[_0x7fba('0x53')](_0x1d32a2['path']),_0x7fba('0x5e'))],'nodir':!![]})[_0x7fba('0x5f')]();_0x3cf588['on']('close',function(){if(!fs['existsSync'](_0x4e87ae)){throw new db[(_0x7fba('0x58'))][(_0x7fba('0x57'))](_0x7fba('0x60'));}return _0x1bd419[_0x7fba('0x4c')](_0x4e87ae,util[_0x7fba('0x51')](_0x7fba('0x52'),path['basename'](_0x1d32a2[_0x7fba('0x7')])),function(_0x55babd){if(_0x55babd){throw new db[(_0x7fba('0x58'))]['Error'](_0x7fba('0x61'));}fs[_0x7fba('0x62')](_0x4e87ae);logger['info'](_0x7fba('0x63'));logger['info'](_0x7fba('0x64'));});});}return null;})[_0x7fba('0x47')](handleError(_0x1bd419,null));};exports['upload']=function(_0x1a4de6,_0x7f94c4,_0x2aaf79){var _0x2cdea9=path['basename'](_0x1a4de6['file'][_0x7fba('0x65')],path[_0x7fba('0x66')](_0x1a4de6[_0x7fba('0x67')][_0x7fba('0x65')]));var _0x4e27ca=path[_0x7fba('0x4e')](config[_0x7fba('0x4f')],'server/files/plugins',_0x1a4de6[_0x7fba('0x67')][_0x7fba('0x65')]);var _0x2f646d=path[_0x7fba('0x4e')](config['root'],'server/files/plugins',_0x2cdea9);logger[_0x7fba('0x68')](_0x7fba('0x69'),_0x4e27ca);logger['info'](_0x7fba('0x6a'),_0x2f646d);try{fs[_0x7fba('0x6b')](_0x4e27ca,parseInt(_0x7fba('0x6c'),0x8));extract(_0x4e27ca,{'dir':_0x2f646d},function(_0x3641ed){if(_0x3641ed){logger[_0x7fba('0x2d')](_0x3641ed);handleError(_0x3641ed,!![]);};var _0x1eb8ec=fs[_0x7fba('0x6d')](_0x2f646d);if(_0x1eb8ec[_0x7fba('0x3c')]>0x1){removeReferences(_0x4e27ca,_0x2f646d);logger[_0x7fba('0x2d')](_0x7fba('0x6e'));return _0x2aaf79(new Error('Invalid\x20plugin\x20structure'));}var _0x5bbe43=fs[_0x7fba('0x6f')](path[_0x7fba('0x4e')](_0x2f646d,_0x1eb8ec[0x0]));if(_0x5bbe43[_0x7fba('0x70')]()){removeReferences(_0x4e27ca,_0x2f646d);logger[_0x7fba('0x2d')](_0x7fba('0x6e'));return _0x2aaf79(new Error(_0x7fba('0x6e')));}if(_0x5bbe43['isDirectory']()){var _0xbaeaa0=fs[_0x7fba('0x6d')](path[_0x7fba('0x4e')](_0x2f646d,_0x1eb8ec[0x0]));if(_0xbaeaa0['length']===0x0){removeReferences(_0x4e27ca,_0x2f646d);logger[_0x7fba('0x2d')](_0x7fba('0x6e'));return _0x2aaf79(new Error(_0x7fba('0x6e')));}var _0xeac2fe=_0xbaeaa0['some'](function(_0x4f25ed){return _0x4f25ed===_0x7fba('0x71');});if(!_0xeac2fe){return _0x2aaf79(new Error(_0x7fba('0x72')));}var _0x162132=fs[_0x7fba('0x73')](path[_0x7fba('0x4e')](_0x2f646d,_0x1eb8ec[0x0],'manifest.json'));var _0x220b5f=JSON[_0x7fba('0x74')](_0x162132);if(_0x7fba('0x1f')==typeof _0x220b5f[_0x7fba('0x2e')]){return _0x2aaf79(new Error(_0x7fba('0x75')));}if(_0x7fba('0x1f')==typeof _0x220b5f[_0x7fba('0x33')]){return _0x2aaf79(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x7fba('0x1f')==typeof _0x220b5f[_0x7fba('0x76')]){return _0x2aaf79(new Error(_0x7fba('0x77')));}if(_0x7fba('0x1f')==typeof _0x220b5f['parameters']){return _0x2aaf79(new Error(_0x7fba('0x78')));}if(_0x220b5f['type']===_0x7fba('0x79')){if('undefined'==typeof _0x220b5f['parameters'][_0x7fba('0x7a')]){return _0x2aaf79(new Error(_0x7fba('0x7b')));}if(_0x7fba('0x1f')==typeof _0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')][_0x7fba('0x7d')]&&_0x7fba('0x1f')==typeof _0x220b5f['parameters'][_0x7fba('0x7a')][_0x7fba('0x7e')]){return _0x2aaf79(new Error(_0x7fba('0x7f')));}}else if(_0x220b5f[_0x7fba('0x33')]==='script'){if(_0x7fba('0x1f')==typeof _0x220b5f[_0x7fba('0x7c')][_0x7fba('0x80')]){return _0x2aaf79(new Error(_0x7fba('0x81')));}if(_0x7fba('0x1f')==typeof _0x220b5f['parameters'][_0x7fba('0x82')]){return _0x2aaf79(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2aaf79(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x278c07=_0x220b5f[_0x7fba('0x2e')];var _0x211024=_0x220b5f[_0x7fba('0x83')];var _0x2c5aa9=_0x220b5f[_0x7fba('0x33')];var _0x47f19b=_0x220b5f[_0x7fba('0x84')]?_0x220b5f['sidebar']:'always';var _0x331d17=_0x220b5f['icon']?_0x220b5f[_0x7fba('0x85')]:_0x7fba('0x86');var _0x2a00d8='';var _0x52144c='';var _0x50f80e='';var _0x4e2392='';var _0x3b97d6=_0x220b5f[_0x7fba('0x76')];if(_0x2c5aa9===_0x7fba('0x79')){if('undefined'!=typeof _0x220b5f['parameters'][_0x7fba('0x7a')][_0x7fba('0x7d')]){var _0x493bb7=_0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7fba('0x87')](_0x493bb7)){_0x2a00d8=path[_0x7fba('0x4e')]('plugins',_0x2cdea9,_0x1eb8ec[0x0],_0x493bb7);}else{_0x2a00d8=_0x493bb7;}}else{logger[_0x7fba('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x7fba('0x1f')!=typeof _0x220b5f['parameters'][_0x7fba('0x7a')]['agent']){var _0x43cad1=_0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')][_0x7fba('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x7fba('0x87')](_0x43cad1)){_0x52144c=path[_0x7fba('0x4e')](_0x7fba('0x88'),_0x2cdea9,_0x1eb8ec[0x0],_0x43cad1);}else{_0x52144c=_0x43cad1;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2c5aa9==='script'){_0x50f80e=_0x220b5f[_0x7fba('0x7c')][_0x7fba('0x80')];_0x4e2392=_0x220b5f['parameters'][_0x7fba('0x82')];if(_0x7fba('0x1f')!=typeof _0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')]){if(_0x7fba('0x1f')!=typeof _0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')][_0x7fba('0x7d')]){var _0x493bb7=_0x220b5f['parameters']['views'][_0x7fba('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x7fba('0x87')](_0x493bb7)){_0x2a00d8=path['join']('plugins',_0x2cdea9,_0x1eb8ec[0x0],_0x493bb7);}else{_0x2a00d8=_0x493bb7;}}if('undefined'!=typeof _0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')]['agent']){var _0x43cad1=_0x220b5f[_0x7fba('0x7c')][_0x7fba('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x7fba('0x87')](_0x43cad1)){_0x52144c=path[_0x7fba('0x4e')](_0x7fba('0x88'),_0x2cdea9,_0x1eb8ec[0x0],_0x43cad1);}else{_0x52144c=_0x43cad1;}}}}var _0x9e8ba1={'name':_0x278c07,'description':_0x211024,'path':path['join'](_0x2cdea9,_0x1eb8ec[0x0]),'type':_0x2c5aa9,'sidebar':_0x47f19b,'icon':_0x331d17,'adminUrl':_0x2a00d8,'agentUrl':_0x52144c,'scriptName':_0x50f80e,'scriptPath':_0x4e2392,'version':_0x3b97d6};removeReferences(_0x4e27ca,null);return db[_0x7fba('0x31')][_0x7fba('0x89')](_0x9e8ba1)['then'](function(_0x5d58cf){var _0x34e126={'role':_0x1a4de6[_0x7fba('0x8a')][_0x7fba('0x8b')],'userProfileId':_0x1a4de6[_0x7fba('0x8a')][_0x7fba('0x8c')]};if(!_0x34e126)throw new Error(_0x7fba('0x8d'));if(_0x34e126[_0x7fba('0x8b')]===_0x7fba('0x8e')){var _0x415eb0=_0x5d58cf[_0x7fba('0x29')]({'plain':!![]});return db[_0x7fba('0x8f')][_0x7fba('0x4d')]({'where':{'name':_0x7fba('0x2a'),'userProfileId':_0x34e126[_0x7fba('0x8c')]},'raw':!![]})['then'](function(_0x1694df){if(_0x1694df&&_0x1694df[_0x7fba('0x90')]===0x0){return db[_0x7fba('0x2b')]['create']({'name':_0x415eb0[_0x7fba('0x2e')],'resourceId':_0x415eb0['id'],'type':_0x1694df[_0x7fba('0x2e')],'sectionId':_0x1694df['id']},{})[_0x7fba('0x28')](function(){return _0x5d58cf;});}else{return _0x5d58cf;}})[_0x7fba('0x47')](function(_0x49c87f){logger[_0x7fba('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c87f);throw _0x49c87f;});}return _0x5d58cf;})['then'](respondWithResult(_0x7f94c4,null))['catch'](handleError(_0x7f94c4,null));}});}catch(_0x10f459){_0x7f94c4[_0x7fba('0x1e')](0x1f4)[_0x7fba('0x2f')](_0x10f459);}};function removeReferences(_0x3df9ca,_0x46397f){try{if(_0x3df9ca){fs[_0x7fba('0x62')](_0x3df9ca);logger[_0x7fba('0x68')]('Zip\x20archive\x20removed');}if(_0x46397f){rimraf(_0x46397f,function(){});logger[_0x7fba('0x68')](_0x7fba('0x91'));}}catch(_0x2c4474){logger[_0x7fba('0x2d')](_0x2c4474);}}exports[_0x7fba('0x27')]=function(_0x32d0d4,_0x346eae,_0x5ead65){return db[_0x7fba('0x31')][_0x7fba('0x4d')]({'where':{'id':_0x32d0d4[_0x7fba('0x48')]['id']}})['then'](handleEntityNotFound(_0x346eae,null))[_0x7fba('0x28')](saveUpdates(_0x32d0d4[_0x7fba('0x8a')],null))['then'](respondWithResult(_0x346eae,null))[_0x7fba('0x47')](handleError(_0x346eae,null));};exports[_0x7fba('0x92')]=function(_0x1e3da8,_0x230f18,_0x20cef7){return db[_0x7fba('0x31')]['find']({'where':{'id':_0x1e3da8[_0x7fba('0x48')]['id']}})[_0x7fba('0x28')](function(_0x1430cb){if(_0x1430cb){return _0x1430cb[_0x7fba('0x93')]();}})[_0x7fba('0x28')](function(_0x526937){rimraf(path[_0x7fba('0x4e')](config['root'],_0x7fba('0x50'),path[_0x7fba('0x5d')](_0x526937[_0x7fba('0x7')])),function(){});return _0x526937;})[_0x7fba('0x28')](handleEntityNotFound(_0x230f18,null))[_0x7fba('0x28')](respondWithStatusCode(_0x230f18,null))[_0x7fba('0x47')](handleError(_0x230f18,null));};exports[_0x7fba('0x94')]=function(_0x3a1f81,_0x329e81,_0x1643f2){return BPromise[_0x7fba('0x95')]()[_0x7fba('0x28')](function(){if(!_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x7')]){throw new Error(_0x7fba('0x96'));}if(!_0x3a1f81[_0x7fba('0x36')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3421eb=_0x3a1f81[_0x7fba('0x36')]['hostname']?_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x97')]+':'+_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x98')]:_0x7fba('0x99')+_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x98')];var _0x359f46=_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x25')]?_0x3a1f81['query']['json']:!![];var _0x39f763=_0x3a1f81['query'][_0x7fba('0x9a')]?_0x3a1f81['query'][_0x7fba('0x9a')]:null;var _0x1fa89e={'method':_0x3a1f81[_0x7fba('0x9b')],'uri':util[_0x7fba('0x51')](_0x7fba('0x9c'),_0x3421eb,_0x3a1f81[_0x7fba('0x36')]['path']),'json':_0x359f46,'resolveWithFullResponse':!![],'encoding':_0x39f763,'qs':_0x3a1f81[_0x7fba('0x36')]};if(_0x3a1f81[_0x7fba('0x9d')]){_0x1fa89e[_0x7fba('0x9d')]=_0x3a1f81['headers'];if(_0x1fa89e['headers'][_0x7fba('0x9e')]){delete _0x1fa89e[_0x7fba('0x9d')]['content-length'];}}if(_0x1fa89e[_0x7fba('0x9d')][_0x7fba('0x9f')]){delete _0x1fa89e[_0x7fba('0x9d')][_0x7fba('0x9f')];}return rp(_0x1fa89e);})[_0x7fba('0x28')](function(_0x491601){if(_0x491601){_0x329e81['set'](_0x491601[_0x7fba('0x9d')]);logger['info'](_0x491601[_0x7fba('0x8a')]);if(_['endsWith'](_0x3a1f81[_0x7fba('0x36')][_0x7fba('0x7')],_0x7fba('0x4c'))&&_0x491601[_0x7fba('0xa0')]==0x1f4){return _0x329e81[_0x7fba('0xa1')](_0x491601[_0x7fba('0xa0')]);}else{return _0x329e81['status'](_0x491601['statusCode'])[_0x7fba('0x2f')](_0x491601[_0x7fba('0x8a')]);}}else{return _0x329e81[_0x7fba('0xa1')](0xc8);}})[_0x7fba('0x47')](handleError(_0x329e81,null));};exports[_0x7fba('0xa2')]=function(_0x50137a,_0x5bb577,_0xcf4ebf){return BPromise[_0x7fba('0x95')]()[_0x7fba('0x28')](function(){if(!_0x50137a[_0x7fba('0x36')][_0x7fba('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x50137a[_0x7fba('0x36')][_0x7fba('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x8174a=_0x50137a[_0x7fba('0x36')]['hostname']?_0x50137a['query'][_0x7fba('0x97')]+':'+_0x50137a[_0x7fba('0x36')][_0x7fba('0x98')]:_0x7fba('0x99')+_0x50137a[_0x7fba('0x36')][_0x7fba('0x98')];var _0x1c7d79=_0x50137a['query'][_0x7fba('0x25')]?_0x50137a[_0x7fba('0x36')]['json']:!![];var _0x9da15e=_0x50137a[_0x7fba('0x36')][_0x7fba('0x9a')]?_0x50137a[_0x7fba('0x36')]['encoding']:null;var _0x502190={'method':_0x50137a['method'],'uri':util[_0x7fba('0x51')]('%s%s',_0x8174a,_0x50137a[_0x7fba('0x36')][_0x7fba('0x7')]),'json':_0x1c7d79,'resolveWithFullResponse':!![],'encoding':_0x9da15e,'body':_0x50137a[_0x7fba('0x8a')]};if(_0x50137a[_0x7fba('0x9d')]){_0x502190[_0x7fba('0x9d')]=_0x50137a[_0x7fba('0x9d')];if(_0x502190['headers']['content-length']){delete _0x502190[_0x7fba('0x9d')][_0x7fba('0x9e')];}}if(_0x502190['headers'][_0x7fba('0x9f')]){delete _0x502190[_0x7fba('0x9d')][_0x7fba('0x9f')];}return rp(_0x502190);})[_0x7fba('0x28')](function(_0x24cb06){if(_0x24cb06){_0x5bb577[_0x7fba('0x23')](_0x24cb06['headers']);logger[_0x7fba('0x68')](_0x24cb06['body']);return _0x5bb577[_0x7fba('0x1e')](_0x24cb06['statusCode'])[_0x7fba('0x2f')](_0x24cb06['body']);}else{return _0x5bb577[_0x7fba('0xa1')](0xc8);}})[_0x7fba('0x47')](handleError(_0x5bb577,null));}; \ No newline at end of file +var _0xd345=['Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','plugins','body','userProfileId','role','user','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','resolve','http://localhost:','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./plugin.socket','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','show','params','includeAll','find','catch','download','root','server/files/plugins','%s.zip','basename','createWriteStream','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found'];(function(_0x221332,_0x5c0307){var _0x281621=function(_0xd004fa){while(--_0xd004fa){_0x221332['push'](_0x221332['shift']());}};_0x281621(++_0x5c0307);}(_0xd345,0xf0));var _0x5d34=function(_0x2a1fe6,_0x3d74e7){_0x2a1fe6=_0x2a1fe6-0x0;var _0x26179f=_0xd345[_0x2a1fe6];return _0x26179f;};'use strict';var emlformat=require(_0x5d34('0x0'));var rimraf=require(_0x5d34('0x1'));var zipdir=require(_0x5d34('0x2'));var jsonpatch=require(_0x5d34('0x3'));var rp=require(_0x5d34('0x4'));var moment=require('moment');var BPromise=require(_0x5d34('0x5'));var Mustache=require(_0x5d34('0x6'));var util=require('util');var path=require(_0x5d34('0x7'));var sox=require('sox');var csv=require(_0x5d34('0x8'));var ejs=require(_0x5d34('0x9'));var fs=require('fs');var fs_extra=require(_0x5d34('0xa'));var _=require(_0x5d34('0xb'));var squel=require(_0x5d34('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d34('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5d34('0xe'));var Papa=require(_0x5d34('0xf'));var extract=require(_0x5d34('0x10'));var rimraf=require(_0x5d34('0x1'));var archiver=require(_0x5d34('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d34('0x12'));var as=require(_0x5d34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d34('0x14'))('api');var utils=require(_0x5d34('0x15'));var config=require(_0x5d34('0x16'));var licenseUtil=require(_0x5d34('0x17'));var db=require(_0x5d34('0x18'))['db'];config['redis']=_[_0x5d34('0x19')](config[_0x5d34('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d34('0x1b'))['register'](socket);function respondWithStatusCode(_0x423921,_0xb20b29){_0xb20b29=_0xb20b29||0xcc;return function(_0x4b70da){if(_0x4b70da){return _0x423921['sendStatus'](_0xb20b29);}return _0x423921[_0x5d34('0x1c')](_0xb20b29)[_0x5d34('0x1d')]();};}function respondWithResult(_0x335434,_0x159643){_0x159643=_0x159643||0xc8;return function(_0x438a57){if(_0x438a57){return _0x335434[_0x5d34('0x1c')](_0x159643)['json'](_0x438a57);}};}function respondWithFilteredResult(_0x297893,_0x5c9b0c){return function(_0x3dea5b){if(_0x3dea5b){var _0x241679=typeof _0x5c9b0c[_0x5d34('0x1e')]===_0x5d34('0x1f')&&typeof _0x5c9b0c[_0x5d34('0x20')]==='undefined';var _0x237409=_0x3dea5b[_0x5d34('0x21')];var _0x25c148=_0x241679?0x0:_0x5c9b0c[_0x5d34('0x1e')];var _0x5ec09f=_0x241679?_0x3dea5b[_0x5d34('0x21')]:_0x5c9b0c[_0x5d34('0x1e')]+_0x5c9b0c[_0x5d34('0x20')];var _0x3fe8db;if(_0x5ec09f>=_0x237409){_0x5ec09f=_0x237409;_0x3fe8db=0xc8;}else{_0x3fe8db=0xce;}_0x297893[_0x5d34('0x1c')](_0x3fe8db);return _0x297893[_0x5d34('0x22')](_0x5d34('0x23'),_0x25c148+'-'+_0x5ec09f+'/'+_0x237409)['json'](_0x3dea5b);}return null;};}function patchUpdates(_0x22c534){return function(_0x1b9dda){try{jsonpatch['apply'](_0x1b9dda,_0x22c534,!![]);}catch(_0x3082c0){return BPromise[_0x5d34('0x24')](_0x3082c0);}return _0x1b9dda[_0x5d34('0x25')]();};}function saveUpdates(_0x247be3,_0x561429){return function(_0x277133){if(_0x277133){return _0x277133['update'](_0x247be3)['then'](function(_0xce5afd){return _0xce5afd;});}return null;};}function removeEntity(_0x11194f,_0x3824fe){return function(_0x217634){if(_0x217634){return _0x217634[_0x5d34('0x26')]()[_0x5d34('0x27')](function(){var _0x48ca24=_0x217634['get']({'plain':!![]});var _0xef5cec='Plugins';return db[_0x5d34('0x28')]['destroy']({'where':{'type':_0xef5cec,'resourceId':_0x48ca24['id']}})['then'](function(){return _0x217634;});})['then'](function(){_0x11194f['status'](0xcc)[_0x5d34('0x1d')]();});}};}function handleEntityNotFound(_0x3f4ec1,_0x263718){return function(_0x300340){if(!_0x300340){_0x3f4ec1[_0x5d34('0x29')](0x194);}return _0x300340;};}function handleError(_0x583886,_0x519691){_0x519691=_0x519691||0x1f4;return function(_0x105373){logger['error'](_0x105373[_0x5d34('0x2a')]);if(_0x105373[_0x5d34('0x2b')]){delete _0x105373[_0x5d34('0x2b')];}_0x583886[_0x5d34('0x1c')](_0x519691)[_0x5d34('0x2c')](_0x105373);};}exports[_0x5d34('0x2d')]=function(_0xeaf0dd,_0x1798d6){var _0x191322={},_0x122f76={},_0x26c888={'count':0x0,'rows':[]};var _0x359f1e=_[_0x5d34('0x2e')](db['Plugin'][_0x5d34('0x2f')],function(_0x337a4c){return{'name':_0x337a4c[_0x5d34('0x30')],'type':_0x337a4c[_0x5d34('0x31')][_0x5d34('0x32')]};});_0x122f76[_0x5d34('0x33')]=_[_0x5d34('0x2e')](_0x359f1e,'name');_0x122f76[_0x5d34('0x34')]=_[_0x5d34('0x35')](_0xeaf0dd[_0x5d34('0x34')]);_0x122f76[_0x5d34('0x36')]=_[_0x5d34('0x37')](_0x122f76[_0x5d34('0x33')],_0x122f76[_0x5d34('0x34')]);_0x191322[_0x5d34('0x38')]=_[_0x5d34('0x37')](_0x122f76['model'],qs[_0x5d34('0x39')](_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x39')]));_0x191322[_0x5d34('0x38')]=_0x191322[_0x5d34('0x38')][_0x5d34('0x3a')]?_0x191322['attributes']:_0x122f76['model'];if(!_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x3b')]('nolimit')){_0x191322['limit']=qs[_0x5d34('0x20')](_0xeaf0dd['query'][_0x5d34('0x20')]);_0x191322[_0x5d34('0x1e')]=qs[_0x5d34('0x1e')](_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x1e')]);}_0x191322['order']=qs[_0x5d34('0x3c')](_0xeaf0dd[_0x5d34('0x34')]['sort']);_0x191322[_0x5d34('0x3d')]=qs['filters'](_[_0x5d34('0x3e')](_0xeaf0dd[_0x5d34('0x34')],_0x122f76['filters']),_0x359f1e);if(_0xeaf0dd[_0x5d34('0x34')][_0x5d34('0x3f')]){_0x191322[_0x5d34('0x3d')]=_[_0x5d34('0x40')](_0x191322[_0x5d34('0x3d')],{'$or':_[_0x5d34('0x2e')](_0x359f1e,function(_0x3d48d4){if(_0x3d48d4[_0x5d34('0x31')]!==_0x5d34('0x41')){var _0x2d6584={};_0x2d6584[_0x3d48d4[_0x5d34('0x2b')]]={'$like':'%'+_0xeaf0dd['query'][_0x5d34('0x3f')]+'%'};return _0x2d6584;}})});}_0x191322=_[_0x5d34('0x40')]({},_0x191322,_0xeaf0dd[_0x5d34('0x42')]);var _0x2d535e={'where':_0x191322[_0x5d34('0x3d')]};return db[_0x5d34('0x43')][_0x5d34('0x21')](_0x2d535e)[_0x5d34('0x27')](function(_0x61fcbf){_0x26c888[_0x5d34('0x21')]=_0x61fcbf;if(_0xeaf0dd[_0x5d34('0x34')]['includeAll']){_0x191322[_0x5d34('0x44')]=[{'all':!![]}];}return db[_0x5d34('0x43')][_0x5d34('0x45')](_0x191322);})[_0x5d34('0x27')](function(_0x587ac7){_0x26c888['rows']=_0x587ac7;return _0x26c888;})['then'](respondWithFilteredResult(_0x1798d6,_0x191322))['catch'](handleError(_0x1798d6,null));};exports[_0x5d34('0x46')]=function(_0x778553,_0x134e3c){var _0x15db17={'raw':!![],'where':{'id':_0x778553[_0x5d34('0x47')]['id']}},_0x3b6e9b={};_0x3b6e9b[_0x5d34('0x33')]=_[_0x5d34('0x35')](db['Plugin']['rawAttributes']);_0x3b6e9b['query']=_['keys'](_0x778553[_0x5d34('0x34')]);_0x3b6e9b[_0x5d34('0x36')]=_[_0x5d34('0x37')](_0x3b6e9b[_0x5d34('0x33')],_0x3b6e9b[_0x5d34('0x34')]);_0x15db17[_0x5d34('0x38')]=_[_0x5d34('0x37')](_0x3b6e9b[_0x5d34('0x33')],qs[_0x5d34('0x39')](_0x778553[_0x5d34('0x34')][_0x5d34('0x39')]));_0x15db17[_0x5d34('0x38')]=_0x15db17['attributes'][_0x5d34('0x3a')]?_0x15db17['attributes']:_0x3b6e9b[_0x5d34('0x33')];if(_0x778553['query'][_0x5d34('0x48')]){_0x15db17[_0x5d34('0x44')]=[{'all':!![]}];}_0x15db17=_[_0x5d34('0x40')]({},_0x15db17,_0x778553[_0x5d34('0x42')]);return db[_0x5d34('0x43')][_0x5d34('0x49')](_0x15db17)[_0x5d34('0x27')](handleEntityNotFound(_0x134e3c,null))['then'](respondWithResult(_0x134e3c,null))[_0x5d34('0x4a')](handleError(_0x134e3c,null));};exports[_0x5d34('0x4b')]=function(_0x26c57c,_0x9c3370,_0x83e5f8){return db[_0x5d34('0x43')][_0x5d34('0x49')]({'where':{'id':_0x26c57c[_0x5d34('0x47')]['id']},'attributes':[_0x5d34('0x2b'),_0x5d34('0x7')],'raw':!![]})[_0x5d34('0x27')](handleEntityNotFound(_0x9c3370,null))[_0x5d34('0x27')](function(_0x3eeb0a){if(_0x3eeb0a){var _0x524e7e=path['join'](config[_0x5d34('0x4c')],_0x5d34('0x4d'),util['format'](_0x5d34('0x4e'),path[_0x5d34('0x4f')](_0x3eeb0a[_0x5d34('0x7')])));var _0x2ed689=fs[_0x5d34('0x50')](_0x524e7e);var _0x5df37f=archiver('zip',{'zlib':{'level':0x9}});_0x5df37f['on']('warning',function(_0x20f3ab){if(_0x20f3ab[_0x5d34('0x51')]==='ENOENT'){logger[_0x5d34('0x52')](_0x20f3ab);}else{throw new db[(_0x5d34('0x53'))][(_0x5d34('0x54'))](_0x5d34('0x55'));}});_0x5df37f['on']('error',function(_0x1a4c52){throw new db[(_0x5d34('0x53'))][(_0x5d34('0x54'))](_0x5d34('0x55'));});_0x5df37f[_0x5d34('0x56')](_0x2ed689);_0x5df37f[_0x5d34('0x57')](_0x5d34('0x58'),{'cwd':path[_0x5d34('0x59')](config[_0x5d34('0x4c')],_0x5d34('0x4d'),path[_0x5d34('0x5a')](_0x3eeb0a['path'])),'ignore':[path['join'](path[_0x5d34('0x4f')](_0x3eeb0a['path']),_0x5d34('0x5b')),path['join'](path[_0x5d34('0x4f')](_0x3eeb0a[_0x5d34('0x7')]),_0x5d34('0x5c'))],'nodir':!![]})[_0x5d34('0x5d')]();_0x2ed689['on'](_0x5d34('0x5e'),function(){if(!fs['existsSync'](_0x524e7e)){throw new db['Sequelize'][(_0x5d34('0x54'))](_0x5d34('0x5f'));}return _0x9c3370[_0x5d34('0x4b')](_0x524e7e,util['format'](_0x5d34('0x4e'),path[_0x5d34('0x4f')](_0x3eeb0a['path'])),function(_0x5d7b30){if(_0x5d7b30){throw new db['Sequelize'][(_0x5d34('0x54'))](_0x5d34('0x60'));}fs[_0x5d34('0x61')](_0x524e7e);logger['info'](_0x5d34('0x62'));logger[_0x5d34('0x63')](_0x5d34('0x64'));});});}return null;})[_0x5d34('0x4a')](handleError(_0x9c3370,null));};exports[_0x5d34('0x65')]=function(_0x1debc6,_0x233302,_0x26fbe9){var _0x3279c3=path[_0x5d34('0x4f')](_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')],path['extname'](_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')]));var _0x396463=path[_0x5d34('0x59')](config[_0x5d34('0x4c')],_0x5d34('0x4d'),_0x1debc6[_0x5d34('0x66')][_0x5d34('0x67')]);var _0x1274cd=path[_0x5d34('0x59')](config['root'],_0x5d34('0x4d'),_0x3279c3);logger[_0x5d34('0x63')](_0x5d34('0x68'),_0x396463);logger[_0x5d34('0x63')]('Plugin\x20upload\x20destination:\x20%s',_0x1274cd);try{fs[_0x5d34('0x69')](_0x396463,parseInt('0777',0x8));extract(_0x396463,{'dir':_0x1274cd},function(_0x30e647){if(_0x30e647){logger[_0x5d34('0x52')](_0x30e647);handleError(_0x30e647,!![]);};var _0x27d322=fs[_0x5d34('0x6a')](_0x1274cd);if(_0x27d322['length']>0x1){removeReferences(_0x396463,_0x1274cd);logger['error']('Invalid\x20plugin\x20structure');return _0x26fbe9(new Error(_0x5d34('0x6b')));}var _0x5b57b4=fs[_0x5d34('0x6c')](path['join'](_0x1274cd,_0x27d322[0x0]));if(_0x5b57b4[_0x5d34('0x6d')]()){removeReferences(_0x396463,_0x1274cd);logger[_0x5d34('0x52')](_0x5d34('0x6b'));return _0x26fbe9(new Error(_0x5d34('0x6b')));}if(_0x5b57b4[_0x5d34('0x6e')]()){var _0x1eab3d=fs['readdirSync'](path['join'](_0x1274cd,_0x27d322[0x0]));if(_0x1eab3d[_0x5d34('0x3a')]===0x0){removeReferences(_0x396463,_0x1274cd);logger['error'](_0x5d34('0x6b'));return _0x26fbe9(new Error(_0x5d34('0x6b')));}var _0x2cdaa0=_0x1eab3d[_0x5d34('0x6f')](function(_0x3bc28c){return _0x3bc28c===_0x5d34('0x70');});if(!_0x2cdaa0){return _0x26fbe9(new Error(_0x5d34('0x71')));}var _0x43ff58=fs['readFileSync'](path[_0x5d34('0x59')](_0x1274cd,_0x27d322[0x0],_0x5d34('0x70')));var _0x201241=JSON[_0x5d34('0x72')](_0x43ff58);if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x2b')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x31')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x73')]){return _0x26fbe9(new Error(_0x5d34('0x74')));}if('undefined'==typeof _0x201241['parameters']){return _0x26fbe9(new Error(_0x5d34('0x75')));}if(_0x201241[_0x5d34('0x31')]==='html'){if('undefined'==typeof _0x201241[_0x5d34('0x76')]['views']){return _0x26fbe9(new Error(_0x5d34('0x77')));}if(_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x79')]&&_0x5d34('0x1f')==typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){return _0x26fbe9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x201241[_0x5d34('0x31')]===_0x5d34('0x7b')){if(_0x5d34('0x1f')==typeof _0x201241['parameters']['scriptName']){return _0x26fbe9(new Error(_0x5d34('0x7c')));}if(_0x5d34('0x1f')==typeof _0x201241['parameters'][_0x5d34('0x7d')]){return _0x26fbe9(new Error(_0x5d34('0x7e')));}}else{return _0x26fbe9(new Error(_0x5d34('0x7f')));}var _0xdd6d60=_0x201241['name'];var _0x45ba0b=_0x201241[_0x5d34('0x80')];var _0x139dd8=_0x201241[_0x5d34('0x31')];var _0x321e3b=_0x201241[_0x5d34('0x81')]?_0x201241['sidebar']:_0x5d34('0x82');var _0x3122ad=_0x201241[_0x5d34('0x83')]?_0x201241[_0x5d34('0x83')]:_0x5d34('0x84');var _0x35e03='';var _0x11fd91='';var _0x5e8412='';var _0x1d071b='';var _0x329270=_0x201241['version'];if(_0x139dd8===_0x5d34('0x85')){if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')]['admin']){var _0xcd332a=_0x201241[_0x5d34('0x76')]['views'][_0x5d34('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xcd332a)){_0x35e03=path[_0x5d34('0x59')]('plugins',_0x3279c3,_0x27d322[0x0],_0xcd332a);}else{_0x35e03=_0xcd332a;}}else{logger[_0x5d34('0x63')](_0x5d34('0x87'));}if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){var _0xbd1a60=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xbd1a60)){_0x11fd91=path[_0x5d34('0x59')]('plugins',_0x3279c3,_0x27d322[0x0],_0xbd1a60);}else{_0x11fd91=_0xbd1a60;}}else{logger[_0x5d34('0x63')](_0x5d34('0x88'));}}else if(_0x139dd8===_0x5d34('0x7b')){_0x5e8412=_0x201241[_0x5d34('0x76')][_0x5d34('0x89')];_0x1d071b=_0x201241[_0x5d34('0x76')][_0x5d34('0x7d')];if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')]){if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')]['views'][_0x5d34('0x79')]){var _0xcd332a=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x5d34('0x86')](_0xcd332a)){_0x35e03=path['join'](_0x5d34('0x8a'),_0x3279c3,_0x27d322[0x0],_0xcd332a);}else{_0x35e03=_0xcd332a;}}if(_0x5d34('0x1f')!=typeof _0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')]){var _0xbd1a60=_0x201241[_0x5d34('0x76')][_0x5d34('0x78')][_0x5d34('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbd1a60)){_0x11fd91=path['join'](_0x5d34('0x8a'),_0x3279c3,_0x27d322[0x0],_0xbd1a60);}else{_0x11fd91=_0xbd1a60;}}}}var _0x669e54={'name':_0xdd6d60,'description':_0x45ba0b,'path':path[_0x5d34('0x59')](_0x3279c3,_0x27d322[0x0]),'type':_0x139dd8,'sidebar':_0x321e3b,'icon':_0x3122ad,'adminUrl':_0x35e03,'agentUrl':_0x11fd91,'scriptName':_0x5e8412,'scriptPath':_0x1d071b,'version':_0x329270};removeReferences(_0x396463,null);return db[_0x5d34('0x43')]['create'](_0x669e54)[_0x5d34('0x27')](function(_0x2849d8){var _0x4160c6={'role':_0x1debc6[_0x5d34('0x8b')]['role'],'userProfileId':_0x1debc6[_0x5d34('0x8b')][_0x5d34('0x8c')]};if(!_0x4160c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4160c6[_0x5d34('0x8d')]===_0x5d34('0x8e')){var _0x3b43f4=_0x2849d8['get']({'plain':!![]});return db['UserProfileSection'][_0x5d34('0x49')]({'where':{'name':_0x5d34('0x8f'),'userProfileId':_0x4160c6[_0x5d34('0x8c')]},'raw':!![]})[_0x5d34('0x27')](function(_0x260b4b){if(_0x260b4b&&_0x260b4b[_0x5d34('0x90')]===0x0){return db[_0x5d34('0x28')][_0x5d34('0x91')]({'name':_0x3b43f4['name'],'resourceId':_0x3b43f4['id'],'type':_0x260b4b[_0x5d34('0x2b')],'sectionId':_0x260b4b['id']},{})['then'](function(){return _0x2849d8;});}else{return _0x2849d8;}})['catch'](function(_0x59950d){logger[_0x5d34('0x52')](_0x5d34('0x92'),_0x59950d);throw _0x59950d;});}return _0x2849d8;})[_0x5d34('0x27')](respondWithResult(_0x233302,null))[_0x5d34('0x4a')](handleError(_0x233302,null));}});}catch(_0x365f13){_0x233302[_0x5d34('0x1c')](0x1f4)[_0x5d34('0x2c')](_0x365f13);}};function removeReferences(_0x548591,_0x5700d6){try{if(_0x548591){fs[_0x5d34('0x61')](_0x548591);logger[_0x5d34('0x63')](_0x5d34('0x93'));}if(_0x5700d6){rimraf(_0x5700d6,function(){});logger[_0x5d34('0x63')](_0x5d34('0x94'));}}catch(_0x5a9c30){logger[_0x5d34('0x52')](_0x5a9c30);}}exports[_0x5d34('0x95')]=function(_0x41e6c8,_0x1d9df9,_0x1d72bd){return db[_0x5d34('0x43')]['find']({'where':{'id':_0x41e6c8[_0x5d34('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d9df9,null))[_0x5d34('0x27')](saveUpdates(_0x41e6c8[_0x5d34('0x8b')],null))[_0x5d34('0x27')](respondWithResult(_0x1d9df9,null))['catch'](handleError(_0x1d9df9,null));};exports[_0x5d34('0x96')]=function(_0x212303,_0x7ad32b,_0x3ae242){return db[_0x5d34('0x43')][_0x5d34('0x49')]({'where':{'id':_0x212303[_0x5d34('0x47')]['id']}})[_0x5d34('0x27')](function(_0x23cb50){if(_0x23cb50){return _0x23cb50[_0x5d34('0x26')]();}})[_0x5d34('0x27')](function(_0x5215d7){rimraf(path['join'](config[_0x5d34('0x4c')],_0x5d34('0x4d'),path[_0x5d34('0x5a')](_0x5215d7[_0x5d34('0x7')])),function(){});return _0x5215d7;})['then'](handleEntityNotFound(_0x7ad32b,null))[_0x5d34('0x27')](respondWithStatusCode(_0x7ad32b,null))[_0x5d34('0x4a')](handleError(_0x7ad32b,null));};exports[_0x5d34('0x97')]=function(_0x1187f4,_0x299e80,_0x4d21e8){return BPromise['resolve']()[_0x5d34('0x27')](function(){if(!_0x1187f4[_0x5d34('0x34')]['path']){throw new Error(_0x5d34('0x98'));}if(!_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')]){throw new Error(_0x5d34('0x9a'));}var _0x1e8cb8=_0x1187f4[_0x5d34('0x34')]['hostname']?_0x1187f4['query'][_0x5d34('0x9b')]+':'+_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')]:'http://localhost:'+_0x1187f4[_0x5d34('0x34')][_0x5d34('0x99')];var _0x5cc3db=_0x1187f4['query'][_0x5d34('0x9c')]?_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9c')]:!![];var _0x715720=_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9d')]?_0x1187f4[_0x5d34('0x34')][_0x5d34('0x9d')]:null;var _0x5d2349={'method':_0x1187f4[_0x5d34('0x9e')],'uri':util[_0x5d34('0x9f')]('%s%s',_0x1e8cb8,_0x1187f4['query']['path']),'json':_0x5cc3db,'resolveWithFullResponse':!![],'encoding':_0x715720,'qs':_0x1187f4[_0x5d34('0x34')]};if(_0x1187f4[_0x5d34('0xa0')]){_0x5d2349[_0x5d34('0xa0')]=_0x1187f4[_0x5d34('0xa0')];if(_0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa1')]){delete _0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa1')];}}if(_0x5d2349['headers']['content-type']){delete _0x5d2349[_0x5d34('0xa0')][_0x5d34('0xa2')];}return rp(_0x5d2349);})['then'](function(_0x730039){if(_0x730039){_0x299e80[_0x5d34('0x22')](_0x730039[_0x5d34('0xa0')]);logger['info'](_0x730039[_0x5d34('0x8b')]);if(_[_0x5d34('0xa3')](_0x1187f4['query'][_0x5d34('0x7')],_0x5d34('0x4b'))&&_0x730039[_0x5d34('0xa4')]==0x1f4){return _0x299e80[_0x5d34('0x29')](_0x730039[_0x5d34('0xa4')]);}else{return _0x299e80[_0x5d34('0x1c')](_0x730039[_0x5d34('0xa4')])['send'](_0x730039['body']);}}else{return _0x299e80[_0x5d34('0x29')](0xc8);}})[_0x5d34('0x4a')](handleError(_0x299e80,null));};exports['webhookPost']=function(_0x15d28b,_0x387a24,_0x3d6afd){return BPromise[_0x5d34('0xa5')]()[_0x5d34('0x27')](function(){if(!_0x15d28b[_0x5d34('0x34')][_0x5d34('0x7')]){throw new Error(_0x5d34('0x98'));}if(!_0x15d28b[_0x5d34('0x34')]['port']){throw new Error(_0x5d34('0x9a'));}var _0x3bf3a2=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9b')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9b')]+':'+_0x15d28b[_0x5d34('0x34')][_0x5d34('0x99')]:_0x5d34('0xa6')+_0x15d28b['query'][_0x5d34('0x99')];var _0x51cf39=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9c')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9c')]:!![];var _0x49e9d3=_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9d')]?_0x15d28b[_0x5d34('0x34')][_0x5d34('0x9d')]:null;var _0xd5fcac={'method':_0x15d28b[_0x5d34('0x9e')],'uri':util[_0x5d34('0x9f')](_0x5d34('0xa7'),_0x3bf3a2,_0x15d28b[_0x5d34('0x34')][_0x5d34('0x7')]),'json':_0x51cf39,'resolveWithFullResponse':!![],'encoding':_0x49e9d3,'body':_0x15d28b[_0x5d34('0x8b')]};if(_0x15d28b['headers']){_0xd5fcac['headers']=_0x15d28b[_0x5d34('0xa0')];if(_0xd5fcac['headers']['content-length']){delete _0xd5fcac['headers'][_0x5d34('0xa1')];}}if(_0xd5fcac[_0x5d34('0xa0')]['content-type']){delete _0xd5fcac[_0x5d34('0xa0')][_0x5d34('0xa2')];}return rp(_0xd5fcac);})[_0x5d34('0x27')](function(_0x313e75){if(_0x313e75){_0x387a24['set'](_0x313e75[_0x5d34('0xa0')]);logger['info'](_0x313e75[_0x5d34('0x8b')]);return _0x387a24['status'](_0x313e75[_0x5d34('0xa4')])['send'](_0x313e75[_0x5d34('0x8b')]);}else{return _0x387a24[_0x5d34('0x29')](0xc8);}})[_0x5d34('0x4a')](handleError(_0x387a24,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 24a4c92..33df069 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 _0x6869=['hook','exports','events','../../mysqldb','Plugin','save','emit','hasOwnProperty'];(function(_0x1349e6,_0x119138){var _0x4762d0=function(_0x21d60c){while(--_0x21d60c){_0x1349e6['push'](_0x1349e6['shift']());}};_0x4762d0(++_0x119138);}(_0x6869,0xe2));var _0x9686=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6869[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0x9686('0x0'));var Plugin=require(_0x9686('0x1'))['db'][_0x9686('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9686('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10b5dd){return function(_0x1214bf,_0x3afe82,_0x2a1a62){PluginEvents[_0x9686('0x4')](_0x10b5dd+':'+_0x1214bf['id'],_0x1214bf);PluginEvents['emit'](_0x10b5dd,_0x1214bf);_0x2a1a62(null);};}for(var e in events){if(events[_0x9686('0x5')](e)){var event=events[e];Plugin[_0x9686('0x6')](e,emitEvent(event));}}module[_0x9686('0x7')]=PluginEvents; \ No newline at end of file +var _0x3eea=['emit','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x3b5b02,_0x34cd1f){var _0x3fd6c9=function(_0x281f67){while(--_0x281f67){_0x3b5b02['push'](_0x3b5b02['shift']());}};_0x3fd6c9(++_0x34cd1f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3d81ba,_0x5c2b7c){_0x3d81ba=_0x3d81ba-0x0;var _0x476ae4=_0x3eea[_0x3d81ba];return _0x476ae4;};'use strict';var EventEmitter=require(_0xa3ee('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa3ee('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xa3ee('0x2')](0x0);var events={'afterCreate':_0xa3ee('0x3'),'afterUpdate':_0xa3ee('0x4'),'afterDestroy':_0xa3ee('0x5')};function emitEvent(_0x269141){return function(_0x104913,_0x35ed7d,_0x23c42d){PluginEvents[_0xa3ee('0x6')](_0x269141+':'+_0x104913['id'],_0x104913);PluginEvents[_0xa3ee('0x6')](_0x269141,_0x104913);_0x23c42d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa3ee('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1ebd48d..1cddbba 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 _0x0c84=['rimraf','../../config/environment','exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x19893e,_0x6ecb5){var _0x374ba2=function(_0x190a98){while(--_0x190a98){_0x19893e['push'](_0x19893e['shift']());}};_0x374ba2(++_0x6ecb5);}(_0x0c84,0xad));var _0x40c8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0c84[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x40c8('0x0'));var util=require(_0x40c8('0x1'));var logger=require(_0x40c8('0x2'))(_0x40c8('0x3'));var moment=require('moment');var BPromise=require(_0x40c8('0x4'));var rp=require(_0x40c8('0x5'));var fs=require('fs');var path=require(_0x40c8('0x6'));var rimraf=require(_0x40c8('0x7'));var config=require(_0x40c8('0x8'));var attributes=require('./plugin.attributes');module[_0x40c8('0x9')]=function(_0x2ad3ab,_0x227b53){return _0x2ad3ab[_0x40c8('0xa')](_0x40c8('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4927=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ea218,_0x48c42b){var _0x15b538=function(_0xddc22f){while(--_0xddc22f){_0x2ea218['push'](_0x2ea218['shift']());}};_0x15b538(++_0x48c42b);}(_0x4927,0x122));var _0x7492=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4927[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var logger=require(_0x7492('0x2'))(_0x7492('0x3'));var moment=require(_0x7492('0x4'));var BPromise=require(_0x7492('0x5'));var rp=require(_0x7492('0x6'));var fs=require('fs');var path=require(_0x7492('0x7'));var rimraf=require(_0x7492('0x8'));var config=require(_0x7492('0x9'));var attributes=require(_0x7492('0xa'));module[_0x7492('0xb')]=function(_0x110eca,_0x276317){return _0x110eca[_0x7492('0xc')](_0x7492('0xd'),attributes,{'tableName':_0x7492('0xe'),'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 bcfc14e..a4aa58e 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 _0xa715=['Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./plugin.socket','then'];(function(_0x9bd1eb,_0x24ccb4){var _0x51b468=function(_0x2b5e79){while(--_0x2b5e79){_0x9bd1eb['push'](_0x9bd1eb['shift']());}};_0x51b468(++_0x24ccb4);}(_0xa715,0x1b4));var _0x5a71=function(_0x1747b5,_0x47ab66){_0x1747b5=_0x1747b5-0x0;var _0x567372=_0xa715[_0x1747b5];return _0x567372;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5a71('0x0'));var rs=require(_0x5a71('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a71('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a71('0x3'))(_0x5a71('0x4'));var config=require(_0x5a71('0x5'));var jayson=require(_0x5a71('0x6'));var client=jayson[_0x5a71('0x7')][_0x5a71('0x8')]({'port':0x232a});config['redis']=_[_0x5a71('0x9')](config[_0x5a71('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a71('0xb'))(new Redis(config[_0x5a71('0xa')]));require(_0x5a71('0xc'))['register'](socket);function respondWithRpcPromise(_0x3c6be2,_0x1d1214,_0x38647d){return new BPromise(function(_0x5a4f3a,_0x548dd7){return client['request'](_0x3c6be2,_0x38647d)[_0x5a71('0xd')](function(_0x251167){logger['info'](_0x5a71('0xe'),_0x1d1214,_0x5a71('0xf'));logger[_0x5a71('0x10')](_0x5a71('0x11'),_0x1d1214,_0x5a71('0xf'),JSON[_0x5a71('0x12')](_0x251167));if(_0x251167['error']){if(_0x251167[_0x5a71('0x13')][_0x5a71('0x14')]===0x1f4){logger[_0x5a71('0x13')]('Plugin,\x20%s,\x20%s',_0x1d1214,_0x251167[_0x5a71('0x13')][_0x5a71('0x15')]);return _0x548dd7(_0x251167[_0x5a71('0x13')][_0x5a71('0x15')]);}logger[_0x5a71('0x13')]('Plugin,\x20%s,\x20%s',_0x1d1214,_0x251167[_0x5a71('0x13')][_0x5a71('0x15')]);return _0x5a4f3a(_0x251167[_0x5a71('0x13')][_0x5a71('0x15')]);}else{logger[_0x5a71('0x16')]('Plugin,\x20%s,\x20%s',_0x1d1214,_0x5a71('0xf'));_0x5a4f3a(_0x251167[_0x5a71('0x17')][_0x5a71('0x15')]);}})[_0x5a71('0x18')](function(_0x2f6268){logger[_0x5a71('0x13')](_0x5a71('0xe'),_0x1d1214,_0x2f6268);_0x548dd7(_0x2f6268);});});}exports[_0x5a71('0x19')]=function(_0x1b3bd9){var _0x4243c3=this;return new Promise(function(_0x2b3566,_0x24cc01){return db[_0x5a71('0x1a')]['create'](_0x1b3bd9[_0x5a71('0x1b')],{'raw':_0x1b3bd9[_0x5a71('0x1c')]?_0x1b3bd9[_0x5a71('0x1c')][_0x5a71('0x1d')]===undefined?!![]:![]:!![]})[_0x5a71('0xd')](function(_0x468346){logger[_0x5a71('0x16')](_0x5a71('0x19'),_0x1b3bd9);logger[_0x5a71('0x10')](_0x5a71('0x19'),_0x1b3bd9,JSON[_0x5a71('0x12')](_0x468346));_0x2b3566(_0x468346);})[_0x5a71('0x18')](function(_0x187919){logger[_0x5a71('0x13')]('CreatePlugin',_0x187919[_0x5a71('0x15')],_0x1b3bd9);_0x24cc01(_0x4243c3['error'](0x1f4,_0x187919[_0x5a71('0x15')]));});});}; \ No newline at end of file +var _0x28f2=['CreatePlugin','Plugin','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4598ef,_0x1dd7c9){var _0x346a13=function(_0x369c1a){while(--_0x369c1a){_0x4598ef['push'](_0x4598ef['shift']());}};_0x346a13(++_0x1dd7c9);}(_0x28f2,0x193));var _0x228f=function(_0x44c209,_0x8c55f0){_0x44c209=_0x44c209-0x0;var _0x1ffd92=_0x28f2[_0x44c209];return _0x1ffd92;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});config[_0x228f('0xc')]=_['defaults'](config[_0x228f('0xc')],{'host':_0x228f('0xd'),'port':0x18eb});var socket=require(_0x228f('0xe'))(new Redis(config['redis']));require(_0x228f('0xf'))['register'](socket);function respondWithRpcPromise(_0x212c90,_0x2dfd07,_0x4e26fe){return new BPromise(function(_0x3884c6,_0x40aca5){return client[_0x228f('0x10')](_0x212c90,_0x4e26fe)[_0x228f('0x11')](function(_0x3aa9bf){logger['info'](_0x228f('0x12'),_0x2dfd07,_0x228f('0x13'));logger[_0x228f('0x14')](_0x228f('0x15'),_0x2dfd07,_0x228f('0x13'),JSON[_0x228f('0x16')](_0x3aa9bf));if(_0x3aa9bf[_0x228f('0x17')]){if(_0x3aa9bf[_0x228f('0x17')]['code']===0x1f4){logger[_0x228f('0x17')](_0x228f('0x12'),_0x2dfd07,_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);return _0x40aca5(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}logger[_0x228f('0x17')]('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x3aa9bf[_0x228f('0x17')]['message']);return _0x3884c6(_0x3aa9bf[_0x228f('0x17')][_0x228f('0x18')]);}else{logger[_0x228f('0x19')]('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x228f('0x13'));_0x3884c6(_0x3aa9bf['result'][_0x228f('0x18')]);}})['catch'](function(_0x30cbc2){logger['error']('Plugin,\x20%s,\x20%s',_0x2dfd07,_0x30cbc2);_0x40aca5(_0x30cbc2);});});}exports[_0x228f('0x1a')]=function(_0x52da36){var _0x302d54=this;return new Promise(function(_0x139373,_0x1294a8){return db[_0x228f('0x1b')][_0x228f('0x1c')](_0x52da36[_0x228f('0x1d')],{'raw':_0x52da36[_0x228f('0x1e')]?_0x52da36[_0x228f('0x1e')][_0x228f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1e96d4){logger[_0x228f('0x19')](_0x228f('0x1a'),_0x52da36);logger[_0x228f('0x14')](_0x228f('0x1a'),_0x52da36,JSON[_0x228f('0x16')](_0x1e96d4));_0x139373(_0x1e96d4);})[_0x228f('0x20')](function(_0x20c111){logger[_0x228f('0x17')]('CreatePlugin',_0x20c111[_0x228f('0x18')],_0x52da36);_0x1294a8(_0x302d54[_0x228f('0x17')](0x1f4,_0x20c111[_0x228f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8cf0360..0811c12 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 _0x652f=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x2f5124,_0x1dd080){var _0x26d1d8=function(_0xef5450){while(--_0xef5450){_0x2f5124['push'](_0x2f5124['shift']());}};_0x26d1d8(++_0x1dd080);}(_0x652f,0xd6));var _0xf652=function(_0x2aed46,_0x512565){_0x2aed46=_0x2aed46-0x0;var _0x4c4114=_0x652f[_0x2aed46];return _0x4c4114;};'use strict';var PluginEvents=require(_0xf652('0x0'));var events=[_0xf652('0x1'),_0xf652('0x2'),_0xf652('0x3')];function createListener(_0xdde66c,_0x38c17f){return function(_0x2ff7ea){_0x38c17f[_0xf652('0x4')](_0xdde66c,_0x2ff7ea);};}function removeListener(_0x52ccbd,_0x318f08){return function(){PluginEvents[_0xf652('0x5')](_0x52ccbd,_0x318f08);};}exports[_0xf652('0x6')]=function(_0x2cf6a2){for(var _0x55d546=0x0,_0xc54df6=events['length'];_0x55d546<_0xc54df6;_0x55d546++){var _0xf8d01=events[_0x55d546];var _0x557043=createListener(_0xf652('0x7')+_0xf8d01,_0x2cf6a2);PluginEvents['on'](_0xf8d01,_0x557043);}}; \ No newline at end of file +var _0xd15e=['update','register','length','./plugin.events','save','remove'];(function(_0x4a84d0,_0x461592){var _0x11d0e9=function(_0x50f299){while(--_0x50f299){_0x4a84d0['push'](_0x4a84d0['shift']());}};_0x11d0e9(++_0x461592);}(_0xd15e,0x9f));var _0xed15=function(_0x3aac46,_0x3ce132){_0x3aac46=_0x3aac46-0x0;var _0x4eb896=_0xd15e[_0x3aac46];return _0x4eb896;};'use strict';var PluginEvents=require(_0xed15('0x0'));var events=[_0xed15('0x1'),_0xed15('0x2'),_0xed15('0x3')];function createListener(_0x56288d,_0x19c232){return function(_0x38fa41){_0x19c232['emit'](_0x56288d,_0x38fa41);};}function removeListener(_0x2ef4fe,_0x5d6f02){return function(){PluginEvents['removeListener'](_0x2ef4fe,_0x5d6f02);};}exports[_0xed15('0x4')]=function(_0x3921c3){for(var _0x19e27b=0x0,_0x2e138d=events[_0xed15('0x5')];_0x19e27b<_0x2e138d;_0x19e27b++){var _0x225a35=events[_0x19e27b];var _0x4a9d55=createListener('plugin:'+_0x225a35,_0x3921c3);PluginEvents['on'](_0x225a35,_0x4a9d55);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1af88d7..1fad750 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 _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2d30c6,_0xbaf111){var _0x13c6e1=function(_0x5ebb98){while(--_0x5ebb98){_0x2d30c6['push'](_0x2d30c6['shift']());}};_0x13c6e1(++_0xbaf111);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4c0c77,_0x8df6ec){var _0x2de5ed=function(_0x5a02b7){while(--_0x5a02b7){_0x4c0c77['push'](_0x4c0c77['shift']());}};_0x2de5ed(++_0x8df6ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('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 6606723..ef396b1 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 _0x6f7a=['../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','dump','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','catch','show','params','body','script','join'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1d7035,_0x2b4f81){_0x1d7035=_0x1d7035-0x0;var _0x47bc45=_0x6f7a[_0x1d7035];return _0x47bc45;};'use strict';var _=require(_0xa6f7('0x0'));var pm2=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var path=require('path');var exec=require(_0xa6f7('0x4'))[_0xa6f7('0x5')];var BPromise=require(_0xa6f7('0x6'));function handleEntityNotFound(_0x1da6dc,_0x22e529){return function(_0x1f5922){if(!_0x1f5922){_0x1da6dc[_0xa6f7('0x7')](0x194);;}return _0x1f5922;};}function respondWithResult(_0x20cccd,_0x1fdd5f){_0x1fdd5f=_0x1fdd5f||0xc8;return function(_0x335aaa){if(_0x335aaa){return _0x20cccd[_0xa6f7('0x8')](_0x1fdd5f)['json'](_0x335aaa);}return null;};}function handleError(_0x4b4f9e,_0x30f2a7){_0x30f2a7=_0x30f2a7||0x1f4;return function(_0x2674c9){logger[_0xa6f7('0x9')](_0x2674c9[_0xa6f7('0xa')]);if(_0x2674c9[_0xa6f7('0xb')]){delete _0x2674c9['name'];}_0x4b4f9e['status'](_0x30f2a7)[_0xa6f7('0xc')](_0x2674c9);};}function execChildProcess(){return new BPromise(function(_0x225da4,_0x4e30bc){exec(_0xa6f7('0xd'),function(_0x5623bf,_0x315096,_0x1303c3){logger[_0xa6f7('0xe')](_0x315096);logger[_0xa6f7('0xe')](_0x1303c3);if(_0x5623bf){logger['error'](_0x5623bf);return _0x4e30bc(_0x5623bf);}return _0x225da4(_0x315096);});});}exports[_0xa6f7('0xf')]=function(_0x532352,_0x25b48f){return pm2[_0xa6f7('0x10')]()[_0xa6f7('0x11')](function(_0x4d3d59){if(_0x4d3d59){var _0x34c02d=_['reject'](_0x4d3d59,function(_0x41bc4d){return _0x41bc4d['name']===_0xa6f7('0x12')||_0x41bc4d[_0xa6f7('0xb')]===_0xa6f7('0x13');});return{'rows':_0x34c02d,'count':_0x34c02d['length']};}return null;})[_0xa6f7('0x11')](respondWithResult(_0x25b48f,null))[_0xa6f7('0x14')](handleError(_0x25b48f,null));};exports[_0xa6f7('0x15')]=function(_0x2401b9,_0x5681d5){return pm2['describe'](_0x2401b9[_0xa6f7('0x16')]['id'])['then'](respondWithResult(_0x5681d5,null))[_0xa6f7('0x11')](handleEntityNotFound(_0x5681d5,null))[_0xa6f7('0x14')](handleError(_0x5681d5,null));};exports['create']=function(_0x18fc4a,_0xb2cfaa){if(_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0xb')]&&_0x18fc4a[_0xa6f7('0x17')][_0xa6f7('0x18')]){var _0x4887ad=path[_0xa6f7('0x19')](__dirname,_0xa6f7('0x1a'),_0x18fc4a['body']['script']);var _0x5ddc8d=process[_0xa6f7('0x1b')]();process[_0xa6f7('0x1c')](path['dirname'](_0x4887ad));return execChildProcess()['then'](function(_0x50e2be){process[_0xa6f7('0x1c')](_0x5ddc8d);return pm2[_0xa6f7('0x1d')]({'name':_0x18fc4a[_0xa6f7('0x17')]['name'],'script':_0x4887ad});})['then'](function(_0x2f4907){pm2['dump']();return _0x2f4907[0x0];})['then'](respondWithResult(_0xb2cfaa,0xc9))[_0xa6f7('0x14')](handleError(_0xb2cfaa,null));}else{return _0xb2cfaa['status'](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x1e')});}};exports[_0xa6f7('0x1f')]=function(_0x2b4c6c,_0x3a3508){if(_0x2b4c6c['body']['id']){delete _0x2b4c6c['body']['id'];}var _0x1c419b={'online':_0xa6f7('0x20'),'stopped':'stop'};if(_0x1c419b[_0xa6f7('0x21')](_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')])){return pm2[_0x1c419b[_0x2b4c6c[_0xa6f7('0x17')][_0xa6f7('0x8')]]](_0x2b4c6c[_0xa6f7('0x16')]['id'])[_0xa6f7('0x11')](respondWithResult(_0x3a3508,0xc8))[_0xa6f7('0x14')](handleError(_0x3a3508,null));}else{return _0x3a3508[_0xa6f7('0x8')](0x1f4)[_0xa6f7('0xc')]({'message':_0xa6f7('0x22')});}};exports[_0xa6f7('0x23')]=function(_0x52f9c1,_0x442ccf){if(_0x52f9c1[_0xa6f7('0x17')]['id']){delete _0x52f9c1['body']['id'];}if(_0x52f9c1[_0xa6f7('0x16')]['id']){return pm2[_0xa6f7('0x24')](_0x52f9c1['params']['id'])['then'](function(_0x176378){pm2[_0xa6f7('0x25')]();return _0x176378[0x0];})[_0xa6f7('0x11')](respondWithResult(_0x442ccf,null))[_0xa6f7('0x14')](handleError(_0x442ccf,null));}else{return _0x442ccf[_0xa6f7('0x8')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x4517bc,_0xe8a21e){var _0x5a90ba=function(_0x1ab4a9){while(--_0x1ab4a9){_0x4517bc['push'](_0x4517bc['shift']());}};_0x5a90ba(++_0xe8a21e);}(_0x7072,0x138));var _0x2707=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7072[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4ebac90..966fae1 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0276=['get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x680f86,_0x381ce8){var _0x680b96=function(_0x230163){while(--_0x230163){_0x680f86['push'](_0x680f86['shift']());}};_0x680b96(++_0x381ce8);}(_0x0276,0xa1));var _0x6027=function(_0x546125,_0xfa3bf){_0x546125=_0x546125-0x0;var _0x77b546=_0x0276[_0x546125];return _0x77b546;};'use strict';var express=require(_0x6027('0x0'));var router=express[_0x6027('0x1')]();var auth=require(_0x6027('0x2'));var controller=require(_0x6027('0x3'));router[_0x6027('0x4')](_0x6027('0x5'),auth[_0x6027('0x6')](),controller[_0x6027('0x7')]);router[_0x6027('0x4')](_0x6027('0x8'),auth[_0x6027('0x6')](),controller[_0x6027('0x9')]);module[_0x6027('0xa')]=router; \ No newline at end of file +var _0xf087=['exports','../../components/auth/service','get','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x4214c2,_0x275024){var _0x6769b=function(_0x5ecbb1){while(--_0x5ecbb1){_0x4214c2['push'](_0x4214c2['shift']());}};_0x6769b(++_0x275024);}(_0xf087,0x1f2));var _0x7f08=function(_0xe08342,_0xca4ab5){_0xe08342=_0xe08342-0x0;var _0x6faba1=_0xf087[_0xe08342];return _0x6faba1;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x7f08('0x0'));var controller=require('./realtime.controller');router[_0x7f08('0x1')]('/agents',auth[_0x7f08('0x2')](),controller[_0x7f08('0x3')]);router[_0x7f08('0x1')](_0x7f08('0x4'),auth[_0x7f08('0x2')](),controller[_0x7f08('0x5')]);module[_0x7f08('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 3ada381..3c76b96 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d39=['isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','fields','join','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','role','agent','raw','sequelize','FIELD(id,','forEach','push','Pause','where','merge','user','online','extraQueryConditions','assign','getResources','filterAgentAttributes','getAgentStatus','pause','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','catch','startCase','Queue','voice','type','outbound','dialActive','dialMethod','getOptions','userProfileId','name','filter','UserProfile','findAndCountAll','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','Content-Range','getChannels','globalQueueFilter','globalStatusFilter','query','*pause','resolve','channel'];(function(_0x42b541,_0xd554cd){var _0x70a479=function(_0x384a84){while(--_0x384a84){_0x42b541['push'](_0x42b541['shift']());}};_0x70a479(++_0xd554cd);}(_0x3d39,0x179));var _0x93d3=function(_0x4711a7,_0x1ca2cf){_0x4711a7=_0x4711a7-0x0;var _0x5d5f53=_0x3d39[_0x4711a7];return _0x5d5f53;};'use strict';var _=require(_0x93d3('0x0'));var util=require(_0x93d3('0x1'));var rta=require(_0x93d3('0x2'));var rtq=require(_0x93d3('0x3'));var qs=require(_0x93d3('0x4'));var utils=require(_0x93d3('0x5'));var db=require(_0x93d3('0x6'))['db'];var APIBadRequestError=require(_0x93d3('0x7'))[_0x93d3('0x8')];var APIHandleError=require('../../errors/api')[_0x93d3('0x9')];function respondWithFilteredResult(_0x3ee0d1,_0x9a8acf){return function(_0x531303){if(_0x531303){var _0x1bc2b3=typeof _0x9a8acf[_0x93d3('0xa')]===_0x93d3('0xb')&&typeof _0x9a8acf[_0x93d3('0xc')]===_0x93d3('0xb');var _0x6c66db=_0x531303[_0x93d3('0xd')];var _0x59f4f4=_0x1bc2b3?0x0:_0x9a8acf['offset'];var _0x23396d=_0x1bc2b3?_0x531303[_0x93d3('0xd')]:_0x9a8acf[_0x93d3('0xa')]+_0x9a8acf[_0x93d3('0xc')];var _0x2af582;if(_0x23396d>=_0x6c66db){_0x23396d=_0x6c66db;_0x2af582=0xc8;}else{_0x2af582=0xce;}_0x3ee0d1[_0x93d3('0xe')](_0x2af582);return _0x3ee0d1['set'](_0x93d3('0xf'),_0x59f4f4+'-'+_0x23396d+'/'+_0x6c66db)['json'](_0x531303);}return null;};}exports['getAgents']=function(_0xa40838,_0x376ce8){var _0x399bdb={'count':0x0,'rows':[]};var _0x1d8c61={};var _0x1a2ad2;var _0x33160d=utils[_0x93d3('0x10')]();var _0x323d50;var _0x2a2aa7;var _0x163ff6=_0xa40838['query'][_0x93d3('0x11')];var _0x3556e9=_0xa40838['query'][_0x93d3('0x12')];var _0x427bd3=_0xa40838[_0x93d3('0x13')]['pauseTypeFilter'];var _0x143d5e=_0x3556e9==='pause'||_0x3556e9===_0x93d3('0x14')?!![]:![];var _0x54c3bc=[];var _0x2651f6;var _0x1b3c7b;Promise[_0x93d3('0x15')]()['then'](function(){if(_0xa40838['query'][_0x93d3('0x16')]){if(!utils[_0x93d3('0x17')](_0xa40838[_0x93d3('0x13')]['channel'])){throw new APIBadRequestError(util[_0x93d3('0x18')](_0x93d3('0x19'),_0xa40838[_0x93d3('0x13')][_0x93d3('0x16')]));}_0x1a2ad2=_0xa40838[_0x93d3('0x13')][_0x93d3('0x16')][_0x93d3('0x1a')]();}if(!_0xa40838[_0x93d3('0x13')]['sort']||!_0xa40838[_0x93d3('0x13')][_0x93d3('0x1b')][_0x93d3('0x1c')](_0x93d3('0x1d'))){_0xa40838[_0x93d3('0x13')][_0x93d3('0x1b')]=rta['validateSortParameter'](_0xa40838[_0x93d3('0x13')][_0x93d3('0x1b')]);return;}var _0x4b7aeb=rta['getUpdatedSortOptions'](_0xa40838[_0x93d3('0x13')][_0x93d3('0x1b')]);_0xa40838[_0x93d3('0x13')][_0x93d3('0x1b')]=_0x4b7aeb[_0x93d3('0x1e')][_0x93d3('0x1f')](',');_0x2651f6=_0x4b7aeb['order'];})[_0x93d3('0x20')](function(){if(!_0x163ff6){return[];}return rta[_0x93d3('0x21')](_0x163ff6,_0x1a2ad2);})[_0x93d3('0x20')](function(_0x2759c1){_0x54c3bc=_0x2759c1;return rta[_0x93d3('0x22')]();})[_0x93d3('0x20')](function(_0x5732e8){_0x2a2aa7=_0x5732e8[_0x93d3('0x23')];if((!_0x3556e9||_0x143d5e)&&!_0x2651f6){return _0x54c3bc;}if(_0x2651f6&&!_0x3556e9){return rta[_0x93d3('0x24')](_0x2a2aa7,_0x54c3bc,_0x2651f6);}else{return rta[_0x93d3('0x25')](_0x2a2aa7,_0x54c3bc,_0x3556e9);}})[_0x93d3('0x20')](function(_0x58d4c3){_0x54c3bc=_0x58d4c3;var _0x417a07=![];if(_0x54c3bc[_0x93d3('0x26')]===0x0){if(_0x163ff6||_0x3556e9){_0x417a07=!![];}if(_0x143d5e){_0x417a07=![];}}if(_0x417a07){return _0x399bdb;}var _0x5a3813=_[_0x93d3('0x27')](db[_0x93d3('0x28')][_0x93d3('0x29')],function(_0x552e20){return{'name':_0x552e20[_0x93d3('0x2a')],'type':_0x552e20['type']['key']};});_0xa40838['query'][_0x93d3('0x2b')]=_0x93d3('0x2c');_0x1d8c61=qs['getOptions'](_0x5a3813,_0xa40838);_0x1d8c61[_0x93d3('0x2d')]=!![];var _0x356805=[];if(_0x54c3bc[_0x93d3('0x26')]>0x0){_0x356805['push']({'id':{'$in':_0x54c3bc}});if(_0x2651f6&&!_0x3556e9){_0x1b3c7b=[db[_0x93d3('0x2e')]['literal'](_0x93d3('0x2f')+_0x54c3bc+')')];_0x1d8c61['order']=_0x1b3c7b;}}if(_0x143d5e){_0x33160d[_0x93d3('0x30')](function(_0x157fa5){var _0x104b97=!![];if(_0x3556e9===_0x93d3('0x14')&&_0x1a2ad2!==_0x157fa5){_0x104b97=![];}_0x356805[_0x93d3('0x31')]({[_0x157fa5+_0x93d3('0x32')]:_0x104b97});});if(_0x427bd3){_0x356805[_0x93d3('0x31')]({'pauseType':_0x427bd3});}}else if(_0x3556e9){_0x33160d[_0x93d3('0x30')](function(_0x2e11ac){_0x356805['push']({[_0x2e11ac+_0x93d3('0x32')]:![]});});}_0x1d8c61[_0x93d3('0x33')]=_[_0x93d3('0x34')](_0x1d8c61[_0x93d3('0x33')],{'$and':_0x356805});if(_0xa40838[_0x93d3('0x35')]['role']===_0x93d3('0x35')){var _0x457f7e={'params':{'id':_0xa40838[_0x93d3('0x35')]['userProfileId']},'query':{'section':'Agents','role':_0x93d3('0x2c'),'raw':!![],'ids':_0x54c3bc,'customSorting':_0x1b3c7b}};if(_0xa40838[_0x93d3('0x13')][_0x93d3('0x36')]){_0x457f7e['query']['online']=!![];}if(_0x143d5e){_0x457f7e['query'][_0x93d3('0x37')]=_0x356805;}_0x457f7e[_0x93d3('0x13')]=Object[_0x93d3('0x38')](_0x457f7e[_0x93d3('0x13')],_0xa40838['query']);return db['UserProfile'][_0x93d3('0x39')](_0x457f7e);}return db[_0x93d3('0x28')]['findAndCountAll'](_0x1d8c61);})['then'](function(_0x4f4ece){_0x399bdb[_0x93d3('0xd')]=_0x4f4ece[_0x93d3('0xd')];_0x323d50=_0x4f4ece[_0x93d3('0x23')];return _0x323d50[_0x93d3('0x27')](function(_0x275ece){var _0x1e185e=_['find'](_0x2a2aa7,['id',_0x275ece['id']]);if(_0x1e185e){var _0x17eb0a=rta[_0x93d3('0x3a')](_0x1e185e);_[_0x93d3('0x34')](_0x275ece,_0x17eb0a);}_0x275ece['globalStatus']=rta[_0x93d3('0x3b')](_0x275ece);if(_0x275ece[_0x93d3('0x1d')][_0x93d3('0x1c')](_0x93d3('0x3c'))){_0x33160d[_0x93d3('0x30')](function(_0x13d408){if(_0x275ece[_0x13d408+_0x93d3('0x32')]){if(_0x13d408==='voice'){if(_0x275ece[_0x93d3('0x3d')]!==_0x93d3('0x3e')){_0x275ece[_0x93d3('0x3d')]='pause';}}else{_0x275ece[_0x13d408+_0x93d3('0x3f')]='pause';}}});}return _0x275ece;});})[_0x93d3('0x20')](function(_0x4c51d3){if(!_0x2651f6||_0x1b3c7b){return _0x4c51d3;}return rta['sortAgentsByStatus'](_0x4c51d3,_0x2651f6);})[_0x93d3('0x20')](function(_0x231af6){var _0x3ba49f=rta[_0x93d3('0x40')]();_0x399bdb[_0x93d3('0x23')]=_0x231af6[_0x93d3('0x27')](function(_0x18e0e5){return _['pick'](_0x18e0e5,_0x3ba49f);});return _0x399bdb;})[_0x93d3('0x20')](respondWithFilteredResult(_0x376ce8,_0x1d8c61))[_0x93d3('0x41')](APIHandleError(_0x376ce8));};exports['getQueues']=function(_0x573290,_0x605cd2){var _0x18808c={'count':0x0,'rows':[]};var _0x668db1={};var _0x549687;var _0xd98eaf;var _0x5293a6;Promise[_0x93d3('0x15')]()[_0x93d3('0x20')](function(){if(_0x573290[_0x93d3('0x13')][_0x93d3('0x16')]){if(!utils[_0x93d3('0x17')](_0x573290[_0x93d3('0x13')][_0x93d3('0x16')])){throw new APIBadRequestError(util['format'](_0x93d3('0x19'),_0x573290[_0x93d3('0x13')][_0x93d3('0x16')]));}_0x549687=_0x573290[_0x93d3('0x13')][_0x93d3('0x16')][_0x93d3('0x1a')]();}var _0x4a481b=_[_0x93d3('0x42')](_0x549687)+_0x93d3('0x43');var _0x598b00=_[_0x93d3('0x27')](db[_0x4a481b]['rawAttributes'],function(_0x4edbac){return{'name':_0x4edbac[_0x93d3('0x2a')],'type':_0x4edbac['type']['key']};});if(!_0x573290['query'][_0x93d3('0x1e')]){var _0x295f89=['id','name'];if(_0x549687===_0x93d3('0x44')){_0x295f89['push'](_0x93d3('0x45'));if(_0x573290[_0x93d3('0x13')][_0x93d3('0x45')]===_0x93d3('0x46')){_0x295f89[_0x93d3('0x31')]([_0x93d3('0x47'),_0x93d3('0x48')]);}}_0x573290[_0x93d3('0x13')][_0x93d3('0x1e')]=_0x295f89[_0x93d3('0x1f')](',');}_0x668db1=qs[_0x93d3('0x49')](_0x598b00,_0x573290);if(_0x573290['user'][_0x93d3('0x2b')]==='user'){var _0xa6a813={'params':{'id':_0x573290[_0x93d3('0x35')][_0x93d3('0x4a')]},'query':{'section':_0x549687===_0x93d3('0x44')&&_0x573290[_0x93d3('0x13')][_0x93d3('0x45')]==='outbound'?'QueueCampaigns':_[_0x93d3('0x42')](_0x549687)+'Queues','type':_0x573290[_0x93d3('0x13')][_0x93d3('0x45')],'nolimit':!![],'sort':_0x93d3('0x4b'),'filter':_0x573290[_0x93d3('0x13')][_0x93d3('0x4c')]}};_0xa6a813['query']=Object[_0x93d3('0x38')](_0xa6a813[_0x93d3('0x13')],_0x573290[_0x93d3('0x13')]);delete _0xa6a813[_0x93d3('0x13')]['id'];return db[_0x93d3('0x4d')][_0x93d3('0x39')](_0xa6a813);}return db[_0x4a481b][_0x93d3('0x4e')](_0x668db1);})[_0x93d3('0x20')](function(_0x4627b5){_0x18808c[_0x93d3('0xd')]=_0x4627b5[_0x93d3('0xd')];_0xd98eaf=_0x4627b5[_0x93d3('0x23')];return rtq['getRealtimeQueues'](_0x573290,_0x549687);})['then'](function(_0x383cb4){_0x5293a6=_0x383cb4[_0x93d3('0x23')];return rtq[_0x93d3('0x4f')](_0xd98eaf,_0x5293a6,_0x549687,_0x573290['query'][_0x93d3('0x45')]);})[_0x93d3('0x20')](function(_0x9a22eb){_0x18808c['rows']=_0x9a22eb;return _0x18808c;})['then'](respondWithFilteredResult(_0x605cd2,_0x668db1))[_0x93d3('0x41')](APIHandleError(_0x605cd2));}; \ No newline at end of file +var _0x500c=['Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','map','rawAttributes','fieldName','type','role','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','Agents','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','includes','voice','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','resolve','toLowerCase','Queue','key','name','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','undefined','count','status','set'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x500c,0x1ab));var _0xc500=function(_0x385dfc,_0x91f31){_0x385dfc=_0x385dfc-0x0;var _0x22ca89=_0x500c[_0x385dfc];return _0x22ca89;};'use strict';var _=require('lodash');var util=require(_0xc500('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xc500('0x1'));var qs=require(_0xc500('0x2'));var utils=require('../../config/utils');var db=require(_0xc500('0x3'))['db'];var APIBadRequestError=require(_0xc500('0x4'))[_0xc500('0x5')];var APIHandleError=require(_0xc500('0x4'))[_0xc500('0x6')];function respondWithFilteredResult(_0x23c77e,_0x4dc516){return function(_0x37c4e8){if(_0x37c4e8){var _0x100a64=typeof _0x4dc516[_0xc500('0x7')]==='undefined'&&typeof _0x4dc516[_0xc500('0x8')]===_0xc500('0x9');var _0x3e1c18=_0x37c4e8[_0xc500('0xa')];var _0x45501f=_0x100a64?0x0:_0x4dc516[_0xc500('0x7')];var _0x2956f3=_0x100a64?_0x37c4e8[_0xc500('0xa')]:_0x4dc516['offset']+_0x4dc516['limit'];var _0x2c69d7;if(_0x2956f3>=_0x3e1c18){_0x2956f3=_0x3e1c18;_0x2c69d7=0xc8;}else{_0x2c69d7=0xce;}_0x23c77e[_0xc500('0xb')](_0x2c69d7);return _0x23c77e[_0xc500('0xc')](_0xc500('0xd'),_0x45501f+'-'+_0x2956f3+'/'+_0x3e1c18)[_0xc500('0xe')](_0x37c4e8);}return null;};}exports[_0xc500('0xf')]=function(_0x14bc5c,_0x43c2c5){var _0x506c10={'count':0x0,'rows':[]};var _0x472c33={};var _0x3f37a6;var _0x2c5459=utils[_0xc500('0x10')]();var _0x1c2b6d;var _0x1e43a5;var _0x4207ab=_0x14bc5c[_0xc500('0x11')]['globalQueueFilter'];var _0x13f640=_0x14bc5c[_0xc500('0x11')][_0xc500('0x12')];var _0x4f95d3=_0x14bc5c[_0xc500('0x11')][_0xc500('0x13')];var _0x3c4b89=_0x13f640===_0xc500('0x14')||_0x13f640===_0xc500('0x15')?!![]:![];var _0x7e4092=[];var _0x33747e;var _0x281a1b;Promise['resolve']()[_0xc500('0x16')](function(){if(_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]){if(!utils[_0xc500('0x18')](_0x14bc5c['query'][_0xc500('0x17')])){throw new APIBadRequestError(util[_0xc500('0x19')](_0xc500('0x1a'),_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]));}_0x3f37a6=_0x14bc5c[_0xc500('0x11')][_0xc500('0x17')]['toLowerCase']();}if(!_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]||!_0x14bc5c[_0xc500('0x11')]['sort']['includes'](_0xc500('0x1c'))){_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]=rta[_0xc500('0x1d')](_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]);return;}var _0x4aadb5=rta['getUpdatedSortOptions'](_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]);_0x14bc5c[_0xc500('0x11')][_0xc500('0x1b')]=_0x4aadb5[_0xc500('0x1e')][_0xc500('0x1f')](',');_0x33747e=_0x4aadb5[_0xc500('0x20')];})[_0xc500('0x16')](function(){if(!_0x4207ab){return[];}return rta[_0xc500('0x21')](_0x4207ab,_0x3f37a6);})[_0xc500('0x16')](function(_0x40d98c){_0x7e4092=_0x40d98c;return rta['getRealtimeAgents']();})[_0xc500('0x16')](function(_0x4740eb){_0x1e43a5=_0x4740eb[_0xc500('0x22')];if((!_0x13f640||_0x3c4b89)&&!_0x33747e){return _0x7e4092;}if(_0x33747e&&!_0x13f640){return rta[_0xc500('0x23')](_0x1e43a5,_0x7e4092,_0x33747e);}else{return rta['getAgentIdsByStatus'](_0x1e43a5,_0x7e4092,_0x13f640);}})['then'](function(_0x11e453){_0x7e4092=_0x11e453;var _0x1e2e77=![];if(_0x7e4092[_0xc500('0x24')]===0x0){if(_0x4207ab||_0x13f640){_0x1e2e77=!![];}if(_0x3c4b89){_0x1e2e77=![];}}if(_0x1e2e77){return _0x506c10;}var _0x3d1509=_[_0xc500('0x25')](db['User'][_0xc500('0x26')],function(_0x4e4002){return{'name':_0x4e4002[_0xc500('0x27')],'type':_0x4e4002[_0xc500('0x28')]['key']};});_0x14bc5c['query'][_0xc500('0x29')]=_0xc500('0x2a');_0x472c33=qs[_0xc500('0x2b')](_0x3d1509,_0x14bc5c);_0x472c33[_0xc500('0x2c')]=!![];var _0x807f61=[];if(_0x7e4092['length']>0x0){_0x807f61[_0xc500('0x2d')]({'id':{'$in':_0x7e4092}});if(_0x33747e&&!_0x13f640){_0x281a1b=[db[_0xc500('0x2e')][_0xc500('0x2f')](_0xc500('0x30')+_0x7e4092+')')];_0x472c33[_0xc500('0x20')]=_0x281a1b;}}if(_0x3c4b89){_0x2c5459[_0xc500('0x31')](function(_0x58eef8){var _0x2d4b4e=!![];if(_0x13f640===_0xc500('0x15')&&_0x3f37a6!==_0x58eef8){_0x2d4b4e=![];}_0x807f61[_0xc500('0x2d')]({[_0x58eef8+_0xc500('0x32')]:_0x2d4b4e});});if(_0x4f95d3){_0x807f61[_0xc500('0x2d')]({'pauseType':_0x4f95d3});}}else if(_0x13f640){_0x2c5459['forEach'](function(_0xcb8e8a){_0x807f61[_0xc500('0x2d')]({[_0xcb8e8a+_0xc500('0x32')]:![]});});}_0x472c33[_0xc500('0x33')]=_[_0xc500('0x34')](_0x472c33[_0xc500('0x33')],{'$and':_0x807f61});if(_0x14bc5c[_0xc500('0x35')][_0xc500('0x29')]===_0xc500('0x35')){var _0x1de9ff={'params':{'id':_0x14bc5c[_0xc500('0x35')]['userProfileId']},'query':{'section':_0xc500('0x36'),'role':_0xc500('0x2a'),'raw':!![],'ids':_0x7e4092,'customSorting':_0x281a1b}};if(_0x14bc5c[_0xc500('0x11')][_0xc500('0x37')]){_0x1de9ff[_0xc500('0x11')][_0xc500('0x37')]=!![];}if(_0x3c4b89){_0x1de9ff[_0xc500('0x11')][_0xc500('0x38')]=_0x807f61;}_0x1de9ff[_0xc500('0x11')]=Object['assign'](_0x1de9ff[_0xc500('0x11')],_0x14bc5c[_0xc500('0x11')]);return db[_0xc500('0x39')][_0xc500('0x3a')](_0x1de9ff);}return db[_0xc500('0x3b')][_0xc500('0x3c')](_0x472c33);})[_0xc500('0x16')](function(_0x108288){_0x506c10[_0xc500('0xa')]=_0x108288[_0xc500('0xa')];_0x1c2b6d=_0x108288['rows'];return _0x1c2b6d[_0xc500('0x25')](function(_0x110ffe){var _0x48d94f=_[_0xc500('0x3d')](_0x1e43a5,['id',_0x110ffe['id']]);if(_0x48d94f){var _0x444d86=rta[_0xc500('0x3e')](_0x48d94f);_[_0xc500('0x34')](_0x110ffe,_0x444d86);}_0x110ffe[_0xc500('0x1c')]=rta[_0xc500('0x3f')](_0x110ffe);if(_0x110ffe['globalStatus'][_0xc500('0x40')]('pause')){_0x2c5459[_0xc500('0x31')](function(_0x59a2c8){if(_0x110ffe[_0x59a2c8+_0xc500('0x32')]){if(_0x59a2c8===_0xc500('0x41')){if(_0x110ffe['voiceStatus']!==_0xc500('0x42')){_0x110ffe[_0xc500('0x43')]=_0xc500('0x14');}}else{_0x110ffe[_0x59a2c8+_0xc500('0x44')]=_0xc500('0x14');}}});}return _0x110ffe;});})[_0xc500('0x16')](function(_0x173ff7){if(!_0x33747e||_0x281a1b){return _0x173ff7;}return rta[_0xc500('0x45')](_0x173ff7,_0x33747e);})[_0xc500('0x16')](function(_0x3f1e3e){var _0x1a63af=rta[_0xc500('0x46')]();_0x506c10['rows']=_0x3f1e3e[_0xc500('0x25')](function(_0x356bd9){return _[_0xc500('0x47')](_0x356bd9,_0x1a63af);});return _0x506c10;})[_0xc500('0x16')](respondWithFilteredResult(_0x43c2c5,_0x472c33))['catch'](APIHandleError(_0x43c2c5));};exports[_0xc500('0x48')]=function(_0x3aefe3,_0x3e773e){var _0x5ac941={'count':0x0,'rows':[]};var _0x51a265={};var _0x31481a;var _0x5825d4;var _0x4cd13a;Promise[_0xc500('0x49')]()[_0xc500('0x16')](function(){if(_0x3aefe3[_0xc500('0x11')][_0xc500('0x17')]){if(!utils[_0xc500('0x18')](_0x3aefe3[_0xc500('0x11')][_0xc500('0x17')])){throw new APIBadRequestError(util[_0xc500('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3aefe3['query'][_0xc500('0x17')]));}_0x31481a=_0x3aefe3['query'][_0xc500('0x17')][_0xc500('0x4a')]();}var _0x1d6d00=_['startCase'](_0x31481a)+_0xc500('0x4b');var _0x1b6106=_['map'](db[_0x1d6d00][_0xc500('0x26')],function(_0x1d0bdf){return{'name':_0x1d0bdf[_0xc500('0x27')],'type':_0x1d0bdf['type'][_0xc500('0x4c')]};});if(!_0x3aefe3[_0xc500('0x11')][_0xc500('0x1e')]){var _0x283954=['id',_0xc500('0x4d')];if(_0x31481a===_0xc500('0x41')){_0x283954[_0xc500('0x2d')]('type');if(_0x3aefe3['query'][_0xc500('0x28')]===_0xc500('0x4e')){_0x283954[_0xc500('0x2d')]([_0xc500('0x4f'),_0xc500('0x50')]);}}_0x3aefe3[_0xc500('0x11')][_0xc500('0x1e')]=_0x283954[_0xc500('0x1f')](',');}_0x51a265=qs[_0xc500('0x2b')](_0x1b6106,_0x3aefe3);if(_0x3aefe3[_0xc500('0x35')][_0xc500('0x29')]===_0xc500('0x35')){var _0x35309a={'params':{'id':_0x3aefe3[_0xc500('0x35')]['userProfileId']},'query':{'section':_0x31481a==='voice'&&_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')]===_0xc500('0x4e')?_0xc500('0x51'):_['startCase'](_0x31481a)+_0xc500('0x52'),'type':_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')],'nolimit':!![],'sort':_0xc500('0x4d'),'filter':_0x3aefe3[_0xc500('0x11')][_0xc500('0x53')]}};_0x35309a[_0xc500('0x11')]=Object[_0xc500('0x54')](_0x35309a[_0xc500('0x11')],_0x3aefe3[_0xc500('0x11')]);delete _0x35309a['query']['id'];return db['UserProfile']['getResources'](_0x35309a);}return db[_0x1d6d00]['findAndCountAll'](_0x51a265);})[_0xc500('0x16')](function(_0x391c71){_0x5ac941[_0xc500('0xa')]=_0x391c71[_0xc500('0xa')];_0x5825d4=_0x391c71[_0xc500('0x22')];return rtq[_0xc500('0x55')](_0x3aefe3,_0x31481a);})[_0xc500('0x16')](function(_0x3ede87){_0x4cd13a=_0x3ede87['rows'];return rtq[_0xc500('0x56')](_0x5825d4,_0x4cd13a,_0x31481a,_0x3aefe3[_0xc500('0x11')][_0xc500('0x28')]);})[_0xc500('0x16')](function(_0x1e85eb){_0x5ac941['rows']=_0x1e85eb;return _0x5ac941;})['then'](respondWithFilteredResult(_0x3e773e,_0x51a265))[_0xc500('0x57')](APIHandleError(_0x3e773e));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7424e29..cbae31a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35ca5b,_0x6cdf03){var _0x39d6d9=function(_0x5c0e9e){while(--_0x5c0e9e){_0x35ca5b['push'](_0x35ca5b['shift']());}};_0x39d6d9(++_0x6cdf03);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d1cd8,_0x569af8){_0x5d1cd8=_0x5d1cd8-0x0;var _0xd15a30=_0xedd9[_0x5d1cd8];return _0xd15a30;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7663836..5166270 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 _0x83d0=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x5c5b3c,_0x3ffb17){var _0x382c0a=function(_0x32bb5a){while(--_0x32bb5a){_0x5c5b3c['push'](_0x5c5b3c['shift']());}};_0x382c0a(++_0x3ffb17);}(_0x83d0,0xb7));var _0x083d=function(_0x57f3ec,_0x9d08ae){_0x57f3ec=_0x57f3ec-0x0;var _0x4a49b4=_0x83d0[_0x57f3ec];return _0x4a49b4;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'state':{'type':Sequelize[_0x083d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x083d('0x3')]},'scheduledat':{'type':Sequelize[_0x083d('0x4')]},'uniqueid':{'type':Sequelize[_0x083d('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x083d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x083d('0x3')]},'membername':{'type':Sequelize[_0x083d('0x3')]}}; \ No newline at end of file +var _0xc029=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x104b96,_0x1968f3){var _0x55cdbd=function(_0x45a723){while(--_0x45a723){_0x104b96['push'](_0x104b96['shift']());}};_0x55cdbd(++_0x1968f3);}(_0xc029,0x1df));var _0x9c02=function(_0x343dab,_0x134185){_0x343dab=_0x343dab-0x0;var _0xa7e52d=_0xc029[_0x343dab];return _0xa7e52d;};'use strict';var Sequelize=require(_0x9c02('0x0'));module[_0x9c02('0x1')]={'state':{'type':Sequelize[_0x9c02('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9c02('0x3')]},'scheduledat':{'type':Sequelize[_0x9c02('0x4')]},'uniqueid':{'type':Sequelize[_0x9c02('0x3')]},'starttime':{'type':Sequelize[_0x9c02('0x4')]},'responsetime':{'type':Sequelize[_0x9c02('0x4')]},'ringtime':{'type':Sequelize[_0x9c02('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9c02('0x3')]},'campaigntype':{'type':Sequelize[_0x9c02('0x3')]},'membername':{'type':Sequelize[_0x9c02('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 8db01b7..98e0505 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 _0x3a18=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x3a18,0x18e));var _0x83a1=function(_0x2cf533,_0x1abb4f){_0x2cf533=_0x2cf533-0x0;var _0x2e7c3a=_0x3a18[_0x2cf533];return _0x2e7c3a;};'use strict';var _=require(_0x83a1('0x0'));var util=require(_0x83a1('0x1'));var logger=require(_0x83a1('0x2'))(_0x83a1('0x3'));var moment=require(_0x83a1('0x4'));var BPromise=require(_0x83a1('0x5'));var rp=require(_0x83a1('0x6'));var fs=require('fs');var path=require(_0x83a1('0x7'));var rimraf=require(_0x83a1('0x8'));var config=require(_0x83a1('0x9'));var attributes=require(_0x83a1('0xa'));module[_0x83a1('0xb')]=function(_0x2b8584,_0x20aebc){return _0x2b8584['define'](_0x83a1('0xc'),attributes,{'tableName':_0x83a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25fb=['request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x4c361c,_0x56d458){var _0x3415b1=function(_0x8dce1a){while(--_0x8dce1a){_0x4c361c['push'](_0x4c361c['shift']());}};_0x3415b1(++_0x56d458);}(_0x25fb,0x1ab));var _0xb25f=function(_0x2b5b8e,_0x33d71f){_0x2b5b8e=_0x2b5b8e-0x0;var _0xfb2055=_0x25fb[_0x2b5b8e];return _0xfb2055;};'use strict';var _=require(_0xb25f('0x0'));var util=require(_0xb25f('0x1'));var logger=require(_0xb25f('0x2'))(_0xb25f('0x3'));var moment=require(_0xb25f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb25f('0x5'));var fs=require('fs');var path=require(_0xb25f('0x6'));var rimraf=require('rimraf');var config=require(_0xb25f('0x7'));var attributes=require(_0xb25f('0x8'));module[_0xb25f('0x9')]=function(_0x3a7efc,_0x566995){return _0x3a7efc[_0xb25f('0xa')]('ReportAgentPreview',attributes,{'tableName':_0xb25f('0xb'),'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 7a056ad..dc09783 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 _0xf3c0=['moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','body','options','then','CreateReportAgentPreview','lodash'];(function(_0x502fd4,_0x3bab6e){var _0x56b3ef=function(_0x322701){while(--_0x322701){_0x502fd4['push'](_0x502fd4['shift']());}};_0x56b3ef(++_0x3bab6e);}(_0xf3c0,0x77));var _0x0f3c=function(_0x1ef903,_0x517c67){_0x1ef903=_0x1ef903-0x0;var _0x319280=_0xf3c0[_0x1ef903];return _0x319280;};'use strict';var _=require(_0x0f3c('0x0'));var util=require('util');var moment=require(_0x0f3c('0x1'));var BPromise=require(_0x0f3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f3c('0x3'))['db'];var utils=require(_0x0f3c('0x4'));var logger=require('../../config/logger')(_0x0f3c('0x5'));var config=require('../../config/environment');var jayson=require(_0x0f3c('0x6'));var client=jayson['client'][_0x0f3c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49b836,_0x28c6a6,_0x2b828a){return new BPromise(function(_0x3ebdde,_0xc5f01b){return client[_0x0f3c('0x8')](_0x49b836,_0x2b828a)['then'](function(_0x2c2680){logger['info'](_0x0f3c('0x9'),_0x28c6a6,'request\x20sent');logger[_0x0f3c('0xa')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x28c6a6,_0x0f3c('0xb'),JSON[_0x0f3c('0xc')](_0x2c2680));if(_0x2c2680['error']){if(_0x2c2680[_0x0f3c('0xd')]['code']===0x1f4){logger[_0x0f3c('0xd')](_0x0f3c('0x9'),_0x28c6a6,_0x2c2680[_0x0f3c('0xd')]['message']);return _0xc5f01b(_0x2c2680[_0x0f3c('0xd')][_0x0f3c('0xe')]);}logger['error'](_0x0f3c('0x9'),_0x28c6a6,_0x2c2680[_0x0f3c('0xd')]['message']);return _0x3ebdde(_0x2c2680['error'][_0x0f3c('0xe')]);}else{logger['info'](_0x0f3c('0x9'),_0x28c6a6,'request\x20sent');_0x3ebdde(_0x2c2680[_0x0f3c('0xf')][_0x0f3c('0xe')]);}})['catch'](function(_0x417728){logger[_0x0f3c('0xd')](_0x0f3c('0x9'),_0x28c6a6,_0x417728);_0xc5f01b(_0x417728);});});}exports['CreateReportAgentPreview']=function(_0x5dd8d4){var _0x1b87b1=this;return new Promise(function(_0x1511ff,_0x3214ad){return db['ReportAgentPreview']['create'](_0x5dd8d4[_0x0f3c('0x10')],{'raw':_0x5dd8d4[_0x0f3c('0x11')]?_0x5dd8d4['options']['raw']===undefined?!![]:![]:!![]})[_0x0f3c('0x12')](function(_0x4a3d19){logger['info'](_0x0f3c('0x13'),_0x5dd8d4);logger['debug'](_0x0f3c('0x13'),_0x5dd8d4,JSON[_0x0f3c('0xc')](_0x4a3d19));_0x1511ff(_0x4a3d19);})['catch'](function(_0x5859fb){logger[_0x0f3c('0xd')](_0x0f3c('0x13'),_0x5859fb[_0x0f3c('0xe')],_0x5dd8d4);_0x3214ad(_0x1b87b1[_0x0f3c('0xd')](0x1f4,_0x5859fb[_0x0f3c('0xe')]));});});}; \ No newline at end of file +var _0x3eeb=['request\x20sent','debug','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3eeb,0x1f3));var _0xb3ee=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3eeb[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0xb3ee('0x0'));var moment=require(_0xb3ee('0x1'));var BPromise=require(_0xb3ee('0x2'));var rs=require(_0xb3ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3ee('0x4'))['db'];var utils=require(_0xb3ee('0x5'));var logger=require(_0xb3ee('0x6'))('rpc');var config=require(_0xb3ee('0x7'));var jayson=require(_0xb3ee('0x8'));var client=jayson[_0xb3ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58a2ff,_0x28a847,_0x62c920){return new BPromise(function(_0x2f8cb3,_0x37e0ad){return client[_0xb3ee('0xa')](_0x58a2ff,_0x62c920)[_0xb3ee('0xb')](function(_0x45dd32){logger[_0xb3ee('0xc')](_0xb3ee('0xd'),_0x28a847,_0xb3ee('0xe'));logger[_0xb3ee('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x28a847,_0xb3ee('0xe'),JSON[_0xb3ee('0x10')](_0x45dd32));if(_0x45dd32[_0xb3ee('0x11')]){if(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x12')]===0x1f4){logger[_0xb3ee('0x11')](_0xb3ee('0xd'),_0x28a847,_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);return _0x37e0ad(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);}logger[_0xb3ee('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x28a847,_0x45dd32[_0xb3ee('0x11')]['message']);return _0x2f8cb3(_0x45dd32[_0xb3ee('0x11')][_0xb3ee('0x13')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x28a847,_0xb3ee('0xe'));_0x2f8cb3(_0x45dd32[_0xb3ee('0x14')][_0xb3ee('0x13')]);}})['catch'](function(_0x58bf3e){logger[_0xb3ee('0x11')](_0xb3ee('0xd'),_0x28a847,_0x58bf3e);_0x37e0ad(_0x58bf3e);});});}exports[_0xb3ee('0x15')]=function(_0x17b869){var _0x22228a=this;return new Promise(function(_0x3a4d28,_0x1bbb76){return db[_0xb3ee('0x16')][_0xb3ee('0x17')](_0x17b869[_0xb3ee('0x18')],{'raw':_0x17b869[_0xb3ee('0x19')]?_0x17b869[_0xb3ee('0x19')][_0xb3ee('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x369d61){logger[_0xb3ee('0xc')]('CreateReportAgentPreview',_0x17b869);logger['debug']('CreateReportAgentPreview',_0x17b869,JSON[_0xb3ee('0x10')](_0x369d61));_0x3a4d28(_0x369d61);})['catch'](function(_0x4c484){logger[_0xb3ee('0x11')](_0xb3ee('0x15'),_0x4c484['message'],_0x17b869);_0x1bbb76(_0x22228a[_0xb3ee('0x11')](0x1f4,_0x4c484[_0xb3ee('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2b14da3..5e3adf0 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 _0x3e9f=['path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','agents','put','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util'];(function(_0x186d11,_0x290d2e){var _0x3621dd=function(_0x3d356a){while(--_0x3d356a){_0x186d11['push'](_0x186d11['shift']());}};_0x3621dd(++_0x290d2e);}(_0x3e9f,0x98));var _0xf3e9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3e9f[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xf3e9('0x0'));var util=require(_0xf3e9('0x1'));var path=require(_0xf3e9('0x2'));var express=require(_0xf3e9('0x3'));var router=express['Router']();var auth=require(_0xf3e9('0x4'));var controller=require(_0xf3e9('0x5'));router[_0xf3e9('0x6')](_0xf3e9('0x7'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x9')]);router[_0xf3e9('0x6')](_0xf3e9('0xa'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0xb')]);router[_0xf3e9('0x6')](_0xf3e9('0xc'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0xd')]);router[_0xf3e9('0x6')](_0xf3e9('0xe'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0xf')]);router['get'](_0xf3e9('0x10'),auth['isAuthenticated'](),controller['chatQueues']);router[_0xf3e9('0x6')](_0xf3e9('0x11'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x12')]);router[_0xf3e9('0x6')](_0xf3e9('0x13'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x14')]);router[_0xf3e9('0x6')](_0xf3e9('0x15'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xf3e9('0x6')](_0xf3e9('0x16'),auth['isAuthenticated'](),controller['smsQueues']);router['get']('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xf3e9('0x17')]);router[_0xf3e9('0x6')]('/fax/queues',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x18')]);router[_0xf3e9('0x6')]('/voice/queues/preview/:id',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x19')]);router['get'](_0xf3e9('0x1a'),auth[_0xf3e9('0x8')](),controller['voiceQueuesChannels']);router[_0xf3e9('0x6')](_0xf3e9('0x1b'),auth[_0xf3e9('0x8')](),controller['voiceQueuesChannel']);router[_0xf3e9('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xf3e9('0x8')](),controller['voiceQueuesChannelHangup']);router['get'](_0xf3e9('0x1c'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x1d')]);router[_0xf3e9('0x6')](_0xf3e9('0x1e'),auth['isAuthenticated'](),controller[_0xf3e9('0x1f')]);router['put'](_0xf3e9('0x1e'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x20')]);router[_0xf3e9('0x6')]('/outbound',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x21')]);router[_0xf3e9('0x6')](_0xf3e9('0x22'),auth['isAuthenticated'](),controller[_0xf3e9('0x23')]);router[_0xf3e9('0x6')]('/agents',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x24')]);router[_0xf3e9('0x25')]('/agents/:id/capacity',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x26')]);router[_0xf3e9('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0xf3e9('0x27')]);router['get'](_0xf3e9('0x28'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x29')]);router[_0xf3e9('0x6')](_0xf3e9('0x2a'),auth[_0xf3e9('0x8')](),controller['campaigns']);router['get'](_0xf3e9('0x2b'),auth[_0xf3e9('0x8')](),controller['faxAccounts']);router['get'](_0xf3e9('0x2c'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x2d')]);router[_0xf3e9('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router['get'](_0xf3e9('0x2e'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x2f')]);router[_0xf3e9('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x30')]);router['get'](_0xf3e9('0x31'),auth['isAuthenticated'](),controller[_0xf3e9('0x32')]);router[_0xf3e9('0x6')](_0xf3e9('0x33'),auth[_0xf3e9('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0xf3e9('0x6')](_0xf3e9('0x34'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x35')]);router[_0xf3e9('0x36')]('/mail/queues/:id/notify',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x37')](_0xf3e9('0x38')));router[_0xf3e9('0x6')](_0xf3e9('0x39'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x3a')]);router[_0xf3e9('0x36')](_0xf3e9('0x3b'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x37')](_0xf3e9('0x3c')));router[_0xf3e9('0x6')](_0xf3e9('0x3d'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x3e')]);router[_0xf3e9('0x36')]('/fax/queues/:id/notify',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x37')](_0xf3e9('0x3f')));router[_0xf3e9('0x6')](_0xf3e9('0x40'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x41')]);router[_0xf3e9('0x36')](_0xf3e9('0x42'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x37')](_0xf3e9('0x43')));router[_0xf3e9('0x6')](_0xf3e9('0x44'),auth['isAuthenticated'](),controller[_0xf3e9('0x45')]);router[_0xf3e9('0x36')](_0xf3e9('0x46'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x37')](_0xf3e9('0x47')));router[_0xf3e9('0x36')](_0xf3e9('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xf3e9('0x49')));router['get'](_0xf3e9('0x4a'),auth[_0xf3e9('0x8')](),controller['showSmsQueues']);router[_0xf3e9('0x6')]('/whatsapp/queues/:id',auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x4b')]);router['post'](_0xf3e9('0x4c'),auth[_0xf3e9('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x89e0=['/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones'];(function(_0x12df10,_0x4ed4bc){var _0xc08e49=function(_0x52920f){while(--_0x52920f){_0x12df10['push'](_0x12df10['shift']());}};_0xc08e49(++_0x4ed4bc);}(_0x89e0,0x1cd));var _0x089e=function(_0x46c6e1,_0x3e103d){_0x46c6e1=_0x46c6e1-0x0;var _0x23f5dd=_0x89e0[_0x46c6e1];return _0x23f5dd;};'use strict';var multer=require(_0x089e('0x0'));var util=require(_0x089e('0x1'));var path=require(_0x089e('0x2'));var express=require(_0x089e('0x3'));var router=express[_0x089e('0x4')]();var auth=require(_0x089e('0x5'));var controller=require(_0x089e('0x6'));router[_0x089e('0x7')](_0x089e('0x8'),auth['isAuthenticated'](),controller[_0x089e('0x9')]);router[_0x089e('0x7')](_0x089e('0xa'),auth[_0x089e('0xb')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x089e('0xb')](),controller[_0x089e('0xc')]);router[_0x089e('0x7')]('/voice/queues',auth[_0x089e('0xb')](),controller[_0x089e('0xd')]);router[_0x089e('0x7')](_0x089e('0xe'),auth[_0x089e('0xb')](),controller['chatQueues']);router[_0x089e('0x7')](_0x089e('0xf'),auth[_0x089e('0xb')](),controller['mailQueues']);router[_0x089e('0x7')](_0x089e('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x089e('0x7')](_0x089e('0x11'),auth[_0x089e('0xb')](),controller[_0x089e('0x12')]);router[_0x089e('0x7')]('/sms/queues',auth[_0x089e('0xb')](),controller[_0x089e('0x13')]);router['get']('/whatsapp/queues',auth[_0x089e('0xb')](),controller[_0x089e('0x14')]);router[_0x089e('0x7')](_0x089e('0x15'),auth[_0x089e('0xb')](),controller[_0x089e('0x16')]);router[_0x089e('0x7')](_0x089e('0x17'),auth['isAuthenticated'](),controller[_0x089e('0x18')]);router['get'](_0x089e('0x19'),auth[_0x089e('0xb')](),controller['voiceQueuesChannels']);router['get'](_0x089e('0x1a'),auth[_0x089e('0xb')](),controller[_0x089e('0x1b')]);router[_0x089e('0x7')](_0x089e('0x1c'),auth[_0x089e('0xb')](),controller['voiceQueuesChannelHangup']);router[_0x089e('0x7')](_0x089e('0x1d'),auth[_0x089e('0xb')](),controller[_0x089e('0x1e')]);router['get']('/voice/queues/:id',auth[_0x089e('0xb')](),controller[_0x089e('0x1f')]);router[_0x089e('0x20')](_0x089e('0x21'),auth[_0x089e('0xb')](),controller['updateVoiceQueue']);router[_0x089e('0x7')](_0x089e('0x22'),auth[_0x089e('0xb')](),controller[_0x089e('0x23')]);router[_0x089e('0x7')](_0x089e('0x24'),auth[_0x089e('0xb')](),controller[_0x089e('0x25')]);router[_0x089e('0x7')](_0x089e('0x26'),auth[_0x089e('0xb')](),controller[_0x089e('0x27')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x089e('0x28')]);router[_0x089e('0x7')](_0x089e('0x29'),auth[_0x089e('0xb')](),controller[_0x089e('0x2a')]);router[_0x089e('0x7')](_0x089e('0x2b'),auth[_0x089e('0xb')](),controller['trunks']);router['get'](_0x089e('0x2c'),auth[_0x089e('0xb')](),controller[_0x089e('0x2d')]);router[_0x089e('0x7')](_0x089e('0x2e'),auth[_0x089e('0xb')](),controller[_0x089e('0x2f')]);router[_0x089e('0x7')](_0x089e('0x30'),auth[_0x089e('0xb')](),controller[_0x089e('0x31')]);router['get'](_0x089e('0x32'),auth[_0x089e('0xb')](),controller[_0x089e('0x33')]);router[_0x089e('0x7')](_0x089e('0x34'),auth[_0x089e('0xb')](),controller[_0x089e('0x35')]);router[_0x089e('0x7')](_0x089e('0x36'),auth[_0x089e('0xb')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x089e('0x7')](_0x089e('0x37'),auth[_0x089e('0xb')](),controller['smsQueuesWaitingInteractions']);router[_0x089e('0x7')](_0x089e('0x38'),auth[_0x089e('0xb')](),controller[_0x089e('0x39')]);router[_0x089e('0x7')](_0x089e('0x3a'),auth['isAuthenticated'](),controller[_0x089e('0x3b')]);router[_0x089e('0x3c')](_0x089e('0x3d'),auth[_0x089e('0xb')](),controller[_0x089e('0x3e')](_0x089e('0x3f')));router[_0x089e('0x7')](_0x089e('0x40'),auth[_0x089e('0xb')](),controller['showMailQueues']);router[_0x089e('0x3c')](_0x089e('0x41'),auth[_0x089e('0xb')](),controller['queueNotify'](_0x089e('0x42')));router['get'](_0x089e('0x43'),auth['isAuthenticated'](),controller[_0x089e('0x44')]);router[_0x089e('0x3c')](_0x089e('0x45'),auth['isAuthenticated'](),controller[_0x089e('0x3e')](_0x089e('0x46')));router[_0x089e('0x7')](_0x089e('0x47'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x089e('0x48'),auth[_0x089e('0xb')](),controller[_0x089e('0x3e')](_0x089e('0x49')));router[_0x089e('0x7')](_0x089e('0x4a'),auth[_0x089e('0xb')](),controller[_0x089e('0x4b')]);router[_0x089e('0x3c')](_0x089e('0x4c'),auth['isAuthenticated'](),controller[_0x089e('0x3e')](_0x089e('0x4d')));router[_0x089e('0x3c')](_0x089e('0x4e'),auth['isAuthenticated'](),controller[_0x089e('0x3e')]('whatsapp'));router['get'](_0x089e('0x4f'),auth[_0x089e('0xb')](),controller[_0x089e('0x50')]);router[_0x089e('0x7')]('/whatsapp/queues/:id',auth[_0x089e('0xb')](),controller[_0x089e('0x51')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x089e('0x52')]);module[_0x089e('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fe8c672..8918f8a 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 _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c0c92,_0x267969){_0x3c0c92=_0x3c0c92-0x0;var _0xe3859b=_0xb10b[_0x3c0c92];return _0xe3859b;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file +var _0xb10b=['showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','Start','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','SIP/%s','interface','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues'];(function(_0x2d9f26,_0x10e8dd){var _0x5c7562=function(_0xc15ae9){while(--_0xc15ae9){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x5c7562(++_0x10e8dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x50450d,_0x314c15){_0x50450d=_0x50450d-0x0;var _0x1c391b=_0xb10b[_0x50450d];return _0x1c391b;};'use strict';var BPromise=require(_0xbb10('0x0'));var moment=require('moment');var _=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var db=require(_0xbb10('0x3'))['db'];var logger=require('../../config/logger')(_0xbb10('0x4'));var jayson=require(_0xbb10('0x5'));var amiClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232a});var mailClient=jayson[_0xbb10('0x6')][_0xbb10('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xbb10('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){var _0x1c3ee5=_0x1b9e94?_0x1b9e94:amiClient;return _0x1c3ee5[_0xbb10('0x8')](_0x3cdd53,_0x513741)[_0xbb10('0x9')](function(_0x229887){if(_0x229887[_0xbb10('0xa')]){if(_0x229887['error']['code']===0x1f4){return _0x21370f(_0x229887[_0xbb10('0xa')][_0xbb10('0xb')]);}return _0x3fb675(_0x229887[_0xbb10('0xa')]['message']);}else{_0x3fb675(_0x229887[_0xbb10('0xc')]);}})['catch'](function(_0x44fb19){_0x21370f(_0x44fb19);});});}function respondWithResult(_0x916a32,_0x285009){_0x285009=_0x285009||0xc8;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0xd')](_0x285009)[_0xbb10('0xe')](_0x193a27);}return _0x916a32['sendStatus'](0x194);};}function handleError(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0x1f4;return function(_0x45b9d6){logger[_0xbb10('0xa')](_0x45b9d6[_0xbb10('0xf')]);if(_0x45b9d6[_0xbb10('0x10')]){delete _0x45b9d6[_0xbb10('0x10')];}_0x26e021[_0xbb10('0xd')](_0x42d7e4)[_0xbb10('0x11')](_0x45b9d6);};}function findById(_0x2b184e){return function(_0x4a2bfc){if(!_[_0xbb10('0x12')](_0x2b184e)&&!_[_0xbb10('0x12')](_0x4a2bfc)&&!_[_0xbb10('0x12')](_0x4a2bfc[_0xbb10('0x13')])){return _[_0xbb10('0x14')](_0x4a2bfc[_0xbb10('0x13')],function(_0x575cca){return _0x575cca['id']==_0x2b184e;});}return null;};}exports[_0xbb10('0x15')]=function(_0xbf2906,_0xe1c665){return respondWithRpcPromise('VoiceChannels',_0xbf2906[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0xe1c665,null))[_0xbb10('0x17')](handleError(_0xe1c665,null));};exports[_0xbb10('0x18')]=function(_0xdf237d,_0x44e563){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xbb10('0x19')](_0xdf237d[_0xbb10('0x16')],_0xdf237d['params']))['then'](respondWithResult(_0x44e563,null))[_0xbb10('0x17')](handleError(_0x44e563,null));};exports[_0xbb10('0x1a')]=function(_0x2e911d,_0x317da4){return respondWithRpcPromise(_0xbb10('0x1b'),_[_0xbb10('0x19')](_0x2e911d[_0xbb10('0x16')],_0x2e911d[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x317da4,null))[_0xbb10('0x17')](handleError(_0x317da4,null));};exports[_0xbb10('0x1d')]=function(_0x26ad93,_0x537898){return respondWithRpcPromise('VoiceQueues',_0x26ad93['query'])[_0xbb10('0x9')](respondWithResult(_0x537898,null))[_0xbb10('0x17')](handleError(_0x537898,null));};exports[_0xbb10('0x1e')]=function(_0x4e25ff,_0x2fdde9){return respondWithRpcPromise(_0xbb10('0x1f'),_0x4e25ff[_0xbb10('0x16')])[_0xbb10('0x9')](findById(_0x4e25ff[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x2fdde9,null))[_0xbb10('0x17')](handleError(_0x2fdde9,null));};exports['updateVoiceQueue']=function(_0x3796c7,_0x21ac54){return respondWithRpcPromise(_0xbb10('0x20'),_[_0xbb10('0x19')](_0x3796c7[_0xbb10('0x21')],_0x3796c7[_0xbb10('0x1c')]))['then'](respondWithResult(_0x21ac54,null))[_0xbb10('0x17')](handleError(_0x21ac54,null));};exports['voiceQueuesPreview']=function(_0x448d5c,_0x56f2da){return respondWithRpcPromise(_0xbb10('0x22'),_[_0xbb10('0x19')](_0x448d5c[_0xbb10('0x16')],_0x448d5c['params']))['then'](respondWithResult(_0x56f2da,null))[_0xbb10('0x17')](handleError(_0x56f2da,null));};exports[_0xbb10('0x23')]=function(_0x4f590d,_0x359ad4){return respondWithRpcPromise(_0xbb10('0x24'),_0x4f590d[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x359ad4,null))[_0xbb10('0x17')](handleError(_0x359ad4,null));};exports[_0xbb10('0x25')]=function(_0xf85197,_0x4975f5){return respondWithRpcPromise(_0xbb10('0x26'),_[_0xbb10('0x19')](_0xf85197[_0xbb10('0x16')],_0xf85197[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4975f5,null))[_0xbb10('0x17')](handleError(_0x4975f5,null));};exports[_0xbb10('0x27')]=function(_0x10202c,_0x3c8d7d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xbb10('0x19')](_0x10202c[_0xbb10('0x16')],_0x10202c[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x3c8d7d,null))['catch'](handleError(_0x3c8d7d,null));};exports[_0xbb10('0x28')]=function(_0x5de37b,_0x4e2754){return respondWithRpcPromise(_0xbb10('0x29'),_[_0xbb10('0x19')](_0x5de37b[_0xbb10('0x16')],_0x5de37b[_0xbb10('0x1c')]))[_0xbb10('0x9')](respondWithResult(_0x4e2754,null))[_0xbb10('0x17')](handleError(_0x4e2754,null));};exports['outbound']=function(_0x1e5bbd,_0x25d72f){return respondWithRpcPromise('Outbound',_0x1e5bbd['query'])['then'](respondWithResult(_0x25d72f,null))[_0xbb10('0x17')](handleError(_0x25d72f,null));};exports[_0xbb10('0x2a')]=function(_0x2b658a,_0x4d5a9b){return respondWithRpcPromise(_0xbb10('0x2b'),_0x2b658a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4d5a9b,null))['catch'](handleError(_0x4d5a9b,null));};exports[_0xbb10('0x2c')]=function(_0x12238a,_0x1dcd38){var _0x446f49;return respondWithRpcPromise('Agents',_0x12238a[_0xbb10('0x16')])[_0xbb10('0x9')](function(_0x5835fd){_0x446f49=_0x5835fd;return respondWithRpcPromise(_0xbb10('0x2d'),_0x12238a[_0xbb10('0x16')],routingClient);})[_0xbb10('0x9')](function(_0x3a9934){return _[_0xbb10('0x19')]({},_0x3a9934,_0x446f49);})[_0xbb10('0x9')](respondWithResult(_0x1dcd38,null))['catch'](handleError(_0x1dcd38,null));};exports[_0xbb10('0x2e')]=function(_0x1c7fae,_0x3e7b4c){if(_0x1c7fae[_0xbb10('0x21')]&&_0x1c7fae['body'][_0xbb10('0x2f')]&&_0x1c7fae[_0xbb10('0x30')]&&_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]){for(var _0x5e2cfa in _0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')]){if(_0x1c7fae['body']['interaction'][_0xbb10('0x31')](_0x5e2cfa)){db['MemberReport'][_0xbb10('0x32')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')]['name'],'type':_0xbb10('0x33'),'exitAt':null,'uniqueid':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]&&_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0xbb10('0x34')]?{'$notIn':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x2f')][_0x5e2cfa]}:{'$ne':null}}})[_0xbb10('0x9')](function(_0x19f94d){var _0x190781=moment()[_0xbb10('0x35')](_0xbb10('0x36'));for(var _0x43b948=0x0,_0x197871=_0x19f94d[_0xbb10('0x34')];_0x43b948<_0x197871;_0x43b948+=0x1){_0x19f94d[_0x43b948]['updateAttributes']({'exitAt':_0x190781});}});for(var _0x426b95=0x0;_0x426b95<_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0xbb10('0x34')];_0x426b95+=0x1){db[_0xbb10('0x37')][_0xbb10('0x38')]({'where':{'channel':_0x5e2cfa,'membername':_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')],'type':_0xbb10('0x33'),'uniqueid':_0x1c7fae[_0xbb10('0x21')]['interaction'][_0x5e2cfa][_0x426b95],'exitAt':null},'defaults':{'channel':_0x5e2cfa,'membername':_0x1c7fae['user'][_0xbb10('0x10')],'interface':_[_0xbb10('0x12')](_0x1c7fae[_0xbb10('0x30')]['interface'])?util['format'](_0xbb10('0x39'),_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x10')]):_0x1c7fae[_0xbb10('0x30')][_0xbb10('0x3a')],'type':_0xbb10('0x33'),'enterAt':moment()[_0xbb10('0x35')](_0xbb10('0x36')),'role':_0xbb10('0x3b'),'internal':_0x1c7fae[_0xbb10('0x30')]['internal'],'uniqueid':_0x1c7fae['body'][_0xbb10('0x2f')][_0x5e2cfa][_0x426b95]}});}}}}return respondWithRpcPromise(_0xbb10('0x3c'),{'id':_0x1c7fae[_0xbb10('0x1c')]['id'],'capacity':_0x1c7fae[_0xbb10('0x21')][_0xbb10('0x3d')]},routingClient)[_0xbb10('0x9')](respondWithResult(_0x3e7b4c,null))[_0xbb10('0x17')](handleError(_0x3e7b4c,null));};exports[_0xbb10('0x3e')]=function(_0x1c0d8f,_0x1214f7){return respondWithRpcPromise(_0xbb10('0x3f'),_0x1c0d8f[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x1214f7,null))[_0xbb10('0x17')](handleError(_0x1214f7,null));};exports[_0xbb10('0x40')]=function(_0x547a7a,_0x124052){return respondWithRpcPromise('Trunks',_0x547a7a[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x124052,null))[_0xbb10('0x17')](handleError(_0x124052,null));};exports[_0xbb10('0x41')]=function(_0x26e66e,_0x32d8e9){return respondWithRpcPromise(_0xbb10('0x42'),_0x26e66e[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x32d8e9,null))[_0xbb10('0x17')](handleError(_0x32d8e9,null));};exports[_0xbb10('0x43')]=function(_0x1c2dce,_0x1d49e1){return respondWithRpcPromise(_0xbb10('0x44'),_0x1c2dce[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d49e1,null))[_0xbb10('0x17')](handleError(_0x1d49e1,null));};exports[_0xbb10('0x45')]=function(_0x1b83a9,_0x4ce8e7){return respondWithRpcPromise(_0xbb10('0x44'),_0x1b83a9[_0xbb10('0x16')],routingClient)['then'](findById(_0x1b83a9[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x4ce8e7,null))[_0xbb10('0x17')](handleError(_0x4ce8e7,null));};exports[_0xbb10('0x46')]=function(_0x432728,_0x22de7f){return respondWithRpcPromise(_0xbb10('0x47'),_0x432728[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x22de7f,null))[_0xbb10('0x17')](handleError(_0x22de7f,null));};exports[_0xbb10('0x48')]=function(_0x2a1ce1,_0x16932f){return respondWithRpcPromise('MailQueues',_0x2a1ce1['query'],routingClient)[_0xbb10('0x9')](findById(_0x2a1ce1[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x16932f,null))[_0xbb10('0x17')](handleError(_0x16932f,null));};exports['mailAccounts']=function(_0x506498,_0x79411e){return respondWithRpcPromise(_0xbb10('0x49'),_0x506498[_0xbb10('0x16')],mailClient)[_0xbb10('0x9')](respondWithResult(_0x79411e,null))[_0xbb10('0x17')](handleError(_0x79411e,null));};exports[_0xbb10('0x4a')]=function(_0x45c0dc,_0x4a5fb9){return respondWithRpcPromise(_0xbb10('0x4b'),_0x45c0dc[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x4a5fb9,null))['catch'](handleError(_0x4a5fb9,null));};exports['showOpenchannelQueues']=function(_0x32c1e8,_0x31c727){return respondWithRpcPromise(_0xbb10('0x4b'),_0x32c1e8['query'],routingClient)['then'](findById(_0x32c1e8['params']['id']))[_0xbb10('0x9')](respondWithResult(_0x31c727,null))[_0xbb10('0x17')](handleError(_0x31c727,null));};exports[_0xbb10('0x4c')]=function(_0x4e9fbd,_0xa1bbd9){return respondWithRpcPromise(_0xbb10('0x4d'),_0x4e9fbd['query'],routingClient)['then'](respondWithResult(_0xa1bbd9,null))[_0xbb10('0x17')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x4e')]=function(_0xd77753,_0x237246){return respondWithRpcPromise('SmsQueues',_0xd77753[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](findById(_0xd77753[_0xbb10('0x1c')]['id']))['then'](respondWithResult(_0x237246,null))[_0xbb10('0x17')](handleError(_0x237246,null));};exports[_0xbb10('0x4f')]=function(_0x3e3617,_0x5b2bd4){return respondWithRpcPromise(_0xbb10('0x50'),_0x3e3617[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x17')](handleError(_0x5b2bd4,null));};exports['showWhatsappQueues']=function(_0x251417,_0x258e55){return respondWithRpcPromise(_0xbb10('0x50'),_0x251417[_0xbb10('0x16')],routingClient)['then'](findById(_0x251417[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x258e55,null))[_0xbb10('0x17')](handleError(_0x258e55,null));};exports[_0xbb10('0x51')]=function(_0x12f750,_0x17807e){return respondWithRpcPromise(_0xbb10('0x52'),_0x12f750['query'],routingClient)['then'](respondWithResult(_0x17807e,null))['catch'](handleError(_0x17807e,null));};exports[_0xbb10('0x53')]=function(_0x9c672d,_0x3eda96){return respondWithRpcPromise('FaxQueues',_0x9c672d['query'],routingClient)[_0xbb10('0x9')](findById(_0x9c672d[_0xbb10('0x1c')]['id']))[_0xbb10('0x9')](respondWithResult(_0x3eda96,null))[_0xbb10('0x17')](handleError(_0x3eda96,null));};exports[_0xbb10('0x54')]=function(_0x1ad2ed,_0x4cf2f3){return respondWithRpcPromise(_0xbb10('0x55'),_0x1ad2ed[_0xbb10('0x16')])[_0xbb10('0x9')](respondWithResult(_0x4cf2f3,null))[_0xbb10('0x17')](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x56')]=function(_0x5bfc68,_0x56094a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5bfc68[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x56094a,null))[_0xbb10('0x17')](handleError(_0x56094a,null));};exports[_0xbb10('0x57')]=function(_0x2f7d2a,_0x1d40b8){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f7d2a[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x1d40b8,null))['catch'](handleError(_0x1d40b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xdf634f,_0x13040d){return respondWithRpcPromise(_0xbb10('0x58'),_0xdf634f[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x13040d,null))[_0xbb10('0x17')](handleError(_0x13040d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x576179,_0x165fe9){return respondWithRpcPromise(_0xbb10('0x58'),_0x576179[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](function(_0xfa3c7c){if(_0x576179['query'][_0xbb10('0x59')]!==undefined){var _0x19fcec=_(_0xfa3c7c[_0xbb10('0x13')])[_0xbb10('0x5a')]([_0x576179[_0xbb10('0x16')][_0xbb10('0x59')],_0x576179[_0xbb10('0x1c')]['id']])['map'](_0xbb10('0x5b'))[_0xbb10('0x5c')]()[_0xbb10('0x5d')]();return _0xfa3c7c[_0xbb10('0x13')][_0xbb10('0x5a')](function(_0x172be3){return _0x19fcec[_0xbb10('0x5e')](_0x172be3[_0xbb10('0x5b')])>-0x1;});}else{return _0xfa3c7c['rows'][_0xbb10('0x5a')](function(_0x218690){return _0x218690[_0xbb10('0x5b')]===parseInt(_0x576179['params']['id']);});}})['then'](respondWithResult(_0x165fe9,null))['catch'](handleError(_0x165fe9,null));};exports[_0xbb10('0x5f')]=function(_0x5a3c44,_0x4e3d6a){return respondWithRpcPromise(_0xbb10('0x60'),_0x5a3c44[_0xbb10('0x16')],routingClient)[_0xbb10('0x9')](respondWithResult(_0x4e3d6a,null))[_0xbb10('0x17')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x61')]=function(_0x24dca6,_0x33116){return respondWithRpcPromise(_0xbb10('0x62'),_0x24dca6[_0xbb10('0x16')],routingClient)['then'](respondWithResult(_0x33116,null))[_0xbb10('0x17')](handleError(_0x33116,null));};exports[_0xbb10('0x63')]=function(_0x46b6d2,_0x35b811){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x46b6d2['query'],routingClient)[_0xbb10('0x9')](respondWithResult(_0x35b811,null))[_0xbb10('0x17')](handleError(_0x35b811,null));};exports[_0xbb10('0x64')]=function(_0x32bb25){return function(_0x5ee705,_0x17d596){var _0x275bce,_0x3f0d74;var _0xf7b3e1=_[_0xbb10('0x65')](_0x32bb25);var _0x517185=_0x32bb25==='chat'?_0xbb10('0x66'):_0xbb10('0x67');return db[_0xf7b3e1+_0xbb10('0x68')]['findOne']({'raw':!![],'where':{'id':_0x5ee705[_0xbb10('0x1c')]['id']}})[_0xbb10('0x9')](function(_0x50bcc9){if(_['isNil'](_0x50bcc9)){throw new Error(_0xf7b3e1+_0xbb10('0x69'));}_0x275bce=_0x50bcc9;return db[_0xf7b3e1+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x5ee705['body'][_0xbb10('0x6c')]},'include':[{'model':db[_0xf7b3e1+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xf7b3e1+_0x517185],'as':_0xbb10('0x67')}]});})[_0xbb10('0x9')](function(_0x5de006){if(_[_0xbb10('0x12')](_0x5de006)){throw new Error(_0xf7b3e1+_0xbb10('0x6e'));}_0x3f0d74=_0x5de006;return _0x5de006[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3367d4={'uniqueid':_0x32bb25+'.'+_0x3f0d74['id']+'.'+_0x3f0d74[_0xbb10('0x6d')]['id'],'FromUserId':_0x5ee705[_0xbb10('0x30')]['id'],'type':_0xbb10('0x70')};_0x3367d4[_0xf7b3e1+_0xbb10('0x71')]=_0x3f0d74['id'];_0x3367d4[_0xf7b3e1+_0xbb10('0x72')]=_0x3f0d74[_0xbb10('0x6d')]['id'];_0x3367d4[_0xbb10('0x73')+_0xf7b3e1+_0x517185+'Id']=_0x3f0d74[_0xbb10('0x67')]['id'];_0x3367d4['To'+_0xf7b3e1+_0xbb10('0x74')]=_0x275bce['id'];return db[_0xf7b3e1+_0xbb10('0x75')][_0xbb10('0x76')](_0x3367d4);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x32bb25,'interaction':_0x3f0d74[_0xbb10('0x6d')],'message':_0x3f0d74,'account':_0x3f0d74[_0xbb10('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x70'),'appdata':_0x275bce[_0xbb10('0x10')]+','+(_0x3f0d74[_0xbb10('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x17d596,null))[_0xbb10('0x17')](handleError(_0x17d596,null));};};exports[_0xbb10('0x78')]=function(_0x19694d,_0x379d49){var _0x546db5,_0xb25e71;if(_[_0xbb10('0x12')](_0x19694d['body'][_0xbb10('0x79')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0xc53c87=_0x19694d[_0xbb10('0x21')][_0xbb10('0x79')];var _0xa99bf5=_[_0xbb10('0x65')](_0xc53c87);var _0x556d7b=_0xc53c87===_0xbb10('0x7a')?'Website':_0xbb10('0x67');return db[_0xbb10('0x7b')]['findOne']({'raw':!![],'where':{'id':_0x19694d['params']['id'],'role':_0xbb10('0x3b')}})[_0xbb10('0x9')](function(_0x1b77c2){if(_[_0xbb10('0x12')](_0x1b77c2)){throw new Error(_0xbb10('0x7c'));}_0x546db5=_0x1b77c2;return db[_0xa99bf5+_0xbb10('0x6a')][_0xbb10('0x6b')]({'where':{'id':_0x19694d[_0xbb10('0x21')][_0xbb10('0x6c')]},'include':[{'model':db[_0xa99bf5+_0xbb10('0x6d')],'as':_0xbb10('0x6d')},{'model':db[_0xa99bf5+_0x556d7b],'as':'Account'}]});})[_0xbb10('0x9')](function(_0x3eeceb){if(_[_0xbb10('0x12')](_0x3eeceb)){throw new Error(_0xa99bf5+_0xbb10('0x6e'));}_0xb25e71=_0x3eeceb;return _0x3eeceb[_0xbb10('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbb10('0x9')](function(){var _0xfefa17={'uniqueid':_0xc53c87+'.'+_0xb25e71['id']+'.'+_0xb25e71[_0xbb10('0x6d')]['id'],'FromUserId':_0x19694d[_0xbb10('0x30')]['id'],'type':_0xbb10('0x3b'),'ToUserId':_0x546db5['id']};_0xfefa17[_0xa99bf5+_0xbb10('0x71')]=_0xb25e71['id'];_0xfefa17[_0xa99bf5+_0xbb10('0x72')]=_0xb25e71['Interaction']['id'];_0xfefa17[_0xbb10('0x73')+_0xa99bf5+_0x556d7b+'Id']=_0xb25e71['Account']['id'];return db[_0xa99bf5+_0xbb10('0x75')][_0xbb10('0x76')](_0xfefa17);})[_0xbb10('0x9')](function(){return respondWithRpcPromise(_0xbb10('0x7d'),{'channel':_0xc53c87,'interaction':_0xb25e71[_0xbb10('0x6d')],'message':_0xb25e71,'account':_0xb25e71['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xbb10('0x3b'),'appdata':_0x546db5[_0xbb10('0x10')]+','+(_0xb25e71[_0xbb10('0x67')][_0xbb10('0x7e')]||0x12c),'interval':_0xbb10('0x77')}],'transfer':!![]},routingClient);})[_0xbb10('0x9')](respondWithResult(_0x379d49,null))['catch'](handleError(_0x379d49,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f84e4bc..7882cf4 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 _0x5582=['post','create','put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','run'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5582,0x1ba));var _0x2558=function(_0x57cbd7,_0x2ee526){_0x57cbd7=_0x57cbd7-0x0;var _0x300714=_0x5582[_0x57cbd7];return _0x300714;};'use strict';var multer=require(_0x2558('0x0'));var util=require(_0x2558('0x1'));var path=require('path');var timeout=require(_0x2558('0x2'));var express=require(_0x2558('0x3'));var router=express[_0x2558('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2558('0x5'));var config=require(_0x2558('0x6'));var controller=require(_0x2558('0x7'));router[_0x2558('0x8')]('/',auth['isAuthenticated'](),controller[_0x2558('0x9')]);router[_0x2558('0x8')](_0x2558('0xa'),auth[_0x2558('0xb')](),controller[_0x2558('0xc')]);router[_0x2558('0x8')]('/:id/run',auth[_0x2558('0xb')](),controller[_0x2558('0xd')]);router[_0x2558('0xe')]('/',auth[_0x2558('0xb')](),controller[_0x2558('0xf')]);router[_0x2558('0x10')](_0x2558('0xa'),auth[_0x2558('0xb')](),controller[_0x2558('0x11')]);router[_0x2558('0x12')](_0x2558('0xa'),auth[_0x2558('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f82=['index','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0xcfd4ae,_0x94892f){var _0x196069=function(_0x47b15f){while(--_0x47b15f){_0xcfd4ae['push'](_0xcfd4ae['shift']());}};_0x196069(++_0x94892f);}(_0x4f82,0x13b));var _0x24f8=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4f82[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0x24f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24f8('0x1'));var express=require(_0x24f8('0x2'));var router=express['Router']();var fs_extra=require(_0x24f8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x24f8('0x4'));var controller=require(_0x24f8('0x5'));router[_0x24f8('0x6')]('/',auth[_0x24f8('0x7')](),controller[_0x24f8('0x8')]);router[_0x24f8('0x6')](_0x24f8('0x9'),auth[_0x24f8('0x7')](),controller['show']);router['get'](_0x24f8('0xa'),auth[_0x24f8('0x7')](),controller[_0x24f8('0xb')]);router[_0x24f8('0xc')]('/',auth[_0x24f8('0x7')](),controller[_0x24f8('0xd')]);router[_0x24f8('0xe')](_0x24f8('0x9'),auth[_0x24f8('0x7')](),controller[_0x24f8('0xf')]);router[_0x24f8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x24f8('0x11')]);module[_0x24f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index aed04fd..a27edcf 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 _0x5124=['INTEGER','ENUM','quarters','months','weeks','hours','minutes','csv','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE'];(function(_0x9c9660,_0x523234){var _0x35913e=function(_0x520f64){while(--_0x520f64){_0x9c9660['push'](_0x9c9660['shift']());}};_0x35913e(++_0x523234);}(_0x5124,0xab));var _0x4512=function(_0x191e59,_0x416610){_0x191e59=_0x191e59-0x0;var _0x3c14ff=_0x5124[_0x191e59];return _0x3c14ff;};'use strict';var Sequelize=require('sequelize');module[_0x4512('0x0')]={'name':{'type':Sequelize[_0x4512('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4512('0x1')]},'active':{'type':Sequelize[_0x4512('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4512('0x1')],'allowNull':![],'defaultValue':_0x4512('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x4512('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4512('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4512('0x6')]('years',_0x4512('0x7'),_0x4512('0x8'),_0x4512('0x9'),'days',_0x4512('0xa'),_0x4512('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x4512('0x6')](_0x4512('0xc'),'pdf',_0x4512('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x4512('0xe'),'default'),'allowNull':![],'defaultValue':_0x4512('0xe')},'sendMail':{'type':Sequelize[_0x4512('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4512('0xf')]},'bcc':{'type':Sequelize[_0x4512('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x4512('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xeefd=['DATE','INTEGER','ENUM','years','quarters','months','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xeefd,0x1d6));var _0xdeef=function(_0x510a58,_0x43ca67){_0x510a58=_0x510a58-0x0;var _0x24e65e=_0xeefd[_0x510a58];return _0x24e65e;};'use strict';var Sequelize=require(_0xdeef('0x0'));module[_0xdeef('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdeef('0x2')]},'active':{'type':Sequelize[_0xdeef('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdeef('0x2')],'allowNull':![],'defaultValue':_0xdeef('0x4')},'startAt':{'type':Sequelize[_0xdeef('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xdeef('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdeef('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdeef('0x7')](_0xdeef('0x8'),_0xdeef('0x9'),_0xdeef('0xa'),'weeks','days',_0xdeef('0xb'),_0xdeef('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xdeef('0xd'),_0xdeef('0xe'),_0xdeef('0xf')),'allowNull':![],'defaultValue':_0xdeef('0xd')},'type':{'type':Sequelize[_0xdeef('0x7')](_0xdeef('0x10'),_0xdeef('0x11')),'allowNull':![],'defaultValue':_0xdeef('0x10')},'sendMail':{'type':Sequelize[_0xdeef('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdeef('0x2')]},'cc':{'type':Sequelize[_0xdeef('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xdeef('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9a54343..b9e6d52 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 _0xbd79=['where','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','map','Schedule','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','filter'];(function(_0x3ee80b,_0xd056c3){var _0x2a3428=function(_0x344088){while(--_0x344088){_0x3ee80b['push'](_0x3ee80b['shift']());}};_0x2a3428(++_0xd056c3);}(_0xbd79,0x104));var _0x9bd7=function(_0x185f5f,_0x21618c){_0x185f5f=_0x185f5f-0x0;var _0x2bfbc0=_0xbd79[_0x185f5f];return _0x2bfbc0;};'use strict';var emlformat=require(_0x9bd7('0x0'));var rimraf=require(_0x9bd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9bd7('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9bd7('0x3'));var csv=require('to-csv');var ejs=require(_0x9bd7('0x4'));var fs=require('fs');var fs_extra=require(_0x9bd7('0x5'));var _=require(_0x9bd7('0x6'));var squel=require(_0x9bd7('0x7'));var crypto=require(_0x9bd7('0x8'));var jsforce=require(_0x9bd7('0x9'));var deskjs=require(_0x9bd7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9bd7('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9bd7('0xc'));var qs=require(_0x9bd7('0xd'));var as=require(_0x9bd7('0xe'));var hardwareService=require(_0x9bd7('0xf'));var logger=require(_0x9bd7('0x10'))(_0x9bd7('0x11'));var utils=require(_0x9bd7('0x12'));var config=require(_0x9bd7('0x13'));var licenseUtil=require(_0x9bd7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588787,_0x5e26f2){_0x5e26f2=_0x5e26f2||0xcc;return function(_0x1eb46a){if(_0x1eb46a){return _0x588787[_0x9bd7('0x15')](_0x5e26f2);}return _0x588787['status'](_0x5e26f2)['end']();};}function respondWithResult(_0x16ac55,_0x21f1e9){_0x21f1e9=_0x21f1e9||0xc8;return function(_0x48228a){if(_0x48228a){return _0x16ac55['status'](_0x21f1e9)['json'](_0x48228a);}};}function respondWithFilteredResult(_0x485aa5,_0x5203ab){return function(_0xab49c8){if(_0xab49c8){var _0x37c9eb=typeof _0x5203ab[_0x9bd7('0x16')]===_0x9bd7('0x17')&&typeof _0x5203ab[_0x9bd7('0x18')]===_0x9bd7('0x17');var _0x7d0ed0=_0xab49c8[_0x9bd7('0x19')];var _0x33a5a6=_0x37c9eb?0x0:_0x5203ab[_0x9bd7('0x16')];var _0xdccf68=_0x37c9eb?_0xab49c8[_0x9bd7('0x19')]:_0x5203ab[_0x9bd7('0x16')]+_0x5203ab['limit'];var _0x11f568;if(_0xdccf68>=_0x7d0ed0){_0xdccf68=_0x7d0ed0;_0x11f568=0xc8;}else{_0x11f568=0xce;}_0x485aa5[_0x9bd7('0x1a')](_0x11f568);return _0x485aa5[_0x9bd7('0x1b')](_0x9bd7('0x1c'),_0x33a5a6+'-'+_0xdccf68+'/'+_0x7d0ed0)[_0x9bd7('0x1d')](_0xab49c8);}return null;};}function patchUpdates(_0x14b1af){return function(_0x38d8fe){try{jsonpatch['apply'](_0x38d8fe,_0x14b1af,!![]);}catch(_0x3c7eb8){return BPromise[_0x9bd7('0x1e')](_0x3c7eb8);}return _0x38d8fe[_0x9bd7('0x1f')]();};}function saveUpdates(_0x5ae987,_0x5ee402){return function(_0x1a5ab6){if(_0x1a5ab6){return _0x1a5ab6[_0x9bd7('0x20')](_0x5ae987)[_0x9bd7('0x21')](function(_0x17699c){return _0x17699c;});}return null;};}function removeEntity(_0x2502ea,_0x3b57b3){return function(_0x219229){if(_0x219229){return _0x219229[_0x9bd7('0x22')]()[_0x9bd7('0x21')](function(){var _0x58c57a=_0x219229[_0x9bd7('0x23')]({'plain':!![]});var _0x514329='Scheduler';return db[_0x9bd7('0x24')]['destroy']({'where':{'type':_0x514329,'resourceId':_0x58c57a['id']}})[_0x9bd7('0x21')](function(){return _0x219229;});})[_0x9bd7('0x21')](function(){_0x2502ea[_0x9bd7('0x1a')](0xcc)[_0x9bd7('0x25')]();});}};}function handleEntityNotFound(_0x4d2019,_0x237d30){return function(_0x50db8c){if(!_0x50db8c){_0x4d2019['sendStatus'](0x194);}return _0x50db8c;};}function handleError(_0x59a85b,_0x123def){_0x123def=_0x123def||0x1f4;return function(_0x29ef86){logger[_0x9bd7('0x26')](_0x29ef86['stack']);if(_0x29ef86['name']){delete _0x29ef86[_0x9bd7('0x27')];}_0x59a85b[_0x9bd7('0x1a')](_0x123def)['send'](_0x29ef86);};}exports['index']=function(_0x96268e,_0x1ad719){var _0x13b2b5={},_0x2d7da5={},_0x170682={'count':0x0,'rows':[]};var _0x42faca=_[_0x9bd7('0x28')](db[_0x9bd7('0x29')][_0x9bd7('0x2a')],function(_0x5eb9ad){return{'name':_0x5eb9ad['fieldName'],'type':_0x5eb9ad[_0x9bd7('0x2b')][_0x9bd7('0x2c')]};});_0x2d7da5[_0x9bd7('0x2d')]=_['map'](_0x42faca,'name');_0x2d7da5[_0x9bd7('0x2e')]=_['keys'](_0x96268e[_0x9bd7('0x2e')]);_0x2d7da5['filters']=_[_0x9bd7('0x2f')](_0x2d7da5[_0x9bd7('0x2d')],_0x2d7da5[_0x9bd7('0x2e')]);_0x13b2b5['attributes']=_['intersection'](_0x2d7da5[_0x9bd7('0x2d')],qs[_0x9bd7('0x30')](_0x96268e['query'][_0x9bd7('0x30')]));_0x13b2b5[_0x9bd7('0x31')]=_0x13b2b5['attributes'][_0x9bd7('0x32')]?_0x13b2b5['attributes']:_0x2d7da5[_0x9bd7('0x2d')];if(!_0x96268e[_0x9bd7('0x2e')][_0x9bd7('0x33')]('nolimit')){_0x13b2b5[_0x9bd7('0x18')]=qs[_0x9bd7('0x18')](_0x96268e['query'][_0x9bd7('0x18')]);_0x13b2b5[_0x9bd7('0x16')]=qs['offset'](_0x96268e['query'][_0x9bd7('0x16')]);}_0x13b2b5[_0x9bd7('0x34')]=qs[_0x9bd7('0x35')](_0x96268e[_0x9bd7('0x2e')][_0x9bd7('0x35')]);_0x13b2b5['where']=qs[_0x9bd7('0x36')](_['pick'](_0x96268e[_0x9bd7('0x2e')],_0x2d7da5[_0x9bd7('0x36')]),_0x42faca);if(_0x96268e[_0x9bd7('0x2e')][_0x9bd7('0x37')]){_0x13b2b5[_0x9bd7('0x38')]=_[_0x9bd7('0x39')](_0x13b2b5['where'],{'$or':_[_0x9bd7('0x28')](_0x42faca,function(_0x1f0a5e){if(_0x1f0a5e['type']!=='VIRTUAL'){var _0x5a2556={};_0x5a2556[_0x1f0a5e['name']]={'$like':'%'+_0x96268e[_0x9bd7('0x2e')][_0x9bd7('0x37')]+'%'};return _0x5a2556;}})});}_0x13b2b5=_[_0x9bd7('0x39')]({},_0x13b2b5,_0x96268e[_0x9bd7('0x3a')]);var _0x23cfd5={'where':_0x13b2b5['where']};return db[_0x9bd7('0x29')][_0x9bd7('0x19')](_0x23cfd5)[_0x9bd7('0x21')](function(_0xda945b){_0x170682['count']=_0xda945b;if(_0x96268e['query'][_0x9bd7('0x3b')]){_0x13b2b5[_0x9bd7('0x3c')]=[{'all':!![]}];}return db[_0x9bd7('0x29')][_0x9bd7('0x3d')](_0x13b2b5);})[_0x9bd7('0x21')](function(_0x10288f){_0x170682[_0x9bd7('0x3e')]=_0x10288f;return _0x170682;})[_0x9bd7('0x21')](respondWithFilteredResult(_0x1ad719,_0x13b2b5))['catch'](handleError(_0x1ad719,null));};exports[_0x9bd7('0x3f')]=function(_0x2676c1,_0x364362){var _0x31cb19={'raw':![],'where':{'id':_0x2676c1[_0x9bd7('0x40')]['id']}},_0x3bd670={};_0x3bd670['model']=_[_0x9bd7('0x41')](db[_0x9bd7('0x29')][_0x9bd7('0x2a')]);_0x3bd670[_0x9bd7('0x2e')]=_[_0x9bd7('0x41')](_0x2676c1[_0x9bd7('0x2e')]);_0x3bd670[_0x9bd7('0x36')]=_[_0x9bd7('0x2f')](_0x3bd670['model'],_0x3bd670[_0x9bd7('0x2e')]);_0x31cb19['attributes']=_['intersection'](_0x3bd670['model'],qs[_0x9bd7('0x30')](_0x2676c1['query'][_0x9bd7('0x30')]));_0x31cb19[_0x9bd7('0x31')]=_0x31cb19[_0x9bd7('0x31')][_0x9bd7('0x32')]?_0x31cb19['attributes']:_0x3bd670[_0x9bd7('0x2d')];if(_0x2676c1[_0x9bd7('0x2e')][_0x9bd7('0x3b')]){_0x31cb19['include']=[{'all':!![]}];}_0x31cb19=_['merge']({},_0x31cb19,_0x2676c1[_0x9bd7('0x3a')]);return db[_0x9bd7('0x29')][_0x9bd7('0x42')](_0x31cb19)['then'](handleEntityNotFound(_0x364362,null))[_0x9bd7('0x21')](respondWithResult(_0x364362,null))[_0x9bd7('0x43')](handleError(_0x364362,null));};exports['create']=function(_0x7d521c,_0x292471){return db[_0x9bd7('0x29')][_0x9bd7('0x44')](_0x7d521c[_0x9bd7('0x45')],{})['then'](function(_0x28fb54){var _0x5c9cdf=_0x7d521c[_0x9bd7('0x46')][_0x9bd7('0x23')]({'plain':!![]});if(!_0x5c9cdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c9cdf[_0x9bd7('0x47')]==='user'){var _0x32b07a=_0x28fb54[_0x9bd7('0x23')]({'plain':!![]});var _0xfa92f4=_0x9bd7('0x48');return db[_0x9bd7('0x49')]['find']({'where':{'name':_0xfa92f4,'userProfileId':_0x5c9cdf[_0x9bd7('0x4a')]},'raw':!![]})['then'](function(_0x37d88e){if(_0x37d88e&&_0x37d88e[_0x9bd7('0x4b')]===0x0){return db['UserProfileResource'][_0x9bd7('0x44')]({'name':_0x32b07a[_0x9bd7('0x27')],'resourceId':_0x32b07a['id'],'type':_0x37d88e[_0x9bd7('0x27')],'sectionId':_0x37d88e['id']},{})[_0x9bd7('0x21')](function(){return _0x28fb54;});}else{return _0x28fb54;}})[_0x9bd7('0x43')](function(_0x368dc4){logger['error'](_0x9bd7('0x4c'),_0x368dc4);throw _0x368dc4;});}return _0x28fb54;})['then'](respondWithResult(_0x292471,0xc9))[_0x9bd7('0x43')](handleError(_0x292471,null));};exports['update']=function(_0x45caa1,_0x51642a){if(_0x45caa1['body']['id']){delete _0x45caa1[_0x9bd7('0x45')]['id'];}return db[_0x9bd7('0x29')][_0x9bd7('0x42')]({'where':{'id':_0x45caa1[_0x9bd7('0x40')]['id']}})[_0x9bd7('0x21')](handleEntityNotFound(_0x51642a,null))[_0x9bd7('0x21')](saveUpdates(_0x45caa1[_0x9bd7('0x45')],null))[_0x9bd7('0x21')](respondWithResult(_0x51642a,null))['catch'](handleError(_0x51642a,null));};exports[_0x9bd7('0x22')]=function(_0x52a6a4,_0x4b0d46){return db[_0x9bd7('0x29')][_0x9bd7('0x42')]({'where':{'id':_0x52a6a4['params']['id']}})[_0x9bd7('0x21')](handleEntityNotFound(_0x4b0d46,null))[_0x9bd7('0x21')](removeEntity(_0x4b0d46,null))['catch'](handleError(_0x4b0d46,null));};exports[_0x9bd7('0x4d')]=function(_0xa4ebd6,_0x5c6cab,_0x501f3f){var _0x44bc2c=require(_0x9bd7('0x4e'));return db['Schedule'][_0x9bd7('0x42')]({'where':{'id':_0xa4ebd6[_0x9bd7('0x40')]['id']},'raw':!![]})[_0x9bd7('0x21')](handleEntityNotFound(_0x5c6cab,null))['then'](function(){_0x44bc2c[_0x9bd7('0x4d')](_0xa4ebd6['params']['id']);})[_0x9bd7('0x21')](respondWithStatusCode(_0x5c6cab,null))[_0x9bd7('0x43')](handleError(_0x5c6cab,null));}; \ No newline at end of file +var _0x52ba=['mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x129890,_0x20af0b){var _0x10f8e8=function(_0x17cd7){while(--_0x17cd7){_0x129890['push'](_0x129890['shift']());}};_0x10f8e8(++_0x20af0b);}(_0x52ba,0x14f));var _0xa52b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52ba[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa52b('0x0'));var rimraf=require(_0xa52b('0x1'));var zipdir=require(_0xa52b('0x2'));var jsonpatch=require(_0xa52b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa52b('0x4'));var Mustache=require(_0xa52b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa52b('0x6'));var csv=require(_0xa52b('0x7'));var ejs=require(_0xa52b('0x8'));var fs=require('fs');var fs_extra=require(_0xa52b('0x9'));var _=require(_0xa52b('0xa'));var squel=require('squel');var crypto=require(_0xa52b('0xb'));var jsforce=require(_0xa52b('0xc'));var deskjs=require(_0xa52b('0xd'));var toCsv=require(_0xa52b('0x7'));var querystring=require(_0xa52b('0xe'));var Papa=require(_0xa52b('0xf'));var Redis=require(_0xa52b('0x10'));var authService=require(_0xa52b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa52b('0x12'));var hardwareService=require(_0xa52b('0x13'));var logger=require(_0xa52b('0x14'))('api');var utils=require(_0xa52b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa52b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x211a05,_0x1addc9){_0x1addc9=_0x1addc9||0xcc;return function(_0x18026d){if(_0x18026d){return _0x211a05[_0xa52b('0x17')](_0x1addc9);}return _0x211a05[_0xa52b('0x18')](_0x1addc9)[_0xa52b('0x19')]();};}function respondWithResult(_0x5de6ab,_0x4d4f7e){_0x4d4f7e=_0x4d4f7e||0xc8;return function(_0x1c0c07){if(_0x1c0c07){return _0x5de6ab[_0xa52b('0x18')](_0x4d4f7e)[_0xa52b('0x1a')](_0x1c0c07);}};}function respondWithFilteredResult(_0x5d268c,_0x1aaaa2){return function(_0x51fc40){if(_0x51fc40){var _0xe8fad4=typeof _0x1aaaa2[_0xa52b('0x1b')]===_0xa52b('0x1c')&&typeof _0x1aaaa2[_0xa52b('0x1d')]===_0xa52b('0x1c');var _0x4119d5=_0x51fc40[_0xa52b('0x1e')];var _0x300e60=_0xe8fad4?0x0:_0x1aaaa2[_0xa52b('0x1b')];var _0x31ca3f=_0xe8fad4?_0x51fc40[_0xa52b('0x1e')]:_0x1aaaa2['offset']+_0x1aaaa2['limit'];var _0x1dcaf7;if(_0x31ca3f>=_0x4119d5){_0x31ca3f=_0x4119d5;_0x1dcaf7=0xc8;}else{_0x1dcaf7=0xce;}_0x5d268c[_0xa52b('0x18')](_0x1dcaf7);return _0x5d268c['set']('Content-Range',_0x300e60+'-'+_0x31ca3f+'/'+_0x4119d5)['json'](_0x51fc40);}return null;};}function patchUpdates(_0x205ca5){return function(_0x44b612){try{jsonpatch[_0xa52b('0x1f')](_0x44b612,_0x205ca5,!![]);}catch(_0x12d154){return BPromise[_0xa52b('0x20')](_0x12d154);}return _0x44b612[_0xa52b('0x21')]();};}function saveUpdates(_0x57fe3f,_0x306bc9){return function(_0x249a42){if(_0x249a42){return _0x249a42[_0xa52b('0x22')](_0x57fe3f)[_0xa52b('0x23')](function(_0x594c9b){return _0x594c9b;});}return null;};}function removeEntity(_0x2c3e1a,_0x506e04){return function(_0x35c04d){if(_0x35c04d){return _0x35c04d['destroy']()['then'](function(){var _0x5ada91=_0x35c04d[_0xa52b('0x24')]({'plain':!![]});var _0x2d094b=_0xa52b('0x25');return db[_0xa52b('0x26')][_0xa52b('0x27')]({'where':{'type':_0x2d094b,'resourceId':_0x5ada91['id']}})[_0xa52b('0x23')](function(){return _0x35c04d;});})[_0xa52b('0x23')](function(){_0x2c3e1a[_0xa52b('0x18')](0xcc)[_0xa52b('0x19')]();});}};}function handleEntityNotFound(_0x10fa1b,_0x150128){return function(_0x3c5c78){if(!_0x3c5c78){_0x10fa1b[_0xa52b('0x17')](0x194);}return _0x3c5c78;};}function handleError(_0x25a90c,_0x2f95a2){_0x2f95a2=_0x2f95a2||0x1f4;return function(_0x5336ae){logger[_0xa52b('0x28')](_0x5336ae[_0xa52b('0x29')]);if(_0x5336ae[_0xa52b('0x2a')]){delete _0x5336ae['name'];}_0x25a90c[_0xa52b('0x18')](_0x2f95a2)['send'](_0x5336ae);};}exports[_0xa52b('0x2b')]=function(_0x4b8ff5,_0x4f910a){var _0x3135f8={},_0x42dd55={},_0xd6e184={'count':0x0,'rows':[]};var _0x5373ed=_['map'](db['Schedule'][_0xa52b('0x2c')],function(_0x18f29d){return{'name':_0x18f29d[_0xa52b('0x2d')],'type':_0x18f29d[_0xa52b('0x2e')]['key']};});_0x42dd55['model']=_[_0xa52b('0x2f')](_0x5373ed,_0xa52b('0x2a'));_0x42dd55[_0xa52b('0x30')]=_[_0xa52b('0x31')](_0x4b8ff5[_0xa52b('0x30')]);_0x42dd55[_0xa52b('0x32')]=_[_0xa52b('0x33')](_0x42dd55['model'],_0x42dd55[_0xa52b('0x30')]);_0x3135f8['attributes']=_['intersection'](_0x42dd55[_0xa52b('0x34')],qs[_0xa52b('0x35')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x35')]));_0x3135f8['attributes']=_0x3135f8[_0xa52b('0x36')][_0xa52b('0x37')]?_0x3135f8[_0xa52b('0x36')]:_0x42dd55[_0xa52b('0x34')];if(!_0x4b8ff5[_0xa52b('0x30')]['hasOwnProperty'](_0xa52b('0x38'))){_0x3135f8[_0xa52b('0x1d')]=qs[_0xa52b('0x1d')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x1d')]);_0x3135f8[_0xa52b('0x1b')]=qs[_0xa52b('0x1b')](_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x1b')]);}_0x3135f8[_0xa52b('0x39')]=qs[_0xa52b('0x3a')](_0x4b8ff5[_0xa52b('0x30')]['sort']);_0x3135f8[_0xa52b('0x3b')]=qs[_0xa52b('0x32')](_[_0xa52b('0x3c')](_0x4b8ff5[_0xa52b('0x30')],_0x42dd55[_0xa52b('0x32')]),_0x5373ed);if(_0x4b8ff5[_0xa52b('0x30')]['filter']){_0x3135f8[_0xa52b('0x3b')]=_[_0xa52b('0x3d')](_0x3135f8['where'],{'$or':_[_0xa52b('0x2f')](_0x5373ed,function(_0x30cab7){if(_0x30cab7[_0xa52b('0x2e')]!==_0xa52b('0x3e')){var _0x46fa75={};_0x46fa75[_0x30cab7['name']]={'$like':'%'+_0x4b8ff5[_0xa52b('0x30')][_0xa52b('0x3f')]+'%'};return _0x46fa75;}})});}_0x3135f8=_['merge']({},_0x3135f8,_0x4b8ff5[_0xa52b('0x40')]);var _0x5c3089={'where':_0x3135f8[_0xa52b('0x3b')]};return db[_0xa52b('0x41')][_0xa52b('0x1e')](_0x5c3089)['then'](function(_0xc005a2){_0xd6e184['count']=_0xc005a2;if(_0x4b8ff5['query'][_0xa52b('0x42')]){_0x3135f8[_0xa52b('0x43')]=[{'all':!![]}];}return db[_0xa52b('0x41')][_0xa52b('0x44')](_0x3135f8);})[_0xa52b('0x23')](function(_0x6c47b8){_0xd6e184[_0xa52b('0x45')]=_0x6c47b8;return _0xd6e184;})[_0xa52b('0x23')](respondWithFilteredResult(_0x4f910a,_0x3135f8))[_0xa52b('0x46')](handleError(_0x4f910a,null));};exports[_0xa52b('0x47')]=function(_0x30c4ce,_0x1f91b1){var _0x46f18f={'raw':![],'where':{'id':_0x30c4ce[_0xa52b('0x48')]['id']}},_0x385f1e={};_0x385f1e[_0xa52b('0x34')]=_[_0xa52b('0x31')](db['Schedule'][_0xa52b('0x2c')]);_0x385f1e[_0xa52b('0x30')]=_[_0xa52b('0x31')](_0x30c4ce['query']);_0x385f1e['filters']=_[_0xa52b('0x33')](_0x385f1e[_0xa52b('0x34')],_0x385f1e[_0xa52b('0x30')]);_0x46f18f[_0xa52b('0x36')]=_['intersection'](_0x385f1e[_0xa52b('0x34')],qs[_0xa52b('0x35')](_0x30c4ce['query']['fields']));_0x46f18f[_0xa52b('0x36')]=_0x46f18f[_0xa52b('0x36')][_0xa52b('0x37')]?_0x46f18f[_0xa52b('0x36')]:_0x385f1e[_0xa52b('0x34')];if(_0x30c4ce['query'][_0xa52b('0x42')]){_0x46f18f[_0xa52b('0x43')]=[{'all':!![]}];}_0x46f18f=_[_0xa52b('0x3d')]({},_0x46f18f,_0x30c4ce[_0xa52b('0x40')]);return db[_0xa52b('0x41')][_0xa52b('0x49')](_0x46f18f)[_0xa52b('0x23')](handleEntityNotFound(_0x1f91b1,null))['then'](respondWithResult(_0x1f91b1,null))[_0xa52b('0x46')](handleError(_0x1f91b1,null));};exports[_0xa52b('0x4a')]=function(_0x1ddbeb,_0x36e64d){return db['Schedule'][_0xa52b('0x4a')](_0x1ddbeb['body'],{})[_0xa52b('0x23')](function(_0x2fb74f){var _0x524170=_0x1ddbeb['user'][_0xa52b('0x24')]({'plain':!![]});if(!_0x524170)throw new Error(_0xa52b('0x4b'));if(_0x524170[_0xa52b('0x4c')]===_0xa52b('0x4d')){var _0x4e16b1=_0x2fb74f[_0xa52b('0x24')]({'plain':!![]});var _0x23dab8=_0xa52b('0x25');return db[_0xa52b('0x4e')][_0xa52b('0x49')]({'where':{'name':_0x23dab8,'userProfileId':_0x524170[_0xa52b('0x4f')]},'raw':!![]})[_0xa52b('0x23')](function(_0x42e07d){if(_0x42e07d&&_0x42e07d[_0xa52b('0x50')]===0x0){return db[_0xa52b('0x26')][_0xa52b('0x4a')]({'name':_0x4e16b1['name'],'resourceId':_0x4e16b1['id'],'type':_0x42e07d['name'],'sectionId':_0x42e07d['id']},{})[_0xa52b('0x23')](function(){return _0x2fb74f;});}else{return _0x2fb74f;}})['catch'](function(_0x3e75ff){logger[_0xa52b('0x28')](_0xa52b('0x51'),_0x3e75ff);throw _0x3e75ff;});}return _0x2fb74f;})[_0xa52b('0x23')](respondWithResult(_0x36e64d,0xc9))[_0xa52b('0x46')](handleError(_0x36e64d,null));};exports[_0xa52b('0x22')]=function(_0x38f961,_0x490647){if(_0x38f961['body']['id']){delete _0x38f961[_0xa52b('0x52')]['id'];}return db[_0xa52b('0x41')]['find']({'where':{'id':_0x38f961[_0xa52b('0x48')]['id']}})['then'](handleEntityNotFound(_0x490647,null))[_0xa52b('0x23')](saveUpdates(_0x38f961['body'],null))[_0xa52b('0x23')](respondWithResult(_0x490647,null))['catch'](handleError(_0x490647,null));};exports['destroy']=function(_0x2f92b8,_0x17ce7b){return db[_0xa52b('0x41')]['find']({'where':{'id':_0x2f92b8['params']['id']}})[_0xa52b('0x23')](handleEntityNotFound(_0x17ce7b,null))['then'](removeEntity(_0x17ce7b,null))['catch'](handleError(_0x17ce7b,null));};exports['run']=function(_0x8637ff,_0x37e1d9,_0x4d6dab){var _0x5eb2fa=require(_0xa52b('0x53'));return db[_0xa52b('0x41')][_0xa52b('0x49')]({'where':{'id':_0x8637ff[_0xa52b('0x48')]['id']},'raw':!![]})[_0xa52b('0x23')](handleEntityNotFound(_0x37e1d9,null))['then'](function(){_0x5eb2fa[_0xa52b('0x54')](_0x8637ff[_0xa52b('0x48')]['id']);})['then'](respondWithStatusCode(_0x37e1d9,null))[_0xa52b('0x46')](handleError(_0x37e1d9,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 369e430..c5db859 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 _0xe092=['exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x3b7fd1,_0x551999){var _0x5014ea=function(_0x656373){while(--_0x656373){_0x3b7fd1['push'](_0x3b7fd1['shift']());}};_0x5014ea(++_0x551999);}(_0xe092,0x1d8));var _0x2e09=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0xe092[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0x2e09('0x0'));var util=require('util');var logger=require(_0x2e09('0x1'))(_0x2e09('0x2'));var moment=require(_0x2e09('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e09('0x4'));var fs=require('fs');var path=require(_0x2e09('0x5'));var rimraf=require(_0x2e09('0x6'));var config=require(_0x2e09('0x7'));var attributes=require(_0x2e09('0x8'));module[_0x2e09('0x9')]=function(_0x385165,_0x20933d){return _0x385165[_0x2e09('0xa')](_0x2e09('0xb'),attributes,{'tableName':_0x2e09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3eb=['define','Schedule','tools_schedules','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x251264,_0x128c77){var _0x95cc54=function(_0x4eb7ad){while(--_0x4eb7ad){_0x251264['push'](_0x251264['shift']());}};_0x95cc54(++_0x128c77);}(_0xc3eb,0x198));var _0xbc3e=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0xc3eb[_0x10df1e];return _0x3e24fb;};'use strict';var _=require(_0xbc3e('0x0'));var util=require(_0xbc3e('0x1'));var logger=require('../../config/logger')(_0xbc3e('0x2'));var moment=require(_0xbc3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc3e('0x5'));var attributes=require('./schedule.attributes');module['exports']=function(_0x1bdd68,_0xc8fd21){return _0x1bdd68[_0xbc3e('0x6')](_0xbc3e('0x7'),attributes,{'tableName':_0xbc3e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index e8273a2..671daa8 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 _0x79ac=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch'];(function(_0x28b48b,_0x374704){var _0x25e091=function(_0x4e94e7){while(--_0x4e94e7){_0x28b48b['push'](_0x28b48b['shift']());}};_0x25e091(++_0x374704);}(_0x79ac,0x7e));var _0xc79a=function(_0xb171c8,_0x179996){_0xb171c8=_0xb171c8-0x0;var _0x3ef274=_0x79ac[_0xb171c8];return _0x3ef274;};'use strict';var _=require(_0xc79a('0x0'));var util=require(_0xc79a('0x1'));var moment=require(_0xc79a('0x2'));var BPromise=require(_0xc79a('0x3'));var rs=require(_0xc79a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc79a('0x5'));var logger=require(_0xc79a('0x6'))(_0xc79a('0x7'));var config=require(_0xc79a('0x8'));var jayson=require(_0xc79a('0x9'));var client=jayson['client'][_0xc79a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c6c9,_0x4d3f01,_0x1e160e){return new BPromise(function(_0x57c5e4,_0x35215d){return client[_0xc79a('0xb')](_0x43c6c9,_0x1e160e)['then'](function(_0x28bd13){logger[_0xc79a('0xc')]('Schedule,\x20%s,\x20%s',_0x4d3f01,'request\x20sent');logger['debug'](_0xc79a('0xd'),_0x4d3f01,_0xc79a('0xe'),JSON[_0xc79a('0xf')](_0x28bd13));if(_0x28bd13['error']){if(_0x28bd13[_0xc79a('0x10')]['code']===0x1f4){logger[_0xc79a('0x10')](_0xc79a('0x11'),_0x4d3f01,_0x28bd13[_0xc79a('0x10')]['message']);return _0x35215d(_0x28bd13['error']['message']);}logger[_0xc79a('0x10')](_0xc79a('0x11'),_0x4d3f01,_0x28bd13[_0xc79a('0x10')][_0xc79a('0x12')]);return _0x57c5e4(_0x28bd13[_0xc79a('0x10')][_0xc79a('0x12')]);}else{logger[_0xc79a('0xc')](_0xc79a('0x11'),_0x4d3f01,_0xc79a('0xe'));_0x57c5e4(_0x28bd13[_0xc79a('0x13')][_0xc79a('0x12')]);}})[_0xc79a('0x14')](function(_0x32385b){logger[_0xc79a('0x10')]('Schedule,\x20%s,\x20%s',_0x4d3f01,_0x32385b);_0x35215d(_0x32385b);});});} \ No newline at end of file +var _0xbfef=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','Schedule,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0xab3ad3,_0x3b65b7){var _0x3528f4=function(_0x2b190f){while(--_0x2b190f){_0xab3ad3['push'](_0xab3ad3['shift']());}};_0x3528f4(++_0x3b65b7);}(_0xbfef,0x1cb));var _0xfbfe=function(_0x1bbcb3,_0x33d9f4){_0x1bbcb3=_0x1bbcb3-0x0;var _0x4681f9=_0xbfef[_0x1bbcb3];return _0x4681f9;};'use strict';var _=require(_0xfbfe('0x0'));var util=require(_0xfbfe('0x1'));var moment=require(_0xfbfe('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbfe('0x3'));var fs=require('fs');var Redis=require(_0xfbfe('0x4'));var db=require(_0xfbfe('0x5'))['db'];var utils=require(_0xfbfe('0x6'));var logger=require(_0xfbfe('0x7'))(_0xfbfe('0x8'));var config=require(_0xfbfe('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17b890,_0x470849,_0x677fed){return new BPromise(function(_0x5f1758,_0x218e6a){return client[_0xfbfe('0xa')](_0x17b890,_0x677fed)[_0xfbfe('0xb')](function(_0x1335a1){logger[_0xfbfe('0xc')]('Schedule,\x20%s,\x20%s',_0x470849,_0xfbfe('0xd'));logger['debug'](_0xfbfe('0xe'),_0x470849,_0xfbfe('0xd'),JSON[_0xfbfe('0xf')](_0x1335a1));if(_0x1335a1['error']){if(_0x1335a1['error'][_0xfbfe('0x10')]===0x1f4){logger['error'](_0xfbfe('0x11'),_0x470849,_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);return _0x218e6a(_0x1335a1[_0xfbfe('0x12')]['message']);}logger[_0xfbfe('0x12')]('Schedule,\x20%s,\x20%s',_0x470849,_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);return _0x5f1758(_0x1335a1[_0xfbfe('0x12')][_0xfbfe('0x13')]);}else{logger[_0xfbfe('0xc')](_0xfbfe('0x11'),_0x470849,'request\x20sent');_0x5f1758(_0x1335a1[_0xfbfe('0x14')][_0xfbfe('0x13')]);}})[_0xfbfe('0x15')](function(_0x37a1be){logger[_0xfbfe('0x12')]('Schedule,\x20%s,\x20%s',_0x470849,_0x37a1be);_0x218e6a(_0x37a1be);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c7eecbe..60239eb 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 _0x10db=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','exports'];(function(_0x5da13f,_0xad240){var _0x13b87d=function(_0x42f87d){while(--_0x42f87d){_0x5da13f['push'](_0x5da13f['shift']());}};_0x13b87d(++_0xad240);}(_0x10db,0x104));var _0xb10d=function(_0x11c009,_0x7c3bb5){_0x11c009=_0x11c009-0x0;var _0x41872e=_0x10db[_0x11c009];return _0x41872e;};'use strict';var multer=require(_0xb10d('0x0'));var util=require(_0xb10d('0x1'));var path=require(_0xb10d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb10d('0x3'));var router=express[_0xb10d('0x4')]();var fs_extra=require(_0xb10d('0x5'));var auth=require(_0xb10d('0x6'));var interaction=require(_0xb10d('0x7'));var config=require(_0xb10d('0x8'));var controller=require(_0xb10d('0x9'));router[_0xb10d('0xa')]('/',auth[_0xb10d('0xb')](),controller['index']);router[_0xb10d('0xa')](_0xb10d('0xc'),auth[_0xb10d('0xb')](),controller[_0xb10d('0xd')]);router[_0xb10d('0xa')](_0xb10d('0xe'),auth[_0xb10d('0xb')](),controller['show']);router[_0xb10d('0xa')]('/:id/download',auth[_0xb10d('0xb')](),controller['download']);router[_0xb10d('0xf')]('/',auth[_0xb10d('0xb')](),controller[_0xb10d('0x10')]);router['put']('/:id',auth[_0xb10d('0xb')](),controller[_0xb10d('0x11')]);router[_0xb10d('0x12')](_0xb10d('0xe'),auth[_0xb10d('0xb')](),controller['destroy']);module[_0xb10d('0x13')]=router; \ No newline at end of file +var _0x5711=['show','/:id/download','download','create','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id'];(function(_0x2e8b1e,_0x13c934){var _0x3a707a=function(_0x33dbf){while(--_0x33dbf){_0x2e8b1e['push'](_0x2e8b1e['shift']());}};_0x3a707a(++_0x13c934);}(_0x5711,0x94));var _0x1571=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x5711[_0x593564];return _0x211a89;};'use strict';var multer=require(_0x1571('0x0'));var util=require(_0x1571('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1571('0x2'));var router=express['Router']();var fs_extra=require(_0x1571('0x3'));var auth=require(_0x1571('0x4'));var interaction=require(_0x1571('0x5'));var config=require(_0x1571('0x6'));var controller=require('./screenRecording.controller');router[_0x1571('0x7')]('/',auth['isAuthenticated'](),controller[_0x1571('0x8')]);router[_0x1571('0x7')](_0x1571('0x9'),auth[_0x1571('0xa')](),controller['describe']);router['get'](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0xc')]);router['get'](_0x1571('0xd'),auth[_0x1571('0xa')](),controller[_0x1571('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1571('0xf')]);router[_0x1571('0x10')](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0x11')]);router[_0x1571('0x12')](_0x1571('0xb'),auth[_0x1571('0xa')](),controller[_0x1571('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5dd5e54..1c64e76 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 _0x2deb=['moment','path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','format','sequelize'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb2de('0x0'));var moment=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var config=require(_0xb2de('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb2de('0x4')](_0xb2de('0x5'))?path[_0xb2de('0x6')](this[_0xb2de('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb2de('0x7')]},'value':{'type':Sequelize[_0xb2de('0x7')],'set':function(_0x191004){var _0x49307b=_0x191004[_0xb2de('0x8')](/\\/g,'/');this[_0xb2de('0x9')]('value',_0x49307b);}},'rating':{'type':Sequelize[_0xb2de('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb2de('0xa')],'set':function(_0x1d40ec){this['setDataValue'](_0xb2de('0xb'),moment()[_0xb2de('0xc')](_0x1d40ec,'ms'));this[_0xb2de('0x9')](_0xb2de('0xd'),moment());this['setDataValue']('duration',_0x1d40ec);}},'startedAt':{'type':Sequelize[_0xb2de('0xe')],'get':function(){return moment(this[_0xb2de('0x4')](_0xb2de('0xb')))['format'](_0xb2de('0xf'))[_0xb2de('0x10')]();}},'closedAt':{'type':Sequelize[_0xb2de('0xe')],'get':function(){return moment(this['getDataValue'](_0xb2de('0xd')))['format'](_0xb2de('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xb2de('0xe')],'get':function(){return moment(this[_0xb2de('0x4')](_0xb2de('0x11')))['format'](_0xb2de('0xf'))[_0xb2de('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb2de('0xe')],'get':function(){return moment(this[_0xb2de('0x4')](_0xb2de('0x12')))[_0xb2de('0x13')](_0xb2de('0xf'))[_0xb2de('0x10')]();}}}; \ No newline at end of file +var _0x2581=['value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','../../config/environment','exports','getDataValue'];(function(_0x156b4c,_0x32fab7){var _0x91e4e5=function(_0x1817b5){while(--_0x1817b5){_0x156b4c['push'](_0x156b4c['shift']());}};_0x91e4e5(++_0x32fab7);}(_0x2581,0xcb));var _0x1258=function(_0x516b4e,_0x75e8f3){_0x516b4e=_0x516b4e-0x0;var _0x58d624=_0x2581[_0x516b4e];return _0x58d624;};'use strict';var Sequelize=require(_0x1258('0x0'));var moment=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var config=require(_0x1258('0x3'));module[_0x1258('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1258('0x5')](_0x1258('0x6'))?path[_0x1258('0x7')](this[_0x1258('0x5')](_0x1258('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x1258('0x8')]},'channel':{'type':Sequelize[_0x1258('0x8')]},'value':{'type':Sequelize[_0x1258('0x8')],'set':function(_0x582ed7){var _0x3e1044=_0x582ed7[_0x1258('0x9')](/\\/g,'/');this[_0x1258('0xa')](_0x1258('0x6'),_0x3e1044);}},'rating':{'type':Sequelize[_0x1258('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1258('0xb')],'set':function(_0x429efc){this['setDataValue']('startedAt',moment()[_0x1258('0xc')](_0x429efc,'ms'));this[_0x1258('0xa')](_0x1258('0xd'),moment());this[_0x1258('0xa')]('duration',_0x429efc);}},'startedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')](_0x1258('0xf')))[_0x1258('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x1258('0x11')]();}},'closedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')](_0x1258('0xd')))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1258('0x5')]('createdAt'))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}},'updatedAt':{'type':Sequelize[_0x1258('0xe')],'get':function(){return moment(this[_0x1258('0x5')]('updatedAt'))[_0x1258('0x10')](_0x1258('0x12'))[_0x1258('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index bdc5060..11ad958 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 _0x7fbe=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','stack','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','find','catch','create','body','duration','createdAt','closedAt','params','describe','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x48c496,_0x5b7509){var _0x555d5e=function(_0x2f2c28){while(--_0x2f2c28){_0x48c496['push'](_0x48c496['shift']());}};_0x555d5e(++_0x5b7509);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xe01a2,_0xfd91e){_0xe01a2=_0xe01a2-0x0;var _0x1e8116=_0x7fbe[_0xe01a2];return _0x1e8116;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['differenceBy'](_[_0xe7fb('0x2c')](_0x219554,'name'),[_0xe7fb('0x32')]);_0xd3fffe[_0xe7fb('0x33')]=_[_0xe7fb('0x34')](_0x4fd290[_0xe7fb('0x33')]);_0xd3fffe['filters']=_[_0xe7fb('0x35')](_0xd3fffe[_0xe7fb('0x36')],_0xd3fffe[_0xe7fb('0x33')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xd3fffe['model'],qs[_0xe7fb('0x38')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x39')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x36')];if(!_0x4fd290[_0xe7fb('0x33')]['hasOwnProperty'](_0xe7fb('0x3a'))){_0x251807[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x4fd290['query'][_0xe7fb('0x20')]);_0x251807[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3b')]=qs[_0xe7fb('0x3c')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x3c')]);_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_[_0xe7fb('0x3f')](_0x4fd290[_0xe7fb('0x33')],_0xd3fffe[_0xe7fb('0x3e')]),_0x219554);if(_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]){_0x251807[_0xe7fb('0x3d')]=_[_0xe7fb('0x41')](_0x251807[_0xe7fb('0x3d')],{'$or':_['map'](_0x219554,function(_0x261ec5){if(_0x261ec5[_0xe7fb('0x30')]!==_0xe7fb('0x42')){var _0x444f98={};_0x444f98[_0x261ec5['name']]={'$like':'%'+_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]+'%'};return _0x444f98;}})});}_0x251807=_[_0xe7fb('0x41')]({},_0x251807,_0x4fd290[_0xe7fb('0x43')]);var _0x49fe9d={'where':_0x251807[_0xe7fb('0x3d')]};return db[_0xe7fb('0x2d')][_0xe7fb('0x21')](_0x49fe9d)[_0xe7fb('0x26')](function(_0x468d16){_0x5f265f[_0xe7fb('0x21')]=_0x468d16;if(_0x4fd290['query'][_0xe7fb('0x44')]){_0x251807[_0xe7fb('0x45')]=[{'all':!![]}];}return db[_0xe7fb('0x2d')]['findAll'](_0x251807);})[_0xe7fb('0x26')](function(_0x3a8c52){_0x5f265f['rows']=_0x3a8c52;return _0x5f265f;})['then'](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5e0153,_0x900d67){var _0x957ca3={'raw':![],'where':{'id':_0x5e0153['params']['id']}},_0xed62e9={};_0xed62e9[_0xe7fb('0x36')]=_['keys'](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')]);_0xed62e9['query']=_[_0xe7fb('0x34')](_0x5e0153[_0xe7fb('0x33')]);_0xed62e9[_0xe7fb('0x3e')]=_[_0xe7fb('0x35')](_0xed62e9['model'],_0xed62e9[_0xe7fb('0x33')]);_0x957ca3[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xed62e9['model'],qs[_0xe7fb('0x38')](_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x957ca3[_0xe7fb('0x37')]=_0x957ca3[_0xe7fb('0x37')]['length']?_0x957ca3[_0xe7fb('0x37')]:_0xed62e9['model'];if(_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x44')]){_0x957ca3[_0xe7fb('0x45')]=[{'all':!![]}];}_0x957ca3=_[_0xe7fb('0x41')]({},_0x957ca3,_0x5e0153[_0xe7fb('0x43')]);return db['ScreenRecording'][_0xe7fb('0x46')](_0x957ca3)['then'](handleEntityNotFound(_0x900d67,null))['then'](respondWithResult(_0x900d67,null))[_0xe7fb('0x47')](handleError(_0x900d67,null));};exports[_0xe7fb('0x48')]=function(_0x16327f,_0x589555){return db[_0xe7fb('0x2d')][_0xe7fb('0x48')](_0x16327f['body'],{})['then'](respondWithResult(_0x589555,0xc9))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x1cbf34,_0x3dd6bf){if(_0x1cbf34[_0xe7fb('0x49')]['id']){delete _0x1cbf34[_0xe7fb('0x49')]['id'];}delete _0x1cbf34[_0xe7fb('0x49')][_0xe7fb('0x4a')];delete _0x1cbf34['body'][_0xe7fb('0x4b')];delete _0x1cbf34['body'][_0xe7fb('0x4c')];delete _0x1cbf34[_0xe7fb('0x49')]['value'];return db[_0xe7fb('0x2d')]['find']({'where':{'id':_0x1cbf34[_0xe7fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3dd6bf,null))[_0xe7fb('0x26')](saveUpdates(_0x1cbf34['body'],null))[_0xe7fb('0x26')](respondWithResult(_0x3dd6bf,null))['catch'](handleError(_0x3dd6bf,null));};exports[_0xe7fb('0x4e')]=function(_0x1b6442,_0x41fcfb){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x41fcfb,null))[_0xe7fb('0x47')](handleError(_0x41fcfb,null));};exports['download']=function(_0x5d20dc,_0x20aa55,_0x4948a7){var _0x4f4240=require('../../components/encryptor');var _0x50b8df=![];var _0x539252={};if(_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]&&_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]==='uniqueid'){_0x539252[_0xe7fb('0x4f')]=_0x5d20dc[_0xe7fb('0x4d')]['id'];}else{_0x539252['id']=_0x5d20dc[_0xe7fb('0x4d')]['id'];}return db['ScreenRecording']['find']({'where':_0x539252,'attributes':['id',_0xe7fb('0x50')],'raw':!![]})[_0xe7fb('0x26')](handleEntityNotFound(_0x20aa55,null))[_0xe7fb('0x26')](function(_0x4f4ba3){if(_0x4f4ba3){var _0x27f860=path[_0xe7fb('0x51')](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x4f4ba3['value']);var _0x4b35f9=util[_0xe7fb('0x32')](_0xe7fb('0x54'),_0x27f860);if(fs[_0xe7fb('0x55')](_0x4b35f9)){_0x50b8df=!![];return _0x4f4240[_0xe7fb('0x56')](_0x4b35f9,_0x27f860,config[_0xe7fb('0x57')]['recording'])[_0xe7fb('0x26')](function(){return _0x4f4ba3;});}return _0x4f4ba3;}})[_0xe7fb('0x26')](function(_0x23755b){if(_0x23755b){var _0x590d7a=path['join'](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x23755b[_0xe7fb('0x50')]);if(!fs[_0xe7fb('0x55')](_0x590d7a)){throw new db[(_0xe7fb('0x58'))][(_0xe7fb('0x59'))]('ScreenRecording\x20not\x20found');}if(_0x23755b[_0xe7fb('0x5a')]){return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,_0x23755b[_0xe7fb('0x5a')]+path[_0xe7fb('0x5c')](_0x590d7a),function(){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}else{return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,function(_0x554092){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}}})['catch'](function(_0x1eda1d){if(_0x1eda1d[_0xe7fb('0x5e')]===_0xe7fb('0x5f')){_0x20aa55[_0xe7fb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x20aa55,null);}});};exports[_0xe7fb('0x60')]=function(_0x11e15a,_0x25aeb2){return db[_0xe7fb('0x2d')][_0xe7fb('0x46')]({'where':{'id':_0x11e15a['params']['id']}})[_0xe7fb('0x26')](function(_0x58d4ec){if(_[_0xe7fb('0x61')](_0x58d4ec)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d4ec;})['then'](function(_0xc13fac){var _0x203da3=path[_0xe7fb('0x51')](config['root'],_0xe7fb('0x53'),_0xc13fac[_0xe7fb('0x50')]);logger[_0xe7fb('0x62')](_0xe7fb('0x63'),_0x203da3);if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')]('File:\x20\x22'+_0x203da3+_0xe7fb('0x64'));fs[_0xe7fb('0x65')](_0x203da3);}_0x203da3=_0x203da3+'.cypher';if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')](_0xe7fb('0x66')+_0x203da3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7fb('0x65')](_0x203da3);}return _0xc13fac;})[_0xe7fb('0x26')](function(_0x2c558a){if(!_0x2c558a)throw new InternalError();return _0x2c558a[_0xe7fb('0x60')]();})[_0xe7fb('0x26')](function(){_0x25aeb2[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();})[_0xe7fb('0x47')](handleError(_0x25aeb2,null));}; \ No newline at end of file +var _0x6aa7=['fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','find','catch','create','body','duration','createdAt','closedAt','params','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','download','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6aa7,0x178));var _0x76aa=function(_0x95ad75,_0x494e6f){_0x95ad75=_0x95ad75-0x0;var _0xe3a140=_0x6aa7[_0x95ad75];return _0xe3a140;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x26b75e,_0x3599a9){return function(_0x4ef9b0){if(!_0x4ef9b0){_0x26b75e[_0x76aa('0x19')](0x194);}return _0x4ef9b0;};}function handleError(_0x1d6d15,_0x25c614){_0x25c614=_0x25c614||0x1f4;return function(_0x2e7ab4){logger[_0x76aa('0x29')](_0x2e7ab4[_0x76aa('0x2a')]);if(_0x2e7ab4[_0x76aa('0x2b')]){delete _0x2e7ab4[_0x76aa('0x2b')];}_0x1d6d15[_0x76aa('0x1a')](_0x25c614)[_0x76aa('0x2c')](_0x2e7ab4);};}exports['index']=function(_0x3fcb7f,_0x5a8030){var _0x994550={},_0x365ff8={},_0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x30')],'type':_0x3827ec[_0x76aa('0x31')]['key']};});_0x365ff8[_0x76aa('0x32')]=_[_0x76aa('0x33')](_[_0x76aa('0x2d')](_0x1e90b9,_0x76aa('0x2b')),[_0x76aa('0x34')]);_0x365ff8[_0x76aa('0x35')]=_[_0x76aa('0x36')](_0x3fcb7f['query']);_0x365ff8[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x365ff8['model'],_0x365ff8[_0x76aa('0x35')]);_0x994550['attributes']=_[_0x76aa('0x38')](_0x365ff8['model'],qs[_0x76aa('0x39')](_0x3fcb7f['query']['fields']));_0x994550[_0x76aa('0x3a')]=_0x994550[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x994550[_0x76aa('0x3a')]:_0x365ff8['model'];if(!_0x3fcb7f['query'][_0x76aa('0x3c')](_0x76aa('0x3d'))){_0x994550[_0x76aa('0x1f')]=qs[_0x76aa('0x1f')](_0x3fcb7f[_0x76aa('0x35')]['limit']);_0x994550[_0x76aa('0x1e')]=qs['offset'](_0x3fcb7f['query'][_0x76aa('0x1e')]);}_0x994550[_0x76aa('0x3e')]=qs[_0x76aa('0x3f')](_0x3fcb7f[_0x76aa('0x35')]['sort']);_0x994550[_0x76aa('0x40')]=qs[_0x76aa('0x37')](_[_0x76aa('0x41')](_0x3fcb7f['query'],_0x365ff8[_0x76aa('0x37')]),_0x1e90b9);if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]){_0x994550[_0x76aa('0x40')]=_[_0x76aa('0x43')](_0x994550[_0x76aa('0x40')],{'$or':_[_0x76aa('0x2d')](_0x1e90b9,function(_0x307d67){if(_0x307d67[_0x76aa('0x31')]!=='VIRTUAL'){var _0x1525cb={};_0x1525cb[_0x307d67[_0x76aa('0x2b')]]={'$like':'%'+_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x42')]+'%'};return _0x1525cb;}})});}_0x994550=_[_0x76aa('0x43')]({},_0x994550,_0x3fcb7f[_0x76aa('0x44')]);var _0x572fdb={'where':_0x994550['where']};return db[_0x76aa('0x2e')][_0x76aa('0x1d')](_0x572fdb)[_0x76aa('0x27')](function(_0x365612){_0x2dec94['count']=_0x365612;if(_0x3fcb7f[_0x76aa('0x35')][_0x76aa('0x45')]){_0x994550[_0x76aa('0x46')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x47')](_0x994550);})['then'](function(_0x13dafe){_0x2dec94['rows']=_0x13dafe;return _0x2dec94;})[_0x76aa('0x27')](respondWithFilteredResult(_0x5a8030,_0x994550))['catch'](handleError(_0x5a8030,null));};exports['show']=function(_0x4f7f3a,_0x144f0a){var _0x541594={'raw':![],'where':{'id':_0x4f7f3a['params']['id']}},_0x5cf314={};_0x5cf314[_0x76aa('0x32')]=_[_0x76aa('0x36')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x5cf314[_0x76aa('0x35')]=_['keys'](_0x4f7f3a[_0x76aa('0x35')]);_0x5cf314[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],_0x5cf314[_0x76aa('0x35')]);_0x541594['attributes']=_[_0x76aa('0x38')](_0x5cf314[_0x76aa('0x32')],qs['fields'](_0x4f7f3a[_0x76aa('0x35')]['fields']));_0x541594[_0x76aa('0x3a')]=_0x541594[_0x76aa('0x3a')][_0x76aa('0x3b')]?_0x541594[_0x76aa('0x3a')]:_0x5cf314[_0x76aa('0x32')];if(_0x4f7f3a[_0x76aa('0x35')][_0x76aa('0x45')]){_0x541594[_0x76aa('0x46')]=[{'all':!![]}];}_0x541594=_[_0x76aa('0x43')]({},_0x541594,_0x4f7f3a[_0x76aa('0x44')]);return db['ScreenRecording'][_0x76aa('0x48')](_0x541594)['then'](handleEntityNotFound(_0x144f0a,null))[_0x76aa('0x27')](respondWithResult(_0x144f0a,null))[_0x76aa('0x49')](handleError(_0x144f0a,null));};exports[_0x76aa('0x4a')]=function(_0x156d4e,_0x5ca721){return db['ScreenRecording'][_0x76aa('0x4a')](_0x156d4e['body'],{})[_0x76aa('0x27')](respondWithResult(_0x5ca721,0xc9))[_0x76aa('0x49')](handleError(_0x5ca721,null));};exports[_0x76aa('0x26')]=function(_0x2e5633,_0x30c577){if(_0x2e5633[_0x76aa('0x4b')]['id']){delete _0x2e5633['body']['id'];}delete _0x2e5633['body'][_0x76aa('0x4c')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4d')];delete _0x2e5633[_0x76aa('0x4b')][_0x76aa('0x4e')];delete _0x2e5633[_0x76aa('0x4b')]['value'];return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x2e5633[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x30c577,null))[_0x76aa('0x27')](saveUpdates(_0x2e5633['body'],null))[_0x76aa('0x27')](respondWithResult(_0x30c577,null))['catch'](handleError(_0x30c577,null));};exports[_0x76aa('0x50')]=function(_0x4449c1,_0x3c63e5){return db[_0x76aa('0x2e')][_0x76aa('0x50')]()[_0x76aa('0x27')](respondWithResult(_0x3c63e5,null))[_0x76aa('0x49')](handleError(_0x3c63e5,null));};exports['download']=function(_0x186654,_0x5eeaa5,_0x3ee32){var _0x311bd5=require(_0x76aa('0x51'));var _0x53be10=![];var _0x3fa7ec={};if(_0x186654[_0x76aa('0x35')][_0x76aa('0x31')]&&_0x186654['query'][_0x76aa('0x31')]===_0x76aa('0x52')){_0x3fa7ec[_0x76aa('0x52')]=_0x186654[_0x76aa('0x4f')]['id'];}else{_0x3fa7ec['id']=_0x186654['params']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':_0x3fa7ec,'attributes':['id',_0x76aa('0x53')],'raw':!![]})[_0x76aa('0x27')](handleEntityNotFound(_0x5eeaa5,null))[_0x76aa('0x27')](function(_0xf7732){if(_0xf7732){var _0x4e6c09=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0xf7732[_0x76aa('0x53')]);var _0x3967f3=util[_0x76aa('0x34')](_0x76aa('0x57'),_0x4e6c09);if(fs['existsSync'](_0x3967f3)){_0x53be10=!![];return _0x311bd5['decryptFile'](_0x3967f3,_0x4e6c09,config[_0x76aa('0x58')][_0x76aa('0x59')])['then'](function(){return _0xf7732;});}return _0xf7732;}})[_0x76aa('0x27')](function(_0x1e6f3c){if(_0x1e6f3c){var _0x4f832d=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x1e6f3c[_0x76aa('0x53')]);if(!fs[_0x76aa('0x5a')](_0x4f832d)){throw new db[(_0x76aa('0x5b'))][(_0x76aa('0x5c'))](_0x76aa('0x5d'));}if(_0x1e6f3c[_0x76aa('0x5e')]){return _0x5eeaa5['download'](_0x4f832d,_0x1e6f3c[_0x76aa('0x5e')]+path['extname'](_0x4f832d),function(){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}else{return _0x5eeaa5[_0x76aa('0x60')](_0x4f832d,function(_0x2fef92){if(_0x53be10){fs[_0x76aa('0x5f')](_0x4f832d);}});}}})[_0x76aa('0x49')](function(_0x260ad2){if(_0x260ad2[_0x76aa('0x61')]===_0x76aa('0x5d')){_0x5eeaa5[_0x76aa('0x1a')](0x194)['send'](_0x76aa('0x62'));}else{return handleError(_0x5eeaa5,null);}});};exports[_0x76aa('0x28')]=function(_0x5c542b,_0xe5957d){return db[_0x76aa('0x2e')][_0x76aa('0x48')]({'where':{'id':_0x5c542b[_0x76aa('0x4f')]['id']}})[_0x76aa('0x27')](function(_0x5546b6){if(_[_0x76aa('0x63')](_0x5546b6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5546b6;})[_0x76aa('0x27')](function(_0x35881c){var _0x3e97f8=path[_0x76aa('0x54')](config[_0x76aa('0x55')],_0x76aa('0x56'),_0x35881c[_0x76aa('0x53')]);logger['info'](_0x76aa('0x64'),_0x3e97f8);if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs['existsSync'](_0x3e97f8)){logger[_0x76aa('0x65')](_0x76aa('0x66')+_0x3e97f8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76aa('0x67')](_0x3e97f8);}_0x3e97f8=_0x3e97f8+_0x76aa('0x68');if(!_[_0x76aa('0x63')](_0x35881c['value'])&&fs[_0x76aa('0x5a')](_0x3e97f8)){logger['info'](_0x76aa('0x66')+_0x3e97f8+_0x76aa('0x69'));fs[_0x76aa('0x67')](_0x3e97f8);}return _0x35881c;})[_0x76aa('0x27')](function(_0x55ca84){if(!_0x55ca84)throw new InternalError();return _0x55ca84['destroy']();})[_0x76aa('0x27')](function(){_0xe5957d['status'](0xcc)[_0x76aa('0x1b')]();})[_0x76aa('0x49')](handleError(_0xe5957d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e9a3230..7b3bc2a 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 _0xfdef=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfdef,0x1a9));var _0xffde=function(_0x277630,_0x31649f){_0x277630=_0x277630-0x0;var _0xff7b9f=_0xfdef[_0x277630];return _0xff7b9f;};'use strict';var _=require(_0xffde('0x0'));var util=require(_0xffde('0x1'));var logger=require(_0xffde('0x2'))(_0xffde('0x3'));var moment=require('moment');var BPromise=require(_0xffde('0x4'));var rp=require(_0xffde('0x5'));var fs=require('fs');var path=require(_0xffde('0x6'));var rimraf=require(_0xffde('0x7'));var config=require('../../config/environment');var attributes=require(_0xffde('0x8'));module[_0xffde('0x9')]=function(_0x3902e3,_0x5a3d95){return _0x3902e3['define'](_0xffde('0xa'),attributes,{'tableName':_0xffde('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xffde('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2aee=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x4724fb,_0x15dc89){var _0x8e378=function(_0x369dd6){while(--_0x369dd6){_0x4724fb['push'](_0x4724fb['shift']());}};_0x8e378(++_0x15dc89);}(_0x2aee,0x1cf));var _0xe2ae=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0x2aee[_0x9bca53];return _0x3894bc;};'use strict';var _=require(_0xe2ae('0x0'));var util=require(_0xe2ae('0x1'));var logger=require(_0xe2ae('0x2'))(_0xe2ae('0x3'));var moment=require(_0xe2ae('0x4'));var BPromise=require(_0xe2ae('0x5'));var rp=require(_0xe2ae('0x6'));var fs=require('fs');var path=require(_0xe2ae('0x7'));var rimraf=require(_0xe2ae('0x8'));var config=require(_0xe2ae('0x9'));var attributes=require(_0xe2ae('0xa'));module[_0xe2ae('0xb')]=function(_0x296392,_0x3b8d07){return _0x296392[_0xe2ae('0xc')](_0xe2ae('0xd'),attributes,{'tableName':_0xe2ae('0xe'),'paranoid':![],'indexes':[{'name':_0xe2ae('0xf'),'fields':[_0xe2ae('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3f76f42..02651c8 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 _0x6317=['then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x38c93f,_0x41bebc){var _0x4bc1f6=function(_0xdee6bb){while(--_0xdee6bb){_0x38c93f['push'](_0x38c93f['shift']());}};_0x4bc1f6(++_0x41bebc);}(_0x6317,0x75));var _0x7631=function(_0x17a2bd,_0x434f1b){_0x17a2bd=_0x17a2bd-0x0;var _0x5651e0=_0x6317[_0x17a2bd];return _0x5651e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7631('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7631('0x1'))['db'];var utils=require(_0x7631('0x2'));var logger=require('../../config/logger')(_0x7631('0x3'));var config=require(_0x7631('0x4'));var jayson=require(_0x7631('0x5'));var client=jayson[_0x7631('0x6')][_0x7631('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x408cb8,_0x5c7e88,_0x1627b8){return new BPromise(function(_0x595ec6,_0xe88dba){return client[_0x7631('0x8')](_0x408cb8,_0x1627b8)[_0x7631('0x9')](function(_0x1e6bfc){logger[_0x7631('0xa')](_0x7631('0xb'),_0x5c7e88,_0x7631('0xc'));logger[_0x7631('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x5c7e88,'request\x20sent',JSON[_0x7631('0xe')](_0x1e6bfc));if(_0x1e6bfc[_0x7631('0xf')]){if(_0x1e6bfc[_0x7631('0xf')][_0x7631('0x10')]===0x1f4){logger[_0x7631('0xf')](_0x7631('0xb'),_0x5c7e88,_0x1e6bfc['error']['message']);return _0xe88dba(_0x1e6bfc[_0x7631('0xf')]['message']);}logger[_0x7631('0xf')](_0x7631('0xb'),_0x5c7e88,_0x1e6bfc[_0x7631('0xf')]['message']);return _0x595ec6(_0x1e6bfc[_0x7631('0xf')]['message']);}else{logger[_0x7631('0xa')](_0x7631('0xb'),_0x5c7e88,_0x7631('0xc'));_0x595ec6(_0x1e6bfc[_0x7631('0x11')]['message']);}})['catch'](function(_0x19a4f7){logger[_0x7631('0xf')](_0x7631('0xb'),_0x5c7e88,_0x19a4f7);_0xe88dba(_0x19a4f7);});});} \ No newline at end of file +var _0xd8ae=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash'];(function(_0x14723d,_0x4e09de){var _0x53227d=function(_0x28aea4){while(--_0x28aea4){_0x14723d['push'](_0x14723d['shift']());}};_0x53227d(++_0x4e09de);}(_0xd8ae,0xaa));var _0xed8a=function(_0x583652,_0x460744){_0x583652=_0x583652-0x0;var _0x4b56fd=_0xd8ae[_0x583652];return _0x4b56fd;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var moment=require('moment');var BPromise=require(_0xed8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed8a('0x3'));var db=require(_0xed8a('0x4'))['db'];var utils=require(_0xed8a('0x5'));var logger=require(_0xed8a('0x6'))('rpc');var config=require(_0xed8a('0x7'));var jayson=require(_0xed8a('0x8'));var client=jayson[_0xed8a('0x9')][_0xed8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116b97,_0x9cd37b,_0x4b3764){return new BPromise(function(_0x4ac30c,_0x5bd0c7){return client[_0xed8a('0xb')](_0x116b97,_0x4b3764)[_0xed8a('0xc')](function(_0x1a79ff){logger[_0xed8a('0xd')](_0xed8a('0xe'),_0x9cd37b,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x9cd37b,_0xed8a('0xf'),JSON['stringify'](_0x1a79ff));if(_0x1a79ff[_0xed8a('0x10')]){if(_0x1a79ff['error']['code']===0x1f4){logger[_0xed8a('0x10')](_0xed8a('0xe'),_0x9cd37b,_0x1a79ff['error']['message']);return _0x5bd0c7(_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);}logger[_0xed8a('0x10')](_0xed8a('0xe'),_0x9cd37b,_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);return _0x4ac30c(_0x1a79ff[_0xed8a('0x10')][_0xed8a('0x11')]);}else{logger[_0xed8a('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x9cd37b,_0xed8a('0xf'));_0x4ac30c(_0x1a79ff['result'][_0xed8a('0x11')]);}})[_0xed8a('0x12')](function(_0x17b874){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x9cd37b,_0x17b874);_0x5bd0c7(_0x17b874);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ddf634a..4ccd5f7 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 _0xb493=['server/files/images/logos/','format','logo','extname','originalname','post','single','file','addLogo','%s%s','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root'];(function(_0x4f7334,_0x413d0d){var _0x3f69c3=function(_0x1d395b){while(--_0x1d395b){_0x4f7334['push'](_0x4f7334['shift']());}};_0x3f69c3(++_0x413d0d);}(_0xb493,0x14e));var _0x3b49=function(_0x24792b,_0x258652){_0x24792b=_0x24792b-0x0;var _0x365277=_0xb493[_0x24792b];return _0x365277;};'use strict';var multer=require(_0x3b49('0x0'));var util=require(_0x3b49('0x1'));var path=require('path');var timeout=require(_0x3b49('0x2'));var express=require(_0x3b49('0x3'));var router=express[_0x3b49('0x4')]();var fs_extra=require(_0x3b49('0x5'));var auth=require(_0x3b49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x3b49('0x7')]('/',auth[_0x3b49('0x8')](),controller[_0x3b49('0x9')]);router['get'](_0x3b49('0xa'),controller[_0x3b49('0xb')]);router[_0x3b49('0x7')](_0x3b49('0xc'),controller[_0x3b49('0xd')]);router[_0x3b49('0x7')](_0x3b49('0xe'),controller[_0x3b49('0xf')]);router[_0x3b49('0x7')](_0x3b49('0x10'),controller[_0x3b49('0x11')]);router[_0x3b49('0x7')]('/:id/gdpr',controller[_0x3b49('0x12')]);router[_0x3b49('0x7')](_0x3b49('0x13'),controller[_0x3b49('0x14')]);router[_0x3b49('0x7')](_0x3b49('0x15'),controller[_0x3b49('0x16')]);var upload=multer({'storage':multer[_0x3b49('0x17')]({'destination':function(_0xcff9dc,_0x25423,_0x3eeeac){_0x3eeeac(null,path[_0x3b49('0x18')](config[_0x3b49('0x19')],_0x3b49('0x1a')));},'filename':function(_0xdc822f,_0x3743e0,_0x2aab80){_0x2aab80(null,util[_0x3b49('0x1b')]('%s%s',_0x3b49('0x1c'),path[_0x3b49('0x1d')](_0x3743e0[_0x3b49('0x1e')])));}})});router[_0x3b49('0x1f')](_0x3b49('0xe'),upload[_0x3b49('0x20')](_0x3b49('0x21')),controller[_0x3b49('0x22')]);var upload=multer({'storage':multer[_0x3b49('0x17')]({'destination':function(_0x55acca,_0x2940be,_0x24094c){_0x24094c(null,path[_0x3b49('0x18')](config[_0x3b49('0x19')],_0x3b49('0x1a')));},'filename':function(_0x1394de,_0x1bbdb7,_0x4256b7){_0x4256b7(null,util[_0x3b49('0x1b')](_0x3b49('0x23'),_0x3b49('0x24'),path[_0x3b49('0x1d')](_0x1bbdb7[_0x3b49('0x1e')])));}})});router[_0x3b49('0x1f')]('/:id/logo_login',upload['single']('file'),controller[_0x3b49('0x25')]);var upload=multer({'storage':multer[_0x3b49('0x17')]({'destination':function(_0x3505c4,_0x2b3cf6,_0x455530){_0x455530(null,path[_0x3b49('0x18')](config[_0x3b49('0x19')],'server/files/images/logos/'));},'filename':function(_0x2d8c10,_0x1b963d,_0x4eed35){_0x4eed35(null,util[_0x3b49('0x1b')](_0x3b49('0x23'),_0x3b49('0x26'),path[_0x3b49('0x1d')](_0x1b963d[_0x3b49('0x1e')])));}})});router[_0x3b49('0x1f')](_0x3b49('0x13'),upload[_0x3b49('0x20')](_0x3b49('0x21')),controller[_0x3b49('0x27')]);var upload=multer({'storage':multer[_0x3b49('0x17')]({'destination':function(_0x128675,_0x18bafa,_0x480310){_0x480310(null,path[_0x3b49('0x18')](config[_0x3b49('0x19')],_0x3b49('0x1a')));},'filename':function(_0x2541e0,_0x35ccea,_0x15c0e5){_0x15c0e5(null,util['format'](_0x3b49('0x23'),_0x3b49('0x28'),path['extname'](_0x35ccea[_0x3b49('0x1e')])));}})});router['post'](_0x3b49('0x15'),upload[_0x3b49('0x20')](_0x3b49('0x21')),controller[_0x3b49('0x29')]);router[_0x3b49('0x2a')](_0x3b49('0xc'),auth[_0x3b49('0x8')](),controller[_0x3b49('0x2b')]);module[_0x3b49('0x2c')]=router; \ No newline at end of file +var _0x48f8=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','/:id/logo','addLogo','join','logologin','originalname','post','addLogoLogin','preferred','single','file','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x5b8290,_0x30c005){var _0xc4418d=function(_0x310e88){while(--_0x310e88){_0x5b8290['push'](_0x5b8290['shift']());}};_0xc4418d(++_0x30c005);}(_0x48f8,0xf1));var _0x848f=function(_0x465bd3,_0x17a11e){_0x465bd3=_0x465bd3-0x0;var _0x366ccc=_0x48f8[_0x465bd3];return _0x366ccc;};'use strict';var multer=require(_0x848f('0x0'));var util=require('util');var path=require(_0x848f('0x1'));var timeout=require(_0x848f('0x2'));var express=require(_0x848f('0x3'));var router=express[_0x848f('0x4')]();var fs_extra=require(_0x848f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x848f('0x6'));var config=require(_0x848f('0x7'));var controller=require('./setting.controller');router[_0x848f('0x8')]('/',auth[_0x848f('0x9')](),controller['index']);router[_0x848f('0x8')]('/now',controller['getDate']);router[_0x848f('0x8')](_0x848f('0xa'),controller['show']);router[_0x848f('0x8')]('/:id/logo',controller['getLogo']);router[_0x848f('0x8')](_0x848f('0xb'),controller[_0x848f('0xc')]);router['get'](_0x848f('0xd'),controller[_0x848f('0xe')]);router['get'](_0x848f('0xf'),controller[_0x848f('0x10')]);router[_0x848f('0x8')](_0x848f('0x11'),controller[_0x848f('0x12')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x31ed71,_0x47637a,_0x2b47ee){_0x2b47ee(null,path['join'](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x4cc201,_0x695677,_0x1314f0){_0x1314f0(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x18'),path[_0x848f('0x19')](_0x695677['originalname'])));}})});router['post'](_0x848f('0x1a'),upload['single']('file'),controller[_0x848f('0x1b')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x25ab10,_0x36608b,_0x49f36c){_0x49f36c(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],'server/files/images/logos/'));},'filename':function(_0x19e1ab,_0x4276f0,_0x27ba4e){_0x27ba4e(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x1d'),path['extname'](_0x4276f0[_0x848f('0x1e')])));}})});router[_0x848f('0x1f')](_0x848f('0xb'),upload['single']('file'),controller[_0x848f('0x20')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x592fa0,_0x4bba03,_0xe4950){_0xe4950(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x3fae22,_0x457bfc,_0x59876b){_0x59876b(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x21'),path[_0x848f('0x19')](_0x457bfc['originalname'])));}})});router[_0x848f('0x1f')](_0x848f('0xf'),upload[_0x848f('0x22')](_0x848f('0x23')),controller[_0x848f('0x24')]);var upload=multer({'storage':multer[_0x848f('0x13')]({'destination':function(_0x507490,_0x371ba7,_0x3fa1ad){_0x3fa1ad(null,path[_0x848f('0x1c')](config[_0x848f('0x14')],_0x848f('0x15')));},'filename':function(_0x226dd7,_0x57926c,_0xed45c){_0xed45c(null,util[_0x848f('0x16')](_0x848f('0x17'),_0x848f('0x25'),path[_0x848f('0x19')](_0x57926c[_0x848f('0x1e')])));}})});router['post'](_0x848f('0x11'),upload['single']('file'),controller[_0x848f('0x26')]);router[_0x848f('0x27')](_0x848f('0xa'),auth[_0x848f('0x9')](),controller[_0x848f('0x28')]);module[_0x848f('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e84984d..e2e3992 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x533995,_0x4ef90c){var _0x2984c4=function(_0x4d48be){while(--_0x4d48be){_0x533995['push'](_0x533995['shift']());}};_0x2984c4(++_0x4ef90c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x280b68,_0x40e9fc){var _0x51c17b=function(_0x35ff30){while(--_0x35ff30){_0x280b68['push'](_0x280b68['shift']());}};_0x51c17b(++_0x40e9fc);}(_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')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3d64249..84d84ae 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 _0xbf04=['apply','save','update','stack','name','send','index','map','rawAttributes','type','key','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','params','length','find','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','logo','root','default_logo.svg','custom','Sequelize','ValidationError','\x20not\x20found','getLicense','default_loginLogo.svg','upperFirst','download','securePassword','addPreferred','defaultLogo','default_preferred.png','getFavicon','default_favicon.ico','default','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Setting,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x2a43a9,_0x43d4dd){var _0x51dd8f=function(_0x3fe364){while(--_0x3fe364){_0x2a43a9['push'](_0x2a43a9['shift']());}};_0x51dd8f(++_0x43d4dd);}(_0xbf04,0xc1));var _0x4bf0=function(_0x5b1a1a,_0x3e7ecf){_0x5b1a1a=_0x5b1a1a-0x0;var _0x56385f=_0xbf04[_0x5b1a1a];return _0x56385f;};'use strict';var emlformat=require(_0x4bf0('0x0'));var rimraf=require(_0x4bf0('0x1'));var zipdir=require(_0x4bf0('0x2'));var jsonpatch=require(_0x4bf0('0x3'));var rp=require('request-promise');var moment=require(_0x4bf0('0x4'));var BPromise=require(_0x4bf0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4bf0('0x6'));var sox=require(_0x4bf0('0x7'));var csv=require('to-csv');var ejs=require(_0x4bf0('0x8'));var fs=require('fs');var fs_extra=require(_0x4bf0('0x9'));var _=require(_0x4bf0('0xa'));var squel=require(_0x4bf0('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bf0('0xc'));var deskjs=require(_0x4bf0('0xd'));var toCsv=require(_0x4bf0('0xe'));var querystring=require(_0x4bf0('0xf'));var Papa=require(_0x4bf0('0x10'));var Redis=require('ioredis');var authService=require(_0x4bf0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4bf0('0x12'));var hardwareService=require(_0x4bf0('0x13'));var logger=require(_0x4bf0('0x14'))(_0x4bf0('0x15'));var utils=require('../../config/utils');var config=require(_0x4bf0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4bf0('0x17'));var client=jayson[_0x4bf0('0x18')][_0x4bf0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2e3f67,_0x542545,_0x58a47c,_0x4b088f){return new BPromise(function(_0x2cfb14,_0x13a30e){var _0xaa8b5e=_0x4b088f||client;return _0xaa8b5e[_0x4bf0('0x1a')](_0x2e3f67,_0x58a47c)[_0x4bf0('0x1b')](function(_0x2659ad){logger[_0x4bf0('0x1c')]('Setting,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'),JSON['stringify'](_0x2659ad));if(_0x2659ad[_0x4bf0('0x1e')]){if(_0x2659ad[_0x4bf0('0x1e')][_0x4bf0('0x1f')]===0x1f4){logger[_0x4bf0('0x1e')](_0x4bf0('0x20'),_0x542545,_0x2659ad[_0x4bf0('0x1e')]['message']);return _0x13a30e(_0x2659ad[_0x4bf0('0x1e')][_0x4bf0('0x21')]);}logger[_0x4bf0('0x1e')]('Setting,\x20%s,\x20%s',_0x542545,_0x2659ad['error'][_0x4bf0('0x21')]);return _0x2cfb14(_0x2659ad['error'][_0x4bf0('0x21')]);}else{logger[_0x4bf0('0x1c')]('Setting,\x20%s,\x20%s',_0x542545,_0x4bf0('0x1d'));_0x2cfb14(_0x2659ad['result']['message']);}})[_0x4bf0('0x22')](function(_0x4f9004){logger[_0x4bf0('0x1e')]('Setting,\x20%s,\x20%s',_0x542545,_0x4f9004);_0x13a30e(_0x4f9004);});});}function respondWithStatusCode(_0x202ad8,_0x40bf5a){_0x40bf5a=_0x40bf5a||0xcc;return function(_0x2ae478){if(_0x2ae478){return _0x202ad8['sendStatus'](_0x40bf5a);}return _0x202ad8[_0x4bf0('0x23')](_0x40bf5a)[_0x4bf0('0x24')]();};}function respondWithResult(_0x83e7ec,_0x28f065){_0x28f065=_0x28f065||0xc8;return function(_0x3f3708){if(_0x3f3708){return _0x83e7ec[_0x4bf0('0x23')](_0x28f065)[_0x4bf0('0x25')](_0x3f3708);}};}function respondWithFilteredResult(_0x150427,_0x2b0c8e){return function(_0x49bb67){if(_0x49bb67){var _0x421663=typeof _0x2b0c8e[_0x4bf0('0x26')]==='undefined'&&typeof _0x2b0c8e[_0x4bf0('0x27')]==='undefined';var _0x2773da=_0x49bb67[_0x4bf0('0x28')];var _0x4de014=_0x421663?0x0:_0x2b0c8e[_0x4bf0('0x26')];var _0x43d2d3=_0x421663?_0x49bb67['count']:_0x2b0c8e['offset']+_0x2b0c8e['limit'];var _0x332a66;if(_0x43d2d3>=_0x2773da){_0x43d2d3=_0x2773da;_0x332a66=0xc8;}else{_0x332a66=0xce;}_0x150427[_0x4bf0('0x23')](_0x332a66);return _0x150427[_0x4bf0('0x29')](_0x4bf0('0x2a'),_0x4de014+'-'+_0x43d2d3+'/'+_0x2773da)[_0x4bf0('0x25')](_0x49bb67);}return null;};}function patchUpdates(_0x443fac){return function(_0x7799a7){try{jsonpatch[_0x4bf0('0x2b')](_0x7799a7,_0x443fac,!![]);}catch(_0x3cc049){return BPromise['reject'](_0x3cc049);}return _0x7799a7[_0x4bf0('0x2c')]();};}function saveUpdates(_0x1868e4,_0x3d583d){return function(_0x1fae0f){if(_0x1fae0f){return _0x1fae0f[_0x4bf0('0x2d')](_0x1868e4)['then'](function(_0xb4f415){return _0xb4f415;});}return null;};}function removeEntity(_0x2102c9,_0x1cdbf3){return function(_0x2c009a){if(_0x2c009a){return _0x2c009a['destroy']()[_0x4bf0('0x1b')](function(){_0x2102c9[_0x4bf0('0x23')](0xcc)[_0x4bf0('0x24')]();});}};}function handleEntityNotFound(_0x22ad76,_0x53ab7f){return function(_0x4af327){if(!_0x4af327){_0x22ad76['sendStatus'](0x194);}return _0x4af327;};}function handleError(_0x43b2c6,_0x23306f){_0x23306f=_0x23306f||0x1f4;return function(_0x3cdf5f){logger[_0x4bf0('0x1e')](_0x3cdf5f[_0x4bf0('0x2e')]);if(_0x3cdf5f[_0x4bf0('0x2f')]){delete _0x3cdf5f[_0x4bf0('0x2f')];}_0x43b2c6['status'](_0x23306f)[_0x4bf0('0x30')](_0x3cdf5f);};}exports[_0x4bf0('0x31')]=function(_0x3630bc,_0x2853f8){var _0x5b7a0={},_0x5390b0={},_0x2c9fd1={'count':0x0,'rows':[]};var _0x33a207=_[_0x4bf0('0x32')](db['Setting'][_0x4bf0('0x33')],function(_0x2ba575){return{'name':_0x2ba575['fieldName'],'type':_0x2ba575[_0x4bf0('0x34')][_0x4bf0('0x35')]};});_0x5390b0['model']=_[_0x4bf0('0x32')](_0x33a207,'name');_0x5390b0['query']=_[_0x4bf0('0x36')](_0x3630bc['query']);_0x5390b0[_0x4bf0('0x37')]=_['intersection'](_0x5390b0[_0x4bf0('0x38')],_0x5390b0[_0x4bf0('0x39')]);_0x5b7a0[_0x4bf0('0x3a')]=_[_0x4bf0('0x3b')](_0x5390b0['model'],qs[_0x4bf0('0x3c')](_0x3630bc['query']['fields']));_0x5b7a0[_0x4bf0('0x3a')]=_0x5b7a0[_0x4bf0('0x3a')]['length']?_0x5b7a0[_0x4bf0('0x3a')]:_0x5390b0[_0x4bf0('0x38')];if(!_0x3630bc['query'][_0x4bf0('0x3d')]('nolimit')){_0x5b7a0[_0x4bf0('0x27')]=qs[_0x4bf0('0x27')](_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x27')]);_0x5b7a0[_0x4bf0('0x26')]=qs['offset'](_0x3630bc['query']['offset']);}_0x5b7a0[_0x4bf0('0x3e')]=qs['sort'](_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x3f')]);_0x5b7a0['where']=qs[_0x4bf0('0x37')](_['pick'](_0x3630bc[_0x4bf0('0x39')],_0x5390b0[_0x4bf0('0x37')]),_0x33a207);if(_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x40')]){_0x5b7a0[_0x4bf0('0x41')]=_[_0x4bf0('0x42')](_0x5b7a0[_0x4bf0('0x41')],{'$or':_[_0x4bf0('0x32')](_0x33a207,function(_0x90ff62){if(_0x90ff62[_0x4bf0('0x34')]!==_0x4bf0('0x43')){var _0x5e65b5={};_0x5e65b5[_0x90ff62[_0x4bf0('0x2f')]]={'$like':'%'+_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x40')]+'%'};return _0x5e65b5;}})});}_0x5b7a0=_[_0x4bf0('0x42')]({},_0x5b7a0,_0x3630bc[_0x4bf0('0x44')]);var _0xd787cc={'where':_0x5b7a0[_0x4bf0('0x41')]};return db[_0x4bf0('0x45')][_0x4bf0('0x28')](_0xd787cc)[_0x4bf0('0x1b')](function(_0x567d6d){_0x2c9fd1[_0x4bf0('0x28')]=_0x567d6d;if(_0x3630bc[_0x4bf0('0x39')][_0x4bf0('0x46')]){_0x5b7a0[_0x4bf0('0x47')]=[{'all':!![]}];}return db[_0x4bf0('0x45')][_0x4bf0('0x48')](_0x5b7a0);})[_0x4bf0('0x1b')](function(_0x5c5157){_0x2c9fd1[_0x4bf0('0x49')]=_0x5c5157;return _0x2c9fd1;})['then'](respondWithFilteredResult(_0x2853f8,_0x5b7a0))[_0x4bf0('0x22')](handleError(_0x2853f8,null));};exports[_0x4bf0('0x4a')]=function(_0x2561d8,_0x24dfd0){var _0x52dc0={'raw':![],'where':{'id':_0x2561d8[_0x4bf0('0x4b')]['id']}},_0x52f650={};_0x52f650['model']=_[_0x4bf0('0x36')](db[_0x4bf0('0x45')][_0x4bf0('0x33')]);_0x52f650[_0x4bf0('0x39')]=_[_0x4bf0('0x36')](_0x2561d8[_0x4bf0('0x39')]);_0x52f650['filters']=_['intersection'](_0x52f650[_0x4bf0('0x38')],_0x52f650[_0x4bf0('0x39')]);_0x52dc0[_0x4bf0('0x3a')]=_[_0x4bf0('0x3b')](_0x52f650[_0x4bf0('0x38')],qs['fields'](_0x2561d8['query'][_0x4bf0('0x3c')]));_0x52dc0['attributes']=_0x52dc0[_0x4bf0('0x3a')][_0x4bf0('0x4c')]?_0x52dc0[_0x4bf0('0x3a')]:_0x52f650[_0x4bf0('0x38')];if(_0x2561d8[_0x4bf0('0x39')][_0x4bf0('0x46')]){_0x52dc0[_0x4bf0('0x47')]=[{'all':!![]}];}_0x52dc0=_[_0x4bf0('0x42')]({},_0x52dc0,_0x2561d8['options']);return db[_0x4bf0('0x45')][_0x4bf0('0x4d')](_0x52dc0)[_0x4bf0('0x1b')](handleEntityNotFound(_0x24dfd0,null))[_0x4bf0('0x1b')](respondWithResult(_0x24dfd0,null))[_0x4bf0('0x22')](handleError(_0x24dfd0,null));};exports[_0x4bf0('0x2d')]=function(_0x443f46,_0x9df00d){if(_0x443f46[_0x4bf0('0x4e')]['id']){delete _0x443f46['body']['id'];}return db[_0x4bf0('0x45')]['find']({'where':{'id':_0x443f46[_0x4bf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9df00d,null))[_0x4bf0('0x1b')](saveUpdates(_0x443f46['body'],null))[_0x4bf0('0x1b')](respondWithResult(_0x9df00d,null))[_0x4bf0('0x22')](handleError(_0x9df00d,null));};exports[_0x4bf0('0x4f')]=function(_0x311ad4,_0x143e0d,_0x5ab35c){if(_0x311ad4['file']&&_0x311ad4[_0x4bf0('0x50')]['filename']){_0x311ad4[_0x4bf0('0x4e')]['logo']=_0x311ad4['file'][_0x4bf0('0x51')];}return db['Setting']['find']({'where':{'id':_0x311ad4[_0x4bf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x143e0d,null))[_0x4bf0('0x1b')](saveUpdates(_0x311ad4[_0x4bf0('0x4e')],null))['then'](respondWithResult(_0x143e0d,null))['catch'](handleError(_0x143e0d,null));};exports[_0x4bf0('0x52')]=function(_0x476310,_0xbf04f7,_0x58c1b8){if(_0x476310[_0x4bf0('0x50')]&&_0x476310[_0x4bf0('0x50')][_0x4bf0('0x51')]){_0x476310['body'][_0x4bf0('0x53')]=_0x476310[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x476310[_0x4bf0('0x4b')]['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0xbf04f7,null))[_0x4bf0('0x1b')](saveUpdates(_0x476310['body'],null))['then'](respondWithResult(_0xbf04f7,null))[_0x4bf0('0x22')](handleError(_0xbf04f7,null));};var utilLicense=require(_0x4bf0('0x54'));exports[_0x4bf0('0x55')]=function(_0x2bb0e8,_0x11a0aa,_0x57b422){var _0x164288=_0x4bf0('0x56');var _0x44a785={'custom':![]};return utilLicense['getLicense']()[_0x4bf0('0x1b')](function(_0x13a432){if(_0x13a432){_0x44a785=_0x13a432;}return db['Setting'][_0x4bf0('0x4d')]({'where':{'id':_0x2bb0e8[_0x4bf0('0x4b')]['id']},'attributes':['logo',_0x4bf0('0x53'),_0x4bf0('0x57'),_0x4bf0('0x58'),'defaultLogo',_0x4bf0('0x59'),_0x4bf0('0x5a'),_0x4bf0('0x5b')],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x11a0aa,null))[_0x4bf0('0x1b')](function(_0x13a375){if(_0x13a375){var _0x51f393=_0x13a375['logo']&&fs[_0x4bf0('0x5c')](path[_0x4bf0('0x5d')](config['root'],_0x164288,_[_0x4bf0('0x5e')](_0x13a375[_0x4bf0('0x5f')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x164288,_[_0x4bf0('0x5e')](_0x13a375[_0x4bf0('0x5f')])):path[_0x4bf0('0x5d')](config['root'],_0x164288,_[_0x4bf0('0x5e')](_0x4bf0('0x61')));var _0x45b661='default'+_['upperFirst']('logo');if(_0x13a375[_0x45b661]||!_0x44a785[_0x4bf0('0x62')]){_0x51f393=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x164288,_['toLower'](_0x4bf0('0x61')));}if(!fs[_0x4bf0('0x5c')](_0x51f393)){throw new db[(_0x4bf0('0x63'))][(_0x4bf0('0x64'))](_['upperFirst'](_0x4bf0('0x5f'))+_0x4bf0('0x65'));}return _0x11a0aa['download'](_0x51f393);}})[_0x4bf0('0x22')](handleError(_0x11a0aa,null));};var utilLicense=require(_0x4bf0('0x54'));exports['getLogoLogin']=function(_0x27d88d,_0x20319b,_0x24a0ba){var _0x5b9d4a=_0x4bf0('0x56');var _0x40fe20={'custom':![]};return utilLicense[_0x4bf0('0x66')]()['then'](function(_0x22fea4){if(_0x22fea4){_0x40fe20=_0x22fea4;}return db['Setting']['find']({'where':{'id':_0x27d88d['params']['id']},'attributes':['logo',_0x4bf0('0x53'),_0x4bf0('0x57'),'favicon','defaultLogo',_0x4bf0('0x59'),_0x4bf0('0x5a'),_0x4bf0('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x20319b,null))[_0x4bf0('0x1b')](function(_0x2d29f3){if(_0x2d29f3){var _0x42db29=_0x2d29f3[_0x4bf0('0x53')]&&fs['existsSync'](path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')](_0x2d29f3[_0x4bf0('0x53')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_['toLower'](_0x2d29f3['loginLogo'])):path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')](_0x4bf0('0x67')));var _0x1474d4='default'+_[_0x4bf0('0x68')](_0x4bf0('0x53'));if(_0x2d29f3[_0x1474d4]||!_0x40fe20['custom']){_0x42db29=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x5b9d4a,_[_0x4bf0('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x4bf0('0x5c')](_0x42db29)){throw new db['Sequelize'][(_0x4bf0('0x64'))](_[_0x4bf0('0x68')]('loginLogo')+_0x4bf0('0x65'));}return _0x20319b[_0x4bf0('0x69')](_0x42db29);}})[_0x4bf0('0x22')](handleError(_0x20319b,null));};exports['gdpr']=function(_0x398117,_0x4a622f){return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x398117['params']['id']},'attributes':[_0x4bf0('0x6a')]})[_0x4bf0('0x1b')](respondWithResult(_0x4a622f,null))[_0x4bf0('0x22')](handleError(_0x4a622f,null));};exports[_0x4bf0('0x6b')]=function(_0x7cfbfc,_0x4f43a9,_0x12d1fa){if(_0x7cfbfc[_0x4bf0('0x50')]&&_0x7cfbfc[_0x4bf0('0x50')][_0x4bf0('0x51')]){_0x7cfbfc[_0x4bf0('0x4e')][_0x4bf0('0x57')]=_0x7cfbfc[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x7cfbfc[_0x4bf0('0x4b')]['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0x4f43a9,null))['then'](saveUpdates(_0x7cfbfc[_0x4bf0('0x4e')],null))[_0x4bf0('0x1b')](respondWithResult(_0x4f43a9,null))['catch'](handleError(_0x4f43a9,null));};var utilLicense=require(_0x4bf0('0x54'));exports['getPreferred']=function(_0x23fa18,_0x4120cd,_0x432c02){var _0x2719c7='server/files/images/logos';var _0x149a8e={'custom':![]};return utilLicense[_0x4bf0('0x66')]()[_0x4bf0('0x1b')](function(_0x1db4ae){if(_0x1db4ae){_0x149a8e=_0x1db4ae;}return db[_0x4bf0('0x45')]['find']({'where':{'id':_0x23fa18[_0x4bf0('0x4b')]['id']},'attributes':[_0x4bf0('0x5f'),_0x4bf0('0x53'),_0x4bf0('0x57'),_0x4bf0('0x58'),_0x4bf0('0x6c'),_0x4bf0('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x4120cd,null))[_0x4bf0('0x1b')](function(_0x291bc0){if(_0x291bc0){var _0x57c3f2=_0x291bc0[_0x4bf0('0x57')]&&fs['existsSync'](path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_[_0x4bf0('0x5e')](_0x291bc0[_0x4bf0('0x57')])))?path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_['toLower'](_0x291bc0[_0x4bf0('0x57')])):path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_[_0x4bf0('0x5e')](_0x4bf0('0x6d')));var _0x2073e0='default'+_[_0x4bf0('0x68')](_0x4bf0('0x57'));if(_0x291bc0[_0x2073e0]||!_0x149a8e[_0x4bf0('0x62')]||!_0x149a8e['preferred']){_0x57c3f2=path[_0x4bf0('0x5d')](config[_0x4bf0('0x60')],_0x2719c7,_['toLower']('default_preferred.png'));}if(!fs[_0x4bf0('0x5c')](_0x57c3f2)){throw new db[(_0x4bf0('0x63'))]['ValidationError'](_['upperFirst']('preferred')+_0x4bf0('0x65'));}return _0x4120cd[_0x4bf0('0x69')](_0x57c3f2);}})[_0x4bf0('0x22')](handleError(_0x4120cd,null));};exports['addFavicon']=function(_0x3a7667,_0x1e8976,_0x47c8fe){if(_0x3a7667[_0x4bf0('0x50')]&&_0x3a7667[_0x4bf0('0x50')]['filename']){_0x3a7667[_0x4bf0('0x4e')][_0x4bf0('0x58')]=_0x3a7667[_0x4bf0('0x50')][_0x4bf0('0x51')];}return db['Setting']['find']({'where':{'id':_0x3a7667['params']['id']}})[_0x4bf0('0x1b')](handleEntityNotFound(_0x1e8976,null))[_0x4bf0('0x1b')](saveUpdates(_0x3a7667['body'],null))[_0x4bf0('0x1b')](respondWithResult(_0x1e8976,null))[_0x4bf0('0x22')](handleError(_0x1e8976,null));};var utilLicense=require(_0x4bf0('0x54'));exports[_0x4bf0('0x6e')]=function(_0x3b4de3,_0x597c78,_0x530ee2){var _0x45aaf1=_0x4bf0('0x56');var _0x47d63b={'custom':![]};return utilLicense[_0x4bf0('0x66')]()['then'](function(_0x24b081){if(_0x24b081){_0x47d63b=_0x24b081;}return db[_0x4bf0('0x45')][_0x4bf0('0x4d')]({'where':{'id':_0x3b4de3['params']['id']},'attributes':[_0x4bf0('0x5f'),_0x4bf0('0x53'),_0x4bf0('0x57'),'favicon',_0x4bf0('0x6c'),_0x4bf0('0x59'),_0x4bf0('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x4bf0('0x1b')](handleEntityNotFound(_0x597c78,null))[_0x4bf0('0x1b')](function(_0x1d2b47){if(_0x1d2b47){var _0xd41f08=_0x1d2b47[_0x4bf0('0x58')]&&fs[_0x4bf0('0x5c')](path['join'](config[_0x4bf0('0x60')],_0x45aaf1,_['toLower'](_0x1d2b47['favicon'])))?path['join'](config['root'],_0x45aaf1,_[_0x4bf0('0x5e')](_0x1d2b47[_0x4bf0('0x58')])):path['join'](config[_0x4bf0('0x60')],_0x45aaf1,_[_0x4bf0('0x5e')](_0x4bf0('0x6f')));var _0x5e166a=_0x4bf0('0x70')+_[_0x4bf0('0x68')]('favicon');if(_0x1d2b47[_0x5e166a]||!_0x47d63b[_0x4bf0('0x62')]){_0xd41f08=path[_0x4bf0('0x5d')](config['root'],_0x45aaf1,_[_0x4bf0('0x5e')](_0x4bf0('0x6f')));}if(!fs[_0x4bf0('0x5c')](_0xd41f08)){throw new db[(_0x4bf0('0x63'))]['ValidationError'](_['upperFirst'](_0x4bf0('0x58'))+'\x20not\x20found');}return _0x597c78[_0x4bf0('0x69')](_0xd41f08);}})['catch'](handleError(_0x597c78,null));};exports[_0x4bf0('0x71')]=function(_0x9b8f85,_0xb46d0){var _0x5c37fa={'offset':moment()['utcOffset']()};_0x5c37fa[_0x4bf0('0x72')]=moment()[_0x4bf0('0x73')](_0x5c37fa[_0x4bf0('0x26')])[_0x4bf0('0x74')](_0x4bf0('0x75'));return _0xb46d0[_0x4bf0('0x23')](0xc8)[_0x4bf0('0x30')](_0x5c37fa);}; \ No newline at end of file +var _0x575b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','then','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','intersection','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','default','upperFirst','custom','join','default_logo.svg','ValidationError','\x20not\x20found','download','getLicense','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','defaultFavicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1dcd54,_0x5e468a){var _0x49e594=function(_0xc3546a){while(--_0xc3546a){_0x1dcd54['push'](_0x1dcd54['shift']());}};_0x49e594(++_0x5e468a);}(_0x575b,0x1e0));var _0xb575=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x575b[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xb575('0x0'));var rimraf=require(_0xb575('0x1'));var zipdir=require(_0xb575('0x2'));var jsonpatch=require(_0xb575('0x3'));var rp=require(_0xb575('0x4'));var moment=require('moment');var BPromise=require(_0xb575('0x5'));var Mustache=require(_0xb575('0x6'));var util=require('util');var path=require(_0xb575('0x7'));var sox=require(_0xb575('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb575('0x9'));var crypto=require(_0xb575('0xa'));var jsforce=require(_0xb575('0xb'));var deskjs=require(_0xb575('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb575('0xd'));var Papa=require(_0xb575('0xe'));var Redis=require(_0xb575('0xf'));var authService=require(_0xb575('0x10'));var qs=require(_0xb575('0x11'));var as=require(_0xb575('0x12'));var hardwareService=require(_0xb575('0x13'));var logger=require(_0xb575('0x14'))(_0xb575('0x15'));var utils=require('../../config/utils');var config=require(_0xb575('0x16'));var licenseUtil=require(_0xb575('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb575('0x18'));var client=jayson[_0xb575('0x19')][_0xb575('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2bace2,_0x200b3b,_0x36dfc5,_0x2bff4d){return new BPromise(function(_0x55cc73,_0x4a4911){var _0x3006fb=_0x2bff4d||client;return _0x3006fb[_0xb575('0x1b')](_0x2bace2,_0x36dfc5)['then'](function(_0xe32150){logger[_0xb575('0x1c')](_0xb575('0x1d'),_0x200b3b,_0xb575('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x200b3b,'request\x20sent',JSON[_0xb575('0x1f')](_0xe32150));if(_0xe32150[_0xb575('0x20')]){if(_0xe32150[_0xb575('0x20')][_0xb575('0x21')]===0x1f4){logger[_0xb575('0x20')](_0xb575('0x1d'),_0x200b3b,_0xe32150['error'][_0xb575('0x22')]);return _0x4a4911(_0xe32150['error']['message']);}logger[_0xb575('0x20')]('Setting,\x20%s,\x20%s',_0x200b3b,_0xe32150[_0xb575('0x20')][_0xb575('0x22')]);return _0x55cc73(_0xe32150['error'][_0xb575('0x22')]);}else{logger[_0xb575('0x1c')](_0xb575('0x1d'),_0x200b3b,_0xb575('0x1e'));_0x55cc73(_0xe32150[_0xb575('0x23')][_0xb575('0x22')]);}})[_0xb575('0x24')](function(_0xc54a3){logger[_0xb575('0x20')]('Setting,\x20%s,\x20%s',_0x200b3b,_0xc54a3);_0x4a4911(_0xc54a3);});});}function respondWithStatusCode(_0x4ee867,_0x250e70){_0x250e70=_0x250e70||0xcc;return function(_0x57b4cb){if(_0x57b4cb){return _0x4ee867[_0xb575('0x25')](_0x250e70);}return _0x4ee867['status'](_0x250e70)[_0xb575('0x26')]();};}function respondWithResult(_0x1a2eda,_0x2296c8){_0x2296c8=_0x2296c8||0xc8;return function(_0x121065){if(_0x121065){return _0x1a2eda[_0xb575('0x27')](_0x2296c8)[_0xb575('0x28')](_0x121065);}};}function respondWithFilteredResult(_0x37b573,_0x5d9a82){return function(_0x39e725){if(_0x39e725){var _0xad37de=typeof _0x5d9a82['offset']===_0xb575('0x29')&&typeof _0x5d9a82['limit']===_0xb575('0x29');var _0x17d18b=_0x39e725[_0xb575('0x2a')];var _0x583a2d=_0xad37de?0x0:_0x5d9a82[_0xb575('0x2b')];var _0x527d71=_0xad37de?_0x39e725['count']:_0x5d9a82['offset']+_0x5d9a82[_0xb575('0x2c')];var _0x4928be;if(_0x527d71>=_0x17d18b){_0x527d71=_0x17d18b;_0x4928be=0xc8;}else{_0x4928be=0xce;}_0x37b573['status'](_0x4928be);return _0x37b573[_0xb575('0x2d')]('Content-Range',_0x583a2d+'-'+_0x527d71+'/'+_0x17d18b)['json'](_0x39e725);}return null;};}function patchUpdates(_0x5e53c8){return function(_0x7a22a1){try{jsonpatch['apply'](_0x7a22a1,_0x5e53c8,!![]);}catch(_0x405448){return BPromise[_0xb575('0x2e')](_0x405448);}return _0x7a22a1['save']();};}function saveUpdates(_0x49100f,_0x3edd3a){return function(_0x26638f){if(_0x26638f){return _0x26638f[_0xb575('0x2f')](_0x49100f)[_0xb575('0x30')](function(_0x431018){return _0x431018;});}return null;};}function removeEntity(_0x2726a8,_0x342bed){return function(_0x30563f){if(_0x30563f){return _0x30563f[_0xb575('0x31')]()[_0xb575('0x30')](function(){_0x2726a8[_0xb575('0x27')](0xcc)[_0xb575('0x26')]();});}};}function handleEntityNotFound(_0x23cdf8,_0x1646c2){return function(_0x181a00){if(!_0x181a00){_0x23cdf8[_0xb575('0x25')](0x194);}return _0x181a00;};}function handleError(_0x547d50,_0x2aafee){_0x2aafee=_0x2aafee||0x1f4;return function(_0x33f503){logger[_0xb575('0x20')](_0x33f503[_0xb575('0x32')]);if(_0x33f503[_0xb575('0x33')]){delete _0x33f503[_0xb575('0x33')];}_0x547d50[_0xb575('0x27')](_0x2aafee)['send'](_0x33f503);};}exports[_0xb575('0x34')]=function(_0x5b092,_0x4c3a95){var _0x504148={},_0x1cf385={},_0x5740f1={'count':0x0,'rows':[]};var _0x5597ed=_[_0xb575('0x35')](db[_0xb575('0x36')][_0xb575('0x37')],function(_0x9ff40e){return{'name':_0x9ff40e[_0xb575('0x38')],'type':_0x9ff40e['type'][_0xb575('0x39')]};});_0x1cf385[_0xb575('0x3a')]=_[_0xb575('0x35')](_0x5597ed,_0xb575('0x33'));_0x1cf385[_0xb575('0x3b')]=_[_0xb575('0x3c')](_0x5b092[_0xb575('0x3b')]);_0x1cf385[_0xb575('0x3d')]=_['intersection'](_0x1cf385[_0xb575('0x3a')],_0x1cf385[_0xb575('0x3b')]);_0x504148[_0xb575('0x3e')]=_['intersection'](_0x1cf385['model'],qs[_0xb575('0x3f')](_0x5b092[_0xb575('0x3b')][_0xb575('0x3f')]));_0x504148[_0xb575('0x3e')]=_0x504148['attributes'][_0xb575('0x40')]?_0x504148[_0xb575('0x3e')]:_0x1cf385[_0xb575('0x3a')];if(!_0x5b092[_0xb575('0x3b')][_0xb575('0x41')](_0xb575('0x42'))){_0x504148[_0xb575('0x2c')]=qs[_0xb575('0x2c')](_0x5b092[_0xb575('0x3b')][_0xb575('0x2c')]);_0x504148['offset']=qs['offset'](_0x5b092[_0xb575('0x3b')][_0xb575('0x2b')]);}_0x504148[_0xb575('0x43')]=qs[_0xb575('0x44')](_0x5b092[_0xb575('0x3b')][_0xb575('0x44')]);_0x504148[_0xb575('0x45')]=qs[_0xb575('0x3d')](_[_0xb575('0x46')](_0x5b092[_0xb575('0x3b')],_0x1cf385['filters']),_0x5597ed);if(_0x5b092[_0xb575('0x3b')][_0xb575('0x47')]){_0x504148[_0xb575('0x45')]=_[_0xb575('0x48')](_0x504148[_0xb575('0x45')],{'$or':_[_0xb575('0x35')](_0x5597ed,function(_0x29d41e){if(_0x29d41e[_0xb575('0x49')]!==_0xb575('0x4a')){var _0x4dc2b8={};_0x4dc2b8[_0x29d41e[_0xb575('0x33')]]={'$like':'%'+_0x5b092[_0xb575('0x3b')]['filter']+'%'};return _0x4dc2b8;}})});}_0x504148=_['merge']({},_0x504148,_0x5b092[_0xb575('0x4b')]);var _0x57335c={'where':_0x504148[_0xb575('0x45')]};return db[_0xb575('0x36')][_0xb575('0x2a')](_0x57335c)[_0xb575('0x30')](function(_0x1eb6c9){_0x5740f1[_0xb575('0x2a')]=_0x1eb6c9;if(_0x5b092[_0xb575('0x3b')]['includeAll']){_0x504148[_0xb575('0x4c')]=[{'all':!![]}];}return db[_0xb575('0x36')][_0xb575('0x4d')](_0x504148);})[_0xb575('0x30')](function(_0x422906){_0x5740f1[_0xb575('0x4e')]=_0x422906;return _0x5740f1;})['then'](respondWithFilteredResult(_0x4c3a95,_0x504148))['catch'](handleError(_0x4c3a95,null));};exports['show']=function(_0x415ea0,_0x411886){var _0x2d32f4={'raw':![],'where':{'id':_0x415ea0[_0xb575('0x4f')]['id']}},_0x4e424e={};_0x4e424e['model']=_[_0xb575('0x3c')](db[_0xb575('0x36')]['rawAttributes']);_0x4e424e['query']=_[_0xb575('0x3c')](_0x415ea0[_0xb575('0x3b')]);_0x4e424e[_0xb575('0x3d')]=_[_0xb575('0x50')](_0x4e424e[_0xb575('0x3a')],_0x4e424e['query']);_0x2d32f4[_0xb575('0x3e')]=_[_0xb575('0x50')](_0x4e424e['model'],qs['fields'](_0x415ea0[_0xb575('0x3b')][_0xb575('0x3f')]));_0x2d32f4[_0xb575('0x3e')]=_0x2d32f4[_0xb575('0x3e')]['length']?_0x2d32f4[_0xb575('0x3e')]:_0x4e424e[_0xb575('0x3a')];if(_0x415ea0['query']['includeAll']){_0x2d32f4[_0xb575('0x4c')]=[{'all':!![]}];}_0x2d32f4=_[_0xb575('0x48')]({},_0x2d32f4,_0x415ea0[_0xb575('0x4b')]);return db[_0xb575('0x36')][_0xb575('0x51')](_0x2d32f4)[_0xb575('0x30')](handleEntityNotFound(_0x411886,null))[_0xb575('0x30')](respondWithResult(_0x411886,null))[_0xb575('0x24')](handleError(_0x411886,null));};exports[_0xb575('0x2f')]=function(_0x23cc0f,_0x13a6fb){if(_0x23cc0f[_0xb575('0x52')]['id']){delete _0x23cc0f[_0xb575('0x52')]['id'];}return db[_0xb575('0x36')]['find']({'where':{'id':_0x23cc0f[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x13a6fb,null))[_0xb575('0x30')](saveUpdates(_0x23cc0f[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x13a6fb,null))[_0xb575('0x24')](handleError(_0x13a6fb,null));};exports[_0xb575('0x53')]=function(_0x3c7823,_0x151d01,_0x12df54){if(_0x3c7823[_0xb575('0x54')]&&_0x3c7823['file'][_0xb575('0x55')]){_0x3c7823['body'][_0xb575('0x56')]=_0x3c7823[_0xb575('0x54')][_0xb575('0x55')];}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x3c7823[_0xb575('0x4f')]['id']}})['then'](handleEntityNotFound(_0x151d01,null))['then'](saveUpdates(_0x3c7823[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x151d01,null))[_0xb575('0x24')](handleError(_0x151d01,null));};exports[_0xb575('0x57')]=function(_0x159534,_0x565690,_0x1a1801){if(_0x159534[_0xb575('0x54')]&&_0x159534['file']['filename']){_0x159534[_0xb575('0x52')][_0xb575('0x58')]=_0x159534[_0xb575('0x54')][_0xb575('0x55')];}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x159534[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x565690,null))['then'](saveUpdates(_0x159534[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x565690,null))[_0xb575('0x24')](handleError(_0x565690,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x59')]=function(_0x3d6491,_0x10990c,_0x35f702){var _0xee178=_0xb575('0x5a');var _0x3337a0={'custom':![]};return utilLicense['getLicense']()[_0xb575('0x30')](function(_0x1c8037){if(_0x1c8037){_0x3337a0=_0x1c8037;}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x3d6491[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),'defaultLogo',_0xb575('0x5d'),_0xb575('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x10990c,null))[_0xb575('0x30')](function(_0x10e371){if(_0x10e371){var _0x342e50=_0x10e371[_0xb575('0x56')]&&fs[_0xb575('0x5f')](path['join'](config['root'],_0xee178,_['toLower'](_0x10e371[_0xb575('0x56')])))?path['join'](config[_0xb575('0x60')],_0xee178,_[_0xb575('0x61')](_0x10e371[_0xb575('0x56')])):path['join'](config[_0xb575('0x60')],_0xee178,_['toLower']('default_logo.svg'));var _0x590422=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x56'));if(_0x10e371[_0x590422]||!_0x3337a0[_0xb575('0x64')]){_0x342e50=path[_0xb575('0x65')](config['root'],_0xee178,_['toLower'](_0xb575('0x66')));}if(!fs[_0xb575('0x5f')](_0x342e50)){throw new db['Sequelize'][(_0xb575('0x67'))](_[_0xb575('0x63')]('logo')+_0xb575('0x68'));}return _0x10990c[_0xb575('0x69')](_0x342e50);}})[_0xb575('0x24')](handleError(_0x10990c,null));};var utilLicense=require(_0xb575('0x17'));exports['getLogoLogin']=function(_0x3ad989,_0x17a7a5,_0x578b8a){var _0x42bf1b='server/files/images/logos';var _0x8274b9={'custom':![]};return utilLicense[_0xb575('0x6a')]()[_0xb575('0x30')](function(_0x48b1f0){if(_0x48b1f0){_0x8274b9=_0x48b1f0;}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x3ad989['params']['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),'defaultLogo',_0xb575('0x5d'),_0xb575('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x17a7a5,null))[_0xb575('0x30')](function(_0xb8f891){if(_0xb8f891){var _0x18eac6=_0xb8f891['loginLogo']&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb8f891['loginLogo'])))?path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb8f891[_0xb575('0x58')])):path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')]('default_loginLogo.svg'));var _0x3d4f08=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x58'));if(_0xb8f891[_0x3d4f08]||!_0x8274b9[_0xb575('0x64')]){_0x18eac6=path[_0xb575('0x65')](config[_0xb575('0x60')],_0x42bf1b,_[_0xb575('0x61')](_0xb575('0x6b')));}if(!fs['existsSync'](_0x18eac6)){throw new db[(_0xb575('0x6c'))][(_0xb575('0x67'))](_[_0xb575('0x63')](_0xb575('0x58'))+'\x20not\x20found');}return _0x17a7a5[_0xb575('0x69')](_0x18eac6);}})['catch'](handleError(_0x17a7a5,null));};exports[_0xb575('0x6d')]=function(_0x59f601,_0x23e486){return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x59f601[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x6e')]})[_0xb575('0x30')](respondWithResult(_0x23e486,null))['catch'](handleError(_0x23e486,null));};exports[_0xb575('0x6f')]=function(_0x5c039f,_0x1a0800,_0x40778b){if(_0x5c039f[_0xb575('0x54')]&&_0x5c039f[_0xb575('0x54')][_0xb575('0x55')]){_0x5c039f[_0xb575('0x52')][_0xb575('0x5b')]=_0x5c039f[_0xb575('0x54')][_0xb575('0x55')];}return db['Setting'][_0xb575('0x51')]({'where':{'id':_0x5c039f['params']['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x1a0800,null))[_0xb575('0x30')](saveUpdates(_0x5c039f[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x1a0800,null))[_0xb575('0x24')](handleError(_0x1a0800,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x70')]=function(_0x1ac5d6,_0x561b36,_0x42afff){var _0x58d6b5='server/files/images/logos';var _0x2800ab={'custom':![]};return utilLicense[_0xb575('0x6a')]()['then'](function(_0x4c4748){if(_0x4c4748){_0x2800ab=_0x4c4748;}return db[_0xb575('0x36')][_0xb575('0x51')]({'where':{'id':_0x1ac5d6[_0xb575('0x4f')]['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),_0xb575('0x5b'),_0xb575('0x5c'),_0xb575('0x71'),'defaultLoginLogo',_0xb575('0x5e'),_0xb575('0x72')],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x561b36,null))[_0xb575('0x30')](function(_0xf60bbf){if(_0xf60bbf){var _0x3f9732=_0xf60bbf[_0xb575('0x5b')]&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x58d6b5,_[_0xb575('0x61')](_0xf60bbf[_0xb575('0x5b')])))?path['join'](config[_0xb575('0x60')],_0x58d6b5,_[_0xb575('0x61')](_0xf60bbf[_0xb575('0x5b')])):path['join'](config['root'],_0x58d6b5,_['toLower']('default_preferred.png'));var _0x81b332='default'+_['upperFirst'](_0xb575('0x5b'));if(_0xf60bbf[_0x81b332]||!_0x2800ab[_0xb575('0x64')]||!_0x2800ab[_0xb575('0x5b')]){_0x3f9732=path['join'](config['root'],_0x58d6b5,_[_0xb575('0x61')](_0xb575('0x73')));}if(!fs[_0xb575('0x5f')](_0x3f9732)){throw new db[(_0xb575('0x6c'))]['ValidationError'](_[_0xb575('0x63')]('preferred')+_0xb575('0x68'));}return _0x561b36['download'](_0x3f9732);}})[_0xb575('0x24')](handleError(_0x561b36,null));};exports[_0xb575('0x74')]=function(_0x134b82,_0x45d80d,_0x2af15f){if(_0x134b82['file']&&_0x134b82[_0xb575('0x54')][_0xb575('0x55')]){_0x134b82['body'][_0xb575('0x5c')]=_0x134b82[_0xb575('0x54')][_0xb575('0x55')];}return db[_0xb575('0x36')]['find']({'where':{'id':_0x134b82[_0xb575('0x4f')]['id']}})[_0xb575('0x30')](handleEntityNotFound(_0x45d80d,null))[_0xb575('0x30')](saveUpdates(_0x134b82[_0xb575('0x52')],null))[_0xb575('0x30')](respondWithResult(_0x45d80d,null))[_0xb575('0x24')](handleError(_0x45d80d,null));};var utilLicense=require(_0xb575('0x17'));exports[_0xb575('0x75')]=function(_0x3e7a59,_0x20ecee,_0x199b2d){var _0x498cbe=_0xb575('0x5a');var _0x383133={'custom':![]};return utilLicense[_0xb575('0x6a')]()[_0xb575('0x30')](function(_0x4eb9a0){if(_0x4eb9a0){_0x383133=_0x4eb9a0;}return db[_0xb575('0x36')]['find']({'where':{'id':_0x3e7a59['params']['id']},'attributes':[_0xb575('0x56'),_0xb575('0x58'),'preferred',_0xb575('0x5c'),_0xb575('0x71'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xb575('0x30')](handleEntityNotFound(_0x20ecee,null))['then'](function(_0x464914){if(_0x464914){var _0x5d2130=_0x464914[_0xb575('0x5c')]&&fs['existsSync'](path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')](_0x464914['favicon'])))?path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')](_0x464914[_0xb575('0x5c')])):path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_[_0xb575('0x61')]('default_favicon.ico'));var _0x319045=_0xb575('0x62')+_[_0xb575('0x63')](_0xb575('0x5c'));if(_0x464914[_0x319045]||!_0x383133[_0xb575('0x64')]){_0x5d2130=path[_0xb575('0x65')](config[_0xb575('0x60')],_0x498cbe,_['toLower'](_0xb575('0x76')));}if(!fs[_0xb575('0x5f')](_0x5d2130)){throw new db[(_0xb575('0x6c'))][(_0xb575('0x67'))](_[_0xb575('0x63')](_0xb575('0x5c'))+_0xb575('0x68'));}return _0x20ecee[_0xb575('0x69')](_0x5d2130);}})[_0xb575('0x24')](handleError(_0x20ecee,null));};exports[_0xb575('0x77')]=function(_0x2aee37,_0x30306d){var _0x5650a9={'offset':moment()[_0xb575('0x78')]()};_0x5650a9[_0xb575('0x79')]=moment()[_0xb575('0x78')](_0x5650a9[_0xb575('0x2b')])[_0xb575('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x30306d[_0xb575('0x27')](0xc8)[_0xb575('0x7b')](_0x5650a9);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 38369a7..6937050 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x3b9b2e,_0x1d3afe){var _0x3e1a74=function(_0x1d5439){while(--_0x1d5439){_0x3b9b2e['push'](_0x3b9b2e['shift']());}};_0x3e1a74(++_0x1d3afe);}(_0x3e74,0x175));var _0x43e7=function(_0x462c9e,_0x462249){_0x462c9e=_0x462c9e-0x0;var _0x286a68=_0x3e74[_0x462c9e];return _0x286a68;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'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 11b9f00..dd70bb5 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 _0x10bf=['model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','map'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x10bf,0x1b0));var _0xf10b=function(_0x4d93c9,_0x4775ae){_0x4d93c9=_0x4d93c9-0x0;var _0x48536d=_0x10bf[_0x4d93c9];return _0x48536d;};'use strict';var _=require(_0xf10b('0x0'));var util=require(_0xf10b('0x1'));var moment=require(_0xf10b('0x2'));var BPromise=require(_0xf10b('0x3'));var rs=require(_0xf10b('0x4'));var fs=require('fs');var Redis=require(_0xf10b('0x5'));var db=require(_0xf10b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf10b('0x7'))(_0xf10b('0x8'));var config=require(_0xf10b('0x9'));var jayson=require(_0xf10b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x173a79,_0x24bd68,_0x2958c1){return new BPromise(function(_0x59e63e,_0x2cc427){return client[_0xf10b('0xb')](_0x173a79,_0x2958c1)['then'](function(_0x8d8b19){logger[_0xf10b('0xc')](_0xf10b('0xd'),_0x24bd68,_0xf10b('0xe'));logger[_0xf10b('0xf')](_0xf10b('0x10'),_0x24bd68,_0xf10b('0xe'),JSON['stringify'](_0x8d8b19));if(_0x8d8b19['error']){if(_0x8d8b19[_0xf10b('0x11')][_0xf10b('0x12')]===0x1f4){logger[_0xf10b('0x11')](_0xf10b('0xd'),_0x24bd68,_0x8d8b19[_0xf10b('0x11')][_0xf10b('0x13')]);return _0x2cc427(_0x8d8b19[_0xf10b('0x11')][_0xf10b('0x13')]);}logger[_0xf10b('0x11')](_0xf10b('0xd'),_0x24bd68,_0x8d8b19[_0xf10b('0x11')][_0xf10b('0x13')]);return _0x59e63e(_0x8d8b19['error']['message']);}else{logger[_0xf10b('0xc')]('Setting,\x20%s,\x20%s',_0x24bd68,_0xf10b('0xe'));_0x59e63e(_0x8d8b19[_0xf10b('0x14')][_0xf10b('0x13')]);}})[_0xf10b('0x15')](function(_0x5e8dc5){logger[_0xf10b('0x11')]('Setting,\x20%s,\x20%s',_0x24bd68,_0x5e8dc5);_0x2cc427(_0x5e8dc5);});});}exports[_0xf10b('0x16')]=function(_0x49c32f){var _0x46aa82=this;return new Promise(function(_0x1dacf0,_0x172a2e){return db[_0xf10b('0x17')][_0xf10b('0x18')]({'raw':_0x49c32f[_0xf10b('0x19')]?_0x49c32f[_0xf10b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49c32f['options']?_0x49c32f[_0xf10b('0x19')][_0xf10b('0x1a')]||null:null,'attributes':_0x49c32f['options']?_0x49c32f[_0xf10b('0x19')][_0xf10b('0x1b')]||null:null,'include':_0x49c32f['options']?_0x49c32f[_0xf10b('0x19')][_0xf10b('0x1c')]?_[_0xf10b('0x1d')](_0x49c32f[_0xf10b('0x19')]['include'],function(_0x166d50){return{'model':db[_0x166d50['model']],'as':_0x166d50['as'],'attributes':_0x166d50[_0xf10b('0x1b')],'include':_0x166d50[_0xf10b('0x1c')]?_[_0xf10b('0x1d')](_0x166d50[_0xf10b('0x1c')],function(_0x42a99b){return{'model':db[_0x42a99b[_0xf10b('0x1e')]],'as':_0x42a99b['as'],'attributes':_0x42a99b['attributes'],'include':_0x42a99b['include']?_['map'](_0x42a99b[_0xf10b('0x1c')],function(_0x1546b2){return{'model':db[_0x1546b2['model']],'as':_0x1546b2['as'],'attributes':_0x1546b2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf10b('0x1f')](function(_0x2d57aa){logger[_0xf10b('0xc')](_0xf10b('0x16'),_0x49c32f);logger[_0xf10b('0xf')]('ShowSetting',_0x49c32f,JSON[_0xf10b('0x20')](_0x2d57aa));_0x1dacf0(_0x2d57aa);})[_0xf10b('0x15')](function(_0x8b258a){logger[_0xf10b('0x11')](_0xf10b('0x16'),_0x8b258a['message'],_0x49c32f);_0x172a2e(_0x46aa82['error'](0x1f4,_0x8b258a['message']));});});}; \ No newline at end of file +var _0x7e86=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','find','options','raw','where','include','model','map','attributes','ShowSetting','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2f4c1d,_0x5821c1){var _0x64b451=function(_0x5af5aa){while(--_0x5af5aa){_0x2f4c1d['push'](_0x2f4c1d['shift']());}};_0x64b451(++_0x5821c1);}(_0x7e86,0x1a1));var _0x67e8=function(_0x56664b,_0x1a29b8){_0x56664b=_0x56664b-0x0;var _0x2c1ca5=_0x7e86[_0x56664b];return _0x2c1ca5;};'use strict';var _=require(_0x67e8('0x0'));var util=require(_0x67e8('0x1'));var moment=require('moment');var BPromise=require(_0x67e8('0x2'));var rs=require(_0x67e8('0x3'));var fs=require('fs');var Redis=require(_0x67e8('0x4'));var db=require(_0x67e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x67e8('0x6'))(_0x67e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x67e8('0x8'));var client=jayson[_0x67e8('0x9')][_0x67e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3087af,_0x27aa9b,_0x4e72f0){return new BPromise(function(_0x1a0d34,_0xff144){return client[_0x67e8('0xb')](_0x3087af,_0x4e72f0)[_0x67e8('0xc')](function(_0x21b5d3){logger[_0x67e8('0xd')](_0x67e8('0xe'),_0x27aa9b,_0x67e8('0xf'));logger[_0x67e8('0x10')](_0x67e8('0x11'),_0x27aa9b,_0x67e8('0xf'),JSON['stringify'](_0x21b5d3));if(_0x21b5d3['error']){if(_0x21b5d3[_0x67e8('0x12')][_0x67e8('0x13')]===0x1f4){logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x21b5d3[_0x67e8('0x12')]['message']);return _0xff144(_0x21b5d3[_0x67e8('0x12')][_0x67e8('0x14')]);}logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x21b5d3[_0x67e8('0x12')]['message']);return _0x1a0d34(_0x21b5d3[_0x67e8('0x12')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x27aa9b,_0x67e8('0xf'));_0x1a0d34(_0x21b5d3[_0x67e8('0x15')][_0x67e8('0x14')]);}})[_0x67e8('0x16')](function(_0x1910dc){logger[_0x67e8('0x12')](_0x67e8('0xe'),_0x27aa9b,_0x1910dc);_0xff144(_0x1910dc);});});}exports['ShowSetting']=function(_0x34094f){var _0x4af67e=this;return new Promise(function(_0xb074aa,_0x14e010){return db['Setting'][_0x67e8('0x17')]({'raw':_0x34094f[_0x67e8('0x18')]?_0x34094f[_0x67e8('0x18')][_0x67e8('0x19')]===undefined?!![]:![]:!![],'where':_0x34094f[_0x67e8('0x18')]?_0x34094f['options'][_0x67e8('0x1a')]||null:null,'attributes':_0x34094f['options']?_0x34094f[_0x67e8('0x18')]['attributes']||null:null,'include':_0x34094f[_0x67e8('0x18')]?_0x34094f[_0x67e8('0x18')]['include']?_['map'](_0x34094f[_0x67e8('0x18')][_0x67e8('0x1b')],function(_0x1865f9){return{'model':db[_0x1865f9[_0x67e8('0x1c')]],'as':_0x1865f9['as'],'attributes':_0x1865f9['attributes'],'include':_0x1865f9[_0x67e8('0x1b')]?_[_0x67e8('0x1d')](_0x1865f9['include'],function(_0xd36bd5){return{'model':db[_0xd36bd5[_0x67e8('0x1c')]],'as':_0xd36bd5['as'],'attributes':_0xd36bd5[_0x67e8('0x1e')],'include':_0xd36bd5[_0x67e8('0x1b')]?_[_0x67e8('0x1d')](_0xd36bd5[_0x67e8('0x1b')],function(_0x24c333){return{'model':db[_0x24c333['model']],'as':_0x24c333['as'],'attributes':_0x24c333[_0x67e8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b8e2a){logger[_0x67e8('0xd')]('ShowSetting',_0x34094f);logger[_0x67e8('0x10')](_0x67e8('0x1f'),_0x34094f,JSON[_0x67e8('0x20')](_0x1b8e2a));_0xb074aa(_0x1b8e2a);})['catch'](function(_0x84d9ae){logger['error']('ShowSetting',_0x84d9ae[_0x67e8('0x14')],_0x34094f);_0x14e010(_0x4af67e[_0x67e8('0x12')](0x1f4,_0x84d9ae[_0x67e8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a33599a..26c40cf 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x49670b,_0x370cd2){var _0x1d5184=function(_0x49a626){while(--_0x49a626){_0x49670b['push'](_0x49670b['shift']());}};_0x1d5184(++_0x370cd2);}(_0x7a54,0x106));var _0x47a5=function(_0x554032,_0x4f0ca6){_0x554032=_0x554032-0x0;var _0xdeafc8=_0x7a54[_0x554032];return _0xdeafc8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4a8ce2,_0x4cd94e){var _0x38c265=function(_0x1fb277){while(--_0x1fb277){_0x4a8ce2['push'](_0x4a8ce2['shift']());}};_0x38c265(++_0x4cd94e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c9a996f..654af09 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 _0xc120=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x4391dd,_0xceb4b5){var _0x378f8e=function(_0x11967a){while(--_0x11967a){_0x4391dd['push'](_0x4391dd['shift']());}};_0x378f8e(++_0xceb4b5);}(_0xc120,0x96));var _0x0c12=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xc120[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x0c12('0x0'));var rs=require(_0x0c12('0x1'));module[_0x0c12('0x2')]={'name':{'type':Sequelize[_0x0c12('0x3')],'unique':_0x0c12('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x0c12('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0c12('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0c12('0x3')],'defaultValue':function(){return rs[_0x0c12('0x5')]();}},'phone':{'type':Sequelize[_0x0c12('0x3')]},'type':{'type':Sequelize[_0x0c12('0x6')](_0x0c12('0x7'),'skebby',_0x0c12('0x8'),_0x0c12('0x9'),_0x0c12('0xa'),_0x0c12('0xb'),_0x0c12('0xc'),'csc',_0x0c12('0xd'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0c12('0x3')]},'authToken':{'type':Sequelize[_0x0c12('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0c12('0x3')]},'password':{'type':Sequelize[_0x0c12('0x3')]},'apiKey':{'type':Sequelize[_0x0c12('0x3')]},'applicationId':{'type':Sequelize[_0x0c12('0x3')]},'accountId':{'type':Sequelize[_0x0c12('0x3')]},'senderString':{'type':Sequelize[_0x0c12('0x3')]},'deliveryReport':{'type':Sequelize[_0x0c12('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x0c12('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0c12('0xf')],'defaultValue':function(){return _0x0c12('0x10');}},'notificationSound':{'type':Sequelize[_0x0c12('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0c12('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0c12('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0c12('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0c12('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0c12('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0c12('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0c12('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0c12('0x12'),'set':function(_0xf96839){if(!_0xf96839)this[_0x0c12('0x13')]('mandatoryDispositionPauseId',null);this[_0x0c12('0x13')](_0x0c12('0x14'),_0xf96839);}}}; \ No newline at end of file +var _0xe2cf=['name','generate','ENUM','skebby','connectel','plivo','clickatell','bandwidth','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0xe2cf,0x7b));var _0xfe2c=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0xe2cf[_0x26d034];return _0x3015aa;};'use strict';var Sequelize=require(_0xfe2c('0x0'));var rs=require('randomstring');module[_0xfe2c('0x1')]={'name':{'type':Sequelize[_0xfe2c('0x2')],'unique':_0xfe2c('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xfe2c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfe2c('0x4')]();}},'phone':{'type':Sequelize[_0xfe2c('0x2')]},'type':{'type':Sequelize[_0xfe2c('0x5')]('twilio',_0xfe2c('0x6'),_0xfe2c('0x7'),'clicksend',_0xfe2c('0x8'),_0xfe2c('0x9'),_0xfe2c('0xa'),_0xfe2c('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xfe2c('0x2')]},'authId':{'type':Sequelize[_0xfe2c('0x2')]},'authToken':{'type':Sequelize[_0xfe2c('0x2')]},'smsMethod':{'type':Sequelize[_0xfe2c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfe2c('0x2')]},'password':{'type':Sequelize[_0xfe2c('0x2')]},'apiKey':{'type':Sequelize[_0xfe2c('0x2')]},'applicationId':{'type':Sequelize[_0xfe2c('0x2')]},'accountId':{'type':Sequelize[_0xfe2c('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xfe2c('0x2')]},'notificationTemplate':{'type':Sequelize[_0xfe2c('0xd')],'defaultValue':function(){return _0xfe2c('0xe');}},'notificationSound':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfe2c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe2c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfe2c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe2c('0xf')],'comment':_0xfe2c('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xfe2c('0xc')],'defaultValue':![],'comment':_0xfe2c('0x11'),'set':function(_0x254064){if(!_0x254064)this['setDataValue'](_0xfe2c('0x12'),null);this[_0xfe2c('0x13')](_0xfe2c('0x14'),_0x254064);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4ca24e7..4d09c84 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 _0x5f0c=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','sender','text','connectel','clicksend','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','send','\x0a','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','List','out','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','clickatell','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x5f0c,0xa3));var _0xc5f0=function(_0x6925a7,_0x4c3fb8){_0x6925a7=_0x6925a7-0x0;var _0x2ddee2=_0x5f0c[_0x6925a7];return _0x2ddee2;};'use strict';var emlformat=require(_0xc5f0('0x0'));var rimraf=require(_0xc5f0('0x1'));var zipdir=require(_0xc5f0('0x2'));var jsonpatch=require(_0xc5f0('0x3'));var rp=require(_0xc5f0('0x4'));var moment=require(_0xc5f0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc5f0('0x6'));var util=require(_0xc5f0('0x7'));var path=require(_0xc5f0('0x8'));var sox=require('sox');var csv=require(_0xc5f0('0x9'));var ejs=require(_0xc5f0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc5f0('0xb'));var crypto=require(_0xc5f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc5f0('0xd'));var toCsv=require(_0xc5f0('0x9'));var querystring=require(_0xc5f0('0xe'));var Papa=require(_0xc5f0('0xf'));var Redis=require(_0xc5f0('0x10'));var authService=require(_0xc5f0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc5f0('0x12'));var hardwareService=require(_0xc5f0('0x13'));var logger=require(_0xc5f0('0x14'))(_0xc5f0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc5f0('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc5f0('0x17')](config[_0xc5f0('0x18')],{'host':_0xc5f0('0x19'),'port':0x18eb});var socket=require(_0xc5f0('0x1a'))(new Redis(config[_0xc5f0('0x18')]));require(_0xc5f0('0x1b'))[_0xc5f0('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc5f0('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5b84be,_0x251482,_0x3edd79,_0x38a596){return new BPromise(function(_0x40f3c8,_0x3ad4ae){var _0x4838c8=_0x38a596||client;return _0x4838c8[_0xc5f0('0x1e')](_0x5b84be,_0x3edd79)[_0xc5f0('0x1f')](function(_0x34a1b5){logger['info'](_0xc5f0('0x20'),_0x251482,'request\x20sent');logger[_0xc5f0('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x251482,_0xc5f0('0x22'),JSON['stringify'](_0x34a1b5));if(_0x34a1b5[_0xc5f0('0x23')]){if(_0x34a1b5[_0xc5f0('0x23')][_0xc5f0('0x24')]===0x1f4){logger['error'](_0xc5f0('0x20'),_0x251482,_0x34a1b5['error']['message']);return _0x3ad4ae(_0x34a1b5[_0xc5f0('0x23')]['message']);}logger['error'](_0xc5f0('0x20'),_0x251482,_0x34a1b5['error']['message']);return _0x40f3c8(_0x34a1b5[_0xc5f0('0x23')][_0xc5f0('0x25')]);}else{logger[_0xc5f0('0x26')]('SmsAccount,\x20%s,\x20%s',_0x251482,_0xc5f0('0x22'));_0x40f3c8(_0x34a1b5[_0xc5f0('0x27')][_0xc5f0('0x25')]);}})[_0xc5f0('0x28')](function(_0x42478c){logger[_0xc5f0('0x23')](_0xc5f0('0x20'),_0x251482,_0x42478c);_0x3ad4ae(_0x42478c);});});}function respondWithStatusCode(_0x3db35a,_0x19407d){_0x19407d=_0x19407d||0xcc;return function(_0x802e7b){if(_0x802e7b){return _0x3db35a[_0xc5f0('0x29')](_0x19407d);}return _0x3db35a[_0xc5f0('0x2a')](_0x19407d)[_0xc5f0('0x2b')]();};}function respondWithResult(_0x57d05c,_0x174fa7){_0x174fa7=_0x174fa7||0xc8;return function(_0x25b33e){if(_0x25b33e){return _0x57d05c[_0xc5f0('0x2a')](_0x174fa7)[_0xc5f0('0x2c')](_0x25b33e);}};}function respondWithFilteredResult(_0x51c50d,_0x49154f){return function(_0x2b545d){if(_0x2b545d){var _0x54120c=typeof _0x49154f[_0xc5f0('0x2d')]===_0xc5f0('0x2e')&&typeof _0x49154f[_0xc5f0('0x2f')]===_0xc5f0('0x2e');var _0x23980c=_0x2b545d[_0xc5f0('0x30')];var _0x3ffb7d=_0x54120c?0x0:_0x49154f[_0xc5f0('0x2d')];var _0x965ddc=_0x54120c?_0x2b545d['count']:_0x49154f[_0xc5f0('0x2d')]+_0x49154f[_0xc5f0('0x2f')];var _0x1b4257;if(_0x965ddc>=_0x23980c){_0x965ddc=_0x23980c;_0x1b4257=0xc8;}else{_0x1b4257=0xce;}_0x51c50d['status'](_0x1b4257);return _0x51c50d[_0xc5f0('0x31')]('Content-Range',_0x3ffb7d+'-'+_0x965ddc+'/'+_0x23980c)[_0xc5f0('0x2c')](_0x2b545d);}return null;};}function patchUpdates(_0x4ee1af){return function(_0x1b9f76){try{jsonpatch[_0xc5f0('0x32')](_0x1b9f76,_0x4ee1af,!![]);}catch(_0x48cc57){return BPromise[_0xc5f0('0x33')](_0x48cc57);}return _0x1b9f76['save']();};}function saveUpdates(_0x28a0d8,_0x5a0369){return function(_0x1f037d){if(_0x1f037d){return _0x1f037d[_0xc5f0('0x34')](_0x28a0d8)[_0xc5f0('0x1f')](function(_0x362f02){return _0x362f02;});}return null;};}function removeEntity(_0x273325,_0x5c425f){return function(_0xceca63){if(_0xceca63){return _0xceca63[_0xc5f0('0x35')]()[_0xc5f0('0x1f')](function(){var _0x1b0d60=_0xceca63[_0xc5f0('0x36')]({'plain':!![]});var _0x22605e='SmsAccounts';return db['UserProfileResource'][_0xc5f0('0x35')]({'where':{'type':_0x22605e,'resourceId':_0x1b0d60['id']}})[_0xc5f0('0x1f')](function(){return _0xceca63;});})[_0xc5f0('0x1f')](function(){_0x273325[_0xc5f0('0x2a')](0xcc)[_0xc5f0('0x2b')]();});}};}function handleEntityNotFound(_0x2b4324,_0x293c06){return function(_0xb0e67d){if(!_0xb0e67d){_0x2b4324['sendStatus'](0x194);}return _0xb0e67d;};}function handleError(_0x13cbed,_0x2260a1){_0x2260a1=_0x2260a1||0x1f4;return function(_0x3ba87d){logger[_0xc5f0('0x23')](_0x3ba87d[_0xc5f0('0x37')]);if(_0x3ba87d[_0xc5f0('0x38')]){delete _0x3ba87d[_0xc5f0('0x38')];}_0x13cbed['status'](_0x2260a1)['send'](_0x3ba87d);};}exports['index']=function(_0x2d407a,_0x3cb6fa){var _0x378ef7={'include':[{'model':db[_0xc5f0('0x39')],'as':_0xc5f0('0x3a')}]},_0x106969={},_0x942351={'count':0x0,'rows':[]};var _0x279a6d=_[_0xc5f0('0x3b')](db[_0xc5f0('0x3c')]['rawAttributes'],function(_0x6602e0){return{'name':_0x6602e0[_0xc5f0('0x3d')],'type':_0x6602e0[_0xc5f0('0x3e')][_0xc5f0('0x3f')]};});_0x106969['model']=_[_0xc5f0('0x3b')](_0x279a6d,'name');_0x106969[_0xc5f0('0x40')]=_[_0xc5f0('0x41')](_0x2d407a[_0xc5f0('0x40')]);_0x106969[_0xc5f0('0x42')]=_[_0xc5f0('0x43')](_0x106969[_0xc5f0('0x44')],_0x106969[_0xc5f0('0x40')]);_0x378ef7[_0xc5f0('0x45')]=_[_0xc5f0('0x43')](_0x106969[_0xc5f0('0x44')],qs['fields'](_0x2d407a['query'][_0xc5f0('0x46')]));_0x378ef7[_0xc5f0('0x45')]=_0x378ef7['attributes'][_0xc5f0('0x47')]?_0x378ef7[_0xc5f0('0x45')]:_0x106969[_0xc5f0('0x44')];if(!_0x2d407a[_0xc5f0('0x40')][_0xc5f0('0x48')](_0xc5f0('0x49'))){_0x378ef7['limit']=qs[_0xc5f0('0x2f')](_0x2d407a[_0xc5f0('0x40')][_0xc5f0('0x2f')]);_0x378ef7[_0xc5f0('0x2d')]=qs[_0xc5f0('0x2d')](_0x2d407a[_0xc5f0('0x40')]['offset']);}_0x378ef7[_0xc5f0('0x4a')]=qs[_0xc5f0('0x4b')](_0x2d407a[_0xc5f0('0x40')][_0xc5f0('0x4b')]);_0x378ef7[_0xc5f0('0x4c')]=qs[_0xc5f0('0x42')](_[_0xc5f0('0x4d')](_0x2d407a[_0xc5f0('0x40')],_0x106969[_0xc5f0('0x42')]),_0x279a6d);if(_0x2d407a[_0xc5f0('0x40')]['filter']){_0x378ef7[_0xc5f0('0x4c')]=_[_0xc5f0('0x4e')](_0x378ef7[_0xc5f0('0x4c')],{'$or':_[_0xc5f0('0x3b')](_0x279a6d,function(_0x3917cc){if(_0x3917cc['type']!==_0xc5f0('0x4f')){var _0x5efb8e={};_0x5efb8e[_0x3917cc[_0xc5f0('0x38')]]={'$like':'%'+_0x2d407a['query'][_0xc5f0('0x50')]+'%'};return _0x5efb8e;}})});}_0x378ef7=_['merge']({},_0x378ef7,_0x2d407a['options']);var _0x4622f8={'where':_0x378ef7[_0xc5f0('0x4c')]};return db[_0xc5f0('0x3c')][_0xc5f0('0x30')](_0x4622f8)[_0xc5f0('0x1f')](function(_0x38cbe9){_0x942351[_0xc5f0('0x30')]=_0x38cbe9;if(_0x2d407a[_0xc5f0('0x40')][_0xc5f0('0x51')]){_0x378ef7['include']=[{'all':!![]}];}return db[_0xc5f0('0x3c')][_0xc5f0('0x52')](_0x378ef7);})[_0xc5f0('0x1f')](function(_0x34e9ee){_0x942351['rows']=_0x34e9ee;return _0x942351;})[_0xc5f0('0x1f')](respondWithFilteredResult(_0x3cb6fa,_0x378ef7))[_0xc5f0('0x28')](handleError(_0x3cb6fa,null));};exports[_0xc5f0('0x53')]=function(_0x425c31,_0x1f5e60){var _0x2eaecf={'raw':![],'where':{'id':_0x425c31[_0xc5f0('0x54')]['id']},'include':[{'model':db[_0xc5f0('0x39')],'as':'mandatoryDispositionPause'}]},_0x1560f5={};_0x1560f5[_0xc5f0('0x44')]=_[_0xc5f0('0x41')](db[_0xc5f0('0x3c')][_0xc5f0('0x55')]);_0x1560f5[_0xc5f0('0x40')]=_['keys'](_0x425c31[_0xc5f0('0x40')]);_0x1560f5[_0xc5f0('0x42')]=_['intersection'](_0x1560f5[_0xc5f0('0x44')],_0x1560f5[_0xc5f0('0x40')]);_0x2eaecf[_0xc5f0('0x45')]=_[_0xc5f0('0x43')](_0x1560f5['model'],qs[_0xc5f0('0x46')](_0x425c31[_0xc5f0('0x40')][_0xc5f0('0x46')]));_0x2eaecf[_0xc5f0('0x45')]=_0x2eaecf[_0xc5f0('0x45')]['length']?_0x2eaecf[_0xc5f0('0x45')]:_0x1560f5['model'];if(_0x425c31[_0xc5f0('0x40')]['includeAll']){_0x2eaecf[_0xc5f0('0x56')]=[{'all':!![]}];}_0x2eaecf=_['merge']({},_0x2eaecf,_0x425c31['options']);return db['SmsAccount'][_0xc5f0('0x57')](_0x2eaecf)[_0xc5f0('0x1f')](handleEntityNotFound(_0x1f5e60,null))[_0xc5f0('0x1f')](respondWithResult(_0x1f5e60,null))[_0xc5f0('0x28')](handleError(_0x1f5e60,null));};exports[_0xc5f0('0x58')]=function(_0x44698c,_0x531a05){return db[_0xc5f0('0x3c')][_0xc5f0('0x58')](_0x44698c[_0xc5f0('0x59')],{})[_0xc5f0('0x1f')](function(_0x5ed0fd){var _0x48213d=_0x44698c[_0xc5f0('0x5a')][_0xc5f0('0x36')]({'plain':!![]});if(!_0x48213d)throw new Error(_0xc5f0('0x5b'));if(_0x48213d[_0xc5f0('0x5c')]===_0xc5f0('0x5a')){var _0x55dd19=_0x5ed0fd[_0xc5f0('0x36')]({'plain':!![]});var _0x3e739a='SmsAccounts';return db[_0xc5f0('0x5d')][_0xc5f0('0x57')]({'where':{'name':_0x3e739a,'userProfileId':_0x48213d[_0xc5f0('0x5e')]},'raw':!![]})['then'](function(_0x428761){if(_0x428761&&_0x428761[_0xc5f0('0x5f')]===0x0){return db[_0xc5f0('0x60')][_0xc5f0('0x58')]({'name':_0x55dd19[_0xc5f0('0x38')],'resourceId':_0x55dd19['id'],'type':_0x428761[_0xc5f0('0x38')],'sectionId':_0x428761['id']},{})[_0xc5f0('0x1f')](function(){return _0x5ed0fd;});}else{return _0x5ed0fd;}})[_0xc5f0('0x28')](function(_0x1dff0d){logger['error'](_0xc5f0('0x61'),_0x1dff0d);throw _0x1dff0d;});}return _0x5ed0fd;})[_0xc5f0('0x1f')](respondWithResult(_0x531a05,0xc9))[_0xc5f0('0x28')](handleError(_0x531a05,null));};exports[_0xc5f0('0x34')]=function(_0x307431,_0x1dc126){if(_0x307431['body']['id']){delete _0x307431['body']['id'];}return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x307431['params']['id']},'include':[{'model':db[_0xc5f0('0x39')],'as':'mandatoryDispositionPause'}]})[_0xc5f0('0x1f')](handleEntityNotFound(_0x1dc126,null))[_0xc5f0('0x1f')](saveUpdates(_0x307431[_0xc5f0('0x59')],null))['then'](respondWithResult(_0x1dc126,null))['catch'](handleError(_0x1dc126,null));};exports[_0xc5f0('0x35')]=function(_0x1d762f,_0x335780){return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x1d762f[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x335780,null))[_0xc5f0('0x1f')](removeEntity(_0x335780,null))[_0xc5f0('0x28')](handleError(_0x335780,null));};exports[_0xc5f0('0x62')]=function(_0x367bfa,_0x226e51){return db[_0xc5f0('0x3c')][_0xc5f0('0x62')]()[_0xc5f0('0x1f')](respondWithResult(_0x226e51,null))[_0xc5f0('0x28')](handleError(_0x226e51,null));};exports[_0xc5f0('0x63')]=function(_0x27a5d5,_0x571625,_0x3c7846){if(_0x27a5d5['body']['id']){delete _0x27a5d5['body']['id'];}return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x27a5d5[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x571625,null))[_0xc5f0('0x1f')](function(_0x52fe2a){if(_0x52fe2a){_0x27a5d5[_0xc5f0('0x59')]['SmsAccountId']=_0x52fe2a['id'];return db[_0xc5f0('0x64')][_0xc5f0('0x58')](_0x27a5d5[_0xc5f0('0x59')]);}})[_0xc5f0('0x1f')](respondWithResult(_0x571625,null))[_0xc5f0('0x28')](handleError(_0x571625,null));};exports[_0xc5f0('0x65')]=function(_0x5ba722,_0x40ceb0,_0x23e41b){var _0xba0529={'raw':![],'where':{}};var _0x2ad475={};var _0x30d132={'count':0x0,'rows':[]};return db[_0xc5f0('0x3c')][_0xc5f0('0x66')]({'where':{'id':_0x5ba722[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x40ceb0,null))[_0xc5f0('0x1f')](function(_0x509c71){if(_0x509c71){_0x2ad475['model']=_[_0xc5f0('0x41')](db[_0xc5f0('0x64')]['rawAttributes']);_0x2ad475[_0xc5f0('0x40')]=_[_0xc5f0('0x41')](_0x5ba722['query']);_0x2ad475[_0xc5f0('0x42')]=_['intersection'](_0x2ad475[_0xc5f0('0x44')],_0x2ad475[_0xc5f0('0x40')]);_0xba0529['attributes']=_[_0xc5f0('0x43')](_0x2ad475[_0xc5f0('0x44')],qs[_0xc5f0('0x46')](_0x5ba722[_0xc5f0('0x40')][_0xc5f0('0x46')]));_0xba0529[_0xc5f0('0x45')]=_0xba0529[_0xc5f0('0x45')]['length']?_0xba0529[_0xc5f0('0x45')]:_0x2ad475[_0xc5f0('0x44')];if(!_0x5ba722['query'][_0xc5f0('0x48')](_0xc5f0('0x49'))){_0xba0529['limit']=qs[_0xc5f0('0x2f')](_0x5ba722['query'][_0xc5f0('0x2f')]);_0xba0529['offset']=qs[_0xc5f0('0x2d')](_0x5ba722[_0xc5f0('0x40')]['offset']);}_0xba0529[_0xc5f0('0x4a')]=qs[_0xc5f0('0x4b')](_0x5ba722[_0xc5f0('0x40')][_0xc5f0('0x4b')]);_0xba0529['where']=qs[_0xc5f0('0x42')](_['pick'](_0x5ba722[_0xc5f0('0x40')],_0x2ad475[_0xc5f0('0x42')]));_0xba0529[_0xc5f0('0x4c')][_0xc5f0('0x67')]=_0x509c71['id'];if(_0x5ba722[_0xc5f0('0x40')][_0xc5f0('0x50')]){_0xba0529[_0xc5f0('0x4c')]=_[_0xc5f0('0x4e')](_0xba0529[_0xc5f0('0x4c')],{'$or':_[_0xc5f0('0x3b')](_0xba0529[_0xc5f0('0x45')],function(_0x9c61c1){var _0x5d4b5b={};_0x5d4b5b[_0x9c61c1]={'$like':'%'+_0x5ba722[_0xc5f0('0x40')][_0xc5f0('0x50')]+'%'};return _0x5d4b5b;})});}_0xba0529=_['merge']({},_0xba0529,_0x5ba722[_0xc5f0('0x68')]);return db[_0xc5f0('0x64')][_0xc5f0('0x30')]({'where':_0xba0529[_0xc5f0('0x4c')]})[_0xc5f0('0x1f')](function(_0x44930d){_0x30d132['count']=_0x44930d;if(_0x5ba722[_0xc5f0('0x40')][_0xc5f0('0x51')]){_0xba0529[_0xc5f0('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xc5f0('0x52')](_0xba0529);})['then'](function(_0x920d95){_0x30d132['rows']=_0x920d95;return _0x30d132;});}})[_0xc5f0('0x1f')](respondWithFilteredResult(_0x40ceb0,_0xba0529))[_0xc5f0('0x28')](handleError(_0x40ceb0,null));};exports[_0xc5f0('0x69')]=function(_0x4e4709,_0x294390,_0xafbc0f){return db[_0xc5f0('0x3c')]['find']({'where':{'id':_0x4e4709[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x294390,null))['then'](function(_0x31b090){if(_0x31b090){return _0x31b090['removeDispositions'](_0x4e4709[_0xc5f0('0x40')][_0xc5f0('0x6a')]);}})['then'](respondWithStatusCode(_0x294390,null))['catch'](handleError(_0x294390,null));};exports[_0xc5f0('0x6b')]=function(_0xf0b103,_0x2c33e0,_0x3ee3af){if(_0xf0b103[_0xc5f0('0x59')]['id']){delete _0xf0b103[_0xc5f0('0x59')]['id'];}return db[_0xc5f0('0x3c')]['find']({'where':{'id':_0xf0b103['params']['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x2c33e0,null))[_0xc5f0('0x1f')](function(_0x4c34e2){if(_0x4c34e2){_0xf0b103[_0xc5f0('0x59')][_0xc5f0('0x67')]=_0x4c34e2['id'];return db[_0xc5f0('0x6c')][_0xc5f0('0x58')](_0xf0b103['body']);}})[_0xc5f0('0x1f')](respondWithResult(_0x2c33e0,null))[_0xc5f0('0x28')](handleError(_0x2c33e0,null));};exports['getAnswers']=function(_0x43a4e0,_0x3f6daf,_0x106f75){var _0x3ba5de={'raw':![],'where':{}};var _0x57c571={};var _0xc3984b={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x43a4e0[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x3f6daf,null))[_0xc5f0('0x1f')](function(_0x2df9d3){if(_0x2df9d3){_0x57c571[_0xc5f0('0x44')]=_['keys'](db[_0xc5f0('0x6c')][_0xc5f0('0x55')]);_0x57c571[_0xc5f0('0x40')]=_[_0xc5f0('0x41')](_0x43a4e0[_0xc5f0('0x40')]);_0x57c571[_0xc5f0('0x42')]=_[_0xc5f0('0x43')](_0x57c571[_0xc5f0('0x44')],_0x57c571[_0xc5f0('0x40')]);_0x3ba5de[_0xc5f0('0x45')]=_[_0xc5f0('0x43')](_0x57c571[_0xc5f0('0x44')],qs[_0xc5f0('0x46')](_0x43a4e0['query'][_0xc5f0('0x46')]));_0x3ba5de[_0xc5f0('0x45')]=_0x3ba5de[_0xc5f0('0x45')][_0xc5f0('0x47')]?_0x3ba5de[_0xc5f0('0x45')]:_0x57c571[_0xc5f0('0x44')];if(!_0x43a4e0[_0xc5f0('0x40')][_0xc5f0('0x48')](_0xc5f0('0x49'))){_0x3ba5de[_0xc5f0('0x2f')]=qs[_0xc5f0('0x2f')](_0x43a4e0[_0xc5f0('0x40')]['limit']);_0x3ba5de[_0xc5f0('0x2d')]=qs['offset'](_0x43a4e0[_0xc5f0('0x40')][_0xc5f0('0x2d')]);}_0x3ba5de['order']=qs[_0xc5f0('0x4b')](_0x43a4e0['query'][_0xc5f0('0x4b')]);_0x3ba5de[_0xc5f0('0x4c')]=qs['filters'](_[_0xc5f0('0x4d')](_0x43a4e0[_0xc5f0('0x40')],_0x57c571[_0xc5f0('0x42')]));_0x3ba5de[_0xc5f0('0x4c')]['SmsAccountId']=_0x2df9d3['id'];if(_0x43a4e0[_0xc5f0('0x40')][_0xc5f0('0x50')]){_0x3ba5de[_0xc5f0('0x4c')]=_['merge'](_0x3ba5de[_0xc5f0('0x4c')],{'$or':_[_0xc5f0('0x3b')](_0x3ba5de['attributes'],function(_0x40a023){var _0x58801f={};_0x58801f[_0x40a023]={'$like':'%'+_0x43a4e0[_0xc5f0('0x40')]['filter']+'%'};return _0x58801f;})});}_0x3ba5de=_[_0xc5f0('0x4e')]({},_0x3ba5de,_0x43a4e0[_0xc5f0('0x68')]);return db[_0xc5f0('0x6c')][_0xc5f0('0x30')]({'where':_0x3ba5de[_0xc5f0('0x4c')]})['then'](function(_0x4b076f){_0xc3984b[_0xc5f0('0x30')]=_0x4b076f;if(_0x43a4e0['query'][_0xc5f0('0x51')]){_0x3ba5de[_0xc5f0('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc5f0('0x52')](_0x3ba5de);})[_0xc5f0('0x1f')](function(_0x3704d2){_0xc3984b[_0xc5f0('0x6d')]=_0x3704d2;return _0xc3984b;});}})['then'](respondWithFilteredResult(_0x3f6daf,_0x3ba5de))[_0xc5f0('0x28')](handleError(_0x3f6daf,null));};exports[_0xc5f0('0x6e')]=function(_0x21301b,_0x520493,_0x45480f){return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x21301b['params']['id']}})['then'](handleEntityNotFound(_0x520493,null))[_0xc5f0('0x1f')](function(_0x3dca1e){if(_0x3dca1e){return _0x3dca1e[_0xc5f0('0x6e')](_0x21301b[_0xc5f0('0x40')][_0xc5f0('0x6a')]);}})[_0xc5f0('0x1f')](respondWithStatusCode(_0x520493,null))['catch'](handleError(_0x520493,null));};exports[_0xc5f0('0x6f')]=function(_0x1e18b3,_0x2055ea,_0x2147a9){var _0x59612e={'channel':_0xc5f0('0x70')};var _0x88012a=[];var _0x1610fa=[];var _0x401ba7={};return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x1e18b3[_0xc5f0('0x54')]['id']},'include':[{'model':db[_0xc5f0('0x71')],'as':_0xc5f0('0x72')}]})[_0xc5f0('0x1f')](handleEntityNotFound(_0x2055ea,null))[_0xc5f0('0x1f')](function(_0x14133f){_0x59612e[_0xc5f0('0x73')]=_0x14133f;_0x59612e[_0xc5f0('0x74')]=_['orderBy'](_0x14133f[_0xc5f0('0x72')],[_0xc5f0('0x75')],[_0xc5f0('0x76')]);if(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0x72')]){delete _0x59612e[_0xc5f0('0x73')][_0xc5f0('0x72')];}return db['CmContact'][_0xc5f0('0x62')]();})['then'](function(_0x434f82){if(!_0x434f82){throw new db['Sequelize'][(_0xc5f0('0x77'))](_0xc5f0('0x78'));}_0x88012a=_[_0xc5f0('0x79')](_['keys'](_0x434f82),[_0xc5f0('0x7a'),_0xc5f0('0x7b')]);_0x1610fa=_[_0xc5f0('0x79')](_[_0xc5f0('0x41')](_0x434f82),[_0xc5f0('0x7a'),_0xc5f0('0x7b'),_0xc5f0('0x7c'),_0xc5f0('0x7d')]);_0x59612e[_0xc5f0('0x59')]={'mapKey':'mobile'};if(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0x3e')]){switch(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0x3e')]){case _0xc5f0('0x7e'):_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')]=_0x1e18b3['body'][_0xc5f0('0x80')];_0x59612e['body'][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x81')];_0x59612e['body'][_0xc5f0('0x82')]=_0x1e18b3[_0xc5f0('0x59')]['MessageSid'];break;case'skebby':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')]='+'+_0x1e18b3['body'][_0xc5f0('0x83')];_0x59612e['body'][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x84')];break;case _0xc5f0('0x85'):_0x59612e[_0xc5f0('0x59')]['from']=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x7f')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3['body'][_0xc5f0('0x25')];break;case _0xc5f0('0x86'):_0x59612e['body']['from']=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x7f')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x59')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x82')]=_0x1e18b3[_0xc5f0('0x59')]['message_id'];break;case _0xc5f0('0x87'):_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')]=_0x1e18b3['body']['From'];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')]['Text'];_0x59612e[_0xc5f0('0x59')]['messageId']=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x88')];break;case _0xc5f0('0x89'):_0x59612e['body']['from']='+'+_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x8a')][0x0][_0xc5f0('0x7f')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x8a')][0x0][_0xc5f0('0x84')];_0x59612e[_0xc5f0('0x59')]['messageId']=_0x1e18b3[_0xc5f0('0x59')]['results'][0x0]['messageId'];break;case _0xc5f0('0x8b'):_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x8c')];_0x59612e['body'][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x8d')][_0xc5f0('0x25')];break;case'clickatell':_0x59612e[_0xc5f0('0x59')]['from']=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x8e')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3[_0xc5f0('0x59')]['text'];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x82')]=_0x1e18b3['body'][_0xc5f0('0x8f')];break;case _0xc5f0('0x90'):_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x82')]=_0x1e18b3['body'][0x0][_0xc5f0('0x25')]['id'];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')]=_0x1e18b3[_0xc5f0('0x59')][0x0]['message'][_0xc5f0('0x7f')];_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')]=_0x1e18b3['body'][0x0][_0xc5f0('0x25')][_0xc5f0('0x84')];break;case _0xc5f0('0x91'):_0x59612e['body'][_0xc5f0('0x7f')]=_0x1e18b3[_0xc5f0('0x59')][_0xc5f0('0x7f')];_0x59612e[_0xc5f0('0x59')]['body']=_0x1e18b3['body'][_0xc5f0('0x25')];_0x59612e['body']['messageId']=_0x1e18b3['body'][_0xc5f0('0x92')];break;}}if(_0x59612e[_0xc5f0('0x59')]['id']){delete _0x59612e[_0xc5f0('0x59')]['id'];}if(_[_0xc5f0('0x93')](_0x59612e[_0xc5f0('0x59')]['from'])){throw new db[(_0xc5f0('0x94'))][(_0xc5f0('0x77'))](_0xc5f0('0x95'));}if(_['isNil'](_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')])||_0x59612e['body'][_0xc5f0('0x59')]===''){throw new db[(_0xc5f0('0x94'))][(_0xc5f0('0x77'))](_0xc5f0('0x96'));}if(_[_0xc5f0('0x93')](_0x59612e['body'][_0xc5f0('0x97')])){throw new db[(_0xc5f0('0x94'))]['ValidationError'](_0xc5f0('0x98')+_0x1610fa);}if(!_[_0xc5f0('0x99')](_0x1610fa,_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x97')])){throw new db['Sequelize'][(_0xc5f0('0x77'))](_0xc5f0('0x9a')+_0x1610fa);}_0x401ba7[_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x97')]]=_0x59612e['body']['from'];return db[_0xc5f0('0x9b')][_0xc5f0('0x57')]({'where':{'id':_0x59612e[_0xc5f0('0x73')][_0xc5f0('0x7d')]},'include':[{'model':db[_0xc5f0('0x9c')],'as':'Contacts','where':_0x401ba7,'limit':0x1,'order':[[_0xc5f0('0x7b'),_0xc5f0('0x9d')]]}]});})[_0xc5f0('0x1f')](handleEntityNotFound(_0x2055ea,null))['then'](function(_0x330e7e){if(_0x330e7e){_0x59612e[_0xc5f0('0x9e')]=_[_0xc5f0('0x9f')](_0x330e7e,[_0xc5f0('0xa0')]);if(_0x330e7e['Contacts'][_0xc5f0('0x47')]){return _0x330e7e[_0xc5f0('0xa0')][0x0];}var _0x3875d1=_[_0xc5f0('0x17')](_0x59612e['body'],{'firstName':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')],'ListId':_0x330e7e['id']});_0x3875d1[_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x97')]]=_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')];return db[_0xc5f0('0x9c')]['create'](_0x3875d1,{'fields':_0x88012a,'raw':!![]});}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x2055ea,null))[_0xc5f0('0x1f')](function(_0x2f9dcc){if(_0x2f9dcc){_0x59612e[_0xc5f0('0xa1')]=_0x2f9dcc;var _0x3683f8={'ContactId':_0x2f9dcc['id'],'phone':_0x59612e['body'][_0xc5f0('0x7f')],'SmsAccountId':_0x1e18b3[_0xc5f0('0x54')]['id']};var _0x31f241={'ContactId':_0x2f9dcc['id'],'SmsAccountId':_0x1e18b3['params']['id'],'closed':![]};return db[_0xc5f0('0xa2')]['find']({'where':_0x31f241})[_0xc5f0('0x1f')](function(_0x3ac55c){if(_0x3ac55c){return[_0x3ac55c,![]];}return db['SmsInteraction'][_0xc5f0('0x58')](_0x3683f8)['then'](function(_0x1de667){return[_0x1de667,!![]];});});}})[_0xc5f0('0xa3')](function(_0x24f46f,_0x250443){_0x59612e['interaction']=_0x24f46f[_0xc5f0('0x36')]({'plain':!![]});_0x59612e[_0xc5f0('0xa4')][_0xc5f0('0xa5')]=![];if(_0x250443){if(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0xa6')]){_0x59612e['applications'][_0xc5f0('0xa7')]({'id':0x0,'priority':_0x59612e['applications']['length']+0x1,'app':_0xc5f0('0xa8'),'appdata':_0xc5f0('0xa9'),'interval':_0xc5f0('0xaa')});}_0x59612e['interaction'][_0xc5f0('0xa5')]=!![];}return db['SmsMessage'][_0xc5f0('0x58')]({'phone':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x7f')],'messageId':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x82')],'body':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0x59')],'SmsAccountId':_0x1e18b3['params']['id'],'SmsInteractionId':_0x24f46f['id'],'direction':'in','ContactId':_0x24f46f[_0xc5f0('0xab')],'AttachmentId':_0x59612e[_0xc5f0('0x59')][_0xc5f0('0xac')]});})['then'](function(_0x40560c){_0x59612e[_0xc5f0('0x25')]=_0x40560c;if(!_0x59612e[_0xc5f0('0xa4')][_0xc5f0('0xad')])return;return db[_0xc5f0('0xae')]['find']({'attributes':['id',_0xc5f0('0x38')],'where':{'id':_0x59612e[_0xc5f0('0xa4')]['UserId']}});})[_0xc5f0('0x1f')](function(_0x4c9738){if(_0x4c9738){_0x59612e['applications'][_0xc5f0('0xaf')]({'id':0x0,'priority':0x0,'app':_0xc5f0('0xb0'),'appdata':_0x4c9738[_0xc5f0('0x38')]+','+(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0xb1')]||0xa),'interval':_0xc5f0('0xaa')});}if(!_0x59612e[_0xc5f0('0xa4')][_0xc5f0('0xb2')])return;return db[_0xc5f0('0xb3')][_0xc5f0('0x57')]({'attributes':['id','name'],'where':{'id':_0x59612e[_0xc5f0('0xa4')][_0xc5f0('0xb2')]}});})[_0xc5f0('0x1f')](function(_0x5722e7){if(_0x5722e7){_0x59612e[_0xc5f0('0x74')][_0xc5f0('0xaf')]({'id':0x0,'priority':0x1,'app':_0xc5f0('0xb4'),'appdata':_0x5722e7['name']+','+(_0x59612e[_0xc5f0('0x73')][_0xc5f0('0xb5')]||0x12c),'interval':_0xc5f0('0xaa')});}return respondWithRpcPromise(_0xc5f0('0xb6'),_0xc5f0('0xb7'),_0x59612e);})[_0xc5f0('0x1f')](function(_0xcaf793){if(_0xcaf793){var _0x5afd15=0xc8;var _0x3cd114=_0xc5f0('0xb8');logger['info'](_0xc5f0('0xb9'),_0x3cd114,_0x5afd15,_0xc5f0('0xba'));logger[_0xc5f0('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3cd114,_0x5afd15,_0xc5f0('0xba'),JSON[_0xc5f0('0xbb')](_0xcaf793));if(_0x59612e[_0xc5f0('0x73')]['type']==='twilio'){return _0x2055ea['status'](_0x5afd15)[_0xc5f0('0x31')]('Content-Type','text/xml')[_0xc5f0('0xbc')](_0xc5f0('0xbd'));}else{return _0x2055ea[_0xc5f0('0x2a')](_0x5afd15)[_0xc5f0('0x2c')](_0xcaf793);}}})['catch'](handleError(_0x2055ea,null));};exports['addApplications']=function(_0x44681b,_0x375b7f){var _0x2e060e=_0x44681b[_0xc5f0('0x54')]['id'];var _0x5bf337=_0x44681b[_0xc5f0('0x59')];var _0x44e35d=0xc8;var _0x44c5f4=null;return db[_0xc5f0('0xbe')]['transaction']({'isolationLevel':db[_0xc5f0('0xbe')]['Transaction'][_0xc5f0('0xbf')][_0xc5f0('0xc0')]},function(_0x6e68ab){return db[_0xc5f0('0x3c')][_0xc5f0('0x66')]({'where':{'id':_0x2e060e},'transaction':_0x6e68ab})[_0xc5f0('0x1f')](function(_0x588a9e){if(_0x588a9e){return db['SmsApplication'][_0xc5f0('0x35')]({'where':{'SmsAccountId':_0x2e060e},'transaction':_0x6e68ab})[_0xc5f0('0x1f')](function(){var _0x7ee6f4=_['map'](_0x5bf337,function(_0x32236f){_0x32236f['SmsAccountId']=_0x2e060e;return _0x32236f;});return db[_0xc5f0('0x71')][_0xc5f0('0xc1')](_0x7ee6f4,{'transaction':_0x6e68ab});});}else{_0x44e35d=0x194;_0x44c5f4=[];}});})[_0xc5f0('0x1f')](function(){if(_0x44e35d!==0x194){return db[_0xc5f0('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x2e060e},'order':_0xc5f0('0x75')})['then'](function(_0x2e50b1){_0x44c5f4=_0x2e50b1;});}})['catch'](function(_0x207c42){_0x44e35d=0x1f4;logger[_0xc5f0('0x23')](_0x207c42['stack']);if(_0x207c42[_0xc5f0('0x38')]){delete _0x207c42[_0xc5f0('0x38')];}_0x44c5f4=_0x207c42;})[_0xc5f0('0xc2')](function(){if(_0x44c5f4===null){_0x375b7f[_0xc5f0('0x29')](_0x44e35d);}else{if(_0x44e35d===0x1f4){_0x375b7f[_0xc5f0('0x2a')](_0x44e35d)['send'](_0x44c5f4);}else{_0x375b7f[_0xc5f0('0x2a')](_0x44e35d)['json'](_0x44c5f4);}}});};exports[_0xc5f0('0xc3')]=function(_0xffd024,_0x571468,_0x49977f){var _0x6e56b5={};var _0x48d4e1={};var _0x494d4a;var _0x2c38a1;return db[_0xc5f0('0x3c')][_0xc5f0('0x66')]({'where':{'id':_0xffd024[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x571468,null))[_0xc5f0('0x1f')](function(_0x5228e2){if(_0x5228e2){_0x494d4a=_0x5228e2;_0x48d4e1[_0xc5f0('0x44')]=_[_0xc5f0('0x41')](db['SmsApplication']['rawAttributes']);_0x48d4e1[_0xc5f0('0x40')]=_[_0xc5f0('0x41')](_0xffd024[_0xc5f0('0x40')]);_0x48d4e1[_0xc5f0('0x42')]=_[_0xc5f0('0x43')](_0x48d4e1[_0xc5f0('0x44')],_0x48d4e1['query']);_0x6e56b5[_0xc5f0('0x45')]=_[_0xc5f0('0x43')](_0x48d4e1[_0xc5f0('0x44')],qs[_0xc5f0('0x46')](_0xffd024[_0xc5f0('0x40')][_0xc5f0('0x46')]));_0x6e56b5['attributes']=_0x6e56b5['attributes'][_0xc5f0('0x47')]?_0x6e56b5[_0xc5f0('0x45')]:_0x48d4e1['model'];_0x6e56b5['order']=qs[_0xc5f0('0x4b')](_0xffd024[_0xc5f0('0x40')][_0xc5f0('0x4b')]);_0x6e56b5['where']=qs['filters'](_[_0xc5f0('0x4d')](_0xffd024[_0xc5f0('0x40')],_0x48d4e1['filters']));if(_0xffd024['query']['filter']){_0x6e56b5[_0xc5f0('0x4c')]=_[_0xc5f0('0x4e')](_0x6e56b5[_0xc5f0('0x4c')],{'$or':_['map'](_0x6e56b5[_0xc5f0('0x45')],function(_0x2b201d){var _0x3f3643={};_0x3f3643[_0x2b201d]={'$like':'%'+_0xffd024[_0xc5f0('0x40')]['filter']+'%'};return _0x3f3643;})});}_0x6e56b5=_[_0xc5f0('0x4e')]({},_0x6e56b5,_0xffd024[_0xc5f0('0x68')]);return _0x494d4a[_0xc5f0('0xc3')](_0x6e56b5);}})[_0xc5f0('0x1f')](function(_0x3ebce6){if(_0x3ebce6){_0x2c38a1=_0x3ebce6[_0xc5f0('0x47')];if(!_0xffd024['query'][_0xc5f0('0x48')](_0xc5f0('0x49'))){_0x6e56b5[_0xc5f0('0x2f')]=qs[_0xc5f0('0x2f')](_0xffd024['query'][_0xc5f0('0x2f')]);_0x6e56b5['offset']=qs['offset'](_0xffd024[_0xc5f0('0x40')]['offset']);}return _0x494d4a[_0xc5f0('0xc3')](_0x6e56b5);}})[_0xc5f0('0x1f')](function(_0x26f99f){if(_0x26f99f){return _0x26f99f?{'count':_0x2c38a1,'rows':_0x26f99f}:null;}})['then'](respondWithResult(_0x571468,null))['catch'](handleError(_0x571468,null));};exports[_0xc5f0('0xc4')]=function(_0x3c0589,_0x212d4b,_0xe34794){var _0xfbb8bf={'raw':![],'where':{}};var _0x1c782f={};var _0x7cee19={'count':0x0,'rows':[]};return db[_0xc5f0('0x3c')][_0xc5f0('0x66')]({'where':{'id':_0x3c0589[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x212d4b,null))['then'](function(_0x18efd1){if(_0x18efd1){_0x1c782f[_0xc5f0('0x44')]=_[_0xc5f0('0x41')](db['SmsInteraction'][_0xc5f0('0x55')]);_0x1c782f['query']=_[_0xc5f0('0x41')](_0x3c0589[_0xc5f0('0x40')]);_0x1c782f[_0xc5f0('0x42')]=_['intersection'](_0x1c782f[_0xc5f0('0x44')],_0x1c782f['query']);_0xfbb8bf[_0xc5f0('0x45')]=_['intersection'](_0x1c782f[_0xc5f0('0x44')],qs['fields'](_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0x46')]));_0xfbb8bf[_0xc5f0('0x45')]=_0xfbb8bf[_0xc5f0('0x45')]['length']?_0xfbb8bf['attributes']:_0x1c782f['model'];if(!_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0x48')]('nolimit')){_0xfbb8bf[_0xc5f0('0x2f')]=qs[_0xc5f0('0x2f')](_0x3c0589['query']['limit']);_0xfbb8bf[_0xc5f0('0x2d')]=qs[_0xc5f0('0x2d')](_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0x2d')]);}_0xfbb8bf['order']=qs[_0xc5f0('0x4b')](_0x3c0589['query'][_0xc5f0('0x4b')]);_0xfbb8bf[_0xc5f0('0x4c')]=qs[_0xc5f0('0x42')](_[_0xc5f0('0x4d')](_0x3c0589[_0xc5f0('0x40')],_0x1c782f['filters']));_0xfbb8bf['where'][_0xc5f0('0x67')]=_0x18efd1['id'];if(_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0x50')]){_0xfbb8bf[_0xc5f0('0x4c')]=_[_0xc5f0('0x4e')](_0xfbb8bf[_0xc5f0('0x4c')],{'$or':_['map'](_0xfbb8bf[_0xc5f0('0x45')],function(_0x540028){var _0x34b4f2={};_0x34b4f2[_0x540028]={'$like':'%'+_0x3c0589['query'][_0xc5f0('0x50')]+'%'};return _0x34b4f2;})});}_0xfbb8bf=_['merge']({},_0xfbb8bf,_0x3c0589[_0xc5f0('0x68')]);return db[_0xc5f0('0xa2')][_0xc5f0('0x30')]({'where':_0xfbb8bf['where']})[_0xc5f0('0x1f')](function(_0x492f80){_0x7cee19[_0xc5f0('0x30')]=_0x492f80;if(_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0x51')]){_0xfbb8bf[_0xc5f0('0x56')]=[{'model':db[_0xc5f0('0x9c')],'as':_0xc5f0('0xc5'),'required':![]},{'model':db[_0xc5f0('0xae')],'as':_0xc5f0('0xc6'),'attributes':[_0xc5f0('0x38'),'fullname',_0xc5f0('0xc7')],'required':![]},{'model':db[_0xc5f0('0xc8')],'as':_0xc5f0('0xc9'),'attributes':['id',_0xc5f0('0x38'),_0xc5f0('0xca')],'where':_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0xcb')]?{'id':_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0xcb')]}:undefined,'required':_0x3c0589[_0xc5f0('0x40')][_0xc5f0('0xcb')]?!![]:![]}];}return db[_0xc5f0('0xa2')]['findAll'](_0xfbb8bf);})[_0xc5f0('0x1f')](function(_0x3c2964){_0x7cee19['rows']=_0x3c2964;return _0x7cee19;});}})['then'](respondWithFilteredResult(_0x212d4b,_0xfbb8bf))['catch'](handleError(_0x212d4b,null));};exports[_0xc5f0('0xbc')]=function(_0x3b757f,_0x41b95a,_0x2f1152){var _0x5c0522,_0x132bab,_0x59be56;if(_['isNil'](_0x3b757f[_0xc5f0('0x59')][_0xc5f0('0x59')])||_0x3b757f['body'][_0xc5f0('0x59')]===''){throw new db[(_0xc5f0('0x94'))][(_0xc5f0('0x77'))](_0xc5f0('0x96'));}if(_['isNil'](_0x3b757f[_0xc5f0('0x59')]['to'])){throw new db[(_0xc5f0('0x94'))][(_0xc5f0('0x77'))]('to\x20is\x20mandatory');}_0x5c0522=_0x3b757f[_0xc5f0('0x59')]['to'];return db['SmsAccount'][_0xc5f0('0x57')]({'where':{'id':_0x3b757f[_0xc5f0('0x54')]['id']},'include':[{'model':db[_0xc5f0('0x9b')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc5f0('0xa0'),'where':{'mobile':_0x5c0522},'limit':0x1,'order':[[_0xc5f0('0x7b'),_0xc5f0('0x9d')]]}]}]})[_0xc5f0('0x1f')](handleEntityNotFound(_0x41b95a,null))['then'](function(_0x4b7206){if(_0x4b7206&&_0x4b7206[_0xc5f0('0xcc')]){_0x132bab=_0x4b7206['get']({'plain':!![]});if(_0x132bab['List']&&_0x132bab[_0xc5f0('0xcc')]['Contacts'][_0xc5f0('0x47')]){return _0x132bab[_0xc5f0('0xcc')][_0xc5f0('0xa0')][0x0];}return db[_0xc5f0('0x9c')][_0xc5f0('0x58')](_['defaults'](_0x3b757f['body'],{'firstName':_0x5c0522,'mobile':_0x5c0522,'phone':_0x5c0522,'ListId':_0x132bab['ListId']}));}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x41b95a,null))['then'](function(_0x39b51a){if(_0x39b51a){_0x59be56=_0x39b51a;return db[_0xc5f0('0xa2')][_0xc5f0('0x57')]({'where':{'ContactId':_0x59be56['id'],'closed':![],'SmsAccountId':_0x132bab['id']}})[_0xc5f0('0x1f')](function(_0x541602){if(_0x541602){return[_0x541602,![]];}return db[_0xc5f0('0xa2')][_0xc5f0('0x58')]({'UserId':_0x3b757f[_0xc5f0('0x5a')]['id'],'ContactId':_0x59be56['id'],'SmsAccountId':_0x132bab['id'],'phone':_0x5c0522,'firstMsgDirection':_0xc5f0('0xcd'),'Messages':[_[_0xc5f0('0x4e')](_0x3b757f[_0xc5f0('0x59')],{'read':![],'body':_0x3b757f[_0xc5f0('0x59')]['body'],'phone':_0x5c0522,'SmsAccountId':_0x132bab['id'],'UserId':_0x3b757f[_0xc5f0('0x5a')]['id'],'ContactId':_0x59be56['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc5f0('0xce')}]})[_0xc5f0('0x1f')](function(_0x457c64){return[_0x457c64,!![]];});});}})['spread'](function(_0x5d265c,_0x5f7b17){if(_0x5f7b17){return _0x5d265c;}return db[_0xc5f0('0xcf')][_0xc5f0('0x58')](_[_0xc5f0('0x4e')](_0x3b757f[_0xc5f0('0x59')],{'read':![],'body':_0x3b757f[_0xc5f0('0x59')][_0xc5f0('0x59')],'phone':_0x5c0522,'SmsAccountId':_0x132bab['id'],'SmsInteractionId':_0x5d265c['id'],'UserId':_0x3b757f[_0xc5f0('0x5a')]['id'],'ContactId':_0x59be56['id']}))[_0xc5f0('0x1f')](function(_0x50ee5c){_0x5d265c[_0xc5f0('0xd0')]['Messages']=[];_0x5d265c[_0xc5f0('0xd0')][_0xc5f0('0xce')]['push'](_0x50ee5c['dataValues']);return _0x5d265c;});})[_0xc5f0('0x1f')](respondWithResult(_0x41b95a,null))[_0xc5f0('0x28')](handleError(_0x41b95a,null));};exports[_0xc5f0('0x2a')]=function(_0xe093d4,_0x1099c5,_0x3a824e){if(_0xe093d4[_0xc5f0('0x59')]['id']){delete _0xe093d4['body']['id'];}var _0x563c12,_0x2afb90,_0x3080e3;return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0xe093d4['params']['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x1099c5,null))[_0xc5f0('0x1f')](function(_0x411c59){if(_0x411c59){_0x3080e3=_0x411c59;logger[_0xc5f0('0x21')](_0xc5f0('0xb9'),'status',_0xc5f0('0xd1'),_0x411c59[_0xc5f0('0x3e')],util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));switch(_0x411c59['type']){case _0xc5f0('0xd3'):if(_0xe093d4['body']['skebby_dispatch_id']&&_0xe093d4[_0xc5f0('0x59')]['status']){_0x2afb90=_0xe093d4['body'][_0xc5f0('0x2a')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0xe093d4['body'][_0xc5f0('0xd4')]}});}break;case'connectel':if(_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xd5')]&&_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xd6')]){_0x2afb90=_0xe093d4[_0xc5f0('0x59')]['statusInt'];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xd5')]}});}break;case _0xc5f0('0x86'):if(_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xd7')]&&_0xe093d4[_0xc5f0('0x59')]['status_code']){_0x2afb90=_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xd8')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0xe093d4['body'][_0xc5f0('0xd7')]}});}break;case'infobip':var _0x1747a5=_0xe093d4['body']['results'][0x0];if(_0x1747a5[_0xc5f0('0x82')]&&_0x1747a5['status'][_0xc5f0('0xd9')]==='DELIVERED'){_0x2afb90=_0x1747a5[_0xc5f0('0x2a')][_0xc5f0('0xd9')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0x1747a5[_0xc5f0('0x82')]}});}break;case _0xc5f0('0xda'):if(_0xe093d4[_0xc5f0('0x59')]['messageId']&&_0xe093d4[_0xc5f0('0x59')]['status']){_0x2afb90=_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0x2a')];return db[_0xc5f0('0xcf')]['find']({'where':{'messageId':_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0x82')]}});}break;case _0xc5f0('0x90'):if(_0xe093d4[_0xc5f0('0x59')][0x0]['message']['id']){_0x2afb90=_0xe093d4[_0xc5f0('0x59')][0x0][_0xc5f0('0x3e')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0xe093d4[_0xc5f0('0x59')][0x0][_0xc5f0('0x25')]['id']}});}break;case'intelepeer':if(_0xe093d4['body'][_0xc5f0('0xdb')]&&_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0x2a')]){_0x2afb90=_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0x2a')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x1099c5,null))['then'](function(_0x396557){if(_0x396557){_0x563c12=_0x396557;switch(_0x3080e3[_0xc5f0('0x3e')]){case _0xc5f0('0xd3'):if(_0x2afb90===_0xc5f0('0xdc')){return _0x563c12['update']({'read':!![]});}else{logger['error'](_0xc5f0('0xb9'),'status',_0xc5f0('0xd3'),util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc5f0('0x85'):if(_0x2afb90==='1'){return _0x563c12['update']({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),'status',_0xc5f0('0xd3'),util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc5f0('0x86'):if(!_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0xdd')]&&_0x2afb90>=0xc8&&_0x2afb90<=0xce){return _0x563c12[_0xc5f0('0x34')]({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),_0xc5f0('0x2a'),'clicksend',util[_0xc5f0('0xd2')](_0xe093d4['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1ceb18=_0xe093d4[_0xc5f0('0x59')][_0xc5f0('0x8a')][0x0];if(_0x1ceb18[_0xc5f0('0x2a')]['groupName']==='DELIVERED'){return _0x563c12['update']({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),_0xc5f0('0x2a'),_0xc5f0('0x89'),util['inspect'](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc5f0('0xda'):if(_0x2afb90==_0xc5f0('0xde')||_0x2afb90=='RECEIVED_BY_RECIPIENT'){return _0x563c12[_0xc5f0('0x34')]({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),_0xc5f0('0x2a'),_0xc5f0('0xda'),util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc5f0('0x90'):if(_0x2afb90=='message-delivered'){return _0x563c12[_0xc5f0('0x34')]({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),_0xc5f0('0x2a'),'bandwidth',util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;case _0xc5f0('0x91'):if(_0x2afb90===_0xc5f0('0xdf')||_0x2afb90===_0xc5f0('0xe0')){return _0x563c12[_0xc5f0('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xc5f0('0x91'),util[_0xc5f0('0xd2')](_0xe093d4[_0xc5f0('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x563c12;}})['then'](respondWithResult(_0x1099c5,null))[_0xc5f0('0x28')](handleError(_0x1099c5,null));};exports[_0xc5f0('0xe1')]=function(_0x33c6ef,_0x3d6b10,_0x3f1db4){var _0xcab429,_0x319893,_0x196dfd;return db[_0xc5f0('0x3c')]['find']({'where':{'id':_0x33c6ef[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x3d6b10,null))[_0xc5f0('0x1f')](function(_0x14d562){if(_0x14d562){_0x196dfd=_0x14d562;logger['debug'](_0xc5f0('0xb9'),_0xc5f0('0x2a'),_0xc5f0('0xd1'),_0x14d562['type'],util[_0xc5f0('0xd2')](_0x33c6ef[_0xc5f0('0x40')],{'showHidden':![],'depth':null}));switch(_0x14d562[_0xc5f0('0x3e')]){case _0xc5f0('0x8b'):if(_0x33c6ef[_0xc5f0('0x40')]['message-id']&&_0x33c6ef['query'][_0xc5f0('0xe2')]){_0x319893=_0x33c6ef[_0xc5f0('0x40')][_0xc5f0('0xe2')];return db[_0xc5f0('0xcf')][_0xc5f0('0x57')]({'where':{'messageId':_0x33c6ef[_0xc5f0('0x40')][_0xc5f0('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x3d6b10,null))[_0xc5f0('0x1f')](function(_0x3f4d8e){if(_0x3f4d8e){_0xcab429=_0x3f4d8e;switch(_0x196dfd[_0xc5f0('0x3e')]){case _0xc5f0('0x8b'):if(_0x319893==='2'||_0x319893==='6'){return _0xcab429['update']({'read':!![]});}else{logger[_0xc5f0('0x23')](_0xc5f0('0xb9'),'status',_0xc5f0('0x8b'),util[_0xc5f0('0xd2')](_0x33c6ef['query'],{'showHidden':![],'depth':null}));};break;}return _0xcab429;}})['then'](respondWithResult(_0x3d6b10,null))[_0xc5f0('0x28')](handleError(_0x3d6b10,null));};exports['addAgents']=function(_0x53cb82,_0x1ec1d9,_0xab106c){return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0x53cb82[_0xc5f0('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ec1d9,null))['then'](function(_0x5898df){if(_0x5898df){return _0x5898df[_0xc5f0('0xe4')](_0x53cb82[_0xc5f0('0x59')][_0xc5f0('0x6a')],_[_0xc5f0('0x9f')](_0x53cb82[_0xc5f0('0x59')],[_0xc5f0('0x6a'),'id'])||{})['spread'](function(_0xf6ed4a){for(var _0x3700b8=0x0;_0x3700b8<_0x53cb82[_0xc5f0('0x59')][_0xc5f0('0x6a')][_0xc5f0('0x47')];_0x3700b8+=0x1){socket[_0xc5f0('0xe5')](_0xc5f0('0xe6'),{'UserId':Number(_0x53cb82[_0xc5f0('0x59')][_0xc5f0('0x6a')][_0x3700b8]),'SmsAccountId':Number(_0x53cb82['params']['id'])});}return _0xf6ed4a;});}})[_0xc5f0('0x1f')](respondWithResult(_0x1ec1d9,null))[_0xc5f0('0x28')](handleError(_0x1ec1d9,null));};exports[_0xc5f0('0xe7')]=function(_0xe53d63,_0x5238a7,_0x265b38){return db[_0xc5f0('0x3c')][_0xc5f0('0x57')]({'where':{'id':_0xe53d63['params']['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x5238a7,null))[_0xc5f0('0x1f')](function(_0x1df635){if(_0x1df635){return _0x1df635[_0xc5f0('0xe7')](_0xe53d63[_0xc5f0('0x40')][_0xc5f0('0x6a')])['then'](function(){if(_[_0xc5f0('0xe8')](_0xe53d63[_0xc5f0('0x40')][_0xc5f0('0x6a')])){for(var _0x4a5144=0x0;_0x4a5144<_0xe53d63[_0xc5f0('0x40')][_0xc5f0('0x6a')][_0xc5f0('0x47')];_0x4a5144+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0xe53d63[_0xc5f0('0x40')][_0xc5f0('0x6a')][_0x4a5144]),'SmsAccountId':Number(_0xe53d63['params']['id'])});}}else{socket['emit'](_0xc5f0('0xe9'),{'UserId':Number(_0xe53d63[_0xc5f0('0x40')][_0xc5f0('0x6a')]),'SmsAccountId':Number(_0xe53d63[_0xc5f0('0x54')]['id'])});}});}})[_0xc5f0('0x1f')](respondWithStatusCode(_0x5238a7,null))[_0xc5f0('0x28')](handleError(_0x5238a7,null));};exports[_0xc5f0('0xea')]=function(_0xea6919,_0x5ab224,_0xc6173e){var _0x4f5b3e={};var _0x33d886={};var _0x361ae1;var _0x3f4883;return db[_0xc5f0('0x3c')]['findOne']({'where':{'id':_0xea6919[_0xc5f0('0x54')]['id']}})[_0xc5f0('0x1f')](handleEntityNotFound(_0x5ab224,null))[_0xc5f0('0x1f')](function(_0x5a2265){if(_0x5a2265){_0x361ae1=_0x5a2265;_0x33d886[_0xc5f0('0x44')]=_[_0xc5f0('0x41')](db[_0xc5f0('0xae')][_0xc5f0('0x55')]);_0x33d886[_0xc5f0('0x40')]=_[_0xc5f0('0x41')](_0xea6919[_0xc5f0('0x40')]);_0x33d886[_0xc5f0('0x42')]=_[_0xc5f0('0x43')](_0x33d886[_0xc5f0('0x44')],_0x33d886[_0xc5f0('0x40')]);_0x4f5b3e[_0xc5f0('0x45')]=_[_0xc5f0('0x43')](_0x33d886[_0xc5f0('0x44')],qs['fields'](_0xea6919[_0xc5f0('0x40')][_0xc5f0('0x46')]));_0x4f5b3e[_0xc5f0('0x45')]=_0x4f5b3e['attributes'][_0xc5f0('0x47')]?_0x4f5b3e['attributes']:_0x33d886['model'];_0x4f5b3e[_0xc5f0('0x4a')]=qs[_0xc5f0('0x4b')](_0xea6919['query'][_0xc5f0('0x4b')]);_0x4f5b3e['where']=qs[_0xc5f0('0x42')](_[_0xc5f0('0x4d')](_0xea6919[_0xc5f0('0x40')],_0x33d886['filters']));if(_0xea6919[_0xc5f0('0x40')][_0xc5f0('0x50')]){_0x4f5b3e[_0xc5f0('0x4c')]=_[_0xc5f0('0x4e')](_0x4f5b3e[_0xc5f0('0x4c')],{'$or':_[_0xc5f0('0x3b')](_0x4f5b3e[_0xc5f0('0x45')],function(_0x51096c){var _0x1b85a3={};_0x1b85a3[_0x51096c]={'$like':'%'+_0xea6919[_0xc5f0('0x40')]['filter']+'%'};return _0x1b85a3;})});}_0x4f5b3e=_[_0xc5f0('0x4e')]({},_0x4f5b3e,_0xea6919[_0xc5f0('0x68')]);return _0x361ae1[_0xc5f0('0xea')](_0x4f5b3e);}})['then'](function(_0x1f0cd8){if(_0x1f0cd8){_0x3f4883=_0x1f0cd8[_0xc5f0('0x47')];if(!_0xea6919[_0xc5f0('0x40')][_0xc5f0('0x48')](_0xc5f0('0x49'))){_0x4f5b3e[_0xc5f0('0x2f')]=qs[_0xc5f0('0x2f')](_0xea6919[_0xc5f0('0x40')][_0xc5f0('0x2f')]);_0x4f5b3e[_0xc5f0('0x2d')]=qs[_0xc5f0('0x2d')](_0xea6919[_0xc5f0('0x40')][_0xc5f0('0x2d')]);}return _0x361ae1[_0xc5f0('0xea')](_0x4f5b3e);}})[_0xc5f0('0x1f')](function(_0x2eff1c){if(_0x2eff1c){return _0x2eff1c?{'count':_0x3f4883,'rows':_0x2eff1c}:null;}})[_0xc5f0('0x1f')](respondWithResult(_0x5ab224,null))['catch'](handleError(_0x5ab224,null));}; \ No newline at end of file +var _0x5664=['isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','skebby','from','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','ContactId','AttachmentId','UserId','User','*,*,*,*','SmsQueue','queueId','unshift','queue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','rows','to\x20is\x20mandatory','CmList','List','out','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','debug','message-id','state','addAgents','emit','removeAgents'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x5664,0xf2));var _0x4566=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x5664[_0x256b72];return _0x2183e3;};'use strict';var emlformat=require(_0x4566('0x0'));var rimraf=require(_0x4566('0x1'));var zipdir=require(_0x4566('0x2'));var jsonpatch=require(_0x4566('0x3'));var rp=require(_0x4566('0x4'));var moment=require(_0x4566('0x5'));var BPromise=require(_0x4566('0x6'));var Mustache=require('mustache');var util=require(_0x4566('0x7'));var path=require(_0x4566('0x8'));var sox=require(_0x4566('0x9'));var csv=require(_0x4566('0xa'));var ejs=require(_0x4566('0xb'));var fs=require('fs');var fs_extra=require(_0x4566('0xc'));var _=require(_0x4566('0xd'));var squel=require('squel');var crypto=require(_0x4566('0xe'));var jsforce=require(_0x4566('0xf'));var deskjs=require(_0x4566('0x10'));var toCsv=require(_0x4566('0xa'));var querystring=require(_0x4566('0x11'));var Papa=require(_0x4566('0x12'));var Redis=require(_0x4566('0x13'));var authService=require(_0x4566('0x14'));var qs=require(_0x4566('0x15'));var as=require(_0x4566('0x16'));var hardwareService=require(_0x4566('0x17'));var logger=require(_0x4566('0x18'))(_0x4566('0x19'));var utils=require(_0x4566('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x4566('0x1b'));var db=require(_0x4566('0x1c'))['db'];config[_0x4566('0x1d')]=_[_0x4566('0x1e')](config['redis'],{'host':_0x4566('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4566('0x1d')]));require(_0x4566('0x20'))[_0x4566('0x21')](socket);var jayson=require(_0x4566('0x22'));var client=jayson[_0x4566('0x23')][_0x4566('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x1aa53d,_0x3a9dc9,_0xbe72a3,_0x3ff076){return new BPromise(function(_0x16530f,_0x28019f){var _0x5e7c93=_0x3ff076||client;return _0x5e7c93[_0x4566('0x25')](_0x1aa53d,_0xbe72a3)[_0x4566('0x26')](function(_0x593a2a){logger[_0x4566('0x27')](_0x4566('0x28'),_0x3a9dc9,'request\x20sent');logger['debug'](_0x4566('0x29'),_0x3a9dc9,'request\x20sent',JSON[_0x4566('0x2a')](_0x593a2a));if(_0x593a2a[_0x4566('0x2b')]){if(_0x593a2a[_0x4566('0x2b')][_0x4566('0x2c')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3a9dc9,_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);return _0x28019f(_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);}logger['error'](_0x4566('0x28'),_0x3a9dc9,_0x593a2a[_0x4566('0x2b')][_0x4566('0x2d')]);return _0x16530f(_0x593a2a['error'][_0x4566('0x2d')]);}else{logger[_0x4566('0x27')](_0x4566('0x28'),_0x3a9dc9,_0x4566('0x2e'));_0x16530f(_0x593a2a['result'][_0x4566('0x2d')]);}})[_0x4566('0x2f')](function(_0x180274){logger['error'](_0x4566('0x28'),_0x3a9dc9,_0x180274);_0x28019f(_0x180274);});});}function respondWithStatusCode(_0x29ad08,_0x6dd3cb){_0x6dd3cb=_0x6dd3cb||0xcc;return function(_0xa8a03f){if(_0xa8a03f){return _0x29ad08['sendStatus'](_0x6dd3cb);}return _0x29ad08[_0x4566('0x30')](_0x6dd3cb)[_0x4566('0x31')]();};}function respondWithResult(_0x4ecd63,_0x1ee9ff){_0x1ee9ff=_0x1ee9ff||0xc8;return function(_0x1e19f2){if(_0x1e19f2){return _0x4ecd63['status'](_0x1ee9ff)[_0x4566('0x32')](_0x1e19f2);}};}function respondWithFilteredResult(_0x59a973,_0x48aeab){return function(_0x5abbe3){if(_0x5abbe3){var _0x3c99a8=typeof _0x48aeab['offset']===_0x4566('0x33')&&typeof _0x48aeab['limit']===_0x4566('0x33');var _0x5ab060=_0x5abbe3[_0x4566('0x34')];var _0x18bee8=_0x3c99a8?0x0:_0x48aeab['offset'];var _0x544196=_0x3c99a8?_0x5abbe3[_0x4566('0x34')]:_0x48aeab[_0x4566('0x35')]+_0x48aeab[_0x4566('0x36')];var _0x22e5ab;if(_0x544196>=_0x5ab060){_0x544196=_0x5ab060;_0x22e5ab=0xc8;}else{_0x22e5ab=0xce;}_0x59a973['status'](_0x22e5ab);return _0x59a973[_0x4566('0x37')](_0x4566('0x38'),_0x18bee8+'-'+_0x544196+'/'+_0x5ab060)[_0x4566('0x32')](_0x5abbe3);}return null;};}function patchUpdates(_0x8c9801){return function(_0x7c4e4b){try{jsonpatch[_0x4566('0x39')](_0x7c4e4b,_0x8c9801,!![]);}catch(_0x5c59b2){return BPromise[_0x4566('0x3a')](_0x5c59b2);}return _0x7c4e4b[_0x4566('0x3b')]();};}function saveUpdates(_0x3baf4f,_0x196087){return function(_0x50afc1){if(_0x50afc1){return _0x50afc1[_0x4566('0x3c')](_0x3baf4f)['then'](function(_0x5efe85){return _0x5efe85;});}return null;};}function removeEntity(_0x9feed6,_0x4f1ecd){return function(_0x382ebe){if(_0x382ebe){return _0x382ebe[_0x4566('0x3d')]()['then'](function(){var _0x255c96=_0x382ebe[_0x4566('0x3e')]({'plain':!![]});var _0x2fcb74=_0x4566('0x3f');return db['UserProfileResource'][_0x4566('0x3d')]({'where':{'type':_0x2fcb74,'resourceId':_0x255c96['id']}})[_0x4566('0x26')](function(){return _0x382ebe;});})[_0x4566('0x26')](function(){_0x9feed6['status'](0xcc)[_0x4566('0x31')]();});}};}function handleEntityNotFound(_0x576973,_0x330147){return function(_0x470ec1){if(!_0x470ec1){_0x576973[_0x4566('0x40')](0x194);}return _0x470ec1;};}function handleError(_0x4b716b,_0x1f4b7c){_0x1f4b7c=_0x1f4b7c||0x1f4;return function(_0x4ab088){logger[_0x4566('0x2b')](_0x4ab088[_0x4566('0x41')]);if(_0x4ab088['name']){delete _0x4ab088[_0x4566('0x42')];}_0x4b716b[_0x4566('0x30')](_0x1f4b7c)[_0x4566('0x43')](_0x4ab088);};}exports['index']=function(_0x26fae1,_0x46f458){var _0x432c84={'include':[{'model':db[_0x4566('0x44')],'as':_0x4566('0x45')}]},_0x4d13cb={},_0x1fd740={'count':0x0,'rows':[]};var _0x124f74=_[_0x4566('0x46')](db[_0x4566('0x47')][_0x4566('0x48')],function(_0x2a83ee){return{'name':_0x2a83ee[_0x4566('0x49')],'type':_0x2a83ee[_0x4566('0x4a')][_0x4566('0x4b')]};});_0x4d13cb[_0x4566('0x4c')]=_[_0x4566('0x46')](_0x124f74,_0x4566('0x42'));_0x4d13cb[_0x4566('0x4d')]=_['keys'](_0x26fae1[_0x4566('0x4d')]);_0x4d13cb['filters']=_['intersection'](_0x4d13cb[_0x4566('0x4c')],_0x4d13cb[_0x4566('0x4d')]);_0x432c84['attributes']=_[_0x4566('0x4e')](_0x4d13cb[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x26fae1[_0x4566('0x4d')]['fields']));_0x432c84[_0x4566('0x50')]=_0x432c84[_0x4566('0x50')][_0x4566('0x51')]?_0x432c84['attributes']:_0x4d13cb[_0x4566('0x4c')];if(!_0x26fae1[_0x4566('0x4d')]['hasOwnProperty']('nolimit')){_0x432c84[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x26fae1['query'][_0x4566('0x36')]);_0x432c84[_0x4566('0x35')]=qs[_0x4566('0x35')](_0x26fae1[_0x4566('0x4d')][_0x4566('0x35')]);}_0x432c84[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x26fae1[_0x4566('0x4d')]['sort']);_0x432c84[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x26fae1['query'],_0x4d13cb[_0x4566('0x55')]),_0x124f74);if(_0x26fae1['query'][_0x4566('0x57')]){_0x432c84[_0x4566('0x54')]=_[_0x4566('0x58')](_0x432c84[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x124f74,function(_0x539de6){if(_0x539de6['type']!=='VIRTUAL'){var _0x37edd5={};_0x37edd5[_0x539de6['name']]={'$like':'%'+_0x26fae1['query'][_0x4566('0x57')]+'%'};return _0x37edd5;}})});}_0x432c84=_['merge']({},_0x432c84,_0x26fae1[_0x4566('0x59')]);var _0x5e1b31={'where':_0x432c84[_0x4566('0x54')]};return db[_0x4566('0x47')][_0x4566('0x34')](_0x5e1b31)['then'](function(_0x15fada){_0x1fd740[_0x4566('0x34')]=_0x15fada;if(_0x26fae1[_0x4566('0x4d')][_0x4566('0x5a')]){_0x432c84['include']=[{'all':!![]}];}return db[_0x4566('0x47')][_0x4566('0x5b')](_0x432c84);})['then'](function(_0x4ab976){_0x1fd740['rows']=_0x4ab976;return _0x1fd740;})['then'](respondWithFilteredResult(_0x46f458,_0x432c84))[_0x4566('0x2f')](handleError(_0x46f458,null));};exports[_0x4566('0x5c')]=function(_0x3ee695,_0x36d44c){var _0x2c636a={'raw':![],'where':{'id':_0x3ee695[_0x4566('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x46902a={};_0x46902a[_0x4566('0x4c')]=_[_0x4566('0x5e')](db['SmsAccount']['rawAttributes']);_0x46902a['query']=_[_0x4566('0x5e')](_0x3ee695[_0x4566('0x4d')]);_0x46902a['filters']=_[_0x4566('0x4e')](_0x46902a[_0x4566('0x4c')],_0x46902a[_0x4566('0x4d')]);_0x2c636a['attributes']=_[_0x4566('0x4e')](_0x46902a[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x3ee695[_0x4566('0x4d')][_0x4566('0x4f')]));_0x2c636a[_0x4566('0x50')]=_0x2c636a['attributes'][_0x4566('0x51')]?_0x2c636a[_0x4566('0x50')]:_0x46902a['model'];if(_0x3ee695[_0x4566('0x4d')][_0x4566('0x5a')]){_0x2c636a['include']=[{'all':!![]}];}_0x2c636a=_[_0x4566('0x58')]({},_0x2c636a,_0x3ee695[_0x4566('0x59')]);return db[_0x4566('0x47')][_0x4566('0x5f')](_0x2c636a)['then'](handleEntityNotFound(_0x36d44c,null))[_0x4566('0x26')](respondWithResult(_0x36d44c,null))['catch'](handleError(_0x36d44c,null));};exports[_0x4566('0x60')]=function(_0x3256a8,_0x20f4be){return db[_0x4566('0x47')][_0x4566('0x60')](_0x3256a8[_0x4566('0x61')],{})[_0x4566('0x26')](function(_0x313d5c){var _0x4c40eb=_0x3256a8[_0x4566('0x62')][_0x4566('0x3e')]({'plain':!![]});if(!_0x4c40eb)throw new Error(_0x4566('0x63'));if(_0x4c40eb[_0x4566('0x64')]==='user'){var _0x2e4130=_0x313d5c[_0x4566('0x3e')]({'plain':!![]});var _0x794782=_0x4566('0x3f');return db[_0x4566('0x65')][_0x4566('0x5f')]({'where':{'name':_0x794782,'userProfileId':_0x4c40eb[_0x4566('0x66')]},'raw':!![]})[_0x4566('0x26')](function(_0x58a696){if(_0x58a696&&_0x58a696[_0x4566('0x67')]===0x0){return db['UserProfileResource'][_0x4566('0x60')]({'name':_0x2e4130[_0x4566('0x42')],'resourceId':_0x2e4130['id'],'type':_0x58a696[_0x4566('0x42')],'sectionId':_0x58a696['id']},{})[_0x4566('0x26')](function(){return _0x313d5c;});}else{return _0x313d5c;}})[_0x4566('0x2f')](function(_0x4eca3a){logger[_0x4566('0x2b')](_0x4566('0x68'),_0x4eca3a);throw _0x4eca3a;});}return _0x313d5c;})[_0x4566('0x26')](respondWithResult(_0x20f4be,0xc9))[_0x4566('0x2f')](handleError(_0x20f4be,null));};exports[_0x4566('0x3c')]=function(_0x135075,_0x48b53a){if(_0x135075[_0x4566('0x61')]['id']){delete _0x135075[_0x4566('0x61')]['id'];}return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x135075[_0x4566('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4566('0x26')](handleEntityNotFound(_0x48b53a,null))[_0x4566('0x26')](saveUpdates(_0x135075[_0x4566('0x61')],null))['then'](respondWithResult(_0x48b53a,null))[_0x4566('0x2f')](handleError(_0x48b53a,null));};exports[_0x4566('0x3d')]=function(_0x2bc3ba,_0x3a118b){return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x2bc3ba['params']['id']}})['then'](handleEntityNotFound(_0x3a118b,null))[_0x4566('0x26')](removeEntity(_0x3a118b,null))[_0x4566('0x2f')](handleError(_0x3a118b,null));};exports[_0x4566('0x69')]=function(_0x585dcc,_0x6707c0){return db[_0x4566('0x47')]['describe']()['then'](respondWithResult(_0x6707c0,null))['catch'](handleError(_0x6707c0,null));};exports[_0x4566('0x6a')]=function(_0x48cdc6,_0x52ca3f,_0x327e3f){if(_0x48cdc6[_0x4566('0x61')]['id']){delete _0x48cdc6[_0x4566('0x61')]['id'];}return db[_0x4566('0x47')]['find']({'where':{'id':_0x48cdc6[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52ca3f,null))[_0x4566('0x26')](function(_0x146635){if(_0x146635){_0x48cdc6[_0x4566('0x61')][_0x4566('0x6b')]=_0x146635['id'];return db[_0x4566('0x6c')]['create'](_0x48cdc6[_0x4566('0x61')]);}})[_0x4566('0x26')](respondWithResult(_0x52ca3f,null))[_0x4566('0x2f')](handleError(_0x52ca3f,null));};exports[_0x4566('0x6d')]=function(_0x5a3d46,_0x2aa623,_0x16032c){var _0x74528e={'raw':![],'where':{}};var _0xe69c33={};var _0x50268e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4566('0x6e')]({'where':{'id':_0x5a3d46[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x2aa623,null))[_0x4566('0x26')](function(_0x30f719){if(_0x30f719){_0xe69c33[_0x4566('0x4c')]=_[_0x4566('0x5e')](db['Disposition']['rawAttributes']);_0xe69c33[_0x4566('0x4d')]=_['keys'](_0x5a3d46[_0x4566('0x4d')]);_0xe69c33[_0x4566('0x55')]=_['intersection'](_0xe69c33[_0x4566('0x4c')],_0xe69c33['query']);_0x74528e['attributes']=_[_0x4566('0x4e')](_0xe69c33[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x4f')]));_0x74528e['attributes']=_0x74528e[_0x4566('0x50')]['length']?_0x74528e[_0x4566('0x50')]:_0xe69c33['model'];if(!_0x5a3d46[_0x4566('0x4d')][_0x4566('0x6f')]('nolimit')){_0x74528e[_0x4566('0x36')]=qs['limit'](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x36')]);_0x74528e[_0x4566('0x35')]=qs['offset'](_0x5a3d46[_0x4566('0x4d')][_0x4566('0x35')]);}_0x74528e[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x5a3d46['query'][_0x4566('0x53')]);_0x74528e[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x5a3d46[_0x4566('0x4d')],_0xe69c33['filters']));_0x74528e[_0x4566('0x54')][_0x4566('0x6b')]=_0x30f719['id'];if(_0x5a3d46['query'][_0x4566('0x57')]){_0x74528e[_0x4566('0x54')]=_[_0x4566('0x58')](_0x74528e['where'],{'$or':_[_0x4566('0x46')](_0x74528e['attributes'],function(_0x2cc598){var _0x6de8a8={};_0x6de8a8[_0x2cc598]={'$like':'%'+_0x5a3d46[_0x4566('0x4d')]['filter']+'%'};return _0x6de8a8;})});}_0x74528e=_['merge']({},_0x74528e,_0x5a3d46[_0x4566('0x59')]);return db['Disposition']['count']({'where':_0x74528e['where']})[_0x4566('0x26')](function(_0x398546){_0x50268e[_0x4566('0x34')]=_0x398546;if(_0x5a3d46[_0x4566('0x4d')][_0x4566('0x5a')]){_0x74528e[_0x4566('0x70')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x74528e);})[_0x4566('0x26')](function(_0x5877c3){_0x50268e['rows']=_0x5877c3;return _0x50268e;});}})[_0x4566('0x26')](respondWithFilteredResult(_0x2aa623,_0x74528e))[_0x4566('0x2f')](handleError(_0x2aa623,null));};exports[_0x4566('0x71')]=function(_0x3c338c,_0x2d55dc,_0x568e95){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x3c338c['params']['id']}})['then'](handleEntityNotFound(_0x2d55dc,null))[_0x4566('0x26')](function(_0xa9092e){if(_0xa9092e){return _0xa9092e[_0x4566('0x71')](_0x3c338c['query'][_0x4566('0x72')]);}})[_0x4566('0x26')](respondWithStatusCode(_0x2d55dc,null))[_0x4566('0x2f')](handleError(_0x2d55dc,null));};exports[_0x4566('0x73')]=function(_0x5dd3da,_0x1bf768,_0x4959d6){if(_0x5dd3da['body']['id']){delete _0x5dd3da[_0x4566('0x61')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5dd3da[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x1bf768,null))[_0x4566('0x26')](function(_0x350ee1){if(_0x350ee1){_0x5dd3da[_0x4566('0x61')]['SmsAccountId']=_0x350ee1['id'];return db[_0x4566('0x74')]['create'](_0x5dd3da[_0x4566('0x61')]);}})[_0x4566('0x26')](respondWithResult(_0x1bf768,null))[_0x4566('0x2f')](handleError(_0x1bf768,null));};exports[_0x4566('0x75')]=function(_0x15a382,_0xd0783c,_0x5d50fb){var _0x39e349={'raw':![],'where':{}};var _0xab00e9={};var _0x4dd750={'count':0x0,'rows':[]};return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x15a382[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0xd0783c,null))[_0x4566('0x26')](function(_0x18d973){if(_0x18d973){_0xab00e9['model']=_[_0x4566('0x5e')](db['CannedAnswer'][_0x4566('0x48')]);_0xab00e9[_0x4566('0x4d')]=_['keys'](_0x15a382[_0x4566('0x4d')]);_0xab00e9[_0x4566('0x55')]=_[_0x4566('0x4e')](_0xab00e9[_0x4566('0x4c')],_0xab00e9[_0x4566('0x4d')]);_0x39e349['attributes']=_['intersection'](_0xab00e9[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x15a382[_0x4566('0x4d')][_0x4566('0x4f')]));_0x39e349[_0x4566('0x50')]=_0x39e349['attributes'][_0x4566('0x51')]?_0x39e349[_0x4566('0x50')]:_0xab00e9[_0x4566('0x4c')];if(!_0x15a382[_0x4566('0x4d')][_0x4566('0x6f')]('nolimit')){_0x39e349[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x15a382[_0x4566('0x4d')][_0x4566('0x36')]);_0x39e349[_0x4566('0x35')]=qs[_0x4566('0x35')](_0x15a382['query'][_0x4566('0x35')]);}_0x39e349[_0x4566('0x52')]=qs['sort'](_0x15a382['query']['sort']);_0x39e349['where']=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x15a382[_0x4566('0x4d')],_0xab00e9[_0x4566('0x55')]));_0x39e349['where'][_0x4566('0x6b')]=_0x18d973['id'];if(_0x15a382[_0x4566('0x4d')][_0x4566('0x57')]){_0x39e349[_0x4566('0x54')]=_['merge'](_0x39e349['where'],{'$or':_['map'](_0x39e349[_0x4566('0x50')],function(_0x4d6271){var _0x26e059={};_0x26e059[_0x4d6271]={'$like':'%'+_0x15a382['query'][_0x4566('0x57')]+'%'};return _0x26e059;})});}_0x39e349=_['merge']({},_0x39e349,_0x15a382[_0x4566('0x59')]);return db[_0x4566('0x74')][_0x4566('0x34')]({'where':_0x39e349['where']})[_0x4566('0x26')](function(_0x1e1749){_0x4dd750[_0x4566('0x34')]=_0x1e1749;if(_0x15a382[_0x4566('0x4d')]['includeAll']){_0x39e349[_0x4566('0x70')]=[{'all':!![]}];}return db[_0x4566('0x74')]['findAll'](_0x39e349);})[_0x4566('0x26')](function(_0x105c04){_0x4dd750['rows']=_0x105c04;return _0x4dd750;});}})[_0x4566('0x26')](respondWithFilteredResult(_0xd0783c,_0x39e349))[_0x4566('0x2f')](handleError(_0xd0783c,null));};exports[_0x4566('0x76')]=function(_0x22267a,_0x377cf5,_0x59c724){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x22267a['params']['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x377cf5,null))[_0x4566('0x26')](function(_0x2ed17f){if(_0x2ed17f){return _0x2ed17f[_0x4566('0x76')](_0x22267a[_0x4566('0x4d')][_0x4566('0x72')]);}})['then'](respondWithStatusCode(_0x377cf5,null))['catch'](handleError(_0x377cf5,null));};exports[_0x4566('0x77')]=function(_0x16eb8e,_0x5e558e,_0x310433){var _0x9ae8e1={'channel':_0x4566('0x78')};var _0x454690=[];var _0x376511=[];var _0xdae6c={};return db[_0x4566('0x47')][_0x4566('0x5f')]({'where':{'id':_0x16eb8e[_0x4566('0x5d')]['id']},'include':[{'model':db[_0x4566('0x79')],'as':_0x4566('0x7a')}]})[_0x4566('0x26')](handleEntityNotFound(_0x5e558e,null))[_0x4566('0x26')](function(_0x48bedf){_0x9ae8e1[_0x4566('0x7b')]=_0x48bedf;_0x9ae8e1[_0x4566('0x7c')]=_[_0x4566('0x7d')](_0x48bedf['Applications'],[_0x4566('0x7e')],[_0x4566('0x7f')]);if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x7a')]){delete _0x9ae8e1[_0x4566('0x7b')]['Applications'];}return db[_0x4566('0x80')][_0x4566('0x69')]();})[_0x4566('0x26')](function(_0x2626b6){if(!_0x2626b6){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))]('no\x20available\x20attributes');}_0x454690=_[_0x4566('0x83')](_['keys'](_0x2626b6),[_0x4566('0x84'),_0x4566('0x85')]);_0x376511=_[_0x4566('0x83')](_[_0x4566('0x5e')](_0x2626b6),[_0x4566('0x84'),'updatedAt',_0x4566('0x86'),_0x4566('0x87')]);_0x9ae8e1['body']={'mapKey':_0x4566('0x88')};if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x4a')]){switch(_0x9ae8e1['account']['type']){case _0x4566('0x89'):_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')]['From'];_0x9ae8e1[_0x4566('0x61')]['body']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8a')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')]['MessageSid'];break;case _0x4566('0x8c'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]='+'+_0x16eb8e[_0x4566('0x61')]['sender'];_0x9ae8e1[_0x4566('0x61')]['body']=_0x16eb8e['body']['text'];break;case _0x4566('0x8e'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8d')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x2d')];break;case _0x4566('0x8f'):_0x9ae8e1['body']['from']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x8d')];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')]['body'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x90')];break;case'plivo':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e['body']['From'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x91')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x92')];break;case _0x4566('0x93'):_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]='+'+_0x16eb8e['body']['results'][0x0][_0x4566('0x8d')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x94')][0x0][_0x4566('0x95')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e['body'][_0x4566('0x94')][0x0]['messageId'];break;case _0x4566('0x96'):_0x9ae8e1['body']['from']=_0x16eb8e[_0x4566('0x61')]['originatingAddress'];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e['body'][_0x4566('0x97')]['message'];break;case _0x4566('0x98'):_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')][_0x4566('0x99')];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]=_0x16eb8e['body']['text'];_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')]=_0x16eb8e['body']['replyMessageId'];break;case _0x4566('0x9a'):_0x9ae8e1[_0x4566('0x61')]['messageId']=_0x16eb8e['body'][0x0][_0x4566('0x2d')]['id'];_0x9ae8e1[_0x4566('0x61')]['from']=_0x16eb8e[_0x4566('0x61')][0x0]['message'][_0x4566('0x8d')];_0x9ae8e1['body']['body']=_0x16eb8e['body'][0x0][_0x4566('0x2d')]['text'];break;case'intelepeer':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')]=_0x16eb8e['body'][_0x4566('0x8d')];_0x9ae8e1['body'][_0x4566('0x61')]=_0x16eb8e[_0x4566('0x61')][_0x4566('0x2d')];_0x9ae8e1['body'][_0x4566('0x8b')]=_0x16eb8e['body'][_0x4566('0x9b')];break;}}if(_0x9ae8e1[_0x4566('0x61')]['id']){delete _0x9ae8e1[_0x4566('0x61')]['id'];}if(_[_0x4566('0x9c')](_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')])){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0x9d'));}if(_[_0x4566('0x9c')](_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')])||_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')]===''){throw new db[(_0x4566('0x81'))]['ValidationError'](_0x4566('0x9e'));}if(_[_0x4566('0x9c')](_0x9ae8e1['body'][_0x4566('0x9f')])){throw new db[(_0x4566('0x81'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x376511);}if(!_[_0x4566('0xa0')](_0x376511,_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')])){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0xa1')+_0x376511);}_0xdae6c[_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')]]=_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8d')];return db['CmList'][_0x4566('0x5f')]({'where':{'id':_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x87')]},'include':[{'model':db[_0x4566('0x80')],'as':'Contacts','where':_0xdae6c,'limit':0x1,'order':[[_0x4566('0x85'),_0x4566('0xa2')]]}]});})['then'](handleEntityNotFound(_0x5e558e,null))['then'](function(_0x38a55f){if(_0x38a55f){_0x9ae8e1[_0x4566('0xa3')]=_[_0x4566('0xa4')](_0x38a55f,['Contacts']);if(_0x38a55f[_0x4566('0xa5')][_0x4566('0x51')]){return _0x38a55f[_0x4566('0xa5')][0x0];}var _0x46af32=_[_0x4566('0x1e')](_0x9ae8e1[_0x4566('0x61')],{'firstName':_0x9ae8e1[_0x4566('0x61')]['from'],'ListId':_0x38a55f['id']});_0x46af32[_0x9ae8e1[_0x4566('0x61')][_0x4566('0x9f')]]=_0x9ae8e1['body'][_0x4566('0x8d')];return db[_0x4566('0x80')][_0x4566('0x60')](_0x46af32,{'fields':_0x454690,'raw':!![]});}})[_0x4566('0x26')](handleEntityNotFound(_0x5e558e,null))[_0x4566('0x26')](function(_0x152cff){if(_0x152cff){_0x9ae8e1[_0x4566('0xa6')]=_0x152cff;var _0x390096={'ContactId':_0x152cff['id'],'phone':_0x9ae8e1[_0x4566('0x61')]['from'],'SmsAccountId':_0x16eb8e['params']['id']};var _0x3a6843={'ContactId':_0x152cff['id'],'SmsAccountId':_0x16eb8e[_0x4566('0x5d')]['id'],'closed':![]};return db[_0x4566('0xa7')]['find']({'where':_0x3a6843})[_0x4566('0x26')](function(_0xe39340){if(_0xe39340){return[_0xe39340,![]];}return db['SmsInteraction'][_0x4566('0x60')](_0x390096)['then'](function(_0x5b88c3){return[_0x5b88c3,!![]];});});}})[_0x4566('0xa8')](function(_0x49b70f,_0x4de2b2){_0x9ae8e1[_0x4566('0xa9')]=_0x49b70f[_0x4566('0x3e')]({'plain':!![]});_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xaa')]=![];if(_0x4de2b2){if(_0x9ae8e1['account'][_0x4566('0xab')]){_0x9ae8e1[_0x4566('0x7c')]['push']({'id':0x0,'priority':_0x9ae8e1['applications'][_0x4566('0x51')]+0x1,'app':_0x4566('0xac'),'appdata':_0x4566('0xad'),'interval':'*,*,*,*'});}_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xaa')]=!![];}return db['SmsMessage'][_0x4566('0x60')]({'phone':_0x9ae8e1['body'][_0x4566('0x8d')],'messageId':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x8b')],'body':_0x9ae8e1[_0x4566('0x61')][_0x4566('0x61')],'SmsAccountId':_0x16eb8e[_0x4566('0x5d')]['id'],'SmsInteractionId':_0x49b70f['id'],'direction':'in','ContactId':_0x49b70f[_0x4566('0xae')],'AttachmentId':_0x9ae8e1[_0x4566('0x61')][_0x4566('0xaf')]});})[_0x4566('0x26')](function(_0x104a67){_0x9ae8e1['message']=_0x104a67;if(!_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb0')])return;return db[_0x4566('0xb1')][_0x4566('0x5f')]({'attributes':['id',_0x4566('0x42')],'where':{'id':_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb0')]}});})[_0x4566('0x26')](function(_0x136451){if(_0x136451){_0x9ae8e1[_0x4566('0x7c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x136451['name']+','+(_0x9ae8e1[_0x4566('0x7b')]['waitForTheAssignedAgent']||0xa),'interval':_0x4566('0xb2')});}if(!_0x9ae8e1[_0x4566('0xa9')]['queueId'])return;return db[_0x4566('0xb3')][_0x4566('0x5f')]({'attributes':['id','name'],'where':{'id':_0x9ae8e1[_0x4566('0xa9')][_0x4566('0xb4')]}});})[_0x4566('0x26')](function(_0x4bcff7){if(_0x4bcff7){_0x9ae8e1[_0x4566('0x7c')][_0x4566('0xb5')]({'id':0x0,'priority':0x1,'app':_0x4566('0xb6'),'appdata':_0x4bcff7['name']+','+(_0x9ae8e1['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4566('0xb7'),'startRouting',_0x9ae8e1);})['then'](function(_0x27bedd){if(_0x27bedd){var _0x52e601=0xc8;var _0x1905d4=_0x4566('0xb8');logger[_0x4566('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1905d4,_0x52e601,_0x4566('0xb9'));logger['debug'](_0x4566('0xba'),_0x1905d4,_0x52e601,_0x4566('0xb9'),JSON[_0x4566('0x2a')](_0x27bedd));if(_0x9ae8e1[_0x4566('0x7b')][_0x4566('0x4a')]===_0x4566('0x89')){return _0x5e558e['status'](_0x52e601)[_0x4566('0x37')](_0x4566('0xbb'),_0x4566('0xbc'))[_0x4566('0x43')]('\x0a');}else{return _0x5e558e[_0x4566('0x30')](_0x52e601)[_0x4566('0x32')](_0x27bedd);}}})[_0x4566('0x2f')](handleError(_0x5e558e,null));};exports['addApplications']=function(_0x192e8a,_0x233f47){var _0x20b0f2=_0x192e8a[_0x4566('0x5d')]['id'];var _0x1f50be=_0x192e8a[_0x4566('0x61')];var _0x4b9dca=0xc8;var _0x21f96c=null;return db['sequelize'][_0x4566('0xbd')]({'isolationLevel':db[_0x4566('0xbe')]['Transaction'][_0x4566('0xbf')][_0x4566('0xc0')]},function(_0x2d36ea){return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x20b0f2},'transaction':_0x2d36ea})['then'](function(_0x3a3e1d){if(_0x3a3e1d){return db['SmsApplication'][_0x4566('0x3d')]({'where':{'SmsAccountId':_0x20b0f2},'transaction':_0x2d36ea})['then'](function(){var _0x59fb85=_[_0x4566('0x46')](_0x1f50be,function(_0x15c95c){_0x15c95c[_0x4566('0x6b')]=_0x20b0f2;return _0x15c95c;});return db[_0x4566('0x79')][_0x4566('0xc1')](_0x59fb85,{'transaction':_0x2d36ea});});}else{_0x4b9dca=0x194;_0x21f96c=[];}});})[_0x4566('0x26')](function(){if(_0x4b9dca!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x20b0f2},'order':_0x4566('0x7e')})[_0x4566('0x26')](function(_0xd25cff){_0x21f96c=_0xd25cff;});}})[_0x4566('0x2f')](function(_0x5aaae9){_0x4b9dca=0x1f4;logger[_0x4566('0x2b')](_0x5aaae9[_0x4566('0x41')]);if(_0x5aaae9[_0x4566('0x42')]){delete _0x5aaae9[_0x4566('0x42')];}_0x21f96c=_0x5aaae9;})[_0x4566('0xc2')](function(){if(_0x21f96c===null){_0x233f47[_0x4566('0x40')](_0x4b9dca);}else{if(_0x4b9dca===0x1f4){_0x233f47[_0x4566('0x30')](_0x4b9dca)['send'](_0x21f96c);}else{_0x233f47[_0x4566('0x30')](_0x4b9dca)[_0x4566('0x32')](_0x21f96c);}}});};exports[_0x4566('0xc3')]=function(_0x280882,_0x5bedbd,_0x2364f7){var _0x1d0f75={};var _0x4b36f4={};var _0x510f36;var _0x310fce;return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x280882[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x5bedbd,null))[_0x4566('0x26')](function(_0x17de7e){if(_0x17de7e){_0x510f36=_0x17de7e;_0x4b36f4[_0x4566('0x4c')]=_['keys'](db['SmsApplication'][_0x4566('0x48')]);_0x4b36f4[_0x4566('0x4d')]=_['keys'](_0x280882[_0x4566('0x4d')]);_0x4b36f4[_0x4566('0x55')]=_[_0x4566('0x4e')](_0x4b36f4[_0x4566('0x4c')],_0x4b36f4[_0x4566('0x4d')]);_0x1d0f75[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x4b36f4['model'],qs[_0x4566('0x4f')](_0x280882[_0x4566('0x4d')][_0x4566('0x4f')]));_0x1d0f75[_0x4566('0x50')]=_0x1d0f75[_0x4566('0x50')][_0x4566('0x51')]?_0x1d0f75['attributes']:_0x4b36f4['model'];_0x1d0f75[_0x4566('0x52')]=qs['sort'](_0x280882[_0x4566('0x4d')][_0x4566('0x53')]);_0x1d0f75[_0x4566('0x54')]=qs[_0x4566('0x55')](_[_0x4566('0x56')](_0x280882[_0x4566('0x4d')],_0x4b36f4[_0x4566('0x55')]));if(_0x280882['query'][_0x4566('0x57')]){_0x1d0f75[_0x4566('0x54')]=_[_0x4566('0x58')](_0x1d0f75[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x1d0f75[_0x4566('0x50')],function(_0xc74ba4){var _0x2e39bf={};_0x2e39bf[_0xc74ba4]={'$like':'%'+_0x280882[_0x4566('0x4d')][_0x4566('0x57')]+'%'};return _0x2e39bf;})});}_0x1d0f75=_[_0x4566('0x58')]({},_0x1d0f75,_0x280882[_0x4566('0x59')]);return _0x510f36[_0x4566('0xc3')](_0x1d0f75);}})[_0x4566('0x26')](function(_0x5cb790){if(_0x5cb790){_0x310fce=_0x5cb790[_0x4566('0x51')];if(!_0x280882[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x1d0f75[_0x4566('0x36')]=qs['limit'](_0x280882[_0x4566('0x4d')]['limit']);_0x1d0f75['offset']=qs[_0x4566('0x35')](_0x280882[_0x4566('0x4d')][_0x4566('0x35')]);}return _0x510f36[_0x4566('0xc3')](_0x1d0f75);}})[_0x4566('0x26')](function(_0x35d8b6){if(_0x35d8b6){return _0x35d8b6?{'count':_0x310fce,'rows':_0x35d8b6}:null;}})['then'](respondWithResult(_0x5bedbd,null))[_0x4566('0x2f')](handleError(_0x5bedbd,null));};exports[_0x4566('0xc5')]=function(_0x5624e4,_0x5bf9b9,_0x5ee369){var _0x2c2f0b={'raw':![],'where':{}};var _0x5030d8={};var _0x1f2bf1={'count':0x0,'rows':[]};return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0x5624e4[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x5bf9b9,null))[_0x4566('0x26')](function(_0x5c1ca7){if(_0x5c1ca7){_0x5030d8[_0x4566('0x4c')]=_[_0x4566('0x5e')](db[_0x4566('0xa7')][_0x4566('0x48')]);_0x5030d8[_0x4566('0x4d')]=_[_0x4566('0x5e')](_0x5624e4[_0x4566('0x4d')]);_0x5030d8[_0x4566('0x55')]=_[_0x4566('0x4e')](_0x5030d8[_0x4566('0x4c')],_0x5030d8['query']);_0x2c2f0b[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x5030d8[_0x4566('0x4c')],qs[_0x4566('0x4f')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x4f')]));_0x2c2f0b['attributes']=_0x2c2f0b[_0x4566('0x50')][_0x4566('0x51')]?_0x2c2f0b[_0x4566('0x50')]:_0x5030d8[_0x4566('0x4c')];if(!_0x5624e4[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x2c2f0b[_0x4566('0x36')]=qs[_0x4566('0x36')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x36')]);_0x2c2f0b['offset']=qs[_0x4566('0x35')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x35')]);}_0x2c2f0b[_0x4566('0x52')]=qs[_0x4566('0x53')](_0x5624e4[_0x4566('0x4d')][_0x4566('0x53')]);_0x2c2f0b['where']=qs['filters'](_[_0x4566('0x56')](_0x5624e4[_0x4566('0x4d')],_0x5030d8[_0x4566('0x55')]));_0x2c2f0b[_0x4566('0x54')][_0x4566('0x6b')]=_0x5c1ca7['id'];if(_0x5624e4[_0x4566('0x4d')][_0x4566('0x57')]){_0x2c2f0b['where']=_[_0x4566('0x58')](_0x2c2f0b[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x2c2f0b['attributes'],function(_0x353b93){var _0x2e3ada={};_0x2e3ada[_0x353b93]={'$like':'%'+_0x5624e4['query']['filter']+'%'};return _0x2e3ada;})});}_0x2c2f0b=_[_0x4566('0x58')]({},_0x2c2f0b,_0x5624e4[_0x4566('0x59')]);return db[_0x4566('0xa7')]['count']({'where':_0x2c2f0b['where']})[_0x4566('0x26')](function(_0x2ada38){_0x1f2bf1[_0x4566('0x34')]=_0x2ada38;if(_0x5624e4[_0x4566('0x4d')][_0x4566('0x5a')]){_0x2c2f0b[_0x4566('0x70')]=[{'model':db['CmContact'],'as':_0x4566('0xc6'),'required':![]},{'model':db[_0x4566('0xb1')],'as':_0x4566('0xc7'),'attributes':[_0x4566('0x42'),_0x4566('0xc8'),_0x4566('0xc9')],'required':![]},{'model':db[_0x4566('0xca')],'as':_0x4566('0xcb'),'attributes':['id',_0x4566('0x42'),_0x4566('0xcc')],'where':_0x5624e4[_0x4566('0x4d')]['tag']?{'id':_0x5624e4[_0x4566('0x4d')][_0x4566('0xcd')]}:undefined,'required':_0x5624e4[_0x4566('0x4d')][_0x4566('0xcd')]?!![]:![]}];}return db[_0x4566('0xa7')][_0x4566('0x5b')](_0x2c2f0b);})[_0x4566('0x26')](function(_0x45f983){_0x1f2bf1[_0x4566('0xce')]=_0x45f983;return _0x1f2bf1;});}})['then'](respondWithFilteredResult(_0x5bf9b9,_0x2c2f0b))[_0x4566('0x2f')](handleError(_0x5bf9b9,null));};exports[_0x4566('0x43')]=function(_0x535112,_0x1f8018,_0xffdcc){var _0x24f876,_0x2cb483,_0x439c76;if(_[_0x4566('0x9c')](_0x535112['body'][_0x4566('0x61')])||_0x535112[_0x4566('0x61')]['body']===''){throw new db[(_0x4566('0x81'))][(_0x4566('0x82'))](_0x4566('0x9e'));}if(_[_0x4566('0x9c')](_0x535112['body']['to'])){throw new db['Sequelize'][(_0x4566('0x82'))](_0x4566('0xcf'));}_0x24f876=_0x535112['body']['to'];return db[_0x4566('0x47')]['find']({'where':{'id':_0x535112[_0x4566('0x5d')]['id']},'include':[{'model':db[_0x4566('0xd0')],'as':'List','include':[{'model':db[_0x4566('0x80')],'as':'Contacts','where':{'mobile':_0x24f876},'limit':0x1,'order':[[_0x4566('0x85'),_0x4566('0xa2')]]}]}]})[_0x4566('0x26')](handleEntityNotFound(_0x1f8018,null))['then'](function(_0x14a70b){if(_0x14a70b&&_0x14a70b[_0x4566('0xd1')]){_0x2cb483=_0x14a70b[_0x4566('0x3e')]({'plain':!![]});if(_0x2cb483['List']&&_0x2cb483['List'][_0x4566('0xa5')]['length']){return _0x2cb483[_0x4566('0xd1')]['Contacts'][0x0];}return db['CmContact'][_0x4566('0x60')](_[_0x4566('0x1e')](_0x535112[_0x4566('0x61')],{'firstName':_0x24f876,'mobile':_0x24f876,'phone':_0x24f876,'ListId':_0x2cb483[_0x4566('0x87')]}));}})[_0x4566('0x26')](handleEntityNotFound(_0x1f8018,null))[_0x4566('0x26')](function(_0x5840f8){if(_0x5840f8){_0x439c76=_0x5840f8;return db[_0x4566('0xa7')][_0x4566('0x5f')]({'where':{'ContactId':_0x439c76['id'],'closed':![],'SmsAccountId':_0x2cb483['id']}})[_0x4566('0x26')](function(_0x2e7259){if(_0x2e7259){return[_0x2e7259,![]];}return db['SmsInteraction']['create']({'UserId':_0x535112['user']['id'],'ContactId':_0x439c76['id'],'SmsAccountId':_0x2cb483['id'],'phone':_0x24f876,'firstMsgDirection':_0x4566('0xd2'),'Messages':[_[_0x4566('0x58')](_0x535112[_0x4566('0x61')],{'read':![],'body':_0x535112[_0x4566('0x61')][_0x4566('0x61')],'phone':_0x24f876,'SmsAccountId':_0x2cb483['id'],'UserId':_0x535112[_0x4566('0x62')]['id'],'ContactId':_0x439c76['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x4566('0x26')](function(_0x36e2d0){return[_0x36e2d0,!![]];});});}})[_0x4566('0xa8')](function(_0x3ca256,_0x1de59a){if(_0x1de59a){return _0x3ca256;}return db[_0x4566('0xd3')]['create'](_[_0x4566('0x58')](_0x535112[_0x4566('0x61')],{'read':![],'body':_0x535112[_0x4566('0x61')][_0x4566('0x61')],'phone':_0x24f876,'SmsAccountId':_0x2cb483['id'],'SmsInteractionId':_0x3ca256['id'],'UserId':_0x535112[_0x4566('0x62')]['id'],'ContactId':_0x439c76['id']}))[_0x4566('0x26')](function(_0x37bd9c){_0x3ca256[_0x4566('0xd4')][_0x4566('0xd5')]=[];_0x3ca256['dataValues'][_0x4566('0xd5')]['push'](_0x37bd9c[_0x4566('0xd4')]);return _0x3ca256;});})[_0x4566('0x26')](respondWithResult(_0x1f8018,null))[_0x4566('0x2f')](handleError(_0x1f8018,null));};exports[_0x4566('0x30')]=function(_0x3614fe,_0x5acf63,_0xf4ca85){if(_0x3614fe['body']['id']){delete _0x3614fe[_0x4566('0x61')]['id'];}var _0x4e0d9c,_0x14f36f,_0x265328;return db[_0x4566('0x47')]['find']({'where':{'id':_0x3614fe[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5acf63,null))['then'](function(_0x4185c5){if(_0x4185c5){_0x265328=_0x4185c5;logger['debug'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xd6'),_0x4185c5[_0x4566('0x4a')],util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));switch(_0x4185c5[_0x4566('0x4a')]){case _0x4566('0x8c'):if(_0x3614fe['body'][_0x4566('0xd8')]&&_0x3614fe[_0x4566('0x61')]['status']){_0x14f36f=_0x3614fe[_0x4566('0x61')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x3614fe[_0x4566('0x61')][_0x4566('0xd8')]}});}break;case _0x4566('0x8e'):if(_0x3614fe[_0x4566('0x61')]['requestid']&&_0x3614fe[_0x4566('0x61')][_0x4566('0xd9')]){_0x14f36f=_0x3614fe[_0x4566('0x61')][_0x4566('0xd9')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')][_0x4566('0xda')]}});}break;case _0x4566('0x8f'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0x90')]&&_0x3614fe[_0x4566('0x61')][_0x4566('0xdb')]){_0x14f36f=_0x3614fe[_0x4566('0x61')][_0x4566('0xdb')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')]['message_id']}});}break;case'infobip':var _0x21ed97=_0x3614fe[_0x4566('0x61')][_0x4566('0x94')][0x0];if(_0x21ed97[_0x4566('0x8b')]&&_0x21ed97['status'][_0x4566('0xdc')]===_0x4566('0xdd')){_0x14f36f=_0x21ed97[_0x4566('0x30')][_0x4566('0xdc')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x21ed97[_0x4566('0x8b')]}});}break;case _0x4566('0x98'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0x8b')]&&_0x3614fe['body'][_0x4566('0x30')]){_0x14f36f=_0x3614fe['body'][_0x4566('0x30')];return db[_0x4566('0xd3')]['find']({'where':{'messageId':_0x3614fe[_0x4566('0x61')]['messageId']}});}break;case _0x4566('0x9a'):if(_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x2d')]['id']){_0x14f36f=_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x4a')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe[_0x4566('0x61')][0x0][_0x4566('0x2d')]['id']}});}break;case _0x4566('0xde'):if(_0x3614fe[_0x4566('0x61')][_0x4566('0xdf')]&&_0x3614fe[_0x4566('0x61')][_0x4566('0x30')]){_0x14f36f=_0x3614fe['body'][_0x4566('0x30')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x3614fe['body'][_0x4566('0xdf')]}});}break;}}})[_0x4566('0x26')](handleEntityNotFound(_0x5acf63,null))[_0x4566('0x26')](function(_0x8817cf){if(_0x8817cf){_0x4e0d9c=_0x8817cf;switch(_0x265328[_0x4566('0x4a')]){case _0x4566('0x8c'):if(_0x14f36f===_0x4566('0xdd')){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0x8c'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x8e'):if(_0x14f36f==='1'){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),'skebby',util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x8f'):if(!_0x3614fe['body'][_0x4566('0xe0')]&&_0x14f36f>=0xc8&&_0x14f36f<=0xce){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0x8f'),util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1cea1f=_0x3614fe[_0x4566('0x61')][_0x4566('0x94')][0x0];if(_0x1cea1f[_0x4566('0x30')][_0x4566('0xdc')]==='DELIVERED'){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger[_0x4566('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4566('0x30'),_0x4566('0x93'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x98'):if(_0x14f36f==_0x4566('0xe1')||_0x14f36f==_0x4566('0xe2')){return _0x4e0d9c[_0x4566('0x3c')]({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),'status',_0x4566('0x98'),util['inspect'](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0x9a'):if(_0x14f36f==_0x4566('0xe3')){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),'bandwidth',util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;case _0x4566('0xde'):if(_0x14f36f===_0x4566('0xe4')||_0x14f36f===_0x4566('0xe5')){return _0x4e0d9c['update']({'read':!![]});}else{logger[_0x4566('0x2b')](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xde'),util[_0x4566('0xd7')](_0x3614fe[_0x4566('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x4e0d9c;}})[_0x4566('0x26')](respondWithResult(_0x5acf63,null))[_0x4566('0x2f')](handleError(_0x5acf63,null));};exports['statusGet']=function(_0x342a13,_0x205371,_0x217cd3){var _0x4575ad,_0x6a40c2,_0xc5d993;return db[_0x4566('0x47')]['find']({'where':{'id':_0x342a13[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x205371,null))[_0x4566('0x26')](function(_0x12d1c5){if(_0x12d1c5){_0xc5d993=_0x12d1c5;logger[_0x4566('0xe6')](_0x4566('0x29'),_0x4566('0x30'),_0x4566('0xd6'),_0x12d1c5[_0x4566('0x4a')],util[_0x4566('0xd7')](_0x342a13[_0x4566('0x4d')],{'showHidden':![],'depth':null}));switch(_0x12d1c5[_0x4566('0x4a')]){case _0x4566('0x96'):if(_0x342a13[_0x4566('0x4d')][_0x4566('0xe7')]&&_0x342a13[_0x4566('0x4d')][_0x4566('0xe8')]){_0x6a40c2=_0x342a13[_0x4566('0x4d')][_0x4566('0xe8')];return db[_0x4566('0xd3')][_0x4566('0x5f')]({'where':{'messageId':_0x342a13['query'][_0x4566('0xe7')]}});}break;}}})[_0x4566('0x26')](handleEntityNotFound(_0x205371,null))[_0x4566('0x26')](function(_0x54c496){if(_0x54c496){_0x4575ad=_0x54c496;switch(_0xc5d993[_0x4566('0x4a')]){case'csc':if(_0x6a40c2==='2'||_0x6a40c2==='6'){return _0x4575ad[_0x4566('0x3c')]({'read':!![]});}else{logger['error'](_0x4566('0x29'),'status','csc',util[_0x4566('0xd7')](_0x342a13[_0x4566('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x4575ad;}})[_0x4566('0x26')](respondWithResult(_0x205371,null))[_0x4566('0x2f')](handleError(_0x205371,null));};exports[_0x4566('0xe9')]=function(_0x29efb2,_0x3203b4,_0x2d49ae){return db['SmsAccount'][_0x4566('0x5f')]({'where':{'id':_0x29efb2[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3203b4,null))[_0x4566('0x26')](function(_0x249a2c){if(_0x249a2c){return _0x249a2c['addAgents'](_0x29efb2[_0x4566('0x61')][_0x4566('0x72')],_[_0x4566('0xa4')](_0x29efb2[_0x4566('0x61')],['ids','id'])||{})['spread'](function(_0x417fb9){for(var _0x413cec=0x0;_0x413cec<_0x29efb2[_0x4566('0x61')][_0x4566('0x72')][_0x4566('0x51')];_0x413cec+=0x1){socket[_0x4566('0xea')]('userSmsAccount:save',{'UserId':Number(_0x29efb2[_0x4566('0x61')][_0x4566('0x72')][_0x413cec]),'SmsAccountId':Number(_0x29efb2[_0x4566('0x5d')]['id'])});}return _0x417fb9;});}})['then'](respondWithResult(_0x3203b4,null))[_0x4566('0x2f')](handleError(_0x3203b4,null));};exports['removeAgents']=function(_0x323b6e,_0x26260f,_0x51a258){return db[_0x4566('0x47')]['find']({'where':{'id':_0x323b6e[_0x4566('0x5d')]['id']}})[_0x4566('0x26')](handleEntityNotFound(_0x26260f,null))[_0x4566('0x26')](function(_0x17d375){if(_0x17d375){return _0x17d375[_0x4566('0xeb')](_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')])[_0x4566('0x26')](function(){if(_[_0x4566('0xec')](_0x323b6e['query'][_0x4566('0x72')])){for(var _0x5ba176=0x0;_0x5ba176<_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')][_0x4566('0x51')];_0x5ba176+=0x1){socket[_0x4566('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x323b6e[_0x4566('0x4d')][_0x4566('0x72')][_0x5ba176]),'SmsAccountId':Number(_0x323b6e[_0x4566('0x5d')]['id'])});}}else{socket[_0x4566('0xea')](_0x4566('0xed'),{'UserId':Number(_0x323b6e[_0x4566('0x4d')]['ids']),'SmsAccountId':Number(_0x323b6e[_0x4566('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x26260f,null))[_0x4566('0x2f')](handleError(_0x26260f,null));};exports['getAgents']=function(_0xbe2599,_0x2b306c,_0x6d4faf){var _0x4131f2={};var _0x54ab06={};var _0x452d8b;var _0x2bdd08;return db[_0x4566('0x47')][_0x4566('0x6e')]({'where':{'id':_0xbe2599[_0x4566('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2b306c,null))[_0x4566('0x26')](function(_0x414552){if(_0x414552){_0x452d8b=_0x414552;_0x54ab06[_0x4566('0x4c')]=_[_0x4566('0x5e')](db[_0x4566('0xb1')]['rawAttributes']);_0x54ab06['query']=_['keys'](_0xbe2599[_0x4566('0x4d')]);_0x54ab06['filters']=_[_0x4566('0x4e')](_0x54ab06[_0x4566('0x4c')],_0x54ab06[_0x4566('0x4d')]);_0x4131f2[_0x4566('0x50')]=_[_0x4566('0x4e')](_0x54ab06['model'],qs['fields'](_0xbe2599[_0x4566('0x4d')][_0x4566('0x4f')]));_0x4131f2[_0x4566('0x50')]=_0x4131f2[_0x4566('0x50')]['length']?_0x4131f2['attributes']:_0x54ab06[_0x4566('0x4c')];_0x4131f2[_0x4566('0x52')]=qs['sort'](_0xbe2599[_0x4566('0x4d')][_0x4566('0x53')]);_0x4131f2[_0x4566('0x54')]=qs['filters'](_['pick'](_0xbe2599[_0x4566('0x4d')],_0x54ab06[_0x4566('0x55')]));if(_0xbe2599['query'][_0x4566('0x57')]){_0x4131f2['where']=_['merge'](_0x4131f2[_0x4566('0x54')],{'$or':_[_0x4566('0x46')](_0x4131f2[_0x4566('0x50')],function(_0x35c5ee){var _0x4561a4={};_0x4561a4[_0x35c5ee]={'$like':'%'+_0xbe2599[_0x4566('0x4d')][_0x4566('0x57')]+'%'};return _0x4561a4;})});}_0x4131f2=_['merge']({},_0x4131f2,_0xbe2599[_0x4566('0x59')]);return _0x452d8b[_0x4566('0xee')](_0x4131f2);}})['then'](function(_0x4ebacc){if(_0x4ebacc){_0x2bdd08=_0x4ebacc[_0x4566('0x51')];if(!_0xbe2599[_0x4566('0x4d')][_0x4566('0x6f')](_0x4566('0xc4'))){_0x4131f2[_0x4566('0x36')]=qs[_0x4566('0x36')](_0xbe2599[_0x4566('0x4d')][_0x4566('0x36')]);_0x4131f2['offset']=qs[_0x4566('0x35')](_0xbe2599[_0x4566('0x4d')]['offset']);}return _0x452d8b['getAgents'](_0x4131f2);}})[_0x4566('0x26')](function(_0x40019a){if(_0x40019a){return _0x40019a?{'count':_0x2bdd08,'rows':_0x40019a}:null;}})[_0x4566('0x26')](respondWithResult(_0x2b306c,null))[_0x4566('0x2f')](handleError(_0x2b306c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 6dcbf56..84ed890 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 _0x4063=['events','../../mysqldb','setMaxListeners','save','remove','emit','exports'];(function(_0x311589,_0x5583a7){var _0x4669d6=function(_0x165ad1){while(--_0x165ad1){_0x311589['push'](_0x311589['shift']());}};_0x4669d6(++_0x5583a7);}(_0x4063,0xcb));var _0x3406=function(_0x4e8875,_0x1e44f2){_0x4e8875=_0x4e8875-0x0;var _0x257b43=_0x4063[_0x4e8875];return _0x257b43;};'use strict';var EventEmitter=require(_0x3406('0x0'));var SmsAccount=require(_0x3406('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3406('0x2')](0x0);var events={'afterCreate':_0x3406('0x3'),'afterUpdate':'update','afterDestroy':_0x3406('0x4')};function emitEvent(_0x419aa5){return function(_0x5f2f78,_0x6691ee,_0x2e6795){SmsAccountEvents['emit'](_0x419aa5+':'+_0x5f2f78['id'],_0x5f2f78);SmsAccountEvents[_0x3406('0x5')](_0x419aa5,_0x5f2f78);_0x2e6795(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3406('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xb8f1=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','SmsAccount'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xb8f1,0x1d1));var _0x1b8f=function(_0x37612b,_0x7338a8){_0x37612b=_0x37612b-0x0;var _0x1ee7e7=_0xb8f1[_0x37612b];return _0x1ee7e7;};'use strict';var EventEmitter=require(_0x1b8f('0x0'));var SmsAccount=require(_0x1b8f('0x1'))['db'][_0x1b8f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1b8f('0x3')](0x0);var events={'afterCreate':_0x1b8f('0x4'),'afterUpdate':_0x1b8f('0x5'),'afterDestroy':_0x1b8f('0x6')};function emitEvent(_0x41fe0c){return function(_0x7ac401,_0x376ad4,_0x10da03){SmsAccountEvents['emit'](_0x41fe0c+':'+_0x7ac401['id'],_0x7ac401);SmsAccountEvents[_0x1b8f('0x7')](_0x41fe0c,_0x7ac401);_0x10da03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x1b8f('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 55ab80f..2b5d2bb 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 _0x3894=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x365a79,_0x868c5e){var _0x2d5dac=function(_0x5a606){while(--_0x5a606){_0x365a79['push'](_0x365a79['shift']());}};_0x2d5dac(++_0x868c5e);}(_0x3894,0x176));var _0x4389=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x3894[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x4389('0x0'));var util=require(_0x4389('0x1'));var logger=require(_0x4389('0x2'))(_0x4389('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4389('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4389('0x5'));var config=require(_0x4389('0x6'));var attributes=require(_0x4389('0x7'));module[_0x4389('0x8')]=function(_0x56da95,_0x6d34eb){return _0x56da95['define'](_0x4389('0x9'),attributes,{'tableName':_0x4389('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8952=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api'];(function(_0x6d7cf0,_0x337915){var _0x2d5ca3=function(_0x2cee25){while(--_0x2cee25){_0x6d7cf0['push'](_0x6d7cf0['shift']());}};_0x2d5ca3(++_0x337915);}(_0x8952,0x71));var _0x2895=function(_0x2e2614,_0x13e5e7){_0x2e2614=_0x2e2614-0x0;var _0x2e57ec=_0x8952[_0x2e2614];return _0x2e57ec;};'use strict';var _=require(_0x2895('0x0'));var util=require(_0x2895('0x1'));var logger=require(_0x2895('0x2'))(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require(_0x2895('0x5'));var rp=require(_0x2895('0x6'));var fs=require('fs');var path=require(_0x2895('0x7'));var rimraf=require('rimraf');var config=require(_0x2895('0x8'));var attributes=require('./smsAccount.attributes');module[_0x2895('0x9')]=function(_0x4ac085,_0x34bbc7){return _0x4ac085[_0x2895('0xa')](_0x2895('0xb'),attributes,{'tableName':_0x2895('0xc'),'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 ac55065..b5f4bb8 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 _0x71a3=['info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','options','raw','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then'];(function(_0x3f4683,_0x4062f9){var _0x1a80aa=function(_0x5dea92){while(--_0x5dea92){_0x3f4683['push'](_0x3f4683['shift']());}};_0x1a80aa(++_0x4062f9);}(_0x71a3,0xa0));var _0x371a=function(_0x47d05b,_0x3f0d07){_0x47d05b=_0x47d05b-0x0;var _0x128862=_0x71a3[_0x47d05b];return _0x128862;};'use strict';var _=require('lodash');var util=require(_0x371a('0x0'));var moment=require(_0x371a('0x1'));var BPromise=require(_0x371a('0x2'));var rs=require(_0x371a('0x3'));var fs=require('fs');var Redis=require(_0x371a('0x4'));var db=require(_0x371a('0x5'))['db'];var utils=require(_0x371a('0x6'));var logger=require(_0x371a('0x7'))(_0x371a('0x8'));var config=require('../../config/environment');var jayson=require(_0x371a('0x9'));var client=jayson[_0x371a('0xa')][_0x371a('0xb')]({'port':0x232a});config[_0x371a('0xc')]=_[_0x371a('0xd')](config[_0x371a('0xc')],{'host':_0x371a('0xe'),'port':0x18eb});var socket=require(_0x371a('0xf'))(new Redis(config['redis']));require(_0x371a('0x10'))[_0x371a('0x11')](socket);function respondWithRpcPromise(_0x13ca08,_0x9ede08,_0x67cc76){return new BPromise(function(_0x4942cf,_0x19141a){return client[_0x371a('0x12')](_0x13ca08,_0x67cc76)[_0x371a('0x13')](function(_0x46498f){logger[_0x371a('0x14')]('SmsAccount,\x20%s,\x20%s',_0x9ede08,_0x371a('0x15'));logger[_0x371a('0x16')](_0x371a('0x17'),_0x9ede08,'request\x20sent',JSON[_0x371a('0x18')](_0x46498f));if(_0x46498f[_0x371a('0x19')]){if(_0x46498f[_0x371a('0x19')]['code']===0x1f4){logger['error'](_0x371a('0x1a'),_0x9ede08,_0x46498f[_0x371a('0x19')]['message']);return _0x19141a(_0x46498f['error']['message']);}logger[_0x371a('0x19')]('SmsAccount,\x20%s,\x20%s',_0x9ede08,_0x46498f[_0x371a('0x19')]['message']);return _0x4942cf(_0x46498f[_0x371a('0x19')][_0x371a('0x1b')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x9ede08,_0x371a('0x15'));_0x4942cf(_0x46498f['result'][_0x371a('0x1b')]);}})[_0x371a('0x1c')](function(_0x310530){logger[_0x371a('0x19')](_0x371a('0x1a'),_0x9ede08,_0x310530);_0x19141a(_0x310530);});});}exports[_0x371a('0x1d')]=function(_0x260675){var _0x28a420=this;return new Promise(function(_0x34e256,_0x4d1bdb){return db['SmsAccount']['find']({'raw':_0x260675['options']?_0x260675[_0x371a('0x1e')][_0x371a('0x1f')]===undefined?!![]:![]:!![],'where':_0x260675['options']?_0x260675['options']['where']||null:null,'attributes':_0x260675[_0x371a('0x1e')]?_0x260675['options'][_0x371a('0x20')]||null:null,'include':_0x260675[_0x371a('0x1e')]?_0x260675[_0x371a('0x1e')][_0x371a('0x21')]?_['map'](_0x260675[_0x371a('0x1e')]['include'],function(_0x224b60){return{'model':db[_0x224b60[_0x371a('0x22')]],'as':_0x224b60['as'],'attributes':_0x224b60[_0x371a('0x20')],'include':_0x224b60[_0x371a('0x21')]?_[_0x371a('0x23')](_0x224b60[_0x371a('0x21')],function(_0x47c44b){return{'model':db[_0x47c44b[_0x371a('0x22')]],'as':_0x47c44b['as'],'attributes':_0x47c44b['attributes'],'include':_0x47c44b['include']?_[_0x371a('0x23')](_0x47c44b[_0x371a('0x21')],function(_0x29ae2a){return{'model':db[_0x29ae2a['model']],'as':_0x29ae2a['as'],'attributes':_0x29ae2a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x511cbf){logger['info'](_0x371a('0x1d'),_0x260675);logger[_0x371a('0x16')](_0x371a('0x1d'),_0x260675,JSON[_0x371a('0x18')](_0x511cbf));_0x34e256(_0x511cbf);})[_0x371a('0x1c')](function(_0xc83de9){logger[_0x371a('0x19')](_0x371a('0x1d'),_0xc83de9[_0x371a('0x1b')],_0x260675);_0x4d1bdb(_0x28a420[_0x371a('0x19')](0x1f4,_0xc83de9[_0x371a('0x1b')]));});});}; \ No newline at end of file +var _0xbe90=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','then'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbe90,0x156));var _0x0be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe90[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0be9('0x0'));var util=require(_0x0be9('0x1'));var moment=require(_0x0be9('0x2'));var BPromise=require(_0x0be9('0x3'));var rs=require(_0x0be9('0x4'));var fs=require('fs');var Redis=require(_0x0be9('0x5'));var db=require(_0x0be9('0x6'))['db'];var utils=require(_0x0be9('0x7'));var logger=require('../../config/logger')(_0x0be9('0x8'));var config=require(_0x0be9('0x9'));var jayson=require(_0x0be9('0xa'));var client=jayson[_0x0be9('0xb')][_0x0be9('0xc')]({'port':0x232a});config[_0x0be9('0xd')]=_[_0x0be9('0xe')](config[_0x0be9('0xd')],{'host':_0x0be9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0be9('0xd')]));require(_0x0be9('0x10'))[_0x0be9('0x11')](socket);function respondWithRpcPromise(_0x2dca85,_0x36aee9,_0x1c6182){return new BPromise(function(_0x54cbc8,_0x44aea1){return client[_0x0be9('0x12')](_0x2dca85,_0x1c6182)['then'](function(_0x27b89b){logger['info'](_0x0be9('0x13'),_0x36aee9,'request\x20sent');logger[_0x0be9('0x14')](_0x0be9('0x15'),_0x36aee9,_0x0be9('0x16'),JSON[_0x0be9('0x17')](_0x27b89b));if(_0x27b89b[_0x0be9('0x18')]){if(_0x27b89b[_0x0be9('0x18')]['code']===0x1f4){logger[_0x0be9('0x18')]('SmsAccount,\x20%s,\x20%s',_0x36aee9,_0x27b89b[_0x0be9('0x18')][_0x0be9('0x19')]);return _0x44aea1(_0x27b89b[_0x0be9('0x18')][_0x0be9('0x19')]);}logger[_0x0be9('0x18')]('SmsAccount,\x20%s,\x20%s',_0x36aee9,_0x27b89b[_0x0be9('0x18')]['message']);return _0x54cbc8(_0x27b89b['error'][_0x0be9('0x19')]);}else{logger[_0x0be9('0x1a')](_0x0be9('0x13'),_0x36aee9,'request\x20sent');_0x54cbc8(_0x27b89b[_0x0be9('0x1b')][_0x0be9('0x19')]);}})['catch'](function(_0x47c2f1){logger[_0x0be9('0x18')](_0x0be9('0x13'),_0x36aee9,_0x47c2f1);_0x44aea1(_0x47c2f1);});});}exports[_0x0be9('0x1c')]=function(_0x2125f1){var _0x5f1796=this;return new Promise(function(_0x553d52,_0x46c74a){return db['SmsAccount'][_0x0be9('0x1d')]({'raw':_0x2125f1['options']?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x1f')]===undefined?!![]:![]:!![],'where':_0x2125f1['options']?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x20')]||null:null,'attributes':_0x2125f1[_0x0be9('0x1e')]?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x21')]||null:null,'include':_0x2125f1[_0x0be9('0x1e')]?_0x2125f1[_0x0be9('0x1e')][_0x0be9('0x22')]?_[_0x0be9('0x23')](_0x2125f1['options'][_0x0be9('0x22')],function(_0x3b0b86){return{'model':db[_0x3b0b86['model']],'as':_0x3b0b86['as'],'attributes':_0x3b0b86[_0x0be9('0x21')],'include':_0x3b0b86[_0x0be9('0x22')]?_[_0x0be9('0x23')](_0x3b0b86[_0x0be9('0x22')],function(_0x354e23){return{'model':db[_0x354e23[_0x0be9('0x24')]],'as':_0x354e23['as'],'attributes':_0x354e23[_0x0be9('0x21')],'include':_0x354e23[_0x0be9('0x22')]?_['map'](_0x354e23[_0x0be9('0x22')],function(_0x17b1e6){return{'model':db[_0x17b1e6['model']],'as':_0x17b1e6['as'],'attributes':_0x17b1e6[_0x0be9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0be9('0x25')](function(_0x198ad7){logger['info'](_0x0be9('0x1c'),_0x2125f1);logger['debug']('ShowSmsAccount',_0x2125f1,JSON[_0x0be9('0x17')](_0x198ad7));_0x553d52(_0x198ad7);})['catch'](function(_0x1f8970){logger[_0x0be9('0x18')](_0x0be9('0x1c'),_0x1f8970[_0x0be9('0x19')],_0x2125f1);_0x46c74a(_0x5f1796[_0x0be9('0x18')](0x1f4,_0x1f8970['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index db74db9..27619a4 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 _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var SmsAccountEvents=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(){SmsAccountEvents[_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);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsAccountEvents=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(){SmsAccountEvents[_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);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7eca928..41afe0d 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47ae1f,_0x328d68){var _0x2a0233=function(_0x53dd41){while(--_0x53dd41){_0x47ae1f['push'](_0x47ae1f['shift']());}};_0x2a0233(++_0x328d68);}(_0x34e8,0x12c));var _0x834e=function(_0x31ee1b,_0x4f9cd1){_0x31ee1b=_0x31ee1b-0x0;var _0x585378=_0x34e8[_0x31ee1b];return _0x585378;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3460f84..dc69638 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 _0x2eca=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x27ad3e,_0x15f1a8){var _0x1777bd=function(_0x124f31){while(--_0x124f31){_0x27ad3e['push'](_0x27ad3e['shift']());}};_0x1777bd(++_0x15f1a8);}(_0x2eca,0x153));var _0xa2ec=function(_0x28107d,_0x2ec8b3){_0x28107d=_0x28107d-0x0;var _0x2b1cbe=_0x2eca[_0x28107d];return _0x2b1cbe;};'use strict';var Sequelize=require(_0xa2ec('0x0'));module[_0xa2ec('0x1')]={'priority':{'type':Sequelize[_0xa2ec('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa2ec('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa2ec('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa2ec('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfa75=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x241e61,_0x51e5ea){var _0x409de4=function(_0x1ccc72){while(--_0x1ccc72){_0x241e61['push'](_0x241e61['shift']());}};_0x409de4(++_0x51e5ea);}(_0xfa75,0x1b9));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5fa7('0x0'));module[_0x5fa7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5fa7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5fa7('0x3')]()},'description':{'type':Sequelize[_0x5fa7('0x2')]},'interval':{'type':Sequelize[_0x5fa7('0x2')],'defaultValue':_0x5fa7('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e1ebf30..c93432f 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 _0xbcf3=['map','SmsApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index'];(function(_0xf94919,_0x30b822){var _0x395617=function(_0x2849d6){while(--_0x2849d6){_0xf94919['push'](_0xf94919['shift']());}};_0x395617(++_0x30b822);}(_0xbcf3,0x68));var _0x3bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bcf('0x2'));var moment=require(_0x3bcf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3bcf('0x4'));var util=require(_0x3bcf('0x5'));var path=require(_0x3bcf('0x6'));var sox=require(_0x3bcf('0x7'));var csv=require(_0x3bcf('0x8'));var ejs=require(_0x3bcf('0x9'));var fs=require('fs');var fs_extra=require(_0x3bcf('0xa'));var _=require('lodash');var squel=require(_0x3bcf('0xb'));var crypto=require(_0x3bcf('0xc'));var jsforce=require(_0x3bcf('0xd'));var deskjs=require(_0x3bcf('0xe'));var toCsv=require(_0x3bcf('0x8'));var querystring=require(_0x3bcf('0xf'));var Papa=require('papaparse');var Redis=require(_0x3bcf('0x10'));var authService=require(_0x3bcf('0x11'));var qs=require(_0x3bcf('0x12'));var as=require(_0x3bcf('0x13'));var hardwareService=require(_0x3bcf('0x14'));var logger=require(_0x3bcf('0x15'))(_0x3bcf('0x16'));var utils=require(_0x3bcf('0x17'));var config=require(_0x3bcf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bcf('0x19'))['db'];function respondWithStatusCode(_0x345291,_0x26bdcb){_0x26bdcb=_0x26bdcb||0xcc;return function(_0xf6016c){if(_0xf6016c){return _0x345291[_0x3bcf('0x1a')](_0x26bdcb);}return _0x345291[_0x3bcf('0x1b')](_0x26bdcb)[_0x3bcf('0x1c')]();};}function respondWithResult(_0xd064b8,_0x2d0db6){_0x2d0db6=_0x2d0db6||0xc8;return function(_0x282b99){if(_0x282b99){return _0xd064b8['status'](_0x2d0db6)[_0x3bcf('0x1d')](_0x282b99);}};}function respondWithFilteredResult(_0x3169a3,_0x3f2b3f){return function(_0x16ef48){if(_0x16ef48){var _0x2c122c=typeof _0x3f2b3f[_0x3bcf('0x1e')]==='undefined'&&typeof _0x3f2b3f[_0x3bcf('0x1f')]===_0x3bcf('0x20');var _0xd6b3b9=_0x16ef48[_0x3bcf('0x21')];var _0x93636=_0x2c122c?0x0:_0x3f2b3f[_0x3bcf('0x1e')];var _0x14650a=_0x2c122c?_0x16ef48[_0x3bcf('0x21')]:_0x3f2b3f[_0x3bcf('0x1e')]+_0x3f2b3f['limit'];var _0x134ea7;if(_0x14650a>=_0xd6b3b9){_0x14650a=_0xd6b3b9;_0x134ea7=0xc8;}else{_0x134ea7=0xce;}_0x3169a3['status'](_0x134ea7);return _0x3169a3[_0x3bcf('0x22')](_0x3bcf('0x23'),_0x93636+'-'+_0x14650a+'/'+_0xd6b3b9)[_0x3bcf('0x1d')](_0x16ef48);}return null;};}function patchUpdates(_0x50c1ba){return function(_0x284a9e){try{jsonpatch[_0x3bcf('0x24')](_0x284a9e,_0x50c1ba,!![]);}catch(_0x236652){return BPromise['reject'](_0x236652);}return _0x284a9e[_0x3bcf('0x25')]();};}function saveUpdates(_0x38b386,_0x5721d1){return function(_0x37c141){if(_0x37c141){return _0x37c141[_0x3bcf('0x26')](_0x38b386)[_0x3bcf('0x27')](function(_0x5e04f0){return _0x5e04f0;});}return null;};}function removeEntity(_0xbdc116,_0x27f246){return function(_0x339479){if(_0x339479){return _0x339479[_0x3bcf('0x28')]()['then'](function(){_0xbdc116['status'](0xcc)[_0x3bcf('0x1c')]();});}};}function handleEntityNotFound(_0x2b8bb5,_0x524ad5){return function(_0x54d9ca){if(!_0x54d9ca){_0x2b8bb5[_0x3bcf('0x1a')](0x194);}return _0x54d9ca;};}function handleError(_0x216f7c,_0x19d6b1){_0x19d6b1=_0x19d6b1||0x1f4;return function(_0x41ede0){logger['error'](_0x41ede0[_0x3bcf('0x29')]);if(_0x41ede0[_0x3bcf('0x2a')]){delete _0x41ede0['name'];}_0x216f7c[_0x3bcf('0x1b')](_0x19d6b1)['send'](_0x41ede0);};}exports[_0x3bcf('0x2b')]=function(_0x45adc9,_0x5d59c9){var _0x511612={},_0x1b180e={},_0x667605={'count':0x0,'rows':[]};var _0x2dddcb=_[_0x3bcf('0x2c')](db[_0x3bcf('0x2d')]['rawAttributes'],function(_0x1d1d23){return{'name':_0x1d1d23[_0x3bcf('0x2e')],'type':_0x1d1d23['type'][_0x3bcf('0x2f')]};});_0x1b180e['model']=_[_0x3bcf('0x2c')](_0x2dddcb,_0x3bcf('0x2a'));_0x1b180e[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x45adc9[_0x3bcf('0x30')]);_0x1b180e[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x1b180e[_0x3bcf('0x34')],_0x1b180e[_0x3bcf('0x30')]);_0x511612[_0x3bcf('0x35')]=_[_0x3bcf('0x33')](_0x1b180e[_0x3bcf('0x34')],qs['fields'](_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x36')]));_0x511612[_0x3bcf('0x35')]=_0x511612[_0x3bcf('0x35')][_0x3bcf('0x37')]?_0x511612['attributes']:_0x1b180e[_0x3bcf('0x34')];if(!_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x38')](_0x3bcf('0x39'))){_0x511612[_0x3bcf('0x1f')]=qs[_0x3bcf('0x1f')](_0x45adc9[_0x3bcf('0x30')]['limit']);_0x511612[_0x3bcf('0x1e')]=qs[_0x3bcf('0x1e')](_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x1e')]);}_0x511612[_0x3bcf('0x3a')]=qs[_0x3bcf('0x3b')](_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x3b')]);_0x511612[_0x3bcf('0x3c')]=qs['filters'](_['pick'](_0x45adc9[_0x3bcf('0x30')],_0x1b180e[_0x3bcf('0x32')]),_0x2dddcb);if(_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x3d')]){_0x511612[_0x3bcf('0x3c')]=_[_0x3bcf('0x3e')](_0x511612[_0x3bcf('0x3c')],{'$or':_[_0x3bcf('0x2c')](_0x2dddcb,function(_0x1b968b){if(_0x1b968b[_0x3bcf('0x3f')]!=='VIRTUAL'){var _0x3ba0d0={};_0x3ba0d0[_0x1b968b[_0x3bcf('0x2a')]]={'$like':'%'+_0x45adc9[_0x3bcf('0x30')][_0x3bcf('0x3d')]+'%'};return _0x3ba0d0;}})});}_0x511612=_[_0x3bcf('0x3e')]({},_0x511612,_0x45adc9['options']);var _0x592941={'where':_0x511612['where']};return db[_0x3bcf('0x2d')][_0x3bcf('0x21')](_0x592941)[_0x3bcf('0x27')](function(_0x5f2159){_0x667605[_0x3bcf('0x21')]=_0x5f2159;if(_0x45adc9[_0x3bcf('0x30')]['includeAll']){_0x511612['include']=[{'all':!![]}];}return db[_0x3bcf('0x2d')][_0x3bcf('0x40')](_0x511612);})[_0x3bcf('0x27')](function(_0x6e8c88){_0x667605[_0x3bcf('0x41')]=_0x6e8c88;return _0x667605;})['then'](respondWithFilteredResult(_0x5d59c9,_0x511612))[_0x3bcf('0x42')](handleError(_0x5d59c9,null));};exports[_0x3bcf('0x43')]=function(_0x279364,_0x16d204){var _0xc88c59={'raw':!![],'where':{'id':_0x279364['params']['id']}},_0x2a01cf={};_0x2a01cf[_0x3bcf('0x34')]=_[_0x3bcf('0x31')](db['SmsApplication'][_0x3bcf('0x44')]);_0x2a01cf[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x279364['query']);_0x2a01cf[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x2a01cf[_0x3bcf('0x34')],_0x2a01cf[_0x3bcf('0x30')]);_0xc88c59[_0x3bcf('0x35')]=_[_0x3bcf('0x33')](_0x2a01cf[_0x3bcf('0x34')],qs['fields'](_0x279364[_0x3bcf('0x30')]['fields']));_0xc88c59[_0x3bcf('0x35')]=_0xc88c59['attributes'][_0x3bcf('0x37')]?_0xc88c59['attributes']:_0x2a01cf[_0x3bcf('0x34')];if(_0x279364['query']['includeAll']){_0xc88c59['include']=[{'all':!![]}];}_0xc88c59=_[_0x3bcf('0x3e')]({},_0xc88c59,_0x279364[_0x3bcf('0x45')]);return db['SmsApplication'][_0x3bcf('0x46')](_0xc88c59)[_0x3bcf('0x27')](handleEntityNotFound(_0x16d204,null))[_0x3bcf('0x27')](respondWithResult(_0x16d204,null))[_0x3bcf('0x42')](handleError(_0x16d204,null));};exports[_0x3bcf('0x47')]=function(_0x47aa37,_0xb15cc6){return db[_0x3bcf('0x2d')][_0x3bcf('0x47')](_0x47aa37[_0x3bcf('0x48')],{})[_0x3bcf('0x27')](respondWithResult(_0xb15cc6,0xc9))[_0x3bcf('0x42')](handleError(_0xb15cc6,null));};exports[_0x3bcf('0x26')]=function(_0x44725d,_0x5051cc){if(_0x44725d[_0x3bcf('0x48')]['id']){delete _0x44725d[_0x3bcf('0x48')]['id'];}return db[_0x3bcf('0x2d')][_0x3bcf('0x46')]({'where':{'id':_0x44725d[_0x3bcf('0x49')]['id']}})['then'](handleEntityNotFound(_0x5051cc,null))[_0x3bcf('0x27')](saveUpdates(_0x44725d[_0x3bcf('0x48')],null))[_0x3bcf('0x27')](respondWithResult(_0x5051cc,null))[_0x3bcf('0x42')](handleError(_0x5051cc,null));};exports[_0x3bcf('0x28')]=function(_0x4ef2a5,_0x3f8b8a){return db['SmsApplication'][_0x3bcf('0x46')]({'where':{'id':_0x4ef2a5[_0x3bcf('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f8b8a,null))[_0x3bcf('0x27')](removeEntity(_0x3f8b8a,null))[_0x3bcf('0x42')](handleError(_0x3f8b8a,null));}; \ No newline at end of file +var _0xbf87=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','map','SmsApplication','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','length','nolimit','sort','pick','merge','where','type','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv'];(function(_0x5c8cd2,_0x3a1bc0){var _0x2706fa=function(_0x338f9b){while(--_0x338f9b){_0x5c8cd2['push'](_0x5c8cd2['shift']());}};_0x2706fa(++_0x3a1bc0);}(_0xbf87,0x156));var _0x7bf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbf87[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7bf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bf8('0x1'));var jsonpatch=require(_0x7bf8('0x2'));var rp=require('request-promise');var moment=require(_0x7bf8('0x3'));var BPromise=require(_0x7bf8('0x4'));var Mustache=require(_0x7bf8('0x5'));var util=require('util');var path=require(_0x7bf8('0x6'));var sox=require('sox');var csv=require(_0x7bf8('0x7'));var ejs=require(_0x7bf8('0x8'));var fs=require('fs');var fs_extra=require(_0x7bf8('0x9'));var _=require(_0x7bf8('0xa'));var squel=require(_0x7bf8('0xb'));var crypto=require('crypto');var jsforce=require(_0x7bf8('0xc'));var deskjs=require(_0x7bf8('0xd'));var toCsv=require(_0x7bf8('0x7'));var querystring=require(_0x7bf8('0xe'));var Papa=require(_0x7bf8('0xf'));var Redis=require('ioredis');var authService=require(_0x7bf8('0x10'));var qs=require(_0x7bf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bf8('0x12'));var logger=require('../../config/logger')(_0x7bf8('0x13'));var utils=require('../../config/utils');var config=require(_0x7bf8('0x14'));var licenseUtil=require(_0x7bf8('0x15'));var db=require(_0x7bf8('0x16'))['db'];function respondWithStatusCode(_0x5c9051,_0x287d0e){_0x287d0e=_0x287d0e||0xcc;return function(_0x65ebb){if(_0x65ebb){return _0x5c9051[_0x7bf8('0x17')](_0x287d0e);}return _0x5c9051['status'](_0x287d0e)[_0x7bf8('0x18')]();};}function respondWithResult(_0x403914,_0x1044d2){_0x1044d2=_0x1044d2||0xc8;return function(_0x1f87ba){if(_0x1f87ba){return _0x403914[_0x7bf8('0x19')](_0x1044d2)['json'](_0x1f87ba);}};}function respondWithFilteredResult(_0x2144d1,_0x239ae8){return function(_0x1c96a4){if(_0x1c96a4){var _0x4be371=typeof _0x239ae8[_0x7bf8('0x1a')]==='undefined'&&typeof _0x239ae8[_0x7bf8('0x1b')]===_0x7bf8('0x1c');var _0x2b42d0=_0x1c96a4[_0x7bf8('0x1d')];var _0x4ca0bd=_0x4be371?0x0:_0x239ae8['offset'];var _0x516c9f=_0x4be371?_0x1c96a4[_0x7bf8('0x1d')]:_0x239ae8[_0x7bf8('0x1a')]+_0x239ae8['limit'];var _0x5416dd;if(_0x516c9f>=_0x2b42d0){_0x516c9f=_0x2b42d0;_0x5416dd=0xc8;}else{_0x5416dd=0xce;}_0x2144d1[_0x7bf8('0x19')](_0x5416dd);return _0x2144d1[_0x7bf8('0x1e')](_0x7bf8('0x1f'),_0x4ca0bd+'-'+_0x516c9f+'/'+_0x2b42d0)[_0x7bf8('0x20')](_0x1c96a4);}return null;};}function patchUpdates(_0xb2eac2){return function(_0x43371e){try{jsonpatch[_0x7bf8('0x21')](_0x43371e,_0xb2eac2,!![]);}catch(_0x2a6184){return BPromise[_0x7bf8('0x22')](_0x2a6184);}return _0x43371e['save']();};}function saveUpdates(_0xe7b185,_0x3a22ce){return function(_0x3dcc53){if(_0x3dcc53){return _0x3dcc53[_0x7bf8('0x23')](_0xe7b185)[_0x7bf8('0x24')](function(_0x12ee38){return _0x12ee38;});}return null;};}function removeEntity(_0x343af1,_0x38a515){return function(_0x42cccc){if(_0x42cccc){return _0x42cccc[_0x7bf8('0x25')]()[_0x7bf8('0x24')](function(){_0x343af1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52052a,_0x21bc6e){return function(_0x1ca8a1){if(!_0x1ca8a1){_0x52052a[_0x7bf8('0x17')](0x194);}return _0x1ca8a1;};}function handleError(_0x1d84e9,_0x40d388){_0x40d388=_0x40d388||0x1f4;return function(_0x1faaa9){logger[_0x7bf8('0x26')](_0x1faaa9['stack']);if(_0x1faaa9['name']){delete _0x1faaa9['name'];}_0x1d84e9['status'](_0x40d388)['send'](_0x1faaa9);};}exports['index']=function(_0x1e73dc,_0x1e3525){var _0x84bae6={},_0x2e408b={},_0x14eaef={'count':0x0,'rows':[]};var _0x1d273d=_[_0x7bf8('0x27')](db[_0x7bf8('0x28')][_0x7bf8('0x29')],function(_0xf6fc9e){return{'name':_0xf6fc9e[_0x7bf8('0x2a')],'type':_0xf6fc9e['type']['key']};});_0x2e408b['model']=_[_0x7bf8('0x27')](_0x1d273d,'name');_0x2e408b['query']=_[_0x7bf8('0x2b')](_0x1e73dc['query']);_0x2e408b[_0x7bf8('0x2c')]=_['intersection'](_0x2e408b[_0x7bf8('0x2d')],_0x2e408b[_0x7bf8('0x2e')]);_0x84bae6[_0x7bf8('0x2f')]=_[_0x7bf8('0x30')](_0x2e408b['model'],qs['fields'](_0x1e73dc[_0x7bf8('0x2e')]['fields']));_0x84bae6[_0x7bf8('0x2f')]=_0x84bae6[_0x7bf8('0x2f')][_0x7bf8('0x31')]?_0x84bae6[_0x7bf8('0x2f')]:_0x2e408b[_0x7bf8('0x2d')];if(!_0x1e73dc[_0x7bf8('0x2e')]['hasOwnProperty'](_0x7bf8('0x32'))){_0x84bae6[_0x7bf8('0x1b')]=qs[_0x7bf8('0x1b')](_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x1b')]);_0x84bae6['offset']=qs[_0x7bf8('0x1a')](_0x1e73dc['query'][_0x7bf8('0x1a')]);}_0x84bae6['order']=qs[_0x7bf8('0x33')](_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x33')]);_0x84bae6['where']=qs[_0x7bf8('0x2c')](_[_0x7bf8('0x34')](_0x1e73dc[_0x7bf8('0x2e')],_0x2e408b[_0x7bf8('0x2c')]),_0x1d273d);if(_0x1e73dc[_0x7bf8('0x2e')]['filter']){_0x84bae6['where']=_[_0x7bf8('0x35')](_0x84bae6[_0x7bf8('0x36')],{'$or':_[_0x7bf8('0x27')](_0x1d273d,function(_0x101bc0){if(_0x101bc0[_0x7bf8('0x37')]!==_0x7bf8('0x38')){var _0x13d5f1={};_0x13d5f1[_0x101bc0[_0x7bf8('0x39')]]={'$like':'%'+_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x3a')]+'%'};return _0x13d5f1;}})});}_0x84bae6=_[_0x7bf8('0x35')]({},_0x84bae6,_0x1e73dc[_0x7bf8('0x3b')]);var _0x3cfbcc={'where':_0x84bae6[_0x7bf8('0x36')]};return db[_0x7bf8('0x28')][_0x7bf8('0x1d')](_0x3cfbcc)[_0x7bf8('0x24')](function(_0x1cd796){_0x14eaef[_0x7bf8('0x1d')]=_0x1cd796;if(_0x1e73dc[_0x7bf8('0x2e')][_0x7bf8('0x3c')]){_0x84bae6[_0x7bf8('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x7bf8('0x3e')](_0x84bae6);})[_0x7bf8('0x24')](function(_0x3997a3){_0x14eaef[_0x7bf8('0x3f')]=_0x3997a3;return _0x14eaef;})[_0x7bf8('0x24')](respondWithFilteredResult(_0x1e3525,_0x84bae6))[_0x7bf8('0x40')](handleError(_0x1e3525,null));};exports['show']=function(_0x4a594f,_0x5d33ca){var _0xb217c={'raw':!![],'where':{'id':_0x4a594f['params']['id']}},_0x496e65={};_0x496e65[_0x7bf8('0x2d')]=_[_0x7bf8('0x2b')](db[_0x7bf8('0x28')][_0x7bf8('0x29')]);_0x496e65['query']=_['keys'](_0x4a594f[_0x7bf8('0x2e')]);_0x496e65[_0x7bf8('0x2c')]=_[_0x7bf8('0x30')](_0x496e65[_0x7bf8('0x2d')],_0x496e65['query']);_0xb217c[_0x7bf8('0x2f')]=_[_0x7bf8('0x30')](_0x496e65[_0x7bf8('0x2d')],qs[_0x7bf8('0x41')](_0x4a594f[_0x7bf8('0x2e')][_0x7bf8('0x41')]));_0xb217c[_0x7bf8('0x2f')]=_0xb217c[_0x7bf8('0x2f')]['length']?_0xb217c[_0x7bf8('0x2f')]:_0x496e65['model'];if(_0x4a594f[_0x7bf8('0x2e')][_0x7bf8('0x3c')]){_0xb217c[_0x7bf8('0x3d')]=[{'all':!![]}];}_0xb217c=_[_0x7bf8('0x35')]({},_0xb217c,_0x4a594f['options']);return db[_0x7bf8('0x28')][_0x7bf8('0x42')](_0xb217c)[_0x7bf8('0x24')](handleEntityNotFound(_0x5d33ca,null))[_0x7bf8('0x24')](respondWithResult(_0x5d33ca,null))[_0x7bf8('0x40')](handleError(_0x5d33ca,null));};exports[_0x7bf8('0x43')]=function(_0x1fcb58,_0x344282){return db[_0x7bf8('0x28')][_0x7bf8('0x43')](_0x1fcb58['body'],{})['then'](respondWithResult(_0x344282,0xc9))['catch'](handleError(_0x344282,null));};exports[_0x7bf8('0x23')]=function(_0x297420,_0x290272){if(_0x297420[_0x7bf8('0x44')]['id']){delete _0x297420[_0x7bf8('0x44')]['id'];}return db[_0x7bf8('0x28')][_0x7bf8('0x42')]({'where':{'id':_0x297420[_0x7bf8('0x45')]['id']}})[_0x7bf8('0x24')](handleEntityNotFound(_0x290272,null))[_0x7bf8('0x24')](saveUpdates(_0x297420[_0x7bf8('0x44')],null))[_0x7bf8('0x24')](respondWithResult(_0x290272,null))[_0x7bf8('0x40')](handleError(_0x290272,null));};exports[_0x7bf8('0x25')]=function(_0x3fa1fd,_0x1e2555){return db[_0x7bf8('0x28')]['find']({'where':{'id':_0x3fa1fd[_0x7bf8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e2555,null))[_0x7bf8('0x24')](removeEntity(_0x1e2555,null))[_0x7bf8('0x40')](handleError(_0x1e2555,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f282d9b..028f7d1 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 _0x59ce=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x4781e5,_0x48d5f4){var _0x3f00b0=function(_0x4753cc){while(--_0x4753cc){_0x4781e5['push'](_0x4781e5['shift']());}};_0x3f00b0(++_0x48d5f4);}(_0x59ce,0x92));var _0xe59c=function(_0x5dff6c,_0x36e540){_0x5dff6c=_0x5dff6c-0x0;var _0x1dbee1=_0x59ce[_0x5dff6c];return _0x1dbee1;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var logger=require(_0xe59c('0x2'))('api');var moment=require(_0xe59c('0x3'));var BPromise=require(_0xe59c('0x4'));var rp=require(_0xe59c('0x5'));var fs=require('fs');var path=require(_0xe59c('0x6'));var rimraf=require(_0xe59c('0x7'));var config=require(_0xe59c('0x8'));var attributes=require(_0xe59c('0x9'));module['exports']=function(_0x387c49,_0x4ba903){return _0x387c49['define']('SmsApplication',attributes,{'tableName':_0xe59c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe59c('0xb'),'collate':_0xe59c('0xc')});}; \ No newline at end of file +var _0x0076=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0076,0x1b4));var _0x6007=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x0076[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x6007('0x0'));var util=require(_0x6007('0x1'));var logger=require(_0x6007('0x2'))(_0x6007('0x3'));var moment=require(_0x6007('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6007('0x5'));var rimraf=require(_0x6007('0x6'));var config=require(_0x6007('0x7'));var attributes=require(_0x6007('0x8'));module[_0x6007('0x9')]=function(_0x442210,_0x4c64c0){return _0x442210[_0x6007('0xa')]('SmsApplication',attributes,{'tableName':_0x6007('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6007('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ff978c4..f68d737 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 _0x5b12=['SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x5b12,0xa3));var _0x25b1=function(_0x2ea244,_0x143398){_0x2ea244=_0x2ea244-0x0;var _0x964179=_0x5b12[_0x2ea244];return _0x964179;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('SmsApplication,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});} \ No newline at end of file +var _0x6209=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2a5a6c,_0xbc8914){var _0x365094=function(_0x198905){while(--_0x198905){_0x2a5a6c['push'](_0x2a5a6c['shift']());}};_0x365094(++_0xbc8914);}(_0x6209,0x1e8));var _0x9620=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6209[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('SmsApplication,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7f8a3ae..9481356 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 _0x9c00=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x9c00,0x1a0));var _0x09c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c00[_0x321bb2];return _0x9c12ed;};'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 fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x8')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x11')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x11')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x11')](_0x09c0('0x14'),auth[_0x09c0('0xa')](),interaction[_0x09c0('0x15')](_0x09c0('0x16'),_0x09c0('0x17')),controller[_0x09c0('0x18')]);router[_0x09c0('0x19')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x09c0('0x1b')),controller[_0x09c0('0x1c')]);router[_0x09c0('0x1d')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction[_0x09c0('0x15')]('sms','smsinteraction:destroy'),controller[_0x09c0('0x1e')]);router['delete'](_0x09c0('0x14'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x41dee0,_0x374287){var _0x4091bb=function(_0x19bfd1){while(--_0x19bfd1){_0x41dee0['push'](_0x41dee0['shift']());}};_0x4091bb(++_0x374287);}(_0x3c81,0x102));var _0x13c8=function(_0xbaae2c,_0xd76f28){_0xbaae2c=_0xbaae2c-0x0;var _0x4e7852=_0x3c81[_0xbaae2c];return _0x4e7852;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 4be417e..3f9b1fd 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 _0xefda=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x1222fc,_0x43b8d6){var _0x2894b5=function(_0x192f53){while(--_0x192f53){_0x1222fc['push'](_0x1222fc['shift']());}};_0x2894b5(++_0x43b8d6);}(_0xefda,0x96));var _0xaefd=function(_0xabd9f3,_0x20d7f5){_0xabd9f3=_0xabd9f3-0x0;var _0x29d5b2=_0xefda[_0xabd9f3];return _0x29d5b2;};'use strict';var Sequelize=require(_0xaefd('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaefd('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaefd('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaefd('0x3')]},'note':{'type':Sequelize[_0xaefd('0x3')]},'phone':{'type':Sequelize[_0xaefd('0x3')]},'read1stAt':{'type':Sequelize[_0xaefd('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaefd('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaefd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xaefd('0x4')]('in',_0xaefd('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaefd('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc893=['STRING','DATE','ENUM','out','BOOLEAN','moment','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc893,0x194));var _0x3c89=function(_0x5d17f1,_0x13cde1){_0x5d17f1=_0x5d17f1-0x0;var _0x4d08f7=_0xc893[_0x5d17f1];return _0x4d08f7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c89('0x0'));module[_0x3c89('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3c89('0x2')]},'secondDisposition':{'type':Sequelize[_0x3c89('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3c89('0x2')]},'note':{'type':Sequelize[_0x3c89('0x2')]},'phone':{'type':Sequelize[_0x3c89('0x2')]},'read1stAt':{'type':Sequelize[_0x3c89('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3c89('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3c89('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3c89('0x4')]('in',_0x3c89('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3c89('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1d88384..a92566a 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 _0x0a1b=['localhost','socket.io-emitter','redis','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','send','index','map','SmsInteraction','fieldName','key','getOptions','findAll','sms','query','user','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','push','User','CmContact','Contact','lastName','createdAt','direction','SmsAccount','Account','fullname','get','mkdirSync','Owner','closedAt','disposition','System','firstName','out','secret','read','renderFile','views','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','defaults'];(function(_0x783834,_0x38c810){var _0x22055f=function(_0x6a6998){while(--_0x6a6998){_0x783834['push'](_0x783834['shift']());}};_0x22055f(++_0x38c810);}(_0x0a1b,0xe0));var _0xb0a1=function(_0x438ae2,_0x1bfeb9){_0x438ae2=_0x438ae2-0x0;var _0x52bbed=_0x0a1b[_0x438ae2];return _0x52bbed;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb0a1('0x0'));var moment=require(_0xb0a1('0x1'));var BPromise=require(_0xb0a1('0x2'));var util=require(_0xb0a1('0x3'));var path=require(_0xb0a1('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0a1('0x5'));var Redis=require('ioredis');var interaction=require(_0xb0a1('0x6'));var qs=require(_0xb0a1('0x7'));var pdf=require(_0xb0a1('0x8'));var logger=require('../../config/logger')(_0xb0a1('0x9'));var config=require('../../config/environment');var db=require(_0xb0a1('0xa'))['db'];config['redis']=_[_0xb0a1('0xb')](config['redis'],{'host':_0xb0a1('0xc'),'port':0x18eb});var socket=require(_0xb0a1('0xd'))(new Redis(config[_0xb0a1('0xe')]));require(_0xb0a1('0xf'))['register'](socket);function respondWithStatusCode(_0x462829,_0x57a1f9){_0x57a1f9=_0x57a1f9||0xcc;return function(_0x3ffd1a){if(_0x3ffd1a){return _0x462829[_0xb0a1('0x10')](_0x57a1f9);}return _0x462829[_0xb0a1('0x11')](_0x57a1f9)['end']();};}function respondWithResult(_0x4ba90a,_0x57f9dc){_0x57f9dc=_0x57f9dc||0xc8;return function(_0x2f3114){if(_0x2f3114){return _0x4ba90a[_0xb0a1('0x11')](_0x57f9dc)[_0xb0a1('0x12')](_0x2f3114);}};}function respondWithFilteredResult(_0x26f3a5,_0x38f0f2){return function(_0x4674c2){if(_0x4674c2){var _0x4133bf=typeof _0x38f0f2[_0xb0a1('0x13')]===_0xb0a1('0x14')&&typeof _0x38f0f2[_0xb0a1('0x15')]===_0xb0a1('0x14');var _0x47371d=_0x4674c2[_0xb0a1('0x16')];var _0x92cd0d=_0x4133bf?0x0:_0x38f0f2[_0xb0a1('0x13')];var _0x13791a=_0x4133bf?_0x4674c2[_0xb0a1('0x16')]:_0x38f0f2[_0xb0a1('0x13')]+_0x38f0f2[_0xb0a1('0x15')];var _0x358913;if(_0x13791a>=_0x47371d){_0x13791a=_0x47371d;_0x358913=0xc8;}else{_0x358913=0xce;}_0x26f3a5['status'](_0x358913);return _0x26f3a5[_0xb0a1('0x17')](_0xb0a1('0x18'),_0x92cd0d+'-'+_0x13791a+'/'+_0x47371d)[_0xb0a1('0x12')](_0x4674c2);}return null;};}function saveUpdates(_0x1e5416){return function(_0x3191ee){if(_0x3191ee){return _0x3191ee[_0xb0a1('0x19')](_0x1e5416)[_0xb0a1('0x1a')](function(_0x1721c5){return _0x1721c5;});}return null;};}function removeEntity(_0x42f123){return function(_0x54bebc){if(_0x54bebc){return _0x54bebc['destroy']()['then'](function(){_0x42f123[_0xb0a1('0x11')](0xcc)[_0xb0a1('0x1b')]();});}};}function handleEntityNotFound(_0x40d900){return function(_0x5e2c08){if(!_0x5e2c08){_0x40d900[_0xb0a1('0x10')](0x194);}return _0x5e2c08;};}function handleError(_0x5b4b14,_0x2de0e3){_0x2de0e3=_0x2de0e3||0x1f4;return function(_0x4ca95c){logger[_0xb0a1('0x1c')](_0x4ca95c[_0xb0a1('0x1d')]);if(_0x4ca95c[_0xb0a1('0x1e')]){delete _0x4ca95c['name'];}_0x5b4b14[_0xb0a1('0x11')](_0x2de0e3)[_0xb0a1('0x1f')](_0x4ca95c);};}exports[_0xb0a1('0x20')]=function(_0x2befa6,_0x110bdc){var _0x449f79={};var _0x5c8979=_[_0xb0a1('0x21')](db[_0xb0a1('0x22')]['rawAttributes'],function(_0x3f9592){return{'name':_0x3f9592[_0xb0a1('0x23')],'type':_0x3f9592['type'][_0xb0a1('0x24')]};});_0x449f79=qs[_0xb0a1('0x25')](_0x5c8979,_0x2befa6);return interaction[_0xb0a1('0x26')](_0xb0a1('0x27'),_0x2befa6[_0xb0a1('0x28')],_0x2befa6[_0xb0a1('0x29')],_0x449f79,_0x5c8979)[_0xb0a1('0x1a')](respondWithFilteredResult(_0x110bdc,_0x449f79))[_0xb0a1('0x2a')](handleError(_0x110bdc,null));};exports['show']=function(_0xa634ad,_0x46ff71){var _0x37602e={'raw':![],'where':{'id':_0xa634ad[_0xb0a1('0x2b')]['id']}},_0x55acc6={};_0x55acc6[_0xb0a1('0x2c')]=_[_0xb0a1('0x2d')](db['SmsInteraction'][_0xb0a1('0x2e')]);_0x55acc6[_0xb0a1('0x28')]=_['keys'](_0xa634ad['query']);_0x55acc6[_0xb0a1('0x2f')]=_['intersection'](_0x55acc6[_0xb0a1('0x2c')],_0x55acc6[_0xb0a1('0x28')]);_0x37602e[_0xb0a1('0x30')]=_[_0xb0a1('0x31')](_0x55acc6[_0xb0a1('0x2c')],qs[_0xb0a1('0x32')](_0xa634ad[_0xb0a1('0x28')][_0xb0a1('0x32')]));_0x37602e[_0xb0a1('0x30')]=_0x37602e['attributes'][_0xb0a1('0x33')]?_0x37602e['attributes']:_0x55acc6[_0xb0a1('0x2c')];if(_0xa634ad[_0xb0a1('0x28')][_0xb0a1('0x34')]){_0x37602e['include']=[{'all':!![]}];}_0x37602e=_['merge']({},_0x37602e,_0xa634ad[_0xb0a1('0x35')]);return db[_0xb0a1('0x22')][_0xb0a1('0x36')](_0x37602e)[_0xb0a1('0x1a')](handleEntityNotFound(_0x46ff71,null))[_0xb0a1('0x1a')](respondWithResult(_0x46ff71,null))[_0xb0a1('0x2a')](handleError(_0x46ff71,null));};exports[_0xb0a1('0x37')]=function(_0x2e4ab3,_0x582a4a){return db[_0xb0a1('0x22')][_0xb0a1('0x37')](_0x2e4ab3[_0xb0a1('0x38')],{})[_0xb0a1('0x1a')](respondWithResult(_0x582a4a,0xc9))['catch'](handleError(_0x582a4a,null));};exports[_0xb0a1('0x19')]=function(_0x597f11,_0x1f7511){if(_0x597f11[_0xb0a1('0x38')]['id']){delete _0x597f11[_0xb0a1('0x38')]['id'];}return db[_0xb0a1('0x22')][_0xb0a1('0x36')]({'where':{'id':_0x597f11['params']['id']}})[_0xb0a1('0x1a')](handleEntityNotFound(_0x1f7511,null))['then'](saveUpdates(_0x597f11[_0xb0a1('0x38')],null))[_0xb0a1('0x1a')](respondWithResult(_0x1f7511,null))[_0xb0a1('0x2a')](handleError(_0x1f7511,null));};exports['destroy']=function(_0x3a3e37,_0xd6919b){return db[_0xb0a1('0x22')][_0xb0a1('0x36')]({'where':{'id':_0x3a3e37[_0xb0a1('0x2b')]['id']}})[_0xb0a1('0x1a')](handleEntityNotFound(_0xd6919b,null))[_0xb0a1('0x1a')](removeEntity(_0xd6919b,null))[_0xb0a1('0x2a')](handleError(_0xd6919b,null));};exports[_0xb0a1('0x39')]=function(_0x43f7c1,_0x3779db){return db[_0xb0a1('0x22')]['describe']()[_0xb0a1('0x1a')](respondWithResult(_0x3779db,null))[_0xb0a1('0x2a')](handleError(_0x3779db,null));};exports['addMessage']=function(_0xca0860,_0x282b6b){return db['SmsMessage'][_0xb0a1('0x36')]({'where':{'id':_0xca0860[_0xb0a1('0x2b')]['id']}})[_0xb0a1('0x1a')](handleEntityNotFound(_0x282b6b,null))[_0xb0a1('0x1a')](function(_0x504296){if(_0x504296){return _0x504296[_0xb0a1('0x3a')](_0xca0860[_0xb0a1('0x38')][_0xb0a1('0x3b')],_[_0xb0a1('0x3c')](_0xca0860['body'],[_0xb0a1('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x282b6b,null))[_0xb0a1('0x2a')](handleError(_0x282b6b,null));};exports[_0xb0a1('0x3d')]=function(_0x471d54,_0x3e6dd2){var _0xe6e203={'raw':![],'where':{}};var _0x22a676={};var _0x593dd7={'count':0x0,'rows':[]};return db[_0xb0a1('0x22')][_0xb0a1('0x3e')]({'where':{'id':_0x471d54[_0xb0a1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3e6dd2,null))[_0xb0a1('0x1a')](function(_0x2bd929){if(_0x2bd929){_0x22a676[_0xb0a1('0x2c')]=_[_0xb0a1('0x2d')](db[_0xb0a1('0x3f')]['rawAttributes']);_0x22a676[_0xb0a1('0x28')]=_[_0xb0a1('0x2d')](_0x471d54[_0xb0a1('0x28')]);_0x22a676[_0xb0a1('0x2f')]=_['intersection'](_0x22a676[_0xb0a1('0x2c')],_0x22a676['query']);_0xe6e203[_0xb0a1('0x30')]=_[_0xb0a1('0x31')](_0x22a676[_0xb0a1('0x2c')],qs[_0xb0a1('0x32')](_0x471d54[_0xb0a1('0x28')]['fields']));_0xe6e203[_0xb0a1('0x30')]=_0xe6e203['attributes'][_0xb0a1('0x33')]?_0xe6e203[_0xb0a1('0x30')]:_0x22a676[_0xb0a1('0x2c')];if(!_0x471d54[_0xb0a1('0x28')][_0xb0a1('0x40')](_0xb0a1('0x41'))){_0xe6e203[_0xb0a1('0x15')]=qs[_0xb0a1('0x15')](_0x471d54[_0xb0a1('0x28')]['limit']);_0xe6e203[_0xb0a1('0x13')]=qs[_0xb0a1('0x13')](_0x471d54[_0xb0a1('0x28')][_0xb0a1('0x13')]);}_0xe6e203[_0xb0a1('0x42')]=qs[_0xb0a1('0x43')](_0x471d54['query'][_0xb0a1('0x43')]);_0xe6e203[_0xb0a1('0x44')]=qs['filters'](_['pick'](_0x471d54[_0xb0a1('0x28')],_0x22a676[_0xb0a1('0x2f')]));_0xe6e203[_0xb0a1('0x44')]['SmsInteractionId']=_0x2bd929['id'];if(_0x471d54[_0xb0a1('0x28')]['filter']){_0xe6e203[_0xb0a1('0x44')]=_[_0xb0a1('0x45')](_0xe6e203[_0xb0a1('0x44')],{'$or':_['map'](_0xe6e203[_0xb0a1('0x30')],function(_0x26c06b){var _0x524f9e={};_0x524f9e[_0x26c06b]={'$like':'%'+_0x471d54[_0xb0a1('0x28')][_0xb0a1('0x46')]+'%'};return _0x524f9e;})});}if(_0x471d54[_0xb0a1('0x28')]['$gte']){var _0x9ea72e=_0x471d54[_0xb0a1('0x28')][_0xb0a1('0x47')][_0xb0a1('0x48')](',');var _0x4557ad={};_0x4557ad[_0x9ea72e[0x0]]={'$gte':moment(_0x9ea72e[0x1])[_0xb0a1('0x49')](_0xb0a1('0x4a'))};_0xe6e203[_0xb0a1('0x44')]=_[_0xb0a1('0x45')](_0xe6e203[_0xb0a1('0x44')],_0x4557ad);}_0xe6e203=_[_0xb0a1('0x45')]({},_0xe6e203,_0x471d54[_0xb0a1('0x35')]);return db['SmsMessage'][_0xb0a1('0x16')]({'where':_0xe6e203[_0xb0a1('0x44')]})['then'](function(_0x1529a6){_0x593dd7[_0xb0a1('0x16')]=_0x1529a6;if(_0x471d54[_0xb0a1('0x28')]['includeAll']){_0xe6e203[_0xb0a1('0x4b')]=[{'all':!![]}];}return db[_0xb0a1('0x3f')][_0xb0a1('0x26')](_0xe6e203);})['then'](function(_0x23f372){_0x593dd7['rows']=_0x23f372;return _0x593dd7;});}})[_0xb0a1('0x1a')](respondWithFilteredResult(_0x3e6dd2,_0xe6e203))[_0xb0a1('0x2a')](handleError(_0x3e6dd2,null));};exports[_0xb0a1('0x4c')]=function(_0x8d4dea,_0x128643){return db[_0xb0a1('0x22')][_0xb0a1('0x36')]({'where':{'id':_0x8d4dea['params']['id']}})[_0xb0a1('0x1a')](handleEntityNotFound(_0x128643,null))['then'](function(_0x45327f){if(_0x45327f){return _0x45327f[_0xb0a1('0x4d')](_0x8d4dea['body'][_0xb0a1('0x3b')],_[_0xb0a1('0x3c')](_0x8d4dea[_0xb0a1('0x38')],[_0xb0a1('0x3b'),'id'])||{})[_0xb0a1('0x4e')](function(){return db['Tag'][_0xb0a1('0x26')]({'attributes':['id',_0xb0a1('0x1e'),'color'],'where':{'id':_0x8d4dea[_0xb0a1('0x38')][_0xb0a1('0x3b')]}});})[_0xb0a1('0x1a')](function(_0x2b754e){socket[_0xb0a1('0x4f')](_0xb0a1('0x50'),{'id':Number(_0x8d4dea['params']['id']),'tags':_0x2b754e||[]});return{'id':Number(_0x8d4dea[_0xb0a1('0x2b')]['id']),'tags':_0x2b754e||[]};});}})[_0xb0a1('0x1a')](respondWithResult(_0x128643,null))[_0xb0a1('0x2a')](handleError(_0x128643,null));};exports[_0xb0a1('0x51')]=function(_0x1a1622,_0x462ac4){return db[_0xb0a1('0x22')][_0xb0a1('0x36')]({'where':{'id':_0x1a1622['params']['id']}})[_0xb0a1('0x1a')](handleEntityNotFound(_0x462ac4,null))['then'](function(_0x267b46){if(_0x267b46){return _0x267b46[_0xb0a1('0x51')](_0x1a1622[_0xb0a1('0x28')][_0xb0a1('0x3b')]);}})[_0xb0a1('0x1a')](respondWithStatusCode(_0x462ac4,null))[_0xb0a1('0x2a')](handleError(_0x462ac4,null));};exports[_0xb0a1('0x52')]=function(_0xf64c09,_0x3e0d8d){var _0x296a99=moment()[_0xb0a1('0x53')]()[_0xb0a1('0x54')]();var _0x41fd13=path['join'](config['root'],_0xb0a1('0x55'),_0xb0a1('0x56'),_0xb0a1('0x57'));var _0x20502d=path[_0xb0a1('0x58')](_0x41fd13,_0x296a99);var _0x487425=util[_0xb0a1('0x49')]('transcript-%d-%s.zip',_0xf64c09[_0xb0a1('0x2b')]['id'],_0x296a99);var _0x589797=path[_0xb0a1('0x58')](_0x41fd13,_0x487425);var _0x21887b=[];_0x21887b[_0xb0a1('0x59')]({'model':db[_0xb0a1('0x5a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x21887b['push']({'model':db[_0xb0a1('0x5b')],'as':_0xb0a1('0x5c'),'attributes':['id','firstName',_0xb0a1('0x5d')],'raw':!![]});var _0x22e925=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb0a1('0x38'),_0xb0a1('0x5e'),_0xb0a1('0x5f'),'secret','read'],'include':_0x21887b}];_0x22e925[_0xb0a1('0x59')]({'model':db[_0xb0a1('0x60')],'as':_0xb0a1('0x61'),'attributes':['id',_0xb0a1('0x1e')]});_0x22e925[_0xb0a1('0x59')]({'model':db[_0xb0a1('0x5a')],'as':'Owner','attributes':['id',_0xb0a1('0x62')]});return db[_0xb0a1('0x22')][_0xb0a1('0x36')]({'where':{'id':_0xf64c09['params']['id']},'include':_0x22e925})['then'](handleEntityNotFound(_0x3e0d8d,null))['then'](function(_0x1a5b6d){if(_0x1a5b6d){var _0x1caf81=_0x1a5b6d[_0xb0a1('0x63')]({'plain':!![]});fs[_0xb0a1('0x64')](_0x20502d);var _0xbf7046={'channel':'Sms','account':_0x1caf81[_0xb0a1('0x61')][_0xb0a1('0x1e')],'agent':_0x1caf81['Owner']?_0x1caf81[_0xb0a1('0x65')][_0xb0a1('0x62')]:'N.A.','createdAt':moment(_0x1caf81[_0xb0a1('0x5e')])[_0xb0a1('0x49')](_0xb0a1('0x4a'))[_0xb0a1('0x54')](),'closedAt':_0x1caf81['closed']?moment(_0x1caf81[_0xb0a1('0x66')])['format'](_0xb0a1('0x4a'))[_0xb0a1('0x54')]():'','disposition':_0x1caf81[_0xb0a1('0x67')],'messages':_(_0x1caf81['Messages'])['filter']({'secret':![]})[_0xb0a1('0x21')](function(_0x2a85a4){return{'date':moment(_0x2a85a4[_0xb0a1('0x5e')])[_0xb0a1('0x49')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2a85a4[_0xb0a1('0x5f')]==='out'?_0x2a85a4[_0xb0a1('0x5a')]?_0x2a85a4[_0xb0a1('0x5a')]['fullname']:_0xb0a1('0x68'):_0x2a85a4['Contact'][_0xb0a1('0x69')]+(_0x2a85a4['Contact'][_0xb0a1('0x5d')]?'\x20'+_0x2a85a4[_0xb0a1('0x5c')][_0xb0a1('0x5d')]:''),'body':_0x2a85a4[_0xb0a1('0x38')],'direction':_0x2a85a4[_0xb0a1('0x5f')]===_0xb0a1('0x6a')?'A':'C','secret':_0x2a85a4[_0xb0a1('0x6b')],'read':_0x2a85a4[_0xb0a1('0x6c')]};})['value']()};return ejs[_0xb0a1('0x6d')](path['join'](config['root'],_0xb0a1('0x55'),_0xb0a1('0x6e'),'downloadInteraction.ejs'),{'interaction':_0xbf7046})[_0xb0a1('0x1a')](function(_0x2f54c8){var _0x3b84a1=path['join'](_0x20502d,_0xb0a1('0x6f')+_0x1caf81['id']+'-'+_0x296a99+_0xb0a1('0x70'));var _0x4aa330={'path':_0x3b84a1,'channel':_0xb0a1('0x71'),'interactionId':_0x1caf81['id']};return pdf[_0xb0a1('0x72')](_0x2f54c8,_0x4aa330);})['then'](function(){return new BPromise(function(_0x345187,_0x5aec56){zipdir(_0x20502d,{'saveTo':_0x589797},function(_0x11adb2,_0xf3f083){if(_0x11adb2)return _0x5aec56(_0x11adb2);return _0x345187(_0xf3f083);});})['then'](function(){return new BPromise(function(_0x4cc4ec,_0x1ac694){rimraf(_0x20502d,function(_0x3621de){if(_0x3621de)_0x1ac694(_0x3621de);return _0x4cc4ec();});});})[_0xb0a1('0x1a')](function(){return _0x3e0d8d[_0xb0a1('0x52')](_0x589797,_0x487425,function(_0x356496){if(_0x356496){console[_0xb0a1('0x73')](_0xb0a1('0x74'),_0x356496);}else{fs[_0xb0a1('0x75')](_0x589797);}});});});}else{return _0x3e0d8d['sendStatus'](0xc8);}})[_0xb0a1('0x2a')](handleError(_0x3e0d8d,null));}; \ No newline at end of file +var _0x06de=['create','body','describe','addMessage','SmsMessage','ids','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','rows','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','format','closed','closedAt','disposition','out','System','Contact','lastName','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','update','then','destroy','error','name','send','index','map','SmsInteraction','fieldName','type','key','findAll','sms','query','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','options','find'];(function(_0x471ee9,_0x1a97ff){var _0x44a386=function(_0x2f0be4){while(--_0x2f0be4){_0x471ee9['push'](_0x471ee9['shift']());}};_0x44a386(++_0x1a97ff);}(_0x06de,0x1a3));var _0xe06d=function(_0x4ca3b4,_0x2450bc){_0x4ca3b4=_0x4ca3b4-0x0;var _0x51ea64=_0x06de[_0x4ca3b4];return _0x51ea64;};'use strict';var rimraf=require(_0xe06d('0x0'));var zipdir=require(_0xe06d('0x1'));var moment=require(_0xe06d('0x2'));var BPromise=require(_0xe06d('0x3'));var util=require('util');var path=require(_0xe06d('0x4'));var ejs=require(_0xe06d('0x5'));var fs=require('fs');var _=require(_0xe06d('0x6'));var Redis=require(_0xe06d('0x7'));var interaction=require(_0xe06d('0x8'));var qs=require(_0xe06d('0x9'));var pdf=require(_0xe06d('0xa'));var logger=require(_0xe06d('0xb'))('api');var config=require(_0xe06d('0xc'));var db=require(_0xe06d('0xd'))['db'];config[_0xe06d('0xe')]=_[_0xe06d('0xf')](config[_0xe06d('0xe')],{'host':_0xe06d('0x10'),'port':0x18eb});var socket=require(_0xe06d('0x11'))(new Redis(config[_0xe06d('0xe')]));require(_0xe06d('0x12'))[_0xe06d('0x13')](socket);function respondWithStatusCode(_0x42463d,_0x524aef){_0x524aef=_0x524aef||0xcc;return function(_0x512448){if(_0x512448){return _0x42463d[_0xe06d('0x14')](_0x524aef);}return _0x42463d[_0xe06d('0x15')](_0x524aef)[_0xe06d('0x16')]();};}function respondWithResult(_0x26b19a,_0x27d7ee){_0x27d7ee=_0x27d7ee||0xc8;return function(_0x198618){if(_0x198618){return _0x26b19a[_0xe06d('0x15')](_0x27d7ee)[_0xe06d('0x17')](_0x198618);}};}function respondWithFilteredResult(_0x3b0f7d,_0x5b8975){return function(_0x33ee52){if(_0x33ee52){var _0x261ce3=typeof _0x5b8975[_0xe06d('0x18')]===_0xe06d('0x19')&&typeof _0x5b8975['limit']===_0xe06d('0x19');var _0x5c8624=_0x33ee52['count'];var _0x30ed8b=_0x261ce3?0x0:_0x5b8975[_0xe06d('0x18')];var _0x5c4404=_0x261ce3?_0x33ee52['count']:_0x5b8975['offset']+_0x5b8975[_0xe06d('0x1a')];var _0x91814b;if(_0x5c4404>=_0x5c8624){_0x5c4404=_0x5c8624;_0x91814b=0xc8;}else{_0x91814b=0xce;}_0x3b0f7d[_0xe06d('0x15')](_0x91814b);return _0x3b0f7d['set']('Content-Range',_0x30ed8b+'-'+_0x5c4404+'/'+_0x5c8624)[_0xe06d('0x17')](_0x33ee52);}return null;};}function saveUpdates(_0x269f63){return function(_0x8a8c1a){if(_0x8a8c1a){return _0x8a8c1a[_0xe06d('0x1b')](_0x269f63)[_0xe06d('0x1c')](function(_0x40a3a7){return _0x40a3a7;});}return null;};}function removeEntity(_0xca0991){return function(_0x28cceb){if(_0x28cceb){return _0x28cceb[_0xe06d('0x1d')]()[_0xe06d('0x1c')](function(){_0xca0991['status'](0xcc)[_0xe06d('0x16')]();});}};}function handleEntityNotFound(_0x57466f){return function(_0x1237c6){if(!_0x1237c6){_0x57466f[_0xe06d('0x14')](0x194);}return _0x1237c6;};}function handleError(_0x2e8524,_0xec3428){_0xec3428=_0xec3428||0x1f4;return function(_0x5709ca){logger[_0xe06d('0x1e')](_0x5709ca['stack']);if(_0x5709ca['name']){delete _0x5709ca[_0xe06d('0x1f')];}_0x2e8524['status'](_0xec3428)[_0xe06d('0x20')](_0x5709ca);};}exports[_0xe06d('0x21')]=function(_0x4ecaba,_0x3dc806){var _0x110a80={};var _0x275226=_[_0xe06d('0x22')](db[_0xe06d('0x23')]['rawAttributes'],function(_0x2b894e){return{'name':_0x2b894e[_0xe06d('0x24')],'type':_0x2b894e[_0xe06d('0x25')][_0xe06d('0x26')]};});_0x110a80=qs['getOptions'](_0x275226,_0x4ecaba);return interaction[_0xe06d('0x27')](_0xe06d('0x28'),_0x4ecaba[_0xe06d('0x29')],_0x4ecaba['user'],_0x110a80,_0x275226)[_0xe06d('0x1c')](respondWithFilteredResult(_0x3dc806,_0x110a80))[_0xe06d('0x2a')](handleError(_0x3dc806,null));};exports[_0xe06d('0x2b')]=function(_0x920392,_0xcd83d5){var _0x3b7463={'raw':![],'where':{'id':_0x920392[_0xe06d('0x2c')]['id']}},_0x9287fc={};_0x9287fc[_0xe06d('0x2d')]=_[_0xe06d('0x2e')](db[_0xe06d('0x23')][_0xe06d('0x2f')]);_0x9287fc[_0xe06d('0x29')]=_[_0xe06d('0x2e')](_0x920392['query']);_0x9287fc[_0xe06d('0x30')]=_[_0xe06d('0x31')](_0x9287fc[_0xe06d('0x2d')],_0x9287fc[_0xe06d('0x29')]);_0x3b7463[_0xe06d('0x32')]=_[_0xe06d('0x31')](_0x9287fc['model'],qs[_0xe06d('0x33')](_0x920392[_0xe06d('0x29')][_0xe06d('0x33')]));_0x3b7463[_0xe06d('0x32')]=_0x3b7463[_0xe06d('0x32')][_0xe06d('0x34')]?_0x3b7463[_0xe06d('0x32')]:_0x9287fc[_0xe06d('0x2d')];if(_0x920392[_0xe06d('0x29')][_0xe06d('0x35')]){_0x3b7463[_0xe06d('0x36')]=[{'all':!![]}];}_0x3b7463=_['merge']({},_0x3b7463,_0x920392[_0xe06d('0x37')]);return db[_0xe06d('0x23')][_0xe06d('0x38')](_0x3b7463)[_0xe06d('0x1c')](handleEntityNotFound(_0xcd83d5,null))[_0xe06d('0x1c')](respondWithResult(_0xcd83d5,null))['catch'](handleError(_0xcd83d5,null));};exports[_0xe06d('0x39')]=function(_0x4cf240,_0x1199a7){return db[_0xe06d('0x23')][_0xe06d('0x39')](_0x4cf240[_0xe06d('0x3a')],{})[_0xe06d('0x1c')](respondWithResult(_0x1199a7,0xc9))['catch'](handleError(_0x1199a7,null));};exports[_0xe06d('0x1b')]=function(_0x276703,_0x3d84cd){if(_0x276703[_0xe06d('0x3a')]['id']){delete _0x276703[_0xe06d('0x3a')]['id'];}return db['SmsInteraction'][_0xe06d('0x38')]({'where':{'id':_0x276703['params']['id']}})['then'](handleEntityNotFound(_0x3d84cd,null))[_0xe06d('0x1c')](saveUpdates(_0x276703[_0xe06d('0x3a')],null))[_0xe06d('0x1c')](respondWithResult(_0x3d84cd,null))[_0xe06d('0x2a')](handleError(_0x3d84cd,null));};exports[_0xe06d('0x1d')]=function(_0x303b2c,_0x5c2962){return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x303b2c['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5c2962,null))['then'](removeEntity(_0x5c2962,null))[_0xe06d('0x2a')](handleError(_0x5c2962,null));};exports[_0xe06d('0x3b')]=function(_0xea4ae3,_0x3141e1){return db[_0xe06d('0x23')][_0xe06d('0x3b')]()[_0xe06d('0x1c')](respondWithResult(_0x3141e1,null))['catch'](handleError(_0x3141e1,null));};exports[_0xe06d('0x3c')]=function(_0x570abf,_0x4fb28b){return db[_0xe06d('0x3d')][_0xe06d('0x38')]({'where':{'id':_0x570abf['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x4fb28b,null))[_0xe06d('0x1c')](function(_0x5d6350){if(_0x5d6350){return _0x5d6350[_0xe06d('0x3c')](_0x570abf[_0xe06d('0x3a')][_0xe06d('0x3e')],_['omit'](_0x570abf['body'],[_0xe06d('0x3e'),'id'])||{});}})[_0xe06d('0x1c')](respondWithResult(_0x4fb28b,null))[_0xe06d('0x2a')](handleError(_0x4fb28b,null));};exports['getMessages']=function(_0x2ad292,_0x5b4600){var _0x292190={'raw':![],'where':{}};var _0x1890ca={};var _0x35d0ed={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x2ad292['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5b4600,null))[_0xe06d('0x1c')](function(_0x16186a){if(_0x16186a){_0x1890ca[_0xe06d('0x2d')]=_[_0xe06d('0x2e')](db[_0xe06d('0x3d')]['rawAttributes']);_0x1890ca['query']=_['keys'](_0x2ad292[_0xe06d('0x29')]);_0x1890ca[_0xe06d('0x30')]=_[_0xe06d('0x31')](_0x1890ca[_0xe06d('0x2d')],_0x1890ca[_0xe06d('0x29')]);_0x292190['attributes']=_[_0xe06d('0x31')](_0x1890ca[_0xe06d('0x2d')],qs['fields'](_0x2ad292[_0xe06d('0x29')][_0xe06d('0x33')]));_0x292190[_0xe06d('0x32')]=_0x292190[_0xe06d('0x32')]['length']?_0x292190[_0xe06d('0x32')]:_0x1890ca[_0xe06d('0x2d')];if(!_0x2ad292[_0xe06d('0x29')][_0xe06d('0x3f')](_0xe06d('0x40'))){_0x292190[_0xe06d('0x1a')]=qs['limit'](_0x2ad292[_0xe06d('0x29')][_0xe06d('0x1a')]);_0x292190['offset']=qs[_0xe06d('0x18')](_0x2ad292[_0xe06d('0x29')]['offset']);}_0x292190[_0xe06d('0x41')]=qs[_0xe06d('0x42')](_0x2ad292[_0xe06d('0x29')]['sort']);_0x292190[_0xe06d('0x43')]=qs[_0xe06d('0x30')](_[_0xe06d('0x44')](_0x2ad292['query'],_0x1890ca['filters']));_0x292190[_0xe06d('0x43')][_0xe06d('0x45')]=_0x16186a['id'];if(_0x2ad292[_0xe06d('0x29')][_0xe06d('0x46')]){_0x292190['where']=_[_0xe06d('0x47')](_0x292190['where'],{'$or':_[_0xe06d('0x22')](_0x292190[_0xe06d('0x32')],function(_0x274341){var _0x2488e4={};_0x2488e4[_0x274341]={'$like':'%'+_0x2ad292['query'][_0xe06d('0x46')]+'%'};return _0x2488e4;})});}if(_0x2ad292[_0xe06d('0x29')][_0xe06d('0x48')]){var _0x529736=_0x2ad292[_0xe06d('0x29')][_0xe06d('0x48')][_0xe06d('0x49')](',');var _0x53b7b6={};_0x53b7b6[_0x529736[0x0]]={'$gte':moment(_0x529736[0x1])['format'](_0xe06d('0x4a'))};_0x292190[_0xe06d('0x43')]=_[_0xe06d('0x47')](_0x292190[_0xe06d('0x43')],_0x53b7b6);}_0x292190=_[_0xe06d('0x47')]({},_0x292190,_0x2ad292[_0xe06d('0x37')]);return db['SmsMessage'][_0xe06d('0x4b')]({'where':_0x292190[_0xe06d('0x43')]})['then'](function(_0x1a217b){_0x35d0ed[_0xe06d('0x4b')]=_0x1a217b;if(_0x2ad292[_0xe06d('0x29')]['includeAll']){_0x292190['include']=[{'all':!![]}];}return db['SmsMessage'][_0xe06d('0x27')](_0x292190);})['then'](function(_0x2a41ee){_0x35d0ed[_0xe06d('0x4c')]=_0x2a41ee;return _0x35d0ed;});}})[_0xe06d('0x1c')](respondWithFilteredResult(_0x5b4600,_0x292190))[_0xe06d('0x2a')](handleError(_0x5b4600,null));};exports['addTags']=function(_0x4bf871,_0x2bccae){return db['SmsInteraction'][_0xe06d('0x38')]({'where':{'id':_0x4bf871['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x2bccae,null))[_0xe06d('0x1c')](function(_0x21c7b5){if(_0x21c7b5){return _0x21c7b5[_0xe06d('0x4d')](_0x4bf871['body'][_0xe06d('0x3e')],_['omit'](_0x4bf871[_0xe06d('0x3a')],[_0xe06d('0x3e'),'id'])||{})[_0xe06d('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe06d('0x1f'),_0xe06d('0x4f')],'where':{'id':_0x4bf871['body'][_0xe06d('0x3e')]}});})['then'](function(_0x4d9ec6){socket[_0xe06d('0x50')](_0xe06d('0x51'),{'id':Number(_0x4bf871[_0xe06d('0x2c')]['id']),'tags':_0x4d9ec6||[]});return{'id':Number(_0x4bf871[_0xe06d('0x2c')]['id']),'tags':_0x4d9ec6||[]};});}})[_0xe06d('0x1c')](respondWithResult(_0x2bccae,null))[_0xe06d('0x2a')](handleError(_0x2bccae,null));};exports['removeTags']=function(_0x52a383,_0x5e7dad){return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x52a383['params']['id']}})[_0xe06d('0x1c')](handleEntityNotFound(_0x5e7dad,null))[_0xe06d('0x1c')](function(_0x4511a4){if(_0x4511a4){return _0x4511a4[_0xe06d('0x52')](_0x52a383['query'][_0xe06d('0x3e')]);}})['then'](respondWithStatusCode(_0x5e7dad,null))[_0xe06d('0x2a')](handleError(_0x5e7dad,null));};exports[_0xe06d('0x53')]=function(_0x70b865,_0x44170e){var _0x4c4188=moment()['unix']()['toString']();var _0x3df215=path['join'](config[_0xe06d('0x54')],_0xe06d('0x55'),_0xe06d('0x56'),_0xe06d('0x57'));var _0x45726e=path[_0xe06d('0x58')](_0x3df215,_0x4c4188);var _0x2b9ca8=util['format'](_0xe06d('0x59'),_0x70b865[_0xe06d('0x2c')]['id'],_0x4c4188);var _0x4e2be3=path[_0xe06d('0x58')](_0x3df215,_0x2b9ca8);var _0x5be31c=[];_0x5be31c[_0xe06d('0x5a')]({'model':db[_0xe06d('0x5b')],'as':_0xe06d('0x5b'),'attributes':['id',_0xe06d('0x5c')],'raw':!![]});_0x5be31c[_0xe06d('0x5a')]({'model':db[_0xe06d('0x5d')],'as':'Contact','attributes':['id',_0xe06d('0x5e'),'lastName'],'raw':!![]});var _0x5952ce=[{'model':db[_0xe06d('0x3d')],'as':_0xe06d('0x5f'),'attributes':['id',_0xe06d('0x3a'),_0xe06d('0x60'),_0xe06d('0x61'),_0xe06d('0x62'),_0xe06d('0x63')],'include':_0x5be31c}];_0x5952ce[_0xe06d('0x5a')]({'model':db[_0xe06d('0x64')],'as':_0xe06d('0x65'),'attributes':['id','name']});_0x5952ce[_0xe06d('0x5a')]({'model':db['User'],'as':_0xe06d('0x66'),'attributes':['id','fullname']});return db[_0xe06d('0x23')][_0xe06d('0x38')]({'where':{'id':_0x70b865['params']['id']},'include':_0x5952ce})[_0xe06d('0x1c')](handleEntityNotFound(_0x44170e,null))[_0xe06d('0x1c')](function(_0x22fb93){if(_0x22fb93){var _0x496b3e=_0x22fb93[_0xe06d('0x67')]({'plain':!![]});fs[_0xe06d('0x68')](_0x45726e);var _0x20c1e4={'channel':_0xe06d('0x69'),'account':_0x496b3e[_0xe06d('0x65')][_0xe06d('0x1f')],'agent':_0x496b3e['Owner']?_0x496b3e[_0xe06d('0x66')][_0xe06d('0x5c')]:'N.A.','createdAt':moment(_0x496b3e['createdAt'])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString'](),'closedAt':_0x496b3e[_0xe06d('0x6b')]?moment(_0x496b3e[_0xe06d('0x6c')])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString']():'','disposition':_0x496b3e[_0xe06d('0x6d')],'messages':_(_0x496b3e[_0xe06d('0x5f')])['filter']({'secret':![]})[_0xe06d('0x22')](function(_0xb88374){return{'date':moment(_0xb88374[_0xe06d('0x60')])[_0xe06d('0x6a')](_0xe06d('0x4a'))['toString'](),'sender':_0xb88374[_0xe06d('0x61')]===_0xe06d('0x6e')?_0xb88374['User']?_0xb88374[_0xe06d('0x5b')]['fullname']:_0xe06d('0x6f'):_0xb88374['Contact'][_0xe06d('0x5e')]+(_0xb88374[_0xe06d('0x70')][_0xe06d('0x71')]?'\x20'+_0xb88374[_0xe06d('0x70')]['lastName']:''),'body':_0xb88374[_0xe06d('0x3a')],'direction':_0xb88374[_0xe06d('0x61')]===_0xe06d('0x6e')?'A':'C','secret':_0xb88374['secret'],'read':_0xb88374['read']};})['value']()};return ejs['renderFile'](path[_0xe06d('0x58')](config[_0xe06d('0x54')],'server',_0xe06d('0x72'),_0xe06d('0x73')),{'interaction':_0x20c1e4})[_0xe06d('0x1c')](function(_0x555aed){var _0x1c1cba=path[_0xe06d('0x58')](_0x45726e,_0xe06d('0x74')+_0x496b3e['id']+'-'+_0x4c4188+_0xe06d('0x75'));var _0xe28941={'path':_0x1c1cba,'channel':'Sms','interactionId':_0x496b3e['id']};return pdf['createPdfFromHTML'](_0x555aed,_0xe28941);})[_0xe06d('0x1c')](function(){return new BPromise(function(_0x2dbe96,_0x423c80){zipdir(_0x45726e,{'saveTo':_0x4e2be3},function(_0x52a013,_0x26db01){if(_0x52a013)return _0x423c80(_0x52a013);return _0x2dbe96(_0x26db01);});})[_0xe06d('0x1c')](function(){return new BPromise(function(_0x4a4020,_0x3c9fd0){rimraf(_0x45726e,function(_0x2421d8){if(_0x2421d8)_0x3c9fd0(_0x2421d8);return _0x4a4020();});});})[_0xe06d('0x1c')](function(){return _0x44170e['download'](_0x4e2be3,_0x2b9ca8,function(_0x5a22fd){if(_0x5a22fd){console['log']('err',_0x5a22fd);}else{fs[_0xe06d('0x76')](_0x4e2be3);}});});});}else{return _0x44170e[_0xe06d('0x14')](0xc8);}})[_0xe06d('0x2a')](handleError(_0x44170e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 54bfb49..bf008cf 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 _0xfb11=['setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xfb11[_0x311c35];return _0x5cc50c;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1fb1('0x1')];var SmsMessage=require(_0x1fb1('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1fb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190f74){return function(_0x2ae20f,_0x5af469,_0x25d44f){_0x2ae20f[_0x1fb1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1859da){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0x7'),_0x1859da[_0x1fb1('0x8')](function(_0x161e1b){return{'id':_0x161e1b['id']};}));return SmsMessage[_0x1fb1('0x9')]({'where':{'SmsInteractionId':_0x2ae20f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fb1('0xa')](function(_0x416625){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0xb'),_0x416625['length']);SmsInteractionEvents[_0x1fb1('0xc')](_0x190f74+':'+_0x2ae20f['id'],_0x2ae20f);SmsInteractionEvents['emit'](_0x190f74,_0x2ae20f);_0x25d44f(null);})[_0x1fb1('0xd')](_0x25d44f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x1fb1('0xe')](e,emitEvent(event));}}module[_0x1fb1('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x4325=['Users','map','findAll','then','setDataValue','length','emit','catch','exports','events','../../mysqldb','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x267070,_0x494ad4){var _0x468380=function(_0x26a6a0){while(--_0x26a6a0){_0x267070['push'](_0x267070['shift']());}};_0x468380(++_0x494ad4);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x5432('0x0'));var SmsInteraction=require(_0x5432('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x5432('0x1'))['db'][_0x5432('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5432('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5432('0x4')};function emitEvent(_0x36ce53){return function(_0xad26e9,_0x4acbe4,_0x209e2e){_0xad26e9[_0x5432('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x106ec9){_0xad26e9['setDataValue'](_0x5432('0x6'),_0x106ec9[_0x5432('0x7')](function(_0x40e756){return{'id':_0x40e756['id']};}));return SmsMessage[_0x5432('0x8')]({'where':{'SmsInteractionId':_0xad26e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5432('0x9')](function(_0x4a9a51){_0xad26e9[_0x5432('0xa')]('unreadMessages',_0x4a9a51[_0x5432('0xb')]);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53+':'+_0xad26e9['id'],_0xad26e9);SmsInteractionEvents[_0x5432('0xc')](_0x36ce53,_0xad26e9);_0x209e2e(null);})[_0x5432('0xd')](_0x209e2e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5432('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c7081d2..9afb022 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 _0x458a=['SmsInteraction','sms_interactions','changed','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2cb7ff,_0x54c189){var _0x3c68ee=function(_0x94afe4){while(--_0x94afe4){_0x2cb7ff['push'](_0x2cb7ff['shift']());}};_0x3c68ee(++_0x54c189);}(_0x458a,0x14e));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa458('0x0'));var util=require(_0xa458('0x1'));var logger=require('../../config/logger')(_0xa458('0x2'));var moment=require(_0xa458('0x3'));var BPromise=require(_0xa458('0x4'));var rp=require(_0xa458('0x5'));var fs=require('fs');var path=require(_0xa458('0x6'));var rimraf=require(_0xa458('0x7'));var config=require(_0xa458('0x8'));var attributes=require('./smsInteraction.attributes');module[_0xa458('0x9')]=function(_0x4eaab6,_0x21133b){return _0x4eaab6[_0xa458('0xa')](_0xa458('0xb'),attributes,{'tableName':_0xa458('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c2e7c,_0x7d1858,_0x10181){if(_0x1c2e7c[_0xa458('0xd')]('closed')){_0x1c2e7c['closedAt']=moment()[_0xa458('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x10181(null,_0x1c2e7c);}}});}; \ No newline at end of file +var _0xd05d=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','sms_interactions'];(function(_0x2d321f,_0x196439){var _0x16744f=function(_0x539eb7){while(--_0x539eb7){_0x2d321f['push'](_0x2d321f['shift']());}};_0x16744f(++_0x196439);}(_0xd05d,0x162));var _0xdd05=function(_0x43b9f8,_0x2fa525){_0x43b9f8=_0x43b9f8-0x0;var _0x1de094=_0xd05d[_0x43b9f8];return _0x1de094;};'use strict';var _=require(_0xdd05('0x0'));var util=require('util');var logger=require(_0xdd05('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdd05('0x2'));var rp=require(_0xdd05('0x3'));var fs=require('fs');var path=require(_0xdd05('0x4'));var rimraf=require(_0xdd05('0x5'));var config=require('../../config/environment');var attributes=require(_0xdd05('0x6'));module[_0xdd05('0x7')]=function(_0x8e6064,_0x5037e5){return _0x8e6064[_0xdd05('0x8')]('SmsInteraction',attributes,{'tableName':_0xdd05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d9db8,_0x4e3494,_0x488cbd){if(_0x1d9db8[_0xdd05('0xa')](_0xdd05('0xb'))){_0x1d9db8[_0xdd05('0xc')]=moment()['format'](_0xdd05('0xd'));}_0x488cbd(null,_0x1d9db8);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b63ba9f..11a26af 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 _0x11e6=['raw','where','attributes','limit','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','SmsInteraction','body','options'];(function(_0x364f67,_0x24b0d7){var _0x474f32=function(_0x234ff7){while(--_0x234ff7){_0x364f67['push'](_0x364f67['shift']());}};_0x474f32(++_0x24b0d7);}(_0x11e6,0x155));var _0x611e=function(_0x12f11b,_0x395826){_0x12f11b=_0x12f11b-0x0;var _0xedf3a2=_0x11e6[_0x12f11b];return _0xedf3a2;};'use strict';var _=require(_0x611e('0x0'));var util=require(_0x611e('0x1'));var moment=require(_0x611e('0x2'));var BPromise=require(_0x611e('0x3'));var rs=require(_0x611e('0x4'));var fs=require('fs');var Redis=require(_0x611e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x611e('0x6'));var config=require(_0x611e('0x7'));var jayson=require(_0x611e('0x8'));var client=jayson['client'][_0x611e('0x9')]({'port':0x232a});config[_0x611e('0xa')]=_[_0x611e('0xb')](config[_0x611e('0xa')],{'host':_0x611e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x611e('0xa')]));require(_0x611e('0xd'))[_0x611e('0xe')](socket);function respondWithRpcPromise(_0x388889,_0x537233,_0x11b703){return new BPromise(function(_0x258556,_0x4e8101){return client[_0x611e('0xf')](_0x388889,_0x11b703)[_0x611e('0x10')](function(_0x2dd1f6){logger['info'](_0x611e('0x11'),_0x537233,'request\x20sent');logger[_0x611e('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x537233,_0x611e('0x13'),JSON[_0x611e('0x14')](_0x2dd1f6));if(_0x2dd1f6[_0x611e('0x15')]){if(_0x2dd1f6[_0x611e('0x15')][_0x611e('0x16')]===0x1f4){logger[_0x611e('0x15')](_0x611e('0x11'),_0x537233,_0x2dd1f6[_0x611e('0x15')][_0x611e('0x17')]);return _0x4e8101(_0x2dd1f6[_0x611e('0x15')]['message']);}logger[_0x611e('0x15')](_0x611e('0x11'),_0x537233,_0x2dd1f6[_0x611e('0x15')][_0x611e('0x17')]);return _0x258556(_0x2dd1f6['error'][_0x611e('0x17')]);}else{logger[_0x611e('0x18')](_0x611e('0x11'),_0x537233,_0x611e('0x13'));_0x258556(_0x2dd1f6['result']['message']);}})['catch'](function(_0x3b7e90){logger['error'](_0x611e('0x11'),_0x537233,_0x3b7e90);_0x4e8101(_0x3b7e90);});});}exports['UpdateSmsInteraction']=function(_0x23495b){var _0x3d3771=this;return new Promise(function(_0x30ca6,_0x57b9a0){return db[_0x611e('0x19')]['update'](_0x23495b[_0x611e('0x1a')],{'raw':_0x23495b[_0x611e('0x1b')]?_0x23495b[_0x611e('0x1b')][_0x611e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23495b['options']?_0x23495b['options'][_0x611e('0x1d')]||null:null,'attributes':_0x23495b['options']?_0x23495b[_0x611e('0x1b')][_0x611e('0x1e')]||null:null,'limit':_0x23495b['options']?_0x23495b[_0x611e('0x1b')][_0x611e('0x1f')]||null:null})[_0x611e('0x10')](function(_0x182f0a){logger['info'](_0x611e('0x20'),_0x23495b);logger[_0x611e('0x12')](_0x611e('0x20'),_0x23495b,JSON['stringify'](_0x182f0a));_0x30ca6(_0x182f0a);})[_0x611e('0x21')](function(_0x28913b){logger[_0x611e('0x15')]('UpdateSmsInteraction',_0x28913b[_0x611e('0x17')],_0x23495b);_0x57b9a0(_0x3d3771[_0x611e('0x15')](0x1f4,_0x28913b[_0x611e('0x17')]));});});};exports[_0x611e('0x22')]=function(_0x8d2bde){return new Promise(function(_0x5f0c08,_0x17eb8b){return db[_0x611e('0x19')][_0x611e('0x23')]({'where':_0x8d2bde[_0x611e('0x1b')]?_0x8d2bde[_0x611e('0x1b')][_0x611e('0x1d')]||null:null})[_0x611e('0x10')](function(_0x147e08){if(_0x147e08){return _0x147e08[_0x611e('0x24')](_0x8d2bde[_0x611e('0x1a')][_0x611e('0x25')],_[_0x611e('0x26')](_0x8d2bde[_0x611e('0x1a')],[_0x611e('0x25'),'id'])||{});}})[_0x611e('0x27')](function(_0x5c458f){logger[_0x611e('0x18')](_0x611e('0x28'),_0x8d2bde);logger[_0x611e('0x12')](_0x611e('0x28'),_0x8d2bde,JSON['stringify'](_0x5c458f));_0x5f0c08(_0x5c458f);})[_0x611e('0x21')](function(_0x2672f0){logger[_0x611e('0x15')](_0x611e('0x28'),_0x2672f0['message'],_0x8d2bde);_0x17eb8b(_this[_0x611e('0x15')](0x1f4,_0x2672f0[_0x611e('0x17')]));});});}; \ No newline at end of file +var _0x6e0d=['then','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x2549ec,_0x20c37e){var _0x30fb2d=function(_0x581287){while(--_0x581287){_0x2549ec['push'](_0x2549ec['shift']());}};_0x30fb2d(++_0x20c37e);}(_0x6e0d,0xbd));var _0xd6e0=function(_0x5dcbc,_0x5cb291){_0x5dcbc=_0x5dcbc-0x0;var _0x4339ef=_0x6e0d[_0x5dcbc];return _0x4339ef;};'use strict';var _=require('lodash');var util=require(_0xd6e0('0x0'));var moment=require(_0xd6e0('0x1'));var BPromise=require(_0xd6e0('0x2'));var rs=require(_0xd6e0('0x3'));var fs=require('fs');var Redis=require(_0xd6e0('0x4'));var db=require(_0xd6e0('0x5'))['db'];var utils=require(_0xd6e0('0x6'));var logger=require(_0xd6e0('0x7'))('rpc');var config=require(_0xd6e0('0x8'));var jayson=require(_0xd6e0('0x9'));var client=jayson[_0xd6e0('0xa')][_0xd6e0('0xb')]({'port':0x232a});config['redis']=_[_0xd6e0('0xc')](config[_0xd6e0('0xd')],{'host':_0xd6e0('0xe'),'port':0x18eb});var socket=require(_0xd6e0('0xf'))(new Redis(config[_0xd6e0('0xd')]));require(_0xd6e0('0x10'))[_0xd6e0('0x11')](socket);function respondWithRpcPromise(_0xeeabef,_0x509744,_0x27c03e){return new BPromise(function(_0x365fa8,_0x8ab3f8){return client['request'](_0xeeabef,_0x27c03e)['then'](function(_0x457ed5){logger[_0xd6e0('0x12')](_0xd6e0('0x13'),_0x509744,'request\x20sent');logger[_0xd6e0('0x14')](_0xd6e0('0x15'),_0x509744,_0xd6e0('0x16'),JSON['stringify'](_0x457ed5));if(_0x457ed5[_0xd6e0('0x17')]){if(_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x18')]===0x1f4){logger[_0xd6e0('0x17')](_0xd6e0('0x13'),_0x509744,_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x19')]);return _0x8ab3f8(_0x457ed5['error'][_0xd6e0('0x19')]);}logger['error'](_0xd6e0('0x13'),_0x509744,_0x457ed5['error'][_0xd6e0('0x19')]);return _0x365fa8(_0x457ed5[_0xd6e0('0x17')][_0xd6e0('0x19')]);}else{logger[_0xd6e0('0x12')](_0xd6e0('0x13'),_0x509744,'request\x20sent');_0x365fa8(_0x457ed5['result']['message']);}})[_0xd6e0('0x1a')](function(_0x519537){logger[_0xd6e0('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x509744,_0x519537);_0x8ab3f8(_0x519537);});});}exports[_0xd6e0('0x1b')]=function(_0x5d5b9a){var _0x507622=this;return new Promise(function(_0x5f36e1,_0x13f349){return db[_0xd6e0('0x1c')][_0xd6e0('0x1d')](_0x5d5b9a[_0xd6e0('0x1e')],{'raw':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a[_0xd6e0('0x1f')][_0xd6e0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a['options'][_0xd6e0('0x21')]||null:null,'attributes':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a['options'][_0xd6e0('0x22')]||null:null,'limit':_0x5d5b9a[_0xd6e0('0x1f')]?_0x5d5b9a[_0xd6e0('0x1f')][_0xd6e0('0x23')]||null:null})[_0xd6e0('0x24')](function(_0x38fa1d){logger['info'](_0xd6e0('0x1b'),_0x5d5b9a);logger['debug'](_0xd6e0('0x1b'),_0x5d5b9a,JSON[_0xd6e0('0x25')](_0x38fa1d));_0x5f36e1(_0x38fa1d);})[_0xd6e0('0x1a')](function(_0x4139d2){logger[_0xd6e0('0x17')](_0xd6e0('0x1b'),_0x4139d2[_0xd6e0('0x19')],_0x5d5b9a);_0x13f349(_0x507622[_0xd6e0('0x17')](0x1f4,_0x4139d2[_0xd6e0('0x19')]));});});};exports[_0xd6e0('0x26')]=function(_0x30c159){return new Promise(function(_0x443810,_0x47961e){return db[_0xd6e0('0x1c')][_0xd6e0('0x27')]({'where':_0x30c159['options']?_0x30c159['options']['where']||null:null})[_0xd6e0('0x24')](function(_0x454f6d){if(_0x454f6d){return _0x454f6d[_0xd6e0('0x28')](_0x30c159[_0xd6e0('0x1e')][_0xd6e0('0x29')],_[_0xd6e0('0x2a')](_0x30c159[_0xd6e0('0x1e')],[_0xd6e0('0x29'),'id'])||{});}})[_0xd6e0('0x2b')](function(_0x31d551){logger[_0xd6e0('0x12')]('AddTags',_0x30c159);logger['debug'](_0xd6e0('0x2c'),_0x30c159,JSON['stringify'](_0x31d551));_0x443810(_0x31d551);})[_0xd6e0('0x1a')](function(_0x1a1374){logger[_0xd6e0('0x17')](_0xd6e0('0x2c'),_0x1a1374[_0xd6e0('0x19')],_0x30c159);_0x47961e(_this[_0xd6e0('0x17')](0x1f4,_0x1a1374[_0xd6e0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0b3866b..026d6b3 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 _0xfe95=['save','update','emit','removeListener','length','./smsInteraction.events'];(function(_0x308279,_0x515b74){var _0xf33ea7=function(_0x4b95b8){while(--_0x4b95b8){_0x308279['push'](_0x308279['shift']());}};_0xf33ea7(++_0x515b74);}(_0xfe95,0xa1));var _0x5fe9=function(_0x1e5bac,_0x2c5987){_0x1e5bac=_0x1e5bac-0x0;var _0x341bef=_0xfe95[_0x1e5bac];return _0x341bef;};'use strict';var SmsInteractionEvents=require(_0x5fe9('0x0'));var events=[_0x5fe9('0x1'),'remove',_0x5fe9('0x2')];function createListener(_0x3a4f39,_0x31c1ac){return function(_0x28e103){_0x31c1ac[_0x5fe9('0x3')](_0x3a4f39,_0x28e103);};}function removeListener(_0x866ef,_0x306c66){return function(){SmsInteractionEvents[_0x5fe9('0x4')](_0x866ef,_0x306c66);};}exports['register']=function(_0x52908b){for(var _0x1b3d35=0x0,_0x246194=events[_0x5fe9('0x5')];_0x1b3d35<_0x246194;_0x1b3d35++){var _0x28f46b=events[_0x1b3d35];var _0x3fe1e2=createListener('smsInteraction:'+_0x28f46b,_0x52908b);SmsInteractionEvents['on'](_0x28f46b,_0x3fe1e2);}}; \ No newline at end of file +var _0xc926=['smsInteraction:','save','remove','update','emit','removeListener','length'];(function(_0xb30b6b,_0x204198){var _0x3ac554=function(_0x57b8f1){while(--_0x57b8f1){_0xb30b6b['push'](_0xb30b6b['shift']());}};_0x3ac554(++_0x204198);}(_0xc926,0x1ac));var _0x6c92=function(_0x55bcbb,_0x4fdca6){_0x55bcbb=_0x55bcbb-0x0;var _0x4c98d2=_0xc926[_0x55bcbb];return _0x4c98d2;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x6c92('0x0'),_0x6c92('0x1'),_0x6c92('0x2')];function createListener(_0x106792,_0x280694){return function(_0x4d5c39){_0x280694[_0x6c92('0x3')](_0x106792,_0x4d5c39);};}function removeListener(_0x11ee9f,_0x4b9031){return function(){SmsInteractionEvents[_0x6c92('0x4')](_0x11ee9f,_0x4b9031);};}exports['register']=function(_0xf17737){for(var _0x3aac18=0x0,_0x21bf8b=events[_0x6c92('0x5')];_0x3aac18<_0x21bf8b;_0x3aac18++){var _0x470741=events[_0x3aac18];var _0x351fca=createListener(_0x6c92('0x6')+_0x470741,_0xf17737);SmsInteractionEvents['on'](_0x470741,_0x351fca);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index eb88c17..bb0929c 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 _0xd33a=['get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x5ad9fc,_0x70790){var _0x5330d5=function(_0x3be1ca){while(--_0x3be1ca){_0x5ad9fc['push'](_0x5ad9fc['shift']());}};_0x5330d5(++_0x70790);}(_0xd33a,0x123));var _0xad33=function(_0xa4bb55,_0x19dc80){_0xa4bb55=_0xa4bb55-0x0;var _0x5d7d2b=_0xd33a[_0xa4bb55];return _0x5d7d2b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xad33('0x0'));var express=require(_0xad33('0x1'));var router=express['Router']();var fs_extra=require(_0xad33('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xad33('0x3'));var config=require(_0xad33('0x4'));var controller=require(_0xad33('0x5'));router[_0xad33('0x6')]('/',auth['isAuthenticated'](),controller[_0xad33('0x7')]);router[_0xad33('0x6')](_0xad33('0x8'),auth[_0xad33('0x9')](),controller[_0xad33('0xa')]);router[_0xad33('0x6')](_0xad33('0xb'),auth[_0xad33('0x9')](),controller[_0xad33('0xc')]);router[_0xad33('0xd')]('/',auth['isAuthenticated'](),interaction[_0xad33('0xe')](_0xad33('0xf'),'smsmessage:create'),controller[_0xad33('0x10')]);router[_0xad33('0xd')](_0xad33('0x11'),controller[_0xad33('0x12')]);router[_0xad33('0x13')](_0xad33('0xb'),auth['isAuthenticated'](),controller[_0xad33('0x14')]);router['put'](_0xad33('0x15'),auth[_0xad33('0x9')](),controller[_0xad33('0x16')]);router[_0xad33('0x13')](_0xad33('0x17'),auth[_0xad33('0x9')](),controller[_0xad33('0x18')]);router[_0xad33('0x19')](_0xad33('0xb'),auth[_0xad33('0x9')](),controller[_0xad33('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6f1e=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','/:id','destroy'];(function(_0x291df7,_0x4d98bf){var _0x5c10cd=function(_0x450757){while(--_0x450757){_0x291df7['push'](_0x291df7['shift']());}};_0x5c10cd(++_0x4d98bf);}(_0x6f1e,0x78));var _0xe6f1=function(_0x31115a,_0x456073){_0x31115a=_0x31115a-0x0;var _0x2fc9f4=_0x6f1e[_0x31115a];return _0x2fc9f4;};'use strict';var multer=require(_0xe6f1('0x0'));var util=require(_0xe6f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6f1('0x2'));var interaction=require(_0xe6f1('0x3'));var config=require(_0xe6f1('0x4'));var controller=require(_0xe6f1('0x5'));router[_0xe6f1('0x6')]('/',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x8')]);router[_0xe6f1('0x6')]('/describe',auth[_0xe6f1('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x9')]);router[_0xe6f1('0xa')]('/',auth[_0xe6f1('0x7')](),interaction[_0xe6f1('0xb')](_0xe6f1('0xc'),_0xe6f1('0xd')),controller[_0xe6f1('0xe')]);router[_0xe6f1('0xa')](_0xe6f1('0xf'),controller[_0xe6f1('0x10')]);router[_0xe6f1('0x11')]('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x12')]);router[_0xe6f1('0x11')](_0xe6f1('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xe6f1('0x11')](_0xe6f1('0x14'),auth[_0xe6f1('0x7')](),controller['reject']);router[_0xe6f1('0x15')](_0xe6f1('0x16'),auth[_0xe6f1('0x7')](),controller[_0xe6f1('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 4285e2e..eae3f27 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 _0xc5dd=['out','STRING','BOOLEAN','TEXT','sequelize','exports','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc5dd,0x170));var _0xdc5d=function(_0x122ad9,_0x14fc03){_0x122ad9=_0x122ad9-0x0;var _0x3cd350=_0xc5dd[_0x122ad9];return _0x3cd350;};'use strict';var Sequelize=require(_0xdc5d('0x0'));module[_0xdc5d('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc5d('0x2')]('in',_0xdc5d('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xdc5d('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xdc5d('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdc5d('0x4')]},'providerResponse':{'type':Sequelize[_0xdc5d('0x6')]}}; \ No newline at end of file +var _0xa14b=['sequelize','exports','TEXT','ENUM','out','STRING','DATE','BOOLEAN'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa14b,0x68));var _0xba14=function(_0x2258bb,_0x337f26){_0x2258bb=_0x2258bb-0x0;var _0x22c2c1=_0xa14b[_0x2258bb];return _0x22c2c1;};'use strict';var Sequelize=require(_0xba14('0x0'));module[_0xba14('0x1')]={'body':{'type':Sequelize[_0xba14('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xba14('0x3')]('in','out'),'defaultValue':_0xba14('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xba14('0x5')]},'readAt':{'type':Sequelize[_0xba14('0x6')]},'secret':{'type':Sequelize[_0xba14('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xba14('0x5')]},'providerResponse':{'type':Sequelize[_0xba14('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ebb0dee..7f0365e 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 _0xd7d5=['create','body','describe','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','SmsAccount','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','inspect','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','map','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SmsMessage','catch','params','find'];(function(_0x5a0c81,_0x28a9c3){var _0x15f201=function(_0x3f8a1d){while(--_0x3f8a1d){_0x5a0c81['push'](_0x5a0c81['shift']());}};_0x15f201(++_0x28a9c3);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x53885b,_0x4a30eb){_0x53885b=_0x53885b-0x0;var _0x59c53b=_0xd7d5[_0x53885b];return _0x59c53b;};'use strict';var emlformat=require(_0x5d7d('0x0'));var rimraf=require(_0x5d7d('0x1'));var zipdir=require(_0x5d7d('0x2'));var jsonpatch=require(_0x5d7d('0x3'));var rp=require(_0x5d7d('0x4'));var moment=require(_0x5d7d('0x5'));var BPromise=require(_0x5d7d('0x6'));var Mustache=require('mustache');var util=require(_0x5d7d('0x7'));var path=require('path');var sox=require(_0x5d7d('0x8'));var csv=require(_0x5d7d('0x9'));var ejs=require(_0x5d7d('0xa'));var fs=require('fs');var fs_extra=require(_0x5d7d('0xb'));var _=require(_0x5d7d('0xc'));var squel=require(_0x5d7d('0xd'));var crypto=require(_0x5d7d('0xe'));var jsforce=require(_0x5d7d('0xf'));var deskjs=require(_0x5d7d('0x10'));var toCsv=require(_0x5d7d('0x9'));var querystring=require('querystring');var Papa=require(_0x5d7d('0x11'));var Redis=require(_0x5d7d('0x12'));var authService=require(_0x5d7d('0x13'));var qs=require(_0x5d7d('0x14'));var as=require(_0x5d7d('0x15'));var hardwareService=require(_0x5d7d('0x16'));var logger=require(_0x5d7d('0x17'))(_0x5d7d('0x18'));var utils=require(_0x5d7d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5d7d('0x1a'));var db=require(_0x5d7d('0x1b'))['db'];config[_0x5d7d('0x1c')]=_['defaults'](config[_0x5d7d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d7d('0x1d'))[_0x5d7d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5d7d('0x1f')]({'port':0x232c});var client9002=jayson[_0x5d7d('0x20')][_0x5d7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x159c5a,_0x3d687b,_0x5d8d8c,_0x4a07d2){return new BPromise(function(_0x4dc832,_0x14b449){var _0x1f2154=_0x4a07d2||client;return _0x1f2154[_0x5d7d('0x21')](_0x159c5a,_0x5d8d8c)[_0x5d7d('0x22')](function(_0x1aa4f5){logger[_0x5d7d('0x23')](_0x5d7d('0x24'),_0x3d687b,_0x5d7d('0x25'));logger[_0x5d7d('0x26')](_0x5d7d('0x27'),_0x3d687b,_0x5d7d('0x25'),JSON['stringify'](_0x1aa4f5));if(_0x1aa4f5[_0x5d7d('0x28')]){if(_0x1aa4f5['error']['code']===0x1f4){logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);return _0x14b449(_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);}logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);return _0x4dc832(_0x1aa4f5[_0x5d7d('0x28')]['message']);}else{logger[_0x5d7d('0x23')](_0x5d7d('0x24'),_0x3d687b,_0x5d7d('0x25'));_0x4dc832(_0x1aa4f5[_0x5d7d('0x2a')]['message']);}})['catch'](function(_0x14002a){logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x14002a);_0x14b449(_0x14002a);});});}function respondWithStatusCode(_0x5b855e,_0x4132a9){_0x4132a9=_0x4132a9||0xcc;return function(_0x509e77){if(_0x509e77){return _0x5b855e[_0x5d7d('0x2b')](_0x4132a9);}return _0x5b855e[_0x5d7d('0x2c')](_0x4132a9)[_0x5d7d('0x2d')]();};}function respondWithResult(_0x5a224a,_0x371a78){_0x371a78=_0x371a78||0xc8;return function(_0xfa9b42){if(_0xfa9b42){return _0x5a224a[_0x5d7d('0x2c')](_0x371a78)['json'](_0xfa9b42);}};}function respondWithFilteredResult(_0x187030,_0x4ed00c){return function(_0x126873){if(_0x126873){var _0x18545f=typeof _0x4ed00c[_0x5d7d('0x2e')]===_0x5d7d('0x2f')&&typeof _0x4ed00c[_0x5d7d('0x30')]==='undefined';var _0x211166=_0x126873[_0x5d7d('0x31')];var _0x1ff099=_0x18545f?0x0:_0x4ed00c[_0x5d7d('0x2e')];var _0x4c588c=_0x18545f?_0x126873[_0x5d7d('0x31')]:_0x4ed00c[_0x5d7d('0x2e')]+_0x4ed00c[_0x5d7d('0x30')];var _0x35d550;if(_0x4c588c>=_0x211166){_0x4c588c=_0x211166;_0x35d550=0xc8;}else{_0x35d550=0xce;}_0x187030['status'](_0x35d550);return _0x187030[_0x5d7d('0x32')](_0x5d7d('0x33'),_0x1ff099+'-'+_0x4c588c+'/'+_0x211166)[_0x5d7d('0x34')](_0x126873);}return null;};}function patchUpdates(_0x563244){return function(_0x48afcb){try{jsonpatch[_0x5d7d('0x35')](_0x48afcb,_0x563244,!![]);}catch(_0x2ad100){return BPromise['reject'](_0x2ad100);}return _0x48afcb[_0x5d7d('0x36')]();};}function saveUpdates(_0xee91b6,_0x2da4ac){return function(_0x393619){if(_0x393619){return _0x393619[_0x5d7d('0x37')](_0xee91b6)[_0x5d7d('0x22')](function(_0x290c79){return _0x290c79;});}return null;};}function removeEntity(_0x5ced5b,_0xfc005c){return function(_0xffd878){if(_0xffd878){return _0xffd878[_0x5d7d('0x38')]()[_0x5d7d('0x22')](function(){_0x5ced5b['status'](0xcc)[_0x5d7d('0x2d')]();});}};}function handleEntityNotFound(_0x306cd1,_0x42c076){return function(_0x4b0b10){if(!_0x4b0b10){_0x306cd1[_0x5d7d('0x2b')](0x194);}return _0x4b0b10;};}function handleError(_0x141680,_0x5cbdbd){_0x5cbdbd=_0x5cbdbd||0x1f4;return function(_0x28c437){logger[_0x5d7d('0x28')](_0x28c437[_0x5d7d('0x39')]);if(_0x28c437['name']){delete _0x28c437['name'];}_0x141680[_0x5d7d('0x2c')](_0x5cbdbd)['send'](_0x28c437);};}exports['index']=function(_0xcce177,_0x3177b4){var _0x525957={},_0x132cef={},_0x55a6c8={'count':0x0,'rows':[]};var _0x13ccb2=_[_0x5d7d('0x3a')](db['SmsMessage'][_0x5d7d('0x3b')],function(_0x548aa3){return{'name':_0x548aa3['fieldName'],'type':_0x548aa3[_0x5d7d('0x3c')][_0x5d7d('0x3d')]};});_0x132cef['model']=_[_0x5d7d('0x3a')](_0x13ccb2,_0x5d7d('0x3e'));_0x132cef[_0x5d7d('0x3f')]=_[_0x5d7d('0x40')](_0xcce177[_0x5d7d('0x3f')]);_0x132cef[_0x5d7d('0x41')]=_[_0x5d7d('0x42')](_0x132cef[_0x5d7d('0x43')],_0x132cef[_0x5d7d('0x3f')]);_0x525957[_0x5d7d('0x44')]=_[_0x5d7d('0x42')](_0x132cef[_0x5d7d('0x43')],qs[_0x5d7d('0x45')](_0xcce177[_0x5d7d('0x3f')]['fields']));_0x525957[_0x5d7d('0x44')]=_0x525957['attributes'][_0x5d7d('0x46')]?_0x525957[_0x5d7d('0x44')]:_0x132cef[_0x5d7d('0x43')];if(!_0xcce177['query'][_0x5d7d('0x47')](_0x5d7d('0x48'))){_0x525957[_0x5d7d('0x30')]=qs[_0x5d7d('0x30')](_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x30')]);_0x525957['offset']=qs[_0x5d7d('0x2e')](_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x2e')]);}_0x525957[_0x5d7d('0x49')]=qs[_0x5d7d('0x4a')](_0xcce177['query'][_0x5d7d('0x4a')]);_0x525957[_0x5d7d('0x4b')]=qs[_0x5d7d('0x41')](_[_0x5d7d('0x4c')](_0xcce177[_0x5d7d('0x3f')],_0x132cef[_0x5d7d('0x41')]),_0x13ccb2);if(_0xcce177['query'][_0x5d7d('0x4d')]){_0x525957[_0x5d7d('0x4b')]=_['merge'](_0x525957[_0x5d7d('0x4b')],{'$or':_[_0x5d7d('0x3a')](_0x13ccb2,function(_0x5e0e66){if(_0x5e0e66[_0x5d7d('0x3c')]!=='VIRTUAL'){var _0x42ec26={};_0x42ec26[_0x5e0e66[_0x5d7d('0x3e')]]={'$like':'%'+_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x4d')]+'%'};return _0x42ec26;}})});}_0x525957=_[_0x5d7d('0x4e')]({},_0x525957,_0xcce177[_0x5d7d('0x4f')]);var _0x1a817c={'where':_0x525957[_0x5d7d('0x4b')]};return db['SmsMessage']['count'](_0x1a817c)[_0x5d7d('0x22')](function(_0x19fc1f){_0x55a6c8['count']=_0x19fc1f;if(_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x50')]){_0x525957[_0x5d7d('0x51')]=[{'all':!![]}];}return db[_0x5d7d('0x52')]['findAll'](_0x525957);})[_0x5d7d('0x22')](function(_0x29512f){_0x55a6c8['rows']=_0x29512f;return _0x55a6c8;})[_0x5d7d('0x22')](respondWithFilteredResult(_0x3177b4,_0x525957))[_0x5d7d('0x53')](handleError(_0x3177b4,null));};exports['show']=function(_0x5100d7,_0x3faf11){var _0x56832a={'raw':!![],'where':{'id':_0x5100d7[_0x5d7d('0x54')]['id']}},_0x4f4c96={};_0x4f4c96[_0x5d7d('0x43')]=_[_0x5d7d('0x40')](db[_0x5d7d('0x52')][_0x5d7d('0x3b')]);_0x4f4c96['query']=_[_0x5d7d('0x40')](_0x5100d7['query']);_0x4f4c96['filters']=_['intersection'](_0x4f4c96[_0x5d7d('0x43')],_0x4f4c96['query']);_0x56832a[_0x5d7d('0x44')]=_[_0x5d7d('0x42')](_0x4f4c96['model'],qs[_0x5d7d('0x45')](_0x5100d7['query'][_0x5d7d('0x45')]));_0x56832a[_0x5d7d('0x44')]=_0x56832a[_0x5d7d('0x44')][_0x5d7d('0x46')]?_0x56832a[_0x5d7d('0x44')]:_0x4f4c96[_0x5d7d('0x43')];if(_0x5100d7[_0x5d7d('0x3f')]['includeAll']){_0x56832a['include']=[{'all':!![]}];}_0x56832a=_[_0x5d7d('0x4e')]({},_0x56832a,_0x5100d7[_0x5d7d('0x4f')]);return db[_0x5d7d('0x52')][_0x5d7d('0x55')](_0x56832a)['then'](handleEntityNotFound(_0x3faf11,null))['then'](respondWithResult(_0x3faf11,null))['catch'](handleError(_0x3faf11,null));};exports[_0x5d7d('0x56')]=function(_0x347ed8,_0x43effb){return db[_0x5d7d('0x52')][_0x5d7d('0x56')](_0x347ed8[_0x5d7d('0x57')],{})[_0x5d7d('0x22')](respondWithResult(_0x43effb,0xc9))['catch'](handleError(_0x43effb,null));};exports['update']=function(_0x4aa73d,_0x3675de){if(_0x4aa73d[_0x5d7d('0x57')]['id']){delete _0x4aa73d[_0x5d7d('0x57')]['id'];}return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x4aa73d['params']['id']}})['then'](handleEntityNotFound(_0x3675de,null))[_0x5d7d('0x22')](saveUpdates(_0x4aa73d['body'],null))[_0x5d7d('0x22')](respondWithResult(_0x3675de,null))[_0x5d7d('0x53')](handleError(_0x3675de,null));};exports[_0x5d7d('0x38')]=function(_0x3844e4,_0x556db3){return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x3844e4['params']['id']}})[_0x5d7d('0x22')](handleEntityNotFound(_0x556db3,null))['then'](removeEntity(_0x556db3,null))[_0x5d7d('0x53')](handleError(_0x556db3,null));};exports[_0x5d7d('0x58')]=function(_0x3d70cf,_0x569214){return db['SmsMessage'][_0x5d7d('0x58')]()[_0x5d7d('0x22')](respondWithResult(_0x569214,null))[_0x5d7d('0x53')](handleError(_0x569214,null));};var interaction_log=require(_0x5d7d('0x17'))(_0x5d7d('0x59'));exports[_0x5d7d('0x5a')]=function(_0x1981de,_0x5df345,_0x301159){var _0x1ba205={'agent':{},'channel':_0x5d7d('0x5b')};if(_0x1981de[_0x5d7d('0x57')]['id']){delete _0x1981de[_0x5d7d('0x57')]['id'];}_0x1981de[_0x5d7d('0x57')]['read']=!![];_0x1981de[_0x5d7d('0x57')]['readAt']=moment()[_0x5d7d('0x5c')](_0x5d7d('0x5d'));_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')]=_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')]||_0x1981de['user']['id'];_0x1ba205[_0x5d7d('0x5f')]['id']=_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')];return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x1981de[_0x5d7d('0x54')]['id'],'UserId':null}})[_0x5d7d('0x22')](handleEntityNotFound(_0x5df345,null))[_0x5d7d('0x22')](saveUpdates(_0x1981de[_0x5d7d('0x57')],null))[_0x5d7d('0x22')](function(_0x5b0f8a){if(_0x5b0f8a){_0x1ba205['message']=_0x5b0f8a[_0x5d7d('0x60')]({'plain':!![]});return db[_0x5d7d('0x61')][_0x5d7d('0x55')]({'where':{'id':_0x5b0f8a['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5df345,null))['then'](function(_0x5af086){if(_0x5af086){return _0x5af086[_0x5d7d('0x37')]({'UserId':_0x1981de['body'][_0x5d7d('0x5e')],'read1stAt':_[_0x5d7d('0x62')](_0x5af086[_0x5d7d('0x63')])?moment()['format'](_0x5d7d('0x5d')):undefined});}return null;})[_0x5d7d('0x22')](function(_0x2dd81c){if(_0x2dd81c){_0x1ba205['interaction']=_0x2dd81c[_0x5d7d('0x60')]({'plain':!![]});interaction_log[_0x5d7d('0x23')](_0x5d7d('0x64'),_0x1981de[_0x5d7d('0x65')]['id'],_0x1981de['user'][_0x5d7d('0x3e')],_0x1981de[_0x5d7d('0x65')]['role'],_0x1ba205['interaction']['id'],_0x1981de['body']?JSON[_0x5d7d('0x66')](_0x1981de['body']):'null');return respondWithRpcPromise(_0x5d7d('0x67'),_0x5d7d('0x68'),_0x1ba205);}return null;})[_0x5d7d('0x22')](function(_0x5154ca){var _0x19864a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5154ca[_0x5d7d('0x29')][_0x5d7d('0x69')];return db[_0x5d7d('0x6a')][_0x5d7d('0x3f')](_0x19864a,{'type':db[_0x5d7d('0x6b')][_0x5d7d('0x6c')][_0x5d7d('0x6d')],'raw':!![]})[_0x5d7d('0x22')](function(_0x4c30e5){return _0x4c30e5;});})[_0x5d7d('0x22')](function(_0x5d9e2d){if(_0x5d9e2d){_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x6e')]=_0x5d9e2d[0x0];if(!_0x1981de[_0x5d7d('0x57')]['UserId'])return;return db[_0x5d7d('0x6f')][_0x5d7d('0x55')]({'where':{'id':_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')],'role':_0x5d7d('0x5f')},'attributes':['id',_0x5d7d('0x3e'),_0x5d7d('0x70'),_0x5d7d('0x71'),_0x5d7d('0x72')],'raw':!![]});}return null;})[_0x5d7d('0x22')](function(_0x19a858){if(!_0x19a858)return null;_0x1ba205[_0x5d7d('0x29')]['agent']=_0x19a858;return _0x1ba205;})[_0x5d7d('0x22')](function(_0x2dfcb2){if(_0x2dfcb2){if(_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x73')]){_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x74')]=util[_0x5d7d('0x5c')]('SIP/%s',_0x1981de['user']['name']);_0x1ba205[_0x5d7d('0x29')]['channel']=_0x1ba205[_0x5d7d('0x75')];_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x76')]=_0x1ba205['channel'];_0x1ba205['message'][_0x5d7d('0x77')]=_0x5d7d('0x5a');return respondWithRpcPromise(_0x5d7d('0x78'),_0x5d7d('0x78'),{'event':_0x5d7d('0x79'),'message':_0x1ba205['message']},client9002)['then'](function(){return _0x1ba205;});}return _0x1ba205;}return null;})[_0x5d7d('0x22')](respondWithResult(_0x5df345,null))[_0x5d7d('0x53')](handleError(_0x5df345,null));};var interaction_log=require(_0x5d7d('0x17'))(_0x5d7d('0x59'));exports[_0x5d7d('0x7a')]=function(_0x7adacc,_0x1459e1,_0x393f7f){var _0x358225={'agent':{},'channel':_0x5d7d('0x5b')};if(_0x7adacc[_0x5d7d('0x57')]['id']){delete _0x7adacc[_0x5d7d('0x57')]['id'];}_0x7adacc['body'][_0x5d7d('0x5e')]=_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')]||_0x7adacc[_0x5d7d('0x65')]['id'];_0x358225[_0x5d7d('0x5f')]['id']=_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x7adacc[_0x5d7d('0x54')]['id'],'UserId':null}})[_0x5d7d('0x22')](handleEntityNotFound(_0x1459e1,null))[_0x5d7d('0x22')](function(_0x41440f){if(_0x41440f){_0x358225['message']=_0x41440f[_0x5d7d('0x60')]({'plain':!![]});return db[_0x5d7d('0x61')][_0x5d7d('0x55')]({'where':{'id':_0x41440f['SmsInteractionId']}});}return null;})[_0x5d7d('0x22')](handleEntityNotFound(_0x1459e1,null))[_0x5d7d('0x22')](function(_0x1a2ea1){if(_0x1a2ea1){_0x358225[_0x5d7d('0x7b')]=_0x1a2ea1[_0x5d7d('0x60')]({'plain':!![]});interaction_log['info'](_0x5d7d('0x7c'),_0x7adacc['user']['id'],_0x7adacc[_0x5d7d('0x65')]['name'],_0x7adacc[_0x5d7d('0x65')]['role'],_0x358225['interaction']['id'],_0x7adacc[_0x5d7d('0x57')]?JSON['stringify'](_0x7adacc[_0x5d7d('0x57')]):'null');return respondWithRpcPromise(_0x5d7d('0x7d'),_0x5d7d('0x7e'),_0x358225);}return null;})['then'](function(_0x4b9eb5){var _0x4b1fde=_0x5d7d('0x7f')+_0x4b9eb5[_0x5d7d('0x29')][_0x5d7d('0x69')];return db['sequelize'][_0x5d7d('0x3f')](_0x4b1fde,{'type':db['Sequelize'][_0x5d7d('0x6c')][_0x5d7d('0x6d')],'raw':!![]})['then'](function(_0x4866ea){return _0x4866ea;});})[_0x5d7d('0x22')](function(_0x3861b0){if(_0x3861b0){_0x358225[_0x5d7d('0x29')][_0x5d7d('0x6e')]=_0x3861b0[0x0];if(!_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')])return;return db[_0x5d7d('0x6f')]['find']({'where':{'id':_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')],'role':_0x5d7d('0x5f')},'attributes':['id',_0x5d7d('0x3e'),_0x5d7d('0x70'),_0x5d7d('0x71'),_0x5d7d('0x72')],'raw':!![]});}return null;})[_0x5d7d('0x22')](function(_0x481a3c){if(!_0x481a3c)return null;_0x358225[_0x5d7d('0x29')][_0x5d7d('0x5f')]=_0x481a3c;return _0x358225;})[_0x5d7d('0x22')](function(_0x488b9e){if(_0x488b9e){_0x488b9e[_0x5d7d('0x29')][_0x5d7d('0x74')]=util[_0x5d7d('0x5c')]('SIP/%s',_0x7adacc[_0x5d7d('0x65')][_0x5d7d('0x3e')]);_0x488b9e[_0x5d7d('0x29')][_0x5d7d('0x75')]=_0x358225[_0x5d7d('0x75')];_0x488b9e[_0x5d7d('0x29')]['motionChannel']=_0x358225[_0x5d7d('0x75')];_0x488b9e[_0x5d7d('0x29')]['event']=_0x5d7d('0x7a');respondWithRpcPromise(_0x5d7d('0x78'),_0x5d7d('0x78'),{'event':_0x5d7d('0x80'),'message':_0x488b9e['message']},client9002);return _0x358225;}return null;})[_0x5d7d('0x22')](respondWithResult(_0x1459e1,null))['catch'](handleError(_0x1459e1,null));};exports[_0x5d7d('0x2c')]=function(_0x2ec919,_0x272ea7,_0x36fa7c){if(_0x2ec919[_0x5d7d('0x57')]['id']){delete _0x2ec919[_0x5d7d('0x57')]['id'];}var _0x1688d6;return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x2ec919[_0x5d7d('0x54')]['id']}})[_0x5d7d('0x22')](handleEntityNotFound(_0x272ea7,null))[_0x5d7d('0x22')](function(_0x5a6779){if(_0x5a6779){_0x1688d6=_0x5a6779;return db[_0x5d7d('0x81')][_0x5d7d('0x55')]({'where':{'id':_0x5a6779['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x272ea7,null))[_0x5d7d('0x22')](function(_0x346c67){if(_0x346c67){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x346c67[_0x5d7d('0x3c')],util['inspect'](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));switch(_0x346c67[_0x5d7d('0x3c')]){case _0x5d7d('0x82'):if(_0x2ec919['body'][_0x5d7d('0x83')]&&_0x2ec919['body'][_0x5d7d('0x83')]===_0x1688d6[_0x5d7d('0x84')]){return _0x1688d6['update']({'read':!![]});}else{logger[_0x5d7d('0x28')](_0x5d7d('0x85'),_0x5d7d('0x2c'),_0x5d7d('0x82'),util['inspect'](_0x2ec919['body'],{'showHidden':![],'depth':null}));}break;case _0x5d7d('0x86'):if(_0x2ec919[_0x5d7d('0x57')][_0x5d7d('0x87')]&&_0x2ec919['body'][_0x5d7d('0x87')]===_0x1688d6[_0x5d7d('0x84')]&&_[_0x5d7d('0x88')]([_0x5d7d('0x89'),_0x5d7d('0x8a')],_0x2ec919['body'][_0x5d7d('0x8b')])>=0x0){return _0x1688d6[_0x5d7d('0x37')]({'read':!![]});}else{logger['error'](_0x5d7d('0x85'),_0x5d7d('0x2c'),'plivio',util[_0x5d7d('0x8c')](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x5d7d('0x8d'):var _0x5cec58=_0x2ec919[_0x5d7d('0x57')][_0x5d7d('0x8e')][0x0];if(_0x5cec58['status'][_0x5d7d('0x8f')]==='DELIVERED'){return _0x1688d6['update']({'read':!![]});}else{logger[_0x5d7d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d7d('0x2c'),_0x5d7d('0x8d'),util[_0x5d7d('0x8c')](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1688d6;}})['then'](respondWithResult(_0x272ea7,null))[_0x5d7d('0x53')](handleError(_0x272ea7,null));}; \ No newline at end of file +var _0x1cdb=['./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','SmsMessage','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','rawAttributes','keys','includeAll','create','body','update','find','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','../../config/logger','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','event','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x3e4419,_0x454b62){var _0x218914=function(_0x5d7eff){while(--_0x5d7eff){_0x3e4419['push'](_0x3e4419['shift']());}};_0x218914(++_0x454b62);}(_0x1cdb,0x117));var _0xb1cd=function(_0x31a597,_0x567f20){_0x31a597=_0x31a597-0x0;var _0x3a8f0e=_0x1cdb[_0x31a597];return _0x3a8f0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb1cd('0x1'));var moment=require(_0xb1cd('0x2'));var BPromise=require(_0xb1cd('0x3'));var Mustache=require(_0xb1cd('0x4'));var util=require(_0xb1cd('0x5'));var path=require(_0xb1cd('0x6'));var sox=require(_0xb1cd('0x7'));var csv=require(_0xb1cd('0x8'));var ejs=require(_0xb1cd('0x9'));var fs=require('fs');var fs_extra=require(_0xb1cd('0xa'));var _=require(_0xb1cd('0xb'));var squel=require(_0xb1cd('0xc'));var crypto=require(_0xb1cd('0xd'));var jsforce=require(_0xb1cd('0xe'));var deskjs=require(_0xb1cd('0xf'));var toCsv=require(_0xb1cd('0x8'));var querystring=require(_0xb1cd('0x10'));var Papa=require(_0xb1cd('0x11'));var Redis=require('ioredis');var authService=require(_0xb1cd('0x12'));var qs=require(_0xb1cd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1cd('0x14'));var logger=require('../../config/logger')(_0xb1cd('0x15'));var utils=require(_0xb1cd('0x16'));var config=require(_0xb1cd('0x17'));var licenseUtil=require(_0xb1cd('0x18'));var db=require(_0xb1cd('0x19'))['db'];config[_0xb1cd('0x1a')]=_[_0xb1cd('0x1b')](config[_0xb1cd('0x1a')],{'host':_0xb1cd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1cd('0x1a')]));require(_0xb1cd('0x1d'))[_0xb1cd('0x1e')](socket);var jayson=require(_0xb1cd('0x1f'));var client=jayson[_0xb1cd('0x20')][_0xb1cd('0x21')]({'port':0x232c});var client9002=jayson[_0xb1cd('0x20')][_0xb1cd('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5055cf,_0x4cbcc4,_0x4e267c,_0xef1d6){return new BPromise(function(_0x2f4584,_0x2cc86e){var _0xbd8d6c=_0xef1d6||client;return _0xbd8d6c[_0xb1cd('0x22')](_0x5055cf,_0x4e267c)[_0xb1cd('0x23')](function(_0xb9dc57){logger[_0xb1cd('0x24')](_0xb1cd('0x25'),_0x4cbcc4,'request\x20sent');logger[_0xb1cd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4cbcc4,_0xb1cd('0x27'),JSON[_0xb1cd('0x28')](_0xb9dc57));if(_0xb9dc57['error']){if(_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2a')]===0x1f4){logger[_0xb1cd('0x29')]('SmsMessage,\x20%s,\x20%s',_0x4cbcc4,_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);return _0x2cc86e(_0xb9dc57[_0xb1cd('0x29')]['message']);}logger[_0xb1cd('0x29')](_0xb1cd('0x25'),_0x4cbcc4,_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);return _0x2f4584(_0xb9dc57[_0xb1cd('0x29')][_0xb1cd('0x2b')]);}else{logger[_0xb1cd('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4cbcc4,_0xb1cd('0x27'));_0x2f4584(_0xb9dc57[_0xb1cd('0x2c')][_0xb1cd('0x2b')]);}})[_0xb1cd('0x2d')](function(_0x4d6288){logger[_0xb1cd('0x29')](_0xb1cd('0x25'),_0x4cbcc4,_0x4d6288);_0x2cc86e(_0x4d6288);});});}function respondWithStatusCode(_0x6d0ec1,_0x49b470){_0x49b470=_0x49b470||0xcc;return function(_0x5c9b3f){if(_0x5c9b3f){return _0x6d0ec1['sendStatus'](_0x49b470);}return _0x6d0ec1[_0xb1cd('0x2e')](_0x49b470)[_0xb1cd('0x2f')]();};}function respondWithResult(_0x4ad880,_0x51d8a8){_0x51d8a8=_0x51d8a8||0xc8;return function(_0xed5006){if(_0xed5006){return _0x4ad880['status'](_0x51d8a8)[_0xb1cd('0x30')](_0xed5006);}};}function respondWithFilteredResult(_0x1eaf78,_0x21606a){return function(_0x3d6524){if(_0x3d6524){var _0xe5e19e=typeof _0x21606a[_0xb1cd('0x31')]===_0xb1cd('0x32')&&typeof _0x21606a[_0xb1cd('0x33')]===_0xb1cd('0x32');var _0x3f44ec=_0x3d6524[_0xb1cd('0x34')];var _0x530cb4=_0xe5e19e?0x0:_0x21606a[_0xb1cd('0x31')];var _0x493173=_0xe5e19e?_0x3d6524[_0xb1cd('0x34')]:_0x21606a[_0xb1cd('0x31')]+_0x21606a[_0xb1cd('0x33')];var _0xcd9f1c;if(_0x493173>=_0x3f44ec){_0x493173=_0x3f44ec;_0xcd9f1c=0xc8;}else{_0xcd9f1c=0xce;}_0x1eaf78[_0xb1cd('0x2e')](_0xcd9f1c);return _0x1eaf78[_0xb1cd('0x35')](_0xb1cd('0x36'),_0x530cb4+'-'+_0x493173+'/'+_0x3f44ec)[_0xb1cd('0x30')](_0x3d6524);}return null;};}function patchUpdates(_0x3e76a5){return function(_0x5a096d){try{jsonpatch['apply'](_0x5a096d,_0x3e76a5,!![]);}catch(_0x43f44c){return BPromise[_0xb1cd('0x37')](_0x43f44c);}return _0x5a096d[_0xb1cd('0x38')]();};}function saveUpdates(_0x3977d4,_0x558352){return function(_0x2b62e0){if(_0x2b62e0){return _0x2b62e0['update'](_0x3977d4)['then'](function(_0x2916e5){return _0x2916e5;});}return null;};}function removeEntity(_0x12b562,_0x4367be){return function(_0x4fb32a){if(_0x4fb32a){return _0x4fb32a[_0xb1cd('0x39')]()[_0xb1cd('0x23')](function(){_0x12b562[_0xb1cd('0x2e')](0xcc)[_0xb1cd('0x2f')]();});}};}function handleEntityNotFound(_0x496761,_0x41c240){return function(_0x167303){if(!_0x167303){_0x496761['sendStatus'](0x194);}return _0x167303;};}function handleError(_0x46ce6a,_0x1455c5){_0x1455c5=_0x1455c5||0x1f4;return function(_0x157360){logger['error'](_0x157360[_0xb1cd('0x3a')]);if(_0x157360[_0xb1cd('0x3b')]){delete _0x157360['name'];}_0x46ce6a['status'](_0x1455c5)['send'](_0x157360);};}exports[_0xb1cd('0x3c')]=function(_0x3c6835,_0x503d55){var _0x4e6a7a={},_0x43780f={},_0x17f8f2={'count':0x0,'rows':[]};var _0x62c8f=_['map'](db[_0xb1cd('0x3d')]['rawAttributes'],function(_0x496a46){return{'name':_0x496a46[_0xb1cd('0x3e')],'type':_0x496a46[_0xb1cd('0x3f')][_0xb1cd('0x40')]};});_0x43780f['model']=_[_0xb1cd('0x41')](_0x62c8f,_0xb1cd('0x3b'));_0x43780f[_0xb1cd('0x42')]=_['keys'](_0x3c6835[_0xb1cd('0x42')]);_0x43780f[_0xb1cd('0x43')]=_[_0xb1cd('0x44')](_0x43780f[_0xb1cd('0x45')],_0x43780f[_0xb1cd('0x42')]);_0x4e6a7a[_0xb1cd('0x46')]=_[_0xb1cd('0x44')](_0x43780f['model'],qs['fields'](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x47')]));_0x4e6a7a[_0xb1cd('0x46')]=_0x4e6a7a[_0xb1cd('0x46')][_0xb1cd('0x48')]?_0x4e6a7a[_0xb1cd('0x46')]:_0x43780f[_0xb1cd('0x45')];if(!_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x49')](_0xb1cd('0x4a'))){_0x4e6a7a[_0xb1cd('0x33')]=qs[_0xb1cd('0x33')](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x33')]);_0x4e6a7a['offset']=qs[_0xb1cd('0x31')](_0x3c6835[_0xb1cd('0x42')]['offset']);}_0x4e6a7a[_0xb1cd('0x4b')]=qs[_0xb1cd('0x4c')](_0x3c6835[_0xb1cd('0x42')][_0xb1cd('0x4c')]);_0x4e6a7a[_0xb1cd('0x4d')]=qs['filters'](_[_0xb1cd('0x4e')](_0x3c6835[_0xb1cd('0x42')],_0x43780f[_0xb1cd('0x43')]),_0x62c8f);if(_0x3c6835['query'][_0xb1cd('0x4f')]){_0x4e6a7a[_0xb1cd('0x4d')]=_[_0xb1cd('0x50')](_0x4e6a7a[_0xb1cd('0x4d')],{'$or':_[_0xb1cd('0x41')](_0x62c8f,function(_0x2cdc89){if(_0x2cdc89[_0xb1cd('0x3f')]!=='VIRTUAL'){var _0x31f49a={};_0x31f49a[_0x2cdc89['name']]={'$like':'%'+_0x3c6835['query'][_0xb1cd('0x4f')]+'%'};return _0x31f49a;}})});}_0x4e6a7a=_['merge']({},_0x4e6a7a,_0x3c6835[_0xb1cd('0x51')]);var _0x5900eb={'where':_0x4e6a7a['where']};return db[_0xb1cd('0x3d')][_0xb1cd('0x34')](_0x5900eb)['then'](function(_0x3ef0b4){_0x17f8f2['count']=_0x3ef0b4;if(_0x3c6835[_0xb1cd('0x42')]['includeAll']){_0x4e6a7a[_0xb1cd('0x52')]=[{'all':!![]}];}return db[_0xb1cd('0x3d')][_0xb1cd('0x53')](_0x4e6a7a);})[_0xb1cd('0x23')](function(_0x2c099c){_0x17f8f2['rows']=_0x2c099c;return _0x17f8f2;})[_0xb1cd('0x23')](respondWithFilteredResult(_0x503d55,_0x4e6a7a))[_0xb1cd('0x2d')](handleError(_0x503d55,null));};exports[_0xb1cd('0x54')]=function(_0x4a8810,_0x1e4a63){var _0x5a5431={'raw':!![],'where':{'id':_0x4a8810['params']['id']}},_0x1bbc16={};_0x1bbc16[_0xb1cd('0x45')]=_['keys'](db[_0xb1cd('0x3d')][_0xb1cd('0x55')]);_0x1bbc16[_0xb1cd('0x42')]=_[_0xb1cd('0x56')](_0x4a8810[_0xb1cd('0x42')]);_0x1bbc16['filters']=_[_0xb1cd('0x44')](_0x1bbc16[_0xb1cd('0x45')],_0x1bbc16[_0xb1cd('0x42')]);_0x5a5431[_0xb1cd('0x46')]=_[_0xb1cd('0x44')](_0x1bbc16['model'],qs[_0xb1cd('0x47')](_0x4a8810[_0xb1cd('0x42')][_0xb1cd('0x47')]));_0x5a5431['attributes']=_0x5a5431[_0xb1cd('0x46')][_0xb1cd('0x48')]?_0x5a5431[_0xb1cd('0x46')]:_0x1bbc16[_0xb1cd('0x45')];if(_0x4a8810['query'][_0xb1cd('0x57')]){_0x5a5431['include']=[{'all':!![]}];}_0x5a5431=_[_0xb1cd('0x50')]({},_0x5a5431,_0x4a8810[_0xb1cd('0x51')]);return db[_0xb1cd('0x3d')]['find'](_0x5a5431)[_0xb1cd('0x23')](handleEntityNotFound(_0x1e4a63,null))['then'](respondWithResult(_0x1e4a63,null))['catch'](handleError(_0x1e4a63,null));};exports[_0xb1cd('0x58')]=function(_0x408aee,_0x99aa09){return db[_0xb1cd('0x3d')][_0xb1cd('0x58')](_0x408aee[_0xb1cd('0x59')],{})[_0xb1cd('0x23')](respondWithResult(_0x99aa09,0xc9))[_0xb1cd('0x2d')](handleError(_0x99aa09,null));};exports[_0xb1cd('0x5a')]=function(_0x13e3a4,_0x22b7b2){if(_0x13e3a4[_0xb1cd('0x59')]['id']){delete _0x13e3a4[_0xb1cd('0x59')]['id'];}return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x13e3a4[_0xb1cd('0x5c')]['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x22b7b2,null))[_0xb1cd('0x23')](saveUpdates(_0x13e3a4[_0xb1cd('0x59')],null))[_0xb1cd('0x23')](respondWithResult(_0x22b7b2,null))[_0xb1cd('0x2d')](handleError(_0x22b7b2,null));};exports[_0xb1cd('0x39')]=function(_0x514d82,_0x295624){return db['SmsMessage']['find']({'where':{'id':_0x514d82['params']['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x295624,null))[_0xb1cd('0x23')](removeEntity(_0x295624,null))[_0xb1cd('0x2d')](handleError(_0x295624,null));};exports[_0xb1cd('0x5d')]=function(_0x4dd819,_0x3ffe81){return db[_0xb1cd('0x3d')]['describe']()['then'](respondWithResult(_0x3ffe81,null))[_0xb1cd('0x2d')](handleError(_0x3ffe81,null));};var interaction_log=require('../../config/logger')(_0xb1cd('0x5e'));exports['accept']=function(_0x48d6d7,_0xb3ff57,_0x4bf575){var _0x25583d={'agent':{},'channel':_0xb1cd('0x5f')};if(_0x48d6d7[_0xb1cd('0x59')]['id']){delete _0x48d6d7['body']['id'];}_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x60')]=!![];_0x48d6d7['body'][_0xb1cd('0x61')]=moment()['format'](_0xb1cd('0x62'));_0x48d6d7[_0xb1cd('0x59')]['UserId']=_0x48d6d7['body'][_0xb1cd('0x63')]||_0x48d6d7['user']['id'];_0x25583d['agent']['id']=_0x48d6d7['body'][_0xb1cd('0x63')];return db[_0xb1cd('0x3d')]['find']({'where':{'id':_0x48d6d7[_0xb1cd('0x5c')]['id'],'UserId':null}})[_0xb1cd('0x23')](handleEntityNotFound(_0xb3ff57,null))['then'](saveUpdates(_0x48d6d7[_0xb1cd('0x59')],null))[_0xb1cd('0x23')](function(_0x20422a){if(_0x20422a){_0x25583d[_0xb1cd('0x2b')]=_0x20422a[_0xb1cd('0x64')]({'plain':!![]});return db[_0xb1cd('0x65')]['find']({'where':{'id':_0x20422a[_0xb1cd('0x66')]}});}return null;})[_0xb1cd('0x23')](handleEntityNotFound(_0xb3ff57,null))[_0xb1cd('0x23')](function(_0x584441){if(_0x584441){return _0x584441[_0xb1cd('0x5a')]({'UserId':_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x63')],'read1stAt':_[_0xb1cd('0x67')](_0x584441['read1stAt'])?moment()[_0xb1cd('0x68')](_0xb1cd('0x62')):undefined});}return null;})[_0xb1cd('0x23')](function(_0x46967e){if(_0x46967e){_0x25583d[_0xb1cd('0x69')]=_0x46967e['get']({'plain':!![]});interaction_log[_0xb1cd('0x24')](_0xb1cd('0x6a'),_0x48d6d7[_0xb1cd('0x6b')]['id'],_0x48d6d7[_0xb1cd('0x6b')][_0xb1cd('0x3b')],_0x48d6d7['user']['role'],_0x25583d[_0xb1cd('0x69')]['id'],_0x48d6d7[_0xb1cd('0x59')]?JSON[_0xb1cd('0x28')](_0x48d6d7[_0xb1cd('0x59')]):_0xb1cd('0x6c'));return respondWithRpcPromise(_0xb1cd('0x6d'),_0xb1cd('0x6e'),_0x25583d);}return null;})['then'](function(_0x343b1e){var _0x10b96f=_0xb1cd('0x6f')+_0x343b1e[_0xb1cd('0x2b')][_0xb1cd('0x70')];return db['sequelize'][_0xb1cd('0x42')](_0x10b96f,{'type':db[_0xb1cd('0x71')][_0xb1cd('0x72')][_0xb1cd('0x73')],'raw':!![]})[_0xb1cd('0x23')](function(_0x4ef5a2){return _0x4ef5a2;});})[_0xb1cd('0x23')](function(_0x420f4e){if(_0x420f4e){_0x25583d['message']['contact']=_0x420f4e[0x0];if(!_0x48d6d7[_0xb1cd('0x59')][_0xb1cd('0x63')])return;return db[_0xb1cd('0x74')][_0xb1cd('0x5b')]({'where':{'id':_0x48d6d7['body'][_0xb1cd('0x63')],'role':_0xb1cd('0x75')},'attributes':['id','name',_0xb1cd('0x76'),_0xb1cd('0x77'),_0xb1cd('0x78')],'raw':!![]});}return null;})['then'](function(_0x1d928d){if(!_0x1d928d)return null;_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x75')]=_0x1d928d;return _0x25583d;})[_0xb1cd('0x23')](function(_0x1819b9){if(_0x1819b9){if(_0x48d6d7['body']['manual']){_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x79')]=util[_0xb1cd('0x68')](_0xb1cd('0x7a'),_0x48d6d7[_0xb1cd('0x6b')][_0xb1cd('0x3b')]);_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x7b')]=_0x25583d[_0xb1cd('0x7b')];_0x25583d[_0xb1cd('0x2b')][_0xb1cd('0x7c')]=_0x25583d['channel'];_0x25583d[_0xb1cd('0x2b')]['event']=_0xb1cd('0x7d');return respondWithRpcPromise(_0xb1cd('0x7e'),'EventManager',{'event':_0xb1cd('0x7f'),'message':_0x25583d[_0xb1cd('0x2b')]},client9002)[_0xb1cd('0x23')](function(){return _0x25583d;});}return _0x25583d;}return null;})[_0xb1cd('0x23')](respondWithResult(_0xb3ff57,null))[_0xb1cd('0x2d')](handleError(_0xb3ff57,null));};var interaction_log=require(_0xb1cd('0x80'))('sms-interactions');exports[_0xb1cd('0x37')]=function(_0x297339,_0x28cd76,_0x59a146){var _0x1dca70={'agent':{},'channel':_0xb1cd('0x5f')};if(_0x297339[_0xb1cd('0x59')]['id']){delete _0x297339[_0xb1cd('0x59')]['id'];}_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')]=_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')]||_0x297339['user']['id'];_0x1dca70[_0xb1cd('0x75')]['id']=_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')];return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x297339[_0xb1cd('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28cd76,null))[_0xb1cd('0x23')](function(_0x1f52a3){if(_0x1f52a3){_0x1dca70[_0xb1cd('0x2b')]=_0x1f52a3[_0xb1cd('0x64')]({'plain':!![]});return db[_0xb1cd('0x65')][_0xb1cd('0x5b')]({'where':{'id':_0x1f52a3['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x28cd76,null))[_0xb1cd('0x23')](function(_0x4cf497){if(_0x4cf497){_0x1dca70[_0xb1cd('0x69')]=_0x4cf497[_0xb1cd('0x64')]({'plain':!![]});interaction_log[_0xb1cd('0x24')](_0xb1cd('0x81'),_0x297339['user']['id'],_0x297339['user'][_0xb1cd('0x3b')],_0x297339[_0xb1cd('0x6b')]['role'],_0x1dca70['interaction']['id'],_0x297339[_0xb1cd('0x59')]?JSON[_0xb1cd('0x28')](_0x297339['body']):_0xb1cd('0x6c'));return respondWithRpcPromise(_0xb1cd('0x82'),_0xb1cd('0x83'),_0x1dca70);}return null;})[_0xb1cd('0x23')](function(_0x3361cb){var _0xedd95c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3361cb['message']['ContactId'];return db[_0xb1cd('0x84')][_0xb1cd('0x42')](_0xedd95c,{'type':db[_0xb1cd('0x71')][_0xb1cd('0x72')][_0xb1cd('0x73')],'raw':!![]})[_0xb1cd('0x23')](function(_0x39eb4d){return _0x39eb4d;});})['then'](function(_0x274ece){if(_0x274ece){_0x1dca70[_0xb1cd('0x2b')][_0xb1cd('0x85')]=_0x274ece[0x0];if(!_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')])return;return db[_0xb1cd('0x74')]['find']({'where':{'id':_0x297339[_0xb1cd('0x59')][_0xb1cd('0x63')],'role':_0xb1cd('0x75')},'attributes':['id',_0xb1cd('0x3b'),_0xb1cd('0x76'),_0xb1cd('0x77'),'internal'],'raw':!![]});}return null;})[_0xb1cd('0x23')](function(_0x553972){if(!_0x553972)return null;_0x1dca70[_0xb1cd('0x2b')]['agent']=_0x553972;return _0x1dca70;})['then'](function(_0xccf129){if(_0xccf129){_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x79')]=util[_0xb1cd('0x68')](_0xb1cd('0x7a'),_0x297339[_0xb1cd('0x6b')][_0xb1cd('0x3b')]);_0xccf129['message'][_0xb1cd('0x7b')]=_0x1dca70[_0xb1cd('0x7b')];_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x7c')]=_0x1dca70[_0xb1cd('0x7b')];_0xccf129[_0xb1cd('0x2b')][_0xb1cd('0x86')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0xccf129['message']},client9002);return _0x1dca70;}return null;})[_0xb1cd('0x23')](respondWithResult(_0x28cd76,null))[_0xb1cd('0x2d')](handleError(_0x28cd76,null));};exports[_0xb1cd('0x2e')]=function(_0x5ec01b,_0x4c5cf6,_0x13d3fe){if(_0x5ec01b[_0xb1cd('0x59')]['id']){delete _0x5ec01b[_0xb1cd('0x59')]['id'];}var _0x4e0a80;return db[_0xb1cd('0x3d')][_0xb1cd('0x5b')]({'where':{'id':_0x5ec01b[_0xb1cd('0x5c')]['id']}})[_0xb1cd('0x23')](handleEntityNotFound(_0x4c5cf6,null))[_0xb1cd('0x23')](function(_0x4e0e21){if(_0x4e0e21){_0x4e0a80=_0x4e0e21;return db[_0xb1cd('0x87')]['find']({'where':{'id':_0x4e0e21[_0xb1cd('0x88')]}});}})[_0xb1cd('0x23')](handleEntityNotFound(_0x4c5cf6,null))['then'](function(_0x2d6199){if(_0x2d6199){logger[_0xb1cd('0x26')](_0xb1cd('0x89'),'status',_0xb1cd('0x8a'),_0x2d6199[_0xb1cd('0x3f')],util['inspect'](_0x5ec01b['body'],{'showHidden':![],'depth':null}));switch(_0x2d6199['type']){case _0xb1cd('0x8b'):if(_0x5ec01b['body']['MessageSid']&&_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x8c')]===_0x4e0a80['messageId']){return _0x4e0a80[_0xb1cd('0x5a')]({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),'status',_0xb1cd('0x8b'),util[_0xb1cd('0x8e')](_0x5ec01b[_0xb1cd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb1cd('0x8f'):if(_0x5ec01b[_0xb1cd('0x59')]['MessageUUID']&&_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x90')]===_0x4e0a80[_0xb1cd('0x91')]&&_[_0xb1cd('0x92')]([_0xb1cd('0x93'),_0xb1cd('0x94')],_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x95')])>=0x0){return _0x4e0a80['update']({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),'status',_0xb1cd('0x96'),util[_0xb1cd('0x8e')](_0x5ec01b[_0xb1cd('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb1cd('0x97'):var _0x447d02=_0x5ec01b[_0xb1cd('0x59')][_0xb1cd('0x98')][0x0];if(_0x447d02['status'][_0xb1cd('0x99')]==='DELIVERED'){return _0x4e0a80[_0xb1cd('0x5a')]({'read':!![]});}else{logger[_0xb1cd('0x29')](_0xb1cd('0x8d'),_0xb1cd('0x2e'),'infobip',util[_0xb1cd('0x8e')](_0x5ec01b['body'],{'showHidden':![],'depth':null}));}break;}return _0x4e0a80;}})[_0xb1cd('0x23')](respondWithResult(_0x4c5cf6,null))[_0xb1cd('0x2d')](handleError(_0x4c5cf6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 555d355..ae7ddb7 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 _0x79f1=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x79f1,0x153));var _0x179f=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x79f1[_0x483e3a];return _0x43fca9;};'use strict';var EventEmitter=require(_0x179f('0x0'));var SmsMessage=require(_0x179f('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x179f('0x2')](0x0);var events={'afterCreate':_0x179f('0x3'),'afterUpdate':'update','afterDestroy':_0x179f('0x4')};function emitEvent(_0x2bb553){return function(_0x4b08c5,_0x44adcb,_0x4e8f1f){SmsMessageEvents[_0x179f('0x5')](_0x2bb553+':'+_0x4b08c5['id'],_0x4b08c5);SmsMessageEvents['emit'](_0x2bb553,_0x4b08c5);_0x4e8f1f(null);};}for(var e in events){if(events[_0x179f('0x6')](e)){var event=events[e];SmsMessage[_0x179f('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x3d16=['events','SmsMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x26c43f,_0x3c6f5f){var _0x18de8b=function(_0x547f33){while(--_0x547f33){_0x26c43f['push'](_0x26c43f['shift']());}};_0x18de8b(++_0x3c6f5f);}(_0x3d16,0x158));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x63d1('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x63d1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x63d1('0x2')](0x0);var events={'afterCreate':_0x63d1('0x3'),'afterUpdate':_0x63d1('0x4'),'afterDestroy':_0x63d1('0x5')};function emitEvent(_0x200704){return function(_0xb3cda1,_0xefd1e,_0x3407f8){SmsMessageEvents[_0x63d1('0x6')](_0x200704+':'+_0xb3cda1['id'],_0xb3cda1);SmsMessageEvents[_0x63d1('0x6')](_0x200704,_0xb3cda1);_0x3407f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x63d1('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 b4d1956..944bcb7 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 _0xc75d=['refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','head','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status'];(function(_0x5e8b4d,_0x4e5ba1){var _0x5d0091=function(_0x53d632){while(--_0x53d632){_0x5e8b4d['push'](_0x5e8b4d['shift']());}};_0x5d0091(++_0x4e5ba1);}(_0xc75d,0x17c));var _0xdc75=function(_0x4d8930,_0x187268){_0x4d8930=_0x4d8930-0x0;var _0xca5ae8=_0xc75d[_0x4d8930];return _0xca5ae8;};'use strict';var _=require('lodash');var util=require(_0xdc75('0x0'));var logger=require(_0xdc75('0x1'))(_0xdc75('0x2'));var moment=require('moment');var BPromise=require(_0xdc75('0x3'));var rp=require(_0xdc75('0x4'));var fs=require('fs');var path=require(_0xdc75('0x5'));var rimraf=require(_0xdc75('0x6'));var config=require(_0xdc75('0x7'));var attributes=require(_0xdc75('0x8'));module[_0xdc75('0x9')]=function(_0x5f3e29,_0x4ad676){return _0x5f3e29[_0xdc75('0xa')](_0xdc75('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xdc75('0xc'),'fields':[_0xdc75('0xc')]},{'name':'fti_sms_messages','fields':[_0xdc75('0xd')],'type':_0xdc75('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ff994,_0xd3e7c8,_0x433afb){var _0x5293a8=_0x5f3e29[_0xdc75('0xf')];var _0xc174d8=_0x2ff994[_0xdc75('0x10')]({'plain':!![]});if(_0xc174d8[_0xdc75('0x11')][_0xdc75('0x12')]()==='in'||_0xc174d8[_0xdc75('0x11')]['toLowerCase']()===_0xdc75('0x13')&&!_0xc174d8[_0xdc75('0x14')]&&!_[_0xdc75('0x15')](_0xc174d8[_0xdc75('0x16')])&&!_[_0xdc75('0x15')](_0xc174d8[_0xdc75('0x17')])){_0x5293a8[_0xdc75('0x18')][_0xdc75('0x19')]({'where':{'id':_0xc174d8['SmsInteractionId']}})[_0xdc75('0x1a')](function(_0x341622){if(_0x341622){_0x341622[_0xdc75('0x1b')]({'lastMsgAt':_0xc174d8[_0xdc75('0x1c')],'lastMsgDirection':_0xc174d8['direction'][_0xdc75('0x12')]()});}})[_0xdc75('0x1d')](function(_0x2adbe4){console['error'](_0x2adbe4);});}if(_0xc174d8['direction']===_0xdc75('0x13')&&!_0xc174d8[_0xdc75('0x14')]){var _0x28c8e6;_0x5293a8['SmsAccount']['find']({'where':{'id':_0xc174d8['SmsAccountId']},'raw':!![]})['then'](function(_0x891b91){_0x28c8e6=_0x891b91;if(_0x28c8e6&&_0x28c8e6['type']){switch(_0x28c8e6['type']){case _0xdc75('0x1e'):var _0x58b43c=require(_0xdc75('0x1e'));if(_0x28c8e6[_0xdc75('0x1f')]&&_0x28c8e6[_0xdc75('0x20')]&&_0x28c8e6[_0xdc75('0x21')]){var _0x308367=new _0x58b43c(_0x28c8e6[_0xdc75('0x1f')],_0x28c8e6[_0xdc75('0x20')]);_0x308367[_0xdc75('0x22')][_0xdc75('0x23')]({'body':_0xc174d8[_0xdc75('0xd')],'to':_0xc174d8['phone'],'from':_0x28c8e6[_0xdc75('0x21')],'statusCallback':_0x28c8e6[_0xdc75('0x24')]+_0xdc75('0x25')+_0xc174d8['id']+'/status?token='+_0x28c8e6[_0xdc75('0x26')]})['then'](function(_0x1b9eed){if(_0x1b9eed[_0xdc75('0x27')]){return _0x2ff994['update']({'messageId':_0x1b9eed[_0xdc75('0x27')]});}})[_0xdc75('0x1d')](function(_0x15358c){logger['error'](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x1e'),util[_0xdc75('0x2a')](_0x15358c,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdc75('0x2c'):var _0x246954=_0xdc75('0x2d');if(_0x28c8e6[_0xdc75('0x2e')]&&_0x28c8e6[_0xdc75('0x2f')]){var _0x433f99={'recipient':[_0xc174d8[_0xdc75('0x21')]],'message':_0xc174d8['body'],'message_type':_0x28c8e6[_0xdc75('0x30')]};if(_0x28c8e6['smsMethod']&&_0x28c8e6[_0xdc75('0x30')]!=='SI'){_0x433f99[_0xdc75('0x31')]=_0x28c8e6[_0xdc75('0x21')];}var _0x44f7e9={'url':_0x246954+_0xdc75('0x32')+_0x28c8e6[_0xdc75('0x2e')]+_0xdc75('0x33')+_0x28c8e6['password'],'method':_0xdc75('0x34')};rp(_0x44f7e9)['then'](function(_0x4cb003){var _0x55e7e7=_0x4cb003[_0xdc75('0x35')](';');var _0x4fff29={'user_key':_0x55e7e7[0x0],'session_key':_0x55e7e7[0x1]};_0x44f7e9={'url':_0x246954+_0xdc75('0x36'),'method':'POST','headers':{'user_key':_0x4fff29['user_key'],'Session_key':_0x4fff29[_0xdc75('0x37')]},'json':!![],'body':_0x433f99};return rp(_0x44f7e9);})[_0xdc75('0x1a')](function(_0x22a205){if(_0x22a205['total_sent']>=0x1){var _0x235b30={'messageId':_0x22a205[_0xdc75('0x38')]};if(_0x28c8e6[_0xdc75('0x30')]!=='GP'||!_0x28c8e6[_0xdc75('0x39')]){_0x235b30[_0xdc75('0x3a')]=!![];}return _0x2ff994[_0xdc75('0x1b')](_0x235b30);}else{return logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdc75('0x2c'),util['inspect'](_0x22a205,{'showHidden':![],'depth':null}));}})[_0xdc75('0x1d')](function(_0x4d1ac7){return logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x2c'),util[_0xdc75('0x2a')](_0x4d1ac7,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),_0xdc75('0x2c'),_0xdc75('0x3b'));}break;case _0xdc75('0x3c'):if(_0x28c8e6['authToken']){var _0x5d71e1={'recipient':_0xc174d8[_0xdc75('0x21')],'message':_0xc174d8[_0xdc75('0xd')],'sender':_0x28c8e6[_0xdc75('0x3d')]||_0x28c8e6[_0xdc75('0x21')],'authorization':_0x28c8e6['authToken']};var _0xd3e7c8={'method':_0xdc75('0x3e'),'uri':_0xdc75('0x3f'),'body':_0x5d71e1,'json':!![]};rp(_0xd3e7c8)[_0xdc75('0x1a')](function(_0x1ab2f6){var _0x6e8700={'messageId':_0x1ab2f6[_0xdc75('0x40')]};if(!_0x28c8e6[_0xdc75('0x39')]){_0x6e8700[_0xdc75('0x3a')]=!![];}return _0x2ff994[_0xdc75('0x1b')](_0x6e8700);})['catch'](function(_0x1a8ea0){logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),'connectel',util[_0xdc75('0x2a')](_0x1a8ea0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdc75('0x28'),'afterCreate',_0xdc75('0x3c'),_0xdc75('0x41'));}break;case'clicksend':if(_0x28c8e6['username']&&_0x28c8e6[_0xdc75('0x2f')]){var _0x5d71e1={'messages':[{'source':'xCALLY\x20Motion','to':_0xc174d8[_0xdc75('0x21')],'body':_0xc174d8[_0xdc75('0xd')],'from':_0x28c8e6[_0xdc75('0x3d')]||_0x28c8e6[_0xdc75('0x21')]}]};var _0x509ed5=util[_0xdc75('0x42')](_0xdc75('0x43'),_0x28c8e6[_0xdc75('0x2e')],_0x28c8e6[_0xdc75('0x2f')]);var _0xd3e7c8={'method':_0xdc75('0x3e'),'uri':_0xdc75('0x44'),'body':_0x5d71e1,'headers':{'Authorization':util[_0xdc75('0x42')]('Basic\x20%s',new Buffer(_0x509ed5)['toString'](_0xdc75('0x45')))},'json':!![]};rp(_0xd3e7c8)[_0xdc75('0x1a')](function(_0x2e311a){if(_0x2e311a[_0xdc75('0x46')]>=0xc8&&_0x2e311a[_0xdc75('0x46')]<=0xce){if(_0x2e311a[_0xdc75('0x47')]&&_0x2e311a[_0xdc75('0x47')]['queued_count']>0x0){var _0x1d96b8=_[_0xdc75('0x48')](_0x2e311a[_0xdc75('0x47')][_0xdc75('0x22')]);var _0x5d5b36={'messageId':_0x1d96b8[_0xdc75('0x49')]};if(!_0x28c8e6['deliveryReport']){_0x5d5b36[_0xdc75('0x3a')]=!![];}return _0x2ff994[_0xdc75('0x1b')](_0x5d5b36);}else{logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdc75('0x4a'),util['inspect'](_0x2e311a,{'showHidden':![],'depth':null}));}}else{logger[_0xdc75('0x2b')](_0xdc75('0x28'),'afterCreate','clickSend',util[_0xdc75('0x2a')](_0x2e311a,{'showHidden':![],'depth':null}));}})[_0xdc75('0x1d')](function(_0x4257c0){logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x4a'),util['inspect'](_0x4257c0,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),_0xdc75('0x4a'),_0xdc75('0x3b'));}break;case _0xdc75('0x4b'):if(_0x28c8e6[_0xdc75('0x4c')]&&_0x28c8e6[_0xdc75('0x20')]){var _0x5d71e1={'dst':_0xc174d8['phone'],'text':_0xc174d8['body'],'src':_0x28c8e6['senderString']||_0x28c8e6[_0xdc75('0x21')],'url':_0x28c8e6[_0xdc75('0x24')]+'/api/sms/messages/'+_0xc174d8['id']+_0xdc75('0x4d')+_0x28c8e6[_0xdc75('0x26')]};var _0x509ed5=util['format']('%s:%s',_0x28c8e6[_0xdc75('0x4c')],_0x28c8e6['authToken']);var _0xd3e7c8={'method':_0xdc75('0x3e'),'uri':util[_0xdc75('0x42')](_0xdc75('0x4e'),_0x28c8e6['authId']),'body':_0x5d71e1,'headers':{'Authorization':util['format'](_0xdc75('0x4f'),new Buffer(_0x509ed5)['toString']('base64'))},'json':!![]};rp(_0xd3e7c8)['then'](function(_0x3dfa32){var _0x1e1db4={'messageId':_0x3dfa32[_0xdc75('0x50')][0x0]};return _0x2ff994[_0xdc75('0x1b')](_0x1e1db4);})[_0xdc75('0x1d')](function(_0x563a80){logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util['inspect'](_0x563a80,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),'plivo',_0xdc75('0x51'));}break;case _0xdc75('0x52'):if(_0x28c8e6[_0xdc75('0x2e')]&&_0x28c8e6[_0xdc75('0x2f')]){if(_0x28c8e6[_0xdc75('0x53')]){var _0x42bf58={'method':'POST','uri':_0x28c8e6['baseUrl']+_0xdc75('0x54'),'body':{'username':_0x28c8e6[_0xdc75('0x2e')],'password':_0x28c8e6[_0xdc75('0x2f')]},'json':!![]};return rp(_0x42bf58)['then'](function(_0x528bcb){var _0xb35194={'method':_0xdc75('0x3e'),'uri':_0x28c8e6[_0xdc75('0x53')]+_0xdc75('0x55'),'body':{'messages':[{'from':_0x28c8e6[_0xdc75('0x21')],'destinations':[{'to':_0xc174d8[_0xdc75('0x21')]}],'text':_0xc174d8[_0xdc75('0xd')],'notifyUrl':_0x28c8e6['remote']+_0xdc75('0x25')+_0xc174d8['id']+_0xdc75('0x4d')+_0x28c8e6['token'],'notifyContentType':'application/json','callbackData':_0x28c8e6['phone']+';'+_0xc174d8['body']}]},'headers':{'Authorization':_0xdc75('0x56')+_0x528bcb[_0xdc75('0x26')]},'json':!![]};return rp(_0xb35194)[_0xdc75('0x1a')](function(_0x24e6e1){if(_0x24e6e1[_0xdc75('0x22')]){var _0x4fefb0={'messageId':_0x24e6e1['messages'][0x0]['messageId']};if(!_0x28c8e6['deliveryReport']){_0x4fefb0[_0xdc75('0x3a')]=!![];}return _0x2ff994['update'](_0x4fefb0);}else{return logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x52'),util[_0xdc75('0x2a')](_0x24e6e1,{'showHidden':![],'depth':null}));}});})[_0xdc75('0x1d')](function(_0x5a1bc5){return logger['error'](_0xdc75('0x28'),'afterCreate',_0xdc75('0x52'),util[_0xdc75('0x2a')](_0x5a1bc5,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')](_0xdc75('0x28'),'afterCreate','infobip',_0xdc75('0x57'));}}else{logger['error'](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdc75('0x58'):var _0x580c6f=require(_0xdc75('0x59'));if(_0x28c8e6[_0xdc75('0x5a')]){var _0x4d643c={};_0x4d643c['login']=_0x28c8e6['username'];_0x4d643c[_0xdc75('0x21')]=_0xc174d8[_0xdc75('0x21')];_0x4d643c[_0xdc75('0x31')]=_0x28c8e6[_0xdc75('0x21')];_0x4d643c[_0xdc75('0x5b')]=_0xc174d8[_0xdc75('0xd')];_0x4d643c[_0xdc75('0x5c')]=+new Date();var _0x531e99='';var _0xfb8649='';var _0x22026b=Object[_0xdc75('0x5d')](_0x4d643c);_0x22026b[_0xdc75('0x5e')]();for(var _0x1c6e04=0x0;_0x1c6e04<_0x22026b[_0xdc75('0x5f')];_0x1c6e04++){if(_0x531e99!=''){_0x531e99+='&';}_0x531e99+=_0x22026b[_0x1c6e04]+'='+encodeURIComponent(_0x4d643c[_0x22026b[_0x1c6e04]]);_0xfb8649+=_0x4d643c[_0x22026b[_0x1c6e04]];}_0xfb8649+=_0x28c8e6[_0xdc75('0x5a')];_0xfb8649=_0x580c6f[_0xdc75('0x60')](_0xdc75('0x61'))[_0xdc75('0x1b')](_0xfb8649)[_0xdc75('0x62')](_0xdc75('0x63'));if(_0x531e99!==''){_0x531e99+='&';}_0x531e99+=_0xdc75('0x64')+_0xfb8649;var _0x44f7e9={'method':_0xdc75('0x34'),'uri':_0x28c8e6['baseUrl']+_0xdc75('0x65')+_0x531e99,'json':!![]};return rp(_0x44f7e9)['then'](function(_0xf89bfa){var _0x576f0e=Object[_0xdc75('0x5d')](_0xf89bfa);if(_0xf89bfa[_0x576f0e[0x0]][_0xdc75('0x2b')]&&parseInt(_0xf89bfa[_0x576f0e[0x0]][_0xdc75('0x2b')])===0x0){var _0x5a33c0={'messageId':_0xf89bfa[_0x576f0e[0x0]][_0xdc75('0x66')]};if(!_0x28c8e6[_0xdc75('0x39')]){_0x5a33c0[_0xdc75('0x3a')]=!![];}return _0x2ff994['update'](_0x5a33c0);}else{return logger[_0xdc75('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc75('0x29'),_0xdc75('0x58'),util[_0xdc75('0x2a')](_0xf89bfa[_0xdc75('0x2b')],{'showHidden':![],'depth':null}));}})[_0xdc75('0x1d')](function(_0xba7864){return logger['error'](_0xdc75('0x28'),'afterCreate','csc',util[_0xdc75('0x2a')](_0xba7864,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x58'),_0xdc75('0x67'));}break;case _0xdc75('0x68'):if(_0x28c8e6[_0xdc75('0x5a')]){var _0x32e12d={'method':_0xdc75('0x3e'),'uri':_0xdc75('0x69'),'headers':{'Authorization':_0x28c8e6['apiKey']},'body':{'content':_0xc174d8[_0xdc75('0xd')],'to':[_0xc174d8[_0xdc75('0x21')]],'from':_0x28c8e6[_0xdc75('0x21')],'binary':![],'clientMessageId':_0xdc75('0x6a'),'charset':_0xdc75('0x6b')},'json':!![]};rp(_0x32e12d)[_0xdc75('0x1a')](function(_0x1d134c){if(!_0x1d134c[_0xdc75('0x2b')]){var _0xdbdca0={'messageId':_0x1d134c[_0xdc75('0x22')][0x0]['apiMessageId']};if(!_0x28c8e6[_0xdc75('0x39')]){_0xdbdca0[_0xdc75('0x3a')]=!![];}return _0x2ff994[_0xdc75('0x1b')](_0xdbdca0);}else{return logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x68'),util[_0xdc75('0x2a')](_0x1d134c[_0xdc75('0x2b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5bf809){return logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x68'),util['inspect'](_0x5bf809,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x68'),_0xdc75('0x67'));}break;case _0xdc75('0x6c'):if(_0x28c8e6[_0xdc75('0x2e')]&&_0x28c8e6['password']){var _0x509ed5=util['format'](_0xdc75('0x43'),_0x28c8e6[_0xdc75('0x2e')],_0x28c8e6[_0xdc75('0x2f')]);var _0xd3e7c8={'method':_0xdc75('0x3e'),'uri':_0xdc75('0x6d')+_0x28c8e6[_0xdc75('0x6e')]+_0xdc75('0x6f'),'body':{'to':[_0xc174d8[_0xdc75('0x21')]],'text':_0xc174d8[_0xdc75('0xd')],'from':_0x28c8e6[_0xdc75('0x21')],'applicationId':_0x28c8e6[_0xdc75('0x70')]},'headers':{'Authorization':util[_0xdc75('0x42')](_0xdc75('0x4f'),new Buffer(_0x509ed5)['toString'](_0xdc75('0x45')))},'json':!![]};rp(_0xd3e7c8)['then'](function(_0x5ab673){if(_0x5ab673['id']){var _0x3f8f93={'messageId':_0x5ab673['id']};return _0x2ff994[_0xdc75('0x1b')](_0x3f8f93);}else{logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x6c'),util[_0xdc75('0x2a')](_0x5ab673,{'showHidden':![],'depth':null}));}})[_0xdc75('0x1d')](function(_0x525b00){logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x6c'),util['inspect'](_0x525b00,{'showHidden':![],'depth':null}));});}else{logger[_0xdc75('0x2b')](_0xdc75('0x28'),_0xdc75('0x29'),_0xdc75('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdc75('0x71'):if(_0x28c8e6['apiKey']){var _0x5dc18d={};var _0x44f7e9={'method':'POST','uri':_0xdc75('0x72'),'headers':{'Authorization':_0xdc75('0x73')+_0x28c8e6['apiKey'],'Content-Type':_0xdc75('0x74')},'body':{'from':_0x28c8e6[_0xdc75('0x21')],'to':_0xc174d8[_0xdc75('0x21')],'text':_0xc174d8[_0xdc75('0xd')]},'json':!![]};return rp(_0x44f7e9)[_0xdc75('0x1a')](function(_0x44f18c){if(_0x44f18c['code']==0xca){_0x5dc18d[_0xdc75('0x75')]=_0x44f18c;var _0x558396={'method':_0xdc75('0x3e'),'uri':_0xdc75('0x76'),'headers':{'Authorization':_0xdc75('0x73')+_0x28c8e6['apiKey'],'Content-Type':_0xdc75('0x74')},'body':{'refid':_0x5dc18d[_0xdc75('0x75')]['refid']},'json':!![]};return rp(_0x558396)[_0xdc75('0x1a')](function(_0x38617f){_0x5dc18d[_0xdc75('0x77')]=_0x38617f;var _0x217ad6={'messageId':_0x5dc18d[_0xdc75('0x75')][_0xdc75('0x78')],'read':!![]};return _0x2ff994[_0xdc75('0x1b')](_0x217ad6);});}else{return logger[_0xdc75('0x2b')](_0xdc75('0x28'),'afterCreate',_0xdc75('0x71'),util[_0xdc75('0x2a')](_0x44f18c,{'showHidden':![],'depth':null}));}})[_0xdc75('0x1d')](function(_0x323c98){return logger[_0xdc75('0x2b')](_0xdc75('0x28'),'afterCreate','intelepeer',util[_0xdc75('0x2a')](_0x323c98,{'showHidden':![],'depth':null}));});}else{return logger[_0xdc75('0x2b')](_0xdc75('0x28'),'afterCreate',_0xdc75('0x71'),_0xdc75('0x79'));}break;}}})[_0xdc75('0x7a')](function(){_0x433afb();});}else{_0x433afb();}}},'charset':_0xdc75('0x7b'),'collate':_0xdc75('0x7c')});}; \ No newline at end of file +var _0xe200=['out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','direction','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','body','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','split','sms','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','read','clickSend','plivo','authId','format','%s:%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase'];(function(_0x31035e,_0x5ae9d3){var _0x4b6640=function(_0x57bf1e){while(--_0x57bf1e){_0x31035e['push'](_0x31035e['shift']());}};_0x4b6640(++_0x5ae9d3);}(_0xe200,0x164));var _0x0e20=function(_0x4883fe,_0x295690){_0x4883fe=_0x4883fe-0x0;var _0x2a97e8=_0xe200[_0x4883fe];return _0x2a97e8;};'use strict';var _=require(_0x0e20('0x0'));var util=require(_0x0e20('0x1'));var logger=require(_0x0e20('0x2'))(_0x0e20('0x3'));var moment=require(_0x0e20('0x4'));var BPromise=require(_0x0e20('0x5'));var rp=require(_0x0e20('0x6'));var fs=require('fs');var path=require(_0x0e20('0x7'));var rimraf=require(_0x0e20('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e20('0x9'));module['exports']=function(_0x2b4f35,_0x5c60c8){return _0x2b4f35[_0x0e20('0xa')](_0x0e20('0xb'),attributes,{'tableName':_0x0e20('0xc'),'paranoid':![],'indexes':[{'name':_0x0e20('0xd'),'fields':[_0x0e20('0xd')]},{'name':_0x0e20('0xe'),'fields':['body'],'type':_0x0e20('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac3e3,_0x315b3e,_0x29886f){var _0x59dc29=_0x2b4f35[_0x0e20('0x10')];var _0x240e8d=_0x2ac3e3[_0x0e20('0x11')]({'plain':!![]});if(_0x240e8d['direction'][_0x0e20('0x12')]()==='in'||_0x240e8d['direction'][_0x0e20('0x12')]()===_0x0e20('0x13')&&!_0x240e8d[_0x0e20('0x14')]&&!_[_0x0e20('0x15')](_0x240e8d[_0x0e20('0x16')])&&!_[_0x0e20('0x15')](_0x240e8d[_0x0e20('0x17')])){_0x59dc29[_0x0e20('0x18')][_0x0e20('0x19')]({'where':{'id':_0x240e8d[_0x0e20('0x17')]}})[_0x0e20('0x1a')](function(_0x548948){if(_0x548948){_0x548948['update']({'lastMsgAt':_0x240e8d[_0x0e20('0x1b')],'lastMsgDirection':_0x240e8d[_0x0e20('0x1c')][_0x0e20('0x12')]()});}})['catch'](function(_0x2c1c84){console['error'](_0x2c1c84);});}if(_0x240e8d[_0x0e20('0x1c')]===_0x0e20('0x13')&&!_0x240e8d['secret']){var _0x24aefc;_0x59dc29[_0x0e20('0x1d')][_0x0e20('0x1e')]({'where':{'id':_0x240e8d[_0x0e20('0x1f')]},'raw':!![]})[_0x0e20('0x1a')](function(_0x55e02b){_0x24aefc=_0x55e02b;if(_0x24aefc&&_0x24aefc[_0x0e20('0x20')]){switch(_0x24aefc[_0x0e20('0x20')]){case'twilio':var _0x4937a8=require(_0x0e20('0x21'));if(_0x24aefc[_0x0e20('0x22')]&&_0x24aefc[_0x0e20('0x23')]&&_0x24aefc[_0x0e20('0x24')]){var _0x16671e=new _0x4937a8(_0x24aefc['accountSid'],_0x24aefc[_0x0e20('0x23')]);_0x16671e[_0x0e20('0x25')]['create']({'body':_0x240e8d[_0x0e20('0x26')],'to':_0x240e8d[_0x0e20('0x24')],'from':_0x24aefc[_0x0e20('0x24')],'statusCallback':_0x24aefc[_0x0e20('0x27')]+_0x0e20('0x28')+_0x240e8d['id']+_0x0e20('0x29')+_0x24aefc[_0x0e20('0x2a')]})[_0x0e20('0x1a')](function(_0x2fe969){if(_0x2fe969[_0x0e20('0x2b')]){return _0x2ac3e3[_0x0e20('0x2c')]({'messageId':_0x2fe969['sid']});}})[_0x0e20('0x2d')](function(_0x125f6f){logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x21'),util[_0x0e20('0x30')](_0x125f6f,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x21'),_0x0e20('0x32'));}break;case'skebby':var _0x3e53e1=_0x0e20('0x33');if(_0x24aefc[_0x0e20('0x34')]&&_0x24aefc[_0x0e20('0x35')]){var _0x7654f0={'recipient':[_0x240e8d[_0x0e20('0x24')]],'message':_0x240e8d[_0x0e20('0x26')],'message_type':_0x24aefc['smsMethod']};if(_0x24aefc[_0x0e20('0x36')]&&_0x24aefc['smsMethod']!=='SI'){_0x7654f0['sender']=_0x24aefc['phone'];}var _0x20f96a={'url':_0x3e53e1+_0x0e20('0x37')+_0x24aefc[_0x0e20('0x34')]+'&password='+_0x24aefc[_0x0e20('0x35')],'method':'GET'};rp(_0x20f96a)[_0x0e20('0x1a')](function(_0xbe0e41){var _0x4b39c2=_0xbe0e41[_0x0e20('0x38')](';');var _0x2e3877={'user_key':_0x4b39c2[0x0],'session_key':_0x4b39c2[0x1]};_0x20f96a={'url':_0x3e53e1+_0x0e20('0x39'),'method':'POST','headers':{'user_key':_0x2e3877['user_key'],'Session_key':_0x2e3877['session_key']},'json':!![],'body':_0x7654f0};return rp(_0x20f96a);})[_0x0e20('0x1a')](function(_0x90b9bb){if(_0x90b9bb[_0x0e20('0x3a')]>=0x1){var _0x479112={'messageId':_0x90b9bb[_0x0e20('0x3b')]};if(_0x24aefc[_0x0e20('0x36')]!=='GP'||!_0x24aefc[_0x0e20('0x3c')]){_0x479112['read']=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x479112);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x3d'),util[_0x0e20('0x30')](_0x90b9bb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x187015){return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x3d'),util['inspect'](_0x187015,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x3d'),_0x0e20('0x3e'));}break;case _0x0e20('0x3f'):if(_0x24aefc[_0x0e20('0x23')]){var _0x23101f={'recipient':_0x240e8d[_0x0e20('0x24')],'message':_0x240e8d[_0x0e20('0x26')],'sender':_0x24aefc[_0x0e20('0x40')]||_0x24aefc['phone'],'authorization':_0x24aefc[_0x0e20('0x23')]};var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x42'),'body':_0x23101f,'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x48522e){var _0x2ea3d4={'messageId':_0x48522e[_0x0e20('0x43')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x2ea3d4['read']=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x2ea3d4);})[_0x0e20('0x2d')](function(_0x5b01be){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'connectel',util[_0x0e20('0x30')](_0x5b01be,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x3f'),_0x0e20('0x44'));}break;case _0x0e20('0x45'):if(_0x24aefc[_0x0e20('0x34')]&&_0x24aefc[_0x0e20('0x35')]){var _0x23101f={'messages':[{'source':'xCALLY\x20Motion','to':_0x240e8d[_0x0e20('0x24')],'body':_0x240e8d[_0x0e20('0x26')],'from':_0x24aefc[_0x0e20('0x40')]||_0x24aefc[_0x0e20('0x24')]}]};var _0x477cf3=util['format']('%s:%s',_0x24aefc[_0x0e20('0x34')],_0x24aefc[_0x0e20('0x35')]);var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x46'),'body':_0x23101f,'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)[_0x0e20('0x48')](_0x0e20('0x49')))},'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x2e66df){if(_0x2e66df[_0x0e20('0x4a')]>=0xc8&&_0x2e66df['http_code']<=0xce){if(_0x2e66df[_0x0e20('0x4b')]&&_0x2e66df['data'][_0x0e20('0x4c')]>0x0){var _0x3a232d=_[_0x0e20('0x4d')](_0x2e66df[_0x0e20('0x4b')][_0x0e20('0x25')]);var _0x3c6d03={'messageId':_0x3a232d[_0x0e20('0x4e')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x3c6d03[_0x0e20('0x4f')]=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x3c6d03);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x50'),util[_0x0e20('0x30')](_0x2e66df,{'showHidden':![],'depth':null}));}}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'clickSend',util[_0x0e20('0x30')](_0x2e66df,{'showHidden':![],'depth':null}));}})['catch'](function(_0x423465){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x50'),util['inspect'](_0x423465,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x50'),_0x0e20('0x3e'));}break;case _0x0e20('0x51'):if(_0x24aefc[_0x0e20('0x52')]&&_0x24aefc['authToken']){var _0x23101f={'dst':_0x240e8d[_0x0e20('0x24')],'text':_0x240e8d['body'],'src':_0x24aefc[_0x0e20('0x40')]||_0x24aefc['phone'],'url':_0x24aefc[_0x0e20('0x27')]+_0x0e20('0x28')+_0x240e8d['id']+'/status?token='+_0x24aefc['token']};var _0x477cf3=util[_0x0e20('0x53')](_0x0e20('0x54'),_0x24aefc[_0x0e20('0x52')],_0x24aefc['authToken']);var _0x315b3e={'method':_0x0e20('0x41'),'uri':util[_0x0e20('0x53')]('https://api.plivo.com/v1/Account/%s/Message/',_0x24aefc[_0x0e20('0x52')]),'body':_0x23101f,'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)['toString'](_0x0e20('0x49')))},'json':!![]};rp(_0x315b3e)[_0x0e20('0x1a')](function(_0x6b317c){var _0x5b2d3c={'messageId':_0x6b317c['message_uuid'][0x0]};return _0x2ac3e3[_0x0e20('0x2c')](_0x5b2d3c);})[_0x0e20('0x2d')](function(_0x436e28){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x51'),util[_0x0e20('0x30')](_0x436e28,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x51'),_0x0e20('0x55'));}break;case _0x0e20('0x56'):if(_0x24aefc['username']&&_0x24aefc['password']){if(_0x24aefc[_0x0e20('0x57')]){var _0x1ff6c7={'method':_0x0e20('0x41'),'uri':_0x24aefc[_0x0e20('0x57')]+'/auth/1/session','body':{'username':_0x24aefc[_0x0e20('0x34')],'password':_0x24aefc[_0x0e20('0x35')]},'json':!![]};return rp(_0x1ff6c7)['then'](function(_0x21dad4){var _0xf8e56a={'method':_0x0e20('0x41'),'uri':_0x24aefc['baseUrl']+_0x0e20('0x58'),'body':{'messages':[{'from':_0x24aefc['phone'],'destinations':[{'to':_0x240e8d[_0x0e20('0x24')]}],'text':_0x240e8d[_0x0e20('0x26')],'notifyUrl':_0x24aefc[_0x0e20('0x27')]+'/api/sms/messages/'+_0x240e8d['id']+'/status?token='+_0x24aefc[_0x0e20('0x2a')],'notifyContentType':_0x0e20('0x59'),'callbackData':_0x24aefc[_0x0e20('0x24')]+';'+_0x240e8d['body']}]},'headers':{'Authorization':_0x0e20('0x5a')+_0x21dad4[_0x0e20('0x2a')]},'json':!![]};return rp(_0xf8e56a)['then'](function(_0x475f11){if(_0x475f11['messages']){var _0x298c67={'messageId':_0x475f11['messages'][0x0][_0x0e20('0xd')]};if(!_0x24aefc['deliveryReport']){_0x298c67[_0x0e20('0x4f')]=!![];}return _0x2ac3e3[_0x0e20('0x2c')](_0x298c67);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x56'),util[_0x0e20('0x30')](_0x475f11,{'showHidden':![],'depth':null}));}});})[_0x0e20('0x2d')](function(_0x396458){return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'infobip',util[_0x0e20('0x30')](_0x396458,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x56'),_0x0e20('0x3e'));}break;case _0x0e20('0x5b'):var _0x30b2c0=require(_0x0e20('0x5c'));if(_0x24aefc[_0x0e20('0x5d')]){var _0x5d6703={};_0x5d6703[_0x0e20('0x5e')]=_0x24aefc[_0x0e20('0x34')];_0x5d6703[_0x0e20('0x24')]=_0x240e8d[_0x0e20('0x24')];_0x5d6703['sender']=_0x24aefc[_0x0e20('0x24')];_0x5d6703[_0x0e20('0x5f')]=_0x240e8d[_0x0e20('0x26')];_0x5d6703[_0x0e20('0x60')]=+new Date();var _0x4725f3='';var _0x4c96f3='';var _0x1c7562=Object[_0x0e20('0x61')](_0x5d6703);_0x1c7562[_0x0e20('0x62')]();for(var _0x403913=0x0;_0x403913<_0x1c7562[_0x0e20('0x63')];_0x403913++){if(_0x4725f3!=''){_0x4725f3+='&';}_0x4725f3+=_0x1c7562[_0x403913]+'='+encodeURIComponent(_0x5d6703[_0x1c7562[_0x403913]]);_0x4c96f3+=_0x5d6703[_0x1c7562[_0x403913]];}_0x4c96f3+=_0x24aefc[_0x0e20('0x5d')];_0x4c96f3=_0x30b2c0['createHash'](_0x0e20('0x64'))['update'](_0x4c96f3)[_0x0e20('0x65')](_0x0e20('0x66'));if(_0x4725f3!==''){_0x4725f3+='&';}_0x4725f3+='signature='+_0x4c96f3;var _0x20f96a={'method':_0x0e20('0x67'),'uri':_0x24aefc[_0x0e20('0x57')]+_0x0e20('0x68')+_0x4725f3,'json':!![]};return rp(_0x20f96a)['then'](function(_0x45648c){var _0x1d347c=Object[_0x0e20('0x61')](_0x45648c);if(_0x45648c[_0x1d347c[0x0]][_0x0e20('0x2e')]&&parseInt(_0x45648c[_0x1d347c[0x0]]['error'])===0x0){var _0xb69aee={'messageId':_0x45648c[_0x1d347c[0x0]][_0x0e20('0x69')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0xb69aee[_0x0e20('0x4f')]=!![];}return _0x2ac3e3['update'](_0xb69aee);}else{return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0e20('0x5b'),util[_0x0e20('0x30')](_0x45648c[_0x0e20('0x2e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x28bb21){return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x5b'),util['inspect'](_0x28bb21,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'csc',_0x0e20('0x6a'));}break;case _0x0e20('0x6b'):if(_0x24aefc[_0x0e20('0x5d')]){var _0x4a7cf2={'method':'POST','uri':_0x0e20('0x6c'),'headers':{'Authorization':_0x24aefc[_0x0e20('0x5d')]},'body':{'content':_0x240e8d[_0x0e20('0x26')],'to':[_0x240e8d[_0x0e20('0x24')]],'from':_0x24aefc[_0x0e20('0x24')],'binary':![],'clientMessageId':_0x0e20('0x6d'),'charset':_0x0e20('0x6e')},'json':!![]};rp(_0x4a7cf2)[_0x0e20('0x1a')](function(_0x2a1be5){if(!_0x2a1be5[_0x0e20('0x2e')]){var _0x49eed8={'messageId':_0x2a1be5[_0x0e20('0x25')][0x0][_0x0e20('0x6f')]};if(!_0x24aefc[_0x0e20('0x3c')]){_0x49eed8[_0x0e20('0x4f')]=!![];}return _0x2ac3e3['update'](_0x49eed8);}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),util[_0x0e20('0x30')](_0x2a1be5[_0x0e20('0x2e')],{'showHidden':![],'depth':null}));}})[_0x0e20('0x2d')](function(_0x22755c){return logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),util[_0x0e20('0x30')](_0x22755c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0e20('0x31'),_0x0e20('0x2f'),_0x0e20('0x6b'),_0x0e20('0x6a'));}break;case _0x0e20('0x70'):if(_0x24aefc['username']&&_0x24aefc[_0x0e20('0x35')]){var _0x477cf3=util[_0x0e20('0x53')](_0x0e20('0x54'),_0x24aefc[_0x0e20('0x34')],_0x24aefc['password']);var _0x315b3e={'method':_0x0e20('0x41'),'uri':_0x0e20('0x71')+_0x24aefc[_0x0e20('0x72')]+_0x0e20('0x73'),'body':{'to':[_0x240e8d[_0x0e20('0x24')]],'text':_0x240e8d['body'],'from':_0x24aefc[_0x0e20('0x24')],'applicationId':_0x24aefc[_0x0e20('0x74')]},'headers':{'Authorization':util['format'](_0x0e20('0x47'),new Buffer(_0x477cf3)['toString']('base64'))},'json':!![]};rp(_0x315b3e)['then'](function(_0x20a894){if(_0x20a894['id']){var _0x509a5f={'messageId':_0x20a894['id']};return _0x2ac3e3[_0x0e20('0x2c')](_0x509a5f);}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth',util[_0x0e20('0x30')](_0x20a894,{'showHidden':![],'depth':null}));}})[_0x0e20('0x2d')](function(_0x486655){logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth',util[_0x0e20('0x30')](_0x486655,{'showHidden':![],'depth':null}));});}else{logger[_0x0e20('0x2e')](_0x0e20('0x31'),_0x0e20('0x2f'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x0e20('0x75'):if(_0x24aefc[_0x0e20('0x5d')]){var _0x13bb88={};var _0x20f96a={'method':_0x0e20('0x41'),'uri':_0x0e20('0x76'),'headers':{'Authorization':_0x0e20('0x77')+_0x24aefc[_0x0e20('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x24aefc[_0x0e20('0x24')],'to':_0x240e8d['phone'],'text':_0x240e8d[_0x0e20('0x26')]},'json':!![]};return rp(_0x20f96a)[_0x0e20('0x1a')](function(_0x463e90){if(_0x463e90[_0x0e20('0x78')]==0xca){_0x13bb88[_0x0e20('0x79')]=_0x463e90;var _0xe76097={'method':'POST','uri':_0x0e20('0x7a'),'headers':{'Authorization':'Bearer\x20'+_0x24aefc['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x13bb88['message']['refid']},'json':!![]};return rp(_0xe76097)['then'](function(_0x432cf0){_0x13bb88['status']=_0x432cf0;var _0x569b08={'messageId':_0x13bb88['message']['refid'],'read':!![]};return _0x2ac3e3[_0x0e20('0x2c')](_0x569b08);});}else{return logger[_0x0e20('0x2e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0e20('0x2f'),_0x0e20('0x75'),util['inspect'](_0x463e90,{'showHidden':![],'depth':null}));}})['catch'](function(_0x216fb9){return logger['error'](_0x0e20('0x31'),_0x0e20('0x2f'),'intelepeer',util['inspect'](_0x216fb9,{'showHidden':![],'depth':null}));});}else{return logger[_0x0e20('0x2e')](_0x0e20('0x31'),'afterCreate',_0x0e20('0x75'),'Token\x20not\x20received');}break;}}})[_0x0e20('0x7b')](function(){_0x29886f();});}else{_0x29886f();}}},'charset':_0x0e20('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3c2d592..fe86909 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 _0xbb5d=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','create','body','options','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0xbb5d,0x1a7));var _0xdbb5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb5d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdbb5('0x0'));var util=require(_0xdbb5('0x1'));var moment=require(_0xdbb5('0x2'));var BPromise=require(_0xdbb5('0x3'));var rs=require(_0xdbb5('0x4'));var fs=require('fs');var Redis=require(_0xdbb5('0x5'));var db=require(_0xdbb5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbb5('0x7'))('rpc');var config=require(_0xdbb5('0x8'));var jayson=require(_0xdbb5('0x9'));var client=jayson[_0xdbb5('0xa')][_0xdbb5('0xb')]({'port':0x232a});config[_0xdbb5('0xc')]=_['defaults'](config['redis'],{'host':_0xdbb5('0xd'),'port':0x18eb});var socket=require(_0xdbb5('0xe'))(new Redis(config[_0xdbb5('0xc')]));require(_0xdbb5('0xf'))[_0xdbb5('0x10')](socket);function respondWithRpcPromise(_0x3d415e,_0x29aa76,_0xa66f45){return new BPromise(function(_0x1e7472,_0x362e1b){return client['request'](_0x3d415e,_0xa66f45)[_0xdbb5('0x11')](function(_0x54163b){logger[_0xdbb5('0x12')]('SmsMessage,\x20%s,\x20%s',_0x29aa76,_0xdbb5('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29aa76,'request\x20sent',JSON[_0xdbb5('0x14')](_0x54163b));if(_0x54163b['error']){if(_0x54163b[_0xdbb5('0x15')][_0xdbb5('0x16')]===0x1f4){logger[_0xdbb5('0x15')](_0xdbb5('0x17'),_0x29aa76,_0x54163b[_0xdbb5('0x15')]['message']);return _0x362e1b(_0x54163b[_0xdbb5('0x15')][_0xdbb5('0x18')]);}logger[_0xdbb5('0x15')](_0xdbb5('0x17'),_0x29aa76,_0x54163b[_0xdbb5('0x15')][_0xdbb5('0x18')]);return _0x1e7472(_0x54163b[_0xdbb5('0x15')]['message']);}else{logger[_0xdbb5('0x12')](_0xdbb5('0x17'),_0x29aa76,_0xdbb5('0x13'));_0x1e7472(_0x54163b[_0xdbb5('0x19')][_0xdbb5('0x18')]);}})['catch'](function(_0x4827a5){logger[_0xdbb5('0x15')]('SmsMessage,\x20%s,\x20%s',_0x29aa76,_0x4827a5);_0x362e1b(_0x4827a5);});});}exports[_0xdbb5('0x1a')]=function(_0x216b96){var _0x3a2392=this;return new Promise(function(_0x37c048,_0x1b8703){return db[_0xdbb5('0x1b')][_0xdbb5('0x1c')](_0x216b96[_0xdbb5('0x1d')],{'raw':_0x216b96['options']?_0x216b96[_0xdbb5('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xdbb5('0x11')](function(_0x22d9ef){logger[_0xdbb5('0x12')]('CreateSmsMessage',_0x216b96);logger[_0xdbb5('0x1f')](_0xdbb5('0x1a'),_0x216b96,JSON[_0xdbb5('0x14')](_0x22d9ef));_0x37c048(_0x22d9ef);})[_0xdbb5('0x20')](function(_0x293f65){logger['error'](_0xdbb5('0x1a'),_0x293f65[_0xdbb5('0x18')],_0x216b96);_0x1b8703(_0x3a2392[_0xdbb5('0x15')](0x1f4,_0x293f65[_0xdbb5('0x18')]));});});}; \ No newline at end of file +var _0x86b4=['rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','create','then','debug','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x487e48,_0x232219){var _0x934dbb=function(_0x12a6bb){while(--_0x12a6bb){_0x487e48['push'](_0x487e48['shift']());}};_0x934dbb(++_0x232219);}(_0x86b4,0x138));var _0x486b=function(_0xd5299b,_0x8c30ab){_0xd5299b=_0xd5299b-0x0;var _0x168ab5=_0x86b4[_0xd5299b];return _0x168ab5;};'use strict';var _=require('lodash');var util=require(_0x486b('0x0'));var moment=require(_0x486b('0x1'));var BPromise=require(_0x486b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x486b('0x3'));var db=require(_0x486b('0x4'))['db'];var utils=require(_0x486b('0x5'));var logger=require(_0x486b('0x6'))(_0x486b('0x7'));var config=require(_0x486b('0x8'));var jayson=require(_0x486b('0x9'));var client=jayson[_0x486b('0xa')]['http']({'port':0x232a});config[_0x486b('0xb')]=_[_0x486b('0xc')](config[_0x486b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x486b('0xd'))(new Redis(config[_0x486b('0xb')]));require(_0x486b('0xe'))[_0x486b('0xf')](socket);function respondWithRpcPromise(_0x51861a,_0x3d9d76,_0x356a50){return new BPromise(function(_0x1bebca,_0x36284b){return client[_0x486b('0x10')](_0x51861a,_0x356a50)['then'](function(_0x50d401){logger[_0x486b('0x11')]('SmsMessage,\x20%s,\x20%s',_0x3d9d76,_0x486b('0x12'));logger['debug'](_0x486b('0x13'),_0x3d9d76,_0x486b('0x12'),JSON['stringify'](_0x50d401));if(_0x50d401[_0x486b('0x14')]){if(_0x50d401[_0x486b('0x14')]['code']===0x1f4){logger[_0x486b('0x14')](_0x486b('0x15'),_0x3d9d76,_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);return _0x36284b(_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);}logger[_0x486b('0x14')](_0x486b('0x15'),_0x3d9d76,_0x50d401[_0x486b('0x14')][_0x486b('0x16')]);return _0x1bebca(_0x50d401[_0x486b('0x14')]['message']);}else{logger[_0x486b('0x11')](_0x486b('0x15'),_0x3d9d76,_0x486b('0x12'));_0x1bebca(_0x50d401['result'][_0x486b('0x16')]);}})['catch'](function(_0x11a1bb){logger['error'](_0x486b('0x15'),_0x3d9d76,_0x11a1bb);_0x36284b(_0x11a1bb);});});}exports[_0x486b('0x17')]=function(_0x965591){var _0x3a5816=this;return new Promise(function(_0x5d583f,_0x1e612f){return db['SmsMessage'][_0x486b('0x18')](_0x965591['body'],{'raw':_0x965591['options']?_0x965591['options']['raw']===undefined?!![]:![]:!![]})[_0x486b('0x19')](function(_0x3851f7){logger[_0x486b('0x11')](_0x486b('0x17'),_0x965591);logger[_0x486b('0x1a')]('CreateSmsMessage',_0x965591,JSON[_0x486b('0x1b')](_0x3851f7));_0x5d583f(_0x3851f7);})[_0x486b('0x1c')](function(_0x484574){logger[_0x486b('0x14')]('CreateSmsMessage',_0x484574[_0x486b('0x16')],_0x965591);_0x1e612f(_0x3a5816[_0x486b('0x14')](0x1f4,_0x484574[_0x486b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7fff7e0..44c1748 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 _0xcee1=['length','./smsMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x4aa657,_0x4484a3){var _0x206bf1=function(_0x3712f3){while(--_0x3712f3){_0x4aa657['push'](_0x4aa657['shift']());}};_0x206bf1(++_0x4484a3);}(_0xcee1,0x69));var _0x1cee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcee1[_0x14add3];return _0x4a174f;};'use strict';var SmsMessageEvents=require(_0x1cee('0x0'));var events=[_0x1cee('0x1'),_0x1cee('0x2'),_0x1cee('0x3')];function createListener(_0x4cc6ef,_0x28883e){return function(_0x44a894){_0x28883e[_0x1cee('0x4')](_0x4cc6ef,_0x44a894);};}function removeListener(_0x3a7b70,_0x2f03a8){return function(){SmsMessageEvents[_0x1cee('0x5')](_0x3a7b70,_0x2f03a8);};}exports[_0x1cee('0x6')]=function(_0x3e7b6f){for(var _0x735c59=0x0,_0x15ccee=events[_0x1cee('0x7')];_0x735c59<_0x15ccee;_0x735c59++){var _0x2c747d=events[_0x735c59];var _0xde968c=createListener('smsMessage:'+_0x2c747d,_0x3e7b6f);SmsMessageEvents['on'](_0x2c747d,_0xde968c);}}; \ No newline at end of file +var _0xe26a=['length','smsMessage:','save','remove','update','removeListener'];(function(_0x2873a5,_0x588b19){var _0x162506=function(_0x2d71d4){while(--_0x2d71d4){_0x2873a5['push'](_0x2873a5['shift']());}};_0x162506(++_0x588b19);}(_0xe26a,0x1a6));var _0xae26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe26a[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xae26('0x0'),_0xae26('0x1'),_0xae26('0x2')];function createListener(_0x177b71,_0x191611){return function(_0x2b5a16){_0x191611['emit'](_0x177b71,_0x2b5a16);};}function removeListener(_0x3aa101,_0x7a306c){return function(){SmsMessageEvents[_0xae26('0x3')](_0x3aa101,_0x7a306c);};}exports['register']=function(_0x394b63){for(var _0x3a2e9e=0x0,_0x2156e2=events[_0xae26('0x4')];_0x3a2e9e<_0x2156e2;_0x3a2e9e++){var _0x5f5865=events[_0x3a2e9e];var _0x16499d=createListener(_0xae26('0x5')+_0x5f5865,_0x394b63);SmsMessageEvents['on'](_0x5f5865,_0x16499d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0fecc24..2984155 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 _0x1438=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','connect-timeout'];(function(_0x15c538,_0x2ec6ab){var _0x51d2cc=function(_0x8cecb9){while(--_0x8cecb9){_0x15c538['push'](_0x15c538['shift']());}};_0x51d2cc(++_0x2ec6ab);}(_0x1438,0xe6));var _0x8143=function(_0x264781,_0x27bf68){_0x264781=_0x264781-0x0;var _0x382f5a=_0x1438[_0x264781];return _0x382f5a;};'use strict';var multer=require(_0x8143('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8143('0x1'));var express=require(_0x8143('0x2'));var router=express[_0x8143('0x3')]();var fs_extra=require(_0x8143('0x4'));var auth=require(_0x8143('0x5'));var interaction=require(_0x8143('0x6'));var config=require(_0x8143('0x7'));var controller=require(_0x8143('0x8'));router[_0x8143('0x9')]('/',auth[_0x8143('0xa')](),controller[_0x8143('0xb')]);router[_0x8143('0x9')](_0x8143('0xc'),auth[_0x8143('0xa')](),controller[_0x8143('0xd')]);router[_0x8143('0x9')](_0x8143('0xe'),auth[_0x8143('0xa')](),controller['show']);router['get'](_0x8143('0xf'),auth[_0x8143('0xa')](),controller[_0x8143('0x10')]);router[_0x8143('0x9')](_0x8143('0x11'),auth['isAuthenticated'](),controller[_0x8143('0x12')]);router[_0x8143('0x9')](_0x8143('0x13'),auth[_0x8143('0xa')](),controller[_0x8143('0x14')]);router[_0x8143('0x15')]('/',auth[_0x8143('0xa')](),controller['create']);router['post'](_0x8143('0x11'),auth[_0x8143('0xa')](),controller[_0x8143('0x16')]);router[_0x8143('0x15')](_0x8143('0x13'),auth[_0x8143('0xa')](),controller[_0x8143('0x17')]);router[_0x8143('0x18')]('/:id',auth[_0x8143('0xa')](),controller[_0x8143('0x19')]);router[_0x8143('0x1a')](_0x8143('0xe'),auth['isAuthenticated'](),controller[_0x8143('0x1b')]);router[_0x8143('0x1a')](_0x8143('0x11'),auth[_0x8143('0xa')](),controller['removeTeams']);router[_0x8143('0x1a')](_0x8143('0x13'),auth[_0x8143('0xa')](),controller[_0x8143('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3df7=['/:id','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3df7,0xdc));var _0x73df=function(_0x15f849,_0x4bbc2e){_0x15f849=_0x15f849-0x0;var _0xeeb648=_0x3df7[_0x15f849];return _0xeeb648;};'use strict';var multer=require(_0x73df('0x0'));var util=require('util');var path=require(_0x73df('0x1'));var timeout=require(_0x73df('0x2'));var express=require(_0x73df('0x3'));var router=express[_0x73df('0x4')]();var fs_extra=require(_0x73df('0x5'));var auth=require(_0x73df('0x6'));var interaction=require(_0x73df('0x7'));var config=require(_0x73df('0x8'));var controller=require('./smsQueue.controller');router[_0x73df('0x9')]('/',auth[_0x73df('0xa')](),controller['index']);router['get'](_0x73df('0xb'),auth[_0x73df('0xa')](),controller['describe']);router[_0x73df('0x9')]('/:id',auth[_0x73df('0xa')](),controller['show']);router[_0x73df('0x9')](_0x73df('0xc'),auth[_0x73df('0xa')](),controller['getMembers']);router[_0x73df('0x9')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0xe')]);router[_0x73df('0x9')](_0x73df('0xf'),auth['isAuthenticated'](),controller[_0x73df('0x10')]);router['post']('/',auth[_0x73df('0xa')](),controller[_0x73df('0x11')]);router[_0x73df('0x12')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0x13')]);router[_0x73df('0x12')](_0x73df('0xf'),auth[_0x73df('0xa')](),controller[_0x73df('0x14')]);router[_0x73df('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x73df('0x16')]);router['delete'](_0x73df('0x17'),auth[_0x73df('0xa')](),controller['destroy']);router[_0x73df('0x18')](_0x73df('0xd'),auth[_0x73df('0xa')](),controller[_0x73df('0x19')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x73df('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 426a8f9..df1cfee 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 _0x060a=['INTEGER','ENUM','rrmemory','roundrobin','exports','STRING'];(function(_0x262f51,_0x3deb07){var _0x3eae95=function(_0x23652c){while(--_0x23652c){_0x262f51['push'](_0x262f51['shift']());}};_0x3eae95(++_0x3deb07);}(_0x060a,0x76));var _0xa060=function(_0x209abc,_0x3ed021){_0x209abc=_0x209abc-0x0;var _0x37b97b=_0x060a[_0x209abc];return _0x37b97b;};'use strict';var Sequelize=require('sequelize');module[_0xa060('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa060('0x1')]},'timeout':{'type':Sequelize[_0xa060('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa060('0x3')](_0xa060('0x4'),'beepall',_0xa060('0x5'))}}; \ No newline at end of file +var _0x2dea=['name','INTEGER','rrmemory','beepall','sequelize','STRING'];(function(_0xee07b5,_0x5baff5){var _0x139ade=function(_0x59c49d){while(--_0x59c49d){_0xee07b5['push'](_0xee07b5['shift']());}};_0x139ade(++_0x5baff5);}(_0x2dea,0x124));var _0xa2de=function(_0x27975e,_0x4856c2){_0x27975e=_0x27975e-0x0;var _0x383887=_0x2dea[_0x27975e];return _0x383887;};'use strict';var Sequelize=require(_0xa2de('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2de('0x1')],'unique':_0xa2de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa2de('0x1')]},'timeout':{'type':Sequelize[_0xa2de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa2de('0x4'),_0xa2de('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c61481a..28fb0b4 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x4e6ede,_0x21029b){var _0x11ef5b=function(_0x1e40c6){while(--_0x1e40c6){_0x4e6ede['push'](_0x4e6ede['shift']());}};_0x11ef5b(++_0x21029b);}(_0xdb28,0x106));var _0x8db2=function(_0x51dc03,_0x31f822){_0x51dc03=_0x51dc03-0x0;var _0x27008b=_0xdb28[_0x51dc03];return _0x27008b;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2032,0xd9));var _0x2203=function(_0x1d76f7,_0x624c33){_0x1d76f7=_0x1d76f7-0x0;var _0x379e1b=_0x2032[_0x1d76f7];return _0x379e1b;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ce089fd..70f36ab 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 _0x9648=['remove','emit','hasOwnProperty','exports','../../mysqldb','update'];(function(_0x1834fb,_0x38bfa4){var _0x578b25=function(_0xb3980e){while(--_0xb3980e){_0x1834fb['push'](_0x1834fb['shift']());}};_0x578b25(++_0x38bfa4);}(_0x9648,0x1cc));var _0x8964=function(_0x47056c,_0x479c2b){_0x47056c=_0x47056c-0x0;var _0x35e966=_0x9648[_0x47056c];return _0x35e966;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x8964('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8964('0x1'),'afterDestroy':_0x8964('0x2')};function emitEvent(_0x57967f){return function(_0x433fb5,_0x1e0543,_0x20c77c){SmsQueueEvents[_0x8964('0x3')](_0x57967f+':'+_0x433fb5['id'],_0x433fb5);SmsQueueEvents[_0x8964('0x3')](_0x57967f,_0x433fb5);_0x20c77c(null);};}for(var e in events){if(events[_0x8964('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8964('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x4415=['emit','hasOwnProperty','hook','../../mysqldb','save','update'];(function(_0x21b9b8,_0x3a1809){var _0x5e13b3=function(_0xbb6757){while(--_0xbb6757){_0x21b9b8['push'](_0x21b9b8['shift']());}};_0x5e13b3(++_0x3a1809);}(_0x4415,0x69));var _0x5441=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x4415[_0x4017b0];return _0x5ed4f7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5441('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5441('0x1'),'afterUpdate':_0x5441('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1d7c1c){return function(_0x2dd9ba,_0x12ead9,_0x4dab75){SmsQueueEvents[_0x5441('0x3')](_0x1d7c1c+':'+_0x2dd9ba['id'],_0x2dd9ba);SmsQueueEvents[_0x5441('0x3')](_0x1d7c1c,_0x2dd9ba);_0x4dab75(null);};}for(var e in events){if(events[_0x5441('0x4')](e)){var event=events[e];SmsQueue[_0x5441('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 30b0e6e..05fe8c4 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 _0xbbe3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports','define','sms_queues','util'];(function(_0x2a1a62,_0x1d7f52){var _0x36da60=function(_0x3ae336){while(--_0x3ae336){_0x2a1a62['push'](_0x2a1a62['shift']());}};_0x36da60(++_0x1d7f52);}(_0xbbe3,0x83));var _0x3bbe=function(_0x19b261,_0x8e3506){_0x19b261=_0x19b261-0x0;var _0x3393b5=_0xbbe3[_0x19b261];return _0x3393b5;};'use strict';var _=require('lodash');var util=require(_0x3bbe('0x0'));var logger=require(_0x3bbe('0x1'))(_0x3bbe('0x2'));var moment=require(_0x3bbe('0x3'));var BPromise=require(_0x3bbe('0x4'));var rp=require(_0x3bbe('0x5'));var fs=require('fs');var path=require(_0x3bbe('0x6'));var rimraf=require(_0x3bbe('0x7'));var config=require('../../config/environment');var attributes=require(_0x3bbe('0x8'));module[_0x3bbe('0x9')]=function(_0x54b2c3,_0xd78c83){return _0x54b2c3[_0x3bbe('0xa')]('SmsQueue',attributes,{'tableName':_0x3bbe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12e8=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsQueue.attributes','exports','SmsQueue'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x12e8,0x1b1));var _0x812e=function(_0x1c097f,_0xc57bae){_0x1c097f=_0x1c097f-0x0;var _0x2844de=_0x12e8[_0x1c097f];return _0x2844de;};'use strict';var _=require(_0x812e('0x0'));var util=require(_0x812e('0x1'));var logger=require(_0x812e('0x2'))(_0x812e('0x3'));var moment=require(_0x812e('0x4'));var BPromise=require(_0x812e('0x5'));var rp=require(_0x812e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x812e('0x7'));var config=require('../../config/environment');var attributes=require(_0x812e('0x8'));module[_0x812e('0x9')]=function(_0x4393da,_0x484ccb){return _0x4393da['define'](_0x812e('0xa'),attributes,{'tableName':_0x812e('0xb'),'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 2a3bc98..1ec41a5 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 _0x6442=['request\x20sent','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','limit','include','map','model','attributes','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6442,0xb9));var _0x2644=function(_0x362519,_0x5d067b){_0x362519=_0x362519-0x0;var _0x134ba4=_0x6442[_0x362519];return _0x134ba4;};'use strict';var _=require(_0x2644('0x0'));var util=require(_0x2644('0x1'));var moment=require(_0x2644('0x2'));var BPromise=require(_0x2644('0x3'));var rs=require(_0x2644('0x4'));var fs=require('fs');var Redis=require(_0x2644('0x5'));var db=require(_0x2644('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2644('0x7'))(_0x2644('0x8'));var config=require(_0x2644('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2644('0xa')][_0x2644('0xb')]({'port':0x232a});config[_0x2644('0xc')]=_[_0x2644('0xd')](config[_0x2644('0xc')],{'host':_0x2644('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2644('0xc')]));require('./smsQueue.socket')[_0x2644('0xf')](socket);function respondWithRpcPromise(_0x501122,_0x4dece4,_0x1e7d7e){return new BPromise(function(_0x511001,_0x466d01){return client['request'](_0x501122,_0x1e7d7e)[_0x2644('0x10')](function(_0x115100){logger[_0x2644('0x11')]('SmsQueue,\x20%s,\x20%s',_0x4dece4,'request\x20sent');logger[_0x2644('0x12')](_0x2644('0x13'),_0x4dece4,_0x2644('0x14'),JSON[_0x2644('0x15')](_0x115100));if(_0x115100['error']){if(_0x115100[_0x2644('0x16')][_0x2644('0x17')]===0x1f4){logger[_0x2644('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4dece4,_0x115100[_0x2644('0x16')]['message']);return _0x466d01(_0x115100['error'][_0x2644('0x18')]);}logger[_0x2644('0x16')](_0x2644('0x19'),_0x4dece4,_0x115100[_0x2644('0x16')][_0x2644('0x18')]);return _0x511001(_0x115100[_0x2644('0x16')]['message']);}else{logger['info'](_0x2644('0x19'),_0x4dece4,_0x2644('0x14'));_0x511001(_0x115100[_0x2644('0x1a')]['message']);}})[_0x2644('0x1b')](function(_0x294605){logger['error'](_0x2644('0x19'),_0x4dece4,_0x294605);_0x466d01(_0x294605);});});}exports[_0x2644('0x1c')]=function(_0x14b7af){var _0x7f005b=this;return new Promise(function(_0x13580f,_0x3db1f4){return db[_0x2644('0x1d')][_0x2644('0x1e')]({'raw':_0x14b7af[_0x2644('0x1f')]?_0x14b7af[_0x2644('0x1f')][_0x2644('0x20')]===undefined?!![]:![]:!![],'where':_0x14b7af[_0x2644('0x1f')]?_0x14b7af[_0x2644('0x1f')]['where']||null:null,'attributes':_0x14b7af[_0x2644('0x1f')]?_0x14b7af[_0x2644('0x1f')]['attributes']||null:null,'limit':_0x14b7af[_0x2644('0x1f')]?_0x14b7af['options'][_0x2644('0x21')]||null:null,'include':_0x14b7af[_0x2644('0x1f')]?_0x14b7af[_0x2644('0x1f')][_0x2644('0x22')]?_[_0x2644('0x23')](_0x14b7af[_0x2644('0x1f')][_0x2644('0x22')],function(_0x56514b){return{'model':db[_0x56514b[_0x2644('0x24')]],'as':_0x56514b['as'],'attributes':_0x56514b[_0x2644('0x25')],'include':_0x56514b[_0x2644('0x22')]?_['map'](_0x56514b[_0x2644('0x22')],function(_0x3f524a){return{'model':db[_0x3f524a['model']],'as':_0x3f524a['as'],'attributes':_0x3f524a[_0x2644('0x25')],'include':_0x3f524a[_0x2644('0x22')]?_[_0x2644('0x23')](_0x3f524a[_0x2644('0x22')],function(_0x381878){return{'model':db[_0x381878[_0x2644('0x24')]],'as':_0x381878['as'],'attributes':_0x381878['attributes']};}):[]};}):[]};}):[]:[]})[_0x2644('0x10')](function(_0x28d7e2){logger[_0x2644('0x11')](_0x2644('0x1c'),_0x14b7af);logger[_0x2644('0x12')]('GetSmsQueue',_0x14b7af,JSON[_0x2644('0x15')](_0x28d7e2));_0x13580f(_0x28d7e2);})[_0x2644('0x1b')](function(_0xb0756a){logger[_0x2644('0x16')]('GetSmsQueue',_0xb0756a[_0x2644('0x18')],_0x14b7af);_0x3db1f4(_0x7f005b[_0x2644('0x16')](0x1f4,_0xb0756a['message']));});});};exports[_0x2644('0x26')]=function(_0x16388d){var _0x1c6dc4=this;return new Promise(function(_0x44bca4,_0x54cf34){return db[_0x2644('0x1d')][_0x2644('0x27')]({'raw':_0x16388d[_0x2644('0x1f')]?_0x16388d[_0x2644('0x1f')][_0x2644('0x20')]===undefined?!![]:![]:!![],'where':_0x16388d[_0x2644('0x1f')]?_0x16388d['options'][_0x2644('0x28')]||null:null,'attributes':_0x16388d[_0x2644('0x1f')]?_0x16388d[_0x2644('0x1f')]['attributes']||null:null,'include':_0x16388d['options']?_0x16388d[_0x2644('0x1f')][_0x2644('0x22')]?_[_0x2644('0x23')](_0x16388d[_0x2644('0x1f')]['include'],function(_0x3cd107){return{'model':db[_0x3cd107['model']],'as':_0x3cd107['as'],'attributes':_0x3cd107[_0x2644('0x25')],'include':_0x3cd107[_0x2644('0x22')]?_[_0x2644('0x23')](_0x3cd107[_0x2644('0x22')],function(_0x1f9380){return{'model':db[_0x1f9380[_0x2644('0x24')]],'as':_0x1f9380['as'],'attributes':_0x1f9380['attributes'],'include':_0x1f9380[_0x2644('0x22')]?_['map'](_0x1f9380[_0x2644('0x22')],function(_0xdef0ac){return{'model':db[_0xdef0ac[_0x2644('0x24')]],'as':_0xdef0ac['as'],'attributes':_0xdef0ac[_0x2644('0x25')]};}):[]};}):[]};}):[]:[]})[_0x2644('0x10')](function(_0x3774aa){logger[_0x2644('0x11')](_0x2644('0x26'),_0x16388d);logger[_0x2644('0x12')](_0x2644('0x26'),_0x16388d,JSON[_0x2644('0x15')](_0x3774aa));_0x44bca4(_0x3774aa);})[_0x2644('0x1b')](function(_0x3e94b7){logger['error']('ShowSmsQueue',_0x3e94b7['message'],_0x16388d);_0x54cf34(_0x1c6dc4[_0x2644('0x16')](0x1f4,_0x3e94b7['message']));});});}; \ No newline at end of file +var _0xcf5e=['limit','map','model','include','ShowSmsQueue','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./smsQueue.socket','request','info','request\x20sent','debug','stringify','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xcf5e,0x13f));var _0xecf5=function(_0x4fae5e,_0x11215c){_0x4fae5e=_0x4fae5e-0x0;var _0x1b0302=_0xcf5e[_0x4fae5e];return _0x1b0302;};'use strict';var _=require('lodash');var util=require(_0xecf5('0x0'));var moment=require(_0xecf5('0x1'));var BPromise=require(_0xecf5('0x2'));var rs=require(_0xecf5('0x3'));var fs=require('fs');var Redis=require(_0xecf5('0x4'));var db=require(_0xecf5('0x5'))['db'];var utils=require(_0xecf5('0x6'));var logger=require(_0xecf5('0x7'))(_0xecf5('0x8'));var config=require(_0xecf5('0x9'));var jayson=require(_0xecf5('0xa'));var client=jayson['client'][_0xecf5('0xb')]({'port':0x232a});config['redis']=_[_0xecf5('0xc')](config[_0xecf5('0xd')],{'host':_0xecf5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecf5('0xd')]));require(_0xecf5('0xf'))['register'](socket);function respondWithRpcPromise(_0x5aa094,_0x464dab,_0xa6a5b9){return new BPromise(function(_0x1560a8,_0x483044){return client[_0xecf5('0x10')](_0x5aa094,_0xa6a5b9)['then'](function(_0x13a853){logger[_0xecf5('0x11')]('SmsQueue,\x20%s,\x20%s',_0x464dab,_0xecf5('0x12'));logger[_0xecf5('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x464dab,_0xecf5('0x12'),JSON[_0xecf5('0x14')](_0x13a853));if(_0x13a853[_0xecf5('0x15')]){if(_0x13a853[_0xecf5('0x15')]['code']===0x1f4){logger['error'](_0xecf5('0x16'),_0x464dab,_0x13a853[_0xecf5('0x15')]['message']);return _0x483044(_0x13a853[_0xecf5('0x15')][_0xecf5('0x17')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x464dab,_0x13a853[_0xecf5('0x15')]['message']);return _0x1560a8(_0x13a853[_0xecf5('0x15')][_0xecf5('0x17')]);}else{logger[_0xecf5('0x11')](_0xecf5('0x16'),_0x464dab,_0xecf5('0x12'));_0x1560a8(_0x13a853['result'][_0xecf5('0x17')]);}})[_0xecf5('0x18')](function(_0x6de3fd){logger['error'](_0xecf5('0x16'),_0x464dab,_0x6de3fd);_0x483044(_0x6de3fd);});});}exports[_0xecf5('0x19')]=function(_0xea4e56){var _0x1897bf=this;return new Promise(function(_0x21fd51,_0x32d315){return db[_0xecf5('0x1a')][_0xecf5('0x1b')]({'raw':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1d')]===undefined?!![]:![]:!![],'where':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1e')]||null:null,'attributes':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x1f')]||null:null,'limit':_0xea4e56['options']?_0xea4e56[_0xecf5('0x1c')][_0xecf5('0x20')]||null:null,'include':_0xea4e56[_0xecf5('0x1c')]?_0xea4e56[_0xecf5('0x1c')]['include']?_[_0xecf5('0x21')](_0xea4e56[_0xecf5('0x1c')]['include'],function(_0x3300b0){return{'model':db[_0x3300b0[_0xecf5('0x22')]],'as':_0x3300b0['as'],'attributes':_0x3300b0[_0xecf5('0x1f')],'include':_0x3300b0[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x3300b0[_0xecf5('0x23')],function(_0x198c8a){return{'model':db[_0x198c8a[_0xecf5('0x22')]],'as':_0x198c8a['as'],'attributes':_0x198c8a[_0xecf5('0x1f')],'include':_0x198c8a[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x198c8a['include'],function(_0x2776cc){return{'model':db[_0x2776cc[_0xecf5('0x22')]],'as':_0x2776cc['as'],'attributes':_0x2776cc[_0xecf5('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3e74){logger[_0xecf5('0x11')](_0xecf5('0x19'),_0xea4e56);logger[_0xecf5('0x13')](_0xecf5('0x19'),_0xea4e56,JSON[_0xecf5('0x14')](_0x5a3e74));_0x21fd51(_0x5a3e74);})['catch'](function(_0x4d0639){logger['error'](_0xecf5('0x19'),_0x4d0639[_0xecf5('0x17')],_0xea4e56);_0x32d315(_0x1897bf[_0xecf5('0x15')](0x1f4,_0x4d0639['message']));});});};exports[_0xecf5('0x24')]=function(_0x4ffc1c){var _0x31e631=this;return new Promise(function(_0x4f17e0,_0x5077c3){return db['SmsQueue'][_0xecf5('0x25')]({'raw':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c['options'][_0xecf5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c[_0xecf5('0x1c')]['where']||null:null,'attributes':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c['options'][_0xecf5('0x1f')]||null:null,'include':_0x4ffc1c[_0xecf5('0x1c')]?_0x4ffc1c[_0xecf5('0x1c')]['include']?_[_0xecf5('0x21')](_0x4ffc1c[_0xecf5('0x1c')]['include'],function(_0x56a6bc){return{'model':db[_0x56a6bc[_0xecf5('0x22')]],'as':_0x56a6bc['as'],'attributes':_0x56a6bc[_0xecf5('0x1f')],'include':_0x56a6bc[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x56a6bc[_0xecf5('0x23')],function(_0x550378){return{'model':db[_0x550378['model']],'as':_0x550378['as'],'attributes':_0x550378[_0xecf5('0x1f')],'include':_0x550378[_0xecf5('0x23')]?_[_0xecf5('0x21')](_0x550378[_0xecf5('0x23')],function(_0x760f63){return{'model':db[_0x760f63[_0xecf5('0x22')]],'as':_0x760f63['as'],'attributes':_0x760f63[_0xecf5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xecf5('0x26')](function(_0x159d6a){logger[_0xecf5('0x11')]('ShowSmsQueue',_0x4ffc1c);logger['debug']('ShowSmsQueue',_0x4ffc1c,JSON[_0xecf5('0x14')](_0x159d6a));_0x4f17e0(_0x159d6a);})[_0xecf5('0x18')](function(_0xc41030){logger[_0xecf5('0x15')](_0xecf5('0x24'),_0xc41030[_0xecf5('0x17')],_0x4ffc1c);_0x5077c3(_0x31e631[_0xecf5('0x15')](0x1f4,_0xc41030[_0xecf5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8444824..f58e95c 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 _0xe344=['update','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0x390b40,_0x32a62e){var _0x11a416=function(_0x985f68){while(--_0x985f68){_0x390b40['push'](_0x390b40['shift']());}};_0x11a416(++_0x32a62e);}(_0xe344,0x153));var _0x4e34=function(_0x42689e,_0x1a3c12){_0x42689e=_0x42689e-0x0;var _0x39a55a=_0xe344[_0x42689e];return _0x39a55a;};'use strict';var SmsQueueEvents=require(_0x4e34('0x0'));var events=['save','remove',_0x4e34('0x1')];function createListener(_0xaac81a,_0x2be3aa){return function(_0x1c32a0){_0x2be3aa['emit'](_0xaac81a,_0x1c32a0);};}function removeListener(_0x36eac0,_0x4798a7){return function(){SmsQueueEvents[_0x4e34('0x2')](_0x36eac0,_0x4798a7);};}exports['register']=function(_0x786ef0){for(var _0x36fa82=0x0,_0x25f87f=events[_0x4e34('0x3')];_0x36fa82<_0x25f87f;_0x36fa82++){var _0x224f06=events[_0x36fa82];var _0x2bf286=createListener(_0x4e34('0x4')+_0x224f06,_0x786ef0);SmsQueueEvents['on'](_0x224f06,_0x2bf286);}}; \ No newline at end of file +var _0x8cea=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x6d9edf,_0x33270f){var _0x380379=function(_0x122e5c){while(--_0x122e5c){_0x6d9edf['push'](_0x6d9edf['shift']());}};_0x380379(++_0x33270f);}(_0x8cea,0x104));var _0xa8ce=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x8cea[_0x2e6dbf];return _0x2680e5;};'use strict';var SmsQueueEvents=require(_0xa8ce('0x0'));var events=[_0xa8ce('0x1'),_0xa8ce('0x2'),_0xa8ce('0x3')];function createListener(_0x472580,_0x52ffce){return function(_0x1c88bf){_0x52ffce[_0xa8ce('0x4')](_0x472580,_0x1c88bf);};}function removeListener(_0x495f54,_0x56c6ff){return function(){SmsQueueEvents[_0xa8ce('0x5')](_0x495f54,_0x56c6ff);};}exports[_0xa8ce('0x6')]=function(_0x58dbf8){for(var _0x5b17c7=0x0,_0xd375e7=events[_0xa8ce('0x7')];_0x5b17c7<_0xd375e7;_0x5b17c7++){var _0x3ab5f9=events[_0x5b17c7];var _0x43e6a0=createListener(_0xa8ce('0x8')+_0x3ab5f9,_0x58dbf8);SmsQueueEvents['on'](_0x3ab5f9,_0x43e6a0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 7ea1429..fd39205 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 _0x1d7b=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x38b27f,_0x4b9a43){var _0x5b9c4d=function(_0x38f7ed){while(--_0x38f7ed){_0x38b27f['push'](_0x38b27f['shift']());}};_0x5b9c4d(++_0x4b9a43);}(_0x1d7b,0xb9));var _0xb1d7=function(_0x35792f,_0x462a6e){_0x35792f=_0x35792f-0x0;var _0x55c2eb=_0x1d7b[_0x35792f];return _0x55c2eb;};'use strict';var multer=require(_0xb1d7('0x0'));var util=require(_0xb1d7('0x1'));var path=require(_0xb1d7('0x2'));var timeout=require(_0xb1d7('0x3'));var express=require(_0xb1d7('0x4'));var router=express[_0xb1d7('0x5')]();var fs_extra=require(_0xb1d7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1d7('0x7'));var controller=require(_0xb1d7('0x8'));router[_0xb1d7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1d7('0x9')]('/describe',auth[_0xb1d7('0xa')](),controller['describe']);router[_0xb1d7('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb1d7('0xa')](),controller[_0xb1d7('0xb')]);router[_0xb1d7('0xc')](_0xb1d7('0xd'),auth[_0xb1d7('0xa')](),controller[_0xb1d7('0xe')]);router['delete'](_0xb1d7('0xd'),auth[_0xb1d7('0xa')](),controller[_0xb1d7('0xf')]);module[_0xb1d7('0x10')]=router; \ No newline at end of file +var _0x8d0a=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','delete','destroy'];(function(_0x5c9025,_0x32b52f){var _0x53ec3b=function(_0x558612){while(--_0x558612){_0x5c9025['push'](_0x5c9025['shift']());}};_0x53ec3b(++_0x32b52f);}(_0x8d0a,0x65));var _0xa8d0=function(_0x25e91e,_0x525f91){_0x25e91e=_0x25e91e-0x0;var _0x4c3018=_0x8d0a[_0x25e91e];return _0x4c3018;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['put'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);module[_0xa8d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 71bb0de..a026b7f 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 _0x1e93=['DATE','moment','sequelize','exports','STRING'];(function(_0x1ad429,_0x286d5f){var _0x27e980=function(_0x9f680b){while(--_0x9f680b){_0x1ad429['push'](_0x1ad429['shift']());}};_0x27e980(++_0x286d5f);}(_0x1e93,0x14b));var _0x31e9=function(_0x3792f8,_0x23b71b){_0x3792f8=_0x3792f8-0x0;var _0x591de9=_0x1e93[_0x3792f8];return _0x591de9;};'use strict';var moment=require(_0x31e9('0x0'));var Sequelize=require(_0x31e9('0x1'));module[_0x31e9('0x2')]={'uniqueid':{'type':Sequelize[_0x31e9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x31e9('0x4')]},'leaveAt':{'type':Sequelize[_0x31e9('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x31e9('0x3')]}}; \ No newline at end of file +var _0xf77f=['moment','exports','STRING','DATE'];(function(_0x3a317e,_0xded344){var _0x80baf2=function(_0x4f9a1d){while(--_0x4f9a1d){_0x3a317e['push'](_0x3a317e['shift']());}};_0x80baf2(++_0xded344);}(_0xf77f,0x134));var _0xff77=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf77f[_0x376b45];return _0x2341b3;};'use strict';var moment=require(_0xff77('0x0'));var Sequelize=require('sequelize');module[_0xff77('0x1')]={'uniqueid':{'type':Sequelize[_0xff77('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xff77('0x2')]},'joinAt':{'type':Sequelize[_0xff77('0x3')]},'leaveAt':{'type':Sequelize[_0xff77('0x3')]},'acceptAt':{'type':Sequelize[_0xff77('0x3')]},'exitAt':{'type':Sequelize[_0xff77('0x3')]},'reason':{'type':Sequelize[_0xff77('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a203198..9584da9 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 _0x63f9=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','send','index','type','key','model','name','keys','query','filters','attributes','intersection','fields','nolimit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x20a1a6,_0x17a33c){var _0x45ab6c=function(_0x146e6d){while(--_0x146e6d){_0x20a1a6['push'](_0x20a1a6['shift']());}};_0x45ab6c(++_0x17a33c);}(_0x63f9,0x124));var _0x963f=function(_0x247c04,_0x4dc4b8){_0x247c04=_0x247c04-0x0;var _0x49fd58=_0x63f9[_0x247c04];return _0x49fd58;};'use strict';var emlformat=require(_0x963f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x963f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x963f('0x2'));var moment=require(_0x963f('0x3'));var BPromise=require(_0x963f('0x4'));var Mustache=require(_0x963f('0x5'));var util=require(_0x963f('0x6'));var path=require('path');var sox=require(_0x963f('0x7'));var csv=require(_0x963f('0x8'));var ejs=require(_0x963f('0x9'));var fs=require('fs');var fs_extra=require(_0x963f('0xa'));var _=require(_0x963f('0xb'));var squel=require(_0x963f('0xc'));var crypto=require(_0x963f('0xd'));var jsforce=require(_0x963f('0xe'));var deskjs=require(_0x963f('0xf'));var toCsv=require(_0x963f('0x8'));var querystring=require(_0x963f('0x10'));var Papa=require(_0x963f('0x11'));var Redis=require(_0x963f('0x12'));var authService=require(_0x963f('0x13'));var qs=require(_0x963f('0x14'));var as=require(_0x963f('0x15'));var hardwareService=require(_0x963f('0x16'));var logger=require(_0x963f('0x17'))(_0x963f('0x18'));var utils=require(_0x963f('0x19'));var config=require(_0x963f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x963f('0x1b'))['db'];function respondWithStatusCode(_0x3e67b2,_0x57945e){_0x57945e=_0x57945e||0xcc;return function(_0x920a93){if(_0x920a93){return _0x3e67b2[_0x963f('0x1c')](_0x57945e);}return _0x3e67b2['status'](_0x57945e)['end']();};}function respondWithResult(_0x1e30b6,_0x4cf684){_0x4cf684=_0x4cf684||0xc8;return function(_0x5d1eeb){if(_0x5d1eeb){return _0x1e30b6[_0x963f('0x1d')](_0x4cf684)[_0x963f('0x1e')](_0x5d1eeb);}};}function respondWithFilteredResult(_0x1f302e,_0x2e1e8d){return function(_0x1aba10){if(_0x1aba10){var _0x3a9b96=typeof _0x2e1e8d['offset']===_0x963f('0x1f')&&typeof _0x2e1e8d[_0x963f('0x20')]==='undefined';var _0x119e6c=_0x1aba10[_0x963f('0x21')];var _0x191b35=_0x3a9b96?0x0:_0x2e1e8d['offset'];var _0x26d3d9=_0x3a9b96?_0x1aba10[_0x963f('0x21')]:_0x2e1e8d['offset']+_0x2e1e8d[_0x963f('0x20')];var _0x5f3f87;if(_0x26d3d9>=_0x119e6c){_0x26d3d9=_0x119e6c;_0x5f3f87=0xc8;}else{_0x5f3f87=0xce;}_0x1f302e[_0x963f('0x1d')](_0x5f3f87);return _0x1f302e['set'](_0x963f('0x22'),_0x191b35+'-'+_0x26d3d9+'/'+_0x119e6c)[_0x963f('0x1e')](_0x1aba10);}return null;};}function patchUpdates(_0x4a37c9){return function(_0x599e96){try{jsonpatch['apply'](_0x599e96,_0x4a37c9,!![]);}catch(_0x3fb807){return BPromise[_0x963f('0x23')](_0x3fb807);}return _0x599e96[_0x963f('0x24')]();};}function saveUpdates(_0x28324c,_0x230f49){return function(_0x57fa23){if(_0x57fa23){return _0x57fa23['update'](_0x28324c)[_0x963f('0x25')](function(_0x519ae7){return _0x519ae7;});}return null;};}function removeEntity(_0x61ef64,_0x124f2b){return function(_0x5280e1){if(_0x5280e1){return _0x5280e1[_0x963f('0x26')]()[_0x963f('0x25')](function(){_0x61ef64[_0x963f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f7c0d,_0xdadafc){return function(_0xa845ec){if(!_0xa845ec){_0x3f7c0d[_0x963f('0x1c')](0x194);}return _0xa845ec;};}function handleError(_0x39edf5,_0x3c69d5){_0x3c69d5=_0x3c69d5||0x1f4;return function(_0xc19dc1){logger[_0x963f('0x27')](_0xc19dc1[_0x963f('0x28')]);if(_0xc19dc1['name']){delete _0xc19dc1['name'];}_0x39edf5[_0x963f('0x1d')](_0x3c69d5)[_0x963f('0x29')](_0xc19dc1);};}exports[_0x963f('0x2a')]=function(_0x5c4fba,_0x59ae48){var _0x3ffb93={},_0x268bac={},_0x49816a={'count':0x0,'rows':[]};var _0x46ef1d=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x493350){return{'name':_0x493350['fieldName'],'type':_0x493350[_0x963f('0x2b')][_0x963f('0x2c')]};});_0x268bac[_0x963f('0x2d')]=_['map'](_0x46ef1d,_0x963f('0x2e'));_0x268bac['query']=_[_0x963f('0x2f')](_0x5c4fba[_0x963f('0x30')]);_0x268bac[_0x963f('0x31')]=_['intersection'](_0x268bac[_0x963f('0x2d')],_0x268bac[_0x963f('0x30')]);_0x3ffb93[_0x963f('0x32')]=_[_0x963f('0x33')](_0x268bac[_0x963f('0x2d')],qs[_0x963f('0x34')](_0x5c4fba[_0x963f('0x30')][_0x963f('0x34')]));_0x3ffb93[_0x963f('0x32')]=_0x3ffb93['attributes']['length']?_0x3ffb93['attributes']:_0x268bac[_0x963f('0x2d')];if(!_0x5c4fba['query']['hasOwnProperty'](_0x963f('0x35'))){_0x3ffb93['limit']=qs[_0x963f('0x20')](_0x5c4fba[_0x963f('0x30')][_0x963f('0x20')]);_0x3ffb93['offset']=qs['offset'](_0x5c4fba[_0x963f('0x30')][_0x963f('0x36')]);}_0x3ffb93[_0x963f('0x37')]=qs[_0x963f('0x38')](_0x5c4fba[_0x963f('0x30')][_0x963f('0x38')]);_0x3ffb93[_0x963f('0x39')]=qs[_0x963f('0x31')](_[_0x963f('0x3a')](_0x5c4fba['query'],_0x268bac[_0x963f('0x31')]),_0x46ef1d);if(_0x5c4fba[_0x963f('0x30')][_0x963f('0x3b')]){_0x3ffb93['where']=_[_0x963f('0x3c')](_0x3ffb93[_0x963f('0x39')],{'$or':_[_0x963f('0x3d')](_0x46ef1d,function(_0x21fbe5){if(_0x21fbe5[_0x963f('0x2b')]!==_0x963f('0x3e')){var _0xa28713={};_0xa28713[_0x21fbe5[_0x963f('0x2e')]]={'$like':'%'+_0x5c4fba[_0x963f('0x30')][_0x963f('0x3b')]+'%'};return _0xa28713;}})});}_0x3ffb93=_[_0x963f('0x3c')]({},_0x3ffb93,_0x5c4fba[_0x963f('0x3f')]);var _0x10c317={'where':_0x3ffb93[_0x963f('0x39')]};return db[_0x963f('0x40')][_0x963f('0x21')](_0x10c317)[_0x963f('0x25')](function(_0x421404){_0x49816a[_0x963f('0x21')]=_0x421404;if(_0x5c4fba[_0x963f('0x30')][_0x963f('0x41')]){_0x3ffb93[_0x963f('0x42')]=[{'all':!![]}];}return db[_0x963f('0x40')][_0x963f('0x43')](_0x3ffb93);})[_0x963f('0x25')](function(_0x436ea3){_0x49816a[_0x963f('0x44')]=_0x436ea3;return _0x49816a;})['then'](respondWithFilteredResult(_0x59ae48,_0x3ffb93))[_0x963f('0x45')](handleError(_0x59ae48,null));};exports[_0x963f('0x46')]=function(_0x56a866,_0xd369bd){var _0x1d542d={'raw':!![],'where':{'id':_0x56a866[_0x963f('0x47')]['id']}},_0x36c58c={};_0x36c58c[_0x963f('0x2d')]=_['keys'](db[_0x963f('0x40')][_0x963f('0x48')]);_0x36c58c[_0x963f('0x30')]=_[_0x963f('0x2f')](_0x56a866[_0x963f('0x30')]);_0x36c58c['filters']=_[_0x963f('0x33')](_0x36c58c['model'],_0x36c58c[_0x963f('0x30')]);_0x1d542d[_0x963f('0x32')]=_[_0x963f('0x33')](_0x36c58c[_0x963f('0x2d')],qs[_0x963f('0x34')](_0x56a866[_0x963f('0x30')]['fields']));_0x1d542d[_0x963f('0x32')]=_0x1d542d[_0x963f('0x32')][_0x963f('0x49')]?_0x1d542d['attributes']:_0x36c58c[_0x963f('0x2d')];if(_0x56a866[_0x963f('0x30')][_0x963f('0x41')]){_0x1d542d['include']=[{'all':!![]}];}_0x1d542d=_[_0x963f('0x3c')]({},_0x1d542d,_0x56a866[_0x963f('0x3f')]);return db['SmsQueueReport'][_0x963f('0x4a')](_0x1d542d)['then'](handleEntityNotFound(_0xd369bd,null))[_0x963f('0x25')](respondWithResult(_0xd369bd,null))[_0x963f('0x45')](handleError(_0xd369bd,null));};exports[_0x963f('0x4b')]=function(_0x3be91b,_0x4a9442){return db[_0x963f('0x40')][_0x963f('0x4b')](_0x3be91b[_0x963f('0x4c')],{})[_0x963f('0x25')](respondWithResult(_0x4a9442,0xc9))['catch'](handleError(_0x4a9442,null));};exports[_0x963f('0x4d')]=function(_0x4e6606,_0x3059ae){if(_0x4e6606['body']['id']){delete _0x4e6606['body']['id'];}return db[_0x963f('0x40')][_0x963f('0x4a')]({'where':{'id':_0x4e6606['params']['id']}})['then'](handleEntityNotFound(_0x3059ae,null))[_0x963f('0x25')](saveUpdates(_0x4e6606['body'],null))[_0x963f('0x25')](respondWithResult(_0x3059ae,null))['catch'](handleError(_0x3059ae,null));};exports['destroy']=function(_0x434df5,_0x1a1e53){return db['SmsQueueReport'][_0x963f('0x4a')]({'where':{'id':_0x434df5[_0x963f('0x47')]['id']}})[_0x963f('0x25')](handleEntityNotFound(_0x1a1e53,null))['then'](removeEntity(_0x1a1e53,null))['catch'](handleError(_0x1a1e53,null));};exports[_0x963f('0x4e')]=function(_0x1f8802,_0x3cf97e){return db['SmsQueueReport'][_0x963f('0x4e')]()[_0x963f('0x25')](respondWithResult(_0x3cf97e,null))[_0x963f('0x45')](handleError(_0x3cf97e,null));}; \ No newline at end of file +var _0xa864=['Content-Range','apply','reject','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x5dcfbc,_0x39c822){var _0xadc7e=function(_0x354a18){while(--_0x354a18){_0x5dcfbc['push'](_0x5dcfbc['shift']());}};_0xadc7e(++_0x39c822);}(_0xa864,0x1a7));var _0x4a86=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xa864[_0x49ad79];return _0xa4e38a;};'use strict';var emlformat=require(_0x4a86('0x0'));var rimraf=require(_0x4a86('0x1'));var zipdir=require(_0x4a86('0x2'));var jsonpatch=require(_0x4a86('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a86('0x4'));var Mustache=require(_0x4a86('0x5'));var util=require(_0x4a86('0x6'));var path=require(_0x4a86('0x7'));var sox=require('sox');var csv=require(_0x4a86('0x8'));var ejs=require(_0x4a86('0x9'));var fs=require('fs');var fs_extra=require(_0x4a86('0xa'));var _=require(_0x4a86('0xb'));var squel=require(_0x4a86('0xc'));var crypto=require(_0x4a86('0xd'));var jsforce=require(_0x4a86('0xe'));var deskjs=require(_0x4a86('0xf'));var toCsv=require(_0x4a86('0x8'));var querystring=require(_0x4a86('0x10'));var Papa=require('papaparse');var Redis=require(_0x4a86('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4a86('0x12'));var as=require(_0x4a86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a86('0x14'))('api');var utils=require(_0x4a86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4a86('0x16'));var db=require(_0x4a86('0x17'))['db'];function respondWithStatusCode(_0x47f190,_0x57f5db){_0x57f5db=_0x57f5db||0xcc;return function(_0xe73276){if(_0xe73276){return _0x47f190[_0x4a86('0x18')](_0x57f5db);}return _0x47f190[_0x4a86('0x19')](_0x57f5db)[_0x4a86('0x1a')]();};}function respondWithResult(_0xd16f22,_0x5da97a){_0x5da97a=_0x5da97a||0xc8;return function(_0x275034){if(_0x275034){return _0xd16f22['status'](_0x5da97a)[_0x4a86('0x1b')](_0x275034);}};}function respondWithFilteredResult(_0x2315dd,_0x414abd){return function(_0x2f5840){if(_0x2f5840){var _0x484978=typeof _0x414abd[_0x4a86('0x1c')]===_0x4a86('0x1d')&&typeof _0x414abd['limit']===_0x4a86('0x1d');var _0x1d9de8=_0x2f5840[_0x4a86('0x1e')];var _0x209c73=_0x484978?0x0:_0x414abd[_0x4a86('0x1c')];var _0x80cf00=_0x484978?_0x2f5840[_0x4a86('0x1e')]:_0x414abd[_0x4a86('0x1c')]+_0x414abd[_0x4a86('0x1f')];var _0x35171e;if(_0x80cf00>=_0x1d9de8){_0x80cf00=_0x1d9de8;_0x35171e=0xc8;}else{_0x35171e=0xce;}_0x2315dd['status'](_0x35171e);return _0x2315dd[_0x4a86('0x20')](_0x4a86('0x21'),_0x209c73+'-'+_0x80cf00+'/'+_0x1d9de8)[_0x4a86('0x1b')](_0x2f5840);}return null;};}function patchUpdates(_0x4ab2a0){return function(_0xec2cc1){try{jsonpatch[_0x4a86('0x22')](_0xec2cc1,_0x4ab2a0,!![]);}catch(_0xed3e2f){return BPromise[_0x4a86('0x23')](_0xed3e2f);}return _0xec2cc1['save']();};}function saveUpdates(_0x5c9c70,_0x2e2c66){return function(_0x4d9182){if(_0x4d9182){return _0x4d9182['update'](_0x5c9c70)[_0x4a86('0x24')](function(_0x711331){return _0x711331;});}return null;};}function removeEntity(_0x2be463,_0x3638ca){return function(_0xc508ef){if(_0xc508ef){return _0xc508ef['destroy']()['then'](function(){_0x2be463['status'](0xcc)[_0x4a86('0x1a')]();});}};}function handleEntityNotFound(_0x523218,_0xe2d81d){return function(_0x1e7680){if(!_0x1e7680){_0x523218['sendStatus'](0x194);}return _0x1e7680;};}function handleError(_0x54fbff,_0x181a96){_0x181a96=_0x181a96||0x1f4;return function(_0x4968a9){logger[_0x4a86('0x25')](_0x4968a9[_0x4a86('0x26')]);if(_0x4968a9[_0x4a86('0x27')]){delete _0x4968a9[_0x4a86('0x27')];}_0x54fbff[_0x4a86('0x19')](_0x181a96)[_0x4a86('0x28')](_0x4968a9);};}exports[_0x4a86('0x29')]=function(_0x328059,_0x50bdb5){var _0x32fb82={},_0x23e465={},_0x466a6e={'count':0x0,'rows':[]};var _0x11fdb6=_[_0x4a86('0x2a')](db[_0x4a86('0x2b')][_0x4a86('0x2c')],function(_0x7c2fa0){return{'name':_0x7c2fa0[_0x4a86('0x2d')],'type':_0x7c2fa0[_0x4a86('0x2e')][_0x4a86('0x2f')]};});_0x23e465['model']=_[_0x4a86('0x2a')](_0x11fdb6,'name');_0x23e465['query']=_['keys'](_0x328059[_0x4a86('0x30')]);_0x23e465[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x23e465[_0x4a86('0x33')],_0x23e465['query']);_0x32fb82['attributes']=_[_0x4a86('0x32')](_0x23e465[_0x4a86('0x33')],qs[_0x4a86('0x34')](_0x328059[_0x4a86('0x30')][_0x4a86('0x34')]));_0x32fb82[_0x4a86('0x35')]=_0x32fb82['attributes'][_0x4a86('0x36')]?_0x32fb82[_0x4a86('0x35')]:_0x23e465[_0x4a86('0x33')];if(!_0x328059['query'][_0x4a86('0x37')](_0x4a86('0x38'))){_0x32fb82[_0x4a86('0x1f')]=qs[_0x4a86('0x1f')](_0x328059['query'][_0x4a86('0x1f')]);_0x32fb82[_0x4a86('0x1c')]=qs[_0x4a86('0x1c')](_0x328059[_0x4a86('0x30')]['offset']);}_0x32fb82[_0x4a86('0x39')]=qs['sort'](_0x328059[_0x4a86('0x30')][_0x4a86('0x3a')]);_0x32fb82[_0x4a86('0x3b')]=qs[_0x4a86('0x31')](_[_0x4a86('0x3c')](_0x328059['query'],_0x23e465[_0x4a86('0x31')]),_0x11fdb6);if(_0x328059[_0x4a86('0x30')][_0x4a86('0x3d')]){_0x32fb82[_0x4a86('0x3b')]=_[_0x4a86('0x3e')](_0x32fb82[_0x4a86('0x3b')],{'$or':_['map'](_0x11fdb6,function(_0x19acd8){if(_0x19acd8['type']!=='VIRTUAL'){var _0x4e617d={};_0x4e617d[_0x19acd8[_0x4a86('0x27')]]={'$like':'%'+_0x328059[_0x4a86('0x30')][_0x4a86('0x3d')]+'%'};return _0x4e617d;}})});}_0x32fb82=_[_0x4a86('0x3e')]({},_0x32fb82,_0x328059[_0x4a86('0x3f')]);var _0x4a1ccb={'where':_0x32fb82[_0x4a86('0x3b')]};return db[_0x4a86('0x2b')][_0x4a86('0x1e')](_0x4a1ccb)[_0x4a86('0x24')](function(_0x5ec51a){_0x466a6e[_0x4a86('0x1e')]=_0x5ec51a;if(_0x328059[_0x4a86('0x30')][_0x4a86('0x40')]){_0x32fb82['include']=[{'all':!![]}];}return db[_0x4a86('0x2b')][_0x4a86('0x41')](_0x32fb82);})[_0x4a86('0x24')](function(_0x5a555e){_0x466a6e[_0x4a86('0x42')]=_0x5a555e;return _0x466a6e;})['then'](respondWithFilteredResult(_0x50bdb5,_0x32fb82))[_0x4a86('0x43')](handleError(_0x50bdb5,null));};exports[_0x4a86('0x44')]=function(_0x585078,_0x51e608){var _0x525324={'raw':!![],'where':{'id':_0x585078[_0x4a86('0x45')]['id']}},_0x120c89={};_0x120c89[_0x4a86('0x33')]=_[_0x4a86('0x46')](db[_0x4a86('0x2b')][_0x4a86('0x2c')]);_0x120c89['query']=_['keys'](_0x585078[_0x4a86('0x30')]);_0x120c89[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x120c89[_0x4a86('0x33')],_0x120c89[_0x4a86('0x30')]);_0x525324[_0x4a86('0x35')]=_[_0x4a86('0x32')](_0x120c89[_0x4a86('0x33')],qs[_0x4a86('0x34')](_0x585078['query'][_0x4a86('0x34')]));_0x525324[_0x4a86('0x35')]=_0x525324[_0x4a86('0x35')][_0x4a86('0x36')]?_0x525324[_0x4a86('0x35')]:_0x120c89[_0x4a86('0x33')];if(_0x585078[_0x4a86('0x30')][_0x4a86('0x40')]){_0x525324['include']=[{'all':!![]}];}_0x525324=_[_0x4a86('0x3e')]({},_0x525324,_0x585078[_0x4a86('0x3f')]);return db['SmsQueueReport'][_0x4a86('0x47')](_0x525324)[_0x4a86('0x24')](handleEntityNotFound(_0x51e608,null))[_0x4a86('0x24')](respondWithResult(_0x51e608,null))[_0x4a86('0x43')](handleError(_0x51e608,null));};exports[_0x4a86('0x48')]=function(_0x75799b,_0x425fd3){return db[_0x4a86('0x2b')]['create'](_0x75799b[_0x4a86('0x49')],{})[_0x4a86('0x24')](respondWithResult(_0x425fd3,0xc9))[_0x4a86('0x43')](handleError(_0x425fd3,null));};exports['update']=function(_0x3b2e89,_0x1f6a7c){if(_0x3b2e89[_0x4a86('0x49')]['id']){delete _0x3b2e89[_0x4a86('0x49')]['id'];}return db[_0x4a86('0x2b')]['find']({'where':{'id':_0x3b2e89[_0x4a86('0x45')]['id']}})[_0x4a86('0x24')](handleEntityNotFound(_0x1f6a7c,null))[_0x4a86('0x24')](saveUpdates(_0x3b2e89[_0x4a86('0x49')],null))[_0x4a86('0x24')](respondWithResult(_0x1f6a7c,null))[_0x4a86('0x43')](handleError(_0x1f6a7c,null));};exports[_0x4a86('0x4a')]=function(_0x2f1d2a,_0xa8895a){return db['SmsQueueReport']['find']({'where':{'id':_0x2f1d2a[_0x4a86('0x45')]['id']}})[_0x4a86('0x24')](handleEntityNotFound(_0xa8895a,null))[_0x4a86('0x24')](removeEntity(_0xa8895a,null))[_0x4a86('0x43')](handleError(_0xa8895a,null));};exports[_0x4a86('0x4b')]=function(_0x49d543,_0x1f95c2){return db[_0x4a86('0x2b')][_0x4a86('0x4b')]()['then'](respondWithResult(_0x1f95c2,null))[_0x4a86('0x43')](handleError(_0x1f95c2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b9353c7..c4e7024 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xeda735,_0x51d771){var _0x4157cc=function(_0x139056){while(--_0x139056){_0xeda735['push'](_0xeda735['shift']());}};_0x4157cc(++_0x51d771);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d80e82a..55bc405 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 _0xc159=['info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x53f608,_0x256def){var _0x495b7d=function(_0x467eab){while(--_0x467eab){_0x53f608['push'](_0x53f608['shift']());}};_0x495b7d(++_0x256def);}(_0xc159,0x7a));var _0x9c15=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xc159[_0x45161c];return _0x186581;};'use strict';var _=require(_0x9c15('0x0'));var util=require(_0x9c15('0x1'));var moment=require(_0x9c15('0x2'));var BPromise=require(_0x9c15('0x3'));var rs=require(_0x9c15('0x4'));var fs=require('fs');var Redis=require(_0x9c15('0x5'));var db=require(_0x9c15('0x6'))['db'];var utils=require(_0x9c15('0x7'));var logger=require(_0x9c15('0x8'))(_0x9c15('0x9'));var config=require(_0x9c15('0xa'));var jayson=require(_0x9c15('0xb'));var client=jayson[_0x9c15('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa989a6,_0x43afbf,_0x41b755){return new BPromise(function(_0x498f38,_0x592bdb){return client['request'](_0xa989a6,_0x41b755)[_0x9c15('0xd')](function(_0x318b61){logger[_0x9c15('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x43afbf,_0x9c15('0xf'));logger[_0x9c15('0x10')](_0x9c15('0x11'),_0x43afbf,_0x9c15('0xf'),JSON[_0x9c15('0x12')](_0x318b61));if(_0x318b61[_0x9c15('0x13')]){if(_0x318b61[_0x9c15('0x13')]['code']===0x1f4){logger[_0x9c15('0x13')](_0x9c15('0x14'),_0x43afbf,_0x318b61[_0x9c15('0x13')][_0x9c15('0x15')]);return _0x592bdb(_0x318b61['error'][_0x9c15('0x15')]);}logger[_0x9c15('0x13')](_0x9c15('0x14'),_0x43afbf,_0x318b61[_0x9c15('0x13')][_0x9c15('0x15')]);return _0x498f38(_0x318b61[_0x9c15('0x13')][_0x9c15('0x15')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x43afbf,_0x9c15('0xf'));_0x498f38(_0x318b61[_0x9c15('0x16')][_0x9c15('0x15')]);}})[_0x9c15('0x17')](function(_0x13d522){logger[_0x9c15('0x13')](_0x9c15('0x14'),_0x43afbf,_0x13d522);_0x592bdb(_0x13d522);});});}exports['CreateSmsQueueReport']=function(_0x374bc0){var _0x1e9d0c=this;return new Promise(function(_0x3b3bca,_0x2f1019){return db[_0x9c15('0x18')]['create'](_0x374bc0[_0x9c15('0x19')],{'raw':_0x374bc0[_0x9c15('0x1a')]?_0x374bc0[_0x9c15('0x1a')][_0x9c15('0x1b')]===undefined?!![]:![]:!![]})[_0x9c15('0xd')](function(_0xe35cbe){logger[_0x9c15('0xe')](_0x9c15('0x1c'),_0x374bc0);logger[_0x9c15('0x10')](_0x9c15('0x1c'),_0x374bc0,JSON[_0x9c15('0x12')](_0xe35cbe));_0x3b3bca(_0xe35cbe);})[_0x9c15('0x17')](function(_0x564f9e){logger[_0x9c15('0x13')](_0x9c15('0x1c'),_0x564f9e[_0x9c15('0x15')],_0x374bc0);_0x2f1019(_0x1e9d0c[_0x9c15('0x13')](0x1f4,_0x564f9e[_0x9c15('0x15')]));});});};exports[_0x9c15('0x1d')]=function(_0x2976ad){var _0x11f122=this;return new Promise(function(_0x8f92ce,_0x3cf00e){return db['SmsQueueReport'][_0x9c15('0x1e')](_0x2976ad['body'],{'raw':_0x2976ad[_0x9c15('0x1a')]?_0x2976ad[_0x9c15('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2976ad[_0x9c15('0x1a')]?_0x2976ad['options'][_0x9c15('0x1f')]||null:null,'attributes':_0x2976ad['options']?_0x2976ad[_0x9c15('0x1a')][_0x9c15('0x20')]||null:null,'limit':_0x2976ad[_0x9c15('0x1a')]?_0x2976ad[_0x9c15('0x1a')][_0x9c15('0x21')]||null:null})[_0x9c15('0xd')](function(_0x3f2438){logger[_0x9c15('0xe')](_0x9c15('0x1d'),_0x2976ad);logger[_0x9c15('0x10')](_0x9c15('0x1d'),_0x2976ad,JSON[_0x9c15('0x12')](_0x3f2438));_0x8f92ce(_0x3f2438);})['catch'](function(_0xa574ea){logger[_0x9c15('0x13')]('UpdateSmsQueueReport',_0xa574ea[_0x9c15('0x15')],_0x2976ad);_0x3cf00e(_0x11f122[_0x9c15('0x13')](0x1f4,_0xa574ea[_0x9c15('0x15')]));});});}; \ No newline at end of file +var _0xe720=['request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3caa59,_0x41d4c6){var _0x324b64=function(_0x4e757f){while(--_0x4e757f){_0x3caa59['push'](_0x3caa59['shift']());}};_0x324b64(++_0x41d4c6);}(_0xe720,0xf7));var _0x0e72=function(_0x2ba23b,_0x4d6341){_0x2ba23b=_0x2ba23b-0x0;var _0x3e521b=_0xe720[_0x2ba23b];return _0x3e521b;};'use strict';var _=require(_0x0e72('0x0'));var util=require(_0x0e72('0x1'));var moment=require(_0x0e72('0x2'));var BPromise=require(_0x0e72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e72('0x4'))['db'];var utils=require(_0x0e72('0x5'));var logger=require('../../config/logger')(_0x0e72('0x6'));var config=require(_0x0e72('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0e72('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40037d,_0x1478f6,_0x397056){return new BPromise(function(_0x3c62d8,_0x7abd3c){return client[_0x0e72('0x9')](_0x40037d,_0x397056)[_0x0e72('0xa')](function(_0x1b8228){logger[_0x0e72('0xb')](_0x0e72('0xc'),_0x1478f6,_0x0e72('0xd'));logger[_0x0e72('0xe')](_0x0e72('0xf'),_0x1478f6,_0x0e72('0xd'),JSON[_0x0e72('0x10')](_0x1b8228));if(_0x1b8228[_0x0e72('0x11')]){if(_0x1b8228[_0x0e72('0x11')]['code']===0x1f4){logger[_0x0e72('0x11')](_0x0e72('0xc'),_0x1478f6,_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);return _0x7abd3c(_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);}logger['error'](_0x0e72('0xc'),_0x1478f6,_0x1b8228[_0x0e72('0x11')][_0x0e72('0x12')]);return _0x3c62d8(_0x1b8228[_0x0e72('0x11')]['message']);}else{logger[_0x0e72('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x1478f6,_0x0e72('0xd'));_0x3c62d8(_0x1b8228[_0x0e72('0x13')][_0x0e72('0x12')]);}})[_0x0e72('0x14')](function(_0x23e31f){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1478f6,_0x23e31f);_0x7abd3c(_0x23e31f);});});}exports[_0x0e72('0x15')]=function(_0x3fe946){var _0x334c59=this;return new Promise(function(_0x5c3ae2,_0x16d30b){return db[_0x0e72('0x16')][_0x0e72('0x17')](_0x3fe946[_0x0e72('0x18')],{'raw':_0x3fe946[_0x0e72('0x19')]?_0x3fe946[_0x0e72('0x19')][_0x0e72('0x1a')]===undefined?!![]:![]:!![]})[_0x0e72('0xa')](function(_0x5ec6dc){logger['info'](_0x0e72('0x15'),_0x3fe946);logger[_0x0e72('0xe')]('CreateSmsQueueReport',_0x3fe946,JSON[_0x0e72('0x10')](_0x5ec6dc));_0x5c3ae2(_0x5ec6dc);})['catch'](function(_0x1812bf){logger[_0x0e72('0x11')]('CreateSmsQueueReport',_0x1812bf[_0x0e72('0x12')],_0x3fe946);_0x16d30b(_0x334c59[_0x0e72('0x11')](0x1f4,_0x1812bf[_0x0e72('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x9f206c){var _0x37409f=this;return new Promise(function(_0x14d14f,_0x423864){return db['SmsQueueReport'][_0x0e72('0x1b')](_0x9f206c[_0x0e72('0x18')],{'raw':_0x9f206c[_0x0e72('0x19')]?_0x9f206c[_0x0e72('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f206c[_0x0e72('0x19')]?_0x9f206c['options'][_0x0e72('0x1c')]||null:null,'attributes':_0x9f206c['options']?_0x9f206c[_0x0e72('0x19')][_0x0e72('0x1d')]||null:null,'limit':_0x9f206c['options']?_0x9f206c[_0x0e72('0x19')][_0x0e72('0x1e')]||null:null})[_0x0e72('0xa')](function(_0x5c4bfe){logger[_0x0e72('0xb')]('UpdateSmsQueueReport',_0x9f206c);logger[_0x0e72('0xe')](_0x0e72('0x1f'),_0x9f206c,JSON[_0x0e72('0x10')](_0x5c4bfe));_0x14d14f(_0x5c4bfe);})[_0x0e72('0x14')](function(_0x4384c8){logger[_0x0e72('0x11')](_0x0e72('0x1f'),_0x4384c8['message'],_0x9f206c);_0x423864(_0x37409f[_0x0e72('0x11')](0x1f4,_0x4384c8[_0x0e72('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 889ba0e..2f0ce24 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 _0x8d0a=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','delete','destroy'];(function(_0x81e5ac,_0x1a0601){var _0x32d059=function(_0x3b0229){while(--_0x3b0229){_0x81e5ac['push'](_0x81e5ac['shift']());}};_0x32d059(++_0x1a0601);}(_0x8d0a,0x65));var _0xa8d0=function(_0x2b7b9d,_0x89a529){_0x2b7b9d=_0x2b7b9d-0x0;var _0x57e721=_0x8d0a[_0x2b7b9d];return _0x57e721;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['put'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);module[_0xa8d0('0x13')]=router; \ No newline at end of file +var _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbd50,0x196));var _0x0bd5=function(_0x72a04b,_0x6e6ccc){_0x72a04b=_0x72a04b-0x0;var _0xc193c2=_0xbd50[_0x72a04b];return _0xc193c2;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 43308d8..44a8432 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2382fb,_0x230846){var _0x57cf00=function(_0x4e5981){while(--_0x4e5981){_0x2382fb['push'](_0x2382fb['shift']());}};_0x57cf00(++_0x230846);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a4eb6,_0x46baea){_0x4a4eb6=_0x4a4eb6-0x0;var _0x5cdad0=_0xedd9[_0x4a4eb6];return _0x5cdad0;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4eaae1,_0x4c214e){_0x4eaae1=_0x4eaae1-0x0;var _0x9fbaa2=_0x9bde[_0x4eaae1];return _0x9fbaa2;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ac28fb1..6b7b446 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 _0x4be5=['findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4be5,0x1f0));var _0x54be=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x4be5[_0x1e2321];return _0x1d346d;};'use strict';var emlformat=require(_0x54be('0x0'));var rimraf=require(_0x54be('0x1'));var zipdir=require(_0x54be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54be('0x3'));var moment=require(_0x54be('0x4'));var BPromise=require(_0x54be('0x5'));var Mustache=require(_0x54be('0x6'));var util=require(_0x54be('0x7'));var path=require(_0x54be('0x8'));var sox=require(_0x54be('0x9'));var csv=require(_0x54be('0xa'));var ejs=require(_0x54be('0xb'));var fs=require('fs');var fs_extra=require(_0x54be('0xc'));var _=require(_0x54be('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x54be('0xe'));var deskjs=require(_0x54be('0xf'));var toCsv=require('to-csv');var querystring=require(_0x54be('0x10'));var Papa=require(_0x54be('0x11'));var Redis=require(_0x54be('0x12'));var authService=require(_0x54be('0x13'));var qs=require(_0x54be('0x14'));var as=require(_0x54be('0x15'));var hardwareService=require(_0x54be('0x16'));var logger=require(_0x54be('0x17'))(_0x54be('0x18'));var utils=require(_0x54be('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x54be('0x1a'));var db=require(_0x54be('0x1b'))['db'];function respondWithStatusCode(_0x3e6e33,_0x3ffd5e){_0x3ffd5e=_0x3ffd5e||0xcc;return function(_0x6c5d34){if(_0x6c5d34){return _0x3e6e33[_0x54be('0x1c')](_0x3ffd5e);}return _0x3e6e33[_0x54be('0x1d')](_0x3ffd5e)[_0x54be('0x1e')]();};}function respondWithResult(_0x4009e6,_0x30a433){_0x30a433=_0x30a433||0xc8;return function(_0x29cc44){if(_0x29cc44){return _0x4009e6[_0x54be('0x1d')](_0x30a433)[_0x54be('0x1f')](_0x29cc44);}};}function respondWithFilteredResult(_0xf1d344,_0x456f4b){return function(_0x133edb){if(_0x133edb){var _0x100aa3=typeof _0x456f4b[_0x54be('0x20')]===_0x54be('0x21')&&typeof _0x456f4b[_0x54be('0x22')]==='undefined';var _0x2190e5=_0x133edb['count'];var _0x40bee7=_0x100aa3?0x0:_0x456f4b[_0x54be('0x20')];var _0x3a00f4=_0x100aa3?_0x133edb[_0x54be('0x23')]:_0x456f4b[_0x54be('0x20')]+_0x456f4b[_0x54be('0x22')];var _0x5742e6;if(_0x3a00f4>=_0x2190e5){_0x3a00f4=_0x2190e5;_0x5742e6=0xc8;}else{_0x5742e6=0xce;}_0xf1d344[_0x54be('0x1d')](_0x5742e6);return _0xf1d344['set'](_0x54be('0x24'),_0x40bee7+'-'+_0x3a00f4+'/'+_0x2190e5)['json'](_0x133edb);}return null;};}function patchUpdates(_0x1396d5){return function(_0x5a1a11){try{jsonpatch[_0x54be('0x25')](_0x5a1a11,_0x1396d5,!![]);}catch(_0xef9eb7){return BPromise[_0x54be('0x26')](_0xef9eb7);}return _0x5a1a11[_0x54be('0x27')]();};}function saveUpdates(_0x2cc583,_0x566e12){return function(_0x2c41c4){if(_0x2c41c4){return _0x2c41c4[_0x54be('0x28')](_0x2cc583)[_0x54be('0x29')](function(_0x3a02e1){return _0x3a02e1;});}return null;};}function removeEntity(_0x31414b,_0x2862f2){return function(_0x15f285){if(_0x15f285){return _0x15f285[_0x54be('0x2a')]()['then'](function(){_0x31414b['status'](0xcc)[_0x54be('0x1e')]();});}};}function handleEntityNotFound(_0x4ca320,_0x5e36ee){return function(_0x418e18){if(!_0x418e18){_0x4ca320[_0x54be('0x1c')](0x194);}return _0x418e18;};}function handleError(_0x8e5e8a,_0x14a203){_0x14a203=_0x14a203||0x1f4;return function(_0x2509bd){logger['error'](_0x2509bd[_0x54be('0x2b')]);if(_0x2509bd[_0x54be('0x2c')]){delete _0x2509bd['name'];}_0x8e5e8a['status'](_0x14a203)[_0x54be('0x2d')](_0x2509bd);};}exports[_0x54be('0x2e')]=function(_0x3cc59e,_0x4056d3){var _0x28e6e5={},_0xb8c1c9={},_0x4ed136={'count':0x0,'rows':[]};var _0x42e1e0=_[_0x54be('0x2f')](db[_0x54be('0x30')][_0x54be('0x31')],function(_0x48fcd6){return{'name':_0x48fcd6[_0x54be('0x32')],'type':_0x48fcd6['type']['key']};});_0xb8c1c9['model']=_['map'](_0x42e1e0,_0x54be('0x2c'));_0xb8c1c9['query']=_[_0x54be('0x33')](_0x3cc59e['query']);_0xb8c1c9[_0x54be('0x34')]=_[_0x54be('0x35')](_0xb8c1c9[_0x54be('0x36')],_0xb8c1c9[_0x54be('0x37')]);_0x28e6e5[_0x54be('0x38')]=_[_0x54be('0x35')](_0xb8c1c9[_0x54be('0x36')],qs[_0x54be('0x39')](_0x3cc59e['query'][_0x54be('0x39')]));_0x28e6e5[_0x54be('0x38')]=_0x28e6e5['attributes'][_0x54be('0x3a')]?_0x28e6e5['attributes']:_0xb8c1c9['model'];if(!_0x3cc59e[_0x54be('0x37')][_0x54be('0x3b')](_0x54be('0x3c'))){_0x28e6e5['limit']=qs[_0x54be('0x22')](_0x3cc59e[_0x54be('0x37')][_0x54be('0x22')]);_0x28e6e5[_0x54be('0x20')]=qs[_0x54be('0x20')](_0x3cc59e[_0x54be('0x37')][_0x54be('0x20')]);}_0x28e6e5[_0x54be('0x3d')]=qs[_0x54be('0x3e')](_0x3cc59e[_0x54be('0x37')][_0x54be('0x3e')]);_0x28e6e5[_0x54be('0x3f')]=qs[_0x54be('0x34')](_[_0x54be('0x40')](_0x3cc59e['query'],_0xb8c1c9[_0x54be('0x34')]),_0x42e1e0);if(_0x3cc59e[_0x54be('0x37')][_0x54be('0x41')]){_0x28e6e5[_0x54be('0x3f')]=_[_0x54be('0x42')](_0x28e6e5[_0x54be('0x3f')],{'$or':_[_0x54be('0x2f')](_0x42e1e0,function(_0x564993){if(_0x564993[_0x54be('0x43')]!==_0x54be('0x44')){var _0x4b13c1={};_0x4b13c1[_0x564993[_0x54be('0x2c')]]={'$like':'%'+_0x3cc59e[_0x54be('0x37')][_0x54be('0x41')]+'%'};return _0x4b13c1;}})});}_0x28e6e5=_[_0x54be('0x42')]({},_0x28e6e5,_0x3cc59e['options']);var _0x3ae9b9={'where':_0x28e6e5[_0x54be('0x3f')]};return db[_0x54be('0x30')]['count'](_0x3ae9b9)[_0x54be('0x29')](function(_0x3a8586){_0x4ed136[_0x54be('0x23')]=_0x3a8586;if(_0x3cc59e[_0x54be('0x37')][_0x54be('0x45')]){_0x28e6e5[_0x54be('0x46')]=[{'all':!![]}];}return db[_0x54be('0x30')][_0x54be('0x47')](_0x28e6e5);})['then'](function(_0x1fc524){_0x4ed136[_0x54be('0x48')]=_0x1fc524;return _0x4ed136;})[_0x54be('0x29')](respondWithFilteredResult(_0x4056d3,_0x28e6e5))[_0x54be('0x49')](handleError(_0x4056d3,null));};exports[_0x54be('0x4a')]=function(_0x349397,_0x2b600e){var _0x363ab2={'raw':!![],'where':{'id':_0x349397[_0x54be('0x4b')]['id']}},_0x3d2f02={};_0x3d2f02[_0x54be('0x36')]=_[_0x54be('0x33')](db[_0x54be('0x30')]['rawAttributes']);_0x3d2f02[_0x54be('0x37')]=_['keys'](_0x349397[_0x54be('0x37')]);_0x3d2f02['filters']=_['intersection'](_0x3d2f02[_0x54be('0x36')],_0x3d2f02[_0x54be('0x37')]);_0x363ab2[_0x54be('0x38')]=_['intersection'](_0x3d2f02['model'],qs[_0x54be('0x39')](_0x349397[_0x54be('0x37')]['fields']));_0x363ab2[_0x54be('0x38')]=_0x363ab2[_0x54be('0x38')][_0x54be('0x3a')]?_0x363ab2[_0x54be('0x38')]:_0x3d2f02['model'];if(_0x349397[_0x54be('0x37')][_0x54be('0x45')]){_0x363ab2['include']=[{'all':!![]}];}_0x363ab2=_[_0x54be('0x42')]({},_0x363ab2,_0x349397[_0x54be('0x4c')]);return db[_0x54be('0x30')][_0x54be('0x4d')](_0x363ab2)[_0x54be('0x29')](handleEntityNotFound(_0x2b600e,null))['then'](respondWithResult(_0x2b600e,null))[_0x54be('0x49')](handleError(_0x2b600e,null));};exports[_0x54be('0x4e')]=function(_0x4b3ded,_0x381a84){return db[_0x54be('0x30')][_0x54be('0x4e')](_0x4b3ded[_0x54be('0x4f')],{})[_0x54be('0x29')](respondWithResult(_0x381a84,0xc9))[_0x54be('0x49')](handleError(_0x381a84,null));};exports[_0x54be('0x28')]=function(_0x5efa07,_0x42f012){if(_0x5efa07[_0x54be('0x4f')]['id']){delete _0x5efa07[_0x54be('0x4f')]['id'];}return db[_0x54be('0x30')][_0x54be('0x4d')]({'where':{'id':_0x5efa07['params']['id']}})[_0x54be('0x29')](handleEntityNotFound(_0x42f012,null))[_0x54be('0x29')](saveUpdates(_0x5efa07[_0x54be('0x4f')],null))['then'](respondWithResult(_0x42f012,null))[_0x54be('0x49')](handleError(_0x42f012,null));};exports[_0x54be('0x2a')]=function(_0x891792,_0x37be6d){return db[_0x54be('0x30')][_0x54be('0x4d')]({'where':{'id':_0x891792[_0x54be('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37be6d,null))['then'](removeEntity(_0x37be6d,null))[_0x54be('0x49')](handleError(_0x37be6d,null));};exports[_0x54be('0x50')]=function(_0x2171d2,_0x473801){return db[_0x54be('0x30')]['describe']()[_0x54be('0x29')](respondWithResult(_0x473801,null))[_0x54be('0x49')](handleError(_0x473801,null));}; \ No newline at end of file +var _0xfdc0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','SmsTransferReport','include','findAll','catch','show','params','length','includeAll','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2ba573,_0x25c00b){var _0x588b98=function(_0x585994){while(--_0x585994){_0x2ba573['push'](_0x2ba573['shift']());}};_0x588b98(++_0x25c00b);}(_0xfdc0,0x1af));var _0x0fdc=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xfdc0[_0x2d9c6a];return _0xf3c918;};'use strict';var emlformat=require(_0x0fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fdc('0x2'));var moment=require(_0x0fdc('0x3'));var BPromise=require(_0x0fdc('0x4'));var Mustache=require(_0x0fdc('0x5'));var util=require(_0x0fdc('0x6'));var path=require(_0x0fdc('0x7'));var sox=require(_0x0fdc('0x8'));var csv=require('to-csv');var ejs=require(_0x0fdc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fdc('0xa'));var squel=require('squel');var crypto=require(_0x0fdc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fdc('0xc'));var toCsv=require(_0x0fdc('0xd'));var querystring=require('querystring');var Papa=require(_0x0fdc('0xe'));var Redis=require(_0x0fdc('0xf'));var authService=require(_0x0fdc('0x10'));var qs=require(_0x0fdc('0x11'));var as=require(_0x0fdc('0x12'));var hardwareService=require(_0x0fdc('0x13'));var logger=require('../../config/logger')(_0x0fdc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0fdc('0x15'));var db=require(_0x0fdc('0x16'))['db'];function respondWithStatusCode(_0x20b0e1,_0x5e2189){_0x5e2189=_0x5e2189||0xcc;return function(_0x443081){if(_0x443081){return _0x20b0e1[_0x0fdc('0x17')](_0x5e2189);}return _0x20b0e1['status'](_0x5e2189)['end']();};}function respondWithResult(_0x243253,_0xb24ff6){_0xb24ff6=_0xb24ff6||0xc8;return function(_0x25b039){if(_0x25b039){return _0x243253[_0x0fdc('0x18')](_0xb24ff6)[_0x0fdc('0x19')](_0x25b039);}};}function respondWithFilteredResult(_0x1afa8e,_0x11d051){return function(_0x178a76){if(_0x178a76){var _0x4d0db0=typeof _0x11d051[_0x0fdc('0x1a')]==='undefined'&&typeof _0x11d051[_0x0fdc('0x1b')]===_0x0fdc('0x1c');var _0x408f5d=_0x178a76[_0x0fdc('0x1d')];var _0x3285e7=_0x4d0db0?0x0:_0x11d051[_0x0fdc('0x1a')];var _0x9e9308=_0x4d0db0?_0x178a76[_0x0fdc('0x1d')]:_0x11d051[_0x0fdc('0x1a')]+_0x11d051[_0x0fdc('0x1b')];var _0x1faca9;if(_0x9e9308>=_0x408f5d){_0x9e9308=_0x408f5d;_0x1faca9=0xc8;}else{_0x1faca9=0xce;}_0x1afa8e[_0x0fdc('0x18')](_0x1faca9);return _0x1afa8e[_0x0fdc('0x1e')](_0x0fdc('0x1f'),_0x3285e7+'-'+_0x9e9308+'/'+_0x408f5d)['json'](_0x178a76);}return null;};}function patchUpdates(_0x32a317){return function(_0x26674b){try{jsonpatch[_0x0fdc('0x20')](_0x26674b,_0x32a317,!![]);}catch(_0x321004){return BPromise[_0x0fdc('0x21')](_0x321004);}return _0x26674b[_0x0fdc('0x22')]();};}function saveUpdates(_0x5b037c,_0x2d205e){return function(_0x10f616){if(_0x10f616){return _0x10f616['update'](_0x5b037c)['then'](function(_0x4313d3){return _0x4313d3;});}return null;};}function removeEntity(_0x52e4f7,_0x5706d9){return function(_0x1723a9){if(_0x1723a9){return _0x1723a9['destroy']()[_0x0fdc('0x23')](function(){_0x52e4f7[_0x0fdc('0x18')](0xcc)[_0x0fdc('0x24')]();});}};}function handleEntityNotFound(_0x1ef474,_0x13db7b){return function(_0x4d9421){if(!_0x4d9421){_0x1ef474[_0x0fdc('0x17')](0x194);}return _0x4d9421;};}function handleError(_0x424792,_0x622306){_0x622306=_0x622306||0x1f4;return function(_0x549b6c){logger[_0x0fdc('0x25')](_0x549b6c[_0x0fdc('0x26')]);if(_0x549b6c['name']){delete _0x549b6c[_0x0fdc('0x27')];}_0x424792[_0x0fdc('0x18')](_0x622306)[_0x0fdc('0x28')](_0x549b6c);};}exports[_0x0fdc('0x29')]=function(_0x133afd,_0x430815){var _0x5938e4={},_0x404b93={},_0x497c1b={'count':0x0,'rows':[]};var _0xb7c816=_['map'](db['SmsTransferReport'][_0x0fdc('0x2a')],function(_0x53aeee){return{'name':_0x53aeee[_0x0fdc('0x2b')],'type':_0x53aeee['type'][_0x0fdc('0x2c')]};});_0x404b93[_0x0fdc('0x2d')]=_[_0x0fdc('0x2e')](_0xb7c816,_0x0fdc('0x27'));_0x404b93[_0x0fdc('0x2f')]=_['keys'](_0x133afd[_0x0fdc('0x2f')]);_0x404b93[_0x0fdc('0x30')]=_[_0x0fdc('0x31')](_0x404b93['model'],_0x404b93['query']);_0x5938e4[_0x0fdc('0x32')]=_[_0x0fdc('0x31')](_0x404b93[_0x0fdc('0x2d')],qs[_0x0fdc('0x33')](_0x133afd[_0x0fdc('0x2f')]['fields']));_0x5938e4[_0x0fdc('0x32')]=_0x5938e4['attributes']['length']?_0x5938e4[_0x0fdc('0x32')]:_0x404b93[_0x0fdc('0x2d')];if(!_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x34')](_0x0fdc('0x35'))){_0x5938e4['limit']=qs[_0x0fdc('0x1b')](_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x1b')]);_0x5938e4['offset']=qs['offset'](_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x1a')]);}_0x5938e4[_0x0fdc('0x36')]=qs[_0x0fdc('0x37')](_0x133afd['query'][_0x0fdc('0x37')]);_0x5938e4[_0x0fdc('0x38')]=qs['filters'](_['pick'](_0x133afd[_0x0fdc('0x2f')],_0x404b93[_0x0fdc('0x30')]),_0xb7c816);if(_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x39')]){_0x5938e4[_0x0fdc('0x38')]=_['merge'](_0x5938e4[_0x0fdc('0x38')],{'$or':_['map'](_0xb7c816,function(_0x2bd5d4){if(_0x2bd5d4[_0x0fdc('0x3a')]!==_0x0fdc('0x3b')){var _0x4c1f5e={};_0x4c1f5e[_0x2bd5d4[_0x0fdc('0x27')]]={'$like':'%'+_0x133afd[_0x0fdc('0x2f')][_0x0fdc('0x39')]+'%'};return _0x4c1f5e;}})});}_0x5938e4=_[_0x0fdc('0x3c')]({},_0x5938e4,_0x133afd[_0x0fdc('0x3d')]);var _0x35adae={'where':_0x5938e4['where']};return db[_0x0fdc('0x3e')][_0x0fdc('0x1d')](_0x35adae)['then'](function(_0x5c9dd7){_0x497c1b[_0x0fdc('0x1d')]=_0x5c9dd7;if(_0x133afd['query']['includeAll']){_0x5938e4[_0x0fdc('0x3f')]=[{'all':!![]}];}return db[_0x0fdc('0x3e')][_0x0fdc('0x40')](_0x5938e4);})[_0x0fdc('0x23')](function(_0x282378){_0x497c1b['rows']=_0x282378;return _0x497c1b;})[_0x0fdc('0x23')](respondWithFilteredResult(_0x430815,_0x5938e4))[_0x0fdc('0x41')](handleError(_0x430815,null));};exports[_0x0fdc('0x42')]=function(_0x23256a,_0x4a8b57){var _0x25eff0={'raw':!![],'where':{'id':_0x23256a[_0x0fdc('0x43')]['id']}},_0x2028db={};_0x2028db[_0x0fdc('0x2d')]=_['keys'](db['SmsTransferReport'][_0x0fdc('0x2a')]);_0x2028db[_0x0fdc('0x2f')]=_['keys'](_0x23256a[_0x0fdc('0x2f')]);_0x2028db[_0x0fdc('0x30')]=_[_0x0fdc('0x31')](_0x2028db['model'],_0x2028db[_0x0fdc('0x2f')]);_0x25eff0[_0x0fdc('0x32')]=_[_0x0fdc('0x31')](_0x2028db['model'],qs[_0x0fdc('0x33')](_0x23256a[_0x0fdc('0x2f')]['fields']));_0x25eff0[_0x0fdc('0x32')]=_0x25eff0[_0x0fdc('0x32')][_0x0fdc('0x44')]?_0x25eff0[_0x0fdc('0x32')]:_0x2028db[_0x0fdc('0x2d')];if(_0x23256a[_0x0fdc('0x2f')][_0x0fdc('0x45')]){_0x25eff0[_0x0fdc('0x3f')]=[{'all':!![]}];}_0x25eff0=_[_0x0fdc('0x3c')]({},_0x25eff0,_0x23256a[_0x0fdc('0x3d')]);return db[_0x0fdc('0x3e')][_0x0fdc('0x46')](_0x25eff0)[_0x0fdc('0x23')](handleEntityNotFound(_0x4a8b57,null))[_0x0fdc('0x23')](respondWithResult(_0x4a8b57,null))[_0x0fdc('0x41')](handleError(_0x4a8b57,null));};exports[_0x0fdc('0x47')]=function(_0x25777b,_0x5a9293){return db['SmsTransferReport']['create'](_0x25777b[_0x0fdc('0x48')],{})[_0x0fdc('0x23')](respondWithResult(_0x5a9293,0xc9))['catch'](handleError(_0x5a9293,null));};exports[_0x0fdc('0x49')]=function(_0x1b73d4,_0x2c3660){if(_0x1b73d4[_0x0fdc('0x48')]['id']){delete _0x1b73d4[_0x0fdc('0x48')]['id'];}return db[_0x0fdc('0x3e')]['find']({'where':{'id':_0x1b73d4[_0x0fdc('0x43')]['id']}})[_0x0fdc('0x23')](handleEntityNotFound(_0x2c3660,null))['then'](saveUpdates(_0x1b73d4[_0x0fdc('0x48')],null))[_0x0fdc('0x23')](respondWithResult(_0x2c3660,null))[_0x0fdc('0x41')](handleError(_0x2c3660,null));};exports[_0x0fdc('0x4a')]=function(_0x1cfc9a,_0x8e3c8d){return db['SmsTransferReport']['find']({'where':{'id':_0x1cfc9a[_0x0fdc('0x43')]['id']}})[_0x0fdc('0x23')](handleEntityNotFound(_0x8e3c8d,null))[_0x0fdc('0x23')](removeEntity(_0x8e3c8d,null))[_0x0fdc('0x41')](handleError(_0x8e3c8d,null));};exports[_0x0fdc('0x4b')]=function(_0x64ef4a,_0x29ebad){return db['SmsTransferReport'][_0x0fdc('0x4b')]()[_0x0fdc('0x23')](respondWithResult(_0x29ebad,null))['catch'](handleError(_0x29ebad,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 81ec0f1..fc936b2 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 _0x28eb=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x28eb,0x105));var _0xb28e=function(_0x173d17,_0x15034b){_0x173d17=_0x173d17-0x0;var _0xb9d6e9=_0x28eb[_0x173d17];return _0xb9d6e9;};'use strict';var _=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var logger=require(_0xb28e('0x2'))('api');var moment=require(_0xb28e('0x3'));var BPromise=require(_0xb28e('0x4'));var rp=require(_0xb28e('0x5'));var fs=require('fs');var path=require(_0xb28e('0x6'));var rimraf=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var attributes=require(_0xb28e('0x9'));module['exports']=function(_0x42b823,_0x4638f9){return _0x42b823[_0xb28e('0xa')](_0xb28e('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb28e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd69c=['api','moment','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x579ad3,_0x5d763c){var _0x289a74=function(_0x16a359){while(--_0x16a359){_0x579ad3['push'](_0x579ad3['shift']());}};_0x289a74(++_0x5d763c);}(_0xd69c,0x15c));var _0xcd69=function(_0x3f2c72,_0x339845){_0x3f2c72=_0x3f2c72-0x0;var _0x4564ab=_0xd69c[_0x3f2c72];return _0x4564ab;};'use strict';var _=require(_0xcd69('0x0'));var util=require(_0xcd69('0x1'));var logger=require(_0xcd69('0x2'))(_0xcd69('0x3'));var moment=require(_0xcd69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd69('0x5'));var rimraf=require(_0xcd69('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd69('0x7'));module[_0xcd69('0x8')]=function(_0x48257f,_0x5d99a5){return _0x48257f[_0xcd69('0x9')](_0xcd69('0xa'),attributes,{'tableName':_0xcd69('0xb'),'paranoid':![],'indexes':[{'name':_0xcd69('0xc'),'fields':[_0xcd69('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 4f42bfb..0283c6c 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 _0xa63f=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x35baf1,_0x1b64ac){var _0x5df43f=function(_0x216d41){while(--_0x216d41){_0x35baf1['push'](_0x35baf1['shift']());}};_0x5df43f(++_0x1b64ac);}(_0xa63f,0x1b6));var _0xfa63=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xa63f[_0x515283];return _0x38f836;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rs=require(_0xfa63('0x4'));var fs=require('fs');var Redis=require(_0xfa63('0x5'));var db=require(_0xfa63('0x6'))['db'];var utils=require(_0xfa63('0x7'));var logger=require(_0xfa63('0x8'))(_0xfa63('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa63('0xa')][_0xfa63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb35bc5,_0x2dcf48,_0x486050){return new BPromise(function(_0x505e1a,_0x575b64){return client[_0xfa63('0xc')](_0xb35bc5,_0x486050)[_0xfa63('0xd')](function(_0x1bf230){logger['info'](_0xfa63('0xe'),_0x2dcf48,'request\x20sent');logger[_0xfa63('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2dcf48,_0xfa63('0x10'),JSON[_0xfa63('0x11')](_0x1bf230));if(_0x1bf230[_0xfa63('0x12')]){if(_0x1bf230[_0xfa63('0x12')][_0xfa63('0x13')]===0x1f4){logger[_0xfa63('0x12')](_0xfa63('0xe'),_0x2dcf48,_0x1bf230[_0xfa63('0x12')]['message']);return _0x575b64(_0x1bf230['error'][_0xfa63('0x14')]);}logger[_0xfa63('0x12')](_0xfa63('0xe'),_0x2dcf48,_0x1bf230['error'][_0xfa63('0x14')]);return _0x505e1a(_0x1bf230['error'][_0xfa63('0x14')]);}else{logger[_0xfa63('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x2dcf48,_0xfa63('0x10'));_0x505e1a(_0x1bf230[_0xfa63('0x16')][_0xfa63('0x14')]);}})[_0xfa63('0x17')](function(_0x7d2ef5){logger[_0xfa63('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x2dcf48,_0x7d2ef5);_0x575b64(_0x7d2ef5);});});} \ No newline at end of file +var _0x34e7=['SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5a85c3,_0x1c5402){var _0x43fa29=function(_0x1b10fc){while(--_0x1b10fc){_0x5a85c3['push'](_0x5a85c3['shift']());}};_0x43fa29(++_0x1c5402);}(_0x34e7,0x164));var _0x734e=function(_0x3f3ad8,_0x4bc014){_0x3f3ad8=_0x3f3ad8-0x0;var _0x3a2667=_0x34e7[_0x3f3ad8];return _0x3a2667;};'use strict';var _=require(_0x734e('0x0'));var util=require(_0x734e('0x1'));var moment=require(_0x734e('0x2'));var BPromise=require(_0x734e('0x3'));var rs=require(_0x734e('0x4'));var fs=require('fs');var Redis=require(_0x734e('0x5'));var db=require(_0x734e('0x6'))['db'];var utils=require(_0x734e('0x7'));var logger=require(_0x734e('0x8'))(_0x734e('0x9'));var config=require(_0x734e('0xa'));var jayson=require(_0x734e('0xb'));var client=jayson[_0x734e('0xc')][_0x734e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f49aa,_0x2cf8f9,_0x1b11da){return new BPromise(function(_0x444194,_0x4df479){return client[_0x734e('0xe')](_0x4f49aa,_0x1b11da)['then'](function(_0x1ce121){logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,_0x734e('0x11'));logger[_0x734e('0x12')](_0x734e('0x13'),_0x2cf8f9,'request\x20sent',JSON['stringify'](_0x1ce121));if(_0x1ce121[_0x734e('0x14')]){if(_0x1ce121[_0x734e('0x14')][_0x734e('0x15')]===0x1f4){logger[_0x734e('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x4df479(_0x1ce121['error'][_0x734e('0x16')]);}logger[_0x734e('0x14')](_0x734e('0x10'),_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x444194(_0x1ce121['error'][_0x734e('0x16')]);}else{logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,'request\x20sent');_0x444194(_0x1ce121[_0x734e('0x17')]['message']);}})[_0x734e('0x18')](function(_0x3aa65b){logger['error'](_0x734e('0x10'),_0x2cf8f9,_0x3aa65b);_0x4df479(_0x3aa65b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8c5335a..9808e6b 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 _0x03b6=['download','diskStorage','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','post','single','file','create','put','delete','/:id','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x03b6,0xc7));var _0x603b=function(_0x3b2813,_0xf0031f){_0x3b2813=_0x3b2813-0x0;var _0x2d1159=_0x03b6[_0x3b2813];return _0x2d1159;};'use strict';var multer=require('multer');var util=require(_0x603b('0x0'));var path=require(_0x603b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x603b('0x2'));var auth=require(_0x603b('0x3'));var interaction=require(_0x603b('0x4'));var config=require(_0x603b('0x5'));var controller=require(_0x603b('0x6'));router[_0x603b('0x7')]('/',auth[_0x603b('0x8')](),controller[_0x603b('0x9')]);router[_0x603b('0x7')]('/:id',auth[_0x603b('0x8')](),controller['show']);router['get'](_0x603b('0xa'),auth['isAuthenticated'](),controller[_0x603b('0xb')]);var upload=multer({'storage':multer[_0x603b('0xc')]({'destination':function(_0x30a903,_0x10ce32,_0x1e32dd){_0x1e32dd(null,path[_0x603b('0xd')](config[_0x603b('0xe')],_0x603b('0xf')));},'filename':function(_0x13371,_0x456cb6,_0x4db3ab){_0x456cb6['originalname']=_0x456cb6['originalname'][_0x603b('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4db3ab(null,util[_0x603b('0x11')](_0x603b('0x12'),path[_0x603b('0x13')](_0x456cb6[_0x603b('0x14')],path[_0x603b('0x15')](_0x456cb6[_0x603b('0x14')])),Date['now'](),path[_0x603b('0x15')](_0x456cb6[_0x603b('0x14')])));}})});router[_0x603b('0x16')]('/',upload[_0x603b('0x17')](_0x603b('0x18')),controller[_0x603b('0x19')]);router[_0x603b('0x1a')]('/:id',auth[_0x603b('0x8')](),controller['update']);router[_0x603b('0x1b')](_0x603b('0x1c'),auth['isAuthenticated'](),controller[_0x603b('0x1b')]);module[_0x603b('0x1d')]=router; \ No newline at end of file +var _0xde26=['extname','originalname','now','file','create','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','server/files/sounds/original/','format','%s-%s%s'];(function(_0xe99335,_0x1428aa){var _0x590ad=function(_0x307d26){while(--_0x307d26){_0xe99335['push'](_0xe99335['shift']());}};_0x590ad(++_0x1428aa);}(_0xde26,0xd8));var _0x6de2=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0xde26[_0x36103d];return _0x4edadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6de2('0x0'));var timeout=require(_0x6de2('0x1'));var express=require(_0x6de2('0x2'));var router=express['Router']();var fs_extra=require(_0x6de2('0x3'));var auth=require(_0x6de2('0x4'));var interaction=require(_0x6de2('0x5'));var config=require(_0x6de2('0x6'));var controller=require('./sound.controller');router[_0x6de2('0x7')]('/',auth[_0x6de2('0x8')](),controller[_0x6de2('0x9')]);router[_0x6de2('0x7')](_0x6de2('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6de2('0xb'),auth[_0x6de2('0x8')](),controller[_0x6de2('0xc')]);var upload=multer({'storage':multer[_0x6de2('0xd')]({'destination':function(_0x323dce,_0x444d2b,_0x40440c){_0x40440c(null,path[_0x6de2('0xe')](config['root'],_0x6de2('0xf')));},'filename':function(_0x5322f8,_0x51c8a7,_0x20355c){_0x51c8a7['originalname']=_0x51c8a7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20355c(null,util[_0x6de2('0x10')](_0x6de2('0x11'),path['basename'](_0x51c8a7['originalname'],path[_0x6de2('0x12')](_0x51c8a7[_0x6de2('0x13')])),Date[_0x6de2('0x14')](),path[_0x6de2('0x12')](_0x51c8a7['originalname'])));}})});router['post']('/',upload['single'](_0x6de2('0x15')),controller[_0x6de2('0x16')]);router['put'](_0x6de2('0xa'),auth[_0x6de2('0x8')](),controller[_0x6de2('0x17')]);router[_0x6de2('0x18')](_0x6de2('0xa'),auth['isAuthenticated'](),controller[_0x6de2('0x18')]);module[_0x6de2('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 301fa6c..401b3c7 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 _0xb70f=['FLOAT','INTEGER','BIGINT','sequelize','STRING','name'];(function(_0x44f3d5,_0x2910f0){var _0x3f750f=function(_0x58b526){while(--_0x58b526){_0x44f3d5['push'](_0x44f3d5['shift']());}};_0x3f750f(++_0x2910f0);}(_0xb70f,0x81));var _0xfb70=function(_0x836a48,_0x35d7dc){_0x836a48=_0x836a48-0x0;var _0x4eec44=_0xb70f[_0x836a48];return _0x4eec44;};'use strict';var Sequelize=require(_0xfb70('0x0'));module['exports']={'name':{'type':Sequelize[_0xfb70('0x1')],'unique':_0xfb70('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xfb70('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xfb70('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xfb70('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfb70('0x4')]},'original_bitRate':{'type':Sequelize[_0xfb70('0x5')]},'original_sampleRate':{'type':Sequelize[_0xfb70('0x4')]},'converted_format':{'type':Sequelize[_0xfb70('0x1')]},'converted_duration':{'type':Sequelize[_0xfb70('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xfb70('0x5')]},'converted_channelCount':{'type':Sequelize[_0xfb70('0x4')]},'converted_bitRate':{'type':Sequelize[_0xfb70('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xfb70('0x4')]}}; \ No newline at end of file +var _0x211f=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x3f9f39,_0x39d8c2){var _0x3de0b8=function(_0x4e9efe){while(--_0x4e9efe){_0x3f9f39['push'](_0x3f9f39['shift']());}};_0x3de0b8(++_0x39d8c2);}(_0x211f,0x1d7));var _0xf211=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x211f[_0x3e85a4];return _0x21e7d1;};'use strict';var Sequelize=require(_0xf211('0x0'));module[_0xf211('0x1')]={'name':{'type':Sequelize[_0xf211('0x2')],'unique':_0xf211('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf211('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf211('0x2')]},'original_format':{'type':Sequelize[_0xf211('0x2')]},'original_duration':{'type':Sequelize[_0xf211('0x4')]},'original_sampleCount':{'type':Sequelize[_0xf211('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf211('0x5')]},'original_sampleRate':{'type':Sequelize[_0xf211('0x6')]},'converted_format':{'type':Sequelize[_0xf211('0x2')]},'converted_duration':{'type':Sequelize[_0xf211('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf211('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf211('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf211('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b28fd27..eb6f5c6 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 _0xc8ad=['role','UserProfileSection','Sounds','autoAssociation','start','description','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','Sound','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','rows','catch','params','keys','length','options','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','root','%s.%s','format','create','originalname','extname','basename','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc8ad,0xf4));var _0xdc8a=function(_0x11fb12,_0x4fe600){_0x11fb12=_0x11fb12-0x0;var _0x17e68c=_0xc8ad[_0x11fb12];return _0x17e68c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc8a('0x0'));var zipdir=require(_0xdc8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc8a('0x2'));var BPromise=require(_0xdc8a('0x3'));var Mustache=require(_0xdc8a('0x4'));var util=require(_0xdc8a('0x5'));var path=require('path');var sox=require(_0xdc8a('0x6'));var csv=require(_0xdc8a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc8a('0x8'));var _=require(_0xdc8a('0x9'));var squel=require(_0xdc8a('0xa'));var crypto=require(_0xdc8a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdc8a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc8a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc8a('0xe'));var logger=require(_0xdc8a('0xf'))(_0xdc8a('0x10'));var utils=require(_0xdc8a('0x11'));var config=require(_0xdc8a('0x12'));var licenseUtil=require(_0xdc8a('0x13'));var db=require(_0xdc8a('0x14'))['db'];function respondWithStatusCode(_0x3a569c,_0x3ff6c8){_0x3ff6c8=_0x3ff6c8||0xcc;return function(_0x3101e6){if(_0x3101e6){return _0x3a569c[_0xdc8a('0x15')](_0x3ff6c8);}return _0x3a569c['status'](_0x3ff6c8)['end']();};}function respondWithResult(_0x28fbb7,_0x4e9eca){_0x4e9eca=_0x4e9eca||0xc8;return function(_0x38a018){if(_0x38a018){return _0x28fbb7['status'](_0x4e9eca)[_0xdc8a('0x16')](_0x38a018);}};}function respondWithFilteredResult(_0xfaef31,_0x185ee9){return function(_0xb3ec50){if(_0xb3ec50){var _0x215bc5=typeof _0x185ee9[_0xdc8a('0x17')]===_0xdc8a('0x18')&&typeof _0x185ee9[_0xdc8a('0x19')]===_0xdc8a('0x18');var _0x21e8a1=_0xb3ec50['count'];var _0x28913b=_0x215bc5?0x0:_0x185ee9[_0xdc8a('0x17')];var _0xb82588=_0x215bc5?_0xb3ec50[_0xdc8a('0x1a')]:_0x185ee9[_0xdc8a('0x17')]+_0x185ee9['limit'];var _0x2679b4;if(_0xb82588>=_0x21e8a1){_0xb82588=_0x21e8a1;_0x2679b4=0xc8;}else{_0x2679b4=0xce;}_0xfaef31[_0xdc8a('0x1b')](_0x2679b4);return _0xfaef31[_0xdc8a('0x1c')](_0xdc8a('0x1d'),_0x28913b+'-'+_0xb82588+'/'+_0x21e8a1)[_0xdc8a('0x16')](_0xb3ec50);}return null;};}function patchUpdates(_0xecfb1d){return function(_0xff0dbc){try{jsonpatch[_0xdc8a('0x1e')](_0xff0dbc,_0xecfb1d,!![]);}catch(_0xd7fdf4){return BPromise[_0xdc8a('0x1f')](_0xd7fdf4);}return _0xff0dbc[_0xdc8a('0x20')]();};}function saveUpdates(_0x4864e7,_0x4458be){return function(_0x3217db){if(_0x3217db){return _0x3217db[_0xdc8a('0x21')](_0x4864e7)[_0xdc8a('0x22')](function(_0x22e3d0){return _0x22e3d0;});}return null;};}function removeEntity(_0x4577fd,_0x8730e1){return function(_0x1a70e9){if(_0x1a70e9){return _0x1a70e9[_0xdc8a('0x23')]()['then'](function(){var _0x59891a=_0x1a70e9[_0xdc8a('0x24')]({'plain':!![]});var _0x91316d='Sounds';return db[_0xdc8a('0x25')]['destroy']({'where':{'type':_0x91316d,'resourceId':_0x59891a['id']}})[_0xdc8a('0x22')](function(){return _0x1a70e9;});})[_0xdc8a('0x22')](function(){_0x4577fd[_0xdc8a('0x1b')](0xcc)[_0xdc8a('0x26')]();});}};}function handleEntityNotFound(_0x46944e,_0x33910d){return function(_0x1c285e){if(!_0x1c285e){_0x46944e[_0xdc8a('0x15')](0x194);}return _0x1c285e;};}function handleError(_0x295af0,_0x2e92e2){_0x2e92e2=_0x2e92e2||0x1f4;return function(_0x9eaad2){logger[_0xdc8a('0x27')](_0x9eaad2[_0xdc8a('0x28')]);if(_0x9eaad2['name']){delete _0x9eaad2[_0xdc8a('0x29')];}_0x295af0[_0xdc8a('0x1b')](_0x2e92e2)[_0xdc8a('0x2a')](_0x9eaad2);};}exports[_0xdc8a('0x2b')]=function(_0x5eeb97,_0x5d1be7){var _0x4c8191={},_0x5b6f29={},_0x4f0fab={'count':0x0,'rows':[]};var _0x583047=_['map'](db[_0xdc8a('0x2c')]['rawAttributes'],function(_0x2c4f07){return{'name':_0x2c4f07[_0xdc8a('0x2d')],'type':_0x2c4f07[_0xdc8a('0x2e')][_0xdc8a('0x2f')]};});_0x5b6f29['model']=_[_0xdc8a('0x30')](_0x583047,_0xdc8a('0x29'));_0x5b6f29[_0xdc8a('0x31')]=_['keys'](_0x5eeb97[_0xdc8a('0x31')]);_0x5b6f29[_0xdc8a('0x32')]=_[_0xdc8a('0x33')](_0x5b6f29[_0xdc8a('0x34')],_0x5b6f29['query']);_0x4c8191[_0xdc8a('0x35')]=_[_0xdc8a('0x33')](_0x5b6f29[_0xdc8a('0x34')],qs[_0xdc8a('0x36')](_0x5eeb97[_0xdc8a('0x31')][_0xdc8a('0x36')]));_0x4c8191[_0xdc8a('0x35')]=_0x4c8191[_0xdc8a('0x35')]['length']?_0x4c8191['attributes']:_0x5b6f29[_0xdc8a('0x34')];if(!_0x5eeb97[_0xdc8a('0x31')][_0xdc8a('0x37')](_0xdc8a('0x38'))){_0x4c8191[_0xdc8a('0x19')]=qs[_0xdc8a('0x19')](_0x5eeb97[_0xdc8a('0x31')][_0xdc8a('0x19')]);_0x4c8191[_0xdc8a('0x17')]=qs[_0xdc8a('0x17')](_0x5eeb97[_0xdc8a('0x31')][_0xdc8a('0x17')]);}_0x4c8191['order']=qs[_0xdc8a('0x39')](_0x5eeb97[_0xdc8a('0x31')]['sort']);_0x4c8191[_0xdc8a('0x3a')]=qs['filters'](_['pick'](_0x5eeb97[_0xdc8a('0x31')],_0x5b6f29[_0xdc8a('0x32')]),_0x583047);if(_0x5eeb97['query'][_0xdc8a('0x3b')]){_0x4c8191['where']=_[_0xdc8a('0x3c')](_0x4c8191[_0xdc8a('0x3a')],{'$or':_[_0xdc8a('0x30')](_0x583047,function(_0xef4454){if(_0xef4454[_0xdc8a('0x2e')]!=='VIRTUAL'){var _0x191ab9={};_0x191ab9[_0xef4454[_0xdc8a('0x29')]]={'$like':'%'+_0x5eeb97[_0xdc8a('0x31')]['filter']+'%'};return _0x191ab9;}})});}_0x4c8191=_[_0xdc8a('0x3c')]({},_0x4c8191,_0x5eeb97['options']);var _0x46abf1={'where':_0x4c8191[_0xdc8a('0x3a')]};return db[_0xdc8a('0x2c')]['count'](_0x46abf1)[_0xdc8a('0x22')](function(_0x59bbe4){_0x4f0fab[_0xdc8a('0x1a')]=_0x59bbe4;if(_0x5eeb97[_0xdc8a('0x31')][_0xdc8a('0x3d')]){_0x4c8191[_0xdc8a('0x3e')]=[{'all':!![]}];}return db[_0xdc8a('0x2c')]['findAll'](_0x4c8191);})[_0xdc8a('0x22')](function(_0x561ec7){_0x4f0fab[_0xdc8a('0x3f')]=_0x561ec7;return _0x4f0fab;})[_0xdc8a('0x22')](respondWithFilteredResult(_0x5d1be7,_0x4c8191))[_0xdc8a('0x40')](handleError(_0x5d1be7,null));};exports['show']=function(_0x151ba7,_0x1de515){var _0x1e2c92={'raw':!![],'where':{'id':_0x151ba7[_0xdc8a('0x41')]['id']}},_0x44d886={};_0x44d886[_0xdc8a('0x34')]=_[_0xdc8a('0x42')](db['Sound']['rawAttributes']);_0x44d886[_0xdc8a('0x31')]=_[_0xdc8a('0x42')](_0x151ba7[_0xdc8a('0x31')]);_0x44d886[_0xdc8a('0x32')]=_[_0xdc8a('0x33')](_0x44d886[_0xdc8a('0x34')],_0x44d886[_0xdc8a('0x31')]);_0x1e2c92['attributes']=_['intersection'](_0x44d886[_0xdc8a('0x34')],qs['fields'](_0x151ba7[_0xdc8a('0x31')]['fields']));_0x1e2c92[_0xdc8a('0x35')]=_0x1e2c92[_0xdc8a('0x35')][_0xdc8a('0x43')]?_0x1e2c92['attributes']:_0x44d886[_0xdc8a('0x34')];if(_0x151ba7[_0xdc8a('0x31')][_0xdc8a('0x3d')]){_0x1e2c92[_0xdc8a('0x3e')]=[{'all':!![]}];}_0x1e2c92=_[_0xdc8a('0x3c')]({},_0x1e2c92,_0x151ba7[_0xdc8a('0x44')]);return db['Sound'][_0xdc8a('0x45')](_0x1e2c92)[_0xdc8a('0x22')](handleEntityNotFound(_0x1de515,null))[_0xdc8a('0x22')](respondWithResult(_0x1de515,null))['catch'](handleError(_0x1de515,null));};exports[_0xdc8a('0x46')]=function(_0x2a84bc,_0x173fba,_0x2dc1c0){return db['Sound'][_0xdc8a('0x45')]({'where':{'id':_0x2a84bc['params']['id']},'attributes':[_0xdc8a('0x29'),_0xdc8a('0x47'),_0xdc8a('0x48')],'raw':!![]})[_0xdc8a('0x22')](handleEntityNotFound(_0x173fba,null))[_0xdc8a('0x22')](function(_0x5c277a){if(_0x5c277a){if(!fs['existsSync'](path[_0xdc8a('0x49')](config['root'],_0xdc8a('0x4a'),_0x5c277a[_0xdc8a('0x47')]+'.'+_0x5c277a[_0xdc8a('0x48')]))){throw new db[(_0xdc8a('0x4b'))]['ValidationError'](_0xdc8a('0x4c'));}return _0x173fba[_0xdc8a('0x46')](path['join'](config[_0xdc8a('0x4d')],_0xdc8a('0x4a'),util['format'](_0xdc8a('0x4e'),_0x5c277a[_0xdc8a('0x47')],_0x5c277a[_0xdc8a('0x48')])),util[_0xdc8a('0x4f')](_0xdc8a('0x4e'),_0x5c277a[_0xdc8a('0x29')],_0x5c277a[_0xdc8a('0x48')]));}return null;})[_0xdc8a('0x40')](handleError(_0x173fba,null));};exports[_0xdc8a('0x50')]=function(_0x1981ce,_0x516cef,_0x418d48){var _0x28c184={'name':path['basename'](_0x1981ce['file'][_0xdc8a('0x51')],path[_0xdc8a('0x52')](_0x1981ce['file'][_0xdc8a('0x51')])),'save_name':path[_0xdc8a('0x53')](_0x1981ce[_0xdc8a('0x54')][_0xdc8a('0x55')],path[_0xdc8a('0x52')](_0x1981ce[_0xdc8a('0x54')][_0xdc8a('0x55')])),'original_format':path['extname'](_0x1981ce[_0xdc8a('0x54')][_0xdc8a('0x51')])[_0xdc8a('0x56')](0x1),'converted_format':_0xdc8a('0x57')};var _0x3ad7c2=path[_0xdc8a('0x49')](config[_0xdc8a('0x4d')],_0xdc8a('0x58'),_0x1981ce[_0xdc8a('0x54')]['filename']);var _0x2f2f25=path[_0xdc8a('0x49')](config[_0xdc8a('0x4d')],_0xdc8a('0x4a'),util['format'](_0xdc8a('0x4e'),path[_0xdc8a('0x53')](_0x1981ce[_0xdc8a('0x54')]['filename'],path[_0xdc8a('0x52')](_0x1981ce[_0xdc8a('0x54')][_0xdc8a('0x55')])),_0x28c184[_0xdc8a('0x48')]));logger[_0xdc8a('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x3ad7c2);logger[_0xdc8a('0x59')](_0xdc8a('0x5a'),_0x2f2f25);try{fs[_0xdc8a('0x5b')](_0x3ad7c2,parseInt('0777',0x8));var _0x52ee44=sox[_0xdc8a('0x5c')](_0x3ad7c2,_0x2f2f25,{'sampleRate':0x1f40,'format':_0xdc8a('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52ee44['on'](_0xdc8a('0x27'),function(_0x25a87f){fs[_0xdc8a('0x5d')](_0x3ad7c2);_0x516cef['status'](0x1f4)[_0xdc8a('0x2a')](_0x25a87f);});_0x52ee44['on'](_0xdc8a('0x5e'),function(_0x4edc45){_0x28c184[_0xdc8a('0x5f')]=isNaN(_0x4edc45['duration'])?null:_0x4edc45[_0xdc8a('0x60')]*0x3e8;_0x28c184[_0xdc8a('0x61')]=isNaN(_0x4edc45[_0xdc8a('0x62')])?null:_0x4edc45[_0xdc8a('0x62')];_0x28c184['original_channelCount']=isNaN(_0x4edc45[_0xdc8a('0x63')])?null:_0x4edc45[_0xdc8a('0x63')];_0x28c184[_0xdc8a('0x64')]=isNaN(_0x4edc45[_0xdc8a('0x65')])?null:_0x4edc45[_0xdc8a('0x65')];_0x28c184[_0xdc8a('0x66')]=isNaN(_0x4edc45[_0xdc8a('0x67')])?null:_0x4edc45[_0xdc8a('0x67')];});_0x52ee44['on'](_0xdc8a('0x68'),function(_0x76ce15){_0x28c184[_0xdc8a('0x69')]=isNaN(_0x76ce15[_0xdc8a('0x60')])?null:_0x76ce15[_0xdc8a('0x60')]*0x3e8;_0x28c184[_0xdc8a('0x6a')]=isNaN(_0x76ce15[_0xdc8a('0x62')])?null:_0x76ce15[_0xdc8a('0x62')];_0x28c184[_0xdc8a('0x6b')]=isNaN(_0x76ce15[_0xdc8a('0x63')])?null:_0x76ce15[_0xdc8a('0x63')];_0x28c184[_0xdc8a('0x6c')]=isNaN(_0x76ce15['bitRate'])?null:_0x76ce15[_0xdc8a('0x65')];_0x28c184[_0xdc8a('0x6d')]=isNaN(_0x76ce15['sampleRate'])?null:_0x76ce15[_0xdc8a('0x67')];});_0x52ee44['on'](_0xdc8a('0x26'),function(){fs[_0xdc8a('0x5b')](_0x2f2f25,parseInt(_0xdc8a('0x6e'),0x8));return db['Sound'][_0xdc8a('0x50')](_0x28c184)[_0xdc8a('0x22')](function(_0x582ce0){var _0x9e7951={'role':_0x1981ce[_0xdc8a('0x6f')]['role'],'userProfileId':_0x1981ce['body']['userProfileId']};if(!_0x9e7951)throw new Error(_0xdc8a('0x70'));if(_0x9e7951[_0xdc8a('0x71')]==='user'){var _0x33c97b=_0x582ce0['get']({'plain':!![]});return db[_0xdc8a('0x72')][_0xdc8a('0x45')]({'where':{'name':_0xdc8a('0x73'),'userProfileId':_0x9e7951['userProfileId']},'raw':!![]})['then'](function(_0xfbcc0d){if(_0xfbcc0d&&_0xfbcc0d[_0xdc8a('0x74')]===0x0){return db[_0xdc8a('0x25')]['create']({'name':_0x33c97b[_0xdc8a('0x29')],'resourceId':_0x33c97b['id'],'type':_0xfbcc0d['name'],'sectionId':_0xfbcc0d['id']},{})['then'](function(){return _0x582ce0;});}else{return _0x582ce0;}})[_0xdc8a('0x40')](function(_0x3f0e9d){logger[_0xdc8a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f0e9d);throw _0x3f0e9d;});}return _0x582ce0;})[_0xdc8a('0x22')](respondWithResult(_0x516cef,null))[_0xdc8a('0x40')](handleError(_0x516cef,null));});_0x52ee44[_0xdc8a('0x75')]();}catch(_0x5a3cbc){_0x516cef['status'](0x1f4)['send'](_0x5a3cbc);}};exports[_0xdc8a('0x21')]=function(_0x38fb87,_0x72f611,_0x29fc68){return db[_0xdc8a('0x2c')][_0xdc8a('0x45')]({'where':{'id':_0x38fb87[_0xdc8a('0x41')]['id']}})[_0xdc8a('0x22')](handleEntityNotFound(_0x72f611,null))[_0xdc8a('0x22')](saveUpdates(_['pick'](_0x38fb87[_0xdc8a('0x6f')],[_0xdc8a('0x29'),_0xdc8a('0x76')]),null))[_0xdc8a('0x22')](respondWithResult(_0x72f611,null))[_0xdc8a('0x40')](handleError(_0x72f611,null));};exports['delete']=function(_0x5b15d7,_0x57b5f4,_0x1e2ba6){return db[_0xdc8a('0x2c')][_0xdc8a('0x45')]({'where':{'id':_0x5b15d7['params']['id']}})[_0xdc8a('0x22')](function(_0x21f0e4){if(_0x21f0e4){return _0x21f0e4[_0xdc8a('0x23')]();}})['then'](function(_0x5e0b8c){var _0x2249df=path['join'](config[_0xdc8a('0x4d')],'server/files/sounds/original',util['format']('%s.%s',_0x5e0b8c[_0xdc8a('0x47')],_0x5e0b8c['original_format']));var _0x37d28d=path[_0xdc8a('0x49')](config[_0xdc8a('0x4d')],_0xdc8a('0x4a'),util['format'](_0xdc8a('0x4e'),_0x5e0b8c[_0xdc8a('0x47')],_0x5e0b8c[_0xdc8a('0x48')]));fs[_0xdc8a('0x5d')](_0x2249df);fs[_0xdc8a('0x5d')](_0x37d28d);return _0x5e0b8c;})[_0xdc8a('0x22')](function(_0x55f240){if(_0x55f240){return _0x57b5f4['status'](0xcc)[_0xdc8a('0x26')]();}})[_0xdc8a('0x22')](handleEntityNotFound(_0x57b5f4,null))[_0xdc8a('0x40')](handleError(_0x57b5f4,null));}; \ No newline at end of file +var _0xc532=['UserProfileResource','destroy','then','end','error','stack','name','send','index','Sound','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','keys','include','find','download','save_name','converted_format','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','delete','join','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','get','Sounds'];(function(_0x19182c,_0x57f404){var _0x2ae5bc=function(_0x226e90){while(--_0x226e90){_0x19182c['push'](_0x19182c['shift']());}};_0x2ae5bc(++_0x57f404);}(_0xc532,0x1e4));var _0x2c53=function(_0x7809ec,_0x443efd){_0x7809ec=_0x7809ec-0x0;var _0x2619f1=_0xc532[_0x7809ec];return _0x2619f1;};'use strict';var emlformat=require(_0x2c53('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c53('0x1'));var rp=require('request-promise');var moment=require(_0x2c53('0x2'));var BPromise=require(_0x2c53('0x3'));var Mustache=require(_0x2c53('0x4'));var util=require(_0x2c53('0x5'));var path=require(_0x2c53('0x6'));var sox=require(_0x2c53('0x7'));var csv=require(_0x2c53('0x8'));var ejs=require(_0x2c53('0x9'));var fs=require('fs');var fs_extra=require(_0x2c53('0xa'));var _=require(_0x2c53('0xb'));var squel=require(_0x2c53('0xc'));var crypto=require(_0x2c53('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c53('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c53('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c53('0x10'));var authService=require(_0x2c53('0x11'));var qs=require(_0x2c53('0x12'));var as=require(_0x2c53('0x13'));var hardwareService=require(_0x2c53('0x14'));var logger=require(_0x2c53('0x15'))('api');var utils=require(_0x2c53('0x16'));var config=require(_0x2c53('0x17'));var licenseUtil=require(_0x2c53('0x18'));var db=require(_0x2c53('0x19'))['db'];function respondWithStatusCode(_0x102cf6,_0x972226){_0x972226=_0x972226||0xcc;return function(_0x108ecf){if(_0x108ecf){return _0x102cf6[_0x2c53('0x1a')](_0x972226);}return _0x102cf6[_0x2c53('0x1b')](_0x972226)['end']();};}function respondWithResult(_0x3cbd2a,_0x41c937){_0x41c937=_0x41c937||0xc8;return function(_0x4aaa66){if(_0x4aaa66){return _0x3cbd2a[_0x2c53('0x1b')](_0x41c937)[_0x2c53('0x1c')](_0x4aaa66);}};}function respondWithFilteredResult(_0x19f063,_0x2ae7c3){return function(_0x243443){if(_0x243443){var _0x16c06e=typeof _0x2ae7c3['offset']===_0x2c53('0x1d')&&typeof _0x2ae7c3[_0x2c53('0x1e')]==='undefined';var _0x447cc6=_0x243443['count'];var _0x1b8e72=_0x16c06e?0x0:_0x2ae7c3['offset'];var _0x548ca2=_0x16c06e?_0x243443['count']:_0x2ae7c3[_0x2c53('0x1f')]+_0x2ae7c3[_0x2c53('0x1e')];var _0x23c211;if(_0x548ca2>=_0x447cc6){_0x548ca2=_0x447cc6;_0x23c211=0xc8;}else{_0x23c211=0xce;}_0x19f063[_0x2c53('0x1b')](_0x23c211);return _0x19f063[_0x2c53('0x20')](_0x2c53('0x21'),_0x1b8e72+'-'+_0x548ca2+'/'+_0x447cc6)[_0x2c53('0x1c')](_0x243443);}return null;};}function patchUpdates(_0x350651){return function(_0x208698){try{jsonpatch[_0x2c53('0x22')](_0x208698,_0x350651,!![]);}catch(_0x431628){return BPromise[_0x2c53('0x23')](_0x431628);}return _0x208698[_0x2c53('0x24')]();};}function saveUpdates(_0x5a5eab,_0x1d6ae1){return function(_0x51921e){if(_0x51921e){return _0x51921e[_0x2c53('0x25')](_0x5a5eab)['then'](function(_0x1a1cd4){return _0x1a1cd4;});}return null;};}function removeEntity(_0x364e5b,_0x4e2af7){return function(_0x122ca7){if(_0x122ca7){return _0x122ca7['destroy']()['then'](function(){var _0x1b28eb=_0x122ca7[_0x2c53('0x26')]({'plain':!![]});var _0x2a8810=_0x2c53('0x27');return db[_0x2c53('0x28')][_0x2c53('0x29')]({'where':{'type':_0x2a8810,'resourceId':_0x1b28eb['id']}})[_0x2c53('0x2a')](function(){return _0x122ca7;});})[_0x2c53('0x2a')](function(){_0x364e5b[_0x2c53('0x1b')](0xcc)[_0x2c53('0x2b')]();});}};}function handleEntityNotFound(_0x368ece,_0x153e67){return function(_0x5d9359){if(!_0x5d9359){_0x368ece[_0x2c53('0x1a')](0x194);}return _0x5d9359;};}function handleError(_0x3bdfd3,_0x5de817){_0x5de817=_0x5de817||0x1f4;return function(_0x13a16a){logger[_0x2c53('0x2c')](_0x13a16a[_0x2c53('0x2d')]);if(_0x13a16a[_0x2c53('0x2e')]){delete _0x13a16a[_0x2c53('0x2e')];}_0x3bdfd3['status'](_0x5de817)[_0x2c53('0x2f')](_0x13a16a);};}exports[_0x2c53('0x30')]=function(_0x10bebe,_0x1ee9e){var _0x1a444a={},_0x20c9de={},_0x5dff93={'count':0x0,'rows':[]};var _0x466696=_['map'](db[_0x2c53('0x31')][_0x2c53('0x32')],function(_0xfd1a45){return{'name':_0xfd1a45['fieldName'],'type':_0xfd1a45['type'][_0x2c53('0x33')]};});_0x20c9de[_0x2c53('0x34')]=_['map'](_0x466696,'name');_0x20c9de[_0x2c53('0x35')]=_['keys'](_0x10bebe['query']);_0x20c9de[_0x2c53('0x36')]=_[_0x2c53('0x37')](_0x20c9de[_0x2c53('0x34')],_0x20c9de['query']);_0x1a444a[_0x2c53('0x38')]=_[_0x2c53('0x37')](_0x20c9de[_0x2c53('0x34')],qs[_0x2c53('0x39')](_0x10bebe[_0x2c53('0x35')]['fields']));_0x1a444a['attributes']=_0x1a444a[_0x2c53('0x38')][_0x2c53('0x3a')]?_0x1a444a['attributes']:_0x20c9de[_0x2c53('0x34')];if(!_0x10bebe[_0x2c53('0x35')][_0x2c53('0x3b')](_0x2c53('0x3c'))){_0x1a444a[_0x2c53('0x1e')]=qs[_0x2c53('0x1e')](_0x10bebe[_0x2c53('0x35')][_0x2c53('0x1e')]);_0x1a444a[_0x2c53('0x1f')]=qs[_0x2c53('0x1f')](_0x10bebe[_0x2c53('0x35')][_0x2c53('0x1f')]);}_0x1a444a[_0x2c53('0x3d')]=qs['sort'](_0x10bebe[_0x2c53('0x35')]['sort']);_0x1a444a[_0x2c53('0x3e')]=qs[_0x2c53('0x36')](_[_0x2c53('0x3f')](_0x10bebe[_0x2c53('0x35')],_0x20c9de[_0x2c53('0x36')]),_0x466696);if(_0x10bebe[_0x2c53('0x35')][_0x2c53('0x40')]){_0x1a444a[_0x2c53('0x3e')]=_[_0x2c53('0x41')](_0x1a444a[_0x2c53('0x3e')],{'$or':_[_0x2c53('0x42')](_0x466696,function(_0x59e98c){if(_0x59e98c[_0x2c53('0x43')]!==_0x2c53('0x44')){var _0x24d7a8={};_0x24d7a8[_0x59e98c['name']]={'$like':'%'+_0x10bebe[_0x2c53('0x35')]['filter']+'%'};return _0x24d7a8;}})});}_0x1a444a=_['merge']({},_0x1a444a,_0x10bebe[_0x2c53('0x45')]);var _0x515a6e={'where':_0x1a444a[_0x2c53('0x3e')]};return db[_0x2c53('0x31')][_0x2c53('0x46')](_0x515a6e)[_0x2c53('0x2a')](function(_0x5a03c9){_0x5dff93[_0x2c53('0x46')]=_0x5a03c9;if(_0x10bebe[_0x2c53('0x35')][_0x2c53('0x47')]){_0x1a444a['include']=[{'all':!![]}];}return db['Sound'][_0x2c53('0x48')](_0x1a444a);})['then'](function(_0x53c33e){_0x5dff93[_0x2c53('0x49')]=_0x53c33e;return _0x5dff93;})[_0x2c53('0x2a')](respondWithFilteredResult(_0x1ee9e,_0x1a444a))[_0x2c53('0x4a')](handleError(_0x1ee9e,null));};exports[_0x2c53('0x4b')]=function(_0x5601d9,_0x1779ca){var _0x2fd525={'raw':!![],'where':{'id':_0x5601d9['params']['id']}},_0x526763={};_0x526763['model']=_[_0x2c53('0x4c')](db[_0x2c53('0x31')][_0x2c53('0x32')]);_0x526763['query']=_['keys'](_0x5601d9[_0x2c53('0x35')]);_0x526763['filters']=_[_0x2c53('0x37')](_0x526763[_0x2c53('0x34')],_0x526763['query']);_0x2fd525[_0x2c53('0x38')]=_[_0x2c53('0x37')](_0x526763[_0x2c53('0x34')],qs[_0x2c53('0x39')](_0x5601d9['query'][_0x2c53('0x39')]));_0x2fd525[_0x2c53('0x38')]=_0x2fd525[_0x2c53('0x38')][_0x2c53('0x3a')]?_0x2fd525[_0x2c53('0x38')]:_0x526763[_0x2c53('0x34')];if(_0x5601d9[_0x2c53('0x35')][_0x2c53('0x47')]){_0x2fd525[_0x2c53('0x4d')]=[{'all':!![]}];}_0x2fd525=_[_0x2c53('0x41')]({},_0x2fd525,_0x5601d9['options']);return db[_0x2c53('0x31')][_0x2c53('0x4e')](_0x2fd525)[_0x2c53('0x2a')](handleEntityNotFound(_0x1779ca,null))[_0x2c53('0x2a')](respondWithResult(_0x1779ca,null))[_0x2c53('0x4a')](handleError(_0x1779ca,null));};exports[_0x2c53('0x4f')]=function(_0x35a0b4,_0x2f6fea,_0x34d03c){return db[_0x2c53('0x31')][_0x2c53('0x4e')]({'where':{'id':_0x35a0b4['params']['id']},'attributes':[_0x2c53('0x2e'),_0x2c53('0x50'),_0x2c53('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x2f6fea,null))[_0x2c53('0x2a')](function(_0x58e90f){if(_0x58e90f){if(!fs['existsSync'](path['join'](config['root'],_0x2c53('0x52'),_0x58e90f['save_name']+'.'+_0x58e90f['converted_format']))){throw new db[(_0x2c53('0x53'))][(_0x2c53('0x54'))](_0x2c53('0x55'));}return _0x2f6fea[_0x2c53('0x4f')](path['join'](config['root'],_0x2c53('0x52'),util[_0x2c53('0x56')]('%s.%s',_0x58e90f['save_name'],_0x58e90f['converted_format'])),util[_0x2c53('0x56')](_0x2c53('0x57'),_0x58e90f[_0x2c53('0x2e')],_0x58e90f[_0x2c53('0x51')]));}return null;})[_0x2c53('0x4a')](handleError(_0x2f6fea,null));};exports[_0x2c53('0x58')]=function(_0x19b22c,_0x7ab32a,_0x449f1a){var _0x231316={'name':path[_0x2c53('0x59')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5b')],path[_0x2c53('0x5c')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5b')])),'save_name':path[_0x2c53('0x59')](_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5d')],path[_0x2c53('0x5c')](_0x19b22c['file'][_0x2c53('0x5d')])),'original_format':path[_0x2c53('0x5c')](_0x19b22c['file']['originalname'])[_0x2c53('0x5e')](0x1),'converted_format':_0x2c53('0x5f')};var _0x52c086=path['join'](config[_0x2c53('0x60')],_0x2c53('0x61'),_0x19b22c[_0x2c53('0x5a')][_0x2c53('0x5d')]);var _0x5d9d31=path['join'](config[_0x2c53('0x60')],'server/files/sounds/converted',util['format'](_0x2c53('0x57'),path[_0x2c53('0x59')](_0x19b22c['file']['filename'],path[_0x2c53('0x5c')](_0x19b22c[_0x2c53('0x5a')]['filename'])),_0x231316[_0x2c53('0x51')]));logger[_0x2c53('0x62')](_0x2c53('0x63'),_0x52c086);logger[_0x2c53('0x62')](_0x2c53('0x64'),_0x5d9d31);try{fs[_0x2c53('0x65')](_0x52c086,parseInt(_0x2c53('0x66'),0x8));var _0x51fc36=sox[_0x2c53('0x67')](_0x52c086,_0x5d9d31,{'sampleRate':0x1f40,'format':_0x2c53('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51fc36['on'](_0x2c53('0x2c'),function(_0x4be18d){fs[_0x2c53('0x68')](_0x52c086);_0x7ab32a[_0x2c53('0x1b')](0x1f4)['send'](_0x4be18d);});_0x51fc36['on'](_0x2c53('0x69'),function(_0x371b82){_0x231316[_0x2c53('0x6a')]=isNaN(_0x371b82[_0x2c53('0x6b')])?null:_0x371b82['duration']*0x3e8;_0x231316[_0x2c53('0x6c')]=isNaN(_0x371b82[_0x2c53('0x6d')])?null:_0x371b82[_0x2c53('0x6d')];_0x231316[_0x2c53('0x6e')]=isNaN(_0x371b82[_0x2c53('0x6f')])?null:_0x371b82[_0x2c53('0x6f')];_0x231316[_0x2c53('0x70')]=isNaN(_0x371b82[_0x2c53('0x71')])?null:_0x371b82[_0x2c53('0x71')];_0x231316['original_sampleRate']=isNaN(_0x371b82['sampleRate'])?null:_0x371b82['sampleRate'];});_0x51fc36['on'](_0x2c53('0x72'),function(_0x2e8bb3){_0x231316[_0x2c53('0x73')]=isNaN(_0x2e8bb3[_0x2c53('0x6b')])?null:_0x2e8bb3[_0x2c53('0x6b')]*0x3e8;_0x231316[_0x2c53('0x74')]=isNaN(_0x2e8bb3[_0x2c53('0x6d')])?null:_0x2e8bb3['sampleCount'];_0x231316[_0x2c53('0x75')]=isNaN(_0x2e8bb3[_0x2c53('0x6f')])?null:_0x2e8bb3[_0x2c53('0x6f')];_0x231316[_0x2c53('0x76')]=isNaN(_0x2e8bb3[_0x2c53('0x71')])?null:_0x2e8bb3[_0x2c53('0x71')];_0x231316[_0x2c53('0x77')]=isNaN(_0x2e8bb3[_0x2c53('0x78')])?null:_0x2e8bb3[_0x2c53('0x78')];});_0x51fc36['on']('end',function(){fs[_0x2c53('0x65')](_0x5d9d31,parseInt(_0x2c53('0x66'),0x8));return db[_0x2c53('0x31')][_0x2c53('0x58')](_0x231316)[_0x2c53('0x2a')](function(_0x537054){var _0x18e008={'role':_0x19b22c['body']['role'],'userProfileId':_0x19b22c[_0x2c53('0x79')]['userProfileId']};if(!_0x18e008)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e008[_0x2c53('0x7a')]===_0x2c53('0x7b')){var _0x59f4f6=_0x537054['get']({'plain':!![]});return db['UserProfileSection'][_0x2c53('0x4e')]({'where':{'name':_0x2c53('0x27'),'userProfileId':_0x18e008[_0x2c53('0x7c')]},'raw':!![]})[_0x2c53('0x2a')](function(_0x229178){if(_0x229178&&_0x229178[_0x2c53('0x7d')]===0x0){return db[_0x2c53('0x28')]['create']({'name':_0x59f4f6[_0x2c53('0x2e')],'resourceId':_0x59f4f6['id'],'type':_0x229178[_0x2c53('0x2e')],'sectionId':_0x229178['id']},{})[_0x2c53('0x2a')](function(){return _0x537054;});}else{return _0x537054;}})[_0x2c53('0x4a')](function(_0x46add5){logger[_0x2c53('0x2c')](_0x2c53('0x7e'),_0x46add5);throw _0x46add5;});}return _0x537054;})[_0x2c53('0x2a')](respondWithResult(_0x7ab32a,null))[_0x2c53('0x4a')](handleError(_0x7ab32a,null));});_0x51fc36[_0x2c53('0x7f')]();}catch(_0x260f47){_0x7ab32a[_0x2c53('0x1b')](0x1f4)[_0x2c53('0x2f')](_0x260f47);}};exports[_0x2c53('0x25')]=function(_0x3b98a2,_0x46853d,_0x43a121){return db[_0x2c53('0x31')][_0x2c53('0x4e')]({'where':{'id':_0x3b98a2[_0x2c53('0x80')]['id']}})['then'](handleEntityNotFound(_0x46853d,null))[_0x2c53('0x2a')](saveUpdates(_[_0x2c53('0x3f')](_0x3b98a2[_0x2c53('0x79')],['name','description']),null))[_0x2c53('0x2a')](respondWithResult(_0x46853d,null))[_0x2c53('0x4a')](handleError(_0x46853d,null));};exports[_0x2c53('0x81')]=function(_0xaec259,_0x4a4552,_0x2ef45b){return db['Sound'][_0x2c53('0x4e')]({'where':{'id':_0xaec259[_0x2c53('0x80')]['id']}})[_0x2c53('0x2a')](function(_0x1317a4){if(_0x1317a4){return _0x1317a4[_0x2c53('0x29')]();}})[_0x2c53('0x2a')](function(_0x4e92a2){var _0x156ea3=path['join'](config[_0x2c53('0x60')],_0x2c53('0x61'),util[_0x2c53('0x56')](_0x2c53('0x57'),_0x4e92a2[_0x2c53('0x50')],_0x4e92a2['original_format']));var _0x57388d=path[_0x2c53('0x82')](config[_0x2c53('0x60')],'server/files/sounds/converted',util[_0x2c53('0x56')](_0x2c53('0x57'),_0x4e92a2['save_name'],_0x4e92a2[_0x2c53('0x51')]));fs[_0x2c53('0x68')](_0x156ea3);fs[_0x2c53('0x68')](_0x57388d);return _0x4e92a2;})[_0x2c53('0x2a')](function(_0x56fdc6){if(_0x56fdc6){return _0x4a4552[_0x2c53('0x1b')](0xcc)[_0x2c53('0x2b')]();}})[_0x2c53('0x2a')](handleEntityNotFound(_0x4a4552,null))[_0x2c53('0x4a')](handleError(_0x4a4552,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b7d7121..e4e075a 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 _0xeac3=['../../config/environment','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3817fb,_0x2aecd3){var _0x25651d=function(_0x2ba30f){while(--_0x2ba30f){_0x3817fb['push'](_0x3817fb['shift']());}};_0x25651d(++_0x2aecd3);}(_0xeac3,0x1e5));var _0x3eac=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeac3[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3eac('0x0'));var util=require('util');var logger=require(_0x3eac('0x1'))(_0x3eac('0x2'));var moment=require(_0x3eac('0x3'));var BPromise=require('bluebird');var rp=require(_0x3eac('0x4'));var fs=require('fs');var path=require(_0x3eac('0x5'));var rimraf=require(_0x3eac('0x6'));var config=require(_0x3eac('0x7'));var attributes=require('./sound.attributes');module[_0x3eac('0x8')]=function(_0xaf15c4,_0x3f842d){return _0xaf15c4[_0x3eac('0x9')](_0x3eac('0xa'),attributes,{'tableName':_0x3eac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cca=['rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x1afcfe,_0x2548e2){var _0x41351b=function(_0x1e7734){while(--_0x1e7734){_0x1afcfe['push'](_0x1afcfe['shift']());}};_0x41351b(++_0x2548e2);}(_0x4cca,0x150));var _0xa4cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa4cc('0x0'));var util=require('util');var logger=require(_0xa4cc('0x1'))(_0xa4cc('0x2'));var moment=require(_0xa4cc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa4cc('0x4'));var config=require(_0xa4cc('0x5'));var attributes=require(_0xa4cc('0x6'));module['exports']=function(_0x197434,_0xd46333){return _0x197434[_0xa4cc('0x7')](_0xa4cc('0x8'),attributes,{'tableName':_0xa4cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 115e819..f899f1d 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 _0xdbc2=['message','result','catch','find','options','where','attributes','include','model','map','ShowSound','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x24a877,_0x11d8c8){var _0x2c919b=function(_0x38c7ef){while(--_0x38c7ef){_0x24a877['push'](_0x24a877['shift']());}};_0x2c919b(++_0x11d8c8);}(_0xdbc2,0xb9));var _0x2dbc=function(_0x27a5b2,_0x1c5781){_0x27a5b2=_0x27a5b2-0x0;var _0xccaef8=_0xdbc2[_0x27a5b2];return _0xccaef8;};'use strict';var _=require(_0x2dbc('0x0'));var util=require(_0x2dbc('0x1'));var moment=require(_0x2dbc('0x2'));var BPromise=require(_0x2dbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2dbc('0x4'))['db'];var utils=require(_0x2dbc('0x5'));var logger=require(_0x2dbc('0x6'))('rpc');var config=require(_0x2dbc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2dbc('0x8')][_0x2dbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25ffb8,_0x54fa75,_0x335b11){return new BPromise(function(_0x2d0086,_0x419c1a){return client['request'](_0x25ffb8,_0x335b11)[_0x2dbc('0xa')](function(_0x24c481){logger[_0x2dbc('0xb')](_0x2dbc('0xc'),_0x54fa75,_0x2dbc('0xd'));logger[_0x2dbc('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x54fa75,_0x2dbc('0xd'),JSON[_0x2dbc('0xf')](_0x24c481));if(_0x24c481['error']){if(_0x24c481[_0x2dbc('0x10')][_0x2dbc('0x11')]===0x1f4){logger['error'](_0x2dbc('0xc'),_0x54fa75,_0x24c481['error'][_0x2dbc('0x12')]);return _0x419c1a(_0x24c481['error']['message']);}logger[_0x2dbc('0x10')](_0x2dbc('0xc'),_0x54fa75,_0x24c481[_0x2dbc('0x10')]['message']);return _0x2d0086(_0x24c481[_0x2dbc('0x10')][_0x2dbc('0x12')]);}else{logger[_0x2dbc('0xb')]('Sound,\x20%s,\x20%s',_0x54fa75,_0x2dbc('0xd'));_0x2d0086(_0x24c481[_0x2dbc('0x13')][_0x2dbc('0x12')]);}})[_0x2dbc('0x14')](function(_0xa46110){logger[_0x2dbc('0x10')](_0x2dbc('0xc'),_0x54fa75,_0xa46110);_0x419c1a(_0xa46110);});});}exports['ShowSound']=function(_0xefb4ad){var _0xcdd269=this;return new Promise(function(_0x1fc18d,_0x157865){return db['Sound'][_0x2dbc('0x15')]({'raw':_0xefb4ad['options']?_0xefb4ad[_0x2dbc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xefb4ad[_0x2dbc('0x16')]?_0xefb4ad[_0x2dbc('0x16')][_0x2dbc('0x17')]||null:null,'attributes':_0xefb4ad[_0x2dbc('0x16')]?_0xefb4ad[_0x2dbc('0x16')][_0x2dbc('0x18')]||null:null,'include':_0xefb4ad['options']?_0xefb4ad['options'][_0x2dbc('0x19')]?_['map'](_0xefb4ad['options']['include'],function(_0x2f0bdb){return{'model':db[_0x2f0bdb[_0x2dbc('0x1a')]],'as':_0x2f0bdb['as'],'attributes':_0x2f0bdb[_0x2dbc('0x18')],'include':_0x2f0bdb['include']?_[_0x2dbc('0x1b')](_0x2f0bdb[_0x2dbc('0x19')],function(_0x5a8936){return{'model':db[_0x5a8936[_0x2dbc('0x1a')]],'as':_0x5a8936['as'],'attributes':_0x5a8936[_0x2dbc('0x18')],'include':_0x5a8936[_0x2dbc('0x19')]?_[_0x2dbc('0x1b')](_0x5a8936[_0x2dbc('0x19')],function(_0x33435d){return{'model':db[_0x33435d['model']],'as':_0x33435d['as'],'attributes':_0x33435d[_0x2dbc('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2dbc('0xa')](function(_0x23830f){logger[_0x2dbc('0xb')](_0x2dbc('0x1c'),_0xefb4ad);logger['debug']('ShowSound',_0xefb4ad,JSON[_0x2dbc('0xf')](_0x23830f));_0x1fc18d(_0x23830f);})[_0x2dbc('0x14')](function(_0x429f75){logger['error']('ShowSound',_0x429f75[_0x2dbc('0x12')],_0xefb4ad);_0x157865(_0xcdd269[_0x2dbc('0x10')](0x1f4,_0x429f75[_0x2dbc('0x12')]));});});}; \ No newline at end of file +var _0x946a=['jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSound','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31432b,_0x30ff39){var _0x22d703=function(_0x2639c2){while(--_0x2639c2){_0x31432b['push'](_0x31432b['shift']());}};_0x22d703(++_0x30ff39);}(_0x946a,0xf7));var _0xa946=function(_0x56be8e,_0xd07bbf){_0x56be8e=_0x56be8e-0x0;var _0x170540=_0x946a[_0x56be8e];return _0x170540;};'use strict';var _=require(_0xa946('0x0'));var util=require(_0xa946('0x1'));var moment=require(_0xa946('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa946('0x3'));var db=require(_0xa946('0x4'))['db'];var utils=require(_0xa946('0x5'));var logger=require(_0xa946('0x6'))(_0xa946('0x7'));var config=require(_0xa946('0x8'));var jayson=require(_0xa946('0x9'));var client=jayson[_0xa946('0xa')][_0xa946('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38fc85,_0x595d6c,_0x20a6e3){return new BPromise(function(_0x44c9b1,_0x42d9dc){return client[_0xa946('0xc')](_0x38fc85,_0x20a6e3)['then'](function(_0x225e27){logger[_0xa946('0xd')](_0xa946('0xe'),_0x595d6c,_0xa946('0xf'));logger[_0xa946('0x10')](_0xa946('0x11'),_0x595d6c,'request\x20sent',JSON[_0xa946('0x12')](_0x225e27));if(_0x225e27['error']){if(_0x225e27['error'][_0xa946('0x13')]===0x1f4){logger[_0xa946('0x14')](_0xa946('0xe'),_0x595d6c,_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);return _0x42d9dc(_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);}logger[_0xa946('0x14')](_0xa946('0xe'),_0x595d6c,_0x225e27[_0xa946('0x14')][_0xa946('0x15')]);return _0x44c9b1(_0x225e27[_0xa946('0x14')]['message']);}else{logger[_0xa946('0xd')]('Sound,\x20%s,\x20%s',_0x595d6c,_0xa946('0xf'));_0x44c9b1(_0x225e27['result'][_0xa946('0x15')]);}})[_0xa946('0x16')](function(_0x37ac53){logger['error'](_0xa946('0xe'),_0x595d6c,_0x37ac53);_0x42d9dc(_0x37ac53);});});}exports[_0xa946('0x17')]=function(_0x343c43){var _0x2726ee=this;return new Promise(function(_0x229201,_0x226fed){return db['Sound']['find']({'raw':_0x343c43[_0xa946('0x18')]?_0x343c43['options'][_0xa946('0x19')]===undefined?!![]:![]:!![],'where':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1a')]||null:null,'attributes':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1b')]||null:null,'include':_0x343c43[_0xa946('0x18')]?_0x343c43[_0xa946('0x18')][_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x343c43['options'][_0xa946('0x1c')],function(_0x5270c7){return{'model':db[_0x5270c7['model']],'as':_0x5270c7['as'],'attributes':_0x5270c7[_0xa946('0x1b')],'include':_0x5270c7[_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x5270c7['include'],function(_0x2d5ac2){return{'model':db[_0x2d5ac2[_0xa946('0x1e')]],'as':_0x2d5ac2['as'],'attributes':_0x2d5ac2[_0xa946('0x1b')],'include':_0x2d5ac2[_0xa946('0x1c')]?_[_0xa946('0x1d')](_0x2d5ac2[_0xa946('0x1c')],function(_0x3566d9){return{'model':db[_0x3566d9[_0xa946('0x1e')]],'as':_0x3566d9['as'],'attributes':_0x3566d9[_0xa946('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa946('0x1f')](function(_0x591a10){logger[_0xa946('0xd')](_0xa946('0x17'),_0x343c43);logger[_0xa946('0x10')]('ShowSound',_0x343c43,JSON['stringify'](_0x591a10));_0x229201(_0x591a10);})['catch'](function(_0x10181e){logger[_0xa946('0x14')](_0xa946('0x17'),_0x10181e[_0xa946('0x15')],_0x343c43);_0x226fed(_0x2726ee[_0xa946('0x14')](0x1f4,_0x10181e[_0xa946('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8fac477..d25a8dd 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54fd33,_0x19b4b4){var _0x47f77c=function(_0x5d5a4f){while(--_0x5d5a4f){_0x54fd33['push'](_0x54fd33['shift']());}};_0x47f77c(++_0x19b4b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0xb10b[_0x5eb442];return _0x53aad0;};'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 fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x253d2b,_0x49a0fb){var _0x3ce8bd=function(_0x3fcafe){while(--_0x3fcafe){_0x253d2b['push'](_0x253d2b['shift']());}};_0x3ce8bd(++_0x49a0fb);}(_0x2032,0xd9));var _0x2203=function(_0x1bdfde,_0x34e4ae){_0x1bdfde=_0x1bdfde-0x0;var _0x40aa24=_0x2032[_0x1bdfde];return _0x40aa24;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('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 0b1fb6e..713abfc 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 _0x9f20=['TEXT','medium','out','sequelize','exports','STRING'];(function(_0x483b8f,_0x2b8514){var _0x2e17a1=function(_0x38744a){while(--_0x38744a){_0x483b8f['push'](_0x483b8f['shift']());}};_0x2e17a1(++_0x2b8514);}(_0x9f20,0x75));var _0x09f2=function(_0x3033ec,_0x4accb8){_0x3033ec=_0x3033ec-0x0;var _0x2f49db=_0x9f20[_0x3033ec];return _0x2f49db;};'use strict';var Sequelize=require(_0x09f2('0x0'));module[_0x09f2('0x1')]={'uniqueid':{'type':Sequelize[_0x09f2('0x2')]},'body':{'type':Sequelize[_0x09f2('0x3')](_0x09f2('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x09f2('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x09f2('0x3')]}}; \ No newline at end of file +var _0xe481=['out','STRING','exports','TEXT','ENUM'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe481,0x84));var _0x1e48=function(_0x411778,_0x524eed){_0x411778=_0x411778-0x0;var _0x8f616=_0xe481[_0x411778];return _0x8f616;};'use strict';var Sequelize=require('sequelize');module[_0x1e48('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x1e48('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x1e48('0x2')]('in','out'),'defaultValue':_0x1e48('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1e48('0x4')]},'providerResponse':{'type':Sequelize[_0x1e48('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index fcf300c..eca8652 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 _0xb2af=['api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4c5a24,_0x5ef60c){var _0x4b067e=function(_0x33c0da){while(--_0x33c0da){_0x4c5a24['push'](_0x4c5a24['shift']());}};_0x4b067e(++_0x5ef60c);}(_0xb2af,0xd2));var _0xfb2a=function(_0x1039cc,_0x2be11c){_0x1039cc=_0x1039cc-0x0;var _0x3dd5c7=_0xb2af[_0x1039cc];return _0x3dd5c7;};'use strict';var emlformat=require(_0xfb2a('0x0'));var rimraf=require(_0xfb2a('0x1'));var zipdir=require(_0xfb2a('0x2'));var jsonpatch=require(_0xfb2a('0x3'));var rp=require('request-promise');var moment=require(_0xfb2a('0x4'));var BPromise=require(_0xfb2a('0x5'));var Mustache=require(_0xfb2a('0x6'));var util=require(_0xfb2a('0x7'));var path=require(_0xfb2a('0x8'));var sox=require('sox');var csv=require(_0xfb2a('0x9'));var ejs=require(_0xfb2a('0xa'));var fs=require('fs');var fs_extra=require(_0xfb2a('0xb'));var _=require('lodash');var squel=require(_0xfb2a('0xc'));var crypto=require(_0xfb2a('0xd'));var jsforce=require(_0xfb2a('0xe'));var deskjs=require(_0xfb2a('0xf'));var toCsv=require(_0xfb2a('0x9'));var querystring=require(_0xfb2a('0x10'));var Papa=require(_0xfb2a('0x11'));var Redis=require(_0xfb2a('0x12'));var authService=require(_0xfb2a('0x13'));var qs=require(_0xfb2a('0x14'));var as=require(_0xfb2a('0x15'));var hardwareService=require(_0xfb2a('0x16'));var logger=require(_0xfb2a('0x17'))(_0xfb2a('0x18'));var utils=require(_0xfb2a('0x19'));var config=require(_0xfb2a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49a66c,_0x26057f){_0x26057f=_0x26057f||0xcc;return function(_0x37e000){if(_0x37e000){return _0x49a66c[_0xfb2a('0x1b')](_0x26057f);}return _0x49a66c[_0xfb2a('0x1c')](_0x26057f)['end']();};}function respondWithResult(_0x29ed37,_0x5b8a45){_0x5b8a45=_0x5b8a45||0xc8;return function(_0x585cc9){if(_0x585cc9){return _0x29ed37[_0xfb2a('0x1c')](_0x5b8a45)['json'](_0x585cc9);}};}function respondWithFilteredResult(_0x55ab68,_0xc1954c){return function(_0x18febb){if(_0x18febb){var _0x49ecbd=typeof _0xc1954c[_0xfb2a('0x1d')]===_0xfb2a('0x1e')&&typeof _0xc1954c[_0xfb2a('0x1f')]===_0xfb2a('0x1e');var _0x214051=_0x18febb[_0xfb2a('0x20')];var _0x52743a=_0x49ecbd?0x0:_0xc1954c[_0xfb2a('0x1d')];var _0xb5ff5c=_0x49ecbd?_0x18febb[_0xfb2a('0x20')]:_0xc1954c[_0xfb2a('0x1d')]+_0xc1954c['limit'];var _0x2644ed;if(_0xb5ff5c>=_0x214051){_0xb5ff5c=_0x214051;_0x2644ed=0xc8;}else{_0x2644ed=0xce;}_0x55ab68['status'](_0x2644ed);return _0x55ab68[_0xfb2a('0x21')](_0xfb2a('0x22'),_0x52743a+'-'+_0xb5ff5c+'/'+_0x214051)[_0xfb2a('0x23')](_0x18febb);}return null;};}function patchUpdates(_0x593291){return function(_0x5857a5){try{jsonpatch['apply'](_0x5857a5,_0x593291,!![]);}catch(_0x497676){return BPromise[_0xfb2a('0x24')](_0x497676);}return _0x5857a5[_0xfb2a('0x25')]();};}function saveUpdates(_0x434ca5,_0x3145d3){return function(_0x3e75c2){if(_0x3e75c2){return _0x3e75c2[_0xfb2a('0x26')](_0x434ca5)[_0xfb2a('0x27')](function(_0x8dc56e){return _0x8dc56e;});}return null;};}function removeEntity(_0xe82821,_0x351489){return function(_0x499c36){if(_0x499c36){return _0x499c36[_0xfb2a('0x28')]()['then'](function(){_0xe82821[_0xfb2a('0x1c')](0xcc)[_0xfb2a('0x29')]();});}};}function handleEntityNotFound(_0x5726b3,_0x1cd567){return function(_0x239446){if(!_0x239446){_0x5726b3['sendStatus'](0x194);}return _0x239446;};}function handleError(_0x446dfa,_0x388bfe){_0x388bfe=_0x388bfe||0x1f4;return function(_0x4cdb14){logger[_0xfb2a('0x2a')](_0x4cdb14[_0xfb2a('0x2b')]);if(_0x4cdb14[_0xfb2a('0x2c')]){delete _0x4cdb14[_0xfb2a('0x2c')];}_0x446dfa[_0xfb2a('0x1c')](_0x388bfe)[_0xfb2a('0x2d')](_0x4cdb14);};}exports[_0xfb2a('0x2e')]=function(_0x3f3da3,_0x111c67){var _0x3d6768={},_0x4b79e5={},_0xbbf3b4={'count':0x0,'rows':[]};var _0x3a4861=_[_0xfb2a('0x2f')](db[_0xfb2a('0x30')][_0xfb2a('0x31')],function(_0xe1a1cf){return{'name':_0xe1a1cf[_0xfb2a('0x32')],'type':_0xe1a1cf[_0xfb2a('0x33')]['key']};});_0x4b79e5[_0xfb2a('0x34')]=_['map'](_0x3a4861,'name');_0x4b79e5[_0xfb2a('0x35')]=_[_0xfb2a('0x36')](_0x3f3da3[_0xfb2a('0x35')]);_0x4b79e5['filters']=_[_0xfb2a('0x37')](_0x4b79e5['model'],_0x4b79e5[_0xfb2a('0x35')]);_0x3d6768[_0xfb2a('0x38')]=_[_0xfb2a('0x37')](_0x4b79e5[_0xfb2a('0x34')],qs[_0xfb2a('0x39')](_0x3f3da3[_0xfb2a('0x35')]['fields']));_0x3d6768['attributes']=_0x3d6768[_0xfb2a('0x38')][_0xfb2a('0x3a')]?_0x3d6768['attributes']:_0x4b79e5['model'];if(!_0x3f3da3[_0xfb2a('0x35')][_0xfb2a('0x3b')](_0xfb2a('0x3c'))){_0x3d6768[_0xfb2a('0x1f')]=qs[_0xfb2a('0x1f')](_0x3f3da3[_0xfb2a('0x35')]['limit']);_0x3d6768[_0xfb2a('0x1d')]=qs[_0xfb2a('0x1d')](_0x3f3da3[_0xfb2a('0x35')][_0xfb2a('0x1d')]);}_0x3d6768[_0xfb2a('0x3d')]=qs[_0xfb2a('0x3e')](_0x3f3da3[_0xfb2a('0x35')][_0xfb2a('0x3e')]);_0x3d6768[_0xfb2a('0x3f')]=qs[_0xfb2a('0x40')](_[_0xfb2a('0x41')](_0x3f3da3[_0xfb2a('0x35')],_0x4b79e5[_0xfb2a('0x40')]),_0x3a4861);if(_0x3f3da3[_0xfb2a('0x35')][_0xfb2a('0x42')]){_0x3d6768[_0xfb2a('0x3f')]=_[_0xfb2a('0x43')](_0x3d6768[_0xfb2a('0x3f')],{'$or':_[_0xfb2a('0x2f')](_0x3a4861,function(_0x45ea7b){if(_0x45ea7b[_0xfb2a('0x33')]!==_0xfb2a('0x44')){var _0x455b7e={};_0x455b7e[_0x45ea7b[_0xfb2a('0x2c')]]={'$like':'%'+_0x3f3da3[_0xfb2a('0x35')][_0xfb2a('0x42')]+'%'};return _0x455b7e;}})});}_0x3d6768=_[_0xfb2a('0x43')]({},_0x3d6768,_0x3f3da3[_0xfb2a('0x45')]);var _0x2e4b2f={'where':_0x3d6768['where']};return db[_0xfb2a('0x30')][_0xfb2a('0x20')](_0x2e4b2f)[_0xfb2a('0x27')](function(_0x3d0973){_0xbbf3b4[_0xfb2a('0x20')]=_0x3d0973;if(_0x3f3da3[_0xfb2a('0x35')]['includeAll']){_0x3d6768[_0xfb2a('0x46')]=[{'all':!![]}];}return db[_0xfb2a('0x30')][_0xfb2a('0x47')](_0x3d6768);})['then'](function(_0x546921){_0xbbf3b4[_0xfb2a('0x48')]=_0x546921;return _0xbbf3b4;})[_0xfb2a('0x27')](respondWithFilteredResult(_0x111c67,_0x3d6768))[_0xfb2a('0x49')](handleError(_0x111c67,null));};exports['show']=function(_0x3216bf,_0x29dd24){var _0x1b9bd5={'raw':!![],'where':{'id':_0x3216bf[_0xfb2a('0x4a')]['id']}},_0x90d963={};_0x90d963[_0xfb2a('0x34')]=_[_0xfb2a('0x36')](db[_0xfb2a('0x30')][_0xfb2a('0x31')]);_0x90d963['query']=_['keys'](_0x3216bf['query']);_0x90d963[_0xfb2a('0x40')]=_[_0xfb2a('0x37')](_0x90d963['model'],_0x90d963['query']);_0x1b9bd5['attributes']=_[_0xfb2a('0x37')](_0x90d963[_0xfb2a('0x34')],qs[_0xfb2a('0x39')](_0x3216bf[_0xfb2a('0x35')]['fields']));_0x1b9bd5[_0xfb2a('0x38')]=_0x1b9bd5[_0xfb2a('0x38')][_0xfb2a('0x3a')]?_0x1b9bd5['attributes']:_0x90d963['model'];if(_0x3216bf['query'][_0xfb2a('0x4b')]){_0x1b9bd5[_0xfb2a('0x46')]=[{'all':!![]}];}_0x1b9bd5=_[_0xfb2a('0x43')]({},_0x1b9bd5,_0x3216bf[_0xfb2a('0x45')]);return db[_0xfb2a('0x30')][_0xfb2a('0x4c')](_0x1b9bd5)[_0xfb2a('0x27')](handleEntityNotFound(_0x29dd24,null))[_0xfb2a('0x27')](respondWithResult(_0x29dd24,null))[_0xfb2a('0x49')](handleError(_0x29dd24,null));};exports['create']=function(_0x4f9460,_0x4b4b64){return db[_0xfb2a('0x30')]['create'](_0x4f9460[_0xfb2a('0x4d')],{})['then'](respondWithResult(_0x4b4b64,0xc9))['catch'](handleError(_0x4b4b64,null));};exports[_0xfb2a('0x26')]=function(_0xef975f,_0x5843f8){if(_0xef975f[_0xfb2a('0x4d')]['id']){delete _0xef975f[_0xfb2a('0x4d')]['id'];}return db[_0xfb2a('0x30')]['find']({'where':{'id':_0xef975f[_0xfb2a('0x4a')]['id']}})[_0xfb2a('0x27')](handleEntityNotFound(_0x5843f8,null))['then'](saveUpdates(_0xef975f['body'],null))[_0xfb2a('0x27')](respondWithResult(_0x5843f8,null))[_0xfb2a('0x49')](handleError(_0x5843f8,null));};exports[_0xfb2a('0x28')]=function(_0x4f62af,_0x1ea4c7){return db[_0xfb2a('0x30')][_0xfb2a('0x4c')]({'where':{'id':_0x4f62af['params']['id']}})[_0xfb2a('0x27')](handleEntityNotFound(_0x1ea4c7,null))['then'](removeEntity(_0x1ea4c7,null))['catch'](handleError(_0x1ea4c7,null));}; \ No newline at end of file +var _0xcdc2=['params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','name','send','index','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','order','sort','filter','where','merge','map','options','SquareMessage','includeAll','include','findAll','rows','catch'];(function(_0x25e48a,_0x4bc23b){var _0x445f58=function(_0x422a35){while(--_0x422a35){_0x25e48a['push'](_0x25e48a['shift']());}};_0x445f58(++_0x4bc23b);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x16bec8,_0x4f9046){_0x16bec8=_0x16bec8-0x0;var _0x3f1d76=_0xcdc2[_0x16bec8];return _0x3f1d76;};'use strict';var emlformat=require(_0x2cdc('0x0'));var rimraf=require(_0x2cdc('0x1'));var zipdir=require(_0x2cdc('0x2'));var jsonpatch=require(_0x2cdc('0x3'));var rp=require(_0x2cdc('0x4'));var moment=require(_0x2cdc('0x5'));var BPromise=require(_0x2cdc('0x6'));var Mustache=require(_0x2cdc('0x7'));var util=require(_0x2cdc('0x8'));var path=require(_0x2cdc('0x9'));var sox=require(_0x2cdc('0xa'));var csv=require(_0x2cdc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cdc('0xc'));var squel=require('squel');var crypto=require(_0x2cdc('0xd'));var jsforce=require(_0x2cdc('0xe'));var deskjs=require(_0x2cdc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2cdc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2cdc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cdc('0x12'));var logger=require('../../config/logger')(_0x2cdc('0x13'));var utils=require(_0x2cdc('0x14'));var config=require(_0x2cdc('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd7d0,_0x53f515){_0x53f515=_0x53f515||0xcc;return function(_0x5951ca){if(_0x5951ca){return _0x4dd7d0[_0x2cdc('0x16')](_0x53f515);}return _0x4dd7d0[_0x2cdc('0x17')](_0x53f515)[_0x2cdc('0x18')]();};}function respondWithResult(_0x19c3d0,_0x4bf2f6){_0x4bf2f6=_0x4bf2f6||0xc8;return function(_0x4fb78b){if(_0x4fb78b){return _0x19c3d0[_0x2cdc('0x17')](_0x4bf2f6)[_0x2cdc('0x19')](_0x4fb78b);}};}function respondWithFilteredResult(_0x3cd5e0,_0x3715be){return function(_0x590fb4){if(_0x590fb4){var _0x570500=typeof _0x3715be[_0x2cdc('0x1a')]===_0x2cdc('0x1b')&&typeof _0x3715be[_0x2cdc('0x1c')]===_0x2cdc('0x1b');var _0x1d0633=_0x590fb4['count'];var _0x3a27bd=_0x570500?0x0:_0x3715be[_0x2cdc('0x1a')];var _0x4e3b93=_0x570500?_0x590fb4[_0x2cdc('0x1d')]:_0x3715be[_0x2cdc('0x1a')]+_0x3715be[_0x2cdc('0x1c')];var _0xa33fe6;if(_0x4e3b93>=_0x1d0633){_0x4e3b93=_0x1d0633;_0xa33fe6=0xc8;}else{_0xa33fe6=0xce;}_0x3cd5e0[_0x2cdc('0x17')](_0xa33fe6);return _0x3cd5e0[_0x2cdc('0x1e')]('Content-Range',_0x3a27bd+'-'+_0x4e3b93+'/'+_0x1d0633)['json'](_0x590fb4);}return null;};}function patchUpdates(_0x27bb5d){return function(_0x4f103c){try{jsonpatch['apply'](_0x4f103c,_0x27bb5d,!![]);}catch(_0x3ff658){return BPromise[_0x2cdc('0x1f')](_0x3ff658);}return _0x4f103c[_0x2cdc('0x20')]();};}function saveUpdates(_0x211eab,_0x3ce18a){return function(_0x22169c){if(_0x22169c){return _0x22169c['update'](_0x211eab)['then'](function(_0x19f1d6){return _0x19f1d6;});}return null;};}function removeEntity(_0x2ea200,_0x4bdb4d){return function(_0x202580){if(_0x202580){return _0x202580[_0x2cdc('0x21')]()[_0x2cdc('0x22')](function(){_0x2ea200[_0x2cdc('0x17')](0xcc)[_0x2cdc('0x18')]();});}};}function handleEntityNotFound(_0x480e57,_0x476c36){return function(_0x119936){if(!_0x119936){_0x480e57[_0x2cdc('0x16')](0x194);}return _0x119936;};}function handleError(_0x1afec9,_0x39203e){_0x39203e=_0x39203e||0x1f4;return function(_0x5468da){logger['error'](_0x5468da['stack']);if(_0x5468da[_0x2cdc('0x23')]){delete _0x5468da[_0x2cdc('0x23')];}_0x1afec9[_0x2cdc('0x17')](_0x39203e)[_0x2cdc('0x24')](_0x5468da);};}exports[_0x2cdc('0x25')]=function(_0x2433f5,_0x17316d){var _0x48224c={},_0x154761={},_0x564194={'count':0x0,'rows':[]};var _0x2acdd2=_['map'](db['SquareMessage'][_0x2cdc('0x26')],function(_0x2a58b0){return{'name':_0x2a58b0[_0x2cdc('0x27')],'type':_0x2a58b0[_0x2cdc('0x28')][_0x2cdc('0x29')]};});_0x154761[_0x2cdc('0x2a')]=_['map'](_0x2acdd2,_0x2cdc('0x23'));_0x154761['query']=_[_0x2cdc('0x2b')](_0x2433f5['query']);_0x154761[_0x2cdc('0x2c')]=_[_0x2cdc('0x2d')](_0x154761[_0x2cdc('0x2a')],_0x154761['query']);_0x48224c[_0x2cdc('0x2e')]=_[_0x2cdc('0x2d')](_0x154761['model'],qs['fields'](_0x2433f5['query'][_0x2cdc('0x2f')]));_0x48224c[_0x2cdc('0x2e')]=_0x48224c[_0x2cdc('0x2e')]['length']?_0x48224c[_0x2cdc('0x2e')]:_0x154761['model'];if(!_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x31')]('nolimit')){_0x48224c[_0x2cdc('0x1c')]=qs[_0x2cdc('0x1c')](_0x2433f5[_0x2cdc('0x30')]['limit']);_0x48224c[_0x2cdc('0x1a')]=qs['offset'](_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x1a')]);}_0x48224c[_0x2cdc('0x32')]=qs[_0x2cdc('0x33')](_0x2433f5['query'][_0x2cdc('0x33')]);_0x48224c['where']=qs[_0x2cdc('0x2c')](_['pick'](_0x2433f5['query'],_0x154761[_0x2cdc('0x2c')]),_0x2acdd2);if(_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x34')]){_0x48224c[_0x2cdc('0x35')]=_[_0x2cdc('0x36')](_0x48224c[_0x2cdc('0x35')],{'$or':_[_0x2cdc('0x37')](_0x2acdd2,function(_0x48e31e){if(_0x48e31e[_0x2cdc('0x28')]!=='VIRTUAL'){var _0x206c7e={};_0x206c7e[_0x48e31e[_0x2cdc('0x23')]]={'$like':'%'+_0x2433f5['query'][_0x2cdc('0x34')]+'%'};return _0x206c7e;}})});}_0x48224c=_[_0x2cdc('0x36')]({},_0x48224c,_0x2433f5[_0x2cdc('0x38')]);var _0x3356f7={'where':_0x48224c[_0x2cdc('0x35')]};return db[_0x2cdc('0x39')]['count'](_0x3356f7)['then'](function(_0x1d1f61){_0x564194['count']=_0x1d1f61;if(_0x2433f5[_0x2cdc('0x30')][_0x2cdc('0x3a')]){_0x48224c[_0x2cdc('0x3b')]=[{'all':!![]}];}return db[_0x2cdc('0x39')][_0x2cdc('0x3c')](_0x48224c);})[_0x2cdc('0x22')](function(_0x2b91a1){_0x564194[_0x2cdc('0x3d')]=_0x2b91a1;return _0x564194;})['then'](respondWithFilteredResult(_0x17316d,_0x48224c))[_0x2cdc('0x3e')](handleError(_0x17316d,null));};exports['show']=function(_0x3ab43b,_0x412217){var _0x4fdfe6={'raw':!![],'where':{'id':_0x3ab43b[_0x2cdc('0x3f')]['id']}},_0x50dc1b={};_0x50dc1b['model']=_[_0x2cdc('0x2b')](db['SquareMessage'][_0x2cdc('0x26')]);_0x50dc1b[_0x2cdc('0x30')]=_[_0x2cdc('0x2b')](_0x3ab43b['query']);_0x50dc1b[_0x2cdc('0x2c')]=_['intersection'](_0x50dc1b[_0x2cdc('0x2a')],_0x50dc1b['query']);_0x4fdfe6[_0x2cdc('0x2e')]=_[_0x2cdc('0x2d')](_0x50dc1b[_0x2cdc('0x2a')],qs[_0x2cdc('0x2f')](_0x3ab43b['query'][_0x2cdc('0x2f')]));_0x4fdfe6['attributes']=_0x4fdfe6[_0x2cdc('0x2e')]['length']?_0x4fdfe6[_0x2cdc('0x2e')]:_0x50dc1b[_0x2cdc('0x2a')];if(_0x3ab43b[_0x2cdc('0x30')][_0x2cdc('0x3a')]){_0x4fdfe6[_0x2cdc('0x3b')]=[{'all':!![]}];}_0x4fdfe6=_['merge']({},_0x4fdfe6,_0x3ab43b[_0x2cdc('0x38')]);return db[_0x2cdc('0x39')]['find'](_0x4fdfe6)[_0x2cdc('0x22')](handleEntityNotFound(_0x412217,null))['then'](respondWithResult(_0x412217,null))[_0x2cdc('0x3e')](handleError(_0x412217,null));};exports[_0x2cdc('0x40')]=function(_0x2136bc,_0x5ea543){return db[_0x2cdc('0x39')][_0x2cdc('0x40')](_0x2136bc[_0x2cdc('0x41')],{})[_0x2cdc('0x22')](respondWithResult(_0x5ea543,0xc9))[_0x2cdc('0x3e')](handleError(_0x5ea543,null));};exports[_0x2cdc('0x42')]=function(_0x37e1ea,_0x89bf5f){if(_0x37e1ea[_0x2cdc('0x41')]['id']){delete _0x37e1ea[_0x2cdc('0x41')]['id'];}return db['SquareMessage'][_0x2cdc('0x43')]({'where':{'id':_0x37e1ea[_0x2cdc('0x3f')]['id']}})[_0x2cdc('0x22')](handleEntityNotFound(_0x89bf5f,null))[_0x2cdc('0x22')](saveUpdates(_0x37e1ea[_0x2cdc('0x41')],null))['then'](respondWithResult(_0x89bf5f,null))[_0x2cdc('0x3e')](handleError(_0x89bf5f,null));};exports[_0x2cdc('0x21')]=function(_0x582487,_0x50174f){return db['SquareMessage'][_0x2cdc('0x43')]({'where':{'id':_0x582487[_0x2cdc('0x3f')]['id']}})[_0x2cdc('0x22')](handleEntityNotFound(_0x50174f,null))['then'](removeEntity(_0x50174f,null))[_0x2cdc('0x3e')](handleError(_0x50174f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fae0480..0a754b9 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 _0x8105=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','api','path'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8105,0x1d2));var _0x5810=function(_0xd105be,_0x257bdc){_0xd105be=_0xd105be-0x0;var _0x63229a=_0x8105[_0xd105be];return _0x63229a;};'use strict';var _=require(_0x5810('0x0'));var util=require(_0x5810('0x1'));var logger=require('../../config/logger')(_0x5810('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5810('0x3'));var rimraf=require(_0x5810('0x4'));var config=require(_0x5810('0x5'));var attributes=require(_0x5810('0x6'));module[_0x5810('0x7')]=function(_0x339e89,_0x3885a1){return _0x339e89[_0x5810('0x8')](_0x5810('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94fc=['../../config/environment','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x207d90,_0x27e800){var _0x45023b=function(_0x20e07c){while(--_0x20e07c){_0x207d90['push'](_0x207d90['shift']());}};_0x45023b(++_0x27e800);}(_0x94fc,0x1ed));var _0xc94f=function(_0x6445b1,_0x5d74ec){_0x6445b1=_0x6445b1-0x0;var _0x1f088d=_0x94fc[_0x6445b1];return _0x1f088d;};'use strict';var _=require(_0xc94f('0x0'));var util=require(_0xc94f('0x1'));var logger=require(_0xc94f('0x2'))(_0xc94f('0x3'));var moment=require(_0xc94f('0x4'));var BPromise=require(_0xc94f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc94f('0x6'));var config=require(_0xc94f('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x258cb4,_0x255508){return _0x258cb4[_0xc94f('0x8')]('SquareMessage',attributes,{'tableName':_0xc94f('0x9'),'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 46030ca..cb25ff6 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 _0x7994=['request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x196ed2,_0x53dfab){var _0x1436f0=function(_0x1a507f){while(--_0x1a507f){_0x196ed2['push'](_0x196ed2['shift']());}};_0x1436f0(++_0x53dfab);}(_0x7994,0x17e));var _0x4799=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7994[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4799('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4799('0x1'));var db=require(_0x4799('0x2'))['db'];var utils=require(_0x4799('0x3'));var logger=require(_0x4799('0x4'))(_0x4799('0x5'));var config=require(_0x4799('0x6'));var jayson=require(_0x4799('0x7'));var client=jayson[_0x4799('0x8')][_0x4799('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c50e5,_0x5c7925,_0x863ec6){return new BPromise(function(_0x238715,_0x52fbd4){return client[_0x4799('0xa')](_0x1c50e5,_0x863ec6)[_0x4799('0xb')](function(_0x2fa70d){logger['info'](_0x4799('0xc'),_0x5c7925,_0x4799('0xd'));logger[_0x4799('0xe')](_0x4799('0xf'),_0x5c7925,'request\x20sent',JSON['stringify'](_0x2fa70d));if(_0x2fa70d[_0x4799('0x10')]){if(_0x2fa70d['error'][_0x4799('0x11')]===0x1f4){logger[_0x4799('0x10')](_0x4799('0xc'),_0x5c7925,_0x2fa70d[_0x4799('0x10')][_0x4799('0x12')]);return _0x52fbd4(_0x2fa70d[_0x4799('0x10')][_0x4799('0x12')]);}logger['error'](_0x4799('0xc'),_0x5c7925,_0x2fa70d['error'][_0x4799('0x12')]);return _0x238715(_0x2fa70d[_0x4799('0x10')][_0x4799('0x12')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x5c7925,_0x4799('0xd'));_0x238715(_0x2fa70d[_0x4799('0x13')][_0x4799('0x12')]);}})[_0x4799('0x14')](function(_0xebc8b8){logger[_0x4799('0x10')](_0x4799('0xc'),_0x5c7925,_0xebc8b8);_0x52fbd4(_0xebc8b8);});});}exports[_0x4799('0x15')]=function(_0xc61e11){var _0x403476=this;return new Promise(function(_0x48d5b8,_0xbf91ac){return db[_0x4799('0x16')][_0x4799('0x17')](_0xc61e11[_0x4799('0x18')],{'raw':_0xc61e11[_0x4799('0x19')]?_0xc61e11[_0x4799('0x19')][_0x4799('0x1a')]===undefined?!![]:![]:!![]})[_0x4799('0xb')](function(_0x3c1125){logger['info'](_0x4799('0x15'),_0xc61e11);logger['debug'](_0x4799('0x15'),_0xc61e11,JSON[_0x4799('0x1b')](_0x3c1125));_0x48d5b8(_0x3c1125);})[_0x4799('0x14')](function(_0xb916ff){logger['error'](_0x4799('0x15'),_0xb916ff[_0x4799('0x12')],_0xc61e11);_0xbf91ac(_0x403476[_0x4799('0x10')](0x1f4,_0xb916ff[_0x4799('0x12')]));});});}; \ No newline at end of file +var _0x5550=['options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage'];(function(_0x5f0d42,_0x2cfae7){var _0x2fbbb4=function(_0x3fe4be){while(--_0x3fe4be){_0x5f0d42['push'](_0x5f0d42['shift']());}};_0x2fbbb4(++_0x2cfae7);}(_0x5550,0x91));var _0x0555=function(_0x3e2053,_0x278f2b){_0x3e2053=_0x3e2053-0x0;var _0x2491c7=_0x5550[_0x3e2053];return _0x2491c7;};'use strict';var _=require(_0x0555('0x0'));var util=require(_0x0555('0x1'));var moment=require('moment');var BPromise=require(_0x0555('0x2'));var rs=require(_0x0555('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0555('0x4'))['db'];var utils=require(_0x0555('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0555('0x6'));var jayson=require(_0x0555('0x7'));var client=jayson[_0x0555('0x8')][_0x0555('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d660,_0x19eeb3,_0x58c369){return new BPromise(function(_0x25cee6,_0x506df9){return client[_0x0555('0xa')](_0x31d660,_0x58c369)[_0x0555('0xb')](function(_0x3d26d5){logger[_0x0555('0xc')]('SquareMessage,\x20%s,\x20%s',_0x19eeb3,_0x0555('0xd'));logger[_0x0555('0xe')](_0x0555('0xf'),_0x19eeb3,_0x0555('0xd'),JSON['stringify'](_0x3d26d5));if(_0x3d26d5[_0x0555('0x10')]){if(_0x3d26d5[_0x0555('0x10')][_0x0555('0x11')]===0x1f4){logger['error'](_0x0555('0x12'),_0x19eeb3,_0x3d26d5[_0x0555('0x10')]['message']);return _0x506df9(_0x3d26d5[_0x0555('0x10')][_0x0555('0x13')]);}logger[_0x0555('0x10')](_0x0555('0x12'),_0x19eeb3,_0x3d26d5[_0x0555('0x10')]['message']);return _0x25cee6(_0x3d26d5['error'][_0x0555('0x13')]);}else{logger['info'](_0x0555('0x12'),_0x19eeb3,'request\x20sent');_0x25cee6(_0x3d26d5[_0x0555('0x14')][_0x0555('0x13')]);}})[_0x0555('0x15')](function(_0x1b79bc){logger[_0x0555('0x10')](_0x0555('0x12'),_0x19eeb3,_0x1b79bc);_0x506df9(_0x1b79bc);});});}exports[_0x0555('0x16')]=function(_0x426a86){var _0x3d3878=this;return new Promise(function(_0x177b85,_0x22a23f){return db['SquareMessage']['create'](_0x426a86['body'],{'raw':_0x426a86[_0x0555('0x17')]?_0x426a86['options']['raw']===undefined?!![]:![]:!![]})[_0x0555('0xb')](function(_0x3528f7){logger[_0x0555('0xc')]('CreateSquareMessage',_0x426a86);logger['debug'](_0x0555('0x16'),_0x426a86,JSON['stringify'](_0x3528f7));_0x177b85(_0x3528f7);})[_0x0555('0x15')](function(_0x57e54a){logger[_0x0555('0x10')]('CreateSquareMessage',_0x57e54a[_0x0555('0x13')],_0x426a86);_0x22a23f(_0x3d3878[_0x0555('0x10')](0x1f4,_0x57e54a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 17a1041..21094d7 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 _0x473d=['index','/:id','isAuthenticated','/:id/test','post','create','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get'];(function(_0x3155ab,_0x40fb97){var _0xbbf655=function(_0x4d93ad){while(--_0x4d93ad){_0x3155ab['push'](_0x3155ab['shift']());}};_0xbbf655(++_0x40fb97);}(_0x473d,0x14e));var _0xd473=function(_0x3ef265,_0x2055d6){_0x3ef265=_0x3ef265-0x0;var _0x123f08=_0x473d[_0x3ef265];return _0x123f08;};'use strict';var multer=require(_0xd473('0x0'));var util=require(_0xd473('0x1'));var path=require(_0xd473('0x2'));var timeout=require('connect-timeout');var express=require(_0xd473('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd473('0x4'));var interaction=require(_0xd473('0x5'));var config=require('../../config/environment');var controller=require(_0xd473('0x6'));router[_0xd473('0x7')]('/',auth['isAuthenticated'](),controller[_0xd473('0x8')]);router[_0xd473('0x7')](_0xd473('0x9'),auth[_0xd473('0xa')](),controller['show']);router[_0xd473('0x7')](_0xd473('0xb'),auth[_0xd473('0xa')](),timeout('15s'),controller['test']);router[_0xd473('0xc')]('/',auth['isAuthenticated'](),controller[_0xd473('0xd')]);router['put'](_0xd473('0x9'),auth[_0xd473('0xa')](),controller[_0xd473('0xe')]);router[_0xd473('0xf')](_0xd473('0x9'),auth['isAuthenticated'](),controller[_0xd473('0x10')]);module[_0xd473('0x11')]=router; \ No newline at end of file +var _0x9abb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','test','post','create','update','delete','destroy','multer','util','path'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9abb,0x1e0));var _0xb9ab=function(_0x2ba62c,_0x1e443a){_0x2ba62c=_0x2ba62c-0x0;var _0x153ab5=_0x9abb[_0x2ba62c];return _0x153ab5;};'use strict';var multer=require(_0xb9ab('0x0'));var util=require(_0xb9ab('0x1'));var path=require(_0xb9ab('0x2'));var timeout=require('connect-timeout');var express=require(_0xb9ab('0x3'));var router=express[_0xb9ab('0x4')]();var fs_extra=require(_0xb9ab('0x5'));var auth=require(_0xb9ab('0x6'));var interaction=require(_0xb9ab('0x7'));var config=require(_0xb9ab('0x8'));var controller=require(_0xb9ab('0x9'));router[_0xb9ab('0xa')]('/',auth[_0xb9ab('0xb')](),controller['index']);router[_0xb9ab('0xa')](_0xb9ab('0xc'),auth[_0xb9ab('0xb')](),controller[_0xb9ab('0xd')]);router[_0xb9ab('0xa')](_0xb9ab('0xe'),auth[_0xb9ab('0xb')](),timeout('15s'),controller[_0xb9ab('0xf')]);router[_0xb9ab('0x10')]('/',auth['isAuthenticated'](),controller[_0xb9ab('0x11')]);router['put'](_0xb9ab('0xc'),auth[_0xb9ab('0xb')](),controller[_0xb9ab('0x12')]);router[_0xb9ab('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb9ab('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2d516ce..1fae2b9 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 _0x4890=['sequelize','exports','name','STRING'];(function(_0x49b2da,_0x4f2f86){var _0xed2fa4=function(_0x45ed2d){while(--_0x45ed2d){_0x49b2da['push'](_0x49b2da['shift']());}};_0xed2fa4(++_0x4f2f86);}(_0x4890,0xc8));var _0x0489=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x4890[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require(_0x0489('0x0'));module[_0x0489('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0489('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0489('0x3')]},'description':{'type':Sequelize[_0x0489('0x3')]}}; \ No newline at end of file +var _0x2494=['STRING','sequelize','exports','name'];(function(_0x19c64a,_0x5de14e){var _0x1b1a06=function(_0x5dd104){while(--_0x5dd104){_0x19c64a['push'](_0x19c64a['shift']());}};_0x1b1a06(++_0x5de14e);}(_0x2494,0x81));var _0x4249=function(_0x4a1856,_0x7a7551){_0x4a1856=_0x4a1856-0x0;var _0x3aba72=_0x2494[_0x4a1856];return _0x3aba72;};'use strict';var Sequelize=require(_0x4249('0x0'));module[_0x4249('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4249('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4249('0x3')]},'description':{'type':Sequelize[_0x4249('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 50eef31..9d75f46 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 _0xd408=['set','apply','save','update','then','get','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','merge','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','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd408,0x8b));var _0x8d40=function(_0x22bfea,_0x3db3e9){_0x22bfea=_0x22bfea-0x0;var _0x8f3537=_0xd408[_0x22bfea];return _0x8f3537;};'use strict';var emlformat=require(_0x8d40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d40('0x1'));var jsonpatch=require(_0x8d40('0x2'));var rp=require(_0x8d40('0x3'));var moment=require(_0x8d40('0x4'));var BPromise=require(_0x8d40('0x5'));var Mustache=require('mustache');var util=require(_0x8d40('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8d40('0x7'));var ejs=require(_0x8d40('0x8'));var fs=require('fs');var fs_extra=require(_0x8d40('0x9'));var _=require(_0x8d40('0xa'));var squel=require(_0x8d40('0xb'));var crypto=require(_0x8d40('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8d40('0xd'));var toCsv=require(_0x8d40('0x7'));var querystring=require('querystring');var Papa=require(_0x8d40('0xe'));var Redis=require('ioredis');var authService=require(_0x8d40('0xf'));var qs=require(_0x8d40('0x10'));var as=require(_0x8d40('0x11'));var hardwareService=require(_0x8d40('0x12'));var logger=require(_0x8d40('0x13'))(_0x8d40('0x14'));var utils=require(_0x8d40('0x15'));var config=require(_0x8d40('0x16'));var licenseUtil=require(_0x8d40('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x396399,_0x272d0d){_0x272d0d=_0x272d0d||0xcc;return function(_0x589980){if(_0x589980){return _0x396399[_0x8d40('0x18')](_0x272d0d);}return _0x396399['status'](_0x272d0d)[_0x8d40('0x19')]();};}function respondWithResult(_0x204a95,_0x51e97f){_0x51e97f=_0x51e97f||0xc8;return function(_0x53e354){if(_0x53e354){return _0x204a95[_0x8d40('0x1a')](_0x51e97f)['json'](_0x53e354);}};}function respondWithFilteredResult(_0x24358e,_0x13a346){return function(_0x2dd71f){if(_0x2dd71f){var _0xb2b72d=typeof _0x13a346['offset']===_0x8d40('0x1b')&&typeof _0x13a346[_0x8d40('0x1c')]===_0x8d40('0x1b');var _0x2bcfd0=_0x2dd71f[_0x8d40('0x1d')];var _0xe73f00=_0xb2b72d?0x0:_0x13a346[_0x8d40('0x1e')];var _0x3991f4=_0xb2b72d?_0x2dd71f[_0x8d40('0x1d')]:_0x13a346[_0x8d40('0x1e')]+_0x13a346[_0x8d40('0x1c')];var _0x18b1b7;if(_0x3991f4>=_0x2bcfd0){_0x3991f4=_0x2bcfd0;_0x18b1b7=0xc8;}else{_0x18b1b7=0xce;}_0x24358e[_0x8d40('0x1a')](_0x18b1b7);return _0x24358e[_0x8d40('0x1f')]('Content-Range',_0xe73f00+'-'+_0x3991f4+'/'+_0x2bcfd0)['json'](_0x2dd71f);}return null;};}function patchUpdates(_0x36fea3){return function(_0xfb42a6){try{jsonpatch[_0x8d40('0x20')](_0xfb42a6,_0x36fea3,!![]);}catch(_0x339018){return BPromise['reject'](_0x339018);}return _0xfb42a6[_0x8d40('0x21')]();};}function saveUpdates(_0x274841,_0x3ca7cd){return function(_0x2bc11f){if(_0x2bc11f){return _0x2bc11f[_0x8d40('0x22')](_0x274841)['then'](function(_0x5dea9a){return _0x5dea9a;});}return null;};}function removeEntity(_0x234dd2,_0x56435c){return function(_0x326c68){if(_0x326c68){return _0x326c68['destroy']()[_0x8d40('0x23')](function(){var _0x38aceb=_0x326c68[_0x8d40('0x24')]({'plain':!![]});var _0x5eb914=_0x8d40('0x25');return db[_0x8d40('0x26')]['destroy']({'where':{'type':_0x5eb914,'resourceId':_0x38aceb['id']}})[_0x8d40('0x23')](function(){return _0x326c68;});})[_0x8d40('0x23')](function(){_0x234dd2[_0x8d40('0x1a')](0xcc)[_0x8d40('0x19')]();});}};}function handleEntityNotFound(_0x454f60,_0x412d67){return function(_0x4c0f1d){if(!_0x4c0f1d){_0x454f60[_0x8d40('0x18')](0x194);}return _0x4c0f1d;};}function handleError(_0x3238e9,_0x54ba1a){_0x54ba1a=_0x54ba1a||0x1f4;return function(_0xe45c94){logger[_0x8d40('0x27')](_0xe45c94[_0x8d40('0x28')]);if(_0xe45c94[_0x8d40('0x29')]){delete _0xe45c94[_0x8d40('0x29')];}_0x3238e9[_0x8d40('0x1a')](_0x54ba1a)['send'](_0xe45c94);};}exports[_0x8d40('0x2a')]=function(_0x2747e9,_0x33fcb9){var _0x30d185={},_0x3bb176={},_0x5029d4={'count':0x0,'rows':[]};var _0x4f5c50=_[_0x8d40('0x2b')](db[_0x8d40('0x2c')][_0x8d40('0x2d')],function(_0x2cd5bb){return{'name':_0x2cd5bb[_0x8d40('0x2e')],'type':_0x2cd5bb['type'][_0x8d40('0x2f')]};});_0x3bb176['model']=_[_0x8d40('0x2b')](_0x4f5c50,'name');_0x3bb176[_0x8d40('0x30')]=_['keys'](_0x2747e9[_0x8d40('0x30')]);_0x3bb176[_0x8d40('0x31')]=_[_0x8d40('0x32')](_0x3bb176['model'],_0x3bb176[_0x8d40('0x30')]);_0x30d185[_0x8d40('0x33')]=_[_0x8d40('0x32')](_0x3bb176[_0x8d40('0x34')],qs[_0x8d40('0x35')](_0x2747e9[_0x8d40('0x30')]['fields']));_0x30d185['attributes']=_0x30d185[_0x8d40('0x33')][_0x8d40('0x36')]?_0x30d185[_0x8d40('0x33')]:_0x3bb176['model'];if(!_0x2747e9[_0x8d40('0x30')]['hasOwnProperty'](_0x8d40('0x37'))){_0x30d185[_0x8d40('0x1c')]=qs[_0x8d40('0x1c')](_0x2747e9['query']['limit']);_0x30d185['offset']=qs[_0x8d40('0x1e')](_0x2747e9['query'][_0x8d40('0x1e')]);}_0x30d185[_0x8d40('0x38')]=qs[_0x8d40('0x39')](_0x2747e9[_0x8d40('0x30')][_0x8d40('0x39')]);_0x30d185[_0x8d40('0x3a')]=qs[_0x8d40('0x31')](_['pick'](_0x2747e9[_0x8d40('0x30')],_0x3bb176[_0x8d40('0x31')]),_0x4f5c50);if(_0x2747e9[_0x8d40('0x30')][_0x8d40('0x3b')]){_0x30d185['where']=_['merge'](_0x30d185[_0x8d40('0x3a')],{'$or':_[_0x8d40('0x2b')](_0x4f5c50,function(_0x3334be){if(_0x3334be[_0x8d40('0x3c')]!==_0x8d40('0x3d')){var _0x3c33a6={};_0x3c33a6[_0x3334be[_0x8d40('0x29')]]={'$like':'%'+_0x2747e9[_0x8d40('0x30')][_0x8d40('0x3b')]+'%'};return _0x3c33a6;}})});}_0x30d185=_['merge']({},_0x30d185,_0x2747e9[_0x8d40('0x3e')]);var _0x36aa60={'where':_0x30d185[_0x8d40('0x3a')]};return db[_0x8d40('0x2c')][_0x8d40('0x1d')](_0x36aa60)[_0x8d40('0x23')](function(_0x2ea82c){_0x5029d4[_0x8d40('0x1d')]=_0x2ea82c;if(_0x2747e9[_0x8d40('0x30')][_0x8d40('0x3f')]){_0x30d185[_0x8d40('0x40')]=[{'all':!![]}];}return db[_0x8d40('0x2c')][_0x8d40('0x41')](_0x30d185);})['then'](function(_0x142901){_0x5029d4[_0x8d40('0x42')]=_0x142901;return _0x5029d4;})['then'](respondWithFilteredResult(_0x33fcb9,_0x30d185))[_0x8d40('0x43')](handleError(_0x33fcb9,null));};exports['show']=function(_0x2c1092,_0x37378d){var _0x29cd63={'raw':!![],'where':{'id':_0x2c1092['params']['id']}},_0x4af32e={};_0x4af32e[_0x8d40('0x34')]=_['keys'](db[_0x8d40('0x2c')]['rawAttributes']);_0x4af32e[_0x8d40('0x30')]=_[_0x8d40('0x44')](_0x2c1092[_0x8d40('0x30')]);_0x4af32e[_0x8d40('0x31')]=_[_0x8d40('0x32')](_0x4af32e[_0x8d40('0x34')],_0x4af32e[_0x8d40('0x30')]);_0x29cd63[_0x8d40('0x33')]=_['intersection'](_0x4af32e[_0x8d40('0x34')],qs[_0x8d40('0x35')](_0x2c1092['query'][_0x8d40('0x35')]));_0x29cd63['attributes']=_0x29cd63[_0x8d40('0x33')][_0x8d40('0x36')]?_0x29cd63[_0x8d40('0x33')]:_0x4af32e['model'];if(_0x2c1092[_0x8d40('0x30')][_0x8d40('0x3f')]){_0x29cd63[_0x8d40('0x40')]=[{'all':!![]}];}_0x29cd63=_[_0x8d40('0x45')]({},_0x29cd63,_0x2c1092['options']);return db[_0x8d40('0x2c')][_0x8d40('0x46')](_0x29cd63)[_0x8d40('0x23')](handleEntityNotFound(_0x37378d,null))[_0x8d40('0x23')](respondWithResult(_0x37378d,null))[_0x8d40('0x43')](handleError(_0x37378d,null));};exports[_0x8d40('0x47')]=function(_0x448e1d,_0x28f7ec){return db[_0x8d40('0x2c')]['create'](_0x448e1d[_0x8d40('0x48')],{})[_0x8d40('0x23')](function(_0xe8e962){var _0x30060a=_0x448e1d[_0x8d40('0x49')]['get']({'plain':!![]});if(!_0x30060a)throw new Error(_0x8d40('0x4a'));if(_0x30060a['role']===_0x8d40('0x49')){var _0x365a1c=_0xe8e962[_0x8d40('0x24')]({'plain':!![]});var _0x4f85a9='ODBC';return db[_0x8d40('0x4b')][_0x8d40('0x46')]({'where':{'name':_0x4f85a9,'userProfileId':_0x30060a[_0x8d40('0x4c')]},'raw':!![]})[_0x8d40('0x23')](function(_0x378b1b){if(_0x378b1b&&_0x378b1b[_0x8d40('0x4d')]===0x0){return db[_0x8d40('0x26')][_0x8d40('0x47')]({'name':_0x365a1c['name'],'resourceId':_0x365a1c['id'],'type':_0x378b1b[_0x8d40('0x29')],'sectionId':_0x378b1b['id']},{})[_0x8d40('0x23')](function(){return _0xe8e962;});}else{return _0xe8e962;}})[_0x8d40('0x43')](function(_0x2b33d0){logger[_0x8d40('0x27')](_0x8d40('0x4e'),_0x2b33d0);throw _0x2b33d0;});}return _0xe8e962;})[_0x8d40('0x23')](respondWithResult(_0x28f7ec,0xc9))['catch'](handleError(_0x28f7ec,null));};exports[_0x8d40('0x22')]=function(_0x5a7d1e,_0x9129b7){if(_0x5a7d1e[_0x8d40('0x48')]['id']){delete _0x5a7d1e[_0x8d40('0x48')]['id'];}return db[_0x8d40('0x2c')][_0x8d40('0x46')]({'where':{'id':_0x5a7d1e['params']['id']}})['then'](handleEntityNotFound(_0x9129b7,null))[_0x8d40('0x23')](saveUpdates(_0x5a7d1e[_0x8d40('0x48')],null))['then'](respondWithResult(_0x9129b7,null))[_0x8d40('0x43')](handleError(_0x9129b7,null));};exports['destroy']=function(_0x1c780a,_0xa4b237){return db[_0x8d40('0x2c')][_0x8d40('0x46')]({'where':{'id':_0x1c780a[_0x8d40('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa4b237,null))[_0x8d40('0x23')](removeEntity(_0xa4b237,null))['catch'](handleError(_0xa4b237,null));};exports[_0x8d40('0x50')]=function(_0x3435c2,_0x409744,_0x65e8ed){var _0x504a38;return db[_0x8d40('0x2c')][_0x8d40('0x46')]({'where':{'id':_0x3435c2['params']['id']},'attributes':['id',_0x8d40('0x51')]})['then'](handleEntityNotFound(_0x409744,null))[_0x8d40('0x23')](function(_0x30bd4e){if(_0x30bd4e){var _0x1a5969=require(_0x8d40('0x52'))();_0x1a5969[_0x8d40('0x53')](_0x30bd4e['dsn']);_0x1a5969[_0x8d40('0x54')]();return _0x30bd4e;}})[_0x8d40('0x23')](respondWithResult(_0x409744,null))[_0x8d40('0x43')](handleError(_0x409744,null));}; \ No newline at end of file +var _0xc36a=['include','rows','catch','show','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','update','body','dsn','odbc','closeSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','get','ODBC','end','sendStatus','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','SquareOdbc','includeAll'];(function(_0x183ac6,_0x116612){var _0xd88667=function(_0x3528ab){while(--_0x3528ab){_0x183ac6['push'](_0x183ac6['shift']());}};_0xd88667(++_0x116612);}(_0xc36a,0x163));var _0xac36=function(_0x3d7500,_0x4a6784){_0x3d7500=_0x3d7500-0x0;var _0x26f5bc=_0xc36a[_0x3d7500];return _0x26f5bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac36('0x0'));var zipdir=require(_0xac36('0x1'));var jsonpatch=require(_0xac36('0x2'));var rp=require('request-promise');var moment=require(_0xac36('0x3'));var BPromise=require(_0xac36('0x4'));var Mustache=require(_0xac36('0x5'));var util=require(_0xac36('0x6'));var path=require('path');var sox=require(_0xac36('0x7'));var csv=require(_0xac36('0x8'));var ejs=require(_0xac36('0x9'));var fs=require('fs');var fs_extra=require(_0xac36('0xa'));var _=require('lodash');var squel=require(_0xac36('0xb'));var crypto=require(_0xac36('0xc'));var jsforce=require(_0xac36('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xac36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac36('0xf'));var as=require(_0xac36('0x10'));var hardwareService=require(_0xac36('0x11'));var logger=require(_0xac36('0x12'))(_0xac36('0x13'));var utils=require(_0xac36('0x14'));var config=require(_0xac36('0x15'));var licenseUtil=require(_0xac36('0x16'));var db=require(_0xac36('0x17'))['db'];function respondWithStatusCode(_0x26b22d,_0xda68bb){_0xda68bb=_0xda68bb||0xcc;return function(_0x29c947){if(_0x29c947){return _0x26b22d['sendStatus'](_0xda68bb);}return _0x26b22d[_0xac36('0x18')](_0xda68bb)['end']();};}function respondWithResult(_0x1b14db,_0x54963b){_0x54963b=_0x54963b||0xc8;return function(_0x12d98e){if(_0x12d98e){return _0x1b14db[_0xac36('0x18')](_0x54963b)[_0xac36('0x19')](_0x12d98e);}};}function respondWithFilteredResult(_0x5d6bfe,_0x384864){return function(_0x37ef20){if(_0x37ef20){var _0x220ef7=typeof _0x384864[_0xac36('0x1a')]===_0xac36('0x1b')&&typeof _0x384864['limit']==='undefined';var _0x249d96=_0x37ef20[_0xac36('0x1c')];var _0x72a008=_0x220ef7?0x0:_0x384864[_0xac36('0x1a')];var _0x273b02=_0x220ef7?_0x37ef20['count']:_0x384864[_0xac36('0x1a')]+_0x384864[_0xac36('0x1d')];var _0x4bc7a8;if(_0x273b02>=_0x249d96){_0x273b02=_0x249d96;_0x4bc7a8=0xc8;}else{_0x4bc7a8=0xce;}_0x5d6bfe['status'](_0x4bc7a8);return _0x5d6bfe['set'](_0xac36('0x1e'),_0x72a008+'-'+_0x273b02+'/'+_0x249d96)[_0xac36('0x19')](_0x37ef20);}return null;};}function patchUpdates(_0xa03b18){return function(_0x2b7044){try{jsonpatch['apply'](_0x2b7044,_0xa03b18,!![]);}catch(_0x4b922d){return BPromise[_0xac36('0x1f')](_0x4b922d);}return _0x2b7044[_0xac36('0x20')]();};}function saveUpdates(_0x2abb2c,_0x2bcf98){return function(_0x3701ec){if(_0x3701ec){return _0x3701ec['update'](_0x2abb2c)[_0xac36('0x21')](function(_0x473645){return _0x473645;});}return null;};}function removeEntity(_0x280af5,_0x2982f9){return function(_0x956c7a){if(_0x956c7a){return _0x956c7a[_0xac36('0x22')]()[_0xac36('0x21')](function(){var _0x3508e3=_0x956c7a[_0xac36('0x23')]({'plain':!![]});var _0x9275a=_0xac36('0x24');return db['UserProfileResource'][_0xac36('0x22')]({'where':{'type':_0x9275a,'resourceId':_0x3508e3['id']}})[_0xac36('0x21')](function(){return _0x956c7a;});})[_0xac36('0x21')](function(){_0x280af5[_0xac36('0x18')](0xcc)[_0xac36('0x25')]();});}};}function handleEntityNotFound(_0x140d9b,_0x2bcd77){return function(_0x183062){if(!_0x183062){_0x140d9b[_0xac36('0x26')](0x194);}return _0x183062;};}function handleError(_0x3fb34b,_0x1d9e42){_0x1d9e42=_0x1d9e42||0x1f4;return function(_0x2b9e24){logger[_0xac36('0x27')](_0x2b9e24[_0xac36('0x28')]);if(_0x2b9e24[_0xac36('0x29')]){delete _0x2b9e24['name'];}_0x3fb34b[_0xac36('0x18')](_0x1d9e42)['send'](_0x2b9e24);};}exports[_0xac36('0x2a')]=function(_0xa13365,_0xace25d){var _0x1c6863={},_0x2d875c={},_0x1c0ffb={'count':0x0,'rows':[]};var _0x394395=_[_0xac36('0x2b')](db['SquareOdbc']['rawAttributes'],function(_0x54ce8a){return{'name':_0x54ce8a[_0xac36('0x2c')],'type':_0x54ce8a[_0xac36('0x2d')][_0xac36('0x2e')]};});_0x2d875c[_0xac36('0x2f')]=_[_0xac36('0x2b')](_0x394395,_0xac36('0x29'));_0x2d875c[_0xac36('0x30')]=_[_0xac36('0x31')](_0xa13365['query']);_0x2d875c[_0xac36('0x32')]=_[_0xac36('0x33')](_0x2d875c[_0xac36('0x2f')],_0x2d875c['query']);_0x1c6863[_0xac36('0x34')]=_['intersection'](_0x2d875c['model'],qs[_0xac36('0x35')](_0xa13365[_0xac36('0x30')][_0xac36('0x35')]));_0x1c6863[_0xac36('0x34')]=_0x1c6863[_0xac36('0x34')]['length']?_0x1c6863['attributes']:_0x2d875c['model'];if(!_0xa13365['query'][_0xac36('0x36')](_0xac36('0x37'))){_0x1c6863['limit']=qs['limit'](_0xa13365[_0xac36('0x30')][_0xac36('0x1d')]);_0x1c6863['offset']=qs[_0xac36('0x1a')](_0xa13365[_0xac36('0x30')][_0xac36('0x1a')]);}_0x1c6863[_0xac36('0x38')]=qs[_0xac36('0x39')](_0xa13365[_0xac36('0x30')][_0xac36('0x39')]);_0x1c6863['where']=qs[_0xac36('0x32')](_[_0xac36('0x3a')](_0xa13365[_0xac36('0x30')],_0x2d875c[_0xac36('0x32')]),_0x394395);if(_0xa13365['query']['filter']){_0x1c6863[_0xac36('0x3b')]=_[_0xac36('0x3c')](_0x1c6863[_0xac36('0x3b')],{'$or':_[_0xac36('0x2b')](_0x394395,function(_0x4fb5cc){if(_0x4fb5cc[_0xac36('0x2d')]!==_0xac36('0x3d')){var _0x40e49d={};_0x40e49d[_0x4fb5cc[_0xac36('0x29')]]={'$like':'%'+_0xa13365[_0xac36('0x30')]['filter']+'%'};return _0x40e49d;}})});}_0x1c6863=_[_0xac36('0x3c')]({},_0x1c6863,_0xa13365[_0xac36('0x3e')]);var _0x133579={'where':_0x1c6863[_0xac36('0x3b')]};return db[_0xac36('0x3f')][_0xac36('0x1c')](_0x133579)[_0xac36('0x21')](function(_0x39caed){_0x1c0ffb[_0xac36('0x1c')]=_0x39caed;if(_0xa13365[_0xac36('0x30')][_0xac36('0x40')]){_0x1c6863[_0xac36('0x41')]=[{'all':!![]}];}return db[_0xac36('0x3f')]['findAll'](_0x1c6863);})['then'](function(_0x39f99d){_0x1c0ffb[_0xac36('0x42')]=_0x39f99d;return _0x1c0ffb;})[_0xac36('0x21')](respondWithFilteredResult(_0xace25d,_0x1c6863))[_0xac36('0x43')](handleError(_0xace25d,null));};exports[_0xac36('0x44')]=function(_0x207387,_0x180814){var _0x5ac7ad={'raw':!![],'where':{'id':_0x207387[_0xac36('0x45')]['id']}},_0x46983d={};_0x46983d[_0xac36('0x2f')]=_['keys'](db[_0xac36('0x3f')][_0xac36('0x46')]);_0x46983d['query']=_[_0xac36('0x31')](_0x207387[_0xac36('0x30')]);_0x46983d[_0xac36('0x32')]=_[_0xac36('0x33')](_0x46983d['model'],_0x46983d[_0xac36('0x30')]);_0x5ac7ad[_0xac36('0x34')]=_[_0xac36('0x33')](_0x46983d[_0xac36('0x2f')],qs[_0xac36('0x35')](_0x207387[_0xac36('0x30')][_0xac36('0x35')]));_0x5ac7ad[_0xac36('0x34')]=_0x5ac7ad[_0xac36('0x34')][_0xac36('0x47')]?_0x5ac7ad[_0xac36('0x34')]:_0x46983d[_0xac36('0x2f')];if(_0x207387[_0xac36('0x30')][_0xac36('0x40')]){_0x5ac7ad['include']=[{'all':!![]}];}_0x5ac7ad=_[_0xac36('0x3c')]({},_0x5ac7ad,_0x207387[_0xac36('0x3e')]);return db['SquareOdbc'][_0xac36('0x48')](_0x5ac7ad)[_0xac36('0x21')](handleEntityNotFound(_0x180814,null))[_0xac36('0x21')](respondWithResult(_0x180814,null))[_0xac36('0x43')](handleError(_0x180814,null));};exports[_0xac36('0x49')]=function(_0x53b26c,_0x50415c){return db['SquareOdbc'][_0xac36('0x49')](_0x53b26c['body'],{})['then'](function(_0xf716){var _0x5251fc=_0x53b26c[_0xac36('0x4a')][_0xac36('0x23')]({'plain':!![]});if(!_0x5251fc)throw new Error(_0xac36('0x4b'));if(_0x5251fc['role']===_0xac36('0x4a')){var _0x306b0c=_0xf716[_0xac36('0x23')]({'plain':!![]});var _0x5c789f=_0xac36('0x24');return db[_0xac36('0x4c')][_0xac36('0x48')]({'where':{'name':_0x5c789f,'userProfileId':_0x5251fc['userProfileId']},'raw':!![]})[_0xac36('0x21')](function(_0x34e69b){if(_0x34e69b&&_0x34e69b[_0xac36('0x4d')]===0x0){return db[_0xac36('0x4e')][_0xac36('0x49')]({'name':_0x306b0c[_0xac36('0x29')],'resourceId':_0x306b0c['id'],'type':_0x34e69b['name'],'sectionId':_0x34e69b['id']},{})[_0xac36('0x21')](function(){return _0xf716;});}else{return _0xf716;}})[_0xac36('0x43')](function(_0xd29be4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd29be4);throw _0xd29be4;});}return _0xf716;})[_0xac36('0x21')](respondWithResult(_0x50415c,0xc9))['catch'](handleError(_0x50415c,null));};exports[_0xac36('0x4f')]=function(_0x12d8ea,_0x263a2a){if(_0x12d8ea[_0xac36('0x50')]['id']){delete _0x12d8ea[_0xac36('0x50')]['id'];}return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0x12d8ea['params']['id']}})[_0xac36('0x21')](handleEntityNotFound(_0x263a2a,null))[_0xac36('0x21')](saveUpdates(_0x12d8ea['body'],null))[_0xac36('0x21')](respondWithResult(_0x263a2a,null))['catch'](handleError(_0x263a2a,null));};exports[_0xac36('0x22')]=function(_0x13d537,_0x430ef9){return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0x13d537[_0xac36('0x45')]['id']}})[_0xac36('0x21')](handleEntityNotFound(_0x430ef9,null))[_0xac36('0x21')](removeEntity(_0x430ef9,null))[_0xac36('0x43')](handleError(_0x430ef9,null));};exports['test']=function(_0xa1c277,_0x1b9d72,_0x2bc17c){var _0x54c5cb;return db[_0xac36('0x3f')][_0xac36('0x48')]({'where':{'id':_0xa1c277['params']['id']},'attributes':['id',_0xac36('0x51')]})[_0xac36('0x21')](handleEntityNotFound(_0x1b9d72,null))[_0xac36('0x21')](function(_0x4c6506){if(_0x4c6506){var _0x29b83e=require(_0xac36('0x52'))();_0x29b83e['openSync'](_0x4c6506[_0xac36('0x51')]);_0x29b83e[_0xac36('0x53')]();return _0x4c6506;}})[_0xac36('0x21')](respondWithResult(_0x1b9d72,null))[_0xac36('0x43')](handleError(_0x1b9d72,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e4f8c7c..0e0fb97 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 _0x61fb=['exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x263d85,_0x290985){var _0x2fb303=function(_0x69e935){while(--_0x69e935){_0x263d85['push'](_0x263d85['shift']());}};_0x2fb303(++_0x290985);}(_0x61fb,0x1bf));var _0xb61f=function(_0x5e61b4,_0x57ef43){_0x5e61b4=_0x5e61b4-0x0;var _0x3bf94b=_0x61fb[_0x5e61b4];return _0x3bf94b;};'use strict';var _=require(_0xb61f('0x0'));var util=require('util');var logger=require(_0xb61f('0x1'))(_0xb61f('0x2'));var moment=require(_0xb61f('0x3'));var BPromise=require(_0xb61f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb61f('0x5'));var rimraf=require(_0xb61f('0x6'));var config=require(_0xb61f('0x7'));var attributes=require(_0xb61f('0x8'));module[_0xb61f('0x9')]=function(_0x4d1606,_0x1ba4ec){return _0x4d1606['define'](_0xb61f('0xa'),attributes,{'tableName':_0xb61f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4edf=['api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x87f53b,_0x3258f0){var _0x54c266=function(_0x4d10a4){while(--_0x4d10a4){_0x87f53b['push'](_0x87f53b['shift']());}};_0x54c266(++_0x3258f0);}(_0x4edf,0xe8));var _0xf4ed=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x4edf[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var logger=require('../../config/logger')(_0xf4ed('0x2'));var moment=require(_0xf4ed('0x3'));var BPromise=require(_0xf4ed('0x4'));var rp=require(_0xf4ed('0x5'));var fs=require('fs');var path=require(_0xf4ed('0x6'));var rimraf=require('rimraf');var config=require(_0xf4ed('0x7'));var attributes=require(_0xf4ed('0x8'));module[_0xf4ed('0x9')]=function(_0x3ac930,_0x2f1844){return _0x3ac930[_0xf4ed('0xa')](_0xf4ed('0xb'),attributes,{'tableName':_0xf4ed('0xc'),'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 06bfd70..2c3a25f 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 _0xc497=['options','raw','where','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareOdbc','SquareOdbc'];(function(_0x2ca6f6,_0x1490ab){var _0x110009=function(_0x5c4486){while(--_0x5c4486){_0x2ca6f6['push'](_0x2ca6f6['shift']());}};_0x110009(++_0x1490ab);}(_0xc497,0x8c));var _0x7c49=function(_0x29c82f,_0x311014){_0x29c82f=_0x29c82f-0x0;var _0x18e1fc=_0xc497[_0x29c82f];return _0x18e1fc;};'use strict';var _=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var moment=require('moment');var BPromise=require(_0x7c49('0x2'));var rs=require(_0x7c49('0x3'));var fs=require('fs');var Redis=require(_0x7c49('0x4'));var db=require(_0x7c49('0x5'))['db'];var utils=require(_0x7c49('0x6'));var logger=require(_0x7c49('0x7'))(_0x7c49('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c49('0x9'));var client=jayson[_0x7c49('0xa')][_0x7c49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a1577,_0x193f30,_0x38b66e){return new BPromise(function(_0x6809fb,_0x4cd175){return client[_0x7c49('0xc')](_0x4a1577,_0x38b66e)[_0x7c49('0xd')](function(_0x1be47b){logger[_0x7c49('0xe')](_0x7c49('0xf'),_0x193f30,_0x7c49('0x10'));logger[_0x7c49('0x11')](_0x7c49('0x12'),_0x193f30,_0x7c49('0x10'),JSON[_0x7c49('0x13')](_0x1be47b));if(_0x1be47b[_0x7c49('0x14')]){if(_0x1be47b['error'][_0x7c49('0x15')]===0x1f4){logger[_0x7c49('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x193f30,_0x1be47b[_0x7c49('0x14')][_0x7c49('0x16')]);return _0x4cd175(_0x1be47b[_0x7c49('0x14')][_0x7c49('0x16')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x193f30,_0x1be47b[_0x7c49('0x14')][_0x7c49('0x16')]);return _0x6809fb(_0x1be47b[_0x7c49('0x14')][_0x7c49('0x16')]);}else{logger[_0x7c49('0xe')](_0x7c49('0xf'),_0x193f30,_0x7c49('0x10'));_0x6809fb(_0x1be47b['result'][_0x7c49('0x16')]);}})['catch'](function(_0x2ee4e8){logger[_0x7c49('0x14')](_0x7c49('0xf'),_0x193f30,_0x2ee4e8);_0x4cd175(_0x2ee4e8);});});}exports[_0x7c49('0x17')]=function(_0x3509a9){var _0x4d308b=this;return new Promise(function(_0x27179f,_0x2dd295){return db[_0x7c49('0x18')]['find']({'raw':_0x3509a9['options']?_0x3509a9[_0x7c49('0x19')][_0x7c49('0x1a')]===undefined?!![]:![]:!![],'where':_0x3509a9[_0x7c49('0x19')]?_0x3509a9[_0x7c49('0x19')][_0x7c49('0x1b')]||null:null,'attributes':_0x3509a9[_0x7c49('0x19')]?_0x3509a9[_0x7c49('0x19')][_0x7c49('0x1c')]||null:null,'include':_0x3509a9['options']?_0x3509a9[_0x7c49('0x19')][_0x7c49('0x1d')]?_[_0x7c49('0x1e')](_0x3509a9['options']['include'],function(_0x47aa84){return{'model':db[_0x47aa84[_0x7c49('0x1f')]],'as':_0x47aa84['as'],'attributes':_0x47aa84['attributes'],'include':_0x47aa84['include']?_[_0x7c49('0x1e')](_0x47aa84[_0x7c49('0x1d')],function(_0x22a047){return{'model':db[_0x22a047['model']],'as':_0x22a047['as'],'attributes':_0x22a047[_0x7c49('0x1c')],'include':_0x22a047[_0x7c49('0x1d')]?_[_0x7c49('0x1e')](_0x22a047[_0x7c49('0x1d')],function(_0x32f677){return{'model':db[_0x32f677[_0x7c49('0x1f')]],'as':_0x32f677['as'],'attributes':_0x32f677['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fe628){logger[_0x7c49('0xe')](_0x7c49('0x17'),_0x3509a9);logger[_0x7c49('0x11')](_0x7c49('0x17'),_0x3509a9,JSON[_0x7c49('0x13')](_0x2fe628));_0x27179f(_0x2fe628);})[_0x7c49('0x20')](function(_0x59198f){logger['error'](_0x7c49('0x17'),_0x59198f[_0x7c49('0x16')],_0x3509a9);_0x2dd295(_0x4d308b[_0x7c49('0x14')](0x1f4,_0x59198f['message']));});});}; \ No newline at end of file +var _0x8a33=['SquareOdbc','options','raw','where','attributes','include','model','map','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc'];(function(_0x160dae,_0x22c724){var _0x468a71=function(_0x35024d){while(--_0x35024d){_0x160dae['push'](_0x160dae['shift']());}};_0x468a71(++_0x22c724);}(_0x8a33,0x1c4));var _0x38a3=function(_0x43f585,_0x3f8ba8){_0x43f585=_0x43f585-0x0;var _0x399005=_0x8a33[_0x43f585];return _0x399005;};'use strict';var _=require(_0x38a3('0x0'));var util=require('util');var moment=require(_0x38a3('0x1'));var BPromise=require(_0x38a3('0x2'));var rs=require(_0x38a3('0x3'));var fs=require('fs');var Redis=require(_0x38a3('0x4'));var db=require(_0x38a3('0x5'))['db'];var utils=require(_0x38a3('0x6'));var logger=require(_0x38a3('0x7'))(_0x38a3('0x8'));var config=require(_0x38a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38a3('0xa')][_0x38a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31fbef,_0x1de806,_0xb96d79){return new BPromise(function(_0x152ac4,_0x324bca){return client[_0x38a3('0xc')](_0x31fbef,_0xb96d79)[_0x38a3('0xd')](function(_0x2aad2a){logger['info'](_0x38a3('0xe'),_0x1de806,_0x38a3('0xf'));logger[_0x38a3('0x10')](_0x38a3('0x11'),_0x1de806,'request\x20sent',JSON['stringify'](_0x2aad2a));if(_0x2aad2a['error']){if(_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x13')]===0x1f4){logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);return _0x324bca(_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);}logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x2aad2a[_0x38a3('0x12')][_0x38a3('0x14')]);return _0x152ac4(_0x2aad2a['error'][_0x38a3('0x14')]);}else{logger['info'](_0x38a3('0xe'),_0x1de806,_0x38a3('0xf'));_0x152ac4(_0x2aad2a[_0x38a3('0x15')][_0x38a3('0x14')]);}})[_0x38a3('0x16')](function(_0x5b4179){logger[_0x38a3('0x12')](_0x38a3('0xe'),_0x1de806,_0x5b4179);_0x324bca(_0x5b4179);});});}exports[_0x38a3('0x17')]=function(_0x34d5aa){var _0x1845d8=this;return new Promise(function(_0x3eb41d,_0x5b49bb){return db[_0x38a3('0x18')]['find']({'raw':_0x34d5aa[_0x38a3('0x19')]?_0x34d5aa['options'][_0x38a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x34d5aa['options']?_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1b')]||null:null,'attributes':_0x34d5aa[_0x38a3('0x19')]?_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1c')]||null:null,'include':_0x34d5aa['options']?_0x34d5aa['options']['include']?_['map'](_0x34d5aa[_0x38a3('0x19')][_0x38a3('0x1d')],function(_0x13b687){return{'model':db[_0x13b687[_0x38a3('0x1e')]],'as':_0x13b687['as'],'attributes':_0x13b687[_0x38a3('0x1c')],'include':_0x13b687[_0x38a3('0x1d')]?_[_0x38a3('0x1f')](_0x13b687['include'],function(_0x15c28e){return{'model':db[_0x15c28e['model']],'as':_0x15c28e['as'],'attributes':_0x15c28e[_0x38a3('0x1c')],'include':_0x15c28e['include']?_[_0x38a3('0x1f')](_0x15c28e['include'],function(_0x8f3090){return{'model':db[_0x8f3090[_0x38a3('0x1e')]],'as':_0x8f3090['as'],'attributes':_0x8f3090[_0x38a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38a3('0xd')](function(_0x11b04c){logger[_0x38a3('0x20')](_0x38a3('0x17'),_0x34d5aa);logger[_0x38a3('0x10')](_0x38a3('0x17'),_0x34d5aa,JSON[_0x38a3('0x21')](_0x11b04c));_0x3eb41d(_0x11b04c);})[_0x38a3('0x16')](function(_0x264444){logger[_0x38a3('0x12')](_0x38a3('0x17'),_0x264444[_0x38a3('0x14')],_0x34d5aa);_0x5b49bb(_0x1845d8[_0x38a3('0x12')](0x1f4,_0x264444['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 98e179f..46d088a 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 _0x163a=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x2bec9b,_0x1896f1){var _0x2e25de=function(_0x4c71a6){while(--_0x4c71a6){_0x2bec9b['push'](_0x2bec9b['shift']());}};_0x2e25de(++_0x1896f1);}(_0x163a,0x99));var _0xa163=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x163a[_0x695b76];return _0x1dc21f;};'use strict';var multer=require(_0xa163('0x0'));var util=require(_0xa163('0x1'));var path=require(_0xa163('0x2'));var timeout=require(_0xa163('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa163('0x4'));var interaction=require(_0xa163('0x5'));var config=require('../../config/environment');var controller=require(_0xa163('0x6'));router['get']('/',auth[_0xa163('0x7')](),controller[_0xa163('0x8')]);router[_0xa163('0x9')](_0xa163('0xa'),auth[_0xa163('0x7')](),controller[_0xa163('0xb')]);router[_0xa163('0xc')]('/',auth[_0xa163('0x7')](),controller[_0xa163('0xd')]);router[_0xa163('0xe')](_0xa163('0xa'),auth[_0xa163('0x7')](),controller[_0xa163('0xf')]);router[_0xa163('0x10')](_0xa163('0xa'),auth[_0xa163('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33f2=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x9ff331,_0x2323b0){var _0xc58534=function(_0x228218){while(--_0x228218){_0x9ff331['push'](_0x9ff331['shift']());}};_0xc58534(++_0x2323b0);}(_0x33f2,0x1c8));var _0x233f=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x33f2[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require(_0x233f('0x0'));var util=require(_0x233f('0x1'));var path=require(_0x233f('0x2'));var timeout=require(_0x233f('0x3'));var express=require(_0x233f('0x4'));var router=express[_0x233f('0x5')]();var fs_extra=require(_0x233f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x233f('0x7'));var config=require(_0x233f('0x8'));var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x233f('0x9'),auth[_0x233f('0xa')](),controller[_0x233f('0xb')]);router['post']('/',auth[_0x233f('0xa')](),controller[_0x233f('0xc')]);router['put'](_0x233f('0x9'),auth[_0x233f('0xa')](),controller[_0x233f('0xd')]);router[_0x233f('0xe')]('/:id',auth[_0x233f('0xa')](),controller[_0x233f('0xf')]);module[_0x233f('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3ba10c5..63de6f2 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 _0xe1d1=['preproduction','toString','utf8','long','production','DATE','sequelize','exports','name','STRING','TEXT','BLOB','getDataValue'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xe1d1,0x131));var _0x1e1d=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xe1d1[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0x1e1d('0x0'));module[_0x1e1d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e1d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1e1d('0x3')]},'notes':{'type':Sequelize[_0x1e1d('0x4')]},'preproduction':{'type':Sequelize[_0x1e1d('0x5')]('long'),'get':function(){if(this[_0x1e1d('0x6')](_0x1e1d('0x7'))){return this[_0x1e1d('0x6')](_0x1e1d('0x7'))[_0x1e1d('0x8')](_0x1e1d('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x1e1d('0xa')),'get':function(){if(this[_0x1e1d('0x6')](_0x1e1d('0xb'))){return this[_0x1e1d('0x6')](_0x1e1d('0xb'))[_0x1e1d('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1e1d('0xc')]},'publishedAt':{'type':Sequelize[_0x1e1d('0xc')]}}; \ No newline at end of file +var _0xa282=['production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x5ed54c,_0x2785e5){var _0x4d8371=function(_0x9a3eae){while(--_0x9a3eae){_0x5ed54c['push'](_0x5ed54c['shift']());}};_0x4d8371(++_0x2785e5);}(_0xa282,0x189));var _0x2a28=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa282[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x2a28('0x0'));module[_0x2a28('0x1')]={'name':{'type':Sequelize[_0x2a28('0x2')],'unique':_0x2a28('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2a28('0x2')]},'notes':{'type':Sequelize[_0x2a28('0x4')]},'preproduction':{'type':Sequelize[_0x2a28('0x5')](_0x2a28('0x6')),'get':function(){if(this[_0x2a28('0x7')](_0x2a28('0x8'))){return this[_0x2a28('0x7')](_0x2a28('0x8'))[_0x2a28('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x2a28('0x6')),'get':function(){if(this[_0x2a28('0x7')](_0x2a28('0xa'))){return this[_0x2a28('0x7')]('production')[_0x2a28('0x9')](_0x2a28('0xb'));}}},'savedAt':{'type':Sequelize[_0x2a28('0xc')]},'publishedAt':{'type':Sequelize[_0x2a28('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a0e6e69..2b9edd2 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 _0x77eb=['../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','json','offset','undefined','count','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','status','end','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','SquareProject','includeAll','include','rows','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x53e52e,_0x470b09){var _0x2b0dc5=function(_0x56bded){while(--_0x56bded){_0x53e52e['push'](_0x53e52e['shift']());}};_0x2b0dc5(++_0x470b09);}(_0x77eb,0x8b));var _0xb77e=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x77eb[_0x2fa1c6];return _0x5f3257;};'use strict';var _=require(_0xb77e('0x0'));var Redis=require(_0xb77e('0x1'));var qs=require(_0xb77e('0x2'));var logger=require(_0xb77e('0x3'))(_0xb77e('0x4'));var config=require(_0xb77e('0x5'));var db=require(_0xb77e('0x6'))['db'];config['redis']=_[_0xb77e('0x7')](config['redis'],{'host':_0xb77e('0x8'),'port':0x18eb});var socket=require(_0xb77e('0x9'))(new Redis(config[_0xb77e('0xa')]));require('./squareProject.socket')[_0xb77e('0xb')](socket);function respondWithResult(_0x180e4a,_0x48a143){_0x48a143=_0x48a143||0xc8;return function(_0x15c36e){if(_0x15c36e){return _0x180e4a['status'](_0x48a143)[_0xb77e('0xc')](_0x15c36e);}};}function respondWithFilteredResult(_0x3c6eae,_0x1c10b9){return function(_0x24efb8){if(_0x24efb8){var _0xa00bff=typeof _0x1c10b9[_0xb77e('0xd')]===_0xb77e('0xe')&&typeof _0x1c10b9['limit']===_0xb77e('0xe');var _0x20a62b=_0x24efb8[_0xb77e('0xf')];var _0x44f16c=_0xa00bff?0x0:_0x1c10b9[_0xb77e('0xd')];var _0x213377=_0xa00bff?_0x24efb8[_0xb77e('0xf')]:_0x1c10b9[_0xb77e('0xd')]+_0x1c10b9['limit'];var _0x20e2be;if(_0x213377>=_0x20a62b){_0x213377=_0x20a62b;_0x20e2be=0xc8;}else{_0x20e2be=0xce;}_0x3c6eae['status'](_0x20e2be);return _0x3c6eae['set'](_0xb77e('0x10'),_0x44f16c+'-'+_0x213377+'/'+_0x20a62b)['json'](_0x24efb8);}return null;};}function saveUpdates(_0x5e476a){return function(_0x56cfad){if(_0x56cfad){return _0x56cfad[_0xb77e('0x11')](_0x5e476a)[_0xb77e('0x12')](function(_0x584eb4){return _0x584eb4;});}return null;};}function removeEntity(_0x2698b8){return function(_0x23ab06){if(_0x23ab06){return _0x23ab06[_0xb77e('0x13')]()[_0xb77e('0x12')](function(){var _0x514ecc=_0x23ab06[_0xb77e('0x14')]({'plain':!![]});var _0x2f2cb7=_0xb77e('0x15');return db['UserProfileResource'][_0xb77e('0x13')]({'where':{'type':_0x2f2cb7,'resourceId':_0x514ecc['id']}})[_0xb77e('0x12')](function(){return _0x23ab06;});})[_0xb77e('0x12')](function(){var _0xd6bed4=new Redis(config[_0xb77e('0xa')]);_0xd6bed4['publish'](_0xb77e('0x16'),JSON[_0xb77e('0x17')]({'id':_0x23ab06['id'],'deleted':!![]}));})[_0xb77e('0x12')](function(){_0x2698b8[_0xb77e('0x18')](0xcc)[_0xb77e('0x19')]();});}};}function handleEntityNotFound(_0x48a726){return function(_0x1eaf66){if(!_0x1eaf66){_0x48a726['sendStatus'](0x194);}return _0x1eaf66;};}function handleError(_0x599930,_0x4cc146){_0x4cc146=_0x4cc146||0x1f4;return function(_0x590b97){logger[_0xb77e('0x1a')](_0x590b97[_0xb77e('0x1b')]);if(_0x590b97[_0xb77e('0x1c')]){delete _0x590b97[_0xb77e('0x1c')];}_0x599930[_0xb77e('0x18')](_0x4cc146)[_0xb77e('0x1d')](_0x590b97);};}exports[_0xb77e('0x1e')]=function(_0x5ae131,_0x2a7c7d){var _0x28e8c3={},_0x24897a={},_0x7d0620={'count':0x0,'rows':[]};var _0x3b1641=_['map'](db['SquareProject'][_0xb77e('0x1f')],function(_0x143dbe){return{'name':_0x143dbe[_0xb77e('0x20')],'type':_0x143dbe[_0xb77e('0x21')]['key']};});_0x24897a['model']=_[_0xb77e('0x22')](_0x3b1641,'name');_0x24897a[_0xb77e('0x23')]=_[_0xb77e('0x24')](_0x5ae131['query']);_0x24897a[_0xb77e('0x25')]=_[_0xb77e('0x26')](_0x24897a[_0xb77e('0x27')],_0x24897a[_0xb77e('0x23')]);_0x28e8c3[_0xb77e('0x28')]=_[_0xb77e('0x26')](_0x24897a[_0xb77e('0x27')],qs[_0xb77e('0x29')](_0x5ae131[_0xb77e('0x23')]['fields']));_0x28e8c3[_0xb77e('0x28')]=_0x28e8c3[_0xb77e('0x28')][_0xb77e('0x2a')]?_0x28e8c3['attributes']:_0x24897a[_0xb77e('0x27')];if(!_0x5ae131['query'][_0xb77e('0x2b')](_0xb77e('0x2c'))){_0x28e8c3[_0xb77e('0x2d')]=qs[_0xb77e('0x2d')](_0x5ae131[_0xb77e('0x23')]['limit']);_0x28e8c3[_0xb77e('0xd')]=qs[_0xb77e('0xd')](_0x5ae131[_0xb77e('0x23')]['offset']);}_0x28e8c3[_0xb77e('0x2e')]=qs[_0xb77e('0x2f')](_0x5ae131[_0xb77e('0x23')][_0xb77e('0x2f')]);_0x28e8c3[_0xb77e('0x30')]=qs['filters'](_[_0xb77e('0x31')](_0x5ae131['query'],_0x24897a[_0xb77e('0x25')]),_0x3b1641);if(_0x5ae131[_0xb77e('0x23')][_0xb77e('0x32')]){_0x28e8c3['where']=_[_0xb77e('0x33')](_0x28e8c3['where'],{'$or':_[_0xb77e('0x22')](_0x3b1641,function(_0x5e7cc6){if(_0x5e7cc6[_0xb77e('0x21')]!==_0xb77e('0x34')){var _0x57160c={};_0x57160c[_0x5e7cc6[_0xb77e('0x1c')]]={'$like':'%'+_0x5ae131[_0xb77e('0x23')][_0xb77e('0x32')]+'%'};return _0x57160c;}})});}_0x28e8c3=_[_0xb77e('0x33')]({},_0x28e8c3,_0x5ae131['options']);var _0x18b32e={'where':_0x28e8c3[_0xb77e('0x30')]};return db[_0xb77e('0x35')]['count'](_0x18b32e)[_0xb77e('0x12')](function(_0xa02b09){_0x7d0620[_0xb77e('0xf')]=_0xa02b09;if(_0x5ae131[_0xb77e('0x23')][_0xb77e('0x36')]){_0x28e8c3[_0xb77e('0x37')]=[{'all':!![]}];}return db[_0xb77e('0x35')]['findAll'](_0x28e8c3);})[_0xb77e('0x12')](function(_0x4874dd){_0x7d0620[_0xb77e('0x38')]=_0x4874dd;return _0x7d0620;})['then'](respondWithFilteredResult(_0x2a7c7d,_0x28e8c3))['catch'](handleError(_0x2a7c7d,null));};exports['show']=function(_0x5ace56,_0x1f45fd){var _0x398c60={'raw':![],'where':{'id':_0x5ace56[_0xb77e('0x39')]['id']}},_0x2c53e0={};_0x2c53e0[_0xb77e('0x27')]=_[_0xb77e('0x24')](db[_0xb77e('0x35')][_0xb77e('0x1f')]);_0x2c53e0['query']=_[_0xb77e('0x24')](_0x5ace56['query']);_0x2c53e0['filters']=_['intersection'](_0x2c53e0[_0xb77e('0x27')],_0x2c53e0[_0xb77e('0x23')]);_0x398c60[_0xb77e('0x28')]=_[_0xb77e('0x26')](_0x2c53e0[_0xb77e('0x27')],qs['fields'](_0x5ace56[_0xb77e('0x23')][_0xb77e('0x29')]));_0x398c60[_0xb77e('0x28')]=_0x398c60[_0xb77e('0x28')]['length']?_0x398c60[_0xb77e('0x28')]:_0x2c53e0['model'];if(_0x5ace56[_0xb77e('0x23')][_0xb77e('0x36')]){_0x398c60[_0xb77e('0x37')]=[{'all':!![]}];}_0x398c60=_[_0xb77e('0x33')]({},_0x398c60,_0x5ace56[_0xb77e('0x3a')]);return db[_0xb77e('0x35')][_0xb77e('0x3b')](_0x398c60)[_0xb77e('0x12')](handleEntityNotFound(_0x1f45fd,null))[_0xb77e('0x12')](respondWithResult(_0x1f45fd,null))[_0xb77e('0x3c')](handleError(_0x1f45fd,null));};exports[_0xb77e('0x3d')]=function(_0x5a1106,_0x2ec856){return db['SquareProject']['create'](_0x5a1106[_0xb77e('0x3e')],{})['then'](function(_0x40918c){var _0x263d0c=_0x5a1106[_0xb77e('0x3f')][_0xb77e('0x14')]({'plain':!![]});if(!_0x263d0c)throw new Error(_0xb77e('0x40'));if(_0x263d0c[_0xb77e('0x41')]===_0xb77e('0x3f')){var _0x5d8707=_0x40918c[_0xb77e('0x14')]({'plain':!![]});var _0x4082b7='SquareProjects';return db[_0xb77e('0x42')]['find']({'where':{'name':_0x4082b7,'userProfileId':_0x263d0c[_0xb77e('0x43')]},'raw':!![]})[_0xb77e('0x12')](function(_0x2f01c9){if(_0x2f01c9&&_0x2f01c9[_0xb77e('0x44')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d8707[_0xb77e('0x1c')],'resourceId':_0x5d8707['id'],'type':_0x2f01c9[_0xb77e('0x1c')],'sectionId':_0x2f01c9['id']},{})[_0xb77e('0x12')](function(){return _0x40918c;});}else{return _0x40918c;}})[_0xb77e('0x3c')](function(_0x1930be){logger[_0xb77e('0x1a')](_0xb77e('0x45'),_0x1930be);throw _0x1930be;});}return _0x40918c;})['then'](respondWithResult(_0x2ec856,0xc9))[_0xb77e('0x3c')](handleError(_0x2ec856,null));};exports['update']=function(_0x485528,_0xfcf327){if(_0x485528[_0xb77e('0x3e')]['id']){delete _0x485528[_0xb77e('0x3e')]['id'];}return db[_0xb77e('0x35')]['find']({'where':{'id':_0x485528['params']['id']}})[_0xb77e('0x12')](handleEntityNotFound(_0xfcf327,null))[_0xb77e('0x12')](saveUpdates(_0x485528['body'],null))[_0xb77e('0x12')](function(_0x576ec8){if(!_0x576ec8)return;var _0x2bc126=_0x576ec8[_0xb77e('0x14')]({'plain':!![]});return _0x2bc126;})['then'](function(_0x53a301){var _0x54791f=new Redis(config[_0xb77e('0xa')]);_0x54791f[_0xb77e('0x46')](_0xb77e('0x16'),JSON[_0xb77e('0x17')](_[_0xb77e('0x31')](_0x53a301,['id',_0xb77e('0x1c'),_0xb77e('0x47')])));return _0x53a301;})[_0xb77e('0x12')](respondWithResult(_0xfcf327,null))[_0xb77e('0x3c')](handleError(_0xfcf327,null));};exports[_0xb77e('0x13')]=function(_0x2a8941,_0x52a4d3){return db['SquareProject'][_0xb77e('0x3b')]({'where':{'id':_0x2a8941[_0xb77e('0x39')]['id']}})[_0xb77e('0x12')](handleEntityNotFound(_0x52a4d3,null))['then'](removeEntity(_0x52a4d3,null))['catch'](handleError(_0x52a4d3,null));}; \ No newline at end of file +var _0x3863=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','update','destroy','get','SquareProjects','publish','agi','stringify','then','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x3863,0xcc));var _0x3386=function(_0x1eb4ca,_0x530bfa){_0x1eb4ca=_0x1eb4ca-0x0;var _0x234ca2=_0x3863[_0x1eb4ca];return _0x234ca2;};'use strict';var _=require('lodash');var Redis=require(_0x3386('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x3386('0x1'))(_0x3386('0x2'));var config=require('../../config/environment');var db=require(_0x3386('0x3'))['db'];config[_0x3386('0x4')]=_[_0x3386('0x5')](config[_0x3386('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x3386('0x6'))(new Redis(config['redis']));require(_0x3386('0x7'))['register'](socket);function respondWithResult(_0x266d1a,_0x5b09d5){_0x5b09d5=_0x5b09d5||0xc8;return function(_0x21de5b){if(_0x21de5b){return _0x266d1a[_0x3386('0x8')](_0x5b09d5)[_0x3386('0x9')](_0x21de5b);}};}function respondWithFilteredResult(_0x21ce31,_0x518eb0){return function(_0x1a2aea){if(_0x1a2aea){var _0x10e067=typeof _0x518eb0[_0x3386('0xa')]===_0x3386('0xb')&&typeof _0x518eb0[_0x3386('0xc')]===_0x3386('0xb');var _0x2654d0=_0x1a2aea[_0x3386('0xd')];var _0x407782=_0x10e067?0x0:_0x518eb0[_0x3386('0xa')];var _0x171edf=_0x10e067?_0x1a2aea[_0x3386('0xd')]:_0x518eb0[_0x3386('0xa')]+_0x518eb0[_0x3386('0xc')];var _0x370d92;if(_0x171edf>=_0x2654d0){_0x171edf=_0x2654d0;_0x370d92=0xc8;}else{_0x370d92=0xce;}_0x21ce31[_0x3386('0x8')](_0x370d92);return _0x21ce31['set']('Content-Range',_0x407782+'-'+_0x171edf+'/'+_0x2654d0)[_0x3386('0x9')](_0x1a2aea);}return null;};}function saveUpdates(_0x128499){return function(_0x2e593c){if(_0x2e593c){return _0x2e593c[_0x3386('0xe')](_0x128499)['then'](function(_0xda6dba){return _0xda6dba;});}return null;};}function removeEntity(_0x40c50a){return function(_0x431c63){if(_0x431c63){return _0x431c63[_0x3386('0xf')]()['then'](function(){var _0x2efd3b=_0x431c63[_0x3386('0x10')]({'plain':!![]});var _0x303036=_0x3386('0x11');return db['UserProfileResource'][_0x3386('0xf')]({'where':{'type':_0x303036,'resourceId':_0x2efd3b['id']}})['then'](function(){return _0x431c63;});})['then'](function(){var _0x317f04=new Redis(config['redis']);_0x317f04[_0x3386('0x12')](_0x3386('0x13'),JSON[_0x3386('0x14')]({'id':_0x431c63['id'],'deleted':!![]}));})[_0x3386('0x15')](function(){_0x40c50a[_0x3386('0x8')](0xcc)[_0x3386('0x16')]();});}};}function handleEntityNotFound(_0x54714d){return function(_0x28d267){if(!_0x28d267){_0x54714d[_0x3386('0x17')](0x194);}return _0x28d267;};}function handleError(_0x4cbc14,_0x4c4d9f){_0x4c4d9f=_0x4c4d9f||0x1f4;return function(_0x58c71a){logger[_0x3386('0x18')](_0x58c71a[_0x3386('0x19')]);if(_0x58c71a[_0x3386('0x1a')]){delete _0x58c71a[_0x3386('0x1a')];}_0x4cbc14[_0x3386('0x8')](_0x4c4d9f)['send'](_0x58c71a);};}exports[_0x3386('0x1b')]=function(_0x60aa09,_0x7be034){var _0xbc0d34={},_0x3b8e4c={},_0x5b8340={'count':0x0,'rows':[]};var _0x5957a0=_[_0x3386('0x1c')](db[_0x3386('0x1d')][_0x3386('0x1e')],function(_0x4cdd7a){return{'name':_0x4cdd7a[_0x3386('0x1f')],'type':_0x4cdd7a[_0x3386('0x20')][_0x3386('0x21')]};});_0x3b8e4c[_0x3386('0x22')]=_[_0x3386('0x1c')](_0x5957a0,_0x3386('0x1a'));_0x3b8e4c[_0x3386('0x23')]=_[_0x3386('0x24')](_0x60aa09[_0x3386('0x23')]);_0x3b8e4c[_0x3386('0x25')]=_[_0x3386('0x26')](_0x3b8e4c[_0x3386('0x22')],_0x3b8e4c['query']);_0xbc0d34[_0x3386('0x27')]=_[_0x3386('0x26')](_0x3b8e4c[_0x3386('0x22')],qs[_0x3386('0x28')](_0x60aa09[_0x3386('0x23')][_0x3386('0x28')]));_0xbc0d34['attributes']=_0xbc0d34[_0x3386('0x27')]['length']?_0xbc0d34[_0x3386('0x27')]:_0x3b8e4c[_0x3386('0x22')];if(!_0x60aa09[_0x3386('0x23')][_0x3386('0x29')](_0x3386('0x2a'))){_0xbc0d34[_0x3386('0xc')]=qs['limit'](_0x60aa09[_0x3386('0x23')][_0x3386('0xc')]);_0xbc0d34[_0x3386('0xa')]=qs[_0x3386('0xa')](_0x60aa09['query'][_0x3386('0xa')]);}_0xbc0d34['order']=qs[_0x3386('0x2b')](_0x60aa09['query'][_0x3386('0x2b')]);_0xbc0d34['where']=qs['filters'](_[_0x3386('0x2c')](_0x60aa09[_0x3386('0x23')],_0x3b8e4c[_0x3386('0x25')]),_0x5957a0);if(_0x60aa09[_0x3386('0x23')][_0x3386('0x2d')]){_0xbc0d34[_0x3386('0x2e')]=_[_0x3386('0x2f')](_0xbc0d34['where'],{'$or':_[_0x3386('0x1c')](_0x5957a0,function(_0x727283){if(_0x727283['type']!=='VIRTUAL'){var _0x41ed91={};_0x41ed91[_0x727283['name']]={'$like':'%'+_0x60aa09[_0x3386('0x23')][_0x3386('0x2d')]+'%'};return _0x41ed91;}})});}_0xbc0d34=_[_0x3386('0x2f')]({},_0xbc0d34,_0x60aa09[_0x3386('0x30')]);var _0x40ceab={'where':_0xbc0d34[_0x3386('0x2e')]};return db[_0x3386('0x1d')][_0x3386('0xd')](_0x40ceab)[_0x3386('0x15')](function(_0x27df0f){_0x5b8340[_0x3386('0xd')]=_0x27df0f;if(_0x60aa09['query'][_0x3386('0x31')]){_0xbc0d34['include']=[{'all':!![]}];}return db[_0x3386('0x1d')]['findAll'](_0xbc0d34);})[_0x3386('0x15')](function(_0x54caf7){_0x5b8340[_0x3386('0x32')]=_0x54caf7;return _0x5b8340;})[_0x3386('0x15')](respondWithFilteredResult(_0x7be034,_0xbc0d34))[_0x3386('0x33')](handleError(_0x7be034,null));};exports['show']=function(_0x11a4c9,_0xd5791b){var _0x5822a3={'raw':![],'where':{'id':_0x11a4c9[_0x3386('0x34')]['id']}},_0x31006a={};_0x31006a['model']=_[_0x3386('0x24')](db[_0x3386('0x1d')][_0x3386('0x1e')]);_0x31006a[_0x3386('0x23')]=_[_0x3386('0x24')](_0x11a4c9[_0x3386('0x23')]);_0x31006a['filters']=_[_0x3386('0x26')](_0x31006a[_0x3386('0x22')],_0x31006a[_0x3386('0x23')]);_0x5822a3[_0x3386('0x27')]=_[_0x3386('0x26')](_0x31006a['model'],qs[_0x3386('0x28')](_0x11a4c9[_0x3386('0x23')][_0x3386('0x28')]));_0x5822a3[_0x3386('0x27')]=_0x5822a3[_0x3386('0x27')][_0x3386('0x35')]?_0x5822a3[_0x3386('0x27')]:_0x31006a[_0x3386('0x22')];if(_0x11a4c9[_0x3386('0x23')][_0x3386('0x31')]){_0x5822a3[_0x3386('0x36')]=[{'all':!![]}];}_0x5822a3=_[_0x3386('0x2f')]({},_0x5822a3,_0x11a4c9[_0x3386('0x30')]);return db[_0x3386('0x1d')][_0x3386('0x37')](_0x5822a3)[_0x3386('0x15')](handleEntityNotFound(_0xd5791b,null))[_0x3386('0x15')](respondWithResult(_0xd5791b,null))[_0x3386('0x33')](handleError(_0xd5791b,null));};exports[_0x3386('0x38')]=function(_0x4e5062,_0x3f394d){return db['SquareProject']['create'](_0x4e5062[_0x3386('0x39')],{})[_0x3386('0x15')](function(_0x5b8209){var _0x3b825d=_0x4e5062[_0x3386('0x3a')]['get']({'plain':!![]});if(!_0x3b825d)throw new Error(_0x3386('0x3b'));if(_0x3b825d[_0x3386('0x3c')]==='user'){var _0x2ea2b8=_0x5b8209[_0x3386('0x10')]({'plain':!![]});var _0x360f42=_0x3386('0x11');return db[_0x3386('0x3d')][_0x3386('0x37')]({'where':{'name':_0x360f42,'userProfileId':_0x3b825d[_0x3386('0x3e')]},'raw':!![]})[_0x3386('0x15')](function(_0x463f80){if(_0x463f80&&_0x463f80['autoAssociation']===0x0){return db[_0x3386('0x3f')][_0x3386('0x38')]({'name':_0x2ea2b8[_0x3386('0x1a')],'resourceId':_0x2ea2b8['id'],'type':_0x463f80['name'],'sectionId':_0x463f80['id']},{})[_0x3386('0x15')](function(){return _0x5b8209;});}else{return _0x5b8209;}})[_0x3386('0x33')](function(_0x157fe2){logger[_0x3386('0x18')](_0x3386('0x40'),_0x157fe2);throw _0x157fe2;});}return _0x5b8209;})[_0x3386('0x15')](respondWithResult(_0x3f394d,0xc9))[_0x3386('0x33')](handleError(_0x3f394d,null));};exports[_0x3386('0xe')]=function(_0x2c8274,_0x690a65){if(_0x2c8274[_0x3386('0x39')]['id']){delete _0x2c8274['body']['id'];}return db[_0x3386('0x1d')][_0x3386('0x37')]({'where':{'id':_0x2c8274[_0x3386('0x34')]['id']}})[_0x3386('0x15')](handleEntityNotFound(_0x690a65,null))['then'](saveUpdates(_0x2c8274[_0x3386('0x39')],null))[_0x3386('0x15')](function(_0xee2c37){if(!_0xee2c37)return;var _0x17bb05=_0xee2c37[_0x3386('0x10')]({'plain':!![]});return _0x17bb05;})['then'](function(_0x1eb79d){var _0x8f6910=new Redis(config[_0x3386('0x4')]);_0x8f6910[_0x3386('0x12')](_0x3386('0x13'),JSON['stringify'](_[_0x3386('0x2c')](_0x1eb79d,['id',_0x3386('0x1a'),_0x3386('0x41')])));return _0x1eb79d;})['then'](respondWithResult(_0x690a65,null))[_0x3386('0x33')](handleError(_0x690a65,null));};exports[_0x3386('0xf')]=function(_0x497aef,_0x534105){return db[_0x3386('0x1d')][_0x3386('0x37')]({'where':{'id':_0x497aef[_0x3386('0x34')]['id']}})[_0x3386('0x15')](handleEntityNotFound(_0x534105,null))[_0x3386('0x15')](removeEntity(_0x534105,null))['catch'](handleError(_0x534105,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8c976a0..86fbd67 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 _0x0aa1=['../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x288570,_0x354b38){var _0x4f338f=function(_0x39496e){while(--_0x39496e){_0x288570['push'](_0x288570['shift']());}};_0x4f338f(++_0x354b38);}(_0x0aa1,0xef));var _0x10aa=function(_0x31f218,_0x99590f){_0x31f218=_0x31f218-0x0;var _0x4b4961=_0x0aa1[_0x31f218];return _0x4b4961;};'use strict';var EventEmitter=require(_0x10aa('0x0'));var SquareProject=require(_0x10aa('0x1'))['db'][_0x10aa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x10aa('0x3')](0x0);var events={'afterCreate':_0x10aa('0x4'),'afterUpdate':_0x10aa('0x5'),'afterDestroy':'remove'};function emitEvent(_0xccace0){return function(_0x3da5b7,_0x5b64e7,_0x2c3f3b){SquareProjectEvents[_0x10aa('0x6')](_0xccace0+':'+_0x3da5b7['id'],_0x3da5b7);SquareProjectEvents[_0x10aa('0x6')](_0xccace0,_0x3da5b7);_0x2c3f3b(null);};}for(var e in events){if(events[_0x10aa('0x7')](e)){var event=events[e];SquareProject[_0x10aa('0x8')](e,emitEvent(event));}}module[_0x10aa('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x0bfd=['hook','exports','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1ad9c6,_0x4042af){var _0x38d321=function(_0x1e66fa){while(--_0x1e66fa){_0x1ad9c6['push'](_0x1ad9c6['shift']());}};_0x38d321(++_0x4042af);}(_0x0bfd,0xa4));var _0xd0bf=function(_0x438281,_0x255640){_0x438281=_0x438281-0x0;var _0x1aed2d=_0x0bfd[_0x438281];return _0x1aed2d;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xd0bf('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd0bf('0x1')](0x0);var events={'afterCreate':_0xd0bf('0x2'),'afterUpdate':_0xd0bf('0x3'),'afterDestroy':_0xd0bf('0x4')};function emitEvent(_0x9f911d){return function(_0xf0ef0a,_0x2503cb,_0x1b4c28){SquareProjectEvents[_0xd0bf('0x5')](_0x9f911d+':'+_0xf0ef0a['id'],_0xf0ef0a);SquareProjectEvents[_0xd0bf('0x5')](_0x9f911d,_0xf0ef0a);_0x1b4c28(null);};}for(var e in events){if(events[_0xd0bf('0x6')](e)){var event=events[e];SquareProject[_0xd0bf('0x7')](e,emitEvent(event));}}module[_0xd0bf('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2e706dd..16e6819 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 _0x02fe=['production','publishedAt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x114b93,_0x5a4f2d){var _0x52f08a=function(_0x222167){while(--_0x222167){_0x114b93['push'](_0x114b93['shift']());}};_0x52f08a(++_0x5a4f2d);}(_0x02fe,0xa7));var _0xe02f=function(_0x5eef34,_0xdb2469){_0x5eef34=_0x5eef34-0x0;var _0x19487a=_0x02fe[_0x5eef34];return _0x19487a;};'use strict';var _=require(_0xe02f('0x0'));var util=require(_0xe02f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe02f('0x2'));var BPromise=require(_0xe02f('0x3'));var rp=require(_0xe02f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe02f('0x5'));var config=require(_0xe02f('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x380b28,_0x89643f){return _0x380b28['define'](_0xe02f('0x7'),attributes,{'tableName':_0xe02f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47d975,_0x2a344b,_0x19790d){if(_0x47d975[_0xe02f('0x9')](_0xe02f('0xa'))){_0x47d975['savedAt']=moment()[_0xe02f('0xb')](_0xe02f('0xc'));}if(_0x47d975[_0xe02f('0x9')](_0xe02f('0xd'))){_0x47d975[_0xe02f('0xe')]=moment()[_0xe02f('0xb')](_0xe02f('0xc'));}_0x19790d(null,_0x47d975);}}});}; \ No newline at end of file +var _0x6e3a=['rimraf','./squareProject.attributes','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x48a809,_0x5bd939){var _0x5c0064=function(_0x7ff42c){while(--_0x7ff42c){_0x48a809['push'](_0x48a809['shift']());}};_0x5c0064(++_0x5bd939);}(_0x6e3a,0x13c));var _0xa6e3=function(_0x28d8bd,_0x2a9333){_0x28d8bd=_0x28d8bd-0x0;var _0x4eacd4=_0x6e3a[_0x28d8bd];return _0x4eacd4;};'use strict';var _=require(_0xa6e3('0x0'));var util=require(_0xa6e3('0x1'));var logger=require(_0xa6e3('0x2'))(_0xa6e3('0x3'));var moment=require(_0xa6e3('0x4'));var BPromise=require(_0xa6e3('0x5'));var rp=require(_0xa6e3('0x6'));var fs=require('fs');var path=require(_0xa6e3('0x7'));var rimraf=require(_0xa6e3('0x8'));var config=require('../../config/environment');var attributes=require(_0xa6e3('0x9'));module[_0xa6e3('0xa')]=function(_0x20bf92,_0x323249){return _0x20bf92[_0xa6e3('0xb')]('SquareProject',attributes,{'tableName':_0xa6e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x330a55,_0x2688d9,_0x526a31){if(_0x330a55[_0xa6e3('0xd')]('preproduction')){_0x330a55[_0xa6e3('0xe')]=moment()[_0xa6e3('0xf')](_0xa6e3('0x10'));}if(_0x330a55[_0xa6e3('0xd')](_0xa6e3('0x11'))){_0x330a55['publishedAt']=moment()[_0xa6e3('0xf')](_0xa6e3('0x10'));}_0x526a31(null,_0x330a55);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0b8e392..153c1b0 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 _0x929b=['where','include','model','attributes','map','then','debug','stringify','catch','error','message','ShowSquareProject','find','info','lodash','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw'];(function(_0xdcb25e,_0x57240d){var _0x509830=function(_0xa5bc59){while(--_0xa5bc59){_0xdcb25e['push'](_0xdcb25e['shift']());}};_0x509830(++_0x57240d);}(_0x929b,0x15e));var _0xb929=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x929b[_0x491cbe];return _0x59449d;};'use strict';var _=require(_0xb929('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xb929('0x1'));var config=require(_0xb929('0x2'));config[_0xb929('0x3')]=_[_0xb929('0x4')](config['redis'],{'host':_0xb929('0x5'),'port':0x18eb});var socket=require(_0xb929('0x6'))(new Redis(config[_0xb929('0x3')]));require(_0xb929('0x7'))[_0xb929('0x8')](socket);exports[_0xb929('0x9')]=function(_0x431987){var _0xbe353a=this;return new Promise(function(_0x43dfec,_0x532fec){return db[_0xb929('0xa')][_0xb929('0xb')]({'raw':_0x431987['options']?_0x431987[_0xb929('0xc')][_0xb929('0xd')]===undefined?!![]:![]:!![],'where':_0x431987[_0xb929('0xc')]?_0x431987[_0xb929('0xc')][_0xb929('0xe')]||null:null,'attributes':_0x431987['options']?_0x431987[_0xb929('0xc')]['attributes']||null:null,'limit':_0x431987['options']?_0x431987[_0xb929('0xc')]['limit']||null:null,'include':_0x431987[_0xb929('0xc')]?_0x431987[_0xb929('0xc')][_0xb929('0xf')]?_['map'](_0x431987['options'][_0xb929('0xf')],function(_0x44fe13){return{'model':db[_0x44fe13[_0xb929('0x10')]],'as':_0x44fe13['as'],'attributes':_0x44fe13[_0xb929('0x11')],'include':_0x44fe13['include']?_[_0xb929('0x12')](_0x44fe13[_0xb929('0xf')],function(_0x4ab6b9){return{'model':db[_0x4ab6b9['model']],'as':_0x4ab6b9['as'],'attributes':_0x4ab6b9[_0xb929('0x11')],'include':_0x4ab6b9[_0xb929('0xf')]?_[_0xb929('0x12')](_0x4ab6b9[_0xb929('0xf')],function(_0x54b775){return{'model':db[_0x54b775[_0xb929('0x10')]],'as':_0x54b775['as'],'attributes':_0x54b775[_0xb929('0x11')]};}):[]};}):[]};}):[]:[]})[_0xb929('0x13')](function(_0x4d11c9){logger['info'](_0xb929('0x9'),_0x431987);logger[_0xb929('0x14')](_0xb929('0x9'),_0x431987,JSON[_0xb929('0x15')](_0x4d11c9));_0x43dfec(_0x4d11c9);})[_0xb929('0x16')](function(_0x2710f2){logger[_0xb929('0x17')]('GetSquareProjects',_0x2710f2['message'],_0x431987);_0x532fec(_0xbe353a[_0xb929('0x17')](0x1f4,_0x2710f2[_0xb929('0x18')]));});});};exports[_0xb929('0x19')]=function(_0x48d4f3){var _0x28c2cf=this;return new Promise(function(_0x4835b8,_0x52e40b){return db[_0xb929('0xa')][_0xb929('0x1a')]({'raw':_0x48d4f3[_0xb929('0xc')]?_0x48d4f3[_0xb929('0xc')][_0xb929('0xd')]===undefined?!![]:![]:!![],'where':_0x48d4f3[_0xb929('0xc')]?_0x48d4f3[_0xb929('0xc')]['where']||null:null,'attributes':_0x48d4f3[_0xb929('0xc')]?_0x48d4f3['options'][_0xb929('0x11')]||null:null,'include':_0x48d4f3[_0xb929('0xc')]?_0x48d4f3[_0xb929('0xc')][_0xb929('0xf')]?_['map'](_0x48d4f3[_0xb929('0xc')][_0xb929('0xf')],function(_0xd0f8a9){return{'model':db[_0xd0f8a9['model']],'as':_0xd0f8a9['as'],'attributes':_0xd0f8a9[_0xb929('0x11')],'include':_0xd0f8a9[_0xb929('0xf')]?_[_0xb929('0x12')](_0xd0f8a9[_0xb929('0xf')],function(_0x433bc6){return{'model':db[_0x433bc6[_0xb929('0x10')]],'as':_0x433bc6['as'],'attributes':_0x433bc6[_0xb929('0x11')],'include':_0x433bc6[_0xb929('0xf')]?_[_0xb929('0x12')](_0x433bc6[_0xb929('0xf')],function(_0x265540){return{'model':db[_0x265540[_0xb929('0x10')]],'as':_0x265540['as'],'attributes':_0x265540['attributes']};}):[]};}):[]};}):[]:[]})[_0xb929('0x13')](function(_0x3887a8){logger[_0xb929('0x1b')](_0xb929('0x19'),_0x48d4f3);logger[_0xb929('0x14')]('ShowSquareProject',_0x48d4f3,JSON[_0xb929('0x15')](_0x3887a8));_0x4835b8(_0x3887a8);})[_0xb929('0x16')](function(_0xdf9fdf){logger[_0xb929('0x17')]('ShowSquareProject',_0xdf9fdf['message'],_0x48d4f3);_0x52e40b(_0x28c2cf['error'](0x1f4,_0xdf9fdf[_0xb929('0x18')]));});});}; \ No newline at end of file +var _0xcb6b=['info','stringify','lodash','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','options','raw','where','attributes','limit','include','map','model','GetSquareProjects','debug','catch','error','message','ShowSquareProject','find','then'];(function(_0x3fa469,_0x57cf49){var _0x2e27dc=function(_0x1ccc9b){while(--_0x1ccc9b){_0x3fa469['push'](_0x3fa469['shift']());}};_0x2e27dc(++_0x57cf49);}(_0xcb6b,0xea));var _0xbcb6=function(_0x4138c5,_0x16cdf4){_0x4138c5=_0x4138c5-0x0;var _0x376efc=_0xcb6b[_0x4138c5];return _0x376efc;};'use strict';var _=require(_0xbcb6('0x0'));var Redis=require('ioredis');var db=require(_0xbcb6('0x1'))['db'];var logger=require('../../config/logger')(_0xbcb6('0x2'));var config=require(_0xbcb6('0x3'));config[_0xbcb6('0x4')]=_[_0xbcb6('0x5')](config['redis'],{'host':_0xbcb6('0x6'),'port':0x18eb});var socket=require(_0xbcb6('0x7'))(new Redis(config[_0xbcb6('0x4')]));require(_0xbcb6('0x8'))[_0xbcb6('0x9')](socket);exports['GetSquareProjects']=function(_0x44ff9c){var _0x4dc735=this;return new Promise(function(_0xb0194,_0x54a114){return db[_0xbcb6('0xa')]['findAll']({'raw':_0x44ff9c['options']?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0xc')]===undefined?!![]:![]:!![],'where':_0x44ff9c['options']?_0x44ff9c['options'][_0xbcb6('0xd')]||null:null,'attributes':_0x44ff9c[_0xbcb6('0xb')]?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0xe')]||null:null,'limit':_0x44ff9c[_0xbcb6('0xb')]?_0x44ff9c['options'][_0xbcb6('0xf')]||null:null,'include':_0x44ff9c['options']?_0x44ff9c[_0xbcb6('0xb')][_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x44ff9c[_0xbcb6('0xb')]['include'],function(_0x4b2a50){return{'model':db[_0x4b2a50[_0xbcb6('0x12')]],'as':_0x4b2a50['as'],'attributes':_0x4b2a50[_0xbcb6('0xe')],'include':_0x4b2a50[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x4b2a50[_0xbcb6('0x10')],function(_0x1c2144){return{'model':db[_0x1c2144[_0xbcb6('0x12')]],'as':_0x1c2144['as'],'attributes':_0x1c2144[_0xbcb6('0xe')],'include':_0x1c2144['include']?_[_0xbcb6('0x11')](_0x1c2144[_0xbcb6('0x10')],function(_0x59a806){return{'model':db[_0x59a806[_0xbcb6('0x12')]],'as':_0x59a806['as'],'attributes':_0x59a806[_0xbcb6('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x465b73){logger['info'](_0xbcb6('0x13'),_0x44ff9c);logger[_0xbcb6('0x14')](_0xbcb6('0x13'),_0x44ff9c,JSON['stringify'](_0x465b73));_0xb0194(_0x465b73);})[_0xbcb6('0x15')](function(_0xf39ed1){logger[_0xbcb6('0x16')](_0xbcb6('0x13'),_0xf39ed1[_0xbcb6('0x17')],_0x44ff9c);_0x54a114(_0x4dc735[_0xbcb6('0x16')](0x1f4,_0xf39ed1[_0xbcb6('0x17')]));});});};exports[_0xbcb6('0x18')]=function(_0x1b4790){var _0x53bfe6=this;return new Promise(function(_0x541929,_0xa08ed7){return db['SquareProject'][_0xbcb6('0x19')]({'raw':_0x1b4790[_0xbcb6('0xb')]?_0x1b4790[_0xbcb6('0xb')][_0xbcb6('0xc')]===undefined?!![]:![]:!![],'where':_0x1b4790['options']?_0x1b4790['options'][_0xbcb6('0xd')]||null:null,'attributes':_0x1b4790[_0xbcb6('0xb')]?_0x1b4790['options'][_0xbcb6('0xe')]||null:null,'include':_0x1b4790['options']?_0x1b4790['options'][_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x1b4790['options'][_0xbcb6('0x10')],function(_0x4cebc2){return{'model':db[_0x4cebc2['model']],'as':_0x4cebc2['as'],'attributes':_0x4cebc2[_0xbcb6('0xe')],'include':_0x4cebc2[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x4cebc2[_0xbcb6('0x10')],function(_0x567696){return{'model':db[_0x567696[_0xbcb6('0x12')]],'as':_0x567696['as'],'attributes':_0x567696[_0xbcb6('0xe')],'include':_0x567696[_0xbcb6('0x10')]?_[_0xbcb6('0x11')](_0x567696['include'],function(_0x18a93e){return{'model':db[_0x18a93e['model']],'as':_0x18a93e['as'],'attributes':_0x18a93e['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcb6('0x1a')](function(_0x2056c1){logger[_0xbcb6('0x1b')](_0xbcb6('0x18'),_0x1b4790);logger['debug']('ShowSquareProject',_0x1b4790,JSON[_0xbcb6('0x1c')](_0x2056c1));_0x541929(_0x2056c1);})[_0xbcb6('0x15')](function(_0x175b10){logger[_0xbcb6('0x16')]('ShowSquareProject',_0x175b10[_0xbcb6('0x17')],_0x1b4790);_0xa08ed7(_0x53bfe6[_0xbcb6('0x16')](0x1f4,_0x175b10['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ab0a9e5..76431bb 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 _0xe909=['update','emit','removeListener','register','length','./squareProject.events','save','remove'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0xe909,0xbd));var _0x9e90=function(_0x26c5c2,_0x442f87){_0x26c5c2=_0x26c5c2-0x0;var _0x2e2ead=_0xe909[_0x26c5c2];return _0x2e2ead;};'use strict';var SquareProjectEvents=require(_0x9e90('0x0'));var events=[_0x9e90('0x1'),_0x9e90('0x2'),_0x9e90('0x3')];function createListener(_0x3d92a7,_0x115ddc){return function(_0x41e2ff){_0x115ddc[_0x9e90('0x4')](_0x3d92a7,_0x41e2ff);};}function removeListener(_0x562e8d,_0x168a32){return function(){SquareProjectEvents[_0x9e90('0x5')](_0x562e8d,_0x168a32);};}exports[_0x9e90('0x6')]=function(_0x3ec0a9){for(var _0x1e67ee=0x0,_0x17cec7=events[_0x9e90('0x7')];_0x1e67ee<_0x17cec7;_0x1e67ee++){var _0x16dac7=events[_0x1e67ee];var _0x125fef=createListener('squareProject:'+_0x16dac7,_0x3ec0a9);SquareProjectEvents['on'](_0x16dac7,_0x125fef);}}; \ No newline at end of file +var _0x0afd=['emit','removeListener','length','./squareProject.events','save','remove'];(function(_0x586bb1,_0x5ae4a8){var _0x222252=function(_0x24b76b){while(--_0x24b76b){_0x586bb1['push'](_0x586bb1['shift']());}};_0x222252(++_0x5ae4a8);}(_0x0afd,0x129));var _0xd0af=function(_0x1fa33b,_0x7b3826){_0x1fa33b=_0x1fa33b-0x0;var _0x13ceb6=_0x0afd[_0x1fa33b];return _0x13ceb6;};'use strict';var SquareProjectEvents=require(_0xd0af('0x0'));var events=[_0xd0af('0x1'),_0xd0af('0x2'),'update'];function createListener(_0x378532,_0x1ac949){return function(_0x4ab497){_0x1ac949[_0xd0af('0x3')](_0x378532,_0x4ab497);};}function removeListener(_0x1a0171,_0x1152a6){return function(){SquareProjectEvents[_0xd0af('0x4')](_0x1a0171,_0x1152a6);};}exports['register']=function(_0x56c216){for(var _0x577849=0x0,_0x350677=events[_0xd0af('0x5')];_0x577849<_0x350677;_0x577849++){var _0x33c4cc=events[_0x577849];var _0x28c110=createListener('squareProject:'+_0x33c4cc,_0x56c216);SquareProjectEvents['on'](_0x33c4cc,_0x28c110);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 80c5ad1..995e96c 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x6b186e,_0x43ef5f){var _0x443857=function(_0x3436c5){while(--_0x3436c5){_0x6b186e['push'](_0x6b186e['shift']());}};_0x443857(++_0x43ef5f);}(_0x1261,0x144));var _0x1126=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1261[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x329684,_0x1124a9){var _0x47f5cb=function(_0x537f03){while(--_0x537f03){_0x329684['push'](_0x329684['shift']());}};_0x47f5cb(++_0x1124a9);}(_0xabce,0x103));var _0xeabc=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xabce[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ad984d2..33ec9ad 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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x484f3a,_0x5c9a1a){var _0x2e408a=function(_0x5e9e03){while(--_0x5e9e03){_0x484f3a['push'](_0x484f3a['shift']());}};_0x2e408a(++_0x5c9a1a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xf2ca[_0x40aaa4];return _0x4e21e5;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file +var _0xe14b=['VIRTUAL','lastIndexOf','sequelize','exports','STRING'];(function(_0x753f66,_0x2844e9){var _0xe676d3=function(_0x4c5d7c){while(--_0x4c5d7c){_0x753f66['push'](_0x753f66['shift']());}};_0xe676d3(++_0x2844e9);}(_0xe14b,0x93));var _0xbe14=function(_0x5e14f5,_0x46fcba){_0x5e14f5=_0x5e14f5-0x0;var _0x2fef43=_0xe14b[_0x5e14f5];return _0x2fef43;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbe14('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbe14('0x2')]},'saveName':{'type':Sequelize[_0xbe14('0x2')]},'filename':{'type':Sequelize[_0xbe14('0x2')]},'savePath':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x3')],'get':function(){var _0x39387e='';var _0x196fca=this['getDataValue']('savePath');if(_0x196fca){_0x39387e=_0x196fca['substring'](_0x196fca[_0xbe14('0x4')]('.'));}return _0x39387e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0880817..2740bec 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 _0xbafb=['fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','includeAll','rows','catch','show','rawAttributes','include','SquareRecording','create','body','find','params','download','uniqueid','savePath','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x4c3ab4,_0x31049e){var _0x5baee6=function(_0x44de5b){while(--_0x44de5b){_0x4c3ab4['push'](_0x4c3ab4['shift']());}};_0x5baee6(++_0x31049e);}(_0xbafb,0x10b));var _0xbbaf=function(_0x4c2bfc,_0x57d655){_0x4c2bfc=_0x4c2bfc-0x0;var _0x5218e9=_0xbafb[_0x4c2bfc];return _0x5218e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbaf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbaf('0x1'));var rp=require(_0xbbaf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbaf('0x3'));var util=require(_0xbbaf('0x4'));var path=require(_0xbbaf('0x5'));var sox=require(_0xbbaf('0x6'));var csv=require(_0xbbaf('0x7'));var ejs=require(_0xbbaf('0x8'));var fs=require('fs');var fs_extra=require(_0xbbaf('0x9'));var _=require(_0xbbaf('0xa'));var squel=require('squel');var crypto=require(_0xbbaf('0xb'));var jsforce=require(_0xbbaf('0xc'));var deskjs=require(_0xbbaf('0xd'));var toCsv=require(_0xbbaf('0x7'));var querystring=require('querystring');var Papa=require(_0xbbaf('0xe'));var Redis=require(_0xbbaf('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbbaf('0x10'));var hardwareService=require(_0xbbaf('0x11'));var logger=require(_0xbbaf('0x12'))('api');var utils=require(_0xbbaf('0x13'));var config=require(_0xbbaf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbaf('0x15'))['db'];function respondWithStatusCode(_0xe368b7,_0x510cc1){_0x510cc1=_0x510cc1||0xcc;return function(_0x6393a3){if(_0x6393a3){return _0xe368b7['sendStatus'](_0x510cc1);}return _0xe368b7[_0xbbaf('0x16')](_0x510cc1)[_0xbbaf('0x17')]();};}function respondWithResult(_0x2eedfb,_0x1b6a23){_0x1b6a23=_0x1b6a23||0xc8;return function(_0x19d04c){if(_0x19d04c){return _0x2eedfb['status'](_0x1b6a23)[_0xbbaf('0x18')](_0x19d04c);}};}function respondWithFilteredResult(_0x53ca51,_0x410fae){return function(_0x2faf43){if(_0x2faf43){var _0x5a2915=typeof _0x410fae[_0xbbaf('0x19')]===_0xbbaf('0x1a')&&typeof _0x410fae[_0xbbaf('0x1b')]===_0xbbaf('0x1a');var _0x44ecfc=_0x2faf43[_0xbbaf('0x1c')];var _0x22c7b7=_0x5a2915?0x0:_0x410fae[_0xbbaf('0x19')];var _0x2218dc=_0x5a2915?_0x2faf43[_0xbbaf('0x1c')]:_0x410fae[_0xbbaf('0x19')]+_0x410fae['limit'];var _0xed1193;if(_0x2218dc>=_0x44ecfc){_0x2218dc=_0x44ecfc;_0xed1193=0xc8;}else{_0xed1193=0xce;}_0x53ca51[_0xbbaf('0x16')](_0xed1193);return _0x53ca51[_0xbbaf('0x1d')](_0xbbaf('0x1e'),_0x22c7b7+'-'+_0x2218dc+'/'+_0x44ecfc)['json'](_0x2faf43);}return null;};}function patchUpdates(_0x54f74e){return function(_0x1e4abb){try{jsonpatch['apply'](_0x1e4abb,_0x54f74e,!![]);}catch(_0x30fe76){return BPromise[_0xbbaf('0x1f')](_0x30fe76);}return _0x1e4abb[_0xbbaf('0x20')]();};}function saveUpdates(_0x3301a3,_0x39074a){return function(_0x323a27){if(_0x323a27){return _0x323a27[_0xbbaf('0x21')](_0x3301a3)[_0xbbaf('0x22')](function(_0x3fc28d){return _0x3fc28d;});}return null;};}function removeEntity(_0x3527f1,_0x5f3ee2){return function(_0x3f33fb){if(_0x3f33fb){return _0x3f33fb[_0xbbaf('0x23')]()[_0xbbaf('0x22')](function(){_0x3527f1[_0xbbaf('0x16')](0xcc)[_0xbbaf('0x17')]();});}};}function handleEntityNotFound(_0x2307f6,_0x3e39bf){return function(_0x3fc830){if(!_0x3fc830){_0x2307f6['sendStatus'](0x194);}return _0x3fc830;};}function handleError(_0x18f462,_0x3e6e3b){_0x3e6e3b=_0x3e6e3b||0x1f4;return function(_0x3f2606){logger[_0xbbaf('0x24')](_0x3f2606[_0xbbaf('0x25')]);if(_0x3f2606[_0xbbaf('0x26')]){delete _0x3f2606[_0xbbaf('0x26')];}_0x18f462[_0xbbaf('0x16')](_0x3e6e3b)[_0xbbaf('0x27')](_0x3f2606);};}exports[_0xbbaf('0x28')]=function(_0x5e753c,_0x4e9656){var _0x3a55e6={},_0x139adb={},_0x42ce54={'count':0x0,'rows':[]};var _0x4d6eee=_[_0xbbaf('0x29')](db['SquareRecording']['rawAttributes'],function(_0x39e954){return{'name':_0x39e954[_0xbbaf('0x2a')],'type':_0x39e954['type'][_0xbbaf('0x2b')]};});_0x139adb[_0xbbaf('0x2c')]=_['map'](_0x4d6eee,_0xbbaf('0x26'));_0x139adb[_0xbbaf('0x2d')]=_[_0xbbaf('0x2e')](_0x5e753c[_0xbbaf('0x2d')]);_0x139adb[_0xbbaf('0x2f')]=_[_0xbbaf('0x30')](_0x139adb[_0xbbaf('0x2c')],_0x139adb[_0xbbaf('0x2d')]);_0x3a55e6[_0xbbaf('0x31')]=_[_0xbbaf('0x30')](_0x139adb[_0xbbaf('0x2c')],qs[_0xbbaf('0x32')](_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x32')]));_0x3a55e6[_0xbbaf('0x31')]=_0x3a55e6[_0xbbaf('0x31')][_0xbbaf('0x33')]?_0x3a55e6[_0xbbaf('0x31')]:_0x139adb[_0xbbaf('0x2c')];if(!_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x34')](_0xbbaf('0x35'))){_0x3a55e6['limit']=qs[_0xbbaf('0x1b')](_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x1b')]);_0x3a55e6[_0xbbaf('0x19')]=qs[_0xbbaf('0x19')](_0x5e753c['query'][_0xbbaf('0x19')]);}_0x3a55e6['order']=qs[_0xbbaf('0x36')](_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x36')]);_0x3a55e6[_0xbbaf('0x37')]=qs[_0xbbaf('0x2f')](_['pick'](_0x5e753c[_0xbbaf('0x2d')],_0x139adb['filters']),_0x4d6eee);if(_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x38')]){_0x3a55e6[_0xbbaf('0x37')]=_[_0xbbaf('0x39')](_0x3a55e6[_0xbbaf('0x37')],{'$or':_[_0xbbaf('0x29')](_0x4d6eee,function(_0x2d29f2){if(_0x2d29f2[_0xbbaf('0x3a')]!=='VIRTUAL'){var _0x163f70={};_0x163f70[_0x2d29f2[_0xbbaf('0x26')]]={'$like':'%'+_0x5e753c[_0xbbaf('0x2d')][_0xbbaf('0x38')]+'%'};return _0x163f70;}})});}_0x3a55e6=_['merge']({},_0x3a55e6,_0x5e753c['options']);var _0x1084e3={'where':_0x3a55e6[_0xbbaf('0x37')]};return db['SquareRecording'][_0xbbaf('0x1c')](_0x1084e3)[_0xbbaf('0x22')](function(_0x556ee8){_0x42ce54[_0xbbaf('0x1c')]=_0x556ee8;if(_0x5e753c['query'][_0xbbaf('0x3b')]){_0x3a55e6['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x3a55e6);})[_0xbbaf('0x22')](function(_0x5126e4){_0x42ce54[_0xbbaf('0x3c')]=_0x5126e4;return _0x42ce54;})['then'](respondWithFilteredResult(_0x4e9656,_0x3a55e6))[_0xbbaf('0x3d')](handleError(_0x4e9656,null));};exports[_0xbbaf('0x3e')]=function(_0x2fcc86,_0x3abc5e){var _0x29491a={'raw':!![],'where':{'id':_0x2fcc86['params']['id']}},_0x19cdea={};_0x19cdea[_0xbbaf('0x2c')]=_[_0xbbaf('0x2e')](db['SquareRecording'][_0xbbaf('0x3f')]);_0x19cdea['query']=_[_0xbbaf('0x2e')](_0x2fcc86[_0xbbaf('0x2d')]);_0x19cdea[_0xbbaf('0x2f')]=_[_0xbbaf('0x30')](_0x19cdea[_0xbbaf('0x2c')],_0x19cdea['query']);_0x29491a[_0xbbaf('0x31')]=_[_0xbbaf('0x30')](_0x19cdea['model'],qs['fields'](_0x2fcc86[_0xbbaf('0x2d')][_0xbbaf('0x32')]));_0x29491a['attributes']=_0x29491a[_0xbbaf('0x31')]['length']?_0x29491a['attributes']:_0x19cdea[_0xbbaf('0x2c')];if(_0x2fcc86['query'][_0xbbaf('0x3b')]){_0x29491a[_0xbbaf('0x40')]=[{'all':!![]}];}_0x29491a=_[_0xbbaf('0x39')]({},_0x29491a,_0x2fcc86['options']);return db[_0xbbaf('0x41')]['find'](_0x29491a)[_0xbbaf('0x22')](handleEntityNotFound(_0x3abc5e,null))[_0xbbaf('0x22')](respondWithResult(_0x3abc5e,null))[_0xbbaf('0x3d')](handleError(_0x3abc5e,null));};exports[_0xbbaf('0x42')]=function(_0x2ffb59,_0x47b7e1){return db[_0xbbaf('0x41')][_0xbbaf('0x42')](_0x2ffb59[_0xbbaf('0x43')],{})[_0xbbaf('0x22')](respondWithResult(_0x47b7e1,0xc9))[_0xbbaf('0x3d')](handleError(_0x47b7e1,null));};exports[_0xbbaf('0x21')]=function(_0x58e74f,_0x1d87a3){if(_0x58e74f[_0xbbaf('0x43')]['id']){delete _0x58e74f[_0xbbaf('0x43')]['id'];}return db[_0xbbaf('0x41')][_0xbbaf('0x44')]({'where':{'id':_0x58e74f[_0xbbaf('0x45')]['id']}})[_0xbbaf('0x22')](handleEntityNotFound(_0x1d87a3,null))['then'](saveUpdates(_0x58e74f['body'],null))[_0xbbaf('0x22')](respondWithResult(_0x1d87a3,null))[_0xbbaf('0x3d')](handleError(_0x1d87a3,null));};exports[_0xbbaf('0x46')]=function(_0x22f581,_0x351231,_0xffa241){var _0x266769=require('../../components/encryptor');var _0x3baf41=![];var _0x2a8c19={};if(_0x22f581[_0xbbaf('0x2d')][_0xbbaf('0x3a')]&&_0x22f581[_0xbbaf('0x2d')]['type']==='uniqueid'){_0x2a8c19[_0xbbaf('0x47')]=_0x22f581[_0xbbaf('0x45')]['id'];}else{_0x2a8c19['id']=_0x22f581['params']['id'];}return db[_0xbbaf('0x41')][_0xbbaf('0x44')]({'where':_0x2a8c19,'attributes':['id',_0xbbaf('0x48'),'filename'],'raw':!![]})[_0xbbaf('0x22')](handleEntityNotFound(_0x351231,null))[_0xbbaf('0x22')](function(_0xca7013){if(_0xca7013){var _0x2d8575=_0xca7013[_0xbbaf('0x48')];var _0x3ae0a9=util[_0xbbaf('0x49')]('%s.cypher',_0x2d8575);if(fs['existsSync'](_0x3ae0a9)){_0x3baf41=!![];return _0x266769[_0xbbaf('0x4a')](_0x3ae0a9,_0x2d8575,config[_0xbbaf('0x4b')][_0xbbaf('0x4c')])['then'](function(){return _0xca7013;});}return _0xca7013;}})[_0xbbaf('0x22')](function(_0x34907e){if(_0x34907e){var _0x482f3a=_0x34907e['savePath'];if(!fs[_0xbbaf('0x4d')](_0x482f3a)){throw new db[(_0xbbaf('0x4e'))][(_0xbbaf('0x4f'))](_0xbbaf('0x50'));}if(_0x34907e[_0xbbaf('0x51')]){return _0x351231[_0xbbaf('0x46')](_0x482f3a,_0x34907e[_0xbbaf('0x51')]+path[_0xbbaf('0x52')](_0x482f3a),function(){if(_0x3baf41){fs[_0xbbaf('0x53')](_0x482f3a);}});}else{return _0x351231['download'](_0x482f3a,function(_0x2205b0){if(_0x3baf41){fs[_0xbbaf('0x53')](_0x482f3a);}});}}})[_0xbbaf('0x3d')](function(_0x2ffc81){if(_0x2ffc81['message']===_0xbbaf('0x50')){_0x351231[_0xbbaf('0x16')](0x194)[_0xbbaf('0x27')](_0xbbaf('0x54'));}else{return handleError(_0x351231,null);}});};exports[_0xbbaf('0x23')]=function(_0x418870,_0x481969){return db[_0xbbaf('0x41')][_0xbbaf('0x44')]({'where':{'id':_0x418870[_0xbbaf('0x45')]['id']}})['then'](function(_0x2016c2){if(_[_0xbbaf('0x55')](_0x2016c2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2016c2;})[_0xbbaf('0x22')](function(_0x546cb3){var _0x380b41=_0x546cb3['savePath'];logger[_0xbbaf('0x56')](_0xbbaf('0x57'),_0x380b41);if(!_['isNil'](_0x546cb3['savePath'])&&fs[_0xbbaf('0x4d')](_0x380b41)){logger[_0xbbaf('0x56')](_0xbbaf('0x58')+_0x380b41+_0xbbaf('0x59'));fs[_0xbbaf('0x5a')](_0x380b41);}_0x380b41=_0x380b41+_0xbbaf('0x5b');if(!_['isNil'](_0x546cb3[_0xbbaf('0x48')])&&fs[_0xbbaf('0x4d')](_0x380b41)){logger[_0xbbaf('0x56')]('File:\x20\x22'+_0x380b41+_0xbbaf('0x59'));fs['unlinkSync'](_0x380b41);}return _0x546cb3;})[_0xbbaf('0x22')](function(_0x5d9f1c){if(!_0x5d9f1c)throw new InternalError();return _0x5d9f1c[_0xbbaf('0x23')]();})[_0xbbaf('0x22')](function(){_0x481969[_0xbbaf('0x16')](0xcc)[_0xbbaf('0x17')]();})[_0xbbaf('0x3d')](handleError(_0x481969,null));}; \ No newline at end of file +var _0x3be9=['fieldName','type','key','model','keys','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','show','SquareRecording','attributes','find','catch','create','update','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','unlink','message','SquareRecording\x20not\x20found','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','info','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','save','then','error','stack','name','send','index','map','rawAttributes'];(function(_0xabf5c8,_0x160c31){var _0x5d5ffe=function(_0x2618b5){while(--_0x2618b5){_0xabf5c8['push'](_0xabf5c8['shift']());}};_0x5d5ffe(++_0x160c31);}(_0x3be9,0xfe));var _0x93be=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x3be9[_0xd21fe7];return _0x14d570;};'use strict';var emlformat=require(_0x93be('0x0'));var rimraf=require(_0x93be('0x1'));var zipdir=require(_0x93be('0x2'));var jsonpatch=require(_0x93be('0x3'));var rp=require('request-promise');var moment=require(_0x93be('0x4'));var BPromise=require(_0x93be('0x5'));var Mustache=require(_0x93be('0x6'));var util=require(_0x93be('0x7'));var path=require('path');var sox=require(_0x93be('0x8'));var csv=require(_0x93be('0x9'));var ejs=require(_0x93be('0xa'));var fs=require('fs');var fs_extra=require(_0x93be('0xb'));var _=require(_0x93be('0xc'));var squel=require('squel');var crypto=require(_0x93be('0xd'));var jsforce=require(_0x93be('0xe'));var deskjs=require(_0x93be('0xf'));var toCsv=require(_0x93be('0x9'));var querystring=require(_0x93be('0x10'));var Papa=require(_0x93be('0x11'));var Redis=require(_0x93be('0x12'));var authService=require(_0x93be('0x13'));var qs=require(_0x93be('0x14'));var as=require(_0x93be('0x15'));var hardwareService=require(_0x93be('0x16'));var logger=require(_0x93be('0x17'))(_0x93be('0x18'));var utils=require('../../config/utils');var config=require(_0x93be('0x19'));var licenseUtil=require(_0x93be('0x1a'));var db=require(_0x93be('0x1b'))['db'];function respondWithStatusCode(_0x3a1393,_0x5e14a4){_0x5e14a4=_0x5e14a4||0xcc;return function(_0x5e3304){if(_0x5e3304){return _0x3a1393[_0x93be('0x1c')](_0x5e14a4);}return _0x3a1393[_0x93be('0x1d')](_0x5e14a4)[_0x93be('0x1e')]();};}function respondWithResult(_0x55e6ea,_0x1d8814){_0x1d8814=_0x1d8814||0xc8;return function(_0x153b1d){if(_0x153b1d){return _0x55e6ea[_0x93be('0x1d')](_0x1d8814)[_0x93be('0x1f')](_0x153b1d);}};}function respondWithFilteredResult(_0x313796,_0x220061){return function(_0x3702b4){if(_0x3702b4){var _0x4fc38d=typeof _0x220061['offset']==='undefined'&&typeof _0x220061[_0x93be('0x20')]==='undefined';var _0x3a5115=_0x3702b4['count'];var _0x12f8a3=_0x4fc38d?0x0:_0x220061[_0x93be('0x21')];var _0x2573a8=_0x4fc38d?_0x3702b4[_0x93be('0x22')]:_0x220061[_0x93be('0x21')]+_0x220061[_0x93be('0x20')];var _0x5a5ebe;if(_0x2573a8>=_0x3a5115){_0x2573a8=_0x3a5115;_0x5a5ebe=0xc8;}else{_0x5a5ebe=0xce;}_0x313796[_0x93be('0x1d')](_0x5a5ebe);return _0x313796['set'](_0x93be('0x23'),_0x12f8a3+'-'+_0x2573a8+'/'+_0x3a5115)[_0x93be('0x1f')](_0x3702b4);}return null;};}function patchUpdates(_0x3a2e22){return function(_0x4079ec){try{jsonpatch[_0x93be('0x24')](_0x4079ec,_0x3a2e22,!![]);}catch(_0x58b242){return BPromise['reject'](_0x58b242);}return _0x4079ec[_0x93be('0x25')]();};}function saveUpdates(_0x5b4a39,_0xff25e9){return function(_0x49e8b6){if(_0x49e8b6){return _0x49e8b6['update'](_0x5b4a39)[_0x93be('0x26')](function(_0xfda562){return _0xfda562;});}return null;};}function removeEntity(_0x3d0e9b,_0x217d3a){return function(_0x5d31c4){if(_0x5d31c4){return _0x5d31c4['destroy']()['then'](function(){_0x3d0e9b[_0x93be('0x1d')](0xcc)[_0x93be('0x1e')]();});}};}function handleEntityNotFound(_0x45414b,_0x11fa72){return function(_0x1cf338){if(!_0x1cf338){_0x45414b[_0x93be('0x1c')](0x194);}return _0x1cf338;};}function handleError(_0x9708da,_0x55484f){_0x55484f=_0x55484f||0x1f4;return function(_0x2b947c){logger[_0x93be('0x27')](_0x2b947c[_0x93be('0x28')]);if(_0x2b947c[_0x93be('0x29')]){delete _0x2b947c[_0x93be('0x29')];}_0x9708da[_0x93be('0x1d')](_0x55484f)[_0x93be('0x2a')](_0x2b947c);};}exports[_0x93be('0x2b')]=function(_0x11b126,_0x43d904){var _0x310233={},_0x506a27={},_0x2d0a21={'count':0x0,'rows':[]};var _0x82b6a5=_[_0x93be('0x2c')](db['SquareRecording'][_0x93be('0x2d')],function(_0x5454d6){return{'name':_0x5454d6[_0x93be('0x2e')],'type':_0x5454d6[_0x93be('0x2f')][_0x93be('0x30')]};});_0x506a27[_0x93be('0x31')]=_[_0x93be('0x2c')](_0x82b6a5,_0x93be('0x29'));_0x506a27['query']=_[_0x93be('0x32')](_0x11b126[_0x93be('0x33')]);_0x506a27[_0x93be('0x34')]=_[_0x93be('0x35')](_0x506a27['model'],_0x506a27[_0x93be('0x33')]);_0x310233['attributes']=_[_0x93be('0x35')](_0x506a27[_0x93be('0x31')],qs[_0x93be('0x36')](_0x11b126[_0x93be('0x33')][_0x93be('0x36')]));_0x310233['attributes']=_0x310233['attributes'][_0x93be('0x37')]?_0x310233['attributes']:_0x506a27[_0x93be('0x31')];if(!_0x11b126['query'][_0x93be('0x38')](_0x93be('0x39'))){_0x310233['limit']=qs[_0x93be('0x20')](_0x11b126[_0x93be('0x33')][_0x93be('0x20')]);_0x310233[_0x93be('0x21')]=qs['offset'](_0x11b126[_0x93be('0x33')][_0x93be('0x21')]);}_0x310233[_0x93be('0x3a')]=qs[_0x93be('0x3b')](_0x11b126[_0x93be('0x33')][_0x93be('0x3b')]);_0x310233[_0x93be('0x3c')]=qs[_0x93be('0x34')](_[_0x93be('0x3d')](_0x11b126[_0x93be('0x33')],_0x506a27[_0x93be('0x34')]),_0x82b6a5);if(_0x11b126[_0x93be('0x33')]['filter']){_0x310233[_0x93be('0x3c')]=_[_0x93be('0x3e')](_0x310233[_0x93be('0x3c')],{'$or':_['map'](_0x82b6a5,function(_0x4b8ae5){if(_0x4b8ae5[_0x93be('0x2f')]!=='VIRTUAL'){var _0x2b62c2={};_0x2b62c2[_0x4b8ae5[_0x93be('0x29')]]={'$like':'%'+_0x11b126[_0x93be('0x33')]['filter']+'%'};return _0x2b62c2;}})});}_0x310233=_[_0x93be('0x3e')]({},_0x310233,_0x11b126[_0x93be('0x3f')]);var _0x4d4717={'where':_0x310233['where']};return db['SquareRecording'][_0x93be('0x22')](_0x4d4717)[_0x93be('0x26')](function(_0x4b4b49){_0x2d0a21['count']=_0x4b4b49;if(_0x11b126['query'][_0x93be('0x40')]){_0x310233[_0x93be('0x41')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x310233);})[_0x93be('0x26')](function(_0x15efbb){_0x2d0a21[_0x93be('0x42')]=_0x15efbb;return _0x2d0a21;})[_0x93be('0x26')](respondWithFilteredResult(_0x43d904,_0x310233))['catch'](handleError(_0x43d904,null));};exports[_0x93be('0x43')]=function(_0x563678,_0x472e57){var _0x41cfab={'raw':!![],'where':{'id':_0x563678['params']['id']}},_0x1383b5={};_0x1383b5[_0x93be('0x31')]=_['keys'](db[_0x93be('0x44')][_0x93be('0x2d')]);_0x1383b5['query']=_[_0x93be('0x32')](_0x563678[_0x93be('0x33')]);_0x1383b5[_0x93be('0x34')]=_[_0x93be('0x35')](_0x1383b5[_0x93be('0x31')],_0x1383b5['query']);_0x41cfab[_0x93be('0x45')]=_[_0x93be('0x35')](_0x1383b5[_0x93be('0x31')],qs['fields'](_0x563678['query'][_0x93be('0x36')]));_0x41cfab[_0x93be('0x45')]=_0x41cfab[_0x93be('0x45')][_0x93be('0x37')]?_0x41cfab['attributes']:_0x1383b5[_0x93be('0x31')];if(_0x563678['query'][_0x93be('0x40')]){_0x41cfab[_0x93be('0x41')]=[{'all':!![]}];}_0x41cfab=_[_0x93be('0x3e')]({},_0x41cfab,_0x563678[_0x93be('0x3f')]);return db[_0x93be('0x44')][_0x93be('0x46')](_0x41cfab)['then'](handleEntityNotFound(_0x472e57,null))[_0x93be('0x26')](respondWithResult(_0x472e57,null))[_0x93be('0x47')](handleError(_0x472e57,null));};exports[_0x93be('0x48')]=function(_0x1d576a,_0x6cc73b){return db['SquareRecording']['create'](_0x1d576a['body'],{})['then'](respondWithResult(_0x6cc73b,0xc9))['catch'](handleError(_0x6cc73b,null));};exports[_0x93be('0x49')]=function(_0x484eaf,_0x790b21){if(_0x484eaf['body']['id']){delete _0x484eaf[_0x93be('0x4a')]['id'];}return db[_0x93be('0x44')][_0x93be('0x46')]({'where':{'id':_0x484eaf[_0x93be('0x4b')]['id']}})[_0x93be('0x26')](handleEntityNotFound(_0x790b21,null))['then'](saveUpdates(_0x484eaf[_0x93be('0x4a')],null))[_0x93be('0x26')](respondWithResult(_0x790b21,null))[_0x93be('0x47')](handleError(_0x790b21,null));};exports[_0x93be('0x4c')]=function(_0x31bcbd,_0x29cee6,_0x208412){var _0x56251c=require(_0x93be('0x4d'));var _0x2ceca8=![];var _0x4cdc12={};if(_0x31bcbd[_0x93be('0x33')][_0x93be('0x2f')]&&_0x31bcbd[_0x93be('0x33')]['type']===_0x93be('0x4e')){_0x4cdc12[_0x93be('0x4e')]=_0x31bcbd['params']['id'];}else{_0x4cdc12['id']=_0x31bcbd[_0x93be('0x4b')]['id'];}return db[_0x93be('0x44')]['find']({'where':_0x4cdc12,'attributes':['id',_0x93be('0x4f'),_0x93be('0x50')],'raw':!![]})[_0x93be('0x26')](handleEntityNotFound(_0x29cee6,null))['then'](function(_0x2ac519){if(_0x2ac519){var _0x3e4b04=_0x2ac519[_0x93be('0x4f')];var _0x476a0d=util[_0x93be('0x51')](_0x93be('0x52'),_0x3e4b04);if(fs['existsSync'](_0x476a0d)){_0x2ceca8=!![];return _0x56251c[_0x93be('0x53')](_0x476a0d,_0x3e4b04,config[_0x93be('0x54')][_0x93be('0x55')])[_0x93be('0x26')](function(){return _0x2ac519;});}return _0x2ac519;}})['then'](function(_0x6781d4){if(_0x6781d4){var _0x57c9a7=_0x6781d4[_0x93be('0x4f')];if(!fs[_0x93be('0x56')](_0x57c9a7)){throw new db[(_0x93be('0x57'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x6781d4[_0x93be('0x50')]){return _0x29cee6[_0x93be('0x4c')](_0x57c9a7,_0x6781d4[_0x93be('0x50')]+path['extname'](_0x57c9a7),function(){if(_0x2ceca8){fs[_0x93be('0x58')](_0x57c9a7);}});}else{return _0x29cee6[_0x93be('0x4c')](_0x57c9a7,function(_0x1b265b){if(_0x2ceca8){fs['unlink'](_0x57c9a7);}});}}})[_0x93be('0x47')](function(_0xb69fd9){if(_0xb69fd9[_0x93be('0x59')]===_0x93be('0x5a')){_0x29cee6['status'](0x194)['send'](_0x93be('0x5b'));}else{return handleError(_0x29cee6,null);}});};exports[_0x93be('0x5c')]=function(_0x21c636,_0x1a2950){return db[_0x93be('0x44')][_0x93be('0x46')]({'where':{'id':_0x21c636[_0x93be('0x4b')]['id']}})[_0x93be('0x26')](function(_0x394df3){if(_[_0x93be('0x5d')](_0x394df3)){throw new ReferenceError(_0x93be('0x5e'));}return _0x394df3;})[_0x93be('0x26')](function(_0x2ebc40){var _0x3eb08b=_0x2ebc40[_0x93be('0x4f')];logger['info'](_0x93be('0x5f'),_0x3eb08b);if(!_[_0x93be('0x5d')](_0x2ebc40[_0x93be('0x4f')])&&fs[_0x93be('0x56')](_0x3eb08b)){logger['info'](_0x93be('0x60')+_0x3eb08b+_0x93be('0x61'));fs['unlinkSync'](_0x3eb08b);}_0x3eb08b=_0x3eb08b+'.cypher';if(!_['isNil'](_0x2ebc40[_0x93be('0x4f')])&&fs[_0x93be('0x56')](_0x3eb08b)){logger[_0x93be('0x62')]('File:\x20\x22'+_0x3eb08b+_0x93be('0x61'));fs[_0x93be('0x63')](_0x3eb08b);}return _0x2ebc40;})['then'](function(_0xdd1c41){if(!_0xdd1c41)throw new InternalError();return _0xdd1c41[_0x93be('0x5c')]();})[_0x93be('0x26')](function(){_0x1a2950[_0x93be('0x1d')](0xcc)['end']();})[_0x93be('0x47')](handleError(_0x1a2950,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fbadf91..f01ab6d 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 _0xb1ad=['moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api'];(function(_0x236ed0,_0x32686a){var _0x18ea82=function(_0x3cadbb){while(--_0x3cadbb){_0x236ed0['push'](_0x236ed0['shift']());}};_0x18ea82(++_0x32686a);}(_0xb1ad,0x184));var _0xdb1a=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb1ad[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var logger=require(_0xdb1a('0x2'))(_0xdb1a('0x3'));var moment=require(_0xdb1a('0x4'));var BPromise=require(_0xdb1a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb1a('0x6'));var rimraf=require(_0xdb1a('0x7'));var config=require(_0xdb1a('0x8'));var attributes=require(_0xdb1a('0x9'));module[_0xdb1a('0xa')]=function(_0x3a19a1,_0x368208){return _0x3a19a1[_0xdb1a('0xb')](_0xdb1a('0xc'),attributes,{'tableName':_0xdb1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings'];(function(_0x230cdf,_0x5e38c3){var _0xb89da8=function(_0x34197c){while(--_0x34197c){_0x230cdf['push'](_0x230cdf['shift']());}};_0xb89da8(++_0x5e38c3);}(_0x2d72,0xa8));var _0x22d7=function(_0xbec98d,_0x5d7675){_0xbec98d=_0xbec98d-0x0;var _0x17cfdf=_0x2d72[_0xbec98d];return _0x17cfdf;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 c6c51d8..81cd5ba 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 _0x2b52=['SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0x576d66,_0x10dfa3){var _0x534452=function(_0x4736f3){while(--_0x4736f3){_0x576d66['push'](_0x576d66['shift']());}};_0x534452(++_0x10dfa3);}(_0x2b52,0x187));var _0x22b5=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x2b52[_0x644ecd];return _0x1c66ce;};'use strict';var _=require(_0x22b5('0x0'));var util=require(_0x22b5('0x1'));var moment=require(_0x22b5('0x2'));var BPromise=require(_0x22b5('0x3'));var rs=require(_0x22b5('0x4'));var fs=require('fs');var Redis=require(_0x22b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x22b5('0x6'));var logger=require(_0x22b5('0x7'))(_0x22b5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x22b5('0x9')][_0x22b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7c69,_0x39d960,_0x228010){return new BPromise(function(_0x396ff7,_0x38c8b5){return client[_0x22b5('0xb')](_0x4a7c69,_0x228010)['then'](function(_0x26bb16){logger[_0x22b5('0xc')](_0x22b5('0xd'),_0x39d960,'request\x20sent');logger['debug'](_0x22b5('0xe'),_0x39d960,_0x22b5('0xf'),JSON[_0x22b5('0x10')](_0x26bb16));if(_0x26bb16[_0x22b5('0x11')]){if(_0x26bb16[_0x22b5('0x11')][_0x22b5('0x12')]===0x1f4){logger[_0x22b5('0x11')](_0x22b5('0xd'),_0x39d960,_0x26bb16[_0x22b5('0x11')][_0x22b5('0x13')]);return _0x38c8b5(_0x26bb16[_0x22b5('0x11')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x39d960,_0x26bb16[_0x22b5('0x11')][_0x22b5('0x13')]);return _0x396ff7(_0x26bb16['error'][_0x22b5('0x13')]);}else{logger[_0x22b5('0xc')]('SquareRecording,\x20%s,\x20%s',_0x39d960,_0x22b5('0xf'));_0x396ff7(_0x26bb16[_0x22b5('0x14')][_0x22b5('0x13')]);}})['catch'](function(_0x1d1e52){logger[_0x22b5('0x11')](_0x22b5('0xd'),_0x39d960,_0x1d1e52);_0x38c8b5(_0x1d1e52);});});}exports[_0x22b5('0x15')]=function(_0x4008d3){var _0x3ddada=this;return new Promise(function(_0x1c2b63,_0x182149){return db['SquareRecording']['create'](_0x4008d3[_0x22b5('0x16')],{'raw':_0x4008d3[_0x22b5('0x17')]?_0x4008d3['options'][_0x22b5('0x18')]===undefined?!![]:![]:!![]})[_0x22b5('0x19')](function(_0x5c7beb){logger[_0x22b5('0xc')](_0x22b5('0x15'),_0x4008d3);logger[_0x22b5('0x1a')](_0x22b5('0x15'),_0x4008d3,JSON[_0x22b5('0x10')](_0x5c7beb));_0x1c2b63(_0x5c7beb);})['catch'](function(_0x586de7){logger[_0x22b5('0x11')]('CreateSquareRecording',_0x586de7[_0x22b5('0x13')],_0x4008d3);_0x182149(_0x3ddada['error'](0x1f4,_0x586de7[_0x22b5('0x13')]));});});}; \ No newline at end of file +var _0x5f38=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x604546,_0x38ccf9){var _0x17809a=function(_0x235b14){while(--_0x235b14){_0x604546['push'](_0x604546['shift']());}};_0x17809a(++_0x38ccf9);}(_0x5f38,0x19c));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85f3('0x0'));var util=require(_0x85f3('0x1'));var moment=require('moment');var BPromise=require(_0x85f3('0x2'));var rs=require(_0x85f3('0x3'));var fs=require('fs');var Redis=require(_0x85f3('0x4'));var db=require(_0x85f3('0x5'))['db'];var utils=require(_0x85f3('0x6'));var logger=require(_0x85f3('0x7'))(_0x85f3('0x8'));var config=require(_0x85f3('0x9'));var jayson=require(_0x85f3('0xa'));var client=jayson[_0x85f3('0xb')][_0x85f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4463ab,_0x3f363c,_0x56ea33){return new BPromise(function(_0x585db2,_0x46cdc6){return client[_0x85f3('0xd')](_0x4463ab,_0x56ea33)[_0x85f3('0xe')](function(_0x437047){logger[_0x85f3('0xf')]('SquareRecording,\x20%s,\x20%s',_0x3f363c,_0x85f3('0x10'));logger[_0x85f3('0x11')](_0x85f3('0x12'),_0x3f363c,_0x85f3('0x10'),JSON[_0x85f3('0x13')](_0x437047));if(_0x437047['error']){if(_0x437047[_0x85f3('0x14')][_0x85f3('0x15')]===0x1f4){logger[_0x85f3('0x14')](_0x85f3('0x16'),_0x3f363c,_0x437047[_0x85f3('0x14')][_0x85f3('0x17')]);return _0x46cdc6(_0x437047[_0x85f3('0x14')][_0x85f3('0x17')]);}logger[_0x85f3('0x14')](_0x85f3('0x16'),_0x3f363c,_0x437047['error'][_0x85f3('0x17')]);return _0x585db2(_0x437047['error'][_0x85f3('0x17')]);}else{logger[_0x85f3('0xf')](_0x85f3('0x16'),_0x3f363c,_0x85f3('0x10'));_0x585db2(_0x437047['result'][_0x85f3('0x17')]);}})[_0x85f3('0x18')](function(_0x520e58){logger['error'](_0x85f3('0x16'),_0x3f363c,_0x520e58);_0x46cdc6(_0x520e58);});});}exports[_0x85f3('0x19')]=function(_0x1f85fd){var _0x39a38c=this;return new Promise(function(_0x2a5db2,_0x524b75){return db['SquareRecording'][_0x85f3('0x1a')](_0x1f85fd[_0x85f3('0x1b')],{'raw':_0x1f85fd[_0x85f3('0x1c')]?_0x1f85fd['options'][_0x85f3('0x1d')]===undefined?!![]:![]:!![]})[_0x85f3('0xe')](function(_0x22efdf){logger['info'](_0x85f3('0x19'),_0x1f85fd);logger['debug']('CreateSquareRecording',_0x1f85fd,JSON[_0x85f3('0x13')](_0x22efdf));_0x2a5db2(_0x22efdf);})[_0x85f3('0x18')](function(_0x42ad2b){logger[_0x85f3('0x14')](_0x85f3('0x19'),_0x42ad2b[_0x85f3('0x17')],_0x1f85fd);_0x524b75(_0x39a38c['error'](0x1f4,_0x42ad2b[_0x85f3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index cc5a5a8..f314abd 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x13a275,_0x3959a5){var _0x45919a=function(_0x56cb70){while(--_0x56cb70){_0x13a275['push'](_0x13a275['shift']());}};_0x45919a(++_0x3959a5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2cfbcf,_0x2cf96f){var _0x41fc13=function(_0x4d7a26){while(--_0x4d7a26){_0x2cfbcf['push'](_0x2cfbcf['shift']());}};_0x41fc13(++_0x2cf96f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3a8541b..dde71ac 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 _0x6a48=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x2e3d51,_0x5c7b75){var _0x1a4ad9=function(_0x3fd759){while(--_0x3fd759){_0x2e3d51['push'](_0x2e3d51['shift']());}};_0x1a4ad9(++_0x5c7b75);}(_0x6a48,0x19c));var _0x86a4=function(_0x8446ca,_0x10636a){_0x8446ca=_0x8446ca-0x0;var _0x1c482d=_0x6a48[_0x8446ca];return _0x1c482d;};'use strict';var Sequelize=require(_0x86a4('0x0'));module[_0x86a4('0x1')]={'network':{'type':Sequelize[_0x86a4('0x2')]},'network_script':{'type':Sequelize[_0x86a4('0x2')]},'request':{'type':Sequelize[_0x86a4('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x86a4('0x2')]},'uniqueid':{'type':Sequelize[_0x86a4('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x86a4('0x2')]},'callingpres':{'type':Sequelize[_0x86a4('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x86a4('0x2')]},'dnid':{'type':Sequelize[_0x86a4('0x2')]},'rdnis':{'type':Sequelize[_0x86a4('0x2')]},'context':{'type':Sequelize[_0x86a4('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x86a4('0x2')]},'enhanced':{'type':Sequelize[_0x86a4('0x2')]},'accountcode':{'type':Sequelize[_0x86a4('0x2')]},'threadid':{'type':Sequelize[_0x86a4('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x86a4('0x3')]},'leaveAt':{'type':Sequelize[_0x86a4('0x3')]},'bot':{'type':Sequelize[_0x86a4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c6a=['BOOLEAN','exports','STRING','DATE'];(function(_0x5c0503,_0x1d8608){var _0x4bf40f=function(_0x3f105d){while(--_0x3f105d){_0x5c0503['push'](_0x5c0503['shift']());}};_0x4bf40f(++_0x1d8608);}(_0x8c6a,0x1b5));var _0xa8c6=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8c6a[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0xa8c6('0x0')]={'network':{'type':Sequelize[_0xa8c6('0x1')]},'network_script':{'type':Sequelize[_0xa8c6('0x1')]},'request':{'type':Sequelize[_0xa8c6('0x1')]},'channel':{'type':Sequelize[_0xa8c6('0x1')]},'language':{'type':Sequelize[_0xa8c6('0x1')]},'type':{'type':Sequelize[_0xa8c6('0x1')]},'uniqueid':{'type':Sequelize[_0xa8c6('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa8c6('0x1')]},'callingani2':{'type':Sequelize[_0xa8c6('0x1')]},'callington':{'type':Sequelize[_0xa8c6('0x1')]},'callingtns':{'type':Sequelize[_0xa8c6('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8c6('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa8c6('0x1')]},'threadid':{'type':Sequelize[_0xa8c6('0x1')]},'project_name':{'type':Sequelize[_0xa8c6('0x1')]},'joinAt':{'type':Sequelize[_0xa8c6('0x2')]},'leaveAt':{'type':Sequelize[_0xa8c6('0x2')]},'bot':{'type':Sequelize[_0xa8c6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 444b357..4c37829 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 _0xe445=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','SquareReport','includeAll','include','findAll','rows','catch','params','merge','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xe445,0x1db));var _0x5e44=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xe445[_0x12a2a6];return _0x1754ae;};'use strict';var emlformat=require(_0x5e44('0x0'));var rimraf=require(_0x5e44('0x1'));var zipdir=require(_0x5e44('0x2'));var jsonpatch=require(_0x5e44('0x3'));var rp=require(_0x5e44('0x4'));var moment=require('moment');var BPromise=require(_0x5e44('0x5'));var Mustache=require(_0x5e44('0x6'));var util=require(_0x5e44('0x7'));var path=require('path');var sox=require(_0x5e44('0x8'));var csv=require('to-csv');var ejs=require(_0x5e44('0x9'));var fs=require('fs');var fs_extra=require(_0x5e44('0xa'));var _=require(_0x5e44('0xb'));var squel=require(_0x5e44('0xc'));var crypto=require(_0x5e44('0xd'));var jsforce=require(_0x5e44('0xe'));var deskjs=require(_0x5e44('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5e44('0x10'));var Papa=require(_0x5e44('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5e44('0x12'));var as=require(_0x5e44('0x13'));var hardwareService=require(_0x5e44('0x14'));var logger=require(_0x5e44('0x15'))(_0x5e44('0x16'));var utils=require(_0x5e44('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5e44('0x18'))['db'];function respondWithStatusCode(_0x20d723,_0x3af382){_0x3af382=_0x3af382||0xcc;return function(_0x5050a0){if(_0x5050a0){return _0x20d723['sendStatus'](_0x3af382);}return _0x20d723[_0x5e44('0x19')](_0x3af382)[_0x5e44('0x1a')]();};}function respondWithResult(_0x43bbad,_0x32f0c3){_0x32f0c3=_0x32f0c3||0xc8;return function(_0x1c859c){if(_0x1c859c){return _0x43bbad[_0x5e44('0x19')](_0x32f0c3)[_0x5e44('0x1b')](_0x1c859c);}};}function respondWithFilteredResult(_0x423e7e,_0x5e0354){return function(_0x28ca90){if(_0x28ca90){var _0x59045b=typeof _0x5e0354[_0x5e44('0x1c')]===_0x5e44('0x1d')&&typeof _0x5e0354[_0x5e44('0x1e')]===_0x5e44('0x1d');var _0xdd5770=_0x28ca90[_0x5e44('0x1f')];var _0x42bbe8=_0x59045b?0x0:_0x5e0354[_0x5e44('0x1c')];var _0x16fc1c=_0x59045b?_0x28ca90['count']:_0x5e0354[_0x5e44('0x1c')]+_0x5e0354[_0x5e44('0x1e')];var _0x1c1989;if(_0x16fc1c>=_0xdd5770){_0x16fc1c=_0xdd5770;_0x1c1989=0xc8;}else{_0x1c1989=0xce;}_0x423e7e[_0x5e44('0x19')](_0x1c1989);return _0x423e7e['set']('Content-Range',_0x42bbe8+'-'+_0x16fc1c+'/'+_0xdd5770)['json'](_0x28ca90);}return null;};}function patchUpdates(_0x3010df){return function(_0x4b5df2){try{jsonpatch[_0x5e44('0x20')](_0x4b5df2,_0x3010df,!![]);}catch(_0x265723){return BPromise[_0x5e44('0x21')](_0x265723);}return _0x4b5df2[_0x5e44('0x22')]();};}function saveUpdates(_0x1491aa,_0x5935d0){return function(_0x5621b4){if(_0x5621b4){return _0x5621b4['update'](_0x1491aa)[_0x5e44('0x23')](function(_0x4404db){return _0x4404db;});}return null;};}function removeEntity(_0x1dca9d,_0x248c6f){return function(_0xf35977){if(_0xf35977){return _0xf35977[_0x5e44('0x24')]()[_0x5e44('0x23')](function(){_0x1dca9d[_0x5e44('0x19')](0xcc)[_0x5e44('0x1a')]();});}};}function handleEntityNotFound(_0x238cfb,_0x22062b){return function(_0x2fd6fc){if(!_0x2fd6fc){_0x238cfb['sendStatus'](0x194);}return _0x2fd6fc;};}function handleError(_0x30a752,_0x411094){_0x411094=_0x411094||0x1f4;return function(_0x32cc35){logger[_0x5e44('0x25')](_0x32cc35[_0x5e44('0x26')]);if(_0x32cc35['name']){delete _0x32cc35[_0x5e44('0x27')];}_0x30a752[_0x5e44('0x19')](_0x411094)[_0x5e44('0x28')](_0x32cc35);};}exports['index']=function(_0x35b759,_0x47d03f){var _0x2f8571={},_0xaa1288={},_0x531e77={'count':0x0,'rows':[]};var _0x1253db=_[_0x5e44('0x29')](db['SquareReport'][_0x5e44('0x2a')],function(_0x143d7f){return{'name':_0x143d7f[_0x5e44('0x2b')],'type':_0x143d7f['type'][_0x5e44('0x2c')]};});_0xaa1288[_0x5e44('0x2d')]=_[_0x5e44('0x29')](_0x1253db,'name');_0xaa1288[_0x5e44('0x2e')]=_[_0x5e44('0x2f')](_0x35b759['query']);_0xaa1288[_0x5e44('0x30')]=_[_0x5e44('0x31')](_0xaa1288[_0x5e44('0x2d')],_0xaa1288['query']);_0x2f8571[_0x5e44('0x32')]=_[_0x5e44('0x31')](_0xaa1288[_0x5e44('0x2d')],qs[_0x5e44('0x33')](_0x35b759['query'][_0x5e44('0x33')]));_0x2f8571['attributes']=_0x2f8571[_0x5e44('0x32')][_0x5e44('0x34')]?_0x2f8571['attributes']:_0xaa1288[_0x5e44('0x2d')];if(!_0x35b759[_0x5e44('0x2e')][_0x5e44('0x35')]('nolimit')){_0x2f8571[_0x5e44('0x1e')]=qs['limit'](_0x35b759[_0x5e44('0x2e')]['limit']);_0x2f8571[_0x5e44('0x1c')]=qs[_0x5e44('0x1c')](_0x35b759[_0x5e44('0x2e')][_0x5e44('0x1c')]);}_0x2f8571[_0x5e44('0x36')]=qs[_0x5e44('0x37')](_0x35b759[_0x5e44('0x2e')]['sort']);_0x2f8571[_0x5e44('0x38')]=qs['filters'](_[_0x5e44('0x39')](_0x35b759['query'],_0xaa1288[_0x5e44('0x30')]),_0x1253db);if(_0x35b759[_0x5e44('0x2e')]['filter']){_0x2f8571[_0x5e44('0x38')]=_['merge'](_0x2f8571[_0x5e44('0x38')],{'$or':_[_0x5e44('0x29')](_0x1253db,function(_0x4180bb){if(_0x4180bb[_0x5e44('0x3a')]!==_0x5e44('0x3b')){var _0x2b61df={};_0x2b61df[_0x4180bb[_0x5e44('0x27')]]={'$like':'%'+_0x35b759[_0x5e44('0x2e')][_0x5e44('0x3c')]+'%'};return _0x2b61df;}})});}_0x2f8571=_['merge']({},_0x2f8571,_0x35b759[_0x5e44('0x3d')]);var _0x4ff964={'where':_0x2f8571[_0x5e44('0x38')]};return db[_0x5e44('0x3e')][_0x5e44('0x1f')](_0x4ff964)['then'](function(_0x309baf){_0x531e77['count']=_0x309baf;if(_0x35b759[_0x5e44('0x2e')][_0x5e44('0x3f')]){_0x2f8571[_0x5e44('0x40')]=[{'all':!![]}];}return db[_0x5e44('0x3e')][_0x5e44('0x41')](_0x2f8571);})['then'](function(_0x16c7c2){_0x531e77[_0x5e44('0x42')]=_0x16c7c2;return _0x531e77;})['then'](respondWithFilteredResult(_0x47d03f,_0x2f8571))[_0x5e44('0x43')](handleError(_0x47d03f,null));};exports['show']=function(_0x50082a,_0x439d6e){var _0x1c027a={'raw':!![],'where':{'id':_0x50082a[_0x5e44('0x44')]['id']}},_0x1e91b1={};_0x1e91b1[_0x5e44('0x2d')]=_[_0x5e44('0x2f')](db[_0x5e44('0x3e')]['rawAttributes']);_0x1e91b1['query']=_['keys'](_0x50082a[_0x5e44('0x2e')]);_0x1e91b1[_0x5e44('0x30')]=_[_0x5e44('0x31')](_0x1e91b1[_0x5e44('0x2d')],_0x1e91b1[_0x5e44('0x2e')]);_0x1c027a['attributes']=_[_0x5e44('0x31')](_0x1e91b1[_0x5e44('0x2d')],qs[_0x5e44('0x33')](_0x50082a[_0x5e44('0x2e')][_0x5e44('0x33')]));_0x1c027a[_0x5e44('0x32')]=_0x1c027a[_0x5e44('0x32')][_0x5e44('0x34')]?_0x1c027a['attributes']:_0x1e91b1[_0x5e44('0x2d')];if(_0x50082a[_0x5e44('0x2e')][_0x5e44('0x3f')]){_0x1c027a[_0x5e44('0x40')]=[{'all':!![]}];}_0x1c027a=_[_0x5e44('0x45')]({},_0x1c027a,_0x50082a[_0x5e44('0x3d')]);return db[_0x5e44('0x3e')]['find'](_0x1c027a)['then'](handleEntityNotFound(_0x439d6e,null))[_0x5e44('0x23')](respondWithResult(_0x439d6e,null))['catch'](handleError(_0x439d6e,null));};exports[_0x5e44('0x46')]=function(_0x3adc2c,_0x296e7c){return db[_0x5e44('0x3e')][_0x5e44('0x46')](_0x3adc2c['body'],{})[_0x5e44('0x23')](respondWithResult(_0x296e7c,0xc9))[_0x5e44('0x43')](handleError(_0x296e7c,null));};exports[_0x5e44('0x47')]=function(_0xca979c,_0x1ddd14){if(_0xca979c['body']['id']){delete _0xca979c[_0x5e44('0x48')]['id'];}return db[_0x5e44('0x3e')][_0x5e44('0x49')]({'where':{'id':_0xca979c[_0x5e44('0x44')]['id']}})[_0x5e44('0x23')](handleEntityNotFound(_0x1ddd14,null))[_0x5e44('0x23')](saveUpdates(_0xca979c[_0x5e44('0x48')],null))['then'](respondWithResult(_0x1ddd14,null))['catch'](handleError(_0x1ddd14,null));};exports[_0x5e44('0x24')]=function(_0x1e838a,_0x1804d0){return db[_0x5e44('0x3e')][_0x5e44('0x49')]({'where':{'id':_0x1e838a[_0x5e44('0x44')]['id']}})[_0x5e44('0x23')](handleEntityNotFound(_0x1804d0,null))[_0x5e44('0x23')](removeEntity(_0x1804d0,null))[_0x5e44('0x43')](handleError(_0x1804d0,null));};exports['describe']=function(_0x5b84b3,_0xc9011b){return db[_0x5e44('0x3e')][_0x5e44('0x4a')]()[_0x5e44('0x23')](respondWithResult(_0xc9011b,null))['catch'](handleError(_0xc9011b,null));}; \ No newline at end of file +var _0x751c=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','catch','body','describe'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0x751c,0x1c8));var _0xc751=function(_0x1ac285,_0x25d523){_0x1ac285=_0x1ac285-0x0;var _0xfe3de4=_0x751c[_0x1ac285];return _0xfe3de4;};'use strict';var emlformat=require(_0xc751('0x0'));var rimraf=require(_0xc751('0x1'));var zipdir=require(_0xc751('0x2'));var jsonpatch=require(_0xc751('0x3'));var rp=require(_0xc751('0x4'));var moment=require('moment');var BPromise=require(_0xc751('0x5'));var Mustache=require(_0xc751('0x6'));var util=require('util');var path=require(_0xc751('0x7'));var sox=require(_0xc751('0x8'));var csv=require('to-csv');var ejs=require(_0xc751('0x9'));var fs=require('fs');var fs_extra=require(_0xc751('0xa'));var _=require(_0xc751('0xb'));var squel=require(_0xc751('0xc'));var crypto=require('crypto');var jsforce=require(_0xc751('0xd'));var deskjs=require(_0xc751('0xe'));var toCsv=require(_0xc751('0xf'));var querystring=require('querystring');var Papa=require(_0xc751('0x10'));var Redis=require('ioredis');var authService=require(_0xc751('0x11'));var qs=require(_0xc751('0x12'));var as=require(_0xc751('0x13'));var hardwareService=require(_0xc751('0x14'));var logger=require('../../config/logger')(_0xc751('0x15'));var utils=require(_0xc751('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc751('0x17'))['db'];function respondWithStatusCode(_0x313f31,_0x3faba0){_0x3faba0=_0x3faba0||0xcc;return function(_0x2fccf7){if(_0x2fccf7){return _0x313f31[_0xc751('0x18')](_0x3faba0);}return _0x313f31[_0xc751('0x19')](_0x3faba0)[_0xc751('0x1a')]();};}function respondWithResult(_0x9e24ad,_0x2b2f93){_0x2b2f93=_0x2b2f93||0xc8;return function(_0x4295bc){if(_0x4295bc){return _0x9e24ad[_0xc751('0x19')](_0x2b2f93)['json'](_0x4295bc);}};}function respondWithFilteredResult(_0x33464a,_0x159272){return function(_0x200596){if(_0x200596){var _0x22c2b5=typeof _0x159272[_0xc751('0x1b')]===_0xc751('0x1c')&&typeof _0x159272[_0xc751('0x1d')]===_0xc751('0x1c');var _0x543906=_0x200596[_0xc751('0x1e')];var _0x510fb8=_0x22c2b5?0x0:_0x159272['offset'];var _0x21d1ff=_0x22c2b5?_0x200596[_0xc751('0x1e')]:_0x159272[_0xc751('0x1b')]+_0x159272[_0xc751('0x1d')];var _0x10cdf2;if(_0x21d1ff>=_0x543906){_0x21d1ff=_0x543906;_0x10cdf2=0xc8;}else{_0x10cdf2=0xce;}_0x33464a['status'](_0x10cdf2);return _0x33464a[_0xc751('0x1f')](_0xc751('0x20'),_0x510fb8+'-'+_0x21d1ff+'/'+_0x543906)['json'](_0x200596);}return null;};}function patchUpdates(_0x337f97){return function(_0xd84db7){try{jsonpatch[_0xc751('0x21')](_0xd84db7,_0x337f97,!![]);}catch(_0x1890fd){return BPromise[_0xc751('0x22')](_0x1890fd);}return _0xd84db7[_0xc751('0x23')]();};}function saveUpdates(_0x2774ac,_0x38af80){return function(_0xcd9114){if(_0xcd9114){return _0xcd9114[_0xc751('0x24')](_0x2774ac)[_0xc751('0x25')](function(_0x2b7ec1){return _0x2b7ec1;});}return null;};}function removeEntity(_0x16ac65,_0x25a031){return function(_0x3f8c71){if(_0x3f8c71){return _0x3f8c71[_0xc751('0x26')]()['then'](function(){_0x16ac65[_0xc751('0x19')](0xcc)[_0xc751('0x1a')]();});}};}function handleEntityNotFound(_0x55ebed,_0x2bf9c5){return function(_0x3c8071){if(!_0x3c8071){_0x55ebed[_0xc751('0x18')](0x194);}return _0x3c8071;};}function handleError(_0x2a615f,_0x46b171){_0x46b171=_0x46b171||0x1f4;return function(_0x53af77){logger[_0xc751('0x27')](_0x53af77['stack']);if(_0x53af77[_0xc751('0x28')]){delete _0x53af77[_0xc751('0x28')];}_0x2a615f['status'](_0x46b171)[_0xc751('0x29')](_0x53af77);};}exports[_0xc751('0x2a')]=function(_0x2ee2d4,_0x165d69){var _0x2f887f={},_0x2953c8={},_0x22449b={'count':0x0,'rows':[]};var _0x1be8b5=_[_0xc751('0x2b')](db[_0xc751('0x2c')][_0xc751('0x2d')],function(_0x765900){return{'name':_0x765900['fieldName'],'type':_0x765900[_0xc751('0x2e')][_0xc751('0x2f')]};});_0x2953c8[_0xc751('0x30')]=_[_0xc751('0x2b')](_0x1be8b5,'name');_0x2953c8[_0xc751('0x31')]=_[_0xc751('0x32')](_0x2ee2d4[_0xc751('0x31')]);_0x2953c8[_0xc751('0x33')]=_[_0xc751('0x34')](_0x2953c8['model'],_0x2953c8[_0xc751('0x31')]);_0x2f887f[_0xc751('0x35')]=_[_0xc751('0x34')](_0x2953c8[_0xc751('0x30')],qs[_0xc751('0x36')](_0x2ee2d4[_0xc751('0x31')]['fields']));_0x2f887f[_0xc751('0x35')]=_0x2f887f['attributes'][_0xc751('0x37')]?_0x2f887f[_0xc751('0x35')]:_0x2953c8[_0xc751('0x30')];if(!_0x2ee2d4[_0xc751('0x31')][_0xc751('0x38')](_0xc751('0x39'))){_0x2f887f[_0xc751('0x1d')]=qs[_0xc751('0x1d')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x1d')]);_0x2f887f[_0xc751('0x1b')]=qs[_0xc751('0x1b')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x1b')]);}_0x2f887f[_0xc751('0x3a')]=qs[_0xc751('0x3b')](_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3b')]);_0x2f887f[_0xc751('0x3c')]=qs['filters'](_[_0xc751('0x3d')](_0x2ee2d4[_0xc751('0x31')],_0x2953c8[_0xc751('0x33')]),_0x1be8b5);if(_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3e')]){_0x2f887f[_0xc751('0x3c')]=_[_0xc751('0x3f')](_0x2f887f[_0xc751('0x3c')],{'$or':_['map'](_0x1be8b5,function(_0xf6c26e){if(_0xf6c26e['type']!==_0xc751('0x40')){var _0x1dbab0={};_0x1dbab0[_0xf6c26e[_0xc751('0x28')]]={'$like':'%'+_0x2ee2d4[_0xc751('0x31')][_0xc751('0x3e')]+'%'};return _0x1dbab0;}})});}_0x2f887f=_[_0xc751('0x3f')]({},_0x2f887f,_0x2ee2d4[_0xc751('0x41')]);var _0x2585e8={'where':_0x2f887f[_0xc751('0x3c')]};return db[_0xc751('0x2c')][_0xc751('0x1e')](_0x2585e8)[_0xc751('0x25')](function(_0x52faf3){_0x22449b[_0xc751('0x1e')]=_0x52faf3;if(_0x2ee2d4['query'][_0xc751('0x42')]){_0x2f887f[_0xc751('0x43')]=[{'all':!![]}];}return db[_0xc751('0x2c')][_0xc751('0x44')](_0x2f887f);})[_0xc751('0x25')](function(_0x11110f){_0x22449b[_0xc751('0x45')]=_0x11110f;return _0x22449b;})['then'](respondWithFilteredResult(_0x165d69,_0x2f887f))['catch'](handleError(_0x165d69,null));};exports['show']=function(_0x37cc87,_0x2018c5){var _0x120bb8={'raw':!![],'where':{'id':_0x37cc87[_0xc751('0x46')]['id']}},_0xa99d3e={};_0xa99d3e[_0xc751('0x30')]=_[_0xc751('0x32')](db['SquareReport'][_0xc751('0x2d')]);_0xa99d3e[_0xc751('0x31')]=_[_0xc751('0x32')](_0x37cc87[_0xc751('0x31')]);_0xa99d3e[_0xc751('0x33')]=_['intersection'](_0xa99d3e[_0xc751('0x30')],_0xa99d3e[_0xc751('0x31')]);_0x120bb8['attributes']=_[_0xc751('0x34')](_0xa99d3e['model'],qs[_0xc751('0x36')](_0x37cc87[_0xc751('0x31')][_0xc751('0x36')]));_0x120bb8[_0xc751('0x35')]=_0x120bb8['attributes'][_0xc751('0x37')]?_0x120bb8[_0xc751('0x35')]:_0xa99d3e[_0xc751('0x30')];if(_0x37cc87[_0xc751('0x31')]['includeAll']){_0x120bb8[_0xc751('0x43')]=[{'all':!![]}];}_0x120bb8=_[_0xc751('0x3f')]({},_0x120bb8,_0x37cc87[_0xc751('0x41')]);return db[_0xc751('0x2c')][_0xc751('0x47')](_0x120bb8)[_0xc751('0x25')](handleEntityNotFound(_0x2018c5,null))[_0xc751('0x25')](respondWithResult(_0x2018c5,null))['catch'](handleError(_0x2018c5,null));};exports[_0xc751('0x48')]=function(_0x178acf,_0x3c80f5){return db[_0xc751('0x2c')]['create'](_0x178acf['body'],{})[_0xc751('0x25')](respondWithResult(_0x3c80f5,0xc9))[_0xc751('0x49')](handleError(_0x3c80f5,null));};exports[_0xc751('0x24')]=function(_0xb71f8e,_0x4b0495){if(_0xb71f8e[_0xc751('0x4a')]['id']){delete _0xb71f8e[_0xc751('0x4a')]['id'];}return db[_0xc751('0x2c')][_0xc751('0x47')]({'where':{'id':_0xb71f8e[_0xc751('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b0495,null))['then'](saveUpdates(_0xb71f8e[_0xc751('0x4a')],null))[_0xc751('0x25')](respondWithResult(_0x4b0495,null))[_0xc751('0x49')](handleError(_0x4b0495,null));};exports[_0xc751('0x26')]=function(_0x27d3fd,_0x3cb7e7){return db['SquareReport']['find']({'where':{'id':_0x27d3fd['params']['id']}})[_0xc751('0x25')](handleEntityNotFound(_0x3cb7e7,null))[_0xc751('0x25')](removeEntity(_0x3cb7e7,null))[_0xc751('0x49')](handleError(_0x3cb7e7,null));};exports[_0xc751('0x4b')]=function(_0x474e22,_0x35e0f6){return db[_0xc751('0x2c')]['describe']()[_0xc751('0x25')](respondWithResult(_0x35e0f6,null))['catch'](handleError(_0x35e0f6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 955a66d..48966b1 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 _0x984f=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','SquareReport','report_square','leaveAt','lodash'];(function(_0x486fc1,_0x6f74fd){var _0x1eb9eb=function(_0x3e71b9){while(--_0x3e71b9){_0x486fc1['push'](_0x486fc1['shift']());}};_0x1eb9eb(++_0x6f74fd);}(_0x984f,0x16a));var _0xf984=function(_0x9553a2,_0x5424d9){_0x9553a2=_0x9553a2-0x0;var _0x3e398c=_0x984f[_0x9553a2];return _0x3e398c;};'use strict';var _=require(_0xf984('0x0'));var util=require('util');var logger=require(_0xf984('0x1'))(_0xf984('0x2'));var moment=require('moment');var BPromise=require(_0xf984('0x3'));var rp=require(_0xf984('0x4'));var fs=require('fs');var path=require(_0xf984('0x5'));var rimraf=require('rimraf');var config=require(_0xf984('0x6'));var attributes=require('./squareReport.attributes');module[_0xf984('0x7')]=function(_0x334fb0,_0x2ca1e0){return _0x334fb0['define'](_0xf984('0x8'),attributes,{'tableName':_0xf984('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':_0xf984('0xa'),'fields':[_0xf984('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8897=['define','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x1f66a8,_0x1f25d4){var _0x99b2c3=function(_0x3a90bb){while(--_0x3a90bb){_0x1f66a8['push'](_0x1f66a8['shift']());}};_0x99b2c3(++_0x1f25d4);}(_0x8897,0x155));var _0x7889=function(_0x485fd8,_0x4845d5){_0x485fd8=_0x485fd8-0x0;var _0x3c3614=_0x8897[_0x485fd8];return _0x3c3614;};'use strict';var _=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var logger=require(_0x7889('0x2'))(_0x7889('0x3'));var moment=require(_0x7889('0x4'));var BPromise=require('bluebird');var rp=require(_0x7889('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7889('0x6'));var config=require(_0x7889('0x7'));var attributes=require(_0x7889('0x8'));module['exports']=function(_0x49704c,_0x5a7864){return _0x49704c[_0x7889('0x9')]('SquareReport',attributes,{'tableName':_0x7889('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7889('0xb'),_0x7889('0xc')]},{'name':_0x7889('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b8e00bf..ccb74cd 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 _0x1a82=['http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareReport','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3420bd,_0x34703d){var _0x5c7793=function(_0x64fe96){while(--_0x64fe96){_0x3420bd['push'](_0x3420bd['shift']());}};_0x5c7793(++_0x34703d);}(_0x1a82,0xbb));var _0x21a8=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x1a82[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0x21a8('0x0'));var util=require(_0x21a8('0x1'));var moment=require(_0x21a8('0x2'));var BPromise=require(_0x21a8('0x3'));var rs=require(_0x21a8('0x4'));var fs=require('fs');var Redis=require(_0x21a8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21a8('0x6'));var logger=require('../../config/logger')(_0x21a8('0x7'));var config=require(_0x21a8('0x8'));var jayson=require(_0x21a8('0x9'));var client=jayson[_0x21a8('0xa')][_0x21a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdcbd85,_0x4cf3c6,_0x149a1b){return new BPromise(function(_0x37a141,_0x2b27ac){return client[_0x21a8('0xc')](_0xdcbd85,_0x149a1b)[_0x21a8('0xd')](function(_0x294115){logger['info'](_0x21a8('0xe'),_0x4cf3c6,_0x21a8('0xf'));logger[_0x21a8('0x10')](_0x21a8('0x11'),_0x4cf3c6,_0x21a8('0xf'),JSON[_0x21a8('0x12')](_0x294115));if(_0x294115[_0x21a8('0x13')]){if(_0x294115[_0x21a8('0x13')][_0x21a8('0x14')]===0x1f4){logger['error'](_0x21a8('0xe'),_0x4cf3c6,_0x294115['error'][_0x21a8('0x15')]);return _0x2b27ac(_0x294115[_0x21a8('0x13')][_0x21a8('0x15')]);}logger[_0x21a8('0x13')](_0x21a8('0xe'),_0x4cf3c6,_0x294115[_0x21a8('0x13')][_0x21a8('0x15')]);return _0x37a141(_0x294115[_0x21a8('0x13')][_0x21a8('0x15')]);}else{logger[_0x21a8('0x16')]('SquareReport,\x20%s,\x20%s',_0x4cf3c6,_0x21a8('0xf'));_0x37a141(_0x294115[_0x21a8('0x17')][_0x21a8('0x15')]);}})[_0x21a8('0x18')](function(_0x1c5462){logger[_0x21a8('0x13')](_0x21a8('0xe'),_0x4cf3c6,_0x1c5462);_0x2b27ac(_0x1c5462);});});}exports['CreateSquareReport']=function(_0x35e0b8){var _0x372906=this;return new Promise(function(_0x4b40cc,_0x4bce82){return db[_0x21a8('0x19')]['create'](_0x35e0b8[_0x21a8('0x1a')],{'raw':_0x35e0b8[_0x21a8('0x1b')]?_0x35e0b8[_0x21a8('0x1b')][_0x21a8('0x1c')]===undefined?!![]:![]:!![]})[_0x21a8('0xd')](function(_0x28e9d0){logger[_0x21a8('0x16')](_0x21a8('0x1d'),_0x35e0b8);logger[_0x21a8('0x10')](_0x21a8('0x1d'),_0x35e0b8,JSON[_0x21a8('0x12')](_0x28e9d0));_0x4b40cc(_0x28e9d0);})[_0x21a8('0x18')](function(_0x1d5b5f){logger[_0x21a8('0x13')]('CreateSquareReport',_0x1d5b5f[_0x21a8('0x15')],_0x35e0b8);_0x4bce82(_0x372906[_0x21a8('0x13')](0x1f4,_0x1d5b5f[_0x21a8('0x15')]));});});};exports[_0x21a8('0x1e')]=function(_0x146696){var _0x4b1d10=this;return new Promise(function(_0x2eacd1,_0x100758){return db[_0x21a8('0x19')][_0x21a8('0x1f')](_0x146696[_0x21a8('0x1a')],{'raw':_0x146696[_0x21a8('0x1b')]?_0x146696['options'][_0x21a8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146696[_0x21a8('0x1b')]?_0x146696[_0x21a8('0x1b')][_0x21a8('0x20')]||null:null,'attributes':_0x146696[_0x21a8('0x1b')]?_0x146696[_0x21a8('0x1b')]['attributes']||null:null,'limit':_0x146696[_0x21a8('0x1b')]?_0x146696[_0x21a8('0x1b')]['limit']||null:null})[_0x21a8('0xd')](function(_0x621366){logger[_0x21a8('0x16')](_0x21a8('0x1e'),_0x146696);logger[_0x21a8('0x10')](_0x21a8('0x1e'),_0x146696,JSON[_0x21a8('0x12')](_0x621366));_0x2eacd1(_0x621366);})['catch'](function(_0x3b19ad){logger[_0x21a8('0x13')](_0x21a8('0x1e'),_0x3b19ad['message'],_0x146696);_0x100758(_0x4b1d10[_0x21a8('0x13')](0x1f4,_0x3b19ad[_0x21a8('0x15')]));});});}; \ No newline at end of file +var _0x1bce=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','stringify','UpdateSquareReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x303c46,_0x7bb727){var _0x300fcd=function(_0x236821){while(--_0x236821){_0x303c46['push'](_0x303c46['shift']());}};_0x300fcd(++_0x7bb727);}(_0x1bce,0xf8));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client'][_0xe1bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302845,_0x4e92ba,_0x1611b8){return new BPromise(function(_0x473b2c,_0x447bb8){return client[_0xe1bc('0xc')](_0x302845,_0x1611b8)[_0xe1bc('0xd')](function(_0xfd2591){logger[_0xe1bc('0xe')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'));logger[_0xe1bc('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'),JSON['stringify'](_0xfd2591));if(_0xfd2591[_0xe1bc('0x11')]){if(_0xfd2591[_0xe1bc('0x11')]['code']===0x1f4){logger[_0xe1bc('0x11')](_0xe1bc('0x12'),_0x4e92ba,_0xfd2591['error']['message']);return _0x447bb8(_0xfd2591['error'][_0xe1bc('0x13')]);}logger[_0xe1bc('0x11')](_0xe1bc('0x12'),_0x4e92ba,_0xfd2591[_0xe1bc('0x11')][_0xe1bc('0x13')]);return _0x473b2c(_0xfd2591[_0xe1bc('0x11')][_0xe1bc('0x13')]);}else{logger[_0xe1bc('0xe')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0xe1bc('0xf'));_0x473b2c(_0xfd2591[_0xe1bc('0x14')][_0xe1bc('0x13')]);}})[_0xe1bc('0x15')](function(_0x58544e){logger[_0xe1bc('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e92ba,_0x58544e);_0x447bb8(_0x58544e);});});}exports[_0xe1bc('0x16')]=function(_0x141d7d){var _0x405a44=this;return new Promise(function(_0x152d0b,_0x14ed5b){return db[_0xe1bc('0x17')]['create'](_0x141d7d[_0xe1bc('0x18')],{'raw':_0x141d7d[_0xe1bc('0x19')]?_0x141d7d['options'][_0xe1bc('0x1a')]===undefined?!![]:![]:!![]})[_0xe1bc('0xd')](function(_0x11836b){logger[_0xe1bc('0xe')]('CreateSquareReport',_0x141d7d);logger[_0xe1bc('0x10')]('CreateSquareReport',_0x141d7d,JSON[_0xe1bc('0x1b')](_0x11836b));_0x152d0b(_0x11836b);})[_0xe1bc('0x15')](function(_0x41f8d1){logger[_0xe1bc('0x11')]('CreateSquareReport',_0x41f8d1[_0xe1bc('0x13')],_0x141d7d);_0x14ed5b(_0x405a44['error'](0x1f4,_0x41f8d1[_0xe1bc('0x13')]));});});};exports[_0xe1bc('0x1c')]=function(_0x1c43f8){var _0x2a32db=this;return new Promise(function(_0x9dc8ad,_0x3808db){return db[_0xe1bc('0x17')][_0xe1bc('0x1d')](_0x1c43f8[_0xe1bc('0x18')],{'raw':_0x1c43f8[_0xe1bc('0x19')]?_0x1c43f8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c43f8['options']?_0x1c43f8[_0xe1bc('0x19')][_0xe1bc('0x1e')]||null:null,'attributes':_0x1c43f8[_0xe1bc('0x19')]?_0x1c43f8[_0xe1bc('0x19')]['attributes']||null:null,'limit':_0x1c43f8['options']?_0x1c43f8[_0xe1bc('0x19')][_0xe1bc('0x1f')]||null:null})[_0xe1bc('0xd')](function(_0x3e730d){logger['info'](_0xe1bc('0x1c'),_0x1c43f8);logger['debug'](_0xe1bc('0x1c'),_0x1c43f8,JSON[_0xe1bc('0x1b')](_0x3e730d));_0x9dc8ad(_0x3e730d);})['catch'](function(_0xc9e82d){logger[_0xe1bc('0x11')](_0xe1bc('0x1c'),_0xc9e82d['message'],_0x1c43f8);_0x3808db(_0x2a32db[_0xe1bc('0x11')](0x1f4,_0xc9e82d[_0xe1bc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8a841e8..9f108b4 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 _0xe373=['/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','describe'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xe373,0x1a7));var _0x3e37=function(_0x2433c6,_0x49cc98){_0x2433c6=_0x2433c6-0x0;var _0x4b1015=_0xe373[_0x2433c6];return _0x4b1015;};'use strict';var multer=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var path=require('path');var timeout=require(_0x3e37('0x2'));var express=require('express');var router=express[_0x3e37('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3e37('0x4'));var config=require('../../config/environment');var controller=require(_0x3e37('0x5'));router[_0x3e37('0x6')]('/',auth[_0x3e37('0x7')](),controller['index']);router[_0x3e37('0x6')]('/describe',auth[_0x3e37('0x7')](),controller[_0x3e37('0x8')]);router['get'](_0x3e37('0x9'),auth[_0x3e37('0x7')](),controller[_0x3e37('0xa')]);router['post']('/',auth[_0x3e37('0x7')](),controller[_0x3e37('0xb')]);router['put'](_0x3e37('0x9'),auth[_0x3e37('0x7')](),controller[_0x3e37('0xc')]);router[_0x3e37('0xd')](_0x3e37('0x9'),auth[_0x3e37('0x7')](),controller[_0x3e37('0xe')]);module[_0x3e37('0xf')]=router; \ No newline at end of file +var _0x3a58=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3a58,0xaa));var _0x83a5=function(_0x3bd8cf,_0x3813fd){_0x3bd8cf=_0x3bd8cf-0x0;var _0x40a161=_0x3a58[_0x3bd8cf];return _0x40a161;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83a5('0x0'));var timeout=require('connect-timeout');var express=require(_0x83a5('0x1'));var router=express[_0x83a5('0x2')]();var fs_extra=require(_0x83a5('0x3'));var auth=require(_0x83a5('0x4'));var interaction=require(_0x83a5('0x5'));var config=require(_0x83a5('0x6'));var controller=require(_0x83a5('0x7'));router[_0x83a5('0x8')]('/',auth[_0x83a5('0x9')](),controller[_0x83a5('0xa')]);router[_0x83a5('0x8')]('/describe',auth[_0x83a5('0x9')](),controller[_0x83a5('0xb')]);router[_0x83a5('0x8')](_0x83a5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x83a5('0xd')]('/',auth[_0x83a5('0x9')](),controller[_0x83a5('0xe')]);router['put'](_0x83a5('0xc'),auth[_0x83a5('0x9')](),controller[_0x83a5('0xf')]);router[_0x83a5('0x10')](_0x83a5('0xc'),auth['isAuthenticated'](),controller[_0x83a5('0x11')]);module[_0x83a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 412b03b..f1fb3c7 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 _0xd887=['sequelize','exports','STRING'];(function(_0x3720b2,_0x165814){var _0x32ec1d=function(_0x55876b){while(--_0x55876b){_0x3720b2['push'](_0x3720b2['shift']());}};_0x32ec1d(++_0x165814);}(_0xd887,0x141));var _0x7d88=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0xd887[_0x45ac0c];return _0x4b4074;};'use strict';var Sequelize=require(_0x7d88('0x0'));module[_0x7d88('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x7d88('0x2')]},'application':{'type':Sequelize[_0x7d88('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x7d88('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f6e=['exports','STRING','TEXT'];(function(_0x46b37b,_0x222c44){var _0x2c5dac=function(_0x41625b){while(--_0x41625b){_0x46b37b['push'](_0x46b37b['shift']());}};_0x2c5dac(++_0x222c44);}(_0x1f6e,0x171));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe1f6('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xe1f6('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xe1f6('0x2')]},'project_name':{'type':Sequelize[_0xe1f6('0x1')]},'callerid':{'type':Sequelize[_0xe1f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 91bf54f..bd6029b 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 _0xb74e=['VIRTUAL','merge','options','SquareDetailsReport','includeAll','include','findAll','catch','length','find','create','body','params','describe','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x20044d,_0x1ea6d8){var _0x55391b=function(_0x746608){while(--_0x746608){_0x20044d['push'](_0x20044d['shift']());}};_0x55391b(++_0x1ea6d8);}(_0xb74e,0xe9));var _0xeb74=function(_0x580e23,_0x192615){_0x580e23=_0x580e23-0x0;var _0x58ea17=_0xb74e[_0x580e23];return _0x58ea17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb74('0x0'));var zipdir=require(_0xeb74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeb74('0x2'));var Mustache=require(_0xeb74('0x3'));var util=require(_0xeb74('0x4'));var path=require('path');var sox=require(_0xeb74('0x5'));var csv=require(_0xeb74('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb74('0x7'));var _=require(_0xeb74('0x8'));var squel=require(_0xeb74('0x9'));var crypto=require(_0xeb74('0xa'));var jsforce=require(_0xeb74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeb74('0x6'));var querystring=require(_0xeb74('0xc'));var Papa=require(_0xeb74('0xd'));var Redis=require(_0xeb74('0xe'));var authService=require(_0xeb74('0xf'));var qs=require(_0xeb74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb74('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xeb74('0x12'));var config=require(_0xeb74('0x13'));var licenseUtil=require(_0xeb74('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4650,_0x1da2b8){_0x1da2b8=_0x1da2b8||0xcc;return function(_0x30711c){if(_0x30711c){return _0x1e4650[_0xeb74('0x15')](_0x1da2b8);}return _0x1e4650[_0xeb74('0x16')](_0x1da2b8)[_0xeb74('0x17')]();};}function respondWithResult(_0x403d99,_0x5d88ca){_0x5d88ca=_0x5d88ca||0xc8;return function(_0x44cda0){if(_0x44cda0){return _0x403d99[_0xeb74('0x16')](_0x5d88ca)[_0xeb74('0x18')](_0x44cda0);}};}function respondWithFilteredResult(_0x504021,_0x134817){return function(_0x4f8212){if(_0x4f8212){var _0x30d5c1=typeof _0x134817[_0xeb74('0x19')]==='undefined'&&typeof _0x134817[_0xeb74('0x1a')]===_0xeb74('0x1b');var _0x30cf30=_0x4f8212[_0xeb74('0x1c')];var _0x34b468=_0x30d5c1?0x0:_0x134817[_0xeb74('0x19')];var _0x2e246c=_0x30d5c1?_0x4f8212[_0xeb74('0x1c')]:_0x134817[_0xeb74('0x19')]+_0x134817['limit'];var _0x48e505;if(_0x2e246c>=_0x30cf30){_0x2e246c=_0x30cf30;_0x48e505=0xc8;}else{_0x48e505=0xce;}_0x504021['status'](_0x48e505);return _0x504021['set'](_0xeb74('0x1d'),_0x34b468+'-'+_0x2e246c+'/'+_0x30cf30)[_0xeb74('0x18')](_0x4f8212);}return null;};}function patchUpdates(_0x1e7ab6){return function(_0x869f45){try{jsonpatch[_0xeb74('0x1e')](_0x869f45,_0x1e7ab6,!![]);}catch(_0x21cab1){return BPromise['reject'](_0x21cab1);}return _0x869f45[_0xeb74('0x1f')]();};}function saveUpdates(_0x30950a,_0x1db0de){return function(_0x53aa27){if(_0x53aa27){return _0x53aa27[_0xeb74('0x20')](_0x30950a)[_0xeb74('0x21')](function(_0x2399ea){return _0x2399ea;});}return null;};}function removeEntity(_0x6ae784,_0x77b207){return function(_0x3d4e1e){if(_0x3d4e1e){return _0x3d4e1e[_0xeb74('0x22')]()[_0xeb74('0x21')](function(){_0x6ae784[_0xeb74('0x16')](0xcc)[_0xeb74('0x17')]();});}};}function handleEntityNotFound(_0x14ee82,_0x21ff21){return function(_0x95855a){if(!_0x95855a){_0x14ee82[_0xeb74('0x15')](0x194);}return _0x95855a;};}function handleError(_0x54112a,_0x26d0e1){_0x26d0e1=_0x26d0e1||0x1f4;return function(_0x5baa7b){logger[_0xeb74('0x23')](_0x5baa7b[_0xeb74('0x24')]);if(_0x5baa7b[_0xeb74('0x25')]){delete _0x5baa7b[_0xeb74('0x25')];}_0x54112a[_0xeb74('0x16')](_0x26d0e1)[_0xeb74('0x26')](_0x5baa7b);};}exports[_0xeb74('0x27')]=function(_0x44478e,_0x3b3eb1){var _0x2c912e={},_0x2b1857={},_0x4cbb41={'count':0x0,'rows':[]};var _0x33e9d1=_[_0xeb74('0x28')](db['SquareDetailsReport'][_0xeb74('0x29')],function(_0x5bf1a8){return{'name':_0x5bf1a8[_0xeb74('0x2a')],'type':_0x5bf1a8[_0xeb74('0x2b')][_0xeb74('0x2c')]};});_0x2b1857['model']=_[_0xeb74('0x28')](_0x33e9d1,_0xeb74('0x25'));_0x2b1857['query']=_[_0xeb74('0x2d')](_0x44478e['query']);_0x2b1857['filters']=_[_0xeb74('0x2e')](_0x2b1857[_0xeb74('0x2f')],_0x2b1857[_0xeb74('0x30')]);_0x2c912e[_0xeb74('0x31')]=_[_0xeb74('0x2e')](_0x2b1857['model'],qs[_0xeb74('0x32')](_0x44478e['query']['fields']));_0x2c912e[_0xeb74('0x31')]=_0x2c912e[_0xeb74('0x31')]['length']?_0x2c912e[_0xeb74('0x31')]:_0x2b1857[_0xeb74('0x2f')];if(!_0x44478e['query'][_0xeb74('0x33')](_0xeb74('0x34'))){_0x2c912e[_0xeb74('0x1a')]=qs[_0xeb74('0x1a')](_0x44478e[_0xeb74('0x30')]['limit']);_0x2c912e[_0xeb74('0x19')]=qs[_0xeb74('0x19')](_0x44478e['query'][_0xeb74('0x19')]);}_0x2c912e[_0xeb74('0x35')]=qs[_0xeb74('0x36')](_0x44478e['query'][_0xeb74('0x36')]);_0x2c912e[_0xeb74('0x37')]=qs[_0xeb74('0x38')](_[_0xeb74('0x39')](_0x44478e[_0xeb74('0x30')],_0x2b1857[_0xeb74('0x38')]),_0x33e9d1);if(_0x44478e[_0xeb74('0x30')][_0xeb74('0x3a')]){_0x2c912e[_0xeb74('0x37')]=_['merge'](_0x2c912e[_0xeb74('0x37')],{'$or':_[_0xeb74('0x28')](_0x33e9d1,function(_0x2f0efb){if(_0x2f0efb[_0xeb74('0x2b')]!==_0xeb74('0x3b')){var _0x428f61={};_0x428f61[_0x2f0efb['name']]={'$like':'%'+_0x44478e[_0xeb74('0x30')][_0xeb74('0x3a')]+'%'};return _0x428f61;}})});}_0x2c912e=_[_0xeb74('0x3c')]({},_0x2c912e,_0x44478e[_0xeb74('0x3d')]);var _0x24e595={'where':_0x2c912e[_0xeb74('0x37')]};return db[_0xeb74('0x3e')][_0xeb74('0x1c')](_0x24e595)[_0xeb74('0x21')](function(_0x14186f){_0x4cbb41[_0xeb74('0x1c')]=_0x14186f;if(_0x44478e['query'][_0xeb74('0x3f')]){_0x2c912e[_0xeb74('0x40')]=[{'all':!![]}];}return db[_0xeb74('0x3e')][_0xeb74('0x41')](_0x2c912e);})[_0xeb74('0x21')](function(_0x3c8479){_0x4cbb41['rows']=_0x3c8479;return _0x4cbb41;})['then'](respondWithFilteredResult(_0x3b3eb1,_0x2c912e))[_0xeb74('0x42')](handleError(_0x3b3eb1,null));};exports['show']=function(_0x272e1d,_0x3a83bc){var _0x5f1f61={'raw':!![],'where':{'id':_0x272e1d['params']['id']}},_0x53eb75={};_0x53eb75[_0xeb74('0x2f')]=_['keys'](db[_0xeb74('0x3e')]['rawAttributes']);_0x53eb75[_0xeb74('0x30')]=_[_0xeb74('0x2d')](_0x272e1d[_0xeb74('0x30')]);_0x53eb75['filters']=_[_0xeb74('0x2e')](_0x53eb75[_0xeb74('0x2f')],_0x53eb75[_0xeb74('0x30')]);_0x5f1f61[_0xeb74('0x31')]=_[_0xeb74('0x2e')](_0x53eb75[_0xeb74('0x2f')],qs[_0xeb74('0x32')](_0x272e1d[_0xeb74('0x30')][_0xeb74('0x32')]));_0x5f1f61[_0xeb74('0x31')]=_0x5f1f61[_0xeb74('0x31')][_0xeb74('0x43')]?_0x5f1f61[_0xeb74('0x31')]:_0x53eb75[_0xeb74('0x2f')];if(_0x272e1d[_0xeb74('0x30')][_0xeb74('0x3f')]){_0x5f1f61[_0xeb74('0x40')]=[{'all':!![]}];}_0x5f1f61=_[_0xeb74('0x3c')]({},_0x5f1f61,_0x272e1d[_0xeb74('0x3d')]);return db['SquareDetailsReport'][_0xeb74('0x44')](_0x5f1f61)[_0xeb74('0x21')](handleEntityNotFound(_0x3a83bc,null))[_0xeb74('0x21')](respondWithResult(_0x3a83bc,null))[_0xeb74('0x42')](handleError(_0x3a83bc,null));};exports[_0xeb74('0x45')]=function(_0x552cc6,_0x43d1ea){return db[_0xeb74('0x3e')][_0xeb74('0x45')](_0x552cc6[_0xeb74('0x46')],{})['then'](respondWithResult(_0x43d1ea,0xc9))[_0xeb74('0x42')](handleError(_0x43d1ea,null));};exports[_0xeb74('0x20')]=function(_0xe1c0f3,_0x325686){if(_0xe1c0f3[_0xeb74('0x46')]['id']){delete _0xe1c0f3['body']['id'];}return db[_0xeb74('0x3e')][_0xeb74('0x44')]({'where':{'id':_0xe1c0f3[_0xeb74('0x47')]['id']}})[_0xeb74('0x21')](handleEntityNotFound(_0x325686,null))['then'](saveUpdates(_0xe1c0f3[_0xeb74('0x46')],null))[_0xeb74('0x21')](respondWithResult(_0x325686,null))['catch'](handleError(_0x325686,null));};exports[_0xeb74('0x22')]=function(_0x520a26,_0xb0d949){return db[_0xeb74('0x3e')][_0xeb74('0x44')]({'where':{'id':_0x520a26['params']['id']}})[_0xeb74('0x21')](handleEntityNotFound(_0xb0d949,null))[_0xeb74('0x21')](removeEntity(_0xb0d949,null))[_0xeb74('0x42')](handleError(_0xb0d949,null));};exports[_0xeb74('0x48')]=function(_0x3a23e3,_0x4b592d){return db[_0xeb74('0x3e')][_0xeb74('0x48')]()[_0xeb74('0x21')](respondWithResult(_0x4b592d,null))[_0xeb74('0x42')](handleError(_0x4b592d,null));}; \ No newline at end of file +var _0x8fa4=['find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','SquareDetailsReport','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','findAll','rows','catch','show','params','length'];(function(_0x41f882,_0x360760){var _0x402761=function(_0x325158){while(--_0x325158){_0x41f882['push'](_0x41f882['shift']());}};_0x402761(++_0x360760);}(_0x8fa4,0x175));var _0x48fa=function(_0x23c2ec,_0x5adc8e){_0x23c2ec=_0x23c2ec-0x0;var _0xece329=_0x8fa4[_0x23c2ec];return _0xece329;};'use strict';var emlformat=require(_0x48fa('0x0'));var rimraf=require(_0x48fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48fa('0x2'));var rp=require(_0x48fa('0x3'));var moment=require(_0x48fa('0x4'));var BPromise=require(_0x48fa('0x5'));var Mustache=require(_0x48fa('0x6'));var util=require(_0x48fa('0x7'));var path=require(_0x48fa('0x8'));var sox=require(_0x48fa('0x9'));var csv=require('to-csv');var ejs=require(_0x48fa('0xa'));var fs=require('fs');var fs_extra=require(_0x48fa('0xb'));var _=require(_0x48fa('0xc'));var squel=require(_0x48fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x48fa('0xe'));var deskjs=require(_0x48fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x48fa('0x10'));var Papa=require(_0x48fa('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48fa('0x12'));var as=require(_0x48fa('0x13'));var hardwareService=require(_0x48fa('0x14'));var logger=require(_0x48fa('0x15'))('api');var utils=require(_0x48fa('0x16'));var config=require(_0x48fa('0x17'));var licenseUtil=require(_0x48fa('0x18'));var db=require(_0x48fa('0x19'))['db'];function respondWithStatusCode(_0x3de2e6,_0x2c5515){_0x2c5515=_0x2c5515||0xcc;return function(_0x1b4c85){if(_0x1b4c85){return _0x3de2e6[_0x48fa('0x1a')](_0x2c5515);}return _0x3de2e6[_0x48fa('0x1b')](_0x2c5515)[_0x48fa('0x1c')]();};}function respondWithResult(_0x447371,_0x13c8b7){_0x13c8b7=_0x13c8b7||0xc8;return function(_0x28becd){if(_0x28becd){return _0x447371[_0x48fa('0x1b')](_0x13c8b7)[_0x48fa('0x1d')](_0x28becd);}};}function respondWithFilteredResult(_0x3cea1b,_0xaddd8){return function(_0x25450b){if(_0x25450b){var _0xfb932b=typeof _0xaddd8['offset']===_0x48fa('0x1e')&&typeof _0xaddd8[_0x48fa('0x1f')]===_0x48fa('0x1e');var _0x6f4cf2=_0x25450b['count'];var _0x1e91f2=_0xfb932b?0x0:_0xaddd8['offset'];var _0x2df64e=_0xfb932b?_0x25450b[_0x48fa('0x20')]:_0xaddd8[_0x48fa('0x21')]+_0xaddd8[_0x48fa('0x1f')];var _0x446999;if(_0x2df64e>=_0x6f4cf2){_0x2df64e=_0x6f4cf2;_0x446999=0xc8;}else{_0x446999=0xce;}_0x3cea1b[_0x48fa('0x1b')](_0x446999);return _0x3cea1b[_0x48fa('0x22')](_0x48fa('0x23'),_0x1e91f2+'-'+_0x2df64e+'/'+_0x6f4cf2)[_0x48fa('0x1d')](_0x25450b);}return null;};}function patchUpdates(_0x1c1a65){return function(_0x5c02c8){try{jsonpatch[_0x48fa('0x24')](_0x5c02c8,_0x1c1a65,!![]);}catch(_0x3ba36c){return BPromise[_0x48fa('0x25')](_0x3ba36c);}return _0x5c02c8[_0x48fa('0x26')]();};}function saveUpdates(_0x37adbf,_0x4451f6){return function(_0x345f83){if(_0x345f83){return _0x345f83[_0x48fa('0x27')](_0x37adbf)['then'](function(_0x4abc7a){return _0x4abc7a;});}return null;};}function removeEntity(_0x29683a,_0x4253c2){return function(_0x12913f){if(_0x12913f){return _0x12913f[_0x48fa('0x28')]()[_0x48fa('0x29')](function(){_0x29683a[_0x48fa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4a13,_0x4adec7){return function(_0x4e0763){if(!_0x4e0763){_0x3c4a13[_0x48fa('0x1a')](0x194);}return _0x4e0763;};}function handleError(_0x46ba52,_0x4d376d){_0x4d376d=_0x4d376d||0x1f4;return function(_0x3e57fa){logger[_0x48fa('0x2a')](_0x3e57fa[_0x48fa('0x2b')]);if(_0x3e57fa[_0x48fa('0x2c')]){delete _0x3e57fa[_0x48fa('0x2c')];}_0x46ba52[_0x48fa('0x1b')](_0x4d376d)['send'](_0x3e57fa);};}exports[_0x48fa('0x2d')]=function(_0x3f2a09,_0x2f170e){var _0x2328cb={},_0x1b98c9={},_0x55ea86={'count':0x0,'rows':[]};var _0x5a2f5f=_['map'](db[_0x48fa('0x2e')][_0x48fa('0x2f')],function(_0x199af0){return{'name':_0x199af0['fieldName'],'type':_0x199af0[_0x48fa('0x30')][_0x48fa('0x31')]};});_0x1b98c9['model']=_[_0x48fa('0x32')](_0x5a2f5f,_0x48fa('0x2c'));_0x1b98c9[_0x48fa('0x33')]=_[_0x48fa('0x34')](_0x3f2a09['query']);_0x1b98c9['filters']=_[_0x48fa('0x35')](_0x1b98c9[_0x48fa('0x36')],_0x1b98c9['query']);_0x2328cb[_0x48fa('0x37')]=_[_0x48fa('0x35')](_0x1b98c9['model'],qs[_0x48fa('0x38')](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x38')]));_0x2328cb[_0x48fa('0x37')]=_0x2328cb[_0x48fa('0x37')]['length']?_0x2328cb[_0x48fa('0x37')]:_0x1b98c9[_0x48fa('0x36')];if(!_0x3f2a09[_0x48fa('0x33')]['hasOwnProperty'](_0x48fa('0x39'))){_0x2328cb[_0x48fa('0x1f')]=qs['limit'](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x1f')]);_0x2328cb[_0x48fa('0x21')]=qs['offset'](_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x21')]);}_0x2328cb[_0x48fa('0x3a')]=qs[_0x48fa('0x3b')](_0x3f2a09['query'][_0x48fa('0x3b')]);_0x2328cb[_0x48fa('0x3c')]=qs[_0x48fa('0x3d')](_['pick'](_0x3f2a09['query'],_0x1b98c9[_0x48fa('0x3d')]),_0x5a2f5f);if(_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x3e')]){_0x2328cb[_0x48fa('0x3c')]=_[_0x48fa('0x3f')](_0x2328cb[_0x48fa('0x3c')],{'$or':_[_0x48fa('0x32')](_0x5a2f5f,function(_0x4a8780){if(_0x4a8780[_0x48fa('0x30')]!=='VIRTUAL'){var _0x3357f9={};_0x3357f9[_0x4a8780['name']]={'$like':'%'+_0x3f2a09[_0x48fa('0x33')][_0x48fa('0x3e')]+'%'};return _0x3357f9;}})});}_0x2328cb=_['merge']({},_0x2328cb,_0x3f2a09[_0x48fa('0x40')]);var _0x81d706={'where':_0x2328cb['where']};return db['SquareDetailsReport']['count'](_0x81d706)[_0x48fa('0x29')](function(_0x1cee69){_0x55ea86[_0x48fa('0x20')]=_0x1cee69;if(_0x3f2a09[_0x48fa('0x33')]['includeAll']){_0x2328cb['include']=[{'all':!![]}];}return db[_0x48fa('0x2e')][_0x48fa('0x41')](_0x2328cb);})['then'](function(_0xcffb9f){_0x55ea86[_0x48fa('0x42')]=_0xcffb9f;return _0x55ea86;})['then'](respondWithFilteredResult(_0x2f170e,_0x2328cb))[_0x48fa('0x43')](handleError(_0x2f170e,null));};exports[_0x48fa('0x44')]=function(_0x16dd23,_0x446861){var _0x5bc360={'raw':!![],'where':{'id':_0x16dd23[_0x48fa('0x45')]['id']}},_0x12e29a={};_0x12e29a[_0x48fa('0x36')]=_['keys'](db[_0x48fa('0x2e')][_0x48fa('0x2f')]);_0x12e29a[_0x48fa('0x33')]=_[_0x48fa('0x34')](_0x16dd23[_0x48fa('0x33')]);_0x12e29a['filters']=_['intersection'](_0x12e29a[_0x48fa('0x36')],_0x12e29a[_0x48fa('0x33')]);_0x5bc360[_0x48fa('0x37')]=_[_0x48fa('0x35')](_0x12e29a[_0x48fa('0x36')],qs[_0x48fa('0x38')](_0x16dd23[_0x48fa('0x33')][_0x48fa('0x38')]));_0x5bc360[_0x48fa('0x37')]=_0x5bc360[_0x48fa('0x37')][_0x48fa('0x46')]?_0x5bc360[_0x48fa('0x37')]:_0x12e29a[_0x48fa('0x36')];if(_0x16dd23[_0x48fa('0x33')]['includeAll']){_0x5bc360['include']=[{'all':!![]}];}_0x5bc360=_[_0x48fa('0x3f')]({},_0x5bc360,_0x16dd23[_0x48fa('0x40')]);return db[_0x48fa('0x2e')][_0x48fa('0x47')](_0x5bc360)[_0x48fa('0x29')](handleEntityNotFound(_0x446861,null))[_0x48fa('0x29')](respondWithResult(_0x446861,null))[_0x48fa('0x43')](handleError(_0x446861,null));};exports[_0x48fa('0x48')]=function(_0x1ffbcc,_0x247300){return db[_0x48fa('0x2e')]['create'](_0x1ffbcc[_0x48fa('0x49')],{})[_0x48fa('0x29')](respondWithResult(_0x247300,0xc9))['catch'](handleError(_0x247300,null));};exports[_0x48fa('0x27')]=function(_0x4e2e70,_0x44aea4){if(_0x4e2e70[_0x48fa('0x49')]['id']){delete _0x4e2e70['body']['id'];}return db[_0x48fa('0x2e')][_0x48fa('0x47')]({'where':{'id':_0x4e2e70[_0x48fa('0x45')]['id']}})['then'](handleEntityNotFound(_0x44aea4,null))[_0x48fa('0x29')](saveUpdates(_0x4e2e70[_0x48fa('0x49')],null))['then'](respondWithResult(_0x44aea4,null))['catch'](handleError(_0x44aea4,null));};exports['destroy']=function(_0x13ccb3,_0xe350a8){return db[_0x48fa('0x2e')][_0x48fa('0x47')]({'where':{'id':_0x13ccb3[_0x48fa('0x45')]['id']}})[_0x48fa('0x29')](handleEntityNotFound(_0xe350a8,null))[_0x48fa('0x29')](removeEntity(_0xe350a8,null))['catch'](handleError(_0xe350a8,null));};exports['describe']=function(_0x2739d6,_0x260f5f){return db[_0x48fa('0x2e')]['describe']()[_0x48fa('0x29')](respondWithResult(_0x260f5f,null))[_0x48fa('0x43')](handleError(_0x260f5f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e3cd40e..99cd01e 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 _0x8b18=['api','moment','bluebird','rimraf','./squareReportDetail.attributes','exports','define','report_square_details','lodash','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b18,0x102));var _0x88b1=function(_0x2df552,_0xbc94d2){_0x2df552=_0x2df552-0x0;var _0x1f6f8f=_0x8b18[_0x2df552];return _0x1f6f8f;};'use strict';var _=require(_0x88b1('0x0'));var util=require('util');var logger=require(_0x88b1('0x1'))(_0x88b1('0x2'));var moment=require(_0x88b1('0x3'));var BPromise=require(_0x88b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x88b1('0x5'));var config=require('../../config/environment');var attributes=require(_0x88b1('0x6'));module[_0x88b1('0x7')]=function(_0x212d4f,_0x460bf2){return _0x212d4f[_0x88b1('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x88b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83c5=['../../config/logger','api','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x218978,_0x3437e8){var _0x3e1a94=function(_0x2151f9){while(--_0x2151f9){_0x218978['push'](_0x218978['shift']());}};_0x3e1a94(++_0x3437e8);}(_0x83c5,0x11e));var _0x583c=function(_0x59c135,_0x2324ac){_0x59c135=_0x59c135-0x0;var _0x1603eb=_0x83c5[_0x59c135];return _0x1603eb;};'use strict';var _=require(_0x583c('0x0'));var util=require(_0x583c('0x1'));var logger=require(_0x583c('0x2'))(_0x583c('0x3'));var moment=require('moment');var BPromise=require(_0x583c('0x4'));var rp=require(_0x583c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x583c('0x6'));var config=require('../../config/environment');var attributes=require(_0x583c('0x7'));module[_0x583c('0x8')]=function(_0x12b73f,_0x2b2328){return _0x12b73f[_0x583c('0x9')](_0x583c('0xa'),attributes,{'tableName':_0x583c('0xb'),'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 db57f3f..c812141 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 _0x6017=['http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','client'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x6017,0xae));var _0x7601=function(_0x295349,_0x258949){_0x295349=_0x295349-0x0;var _0x5af2c8=_0x6017[_0x295349];return _0x5af2c8;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});}exports[_0x7601('0x14')]=function(_0x5c3fb7){var _0x5f530e=this;return new Promise(function(_0x22520e,_0x403e38){return db[_0x7601('0x15')][_0x7601('0x16')](_0x5c3fb7[_0x7601('0x17')],{'raw':_0x5c3fb7[_0x7601('0x18')]?_0x5c3fb7[_0x7601('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7601('0xa')](function(_0x1d58c0){logger['info'](_0x7601('0x14'),_0x5c3fb7);logger[_0x7601('0xd')](_0x7601('0x14'),_0x5c3fb7,JSON[_0x7601('0xe')](_0x1d58c0));_0x22520e(_0x1d58c0);})[_0x7601('0x19')](function(_0x12f3f6){logger['error'](_0x7601('0x14'),_0x12f3f6[_0x7601('0x11')],_0x5c3fb7);_0x403e38(_0x5f530e[_0x7601('0xf')](0x1f4,_0x12f3f6[_0x7601('0x11')]));});});}; \ No newline at end of file +var _0x6cb4=['raw','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x6cb4,0xff));var _0x46cb=function(_0x26e310,_0x1460d0){_0x26e310=_0x26e310-0x0;var _0x1a520f=_0x6cb4[_0x26e310];return _0x1a520f;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateSquareDetailsReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index cca6d83..85fb291 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 _0xa9d8=['./system.controller','index','get','/process/:pid/kill','isAuthenticated','killProcess','../../components/auth/service'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0xa9d8,0x141));var _0x8a9d=function(_0x28db16,_0x31b243){_0x28db16=_0x28db16-0x0;var _0x5524b5=_0xa9d8[_0x28db16];return _0x5524b5;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x8a9d('0x0'));var controller=require(_0x8a9d('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a9d('0x2')]);router[_0x8a9d('0x3')](_0x8a9d('0x4'),auth[_0x8a9d('0x5')](),controller[_0x8a9d('0x6')]);module['exports']=router; \ No newline at end of file +var _0xeadf=['get','isAuthenticated','index','killProcess','exports','express','../../components/auth/service'];(function(_0x2f2a02,_0x33101a){var _0x427b7b=function(_0x49a5be){while(--_0x49a5be){_0x2f2a02['push'](_0x2f2a02['shift']());}};_0x427b7b(++_0x33101a);}(_0xeadf,0xa6));var _0xfead=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0xeadf[_0x1b8bda];return _0x1f7050;};'use strict';var express=require(_0xfead('0x0'));var router=express['Router']();var auth=require(_0xfead('0x1'));var controller=require('./system.controller');router[_0xfead('0x2')]('/',auth[_0xfead('0x3')](),controller[_0xfead('0x4')]);router['get']('/process/:pid/kill',auth[_0xfead('0x3')](),controller[_0xfead('0x5')]);module[_0xfead('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7ee4d24..3b9da8b 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 _0xe798=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','json','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util'];(function(_0x25eb3b,_0x127b46){var _0x17729c=function(_0x5783a7){while(--_0x5783a7){_0x25eb3b['push'](_0x25eb3b['shift']());}};_0x17729c(++_0x127b46);}(_0xe798,0x174));var _0x8e79=function(_0x3fe132,_0xc255fb){_0x3fe132=_0x3fe132-0x0;var _0x1cfeb=_0xe798[_0x3fe132];return _0x1cfeb;};'use strict';var info=require(_0x8e79('0x0'));var exec=require(_0x8e79('0x1'))[_0x8e79('0x2')];var logger=require(_0x8e79('0x3'))('api');var util=require(_0x8e79('0x4'));var BPromise=require(_0x8e79('0x5'));var _=require(_0x8e79('0x6'));function handleError(_0x16a00c,_0x299556,_0x4a0fe8){_0x299556=_0x299556||0x1f4;return function(_0x28b34f){logger[_0x8e79('0x7')](_0x8e79('0x8'),_0x4a0fe8,_0x299556,util[_0x8e79('0x9')](_0x28b34f,{'showHidden':![],'depth':null}));delete _0x28b34f[_0x8e79('0xa')];_0x16a00c[_0x8e79('0xb')](_0x299556)[_0x8e79('0xc')](_0x28b34f);};}exports[_0x8e79('0xd')]=function(_0x4fc5b3,_0x366e93){return info[_0x8e79('0xe')]()[_0x8e79('0xf')](function(_0x52bf40){return _0x366e93[_0x8e79('0xb')](0xc8)['json'](_0x52bf40);})[_0x8e79('0x10')](function(_0xe2dc73){return _0x366e93[_0x8e79('0xb')](0x1f4)['json'](_0xe2dc73);});};exports[_0x8e79('0x11')]=function(_0x43455a,_0x31fa3d){var _0x2ceb06=['components/import/cm'];return new BPromise(function(_0x3d8c19,_0x1211e6){return exec(util['format'](_0x8e79('0x12'),_0x43455a[_0x8e79('0x13')][_0x8e79('0x14')]),function(_0x27950c,_0x3dca3c,_0x1c3523){if(_0x27950c){return _0x1211e6(_0x27950c);}return _0x3d8c19(_0x3dca3c);});})[_0x8e79('0xf')](function(_0x4d1e4b){var _0x171a8f=![];var _0x594776=_0x4d1e4b[_0x8e79('0x15')](/\n/);for(var _0x5534b5=0x0,_0x28c166=_0x2ceb06[_0x8e79('0x16')];_0x5534b5<_0x28c166,_0x171a8f===![];_0x5534b5+=0x1){if(_0x4d1e4b['indexOf'](_0x2ceb06[_0x5534b5])>=0x0){_0x171a8f=!![];}}if(!_0x171a8f){throw new Error(util['format'](_0x8e79('0x17'),_0x43455a['params']['pid']));}process[_0x8e79('0x18')](_0x43455a[_0x8e79('0x13')]['pid'],_0x8e79('0x19'));return _0x31fa3d['status'](0xc8)[_0x8e79('0x1a')]({'message':util[_0x8e79('0x1b')](_0x8e79('0x1c'),_0x43455a[_0x8e79('0x13')][_0x8e79('0x14')])});})[_0x8e79('0x10')](handleError(_0x31fa3d,null,_0x8e79('0x11')));}; \ No newline at end of file +var _0x13d7=['indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','then','catch','status','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x4071b6,_0x92cb6e){var _0x576d62=function(_0x3095ec){while(--_0x3095ec){_0x4071b6['push'](_0x4071b6['shift']());}};_0x576d62(++_0x92cb6e);}(_0x13d7,0xa7));var _0x713d=function(_0x58f9e1,_0x1f45ba){_0x58f9e1=_0x58f9e1-0x0;var _0x235451=_0x13d7[_0x58f9e1];return _0x235451;};'use strict';var info=require(_0x713d('0x0'));var exec=require(_0x713d('0x1'))['exec'];var logger=require('../../config/logger')(_0x713d('0x2'));var util=require(_0x713d('0x3'));var BPromise=require(_0x713d('0x4'));var _=require(_0x713d('0x5'));function handleError(_0x596288,_0x2c4be9,_0x1c7af3){_0x2c4be9=_0x2c4be9||0x1f4;return function(_0x53c085){logger[_0x713d('0x6')](_0x713d('0x7'),_0x1c7af3,_0x2c4be9,util[_0x713d('0x8')](_0x53c085,{'showHidden':![],'depth':null}));delete _0x53c085[_0x713d('0x9')];_0x596288['status'](_0x2c4be9)[_0x713d('0xa')](_0x53c085);};}exports['index']=function(_0xaa7f69,_0x1da8a9){return info['getAllData']()[_0x713d('0xb')](function(_0x205458){return _0x1da8a9['status'](0xc8)['json'](_0x205458);})[_0x713d('0xc')](function(_0x2ea9e0){return _0x1da8a9[_0x713d('0xd')](0x1f4)[_0x713d('0xe')](_0x2ea9e0);});};exports[_0x713d('0xf')]=function(_0x2001f7,_0x423595){var _0x8d5275=[_0x713d('0x10')];return new BPromise(function(_0x219d10,_0x4dc8fa){return exec(util['format'](_0x713d('0x11'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')]),function(_0xf4e9e8,_0x292a6a,_0x3c8b84){if(_0xf4e9e8){return _0x4dc8fa(_0xf4e9e8);}return _0x219d10(_0x292a6a);});})[_0x713d('0xb')](function(_0x248c17){var _0x47e67c=![];var _0x4e5f6e=_0x248c17[_0x713d('0x14')](/\n/);for(var _0x302147=0x0,_0x4e6628=_0x8d5275[_0x713d('0x15')];_0x302147<_0x4e6628,_0x47e67c===![];_0x302147+=0x1){if(_0x248c17[_0x713d('0x16')](_0x8d5275[_0x302147])>=0x0){_0x47e67c=!![];}}if(!_0x47e67c){throw new Error(util['format'](_0x713d('0x17'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')]));}process[_0x713d('0x18')](_0x2001f7[_0x713d('0x12')][_0x713d('0x13')],_0x713d('0x19'));return _0x423595['status'](0xc8)[_0x713d('0xe')]({'message':util['format'](_0x713d('0x1a'),_0x2001f7[_0x713d('0x12')][_0x713d('0x13')])});})['catch'](handleError(_0x423595,null,_0x713d('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 406a388..db36d84 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 _0x96d4=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','delete'];(function(_0x1f5d43,_0x2c130c){var _0x2158db=function(_0x5c71b2){while(--_0x5c71b2){_0x1f5d43['push'](_0x1f5d43['shift']());}};_0x2158db(++_0x2c130c);}(_0x96d4,0x18d));var _0x496d=function(_0x460acc,_0x2d0cdc){_0x460acc=_0x460acc-0x0;var _0x41f151=_0x96d4[_0x460acc];return _0x41f151;};'use strict';var multer=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var path=require(_0x496d('0x2'));var timeout=require(_0x496d('0x3'));var express=require(_0x496d('0x4'));var router=express['Router']();var fs_extra=require(_0x496d('0x5'));var auth=require(_0x496d('0x6'));var interaction=require(_0x496d('0x7'));var config=require(_0x496d('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x496d('0x9')](),controller['index']);router[_0x496d('0xa')](_0x496d('0xb'),auth[_0x496d('0x9')](),controller[_0x496d('0xc')]);router[_0x496d('0xd')]('/',auth[_0x496d('0x9')](),controller[_0x496d('0xe')]);router[_0x496d('0xf')](_0x496d('0xb'),auth[_0x496d('0x9')](),controller['update']);router[_0x496d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x496d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf5ec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','path','express'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf5ec,0x165));var _0xcf5e=function(_0x52f271,_0x335ffb){_0x52f271=_0x52f271-0x0;var _0x5adc27=_0xf5ec[_0x52f271];return _0x5adc27;};'use strict';var multer=require(_0xcf5e('0x0'));var util=require(_0xcf5e('0x1'));var path=require(_0xcf5e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf5e('0x3'));var router=express[_0xcf5e('0x4')]();var fs_extra=require(_0xcf5e('0x5'));var auth=require(_0xcf5e('0x6'));var interaction=require(_0xcf5e('0x7'));var config=require(_0xcf5e('0x8'));var controller=require(_0xcf5e('0x9'));router[_0xcf5e('0xa')]('/',auth[_0xcf5e('0xb')](),controller[_0xcf5e('0xc')]);router['get'](_0xcf5e('0xd'),auth['isAuthenticated'](),controller[_0xcf5e('0xe')]);router[_0xcf5e('0xf')]('/',auth['isAuthenticated'](),controller[_0xcf5e('0x10')]);router['put'](_0xcf5e('0xd'),auth[_0xcf5e('0xb')](),controller[_0xcf5e('0x11')]);router[_0xcf5e('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 83b0f5f..fcda326 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 _0xb11e=['name','sequelize','exports','STRING'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0xb11e,0x7d));var _0xeb11=function(_0x22ab2d,_0x29ec89){_0x22ab2d=_0x22ab2d-0x0;var _0x51a9f7=_0xb11e[_0x22ab2d];return _0x51a9f7;};'use strict';var Sequelize=require(_0xeb11('0x0'));module[_0xeb11('0x1')]={'name':{'type':Sequelize[_0xeb11('0x2')],'unique':_0xeb11('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeb11('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5236=['name','sequelize','exports','STRING'];(function(_0x4543f8,_0x29face){var _0x5141f0=function(_0x3e5afa){while(--_0x3e5afa){_0x4543f8['push'](_0x4543f8['shift']());}};_0x5141f0(++_0x29face);}(_0x5236,0x109));var _0x6523=function(_0x1bab65,_0x4e223a){_0x1bab65=_0x1bab65-0x0;var _0x5ee2a1=_0x5236[_0x1bab65];return _0x5ee2a1;};'use strict';var Sequelize=require(_0x6523('0x0'));module[_0x6523('0x1')]={'name':{'type':Sequelize[_0x6523('0x2')],'unique':_0x6523('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6523('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x6523('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8a50f56..c4abde9 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 _0xb7c8=['nolimit','order','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x521829,_0x15c492){var _0x476ce5=function(_0x472477){while(--_0x472477){_0x521829['push'](_0x521829['shift']());}};_0x476ce5(++_0x15c492);}(_0xb7c8,0x119));var _0x8b7c=function(_0x209369,_0xa93559){_0x209369=_0x209369-0x0;var _0x42b78c=_0xb7c8[_0x209369];return _0x42b78c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b7c('0x0'));var zipdir=require(_0x8b7c('0x1'));var jsonpatch=require(_0x8b7c('0x2'));var rp=require(_0x8b7c('0x3'));var moment=require(_0x8b7c('0x4'));var BPromise=require(_0x8b7c('0x5'));var Mustache=require(_0x8b7c('0x6'));var util=require('util');var path=require(_0x8b7c('0x7'));var sox=require(_0x8b7c('0x8'));var csv=require(_0x8b7c('0x9'));var ejs=require(_0x8b7c('0xa'));var fs=require('fs');var fs_extra=require(_0x8b7c('0xb'));var _=require(_0x8b7c('0xc'));var squel=require(_0x8b7c('0xd'));var crypto=require(_0x8b7c('0xe'));var jsforce=require(_0x8b7c('0xf'));var deskjs=require(_0x8b7c('0x10'));var toCsv=require(_0x8b7c('0x9'));var querystring=require(_0x8b7c('0x11'));var Papa=require('papaparse');var Redis=require(_0x8b7c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8b7c('0x13'));var as=require(_0x8b7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b7c('0x15'))(_0x8b7c('0x16'));var utils=require(_0x8b7c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b7c('0x18'))['db'];function respondWithStatusCode(_0x33c5aa,_0x297c39){_0x297c39=_0x297c39||0xcc;return function(_0x282b87){if(_0x282b87){return _0x33c5aa[_0x8b7c('0x19')](_0x297c39);}return _0x33c5aa[_0x8b7c('0x1a')](_0x297c39)[_0x8b7c('0x1b')]();};}function respondWithResult(_0x56e02b,_0x2b60a7){_0x2b60a7=_0x2b60a7||0xc8;return function(_0x19c63e){if(_0x19c63e){return _0x56e02b[_0x8b7c('0x1a')](_0x2b60a7)['json'](_0x19c63e);}};}function respondWithFilteredResult(_0xd37a82,_0x4284a2){return function(_0x496bc0){if(_0x496bc0){var _0x3b8d62=typeof _0x4284a2[_0x8b7c('0x1c')]===_0x8b7c('0x1d')&&typeof _0x4284a2[_0x8b7c('0x1e')]===_0x8b7c('0x1d');var _0x4cc809=_0x496bc0[_0x8b7c('0x1f')];var _0x3ef583=_0x3b8d62?0x0:_0x4284a2[_0x8b7c('0x1c')];var _0x2ac635=_0x3b8d62?_0x496bc0[_0x8b7c('0x1f')]:_0x4284a2['offset']+_0x4284a2[_0x8b7c('0x1e')];var _0x2b0874;if(_0x2ac635>=_0x4cc809){_0x2ac635=_0x4cc809;_0x2b0874=0xc8;}else{_0x2b0874=0xce;}_0xd37a82[_0x8b7c('0x1a')](_0x2b0874);return _0xd37a82[_0x8b7c('0x20')](_0x8b7c('0x21'),_0x3ef583+'-'+_0x2ac635+'/'+_0x4cc809)[_0x8b7c('0x22')](_0x496bc0);}return null;};}function patchUpdates(_0x3f587b){return function(_0xd0c3e6){try{jsonpatch[_0x8b7c('0x23')](_0xd0c3e6,_0x3f587b,!![]);}catch(_0xd006c4){return BPromise[_0x8b7c('0x24')](_0xd006c4);}return _0xd0c3e6[_0x8b7c('0x25')]();};}function saveUpdates(_0x53451d,_0x4222ab){return function(_0x3186cd){if(_0x3186cd){return _0x3186cd[_0x8b7c('0x26')](_0x53451d)[_0x8b7c('0x27')](function(_0x9365e3){return _0x9365e3;});}return null;};}function removeEntity(_0x389411,_0x2922a0){return function(_0x3870b4){if(_0x3870b4){return _0x3870b4[_0x8b7c('0x28')]()[_0x8b7c('0x27')](function(){var _0x5e131c=_0x3870b4['get']({'plain':!![]});var _0x2b318e='Tags';return db[_0x8b7c('0x29')][_0x8b7c('0x28')]({'where':{'type':_0x2b318e,'resourceId':_0x5e131c['id']}})[_0x8b7c('0x27')](function(){return _0x3870b4;});})[_0x8b7c('0x27')](function(){_0x389411[_0x8b7c('0x1a')](0xcc)[_0x8b7c('0x1b')]();});}};}function handleEntityNotFound(_0x58dc4a,_0x39d677){return function(_0x31390d){if(!_0x31390d){_0x58dc4a[_0x8b7c('0x19')](0x194);}return _0x31390d;};}function handleError(_0x94a31e,_0x305a40){_0x305a40=_0x305a40||0x1f4;return function(_0x3c4b0c){logger[_0x8b7c('0x2a')](_0x3c4b0c[_0x8b7c('0x2b')]);if(_0x3c4b0c[_0x8b7c('0x2c')]){delete _0x3c4b0c[_0x8b7c('0x2c')];}_0x94a31e['status'](_0x305a40)['send'](_0x3c4b0c);};}exports[_0x8b7c('0x2d')]=function(_0x170fa9,_0x101649){var _0x3f5fab={},_0x3bfe78={},_0x1f373f={'count':0x0,'rows':[]};var _0xb5356=_[_0x8b7c('0x2e')](db[_0x8b7c('0x2f')][_0x8b7c('0x30')],function(_0x57406f){return{'name':_0x57406f[_0x8b7c('0x31')],'type':_0x57406f['type'][_0x8b7c('0x32')]};});_0x3bfe78[_0x8b7c('0x33')]=_['map'](_0xb5356,_0x8b7c('0x2c'));_0x3bfe78['query']=_[_0x8b7c('0x34')](_0x170fa9[_0x8b7c('0x35')]);_0x3bfe78[_0x8b7c('0x36')]=_[_0x8b7c('0x37')](_0x3bfe78[_0x8b7c('0x33')],_0x3bfe78[_0x8b7c('0x35')]);_0x3f5fab[_0x8b7c('0x38')]=_[_0x8b7c('0x37')](_0x3bfe78[_0x8b7c('0x33')],qs['fields'](_0x170fa9[_0x8b7c('0x35')][_0x8b7c('0x39')]));_0x3f5fab['attributes']=_0x3f5fab['attributes']['length']?_0x3f5fab[_0x8b7c('0x38')]:_0x3bfe78[_0x8b7c('0x33')];if(!_0x170fa9['query'][_0x8b7c('0x3a')](_0x8b7c('0x3b'))){_0x3f5fab[_0x8b7c('0x1e')]=qs[_0x8b7c('0x1e')](_0x170fa9['query'][_0x8b7c('0x1e')]);_0x3f5fab[_0x8b7c('0x1c')]=qs[_0x8b7c('0x1c')](_0x170fa9['query'][_0x8b7c('0x1c')]);}_0x3f5fab[_0x8b7c('0x3c')]=qs['sort'](_0x170fa9['query']['sort']);_0x3f5fab[_0x8b7c('0x3d')]=qs[_0x8b7c('0x36')](_[_0x8b7c('0x3e')](_0x170fa9[_0x8b7c('0x35')],_0x3bfe78[_0x8b7c('0x36')]),_0xb5356);if(_0x170fa9[_0x8b7c('0x35')]['filter']){_0x3f5fab[_0x8b7c('0x3d')]=_[_0x8b7c('0x3f')](_0x3f5fab[_0x8b7c('0x3d')],{'$or':_[_0x8b7c('0x2e')](_0xb5356,function(_0x332f32){if(_0x332f32[_0x8b7c('0x40')]!=='VIRTUAL'){var _0x2458b2={};_0x2458b2[_0x332f32[_0x8b7c('0x2c')]]={'$like':'%'+_0x170fa9[_0x8b7c('0x35')][_0x8b7c('0x41')]+'%'};return _0x2458b2;}})});}_0x3f5fab=_[_0x8b7c('0x3f')]({},_0x3f5fab,_0x170fa9[_0x8b7c('0x42')]);var _0x571658={'where':_0x3f5fab['where']};return db[_0x8b7c('0x2f')][_0x8b7c('0x1f')](_0x571658)['then'](function(_0x50908c){_0x1f373f[_0x8b7c('0x1f')]=_0x50908c;if(_0x170fa9[_0x8b7c('0x35')][_0x8b7c('0x43')]){_0x3f5fab[_0x8b7c('0x44')]=[{'all':!![]}];}return db[_0x8b7c('0x2f')][_0x8b7c('0x45')](_0x3f5fab);})[_0x8b7c('0x27')](function(_0x22d574){_0x1f373f[_0x8b7c('0x46')]=_0x22d574;return _0x1f373f;})[_0x8b7c('0x27')](respondWithFilteredResult(_0x101649,_0x3f5fab))[_0x8b7c('0x47')](handleError(_0x101649,null));};exports[_0x8b7c('0x48')]=function(_0x5aec7d,_0x40cc39){var _0x21a690={'raw':!![],'where':{'id':_0x5aec7d[_0x8b7c('0x49')]['id']}},_0x1afec7={};_0x1afec7[_0x8b7c('0x33')]=_['keys'](db['Tag'][_0x8b7c('0x30')]);_0x1afec7[_0x8b7c('0x35')]=_[_0x8b7c('0x34')](_0x5aec7d[_0x8b7c('0x35')]);_0x1afec7[_0x8b7c('0x36')]=_[_0x8b7c('0x37')](_0x1afec7['model'],_0x1afec7['query']);_0x21a690[_0x8b7c('0x38')]=_[_0x8b7c('0x37')](_0x1afec7['model'],qs[_0x8b7c('0x39')](_0x5aec7d[_0x8b7c('0x35')][_0x8b7c('0x39')]));_0x21a690['attributes']=_0x21a690['attributes'][_0x8b7c('0x4a')]?_0x21a690['attributes']:_0x1afec7[_0x8b7c('0x33')];if(_0x5aec7d[_0x8b7c('0x35')][_0x8b7c('0x43')]){_0x21a690[_0x8b7c('0x44')]=[{'all':!![]}];}_0x21a690=_[_0x8b7c('0x3f')]({},_0x21a690,_0x5aec7d[_0x8b7c('0x42')]);return db[_0x8b7c('0x2f')]['find'](_0x21a690)[_0x8b7c('0x27')](handleEntityNotFound(_0x40cc39,null))[_0x8b7c('0x27')](respondWithResult(_0x40cc39,null))[_0x8b7c('0x47')](handleError(_0x40cc39,null));};exports[_0x8b7c('0x4b')]=function(_0x5d5758,_0x56d378){return db['Tag'][_0x8b7c('0x4b')](_0x5d5758[_0x8b7c('0x4c')],{})[_0x8b7c('0x27')](function(_0x56aa21){var _0x190192=_0x5d5758[_0x8b7c('0x4d')][_0x8b7c('0x4e')]({'plain':!![]});if(!_0x190192)throw new Error(_0x8b7c('0x4f'));if(_0x190192[_0x8b7c('0x50')]===_0x8b7c('0x4d')){var _0x58c25a=_0x56aa21[_0x8b7c('0x4e')]({'plain':!![]});var _0x34413b=_0x8b7c('0x51');return db['UserProfileSection'][_0x8b7c('0x52')]({'where':{'name':_0x34413b,'userProfileId':_0x190192[_0x8b7c('0x53')]},'raw':!![]})[_0x8b7c('0x27')](function(_0x2d0fee){if(_0x2d0fee&&_0x2d0fee['autoAssociation']===0x0){return db['UserProfileResource'][_0x8b7c('0x4b')]({'name':_0x58c25a[_0x8b7c('0x2c')],'resourceId':_0x58c25a['id'],'type':_0x2d0fee['name'],'sectionId':_0x2d0fee['id']},{})[_0x8b7c('0x27')](function(){return _0x56aa21;});}else{return _0x56aa21;}})[_0x8b7c('0x47')](function(_0x458b82){logger['error'](_0x8b7c('0x54'),_0x458b82);throw _0x458b82;});}return _0x56aa21;})[_0x8b7c('0x27')](respondWithResult(_0x56d378,0xc9))[_0x8b7c('0x47')](handleError(_0x56d378,null));};exports[_0x8b7c('0x26')]=function(_0x29ff93,_0x2fbd87){if(_0x29ff93['body']['id']){delete _0x29ff93['body']['id'];}return db[_0x8b7c('0x2f')][_0x8b7c('0x52')]({'where':{'id':_0x29ff93['params']['id']}})['then'](handleEntityNotFound(_0x2fbd87,null))['then'](saveUpdates(_0x29ff93[_0x8b7c('0x4c')],null))['then'](respondWithResult(_0x2fbd87,null))['catch'](handleError(_0x2fbd87,null));};exports[_0x8b7c('0x28')]=function(_0x52b4e3,_0x2746fb){return db[_0x8b7c('0x2f')][_0x8b7c('0x52')]({'where':{'id':_0x52b4e3[_0x8b7c('0x49')]['id']}})[_0x8b7c('0x27')](handleEntityNotFound(_0x2746fb,null))['then'](removeEntity(_0x2746fb,null))[_0x8b7c('0x47')](handleError(_0x2746fb,null));}; \ No newline at end of file +var _0xb717=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Tags','end','sendStatus','stack','name','send','map','Tag','rawAttributes','fieldName','type','model'];(function(_0x497568,_0x133550){var _0x63ca6d=function(_0x4b73ef){while(--_0x4b73ef){_0x497568['push'](_0x497568['shift']());}};_0x63ca6d(++_0x133550);}(_0xb717,0x1b4));var _0x7b71=function(_0x49ac9f,_0x5a4dc4){_0x49ac9f=_0x49ac9f-0x0;var _0x430a1c=_0xb717[_0x49ac9f];return _0x430a1c;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){var _0x16c1f3=_0x478dd8[_0x7b71('0x25')]({'plain':!![]});var _0x19a6f5=_0x7b71('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x19a6f5,'resourceId':_0x16c1f3['id']}})[_0x7b71('0x23')](function(){return _0x478dd8;});})[_0x7b71('0x23')](function(){_0x33ad80['status'](0xcc)[_0x7b71('0x27')]();});}};}function handleEntityNotFound(_0x214555,_0x7c978b){return function(_0x2f9ca9){if(!_0x2f9ca9){_0x214555[_0x7b71('0x28')](0x194);}return _0x2f9ca9;};}function handleError(_0x5209b6,_0x55ae81){_0x55ae81=_0x55ae81||0x1f4;return function(_0x2b323b){logger['error'](_0x2b323b[_0x7b71('0x29')]);if(_0x2b323b['name']){delete _0x2b323b[_0x7b71('0x2a')];}_0x5209b6[_0x7b71('0x18')](_0x55ae81)[_0x7b71('0x2b')](_0x2b323b);};}exports['index']=function(_0x1e4e89,_0xc29e2b){var _0x21ef65={},_0x5b5a4b={},_0x5e11e1={'count':0x0,'rows':[]};var _0xd100d4=_[_0x7b71('0x2c')](db[_0x7b71('0x2d')][_0x7b71('0x2e')],function(_0x43925c){return{'name':_0x43925c[_0x7b71('0x2f')],'type':_0x43925c[_0x7b71('0x30')]['key']};});_0x5b5a4b[_0x7b71('0x31')]=_[_0x7b71('0x2c')](_0xd100d4,_0x7b71('0x2a'));_0x5b5a4b['query']=_[_0x7b71('0x32')](_0x1e4e89[_0x7b71('0x33')]);_0x5b5a4b[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],_0x5b5a4b[_0x7b71('0x33')]);_0x21ef65['attributes']=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x36')]));_0x21ef65['attributes']=_0x21ef65[_0x7b71('0x37')][_0x7b71('0x38')]?_0x21ef65[_0x7b71('0x37')]:_0x5b5a4b[_0x7b71('0x31')];if(!_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x39')](_0x7b71('0x3a'))){_0x21ef65[_0x7b71('0x1c')]=qs['limit'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1c')]);_0x21ef65[_0x7b71('0x1a')]=qs[_0x7b71('0x1a')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1a')]);}_0x21ef65[_0x7b71('0x3b')]=qs['sort'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3c')]);_0x21ef65[_0x7b71('0x3d')]=qs[_0x7b71('0x34')](_['pick'](_0x1e4e89[_0x7b71('0x33')],_0x5b5a4b[_0x7b71('0x34')]),_0xd100d4);if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]){_0x21ef65[_0x7b71('0x3d')]=_[_0x7b71('0x3f')](_0x21ef65[_0x7b71('0x3d')],{'$or':_[_0x7b71('0x2c')](_0xd100d4,function(_0x30e9d1){if(_0x30e9d1[_0x7b71('0x30')]!==_0x7b71('0x40')){var _0x154dd5={};_0x154dd5[_0x30e9d1['name']]={'$like':'%'+_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]+'%'};return _0x154dd5;}})});}_0x21ef65=_['merge']({},_0x21ef65,_0x1e4e89[_0x7b71('0x41')]);var _0x411c57={'where':_0x21ef65[_0x7b71('0x3d')]};return db[_0x7b71('0x2d')][_0x7b71('0x1d')](_0x411c57)['then'](function(_0x37cf27){_0x5e11e1[_0x7b71('0x1d')]=_0x37cf27;if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x42')]){_0x21ef65[_0x7b71('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x21ef65);})[_0x7b71('0x23')](function(_0x541730){_0x5e11e1[_0x7b71('0x44')]=_0x541730;return _0x5e11e1;})[_0x7b71('0x23')](respondWithFilteredResult(_0xc29e2b,_0x21ef65))[_0x7b71('0x45')](handleError(_0xc29e2b,null));};exports[_0x7b71('0x46')]=function(_0x3c3ffb,_0x324b28){var _0x23a762={'raw':!![],'where':{'id':_0x3c3ffb[_0x7b71('0x47')]['id']}},_0x5b73a6={};_0x5b73a6[_0x7b71('0x31')]=_['keys'](db[_0x7b71('0x2d')][_0x7b71('0x2e')]);_0x5b73a6[_0x7b71('0x33')]=_[_0x7b71('0x32')](_0x3c3ffb[_0x7b71('0x33')]);_0x5b73a6[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],_0x5b73a6[_0x7b71('0x33')]);_0x23a762[_0x7b71('0x37')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x3c3ffb['query'][_0x7b71('0x36')]));_0x23a762[_0x7b71('0x37')]=_0x23a762['attributes']['length']?_0x23a762['attributes']:_0x5b73a6[_0x7b71('0x31')];if(_0x3c3ffb[_0x7b71('0x33')][_0x7b71('0x42')]){_0x23a762['include']=[{'all':!![]}];}_0x23a762=_[_0x7b71('0x3f')]({},_0x23a762,_0x3c3ffb[_0x7b71('0x41')]);return db['Tag'][_0x7b71('0x48')](_0x23a762)[_0x7b71('0x23')](handleEntityNotFound(_0x324b28,null))[_0x7b71('0x23')](respondWithResult(_0x324b28,null))['catch'](handleError(_0x324b28,null));};exports[_0x7b71('0x49')]=function(_0x18cb19,_0x945c68){return db[_0x7b71('0x2d')][_0x7b71('0x49')](_0x18cb19[_0x7b71('0x4a')],{})[_0x7b71('0x23')](function(_0x30e8d8){var _0xdb438=_0x18cb19[_0x7b71('0x4b')][_0x7b71('0x25')]({'plain':!![]});if(!_0xdb438)throw new Error(_0x7b71('0x4c'));if(_0xdb438['role']===_0x7b71('0x4b')){var _0x504cdf=_0x30e8d8[_0x7b71('0x25')]({'plain':!![]});var _0x154f72=_0x7b71('0x26');return db[_0x7b71('0x4d')][_0x7b71('0x48')]({'where':{'name':_0x154f72,'userProfileId':_0xdb438[_0x7b71('0x4e')]},'raw':!![]})['then'](function(_0x318605){if(_0x318605&&_0x318605['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b71('0x49')]({'name':_0x504cdf['name'],'resourceId':_0x504cdf['id'],'type':_0x318605[_0x7b71('0x2a')],'sectionId':_0x318605['id']},{})[_0x7b71('0x23')](function(){return _0x30e8d8;});}else{return _0x30e8d8;}})[_0x7b71('0x45')](function(_0x38cf0e){logger[_0x7b71('0x4f')](_0x7b71('0x50'),_0x38cf0e);throw _0x38cf0e;});}return _0x30e8d8;})[_0x7b71('0x23')](respondWithResult(_0x945c68,0xc9))[_0x7b71('0x45')](handleError(_0x945c68,null));};exports[_0x7b71('0x22')]=function(_0x38395a,_0xbb46b3){if(_0x38395a['body']['id']){delete _0x38395a['body']['id'];}return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x38395a[_0x7b71('0x47')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0xbb46b3,null))[_0x7b71('0x23')](saveUpdates(_0x38395a['body'],null))['then'](respondWithResult(_0xbb46b3,null))['catch'](handleError(_0xbb46b3,null));};exports[_0x7b71('0x24')]=function(_0x48b486,_0x1d3acf){return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x48b486[_0x7b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3acf,null))[_0x7b71('0x23')](removeEntity(_0x1d3acf,null))['catch'](handleError(_0x1d3acf,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 61223b5..0e13585 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 _0x1a3c=['./tag.attributes','exports','define','Tag','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ee458,_0x4f966d){var _0x4df0c8=function(_0x36d4a0){while(--_0x36d4a0){_0x4ee458['push'](_0x4ee458['shift']());}};_0x4df0c8(++_0x4f966d);}(_0x1a3c,0x1a6));var _0xc1a3=function(_0xc17146,_0x911e46){_0xc17146=_0xc17146-0x0;var _0x6d93ab=_0x1a3c[_0xc17146];return _0x6d93ab;};'use strict';var _=require(_0xc1a3('0x0'));var util=require('util');var logger=require(_0xc1a3('0x1'))('api');var moment=require(_0xc1a3('0x2'));var BPromise=require(_0xc1a3('0x3'));var rp=require(_0xc1a3('0x4'));var fs=require('fs');var path=require(_0xc1a3('0x5'));var rimraf=require(_0xc1a3('0x6'));var config=require('../../config/environment');var attributes=require(_0xc1a3('0x7'));module[_0xc1a3('0x8')]=function(_0x12db04,_0x55d1fc){return _0x12db04[_0xc1a3('0x9')](_0xc1a3('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4307=['rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4eebd7,_0x3e3b58){var _0x324aa9=function(_0x32a4eb){while(--_0x32a4eb){_0x4eebd7['push'](_0x4eebd7['shift']());}};_0x324aa9(++_0x3e3b58);}(_0x4307,0x145));var _0x7430=function(_0x20e77e,_0x3e0c74){_0x20e77e=_0x20e77e-0x0;var _0x213558=_0x4307[_0x20e77e];return _0x213558;};'use strict';var _=require(_0x7430('0x0'));var util=require('util');var logger=require(_0x7430('0x1'))('api');var moment=require(_0x7430('0x2'));var BPromise=require(_0x7430('0x3'));var rp=require(_0x7430('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7430('0x5'));var config=require(_0x7430('0x6'));var attributes=require('./tag.attributes');module[_0x7430('0x7')]=function(_0x573317,_0x1cab19){return _0x573317[_0x7430('0x8')](_0x7430('0x9'),attributes,{'tableName':_0x7430('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 20833e2..b2c1df6 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 _0xe198=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis'];(function(_0x9209b3,_0x2a2213){var _0x40c615=function(_0x4289f8){while(--_0x4289f8){_0x9209b3['push'](_0x9209b3['shift']());}};_0x40c615(++_0x2a2213);}(_0xe198,0x6f));var _0x8e19=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe198[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e19('0x2'));var fs=require('fs');var Redis=require(_0x8e19('0x3'));var db=require(_0x8e19('0x4'))['db'];var utils=require(_0x8e19('0x5'));var logger=require(_0x8e19('0x6'))('rpc');var config=require(_0x8e19('0x7'));var jayson=require(_0x8e19('0x8'));var client=jayson[_0x8e19('0x9')][_0x8e19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1175d6,_0x4db35e,_0x1e61ae){return new BPromise(function(_0xfc45e,_0xfc4670){return client[_0x8e19('0xb')](_0x1175d6,_0x1e61ae)[_0x8e19('0xc')](function(_0x41e998){logger[_0x8e19('0xd')]('Tag,\x20%s,\x20%s',_0x4db35e,_0x8e19('0xe'));logger[_0x8e19('0xf')](_0x8e19('0x10'),_0x4db35e,_0x8e19('0xe'),JSON[_0x8e19('0x11')](_0x41e998));if(_0x41e998[_0x8e19('0x12')]){if(_0x41e998[_0x8e19('0x12')][_0x8e19('0x13')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc4670(_0x41e998['error'][_0x8e19('0x14')]);}logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc45e(_0x41e998[_0x8e19('0x12')][_0x8e19('0x14')]);}else{logger['info'](_0x8e19('0x15'),_0x4db35e,_0x8e19('0xe'));_0xfc45e(_0x41e998['result'][_0x8e19('0x14')]);}})[_0x8e19('0x16')](function(_0x47680f){logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x47680f);_0xfc4670(_0x47680f);});});} \ No newline at end of file +var _0x2121=['request\x20sent','stringify','error','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x9bb1a4,_0x168d76){var _0x4c33dd=function(_0x1686f1){while(--_0x1686f1){_0x9bb1a4['push'](_0x9bb1a4['shift']());}};_0x4c33dd(++_0x168d76);}(_0x2121,0x1b4));var _0x1212=function(_0x1642e0,_0x379fc7){_0x1642e0=_0x1642e0-0x0;var _0x16a62a=_0x2121[_0x1642e0];return _0x16a62a;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 31561b3..0610aec 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b730966..f98f56a 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 _0xb7e7=['STRING','sequelize'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xb78a58,_0x28eb90){var _0x6f4789=function(_0x4ae9af){while(--_0x4ae9af){_0xb78a58['push'](_0xb78a58['shift']());}};_0x6f4789(++_0x28eb90);}(_0x2032,0xd9));var _0x2203=function(_0x5814a2,_0x4ea77b){_0x5814a2=_0x5814a2-0x0;var _0x5d507f=_0x2032[_0x5814a2];return _0x5d507f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('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 96f2360..e05aaa7 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 _0xebb5=['QueueId','Voice','defaults','penalty','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','TeamVoiceQueue','all','VoicePrefixId','spread','Chat','Sms','removeAgents','getAgents','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./team.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','sendStatus','error','stack','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','name','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','SELECT','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','UserProfileResource','getQueues','findOne','channel','ValidationError','Unknown\x20channel','toLowerCase','pick','options','addQueues','isValidChannel','add','capitalize','Queues','removeQueues','remove','ids','addAgents','isArray','Mail','Fax','Openchannel','through'];(function(_0x2f9387,_0x101e39){var _0x425109=function(_0x1647d3){while(--_0x1647d3){_0x2f9387['push'](_0x2f9387['shift']());}};_0x425109(++_0x101e39);}(_0xebb5,0xb2));var _0x5ebb=function(_0x28f05f,_0x5542c6){_0x28f05f=_0x28f05f-0x0;var _0x2ace69=_0xebb5[_0x28f05f];return _0x2ace69;};'use strict';var emlformat=require(_0x5ebb('0x0'));var rimraf=require(_0x5ebb('0x1'));var zipdir=require(_0x5ebb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ebb('0x3'));var moment=require(_0x5ebb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ebb('0x5'));var util=require(_0x5ebb('0x6'));var path=require(_0x5ebb('0x7'));var sox=require(_0x5ebb('0x8'));var csv=require(_0x5ebb('0x9'));var ejs=require(_0x5ebb('0xa'));var fs=require('fs');var fs_extra=require(_0x5ebb('0xb'));var _=require(_0x5ebb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ebb('0xd'));var toCsv=require(_0x5ebb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5ebb('0xe'));var authService=require(_0x5ebb('0xf'));var qs=require(_0x5ebb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ebb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5ebb('0x12'));var config=require(_0x5ebb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ebb('0x14'))['db'];config[_0x5ebb('0x15')]=_['defaults'](config[_0x5ebb('0x15')],{'host':_0x5ebb('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ebb('0x15')]));require(_0x5ebb('0x17'))[_0x5ebb('0x18')](socket);function respondWithStatusCode(_0x1520e5,_0x458bf7){_0x458bf7=_0x458bf7||0xcc;return function(_0x357469){if(_0x357469){return _0x1520e5['sendStatus'](_0x458bf7);}return _0x1520e5['status'](_0x458bf7)[_0x5ebb('0x19')]();};}function respondWithResult(_0x22ce81,_0x21559f){_0x21559f=_0x21559f||0xc8;return function(_0x171937){if(_0x171937){return _0x22ce81[_0x5ebb('0x1a')](_0x21559f)[_0x5ebb('0x1b')](_0x171937);}};}function respondWithFilteredResult(_0x98edd4,_0x569cdc){return function(_0x876868){if(_0x876868){var _0x4d9a3f=typeof _0x569cdc[_0x5ebb('0x1c')]===_0x5ebb('0x1d')&&typeof _0x569cdc[_0x5ebb('0x1e')]===_0x5ebb('0x1d');var _0x419691=_0x876868[_0x5ebb('0x1f')];var _0x18ebaa=_0x4d9a3f?0x0:_0x569cdc[_0x5ebb('0x1c')];var _0x32268e=_0x4d9a3f?_0x876868[_0x5ebb('0x1f')]:_0x569cdc['offset']+_0x569cdc['limit'];var _0x179bb3;if(_0x32268e>=_0x419691){_0x32268e=_0x419691;_0x179bb3=0xc8;}else{_0x179bb3=0xce;}_0x98edd4[_0x5ebb('0x1a')](_0x179bb3);return _0x98edd4[_0x5ebb('0x20')](_0x5ebb('0x21'),_0x18ebaa+'-'+_0x32268e+'/'+_0x419691)[_0x5ebb('0x1b')](_0x876868);}return null;};}function patchUpdates(_0x3b8dbe){return function(_0x55eaec){try{jsonpatch[_0x5ebb('0x22')](_0x55eaec,_0x3b8dbe,!![]);}catch(_0x58d760){return BPromise['reject'](_0x58d760);}return _0x55eaec['save']();};}function saveUpdates(_0x504364,_0x28b556){return function(_0x5f295d){if(_0x5f295d){return _0x5f295d[_0x5ebb('0x23')](_0x504364)['then'](function(_0x561b8b){return _0x561b8b;});}return null;};}function handleEntityNotFound(_0x52b4b9,_0x5e62eb){return function(_0x255a79){if(!_0x255a79){_0x52b4b9[_0x5ebb('0x24')](0x194);}return _0x255a79;};}function handleError(_0x435807,_0x1c245f){_0x1c245f=_0x1c245f||0x1f4;return function(_0x2f8d51){logger[_0x5ebb('0x25')](_0x2f8d51[_0x5ebb('0x26')]);if(_0x2f8d51['name']){delete _0x2f8d51['name'];}_0x435807['status'](_0x1c245f)[_0x5ebb('0x27')](_0x2f8d51);};}exports[_0x5ebb('0x28')]=function(_0x23bfe2,_0x59af26){var _0x23d500={},_0x4be46b={},_0x303986={'count':0x0,'rows':[]};var _0x13255c=_[_0x5ebb('0x29')](db[_0x5ebb('0x2a')][_0x5ebb('0x2b')],function(_0x1d309b){return{'name':_0x1d309b[_0x5ebb('0x2c')],'type':_0x1d309b[_0x5ebb('0x2d')][_0x5ebb('0x2e')]};});_0x4be46b[_0x5ebb('0x2f')]=_[_0x5ebb('0x29')](_0x13255c,'name');_0x4be46b[_0x5ebb('0x30')]=_[_0x5ebb('0x31')](_0x23bfe2['query']);_0x4be46b[_0x5ebb('0x32')]=_[_0x5ebb('0x33')](_0x4be46b['model'],_0x4be46b[_0x5ebb('0x30')]);_0x23d500['attributes']=_['intersection'](_0x4be46b[_0x5ebb('0x2f')],qs[_0x5ebb('0x34')](_0x23bfe2[_0x5ebb('0x30')][_0x5ebb('0x34')]));_0x23d500[_0x5ebb('0x35')]=_0x23d500[_0x5ebb('0x35')][_0x5ebb('0x36')]?_0x23d500[_0x5ebb('0x35')]:_0x4be46b[_0x5ebb('0x2f')];if(!_0x23bfe2[_0x5ebb('0x30')][_0x5ebb('0x37')]('nolimit')){_0x23d500[_0x5ebb('0x1e')]=qs[_0x5ebb('0x1e')](_0x23bfe2['query']['limit']);_0x23d500[_0x5ebb('0x1c')]=qs[_0x5ebb('0x1c')](_0x23bfe2['query'][_0x5ebb('0x1c')]);}_0x23d500['order']=qs[_0x5ebb('0x38')](_0x23bfe2[_0x5ebb('0x30')][_0x5ebb('0x38')]);_0x23d500[_0x5ebb('0x39')]=qs[_0x5ebb('0x32')](_['pick'](_0x23bfe2[_0x5ebb('0x30')],_0x4be46b[_0x5ebb('0x32')]),_0x13255c);if(_0x23bfe2[_0x5ebb('0x30')][_0x5ebb('0x3a')]){_0x23d500[_0x5ebb('0x39')]=_[_0x5ebb('0x3b')](_0x23d500[_0x5ebb('0x39')],{'$or':_['map'](_0x13255c,function(_0x5da14a){if(_0x5da14a[_0x5ebb('0x2d')]!=='VIRTUAL'){var _0x2a0591={};_0x2a0591[_0x5da14a[_0x5ebb('0x3c')]]={'$like':'%'+_0x23bfe2['query'][_0x5ebb('0x3a')]+'%'};return _0x2a0591;}})});}_0x23d500=_[_0x5ebb('0x3b')]({},_0x23d500,_0x23bfe2['options']);var _0x11e139={'where':_0x23d500[_0x5ebb('0x39')]};return db[_0x5ebb('0x2a')]['count'](_0x11e139)['then'](function(_0x2d1c18){_0x303986[_0x5ebb('0x1f')]=_0x2d1c18;if(_0x23bfe2[_0x5ebb('0x30')][_0x5ebb('0x3d')]){_0x23d500[_0x5ebb('0x3e')]=[{'all':!![]}];}return db['Team'][_0x5ebb('0x3f')](_0x23d500);})[_0x5ebb('0x40')](function(_0x3e3652){_0x303986[_0x5ebb('0x41')]=_0x3e3652;return _0x303986;})[_0x5ebb('0x40')](respondWithFilteredResult(_0x59af26,_0x23d500))[_0x5ebb('0x42')](handleError(_0x59af26,null));};exports[_0x5ebb('0x43')]=function(_0x1f8238,_0x2d23c1){var _0x32ff76={'raw':![],'where':{'id':_0x1f8238[_0x5ebb('0x44')]['id']}},_0xcd1c0a={};_0xcd1c0a[_0x5ebb('0x2f')]=_[_0x5ebb('0x31')](db[_0x5ebb('0x2a')][_0x5ebb('0x2b')]);_0xcd1c0a[_0x5ebb('0x30')]=_['keys'](_0x1f8238[_0x5ebb('0x30')]);_0xcd1c0a[_0x5ebb('0x32')]=_[_0x5ebb('0x33')](_0xcd1c0a[_0x5ebb('0x2f')],_0xcd1c0a[_0x5ebb('0x30')]);_0x32ff76[_0x5ebb('0x35')]=_[_0x5ebb('0x33')](_0xcd1c0a['model'],qs[_0x5ebb('0x34')](_0x1f8238['query'][_0x5ebb('0x34')]));_0x32ff76[_0x5ebb('0x35')]=_0x32ff76['attributes']['length']?_0x32ff76['attributes']:_0xcd1c0a[_0x5ebb('0x2f')];if(_0x1f8238[_0x5ebb('0x30')][_0x5ebb('0x3d')]){_0x32ff76[_0x5ebb('0x3e')]=[{'all':!![]}];}_0x32ff76=_[_0x5ebb('0x3b')]({},_0x32ff76,_0x1f8238['options']);return db['Team'][_0x5ebb('0x45')](_0x32ff76)['then'](handleEntityNotFound(_0x2d23c1,null))['then'](respondWithResult(_0x2d23c1,null))[_0x5ebb('0x42')](handleError(_0x2d23c1,null));};exports[_0x5ebb('0x46')]=function(_0x20ee17,_0x342c1e){return db['Team'][_0x5ebb('0x46')](_0x20ee17[_0x5ebb('0x47')],{})['then'](function(_0x53d555){var _0x14e91e=_0x20ee17[_0x5ebb('0x48')][_0x5ebb('0x49')]({'plain':!![]});if(!_0x14e91e)throw new Error(_0x5ebb('0x4a'));if(_0x14e91e[_0x5ebb('0x4b')]===_0x5ebb('0x48')){var _0x1f8fe5=_0x53d555['get']({'plain':!![]});var _0x390798=_0x5ebb('0x4c');return db[_0x5ebb('0x4d')][_0x5ebb('0x45')]({'where':{'name':_0x390798,'userProfileId':_0x14e91e[_0x5ebb('0x4e')]},'raw':!![]})[_0x5ebb('0x40')](function(_0x4d42b1){if(_0x4d42b1&&_0x4d42b1[_0x5ebb('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f8fe5[_0x5ebb('0x3c')],'resourceId':_0x1f8fe5['id'],'type':_0x4d42b1[_0x5ebb('0x3c')],'sectionId':_0x4d42b1['id']},{})[_0x5ebb('0x40')](function(){return _0x53d555;});}else{return _0x53d555;}})[_0x5ebb('0x42')](function(_0x4eeb42){logger[_0x5ebb('0x25')](_0x5ebb('0x50'),_0x4eeb42);throw _0x4eeb42;});}return _0x53d555;})[_0x5ebb('0x40')](respondWithResult(_0x342c1e,0xc9))[_0x5ebb('0x42')](handleError(_0x342c1e,null));};exports['update']=function(_0x28b73e,_0x98f48){if(_0x28b73e[_0x5ebb('0x47')]['id']){delete _0x28b73e[_0x5ebb('0x47')]['id'];}return db[_0x5ebb('0x2a')][_0x5ebb('0x45')]({'where':{'id':_0x28b73e[_0x5ebb('0x44')]['id']}})[_0x5ebb('0x40')](handleEntityNotFound(_0x98f48,null))[_0x5ebb('0x40')](saveUpdates(_0x28b73e[_0x5ebb('0x47')],null))['then'](respondWithResult(_0x98f48,null))['catch'](handleError(_0x98f48,null));};exports['destroy']=function(_0x42c7cd,_0x256b21){var _0x25dc92=_0x42c7cd[_0x5ebb('0x44')]['id'];var _0x3d3d22=[];return db[_0x5ebb('0x51')][_0x5ebb('0x52')](function(_0x3bd83a){var _0x39952d=_0x5ebb('0x53')+_0x25dc92;return db['sequelize']['query'](_0x39952d,{'type':db['Sequelize'][_0x5ebb('0x54')]['SELECT'],'raw':!![],'transaction':_0x3bd83a})[_0x5ebb('0x40')](function(_0x3f76b3){_0x3d3d22=_[_0x5ebb('0x29')](_0x3f76b3,function(_0xac457d){return Number(_0xac457d['UserId']);});})[_0x5ebb('0x40')](function(){var _0x3da901=_0x5ebb('0x55')+_0x25dc92;return db[_0x5ebb('0x51')][_0x5ebb('0x30')](_0x3da901,{'type':db[_0x5ebb('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3bd83a});})['then'](function(_0x29fefa){var _0x5ba49c=_['map'](_0x29fefa,function(_0x54339b){return Number(_0x54339b[_0x5ebb('0x57')]);});return db[_0x5ebb('0x58')]['destroy']({'where':{'UserId':{'$in':_0x3d3d22},'VoiceQueueId':{'$in':_0x5ba49c}},'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(){var _0x59d8b6='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x25dc92;return db[_0x5ebb('0x51')][_0x5ebb('0x30')](_0x59d8b6,{'type':db[_0x5ebb('0x56')][_0x5ebb('0x54')][_0x5ebb('0x59')],'raw':!![],'transaction':_0x3bd83a});})['then'](function(_0x247aed){var _0x316c72=_['map'](_0x247aed,function(_0x532b59){return Number(_0x532b59['MailQueueId']);});return db[_0x5ebb('0x5a')][_0x5ebb('0x5b')]({'where':{'UserId':{'$in':_0x3d3d22},'MailQueueId':{'$in':_0x316c72}},'transaction':_0x3bd83a});})['then'](function(){var _0x17844d=_0x5ebb('0x5c')+_0x25dc92;return db['sequelize'][_0x5ebb('0x30')](_0x17844d,{'type':db[_0x5ebb('0x56')][_0x5ebb('0x54')]['SELECT'],'raw':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x10a330){var _0x4d9545=_['map'](_0x10a330,function(_0x14b4d7){return Number(_0x14b4d7['SmsQueueId']);});return db['UserSmsQueue'][_0x5ebb('0x5b')]({'where':{'UserId':{'$in':_0x3d3d22},'SmsQueueId':{'$in':_0x4d9545}},'transaction':_0x3bd83a});})['then'](function(){var _0x3aa10a=_0x5ebb('0x5d')+_0x25dc92;return db['sequelize'][_0x5ebb('0x30')](_0x3aa10a,{'type':db[_0x5ebb('0x56')][_0x5ebb('0x54')][_0x5ebb('0x59')],'raw':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x47714f){var _0x2e2199=_[_0x5ebb('0x29')](_0x47714f,function(_0x4a9d3c){return Number(_0x4a9d3c[_0x5ebb('0x5e')]);});return db[_0x5ebb('0x5f')][_0x5ebb('0x5b')]({'where':{'UserId':{'$in':_0x3d3d22},'ChatQueueId':{'$in':_0x2e2199}},'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(){var _0x18d0a3=_0x5ebb('0x60')+_0x25dc92;return db['sequelize']['query'](_0x18d0a3,{'type':db[_0x5ebb('0x56')][_0x5ebb('0x54')][_0x5ebb('0x59')],'raw':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x218861){var _0x2dd7eb=_[_0x5ebb('0x29')](_0x218861,function(_0x52787a){return Number(_0x52787a[_0x5ebb('0x61')]);});return db[_0x5ebb('0x62')]['destroy']({'where':{'UserId':{'$in':_0x3d3d22},'FaxQueueId':{'$in':_0x2dd7eb}},'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(){var _0x1f1fe9=_0x5ebb('0x63')+_0x25dc92;return db[_0x5ebb('0x51')][_0x5ebb('0x30')](_0x1f1fe9,{'type':db['Sequelize'][_0x5ebb('0x54')][_0x5ebb('0x59')],'raw':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x3990c4){var _0xe00dc0=_[_0x5ebb('0x29')](_0x3990c4,function(_0x55eafe){return Number(_0x55eafe['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x5ebb('0x5b')]({'where':{'UserId':{'$in':_0x3d3d22},'OpenchannelQueueId':{'$in':_0xe00dc0}},'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(){var _0x1bff47=_0x5ebb('0x64')+_0x25dc92;return db[_0x5ebb('0x51')][_0x5ebb('0x30')](_0x1bff47,{'type':db['Sequelize']['QueryTypes'][_0x5ebb('0x59')],'raw':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x3f5b6c){var _0x53f3fb=_[_0x5ebb('0x29')](_0x3f5b6c,function(_0x1c05f9){return Number(_0x1c05f9[_0x5ebb('0x65')]);});return db[_0x5ebb('0x66')]['destroy']({'where':{'UserId':{'$in':_0x3d3d22},'WhatsappQueueId':{'$in':_0x53f3fb}},'transaction':_0x3bd83a});})['then'](function(){return db[_0x5ebb('0x67')][_0x5ebb('0x45')]({'where':{'TeamId':_0x25dc92}});})[_0x5ebb('0x40')](function(_0x3b018a){if(_0x3b018a===null){return;}return db[_0x5ebb('0x68')]['destroy']({'where':{'UserId':{'$in':_0x3d3d22},'VoicePrefixId':_0x3b018a['VoicePrefixId']},'transaction':_0x3bd83a});})['then'](function(){return db[_0x5ebb('0x2a')][_0x5ebb('0x5b')]({'where':{'id':_0x25dc92},'cascade':!![],'transaction':_0x3bd83a});})[_0x5ebb('0x40')](function(_0x202235){if(_0x202235===0x0){_0x256b21['sendStatus'](0x194);}else{return db[_0x5ebb('0x69')][_0x5ebb('0x5b')]({'where':{'type':_0x5ebb('0x4c'),'resourceId':_0x25dc92},'cascade':!![],'transaction':_0x3bd83a})[_0x5ebb('0x40')](function(){_0x256b21[_0x5ebb('0x1a')](0xcc)['end']();});}})[_0x5ebb('0x42')](function(_0x15a1ec){_0x256b21[_0x5ebb('0x1a')](0x1f4)[_0x5ebb('0x27')](_0x15a1ec);});});};exports[_0x5ebb('0x6a')]=function(_0x8017e8,_0x33ad90,_0x559f39){return db['Team'][_0x5ebb('0x6b')]({'where':{'id':_0x8017e8[_0x5ebb('0x44')]['id']}})[_0x5ebb('0x40')](handleEntityNotFound(_0x33ad90,null))[_0x5ebb('0x40')](function(_0x5e0a18){if(!_0x8017e8[_0x5ebb('0x30')][_0x5ebb('0x6c')]||!utils['isValidChannel'](_0x8017e8[_0x5ebb('0x30')][_0x5ebb('0x6c')])){throw new db[(_0x5ebb('0x56'))][(_0x5ebb('0x6d'))](_0x5ebb('0x6e'));}var _0x3d5627={};var _0x28db4d={};_0x28db4d[_0x5ebb('0x2f')]=_[_0x5ebb('0x31')](db[_['capitalize'](_0x8017e8[_0x5ebb('0x30')][_0x5ebb('0x6c')][_0x5ebb('0x6f')]())+'Queue'][_0x5ebb('0x2b')]);_0x28db4d[_0x5ebb('0x30')]=_[_0x5ebb('0x31')](_0x8017e8[_0x5ebb('0x30')]);_0x28db4d[_0x5ebb('0x32')]=_[_0x5ebb('0x33')](_0x28db4d['model'],_0x28db4d[_0x5ebb('0x30')]);_0x3d5627[_0x5ebb('0x35')]=_['intersection'](_0x28db4d[_0x5ebb('0x2f')],qs[_0x5ebb('0x34')](_0x8017e8['query'][_0x5ebb('0x34')]));_0x3d5627[_0x5ebb('0x35')]=_0x3d5627[_0x5ebb('0x35')]['length']?_0x3d5627['attributes']:_0x28db4d[_0x5ebb('0x2f')];_0x3d5627['limit']=qs[_0x5ebb('0x1e')](_0x8017e8['query']['limit']);_0x3d5627[_0x5ebb('0x1c')]=qs[_0x5ebb('0x1c')](_0x8017e8[_0x5ebb('0x30')]['offset']);_0x3d5627['order']=qs['sort'](_0x8017e8['query']['sort']);_0x3d5627[_0x5ebb('0x39')]=qs['filters'](_[_0x5ebb('0x70')](_0x8017e8[_0x5ebb('0x30')],_0x28db4d[_0x5ebb('0x32')]));_0x3d5627=_[_0x5ebb('0x3b')]({},_0x3d5627,_0x8017e8[_0x5ebb('0x71')]);return _0x5e0a18['get'+_['capitalize'](_0x8017e8[_0x5ebb('0x30')]['channel'][_0x5ebb('0x6f')]())+'Queues'](_0x3d5627);})[_0x5ebb('0x40')](respondWithResult(_0x33ad90,null))[_0x5ebb('0x42')](handleError(_0x33ad90,null));};exports[_0x5ebb('0x72')]=function(_0x39c390,_0x3b0fa4,_0xcd15a8){return db[_0x5ebb('0x2a')][_0x5ebb('0x6b')]({'where':{'id':_0x39c390[_0x5ebb('0x44')]['id']}})[_0x5ebb('0x40')](function(_0x83e703){if(_0x83e703){if(!_0x39c390[_0x5ebb('0x47')][_0x5ebb('0x6c')]||!utils[_0x5ebb('0x73')](_0x39c390['body']['channel'])){throw new db[(_0x5ebb('0x56'))][(_0x5ebb('0x6d'))](_0x5ebb('0x6e'));}return _0x83e703[_0x5ebb('0x74')+_[_0x5ebb('0x75')](_0x39c390[_0x5ebb('0x47')][_0x5ebb('0x6c')]['toLowerCase']())+_0x5ebb('0x76')](_0x39c390[_0x5ebb('0x47')]['ids']);}return null;})[_0x5ebb('0x40')](handleEntityNotFound(_0x3b0fa4,null))['then'](respondWithStatusCode(_0x3b0fa4,null))[_0x5ebb('0x42')](handleError(_0x3b0fa4,null));};exports[_0x5ebb('0x77')]=function(_0x511586,_0x12edee,_0x2187cf){return db[_0x5ebb('0x2a')][_0x5ebb('0x6b')]({'where':{'id':_0x511586[_0x5ebb('0x44')]['id']}})[_0x5ebb('0x40')](function(_0x10ff51){if(_0x10ff51){if(!_0x511586[_0x5ebb('0x30')]['channel']||!utils[_0x5ebb('0x73')](_0x511586[_0x5ebb('0x30')][_0x5ebb('0x6c')])){throw new db['Sequelize']['ValidationError'](_0x5ebb('0x6e'));}return _0x10ff51[_0x5ebb('0x78')+_[_0x5ebb('0x75')](_0x511586[_0x5ebb('0x30')][_0x5ebb('0x6c')][_0x5ebb('0x6f')]())+_0x5ebb('0x76')](_0x511586[_0x5ebb('0x30')][_0x5ebb('0x79')]);}return null;})[_0x5ebb('0x40')](handleEntityNotFound(_0x12edee,null))[_0x5ebb('0x40')](respondWithStatusCode(_0x12edee,null))['catch'](handleError(_0x12edee,null));};exports[_0x5ebb('0x7a')]=function(_0x16d155,_0x2a31ac){var _0x38bf77=_[_0x5ebb('0x7b')](_0x16d155[_0x5ebb('0x47')][_0x5ebb('0x79')])?_0x16d155[_0x5ebb('0x47')][_0x5ebb('0x79')]:[_0x16d155[_0x5ebb('0x47')]['ids']];var _0x44e5ad=_0x16d155[_0x5ebb('0x44')]['id'];return db[_0x5ebb('0x2a')][_0x5ebb('0x45')]({'where':{'id':_0x44e5ad}})[_0x5ebb('0x40')](handleEntityNotFound(_0x2a31ac,null))[_0x5ebb('0x40')](function(_0x24f45f){if(_0x24f45f){var _0x404ddf=['Voice','Chat',_0x5ebb('0x7c'),'Sms',_0x5ebb('0x7d'),_0x5ebb('0x7e'),'Whatsapp'];return db[_0x5ebb('0x51')][_0x5ebb('0x52')](function(_0x6b65a7){var _0x466449=_[_0x5ebb('0x29')](_0x404ddf,function(_0x4f5af8){var _0x48ee6b={'attributes':['id',_0x5ebb('0x3c')]};if(_0x4f5af8==='Voice'){_0x48ee6b[_0x5ebb('0x7f')]={'attributes':['penalty']};}return _0x24f45f['get'+_0x4f5af8+_0x5ebb('0x76')](_0x48ee6b)['then'](function(_0x5bd69a){var _0x452654=_[_0x5ebb('0x29')](_0x5bd69a,function(_0x3d6a0b){var _0x395ddc=_[_0x5ebb('0x29')](_0x38bf77,function(_0x4694b0){var _0x177207={'where':{'UserId':_0x4694b0,[_0x4f5af8+_0x5ebb('0x80')]:_0x3d6a0b['id']},'transaction':_0x6b65a7};if(_0x4f5af8===_0x5ebb('0x81')){_0x177207[_0x5ebb('0x82')]={'penalty':_0x3d6a0b['TeamVoiceQueue'][_0x5ebb('0x83')]};}return db[_0x5ebb('0x84')+_0x4f5af8+_0x5ebb('0x85')][_0x5ebb('0x86')](_0x177207)[_0x5ebb('0x40')](function(){socket[_0x5ebb('0x87')]('user'+_0x4f5af8+_0x5ebb('0x88'),{'UserId':_0x4694b0,[_0x4f5af8+_0x5ebb('0x80')]:_0x3d6a0b['id']});if(_0x4f5af8!==_0x5ebb('0x81')){return;}return db[_0x5ebb('0x84')][_0x5ebb('0x3f')]({'where':{'id':_0x38bf77,'online':0x1},'attributes':['id',_0x5ebb('0x3c'),_0x5ebb('0x89'),_0x5ebb('0x8a'),_0x5ebb('0x8b')],'raw':!![]})[_0x5ebb('0x40')](function(_0x3cced9){var _0x3dbda1=_[_0x5ebb('0x29')](_0x3cced9,function(_0x4f9535){return db[_0x5ebb('0x8c')][_0x5ebb('0x8d')]({'membername':_0x4f9535[_0x5ebb('0x3c')],'UserId':_0x4f9535['id'],'queue_name':_0x3d6a0b[_0x5ebb('0x3c')],'VoiceQueueId':_0x3d6a0b['id'],'interface':_[_0x5ebb('0x8e')](_0x4f9535[_0x5ebb('0x8b')])?util[_0x5ebb('0x8f')]('SIP/%s',_0x4f9535[_0x5ebb('0x3c')]):_0x4f9535[_0x5ebb('0x8b')],'paused':_0x4f9535['voicePause']||![],'penalty':_0x3d6a0b[_0x5ebb('0x90')]['penalty']},{'transaction':_0x6b65a7});});return Promise[_0x5ebb('0x91')](_0x3dbda1);});});});return Promise[_0x5ebb('0x91')](_0x395ddc);});return Promise['all'](_0x452654);})[_0x5ebb('0x40')](function(){return db[_0x5ebb('0x67')][_0x5ebb('0x6b')]({'where':{'teamId':_0x44e5ad}})[_0x5ebb('0x40')](function(_0x43eb71){if(_0x43eb71){var _0x1a7bc0=_['map'](_0x38bf77,function(_0x2e8cdf){db[_0x5ebb('0x68')][_0x5ebb('0x8d')]({'UserId':_0x2e8cdf,'VoicePrefixId':_0x43eb71[_0x5ebb('0x92')]});});return Promise[_0x5ebb('0x91')](_0x1a7bc0);}});});});return Promise['all'](_0x466449)[_0x5ebb('0x40')](function(){return _0x24f45f['addAgents'](_0x38bf77,{'transaction':_0x6b65a7})[_0x5ebb('0x93')](function(_0x4c2b60){return _0x4c2b60;});});});}})['then'](respondWithResult(_0x2a31ac,null))['catch'](handleError(_0x2a31ac,null));};exports['removeAgents']=function(_0x9bf050,_0x253445){var _0x37e871=_['isArray'](_0x9bf050[_0x5ebb('0x30')][_0x5ebb('0x79')])?_0x9bf050[_0x5ebb('0x30')][_0x5ebb('0x79')]:[_0x9bf050[_0x5ebb('0x30')][_0x5ebb('0x79')]];var _0x5dea51=_0x9bf050['params']['id'];return db[_0x5ebb('0x2a')][_0x5ebb('0x45')]({'where':{'id':_0x5dea51}})['then'](handleEntityNotFound(_0x253445,null))[_0x5ebb('0x40')](function(_0x5254e8){if(_0x5254e8){var _0x2ab5cb=[_0x5ebb('0x81'),_0x5ebb('0x94'),_0x5ebb('0x7c'),_0x5ebb('0x95'),_0x5ebb('0x7d'),_0x5ebb('0x7e'),'Whatsapp'];return db['sequelize'][_0x5ebb('0x52')](function(_0x3d2d3f){var _0x1b2ee8=_['map'](_0x2ab5cb,function(_0x26cf81){var _0x2c48e3={'attributes':['id',_0x5ebb('0x3c')]};return _0x5254e8[_0x5ebb('0x49')+_0x26cf81+'Queues'](_0x2c48e3)['then'](function(_0x8ee62){var _0x2805a3=_[_0x5ebb('0x29')](_0x8ee62,function(_0xe2ffd1){return _0xe2ffd1[_0x5ebb('0x96')](_0x37e871,{'transaction':_0x3d2d3f})['then'](function(){var _0x482dbd=_[_0x5ebb('0x29')](_0x37e871,function(_0x226cce){socket[_0x5ebb('0x87')](_0x5ebb('0x48')+_0x26cf81+'Queue:remove',{'UserId':Number(_0x226cce),[_0x26cf81+_0x5ebb('0x80')]:_0xe2ffd1['id']});if(_0x26cf81!==_0x5ebb('0x81')){return;}return db[_0x5ebb('0x8c')][_0x5ebb('0x5b')]({'where':{'VoiceQueueId':_0xe2ffd1['id'],'UserId':_0x226cce},'transaction':_0x3d2d3f});});return Promise[_0x5ebb('0x91')](_0x482dbd);});});return Promise['all'](_0x2805a3);});});return Promise[_0x5ebb('0x91')](_0x1b2ee8)[_0x5ebb('0x40')](function(){return _0x5254e8['removeAgents'](_0x37e871,{'transaction':_0x3d2d3f});})[_0x5ebb('0x40')](function(){return db[_0x5ebb('0x67')]['findOne']({'where':{'teamId':_0x5dea51}})[_0x5ebb('0x40')](function(_0x4ddcf0){if(_0x4ddcf0){var _0x4f5355=_[_0x5ebb('0x29')](_0x37e871,function(_0x3b1510){db[_0x5ebb('0x68')][_0x5ebb('0x5b')]({'where':{'UserId':_0x3b1510,'VoicePrefixId':_0x4ddcf0[_0x5ebb('0x92')]}});});return Promise['all'](_0x4f5355);}});});});}})[_0x5ebb('0x40')](respondWithStatusCode(_0x253445,null))['catch'](handleError(_0x253445,null));};exports[_0x5ebb('0x97')]=function(_0x46e734,_0x923725,_0x3f7062){var _0x1389be={};var _0x5ab614={};var _0x3d720d;var _0x5c0891;return db[_0x5ebb('0x2a')]['findOne']({'where':{'id':_0x46e734['params']['id']}})[_0x5ebb('0x40')](handleEntityNotFound(_0x923725,null))['then'](function(_0x44c37b){if(_0x44c37b){_0x3d720d=_0x44c37b;_0x5ab614[_0x5ebb('0x2f')]=_['keys'](db[_0x5ebb('0x84')][_0x5ebb('0x2b')]);_0x5ab614[_0x5ebb('0x30')]=_[_0x5ebb('0x31')](_0x46e734[_0x5ebb('0x30')]);_0x5ab614[_0x5ebb('0x32')]=_[_0x5ebb('0x33')](_0x5ab614[_0x5ebb('0x2f')],_0x5ab614[_0x5ebb('0x30')]);_0x1389be[_0x5ebb('0x35')]=_[_0x5ebb('0x33')](_0x5ab614[_0x5ebb('0x2f')],qs[_0x5ebb('0x34')](_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x34')]));_0x1389be['attributes']=_0x1389be[_0x5ebb('0x35')]['length']?_0x1389be[_0x5ebb('0x35')]:_0x5ab614[_0x5ebb('0x2f')];_0x1389be['order']=qs[_0x5ebb('0x38')](_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x38')]);_0x1389be[_0x5ebb('0x39')]=qs[_0x5ebb('0x32')](_[_0x5ebb('0x70')](_0x46e734['query'],_0x5ab614[_0x5ebb('0x32')]));if(_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x3a')]){_0x1389be['where']=_[_0x5ebb('0x3b')](_0x1389be[_0x5ebb('0x39')],{'$or':_[_0x5ebb('0x29')](_0x1389be[_0x5ebb('0x35')],function(_0x4575c9){var _0x108bd7={};_0x108bd7[_0x4575c9]={'$like':'%'+_0x46e734[_0x5ebb('0x30')]['filter']+'%'};return _0x108bd7;})});}_0x1389be=_['merge']({},_0x1389be,_0x46e734[_0x5ebb('0x71')]);return _0x3d720d['getAgents'](_0x1389be);}})['then'](function(_0x3c0178){if(_0x3c0178){_0x5c0891=_0x3c0178['length'];if(!_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x37')](_0x5ebb('0x98'))){_0x1389be['limit']=qs[_0x5ebb('0x1e')](_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x1e')]);_0x1389be[_0x5ebb('0x1c')]=qs[_0x5ebb('0x1c')](_0x46e734[_0x5ebb('0x30')][_0x5ebb('0x1c')]);}return _0x3d720d[_0x5ebb('0x97')](_0x1389be);}})['then'](function(_0x4fe1ca){if(_0x4fe1ca){return _0x4fe1ca?{'count':_0x5c0891,'rows':_0x4fe1ca}:null;}})['then'](respondWithResult(_0x923725,null))[_0x5ebb('0x42')](handleError(_0x923725,null));}; \ No newline at end of file +var _0x6435=['./team.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','show','params','intersection','fields','includeAll','merge','find','catch','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','transaction','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ValidationError','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Sms','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x6435,0x82));var _0x5643=function(_0xdbf3b2,_0x1f5d85){_0xdbf3b2=_0xdbf3b2-0x0;var _0x59350a=_0x6435[_0xdbf3b2];return _0x59350a;};'use strict';var emlformat=require(_0x5643('0x0'));var rimraf=require(_0x5643('0x1'));var zipdir=require(_0x5643('0x2'));var jsonpatch=require(_0x5643('0x3'));var rp=require('request-promise');var moment=require(_0x5643('0x4'));var BPromise=require(_0x5643('0x5'));var Mustache=require(_0x5643('0x6'));var util=require(_0x5643('0x7'));var path=require(_0x5643('0x8'));var sox=require('sox');var csv=require(_0x5643('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5643('0xa'));var _=require(_0x5643('0xb'));var squel=require(_0x5643('0xc'));var crypto=require('crypto');var jsforce=require(_0x5643('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5643('0xe'));var Papa=require(_0x5643('0xf'));var Redis=require(_0x5643('0x10'));var authService=require(_0x5643('0x11'));var qs=require(_0x5643('0x12'));var as=require(_0x5643('0x13'));var hardwareService=require(_0x5643('0x14'));var logger=require(_0x5643('0x15'))(_0x5643('0x16'));var utils=require(_0x5643('0x17'));var config=require(_0x5643('0x18'));var licenseUtil=require(_0x5643('0x19'));var db=require(_0x5643('0x1a'))['db'];config[_0x5643('0x1b')]=_[_0x5643('0x1c')](config[_0x5643('0x1b')],{'host':_0x5643('0x1d'),'port':0x18eb});var socket=require(_0x5643('0x1e'))(new Redis(config[_0x5643('0x1b')]));require(_0x5643('0x1f'))[_0x5643('0x20')](socket);function respondWithStatusCode(_0x1b7781,_0x3ca99c){_0x3ca99c=_0x3ca99c||0xcc;return function(_0x5c789b){if(_0x5c789b){return _0x1b7781[_0x5643('0x21')](_0x3ca99c);}return _0x1b7781[_0x5643('0x22')](_0x3ca99c)[_0x5643('0x23')]();};}function respondWithResult(_0x473f6d,_0x104937){_0x104937=_0x104937||0xc8;return function(_0x10f04e){if(_0x10f04e){return _0x473f6d['status'](_0x104937)[_0x5643('0x24')](_0x10f04e);}};}function respondWithFilteredResult(_0x5e32e4,_0x3fe772){return function(_0x27751d){if(_0x27751d){var _0x1a72d6=typeof _0x3fe772['offset']==='undefined'&&typeof _0x3fe772['limit']===_0x5643('0x25');var _0x54bdf7=_0x27751d[_0x5643('0x26')];var _0xf9e01c=_0x1a72d6?0x0:_0x3fe772[_0x5643('0x27')];var _0x526605=_0x1a72d6?_0x27751d[_0x5643('0x26')]:_0x3fe772[_0x5643('0x27')]+_0x3fe772[_0x5643('0x28')];var _0x3c99a1;if(_0x526605>=_0x54bdf7){_0x526605=_0x54bdf7;_0x3c99a1=0xc8;}else{_0x3c99a1=0xce;}_0x5e32e4[_0x5643('0x22')](_0x3c99a1);return _0x5e32e4[_0x5643('0x29')](_0x5643('0x2a'),_0xf9e01c+'-'+_0x526605+'/'+_0x54bdf7)['json'](_0x27751d);}return null;};}function patchUpdates(_0x39baad){return function(_0x20dc8b){try{jsonpatch[_0x5643('0x2b')](_0x20dc8b,_0x39baad,!![]);}catch(_0x1f3e59){return BPromise[_0x5643('0x2c')](_0x1f3e59);}return _0x20dc8b[_0x5643('0x2d')]();};}function saveUpdates(_0x2c7cd3,_0x229f7b){return function(_0x36cbb8){if(_0x36cbb8){return _0x36cbb8[_0x5643('0x2e')](_0x2c7cd3)[_0x5643('0x2f')](function(_0x272a75){return _0x272a75;});}return null;};}function handleEntityNotFound(_0xafc985,_0x353ce8){return function(_0x52ad2a){if(!_0x52ad2a){_0xafc985['sendStatus'](0x194);}return _0x52ad2a;};}function handleError(_0x249d4c,_0x509871){_0x509871=_0x509871||0x1f4;return function(_0x3599ff){logger[_0x5643('0x30')](_0x3599ff['stack']);if(_0x3599ff[_0x5643('0x31')]){delete _0x3599ff['name'];}_0x249d4c[_0x5643('0x22')](_0x509871)[_0x5643('0x32')](_0x3599ff);};}exports[_0x5643('0x33')]=function(_0x31d86b,_0x25e83e){var _0x5a6fb4={},_0x4a997d={},_0x49bc3b={'count':0x0,'rows':[]};var _0x26777d=_[_0x5643('0x34')](db[_0x5643('0x35')][_0x5643('0x36')],function(_0x3e1ef2){return{'name':_0x3e1ef2[_0x5643('0x37')],'type':_0x3e1ef2[_0x5643('0x38')][_0x5643('0x39')]};});_0x4a997d[_0x5643('0x3a')]=_[_0x5643('0x34')](_0x26777d,_0x5643('0x31'));_0x4a997d[_0x5643('0x3b')]=_[_0x5643('0x3c')](_0x31d86b[_0x5643('0x3b')]);_0x4a997d['filters']=_['intersection'](_0x4a997d[_0x5643('0x3a')],_0x4a997d[_0x5643('0x3b')]);_0x5a6fb4['attributes']=_['intersection'](_0x4a997d[_0x5643('0x3a')],qs['fields'](_0x31d86b['query']['fields']));_0x5a6fb4[_0x5643('0x3d')]=_0x5a6fb4[_0x5643('0x3d')][_0x5643('0x3e')]?_0x5a6fb4['attributes']:_0x4a997d['model'];if(!_0x31d86b[_0x5643('0x3b')][_0x5643('0x3f')](_0x5643('0x40'))){_0x5a6fb4[_0x5643('0x28')]=qs['limit'](_0x31d86b[_0x5643('0x3b')][_0x5643('0x28')]);_0x5a6fb4['offset']=qs[_0x5643('0x27')](_0x31d86b[_0x5643('0x3b')][_0x5643('0x27')]);}_0x5a6fb4[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x31d86b[_0x5643('0x3b')][_0x5643('0x42')]);_0x5a6fb4['where']=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x31d86b[_0x5643('0x3b')],_0x4a997d[_0x5643('0x43')]),_0x26777d);if(_0x31d86b[_0x5643('0x3b')][_0x5643('0x45')]){_0x5a6fb4['where']=_['merge'](_0x5a6fb4[_0x5643('0x46')],{'$or':_[_0x5643('0x34')](_0x26777d,function(_0x13f779){if(_0x13f779[_0x5643('0x38')]!==_0x5643('0x47')){var _0x1ff71b={};_0x1ff71b[_0x13f779[_0x5643('0x31')]]={'$like':'%'+_0x31d86b[_0x5643('0x3b')][_0x5643('0x45')]+'%'};return _0x1ff71b;}})});}_0x5a6fb4=_['merge']({},_0x5a6fb4,_0x31d86b[_0x5643('0x48')]);var _0x251389={'where':_0x5a6fb4['where']};return db['Team']['count'](_0x251389)[_0x5643('0x2f')](function(_0x3a7fe7){_0x49bc3b[_0x5643('0x26')]=_0x3a7fe7;if(_0x31d86b[_0x5643('0x3b')]['includeAll']){_0x5a6fb4[_0x5643('0x49')]=[{'all':!![]}];}return db[_0x5643('0x35')][_0x5643('0x4a')](_0x5a6fb4);})[_0x5643('0x2f')](function(_0x118a40){_0x49bc3b['rows']=_0x118a40;return _0x49bc3b;})[_0x5643('0x2f')](respondWithFilteredResult(_0x25e83e,_0x5a6fb4))['catch'](handleError(_0x25e83e,null));};exports[_0x5643('0x4b')]=function(_0x322e1e,_0x35554a){var _0x3fd3eb={'raw':![],'where':{'id':_0x322e1e[_0x5643('0x4c')]['id']}},_0x394de8={};_0x394de8[_0x5643('0x3a')]=_['keys'](db[_0x5643('0x35')][_0x5643('0x36')]);_0x394de8['query']=_[_0x5643('0x3c')](_0x322e1e[_0x5643('0x3b')]);_0x394de8[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x394de8[_0x5643('0x3a')],_0x394de8[_0x5643('0x3b')]);_0x3fd3eb[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x394de8['model'],qs[_0x5643('0x4e')](_0x322e1e[_0x5643('0x3b')][_0x5643('0x4e')]));_0x3fd3eb[_0x5643('0x3d')]=_0x3fd3eb[_0x5643('0x3d')][_0x5643('0x3e')]?_0x3fd3eb[_0x5643('0x3d')]:_0x394de8[_0x5643('0x3a')];if(_0x322e1e[_0x5643('0x3b')][_0x5643('0x4f')]){_0x3fd3eb['include']=[{'all':!![]}];}_0x3fd3eb=_[_0x5643('0x50')]({},_0x3fd3eb,_0x322e1e['options']);return db['Team'][_0x5643('0x51')](_0x3fd3eb)['then'](handleEntityNotFound(_0x35554a,null))[_0x5643('0x2f')](respondWithResult(_0x35554a,null))[_0x5643('0x52')](handleError(_0x35554a,null));};exports[_0x5643('0x53')]=function(_0x401d7a,_0x4cb9c6){return db[_0x5643('0x35')][_0x5643('0x53')](_0x401d7a[_0x5643('0x54')],{})[_0x5643('0x2f')](function(_0x127534){var _0x256704=_0x401d7a['user'][_0x5643('0x55')]({'plain':!![]});if(!_0x256704)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x256704[_0x5643('0x56')]===_0x5643('0x57')){var _0x5768ae=_0x127534[_0x5643('0x55')]({'plain':!![]});var _0x526a12=_0x5643('0x58');return db[_0x5643('0x59')][_0x5643('0x51')]({'where':{'name':_0x526a12,'userProfileId':_0x256704[_0x5643('0x5a')]},'raw':!![]})[_0x5643('0x2f')](function(_0x26a477){if(_0x26a477&&_0x26a477[_0x5643('0x5b')]===0x0){return db[_0x5643('0x5c')][_0x5643('0x53')]({'name':_0x5768ae['name'],'resourceId':_0x5768ae['id'],'type':_0x26a477[_0x5643('0x31')],'sectionId':_0x26a477['id']},{})[_0x5643('0x2f')](function(){return _0x127534;});}else{return _0x127534;}})[_0x5643('0x52')](function(_0x392f71){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x392f71);throw _0x392f71;});}return _0x127534;})[_0x5643('0x2f')](respondWithResult(_0x4cb9c6,0xc9))[_0x5643('0x52')](handleError(_0x4cb9c6,null));};exports[_0x5643('0x2e')]=function(_0x46ef36,_0xa48f2b){if(_0x46ef36[_0x5643('0x54')]['id']){delete _0x46ef36[_0x5643('0x54')]['id'];}return db['Team'][_0x5643('0x51')]({'where':{'id':_0x46ef36[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0xa48f2b,null))['then'](saveUpdates(_0x46ef36[_0x5643('0x54')],null))['then'](respondWithResult(_0xa48f2b,null))[_0x5643('0x52')](handleError(_0xa48f2b,null));};exports[_0x5643('0x5d')]=function(_0x48ac6f,_0x580c75){var _0x56e6ab=_0x48ac6f[_0x5643('0x4c')]['id'];var _0x4f5952=[];return db['sequelize'][_0x5643('0x5e')](function(_0x36032b){var _0x14659b='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x14659b,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b})['then'](function(_0x2befda){_0x4f5952=_[_0x5643('0x34')](_0x2befda,function(_0x36d14f){return Number(_0x36d14f[_0x5643('0x63')]);});})[_0x5643('0x2f')](function(){var _0x4e302e='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x4e302e,{'type':db['Sequelize'][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x5b6071){var _0x2f55ea=_[_0x5643('0x34')](_0x5b6071,function(_0x231117){return Number(_0x231117[_0x5643('0x64')]);});return db[_0x5643('0x65')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'VoiceQueueId':{'$in':_0x2f55ea}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x3d209b=_0x5643('0x66')+_0x56e6ab;return db[_0x5643('0x5f')]['query'](_0x3d209b,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x42422f){var _0x4706f4=_['map'](_0x42422f,function(_0x3c3a41){return Number(_0x3c3a41['MailQueueId']);});return db[_0x5643('0x67')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'MailQueueId':{'$in':_0x4706f4}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x59bec4=_0x5643('0x68')+_0x56e6ab;return db[_0x5643('0x5f')]['query'](_0x59bec4,{'type':db[_0x5643('0x60')][_0x5643('0x61')]['SELECT'],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x2654ac){var _0x5ef656=_[_0x5643('0x34')](_0x2654ac,function(_0x1fc569){return Number(_0x1fc569[_0x5643('0x69')]);});return db['UserSmsQueue'][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'SmsQueueId':{'$in':_0x5ef656}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x3e95df=_0x5643('0x6a')+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x3e95df,{'type':db[_0x5643('0x60')]['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x2aeec1){var _0x331444=_[_0x5643('0x34')](_0x2aeec1,function(_0x2a0bd6){return Number(_0x2a0bd6[_0x5643('0x6b')]);});return db[_0x5643('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x4f5952},'ChatQueueId':{'$in':_0x331444}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0xfc3e6d=_0x5643('0x6d')+_0x56e6ab;return db['sequelize'][_0x5643('0x3b')](_0xfc3e6d,{'type':db[_0x5643('0x60')]['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})['then'](function(_0x12ea3a){var _0x50d13c=_[_0x5643('0x34')](_0x12ea3a,function(_0x27e484){return Number(_0x27e484['FaxQueueId']);});return db[_0x5643('0x6e')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'FaxQueueId':{'$in':_0x50d13c}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x51b203=_0x5643('0x6f')+_0x56e6ab;return db[_0x5643('0x5f')][_0x5643('0x3b')](_0x51b203,{'type':db[_0x5643('0x60')][_0x5643('0x61')][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x2e72d6){var _0x146142=_[_0x5643('0x34')](_0x2e72d6,function(_0x2521db){return Number(_0x2521db[_0x5643('0x70')]);});return db['UserOpenchannelQueue'][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'OpenchannelQueueId':{'$in':_0x146142}},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){var _0x58a2c2='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56e6ab;return db['sequelize'][_0x5643('0x3b')](_0x58a2c2,{'type':db['Sequelize']['QueryTypes'][_0x5643('0x62')],'raw':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x25a854){var _0x481975=_['map'](_0x25a854,function(_0x1f15c3){return Number(_0x1f15c3[_0x5643('0x71')]);});return db[_0x5643('0x72')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'WhatsappQueueId':{'$in':_0x481975}},'transaction':_0x36032b});})['then'](function(){return db[_0x5643('0x73')][_0x5643('0x51')]({'where':{'TeamId':_0x56e6ab}});})[_0x5643('0x2f')](function(_0x48fc35){if(_0x48fc35===null){return;}return db[_0x5643('0x74')][_0x5643('0x5d')]({'where':{'UserId':{'$in':_0x4f5952},'VoicePrefixId':_0x48fc35[_0x5643('0x75')]},'transaction':_0x36032b});})[_0x5643('0x2f')](function(){return db['Team'][_0x5643('0x5d')]({'where':{'id':_0x56e6ab},'cascade':!![],'transaction':_0x36032b});})[_0x5643('0x2f')](function(_0x403f3e){if(_0x403f3e===0x0){_0x580c75[_0x5643('0x21')](0x194);}else{return db[_0x5643('0x5c')][_0x5643('0x5d')]({'where':{'type':_0x5643('0x58'),'resourceId':_0x56e6ab},'cascade':!![],'transaction':_0x36032b})['then'](function(){_0x580c75['status'](0xcc)[_0x5643('0x23')]();});}})[_0x5643('0x52')](function(_0x136a49){_0x580c75[_0x5643('0x22')](0x1f4)[_0x5643('0x32')](_0x136a49);});});};exports['getQueues']=function(_0x2038a,_0x1c14b3,_0x3190cc){return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x2038a['params']['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0x1c14b3,null))[_0x5643('0x2f')](function(_0x471466){if(!_0x2038a[_0x5643('0x3b')][_0x5643('0x77')]||!utils[_0x5643('0x78')](_0x2038a[_0x5643('0x3b')]['channel'])){throw new db[(_0x5643('0x60'))]['ValidationError'](_0x5643('0x79'));}var _0x4817bc={};var _0x531b79={};_0x531b79[_0x5643('0x3a')]=_[_0x5643('0x3c')](db[_[_0x5643('0x7a')](_0x2038a[_0x5643('0x3b')]['channel']['toLowerCase']())+_0x5643('0x7b')]['rawAttributes']);_0x531b79[_0x5643('0x3b')]=_['keys'](_0x2038a[_0x5643('0x3b')]);_0x531b79[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x531b79[_0x5643('0x3a')],_0x531b79['query']);_0x4817bc[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x531b79[_0x5643('0x3a')],qs[_0x5643('0x4e')](_0x2038a['query'][_0x5643('0x4e')]));_0x4817bc['attributes']=_0x4817bc[_0x5643('0x3d')][_0x5643('0x3e')]?_0x4817bc[_0x5643('0x3d')]:_0x531b79[_0x5643('0x3a')];_0x4817bc[_0x5643('0x28')]=qs[_0x5643('0x28')](_0x2038a[_0x5643('0x3b')][_0x5643('0x28')]);_0x4817bc[_0x5643('0x27')]=qs['offset'](_0x2038a[_0x5643('0x3b')][_0x5643('0x27')]);_0x4817bc[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x2038a[_0x5643('0x3b')][_0x5643('0x42')]);_0x4817bc[_0x5643('0x46')]=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x2038a[_0x5643('0x3b')],_0x531b79['filters']));_0x4817bc=_[_0x5643('0x50')]({},_0x4817bc,_0x2038a[_0x5643('0x48')]);return _0x471466[_0x5643('0x55')+_[_0x5643('0x7a')](_0x2038a[_0x5643('0x3b')][_0x5643('0x77')][_0x5643('0x7c')]())+_0x5643('0x7d')](_0x4817bc);})[_0x5643('0x2f')](respondWithResult(_0x1c14b3,null))['catch'](handleError(_0x1c14b3,null));};exports[_0x5643('0x7e')]=function(_0x15d743,_0x1cb38d,_0x347a2c){return db['Team']['findOne']({'where':{'id':_0x15d743[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](function(_0x93e2a){if(_0x93e2a){if(!_0x15d743[_0x5643('0x54')]['channel']||!utils[_0x5643('0x78')](_0x15d743[_0x5643('0x54')]['channel'])){throw new db['Sequelize'][(_0x5643('0x7f'))](_0x5643('0x79'));}return _0x93e2a[_0x5643('0x80')+_[_0x5643('0x7a')](_0x15d743[_0x5643('0x54')][_0x5643('0x77')]['toLowerCase']())+_0x5643('0x7d')](_0x15d743[_0x5643('0x54')][_0x5643('0x81')]);}return null;})[_0x5643('0x2f')](handleEntityNotFound(_0x1cb38d,null))[_0x5643('0x2f')](respondWithStatusCode(_0x1cb38d,null))[_0x5643('0x52')](handleError(_0x1cb38d,null));};exports[_0x5643('0x82')]=function(_0x529374,_0x46b917,_0x520e0e){return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x529374['params']['id']}})[_0x5643('0x2f')](function(_0x4bf269){if(_0x4bf269){if(!_0x529374[_0x5643('0x3b')][_0x5643('0x77')]||!utils[_0x5643('0x78')](_0x529374['query']['channel'])){throw new db[(_0x5643('0x60'))][(_0x5643('0x7f'))](_0x5643('0x79'));}return _0x4bf269[_0x5643('0x83')+_['capitalize'](_0x529374['query'][_0x5643('0x77')]['toLowerCase']())+_0x5643('0x7d')](_0x529374[_0x5643('0x3b')][_0x5643('0x81')]);}return null;})[_0x5643('0x2f')](handleEntityNotFound(_0x46b917,null))[_0x5643('0x2f')](respondWithStatusCode(_0x46b917,null))[_0x5643('0x52')](handleError(_0x46b917,null));};exports[_0x5643('0x84')]=function(_0x4bc00e,_0x4317fc){var _0x5d001c=_[_0x5643('0x85')](_0x4bc00e['body'][_0x5643('0x81')])?_0x4bc00e[_0x5643('0x54')][_0x5643('0x81')]:[_0x4bc00e['body'][_0x5643('0x81')]];var _0x483207=_0x4bc00e[_0x5643('0x4c')]['id'];return db[_0x5643('0x35')][_0x5643('0x51')]({'where':{'id':_0x483207}})[_0x5643('0x2f')](handleEntityNotFound(_0x4317fc,null))['then'](function(_0xe69508){if(_0xe69508){var _0x50b68d=[_0x5643('0x86'),_0x5643('0x87'),_0x5643('0x88'),'Sms',_0x5643('0x89'),_0x5643('0x8a'),_0x5643('0x8b')];return db[_0x5643('0x5f')]['transaction'](function(_0x3aa399){var _0x421e5d=_[_0x5643('0x34')](_0x50b68d,function(_0x1cb4ab){var _0x1b9299={'attributes':['id','name']};if(_0x1cb4ab==='Voice'){_0x1b9299[_0x5643('0x8c')]={'attributes':[_0x5643('0x8d')]};}return _0xe69508[_0x5643('0x55')+_0x1cb4ab+_0x5643('0x7d')](_0x1b9299)[_0x5643('0x2f')](function(_0xc70fe0){var _0x77dd1b=_['map'](_0xc70fe0,function(_0x3901c9){var _0x523deb=_[_0x5643('0x34')](_0x5d001c,function(_0x55b711){var _0x56f328={'where':{'UserId':_0x55b711,[_0x1cb4ab+_0x5643('0x8e')]:_0x3901c9['id']},'transaction':_0x3aa399};if(_0x1cb4ab==='Voice'){_0x56f328[_0x5643('0x1c')]={'penalty':_0x3901c9[_0x5643('0x8f')][_0x5643('0x8d')]};}return db[_0x5643('0x90')+_0x1cb4ab+_0x5643('0x7b')]['findOrCreate'](_0x56f328)['then'](function(){socket[_0x5643('0x91')](_0x5643('0x57')+_0x1cb4ab+_0x5643('0x92'),{'UserId':_0x55b711,[_0x1cb4ab+_0x5643('0x8e')]:_0x3901c9['id']});if(_0x1cb4ab!=='Voice'){return;}return db['User'][_0x5643('0x4a')]({'where':{'id':_0x5d001c,'online':0x1},'attributes':['id',_0x5643('0x31'),_0x5643('0x93'),_0x5643('0x94'),_0x5643('0x95')],'raw':!![]})[_0x5643('0x2f')](function(_0x2494dd){var _0x3d911a=_['map'](_0x2494dd,function(_0x4736a1){return db[_0x5643('0x96')][_0x5643('0x97')]({'membername':_0x4736a1[_0x5643('0x31')],'UserId':_0x4736a1['id'],'queue_name':_0x3901c9['name'],'VoiceQueueId':_0x3901c9['id'],'interface':_[_0x5643('0x98')](_0x4736a1[_0x5643('0x95')])?util[_0x5643('0x99')](_0x5643('0x9a'),_0x4736a1[_0x5643('0x31')]):_0x4736a1['interface'],'paused':_0x4736a1[_0x5643('0x94')]||![],'penalty':_0x3901c9[_0x5643('0x8f')][_0x5643('0x8d')]},{'transaction':_0x3aa399});});return Promise[_0x5643('0x9b')](_0x3d911a);});});});return Promise[_0x5643('0x9b')](_0x523deb);});return Promise[_0x5643('0x9b')](_0x77dd1b);})[_0x5643('0x2f')](function(){return db[_0x5643('0x73')]['findOne']({'where':{'teamId':_0x483207}})['then'](function(_0x234292){if(_0x234292){var _0x4f58e6=_[_0x5643('0x34')](_0x5d001c,function(_0x55452f){db['UserVoicePrefix'][_0x5643('0x97')]({'UserId':_0x55452f,'VoicePrefixId':_0x234292[_0x5643('0x75')]});});return Promise[_0x5643('0x9b')](_0x4f58e6);}});});});return Promise['all'](_0x421e5d)[_0x5643('0x2f')](function(){return _0xe69508[_0x5643('0x84')](_0x5d001c,{'transaction':_0x3aa399})[_0x5643('0x9c')](function(_0xd441ba){return _0xd441ba;});});});}})[_0x5643('0x2f')](respondWithResult(_0x4317fc,null))[_0x5643('0x52')](handleError(_0x4317fc,null));};exports[_0x5643('0x9d')]=function(_0x5aeff1,_0x5390ac){var _0x4aae77=_[_0x5643('0x85')](_0x5aeff1[_0x5643('0x3b')][_0x5643('0x81')])?_0x5aeff1[_0x5643('0x3b')][_0x5643('0x81')]:[_0x5aeff1['query'][_0x5643('0x81')]];var _0x40ce33=_0x5aeff1[_0x5643('0x4c')]['id'];return db[_0x5643('0x35')][_0x5643('0x51')]({'where':{'id':_0x40ce33}})[_0x5643('0x2f')](handleEntityNotFound(_0x5390ac,null))['then'](function(_0x8b7de7){if(_0x8b7de7){var _0x5e043b=[_0x5643('0x86'),'Chat',_0x5643('0x88'),_0x5643('0x9e'),'Fax',_0x5643('0x8a'),_0x5643('0x8b')];return db[_0x5643('0x5f')][_0x5643('0x5e')](function(_0x364f9f){var _0x93f4ea=_['map'](_0x5e043b,function(_0x5ef413){var _0x4f911e={'attributes':['id',_0x5643('0x31')]};return _0x8b7de7[_0x5643('0x55')+_0x5ef413+_0x5643('0x7d')](_0x4f911e)[_0x5643('0x2f')](function(_0x2933d0){var _0x1066e9=_['map'](_0x2933d0,function(_0x353895){return _0x353895[_0x5643('0x9d')](_0x4aae77,{'transaction':_0x364f9f})['then'](function(){var _0x2a6a48=_[_0x5643('0x34')](_0x4aae77,function(_0x2bccba){socket[_0x5643('0x91')](_0x5643('0x57')+_0x5ef413+_0x5643('0x9f'),{'UserId':Number(_0x2bccba),[_0x5ef413+_0x5643('0x8e')]:_0x353895['id']});if(_0x5ef413!==_0x5643('0x86')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x353895['id'],'UserId':_0x2bccba},'transaction':_0x364f9f});});return Promise[_0x5643('0x9b')](_0x2a6a48);});});return Promise[_0x5643('0x9b')](_0x1066e9);});});return Promise[_0x5643('0x9b')](_0x93f4ea)[_0x5643('0x2f')](function(){return _0x8b7de7[_0x5643('0x9d')](_0x4aae77,{'transaction':_0x364f9f});})[_0x5643('0x2f')](function(){return db[_0x5643('0x73')][_0x5643('0x76')]({'where':{'teamId':_0x40ce33}})['then'](function(_0x14acbb){if(_0x14acbb){var _0x51d1fb=_[_0x5643('0x34')](_0x4aae77,function(_0x33e67d){db[_0x5643('0x74')][_0x5643('0x5d')]({'where':{'UserId':_0x33e67d,'VoicePrefixId':_0x14acbb[_0x5643('0x75')]}});});return Promise[_0x5643('0x9b')](_0x51d1fb);}});});});}})[_0x5643('0x2f')](respondWithStatusCode(_0x5390ac,null))[_0x5643('0x52')](handleError(_0x5390ac,null));};exports[_0x5643('0xa0')]=function(_0x5bfad8,_0x61d6e2,_0xfda2af){var _0x4d7cfa={};var _0x3eda05={};var _0x57d175;var _0x4b9b98;return db[_0x5643('0x35')][_0x5643('0x76')]({'where':{'id':_0x5bfad8[_0x5643('0x4c')]['id']}})[_0x5643('0x2f')](handleEntityNotFound(_0x61d6e2,null))[_0x5643('0x2f')](function(_0xfaffbe){if(_0xfaffbe){_0x57d175=_0xfaffbe;_0x3eda05[_0x5643('0x3a')]=_[_0x5643('0x3c')](db[_0x5643('0x90')][_0x5643('0x36')]);_0x3eda05[_0x5643('0x3b')]=_[_0x5643('0x3c')](_0x5bfad8[_0x5643('0x3b')]);_0x3eda05[_0x5643('0x43')]=_[_0x5643('0x4d')](_0x3eda05[_0x5643('0x3a')],_0x3eda05[_0x5643('0x3b')]);_0x4d7cfa[_0x5643('0x3d')]=_[_0x5643('0x4d')](_0x3eda05[_0x5643('0x3a')],qs[_0x5643('0x4e')](_0x5bfad8['query'][_0x5643('0x4e')]));_0x4d7cfa[_0x5643('0x3d')]=_0x4d7cfa[_0x5643('0x3d')]['length']?_0x4d7cfa[_0x5643('0x3d')]:_0x3eda05[_0x5643('0x3a')];_0x4d7cfa[_0x5643('0x41')]=qs[_0x5643('0x42')](_0x5bfad8[_0x5643('0x3b')]['sort']);_0x4d7cfa['where']=qs[_0x5643('0x43')](_[_0x5643('0x44')](_0x5bfad8['query'],_0x3eda05['filters']));if(_0x5bfad8[_0x5643('0x3b')]['filter']){_0x4d7cfa[_0x5643('0x46')]=_['merge'](_0x4d7cfa[_0x5643('0x46')],{'$or':_[_0x5643('0x34')](_0x4d7cfa['attributes'],function(_0x4aa42d){var _0xab9708={};_0xab9708[_0x4aa42d]={'$like':'%'+_0x5bfad8[_0x5643('0x3b')][_0x5643('0x45')]+'%'};return _0xab9708;})});}_0x4d7cfa=_[_0x5643('0x50')]({},_0x4d7cfa,_0x5bfad8[_0x5643('0x48')]);return _0x57d175[_0x5643('0xa0')](_0x4d7cfa);}})[_0x5643('0x2f')](function(_0x37f3ce){if(_0x37f3ce){_0x4b9b98=_0x37f3ce[_0x5643('0x3e')];if(!_0x5bfad8[_0x5643('0x3b')][_0x5643('0x3f')](_0x5643('0x40'))){_0x4d7cfa[_0x5643('0x28')]=qs[_0x5643('0x28')](_0x5bfad8[_0x5643('0x3b')][_0x5643('0x28')]);_0x4d7cfa['offset']=qs[_0x5643('0x27')](_0x5bfad8[_0x5643('0x3b')][_0x5643('0x27')]);}return _0x57d175[_0x5643('0xa0')](_0x4d7cfa);}})[_0x5643('0x2f')](function(_0x18468e){if(_0x18468e){return _0x18468e?{'count':_0x4b9b98,'rows':_0x18468e}:null;}})[_0x5643('0x2f')](respondWithResult(_0x61d6e2,null))[_0x5643('0x52')](handleError(_0x61d6e2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f53a31d..f9d96c4 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 _0xddb4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xddb4,0x1bd));var _0x4ddb=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xddb4[_0x3452a8];return _0x233814;};'use strict';var EventEmitter=require(_0x4ddb('0x0'));var Team=require(_0x4ddb('0x1'))['db'][_0x4ddb('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4ddb('0x3')](0x0);var events={'afterCreate':_0x4ddb('0x4'),'afterUpdate':'update','afterDestroy':_0x4ddb('0x5')};function emitEvent(_0x25e2bf){return function(_0x25c761,_0x5726f9,_0x255f6c){TeamEvents['emit'](_0x25e2bf+':'+_0x25c761['id'],_0x25c761);TeamEvents[_0x4ddb('0x6')](_0x25e2bf,_0x25c761);_0x255f6c(null);};}for(var e in events){if(events[_0x4ddb('0x7')](e)){var event=events[e];Team[_0x4ddb('0x8')](e,emitEvent(event));}}module[_0x4ddb('0x9')]=TeamEvents; \ No newline at end of file +var _0x6696=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','Team'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6696,0x155));var _0x6669=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x6696[_0x4914e2];return _0x2dcd07;};'use strict';var EventEmitter=require(_0x6669('0x0'));var Team=require(_0x6669('0x1'))['db'][_0x6669('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6669('0x3'),'afterUpdate':_0x6669('0x4'),'afterDestroy':_0x6669('0x5')};function emitEvent(_0x5e4cb8){return function(_0x5bb362,_0x5f53aa,_0x31cf14){TeamEvents['emit'](_0x5e4cb8+':'+_0x5bb362['id'],_0x5bb362);TeamEvents['emit'](_0x5e4cb8,_0x5bb362);_0x31cf14(null);};}for(var e in events){if(events[_0x6669('0x6')](e)){var event=events[e];Team[_0x6669('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 18dd829..2fbc511 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 _0x24f6=['Queues','map','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','Voice','resolve','then','all','lodash','get'];(function(_0x506bf2,_0x1faa91){var _0x291d7a=function(_0x4583d1){while(--_0x4583d1){_0x506bf2['push'](_0x506bf2['shift']());}};_0x291d7a(++_0x1faa91);}(_0x24f6,0xd6));var _0x624f=function(_0xb58bc2,_0x3fff5f){_0xb58bc2=_0xb58bc2-0x0;var _0x3902d6=_0x24f6[_0xb58bc2];return _0x3902d6;};'use strict';var _=require(_0x624f('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x2579ac,_0x27dbf7){var _0x5ce54a=_0x624f('0x1')+_0x27dbf7+_0x624f('0x2');return _0x2579ac[_0x5ce54a]()['then'](function(_0x4ff9ce){return _[_0x624f('0x3')](_0x4ff9ce,function(_0x5a9ef4){_0x5a9ef4['setDataValue'](_0x624f('0x4'),_0x27dbf7);return _0x5a9ef4;});})[_0x624f('0x5')](function(_0x397f5e){throw _0x397f5e;});}module[_0x624f('0x6')]=function(_0x2811b0){return _0x2811b0[_0x624f('0x7')](_0x624f('0x8'),attributes,{'tableName':_0x624f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1ed8f9=this;var _0x986369=[_0x624f('0xa'),_0x624f('0xb'),_0x624f('0xc'),'Openchannel',_0x624f('0xd'),_0x624f('0xe'),'Whatsapp'];return Promise[_0x624f('0xf')]()[_0x624f('0x10')](function(){var _0x128704=_['map'](_0x986369,function(_0x1fa40a){return getQueuesByChannel(_0x1ed8f9,_0x1fa40a);});return Promise[_0x624f('0x11')](_0x128704);})[_0x624f('0x5')](function(_0x31ebd2){throw _0x31ebd2;});}}});}; \ No newline at end of file +var _0x3925=['setDataValue','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','resolve','then','all','catch','lodash','./team.attributes','get','Queues','map'];(function(_0x30584a,_0x43c31c){var _0x39532d=function(_0xeff0d4){while(--_0xeff0d4){_0x30584a['push'](_0x30584a['shift']());}};_0x39532d(++_0x43c31c);}(_0x3925,0x6d));var _0x5392=function(_0x233186,_0x896f00){_0x233186=_0x233186-0x0;var _0x7ef0d0=_0x3925[_0x233186];return _0x7ef0d0;};'use strict';var _=require(_0x5392('0x0'));var attributes=require(_0x5392('0x1'));function getQueuesByChannel(_0xffba49,_0x4899bb){var _0x58f9d9=_0x5392('0x2')+_0x4899bb+_0x5392('0x3');return _0xffba49[_0x58f9d9]()['then'](function(_0x3ac31c){return _[_0x5392('0x4')](_0x3ac31c,function(_0x5a4561){_0x5a4561[_0x5392('0x5')]('channel',_0x4899bb);return _0x5a4561;});})['catch'](function(_0x49c948){throw _0x49c948;});}module[_0x5392('0x6')]=function(_0x1fa843){return _0x1fa843[_0x5392('0x7')](_0x5392('0x8'),attributes,{'tableName':_0x5392('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x33a677=this;var _0x5ac6ff=[_0x5392('0xa'),_0x5392('0xb'),_0x5392('0xc'),_0x5392('0xd'),'Sms',_0x5392('0xe'),'Whatsapp'];return Promise[_0x5392('0xf')]()[_0x5392('0x10')](function(){var _0x438f00=_[_0x5392('0x4')](_0x5ac6ff,function(_0x47827f){return getQueuesByChannel(_0x33a677,_0x47827f);});return Promise[_0x5392('0x11')](_0x438f00);})[_0x5392('0x12')](function(_0x3799e2){throw _0x3799e2;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8f6d3db..25c72f9 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 _0x5a48=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2cce35,_0x154bc7){var _0x10cfcb=function(_0xda7b3c){while(--_0xda7b3c){_0x2cce35['push'](_0x2cce35['shift']());}};_0x10cfcb(++_0x154bc7);}(_0x5a48,0xf5));var _0x85a4=function(_0x4e457b,_0x31b37c){_0x4e457b=_0x4e457b-0x0;var _0x248e7b=_0x5a48[_0x4e457b];return _0x248e7b;};'use strict';var _=require(_0x85a4('0x0'));var util=require(_0x85a4('0x1'));var moment=require(_0x85a4('0x2'));var BPromise=require(_0x85a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x85a4('0x5'))(_0x85a4('0x6'));var config=require(_0x85a4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85a4('0x8')][_0x85a4('0x9')]({'port':0x232a});config[_0x85a4('0xa')]=_[_0x85a4('0xb')](config[_0x85a4('0xa')],{'host':_0x85a4('0xc'),'port':0x18eb});var socket=require(_0x85a4('0xd'))(new Redis(config[_0x85a4('0xa')]));require(_0x85a4('0xe'))[_0x85a4('0xf')](socket);function respondWithRpcPromise(_0x55f8d3,_0x16de60,_0xeee067){return new BPromise(function(_0x523532,_0x2fa3a5){return client[_0x85a4('0x10')](_0x55f8d3,_0xeee067)['then'](function(_0x193914){logger[_0x85a4('0x11')](_0x85a4('0x12'),_0x16de60,_0x85a4('0x13'));logger[_0x85a4('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x16de60,_0x85a4('0x13'),JSON[_0x85a4('0x15')](_0x193914));if(_0x193914['error']){if(_0x193914[_0x85a4('0x16')][_0x85a4('0x17')]===0x1f4){logger[_0x85a4('0x16')]('Team,\x20%s,\x20%s',_0x16de60,_0x193914['error']['message']);return _0x2fa3a5(_0x193914[_0x85a4('0x16')][_0x85a4('0x18')]);}logger['error'](_0x85a4('0x12'),_0x16de60,_0x193914['error'][_0x85a4('0x18')]);return _0x523532(_0x193914[_0x85a4('0x16')][_0x85a4('0x18')]);}else{logger[_0x85a4('0x11')]('Team,\x20%s,\x20%s',_0x16de60,'request\x20sent');_0x523532(_0x193914[_0x85a4('0x19')]['message']);}})[_0x85a4('0x1a')](function(_0x127114){logger['error'](_0x85a4('0x12'),_0x16de60,_0x127114);_0x2fa3a5(_0x127114);});});} \ No newline at end of file +var _0x0c9c=['localhost','./team.socket','register','request','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var util=require(_0xc0c9('0x1'));var moment=require(_0xc0c9('0x2'));var BPromise=require(_0xc0c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0c9('0x5'));var logger=require(_0xc0c9('0x6'))(_0xc0c9('0x7'));var config=require(_0xc0c9('0x8'));var jayson=require(_0xc0c9('0x9'));var client=jayson[_0xc0c9('0xa')][_0xc0c9('0xb')]({'port':0x232a});config[_0xc0c9('0xc')]=_[_0xc0c9('0xd')](config[_0xc0c9('0xc')],{'host':_0xc0c9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0c9('0xc')]));require(_0xc0c9('0xf'))[_0xc0c9('0x10')](socket);function respondWithRpcPromise(_0x2425cf,_0x55f57a,_0x1c409d){return new BPromise(function(_0xe9b883,_0x56fcce){return client[_0xc0c9('0x11')](_0x2425cf,_0x1c409d)['then'](function(_0x17ed3d){logger[_0xc0c9('0x12')]('Team,\x20%s,\x20%s',_0x55f57a,'request\x20sent');logger[_0xc0c9('0x13')](_0xc0c9('0x14'),_0x55f57a,_0xc0c9('0x15'),JSON[_0xc0c9('0x16')](_0x17ed3d));if(_0x17ed3d[_0xc0c9('0x17')]){if(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x18')]===0x1f4){logger[_0xc0c9('0x17')]('Team,\x20%s,\x20%s',_0x55f57a,_0x17ed3d['error'][_0xc0c9('0x19')]);return _0x56fcce(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);}logger[_0xc0c9('0x17')]('Team,\x20%s,\x20%s',_0x55f57a,_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);return _0xe9b883(_0x17ed3d[_0xc0c9('0x17')][_0xc0c9('0x19')]);}else{logger['info'](_0xc0c9('0x1a'),_0x55f57a,_0xc0c9('0x15'));_0xe9b883(_0x17ed3d[_0xc0c9('0x1b')][_0xc0c9('0x19')]);}})[_0xc0c9('0x1c')](function(_0xf0327d){logger[_0xc0c9('0x17')](_0xc0c9('0x1a'),_0x55f57a,_0xf0327d);_0x56fcce(_0xf0327d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 01df6a7..759c762 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 _0x8058=['save','update','removeListener','length','team:','./team.events'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x8058,0x101));var _0x8805=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x8058[_0x49aa7d];return _0xdd0d26;};'use strict';var TeamEvents=require(_0x8805('0x0'));var events=[_0x8805('0x1'),'remove',_0x8805('0x2')];function createListener(_0x52e1e1,_0x280811){return function(_0x37846d){_0x280811['emit'](_0x52e1e1,_0x37846d);};}function removeListener(_0x59a9e9,_0x266e06){return function(){TeamEvents[_0x8805('0x3')](_0x59a9e9,_0x266e06);};}exports['register']=function(_0x438a1c){for(var _0x7a9c5c=0x0,_0x5e5c27=events[_0x8805('0x4')];_0x7a9c5c<_0x5e5c27;_0x7a9c5c++){var _0x50ff2f=events[_0x7a9c5c];var _0xb1b7fb=createListener(_0x8805('0x5')+_0x50ff2f,_0x438a1c);TeamEvents['on'](_0x50ff2f,_0xb1b7fb);}}; \ No newline at end of file +var _0x6da1=['update','emit','removeListener','register','length','team:','save'];(function(_0x4e59de,_0x3d31bd){var _0x14b337=function(_0xe5ce1e){while(--_0xe5ce1e){_0x4e59de['push'](_0x4e59de['shift']());}};_0x14b337(++_0x3d31bd);}(_0x6da1,0x1b8));var _0x16da=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x6da1[_0x12a2a6];return _0x1754ae;};'use strict';var TeamEvents=require('./team.events');var events=[_0x16da('0x0'),'remove',_0x16da('0x1')];function createListener(_0x202305,_0x4022ae){return function(_0x4c6c15){_0x4022ae[_0x16da('0x2')](_0x202305,_0x4c6c15);};}function removeListener(_0x2a27dc,_0x4990d9){return function(){TeamEvents[_0x16da('0x3')](_0x2a27dc,_0x4990d9);};}exports[_0x16da('0x4')]=function(_0x3058f2){for(var _0x57612f=0x0,_0x4aa4b0=events[_0x16da('0x5')];_0x57612f<_0x4aa4b0;_0x57612f++){var _0x9ced5c=events[_0x57612f];var _0x12df0e=createListener(_0x16da('0x6')+_0x9ced5c,_0x3058f2);TeamEvents['on'](_0x9ced5c,_0x12df0e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6c3c9ff..b6c99de 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfe9=['INTEGER','sequelize'];(function(_0x34373a,_0x2c7e02){var _0x2919db=function(_0x4db1ea){while(--_0x4db1ea){_0x34373a['push'](_0x34373a['shift']());}};_0x2919db(++_0x2c7e02);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x5b0407,_0x364a3b){_0x5b0407=_0x5b0407-0x0;var _0x10b3f0=_0xdfe9[_0x5b0407];return _0x10b3f0;};'use strict';var Sequelize=require(_0x9dfe('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x9dfe('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x08e5=['exports','INTEGER','sequelize'];(function(_0x4fdfb3,_0x5956e3){var _0x4e0f0f=function(_0x191c60){while(--_0x191c60){_0x4fdfb3['push'](_0x4fdfb3['shift']());}};_0x4e0f0f(++_0x5956e3);}(_0x08e5,0x1a9));var _0x508e=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x08e5[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x508e('0x0'));module[_0x508e('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x508e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2719e7b..2fcf6eb 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x105b=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf17dd4,_0x411241){var _0x22a566=function(_0x2346ef){while(--_0x2346ef){_0xf17dd4['push'](_0xf17dd4['shift']());}};_0x22a566(++_0x411241);}(_0x105b,0x1a7));var _0xb105=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x105b[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var logger=require(_0xb105('0x2'))(_0xb105('0x3'));var moment=require(_0xb105('0x4'));var BPromise=require(_0xb105('0x5'));var rp=require(_0xb105('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb105('0x7'));var config=require(_0xb105('0x8'));var attributes=require(_0xb105('0x9'));module['exports']=function(_0x33602c,_0xec2901){return _0x33602c[_0xb105('0xa')](_0xb105('0xb'),attributes,{'tableName':_0xb105('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8efc=['exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf','./teamVoicePrefix.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8efc,0xb3));var _0xc8ef=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0x8efc[_0x227cfb];return _0x131407;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var logger=require(_0xc8ef('0x1'))(_0xc8ef('0x2'));var moment=require(_0xc8ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ef('0x4'));var fs=require('fs');var path=require(_0xc8ef('0x5'));var rimraf=require(_0xc8ef('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8ef('0x7'));module[_0xc8ef('0x8')]=function(_0x1cd466,_0x13b433){return _0x1cd466['define'](_0xc8ef('0x9'),attributes,{'tableName':_0xc8ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 21db255..e54edcb 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4e059d,_0x1d7a22){var _0x2e1798=function(_0xcb6b9d){while(--_0xcb6b9d){_0x4e059d['push'](_0x4e059d['shift']());}};_0x2e1798(++_0x1d7a22);}(_0x70e0,0x17b));var _0x070e=function(_0x39dece,_0x144e73){_0x39dece=_0x39dece-0x0;var _0x45dce4=_0x70e0[_0x39dece];return _0x45dce4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a02be,_0x52b74c){var _0x47bb4b=function(_0x8e2478){while(--_0x8e2478){_0x2a02be['push'](_0x2a02be['shift']());}};_0x47bb4b(++_0x52b74c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 471bb74..9183192 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe50b=['INTEGER','sequelize','exports'];(function(_0x2147aa,_0x3a4af9){var _0x3e8f65=function(_0x284062){while(--_0x284062){_0x2147aa['push'](_0x2147aa['shift']());}};_0x3e8f65(++_0x3a4af9);}(_0xe50b,0x18d));var _0xbe50=function(_0x27b62b,_0x397d23){_0x27b62b=_0x27b62b-0x0;var _0xfb52f5=_0xe50b[_0x27b62b];return _0xfb52f5;};'use strict';var Sequelize=require(_0xbe50('0x0'));module[_0xbe50('0x1')]={'penalty':{'type':Sequelize[_0xbe50('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22c0=['sequelize','exports'];(function(_0x525fc7,_0x13d6a9){var _0x97d47c=function(_0x32ca03){while(--_0x32ca03){_0x525fc7['push'](_0x525fc7['shift']());}};_0x97d47c(++_0x13d6a9);}(_0x22c0,0x1c4));var _0x022c=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x22c0[_0x4653f7];return _0x5454da;};'use strict';var Sequelize=require(_0x022c('0x0'));module[_0x022c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index dcd6a04..d97c66e 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','util'];(function(_0x519e6e,_0x50fb78){var _0x16f533=function(_0x5de56a){while(--_0x5de56a){_0x519e6e['push'](_0x519e6e['shift']());}};_0x16f533(++_0x50fb78);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa4ba[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3645=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x4880ff,_0x584169){var _0x4094d7=function(_0x4d66e3){while(--_0x4d66e3){_0x4880ff['push'](_0x4880ff['shift']());}};_0x4094d7(++_0x584169);}(_0x3645,0x154));var _0x5364=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3645[_0x1ae491];return _0x4958a5;};'use strict';var _=require('lodash');var util=require(_0x5364('0x0'));var logger=require(_0x5364('0x1'))(_0x5364('0x2'));var moment=require(_0x5364('0x3'));var BPromise=require(_0x5364('0x4'));var rp=require(_0x5364('0x5'));var fs=require('fs');var path=require(_0x5364('0x6'));var rimraf=require('rimraf');var config=require(_0x5364('0x7'));var attributes=require(_0x5364('0x8'));module[_0x5364('0x9')]=function(_0x1f9c6b,_0x417c44){return _0x1f9c6b[_0x5364('0xa')](_0x5364('0xb'),attributes,{'tableName':_0x5364('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 9a756d3..23c0284 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3e=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x35f500,_0x4ea083){var _0x3fed41=function(_0x4f7269){while(--_0x4f7269){_0x35f500['push'](_0x35f500['shift']());}};_0x3fed41(++_0x4ea083);}(_0xed3e,0x1a0));var _0xeed3=function(_0x58f2cb,_0x1dbae6){_0x58f2cb=_0x58f2cb-0x0;var _0x58b6bb=_0xed3e[_0x58f2cb];return _0x58b6bb;};'use strict';var _=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var moment=require(_0xeed3('0x2'));var BPromise=require(_0xeed3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeed3('0x4'));var db=require(_0xeed3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeed3('0x6'))(_0xeed3('0x7'));var config=require(_0xeed3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeed3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47dfae,_0xeb9e9d,_0x88c6cb){return new BPromise(function(_0x5def7e,_0x41f229){return client[_0xeed3('0xa')](_0x47dfae,_0x88c6cb)[_0xeed3('0xb')](function(_0x4a86dd){logger[_0xeed3('0xc')](_0xeed3('0xd'),_0xeb9e9d,_0xeed3('0xe'));logger['debug'](_0xeed3('0xf'),_0xeb9e9d,_0xeed3('0xe'),JSON['stringify'](_0x4a86dd));if(_0x4a86dd['error']){if(_0x4a86dd[_0xeed3('0x10')]['code']===0x1f4){logger['error'](_0xeed3('0xd'),_0xeb9e9d,_0x4a86dd['error'][_0xeed3('0x11')]);return _0x41f229(_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);}logger[_0xeed3('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xeb9e9d,_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);return _0x5def7e(_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);}else{logger[_0xeed3('0xc')](_0xeed3('0xd'),_0xeb9e9d,_0xeed3('0xe'));_0x5def7e(_0x4a86dd[_0xeed3('0x12')]['message']);}})[_0xeed3('0x13')](function(_0x144ec4){logger[_0xeed3('0x10')](_0xeed3('0xd'),_0xeb9e9d,_0x144ec4);_0x41f229(_0x144ec4);});});} \ No newline at end of file +var _0x5e61=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x45a96c,_0x56ba3d){var _0x16cacc=function(_0x31630e){while(--_0x31630e){_0x45a96c['push'](_0x45a96c['shift']());}};_0x16cacc(++_0x56ba3d);}(_0x5e61,0xe2));var _0x15e6=function(_0x25d7fd,_0x7865e4){_0x25d7fd=_0x25d7fd-0x0;var _0x33b1ef=_0x5e61[_0x25d7fd];return _0x33b1ef;};'use strict';var _=require(_0x15e6('0x0'));var util=require(_0x15e6('0x1'));var moment=require('moment');var BPromise=require(_0x15e6('0x2'));var rs=require(_0x15e6('0x3'));var fs=require('fs');var Redis=require(_0x15e6('0x4'));var db=require(_0x15e6('0x5'))['db'];var utils=require(_0x15e6('0x6'));var logger=require(_0x15e6('0x7'))(_0x15e6('0x8'));var config=require(_0x15e6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x15e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43d1fe,_0x4f926a,_0x5a2694){return new BPromise(function(_0x4bb14c,_0xbac773){return client[_0x15e6('0xb')](_0x43d1fe,_0x5a2694)[_0x15e6('0xc')](function(_0x254abc){logger['info'](_0x15e6('0xd'),_0x4f926a,_0x15e6('0xe'));logger[_0x15e6('0xf')](_0x15e6('0x10'),_0x4f926a,_0x15e6('0xe'),JSON[_0x15e6('0x11')](_0x254abc));if(_0x254abc[_0x15e6('0x12')]){if(_0x254abc['error'][_0x15e6('0x13')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4f926a,_0x254abc['error']['message']);return _0xbac773(_0x254abc[_0x15e6('0x12')][_0x15e6('0x14')]);}logger[_0x15e6('0x12')](_0x15e6('0xd'),_0x4f926a,_0x254abc[_0x15e6('0x12')]['message']);return _0x4bb14c(_0x254abc[_0x15e6('0x12')][_0x15e6('0x14')]);}else{logger[_0x15e6('0x15')](_0x15e6('0xd'),_0x4f926a,_0x15e6('0xe'));_0x4bb14c(_0x254abc[_0x15e6('0x16')][_0x15e6('0x14')]);}})[_0x15e6('0x17')](function(_0x40b33f){logger[_0x15e6('0x12')](_0x15e6('0xd'),_0x4f926a,_0x40b33f);_0xbac773(_0x40b33f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index cd2f54b..4e33e42 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 _0x9512=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post'];(function(_0x2f62d0,_0x5d70ea){var _0x296c86=function(_0x310a40){while(--_0x310a40){_0x2f62d0['push'](_0x2f62d0['shift']());}};_0x296c86(++_0x5d70ea);}(_0x9512,0x75));var _0x2951=function(_0x4dfd70,_0x35e8d2){_0x4dfd70=_0x4dfd70-0x0;var _0x48d818=_0x9512[_0x4dfd70];return _0x48d818;};'use strict';var multer=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var path=require(_0x2951('0x2'));var timeout=require(_0x2951('0x3'));var express=require(_0x2951('0x4'));var router=express[_0x2951('0x5')]();var fs_extra=require(_0x2951('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2951('0x7'));var config=require(_0x2951('0x8'));var controller=require(_0x2951('0x9'));router[_0x2951('0xa')]('/',auth[_0x2951('0xb')](),controller[_0x2951('0xc')]);router[_0x2951('0xa')]('/:id',auth[_0x2951('0xb')](),controller[_0x2951('0xd')]);router[_0x2951('0xe')]('/',auth[_0x2951('0xb')](),controller[_0x2951('0xf')]);router[_0x2951('0x10')]('/:id',auth[_0x2951('0xb')](),controller[_0x2951('0x11')]);router[_0x2951('0x12')](_0x2951('0x13'),auth['isAuthenticated'](),controller[_0x2951('0x14')]);module[_0x2951('0x15')]=router; \ No newline at end of file +var _0x89fb=['get','index','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x89fb,0x14b));var _0xb89f=function(_0x4b99a7,_0x57a007){_0x4b99a7=_0x4b99a7-0x0;var _0x36aab0=_0x89fb[_0x4b99a7];return _0x36aab0;};'use strict';var multer=require('multer');var util=require(_0xb89f('0x0'));var path=require(_0xb89f('0x1'));var timeout=require(_0xb89f('0x2'));var express=require(_0xb89f('0x3'));var router=express[_0xb89f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb89f('0x5'));var interaction=require(_0xb89f('0x6'));var config=require(_0xb89f('0x7'));var controller=require(_0xb89f('0x8'));router[_0xb89f('0x9')]('/',auth['isAuthenticated'](),controller[_0xb89f('0xa')]);router['get'](_0xb89f('0xb'),auth['isAuthenticated'](),controller[_0xb89f('0xc')]);router[_0xb89f('0xd')]('/',auth[_0xb89f('0xe')](),controller['create']);router[_0xb89f('0xf')](_0xb89f('0xb'),auth[_0xb89f('0xe')](),controller[_0xb89f('0x10')]);router[_0xb89f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb89f('0x12')]);module[_0xb89f('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 856e68b..077dc0c 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 _0x6f85=['STRING','TEXT','sequelize','exports'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x6f85,0x8e));var _0x56f8=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x6f85[_0x542da8];return _0x533d7e;};'use strict';var Sequelize=require(_0x56f8('0x0'));module[_0x56f8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56f8('0x2')]},'html':{'type':Sequelize[_0x56f8('0x3')]}}; \ No newline at end of file +var _0x33e7=['TEXT','sequelize','exports','STRING'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x33e7,0x1a1));var _0x733e=function(_0x56fe99,_0x1449da){_0x56fe99=_0x56fe99-0x0;var _0x322d78=_0x33e7[_0x56fe99];return _0x322d78;};'use strict';var Sequelize=require(_0x733e('0x0'));module[_0x733e('0x1')]={'name':{'type':Sequelize[_0x733e('0x2')]},'description':{'type':Sequelize[_0x733e('0x2')]},'html':{'type':Sequelize[_0x733e('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 04ffd2e..cce9628 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 _0xdc0e=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xc44a20,_0x477b5e){var _0x590b28=function(_0x5271c3){while(--_0x5271c3){_0xc44a20['push'](_0xc44a20['shift']());}};_0x590b28(++_0x477b5e);}(_0xdc0e,0xeb));var _0xedc0=function(_0x5a550c,_0x4b1bc0){_0x5a550c=_0x5a550c-0x0;var _0x5f2417=_0xdc0e[_0x5a550c];return _0x5f2417;};'use strict';var emlformat=require(_0xedc0('0x0'));var rimraf=require(_0xedc0('0x1'));var zipdir=require(_0xedc0('0x2'));var jsonpatch=require(_0xedc0('0x3'));var rp=require(_0xedc0('0x4'));var moment=require('moment');var BPromise=require(_0xedc0('0x5'));var Mustache=require(_0xedc0('0x6'));var util=require(_0xedc0('0x7'));var path=require(_0xedc0('0x8'));var sox=require(_0xedc0('0x9'));var csv=require('to-csv');var ejs=require(_0xedc0('0xa'));var fs=require('fs');var fs_extra=require(_0xedc0('0xb'));var _=require(_0xedc0('0xc'));var squel=require(_0xedc0('0xd'));var crypto=require(_0xedc0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xedc0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xedc0('0x10'));var Redis=require(_0xedc0('0x11'));var authService=require(_0xedc0('0x12'));var qs=require(_0xedc0('0x13'));var as=require(_0xedc0('0x14'));var hardwareService=require(_0xedc0('0x15'));var logger=require('../../config/logger')(_0xedc0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedc0('0x17'));var db=require(_0xedc0('0x18'))['db'];function respondWithStatusCode(_0x4c507c,_0x1881ef){_0x1881ef=_0x1881ef||0xcc;return function(_0x5a4dbe){if(_0x5a4dbe){return _0x4c507c[_0xedc0('0x19')](_0x1881ef);}return _0x4c507c[_0xedc0('0x1a')](_0x1881ef)[_0xedc0('0x1b')]();};}function respondWithResult(_0x1e280e,_0xf02e45){_0xf02e45=_0xf02e45||0xc8;return function(_0x3f5e10){if(_0x3f5e10){return _0x1e280e[_0xedc0('0x1a')](_0xf02e45)['json'](_0x3f5e10);}};}function respondWithFilteredResult(_0x68fe8,_0x4d28a3){return function(_0x22885d){if(_0x22885d){var _0x5d6f53=typeof _0x4d28a3[_0xedc0('0x1c')]===_0xedc0('0x1d')&&typeof _0x4d28a3[_0xedc0('0x1e')]===_0xedc0('0x1d');var _0x2356f5=_0x22885d[_0xedc0('0x1f')];var _0x9f0c8d=_0x5d6f53?0x0:_0x4d28a3[_0xedc0('0x1c')];var _0xdfb73b=_0x5d6f53?_0x22885d[_0xedc0('0x1f')]:_0x4d28a3[_0xedc0('0x1c')]+_0x4d28a3['limit'];var _0x4d17f3;if(_0xdfb73b>=_0x2356f5){_0xdfb73b=_0x2356f5;_0x4d17f3=0xc8;}else{_0x4d17f3=0xce;}_0x68fe8[_0xedc0('0x1a')](_0x4d17f3);return _0x68fe8[_0xedc0('0x20')](_0xedc0('0x21'),_0x9f0c8d+'-'+_0xdfb73b+'/'+_0x2356f5)[_0xedc0('0x22')](_0x22885d);}return null;};}function patchUpdates(_0x15c1e1){return function(_0x2123d9){try{jsonpatch['apply'](_0x2123d9,_0x15c1e1,!![]);}catch(_0x833832){return BPromise[_0xedc0('0x23')](_0x833832);}return _0x2123d9[_0xedc0('0x24')]();};}function saveUpdates(_0x5af2d7,_0x5cb366){return function(_0x211e3b){if(_0x211e3b){return _0x211e3b[_0xedc0('0x25')](_0x5af2d7)[_0xedc0('0x26')](function(_0x4effd3){return _0x4effd3;});}return null;};}function removeEntity(_0x39b75a,_0x583602){return function(_0x514bfc){if(_0x514bfc){return _0x514bfc[_0xedc0('0x27')]()[_0xedc0('0x26')](function(){var _0x4d5c59=_0x514bfc[_0xedc0('0x28')]({'plain':!![]});var _0x21186d=_0xedc0('0x29');return db[_0xedc0('0x2a')][_0xedc0('0x27')]({'where':{'type':_0x21186d,'resourceId':_0x4d5c59['id']}})['then'](function(){return _0x514bfc;});})[_0xedc0('0x26')](function(){_0x39b75a['status'](0xcc)[_0xedc0('0x1b')]();});}};}function handleEntityNotFound(_0x55cae2,_0x503ad1){return function(_0x289171){if(!_0x289171){_0x55cae2[_0xedc0('0x19')](0x194);}return _0x289171;};}function handleError(_0x424286,_0x3a80a2){_0x3a80a2=_0x3a80a2||0x1f4;return function(_0x51e06a){logger[_0xedc0('0x2b')](_0x51e06a['stack']);if(_0x51e06a[_0xedc0('0x2c')]){delete _0x51e06a[_0xedc0('0x2c')];}_0x424286['status'](_0x3a80a2)[_0xedc0('0x2d')](_0x51e06a);};}exports[_0xedc0('0x2e')]=function(_0xc66d7d,_0x299741){var _0x3e1c76={},_0x17496f={},_0x36f400={'count':0x0,'rows':[]};var _0x20e2f1=_[_0xedc0('0x2f')](db[_0xedc0('0x30')][_0xedc0('0x31')],function(_0x5d1d9){return{'name':_0x5d1d9[_0xedc0('0x32')],'type':_0x5d1d9[_0xedc0('0x33')][_0xedc0('0x34')]};});_0x17496f[_0xedc0('0x35')]=_['map'](_0x20e2f1,'name');_0x17496f[_0xedc0('0x36')]=_[_0xedc0('0x37')](_0xc66d7d[_0xedc0('0x36')]);_0x17496f[_0xedc0('0x38')]=_[_0xedc0('0x39')](_0x17496f[_0xedc0('0x35')],_0x17496f[_0xedc0('0x36')]);_0x3e1c76[_0xedc0('0x3a')]=_[_0xedc0('0x39')](_0x17496f[_0xedc0('0x35')],qs[_0xedc0('0x3b')](_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x3b')]));_0x3e1c76['attributes']=_0x3e1c76['attributes'][_0xedc0('0x3c')]?_0x3e1c76[_0xedc0('0x3a')]:_0x17496f[_0xedc0('0x35')];if(!_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x3d')](_0xedc0('0x3e'))){_0x3e1c76[_0xedc0('0x1e')]=qs['limit'](_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x1e')]);_0x3e1c76[_0xedc0('0x1c')]=qs[_0xedc0('0x1c')](_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x1c')]);}_0x3e1c76[_0xedc0('0x3f')]=qs[_0xedc0('0x40')](_0xc66d7d['query'][_0xedc0('0x40')]);_0x3e1c76[_0xedc0('0x41')]=qs['filters'](_['pick'](_0xc66d7d['query'],_0x17496f[_0xedc0('0x38')]),_0x20e2f1);if(_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x42')]){_0x3e1c76['where']=_[_0xedc0('0x43')](_0x3e1c76[_0xedc0('0x41')],{'$or':_[_0xedc0('0x2f')](_0x20e2f1,function(_0x582b69){if(_0x582b69[_0xedc0('0x33')]!==_0xedc0('0x44')){var _0x140ed4={};_0x140ed4[_0x582b69[_0xedc0('0x2c')]]={'$like':'%'+_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x42')]+'%'};return _0x140ed4;}})});}_0x3e1c76=_[_0xedc0('0x43')]({},_0x3e1c76,_0xc66d7d[_0xedc0('0x45')]);var _0x1a6ba7={'where':_0x3e1c76[_0xedc0('0x41')]};return db[_0xedc0('0x30')][_0xedc0('0x1f')](_0x1a6ba7)[_0xedc0('0x26')](function(_0x49edfe){_0x36f400[_0xedc0('0x1f')]=_0x49edfe;if(_0xc66d7d[_0xedc0('0x36')][_0xedc0('0x46')]){_0x3e1c76[_0xedc0('0x47')]=[{'all':!![]}];}return db[_0xedc0('0x30')][_0xedc0('0x48')](_0x3e1c76);})[_0xedc0('0x26')](function(_0x242b7a){_0x36f400['rows']=_0x242b7a;return _0x36f400;})[_0xedc0('0x26')](respondWithFilteredResult(_0x299741,_0x3e1c76))[_0xedc0('0x49')](handleError(_0x299741,null));};exports[_0xedc0('0x4a')]=function(_0x256e80,_0x551aa6){var _0x19c6a5={'raw':!![],'where':{'id':_0x256e80[_0xedc0('0x4b')]['id']}},_0x34f6ae={};_0x34f6ae[_0xedc0('0x35')]=_[_0xedc0('0x37')](db['Template'][_0xedc0('0x31')]);_0x34f6ae[_0xedc0('0x36')]=_['keys'](_0x256e80['query']);_0x34f6ae[_0xedc0('0x38')]=_[_0xedc0('0x39')](_0x34f6ae[_0xedc0('0x35')],_0x34f6ae[_0xedc0('0x36')]);_0x19c6a5[_0xedc0('0x3a')]=_[_0xedc0('0x39')](_0x34f6ae[_0xedc0('0x35')],qs['fields'](_0x256e80['query'][_0xedc0('0x3b')]));_0x19c6a5[_0xedc0('0x3a')]=_0x19c6a5[_0xedc0('0x3a')][_0xedc0('0x3c')]?_0x19c6a5['attributes']:_0x34f6ae[_0xedc0('0x35')];if(_0x256e80[_0xedc0('0x36')][_0xedc0('0x46')]){_0x19c6a5[_0xedc0('0x47')]=[{'all':!![]}];}_0x19c6a5=_[_0xedc0('0x43')]({},_0x19c6a5,_0x256e80[_0xedc0('0x45')]);return db[_0xedc0('0x30')]['find'](_0x19c6a5)[_0xedc0('0x26')](handleEntityNotFound(_0x551aa6,null))[_0xedc0('0x26')](respondWithResult(_0x551aa6,null))['catch'](handleError(_0x551aa6,null));};exports[_0xedc0('0x4c')]=function(_0x1013f0,_0x35ec91){return db[_0xedc0('0x30')]['create'](_0x1013f0['body'],{})[_0xedc0('0x26')](function(_0x3ec104){var _0x1b20d4=_0x1013f0[_0xedc0('0x4d')][_0xedc0('0x28')]({'plain':!![]});if(!_0x1b20d4)throw new Error(_0xedc0('0x4e'));if(_0x1b20d4[_0xedc0('0x4f')]===_0xedc0('0x4d')){var _0x13d998=_0x3ec104[_0xedc0('0x28')]({'plain':!![]});var _0x1b8e1d=_0xedc0('0x29');return db[_0xedc0('0x50')]['find']({'where':{'name':_0x1b8e1d,'userProfileId':_0x1b20d4[_0xedc0('0x51')]},'raw':!![]})[_0xedc0('0x26')](function(_0x4a9578){if(_0x4a9578&&_0x4a9578[_0xedc0('0x52')]===0x0){return db[_0xedc0('0x2a')]['create']({'name':_0x13d998['name'],'resourceId':_0x13d998['id'],'type':_0x4a9578[_0xedc0('0x2c')],'sectionId':_0x4a9578['id']},{})[_0xedc0('0x26')](function(){return _0x3ec104;});}else{return _0x3ec104;}})[_0xedc0('0x49')](function(_0x3af860){logger[_0xedc0('0x2b')](_0xedc0('0x53'),_0x3af860);throw _0x3af860;});}return _0x3ec104;})[_0xedc0('0x26')](respondWithResult(_0x35ec91,0xc9))[_0xedc0('0x49')](handleError(_0x35ec91,null));};exports[_0xedc0('0x25')]=function(_0x5d34d7,_0x15807c){if(_0x5d34d7[_0xedc0('0x54')]['id']){delete _0x5d34d7[_0xedc0('0x54')]['id'];}return db[_0xedc0('0x30')][_0xedc0('0x55')]({'where':{'id':_0x5d34d7[_0xedc0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15807c,null))[_0xedc0('0x26')](saveUpdates(_0x5d34d7['body'],null))['then'](respondWithResult(_0x15807c,null))[_0xedc0('0x49')](handleError(_0x15807c,null));};exports[_0xedc0('0x27')]=function(_0x10989e,_0xe7a8b9){return db[_0xedc0('0x30')][_0xedc0('0x55')]({'where':{'id':_0x10989e[_0xedc0('0x4b')]['id']}})[_0xedc0('0x26')](handleEntityNotFound(_0xe7a8b9,null))[_0xedc0('0x26')](removeEntity(_0xe7a8b9,null))['catch'](handleError(_0xe7a8b9,null));}; \ No newline at end of file +var _0x5569=['userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','Template','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','role','user','UserProfileSection','find'];(function(_0x2f8a7c,_0x3f65fd){var _0x257e01=function(_0x412826){while(--_0x412826){_0x2f8a7c['push'](_0x2f8a7c['shift']());}};_0x257e01(++_0x3f65fd);}(_0x5569,0xa9));var _0x9556=function(_0x64bbb9,_0x909c76){_0x64bbb9=_0x64bbb9-0x0;var _0x5c3707=_0x5569[_0x64bbb9];return _0x5c3707;};'use strict';var emlformat=require(_0x9556('0x0'));var rimraf=require(_0x9556('0x1'));var zipdir=require(_0x9556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9556('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9556('0x4'));var util=require(_0x9556('0x5'));var path=require('path');var sox=require(_0x9556('0x6'));var csv=require(_0x9556('0x7'));var ejs=require(_0x9556('0x8'));var fs=require('fs');var fs_extra=require(_0x9556('0x9'));var _=require(_0x9556('0xa'));var squel=require(_0x9556('0xb'));var crypto=require(_0x9556('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9556('0xd'));var toCsv=require(_0x9556('0x7'));var querystring=require(_0x9556('0xe'));var Papa=require('papaparse');var Redis=require(_0x9556('0xf'));var authService=require(_0x9556('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9556('0x11'));var hardwareService=require(_0x9556('0x12'));var logger=require(_0x9556('0x13'))(_0x9556('0x14'));var utils=require('../../config/utils');var config=require(_0x9556('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9556('0x16'))['db'];function respondWithStatusCode(_0x1ae8b3,_0x30234f){_0x30234f=_0x30234f||0xcc;return function(_0xb8c977){if(_0xb8c977){return _0x1ae8b3[_0x9556('0x17')](_0x30234f);}return _0x1ae8b3[_0x9556('0x18')](_0x30234f)[_0x9556('0x19')]();};}function respondWithResult(_0x405d81,_0xd531a){_0xd531a=_0xd531a||0xc8;return function(_0xe70270){if(_0xe70270){return _0x405d81[_0x9556('0x18')](_0xd531a)[_0x9556('0x1a')](_0xe70270);}};}function respondWithFilteredResult(_0xfe3f8c,_0x4584a1){return function(_0x5ad005){if(_0x5ad005){var _0x5f21b8=typeof _0x4584a1[_0x9556('0x1b')]===_0x9556('0x1c')&&typeof _0x4584a1['limit']===_0x9556('0x1c');var _0x3aa799=_0x5ad005[_0x9556('0x1d')];var _0x261ece=_0x5f21b8?0x0:_0x4584a1[_0x9556('0x1b')];var _0xfb5cb0=_0x5f21b8?_0x5ad005['count']:_0x4584a1['offset']+_0x4584a1[_0x9556('0x1e')];var _0x4d7af1;if(_0xfb5cb0>=_0x3aa799){_0xfb5cb0=_0x3aa799;_0x4d7af1=0xc8;}else{_0x4d7af1=0xce;}_0xfe3f8c['status'](_0x4d7af1);return _0xfe3f8c['set'](_0x9556('0x1f'),_0x261ece+'-'+_0xfb5cb0+'/'+_0x3aa799)[_0x9556('0x1a')](_0x5ad005);}return null;};}function patchUpdates(_0x435754){return function(_0x1ce1fa){try{jsonpatch[_0x9556('0x20')](_0x1ce1fa,_0x435754,!![]);}catch(_0x119b2e){return BPromise[_0x9556('0x21')](_0x119b2e);}return _0x1ce1fa[_0x9556('0x22')]();};}function saveUpdates(_0x553192,_0x50c3dc){return function(_0x4694c2){if(_0x4694c2){return _0x4694c2[_0x9556('0x23')](_0x553192)['then'](function(_0x1b55ae){return _0x1b55ae;});}return null;};}function removeEntity(_0x43e30a,_0x4caa95){return function(_0x24231c){if(_0x24231c){return _0x24231c[_0x9556('0x24')]()[_0x9556('0x25')](function(){var _0x5281f9=_0x24231c[_0x9556('0x26')]({'plain':!![]});var _0x5b2f98=_0x9556('0x27');return db[_0x9556('0x28')][_0x9556('0x24')]({'where':{'type':_0x5b2f98,'resourceId':_0x5281f9['id']}})[_0x9556('0x25')](function(){return _0x24231c;});})[_0x9556('0x25')](function(){_0x43e30a[_0x9556('0x18')](0xcc)[_0x9556('0x19')]();});}};}function handleEntityNotFound(_0x5796d4,_0x923010){return function(_0x1ec6a5){if(!_0x1ec6a5){_0x5796d4[_0x9556('0x17')](0x194);}return _0x1ec6a5;};}function handleError(_0x2f88ec,_0x52b7b6){_0x52b7b6=_0x52b7b6||0x1f4;return function(_0x98a3f){logger[_0x9556('0x29')](_0x98a3f[_0x9556('0x2a')]);if(_0x98a3f[_0x9556('0x2b')]){delete _0x98a3f[_0x9556('0x2b')];}_0x2f88ec[_0x9556('0x18')](_0x52b7b6)[_0x9556('0x2c')](_0x98a3f);};}exports[_0x9556('0x2d')]=function(_0x33fa0a,_0x46361d){var _0x13de5c={},_0x9b06ae={},_0x17f2eb={'count':0x0,'rows':[]};var _0x3d7fa4=_['map'](db[_0x9556('0x2e')]['rawAttributes'],function(_0x11488e){return{'name':_0x11488e[_0x9556('0x2f')],'type':_0x11488e[_0x9556('0x30')][_0x9556('0x31')]};});_0x9b06ae[_0x9556('0x32')]=_[_0x9556('0x33')](_0x3d7fa4,_0x9556('0x2b'));_0x9b06ae[_0x9556('0x34')]=_[_0x9556('0x35')](_0x33fa0a[_0x9556('0x34')]);_0x9b06ae[_0x9556('0x36')]=_[_0x9556('0x37')](_0x9b06ae[_0x9556('0x32')],_0x9b06ae[_0x9556('0x34')]);_0x13de5c[_0x9556('0x38')]=_['intersection'](_0x9b06ae[_0x9556('0x32')],qs['fields'](_0x33fa0a['query'][_0x9556('0x39')]));_0x13de5c['attributes']=_0x13de5c[_0x9556('0x38')][_0x9556('0x3a')]?_0x13de5c[_0x9556('0x38')]:_0x9b06ae['model'];if(!_0x33fa0a[_0x9556('0x34')]['hasOwnProperty'](_0x9556('0x3b'))){_0x13de5c['limit']=qs[_0x9556('0x1e')](_0x33fa0a[_0x9556('0x34')][_0x9556('0x1e')]);_0x13de5c[_0x9556('0x1b')]=qs[_0x9556('0x1b')](_0x33fa0a[_0x9556('0x34')][_0x9556('0x1b')]);}_0x13de5c['order']=qs[_0x9556('0x3c')](_0x33fa0a[_0x9556('0x34')]['sort']);_0x13de5c[_0x9556('0x3d')]=qs['filters'](_[_0x9556('0x3e')](_0x33fa0a[_0x9556('0x34')],_0x9b06ae[_0x9556('0x36')]),_0x3d7fa4);if(_0x33fa0a[_0x9556('0x34')][_0x9556('0x3f')]){_0x13de5c['where']=_[_0x9556('0x40')](_0x13de5c[_0x9556('0x3d')],{'$or':_['map'](_0x3d7fa4,function(_0x8c8e7c){if(_0x8c8e7c[_0x9556('0x30')]!==_0x9556('0x41')){var _0x10e1cf={};_0x10e1cf[_0x8c8e7c[_0x9556('0x2b')]]={'$like':'%'+_0x33fa0a['query']['filter']+'%'};return _0x10e1cf;}})});}_0x13de5c=_[_0x9556('0x40')]({},_0x13de5c,_0x33fa0a[_0x9556('0x42')]);var _0x25b18f={'where':_0x13de5c[_0x9556('0x3d')]};return db[_0x9556('0x2e')][_0x9556('0x1d')](_0x25b18f)[_0x9556('0x25')](function(_0x473e5e){_0x17f2eb[_0x9556('0x1d')]=_0x473e5e;if(_0x33fa0a[_0x9556('0x34')][_0x9556('0x43')]){_0x13de5c[_0x9556('0x44')]=[{'all':!![]}];}return db['Template'][_0x9556('0x45')](_0x13de5c);})[_0x9556('0x25')](function(_0xab6cbe){_0x17f2eb[_0x9556('0x46')]=_0xab6cbe;return _0x17f2eb;})[_0x9556('0x25')](respondWithFilteredResult(_0x46361d,_0x13de5c))[_0x9556('0x47')](handleError(_0x46361d,null));};exports[_0x9556('0x48')]=function(_0x2d9d0a,_0x8b6c6f){var _0x33b343={'raw':!![],'where':{'id':_0x2d9d0a[_0x9556('0x49')]['id']}},_0x40cc56={};_0x40cc56[_0x9556('0x32')]=_[_0x9556('0x35')](db[_0x9556('0x2e')][_0x9556('0x4a')]);_0x40cc56['query']=_['keys'](_0x2d9d0a[_0x9556('0x34')]);_0x40cc56['filters']=_[_0x9556('0x37')](_0x40cc56[_0x9556('0x32')],_0x40cc56[_0x9556('0x34')]);_0x33b343[_0x9556('0x38')]=_['intersection'](_0x40cc56[_0x9556('0x32')],qs['fields'](_0x2d9d0a[_0x9556('0x34')]['fields']));_0x33b343[_0x9556('0x38')]=_0x33b343['attributes'][_0x9556('0x3a')]?_0x33b343[_0x9556('0x38')]:_0x40cc56['model'];if(_0x2d9d0a[_0x9556('0x34')][_0x9556('0x43')]){_0x33b343[_0x9556('0x44')]=[{'all':!![]}];}_0x33b343=_[_0x9556('0x40')]({},_0x33b343,_0x2d9d0a[_0x9556('0x42')]);return db['Template']['find'](_0x33b343)[_0x9556('0x25')](handleEntityNotFound(_0x8b6c6f,null))[_0x9556('0x25')](respondWithResult(_0x8b6c6f,null))['catch'](handleError(_0x8b6c6f,null));};exports[_0x9556('0x4b')]=function(_0x6e8270,_0x11af37){return db[_0x9556('0x2e')][_0x9556('0x4b')](_0x6e8270['body'],{})['then'](function(_0x35e668){var _0x5f3ca4=_0x6e8270['user'][_0x9556('0x26')]({'plain':!![]});if(!_0x5f3ca4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f3ca4[_0x9556('0x4c')]===_0x9556('0x4d')){var _0x4f9144=_0x35e668['get']({'plain':!![]});var _0x2e4a3a=_0x9556('0x27');return db[_0x9556('0x4e')][_0x9556('0x4f')]({'where':{'name':_0x2e4a3a,'userProfileId':_0x5f3ca4[_0x9556('0x50')]},'raw':!![]})[_0x9556('0x25')](function(_0x56565c){if(_0x56565c&&_0x56565c[_0x9556('0x51')]===0x0){return db[_0x9556('0x28')][_0x9556('0x4b')]({'name':_0x4f9144[_0x9556('0x2b')],'resourceId':_0x4f9144['id'],'type':_0x56565c['name'],'sectionId':_0x56565c['id']},{})['then'](function(){return _0x35e668;});}else{return _0x35e668;}})[_0x9556('0x47')](function(_0x55121b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55121b);throw _0x55121b;});}return _0x35e668;})[_0x9556('0x25')](respondWithResult(_0x11af37,0xc9))[_0x9556('0x47')](handleError(_0x11af37,null));};exports['update']=function(_0x56e9e2,_0x41cecd){if(_0x56e9e2['body']['id']){delete _0x56e9e2[_0x9556('0x52')]['id'];}return db[_0x9556('0x2e')][_0x9556('0x4f')]({'where':{'id':_0x56e9e2[_0x9556('0x49')]['id']}})[_0x9556('0x25')](handleEntityNotFound(_0x41cecd,null))[_0x9556('0x25')](saveUpdates(_0x56e9e2[_0x9556('0x52')],null))[_0x9556('0x25')](respondWithResult(_0x41cecd,null))[_0x9556('0x47')](handleError(_0x41cecd,null));};exports[_0x9556('0x24')]=function(_0x327779,_0x834651){return db[_0x9556('0x2e')][_0x9556('0x4f')]({'where':{'id':_0x327779[_0x9556('0x49')]['id']}})[_0x9556('0x25')](handleEntityNotFound(_0x834651,null))[_0x9556('0x25')](removeEntity(_0x834651,null))['catch'](handleError(_0x834651,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 392e6e7..e9408c0 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 _0x98ab=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','util'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x98ab,0x1ba));var _0xb98a=function(_0x5f5138,_0x24aa70){_0x5f5138=_0x5f5138-0x0;var _0x489b1e=_0x98ab[_0x5f5138];return _0x489b1e;};'use strict';var _=require(_0xb98a('0x0'));var util=require(_0xb98a('0x1'));var logger=require(_0xb98a('0x2'))('api');var moment=require(_0xb98a('0x3'));var BPromise=require(_0xb98a('0x4'));var rp=require(_0xb98a('0x5'));var fs=require('fs');var path=require(_0xb98a('0x6'));var rimraf=require(_0xb98a('0x7'));var config=require(_0xb98a('0x8'));var attributes=require(_0xb98a('0x9'));module['exports']=function(_0x3640da,_0x5361e5){return _0x3640da['define'](_0xb98a('0xa'),attributes,{'tableName':_0xb98a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f31=['../../config/logger','path','./template.attributes','Template','tools_templates','lodash'];(function(_0xb75fea,_0x3212f8){var _0x242ee4=function(_0x4c6b8e){while(--_0x4c6b8e){_0xb75fea['push'](_0xb75fea['shift']());}};_0x242ee4(++_0x3212f8);}(_0x2f31,0x119));var _0x12f3=function(_0x126dcd,_0x28c248){_0x126dcd=_0x126dcd-0x0;var _0x3f9913=_0x2f31[_0x126dcd];return _0x3f9913;};'use strict';var _=require(_0x12f3('0x0'));var util=require('util');var logger=require(_0x12f3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x12f3('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12f3('0x3'));module['exports']=function(_0x32a239,_0x4cfc0d){return _0x32a239['define'](_0x12f3('0x4'),attributes,{'tableName':_0x12f3('0x5'),'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 23f1533..68d1daf 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 _0xb50a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x17a0a0,_0x1befaa){var _0x4da752=function(_0x429829){while(--_0x429829){_0x17a0a0['push'](_0x17a0a0['shift']());}};_0x4da752(++_0x1befaa);}(_0xb50a,0x135));var _0xab50=function(_0x1c962f,_0x31c1b5){_0x1c962f=_0x1c962f-0x0;var _0x460a1d=_0xb50a[_0x1c962f];return _0x460a1d;};'use strict';var _=require(_0xab50('0x0'));var util=require(_0xab50('0x1'));var moment=require(_0xab50('0x2'));var BPromise=require(_0xab50('0x3'));var rs=require(_0xab50('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab50('0x5'));var logger=require(_0xab50('0x6'))(_0xab50('0x7'));var config=require(_0xab50('0x8'));var jayson=require(_0xab50('0x9'));var client=jayson[_0xab50('0xa')][_0xab50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5beaa8,_0x49b912,_0x5f465a){return new BPromise(function(_0x1026a5,_0x46bd73){return client[_0xab50('0xc')](_0x5beaa8,_0x5f465a)['then'](function(_0x59e872){logger[_0xab50('0xd')](_0xab50('0xe'),_0x49b912,_0xab50('0xf'));logger[_0xab50('0x10')](_0xab50('0x11'),_0x49b912,_0xab50('0xf'),JSON[_0xab50('0x12')](_0x59e872));if(_0x59e872[_0xab50('0x13')]){if(_0x59e872[_0xab50('0x13')][_0xab50('0x14')]===0x1f4){logger[_0xab50('0x13')](_0xab50('0xe'),_0x49b912,_0x59e872['error'][_0xab50('0x15')]);return _0x46bd73(_0x59e872[_0xab50('0x13')][_0xab50('0x15')]);}logger['error']('Template,\x20%s,\x20%s',_0x49b912,_0x59e872['error'][_0xab50('0x15')]);return _0x1026a5(_0x59e872['error'][_0xab50('0x15')]);}else{logger['info'](_0xab50('0xe'),_0x49b912,'request\x20sent');_0x1026a5(_0x59e872[_0xab50('0x16')][_0xab50('0x15')]);}})[_0xab50('0x17')](function(_0x3b5f7b){logger[_0xab50('0x13')](_0xab50('0xe'),_0x49b912,_0x3b5f7b);_0x46bd73(_0x3b5f7b);});});}exports[_0xab50('0x18')]=function(_0xbbd119){var _0x63acec=this;return new Promise(function(_0x5a057c,_0x1e2eaf){return db[_0xab50('0x19')][_0xab50('0x1a')]({'raw':_0xbbd119[_0xab50('0x1b')]?_0xbbd119[_0xab50('0x1b')][_0xab50('0x1c')]===undefined?!![]:![]:!![],'where':_0xbbd119[_0xab50('0x1b')]?_0xbbd119[_0xab50('0x1b')][_0xab50('0x1d')]||null:null,'attributes':_0xbbd119[_0xab50('0x1b')]?_0xbbd119['options'][_0xab50('0x1e')]||null:null,'limit':_0xbbd119[_0xab50('0x1b')]?_0xbbd119[_0xab50('0x1b')]['limit']||null:null,'include':_0xbbd119[_0xab50('0x1b')]?_0xbbd119['options'][_0xab50('0x1f')]?_['map'](_0xbbd119[_0xab50('0x1b')][_0xab50('0x1f')],function(_0x231c45){return{'model':db[_0x231c45['model']],'as':_0x231c45['as'],'attributes':_0x231c45['attributes'],'include':_0x231c45[_0xab50('0x1f')]?_[_0xab50('0x20')](_0x231c45[_0xab50('0x1f')],function(_0x1b2540){return{'model':db[_0x1b2540[_0xab50('0x21')]],'as':_0x1b2540['as'],'attributes':_0x1b2540[_0xab50('0x1e')],'include':_0x1b2540[_0xab50('0x1f')]?_[_0xab50('0x20')](_0x1b2540['include'],function(_0x1c851){return{'model':db[_0x1c851[_0xab50('0x21')]],'as':_0x1c851['as'],'attributes':_0x1c851[_0xab50('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xab50('0x22')](function(_0x5da9b2){logger[_0xab50('0xd')]('GetTemplate',_0xbbd119);logger['debug']('GetTemplate',_0xbbd119,JSON['stringify'](_0x5da9b2));_0x5a057c(_0x5da9b2);})[_0xab50('0x17')](function(_0x40ff40){logger['error']('GetTemplate',_0x40ff40[_0xab50('0x15')],_0xbbd119);_0x1e2eaf(_0x63acec[_0xab50('0x13')](0x1f4,_0x40ff40['message']));});});}; \ No newline at end of file +var _0xec1c=['debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','Template','findAll','options','where','attributes','include','map','model','GetTemplate','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x1568e4,_0xe2e742){var _0x1e9092=function(_0x4b34ec){while(--_0x4b34ec){_0x1568e4['push'](_0x1568e4['shift']());}};_0x1e9092(++_0xe2e742);}(_0xec1c,0x1c3));var _0xcec1=function(_0x2b37aa,_0x1d40dc){_0x2b37aa=_0x2b37aa-0x0;var _0x52b73d=_0xec1c[_0x2b37aa];return _0x52b73d;};'use strict';var _=require('lodash');var util=require(_0xcec1('0x0'));var moment=require(_0xcec1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcec1('0x2'));var db=require(_0xcec1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcec1('0x4'))('rpc');var config=require(_0xcec1('0x5'));var jayson=require(_0xcec1('0x6'));var client=jayson['client'][_0xcec1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40682b,_0x2dac8e,_0x40c3dd){return new BPromise(function(_0x139832,_0x112347){return client[_0xcec1('0x8')](_0x40682b,_0x40c3dd)[_0xcec1('0x9')](function(_0x549f4a){logger[_0xcec1('0xa')](_0xcec1('0xb'),_0x2dac8e,_0xcec1('0xc'));logger[_0xcec1('0xd')](_0xcec1('0xe'),_0x2dac8e,'request\x20sent',JSON['stringify'](_0x549f4a));if(_0x549f4a[_0xcec1('0xf')]){if(_0x549f4a['error'][_0xcec1('0x10')]===0x1f4){logger['error'](_0xcec1('0xb'),_0x2dac8e,_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);return _0x112347(_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);}logger[_0xcec1('0xf')](_0xcec1('0xb'),_0x2dac8e,_0x549f4a[_0xcec1('0xf')][_0xcec1('0x11')]);return _0x139832(_0x549f4a['error'][_0xcec1('0x11')]);}else{logger['info'](_0xcec1('0xb'),_0x2dac8e,_0xcec1('0xc'));_0x139832(_0x549f4a['result']['message']);}})[_0xcec1('0x12')](function(_0x24ce7d){logger[_0xcec1('0xf')]('Template,\x20%s,\x20%s',_0x2dac8e,_0x24ce7d);_0x112347(_0x24ce7d);});});}exports['GetTemplate']=function(_0x2b741f){var _0x436fb9=this;return new Promise(function(_0x1f523c,_0x344a9b){return db[_0xcec1('0x13')][_0xcec1('0x14')]({'raw':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2b741f['options']?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x16')]||null:null,'attributes':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x17')]||null:null,'limit':_0x2b741f[_0xcec1('0x15')]?_0x2b741f[_0xcec1('0x15')]['limit']||null:null,'include':_0x2b741f['options']?_0x2b741f[_0xcec1('0x15')][_0xcec1('0x18')]?_[_0xcec1('0x19')](_0x2b741f['options'][_0xcec1('0x18')],function(_0x1e5528){return{'model':db[_0x1e5528[_0xcec1('0x1a')]],'as':_0x1e5528['as'],'attributes':_0x1e5528[_0xcec1('0x17')],'include':_0x1e5528['include']?_[_0xcec1('0x19')](_0x1e5528['include'],function(_0x21d6fb){return{'model':db[_0x21d6fb['model']],'as':_0x21d6fb['as'],'attributes':_0x21d6fb[_0xcec1('0x17')],'include':_0x21d6fb[_0xcec1('0x18')]?_['map'](_0x21d6fb[_0xcec1('0x18')],function(_0x5329b4){return{'model':db[_0x5329b4[_0xcec1('0x1a')]],'as':_0x5329b4['as'],'attributes':_0x5329b4[_0xcec1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcec1('0x9')](function(_0x48717a){logger[_0xcec1('0xa')](_0xcec1('0x1b'),_0x2b741f);logger['debug'](_0xcec1('0x1b'),_0x2b741f,JSON[_0xcec1('0x1c')](_0x48717a));_0x1f523c(_0x48717a);})['catch'](function(_0x171c05){logger[_0xcec1('0xf')](_0xcec1('0x1b'),_0x171c05['message'],_0x2b741f);_0x344a9b(_0x436fb9[_0xcec1('0xf')](0x1f4,_0x171c05['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3301d3a..a834d01 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 _0xcd6f=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','addAction','delete','destroy'];(function(_0xabe298,_0x356381){var _0x5db0d4=function(_0xd4828b){while(--_0xd4828b){_0xabe298['push'](_0xabe298['shift']());}};_0x5db0d4(++_0x356381);}(_0xcd6f,0x73));var _0xfcd6=function(_0x16920a,_0x509068){_0x16920a=_0x16920a-0x0;var _0x421782=_0xcd6f[_0x16920a];return _0x421782;};'use strict';var multer=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var path=require('path');var timeout=require(_0xfcd6('0x2'));var express=require('express');var router=express[_0xfcd6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfcd6('0x4'));var interaction=require(_0xfcd6('0x5'));var config=require('../../config/environment');var controller=require(_0xfcd6('0x6'));router[_0xfcd6('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcd6('0x8')]);router[_0xfcd6('0x7')](_0xfcd6('0x9'),auth[_0xfcd6('0xa')](),controller['show']);router[_0xfcd6('0x7')](_0xfcd6('0xb'),auth[_0xfcd6('0xa')](),controller[_0xfcd6('0xc')]);router['get'](_0xfcd6('0xd'),auth['isAuthenticated'](),controller[_0xfcd6('0xe')]);router[_0xfcd6('0x7')]('/:id/actions',auth[_0xfcd6('0xa')](),controller[_0xfcd6('0xf')]);router[_0xfcd6('0x10')]('/',auth['isAuthenticated'](),controller[_0xfcd6('0x11')]);router[_0xfcd6('0x10')]('/:id/all_conditions',auth[_0xfcd6('0xa')](),controller[_0xfcd6('0x12')]);router['post']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xfcd6('0x13')]);router[_0xfcd6('0x10')]('/:id/actions',auth[_0xfcd6('0xa')](),controller[_0xfcd6('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfcd6('0x15')](_0xfcd6('0x9'),auth[_0xfcd6('0xa')](),controller[_0xfcd6('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf993=['getAnyConditions','getActions','post','addAllCondition','/:id/actions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions'];(function(_0xe5f810,_0x27722a){var _0x589c86=function(_0x5a1db5){while(--_0x5a1db5){_0xe5f810['push'](_0xe5f810['shift']());}};_0x589c86(++_0x27722a);}(_0xf993,0x1d5));var _0x3f99=function(_0x2c1082,_0x3a9379){_0x2c1082=_0x2c1082-0x0;var _0x659be9=_0xf993[_0x2c1082];return _0x659be9;};'use strict';var multer=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var path=require(_0x3f99('0x2'));var timeout=require(_0x3f99('0x3'));var express=require(_0x3f99('0x4'));var router=express[_0x3f99('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f99('0x6'));var config=require('../../config/environment');var controller=require(_0x3f99('0x7'));router[_0x3f99('0x8')]('/',auth[_0x3f99('0x9')](),controller['index']);router['get'](_0x3f99('0xa'),auth[_0x3f99('0x9')](),controller[_0x3f99('0xb')]);router['get'](_0x3f99('0xc'),auth[_0x3f99('0x9')](),controller['getAllConditions']);router['get'](_0x3f99('0xd'),auth[_0x3f99('0x9')](),controller[_0x3f99('0xe')]);router[_0x3f99('0x8')]('/:id/actions',auth[_0x3f99('0x9')](),controller[_0x3f99('0xf')]);router[_0x3f99('0x10')]('/',auth[_0x3f99('0x9')](),controller['create']);router[_0x3f99('0x10')]('/:id/all_conditions',auth[_0x3f99('0x9')](),controller[_0x3f99('0x11')]);router[_0x3f99('0x10')](_0x3f99('0xd'),auth[_0x3f99('0x9')](),controller['addAnyCondition']);router[_0x3f99('0x10')](_0x3f99('0x12'),auth[_0x3f99('0x9')](),controller['addAction']);router[_0x3f99('0x13')](_0x3f99('0xa'),auth[_0x3f99('0x9')](),controller[_0x3f99('0x14')]);router[_0x3f99('0x15')](_0x3f99('0xa'),auth['isAuthenticated'](),controller[_0x3f99('0x16')]);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 58fc090..1f67669 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 _0x1dd4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1205bb,_0x273416){var _0xc822bc=function(_0xec2773){while(--_0xec2773){_0x1205bb['push'](_0x1205bb['shift']());}};_0xc822bc(++_0x273416);}(_0x1dd4,0x14a));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41dd('0x0'));module[_0x41dd('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x41dd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x41dd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd743=['BOOLEAN','exports','STRING'];(function(_0x339a1b,_0x5e938c){var _0x400b68=function(_0x2769b2){while(--_0x2769b2){_0x339a1b['push'](_0x339a1b['shift']());}};_0x400b68(++_0x5e938c);}(_0xd743,0xee));var _0x3d74=function(_0x1426f7,_0x3d0199){_0x1426f7=_0x1426f7-0x0;var _0x2c55bf=_0xd743[_0x1426f7];return _0x2c55bf;};'use strict';var Sequelize=require('sequelize');module[_0x3d74('0x0')]={'name':{'type':Sequelize[_0x3d74('0x1')]},'channel':{'type':Sequelize[_0x3d74('0x1')]},'description':{'type':Sequelize[_0x3d74('0x1')]},'status':{'type':Sequelize[_0x3d74('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 55681a9..4df0a64 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 _0x7221=['where','VIRTUAL','filter','options','count','include','Trigger','rows','catch','show','params','includeAll','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','addAllCondition','TriggerAnyId','Condition','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','merge'];(function(_0x22c373,_0x213e01){var _0xf298b1=function(_0x47c9d0){while(--_0x47c9d0){_0x22c373['push'](_0x22c373['shift']());}};_0xf298b1(++_0x213e01);}(_0x7221,0x125));var _0x1722=function(_0xb20ec1,_0x49dc85){_0xb20ec1=_0xb20ec1-0x0;var _0x53cd29=_0x7221[_0xb20ec1];return _0x53cd29;};'use strict';var emlformat=require(_0x1722('0x0'));var rimraf=require(_0x1722('0x1'));var zipdir=require(_0x1722('0x2'));var jsonpatch=require(_0x1722('0x3'));var rp=require(_0x1722('0x4'));var moment=require(_0x1722('0x5'));var BPromise=require(_0x1722('0x6'));var Mustache=require(_0x1722('0x7'));var util=require(_0x1722('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1722('0x9'));var ejs=require(_0x1722('0xa'));var fs=require('fs');var fs_extra=require(_0x1722('0xb'));var _=require(_0x1722('0xc'));var squel=require(_0x1722('0xd'));var crypto=require(_0x1722('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1722('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1722('0x10'));var Papa=require(_0x1722('0x11'));var Redis=require(_0x1722('0x12'));var authService=require(_0x1722('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1722('0x14'));var hardwareService=require(_0x1722('0x15'));var logger=require(_0x1722('0x16'))(_0x1722('0x17'));var utils=require('../../config/utils');var config=require(_0x1722('0x18'));var licenseUtil=require(_0x1722('0x19'));var db=require(_0x1722('0x1a'))['db'];function respondWithStatusCode(_0x20c556,_0x56f7b3){_0x56f7b3=_0x56f7b3||0xcc;return function(_0x58268e){if(_0x58268e){return _0x20c556[_0x1722('0x1b')](_0x56f7b3);}return _0x20c556[_0x1722('0x1c')](_0x56f7b3)[_0x1722('0x1d')]();};}function respondWithResult(_0x224fd1,_0x310240){_0x310240=_0x310240||0xc8;return function(_0x2a2bd6){if(_0x2a2bd6){return _0x224fd1['status'](_0x310240)['json'](_0x2a2bd6);}};}function respondWithFilteredResult(_0x51a6b1,_0x253e48){return function(_0x239c06){if(_0x239c06){var _0x522025=typeof _0x253e48[_0x1722('0x1e')]==='undefined'&&typeof _0x253e48[_0x1722('0x1f')]==='undefined';var _0x4b135c=_0x239c06['count'];var _0x19a119=_0x522025?0x0:_0x253e48[_0x1722('0x1e')];var _0x21f124=_0x522025?_0x239c06['count']:_0x253e48[_0x1722('0x1e')]+_0x253e48[_0x1722('0x1f')];var _0xab5ac5;if(_0x21f124>=_0x4b135c){_0x21f124=_0x4b135c;_0xab5ac5=0xc8;}else{_0xab5ac5=0xce;}_0x51a6b1[_0x1722('0x1c')](_0xab5ac5);return _0x51a6b1[_0x1722('0x20')](_0x1722('0x21'),_0x19a119+'-'+_0x21f124+'/'+_0x4b135c)['json'](_0x239c06);}return null;};}function patchUpdates(_0x11121f){return function(_0x2b85e9){try{jsonpatch['apply'](_0x2b85e9,_0x11121f,!![]);}catch(_0x5d0aa8){return BPromise[_0x1722('0x22')](_0x5d0aa8);}return _0x2b85e9['save']();};}function saveUpdates(_0x272bb1,_0x173b9a){return function(_0x86e880){if(_0x86e880){return _0x86e880[_0x1722('0x23')](_0x272bb1)[_0x1722('0x24')](function(_0xcc0c86){return _0xcc0c86;});}return null;};}function removeEntity(_0x1fad1f,_0x604ae8){return function(_0x1e7954){if(_0x1e7954){return _0x1e7954[_0x1722('0x25')]()['then'](function(){var _0x269af9=_0x1e7954[_0x1722('0x26')]({'plain':!![]});var _0x5e7224='Triggers';return db[_0x1722('0x27')][_0x1722('0x25')]({'where':{'type':_0x5e7224,'resourceId':_0x269af9['id']}})[_0x1722('0x24')](function(){return _0x1e7954;});})[_0x1722('0x24')](function(){_0x1fad1f['status'](0xcc)[_0x1722('0x1d')]();});}};}function handleEntityNotFound(_0xb4d8f2,_0x203162){return function(_0x55eece){if(!_0x55eece){_0xb4d8f2[_0x1722('0x1b')](0x194);}return _0x55eece;};}function handleError(_0x5dd8ee,_0x487447){_0x487447=_0x487447||0x1f4;return function(_0x1db441){logger[_0x1722('0x28')](_0x1db441[_0x1722('0x29')]);if(_0x1db441[_0x1722('0x2a')]){delete _0x1db441[_0x1722('0x2a')];}_0x5dd8ee[_0x1722('0x1c')](_0x487447)['send'](_0x1db441);};}exports[_0x1722('0x2b')]=function(_0x201380,_0x114c21){var _0x3b9e57={},_0x3eb39d={},_0x2e8a71={'count':0x0,'rows':[]};var _0x53f301=_[_0x1722('0x2c')](db['Trigger'][_0x1722('0x2d')],function(_0x1e17fb){return{'name':_0x1e17fb['fieldName'],'type':_0x1e17fb[_0x1722('0x2e')]['key']};});_0x3eb39d['model']=_[_0x1722('0x2c')](_0x53f301,'name');_0x3eb39d['query']=_[_0x1722('0x2f')](_0x201380[_0x1722('0x30')]);_0x3eb39d[_0x1722('0x31')]=_[_0x1722('0x32')](_0x3eb39d[_0x1722('0x33')],_0x3eb39d['query']);_0x3b9e57['attributes']=_[_0x1722('0x32')](_0x3eb39d[_0x1722('0x33')],qs[_0x1722('0x34')](_0x201380[_0x1722('0x30')][_0x1722('0x34')]));_0x3b9e57[_0x1722('0x35')]=_0x3b9e57[_0x1722('0x35')][_0x1722('0x36')]?_0x3b9e57[_0x1722('0x35')]:_0x3eb39d['model'];if(!_0x201380[_0x1722('0x30')][_0x1722('0x37')]('nolimit')){_0x3b9e57[_0x1722('0x1f')]=qs[_0x1722('0x1f')](_0x201380['query'][_0x1722('0x1f')]);_0x3b9e57['offset']=qs[_0x1722('0x1e')](_0x201380[_0x1722('0x30')]['offset']);}_0x3b9e57['order']=qs[_0x1722('0x38')](_0x201380[_0x1722('0x30')][_0x1722('0x38')]);_0x3b9e57['where']=qs[_0x1722('0x31')](_[_0x1722('0x39')](_0x201380[_0x1722('0x30')],_0x3eb39d[_0x1722('0x31')]),_0x53f301);if(_0x201380[_0x1722('0x30')]['filter']){_0x3b9e57['where']=_[_0x1722('0x3a')](_0x3b9e57[_0x1722('0x3b')],{'$or':_[_0x1722('0x2c')](_0x53f301,function(_0x189533){if(_0x189533[_0x1722('0x2e')]!==_0x1722('0x3c')){var _0x14e1f4={};_0x14e1f4[_0x189533[_0x1722('0x2a')]]={'$like':'%'+_0x201380[_0x1722('0x30')][_0x1722('0x3d')]+'%'};return _0x14e1f4;}})});}_0x3b9e57=_[_0x1722('0x3a')]({},_0x3b9e57,_0x201380[_0x1722('0x3e')]);var _0x49708a={'where':_0x3b9e57[_0x1722('0x3b')]};return db['Trigger'][_0x1722('0x3f')](_0x49708a)['then'](function(_0x53b4df){_0x2e8a71[_0x1722('0x3f')]=_0x53b4df;if(_0x201380[_0x1722('0x30')]['includeAll']){_0x3b9e57[_0x1722('0x40')]=[{'all':!![]}];}return db[_0x1722('0x41')]['findAll'](_0x3b9e57);})[_0x1722('0x24')](function(_0x563314){_0x2e8a71[_0x1722('0x42')]=_0x563314;return _0x2e8a71;})[_0x1722('0x24')](respondWithFilteredResult(_0x114c21,_0x3b9e57))[_0x1722('0x43')](handleError(_0x114c21,null));};exports[_0x1722('0x44')]=function(_0x537f69,_0x26cf80){var _0x375fbf={'raw':![],'where':{'id':_0x537f69[_0x1722('0x45')]['id']}},_0x39ed5a={};_0x39ed5a[_0x1722('0x33')]=_[_0x1722('0x2f')](db[_0x1722('0x41')][_0x1722('0x2d')]);_0x39ed5a[_0x1722('0x30')]=_[_0x1722('0x2f')](_0x537f69[_0x1722('0x30')]);_0x39ed5a['filters']=_[_0x1722('0x32')](_0x39ed5a['model'],_0x39ed5a[_0x1722('0x30')]);_0x375fbf[_0x1722('0x35')]=_[_0x1722('0x32')](_0x39ed5a[_0x1722('0x33')],qs[_0x1722('0x34')](_0x537f69['query'][_0x1722('0x34')]));_0x375fbf[_0x1722('0x35')]=_0x375fbf['attributes']['length']?_0x375fbf[_0x1722('0x35')]:_0x39ed5a[_0x1722('0x33')];if(_0x537f69[_0x1722('0x30')][_0x1722('0x46')]){_0x375fbf[_0x1722('0x40')]=[{'all':!![]}];}_0x375fbf=_[_0x1722('0x3a')]({},_0x375fbf,_0x537f69['options']);return db[_0x1722('0x41')][_0x1722('0x47')](_0x375fbf)[_0x1722('0x24')](handleEntityNotFound(_0x26cf80,null))[_0x1722('0x24')](respondWithResult(_0x26cf80,null))[_0x1722('0x43')](handleError(_0x26cf80,null));};exports['create']=function(_0x4f1605,_0x11f15f){return db[_0x1722('0x41')][_0x1722('0x48')](_0x4f1605['body'],{})[_0x1722('0x24')](function(_0x4ef59a){var _0x491923=_0x4f1605[_0x1722('0x49')]['get']({'plain':!![]});if(!_0x491923)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x491923['role']===_0x1722('0x49')){var _0x46f029=_0x4ef59a['get']({'plain':!![]});var _0x59ef51='Triggers';return db[_0x1722('0x4a')][_0x1722('0x47')]({'where':{'name':_0x59ef51,'userProfileId':_0x491923[_0x1722('0x4b')]},'raw':!![]})['then'](function(_0x38dcbe){if(_0x38dcbe&&_0x38dcbe[_0x1722('0x4c')]===0x0){return db[_0x1722('0x27')][_0x1722('0x48')]({'name':_0x46f029[_0x1722('0x2a')],'resourceId':_0x46f029['id'],'type':_0x38dcbe[_0x1722('0x2a')],'sectionId':_0x38dcbe['id']},{})[_0x1722('0x24')](function(){return _0x4ef59a;});}else{return _0x4ef59a;}})[_0x1722('0x43')](function(_0x30944b){logger[_0x1722('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30944b);throw _0x30944b;});}return _0x4ef59a;})[_0x1722('0x24')](respondWithResult(_0x11f15f,0xc9))[_0x1722('0x43')](handleError(_0x11f15f,null));};exports['update']=function(_0xd3c9ba,_0x46da58){if(_0xd3c9ba[_0x1722('0x4d')]['id']){delete _0xd3c9ba['body']['id'];}return db[_0x1722('0x41')][_0x1722('0x47')]({'where':{'id':_0xd3c9ba[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x46da58,null))['then'](saveUpdates(_0xd3c9ba[_0x1722('0x4d')],null))[_0x1722('0x24')](respondWithResult(_0x46da58,null))['catch'](handleError(_0x46da58,null));};exports[_0x1722('0x25')]=function(_0x44dc95,_0x5da7d5){return db[_0x1722('0x41')][_0x1722('0x47')]({'where':{'id':_0x44dc95[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x5da7d5,null))[_0x1722('0x24')](removeEntity(_0x5da7d5,null))[_0x1722('0x43')](handleError(_0x5da7d5,null));};exports[_0x1722('0x4e')]=function(_0x46f675,_0x17a657,_0x1953e1){if(_0x46f675['body']['id']){delete _0x46f675[_0x1722('0x4d')]['id'];}return db[_0x1722('0x41')][_0x1722('0x47')]({'where':{'id':_0x46f675[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x17a657,null))[_0x1722('0x24')](function(_0x4080cf){if(_0x4080cf){_0x46f675[_0x1722('0x4d')]['TriggerAllId']=_0x4080cf['id'];return db['Condition'][_0x1722('0x48')](_0x46f675[_0x1722('0x4d')]);}})[_0x1722('0x24')](respondWithResult(_0x17a657,null))[_0x1722('0x43')](handleError(_0x17a657,null));};exports['addAnyCondition']=function(_0x381346,_0x1e9a04,_0x5ea1b5){if(_0x381346[_0x1722('0x4d')]['id']){delete _0x381346[_0x1722('0x4d')]['id'];}return db[_0x1722('0x41')]['find']({'where':{'id':_0x381346[_0x1722('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e9a04,null))[_0x1722('0x24')](function(_0xed63ba){if(_0xed63ba){_0x381346[_0x1722('0x4d')][_0x1722('0x4f')]=_0xed63ba['id'];return db[_0x1722('0x50')][_0x1722('0x48')](_0x381346['body']);}})[_0x1722('0x24')](respondWithResult(_0x1e9a04,null))['catch'](handleError(_0x1e9a04,null));};exports[_0x1722('0x51')]=function(_0x5f3a9d,_0x34584a,_0x457c64){var _0x5e78ed={};var _0x4af069={};var _0x4f575e;var _0xa5dfa8;return db[_0x1722('0x41')][_0x1722('0x52')]({'where':{'id':_0x5f3a9d[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x34584a,null))[_0x1722('0x24')](function(_0x362c92){if(_0x362c92){_0x4f575e=_0x362c92;_0x4af069[_0x1722('0x33')]=_[_0x1722('0x2f')](db[_0x1722('0x50')][_0x1722('0x2d')]);_0x4af069[_0x1722('0x30')]=_[_0x1722('0x2f')](_0x5f3a9d[_0x1722('0x30')]);_0x4af069[_0x1722('0x31')]=_[_0x1722('0x32')](_0x4af069[_0x1722('0x33')],_0x4af069[_0x1722('0x30')]);_0x5e78ed[_0x1722('0x35')]=_[_0x1722('0x32')](_0x4af069[_0x1722('0x33')],qs[_0x1722('0x34')](_0x5f3a9d[_0x1722('0x30')][_0x1722('0x34')]));_0x5e78ed[_0x1722('0x35')]=_0x5e78ed[_0x1722('0x35')]['length']?_0x5e78ed[_0x1722('0x35')]:_0x4af069['model'];_0x5e78ed['order']=qs[_0x1722('0x38')](_0x5f3a9d[_0x1722('0x30')]['sort']);_0x5e78ed[_0x1722('0x3b')]=qs[_0x1722('0x31')](_[_0x1722('0x39')](_0x5f3a9d[_0x1722('0x30')],_0x4af069[_0x1722('0x31')]));if(_0x5f3a9d[_0x1722('0x30')][_0x1722('0x3d')]){_0x5e78ed['where']=_[_0x1722('0x3a')](_0x5e78ed[_0x1722('0x3b')],{'$or':_['map'](_0x5e78ed[_0x1722('0x35')],function(_0x4baecb){var _0x407d50={};_0x407d50[_0x4baecb]={'$like':'%'+_0x5f3a9d[_0x1722('0x30')]['filter']+'%'};return _0x407d50;})});}_0x5e78ed=_[_0x1722('0x3a')]({},_0x5e78ed,_0x5f3a9d['options']);return _0x4f575e[_0x1722('0x51')](_0x5e78ed);}})['then'](function(_0x27d7f0){if(_0x27d7f0){_0xa5dfa8=_0x27d7f0['length'];if(!_0x5f3a9d[_0x1722('0x30')]['hasOwnProperty'](_0x1722('0x53'))){_0x5e78ed[_0x1722('0x1f')]=qs['limit'](_0x5f3a9d[_0x1722('0x30')]['limit']);_0x5e78ed[_0x1722('0x1e')]=qs[_0x1722('0x1e')](_0x5f3a9d[_0x1722('0x30')][_0x1722('0x1e')]);}return _0x4f575e[_0x1722('0x51')](_0x5e78ed);}})[_0x1722('0x24')](function(_0x3593fe){if(_0x3593fe){return _0x3593fe?{'count':_0xa5dfa8,'rows':_0x3593fe}:null;}})[_0x1722('0x24')](respondWithResult(_0x34584a,null))[_0x1722('0x43')](handleError(_0x34584a,null));};exports[_0x1722('0x54')]=function(_0x58bb17,_0x48247e,_0x160e7b){var _0x23ee6d={};var _0x5bbd44={};var _0x51268b;var _0x3c4c90;return db[_0x1722('0x41')][_0x1722('0x52')]({'where':{'id':_0x58bb17[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x48247e,null))[_0x1722('0x24')](function(_0x157cff){if(_0x157cff){_0x51268b=_0x157cff;_0x5bbd44[_0x1722('0x33')]=_['keys'](db[_0x1722('0x50')][_0x1722('0x2d')]);_0x5bbd44[_0x1722('0x30')]=_[_0x1722('0x2f')](_0x58bb17[_0x1722('0x30')]);_0x5bbd44[_0x1722('0x31')]=_[_0x1722('0x32')](_0x5bbd44[_0x1722('0x33')],_0x5bbd44[_0x1722('0x30')]);_0x23ee6d['attributes']=_[_0x1722('0x32')](_0x5bbd44[_0x1722('0x33')],qs[_0x1722('0x34')](_0x58bb17[_0x1722('0x30')][_0x1722('0x34')]));_0x23ee6d[_0x1722('0x35')]=_0x23ee6d[_0x1722('0x35')]['length']?_0x23ee6d['attributes']:_0x5bbd44[_0x1722('0x33')];_0x23ee6d['order']=qs[_0x1722('0x38')](_0x58bb17['query'][_0x1722('0x38')]);_0x23ee6d[_0x1722('0x3b')]=qs['filters'](_[_0x1722('0x39')](_0x58bb17[_0x1722('0x30')],_0x5bbd44[_0x1722('0x31')]));if(_0x58bb17['query'][_0x1722('0x3d')]){_0x23ee6d[_0x1722('0x3b')]=_['merge'](_0x23ee6d[_0x1722('0x3b')],{'$or':_[_0x1722('0x2c')](_0x23ee6d[_0x1722('0x35')],function(_0x4e6d72){var _0x40695d={};_0x40695d[_0x4e6d72]={'$like':'%'+_0x58bb17[_0x1722('0x30')]['filter']+'%'};return _0x40695d;})});}_0x23ee6d=_['merge']({},_0x23ee6d,_0x58bb17[_0x1722('0x3e')]);return _0x51268b[_0x1722('0x54')](_0x23ee6d);}})['then'](function(_0x1435fa){if(_0x1435fa){_0x3c4c90=_0x1435fa[_0x1722('0x36')];if(!_0x58bb17[_0x1722('0x30')][_0x1722('0x37')]('nolimit')){_0x23ee6d[_0x1722('0x1f')]=qs[_0x1722('0x1f')](_0x58bb17[_0x1722('0x30')][_0x1722('0x1f')]);_0x23ee6d['offset']=qs['offset'](_0x58bb17[_0x1722('0x30')]['offset']);}return _0x51268b[_0x1722('0x54')](_0x23ee6d);}})[_0x1722('0x24')](function(_0x51e1b8){if(_0x51e1b8){return _0x51e1b8?{'count':_0x3c4c90,'rows':_0x51e1b8}:null;}})[_0x1722('0x24')](respondWithResult(_0x48247e,null))['catch'](handleError(_0x48247e,null));};exports[_0x1722('0x55')]=function(_0x3326df,_0x45d658,_0x2cb346){if(_0x3326df[_0x1722('0x4d')]['id']){delete _0x3326df[_0x1722('0x4d')]['id'];}return db[_0x1722('0x41')][_0x1722('0x47')]({'where':{'id':_0x3326df[_0x1722('0x45')]['id']}})['then'](handleEntityNotFound(_0x45d658,null))[_0x1722('0x24')](function(_0x839538){if(_0x839538){_0x3326df[_0x1722('0x4d')][_0x1722('0x56')]=_0x839538['id'];return db[_0x1722('0x57')][_0x1722('0x48')](_0x3326df[_0x1722('0x4d')]);}})['then'](respondWithResult(_0x45d658,null))[_0x1722('0x43')](handleError(_0x45d658,null));};exports['getActions']=function(_0x20caf6,_0x5cc845,_0x26240f){var _0x4b6f94={};var _0xbbea7a={};var _0x4c4da8;var _0xfff23f;return db['Trigger'][_0x1722('0x52')]({'where':{'id':_0x20caf6[_0x1722('0x45')]['id']}})[_0x1722('0x24')](handleEntityNotFound(_0x5cc845,null))[_0x1722('0x24')](function(_0x3c7bbc){if(_0x3c7bbc){_0x4c4da8=_0x3c7bbc;_0xbbea7a[_0x1722('0x33')]=_[_0x1722('0x2f')](db[_0x1722('0x57')][_0x1722('0x2d')]);_0xbbea7a[_0x1722('0x30')]=_[_0x1722('0x2f')](_0x20caf6[_0x1722('0x30')]);_0xbbea7a[_0x1722('0x31')]=_[_0x1722('0x32')](_0xbbea7a[_0x1722('0x33')],_0xbbea7a[_0x1722('0x30')]);_0x4b6f94[_0x1722('0x35')]=_['intersection'](_0xbbea7a[_0x1722('0x33')],qs[_0x1722('0x34')](_0x20caf6[_0x1722('0x30')][_0x1722('0x34')]));_0x4b6f94[_0x1722('0x35')]=_0x4b6f94[_0x1722('0x35')][_0x1722('0x36')]?_0x4b6f94[_0x1722('0x35')]:_0xbbea7a[_0x1722('0x33')];_0x4b6f94['order']=qs[_0x1722('0x38')](_0x20caf6['query'][_0x1722('0x38')]);_0x4b6f94[_0x1722('0x3b')]=qs[_0x1722('0x31')](_[_0x1722('0x39')](_0x20caf6['query'],_0xbbea7a[_0x1722('0x31')]));if(_0x20caf6[_0x1722('0x30')][_0x1722('0x3d')]){_0x4b6f94[_0x1722('0x3b')]=_[_0x1722('0x3a')](_0x4b6f94['where'],{'$or':_[_0x1722('0x2c')](_0x4b6f94['attributes'],function(_0x3d2b61){var _0x4be5b4={};_0x4be5b4[_0x3d2b61]={'$like':'%'+_0x20caf6[_0x1722('0x30')][_0x1722('0x3d')]+'%'};return _0x4be5b4;})});}_0x4b6f94=_['merge']({},_0x4b6f94,_0x20caf6[_0x1722('0x3e')]);return _0x4c4da8['getActions'](_0x4b6f94);}})[_0x1722('0x24')](function(_0x40978c){if(_0x40978c){_0xfff23f=_0x40978c[_0x1722('0x36')];if(!_0x20caf6[_0x1722('0x30')][_0x1722('0x37')]('nolimit')){_0x4b6f94['limit']=qs[_0x1722('0x1f')](_0x20caf6[_0x1722('0x30')]['limit']);_0x4b6f94[_0x1722('0x1e')]=qs['offset'](_0x20caf6[_0x1722('0x30')][_0x1722('0x1e')]);}return _0x4c4da8['getActions'](_0x4b6f94);}})['then'](function(_0x2dc60c){if(_0x2dc60c){return _0x2dc60c?{'count':_0xfff23f,'rows':_0x2dc60c}:null;}})['then'](respondWithResult(_0x5cc845,null))[_0x1722('0x43')](handleError(_0x5cc845,null));}; \ No newline at end of file +var _0x7227=['find','body','get','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','findOne','hasOwnProperty','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','Trigger','includeAll','findAll','catch','show'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7227,0x1c6));var _0x7722=function(_0x1ab20a,_0x50a80a){_0x1ab20a=_0x1ab20a-0x0;var _0x42c089=_0x7227[_0x1ab20a];return _0x42c089;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7722('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7722('0x1'));var rp=require(_0x7722('0x2'));var moment=require(_0x7722('0x3'));var BPromise=require(_0x7722('0x4'));var Mustache=require(_0x7722('0x5'));var util=require('util');var path=require(_0x7722('0x6'));var sox=require('sox');var csv=require(_0x7722('0x7'));var ejs=require(_0x7722('0x8'));var fs=require('fs');var fs_extra=require(_0x7722('0x9'));var _=require(_0x7722('0xa'));var squel=require('squel');var crypto=require(_0x7722('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7722('0xc'));var toCsv=require(_0x7722('0x7'));var querystring=require(_0x7722('0xd'));var Papa=require('papaparse');var Redis=require(_0x7722('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7722('0xf'));var as=require(_0x7722('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7722('0x11'))(_0x7722('0x12'));var utils=require('../../config/utils');var config=require(_0x7722('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7722('0x14'))['db'];function respondWithStatusCode(_0x382765,_0x31913b){_0x31913b=_0x31913b||0xcc;return function(_0x369f30){if(_0x369f30){return _0x382765[_0x7722('0x15')](_0x31913b);}return _0x382765['status'](_0x31913b)[_0x7722('0x16')]();};}function respondWithResult(_0x4fa198,_0xafc2b9){_0xafc2b9=_0xafc2b9||0xc8;return function(_0xf8cb77){if(_0xf8cb77){return _0x4fa198['status'](_0xafc2b9)[_0x7722('0x17')](_0xf8cb77);}};}function respondWithFilteredResult(_0x4da31d,_0x3de9e1){return function(_0x26f2ca){if(_0x26f2ca){var _0x1b3bbc=typeof _0x3de9e1[_0x7722('0x18')]==='undefined'&&typeof _0x3de9e1[_0x7722('0x19')]===_0x7722('0x1a');var _0x49d3e8=_0x26f2ca['count'];var _0x4fb349=_0x1b3bbc?0x0:_0x3de9e1[_0x7722('0x18')];var _0x5360c6=_0x1b3bbc?_0x26f2ca[_0x7722('0x1b')]:_0x3de9e1[_0x7722('0x18')]+_0x3de9e1[_0x7722('0x19')];var _0x3a74be;if(_0x5360c6>=_0x49d3e8){_0x5360c6=_0x49d3e8;_0x3a74be=0xc8;}else{_0x3a74be=0xce;}_0x4da31d[_0x7722('0x1c')](_0x3a74be);return _0x4da31d[_0x7722('0x1d')](_0x7722('0x1e'),_0x4fb349+'-'+_0x5360c6+'/'+_0x49d3e8)[_0x7722('0x17')](_0x26f2ca);}return null;};}function patchUpdates(_0x34c65f){return function(_0x55c7de){try{jsonpatch[_0x7722('0x1f')](_0x55c7de,_0x34c65f,!![]);}catch(_0x4991b7){return BPromise[_0x7722('0x20')](_0x4991b7);}return _0x55c7de[_0x7722('0x21')]();};}function saveUpdates(_0x55c5c6,_0x465352){return function(_0x7cc538){if(_0x7cc538){return _0x7cc538[_0x7722('0x22')](_0x55c5c6)[_0x7722('0x23')](function(_0x5c623d){return _0x5c623d;});}return null;};}function removeEntity(_0x205811,_0x335308){return function(_0x3f113e){if(_0x3f113e){return _0x3f113e['destroy']()[_0x7722('0x23')](function(){var _0x151d07=_0x3f113e['get']({'plain':!![]});var _0x45b7c9=_0x7722('0x24');return db[_0x7722('0x25')][_0x7722('0x26')]({'where':{'type':_0x45b7c9,'resourceId':_0x151d07['id']}})['then'](function(){return _0x3f113e;});})[_0x7722('0x23')](function(){_0x205811[_0x7722('0x1c')](0xcc)[_0x7722('0x16')]();});}};}function handleEntityNotFound(_0x4d719b,_0x1abfdc){return function(_0x4b544f){if(!_0x4b544f){_0x4d719b[_0x7722('0x15')](0x194);}return _0x4b544f;};}function handleError(_0x5a5bb3,_0x273ab1){_0x273ab1=_0x273ab1||0x1f4;return function(_0x110fee){logger['error'](_0x110fee['stack']);if(_0x110fee[_0x7722('0x27')]){delete _0x110fee[_0x7722('0x27')];}_0x5a5bb3['status'](_0x273ab1)[_0x7722('0x28')](_0x110fee);};}exports['index']=function(_0x2dda48,_0x257526){var _0xd80179={},_0x5621ee={},_0x25388c={'count':0x0,'rows':[]};var _0x66925=_[_0x7722('0x29')](db['Trigger'][_0x7722('0x2a')],function(_0x821bfe){return{'name':_0x821bfe[_0x7722('0x2b')],'type':_0x821bfe[_0x7722('0x2c')][_0x7722('0x2d')]};});_0x5621ee[_0x7722('0x2e')]=_[_0x7722('0x29')](_0x66925,'name');_0x5621ee[_0x7722('0x2f')]=_[_0x7722('0x30')](_0x2dda48[_0x7722('0x2f')]);_0x5621ee[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5621ee[_0x7722('0x2e')],_0x5621ee[_0x7722('0x2f')]);_0xd80179[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5621ee[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x2dda48['query']['fields']));_0xd80179[_0x7722('0x33')]=_0xd80179[_0x7722('0x33')][_0x7722('0x35')]?_0xd80179[_0x7722('0x33')]:_0x5621ee[_0x7722('0x2e')];if(!_0x2dda48[_0x7722('0x2f')]['hasOwnProperty'](_0x7722('0x36'))){_0xd80179[_0x7722('0x19')]=qs[_0x7722('0x19')](_0x2dda48[_0x7722('0x2f')][_0x7722('0x19')]);_0xd80179['offset']=qs[_0x7722('0x18')](_0x2dda48[_0x7722('0x2f')]['offset']);}_0xd80179[_0x7722('0x37')]=qs['sort'](_0x2dda48['query'][_0x7722('0x38')]);_0xd80179['where']=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x2dda48[_0x7722('0x2f')],_0x5621ee['filters']),_0x66925);if(_0x2dda48[_0x7722('0x2f')]['filter']){_0xd80179[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0xd80179[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x66925,function(_0x1f8e64){if(_0x1f8e64['type']!==_0x7722('0x3c')){var _0x93d6f6={};_0x93d6f6[_0x1f8e64[_0x7722('0x27')]]={'$like':'%'+_0x2dda48[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0x93d6f6;}})});}_0xd80179=_['merge']({},_0xd80179,_0x2dda48[_0x7722('0x3e')]);var _0x3467bc={'where':_0xd80179[_0x7722('0x3a')]};return db[_0x7722('0x3f')][_0x7722('0x1b')](_0x3467bc)[_0x7722('0x23')](function(_0xe84593){_0x25388c[_0x7722('0x1b')]=_0xe84593;if(_0x2dda48[_0x7722('0x2f')][_0x7722('0x40')]){_0xd80179['include']=[{'all':!![]}];}return db['Trigger'][_0x7722('0x41')](_0xd80179);})[_0x7722('0x23')](function(_0x4f5a2c){_0x25388c['rows']=_0x4f5a2c;return _0x25388c;})[_0x7722('0x23')](respondWithFilteredResult(_0x257526,_0xd80179))[_0x7722('0x42')](handleError(_0x257526,null));};exports[_0x7722('0x43')]=function(_0x27bf50,_0x59f45e){var _0x124b54={'raw':![],'where':{'id':_0x27bf50['params']['id']}},_0x5afe80={};_0x5afe80[_0x7722('0x2e')]=_[_0x7722('0x30')](db[_0x7722('0x3f')]['rawAttributes']);_0x5afe80['query']=_[_0x7722('0x30')](_0x27bf50[_0x7722('0x2f')]);_0x5afe80[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5afe80[_0x7722('0x2e')],_0x5afe80[_0x7722('0x2f')]);_0x124b54[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5afe80[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x27bf50[_0x7722('0x2f')][_0x7722('0x34')]));_0x124b54[_0x7722('0x33')]=_0x124b54[_0x7722('0x33')][_0x7722('0x35')]?_0x124b54['attributes']:_0x5afe80[_0x7722('0x2e')];if(_0x27bf50[_0x7722('0x2f')][_0x7722('0x40')]){_0x124b54['include']=[{'all':!![]}];}_0x124b54=_[_0x7722('0x3b')]({},_0x124b54,_0x27bf50['options']);return db[_0x7722('0x3f')][_0x7722('0x44')](_0x124b54)['then'](handleEntityNotFound(_0x59f45e,null))[_0x7722('0x23')](respondWithResult(_0x59f45e,null))[_0x7722('0x42')](handleError(_0x59f45e,null));};exports['create']=function(_0x32ffbc,_0x5b0236){return db[_0x7722('0x3f')]['create'](_0x32ffbc[_0x7722('0x45')],{})[_0x7722('0x23')](function(_0x475fcb){var _0x20ff65=_0x32ffbc['user'][_0x7722('0x46')]({'plain':!![]});if(!_0x20ff65)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20ff65['role']==='user'){var _0x85e408=_0x475fcb[_0x7722('0x46')]({'plain':!![]});var _0xb2c051='Triggers';return db['UserProfileSection'][_0x7722('0x44')]({'where':{'name':_0xb2c051,'userProfileId':_0x20ff65['userProfileId']},'raw':!![]})['then'](function(_0x10f0db){if(_0x10f0db&&_0x10f0db[_0x7722('0x47')]===0x0){return db[_0x7722('0x25')][_0x7722('0x48')]({'name':_0x85e408[_0x7722('0x27')],'resourceId':_0x85e408['id'],'type':_0x10f0db[_0x7722('0x27')],'sectionId':_0x10f0db['id']},{})[_0x7722('0x23')](function(){return _0x475fcb;});}else{return _0x475fcb;}})[_0x7722('0x42')](function(_0x3d7b89){logger[_0x7722('0x49')](_0x7722('0x4a'),_0x3d7b89);throw _0x3d7b89;});}return _0x475fcb;})[_0x7722('0x23')](respondWithResult(_0x5b0236,0xc9))[_0x7722('0x42')](handleError(_0x5b0236,null));};exports[_0x7722('0x22')]=function(_0x390f95,_0x24b80f){if(_0x390f95[_0x7722('0x45')]['id']){delete _0x390f95['body']['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x390f95[_0x7722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24b80f,null))['then'](saveUpdates(_0x390f95['body'],null))[_0x7722('0x23')](respondWithResult(_0x24b80f,null))['catch'](handleError(_0x24b80f,null));};exports['destroy']=function(_0x5800b6,_0x2cae4d){return db['Trigger'][_0x7722('0x44')]({'where':{'id':_0x5800b6['params']['id']}})['then'](handleEntityNotFound(_0x2cae4d,null))['then'](removeEntity(_0x2cae4d,null))[_0x7722('0x42')](handleError(_0x2cae4d,null));};exports['addAllCondition']=function(_0x1f37e1,_0x148de6,_0x2f3525){if(_0x1f37e1[_0x7722('0x45')]['id']){delete _0x1f37e1['body']['id'];}return db['Trigger'][_0x7722('0x44')]({'where':{'id':_0x1f37e1['params']['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x148de6,null))[_0x7722('0x23')](function(_0x3a6666){if(_0x3a6666){_0x1f37e1['body'][_0x7722('0x4c')]=_0x3a6666['id'];return db[_0x7722('0x4d')]['create'](_0x1f37e1[_0x7722('0x45')]);}})['then'](respondWithResult(_0x148de6,null))[_0x7722('0x42')](handleError(_0x148de6,null));};exports[_0x7722('0x4e')]=function(_0x23bfd6,_0x21cd8c,_0x1e9c9f){if(_0x23bfd6[_0x7722('0x45')]['id']){delete _0x23bfd6[_0x7722('0x45')]['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x23bfd6['params']['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x21cd8c,null))[_0x7722('0x23')](function(_0x1f33ed){if(_0x1f33ed){_0x23bfd6[_0x7722('0x45')]['TriggerAnyId']=_0x1f33ed['id'];return db[_0x7722('0x4d')][_0x7722('0x48')](_0x23bfd6[_0x7722('0x45')]);}})[_0x7722('0x23')](respondWithResult(_0x21cd8c,null))[_0x7722('0x42')](handleError(_0x21cd8c,null));};exports['getAllConditions']=function(_0x46833a,_0x30eb9b,_0x3fdd87){var _0x438845={};var _0x5ac8d2={};var _0x34aba8;var _0x55d4c7;return db[_0x7722('0x3f')][_0x7722('0x4f')]({'where':{'id':_0x46833a[_0x7722('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30eb9b,null))[_0x7722('0x23')](function(_0x1b5b7c){if(_0x1b5b7c){_0x34aba8=_0x1b5b7c;_0x5ac8d2['model']=_[_0x7722('0x30')](db[_0x7722('0x4d')][_0x7722('0x2a')]);_0x5ac8d2[_0x7722('0x2f')]=_['keys'](_0x46833a[_0x7722('0x2f')]);_0x5ac8d2[_0x7722('0x31')]=_[_0x7722('0x32')](_0x5ac8d2[_0x7722('0x2e')],_0x5ac8d2['query']);_0x438845[_0x7722('0x33')]=_['intersection'](_0x5ac8d2['model'],qs['fields'](_0x46833a['query'][_0x7722('0x34')]));_0x438845['attributes']=_0x438845[_0x7722('0x33')]['length']?_0x438845['attributes']:_0x5ac8d2[_0x7722('0x2e')];_0x438845[_0x7722('0x37')]=qs[_0x7722('0x38')](_0x46833a[_0x7722('0x2f')]['sort']);_0x438845[_0x7722('0x3a')]=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x46833a[_0x7722('0x2f')],_0x5ac8d2[_0x7722('0x31')]));if(_0x46833a[_0x7722('0x2f')]['filter']){_0x438845['where']=_[_0x7722('0x3b')](_0x438845[_0x7722('0x3a')],{'$or':_['map'](_0x438845[_0x7722('0x33')],function(_0x59da74){var _0x1b4902={};_0x1b4902[_0x59da74]={'$like':'%'+_0x46833a[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0x1b4902;})});}_0x438845=_[_0x7722('0x3b')]({},_0x438845,_0x46833a['options']);return _0x34aba8['getAllConditions'](_0x438845);}})[_0x7722('0x23')](function(_0x5f9101){if(_0x5f9101){_0x55d4c7=_0x5f9101[_0x7722('0x35')];if(!_0x46833a[_0x7722('0x2f')][_0x7722('0x50')](_0x7722('0x36'))){_0x438845['limit']=qs['limit'](_0x46833a[_0x7722('0x2f')][_0x7722('0x19')]);_0x438845[_0x7722('0x18')]=qs[_0x7722('0x18')](_0x46833a[_0x7722('0x2f')][_0x7722('0x18')]);}return _0x34aba8[_0x7722('0x51')](_0x438845);}})[_0x7722('0x23')](function(_0x3db9f0){if(_0x3db9f0){return _0x3db9f0?{'count':_0x55d4c7,'rows':_0x3db9f0}:null;}})[_0x7722('0x23')](respondWithResult(_0x30eb9b,null))[_0x7722('0x42')](handleError(_0x30eb9b,null));};exports[_0x7722('0x52')]=function(_0xd6e805,_0x1a9e42,_0x23c154){var _0x5220ef={};var _0x5e0601={};var _0x47e28c;var _0x2f0d24;return db['Trigger'][_0x7722('0x4f')]({'where':{'id':_0xd6e805[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x1a9e42,null))[_0x7722('0x23')](function(_0x4a799e){if(_0x4a799e){_0x47e28c=_0x4a799e;_0x5e0601[_0x7722('0x2e')]=_[_0x7722('0x30')](db[_0x7722('0x4d')][_0x7722('0x2a')]);_0x5e0601['query']=_[_0x7722('0x30')](_0xd6e805['query']);_0x5e0601[_0x7722('0x31')]=_['intersection'](_0x5e0601[_0x7722('0x2e')],_0x5e0601[_0x7722('0x2f')]);_0x5220ef[_0x7722('0x33')]=_[_0x7722('0x32')](_0x5e0601[_0x7722('0x2e')],qs[_0x7722('0x34')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x34')]));_0x5220ef[_0x7722('0x33')]=_0x5220ef['attributes'][_0x7722('0x35')]?_0x5220ef[_0x7722('0x33')]:_0x5e0601[_0x7722('0x2e')];_0x5220ef[_0x7722('0x37')]=qs[_0x7722('0x38')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x38')]);_0x5220ef[_0x7722('0x3a')]=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0xd6e805[_0x7722('0x2f')],_0x5e0601[_0x7722('0x31')]));if(_0xd6e805[_0x7722('0x2f')][_0x7722('0x3d')]){_0x5220ef[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0x5220ef[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x5220ef[_0x7722('0x33')],function(_0x23cc4f){var _0x42c544={};_0x42c544[_0x23cc4f]={'$like':'%'+_0xd6e805[_0x7722('0x2f')]['filter']+'%'};return _0x42c544;})});}_0x5220ef=_['merge']({},_0x5220ef,_0xd6e805[_0x7722('0x3e')]);return _0x47e28c[_0x7722('0x52')](_0x5220ef);}})[_0x7722('0x23')](function(_0x2b3aa2){if(_0x2b3aa2){_0x2f0d24=_0x2b3aa2[_0x7722('0x35')];if(!_0xd6e805[_0x7722('0x2f')][_0x7722('0x50')](_0x7722('0x36'))){_0x5220ef[_0x7722('0x19')]=qs['limit'](_0xd6e805[_0x7722('0x2f')][_0x7722('0x19')]);_0x5220ef[_0x7722('0x18')]=qs[_0x7722('0x18')](_0xd6e805[_0x7722('0x2f')][_0x7722('0x18')]);}return _0x47e28c[_0x7722('0x52')](_0x5220ef);}})[_0x7722('0x23')](function(_0x51630f){if(_0x51630f){return _0x51630f?{'count':_0x2f0d24,'rows':_0x51630f}:null;}})[_0x7722('0x23')](respondWithResult(_0x1a9e42,null))[_0x7722('0x42')](handleError(_0x1a9e42,null));};exports[_0x7722('0x53')]=function(_0x296c24,_0x258699,_0x1ce374){if(_0x296c24[_0x7722('0x45')]['id']){delete _0x296c24[_0x7722('0x45')]['id'];}return db[_0x7722('0x3f')][_0x7722('0x44')]({'where':{'id':_0x296c24[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x258699,null))[_0x7722('0x23')](function(_0x3709de){if(_0x3709de){_0x296c24[_0x7722('0x45')][_0x7722('0x54')]=_0x3709de['id'];return db[_0x7722('0x55')][_0x7722('0x48')](_0x296c24[_0x7722('0x45')]);}})[_0x7722('0x23')](respondWithResult(_0x258699,null))['catch'](handleError(_0x258699,null));};exports[_0x7722('0x56')]=function(_0x130c11,_0x4b90a2,_0x396619){var _0x4ed576={};var _0xb6143f={};var _0x28ef56;var _0x533956;return db[_0x7722('0x3f')][_0x7722('0x4f')]({'where':{'id':_0x130c11[_0x7722('0x4b')]['id']}})[_0x7722('0x23')](handleEntityNotFound(_0x4b90a2,null))[_0x7722('0x23')](function(_0x50ba83){if(_0x50ba83){_0x28ef56=_0x50ba83;_0xb6143f[_0x7722('0x2e')]=_[_0x7722('0x30')](db['Action']['rawAttributes']);_0xb6143f['query']=_[_0x7722('0x30')](_0x130c11[_0x7722('0x2f')]);_0xb6143f['filters']=_[_0x7722('0x32')](_0xb6143f[_0x7722('0x2e')],_0xb6143f[_0x7722('0x2f')]);_0x4ed576['attributes']=_[_0x7722('0x32')](_0xb6143f[_0x7722('0x2e')],qs[_0x7722('0x34')](_0x130c11[_0x7722('0x2f')]['fields']));_0x4ed576[_0x7722('0x33')]=_0x4ed576[_0x7722('0x33')][_0x7722('0x35')]?_0x4ed576[_0x7722('0x33')]:_0xb6143f[_0x7722('0x2e')];_0x4ed576[_0x7722('0x37')]=qs[_0x7722('0x38')](_0x130c11['query']['sort']);_0x4ed576['where']=qs[_0x7722('0x31')](_[_0x7722('0x39')](_0x130c11[_0x7722('0x2f')],_0xb6143f[_0x7722('0x31')]));if(_0x130c11[_0x7722('0x2f')]['filter']){_0x4ed576[_0x7722('0x3a')]=_[_0x7722('0x3b')](_0x4ed576[_0x7722('0x3a')],{'$or':_[_0x7722('0x29')](_0x4ed576['attributes'],function(_0x3f6027){var _0xa264a7={};_0xa264a7[_0x3f6027]={'$like':'%'+_0x130c11[_0x7722('0x2f')][_0x7722('0x3d')]+'%'};return _0xa264a7;})});}_0x4ed576=_['merge']({},_0x4ed576,_0x130c11[_0x7722('0x3e')]);return _0x28ef56['getActions'](_0x4ed576);}})[_0x7722('0x23')](function(_0x4efdb8){if(_0x4efdb8){_0x533956=_0x4efdb8[_0x7722('0x35')];if(!_0x130c11['query'][_0x7722('0x50')](_0x7722('0x36'))){_0x4ed576[_0x7722('0x19')]=qs[_0x7722('0x19')](_0x130c11['query']['limit']);_0x4ed576['offset']=qs[_0x7722('0x18')](_0x130c11['query'][_0x7722('0x18')]);}return _0x28ef56['getActions'](_0x4ed576);}})[_0x7722('0x23')](function(_0x4a5ad2){if(_0x4a5ad2){return _0x4a5ad2?{'count':_0x533956,'rows':_0x4a5ad2}:null;}})['then'](respondWithResult(_0x4b90a2,null))[_0x7722('0x42')](handleError(_0x4b90a2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a9449e5..7eaafda 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 _0x9ffd=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','Trigger','lodash','util'];(function(_0x3cdb2b,_0xbda204){var _0x3a5471=function(_0x13d007){while(--_0x13d007){_0x3cdb2b['push'](_0x3cdb2b['shift']());}};_0x3a5471(++_0xbda204);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x4a8219,_0x5474a7){_0x4a8219=_0x4a8219-0x0;var _0x3508d5=_0x9ffd[_0x4a8219];return _0x3508d5;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))(_0xd9ff('0x3'));var moment=require('moment');var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x43bc7f,_0x5d5f0d){return _0x43bc7f[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./trigger.attributes','define','Trigger'];(function(_0x1bf913,_0x1540c9){var _0x24b24b=function(_0x2b3248){while(--_0x2b3248){_0x1bf913['push'](_0x1bf913['shift']());}};_0x24b24b(++_0x1540c9);}(_0xfd2f,0x14a));var _0xffd2=function(_0x54ba7a,_0x126889){_0x54ba7a=_0x54ba7a-0x0;var _0x3011f2=_0xfd2f[_0x54ba7a];return _0x3011f2;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index bb30a12..df21e47 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 _0x5aff=['client','http','then','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','findAll','raw','options','attributes','limit','include','model','map','GetTrigger','debug','catch','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x5aff,0x128));var _0xf5af=function(_0x12163b,_0x503b3f){_0x12163b=_0x12163b-0x0;var _0x50eae3=_0x5aff[_0x12163b];return _0x50eae3;};'use strict';var _=require('lodash');var util=require(_0xf5af('0x0'));var moment=require(_0xf5af('0x1'));var BPromise=require(_0xf5af('0x2'));var rs=require(_0xf5af('0x3'));var fs=require('fs');var Redis=require(_0xf5af('0x4'));var db=require(_0xf5af('0x5'))['db'];var utils=require(_0xf5af('0x6'));var logger=require(_0xf5af('0x7'))(_0xf5af('0x8'));var config=require('../../config/environment');var jayson=require(_0xf5af('0x9'));var client=jayson[_0xf5af('0xa')][_0xf5af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57b087,_0x182a40,_0x5de0d5){return new BPromise(function(_0x5df93d,_0x4e7eac){return client['request'](_0x57b087,_0x5de0d5)[_0xf5af('0xc')](function(_0x162f39){logger['info'](_0xf5af('0xd'),_0x182a40,'request\x20sent');logger['debug'](_0xf5af('0xe'),_0x182a40,_0xf5af('0xf'),JSON[_0xf5af('0x10')](_0x162f39));if(_0x162f39['error']){if(_0x162f39[_0xf5af('0x11')][_0xf5af('0x12')]===0x1f4){logger[_0xf5af('0x11')]('Trigger,\x20%s,\x20%s',_0x182a40,_0x162f39[_0xf5af('0x11')]['message']);return _0x4e7eac(_0x162f39['error'][_0xf5af('0x13')]);}logger[_0xf5af('0x11')](_0xf5af('0xd'),_0x182a40,_0x162f39[_0xf5af('0x11')][_0xf5af('0x13')]);return _0x5df93d(_0x162f39[_0xf5af('0x11')][_0xf5af('0x13')]);}else{logger[_0xf5af('0x14')]('Trigger,\x20%s,\x20%s',_0x182a40,_0xf5af('0xf'));_0x5df93d(_0x162f39[_0xf5af('0x15')][_0xf5af('0x13')]);}})['catch'](function(_0x348b69){logger[_0xf5af('0x11')](_0xf5af('0xd'),_0x182a40,_0x348b69);_0x4e7eac(_0x348b69);});});}exports['GetTrigger']=function(_0x2c7e11){var _0xd241bd=this;return new Promise(function(_0x5ecd7c,_0x32a703){return db['Trigger'][_0xf5af('0x16')]({'raw':_0x2c7e11['options']?_0x2c7e11['options'][_0xf5af('0x17')]===undefined?!![]:![]:!![],'where':_0x2c7e11[_0xf5af('0x18')]?_0x2c7e11[_0xf5af('0x18')]['where']||null:null,'attributes':_0x2c7e11[_0xf5af('0x18')]?_0x2c7e11['options'][_0xf5af('0x19')]||null:null,'limit':_0x2c7e11[_0xf5af('0x18')]?_0x2c7e11[_0xf5af('0x18')][_0xf5af('0x1a')]||null:null,'include':_0x2c7e11[_0xf5af('0x18')]?_0x2c7e11['options'][_0xf5af('0x1b')]?_['map'](_0x2c7e11[_0xf5af('0x18')][_0xf5af('0x1b')],function(_0x24f32a){return{'model':db[_0x24f32a[_0xf5af('0x1c')]],'as':_0x24f32a['as'],'attributes':_0x24f32a['attributes'],'include':_0x24f32a[_0xf5af('0x1b')]?_[_0xf5af('0x1d')](_0x24f32a['include'],function(_0x56babe){return{'model':db[_0x56babe[_0xf5af('0x1c')]],'as':_0x56babe['as'],'attributes':_0x56babe[_0xf5af('0x19')],'include':_0x56babe[_0xf5af('0x1b')]?_[_0xf5af('0x1d')](_0x56babe[_0xf5af('0x1b')],function(_0x1f89d7){return{'model':db[_0x1f89d7[_0xf5af('0x1c')]],'as':_0x1f89d7['as'],'attributes':_0x1f89d7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x54955b){logger[_0xf5af('0x14')](_0xf5af('0x1e'),_0x2c7e11);logger[_0xf5af('0x1f')](_0xf5af('0x1e'),_0x2c7e11,JSON[_0xf5af('0x10')](_0x54955b));_0x5ecd7c(_0x54955b);})[_0xf5af('0x20')](function(_0x384c96){logger[_0xf5af('0x11')](_0xf5af('0x1e'),_0x384c96[_0xf5af('0x13')],_0x2c7e11);_0x32a703(_0xd241bd['error'](0x1f4,_0x384c96[_0xf5af('0x13')]));});});};exports[_0xf5af('0x21')]=function(_0x4f890f){var _0x2ffc5a=this;return new Promise(function(_0x39c9d3,_0x360746){return db['Trigger']['find']({'raw':_0x4f890f['options']?_0x4f890f[_0xf5af('0x18')][_0xf5af('0x17')]===undefined?!![]:![]:!![],'where':_0x4f890f[_0xf5af('0x18')]?_0x4f890f[_0xf5af('0x18')]['where']||null:null,'attributes':_0x4f890f[_0xf5af('0x18')]?_0x4f890f[_0xf5af('0x18')][_0xf5af('0x19')]||null:null,'include':_0x4f890f[_0xf5af('0x18')]?_0x4f890f['options'][_0xf5af('0x1b')]?_['map'](_0x4f890f[_0xf5af('0x18')][_0xf5af('0x1b')],function(_0x2a353d){return{'model':db[_0x2a353d[_0xf5af('0x1c')]],'as':_0x2a353d['as'],'attributes':_0x2a353d['attributes'],'include':_0x2a353d[_0xf5af('0x1b')]?_[_0xf5af('0x1d')](_0x2a353d[_0xf5af('0x1b')],function(_0x15e9eb){return{'model':db[_0x15e9eb[_0xf5af('0x1c')]],'as':_0x15e9eb['as'],'attributes':_0x15e9eb[_0xf5af('0x19')],'include':_0x15e9eb[_0xf5af('0x1b')]?_[_0xf5af('0x1d')](_0x15e9eb[_0xf5af('0x1b')],function(_0x2688ea){return{'model':db[_0x2688ea[_0xf5af('0x1c')]],'as':_0x2688ea['as'],'attributes':_0x2688ea[_0xf5af('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231ef8){logger[_0xf5af('0x14')](_0xf5af('0x21'),_0x4f890f);logger['debug']('ShowTrigger',_0x4f890f,JSON[_0xf5af('0x10')](_0x231ef8));_0x39c9d3(_0x231ef8);})[_0xf5af('0x20')](function(_0x546988){logger[_0xf5af('0x11')]('ShowTrigger',_0x546988[_0xf5af('0x13')],_0x4f890f);_0x360746(_0x2ffc5a[_0xf5af('0x11')](0x1f4,_0x546988[_0xf5af('0x13')]));});});}; \ No newline at end of file +var _0x0f27=['jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','Trigger','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5aa0a3,_0x20d59b){var _0x5689cf=function(_0xbeeeca){while(--_0xbeeeca){_0x5aa0a3['push'](_0x5aa0a3['shift']());}};_0x5689cf(++_0x20d59b);}(_0x0f27,0xaf));var _0x70f2=function(_0x4aa7b8,_0xc69b67){_0x4aa7b8=_0x4aa7b8-0x0;var _0x310986=_0x0f27[_0x4aa7b8];return _0x310986;};'use strict';var _=require(_0x70f2('0x0'));var util=require(_0x70f2('0x1'));var moment=require(_0x70f2('0x2'));var BPromise=require(_0x70f2('0x3'));var rs=require(_0x70f2('0x4'));var fs=require('fs');var Redis=require(_0x70f2('0x5'));var db=require(_0x70f2('0x6'))['db'];var utils=require(_0x70f2('0x7'));var logger=require(_0x70f2('0x8'))(_0x70f2('0x9'));var config=require('../../config/environment');var jayson=require(_0x70f2('0xa'));var client=jayson['client'][_0x70f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11dedf,_0xf81cc,_0x1df8c5){return new BPromise(function(_0x77353,_0x25c191){return client[_0x70f2('0xc')](_0x11dedf,_0x1df8c5)[_0x70f2('0xd')](function(_0x25c5bb){logger[_0x70f2('0xe')](_0x70f2('0xf'),_0xf81cc,'request\x20sent');logger[_0x70f2('0x10')](_0x70f2('0x11'),_0xf81cc,_0x70f2('0x12'),JSON[_0x70f2('0x13')](_0x25c5bb));if(_0x25c5bb[_0x70f2('0x14')]){if(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x15')]===0x1f4){logger[_0x70f2('0x14')](_0x70f2('0xf'),_0xf81cc,_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);return _0x25c191(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);}logger[_0x70f2('0x14')](_0x70f2('0xf'),_0xf81cc,_0x25c5bb['error']['message']);return _0x77353(_0x25c5bb[_0x70f2('0x14')][_0x70f2('0x16')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0xf81cc,_0x70f2('0x12'));_0x77353(_0x25c5bb['result'][_0x70f2('0x16')]);}})[_0x70f2('0x17')](function(_0x361b7f){logger['error'](_0x70f2('0xf'),_0xf81cc,_0x361b7f);_0x25c191(_0x361b7f);});});}exports['GetTrigger']=function(_0x41274e){var _0x45c719=this;return new Promise(function(_0x1bbdd8,_0x1e3125){return db['Trigger'][_0x70f2('0x18')]({'raw':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x41274e['options']?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1b')]||null:null,'attributes':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1c')]||null:null,'limit':_0x41274e['options']?_0x41274e['options'][_0x70f2('0x1d')]||null:null,'include':_0x41274e[_0x70f2('0x19')]?_0x41274e[_0x70f2('0x19')][_0x70f2('0x1e')]?_['map'](_0x41274e['options'][_0x70f2('0x1e')],function(_0x11eb83){return{'model':db[_0x11eb83[_0x70f2('0x1f')]],'as':_0x11eb83['as'],'attributes':_0x11eb83[_0x70f2('0x1c')],'include':_0x11eb83[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x11eb83[_0x70f2('0x1e')],function(_0x43b98a){return{'model':db[_0x43b98a[_0x70f2('0x1f')]],'as':_0x43b98a['as'],'attributes':_0x43b98a['attributes'],'include':_0x43b98a['include']?_[_0x70f2('0x20')](_0x43b98a[_0x70f2('0x1e')],function(_0x409368){return{'model':db[_0x409368['model']],'as':_0x409368['as'],'attributes':_0x409368['attributes']};}):[]};}):[]};}):[]:[]})[_0x70f2('0xd')](function(_0x368baf){logger[_0x70f2('0xe')](_0x70f2('0x21'),_0x41274e);logger[_0x70f2('0x10')](_0x70f2('0x21'),_0x41274e,JSON[_0x70f2('0x13')](_0x368baf));_0x1bbdd8(_0x368baf);})[_0x70f2('0x17')](function(_0x2bd691){logger['error'](_0x70f2('0x21'),_0x2bd691[_0x70f2('0x16')],_0x41274e);_0x1e3125(_0x45c719[_0x70f2('0x14')](0x1f4,_0x2bd691[_0x70f2('0x16')]));});});};exports['ShowTrigger']=function(_0x18df49){var _0x390cb8=this;return new Promise(function(_0x44a1b9,_0x2bc856){return db[_0x70f2('0x22')][_0x70f2('0x23')]({'raw':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')][_0x70f2('0x1a')]===undefined?!![]:![]:!![],'where':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')][_0x70f2('0x1b')]||null:null,'attributes':_0x18df49[_0x70f2('0x19')]?_0x18df49[_0x70f2('0x19')]['attributes']||null:null,'include':_0x18df49[_0x70f2('0x19')]?_0x18df49['options'][_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x18df49[_0x70f2('0x19')][_0x70f2('0x1e')],function(_0x449aa4){return{'model':db[_0x449aa4[_0x70f2('0x1f')]],'as':_0x449aa4['as'],'attributes':_0x449aa4[_0x70f2('0x1c')],'include':_0x449aa4[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x449aa4[_0x70f2('0x1e')],function(_0x31eaaf){return{'model':db[_0x31eaaf[_0x70f2('0x1f')]],'as':_0x31eaaf['as'],'attributes':_0x31eaaf[_0x70f2('0x1c')],'include':_0x31eaaf[_0x70f2('0x1e')]?_[_0x70f2('0x20')](_0x31eaaf[_0x70f2('0x1e')],function(_0x448ab6){return{'model':db[_0x448ab6[_0x70f2('0x1f')]],'as':_0x448ab6['as'],'attributes':_0x448ab6[_0x70f2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe6f079){logger[_0x70f2('0xe')](_0x70f2('0x24'),_0x18df49);logger[_0x70f2('0x10')](_0x70f2('0x24'),_0x18df49,JSON['stringify'](_0xe6f079));_0x44a1b9(_0xe6f079);})['catch'](function(_0x29c466){logger[_0x70f2('0x14')]('ShowTrigger',_0x29c466[_0x70f2('0x16')],_0x18df49);_0x2bc856(_0x390cb8[_0x70f2('0x14')](0x1f4,_0x29c466['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 522651c..c2700a9 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 _0x6014=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','put','update','delete','destroy','exports','multer','util'];(function(_0x40bbf0,_0x397b73){var _0x537d13=function(_0x5c038e){while(--_0x5c038e){_0x40bbf0['push'](_0x40bbf0['shift']());}};_0x537d13(++_0x397b73);}(_0x6014,0x67));var _0x4601=function(_0xe111d,_0x530bb4){_0xe111d=_0xe111d-0x0;var _0x4f8927=_0x6014[_0xe111d];return _0x4f8927;};'use strict';var multer=require(_0x4601('0x0'));var util=require(_0x4601('0x1'));var path=require(_0x4601('0x2'));var timeout=require(_0x4601('0x3'));var express=require(_0x4601('0x4'));var router=express[_0x4601('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4601('0x6'));var interaction=require(_0x4601('0x7'));var config=require(_0x4601('0x8'));var controller=require(_0x4601('0x9'));router[_0x4601('0xa')]('/',auth[_0x4601('0xb')](),controller['index']);router[_0x4601('0xa')](_0x4601('0xc'),auth['isAuthenticated'](),controller[_0x4601('0xd')]);router[_0x4601('0xe')](_0x4601('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x4601('0xe')]('/',auth[_0x4601('0xb')](),controller['create']);router[_0x4601('0x10')](_0x4601('0xc'),auth[_0x4601('0xb')](),controller[_0x4601('0x11')]);router[_0x4601('0x12')](_0x4601('0xc'),auth['isAuthenticated'](),controller[_0x4601('0x13')]);module[_0x4601('0x14')]=router; \ No newline at end of file +var _0x35c0=['/:id/clone','clone','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x35c0,0x9a));var _0x035c=function(_0x18f9e1,_0x2763b3){_0x18f9e1=_0x18f9e1-0x0;var _0x61a32d=_0x35c0[_0x18f9e1];return _0x61a32d;};'use strict';var multer=require(_0x035c('0x0'));var util=require(_0x035c('0x1'));var path=require(_0x035c('0x2'));var timeout=require(_0x035c('0x3'));var express=require(_0x035c('0x4'));var router=express[_0x035c('0x5')]();var fs_extra=require(_0x035c('0x6'));var auth=require(_0x035c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x035c('0x8'));var controller=require(_0x035c('0x9'));router[_0x035c('0xa')]('/',auth[_0x035c('0xb')](),controller[_0x035c('0xc')]);router[_0x035c('0xa')](_0x035c('0xd'),auth[_0x035c('0xb')](),controller['show']);router['post'](_0x035c('0xe'),auth['isAuthenticated'](),controller[_0x035c('0xf')]);router[_0x035c('0x10')]('/',auth[_0x035c('0xb')](),controller[_0x035c('0x11')]);router[_0x035c('0x12')](_0x035c('0xd'),auth[_0x035c('0xb')](),controller[_0x035c('0x13')]);router['delete'](_0x035c('0xd'),auth[_0x035c('0xb')](),controller['destroy']);module[_0x035c('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 175acb9..b0dbe12 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 _0xdb23=['udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','outgoing','force_rport,comedia','setDataValue','nat','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','name','ENUM','friend','user','STRING','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x144de1,_0x138d31){var _0x44eb16=function(_0x35276d){while(--_0x35276d){_0x144de1['push'](_0x144de1['shift']());}};_0x44eb16(++_0x138d31);}(_0xdb23,0x1b6));var _0x3db2=function(_0x2d66fa,_0x479947){_0x2d66fa=_0x2d66fa-0x0;var _0x321a6e=_0xdb23[_0x2d66fa];return _0x321a6e;};'use strict';var Sequelize=require(_0x3db2('0x0'));module[_0x3db2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3db2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x4'),_0x3db2('0x5'),'peer'),'allowNull':![],'defaultValue':_0x3db2('0x4')},'context':{'type':Sequelize[_0x3db2('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3db2('0x3')]('ALLOWED_NOT_SCREENED',_0x3db2('0x7'),_0x3db2('0x8'),_0x3db2('0x9'),_0x3db2('0xa'),_0x3db2('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x3db2('0x6')]},'permit':{'type':Sequelize[_0x3db2('0x6')]},'secret':{'type':Sequelize[_0x3db2('0x6')]},'md5secret':{'type':Sequelize[_0x3db2('0x6')]},'remotesecret':{'type':Sequelize[_0x3db2('0x6')]},'transport':{'type':Sequelize[_0x3db2('0x6')],'defaultValue':_0x3db2('0xc'),'set':function(_0x393fc3){this['setDataValue']('transport',_0x393fc3?_0x393fc3['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x3db2('0xd')](_0x3db2('0xe'))[_0x3db2('0xf')](','):null;},'comment':_0x3db2('0x10')},'dtmfmode':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x11'),_0x3db2('0x12'),_0x3db2('0x13'),'inband',_0x3db2('0x14')),'defaultValue':_0x3db2('0x11')},'directmedia':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no','nonat',_0x3db2('0x16'),_0x3db2('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3db2('0x6')]},'directmediadeny':{'type':Sequelize[_0x3db2('0x6')]},'nat':{'type':Sequelize[_0x3db2('0x6')],'defaultValue':_0x3db2('0x18'),'set':function(_0x7e94e3){this[_0x3db2('0x19')](_0x3db2('0x1a'),_0x7e94e3?_0x7e94e3[_0x3db2('0x1b')](','):null);},'get':function(){return this[_0x3db2('0xd')](_0x3db2('0x1a'))?this['getDataValue'](_0x3db2('0x1a'))[_0x3db2('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3db2('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3db2('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x3db2('0x6')]},'language':{'type':Sequelize[_0x3db2('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3db2('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3db2('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3db2('0x6')],'allowNull':![],'defaultValue':_0x3db2('0x1c'),'set':function(_0x51f036){this['setDataValue'](_0x3db2('0x1d'),_0x51f036?_0x51f036['join'](';'):_0x3db2('0x1c'));},'get':function(){return this[_0x3db2('0xd')](_0x3db2('0x1d'))?this['getDataValue'](_0x3db2('0x1d'))[_0x3db2('0xf')](';'):null;},'comment':_0x3db2('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x3db2('0x15'),'no')},'insecure':{'type':Sequelize[_0x3db2('0x6')],'defaultValue':_0x3db2('0x1f'),'set':function(_0x1f4cf4){this[_0x3db2('0x19')](_0x3db2('0x20'),_0x1f4cf4?_0x1f4cf4[_0x3db2('0x1b')](','):null);},'get':function(){return this[_0x3db2('0xd')](_0x3db2('0x20'))?this['getDataValue']('insecure')[_0x3db2('0xf')](','):null;},'comment':_0x3db2('0x21')},'trustrpid':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3db2('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3db2('0x3')]('yes','no',_0x3db2('0x22'))},'promiscredir':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3db2('0x15'),'no')},'accountcode':{'type':Sequelize[_0x3db2('0x23')](0xb)},'setvar':{'type':Sequelize[_0x3db2('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3db2('0x24')},'amaflags':{'type':Sequelize[_0x3db2('0x6')]},'callcounter':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3db2('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x3db2('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no',_0x3db2('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x26'),'refuse',_0x3db2('0x27'))},'session_expires':{'type':Sequelize[_0x3db2('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x3db2('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x28'),_0x3db2('0x29')),'defaultValue':_0x3db2('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x3db2('0x6')]},'regexten':{'type':Sequelize[_0x3db2('0x6')]},'fromdomain':{'type':Sequelize[_0x3db2('0x6')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3db2('0x23')](0x5)},'qualify':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no'),'defaultValue':_0x3db2('0x15')},'keepalive':{'type':Sequelize[_0x3db2('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3db2('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3db2('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no',_0x3db2('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x3db2('0x6')]},'timert1':{'type':Sequelize[_0x3db2('0x23')](0xb)},'timerb':{'type':Sequelize[_0x3db2('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3db2('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x3db2('0x6')]},'contactdeny':{'type':Sequelize[_0x3db2('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x3db2('0x6')]},'use_q850_reason':{'type':Sequelize[_0x3db2('0x6')]},'maxforwards':{'type':Sequelize[_0x3db2('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x3db2('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'force_avp':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'icesupport':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no',_0x3db2('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3db2('0x6')]},'dtlscipher':{'type':Sequelize[_0x3db2('0x6')]},'dtlscafile':{'type':Sequelize[_0x3db2('0x6')]},'dtlscapath':{'type':Sequelize[_0x3db2('0x6')]},'dtlssetup':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x2c'),_0x3db2('0x2d'),_0x3db2('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x3db2('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3db2('0x6')]},'recordofffeature':{'type':Sequelize[_0x3db2('0x6')]},'call_limit':{'type':Sequelize[_0x3db2('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3db2('0x3')](_0x3db2('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x3db2('0x6')]},'mohinterpret':{'type':Sequelize[_0x3db2('0x6')]},'mohsuggest':{'type':Sequelize[_0x3db2('0x6')]},'parkinglot':{'type':Sequelize[_0x3db2('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x3db2('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x3db2('0x15'),'no',_0x3db2('0x30'),_0x3db2('0x16'),_0x3db2('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3db2('0x6')]},'otherFields':{'type':Sequelize[_0x3db2('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x9b24=['name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','setDataValue','join','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','INTEGER','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','nonat','BOOLEAN','exports'];(function(_0x3c80c3,_0x40e427){var _0x5ce977=function(_0x3c355b){while(--_0x3c355b){_0x3c80c3['push'](_0x3c80c3['shift']());}};_0x5ce977(++_0x40e427);}(_0x9b24,0x92));var _0x49b2=function(_0x36dfa0,_0x4d87d){_0x36dfa0=_0x36dfa0-0x0;var _0x3796c7=_0x9b24[_0x36dfa0];return _0x3796c7;};'use strict';var Sequelize=require('sequelize');module[_0x49b2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x49b2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x3'),'user',_0x49b2('0x4')),'allowNull':![],'defaultValue':_0x49b2('0x3')},'context':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':_0x49b2('0x6')},'callingpres':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x7'),_0x49b2('0x8'),'ALLOWED_FAILED_SCREEN',_0x49b2('0x9'),_0x49b2('0xa'),_0x49b2('0xb'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x49b2('0x5')]},'md5secret':{'type':Sequelize[_0x49b2('0x5')]},'remotesecret':{'type':Sequelize[_0x49b2('0x5')]},'transport':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0xc'),'set':function(_0x429dfa){this[_0x49b2('0xd')]('transport',_0x429dfa?_0x429dfa[_0x49b2('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x49b2('0xf'))?this[_0x49b2('0x10')](_0x49b2('0xf'))['split'](','):null;},'comment':_0x49b2('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x49b2('0x12'),_0x49b2('0x13'),_0x49b2('0x14'),_0x49b2('0x15'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no','nonat',_0x49b2('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49b2('0x5')]},'directmediadeny':{'type':Sequelize[_0x49b2('0x5')]},'nat':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x18'),'set':function(_0x331e3f){this[_0x49b2('0xd')](_0x49b2('0x19'),_0x331e3f?_0x331e3f[_0x49b2('0xe')](','):null);},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x19'))?this[_0x49b2('0x10')](_0x49b2('0x19'))[_0x49b2('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49b2('0x5')]},'namedcallgroup':{'type':Sequelize[_0x49b2('0x5')]},'pickupgroup':{'type':Sequelize[_0x49b2('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x49b2('0x5')]},'language':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49b2('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x1b')},'allow':{'type':Sequelize[_0x49b2('0x5')],'allowNull':![],'defaultValue':_0x49b2('0x1c'),'set':function(_0x167854){this[_0x49b2('0xd')]('allow',_0x167854?_0x167854[_0x49b2('0xe')](';'):_0x49b2('0x1c'));},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x1d'))?this[_0x49b2('0x10')](_0x49b2('0x1d'))[_0x49b2('0x1a')](';'):null;},'comment':_0x49b2('0x1e')},'autoframing':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x7122d8){this['setDataValue'](_0x49b2('0x1f'),_0x7122d8?_0x7122d8[_0x49b2('0xe')](','):null);},'get':function(){return this[_0x49b2('0x10')](_0x49b2('0x1f'))?this[_0x49b2('0x10')](_0x49b2('0x1f'))['split'](','):null;},'comment':_0x49b2('0x20')},'trustrpid':{'type':Sequelize[_0x49b2('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no',_0x49b2('0x21'))},'promiscredir':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x22')},'amaflags':{'type':Sequelize[_0x49b2('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x49b2('0x5')]},'template':{'type':Sequelize[_0x49b2('0x5')]},'videosupport':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'mailbox':{'type':Sequelize[_0x49b2('0x5')]},'session_timers':{'type':Sequelize['ENUM'](_0x49b2('0x23'),_0x49b2('0x24'),_0x49b2('0x25'))},'session_expires':{'type':Sequelize[_0x49b2('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x27'),_0x49b2('0x28')),'defaultValue':_0x49b2('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x49b2('0x5')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x49b2('0x5')]},'port':{'type':Sequelize[_0x49b2('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':_0x49b2('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x49b2('0x5')]},'defaultuser':{'type':Sequelize[_0x49b2('0x5')]},'rtptimeout':{'type':Sequelize[_0x49b2('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x49b2('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49b2('0x5')]},'callbackextension':{'type':Sequelize[_0x49b2('0x5')]},'timert1':{'type':Sequelize[_0x49b2('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x49b2('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x49b2('0x5')]},'contactacl':{'type':Sequelize[_0x49b2('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x49b2('0x5')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x49b2('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x49b2('0x16'),'no')},'icesupport':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no',_0x49b2('0x29'),_0x49b2('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x49b2('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x49b2('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x49b2('0x5')]},'dtlscipher':{'type':Sequelize[_0x49b2('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x2b'),_0x49b2('0x2c'),_0x49b2('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49b2('0x5')]},'usereqphone':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49b2('0x5')]},'recordofffeature':{'type':Sequelize[_0x49b2('0x5')]},'call_limit':{'type':Sequelize[_0x49b2('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x49b2('0x2')](_0x49b2('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x49b2('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x49b2('0x5')]},'mohinterpret':{'type':Sequelize[_0x49b2('0x5')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x49b2('0x5')],'defaultValue':_0x49b2('0x2e')},'canreinvite':{'type':Sequelize[_0x49b2('0x2')]('yes','no',_0x49b2('0x2f'),_0x49b2('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x49b2('0x5')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x49b2('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x49b2('0x5')],'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 ce7dcc1..ed9dc57 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 _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x3943dc,_0x1102ef){var _0x11ca14=function(_0x29d415){while(--_0x29d415){_0x3943dc['push'](_0x3943dc['shift']());}};_0x11ca14(++_0x1102ef);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x4a247a,_0x3cddab){var _0x224805=function(_0x55f64e){while(--_0x55f64e){_0x4a247a['push'](_0x4a247a['shift']());}};_0x224805(++_0x3cddab);}(_0xe14d,0x1ee));var _0xde14=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe14d[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ee08f78..571c415 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 _0x142e=['api','moment','bluebird','request-promise','path','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger'];(function(_0x5165a5,_0x260f53){var _0x43e5fd=function(_0x2b4959){while(--_0x2b4959){_0x5165a5['push'](_0x5165a5['shift']());}};_0x43e5fd(++_0x260f53);}(_0x142e,0x17d));var _0xe142=function(_0x39e098,_0x5332cf){_0x39e098=_0x39e098-0x0;var _0x364d0f=_0x142e[_0x39e098];return _0x364d0f;};'use strict';var _=require(_0xe142('0x0'));var util=require(_0xe142('0x1'));var logger=require(_0xe142('0x2'))(_0xe142('0x3'));var moment=require(_0xe142('0x4'));var BPromise=require(_0xe142('0x5'));var rp=require(_0xe142('0x6'));var fs=require('fs');var path=require(_0xe142('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe142('0x8'));module[_0xe142('0x9')]=function(_0x50cd2a,_0x3bbe0f){return _0x50cd2a[_0xe142('0xa')](_0xe142('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e4=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xe8d47b,_0x81283f){var _0x392563=function(_0x362728){while(--_0x362728){_0xe8d47b['push'](_0xe8d47b['shift']());}};_0x392563(++_0x81283f);}(_0xe1e4,0x185));var _0x4e1e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe1e4[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4e1e('0x0'));var util=require(_0x4e1e('0x1'));var logger=require(_0x4e1e('0x2'))(_0x4e1e('0x3'));var moment=require(_0x4e1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x4e1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e1e('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e1e('0x7'));module[_0x4e1e('0x8')]=function(_0x5e09ac,_0x412397){return _0x5e09ac[_0x4e1e('0x9')](_0x4e1e('0xa'),attributes,{'tableName':_0x4e1e('0xb'),'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 94bade5..fa61d07 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 _0x38e3=['jayson/promise','client','request','then','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','info','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1eeb7a,_0x5d531c){var _0x2b6fc7=function(_0x5a940){while(--_0x5a940){_0x1eeb7a['push'](_0x1eeb7a['shift']());}};_0x2b6fc7(++_0x5d531c);}(_0x38e3,0x142));var _0x338e=function(_0x12f4d5,_0xd944df){_0x12f4d5=_0x12f4d5-0x0;var _0x3446b8=_0x38e3[_0x12f4d5];return _0x3446b8;};'use strict';var _=require(_0x338e('0x0'));var util=require(_0x338e('0x1'));var moment=require(_0x338e('0x2'));var BPromise=require(_0x338e('0x3'));var rs=require(_0x338e('0x4'));var fs=require('fs');var Redis=require(_0x338e('0x5'));var db=require(_0x338e('0x6'))['db'];var utils=require(_0x338e('0x7'));var logger=require(_0x338e('0x8'))(_0x338e('0x9'));var config=require(_0x338e('0xa'));var jayson=require(_0x338e('0xb'));var client=jayson[_0x338e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387432,_0xefd5f6,_0x12799f){return new BPromise(function(_0x3fd859,_0x2f2d51){return client[_0x338e('0xd')](_0x387432,_0x12799f)[_0x338e('0xe')](function(_0xd6a8a1){logger['info']('Trunk,\x20%s,\x20%s',_0xefd5f6,'request\x20sent');logger[_0x338e('0xf')](_0x338e('0x10'),_0xefd5f6,_0x338e('0x11'),JSON[_0x338e('0x12')](_0xd6a8a1));if(_0xd6a8a1[_0x338e('0x13')]){if(_0xd6a8a1['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0xefd5f6,_0xd6a8a1[_0x338e('0x13')]['message']);return _0x2f2d51(_0xd6a8a1[_0x338e('0x13')]['message']);}logger['error'](_0x338e('0x14'),_0xefd5f6,_0xd6a8a1[_0x338e('0x13')]['message']);return _0x3fd859(_0xd6a8a1['error'][_0x338e('0x15')]);}else{logger[_0x338e('0x16')]('Trunk,\x20%s,\x20%s',_0xefd5f6,'request\x20sent');_0x3fd859(_0xd6a8a1['result'][_0x338e('0x15')]);}})[_0x338e('0x17')](function(_0x966939){logger['error']('Trunk,\x20%s,\x20%s',_0xefd5f6,_0x966939);_0x2f2d51(_0x966939);});});}exports[_0x338e('0x18')]=function(_0x5cfe70){var _0x328d7d=this;return new Promise(function(_0x3c58d9,_0x5b458c){return db[_0x338e('0x19')][_0x338e('0x1a')]({'raw':_0x5cfe70[_0x338e('0x1b')]?_0x5cfe70[_0x338e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5cfe70['options']?_0x5cfe70[_0x338e('0x1b')][_0x338e('0x1c')]||null:null,'attributes':_0x5cfe70[_0x338e('0x1b')]?_0x5cfe70[_0x338e('0x1b')][_0x338e('0x1d')]||null:null,'limit':_0x5cfe70[_0x338e('0x1b')]?_0x5cfe70[_0x338e('0x1b')][_0x338e('0x1e')]||null:null,'include':_0x5cfe70[_0x338e('0x1b')]?_0x5cfe70[_0x338e('0x1b')][_0x338e('0x1f')]?_['map'](_0x5cfe70[_0x338e('0x1b')][_0x338e('0x1f')],function(_0x41292f){return{'model':db[_0x41292f[_0x338e('0x20')]],'as':_0x41292f['as'],'attributes':_0x41292f[_0x338e('0x1d')],'include':_0x41292f[_0x338e('0x1f')]?_[_0x338e('0x21')](_0x41292f['include'],function(_0x1ddd2b){return{'model':db[_0x1ddd2b['model']],'as':_0x1ddd2b['as'],'attributes':_0x1ddd2b[_0x338e('0x1d')],'include':_0x1ddd2b['include']?_['map'](_0x1ddd2b[_0x338e('0x1f')],function(_0xf8eb8d){return{'model':db[_0xf8eb8d[_0x338e('0x20')]],'as':_0xf8eb8d['as'],'attributes':_0xf8eb8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x338e('0xe')](function(_0x162743){logger[_0x338e('0x16')](_0x338e('0x18'),_0x5cfe70);logger[_0x338e('0xf')](_0x338e('0x18'),_0x5cfe70,JSON[_0x338e('0x12')](_0x162743));_0x3c58d9(_0x162743);})['catch'](function(_0x42893a){logger['error']('GetTrunk',_0x42893a['message'],_0x5cfe70);_0x5b458c(_0x328d7d['error'](0x1f4,_0x42893a[_0x338e('0x15')]));});});};exports['ShowTrunk']=function(_0x4be3e9){var _0x2022f5=this;return new Promise(function(_0x535e28,_0x160e40){return db[_0x338e('0x19')][_0x338e('0x22')]({'raw':_0x4be3e9[_0x338e('0x1b')]?_0x4be3e9[_0x338e('0x1b')][_0x338e('0x23')]===undefined?!![]:![]:!![],'where':_0x4be3e9[_0x338e('0x1b')]?_0x4be3e9[_0x338e('0x1b')][_0x338e('0x1c')]||null:null,'attributes':_0x4be3e9[_0x338e('0x1b')]?_0x4be3e9[_0x338e('0x1b')]['attributes']||null:null,'include':_0x4be3e9[_0x338e('0x1b')]?_0x4be3e9[_0x338e('0x1b')][_0x338e('0x1f')]?_[_0x338e('0x21')](_0x4be3e9[_0x338e('0x1b')][_0x338e('0x1f')],function(_0x19b9bd){return{'model':db[_0x19b9bd[_0x338e('0x20')]],'as':_0x19b9bd['as'],'attributes':_0x19b9bd[_0x338e('0x1d')],'include':_0x19b9bd['include']?_['map'](_0x19b9bd[_0x338e('0x1f')],function(_0x124f90){return{'model':db[_0x124f90[_0x338e('0x20')]],'as':_0x124f90['as'],'attributes':_0x124f90['attributes'],'include':_0x124f90['include']?_[_0x338e('0x21')](_0x124f90['include'],function(_0x2467ad){return{'model':db[_0x2467ad['model']],'as':_0x2467ad['as'],'attributes':_0x2467ad[_0x338e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x338e('0xe')](function(_0xf79986){logger[_0x338e('0x16')](_0x338e('0x24'),_0x4be3e9);logger['debug']('ShowTrunk',_0x4be3e9,JSON['stringify'](_0xf79986));_0x535e28(_0xf79986);})[_0x338e('0x17')](function(_0x5358d5){logger[_0x338e('0x13')](_0x338e('0x24'),_0x5358d5[_0x338e('0x15')],_0x4be3e9);_0x160e40(_0x2022f5[_0x338e('0x13')](0x1f4,_0x5358d5[_0x338e('0x15')]));});});}; \ No newline at end of file +var _0xd358=['error','code','message','result','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c31b0,_0x41057e){var _0x32d1ef=function(_0x394dc0){while(--_0x394dc0){_0x4c31b0['push'](_0x4c31b0['shift']());}};_0x32d1ef(++_0x41057e);}(_0xd358,0xd0));var _0x8d35=function(_0x3dc26,_0x4bc827){_0x3dc26=_0x3dc26-0x0;var _0x286075=_0xd358[_0x3dc26];return _0x286075;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var moment=require(_0x8d35('0x2'));var BPromise=require(_0x8d35('0x3'));var rs=require(_0x8d35('0x4'));var fs=require('fs');var Redis=require(_0x8d35('0x5'));var db=require(_0x8d35('0x6'))['db'];var utils=require(_0x8d35('0x7'));var logger=require(_0x8d35('0x8'))('rpc');var config=require(_0x8d35('0x9'));var jayson=require(_0x8d35('0xa'));var client=jayson[_0x8d35('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8687e7,_0x361812,_0x4fdcdb){return new BPromise(function(_0xadc353,_0x25add0){return client[_0x8d35('0xc')](_0x8687e7,_0x4fdcdb)[_0x8d35('0xd')](function(_0x8c9e9a){logger[_0x8d35('0xe')](_0x8d35('0xf'),_0x361812,'request\x20sent');logger[_0x8d35('0x10')](_0x8d35('0x11'),_0x361812,_0x8d35('0x12'),JSON[_0x8d35('0x13')](_0x8c9e9a));if(_0x8c9e9a[_0x8d35('0x14')]){if(_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x15')]===0x1f4){logger['error'](_0x8d35('0xf'),_0x361812,_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x16')]);return _0x25add0(_0x8c9e9a['error'][_0x8d35('0x16')]);}logger[_0x8d35('0x14')](_0x8d35('0xf'),_0x361812,_0x8c9e9a[_0x8d35('0x14')][_0x8d35('0x16')]);return _0xadc353(_0x8c9e9a[_0x8d35('0x14')]['message']);}else{logger['info'](_0x8d35('0xf'),_0x361812,_0x8d35('0x12'));_0xadc353(_0x8c9e9a[_0x8d35('0x17')][_0x8d35('0x16')]);}})['catch'](function(_0x2aee8c){logger[_0x8d35('0x14')](_0x8d35('0xf'),_0x361812,_0x2aee8c);_0x25add0(_0x2aee8c);});});}exports[_0x8d35('0x18')]=function(_0xc26b08){var _0x33bd14=this;return new Promise(function(_0x5545c8,_0x1790d1){return db[_0x8d35('0x19')][_0x8d35('0x1a')]({'raw':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc26b08['options']?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1c')]||null:null,'attributes':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1d')]||null:null,'limit':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08[_0x8d35('0x1b')][_0x8d35('0x1e')]||null:null,'include':_0xc26b08[_0x8d35('0x1b')]?_0xc26b08['options'][_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0xc26b08['options'][_0x8d35('0x1f')],function(_0x350052){return{'model':db[_0x350052['model']],'as':_0x350052['as'],'attributes':_0x350052[_0x8d35('0x1d')],'include':_0x350052['include']?_['map'](_0x350052[_0x8d35('0x1f')],function(_0x4d8379){return{'model':db[_0x4d8379['model']],'as':_0x4d8379['as'],'attributes':_0x4d8379[_0x8d35('0x1d')],'include':_0x4d8379[_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x4d8379[_0x8d35('0x1f')],function(_0x41148d){return{'model':db[_0x41148d[_0x8d35('0x21')]],'as':_0x41148d['as'],'attributes':_0x41148d[_0x8d35('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29c90b){logger[_0x8d35('0xe')](_0x8d35('0x18'),_0xc26b08);logger[_0x8d35('0x10')]('GetTrunk',_0xc26b08,JSON[_0x8d35('0x13')](_0x29c90b));_0x5545c8(_0x29c90b);})[_0x8d35('0x22')](function(_0x328878){logger[_0x8d35('0x14')](_0x8d35('0x18'),_0x328878[_0x8d35('0x16')],_0xc26b08);_0x1790d1(_0x33bd14['error'](0x1f4,_0x328878[_0x8d35('0x16')]));});});};exports['ShowTrunk']=function(_0x407502){var _0x3ff522=this;return new Promise(function(_0x2b76cd,_0x4ea885){return db[_0x8d35('0x19')][_0x8d35('0x23')]({'raw':_0x407502['options']?_0x407502['options'][_0x8d35('0x24')]===undefined?!![]:![]:!![],'where':_0x407502[_0x8d35('0x1b')]?_0x407502['options']['where']||null:null,'attributes':_0x407502[_0x8d35('0x1b')]?_0x407502[_0x8d35('0x1b')]['attributes']||null:null,'include':_0x407502[_0x8d35('0x1b')]?_0x407502[_0x8d35('0x1b')][_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x407502[_0x8d35('0x1b')][_0x8d35('0x1f')],function(_0x3562e7){return{'model':db[_0x3562e7['model']],'as':_0x3562e7['as'],'attributes':_0x3562e7['attributes'],'include':_0x3562e7['include']?_[_0x8d35('0x20')](_0x3562e7['include'],function(_0x4d5319){return{'model':db[_0x4d5319['model']],'as':_0x4d5319['as'],'attributes':_0x4d5319[_0x8d35('0x1d')],'include':_0x4d5319[_0x8d35('0x1f')]?_[_0x8d35('0x20')](_0x4d5319[_0x8d35('0x1f')],function(_0x53b3b9){return{'model':db[_0x53b3b9['model']],'as':_0x53b3b9['as'],'attributes':_0x53b3b9[_0x8d35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8d35('0xd')](function(_0x1aa76b){logger[_0x8d35('0xe')](_0x8d35('0x25'),_0x407502);logger[_0x8d35('0x10')]('ShowTrunk',_0x407502,JSON[_0x8d35('0x13')](_0x1aa76b));_0x2b76cd(_0x1aa76b);})[_0x8d35('0x22')](function(_0x348767){logger[_0x8d35('0x14')]('ShowTrunk',_0x348767['message'],_0x407502);_0x4ea885(_0x3ff522[_0x8d35('0x14')](0x1f4,_0x348767[_0x8d35('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f510e57..0751d9e 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ebe=['isAuthenticated','update','exports','express','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x4e6ef9,_0x22a04e){var _0x331c37=function(_0x3d2811){while(--_0x3d2811){_0x4e6ef9['push'](_0x4e6ef9['shift']());}};_0x331c37(++_0x22a04e);}(_0x0ebe,0x153));var _0xe0eb=function(_0x2d6d61,_0x175988){_0x2d6d61=_0x2d6d61-0x0;var _0x533fa4=_0x0ebe[_0x2d6d61];return _0x533fa4;};'use strict';var express=require(_0xe0eb('0x0'));var router=express['Router']();var auth=require(_0xe0eb('0x1'));var controller=require(_0xe0eb('0x2'));router['put'](_0xe0eb('0x3'),auth[_0xe0eb('0x4')](),controller[_0xe0eb('0x5')]);module[_0xe0eb('0x6')]=router; \ No newline at end of file +var _0xb349=['/:id','isAuthenticated','exports','Router','../../components/auth/service','./user-setting.controller'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb349,0x99));var _0x9b34=function(_0x625a7,_0x50675d){_0x625a7=_0x625a7-0x0;var _0x42e440=_0xb349[_0x625a7];return _0x42e440;};'use strict';var express=require('express');var router=express[_0x9b34('0x0')]();var auth=require(_0x9b34('0x1'));var controller=require(_0x9b34('0x2'));router['put'](_0x9b34('0x3'),auth[_0x9b34('0x4')](),controller['update']);module[_0x9b34('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 58f2205..7e31734 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda32=['INTEGER','UserId','sequelize','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE'];(function(_0x1b14bd,_0x28ee5f){var _0x5c28d3=function(_0x37cd74){while(--_0x37cd74){_0x1b14bd['push'](_0x1b14bd['shift']());}};_0x5c28d3(++_0x28ee5f);}(_0xda32,0x142));var _0x2da3=function(_0x22eec7,_0x19447c){_0x22eec7=_0x22eec7-0x0;var _0x5b37a7=_0xda32[_0x22eec7];return _0x5b37a7;};'use strict';var Sequelize=require(_0x2da3('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x2da3('0x1'),_0x2da3('0x2')];module[_0x2da3('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2da3('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2da3('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2da3('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2da3('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2da3('0x8')],'unique':_0x2da3('0x9')}}; \ No newline at end of file +var _0x1f06=['sequelize','error','warning','info','debug','ENUM','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x32189c,_0x4fa006){var _0x8da8f1=function(_0x239113){while(--_0x239113){_0x32189c['push'](_0x32189c['shift']());}};_0x8da8f1(++_0x4fa006);}(_0x1f06,0x8c));var _0x61f0=function(_0x4399f,_0x725f78){_0x4399f=_0x4399f-0x0;var _0x5b3506=_0x1f06[_0x4399f];return _0x5b3506;};'use strict';var Sequelize=require(_0x61f0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x61f0('0x1'),_0x61f0('0x2'),_0x61f0('0x3'),_0x61f0('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x61f0('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x61f0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x61f0('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x61f0('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x61f0('0x8')],'unique':_0x61f0('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index e0ca4f8..7945eae 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ebf=['../../mysqldb','redis','./user-setting.socket','register','defaults','json','then','sendStatus','error','stack','name','send','update','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','../../config/logger','../../config/environment'];(function(_0x4b42ce,_0x2014cd){var _0x2cc426=function(_0x31698f){while(--_0x31698f){_0x4b42ce['push'](_0x4b42ce['shift']());}};_0x2cc426(++_0x2014cd);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x8ebf[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0xf8eb('0x0'));var Redis=require(_0xf8eb('0x1'));var logger=require(_0xf8eb('0x2'))('api');var config=require(_0xf8eb('0x3'));var db=require(_0xf8eb('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xf8eb('0x5')]));require(_0xf8eb('0x6'))[_0xf8eb('0x7')](socket);config['redis']=_[_0xf8eb('0x8')](config[_0xf8eb('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x30c91c,_0x2c2489){_0x2c2489=_0x2c2489||0xc8;return function(_0x2a1fb6){if(_0x2a1fb6){return _0x30c91c['status'](_0x2c2489)[_0xf8eb('0x9')](_0x2a1fb6);}};}function saveUpdates(_0x4a22d0){return function(_0x1924e7){if(_0x1924e7){return _0x1924e7['update'](_0x4a22d0)[_0xf8eb('0xa')](function(_0x17d538){return _0x17d538;});}return null;};}function handleEntityNotFound(_0x166aa1){return function(_0x4ca01b){if(!_0x4ca01b){_0x166aa1[_0xf8eb('0xb')](0x194);}return _0x4ca01b;};}function handleError(_0x2d55dd,_0x21191d){_0x21191d=_0x21191d||0x1f4;return function(_0x2a87ab){logger[_0xf8eb('0xc')](_0x2a87ab[_0xf8eb('0xd')]);if(_0x2a87ab[_0xf8eb('0xe')]){delete _0x2a87ab[_0xf8eb('0xe')];}_0x2d55dd['status'](_0x21191d)[_0xf8eb('0xf')](_0x2a87ab);};}exports[_0xf8eb('0x10')]=function(_0x26f79f,_0xf092b6){if(_0x26f79f['user']['role']!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x26f79f[_0xf8eb('0x11')]['id'])))throw new Error(_0xf8eb('0x12'));return db['UserSetting'][_0xf8eb('0x13')]({'where':{'id':_0x26f79f[_0xf8eb('0x11')]['id']}})[_0xf8eb('0xa')](handleEntityNotFound(_0xf092b6,null))['then'](saveUpdates(_0x26f79f[_0xf8eb('0x14')],null))[_0xf8eb('0xa')](respondWithResult(_0xf092b6,null))[_0xf8eb('0x15')](handleError(_0xf092b6,null));}; \ No newline at end of file +var _0xbe45=['status','json','update','then','error','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost'];(function(_0x474e35,_0x2f8226){var _0x13062a=function(_0x53938f){while(--_0x53938f){_0x474e35['push'](_0x474e35['shift']());}};_0x13062a(++_0x2f8226);}(_0xbe45,0xf0));var _0x5be4=function(_0x3624e2,_0x41aa26){_0x3624e2=_0x3624e2-0x0;var _0x3e1316=_0xbe45[_0x3624e2];return _0x3e1316;};'use strict';var _=require(_0x5be4('0x0'));var Redis=require(_0x5be4('0x1'));var logger=require('../../config/logger')(_0x5be4('0x2'));var config=require(_0x5be4('0x3'));var db=require(_0x5be4('0x4'))['db'];var socket=require(_0x5be4('0x5'))(new Redis(config[_0x5be4('0x6')]));require(_0x5be4('0x7'))['register'](socket);config[_0x5be4('0x6')]=_[_0x5be4('0x8')](config[_0x5be4('0x6')],{'host':_0x5be4('0x9'),'port':0x18eb});function respondWithResult(_0xa883b2,_0x451a23){_0x451a23=_0x451a23||0xc8;return function(_0x2a2e93){if(_0x2a2e93){return _0xa883b2[_0x5be4('0xa')](_0x451a23)[_0x5be4('0xb')](_0x2a2e93);}};}function saveUpdates(_0x1e4ec5){return function(_0x4053e9){if(_0x4053e9){return _0x4053e9[_0x5be4('0xc')](_0x1e4ec5)[_0x5be4('0xd')](function(_0x4abb5d){return _0x4abb5d;});}return null;};}function handleEntityNotFound(_0xc75e87){return function(_0x47a9ad){if(!_0x47a9ad){_0xc75e87['sendStatus'](0x194);}return _0x47a9ad;};}function handleError(_0x35662a,_0x53c256){_0x53c256=_0x53c256||0x1f4;return function(_0x42bbee){logger[_0x5be4('0xe')](_0x42bbee['stack']);if(_0x42bbee[_0x5be4('0xf')]){delete _0x42bbee[_0x5be4('0xf')];}_0x35662a[_0x5be4('0xa')](_0x53c256)['send'](_0x42bbee);};}exports[_0x5be4('0xc')]=function(_0x4a84c5,_0x246d2e){if(_0x4a84c5[_0x5be4('0x10')][_0x5be4('0x11')]!==_0x5be4('0x12'))throw new Error(_0x5be4('0x13'));if(isNaN(Number(_0x4a84c5[_0x5be4('0x14')]['id'])))throw new Error(_0x5be4('0x15'));return db['UserSetting'][_0x5be4('0x16')]({'where':{'id':_0x4a84c5[_0x5be4('0x14')]['id']}})[_0x5be4('0xd')](handleEntityNotFound(_0x246d2e,null))[_0x5be4('0xd')](saveUpdates(_0x4a84c5[_0x5be4('0x17')],null))[_0x5be4('0xd')](respondWithResult(_0x246d2e,null))[_0x5be4('0x18')](handleError(_0x246d2e,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 09271fd..d53b7e9 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea13=['hook','UserSetting','save','update','remove','emit','hasOwnProperty'];(function(_0x467413,_0x5eff9b){var _0x494c3b=function(_0x37b94b){while(--_0x37b94b){_0x467413['push'](_0x467413['shift']());}};_0x494c3b(++_0x5eff9b);}(_0xea13,0xb0));var _0x3ea1=function(_0x5f37e0,_0x23a012){_0x5f37e0=_0x5f37e0-0x0;var _0x44130c=_0xea13[_0x5f37e0];return _0x44130c;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x3ea1('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3ea1('0x1'),'afterUpdate':_0x3ea1('0x2'),'afterDestroy':_0x3ea1('0x3')};function emitEvent(_0x3fd842){return function(_0x430e27,_0x52188e,_0x560ae3){UserSettingEvents[_0x3ea1('0x4')](_0x3fd842+':'+_0x430e27['id'],_0x430e27);UserSettingEvents[_0x3ea1('0x4')](_0x3fd842,_0x430e27);_0x560ae3(null);};}for(var e in events){if(events[_0x3ea1('0x5')](e)){var event=events[e];UserSetting[_0x3ea1('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x7882=['remove','emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x4f3b96,_0x2ef96a){var _0x45a23e=function(_0x59cf68){while(--_0x59cf68){_0x4f3b96['push'](_0x4f3b96['shift']());}};_0x45a23e(++_0x2ef96a);}(_0x7882,0x16c));var _0x2788=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x7882[_0x443f79];return _0x3847e4;};'use strict';var EventEmitter=require(_0x2788('0x0'));var UserSetting=require(_0x2788('0x1'))['db'][_0x2788('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2788('0x3')](0x0);var events={'afterCreate':_0x2788('0x4'),'afterUpdate':_0x2788('0x5'),'afterDestroy':_0x2788('0x6')};function emitEvent(_0x2ab464){return function(_0x2bea83,_0x513267,_0x5c2f47){UserSettingEvents[_0x2788('0x7')](_0x2ab464+':'+_0x2bea83['id'],_0x2bea83);UserSettingEvents[_0x2788('0x7')](_0x2ab464,_0x2bea83);_0x5c2f47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x2788('0x8')](e,emitEvent(event));}}module[_0x2788('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index c86b5c0..b481c62 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c32=['exports','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c32,0x15d));var _0x29c3=function(_0x42bd5d,_0x3f2903){_0x42bd5d=_0x42bd5d-0x0;var _0x286500=_0x9c32[_0x42bd5d];return _0x286500;};'use strict';var attributes=require(_0x29c3('0x0'));module[_0x29c3('0x1')]=function(_0x1ad1eb){return _0x1ad1eb['define'](_0x29c3('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c2fa9){if(!_0x5c2fa9[_0x29c3('0x3')])_0x5c2fa9[_0x29c3('0x4')]=null;else if(_0x5c2fa9['clientSideLoggingEnabledSince']===null)_0x5c2fa9[_0x29c3('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4e5c=['clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting','user_settings'];(function(_0x2f169c,_0x130a86){var _0x39937f=function(_0x172407){while(--_0x172407){_0x2f169c['push'](_0x2f169c['shift']());}};_0x39937f(++_0x130a86);}(_0x4e5c,0x149));var _0xc4e5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4e5c[_0x1694f5];return _0x5b4321;};'use strict';var attributes=require(_0xc4e5('0x0'));module['exports']=function(_0x1cf8d8){return _0x1cf8d8['define'](_0xc4e5('0x1'),attributes,{'tableName':_0xc4e5('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x253810){if(!_0x253810['clientSideLoggingEnabled'])_0x253810['clientSideLoggingEnabledSince']=null;else if(_0x253810['clientSideLoggingEnabledSince']===null)_0x253810[_0xc4e5('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 8988bb6..1bb2b34 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc15=['length','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0xac74c6,_0x358374){var _0x630f72=function(_0x13fe72){while(--_0x13fe72){_0xac74c6['push'](_0xac74c6['shift']());}};_0x630f72(++_0x358374);}(_0xbc15,0x1b1));var _0x5bc1=function(_0x5d7ada,_0x1c9891){_0x5d7ada=_0x5d7ada-0x0;var _0x41a3b4=_0xbc15[_0x5d7ada];return _0x41a3b4;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5bc1('0x0'),_0x5bc1('0x1'),_0x5bc1('0x2')];function createListener(_0x487d87,_0x3243a){return function(_0x522fdc){_0x3243a[_0x5bc1('0x3')](_0x487d87,_0x522fdc);if(_0x487d87===_0x5bc1('0x4')){_0x3243a['emit'](_0x5bc1('0x5')+_0x522fdc[_0x5bc1('0x6')],_0x522fdc);}};}exports[_0x5bc1('0x7')]=function(_0x46ef8e){for(var _0x1c0745=0x0,_0x5eb692=events[_0x5bc1('0x8')];_0x1c0745<_0x5eb692;_0x1c0745++){var _0x456ea6=events[_0x1c0745];var _0x3b4af1=createListener('user-setting:'+_0x456ea6,_0x46ef8e);UserSettingEvents['on'](_0x456ea6,_0x3b4af1);}}; \ No newline at end of file +var _0xd9a9=['emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','remove','update','user-setting:update'];(function(_0x204931,_0x53e846){var _0x9d95b8=function(_0x9faffa){while(--_0x9faffa){_0x204931['push'](_0x204931['shift']());}};_0x9d95b8(++_0x53e846);}(_0xd9a9,0x149));var _0x9d9a=function(_0x58ae03,_0x5396ef){_0x58ae03=_0x58ae03-0x0;var _0x9f4ddf=_0xd9a9[_0x58ae03];return _0x9f4ddf;};'use strict';var UserSettingEvents=require(_0x9d9a('0x0'));var events=['save',_0x9d9a('0x1'),_0x9d9a('0x2')];function createListener(_0x7ea251,_0x23453c){return function(_0x290114){_0x23453c['emit'](_0x7ea251,_0x290114);if(_0x7ea251===_0x9d9a('0x3')){_0x23453c[_0x9d9a('0x4')](_0x9d9a('0x5')+_0x290114[_0x9d9a('0x6')],_0x290114);}};}exports[_0x9d9a('0x7')]=function(_0x134546){for(var _0x398b97=0x0,_0x66cd01=events['length'];_0x398b97<_0x66cd01;_0x398b97++){var _0x1bd3d0=events[_0x398b97];var _0x2a6b19=createListener(_0x9d9a('0x8')+_0x1bd3d0,_0x134546);UserSettingEvents['on'](_0x1bd3d0,_0x2a6b19);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 62b3da3..236ba99 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 _0xf898=['removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','./user.controller','get','isAuthenticated','index','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf898,0x14d));var _0x8f89=function(_0x38cf31,_0x42c667){_0x38cf31=_0x38cf31-0x0;var _0xe41ee2=_0xf898[_0x38cf31];return _0xe41ee2;};'use strict';var multer=require(_0x8f89('0x0'));var util=require(_0x8f89('0x1'));var path=require('path');var timeout=require(_0x8f89('0x2'));var express=require(_0x8f89('0x3'));var router=express[_0x8f89('0x4')]();var fs_extra=require(_0x8f89('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f89('0x6'));router[_0x8f89('0x7')]('/',auth[_0x8f89('0x8')](),controller[_0x8f89('0x9')]);router[_0x8f89('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8f89('0x7')]('/whoami',auth[_0x8f89('0x8')](),controller['whoami']);router[_0x8f89('0x7')]('/presence',auth[_0x8f89('0x8')](),controller[_0x8f89('0xa')]);router[_0x8f89('0x7')](_0x8f89('0xb'),auth[_0x8f89('0x8')](),controller['show']);router['get'](_0x8f89('0xc'),controller[_0x8f89('0xd')]);router[_0x8f89('0x7')](_0x8f89('0xe'),auth[_0x8f89('0x8')](),controller['getOpenTabs']);router['get'](_0x8f89('0xf'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x10')]);router['get'](_0x8f89('0x11'),auth[_0x8f89('0x8')](),controller['getQueues']);router[_0x8f89('0x7')]('/:id/queues_rt',auth[_0x8f89('0x8')](),controller[_0x8f89('0x12')]);router[_0x8f89('0x7')](_0x8f89('0x13'),auth[_0x8f89('0x8')](),controller['getGroups']);router[_0x8f89('0x7')](_0x8f89('0x14'),auth[_0x8f89('0x8')](),controller['getRecordings']);router[_0x8f89('0x7')](_0x8f89('0x15'),auth[_0x8f89('0x8')](),controller['getScreenRecordings']);router[_0x8f89('0x7')](_0x8f89('0x16'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x17')]);router['get'](_0x8f89('0x18'),auth[_0x8f89('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0x8f89('0x19'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x8f89('0x7')]('/:id/sms/interactions',auth[_0x8f89('0x8')](),controller[_0x8f89('0x1a')]);router[_0x8f89('0x7')](_0x8f89('0x1b'),auth[_0x8f89('0x8')](),controller['getFaxInteractions']);router[_0x8f89('0x7')](_0x8f89('0x1c'),auth[_0x8f89('0x8')](),controller['getWhatsappInteractions']);router[_0x8f89('0x7')](_0x8f89('0x1d'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x1e')]);router[_0x8f89('0x7')](_0x8f89('0x1f'),auth[_0x8f89('0x8')](),controller['getLists']);router[_0x8f89('0x7')](_0x8f89('0x20'),auth['isAuthenticated'](),controller[_0x8f89('0x21')]);router[_0x8f89('0x7')]('/:id/prefixes',auth[_0x8f89('0x8')](),controller[_0x8f89('0x22')]);router['get'](_0x8f89('0x23'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x24')]);router[_0x8f89('0x7')](_0x8f89('0x25'),auth['isAuthenticated'](),controller[_0x8f89('0x26')]);router[_0x8f89('0x7')](_0x8f89('0x27'),auth[_0x8f89('0x8')](),controller['getOpenchannelAccounts']);router['get'](_0x8f89('0x28'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x29')]);router['get'](_0x8f89('0x2a'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x2b')]);router[_0x8f89('0x7')](_0x8f89('0x2c'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x2d')]);router[_0x8f89('0x7')](_0x8f89('0x2e'),auth[_0x8f89('0x8')](),controller['getScheduledCalls']);router[_0x8f89('0x7')](_0x8f89('0x2f'),auth[_0x8f89('0x8')](),controller['getApiKey']);router['post'](_0x8f89('0xf'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x30')]);router[_0x8f89('0x31')]('/',auth[_0x8f89('0x8')](),controller[_0x8f89('0x32')]);router['post'](_0x8f89('0x33'),auth['isAuthenticated'](),controller[_0x8f89('0x34')]);router[_0x8f89('0x31')]('/:id/queues',auth[_0x8f89('0x8')](),controller[_0x8f89('0x35')]);var upload=multer({'storage':multer[_0x8f89('0x36')]({'destination':function(_0x69868a,_0x5ea0ff,_0x134ad5){_0x134ad5(null,path[_0x8f89('0x37')](config['root'],'server/files/images/'));},'filename':function(_0x514af6,_0x7727d7,_0x57a3d2){_0x57a3d2(null,util[_0x8f89('0x38')](_0x8f89('0x39'),Date[_0x8f89('0x3a')](),_0x7727d7[_0x8f89('0x3b')]));}})});router[_0x8f89('0x31')](_0x8f89('0xc'),upload[_0x8f89('0x3c')](_0x8f89('0x3d')),controller[_0x8f89('0x3e')]);router[_0x8f89('0x31')](_0x8f89('0x3f'),auth['isAuthenticated'](),controller['login']);router[_0x8f89('0x31')](_0x8f89('0x40'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x41')]);router[_0x8f89('0x31')](_0x8f89('0x42'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x43')]);router[_0x8f89('0x31')](_0x8f89('0x44'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x45')]);router[_0x8f89('0x31')](_0x8f89('0x1d'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x46')]);router[_0x8f89('0x31')](_0x8f89('0x47'),auth['isAuthenticated'](),controller[_0x8f89('0x48')]);router[_0x8f89('0x31')](_0x8f89('0x49'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x4a')]);router[_0x8f89('0x31')](_0x8f89('0x4b'),auth['isAuthenticated'](),controller[_0x8f89('0x4c')]);router[_0x8f89('0x31')](_0x8f89('0x4d'),auth[_0x8f89('0x8')](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0x8f89('0x8')](),controller['addOpenchannelInteractions']);router[_0x8f89('0x31')](_0x8f89('0x4e'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x4f')]);router[_0x8f89('0x31')](_0x8f89('0x23'),auth['isAuthenticated'](),controller[_0x8f89('0x50')]);router[_0x8f89('0x31')](_0x8f89('0x25'),auth['isAuthenticated'](),controller[_0x8f89('0x51')]);router['post'](_0x8f89('0x27'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x8f89('0x31')]('/:id/sms_accounts',auth[_0x8f89('0x8')](),controller[_0x8f89('0x52')]);router[_0x8f89('0x31')](_0x8f89('0x2a'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x53')]);router[_0x8f89('0x31')]('/:id/whatsapp_accounts',auth[_0x8f89('0x8')](),controller[_0x8f89('0x54')]);router['post']('/:id/api_key',auth[_0x8f89('0x8')](),controller[_0x8f89('0x55')]);router[_0x8f89('0x56')](_0x8f89('0xb'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x57')]);router[_0x8f89('0x56')]('/:id/password',auth[_0x8f89('0x8')](),controller[_0x8f89('0x58')]);router[_0x8f89('0x59')](_0x8f89('0x11'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x5a')]);router[_0x8f89('0x59')](_0x8f89('0x1d'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x5b')]);router['delete'](_0x8f89('0xb'),auth['isAuthenticated'](),controller[_0x8f89('0x5c')]);router[_0x8f89('0x59')](_0x8f89('0x47'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x5d')]);router['delete'](_0x8f89('0x49'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x5e')]);router[_0x8f89('0x59')](_0x8f89('0x4b'),auth[_0x8f89('0x8')](),controller['removeFaxInteractions']);router[_0x8f89('0x59')](_0x8f89('0x4d'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x8f89('0x59')](_0x8f89('0x5f'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x60')]);router[_0x8f89('0x59')](_0x8f89('0x4e'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x61')]);router[_0x8f89('0x59')](_0x8f89('0x23'),auth['isAuthenticated'](),controller[_0x8f89('0x62')]);router[_0x8f89('0x59')]('/:id/mail_accounts',auth[_0x8f89('0x8')](),controller[_0x8f89('0x63')]);router[_0x8f89('0x59')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x8f89('0x64')]);router[_0x8f89('0x59')](_0x8f89('0x28'),auth['isAuthenticated'](),controller[_0x8f89('0x65')]);router[_0x8f89('0x59')](_0x8f89('0x2a'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x66')]);router['delete'](_0x8f89('0x2c'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x67')]);router[_0x8f89('0x59')](_0x8f89('0x2f'),auth[_0x8f89('0x8')](),controller[_0x8f89('0x68')]);router[_0x8f89('0x31')]('/:id/messengerSoundNotification',auth[_0x8f89('0x8')](),controller['messengerSoundNotification']);module[_0x8f89('0x69')]=router; \ No newline at end of file +var _0x5373=['/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','/:id/login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','/describe','/whoami','whoami','/presence','/:id','isAuthenticated','show'];(function(_0x53710e,_0x96b553){var _0x229d8d=function(_0x51f9c3){while(--_0x51f9c3){_0x53710e['push'](_0x53710e['shift']());}};_0x229d8d(++_0x96b553);}(_0x5373,0xcd));var _0x3537=function(_0x5c3936,_0x1dbb3e){_0x5c3936=_0x5c3936-0x0;var _0x4f6344=_0x5373[_0x5c3936];return _0x4f6344;};'use strict';var multer=require(_0x3537('0x0'));var util=require(_0x3537('0x1'));var path=require(_0x3537('0x2'));var timeout=require(_0x3537('0x3'));var express=require(_0x3537('0x4'));var router=express[_0x3537('0x5')]();var fs_extra=require(_0x3537('0x6'));var auth=require(_0x3537('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3537('0x8'));var controller=require(_0x3537('0x9'));router[_0x3537('0xa')]('/',auth['isAuthenticated'](),controller[_0x3537('0xb')]);router[_0x3537('0xa')](_0x3537('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3537('0xa')](_0x3537('0xd'),auth['isAuthenticated'](),controller[_0x3537('0xe')]);router['get'](_0x3537('0xf'),auth['isAuthenticated'](),controller['getPresence']);router['get'](_0x3537('0x10'),auth[_0x3537('0x11')](),controller[_0x3537('0x12')]);router[_0x3537('0xa')](_0x3537('0x13'),controller[_0x3537('0x14')]);router[_0x3537('0xa')](_0x3537('0x15'),auth[_0x3537('0x11')](),controller[_0x3537('0x16')]);router[_0x3537('0xa')](_0x3537('0x17'),auth['isAuthenticated'](),controller['getContacts']);router[_0x3537('0xa')](_0x3537('0x18'),auth[_0x3537('0x11')](),controller[_0x3537('0x19')]);router['get'](_0x3537('0x1a'),auth[_0x3537('0x11')](),controller[_0x3537('0x1b')]);router[_0x3537('0xa')](_0x3537('0x1c'),auth['isAuthenticated'](),controller[_0x3537('0x1d')]);router[_0x3537('0xa')](_0x3537('0x1e'),auth['isAuthenticated'](),controller[_0x3537('0x1f')]);router[_0x3537('0xa')](_0x3537('0x20'),auth[_0x3537('0x11')](),controller[_0x3537('0x21')]);router[_0x3537('0xa')](_0x3537('0x22'),auth[_0x3537('0x11')](),controller[_0x3537('0x23')]);router[_0x3537('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x3537('0x24')]);router[_0x3537('0xa')]('/:id/mail/interactions',auth[_0x3537('0x11')](),controller[_0x3537('0x25')]);router[_0x3537('0xa')](_0x3537('0x26'),auth[_0x3537('0x11')](),controller['getSmsInteractions']);router[_0x3537('0xa')](_0x3537('0x27'),auth['isAuthenticated'](),controller[_0x3537('0x28')]);router['get'](_0x3537('0x29'),auth[_0x3537('0x11')](),controller[_0x3537('0x2a')]);router[_0x3537('0xa')](_0x3537('0x2b'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3537('0xa')](_0x3537('0x2c'),auth[_0x3537('0x11')](),controller['getLists']);router[_0x3537('0xa')]('/:id/agents',auth['isAuthenticated'](),controller[_0x3537('0x2d')]);router['get']('/:id/prefixes',auth[_0x3537('0x11')](),controller['getVoicePrefixes']);router[_0x3537('0xa')](_0x3537('0x2e'),auth[_0x3537('0x11')](),controller[_0x3537('0x2f')]);router[_0x3537('0xa')](_0x3537('0x30'),auth[_0x3537('0x11')](),controller[_0x3537('0x31')]);router[_0x3537('0xa')](_0x3537('0x32'),auth[_0x3537('0x11')](),controller[_0x3537('0x33')]);router[_0x3537('0xa')]('/:id/sms_accounts',auth[_0x3537('0x11')](),controller[_0x3537('0x34')]);router[_0x3537('0xa')]('/:id/chat_websites',auth[_0x3537('0x11')](),controller[_0x3537('0x35')]);router[_0x3537('0xa')](_0x3537('0x36'),auth['isAuthenticated'](),controller[_0x3537('0x37')]);router['get']('/:id/scheduled_calls',auth[_0x3537('0x11')](),controller[_0x3537('0x38')]);router[_0x3537('0xa')](_0x3537('0x39'),auth[_0x3537('0x11')](),controller['getApiKey']);router[_0x3537('0x3a')]('/:id/contacts',auth[_0x3537('0x11')](),controller[_0x3537('0x3b')]);router[_0x3537('0x3a')]('/',auth['isAuthenticated'](),controller[_0x3537('0x3c')]);router[_0x3537('0x3a')]('/create_many',auth[_0x3537('0x11')](),controller[_0x3537('0x3d')]);router[_0x3537('0x3a')](_0x3537('0x18'),auth[_0x3537('0x11')](),controller[_0x3537('0x3e')]);var upload=multer({'storage':multer[_0x3537('0x3f')]({'destination':function(_0x3b4fb4,_0x22713a,_0x49c496){_0x49c496(null,path[_0x3537('0x40')](config[_0x3537('0x41')],_0x3537('0x42')));},'filename':function(_0x575b2e,_0xdd240,_0x511433){_0x511433(null,util[_0x3537('0x43')](_0x3537('0x44'),Date[_0x3537('0x45')](),_0xdd240['originalname']));}})});router['post'](_0x3537('0x13'),upload[_0x3537('0x46')]('file'),controller['addAvatar']);router['post'](_0x3537('0x47'),auth[_0x3537('0x11')](),controller['login']);router['post'](_0x3537('0x48'),auth[_0x3537('0x11')](),controller['logout']);router[_0x3537('0x3a')](_0x3537('0x49'),auth[_0x3537('0x11')](),controller[_0x3537('0x4a')]);router['post'](_0x3537('0x4b'),auth[_0x3537('0x11')](),controller['unpause']);router[_0x3537('0x3a')](_0x3537('0x2b'),auth['isAuthenticated'](),controller[_0x3537('0x4c')]);router[_0x3537('0x3a')](_0x3537('0x4d'),auth[_0x3537('0x11')](),controller['addChatInteractions']);router[_0x3537('0x3a')](_0x3537('0x4e'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x3537('0x3a')](_0x3537('0x4f'),auth[_0x3537('0x11')](),controller[_0x3537('0x50')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3537('0x51')]);router[_0x3537('0x3a')](_0x3537('0x52'),auth['isAuthenticated'](),controller[_0x3537('0x53')]);router['post'](_0x3537('0x54'),auth[_0x3537('0x11')](),controller['addWhatsappInteractions']);router[_0x3537('0x3a')](_0x3537('0x2e'),auth['isAuthenticated'](),controller[_0x3537('0x55')]);router[_0x3537('0x3a')]('/:id/mail_accounts',auth[_0x3537('0x11')](),controller['addMailAccounts']);router['post'](_0x3537('0x32'),auth[_0x3537('0x11')](),controller[_0x3537('0x56')]);router[_0x3537('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x3537('0x3a')](_0x3537('0x57'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x3537('0x3a')](_0x3537('0x36'),auth['isAuthenticated'](),controller[_0x3537('0x58')]);router['post'](_0x3537('0x39'),auth[_0x3537('0x11')](),controller[_0x3537('0x59')]);router[_0x3537('0x5a')](_0x3537('0x10'),auth[_0x3537('0x11')](),controller['update']);router[_0x3537('0x5a')](_0x3537('0x5b'),auth[_0x3537('0x11')](),controller[_0x3537('0x5c')]);router[_0x3537('0x5d')]('/:id/queues',auth[_0x3537('0x11')](),controller[_0x3537('0x5e')]);router['delete'](_0x3537('0x2b'),auth[_0x3537('0x11')](),controller[_0x3537('0x5f')]);router[_0x3537('0x5d')](_0x3537('0x10'),auth[_0x3537('0x11')](),controller[_0x3537('0x60')]);router[_0x3537('0x5d')](_0x3537('0x4d'),auth['isAuthenticated'](),controller[_0x3537('0x61')]);router[_0x3537('0x5d')](_0x3537('0x4e'),auth[_0x3537('0x11')](),controller[_0x3537('0x62')]);router[_0x3537('0x5d')](_0x3537('0x4f'),auth['isAuthenticated'](),controller[_0x3537('0x63')]);router[_0x3537('0x5d')](_0x3537('0x64'),auth['isAuthenticated'](),controller[_0x3537('0x65')]);router[_0x3537('0x5d')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3537('0x66')]);router[_0x3537('0x5d')](_0x3537('0x54'),auth[_0x3537('0x11')](),controller[_0x3537('0x67')]);router['delete'](_0x3537('0x2e'),auth[_0x3537('0x11')](),controller[_0x3537('0x68')]);router[_0x3537('0x5d')](_0x3537('0x30'),auth[_0x3537('0x11')](),controller['removeMailAccounts']);router['delete'](_0x3537('0x32'),auth['isAuthenticated'](),controller[_0x3537('0x69')]);router[_0x3537('0x5d')](_0x3537('0x6a'),auth['isAuthenticated'](),controller[_0x3537('0x6b')]);router['delete'](_0x3537('0x57'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x3537('0x5d')](_0x3537('0x36'),auth[_0x3537('0x11')](),controller[_0x3537('0x6c')]);router[_0x3537('0x5d')]('/:id/api_key',auth[_0x3537('0x11')](),controller[_0x3537('0x6d')]);router[_0x3537('0x3a')]('/:id/messengerSoundNotification',auth[_0x3537('0x11')](),controller[_0x3537('0x6e')]);module[_0x3537('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 5ef5380..d0c30dd 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 _0xe812=['user','agent','telephone','local','INTEGER','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin'];(function(_0x1dda39,_0x221826){var _0x269408=function(_0x545613){while(--_0x545613){_0x1dda39['push'](_0x1dda39['shift']());}};_0x269408(++_0x221826);}(_0xe812,0x1cb));var _0x2e81=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe812[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2e81('0x0'));var util=require(_0x2e81('0x1'));var _=require('lodash');module[_0x2e81('0x2')]={'name':{'type':Sequelize[_0x2e81('0x3')],'allowNull':![],'unique':_0x2e81('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x21ec95){this[_0x2e81('0x5')](_0x2e81('0x4'),_0x21ec95);this[_0x2e81('0x5')](_0x2e81('0x6'),_0x21ec95);},'comment':_0x2e81('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1e74e0){this[_0x2e81('0x5')](_0x2e81('0x8'),_0x1e74e0);this['setDataValue']('callerid',util[_0x2e81('0x9')](_0x2e81('0xa'),_0x1e74e0,this['getDataValue'](_0x2e81('0xb'))));}},'alias':{'type':Sequelize[_0x2e81('0x3')]},'email':{'type':Sequelize[_0x2e81('0x3')],'allowNull':![],'unique':_0x2e81('0xc'),'validate':{'isEmail':!![]},'set':function(_0x442391){if(_0x442391){this[_0x2e81('0x5')](_0x2e81('0xc'),_0x442391[_0x2e81('0xd')]());}}},'role':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0xf'),_0x2e81('0x10'),_0x2e81('0x11'),_0x2e81('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2e81('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2e81('0x3')],'defaultValue':_0x2e81('0x13')},'internal':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':![],'unique':_0x2e81('0xb'),'set':function(_0x46a90b){this['setDataValue'](_0x2e81('0xb'),_0x46a90b);this[_0x2e81('0x5')]('accountcode',_0x46a90b);this[_0x2e81('0x5')](_0x2e81('0x15'),util['format'](_0x2e81('0xa'),this[_0x2e81('0x16')]('fullname'),_0x46a90b));}},'salt':{'type':Sequelize[_0x2e81('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2e81('0x3')]},'address':{'type':Sequelize[_0x2e81('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2e81('0x3')]},'city':{'type':Sequelize[_0x2e81('0x3')]},'country':{'type':Sequelize[_0x2e81('0x3')]},'online':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2e81('0x18')]},'voicePause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x2e81('0x19')},'lastPauseAt':{'type':Sequelize[_0x2e81('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2e81('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2e81('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![],'defaultValue':_0x2e81('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x2e81('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x1b'),_0x2e81('0x10'),_0x2e81('0x1c')),'allowNull':!![],'defaultValue':_0x2e81('0x1b')},'context':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x1d'),_0x2e81('0x1e'),'ALLOWED_FAILED_SCREEN',_0x2e81('0x1f'),_0x2e81('0x20'),_0x2e81('0x21'),'PROHIB_FAILED_SCREEN',_0x2e81('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x5a8168){this[_0x2e81('0x5')](_0x2e81('0x23'),_0x5a8168?_0x5a8168['join'](','):null);},'get':function(){return this[_0x2e81('0x16')](_0x2e81('0x23'))?this[_0x2e81('0x16')]('transport')[_0x2e81('0x24')](','):null;},'comment':_0x2e81('0x25')},'dtmfmode':{'type':Sequelize[_0x2e81('0xe')]('rfc2833',_0x2e81('0x26'),_0x2e81('0x27'),_0x2e81('0x28'),_0x2e81('0x29')),'allowNull':!![],'defaultValue':_0x2e81('0x2a')},'directmedia':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no',_0x2e81('0x2c'),_0x2e81('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![],'defaultValue':_0x2e81('0x2e'),'set':function(_0x376111){this['setDataValue'](_0x2e81('0x2f'),_0x376111?_0x376111[_0x2e81('0x30')](','):null);},'get':function(){return this[_0x2e81('0x16')]('nat')?this['getDataValue'](_0x2e81('0x2f'))[_0x2e81('0x24')](','):null;},'comment':_0x2e81('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2e81('0x3')]},'pickupgroup':{'type':Sequelize[_0x2e81('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x2e81('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x2e81('0x3')],'allowNull':![],'defaultValue':_0x2e81('0x32')},'allow':{'type':Sequelize[_0x2e81('0x3')],'allowNull':![],'defaultValue':_0x2e81('0x33'),'set':function(_0x3cc551){this['setDataValue'](_0x2e81('0x34'),_0x3cc551?_0x3cc551[_0x2e81('0x30')](';'):_0x2e81('0x33'));},'get':function(){return this[_0x2e81('0x16')]('allow')?this[_0x2e81('0x16')](_0x2e81('0x34'))[_0x2e81('0x24')](';'):null;},'comment':_0x2e81('0x35')},'autoframing':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x51186f){this[_0x2e81('0x5')](_0x2e81('0x36'),_0x51186f?_0x51186f[_0x2e81('0x30')](','):null);},'get':function(){return this[_0x2e81('0x16')](_0x2e81('0x36'))?this['getDataValue'](_0x2e81('0x36'))[_0x2e81('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no',_0x2e81('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![],'defaultValue':_0x2e81('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x2e81('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no',_0x2e81('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2e81('0xe')]('accept',_0x2e81('0x3a'),_0x2e81('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x3c'),_0x2e81('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x2e81('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no',_0x2e81('0x3e'),_0x2e81('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x40'),_0x2e81('0x41'),_0x2e81('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2e81('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2e81('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0x2e81('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2e81('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x2e81('0x18')]},'passwordResetAt':{'type':Sequelize[_0x2e81('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3b60b7){this[_0x2e81('0x5')](_0x2e81('0x44'),_0x3b60b7);var _0x1057c4=this[_0x2e81('0x45')]({'plain':!![]});switch(_0x3b60b7){case 0x0:case 0x1:var _0xced6ea=_0x1057c4[_0x2e81('0x23')]?_[_0x2e81('0x46')](_0x1057c4[_0x2e81('0x23')])?_0x1057c4['transport'][_0x2e81('0x30')]():_0x1057c4[_0x2e81('0x23')]:_0x2e81('0x47');if(_0xced6ea===_0x2e81('0x48')){_0xced6ea='udp';}this[_0x2e81('0x5')](_0x2e81('0x23'),_0xced6ea);this[_0x2e81('0x5')](_0x2e81('0x49'),'no');this[_0x2e81('0x5')]('avpf',null);this['setDataValue']('force_avp',null);this[_0x2e81('0x5')]('icesupport',null);this[_0x2e81('0x5')](_0x2e81('0x4a'),null);this[_0x2e81('0x5')](_0x2e81('0x4b'),null);this[_0x2e81('0x5')](_0x2e81('0x4c'),null);this[_0x2e81('0x5')](_0x2e81('0x4d'),null);this['setDataValue'](_0x2e81('0x4e'),null);this[_0x2e81('0x5')](_0x2e81('0x4f'),'no');break;case 0x2:this[_0x2e81('0x5')](_0x2e81('0x23'),_0x2e81('0x48'));this[_0x2e81('0x5')](_0x2e81('0x49'),'yes');this[_0x2e81('0x5')]('avpf','yes');this[_0x2e81('0x5')](_0x2e81('0x50'),_0x2e81('0x2b'));this[_0x2e81('0x5')]('icesupport',_0x2e81('0x2b'));this[_0x2e81('0x5')](_0x2e81('0x4a'),'yes');this['setDataValue'](_0x2e81('0x4b'),'no');this['setDataValue'](_0x2e81('0x4c'),_0x2e81('0x42'));this['setDataValue'](_0x2e81('0x4d'),_0x1057c4[_0x2e81('0x4d')]||_0x2e81('0x51'));this[_0x2e81('0x5')](_0x2e81('0x4e'),_0x1057c4['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x2e81('0x5')](_0x2e81('0x4f'),_0x2e81('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x2e81('0x52')],'set':function(_0x35eb9c){this[_0x2e81('0x5')](_0x2e81('0x53'),_0x35eb9c?_0x35eb9c[_0x2e81('0x30')](','):[]);},'get':function(){return this['getDataValue'](_0x2e81('0x53'))?_[_0x2e81('0x54')](this['getDataValue'](_0x2e81('0x53'))[_0x2e81('0x24')](','),function(_0x3b2565){return parseInt(_0x3b2565,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2e81('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2e81('0xe')](_0x2e81('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2e81('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2e81('0x55')],'get':function(){return this['getDataValue'](_0x2e81('0x56'))?this[_0x2e81('0x16')](_0x2e81('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2e81('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2e81('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![],'set':function(_0x5402e4){if(typeof _0x5402e4===_0x2e81('0x57')){var _0x281dbd=_0x5402e4==='1'?!![]:_0x5402e4==='0'?![]:_0x5402e4===_0x2e81('0x58')?!![]:_0x5402e4===_0x2e81('0x59')?![]:![];this[_0x2e81('0x5')]('screenrecording',_0x281dbd);}else{this['setDataValue'](_0x2e81('0x5a'),_0x5402e4);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x23d87e){this[_0x2e81('0x5')](_0x2e81('0x5b'),_0x23d87e);if(_0x23d87e===!![]){this[_0x2e81('0x5')](_0x2e81('0x5c'),moment());this[_0x2e81('0x5')](_0x2e81('0x5d'),0x0);}else{this[_0x2e81('0x5')](_0x2e81('0x5c'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2e81('0x14')](0x5)[_0x2e81('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2e81('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2e81('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xe01d=['screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','accept','refuse','originate','uas','fingerprint','certificate','passive','update,nonat','showWebBar','isArray','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','encryption','avpf','icesupport','actpass','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false'];(function(_0x226771,_0xf7e8b5){var _0x12dd08=function(_0x4bc657){while(--_0x4bc657){_0x226771['push'](_0x226771['shift']());}};_0x12dd08(++_0xf7e8b5);}(_0xe01d,0x160));var _0xde01=function(_0x2bbee4,_0x287798){_0x2bbee4=_0x2bbee4-0x0;var _0x209006=_0xe01d[_0x2bbee4];return _0x209006;};'use strict';var Sequelize=require(_0xde01('0x0'));var moment=require(_0xde01('0x1'));var util=require(_0xde01('0x2'));var _=require('lodash');module[_0xde01('0x3')]={'name':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'unique':_0xde01('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1a89d3){this[_0xde01('0x6')](_0xde01('0x5'),_0x1a89d3);this[_0xde01('0x6')]('defaultuser',_0x1a89d3);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'set':function(_0xe5ed61){this[_0xde01('0x6')](_0xde01('0x7'),_0xe5ed61);this['setDataValue'](_0xde01('0x8'),util[_0xde01('0x9')](_0xde01('0xa'),_0xe5ed61,this[_0xde01('0xb')]('internal')));}},'alias':{'type':Sequelize[_0xde01('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1e5ee9){if(_0x1e5ee9){this[_0xde01('0x6')](_0xde01('0xc'),_0x1e5ee9[_0xde01('0xd')]());}}},'role':{'type':Sequelize[_0xde01('0xe')](_0xde01('0xf'),'user','agent',_0xde01('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xde01('0x4')],'defaultValue':_0xde01('0x11')},'internal':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':![],'unique':_0xde01('0x13'),'set':function(_0x4221e9){this[_0xde01('0x6')]('internal',_0x4221e9);this[_0xde01('0x6')](_0xde01('0x14'),_0x4221e9);this[_0xde01('0x6')]('callerid',util['format'](_0xde01('0xa'),this[_0xde01('0xb')](_0xde01('0x7')),_0x4221e9));}},'salt':{'type':Sequelize[_0xde01('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xde01('0x4')]},'address':{'type':Sequelize[_0xde01('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xde01('0x4')]},'city':{'type':Sequelize[_0xde01('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xde01('0x16')]},'voicePause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xde01('0x16')]},'chatCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xde01('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xde01('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x17')},'ipaddr':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xde01('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xde01('0x18'),'user','peer'),'allowNull':!![],'defaultValue':_0xde01('0x18')},'context':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0xde01('0x1a'),_0xde01('0x1b'),_0xde01('0x1c'),_0xde01('0x1d'),_0xde01('0x1e'),_0xde01('0x1f'),'PROHIB_FAILED_SCREEN',_0xde01('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xde01('0x21'),'set':function(_0x27286c){this['setDataValue'](_0xde01('0x22'),_0x27286c?_0x27286c[_0xde01('0x23')](','):null);},'get':function(){return this['getDataValue'](_0xde01('0x22'))?this[_0xde01('0xb')]('transport')[_0xde01('0x24')](','):null;},'comment':_0xde01('0x25')},'dtmfmode':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x26'),'info',_0xde01('0x27'),_0xde01('0x28'),_0xde01('0x29')),'allowNull':!![],'defaultValue':_0xde01('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no',_0xde01('0x2b'),_0xde01('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':_0xde01('0x2d'),'set':function(_0xc79b94){this[_0xde01('0x6')](_0xde01('0x2e'),_0xc79b94?_0xc79b94[_0xde01('0x23')](','):null);},'get':function(){return this[_0xde01('0xb')](_0xde01('0x2e'))?this[_0xde01('0xb')](_0xde01('0x2e'))[_0xde01('0x24')](','):null;},'comment':_0xde01('0x2f')},'callgroup':{'type':Sequelize[_0xde01('0x4')]},'namedcallgroup':{'type':Sequelize[_0xde01('0x4')]},'pickupgroup':{'type':Sequelize[_0xde01('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xde01('0x4')]},'language':{'type':Sequelize[_0xde01('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xde01('0x4')],'allowNull':![],'defaultValue':_0xde01('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde01('0x31'),'set':function(_0x4bb65d){this[_0xde01('0x6')](_0xde01('0x32'),_0x4bb65d?_0x4bb65d[_0xde01('0x23')](';'):_0xde01('0x31'));},'get':function(){return this[_0xde01('0xb')]('allow')?this[_0xde01('0xb')](_0xde01('0x32'))[_0xde01('0x24')](';'):null;},'comment':_0xde01('0x33')},'autoframing':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x12d5fe){this['setDataValue'](_0xde01('0x34'),_0x12d5fe?_0x12d5fe[_0xde01('0x23')](','):null);},'get':function(){return this[_0xde01('0xb')]('insecure')?this['getDataValue'](_0xde01('0x34'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xde01('0x2a')},'busylevel':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x36'),_0xde01('0x37'),_0xde01('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xde01('0x39')),'allowNull':!![],'defaultValue':_0xde01('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xde01('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xde01('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x3a'),_0xde01('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xde01('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xde01('0xe')]('yes','no',_0xde01('0x2b'),_0xde01('0x2c'),_0xde01('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xde01('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xde01('0x16')]},'passwordResetAt':{'type':Sequelize[_0xde01('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0,'set':function(_0x1e996c){this[_0xde01('0x6')](_0xde01('0x3e'),_0x1e996c);var _0x3221a1=this['get']({'plain':!![]});switch(_0x1e996c){case 0x0:case 0x1:var _0x50390e=_0x3221a1['transport']?_[_0xde01('0x3f')](_0x3221a1[_0xde01('0x22')])?_0x3221a1[_0xde01('0x22')][_0xde01('0x23')]():_0x3221a1[_0xde01('0x22')]:_0xde01('0x21');if(_0x50390e==='wss'){_0x50390e='udp';}this['setDataValue']('transport',_0x50390e);this[_0xde01('0x6')]('encryption','no');this['setDataValue']('avpf',null);this[_0xde01('0x6')](_0xde01('0x40'),null);this[_0xde01('0x6')]('icesupport',null);this[_0xde01('0x6')](_0xde01('0x41'),null);this[_0xde01('0x6')](_0xde01('0x42'),null);this[_0xde01('0x6')](_0xde01('0x43'),null);this[_0xde01('0x6')](_0xde01('0x44'),null);this[_0xde01('0x6')](_0xde01('0x45'),null);this[_0xde01('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xde01('0x6')](_0xde01('0x22'),_0xde01('0x46'));this[_0xde01('0x6')](_0xde01('0x47'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x48'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x40'),'yes');this[_0xde01('0x6')](_0xde01('0x49'),_0xde01('0x2a'));this[_0xde01('0x6')](_0xde01('0x41'),_0xde01('0x2a'));this['setDataValue'](_0xde01('0x42'),'no');this[_0xde01('0x6')](_0xde01('0x43'),_0xde01('0x4a'));this[_0xde01('0x6')](_0xde01('0x44'),_0x3221a1[_0xde01('0x44')]||'/etc/pki/tls/certs/motion.crt');this[_0xde01('0x6')]('dtlsprivatekey',_0x3221a1[_0xde01('0x45')]||'/etc/pki/tls/private/motion.key');this[_0xde01('0x6')](_0xde01('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2ecd05){this['setDataValue'](_0xde01('0x4c'),_0x2ecd05?_0x2ecd05[_0xde01('0x23')](','):[]);},'get':function(){return this[_0xde01('0xb')](_0xde01('0x4c'))?_[_0xde01('0x4d')](this['getDataValue'](_0xde01('0x4c'))['split'](','),function(_0x5660f4){return parseInt(_0x5660f4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xde01('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xde01('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xde01('0xe')](_0xde01('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xde01('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xde01('0x4e')],'get':function(){return this[_0xde01('0xb')](_0xde01('0x4f'))?this[_0xde01('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xde01('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xde01('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2549cc){if(typeof _0x2549cc===_0xde01('0x50')){var _0x1f3d62=_0x2549cc==='1'?!![]:_0x2549cc==='0'?![]:_0x2549cc===_0xde01('0x51')?!![]:_0x2549cc===_0xde01('0x52')?![]:![];this[_0xde01('0x6')](_0xde01('0x53'),_0x1f3d62);}else{this['setDataValue'](_0xde01('0x53'),_0x2549cc);}}},'blocked':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![],'set':function(_0x2d711b){this[_0xde01('0x6')](_0xde01('0x54'),_0x2d711b);if(_0x2d711b===!![]){this[_0xde01('0x6')]('blockedAt',moment());this[_0xde01('0x6')]('loginAttempts',0x0);}else{this[_0xde01('0x6')](_0xde01('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xde01('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xde01('0x12')](0x5)[_0xde01('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xde01('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xde01('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xde01('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'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 d4b7d0d..3f53891 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 _0x8a73=['col','asc','desc','orderBy','getRealtimeAgents','offline','unavailable','busy','slice','charAt','toUpperCase','SELECT','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','path','lodash','squel','ioredis','../../components/contacts','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','agent','emit','userNotification:recalc:','destroy','get','role','admin','Agents','Telephones','telephone','ignore','map','value','includes','find','error','stack','name','rawAttributes','fieldName','type','key','filter','salt','previousPasswords','resetPasswordExpires','md5secret','index','where','User','include','true','UserSetting','userSetting','attributes','push','findAll','rows','query','openTabs','chat','dataValues','sms','openchannel','whatsapp','catch','show','params','getOptions','includeAll','options','all','body','describe','addContacts','ids','internal','Setting','findById','password','max','isNil','min_internal','sequelize','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','length','from','voicemail','mailbox','fullname','permissions','101','102','103','113','110','104','105','106','108','109','100','111','114','115','create','user','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','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','isEmpty','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','voice','VoiceQueue','UserVoiceQueueRt','upsert','remove','Queues','channel','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','fax','mail','CHAT','createdAt','FAX','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','merge','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','nolimit','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','logout','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','faxPause','smsPause','lastPauseAt','getTeams','addTeams','Team','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$notLike','$iLike','$like','$overlap','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','idle','unknown','ringing','teams','flatten','toString','lower'];(function(_0x3d2c91,_0x2f965f){var _0x4ea4df=function(_0x1fefb0){while(--_0x1fefb0){_0x3d2c91['push'](_0x3d2c91['shift']());}};_0x4ea4df(++_0x2f965f);}(_0x8a73,0x19c));var _0x38a7=function(_0x1800fe,_0x57f7cc){_0x1800fe=_0x1800fe-0x0;var _0x14c4cb=_0x8a73[_0x1800fe];return _0x14c4cb;};'use strict';var moment=require(_0x38a7('0x0'));var util=require(_0x38a7('0x1'));var path=require(_0x38a7('0x2'));var fs=require('fs');var _=require(_0x38a7('0x3'));var squel=require(_0x38a7('0x4'));var Redis=require(_0x38a7('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0x38a7('0x6'));var qs=require('../../components/parsers/qs');var rta=require(_0x38a7('0x7'));var logger=require(_0x38a7('0x8'))('api');var utils=require(_0x38a7('0x9'));var config=require(_0x38a7('0xa'));var licenseUtil=require(_0x38a7('0xb'));var APIBadRequestError=require(_0x38a7('0xc'))[_0x38a7('0xd')];var APINotFoundError=require(_0x38a7('0xc'))[_0x38a7('0xe')];var APIHandleError=require(_0x38a7('0xc'))['handleError'];var db=require(_0x38a7('0xf'))['db'];var socket=require(_0x38a7('0x10'))(new Redis(config[_0x38a7('0x11')]));require(_0x38a7('0x12'))[_0x38a7('0x13')](socket);config[_0x38a7('0x11')]=_[_0x38a7('0x14')](config[_0x38a7('0x11')],{'host':_0x38a7('0x15'),'port':0x18eb});var values;function respondWithStatusCode(_0x5d3e3f,_0x2ef997){_0x2ef997=_0x2ef997||0xcc;return function(_0x5a2066){if(_0x5a2066){return _0x5d3e3f[_0x38a7('0x16')](_0x2ef997);}return _0x5d3e3f[_0x38a7('0x17')](_0x2ef997)[_0x38a7('0x18')]();};}function respondWithResult(_0x2c5f1f,_0xbbaa7){_0xbbaa7=_0xbbaa7||0xc8;return function(_0x437111){if(_0x437111){return _0x2c5f1f['status'](_0xbbaa7)[_0x38a7('0x19')](_0x437111);}};}function respondWithFilteredResult(_0x469362,_0x163b5d){return function(_0xd1b444){if(_0xd1b444){var _0x56da54=typeof _0x163b5d[_0x38a7('0x1a')]==='undefined'&&typeof _0x163b5d[_0x38a7('0x1b')]===_0x38a7('0x1c');var _0x16906e=_0xd1b444[_0x38a7('0x1d')];var _0x3929c5=_0x56da54?0x0:_0x163b5d[_0x38a7('0x1a')];var _0x5e474b=_0x56da54?_0xd1b444[_0x38a7('0x1d')]:_0x163b5d[_0x38a7('0x1a')]+_0x163b5d[_0x38a7('0x1b')];var _0x42f75e;if(_0x5e474b>=_0x16906e){_0x5e474b=_0x16906e;_0x42f75e=0xc8;}else{_0x42f75e=0xce;}_0x469362[_0x38a7('0x17')](_0x42f75e);return _0x469362[_0x38a7('0x1e')](_0x38a7('0x1f'),_0x3929c5+'-'+_0x5e474b+'/'+_0x16906e)[_0x38a7('0x19')](_0xd1b444);}return null;};}function saveUpdates(_0x376408){return function(_0x2c8250){if(_0x2c8250){return _0x2c8250[_0x38a7('0x20')](_0x376408)[_0x38a7('0x21')](function(_0x584760){if(_0x584760['role']===_0x38a7('0x22')){socket[_0x38a7('0x23')](_0x38a7('0x24')+_0x584760['id'],_0x584760);}return _0x584760;});}return null;};}function removeEntity(_0xba55e9){return function(_0x1ce3b4){if(_0x1ce3b4){return _0x1ce3b4[_0x38a7('0x25')]()[_0x38a7('0x21')](function(){var _0x1fcf09=_0x1ce3b4[_0x38a7('0x26')]({'plain':!![]});if(_0x1fcf09[_0x38a7('0x27')]===_0x38a7('0x28'))return;var _0x3733aa=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x38a7('0x29'),'value':_0x38a7('0x22'),'ignore':![]},{'name':_0x38a7('0x2a'),'value':_0x38a7('0x2b'),'ignore':![]}];var _0x2d9fea=_(_0x3733aa)['filter'](_0x38a7('0x2c'))[_0x38a7('0x2d')]('value')[_0x38a7('0x2e')]();if(_[_0x38a7('0x2f')](_0x2d9fea,_0x1fcf09[_0x38a7('0x27')])){return;}var _0x546618=_[_0x38a7('0x30')](_0x3733aa,[_0x38a7('0x2e'),_0x1fcf09['role']])['name'];return db['UserProfileResource'][_0x38a7('0x25')]({'where':{'type':_0x546618,'resourceId':_0x1fcf09['id']}})[_0x38a7('0x21')](function(){return _0x1ce3b4;});})[_0x38a7('0x21')](function(){_0xba55e9[_0x38a7('0x17')](0xcc)[_0x38a7('0x18')]();});}};}function handleEntityNotFound(_0x31d911){return function(_0x3de26f){if(!_0x3de26f){_0x31d911[_0x38a7('0x16')](0x194);}return _0x3de26f;};}function handleError(_0x2818bc,_0x4692e4){_0x4692e4=_0x4692e4||0x1f4;return function(_0x33d70b){logger[_0x38a7('0x31')](_0x33d70b[_0x38a7('0x32')]);if(_0x33d70b[_0x38a7('0x33')]){delete _0x33d70b[_0x38a7('0x33')];}_0x2818bc[_0x38a7('0x17')](_0x4692e4)['send'](_0x33d70b);};}function getUserAttributes(){return _(db['User'][_0x38a7('0x34')])['map'](function(_0x264311){return{'name':_0x264311[_0x38a7('0x35')],'type':_0x264311[_0x38a7('0x36')][_0x38a7('0x37')]};})[_0x38a7('0x38')](function(_0x317efc){return!['password',_0x38a7('0x39'),_0x38a7('0x3a'),'resetPasswordToken',_0x38a7('0x3b'),_0x38a7('0x3c')][_0x38a7('0x2f')](_0x317efc['name']);})[_0x38a7('0x2e')]();}exports[_0x38a7('0x3d')]=function(_0x43e587,_0x3d1965){var _0x48cae3={},_0x4ed52d={'count':0x0,'rows':[]};var _0x20fb59=getUserAttributes();_0x48cae3=qs['getOptions'](_0x20fb59,_0x43e587);var _0x5e0874={'where':_0x48cae3[_0x38a7('0x3e')]};return db[_0x38a7('0x3f')][_0x38a7('0x1d')](_0x5e0874)[_0x38a7('0x21')](function(_0x143310){_0x4ed52d['count']=_0x143310;if(_0x43e587['query']['includeAll']){_0x48cae3[_0x38a7('0x40')]=[{'all':!![]}];}if(_0x43e587['query']['userSetting']===_0x38a7('0x41')){_0x48cae3[_0x38a7('0x40')]=[{'model':db[_0x38a7('0x42')],'as':_0x38a7('0x43')}];}if(!_[_0x38a7('0x2f')](_0x48cae3[_0x38a7('0x44')],'id')){_0x48cae3[_0x38a7('0x44')][_0x38a7('0x45')]('id');}return db[_0x38a7('0x3f')][_0x38a7('0x46')](_0x48cae3);})[_0x38a7('0x21')](function(_0x2fc2f4){_0x4ed52d[_0x38a7('0x47')]=_0x2fc2f4;if(_0x43e587[_0x38a7('0x48')][_0x38a7('0x49')]===_0x38a7('0x41')){var _0x51aac6=[];for(var _0x4c88ef=0x0;_0x4c88ef<_0x4ed52d[_0x38a7('0x47')]['length'];_0x4c88ef++){_0x51aac6['push'](get_open_tabs(_0x38a7('0x4a'),_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));_0x51aac6['push'](get_open_tabs(_0x38a7('0x4c'),_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));_0x51aac6[_0x38a7('0x45')](get_open_tabs('fax',_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));_0x51aac6[_0x38a7('0x45')](get_open_tabs('mail',_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));_0x51aac6[_0x38a7('0x45')](get_open_tabs(_0x38a7('0x4d'),_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));_0x51aac6['push'](get_open_tabs(_0x38a7('0x4e'),_0x4ed52d[_0x38a7('0x47')][_0x4c88ef][_0x38a7('0x4b')]));}return Promise['all'](_0x51aac6)[_0x38a7('0x21')](function(){return _0x4ed52d;});}else{return _0x4ed52d;}})[_0x38a7('0x21')](respondWithFilteredResult(_0x3d1965,_0x48cae3))[_0x38a7('0x4f')](handleError(_0x3d1965,null));};exports[_0x38a7('0x50')]=function(_0x28e3f3,_0x4a6518){var _0x2c2acc=getUserAttributes();_0x28e3f3[_0x38a7('0x48')]['id']=_0x28e3f3[_0x38a7('0x51')]['id'];var _0x1a6b48=qs[_0x38a7('0x52')](_0x2c2acc,_0x28e3f3);if(_0x28e3f3[_0x38a7('0x48')][_0x38a7('0x53')]){_0x1a6b48['include']=[{'all':!![]}];}if(_0x28e3f3[_0x38a7('0x48')][_0x38a7('0x43')]===_0x38a7('0x41')){_0x1a6b48[_0x38a7('0x40')]=[{'model':db[_0x38a7('0x42')],'as':_0x38a7('0x43')}];}_0x1a6b48=_['merge']({},_0x1a6b48,_0x28e3f3[_0x38a7('0x54')]);if(!_['includes'](_0x1a6b48[_0x38a7('0x44')],'id')){_0x1a6b48['attributes']['push']('id');}return db[_0x38a7('0x3f')][_0x38a7('0x30')](_0x1a6b48)['then'](handleEntityNotFound(_0x4a6518,null))[_0x38a7('0x21')](function(_0x21124d){var _0x2aabec=[];values=_0x21124d;if(_0x28e3f3[_0x38a7('0x48')][_0x38a7('0x49')]==='true'){_0x2aabec[_0x38a7('0x45')](get_open_tabs('chat',_0x21124d[_0x38a7('0x4b')]));_0x2aabec[_0x38a7('0x45')](get_open_tabs(_0x38a7('0x4c'),_0x21124d[_0x38a7('0x4b')]));_0x2aabec['push'](get_open_tabs(_0x38a7('0x4d'),_0x21124d[_0x38a7('0x4b')]));_0x2aabec[_0x38a7('0x45')](get_open_tabs(_0x38a7('0x4e'),_0x21124d['dataValues']));_0x2aabec[_0x38a7('0x45')](get_open_tabs('fax',_0x21124d[_0x38a7('0x4b')]));_0x2aabec[_0x38a7('0x45')](get_open_tabs('mail',_0x21124d['dataValues']));return Promise[_0x38a7('0x55')](_0x2aabec);}else{return values;}})[_0x38a7('0x21')](function(){return values;})[_0x38a7('0x21')](respondWithResult(_0x4a6518,null))['catch'](handleError(_0x4a6518,null));};exports['update']=function(_0xdc2815,_0x16a856){if(_0xdc2815[_0x38a7('0x56')]['id']){delete _0xdc2815[_0x38a7('0x56')]['id'];}delete _0xdc2815[_0x38a7('0x56')][_0x38a7('0x27')];return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0xdc2815[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x16a856,null))[_0x38a7('0x21')](saveUpdates(_0xdc2815[_0x38a7('0x56')],null))[_0x38a7('0x21')](respondWithResult(_0x16a856,null))[_0x38a7('0x4f')](handleError(_0x16a856,null));};exports[_0x38a7('0x57')]=function(_0x34e36f,_0xde3072){return db[_0x38a7('0x3f')][_0x38a7('0x57')]()[_0x38a7('0x21')](respondWithResult(_0xde3072,null))[_0x38a7('0x4f')](handleError(_0xde3072,null));};exports['addContacts']=function(_0x44a797,_0x27d08f){return db['User'][_0x38a7('0x30')]({'where':{'id':_0x44a797[_0x38a7('0x51')]['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x27d08f,null))[_0x38a7('0x21')](function(_0x535a12){if(_0x535a12){return _0x535a12[_0x38a7('0x58')](_0x44a797[_0x38a7('0x56')][_0x38a7('0x59')],_['omit'](_0x44a797['body'],['ids','id'])||{});}})[_0x38a7('0x21')](respondWithResult(_0x27d08f,null))[_0x38a7('0x4f')](handleError(_0x27d08f,null));};function validateUser(_0x2c4596){return new Promise(function(_0x491147,_0x447a92){if(_0x2c4596[_0x38a7('0x5a')])return _0x491147(_0x2c4596);return db[_0x38a7('0x5b')][_0x38a7('0x5c')](0x1)[_0x38a7('0x21')](function(_0x104596){if(_0x104596['securePassword'])authService['validatePasswordPattern'](_0x2c4596[_0x38a7('0x5d')]);db[_0x38a7('0x3f')][_0x38a7('0x5e')](_0x38a7('0x5a'))['then'](function(_0x22b4c3){if(_[_0x38a7('0x5f')](_0x22b4c3)){_0x2c4596['internal']=_0x104596[_0x38a7('0x60')]||0x1;return;}if(_['isNil'](_0x104596[_0x38a7('0x60')])||_0x104596[_0x38a7('0x60')]===_0x22b4c3){_0x2c4596[_0x38a7('0x5a')]=_0x22b4c3+0x1;return;}if(_0x104596[_0x38a7('0x60')]>_0x22b4c3){_0x2c4596[_0x38a7('0x5a')]=_0x104596[_0x38a7('0x60')];return;}return db[_0x38a7('0x61')][_0x38a7('0x48')](_0x38a7('0x62'),{'type':db[_0x38a7('0x61')][_0x38a7('0x63')]['SELECT']})['then'](function(_0x21c182){if(_0x21c182&&_0x21c182['length']){for(var _0x4c427e=0x0,_0x13057a=_0x21c182[_0x38a7('0x64')];_0x4c427e<_0x13057a&&_[_0x38a7('0x5f')](_0x2c4596[_0x38a7('0x5a')]);_0x4c427e++){if(_0x104596[_0x38a7('0x60')]<=_0x21c182[_0x4c427e][_0x38a7('0x65')]){_0x2c4596[_0x38a7('0x5a')]=_0x21c182[_0x4c427e][_0x38a7('0x65')];}else if(_0x104596[_0x38a7('0x60')]>_0x21c182[_0x4c427e]['from']&&_0x104596['min_internal']<=_0x21c182[_0x4c427e]['to']){_0x2c4596[_0x38a7('0x5a')]=_0x104596[_0x38a7('0x60')];}}}if(_[_0x38a7('0x5f')](_0x2c4596[_0x38a7('0x5a')])){_0x2c4596[_0x38a7('0x5a')]=_0x22b4c3+0x1;}return _0x491147(_0x2c4596);});});})[_0x38a7('0x4f')](function(_0x3dff88){_0x447a92(_0x3dff88);});});}function updateUser(_0x45ff7a){return new Promise(function(_0x2ecdb4,_0x3efa72){try{if(_0x45ff7a[_0x38a7('0x66')]){_0x45ff7a[_0x38a7('0x67')]=_0x45ff7a['internal'];_0x45ff7a['VoiceMail']={'mailbox':_0x45ff7a['internal'],'password':_0x45ff7a['password'],'fullname':_0x45ff7a[_0x38a7('0x68')],'email':_0x45ff7a['email']};}if(_0x45ff7a[_0x38a7('0x27')]===_0x38a7('0x22')){if(!_0x45ff7a[_0x38a7('0x69')])_0x45ff7a[_0x38a7('0x69')]=[_0x38a7('0x6a'),_0x38a7('0x6b'),_0x38a7('0x6c'),_0x38a7('0x6d'),_0x38a7('0x6e'),_0x38a7('0x6f'),_0x38a7('0x70'),_0x38a7('0x71'),'107',_0x38a7('0x72'),_0x38a7('0x73'),_0x38a7('0x74'),_0x38a7('0x75'),_0x38a7('0x76'),_0x38a7('0x77')];}_0x2ecdb4(_0x45ff7a);}catch(_0x107711){_0x3efa72(_0x107711);}});}exports[_0x38a7('0x78')]=function(_0x1265c8,_0x27f85e){if(_0x1265c8[_0x38a7('0x79')][_0x38a7('0x27')]==='agent')throw new Error(_0x38a7('0x7a'));if(_0x1265c8[_0x38a7('0x56')]['role']==='user'&&_0x1265c8[_0x38a7('0x79')][_0x38a7('0x27')]!==_0x38a7('0x28')){throw new Error(_0x38a7('0x7b'));}if(_0x1265c8[_0x38a7('0x56')][_0x38a7('0x27')]==='admin'&&_0x1265c8[_0x38a7('0x79')][_0x38a7('0x27')]!==_0x38a7('0x28')){throw new Error(_0x38a7('0x7c'));}return licenseUtil['checkUserLimits']([_0x1265c8[_0x38a7('0x56')]])['then'](function(){return validateUser(_0x1265c8['body']);})[_0x38a7('0x21')](function(_0x2bbc53){return updateUser(_0x2bbc53)[_0x38a7('0x21')](function(_0x4dfcee){if(_0x4dfcee[_0x38a7('0x27')]===_0x38a7('0x28')){_0x4dfcee[_0x38a7('0x7d')]=_0x1265c8['user']['settingsEnabled'];delete _0x4dfcee[_0x38a7('0x7e')];}return _0x4dfcee;});})[_0x38a7('0x21')](function(_0x12bd7e){return db['User'][_0x38a7('0x78')](_0x12bd7e,{'include':[{'model':db[_0x38a7('0x7f')],'as':_0x38a7('0x7f')}]});})['then'](function(_0x3f8b1c){if(_0x1265c8[_0x38a7('0x56')]['role']===_0x38a7('0x79'))return _0x3f8b1c;if(_0x1265c8[_0x38a7('0x79')][_0x38a7('0x27')]!==_0x38a7('0x79'))return _0x3f8b1c;return db[_0x38a7('0x80')][_0x38a7('0x30')]({'where':{'name':_0x3f8b1c[_0x38a7('0x27')]===_0x38a7('0x22')?_0x38a7('0x29'):_0x38a7('0x2a'),'userProfileId':_0x1265c8[_0x38a7('0x79')][_0x38a7('0x7e')]},'raw':!![]})[_0x38a7('0x21')](function(_0x414a27){if(!_0x414a27||_0x414a27[_0x38a7('0x81')]!=0x0)return _0x3f8b1c;return db['UserProfileResource'][_0x38a7('0x78')]({'name':_0x3f8b1c['name'],'resourceId':_0x3f8b1c['id'],'type':_0x414a27[_0x38a7('0x33')],'sectionId':_0x414a27['id']},{})[_0x38a7('0x21')](function(){return _0x3f8b1c;});})[_0x38a7('0x4f')](function(_0x164088){logger[_0x38a7('0x31')](_0x38a7('0x82'),_0x164088);throw _0x164088;});})[_0x38a7('0x21')](respondWithResult(_0x27f85e,0xc9))[_0x38a7('0x4f')](handleError(_0x27f85e,null));};exports[_0x38a7('0x83')]=function(_0x35db3e,_0x19d107){var _0x39d21e=_0x35db3e[_0x38a7('0x56')];var _0x44b67f=[];if(_0x35db3e[_0x38a7('0x79')]['role']===_0x38a7('0x22'))throw new Error('Unauthorized');if(_[_0x38a7('0x84')](_0x39d21e,['role',_0x38a7('0x79')])&&_0x35db3e[_0x38a7('0x79')][_0x38a7('0x27')]!==_0x38a7('0x28')){throw new Error(_0x38a7('0x7b'));}if(_[_0x38a7('0x84')](_0x39d21e,['role',_0x38a7('0x28')])&&_0x35db3e[_0x38a7('0x79')][_0x38a7('0x27')]!==_0x38a7('0x28')){throw new Error(_0x38a7('0x85'));}return licenseUtil[_0x38a7('0x86')](_0x39d21e)[_0x38a7('0x21')](function(){return validateUser(_0x39d21e[0x0]);})[_0x38a7('0x21')](function(){for(var _0x4ae9c9=0x1;_0x4ae9c9<_0x39d21e[_0x38a7('0x64')];_0x4ae9c9++){var _0x30240b=_0x39d21e[_0x4ae9c9-0x1][_0x38a7('0x5a')];if(!_0x39d21e[_0x4ae9c9][_0x38a7('0x5a')])_0x39d21e[_0x4ae9c9][_0x38a7('0x5a')]=_0x30240b+0x1;_0x44b67f[_0x38a7('0x45')](validateUser(_0x39d21e[_0x4ae9c9]));}return Promise[_0x38a7('0x55')](_0x44b67f);})[_0x38a7('0x21')](function(){_0x44b67f=[];for(var _0x100a6e=0x0;_0x100a6e<_0x39d21e['length'];_0x100a6e++){_0x44b67f['push'](updateUser(_0x39d21e[_0x100a6e]));}return Promise[_0x38a7('0x55')](_0x44b67f);})[_0x38a7('0x21')](function(){_0x44b67f=_0x39d21e[_0x38a7('0x2d')](function(_0x27a936){return db['User'][_0x38a7('0x78')](_0x27a936,{'include':[{'model':db[_0x38a7('0x7f')],'as':_0x38a7('0x7f')}]})['then'](function(_0x45802d){_0x27a936['id']=_0x45802d['id'];return _0x27a936;});});return Promise['all'](_0x44b67f);})[_0x38a7('0x21')](function(_0x37f3b8){if(_0x35db3e['body'][_0x38a7('0x27')]==='user')return _0x37f3b8;if(_0x35db3e['user'][_0x38a7('0x27')]!==_0x38a7('0x79'))return _0x37f3b8;var _0x3bbbea=_[_0x38a7('0x84')](_0x37f3b8,function(_0x48cb92){return _0x48cb92[_0x38a7('0x27')]===_0x38a7('0x22')||_0x48cb92['role']==='telephone';});if(!_0x3bbbea)return _0x37f3b8;return db[_0x38a7('0x80')][_0x38a7('0x46')]({'where':{'name':{'$or':[_0x38a7('0x29'),_0x38a7('0x2a')]},'userProfileId':_0x35db3e[_0x38a7('0x79')][_0x38a7('0x7e')]},'raw':!![]})['then'](function(_0x20fb62){if(_[_0x38a7('0x87')](_0x20fb62)||!_[_0x38a7('0x84')](_0x20fb62,['autoAssociation',0x0]))return _0x37f3b8;_0x44b67f=[];var _0x122529=_(_0x20fb62)[_0x38a7('0x2d')](function(_0x400b6a){if(_0x400b6a[_0x38a7('0x81')]===0x1)return;return _0x400b6a[_0x38a7('0x33')]===_0x38a7('0x29')?_0x38a7('0x22'):_0x38a7('0x2b');})['compact']()[_0x38a7('0x2e')]();for(var _0x414eb7=0x0;_0x414eb7<_0x37f3b8['length'];_0x414eb7++){if(!_[_0x38a7('0x2f')](_0x122529,_0x37f3b8[_0x414eb7][_0x38a7('0x27')]))return;var _0x5df661=_0x37f3b8[_0x414eb7]['role']==='agent'?_0x38a7('0x29'):_0x38a7('0x2a');_0x44b67f[_0x38a7('0x45')](db[_0x38a7('0x88')]['create']({'name':_0x37f3b8[_0x414eb7][_0x38a7('0x33')],'resourceId':_0x37f3b8[_0x414eb7]['id'],'type':_0x5df661,'sectionId':_[_0x38a7('0x30')](_0x20fb62,[_0x38a7('0x33'),_0x5df661])['id']},{}));}return Promise[_0x38a7('0x55')](_0x44b67f);});})['then'](respondWithResult(_0x19d107,0xc9))[_0x38a7('0x4f')](handleError(_0x19d107,null));};exports[_0x38a7('0x89')]=function(_0x4c2fd5,_0x19a472){if(_0x4c2fd5[_0x38a7('0x56')]['id']){delete _0x4c2fd5['body']['id'];}return db['User'][_0x38a7('0x30')]({'where':{'id':_0x4c2fd5[_0x38a7('0x51')]['id']}})[_0x38a7('0x21')](function(_0x40733f){if(!_0x40733f)return null;if(_0x40733f['id']===_0x4c2fd5[_0x38a7('0x79')]['id']){if(!_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8a')]||!_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8b')]){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0x8e'));}if(!_0x40733f['authenticate'](_0x4c2fd5[_0x38a7('0x56')]['oldPassword'])){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0x8f'));}if(_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8a')]===_0x4c2fd5['body'][_0x38a7('0x8b')]){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0x90'));}}else if(_0x4c2fd5[_0x38a7('0x79')][_0x38a7('0x27')]===_0x38a7('0x28')){if(!_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8b')]){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0x91'));}}else if(_0x4c2fd5[_0x38a7('0x79')][_0x38a7('0x27')]===_0x38a7('0x79')){if(!_0x4c2fd5[_0x38a7('0x56')]['newPassword']){throw new db['Sequelize'][(_0x38a7('0x8d'))](_0x38a7('0x91'));}if(_0x40733f['role']!==_0x38a7('0x22')){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))]('Unauthorized');}}else{throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))]('Unauthorized');}return _0x40733f;})[_0x38a7('0x21')](handleEntityNotFound(_0x19a472,null))['then'](function(_0x4cd1f3){return db[_0x38a7('0x5b')][_0x38a7('0x92')]({'attributes':['id',_0x38a7('0x93'),_0x38a7('0x94'),_0x38a7('0x95')]})[_0x38a7('0x21')](function(_0xe07961){if(_0xe07961[_0x38a7('0x93')])authService[_0x38a7('0x96')](_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8b')]);if(!_0xe07961[_0x38a7('0x94')]||!_0x4cd1f3['previousPasswords'])return _0x4cd1f3;authService[_0x38a7('0x97')](_0x4c2fd5['body'][_0x38a7('0x8b')],_0x4cd1f3[_0x38a7('0x3a')],_0xe07961['passwordHistoryLimit']);return _0x4cd1f3;})['then'](saveUpdates({'password':_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8b')],'passwordResetAt':_0x4c2fd5[_0x38a7('0x79')]['id']==_0x4c2fd5[_0x38a7('0x51')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4c2fd5[_0x38a7('0x56')][_0x38a7('0x8b')],_0x4cd1f3[_0x38a7('0x3a')])},null));})['then'](respondWithResult(_0x19a472,null))[_0x38a7('0x4f')](handleError(_0x19a472,null));};exports[_0x38a7('0x98')]=function(_0x188eed,_0x4d3454){var _0x69fae7=_0x188eed[_0x38a7('0x56')]['channel'];return db[_0x38a7('0x3f')]['find']({'where':{'id':_0x188eed['params']['id']},'attributes':['id',_0x38a7('0x33'),'role',_0x38a7('0x99'),_0x38a7('0x9a'),_0x38a7('0x9b'),_0x38a7('0x9c')]})[_0x38a7('0x21')](handleEntityNotFound(_0x4d3454,null))[_0x38a7('0x21')](function(_0x2ecd28){if(_0x2ecd28){if(!utils[_0x38a7('0x9d')](_0x69fae7)){throw new db['Sequelize'][(_0x38a7('0x8d'))](_0x38a7('0x9e'));}return _0x2ecd28[_0x38a7('0x9f')+_[_0x38a7('0xa0')](_0x69fae7[_0x38a7('0xa1')]())+'Queues'](_0x188eed[_0x38a7('0x56')][_0x38a7('0x59')],{'penalty':_0x188eed[_0x38a7('0x56')][_0x38a7('0xa2')]||0x0})[_0x38a7('0xa3')](function(_0x44e70d){for(var _0x8040da=0x0;_0x8040da<_0x188eed['body'][_0x38a7('0x59')][_0x38a7('0x64')];_0x8040da+=0x1){var _0x255f08={'UserId':Number(_0x188eed[_0x38a7('0x51')]['id'])};_0x255f08[_[_0x38a7('0xa0')](_0x69fae7['toLowerCase']())+'QueueId']=Number(_0x188eed[_0x38a7('0x56')][_0x38a7('0x59')][_0x8040da]);socket['emit'](_0x38a7('0x79')+_[_0x38a7('0xa0')](_0x69fae7[_0x38a7('0xa1')]())+'Queue:save',_0x255f08);}return _0x44e70d;})['then'](function(){if(_0x69fae7===_0x38a7('0xa4')){return db[_0x38a7('0xa5')][_0x38a7('0x46')]({'where':{'id':_0x188eed[_0x38a7('0x56')][_0x38a7('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x38a7('0x21')](function(_0x157161){var _0x5452a0=_0x2ecd28[_0x38a7('0x26')]({'plain':!![]});var _0x5d9b0f=[];if(_0x69fae7===_0x38a7('0xa4')&&_0x5452a0['role']===_0x38a7('0x22')&&_0x5452a0[_0x38a7('0x99')]){for(let _0x98c040=0x0;_0x98c040<_0x157161[_0x38a7('0x64')];_0x98c040+=0x1){_0x5d9b0f['push']({'membername':_0x5452a0[_0x38a7('0x33')],'UserId':_0x5452a0['id'],'queue_name':_0x157161[_0x98c040][_0x38a7('0x33')],'VoiceQueueId':_0x157161[_0x98c040]['id'],'interface':_[_0x38a7('0x5f')](_0x5452a0['interface'])?util['format']('SIP/%s',_0x5452a0[_0x38a7('0x33')]):_0x5452a0[_0x38a7('0x9c')],'paused':_0x5452a0[_0x38a7('0x9b')]||![],'penalty':_0x188eed['body'][_0x38a7('0xa2')]||0x0});}return Promise[_0x38a7('0x55')](_0x5d9b0f[_0x38a7('0x2d')](function(_0x388f41){return db[_0x38a7('0xa6')][_0x38a7('0xa7')](_0x388f41);}));}return _0x2ecd28;});}})[_0x38a7('0x21')](respondWithStatusCode(_0x4d3454,null))[_0x38a7('0x4f')](handleError(_0x4d3454,null));};exports['removeQueues']=function(_0x4f4b29,_0x35cfb9){var _0x1a2b5b,_0xab3331;return db['User'][_0x38a7('0x30')]({'where':{'id':_0x4f4b29[_0x38a7('0x51')]['id']},'attributes':['id','name','role']})[_0x38a7('0x21')](handleEntityNotFound(_0x35cfb9,null))[_0x38a7('0x21')](function(_0x36b0a2){if(_0x36b0a2){_0x1a2b5b=_0x36b0a2;if(!_0x4f4b29[_0x38a7('0x48')]['channel']||!utils[_0x38a7('0x9d')](_0x4f4b29[_0x38a7('0x48')]['channel'])){throw new db['Sequelize'][(_0x38a7('0x8d'))](_0x38a7('0x9e'));}return _0x36b0a2[_0x38a7('0xa8')+_[_0x38a7('0xa0')](_0x4f4b29[_0x38a7('0x48')]['channel']['toLowerCase']())+_0x38a7('0xa9')](_0x4f4b29[_0x38a7('0x48')][_0x38a7('0x59')]);}})[_0x38a7('0x21')](function(_0x2e78fc){if(_['isArray'](_0x4f4b29[_0x38a7('0x48')][_0x38a7('0x59')])){for(var _0x2556cd=0x0;_0x2556cd<_0x4f4b29[_0x38a7('0x48')]['ids'][_0x38a7('0x64')];_0x2556cd+=0x1){_0xab3331={'UserId':Number(_0x4f4b29['params']['id'])};_0xab3331[_['capitalize'](_0x4f4b29[_0x38a7('0x48')][_0x38a7('0xaa')][_0x38a7('0xa1')]())+_0x38a7('0xab')]=Number(_0x4f4b29['query'][_0x38a7('0x59')][_0x2556cd]);socket[_0x38a7('0x23')](_0x38a7('0x79')+_[_0x38a7('0xa0')](_0x4f4b29['query'][_0x38a7('0xaa')][_0x38a7('0xa1')]())+'Queue:remove',_0xab3331);}}else{_0xab3331={'UserId':Number(_0x4f4b29[_0x38a7('0x51')]['id'])};_0xab3331[_[_0x38a7('0xa0')](_0x4f4b29[_0x38a7('0x48')][_0x38a7('0xaa')][_0x38a7('0xa1')]())+'QueueId']=Number(_0x4f4b29[_0x38a7('0x48')][_0x38a7('0x59')]);socket[_0x38a7('0x23')]('user'+_[_0x38a7('0xa0')](_0x4f4b29[_0x38a7('0x48')][_0x38a7('0xaa')][_0x38a7('0xa1')]())+_0x38a7('0xac'),_0xab3331);}return _0x2e78fc;})['then'](function(){if(_0x4f4b29[_0x38a7('0x48')][_0x38a7('0xaa')]===_0x38a7('0xa4')){return db[_0x38a7('0xa6')][_0x38a7('0x25')]({'where':{'UserId':_0x4f4b29['params']['id'],'VoiceQueueId':_0x4f4b29[_0x38a7('0x48')][_0x38a7('0x59')]},'individualHooks':!![]})['then'](function(){return _0x1a2b5b;});}return _0x1a2b5b;})['then'](respondWithStatusCode(_0x35cfb9,null))['catch'](handleError(_0x35cfb9,null));};exports[_0x38a7('0xad')]=function(_0x458706,_0x307f6b){_0x458706['body'][_0x38a7('0xae')]=_0x458706[_0x38a7('0xaf')][_0x38a7('0xb0')];return db[_0x38a7('0x3f')]['find']({'where':{'id':_0x458706['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x307f6b,null))['then'](saveUpdates(_0x458706[_0x38a7('0x56')],null))[_0x38a7('0x21')](respondWithResult(_0x307f6b,null))[_0x38a7('0x4f')](handleError(_0x307f6b,null));};exports[_0x38a7('0xb1')]=function(_0x44b1cc,_0x21963e){var _0x38421d=path[_0x38a7('0xb2')](config[_0x38a7('0xb3')],_0x38a7('0xb4'));return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0x44b1cc[_0x38a7('0x51')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x38a7('0x21')](handleEntityNotFound(_0x21963e,null))[_0x38a7('0x21')](function(_0x15c8dc){if(_0x15c8dc){if(_['isNil'](_0x15c8dc['userpic'])){return _0x21963e[_0x38a7('0xb5')](_0x38421d);}else{if(!fs[_0x38a7('0xb6')](path[_0x38a7('0xb2')](config[_0x38a7('0xb3')],_0x38a7('0xb7'),_0x15c8dc['userpic']))){return _0x21963e[_0x38a7('0xb5')](_0x38421d);}return _0x21963e[_0x38a7('0xb5')](path[_0x38a7('0xb2')](config[_0x38a7('0xb3')],_0x38a7('0xb7'),_0x15c8dc['userpic']));}}})[_0x38a7('0x4f')](handleError(_0x21963e,null));};exports[_0x38a7('0xb8')]=function(_0xe313e5,_0x142181){return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0xe313e5['params']['id']},'attributes':['id']})[_0x38a7('0x21')](handleEntityNotFound(_0x142181,null))['then'](function(_0x4ab366){var _0x2c225a=[];values=_0x4ab366[_0x38a7('0x4b')];_0x2c225a['push'](get_open_tabs('chat',_0x4ab366[_0x38a7('0x4b')]));_0x2c225a[_0x38a7('0x45')](get_open_tabs('sms',_0x4ab366[_0x38a7('0x4b')]));_0x2c225a[_0x38a7('0x45')](get_open_tabs(_0x38a7('0x4d'),_0x4ab366['dataValues']));_0x2c225a['push'](get_open_tabs(_0x38a7('0x4e'),_0x4ab366[_0x38a7('0x4b')]));_0x2c225a[_0x38a7('0x45')](get_open_tabs(_0x38a7('0xb9'),_0x4ab366[_0x38a7('0x4b')]));_0x2c225a[_0x38a7('0x45')](get_open_tabs(_0x38a7('0xba'),_0x4ab366['dataValues']));return Promise[_0x38a7('0x55')](_0x2c225a);})[_0x38a7('0x21')](function(_0x1734e6){if(_0x1734e6){var _0xba1c82=_[_0x38a7('0x2d')](values['ChatOpenTabs'],function(_0xcf5dd9){return{'channel':_0x38a7('0xbb'),'id':_0xcf5dd9['id'],'createdAt':_0xcf5dd9[_0x38a7('0xbc')]};});var _0x148446=_[_0x38a7('0x2d')](values['FaxOpenTabs'],function(_0x1d5841){return{'channel':_0x38a7('0xbd'),'id':_0x1d5841['id'],'createdAt':_0x1d5841[_0x38a7('0xbc')]};});var _0x1b69b9=_['map'](values['OpenchannelOpenTabs'],function(_0x6de3db){return{'channel':_0x38a7('0xbe'),'id':_0x6de3db['id'],'createdAt':_0x6de3db[_0x38a7('0xbc')]};});var _0x83b018=_[_0x38a7('0x2d')](values['MailOpenTabs'],function(_0x39c26f){return{'channel':_0x38a7('0xbf'),'id':_0x39c26f['id'],'createdAt':_0x39c26f[_0x38a7('0xbc')]};});var _0x21287c=_['map'](values[_0x38a7('0xc0')],function(_0x3cf05f){return{'channel':_0x38a7('0xc1'),'id':_0x3cf05f['id'],'createdAt':_0x3cf05f[_0x38a7('0xbc')]};});var _0x54c557=_[_0x38a7('0x2d')](values[_0x38a7('0xc2')],function(_0x3d3c9e){return{'channel':_0x38a7('0xc3'),'id':_0x3d3c9e['id'],'createdAt':_0x3d3c9e[_0x38a7('0xbc')]};});var _0xea51c2=_[_0x38a7('0xc4')](_0xba1c82,_0x148446,_0x1b69b9,_0x83b018,_0x21287c,_0x54c557);var _0x506fb5={'count':_0xea51c2[_0x38a7('0x64')],'rows':_0xea51c2};return _0x506fb5;}else return null;})[_0x38a7('0x21')](respondWithResult(_0x142181,null))['catch'](handleError(_0x142181,null));};exports[_0x38a7('0xc5')]=function(_0x364fa7,_0x4b0957){var _0x18b950={};return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x364fa7['params']['id']}})[_0x38a7('0x21')](function(_0x4d27a8){if(!_0x4d27a8){throw new APINotFoundError(util['format'](_0x38a7('0xc6'),_0x364fa7['params']['id']));}return contacts[_0x38a7('0x57')]();})[_0x38a7('0x21')](function(_0x4dbfe0){_0x364fa7[_0x38a7('0x48')][_0x38a7('0x3f')]=_0x364fa7[_0x38a7('0x51')]['id'];_0x18b950=qs[_0x38a7('0x52')](_0x4dbfe0,_0x364fa7);if(_0x364fa7[_0x38a7('0x48')][_0x38a7('0xc7')]('includeAll')){_0x18b950[_0x38a7('0x40')]=[{'model':db[_0x38a7('0xc8')],'as':_0x38a7('0xc9'),'required':![]},{'model':db[_0x38a7('0xca')],'as':_0x38a7('0xcb'),'attributes':['id',_0x38a7('0x33'),_0x38a7('0xcc')],'where':_0x364fa7['query'][_0x38a7('0xcd')]?{'id':_0x364fa7['query'][_0x38a7('0xcd')]}:undefined,'required':_0x364fa7[_0x38a7('0x48')]['tag']?!![]:![]}];}return contacts[_0x38a7('0x46')](_0x364fa7[_0x38a7('0x48')],_0x364fa7['user'],_0x18b950,_0x4dbfe0);})[_0x38a7('0x21')](respondWithFilteredResult(_0x4b0957,_0x18b950))[_0x38a7('0x4f')](APIHandleError(_0x4b0957));};exports[_0x38a7('0xce')]=function(_0x2f27a4,_0x35a280){var _0x1d70eb;var _0xbe61da={};var _0x311612;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x2f27a4['params']['id']},'attributes':['id',_0x38a7('0x33'),_0x38a7('0x27')]})[_0x38a7('0x21')](handleEntityNotFound(_0x35a280,null))['then'](function(_0x340472){if(!utils[_0x38a7('0x9d')](_0x2f27a4[_0x38a7('0x48')][_0x38a7('0xaa')])){throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0x9e'));}_0x1d70eb=_0x340472;var _0x25f4d5={};_0x25f4d5[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db[_[_0x38a7('0xa0')](_0x2f27a4[_0x38a7('0x48')][_0x38a7('0xaa')])+_0x38a7('0xd1')]['rawAttributes']);_0x25f4d5[_0x38a7('0x48')]=_['keys'](_0x2f27a4['query']);_0x25f4d5[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x25f4d5[_0x38a7('0xcf')],_0x25f4d5[_0x38a7('0x48')]);_0xbe61da[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x25f4d5[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x2f27a4['query'][_0x38a7('0xd4')]));_0xbe61da[_0x38a7('0x44')]=_0xbe61da['attributes'][_0x38a7('0x64')]?_0xbe61da[_0x38a7('0x44')]:_0x25f4d5['model'];_0xbe61da[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x2f27a4[_0x38a7('0x48')][_0x38a7('0xd6')]);_0xbe61da[_0x38a7('0x3e')]=qs['filters'](_[_0x38a7('0xd7')](_0x2f27a4[_0x38a7('0x48')],_0x25f4d5['filters']));if(_0x2f27a4[_0x38a7('0x48')]['filter']){_0xbe61da[_0x38a7('0x3e')]=_[_0x38a7('0xd8')](_0xbe61da[_0x38a7('0x3e')],{'$or':_[_0x38a7('0x2d')](_0xbe61da[_0x38a7('0x44')],function(_0x58f532){var _0x4f1e2a={};_0x4f1e2a[_0x58f532]={'$like':'%'+_0x2f27a4[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x4f1e2a;})});}_0xbe61da=_[_0x38a7('0xd8')]({},_0xbe61da,_0x2f27a4['options']);switch(_0x1d70eb['role']){case _0x38a7('0x28'):return db[_['capitalize'](_0x2f27a4[_0x38a7('0x48')]['channel'])+'Queue'][_0x38a7('0x46')](_0xbe61da);case _0x38a7('0x79'):case _0x38a7('0x22'):return _0x1d70eb[_0x38a7('0x26')+_[_0x38a7('0xa0')](_0x2f27a4[_0x38a7('0x48')][_0x38a7('0xaa')])+_0x38a7('0xa9')](_0xbe61da);default:throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0xd9'));}})[_0x38a7('0x21')](function(_0x23ff4d){_0x311612=_0x23ff4d[_0x38a7('0x64')];if(!_0x2f27a4[_0x38a7('0x48')]['hasOwnProperty']('nolimit')){_0xbe61da[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x2f27a4[_0x38a7('0x48')]['limit']);_0xbe61da[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x2f27a4[_0x38a7('0x48')][_0x38a7('0x1a')]);}switch(_0x1d70eb[_0x38a7('0x27')]){case _0x38a7('0x28'):return db[_['capitalize'](_0x2f27a4['query'][_0x38a7('0xaa')])+_0x38a7('0xd1')][_0x38a7('0x46')](_0xbe61da);case'user':case _0x38a7('0x22'):return _0x1d70eb['get'+_[_0x38a7('0xa0')](_0x2f27a4['query'][_0x38a7('0xaa')])+_0x38a7('0xa9')](_0xbe61da);}})[_0x38a7('0x21')](function(_0x2ca292){return{'count':_0x311612,'rows':_0x2ca292};})[_0x38a7('0x21')](respondWithResult(_0x35a280,null))[_0x38a7('0x4f')](handleError(_0x35a280,null));};exports[_0x38a7('0xda')]=function(_0x309125,_0x4e2980){var _0x5084a2={};var _0x9820ac={};var _0x561e00;var _0x267ae0;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x309125[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e2980,null))[_0x38a7('0x21')](function(_0x5648e8){if(_0x5648e8){_0x561e00=_0x5648e8;_0x9820ac[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db['UserVoiceQueueRt'][_0x38a7('0x34')]);_0x9820ac[_0x38a7('0x48')]=_['keys'](_0x309125[_0x38a7('0x48')]);_0x9820ac[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x9820ac[_0x38a7('0xcf')],_0x9820ac[_0x38a7('0x48')]);_0x5084a2[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x9820ac[_0x38a7('0xcf')],qs['fields'](_0x309125[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x5084a2[_0x38a7('0x44')]=_0x5084a2['attributes'][_0x38a7('0x64')]?_0x5084a2[_0x38a7('0x44')]:_0x9820ac[_0x38a7('0xcf')];_0x5084a2[_0x38a7('0xd5')]=qs['sort'](_0x309125[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x5084a2[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x309125[_0x38a7('0x48')],_0x9820ac[_0x38a7('0xd2')]));if(_0x309125[_0x38a7('0x48')][_0x38a7('0x38')]){_0x5084a2['where']=_['merge'](_0x5084a2[_0x38a7('0x3e')],{'$or':_['map'](_0x5084a2[_0x38a7('0x44')],function(_0x20dd44){var _0x464b7a={};_0x464b7a[_0x20dd44]={'$like':'%'+_0x309125[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x464b7a;})});}_0x5084a2=_['merge']({},_0x5084a2,_0x309125[_0x38a7('0x54')]);return _0x561e00['getVoiceQueuesRt'](_0x5084a2);}})[_0x38a7('0x21')](function(_0x4a14d8){if(_0x4a14d8){_0x267ae0=_0x4a14d8[_0x38a7('0x64')];if(!_0x309125[_0x38a7('0x48')][_0x38a7('0xc7')]('nolimit')){_0x5084a2[_0x38a7('0x1b')]=qs['limit'](_0x309125[_0x38a7('0x48')][_0x38a7('0x1b')]);_0x5084a2[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x309125[_0x38a7('0x48')]['offset']);}return _0x561e00[_0x38a7('0xda')](_0x5084a2);}})['then'](function(_0x28b96f){if(_0x28b96f){return _0x28b96f?{'count':_0x267ae0,'rows':_0x28b96f}:null;}})[_0x38a7('0x21')](respondWithResult(_0x4e2980,null))[_0x38a7('0x4f')](handleError(_0x4e2980,null));};exports['getGroups']=function(_0x471410,_0x4a07bc){var _0xab6de9={};var _0xf08cd6={};var _0x4b9116;var _0x1202db;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x471410[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a07bc,null))[_0x38a7('0x21')](function(_0x2017cc){if(_0x2017cc){_0x4b9116=_0x2017cc;_0xf08cd6[_0x38a7('0xcf')]=_['keys'](db['ChatGroup']['rawAttributes']);_0xf08cd6[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x471410[_0x38a7('0x48')]);_0xf08cd6[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0xf08cd6[_0x38a7('0xcf')],_0xf08cd6['query']);_0xab6de9['attributes']=_[_0x38a7('0xd3')](_0xf08cd6[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x471410[_0x38a7('0x48')][_0x38a7('0xd4')]));_0xab6de9[_0x38a7('0x44')]=_0xab6de9[_0x38a7('0x44')][_0x38a7('0x64')]?_0xab6de9[_0x38a7('0x44')]:_0xf08cd6[_0x38a7('0xcf')];_0xab6de9[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x471410[_0x38a7('0x48')][_0x38a7('0xd6')]);_0xab6de9[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_['pick'](_0x471410['query'],_0xf08cd6[_0x38a7('0xd2')]));if(_0x471410['query'][_0x38a7('0x38')]){_0xab6de9['where']=_[_0x38a7('0xd8')](_0xab6de9['where'],{'$or':_[_0x38a7('0x2d')](_0xab6de9[_0x38a7('0x44')],function(_0x5adf4f){var _0x146b5d={};_0x146b5d[_0x5adf4f]={'$like':'%'+_0x471410[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x146b5d;})});}_0xab6de9=_['merge']({},_0xab6de9,_0x471410['options']);return _0x4b9116[_0x38a7('0xdb')](_0xab6de9);}})[_0x38a7('0x21')](function(_0xb0e647){if(_0xb0e647){_0x1202db=_0xb0e647[_0x38a7('0x64')];if(!_0x471410[_0x38a7('0x48')]['hasOwnProperty']('nolimit')){_0xab6de9[_0x38a7('0x1b')]=qs['limit'](_0x471410['query'][_0x38a7('0x1b')]);_0xab6de9[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x471410['query'][_0x38a7('0x1a')]);}return _0x4b9116['getGroups'](_0xab6de9);}})[_0x38a7('0x21')](function(_0x4fe17e){if(_0x4fe17e){return _0x4fe17e?{'count':_0x1202db,'rows':_0x4fe17e}:null;}})['then'](respondWithResult(_0x4a07bc,null))[_0x38a7('0x4f')](handleError(_0x4a07bc,null));};exports[_0x38a7('0xdc')]=function(_0x39915b,_0x2c9483){var _0xf3eb87={'raw':!![],'where':{}};var _0x358871={};var _0x17a01d={'count':0x0,'rows':[]};return db[_0x38a7('0x3f')]['findOne']({'where':{'id':_0x39915b[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c9483,null))['then'](function(_0x57179f){if(_0x57179f){_0x358871['model']=_[_0x38a7('0xd0')](db[_0x38a7('0xdd')][_0x38a7('0x34')]);_0x358871[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x39915b['query']);_0x358871[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x358871[_0x38a7('0xcf')],_0x358871[_0x38a7('0x48')]);_0xf3eb87[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x358871[_0x38a7('0xcf')],qs['fields'](_0x39915b[_0x38a7('0x48')][_0x38a7('0xd4')]));_0xf3eb87[_0x38a7('0x44')]=_0xf3eb87[_0x38a7('0x44')]['length']?_0xf3eb87[_0x38a7('0x44')]:_0x358871[_0x38a7('0xcf')];if(!_0x39915b[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0xf3eb87['limit']=qs[_0x38a7('0x1b')](_0x39915b['query']['limit']);_0xf3eb87[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x39915b[_0x38a7('0x48')]['offset']);}_0xf3eb87[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x39915b[_0x38a7('0x48')]['sort']);_0xf3eb87[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x39915b[_0x38a7('0x48')],_0x358871['filters']));_0xf3eb87[_0x38a7('0x3e')]['UserId']=_0x57179f['id'];if(_0x39915b[_0x38a7('0x48')]['filter']){_0xf3eb87[_0x38a7('0x3e')]=_[_0x38a7('0xd8')](_0xf3eb87[_0x38a7('0x3e')],{'$or':_['map'](_0xf3eb87[_0x38a7('0x44')],function(_0x3bf19a){var _0xad3865={};_0xad3865[_0x3bf19a]={'$like':'%'+_0x39915b[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0xad3865;})});}_0xf3eb87=_[_0x38a7('0xd8')]({},_0xf3eb87,_0x39915b[_0x38a7('0x54')]);return db['VoiceRecording'][_0x38a7('0x1d')]({'where':_0xf3eb87[_0x38a7('0x3e')]})[_0x38a7('0x21')](function(_0x5a2b38){_0x17a01d['count']=_0x5a2b38;if(_0x39915b[_0x38a7('0x48')][_0x38a7('0x53')]){_0xf3eb87[_0x38a7('0x40')]=[{'all':!![]}];}return db[_0x38a7('0xdd')][_0x38a7('0x46')](_0xf3eb87);})[_0x38a7('0x21')](function(_0x31dc9f){_0x17a01d['rows']=_0x31dc9f;return _0x17a01d;});}})['then'](respondWithFilteredResult(_0x2c9483,_0xf3eb87))['catch'](handleError(_0x2c9483,null));};exports[_0x38a7('0xdf')]=function(_0x34d51d,_0x2edb6a){var _0x1b6b42={'raw':!![],'where':{}};var _0x3ef3c1={};var _0x5e5568={'count':0x0,'rows':[]};return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x34d51d['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x2edb6a,null))['then'](function(_0x20a42d){if(_0x20a42d){_0x3ef3c1['model']=_[_0x38a7('0xd0')](db[_0x38a7('0xe0')][_0x38a7('0x34')]);_0x3ef3c1[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x34d51d[_0x38a7('0x48')]);_0x3ef3c1[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x3ef3c1[_0x38a7('0xcf')],_0x3ef3c1[_0x38a7('0x48')]);_0x1b6b42[_0x38a7('0x44')]=_['intersection'](_0x3ef3c1[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x34d51d[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x1b6b42[_0x38a7('0x44')]=_0x1b6b42[_0x38a7('0x44')][_0x38a7('0x64')]?_0x1b6b42[_0x38a7('0x44')]:_0x3ef3c1['model'];if(!_0x34d51d[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x1b6b42[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x34d51d[_0x38a7('0x48')][_0x38a7('0x1b')]);_0x1b6b42['offset']=qs[_0x38a7('0x1a')](_0x34d51d[_0x38a7('0x48')][_0x38a7('0x1a')]);}_0x1b6b42[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x34d51d[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x1b6b42[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_['pick'](_0x34d51d[_0x38a7('0x48')],_0x3ef3c1[_0x38a7('0xd2')]));_0x1b6b42['where'][_0x38a7('0xe1')]=_0x20a42d['id'];if(_0x34d51d['query'][_0x38a7('0x38')]){_0x1b6b42[_0x38a7('0x3e')]=_[_0x38a7('0xd8')](_0x1b6b42['where'],{'$or':_[_0x38a7('0x2d')](_0x1b6b42[_0x38a7('0x44')],function(_0x42085a){var _0x165aae={};_0x165aae[_0x42085a]={'$like':'%'+_0x34d51d[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x165aae;})});}_0x1b6b42=_[_0x38a7('0xd8')]({},_0x1b6b42,_0x34d51d[_0x38a7('0x54')]);return db[_0x38a7('0xe0')]['count']({'where':_0x1b6b42['where']})[_0x38a7('0x21')](function(_0x42549f){_0x5e5568[_0x38a7('0x1d')]=_0x42549f;if(_0x34d51d[_0x38a7('0x48')]['includeAll']){_0x1b6b42['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x38a7('0x46')](_0x1b6b42);})['then'](function(_0x56a794){_0x5e5568[_0x38a7('0x47')]=_0x56a794;return _0x5e5568;});}})[_0x38a7('0x21')](respondWithFilteredResult(_0x2edb6a,_0x1b6b42))[_0x38a7('0x4f')](handleError(_0x2edb6a,null));};exports[_0x38a7('0xe2')]=function(_0xc28393,_0x437cb5){var _0x1cc033={};var _0x40713f={};var _0x15804c;var _0x360870;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0xc28393[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x437cb5,null))['then'](function(_0x15a9cd){if(_0x15a9cd){_0x15804c=_0x15a9cd;_0x40713f[_0x38a7('0xcf')]=_['keys'](db['ChatInteraction'][_0x38a7('0x34')]);_0x40713f[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0xc28393[_0x38a7('0x48')]);_0x40713f[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x40713f['model'],_0x40713f[_0x38a7('0x48')]);_0x1cc033['attributes']=_[_0x38a7('0xd3')](_0x40713f['model'],qs[_0x38a7('0xd4')](_0xc28393[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x1cc033[_0x38a7('0x44')]=_0x1cc033['attributes'][_0x38a7('0x64')]?_0x1cc033[_0x38a7('0x44')]:_0x40713f[_0x38a7('0xcf')];_0x1cc033[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0xc28393['query']['sort']);_0x1cc033[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0xc28393['query'],_0x40713f[_0x38a7('0xd2')]));if(_0xc28393[_0x38a7('0x48')]['filter']){_0x1cc033[_0x38a7('0x3e')]=_['merge'](_0x1cc033[_0x38a7('0x3e')],{'$or':_['map'](_0x1cc033['attributes'],function(_0x574fd7){var _0xd74c04={};_0xd74c04[_0x574fd7]={'$like':'%'+_0xc28393[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0xd74c04;})});}_0x1cc033=_[_0x38a7('0xd8')]({},_0x1cc033,_0xc28393[_0x38a7('0x54')]);return _0x15804c[_0x38a7('0xe2')](_0x1cc033);}})[_0x38a7('0x21')](function(_0x5ad833){if(_0x5ad833){_0x360870=_0x5ad833[_0x38a7('0x64')];if(!_0xc28393[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x1cc033[_0x38a7('0x1b')]=qs['limit'](_0xc28393[_0x38a7('0x48')][_0x38a7('0x1b')]);_0x1cc033['offset']=qs[_0x38a7('0x1a')](_0xc28393[_0x38a7('0x48')][_0x38a7('0x1a')]);}return _0x15804c[_0x38a7('0xe2')](_0x1cc033);}})['then'](function(_0x5065a8){if(_0x5065a8){return _0x5065a8?{'count':_0x360870,'rows':_0x5065a8}:null;}})['then'](respondWithResult(_0x437cb5,null))['catch'](handleError(_0x437cb5,null));};exports['getOpenchannelInteractions']=function(_0x25e4d9,_0x4d56ee){var _0x1d5610={};var _0x5c91bd={};var _0x3c6d59;var _0x331db3;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x25e4d9['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x4d56ee,null))[_0x38a7('0x21')](function(_0x53cf85){if(_0x53cf85){_0x3c6d59=_0x53cf85;_0x5c91bd[_0x38a7('0xcf')]=_['keys'](db['OpenchannelInteraction'][_0x38a7('0x34')]);_0x5c91bd[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x25e4d9[_0x38a7('0x48')]);_0x5c91bd[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x5c91bd[_0x38a7('0xcf')],_0x5c91bd['query']);_0x1d5610[_0x38a7('0x44')]=_['intersection'](_0x5c91bd[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x25e4d9[_0x38a7('0x48')]['fields']));_0x1d5610[_0x38a7('0x44')]=_0x1d5610[_0x38a7('0x44')][_0x38a7('0x64')]?_0x1d5610['attributes']:_0x5c91bd[_0x38a7('0xcf')];_0x1d5610[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x25e4d9[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x1d5610[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x25e4d9[_0x38a7('0x48')],_0x5c91bd[_0x38a7('0xd2')]));if(_0x25e4d9[_0x38a7('0x48')]['filter']){_0x1d5610[_0x38a7('0x3e')]=_[_0x38a7('0xd8')](_0x1d5610[_0x38a7('0x3e')],{'$or':_['map'](_0x1d5610[_0x38a7('0x44')],function(_0x59c2c0){var _0x4e63c7={};_0x4e63c7[_0x59c2c0]={'$like':'%'+_0x25e4d9['query'][_0x38a7('0x38')]+'%'};return _0x4e63c7;})});}_0x1d5610=_['merge']({},_0x1d5610,_0x25e4d9['options']);return _0x3c6d59[_0x38a7('0xe3')](_0x1d5610);}})[_0x38a7('0x21')](function(_0x2b6aa6){if(_0x2b6aa6){_0x331db3=_0x2b6aa6[_0x38a7('0x64')];if(!_0x25e4d9[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x1d5610[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x25e4d9['query']['limit']);_0x1d5610[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x25e4d9['query']['offset']);}return _0x3c6d59['getOpenchannelInteractions'](_0x1d5610);}})[_0x38a7('0x21')](function(_0x459908){if(_0x459908){return _0x459908?{'count':_0x331db3,'rows':_0x459908}:null;}})[_0x38a7('0x21')](respondWithResult(_0x4d56ee,null))[_0x38a7('0x4f')](handleError(_0x4d56ee,null));};exports[_0x38a7('0xe4')]=function(_0x5856be,_0x3a897a){var _0x598efc={'raw':!![],'where':{}};var _0x579f22={};var _0x17951b={'count':0x0,'rows':[]};return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x5856be[_0x38a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a897a,null))[_0x38a7('0x21')](function(_0x500770){if(_0x500770){_0x579f22[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db[_0x38a7('0xe5')]['rawAttributes']);_0x579f22['query']=_[_0x38a7('0xd0')](_0x5856be[_0x38a7('0x48')]);_0x579f22[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x579f22[_0x38a7('0xcf')],_0x579f22[_0x38a7('0x48')]);_0x598efc[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x579f22[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x5856be[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x598efc['attributes']=_0x598efc[_0x38a7('0x44')][_0x38a7('0x64')]?_0x598efc[_0x38a7('0x44')]:_0x579f22[_0x38a7('0xcf')];if(!_0x5856be[_0x38a7('0x48')][_0x38a7('0xc7')]('nolimit')){_0x598efc['limit']=qs[_0x38a7('0x1b')](_0x5856be[_0x38a7('0x48')]['limit']);_0x598efc[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x5856be['query']['offset']);}_0x598efc[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x5856be[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x598efc[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x5856be[_0x38a7('0x48')],_0x579f22[_0x38a7('0xd2')]));_0x598efc['where']['UserId']=_0x500770['id'];if(_0x5856be[_0x38a7('0x48')][_0x38a7('0x38')]){_0x598efc['where']=_[_0x38a7('0xd8')](_0x598efc[_0x38a7('0x3e')],{'$or':_[_0x38a7('0x2d')](_0x598efc[_0x38a7('0x44')],function(_0x587e28){var _0x521b9e={};_0x521b9e[_0x587e28]={'$like':'%'+_0x5856be[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x521b9e;})});}_0x598efc=_[_0x38a7('0xd8')]({},_0x598efc,_0x5856be[_0x38a7('0x54')]);return db[_0x38a7('0xe5')]['count']({'where':_0x598efc[_0x38a7('0x3e')]})[_0x38a7('0x21')](function(_0x4c0385){_0x17951b[_0x38a7('0x1d')]=_0x4c0385;if(_0x5856be['query']['includeAll']){_0x598efc[_0x38a7('0x40')]=[{'all':!![]}];}return db[_0x38a7('0xe5')][_0x38a7('0x46')](_0x598efc);})[_0x38a7('0x21')](function(_0x20adc4){_0x17951b['rows']=_0x20adc4;return _0x17951b;});}})[_0x38a7('0x21')](respondWithFilteredResult(_0x3a897a,_0x598efc))[_0x38a7('0x4f')](handleError(_0x3a897a,null));};exports[_0x38a7('0xe6')]=function(_0x3cb48a,_0x5e19ed){var _0xf2142b={};var _0x468fa5={};var _0xad7ec;var _0x133603;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x3cb48a[_0x38a7('0x51')]['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x5e19ed,null))[_0x38a7('0x21')](function(_0x54a8a0){if(_0x54a8a0){_0xad7ec=_0x54a8a0;_0x468fa5['model']=_[_0x38a7('0xd0')](db['SmsInteraction'][_0x38a7('0x34')]);_0x468fa5[_0x38a7('0x48')]=_['keys'](_0x3cb48a[_0x38a7('0x48')]);_0x468fa5[_0x38a7('0xd2')]=_['intersection'](_0x468fa5[_0x38a7('0xcf')],_0x468fa5['query']);_0xf2142b[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x468fa5[_0x38a7('0xcf')],qs['fields'](_0x3cb48a[_0x38a7('0x48')]['fields']));_0xf2142b[_0x38a7('0x44')]=_0xf2142b[_0x38a7('0x44')][_0x38a7('0x64')]?_0xf2142b[_0x38a7('0x44')]:_0x468fa5[_0x38a7('0xcf')];_0xf2142b[_0x38a7('0xd5')]=qs['sort'](_0x3cb48a[_0x38a7('0x48')][_0x38a7('0xd6')]);_0xf2142b[_0x38a7('0x3e')]=qs['filters'](_[_0x38a7('0xd7')](_0x3cb48a[_0x38a7('0x48')],_0x468fa5[_0x38a7('0xd2')]));if(_0x3cb48a[_0x38a7('0x48')][_0x38a7('0x38')]){_0xf2142b[_0x38a7('0x3e')]=_['merge'](_0xf2142b[_0x38a7('0x3e')],{'$or':_[_0x38a7('0x2d')](_0xf2142b[_0x38a7('0x44')],function(_0x7f9313){var _0x39cfdd={};_0x39cfdd[_0x7f9313]={'$like':'%'+_0x3cb48a[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x39cfdd;})});}_0xf2142b=_[_0x38a7('0xd8')]({},_0xf2142b,_0x3cb48a[_0x38a7('0x54')]);return _0xad7ec[_0x38a7('0xe6')](_0xf2142b);}})[_0x38a7('0x21')](function(_0x5ca756){if(_0x5ca756){_0x133603=_0x5ca756[_0x38a7('0x64')];if(!_0x3cb48a[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0xf2142b[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x3cb48a[_0x38a7('0x48')][_0x38a7('0x1b')]);_0xf2142b['offset']=qs[_0x38a7('0x1a')](_0x3cb48a['query'][_0x38a7('0x1a')]);}return _0xad7ec[_0x38a7('0xe6')](_0xf2142b);}})[_0x38a7('0x21')](function(_0x47d40e){if(_0x47d40e){return _0x47d40e?{'count':_0x133603,'rows':_0x47d40e}:null;}})['then'](respondWithResult(_0x5e19ed,null))[_0x38a7('0x4f')](handleError(_0x5e19ed,null));};exports[_0x38a7('0xe7')]=function(_0xc3b4c4,_0x44975c){var _0x5bb269={};var _0x470487={};var _0x58e52e;var _0x3ffc7a;return db['User'][_0x38a7('0x92')]({'where':{'id':_0xc3b4c4[_0x38a7('0x51')]['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x44975c,null))[_0x38a7('0x21')](function(_0x5b242b){if(_0x5b242b){_0x58e52e=_0x5b242b;_0x470487[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db[_0x38a7('0xe8')][_0x38a7('0x34')]);_0x470487[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0xc3b4c4[_0x38a7('0x48')]);_0x470487[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x470487['model'],_0x470487[_0x38a7('0x48')]);_0x5bb269[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x470487[_0x38a7('0xcf')],qs['fields'](_0xc3b4c4[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x5bb269['attributes']=_0x5bb269[_0x38a7('0x44')][_0x38a7('0x64')]?_0x5bb269[_0x38a7('0x44')]:_0x470487[_0x38a7('0xcf')];_0x5bb269['order']=qs[_0x38a7('0xd6')](_0xc3b4c4[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x5bb269[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0xc3b4c4[_0x38a7('0x48')],_0x470487[_0x38a7('0xd2')]));if(_0xc3b4c4[_0x38a7('0x48')]['filter']){_0x5bb269['where']=_[_0x38a7('0xd8')](_0x5bb269[_0x38a7('0x3e')],{'$or':_[_0x38a7('0x2d')](_0x5bb269[_0x38a7('0x44')],function(_0x5c0ef0){var _0x3ab79c={};_0x3ab79c[_0x5c0ef0]={'$like':'%'+_0xc3b4c4[_0x38a7('0x48')]['filter']+'%'};return _0x3ab79c;})});}_0x5bb269=_[_0x38a7('0xd8')]({},_0x5bb269,_0xc3b4c4['options']);return _0x58e52e[_0x38a7('0xe7')](_0x5bb269);}})[_0x38a7('0x21')](function(_0x1a0ddf){if(_0x1a0ddf){_0x3ffc7a=_0x1a0ddf[_0x38a7('0x64')];if(!_0xc3b4c4[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x5bb269[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0xc3b4c4['query'][_0x38a7('0x1b')]);_0x5bb269[_0x38a7('0x1a')]=qs['offset'](_0xc3b4c4[_0x38a7('0x48')][_0x38a7('0x1a')]);}return _0x58e52e['getFaxInteractions'](_0x5bb269);}})['then'](function(_0x337484){if(_0x337484){return _0x337484?{'count':_0x3ffc7a,'rows':_0x337484}:null;}})[_0x38a7('0x21')](respondWithResult(_0x44975c,null))[_0x38a7('0x4f')](handleError(_0x44975c,null));};exports[_0x38a7('0xe9')]=function(_0x425ab9,_0x2dffab){var _0x334c5e={};var _0x12c9b6={};var _0x4e3d1d;var _0x2142e4;return db['User']['findOne']({'where':{'id':_0x425ab9['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x2dffab,null))['then'](function(_0x1406e7){if(_0x1406e7){_0x4e3d1d=_0x1406e7;_0x12c9b6[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db[_0x38a7('0xea')][_0x38a7('0x34')]);_0x12c9b6[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x425ab9[_0x38a7('0x48')]);_0x12c9b6['filters']=_[_0x38a7('0xd3')](_0x12c9b6[_0x38a7('0xcf')],_0x12c9b6[_0x38a7('0x48')]);_0x334c5e[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x12c9b6[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x425ab9['query'][_0x38a7('0xd4')]));_0x334c5e[_0x38a7('0x44')]=_0x334c5e[_0x38a7('0x44')][_0x38a7('0x64')]?_0x334c5e[_0x38a7('0x44')]:_0x12c9b6[_0x38a7('0xcf')];_0x334c5e[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x425ab9[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x334c5e['where']=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x425ab9[_0x38a7('0x48')],_0x12c9b6[_0x38a7('0xd2')]));if(_0x425ab9[_0x38a7('0x48')][_0x38a7('0x38')]){_0x334c5e[_0x38a7('0x3e')]=_['merge'](_0x334c5e[_0x38a7('0x3e')],{'$or':_[_0x38a7('0x2d')](_0x334c5e[_0x38a7('0x44')],function(_0x36fca7){var _0x5c6a7a={};_0x5c6a7a[_0x36fca7]={'$like':'%'+_0x425ab9[_0x38a7('0x48')]['filter']+'%'};return _0x5c6a7a;})});}_0x334c5e=_[_0x38a7('0xd8')]({},_0x334c5e,_0x425ab9['options']);return _0x4e3d1d[_0x38a7('0xe9')](_0x334c5e);}})[_0x38a7('0x21')](function(_0x39b0ff){if(_0x39b0ff){_0x2142e4=_0x39b0ff[_0x38a7('0x64')];if(!_0x425ab9[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x334c5e[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x425ab9[_0x38a7('0x48')]['limit']);_0x334c5e[_0x38a7('0x1a')]=qs['offset'](_0x425ab9[_0x38a7('0x48')][_0x38a7('0x1a')]);}return _0x4e3d1d[_0x38a7('0xe9')](_0x334c5e);}})[_0x38a7('0x21')](function(_0x11ac7b){if(_0x11ac7b){return _0x11ac7b?{'count':_0x2142e4,'rows':_0x11ac7b}:null;}})[_0x38a7('0x21')](respondWithResult(_0x2dffab,null))['catch'](handleError(_0x2dffab,null));};exports[_0x38a7('0xeb')]=function(_0xc74e37,_0x547e38,_0xbafe5){var _0x4c06f5;var _0x520c64;var _0x940935;var _0x5808b=!_[_0x38a7('0x5f')](_0xc74e37['params']['id'])?_0xc74e37[_0x38a7('0x51')]['id']:!_[_0x38a7('0x5f')](_0xc74e37['user']['id'])?_0xc74e37[_0x38a7('0x79')]['id']:null;return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0x5808b,'role':{'$or':[_0x38a7('0x28'),_0x38a7('0x79'),_0x38a7('0x22')]}},'attributes':['id','name',_0x38a7('0xec'),_0x38a7('0xed'),_0x38a7('0x27'),_0x38a7('0x5a'),_0x38a7('0x9a')]})[_0x38a7('0x21')](function(_0x57958c){if(_0x57958c){if(_0x57958c['role']===_0x38a7('0x22')){_0x4c06f5=_0x57958c;if(_0xc74e37['body']['interface']){_0x940935=util[_0x38a7('0xee')](_0x38a7('0xef'),_0x4c06f5[_0xc74e37[_0x38a7('0x56')][_0x38a7('0x9c')]]);}else if(_0xc74e37[_0x38a7('0x56')]['intrf']){_0x940935=util[_0x38a7('0xee')]('SIP/%s',_0xc74e37[_0x38a7('0x56')][_0x38a7('0xf0')]);}else{_0x940935=util['format'](_0x38a7('0xf1'),_0x4c06f5[_0x38a7('0x33')]);}socket['to'](util['format'](_0x38a7('0xf2'),_0x4c06f5['name']))[_0x38a7('0x23')](_0x38a7('0xf3'),{'user':{'id':_0x4c06f5['id'],'name':_0x4c06f5[_0x38a7('0x33')]},'ip':_0xc74e37[_0x38a7('0xf4')][_0x38a7('0xf5')]||_0xc74e37[_0x38a7('0xf6')][_0x38a7('0xf7')]||_0xc74e37[_0x38a7('0xf8')][_0x38a7('0xf7')]||_0xc74e37[_0x38a7('0xf6')][_0x38a7('0xf8')][_0x38a7('0xf7')]});return db[_0x38a7('0xa6')][_0x38a7('0x25')]({'where':{'membername':_0x4c06f5[_0x38a7('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x38a7('0x8c'))][(_0x38a7('0x8d'))](_0x38a7('0xf9'));}})['then'](function(){if(_0x4c06f5){return _0x4c06f5[_0x38a7('0xfa')]({'raw':!![]});}})[_0x38a7('0x21')](function(_0x4e14d7){if(_0x4c06f5){if(_0x4e14d7){_0x520c64=_0x4e14d7;if(_0x520c64['length']){var _0x4d1ba9=_0x520c64[_0x38a7('0x2d')](function(_0x3ac931){var _0x1c5d5c={'membername':_0x4c06f5[_0x38a7('0x33')],'UserId':_0x4c06f5['id'],'queue_name':_0x3ac931[_0x38a7('0x33')],'VoiceQueueId':_0x3ac931['id'],'interface':_0x940935,'paused':_0x4c06f5['loginInPause']||![],'penalty':_0x3ac931[_0x38a7('0xfb')]||0x0};return db[_0x38a7('0xa6')][_0x38a7('0xa7')](_0x1c5d5c);});return Promise[_0x38a7('0x55')](_0x4d1ba9);}}}})[_0x38a7('0x21')](function(){if(_0x4c06f5){return db[_0x38a7('0xfc')][_0x38a7('0x46')]({'where':{'membername':_0x4c06f5[_0x38a7('0x33')],'exitAt':null}});}})[_0x38a7('0x21')](function(_0x4d67c4){if(_0x4c06f5){var _0x25355f=[];_0x4d67c4[_0x38a7('0xfd')](function(_0x55fd48){_0x25355f[_0x38a7('0x45')](_0x55fd48[_0x38a7('0x20')]({'exitAt':moment()[_0x38a7('0xee')](_0x38a7('0xfe'))}));});return Promise[_0x38a7('0x55')](_0x25355f);}})[_0x38a7('0x21')](function(){if(_0x4c06f5){var _0x477b51=[];var _0x414895=[];var _0x36c1ad=utils[_0x38a7('0xff')]();var _0x42cb17={'membername':_0x4c06f5[_0x38a7('0x33')],'interface':_0x940935,'enterAt':moment()[_0x38a7('0xee')](_0x38a7('0xfe')),'role':_0x4c06f5['role'],'internal':_0x4c06f5['internal']};_0x36c1ad[_0x38a7('0xfd')](function(_0x47ddf1){_0x477b51[_0x38a7('0x45')](_['merge']({'channel':_0x47ddf1,'type':_0x38a7('0x100'),'data1':_0xc74e37[_0x38a7('0x56')][_0x38a7('0x101')],'data2':_0x940935},_0x42cb17));if(_0x4c06f5['loginInPause']){_0x414895[_0x38a7('0x45')](_['merge']({'channel':_0x47ddf1,'type':'PAUSE','data1':_0x38a7('0x102')},_0x42cb17));}});return db[_0x38a7('0xfc')][_0x38a7('0x83')](_0x477b51[_0x38a7('0xc4')](_0x414895),{'individualHooks':!![]});}})[_0x38a7('0x21')](function(){if(_0x4c06f5){return _0x4c06f5[_0x38a7('0x20')]({'online':!![],'lastLoginAt':moment()['format'](_0x38a7('0xfe')),'voicePause':_0x4c06f5[_0x38a7('0x9a')]||![],'mailPause':_0x4c06f5['loginInPause']||![],'chatPause':_0x4c06f5[_0x38a7('0x9a')]||![],'faxPause':_0x4c06f5[_0x38a7('0x9a')]||![],'smsPause':_0x4c06f5[_0x38a7('0x9a')]||![],'openchannelPause':_0x4c06f5[_0x38a7('0x9a')]||![],'whatsappPause':_0x4c06f5[_0x38a7('0x9a')]||![],'pauseType':_0x4c06f5['loginInPause']?_0x38a7('0x102'):null,'interface':_0x940935,'lastPauseAt':moment()[_0x38a7('0xee')](_0x38a7('0xfe'))});}})[_0x38a7('0x21')](function(_0x5deea1){if(_0xc74e37[_0x38a7('0x103')]){return _0xbafe5();}else{return Promise[_0x38a7('0x104')](_0x5deea1)['then'](respondWithResult(_0x547e38,null));}})[_0x38a7('0x4f')](handleError(_0x547e38,null));};exports[_0x38a7('0x105')]=function(_0x265b80,_0x50db09){var _0x53d625;return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0x265b80[_0x38a7('0x51')]['id'],'role':_0x38a7('0x22')},'attributes':['id',_0x38a7('0x33'),_0x38a7('0x27')]})['then'](handleEntityNotFound(_0x50db09,null))['then'](function(_0xd78077){if(_0xd78077){_0x53d625=_0xd78077;return db['UserVoiceQueueRt'][_0x38a7('0x25')]({'where':{'membername':_0x53d625[_0x38a7('0x33')]},'individualHooks':!![]});}})['then'](function(){return db[_0x38a7('0xfc')][_0x38a7('0x46')]({'where':{'membername':_0x53d625['name'],'exitAt':null}});})[_0x38a7('0x21')](function(_0x4a83dc){var _0x16ac9c=[];_0x4a83dc[_0x38a7('0xfd')](function(_0x1e384b){_0x16ac9c[_0x38a7('0x45')](_0x1e384b[_0x38a7('0x20')]({'exitAt':moment()[_0x38a7('0xee')](_0x38a7('0xfe'))}));});return Promise[_0x38a7('0x55')](_0x16ac9c);})[_0x38a7('0x21')](function(){return _0x53d625[_0x38a7('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x38a7('0x21')](respondWithResult(_0x50db09,null))[_0x38a7('0x4f')](handleError(_0x50db09,null));};exports[_0x38a7('0x106')]=function(_0x1f34c2,_0x4702e1){var _0x3edac8;return db[_0x38a7('0xa6')]['update']({'paused':0x1},{'where':{'UserId':_0x1f34c2[_0x38a7('0x51')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x38a7('0x3f')][_0x38a7('0x30')]({'where':{'id':_0x1f34c2['params']['id'],'role':'agent'},'attributes':['id',_0x38a7('0x33'),_0x38a7('0x27'),_0x38a7('0x5a'),'interface',_0x38a7('0x99')]});})['then'](handleEntityNotFound(_0x4702e1,null))[_0x38a7('0x21')](function(_0x129b5c){if(_0x129b5c){_0x3edac8=_0x129b5c;return db[_0x38a7('0xfc')]['findAll']({'where':{'membername':_0x3edac8['name'],'type':_0x38a7('0x107'),'exitAt':null}});}})[_0x38a7('0x21')](function(_0x38292f){if(_0x38292f['length']){var _0x531bc5=moment()[_0x38a7('0xee')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x456af0=0x0,_0x382bdc=_0x38292f[_0x38a7('0x64')];_0x456af0<_0x382bdc;_0x456af0++){_0x38292f[_0x456af0][_0x38a7('0x108')]({'exitAt':_0x531bc5});}}})[_0x38a7('0x21')](function(){var _0x33dcca=[];var _0xa27918=utils[_0x38a7('0xff')]();_0xa27918[_0x38a7('0xfd')](function(_0x1785b6){_0x33dcca[_0x38a7('0x45')]({'channel':_0x1785b6,'membername':_0x3edac8[_0x38a7('0x33')],'interface':_[_0x38a7('0x5f')](_0x3edac8['interface'])?util[_0x38a7('0xee')]('SIP/%s',_0x3edac8[_0x38a7('0x33')]):_0x3edac8[_0x38a7('0x9c')],'type':'PAUSE','enterAt':moment()[_0x38a7('0xee')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1f34c2[_0x38a7('0x56')][_0x38a7('0x36')]||_0x38a7('0x109'),'role':_0x3edac8[_0x38a7('0x27')],'internal':_0x3edac8['internal']});});return db[_0x38a7('0xfc')][_0x38a7('0x83')](_0x33dcca,{'individualHooks':!![]});})[_0x38a7('0x21')](function(){return _0x3edac8[_0x38a7('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1f34c2['body'][_0x38a7('0x36')]||_0x38a7('0x109'),'lastPauseAt':moment()[_0x38a7('0xee')](_0x38a7('0xfe'))});})[_0x38a7('0x21')](respondWithResult(_0x4702e1,null))[_0x38a7('0x4f')](handleError(_0x4702e1,null));};exports[_0x38a7('0x10a')]=function(_0x54041d,_0x2829c0){if(_0x54041d[_0x38a7('0x56')][_0x38a7('0xaa')]&&!utils['isValidChannel'](_0x54041d['body']['channel'])){throw new APIBadRequestError(util['format'](_0x38a7('0x10b'),_0x54041d[_0x38a7('0x56')][_0x38a7('0xaa')]));}return db['User']['find']({'where':{'id':_0x54041d[_0x38a7('0x51')]['id']},'attributes':['id',_0x38a7('0x33'),_0x38a7('0x27'),_0x38a7('0x5a'),_0x38a7('0x9c'),_0x38a7('0x99'),_0x38a7('0x9b'),'mailPause','chatPause',_0x38a7('0x10c'),'openchannelPause',_0x38a7('0x10d'),'whatsappPause','pauseType',_0x38a7('0x10e')]})[_0x38a7('0x21')](function(_0x3675f4){if(!_0x3675f4){throw new APINotFoundError(util[_0x38a7('0xee')](_0x38a7('0xc6'),_0x54041d[_0x38a7('0x51')]['id']));}return _0x3675f4[_0x38a7('0x10a')](_0x54041d[_0x38a7('0x56')]['channel']);})['then'](respondWithResult(_0x2829c0,null))[_0x38a7('0x4f')](APIHandleError(_0x2829c0));};exports['getTeams']=function(_0x26c7b3,_0x47b123){var _0x2a6461={};var _0x7f2bd5={};var _0x16d5ab;var _0x51ab87;return db[_0x38a7('0x3f')]['findOne']({'where':{'id':_0x26c7b3['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x47b123,null))[_0x38a7('0x21')](function(_0x3a6f2d){if(_0x3a6f2d){_0x16d5ab=_0x3a6f2d;_0x7f2bd5['model']=_[_0x38a7('0xd0')](db['Team'][_0x38a7('0x34')]);_0x7f2bd5[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x26c7b3['query']);_0x7f2bd5['filters']=_[_0x38a7('0xd3')](_0x7f2bd5['model'],_0x7f2bd5['query']);_0x2a6461[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x7f2bd5[_0x38a7('0xcf')],qs[_0x38a7('0xd4')](_0x26c7b3[_0x38a7('0x48')]['fields']));_0x2a6461[_0x38a7('0x44')]=_0x2a6461['attributes']['length']?_0x2a6461[_0x38a7('0x44')]:_0x7f2bd5['model'];_0x2a6461['order']=qs[_0x38a7('0xd6')](_0x26c7b3['query'][_0x38a7('0xd6')]);_0x2a6461[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_['pick'](_0x26c7b3[_0x38a7('0x48')],_0x7f2bd5[_0x38a7('0xd2')]));if(_0x26c7b3['query'][_0x38a7('0x38')]){_0x2a6461['where']=_[_0x38a7('0xd8')](_0x2a6461['where'],{'$or':_[_0x38a7('0x2d')](_0x2a6461[_0x38a7('0x44')],function(_0x1f70a5){var _0x39ace6={};_0x39ace6[_0x1f70a5]={'$like':'%'+_0x26c7b3[_0x38a7('0x48')][_0x38a7('0x38')]+'%'};return _0x39ace6;})});}_0x2a6461=_[_0x38a7('0xd8')]({},_0x2a6461,_0x26c7b3[_0x38a7('0x54')]);return _0x16d5ab[_0x38a7('0x10f')](_0x2a6461);}})['then'](function(_0x320fad){if(_0x320fad){_0x51ab87=_0x320fad[_0x38a7('0x64')];if(!_0x26c7b3[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x2a6461[_0x38a7('0x1b')]=qs[_0x38a7('0x1b')](_0x26c7b3[_0x38a7('0x48')]['limit']);_0x2a6461['offset']=qs[_0x38a7('0x1a')](_0x26c7b3['query'][_0x38a7('0x1a')]);}return _0x16d5ab[_0x38a7('0x10f')](_0x2a6461);}})[_0x38a7('0x21')](function(_0x1c59e0){if(_0x1c59e0){return _0x1c59e0?{'count':_0x51ab87,'rows':_0x1c59e0}:null;}})[_0x38a7('0x21')](respondWithResult(_0x47b123,null))[_0x38a7('0x4f')](handleError(_0x47b123,null));};exports[_0x38a7('0x110')]=function(_0x58dd85,_0x861c){var _0xe226ff=_0x58dd85[_0x38a7('0x51')]['id'];var _0x3213dc=_0x58dd85[_0x38a7('0x56')]?_0x58dd85[_0x38a7('0x56')]['ids']:null;var _0x3d445e=[];return Promise[_0x38a7('0x104')]()['then'](function(){if(!_0x3213dc)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x38a7('0x92')]({'where':{'id':_0xe226ff}});})['then'](function(_0x2312f7){if(!_0x2312f7)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x58dd85['params']['id']));return db['sequelize']['transaction'](function(_0x2fc6a7){return _0x2312f7[_0x38a7('0x110')](_0x3213dc,{'transaction':_0x2fc6a7})[_0x38a7('0x21')](function(){return db[_0x38a7('0x111')][_0x38a7('0x46')]({'where':{'id':{'$in':_0x3213dc}}});})[_0x38a7('0x21')](function(_0x430775){var _0x121871=_['map'](_0x430775,function(_0x2f5e67){return _0x2f5e67[_0x38a7('0x112')]();});return Promise[_0x38a7('0x55')](_0x121871);})[_0x38a7('0x21')](function(_0x28e065){_0x3d445e=_['flattenDeep'](_0x28e065);var _0x110878=_['map'](_0x3d445e,function(_0x587726){return _0x587726[_0x38a7('0x113')](_0x2312f7['id'],{'transaction':_0x2fc6a7});});return Promise[_0x38a7('0x55')](_0x110878);})['then'](function(){if(!_0x2312f7['online'])return;var _0xe23870=_['filter'](_0x3d445e,function(_0xa6d27e){return _0xa6d27e[_0x38a7('0x114')](_0x38a7('0xaa'))===_0x38a7('0x115');});var _0x53a65f=_[_0x38a7('0x2d')](_0xe23870,function(_0x10c6b4){return db[_0x38a7('0xa6')]['upsert']({'membername':_0x2312f7[_0x38a7('0x33')],'UserId':_0x2312f7['id'],'queue_name':_0x10c6b4[_0x38a7('0x33')],'VoiceQueueId':_0x10c6b4['id'],'interface':_[_0x38a7('0x5f')](_0x2312f7[_0x38a7('0x9c')])?util[_0x38a7('0xee')]('SIP/%s',_0x2312f7[_0x38a7('0x33')]):_0x2312f7[_0x38a7('0x9c')],'paused':_0x2312f7[_0x38a7('0x9b')]||![],'penalty':_0x2312f7[_0x38a7('0xa2')]},{'transaction':_0x2fc6a7});});return Promise['all'](_0x53a65f);})[_0x38a7('0x21')](function(){return db[_0x38a7('0x116')][_0x38a7('0x46')]({'where':{'teamId':{'$in':_0x3213dc}}});})[_0x38a7('0x21')](function(_0x3e52ab){var _0x48c000=_['map'](_0x3e52ab,function(_0x2737f4){return db[_0x38a7('0x117')][_0x38a7('0x78')]({'UserId':_0x2312f7['id'],'VoicePrefixId':_0x2737f4[_0x38a7('0x118')]},{'transaction':_0x2fc6a7});});return Promise[_0x38a7('0x55')](_0x48c000);});});})[_0x38a7('0x21')](function(){for(var _0x594783=0x0;_0x594783<_0x3d445e[_0x38a7('0x64')];_0x594783++){var _0x25485f=_0x3d445e[_0x594783][_0x38a7('0x114')](_0x38a7('0xaa'));var _0x2ea444=_0x25485f+_0x38a7('0xab');socket[_0x38a7('0x23')](_0x38a7('0x79')+_0x25485f+'Queue:save',{'UserId':_0xe226ff,['queueField']:_0x3d445e[_0x594783]['id']});}})[_0x38a7('0x21')](respondWithStatusCode(_0x861c,null))['catch'](APIHandleError(_0x861c));};exports['removeTeams']=function(_0x137291,_0x4a3837){var _0x44df3c=_0x137291['params']['id'];var _0x326a72=null;if(_0x137291['query'][_0x38a7('0x59')]){_0x326a72=_['isArray'](_0x137291[_0x38a7('0x48')]['ids'])?_0x137291[_0x38a7('0x48')][_0x38a7('0x59')]:[_0x137291[_0x38a7('0x48')]['ids']];}var _0x27f3e1=[];return Promise[_0x38a7('0x104')]()[_0x38a7('0x21')](function(){if(!_0x326a72)throw new APIBadRequestError(_0x38a7('0x119'));})[_0x38a7('0x21')](function(){return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x44df3c}});})[_0x38a7('0x21')](function(_0x200167){if(!_0x200167)throw new APINotFoundError(util[_0x38a7('0xee')](_0x38a7('0xc6'),_0x137291[_0x38a7('0x51')]['id']));return db[_0x38a7('0x61')]['transaction'](function(_0x38df46){return _0x200167[_0x38a7('0x11a')](_0x326a72,{'transaction':_0x38df46})[_0x38a7('0x21')](function(){return db[_0x38a7('0x111')][_0x38a7('0x46')]({'where':{'id':{'$in':_0x326a72}}});})['then'](function(_0x45a8ad){var _0x24b266=_[_0x38a7('0x2d')](_0x45a8ad,function(_0x46fcdb){return _0x46fcdb[_0x38a7('0x112')]();});return Promise['all'](_0x24b266);})[_0x38a7('0x21')](function(_0x4d8fdf){_0x27f3e1=_['flattenDeep'](_0x4d8fdf);var _0x4ae926=_['map'](_0x27f3e1,function(_0x290458){return _0x290458['removeAgent'](_0x200167['id'],{'transaction':_0x38df46});});return Promise[_0x38a7('0x55')](_0x4ae926);})[_0x38a7('0x21')](function(){if(!_0x200167[_0x38a7('0x99')])return;var _0x53a496=_[_0x38a7('0x38')](_0x27f3e1,function(_0xc1ea7d){return _0xc1ea7d['getDataValue'](_0x38a7('0xaa'))===_0x38a7('0x115');});var _0x34e5e5=_[_0x38a7('0x2d')](_0x53a496,function(_0x1e2c6a){return db[_0x38a7('0xa6')][_0x38a7('0x25')]({'where':{'VoiceQueueId':_0x1e2c6a['id'],'UserId':_0x200167['id']},'transaction':_0x38df46});});return Promise[_0x38a7('0x55')](_0x34e5e5);})[_0x38a7('0x21')](function(){return db[_0x38a7('0x116')][_0x38a7('0x46')]({'where':{'teamId':{'$in':_0x326a72}}});})[_0x38a7('0x21')](function(_0x58cf57){var _0x179667=_[_0x38a7('0x2d')](_0x58cf57,function(_0x1293f1){return db[_0x38a7('0x117')][_0x38a7('0x25')]({'where':{'UserId':_0x200167['id'],'VoicePrefixId':_0x1293f1[_0x38a7('0x118')]}},{'transaction':_0x38df46});});return Promise[_0x38a7('0x55')](_0x179667);});});})[_0x38a7('0x21')](function(){for(var _0x13b688=0x0;_0x13b688<_0x27f3e1[_0x38a7('0x64')];_0x13b688++){var _0xf4463d=_0x27f3e1[_0x13b688][_0x38a7('0x114')](_0x38a7('0xaa'));var _0x5e79b0=_0xf4463d+_0x38a7('0xab');socket[_0x38a7('0x23')](_0x38a7('0x79')+_0xf4463d+'Queue:remove',{'UserId':_0x44df3c,['queueField']:_0x27f3e1[_0x13b688]['id']});}})[_0x38a7('0x21')](respondWithStatusCode(_0x4a3837,null))[_0x38a7('0x4f')](APIHandleError(_0x4a3837));};exports['getLists']=function(_0x4ceed4,_0x2cdc96){var _0x40ec77={};var _0x4f5f98={};var _0x549608;var _0xdec061;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x4ceed4[_0x38a7('0x51')]['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x2cdc96,null))[_0x38a7('0x21')](function(_0x3e805b){if(_0x3e805b){_0x549608=_0x3e805b;_0x4f5f98[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db['CmList'][_0x38a7('0x34')]);_0x4f5f98[_0x38a7('0x48')]=_[_0x38a7('0xd0')](_0x4ceed4[_0x38a7('0x48')]);_0x4f5f98[_0x38a7('0xd2')]=_[_0x38a7('0xd3')](_0x4f5f98[_0x38a7('0xcf')],_0x4f5f98[_0x38a7('0x48')]);_0x40ec77[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x4f5f98['model'],qs[_0x38a7('0xd4')](_0x4ceed4['query']['fields']));_0x40ec77[_0x38a7('0x44')]=_0x40ec77[_0x38a7('0x44')][_0x38a7('0x64')]?_0x40ec77['attributes']:_0x4f5f98['model'];_0x40ec77[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x4ceed4['query'][_0x38a7('0xd6')]);_0x40ec77[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_['pick'](_0x4ceed4[_0x38a7('0x48')],_0x4f5f98[_0x38a7('0xd2')]));if(_0x4ceed4[_0x38a7('0x48')][_0x38a7('0x38')]){_0x40ec77['where']=_[_0x38a7('0xd8')](_0x40ec77[_0x38a7('0x3e')],{'$or':_['map'](_0x40ec77[_0x38a7('0x44')],function(_0x16bf90){var _0x48bc54={};_0x48bc54[_0x16bf90]={'$like':'%'+_0x4ceed4[_0x38a7('0x48')]['filter']+'%'};return _0x48bc54;})});}_0x40ec77=_[_0x38a7('0xd8')]({},_0x40ec77,_0x4ceed4[_0x38a7('0x54')]);return _0x549608[_0x38a7('0x11b')](_0x40ec77);}})[_0x38a7('0x21')](function(_0x3c24d5){if(_0x3c24d5){_0xdec061=_0x3c24d5[_0x38a7('0x64')];if(!_0x4ceed4[_0x38a7('0x48')][_0x38a7('0xc7')](_0x38a7('0xde'))){_0x40ec77[_0x38a7('0x1b')]=qs['limit'](_0x4ceed4['query'][_0x38a7('0x1b')]);_0x40ec77[_0x38a7('0x1a')]=qs[_0x38a7('0x1a')](_0x4ceed4[_0x38a7('0x48')][_0x38a7('0x1a')]);}return _0x549608[_0x38a7('0x11b')](_0x40ec77);}})[_0x38a7('0x21')](function(_0x4d38c7){if(_0x4d38c7){return _0x4d38c7?{'count':_0xdec061,'rows':_0x4d38c7}:null;}})['then'](respondWithResult(_0x2cdc96,null))['catch'](handleError(_0x2cdc96,null));};exports[_0x38a7('0x11c')]=function(_0x162984,_0x552cab){var _0x58c280={};var _0x4a8f8a={};var _0x477a8a;return db[_0x38a7('0x3f')][_0x38a7('0x92')]({'where':{'id':_0x162984['params']['id']}})[_0x38a7('0x21')](handleEntityNotFound(_0x552cab,null))[_0x38a7('0x21')](function(_0x24f4fd){if(_0x24f4fd){_0x477a8a=_0x24f4fd;_0x4a8f8a[_0x38a7('0xcf')]=_[_0x38a7('0xd0')](db[_0x38a7('0x3f')][_0x38a7('0x34')]);_0x4a8f8a['query']=_['keys'](_0x162984[_0x38a7('0x48')]);_0x4a8f8a['filters']=_['intersection'](_0x4a8f8a[_0x38a7('0xcf')],_0x4a8f8a[_0x38a7('0x48')]);_0x58c280[_0x38a7('0x44')]=_[_0x38a7('0xd3')](_0x4a8f8a[_0x38a7('0xcf')],qs['fields'](_0x162984[_0x38a7('0x48')][_0x38a7('0xd4')]));_0x58c280[_0x38a7('0x44')]=_0x58c280['attributes'][_0x38a7('0x64')]?_0x58c280[_0x38a7('0x44')]:_0x4a8f8a[_0x38a7('0xcf')];_0x58c280[_0x38a7('0xd5')]=qs[_0x38a7('0xd6')](_0x162984[_0x38a7('0x48')][_0x38a7('0xd6')]);_0x58c280[_0x38a7('0x3e')]=qs[_0x38a7('0xd2')](_[_0x38a7('0xd7')](_0x162984['query'],_0x4a8f8a[_0x38a7('0xd2')]));if(_0x162984[_0x38a7('0x48')][_0x38a7('0x38')]){_0x58c280[_0x38a7('0x3e')]=_[_0x38a7('0xd8')](_0x58c280['where'],{'$or':_[_0x38a7('0x2d')](_0x58c280[_0x38a7('0x44')],function(_0x3c5366){var _0x2f013f={};_0x2f013f[_0x3c5366]={'$like':'%'+_0x162984['query']['filter']+'%'};return _0x2f013f;})});}_0x58c280[_0x38a7('0xcf')]=db[_0x38a7('0x3f')];_0x58c280['as']='Agents';_0x58c280=_[_0x38a7('0xd8')]({},_0x58c280,_0x162984[_0x38a7('0x54')]);return _0x477a8a[_0x38a7('0xfa')]({'include':[_0x58c280]});}})[_0x38a7('0x21')](function(_0x55ed15){if(_0x55ed15){var _0x1b86f9={},_0x486702=[];for(var _0x364d36=0x0;_0x364d36<_0x55ed15[_0x38a7('0x64')];_0x364d36+=0x1){for(var _0x8e17dd=0x0,_0x19b43c;_0x8e17dd<_0x55ed15[_0x364d36][_0x38a7('0x29')][_0x38a7('0x64')];_0x8e17dd+=0x1){_0x19b43c=_0x55ed15[_0x364d36][_0x38a7('0x29')][_0x8e17dd][_0x38a7('0x26')]({'plain':!![]});_0x1b86f9[_0x19b43c['id']]=_0x19b43c;}}_0x1b86f9=_[_0x38a7('0x11d')](_0x1b86f9);for(var _0x454dbb=qs[_0x38a7('0x1a')](_0x162984[_0x38a7('0x48')][_0x38a7('0x1a')]);_0x454dbb<_0x1b86f9[_0x38a7('0x64')]&&_0x486702[_0x38a7('0x64')]=_0x54e44f){_0x43702b=_0x54e44f;_0x13c137=0xc8;}else{_0x13c137=0xce;}_0x56fe3b[_0xa898('0x14')](_0x13c137);return _0x56fe3b[_0xa898('0x1b')]('Content-Range',_0x19d123+'-'+_0x43702b+'/'+_0x54e44f)[_0xa898('0x16')](_0x3beae0);}return null;};}function saveUpdates(_0x281705){return function(_0x3e496d){if(_0x3e496d){return _0x3e496d[_0xa898('0x1c')](_0x281705)['then'](function(_0x1446d8){if(_0x1446d8[_0xa898('0x1d')]==='agent'){socket[_0xa898('0x1e')](_0xa898('0x1f')+_0x1446d8['id'],_0x1446d8);}return _0x1446d8;});}return null;};}function removeEntity(_0x3cd749){return function(_0x5ce2ad){if(_0x5ce2ad){return _0x5ce2ad[_0xa898('0x20')]()[_0xa898('0x21')](function(){var _0x5c389c=_0x5ce2ad[_0xa898('0x22')]({'plain':!![]});if(_0x5c389c['role']===_0xa898('0x23'))return;var _0x38193c=[{'name':_0xa898('0x24'),'value':_0xa898('0x25'),'ignore':!![]},{'name':_0xa898('0x26'),'value':_0xa898('0x27'),'ignore':![]},{'name':_0xa898('0x28'),'value':_0xa898('0x29'),'ignore':![]}];var _0x3ad482=_(_0x38193c)['filter'](_0xa898('0x2a'))[_0xa898('0x2b')]('value')['value']();if(_[_0xa898('0x2c')](_0x3ad482,_0x5c389c[_0xa898('0x1d')])){return;}var _0x443b4e=_[_0xa898('0x2d')](_0x38193c,[_0xa898('0x2e'),_0x5c389c[_0xa898('0x1d')]])['name'];return db['UserProfileResource'][_0xa898('0x20')]({'where':{'type':_0x443b4e,'resourceId':_0x5c389c['id']}})['then'](function(){return _0x5ce2ad;});})['then'](function(){_0x3cd749[_0xa898('0x14')](0xcc)[_0xa898('0x15')]();});}};}function handleEntityNotFound(_0x7fc1ef){return function(_0x44780c){if(!_0x44780c){_0x7fc1ef[_0xa898('0x13')](0x194);}return _0x44780c;};}function handleError(_0x507a90,_0x597881){_0x597881=_0x597881||0x1f4;return function(_0x200ab2){logger[_0xa898('0x2f')](_0x200ab2[_0xa898('0x30')]);if(_0x200ab2[_0xa898('0x31')]){delete _0x200ab2[_0xa898('0x31')];}_0x507a90['status'](_0x597881)[_0xa898('0x32')](_0x200ab2);};}function getUserAttributes(){return _(db[_0xa898('0x33')][_0xa898('0x34')])['map'](function(_0x4dd1a7){return{'name':_0x4dd1a7[_0xa898('0x35')],'type':_0x4dd1a7['type'][_0xa898('0x36')]};})[_0xa898('0x37')](function(_0x518049){return!['password',_0xa898('0x38'),_0xa898('0x39'),_0xa898('0x3a'),_0xa898('0x3b'),_0xa898('0x3c')]['includes'](_0x518049[_0xa898('0x31')]);})[_0xa898('0x2e')]();}exports[_0xa898('0x3d')]=function(_0x153a22,_0x149f17){var _0xa5aaf2={},_0x598397={'count':0x0,'rows':[]};var _0x1a569f=getUserAttributes();_0xa5aaf2=qs[_0xa898('0x3e')](_0x1a569f,_0x153a22);var _0x30b9a8={'where':_0xa5aaf2[_0xa898('0x3f')]};return db[_0xa898('0x33')][_0xa898('0x1a')](_0x30b9a8)[_0xa898('0x21')](function(_0x38c082){_0x598397[_0xa898('0x1a')]=_0x38c082;if(_0x153a22[_0xa898('0x40')][_0xa898('0x41')]){_0xa5aaf2[_0xa898('0x42')]=[{'all':!![]}];}if(_0x153a22[_0xa898('0x40')][_0xa898('0x43')]===_0xa898('0x44')){_0xa5aaf2['include']=[{'model':db[_0xa898('0x45')],'as':'userSetting'}];}if(!_[_0xa898('0x2c')](_0xa5aaf2[_0xa898('0x46')],'id')){_0xa5aaf2[_0xa898('0x46')][_0xa898('0x47')]('id');}return db['User'][_0xa898('0x48')](_0xa5aaf2);})['then'](function(_0x25626e){_0x598397[_0xa898('0x49')]=_0x25626e;if(_0x153a22['query'][_0xa898('0x4a')]===_0xa898('0x44')){var _0x219d01=[];for(var _0xcf520c=0x0;_0xcf520c<_0x598397['rows']['length'];_0xcf520c++){_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4b'),_0x598397['rows'][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4d'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x598397['rows'][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x4f'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs('openchannel',_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));_0x219d01[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x598397[_0xa898('0x49')][_0xcf520c][_0xa898('0x4c')]));}return Promise[_0xa898('0x51')](_0x219d01)[_0xa898('0x21')](function(){return _0x598397;});}else{return _0x598397;}})[_0xa898('0x21')](respondWithFilteredResult(_0x149f17,_0xa5aaf2))[_0xa898('0x52')](handleError(_0x149f17,null));};exports[_0xa898('0x53')]=function(_0x3a90e6,_0x420d92){var _0x3b1c80=getUserAttributes();_0x3a90e6[_0xa898('0x40')]['id']=_0x3a90e6[_0xa898('0x54')]['id'];var _0x443895=qs['getOptions'](_0x3b1c80,_0x3a90e6);if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x41')]){_0x443895[_0xa898('0x42')]=[{'all':!![]}];}if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x43')]==='true'){_0x443895[_0xa898('0x42')]=[{'model':db[_0xa898('0x45')],'as':'userSetting'}];}_0x443895=_[_0xa898('0x55')]({},_0x443895,_0x3a90e6[_0xa898('0x56')]);if(!_['includes'](_0x443895[_0xa898('0x46')],'id')){_0x443895[_0xa898('0x46')][_0xa898('0x47')]('id');}return db['User'][_0xa898('0x2d')](_0x443895)['then'](handleEntityNotFound(_0x420d92,null))[_0xa898('0x21')](function(_0x22a071){var _0x3191ce=[];values=_0x22a071;if(_0x3a90e6[_0xa898('0x40')][_0xa898('0x4a')]==='true'){_0x3191ce['push'](get_open_tabs(_0xa898('0x4b'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4d'),_0x22a071[_0xa898('0x4c')]));_0x3191ce['push'](get_open_tabs('openchannel',_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x22a071[_0xa898('0x4c')]));_0x3191ce[_0xa898('0x47')](get_open_tabs(_0xa898('0x4f'),_0x22a071[_0xa898('0x4c')]));return Promise['all'](_0x3191ce);}else{return values;}})['then'](function(){return values;})[_0xa898('0x21')](respondWithResult(_0x420d92,null))[_0xa898('0x52')](handleError(_0x420d92,null));};exports[_0xa898('0x1c')]=function(_0x1519e5,_0x172b92){if(_0x1519e5[_0xa898('0x57')]['id']){delete _0x1519e5['body']['id'];}delete _0x1519e5['body'][_0xa898('0x1d')];return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x1519e5[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x172b92,null))[_0xa898('0x21')](saveUpdates(_0x1519e5[_0xa898('0x57')],null))[_0xa898('0x21')](respondWithResult(_0x172b92,null))[_0xa898('0x52')](handleError(_0x172b92,null));};exports[_0xa898('0x58')]=function(_0x2afa8d,_0x3a8517){return db[_0xa898('0x33')][_0xa898('0x58')]()[_0xa898('0x21')](respondWithResult(_0x3a8517,null))[_0xa898('0x52')](handleError(_0x3a8517,null));};exports['addContacts']=function(_0x2722c9,_0x29fb75){return db['User'][_0xa898('0x2d')]({'where':{'id':_0x2722c9[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x29fb75,null))['then'](function(_0x432b65){if(_0x432b65){return _0x432b65['addContacts'](_0x2722c9[_0xa898('0x57')][_0xa898('0x59')],_[_0xa898('0x5a')](_0x2722c9['body'],[_0xa898('0x59'),'id'])||{});}})[_0xa898('0x21')](respondWithResult(_0x29fb75,null))[_0xa898('0x52')](handleError(_0x29fb75,null));};function validateUser(_0x40ac04){return new Promise(function(_0x256327,_0x1bbcb0){if(_0x40ac04[_0xa898('0x5b')])return _0x256327(_0x40ac04);return db['Setting'][_0xa898('0x5c')](0x1)[_0xa898('0x21')](function(_0x5ed17e){if(_0x5ed17e[_0xa898('0x5d')])authService['validatePasswordPattern'](_0x40ac04[_0xa898('0x5e')]);db['User'][_0xa898('0x5f')](_0xa898('0x5b'))[_0xa898('0x21')](function(_0x204d1f){if(_[_0xa898('0x60')](_0x204d1f)){_0x40ac04[_0xa898('0x5b')]=_0x5ed17e['min_internal']||0x1;return;}if(_[_0xa898('0x60')](_0x5ed17e[_0xa898('0x61')])||_0x5ed17e[_0xa898('0x61')]===_0x204d1f){_0x40ac04[_0xa898('0x5b')]=_0x204d1f+0x1;return;}if(_0x5ed17e[_0xa898('0x61')]>_0x204d1f){_0x40ac04['internal']=_0x5ed17e[_0xa898('0x61')];return;}return db['sequelize'][_0xa898('0x40')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xa898('0x62')]['QueryTypes']['SELECT']})[_0xa898('0x21')](function(_0x1b2365){if(_0x1b2365&&_0x1b2365[_0xa898('0x63')]){for(var _0x400813=0x0,_0x2b41c4=_0x1b2365[_0xa898('0x63')];_0x400813<_0x2b41c4&&_[_0xa898('0x60')](_0x40ac04[_0xa898('0x5b')]);_0x400813++){if(_0x5ed17e['min_internal']<=_0x1b2365[_0x400813][_0xa898('0x64')]){_0x40ac04[_0xa898('0x5b')]=_0x1b2365[_0x400813][_0xa898('0x64')];}else if(_0x5ed17e[_0xa898('0x61')]>_0x1b2365[_0x400813][_0xa898('0x64')]&&_0x5ed17e[_0xa898('0x61')]<=_0x1b2365[_0x400813]['to']){_0x40ac04[_0xa898('0x5b')]=_0x5ed17e['min_internal'];}}}if(_[_0xa898('0x60')](_0x40ac04[_0xa898('0x5b')])){_0x40ac04['internal']=_0x204d1f+0x1;}return _0x256327(_0x40ac04);});});})[_0xa898('0x52')](function(_0x553f8f){_0x1bbcb0(_0x553f8f);});});}function updateUser(_0xa923cb){return new Promise(function(_0x3ce410,_0x76c912){try{if(_0xa923cb[_0xa898('0x65')]){_0xa923cb[_0xa898('0x66')]=_0xa923cb[_0xa898('0x5b')];_0xa923cb['VoiceMail']={'mailbox':_0xa923cb[_0xa898('0x5b')],'password':_0xa923cb['password'],'fullname':_0xa923cb[_0xa898('0x67')],'email':_0xa923cb[_0xa898('0x68')]};}if(_0xa923cb['role']===_0xa898('0x27')){if(!_0xa923cb[_0xa898('0x69')])_0xa923cb[_0xa898('0x69')]=[_0xa898('0x6a'),_0xa898('0x6b'),_0xa898('0x6c'),_0xa898('0x6d'),_0xa898('0x6e'),_0xa898('0x6f'),_0xa898('0x70'),_0xa898('0x71'),'107',_0xa898('0x72'),_0xa898('0x73'),_0xa898('0x74'),_0xa898('0x75'),_0xa898('0x76'),'115'];}_0x3ce410(_0xa923cb);}catch(_0x2b713b){_0x76c912(_0x2b713b);}});}exports[_0xa898('0x77')]=function(_0x596809,_0x556a3){if(_0x596809[_0xa898('0x25')]['role']===_0xa898('0x27'))throw new Error('Unauthorized');if(_0x596809[_0xa898('0x57')][_0xa898('0x1d')]===_0xa898('0x25')&&_0x596809[_0xa898('0x25')][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error(_0xa898('0x78'));}if(_0x596809['body'][_0xa898('0x1d')]===_0xa898('0x23')&&_0x596809['user']['role']!==_0xa898('0x23')){throw new Error(_0xa898('0x79'));}return licenseUtil[_0xa898('0x7a')]([_0x596809[_0xa898('0x57')]])[_0xa898('0x21')](function(){return validateUser(_0x596809[_0xa898('0x57')]);})[_0xa898('0x21')](function(_0x31d64d){return updateUser(_0x31d64d)[_0xa898('0x21')](function(_0x100160){if(_0x100160[_0xa898('0x1d')]===_0xa898('0x23')){_0x100160[_0xa898('0x7b')]=_0x596809[_0xa898('0x25')]['settingsEnabled'];delete _0x100160[_0xa898('0x7c')];}return _0x100160;});})['then'](function(_0x373a18){return db['User'][_0xa898('0x77')](_0x373a18,{'include':[{'model':db[_0xa898('0x7d')],'as':_0xa898('0x7d')}]});})[_0xa898('0x21')](function(_0x4c14bb){if(_0x596809['body'][_0xa898('0x1d')]===_0xa898('0x25'))return _0x4c14bb;if(_0x596809['user'][_0xa898('0x1d')]!==_0xa898('0x25'))return _0x4c14bb;return db['UserProfileSection'][_0xa898('0x2d')]({'where':{'name':_0x4c14bb['role']===_0xa898('0x27')?_0xa898('0x26'):_0xa898('0x28'),'userProfileId':_0x596809[_0xa898('0x25')][_0xa898('0x7c')]},'raw':!![]})['then'](function(_0x33f13a){if(!_0x33f13a||_0x33f13a[_0xa898('0x7e')]!=0x0)return _0x4c14bb;return db[_0xa898('0x7f')][_0xa898('0x77')]({'name':_0x4c14bb[_0xa898('0x31')],'resourceId':_0x4c14bb['id'],'type':_0x33f13a[_0xa898('0x31')],'sectionId':_0x33f13a['id']},{})['then'](function(){return _0x4c14bb;});})[_0xa898('0x52')](function(_0x20d8f7){logger[_0xa898('0x2f')](_0xa898('0x80'),_0x20d8f7);throw _0x20d8f7;});})[_0xa898('0x21')](respondWithResult(_0x556a3,0xc9))['catch'](handleError(_0x556a3,null));};exports[_0xa898('0x81')]=function(_0x9b5b9c,_0x5b9952){var _0x37885d=_0x9b5b9c[_0xa898('0x57')];var _0xd2fd9b=[];if(_0x9b5b9c[_0xa898('0x25')]['role']===_0xa898('0x27'))throw new Error(_0xa898('0x82'));if(_[_0xa898('0x83')](_0x37885d,[_0xa898('0x1d'),_0xa898('0x25')])&&_0x9b5b9c['user'][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xa898('0x83')](_0x37885d,[_0xa898('0x1d'),_0xa898('0x23')])&&_0x9b5b9c['user'][_0xa898('0x1d')]!==_0xa898('0x23')){throw new Error(_0xa898('0x84'));}return licenseUtil[_0xa898('0x7a')](_0x37885d)[_0xa898('0x21')](function(){return validateUser(_0x37885d[0x0]);})[_0xa898('0x21')](function(){for(var _0x2506ee=0x1;_0x2506ee<_0x37885d[_0xa898('0x63')];_0x2506ee++){var _0x3d417c=_0x37885d[_0x2506ee-0x1][_0xa898('0x5b')];if(!_0x37885d[_0x2506ee][_0xa898('0x5b')])_0x37885d[_0x2506ee][_0xa898('0x5b')]=_0x3d417c+0x1;_0xd2fd9b[_0xa898('0x47')](validateUser(_0x37885d[_0x2506ee]));}return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(){_0xd2fd9b=[];for(var _0x5cfd50=0x0;_0x5cfd50<_0x37885d['length'];_0x5cfd50++){_0xd2fd9b[_0xa898('0x47')](updateUser(_0x37885d[_0x5cfd50]));}return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(){_0xd2fd9b=_0x37885d[_0xa898('0x2b')](function(_0x58d32c){return db[_0xa898('0x33')][_0xa898('0x77')](_0x58d32c,{'include':[{'model':db[_0xa898('0x7d')],'as':_0xa898('0x7d')}]})[_0xa898('0x21')](function(_0x158a0e){_0x58d32c['id']=_0x158a0e['id'];return _0x58d32c;});});return Promise[_0xa898('0x51')](_0xd2fd9b);})[_0xa898('0x21')](function(_0x4e641b){if(_0x9b5b9c[_0xa898('0x57')][_0xa898('0x1d')]==='user')return _0x4e641b;if(_0x9b5b9c[_0xa898('0x25')]['role']!==_0xa898('0x25'))return _0x4e641b;var _0x2b5865=_[_0xa898('0x83')](_0x4e641b,function(_0x2e05b6){return _0x2e05b6[_0xa898('0x1d')]===_0xa898('0x27')||_0x2e05b6['role']===_0xa898('0x29');});if(!_0x2b5865)return _0x4e641b;return db[_0xa898('0x85')][_0xa898('0x48')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x9b5b9c[_0xa898('0x25')]['userProfileId']},'raw':!![]})[_0xa898('0x21')](function(_0x5366a5){if(_[_0xa898('0x86')](_0x5366a5)||!_[_0xa898('0x83')](_0x5366a5,['autoAssociation',0x0]))return _0x4e641b;_0xd2fd9b=[];var _0xfa4ddd=_(_0x5366a5)['map'](function(_0x29a979){if(_0x29a979[_0xa898('0x7e')]===0x1)return;return _0x29a979[_0xa898('0x31')]===_0xa898('0x26')?'agent':_0xa898('0x29');})[_0xa898('0x87')]()[_0xa898('0x2e')]();for(var _0x30cd24=0x0;_0x30cd24<_0x4e641b['length'];_0x30cd24++){if(!_[_0xa898('0x2c')](_0xfa4ddd,_0x4e641b[_0x30cd24][_0xa898('0x1d')]))return;var _0x37288f=_0x4e641b[_0x30cd24][_0xa898('0x1d')]===_0xa898('0x27')?_0xa898('0x26'):_0xa898('0x28');_0xd2fd9b[_0xa898('0x47')](db[_0xa898('0x7f')][_0xa898('0x77')]({'name':_0x4e641b[_0x30cd24][_0xa898('0x31')],'resourceId':_0x4e641b[_0x30cd24]['id'],'type':_0x37288f,'sectionId':_[_0xa898('0x2d')](_0x5366a5,[_0xa898('0x31'),_0x37288f])['id']},{}));}return Promise[_0xa898('0x51')](_0xd2fd9b);});})[_0xa898('0x21')](respondWithResult(_0x5b9952,0xc9))[_0xa898('0x52')](handleError(_0x5b9952,null));};exports[_0xa898('0x88')]=function(_0x3a106d,_0x289b9a){if(_0x3a106d['body']['id']){delete _0x3a106d[_0xa898('0x57')]['id'];}return db['User'][_0xa898('0x2d')]({'where':{'id':_0x3a106d['params']['id']}})[_0xa898('0x21')](function(_0x3e75f8){if(!_0x3e75f8)return null;if(_0x3e75f8['id']===_0x3a106d[_0xa898('0x25')]['id']){if(!_0x3a106d[_0xa898('0x57')][_0xa898('0x89')]||!_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')]){throw new db['Sequelize'][(_0xa898('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3e75f8['authenticate'](_0x3a106d[_0xa898('0x57')][_0xa898('0x89')])){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x8d'));}if(_0x3a106d[_0xa898('0x57')][_0xa898('0x89')]===_0x3a106d['body']['newPassword']){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x8e'));}}else if(_0x3a106d['user'][_0xa898('0x1d')]==='admin'){if(!_0x3a106d['body'][_0xa898('0x8a')]){throw new db['Sequelize'][(_0xa898('0x8b'))](_0xa898('0x8f'));}}else if(_0x3a106d[_0xa898('0x25')][_0xa898('0x1d')]===_0xa898('0x25')){if(!_0x3a106d[_0xa898('0x57')]['newPassword']){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x8f'));}if(_0x3e75f8[_0xa898('0x1d')]!=='agent'){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x82'));}}else{throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0x82'));}return _0x3e75f8;})[_0xa898('0x21')](handleEntityNotFound(_0x289b9a,null))['then'](function(_0x5ce8bd){return db['Setting'][_0xa898('0x90')]({'attributes':['id',_0xa898('0x5d'),_0xa898('0x91'),_0xa898('0x92')]})[_0xa898('0x21')](function(_0x458f99){if(_0x458f99[_0xa898('0x5d')])authService['validatePasswordPattern'](_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')]);if(!_0x458f99[_0xa898('0x91')]||!_0x5ce8bd[_0xa898('0x39')])return _0x5ce8bd;authService[_0xa898('0x93')](_0x3a106d[_0xa898('0x57')]['newPassword'],_0x5ce8bd['previousPasswords'],_0x458f99[_0xa898('0x92')]);return _0x5ce8bd;})[_0xa898('0x21')](saveUpdates({'password':_0x3a106d[_0xa898('0x57')][_0xa898('0x8a')],'passwordResetAt':_0x3a106d[_0xa898('0x25')]['id']==_0x3a106d[_0xa898('0x54')]['id']?moment():null,'previousPasswords':authService[_0xa898('0x94')](_0x3a106d['body'][_0xa898('0x8a')],_0x5ce8bd[_0xa898('0x39')])},null));})[_0xa898('0x21')](respondWithResult(_0x289b9a,null))[_0xa898('0x52')](handleError(_0x289b9a,null));};exports[_0xa898('0x95')]=function(_0x2f0926,_0x3b34a3){var _0x3a6736=_0x2f0926[_0xa898('0x57')][_0xa898('0x96')];return db['User'][_0xa898('0x2d')]({'where':{'id':_0x2f0926[_0xa898('0x54')]['id']},'attributes':['id','name','role',_0xa898('0x97'),_0xa898('0x98'),_0xa898('0x99'),_0xa898('0x9a')]})[_0xa898('0x21')](handleEntityNotFound(_0x3b34a3,null))[_0xa898('0x21')](function(_0x22f0c6){if(_0x22f0c6){if(!utils[_0xa898('0x9b')](_0x3a6736)){throw new db[(_0xa898('0x8c'))]['ValidationError'](_0xa898('0x9c'));}return _0x22f0c6[_0xa898('0x9d')+_[_0xa898('0x9e')](_0x3a6736['toLowerCase']())+_0xa898('0x9f')](_0x2f0926[_0xa898('0x57')][_0xa898('0x59')],{'penalty':_0x2f0926[_0xa898('0x57')][_0xa898('0xa0')]||0x0})[_0xa898('0xa1')](function(_0x34f2ba){for(var _0x3a7e76=0x0;_0x3a7e76<_0x2f0926[_0xa898('0x57')]['ids'][_0xa898('0x63')];_0x3a7e76+=0x1){var _0x352aa5={'UserId':Number(_0x2f0926['params']['id'])};_0x352aa5[_[_0xa898('0x9e')](_0x3a6736['toLowerCase']())+_0xa898('0xa2')]=Number(_0x2f0926[_0xa898('0x57')][_0xa898('0x59')][_0x3a7e76]);socket[_0xa898('0x1e')](_0xa898('0x25')+_[_0xa898('0x9e')](_0x3a6736[_0xa898('0xa3')]())+_0xa898('0xa4'),_0x352aa5);}return _0x34f2ba;})['then'](function(){if(_0x3a6736===_0xa898('0xa5')){return db[_0xa898('0xa6')][_0xa898('0x48')]({'where':{'id':_0x2f0926['body'][_0xa898('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x13c51c){var _0x27fbb2=_0x22f0c6['get']({'plain':!![]});var _0x4410d3=[];if(_0x3a6736==='voice'&&_0x27fbb2[_0xa898('0x1d')]===_0xa898('0x27')&&_0x27fbb2[_0xa898('0x97')]){for(let _0x3daa9f=0x0;_0x3daa9f<_0x13c51c[_0xa898('0x63')];_0x3daa9f+=0x1){_0x4410d3[_0xa898('0x47')]({'membername':_0x27fbb2[_0xa898('0x31')],'UserId':_0x27fbb2['id'],'queue_name':_0x13c51c[_0x3daa9f]['name'],'VoiceQueueId':_0x13c51c[_0x3daa9f]['id'],'interface':_[_0xa898('0x60')](_0x27fbb2['interface'])?util[_0xa898('0xa7')](_0xa898('0xa8'),_0x27fbb2['name']):_0x27fbb2['interface'],'paused':_0x27fbb2[_0xa898('0x99')]||![],'penalty':_0x2f0926[_0xa898('0x57')]['penalty']||0x0});}return Promise[_0xa898('0x51')](_0x4410d3[_0xa898('0x2b')](function(_0x2dfbec){return db[_0xa898('0xa9')][_0xa898('0xaa')](_0x2dfbec);}));}return _0x22f0c6;});}})[_0xa898('0x21')](respondWithStatusCode(_0x3b34a3,null))[_0xa898('0x52')](handleError(_0x3b34a3,null));};exports[_0xa898('0xab')]=function(_0x3b11ca,_0x454bc0){var _0x4cff46,_0x3d404f;return db['User'][_0xa898('0x2d')]({'where':{'id':_0x3b11ca[_0xa898('0x54')]['id']},'attributes':['id',_0xa898('0x31'),'role']})[_0xa898('0x21')](handleEntityNotFound(_0x454bc0,null))['then'](function(_0x15b0dd){if(_0x15b0dd){_0x4cff46=_0x15b0dd;if(!_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')]||!utils[_0xa898('0x9b')](_0x3b11ca['query'][_0xa898('0x96')])){throw new db['Sequelize'][(_0xa898('0x8b'))](_0xa898('0x9c'));}return _0x15b0dd['remove'+_['capitalize'](_0x3b11ca[_0xa898('0x40')]['channel'][_0xa898('0xa3')]())+_0xa898('0x9f')](_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')]);}})[_0xa898('0x21')](function(_0x11662f){if(_[_0xa898('0xac')](_0x3b11ca['query']['ids'])){for(var _0x1a2190=0x0;_0x1a2190<_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')][_0xa898('0x63')];_0x1a2190+=0x1){_0x3d404f={'UserId':Number(_0x3b11ca[_0xa898('0x54')]['id'])};_0x3d404f[_[_0xa898('0x9e')](_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xa2')]=Number(_0x3b11ca[_0xa898('0x40')]['ids'][_0x1a2190]);socket[_0xa898('0x1e')](_0xa898('0x25')+_[_0xa898('0x9e')](_0x3b11ca['query'][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xad'),_0x3d404f);}}else{_0x3d404f={'UserId':Number(_0x3b11ca[_0xa898('0x54')]['id'])};_0x3d404f[_[_0xa898('0x9e')](_0x3b11ca['query']['channel'][_0xa898('0xa3')]())+'QueueId']=Number(_0x3b11ca['query'][_0xa898('0x59')]);socket['emit']('user'+_[_0xa898('0x9e')](_0x3b11ca['query'][_0xa898('0x96')][_0xa898('0xa3')]())+_0xa898('0xad'),_0x3d404f);}return _0x11662f;})[_0xa898('0x21')](function(){if(_0x3b11ca[_0xa898('0x40')][_0xa898('0x96')]===_0xa898('0xa5')){return db[_0xa898('0xa9')][_0xa898('0x20')]({'where':{'UserId':_0x3b11ca[_0xa898('0x54')]['id'],'VoiceQueueId':_0x3b11ca[_0xa898('0x40')][_0xa898('0x59')]},'individualHooks':!![]})[_0xa898('0x21')](function(){return _0x4cff46;});}return _0x4cff46;})[_0xa898('0x21')](respondWithStatusCode(_0x454bc0,null))['catch'](handleError(_0x454bc0,null));};exports[_0xa898('0xae')]=function(_0x42c48b,_0x2da574){_0x42c48b['body'][_0xa898('0xaf')]=_0x42c48b[_0xa898('0xb0')]['filename'];return db['User'][_0xa898('0x2d')]({'where':{'id':_0x42c48b['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x2da574,null))[_0xa898('0x21')](saveUpdates(_0x42c48b[_0xa898('0x57')],null))['then'](respondWithResult(_0x2da574,null))[_0xa898('0x52')](handleError(_0x2da574,null));};exports[_0xa898('0xb1')]=function(_0x25254c,_0x43692c){var _0x5a8bd7=path['join'](config[_0xa898('0xb2')],_0xa898('0xb3'));return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x25254c[_0xa898('0x54')]['id']},'attributes':['id',_0xa898('0xaf')],'raw':!![]})[_0xa898('0x21')](handleEntityNotFound(_0x43692c,null))['then'](function(_0x546258){if(_0x546258){if(_['isNil'](_0x546258[_0xa898('0xaf')])){return _0x43692c[_0xa898('0xb4')](_0x5a8bd7);}else{if(!fs['existsSync'](path[_0xa898('0xb5')](config['root'],_0xa898('0xb6'),_0x546258[_0xa898('0xaf')]))){return _0x43692c['download'](_0x5a8bd7);}return _0x43692c['download'](path[_0xa898('0xb5')](config[_0xa898('0xb2')],'server/files/images/',_0x546258[_0xa898('0xaf')]));}}})[_0xa898('0x52')](handleError(_0x43692c,null));};exports[_0xa898('0xb7')]=function(_0x5cbdf1,_0x1c1d32){return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x5cbdf1[_0xa898('0x54')]['id']},'attributes':['id']})[_0xa898('0x21')](handleEntityNotFound(_0x1c1d32,null))[_0xa898('0x21')](function(_0x82a59a){var _0x50d3cb=[];values=_0x82a59a[_0xa898('0x4c')];_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x4b'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs('sms',_0x82a59a[_0xa898('0x4c')]));_0x50d3cb['push'](get_open_tabs('openchannel',_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x50'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs(_0xa898('0x4e'),_0x82a59a[_0xa898('0x4c')]));_0x50d3cb[_0xa898('0x47')](get_open_tabs('mail',_0x82a59a[_0xa898('0x4c')]));return Promise[_0xa898('0x51')](_0x50d3cb);})[_0xa898('0x21')](function(_0x2cb0e3){if(_0x2cb0e3){var _0x4dc19e=_[_0xa898('0x2b')](values[_0xa898('0xb8')],function(_0x34e9d2){return{'channel':'CHAT','id':_0x34e9d2['id'],'createdAt':_0x34e9d2[_0xa898('0xb9')]};});var _0x378cb0=_[_0xa898('0x2b')](values[_0xa898('0xba')],function(_0x53d90d){return{'channel':_0xa898('0xbb'),'id':_0x53d90d['id'],'createdAt':_0x53d90d['createdAt']};});var _0x48b467=_[_0xa898('0x2b')](values[_0xa898('0xbc')],function(_0x48ba65){return{'channel':_0xa898('0xbd'),'id':_0x48ba65['id'],'createdAt':_0x48ba65[_0xa898('0xb9')]};});var _0x2859a6=_['map'](values[_0xa898('0xbe')],function(_0x838601){return{'channel':'MAIL','id':_0x838601['id'],'createdAt':_0x838601[_0xa898('0xb9')]};});var _0x577b05=_[_0xa898('0x2b')](values['SmsOpenTabs'],function(_0x4f8179){return{'channel':_0xa898('0xbf'),'id':_0x4f8179['id'],'createdAt':_0x4f8179[_0xa898('0xb9')]};});var _0x3dc59f=_[_0xa898('0x2b')](values[_0xa898('0xc0')],function(_0x37d456){return{'channel':_0xa898('0xc1'),'id':_0x37d456['id'],'createdAt':_0x37d456[_0xa898('0xb9')]};});var _0x59b6ee=_[_0xa898('0xc2')](_0x4dc19e,_0x378cb0,_0x48b467,_0x2859a6,_0x577b05,_0x3dc59f);var _0x31cfb6={'count':_0x59b6ee[_0xa898('0x63')],'rows':_0x59b6ee};return _0x31cfb6;}else return null;})[_0xa898('0x21')](respondWithResult(_0x1c1d32,null))['catch'](handleError(_0x1c1d32,null));};exports[_0xa898('0xc3')]=function(_0x249211,_0x279ada){var _0x351eba={};return db[_0xa898('0x33')]['findOne']({'where':{'id':_0x249211[_0xa898('0x54')]['id']}})[_0xa898('0x21')](function(_0x30e5f1){if(!_0x30e5f1){throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x249211['params']['id']));}return contacts[_0xa898('0x58')]();})['then'](function(_0xd05470){_0x249211[_0xa898('0x40')][_0xa898('0x33')]=_0x249211[_0xa898('0x54')]['id'];_0x351eba=qs[_0xa898('0x3e')](_0xd05470,_0x249211);if(_0x249211[_0xa898('0x40')][_0xa898('0xc5')]('includeAll')){_0x351eba['include']=[{'model':db[_0xa898('0xc6')],'as':'List','required':![]},{'model':db[_0xa898('0xc7')],'as':_0xa898('0xc8'),'attributes':['id',_0xa898('0x31'),_0xa898('0xc9')],'where':_0x249211['query']['tag']?{'id':_0x249211[_0xa898('0x40')][_0xa898('0xca')]}:undefined,'required':_0x249211[_0xa898('0x40')][_0xa898('0xca')]?!![]:![]}];}return contacts['findAll'](_0x249211['query'],_0x249211[_0xa898('0x25')],_0x351eba,_0xd05470);})[_0xa898('0x21')](respondWithFilteredResult(_0x279ada,_0x351eba))[_0xa898('0x52')](APIHandleError(_0x279ada));};exports['getQueues']=function(_0x3a5c1f,_0x5b7a87){var _0x5e88f4;var _0x5be7e2={};var _0x40f6ef;return db['User']['findOne']({'where':{'id':_0x3a5c1f['params']['id']},'attributes':['id','name','role']})[_0xa898('0x21')](handleEntityNotFound(_0x5b7a87,null))[_0xa898('0x21')](function(_0x4bb208){if(!utils['isValidChannel'](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])){throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))]('Unknown\x20channel');}_0x5e88f4=_0x4bb208;var _0x3237ab={};_0x3237ab[_0xa898('0xcb')]=_['keys'](db[_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+_0xa898('0xcc')][_0xa898('0x34')]);_0x3237ab[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x3a5c1f[_0xa898('0x40')]);_0x3237ab[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x3237ab[_0xa898('0xcb')],_0x3237ab[_0xa898('0x40')]);_0x5be7e2[_0xa898('0x46')]=_['intersection'](_0x3237ab[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0xd0')]));_0x5be7e2['attributes']=_0x5be7e2[_0xa898('0x46')][_0xa898('0x63')]?_0x5be7e2[_0xa898('0x46')]:_0x3237ab[_0xa898('0xcb')];_0x5be7e2[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0xd2')]);_0x5be7e2[_0xa898('0x3f')]=qs['filters'](_[_0xa898('0xd3')](_0x3a5c1f['query'],_0x3237ab[_0xa898('0xce')]));if(_0x3a5c1f[_0xa898('0x40')]['filter']){_0x5be7e2['where']=_['merge'](_0x5be7e2['where'],{'$or':_[_0xa898('0x2b')](_0x5be7e2[_0xa898('0x46')],function(_0x2375f2){var _0x8501cf={};_0x8501cf[_0x2375f2]={'$like':'%'+_0x3a5c1f[_0xa898('0x40')]['filter']+'%'};return _0x8501cf;})});}_0x5be7e2=_[_0xa898('0x55')]({},_0x5be7e2,_0x3a5c1f['options']);switch(_0x5e88f4['role']){case _0xa898('0x23'):return db[_['capitalize'](_0x3a5c1f['query'][_0xa898('0x96')])+_0xa898('0xcc')][_0xa898('0x48')](_0x5be7e2);case _0xa898('0x25'):case _0xa898('0x27'):return _0x5e88f4[_0xa898('0x22')+_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+'Queues'](_0x5be7e2);default:throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0xd4'));}})[_0xa898('0x21')](function(_0x20da31){_0x40f6ef=_0x20da31[_0xa898('0x63')];if(!_0x3a5c1f['query'][_0xa898('0xc5')](_0xa898('0xd5'))){_0x5be7e2[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x3a5c1f[_0xa898('0x40')]['limit']);_0x5be7e2[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x3a5c1f['query'][_0xa898('0x17')]);}switch(_0x5e88f4['role']){case _0xa898('0x23'):return db[_[_0xa898('0x9e')](_0x3a5c1f[_0xa898('0x40')][_0xa898('0x96')])+_0xa898('0xcc')]['findAll'](_0x5be7e2);case _0xa898('0x25'):case _0xa898('0x27'):return _0x5e88f4[_0xa898('0x22')+_[_0xa898('0x9e')](_0x3a5c1f['query'][_0xa898('0x96')])+'Queues'](_0x5be7e2);}})['then'](function(_0x118d65){return{'count':_0x40f6ef,'rows':_0x118d65};})[_0xa898('0x21')](respondWithResult(_0x5b7a87,null))[_0xa898('0x52')](handleError(_0x5b7a87,null));};exports[_0xa898('0xd6')]=function(_0x4f7aeb,_0x3e635b){var _0x24933a={};var _0x5c9dcd={};var _0x471d80;var _0x2c7553;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x4f7aeb[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x3e635b,null))['then'](function(_0x38697f){if(_0x38697f){_0x471d80=_0x38697f;_0x5c9dcd['model']=_['keys'](db['UserVoiceQueueRt'][_0xa898('0x34')]);_0x5c9dcd[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x4f7aeb['query']);_0x5c9dcd[_0xa898('0xce')]=_['intersection'](_0x5c9dcd[_0xa898('0xcb')],_0x5c9dcd[_0xa898('0x40')]);_0x24933a[_0xa898('0x46')]=_['intersection'](_0x5c9dcd[_0xa898('0xcb')],qs['fields'](_0x4f7aeb[_0xa898('0x40')][_0xa898('0xd0')]));_0x24933a[_0xa898('0x46')]=_0x24933a[_0xa898('0x46')][_0xa898('0x63')]?_0x24933a[_0xa898('0x46')]:_0x5c9dcd[_0xa898('0xcb')];_0x24933a[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x4f7aeb[_0xa898('0x40')][_0xa898('0xd2')]);_0x24933a[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x4f7aeb[_0xa898('0x40')],_0x5c9dcd[_0xa898('0xce')]));if(_0x4f7aeb['query'][_0xa898('0x37')]){_0x24933a[_0xa898('0x3f')]=_['merge'](_0x24933a[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x24933a[_0xa898('0x46')],function(_0x330945){var _0x8618fe={};_0x8618fe[_0x330945]={'$like':'%'+_0x4f7aeb[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x8618fe;})});}_0x24933a=_['merge']({},_0x24933a,_0x4f7aeb[_0xa898('0x56')]);return _0x471d80[_0xa898('0xd6')](_0x24933a);}})[_0xa898('0x21')](function(_0x218b8f){if(_0x218b8f){_0x2c7553=_0x218b8f[_0xa898('0x63')];if(!_0x4f7aeb[_0xa898('0x40')][_0xa898('0xc5')]('nolimit')){_0x24933a[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x4f7aeb[_0xa898('0x40')][_0xa898('0x19')]);_0x24933a[_0xa898('0x17')]=qs['offset'](_0x4f7aeb[_0xa898('0x40')][_0xa898('0x17')]);}return _0x471d80[_0xa898('0xd6')](_0x24933a);}})[_0xa898('0x21')](function(_0x53394c){if(_0x53394c){return _0x53394c?{'count':_0x2c7553,'rows':_0x53394c}:null;}})[_0xa898('0x21')](respondWithResult(_0x3e635b,null))[_0xa898('0x52')](handleError(_0x3e635b,null));};exports[_0xa898('0xd7')]=function(_0x46a5bd,_0x51a388){var _0x37efaa={};var _0x5a474b={};var _0x197d7b;var _0x3949a2;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x46a5bd[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x51a388,null))['then'](function(_0x57b352){if(_0x57b352){_0x197d7b=_0x57b352;_0x5a474b[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xd8')][_0xa898('0x34')]);_0x5a474b[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x46a5bd[_0xa898('0x40')]);_0x5a474b['filters']=_[_0xa898('0xcf')](_0x5a474b[_0xa898('0xcb')],_0x5a474b[_0xa898('0x40')]);_0x37efaa[_0xa898('0x46')]=_['intersection'](_0x5a474b[_0xa898('0xcb')],qs['fields'](_0x46a5bd[_0xa898('0x40')][_0xa898('0xd0')]));_0x37efaa[_0xa898('0x46')]=_0x37efaa['attributes']['length']?_0x37efaa[_0xa898('0x46')]:_0x5a474b[_0xa898('0xcb')];_0x37efaa[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x46a5bd[_0xa898('0x40')]['sort']);_0x37efaa[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x46a5bd[_0xa898('0x40')],_0x5a474b[_0xa898('0xce')]));if(_0x46a5bd[_0xa898('0x40')][_0xa898('0x37')]){_0x37efaa[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x37efaa['where'],{'$or':_[_0xa898('0x2b')](_0x37efaa['attributes'],function(_0x26aacd){var _0x31d31b={};_0x31d31b[_0x26aacd]={'$like':'%'+_0x46a5bd[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x31d31b;})});}_0x37efaa=_[_0xa898('0x55')]({},_0x37efaa,_0x46a5bd[_0xa898('0x56')]);return _0x197d7b[_0xa898('0xd7')](_0x37efaa);}})['then'](function(_0x377528){if(_0x377528){_0x3949a2=_0x377528['length'];if(!_0x46a5bd[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x37efaa['limit']=qs['limit'](_0x46a5bd[_0xa898('0x40')][_0xa898('0x19')]);_0x37efaa['offset']=qs[_0xa898('0x17')](_0x46a5bd[_0xa898('0x40')][_0xa898('0x17')]);}return _0x197d7b[_0xa898('0xd7')](_0x37efaa);}})['then'](function(_0x417cb9){if(_0x417cb9){return _0x417cb9?{'count':_0x3949a2,'rows':_0x417cb9}:null;}})[_0xa898('0x21')](respondWithResult(_0x51a388,null))['catch'](handleError(_0x51a388,null));};exports[_0xa898('0xd9')]=function(_0x408555,_0x26d7e1){var _0x270551={'raw':!![],'where':{}};var _0x2d3d96={};var _0x1a3fcc={'count':0x0,'rows':[]};return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x408555[_0xa898('0x54')]['id']}})['then'](handleEntityNotFound(_0x26d7e1,null))[_0xa898('0x21')](function(_0x528bd4){if(_0x528bd4){_0x2d3d96[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xda')]['rawAttributes']);_0x2d3d96[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x408555[_0xa898('0x40')]);_0x2d3d96[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x2d3d96[_0xa898('0xcb')],_0x2d3d96[_0xa898('0x40')]);_0x270551[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x2d3d96['model'],qs[_0xa898('0xd0')](_0x408555['query'][_0xa898('0xd0')]));_0x270551[_0xa898('0x46')]=_0x270551['attributes'][_0xa898('0x63')]?_0x270551[_0xa898('0x46')]:_0x2d3d96[_0xa898('0xcb')];if(!_0x408555[_0xa898('0x40')]['hasOwnProperty'](_0xa898('0xd5'))){_0x270551[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x408555[_0xa898('0x40')][_0xa898('0x19')]);_0x270551[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x408555['query'][_0xa898('0x17')]);}_0x270551[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x408555[_0xa898('0x40')]['sort']);_0x270551[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x408555[_0xa898('0x40')],_0x2d3d96['filters']));_0x270551[_0xa898('0x3f')][_0xa898('0xdb')]=_0x528bd4['id'];if(_0x408555['query'][_0xa898('0x37')]){_0x270551[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x270551[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x270551[_0xa898('0x46')],function(_0x579f79){var _0x2b77d7={};_0x2b77d7[_0x579f79]={'$like':'%'+_0x408555[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x2b77d7;})});}_0x270551=_[_0xa898('0x55')]({},_0x270551,_0x408555[_0xa898('0x56')]);return db[_0xa898('0xda')]['count']({'where':_0x270551[_0xa898('0x3f')]})['then'](function(_0x3dd2ec){_0x1a3fcc['count']=_0x3dd2ec;if(_0x408555[_0xa898('0x40')][_0xa898('0x41')]){_0x270551[_0xa898('0x42')]=[{'all':!![]}];}return db[_0xa898('0xda')][_0xa898('0x48')](_0x270551);})[_0xa898('0x21')](function(_0x15d083){_0x1a3fcc[_0xa898('0x49')]=_0x15d083;return _0x1a3fcc;});}})[_0xa898('0x21')](respondWithFilteredResult(_0x26d7e1,_0x270551))[_0xa898('0x52')](handleError(_0x26d7e1,null));};exports[_0xa898('0xdc')]=function(_0x2cff86,_0x33966e){var _0x3451d4={'raw':!![],'where':{}};var _0xe297d2={};var _0x572b23={'count':0x0,'rows':[]};return db['User'][_0xa898('0x90')]({'where':{'id':_0x2cff86[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x33966e,null))['then'](function(_0x53a4be){if(_0x53a4be){_0xe297d2['model']=_[_0xa898('0xcd')](db['ScreenRecording'][_0xa898('0x34')]);_0xe297d2['query']=_[_0xa898('0xcd')](_0x2cff86[_0xa898('0x40')]);_0xe297d2[_0xa898('0xce')]=_[_0xa898('0xcf')](_0xe297d2[_0xa898('0xcb')],_0xe297d2[_0xa898('0x40')]);_0x3451d4[_0xa898('0x46')]=_[_0xa898('0xcf')](_0xe297d2[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x2cff86[_0xa898('0x40')]['fields']));_0x3451d4['attributes']=_0x3451d4[_0xa898('0x46')][_0xa898('0x63')]?_0x3451d4[_0xa898('0x46')]:_0xe297d2['model'];if(!_0x2cff86['query']['hasOwnProperty']('nolimit')){_0x3451d4[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x2cff86['query'][_0xa898('0x19')]);_0x3451d4[_0xa898('0x17')]=qs['offset'](_0x2cff86[_0xa898('0x40')][_0xa898('0x17')]);}_0x3451d4[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x2cff86[_0xa898('0x40')][_0xa898('0xd2')]);_0x3451d4[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x2cff86[_0xa898('0x40')],_0xe297d2['filters']));_0x3451d4[_0xa898('0x3f')]['UserId']=_0x53a4be['id'];if(_0x2cff86['query']['filter']){_0x3451d4[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x3451d4['where'],{'$or':_[_0xa898('0x2b')](_0x3451d4[_0xa898('0x46')],function(_0x31f743){var _0x3fa8b9={};_0x3fa8b9[_0x31f743]={'$like':'%'+_0x2cff86['query'][_0xa898('0x37')]+'%'};return _0x3fa8b9;})});}_0x3451d4=_[_0xa898('0x55')]({},_0x3451d4,_0x2cff86[_0xa898('0x56')]);return db['ScreenRecording'][_0xa898('0x1a')]({'where':_0x3451d4[_0xa898('0x3f')]})['then'](function(_0xb062a7){_0x572b23[_0xa898('0x1a')]=_0xb062a7;if(_0x2cff86[_0xa898('0x40')][_0xa898('0x41')]){_0x3451d4[_0xa898('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3451d4);})[_0xa898('0x21')](function(_0x4a3d57){_0x572b23['rows']=_0x4a3d57;return _0x572b23;});}})[_0xa898('0x21')](respondWithFilteredResult(_0x33966e,_0x3451d4))[_0xa898('0x52')](handleError(_0x33966e,null));};exports['getChatInteractions']=function(_0xe98fe8,_0x523602){var _0x4c73c0={};var _0xb595ef={};var _0x294bd9;var _0x11fa98;return db['User'][_0xa898('0x90')]({'where':{'id':_0xe98fe8['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x523602,null))['then'](function(_0xf026ad){if(_0xf026ad){_0x294bd9=_0xf026ad;_0xb595ef[_0xa898('0xcb')]=_['keys'](db[_0xa898('0xdd')][_0xa898('0x34')]);_0xb595ef[_0xa898('0x40')]=_[_0xa898('0xcd')](_0xe98fe8['query']);_0xb595ef[_0xa898('0xce')]=_['intersection'](_0xb595ef[_0xa898('0xcb')],_0xb595ef['query']);_0x4c73c0['attributes']=_['intersection'](_0xb595ef[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0xe98fe8['query'][_0xa898('0xd0')]));_0x4c73c0['attributes']=_0x4c73c0['attributes']['length']?_0x4c73c0[_0xa898('0x46')]:_0xb595ef['model'];_0x4c73c0['order']=qs['sort'](_0xe98fe8[_0xa898('0x40')][_0xa898('0xd2')]);_0x4c73c0['where']=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0xe98fe8[_0xa898('0x40')],_0xb595ef[_0xa898('0xce')]));if(_0xe98fe8[_0xa898('0x40')][_0xa898('0x37')]){_0x4c73c0[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x4c73c0[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x4c73c0['attributes'],function(_0x2e6916){var _0x15a25e={};_0x15a25e[_0x2e6916]={'$like':'%'+_0xe98fe8[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x15a25e;})});}_0x4c73c0=_[_0xa898('0x55')]({},_0x4c73c0,_0xe98fe8[_0xa898('0x56')]);return _0x294bd9['getChatInteractions'](_0x4c73c0);}})['then'](function(_0x389f74){if(_0x389f74){_0x11fa98=_0x389f74[_0xa898('0x63')];if(!_0xe98fe8[_0xa898('0x40')]['hasOwnProperty'](_0xa898('0xd5'))){_0x4c73c0[_0xa898('0x19')]=qs[_0xa898('0x19')](_0xe98fe8[_0xa898('0x40')][_0xa898('0x19')]);_0x4c73c0['offset']=qs[_0xa898('0x17')](_0xe98fe8[_0xa898('0x40')][_0xa898('0x17')]);}return _0x294bd9[_0xa898('0xde')](_0x4c73c0);}})['then'](function(_0x25b02a){if(_0x25b02a){return _0x25b02a?{'count':_0x11fa98,'rows':_0x25b02a}:null;}})[_0xa898('0x21')](respondWithResult(_0x523602,null))['catch'](handleError(_0x523602,null));};exports['getOpenchannelInteractions']=function(_0x203276,_0x4ef7b5){var _0x57955c={};var _0x51ce14={};var _0x39ade9;var _0xe1c8b6;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x203276[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x4ef7b5,null))[_0xa898('0x21')](function(_0x32ff03){if(_0x32ff03){_0x39ade9=_0x32ff03;_0x51ce14[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xdf')][_0xa898('0x34')]);_0x51ce14[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x203276[_0xa898('0x40')]);_0x51ce14['filters']=_[_0xa898('0xcf')](_0x51ce14[_0xa898('0xcb')],_0x51ce14['query']);_0x57955c[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x51ce14[_0xa898('0xcb')],qs['fields'](_0x203276['query'][_0xa898('0xd0')]));_0x57955c[_0xa898('0x46')]=_0x57955c[_0xa898('0x46')][_0xa898('0x63')]?_0x57955c[_0xa898('0x46')]:_0x51ce14[_0xa898('0xcb')];_0x57955c[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x203276[_0xa898('0x40')][_0xa898('0xd2')]);_0x57955c[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x203276[_0xa898('0x40')],_0x51ce14[_0xa898('0xce')]));if(_0x203276[_0xa898('0x40')][_0xa898('0x37')]){_0x57955c[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x57955c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x57955c[_0xa898('0x46')],function(_0x10be04){var _0x11cd8a={};_0x11cd8a[_0x10be04]={'$like':'%'+_0x203276[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x11cd8a;})});}_0x57955c=_['merge']({},_0x57955c,_0x203276['options']);return _0x39ade9[_0xa898('0xe0')](_0x57955c);}})[_0xa898('0x21')](function(_0x1fdf8f){if(_0x1fdf8f){_0xe1c8b6=_0x1fdf8f[_0xa898('0x63')];if(!_0x203276[_0xa898('0x40')]['hasOwnProperty']('nolimit')){_0x57955c[_0xa898('0x19')]=qs['limit'](_0x203276[_0xa898('0x40')][_0xa898('0x19')]);_0x57955c[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x203276[_0xa898('0x40')]['offset']);}return _0x39ade9[_0xa898('0xe0')](_0x57955c);}})[_0xa898('0x21')](function(_0x31eb35){if(_0x31eb35){return _0x31eb35?{'count':_0xe1c8b6,'rows':_0x31eb35}:null;}})[_0xa898('0x21')](respondWithResult(_0x4ef7b5,null))['catch'](handleError(_0x4ef7b5,null));};exports['getMailInteractions']=function(_0xe1c44,_0x20043c){var _0x2a0c7b={'raw':!![],'where':{}};var _0x2d4616={};var _0x17a13b={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0xe1c44[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x20043c,null))[_0xa898('0x21')](function(_0x494ee2){if(_0x494ee2){_0x2d4616[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xe1')][_0xa898('0x34')]);_0x2d4616['query']=_[_0xa898('0xcd')](_0xe1c44[_0xa898('0x40')]);_0x2d4616[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x2d4616[_0xa898('0xcb')],_0x2d4616[_0xa898('0x40')]);_0x2a0c7b[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x2d4616[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0xe1c44[_0xa898('0x40')]['fields']));_0x2a0c7b[_0xa898('0x46')]=_0x2a0c7b[_0xa898('0x46')][_0xa898('0x63')]?_0x2a0c7b[_0xa898('0x46')]:_0x2d4616[_0xa898('0xcb')];if(!_0xe1c44['query'][_0xa898('0xc5')](_0xa898('0xd5'))){_0x2a0c7b[_0xa898('0x19')]=qs['limit'](_0xe1c44[_0xa898('0x40')]['limit']);_0x2a0c7b['offset']=qs[_0xa898('0x17')](_0xe1c44['query']['offset']);}_0x2a0c7b[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0xe1c44[_0xa898('0x40')][_0xa898('0xd2')]);_0x2a0c7b[_0xa898('0x3f')]=qs['filters'](_[_0xa898('0xd3')](_0xe1c44['query'],_0x2d4616[_0xa898('0xce')]));_0x2a0c7b[_0xa898('0x3f')][_0xa898('0xdb')]=_0x494ee2['id'];if(_0xe1c44[_0xa898('0x40')][_0xa898('0x37')]){_0x2a0c7b[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x2a0c7b['where'],{'$or':_[_0xa898('0x2b')](_0x2a0c7b[_0xa898('0x46')],function(_0x4bb00c){var _0x310ea3={};_0x310ea3[_0x4bb00c]={'$like':'%'+_0xe1c44[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x310ea3;})});}_0x2a0c7b=_[_0xa898('0x55')]({},_0x2a0c7b,_0xe1c44['options']);return db[_0xa898('0xe1')]['count']({'where':_0x2a0c7b[_0xa898('0x3f')]})[_0xa898('0x21')](function(_0x33af84){_0x17a13b[_0xa898('0x1a')]=_0x33af84;if(_0xe1c44['query'][_0xa898('0x41')]){_0x2a0c7b[_0xa898('0x42')]=[{'all':!![]}];}return db[_0xa898('0xe1')][_0xa898('0x48')](_0x2a0c7b);})[_0xa898('0x21')](function(_0x502da1){_0x17a13b['rows']=_0x502da1;return _0x17a13b;});}})['then'](respondWithFilteredResult(_0x20043c,_0x2a0c7b))[_0xa898('0x52')](handleError(_0x20043c,null));};exports[_0xa898('0xe2')]=function(_0x32deda,_0x3355b5){var _0x859c06={};var _0x4d329c={};var _0x45a87a;var _0x2c788a;return db['User'][_0xa898('0x90')]({'where':{'id':_0x32deda['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x3355b5,null))[_0xa898('0x21')](function(_0x6d343c){if(_0x6d343c){_0x45a87a=_0x6d343c;_0x4d329c['model']=_['keys'](db[_0xa898('0xe3')][_0xa898('0x34')]);_0x4d329c[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x32deda[_0xa898('0x40')]);_0x4d329c['filters']=_[_0xa898('0xcf')](_0x4d329c[_0xa898('0xcb')],_0x4d329c['query']);_0x859c06[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x4d329c[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x32deda[_0xa898('0x40')][_0xa898('0xd0')]));_0x859c06[_0xa898('0x46')]=_0x859c06[_0xa898('0x46')][_0xa898('0x63')]?_0x859c06[_0xa898('0x46')]:_0x4d329c['model'];_0x859c06[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x32deda[_0xa898('0x40')]['sort']);_0x859c06[_0xa898('0x3f')]=qs['filters'](_['pick'](_0x32deda[_0xa898('0x40')],_0x4d329c[_0xa898('0xce')]));if(_0x32deda[_0xa898('0x40')]['filter']){_0x859c06[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x859c06[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x859c06[_0xa898('0x46')],function(_0x479767){var _0x57c114={};_0x57c114[_0x479767]={'$like':'%'+_0x32deda[_0xa898('0x40')]['filter']+'%'};return _0x57c114;})});}_0x859c06=_['merge']({},_0x859c06,_0x32deda[_0xa898('0x56')]);return _0x45a87a[_0xa898('0xe2')](_0x859c06);}})['then'](function(_0x2a3d1b){if(_0x2a3d1b){_0x2c788a=_0x2a3d1b[_0xa898('0x63')];if(!_0x32deda[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x859c06[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x32deda[_0xa898('0x40')][_0xa898('0x19')]);_0x859c06[_0xa898('0x17')]=qs[_0xa898('0x17')](_0x32deda['query'][_0xa898('0x17')]);}return _0x45a87a[_0xa898('0xe2')](_0x859c06);}})['then'](function(_0x16d391){if(_0x16d391){return _0x16d391?{'count':_0x2c788a,'rows':_0x16d391}:null;}})['then'](respondWithResult(_0x3355b5,null))[_0xa898('0x52')](handleError(_0x3355b5,null));};exports['getFaxInteractions']=function(_0x113efd,_0x12c34d){var _0x1d09e9={};var _0x100664={};var _0x3719f0;var _0x5c7e86;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x113efd[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x12c34d,null))['then'](function(_0x4a7308){if(_0x4a7308){_0x3719f0=_0x4a7308;_0x100664[_0xa898('0xcb')]=_[_0xa898('0xcd')](db['FaxInteraction'][_0xa898('0x34')]);_0x100664['query']=_[_0xa898('0xcd')](_0x113efd[_0xa898('0x40')]);_0x100664['filters']=_[_0xa898('0xcf')](_0x100664[_0xa898('0xcb')],_0x100664[_0xa898('0x40')]);_0x1d09e9[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x100664[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x113efd[_0xa898('0x40')]['fields']));_0x1d09e9[_0xa898('0x46')]=_0x1d09e9[_0xa898('0x46')][_0xa898('0x63')]?_0x1d09e9['attributes']:_0x100664[_0xa898('0xcb')];_0x1d09e9['order']=qs[_0xa898('0xd2')](_0x113efd['query'][_0xa898('0xd2')]);_0x1d09e9[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x113efd['query'],_0x100664[_0xa898('0xce')]));if(_0x113efd[_0xa898('0x40')][_0xa898('0x37')]){_0x1d09e9[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x1d09e9['where'],{'$or':_[_0xa898('0x2b')](_0x1d09e9[_0xa898('0x46')],function(_0x2080d0){var _0x11d491={};_0x11d491[_0x2080d0]={'$like':'%'+_0x113efd[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x11d491;})});}_0x1d09e9=_[_0xa898('0x55')]({},_0x1d09e9,_0x113efd[_0xa898('0x56')]);return _0x3719f0[_0xa898('0xe4')](_0x1d09e9);}})[_0xa898('0x21')](function(_0x4a49a5){if(_0x4a49a5){_0x5c7e86=_0x4a49a5[_0xa898('0x63')];if(!_0x113efd[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x1d09e9[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x113efd[_0xa898('0x40')][_0xa898('0x19')]);_0x1d09e9['offset']=qs[_0xa898('0x17')](_0x113efd['query'][_0xa898('0x17')]);}return _0x3719f0['getFaxInteractions'](_0x1d09e9);}})[_0xa898('0x21')](function(_0x5ab88c){if(_0x5ab88c){return _0x5ab88c?{'count':_0x5c7e86,'rows':_0x5ab88c}:null;}})[_0xa898('0x21')](respondWithResult(_0x12c34d,null))['catch'](handleError(_0x12c34d,null));};exports['getWhatsappInteractions']=function(_0x1147a8,_0x1dcb75){var _0x6491d8={};var _0x21344e={};var _0x405760;var _0x2a860d;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x1147a8[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x1dcb75,null))['then'](function(_0x1db2be){if(_0x1db2be){_0x405760=_0x1db2be;_0x21344e[_0xa898('0xcb')]=_[_0xa898('0xcd')](db[_0xa898('0xe5')][_0xa898('0x34')]);_0x21344e[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x1147a8[_0xa898('0x40')]);_0x21344e[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x21344e[_0xa898('0xcb')],_0x21344e[_0xa898('0x40')]);_0x6491d8['attributes']=_[_0xa898('0xcf')](_0x21344e[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x1147a8[_0xa898('0x40')]['fields']));_0x6491d8[_0xa898('0x46')]=_0x6491d8[_0xa898('0x46')]['length']?_0x6491d8[_0xa898('0x46')]:_0x21344e[_0xa898('0xcb')];_0x6491d8[_0xa898('0xd1')]=qs['sort'](_0x1147a8[_0xa898('0x40')][_0xa898('0xd2')]);_0x6491d8[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x1147a8[_0xa898('0x40')],_0x21344e[_0xa898('0xce')]));if(_0x1147a8[_0xa898('0x40')][_0xa898('0x37')]){_0x6491d8['where']=_['merge'](_0x6491d8[_0xa898('0x3f')],{'$or':_['map'](_0x6491d8[_0xa898('0x46')],function(_0x25e1b5){var _0x331b26={};_0x331b26[_0x25e1b5]={'$like':'%'+_0x1147a8[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x331b26;})});}_0x6491d8=_[_0xa898('0x55')]({},_0x6491d8,_0x1147a8[_0xa898('0x56')]);return _0x405760[_0xa898('0xe6')](_0x6491d8);}})['then'](function(_0x1af00a){if(_0x1af00a){_0x2a860d=_0x1af00a[_0xa898('0x63')];if(!_0x1147a8[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x6491d8[_0xa898('0x19')]=qs[_0xa898('0x19')](_0x1147a8['query'][_0xa898('0x19')]);_0x6491d8['offset']=qs[_0xa898('0x17')](_0x1147a8['query'][_0xa898('0x17')]);}return _0x405760[_0xa898('0xe6')](_0x6491d8);}})[_0xa898('0x21')](function(_0x416d61){if(_0x416d61){return _0x416d61?{'count':_0x2a860d,'rows':_0x416d61}:null;}})['then'](respondWithResult(_0x1dcb75,null))[_0xa898('0x52')](handleError(_0x1dcb75,null));};exports['login']=function(_0x3eb78b,_0x58d4c3,_0x1ca280){var _0x447362;var _0x16e340;var _0x3305dd;var _0xfb78db=!_[_0xa898('0x60')](_0x3eb78b[_0xa898('0x54')]['id'])?_0x3eb78b['params']['id']:!_[_0xa898('0x60')](_0x3eb78b[_0xa898('0x25')]['id'])?_0x3eb78b[_0xa898('0x25')]['id']:null;return db[_0xa898('0x33')]['find']({'where':{'id':_0xfb78db,'role':{'$or':[_0xa898('0x23'),_0xa898('0x25'),'agent']}},'attributes':['id','name','phone',_0xa898('0xe7'),_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x98')]})[_0xa898('0x21')](function(_0x1f6445){if(_0x1f6445){if(_0x1f6445['role']===_0xa898('0x27')){_0x447362=_0x1f6445;if(_0x3eb78b['body']['interface']){_0x3305dd=util[_0xa898('0xa7')]('LOCAL/%s@from-sip/n',_0x447362[_0x3eb78b[_0xa898('0x57')][_0xa898('0x9a')]]);}else if(_0x3eb78b['body']['intrf']){_0x3305dd=util[_0xa898('0xa7')](_0xa898('0xa8'),_0x3eb78b[_0xa898('0x57')][_0xa898('0xe8')]);}else{_0x3305dd=util[_0xa898('0xa7')](_0xa898('0xa8'),_0x447362[_0xa898('0x31')]);}socket['to'](util[_0xa898('0xa7')]('user:%s',_0x447362[_0xa898('0x31')]))['emit'](_0xa898('0xe9'),{'user':{'id':_0x447362['id'],'name':_0x447362[_0xa898('0x31')]},'ip':_0x3eb78b['headers'][_0xa898('0xea')]||_0x3eb78b[_0xa898('0xeb')][_0xa898('0xec')]||_0x3eb78b[_0xa898('0xed')][_0xa898('0xec')]||_0x3eb78b[_0xa898('0xeb')][_0xa898('0xed')][_0xa898('0xec')]});return db[_0xa898('0xa9')]['destroy']({'where':{'membername':_0x447362['name']},'individualHooks':!![]});}}else{throw new db[(_0xa898('0x8c'))][(_0xa898('0x8b'))](_0xa898('0xee'));}})[_0xa898('0x21')](function(){if(_0x447362){return _0x447362[_0xa898('0xef')]({'raw':!![]});}})[_0xa898('0x21')](function(_0x4d030d){if(_0x447362){if(_0x4d030d){_0x16e340=_0x4d030d;if(_0x16e340[_0xa898('0x63')]){var _0x20ac6a=_0x16e340[_0xa898('0x2b')](function(_0x49b56d){var _0x885fe7={'membername':_0x447362[_0xa898('0x31')],'UserId':_0x447362['id'],'queue_name':_0x49b56d[_0xa898('0x31')],'VoiceQueueId':_0x49b56d['id'],'interface':_0x3305dd,'paused':_0x447362[_0xa898('0x98')]||![],'penalty':_0x49b56d[_0xa898('0xf0')]||0x0};return db['UserVoiceQueueRt'][_0xa898('0xaa')](_0x885fe7);});return Promise[_0xa898('0x51')](_0x20ac6a);}}}})[_0xa898('0x21')](function(){if(_0x447362){return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x447362[_0xa898('0x31')],'exitAt':null}});}})['then'](function(_0x5406f7){if(_0x447362){var _0x5156a7=[];_0x5406f7['forEach'](function(_0x23dd8e){_0x5156a7[_0xa898('0x47')](_0x23dd8e['update']({'exitAt':moment()[_0xa898('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa898('0x51')](_0x5156a7);}})[_0xa898('0x21')](function(){if(_0x447362){var _0x449c2b=[];var _0x3add47=[];var _0x51edfc=utils['getChannels']();var _0x2b5c72={'membername':_0x447362[_0xa898('0x31')],'interface':_0x3305dd,'enterAt':moment()[_0xa898('0xa7')](_0xa898('0xf2')),'role':_0x447362[_0xa898('0x1d')],'internal':_0x447362['internal']};_0x51edfc['forEach'](function(_0x4bae03){_0x449c2b['push'](_[_0xa898('0x55')]({'channel':_0x4bae03,'type':_0xa898('0xf3'),'data1':_0x3eb78b[_0xa898('0x57')][_0xa898('0xf4')],'data2':_0x3305dd},_0x2b5c72));if(_0x447362['loginInPause']){_0x3add47[_0xa898('0x47')](_[_0xa898('0x55')]({'channel':_0x4bae03,'type':_0xa898('0xf5'),'data1':_0xa898('0xf6')},_0x2b5c72));}});return db[_0xa898('0xf1')][_0xa898('0x81')](_0x449c2b[_0xa898('0xc2')](_0x3add47),{'individualHooks':!![]});}})['then'](function(){if(_0x447362){return _0x447362['update']({'online':!![],'lastLoginAt':moment()['format'](_0xa898('0xf2')),'voicePause':_0x447362[_0xa898('0x98')]||![],'mailPause':_0x447362['loginInPause']||![],'chatPause':_0x447362['loginInPause']||![],'faxPause':_0x447362['loginInPause']||![],'smsPause':_0x447362['loginInPause']||![],'openchannelPause':_0x447362['loginInPause']||![],'whatsappPause':_0x447362[_0xa898('0x98')]||![],'pauseType':_0x447362[_0xa898('0x98')]?_0xa898('0xf6'):null,'interface':_0x3305dd,'lastPauseAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))});}})[_0xa898('0x21')](function(_0x3c379c){if(_0x3eb78b['isMiddleware']){return _0x1ca280();}else{return Promise[_0xa898('0xf7')](_0x3c379c)[_0xa898('0x21')](respondWithResult(_0x58d4c3,null));}})[_0xa898('0x52')](handleError(_0x58d4c3,null));};exports[_0xa898('0xf8')]=function(_0x1f9185,_0x4c80e2){var _0x3edee9;return db['User']['find']({'where':{'id':_0x1f9185[_0xa898('0x54')]['id'],'role':_0xa898('0x27')},'attributes':['id',_0xa898('0x31'),_0xa898('0x1d')]})['then'](handleEntityNotFound(_0x4c80e2,null))[_0xa898('0x21')](function(_0xcdc236){if(_0xcdc236){_0x3edee9=_0xcdc236;return db[_0xa898('0xa9')][_0xa898('0x20')]({'where':{'membername':_0x3edee9[_0xa898('0x31')]},'individualHooks':!![]});}})[_0xa898('0x21')](function(){return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x3edee9[_0xa898('0x31')],'exitAt':null}});})['then'](function(_0x55d494){var _0x2bf181=[];_0x55d494[_0xa898('0xf9')](function(_0x1ad907){_0x2bf181[_0xa898('0x47')](_0x1ad907[_0xa898('0x1c')]({'exitAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))}));});return Promise['all'](_0x2bf181);})['then'](function(){return _0x3edee9['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa898('0x21')](respondWithResult(_0x4c80e2,null))['catch'](handleError(_0x4c80e2,null));};exports[_0xa898('0xfa')]=function(_0x27d79b,_0x359fa0){var _0x4f095b;return db['UserVoiceQueueRt'][_0xa898('0x1c')]({'paused':0x1},{'where':{'UserId':_0x27d79b['params']['id']},'individualHooks':!![]})[_0xa898('0x21')](function(){return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x27d79b[_0xa898('0x54')]['id'],'role':'agent'},'attributes':['id','name',_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x9a'),_0xa898('0x97')]});})[_0xa898('0x21')](handleEntityNotFound(_0x359fa0,null))[_0xa898('0x21')](function(_0x236775){if(_0x236775){_0x4f095b=_0x236775;return db[_0xa898('0xf1')][_0xa898('0x48')]({'where':{'membername':_0x4f095b[_0xa898('0x31')],'type':_0xa898('0xf5'),'exitAt':null}});}})[_0xa898('0x21')](function(_0x6204e3){if(_0x6204e3[_0xa898('0x63')]){var _0x22b8ef=moment()[_0xa898('0xa7')](_0xa898('0xf2'));for(var _0x5d6570=0x0,_0x24efd6=_0x6204e3[_0xa898('0x63')];_0x5d6570<_0x24efd6;_0x5d6570++){_0x6204e3[_0x5d6570][_0xa898('0xfb')]({'exitAt':_0x22b8ef});}}})[_0xa898('0x21')](function(){var _0x24ea18=[];var _0x4747d1=utils['getChannels']();_0x4747d1[_0xa898('0xf9')](function(_0x1ac4d2){_0x24ea18[_0xa898('0x47')]({'channel':_0x1ac4d2,'membername':_0x4f095b['name'],'interface':_[_0xa898('0x60')](_0x4f095b[_0xa898('0x9a')])?util[_0xa898('0xa7')](_0xa898('0xa8'),_0x4f095b[_0xa898('0x31')]):_0x4f095b[_0xa898('0x9a')],'type':_0xa898('0xf5'),'enterAt':moment()[_0xa898('0xa7')](_0xa898('0xf2')),'data1':_0x27d79b[_0xa898('0x57')][_0xa898('0xfc')]||_0xa898('0xfd'),'role':_0x4f095b[_0xa898('0x1d')],'internal':_0x4f095b[_0xa898('0x5b')]});});return db[_0xa898('0xf1')][_0xa898('0x81')](_0x24ea18,{'individualHooks':!![]});})['then'](function(){return _0x4f095b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x27d79b[_0xa898('0x57')][_0xa898('0xfc')]||_0xa898('0xfd'),'lastPauseAt':moment()[_0xa898('0xa7')](_0xa898('0xf2'))});})['then'](respondWithResult(_0x359fa0,null))['catch'](handleError(_0x359fa0,null));};exports['unpause']=function(_0x390600,_0x211110){if(_0x390600[_0xa898('0x57')][_0xa898('0x96')]&&!utils[_0xa898('0x9b')](_0x390600[_0xa898('0x57')][_0xa898('0x96')])){throw new APIBadRequestError(util[_0xa898('0xa7')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x390600[_0xa898('0x57')][_0xa898('0x96')]));}return db[_0xa898('0x33')][_0xa898('0x2d')]({'where':{'id':_0x390600['params']['id']},'attributes':['id','name',_0xa898('0x1d'),_0xa898('0x5b'),_0xa898('0x9a'),'online',_0xa898('0x99'),_0xa898('0xfe'),_0xa898('0xff'),_0xa898('0x100'),_0xa898('0x101'),_0xa898('0x102'),_0xa898('0x103'),_0xa898('0x104'),_0xa898('0x105')]})[_0xa898('0x21')](function(_0x13e43){if(!_0x13e43){throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x390600[_0xa898('0x54')]['id']));}return _0x13e43['unpause'](_0x390600[_0xa898('0x57')][_0xa898('0x96')]);})[_0xa898('0x21')](respondWithResult(_0x211110,null))[_0xa898('0x52')](APIHandleError(_0x211110));};exports[_0xa898('0x106')]=function(_0x528792,_0x4e3464){var _0x382a9e={};var _0x3a8bd0={};var _0x3b9fcb;var _0x2f5a32;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x528792['params']['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x4e3464,null))['then'](function(_0x2c05f9){if(_0x2c05f9){_0x3b9fcb=_0x2c05f9;_0x3a8bd0[_0xa898('0xcb')]=_['keys'](db[_0xa898('0x107')][_0xa898('0x34')]);_0x3a8bd0[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x528792[_0xa898('0x40')]);_0x3a8bd0[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x3a8bd0[_0xa898('0xcb')],_0x3a8bd0[_0xa898('0x40')]);_0x382a9e[_0xa898('0x46')]=_[_0xa898('0xcf')](_0x3a8bd0[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x528792[_0xa898('0x40')][_0xa898('0xd0')]));_0x382a9e[_0xa898('0x46')]=_0x382a9e[_0xa898('0x46')][_0xa898('0x63')]?_0x382a9e[_0xa898('0x46')]:_0x3a8bd0[_0xa898('0xcb')];_0x382a9e['order']=qs[_0xa898('0xd2')](_0x528792[_0xa898('0x40')][_0xa898('0xd2')]);_0x382a9e[_0xa898('0x3f')]=qs[_0xa898('0xce')](_['pick'](_0x528792[_0xa898('0x40')],_0x3a8bd0[_0xa898('0xce')]));if(_0x528792[_0xa898('0x40')][_0xa898('0x37')]){_0x382a9e['where']=_[_0xa898('0x55')](_0x382a9e[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x382a9e[_0xa898('0x46')],function(_0xd83c2b){var _0x14ce98={};_0x14ce98[_0xd83c2b]={'$like':'%'+_0x528792[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x14ce98;})});}_0x382a9e=_[_0xa898('0x55')]({},_0x382a9e,_0x528792[_0xa898('0x56')]);return _0x3b9fcb[_0xa898('0x106')](_0x382a9e);}})['then'](function(_0x17106e){if(_0x17106e){_0x2f5a32=_0x17106e[_0xa898('0x63')];if(!_0x528792[_0xa898('0x40')][_0xa898('0xc5')]('nolimit')){_0x382a9e['limit']=qs['limit'](_0x528792[_0xa898('0x40')][_0xa898('0x19')]);_0x382a9e['offset']=qs['offset'](_0x528792[_0xa898('0x40')][_0xa898('0x17')]);}return _0x3b9fcb['getTeams'](_0x382a9e);}})[_0xa898('0x21')](function(_0x318f66){if(_0x318f66){return _0x318f66?{'count':_0x2f5a32,'rows':_0x318f66}:null;}})[_0xa898('0x21')](respondWithResult(_0x4e3464,null))[_0xa898('0x52')](handleError(_0x4e3464,null));};exports[_0xa898('0x108')]=function(_0x1e32c9,_0x1c22a4){var _0x40cea4=_0x1e32c9[_0xa898('0x54')]['id'];var _0x36b90a=_0x1e32c9[_0xa898('0x57')]?_0x1e32c9[_0xa898('0x57')][_0xa898('0x59')]:null;var _0x9ef97a=[];return Promise[_0xa898('0xf7')]()['then'](function(){if(!_0x36b90a)throw new APIBadRequestError(_0xa898('0x109'));})[_0xa898('0x21')](function(){return db['User'][_0xa898('0x90')]({'where':{'id':_0x40cea4}});})[_0xa898('0x21')](function(_0x2fe81d){if(!_0x2fe81d)throw new APINotFoundError(util[_0xa898('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1e32c9[_0xa898('0x54')]['id']));return db['sequelize']['transaction'](function(_0x13e820){return _0x2fe81d[_0xa898('0x108')](_0x36b90a,{'transaction':_0x13e820})[_0xa898('0x21')](function(){return db[_0xa898('0x107')][_0xa898('0x48')]({'where':{'id':{'$in':_0x36b90a}}});})[_0xa898('0x21')](function(_0x414e4f){var _0x17ba08=_[_0xa898('0x2b')](_0x414e4f,function(_0x9a71bc){return _0x9a71bc['getAssociatedQueues']();});return Promise[_0xa898('0x51')](_0x17ba08);})['then'](function(_0x5e5ff3){_0x9ef97a=_[_0xa898('0x10a')](_0x5e5ff3);var _0x10a1c0=_['map'](_0x9ef97a,function(_0x126bc1){return _0x126bc1[_0xa898('0x10b')](_0x2fe81d['id'],{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x10a1c0);})[_0xa898('0x21')](function(){if(!_0x2fe81d[_0xa898('0x97')])return;var _0x47cbfb=_[_0xa898('0x37')](_0x9ef97a,function(_0x4e09ff){return _0x4e09ff[_0xa898('0x10c')](_0xa898('0x96'))===_0xa898('0x10d');});var _0x4b7df=_[_0xa898('0x2b')](_0x47cbfb,function(_0x3dd1ea){return db[_0xa898('0xa9')][_0xa898('0xaa')]({'membername':_0x2fe81d[_0xa898('0x31')],'UserId':_0x2fe81d['id'],'queue_name':_0x3dd1ea['name'],'VoiceQueueId':_0x3dd1ea['id'],'interface':_[_0xa898('0x60')](_0x2fe81d['interface'])?util[_0xa898('0xa7')]('SIP/%s',_0x2fe81d['name']):_0x2fe81d['interface'],'paused':_0x2fe81d[_0xa898('0x99')]||![],'penalty':_0x2fe81d[_0xa898('0xa0')]},{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x4b7df);})[_0xa898('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x36b90a}}});})[_0xa898('0x21')](function(_0x37617f){var _0x57651f=_[_0xa898('0x2b')](_0x37617f,function(_0x3efb67){return db[_0xa898('0x10e')][_0xa898('0x77')]({'UserId':_0x2fe81d['id'],'VoicePrefixId':_0x3efb67[_0xa898('0x10f')]},{'transaction':_0x13e820});});return Promise[_0xa898('0x51')](_0x57651f);});});})[_0xa898('0x21')](function(){for(var _0x1584a6=0x0;_0x1584a6<_0x9ef97a[_0xa898('0x63')];_0x1584a6++){var _0xbe68fc=_0x9ef97a[_0x1584a6][_0xa898('0x10c')](_0xa898('0x96'));var _0x4f8e31=_0xbe68fc+_0xa898('0xa2');socket[_0xa898('0x1e')](_0xa898('0x25')+_0xbe68fc+_0xa898('0xa4'),{'UserId':_0x40cea4,['queueField']:_0x9ef97a[_0x1584a6]['id']});}})[_0xa898('0x21')](respondWithStatusCode(_0x1c22a4,null))[_0xa898('0x52')](APIHandleError(_0x1c22a4));};exports['removeTeams']=function(_0x337415,_0x1a157f){var _0x2bc387=_0x337415[_0xa898('0x54')]['id'];var _0x3ddfc5=null;if(_0x337415[_0xa898('0x40')][_0xa898('0x59')]){_0x3ddfc5=_[_0xa898('0xac')](_0x337415[_0xa898('0x40')][_0xa898('0x59')])?_0x337415[_0xa898('0x40')][_0xa898('0x59')]:[_0x337415[_0xa898('0x40')]['ids']];}var _0x568805=[];return Promise['resolve']()[_0xa898('0x21')](function(){if(!_0x3ddfc5)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xa898('0x21')](function(){return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x2bc387}});})[_0xa898('0x21')](function(_0x444b79){if(!_0x444b79)throw new APINotFoundError(util[_0xa898('0xa7')](_0xa898('0xc4'),_0x337415[_0xa898('0x54')]['id']));return db[_0xa898('0x62')]['transaction'](function(_0x135096){return _0x444b79['removeTeams'](_0x3ddfc5,{'transaction':_0x135096})['then'](function(){return db[_0xa898('0x107')][_0xa898('0x48')]({'where':{'id':{'$in':_0x3ddfc5}}});})['then'](function(_0x5088b0){var _0xc9e24f=_[_0xa898('0x2b')](_0x5088b0,function(_0x272f9c){return _0x272f9c['getAssociatedQueues']();});return Promise[_0xa898('0x51')](_0xc9e24f);})[_0xa898('0x21')](function(_0x1c593b){_0x568805=_[_0xa898('0x10a')](_0x1c593b);var _0x185a30=_[_0xa898('0x2b')](_0x568805,function(_0x414a5b){return _0x414a5b['removeAgent'](_0x444b79['id'],{'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x185a30);})[_0xa898('0x21')](function(){if(!_0x444b79[_0xa898('0x97')])return;var _0x10cc15=_[_0xa898('0x37')](_0x568805,function(_0x378b3f){return _0x378b3f['getDataValue'](_0xa898('0x96'))===_0xa898('0x10d');});var _0x290bef=_[_0xa898('0x2b')](_0x10cc15,function(_0x34c16d){return db['UserVoiceQueueRt'][_0xa898('0x20')]({'where':{'VoiceQueueId':_0x34c16d['id'],'UserId':_0x444b79['id']},'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x290bef);})[_0xa898('0x21')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3ddfc5}}});})['then'](function(_0x46854a){var _0x28d8d1=_['map'](_0x46854a,function(_0x548cc1){return db[_0xa898('0x10e')][_0xa898('0x20')]({'where':{'UserId':_0x444b79['id'],'VoicePrefixId':_0x548cc1['VoicePrefixId']}},{'transaction':_0x135096});});return Promise[_0xa898('0x51')](_0x28d8d1);});});})[_0xa898('0x21')](function(){for(var _0x4d55c6=0x0;_0x4d55c6<_0x568805[_0xa898('0x63')];_0x4d55c6++){var _0x4d2748=_0x568805[_0x4d55c6][_0xa898('0x10c')](_0xa898('0x96'));var _0x572d03=_0x4d2748+_0xa898('0xa2');socket[_0xa898('0x1e')](_0xa898('0x25')+_0x4d2748+'Queue:remove',{'UserId':_0x2bc387,['queueField']:_0x568805[_0x4d55c6]['id']});}})['then'](respondWithStatusCode(_0x1a157f,null))[_0xa898('0x52')](APIHandleError(_0x1a157f));};exports[_0xa898('0x110')]=function(_0x1728b7,_0x20730c){var _0x226a2c={};var _0x1a2fe6={};var _0x21e6a9;var _0x5e9e45;return db[_0xa898('0x33')][_0xa898('0x90')]({'where':{'id':_0x1728b7[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x20730c,null))[_0xa898('0x21')](function(_0xda2378){if(_0xda2378){_0x21e6a9=_0xda2378;_0x1a2fe6[_0xa898('0xcb')]=_['keys'](db[_0xa898('0xc6')][_0xa898('0x34')]);_0x1a2fe6[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x1728b7['query']);_0x1a2fe6[_0xa898('0xce')]=_[_0xa898('0xcf')](_0x1a2fe6[_0xa898('0xcb')],_0x1a2fe6[_0xa898('0x40')]);_0x226a2c[_0xa898('0x46')]=_['intersection'](_0x1a2fe6[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x1728b7[_0xa898('0x40')][_0xa898('0xd0')]));_0x226a2c['attributes']=_0x226a2c['attributes'][_0xa898('0x63')]?_0x226a2c[_0xa898('0x46')]:_0x1a2fe6[_0xa898('0xcb')];_0x226a2c[_0xa898('0xd1')]=qs[_0xa898('0xd2')](_0x1728b7[_0xa898('0x40')][_0xa898('0xd2')]);_0x226a2c[_0xa898('0x3f')]=qs[_0xa898('0xce')](_[_0xa898('0xd3')](_0x1728b7[_0xa898('0x40')],_0x1a2fe6[_0xa898('0xce')]));if(_0x1728b7['query']['filter']){_0x226a2c[_0xa898('0x3f')]=_[_0xa898('0x55')](_0x226a2c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x226a2c[_0xa898('0x46')],function(_0x439fbe){var _0x4659dc={};_0x4659dc[_0x439fbe]={'$like':'%'+_0x1728b7['query']['filter']+'%'};return _0x4659dc;})});}_0x226a2c=_[_0xa898('0x55')]({},_0x226a2c,_0x1728b7[_0xa898('0x56')]);return _0x21e6a9[_0xa898('0x110')](_0x226a2c);}})[_0xa898('0x21')](function(_0x2d2dc8){if(_0x2d2dc8){_0x5e9e45=_0x2d2dc8[_0xa898('0x63')];if(!_0x1728b7[_0xa898('0x40')][_0xa898('0xc5')](_0xa898('0xd5'))){_0x226a2c['limit']=qs['limit'](_0x1728b7[_0xa898('0x40')]['limit']);_0x226a2c[_0xa898('0x17')]=qs['offset'](_0x1728b7[_0xa898('0x40')]['offset']);}return _0x21e6a9[_0xa898('0x110')](_0x226a2c);}})[_0xa898('0x21')](function(_0x1723c9){if(_0x1723c9){return _0x1723c9?{'count':_0x5e9e45,'rows':_0x1723c9}:null;}})['then'](respondWithResult(_0x20730c,null))[_0xa898('0x52')](handleError(_0x20730c,null));};exports['getAgents']=function(_0x15bc91,_0x5503a3){var _0x19e09c={};var _0x2c47f8={};var _0x8b6184;return db['User'][_0xa898('0x90')]({'where':{'id':_0x15bc91[_0xa898('0x54')]['id']}})[_0xa898('0x21')](handleEntityNotFound(_0x5503a3,null))[_0xa898('0x21')](function(_0x4bb1ca){if(_0x4bb1ca){_0x8b6184=_0x4bb1ca;_0x2c47f8[_0xa898('0xcb')]=_[_0xa898('0xcd')](db['User'][_0xa898('0x34')]);_0x2c47f8[_0xa898('0x40')]=_[_0xa898('0xcd')](_0x15bc91[_0xa898('0x40')]);_0x2c47f8['filters']=_[_0xa898('0xcf')](_0x2c47f8[_0xa898('0xcb')],_0x2c47f8[_0xa898('0x40')]);_0x19e09c[_0xa898('0x46')]=_['intersection'](_0x2c47f8[_0xa898('0xcb')],qs[_0xa898('0xd0')](_0x15bc91['query']['fields']));_0x19e09c['attributes']=_0x19e09c[_0xa898('0x46')][_0xa898('0x63')]?_0x19e09c[_0xa898('0x46')]:_0x2c47f8[_0xa898('0xcb')];_0x19e09c['order']=qs[_0xa898('0xd2')](_0x15bc91[_0xa898('0x40')]['sort']);_0x19e09c['where']=qs[_0xa898('0xce')](_['pick'](_0x15bc91['query'],_0x2c47f8[_0xa898('0xce')]));if(_0x15bc91['query'][_0xa898('0x37')]){_0x19e09c['where']=_[_0xa898('0x55')](_0x19e09c[_0xa898('0x3f')],{'$or':_[_0xa898('0x2b')](_0x19e09c[_0xa898('0x46')],function(_0x320457){var _0x47aa9c={};_0x47aa9c[_0x320457]={'$like':'%'+_0x15bc91[_0xa898('0x40')][_0xa898('0x37')]+'%'};return _0x47aa9c;})});}_0x19e09c[_0xa898('0xcb')]=db[_0xa898('0x33')];_0x19e09c['as']=_0xa898('0x26');_0x19e09c=_[_0xa898('0x55')]({},_0x19e09c,_0x15bc91[_0xa898('0x56')]);return _0x8b6184['getVoiceQueues']({'include':[_0x19e09c]});}})['then'](function(_0x156811){if(_0x156811){var _0xce9d38={},_0x3cffca=[];for(var _0x424193=0x0;_0x424193<_0x156811[_0xa898('0x63')];_0x424193+=0x1){for(var _0x981e7b=0x0,_0x20a9b5;_0x981e7b<_0x156811[_0x424193][_0xa898('0x26')]['length'];_0x981e7b+=0x1){_0x20a9b5=_0x156811[_0x424193][_0xa898('0x26')][_0x981e7b][_0xa898('0x22')]({'plain':!![]});_0xce9d38[_0x20a9b5['id']]=_0x20a9b5;}}_0xce9d38=_[_0xa898('0x111')](_0xce9d38);for(var _0x12327c=qs[_0xa898('0x17')](_0x15bc91[_0xa898('0x40')]['offset']);_0x12327c<_0xce9d38[_0xa898('0x63')]&&_0x3cffca['length']=_0x5bd7f9[_0x0414('0x4f')]){throw new Error(_0x0414('0x50'));}})[_0x0414('0x18')](function(){if(_0x28ead9){return db[_0x0414('0x45')][_0x0414('0x46')]({'where':{'membername':_0x28ead9[_0x0414('0x20')]},'individualHooks':!![]});}})[_0x0414('0x18')](function(){if(_0x28ead9){return _0x28ead9[_0x0414('0x51')]({'raw':!![]});}})[_0x0414('0x18')](function(_0x22f1ce){if(_0x28ead9){if(_0x22f1ce){var _0x3f3ca5=[];_0x1d7c0f=_0x22f1ce;if(_0x1d7c0f[_0x0414('0x2a')]){for(var _0x9e2dc=0x0;_0x9e2dc<_0x1d7c0f[_0x0414('0x2a')];_0x9e2dc++){_0x3f3ca5[_0x0414('0x47')](db[_0x0414('0x45')][_0x0414('0x52')]({'membername':_0x28ead9[_0x0414('0x20')],'UserId':_0x28ead9['id'],'queue_name':_0x1d7c0f[_0x9e2dc][_0x0414('0x20')],'VoiceQueueId':_0x1d7c0f[_0x9e2dc]['id'],'interface':_0x5acab7,'paused':_0x28ead9[_0x0414('0x53')]||![],'penalty':_0x1d7c0f[_0x9e2dc][_0x0414('0x54')]||0x0}));}return BPromise[_0x0414('0x48')](_0x3f3ca5);}}}})[_0x0414('0x18')](function(){if(_0x28ead9){return db[_0x0414('0x28')][_0x0414('0xf')]({'where':{'membername':_0x28ead9[_0x0414('0x20')],'exitAt':null}});}})['then'](function(_0x175a6d){if(_0x28ead9){if(_0x175a6d&&_0x175a6d[_0x0414('0x2a')]){var _0x40065a=[];_0x175a6d[_0x0414('0x55')](function(_0x20a1b8){_0x40065a['push'](_0x20a1b8['update']({'exitAt':moment()[_0x0414('0x24')](_0x0414('0x2f'))}));});return BPromise[_0x0414('0x48')](_0x40065a);}}})['then'](function(){if(_0x28ead9){var _0x323a78=[];var _0x2b0a11=[];var _0x210275=utils['getChannels']();var _0x33ce8e={'membername':_0x28ead9[_0x0414('0x20')],'interface':_0x5acab7,'enterAt':moment()['format'](_0x0414('0x2f')),'role':_0x28ead9['role'],'internal':_0x28ead9[_0x0414('0x22')]};_0x210275[_0x0414('0x55')](function(_0x35b928){_0x323a78[_0x0414('0x47')](_['merge']({'channel':_0x35b928,'type':_0x0414('0x56'),'data1':_0x0414('0x57'),'data2':_0x5acab7},_0x33ce8e));if(_0x28ead9[_0x0414('0x53')]){_0x2b0a11['push'](_[_0x0414('0x58')]({'channel':_0x35b928,'type':'PAUSE','data1':_0x0414('0x59')},_0x33ce8e));}});return db[_0x0414('0x28')][_0x0414('0x33')](_0x323a78[_0x0414('0x5a')](_0x2b0a11),{'individualHooks':!![]});}})['then'](function(){if(_0x28ead9){return _0x28ead9[_0x0414('0x27')]({'online':!![],'lastLoginAt':moment()[_0x0414('0x24')](_0x0414('0x2f')),'voicePause':_0x28ead9[_0x0414('0x53')]||![],'mailPause':_0x28ead9['loginInPause']||![],'chatPause':_0x28ead9['loginInPause']||![],'faxPause':_0x28ead9['loginInPause']||![],'smsPause':_0x28ead9['loginInPause']||![],'openchannelPause':_0x28ead9[_0x0414('0x53')]||![],'pauseType':_0x28ead9['loginInPause']?_0x0414('0x59'):null,'lastPauseAt':moment()['format'](_0x0414('0x2f')),'interface':_0x5acab7});}})['then'](function(_0x57fd59){_0x55a8cb(_0x57fd59);})[_0x0414('0x1a')](function(_0x396dcb){_0x35c0ef(_0x1de634[_0x0414('0x1b')](0x1f4,_0x396dcb[_0x0414('0x1c')]));});});}; \ No newline at end of file +var _0xebcd=['MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','bulkCreate','type','UnpauseUser','resolve','Channel\x20parameter\x20%s\x20is\x20invalid','channel','findOne','internal','online','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','unpause','LogoutUser','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','all','getChannels','merge','LOGIN','callysquare','PAUSE','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','attributes','limit','map','model','include','then','info','debug','catch','message','ShowUser','User','stringify','error','PauseUser','find','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update'];(function(_0x497672,_0x12ffe6){var _0x392c0b=function(_0x52de72){while(--_0x52de72){_0x497672['push'](_0x497672['shift']());}};_0x392c0b(++_0x12ffe6);}(_0xebcd,0x140));var _0xdebc=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xebcd[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require(_0xdebc('0x0'));var util=require(_0xdebc('0x1'));var moment=require(_0xdebc('0x2'));var BPromise=require(_0xdebc('0x3'));var Redis=require(_0xdebc('0x4'));var db=require(_0xdebc('0x5'))['db'];var utils=require(_0xdebc('0x6'));var logger=require(_0xdebc('0x7'))(_0xdebc('0x8'));var config=require(_0xdebc('0x9'));config[_0xdebc('0xa')]=_[_0xdebc('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdebc('0xc'))(new Redis(config['redis']));require(_0xdebc('0xd'))[_0xdebc('0xe')](socket);exports[_0xdebc('0xf')]=function(_0x1750d1){var _0x259a43=this;return new Promise(function(_0xfa1a9,_0x3a09b5){return db['User'][_0xdebc('0x10')]({'raw':_0x1750d1['options']?_0x1750d1[_0xdebc('0x11')][_0xdebc('0x12')]===undefined?!![]:![]:!![],'where':_0x1750d1['options']?_0x1750d1[_0xdebc('0x11')][_0xdebc('0x13')]||null:null,'attributes':_0x1750d1[_0xdebc('0x11')]?_0x1750d1[_0xdebc('0x11')][_0xdebc('0x14')]||null:null,'limit':_0x1750d1[_0xdebc('0x11')]?_0x1750d1[_0xdebc('0x11')][_0xdebc('0x15')]||null:null,'include':_0x1750d1[_0xdebc('0x11')]?_0x1750d1[_0xdebc('0x11')]['include']?_[_0xdebc('0x16')](_0x1750d1[_0xdebc('0x11')]['include'],function(_0x4b357d){return{'model':db[_0x4b357d[_0xdebc('0x17')]],'as':_0x4b357d['as'],'attributes':_0x4b357d[_0xdebc('0x14')],'include':_0x4b357d[_0xdebc('0x18')]?_['map'](_0x4b357d[_0xdebc('0x18')],function(_0x367b4d){return{'model':db[_0x367b4d[_0xdebc('0x17')]],'as':_0x367b4d['as'],'attributes':_0x367b4d[_0xdebc('0x14')],'include':_0x367b4d['include']?_[_0xdebc('0x16')](_0x367b4d['include'],function(_0x27abbe){return{'model':db[_0x27abbe[_0xdebc('0x17')]],'as':_0x27abbe['as'],'attributes':_0x27abbe[_0xdebc('0x14')]};}):[]};}):[]};}):[]:[]})[_0xdebc('0x19')](function(_0x5e4681){logger[_0xdebc('0x1a')]('GetUser',_0x1750d1);logger[_0xdebc('0x1b')]('GetUser',_0x1750d1,JSON['stringify'](_0x5e4681));_0xfa1a9(_0x5e4681);})[_0xdebc('0x1c')](function(_0x25dab7){logger['error']('GetUser',_0x25dab7[_0xdebc('0x1d')],_0x1750d1);_0x3a09b5(_0x259a43['error'](0x1f4,_0x25dab7['message']));});});};exports[_0xdebc('0x1e')]=function(_0x476e78){var _0x3a0d8a=this;return new Promise(function(_0x3c4942,_0x3e9397){return db[_0xdebc('0x1f')]['find']({'raw':_0x476e78[_0xdebc('0x11')]?_0x476e78['options']['raw']===undefined?!![]:![]:!![],'where':_0x476e78[_0xdebc('0x11')]?_0x476e78[_0xdebc('0x11')][_0xdebc('0x13')]||null:null,'attributes':_0x476e78[_0xdebc('0x11')]?_0x476e78[_0xdebc('0x11')][_0xdebc('0x14')]||null:null,'include':_0x476e78[_0xdebc('0x11')]?_0x476e78[_0xdebc('0x11')]['include']?_[_0xdebc('0x16')](_0x476e78[_0xdebc('0x11')][_0xdebc('0x18')],function(_0x8c15bd){return{'model':db[_0x8c15bd['model']],'as':_0x8c15bd['as'],'attributes':_0x8c15bd[_0xdebc('0x14')],'include':_0x8c15bd[_0xdebc('0x18')]?_[_0xdebc('0x16')](_0x8c15bd[_0xdebc('0x18')],function(_0x4a47d3){return{'model':db[_0x4a47d3['model']],'as':_0x4a47d3['as'],'attributes':_0x4a47d3['attributes'],'include':_0x4a47d3['include']?_[_0xdebc('0x16')](_0x4a47d3[_0xdebc('0x18')],function(_0x15691a){return{'model':db[_0x15691a[_0xdebc('0x17')]],'as':_0x15691a['as'],'attributes':_0x15691a[_0xdebc('0x14')]};}):[]};}):[]};}):[]:[]})[_0xdebc('0x19')](function(_0x369bba){logger[_0xdebc('0x1a')](_0xdebc('0x1e'),_0x476e78);logger[_0xdebc('0x1b')]('ShowUser',_0x476e78,JSON[_0xdebc('0x20')](_0x369bba));_0x3c4942(_0x369bba);})[_0xdebc('0x1c')](function(_0x2c6dca){logger[_0xdebc('0x21')](_0xdebc('0x1e'),_0x2c6dca[_0xdebc('0x1d')],_0x476e78);_0x3e9397(_0x3a0d8a['error'](0x1f4,_0x2c6dca[_0xdebc('0x1d')]));});});};exports[_0xdebc('0x22')]=function(_0x3001f0){var _0x32b417;return db[_0xdebc('0x1f')][_0xdebc('0x23')]({'where':_0x3001f0[_0xdebc('0x11')][_0xdebc('0x13')]||{},'attributes':['id',_0xdebc('0x24'),_0xdebc('0x25'),'internal',_0xdebc('0x26')]})['then'](function(_0x19a306){if(!_0x19a306){throw new Error(util[_0xdebc('0x27')](_0xdebc('0x28'),_0x3001f0[_0xdebc('0x29')]['id']));}_0x32b417=_0x19a306;return db[_0xdebc('0x2a')][_0xdebc('0x2b')]({'paused':0x1},{'where':{'UserId':_0x32b417['id']},'individualHooks':!![]});})['then'](function(){return db[_0xdebc('0x2c')][_0xdebc('0x10')]({'where':{'membername':_0x32b417[_0xdebc('0x24')],'type':'PAUSE','exitAt':null}});})[_0xdebc('0x19')](function(_0x585bc5){if(_0x585bc5&&_0x585bc5[_0xdebc('0x2d')]){var _0xeb71a4=moment()[_0xdebc('0x27')](_0xdebc('0x2e'));for(var _0x4461df=0x0,_0x5b99b4=_0x585bc5['length'];_0x4461df<_0x5b99b4;_0x4461df++){_0x585bc5[_0x4461df][_0xdebc('0x2f')]({'exitAt':_0xeb71a4});}}})[_0xdebc('0x19')](function(){var _0x39bd51=[];var _0x379ef5=utils['getChannels']();_0x379ef5[_0xdebc('0x30')](function(_0x973f7f){_0x39bd51[_0xdebc('0x31')]({'channel':_0x973f7f,'membername':_0x32b417['name'],'interface':_[_0xdebc('0x32')](_0x32b417[_0xdebc('0x26')])?util[_0xdebc('0x27')](_0xdebc('0x33'),_0x32b417[_0xdebc('0x24')]):_0x32b417['interface'],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3001f0[_0xdebc('0x34')]['type']||_0xdebc('0x35'),'role':_0x32b417['role'],'internal':_0x32b417['internal'],'uniqueid':_0x3001f0[_0xdebc('0x34')]['uniqueid']||null});});return db[_0xdebc('0x2c')][_0xdebc('0x36')](_0x39bd51,{'individualHooks':!![]});})[_0xdebc('0x19')](function(){return _0x32b417['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3001f0[_0xdebc('0x34')][_0xdebc('0x37')]||_0xdebc('0x35'),'lastPauseAt':moment()[_0xdebc('0x27')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x5e35cb){throw _0x5e35cb;});};exports[_0xdebc('0x38')]=function(_0x4f16bc){return Promise[_0xdebc('0x39')]()[_0xdebc('0x19')](function(){if(_0x4f16bc[_0xdebc('0x34')]['channel']&&!utils['isValidChannel'](_0x4f16bc['body']['channel'])){throw new Error(util[_0xdebc('0x27')](_0xdebc('0x3a'),_0x4f16bc['body'][_0xdebc('0x3b')]));}return db[_0xdebc('0x1f')][_0xdebc('0x3c')]({'where':_0x4f16bc[_0xdebc('0x11')]['where']||{},'attributes':['id',_0xdebc('0x24'),_0xdebc('0x25'),_0xdebc('0x3d'),'interface',_0xdebc('0x3e'),'voicePause',_0xdebc('0x3f'),_0xdebc('0x40'),_0xdebc('0x41'),'openchannelPause',_0xdebc('0x42'),_0xdebc('0x43'),_0xdebc('0x44'),'lastPauseAt']});})[_0xdebc('0x19')](function(_0x368d09){if(!_0x368d09){throw new Error(util[_0xdebc('0x27')](_0xdebc('0x28'),_0x4f16bc['params']['id']));}return _0x368d09[_0xdebc('0x45')](_0x4f16bc['body'][_0xdebc('0x3b')],'system');})[_0xdebc('0x1c')](function(_0x2ee6b0){throw _0x2ee6b0;});};exports[_0xdebc('0x46')]=function(_0xe949ed){var _0x5eb0f9=this;return new Promise(function(_0x44bbe6,_0x3f324c){var _0x3cb459;return db[_0xdebc('0x1f')][_0xdebc('0x3c')]({'where':_0xe949ed[_0xdebc('0x11')]['where']||{},'attributes':['id',_0xdebc('0x24')]})[_0xdebc('0x19')](function(_0x44fbc1){if(_0x44fbc1){_0x3cb459=_0x44fbc1;return db[_0xdebc('0x2a')]['destroy']({'where':{'membername':_0x3cb459[_0xdebc('0x24')]},'individualHooks':!![]});}})[_0xdebc('0x19')](function(){if(_0x3cb459){return db[_0xdebc('0x2c')]['findAll']({'where':{'membername':_0x3cb459[_0xdebc('0x24')],'exitAt':null}});}})[_0xdebc('0x19')](function(_0x482da8){if(_0x3cb459){if(_0x482da8&&_0x482da8[_0xdebc('0x2d')]){var _0x158b0d=[];_0x482da8[_0xdebc('0x30')](function(_0x214819){_0x158b0d[_0xdebc('0x31')](_0x214819[_0xdebc('0x2b')]({'exitAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e'))}));});return BPromise['all'](_0x158b0d);}}})['then'](function(){if(_0x3cb459){return _0x3cb459[_0xdebc('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdebc('0x19')](function(_0x31688e){_0x44bbe6(_0x31688e);})[_0xdebc('0x1c')](function(_0x280ddf){_0x3f324c(_0x5eb0f9[_0xdebc('0x21')](0x1f4,_0x280ddf[_0xdebc('0x1d')]));});});};exports[_0xdebc('0x47')]=function(_0x18e513){var _0xfcbaaa=this;return new Promise(function(_0x38458a,_0x3f8b9d){var _0x443432;var _0x75b82d;var _0xee4591;var _0x3b4c1b;return db[_0xdebc('0x1f')][_0xdebc('0x3c')]({'where':_0x18e513[_0xdebc('0x11')][_0xdebc('0x13')]||{},'attributes':['id','name',_0xdebc('0x25'),_0xdebc('0x48'),'phone',_0xdebc('0x3d'),_0xdebc('0x49'),_0xdebc('0x26')]})['then'](function(_0x589acf){if(_0x589acf){_0x443432=_0x589acf;_0x3b4c1b=_0x18e513[_0xdebc('0x34')]['interface']?_0x18e513[_0xdebc('0x34')]['interface']:util[_0xdebc('0x27')](_0xdebc('0x33'),_0x443432[_0xdebc('0x24')]);return db[_0xdebc('0x1f')][_0xdebc('0x4a')]({'where':{'role':_0xdebc('0x4b'),'online':!![],'id':{'$ne':_0x443432['id']}}});}})[_0xdebc('0x19')](function(_0x211221){if(_0x211221){_0xee4591=_0x211221;return require(_0xdebc('0x4c'))['getLicense']();}})[_0xdebc('0x19')](function(_0x28b418){if(_0x28b418&&_0x28b418[_0xdebc('0x4d')]&&_0xee4591>=_0x28b418[_0xdebc('0x4d')]){throw new Error(_0xdebc('0x4e'));}})[_0xdebc('0x19')](function(){if(_0x443432){return db['UserVoiceQueueRt'][_0xdebc('0x4f')]({'where':{'membername':_0x443432[_0xdebc('0x24')]},'individualHooks':!![]});}})[_0xdebc('0x19')](function(){if(_0x443432){return _0x443432[_0xdebc('0x50')]({'raw':!![]});}})['then'](function(_0x56c601){if(_0x443432){if(_0x56c601){var _0x1a09ec=[];_0x75b82d=_0x56c601;if(_0x75b82d[_0xdebc('0x2d')]){for(var _0x2c29fe=0x0;_0x2c29fe<_0x75b82d[_0xdebc('0x2d')];_0x2c29fe++){_0x1a09ec[_0xdebc('0x31')](db['UserVoiceQueueRt'][_0xdebc('0x51')]({'membername':_0x443432[_0xdebc('0x24')],'UserId':_0x443432['id'],'queue_name':_0x75b82d[_0x2c29fe][_0xdebc('0x24')],'VoiceQueueId':_0x75b82d[_0x2c29fe]['id'],'interface':_0x3b4c1b,'paused':_0x443432['loginInPause']||![],'penalty':_0x75b82d[_0x2c29fe][_0xdebc('0x52')]||0x0}));}return BPromise[_0xdebc('0x53')](_0x1a09ec);}}}})[_0xdebc('0x19')](function(){if(_0x443432){return db[_0xdebc('0x2c')]['findAll']({'where':{'membername':_0x443432['name'],'exitAt':null}});}})[_0xdebc('0x19')](function(_0x357d52){if(_0x443432){if(_0x357d52&&_0x357d52[_0xdebc('0x2d')]){var _0xf7c2b0=[];_0x357d52[_0xdebc('0x30')](function(_0x5828b1){_0xf7c2b0[_0xdebc('0x31')](_0x5828b1[_0xdebc('0x2b')]({'exitAt':moment()['format'](_0xdebc('0x2e'))}));});return BPromise['all'](_0xf7c2b0);}}})[_0xdebc('0x19')](function(){if(_0x443432){var _0x116d54=[];var _0x28a884=[];var _0x49ce0f=utils[_0xdebc('0x54')]();var _0x372182={'membername':_0x443432[_0xdebc('0x24')],'interface':_0x3b4c1b,'enterAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'role':_0x443432[_0xdebc('0x25')],'internal':_0x443432[_0xdebc('0x3d')]};_0x49ce0f[_0xdebc('0x30')](function(_0x4efbde){_0x116d54[_0xdebc('0x31')](_[_0xdebc('0x55')]({'channel':_0x4efbde,'type':_0xdebc('0x56'),'data1':_0xdebc('0x57'),'data2':_0x3b4c1b},_0x372182));if(_0x443432[_0xdebc('0x49')]){_0x28a884[_0xdebc('0x31')](_['merge']({'channel':_0x4efbde,'type':_0xdebc('0x58'),'data1':_0xdebc('0x59')},_0x372182));}});return db[_0xdebc('0x2c')][_0xdebc('0x36')](_0x116d54[_0xdebc('0x5a')](_0x28a884),{'individualHooks':!![]});}})[_0xdebc('0x19')](function(){if(_0x443432){return _0x443432[_0xdebc('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'voicePause':_0x443432[_0xdebc('0x49')]||![],'mailPause':_0x443432[_0xdebc('0x49')]||![],'chatPause':_0x443432[_0xdebc('0x49')]||![],'faxPause':_0x443432[_0xdebc('0x49')]||![],'smsPause':_0x443432[_0xdebc('0x49')]||![],'openchannelPause':_0x443432[_0xdebc('0x49')]||![],'pauseType':_0x443432[_0xdebc('0x49')]?_0xdebc('0x59'):null,'lastPauseAt':moment()[_0xdebc('0x27')](_0xdebc('0x2e')),'interface':_0x3b4c1b});}})['then'](function(_0x5869b5){_0x38458a(_0x5869b5);})['catch'](function(_0x5d2be3){_0x3f8b9d(_0xfcbaaa[_0xdebc('0x21')](0x1f4,_0x5d2be3[_0xdebc('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 20666eb..d7b885b 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 _0xf761=['length','./user.events','save','remove','update','emit','removeListener'];(function(_0x234619,_0x5bc30e){var _0x5fa69=function(_0x52b387){while(--_0x52b387){_0x234619['push'](_0x234619['shift']());}};_0x5fa69(++_0x5bc30e);}(_0xf761,0x1dd));var _0x1f76=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xf761[_0x15ca1a];return _0x507626;};'use strict';var UserEvents=require(_0x1f76('0x0'));var events=[_0x1f76('0x1'),_0x1f76('0x2'),_0x1f76('0x3')];function createListener(_0x473586,_0x5b97ab){return function(_0x3e5c7b){_0x5b97ab[_0x1f76('0x4')](_0x473586,_0x3e5c7b);};}function removeListener(_0x5e577a,_0x456a42){return function(){UserEvents[_0x1f76('0x5')](_0x5e577a,_0x456a42);};}exports['register']=function(_0x49d6ba){for(var _0xb665d0=0x0,_0x2e0f24=events[_0x1f76('0x6')];_0xb665d0<_0x2e0f24;_0xb665d0++){var _0x1fb8c3=events[_0xb665d0];var _0x17bf00=createListener('user:'+_0x1fb8c3,_0x49d6ba);UserEvents['on'](_0x1fb8c3,_0x17bf00);}}; \ No newline at end of file +var _0xdb77=['emit','removeListener','register','user:','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb77,0xb8));var _0x7db7=function(_0x25bfc0,_0x2a9e01){_0x25bfc0=_0x25bfc0-0x0;var _0x41395d=_0xdb77[_0x25bfc0];return _0x41395d;};'use strict';var UserEvents=require('./user.events');var events=[_0x7db7('0x0'),_0x7db7('0x1'),'update'];function createListener(_0x1aa7e9,_0x126906){return function(_0x39c787){_0x126906[_0x7db7('0x2')](_0x1aa7e9,_0x39c787);};}function removeListener(_0x478f15,_0x4ff382){return function(){UserEvents[_0x7db7('0x3')](_0x478f15,_0x4ff382);};}exports[_0x7db7('0x4')]=function(_0x30d6d6){for(var _0x101305=0x0,_0x2f70f7=events['length'];_0x101305<_0x2f70f7;_0x101305++){var _0x1915a7=events[_0x101305];var _0x5727f2=createListener(_0x7db7('0x5')+_0x1915a7,_0x30d6d6);UserEvents['on'](_0x1915a7,_0x5727f2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 04891a6..f10b455 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x109de0,_0x110f6d){var _0x118357=function(_0x3ef478){while(--_0x3ef478){_0x109de0['push'](_0x109de0['shift']());}};_0x118357(++_0x110f6d);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0xe706[_0x3a7bdf];return _0x35a9a8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 444719c..58798e3 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 _0xd271=['INTEGER','exports'];(function(_0x22e297,_0x1b87ba){var _0x119376=function(_0x5606ed){while(--_0x5606ed){_0x22e297['push'](_0x22e297['shift']());}};_0x119376(++_0x1b87ba);}(_0xd271,0xf5));var _0x1d27=function(_0x3325fa,_0x2148ac){_0x3325fa=_0x3325fa-0x0;var _0x1ac753=_0xd271[_0x3325fa];return _0x1ac753;};'use strict';var Sequelize=require('sequelize');module[_0x1d27('0x0')]={'penalty':{'type':Sequelize[_0x1d27('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea85=['INTEGER','sequelize','exports'];(function(_0x474058,_0x4e1fc5){var _0x15f033=function(_0x172070){while(--_0x172070){_0x474058['push'](_0x474058['shift']());}};_0x15f033(++_0x4e1fc5);}(_0xea85,0x1ea));var _0x5ea8=function(_0x127771,_0x26020a){_0x127771=_0x127771-0x0;var _0x948cee=_0xea85[_0x127771];return _0x948cee;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module[_0x5ea8('0x1')]={'penalty':{'type':Sequelize[_0x5ea8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 49c2219..5259942 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 _0x68c6=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue'];(function(_0x408f19,_0x3b4fb6){var _0x5d4738=function(_0x90b577){while(--_0x90b577){_0x408f19['push'](_0x408f19['shift']());}};_0x5d4738(++_0x3b4fb6);}(_0x68c6,0x17c));var _0x668c=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0x68c6[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x668c('0x0'));var util=require(_0x668c('0x1'));var logger=require('../../config/logger')(_0x668c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x668c('0x3'));var fs=require('fs');var path=require(_0x668c('0x4'));var rimraf=require(_0x668c('0x5'));var config=require(_0x668c('0x6'));var attributes=require(_0x668c('0x7'));module[_0x668c('0x8')]=function(_0x3ab64e,_0x1c13f6){return _0x3ab64e['define'](_0x668c('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50f0=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x6a89d9,_0x57b654){var _0x56d771=function(_0x4dc322){while(--_0x4dc322){_0x6a89d9['push'](_0x6a89d9['shift']());}};_0x56d771(++_0x57b654);}(_0x50f0,0x1bd));var _0x050f=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0x50f0[_0x1f3aec];return _0x409f0d;};'use strict';var _=require('lodash');var util=require(_0x050f('0x0'));var logger=require(_0x050f('0x1'))(_0x050f('0x2'));var moment=require('moment');var BPromise=require(_0x050f('0x3'));var rp=require(_0x050f('0x4'));var fs=require('fs');var path=require(_0x050f('0x5'));var rimraf=require(_0x050f('0x6'));var config=require(_0x050f('0x7'));var attributes=require(_0x050f('0x8'));module[_0x050f('0x9')]=function(_0x4d5bee,_0x4e8a65){return _0x4d5bee[_0x050f('0xa')](_0x050f('0xb'),attributes,{'tableName':_0x050f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 500c66f..76e27da 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 _0xaefc=['stringify','error','code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xaefc,0x10a));var _0xcaef=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xaefc[_0x234ae1];return _0x227ba0;};'use strict';var _=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaef('0x2'))['db'];var utils=require(_0xcaef('0x3'));var logger=require('../../config/logger')(_0xcaef('0x4'));var config=require(_0xcaef('0x5'));var jayson=require(_0xcaef('0x6'));var client=jayson[_0xcaef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd61616,_0x584cc3,_0x1971be){return new BPromise(function(_0x597d7d,_0x26f35e){return client[_0xcaef('0x8')](_0xd61616,_0x1971be)[_0xcaef('0x9')](function(_0x4d79b9){logger[_0xcaef('0xa')](_0xcaef('0xb'),_0x584cc3,_0xcaef('0xc'));logger['debug'](_0xcaef('0xd'),_0x584cc3,'request\x20sent',JSON[_0xcaef('0xe')](_0x4d79b9));if(_0x4d79b9['error']){if(_0x4d79b9[_0xcaef('0xf')][_0xcaef('0x10')]===0x1f4){logger[_0xcaef('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x584cc3,_0x4d79b9['error'][_0xcaef('0x11')]);return _0x26f35e(_0x4d79b9[_0xcaef('0xf')][_0xcaef('0x11')]);}logger[_0xcaef('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x584cc3,_0x4d79b9['error'][_0xcaef('0x11')]);return _0x597d7d(_0x4d79b9['error'][_0xcaef('0x11')]);}else{logger[_0xcaef('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x584cc3,_0xcaef('0xc'));_0x597d7d(_0x4d79b9[_0xcaef('0x12')]['message']);}})[_0xcaef('0x13')](function(_0x4a5457){logger[_0xcaef('0xf')](_0xcaef('0xb'),_0x584cc3,_0x4a5457);_0x26f35e(_0x4a5457);});});} \ No newline at end of file +var _0x2712=['rpc','../../config/environment','jayson/promise','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2712,0x19e));var _0x2271=function(_0x4b769c,_0x541b21){_0x4b769c=_0x4b769c-0x0;var _0x490a31=_0x2712[_0x4b769c];return _0x490a31;};'use strict';var _=require(_0x2271('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2271('0x1'));var rs=require(_0x2271('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2271('0x3'))['db'];var utils=require(_0x2271('0x4'));var logger=require(_0x2271('0x5'))(_0x2271('0x6'));var config=require(_0x2271('0x7'));var jayson=require(_0x2271('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x546d1c,_0x3a671f,_0x78c076){return new BPromise(function(_0x526b31,_0x3c5680){return client[_0x2271('0x9')](_0x546d1c,_0x78c076)[_0x2271('0xa')](function(_0x8165e1){logger[_0x2271('0xb')](_0x2271('0xc'),_0x3a671f,_0x2271('0xd'));logger[_0x2271('0xe')](_0x2271('0xf'),_0x3a671f,'request\x20sent',JSON[_0x2271('0x10')](_0x8165e1));if(_0x8165e1[_0x2271('0x11')]){if(_0x8165e1[_0x2271('0x11')]['code']===0x1f4){logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x8165e1['error']['message']);return _0x3c5680(_0x8165e1[_0x2271('0x11')][_0x2271('0x12')]);}logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x8165e1['error']['message']);return _0x526b31(_0x8165e1[_0x2271('0x11')][_0x2271('0x12')]);}else{logger[_0x2271('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x3a671f,'request\x20sent');_0x526b31(_0x8165e1[_0x2271('0x13')][_0x2271('0x12')]);}})['catch'](function(_0x5be2ef){logger[_0x2271('0x11')](_0x2271('0xc'),_0x3a671f,_0x5be2ef);_0x3c5680(_0x5be2ef);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d571fb6..fd0c920 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3bf4f0,_0x316456){var _0x2c6a5c=function(_0x412cf){while(--_0x412cf){_0x3bf4f0['push'](_0x3bf4f0['shift']());}};_0x2c6a5c(++_0x316456);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3fa4b4,_0x435846){var _0x160c23=function(_0x371c51){while(--_0x371c51){_0x3fa4b4['push'](_0x3fa4b4['shift']());}};_0x160c23(++_0x435846);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xcb91[_0x328534];return _0x2796c0;};'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 fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c8bb3b1..3a89261 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 _0x37bb=['exports','INTEGER','STRING','sequelize'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0x37bb,0x1d3));var _0xb37b=function(_0x1dc2b4,_0x36aab4){_0x1dc2b4=_0x1dc2b4-0x0;var _0x409555=_0x37bb[_0x1dc2b4];return _0x409555;};'use strict';var Sequelize=require(_0xb37b('0x0'));module[_0xb37b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb37b('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb37b('0x3')]}}; \ No newline at end of file +var _0x87c2=['exports','INTEGER','STRING'];(function(_0x710d6f,_0x469528){var _0x1c2271=function(_0x11d047){while(--_0x11d047){_0x710d6f['push'](_0x710d6f['shift']());}};_0x1c2271(++_0x469528);}(_0x87c2,0xbd));var _0x287c=function(_0x12b896,_0x842bfd){_0x12b896=_0x12b896-0x0;var _0x19884c=_0x87c2[_0x12b896];return _0x19884c;};'use strict';var Sequelize=require('sequelize');module[_0x287c('0x0')]={'penalty':{'type':Sequelize[_0x287c('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x287c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 194f5d8..1d1231d 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 _0x9339=['../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x475006,_0x471d91){var _0x4737e6=function(_0x10b762){while(--_0x10b762){_0x475006['push'](_0x475006['shift']());}};_0x4737e6(++_0x471d91);}(_0x9339,0x1c7));var _0x9933=function(_0x5b95f2,_0x2adb49){_0x5b95f2=_0x5b95f2-0x0;var _0x376b33=_0x9339[_0x5b95f2];return _0x376b33;};'use strict';var _=require(_0x9933('0x0'));var util=require('util');var logger=require(_0x9933('0x1'))(_0x9933('0x2'));var moment=require(_0x9933('0x3'));var BPromise=require(_0x9933('0x4'));var rp=require(_0x9933('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9933('0x6'));var config=require(_0x9933('0x7'));var attributes=require(_0x9933('0x8'));module['exports']=function(_0x1afdb8,_0x303a01){return _0x1afdb8[_0x9933('0x9')]('UserFaxQueue',attributes,{'tableName':_0x9933('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf69=['../../config/logger','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','lodash'];(function(_0x4ca7c2,_0x3928b9){var _0x2a3d78=function(_0x627669){while(--_0x627669){_0x4ca7c2['push'](_0x4ca7c2['shift']());}};_0x2a3d78(++_0x3928b9);}(_0xdf69,0xe9));var _0x9df6=function(_0x2f33b3,_0x1c789d){_0x2f33b3=_0x2f33b3-0x0;var _0x31276c=_0xdf69[_0x2f33b3];return _0x31276c;};'use strict';var _=require(_0x9df6('0x0'));var util=require('util');var logger=require(_0x9df6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9df6('0x2'));var rp=require(_0x9df6('0x3'));var fs=require('fs');var path=require(_0x9df6('0x4'));var rimraf=require('rimraf');var config=require(_0x9df6('0x5'));var attributes=require(_0x9df6('0x6'));module[_0x9df6('0x7')]=function(_0x4cfab4,_0x16dd03){return _0x4cfab4[_0x9df6('0x8')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','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 863ab98..b6a54e1 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 _0xdcb5=['client','http','request','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x3e80b2,_0x27425b){var _0x10a383=function(_0x36727e){while(--_0x36727e){_0x3e80b2['push'](_0x3e80b2['shift']());}};_0x10a383(++_0x27425b);}(_0xdcb5,0x14e));var _0x5dcb=function(_0x4ad61b,_0x18e31b){_0x4ad61b=_0x4ad61b-0x0;var _0x50e92f=_0xdcb5[_0x4ad61b];return _0x50e92f;};'use strict';var _=require(_0x5dcb('0x0'));var util=require(_0x5dcb('0x1'));var moment=require(_0x5dcb('0x2'));var BPromise=require('bluebird');var rs=require(_0x5dcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dcb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcb('0x5'))(_0x5dcb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5dcb('0x7'));var client=jayson[_0x5dcb('0x8')][_0x5dcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3aaa62,_0x2f9194,_0x1dc7e9){return new BPromise(function(_0x39d52e,_0x1c4588){return client[_0x5dcb('0xa')](_0x3aaa62,_0x1dc7e9)['then'](function(_0x3bf1f3){logger[_0x5dcb('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2f9194,_0x5dcb('0xc'));logger['debug'](_0x5dcb('0xd'),_0x2f9194,_0x5dcb('0xc'),JSON['stringify'](_0x3bf1f3));if(_0x3bf1f3[_0x5dcb('0xe')]){if(_0x3bf1f3[_0x5dcb('0xe')][_0x5dcb('0xf')]===0x1f4){logger[_0x5dcb('0xe')](_0x5dcb('0x10'),_0x2f9194,_0x3bf1f3[_0x5dcb('0xe')]['message']);return _0x1c4588(_0x3bf1f3[_0x5dcb('0xe')]['message']);}logger[_0x5dcb('0xe')](_0x5dcb('0x10'),_0x2f9194,_0x3bf1f3[_0x5dcb('0xe')][_0x5dcb('0x11')]);return _0x39d52e(_0x3bf1f3[_0x5dcb('0xe')][_0x5dcb('0x11')]);}else{logger[_0x5dcb('0xb')](_0x5dcb('0x10'),_0x2f9194,_0x5dcb('0xc'));_0x39d52e(_0x3bf1f3[_0x5dcb('0x12')][_0x5dcb('0x11')]);}})['catch'](function(_0x56fcd7){logger[_0x5dcb('0xe')](_0x5dcb('0x10'),_0x2f9194,_0x56fcd7);_0x1c4588(_0x56fcd7);});});} \ No newline at end of file +var _0x31ba=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31ba,0x69));var _0xa31b=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0x31ba[_0x132558];return _0x34f138;};'use strict';var _=require('lodash');var util=require(_0xa31b('0x0'));var moment=require(_0xa31b('0x1'));var BPromise=require(_0xa31b('0x2'));var rs=require(_0xa31b('0x3'));var fs=require('fs');var Redis=require(_0xa31b('0x4'));var db=require(_0xa31b('0x5'))['db'];var utils=require(_0xa31b('0x6'));var logger=require(_0xa31b('0x7'))('rpc');var config=require(_0xa31b('0x8'));var jayson=require(_0xa31b('0x9'));var client=jayson[_0xa31b('0xa')][_0xa31b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3105e3,_0x4334b2,_0x2cb403){return new BPromise(function(_0x4d15c6,_0x532818){return client[_0xa31b('0xc')](_0x3105e3,_0x2cb403)[_0xa31b('0xd')](function(_0x1e1210){logger[_0xa31b('0xe')](_0xa31b('0xf'),_0x4334b2,_0xa31b('0x10'));logger[_0xa31b('0x11')](_0xa31b('0x12'),_0x4334b2,_0xa31b('0x10'),JSON[_0xa31b('0x13')](_0x1e1210));if(_0x1e1210['error']){if(_0x1e1210[_0xa31b('0x14')][_0xa31b('0x15')]===0x1f4){logger[_0xa31b('0x14')](_0xa31b('0xf'),_0x4334b2,_0x1e1210[_0xa31b('0x14')][_0xa31b('0x16')]);return _0x532818(_0x1e1210[_0xa31b('0x14')][_0xa31b('0x16')]);}logger[_0xa31b('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x4334b2,_0x1e1210['error'][_0xa31b('0x16')]);return _0x4d15c6(_0x1e1210[_0xa31b('0x14')]['message']);}else{logger['info'](_0xa31b('0xf'),_0x4334b2,_0xa31b('0x10'));_0x4d15c6(_0x1e1210['result']['message']);}})[_0xa31b('0x17')](function(_0x5419b9){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4334b2,_0x5419b9);_0x532818(_0x5419b9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e9ffc51..d5762f0 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d2bcf,_0x15e246){var _0x59d93d=function(_0x5c5656){while(--_0x5c5656){_0x3d2bcf['push'](_0x3d2bcf['shift']());}};_0x59d93d(++_0x15e246);}(_0x70e0,0x17b));var _0x070e=function(_0x2ec17c,_0x49604d){_0x2ec17c=_0x2ec17c-0x0;var _0x579a9a=_0x70e0[_0x2ec17c];return _0x579a9a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x568fc4,_0x3d32ed){var _0x4b6254=function(_0x3aee45){while(--_0x3aee45){_0x568fc4['push'](_0x568fc4['shift']());}};_0x4b6254(++_0x3d32ed);}(_0x70e0,0x17b));var _0x070e=function(_0x1e3c6f,_0x1d6113){_0x1e3c6f=_0x1e3c6f-0x0;var _0x253464=_0x70e0[_0x1e3c6f];return _0x253464;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 300396b..04405c1 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 _0xf9cc=['exports','INTEGER'];(function(_0x449216,_0x33b40f){var _0x23443c=function(_0x42be42){while(--_0x42be42){_0x449216['push'](_0x449216['shift']());}};_0x23443c(++_0x33b40f);}(_0xf9cc,0xa0));var _0xcf9c=function(_0x46d4f6,_0x1247b2){_0x46d4f6=_0x46d4f6-0x0;var _0x1900b5=_0xf9cc[_0x46d4f6];return _0x1900b5;};'use strict';var Sequelize=require('sequelize');module[_0xcf9c('0x0')]={'penalty':{'type':Sequelize[_0xcf9c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb9ce=['sequelize','exports'];(function(_0x35960a,_0x4f7957){var _0x3c2913=function(_0x11354f){while(--_0x11354f){_0x35960a['push'](_0x35960a['shift']());}};_0x3c2913(++_0x4f7957);}(_0xb9ce,0x10c));var _0xeb9c=function(_0x4f7773,_0x47f366){_0x4f7773=_0x4f7773-0x0;var _0x50dab8=_0xb9ce[_0x4f7773];return _0x50dab8;};'use strict';var Sequelize=require(_0xeb9c('0x0'));module[_0xeb9c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 36181d0..4e1280a 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 _0xa1cc=['../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xa1cc,0x1b5));var _0xca1c=function(_0xa5c94c,_0x595b57){_0xa5c94c=_0xa5c94c-0x0;var _0x4130e6=_0xa1cc[_0xa5c94c];return _0x4130e6;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var logger=require(_0xca1c('0x2'))('api');var moment=require(_0xca1c('0x3'));var BPromise=require('bluebird');var rp=require(_0xca1c('0x4'));var fs=require('fs');var path=require(_0xca1c('0x5'));var rimraf=require(_0xca1c('0x6'));var config=require(_0xca1c('0x7'));var attributes=require(_0xca1c('0x8'));module['exports']=function(_0x35c690,_0x1a1ebd){return _0x35c690[_0xca1c('0x9')](_0xca1c('0xa'),attributes,{'tableName':_0xca1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeff=['moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','api'];(function(_0x23af31,_0x8a1add){var _0x49b82f=function(_0x5d08d5){while(--_0x5d08d5){_0x23af31['push'](_0x23af31['shift']());}};_0x49b82f(++_0x8a1add);}(_0xeeff,0xd0));var _0xfeef=function(_0x2a3872,_0x44ccd4){_0x2a3872=_0x2a3872-0x0;var _0x59ffb2=_0xeeff[_0x2a3872];return _0x59ffb2;};'use strict';var _=require(_0xfeef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfeef('0x1'));var moment=require(_0xfeef('0x2'));var BPromise=require('bluebird');var rp=require(_0xfeef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfeef('0x4'));var config=require(_0xfeef('0x5'));var attributes=require(_0xfeef('0x6'));module[_0xfeef('0x7')]=function(_0x57b406,_0x308fa3){return _0x57b406['define'](_0xfeef('0x8'),attributes,{'tableName':_0xfeef('0x9'),'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 74f0818..5cb4526 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x289457,_0x39dc5d){var _0x125568=function(_0x4dd4c4){while(--_0x4dd4c4){_0x289457['push'](_0x289457['shift']());}};_0x125568(++_0x39dc5d);}(_0x6aa7,0x178));var _0x76aa=function(_0x414da9,_0x414e99){_0x414da9=_0x414da9-0x0;var _0x3bb7db=_0x6aa7[_0x414da9];return _0x3bb7db;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d5eb3c0..8b7e0be 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x184c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x184c,0xb3));var _0xc184=function(_0x23ab46,_0x13b522){_0x23ab46=_0x23ab46-0x0;var _0x58c3c3=_0x184c[_0x23ab46];return _0x58c3c3;};'use strict';var multer=require(_0xc184('0x0'));var util=require(_0xc184('0x1'));var path=require(_0xc184('0x2'));var timeout=require(_0xc184('0x3'));var express=require(_0xc184('0x4'));var router=express[_0xc184('0x5')]();var fs_extra=require(_0xc184('0x6'));var auth=require(_0xc184('0x7'));var interaction=require(_0xc184('0x8'));var config=require(_0xc184('0x9'));var controller=require(_0xc184('0xa'));router[_0xc184('0xb')]('/',auth[_0xc184('0xc')](),controller[_0xc184('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2200=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0x2200,0x144));var _0x0220=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x2200[_0x3ccdf8];return _0x243dab;};'use strict';var multer=require('multer');var util=require(_0x0220('0x0'));var path=require(_0x0220('0x1'));var timeout=require(_0x0220('0x2'));var express=require('express');var router=express[_0x0220('0x3')]();var fs_extra=require(_0x0220('0x4'));var auth=require(_0x0220('0x5'));var interaction=require(_0x0220('0x6'));var config=require(_0x0220('0x7'));var controller=require(_0x0220('0x8'));router[_0x0220('0x9')]('/',auth[_0x0220('0xa')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0a3396b..f3f4cdc 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b9a=['BOOLEAN','TEXT','STRING'];(function(_0x10078b,_0x2dd353){var _0x186f42=function(_0x291e51){while(--_0x291e51){_0x10078b['push'](_0x10078b['shift']());}};_0x186f42(++_0x2dd353);}(_0x1b9a,0x181));var _0xa1b9=function(_0x5c0f80,_0x3cb38f){_0x5c0f80=_0x5c0f80-0x0;var _0x34c1be=_0x1b9a[_0x5c0f80];return _0x34c1be;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xa1b9('0x0')]},'senderName':{'type':Sequelize[_0xa1b9('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xa1b9('0x1')]},'beep':{'type':Sequelize[_0xa1b9('0x2')]}}; \ No newline at end of file +var _0x398c=['TEXT','STRING','sequelize','exports'];(function(_0x1a8bf0,_0x50d0dd){var _0x1d7007=function(_0x1ac3fb){while(--_0x1ac3fb){_0x1a8bf0['push'](_0x1a8bf0['shift']());}};_0x1d7007(++_0x50d0dd);}(_0x398c,0xfe));var _0xc398=function(_0x381665,_0x1bbc3a){_0x381665=_0x381665-0x0;var _0x23f81d=_0x398c[_0x381665];return _0x23f81d;};'use strict';var Sequelize=require(_0xc398('0x0'));module[_0xc398('0x1')]={'body':{'type':Sequelize[_0xc398('0x2')]},'senderName':{'type':Sequelize[_0xc398('0x3')]},'recipientsId':{'type':Sequelize[_0xc398('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc398('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 712f38e..a5b48a6 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbad5=['localhost','./userNotification.socket','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','userNotification:send','catch','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','union','ids','queue','replace','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x30e687,_0x169de4){var _0x1bd3bf=function(_0x439963){while(--_0x439963){_0x30e687['push'](_0x30e687['shift']());}};_0x1bd3bf(++_0x169de4);}(_0xbad5,0x1c6));var _0x5bad=function(_0x2c8fa0,_0x3bf6c5){_0x2c8fa0=_0x2c8fa0-0x0;var _0x428fa0=_0xbad5[_0x2c8fa0];return _0x428fa0;};'use strict';var emlformat=require(_0x5bad('0x0'));var rimraf=require(_0x5bad('0x1'));var zipdir=require(_0x5bad('0x2'));var jsonpatch=require(_0x5bad('0x3'));var rp=require('request-promise');var moment=require(_0x5bad('0x4'));var BPromise=require(_0x5bad('0x5'));var Mustache=require('mustache');var util=require(_0x5bad('0x6'));var path=require(_0x5bad('0x7'));var sox=require('sox');var csv=require(_0x5bad('0x8'));var ejs=require(_0x5bad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bad('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5bad('0xb'));var deskjs=require(_0x5bad('0xc'));var toCsv=require(_0x5bad('0x8'));var querystring=require(_0x5bad('0xd'));var Papa=require(_0x5bad('0xe'));var Redis=require(_0x5bad('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5bad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bad('0x11'));var logger=require(_0x5bad('0x12'))(_0x5bad('0x13'));var utils=require(_0x5bad('0x14'));var config=require(_0x5bad('0x15'));var licenseUtil=require(_0x5bad('0x16'));var db=require(_0x5bad('0x17'))['db'];config[_0x5bad('0x18')]=_[_0x5bad('0x19')](config[_0x5bad('0x18')],{'host':_0x5bad('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bad('0x18')]));require(_0x5bad('0x1b'))['register'](socket);function respondWithStatusCode(_0x22ae7f,_0x308873){_0x308873=_0x308873||0xcc;return function(_0x34d1e0){if(_0x34d1e0){return _0x22ae7f[_0x5bad('0x1c')](_0x308873);}return _0x22ae7f[_0x5bad('0x1d')](_0x308873)[_0x5bad('0x1e')]();};}function respondWithResult(_0x3e535d,_0x1fa87b){_0x1fa87b=_0x1fa87b||0xc8;return function(_0x2257a1){if(_0x2257a1){return _0x3e535d['status'](_0x1fa87b)[_0x5bad('0x1f')](_0x2257a1);}};}function respondWithFilteredResult(_0x44dd42,_0x83aa9c){return function(_0x1d9dcc){if(_0x1d9dcc){var _0x47fba8=typeof _0x83aa9c[_0x5bad('0x20')]==='undefined'&&typeof _0x83aa9c['limit']==='undefined';var _0x1d2ef4=_0x1d9dcc[_0x5bad('0x21')];var _0x437ded=_0x47fba8?0x0:_0x83aa9c[_0x5bad('0x20')];var _0x28e97e=_0x47fba8?_0x1d9dcc[_0x5bad('0x21')]:_0x83aa9c[_0x5bad('0x20')]+_0x83aa9c[_0x5bad('0x22')];var _0x44b27f;if(_0x28e97e>=_0x1d2ef4){_0x28e97e=_0x1d2ef4;_0x44b27f=0xc8;}else{_0x44b27f=0xce;}_0x44dd42['status'](_0x44b27f);return _0x44dd42[_0x5bad('0x23')](_0x5bad('0x24'),_0x437ded+'-'+_0x28e97e+'/'+_0x1d2ef4)['json'](_0x1d9dcc);}return null;};}function patchUpdates(_0x33e981){return function(_0x5c8939){try{jsonpatch['apply'](_0x5c8939,_0x33e981,!![]);}catch(_0x1110bd){return BPromise[_0x5bad('0x25')](_0x1110bd);}return _0x5c8939['save']();};}function saveUpdates(_0x207505,_0x539b82){return function(_0x494e23){if(_0x494e23){return _0x494e23[_0x5bad('0x26')](_0x207505)[_0x5bad('0x27')](function(_0x5b013b){return _0x5b013b;});}return null;};}function removeEntity(_0x4aca79,_0x498f86){return function(_0x330780){if(_0x330780){return _0x330780['destroy']()[_0x5bad('0x27')](function(){_0x4aca79[_0x5bad('0x1d')](0xcc)[_0x5bad('0x1e')]();});}};}function handleEntityNotFound(_0x34b7c7,_0x3422d7){return function(_0xac72f8){if(!_0xac72f8){_0x34b7c7[_0x5bad('0x1c')](0x194);}return _0xac72f8;};}function handleError(_0x3acf1c,_0x2b0dbe){_0x2b0dbe=_0x2b0dbe||0x1f4;return function(_0x54867d){logger[_0x5bad('0x28')](_0x54867d['stack']);if(_0x54867d[_0x5bad('0x29')]){delete _0x54867d[_0x5bad('0x29')];}_0x3acf1c['status'](_0x2b0dbe)[_0x5bad('0x2a')](_0x54867d);};}exports[_0x5bad('0x2b')]=function(_0x23f910,_0xd83293,_0x377845){if(!_0x23f910[_0x5bad('0x2c')]['hasOwnProperty']('text')&&!_0x23f910[_0x5bad('0x2c')][_0x5bad('0x2d')](_0x5bad('0x2e'))){throw new db['Sequelize'][(_0x5bad('0x2f'))](_0x5bad('0x30'));}else{if(_0x23f910[_0x5bad('0x2c')]['hasOwnProperty']('TemplateId')&&!_0x23f910[_0x5bad('0x2c')][_0x5bad('0x2d')](_0x5bad('0x31'))){throw new db[(_0x5bad('0x32'))][(_0x5bad('0x2f'))](_0x5bad('0x33'));}if(!_0x23f910[_0x5bad('0x2c')][_0x5bad('0x2d')](_0x5bad('0x34'))){throw new db[(_0x5bad('0x32'))][(_0x5bad('0x2f'))](_0x5bad('0x35'));}else{try{var _0x2e08bf=JSON[_0x5bad('0x36')](_0x23f910[_0x5bad('0x2c')][_0x5bad('0x34')]);}catch(_0x5f1110){logger[_0x5bad('0x28')](_0x5f1110);throw new db[(_0x5bad('0x32'))]['ValidationError'](_0x5bad('0x37'));}var _0x4bfbe3=['chatqueue',_0x5bad('0x38'),_0x5bad('0x39'),_0x5bad('0x3a'),_0x5bad('0x3b'),_0x5bad('0x3c'),'whatsappqueue',_0x5bad('0x3d'),_0x5bad('0x3e')];if(_[_0x5bad('0x3f')](_0x2e08bf,function(_0x10f854){return!_[_0x5bad('0x40')](_0x4bfbe3,_0x10f854[_0x5bad('0x41')][_0x5bad('0x42')]());})){throw new db['Sequelize'][(_0x5bad('0x2f'))](_0x5bad('0x43'));}}}var _0x2eb64c={};_0x2eb64c[_0x5bad('0x44')]=_0x23f910[_0x5bad('0x2c')]['hasOwnProperty'](_0x5bad('0x44'))?_0x23f910[_0x5bad('0x2c')][_0x5bad('0x44')]:_0x23f910[_0x5bad('0x3e')]['fullname'];_0x2eb64c[_0x5bad('0x45')]=_[_0x5bad('0x46')](_0x23f910[_0x5bad('0x2c')][_0x5bad('0x45')])?null:_0x23f910[_0x5bad('0x2c')][_0x5bad('0x45')];_0x2eb64c['beep']=_0x23f910[_0x5bad('0x2c')][_0x5bad('0x47')]||![];_0x2eb64c[_0x5bad('0x48')]=_0x23f910['user']['id'];return getContent(_0x23f910[_0x5bad('0x2c')])[_0x5bad('0x27')](function(_0x4fb8ef){_0x2eb64c['body']=_0x4fb8ef;return getRecipients(_0x2e08bf);})[_0x5bad('0x27')](function(_0x4ba73f){_0x2eb64c['recipientsId']=_[_0x5bad('0x49')](_0x4ba73f)[_0x5bad('0x4a')](',');return db[_0x5bad('0x4b')][_0x5bad('0x4c')](function(_0xb314d9){return db[_0x5bad('0x4d')][_0x5bad('0x4e')](_0x2eb64c,{'raw':!![],'transaction':_0xb314d9})[_0x5bad('0x27')](function(_0x4d22ab){var _0x327850={'sender':_0x2eb64c[_0x5bad('0x44')],'description':_0x2eb64c['recipientsDescription'],'content':_0x2eb64c[_0x5bad('0x2c')],'beep':_0x2eb64c[_0x5bad('0x47')]};_0x4ba73f['forEach'](function(_0x7feee9){_0x327850[_0x5bad('0x4f')]=_0x7feee9;socket['emit'](_0x5bad('0x50'),_0x327850);});return _0x4d22ab;});});})[_0x5bad('0x27')](respondWithResult(_0xd83293,0xc9))[_0x5bad('0x51')](handleError(_0xd83293,null));};function getContent(_0x140d35){return new BPromise(function(_0x110a76,_0x995821){if(_0x140d35['text']){_0x110a76(_0x140d35[_0x5bad('0x52')]);return;}return db['Template'][_0x5bad('0x53')]({'attributes':[_0x5bad('0x54')],'where':{'id':_0x140d35[_0x5bad('0x2e')]},'raw':!![]})['then'](function(_0x4c599a){if(!_0x4c599a)throw new db[(_0x5bad('0x32'))][(_0x5bad('0x2f'))](_0x5bad('0x55'));var _0xa37c9e=Mustache[_0x5bad('0x56')](_0x4c599a[_0x5bad('0x54')],_0x140d35[_0x5bad('0x31')]);_0x110a76(_0xa37c9e);})[_0x5bad('0x51')](function(_0x1701ee){_0x995821(_0x1701ee);});});}function getRecipients(_0x3294cb){return new BPromise(function(_0xd397,_0x3622cb){var _0x360353=[];var _0x444058=[];_0x3294cb[_0x5bad('0x57')](function(_0x30f0ea){var _0x5a49ff=_[_0x5bad('0x58')](_0x30f0ea[_0x5bad('0x41')]['toLowerCase']());if(_0x5a49ff==='User'){_0x360353=_[_0x5bad('0x59')](_0x360353,_0x30f0ea[_0x5bad('0x5a')]);}else{if(_['includes'](_0x5a49ff,_0x5bad('0x5b')))_0x5a49ff=_0x5a49ff[_0x5bad('0x5c')](_0x5bad('0x5b'),'Queue');_0x30f0ea[_0x5bad('0x5a')][_0x5bad('0x57')](function(_0x519fab){_0x444058['push'](getAgents(_0x5a49ff,_0x519fab));});}});return BPromise[_0x5bad('0x5d')](_0x444058)[_0x5bad('0x27')](function(_0x4f5267){_0x360353=_[_0x5bad('0x59')](_0x360353,_['flatten'](_0x4f5267));_0xd397(_0x360353);})[_0x5bad('0x51')](function(_0x3cd402){_0x3622cb(_0x3cd402);});});}function getAgents(_0x428a84,_0x5f0ad5){return new BPromise(function(_0xbed40,_0x29e5c7){return db[_0x428a84][_0x5bad('0x53')]({'where':{'id':_0x5f0ad5}})[_0x5bad('0x27')](function(_0x1e0725){return _0x1e0725[_0x5bad('0x5e')]({'attributes':['id'],'raw':!![]})[_0x5bad('0x27')](function(_0x1d0305){var _0x25340c=_[_0x5bad('0x5f')](_0x1d0305,'id');_0xbed40(_0x25340c);});})[_0x5bad('0x51')](function(_0x32e86a){_0x29e5c7(_0x32e86a);});});} \ No newline at end of file +var _0x0edb=['User','ids','queue','replace','Queue','push','union','flatten','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./userNotification.socket','sendStatus','status','end','offset','undefined','limit','count','json','apply','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','recipientsId','sortBy','join','UserNotification','create','forEach','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x12347c,_0x574f79){var _0x2a656e=function(_0x255d50){while(--_0x255d50){_0x12347c['push'](_0x12347c['shift']());}};_0x2a656e(++_0x574f79);}(_0x0edb,0x67));var _0xb0ed=function(_0x136e6e,_0xd871e4){_0x136e6e=_0x136e6e-0x0;var _0x43086e=_0x0edb[_0x136e6e];return _0x43086e;};'use strict';var emlformat=require(_0xb0ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0ed('0x1'));var rp=require('request-promise');var moment=require(_0xb0ed('0x2'));var BPromise=require(_0xb0ed('0x3'));var Mustache=require(_0xb0ed('0x4'));var util=require(_0xb0ed('0x5'));var path=require(_0xb0ed('0x6'));var sox=require(_0xb0ed('0x7'));var csv=require('to-csv');var ejs=require(_0xb0ed('0x8'));var fs=require('fs');var fs_extra=require(_0xb0ed('0x9'));var _=require(_0xb0ed('0xa'));var squel=require(_0xb0ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xb0ed('0xc'));var deskjs=require(_0xb0ed('0xd'));var toCsv=require(_0xb0ed('0xe'));var querystring=require(_0xb0ed('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0ed('0x10'));var authService=require(_0xb0ed('0x11'));var qs=require(_0xb0ed('0x12'));var as=require(_0xb0ed('0x13'));var hardwareService=require(_0xb0ed('0x14'));var logger=require(_0xb0ed('0x15'))(_0xb0ed('0x16'));var utils=require(_0xb0ed('0x17'));var config=require(_0xb0ed('0x18'));var licenseUtil=require(_0xb0ed('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb0ed('0x1a')](config[_0xb0ed('0x1b')],{'host':_0xb0ed('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0ed('0x1d'))['register'](socket);function respondWithStatusCode(_0x3e4f12,_0x2d2a06){_0x2d2a06=_0x2d2a06||0xcc;return function(_0x2e303a){if(_0x2e303a){return _0x3e4f12[_0xb0ed('0x1e')](_0x2d2a06);}return _0x3e4f12[_0xb0ed('0x1f')](_0x2d2a06)[_0xb0ed('0x20')]();};}function respondWithResult(_0x4a7cc5,_0x58321a){_0x58321a=_0x58321a||0xc8;return function(_0x175296){if(_0x175296){return _0x4a7cc5[_0xb0ed('0x1f')](_0x58321a)['json'](_0x175296);}};}function respondWithFilteredResult(_0x37dbf2,_0x3aa7a1){return function(_0x1c65bc){if(_0x1c65bc){var _0x338079=typeof _0x3aa7a1[_0xb0ed('0x21')]===_0xb0ed('0x22')&&typeof _0x3aa7a1[_0xb0ed('0x23')]===_0xb0ed('0x22');var _0x568b32=_0x1c65bc[_0xb0ed('0x24')];var _0x43e969=_0x338079?0x0:_0x3aa7a1[_0xb0ed('0x21')];var _0x1292c0=_0x338079?_0x1c65bc['count']:_0x3aa7a1[_0xb0ed('0x21')]+_0x3aa7a1['limit'];var _0x46ab71;if(_0x1292c0>=_0x568b32){_0x1292c0=_0x568b32;_0x46ab71=0xc8;}else{_0x46ab71=0xce;}_0x37dbf2[_0xb0ed('0x1f')](_0x46ab71);return _0x37dbf2['set']('Content-Range',_0x43e969+'-'+_0x1292c0+'/'+_0x568b32)[_0xb0ed('0x25')](_0x1c65bc);}return null;};}function patchUpdates(_0x132ed2){return function(_0x126ac1){try{jsonpatch[_0xb0ed('0x26')](_0x126ac1,_0x132ed2,!![]);}catch(_0x323f5e){return BPromise['reject'](_0x323f5e);}return _0x126ac1['save']();};}function saveUpdates(_0xc19fca,_0x7f7363){return function(_0x1d9996){if(_0x1d9996){return _0x1d9996[_0xb0ed('0x27')](_0xc19fca)[_0xb0ed('0x28')](function(_0x5e00b0){return _0x5e00b0;});}return null;};}function removeEntity(_0x430bd8,_0x790721){return function(_0x3eb9dd){if(_0x3eb9dd){return _0x3eb9dd[_0xb0ed('0x29')]()['then'](function(){_0x430bd8[_0xb0ed('0x1f')](0xcc)[_0xb0ed('0x20')]();});}};}function handleEntityNotFound(_0x4905b4,_0x37fef6){return function(_0x30490a){if(!_0x30490a){_0x4905b4[_0xb0ed('0x1e')](0x194);}return _0x30490a;};}function handleError(_0x2f8602,_0x5e8022){_0x5e8022=_0x5e8022||0x1f4;return function(_0x420cd9){logger[_0xb0ed('0x2a')](_0x420cd9[_0xb0ed('0x2b')]);if(_0x420cd9['name']){delete _0x420cd9[_0xb0ed('0x2c')];}_0x2f8602[_0xb0ed('0x1f')](_0x5e8022)[_0xb0ed('0x2d')](_0x420cd9);};}exports[_0xb0ed('0x2e')]=function(_0x34ab0b,_0x99bc1b,_0xa57a96){if(!_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x31'))&&!_0x34ab0b[_0xb0ed('0x2f')]['hasOwnProperty'](_0xb0ed('0x32'))){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x35'));}else{if(_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x32'))&&!_0x34ab0b['body'][_0xb0ed('0x30')](_0xb0ed('0x36'))){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x37'));}if(!_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x38'))){throw new db[(_0xb0ed('0x33'))]['ValidationError'](_0xb0ed('0x39'));}else{try{var _0x5a825b=JSON['parse'](_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x38')]);}catch(_0x50b00d){logger['error'](_0x50b00d);throw new db[(_0xb0ed('0x33'))]['ValidationError'](_0xb0ed('0x3a'));}var _0xf83e11=['chatqueue',_0xb0ed('0x3b'),_0xb0ed('0x3c'),_0xb0ed('0x3d'),_0xb0ed('0x3e'),_0xb0ed('0x3f'),_0xb0ed('0x40'),_0xb0ed('0x41'),_0xb0ed('0x42')];if(_[_0xb0ed('0x43')](_0x5a825b,function(_0x36097b){return!_[_0xb0ed('0x44')](_0xf83e11,_0x36097b['model'][_0xb0ed('0x45')]());})){throw new db[(_0xb0ed('0x33'))][(_0xb0ed('0x34'))](_0xb0ed('0x46'));}}}var _0x118fd9={};_0x118fd9[_0xb0ed('0x47')]=_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x30')](_0xb0ed('0x47'))?_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x47')]:_0x34ab0b[_0xb0ed('0x42')][_0xb0ed('0x48')];_0x118fd9[_0xb0ed('0x49')]=_['isEmpty'](_0x34ab0b['body'][_0xb0ed('0x49')])?null:_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x49')];_0x118fd9[_0xb0ed('0x4a')]=_0x34ab0b[_0xb0ed('0x2f')][_0xb0ed('0x4a')]||![];_0x118fd9['SenderId']=_0x34ab0b[_0xb0ed('0x42')]['id'];return getContent(_0x34ab0b[_0xb0ed('0x2f')])['then'](function(_0xc8c723){_0x118fd9['body']=_0xc8c723;return getRecipients(_0x5a825b);})['then'](function(_0x1fe50e){_0x118fd9[_0xb0ed('0x4b')]=_[_0xb0ed('0x4c')](_0x1fe50e)[_0xb0ed('0x4d')](',');return db['sequelize']['transaction'](function(_0x4526aa){return db[_0xb0ed('0x4e')][_0xb0ed('0x4f')](_0x118fd9,{'raw':!![],'transaction':_0x4526aa})[_0xb0ed('0x28')](function(_0x50cd00){var _0x1c9d2b={'sender':_0x118fd9['senderName'],'description':_0x118fd9[_0xb0ed('0x49')],'content':_0x118fd9['body'],'beep':_0x118fd9[_0xb0ed('0x4a')]};_0x1fe50e[_0xb0ed('0x50')](function(_0x321222){_0x1c9d2b[_0xb0ed('0x51')]=_0x321222;socket[_0xb0ed('0x52')]('userNotification:send',_0x1c9d2b);});return _0x50cd00;});});})['then'](respondWithResult(_0x99bc1b,0xc9))[_0xb0ed('0x53')](handleError(_0x99bc1b,null));};function getContent(_0x508f2e){return new BPromise(function(_0x4ec15b,_0x2315e4){if(_0x508f2e['text']){_0x4ec15b(_0x508f2e[_0xb0ed('0x31')]);return;}return db['Template'][_0xb0ed('0x54')]({'attributes':['html'],'where':{'id':_0x508f2e[_0xb0ed('0x32')]},'raw':!![]})[_0xb0ed('0x28')](function(_0x51f21e){if(!_0x51f21e)throw new db['Sequelize'][(_0xb0ed('0x34'))](_0xb0ed('0x55'));var _0x5e0460=Mustache[_0xb0ed('0x56')](_0x51f21e['html'],_0x508f2e[_0xb0ed('0x36')]);_0x4ec15b(_0x5e0460);})['catch'](function(_0x2795df){_0x2315e4(_0x2795df);});});}function getRecipients(_0x34dbd9){return new BPromise(function(_0x506ea8,_0x5d15a4){var _0x32c4bc=[];var _0x222ed4=[];_0x34dbd9[_0xb0ed('0x50')](function(_0x2c3c38){var _0x5b1345=_['startCase'](_0x2c3c38['model']['toLowerCase']());if(_0x5b1345===_0xb0ed('0x57')){_0x32c4bc=_['union'](_0x32c4bc,_0x2c3c38[_0xb0ed('0x58')]);}else{if(_[_0xb0ed('0x44')](_0x5b1345,_0xb0ed('0x59')))_0x5b1345=_0x5b1345[_0xb0ed('0x5a')]('queue',_0xb0ed('0x5b'));_0x2c3c38[_0xb0ed('0x58')]['forEach'](function(_0x332526){_0x222ed4[_0xb0ed('0x5c')](getAgents(_0x5b1345,_0x332526));});}});return BPromise['all'](_0x222ed4)[_0xb0ed('0x28')](function(_0x242148){_0x32c4bc=_[_0xb0ed('0x5d')](_0x32c4bc,_[_0xb0ed('0x5e')](_0x242148));_0x506ea8(_0x32c4bc);})[_0xb0ed('0x53')](function(_0x40b411){_0x5d15a4(_0x40b411);});});}function getAgents(_0x1623f1,_0x50ea36){return new BPromise(function(_0x2cfcca,_0x37b77e){return db[_0x1623f1][_0xb0ed('0x54')]({'where':{'id':_0x50ea36}})[_0xb0ed('0x28')](function(_0x57c0a4){return _0x57c0a4['getAgents']({'attributes':['id'],'raw':!![]})[_0xb0ed('0x28')](function(_0x1fff0){var _0xfb39f=_['map'](_0x1fff0,'id');_0x2cfcca(_0xfb39f);});})[_0xb0ed('0x53')](function(_0x3be817){_0x37b77e(_0x3be817);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e3a0e7e..a1f1fd7 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb92e=['exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb92e,0x6a));var _0xeb92=function(_0x57913b,_0x41bb78){_0x57913b=_0x57913b-0x0;var _0x5ce491=_0xb92e[_0x57913b];return _0x5ce491;};'use strict';var EventEmitter=require(_0xeb92('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xeb92('0x1')](0x0);var events={'afterCreate':_0xeb92('0x2'),'afterUpdate':_0xeb92('0x3'),'afterDestroy':_0xeb92('0x4')};function emitEvent(_0x393a55){return function(_0x57951b,_0x4ae660,_0x3aa14f){UserNotificationEvents[_0xeb92('0x5')](_0x393a55+':'+_0x57951b['id'],_0x57951b);UserNotificationEvents[_0xeb92('0x5')](_0x393a55,_0x57951b);_0x3aa14f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xeb92('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x4f5f=['../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x381aba,_0x308216){var _0x3f0abd=function(_0xb20b85){while(--_0xb20b85){_0x381aba['push'](_0x381aba['shift']());}};_0x3f0abd(++_0x308216);}(_0x4f5f,0x135));var _0xf4f5=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x4f5f[_0x33080e];return _0x407395;};'use strict';var EventEmitter=require(_0xf4f5('0x0'));var UserNotification=require(_0xf4f5('0x1'))['db'][_0xf4f5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf4f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4f5('0x4'),'afterDestroy':_0xf4f5('0x5')};function emitEvent(_0x2e90f8){return function(_0x2101b5,_0x27a22b,_0x41402f){UserNotificationEvents[_0xf4f5('0x6')](_0x2e90f8+':'+_0x2101b5['id'],_0x2101b5);UserNotificationEvents['emit'](_0x2e90f8,_0x2101b5);_0x41402f(null);};}for(var e in events){if(events[_0xf4f5('0x7')](e)){var event=events[e];UserNotification[_0xf4f5('0x8')](e,emitEvent(event));}}module[_0xf4f5('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index aee2a8b..b0e6829 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9425=['userNotifications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','define','UserNotification'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0x9425,0x91));var _0x5942=function(_0x3c45d3,_0x513ca4){_0x3c45d3=_0x3c45d3-0x0;var _0x2a3b29=_0x9425[_0x3c45d3];return _0x2a3b29;};'use strict';var _=require('lodash');var util=require(_0x5942('0x0'));var logger=require(_0x5942('0x1'))(_0x5942('0x2'));var moment=require(_0x5942('0x3'));var BPromise=require(_0x5942('0x4'));var rp=require(_0x5942('0x5'));var fs=require('fs');var path=require(_0x5942('0x6'));var rimraf=require('rimraf');var config=require(_0x5942('0x7'));var attributes=require(_0x5942('0x8'));module['exports']=function(_0xaaade8,_0x47d0ae){return _0xaaade8[_0x5942('0x9')](_0x5942('0xa'),attributes,{'tableName':_0x5942('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5942('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7096=['path','rimraf','../../config/environment','exports','define','UserNotification','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0x7096,0x1f3));var _0x6709=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7096[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var logger=require(_0x6709('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6709('0x3'));var rp=require(_0x6709('0x4'));var fs=require('fs');var path=require(_0x6709('0x5'));var rimraf=require(_0x6709('0x6'));var config=require(_0x6709('0x7'));var attributes=require('./userNotification.attributes');module[_0x6709('0x8')]=function(_0x3cb3ab,_0x27fbf9){return _0x3cb3ab[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6709('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3827490..26c3742 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8340=['stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x41f7d8,_0xdd5632){var _0x324b31=function(_0x5e6c85){while(--_0x5e6c85){_0x41f7d8['push'](_0x41f7d8['shift']());}};_0x324b31(++_0xdd5632);}(_0x8340,0xbb));var _0x0834=function(_0x35a0cd,_0x1bc776){_0x35a0cd=_0x35a0cd-0x0;var _0x227c99=_0x8340[_0x35a0cd];return _0x227c99;};'use strict';var _=require(_0x0834('0x0'));var util=require('util');var moment=require(_0x0834('0x1'));var BPromise=require(_0x0834('0x2'));var rs=require(_0x0834('0x3'));var fs=require('fs');var Redis=require(_0x0834('0x4'));var db=require(_0x0834('0x5'))['db'];var utils=require(_0x0834('0x6'));var logger=require(_0x0834('0x7'))(_0x0834('0x8'));var config=require(_0x0834('0x9'));var jayson=require(_0x0834('0xa'));var client=jayson[_0x0834('0xb')][_0x0834('0xc')]({'port':0x232a});config[_0x0834('0xd')]=_['defaults'](config[_0x0834('0xd')],{'host':_0x0834('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0834('0xd')]));require(_0x0834('0xf'))[_0x0834('0x10')](socket);function respondWithRpcPromise(_0x341129,_0x299100,_0x2022fa){return new BPromise(function(_0x33de6f,_0x20046d){return client[_0x0834('0x11')](_0x341129,_0x2022fa)[_0x0834('0x12')](function(_0x18d1d8){logger[_0x0834('0x13')]('UserNotification,\x20%s,\x20%s',_0x299100,_0x0834('0x14'));logger[_0x0834('0x15')](_0x0834('0x16'),_0x299100,_0x0834('0x14'),JSON[_0x0834('0x17')](_0x18d1d8));if(_0x18d1d8[_0x0834('0x18')]){if(_0x18d1d8[_0x0834('0x18')][_0x0834('0x19')]===0x1f4){logger[_0x0834('0x18')](_0x0834('0x1a'),_0x299100,_0x18d1d8[_0x0834('0x18')]['message']);return _0x20046d(_0x18d1d8[_0x0834('0x18')][_0x0834('0x1b')]);}logger[_0x0834('0x18')]('UserNotification,\x20%s,\x20%s',_0x299100,_0x18d1d8[_0x0834('0x18')][_0x0834('0x1b')]);return _0x33de6f(_0x18d1d8[_0x0834('0x18')][_0x0834('0x1b')]);}else{logger[_0x0834('0x13')]('UserNotification,\x20%s,\x20%s',_0x299100,_0x0834('0x14'));_0x33de6f(_0x18d1d8[_0x0834('0x1c')]['message']);}})[_0x0834('0x1d')](function(_0x513749){logger[_0x0834('0x18')]('UserNotification,\x20%s,\x20%s',_0x299100,_0x513749);_0x20046d(_0x513749);});});} \ No newline at end of file +var _0x216f=['../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1a7de8,_0x19088c){var _0x1d6cbf=function(_0x3319d4){while(--_0x3319d4){_0x1a7de8['push'](_0x1a7de8['shift']());}};_0x1d6cbf(++_0x19088c);}(_0x216f,0xd9));var _0xf216=function(_0x929887,_0x5480e3){_0x929887=_0x929887-0x0;var _0x557305=_0x216f[_0x929887];return _0x557305;};'use strict';var _=require(_0xf216('0x0'));var util=require(_0xf216('0x1'));var moment=require(_0xf216('0x2'));var BPromise=require(_0xf216('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf216('0x4'));var db=require(_0xf216('0x5'))['db'];var utils=require(_0xf216('0x6'));var logger=require(_0xf216('0x7'))('rpc');var config=require(_0xf216('0x8'));var jayson=require(_0xf216('0x9'));var client=jayson[_0xf216('0xa')]['http']({'port':0x232a});config[_0xf216('0xb')]=_[_0xf216('0xc')](config[_0xf216('0xb')],{'host':_0xf216('0xd'),'port':0x18eb});var socket=require(_0xf216('0xe'))(new Redis(config[_0xf216('0xb')]));require(_0xf216('0xf'))[_0xf216('0x10')](socket);function respondWithRpcPromise(_0x437701,_0x827461,_0x5df0fb){return new BPromise(function(_0xe30585,_0x318f58){return client[_0xf216('0x11')](_0x437701,_0x5df0fb)['then'](function(_0x2189f4){logger[_0xf216('0x12')](_0xf216('0x13'),_0x827461,'request\x20sent');logger[_0xf216('0x14')](_0xf216('0x15'),_0x827461,_0xf216('0x16'),JSON[_0xf216('0x17')](_0x2189f4));if(_0x2189f4['error']){if(_0x2189f4[_0xf216('0x18')][_0xf216('0x19')]===0x1f4){logger[_0xf216('0x18')](_0xf216('0x13'),_0x827461,_0x2189f4[_0xf216('0x18')]['message']);return _0x318f58(_0x2189f4[_0xf216('0x18')][_0xf216('0x1a')]);}logger['error'](_0xf216('0x13'),_0x827461,_0x2189f4[_0xf216('0x18')]['message']);return _0xe30585(_0x2189f4['error'][_0xf216('0x1a')]);}else{logger[_0xf216('0x12')]('UserNotification,\x20%s,\x20%s',_0x827461,'request\x20sent');_0xe30585(_0x2189f4[_0xf216('0x1b')]['message']);}})['catch'](function(_0xd9f79d){logger[_0xf216('0x18')](_0xf216('0x13'),_0x827461,_0xd9f79d);_0x318f58(_0xd9f79d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 068991a..5a72237 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0055=['save','remove','removeListener','register','userNotification:','./userNotification.events'];(function(_0x327300,_0x48ac95){var _0x7041ec=function(_0x489fa6){while(--_0x489fa6){_0x327300['push'](_0x327300['shift']());}};_0x7041ec(++_0x48ac95);}(_0x0055,0x12b));var _0x5005=function(_0x571068,_0x5c048e){_0x571068=_0x571068-0x0;var _0x2f6cd7=_0x0055[_0x571068];return _0x2f6cd7;};'use strict';var UserNotificationEvents=require(_0x5005('0x0'));var events=[_0x5005('0x1'),_0x5005('0x2'),'update'];function createListener(_0x3ae5eb,_0x50dac9){return function(_0x3ec11f){_0x50dac9['emit'](_0x3ae5eb,_0x3ec11f);};}function removeListener(_0x3790e0,_0x203ef9){return function(){UserNotificationEvents[_0x5005('0x3')](_0x3790e0,_0x203ef9);};}exports[_0x5005('0x4')]=function(_0x253a12){for(var _0x1a1673=0x0,_0x371733=events['length'];_0x1a1673<_0x371733;_0x1a1673++){var _0x47ee3e=events[_0x1a1673];var _0x1def05=createListener(_0x5005('0x5')+_0x47ee3e,_0x253a12);UserNotificationEvents['on'](_0x47ee3e,_0x1def05);}}; \ No newline at end of file +var _0xbd88=['./userNotification.events','remove','update','emit','removeListener','register','userNotification:'];(function(_0x486b88,_0x10faca){var _0x20dee9=function(_0x5130a3){while(--_0x5130a3){_0x486b88['push'](_0x486b88['shift']());}};_0x20dee9(++_0x10faca);}(_0xbd88,0xfc));var _0x8bd8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xbd88[_0x36eaaa];return _0x461349;};'use strict';var UserNotificationEvents=require(_0x8bd8('0x0'));var events=['save',_0x8bd8('0x1'),_0x8bd8('0x2')];function createListener(_0x11ec7b,_0x45d1ad){return function(_0x516764){_0x45d1ad[_0x8bd8('0x3')](_0x11ec7b,_0x516764);};}function removeListener(_0x4e143e,_0x581365){return function(){UserNotificationEvents[_0x8bd8('0x4')](_0x4e143e,_0x581365);};}exports[_0x8bd8('0x5')]=function(_0x1c4520){for(var _0x2334f9=0x0,_0x340739=events['length'];_0x2334f9<_0x340739;_0x2334f9++){var _0x4400e8=events[_0x2334f9];var _0x2c6f33=createListener(_0x8bd8('0x6')+_0x4400e8,_0x1c4520);UserNotificationEvents['on'](_0x4400e8,_0x2c6f33);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f0247b0..31256da 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2d83a2,_0xb2c06a){var _0x2fc6c0=function(_0x1ce0cf){while(--_0x1ce0cf){_0x2d83a2['push'](_0x2d83a2['shift']());}};_0x2fc6c0(++_0xb2c06a);}(_0xe706,0xa3));var _0x6e70=function(_0x305a6e,_0x1f4a40){_0x305a6e=_0x305a6e-0x0;var _0xd23128=_0xe706[_0x305a6e];return _0xd23128;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3e9115,_0x316b4c){var _0xa0007c=function(_0x545059){while(--_0x545059){_0x3e9115['push'](_0x3e9115['shift']());}};_0xa0007c(++_0x316b4c);}(_0xe706,0xa3));var _0x6e70=function(_0x4c49c0,_0x4adb76){_0x4c49c0=_0x4c49c0-0x0;var _0x596b70=_0xe706[_0x4c49c0];return _0x596b70;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index b6f99f6..3e5adf9 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 _0x48f0=['INTEGER','sequelize','exports'];(function(_0x1edb57,_0x217b2d){var _0x311eec=function(_0x536c5c){while(--_0x536c5c){_0x1edb57['push'](_0x1edb57['shift']());}};_0x311eec(++_0x217b2d);}(_0x48f0,0x1ab));var _0x048f=function(_0x1a7a7e,_0x4eb3c1){_0x1a7a7e=_0x1a7a7e-0x0;var _0x3bb469=_0x48f0[_0x1a7a7e];return _0x3bb469;};'use strict';var Sequelize=require(_0x048f('0x0'));module[_0x048f('0x1')]={'penalty':{'type':Sequelize[_0x048f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc3ee=['INTEGER','exports'];(function(_0x57cd77,_0x100760){var _0x437a56=function(_0x30251d){while(--_0x30251d){_0x57cd77['push'](_0x57cd77['shift']());}};_0x437a56(++_0x100760);}(_0xc3ee,0x1df));var _0xec3e=function(_0xa3ad33,_0x2e4d84){_0xa3ad33=_0xa3ad33-0x0;var _0xb57604=_0xc3ee[_0xa3ad33];return _0xb57604;};'use strict';var Sequelize=require('sequelize');module[_0xec3e('0x0')]={'penalty':{'type':Sequelize[_0xec3e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 570a50b..bea242d 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 _0x3267=['../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3267,0x18a));var _0x7326=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x3267[_0x1d39f6];return _0x3dbd7a;};'use strict';var _=require(_0x7326('0x0'));var util=require(_0x7326('0x1'));var logger=require(_0x7326('0x2'))(_0x7326('0x3'));var moment=require(_0x7326('0x4'));var BPromise=require(_0x7326('0x5'));var rp=require(_0x7326('0x6'));var fs=require('fs');var path=require(_0x7326('0x7'));var rimraf=require(_0x7326('0x8'));var config=require(_0x7326('0x9'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x49f577,_0x2a47d0){return _0x49f577[_0x7326('0xa')](_0x7326('0xb'),attributes,{'tableName':_0x7326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf09b=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x414bfc,_0x38a127){var _0xc6b723=function(_0x12d409){while(--_0x12d409){_0x414bfc['push'](_0x414bfc['shift']());}};_0xc6b723(++_0x38a127);}(_0xf09b,0x13f));var _0xbf09=function(_0x53872d,_0x360520){_0x53872d=_0x53872d-0x0;var _0x2867c6=_0xf09b[_0x53872d];return _0x2867c6;};'use strict';var _=require('lodash');var util=require(_0xbf09('0x0'));var logger=require('../../config/logger')(_0xbf09('0x1'));var moment=require(_0xbf09('0x2'));var BPromise=require(_0xbf09('0x3'));var rp=require(_0xbf09('0x4'));var fs=require('fs');var path=require(_0xbf09('0x5'));var rimraf=require(_0xbf09('0x6'));var config=require(_0xbf09('0x7'));var attributes=require(_0xbf09('0x8'));module['exports']=function(_0x298530,_0x1acaf9){return _0x298530['define'](_0xbf09('0x9'),attributes,{'tableName':_0xbf09('0xa'),'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 de3e86a..0c7abc9 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 _0x7b22=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x7b22,0x177));var _0x27b2=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x7b22[_0xe501ff];return _0x17135d;};'use strict';var _=require(_0x27b2('0x0'));var util=require(_0x27b2('0x1'));var moment=require('moment');var BPromise=require(_0x27b2('0x2'));var rs=require(_0x27b2('0x3'));var fs=require('fs');var Redis=require(_0x27b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27b2('0x5'));var logger=require('../../config/logger')(_0x27b2('0x6'));var config=require(_0x27b2('0x7'));var jayson=require(_0x27b2('0x8'));var client=jayson[_0x27b2('0x9')][_0x27b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x495ff9,_0x1de7ee,_0x139447){return new BPromise(function(_0x277aad,_0x21ea06){return client['request'](_0x495ff9,_0x139447)[_0x27b2('0xb')](function(_0x1cb268){logger[_0x27b2('0xc')](_0x27b2('0xd'),_0x1de7ee,_0x27b2('0xe'));logger['debug'](_0x27b2('0xf'),_0x1de7ee,_0x27b2('0xe'),JSON[_0x27b2('0x10')](_0x1cb268));if(_0x1cb268['error']){if(_0x1cb268['error'][_0x27b2('0x11')]===0x1f4){logger[_0x27b2('0x12')](_0x27b2('0xd'),_0x1de7ee,_0x1cb268[_0x27b2('0x12')]['message']);return _0x21ea06(_0x1cb268['error'][_0x27b2('0x13')]);}logger[_0x27b2('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1de7ee,_0x1cb268[_0x27b2('0x12')][_0x27b2('0x13')]);return _0x277aad(_0x1cb268[_0x27b2('0x12')][_0x27b2('0x13')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1de7ee,_0x27b2('0xe'));_0x277aad(_0x1cb268[_0x27b2('0x14')][_0x27b2('0x13')]);}})[_0x27b2('0x15')](function(_0x22d218){logger[_0x27b2('0x12')](_0x27b2('0xd'),_0x1de7ee,_0x22d218);_0x21ea06(_0x22d218);});});} \ No newline at end of file +var _0xd33f=['code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0xd33f,0xd4));var _0xfd33=function(_0x598b9d,_0x2f6c55){_0x598b9d=_0x598b9d-0x0;var _0x43055b=_0xd33f[_0x598b9d];return _0x43055b;};'use strict';var _=require('lodash');var util=require(_0xfd33('0x0'));var moment=require(_0xfd33('0x1'));var BPromise=require(_0xfd33('0x2'));var rs=require(_0xfd33('0x3'));var fs=require('fs');var Redis=require(_0xfd33('0x4'));var db=require(_0xfd33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd33('0x6'))(_0xfd33('0x7'));var config=require(_0xfd33('0x8'));var jayson=require(_0xfd33('0x9'));var client=jayson[_0xfd33('0xa')][_0xfd33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10cb91,_0x5e774d,_0x5d9798){return new BPromise(function(_0x3f0327,_0x1f1d1f){return client['request'](_0x10cb91,_0x5d9798)['then'](function(_0x6c94c1){logger['info'](_0xfd33('0xc'),_0x5e774d,_0xfd33('0xd'));logger[_0xfd33('0xe')](_0xfd33('0xf'),_0x5e774d,_0xfd33('0xd'),JSON[_0xfd33('0x10')](_0x6c94c1));if(_0x6c94c1[_0xfd33('0x11')]){if(_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x12')]===0x1f4){logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x13')]);return _0x1f1d1f(_0x6c94c1[_0xfd33('0x11')]['message']);}logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x6c94c1[_0xfd33('0x11')]['message']);return _0x3f0327(_0x6c94c1[_0xfd33('0x11')][_0xfd33('0x13')]);}else{logger[_0xfd33('0x14')](_0xfd33('0xc'),_0x5e774d,_0xfd33('0xd'));_0x3f0327(_0x6c94c1[_0xfd33('0x15')][_0xfd33('0x13')]);}})[_0xfd33('0x16')](function(_0x135af0){logger[_0xfd33('0x11')](_0xfd33('0xc'),_0x5e774d,_0x135af0);_0x1f1d1f(_0x135af0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1eec318..1bc6d63 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 _0x5abd=['describe','show','/:id/resources','post','create','clone','/:id/sections','addSections','addResources','/:id','update','destroy','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x5e697d,_0x111770){var _0x33e09f=function(_0x34e621){while(--_0x34e621){_0x5e697d['push'](_0x5e697d['shift']());}};_0x33e09f(++_0x111770);}(_0x5abd,0x128));var _0xd5ab=function(_0x276986,_0x58a02e){_0x276986=_0x276986-0x0;var _0x1b9e9e=_0x5abd[_0x276986];return _0x1b9e9e;};'use strict';var multer=require(_0xd5ab('0x0'));var util=require(_0xd5ab('0x1'));var path=require(_0xd5ab('0x2'));var timeout=require(_0xd5ab('0x3'));var express=require(_0xd5ab('0x4'));var router=express['Router']();var fs_extra=require(_0xd5ab('0x5'));var auth=require(_0xd5ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd5ab('0x7'));var controller=require('./userProfile.controller');router[_0xd5ab('0x8')]('/',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0xa')]);router[_0xd5ab('0x8')](_0xd5ab('0xb'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0xc')]);router[_0xd5ab('0x8')]('/:id',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0xd')]);router[_0xd5ab('0x8')]('/:id/sections',auth[_0xd5ab('0x9')](),controller['getSections']);router[_0xd5ab('0x8')](_0xd5ab('0xe'),auth[_0xd5ab('0x9')](),controller['getResources']);router[_0xd5ab('0xf')]('/',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x10')]);router[_0xd5ab('0xf')]('/:id/clone',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x11')]);router[_0xd5ab('0xf')](_0xd5ab('0x12'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x13')]);router[_0xd5ab('0xf')](_0xd5ab('0xe'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x14')]);router['put'](_0xd5ab('0x15'),auth['isAuthenticated'](),controller[_0xd5ab('0x16')]);router['delete'](_0xd5ab('0x15'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x17')]);router['delete'](_0xd5ab('0x12'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x18')]);router[_0xd5ab('0x19')]('/:id/resources',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x1a')]);module[_0xd5ab('0x1b')]=router; \ No newline at end of file +var _0x49aa=['./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','delete','removeResources','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x49aa,0x10e));var _0xa49a=function(_0x443c86,_0x1d01af){_0x443c86=_0x443c86-0x0;var _0x4d0e21=_0x49aa[_0x443c86];return _0x4d0e21;};'use strict';var multer=require('multer');var util=require(_0xa49a('0x0'));var path=require('path');var timeout=require(_0xa49a('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa49a('0x2'));var interaction=require(_0xa49a('0x3'));var config=require(_0xa49a('0x4'));var controller=require(_0xa49a('0x5'));router[_0xa49a('0x6')]('/',auth[_0xa49a('0x7')](),controller['index']);router[_0xa49a('0x6')](_0xa49a('0x8'),auth[_0xa49a('0x7')](),controller[_0xa49a('0x9')]);router['get'](_0xa49a('0xa'),auth[_0xa49a('0x7')](),controller[_0xa49a('0xb')]);router[_0xa49a('0x6')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller[_0xa49a('0xd')]);router[_0xa49a('0x6')](_0xa49a('0xe'),auth['isAuthenticated'](),controller[_0xa49a('0xf')]);router[_0xa49a('0x10')]('/',auth[_0xa49a('0x7')](),controller[_0xa49a('0x11')]);router[_0xa49a('0x10')]('/:id/clone',auth['isAuthenticated'](),controller[_0xa49a('0x12')]);router[_0xa49a('0x10')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller[_0xa49a('0x13')]);router['post']('/:id/resources',auth[_0xa49a('0x7')](),controller[_0xa49a('0x14')]);router[_0xa49a('0x15')](_0xa49a('0xa'),auth[_0xa49a('0x7')](),controller['update']);router[_0xa49a('0x16')](_0xa49a('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xa49a('0x16')](_0xa49a('0xc'),auth[_0xa49a('0x7')](),controller['removeSections']);router[_0xa49a('0x16')]('/:id/resources',auth['isAuthenticated'](),controller[_0xa49a('0x17')]);module[_0xa49a('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 02030fc..07f20c7 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 _0xd7e4=['name','setDataValue','crudPermissions','split','BOOLEAN','sequelize','STRING'];(function(_0x29b37d,_0x86755b){var _0x378b35=function(_0xde1ca5){while(--_0xde1ca5){_0x29b37d['push'](_0x29b37d['shift']());}};_0x378b35(++_0x86755b);}(_0xd7e4,0xad));var _0x4d7e=function(_0x5b3cb0,_0xe3410b){_0x5b3cb0=_0x5b3cb0-0x0;var _0x363f0e=_0xd7e4[_0x5b3cb0];return _0x363f0e;};'use strict';var Sequelize=require(_0x4d7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d7e('0x1')],'allowNull':![],'unique':_0x4d7e('0x2')},'crudPermissions':{'type':Sequelize[_0x4d7e('0x1')],'set':function(_0x4c0c7d){this[_0x4d7e('0x3')]('crudPermissions',_0x4c0c7d?_0x4c0c7d['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4d7e('0x4'))?this['getDataValue'](_0x4d7e('0x4'))[_0x4d7e('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4d7e('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4d7e('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4d7e('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4d7e('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4d7e('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6a8a=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','STRING','name'];(function(_0x19409d,_0xf48905){var _0x5de146=function(_0x117745){while(--_0x117745){_0x19409d['push'](_0x19409d['shift']());}};_0x5de146(++_0xf48905);}(_0x6a8a,0x105));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6a8('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6a8('0x1')],'allowNull':![],'unique':_0xa6a8('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xada9a0){this['setDataValue'](_0xa6a8('0x3'),_0xada9a0?_0xada9a0[_0xa6a8('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xa6a8('0x3'))?this[_0xa6a8('0x5')](_0xa6a8('0x3'))[_0xa6a8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa6a8('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index bac4b20..c27b8eb 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 _0xab8f=['type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','clone','createdAt','updatedAt','crudPermissions','body','omit','sequelize','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','describe','addSections','each','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','UserProfileResource','Dashboard','forEach','resourceId','Plugin','addResources','transaction','get','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','fieldName'];(function(_0x3934ac,_0x369499){var _0x7f0311=function(_0x51284a){while(--_0x51284a){_0x3934ac['push'](_0x3934ac['shift']());}};_0x7f0311(++_0x369499);}(_0xab8f,0xb7));var _0xfab8=function(_0x38d2bb,_0x189e4d){_0x38d2bb=_0x38d2bb-0x0;var _0x399b86=_0xab8f[_0x38d2bb];return _0x399b86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfab8('0x0'));var zipdir=require(_0xfab8('0x1'));var jsonpatch=require(_0xfab8('0x2'));var rp=require(_0xfab8('0x3'));var moment=require('moment');var BPromise=require(_0xfab8('0x4'));var Mustache=require(_0xfab8('0x5'));var util=require(_0xfab8('0x6'));var path=require(_0xfab8('0x7'));var sox=require(_0xfab8('0x8'));var csv=require(_0xfab8('0x9'));var ejs=require(_0xfab8('0xa'));var fs=require('fs');var fs_extra=require(_0xfab8('0xb'));var _=require(_0xfab8('0xc'));var squel=require(_0xfab8('0xd'));var crypto=require(_0xfab8('0xe'));var jsforce=require(_0xfab8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfab8('0x9'));var querystring=require(_0xfab8('0x10'));var Papa=require(_0xfab8('0x11'));var Redis=require(_0xfab8('0x12'));var authService=require(_0xfab8('0x13'));var qs=require(_0xfab8('0x14'));var as=require(_0xfab8('0x15'));var hardwareService=require(_0xfab8('0x16'));var logger=require(_0xfab8('0x17'))('api');var utils=require(_0xfab8('0x18'));var config=require(_0xfab8('0x19'));var licenseUtil=require(_0xfab8('0x1a'));var db=require(_0xfab8('0x1b'))['db'];config['redis']=_[_0xfab8('0x1c')](config[_0xfab8('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xfab8('0x1e'))(new Redis(config[_0xfab8('0x1d')]));require(_0xfab8('0x1f'))[_0xfab8('0x20')](socket);function respondWithStatusCode(_0x551883,_0x24d70e){_0x24d70e=_0x24d70e||0xcc;return function(_0x5b56da){if(_0x5b56da){return _0x551883[_0xfab8('0x21')](_0x24d70e);}return _0x551883[_0xfab8('0x22')](_0x24d70e)[_0xfab8('0x23')]();};}function respondWithResult(_0x18f44c,_0x2be0c4){_0x2be0c4=_0x2be0c4||0xc8;return function(_0x4cfc2c){if(_0x4cfc2c){return _0x18f44c[_0xfab8('0x22')](_0x2be0c4)[_0xfab8('0x24')](_0x4cfc2c);}};}function respondWithFilteredResult(_0x3b01ba,_0x4bff39){return function(_0x3ae50e){if(_0x3ae50e){var _0x1b5889=typeof _0x4bff39['offset']===_0xfab8('0x25')&&typeof _0x4bff39[_0xfab8('0x26')]==='undefined';var _0x57db96=_0x3ae50e[_0xfab8('0x27')];var _0x2ed739=_0x1b5889?0x0:_0x4bff39['offset'];var _0x17fed2=_0x1b5889?_0x3ae50e[_0xfab8('0x27')]:_0x4bff39[_0xfab8('0x28')]+_0x4bff39[_0xfab8('0x26')];var _0x2b1d00;if(_0x17fed2>=_0x57db96){_0x17fed2=_0x57db96;_0x2b1d00=0xc8;}else{_0x2b1d00=0xce;}_0x3b01ba['status'](_0x2b1d00);return _0x3b01ba[_0xfab8('0x29')](_0xfab8('0x2a'),_0x2ed739+'-'+_0x17fed2+'/'+_0x57db96)[_0xfab8('0x24')](_0x3ae50e);}return null;};}function patchUpdates(_0x4e2084){return function(_0x274a91){try{jsonpatch['apply'](_0x274a91,_0x4e2084,!![]);}catch(_0x44a907){return BPromise['reject'](_0x44a907);}return _0x274a91[_0xfab8('0x2b')]();};}function saveUpdates(_0x3a3694,_0x1c8474){return function(_0xb86878){if(_0xb86878){return _0xb86878[_0xfab8('0x2c')](_0x3a3694)['then'](function(_0x44faa1){return _0x44faa1;});}return null;};}function removeEntity(_0xefe597,_0x5bef5b){return function(_0x67079){if(_0x67079){return _0x67079[_0xfab8('0x2d')]()[_0xfab8('0x2e')](function(){_0xefe597[_0xfab8('0x22')](0xcc)[_0xfab8('0x23')]();});}};}function handleEntityNotFound(_0x4c6a59,_0x2e99cc){return function(_0x5d9ecc){if(!_0x5d9ecc){_0x4c6a59['sendStatus'](0x194);}return _0x5d9ecc;};}function handleError(_0xc72289,_0x2b1b04){_0x2b1b04=_0x2b1b04||0x1f4;return function(_0x349f35){logger[_0xfab8('0x2f')](_0x349f35[_0xfab8('0x30')]);if(_0x349f35[_0xfab8('0x31')]){delete _0x349f35[_0xfab8('0x31')];}_0xc72289['status'](_0x2b1b04)[_0xfab8('0x32')](_0x349f35);};}exports[_0xfab8('0x33')]=function(_0x476791,_0x3efc5f){var _0x257252={},_0x6b5967={},_0x50fa8a={'count':0x0,'rows':[]};var _0x478db1=_[_0xfab8('0x34')](db[_0xfab8('0x35')]['rawAttributes'],function(_0xf23ee6){return{'name':_0xf23ee6[_0xfab8('0x36')],'type':_0xf23ee6[_0xfab8('0x37')]['key']};});_0x6b5967[_0xfab8('0x38')]=_[_0xfab8('0x34')](_0x478db1,_0xfab8('0x31'));_0x6b5967[_0xfab8('0x39')]=_[_0xfab8('0x3a')](_0x476791['query']);_0x6b5967['filters']=_[_0xfab8('0x3b')](_0x6b5967[_0xfab8('0x38')],_0x6b5967[_0xfab8('0x39')]);_0x257252[_0xfab8('0x3c')]=_[_0xfab8('0x3b')](_0x6b5967[_0xfab8('0x38')],qs[_0xfab8('0x3d')](_0x476791[_0xfab8('0x39')]['fields']));_0x257252[_0xfab8('0x3c')]=_0x257252[_0xfab8('0x3c')][_0xfab8('0x3e')]?_0x257252[_0xfab8('0x3c')]:_0x6b5967[_0xfab8('0x38')];if(!_0x476791[_0xfab8('0x39')]['hasOwnProperty'](_0xfab8('0x3f'))){_0x257252['limit']=qs[_0xfab8('0x26')](_0x476791[_0xfab8('0x39')]['limit']);_0x257252['offset']=qs[_0xfab8('0x28')](_0x476791[_0xfab8('0x39')][_0xfab8('0x28')]);}_0x257252[_0xfab8('0x40')]=qs[_0xfab8('0x41')](_0x476791[_0xfab8('0x39')]['sort']);_0x257252[_0xfab8('0x42')]=qs[_0xfab8('0x43')](_['pick'](_0x476791[_0xfab8('0x39')],_0x6b5967['filters']),_0x478db1);if(_0x476791['query']['filter']){_0x257252['where']=_[_0xfab8('0x44')](_0x257252[_0xfab8('0x42')],{'$or':_[_0xfab8('0x34')](_0x478db1,function(_0x1c1519){if(_0x1c1519['type']!=='VIRTUAL'){var _0x2c576b={};_0x2c576b[_0x1c1519['name']]={'$like':'%'+_0x476791[_0xfab8('0x39')][_0xfab8('0x45')]+'%'};return _0x2c576b;}})});}_0x257252=_[_0xfab8('0x44')]({},_0x257252,_0x476791[_0xfab8('0x46')]);var _0x102af7={'where':_0x257252['where']};return db['UserProfile'][_0xfab8('0x27')](_0x102af7)['then'](function(_0x3628d8){_0x50fa8a[_0xfab8('0x27')]=_0x3628d8;if(_0x476791[_0xfab8('0x39')][_0xfab8('0x47')]){_0x257252[_0xfab8('0x48')]=[{'all':!![]}];}return db[_0xfab8('0x35')][_0xfab8('0x49')](_0x257252);})[_0xfab8('0x2e')](function(_0x2beaa6){_0x50fa8a['rows']=_0x2beaa6;return _0x50fa8a;})['then'](respondWithFilteredResult(_0x3efc5f,_0x257252))[_0xfab8('0x4a')](handleError(_0x3efc5f,null));};exports[_0xfab8('0x4b')]=function(_0x5d27d5,_0x434726){var _0xf3c6e1={'raw':![],'where':{'id':_0x5d27d5[_0xfab8('0x4c')]['id']}},_0x31008a={};_0x31008a[_0xfab8('0x38')]=_['keys'](db[_0xfab8('0x35')][_0xfab8('0x4d')]);_0x31008a[_0xfab8('0x39')]=_['keys'](_0x5d27d5[_0xfab8('0x39')]);_0x31008a[_0xfab8('0x43')]=_[_0xfab8('0x3b')](_0x31008a[_0xfab8('0x38')],_0x31008a[_0xfab8('0x39')]);_0xf3c6e1[_0xfab8('0x3c')]=_['intersection'](_0x31008a[_0xfab8('0x38')],qs[_0xfab8('0x3d')](_0x5d27d5[_0xfab8('0x39')][_0xfab8('0x3d')]));_0xf3c6e1[_0xfab8('0x3c')]=_0xf3c6e1[_0xfab8('0x3c')][_0xfab8('0x3e')]?_0xf3c6e1['attributes']:_0x31008a[_0xfab8('0x38')];if(_0x5d27d5[_0xfab8('0x39')]['includeAll']){_0xf3c6e1[_0xfab8('0x48')]=[{'all':!![]}];}_0xf3c6e1=_[_0xfab8('0x44')]({},_0xf3c6e1,_0x5d27d5[_0xfab8('0x46')]);return db['UserProfile'][_0xfab8('0x4e')](_0xf3c6e1)['then'](handleEntityNotFound(_0x434726,null))['then'](respondWithResult(_0x434726,null))[_0xfab8('0x4a')](handleError(_0x434726,null));};exports[_0xfab8('0x4f')]=function(_0x2bc6ed,_0x450058){return db['UserProfile']['create'](_0x2bc6ed['body'],{})[_0xfab8('0x2e')](respondWithResult(_0x450058,0xc9))['catch'](handleError(_0x450058,null));};exports[_0xfab8('0x50')]=function(_0x3e5fad,_0x1c1eef){var _0x125b08={'where':{'id':_0x3e5fad[_0xfab8('0x4c')]['id']}},_0x236fbe={};_0x236fbe[_0xfab8('0x38')]=_['keys'](db['UserProfile'][_0xfab8('0x4d')]);_0x125b08[_0xfab8('0x3c')]=_['intersection'](_0x236fbe[_0xfab8('0x38')],qs[_0xfab8('0x3d')](_0x3e5fad[_0xfab8('0x39')][_0xfab8('0x3d')]));_0x125b08[_0xfab8('0x3c')]=_0x125b08['attributes'][_0xfab8('0x3e')]?_0x125b08[_0xfab8('0x3c')]:_0x236fbe['model'];if(_0x3e5fad[_0xfab8('0x39')]['includeAll']){_0x125b08['include']=[{'all':!![]}];}_0x125b08=_['merge']({},_0x125b08,_0x3e5fad[_0xfab8('0x46')]);return db[_0xfab8('0x35')][_0xfab8('0x4e')](_0x125b08)[_0xfab8('0x2e')](handleEntityNotFound(_0x1c1eef,null))[_0xfab8('0x2e')](function(_0x312045){if(_0x312045){var _0x5b3a22=_0x312045['get']({'plain':!![]});_0x5b3a22=qs['omit'](_0x5b3a22,['id',_0xfab8('0x51'),_0xfab8('0x52'),_0xfab8('0x53')]);_0x3e5fad[_0xfab8('0x54')]=_[_0xfab8('0x55')](_0x3e5fad[_0xfab8('0x54')],['id','createdAt','updatedAt']);return db[_0xfab8('0x56')]['transaction'](function(_0x47b337){return db['UserProfile']['create'](_['merge'](_0x5b3a22,_0x3e5fad['body']),{'include':_0x3e5fad[_0xfab8('0x39')][_0xfab8('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x47b337})['then'](function(_0x3d012f){var _0x31316b=_0x3d012f['get']({'plain':!![]});return db[_0xfab8('0x57')][_0xfab8('0x49')]({'where':{'userProfileId':_0x3e5fad[_0xfab8('0x4c')]['id']},'raw':!![]})[_0xfab8('0x2e')](function(_0x4047a2){if(_0x4047a2){return BPromise['each'](_0x4047a2,function(_0x27153b){return new BPromise(function(_0x504b72,_0x36f4cf){if(_0x27153b[_0xfab8('0x58')]===null||_0x27153b['autoAssociation']===0x1)_0x504b72(null);return db['UserProfileResource'][_0xfab8('0x49')]({'where':{'sectionId':_0x27153b['id']},'raw':!![]})['then'](function(_0x24a34e){var _0x16cfc6=_[_0xfab8('0x34')](_0x24a34e,function(_0x1740ac){return qs['omit'](_0x1740ac,['id',_0xfab8('0x51'),_0xfab8('0x52'),_0xfab8('0x59')]);});_0x504b72(_0x16cfc6);})[_0xfab8('0x4a')](function(_0x1ee395){_0x36f4cf(_0x1ee395);});})[_0xfab8('0x2e')](function(_0x52aa7a){var _0x31bc87=qs[_0xfab8('0x55')](_0x27153b,['id',_0xfab8('0x51'),'updatedAt']);_0x31bc87[_0xfab8('0x5a')]=_0x31316b['id'];if(_0x52aa7a)_0x31bc87[_0xfab8('0x5b')]=_0x52aa7a;return _0x31bc87;})[_0xfab8('0x2e')](function(_0x5c2fb5){return db[_0xfab8('0x57')][_0xfab8('0x4f')](_0x5c2fb5,{'include':[{'model':db['UserProfileResource'],'as':_0xfab8('0x5b')}],'raw':!![],'transaction':_0x47b337});});})[_0xfab8('0x2e')](function(){return _0x31316b;});}});});});}})[_0xfab8('0x2e')](respondWithResult(_0x1c1eef,0xc9))[_0xfab8('0x4a')](handleError(_0x1c1eef,null));};exports['update']=function(_0x276d55,_0x3aac47){if(_0x276d55[_0xfab8('0x54')]['id']){delete _0x276d55[_0xfab8('0x54')]['id'];}return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x276d55[_0xfab8('0x4c')]['id']}})[_0xfab8('0x2e')](handleEntityNotFound(_0x3aac47,null))[_0xfab8('0x2e')](saveUpdates(_0x276d55[_0xfab8('0x54')],null))[_0xfab8('0x2e')](respondWithResult(_0x3aac47,null))['catch'](handleError(_0x3aac47,null));};exports['destroy']=function(_0x33bf62,_0x5269ec){return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x33bf62[_0xfab8('0x4c')]['id']}})[_0xfab8('0x2e')](handleEntityNotFound(_0x5269ec,null))[_0xfab8('0x2e')](removeEntity(_0x5269ec,null))[_0xfab8('0x4a')](handleError(_0x5269ec,null));};exports['describe']=function(_0x433e74,_0x2eceb6){return db[_0xfab8('0x35')][_0xfab8('0x5c')]()[_0xfab8('0x2e')](respondWithResult(_0x2eceb6,null))['catch'](handleError(_0x2eceb6,null));};exports[_0xfab8('0x5d')]=function(_0x52a23e,_0xd34af6){var _0xeb1cc6=_0x52a23e['body'];return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x52a23e['params']['id']}})[_0xfab8('0x2e')](handleEntityNotFound(_0xd34af6,null))[_0xfab8('0x2e')](function(_0x1ffbc5){if(_0x1ffbc5){return db[_0xfab8('0x56')]['transaction'](function(_0x48ec96){return db[_0xfab8('0x57')]['destroy']({'where':{'userProfileId':_0x52a23e[_0xfab8('0x4c')]['id'],'sectionId':_[_0xfab8('0x34')](_0xeb1cc6,function(_0x504c50){return _0x504c50[_0xfab8('0x59')];})},'transaction':_0x48ec96})[_0xfab8('0x2e')](function(){var _0x5037e6=_[_0xfab8('0x34')](_0xeb1cc6,function(_0x23c232){_0x23c232[_0xfab8('0x5a')]=_0x52a23e[_0xfab8('0x4c')]['id'];return _0x23c232;});var _0x2c5dd2=[];return BPromise[_0xfab8('0x5e')](_0x5037e6,function(_0x15d9b9){return db[_0xfab8('0x57')]['create'](_0x15d9b9,{'include':[{'model':db['UserProfileResource'],'as':_0xfab8('0x5b')}],'raw':!![],'transaction':_0x48ec96})[_0xfab8('0x2e')](function(_0x4435ea){_0x2c5dd2[_0xfab8('0x5f')](_0x4435ea['get']({'plain':!![]}));});})[_0xfab8('0x2e')](function(){return _0x2c5dd2;});});});}})[_0xfab8('0x2e')](function(_0x498d6d){return _0x498d6d;})[_0xfab8('0x2e')](respondWithResult(_0xd34af6,null))[_0xfab8('0x4a')](handleError(_0xd34af6,null));};exports[_0xfab8('0x60')]=function(_0x48c1f8,_0x39fa5a){var _0x258c64;return db[_0xfab8('0x35')]['find']({'where':{'id':_0x48c1f8['params']['id']},'attributes':['id',_0xfab8('0x31')]})[_0xfab8('0x2e')](handleEntityNotFound(_0x39fa5a,null))['then'](function(_0x508e5e){if(_0x508e5e){_0x258c64=_0x508e5e;return db[_0xfab8('0x57')][_0xfab8('0x2d')]({'where':{'userProfileId':_0x48c1f8['params']['id'],'sectionId':_0x48c1f8[_0xfab8('0x39')][_0xfab8('0x61')]}});}})[_0xfab8('0x2e')](function(){return _0x258c64;})['then'](respondWithStatusCode(_0x39fa5a,null))[_0xfab8('0x4a')](handleError(_0x39fa5a,null));};exports[_0xfab8('0x62')]=function(_0x1b3c7c,_0x2698e4){var _0x5494eb=[];var _0x234907=[];return db['UserProfileSection'][_0xfab8('0x49')]({'where':{'userProfileId':_0x1b3c7c[_0xfab8('0x4c')]['id']},'raw':!![]})[_0xfab8('0x2e')](function(_0x1c731e){_0x5494eb=_['filter'](_0x1c731e,function(_0x535c5a){return _0x535c5a[_0xfab8('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x535c5a[_0xfab8('0x59')]);});if(!_[_0xfab8('0x64')](_0x5494eb)){return _[_0xfab8('0x34')](_0x5494eb,function(_0x3b7cc9){return _0x3b7cc9[_0xfab8('0x59')];});}else{return;}})['then'](function(_0x5144cc){if(_0x5144cc)_0x234907=_0x5144cc;if(_[_0xfab8('0x65')](_0x234907,0x64)){var _0x1b9e6f=_[_0xfab8('0x4e')](_0x5494eb,{'sectionId':0x64});return hasDefaultDashboard(_0x1b9e6f)[_0xfab8('0x2e')](function(_0x22c596){return _[_0xfab8('0x34')](_0x5494eb,function(_0x30f4dc){if(_0x30f4dc[_0xfab8('0x59')]===0x64){_0x30f4dc[_0xfab8('0x66')]=_0x22c596;}return _0x30f4dc;});});}else{return;}})['then'](function(_0x4c7e1f){if(_0x4c7e1f)_0x5494eb=_0x4c7e1f;if(_[_0xfab8('0x65')](_0x234907,0x3eb)){var _0x2cbd43=_[_0xfab8('0x4e')](_0x5494eb,{'sectionId':0x3eb});return getCustomDashboards(_0x2cbd43)['then'](function(_0x3a7e9b){return _[_0xfab8('0x34')](_0x5494eb,function(_0x332cd7){if(_0x2cbd43['enabled']){if(_0x332cd7[_0xfab8('0x59')]===0x3eb){_0x332cd7['subsections']=_0x3a7e9b;}}else{if(_0x332cd7['sectionId']===0x64){if(!_0x332cd7[_0xfab8('0x66')]){_0x332cd7[_0xfab8('0x66')]=[];}_0x332cd7[_0xfab8('0x66')]=_0x332cd7['subsections'][_0xfab8('0x67')](_0x3a7e9b);}}return _0x332cd7;});});}else{return;}})['then'](function(_0x5738d4){if(_0x5738d4)_0x5494eb=_0x5738d4;if(_[_0xfab8('0x65')](_0x234907,0x709)){var _0x56b60f=_[_0xfab8('0x4e')](_0x5494eb,{'sectionId':0x709});return getPlugins(_0x56b60f)[_0xfab8('0x2e')](function(_0x3ae31b){if(_0x56b60f[_0xfab8('0x63')]){return _[_0xfab8('0x34')](_0x5494eb,function(_0x28be38){if(_0x28be38[_0xfab8('0x59')]===0x709){_0x28be38[_0xfab8('0x66')]=_0x3ae31b;}return _0x28be38;});}else{var _0x3868e8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3ae31b};var _0x3de99f=_[_0xfab8('0x34')](_0x5494eb);_0x3de99f[_0xfab8('0x5f')](_0x3868e8);return _0x3de99f;}});}else{return;}})[_0xfab8('0x2e')](function(_0x351420){if(_0x351420)_0x5494eb=_0x351420;return _['filter'](_0x5494eb,[_0xfab8('0x63'),0x1]);})[_0xfab8('0x2e')](respondWithResult(_0x2698e4,null))['catch'](handleError(_0x2698e4,null));};function hasDefaultDashboard(_0x2367ee){var _0x22340e=[0x65];return new BPromise(function(_0xce9227,_0x319523){try{if(_0x2367ee[_0xfab8('0x58')]){_0xce9227(_0x22340e);}else{return db[_0xfab8('0x68')]['findOne']({'where':{'sectionId':_0x2367ee['id']},'raw':!![]})[_0xfab8('0x2e')](function(_0x128ef6){_0x128ef6?_0xce9227(_0x22340e):_0xce9227();});}}catch(_0x8efc4f){_0x319523(_0x8efc4f);}});}function getCustomDashboards(_0x3b995d){var _0x5d1d7d=[];return new BPromise(function(_0x3aef1b,_0x52a948){try{if(_0x3b995d[_0xfab8('0x58')]){return db[_0xfab8('0x69')][_0xfab8('0x49')]({'raw':!![]})[_0xfab8('0x2e')](function(_0x4d1399){_0x4d1399[_0xfab8('0x6a')](function(_0x598e8d){_0x5d1d7d[_0xfab8('0x5f')](_0x598e8d['id']+0x1869f);});_0x3aef1b(_0x5d1d7d);});}else{return db[_0xfab8('0x68')][_0xfab8('0x49')]({'where':{'sectionId':_0x3b995d['id']},'raw':!![]})['then'](function(_0x5d5c37){_0x5d5c37['forEach'](function(_0x4742a7){_0x5d1d7d[_0xfab8('0x5f')](_0x4742a7[_0xfab8('0x6b')]+0x1869f);});_0x3aef1b(_0x5d1d7d);});}}catch(_0x42ccc4){_0x52a948(_0x42ccc4);}});}function getPlugins(_0x10f9bb){var _0x485372=[];return new BPromise(function(_0x26d886,_0x194f65){try{if(_0x10f9bb[_0xfab8('0x58')]){return db[_0xfab8('0x6c')]['findAll']({'raw':!![]})[_0xfab8('0x2e')](function(_0x4b6941){_0x4b6941[_0xfab8('0x6a')](function(_0x37225c){_0x485372[_0xfab8('0x5f')](_0x37225c['id']+0x15b38);});_0x26d886(_0x485372);});}else{return db['UserProfileResource'][_0xfab8('0x49')]({'where':{'sectionId':_0x10f9bb['id']},'raw':!![]})[_0xfab8('0x2e')](function(_0x3f5538){_0x3f5538[_0xfab8('0x6a')](function(_0x5ab29c){_0x485372[_0xfab8('0x5f')](_0x5ab29c[_0xfab8('0x6b')]+0x15b38);});_0x26d886(_0x485372);});}}catch(_0x2e8da0){_0x194f65(_0x2e8da0);}});}exports[_0xfab8('0x6d')]=function(_0x357fd6,_0xd48bd1){return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x357fd6[_0xfab8('0x4c')]['id']}})[_0xfab8('0x2e')](handleEntityNotFound(_0xd48bd1,null))[_0xfab8('0x2e')](function(_0x5886d6){if(_0x5886d6){return db['sequelize'][_0xfab8('0x6e')](function(_0x5c75f2){return db[_0xfab8('0x57')][_0xfab8('0x49')]({'where':{'userProfileId':_0x357fd6[_0xfab8('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5f5a35){if(_0x5f5a35){return db[_0xfab8('0x57')][_0xfab8('0x2d')]({'where':{'userProfileId':_0x357fd6['params']['id'],'id':_[_0xfab8('0x34')](_0x5f5a35,function(_0x2675aa){return _0x2675aa['id'];})},'transaction':_0x5c75f2});}})[_0xfab8('0x2e')](function(_0x1b02c1){var _0x5e952b=_[_0xfab8('0x34')](_0x357fd6[_0xfab8('0x54')],function(_0x23d188){_0x23d188['userProfileId']=_0x357fd6['params']['id'];return _0x23d188;});return db['UserProfileSection']['bulkCreate'](_0x5e952b,{'raw':!![],'transaction':_0x5c75f2});})[_0xfab8('0x2e')](function(_0x1f213c){var _0x4072bf=_[_0xfab8('0x45')](_['map'](_0x1f213c,function(_0x29613c){return _0x29613c[_0xfab8('0x6f')]({'plain':!![]});}),{'includeAll':![]});if(_0x4072bf){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x357fd6[_0xfab8('0x4c')]['id'],'sectionId':_['map'](_0x4072bf,function(_0x510ceb){return _0x510ceb[_0xfab8('0x59')];})},'attributes':['id',_0xfab8('0x59')],'raw':!![]})[_0xfab8('0x2e')](function(_0x456e34){var _0x294822=_[_0xfab8('0x34')](_0x357fd6[_0xfab8('0x54')],function(_0x48f109){_0x48f109[_0xfab8('0x5a')]=_0x357fd6[_0xfab8('0x4c')]['id'];return _0x48f109;});return db['UserProfileResource'][_0xfab8('0x70')](_0x294822,{'raw':!![],'transaction':_0x5c75f2});});}})[_0xfab8('0x4a')](handleError(_0xd48bd1,null));});}})[_0xfab8('0x2e')](function(_0x454e80){var _0x6d6750=_[_0xfab8('0x34')](_0x454e80,function(_0x1447bc){return _0x1447bc[_0xfab8('0x6f')]({'plain':!![]});});})[_0xfab8('0x2e')](respondWithResult(_0xd48bd1,null))['catch'](handleError(_0xd48bd1,null));};exports[_0xfab8('0x71')]=function(_0x40cd1a,_0x43ed04,_0x503daa){return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x40cd1a[_0xfab8('0x4c')]['id']}})[_0xfab8('0x2e')](handleEntityNotFound(_0x43ed04,null))[_0xfab8('0x2e')](function(_0x74033c){if(_0x74033c){return _0x74033c[_0xfab8('0x71')](_0x40cd1a[_0xfab8('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x43ed04,null))[_0xfab8('0x4a')](handleError(_0x43ed04,null));};exports[_0xfab8('0x72')]=function(_0x5e247a,_0x5e1831){var _0x3b508a={};if(!_0x5e247a[_0xfab8('0x39')][_0xfab8('0x73')])throw new Error(_0xfab8('0x74'));if(!_0x5e247a[_0xfab8('0x39')][_0xfab8('0x75')]('nolimit')){_0x3b508a[_0xfab8('0x26')]=qs['limit'](_0x5e247a[_0xfab8('0x39')][_0xfab8('0x26')]);_0x3b508a[_0xfab8('0x28')]=qs[_0xfab8('0x28')](_0x5e247a[_0xfab8('0x39')]['offset']);}return db[_0xfab8('0x35')][_0xfab8('0x4e')]({'where':{'id':_0x5e247a[_0xfab8('0x4c')]['id']}})[_0xfab8('0x2e')](function(_0x36b43a){if(!_0x36b43a)throw new Error(_0xfab8('0x76')+_0x5e247a[_0xfab8('0x4c')]['id']);return db['UserProfile'][_0xfab8('0x72')](_0x5e247a);})[_0xfab8('0x2e')](respondWithFilteredResult(_0x5e1831,_0x3b508a))[_0xfab8('0x4a')](handleError(_0x5e1831,null));}; \ No newline at end of file +var _0xb88b=['Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','filter','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','stack','send','map','UserProfile','rawAttributes','fieldName','key','name','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','clone','params','omit','updatedAt','body','createdAt','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','find','push','ids','enabled','includes','isEmpty','subsections','concat','findOne'];(function(_0x30ae7b,_0x3a718f){var _0xa9d0cf=function(_0x8102a1){while(--_0x8102a1){_0x30ae7b['push'](_0x30ae7b['shift']());}};_0xa9d0cf(++_0x3a718f);}(_0xb88b,0x1c8));var _0xbb88=function(_0x54787e,_0xcdfd2c){_0x54787e=_0x54787e-0x0;var _0x5f4876=_0xb88b[_0x54787e];return _0x5f4876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb88('0x0'));var zipdir=require(_0xbb88('0x1'));var jsonpatch=require(_0xbb88('0x2'));var rp=require('request-promise');var moment=require(_0xbb88('0x3'));var BPromise=require(_0xbb88('0x4'));var Mustache=require('mustache');var util=require(_0xbb88('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbb88('0x6'));var ejs=require(_0xbb88('0x7'));var fs=require('fs');var fs_extra=require(_0xbb88('0x8'));var _=require(_0xbb88('0x9'));var squel=require(_0xbb88('0xa'));var crypto=require('crypto');var jsforce=require(_0xbb88('0xb'));var deskjs=require(_0xbb88('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb88('0xd'));var Redis=require(_0xbb88('0xe'));var authService=require(_0xbb88('0xf'));var qs=require(_0xbb88('0x10'));var as=require(_0xbb88('0x11'));var hardwareService=require(_0xbb88('0x12'));var logger=require(_0xbb88('0x13'))('api');var utils=require(_0xbb88('0x14'));var config=require(_0xbb88('0x15'));var licenseUtil=require(_0xbb88('0x16'));var db=require(_0xbb88('0x17'))['db'];config['redis']=_[_0xbb88('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb88('0x19'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbb88('0x1a')](socket);function respondWithStatusCode(_0x28870b,_0x164ee9){_0x164ee9=_0x164ee9||0xcc;return function(_0x4bf486){if(_0x4bf486){return _0x28870b[_0xbb88('0x1b')](_0x164ee9);}return _0x28870b[_0xbb88('0x1c')](_0x164ee9)['end']();};}function respondWithResult(_0x1731c3,_0x1d5f74){_0x1d5f74=_0x1d5f74||0xc8;return function(_0x492e02){if(_0x492e02){return _0x1731c3[_0xbb88('0x1c')](_0x1d5f74)[_0xbb88('0x1d')](_0x492e02);}};}function respondWithFilteredResult(_0x3996b1,_0x563940){return function(_0x3788ef){if(_0x3788ef){var _0x3f9f4f=typeof _0x563940[_0xbb88('0x1e')]===_0xbb88('0x1f')&&typeof _0x563940[_0xbb88('0x20')]===_0xbb88('0x1f');var _0x3eebfa=_0x3788ef['count'];var _0xa21e82=_0x3f9f4f?0x0:_0x563940[_0xbb88('0x1e')];var _0x4d17b3=_0x3f9f4f?_0x3788ef[_0xbb88('0x21')]:_0x563940[_0xbb88('0x1e')]+_0x563940[_0xbb88('0x20')];var _0x3cfe6d;if(_0x4d17b3>=_0x3eebfa){_0x4d17b3=_0x3eebfa;_0x3cfe6d=0xc8;}else{_0x3cfe6d=0xce;}_0x3996b1[_0xbb88('0x1c')](_0x3cfe6d);return _0x3996b1[_0xbb88('0x22')]('Content-Range',_0xa21e82+'-'+_0x4d17b3+'/'+_0x3eebfa)['json'](_0x3788ef);}return null;};}function patchUpdates(_0x5525f7){return function(_0x4fa982){try{jsonpatch[_0xbb88('0x23')](_0x4fa982,_0x5525f7,!![]);}catch(_0x19742f){return BPromise['reject'](_0x19742f);}return _0x4fa982[_0xbb88('0x24')]();};}function saveUpdates(_0xb896c6,_0x2e6e40){return function(_0x502a87){if(_0x502a87){return _0x502a87[_0xbb88('0x25')](_0xb896c6)[_0xbb88('0x26')](function(_0x8a7f29){return _0x8a7f29;});}return null;};}function removeEntity(_0x17bac2,_0x2abcd0){return function(_0x52a408){if(_0x52a408){return _0x52a408[_0xbb88('0x27')]()[_0xbb88('0x26')](function(){_0x17bac2['status'](0xcc)[_0xbb88('0x28')]();});}};}function handleEntityNotFound(_0x165b7c,_0xdc9d6e){return function(_0x4f499f){if(!_0x4f499f){_0x165b7c['sendStatus'](0x194);}return _0x4f499f;};}function handleError(_0x22d159,_0x1f4f42){_0x1f4f42=_0x1f4f42||0x1f4;return function(_0x52fd49){logger['error'](_0x52fd49[_0xbb88('0x29')]);if(_0x52fd49['name']){delete _0x52fd49['name'];}_0x22d159[_0xbb88('0x1c')](_0x1f4f42)[_0xbb88('0x2a')](_0x52fd49);};}exports['index']=function(_0x53528f,_0x34d271){var _0x30415b={},_0x565cd3={},_0x4be7bc={'count':0x0,'rows':[]};var _0x45b90e=_[_0xbb88('0x2b')](db[_0xbb88('0x2c')][_0xbb88('0x2d')],function(_0xcfe3c2){return{'name':_0xcfe3c2[_0xbb88('0x2e')],'type':_0xcfe3c2['type'][_0xbb88('0x2f')]};});_0x565cd3['model']=_[_0xbb88('0x2b')](_0x45b90e,_0xbb88('0x30'));_0x565cd3[_0xbb88('0x31')]=_[_0xbb88('0x32')](_0x53528f[_0xbb88('0x31')]);_0x565cd3['filters']=_[_0xbb88('0x33')](_0x565cd3['model'],_0x565cd3['query']);_0x30415b['attributes']=_[_0xbb88('0x33')](_0x565cd3['model'],qs[_0xbb88('0x34')](_0x53528f['query'][_0xbb88('0x34')]));_0x30415b[_0xbb88('0x35')]=_0x30415b[_0xbb88('0x35')]['length']?_0x30415b[_0xbb88('0x35')]:_0x565cd3[_0xbb88('0x36')];if(!_0x53528f[_0xbb88('0x31')][_0xbb88('0x37')](_0xbb88('0x38'))){_0x30415b['limit']=qs[_0xbb88('0x20')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x20')]);_0x30415b[_0xbb88('0x1e')]=qs[_0xbb88('0x1e')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x1e')]);}_0x30415b[_0xbb88('0x39')]=qs[_0xbb88('0x3a')](_0x53528f[_0xbb88('0x31')][_0xbb88('0x3a')]);_0x30415b[_0xbb88('0x3b')]=qs[_0xbb88('0x3c')](_[_0xbb88('0x3d')](_0x53528f[_0xbb88('0x31')],_0x565cd3['filters']),_0x45b90e);if(_0x53528f[_0xbb88('0x31')]['filter']){_0x30415b[_0xbb88('0x3b')]=_[_0xbb88('0x3e')](_0x30415b[_0xbb88('0x3b')],{'$or':_[_0xbb88('0x2b')](_0x45b90e,function(_0x5a20d0){if(_0x5a20d0['type']!==_0xbb88('0x3f')){var _0x2db78a={};_0x2db78a[_0x5a20d0[_0xbb88('0x30')]]={'$like':'%'+_0x53528f[_0xbb88('0x31')]['filter']+'%'};return _0x2db78a;}})});}_0x30415b=_[_0xbb88('0x3e')]({},_0x30415b,_0x53528f[_0xbb88('0x40')]);var _0x1c6769={'where':_0x30415b[_0xbb88('0x3b')]};return db[_0xbb88('0x2c')][_0xbb88('0x21')](_0x1c6769)[_0xbb88('0x26')](function(_0x56df38){_0x4be7bc[_0xbb88('0x21')]=_0x56df38;if(_0x53528f[_0xbb88('0x31')][_0xbb88('0x41')]){_0x30415b[_0xbb88('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0xbb88('0x43')](_0x30415b);})[_0xbb88('0x26')](function(_0x331d20){_0x4be7bc[_0xbb88('0x44')]=_0x331d20;return _0x4be7bc;})['then'](respondWithFilteredResult(_0x34d271,_0x30415b))[_0xbb88('0x45')](handleError(_0x34d271,null));};exports[_0xbb88('0x46')]=function(_0x2217d0,_0x11644f){var _0x594f5a={'raw':![],'where':{'id':_0x2217d0['params']['id']}},_0x32788f={};_0x32788f['model']=_['keys'](db[_0xbb88('0x2c')][_0xbb88('0x2d')]);_0x32788f[_0xbb88('0x31')]=_['keys'](_0x2217d0[_0xbb88('0x31')]);_0x32788f[_0xbb88('0x3c')]=_['intersection'](_0x32788f[_0xbb88('0x36')],_0x32788f['query']);_0x594f5a[_0xbb88('0x35')]=_[_0xbb88('0x33')](_0x32788f['model'],qs[_0xbb88('0x34')](_0x2217d0[_0xbb88('0x31')]['fields']));_0x594f5a[_0xbb88('0x35')]=_0x594f5a[_0xbb88('0x35')]['length']?_0x594f5a[_0xbb88('0x35')]:_0x32788f['model'];if(_0x2217d0['query'][_0xbb88('0x41')]){_0x594f5a[_0xbb88('0x42')]=[{'all':!![]}];}_0x594f5a=_[_0xbb88('0x3e')]({},_0x594f5a,_0x2217d0['options']);return db[_0xbb88('0x2c')]['find'](_0x594f5a)[_0xbb88('0x26')](handleEntityNotFound(_0x11644f,null))[_0xbb88('0x26')](respondWithResult(_0x11644f,null))[_0xbb88('0x45')](handleError(_0x11644f,null));};exports[_0xbb88('0x47')]=function(_0x25efda,_0x4ba153){return db[_0xbb88('0x2c')][_0xbb88('0x47')](_0x25efda['body'],{})['then'](respondWithResult(_0x4ba153,0xc9))[_0xbb88('0x45')](handleError(_0x4ba153,null));};exports[_0xbb88('0x48')]=function(_0x268d86,_0x581774){var _0x5a22f6={'where':{'id':_0x268d86[_0xbb88('0x49')]['id']}},_0x628ea2={};_0x628ea2[_0xbb88('0x36')]=_['keys'](db['UserProfile']['rawAttributes']);_0x5a22f6[_0xbb88('0x35')]=_[_0xbb88('0x33')](_0x628ea2[_0xbb88('0x36')],qs['fields'](_0x268d86[_0xbb88('0x31')][_0xbb88('0x34')]));_0x5a22f6[_0xbb88('0x35')]=_0x5a22f6[_0xbb88('0x35')]['length']?_0x5a22f6[_0xbb88('0x35')]:_0x628ea2[_0xbb88('0x36')];if(_0x268d86['query'][_0xbb88('0x41')]){_0x5a22f6[_0xbb88('0x42')]=[{'all':!![]}];}_0x5a22f6=_[_0xbb88('0x3e')]({},_0x5a22f6,_0x268d86[_0xbb88('0x40')]);return db[_0xbb88('0x2c')]['find'](_0x5a22f6)[_0xbb88('0x26')](handleEntityNotFound(_0x581774,null))[_0xbb88('0x26')](function(_0x2197f3){if(_0x2197f3){var _0x57465=_0x2197f3['get']({'plain':!![]});_0x57465=qs[_0xbb88('0x4a')](_0x57465,['id','createdAt',_0xbb88('0x4b'),'crudPermissions']);_0x268d86[_0xbb88('0x4c')]=_[_0xbb88('0x4a')](_0x268d86[_0xbb88('0x4c')],['id',_0xbb88('0x4d'),_0xbb88('0x4b')]);return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x139941){return db['UserProfile'][_0xbb88('0x47')](_[_0xbb88('0x3e')](_0x57465,_0x268d86['body']),{'include':_0x268d86['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x139941})[_0xbb88('0x26')](function(_0x42acfc){var _0xc52d4a=_0x42acfc[_0xbb88('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xbb88('0x43')]({'where':{'userProfileId':_0x268d86[_0xbb88('0x49')]['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x4ce63b){if(_0x4ce63b){return BPromise[_0xbb88('0x51')](_0x4ce63b,function(_0x595a3f){return new BPromise(function(_0x456f1b,_0x4af2ff){if(_0x595a3f[_0xbb88('0x52')]===null||_0x595a3f[_0xbb88('0x52')]===0x1)_0x456f1b(null);return db[_0xbb88('0x53')]['findAll']({'where':{'sectionId':_0x595a3f['id']},'raw':!![]})['then'](function(_0x223ff1){var _0x51ca41=_['map'](_0x223ff1,function(_0x3a95e1){return qs[_0xbb88('0x4a')](_0x3a95e1,['id',_0xbb88('0x4d'),_0xbb88('0x4b'),_0xbb88('0x54')]);});_0x456f1b(_0x51ca41);})['catch'](function(_0x1f61af){_0x4af2ff(_0x1f61af);});})[_0xbb88('0x26')](function(_0x249809){var _0x4f761f=qs[_0xbb88('0x4a')](_0x595a3f,['id',_0xbb88('0x4d'),_0xbb88('0x4b')]);_0x4f761f[_0xbb88('0x55')]=_0xc52d4a['id'];if(_0x249809)_0x4f761f[_0xbb88('0x56')]=_0x249809;return _0x4f761f;})[_0xbb88('0x26')](function(_0x2ef2be){return db[_0xbb88('0x57')][_0xbb88('0x47')](_0x2ef2be,{'include':[{'model':db[_0xbb88('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x139941});});})[_0xbb88('0x26')](function(){return _0xc52d4a;});}});});});}})[_0xbb88('0x26')](respondWithResult(_0x581774,0xc9))[_0xbb88('0x45')](handleError(_0x581774,null));};exports['update']=function(_0x2ca0d9,_0x5c2265){if(_0x2ca0d9[_0xbb88('0x4c')]['id']){delete _0x2ca0d9['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x2ca0d9[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x5c2265,null))[_0xbb88('0x26')](saveUpdates(_0x2ca0d9[_0xbb88('0x4c')],null))[_0xbb88('0x26')](respondWithResult(_0x5c2265,null))[_0xbb88('0x45')](handleError(_0x5c2265,null));};exports[_0xbb88('0x27')]=function(_0x2a3ae8,_0x5666ff){return db[_0xbb88('0x2c')]['find']({'where':{'id':_0x2a3ae8['params']['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x5666ff,null))[_0xbb88('0x26')](removeEntity(_0x5666ff,null))['catch'](handleError(_0x5666ff,null));};exports[_0xbb88('0x58')]=function(_0x535f89,_0x3c0060){return db[_0xbb88('0x2c')]['describe']()[_0xbb88('0x26')](respondWithResult(_0x3c0060,null))[_0xbb88('0x45')](handleError(_0x3c0060,null));};exports[_0xbb88('0x59')]=function(_0x45ee08,_0x2b3961){var _0x2cac46=_0x45ee08[_0xbb88('0x4c')];return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x45ee08['params']['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x2b3961,null))[_0xbb88('0x26')](function(_0x5d19ee){if(_0x5d19ee){return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x2d807f){return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x45ee08[_0xbb88('0x49')]['id'],'sectionId':_[_0xbb88('0x2b')](_0x2cac46,function(_0x3b401c){return _0x3b401c['sectionId'];})},'transaction':_0x2d807f})[_0xbb88('0x26')](function(){var _0x756b52=_[_0xbb88('0x2b')](_0x2cac46,function(_0x1ee0ac){_0x1ee0ac[_0xbb88('0x55')]=_0x45ee08[_0xbb88('0x49')]['id'];return _0x1ee0ac;});var _0x3996dd=[];return BPromise[_0xbb88('0x51')](_0x756b52,function(_0x16d9b4){return db[_0xbb88('0x57')][_0xbb88('0x47')](_0x16d9b4,{'include':[{'model':db[_0xbb88('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x2d807f})[_0xbb88('0x26')](function(_0x335069){_0x3996dd[_0xbb88('0x5b')](_0x335069[_0xbb88('0x50')]({'plain':!![]}));});})[_0xbb88('0x26')](function(){return _0x3996dd;});});});}})[_0xbb88('0x26')](function(_0x52cd0f){return _0x52cd0f;})[_0xbb88('0x26')](respondWithResult(_0x2b3961,null))[_0xbb88('0x45')](handleError(_0x2b3961,null));};exports['removeSections']=function(_0x193bad,_0x539129){var _0x4e3a68;return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x193bad[_0xbb88('0x49')]['id']},'attributes':['id',_0xbb88('0x30')]})[_0xbb88('0x26')](handleEntityNotFound(_0x539129,null))[_0xbb88('0x26')](function(_0x53b3c7){if(_0x53b3c7){_0x4e3a68=_0x53b3c7;return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x193bad[_0xbb88('0x49')]['id'],'sectionId':_0x193bad[_0xbb88('0x31')][_0xbb88('0x5c')]}});}})[_0xbb88('0x26')](function(){return _0x4e3a68;})[_0xbb88('0x26')](respondWithStatusCode(_0x539129,null))[_0xbb88('0x45')](handleError(_0x539129,null));};exports['getSections']=function(_0x13bfb9,_0x2cd5ce){var _0x3b5483=[];var _0x4111b7=[];return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x13bfb9[_0xbb88('0x49')]['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x308133){_0x3b5483=_['filter'](_0x308133,function(_0x3e6fb1){return _0x3e6fb1[_0xbb88('0x5d')]===0x1||_[_0xbb88('0x5e')]([0x3eb,0x709],_0x3e6fb1[_0xbb88('0x54')]);});if(!_[_0xbb88('0x5f')](_0x3b5483)){return _[_0xbb88('0x2b')](_0x3b5483,function(_0xfd5b1c){return _0xfd5b1c[_0xbb88('0x54')];});}else{return;}})[_0xbb88('0x26')](function(_0x4465a4){if(_0x4465a4)_0x4111b7=_0x4465a4;if(_[_0xbb88('0x5e')](_0x4111b7,0x64)){var _0x2327e4=_['find'](_0x3b5483,{'sectionId':0x64});return hasDefaultDashboard(_0x2327e4)[_0xbb88('0x26')](function(_0x3401d2){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x2624aa){if(_0x2624aa[_0xbb88('0x54')]===0x64){_0x2624aa[_0xbb88('0x60')]=_0x3401d2;}return _0x2624aa;});});}else{return;}})[_0xbb88('0x26')](function(_0x330f91){if(_0x330f91)_0x3b5483=_0x330f91;if(_['includes'](_0x4111b7,0x3eb)){var _0x3413ea=_[_0xbb88('0x5a')](_0x3b5483,{'sectionId':0x3eb});return getCustomDashboards(_0x3413ea)[_0xbb88('0x26')](function(_0x9a5c30){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x3b36ec){if(_0x3413ea[_0xbb88('0x5d')]){if(_0x3b36ec[_0xbb88('0x54')]===0x3eb){_0x3b36ec['subsections']=_0x9a5c30;}}else{if(_0x3b36ec[_0xbb88('0x54')]===0x64){if(!_0x3b36ec[_0xbb88('0x60')]){_0x3b36ec[_0xbb88('0x60')]=[];}_0x3b36ec[_0xbb88('0x60')]=_0x3b36ec[_0xbb88('0x60')][_0xbb88('0x61')](_0x9a5c30);}}return _0x3b36ec;});});}else{return;}})[_0xbb88('0x26')](function(_0x3974ca){if(_0x3974ca)_0x3b5483=_0x3974ca;if(_[_0xbb88('0x5e')](_0x4111b7,0x709)){var _0x118557=_[_0xbb88('0x5a')](_0x3b5483,{'sectionId':0x709});return getPlugins(_0x118557)['then'](function(_0x43be2c){if(_0x118557[_0xbb88('0x5d')]){return _[_0xbb88('0x2b')](_0x3b5483,function(_0x4179bc){if(_0x4179bc[_0xbb88('0x54')]===0x709){_0x4179bc[_0xbb88('0x60')]=_0x43be2c;}return _0x4179bc;});}else{var _0x53c0a2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x43be2c};var _0x41d4c2=_[_0xbb88('0x2b')](_0x3b5483);_0x41d4c2[_0xbb88('0x5b')](_0x53c0a2);return _0x41d4c2;}});}else{return;}})[_0xbb88('0x26')](function(_0x1068ad){if(_0x1068ad)_0x3b5483=_0x1068ad;return _['filter'](_0x3b5483,[_0xbb88('0x5d'),0x1]);})[_0xbb88('0x26')](respondWithResult(_0x2cd5ce,null))[_0xbb88('0x45')](handleError(_0x2cd5ce,null));};function hasDefaultDashboard(_0x353baa){var _0x1aad1f=[0x65];return new BPromise(function(_0x2f7e4f,_0x28877c){try{if(_0x353baa[_0xbb88('0x52')]){_0x2f7e4f(_0x1aad1f);}else{return db[_0xbb88('0x53')][_0xbb88('0x62')]({'where':{'sectionId':_0x353baa['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x24976f){_0x24976f?_0x2f7e4f(_0x1aad1f):_0x2f7e4f();});}}catch(_0x5e3c24){_0x28877c(_0x5e3c24);}});}function getCustomDashboards(_0x440abc){var _0x1a8628=[];return new BPromise(function(_0x122bec,_0x41958a){try{if(_0x440abc[_0xbb88('0x52')]){return db[_0xbb88('0x63')][_0xbb88('0x43')]({'raw':!![]})['then'](function(_0x4b3aa9){_0x4b3aa9['forEach'](function(_0x1d277d){_0x1a8628[_0xbb88('0x5b')](_0x1d277d['id']+0x1869f);});_0x122bec(_0x1a8628);});}else{return db[_0xbb88('0x53')][_0xbb88('0x43')]({'where':{'sectionId':_0x440abc['id']},'raw':!![]})[_0xbb88('0x26')](function(_0x3e256b){_0x3e256b[_0xbb88('0x64')](function(_0x1c860e){_0x1a8628[_0xbb88('0x5b')](_0x1c860e[_0xbb88('0x65')]+0x1869f);});_0x122bec(_0x1a8628);});}}catch(_0x593466){_0x41958a(_0x593466);}});}function getPlugins(_0x5f1e84){var _0x4e1b96=[];return new BPromise(function(_0x3582ce,_0x598c93){try{if(_0x5f1e84['autoAssociation']){return db[_0xbb88('0x66')]['findAll']({'raw':!![]})[_0xbb88('0x26')](function(_0x2dffa7){_0x2dffa7[_0xbb88('0x64')](function(_0x49d84a){_0x4e1b96['push'](_0x49d84a['id']+0x15b38);});_0x3582ce(_0x4e1b96);});}else{return db[_0xbb88('0x53')][_0xbb88('0x43')]({'where':{'sectionId':_0x5f1e84['id']},'raw':!![]})['then'](function(_0x308a00){_0x308a00['forEach'](function(_0x5b328e){_0x4e1b96[_0xbb88('0x5b')](_0x5b328e[_0xbb88('0x65')]+0x15b38);});_0x3582ce(_0x4e1b96);});}}catch(_0xb90634){_0x598c93(_0xb90634);}});}exports[_0xbb88('0x67')]=function(_0x6acd5f,_0x188531){return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0x6acd5f[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x188531,null))['then'](function(_0x42ef89){if(_0x42ef89){return db[_0xbb88('0x4e')][_0xbb88('0x4f')](function(_0x3d637d){return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xbb88('0x26')](function(_0x367d6d){if(_0x367d6d){return db['UserProfileSection'][_0xbb88('0x27')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id'],'id':_[_0xbb88('0x2b')](_0x367d6d,function(_0x2928e5){return _0x2928e5['id'];})},'transaction':_0x3d637d});}})['then'](function(_0x234cd5){var _0x44ecfa=_[_0xbb88('0x2b')](_0x6acd5f[_0xbb88('0x4c')],function(_0x3574c8){_0x3574c8[_0xbb88('0x55')]=_0x6acd5f[_0xbb88('0x49')]['id'];return _0x3574c8;});return db[_0xbb88('0x57')][_0xbb88('0x68')](_0x44ecfa,{'raw':!![],'transaction':_0x3d637d});})[_0xbb88('0x26')](function(_0x245264){var _0x4ec11d=_[_0xbb88('0x69')](_['map'](_0x245264,function(_0x2729e5){return _0x2729e5[_0xbb88('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x4ec11d){return db[_0xbb88('0x57')][_0xbb88('0x43')]({'where':{'userProfileId':_0x6acd5f[_0xbb88('0x49')]['id'],'sectionId':_[_0xbb88('0x2b')](_0x4ec11d,function(_0x326b4b){return _0x326b4b[_0xbb88('0x54')];})},'attributes':['id',_0xbb88('0x54')],'raw':!![]})[_0xbb88('0x26')](function(_0x463bc9){var _0x2e05e3=_[_0xbb88('0x2b')](_0x6acd5f[_0xbb88('0x4c')],function(_0x3a9443){_0x3a9443[_0xbb88('0x55')]=_0x6acd5f[_0xbb88('0x49')]['id'];return _0x3a9443;});return db[_0xbb88('0x53')][_0xbb88('0x68')](_0x2e05e3,{'raw':!![],'transaction':_0x3d637d});});}})['catch'](handleError(_0x188531,null));});}})[_0xbb88('0x26')](function(_0x36032){var _0x44ce52=_['map'](_0x36032,function(_0x5ad215){return _0x5ad215['get']({'plain':!![]});});})[_0xbb88('0x26')](respondWithResult(_0x188531,null))[_0xbb88('0x45')](handleError(_0x188531,null));};exports[_0xbb88('0x6a')]=function(_0xecfd43,_0x9e5583,_0x7c85dc){return db[_0xbb88('0x2c')][_0xbb88('0x5a')]({'where':{'id':_0xecfd43[_0xbb88('0x49')]['id']}})[_0xbb88('0x26')](handleEntityNotFound(_0x9e5583,null))[_0xbb88('0x26')](function(_0x102d4b){if(_0x102d4b){return _0x102d4b[_0xbb88('0x6a')](_0xecfd43[_0xbb88('0x31')][_0xbb88('0x5c')]);}})['then'](respondWithStatusCode(_0x9e5583,null))[_0xbb88('0x45')](handleError(_0x9e5583,null));};exports[_0xbb88('0x6b')]=function(_0x4ddc9f,_0x4b58f2){var _0x40da35={};if(!_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x6c')])throw new Error(_0xbb88('0x6d'));if(!_0x4ddc9f[_0xbb88('0x31')]['hasOwnProperty']('nolimit')){_0x40da35[_0xbb88('0x20')]=qs[_0xbb88('0x20')](_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x20')]);_0x40da35[_0xbb88('0x1e')]=qs[_0xbb88('0x1e')](_0x4ddc9f[_0xbb88('0x31')][_0xbb88('0x1e')]);}return db['UserProfile'][_0xbb88('0x5a')]({'where':{'id':_0x4ddc9f[_0xbb88('0x49')]['id']}})['then'](function(_0x3cf73c){if(!_0x3cf73c)throw new Error(_0xbb88('0x6e')+_0x4ddc9f[_0xbb88('0x49')]['id']);return db[_0xbb88('0x2c')][_0xbb88('0x6b')](_0x4ddc9f);})[_0xbb88('0x26')](respondWithFilteredResult(_0x4b58f2,_0x40da35))['catch'](handleError(_0x4b58f2,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 911be33..af5d957 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 _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0xadb920,_0xf8d5cc){var _0x2c47f6=function(_0x37767a){while(--_0x37767a){_0xadb920['push'](_0xadb920['shift']());}};_0x2c47f6(++_0xf8d5cc);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x50e410,_0x36bb68){_0x50e410=_0x50e410-0x0;var _0x3eb22c=_0x8ace[_0x50e410];return _0x3eb22c;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var UserProfile=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){UserProfileEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);UserProfileEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x539d=['hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','remove','emit'];(function(_0x24164d,_0x12e3f2){var _0x4e0441=function(_0x3241ad){while(--_0x3241ad){_0x24164d['push'](_0x24164d['shift']());}};_0x4e0441(++_0x12e3f2);}(_0x539d,0x17b));var _0xd539=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x539d[_0x144b30];return _0x1bb7bc;};'use strict';var EventEmitter=require(_0xd539('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xd539('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd539('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd539('0x3')};function emitEvent(_0x2a38d5){return function(_0xe8e6e4,_0x19ae25,_0x2f9d1f){UserProfileEvents['emit'](_0x2a38d5+':'+_0xe8e6e4['id'],_0xe8e6e4);UserProfileEvents[_0xd539('0x4')](_0x2a38d5,_0xe8e6e4);_0x2f9d1f(null);};}for(var e in events){if(events[_0xd539('0x5')](e)){var event=events[e];UserProfile[_0xd539('0x6')](e,emitEvent(event));}}module[_0xd539('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 89818d9..7f20703 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 _0xa4ef=['fax','mail','openchannel','whatsapp','lodash','squel','exports','models','filter','field','value','then','catch','model','findAll','associatedResources','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projects','JscriptyProject','Lists','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','parentSections','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Sound','tags','templates','Template','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','union','find','rawAttributes','keys','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','pick','filters','key','foreignKey','forEach','merge','options','autoAssociation','include','DefaultReports','custom','reportId','CustomReports','count','rows','ids','intersection','customSorting','order','extraQueryConditions','includeAll','CmContact','Tag','color','tag','ThroughTags','chat','dataValues','sms'];(function(_0x4791f2,_0x453964){var _0x221c59=function(_0x55f550){while(--_0x55f550){_0x4791f2['push'](_0x4791f2['shift']());}};_0x221c59(++_0x453964);}(_0xa4ef,0x182));var _0xfa4e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa4ef[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfa4e('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xfa4e('0x1'));module[_0xfa4e('0x2')]=function(_0x275a7a){var _0x29f36e=_0x275a7a[_0xfa4e('0x3')];function _0x22e7ff(_0x3caf0e,_0x1bbd44){return new Promise(function(_0x2ffc75,_0x532e3d){if(!_0x1bbd44)return _0x2ffc75(null);var _0x37b5c1=_0x1bbd44[_0xfa4e('0x4')]?{[_0x1bbd44['filter'][_0xfa4e('0x5')]]:_0x1bbd44['filter'][_0xfa4e('0x6')]}:undefined;return _0x29f36e[_0x3caf0e]['findAll']({'where':_0x37b5c1,'raw':!![]})[_0xfa4e('0x7')](function(_0x1de8b0){_0x1bbd44['associatedResources']=_['map'](_0x1de8b0,'id');_0x2ffc75(_0x1bbd44);})[_0xfa4e('0x8')](function(_0x22ff5b){_0x532e3d(_0x22ff5b);});});}function _0x2a546f(_0x43b6e0,_0x49771a){return new Promise(function(_0x454c87,_0x1879be){var _0xe4f6d0=_0x43b6e0[_0xfa4e('0x4')]?{[_0x43b6e0[_0xfa4e('0x4')]['field']]:_0x43b6e0[_0xfa4e('0x4')][_0xfa4e('0x6')]}:undefined;return _0x29f36e[_0x43b6e0[_0xfa4e('0x9')]][_0xfa4e('0xa')]({'where':_0xe4f6d0,'raw':!![]})[_0xfa4e('0x7')](function(_0x4a6a08){_0x49771a[_0xfa4e('0xb')]=_[_0xfa4e('0xc')](_0x4a6a08,function(_0x3d7aef){return _0x3d7aef[_0xfa4e('0xd')];});_0x454c87(_0x49771a);})[_0xfa4e('0x8')](function(_0x4e4de2){_0x1879be(_0x4e4de2);});});}function _0x536884(_0x3cc96b,_0x47a19c,_0x516182){if(!_0x47a19c)return Promise[_0xfa4e('0xe')](null);return new Promise(function(_0x1f44de,_0x4f72e4){return _0x29f36e[_0xfa4e('0xf')][_0xfa4e('0xa')]({'where':{'sectionId':_0x47a19c['id']},'raw':!![]})[_0xfa4e('0x7')](function(_0x29fd39){if(_0x3cc96b['field']&&_0x3cc96b['field']!=='id'){_0x47a19c[_0xfa4e('0xb')]=_['map'](_0x29fd39,function(_0x66d076){return _0x66d076[_0x3cc96b[_0xfa4e('0x5')]];});}else{if(_0x516182===_0xfa4e('0x10')){_0x47a19c[_0xfa4e('0xb')]=_[_0xfa4e('0xc')](_0x29fd39,function(_0x77dbd0){return{'id':_0x77dbd0[_0xfa4e('0x11')],'type':_0x77dbd0['type']};});}else{_0x47a19c[_0xfa4e('0xb')]=_[_0xfa4e('0xc')](_0x29fd39,function(_0x55e4ca){return _0x55e4ca['resourceId'];});}}_0x1f44de(_0x47a19c);})[_0xfa4e('0x8')](function(_0x5533cc){_0x4f72e4(_0x5533cc);});});}function _0xabd320(_0x259748,_0x4f02df){var _0x1a7953={'parentSections':[]};switch(_0x259748[_0xfa4e('0x12')]()){case _0xfa4e('0x13'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x15');break;case'odbc':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x16');break;case _0xfa4e('0x17'):_0x1a7953['childModel']=_0xfa4e('0x18');_0x1a7953['parentSections']=[{'name':'SquareProjects','field':_0xfa4e('0xd'),'foreignKey':'projectName'}];break;case _0xfa4e('0x19'):_0x1a7953['childModel']=_0xfa4e('0x1a');break;case'contacts':_0x1a7953[_0xfa4e('0x14')]='CmContact';_0x1a7953['parentSections']=[{'name':_0xfa4e('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0xfa4e('0x1c'):_0x1a7953[_0xfa4e('0x14')]='CmList';break;case _0xfa4e('0x1d'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x1e');break;case _0xfa4e('0x1f'):_0x1a7953['childModel']='CmCustomField';break;case _0xfa4e('0x20'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x21');break;case _0xfa4e('0x22'):_0x1a7953['childModel']=_0xfa4e('0x23');break;case _0xfa4e('0x24'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x25');break;case'faxaccounts':_0x1a7953['childModel']=_0xfa4e('0x26');break;case _0xfa4e('0x27'):case _0xfa4e('0x28'):case _0xfa4e('0x29'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x2a');break;case'contexts':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x2b');break;case _0xfa4e('0x2c'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x2d');break;case _0xfa4e('0x2e'):_0x1a7953[_0xfa4e('0x14')]='VoiceRecording';_0x1a7953['parentSections']=[{'name':_0xfa4e('0x2f'),'field':'name','foreignKey':_0xfa4e('0x30'),'model':_0xfa4e('0x31'),'filter':{'field':'role','value':[_0xfa4e('0x32')]}},{'name':_0xfa4e('0x33'),'field':_0xfa4e('0xd'),'foreignKey':_0xfa4e('0x30'),'model':'User','filter':{'field':_0xfa4e('0x34'),'value':['telephone']}},{'name':_0xfa4e('0x35'),'field':_0xfa4e('0xd'),'foreignKey':_0xfa4e('0x36'),'model':_0xfa4e('0x37'),'filter':{'field':_0xfa4e('0x38'),'value':[_0xfa4e('0x39')]}},{'name':_0xfa4e('0x3a'),'field':'name','foreignKey':_0xfa4e('0x36'),'model':_0xfa4e('0x37'),'filter':{'field':_0xfa4e('0x38'),'value':['outbound']}}];break;case _0xfa4e('0x3b'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x3c');break;case'chanspies':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x3d');break;case _0xfa4e('0x3e'):_0x1a7953[_0xfa4e('0x14')]='VoicePrefix';break;case _0xfa4e('0x3f'):_0x1a7953[_0xfa4e('0x14')]='Campaign';break;case _0xfa4e('0x40'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x41');break;case'mailaccounts':_0x1a7953['childModel']=_0xfa4e('0x42');break;case _0xfa4e('0x43'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x44');break;case _0xfa4e('0x45'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x46');break;case _0xfa4e('0x47'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x48');break;case'smsqueues':_0x1a7953['childModel']=_0xfa4e('0x49');break;case'smsaccounts':_0x1a7953[_0xfa4e('0x14')]='SmsAccount';break;case _0xfa4e('0x4a'):_0x1a7953[_0xfa4e('0x14')]='WhatsappQueue';break;case _0xfa4e('0x4b'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x4c');break;case _0xfa4e('0x4d'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x4e');break;case _0xfa4e('0x4f'):case _0xfa4e('0x50'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x37');if(_0x4f02df){_0x1a7953[_0xfa4e('0x51')]=[{'name':_0xfa4e('0x35')},{'name':_0xfa4e('0x3a')}];}break;case _0xfa4e('0x52'):case _0xfa4e('0x53'):case'telephones':_0x1a7953['childModel']=_0xfa4e('0x31');if(_0x4f02df){_0x1a7953['parentSections']=[{'name':_0xfa4e('0x54'),'filter':{'field':_0xfa4e('0x34'),'value':[_0xfa4e('0x55'),_0xfa4e('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0xfa4e('0x33')}];}break;case _0xfa4e('0x57'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x58');break;case _0xfa4e('0x59'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x5a');break;case'freshdeskaccounts':_0x1a7953[_0xfa4e('0x14')]='FreshdeskAccount';break;case _0xfa4e('0x5b'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x5c');break;case _0xfa4e('0x5d'):_0x1a7953[_0xfa4e('0x14')]='DeskAccount';break;case'zohoaccounts':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x5e');break;case _0xfa4e('0x5f'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x31');break;case _0xfa4e('0x60'):_0x1a7953['childModel']=_0xfa4e('0x61');break;case _0xfa4e('0x62'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x63');break;case _0xfa4e('0x64'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x65');break;case _0xfa4e('0x66'):_0x1a7953['childModel']=_0xfa4e('0x67');break;case _0xfa4e('0x68'):_0x1a7953[_0xfa4e('0x14')]='Pause';break;case _0xfa4e('0x69'):_0x1a7953[_0xfa4e('0x14')]='Schedule';break;case'sounds':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x6a');break;case _0xfa4e('0x6b'):_0x1a7953[_0xfa4e('0x14')]='Tag';break;case _0xfa4e('0x6c'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x6d');break;case'triggers':_0x1a7953[_0xfa4e('0x14')]='Trigger';break;case _0xfa4e('0x6e'):_0x1a7953[_0xfa4e('0x14')]='Trunk';break;case _0xfa4e('0x6f'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x70');break;case _0xfa4e('0x71'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x72');break;case _0xfa4e('0x73'):_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x10');_0x1a7953['parentSections']=[{'name':_0xfa4e('0x74'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1a7953[_0xfa4e('0x14')]=_0xfa4e('0x75');break;}return _0x1a7953;}function _0x310b34(_0x10f92d,_0x161708){var _0xcc83fe=_0x10f92d['charAt'](0x0)[_0xfa4e('0x76')]()+_0x10f92d[_0xfa4e('0x77')](0x1);var _0x53a23a={'type':_0x29f36e[_0xfa4e('0x78')]['QueryTypes'][_0xfa4e('0x79')],'raw':!![]};return new Promise(function(_0x31e9ec,_0x2ef8fd){var _0x3a4cad=squel[_0xfa4e('0x7a')]()[_0xfa4e('0x5')](_0xfa4e('0x7b')+_0xcc83fe+_0xfa4e('0x7c'),'id')[_0xfa4e('0x5')](_0xfa4e('0x7d'))[_0xfa4e('0x7e')](_0xfa4e('0x7f')+_0x10f92d+'_interactions','ui')[_0xfa4e('0x80')]('ui.UserId\x20=\x20?',_0x161708['id']);return _0x29f36e[_0xfa4e('0x81')][_0xfa4e('0x82')](_0x3a4cad[_0xfa4e('0x83')](),_0x53a23a)[_0xfa4e('0x7')](function(_0x2dbf17){_0x161708[_0xcc83fe+_0xfa4e('0x84')]=_0x2dbf17;_0x31e9ec(_0x2dbf17);})['catch'](function(_0x4b45c7){_0x2ef8fd(_0x4b45c7);});});}return _0x275a7a[_0xfa4e('0x85')](_0xfa4e('0x86'),attributes,{'tableName':_0xfa4e('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1fa3fe){var _0x20c23e=require('../../components/parsers/qs');var _0x52591={'raw':_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x88')],'where':{}};var _0xc064bb={};var _0x264815={'count':0x0,'rows':[]};var _0x5187c0=_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x89')];var _0xaf4191=_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x8a')]||![];var _0x3031f3=_0xabd320(_0x5187c0,_0xaf4191);if(!_0x3031f3[_0xfa4e('0x14')])throw new Error(_0xfa4e('0x8b')+_0x5187c0+'\x27');var _0x2f29a7=[{'name':_0x5187c0}];if(!_[_0xfa4e('0x8c')](_0x3031f3['parentSections']))_0x2f29a7=_0x3031f3[_0xfa4e('0x51')];var _0x409a42=[];for(var _0x176660=0x0;_0x176660<_0x2f29a7[_0xfa4e('0x8d')];_0x176660++){_0x409a42[_0xfa4e('0x8e')](_0x29f36e[_0xfa4e('0x8f')]['find']({'where':{'userProfileId':_0x1fa3fe[_0xfa4e('0x90')]['id'],'name':_0x2f29a7[_0x176660][_0xfa4e('0xd')]},'raw':!![]}));}return Promise[_0xfa4e('0x91')](_0x409a42)[_0xfa4e('0x7')](function(_0x2cbade){var _0x2d6c1f=_[_0xfa4e('0x4')](_0x2cbade,function(_0x38b8fa){return _0x38b8fa?_0x38b8fa:undefined;});var _0x2025ea=_[_0xfa4e('0x4')](_0x2f29a7,[_0xfa4e('0x92'),!![]]);var _0x4331a8=_[_0xfa4e('0x8c')](_0x2d6c1f)&&_['isEmpty'](_0x2025ea)?null:_[_0xfa4e('0x93')](_0x2025ea,_0x2d6c1f);if(!_0x4331a8)return null;var _0x28f497=[];for(var _0x44c785=0x0;_0x44c785<_0x4331a8[_0xfa4e('0x8d')];_0x44c785++){var _0x414af5=_[_0xfa4e('0x94')](_0x2f29a7,function(_0x335e11){return _0x4331a8[_0x44c785]?_0x335e11[_0xfa4e('0xd')]===_0x4331a8[_0x44c785]['name']:null;});if(_0x414af5){if(_0x4331a8[_0x44c785][_0xfa4e('0x92')]){_0x28f497[_0xfa4e('0x8e')](_0x22e7ff(_0x3031f3[_0xfa4e('0x14')],_0x4331a8[_0x44c785]));}else{if(!_0x4331a8[_0x44c785]['autoAssociation']){_0x28f497[_0xfa4e('0x8e')](_0x536884(_0x414af5,_0x4331a8[_0x44c785],_0x3031f3[_0xfa4e('0x14')]));}else{if(_0x414af5[_0xfa4e('0x9')]){_0x28f497[_0xfa4e('0x8e')](_0x2a546f(_0x414af5,_0x4331a8[_0x44c785]));}}}}}return Promise['all'](_0x28f497);})[_0xfa4e('0x7')](function(_0x32019b){var _0x23fbca=_0x32019b;var _0x1a0cbb=null;if(_0x23fbca){_0x1a0cbb=_0x23fbca['length']===0x1?_0x23fbca[0x0]:null;}if(!_0x1a0cbb&&!_0x23fbca)return _0x264815;var _0x88bda6=_0x29f36e[_0x3031f3['childModel']][_0xfa4e('0x95')];_0xc064bb[_0xfa4e('0x9')]=_[_0xfa4e('0x96')](_0x88bda6);_0xc064bb[_0xfa4e('0x82')]=_['keys'](_0x1fa3fe[_0xfa4e('0x82')]);_0xc064bb['filters']=_['intersection'](_0xc064bb['model'],_0xc064bb[_0xfa4e('0x82')]);_0x52591['attributes']=_['intersection'](_0xc064bb[_0xfa4e('0x9')],_0x20c23e[_0xfa4e('0x97')](_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x97')]));_0x52591[_0xfa4e('0x98')]=_0x52591['attributes']['length']?_0x52591[_0xfa4e('0x98')]:_0xc064bb[_0xfa4e('0x9')];if(!_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x99')](_0xfa4e('0x9a'))){_0x52591[_0xfa4e('0x9b')]=_0x20c23e[_0xfa4e('0x9b')](_0x1fa3fe['query']['limit']);_0x52591[_0xfa4e('0x9c')]=_0x20c23e[_0xfa4e('0x9c')](_0x1fa3fe[_0xfa4e('0x82')]['offset']);}_0x52591['order']=_0x20c23e['sort'](_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0x9d')]);_0x52591[_0xfa4e('0x80')]=_0x20c23e['filters'](_[_0xfa4e('0x9e')](_0x1fa3fe[_0xfa4e('0x82')],_0xc064bb[_0xfa4e('0x9f')]));if(_0x1fa3fe[_0xfa4e('0x82')]['filter']){_0x52591[_0xfa4e('0x80')]=_['merge'](_0x52591[_0xfa4e('0x80')],{'$or':_[_0xfa4e('0xc')](_0x88bda6,function(_0x5af810){if(_0x5af810[_0xfa4e('0x38')][_0xfa4e('0xa0')]!=='VIRTUAL'){var _0x3a83f9={};_0x3a83f9[_0x5af810['field']]={'$like':'%'+_0x1fa3fe['query']['filter']+'%'};return _0x3a83f9;}})});}var _0x2d7911=[];var _0x20501d=null;var _0x5308ef={};if(_0x1a0cbb){_0x20501d=_['find'](_0x2f29a7,[_0xfa4e('0xd'),_0x1a0cbb[_0xfa4e('0xd')]]);if(_0x20501d[_0xfa4e('0x5')]){_0x5308ef={};if(_0x3031f3[_0xfa4e('0x14')]===_0xfa4e('0x10')){_0x5308ef[_0x20501d[_0xfa4e('0xa1')]]=_['map'](_0x1a0cbb[_0xfa4e('0xb')],'id');}else{_0x5308ef[_0x20501d[_0xfa4e('0xa1')]]=_0x1a0cbb['associatedResources'];}_0x2d7911[_0xfa4e('0x8e')](_0x5308ef);}else{_0x52591[_0xfa4e('0x80')]['id']=_0x1a0cbb[_0xfa4e('0xb')];}}else{for(var _0x480428=0x0;_0x480428<_0x23fbca['length'];_0x480428++){_0x20501d=_[_0xfa4e('0x94')](_0x2f29a7,[_0xfa4e('0xd'),_0x23fbca[_0x480428][_0xfa4e('0xd')]]);if(_0x20501d[_0xfa4e('0x5')]){_0x5308ef={};_0x5308ef[_0x20501d[_0xfa4e('0xa1')]]=_0x23fbca[_0x480428][_0xfa4e('0xb')];_0x2d7911['push'](_0x5308ef);}else{if(!_0x52591[_0xfa4e('0x80')]['id'])_0x52591[_0xfa4e('0x80')]['id']=[];_0x23fbca[_0x480428]['associatedResources'][_0xfa4e('0xa2')](function(_0x19f658){_0x52591[_0xfa4e('0x80')]['id'][_0xfa4e('0x8e')](_0x19f658);});}}}if(!_[_0xfa4e('0x8c')](_0x2d7911)){_0x52591[_0xfa4e('0x80')]=_[_0xfa4e('0xa3')](_0x52591[_0xfa4e('0x80')],{'$and':{'$or':_0x2d7911}});}_0x52591=_[_0xfa4e('0xa3')]({},_0x52591,_0x1fa3fe[_0xfa4e('0xa4')]);if(_0x1a0cbb&&!_0x1a0cbb[_0xfa4e('0xa5')]&&_0x3031f3[_0xfa4e('0x14')]===_0xfa4e('0x10')){if(_0x1fa3fe[_0xfa4e('0x82')]['includeAll']){_0x52591[_0xfa4e('0xa6')]=[{'all':!![]}];}return _0x29f36e[_0x3031f3['childModel']][_0xfa4e('0xa')](_0x52591)[_0xfa4e('0x7')](function(_0x4a6078){var _0x23b87f=[];_0x4a6078['forEach'](function(_0x2cebaa){var _0x3ab990;switch(_0x2cebaa['reportType']){case'default':_0x3ab990=_[_0xfa4e('0x94')](_0x1a0cbb[_0xfa4e('0xb')],function(_0x3d0aee){return _0x3d0aee['id']===_0x2cebaa['reportId']&&_0x3d0aee[_0xfa4e('0x38')]===_0xfa4e('0xa7');});break;case _0xfa4e('0xa8'):_0x3ab990=_[_0xfa4e('0x94')](_0x1a0cbb[_0xfa4e('0xb')],function(_0x558de7){return _0x558de7['id']===_0x2cebaa[_0xfa4e('0xa9')]&&_0x558de7[_0xfa4e('0x38')]===_0xfa4e('0xaa');});break;}if(_0x3ab990)_0x23b87f[_0xfa4e('0x8e')](_0x2cebaa);});_0x264815[_0xfa4e('0xab')]=_0x23b87f[_0xfa4e('0x8d')];_0x264815[_0xfa4e('0xac')]=_0x23b87f;return _0x264815;});}else{if(!_['isEmpty'](_0x1fa3fe['query'][_0xfa4e('0xad')])){_0x52591[_0xfa4e('0x80')]['id']=_0x52591['where']['id']?_[_0xfa4e('0xae')](_0x52591[_0xfa4e('0x80')]['id'],_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xad')]):_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xad')];if(_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xaf')]){_0x52591[_0xfa4e('0xb0')]=_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xaf')];}}if(_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xb1')]){_0x52591['where']=_[_0xfa4e('0xa3')](_0x52591[_0xfa4e('0x80')],{'$and':_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xb1')]});}return _0x29f36e[_0x3031f3['childModel']][_0xfa4e('0xab')]({'where':_0x52591[_0xfa4e('0x80')]})[_0xfa4e('0x7')](function(_0x113a96){_0x264815[_0xfa4e('0xab')]=_0x113a96;if(_0x1fa3fe[_0xfa4e('0x82')][_0xfa4e('0xb2')]){if(_0x3031f3[_0xfa4e('0x14')]===_0xfa4e('0xb3')){_0x52591[_0xfa4e('0xa6')]=[{'model':_0x29f36e[_0xfa4e('0xb4')],'as':'Tags','attributes':['id',_0xfa4e('0xd'),_0xfa4e('0xb5')],'required':_0x1fa3fe['query'][_0xfa4e('0xb6')]?!![]:![]},{'model':_0x29f36e['Tag'],'as':_0xfa4e('0xb7'),'attributes':['id',_0xfa4e('0xd'),'color'],'through':_0x1fa3fe[_0xfa4e('0x82')]['tag']?{'attributes':[],'where':{'TagId':_0x1fa3fe['query']['tag']||undefined}}:{},'required':_0x1fa3fe[_0xfa4e('0x82')]['tag']?!![]:![]}];}else{_0x52591[_0xfa4e('0xa6')]=[{'all':!![]}];}}return _0x29f36e[_0x3031f3[_0xfa4e('0x14')]][_0xfa4e('0xa')](_0x52591);})[_0xfa4e('0x7')](function(_0x59ac0f){_0x264815['rows']=_0x59ac0f;if(_0x5187c0===_0xfa4e('0x2f')&&_0x1fa3fe['query']['openTabs']==='true'){var _0xbf267=[];for(var _0x18be95=0x0;_0x18be95<_0x264815[_0xfa4e('0xac')][_0xfa4e('0x8d')];_0x18be95++){_0xbf267[_0xfa4e('0x8e')](_0x310b34(_0xfa4e('0xb8'),_0x264815[_0xfa4e('0xac')][_0x18be95][_0xfa4e('0xb9')]));_0xbf267[_0xfa4e('0x8e')](_0x310b34(_0xfa4e('0xba'),_0x264815[_0xfa4e('0xac')][_0x18be95]['dataValues']));_0xbf267['push'](_0x310b34(_0xfa4e('0xbb'),_0x264815['rows'][_0x18be95]['dataValues']));_0xbf267['push'](_0x310b34(_0xfa4e('0xbc'),_0x264815['rows'][_0x18be95]['dataValues']));_0xbf267[_0xfa4e('0x8e')](_0x310b34(_0xfa4e('0xbd'),_0x264815[_0xfa4e('0xac')][_0x18be95][_0xfa4e('0xb9')]));_0xbf267[_0xfa4e('0x8e')](_0x310b34(_0xfa4e('0xbe'),_0x264815[_0xfa4e('0xac')][_0x18be95][_0xfa4e('0xb9')]));}return Promise[_0xfa4e('0x91')](_0xbf267)['then'](function(){return _0x264815;});}return _0x264815;});}});}}});}; \ No newline at end of file +var _0xf435=['SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','telephones','Users','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','SELECT','select','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','AnalyticExtractedReport','include','forEach','reportType','default','DefaultReports','custom','count','ids','customSorting','extraQueryConditions','includeAll','Tag','ThroughTags','color','tag','chat','rows','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','UserProfileResource','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts'];(function(_0x5dc234,_0x8bfeef){var _0x4e4b39=function(_0x2a671f){while(--_0x2a671f){_0x5dc234['push'](_0x5dc234['shift']());}};_0x4e4b39(++_0x8bfeef);}(_0xf435,0x136));var _0x5f43=function(_0x56c864,_0x7b8e4){_0x56c864=_0x56c864-0x0;var _0x2b5df4=_0xf435[_0x56c864];return _0x2b5df4;};'use strict';var _=require(_0x5f43('0x0'));var attributes=require(_0x5f43('0x1'));var squel=require(_0x5f43('0x2'));module[_0x5f43('0x3')]=function(_0x24a542){var _0x5354d1=_0x24a542['models'];function _0xe85167(_0x2ce0f2,_0x4edb78){return new Promise(function(_0x5b5279,_0x556618){if(!_0x4edb78)return _0x5b5279(null);var _0x12b68f=_0x4edb78[_0x5f43('0x4')]?{[_0x4edb78[_0x5f43('0x4')][_0x5f43('0x5')]]:_0x4edb78[_0x5f43('0x4')][_0x5f43('0x6')]}:undefined;return _0x5354d1[_0x2ce0f2][_0x5f43('0x7')]({'where':_0x12b68f,'raw':!![]})[_0x5f43('0x8')](function(_0x1a3f0c){_0x4edb78[_0x5f43('0x9')]=_['map'](_0x1a3f0c,'id');_0x5b5279(_0x4edb78);})[_0x5f43('0xa')](function(_0x113142){_0x556618(_0x113142);});});}function _0xa27ec4(_0xc41ab2,_0x11bd76){return new Promise(function(_0x41fb35,_0x3b55ea){var _0x2f8745=_0xc41ab2[_0x5f43('0x4')]?{[_0xc41ab2[_0x5f43('0x4')][_0x5f43('0x5')]]:_0xc41ab2[_0x5f43('0x4')][_0x5f43('0x6')]}:undefined;return _0x5354d1[_0xc41ab2[_0x5f43('0xb')]][_0x5f43('0x7')]({'where':_0x2f8745,'raw':!![]})[_0x5f43('0x8')](function(_0x4abff5){_0x11bd76[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x4abff5,function(_0x5c0ecc){return _0x5c0ecc[_0x5f43('0xd')];});_0x41fb35(_0x11bd76);})['catch'](function(_0x405d0b){_0x3b55ea(_0x405d0b);});});}function _0x2c88ee(_0x1d1542,_0x2b6d05,_0x2ff099){if(!_0x2b6d05)return Promise[_0x5f43('0xe')](null);return new Promise(function(_0x2c151b,_0x3d9532){return _0x5354d1[_0x5f43('0xf')]['findAll']({'where':{'sectionId':_0x2b6d05['id']},'raw':!![]})[_0x5f43('0x8')](function(_0x596582){if(_0x1d1542['field']&&_0x1d1542[_0x5f43('0x5')]!=='id'){_0x2b6d05[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x596582,function(_0x1cbbfa){return _0x1cbbfa[_0x1d1542[_0x5f43('0x5')]];});}else{if(_0x2ff099==='AnalyticExtractedReport'){_0x2b6d05[_0x5f43('0x9')]=_['map'](_0x596582,function(_0x402496){return{'id':_0x402496[_0x5f43('0x10')],'type':_0x402496[_0x5f43('0x11')]};});}else{_0x2b6d05[_0x5f43('0x9')]=_[_0x5f43('0xc')](_0x596582,function(_0x56069c){return _0x56069c[_0x5f43('0x10')];});}}_0x2c151b(_0x2b6d05);})[_0x5f43('0xa')](function(_0x581874){_0x3d9532(_0x581874);});});}function _0x3bca9e(_0x244c8f,_0x3b20fb){var _0xff3e22={'parentSections':[]};switch(_0x244c8f['toLowerCase']()){case _0x5f43('0x12'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x14');break;case _0x5f43('0x15'):_0xff3e22['childModel']=_0x5f43('0x16');break;case _0x5f43('0x17'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x18');_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x1a'),'field':_0x5f43('0xd'),'foreignKey':'projectName'}];break;case _0x5f43('0x1b'):_0xff3e22['childModel']=_0x5f43('0x1c');break;case _0x5f43('0x1d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x1e');_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x1f'),'field':'id','foreignKey':_0x5f43('0x20')}];break;case _0x5f43('0x21'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x22');break;case'companies':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x23');break;case _0x5f43('0x24'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x25');break;case _0x5f43('0x26'):_0xff3e22['childModel']=_0x5f43('0x27');break;case'chatwebsites':_0xff3e22[_0x5f43('0x13')]='ChatWebsite';break;case _0x5f43('0x28'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x29');break;case _0x5f43('0x2a'):_0xff3e22[_0x5f43('0x13')]='FaxAccount';break;case _0x5f43('0x2b'):case _0x5f43('0x2c'):case _0x5f43('0x2d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x2e');break;case _0x5f43('0x2f'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x30');break;case _0x5f43('0x31'):_0xff3e22['childModel']=_0x5f43('0x32');break;case'voicerecordings':_0xff3e22[_0x5f43('0x13')]='VoiceRecording';_0xff3e22['parentSections']=[{'name':_0x5f43('0x33'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x34'),'model':_0x5f43('0x35'),'filter':{'field':_0x5f43('0x36'),'value':[_0x5f43('0x37')]}},{'name':'Telephones','field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x34'),'model':_0x5f43('0x35'),'filter':{'field':_0x5f43('0x36'),'value':[_0x5f43('0x38')]}},{'name':_0x5f43('0x39'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x3a'),'model':_0x5f43('0x3b'),'filter':{'field':_0x5f43('0x11'),'value':[_0x5f43('0x3c')]}},{'name':_0x5f43('0x3d'),'field':_0x5f43('0xd'),'foreignKey':_0x5f43('0x3a'),'model':_0x5f43('0x3b'),'filter':{'field':_0x5f43('0x11'),'value':[_0x5f43('0x3e')]}}];break;case _0x5f43('0x3f'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x40');break;case _0x5f43('0x41'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x42');break;case _0x5f43('0x43'):_0xff3e22['childModel']=_0x5f43('0x44');break;case _0x5f43('0x45'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x46');break;case _0x5f43('0x47'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x48');break;case _0x5f43('0x49'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4a');break;case'mailsubstatuses':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4b');break;case _0x5f43('0x4c'):_0xff3e22['childModel']='OpenchannelQueue';break;case _0x5f43('0x4d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x4e');break;case _0x5f43('0x4f'):_0xff3e22['childModel']=_0x5f43('0x50');break;case _0x5f43('0x51'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x52');break;case _0x5f43('0x53'):_0xff3e22[_0x5f43('0x13')]='WhatsappQueue';break;case _0x5f43('0x54'):_0xff3e22['childModel']=_0x5f43('0x55');break;case'teams':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x56');break;case'voicequeues':case _0x5f43('0x57'):_0xff3e22['childModel']=_0x5f43('0x3b');if(_0x3b20fb){_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x39')},{'name':_0x5f43('0x3d')}];}break;case _0x5f43('0x58'):case'agents':case _0x5f43('0x59'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x35');if(_0x3b20fb){_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x5a'),'filter':{'field':_0x5f43('0x36'),'value':['admin',_0x5f43('0x5b')]},'ignore':!![]},{'name':_0x5f43('0x33')},{'name':_0x5f43('0x5c')}];}break;case'zendeskaccounts':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x5d');break;case'salesforceaccounts':_0xff3e22['childModel']=_0x5f43('0x5e');break;case _0x5f43('0x5f'):_0xff3e22['childModel']='FreshdeskAccount';break;case _0x5f43('0x60'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x61');break;case _0x5f43('0x62'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x63');break;case'zohoaccounts':_0xff3e22['childModel']=_0x5f43('0x64');break;case _0x5f43('0x65'):_0xff3e22['childModel']=_0x5f43('0x35');break;case _0x5f43('0x66'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x67');break;case'dispositions':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x68');break;case _0x5f43('0x69'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6a');break;case _0x5f43('0x6b'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6c');break;case _0x5f43('0x6d'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x6e');break;case _0x5f43('0x6f'):_0xff3e22[_0x5f43('0x13')]='Schedule';break;case _0x5f43('0x70'):_0xff3e22[_0x5f43('0x13')]='Sound';break;case _0x5f43('0x71'):_0xff3e22['childModel']='Tag';break;case _0x5f43('0x72'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x73');break;case _0x5f43('0x74'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x75');break;case'trunks':_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x76');break;case _0x5f43('0x77'):_0xff3e22[_0x5f43('0x13')]=_0x5f43('0x78');break;case'plugins':_0xff3e22['childModel']=_0x5f43('0x79');break;case _0x5f43('0x7a'):_0xff3e22[_0x5f43('0x13')]='AnalyticExtractedReport';_0xff3e22[_0x5f43('0x19')]=[{'name':_0x5f43('0x7b'),'field':'id','foreignKey':_0x5f43('0x7c')}];break;case _0x5f43('0x7d'):_0xff3e22['childModel']='AnalyticMetric';break;}return _0xff3e22;}function _0x262231(_0x3c98bf,_0x106628){var _0x1d706f=_0x3c98bf[_0x5f43('0x7e')](0x0)[_0x5f43('0x7f')]()+_0x3c98bf[_0x5f43('0x80')](0x1);var _0x49ade3={'type':_0x5354d1[_0x5f43('0x81')]['QueryTypes'][_0x5f43('0x82')],'raw':!![]};return new Promise(function(_0x7cbe6f,_0x335dc5){var _0x28815e=squel[_0x5f43('0x83')]()[_0x5f43('0x5')]('ui.'+_0x1d706f+_0x5f43('0x84'),'id')[_0x5f43('0x5')](_0x5f43('0x85'))[_0x5f43('0x86')]('user_has_'+_0x3c98bf+_0x5f43('0x87'),'ui')[_0x5f43('0x88')](_0x5f43('0x89'),_0x106628['id']);return _0x5354d1[_0x5f43('0x8a')][_0x5f43('0x8b')](_0x28815e['toString'](),_0x49ade3)[_0x5f43('0x8')](function(_0x360b64){_0x106628[_0x1d706f+_0x5f43('0x8c')]=_0x360b64;_0x7cbe6f(_0x360b64);})[_0x5f43('0xa')](function(_0x4c8e5c){_0x335dc5(_0x4c8e5c);});});}return _0x24a542[_0x5f43('0x8d')](_0x5f43('0x8e'),attributes,{'tableName':_0x5f43('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x15b092){var _0x40e97b=require(_0x5f43('0x90'));var _0xb22f3f={'raw':_0x15b092[_0x5f43('0x8b')][_0x5f43('0x91')],'where':{}};var _0x59fb88={};var _0x3ec929={'count':0x0,'rows':[]};var _0x52f065=_0x15b092['query']['section'];var _0x1ee4e3=_0x15b092['query']['mergeResources']||![];var _0x267224=_0x3bca9e(_0x52f065,_0x1ee4e3);if(!_0x267224[_0x5f43('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x52f065+'\x27');var _0x3d8d60=[{'name':_0x52f065}];if(!_[_0x5f43('0x92')](_0x267224[_0x5f43('0x19')]))_0x3d8d60=_0x267224[_0x5f43('0x19')];var _0x294a25=[];for(var _0xa0f7a4=0x0;_0xa0f7a4<_0x3d8d60[_0x5f43('0x93')];_0xa0f7a4++){_0x294a25[_0x5f43('0x94')](_0x5354d1[_0x5f43('0x95')][_0x5f43('0x96')]({'where':{'userProfileId':_0x15b092[_0x5f43('0x97')]['id'],'name':_0x3d8d60[_0xa0f7a4][_0x5f43('0xd')]},'raw':!![]}));}return Promise[_0x5f43('0x98')](_0x294a25)[_0x5f43('0x8')](function(_0x2fee94){var _0x103183=_[_0x5f43('0x4')](_0x2fee94,function(_0x5e3eaf){return _0x5e3eaf?_0x5e3eaf:undefined;});var _0x2b5917=_[_0x5f43('0x4')](_0x3d8d60,[_0x5f43('0x99'),!![]]);var _0x9cd90c=_[_0x5f43('0x92')](_0x103183)&&_[_0x5f43('0x92')](_0x2b5917)?null:_[_0x5f43('0x9a')](_0x2b5917,_0x103183);if(!_0x9cd90c)return null;var _0x9d06a2=[];for(var _0x41e15a=0x0;_0x41e15a<_0x9cd90c[_0x5f43('0x93')];_0x41e15a++){var _0x114c90=_['find'](_0x3d8d60,function(_0x301200){return _0x9cd90c[_0x41e15a]?_0x301200[_0x5f43('0xd')]===_0x9cd90c[_0x41e15a][_0x5f43('0xd')]:null;});if(_0x114c90){if(_0x9cd90c[_0x41e15a]['ignore']){_0x9d06a2[_0x5f43('0x94')](_0xe85167(_0x267224['childModel'],_0x9cd90c[_0x41e15a]));}else{if(!_0x9cd90c[_0x41e15a][_0x5f43('0x9b')]){_0x9d06a2['push'](_0x2c88ee(_0x114c90,_0x9cd90c[_0x41e15a],_0x267224[_0x5f43('0x13')]));}else{if(_0x114c90[_0x5f43('0xb')]){_0x9d06a2[_0x5f43('0x94')](_0xa27ec4(_0x114c90,_0x9cd90c[_0x41e15a]));}}}}}return Promise['all'](_0x9d06a2);})[_0x5f43('0x8')](function(_0x80b270){var _0x3684d4=_0x80b270;var _0x291ae1=null;if(_0x3684d4){_0x291ae1=_0x3684d4[_0x5f43('0x93')]===0x1?_0x3684d4[0x0]:null;}if(!_0x291ae1&&!_0x3684d4)return _0x3ec929;var _0x4a3be3=_0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x9c')];_0x59fb88[_0x5f43('0xb')]=_[_0x5f43('0x9d')](_0x4a3be3);_0x59fb88['query']=_['keys'](_0x15b092[_0x5f43('0x8b')]);_0x59fb88[_0x5f43('0x9e')]=_['intersection'](_0x59fb88[_0x5f43('0xb')],_0x59fb88[_0x5f43('0x8b')]);_0xb22f3f['attributes']=_[_0x5f43('0x9f')](_0x59fb88[_0x5f43('0xb')],_0x40e97b['fields'](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa0')]));_0xb22f3f[_0x5f43('0xa1')]=_0xb22f3f[_0x5f43('0xa1')][_0x5f43('0x93')]?_0xb22f3f['attributes']:_0x59fb88['model'];if(!_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa2')](_0x5f43('0xa3'))){_0xb22f3f['limit']=_0x40e97b[_0x5f43('0xa4')](_0x15b092[_0x5f43('0x8b')]['limit']);_0xb22f3f[_0x5f43('0xa5')]=_0x40e97b[_0x5f43('0xa5')](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xa5')]);}_0xb22f3f[_0x5f43('0xa6')]=_0x40e97b[_0x5f43('0xa7')](_0x15b092[_0x5f43('0x8b')]['sort']);_0xb22f3f[_0x5f43('0x88')]=_0x40e97b[_0x5f43('0x9e')](_[_0x5f43('0xa8')](_0x15b092[_0x5f43('0x8b')],_0x59fb88[_0x5f43('0x9e')]));if(_0x15b092[_0x5f43('0x8b')]['filter']){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f[_0x5f43('0x88')],{'$or':_[_0x5f43('0xc')](_0x4a3be3,function(_0x4aae5a){if(_0x4aae5a[_0x5f43('0x11')]['key']!==_0x5f43('0xaa')){var _0x48120a={};_0x48120a[_0x4aae5a[_0x5f43('0x5')]]={'$like':'%'+_0x15b092['query']['filter']+'%'};return _0x48120a;}})});}var _0x51d37d=[];var _0x488397=null;var _0x286193={};if(_0x291ae1){_0x488397=_['find'](_0x3d8d60,['name',_0x291ae1[_0x5f43('0xd')]]);if(_0x488397['field']){_0x286193={};if(_0x267224[_0x5f43('0x13')]==='AnalyticExtractedReport'){_0x286193[_0x488397[_0x5f43('0xab')]]=_['map'](_0x291ae1['associatedResources'],'id');}else{_0x286193[_0x488397[_0x5f43('0xab')]]=_0x291ae1[_0x5f43('0x9')];}_0x51d37d['push'](_0x286193);}else{_0xb22f3f[_0x5f43('0x88')]['id']=_0x291ae1[_0x5f43('0x9')];}}else{for(var _0x2a7648=0x0;_0x2a7648<_0x3684d4[_0x5f43('0x93')];_0x2a7648++){_0x488397=_[_0x5f43('0x96')](_0x3d8d60,[_0x5f43('0xd'),_0x3684d4[_0x2a7648][_0x5f43('0xd')]]);if(_0x488397[_0x5f43('0x5')]){_0x286193={};_0x286193[_0x488397[_0x5f43('0xab')]]=_0x3684d4[_0x2a7648]['associatedResources'];_0x51d37d[_0x5f43('0x94')](_0x286193);}else{if(!_0xb22f3f['where']['id'])_0xb22f3f[_0x5f43('0x88')]['id']=[];_0x3684d4[_0x2a7648][_0x5f43('0x9')]['forEach'](function(_0x20b7b0){_0xb22f3f['where']['id']['push'](_0x20b7b0);});}}}if(!_[_0x5f43('0x92')](_0x51d37d)){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f['where'],{'$and':{'$or':_0x51d37d}});}_0xb22f3f=_['merge']({},_0xb22f3f,_0x15b092[_0x5f43('0xac')]);if(_0x291ae1&&!_0x291ae1['autoAssociation']&&_0x267224[_0x5f43('0x13')]===_0x5f43('0xad')){if(_0x15b092['query']['includeAll']){_0xb22f3f[_0x5f43('0xae')]=[{'all':!![]}];}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x7')](_0xb22f3f)[_0x5f43('0x8')](function(_0x5c737f){var _0x31905a=[];_0x5c737f[_0x5f43('0xaf')](function(_0x15de8f){var _0x3cf845;switch(_0x15de8f[_0x5f43('0xb0')]){case _0x5f43('0xb1'):_0x3cf845=_[_0x5f43('0x96')](_0x291ae1['associatedResources'],function(_0x31bf33){return _0x31bf33['id']===_0x15de8f[_0x5f43('0x7c')]&&_0x31bf33[_0x5f43('0x11')]===_0x5f43('0xb2');});break;case _0x5f43('0xb3'):_0x3cf845=_['find'](_0x291ae1[_0x5f43('0x9')],function(_0x5c5308){return _0x5c5308['id']===_0x15de8f['reportId']&&_0x5c5308['type']==='CustomReports';});break;}if(_0x3cf845)_0x31905a[_0x5f43('0x94')](_0x15de8f);});_0x3ec929[_0x5f43('0xb4')]=_0x31905a[_0x5f43('0x93')];_0x3ec929['rows']=_0x31905a;return _0x3ec929;});}else{if(!_['isEmpty'](_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')])){_0xb22f3f[_0x5f43('0x88')]['id']=_0xb22f3f['where']['id']?_['intersection'](_0xb22f3f[_0x5f43('0x88')]['id'],_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')]):_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb5')];if(_0x15b092['query'][_0x5f43('0xb6')]){_0xb22f3f['order']=_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb6')];}}if(_0x15b092['query'][_0x5f43('0xb7')]){_0xb22f3f[_0x5f43('0x88')]=_[_0x5f43('0xa9')](_0xb22f3f[_0x5f43('0x88')],{'$and':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb7')]});}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0xb4')]({'where':_0xb22f3f[_0x5f43('0x88')]})[_0x5f43('0x8')](function(_0x15c33b){_0x3ec929[_0x5f43('0xb4')]=_0x15c33b;if(_0x15b092[_0x5f43('0x8b')][_0x5f43('0xb8')]){if(_0x267224[_0x5f43('0x13')]==='CmContact'){_0xb22f3f[_0x5f43('0xae')]=[{'model':_0x5354d1[_0x5f43('0xb9')],'as':'Tags','attributes':['id','name','color'],'required':_0x15b092['query']['tag']?!![]:![]},{'model':_0x5354d1[_0x5f43('0xb9')],'as':_0x5f43('0xba'),'attributes':['id',_0x5f43('0xd'),_0x5f43('0xbb')],'through':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xbc')]?{'attributes':[],'where':{'TagId':_0x15b092[_0x5f43('0x8b')][_0x5f43('0xbc')]||undefined}}:{},'required':_0x15b092['query']['tag']?!![]:![]}];}else{_0xb22f3f[_0x5f43('0xae')]=[{'all':!![]}];}}return _0x5354d1[_0x267224[_0x5f43('0x13')]][_0x5f43('0x7')](_0xb22f3f);})[_0x5f43('0x8')](function(_0x19411e){_0x3ec929['rows']=_0x19411e;if(_0x52f065===_0x5f43('0x33')&&_0x15b092[_0x5f43('0x8b')]['openTabs']==='true'){var _0x32e627=[];for(var _0x54b634=0x0;_0x54b634<_0x3ec929['rows'][_0x5f43('0x93')];_0x54b634++){_0x32e627['push'](_0x262231(_0x5f43('0xbd'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc0'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc1'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231('mail',_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627[_0x5f43('0x94')](_0x262231(_0x5f43('0xc2'),_0x3ec929[_0x5f43('0xbe')][_0x54b634][_0x5f43('0xbf')]));_0x32e627['push'](_0x262231(_0x5f43('0xc3'),_0x3ec929[_0x5f43('0xbe')][_0x54b634]['dataValues']));}return Promise[_0x5f43('0x98')](_0x32e627)[_0x5f43('0x8')](function(){return _0x3ec929;});}return _0x3ec929;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e727dcf..cb9b66e 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 _0x0424=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x0424,0x159));var _0x4042=function(_0x559cc4,_0x44ce57){_0x559cc4=_0x559cc4-0x0;var _0x138971=_0x0424[_0x559cc4];return _0x138971;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});config[_0x4042('0x9')]=_[_0x4042('0xa')](config[_0x4042('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4042('0x9')]));require(_0x4042('0xb'))[_0x4042('0xc')](socket);function respondWithRpcPromise(_0x4b92d2,_0x341152,_0x11c0f7){return new BPromise(function(_0x2376a4,_0x2cbc75){return client[_0x4042('0xd')](_0x4b92d2,_0x11c0f7)[_0x4042('0xe')](function(_0x380aa0){logger[_0x4042('0xf')]('UserProfile,\x20%s,\x20%s',_0x341152,_0x4042('0x10'));logger[_0x4042('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x341152,_0x4042('0x10'),JSON[_0x4042('0x12')](_0x380aa0));if(_0x380aa0[_0x4042('0x13')]){if(_0x380aa0[_0x4042('0x13')][_0x4042('0x14')]===0x1f4){logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0['error'][_0x4042('0x16')]);return _0x2cbc75(_0x380aa0[_0x4042('0x13')]['message']);}logger[_0x4042('0x13')](_0x4042('0x15'),_0x341152,_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);return _0x2376a4(_0x380aa0[_0x4042('0x13')][_0x4042('0x16')]);}else{logger[_0x4042('0xf')](_0x4042('0x15'),_0x341152,_0x4042('0x10'));_0x2376a4(_0x380aa0['result'][_0x4042('0x16')]);}})['catch'](function(_0x9c8357){logger['error'](_0x4042('0x15'),_0x341152,_0x9c8357);_0x2cbc75(_0x9c8357);});});} \ No newline at end of file +var _0xf40b=['request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf40b,0xb0));var _0xbf40=function(_0x4863bc,_0x26dd88){_0x4863bc=_0x4863bc-0x0;var _0xa20d45=_0xf40b[_0x4863bc];return _0xa20d45;};'use strict';var _=require('lodash');var util=require(_0xbf40('0x0'));var moment=require(_0xbf40('0x1'));var BPromise=require(_0xbf40('0x2'));var rs=require(_0xbf40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf40('0x4'))['db'];var utils=require(_0xbf40('0x5'));var logger=require(_0xbf40('0x6'))(_0xbf40('0x7'));var config=require(_0xbf40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf40('0x9')][_0xbf40('0xa')]({'port':0x232a});config[_0xbf40('0xb')]=_[_0xbf40('0xc')](config[_0xbf40('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf40('0xd'))(new Redis(config[_0xbf40('0xb')]));require(_0xbf40('0xe'))[_0xbf40('0xf')](socket);function respondWithRpcPromise(_0x11c5be,_0x7ed794,_0x2cc598){return new BPromise(function(_0x20b14e,_0x500300){return client[_0xbf40('0x10')](_0x11c5be,_0x2cc598)[_0xbf40('0x11')](function(_0x40ee4a){logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x7ed794,_0xbf40('0x14'));logger[_0xbf40('0x15')](_0xbf40('0x16'),_0x7ed794,'request\x20sent',JSON['stringify'](_0x40ee4a));if(_0x40ee4a[_0xbf40('0x17')]){if(_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x18')]===0x1f4){logger[_0xbf40('0x17')]('UserProfile,\x20%s,\x20%s',_0x7ed794,_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);return _0x500300(_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);}logger[_0xbf40('0x17')](_0xbf40('0x13'),_0x7ed794,_0x40ee4a[_0xbf40('0x17')][_0xbf40('0x19')]);return _0x20b14e(_0x40ee4a['error'][_0xbf40('0x19')]);}else{logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x7ed794,_0xbf40('0x14'));_0x20b14e(_0x40ee4a[_0xbf40('0x1a')][_0xbf40('0x19')]);}})[_0xbf40('0x1b')](function(_0x3cca3c){logger['error'](_0xbf40('0x13'),_0x7ed794,_0x3cca3c);_0x500300(_0x3cca3c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 362ec14..f3ba1be 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 _0x21b9=['./userProfile.events','save','remove','emit','register','length'];(function(_0x528342,_0x17a981){var _0x27dd91=function(_0x20bed6){while(--_0x20bed6){_0x528342['push'](_0x528342['shift']());}};_0x27dd91(++_0x17a981);}(_0x21b9,0x150));var _0x921b=function(_0x14e0bd,_0x506b0e){_0x14e0bd=_0x14e0bd-0x0;var _0x3b01dc=_0x21b9[_0x14e0bd];return _0x3b01dc;};'use strict';var UserProfileEvents=require(_0x921b('0x0'));var events=[_0x921b('0x1'),_0x921b('0x2'),'update'];function createListener(_0x16df75,_0x3bafc7){return function(_0x843734){_0x3bafc7[_0x921b('0x3')](_0x16df75,_0x843734);};}function removeListener(_0x57fc7,_0x2f9ede){return function(){UserProfileEvents['removeListener'](_0x57fc7,_0x2f9ede);};}exports[_0x921b('0x4')]=function(_0x360510){for(var _0x5a2493=0x0,_0x5e5c8f=events[_0x921b('0x5')];_0x5a2493<_0x5e5c8f;_0x5a2493++){var _0x309784=events[_0x5a2493];var _0x19f657=createListener('userProfile:'+_0x309784,_0x360510);UserProfileEvents['on'](_0x309784,_0x19f657);}}; \ No newline at end of file +var _0xa330=['save','update','register','length','userProfile:','./userProfile.events'];(function(_0x732bac,_0xd7f7bb){var _0x385ac9=function(_0x42844a){while(--_0x42844a){_0x732bac['push'](_0x732bac['shift']());}};_0x385ac9(++_0xd7f7bb);}(_0xa330,0x155));var _0x0a33=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa330[_0x2112d4];return _0x434972;};'use strict';var UserProfileEvents=require(_0x0a33('0x0'));var events=[_0x0a33('0x1'),'remove',_0x0a33('0x2')];function createListener(_0x489956,_0x138e1a){return function(_0x4bf4d7){_0x138e1a['emit'](_0x489956,_0x4bf4d7);};}function removeListener(_0x35fd16,_0x522ace){return function(){UserProfileEvents['removeListener'](_0x35fd16,_0x522ace);};}exports[_0x0a33('0x3')]=function(_0x4b86d2){for(var _0x1e784f=0x0,_0x5e3057=events[_0x0a33('0x4')];_0x1e784f<_0x5e3057;_0x1e784f++){var _0x25f608=events[_0x1e784f];var _0xb9c6f2=createListener(_0x0a33('0x5')+_0x25f608,_0x4b86d2);UserProfileEvents['on'](_0x25f608,_0xb9c6f2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9c9268d..5332736 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 _0x9a5d=['show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x1156ce,_0x50f233){var _0x2b6d72=function(_0x36a033){while(--_0x36a033){_0x1156ce['push'](_0x1156ce['shift']());}};_0x2b6d72(++_0x50f233);}(_0x9a5d,0x1ea));var _0xd9a5=function(_0x12db2a,_0x1272db){_0x12db2a=_0x12db2a-0x0;var _0x54fd3c=_0x9a5d[_0x12db2a];return _0x54fd3c;};'use strict';var multer=require(_0xd9a5('0x0'));var util=require(_0xd9a5('0x1'));var path=require(_0xd9a5('0x2'));var timeout=require(_0xd9a5('0x3'));var express=require('express');var router=express[_0xd9a5('0x4')]();var fs_extra=require(_0xd9a5('0x5'));var auth=require(_0xd9a5('0x6'));var interaction=require(_0xd9a5('0x7'));var config=require(_0xd9a5('0x8'));var controller=require('./userProfileResource.controller');router[_0xd9a5('0x9')]('/',auth['isAuthenticated'](),controller[_0xd9a5('0xa')]);router[_0xd9a5('0x9')](_0xd9a5('0xb'),auth[_0xd9a5('0xc')](),controller[_0xd9a5('0xd')]);router['get']('/:id',auth[_0xd9a5('0xc')](),controller[_0xd9a5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd9a5('0xf')]);router[_0xd9a5('0x10')](_0xd9a5('0x11'),auth['isAuthenticated'](),controller[_0xd9a5('0x12')]);router[_0xd9a5('0x13')](_0xd9a5('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xd9a5('0x14')]=router; \ No newline at end of file +var _0x287d=['./userProfileResource.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x287d,0x83));var _0xd287=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0x287d[_0x5caabb];return _0x2929d8;};'use strict';var multer=require(_0xd287('0x0'));var util=require(_0xd287('0x1'));var path=require('path');var timeout=require(_0xd287('0x2'));var express=require(_0xd287('0x3'));var router=express[_0xd287('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd287('0x5'));router['get']('/',auth[_0xd287('0x6')](),controller[_0xd287('0x7')]);router[_0xd287('0x8')]('/describe',auth[_0xd287('0x6')](),controller[_0xd287('0x9')]);router[_0xd287('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd287('0xa')]);router[_0xd287('0xb')]('/',auth[_0xd287('0x6')](),controller[_0xd287('0xc')]);router[_0xd287('0xd')](_0xd287('0xe'),auth[_0xd287('0x6')](),controller[_0xd287('0xf')]);router['delete'](_0xd287('0xe'),auth[_0xd287('0x6')](),controller[_0xd287('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 18b8469..1be82f4 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 _0x0804=['INTEGER','sequelize','exports'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x0804,0x1de));var _0x4080=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x0804[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0x4080('0x0'));module[_0x4080('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4080('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd5cd=['exports','STRING','INTEGER'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd5cd,0x120));var _0xdd5c=function(_0x24ef7e,_0x82a220){_0x24ef7e=_0x24ef7e-0x0;var _0x2ca201=_0xd5cd[_0x24ef7e];return _0x2ca201;};'use strict';var Sequelize=require('sequelize');module[_0xdd5c('0x0')]={'name':{'type':Sequelize[_0xdd5c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xdd5c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdd5c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a4baea1..fb00049 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 _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x150627,_0x33aff6){var _0x2bdc35=function(_0x49b8d3){while(--_0x49b8d3){_0x150627['push'](_0x150627['shift']());}};_0x2bdc35(++_0x33aff6);}(_0x524e,0x15e));var _0xe524=function(_0x395f79,_0x4e6248){_0x395f79=_0x395f79-0x0;var _0x1bdd20=_0x524e[_0x395f79];return _0x1bdd20;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['UserProfileResource'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['UserProfileResource'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['UserProfileResource'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x552192,_0x4d9370){var _0x6b7953=function(_0x4bccbf){while(--_0x4bccbf){_0x552192['push'](_0x552192['shift']());}};_0x6b7953(++_0x4d9370);}(_0x0295,0x1f0));var _0x5029=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x0295[_0x5ba549];return _0x36e3a1;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));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'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 9e47a4e..52ceefd 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 _0xc2d2=['resourceId','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex'];(function(_0x5472b0,_0x5a03ed){var _0x3de3a5=function(_0x246923){while(--_0x246923){_0x5472b0['push'](_0x5472b0['shift']());}};_0x3de3a5(++_0x5a03ed);}(_0xc2d2,0xe2));var _0x2c2d=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xc2d2[_0x45ae0d];return _0x371826;};'use strict';var _=require(_0x2c2d('0x0'));var util=require(_0x2c2d('0x1'));var logger=require(_0x2c2d('0x2'))(_0x2c2d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2c2d('0x4'));var fs=require('fs');var path=require(_0x2c2d('0x5'));var rimraf=require(_0x2c2d('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c2d('0x7'));module[_0x2c2d('0x8')]=function(_0x1795ed,_0x463a8c){return _0x1795ed[_0x2c2d('0x9')](_0x2c2d('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2c2d('0xb'),'fields':[_0x2c2d('0xc'),_0x2c2d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1184=['../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1184,0xe4));var _0x4118=function(_0x193d1a,_0x249662){_0x193d1a=_0x193d1a-0x0;var _0x35399a=_0x1184[_0x193d1a];return _0x35399a;};'use strict';var _=require('lodash');var util=require(_0x4118('0x0'));var logger=require(_0x4118('0x1'))(_0x4118('0x2'));var moment=require(_0x4118('0x3'));var BPromise=require('bluebird');var rp=require(_0x4118('0x4'));var fs=require('fs');var path=require(_0x4118('0x5'));var rimraf=require('rimraf');var config=require(_0x4118('0x6'));var attributes=require(_0x4118('0x7'));module[_0x4118('0x8')]=function(_0x3c32d7,_0xd89651){return _0x3c32d7['define']('UserProfileResource',attributes,{'tableName':_0x4118('0x9'),'paranoid':![],'indexes':[{'name':_0x4118('0xa'),'fields':[_0x4118('0xb'),_0x4118('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 390a347..41af879 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 _0x3d97=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x28e714,_0x1ca825){var _0x2c3bf2=function(_0x2e0af6){while(--_0x2e0af6){_0x28e714['push'](_0x28e714['shift']());}};_0x2c3bf2(++_0x1ca825);}(_0x3d97,0xa6));var _0x73d9=function(_0x370561,_0x44486e){_0x370561=_0x370561-0x0;var _0x481f57=_0x3d97[_0x370561];return _0x481f57;};'use strict';var _=require(_0x73d9('0x0'));var util=require(_0x73d9('0x1'));var moment=require(_0x73d9('0x2'));var BPromise=require(_0x73d9('0x3'));var rs=require(_0x73d9('0x4'));var fs=require('fs');var Redis=require(_0x73d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x73d9('0x6'));var logger=require('../../config/logger')(_0x73d9('0x7'));var config=require(_0x73d9('0x8'));var jayson=require(_0x73d9('0x9'));var client=jayson[_0x73d9('0xa')][_0x73d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42b54a,_0x4e8646,_0x10bf43){return new BPromise(function(_0x2baea5,_0x37565d){return client[_0x73d9('0xc')](_0x42b54a,_0x10bf43)[_0x73d9('0xd')](function(_0xcde8c4){logger[_0x73d9('0xe')](_0x73d9('0xf'),_0x4e8646,'request\x20sent');logger[_0x73d9('0x10')](_0x73d9('0x11'),_0x4e8646,_0x73d9('0x12'),JSON[_0x73d9('0x13')](_0xcde8c4));if(_0xcde8c4[_0x73d9('0x14')]){if(_0xcde8c4[_0x73d9('0x14')][_0x73d9('0x15')]===0x1f4){logger[_0x73d9('0x14')](_0x73d9('0xf'),_0x4e8646,_0xcde8c4[_0x73d9('0x14')][_0x73d9('0x16')]);return _0x37565d(_0xcde8c4[_0x73d9('0x14')][_0x73d9('0x16')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4e8646,_0xcde8c4[_0x73d9('0x14')][_0x73d9('0x16')]);return _0x2baea5(_0xcde8c4['error'][_0x73d9('0x16')]);}else{logger[_0x73d9('0xe')](_0x73d9('0xf'),_0x4e8646,_0x73d9('0x12'));_0x2baea5(_0xcde8c4['result']['message']);}})['catch'](function(_0x28e05f){logger[_0x73d9('0x14')](_0x73d9('0xf'),_0x4e8646,_0x28e05f);_0x37565d(_0x28e05f);});});} \ No newline at end of file +var _0x6453=['debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6453,0x1c0));var _0x3645=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x6453[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var moment=require(_0x3645('0x2'));var BPromise=require(_0x3645('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3645('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3645('0x5'));var logger=require(_0x3645('0x6'))(_0x3645('0x7'));var config=require('../../config/environment');var jayson=require(_0x3645('0x8'));var client=jayson['client'][_0x3645('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e4ed6,_0x34c468,_0x2d2fbf){return new BPromise(function(_0x4342ea,_0x1f2ee3){return client['request'](_0x4e4ed6,_0x2d2fbf)[_0x3645('0xa')](function(_0x2b38b5){logger[_0x3645('0xb')](_0x3645('0xc'),_0x34c468,_0x3645('0xd'));logger[_0x3645('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x34c468,_0x3645('0xd'),JSON[_0x3645('0xf')](_0x2b38b5));if(_0x2b38b5['error']){if(_0x2b38b5['error'][_0x3645('0x10')]===0x1f4){logger[_0x3645('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);return _0x1f2ee3(_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);}logger[_0x3645('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);return _0x4342ea(_0x2b38b5[_0x3645('0x11')][_0x3645('0x12')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x34c468,_0x3645('0xd'));_0x4342ea(_0x2b38b5[_0x3645('0x13')]['message']);}})[_0x3645('0x14')](function(_0x3289ef){logger[_0x3645('0x11')](_0x3645('0xc'),_0x34c468,_0x3289ef);_0x1f2ee3(_0x3289ef);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 88dbdd1..ea19ee5 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 _0xaf4a=['/describe','/:id','show','put','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x17eee6,_0x47fc53){var _0x5c9b21=function(_0x15cd83){while(--_0x15cd83){_0x17eee6['push'](_0x17eee6['shift']());}};_0x5c9b21(++_0x47fc53);}(_0xaf4a,0x107));var _0xaaf4=function(_0x16c42d,_0x5e3aa6){_0x16c42d=_0x16c42d-0x0;var _0x5e498f=_0xaf4a[_0x16c42d];return _0x5e498f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaaf4('0x0'));var timeout=require(_0xaaf4('0x1'));var express=require(_0xaaf4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaaf4('0x3'));var interaction=require(_0xaaf4('0x4'));var config=require(_0xaaf4('0x5'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xaaf4('0x6')](),controller[_0xaaf4('0x7')]);router[_0xaaf4('0x8')](_0xaaf4('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xaaf4('0xa'),auth[_0xaaf4('0x6')](),controller[_0xaaf4('0xb')]);router['post']('/',auth[_0xaaf4('0x6')](),controller['create']);router[_0xaaf4('0xc')](_0xaaf4('0xa'),auth[_0xaaf4('0x6')](),controller['update']);router[_0xaaf4('0xd')](_0xaaf4('0xa'),auth[_0xaaf4('0x6')](),controller[_0xaaf4('0xe')]);module[_0xaaf4('0xf')]=router; \ No newline at end of file +var _0xbb3c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbb3c,0xa4));var _0xcbb3=function(_0x766881,_0x754ca6){_0x766881=_0x766881-0x0;var _0x35df53=_0xbb3c[_0x766881];return _0x35df53;};'use strict';var multer=require(_0xcbb3('0x0'));var util=require(_0xcbb3('0x1'));var path=require(_0xcbb3('0x2'));var timeout=require(_0xcbb3('0x3'));var express=require(_0xcbb3('0x4'));var router=express[_0xcbb3('0x5')]();var fs_extra=require(_0xcbb3('0x6'));var auth=require(_0xcbb3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcbb3('0x8'));var controller=require(_0xcbb3('0x9'));router[_0xcbb3('0xa')]('/',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0xc')]);router[_0xcbb3('0xa')](_0xcbb3('0xd'),auth[_0xcbb3('0xb')](),controller['describe']);router[_0xcbb3('0xa')](_0xcbb3('0xe'),auth[_0xcbb3('0xb')](),controller['show']);router[_0xcbb3('0xf')]('/',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x10')]);router[_0xcbb3('0x11')](_0xcbb3('0xe'),auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x12')]);router['delete']('/:id',auth[_0xcbb3('0xb')](),controller[_0xcbb3('0x13')]);module[_0xcbb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 28ebae5..851ad07 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 _0x087b=['getDataValue','split','sequelize','exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x087b,0x11a));var _0xb087=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x087b[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb087('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb087('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb087('0x4')],'set':function(_0x1d3299){this[_0xb087('0x5')](_0xb087('0x6'),_0x1d3299?_0x1d3299[_0xb087('0x7')](''):[]);},'get':function(){return this[_0xb087('0x8')](_0xb087('0x6'))?this[_0xb087('0x8')](_0xb087('0x6'))[_0xb087('0x9')](''):[];}}}; \ No newline at end of file +var _0x282b=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x4de43d,_0x3d422e){var _0x81f2d8=function(_0x42f0dc){while(--_0x42f0dc){_0x4de43d['push'](_0x4de43d['shift']());}};_0x81f2d8(++_0x3d422e);}(_0x282b,0xec));var _0xb282=function(_0xa67057,_0x1a02d6){_0xa67057=_0xa67057-0x0;var _0x1277ef=_0x282b[_0xa67057];return _0x1277ef;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'name':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb282('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb282('0x2')],'set':function(_0x5cadd7){this[_0xb282('0x4')](_0xb282('0x5'),_0x5cadd7?_0x5cadd7[_0xb282('0x6')](''):[]);},'get':function(){return this[_0xb282('0x7')](_0xb282('0x5'))?this[_0xb282('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a474ede..39dd7fc 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 _0x2e91=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','send','index','UserProfileSection','fieldName','type','key','model','map','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','find','catch','create','update','body','destroy','describe','rimraf','zip-dir'];(function(_0x4e0882,_0x331f62){var _0x557e38=function(_0x3aabb0){while(--_0x3aabb0){_0x4e0882['push'](_0x4e0882['shift']());}};_0x557e38(++_0x331f62);}(_0x2e91,0x9a));var _0x12e9=function(_0x35a65e,_0x19f545){_0x35a65e=_0x35a65e-0x0;var _0x2d7280=_0x2e91[_0x35a65e];return _0x2d7280;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12e9('0x0'));var zipdir=require(_0x12e9('0x1'));var jsonpatch=require(_0x12e9('0x2'));var rp=require(_0x12e9('0x3'));var moment=require(_0x12e9('0x4'));var BPromise=require(_0x12e9('0x5'));var Mustache=require(_0x12e9('0x6'));var util=require(_0x12e9('0x7'));var path=require(_0x12e9('0x8'));var sox=require('sox');var csv=require(_0x12e9('0x9'));var ejs=require(_0x12e9('0xa'));var fs=require('fs');var fs_extra=require(_0x12e9('0xb'));var _=require(_0x12e9('0xc'));var squel=require(_0x12e9('0xd'));var crypto=require('crypto');var jsforce=require(_0x12e9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x12e9('0x9'));var querystring=require('querystring');var Papa=require(_0x12e9('0xf'));var Redis=require(_0x12e9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12e9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e9('0x12'))(_0x12e9('0x13'));var utils=require(_0x12e9('0x14'));var config=require(_0x12e9('0x15'));var licenseUtil=require(_0x12e9('0x16'));var db=require(_0x12e9('0x17'))['db'];function respondWithStatusCode(_0x390dfb,_0x46090f){_0x46090f=_0x46090f||0xcc;return function(_0x47fe30){if(_0x47fe30){return _0x390dfb['sendStatus'](_0x46090f);}return _0x390dfb['status'](_0x46090f)[_0x12e9('0x18')]();};}function respondWithResult(_0x44ade2,_0x319f31){_0x319f31=_0x319f31||0xc8;return function(_0x14e2e3){if(_0x14e2e3){return _0x44ade2[_0x12e9('0x19')](_0x319f31)[_0x12e9('0x1a')](_0x14e2e3);}};}function respondWithFilteredResult(_0x573f67,_0x192be7){return function(_0x16c7be){if(_0x16c7be){var _0x24f9ef=typeof _0x192be7[_0x12e9('0x1b')]===_0x12e9('0x1c')&&typeof _0x192be7[_0x12e9('0x1d')]==='undefined';var _0x4037df=_0x16c7be[_0x12e9('0x1e')];var _0x4c0d1b=_0x24f9ef?0x0:_0x192be7[_0x12e9('0x1b')];var _0x312b59=_0x24f9ef?_0x16c7be[_0x12e9('0x1e')]:_0x192be7[_0x12e9('0x1b')]+_0x192be7['limit'];var _0x5a9bad;if(_0x312b59>=_0x4037df){_0x312b59=_0x4037df;_0x5a9bad=0xc8;}else{_0x5a9bad=0xce;}_0x573f67[_0x12e9('0x19')](_0x5a9bad);return _0x573f67[_0x12e9('0x1f')](_0x12e9('0x20'),_0x4c0d1b+'-'+_0x312b59+'/'+_0x4037df)[_0x12e9('0x1a')](_0x16c7be);}return null;};}function patchUpdates(_0x53449b){return function(_0x43ea15){try{jsonpatch[_0x12e9('0x21')](_0x43ea15,_0x53449b,!![]);}catch(_0x512d66){return BPromise[_0x12e9('0x22')](_0x512d66);}return _0x43ea15[_0x12e9('0x23')]();};}function saveUpdates(_0xb9239f,_0x2ae780){return function(_0x38f28f){if(_0x38f28f){return _0x38f28f['update'](_0xb9239f)[_0x12e9('0x24')](function(_0x32a031){return _0x32a031;});}return null;};}function removeEntity(_0x4e3550,_0x52ab83){return function(_0x243750){if(_0x243750){return _0x243750['destroy']()[_0x12e9('0x24')](function(){_0x4e3550[_0x12e9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x371261,_0x3df39b){return function(_0x531fd7){if(!_0x531fd7){_0x371261[_0x12e9('0x25')](0x194);}return _0x531fd7;};}function handleError(_0x3fa448,_0x116064){_0x116064=_0x116064||0x1f4;return function(_0x1d9bc0){logger[_0x12e9('0x26')](_0x1d9bc0[_0x12e9('0x27')]);if(_0x1d9bc0['name']){delete _0x1d9bc0['name'];}_0x3fa448[_0x12e9('0x19')](_0x116064)[_0x12e9('0x28')](_0x1d9bc0);};}exports[_0x12e9('0x29')]=function(_0x35a0d3,_0x50d809){var _0x414a0f={},_0x21be47={},_0x3450f6={'count':0x0,'rows':[]};var _0xf9cc18=_['map'](db[_0x12e9('0x2a')]['rawAttributes'],function(_0x57211f){return{'name':_0x57211f[_0x12e9('0x2b')],'type':_0x57211f[_0x12e9('0x2c')][_0x12e9('0x2d')]};});_0x21be47[_0x12e9('0x2e')]=_[_0x12e9('0x2f')](_0xf9cc18,_0x12e9('0x30'));_0x21be47['query']=_[_0x12e9('0x31')](_0x35a0d3[_0x12e9('0x32')]);_0x21be47[_0x12e9('0x33')]=_['intersection'](_0x21be47[_0x12e9('0x2e')],_0x21be47[_0x12e9('0x32')]);_0x414a0f[_0x12e9('0x34')]=_[_0x12e9('0x35')](_0x21be47[_0x12e9('0x2e')],qs[_0x12e9('0x36')](_0x35a0d3['query'][_0x12e9('0x36')]));_0x414a0f['attributes']=_0x414a0f[_0x12e9('0x34')][_0x12e9('0x37')]?_0x414a0f[_0x12e9('0x34')]:_0x21be47[_0x12e9('0x2e')];if(!_0x35a0d3[_0x12e9('0x32')][_0x12e9('0x38')](_0x12e9('0x39'))){_0x414a0f[_0x12e9('0x1d')]=qs[_0x12e9('0x1d')](_0x35a0d3[_0x12e9('0x32')]['limit']);_0x414a0f[_0x12e9('0x1b')]=qs['offset'](_0x35a0d3[_0x12e9('0x32')][_0x12e9('0x1b')]);}_0x414a0f[_0x12e9('0x3a')]=qs[_0x12e9('0x3b')](_0x35a0d3[_0x12e9('0x32')]['sort']);_0x414a0f[_0x12e9('0x3c')]=qs[_0x12e9('0x33')](_[_0x12e9('0x3d')](_0x35a0d3[_0x12e9('0x32')],_0x21be47[_0x12e9('0x33')]),_0xf9cc18);if(_0x35a0d3[_0x12e9('0x32')][_0x12e9('0x3e')]){_0x414a0f[_0x12e9('0x3c')]=_['merge'](_0x414a0f[_0x12e9('0x3c')],{'$or':_[_0x12e9('0x2f')](_0xf9cc18,function(_0x3a1acf){if(_0x3a1acf['type']!==_0x12e9('0x3f')){var _0x157d9d={};_0x157d9d[_0x3a1acf[_0x12e9('0x30')]]={'$like':'%'+_0x35a0d3[_0x12e9('0x32')]['filter']+'%'};return _0x157d9d;}})});}_0x414a0f=_[_0x12e9('0x40')]({},_0x414a0f,_0x35a0d3[_0x12e9('0x41')]);var _0x474d65={'where':_0x414a0f[_0x12e9('0x3c')]};return db[_0x12e9('0x2a')][_0x12e9('0x1e')](_0x474d65)[_0x12e9('0x24')](function(_0x44a697){_0x3450f6[_0x12e9('0x1e')]=_0x44a697;if(_0x35a0d3['query'][_0x12e9('0x42')]){_0x414a0f[_0x12e9('0x43')]=[{'all':!![]}];}return db[_0x12e9('0x2a')]['findAll'](_0x414a0f);})[_0x12e9('0x24')](function(_0xf96306){_0x3450f6['rows']=_0xf96306;return _0x3450f6;})['then'](respondWithFilteredResult(_0x50d809,_0x414a0f))['catch'](handleError(_0x50d809,null));};exports[_0x12e9('0x44')]=function(_0x3df18a,_0x341027){var _0x3efe3e={'raw':![],'where':{'id':_0x3df18a[_0x12e9('0x45')]['id']}},_0x49cb61={};_0x49cb61[_0x12e9('0x2e')]=_['keys'](db[_0x12e9('0x2a')][_0x12e9('0x46')]);_0x49cb61[_0x12e9('0x32')]=_[_0x12e9('0x31')](_0x3df18a['query']);_0x49cb61[_0x12e9('0x33')]=_[_0x12e9('0x35')](_0x49cb61['model'],_0x49cb61['query']);_0x3efe3e['attributes']=_[_0x12e9('0x35')](_0x49cb61['model'],qs[_0x12e9('0x36')](_0x3df18a[_0x12e9('0x32')]['fields']));_0x3efe3e[_0x12e9('0x34')]=_0x3efe3e['attributes'][_0x12e9('0x37')]?_0x3efe3e[_0x12e9('0x34')]:_0x49cb61[_0x12e9('0x2e')];if(_0x3df18a[_0x12e9('0x32')][_0x12e9('0x42')]){_0x3efe3e[_0x12e9('0x43')]=[{'all':!![]}];}_0x3efe3e=_[_0x12e9('0x40')]({},_0x3efe3e,_0x3df18a[_0x12e9('0x41')]);return db['UserProfileSection'][_0x12e9('0x47')](_0x3efe3e)['then'](handleEntityNotFound(_0x341027,null))[_0x12e9('0x24')](respondWithResult(_0x341027,null))[_0x12e9('0x48')](handleError(_0x341027,null));};exports['create']=function(_0x19cd46,_0xe27967){return db['UserProfileSection'][_0x12e9('0x49')](_0x19cd46['body'],{})[_0x12e9('0x24')](respondWithResult(_0xe27967,0xc9))[_0x12e9('0x48')](handleError(_0xe27967,null));};exports[_0x12e9('0x4a')]=function(_0x3d5a96,_0x464d8e){if(_0x3d5a96['body']['id']){delete _0x3d5a96['body']['id'];}return db[_0x12e9('0x2a')]['find']({'where':{'id':_0x3d5a96[_0x12e9('0x45')]['id']}})['then'](handleEntityNotFound(_0x464d8e,null))[_0x12e9('0x24')](saveUpdates(_0x3d5a96[_0x12e9('0x4b')],null))['then'](respondWithResult(_0x464d8e,null))[_0x12e9('0x48')](handleError(_0x464d8e,null));};exports[_0x12e9('0x4c')]=function(_0x14a964,_0x9d0ab2){return db[_0x12e9('0x2a')][_0x12e9('0x47')]({'where':{'id':_0x14a964['params']['id']}})['then'](handleEntityNotFound(_0x9d0ab2,null))[_0x12e9('0x24')](removeEntity(_0x9d0ab2,null))['catch'](handleError(_0x9d0ab2,null));};exports[_0x12e9('0x4d')]=function(_0x5540b7,_0x15a684){return db[_0x12e9('0x2a')][_0x12e9('0x4d')]()['then'](respondWithResult(_0x15a684,null))[_0x12e9('0x48')](handleError(_0x15a684,null));}; \ No newline at end of file +var _0x7c33=['model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','UserProfileSection','rawAttributes','type','key'];(function(_0x5c4f56,_0x3c12ad){var _0x4d917a=function(_0x43bee8){while(--_0x43bee8){_0x5c4f56['push'](_0x5c4f56['shift']());}};_0x4d917a(++_0x3c12ad);}(_0x7c33,0x19c));var _0x37c3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7c33[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x37c3('0x0'));var rimraf=require(_0x37c3('0x1'));var zipdir=require(_0x37c3('0x2'));var jsonpatch=require(_0x37c3('0x3'));var rp=require(_0x37c3('0x4'));var moment=require(_0x37c3('0x5'));var BPromise=require(_0x37c3('0x6'));var Mustache=require(_0x37c3('0x7'));var util=require(_0x37c3('0x8'));var path=require(_0x37c3('0x9'));var sox=require(_0x37c3('0xa'));var csv=require(_0x37c3('0xb'));var ejs=require(_0x37c3('0xc'));var fs=require('fs');var fs_extra=require(_0x37c3('0xd'));var _=require(_0x37c3('0xe'));var squel=require('squel');var crypto=require(_0x37c3('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x37c3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37c3('0x11'));var Papa=require(_0x37c3('0x12'));var Redis=require(_0x37c3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x37c3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37c3('0x15'));var logger=require(_0x37c3('0x16'))(_0x37c3('0x17'));var utils=require('../../config/utils');var config=require(_0x37c3('0x18'));var licenseUtil=require(_0x37c3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1257af,_0x27525b){_0x27525b=_0x27525b||0xcc;return function(_0x279118){if(_0x279118){return _0x1257af[_0x37c3('0x1a')](_0x27525b);}return _0x1257af['status'](_0x27525b)['end']();};}function respondWithResult(_0x2efa7e,_0x324f3b){_0x324f3b=_0x324f3b||0xc8;return function(_0x31eab9){if(_0x31eab9){return _0x2efa7e['status'](_0x324f3b)[_0x37c3('0x1b')](_0x31eab9);}};}function respondWithFilteredResult(_0x50ba1d,_0x4d9028){return function(_0x9d1086){if(_0x9d1086){var _0x927730=typeof _0x4d9028[_0x37c3('0x1c')]===_0x37c3('0x1d')&&typeof _0x4d9028['limit']==='undefined';var _0x587925=_0x9d1086['count'];var _0x23e0bb=_0x927730?0x0:_0x4d9028['offset'];var _0x7fa8b5=_0x927730?_0x9d1086[_0x37c3('0x1e')]:_0x4d9028[_0x37c3('0x1c')]+_0x4d9028[_0x37c3('0x1f')];var _0x22965a;if(_0x7fa8b5>=_0x587925){_0x7fa8b5=_0x587925;_0x22965a=0xc8;}else{_0x22965a=0xce;}_0x50ba1d[_0x37c3('0x20')](_0x22965a);return _0x50ba1d[_0x37c3('0x21')](_0x37c3('0x22'),_0x23e0bb+'-'+_0x7fa8b5+'/'+_0x587925)[_0x37c3('0x1b')](_0x9d1086);}return null;};}function patchUpdates(_0x5bc139){return function(_0x52cb9a){try{jsonpatch[_0x37c3('0x23')](_0x52cb9a,_0x5bc139,!![]);}catch(_0xfca85c){return BPromise['reject'](_0xfca85c);}return _0x52cb9a[_0x37c3('0x24')]();};}function saveUpdates(_0xc71071,_0x61fd02){return function(_0xbe5180){if(_0xbe5180){return _0xbe5180[_0x37c3('0x25')](_0xc71071)[_0x37c3('0x26')](function(_0xff1b30){return _0xff1b30;});}return null;};}function removeEntity(_0x344fc9,_0x5a3053){return function(_0x28a0b0){if(_0x28a0b0){return _0x28a0b0[_0x37c3('0x27')]()[_0x37c3('0x26')](function(){_0x344fc9[_0x37c3('0x20')](0xcc)[_0x37c3('0x28')]();});}};}function handleEntityNotFound(_0x424e7e,_0x2a7919){return function(_0x533b98){if(!_0x533b98){_0x424e7e[_0x37c3('0x1a')](0x194);}return _0x533b98;};}function handleError(_0x3d65ca,_0xf8a58b){_0xf8a58b=_0xf8a58b||0x1f4;return function(_0x4e7eda){logger[_0x37c3('0x29')](_0x4e7eda[_0x37c3('0x2a')]);if(_0x4e7eda[_0x37c3('0x2b')]){delete _0x4e7eda['name'];}_0x3d65ca[_0x37c3('0x20')](_0xf8a58b)['send'](_0x4e7eda);};}exports[_0x37c3('0x2c')]=function(_0x55975c,_0x4306f5){var _0x42b705={},_0xf38f48={},_0x295e58={'count':0x0,'rows':[]};var _0x1994dd=_[_0x37c3('0x2d')](db[_0x37c3('0x2e')][_0x37c3('0x2f')],function(_0x4a866c){return{'name':_0x4a866c['fieldName'],'type':_0x4a866c[_0x37c3('0x30')][_0x37c3('0x31')]};});_0xf38f48[_0x37c3('0x32')]=_[_0x37c3('0x2d')](_0x1994dd,_0x37c3('0x2b'));_0xf38f48[_0x37c3('0x33')]=_[_0x37c3('0x34')](_0x55975c['query']);_0xf38f48[_0x37c3('0x35')]=_[_0x37c3('0x36')](_0xf38f48[_0x37c3('0x32')],_0xf38f48[_0x37c3('0x33')]);_0x42b705['attributes']=_['intersection'](_0xf38f48['model'],qs['fields'](_0x55975c['query'][_0x37c3('0x37')]));_0x42b705[_0x37c3('0x38')]=_0x42b705[_0x37c3('0x38')]['length']?_0x42b705[_0x37c3('0x38')]:_0xf38f48[_0x37c3('0x32')];if(!_0x55975c[_0x37c3('0x33')][_0x37c3('0x39')](_0x37c3('0x3a'))){_0x42b705['limit']=qs[_0x37c3('0x1f')](_0x55975c[_0x37c3('0x33')][_0x37c3('0x1f')]);_0x42b705[_0x37c3('0x1c')]=qs[_0x37c3('0x1c')](_0x55975c[_0x37c3('0x33')][_0x37c3('0x1c')]);}_0x42b705[_0x37c3('0x3b')]=qs[_0x37c3('0x3c')](_0x55975c['query'][_0x37c3('0x3c')]);_0x42b705[_0x37c3('0x3d')]=qs['filters'](_['pick'](_0x55975c[_0x37c3('0x33')],_0xf38f48[_0x37c3('0x35')]),_0x1994dd);if(_0x55975c[_0x37c3('0x33')][_0x37c3('0x3e')]){_0x42b705['where']=_[_0x37c3('0x3f')](_0x42b705[_0x37c3('0x3d')],{'$or':_['map'](_0x1994dd,function(_0x51f878){if(_0x51f878[_0x37c3('0x30')]!==_0x37c3('0x40')){var _0x510674={};_0x510674[_0x51f878['name']]={'$like':'%'+_0x55975c[_0x37c3('0x33')][_0x37c3('0x3e')]+'%'};return _0x510674;}})});}_0x42b705=_[_0x37c3('0x3f')]({},_0x42b705,_0x55975c[_0x37c3('0x41')]);var _0x559a2b={'where':_0x42b705[_0x37c3('0x3d')]};return db['UserProfileSection'][_0x37c3('0x1e')](_0x559a2b)[_0x37c3('0x26')](function(_0x7e89fc){_0x295e58[_0x37c3('0x1e')]=_0x7e89fc;if(_0x55975c['query']['includeAll']){_0x42b705[_0x37c3('0x42')]=[{'all':!![]}];}return db[_0x37c3('0x2e')][_0x37c3('0x43')](_0x42b705);})[_0x37c3('0x26')](function(_0xc8364){_0x295e58[_0x37c3('0x44')]=_0xc8364;return _0x295e58;})[_0x37c3('0x26')](respondWithFilteredResult(_0x4306f5,_0x42b705))['catch'](handleError(_0x4306f5,null));};exports[_0x37c3('0x45')]=function(_0x3ab428,_0x57daa1){var _0x4b1ede={'raw':![],'where':{'id':_0x3ab428['params']['id']}},_0x1b7d1a={};_0x1b7d1a[_0x37c3('0x32')]=_[_0x37c3('0x34')](db[_0x37c3('0x2e')][_0x37c3('0x2f')]);_0x1b7d1a[_0x37c3('0x33')]=_[_0x37c3('0x34')](_0x3ab428[_0x37c3('0x33')]);_0x1b7d1a[_0x37c3('0x35')]=_[_0x37c3('0x36')](_0x1b7d1a['model'],_0x1b7d1a[_0x37c3('0x33')]);_0x4b1ede[_0x37c3('0x38')]=_[_0x37c3('0x36')](_0x1b7d1a['model'],qs['fields'](_0x3ab428['query'][_0x37c3('0x37')]));_0x4b1ede[_0x37c3('0x38')]=_0x4b1ede[_0x37c3('0x38')]['length']?_0x4b1ede[_0x37c3('0x38')]:_0x1b7d1a[_0x37c3('0x32')];if(_0x3ab428['query'][_0x37c3('0x46')]){_0x4b1ede[_0x37c3('0x42')]=[{'all':!![]}];}_0x4b1ede=_[_0x37c3('0x3f')]({},_0x4b1ede,_0x3ab428['options']);return db[_0x37c3('0x2e')]['find'](_0x4b1ede)[_0x37c3('0x26')](handleEntityNotFound(_0x57daa1,null))['then'](respondWithResult(_0x57daa1,null))[_0x37c3('0x47')](handleError(_0x57daa1,null));};exports[_0x37c3('0x48')]=function(_0x4d51d3,_0x19640d){return db[_0x37c3('0x2e')]['create'](_0x4d51d3[_0x37c3('0x49')],{})[_0x37c3('0x26')](respondWithResult(_0x19640d,0xc9))[_0x37c3('0x47')](handleError(_0x19640d,null));};exports[_0x37c3('0x25')]=function(_0x571695,_0x51be15){if(_0x571695['body']['id']){delete _0x571695[_0x37c3('0x49')]['id'];}return db[_0x37c3('0x2e')]['find']({'where':{'id':_0x571695['params']['id']}})[_0x37c3('0x26')](handleEntityNotFound(_0x51be15,null))[_0x37c3('0x26')](saveUpdates(_0x571695['body'],null))[_0x37c3('0x26')](respondWithResult(_0x51be15,null))['catch'](handleError(_0x51be15,null));};exports[_0x37c3('0x27')]=function(_0xa70f8c,_0x29ff35){return db[_0x37c3('0x2e')][_0x37c3('0x4a')]({'where':{'id':_0xa70f8c[_0x37c3('0x4b')]['id']}})[_0x37c3('0x26')](handleEntityNotFound(_0x29ff35,null))[_0x37c3('0x26')](removeEntity(_0x29ff35,null))[_0x37c3('0x47')](handleError(_0x29ff35,null));};exports[_0x37c3('0x4c')]=function(_0x2f025f,_0x13a742){return db['UserProfileSection'][_0x37c3('0x4c')]()['then'](respondWithResult(_0x13a742,null))['catch'](handleError(_0x13a742,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c9e4106..f8a7bd3 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 _0x5b38=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x3442db,_0x2274fc){var _0x59625a=function(_0x20ce39){while(--_0x20ce39){_0x3442db['push'](_0x3442db['shift']());}};_0x59625a(++_0x2274fc);}(_0x5b38,0x81));var _0x85b3=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x5b38[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x85b3('0x0'));var util=require(_0x85b3('0x1'));var logger=require(_0x85b3('0x2'))('api');var moment=require(_0x85b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x85b3('0x4'));var rimraf=require(_0x85b3('0x5'));var config=require(_0x85b3('0x6'));var attributes=require(_0x85b3('0x7'));module[_0x85b3('0x8')]=function(_0x254cb5,_0x3db978){return _0x254cb5[_0x85b3('0x9')](_0x85b3('0xa'),attributes,{'tableName':_0x85b3('0xb'),'paranoid':![],'indexes':[{'name':_0x85b3('0xc'),'fields':[_0x85b3('0xd'),_0x85b3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5dfc=['UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','api','moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define'];(function(_0x51a945,_0x287210){var _0x42d523=function(_0x38efc8){while(--_0x38efc8){_0x51a945['push'](_0x51a945['shift']());}};_0x42d523(++_0x287210);}(_0x5dfc,0x1d8));var _0xc5df=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x5dfc[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0xc5df('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5df('0x1'));var moment=require(_0xc5df('0x2'));var BPromise=require(_0xc5df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5df('0x4'));var rimraf=require(_0xc5df('0x5'));var config=require('../../config/environment');var attributes=require(_0xc5df('0x6'));module[_0xc5df('0x7')]=function(_0x33fe5e,_0x2d099d){return _0x33fe5e[_0xc5df('0x8')](_0xc5df('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc5df('0xa'),'fields':[_0xc5df('0xb'),_0xc5df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index eb36d20..a33ef83 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 _0x5d1f=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2d468e,_0x1d81a0){var _0x27df8f=function(_0x180a8d){while(--_0x180a8d){_0x2d468e['push'](_0x2d468e['shift']());}};_0x27df8f(++_0x1d81a0);}(_0x5d1f,0x168));var _0xf5d1=function(_0x43b8d2,_0x51d90a){_0x43b8d2=_0x43b8d2-0x0;var _0x2e87b5=_0x5d1f[_0x43b8d2];return _0x2e87b5;};'use strict';var _=require(_0xf5d1('0x0'));var util=require(_0xf5d1('0x1'));var moment=require(_0xf5d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5d1('0x3'));var fs=require('fs');var Redis=require(_0xf5d1('0x4'));var db=require(_0xf5d1('0x5'))['db'];var utils=require(_0xf5d1('0x6'));var logger=require('../../config/logger')(_0xf5d1('0x7'));var config=require(_0xf5d1('0x8'));var jayson=require(_0xf5d1('0x9'));var client=jayson[_0xf5d1('0xa')][_0xf5d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c024a,_0x1ec8cc,_0x47fc3f){return new BPromise(function(_0x1eb409,_0x4827c8){return client[_0xf5d1('0xc')](_0x4c024a,_0x47fc3f)[_0xf5d1('0xd')](function(_0x2aec92){logger[_0xf5d1('0xe')](_0xf5d1('0xf'),_0x1ec8cc,_0xf5d1('0x10'));logger[_0xf5d1('0x11')](_0xf5d1('0x12'),_0x1ec8cc,_0xf5d1('0x10'),JSON[_0xf5d1('0x13')](_0x2aec92));if(_0x2aec92[_0xf5d1('0x14')]){if(_0x2aec92[_0xf5d1('0x14')]['code']===0x1f4){logger['error'](_0xf5d1('0xf'),_0x1ec8cc,_0x2aec92[_0xf5d1('0x14')]['message']);return _0x4827c8(_0x2aec92[_0xf5d1('0x14')][_0xf5d1('0x15')]);}logger[_0xf5d1('0x14')](_0xf5d1('0xf'),_0x1ec8cc,_0x2aec92['error'][_0xf5d1('0x15')]);return _0x1eb409(_0x2aec92['error'][_0xf5d1('0x15')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1ec8cc,_0xf5d1('0x10'));_0x1eb409(_0x2aec92[_0xf5d1('0x16')][_0xf5d1('0x15')]);}})[_0xf5d1('0x17')](function(_0x29edc8){logger[_0xf5d1('0x14')](_0xf5d1('0xf'),_0x1ec8cc,_0x29edc8);_0x4827c8(_0x29edc8);});});} \ No newline at end of file +var _0x9e07=['error','code','message','UserProfileSection,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0x9e07,0x1cf));var _0x79e0=function(_0x2d1369,_0x45e78a){_0x2d1369=_0x2d1369-0x0;var _0x3ba6e6=_0x9e07[_0x2d1369];return _0x3ba6e6;};'use strict';var _=require(_0x79e0('0x0'));var util=require(_0x79e0('0x1'));var moment=require('moment');var BPromise=require(_0x79e0('0x2'));var rs=require(_0x79e0('0x3'));var fs=require('fs');var Redis=require(_0x79e0('0x4'));var db=require(_0x79e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79e0('0x6'))(_0x79e0('0x7'));var config=require(_0x79e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79e0('0x9')][_0x79e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49d6d5,_0x1fd7cf,_0x581934){return new BPromise(function(_0x445b8c,_0x6b7585){return client[_0x79e0('0xb')](_0x49d6d5,_0x581934)[_0x79e0('0xc')](function(_0x58a0bd){logger[_0x79e0('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x1fd7cf,'request\x20sent');logger[_0x79e0('0xe')](_0x79e0('0xf'),_0x1fd7cf,'request\x20sent',JSON[_0x79e0('0x10')](_0x58a0bd));if(_0x58a0bd[_0x79e0('0x11')]){if(_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1fd7cf,_0x58a0bd[_0x79e0('0x11')]['message']);return _0x6b7585(_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x13')]);}logger[_0x79e0('0x11')](_0x79e0('0x14'),_0x1fd7cf,_0x58a0bd[_0x79e0('0x11')][_0x79e0('0x13')]);return _0x445b8c(_0x58a0bd[_0x79e0('0x11')]['message']);}else{logger[_0x79e0('0xd')](_0x79e0('0x14'),_0x1fd7cf,_0x79e0('0x15'));_0x445b8c(_0x58a0bd[_0x79e0('0x16')][_0x79e0('0x13')]);}})[_0x79e0('0x17')](function(_0x43685c){logger[_0x79e0('0x11')](_0x79e0('0x14'),_0x1fd7cf,_0x43685c);_0x6b7585(_0x43685c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 43ad0d2..c733039 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3cc756,_0x4232cb){var _0x2e261a=function(_0x451b98){while(--_0x451b98){_0x3cc756['push'](_0x3cc756['shift']());}};_0x2e261a(++_0x4232cb);}(_0xe706,0xa3));var _0x6e70=function(_0x34f1c8,_0x12ae31){_0x34f1c8=_0x34f1c8-0x0;var _0x17cbb4=_0xe706[_0x34f1c8];return _0x17cbb4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3690f8,_0x27f95b){var _0xd97dea=function(_0x4273f3){while(--_0x4273f3){_0x3690f8['push'](_0x3690f8['shift']());}};_0xd97dea(++_0x27f95b);}(_0xedd9,0xfc));var _0x9edd=function(_0x59aedf,_0x1e5baa){_0x59aedf=_0x59aedf-0x0;var _0x465a37=_0xedd9[_0x59aedf];return _0x465a37;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('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 9b78044..cab85db 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 _0xf380=['exports','sequelize'];(function(_0x20bf7f,_0xe9dbb6){var _0x497cb5=function(_0x581a98){while(--_0x581a98){_0x20bf7f['push'](_0x20bf7f['shift']());}};_0x497cb5(++_0xe9dbb6);}(_0xf380,0x117));var _0x0f38=function(_0x278787,_0x29c0ab){_0x278787=_0x278787-0x0;var _0x35b596=_0xf380[_0x278787];return _0x35b596;};'use strict';var Sequelize=require(_0x0f38('0x0'));module[_0x0f38('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x84cc=['sequelize','INTEGER'];(function(_0x24f019,_0x50189c){var _0x436cf1=function(_0x2dc7c2){while(--_0x2dc7c2){_0x24f019['push'](_0x24f019['shift']());}};_0x436cf1(++_0x50189c);}(_0x84cc,0x1c6));var _0xc84c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x84cc[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xc84c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc84c('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 7a1b5b4..f1a3455 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 _0x50a5=['util','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x50a5,0xd1));var _0x550a=function(_0x58ac56,_0x1b6047){_0x58ac56=_0x58ac56-0x0;var _0x555e71=_0x50a5[_0x58ac56];return _0x555e71;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5bcdee,_0x416727){_0x5bcdee=_0x5bcdee-0x0;var _0x1e85a4=_0xc6ac[_0x5bcdee];return _0x1e85a4;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2660a7e..33509a5 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 _0xa0ba=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s'];(function(_0x369341,_0x579dea){var _0x13155b=function(_0x921899){while(--_0x921899){_0x369341['push'](_0x369341['shift']());}};_0x13155b(++_0x579dea);}(_0xa0ba,0xc8));var _0xaa0b=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xa0ba[_0x294b6];return _0x38bb97;};'use strict';var _=require(_0xaa0b('0x0'));var util=require(_0xaa0b('0x1'));var moment=require(_0xaa0b('0x2'));var BPromise=require(_0xaa0b('0x3'));var rs=require(_0xaa0b('0x4'));var fs=require('fs');var Redis=require(_0xaa0b('0x5'));var db=require(_0xaa0b('0x6'))['db'];var utils=require(_0xaa0b('0x7'));var logger=require(_0xaa0b('0x8'))(_0xaa0b('0x9'));var config=require(_0xaa0b('0xa'));var jayson=require(_0xaa0b('0xb'));var client=jayson[_0xaa0b('0xc')][_0xaa0b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21b37e,_0x469c26,_0x2d12f1){return new BPromise(function(_0x14695c,_0x35bf94){return client[_0xaa0b('0xe')](_0x21b37e,_0x2d12f1)['then'](function(_0x5814e0){logger['info'](_0xaa0b('0xf'),_0x469c26,_0xaa0b('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x469c26,_0xaa0b('0x10'),JSON[_0xaa0b('0x11')](_0x5814e0));if(_0x5814e0[_0xaa0b('0x12')]){if(_0x5814e0[_0xaa0b('0x12')][_0xaa0b('0x13')]===0x1f4){logger[_0xaa0b('0x12')](_0xaa0b('0xf'),_0x469c26,_0x5814e0[_0xaa0b('0x12')][_0xaa0b('0x14')]);return _0x35bf94(_0x5814e0[_0xaa0b('0x12')]['message']);}logger[_0xaa0b('0x12')](_0xaa0b('0xf'),_0x469c26,_0x5814e0[_0xaa0b('0x12')][_0xaa0b('0x14')]);return _0x14695c(_0x5814e0[_0xaa0b('0x12')]['message']);}else{logger[_0xaa0b('0x15')](_0xaa0b('0xf'),_0x469c26,_0xaa0b('0x10'));_0x14695c(_0x5814e0[_0xaa0b('0x16')][_0xaa0b('0x14')]);}})[_0xaa0b('0x17')](function(_0x4329cd){logger['error'](_0xaa0b('0xf'),_0x469c26,_0x4329cd);_0x35bf94(_0x4329cd);});});} \ No newline at end of file +var _0x9495=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x2de0eb,_0x286a1e){var _0x54458b=function(_0x363953){while(--_0x363953){_0x2de0eb['push'](_0x2de0eb['shift']());}};_0x54458b(++_0x286a1e);}(_0x9495,0x186));var _0x5949=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0x9495[_0x3fe2be];return _0x16b3ca;};'use strict';var _=require(_0x5949('0x0'));var util=require('util');var moment=require(_0x5949('0x1'));var BPromise=require(_0x5949('0x2'));var rs=require(_0x5949('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5949('0x4'))['db'];var utils=require(_0x5949('0x5'));var logger=require('../../config/logger')(_0x5949('0x6'));var config=require('../../config/environment');var jayson=require(_0x5949('0x7'));var client=jayson['client'][_0x5949('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38562a,_0x2c99a4,_0x435225){return new BPromise(function(_0x349c44,_0x382920){return client[_0x5949('0x9')](_0x38562a,_0x435225)[_0x5949('0xa')](function(_0x2eab20){logger[_0x5949('0xb')](_0x5949('0xc'),_0x2c99a4,_0x5949('0xd'));logger['debug'](_0x5949('0xe'),_0x2c99a4,_0x5949('0xd'),JSON[_0x5949('0xf')](_0x2eab20));if(_0x2eab20[_0x5949('0x10')]){if(_0x2eab20['error']['code']===0x1f4){logger[_0x5949('0x10')](_0x5949('0xc'),_0x2c99a4,_0x2eab20['error'][_0x5949('0x11')]);return _0x382920(_0x2eab20[_0x5949('0x10')][_0x5949('0x11')]);}logger[_0x5949('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2c99a4,_0x2eab20[_0x5949('0x10')][_0x5949('0x11')]);return _0x349c44(_0x2eab20['error']['message']);}else{logger[_0x5949('0xb')](_0x5949('0xc'),_0x2c99a4,_0x5949('0xd'));_0x349c44(_0x2eab20[_0x5949('0x12')][_0x5949('0x11')]);}})[_0x5949('0x13')](function(_0x2318f0){logger['error'](_0x5949('0xc'),_0x2c99a4,_0x2318f0);_0x382920(_0x2318f0);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b40400d..2502256 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeea1=['exports','INTEGER','sequelize'];(function(_0x5c4e6b,_0x2ba5f1){var _0x204e62=function(_0x4c718c){while(--_0x4c718c){_0x5c4e6b['push'](_0x5c4e6b['shift']());}};_0x204e62(++_0x2ba5f1);}(_0xeea1,0x17f));var _0x1eea=function(_0x23de66,_0x4b669a){_0x23de66=_0x23de66-0x0;var _0x19a16a=_0xeea1[_0x23de66];return _0x19a16a;};'use strict';var Sequelize=require(_0x1eea('0x0'));module[_0x1eea('0x1')]={'UserId':{'type':Sequelize[_0x1eea('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1eea('0x2')]}}; \ No newline at end of file +var _0x2cee=['INTEGER','sequelize','exports'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x2cee,0x6d));var _0xe2ce=function(_0x4811c0,_0x125228){_0x4811c0=_0x4811c0-0x0;var _0x5ddf51=_0x2cee[_0x4811c0];return _0x5ddf51;};'use strict';var Sequelize=require(_0xe2ce('0x0'));module[_0xe2ce('0x1')]={'UserId':{'type':Sequelize[_0xe2ce('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe2ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index bf07a14..4c9f9f9 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x46041f,_0x2ca63e){var _0x5aec89=function(_0x512562){while(--_0x512562){_0x46041f['push'](_0x46041f['shift']());}};_0x5aec89(++_0x2ca63e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x223512,_0x1a0d90){var _0x1f3684=function(_0x55627e){while(--_0x55627e){_0x223512['push'](_0x223512['shift']());}};_0x1f3684(++_0x1a0d90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index d000b7e..7f3a1e2 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2969a3,_0x801e59){var _0x40f909=function(_0x3f0a17){while(--_0x3f0a17){_0x2969a3['push'](_0x2969a3['shift']());}};_0x40f909(++_0x801e59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2fdc81,_0x3dbe8e){var _0x4bd8f7=function(_0x594709){while(--_0x594709){_0x2fdc81['push'](_0x2fdc81['shift']());}};_0x4bd8f7(++_0x3dbe8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3ba822c..b231353 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 _0x4634=['INTEGER','sequelize'];(function(_0x39c341,_0x2f47ff){var _0x58f61e=function(_0x101e79){while(--_0x101e79){_0x39c341['push'](_0x39c341['shift']());}};_0x58f61e(++_0x2f47ff);}(_0x4634,0x163));var _0x4463=function(_0xc7091a,_0x4dc27b){_0xc7091a=_0xc7091a-0x0;var _0x4517f6=_0x4634[_0xc7091a];return _0x4517f6;};'use strict';var Sequelize=require(_0x4463('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4463('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4584=['INTEGER','exports'];(function(_0x2e661e,_0x4e45fb){var _0x3349de=function(_0x340510){while(--_0x340510){_0x2e661e['push'](_0x2e661e['shift']());}};_0x3349de(++_0x4e45fb);}(_0x4584,0x18b));var _0x4458=function(_0x38642c,_0x45a9b6){_0x38642c=_0x38642c-0x0;var _0x1d7856=_0x4584[_0x38642c];return _0x1d7856;};'use strict';var Sequelize=require('sequelize');module[_0x4458('0x0')]={'penalty':{'type':Sequelize[_0x4458('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3d1ddf7..3520cd5 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 _0xc4fc=['request-promise','path','rimraf','../../config/environment','define','UserVoiceQueue','util','../../config/logger','api','bluebird'];(function(_0x1002d3,_0x3b12ad){var _0x4fc93a=function(_0x2f2e46){while(--_0x2f2e46){_0x1002d3['push'](_0x1002d3['shift']());}};_0x4fc93a(++_0x3b12ad);}(_0xc4fc,0x1d2));var _0xcc4f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xc4fc[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0xcc4f('0x0'));var logger=require(_0xcc4f('0x1'))(_0xcc4f('0x2'));var moment=require('moment');var BPromise=require(_0xcc4f('0x3'));var rp=require(_0xcc4f('0x4'));var fs=require('fs');var path=require(_0xcc4f('0x5'));var rimraf=require(_0xcc4f('0x6'));var config=require(_0xcc4f('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x1f2f37,_0x11d5c3){return _0x1f2f37[_0xcc4f('0x8')](_0xcc4f('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb93b=['define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x13e34c,_0xc1ab89){var _0x4191da=function(_0x197952){while(--_0x197952){_0x13e34c['push'](_0x13e34c['shift']());}};_0x4191da(++_0xc1ab89);}(_0xb93b,0x147));var _0xbb93=function(_0x285b48,_0x41b4c6){_0x285b48=_0x285b48-0x0;var _0x5020e9=_0xb93b[_0x285b48];return _0x5020e9;};'use strict';var _=require('lodash');var util=require(_0xbb93('0x0'));var logger=require(_0xbb93('0x1'))(_0xbb93('0x2'));var moment=require(_0xbb93('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb93('0x4'));var fs=require('fs');var path=require(_0xbb93('0x5'));var rimraf=require(_0xbb93('0x6'));var config=require(_0xbb93('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xbb93('0x8')]=function(_0x367ba0,_0x9ac840){return _0x367ba0[_0xbb93('0x9')](_0xbb93('0xa'),attributes,{'tableName':_0xbb93('0xb'),'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 d3650dc..39e3b62 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 _0x38f3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4df953,_0x35e0f8){var _0x33ba9f=function(_0x5d8105){while(--_0x5d8105){_0x4df953['push'](_0x4df953['shift']());}};_0x33ba9f(++_0x35e0f8);}(_0x38f3,0x134));var _0x338f=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0x38f3[_0x4a1e96];return _0x5acea9;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var moment=require(_0x338f('0x2'));var BPromise=require(_0x338f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x338f('0x4'));var db=require(_0x338f('0x5'))['db'];var utils=require(_0x338f('0x6'));var logger=require(_0x338f('0x7'))(_0x338f('0x8'));var config=require('../../config/environment');var jayson=require(_0x338f('0x9'));var client=jayson[_0x338f('0xa')][_0x338f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eb29b,_0x3644db,_0x42832e){return new BPromise(function(_0x21f36f,_0x5b524b){return client[_0x338f('0xc')](_0x2eb29b,_0x42832e)[_0x338f('0xd')](function(_0x335f0d){logger[_0x338f('0xe')](_0x338f('0xf'),_0x3644db,'request\x20sent');logger['debug'](_0x338f('0x10'),_0x3644db,_0x338f('0x11'),JSON[_0x338f('0x12')](_0x335f0d));if(_0x335f0d[_0x338f('0x13')]){if(_0x335f0d[_0x338f('0x13')][_0x338f('0x14')]===0x1f4){logger[_0x338f('0x13')](_0x338f('0xf'),_0x3644db,_0x335f0d[_0x338f('0x13')][_0x338f('0x15')]);return _0x5b524b(_0x335f0d['error']['message']);}logger[_0x338f('0x13')](_0x338f('0xf'),_0x3644db,_0x335f0d[_0x338f('0x13')][_0x338f('0x15')]);return _0x21f36f(_0x335f0d[_0x338f('0x13')]['message']);}else{logger[_0x338f('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x3644db,_0x338f('0x11'));_0x21f36f(_0x335f0d[_0x338f('0x16')][_0x338f('0x15')]);}})[_0x338f('0x17')](function(_0x316599){logger[_0x338f('0x13')](_0x338f('0xf'),_0x3644db,_0x316599);_0x5b524b(_0x316599);});});} \ No newline at end of file +var _0xdaae=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x515e2c,_0x5d9e61){var _0xadc630=function(_0x8486e9){while(--_0x8486e9){_0x515e2c['push'](_0x515e2c['shift']());}};_0xadc630(++_0x5d9e61);}(_0xdaae,0x110));var _0xedaa=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0xdaae[_0x5a9fb9];return _0x110430;};'use strict';var _=require(_0xedaa('0x0'));var util=require(_0xedaa('0x1'));var moment=require(_0xedaa('0x2'));var BPromise=require(_0xedaa('0x3'));var rs=require(_0xedaa('0x4'));var fs=require('fs');var Redis=require(_0xedaa('0x5'));var db=require(_0xedaa('0x6'))['db'];var utils=require(_0xedaa('0x7'));var logger=require('../../config/logger')(_0xedaa('0x8'));var config=require(_0xedaa('0x9'));var jayson=require(_0xedaa('0xa'));var client=jayson[_0xedaa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b5e3,_0x1cafc7,_0x52d373){return new BPromise(function(_0x5a8aa9,_0x3ef8b0){return client[_0xedaa('0xc')](_0x36b5e3,_0x52d373)['then'](function(_0x4b7358){logger[_0xedaa('0xd')](_0xedaa('0xe'),_0x1cafc7,'request\x20sent');logger[_0xedaa('0xf')](_0xedaa('0x10'),_0x1cafc7,_0xedaa('0x11'),JSON[_0xedaa('0x12')](_0x4b7358));if(_0x4b7358[_0xedaa('0x13')]){if(_0x4b7358[_0xedaa('0x13')][_0xedaa('0x14')]===0x1f4){logger[_0xedaa('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x1cafc7,_0x4b7358[_0xedaa('0x13')][_0xedaa('0x15')]);return _0x3ef8b0(_0x4b7358[_0xedaa('0x13')][_0xedaa('0x15')]);}logger['error'](_0xedaa('0xe'),_0x1cafc7,_0x4b7358['error'][_0xedaa('0x15')]);return _0x5a8aa9(_0x4b7358[_0xedaa('0x13')]['message']);}else{logger[_0xedaa('0xd')](_0xedaa('0xe'),_0x1cafc7,_0xedaa('0x11'));_0x5a8aa9(_0x4b7358[_0xedaa('0x16')][_0xedaa('0x15')]);}})[_0xedaa('0x17')](function(_0x4a3174){logger[_0xedaa('0x13')](_0xedaa('0xe'),_0x1cafc7,_0x4a3174);_0x3ef8b0(_0x4a3174);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index bafc9da..99f48e8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5f1979,_0x19567c){var _0xca1c19=function(_0x1e2760){while(--_0x1e2760){_0x5f1979['push'](_0x5f1979['shift']());}};_0xca1c19(++_0x19567c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2d1451,_0x5c5cf9){var _0x231908=function(_0xe7955d){while(--_0xe7955d){_0x2d1451['push'](_0x2d1451['shift']());}};_0x231908(++_0x5c5cf9);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7a65663..2dd41c4 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 _0x844e=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x2e9077,_0x32c9d5){var _0x118bea=function(_0x1317c3){while(--_0x1317c3){_0x2e9077['push'](_0x2e9077['shift']());}};_0x118bea(++_0x32c9d5);}(_0x844e,0x7c));var _0xe844=function(_0x5894fd,_0x5cc5b6){_0x5894fd=_0x5894fd-0x0;var _0x34cf6a=_0x844e[_0x5894fd];return _0x34cf6a;};'use strict';var Sequelize=require(_0xe844('0x0'));module[_0xe844('0x1')]={'uniqueid':{'type':Sequelize[_0xe844('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe844('0x3')},'membername':{'type':Sequelize[_0xe844('0x4')],'allowNull':![],'comment':_0xe844('0x3')},'UserId':{'type':Sequelize[_0xe844('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe844('0x4')],'allowNull':![],'unique':_0xe844('0x5'),'comment':_0xe844('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe844('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xe844('0x4')],'allowNull':![],'unique':_0xe844('0x5'),'comment':_0xe844('0x3')},'penalty':{'type':Sequelize[_0xe844('0x2')](0xb),'defaultValue':0x0,'comment':_0xe844('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe844('0x3')}}; \ No newline at end of file +var _0x864a=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x864a,0x172));var _0xa864=function(_0x146a9c,_0x350c07){_0x146a9c=_0x146a9c-0x0;var _0x1943a0=_0x864a[_0x146a9c];return _0x1943a0;};'use strict';var Sequelize=require(_0xa864('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa864('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa864('0x2')},'membername':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'comment':_0xa864('0x2')},'UserId':{'type':Sequelize[_0xa864('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'unique':_0xa864('0x4'),'comment':_0xa864('0x2')},'VoiceQueueId':{'type':Sequelize[_0xa864('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xa864('0x3')],'allowNull':![],'unique':_0xa864('0x4'),'comment':_0xa864('0x2')},'penalty':{'type':Sequelize[_0xa864('0x1')](0xb),'defaultValue':0x0,'comment':_0xa864('0x2')},'paused':{'type':Sequelize[_0xa864('0x1')](0xb),'defaultValue':0x0,'comment':_0xa864('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f6b43ea..8a54eb1 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 _0x866f=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x866f,0xe7));var _0xf866=function(_0x1c8b26,_0x476fb8){_0x1c8b26=_0x1c8b26-0x0;var _0x478147=_0x866f[_0x1c8b26];return _0x478147;};'use strict';var EventEmitter=require(_0xf866('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf866('0x1')](0x0);var events={'afterCreate':_0xf866('0x2'),'afterUpdate':_0xf866('0x3'),'afterDestroy':_0xf866('0x4')};function emitEvent(_0x488f57){return function(_0xa2aa3c,_0x2de601,_0x34523f){UserVoiceQueueRtEvents[_0xf866('0x5')](_0x488f57+':'+_0xa2aa3c['id'],_0xa2aa3c);UserVoiceQueueRtEvents[_0xf866('0x5')](_0x488f57,_0xa2aa3c);_0x34523f(null);};}for(var e in events){if(events[_0xf866('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xf866('0x7')](e,emitEvent(event));}}module[_0xf866('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xcb5c=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x5d293d,_0x5a6e7e){var _0x10386b=function(_0x7c3e25){while(--_0x7c3e25){_0x5d293d['push'](_0x5d293d['shift']());}};_0x10386b(++_0x5a6e7e);}(_0xcb5c,0x182));var _0xccb5=function(_0x187769,_0x59385d){_0x187769=_0x187769-0x0;var _0x46da28=_0xcb5c[_0x187769];return _0x46da28;};'use strict';var EventEmitter=require(_0xccb5('0x0'));var UserVoiceQueueRt=require(_0xccb5('0x1'))['db'][_0xccb5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xccb5('0x3')](0x0);var events={'afterCreate':_0xccb5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9ffd38){return function(_0x120ce6,_0xb3afcf,_0x1f6615){UserVoiceQueueRtEvents[_0xccb5('0x5')](_0x9ffd38+':'+_0x120ce6['id'],_0x120ce6);UserVoiceQueueRtEvents[_0xccb5('0x5')](_0x9ffd38,_0x120ce6);_0x1f6615(null);};}for(var e in events){if(events[_0xccb5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xccb5('0x7')](e,emitEvent(event));}}module[_0xccb5('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5a894e3..227c9b9 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 _0x46be=['bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x46be,0xf9));var _0xe46b=function(_0x5ae325,_0x1652b4){_0x5ae325=_0x5ae325-0x0;var _0x542ffe=_0x46be[_0x5ae325];return _0x542ffe;};'use strict';var _=require('lodash');var util=require(_0xe46b('0x0'));var logger=require('../../config/logger')(_0xe46b('0x1'));var moment=require(_0xe46b('0x2'));var BPromise=require(_0xe46b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe46b('0x4'));var rimraf=require(_0xe46b('0x5'));var config=require(_0xe46b('0x6'));var attributes=require(_0xe46b('0x7'));module[_0xe46b('0x8')]=function(_0x2ce97e,_0x7986c8){return _0x2ce97e[_0xe46b('0x9')](_0xe46b('0xa'),attributes,{'tableName':_0xe46b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3e4=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x48cbfc,_0x1d067f){var _0x392a9d=function(_0x1dcfce){while(--_0x1dcfce){_0x48cbfc['push'](_0x48cbfc['shift']());}};_0x392a9d(++_0x1d067f);}(_0xd3e4,0x1e6));var _0x4d3e=function(_0x4e4529,_0x33f07b){_0x4e4529=_0x4e4529-0x0;var _0x100460=_0xd3e4[_0x4e4529];return _0x100460;};'use strict';var _=require(_0x4d3e('0x0'));var util=require('util');var logger=require(_0x4d3e('0x1'))('api');var moment=require(_0x4d3e('0x2'));var BPromise=require(_0x4d3e('0x3'));var rp=require(_0x4d3e('0x4'));var fs=require('fs');var path=require(_0x4d3e('0x5'));var rimraf=require(_0x4d3e('0x6'));var config=require(_0x4d3e('0x7'));var attributes=require(_0x4d3e('0x8'));module['exports']=function(_0xade955,_0xa91da5){return _0xade955[_0x4d3e('0x9')](_0x4d3e('0xa'),attributes,{'tableName':_0x4d3e('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 df466d6..a021235 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 _0x3621=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x3621,0x147));var _0x1362=function(_0xdd985d,_0x45666d){_0xdd985d=_0xdd985d-0x0;var _0x115bf5=_0x3621[_0xdd985d];return _0x115bf5;};'use strict';var _=require(_0x1362('0x0'));var util=require(_0x1362('0x1'));var moment=require(_0x1362('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1362('0x3'))['db'];var utils=require(_0x1362('0x4'));var logger=require(_0x1362('0x5'))(_0x1362('0x6'));var config=require(_0x1362('0x7'));var jayson=require(_0x1362('0x8'));var client=jayson[_0x1362('0x9')]['http']({'port':0x232a});config[_0x1362('0xa')]=_[_0x1362('0xb')](config[_0x1362('0xa')],{'host':_0x1362('0xc'),'port':0x18eb});var socket=require(_0x1362('0xd'))(new Redis(config['redis']));require(_0x1362('0xe'))[_0x1362('0xf')](socket);function respondWithRpcPromise(_0x2aac3d,_0x396bd3,_0x232b97){return new BPromise(function(_0x2e8ea1,_0x25819c){return client[_0x1362('0x10')](_0x2aac3d,_0x232b97)[_0x1362('0x11')](function(_0x550e2b){logger[_0x1362('0x12')](_0x1362('0x13'),_0x396bd3,_0x1362('0x14'));logger[_0x1362('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x396bd3,'request\x20sent',JSON[_0x1362('0x16')](_0x550e2b));if(_0x550e2b[_0x1362('0x17')]){if(_0x550e2b[_0x1362('0x17')]['code']===0x1f4){logger[_0x1362('0x17')](_0x1362('0x13'),_0x396bd3,_0x550e2b[_0x1362('0x17')]['message']);return _0x25819c(_0x550e2b[_0x1362('0x17')][_0x1362('0x18')]);}logger[_0x1362('0x17')](_0x1362('0x13'),_0x396bd3,_0x550e2b[_0x1362('0x17')]['message']);return _0x2e8ea1(_0x550e2b['error'][_0x1362('0x18')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x396bd3,_0x1362('0x14'));_0x2e8ea1(_0x550e2b[_0x1362('0x19')][_0x1362('0x18')]);}})[_0x1362('0x1a')](function(_0x206b14){logger[_0x1362('0x17')](_0x1362('0x13'),_0x396bd3,_0x206b14);_0x25819c(_0x206b14);});});}exports[_0x1362('0x1b')]=function(_0x11176d){var _0x49d20e=this;return new Promise(function(_0x59e66f,_0x7d5f8f){return db[_0x1362('0x1c')][_0x1362('0x1d')]({'raw':_0x11176d[_0x1362('0x1e')]?_0x11176d['options'][_0x1362('0x1f')]===undefined?!![]:![]:!![],'where':_0x11176d['options']?_0x11176d[_0x1362('0x1e')][_0x1362('0x20')]||null:null,'attributes':[[db[_0x1362('0x21')]['fn'](_0x1362('0x22'),db[_0x1362('0x21')]['fn']('IF',db['sequelize'][_0x1362('0x23')](_0x1362('0x24')))),'outboundQueuePauses']]})['then'](function(_0x170f43){logger[_0x1362('0x12')](_0x1362('0x1b'),_0x11176d);logger[_0x1362('0x15')](_0x1362('0x1b'),_0x11176d,JSON['stringify'](_0x170f43));_0x59e66f(_0x170f43);})[_0x1362('0x1a')](function(_0x1f7d2d){logger[_0x1362('0x17')]('GetVoiceQueueRtPauses',_0x1f7d2d[_0x1362('0x18')],_0x11176d);_0x7d5f8f(_0x49d20e[_0x1362('0x17')](0x1f4,_0x1f7d2d[_0x1362('0x18')]));});});}; \ No newline at end of file +var _0x8df8=['options','where','sequelize','COUNT','literal','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x12fe24,_0x4061cd){var _0x309501=function(_0x2c91d8){while(--_0x2c91d8){_0x12fe24['push'](_0x12fe24['shift']());}};_0x309501(++_0x4061cd);}(_0x8df8,0x1ef));var _0x88df=function(_0x4b216b,_0xa2909c){_0x4b216b=_0x4b216b-0x0;var _0x375163=_0x8df8[_0x4b216b];return _0x375163;};'use strict';var _=require(_0x88df('0x0'));var util=require(_0x88df('0x1'));var moment=require(_0x88df('0x2'));var BPromise=require('bluebird');var rs=require(_0x88df('0x3'));var fs=require('fs');var Redis=require(_0x88df('0x4'));var db=require(_0x88df('0x5'))['db'];var utils=require(_0x88df('0x6'));var logger=require(_0x88df('0x7'))(_0x88df('0x8'));var config=require(_0x88df('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x88df('0xa')][_0x88df('0xb')]({'port':0x232a});config['redis']=_[_0x88df('0xc')](config['redis'],{'host':_0x88df('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x88df('0xe'))[_0x88df('0xf')](socket);function respondWithRpcPromise(_0x205d0e,_0x1f21ba,_0x3e480c){return new BPromise(function(_0x47319e,_0x502eb8){return client['request'](_0x205d0e,_0x3e480c)[_0x88df('0x10')](function(_0x95acfc){logger[_0x88df('0x11')](_0x88df('0x12'),_0x1f21ba,'request\x20sent');logger[_0x88df('0x13')](_0x88df('0x14'),_0x1f21ba,'request\x20sent',JSON[_0x88df('0x15')](_0x95acfc));if(_0x95acfc[_0x88df('0x16')]){if(_0x95acfc['error'][_0x88df('0x17')]===0x1f4){logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);return _0x502eb8(_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);}logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x95acfc['error']['message']);return _0x47319e(_0x95acfc[_0x88df('0x16')][_0x88df('0x18')]);}else{logger['info'](_0x88df('0x12'),_0x1f21ba,_0x88df('0x19'));_0x47319e(_0x95acfc['result'][_0x88df('0x18')]);}})[_0x88df('0x1a')](function(_0x4d62a1){logger[_0x88df('0x16')](_0x88df('0x12'),_0x1f21ba,_0x4d62a1);_0x502eb8(_0x4d62a1);});});}exports[_0x88df('0x1b')]=function(_0x148ae4){var _0x471d7f=this;return new Promise(function(_0x28a4a6,_0x53018f){return db[_0x88df('0x1c')][_0x88df('0x1d')]({'raw':_0x148ae4[_0x88df('0x1e')]?_0x148ae4[_0x88df('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x148ae4[_0x88df('0x1e')]?_0x148ae4['options'][_0x88df('0x1f')]||null:null,'attributes':[[db[_0x88df('0x20')]['fn'](_0x88df('0x21'),db['sequelize']['fn']('IF',db[_0x88df('0x20')][_0x88df('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x88df('0x10')](function(_0x43a2ba){logger[_0x88df('0x11')]('GetVoiceQueueRtPauses',_0x148ae4);logger[_0x88df('0x13')](_0x88df('0x1b'),_0x148ae4,JSON['stringify'](_0x43a2ba));_0x28a4a6(_0x43a2ba);})[_0x88df('0x1a')](function(_0x258348){logger[_0x88df('0x16')](_0x88df('0x1b'),_0x258348[_0x88df('0x18')],_0x148ae4);_0x53018f(_0x471d7f[_0x88df('0x16')](0x1f4,_0x258348[_0x88df('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5821aa4..2371401 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 _0x095b=['update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x095b,0x6e));var _0xb095=function(_0x5823f4,_0xcc5679){_0x5823f4=_0x5823f4-0x0;var _0x315ba5=_0x095b[_0x5823f4];return _0x315ba5;};'use strict';var UserVoiceQueueRtEvents=require(_0xb095('0x0'));var events=['save',_0xb095('0x1'),_0xb095('0x2')];function createListener(_0x3e60de,_0x33ef98){return function(_0x33888f){_0x33ef98['emit'](_0x3e60de,_0x33888f);};}function removeListener(_0x1a42a5,_0x25f040){return function(){UserVoiceQueueRtEvents[_0xb095('0x3')](_0x1a42a5,_0x25f040);};}exports[_0xb095('0x4')]=function(_0x10a03d){for(var _0x3e4cc9=0x0,_0x24deed=events[_0xb095('0x5')];_0x3e4cc9<_0x24deed;_0x3e4cc9++){var _0x39fc96=events[_0x3e4cc9];var _0x47a5eb=createListener(_0xb095('0x6')+_0x39fc96,_0x10a03d);UserVoiceQueueRtEvents['on'](_0x39fc96,_0x47a5eb);}}; \ No newline at end of file +var _0x5c1f=['emit','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5c1f[_0x247fa1];return _0x244f35;};'use strict';var UserVoiceQueueRtEvents=require(_0xf5c1('0x0'));var events=['save',_0xf5c1('0x1'),_0xf5c1('0x2')];function createListener(_0x5dc804,_0x245264){return function(_0xcc7e35){_0x245264[_0xf5c1('0x3')](_0x5dc804,_0xcc7e35);};}function removeListener(_0x51ea7a,_0x5c0515){return function(){UserVoiceQueueRtEvents['removeListener'](_0x51ea7a,_0x5c0515);};}exports[_0xf5c1('0x4')]=function(_0x3a7475){for(var _0x52e4cb=0x0,_0x34a073=events[_0xf5c1('0x5')];_0x52e4cb<_0x34a073;_0x52e4cb++){var _0x12128b=events[_0x52e4cb];var _0x40cad7=createListener('userVoiceQueueRt:'+_0x12128b,_0x3a7475);UserVoiceQueueRtEvents['on'](_0x12128b,_0x40cad7);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b335957..941a883 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12dfc3,_0x5a1943){var _0x16af1b=function(_0x57097c){while(--_0x57097c){_0x12dfc3['push'](_0x12dfc3['shift']());}};_0x16af1b(++_0x5a1943);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'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 fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x47d060,_0x4a2b1d){var _0xb2d051=function(_0x3434e7){while(--_0x3434e7){_0x47d060['push'](_0x47d060['shift']());}};_0xb2d051(++_0x4a2b1d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b98b655..fb8f2d6 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 _0x5126=['INTEGER','sequelize','exports'];(function(_0x2931c1,_0x2147a4){var _0x16cdb5=function(_0x43b0c4){while(--_0x43b0c4){_0x2931c1['push'](_0x2931c1['shift']());}};_0x16cdb5(++_0x2147a4);}(_0x5126,0x7c));var _0x6512=function(_0x3608b8,_0x46c433){_0x3608b8=_0x3608b8-0x0;var _0x28901a=_0x5126[_0x3608b8];return _0x28901a;};'use strict';var Sequelize=require(_0x6512('0x0'));module[_0x6512('0x1')]={'penalty':{'type':Sequelize[_0x6512('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c43=['sequelize','exports'];(function(_0x1f9a44,_0x572d0f){var _0xed2749=function(_0x39546e){while(--_0x39546e){_0x1f9a44['push'](_0x1f9a44['shift']());}};_0xed2749(++_0x572d0f);}(_0x2c43,0x128));var _0x32c4=function(_0x2350d7,_0x5ee5d1){_0x2350d7=_0x2350d7-0x0;var _0xe0be2f=_0x2c43[_0x2350d7];return _0xe0be2f;};'use strict';var Sequelize=require(_0x32c4('0x0'));module[_0x32c4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 0a734a9..368c8ba 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 _0xcf30=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x42cba2,_0x37a071){var _0x2e098f=function(_0x5a123e){while(--_0x5a123e){_0x42cba2['push'](_0x42cba2['shift']());}};_0x2e098f(++_0x37a071);}(_0xcf30,0x1ec));var _0x0cf3=function(_0x4f98c1,_0xdf9a4b){_0x4f98c1=_0x4f98c1-0x0;var _0x208da4=_0xcf30[_0x4f98c1];return _0x208da4;};'use strict';var _=require('lodash');var util=require(_0x0cf3('0x0'));var logger=require(_0x0cf3('0x1'))(_0x0cf3('0x2'));var moment=require('moment');var BPromise=require(_0x0cf3('0x3'));var rp=require(_0x0cf3('0x4'));var fs=require('fs');var path=require(_0x0cf3('0x5'));var rimraf=require(_0x0cf3('0x6'));var config=require(_0x0cf3('0x7'));var attributes=require(_0x0cf3('0x8'));module['exports']=function(_0x19ed48,_0x2a928b){return _0x19ed48[_0x0cf3('0x9')](_0x0cf3('0xa'),attributes,{'tableName':_0x0cf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e6=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','api','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x1967b8,_0x2ce618){var _0xeacbb7=function(_0x4e5c73){while(--_0x4e5c73){_0x1967b8['push'](_0x1967b8['shift']());}};_0xeacbb7(++_0x2ce618);}(_0xc1e6,0xe0));var _0x6c1e=function(_0x1c19b6,_0xddf7cc){_0x1c19b6=_0x1c19b6-0x0;var _0x59d560=_0xc1e6[_0x1c19b6];return _0x59d560;};'use strict';var _=require('lodash');var util=require(_0x6c1e('0x0'));var logger=require('../../config/logger')(_0x6c1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c1e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c1e('0x3'));var config=require(_0x6c1e('0x4'));var attributes=require(_0x6c1e('0x5'));module[_0x6c1e('0x6')]=function(_0x1aa07c,_0x3550c4){return _0x1aa07c[_0x6c1e('0x7')](_0x6c1e('0x8'),attributes,{'tableName':_0x6c1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 4a8088d..4b1d34f 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 _0x2cf1=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x8a2e04,_0x2ec12d){var _0x8688e8=function(_0x29a2f8){while(--_0x29a2f8){_0x8a2e04['push'](_0x8a2e04['shift']());}};_0x8688e8(++_0x2ec12d);}(_0x2cf1,0xe7));var _0x12cf=function(_0x516fec,_0x4ffb5d){_0x516fec=_0x516fec-0x0;var _0x492032=_0x2cf1[_0x516fec];return _0x492032;};'use strict';var _=require(_0x12cf('0x0'));var util=require(_0x12cf('0x1'));var moment=require(_0x12cf('0x2'));var BPromise=require(_0x12cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12cf('0x4'));var db=require(_0x12cf('0x5'))['db'];var utils=require(_0x12cf('0x6'));var logger=require(_0x12cf('0x7'))(_0x12cf('0x8'));var config=require(_0x12cf('0x9'));var jayson=require(_0x12cf('0xa'));var client=jayson['client'][_0x12cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5365db,_0x5cd1c8,_0x23b6f2){return new BPromise(function(_0xfc34b8,_0x3b7a04){return client[_0x12cf('0xc')](_0x5365db,_0x23b6f2)[_0x12cf('0xd')](function(_0x3af014){logger[_0x12cf('0xe')](_0x12cf('0xf'),_0x5cd1c8,_0x12cf('0x10'));logger[_0x12cf('0x11')](_0x12cf('0x12'),_0x5cd1c8,_0x12cf('0x10'),JSON[_0x12cf('0x13')](_0x3af014));if(_0x3af014[_0x12cf('0x14')]){if(_0x3af014[_0x12cf('0x14')]['code']===0x1f4){logger[_0x12cf('0x14')](_0x12cf('0xf'),_0x5cd1c8,_0x3af014[_0x12cf('0x14')][_0x12cf('0x15')]);return _0x3b7a04(_0x3af014['error'][_0x12cf('0x15')]);}logger[_0x12cf('0x14')](_0x12cf('0xf'),_0x5cd1c8,_0x3af014[_0x12cf('0x14')][_0x12cf('0x15')]);return _0xfc34b8(_0x3af014[_0x12cf('0x14')][_0x12cf('0x15')]);}else{logger[_0x12cf('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5cd1c8,_0x12cf('0x10'));_0xfc34b8(_0x3af014['result'][_0x12cf('0x15')]);}})[_0x12cf('0x16')](function(_0x2162ca){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x5cd1c8,_0x2162ca);_0x3b7a04(_0x2162ca);});});} \ No newline at end of file +var _0x4288=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x161212,_0x38dd6f){var _0x368b24=function(_0x5da9f7){while(--_0x5da9f7){_0x161212['push'](_0x161212['shift']());}};_0x368b24(++_0x38dd6f);}(_0x4288,0x1e2));var _0x8428=function(_0x5b2219,_0x30fae9){_0x5b2219=_0x5b2219-0x0;var _0x6a4978=_0x4288[_0x5b2219];return _0x6a4978;};'use strict';var _=require(_0x8428('0x0'));var util=require('util');var moment=require(_0x8428('0x1'));var BPromise=require('bluebird');var rs=require(_0x8428('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8428('0x3'))['db'];var utils=require(_0x8428('0x4'));var logger=require(_0x8428('0x5'))(_0x8428('0x6'));var config=require(_0x8428('0x7'));var jayson=require(_0x8428('0x8'));var client=jayson[_0x8428('0x9')][_0x8428('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b566,_0x4291aa,_0x5b3cfd){return new BPromise(function(_0x51b04b,_0xac7ecb){return client[_0x8428('0xb')](_0x27b566,_0x5b3cfd)[_0x8428('0xc')](function(_0x5aef7b){logger[_0x8428('0xd')](_0x8428('0xe'),_0x4291aa,_0x8428('0xf'));logger[_0x8428('0x10')](_0x8428('0x11'),_0x4291aa,'request\x20sent',JSON['stringify'](_0x5aef7b));if(_0x5aef7b[_0x8428('0x12')]){if(_0x5aef7b[_0x8428('0x12')][_0x8428('0x13')]===0x1f4){logger['error'](_0x8428('0xe'),_0x4291aa,_0x5aef7b['error'][_0x8428('0x14')]);return _0xac7ecb(_0x5aef7b[_0x8428('0x12')][_0x8428('0x14')]);}logger[_0x8428('0x12')](_0x8428('0xe'),_0x4291aa,_0x5aef7b[_0x8428('0x12')]['message']);return _0x51b04b(_0x5aef7b[_0x8428('0x12')][_0x8428('0x14')]);}else{logger[_0x8428('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4291aa,_0x8428('0xf'));_0x51b04b(_0x5aef7b['result']['message']);}})['catch'](function(_0x31796e){logger[_0x8428('0x12')](_0x8428('0xe'),_0x4291aa,_0x31796e);_0xac7ecb(_0x31796e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f32038e..7f80d66 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 _0xe2cc=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x434c1e,_0x365109){var _0x5232e5=function(_0x28cfdc){while(--_0x28cfdc){_0x434c1e['push'](_0x434c1e['shift']());}};_0x5232e5(++_0x365109);}(_0xe2cc,0x69));var _0xce2c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe2cc[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce2c('0x2'));var router=express[_0xce2c('0x3')]();var fs_extra=require(_0xce2c('0x4'));var auth=require(_0xce2c('0x5'));var interaction=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var controller=require(_0xce2c('0x8'));router[_0xce2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce2c('0x9')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xc')]);router[_0xce2c('0xd')]('/',auth[_0xce2c('0xb')](),controller['create']);router[_0xce2c('0xe')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xf')]);router[_0xce2c('0x10')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x11')]);module[_0xce2c('0x12')]=router; \ No newline at end of file +var _0xc718=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0xc718,0xb6));var _0x8c71=function(_0x4df6bd,_0x30d543){_0x4df6bd=_0x4df6bd-0x0;var _0x322dcb=_0xc718[_0x4df6bd];return _0x322dcb;};'use strict';var multer=require(_0x8c71('0x0'));var util=require('util');var path=require(_0x8c71('0x1'));var timeout=require(_0x8c71('0x2'));var express=require('express');var router=express[_0x8c71('0x3')]();var fs_extra=require(_0x8c71('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c71('0x5'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8c71('0x6')]);router['get'](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0x9')]);router[_0x8c71('0xa')]('/',auth[_0x8c71('0x8')](),controller['create']);router[_0x8c71('0xb')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0xc')]);router[_0x8c71('0xd')](_0x8c71('0x7'),auth[_0x8c71('0x8')](),controller[_0x8c71('0xe')]);module[_0x8c71('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c3f2555..61f3f5f 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 _0x96b2=['name','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x96b2,0x1cf));var _0x296b=function(_0x130be4,_0x5a27c9){_0x130be4=_0x130be4-0x0;var _0x27b6b6=_0x96b2[_0x130be4];return _0x27b6b6;};'use strict';var Sequelize=require('sequelize');module[_0x296b('0x0')]={'name':{'type':Sequelize[_0x296b('0x1')],'unique':_0x296b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5034=['sequelize','exports','STRING'];(function(_0x4e5af7,_0x373dca){var _0x8e6750=function(_0x3ec8d6){while(--_0x3ec8d6){_0x4e5af7['push'](_0x4e5af7['shift']());}};_0x8e6750(++_0x373dca);}(_0x5034,0x8d));var _0x4503=function(_0x4d9fae,_0x3bf732){_0x4d9fae=_0x4d9fae-0x0;var _0x17e846=_0x5034[_0x4d9fae];return _0x17e846;};'use strict';var Sequelize=require(_0x4503('0x0'));module[_0x4503('0x1')]={'name':{'type':Sequelize[_0x4503('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4503('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d006611..98eb4fd 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 _0xfe67=['fields','nolimit','order','sort','where','filters','filter','merge','Variable','includeAll','include','findAll','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','index','fieldName','type','model','map','query','keys','intersection','attributes'];(function(_0x14324d,_0x35d433){var _0x4cb586=function(_0x25f3a9){while(--_0x25f3a9){_0x14324d['push'](_0x14324d['shift']());}};_0x4cb586(++_0x35d433);}(_0xfe67,0x10a));var _0x7fe6=function(_0x1bf0b4,_0x4d7375){_0x1bf0b4=_0x1bf0b4-0x0;var _0x42fd7e=_0xfe67[_0x1bf0b4];return _0x42fd7e;};'use strict';var emlformat=require(_0x7fe6('0x0'));var rimraf=require(_0x7fe6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe6('0x2'));var rp=require(_0x7fe6('0x3'));var moment=require(_0x7fe6('0x4'));var BPromise=require(_0x7fe6('0x5'));var Mustache=require(_0x7fe6('0x6'));var util=require(_0x7fe6('0x7'));var path=require(_0x7fe6('0x8'));var sox=require(_0x7fe6('0x9'));var csv=require(_0x7fe6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fe6('0xb'));var squel=require(_0x7fe6('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fe6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7fe6('0xa'));var querystring=require(_0x7fe6('0xe'));var Papa=require(_0x7fe6('0xf'));var Redis=require(_0x7fe6('0x10'));var authService=require(_0x7fe6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7fe6('0x12'));var hardwareService=require(_0x7fe6('0x13'));var logger=require(_0x7fe6('0x14'))(_0x7fe6('0x15'));var utils=require(_0x7fe6('0x16'));var config=require(_0x7fe6('0x17'));var licenseUtil=require(_0x7fe6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d64e,_0x3210bc){_0x3210bc=_0x3210bc||0xcc;return function(_0x5f45fc){if(_0x5f45fc){return _0x11d64e['sendStatus'](_0x3210bc);}return _0x11d64e[_0x7fe6('0x19')](_0x3210bc)[_0x7fe6('0x1a')]();};}function respondWithResult(_0x238efb,_0x15284b){_0x15284b=_0x15284b||0xc8;return function(_0x553a92){if(_0x553a92){return _0x238efb[_0x7fe6('0x19')](_0x15284b)['json'](_0x553a92);}};}function respondWithFilteredResult(_0x4a2dd,_0x5c21da){return function(_0x4dcdf9){if(_0x4dcdf9){var _0x2ed610=typeof _0x5c21da[_0x7fe6('0x1b')]==='undefined'&&typeof _0x5c21da[_0x7fe6('0x1c')]===_0x7fe6('0x1d');var _0x4f3e27=_0x4dcdf9[_0x7fe6('0x1e')];var _0x24d169=_0x2ed610?0x0:_0x5c21da['offset'];var _0x118cc1=_0x2ed610?_0x4dcdf9[_0x7fe6('0x1e')]:_0x5c21da[_0x7fe6('0x1b')]+_0x5c21da['limit'];var _0xdb61b1;if(_0x118cc1>=_0x4f3e27){_0x118cc1=_0x4f3e27;_0xdb61b1=0xc8;}else{_0xdb61b1=0xce;}_0x4a2dd[_0x7fe6('0x19')](_0xdb61b1);return _0x4a2dd[_0x7fe6('0x1f')]('Content-Range',_0x24d169+'-'+_0x118cc1+'/'+_0x4f3e27)[_0x7fe6('0x20')](_0x4dcdf9);}return null;};}function patchUpdates(_0x7c87b6){return function(_0x16d9f3){try{jsonpatch[_0x7fe6('0x21')](_0x16d9f3,_0x7c87b6,!![]);}catch(_0x2a8072){return BPromise[_0x7fe6('0x22')](_0x2a8072);}return _0x16d9f3[_0x7fe6('0x23')]();};}function saveUpdates(_0x1ed966,_0x25f64f){return function(_0x42ba26){if(_0x42ba26){return _0x42ba26[_0x7fe6('0x24')](_0x1ed966)['then'](function(_0x4414e4){return _0x4414e4;});}return null;};}function removeEntity(_0x15af7f,_0x419ff1){return function(_0x354a46){if(_0x354a46){return _0x354a46[_0x7fe6('0x25')]()[_0x7fe6('0x26')](function(){var _0x2e4401=_0x354a46[_0x7fe6('0x27')]({'plain':!![]});var _0x433c60='Variables';return db[_0x7fe6('0x28')]['destroy']({'where':{'type':_0x433c60,'resourceId':_0x2e4401['id']}})[_0x7fe6('0x26')](function(){return _0x354a46;});})[_0x7fe6('0x26')](function(){_0x15af7f[_0x7fe6('0x19')](0xcc)[_0x7fe6('0x1a')]();});}};}function handleEntityNotFound(_0x1bfe3b,_0x462f7d){return function(_0x5e6e58){if(!_0x5e6e58){_0x1bfe3b[_0x7fe6('0x29')](0x194);}return _0x5e6e58;};}function handleError(_0x3864f1,_0xb85b3e){_0xb85b3e=_0xb85b3e||0x1f4;return function(_0x429d26){logger[_0x7fe6('0x2a')](_0x429d26[_0x7fe6('0x2b')]);if(_0x429d26[_0x7fe6('0x2c')]){delete _0x429d26[_0x7fe6('0x2c')];}_0x3864f1[_0x7fe6('0x19')](_0xb85b3e)['send'](_0x429d26);};}exports[_0x7fe6('0x2d')]=function(_0x32c2df,_0x27b006){var _0x324cdc={},_0x3ad1c6={},_0x1371c0={'count':0x0,'rows':[]};var _0x4ab0c5=_['map'](db['Variable']['rawAttributes'],function(_0x3bff70){return{'name':_0x3bff70[_0x7fe6('0x2e')],'type':_0x3bff70[_0x7fe6('0x2f')]['key']};});_0x3ad1c6[_0x7fe6('0x30')]=_[_0x7fe6('0x31')](_0x4ab0c5,'name');_0x3ad1c6[_0x7fe6('0x32')]=_[_0x7fe6('0x33')](_0x32c2df['query']);_0x3ad1c6['filters']=_[_0x7fe6('0x34')](_0x3ad1c6[_0x7fe6('0x30')],_0x3ad1c6[_0x7fe6('0x32')]);_0x324cdc[_0x7fe6('0x35')]=_['intersection'](_0x3ad1c6[_0x7fe6('0x30')],qs[_0x7fe6('0x36')](_0x32c2df[_0x7fe6('0x32')]['fields']));_0x324cdc[_0x7fe6('0x35')]=_0x324cdc[_0x7fe6('0x35')]['length']?_0x324cdc['attributes']:_0x3ad1c6[_0x7fe6('0x30')];if(!_0x32c2df[_0x7fe6('0x32')]['hasOwnProperty'](_0x7fe6('0x37'))){_0x324cdc[_0x7fe6('0x1c')]=qs[_0x7fe6('0x1c')](_0x32c2df['query'][_0x7fe6('0x1c')]);_0x324cdc[_0x7fe6('0x1b')]=qs['offset'](_0x32c2df['query'][_0x7fe6('0x1b')]);}_0x324cdc[_0x7fe6('0x38')]=qs['sort'](_0x32c2df['query'][_0x7fe6('0x39')]);_0x324cdc[_0x7fe6('0x3a')]=qs[_0x7fe6('0x3b')](_['pick'](_0x32c2df['query'],_0x3ad1c6[_0x7fe6('0x3b')]),_0x4ab0c5);if(_0x32c2df['query'][_0x7fe6('0x3c')]){_0x324cdc[_0x7fe6('0x3a')]=_[_0x7fe6('0x3d')](_0x324cdc['where'],{'$or':_[_0x7fe6('0x31')](_0x4ab0c5,function(_0x5b56b0){if(_0x5b56b0['type']!=='VIRTUAL'){var _0x29a9de={};_0x29a9de[_0x5b56b0['name']]={'$like':'%'+_0x32c2df[_0x7fe6('0x32')]['filter']+'%'};return _0x29a9de;}})});}_0x324cdc=_[_0x7fe6('0x3d')]({},_0x324cdc,_0x32c2df['options']);var _0x51e499={'where':_0x324cdc[_0x7fe6('0x3a')]};return db[_0x7fe6('0x3e')][_0x7fe6('0x1e')](_0x51e499)[_0x7fe6('0x26')](function(_0xbabf3a){_0x1371c0[_0x7fe6('0x1e')]=_0xbabf3a;if(_0x32c2df[_0x7fe6('0x32')][_0x7fe6('0x3f')]){_0x324cdc[_0x7fe6('0x40')]=[{'all':!![]}];}return db[_0x7fe6('0x3e')][_0x7fe6('0x41')](_0x324cdc);})['then'](function(_0x258c5b){_0x1371c0['rows']=_0x258c5b;return _0x1371c0;})[_0x7fe6('0x26')](respondWithFilteredResult(_0x27b006,_0x324cdc))[_0x7fe6('0x42')](handleError(_0x27b006,null));};exports[_0x7fe6('0x43')]=function(_0x4ba23b,_0x5ea702){var _0x5f3c08={'raw':!![],'where':{'id':_0x4ba23b[_0x7fe6('0x44')]['id']}},_0x592038={};_0x592038[_0x7fe6('0x30')]=_[_0x7fe6('0x33')](db[_0x7fe6('0x3e')]['rawAttributes']);_0x592038['query']=_[_0x7fe6('0x33')](_0x4ba23b[_0x7fe6('0x32')]);_0x592038['filters']=_[_0x7fe6('0x34')](_0x592038[_0x7fe6('0x30')],_0x592038[_0x7fe6('0x32')]);_0x5f3c08[_0x7fe6('0x35')]=_[_0x7fe6('0x34')](_0x592038['model'],qs[_0x7fe6('0x36')](_0x4ba23b[_0x7fe6('0x32')][_0x7fe6('0x36')]));_0x5f3c08[_0x7fe6('0x35')]=_0x5f3c08[_0x7fe6('0x35')][_0x7fe6('0x45')]?_0x5f3c08['attributes']:_0x592038[_0x7fe6('0x30')];if(_0x4ba23b[_0x7fe6('0x32')][_0x7fe6('0x3f')]){_0x5f3c08[_0x7fe6('0x40')]=[{'all':!![]}];}_0x5f3c08=_[_0x7fe6('0x3d')]({},_0x5f3c08,_0x4ba23b[_0x7fe6('0x46')]);return db[_0x7fe6('0x3e')][_0x7fe6('0x47')](_0x5f3c08)[_0x7fe6('0x26')](handleEntityNotFound(_0x5ea702,null))['then'](respondWithResult(_0x5ea702,null))[_0x7fe6('0x42')](handleError(_0x5ea702,null));};exports[_0x7fe6('0x48')]=function(_0x182167,_0x544fc7){return db[_0x7fe6('0x3e')]['create'](_0x182167[_0x7fe6('0x49')],{})[_0x7fe6('0x26')](function(_0x88e428){var _0x35ab0f=_0x182167[_0x7fe6('0x4a')][_0x7fe6('0x27')]({'plain':!![]});if(!_0x35ab0f)throw new Error(_0x7fe6('0x4b'));if(_0x35ab0f['role']===_0x7fe6('0x4a')){var _0x13b6b4=_0x88e428[_0x7fe6('0x27')]({'plain':!![]});var _0xe40eba=_0x7fe6('0x4c');return db[_0x7fe6('0x4d')]['find']({'where':{'name':_0xe40eba,'userProfileId':_0x35ab0f[_0x7fe6('0x4e')]},'raw':!![]})['then'](function(_0x1d9bbe){if(_0x1d9bbe&&_0x1d9bbe['autoAssociation']===0x0){return db['UserProfileResource'][_0x7fe6('0x48')]({'name':_0x13b6b4['name'],'resourceId':_0x13b6b4['id'],'type':_0x1d9bbe[_0x7fe6('0x2c')],'sectionId':_0x1d9bbe['id']},{})[_0x7fe6('0x26')](function(){return _0x88e428;});}else{return _0x88e428;}})[_0x7fe6('0x42')](function(_0x418ea2){logger[_0x7fe6('0x2a')](_0x7fe6('0x4f'),_0x418ea2);throw _0x418ea2;});}return _0x88e428;})[_0x7fe6('0x26')](respondWithResult(_0x544fc7,0xc9))['catch'](handleError(_0x544fc7,null));};exports[_0x7fe6('0x24')]=function(_0x1659b1,_0x451dc7){if(_0x1659b1[_0x7fe6('0x49')]['id']){delete _0x1659b1[_0x7fe6('0x49')]['id'];}return db['Variable'][_0x7fe6('0x47')]({'where':{'id':_0x1659b1['params']['id']}})[_0x7fe6('0x26')](handleEntityNotFound(_0x451dc7,null))['then'](saveUpdates(_0x1659b1[_0x7fe6('0x49')],null))['then'](respondWithResult(_0x451dc7,null))[_0x7fe6('0x42')](handleError(_0x451dc7,null));};exports[_0x7fe6('0x25')]=function(_0x1b0495,_0x3cd79a){return db[_0x7fe6('0x3e')][_0x7fe6('0x47')]({'where':{'id':_0x1b0495['params']['id']}})[_0x7fe6('0x26')](handleEntityNotFound(_0x3cd79a,null))['then'](removeEntity(_0x3cd79a,null))['catch'](handleError(_0x3cd79a,null));}; \ No newline at end of file +var _0x4e9e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','then','get','Variables','UserProfileResource','stack','name','send','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4e9e,0x132));var _0xe4e9=function(_0xf3c843,_0x8ff24e){_0xf3c843=_0xf3c843-0x0;var _0x3191c6=_0x4e9e[_0xf3c843];return _0x3191c6;};'use strict';var emlformat=require(_0xe4e9('0x0'));var rimraf=require(_0xe4e9('0x1'));var zipdir=require(_0xe4e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe4e9('0x4'));var util=require(_0xe4e9('0x5'));var path=require(_0xe4e9('0x6'));var sox=require(_0xe4e9('0x7'));var csv=require('to-csv');var ejs=require(_0xe4e9('0x8'));var fs=require('fs');var fs_extra=require(_0xe4e9('0x9'));var _=require(_0xe4e9('0xa'));var squel=require(_0xe4e9('0xb'));var crypto=require(_0xe4e9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4e9('0xd'));var toCsv=require(_0xe4e9('0xe'));var querystring=require('querystring');var Papa=require(_0xe4e9('0xf'));var Redis=require(_0xe4e9('0x10'));var authService=require(_0xe4e9('0x11'));var qs=require(_0xe4e9('0x12'));var as=require(_0xe4e9('0x13'));var hardwareService=require(_0xe4e9('0x14'));var logger=require('../../config/logger')(_0xe4e9('0x15'));var utils=require(_0xe4e9('0x16'));var config=require(_0xe4e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e9('0x18'))['db'];function respondWithStatusCode(_0x58fcca,_0x2b089b){_0x2b089b=_0x2b089b||0xcc;return function(_0x4e4dc4){if(_0x4e4dc4){return _0x58fcca[_0xe4e9('0x19')](_0x2b089b);}return _0x58fcca['status'](_0x2b089b)[_0xe4e9('0x1a')]();};}function respondWithResult(_0x154ae2,_0xaa5314){_0xaa5314=_0xaa5314||0xc8;return function(_0x8ce314){if(_0x8ce314){return _0x154ae2[_0xe4e9('0x1b')](_0xaa5314)['json'](_0x8ce314);}};}function respondWithFilteredResult(_0x14efbc,_0x3d8ea3){return function(_0x394b58){if(_0x394b58){var _0x118c86=typeof _0x3d8ea3['offset']===_0xe4e9('0x1c')&&typeof _0x3d8ea3[_0xe4e9('0x1d')]===_0xe4e9('0x1c');var _0x55cfd5=_0x394b58[_0xe4e9('0x1e')];var _0x2f4433=_0x118c86?0x0:_0x3d8ea3[_0xe4e9('0x1f')];var _0x4df416=_0x118c86?_0x394b58['count']:_0x3d8ea3[_0xe4e9('0x1f')]+_0x3d8ea3['limit'];var _0x58da97;if(_0x4df416>=_0x55cfd5){_0x4df416=_0x55cfd5;_0x58da97=0xc8;}else{_0x58da97=0xce;}_0x14efbc[_0xe4e9('0x1b')](_0x58da97);return _0x14efbc[_0xe4e9('0x20')]('Content-Range',_0x2f4433+'-'+_0x4df416+'/'+_0x55cfd5)[_0xe4e9('0x21')](_0x394b58);}return null;};}function patchUpdates(_0x2d01b5){return function(_0x39e4ca){try{jsonpatch[_0xe4e9('0x22')](_0x39e4ca,_0x2d01b5,!![]);}catch(_0x2a1533){return BPromise['reject'](_0x2a1533);}return _0x39e4ca['save']();};}function saveUpdates(_0x3920e5,_0x56f672){return function(_0x468d97){if(_0x468d97){return _0x468d97['update'](_0x3920e5)['then'](function(_0x4b4221){return _0x4b4221;});}return null;};}function removeEntity(_0x13c760,_0x4140a3){return function(_0x3769bc){if(_0x3769bc){return _0x3769bc['destroy']()[_0xe4e9('0x23')](function(){var _0xa49088=_0x3769bc[_0xe4e9('0x24')]({'plain':!![]});var _0x2cf3ed=_0xe4e9('0x25');return db[_0xe4e9('0x26')]['destroy']({'where':{'type':_0x2cf3ed,'resourceId':_0xa49088['id']}})[_0xe4e9('0x23')](function(){return _0x3769bc;});})[_0xe4e9('0x23')](function(){_0x13c760['status'](0xcc)[_0xe4e9('0x1a')]();});}};}function handleEntityNotFound(_0x1ce50c,_0x327215){return function(_0x5072aa){if(!_0x5072aa){_0x1ce50c[_0xe4e9('0x19')](0x194);}return _0x5072aa;};}function handleError(_0x5bd71e,_0x1b6003){_0x1b6003=_0x1b6003||0x1f4;return function(_0x19f650){logger['error'](_0x19f650[_0xe4e9('0x27')]);if(_0x19f650[_0xe4e9('0x28')]){delete _0x19f650['name'];}_0x5bd71e[_0xe4e9('0x1b')](_0x1b6003)[_0xe4e9('0x29')](_0x19f650);};}exports['index']=function(_0x5d8c79,_0x289ab3){var _0x4c0b21={},_0x32c049={},_0x5a8eeb={'count':0x0,'rows':[]};var _0x251c74=_[_0xe4e9('0x2a')](db[_0xe4e9('0x2b')][_0xe4e9('0x2c')],function(_0x4b8d4e){return{'name':_0x4b8d4e[_0xe4e9('0x2d')],'type':_0x4b8d4e[_0xe4e9('0x2e')]['key']};});_0x32c049[_0xe4e9('0x2f')]=_[_0xe4e9('0x2a')](_0x251c74,_0xe4e9('0x28'));_0x32c049[_0xe4e9('0x30')]=_[_0xe4e9('0x31')](_0x5d8c79['query']);_0x32c049[_0xe4e9('0x32')]=_[_0xe4e9('0x33')](_0x32c049[_0xe4e9('0x2f')],_0x32c049[_0xe4e9('0x30')]);_0x4c0b21[_0xe4e9('0x34')]=_[_0xe4e9('0x33')](_0x32c049[_0xe4e9('0x2f')],qs[_0xe4e9('0x35')](_0x5d8c79[_0xe4e9('0x30')]['fields']));_0x4c0b21[_0xe4e9('0x34')]=_0x4c0b21[_0xe4e9('0x34')]['length']?_0x4c0b21[_0xe4e9('0x34')]:_0x32c049['model'];if(!_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x36')]('nolimit')){_0x4c0b21[_0xe4e9('0x1d')]=qs['limit'](_0x5d8c79[_0xe4e9('0x30')]['limit']);_0x4c0b21[_0xe4e9('0x1f')]=qs[_0xe4e9('0x1f')](_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x1f')]);}_0x4c0b21[_0xe4e9('0x37')]=qs[_0xe4e9('0x38')](_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x38')]);_0x4c0b21[_0xe4e9('0x39')]=qs['filters'](_[_0xe4e9('0x3a')](_0x5d8c79[_0xe4e9('0x30')],_0x32c049[_0xe4e9('0x32')]),_0x251c74);if(_0x5d8c79['query']['filter']){_0x4c0b21[_0xe4e9('0x39')]=_[_0xe4e9('0x3b')](_0x4c0b21[_0xe4e9('0x39')],{'$or':_[_0xe4e9('0x2a')](_0x251c74,function(_0x58ec08){if(_0x58ec08['type']!=='VIRTUAL'){var _0x1e55dd={};_0x1e55dd[_0x58ec08['name']]={'$like':'%'+_0x5d8c79[_0xe4e9('0x30')][_0xe4e9('0x3c')]+'%'};return _0x1e55dd;}})});}_0x4c0b21=_[_0xe4e9('0x3b')]({},_0x4c0b21,_0x5d8c79['options']);var _0x2347bb={'where':_0x4c0b21[_0xe4e9('0x39')]};return db[_0xe4e9('0x2b')][_0xe4e9('0x1e')](_0x2347bb)[_0xe4e9('0x23')](function(_0x43cfc4){_0x5a8eeb[_0xe4e9('0x1e')]=_0x43cfc4;if(_0x5d8c79['query'][_0xe4e9('0x3d')]){_0x4c0b21[_0xe4e9('0x3e')]=[{'all':!![]}];}return db[_0xe4e9('0x2b')][_0xe4e9('0x3f')](_0x4c0b21);})[_0xe4e9('0x23')](function(_0x5e0ee7){_0x5a8eeb[_0xe4e9('0x40')]=_0x5e0ee7;return _0x5a8eeb;})[_0xe4e9('0x23')](respondWithFilteredResult(_0x289ab3,_0x4c0b21))['catch'](handleError(_0x289ab3,null));};exports[_0xe4e9('0x41')]=function(_0xbc1d2d,_0x2050ec){var _0x3d5840={'raw':!![],'where':{'id':_0xbc1d2d[_0xe4e9('0x42')]['id']}},_0x27fbcf={};_0x27fbcf[_0xe4e9('0x2f')]=_[_0xe4e9('0x31')](db[_0xe4e9('0x2b')][_0xe4e9('0x2c')]);_0x27fbcf[_0xe4e9('0x30')]=_[_0xe4e9('0x31')](_0xbc1d2d['query']);_0x27fbcf[_0xe4e9('0x32')]=_[_0xe4e9('0x33')](_0x27fbcf[_0xe4e9('0x2f')],_0x27fbcf[_0xe4e9('0x30')]);_0x3d5840['attributes']=_['intersection'](_0x27fbcf['model'],qs[_0xe4e9('0x35')](_0xbc1d2d['query'][_0xe4e9('0x35')]));_0x3d5840[_0xe4e9('0x34')]=_0x3d5840[_0xe4e9('0x34')][_0xe4e9('0x43')]?_0x3d5840[_0xe4e9('0x34')]:_0x27fbcf[_0xe4e9('0x2f')];if(_0xbc1d2d['query'][_0xe4e9('0x3d')]){_0x3d5840[_0xe4e9('0x3e')]=[{'all':!![]}];}_0x3d5840=_[_0xe4e9('0x3b')]({},_0x3d5840,_0xbc1d2d['options']);return db[_0xe4e9('0x2b')][_0xe4e9('0x44')](_0x3d5840)[_0xe4e9('0x23')](handleEntityNotFound(_0x2050ec,null))['then'](respondWithResult(_0x2050ec,null))[_0xe4e9('0x45')](handleError(_0x2050ec,null));};exports[_0xe4e9('0x46')]=function(_0x564ad8,_0x9b8da9){return db[_0xe4e9('0x2b')][_0xe4e9('0x46')](_0x564ad8['body'],{})[_0xe4e9('0x23')](function(_0x5dea7f){var _0x14b70a=_0x564ad8[_0xe4e9('0x47')]['get']({'plain':!![]});if(!_0x14b70a)throw new Error(_0xe4e9('0x48'));if(_0x14b70a[_0xe4e9('0x49')]==='user'){var _0x14ca53=_0x5dea7f[_0xe4e9('0x24')]({'plain':!![]});var _0x27647b=_0xe4e9('0x25');return db[_0xe4e9('0x4a')]['find']({'where':{'name':_0x27647b,'userProfileId':_0x14b70a[_0xe4e9('0x4b')]},'raw':!![]})[_0xe4e9('0x23')](function(_0x1ff250){if(_0x1ff250&&_0x1ff250[_0xe4e9('0x4c')]===0x0){return db[_0xe4e9('0x26')][_0xe4e9('0x46')]({'name':_0x14ca53[_0xe4e9('0x28')],'resourceId':_0x14ca53['id'],'type':_0x1ff250['name'],'sectionId':_0x1ff250['id']},{})[_0xe4e9('0x23')](function(){return _0x5dea7f;});}else{return _0x5dea7f;}})[_0xe4e9('0x45')](function(_0xc06dd8){logger[_0xe4e9('0x4d')](_0xe4e9('0x4e'),_0xc06dd8);throw _0xc06dd8;});}return _0x5dea7f;})[_0xe4e9('0x23')](respondWithResult(_0x9b8da9,0xc9))['catch'](handleError(_0x9b8da9,null));};exports['update']=function(_0x5ed5f5,_0x339b32){if(_0x5ed5f5[_0xe4e9('0x4f')]['id']){delete _0x5ed5f5['body']['id'];}return db[_0xe4e9('0x2b')]['find']({'where':{'id':_0x5ed5f5[_0xe4e9('0x42')]['id']}})[_0xe4e9('0x23')](handleEntityNotFound(_0x339b32,null))[_0xe4e9('0x23')](saveUpdates(_0x5ed5f5['body'],null))[_0xe4e9('0x23')](respondWithResult(_0x339b32,null))[_0xe4e9('0x45')](handleError(_0x339b32,null));};exports[_0xe4e9('0x50')]=function(_0x57553c,_0x5d41cb){return db[_0xe4e9('0x2b')][_0xe4e9('0x44')]({'where':{'id':_0x57553c['params']['id']}})[_0xe4e9('0x23')](handleEntityNotFound(_0x5d41cb,null))[_0xe4e9('0x23')](removeEntity(_0x5d41cb,null))[_0xe4e9('0x45')](handleError(_0x5d41cb,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8b6a3de..6a0e638 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 _0x2cec=['tools_variables','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x2cec,0x1ae));var _0xc2ce=function(_0x136060,_0x3d5690){_0x136060=_0x136060-0x0;var _0xf035f9=_0x2cec[_0x136060];return _0xf035f9;};'use strict';var _=require(_0xc2ce('0x0'));var util=require('util');var logger=require(_0xc2ce('0x1'))(_0xc2ce('0x2'));var moment=require(_0xc2ce('0x3'));var BPromise=require(_0xc2ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2ce('0x5'));var rimraf=require('rimraf');var config=require(_0xc2ce('0x6'));var attributes=require(_0xc2ce('0x7'));module[_0xc2ce('0x8')]=function(_0x122ed6,_0x4015ef){return _0x122ed6[_0xc2ce('0x9')]('Variable',attributes,{'tableName':_0xc2ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1194=['../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x348bd3,_0x16c57d){var _0x3de464=function(_0x55203c){while(--_0x55203c){_0x348bd3['push'](_0x348bd3['shift']());}};_0x3de464(++_0x16c57d);}(_0x1194,0x1d9));var _0x4119=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x1194[_0x34919b];return _0x505b56;};'use strict';var _=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var logger=require(_0x4119('0x2'))(_0x4119('0x3'));var moment=require(_0x4119('0x4'));var BPromise=require(_0x4119('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4119('0x6'));var rimraf=require('rimraf');var config=require(_0x4119('0x7'));var attributes=require(_0x4119('0x8'));module[_0x4119('0x9')]=function(_0x311b8b,_0x5c60aa){return _0x311b8b['define'](_0x4119('0xa'),attributes,{'tableName':_0x4119('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c6b0591..84a2917 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0xe53f73,_0x1df0d5){var _0x373a31=function(_0x43f6ab){while(--_0x43f6ab){_0xe53f73['push'](_0xe53f73['shift']());}};_0x373a31(++_0x1df0d5);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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']('Variable,\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['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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'];(function(_0x5bece3,_0x53fbe0){var _0x208326=function(_0x5036df){while(--_0x5036df){_0x5bece3['push'](_0x5bece3['shift']());}};_0x208326(++_0x53fbe0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x13cd20,_0x1d9211){_0x13cd20=_0x13cd20-0x0;var _0x22b6de=_0x7fbe[_0x13cd20];return _0x22b6de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d95fea1..de876cb 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 _0x41cd=['index','/fetch','isAuthenticated','canUpdate','/reset','pull','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x2c684b,_0x55b624){var _0x4c4965=function(_0x469dd7){while(--_0x469dd7){_0x2c684b['push'](_0x2c684b['shift']());}};_0x4c4965(++_0x55b624);}(_0x41cd,0x1e9));var _0xd41c=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0x41cd[_0x54dcad];return _0x537c56;};'use strict';var express=require(_0xd41c('0x0'));var router=express[_0xd41c('0x1')]();var auth=require(_0xd41c('0x2'));var controller=require(_0xd41c('0x3'));router[_0xd41c('0x4')]('/',controller[_0xd41c('0x5')]);router[_0xd41c('0x4')](_0xd41c('0x6'),auth[_0xd41c('0x7')](),auth[_0xd41c('0x8')](),controller['fetch']);router[_0xd41c('0x4')](_0xd41c('0x9'),auth[_0xd41c('0x7')](),auth[_0xd41c('0x8')](),controller['reset']);router['get']('/pull',auth[_0xd41c('0x7')](),auth[_0xd41c('0x8')](),controller[_0xd41c('0xa')]);router[_0xd41c('0x4')]('/restart',auth[_0xd41c('0x7')](),controller['restart']);router[_0xd41c('0x4')](_0xd41c('0xb'),controller['migrations']);module[_0xd41c('0xc')]=router; \ No newline at end of file +var _0x3fa3=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated'];(function(_0x57f1a3,_0xdb8a32){var _0x24b255=function(_0xac3f58){while(--_0xac3f58){_0x57f1a3['push'](_0x57f1a3['shift']());}};_0x24b255(++_0xdb8a32);}(_0x3fa3,0x9a));var _0x33fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fa3[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x33fa('0x0'));var router=express['Router']();var auth=require(_0x33fa('0x1'));var controller=require(_0x33fa('0x2'));router[_0x33fa('0x3')]('/',controller['index']);router[_0x33fa('0x3')](_0x33fa('0x4'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0x7')]);router[_0x33fa('0x3')](_0x33fa('0x8'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0x9')]);router['get'](_0x33fa('0xa'),auth[_0x33fa('0x5')](),auth[_0x33fa('0x6')](),controller[_0x33fa('0xb')]);router[_0x33fa('0x3')](_0x33fa('0xc'),auth[_0x33fa('0x5')](),controller[_0x33fa('0xd')]);router[_0x33fa('0x3')](_0x33fa('0xe'),controller['migrations']);module[_0x33fa('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 1e3dfb6..2555388 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 _0x4a1b=['.js','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','exports','version','latest','fetch','tags','2.0.0','status','json','origin','master','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','motion2','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','length','replace'];(function(_0x5cfaf8,_0x36f7ed){var _0x19f3f1=function(_0x1db5c6){while(--_0x1db5c6){_0x5cfaf8['push'](_0x5cfaf8['shift']());}};_0x19f3f1(++_0x36f7ed);}(_0x4a1b,0xdd));var _0xb4a1=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x4a1b[_0x4b12ae];return _0x16957b;};'use strict';var Umzug=require(_0xb4a1('0x0'));var path=require(_0xb4a1('0x1'));var fs=require('fs');var _=require(_0xb4a1('0x2'));var pkginfo=require(_0xb4a1('0x3'))(module,'version');var compareVersions=require(_0xb4a1('0x4'));var exec=require(_0xb4a1('0x5'))['exec'];var db=require(_0xb4a1('0x6'))['db'];var config=require(_0xb4a1('0x7'));var pm2=require(_0xb4a1('0x8'));var logger=require('../../config/logger')(_0xb4a1('0x9'));var git=require(_0xb4a1('0xa'))(config[_0xb4a1('0xb')]);exports['index']=function(_0x46d170,_0x8e4201){var _0x3a7da8={'current':module[_0xb4a1('0xc')][_0xb4a1('0xd')],'phonebar':0x2};if(_0x46d170['query']&&_0x46d170['query'][_0xb4a1('0xe')]){return git[_0xb4a1('0xf')]()[_0xb4a1('0x10')](function(_0x3dcb72,_0x502762){_0x3a7da8[_0xb4a1('0xe')]=(_0x3dcb72?module[_0xb4a1('0xc')][_0xb4a1('0xd')]:_0x502762['latest'])||_0xb4a1('0x11');return _0x8e4201[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')](_0x3a7da8);});}else{return _0x8e4201[_0xb4a1('0x12')](0xc8)['json'](_0x3a7da8);}};exports['fetch']=function(_0x3206fa,_0x334018){return git[_0xb4a1('0xf')]([_0xb4a1('0x14'),_0xb4a1('0x15')],function(_0x107637){if(_0x107637){logger['error'](_0x107637);return _0x334018[_0xb4a1('0x12')](0x1f4)['json'](_0x107637);}logger[_0xb4a1('0x16')]('git\x20fetch');return _0x334018[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xb4a1('0x17')]=function(_0x3f7ca5,_0x233a5c){return git[_0xb4a1('0x17')]([_0xb4a1('0x18'),_0xb4a1('0x19')],function(_0x134adb){if(_0x134adb){logger['error'](_0x134adb);return _0x233a5c['status'](0x1f4)[_0xb4a1('0x13')](_0x134adb);}logger['info'](_0xb4a1('0x1a'));return _0x233a5c[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':_0xb4a1('0x1b')});});};exports[_0xb4a1('0x1c')]=function(_0x21df3b,_0x475e1b){exec(_0xb4a1('0x1d'),function(_0x423ee6,_0x5b2c03,_0x1ba1ff){logger[_0xb4a1('0x16')](_0x5b2c03);logger[_0xb4a1('0x16')](_0x1ba1ff);if(_0x423ee6){logger[_0xb4a1('0x1e')](_0x423ee6);return _0x475e1b[_0xb4a1('0x12')](0x1f4)['json'](_0x423ee6);}return _0x475e1b[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':_0x5b2c03});});};exports[_0xb4a1('0x1f')]=function(_0x3a35dd,_0x91581d){return pm2[_0xb4a1('0x1f')](_0xb4a1('0x20'))['then'](function(_0x37d533){logger[_0xb4a1('0x16')](_0xb4a1('0x21'),_0x37d533);return _0x91581d[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x8370fc){logger[_0xb4a1('0x1e')](_0x8370fc);return _0x91581d['status'](0x1f4)[_0xb4a1('0x13')](_0x8370fc);});};exports[_0xb4a1('0x22')]=function(_0x5a6cba,_0x1f4df3){var _0x1c3a03=fs[_0xb4a1('0x23')](path[_0xb4a1('0x24')](config[_0xb4a1('0xb')],'server',_0xb4a1('0x22')));var _0x4a922c=[];for(var _0x1a5934=0x0;_0x1a5934<_0x1c3a03[_0xb4a1('0x25')];_0x1a5934++){var _0x5789fe=_0x1c3a03[_0x1a5934][_0xb4a1('0x26')](_0xb4a1('0x27'),'');if(compareVersions(module['exports'][_0xb4a1('0xd')],_0x5789fe)===-0x1){_0x4a922c['push'](_0x5789fe);}}if(_0x4a922c[_0xb4a1('0x25')]){var _0xa7d8d3=_0x4a922c['sort'](compareVersions);var _0x374a0f=new Umzug({'storage':_0xb4a1('0x28'),'storageOptions':{'model':db[_0xb4a1('0x29')],'modelName':_0xb4a1('0x29'),'columnName':_0xb4a1('0xd')},'migrations':{'params':[db[_0xb4a1('0x28')][_0xb4a1('0x2a')](),db['sequelize'][_0xb4a1('0x2b')],function(){throw new Error(_0xb4a1('0x2c'));}],'path':path['join'](config['root'],_0xb4a1('0x2d'),_0xb4a1('0x22')),'pattern':/\.js$/}});_0x374a0f['up']({'migrations':_[_0xb4a1('0x2e')](_0xa7d8d3,function(_0x2228cd){return _0x2228cd+'.js';})})[_0xb4a1('0x2f')](function(){return _0x1f4df3[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':_0xb4a1('0x30')+module[_0xb4a1('0xc')][_0xb4a1('0xd')]+_0xb4a1('0x31')+_[_0xb4a1('0x32')](_0xa7d8d3),'migrations':_[_0xb4a1('0x24')](_0xa7d8d3)});})['catch'](function(_0x4432cb){if(_0x4432cb instanceof db['sequelize'][_0xb4a1('0x33')]){return _0x1f4df3[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x1f4df3[_0xb4a1('0x12')](0x1f4)[_0xb4a1('0x13')](_0x4432cb);}});}else{return _0x1f4df3[_0xb4a1('0x12')](0xc8)[_0xb4a1('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xf943=['npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','exports','push','length','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x4bdb34,_0x58ef2b){var _0x6f3405=function(_0x2b4f6f){while(--_0x2b4f6f){_0x4bdb34['push'](_0x4bdb34['shift']());}};_0x6f3405(++_0x58ef2b);}(_0xf943,0x1a2));var _0x3f94=function(_0x1e69b4,_0x5b369c){_0x1e69b4=_0x1e69b4-0x0;var _0x5f4ccb=_0xf943[_0x1e69b4];return _0x5f4ccb;};'use strict';var Umzug=require(_0x3f94('0x0'));var path=require(_0x3f94('0x1'));var fs=require('fs');var _=require(_0x3f94('0x2'));var pkginfo=require(_0x3f94('0x3'))(module,_0x3f94('0x4'));var compareVersions=require(_0x3f94('0x5'));var exec=require(_0x3f94('0x6'))[_0x3f94('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x3f94('0x8'));var logger=require(_0x3f94('0x9'))(_0x3f94('0xa'));var git=require(_0x3f94('0xb'))(config[_0x3f94('0xc')]);exports[_0x3f94('0xd')]=function(_0x3e13d6,_0x1b9336){var _0x1ea220={'current':module['exports'][_0x3f94('0x4')],'phonebar':0x2};if(_0x3e13d6[_0x3f94('0xe')]&&_0x3e13d6[_0x3f94('0xe')][_0x3f94('0xf')]){return git[_0x3f94('0x10')]()[_0x3f94('0x11')](function(_0xe2abbe,_0x439ab8){_0x1ea220['latest']=(_0xe2abbe?module['exports'][_0x3f94('0x4')]:_0x439ab8[_0x3f94('0xf')])||_0x3f94('0x12');return _0x1b9336['status'](0xc8)['json'](_0x1ea220);});}else{return _0x1b9336[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')](_0x1ea220);}};exports['fetch']=function(_0x231346,_0x5dc234){return git[_0x3f94('0x10')]([_0x3f94('0x15'),'master'],function(_0x2c89e3){if(_0x2c89e3){logger[_0x3f94('0x16')](_0x2c89e3);return _0x5dc234[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x2c89e3);}logger[_0x3f94('0x17')](_0x3f94('0x18'));return _0x5dc234[_0x3f94('0x13')](0xc8)['json']({'output':_0x3f94('0x19')});});};exports[_0x3f94('0x1a')]=function(_0x242e8a,_0x32def1){return git[_0x3f94('0x1a')](['--hard','FETCH_HEAD'],function(_0x45ea40){if(_0x45ea40){logger['error'](_0x45ea40);return _0x32def1[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x45ea40);}logger[_0x3f94('0x17')](_0x3f94('0x1b'));return _0x32def1[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x1c')});});};exports[_0x3f94('0x1d')]=function(_0x1e3151,_0x2aeda3){exec(_0x3f94('0x1e'),function(_0x2c1665,_0x5bc856,_0x424cc9){logger[_0x3f94('0x17')](_0x5bc856);logger['info'](_0x424cc9);if(_0x2c1665){logger['error'](_0x2c1665);return _0x2aeda3[_0x3f94('0x13')](0x1f4)[_0x3f94('0x14')](_0x2c1665);}return _0x2aeda3[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x5bc856});});};exports['restart']=function(_0x5545fe,_0x50d5e2){return pm2[_0x3f94('0x1f')](_0x3f94('0x20'))['then'](function(_0x1a23c0){logger['info'](_0x3f94('0x21'),_0x1a23c0);return _0x50d5e2[_0x3f94('0x13')](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x22')});})[_0x3f94('0x23')](function(_0x41be64){logger[_0x3f94('0x16')](_0x41be64);return _0x50d5e2[_0x3f94('0x13')](0x1f4)['json'](_0x41be64);});};exports[_0x3f94('0x24')]=function(_0x571390,_0x3344a){var _0x31cc30=fs[_0x3f94('0x25')](path[_0x3f94('0x26')](config[_0x3f94('0xc')],_0x3f94('0x27'),_0x3f94('0x24')));var _0x57df27=[];for(var _0x4e5697=0x0;_0x4e5697<_0x31cc30['length'];_0x4e5697++){var _0x4cbe26=_0x31cc30[_0x4e5697][_0x3f94('0x28')](_0x3f94('0x29'),'');if(compareVersions(module[_0x3f94('0x2a')][_0x3f94('0x4')],_0x4cbe26)===-0x1){_0x57df27[_0x3f94('0x2b')](_0x4cbe26);}}if(_0x57df27[_0x3f94('0x2c')]){var _0x5efd90=_0x57df27['sort'](compareVersions);var _0x3af2ad=new Umzug({'storage':_0x3f94('0x2d'),'storageOptions':{'model':db[_0x3f94('0x2e')],'modelName':_0x3f94('0x2e'),'columnName':_0x3f94('0x4')},'migrations':{'params':[db['sequelize'][_0x3f94('0x2f')](),db[_0x3f94('0x2d')]['constructor'],function(){throw new Error(_0x3f94('0x30'));}],'path':path[_0x3f94('0x26')](config[_0x3f94('0xc')],'server',_0x3f94('0x24')),'pattern':/\.js$/}});_0x3af2ad['up']({'migrations':_[_0x3f94('0x31')](_0x5efd90,function(_0x2af69c){return _0x2af69c+_0x3f94('0x29');})})[_0x3f94('0x32')](function(){return _0x3344a['status'](0xc8)[_0x3f94('0x14')]({'output':_0x3f94('0x33')+module[_0x3f94('0x2a')][_0x3f94('0x4')]+_0x3f94('0x34')+_[_0x3f94('0x35')](_0x5efd90),'migrations':_[_0x3f94('0x26')](_0x5efd90)});})['catch'](function(_0x55f704){if(_0x55f704 instanceof db[_0x3f94('0x2d')][_0x3f94('0x36')]){return _0x3344a[_0x3f94('0x13')](0xc8)['json']({'output':_0x3f94('0x37')});}else{return _0x3344a['status'](0x1f4)['json'](_0x55f704);}});}else{return _0x3344a[_0x3f94('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2b0f958..d5449cb 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 _0x2bb7=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get'];(function(_0x154de9,_0x2c7716){var _0x4bd0a5=function(_0x1bbf67){while(--_0x1bbf67){_0x154de9['push'](_0x154de9['shift']());}};_0x4bd0a5(++_0x2c7716);}(_0x2bb7,0xf2));var _0x72bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bb7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x72bb('0x0'));var path=require(_0x72bb('0x1'));var timeout=require(_0x72bb('0x2'));var express=require(_0x72bb('0x3'));var router=express[_0x72bb('0x4')]();var fs_extra=require(_0x72bb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72bb('0x6'));var config=require(_0x72bb('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x72bb('0x8')]);router[_0x72bb('0x9')](_0x72bb('0xa'),auth['isAuthenticated'](),controller[_0x72bb('0xb')]);router['get'](_0x72bb('0xc'),auth[_0x72bb('0xd')](),controller[_0x72bb('0xe')]);router[_0x72bb('0xf')]('/',auth['isAuthenticated'](),controller[_0x72bb('0x10')]);router[_0x72bb('0x11')]('/:id',auth[_0x72bb('0xd')](),controller[_0x72bb('0x12')]);router[_0x72bb('0x13')](_0x72bb('0xc'),auth[_0x72bb('0xd')](),controller['destroy']);module[_0x72bb('0x14')]=router; \ No newline at end of file +var _0x5686=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','delete','/:id','exports','util','connect-timeout','express','Router'];(function(_0x4f4426,_0x37331d){var _0x4715aa=function(_0x366403){while(--_0x366403){_0x4f4426['push'](_0x4f4426['shift']());}};_0x4715aa(++_0x37331d);}(_0x5686,0x1a0));var _0x6568=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0x5686[_0x28258a];return _0x4e968e;};'use strict';var multer=require('multer');var util=require(_0x6568('0x0'));var path=require('path');var timeout=require(_0x6568('0x1'));var express=require(_0x6568('0x2'));var router=express[_0x6568('0x3')]();var fs_extra=require(_0x6568('0x4'));var auth=require(_0x6568('0x5'));var interaction=require(_0x6568('0x6'));var config=require(_0x6568('0x7'));var controller=require(_0x6568('0x8'));router[_0x6568('0x9')]('/',auth[_0x6568('0xa')](),controller['index']);router[_0x6568('0x9')](_0x6568('0xb'),auth[_0x6568('0xa')](),controller[_0x6568('0xc')]);router[_0x6568('0x9')]('/:id',auth[_0x6568('0xa')](),controller[_0x6568('0xd')]);router[_0x6568('0xe')]('/',auth[_0x6568('0xa')](),controller[_0x6568('0xf')]);router[_0x6568('0x10')]('/:id',auth[_0x6568('0xa')](),controller['update']);router[_0x6568('0x11')](_0x6568('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x6568('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 2739369..1d4a1c6 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 _0xa064=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x53e6ca,_0x173260){var _0x1b14b8=function(_0x1ec25f){while(--_0x1ec25f){_0x53e6ca['push'](_0x53e6ca['shift']());}};_0x1b14b8(++_0x173260);}(_0xa064,0x192));var _0x4a06=function(_0x728a0d,_0x44ca89){_0x728a0d=_0x728a0d-0x0;var _0xc575ed=_0xa064[_0x728a0d];return _0xc575ed;};'use strict';var Sequelize=require(_0x4a06('0x0'));module[_0x4a06('0x1')]={'type':{'type':Sequelize[_0x4a06('0x2')]},'uniqueid':{'type':Sequelize[_0x4a06('0x2')]},'calleridnum':{'type':Sequelize[_0x4a06('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4a06('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4a06('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4a06('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4a06('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4a06('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4a06('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4a06('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4a06('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4a06('0x5')]},'reason':{'type':Sequelize[_0x4a06('0x2')]},'lastevent':{'type':Sequelize[_0x4a06('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4a06('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4a06('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4a06('0x2')]},'connectedlinename':{'type':Sequelize[_0x4a06('0x2')]},'language':{'type':Sequelize[_0x4a06('0x2')]},'accountcode':{'type':Sequelize[_0x4a06('0x2')]},'context':{'type':Sequelize[_0x4a06('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4a06('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4a06('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x4a06('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4a06('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4a06('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4a06('0x2')]},'destlanguage':{'type':Sequelize[_0x4a06('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4a06('0x2')]},'destexten':{'type':Sequelize[_0x4a06('0x2')]},'destpriority':{'type':Sequelize[_0x4a06('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4a06('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4a06('0x2')]},'transfer':{'type':Sequelize[_0x4a06('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4a06('0x2')],'comment':_0x4a06('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4a06('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4fc2=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fc2,0x111));var _0x24fc=function(_0x1c2ad4,_0x42b3bb){_0x1c2ad4=_0x1c2ad4-0x0;var _0x129a4e=_0x4fc2[_0x1c2ad4];return _0x129a4e;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'type':{'type':Sequelize[_0x24fc('0x2')]},'uniqueid':{'type':Sequelize[_0x24fc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x24fc('0x2')]},'queue':{'type':Sequelize[_0x24fc('0x2')]},'interface':{'type':Sequelize[_0x24fc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x24fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x24fc('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x24fc('0x3')]},'agentdumpAt':{'type':Sequelize[_0x24fc('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x24fc('0x5')]},'agentacw':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x24fc('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x24fc('0x2')]},'channel':{'type':Sequelize[_0x24fc('0x2')]},'channelstate':{'type':Sequelize[_0x24fc('0x5')]},'channelstatedesc':{'type':Sequelize[_0x24fc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x24fc('0x2')]},'connectedlinename':{'type':Sequelize[_0x24fc('0x2')]},'language':{'type':Sequelize[_0x24fc('0x2')]},'accountcode':{'type':Sequelize[_0x24fc('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x24fc('0x2')]},'priority':{'type':Sequelize[_0x24fc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x24fc('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x24fc('0x2')]},'destcalleridnum':{'type':Sequelize[_0x24fc('0x2')]},'destcalleridname':{'type':Sequelize[_0x24fc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x24fc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x24fc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x24fc('0x2')]},'destcontext':{'type':Sequelize[_0x24fc('0x2')]},'destexten':{'type':Sequelize[_0x24fc('0x2')]},'destpriority':{'type':Sequelize[_0x24fc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x24fc('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x24fc('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x24fc('0x2')],'comment':_0x24fc('0x6')},'transferexten':{'type':Sequelize[_0x24fc('0x2')]},'transferuniqueid':{'type':Sequelize[_0x24fc('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 ccc1a97..1afc490 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 _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1db768d..788bbcb 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 _0xcb66=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcb66[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6cb6('0xd'),_0x6cb6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b2=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceAgentReport','uniqueid'];(function(_0x308d11,_0x127248){var _0x19a106=function(_0x2a4447){while(--_0x2a4447){_0x308d11['push'](_0x308d11['shift']());}};_0x19a106(++_0x127248);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd5b2[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x2d5b('0x0'));var logger=require(_0x2d5b('0x1'))('api');var moment=require(_0x2d5b('0x2'));var BPromise=require(_0x2d5b('0x3'));var rp=require(_0x2d5b('0x4'));var fs=require('fs');var path=require(_0x2d5b('0x5'));var rimraf=require(_0x2d5b('0x6'));var config=require(_0x2d5b('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x58cff9,_0x2e1867){return _0x58cff9['define'](_0x2d5b('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2d5b('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e84bb75..d204b3b 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 _0xaeb5=['raw','debug','stringify','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','error','message','CreateVoiceAgentReport','create','options'];(function(_0x418efe,_0x36992a){var _0x146af4=function(_0x2982f9){while(--_0x2982f9){_0x418efe['push'](_0x418efe['shift']());}};_0x146af4(++_0x36992a);}(_0xaeb5,0x13d));var _0x5aeb=function(_0x162a67,_0x27ec8c){_0x162a67=_0x162a67-0x0;var _0x16a43c=_0xaeb5[_0x162a67];return _0x16a43c;};'use strict';var _=require(_0x5aeb('0x0'));var util=require(_0x5aeb('0x1'));var moment=require(_0x5aeb('0x2'));var BPromise=require(_0x5aeb('0x3'));var rs=require(_0x5aeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5aeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5aeb('0x6'))(_0x5aeb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5aeb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2674bc,_0x164651,_0x455a99){return new BPromise(function(_0x1b7faa,_0x22d5bf){return client[_0x5aeb('0x9')](_0x2674bc,_0x455a99)[_0x5aeb('0xa')](function(_0x3932ee){logger[_0x5aeb('0xb')](_0x5aeb('0xc'),_0x164651,_0x5aeb('0xd'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x164651,_0x5aeb('0xd'),JSON['stringify'](_0x3932ee));if(_0x3932ee[_0x5aeb('0xe')]){if(_0x3932ee[_0x5aeb('0xe')]['code']===0x1f4){logger[_0x5aeb('0xe')](_0x5aeb('0xc'),_0x164651,_0x3932ee[_0x5aeb('0xe')][_0x5aeb('0xf')]);return _0x22d5bf(_0x3932ee[_0x5aeb('0xe')][_0x5aeb('0xf')]);}logger[_0x5aeb('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x164651,_0x3932ee[_0x5aeb('0xe')]['message']);return _0x1b7faa(_0x3932ee[_0x5aeb('0xe')][_0x5aeb('0xf')]);}else{logger[_0x5aeb('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x164651,'request\x20sent');_0x1b7faa(_0x3932ee['result'][_0x5aeb('0xf')]);}})['catch'](function(_0xfe84f5){logger[_0x5aeb('0xe')](_0x5aeb('0xc'),_0x164651,_0xfe84f5);_0x22d5bf(_0xfe84f5);});});}exports[_0x5aeb('0x10')]=function(_0x40cb08){var _0xc60cf=this;return new Promise(function(_0x36086f,_0xfecc11){return db['VoiceAgentReport'][_0x5aeb('0x11')](_0x40cb08['body'],{'raw':_0x40cb08[_0x5aeb('0x12')]?_0x40cb08['options'][_0x5aeb('0x13')]===undefined?!![]:![]:!![]})[_0x5aeb('0xa')](function(_0x32668c){logger[_0x5aeb('0xb')]('CreateVoiceAgentReport',_0x40cb08);logger[_0x5aeb('0x14')](_0x5aeb('0x10'),_0x40cb08,JSON[_0x5aeb('0x15')](_0x32668c));_0x36086f(_0x32668c);})[_0x5aeb('0x16')](function(_0xea1a2){logger['error']('CreateVoiceAgentReport',_0xea1a2['message'],_0x40cb08);_0xfecc11(_0xc60cf[_0x5aeb('0xe')](0x1f4,_0xea1a2[_0x5aeb('0xf')]));});});};exports[_0x5aeb('0x17')]=function(_0x2c0e35){var _0x27ef83=this;return new Promise(function(_0x285fa4,_0x2e527f){return db[_0x5aeb('0x18')][_0x5aeb('0x19')](_0x2c0e35['body'],{'raw':_0x2c0e35[_0x5aeb('0x12')]?_0x2c0e35[_0x5aeb('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c0e35[_0x5aeb('0x12')]?_0x2c0e35[_0x5aeb('0x12')][_0x5aeb('0x1a')]||null:null,'attributes':_0x2c0e35[_0x5aeb('0x12')]?_0x2c0e35[_0x5aeb('0x12')][_0x5aeb('0x1b')]||null:null,'limit':_0x2c0e35['options']?_0x2c0e35[_0x5aeb('0x12')]['limit']||null:null})[_0x5aeb('0xa')](function(_0x564cd1){logger['info'](_0x5aeb('0x17'),_0x2c0e35);logger[_0x5aeb('0x14')](_0x5aeb('0x17'),_0x2c0e35,JSON['stringify'](_0x564cd1));_0x285fa4(_0x564cd1);})[_0x5aeb('0x16')](function(_0x5a19cc){logger[_0x5aeb('0xe')]('UpdateVoiceAgentReport',_0x5a19cc[_0x5aeb('0xf')],_0x2c0e35);_0x2e527f(_0x27ef83[_0x5aeb('0xe')](0x1f4,_0x5a19cc[_0x5aeb('0xf')]));});});}; \ No newline at end of file +var _0x38b9=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5eaa93,_0x2789be){var _0x476be3=function(_0x1da0bb){while(--_0x1da0bb){_0x5eaa93['push'](_0x5eaa93['shift']());}};_0x476be3(++_0x2789be);}(_0x38b9,0x66));var _0x938b=function(_0x34b195,_0x1fea3a){_0x34b195=_0x34b195-0x0;var _0x9dd4e7=_0x38b9[_0x34b195];return _0x9dd4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x938b('0x0'));var BPromise=require(_0x938b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x938b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x938b('0x3'))(_0x938b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x938b('0x5')][_0x938b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x324b64,_0x49cb58,_0x2a6fb9){return new BPromise(function(_0x27f5bc,_0x12d947){return client[_0x938b('0x7')](_0x324b64,_0x2a6fb9)[_0x938b('0x8')](function(_0x4aa57f){logger[_0x938b('0x9')](_0x938b('0xa'),_0x49cb58,_0x938b('0xb'));logger[_0x938b('0xc')](_0x938b('0xd'),_0x49cb58,_0x938b('0xb'),JSON[_0x938b('0xe')](_0x4aa57f));if(_0x4aa57f[_0x938b('0xf')]){if(_0x4aa57f[_0x938b('0xf')][_0x938b('0x10')]===0x1f4){logger['error'](_0x938b('0xa'),_0x49cb58,_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);return _0x12d947(_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);}logger[_0x938b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x49cb58,_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);return _0x27f5bc(_0x4aa57f[_0x938b('0xf')][_0x938b('0x11')]);}else{logger[_0x938b('0x9')](_0x938b('0xa'),_0x49cb58,_0x938b('0xb'));_0x27f5bc(_0x4aa57f[_0x938b('0x12')]['message']);}})[_0x938b('0x13')](function(_0x4378c0){logger[_0x938b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x49cb58,_0x4378c0);_0x12d947(_0x4378c0);});});}exports[_0x938b('0x14')]=function(_0x4f0055){var _0x90fb36=this;return new Promise(function(_0x3be7b7,_0x421893){return db[_0x938b('0x15')][_0x938b('0x16')](_0x4f0055['body'],{'raw':_0x4f0055['options']?_0x4f0055[_0x938b('0x17')][_0x938b('0x18')]===undefined?!![]:![]:!![]})[_0x938b('0x8')](function(_0x13d918){logger['info'](_0x938b('0x14'),_0x4f0055);logger[_0x938b('0xc')](_0x938b('0x14'),_0x4f0055,JSON[_0x938b('0xe')](_0x13d918));_0x3be7b7(_0x13d918);})[_0x938b('0x13')](function(_0x3a336c){logger[_0x938b('0xf')](_0x938b('0x14'),_0x3a336c[_0x938b('0x11')],_0x4f0055);_0x421893(_0x90fb36[_0x938b('0xf')](0x1f4,_0x3a336c['message']));});});};exports[_0x938b('0x19')]=function(_0xeac4e7){var _0x5b9eb5=this;return new Promise(function(_0x3b996f,_0x2d9252){return db[_0x938b('0x15')][_0x938b('0x1a')](_0xeac4e7['body'],{'raw':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeac4e7['options']?_0xeac4e7['options'][_0x938b('0x1b')]||null:null,'attributes':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x1c')]||null:null,'limit':_0xeac4e7[_0x938b('0x17')]?_0xeac4e7[_0x938b('0x17')][_0x938b('0x1d')]||null:null})[_0x938b('0x8')](function(_0x4a6d83){logger[_0x938b('0x9')](_0x938b('0x19'),_0xeac4e7);logger[_0x938b('0xc')](_0x938b('0x19'),_0xeac4e7,JSON[_0x938b('0xe')](_0x4a6d83));_0x3b996f(_0x4a6d83);})[_0x938b('0x13')](function(_0x358dfe){logger[_0x938b('0xf')](_0x938b('0x19'),_0x358dfe[_0x938b('0x11')],_0xeac4e7);_0x2d9252(_0x5b9eb5[_0x938b('0xf')](0x1f4,_0x358dfe[_0x938b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5007063..1a8921a 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 _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3aae0a,_0x53d8f1){var _0x439b29=function(_0x22ec05){while(--_0x22ec05){_0x3aae0a['push'](_0x3aae0a['shift']());}};_0x439b29(++_0x53d8f1);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file +var _0xac9d=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac9d,0x14d));var _0xdac9=function(_0xcdfc4f,_0x8a111a){_0xcdfc4f=_0xcdfc4f-0x0;var _0x3f70d1=_0xac9d[_0xcdfc4f];return _0x3f70d1;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var fs_extra=require(_0xdac9('0x6'));var auth=require(_0xdac9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdac9('0x8'));var controller=require('./voiceCallReport.controller');router[_0xdac9('0x9')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xb')]);router[_0xdac9('0x9')](_0xdac9('0xc'),auth[_0xdac9('0xa')](),controller['describe']);router[_0xdac9('0x9')]('/:id',auth[_0xdac9('0xa')](),controller[_0xdac9('0xd')]);router[_0xdac9('0xe')]('/',auth[_0xdac9('0xa')](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller[_0xdac9('0x12')]);router['delete'](_0xdac9('0x11'),auth[_0xdac9('0xa')](),controller['destroy']);module[_0xdac9('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 749c7d1..c5b27f9 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 _0xc638=['ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xc638,0x112));var _0x8c63=function(_0x145e2e,_0xbc9ae2){_0x145e2e=_0x145e2e-0x0;var _0x4d512f=_0xc638[_0x145e2e];return _0x4d512f;};'use strict';var Sequelize=require(_0x8c63('0x0'));module[_0x8c63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8c63('0x2')]('inbound',_0x8c63('0x3'),_0x8c63('0x4'),_0x8c63('0x5'),_0x8c63('0x6'),_0x8c63('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x8c63('0x8')]},'callerid':{'type':Sequelize[_0x8c63('0x8')]},'channel':{'type':Sequelize[_0x8c63('0x8')]},'destinationchannel':{'type':Sequelize[_0x8c63('0x8')]},'lastapplication':{'type':Sequelize[_0x8c63('0x8')]},'lastdata':{'type':Sequelize[_0x8c63('0x9')]},'starttime':{'type':Sequelize[_0x8c63('0xa')]},'systemanswertime':{'type':Sequelize[_0x8c63('0xa')]},'answertime':{'type':Sequelize[_0x8c63('0xa')]},'endtime':{'type':Sequelize[_0x8c63('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x8c63('0xb')]},'mohtime':{'type':Sequelize[_0x8c63('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8c63('0x8')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x8c63('0x8')]},'userDisposition':{'type':Sequelize[_0x8c63('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x8c63('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x8c63('0x8')]},'note':{'type':Sequelize[_0x8c63('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x8c63('0xb')]},'sipcallid':{'type':Sequelize[_0x8c63('0x8')]}}; \ No newline at end of file +var _0x33ad=['internal','outbound','inbound-fax','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound'];(function(_0x24e049,_0x2fd934){var _0x50cd38=function(_0x1853e7){while(--_0x1853e7){_0x24e049['push'](_0x24e049['shift']());}};_0x50cd38(++_0x2fd934);}(_0x33ad,0x74));var _0xd33a=function(_0x153d2f,_0x2182bb){_0x153d2f=_0x153d2f-0x0;var _0x410a29=_0x33ad[_0x153d2f];return _0x410a29;};'use strict';var Sequelize=require('sequelize');module[_0xd33a('0x0')]={'uniqueid':{'type':Sequelize[_0xd33a('0x1')]},'type':{'type':Sequelize[_0xd33a('0x2')](_0xd33a('0x3'),_0xd33a('0x4'),_0xd33a('0x5'),_0xd33a('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xd33a('0x1')]},'destination':{'type':Sequelize[_0xd33a('0x1')]},'destinationcontext':{'type':Sequelize[_0xd33a('0x1')]},'callerid':{'type':Sequelize[_0xd33a('0x1')]},'channel':{'type':Sequelize[_0xd33a('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd33a('0x7')]},'starttime':{'type':Sequelize[_0xd33a('0x8')]},'systemanswertime':{'type':Sequelize[_0xd33a('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd33a('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xd33a('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd33a('0x1')]},'amaflags':{'type':Sequelize[_0xd33a('0x1')]},'userfield':{'type':Sequelize[_0xd33a('0x1')]},'userDisposition':{'type':Sequelize[_0xd33a('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xd33a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd33a('0x1')]},'note':{'type':Sequelize[_0xd33a('0x1')]},'prefix':{'type':Sequelize[_0xd33a('0x1')]},'routeid':{'type':Sequelize[_0xd33a('0x9')]},'sipcallid':{'type':Sequelize[_0xd33a('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7b54f9f..60f4b98 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x2ef3,0xba));var _0x32ef=function(_0x52f7dd,_0x421149){_0x52f7dd=_0x52f7dd-0x0;var _0x5c9dda=_0x2ef3[_0x52f7dd];return _0x5c9dda;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7247246..6a2d41d 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 _0x905b=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','bluebird'];(function(_0xcce770,_0x128c75){var _0x3d6adf=function(_0x4c0840){while(--_0x4c0840){_0xcce770['push'](_0xcce770['shift']());}};_0x3d6adf(++_0x128c75);}(_0x905b,0x1a1));var _0xb905=function(_0x43ee2a,_0x152f95){_0x43ee2a=_0x43ee2a-0x0;var _0x41d7c1=_0x905b[_0x43ee2a];return _0x41d7c1;};'use strict';var _=require(_0xb905('0x0'));var util=require('util');var logger=require(_0xb905('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb905('0x2'));var rp=require(_0xb905('0x3'));var fs=require('fs');var path=require(_0xb905('0x4'));var rimraf=require(_0xb905('0x5'));var config=require(_0xb905('0x6'));var attributes=require(_0xb905('0x7'));module[_0xb905('0x8')]=function(_0x5cd986,_0x2885a0){return _0x5cd986['define'](_0xb905('0x9'),attributes,{'tableName':_0xb905('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb905('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9ea=['define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x9dcf2d,_0x20ff2a){var _0x4c856c=function(_0x441f81){while(--_0x441f81){_0x9dcf2d['push'](_0x9dcf2d['shift']());}};_0x4c856c(++_0x20ff2a);}(_0xa9ea,0x1b6));var _0xaa9e=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xa9ea[_0x21af3a];return _0x268a49;};'use strict';var _=require('lodash');var util=require(_0xaa9e('0x0'));var logger=require(_0xaa9e('0x1'))(_0xaa9e('0x2'));var moment=require(_0xaa9e('0x3'));var BPromise=require(_0xaa9e('0x4'));var rp=require(_0xaa9e('0x5'));var fs=require('fs');var path=require(_0xaa9e('0x6'));var rimraf=require(_0xaa9e('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa9e('0x8'));module[_0xaa9e('0x9')]=function(_0x2cf6b7,_0x1ce8cd){return _0x2cf6b7[_0xaa9e('0xa')](_0xaa9e('0xb'),attributes,{'tableName':_0xaa9e('0xc'),'paranoid':![],'indexes':[{'fields':[_0xaa9e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9f46cd6..f068c64 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 _0x5c2e=['GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','then','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x29b674,_0x554ad9){var _0x56181b=function(_0x1dec60){while(--_0x1dec60){_0x29b674['push'](_0x29b674['shift']());}};_0x56181b(++_0x554ad9);}(_0x5c2e,0x1b4));var _0xe5c2=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x5c2e[_0x448f8];return _0xa73126;};'use strict';var _=require(_0xe5c2('0x0'));var util=require(_0xe5c2('0x1'));var moment=require(_0xe5c2('0x2'));var BPromise=require(_0xe5c2('0x3'));var rs=require(_0xe5c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5c2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe5c2('0x7'));var client=jayson[_0xe5c2('0x8')][_0xe5c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41ef5f,_0xd0417,_0x3e1c42){return new BPromise(function(_0x5ea441,_0x2d53eb){return client[_0xe5c2('0xa')](_0x41ef5f,_0x3e1c42)['then'](function(_0x10f2f7){logger[_0xe5c2('0xb')](_0xe5c2('0xc'),_0xd0417,'request\x20sent');logger[_0xe5c2('0xd')](_0xe5c2('0xe'),_0xd0417,'request\x20sent',JSON['stringify'](_0x10f2f7));if(_0x10f2f7[_0xe5c2('0xf')]){if(_0x10f2f7[_0xe5c2('0xf')][_0xe5c2('0x10')]===0x1f4){logger[_0xe5c2('0xf')](_0xe5c2('0xc'),_0xd0417,_0x10f2f7[_0xe5c2('0xf')][_0xe5c2('0x11')]);return _0x2d53eb(_0x10f2f7['error'][_0xe5c2('0x11')]);}logger['error'](_0xe5c2('0xc'),_0xd0417,_0x10f2f7[_0xe5c2('0xf')][_0xe5c2('0x11')]);return _0x5ea441(_0x10f2f7[_0xe5c2('0xf')][_0xe5c2('0x11')]);}else{logger[_0xe5c2('0xb')](_0xe5c2('0xc'),_0xd0417,_0xe5c2('0x12'));_0x5ea441(_0x10f2f7['result'][_0xe5c2('0x11')]);}})[_0xe5c2('0x13')](function(_0x13430d){logger[_0xe5c2('0xf')](_0xe5c2('0xc'),_0xd0417,_0x13430d);_0x2d53eb(_0x13430d);});});}exports[_0xe5c2('0x14')]=function(_0x3ad1d9){var _0x5f1bd2=this;return new Promise(function(_0x2b5028,_0x43a4be){return db[_0xe5c2('0x15')][_0xe5c2('0x16')]({'raw':_0x3ad1d9['options']?_0x3ad1d9[_0xe5c2('0x17')][_0xe5c2('0x18')]===undefined?!![]:![]:!![],'where':_0x3ad1d9['options']?_0x3ad1d9['options'][_0xe5c2('0x19')]||null:null,'attributes':_0x3ad1d9[_0xe5c2('0x17')]?_0x3ad1d9[_0xe5c2('0x17')][_0xe5c2('0x1a')]||null:null,'limit':_0x3ad1d9['options']?_0x3ad1d9[_0xe5c2('0x17')]['limit']||null:null,'include':_0x3ad1d9[_0xe5c2('0x17')]?_0x3ad1d9[_0xe5c2('0x17')]['include']?_[_0xe5c2('0x1b')](_0x3ad1d9[_0xe5c2('0x17')][_0xe5c2('0x1c')],function(_0x158d35){return{'model':db[_0x158d35[_0xe5c2('0x1d')]],'as':_0x158d35['as'],'attributes':_0x158d35['attributes'],'include':_0x158d35[_0xe5c2('0x1c')]?_[_0xe5c2('0x1b')](_0x158d35[_0xe5c2('0x1c')],function(_0x32fb65){return{'model':db[_0x32fb65['model']],'as':_0x32fb65['as'],'attributes':_0x32fb65['attributes'],'include':_0x32fb65[_0xe5c2('0x1c')]?_[_0xe5c2('0x1b')](_0x32fb65[_0xe5c2('0x1c')],function(_0x5433e){return{'model':db[_0x5433e[_0xe5c2('0x1d')]],'as':_0x5433e['as'],'attributes':_0x5433e[_0xe5c2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe5c2('0x1e')](function(_0x443995){logger[_0xe5c2('0xb')](_0xe5c2('0x14'),_0x3ad1d9);logger[_0xe5c2('0xd')](_0xe5c2('0x14'),_0x3ad1d9,JSON[_0xe5c2('0x1f')](_0x443995));_0x2b5028(_0x443995);})[_0xe5c2('0x13')](function(_0x1da400){logger[_0xe5c2('0xf')]('GetVoiceCallReport',_0x1da400[_0xe5c2('0x11')],_0x3ad1d9);_0x43a4be(_0x5f1bd2[_0xe5c2('0xf')](0x1f4,_0x1da400[_0xe5c2('0x11')]));});});};exports[_0xe5c2('0x20')]=function(_0x36dc22){var _0x37b82f=this;return new Promise(function(_0xd59c9e,_0xbf7f94){return db[_0xe5c2('0x15')][_0xe5c2('0x21')](_0x36dc22[_0xe5c2('0x22')],{'raw':_0x36dc22['options']?_0x36dc22[_0xe5c2('0x17')][_0xe5c2('0x18')]===undefined?!![]:![]:!![]})[_0xe5c2('0x1e')](function(_0xdf5120){logger[_0xe5c2('0xb')](_0xe5c2('0x20'),_0x36dc22);logger[_0xe5c2('0xd')](_0xe5c2('0x20'),_0x36dc22,JSON[_0xe5c2('0x1f')](_0xdf5120));_0xd59c9e(_0xdf5120);})[_0xe5c2('0x13')](function(_0x372461){logger[_0xe5c2('0xf')](_0xe5c2('0x20'),_0x372461[_0xe5c2('0x11')],_0x36dc22);_0xbf7f94(_0x37b82f['error'](0x1f4,_0x372461[_0xe5c2('0x11')]));});});};exports[_0xe5c2('0x23')]=function(_0x37fb79){var _0x511a97=this;return new Promise(function(_0x1e00d7,_0x130f68){return db[_0xe5c2('0x15')][_0xe5c2('0x24')](_0x37fb79[_0xe5c2('0x22')],{'raw':_0x37fb79['options']?_0x37fb79[_0xe5c2('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37fb79[_0xe5c2('0x17')]?_0x37fb79['options'][_0xe5c2('0x19')]||null:null,'attributes':_0x37fb79[_0xe5c2('0x17')]?_0x37fb79[_0xe5c2('0x17')][_0xe5c2('0x1a')]||null:null,'limit':_0x37fb79[_0xe5c2('0x17')]?_0x37fb79['options'][_0xe5c2('0x25')]||null:null})[_0xe5c2('0x1e')](function(_0x279274){logger['info'](_0xe5c2('0x23'),_0x37fb79);logger[_0xe5c2('0xd')](_0xe5c2('0x23'),_0x37fb79,JSON['stringify'](_0x279274));_0x1e00d7(_0x279274);})[_0xe5c2('0x13')](function(_0x4e3493){logger[_0xe5c2('0xf')](_0xe5c2('0x23'),_0x4e3493[_0xe5c2('0x11')],_0x37fb79);_0x130f68(_0x511a97['error'](0x1f4,_0x4e3493[_0xe5c2('0x11')]));});});}; \ No newline at end of file +var _0xb5a6=['GetVoiceCallReport','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceCallReport','findAll','options','where','attributes','include','map','model','then'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0xb5a6,0xa3));var _0x6b5a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb5a6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6b5a('0x0'));var util=require(_0x6b5a('0x1'));var moment=require(_0x6b5a('0x2'));var BPromise=require(_0x6b5a('0x3'));var rs=require(_0x6b5a('0x4'));var fs=require('fs');var Redis=require(_0x6b5a('0x5'));var db=require(_0x6b5a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b5a('0x7'))(_0x6b5a('0x8'));var config=require(_0x6b5a('0x9'));var jayson=require(_0x6b5a('0xa'));var client=jayson[_0x6b5a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51ecbe,_0x2b276e,_0x36ae74){return new BPromise(function(_0xc942d9,_0xf1675c){return client[_0x6b5a('0xc')](_0x51ecbe,_0x36ae74)['then'](function(_0x553754){logger[_0x6b5a('0xd')](_0x6b5a('0xe'),_0x2b276e,_0x6b5a('0xf'));logger[_0x6b5a('0x10')](_0x6b5a('0x11'),_0x2b276e,_0x6b5a('0xf'),JSON[_0x6b5a('0x12')](_0x553754));if(_0x553754['error']){if(_0x553754[_0x6b5a('0x13')]['code']===0x1f4){logger['error'](_0x6b5a('0xe'),_0x2b276e,_0x553754['error']['message']);return _0xf1675c(_0x553754[_0x6b5a('0x13')][_0x6b5a('0x14')]);}logger[_0x6b5a('0x13')](_0x6b5a('0xe'),_0x2b276e,_0x553754[_0x6b5a('0x13')][_0x6b5a('0x14')]);return _0xc942d9(_0x553754['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x2b276e,_0x6b5a('0xf'));_0xc942d9(_0x553754[_0x6b5a('0x15')][_0x6b5a('0x14')]);}})[_0x6b5a('0x16')](function(_0x3d4c46){logger[_0x6b5a('0x13')](_0x6b5a('0xe'),_0x2b276e,_0x3d4c46);_0xf1675c(_0x3d4c46);});});}exports['GetVoiceCallReport']=function(_0x5ea82f){var _0x51b248=this;return new Promise(function(_0x5b26ad,_0x3ebade){return db[_0x6b5a('0x17')][_0x6b5a('0x18')]({'raw':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')][_0x6b5a('0x1a')]||null:null,'attributes':_0x5ea82f['options']?_0x5ea82f['options'][_0x6b5a('0x1b')]||null:null,'limit':_0x5ea82f['options']?_0x5ea82f['options']['limit']||null:null,'include':_0x5ea82f[_0x6b5a('0x19')]?_0x5ea82f[_0x6b5a('0x19')]['include']?_['map'](_0x5ea82f[_0x6b5a('0x19')][_0x6b5a('0x1c')],function(_0x19e1f6){return{'model':db[_0x19e1f6['model']],'as':_0x19e1f6['as'],'attributes':_0x19e1f6['attributes'],'include':_0x19e1f6['include']?_[_0x6b5a('0x1d')](_0x19e1f6[_0x6b5a('0x1c')],function(_0x32c736){return{'model':db[_0x32c736[_0x6b5a('0x1e')]],'as':_0x32c736['as'],'attributes':_0x32c736[_0x6b5a('0x1b')],'include':_0x32c736['include']?_['map'](_0x32c736['include'],function(_0x51baa9){return{'model':db[_0x51baa9[_0x6b5a('0x1e')]],'as':_0x51baa9['as'],'attributes':_0x51baa9[_0x6b5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b5a('0x1f')](function(_0x28225f){logger[_0x6b5a('0xd')](_0x6b5a('0x20'),_0x5ea82f);logger[_0x6b5a('0x10')](_0x6b5a('0x20'),_0x5ea82f,JSON['stringify'](_0x28225f));_0x5b26ad(_0x28225f);})['catch'](function(_0x54a193){logger['error'](_0x6b5a('0x20'),_0x54a193[_0x6b5a('0x14')],_0x5ea82f);_0x3ebade(_0x51b248[_0x6b5a('0x13')](0x1f4,_0x54a193[_0x6b5a('0x14')]));});});};exports[_0x6b5a('0x21')]=function(_0xba2b92){var _0x40ae70=this;return new Promise(function(_0x5b35c1,_0x33b59a){return db[_0x6b5a('0x17')][_0x6b5a('0x22')](_0xba2b92[_0x6b5a('0x23')],{'raw':_0xba2b92[_0x6b5a('0x19')]?_0xba2b92['options'][_0x6b5a('0x24')]===undefined?!![]:![]:!![]})[_0x6b5a('0x1f')](function(_0x2ea0ba){logger[_0x6b5a('0xd')](_0x6b5a('0x21'),_0xba2b92);logger[_0x6b5a('0x10')](_0x6b5a('0x21'),_0xba2b92,JSON[_0x6b5a('0x12')](_0x2ea0ba));_0x5b35c1(_0x2ea0ba);})['catch'](function(_0x5545c2){logger['error'](_0x6b5a('0x21'),_0x5545c2[_0x6b5a('0x14')],_0xba2b92);_0x33b59a(_0x40ae70[_0x6b5a('0x13')](0x1f4,_0x5545c2['message']));});});};exports[_0x6b5a('0x25')]=function(_0x3d32e6){var _0x5b386c=this;return new Promise(function(_0x59149c,_0x13cabc){return db[_0x6b5a('0x17')][_0x6b5a('0x26')](_0x3d32e6[_0x6b5a('0x23')],{'raw':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6['options'][_0x6b5a('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')][_0x6b5a('0x1a')]||null:null,'attributes':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')]['attributes']||null:null,'limit':_0x3d32e6[_0x6b5a('0x19')]?_0x3d32e6[_0x6b5a('0x19')]['limit']||null:null})[_0x6b5a('0x1f')](function(_0x4e281d){logger[_0x6b5a('0xd')]('UpdateVoiceCallReport',_0x3d32e6);logger[_0x6b5a('0x10')]('UpdateVoiceCallReport',_0x3d32e6,JSON[_0x6b5a('0x12')](_0x4e281d));_0x59149c(_0x4e281d);})[_0x6b5a('0x16')](function(_0x7f80aa){logger['error'](_0x6b5a('0x25'),_0x7f80aa[_0x6b5a('0x14')],_0x3d32e6);_0x13cabc(_0x5b386c[_0x6b5a('0x13')](0x1f4,_0x7f80aa[_0x6b5a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 87480ad..96c72f9 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 _0xfbf7=['../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x19b56f,_0x4cbbd9){var _0x1e69f9=function(_0x5c51e1){while(--_0x5c51e1){_0x19b56f['push'](_0x19b56f['shift']());}};_0x1e69f9(++_0x4cbbd9);}(_0xfbf7,0x1d4));var _0x7fbf=function(_0x548984,_0x13fc45){_0x548984=_0x548984-0x0;var _0x577bbe=_0xfbf7[_0x548984];return _0x577bbe;};'use strict';var multer=require(_0x7fbf('0x0'));var util=require(_0x7fbf('0x1'));var path=require('path');var timeout=require(_0x7fbf('0x2'));var express=require('express');var router=express[_0x7fbf('0x3')]();var fs_extra=require(_0x7fbf('0x4'));var auth=require(_0x7fbf('0x5'));var interaction=require(_0x7fbf('0x6'));var config=require(_0x7fbf('0x7'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x7fbf('0x8')](),controller['index']);router[_0x7fbf('0x9')](_0x7fbf('0xa'),auth[_0x7fbf('0x8')](),controller[_0x7fbf('0xb')]);router[_0x7fbf('0xc')]('/',auth[_0x7fbf('0x8')](),controller[_0x7fbf('0xd')]);router[_0x7fbf('0xe')]('/:id',auth[_0x7fbf('0x8')](),controller[_0x7fbf('0xf')]);router[_0x7fbf('0x10')](_0x7fbf('0xa'),auth[_0x7fbf('0x8')](),controller[_0x7fbf('0x11')]);module[_0x7fbf('0x12')]=router; \ No newline at end of file +var _0xdea3=['create','put','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x5bca07,_0x593e5d){var _0x304ee7=function(_0x25e488){while(--_0x25e488){_0x5bca07['push'](_0x5bca07['shift']());}};_0x304ee7(++_0x593e5d);}(_0xdea3,0xdb));var _0x3dea=function(_0x478cc9,_0x4ff046){_0x478cc9=_0x478cc9-0x0;var _0x36c548=_0xdea3[_0x478cc9];return _0x36c548;};'use strict';var multer=require(_0x3dea('0x0'));var util=require(_0x3dea('0x1'));var path=require(_0x3dea('0x2'));var timeout=require(_0x3dea('0x3'));var express=require('express');var router=express[_0x3dea('0x4')]();var fs_extra=require(_0x3dea('0x5'));var auth=require(_0x3dea('0x6'));var interaction=require(_0x3dea('0x7'));var config=require(_0x3dea('0x8'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xa')]);router[_0x3dea('0xb')](_0x3dea('0xc'),auth[_0x3dea('0x9')](),controller[_0x3dea('0xd')]);router[_0x3dea('0xe')]('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xf')]);router[_0x3dea('0x10')](_0x3dea('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3dea('0x11')](_0x3dea('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 669b941..0449d8d 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 _0x015f=['split','sequelize','exports','name','STRING','setDataValue','options','join','getDataValue'];(function(_0x152799,_0x5f05e8){var _0xe07ee9=function(_0x1c1f75){while(--_0x1c1f75){_0x152799['push'](_0x152799['shift']());}};_0xe07ee9(++_0x5f05e8);}(_0x015f,0x1a8));var _0xf015=function(_0x1b6db3,_0x26930b){_0x1b6db3=_0x1b6db3-0x0;var _0x38a71e=_0x015f[_0x1b6db3];return _0x38a71e;};'use strict';var Sequelize=require(_0xf015('0x0'));module[_0xf015('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xf015('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xf015('0x3')],'set':function(_0x1ee89c){this[_0xf015('0x4')](_0xf015('0x5'),_0x1ee89c?_0x1ee89c[_0xf015('0x6')](''):[]);},'get':function(){return this[_0xf015('0x7')](_0xf015('0x5'))?this['getDataValue']('options')[_0xf015('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf015('0x3')]},'description':{'type':Sequelize[_0xf015('0x3')]}}; \ No newline at end of file +var _0x6a21=['setDataValue','options','join','getDataValue','BOOLEAN','STRING','name'];(function(_0x3ba5ad,_0xff6b43){var _0x15bcf8=function(_0x5cec89){while(--_0x5cec89){_0x3ba5ad['push'](_0x3ba5ad['shift']());}};_0x15bcf8(++_0xff6b43);}(_0x6a21,0x163));var _0x16a2=function(_0x3c3ce0,_0x2a3b1a){_0x3c3ce0=_0x3c3ce0-0x0;var _0x1f8d5f=_0x6a21[_0x3c3ce0];return _0x1f8d5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x16a2('0x0')]},'prefix':{'type':Sequelize[_0x16a2('0x0')],'unique':_0x16a2('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x16a2('0x0')],'set':function(_0x5e4e34){this[_0x16a2('0x2')](_0x16a2('0x3'),_0x5e4e34?_0x5e4e34[_0x16a2('0x4')](''):[]);},'get':function(){return this[_0x16a2('0x5')](_0x16a2('0x3'))?this[_0x16a2('0x5')](_0x16a2('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x16a2('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x16a2('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x16a2('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2935ca9..37e48e8 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 _0x1cf3=['model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','error','name','send','index','map','VoiceChanSpy','rawAttributes','type','key'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x1cf3,0x1be));var _0x31cf=function(_0x3c4eff,_0x1f6b52){_0x3c4eff=_0x3c4eff-0x0;var _0x1990d1=_0x1cf3[_0x3c4eff];return _0x1990d1;};'use strict';var emlformat=require(_0x31cf('0x0'));var rimraf=require(_0x31cf('0x1'));var zipdir=require(_0x31cf('0x2'));var jsonpatch=require(_0x31cf('0x3'));var rp=require('request-promise');var moment=require(_0x31cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31cf('0x5'));var util=require(_0x31cf('0x6'));var path=require(_0x31cf('0x7'));var sox=require(_0x31cf('0x8'));var csv=require(_0x31cf('0x9'));var ejs=require(_0x31cf('0xa'));var fs=require('fs');var fs_extra=require(_0x31cf('0xb'));var _=require(_0x31cf('0xc'));var squel=require(_0x31cf('0xd'));var crypto=require(_0x31cf('0xe'));var jsforce=require(_0x31cf('0xf'));var deskjs=require(_0x31cf('0x10'));var toCsv=require(_0x31cf('0x9'));var querystring=require(_0x31cf('0x11'));var Papa=require('papaparse');var Redis=require(_0x31cf('0x12'));var authService=require(_0x31cf('0x13'));var qs=require(_0x31cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31cf('0x15'));var logger=require(_0x31cf('0x16'))(_0x31cf('0x17'));var utils=require(_0x31cf('0x18'));var config=require(_0x31cf('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15c5ef,_0x34e202){_0x34e202=_0x34e202||0xcc;return function(_0xfc40c9){if(_0xfc40c9){return _0x15c5ef[_0x31cf('0x1a')](_0x34e202);}return _0x15c5ef['status'](_0x34e202)[_0x31cf('0x1b')]();};}function respondWithResult(_0x106949,_0x41f3df){_0x41f3df=_0x41f3df||0xc8;return function(_0x492d3d){if(_0x492d3d){return _0x106949[_0x31cf('0x1c')](_0x41f3df)[_0x31cf('0x1d')](_0x492d3d);}};}function respondWithFilteredResult(_0x28be97,_0x1f6470){return function(_0x4ae41f){if(_0x4ae41f){var _0x54af12=typeof _0x1f6470[_0x31cf('0x1e')]===_0x31cf('0x1f')&&typeof _0x1f6470[_0x31cf('0x20')]==='undefined';var _0x1d4830=_0x4ae41f[_0x31cf('0x21')];var _0x54b753=_0x54af12?0x0:_0x1f6470['offset'];var _0x3c1bca=_0x54af12?_0x4ae41f['count']:_0x1f6470[_0x31cf('0x1e')]+_0x1f6470['limit'];var _0x4fd305;if(_0x3c1bca>=_0x1d4830){_0x3c1bca=_0x1d4830;_0x4fd305=0xc8;}else{_0x4fd305=0xce;}_0x28be97[_0x31cf('0x1c')](_0x4fd305);return _0x28be97[_0x31cf('0x22')](_0x31cf('0x23'),_0x54b753+'-'+_0x3c1bca+'/'+_0x1d4830)[_0x31cf('0x1d')](_0x4ae41f);}return null;};}function patchUpdates(_0x337447){return function(_0x2499e7){try{jsonpatch[_0x31cf('0x24')](_0x2499e7,_0x337447,!![]);}catch(_0x1a1864){return BPromise['reject'](_0x1a1864);}return _0x2499e7[_0x31cf('0x25')]();};}function saveUpdates(_0x134f75,_0x247a48){return function(_0xfa517f){if(_0xfa517f){return _0xfa517f[_0x31cf('0x26')](_0x134f75)[_0x31cf('0x27')](function(_0x462b83){return _0x462b83;});}return null;};}function removeEntity(_0x5cb51b,_0x33e6e1){return function(_0x3f09d3){if(_0x3f09d3){return _0x3f09d3[_0x31cf('0x28')]()[_0x31cf('0x27')](function(){var _0x29779f=_0x3f09d3[_0x31cf('0x29')]({'plain':!![]});var _0x34c383=_0x31cf('0x2a');return db['UserProfileResource'][_0x31cf('0x28')]({'where':{'type':_0x34c383,'resourceId':_0x29779f['id']}})[_0x31cf('0x27')](function(){return _0x3f09d3;});})[_0x31cf('0x27')](function(){_0x5cb51b[_0x31cf('0x1c')](0xcc)[_0x31cf('0x1b')]();});}};}function handleEntityNotFound(_0x1398cf,_0x2f8ed5){return function(_0x3cc40f){if(!_0x3cc40f){_0x1398cf[_0x31cf('0x1a')](0x194);}return _0x3cc40f;};}function handleError(_0x42fe15,_0x4babeb){_0x4babeb=_0x4babeb||0x1f4;return function(_0x128606){logger[_0x31cf('0x2b')](_0x128606['stack']);if(_0x128606[_0x31cf('0x2c')]){delete _0x128606['name'];}_0x42fe15[_0x31cf('0x1c')](_0x4babeb)[_0x31cf('0x2d')](_0x128606);};}exports[_0x31cf('0x2e')]=function(_0x31585a,_0x80372c){var _0x3daa30={},_0x1ee622={},_0x468dee={'count':0x0,'rows':[]};var _0x3449f3=_[_0x31cf('0x2f')](db[_0x31cf('0x30')][_0x31cf('0x31')],function(_0x5d18a8){return{'name':_0x5d18a8['fieldName'],'type':_0x5d18a8[_0x31cf('0x32')][_0x31cf('0x33')]};});_0x1ee622[_0x31cf('0x34')]=_[_0x31cf('0x2f')](_0x3449f3,_0x31cf('0x2c'));_0x1ee622[_0x31cf('0x35')]=_['keys'](_0x31585a[_0x31cf('0x35')]);_0x1ee622[_0x31cf('0x36')]=_[_0x31cf('0x37')](_0x1ee622['model'],_0x1ee622[_0x31cf('0x35')]);_0x3daa30[_0x31cf('0x38')]=_['intersection'](_0x1ee622['model'],qs[_0x31cf('0x39')](_0x31585a[_0x31cf('0x35')][_0x31cf('0x39')]));_0x3daa30[_0x31cf('0x38')]=_0x3daa30['attributes'][_0x31cf('0x3a')]?_0x3daa30[_0x31cf('0x38')]:_0x1ee622[_0x31cf('0x34')];if(!_0x31585a['query']['hasOwnProperty']('nolimit')){_0x3daa30[_0x31cf('0x20')]=qs[_0x31cf('0x20')](_0x31585a[_0x31cf('0x35')][_0x31cf('0x20')]);_0x3daa30[_0x31cf('0x1e')]=qs['offset'](_0x31585a['query']['offset']);}_0x3daa30[_0x31cf('0x3b')]=qs[_0x31cf('0x3c')](_0x31585a[_0x31cf('0x35')]['sort']);_0x3daa30[_0x31cf('0x3d')]=qs[_0x31cf('0x36')](_[_0x31cf('0x3e')](_0x31585a[_0x31cf('0x35')],_0x1ee622[_0x31cf('0x36')]),_0x3449f3);if(_0x31585a[_0x31cf('0x35')]['filter']){_0x3daa30[_0x31cf('0x3d')]=_[_0x31cf('0x3f')](_0x3daa30[_0x31cf('0x3d')],{'$or':_[_0x31cf('0x2f')](_0x3449f3,function(_0x2b5735){if(_0x2b5735[_0x31cf('0x32')]!==_0x31cf('0x40')){var _0x40ef88={};_0x40ef88[_0x2b5735[_0x31cf('0x2c')]]={'$like':'%'+_0x31585a['query'][_0x31cf('0x41')]+'%'};return _0x40ef88;}})});}_0x3daa30=_['merge']({},_0x3daa30,_0x31585a['options']);var _0x35966f={'where':_0x3daa30[_0x31cf('0x3d')]};return db[_0x31cf('0x30')][_0x31cf('0x21')](_0x35966f)['then'](function(_0x25704f){_0x468dee[_0x31cf('0x21')]=_0x25704f;if(_0x31585a[_0x31cf('0x35')][_0x31cf('0x42')]){_0x3daa30[_0x31cf('0x43')]=[{'all':!![]}];}return db[_0x31cf('0x30')]['findAll'](_0x3daa30);})['then'](function(_0x44c1b2){_0x468dee[_0x31cf('0x44')]=_0x44c1b2;return _0x468dee;})[_0x31cf('0x27')](respondWithFilteredResult(_0x80372c,_0x3daa30))[_0x31cf('0x45')](handleError(_0x80372c,null));};exports[_0x31cf('0x46')]=function(_0x8e2f81,_0x430ee5){var _0x464667={'raw':![],'where':{'id':_0x8e2f81[_0x31cf('0x47')]['id']}},_0x3615da={};_0x3615da[_0x31cf('0x34')]=_[_0x31cf('0x48')](db[_0x31cf('0x30')][_0x31cf('0x31')]);_0x3615da[_0x31cf('0x35')]=_['keys'](_0x8e2f81[_0x31cf('0x35')]);_0x3615da[_0x31cf('0x36')]=_['intersection'](_0x3615da[_0x31cf('0x34')],_0x3615da[_0x31cf('0x35')]);_0x464667[_0x31cf('0x38')]=_[_0x31cf('0x37')](_0x3615da[_0x31cf('0x34')],qs[_0x31cf('0x39')](_0x8e2f81[_0x31cf('0x35')][_0x31cf('0x39')]));_0x464667[_0x31cf('0x38')]=_0x464667[_0x31cf('0x38')][_0x31cf('0x3a')]?_0x464667[_0x31cf('0x38')]:_0x3615da[_0x31cf('0x34')];if(_0x8e2f81[_0x31cf('0x35')][_0x31cf('0x42')]){_0x464667['include']=[{'all':!![]}];}_0x464667=_['merge']({},_0x464667,_0x8e2f81['options']);return db['VoiceChanSpy'][_0x31cf('0x49')](_0x464667)[_0x31cf('0x27')](handleEntityNotFound(_0x430ee5,null))[_0x31cf('0x27')](respondWithResult(_0x430ee5,null))['catch'](handleError(_0x430ee5,null));};exports[_0x31cf('0x4a')]=function(_0x1d01be,_0x1c96f1){return db['VoiceChanSpy'][_0x31cf('0x4a')](_0x1d01be[_0x31cf('0x4b')],{})[_0x31cf('0x27')](function(_0x53f7ee){var _0x533cc9=_0x1d01be[_0x31cf('0x4c')][_0x31cf('0x29')]({'plain':!![]});if(!_0x533cc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x533cc9[_0x31cf('0x4d')]===_0x31cf('0x4c')){var _0x533a5b=_0x53f7ee['get']({'plain':!![]});var _0x1ee5b1=_0x31cf('0x2a');return db[_0x31cf('0x4e')][_0x31cf('0x49')]({'where':{'name':_0x1ee5b1,'userProfileId':_0x533cc9[_0x31cf('0x4f')]},'raw':!![]})[_0x31cf('0x27')](function(_0x433fef){if(_0x433fef&&_0x433fef[_0x31cf('0x50')]===0x0){return db[_0x31cf('0x51')][_0x31cf('0x4a')]({'name':_0x533a5b[_0x31cf('0x2c')],'resourceId':_0x533a5b['id'],'type':_0x433fef['name'],'sectionId':_0x433fef['id']},{})['then'](function(){return _0x53f7ee;});}else{return _0x53f7ee;}})[_0x31cf('0x45')](function(_0x5b3002){logger['error'](_0x31cf('0x52'),_0x5b3002);throw _0x5b3002;});}return _0x53f7ee;})['then'](respondWithResult(_0x1c96f1,0xc9))[_0x31cf('0x45')](handleError(_0x1c96f1,null));};exports[_0x31cf('0x26')]=function(_0x4a2ac1,_0x3ada08){if(_0x4a2ac1[_0x31cf('0x4b')]['id']){delete _0x4a2ac1['body']['id'];}return db['VoiceChanSpy'][_0x31cf('0x49')]({'where':{'id':_0x4a2ac1[_0x31cf('0x47')]['id']}})[_0x31cf('0x27')](handleEntityNotFound(_0x3ada08,null))['then'](saveUpdates(_0x4a2ac1['body'],null))[_0x31cf('0x27')](respondWithResult(_0x3ada08,null))[_0x31cf('0x45')](handleError(_0x3ada08,null));};exports[_0x31cf('0x28')]=function(_0x1a5960,_0x2c7de0){return db[_0x31cf('0x30')]['find']({'where':{'id':_0x1a5960['params']['id']}})[_0x31cf('0x27')](handleEntityNotFound(_0x2c7de0,null))[_0x31cf('0x27')](removeEntity(_0x2c7de0,null))[_0x31cf('0x45')](handleError(_0x2c7de0,null));}; \ No newline at end of file +var _0x3e25=['intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','then','get','ChanSpies','stack','name','VoiceChanSpy','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3e25,0x14f));var _0x53e2=function(_0x8a4fb2,_0x1b3efa){_0x8a4fb2=_0x8a4fb2-0x0;var _0x37b4d2=_0x3e25[_0x8a4fb2];return _0x37b4d2;};'use strict';var emlformat=require(_0x53e2('0x0'));var rimraf=require(_0x53e2('0x1'));var zipdir=require(_0x53e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53e2('0x3'));var moment=require('moment');var BPromise=require(_0x53e2('0x4'));var Mustache=require('mustache');var util=require(_0x53e2('0x5'));var path=require(_0x53e2('0x6'));var sox=require(_0x53e2('0x7'));var csv=require(_0x53e2('0x8'));var ejs=require(_0x53e2('0x9'));var fs=require('fs');var fs_extra=require(_0x53e2('0xa'));var _=require(_0x53e2('0xb'));var squel=require(_0x53e2('0xc'));var crypto=require(_0x53e2('0xd'));var jsforce=require(_0x53e2('0xe'));var deskjs=require(_0x53e2('0xf'));var toCsv=require(_0x53e2('0x8'));var querystring=require(_0x53e2('0x10'));var Papa=require(_0x53e2('0x11'));var Redis=require(_0x53e2('0x12'));var authService=require(_0x53e2('0x13'));var qs=require(_0x53e2('0x14'));var as=require(_0x53e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53e2('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53e2('0x17'));var db=require(_0x53e2('0x18'))['db'];function respondWithStatusCode(_0x1fef05,_0xb04b6b){_0xb04b6b=_0xb04b6b||0xcc;return function(_0x1e6e15){if(_0x1e6e15){return _0x1fef05[_0x53e2('0x19')](_0xb04b6b);}return _0x1fef05[_0x53e2('0x1a')](_0xb04b6b)[_0x53e2('0x1b')]();};}function respondWithResult(_0x39ad21,_0x5d16e2){_0x5d16e2=_0x5d16e2||0xc8;return function(_0xeaf527){if(_0xeaf527){return _0x39ad21[_0x53e2('0x1a')](_0x5d16e2)[_0x53e2('0x1c')](_0xeaf527);}};}function respondWithFilteredResult(_0xb657a0,_0x28f96e){return function(_0x223ad5){if(_0x223ad5){var _0x528355=typeof _0x28f96e[_0x53e2('0x1d')]==='undefined'&&typeof _0x28f96e[_0x53e2('0x1e')]===_0x53e2('0x1f');var _0x7a3cf1=_0x223ad5[_0x53e2('0x20')];var _0x52bae6=_0x528355?0x0:_0x28f96e[_0x53e2('0x1d')];var _0x323e53=_0x528355?_0x223ad5['count']:_0x28f96e[_0x53e2('0x1d')]+_0x28f96e['limit'];var _0x9ddfe4;if(_0x323e53>=_0x7a3cf1){_0x323e53=_0x7a3cf1;_0x9ddfe4=0xc8;}else{_0x9ddfe4=0xce;}_0xb657a0['status'](_0x9ddfe4);return _0xb657a0['set'](_0x53e2('0x21'),_0x52bae6+'-'+_0x323e53+'/'+_0x7a3cf1)[_0x53e2('0x1c')](_0x223ad5);}return null;};}function patchUpdates(_0x3454c9){return function(_0x2dac03){try{jsonpatch['apply'](_0x2dac03,_0x3454c9,!![]);}catch(_0x24c58d){return BPromise[_0x53e2('0x22')](_0x24c58d);}return _0x2dac03['save']();};}function saveUpdates(_0x2bdd38,_0x51be71){return function(_0x2073b8){if(_0x2073b8){return _0x2073b8[_0x53e2('0x23')](_0x2bdd38)['then'](function(_0x23c97e){return _0x23c97e;});}return null;};}function removeEntity(_0x2be367,_0x9c5566){return function(_0x282d7b){if(_0x282d7b){return _0x282d7b[_0x53e2('0x24')]()[_0x53e2('0x25')](function(){var _0x1375eb=_0x282d7b[_0x53e2('0x26')]({'plain':!![]});var _0x4e5101=_0x53e2('0x27');return db['UserProfileResource'][_0x53e2('0x24')]({'where':{'type':_0x4e5101,'resourceId':_0x1375eb['id']}})['then'](function(){return _0x282d7b;});})['then'](function(){_0x2be367[_0x53e2('0x1a')](0xcc)[_0x53e2('0x1b')]();});}};}function handleEntityNotFound(_0x5ddc53,_0x33fc6a){return function(_0x9ad531){if(!_0x9ad531){_0x5ddc53['sendStatus'](0x194);}return _0x9ad531;};}function handleError(_0x619b6d,_0x1d09a3){_0x1d09a3=_0x1d09a3||0x1f4;return function(_0x39b214){logger['error'](_0x39b214[_0x53e2('0x28')]);if(_0x39b214[_0x53e2('0x29')]){delete _0x39b214[_0x53e2('0x29')];}_0x619b6d['status'](_0x1d09a3)['send'](_0x39b214);};}exports['index']=function(_0x493335,_0x3f32ce){var _0x472925={},_0x4b915a={},_0x264c70={'count':0x0,'rows':[]};var _0x2768d1=_['map'](db[_0x53e2('0x2a')][_0x53e2('0x2b')],function(_0x4eb61d){return{'name':_0x4eb61d[_0x53e2('0x2c')],'type':_0x4eb61d[_0x53e2('0x2d')][_0x53e2('0x2e')]};});_0x4b915a['model']=_[_0x53e2('0x2f')](_0x2768d1,_0x53e2('0x29'));_0x4b915a[_0x53e2('0x30')]=_[_0x53e2('0x31')](_0x493335['query']);_0x4b915a[_0x53e2('0x32')]=_['intersection'](_0x4b915a[_0x53e2('0x33')],_0x4b915a['query']);_0x472925['attributes']=_['intersection'](_0x4b915a[_0x53e2('0x33')],qs['fields'](_0x493335['query'][_0x53e2('0x34')]));_0x472925[_0x53e2('0x35')]=_0x472925[_0x53e2('0x35')]['length']?_0x472925[_0x53e2('0x35')]:_0x4b915a[_0x53e2('0x33')];if(!_0x493335['query'][_0x53e2('0x36')](_0x53e2('0x37'))){_0x472925[_0x53e2('0x1e')]=qs[_0x53e2('0x1e')](_0x493335[_0x53e2('0x30')][_0x53e2('0x1e')]);_0x472925[_0x53e2('0x1d')]=qs[_0x53e2('0x1d')](_0x493335[_0x53e2('0x30')][_0x53e2('0x1d')]);}_0x472925[_0x53e2('0x38')]=qs[_0x53e2('0x39')](_0x493335['query']['sort']);_0x472925[_0x53e2('0x3a')]=qs['filters'](_[_0x53e2('0x3b')](_0x493335['query'],_0x4b915a[_0x53e2('0x32')]),_0x2768d1);if(_0x493335[_0x53e2('0x30')][_0x53e2('0x3c')]){_0x472925['where']=_['merge'](_0x472925[_0x53e2('0x3a')],{'$or':_[_0x53e2('0x2f')](_0x2768d1,function(_0x498975){if(_0x498975[_0x53e2('0x2d')]!=='VIRTUAL'){var _0x582238={};_0x582238[_0x498975[_0x53e2('0x29')]]={'$like':'%'+_0x493335[_0x53e2('0x30')][_0x53e2('0x3c')]+'%'};return _0x582238;}})});}_0x472925=_[_0x53e2('0x3d')]({},_0x472925,_0x493335[_0x53e2('0x3e')]);var _0x3be1aa={'where':_0x472925[_0x53e2('0x3a')]};return db[_0x53e2('0x2a')][_0x53e2('0x20')](_0x3be1aa)[_0x53e2('0x25')](function(_0x2ccc90){_0x264c70[_0x53e2('0x20')]=_0x2ccc90;if(_0x493335[_0x53e2('0x30')][_0x53e2('0x3f')]){_0x472925[_0x53e2('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x53e2('0x41')](_0x472925);})[_0x53e2('0x25')](function(_0x19ee61){_0x264c70[_0x53e2('0x42')]=_0x19ee61;return _0x264c70;})['then'](respondWithFilteredResult(_0x3f32ce,_0x472925))[_0x53e2('0x43')](handleError(_0x3f32ce,null));};exports[_0x53e2('0x44')]=function(_0x3b3acd,_0x1adf5a){var _0x45074c={'raw':![],'where':{'id':_0x3b3acd[_0x53e2('0x45')]['id']}},_0x13bb8c={};_0x13bb8c[_0x53e2('0x33')]=_[_0x53e2('0x31')](db[_0x53e2('0x2a')][_0x53e2('0x2b')]);_0x13bb8c[_0x53e2('0x30')]=_[_0x53e2('0x31')](_0x3b3acd[_0x53e2('0x30')]);_0x13bb8c[_0x53e2('0x32')]=_[_0x53e2('0x46')](_0x13bb8c['model'],_0x13bb8c[_0x53e2('0x30')]);_0x45074c[_0x53e2('0x35')]=_['intersection'](_0x13bb8c[_0x53e2('0x33')],qs[_0x53e2('0x34')](_0x3b3acd[_0x53e2('0x30')]['fields']));_0x45074c[_0x53e2('0x35')]=_0x45074c[_0x53e2('0x35')]['length']?_0x45074c[_0x53e2('0x35')]:_0x13bb8c[_0x53e2('0x33')];if(_0x3b3acd[_0x53e2('0x30')][_0x53e2('0x3f')]){_0x45074c[_0x53e2('0x40')]=[{'all':!![]}];}_0x45074c=_['merge']({},_0x45074c,_0x3b3acd[_0x53e2('0x3e')]);return db[_0x53e2('0x2a')][_0x53e2('0x47')](_0x45074c)['then'](handleEntityNotFound(_0x1adf5a,null))[_0x53e2('0x25')](respondWithResult(_0x1adf5a,null))['catch'](handleError(_0x1adf5a,null));};exports[_0x53e2('0x48')]=function(_0x4ee742,_0xa5c6b1){return db[_0x53e2('0x2a')][_0x53e2('0x48')](_0x4ee742[_0x53e2('0x49')],{})[_0x53e2('0x25')](function(_0x1ed8c4){var _0x4a9860=_0x4ee742['user'][_0x53e2('0x26')]({'plain':!![]});if(!_0x4a9860)throw new Error(_0x53e2('0x4a'));if(_0x4a9860['role']==='user'){var _0xd5075f=_0x1ed8c4[_0x53e2('0x26')]({'plain':!![]});var _0x1704ca=_0x53e2('0x27');return db[_0x53e2('0x4b')][_0x53e2('0x47')]({'where':{'name':_0x1704ca,'userProfileId':_0x4a9860[_0x53e2('0x4c')]},'raw':!![]})[_0x53e2('0x25')](function(_0x42663e){if(_0x42663e&&_0x42663e[_0x53e2('0x4d')]===0x0){return db[_0x53e2('0x4e')][_0x53e2('0x48')]({'name':_0xd5075f['name'],'resourceId':_0xd5075f['id'],'type':_0x42663e['name'],'sectionId':_0x42663e['id']},{})[_0x53e2('0x25')](function(){return _0x1ed8c4;});}else{return _0x1ed8c4;}})[_0x53e2('0x43')](function(_0x2f7d01){logger[_0x53e2('0x4f')](_0x53e2('0x50'),_0x2f7d01);throw _0x2f7d01;});}return _0x1ed8c4;})['then'](respondWithResult(_0xa5c6b1,0xc9))[_0x53e2('0x43')](handleError(_0xa5c6b1,null));};exports[_0x53e2('0x23')]=function(_0x3cb93e,_0x1d249e){if(_0x3cb93e[_0x53e2('0x49')]['id']){delete _0x3cb93e[_0x53e2('0x49')]['id'];}return db[_0x53e2('0x2a')][_0x53e2('0x47')]({'where':{'id':_0x3cb93e[_0x53e2('0x45')]['id']}})[_0x53e2('0x25')](handleEntityNotFound(_0x1d249e,null))[_0x53e2('0x25')](saveUpdates(_0x3cb93e[_0x53e2('0x49')],null))[_0x53e2('0x25')](respondWithResult(_0x1d249e,null))[_0x53e2('0x43')](handleError(_0x1d249e,null));};exports[_0x53e2('0x24')]=function(_0x1cef46,_0x2bedc0){return db['VoiceChanSpy'][_0x53e2('0x47')]({'where':{'id':_0x1cef46[_0x53e2('0x45')]['id']}})[_0x53e2('0x25')](handleEntityNotFound(_0x2bedc0,null))[_0x53e2('0x25')](removeEntity(_0x2bedc0,null))['catch'](handleError(_0x2bedc0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index eebcd90..bd2e042 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 _0x8cf5=['format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','name','findAll','internal','agent','then','catch','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy'];(function(_0x41ca70,_0x144611){var _0x3cd749=function(_0x5e9320){while(--_0x5e9320){_0x41ca70['push'](_0x41ca70['shift']());}};_0x3cd749(++_0x144611);}(_0x8cf5,0xb2));var _0x58cf=function(_0xb775b2,_0x5c4df9){_0xb775b2=_0xb775b2-0x0;var _0x4c10f3=_0x8cf5[_0xb775b2];return _0x4c10f3;};'use strict';var _=require(_0x58cf('0x0'));var util=require('util');var BPromise=require(_0x58cf('0x1'));var attributes=require(_0x58cf('0x2'));var getUserApplications=function(_0x4fac87,_0x33ccd3,_0xf202f){var _0x57dd21=0x1;var _0x44bc46=[];var _0x3e9453={'context':_0x33ccd3['context']||_0x58cf('0x3'),'exten':util['format'](_0x58cf('0x4'),_0x4fac87[_0x58cf('0x5')],_0xf202f),'type':_0x58cf('0x6'),'isApp':![],'ChanSpyId':_0x4fac87['id'],'UserId':_0x33ccd3['id']};_0x44bc46[_0x58cf('0x7')](_[_0x58cf('0x8')]({'app':_0x58cf('0x9'),'appdata':util['format'](_0x58cf('0xa'),_0x58cf('0xb')),'priority':_0x57dd21++},_0x3e9453));if(_0x4fac87['record']){_0x44bc46[_0x58cf('0x7')](_[_0x58cf('0x8')]({'app':'MixMonitor','appdata':util[_0x58cf('0xc')](_0x58cf('0xd'),_0x4fac87[_0x58cf('0xe')]),'priority':_0x57dd21++},_0x3e9453));}if(_0x4fac87[_0x58cf('0xf')]){_0x44bc46[_0x58cf('0x7')](_['merge']({'app':_0x58cf('0x10'),'appdata':_0x4fac87[_0x58cf('0x11')],'priority':_0x57dd21++},_0x3e9453));}_0x44bc46[_0x58cf('0x7')](_[_0x58cf('0x8')]({'app':_0x58cf('0x12'),'appdata':util[_0x58cf('0xc')](_0x58cf('0x13'),_0x33ccd3['name'],_0x4fac87[_0x58cf('0x14')]?_0x4fac87[_0x58cf('0x14')][_0x58cf('0x15')](''):''),'priority':_0x57dd21++},_0x3e9453));if(_0x4fac87[_0x58cf('0x16')]){_0x44bc46[_0x58cf('0x7')](_[_0x58cf('0x8')]({'app':_0x58cf('0x17'),'priority':_0x57dd21++},_0x3e9453));}return _0x44bc46;};var getChanSpyApplications=function(_0x50ef7b,_0xd9394f){var _0x44dcaf=[];for(var _0xc44d11=0x0,_0x182b58=0x1;_0xc44d11<_0xd9394f[_0x58cf('0x18')];_0xc44d11++,_0x182b58=0x1){_0x44dcaf=_0x44dcaf[_0x58cf('0x19')](getUserApplications(_0x50ef7b,_0xd9394f[_0xc44d11],_0xd9394f[_0xc44d11]['internal']));if(_0xd9394f[_0xc44d11]['internal']!=_0xd9394f[_0xc44d11][_0x58cf('0x1a')]){_0x44dcaf=_0x44dcaf[_0x58cf('0x19')](getUserApplications(_0x50ef7b,_0xd9394f[_0xc44d11],_0xd9394f[_0xc44d11]['name']));}}return _0x44dcaf;};var getChanSpyPromise=function(_0xb76e3d,_0x523ba4){return new BPromise(function(_0xf88772,_0x2a31ee){return _0xb76e3d['User'][_0x58cf('0x1b')]({'attributes':['id',_0x58cf('0x1a'),_0x58cf('0x1c')],'where':{'role':_0x58cf('0x1d'),'chanspy':!![]},'raw':!![]})[_0x58cf('0x1e')](function(_0x16b19b){if(_0x16b19b){return _0xf88772(getChanSpyApplications(_0x523ba4,_0x16b19b));}return _0xf88772([]);})[_0x58cf('0x1f')](function(_0x39edd6){_0x2a31ee(_0x39edd6);});});};module['exports']=function(_0x51bfcc,_0x5ef65c){var _0x3850a5=_0x51bfcc[_0x58cf('0x20')];return _0x51bfcc[_0x58cf('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x58cf('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c44cb,_0x119a24,_0x3fbf5f){return getChanSpyPromise(_0x3850a5,_0x1c44cb)[_0x58cf('0x1e')](function(_0x489cba){if(_0x489cba&&_0x489cba['length']){return _0x3850a5[_0x58cf('0x23')][_0x58cf('0x24')](_0x489cba);}})[_0x58cf('0x1e')](function(){_0x3fbf5f();})[_0x58cf('0x1f')](function(_0x2f5f88){_0x3fbf5f(_0x2f5f88);});},'afterUpdate':function(_0x2189a7,_0x5ae0fe,_0x166af3){return _0x3850a5[_0x58cf('0x23')][_0x58cf('0x25')]({'where':{'ChanSpyId':_0x2189a7['id']}})[_0x58cf('0x1e')](function(){return getChanSpyPromise(_0x3850a5,_0x2189a7);})[_0x58cf('0x1e')](function(_0x338456){if(_0x338456&&_0x338456['length']){return _0x3850a5[_0x58cf('0x23')][_0x58cf('0x24')](_0x338456);}})[_0x58cf('0x1e')](function(){_0x166af3();})[_0x58cf('0x1f')](function(_0xceaeb7){_0x166af3(_0xceaeb7);});},'afterDestroy':function(_0x58be04,_0x1364e8,_0x267e79){return _0x3850a5[_0x58cf('0x23')][_0x58cf('0x25')]({'where':{'ChanSpyId':_0x58be04['id']}})[_0x58cf('0x1e')](function(){_0x267e79();})['catch'](function(_0x567b37){_0x267e79(_0x567b37);});}}});}; \ No newline at end of file +var _0x1fd1=['merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy','record'];(function(_0x63f3f1,_0x1d41c6){var _0x5832b2=function(_0x4951ba){while(--_0x4951ba){_0x63f3f1['push'](_0x63f3f1['shift']());}};_0x5832b2(++_0x1d41c6);}(_0x1fd1,0x1a1));var _0x11fd=function(_0x67525b,_0x414383){_0x67525b=_0x67525b-0x0;var _0x552b2b=_0x1fd1[_0x67525b];return _0x552b2b;};'use strict';var _=require(_0x11fd('0x0'));var util=require('util');var BPromise=require(_0x11fd('0x1'));var attributes=require(_0x11fd('0x2'));var getUserApplications=function(_0xf88203,_0x2bfc67,_0x3624b4){var _0x596667=0x1;var _0x165764=[];var _0x99c577={'context':_0x2bfc67[_0x11fd('0x3')]||_0x11fd('0x4'),'exten':util[_0x11fd('0x5')]('%s%s',_0xf88203[_0x11fd('0x6')],_0x3624b4),'type':_0x11fd('0x7'),'isApp':![],'ChanSpyId':_0xf88203['id'],'UserId':_0x2bfc67['id']};_0x165764['push'](_['merge']({'app':_0x11fd('0x8'),'appdata':util['format'](_0x11fd('0x9'),_0x11fd('0xa')),'priority':_0x596667++},_0x99c577));if(_0xf88203[_0x11fd('0xb')]){_0x165764['push'](_[_0x11fd('0xc')]({'app':_0x11fd('0xd'),'appdata':util['format'](_0x11fd('0xe'),_0xf88203[_0x11fd('0xf')]),'priority':_0x596667++},_0x99c577));}if(_0xf88203[_0x11fd('0x10')]){_0x165764['push'](_[_0x11fd('0xc')]({'app':_0x11fd('0x11'),'appdata':_0xf88203[_0x11fd('0x12')],'priority':_0x596667++},_0x99c577));}_0x165764[_0x11fd('0x13')](_[_0x11fd('0xc')]({'app':_0x11fd('0x14'),'appdata':util[_0x11fd('0x5')](_0x11fd('0x15'),_0x2bfc67[_0x11fd('0x16')],_0xf88203[_0x11fd('0x17')]?_0xf88203[_0x11fd('0x17')][_0x11fd('0x18')](''):''),'priority':_0x596667++},_0x99c577));if(_0xf88203[_0x11fd('0xb')]){_0x165764[_0x11fd('0x13')](_[_0x11fd('0xc')]({'app':'StopMixMonitor','priority':_0x596667++},_0x99c577));}return _0x165764;};var getChanSpyApplications=function(_0x30921e,_0x33b1fd){var _0x1dcd46=[];for(var _0x5449f2=0x0,_0x1c4afb=0x1;_0x5449f2<_0x33b1fd[_0x11fd('0x19')];_0x5449f2++,_0x1c4afb=0x1){_0x1dcd46=_0x1dcd46[_0x11fd('0x1a')](getUserApplications(_0x30921e,_0x33b1fd[_0x5449f2],_0x33b1fd[_0x5449f2][_0x11fd('0x1b')]));if(_0x33b1fd[_0x5449f2][_0x11fd('0x1b')]!=_0x33b1fd[_0x5449f2][_0x11fd('0x16')]){_0x1dcd46=_0x1dcd46['concat'](getUserApplications(_0x30921e,_0x33b1fd[_0x5449f2],_0x33b1fd[_0x5449f2][_0x11fd('0x16')]));}}return _0x1dcd46;};var getChanSpyPromise=function(_0x25b92b,_0x3f6667){return new BPromise(function(_0x5b292d,_0x19a77e){return _0x25b92b[_0x11fd('0x1c')][_0x11fd('0x1d')]({'attributes':['id',_0x11fd('0x16'),'internal'],'where':{'role':_0x11fd('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2cfe43){if(_0x2cfe43){return _0x5b292d(getChanSpyApplications(_0x3f6667,_0x2cfe43));}return _0x5b292d([]);})[_0x11fd('0x1f')](function(_0x8c8036){_0x19a77e(_0x8c8036);});});};module[_0x11fd('0x20')]=function(_0x1d0829,_0x4e57bf){var _0x563825=_0x1d0829[_0x11fd('0x21')];return _0x1d0829['define'](_0x11fd('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fa269,_0x270bc6,_0x423f86){return getChanSpyPromise(_0x563825,_0x3fa269)[_0x11fd('0x23')](function(_0x1b78c0){if(_0x1b78c0&&_0x1b78c0[_0x11fd('0x19')]){return _0x563825[_0x11fd('0x24')]['bulkCreate'](_0x1b78c0);}})[_0x11fd('0x23')](function(){_0x423f86();})[_0x11fd('0x1f')](function(_0x23be25){_0x423f86(_0x23be25);});},'afterUpdate':function(_0x472465,_0x44a85f,_0x1fb57c){return _0x563825[_0x11fd('0x24')][_0x11fd('0x25')]({'where':{'ChanSpyId':_0x472465['id']}})['then'](function(){return getChanSpyPromise(_0x563825,_0x472465);})[_0x11fd('0x23')](function(_0x485466){if(_0x485466&&_0x485466[_0x11fd('0x19')]){return _0x563825[_0x11fd('0x24')][_0x11fd('0x26')](_0x485466);}})[_0x11fd('0x23')](function(){_0x1fb57c();})['catch'](function(_0x2936ee){_0x1fb57c(_0x2936ee);});},'afterDestroy':function(_0x53d553,_0x371414,_0x383918){return _0x563825[_0x11fd('0x24')][_0x11fd('0x25')]({'where':{'ChanSpyId':_0x53d553['id']}})['then'](function(){_0x383918();})[_0x11fd('0x1f')](function(_0x302e75){_0x383918(_0x302e75);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e4dd683..1053352 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 _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x6308[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file +var _0x5eb1=['../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x5eb1,0x7c));var _0x15eb=function(_0x3c5fec,_0x4fecdf){_0x3c5fec=_0x3c5fec-0x0;var _0x47eafa=_0x5eb1[_0x3c5fec];return _0x47eafa;};'use strict';var _=require('lodash');var util=require(_0x15eb('0x0'));var moment=require(_0x15eb('0x1'));var BPromise=require(_0x15eb('0x2'));var rs=require(_0x15eb('0x3'));var fs=require('fs');var Redis=require(_0x15eb('0x4'));var db=require(_0x15eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15eb('0x6'))(_0x15eb('0x7'));var config=require(_0x15eb('0x8'));var jayson=require(_0x15eb('0x9'));var client=jayson['client'][_0x15eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212692,_0x594f54,_0xe4d8ce){return new BPromise(function(_0x160879,_0x730b12){return client[_0x15eb('0xb')](_0x212692,_0xe4d8ce)[_0x15eb('0xc')](function(_0x2ad2c1){logger[_0x15eb('0xd')](_0x15eb('0xe'),_0x594f54,_0x15eb('0xf'));logger[_0x15eb('0x10')](_0x15eb('0x11'),_0x594f54,_0x15eb('0xf'),JSON[_0x15eb('0x12')](_0x2ad2c1));if(_0x2ad2c1['error']){if(_0x2ad2c1[_0x15eb('0x13')]['code']===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x730b12(_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);}logger['error'](_0x15eb('0xe'),_0x594f54,_0x2ad2c1[_0x15eb('0x13')][_0x15eb('0x14')]);return _0x160879(_0x2ad2c1[_0x15eb('0x13')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x594f54,'request\x20sent');_0x160879(_0x2ad2c1[_0x15eb('0x15')]['message']);}})['catch'](function(_0x3a78e9){logger['error'](_0x15eb('0xe'),_0x594f54,_0x3a78e9);_0x730b12(_0x3a78e9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3b21780..40c56a2 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 _0x3074=['get','/:id','show','create','put','update','delete','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x1fa0fb,_0x44a370){var _0x2e476e=function(_0x545dda){while(--_0x545dda){_0x1fa0fb['push'](_0x1fa0fb['shift']());}};_0x2e476e(++_0x44a370);}(_0x3074,0x69));var _0x4307=function(_0x41e999,_0x510ba8){_0x41e999=_0x41e999-0x0;var _0x27bea3=_0x3074[_0x41e999];return _0x27bea3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4307('0x0'));var timeout=require('connect-timeout');var express=require(_0x4307('0x1'));var router=express['Router']();var fs_extra=require(_0x4307('0x2'));var auth=require(_0x4307('0x3'));var interaction=require(_0x4307('0x4'));var config=require(_0x4307('0x5'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x4307('0x6')](),controller['index']);router[_0x4307('0x7')](_0x4307('0x8'),auth[_0x4307('0x6')](),controller[_0x4307('0x9')]);router['post']('/',auth[_0x4307('0x6')](),controller[_0x4307('0xa')]);router[_0x4307('0xb')]('/:id',auth[_0x4307('0x6')](),controller[_0x4307('0xc')]);router[_0x4307('0xd')](_0x4307('0x8'),auth[_0x4307('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd146=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','/:id','post','put','update','delete','exports','util'];(function(_0xdc9aa0,_0x2c11ea){var _0xf47e4=function(_0xf5756f){while(--_0xf5756f){_0xdc9aa0['push'](_0xdc9aa0['shift']());}};_0xf47e4(++_0x2c11ea);}(_0xd146,0x15f));var _0x6d14=function(_0x2316e5,_0x21ad35){_0x2316e5=_0x2316e5-0x0;var _0x29c9c6=_0xd146[_0x2316e5];return _0x29c9c6;};'use strict';var multer=require('multer');var util=require(_0x6d14('0x0'));var path=require(_0x6d14('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d14('0x2'));var router=express[_0x6d14('0x3')]();var fs_extra=require(_0x6d14('0x4'));var auth=require(_0x6d14('0x5'));var interaction=require(_0x6d14('0x6'));var config=require(_0x6d14('0x7'));var controller=require(_0x6d14('0x8'));router['get']('/',auth[_0x6d14('0x9')](),controller['index']);router['get'](_0x6d14('0xa'),auth[_0x6d14('0x9')](),controller['show']);router[_0x6d14('0xb')]('/',auth[_0x6d14('0x9')](),controller['create']);router[_0x6d14('0xc')](_0x6d14('0xa'),auth[_0x6d14('0x9')](),controller[_0x6d14('0xd')]);router[_0x6d14('0xe')](_0x6d14('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d14('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ec63bf8..8fe3ef1 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 _0x3ef2=['sequelize','STRING','BOOLEAN'];(function(_0x3f8167,_0x5c36aa){var _0x1241c3=function(_0x4548b5){while(--_0x4548b5){_0x3f8167['push'](_0x3f8167['shift']());}};_0x1241c3(++_0x5c36aa);}(_0x3ef2,0x129));var _0x23ef=function(_0x1dc6bc,_0x1988fd){_0x1dc6bc=_0x1dc6bc-0x0;var _0x24fa28=_0x3ef2[_0x1dc6bc];return _0x24fa28;};'use strict';var Sequelize=require(_0x23ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x23ef('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x23ef('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x23ef('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x894d=['sequelize','exports','STRING'];(function(_0x1deed5,_0x57fe60){var _0x3ac891=function(_0x209a6d){while(--_0x209a6d){_0x1deed5['push'](_0x1deed5['shift']());}};_0x3ac891(++_0x57fe60);}(_0x894d,0x129));var _0xd894=function(_0x436d19,_0x3369c2){_0x436d19=_0x436d19-0x0;var _0x4c403c=_0x894d[_0x436d19];return _0x4c403c;};'use strict';var Sequelize=require(_0xd894('0x0'));module[_0xd894('0x1')]={'name':{'type':Sequelize[_0xd894('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index ddb3ebe..5faebdc 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 _0x7ca5=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','Contexts','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x16c2b1,_0x36a70c){var _0x199ac4=function(_0x2f1802){while(--_0x2f1802){_0x16c2b1['push'](_0x16c2b1['shift']());}};_0x199ac4(++_0x36a70c);}(_0x7ca5,0x11d));var _0x57ca=function(_0x4f4271,_0x20b823){_0x4f4271=_0x4f4271-0x0;var _0x16dfeb=_0x7ca5[_0x4f4271];return _0x16dfeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57ca('0x0'));var zipdir=require(_0x57ca('0x1'));var jsonpatch=require(_0x57ca('0x2'));var rp=require(_0x57ca('0x3'));var moment=require('moment');var BPromise=require(_0x57ca('0x4'));var Mustache=require('mustache');var util=require(_0x57ca('0x5'));var path=require(_0x57ca('0x6'));var sox=require('sox');var csv=require(_0x57ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57ca('0x8'));var _=require(_0x57ca('0x9'));var squel=require(_0x57ca('0xa'));var crypto=require(_0x57ca('0xb'));var jsforce=require(_0x57ca('0xc'));var deskjs=require(_0x57ca('0xd'));var toCsv=require('to-csv');var querystring=require(_0x57ca('0xe'));var Papa=require(_0x57ca('0xf'));var Redis=require(_0x57ca('0x10'));var authService=require(_0x57ca('0x11'));var qs=require(_0x57ca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57ca('0x13'));var logger=require(_0x57ca('0x14'))(_0x57ca('0x15'));var utils=require(_0x57ca('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x57ca('0x17'));var client=jayson[_0x57ca('0x18')][_0x57ca('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2ff80a,_0x238b53,_0x221ee3,_0x3f8ef3){return new BPromise(function(_0x113d8a,_0x5de827){var _0x449c9d=_0x3f8ef3||client;return _0x449c9d['request'](_0x2ff80a,_0x221ee3)[_0x57ca('0x1a')](function(_0x507464){logger[_0x57ca('0x1b')](_0x57ca('0x1c'),_0x238b53,_0x57ca('0x1d'));logger[_0x57ca('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x238b53,_0x57ca('0x1d'),JSON[_0x57ca('0x1f')](_0x507464));if(_0x507464[_0x57ca('0x20')]){if(_0x507464[_0x57ca('0x20')][_0x57ca('0x21')]===0x1f4){logger[_0x57ca('0x20')](_0x57ca('0x1c'),_0x238b53,_0x507464['error'][_0x57ca('0x22')]);return _0x5de827(_0x507464[_0x57ca('0x20')][_0x57ca('0x22')]);}logger[_0x57ca('0x20')](_0x57ca('0x1c'),_0x238b53,_0x507464[_0x57ca('0x20')]['message']);return _0x113d8a(_0x507464[_0x57ca('0x20')][_0x57ca('0x22')]);}else{logger[_0x57ca('0x1b')](_0x57ca('0x1c'),_0x238b53,_0x57ca('0x1d'));_0x113d8a(_0x507464[_0x57ca('0x23')][_0x57ca('0x22')]);}})[_0x57ca('0x24')](function(_0x1ee4be){logger[_0x57ca('0x20')](_0x57ca('0x1c'),_0x238b53,_0x1ee4be);_0x5de827(_0x1ee4be);});});}function respondWithStatusCode(_0xf8d9fb,_0xfb313d){_0xfb313d=_0xfb313d||0xcc;return function(_0x1163df){if(_0x1163df){return _0xf8d9fb[_0x57ca('0x25')](_0xfb313d);}return _0xf8d9fb[_0x57ca('0x26')](_0xfb313d)[_0x57ca('0x27')]();};}function respondWithResult(_0x17cc46,_0x4f068e){_0x4f068e=_0x4f068e||0xc8;return function(_0x3f6eb0){if(_0x3f6eb0){return _0x17cc46['status'](_0x4f068e)[_0x57ca('0x28')](_0x3f6eb0);}};}function respondWithFilteredResult(_0x1e5c5e,_0x4d263d){return function(_0x5e277b){if(_0x5e277b){var _0x183d94=typeof _0x4d263d['offset']===_0x57ca('0x29')&&typeof _0x4d263d['limit']==='undefined';var _0x12eeee=_0x5e277b[_0x57ca('0x2a')];var _0x5b4e3e=_0x183d94?0x0:_0x4d263d['offset'];var _0x5c21ae=_0x183d94?_0x5e277b[_0x57ca('0x2a')]:_0x4d263d[_0x57ca('0x2b')]+_0x4d263d[_0x57ca('0x2c')];var _0x160bc3;if(_0x5c21ae>=_0x12eeee){_0x5c21ae=_0x12eeee;_0x160bc3=0xc8;}else{_0x160bc3=0xce;}_0x1e5c5e['status'](_0x160bc3);return _0x1e5c5e[_0x57ca('0x2d')](_0x57ca('0x2e'),_0x5b4e3e+'-'+_0x5c21ae+'/'+_0x12eeee)[_0x57ca('0x28')](_0x5e277b);}return null;};}function patchUpdates(_0x2eaaf7){return function(_0x5171b3){try{jsonpatch['apply'](_0x5171b3,_0x2eaaf7,!![]);}catch(_0x3a70c7){return BPromise[_0x57ca('0x2f')](_0x3a70c7);}return _0x5171b3[_0x57ca('0x30')]();};}function saveUpdates(_0x36ae70,_0x2d0842){return function(_0x4f24b4){if(_0x4f24b4){return _0x4f24b4[_0x57ca('0x31')](_0x36ae70)[_0x57ca('0x1a')](function(_0x1d413b){return _0x1d413b;});}return null;};}function removeEntity(_0x115f3d,_0x260e7a){return function(_0x389de8){if(_0x389de8){return _0x389de8[_0x57ca('0x32')]()['then'](function(){var _0x5613f8=_0x389de8['get']({'plain':!![]});var _0x56a631=_0x57ca('0x33');return db['UserProfileResource'][_0x57ca('0x32')]({'where':{'type':_0x56a631,'resourceId':_0x5613f8['id']}})[_0x57ca('0x1a')](function(){return _0x389de8;});})['then'](function(){_0x115f3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4057b1,_0x2c657d){return function(_0x3a5ed8){if(!_0x3a5ed8){_0x4057b1[_0x57ca('0x25')](0x194);}return _0x3a5ed8;};}function handleError(_0xd2e148,_0x443d2e){_0x443d2e=_0x443d2e||0x1f4;return function(_0x36e420){logger[_0x57ca('0x20')](_0x36e420[_0x57ca('0x34')]);if(_0x36e420[_0x57ca('0x35')]){delete _0x36e420[_0x57ca('0x35')];}_0xd2e148[_0x57ca('0x26')](_0x443d2e)[_0x57ca('0x36')](_0x36e420);};}exports['index']=function(_0x25705f,_0x6a44c0){var _0x16ba2f={},_0x3b6803={},_0xe19286={'count':0x0,'rows':[]};var _0x41afb8=_[_0x57ca('0x37')](db[_0x57ca('0x38')][_0x57ca('0x39')],function(_0x285dde){return{'name':_0x285dde[_0x57ca('0x3a')],'type':_0x285dde[_0x57ca('0x3b')]['key']};});_0x3b6803[_0x57ca('0x3c')]=_[_0x57ca('0x37')](_0x41afb8,'name');_0x3b6803[_0x57ca('0x3d')]=_[_0x57ca('0x3e')](_0x25705f[_0x57ca('0x3d')]);_0x3b6803[_0x57ca('0x3f')]=_[_0x57ca('0x40')](_0x3b6803[_0x57ca('0x3c')],_0x3b6803[_0x57ca('0x3d')]);_0x16ba2f['attributes']=_[_0x57ca('0x40')](_0x3b6803[_0x57ca('0x3c')],qs['fields'](_0x25705f[_0x57ca('0x3d')]['fields']));_0x16ba2f['attributes']=_0x16ba2f[_0x57ca('0x41')][_0x57ca('0x42')]?_0x16ba2f[_0x57ca('0x41')]:_0x3b6803[_0x57ca('0x3c')];if(!_0x25705f[_0x57ca('0x3d')]['hasOwnProperty']('nolimit')){_0x16ba2f[_0x57ca('0x2c')]=qs[_0x57ca('0x2c')](_0x25705f[_0x57ca('0x3d')][_0x57ca('0x2c')]);_0x16ba2f[_0x57ca('0x2b')]=qs['offset'](_0x25705f[_0x57ca('0x3d')][_0x57ca('0x2b')]);}_0x16ba2f[_0x57ca('0x43')]=qs[_0x57ca('0x44')](_0x25705f[_0x57ca('0x3d')][_0x57ca('0x44')]);_0x16ba2f[_0x57ca('0x45')]=qs[_0x57ca('0x3f')](_['pick'](_0x25705f[_0x57ca('0x3d')],_0x3b6803[_0x57ca('0x3f')]),_0x41afb8);if(_0x25705f['query'][_0x57ca('0x46')]){_0x16ba2f['where']=_[_0x57ca('0x47')](_0x16ba2f[_0x57ca('0x45')],{'$or':_[_0x57ca('0x37')](_0x41afb8,function(_0x9aa4cf){if(_0x9aa4cf[_0x57ca('0x3b')]!==_0x57ca('0x48')){var _0x4e9eb9={};_0x4e9eb9[_0x9aa4cf[_0x57ca('0x35')]]={'$like':'%'+_0x25705f[_0x57ca('0x3d')]['filter']+'%'};return _0x4e9eb9;}})});}_0x16ba2f=_[_0x57ca('0x47')]({},_0x16ba2f,_0x25705f[_0x57ca('0x49')]);var _0x3a6fdd={'where':_0x16ba2f[_0x57ca('0x45')]};return db[_0x57ca('0x38')][_0x57ca('0x2a')](_0x3a6fdd)[_0x57ca('0x1a')](function(_0x3994f8){_0xe19286[_0x57ca('0x2a')]=_0x3994f8;if(_0x25705f[_0x57ca('0x3d')][_0x57ca('0x4a')]){_0x16ba2f[_0x57ca('0x4b')]=[{'all':!![]}];}return db[_0x57ca('0x38')][_0x57ca('0x4c')](_0x16ba2f);})[_0x57ca('0x1a')](function(_0x276b9d){_0xe19286[_0x57ca('0x4d')]=_0x276b9d;return _0xe19286;})[_0x57ca('0x1a')](respondWithFilteredResult(_0x6a44c0,_0x16ba2f))[_0x57ca('0x24')](handleError(_0x6a44c0,null));};exports[_0x57ca('0x4e')]=function(_0x56a778,_0x6926b){var _0x100521={'raw':![],'where':{'id':_0x56a778[_0x57ca('0x4f')]['id']}},_0xf95901={};_0xf95901[_0x57ca('0x3c')]=_[_0x57ca('0x3e')](db[_0x57ca('0x38')][_0x57ca('0x39')]);_0xf95901['query']=_[_0x57ca('0x3e')](_0x56a778['query']);_0xf95901[_0x57ca('0x3f')]=_[_0x57ca('0x40')](_0xf95901['model'],_0xf95901[_0x57ca('0x3d')]);_0x100521[_0x57ca('0x41')]=_[_0x57ca('0x40')](_0xf95901['model'],qs[_0x57ca('0x50')](_0x56a778[_0x57ca('0x3d')][_0x57ca('0x50')]));_0x100521[_0x57ca('0x41')]=_0x100521[_0x57ca('0x41')]['length']?_0x100521['attributes']:_0xf95901[_0x57ca('0x3c')];if(_0x56a778['query'][_0x57ca('0x4a')]){_0x100521[_0x57ca('0x4b')]=[{'all':!![]}];}_0x100521=_[_0x57ca('0x47')]({},_0x100521,_0x56a778['options']);return db[_0x57ca('0x38')][_0x57ca('0x51')](_0x100521)[_0x57ca('0x1a')](handleEntityNotFound(_0x6926b,null))['then'](respondWithResult(_0x6926b,null))['catch'](handleError(_0x6926b,null));};exports[_0x57ca('0x52')]=function(_0x3dcd1d,_0x47ef60,_0x25fb73){var _0xd7a85b;return db[_0x57ca('0x38')][_0x57ca('0x52')](_0x3dcd1d[_0x57ca('0x53')],{'raw':!![]})['then'](function(_0x308957){_0xd7a85b=_0x308957;return db[_0x57ca('0x38')][_0x57ca('0x4c')]({'raw':!![]});})[_0x57ca('0x1a')](function(_0x53f4a4){var _0x5e263b=fs[_0x57ca('0x54')](path[_0x57ca('0x55')](config[_0x57ca('0x56')],_0x57ca('0x57')),_0x57ca('0x58'));var _0x35d9be=ejs[_0x57ca('0x59')](_0x5e263b,{'contexts':_0x53f4a4||[]});fs[_0x57ca('0x5a')](_0x57ca('0x5b'),_0x35d9be);})[_0x57ca('0x1a')](function(){return respondWithRpcPromise(_0x57ca('0x5c'),_0x57ca('0x52'),{'module':_0x57ca('0x5d')});})[_0x57ca('0x1a')](function(){var _0x344e77=_0x3dcd1d[_0x57ca('0x5e')][_0x57ca('0x5f')]({'plain':!![]});if(!_0x344e77)throw new Error(_0x57ca('0x60'));if(_0x344e77[_0x57ca('0x61')]==='user'){var _0x41566f=_0xd7a85b[_0x57ca('0x5f')]({'plain':!![]});return db[_0x57ca('0x62')][_0x57ca('0x51')]({'where':{'name':_0x57ca('0x33'),'userProfileId':_0x344e77[_0x57ca('0x63')]},'raw':!![]})[_0x57ca('0x1a')](function(_0x141569){if(_0x141569&&_0x141569[_0x57ca('0x64')]===0x0){return db['UserProfileResource'][_0x57ca('0x52')]({'name':_0x41566f[_0x57ca('0x35')],'resourceId':_0x41566f['id'],'type':_0x141569[_0x57ca('0x35')],'sectionId':_0x141569['id']},{})[_0x57ca('0x1a')](function(){return _0xd7a85b;});}else{return _0xd7a85b;}})[_0x57ca('0x24')](function(_0x139e29){logger[_0x57ca('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139e29);throw _0x139e29;});}return _0xd7a85b;})[_0x57ca('0x1a')](respondWithResult(_0x47ef60,0xc9))[_0x57ca('0x24')](handleError(_0x47ef60,null));};exports[_0x57ca('0x31')]=function(_0x5d0686,_0x4ae474,_0x353a61){var _0x488f4e;return db['VoiceContext']['find']({'where':{'id':_0x5d0686[_0x57ca('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4ae474,null))['then'](saveUpdates(_0x5d0686[_0x57ca('0x53')],null))[_0x57ca('0x1a')](function(_0x19f2ac){if(_0x19f2ac){_0x488f4e=_0x19f2ac;return db[_0x57ca('0x38')][_0x57ca('0x4c')]({'raw':!![]});}})[_0x57ca('0x1a')](function(_0x581560){var _0x4a9535=fs[_0x57ca('0x54')](path[_0x57ca('0x55')](config['root'],_0x57ca('0x57')),_0x57ca('0x58'));var _0x16779b=ejs['render'](_0x4a9535,{'contexts':_0x581560||[]});fs[_0x57ca('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x16779b);})['then'](function(){return respondWithRpcPromise(_0x57ca('0x5c'),_0x57ca('0x31'),{'module':'chan_sip.so'});})['then'](function(){return _0x488f4e;})['then'](respondWithResult(_0x4ae474,null))['catch'](handleError(_0x4ae474,null));};exports['destroy']=function(_0x1f67cb,_0x50b7ef,_0x5094b6){var _0x590961;return db[_0x57ca('0x38')]['find']({'where':{'id':_0x1f67cb['params']['id']}})[_0x57ca('0x1a')](handleEntityNotFound(_0x50b7ef,null))[_0x57ca('0x1a')](removeEntity(_0x50b7ef,null))[_0x57ca('0x1a')](function(){return db[_0x57ca('0x38')][_0x57ca('0x4c')]({'raw':!![]});})[_0x57ca('0x1a')](function(_0x3c6214){var _0x1326a4=fs[_0x57ca('0x54')](path[_0x57ca('0x55')](config[_0x57ca('0x56')],_0x57ca('0x57')),_0x57ca('0x58'));var _0xfd2621=ejs[_0x57ca('0x59')](_0x1326a4,{'contexts':_0x3c6214});fs[_0x57ca('0x5a')](_0x57ca('0x5b'),_0xfd2621);return respondWithRpcPromise(_0x57ca('0x5c'),_0x57ca('0x32'),{'module':'chan_sip.so'});})[_0x57ca('0x24')](handleError(_0x50b7ef,null));}; \ No newline at end of file +var _0x62c9=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','get','Contexts','destroy','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','find','autoAssociation','render','writeFileSync','eml-format'];(function(_0x24ca51,_0x4d69dd){var _0x58d4da=function(_0x4497c4){while(--_0x4497c4){_0x24ca51['push'](_0x24ca51['shift']());}};_0x58d4da(++_0x4d69dd);}(_0x62c9,0x66));var _0x962c=function(_0x6c4017,_0x6a3ab1){_0x6c4017=_0x6c4017-0x0;var _0x2b8983=_0x62c9[_0x6c4017];return _0x2b8983;};'use strict';var emlformat=require(_0x962c('0x0'));var rimraf=require(_0x962c('0x1'));var zipdir=require(_0x962c('0x2'));var jsonpatch=require(_0x962c('0x3'));var rp=require('request-promise');var moment=require(_0x962c('0x4'));var BPromise=require(_0x962c('0x5'));var Mustache=require(_0x962c('0x6'));var util=require('util');var path=require(_0x962c('0x7'));var sox=require('sox');var csv=require(_0x962c('0x8'));var ejs=require(_0x962c('0x9'));var fs=require('fs');var fs_extra=require(_0x962c('0xa'));var _=require(_0x962c('0xb'));var squel=require(_0x962c('0xc'));var crypto=require(_0x962c('0xd'));var jsforce=require(_0x962c('0xe'));var deskjs=require(_0x962c('0xf'));var toCsv=require(_0x962c('0x8'));var querystring=require(_0x962c('0x10'));var Papa=require('papaparse');var Redis=require(_0x962c('0x11'));var authService=require(_0x962c('0x12'));var qs=require(_0x962c('0x13'));var as=require(_0x962c('0x14'));var hardwareService=require(_0x962c('0x15'));var logger=require('../../config/logger')(_0x962c('0x16'));var utils=require('../../config/utils');var config=require(_0x962c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x962c('0x18'));var client=jayson[_0x962c('0x19')][_0x962c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xf73a5d,_0x4474c9,_0x59696a,_0x39b4c7){return new BPromise(function(_0x1171f9,_0x4d1a26){var _0x422bcd=_0x39b4c7||client;return _0x422bcd[_0x962c('0x1b')](_0xf73a5d,_0x59696a)['then'](function(_0x23c9f4){logger[_0x962c('0x1c')](_0x962c('0x1d'),_0x4474c9,_0x962c('0x1e'));logger[_0x962c('0x1f')](_0x962c('0x20'),_0x4474c9,_0x962c('0x1e'),JSON['stringify'](_0x23c9f4));if(_0x23c9f4[_0x962c('0x21')]){if(_0x23c9f4[_0x962c('0x21')][_0x962c('0x22')]===0x1f4){logger[_0x962c('0x21')](_0x962c('0x1d'),_0x4474c9,_0x23c9f4['error']['message']);return _0x4d1a26(_0x23c9f4[_0x962c('0x21')]['message']);}logger['error'](_0x962c('0x1d'),_0x4474c9,_0x23c9f4[_0x962c('0x21')][_0x962c('0x23')]);return _0x1171f9(_0x23c9f4['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x4474c9,_0x962c('0x1e'));_0x1171f9(_0x23c9f4[_0x962c('0x24')]['message']);}})[_0x962c('0x25')](function(_0x3e12d9){logger['error'](_0x962c('0x1d'),_0x4474c9,_0x3e12d9);_0x4d1a26(_0x3e12d9);});});}function respondWithStatusCode(_0x3f54b1,_0xcbb09d){_0xcbb09d=_0xcbb09d||0xcc;return function(_0x2ad8d8){if(_0x2ad8d8){return _0x3f54b1[_0x962c('0x26')](_0xcbb09d);}return _0x3f54b1['status'](_0xcbb09d)[_0x962c('0x27')]();};}function respondWithResult(_0x267596,_0x1b8376){_0x1b8376=_0x1b8376||0xc8;return function(_0x48e74b){if(_0x48e74b){return _0x267596[_0x962c('0x28')](_0x1b8376)['json'](_0x48e74b);}};}function respondWithFilteredResult(_0x38fae1,_0x582630){return function(_0x45ef71){if(_0x45ef71){var _0x51cc0c=typeof _0x582630[_0x962c('0x29')]===_0x962c('0x2a')&&typeof _0x582630[_0x962c('0x2b')]===_0x962c('0x2a');var _0x247050=_0x45ef71['count'];var _0x3e107b=_0x51cc0c?0x0:_0x582630['offset'];var _0x50d55c=_0x51cc0c?_0x45ef71[_0x962c('0x2c')]:_0x582630[_0x962c('0x29')]+_0x582630['limit'];var _0x2364d6;if(_0x50d55c>=_0x247050){_0x50d55c=_0x247050;_0x2364d6=0xc8;}else{_0x2364d6=0xce;}_0x38fae1[_0x962c('0x28')](_0x2364d6);return _0x38fae1['set']('Content-Range',_0x3e107b+'-'+_0x50d55c+'/'+_0x247050)[_0x962c('0x2d')](_0x45ef71);}return null;};}function patchUpdates(_0xdaafe5){return function(_0x59bfdc){try{jsonpatch[_0x962c('0x2e')](_0x59bfdc,_0xdaafe5,!![]);}catch(_0x4199a1){return BPromise[_0x962c('0x2f')](_0x4199a1);}return _0x59bfdc[_0x962c('0x30')]();};}function saveUpdates(_0x51cbf7,_0x30493f){return function(_0x29aa4a){if(_0x29aa4a){return _0x29aa4a[_0x962c('0x31')](_0x51cbf7)[_0x962c('0x32')](function(_0x352c69){return _0x352c69;});}return null;};}function removeEntity(_0x25af91,_0x25a846){return function(_0xeb62f8){if(_0xeb62f8){return _0xeb62f8['destroy']()[_0x962c('0x32')](function(){var _0x35e06e=_0xeb62f8[_0x962c('0x33')]({'plain':!![]});var _0x1d8d6b=_0x962c('0x34');return db['UserProfileResource'][_0x962c('0x35')]({'where':{'type':_0x1d8d6b,'resourceId':_0x35e06e['id']}})[_0x962c('0x32')](function(){return _0xeb62f8;});})['then'](function(){_0x25af91['status'](0xcc)[_0x962c('0x27')]();});}};}function handleEntityNotFound(_0xfa1e62,_0x1e5a46){return function(_0x24c3ba){if(!_0x24c3ba){_0xfa1e62['sendStatus'](0x194);}return _0x24c3ba;};}function handleError(_0x1e1d20,_0x5bfd5d){_0x5bfd5d=_0x5bfd5d||0x1f4;return function(_0x4da90f){logger[_0x962c('0x21')](_0x4da90f[_0x962c('0x36')]);if(_0x4da90f['name']){delete _0x4da90f[_0x962c('0x37')];}_0x1e1d20[_0x962c('0x28')](_0x5bfd5d)[_0x962c('0x38')](_0x4da90f);};}exports[_0x962c('0x39')]=function(_0x4eff71,_0x4a8735){var _0x945895={},_0xc25e62={},_0x34aa4c={'count':0x0,'rows':[]};var _0x301e73=_[_0x962c('0x3a')](db[_0x962c('0x3b')][_0x962c('0x3c')],function(_0x53f3ea){return{'name':_0x53f3ea[_0x962c('0x3d')],'type':_0x53f3ea[_0x962c('0x3e')]['key']};});_0xc25e62[_0x962c('0x3f')]=_[_0x962c('0x3a')](_0x301e73,_0x962c('0x37'));_0xc25e62[_0x962c('0x40')]=_['keys'](_0x4eff71['query']);_0xc25e62[_0x962c('0x41')]=_[_0x962c('0x42')](_0xc25e62[_0x962c('0x3f')],_0xc25e62[_0x962c('0x40')]);_0x945895[_0x962c('0x43')]=_[_0x962c('0x42')](_0xc25e62['model'],qs['fields'](_0x4eff71[_0x962c('0x40')][_0x962c('0x44')]));_0x945895['attributes']=_0x945895[_0x962c('0x43')][_0x962c('0x45')]?_0x945895['attributes']:_0xc25e62[_0x962c('0x3f')];if(!_0x4eff71[_0x962c('0x40')][_0x962c('0x46')](_0x962c('0x47'))){_0x945895[_0x962c('0x2b')]=qs[_0x962c('0x2b')](_0x4eff71[_0x962c('0x40')][_0x962c('0x2b')]);_0x945895[_0x962c('0x29')]=qs[_0x962c('0x29')](_0x4eff71[_0x962c('0x40')]['offset']);}_0x945895[_0x962c('0x48')]=qs[_0x962c('0x49')](_0x4eff71['query'][_0x962c('0x49')]);_0x945895[_0x962c('0x4a')]=qs[_0x962c('0x41')](_[_0x962c('0x4b')](_0x4eff71[_0x962c('0x40')],_0xc25e62[_0x962c('0x41')]),_0x301e73);if(_0x4eff71[_0x962c('0x40')][_0x962c('0x4c')]){_0x945895[_0x962c('0x4a')]=_[_0x962c('0x4d')](_0x945895[_0x962c('0x4a')],{'$or':_[_0x962c('0x3a')](_0x301e73,function(_0x4cea5e){if(_0x4cea5e[_0x962c('0x3e')]!==_0x962c('0x4e')){var _0x1609b3={};_0x1609b3[_0x4cea5e[_0x962c('0x37')]]={'$like':'%'+_0x4eff71[_0x962c('0x40')][_0x962c('0x4c')]+'%'};return _0x1609b3;}})});}_0x945895=_[_0x962c('0x4d')]({},_0x945895,_0x4eff71[_0x962c('0x4f')]);var _0x45be81={'where':_0x945895[_0x962c('0x4a')]};return db[_0x962c('0x3b')]['count'](_0x45be81)['then'](function(_0x1672f0){_0x34aa4c[_0x962c('0x2c')]=_0x1672f0;if(_0x4eff71[_0x962c('0x40')][_0x962c('0x50')]){_0x945895[_0x962c('0x51')]=[{'all':!![]}];}return db[_0x962c('0x3b')]['findAll'](_0x945895);})['then'](function(_0x1eb15c){_0x34aa4c[_0x962c('0x52')]=_0x1eb15c;return _0x34aa4c;})[_0x962c('0x32')](respondWithFilteredResult(_0x4a8735,_0x945895))[_0x962c('0x25')](handleError(_0x4a8735,null));};exports[_0x962c('0x53')]=function(_0x5492e5,_0x43983d){var _0x44d60c={'raw':![],'where':{'id':_0x5492e5[_0x962c('0x54')]['id']}},_0x57fed9={};_0x57fed9[_0x962c('0x3f')]=_[_0x962c('0x55')](db['VoiceContext'][_0x962c('0x3c')]);_0x57fed9[_0x962c('0x40')]=_[_0x962c('0x55')](_0x5492e5[_0x962c('0x40')]);_0x57fed9[_0x962c('0x41')]=_[_0x962c('0x42')](_0x57fed9[_0x962c('0x3f')],_0x57fed9[_0x962c('0x40')]);_0x44d60c[_0x962c('0x43')]=_[_0x962c('0x42')](_0x57fed9['model'],qs[_0x962c('0x44')](_0x5492e5[_0x962c('0x40')]['fields']));_0x44d60c[_0x962c('0x43')]=_0x44d60c[_0x962c('0x43')][_0x962c('0x45')]?_0x44d60c[_0x962c('0x43')]:_0x57fed9[_0x962c('0x3f')];if(_0x5492e5[_0x962c('0x40')][_0x962c('0x50')]){_0x44d60c['include']=[{'all':!![]}];}_0x44d60c=_[_0x962c('0x4d')]({},_0x44d60c,_0x5492e5['options']);return db[_0x962c('0x3b')]['find'](_0x44d60c)[_0x962c('0x32')](handleEntityNotFound(_0x43983d,null))[_0x962c('0x32')](respondWithResult(_0x43983d,null))[_0x962c('0x25')](handleError(_0x43983d,null));};exports[_0x962c('0x56')]=function(_0x331822,_0xffe010,_0x348c42){var _0x586858;return db[_0x962c('0x3b')][_0x962c('0x56')](_0x331822[_0x962c('0x57')],{'raw':!![]})[_0x962c('0x32')](function(_0xc13969){_0x586858=_0xc13969;return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});})[_0x962c('0x32')](function(_0x2a9c50){var _0x8f9bc7=fs[_0x962c('0x59')](path[_0x962c('0x5a')](config[_0x962c('0x5b')],_0x962c('0x5c')),'utf8');var _0x1f4071=ejs['render'](_0x8f9bc7,{'contexts':_0x2a9c50||[]});fs['writeFileSync'](_0x962c('0x5d'),_0x1f4071);})['then'](function(){return respondWithRpcPromise(_0x962c('0x5e'),'create',{'module':_0x962c('0x5f')});})[_0x962c('0x32')](function(){var _0xeed9c3=_0x331822[_0x962c('0x60')][_0x962c('0x33')]({'plain':!![]});if(!_0xeed9c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeed9c3[_0x962c('0x61')]==='user'){var _0x29faf0=_0x586858[_0x962c('0x33')]({'plain':!![]});return db[_0x962c('0x62')][_0x962c('0x63')]({'where':{'name':'Contexts','userProfileId':_0xeed9c3['userProfileId']},'raw':!![]})['then'](function(_0x363a27){if(_0x363a27&&_0x363a27[_0x962c('0x64')]===0x0){return db['UserProfileResource'][_0x962c('0x56')]({'name':_0x29faf0[_0x962c('0x37')],'resourceId':_0x29faf0['id'],'type':_0x363a27[_0x962c('0x37')],'sectionId':_0x363a27['id']},{})[_0x962c('0x32')](function(){return _0x586858;});}else{return _0x586858;}})[_0x962c('0x25')](function(_0xc6aae4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc6aae4);throw _0xc6aae4;});}return _0x586858;})[_0x962c('0x32')](respondWithResult(_0xffe010,0xc9))[_0x962c('0x25')](handleError(_0xffe010,null));};exports[_0x962c('0x31')]=function(_0x4635fc,_0x397bd2,_0x5fbcc4){var _0x3f84d7;return db['VoiceContext'][_0x962c('0x63')]({'where':{'id':_0x4635fc[_0x962c('0x54')]['id']}})[_0x962c('0x32')](handleEntityNotFound(_0x397bd2,null))['then'](saveUpdates(_0x4635fc[_0x962c('0x57')],null))[_0x962c('0x32')](function(_0x358664){if(_0x358664){_0x3f84d7=_0x358664;return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});}})[_0x962c('0x32')](function(_0x23f1de){var _0x3b43e1=fs['readFileSync'](path['join'](config[_0x962c('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x25f5f0=ejs[_0x962c('0x65')](_0x3b43e1,{'contexts':_0x23f1de||[]});fs[_0x962c('0x66')](_0x962c('0x5d'),_0x25f5f0);})[_0x962c('0x32')](function(){return respondWithRpcPromise(_0x962c('0x5e'),'update',{'module':_0x962c('0x5f')});})[_0x962c('0x32')](function(){return _0x3f84d7;})['then'](respondWithResult(_0x397bd2,null))[_0x962c('0x25')](handleError(_0x397bd2,null));};exports[_0x962c('0x35')]=function(_0x3def9a,_0x4450d9,_0x273e81){var _0x10b5d1;return db[_0x962c('0x3b')]['find']({'where':{'id':_0x3def9a[_0x962c('0x54')]['id']}})[_0x962c('0x32')](handleEntityNotFound(_0x4450d9,null))['then'](removeEntity(_0x4450d9,null))[_0x962c('0x32')](function(){return db[_0x962c('0x3b')][_0x962c('0x58')]({'raw':!![]});})[_0x962c('0x32')](function(_0x1d11cc){var _0x339ab0=fs[_0x962c('0x59')](path[_0x962c('0x5a')](config['root'],_0x962c('0x5c')),'utf8');var _0x1530c7=ejs[_0x962c('0x65')](_0x339ab0,{'contexts':_0x1d11cc});fs[_0x962c('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1530c7);return respondWithRpcPromise(_0x962c('0x5e'),'destroy',{'module':_0x962c('0x5f')});})[_0x962c('0x25')](handleError(_0x4450d9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index caa4124..62a3efd 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 _0xb652=['util','api','rimraf','./voiceContext.attributes','exports','voice_contexts'];(function(_0x52b91f,_0x499757){var _0x15f8f5=function(_0x33fbf6){while(--_0x33fbf6){_0x52b91f['push'](_0x52b91f['shift']());}};_0x15f8f5(++_0x499757);}(_0xb652,0x1ce));var _0x2b65=function(_0x143a3d,_0x2b4e25){_0x143a3d=_0x143a3d-0x0;var _0x4483df=_0xb652[_0x143a3d];return _0x4483df;};'use strict';var _=require('lodash');var util=require(_0x2b65('0x0'));var logger=require('../../config/logger')(_0x2b65('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b65('0x2'));var config=require('../../config/environment');var attributes=require(_0x2b65('0x3'));module[_0x2b65('0x4')]=function(_0x23c03e,_0x2c20b4){return _0x23c03e['define']('VoiceContext',attributes,{'tableName':_0x2b65('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x905b=['path','rimraf','../../config/environment','exports','voice_contexts','lodash','util','../../config/logger','api','request-promise'];(function(_0x1b7297,_0x488719){var _0x2c8eb4=function(_0x5252a4){while(--_0x5252a4){_0x1b7297['push'](_0x1b7297['shift']());}};_0x2c8eb4(++_0x488719);}(_0x905b,0x87));var _0xb905=function(_0x115f3d,_0x963277){_0x115f3d=_0x115f3d-0x0;var _0x6e69f9=_0x905b[_0x115f3d];return _0x6e69f9;};'use strict';var _=require(_0xb905('0x0'));var util=require(_0xb905('0x1'));var logger=require(_0xb905('0x2'))(_0xb905('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb905('0x4'));var fs=require('fs');var path=require(_0xb905('0x5'));var rimraf=require(_0xb905('0x6'));var config=require(_0xb905('0x7'));var attributes=require('./voiceContext.attributes');module[_0xb905('0x8')]=function(_0x294506,_0x5b89c2){return _0x294506['define']('VoiceContext',attributes,{'tableName':_0xb905('0x9'),'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 07c5720..7acc179 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 _0x336d=['http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cab41,_0x4bfa57){var _0x511deb=function(_0x3d1a43){while(--_0x3d1a43){_0x1cab41['push'](_0x1cab41['shift']());}};_0x511deb(++_0x4bfa57);}(_0x336d,0xae));var _0xd336=function(_0x36ee11,_0x504823){_0x36ee11=_0x36ee11-0x0;var _0x164a8e=_0x336d[_0x36ee11];return _0x164a8e;};'use strict';var _=require('lodash');var util=require(_0xd336('0x0'));var moment=require(_0xd336('0x1'));var BPromise=require(_0xd336('0x2'));var rs=require(_0xd336('0x3'));var fs=require('fs');var Redis=require(_0xd336('0x4'));var db=require(_0xd336('0x5'))['db'];var utils=require(_0xd336('0x6'));var logger=require(_0xd336('0x7'))(_0xd336('0x8'));var config=require(_0xd336('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd336('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23c751,_0x3cf826,_0x5debef){return new BPromise(function(_0x419f42,_0x223e93){return client[_0xd336('0xb')](_0x23c751,_0x5debef)[_0xd336('0xc')](function(_0x198845){logger[_0xd336('0xd')](_0xd336('0xe'),_0x3cf826,_0xd336('0xf'));logger[_0xd336('0x10')](_0xd336('0x11'),_0x3cf826,'request\x20sent',JSON['stringify'](_0x198845));if(_0x198845[_0xd336('0x12')]){if(_0x198845[_0xd336('0x12')][_0xd336('0x13')]===0x1f4){logger[_0xd336('0x12')](_0xd336('0xe'),_0x3cf826,_0x198845[_0xd336('0x12')][_0xd336('0x14')]);return _0x223e93(_0x198845[_0xd336('0x12')][_0xd336('0x14')]);}logger[_0xd336('0x12')]('VoiceContext,\x20%s,\x20%s',_0x3cf826,_0x198845[_0xd336('0x12')]['message']);return _0x419f42(_0x198845[_0xd336('0x12')][_0xd336('0x14')]);}else{logger[_0xd336('0xd')](_0xd336('0xe'),_0x3cf826,_0xd336('0xf'));_0x419f42(_0x198845[_0xd336('0x15')][_0xd336('0x14')]);}})[_0xd336('0x16')](function(_0x46432f){logger[_0xd336('0x12')](_0xd336('0xe'),_0x3cf826,_0x46432f);_0x223e93(_0x46432f);});});} \ No newline at end of file +var _0x5433=['error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c5a60,_0x327a29){var _0x1ece60=function(_0x350827){while(--_0x350827){_0x3c5a60['push'](_0x3c5a60['shift']());}};_0x1ece60(++_0x327a29);}(_0x5433,0x9f));var _0x3543=function(_0x3c9ccb,_0xe17a4f){_0x3c9ccb=_0x3c9ccb-0x0;var _0xb5a2ba=_0x5433[_0x3c9ccb];return _0xb5a2ba;};'use strict';var _=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var moment=require(_0x3543('0x2'));var BPromise=require(_0x3543('0x3'));var rs=require(_0x3543('0x4'));var fs=require('fs');var Redis=require(_0x3543('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3543('0x6'));var logger=require(_0x3543('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3543('0x8'));var client=jayson[_0x3543('0x9')][_0x3543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34abfe,_0x5e8b5d,_0x24794a){return new BPromise(function(_0x13339f,_0x4b8027){return client[_0x3543('0xb')](_0x34abfe,_0x24794a)[_0x3543('0xc')](function(_0x382389){logger[_0x3543('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5e8b5d,_0x3543('0xe'));logger['debug'](_0x3543('0xf'),_0x5e8b5d,_0x3543('0xe'),JSON[_0x3543('0x10')](_0x382389));if(_0x382389[_0x3543('0x11')]){if(_0x382389[_0x3543('0x11')][_0x3543('0x12')]===0x1f4){logger[_0x3543('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5e8b5d,_0x382389['error'][_0x3543('0x13')]);return _0x4b8027(_0x382389['error'][_0x3543('0x13')]);}logger[_0x3543('0x11')](_0x3543('0x14'),_0x5e8b5d,_0x382389['error'][_0x3543('0x13')]);return _0x13339f(_0x382389['error'][_0x3543('0x13')]);}else{logger[_0x3543('0xd')](_0x3543('0x14'),_0x5e8b5d,_0x3543('0xe'));_0x13339f(_0x382389['result']['message']);}})[_0x3543('0x15')](function(_0xb315bb){logger['error'](_0x3543('0x14'),_0x5e8b5d,_0xb315bb);_0x4b8027(_0xb315bb);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b37c434..b3234d7 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 _0x44c8=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','show','create','update','delete','destroy','exports','util'];(function(_0x14b87d,_0x1055a3){var _0x10a1eb=function(_0x460035){while(--_0x460035){_0x14b87d['push'](_0x14b87d['shift']());}};_0x10a1eb(++_0x1055a3);}(_0x44c8,0xaa));var _0x844c=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x44c8[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require(_0x844c('0x0'));var path=require(_0x844c('0x1'));var timeout=require(_0x844c('0x2'));var express=require('express');var router=express[_0x844c('0x3')]();var fs_extra=require(_0x844c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844c('0x5'));var config=require(_0x844c('0x6'));var controller=require(_0x844c('0x7'));router['get']('/',auth[_0x844c('0x8')](),controller[_0x844c('0x9')]);router[_0x844c('0xa')](_0x844c('0xb'),auth[_0x844c('0x8')](),controller[_0x844c('0xc')]);router[_0x844c('0xa')]('/:id',auth[_0x844c('0x8')](),controller[_0x844c('0xd')]);router['post']('/',auth[_0x844c('0x8')](),controller[_0x844c('0xe')]);router['put']('/:id',auth[_0x844c('0x8')](),controller[_0x844c('0xf')]);router[_0x844c('0x10')]('/:id',auth[_0x844c('0x8')](),controller[_0x844c('0x11')]);module[_0x844c('0x12')]=router; \ No newline at end of file +var _0x9292=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x30ab7e,_0x2d6c1d){var _0x23810b=function(_0x350b3e){while(--_0x350b3e){_0x30ab7e['push'](_0x30ab7e['shift']());}};_0x23810b(++_0x2d6c1d);}(_0x9292,0x176));var _0x2929=function(_0x3acbc1,_0x38c359){_0x3acbc1=_0x3acbc1-0x0;var _0x16afeb=_0x9292[_0x3acbc1];return _0x16afeb;};'use strict';var multer=require(_0x2929('0x0'));var util=require(_0x2929('0x1'));var path=require(_0x2929('0x2'));var timeout=require(_0x2929('0x3'));var express=require(_0x2929('0x4'));var router=express[_0x2929('0x5')]();var fs_extra=require(_0x2929('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2929('0x7'));var config=require(_0x2929('0x8'));var controller=require(_0x2929('0x9'));router[_0x2929('0xa')]('/',auth[_0x2929('0xb')](),controller['index']);router[_0x2929('0xa')](_0x2929('0xc'),auth[_0x2929('0xb')](),controller['describe']);router['get'](_0x2929('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2929('0xb')](),controller[_0x2929('0xe')]);router[_0x2929('0xf')](_0x2929('0xd'),auth[_0x2929('0xb')](),controller['update']);router[_0x2929('0x10')]('/:id',auth[_0x2929('0xb')](),controller[_0x2929('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5b51101..9480beb 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x27bfb7,_0x2b06b8){var _0x4ca182=function(_0x164d95){while(--_0x164d95){_0x27bfb7['push'](_0x27bfb7['shift']());}};_0x4ca182(++_0x2b06b8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x4b84[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x515608,_0xb33751){var _0x16aa3d=function(_0x27fe55){while(--_0x27fe55){_0x515608['push'](_0x515608['shift']());}};_0x16aa3d(++_0xb33751);}(_0xedd9,0xfc));var _0x9edd=function(_0x404b4f,_0x3615fe){_0x404b4f=_0x404b4f-0x0;var _0x563ad2=_0xedd9[_0x404b4f];return _0x563ad2;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f77908b..925b776 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 _0x3050=['findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x180a99,_0xa85652){var _0x37eef6=function(_0x19c367){while(--_0x19c367){_0x180a99['push'](_0x180a99['shift']());}};_0x37eef6(++_0xa85652);}(_0x3050,0x1d9));var _0x0305=function(_0x43cdb9,_0x254263){_0x43cdb9=_0x43cdb9-0x0;var _0x2c022d=_0x3050[_0x43cdb9];return _0x2c022d;};'use strict';var emlformat=require(_0x0305('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0305('0x1'));var jsonpatch=require(_0x0305('0x2'));var rp=require('request-promise');var moment=require(_0x0305('0x3'));var BPromise=require(_0x0305('0x4'));var Mustache=require(_0x0305('0x5'));var util=require(_0x0305('0x6'));var path=require(_0x0305('0x7'));var sox=require(_0x0305('0x8'));var csv=require(_0x0305('0x9'));var ejs=require(_0x0305('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0305('0xb'));var squel=require(_0x0305('0xc'));var crypto=require(_0x0305('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0305('0xe'));var toCsv=require(_0x0305('0x9'));var querystring=require(_0x0305('0xf'));var Papa=require(_0x0305('0x10'));var Redis=require(_0x0305('0x11'));var authService=require(_0x0305('0x12'));var qs=require(_0x0305('0x13'));var as=require(_0x0305('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0305('0x15'))(_0x0305('0x16'));var utils=require(_0x0305('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2875a5,_0x29f545){_0x29f545=_0x29f545||0xcc;return function(_0x2e07e4){if(_0x2e07e4){return _0x2875a5[_0x0305('0x18')](_0x29f545);}return _0x2875a5[_0x0305('0x19')](_0x29f545)[_0x0305('0x1a')]();};}function respondWithResult(_0x3c878a,_0x25caf0){_0x25caf0=_0x25caf0||0xc8;return function(_0x4b434f){if(_0x4b434f){return _0x3c878a[_0x0305('0x19')](_0x25caf0)[_0x0305('0x1b')](_0x4b434f);}};}function respondWithFilteredResult(_0x12a166,_0x1b0aea){return function(_0x18ba2b){if(_0x18ba2b){var _0x17e7ec=typeof _0x1b0aea[_0x0305('0x1c')]===_0x0305('0x1d')&&typeof _0x1b0aea['limit']==='undefined';var _0x19ba0b=_0x18ba2b['count'];var _0x3307f9=_0x17e7ec?0x0:_0x1b0aea['offset'];var _0x2f93d1=_0x17e7ec?_0x18ba2b[_0x0305('0x1e')]:_0x1b0aea['offset']+_0x1b0aea['limit'];var _0x5f572f;if(_0x2f93d1>=_0x19ba0b){_0x2f93d1=_0x19ba0b;_0x5f572f=0xc8;}else{_0x5f572f=0xce;}_0x12a166[_0x0305('0x19')](_0x5f572f);return _0x12a166[_0x0305('0x1f')](_0x0305('0x20'),_0x3307f9+'-'+_0x2f93d1+'/'+_0x19ba0b)[_0x0305('0x1b')](_0x18ba2b);}return null;};}function patchUpdates(_0x588eb7){return function(_0x4c0f51){try{jsonpatch[_0x0305('0x21')](_0x4c0f51,_0x588eb7,!![]);}catch(_0x355092){return BPromise[_0x0305('0x22')](_0x355092);}return _0x4c0f51[_0x0305('0x23')]();};}function saveUpdates(_0x46f3fb,_0x520bba){return function(_0x43df00){if(_0x43df00){return _0x43df00[_0x0305('0x24')](_0x46f3fb)[_0x0305('0x25')](function(_0x4a8bed){return _0x4a8bed;});}return null;};}function removeEntity(_0x563b40,_0x4221b9){return function(_0x5f55f4){if(_0x5f55f4){return _0x5f55f4[_0x0305('0x26')]()[_0x0305('0x25')](function(){_0x563b40[_0x0305('0x19')](0xcc)[_0x0305('0x1a')]();});}};}function handleEntityNotFound(_0x5a96f0,_0x11d11f){return function(_0x31bb32){if(!_0x31bb32){_0x5a96f0['sendStatus'](0x194);}return _0x31bb32;};}function handleError(_0x18ef7c,_0x3a0c10){_0x3a0c10=_0x3a0c10||0x1f4;return function(_0x5294aa){logger[_0x0305('0x27')](_0x5294aa['stack']);if(_0x5294aa[_0x0305('0x28')]){delete _0x5294aa[_0x0305('0x28')];}_0x18ef7c[_0x0305('0x19')](_0x3a0c10)['send'](_0x5294aa);};}exports[_0x0305('0x29')]=function(_0x27cf6e,_0x105bd8){var _0x2fab90={},_0x19b14d={},_0x1220b3={'count':0x0,'rows':[]};var _0x31d35b=_[_0x0305('0x2a')](db[_0x0305('0x2b')][_0x0305('0x2c')],function(_0x51de04){return{'name':_0x51de04[_0x0305('0x2d')],'type':_0x51de04[_0x0305('0x2e')][_0x0305('0x2f')]};});_0x19b14d[_0x0305('0x30')]=_[_0x0305('0x2a')](_0x31d35b,_0x0305('0x28'));_0x19b14d[_0x0305('0x31')]=_[_0x0305('0x32')](_0x27cf6e[_0x0305('0x31')]);_0x19b14d[_0x0305('0x33')]=_[_0x0305('0x34')](_0x19b14d['model'],_0x19b14d[_0x0305('0x31')]);_0x2fab90['attributes']=_['intersection'](_0x19b14d[_0x0305('0x30')],qs['fields'](_0x27cf6e[_0x0305('0x31')][_0x0305('0x35')]));_0x2fab90[_0x0305('0x36')]=_0x2fab90[_0x0305('0x36')]['length']?_0x2fab90[_0x0305('0x36')]:_0x19b14d[_0x0305('0x30')];if(!_0x27cf6e[_0x0305('0x31')][_0x0305('0x37')](_0x0305('0x38'))){_0x2fab90[_0x0305('0x39')]=qs[_0x0305('0x39')](_0x27cf6e[_0x0305('0x31')][_0x0305('0x39')]);_0x2fab90[_0x0305('0x1c')]=qs[_0x0305('0x1c')](_0x27cf6e[_0x0305('0x31')][_0x0305('0x1c')]);}_0x2fab90['order']=qs[_0x0305('0x3a')](_0x27cf6e[_0x0305('0x31')]['sort']);_0x2fab90[_0x0305('0x3b')]=qs[_0x0305('0x33')](_[_0x0305('0x3c')](_0x27cf6e[_0x0305('0x31')],_0x19b14d[_0x0305('0x33')]),_0x31d35b);if(_0x27cf6e[_0x0305('0x31')][_0x0305('0x3d')]){_0x2fab90['where']=_[_0x0305('0x3e')](_0x2fab90['where'],{'$or':_['map'](_0x31d35b,function(_0x5c378f){if(_0x5c378f[_0x0305('0x2e')]!==_0x0305('0x3f')){var _0x1e45cd={};_0x1e45cd[_0x5c378f[_0x0305('0x28')]]={'$like':'%'+_0x27cf6e[_0x0305('0x31')][_0x0305('0x3d')]+'%'};return _0x1e45cd;}})});}_0x2fab90=_['merge']({},_0x2fab90,_0x27cf6e[_0x0305('0x40')]);var _0x56c6cb={'where':_0x2fab90[_0x0305('0x3b')]};return db[_0x0305('0x2b')][_0x0305('0x1e')](_0x56c6cb)['then'](function(_0x1e7f84){_0x1220b3[_0x0305('0x1e')]=_0x1e7f84;if(_0x27cf6e[_0x0305('0x31')]['includeAll']){_0x2fab90[_0x0305('0x41')]=[{'all':!![]}];}return db[_0x0305('0x2b')][_0x0305('0x42')](_0x2fab90);})[_0x0305('0x25')](function(_0x29dc49){_0x1220b3[_0x0305('0x43')]=_0x29dc49;return _0x1220b3;})[_0x0305('0x25')](respondWithFilteredResult(_0x105bd8,_0x2fab90))[_0x0305('0x44')](handleError(_0x105bd8,null));};exports[_0x0305('0x45')]=function(_0x31bd32,_0x3d30f3){var _0x2f66ba={'raw':!![],'where':{'id':_0x31bd32[_0x0305('0x46')]['id']}},_0x5b0270={};_0x5b0270['model']=_[_0x0305('0x32')](db[_0x0305('0x2b')][_0x0305('0x2c')]);_0x5b0270[_0x0305('0x31')]=_[_0x0305('0x32')](_0x31bd32[_0x0305('0x31')]);_0x5b0270[_0x0305('0x33')]=_['intersection'](_0x5b0270[_0x0305('0x30')],_0x5b0270[_0x0305('0x31')]);_0x2f66ba[_0x0305('0x36')]=_[_0x0305('0x34')](_0x5b0270['model'],qs['fields'](_0x31bd32[_0x0305('0x31')][_0x0305('0x35')]));_0x2f66ba[_0x0305('0x36')]=_0x2f66ba[_0x0305('0x36')][_0x0305('0x47')]?_0x2f66ba[_0x0305('0x36')]:_0x5b0270[_0x0305('0x30')];if(_0x31bd32['query'][_0x0305('0x48')]){_0x2f66ba[_0x0305('0x41')]=[{'all':!![]}];}_0x2f66ba=_['merge']({},_0x2f66ba,_0x31bd32[_0x0305('0x40')]);return db[_0x0305('0x2b')][_0x0305('0x49')](_0x2f66ba)[_0x0305('0x25')](handleEntityNotFound(_0x3d30f3,null))['then'](respondWithResult(_0x3d30f3,null))[_0x0305('0x44')](handleError(_0x3d30f3,null));};exports[_0x0305('0x4a')]=function(_0x2c764,_0x3c6464){return db[_0x0305('0x2b')][_0x0305('0x4a')](_0x2c764[_0x0305('0x4b')],{})[_0x0305('0x25')](respondWithResult(_0x3c6464,0xc9))[_0x0305('0x44')](handleError(_0x3c6464,null));};exports[_0x0305('0x24')]=function(_0x1cd9d7,_0xac52e1){if(_0x1cd9d7[_0x0305('0x4b')]['id']){delete _0x1cd9d7['body']['id'];}return db[_0x0305('0x2b')][_0x0305('0x49')]({'where':{'id':_0x1cd9d7[_0x0305('0x46')]['id']}})['then'](handleEntityNotFound(_0xac52e1,null))['then'](saveUpdates(_0x1cd9d7[_0x0305('0x4b')],null))[_0x0305('0x25')](respondWithResult(_0xac52e1,null))[_0x0305('0x44')](handleError(_0xac52e1,null));};exports[_0x0305('0x26')]=function(_0x36b0e6,_0x17fdc6){return db[_0x0305('0x2b')]['find']({'where':{'id':_0x36b0e6['params']['id']}})['then'](handleEntityNotFound(_0x17fdc6,null))[_0x0305('0x25')](removeEntity(_0x17fdc6,null))[_0x0305('0x44')](handleError(_0x17fdc6,null));};exports[_0x0305('0x4c')]=function(_0x36f22f,_0x36d93e){return db[_0x0305('0x2b')]['describe']()['then'](respondWithResult(_0x36d93e,null))[_0x0305('0x44')](handleError(_0x36d93e,null));}; \ No newline at end of file +var _0xd028=['../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','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'];(function(_0x38d1e9,_0x4870a3){var _0x57c48d=function(_0x3974e8){while(--_0x3974e8){_0x38d1e9['push'](_0x38d1e9['shift']());}};_0x57c48d(++_0x4870a3);}(_0xd028,0x15f));var _0x8d02=function(_0x29f01f,_0x4f9429){_0x29f01f=_0x29f01f-0x0;var _0x404444=_0xd028[_0x29f01f];return _0x404444;};'use strict';var emlformat=require(_0x8d02('0x0'));var rimraf=require(_0x8d02('0x1'));var zipdir=require(_0x8d02('0x2'));var jsonpatch=require(_0x8d02('0x3'));var rp=require('request-promise');var moment=require(_0x8d02('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d02('0x5'));var util=require(_0x8d02('0x6'));var path=require(_0x8d02('0x7'));var sox=require(_0x8d02('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d02('0x9'));var _=require(_0x8d02('0xa'));var squel=require(_0x8d02('0xb'));var crypto=require(_0x8d02('0xc'));var jsforce=require(_0x8d02('0xd'));var deskjs=require(_0x8d02('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d02('0xf'));var Papa=require(_0x8d02('0x10'));var Redis=require(_0x8d02('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d02('0x12'));var as=require(_0x8d02('0x13'));var hardwareService=require(_0x8d02('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8d02('0x15'));var config=require(_0x8d02('0x16'));var licenseUtil=require(_0x8d02('0x17'));var db=require(_0x8d02('0x18'))['db'];function respondWithStatusCode(_0x49a70e,_0x3b4c0d){_0x3b4c0d=_0x3b4c0d||0xcc;return function(_0x287981){if(_0x287981){return _0x49a70e['sendStatus'](_0x3b4c0d);}return _0x49a70e['status'](_0x3b4c0d)[_0x8d02('0x19')]();};}function respondWithResult(_0x2186e6,_0x2e3886){_0x2e3886=_0x2e3886||0xc8;return function(_0x38db5b){if(_0x38db5b){return _0x2186e6['status'](_0x2e3886)['json'](_0x38db5b);}};}function respondWithFilteredResult(_0x1e9ce5,_0x141075){return function(_0x3bd720){if(_0x3bd720){var _0x39d61a=typeof _0x141075[_0x8d02('0x1a')]===_0x8d02('0x1b')&&typeof _0x141075['limit']===_0x8d02('0x1b');var _0x301d1e=_0x3bd720[_0x8d02('0x1c')];var _0x2ffbec=_0x39d61a?0x0:_0x141075[_0x8d02('0x1a')];var _0x4faf6e=_0x39d61a?_0x3bd720['count']:_0x141075[_0x8d02('0x1a')]+_0x141075[_0x8d02('0x1d')];var _0xcd4688;if(_0x4faf6e>=_0x301d1e){_0x4faf6e=_0x301d1e;_0xcd4688=0xc8;}else{_0xcd4688=0xce;}_0x1e9ce5[_0x8d02('0x1e')](_0xcd4688);return _0x1e9ce5[_0x8d02('0x1f')](_0x8d02('0x20'),_0x2ffbec+'-'+_0x4faf6e+'/'+_0x301d1e)[_0x8d02('0x21')](_0x3bd720);}return null;};}function patchUpdates(_0x56f9a3){return function(_0x5b607f){try{jsonpatch[_0x8d02('0x22')](_0x5b607f,_0x56f9a3,!![]);}catch(_0x5eefcf){return BPromise[_0x8d02('0x23')](_0x5eefcf);}return _0x5b607f[_0x8d02('0x24')]();};}function saveUpdates(_0xa86207,_0x375c6c){return function(_0xe8fc9f){if(_0xe8fc9f){return _0xe8fc9f[_0x8d02('0x25')](_0xa86207)[_0x8d02('0x26')](function(_0x56aad7){return _0x56aad7;});}return null;};}function removeEntity(_0x2068c4,_0x4ef4f8){return function(_0x3bfcb0){if(_0x3bfcb0){return _0x3bfcb0['destroy']()[_0x8d02('0x26')](function(){_0x2068c4[_0x8d02('0x1e')](0xcc)[_0x8d02('0x19')]();});}};}function handleEntityNotFound(_0x33c237,_0x39563f){return function(_0x128f19){if(!_0x128f19){_0x33c237[_0x8d02('0x27')](0x194);}return _0x128f19;};}function handleError(_0x9a792b,_0x1cc6f7){_0x1cc6f7=_0x1cc6f7||0x1f4;return function(_0x357d13){logger['error'](_0x357d13['stack']);if(_0x357d13[_0x8d02('0x28')]){delete _0x357d13[_0x8d02('0x28')];}_0x9a792b[_0x8d02('0x1e')](_0x1cc6f7)['send'](_0x357d13);};}exports['index']=function(_0x3e6724,_0x2959a3){var _0x4cb3f6={},_0x2388ed={},_0x45c27f={'count':0x0,'rows':[]};var _0x519f1d=_[_0x8d02('0x29')](db[_0x8d02('0x2a')][_0x8d02('0x2b')],function(_0x416059){return{'name':_0x416059[_0x8d02('0x2c')],'type':_0x416059[_0x8d02('0x2d')][_0x8d02('0x2e')]};});_0x2388ed[_0x8d02('0x2f')]=_[_0x8d02('0x29')](_0x519f1d,_0x8d02('0x28'));_0x2388ed['query']=_[_0x8d02('0x30')](_0x3e6724[_0x8d02('0x31')]);_0x2388ed['filters']=_[_0x8d02('0x32')](_0x2388ed[_0x8d02('0x2f')],_0x2388ed['query']);_0x4cb3f6[_0x8d02('0x33')]=_[_0x8d02('0x32')](_0x2388ed[_0x8d02('0x2f')],qs[_0x8d02('0x34')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x34')]));_0x4cb3f6[_0x8d02('0x33')]=_0x4cb3f6[_0x8d02('0x33')][_0x8d02('0x35')]?_0x4cb3f6['attributes']:_0x2388ed[_0x8d02('0x2f')];if(!_0x3e6724['query'][_0x8d02('0x36')](_0x8d02('0x37'))){_0x4cb3f6[_0x8d02('0x1d')]=qs[_0x8d02('0x1d')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x1d')]);_0x4cb3f6[_0x8d02('0x1a')]=qs['offset'](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x1a')]);}_0x4cb3f6[_0x8d02('0x38')]=qs[_0x8d02('0x39')](_0x3e6724[_0x8d02('0x31')][_0x8d02('0x39')]);_0x4cb3f6[_0x8d02('0x3a')]=qs[_0x8d02('0x3b')](_['pick'](_0x3e6724[_0x8d02('0x31')],_0x2388ed['filters']),_0x519f1d);if(_0x3e6724['query'][_0x8d02('0x3c')]){_0x4cb3f6['where']=_[_0x8d02('0x3d')](_0x4cb3f6[_0x8d02('0x3a')],{'$or':_[_0x8d02('0x29')](_0x519f1d,function(_0x43581d){if(_0x43581d[_0x8d02('0x2d')]!==_0x8d02('0x3e')){var _0x10a321={};_0x10a321[_0x43581d[_0x8d02('0x28')]]={'$like':'%'+_0x3e6724[_0x8d02('0x31')]['filter']+'%'};return _0x10a321;}})});}_0x4cb3f6=_[_0x8d02('0x3d')]({},_0x4cb3f6,_0x3e6724[_0x8d02('0x3f')]);var _0x434894={'where':_0x4cb3f6['where']};return db[_0x8d02('0x2a')]['count'](_0x434894)['then'](function(_0x56aa0d){_0x45c27f[_0x8d02('0x1c')]=_0x56aa0d;if(_0x3e6724[_0x8d02('0x31')][_0x8d02('0x40')]){_0x4cb3f6['include']=[{'all':!![]}];}return db[_0x8d02('0x2a')][_0x8d02('0x41')](_0x4cb3f6);})[_0x8d02('0x26')](function(_0xdad2f1){_0x45c27f['rows']=_0xdad2f1;return _0x45c27f;})['then'](respondWithFilteredResult(_0x2959a3,_0x4cb3f6))[_0x8d02('0x42')](handleError(_0x2959a3,null));};exports[_0x8d02('0x43')]=function(_0x5c326a,_0x302152){var _0x45cde8={'raw':!![],'where':{'id':_0x5c326a['params']['id']}},_0x2be391={};_0x2be391[_0x8d02('0x2f')]=_[_0x8d02('0x30')](db[_0x8d02('0x2a')][_0x8d02('0x2b')]);_0x2be391[_0x8d02('0x31')]=_[_0x8d02('0x30')](_0x5c326a['query']);_0x2be391[_0x8d02('0x3b')]=_[_0x8d02('0x32')](_0x2be391[_0x8d02('0x2f')],_0x2be391[_0x8d02('0x31')]);_0x45cde8[_0x8d02('0x33')]=_[_0x8d02('0x32')](_0x2be391['model'],qs[_0x8d02('0x34')](_0x5c326a['query'][_0x8d02('0x34')]));_0x45cde8[_0x8d02('0x33')]=_0x45cde8[_0x8d02('0x33')]['length']?_0x45cde8[_0x8d02('0x33')]:_0x2be391[_0x8d02('0x2f')];if(_0x5c326a['query'][_0x8d02('0x40')]){_0x45cde8[_0x8d02('0x44')]=[{'all':!![]}];}_0x45cde8=_['merge']({},_0x45cde8,_0x5c326a[_0x8d02('0x3f')]);return db[_0x8d02('0x2a')][_0x8d02('0x45')](_0x45cde8)[_0x8d02('0x26')](handleEntityNotFound(_0x302152,null))[_0x8d02('0x26')](respondWithResult(_0x302152,null))[_0x8d02('0x42')](handleError(_0x302152,null));};exports['create']=function(_0x59d122,_0x3a6e20){return db['VoiceDialReport'][_0x8d02('0x46')](_0x59d122['body'],{})[_0x8d02('0x26')](respondWithResult(_0x3a6e20,0xc9))[_0x8d02('0x42')](handleError(_0x3a6e20,null));};exports[_0x8d02('0x25')]=function(_0x1d36c4,_0x35aaad){if(_0x1d36c4['body']['id']){delete _0x1d36c4[_0x8d02('0x47')]['id'];}return db[_0x8d02('0x2a')][_0x8d02('0x45')]({'where':{'id':_0x1d36c4[_0x8d02('0x48')]['id']}})['then'](handleEntityNotFound(_0x35aaad,null))['then'](saveUpdates(_0x1d36c4[_0x8d02('0x47')],null))[_0x8d02('0x26')](respondWithResult(_0x35aaad,null))[_0x8d02('0x42')](handleError(_0x35aaad,null));};exports[_0x8d02('0x49')]=function(_0x2a863f,_0xb3d262){return db[_0x8d02('0x2a')][_0x8d02('0x45')]({'where':{'id':_0x2a863f['params']['id']}})[_0x8d02('0x26')](handleEntityNotFound(_0xb3d262,null))[_0x8d02('0x26')](removeEntity(_0xb3d262,null))[_0x8d02('0x42')](handleError(_0xb3d262,null));};exports[_0x8d02('0x4a')]=function(_0x3ead24,_0x5d4fe5){return db[_0x8d02('0x2a')]['describe']()[_0x8d02('0x26')](respondWithResult(_0x5d4fe5,null))[_0x8d02('0x42')](handleError(_0x5d4fe5,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7d93f76..dfce5b4 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 _0x4059=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','lodash','util'];(function(_0x23c9a6,_0x5b2afa){var _0x5cfbb3=function(_0x3274bd){while(--_0x3274bd){_0x23c9a6['push'](_0x23c9a6['shift']());}};_0x5cfbb3(++_0x5b2afa);}(_0x4059,0xb2));var _0x9405=function(_0x2f9145,_0x3b83b9){_0x2f9145=_0x2f9145-0x0;var _0x172114=_0x4059[_0x2f9145];return _0x172114;};'use strict';var _=require(_0x9405('0x0'));var util=require(_0x9405('0x1'));var logger=require(_0x9405('0x2'))(_0x9405('0x3'));var moment=require(_0x9405('0x4'));var BPromise=require('bluebird');var rp=require(_0x9405('0x5'));var fs=require('fs');var path=require(_0x9405('0x6'));var rimraf=require(_0x9405('0x7'));var config=require(_0x9405('0x8'));var attributes=require(_0x9405('0x9'));module['exports']=function(_0x904624,_0x3701f3){return _0x904624['define'](_0x9405('0xa'),attributes,{'tableName':_0x9405('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x19b3=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','util','../../config/logger','moment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x19b3,0x194));var _0x319b=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x19b3[_0x19aa84];return _0x536146;};'use strict';var _=require('lodash');var util=require(_0x319b('0x0'));var logger=require(_0x319b('0x1'))('api');var moment=require(_0x319b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x319b('0x3'));var rimraf=require(_0x319b('0x4'));var config=require(_0x319b('0x5'));var attributes=require(_0x319b('0x6'));module[_0x319b('0x7')]=function(_0x23d053,_0x1afe5d){return _0x23d053[_0x319b('0x8')](_0x319b('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x319b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1f3065e..ae49003 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 _0xeab5=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','raw','where','attributes','limit','lodash'];(function(_0x35cfa9,_0x323fe6){var _0x5e9d77=function(_0x307602){while(--_0x307602){_0x35cfa9['push'](_0x35cfa9['shift']());}};_0x5e9d77(++_0x323fe6);}(_0xeab5,0x1e9));var _0x5eab=function(_0x1403d6,_0x35aee9){_0x1403d6=_0x1403d6-0x0;var _0x212863=_0xeab5[_0x1403d6];return _0x212863;};'use strict';var _=require(_0x5eab('0x0'));var util=require(_0x5eab('0x1'));var moment=require(_0x5eab('0x2'));var BPromise=require(_0x5eab('0x3'));var rs=require(_0x5eab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5eab('0x5'))['db'];var utils=require(_0x5eab('0x6'));var logger=require(_0x5eab('0x7'))('rpc');var config=require(_0x5eab('0x8'));var jayson=require(_0x5eab('0x9'));var client=jayson[_0x5eab('0xa')][_0x5eab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dcfc3,_0x543c93,_0x5299ac){return new BPromise(function(_0x2a16a5,_0x56b91d){return client[_0x5eab('0xc')](_0x4dcfc3,_0x5299ac)[_0x5eab('0xd')](function(_0x5ac8ad){logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x543c93,_0x5eab('0x10'));logger[_0x5eab('0x11')](_0x5eab('0x12'),_0x543c93,'request\x20sent',JSON[_0x5eab('0x13')](_0x5ac8ad));if(_0x5ac8ad['error']){if(_0x5ac8ad[_0x5eab('0x14')][_0x5eab('0x15')]===0x1f4){logger['error'](_0x5eab('0xf'),_0x543c93,_0x5ac8ad[_0x5eab('0x14')][_0x5eab('0x16')]);return _0x56b91d(_0x5ac8ad[_0x5eab('0x14')][_0x5eab('0x16')]);}logger[_0x5eab('0x14')](_0x5eab('0xf'),_0x543c93,_0x5ac8ad[_0x5eab('0x14')]['message']);return _0x2a16a5(_0x5ac8ad[_0x5eab('0x14')]['message']);}else{logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x543c93,'request\x20sent');_0x2a16a5(_0x5ac8ad[_0x5eab('0x17')]['message']);}})[_0x5eab('0x18')](function(_0x595073){logger[_0x5eab('0x14')](_0x5eab('0xf'),_0x543c93,_0x595073);_0x56b91d(_0x595073);});});}exports[_0x5eab('0x19')]=function(_0x4536e6){var _0x1ab969=this;return new Promise(function(_0x375d53,_0x443b5d){return db[_0x5eab('0x1a')][_0x5eab('0x1b')](_0x4536e6[_0x5eab('0x1c')],{'raw':_0x4536e6[_0x5eab('0x1d')]?_0x4536e6[_0x5eab('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x5eab('0xd')](function(_0x1dbee6){logger[_0x5eab('0xe')](_0x5eab('0x19'),_0x4536e6);logger['debug'](_0x5eab('0x19'),_0x4536e6,JSON[_0x5eab('0x13')](_0x1dbee6));_0x375d53(_0x1dbee6);})[_0x5eab('0x18')](function(_0x48ecae){logger[_0x5eab('0x14')]('CreateVoiceDialReport',_0x48ecae[_0x5eab('0x16')],_0x4536e6);_0x443b5d(_0x1ab969[_0x5eab('0x14')](0x1f4,_0x48ecae[_0x5eab('0x16')]));});});};exports[_0x5eab('0x1e')]=function(_0x5dddcf){var _0x5f37a7=this;return new Promise(function(_0x344c3c,_0x4627f3){return db['VoiceDialReport']['update'](_0x5dddcf[_0x5eab('0x1c')],{'raw':_0x5dddcf['options']?_0x5dddcf[_0x5eab('0x1d')][_0x5eab('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dddcf[_0x5eab('0x1d')]?_0x5dddcf['options'][_0x5eab('0x20')]||null:null,'attributes':_0x5dddcf['options']?_0x5dddcf['options'][_0x5eab('0x21')]||null:null,'limit':_0x5dddcf[_0x5eab('0x1d')]?_0x5dddcf['options'][_0x5eab('0x22')]||null:null})[_0x5eab('0xd')](function(_0xe966d8){logger[_0x5eab('0xe')](_0x5eab('0x1e'),_0x5dddcf);logger[_0x5eab('0x11')](_0x5eab('0x1e'),_0x5dddcf,JSON[_0x5eab('0x13')](_0xe966d8));_0x344c3c(_0xe966d8);})['catch'](function(_0x1dd28b){logger[_0x5eab('0x14')](_0x5eab('0x1e'),_0x1dd28b[_0x5eab('0x16')],_0x5dddcf);_0x4627f3(_0x5f37a7[_0x5eab('0x14')](0x1f4,_0x1dd28b[_0x5eab('0x16')]));});});}; \ No newline at end of file +var _0xe448=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','stringify','catch','raw','where','attributes','limit','UpdateVoiceDialReport'];(function(_0x24da10,_0x2dbd25){var _0x11ae58=function(_0x5d9782){while(--_0x5d9782){_0x24da10['push'](_0x24da10['shift']());}};_0x11ae58(++_0x2dbd25);}(_0xe448,0x1dc));var _0x8e44=function(_0x49fef1,_0x2cee9f){_0x49fef1=_0x49fef1-0x0;var _0x407e54=_0xe448[_0x49fef1];return _0x407e54;};'use strict';var _=require(_0x8e44('0x0'));var util=require(_0x8e44('0x1'));var moment=require(_0x8e44('0x2'));var BPromise=require(_0x8e44('0x3'));var rs=require(_0x8e44('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e44('0x5'));var logger=require(_0x8e44('0x6'))(_0x8e44('0x7'));var config=require(_0x8e44('0x8'));var jayson=require(_0x8e44('0x9'));var client=jayson[_0x8e44('0xa')][_0x8e44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a054,_0x20853d,_0x26f3e2){return new BPromise(function(_0x331f1b,_0x47eb2e){return client[_0x8e44('0xc')](_0x13a054,_0x26f3e2)[_0x8e44('0xd')](function(_0x2bab9d){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x20853d,'request\x20sent');logger[_0x8e44('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x20853d,_0x8e44('0xf'),JSON['stringify'](_0x2bab9d));if(_0x2bab9d[_0x8e44('0x10')]){if(_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x11')]===0x1f4){logger['error'](_0x8e44('0x12'),_0x20853d,_0x2bab9d[_0x8e44('0x10')]['message']);return _0x47eb2e(_0x2bab9d[_0x8e44('0x10')]['message']);}logger['error'](_0x8e44('0x12'),_0x20853d,_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x13')]);return _0x331f1b(_0x2bab9d[_0x8e44('0x10')][_0x8e44('0x13')]);}else{logger[_0x8e44('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x20853d,_0x8e44('0xf'));_0x331f1b(_0x2bab9d[_0x8e44('0x15')][_0x8e44('0x13')]);}})['catch'](function(_0x437ae4){logger[_0x8e44('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x20853d,_0x437ae4);_0x47eb2e(_0x437ae4);});});}exports[_0x8e44('0x16')]=function(_0x26ec76){var _0x414c56=this;return new Promise(function(_0x4ca3ca,_0x34a13e){return db[_0x8e44('0x17')][_0x8e44('0x18')](_0x26ec76[_0x8e44('0x19')],{'raw':_0x26ec76['options']?_0x26ec76[_0x8e44('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8e44('0xd')](function(_0x42891e){logger['info']('CreateVoiceDialReport',_0x26ec76);logger[_0x8e44('0xe')](_0x8e44('0x16'),_0x26ec76,JSON[_0x8e44('0x1b')](_0x42891e));_0x4ca3ca(_0x42891e);})[_0x8e44('0x1c')](function(_0x45037a){logger['error'](_0x8e44('0x16'),_0x45037a[_0x8e44('0x13')],_0x26ec76);_0x34a13e(_0x414c56[_0x8e44('0x10')](0x1f4,_0x45037a[_0x8e44('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0xfdc09f){var _0x1d6598=this;return new Promise(function(_0x12e189,_0x55e3dc){return db[_0x8e44('0x17')]['update'](_0xfdc09f[_0x8e44('0x19')],{'raw':_0xfdc09f[_0x8e44('0x1a')]?_0xfdc09f['options'][_0x8e44('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x1e')]||null:null,'attributes':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x1f')]||null:null,'limit':_0xfdc09f['options']?_0xfdc09f[_0x8e44('0x1a')][_0x8e44('0x20')]||null:null})[_0x8e44('0xd')](function(_0x45663a){logger[_0x8e44('0x14')](_0x8e44('0x21'),_0xfdc09f);logger[_0x8e44('0xe')](_0x8e44('0x21'),_0xfdc09f,JSON['stringify'](_0x45663a));_0x12e189(_0x45663a);})[_0x8e44('0x1c')](function(_0x3d17ae){logger[_0x8e44('0x10')]('UpdateVoiceDialReport',_0x3d17ae['message'],_0xfdc09f);_0x55e3dc(_0x1d6598[_0x8e44('0x10')](0x1f4,_0x3d17ae[_0x8e44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ff0cf8e..2b16397 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 _0xdcbc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x283cf6,_0x14e096){var _0x4b40e5=function(_0xd340e5){while(--_0xd340e5){_0x283cf6['push'](_0x283cf6['shift']());}};_0x4b40e5(++_0x14e096);}(_0xdcbc,0x8e));var _0xcdcb=function(_0xe4e8ce,_0x5e8c32){_0xe4e8ce=_0xe4e8ce-0x0;var _0x3cf248=_0xdcbc[_0xe4e8ce];return _0x3cf248;};'use strict';var multer=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var path=require(_0xcdcb('0x2'));var timeout=require(_0xcdcb('0x3'));var express=require(_0xcdcb('0x4'));var router=express[_0xcdcb('0x5')]();var fs_extra=require(_0xcdcb('0x6'));var auth=require(_0xcdcb('0x7'));var interaction=require(_0xcdcb('0x8'));var config=require('../../config/environment');var controller=require(_0xcdcb('0x9'));router[_0xcdcb('0xa')]('/',auth[_0xcdcb('0xb')](),controller[_0xcdcb('0xc')]);router[_0xcdcb('0xa')]('/:id',auth[_0xcdcb('0xb')](),controller[_0xcdcb('0xd')]);router[_0xcdcb('0xe')]('/',auth['isAuthenticated'](),controller[_0xcdcb('0xf')]);router[_0xcdcb('0xe')](_0xcdcb('0x10'),auth[_0xcdcb('0xb')](),controller[_0xcdcb('0x11')]);router[_0xcdcb('0x12')](_0xcdcb('0x13'),auth[_0xcdcb('0xb')](),controller[_0xcdcb('0x14')]);router[_0xcdcb('0x15')](_0xcdcb('0x13'),auth[_0xcdcb('0xb')](),controller[_0xcdcb('0x16')]);module[_0xcdcb('0x17')]=router; \ No newline at end of file +var _0x50ce=['destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','/:id/applications','put','update'];(function(_0x55bf96,_0x7267a7){var _0x5092ef=function(_0x3ed3f1){while(--_0x3ed3f1){_0x55bf96['push'](_0x55bf96['shift']());}};_0x5092ef(++_0x7267a7);}(_0x50ce,0x9b));var _0xe50c=function(_0x5e6515,_0x2954b1){_0x5e6515=_0x5e6515-0x0;var _0xd33ce2=_0x50ce[_0x5e6515];return _0xd33ce2;};'use strict';var multer=require(_0xe50c('0x0'));var util=require('util');var path=require(_0xe50c('0x1'));var timeout=require(_0xe50c('0x2'));var express=require('express');var router=express[_0xe50c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe50c('0x4'));var config=require(_0xe50c('0x5'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe50c('0x6')]);router[_0xe50c('0x7')](_0xe50c('0x8'),auth[_0xe50c('0x9')](),controller[_0xe50c('0xa')]);router[_0xe50c('0xb')]('/',auth[_0xe50c('0x9')](),controller['create']);router[_0xe50c('0xb')](_0xe50c('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0xe50c('0xd')](_0xe50c('0x8'),auth['isAuthenticated'](),controller[_0xe50c('0xe')]);router['delete'](_0xe50c('0x8'),auth['isAuthenticated'](),controller[_0xe50c('0xf')]);module[_0xe50c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 886986a..e9e6e24 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 _0x3ef7=['STRING','compositeIndex','ENUM','inbound','outbound','internal','outbound-fax','system','any','BOOLEAN','wav','getDataValue','exten','sequelize','exports'];(function(_0x399975,_0x2c961c){var _0x4cebef=function(_0x5e8f7b){while(--_0x5e8f7b){_0x399975['push'](_0x399975['shift']());}};_0x4cebef(++_0x2c961c);}(_0x3ef7,0x67));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x73ef('0x0'));module[_0x73ef('0x1')]={'context':{'type':Sequelize[_0x73ef('0x2')],'allowNull':![],'unique':_0x73ef('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x73ef('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x73ef('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x73ef('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x73ef('0x4')](_0x73ef('0x5'),_0x73ef('0x6'),_0x73ef('0x7'),'inbound-fax',_0x73ef('0x8'),_0x73ef('0x9'),_0x73ef('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x73ef('0x2')]},'interval':{'type':Sequelize[_0x73ef('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x73ef('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x73ef('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x73ef('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x73ef('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x73ef('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a9420){return this[_0x73ef('0xd')](_0x73ef('0xe'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xe38e=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','internal','outbound-fax','system','any'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe38e,0x15d));var _0xee38=function(_0xf9836c,_0x2aeb62){_0xf9836c=_0xf9836c-0x0;var _0x3b679b=_0xe38e[_0xf9836c];return _0x3b679b;};'use strict';var Sequelize=require(_0xee38('0x0'));module[_0xee38('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xee38('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'unique':_0xee38('0x2')},'priority':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xee38('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xee38('0x4')](_0xee38('0x5'),_0xee38('0x6'),_0xee38('0x7'),'inbound-fax',_0xee38('0x8'),_0xee38('0x9'),_0xee38('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xee38('0x3')]},'interval':{'type':Sequelize[_0xee38('0x3')],'allowNull':![],'defaultValue':_0xee38('0xb')},'IntervalId':{'type':Sequelize[_0xee38('0xc')]},'isApp':{'type':Sequelize[_0xee38('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xee38('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xee38('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xee38('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xee38('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xee38('0xe')],'get':function(_0x4ca5e3){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xee38('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 47ab532..595dfd5 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 _0xe181=['destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','error','stack','send','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','options','VoiceExtension','include','findAll','rows','catch','params','fields','includeAll','merge','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InternalRoutes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','json','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','offset','limit','undefined','count','Content-Range'];(function(_0x49d2d1,_0x4f530c){var _0x3e09d8=function(_0x508f3e){while(--_0x508f3e){_0x49d2d1['push'](_0x49d2d1['shift']());}};_0x3e09d8(++_0x4f530c);}(_0xe181,0x1c2));var _0x1e18=function(_0x4b55e8,_0x41ba7e){_0x4b55e8=_0x4b55e8-0x0;var _0x46e844=_0xe181[_0x4b55e8];return _0x46e844;};'use strict';var _=require(_0x1e18('0x0'));var Redis=require('ioredis');var qs=require(_0x1e18('0x1'));var logger=require(_0x1e18('0x2'))(_0x1e18('0x3'));var config=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];config['redis']=_[_0x1e18('0x6')](config[_0x1e18('0x7')],{'host':_0x1e18('0x8'),'port':0x18eb});var socket=require(_0x1e18('0x9'))(new Redis(config[_0x1e18('0x7')]));require(_0x1e18('0xa'))[_0x1e18('0xb')](socket);function respondWithStatusCode(_0x5c8574,_0x460d74){_0x460d74=_0x460d74||0xcc;return function(_0x366c96){if(_0x366c96){return _0x5c8574[_0x1e18('0xc')](_0x460d74);}return _0x5c8574['status'](_0x460d74)[_0x1e18('0xd')]();};}function respondWithResult(_0x10db52,_0xaea71d){_0xaea71d=_0xaea71d||0xc8;return function(_0x4c09ed){if(_0x4c09ed){return _0x10db52[_0x1e18('0xe')](_0xaea71d)['json'](_0x4c09ed);}};}function respondWithFilteredResult(_0x58ac98,_0x16e26b){return function(_0x4e34c4){if(_0x4e34c4){var _0x2771ab=typeof _0x16e26b[_0x1e18('0xf')]==='undefined'&&typeof _0x16e26b[_0x1e18('0x10')]===_0x1e18('0x11');var _0x45b6cd=_0x4e34c4[_0x1e18('0x12')];var _0x11b77b=_0x2771ab?0x0:_0x16e26b[_0x1e18('0xf')];var _0x895a1f=_0x2771ab?_0x4e34c4[_0x1e18('0x12')]:_0x16e26b['offset']+_0x16e26b[_0x1e18('0x10')];var _0x57dcf3;if(_0x895a1f>=_0x45b6cd){_0x895a1f=_0x45b6cd;_0x57dcf3=0xc8;}else{_0x57dcf3=0xce;}_0x58ac98[_0x1e18('0xe')](_0x57dcf3);return _0x58ac98['set'](_0x1e18('0x13'),_0x11b77b+'-'+_0x895a1f+'/'+_0x45b6cd)['json'](_0x4e34c4);}return null;};}function removeEntity(_0x47b01c){return function(_0x915fbc){if(_0x915fbc){return _0x915fbc[_0x1e18('0x14')]()[_0x1e18('0x15')](function(){var _0xb94ad8=_0x915fbc[_0x1e18('0x16')]({'plain':!![]});var _0x2a63d8=[{'name':_0x1e18('0x17'),'value':_0x1e18('0x18'),'ignore':![]},{'name':_0x1e18('0x19'),'value':_0x1e18('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0x1e18('0x1b'),'ignore':![]}];var _0x5a4c7a=_(_0x2a63d8)[_0x1e18('0x1c')](_0x1e18('0x1d'))[_0x1e18('0x1e')](_0x1e18('0x1f'))[_0x1e18('0x1f')]();if(_[_0x1e18('0x20')](_0x5a4c7a,_0xb94ad8[_0x1e18('0x21')])){return;}var _0x2c2592=_[_0x1e18('0x22')](_0x2a63d8,[_0x1e18('0x1f'),_0xb94ad8[_0x1e18('0x21')]])[_0x1e18('0x23')];return db['UserProfileResource'][_0x1e18('0x14')]({'where':{'type':_0x2c2592,'resourceId':_0xb94ad8['id']}})['then'](function(){return _0x915fbc;});})[_0x1e18('0x15')](function(){_0x47b01c[_0x1e18('0xe')](0xcc)[_0x1e18('0xd')]();});}};}function handleEntityNotFound(_0x363d18){return function(_0x5897b8){if(!_0x5897b8){_0x363d18[_0x1e18('0xc')](0x194);}return _0x5897b8;};}function handleError(_0x2ee8db,_0x29b75f){_0x29b75f=_0x29b75f||0x1f4;return function(_0xed1be1){logger[_0x1e18('0x24')](_0xed1be1[_0x1e18('0x25')]);if(_0xed1be1[_0x1e18('0x23')]){delete _0xed1be1[_0x1e18('0x23')];}_0x2ee8db[_0x1e18('0xe')](_0x29b75f)[_0x1e18('0x26')](_0xed1be1);};}exports[_0x1e18('0x27')]=function(_0x5d78cc,_0x35f2ba){var _0x4c4151={},_0x28a2db={},_0x3643f0={'count':0x0,'rows':[]};var _0x5b266e=_[_0x1e18('0x1e')](db['VoiceExtension'][_0x1e18('0x28')],function(_0x33fe3c){return{'name':_0x33fe3c[_0x1e18('0x29')],'type':_0x33fe3c[_0x1e18('0x21')][_0x1e18('0x2a')]};});_0x28a2db[_0x1e18('0x2b')]=_[_0x1e18('0x1e')](_0x5b266e,_0x1e18('0x23'));_0x28a2db['query']=_[_0x1e18('0x2c')](_0x5d78cc[_0x1e18('0x2d')]);_0x28a2db[_0x1e18('0x2e')]=_[_0x1e18('0x2f')](_0x28a2db['model'],_0x28a2db['query']);_0x4c4151[_0x1e18('0x30')]=_[_0x1e18('0x2f')](_0x28a2db[_0x1e18('0x2b')],qs['fields'](_0x5d78cc[_0x1e18('0x2d')]['fields']));_0x4c4151['attributes']=_0x4c4151[_0x1e18('0x30')][_0x1e18('0x31')]?_0x4c4151['attributes']:_0x28a2db[_0x1e18('0x2b')];if(!_0x5d78cc['query'][_0x1e18('0x32')](_0x1e18('0x33'))){_0x4c4151[_0x1e18('0x10')]=qs[_0x1e18('0x10')](_0x5d78cc[_0x1e18('0x2d')][_0x1e18('0x10')]);_0x4c4151[_0x1e18('0xf')]=qs['offset'](_0x5d78cc[_0x1e18('0x2d')]['offset']);}_0x4c4151['order']=qs['sort'](_0x5d78cc[_0x1e18('0x2d')][_0x1e18('0x34')]);_0x4c4151[_0x1e18('0x35')]=qs[_0x1e18('0x2e')](_[_0x1e18('0x36')](_0x5d78cc[_0x1e18('0x2d')],_0x28a2db['filters']),_0x5b266e);if(_0x5d78cc[_0x1e18('0x2d')][_0x1e18('0x1c')]){_0x4c4151['where']=_['merge'](_0x4c4151[_0x1e18('0x35')],{'$or':_['map'](_0x5b266e,function(_0x48eef7){if(_0x48eef7[_0x1e18('0x21')]!=='VIRTUAL'){var _0x48ac3d={};_0x48ac3d[_0x48eef7[_0x1e18('0x23')]]={'$like':'%'+_0x5d78cc['query'][_0x1e18('0x1c')]+'%'};return _0x48ac3d;}})});}_0x4c4151=_['merge']({},_0x4c4151,_0x5d78cc[_0x1e18('0x37')]);var _0x32e4dc={'where':_0x4c4151['where']};return db[_0x1e18('0x38')]['count'](_0x32e4dc)[_0x1e18('0x15')](function(_0x2c75e4){_0x3643f0[_0x1e18('0x12')]=_0x2c75e4;if(_0x5d78cc[_0x1e18('0x2d')]['includeAll']){_0x4c4151[_0x1e18('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x1e18('0x3a')](_0x4c4151);})['then'](function(_0x325831){_0x3643f0[_0x1e18('0x3b')]=_0x325831;return _0x3643f0;})[_0x1e18('0x15')](respondWithFilteredResult(_0x35f2ba,_0x4c4151))[_0x1e18('0x3c')](handleError(_0x35f2ba,null));};exports['show']=function(_0x1b0e21,_0x373f7b){var _0x78faa4={'raw':![],'where':{'id':_0x1b0e21[_0x1e18('0x3d')]['id']}},_0x50caf3={};_0x50caf3[_0x1e18('0x2b')]=_['keys'](db[_0x1e18('0x38')][_0x1e18('0x28')]);_0x50caf3['query']=_['keys'](_0x1b0e21['query']);_0x50caf3['filters']=_[_0x1e18('0x2f')](_0x50caf3['model'],_0x50caf3[_0x1e18('0x2d')]);_0x78faa4[_0x1e18('0x30')]=_[_0x1e18('0x2f')](_0x50caf3['model'],qs[_0x1e18('0x3e')](_0x1b0e21[_0x1e18('0x2d')][_0x1e18('0x3e')]));_0x78faa4[_0x1e18('0x30')]=_0x78faa4['attributes'][_0x1e18('0x31')]?_0x78faa4['attributes']:_0x50caf3['model'];if(_0x1b0e21[_0x1e18('0x2d')][_0x1e18('0x3f')]){_0x78faa4[_0x1e18('0x39')]=[{'all':!![]}];}_0x78faa4=_[_0x1e18('0x40')]({},_0x78faa4,_0x1b0e21[_0x1e18('0x37')]);return db['VoiceExtension'][_0x1e18('0x22')](_0x78faa4)[_0x1e18('0x15')](handleEntityNotFound(_0x373f7b,null))[_0x1e18('0x15')](respondWithResult(_0x373f7b,null))['catch'](handleError(_0x373f7b,null));};exports[_0x1e18('0x14')]=function(_0x3f7221,_0x49835a){return db[_0x1e18('0x38')][_0x1e18('0x22')]({'where':{'id':_0x3f7221[_0x1e18('0x3d')]['id']}})[_0x1e18('0x15')](handleEntityNotFound(_0x49835a,null))[_0x1e18('0x15')](removeEntity(_0x49835a,null))['catch'](handleError(_0x49835a,null));};exports[_0x1e18('0x41')]=function(_0x11e5d9,_0x1df3a1){if(_0x11e5d9['body'][_0x1e18('0x21')]===_0x1e18('0x1a')&&!_[_0x1e18('0x42')](_0x11e5d9[_0x1e18('0x43')][_0x1e18('0x44')],'_')){_0x11e5d9[_0x1e18('0x43')][_0x1e18('0x44')]='_'[_0x1e18('0x45')](_0x11e5d9[_0x1e18('0x43')][_0x1e18('0x44')]);}return db[_0x1e18('0x38')][_0x1e18('0x41')](_0x11e5d9[_0x1e18('0x43')],{'raw':![]})[_0x1e18('0x15')](function(_0xa7f184){var _0x91707=_0x11e5d9[_0x1e18('0x46')][_0x1e18('0x16')]({'plain':!![]});if(!_0x91707)throw new Error(_0x1e18('0x47'));if(_0x91707['role']===_0x1e18('0x46')){var _0x36011f=_0xa7f184[_0x1e18('0x16')]({'plain':!![]});var _0x5e3224=[{'name':_0x1e18('0x17'),'value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1e18('0x48'),'value':_0x1e18('0x1b')}];var _0x5b4a8d=_[_0x1e18('0x22')](_0x5e3224,[_0x1e18('0x1f'),_0x36011f[_0x1e18('0x21')]])[_0x1e18('0x23')];return db['UserProfileSection'][_0x1e18('0x22')]({'where':{'name':_0x5b4a8d,'userProfileId':_0x91707[_0x1e18('0x49')]},'raw':!![]})[_0x1e18('0x15')](function(_0x3e97dd){if(_0x3e97dd&&_0x3e97dd[_0x1e18('0x4a')]===0x0){return db[_0x1e18('0x4b')][_0x1e18('0x41')]({'name':_0x36011f[_0x1e18('0x23')],'resourceId':_0x36011f['id'],'type':_0x3e97dd['name'],'sectionId':_0x3e97dd['id']},{})['then'](function(){return _0xa7f184;});}else{return _0xa7f184;}})[_0x1e18('0x3c')](function(_0x216d20){logger['error'](_0x1e18('0x4c'),_0x216d20);throw _0x216d20;});}return _0xa7f184;})['then'](respondWithResult(_0x1df3a1,0xc9))['catch'](handleError(_0x1df3a1,null));};exports[_0x1e18('0x4d')]=function(_0x3b97ef,_0x35f861){if(_0x3b97ef[_0x1e18('0x43')]['id']){delete _0x3b97ef[_0x1e18('0x43')]['id'];}return db[_0x1e18('0x38')][_0x1e18('0x22')]({'where':{'id':_0x3b97ef[_0x1e18('0x3d')]['id']}})['then'](handleEntityNotFound(_0x35f861,null))[_0x1e18('0x15')](function(_0x33e61a){if(_0x33e61a){return db['VoiceExtension'][_0x1e18('0x4d')](_[_0x1e18('0x36')](_0x3b97ef['body'],[_0x1e18('0x44'),'context',_0x1e18('0x4e'),_0x1e18('0x4f'),_0x1e18('0x50'),'mandatoryDisposition',_0x1e18('0x51')]),{'where':{'context':_0x33e61a['context'],'exten':_0x33e61a[_0x1e18('0x44')]},'individualHooks':!![]})[_0x1e18('0x15')](function(_0x5a4982){return _0x5a4982;});}return null;})[_0x1e18('0x15')](respondWithStatusCode(_0x35f861,null))[_0x1e18('0x3c')](handleError(_0x35f861,null));};exports[_0x1e18('0x52')]=function(_0x48b004,_0x32a847){var _0x3a0e74=_0x48b004[_0x1e18('0x3d')]['id'];var _0x4ac914=_0x48b004[_0x1e18('0x43')];var _0x224265=0xc8;var _0x899e63=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x1e18('0x53')]['Transaction'][_0x1e18('0x54')][_0x1e18('0x55')]},function(_0x3a9fb5){return db[_0x1e18('0x38')][_0x1e18('0x56')]({'where':{'id':_0x3a0e74},'transaction':_0x3a9fb5})[_0x1e18('0x15')](function(_0x35ea7e){if(_0x35ea7e){return db[_0x1e18('0x38')]['destroy']({'where':{'VoiceExtensionId':_0x3a0e74},'transaction':_0x3a9fb5})[_0x1e18('0x15')](function(){var _0x51834c=_[_0x1e18('0x1e')](_0x4ac914,function(_0x479cb1){_0x479cb1[_0x1e18('0x57')]=_0x3a0e74;_0x479cb1[_0x1e18('0x58')]=!![];return _0x479cb1;});return _0x35ea7e[_0x1e18('0x59')](_0x51834c);})[_0x1e18('0x15')](function(_0x2323e9){return db['VoiceExtension'][_0x1e18('0x5a')](_0x2323e9,{'transaction':_0x3a9fb5});});}else{_0x224265=0x194;_0x899e63=[];}});})[_0x1e18('0x15')](function(){if(_0x224265!==0x194){return db[_0x1e18('0x38')][_0x1e18('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3a0e74},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x3bc144){_0x899e63=_0x3bc144;});}})['catch'](function(_0x17a00c){_0x224265=0x1f4;logger[_0x1e18('0x24')](_0x17a00c['stack']);if(_0x17a00c[_0x1e18('0x23')]){delete _0x17a00c[_0x1e18('0x23')];}_0x899e63=_0x17a00c;})[_0x1e18('0x5c')](function(){if(_0x899e63===null){_0x32a847[_0x1e18('0xc')](_0x224265);}else{if(_0x224265===0x1f4){_0x32a847[_0x1e18('0xe')](_0x224265)['send'](_0x899e63);}else{_0x32a847[_0x1e18('0xe')](_0x224265)[_0x1e18('0x5d')](_0x899e63);}}});}; \ No newline at end of file +var _0xc232=['startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','json','undefined','count','offset','limit','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','sendStatus','send','VoiceExtension','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','fields','includeAll','create','body'];(function(_0x58fad2,_0xb39887){var _0x49f947=function(_0x1b22c2){while(--_0x1b22c2){_0x58fad2['push'](_0x58fad2['shift']());}};_0x49f947(++_0xb39887);}(_0xc232,0x76));var _0x2c23=function(_0x35d445,_0x288824){_0x35d445=_0x35d445-0x0;var _0x15c27e=_0xc232[_0x35d445];return _0x15c27e;};'use strict';var _=require(_0x2c23('0x0'));var Redis=require(_0x2c23('0x1'));var qs=require(_0x2c23('0x2'));var logger=require(_0x2c23('0x3'))(_0x2c23('0x4'));var config=require('../../config/environment');var db=require(_0x2c23('0x5'))['db'];config[_0x2c23('0x6')]=_[_0x2c23('0x7')](config[_0x2c23('0x6')],{'host':_0x2c23('0x8'),'port':0x18eb});var socket=require(_0x2c23('0x9'))(new Redis(config[_0x2c23('0x6')]));require(_0x2c23('0xa'))['register'](socket);function respondWithStatusCode(_0x22f10e,_0x4f7155){_0x4f7155=_0x4f7155||0xcc;return function(_0x260334){if(_0x260334){return _0x22f10e['sendStatus'](_0x4f7155);}return _0x22f10e[_0x2c23('0xb')](_0x4f7155)[_0x2c23('0xc')]();};}function respondWithResult(_0x16183d,_0x23d507){_0x23d507=_0x23d507||0xc8;return function(_0x5052f9){if(_0x5052f9){return _0x16183d[_0x2c23('0xb')](_0x23d507)[_0x2c23('0xd')](_0x5052f9);}};}function respondWithFilteredResult(_0x3b9a3c,_0xbb357){return function(_0x4d01d7){if(_0x4d01d7){var _0x5b5b85=typeof _0xbb357['offset']===_0x2c23('0xe')&&typeof _0xbb357['limit']==='undefined';var _0x277c9d=_0x4d01d7[_0x2c23('0xf')];var _0x583a84=_0x5b5b85?0x0:_0xbb357[_0x2c23('0x10')];var _0x19f9e0=_0x5b5b85?_0x4d01d7[_0x2c23('0xf')]:_0xbb357[_0x2c23('0x10')]+_0xbb357[_0x2c23('0x11')];var _0x2fbfb4;if(_0x19f9e0>=_0x277c9d){_0x19f9e0=_0x277c9d;_0x2fbfb4=0xc8;}else{_0x2fbfb4=0xce;}_0x3b9a3c['status'](_0x2fbfb4);return _0x3b9a3c['set'](_0x2c23('0x12'),_0x583a84+'-'+_0x19f9e0+'/'+_0x277c9d)[_0x2c23('0xd')](_0x4d01d7);}return null;};}function removeEntity(_0x4c78f2){return function(_0x20acc9){if(_0x20acc9){return _0x20acc9[_0x2c23('0x13')]()[_0x2c23('0x14')](function(){var _0x43036a=_0x20acc9[_0x2c23('0x15')]({'plain':!![]});var _0x34761e=[{'name':'InboundRoutes','value':_0x2c23('0x16'),'ignore':![]},{'name':_0x2c23('0x17'),'value':_0x2c23('0x18'),'ignore':![]},{'name':_0x2c23('0x19'),'value':_0x2c23('0x1a'),'ignore':![]}];var _0x124664=_(_0x34761e)[_0x2c23('0x1b')](_0x2c23('0x1c'))[_0x2c23('0x1d')](_0x2c23('0x1e'))[_0x2c23('0x1e')]();if(_['includes'](_0x124664,_0x43036a[_0x2c23('0x1f')])){return;}var _0x12e96b=_[_0x2c23('0x20')](_0x34761e,[_0x2c23('0x1e'),_0x43036a[_0x2c23('0x1f')]])[_0x2c23('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x12e96b,'resourceId':_0x43036a['id']}})[_0x2c23('0x14')](function(){return _0x20acc9;});})[_0x2c23('0x14')](function(){_0x4c78f2[_0x2c23('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228680){return function(_0x582625){if(!_0x582625){_0x228680[_0x2c23('0x22')](0x194);}return _0x582625;};}function handleError(_0x111498,_0x676b3a){_0x676b3a=_0x676b3a||0x1f4;return function(_0x3fb2c4){logger['error'](_0x3fb2c4['stack']);if(_0x3fb2c4[_0x2c23('0x21')]){delete _0x3fb2c4[_0x2c23('0x21')];}_0x111498[_0x2c23('0xb')](_0x676b3a)[_0x2c23('0x23')](_0x3fb2c4);};}exports['index']=function(_0x1090df,_0x53e4d3){var _0x4385d1={},_0x533a4b={},_0x5e320e={'count':0x0,'rows':[]};var _0x446f0a=_[_0x2c23('0x1d')](db[_0x2c23('0x24')]['rawAttributes'],function(_0x50b666){return{'name':_0x50b666[_0x2c23('0x25')],'type':_0x50b666[_0x2c23('0x1f')][_0x2c23('0x26')]};});_0x533a4b['model']=_[_0x2c23('0x1d')](_0x446f0a,_0x2c23('0x21'));_0x533a4b[_0x2c23('0x27')]=_[_0x2c23('0x28')](_0x1090df[_0x2c23('0x27')]);_0x533a4b[_0x2c23('0x29')]=_[_0x2c23('0x2a')](_0x533a4b[_0x2c23('0x2b')],_0x533a4b[_0x2c23('0x27')]);_0x4385d1[_0x2c23('0x2c')]=_[_0x2c23('0x2a')](_0x533a4b[_0x2c23('0x2b')],qs['fields'](_0x1090df[_0x2c23('0x27')]['fields']));_0x4385d1[_0x2c23('0x2c')]=_0x4385d1[_0x2c23('0x2c')][_0x2c23('0x2d')]?_0x4385d1[_0x2c23('0x2c')]:_0x533a4b['model'];if(!_0x1090df['query']['hasOwnProperty'](_0x2c23('0x2e'))){_0x4385d1[_0x2c23('0x11')]=qs[_0x2c23('0x11')](_0x1090df['query'][_0x2c23('0x11')]);_0x4385d1[_0x2c23('0x10')]=qs[_0x2c23('0x10')](_0x1090df[_0x2c23('0x27')][_0x2c23('0x10')]);}_0x4385d1[_0x2c23('0x2f')]=qs[_0x2c23('0x30')](_0x1090df['query'][_0x2c23('0x30')]);_0x4385d1[_0x2c23('0x31')]=qs[_0x2c23('0x29')](_['pick'](_0x1090df[_0x2c23('0x27')],_0x533a4b['filters']),_0x446f0a);if(_0x1090df['query'][_0x2c23('0x1b')]){_0x4385d1[_0x2c23('0x31')]=_[_0x2c23('0x32')](_0x4385d1[_0x2c23('0x31')],{'$or':_[_0x2c23('0x1d')](_0x446f0a,function(_0x37deb0){if(_0x37deb0['type']!==_0x2c23('0x33')){var _0x1d390f={};_0x1d390f[_0x37deb0[_0x2c23('0x21')]]={'$like':'%'+_0x1090df['query'][_0x2c23('0x1b')]+'%'};return _0x1d390f;}})});}_0x4385d1=_['merge']({},_0x4385d1,_0x1090df[_0x2c23('0x34')]);var _0x42ec30={'where':_0x4385d1[_0x2c23('0x31')]};return db[_0x2c23('0x24')][_0x2c23('0xf')](_0x42ec30)[_0x2c23('0x14')](function(_0x245d48){_0x5e320e[_0x2c23('0xf')]=_0x245d48;if(_0x1090df[_0x2c23('0x27')]['includeAll']){_0x4385d1[_0x2c23('0x35')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x4385d1);})[_0x2c23('0x14')](function(_0x1cc55d){_0x5e320e[_0x2c23('0x36')]=_0x1cc55d;return _0x5e320e;})[_0x2c23('0x14')](respondWithFilteredResult(_0x53e4d3,_0x4385d1))[_0x2c23('0x37')](handleError(_0x53e4d3,null));};exports[_0x2c23('0x38')]=function(_0x5332a2,_0x3d54a4){var _0x5195b9={'raw':![],'where':{'id':_0x5332a2[_0x2c23('0x39')]['id']}},_0x277ef7={};_0x277ef7[_0x2c23('0x2b')]=_[_0x2c23('0x28')](db['VoiceExtension']['rawAttributes']);_0x277ef7['query']=_['keys'](_0x5332a2[_0x2c23('0x27')]);_0x277ef7['filters']=_['intersection'](_0x277ef7[_0x2c23('0x2b')],_0x277ef7[_0x2c23('0x27')]);_0x5195b9[_0x2c23('0x2c')]=_[_0x2c23('0x2a')](_0x277ef7[_0x2c23('0x2b')],qs[_0x2c23('0x3a')](_0x5332a2[_0x2c23('0x27')][_0x2c23('0x3a')]));_0x5195b9['attributes']=_0x5195b9[_0x2c23('0x2c')]['length']?_0x5195b9['attributes']:_0x277ef7[_0x2c23('0x2b')];if(_0x5332a2[_0x2c23('0x27')][_0x2c23('0x3b')]){_0x5195b9['include']=[{'all':!![]}];}_0x5195b9=_[_0x2c23('0x32')]({},_0x5195b9,_0x5332a2[_0x2c23('0x34')]);return db[_0x2c23('0x24')][_0x2c23('0x20')](_0x5195b9)[_0x2c23('0x14')](handleEntityNotFound(_0x3d54a4,null))['then'](respondWithResult(_0x3d54a4,null))['catch'](handleError(_0x3d54a4,null));};exports['destroy']=function(_0xfcc455,_0x51ddd6){return db['VoiceExtension'][_0x2c23('0x20')]({'where':{'id':_0xfcc455[_0x2c23('0x39')]['id']}})[_0x2c23('0x14')](handleEntityNotFound(_0x51ddd6,null))[_0x2c23('0x14')](removeEntity(_0x51ddd6,null))[_0x2c23('0x37')](handleError(_0x51ddd6,null));};exports[_0x2c23('0x3c')]=function(_0x1f3971,_0x1a1822){if(_0x1f3971[_0x2c23('0x3d')][_0x2c23('0x1f')]===_0x2c23('0x18')&&!_[_0x2c23('0x3e')](_0x1f3971['body'][_0x2c23('0x3f')],'_')){_0x1f3971[_0x2c23('0x3d')][_0x2c23('0x3f')]='_'['concat'](_0x1f3971['body'][_0x2c23('0x3f')]);}return db[_0x2c23('0x24')][_0x2c23('0x3c')](_0x1f3971['body'],{'raw':![]})[_0x2c23('0x14')](function(_0x2b2db0){var _0x25f7b3=_0x1f3971[_0x2c23('0x40')][_0x2c23('0x15')]({'plain':!![]});if(!_0x25f7b3)throw new Error(_0x2c23('0x41'));if(_0x25f7b3[_0x2c23('0x42')]===_0x2c23('0x40')){var _0x6c25ba=_0x2b2db0[_0x2c23('0x15')]({'plain':!![]});var _0x25d0d3=[{'name':_0x2c23('0x43'),'value':'inbound'},{'name':_0x2c23('0x17'),'value':_0x2c23('0x18')},{'name':_0x2c23('0x19'),'value':'internal'}];var _0x3458aa=_[_0x2c23('0x20')](_0x25d0d3,[_0x2c23('0x1e'),_0x6c25ba[_0x2c23('0x1f')]])[_0x2c23('0x21')];return db[_0x2c23('0x44')]['find']({'where':{'name':_0x3458aa,'userProfileId':_0x25f7b3['userProfileId']},'raw':!![]})[_0x2c23('0x14')](function(_0x4c3360){if(_0x4c3360&&_0x4c3360[_0x2c23('0x45')]===0x0){return db[_0x2c23('0x46')]['create']({'name':_0x6c25ba[_0x2c23('0x21')],'resourceId':_0x6c25ba['id'],'type':_0x4c3360[_0x2c23('0x21')],'sectionId':_0x4c3360['id']},{})['then'](function(){return _0x2b2db0;});}else{return _0x2b2db0;}})[_0x2c23('0x37')](function(_0x5181b9){logger['error'](_0x2c23('0x47'),_0x5181b9);throw _0x5181b9;});}return _0x2b2db0;})['then'](respondWithResult(_0x1a1822,0xc9))['catch'](handleError(_0x1a1822,null));};exports[_0x2c23('0x48')]=function(_0x1bbafa,_0x3bf3b3){if(_0x1bbafa['body']['id']){delete _0x1bbafa[_0x2c23('0x3d')]['id'];}return db[_0x2c23('0x24')][_0x2c23('0x20')]({'where':{'id':_0x1bbafa[_0x2c23('0x39')]['id']}})['then'](handleEntityNotFound(_0x3bf3b3,null))[_0x2c23('0x14')](function(_0x5602ac){if(_0x5602ac){return db[_0x2c23('0x24')][_0x2c23('0x48')](_[_0x2c23('0x49')](_0x1bbafa[_0x2c23('0x3d')],[_0x2c23('0x3f'),_0x2c23('0x4a'),_0x2c23('0x4b'),_0x2c23('0x4c'),_0x2c23('0x4d'),_0x2c23('0x4e'),_0x2c23('0x4f')]),{'where':{'context':_0x5602ac['context'],'exten':_0x5602ac[_0x2c23('0x3f')]},'individualHooks':!![]})['then'](function(_0x4a5c06){return _0x4a5c06;});}return null;})[_0x2c23('0x14')](respondWithStatusCode(_0x3bf3b3,null))['catch'](handleError(_0x3bf3b3,null));};exports['addApplications']=function(_0x5e851d,_0x4c7396){var _0x69cadd=_0x5e851d[_0x2c23('0x39')]['id'];var _0x26f759=_0x5e851d['body'];var _0x30a975=0xc8;var _0x384341=null;return db[_0x2c23('0x50')]['transaction']({'isolationLevel':db[_0x2c23('0x50')][_0x2c23('0x51')]['ISOLATION_LEVELS'][_0x2c23('0x52')]},function(_0x24873d){return db[_0x2c23('0x24')][_0x2c23('0x53')]({'where':{'id':_0x69cadd},'transaction':_0x24873d})['then'](function(_0xa5ffc0){if(_0xa5ffc0){return db['VoiceExtension'][_0x2c23('0x13')]({'where':{'VoiceExtensionId':_0x69cadd},'transaction':_0x24873d})['then'](function(){var _0x5c6a3a=_['map'](_0x26f759,function(_0x278ba3){_0x278ba3[_0x2c23('0x54')]=_0x69cadd;_0x278ba3[_0x2c23('0x55')]=!![];return _0x278ba3;});return _0xa5ffc0[_0x2c23('0x56')](_0x5c6a3a);})[_0x2c23('0x14')](function(_0x1ba863){return db[_0x2c23('0x24')][_0x2c23('0x57')](_0x1ba863,{'transaction':_0x24873d});});}else{_0x30a975=0x194;_0x384341=[];}});})[_0x2c23('0x14')](function(){if(_0x30a975!==0x194){return db[_0x2c23('0x24')][_0x2c23('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x69cadd},'order':'cast(priority\x20as\x20unsigned)'})[_0x2c23('0x14')](function(_0x448dbd){_0x384341=_0x448dbd;});}})['catch'](function(_0x19b998){_0x30a975=0x1f4;logger['error'](_0x19b998['stack']);if(_0x19b998['name']){delete _0x19b998[_0x2c23('0x21')];}_0x384341=_0x19b998;})[_0x2c23('0x59')](function(){if(_0x384341===null){_0x4c7396[_0x2c23('0x22')](_0x30a975);}else{if(_0x30a975===0x1f4){_0x4c7396[_0x2c23('0xb')](_0x30a975)[_0x2c23('0x23')](_0x384341);}else{_0x4c7396[_0x2c23('0xb')](_0x30a975)[_0x2c23('0xd')](_0x384341);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 04bcf4c..9a752e0 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 _0xf5bf=['setMaxListeners','emit','exports','events','../../mysqldb','VoiceExtension'];(function(_0x3af770,_0x1a957a){var _0x42c9a9=function(_0x2afac3){while(--_0x2afac3){_0x3af770['push'](_0x3af770['shift']());}};_0x42c9a9(++_0x1a957a);}(_0xf5bf,0x19b));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xff5b('0x0'));var VoiceExtension=require(_0xff5b('0x1'))['db'][_0xff5b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xff5b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x453996){return function(_0x446295,_0x4764cc,_0x4279ed){VoiceExtensionEvents[_0xff5b('0x4')](_0x453996+':'+_0x446295['id'],_0x446295);VoiceExtensionEvents['emit'](_0x453996,_0x446295);_0x4279ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xff5b('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5090=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x487085,_0x13ffeb){var _0xd08cb8=function(_0x1922e5){while(--_0x1922e5){_0x487085['push'](_0x487085['shift']());}};_0xd08cb8(++_0x13ffeb);}(_0x5090,0x7a));var _0x0509=function(_0x5c0cdc,_0x12e039){_0x5c0cdc=_0x5c0cdc-0x0;var _0x19ec84=_0x5090[_0x5c0cdc];return _0x19ec84;};'use strict';var EventEmitter=require(_0x0509('0x0'));var VoiceExtension=require(_0x0509('0x1'))['db'][_0x0509('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0509('0x3')](0x0);var events={'afterCreate':_0x0509('0x4'),'afterUpdate':_0x0509('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21c970){return function(_0x288f56,_0xd37982,_0x4d5fb7){VoiceExtensionEvents[_0x0509('0x6')](_0x21c970+':'+_0x288f56['id'],_0x288f56);VoiceExtensionEvents[_0x0509('0x6')](_0x21c970,_0x288f56);_0x4d5fb7(null);};}for(var e in events){if(events[_0x0509('0x7')](e)){var event=events[e];VoiceExtension[_0x0509('0x8')](e,emitEvent(event));}}module[_0x0509('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 578ef7f..0c12513 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 _0xa60a=['outbound','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','answer','playback','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','context','exten','Set','alias','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound'];(function(_0x55a4b5,_0x234098){var _0x3d0f7a=function(_0x4f8249){while(--_0x4f8249){_0x55a4b5['push'](_0x55a4b5['shift']());}};_0x3d0f7a(++_0x234098);}(_0xa60a,0x90));var _0xaa60=function(_0x3140c8,_0x137ee6){_0x3140c8=_0x3140c8-0x0;var _0xc7c85c=_0xa60a[_0x3140c8];return _0xc7c85c;};'use strict';var _=require(_0xaa60('0x0'));var attributes=require(_0xaa60('0x1'));module['exports']=function(_0x58379e){var _0x23e7fb=_0x58379e[_0xaa60('0x2')];function _0x26bea3(_0x71043c){var _0x39d38e=0x2;var _0x1ffc0f=[{'type':_0x71043c[_0xaa60('0x3')],'app':'Set','appdata':'CDR(type)='+_0x71043c['type'],'context':_0x71043c[_0xaa60('0x4')],'exten':_0x71043c[_0xaa60('0x5')],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']},{'type':_0x71043c['type'],'app':_0x71043c['alias']?_0xaa60('0x6'):'NoOp','appdata':_0x71043c[_0xaa60('0x7')]?'CDR(routeAlias)='+_0x71043c[_0xaa60('0x7')]:_0xaa60('0x8'),'context':_0x71043c['context'],'exten':_0x71043c[_0xaa60('0x5')],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']}];if(_0x71043c[_0xaa60('0x3')]===_0xaa60('0x9')){_0x1ffc0f['push']({'type':'inbound','app':_0xaa60('0x6'),'appdata':_0xaa60('0xa')+_0x71043c['id'],'context':_0x71043c[_0xaa60('0x4')],'exten':_0x71043c['exten'],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']});}_0x1ffc0f[_0xaa60('0xb')]({'type':_0x71043c[_0xaa60('0x3')],'app':'Set','appdata':_0xaa60('0xc'),'context':_0x71043c[_0xaa60('0x4')],'exten':_0x71043c['exten'],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']},{'type':_0x71043c[_0xaa60('0x3')],'app':_0xaa60('0x6'),'appdata':_0xaa60('0xd'),'context':_0x71043c[_0xaa60('0x4')],'exten':_0x71043c[_0xaa60('0x5')],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']},{'type':_0x71043c[_0xaa60('0x3')],'app':'Set','appdata':_0xaa60('0xe'),'context':_0x71043c[_0xaa60('0x4')],'exten':_0x71043c[_0xaa60('0x5')],'priority':_0x39d38e++,'VoiceExtensionId':_0x71043c['id']});return _0x1ffc0f;}function _0x45f45d(_0x306e2b){var _0x1a2c9c=0x2;var _0x2a6c04=[{'type':'outbound','app':_0xaa60('0x6'),'appdata':_0xaa60('0xf'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':'outbound','app':_0x306e2b[_0xaa60('0x7')]?_0xaa60('0x6'):'NoOp','appdata':_0x306e2b[_0xaa60('0x7')]?'CDR(routeAlias)='+_0x306e2b['alias']:_0xaa60('0x8'),'context':_0x306e2b['context'],'exten':_0x306e2b['exten'],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':_0xaa60('0x6'),'appdata':'CDR(destination)='+(_0x306e2b['cutdigits']?_0xaa60('0x11')+_0x306e2b[_0xaa60('0x12')]+'}':_0xaa60('0x13')),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b['exten'],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':_0xaa60('0x6'),'appdata':_0xaa60('0xa')+_0x306e2b['id'],'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1a2c9c+0x2)+_0xaa60('0x14')+(_0x1a2c9c+0x1)+')','context':_0x306e2b['context'],'exten':_0x306e2b['exten'],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':'outbound','app':'Set','appdata':_0x306e2b['cutdigits']?_0xaa60('0x15')+_0x306e2b[_0xaa60('0x12')]+'}':_0xaa60('0x16'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':_0xaa60('0x6'),'appdata':_0xaa60('0xc'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b['exten'],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':'Set','appdata':_0xaa60('0xd'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':'Set','appdata':_0xaa60('0xe'),'context':_0x306e2b['context'],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':_0xaa60('0x6'),'appdata':_0xaa60('0x17')+_0x306e2b['id'],'context':_0x306e2b['context'],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']}];if(_0x306e2b[_0xaa60('0x18')]('recordingFormat')&&_0x306e2b[_0xaa60('0x19')]!==_0xaa60('0x1a')){_0x2a6c04['push']({'type':'outbound','app':'Set','appdata':_0xaa60('0x1b'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b[_0xaa60('0x5')],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']},{'type':_0xaa60('0x10'),'app':_0xaa60('0x6'),'appdata':_0xaa60('0x1c')+_0x306e2b['recordingFormat']||_0xaa60('0x1d'),'context':_0x306e2b[_0xaa60('0x4')],'exten':_0x306e2b['exten'],'priority':_0x1a2c9c++,'VoiceExtensionId':_0x306e2b['id']});}return _0x2a6c04;}function _0x4e2491(_0x2b6611,_0x3d9a21){var _0x287e2d=[{'name':_0xaa60('0x1e'),'param':0x0},{'name':_0xaa60('0x1f'),'param':0x1},{'name':_0xaa60('0x20'),'param':0x2},{'name':_0xaa60('0x21'),'param':0x3}];var _0x487309={};var _0xfa2c7=_0x3d9a21[_0xaa60('0x22')](',');var _0x50f520=[];for(var _0x20bd72=0x0;_0x20bd72<_0x287e2d[_0xaa60('0x23')];_0x20bd72++){switch(_0x287e2d[_0x20bd72][_0xaa60('0x24')]){case'trunk':_0x487309[_0xaa60('0x1e')]=_0xfa2c7[_0x287e2d[_0x20bd72][_0xaa60('0x25')]][_0xaa60('0x22')]('/')[0x1];_0x487309[_0xaa60('0x26')]=_0xfa2c7[_0x287e2d[_0x20bd72][_0xaa60('0x25')]][_0xaa60('0x22')]('/')[0x2];_0x487309[_0xaa60('0x27')]=_0x487309[_0xaa60('0x26')]?_0x487309[_0xaa60('0x26')][_0xaa60('0x22')]('$')[0x0]:undefined;_0x487309['phone']=_0x2b6611[_0xaa60('0x12')]?(_0x487309['prefix']||'')+_0xaa60('0x11')+_0x2b6611[_0xaa60('0x12')]+'}':(_0x487309[_0xaa60('0x27')]||'')+_0xaa60('0x13');_0x50f520[_0x287e2d[_0x20bd72][_0xaa60('0x25')]]=['SIP',_0x487309['trunk'],_0x487309[_0xaa60('0x26')]][_0xaa60('0x28')]('/');break;case _0xaa60('0x20'):_0x487309[_0xaa60('0x20')]=_0xfa2c7[_0x287e2d[_0x20bd72][_0xaa60('0x25')]];if(_0x2b6611[_0xaa60('0x19')]!=='none'){if(_0x487309[_0xaa60('0x20')][_0xaa60('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x487309[_0xaa60('0x20')]+=_0xaa60('0x2a');}}else{_0x487309['options']=_0x487309[_0xaa60('0x20')][_0xaa60('0x2b')]('U(xcally-mixmonitor-context)','');}_0x50f520[_0x287e2d[_0x20bd72]['param']]=_0x487309[_0xaa60('0x20')];break;default:_0x50f520[_0x287e2d[_0x20bd72][_0xaa60('0x25')]]=_0xfa2c7[_0x287e2d[_0x20bd72][_0xaa60('0x25')]];}}return _0x50f520[_0xaa60('0x28')](',');}function _0x1e011e(_0x56b21d,_0x87c19e,_0x1cfb26){return new Promise(function(_0x3fe5cc,_0xdfb2cd){var _0x12c7cb=[];if(_['isEmpty'](_0x87c19e))return _0x3fe5cc(_0x12c7cb);_0x23e7fb[_0xaa60('0x2c')]['findAll']({'attributes':['id',_0xaa60('0x2d'),_0xaa60('0x2e')],'raw':!![]})[_0xaa60('0x2f')](function(_0x31554f){for(var _0x47493d=0x0,_0xc4cf1c=0x0;_0x47493d<_0x87c19e[_0xaa60('0x23')];_0x47493d++,_0xc4cf1c=0x0){var _0x3b15b1=_0x87c19e[_0x47493d];var _0x35ef5d=[];var _0x2b6b52=[];delete _0x3b15b1['id'];if(_0x3b15b1[_0xaa60('0x2d')]!=='*,*,*,*'){_0x3b15b1['intervals']=[_0x3b15b1[_0xaa60('0x2d')]];}else{_0x3b15b1[_0xaa60('0x30')]=_0x3b15b1[_0xaa60('0x2e')]?_[_0xaa60('0x31')](_[_0xaa60('0x32')](_0x31554f,{'IntervalId':_0x3b15b1[_0xaa60('0x2e')]}),_0xaa60('0x2d')):[];}_0x3b15b1['context']=_0x56b21d[_0xaa60('0x4')];_0x3b15b1[_0xaa60('0x5')]=_0x56b21d[_0xaa60('0x5')];if(_0x3b15b1['type'])_0x3b15b1[_0xaa60('0x3')]=_0x3b15b1['type'][_0xaa60('0x33')]();if(_0x56b21d['type']===_0xaa60('0x10')){if(_0x3b15b1[_0xaa60('0x18')](_0xaa60('0x34'))&&_0x3b15b1[_0xaa60('0x34')]&&_0x3b15b1['tag']!=='--'){_0x35ef5d['push']({'type':_0x3b15b1[_0xaa60('0x3')]['toLowerCase'](),'app':'Set','appdata':_0xaa60('0x35')+_0x3b15b1[_0xaa60('0x34')],'context':_0x56b21d[_0xaa60('0x4')],'exten':_0x56b21d[_0xaa60('0x5')],'priority':_0x3b15b1['intervals']['length']+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});}_0x35ef5d[_0xaa60('0xb')]({'type':_0x3b15b1[_0xaa60('0x3')][_0xaa60('0x33')](),'app':_0xaa60('0x36'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3b15b1[_0xaa60('0x37')]?_0xaa60('0x38')+_0x3b15b1[_0xaa60('0x37')]+')':'NoOp(No\x20number\x20available)'),'context':_0x56b21d[_0xaa60('0x4')],'exten':_0x56b21d[_0xaa60('0x5')],'priority':_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')]+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});}else{if(_0x3b15b1[_0xaa60('0x18')](_0xaa60('0x39'))){if(['queue',_0xaa60('0x3a')][_0xaa60('0x3b')](_0x3b15b1[_0xaa60('0x3c')][_0xaa60('0x33')]())&&_0x3b15b1['appType']!=='custom'){if(_0x3b15b1['answer']){_0x35ef5d['push']({'type':_0x3b15b1[_0xaa60('0x3')][_0xaa60('0x33')](),'app':'ExecIf','appdata':_0xaa60('0x3d'),'context':_0x56b21d['context'],'exten':_0x56b21d[_0xaa60('0x5')],'priority':_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')]+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});_0x35ef5d[_0xaa60('0xb')]({'type':_0x3b15b1[_0xaa60('0x3')][_0xaa60('0x33')](),'app':_0xaa60('0x6'),'appdata':_0xaa60('0x3e'),'context':_0x56b21d[_0xaa60('0x4')],'exten':_0x56b21d[_0xaa60('0x5')],'priority':_0x3b15b1[_0xaa60('0x30')]['length']+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});}else{_0x35ef5d[_0xaa60('0xb')]({'type':_0x3b15b1[_0xaa60('0x3')]['toLowerCase'](),'app':_0xaa60('0x36'),'appdata':_0xaa60('0x3f'),'context':_0x56b21d['context'],'exten':_0x56b21d['exten'],'priority':_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')]+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});_0x35ef5d[_0xaa60('0xb')]({'type':_0x3b15b1[_0xaa60('0x3')][_0xaa60('0x33')](),'app':'Set','appdata':_0xaa60('0x40'),'context':_0x56b21d['context'],'exten':_0x56b21d['exten'],'priority':_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')]+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});}}}}for(var _0xad055=0x0;_0xad055<_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')];_0xad055++){var _0x407fca=_0x1cfb26+_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')];var _0xef2243=_0xad055===_0x3b15b1[_0xaa60('0x30')]['length']-0x1?_0x1cfb26+_0x35ef5d[_0xaa60('0x23')]+_0x2b6b52[_0xaa60('0x23')]+0x2:_0x1cfb26+_0xad055+0x1;_0x35ef5d[_0xaa60('0x41')](_0xad055,0x0,{'type':_0x56b21d[_0xaa60('0x3')],'app':'GotoIfTime','appdata':_0x3b15b1[_0xaa60('0x30')][_0xad055]+'?'+_0x56b21d[_0xaa60('0x4')]+_0xaa60('0x42')+_0x407fca+':'+_0x56b21d[_0xaa60('0x4')]+_0xaa60('0x42')+_0xef2243,'exten':_0x56b21d[_0xaa60('0x5')],'context':_0x56b21d[_0xaa60('0x4')],'priority':_0x1cfb26+_0xad055,'VoiceExtensionId':_0x56b21d['id']});}if(_0x3b15b1[_0xaa60('0x43')]===_0xaa60('0x44')){_0x3b15b1[_0xaa60('0x45')]=_0x4e2491(_0x56b21d,_0x3b15b1[_0xaa60('0x45')]);}if(_0x3b15b1[_0xaa60('0x43')]===_0xaa60('0x46')){_0x35ef5d[_0xaa60('0xb')]({'type':_0x3b15b1[_0xaa60('0x3')][_0xaa60('0x33')](),'app':_0xaa60('0x6'),'appdata':_0xaa60('0x47'),'context':_0x56b21d[_0xaa60('0x4')],'exten':_0x56b21d['exten'],'priority':_0x3b15b1[_0xaa60('0x30')][_0xaa60('0x23')]+_0x1cfb26+_0xc4cf1c++,'VoiceExtensionId':_0x56b21d['id']});}_0x3b15b1[_0xaa60('0x48')]=_0x35ef5d[_0xaa60('0x23')]?_[_0xaa60('0x49')](_0x35ef5d)[_0xaa60('0x48')]+0x1:_0x1cfb26;_0x12c7cb=_[_0xaa60('0x4a')](_0x12c7cb,_0x35ef5d,[_0x3b15b1],_0x2b6b52);_0x1cfb26=_[_0xaa60('0x49')](_0x12c7cb)[_0xaa60('0x48')]+0x1;}return _0x3fe5cc(_0x12c7cb);})[_0xaa60('0x4b')](function(_0x575438){_0xdfb2cd(_0x575438);});});}return _0x58379e[_0xaa60('0x4c')]('VoiceExtension',attributes,{'tableName':_0xaa60('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5869a0){var _0x13088=this[_0xaa60('0x4e')]({'plain':!![]});var _0x43187a=_0x13088[_0xaa60('0x3')]==='outbound'?_0x45f45d(_0x13088):_0x26bea3(_0x13088);return _0x1e011e(_0x13088,_0x5869a0,_[_0xaa60('0x49')](_0x43187a)[_0xaa60('0x48')]+0x1)['then'](function(_0x25be03){var _0x4be33a=_[_0xaa60('0x4a')](_0x43187a,_0x25be03);_0x4be33a['push']({'type':_0x13088[_0xaa60('0x3')],'app':_0xaa60('0x4f'),'exten':_0x13088[_0xaa60('0x5')],'context':_0x13088[_0xaa60('0x4')],'priority':_[_0xaa60('0x49')](_0x4be33a)[_0xaa60('0x48')]+0x1,'VoiceExtensionId':_0x13088['id']});return _0x4be33a;});}}});}; \ No newline at end of file +var _0x3611=['tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','cutdigits','${EXTEN:','${EXTEN}','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','split','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase'];(function(_0x5bec2a,_0x16e1c7){var _0x58b6bc=function(_0x7520fa){while(--_0x7520fa){_0x5bec2a['push'](_0x5bec2a['shift']());}};_0x58b6bc(++_0x16e1c7);}(_0x3611,0x11d));var _0x1361=function(_0x1a4d93,_0x3b5097){_0x1a4d93=_0x1a4d93-0x0;var _0x476ddc=_0x3611[_0x1a4d93];return _0x476ddc;};'use strict';var _=require(_0x1361('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x2d8bf1){var _0x37681e=_0x2d8bf1['models'];function _0x5b58dc(_0x21c3f0){var _0x27236e=0x2;var _0x4b7eb4=[{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0x3')+_0x21c3f0['type'],'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0['exten'],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x21c3f0[_0x1361('0x5')]?_0x1361('0x2'):_0x1361('0x6'),'appdata':_0x21c3f0[_0x1361('0x5')]?_0x1361('0x7')+_0x21c3f0[_0x1361('0x5')]:_0x1361('0x8'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']}];if(_0x21c3f0[_0x1361('0x1')]==='inbound'){_0x4b7eb4[_0x1361('0xa')]({'type':_0x1361('0xb'),'app':_0x1361('0x2'),'appdata':_0x1361('0xc')+_0x21c3f0['id'],'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']});}_0x4b7eb4['push']({'type':_0x21c3f0['type'],'app':_0x1361('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0['exten'],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0xd'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']},{'type':_0x21c3f0[_0x1361('0x1')],'app':_0x1361('0x2'),'appdata':_0x1361('0xe'),'context':_0x21c3f0[_0x1361('0x4')],'exten':_0x21c3f0[_0x1361('0x9')],'priority':_0x27236e++,'VoiceExtensionId':_0x21c3f0['id']});return _0x4b7eb4;}function _0x1cb2b0(_0x15bc02){var _0x1650c0=0x2;var _0x1da464=[{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x1361('0xf'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x15bc02[_0x1361('0x5')]?'Set':'NoOp','appdata':_0x15bc02[_0x1361('0x5')]?_0x1361('0x7')+_0x15bc02[_0x1361('0x5')]:_0x1361('0x8'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':'CDR(destination)='+(_0x15bc02[_0x1361('0x11')]?_0x1361('0x12')+_0x15bc02[_0x1361('0x11')]+'}':_0x1361('0x13')),'context':_0x15bc02['context'],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x1361('0xc')+_0x15bc02['id'],'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1650c0+0x2)+'):Goto('+(_0x1650c0+0x1)+')','context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':'outbound','app':_0x1361('0x2'),'appdata':_0x15bc02[_0x1361('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x15bc02[_0x1361('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x14'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':'Set','appdata':_0x1361('0xd'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0xe'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x15')+_0x15bc02['id'],'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02[_0x1361('0x9')],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']}];if(_0x15bc02[_0x1361('0x16')](_0x1361('0x17'))&&_0x15bc02[_0x1361('0x17')]!=='none'){_0x1da464[_0x1361('0xa')]({'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x18'),'context':_0x15bc02[_0x1361('0x4')],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']},{'type':_0x1361('0x10'),'app':_0x1361('0x2'),'appdata':_0x1361('0x19')+_0x15bc02[_0x1361('0x17')]||_0x1361('0x1a'),'context':_0x15bc02['context'],'exten':_0x15bc02['exten'],'priority':_0x1650c0++,'VoiceExtensionId':_0x15bc02['id']});}return _0x1da464;}function _0x593170(_0xab3808,_0x41ff5a){var _0x47bd91=[{'name':_0x1361('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x1361('0x1c'),'param':0x2},{'name':_0x1361('0x1d'),'param':0x3}];var _0x3e6b20={};var _0x582af8=_0x41ff5a['split'](',');var _0x225d63=[];for(var _0x21a6f7=0x0;_0x21a6f7<_0x47bd91[_0x1361('0x1e')];_0x21a6f7++){switch(_0x47bd91[_0x21a6f7][_0x1361('0x1f')]){case _0x1361('0x1b'):_0x3e6b20['trunk']=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]][_0x1361('0x21')]('/')[0x1];_0x3e6b20[_0x1361('0x22')]=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]['split']('/')[0x2];_0x3e6b20[_0x1361('0x23')]=_0x3e6b20[_0x1361('0x22')]?_0x3e6b20['phone'][_0x1361('0x21')]('$')[0x0]:undefined;_0x3e6b20[_0x1361('0x22')]=_0xab3808[_0x1361('0x11')]?(_0x3e6b20[_0x1361('0x23')]||'')+_0x1361('0x12')+_0xab3808[_0x1361('0x11')]+'}':(_0x3e6b20[_0x1361('0x23')]||'')+'${EXTEN}';_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=[_0x1361('0x24'),_0x3e6b20[_0x1361('0x1b')],_0x3e6b20[_0x1361('0x22')]]['join']('/');break;case _0x1361('0x1c'):_0x3e6b20[_0x1361('0x1c')]=_0x582af8[_0x47bd91[_0x21a6f7][_0x1361('0x20')]];if(_0xab3808[_0x1361('0x17')]!==_0x1361('0x25')){if(_0x3e6b20[_0x1361('0x1c')][_0x1361('0x26')](_0x1361('0x27'))<0x0){_0x3e6b20[_0x1361('0x1c')]+='U(xcally-mixmonitor-context)';}}else{_0x3e6b20[_0x1361('0x1c')]=_0x3e6b20[_0x1361('0x1c')]['replace'](_0x1361('0x27'),'');}_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=_0x3e6b20[_0x1361('0x1c')];break;default:_0x225d63[_0x47bd91[_0x21a6f7][_0x1361('0x20')]]=_0x582af8[_0x47bd91[_0x21a6f7]['param']];}}return _0x225d63[_0x1361('0x28')](',');}function _0x1c8ef0(_0x1ddc42,_0x9c1eb2,_0x20f845){return new Promise(function(_0x3d166b,_0x225d6b){var _0x10c6cd=[];if(_[_0x1361('0x29')](_0x9c1eb2))return _0x3d166b(_0x10c6cd);_0x37681e[_0x1361('0x2a')][_0x1361('0x2b')]({'attributes':['id',_0x1361('0x2c'),_0x1361('0x2d')],'raw':!![]})[_0x1361('0x2e')](function(_0x1a9481){for(var _0x5c8111=0x0,_0x1152b8=0x0;_0x5c8111<_0x9c1eb2[_0x1361('0x1e')];_0x5c8111++,_0x1152b8=0x0){var _0x4ce0e1=_0x9c1eb2[_0x5c8111];var _0x7b1bc9=[];var _0x2e600c=[];delete _0x4ce0e1['id'];if(_0x4ce0e1[_0x1361('0x2c')]!=='*,*,*,*'){_0x4ce0e1[_0x1361('0x2f')]=[_0x4ce0e1[_0x1361('0x2c')]];}else{_0x4ce0e1['intervals']=_0x4ce0e1[_0x1361('0x2d')]?_[_0x1361('0x30')](_[_0x1361('0x31')](_0x1a9481,{'IntervalId':_0x4ce0e1[_0x1361('0x2d')]}),_0x1361('0x2c')):[];}_0x4ce0e1[_0x1361('0x4')]=_0x1ddc42['context'];_0x4ce0e1[_0x1361('0x9')]=_0x1ddc42[_0x1361('0x9')];if(_0x4ce0e1['type'])_0x4ce0e1[_0x1361('0x1')]=_0x4ce0e1['type'][_0x1361('0x32')]();if(_0x1ddc42[_0x1361('0x1')]===_0x1361('0x10')){if(_0x4ce0e1[_0x1361('0x16')]('tag')&&_0x4ce0e1[_0x1361('0x33')]&&_0x4ce0e1['tag']!=='--'){_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':'CDR(tag)='+_0x4ce0e1['tag'],'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x34'),'appdata':_0x1361('0x35')+(_0x4ce0e1[_0x1361('0x36')]?_0x1361('0x37')+_0x4ce0e1[_0x1361('0x36')]+')':_0x1361('0x38')),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}else{if(_0x4ce0e1[_0x1361('0x16')](_0x1361('0x39'))){if([_0x1361('0x3a'),_0x1361('0x3b')][_0x1361('0x3c')](_0x4ce0e1[_0x1361('0x3d')]['toLowerCase']())&&_0x4ce0e1[_0x1361('0x3e')]!==_0x1361('0x3f')){if(_0x4ce0e1[_0x1361('0x39')]){_0x7b1bc9['push']({'type':_0x4ce0e1[_0x1361('0x1')]['toLowerCase'](),'app':'ExecIf','appdata':_0x1361('0x40'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});_0x7b1bc9['push']({'type':_0x4ce0e1['type'][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x41'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}else{_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x34'),'appdata':_0x1361('0x42'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')]['length']+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1[_0x1361('0x1')][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x43'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42[_0x1361('0x9')],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}}}}for(var _0x5af22f=0x0;_0x5af22f<_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')];_0x5af22f++){var _0xe8844a=_0x20f845+_0x4ce0e1[_0x1361('0x2f')]['length'];var _0x5a3cb4=_0x5af22f===_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]-0x1?_0x20f845+_0x7b1bc9[_0x1361('0x1e')]+_0x2e600c['length']+0x2:_0x20f845+_0x5af22f+0x1;_0x7b1bc9[_0x1361('0x44')](_0x5af22f,0x0,{'type':_0x1ddc42[_0x1361('0x1')],'app':_0x1361('0x45'),'appdata':_0x4ce0e1[_0x1361('0x2f')][_0x5af22f]+'?'+_0x1ddc42[_0x1361('0x4')]+',${EXTEN},'+_0xe8844a+':'+_0x1ddc42[_0x1361('0x4')]+_0x1361('0x46')+_0x5a3cb4,'exten':_0x1ddc42[_0x1361('0x9')],'context':_0x1ddc42[_0x1361('0x4')],'priority':_0x20f845+_0x5af22f,'VoiceExtensionId':_0x1ddc42['id']});}if(_0x4ce0e1[_0x1361('0x3e')]===_0x1361('0x47')){_0x4ce0e1[_0x1361('0x48')]=_0x593170(_0x1ddc42,_0x4ce0e1[_0x1361('0x48')]);}if(_0x4ce0e1['appType']===_0x1361('0x49')){_0x7b1bc9[_0x1361('0xa')]({'type':_0x4ce0e1['type'][_0x1361('0x32')](),'app':_0x1361('0x2'),'appdata':_0x1361('0x4a'),'context':_0x1ddc42[_0x1361('0x4')],'exten':_0x1ddc42['exten'],'priority':_0x4ce0e1[_0x1361('0x2f')][_0x1361('0x1e')]+_0x20f845+_0x1152b8++,'VoiceExtensionId':_0x1ddc42['id']});}_0x4ce0e1[_0x1361('0x4b')]=_0x7b1bc9['length']?_['last'](_0x7b1bc9)[_0x1361('0x4b')]+0x1:_0x20f845;_0x10c6cd=_[_0x1361('0x4c')](_0x10c6cd,_0x7b1bc9,[_0x4ce0e1],_0x2e600c);_0x20f845=_[_0x1361('0x4d')](_0x10c6cd)[_0x1361('0x4b')]+0x1;}return _0x3d166b(_0x10c6cd);})[_0x1361('0x4e')](function(_0x3f5ad4){_0x225d6b(_0x3f5ad4);});});}return _0x2d8bf1[_0x1361('0x4f')](_0x1361('0x50'),attributes,{'tableName':_0x1361('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2a68c8){var _0x26bfe1=this[_0x1361('0x52')]({'plain':!![]});var _0xf70c33=_0x26bfe1[_0x1361('0x1')]==='outbound'?_0x1cb2b0(_0x26bfe1):_0x5b58dc(_0x26bfe1);return _0x1c8ef0(_0x26bfe1,_0x2a68c8,_['last'](_0xf70c33)[_0x1361('0x4b')]+0x1)['then'](function(_0x2d74e6){var _0x26ba00=_[_0x1361('0x4c')](_0xf70c33,_0x2d74e6);_0x26ba00['push']({'type':_0x26bfe1[_0x1361('0x1')],'app':_0x1361('0x53'),'exten':_0x26bfe1[_0x1361('0x9')],'context':_0x26bfe1['context'],'priority':_[_0x1361('0x4d')](_0x26ba00)[_0x1361('0x4b')]+0x1,'VoiceExtensionId':_0x26bfe1['id']});return _0x26ba00;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 250da12..c99d535 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 _0xe08b=['include','map','model','GetVoiceExtension','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit'];(function(_0x5a42ce,_0x40a24e){var _0x50ab39=function(_0x10f66d){while(--_0x10f66d){_0x5a42ce['push'](_0x5a42ce['shift']());}};_0x50ab39(++_0x40a24e);}(_0xe08b,0x10e));var _0xbe08=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xe08b[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0xbe08('0x0'));var util=require('util');var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe08('0x3'));var db=require(_0xbe08('0x4'))['db'];var utils=require(_0xbe08('0x5'));var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});config[_0xbe08('0xc')]=_[_0xbe08('0xd')](config[_0xbe08('0xc')],{'host':_0xbe08('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe08('0xc')]));require(_0xbe08('0xf'))['register'](socket);function respondWithRpcPromise(_0xb4e69a,_0xed8e0c,_0x47ca8d){return new BPromise(function(_0xc5824c,_0x202fec){return client['request'](_0xb4e69a,_0x47ca8d)[_0xbe08('0x10')](function(_0x133725){logger[_0xbe08('0x11')](_0xbe08('0x12'),_0xed8e0c,'request\x20sent');logger[_0xbe08('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'),JSON[_0xbe08('0x15')](_0x133725));if(_0x133725[_0xbe08('0x16')]){if(_0x133725[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x202fec(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);return _0xc5824c(_0x133725[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xed8e0c,_0xbe08('0x14'));_0xc5824c(_0x133725[_0xbe08('0x19')][_0xbe08('0x18')]);}})[_0xbe08('0x1a')](function(_0x1c9379){logger[_0xbe08('0x16')](_0xbe08('0x12'),_0xed8e0c,_0x1c9379);_0x202fec(_0x1c9379);});});}exports['GetVoiceExtension']=function(_0x16e8b4){var _0x27dc52=this;return new Promise(function(_0x5ca59b,_0x5ab5f5){return db[_0xbe08('0x1b')][_0xbe08('0x1c')]({'raw':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4['options'][_0xbe08('0x1e')]===undefined?!![]:![]:!![],'where':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x1f')]||null:null,'attributes':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x20')]||null:null,'limit':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x21')]||null:null,'include':_0x16e8b4[_0xbe08('0x1d')]?_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x22')]?_[_0xbe08('0x23')](_0x16e8b4[_0xbe08('0x1d')][_0xbe08('0x22')],function(_0x368122){return{'model':db[_0x368122[_0xbe08('0x24')]],'as':_0x368122['as'],'attributes':_0x368122[_0xbe08('0x20')],'include':_0x368122[_0xbe08('0x22')]?_['map'](_0x368122[_0xbe08('0x22')],function(_0x23100b){return{'model':db[_0x23100b[_0xbe08('0x24')]],'as':_0x23100b['as'],'attributes':_0x23100b[_0xbe08('0x20')],'include':_0x23100b[_0xbe08('0x22')]?_[_0xbe08('0x23')](_0x23100b['include'],function(_0x415da3){return{'model':db[_0x415da3[_0xbe08('0x24')]],'as':_0x415da3['as'],'attributes':_0x415da3[_0xbe08('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbe08('0x10')](function(_0x1135c3){logger['info'](_0xbe08('0x25'),_0x16e8b4);logger[_0xbe08('0x13')](_0xbe08('0x25'),_0x16e8b4,JSON['stringify'](_0x1135c3));_0x5ca59b(_0x1135c3);})[_0xbe08('0x1a')](function(_0x31b820){logger['error'](_0xbe08('0x25'),_0x31b820[_0xbe08('0x18')],_0x16e8b4);_0x5ab5f5(_0x27dc52['error'](0x1f4,_0x31b820[_0xbe08('0x18')]));});});}; \ No newline at end of file +var _0xab86=['attributes','limit','include','map','model','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where'];(function(_0x1d2362,_0x83aa1a){var _0x8741c=function(_0xf2ba7){while(--_0xf2ba7){_0x1d2362['push'](_0x1d2362['shift']());}};_0x8741c(++_0x83aa1a);}(_0xab86,0x13e));var _0x6ab8=function(_0xe35a3,_0x4973eb){_0xe35a3=_0xe35a3-0x0;var _0x4ba2d2=_0xab86[_0xe35a3];return _0x4ba2d2;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var moment=require(_0x6ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ab8('0x4'));var logger=require('../../config/logger')(_0x6ab8('0x5'));var config=require(_0x6ab8('0x6'));var jayson=require(_0x6ab8('0x7'));var client=jayson[_0x6ab8('0x8')][_0x6ab8('0x9')]({'port':0x232a});config[_0x6ab8('0xa')]=_[_0x6ab8('0xb')](config[_0x6ab8('0xa')],{'host':_0x6ab8('0xc'),'port':0x18eb});var socket=require(_0x6ab8('0xd'))(new Redis(config[_0x6ab8('0xa')]));require(_0x6ab8('0xe'))[_0x6ab8('0xf')](socket);function respondWithRpcPromise(_0x5127eb,_0x5ea6e6,_0x383594){return new BPromise(function(_0x5b7732,_0x18d3a3){return client[_0x6ab8('0x10')](_0x5127eb,_0x383594)[_0x6ab8('0x11')](function(_0x52d636){logger[_0x6ab8('0x12')](_0x6ab8('0x13'),_0x5ea6e6,'request\x20sent');logger[_0x6ab8('0x14')](_0x6ab8('0x15'),_0x5ea6e6,_0x6ab8('0x16'),JSON['stringify'](_0x52d636));if(_0x52d636[_0x6ab8('0x17')]){if(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x18')]===0x1f4){logger[_0x6ab8('0x17')](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x18d3a3(_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);}logger['error'](_0x6ab8('0x13'),_0x5ea6e6,_0x52d636[_0x6ab8('0x17')][_0x6ab8('0x19')]);return _0x5b7732(_0x52d636['error'][_0x6ab8('0x19')]);}else{logger[_0x6ab8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,'request\x20sent');_0x5b7732(_0x52d636[_0x6ab8('0x1a')]['message']);}})[_0x6ab8('0x1b')](function(_0x292b36){logger[_0x6ab8('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x5ea6e6,_0x292b36);_0x18d3a3(_0x292b36);});});}exports[_0x6ab8('0x1c')]=function(_0x3de5b3){var _0x2d2a80=this;return new Promise(function(_0x312183,_0x5227c6){return db[_0x6ab8('0x1d')][_0x6ab8('0x1e')]({'raw':_0x3de5b3['options']?_0x3de5b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x20')]||null:null,'attributes':_0x3de5b3['options']?_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x21')]||null:null,'limit':_0x3de5b3['options']?_0x3de5b3['options'][_0x6ab8('0x22')]||null:null,'include':_0x3de5b3[_0x6ab8('0x1f')]?_0x3de5b3['options'][_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x3de5b3[_0x6ab8('0x1f')][_0x6ab8('0x23')],function(_0x3ddaeb){return{'model':db[_0x3ddaeb[_0x6ab8('0x25')]],'as':_0x3ddaeb['as'],'attributes':_0x3ddaeb[_0x6ab8('0x21')],'include':_0x3ddaeb[_0x6ab8('0x23')]?_['map'](_0x3ddaeb['include'],function(_0x334e21){return{'model':db[_0x334e21['model']],'as':_0x334e21['as'],'attributes':_0x334e21[_0x6ab8('0x21')],'include':_0x334e21[_0x6ab8('0x23')]?_[_0x6ab8('0x24')](_0x334e21['include'],function(_0x525687){return{'model':db[_0x525687['model']],'as':_0x525687['as'],'attributes':_0x525687[_0x6ab8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6ab8('0x11')](function(_0x3723a7){logger[_0x6ab8('0x12')](_0x6ab8('0x1c'),_0x3de5b3);logger[_0x6ab8('0x14')](_0x6ab8('0x1c'),_0x3de5b3,JSON[_0x6ab8('0x26')](_0x3723a7));_0x312183(_0x3723a7);})[_0x6ab8('0x1b')](function(_0x1f6dbc){logger[_0x6ab8('0x17')](_0x6ab8('0x1c'),_0x1f6dbc[_0x6ab8('0x19')],_0x3de5b3);_0x5227c6(_0x2d2a80['error'](0x1f4,_0x1f6dbc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 459251b..616cf60 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 _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0xc8a62b,_0x4e1b0b){var _0x454c14=function(_0x790b69){while(--_0x790b69){_0xc8a62b['push'](_0xc8a62b['shift']());}};_0x454c14(++_0x4e1b0b);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d1a73,_0x18667d){_0x4d1a73=_0x4d1a73-0x0;var _0x19e552=_0x2ef3[_0x4d1a73];return _0x19e552;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x463bbe,_0xf91af8){var _0x2af9cc=function(_0x1a5870){while(--_0x1a5870){_0x463bbe['push'](_0x463bbe['shift']());}};_0x2af9cc(++_0xf91af8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5fc3[_0x11a55c];return _0x26c390;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 312c74e..b593178 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 _0x8f9d=['/:id/messages','getMessages','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0x12')](_0xd8f9('0xc'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x3e3f09,_0x564b0e){var _0x462a5e=function(_0x234b70){while(--_0x234b70){_0x3e3f09['push'](_0x3e3f09['shift']());}};_0x462a5e(++_0x564b0e);}(_0x32f4,0x154));var _0x432f=function(_0x16bc7f,_0x525713){_0x16bc7f=_0x16bc7f-0x0;var _0x15833e=_0x32f4[_0x16bc7f];return _0x15833e;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c48e737..bbc9a36 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 _0x8bbf=['exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize'];(function(_0x30ccab,_0x264087){var _0x211d4b=function(_0x2b40b2){while(--_0x2b40b2){_0x30ccab['push'](_0x30ccab['shift']());}};_0x211d4b(++_0x264087);}(_0x8bbf,0x142));var _0xf8bb=function(_0x383019,_0x4345ea){_0x383019=_0x383019-0x0;var _0x265b36=_0x8bbf[_0x383019];return _0x265b36;};'use strict';var Sequelize=require(_0xf8bb('0x0'));module[_0xf8bb('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf8bb('0x2')],'defaultValue':_0xf8bb('0x3'),'unique':_0xf8bb('0x4')},'mailbox':{'type':Sequelize[_0xf8bb('0x2')],'defaultValue':'','allowNull':![],'unique':_0xf8bb('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xf8bb('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x155c4d){this['setDataValue']('email',typeof _0x155c4d===_0xf8bb('0x5')&&_0x155c4d[_0xf8bb('0x6')]()?_0x155c4d[_0xf8bb('0x6')]():null);}},'pager':{'type':Sequelize[_0xf8bb('0x2')]},'tz':{'type':Sequelize[_0xf8bb('0x2')],'defaultValue':_0xf8bb('0x7')},'attach':{'type':Sequelize[_0xf8bb('0x8')]('yes','no'),'defaultValue':_0xf8bb('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf8bb('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf8bb('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf8bb('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf8bb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf8bb('0x8')](_0xf8bb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xf8bb('0x9'),'no'),'defaultValue':_0xf8bb('0x9'),'allowNull':![]},'stamp':{'type':_0xf8bb('0xb')},'emailsubject':{'type':Sequelize[_0xf8bb('0x2')]},'emailbody':{'type':Sequelize[_0xf8bb('0x2')]},'maxsecs':{'type':Sequelize[_0xf8bb('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf8bb('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf8bb('0xd')],'get':function(){return this[_0xf8bb('0xe')](_0xf8bb('0xf'))+'\x20-\x20'+this[_0xf8bb('0xe')](_0xf8bb('0x10'));}}}; \ No newline at end of file +var _0xe8c0=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xe8c0,0x168));var _0x0e8c=function(_0x5d8f15,_0x382d47){_0x5d8f15=_0x5d8f15-0x0;var _0x5a798e=_0xe8c0[_0x5d8f15];return _0x5a798e;};'use strict';var Sequelize=require(_0x0e8c('0x0'));module[_0x0e8c('0x1')]={'customer_id':{'type':Sequelize[_0x0e8c('0x2')]},'context':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':_0x0e8c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0e8c('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0e8c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x15571d){this[_0x0e8c('0x5')]('email',typeof _0x15571d===_0x0e8c('0x6')&&_0x15571d[_0x0e8c('0x7')]()?_0x15571d[_0x0e8c('0x7')]():null);}},'pager':{'type':Sequelize[_0x0e8c('0x2')]},'tz':{'type':Sequelize[_0x0e8c('0x2')],'defaultValue':_0x0e8c('0x8')},'attach':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0e8c('0x2')]},'callback':{'type':Sequelize[_0x0e8c('0x2')]},'review':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0e8c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0e8c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0e8c('0xa')](_0x0e8c('0x9'),'no'),'defaultValue':_0x0e8c('0x9'),'allowNull':![]},'stamp':{'type':_0x0e8c('0xb')},'emailsubject':{'type':Sequelize[_0x0e8c('0x2')]},'emailbody':{'type':Sequelize[_0x0e8c('0x2')]},'maxsecs':{'type':Sequelize[_0x0e8c('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0e8c('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0e8c('0xd')],'get':function(){return this[_0x0e8c('0xe')](_0x0e8c('0xf'))+_0x0e8c('0x10')+this['getDataValue'](_0x0e8c('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b56f238..c542cd2 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 _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1b27f1,_0x6be923){var _0x1fa499=function(_0x501330){while(--_0x501330){_0x1b27f1['push'](_0x1b27f1['shift']());}};_0x1fa499(++_0x6be923);}(_0x3c81,0x102));var _0x13c8=function(_0x20bbdb,_0x2633ac){_0x20bbdb=_0x20bbdb-0x0;var _0x56c8a0=_0x3c81[_0x20bbdb];return _0x56c8a0;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file +var _0x2f68=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','body','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel'];(function(_0x5e548d,_0x5f4e1c){var _0x1d4390=function(_0x321854){while(--_0x321854){_0x5e548d['push'](_0x5e548d['shift']());}};_0x1d4390(++_0x5f4e1c);}(_0x2f68,0x9a));var _0x82f6=function(_0x120477,_0x2d0d39){_0x120477=_0x120477-0x0;var _0x1ec058=_0x2f68[_0x120477];return _0x1ec058;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];function respondWithStatusCode(_0x442262,_0x4cc967){_0x4cc967=_0x4cc967||0xcc;return function(_0x194da7){if(_0x194da7){return _0x442262[_0x82f6('0x15')](_0x4cc967);}return _0x442262[_0x82f6('0x16')](_0x4cc967)[_0x82f6('0x17')]();};}function respondWithResult(_0x371481,_0xa00275){_0xa00275=_0xa00275||0xc8;return function(_0x115c7b){if(_0x115c7b){return _0x371481[_0x82f6('0x16')](_0xa00275)[_0x82f6('0x18')](_0x115c7b);}};}function respondWithFilteredResult(_0x55b58e,_0x389949){return function(_0x5d0827){if(_0x5d0827){var _0x249222=typeof _0x389949[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x389949[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x2326ae=_0x5d0827[_0x82f6('0x1c')];var _0xcbc95f=_0x249222?0x0:_0x389949[_0x82f6('0x19')];var _0x2bfd57=_0x249222?_0x5d0827[_0x82f6('0x1c')]:_0x389949[_0x82f6('0x19')]+_0x389949[_0x82f6('0x1b')];var _0x4fe226;if(_0x2bfd57>=_0x2326ae){_0x2bfd57=_0x2326ae;_0x4fe226=0xc8;}else{_0x4fe226=0xce;}_0x55b58e[_0x82f6('0x16')](_0x4fe226);return _0x55b58e['set'](_0x82f6('0x1d'),_0xcbc95f+'-'+_0x2bfd57+'/'+_0x2326ae)[_0x82f6('0x18')](_0x5d0827);}return null;};}function patchUpdates(_0x55cbce){return function(_0x2b03ad){try{jsonpatch[_0x82f6('0x1e')](_0x2b03ad,_0x55cbce,!![]);}catch(_0x46713a){return BPromise[_0x82f6('0x1f')](_0x46713a);}return _0x2b03ad['save']();};}function saveUpdates(_0xdc4dea,_0x4beccf){return function(_0x8668bb){if(_0x8668bb){return _0x8668bb[_0x82f6('0x20')](_0xdc4dea)['then'](function(_0x516deb){return _0x516deb;});}return null;};}function removeEntity(_0x3af5f7,_0x1d96d5){return function(_0x4c57c5){if(_0x4c57c5){return _0x4c57c5['destroy']()[_0x82f6('0x21')](function(){var _0x31face=_0x4c57c5['get']({'plain':!![]});var _0xfd8b68=_0x82f6('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd8b68,'resourceId':_0x31face['id']}})[_0x82f6('0x21')](function(){return _0x4c57c5;});})['then'](function(){_0x3af5f7[_0x82f6('0x16')](0xcc)[_0x82f6('0x17')]();});}};}function handleEntityNotFound(_0x54ce11,_0x3795ef){return function(_0x15c9b7){if(!_0x15c9b7){_0x54ce11[_0x82f6('0x15')](0x194);}return _0x15c9b7;};}function handleError(_0x1125a0,_0x4f9fa4){_0x4f9fa4=_0x4f9fa4||0x1f4;return function(_0x40a071){logger[_0x82f6('0x23')](_0x40a071[_0x82f6('0x24')]);if(_0x40a071[_0x82f6('0x25')]){delete _0x40a071[_0x82f6('0x25')];}_0x1125a0[_0x82f6('0x16')](_0x4f9fa4)[_0x82f6('0x26')](_0x40a071);};}exports[_0x82f6('0x27')]=function(_0x1e1aa4,_0x402449){var _0x3c9419={},_0x20d1c5={},_0x6ce179={'count':0x0,'rows':[]};var _0x91117b=_['map'](db[_0x82f6('0x28')][_0x82f6('0x29')],function(_0x418f34){return{'name':_0x418f34['fieldName'],'type':_0x418f34[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x20d1c5[_0x82f6('0x2c')]=_[_0x82f6('0x2d')](_0x91117b,_0x82f6('0x25'));_0x20d1c5[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x1e1aa4[_0x82f6('0x2e')]);_0x20d1c5[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x20d1c5[_0x82f6('0x2c')],_0x20d1c5[_0x82f6('0x2e')]);_0x3c9419[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x20d1c5['model'],qs[_0x82f6('0x33')](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x3c9419[_0x82f6('0x32')]=_0x3c9419[_0x82f6('0x32')][_0x82f6('0x34')]?_0x3c9419[_0x82f6('0x32')]:_0x20d1c5[_0x82f6('0x2c')];if(!_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x3c9419[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1e1aa4[_0x82f6('0x2e')]['limit']);_0x3c9419[_0x82f6('0x19')]=qs['offset'](_0x1e1aa4['query'][_0x82f6('0x19')]);}_0x3c9419[_0x82f6('0x37')]=qs['sort'](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x3c9419[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x3a')](_0x1e1aa4['query'],_0x20d1c5[_0x82f6('0x30')]),_0x91117b);if(_0x1e1aa4['query'][_0x82f6('0x3b')]){_0x3c9419['where']=_[_0x82f6('0x3c')](_0x3c9419[_0x82f6('0x39')],{'$or':_['map'](_0x91117b,function(_0xfce1dd){if(_0xfce1dd[_0x82f6('0x2a')]!==_0x82f6('0x3d')){var _0x43dcd1={};_0x43dcd1[_0xfce1dd['name']]={'$like':'%'+_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0x43dcd1;}})});}_0x3c9419=_[_0x82f6('0x3c')]({},_0x3c9419,_0x1e1aa4[_0x82f6('0x3e')]);var _0x55ecd4={'where':_0x3c9419[_0x82f6('0x39')]};return db[_0x82f6('0x28')]['count'](_0x55ecd4)[_0x82f6('0x21')](function(_0x699803){_0x6ce179[_0x82f6('0x1c')]=_0x699803;if(_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3f')]){_0x3c9419['include']=[{'all':!![]}];}return db[_0x82f6('0x28')]['findAll'](_0x3c9419);})[_0x82f6('0x21')](function(_0x38e82d){_0x6ce179[_0x82f6('0x40')]=_0x38e82d;return _0x6ce179;})[_0x82f6('0x21')](respondWithFilteredResult(_0x402449,_0x3c9419))[_0x82f6('0x41')](handleError(_0x402449,null));};exports[_0x82f6('0x42')]=function(_0x43fefc,_0x47a0d1){var _0x165493={'raw':!![],'where':{'id':_0x43fefc[_0x82f6('0x43')]['id']}},_0x297cda={};_0x297cda[_0x82f6('0x2c')]=_['keys'](db[_0x82f6('0x28')]['rawAttributes']);_0x297cda[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x43fefc[_0x82f6('0x2e')]);_0x297cda[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],_0x297cda['query']);_0x165493[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],qs[_0x82f6('0x33')](_0x43fefc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x165493[_0x82f6('0x32')]=_0x165493[_0x82f6('0x32')]['length']?_0x165493[_0x82f6('0x32')]:_0x297cda[_0x82f6('0x2c')];if(_0x43fefc['query'][_0x82f6('0x3f')]){_0x165493['include']=[{'all':!![]}];}_0x165493=_[_0x82f6('0x3c')]({},_0x165493,_0x43fefc['options']);return db[_0x82f6('0x28')][_0x82f6('0x44')](_0x165493)[_0x82f6('0x21')](handleEntityNotFound(_0x47a0d1,null))[_0x82f6('0x21')](respondWithResult(_0x47a0d1,null))[_0x82f6('0x41')](handleError(_0x47a0d1,null));};exports[_0x82f6('0x45')]=function(_0x53f7d4,_0x3cb1f0){return db[_0x82f6('0x28')]['create'](_0x53f7d4['body'],{})[_0x82f6('0x21')](function(_0x2a6366){var _0x2c2b64=_0x53f7d4['user'][_0x82f6('0x46')]({'plain':!![]});if(!_0x2c2b64)throw new Error(_0x82f6('0x47'));if(_0x2c2b64[_0x82f6('0x48')]===_0x82f6('0x49')){var _0x4e9e13=_0x2a6366['get']({'plain':!![]});var _0x1695ea=_0x82f6('0x22');return db[_0x82f6('0x4a')]['find']({'where':{'name':_0x1695ea,'userProfileId':_0x2c2b64[_0x82f6('0x4b')]},'raw':!![]})[_0x82f6('0x21')](function(_0x4bc646){if(_0x4bc646&&_0x4bc646['autoAssociation']===0x0){return db['UserProfileResource'][_0x82f6('0x45')]({'name':_0x4e9e13['name'],'resourceId':_0x4e9e13['id'],'type':_0x4bc646[_0x82f6('0x25')],'sectionId':_0x4bc646['id']},{})['then'](function(){return _0x2a6366;});}else{return _0x2a6366;}})[_0x82f6('0x41')](function(_0x4f69de){logger[_0x82f6('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f69de);throw _0x4f69de;});}return _0x2a6366;})[_0x82f6('0x21')](respondWithResult(_0x3cb1f0,0xc9))[_0x82f6('0x41')](handleError(_0x3cb1f0,null));};exports[_0x82f6('0x20')]=function(_0x1633cf,_0xb8d7d8){if(_0x1633cf[_0x82f6('0x4c')]['id']){delete _0x1633cf['body']['id'];}return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x1633cf[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0xb8d7d8,null))['then'](saveUpdates(_0x1633cf[_0x82f6('0x4c')],null))[_0x82f6('0x21')](respondWithResult(_0xb8d7d8,null))[_0x82f6('0x41')](handleError(_0xb8d7d8,null));};exports[_0x82f6('0x4d')]=function(_0x49a204,_0x2c1c0e){return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x49a204['params']['id']}})['then'](handleEntityNotFound(_0x2c1c0e,null))['then'](removeEntity(_0x2c1c0e,null))[_0x82f6('0x41')](handleError(_0x2c1c0e,null));};exports[_0x82f6('0x4e')]=function(_0x221cfc,_0x59176d,_0x4013f0){return db[_0x82f6('0x28')][_0x82f6('0x4f')]({'where':{'id':_0x221cfc[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0x59176d,null))[_0x82f6('0x21')](function(_0x94aed4){var _0x12a5b9;var _0x33591b={},_0x4a8bdb={};_0x4a8bdb['model']=_[_0x82f6('0x2f')](db[_0x82f6('0x50')]['rawAttributes']);_0x4a8bdb[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x221cfc[_0x82f6('0x2e')]);_0x4a8bdb['filters']=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],_0x4a8bdb[_0x82f6('0x2e')]);_0x33591b[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],qs['fields'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x33591b[_0x82f6('0x32')]=_0x33591b[_0x82f6('0x32')][_0x82f6('0x34')]?_0x33591b['attributes']:_0x4a8bdb[_0x82f6('0x2c')];if(!_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x33591b[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x1b')]);_0x33591b['offset']=qs[_0x82f6('0x19')](_0x221cfc['query'][_0x82f6('0x19')]);}_0x33591b[_0x82f6('0x37')]=qs['sort'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x33591b[_0x82f6('0x39')]=qs['filters'](_['pick'](_0x221cfc[_0x82f6('0x2e')],_0x4a8bdb[_0x82f6('0x30')]));if(_0x221cfc['query']['filter']){_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'$or':_[_0x82f6('0x2d')](_0x33591b[_0x82f6('0x32')],function(_0x11581c){var _0xc1d784={};_0xc1d784[_0x11581c]={'$like':'%'+_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0xc1d784;})});}_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'mailboxuser':_0x94aed4['mailbox']});_0x33591b=_[_0x82f6('0x3c')]({},_0x33591b,_0x221cfc[_0x82f6('0x3e')]);return db[_0x82f6('0x50')][_0x82f6('0x51')](_0x33591b)[_0x82f6('0x21')](respondWithFilteredResult(_0x59176d,_0x33591b));})['catch'](handleError(_0x59176d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0103418..d1e3a99 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 _0x6ca6=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x405b3c,_0xa2e533){var _0x1ff5f4=function(_0x49513f){while(--_0x49513f){_0x405b3c['push'](_0x405b3c['shift']());}};_0x1ff5f4(++_0xa2e533);}(_0x6ca6,0x7e));var _0x66ca=function(_0x521a80,_0x15d681){_0x521a80=_0x521a80-0x0;var _0x11f5ca=_0x6ca6[_0x521a80];return _0x11f5ca;};'use strict';var _=require(_0x66ca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x66ca('0x1'));var rp=require(_0x66ca('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66ca('0x3'));var config=require(_0x66ca('0x4'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x18e550,_0x396e8a){return _0x18e550[_0x66ca('0x5')](_0x66ca('0x6'),attributes,{'tableName':_0x66ca('0x7'),'paranoid':![],'indexes':[{'name':_0x66ca('0x8'),'fields':[_0x66ca('0x9'),_0x66ca('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5821=['context','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5821,0x14b));var _0x1582=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5821[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1582('0x0'));var logger=require(_0x1582('0x1'))(_0x1582('0x2'));var moment=require(_0x1582('0x3'));var BPromise=require(_0x1582('0x4'));var rp=require(_0x1582('0x5'));var fs=require('fs');var path=require(_0x1582('0x6'));var rimraf=require('rimraf');var config=require(_0x1582('0x7'));var attributes=require(_0x1582('0x8'));module[_0x1582('0x9')]=function(_0x7058e4,_0x584655){return _0x7058e4['define'](_0x1582('0xa'),attributes,{'tableName':_0x1582('0xb'),'paranoid':![],'indexes':[{'name':_0x1582('0xc'),'fields':[_0x1582('0xd'),_0x1582('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f73671f..d77f3b7 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 _0x80bb=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80bb,0x176));var _0xb80b=function(_0x2ca759,_0xfb4730){_0x2ca759=_0x2ca759-0x0;var _0x205c91=_0x80bb[_0x2ca759];return _0x205c91;};'use strict';var _=require('lodash');var util=require(_0xb80b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb80b('0x1'));var fs=require('fs');var Redis=require(_0xb80b('0x2'));var db=require(_0xb80b('0x3'))['db'];var utils=require(_0xb80b('0x4'));var logger=require(_0xb80b('0x5'))(_0xb80b('0x6'));var config=require(_0xb80b('0x7'));var jayson=require(_0xb80b('0x8'));var client=jayson[_0xb80b('0x9')][_0xb80b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31bc83,_0x4c025a,_0xbb4268){return new BPromise(function(_0x37172c,_0x436e6c){return client[_0xb80b('0xb')](_0x31bc83,_0xbb4268)[_0xb80b('0xc')](function(_0x5db8e5){logger[_0xb80b('0xd')](_0xb80b('0xe'),_0x4c025a,_0xb80b('0xf'));logger[_0xb80b('0x10')](_0xb80b('0x11'),_0x4c025a,_0xb80b('0xf'),JSON[_0xb80b('0x12')](_0x5db8e5));if(_0x5db8e5[_0xb80b('0x13')]){if(_0x5db8e5[_0xb80b('0x13')]['code']===0x1f4){logger[_0xb80b('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4c025a,_0x5db8e5['error'][_0xb80b('0x14')]);return _0x436e6c(_0x5db8e5[_0xb80b('0x13')][_0xb80b('0x14')]);}logger[_0xb80b('0x13')](_0xb80b('0xe'),_0x4c025a,_0x5db8e5[_0xb80b('0x13')]['message']);return _0x37172c(_0x5db8e5[_0xb80b('0x13')][_0xb80b('0x14')]);}else{logger[_0xb80b('0xd')](_0xb80b('0xe'),_0x4c025a,_0xb80b('0xf'));_0x37172c(_0x5db8e5[_0xb80b('0x15')][_0xb80b('0x14')]);}})['catch'](function(_0x33fc13){logger['error'](_0xb80b('0xe'),_0x4c025a,_0x33fc13);_0x436e6c(_0x33fc13);});});} \ No newline at end of file +var _0x3736=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x422065,_0x5b1aa9){var _0x39eada=function(_0x1e30e9){while(--_0x1e30e9){_0x422065['push'](_0x422065['shift']());}};_0x39eada(++_0x5b1aa9);}(_0x3736,0xdd));var _0x6373=function(_0x5e80be,_0x20d699){_0x5e80be=_0x5e80be-0x0;var _0x5e8ade=_0x3736[_0x5e80be];return _0x5e8ade;};'use strict';var _=require(_0x6373('0x0'));var util=require(_0x6373('0x1'));var moment=require('moment');var BPromise=require(_0x6373('0x2'));var rs=require(_0x6373('0x3'));var fs=require('fs');var Redis=require(_0x6373('0x4'));var db=require(_0x6373('0x5'))['db'];var utils=require(_0x6373('0x6'));var logger=require(_0x6373('0x7'))(_0x6373('0x8'));var config=require('../../config/environment');var jayson=require(_0x6373('0x9'));var client=jayson[_0x6373('0xa')][_0x6373('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565ae4,_0x5b8d0a,_0x2fd8d0){return new BPromise(function(_0x3c4788,_0x25a729){return client[_0x6373('0xc')](_0x565ae4,_0x2fd8d0)['then'](function(_0x4e6b9c){logger[_0x6373('0xd')](_0x6373('0xe'),_0x5b8d0a,_0x6373('0xf'));logger[_0x6373('0x10')](_0x6373('0x11'),_0x5b8d0a,_0x6373('0xf'),JSON[_0x6373('0x12')](_0x4e6b9c));if(_0x4e6b9c[_0x6373('0x13')]){if(_0x4e6b9c[_0x6373('0x13')][_0x6373('0x14')]===0x1f4){logger['error'](_0x6373('0xe'),_0x5b8d0a,_0x4e6b9c[_0x6373('0x13')][_0x6373('0x15')]);return _0x25a729(_0x4e6b9c['error'][_0x6373('0x15')]);}logger['error'](_0x6373('0xe'),_0x5b8d0a,_0x4e6b9c['error'][_0x6373('0x15')]);return _0x3c4788(_0x4e6b9c[_0x6373('0x13')][_0x6373('0x15')]);}else{logger[_0x6373('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5b8d0a,_0x6373('0xf'));_0x3c4788(_0x4e6b9c[_0x6373('0x16')][_0x6373('0x15')]);}})[_0x6373('0x17')](function(_0x21be7a){logger[_0x6373('0x13')](_0x6373('0xe'),_0x5b8d0a,_0x21be7a);_0x25a729(_0x21be7a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index dbde9b0..d6ec6c3 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 _0x178a=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x178a,0x173));var _0xa178=function(_0x4ef499,_0x3a6f33){_0x4ef499=_0x4ef499-0x0;var _0x5c5079=_0x178a[_0x4ef499];return _0x5c5079;};'use strict';var multer=require('multer');var util=require(_0xa178('0x0'));var path=require('path');var timeout=require(_0xa178('0x1'));var express=require(_0xa178('0x2'));var router=express[_0xa178('0x3')]();var fs_extra=require(_0xa178('0x4'));var auth=require(_0xa178('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa178('0x6'));var controller=require(_0xa178('0x7'));router[_0xa178('0x8')]('/',auth[_0xa178('0x9')](),controller[_0xa178('0xa')]);router['get'](_0xa178('0xb'),auth[_0xa178('0x9')](),controller[_0xa178('0xc')]);router['get'](_0xa178('0xd'),auth[_0xa178('0x9')](),controller[_0xa178('0xe')]);router[_0xa178('0xf')]('/',auth['isAuthenticated'](),controller[_0xa178('0x10')]);router['put'](_0xa178('0xb'),auth[_0xa178('0x9')](),controller[_0xa178('0x11')]);router[_0xa178('0x12')](_0xa178('0xb'),auth[_0xa178('0x9')](),controller[_0xa178('0x13')]);module[_0xa178('0x14')]=router; \ No newline at end of file +var _0x3c21=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x302f26,_0x1ad303){var _0x2a09ef=function(_0x17f035){while(--_0x17f035){_0x302f26['push'](_0x302f26['shift']());}};_0x2a09ef(++_0x1ad303);}(_0x3c21,0x177));var _0x13c2=function(_0x24a051,_0x4e6169){_0x24a051=_0x24a051-0x0;var _0x5acb0f=_0x3c21[_0x24a051];return _0x5acb0f;};'use strict';var multer=require(_0x13c2('0x0'));var util=require(_0x13c2('0x1'));var path=require(_0x13c2('0x2'));var timeout=require(_0x13c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x13c2('0x4'));var auth=require(_0x13c2('0x5'));var interaction=require(_0x13c2('0x6'));var config=require(_0x13c2('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x13c2('0x8')]('/',auth[_0x13c2('0x9')](),controller[_0x13c2('0xa')]);router['get'](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller['show']);router[_0x13c2('0x8')](_0x13c2('0xc'),auth[_0x13c2('0x9')](),controller[_0x13c2('0xd')]);router[_0x13c2('0xe')]('/',auth[_0x13c2('0x9')](),controller[_0x13c2('0xf')]);router[_0x13c2('0x10')](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller[_0x13c2('0x11')]);router[_0x13c2('0x12')](_0x13c2('0xb'),auth[_0x13c2('0x9')](),controller[_0x13c2('0x13')]);module[_0x13c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bc6e4c8..344d0f4 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 _0x79ac=['BLOB','literal','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x4a0701,_0xed45be){var _0x5c0336=function(_0x81fb46){while(--_0x81fb46){_0x4a0701['push'](_0x4a0701['shift']());}};_0x5c0336(++_0xed45be);}(_0x79ac,0x198));var _0xc79a=function(_0x59f776,_0x15c103){_0x59f776=_0x59f776-0x0;var _0xd9f707=_0x79ac[_0x59f776];return _0xd9f707;};'use strict';var Sequelize=require(_0xc79a('0x0'));module[_0xc79a('0x1')]={'name':{'type':Sequelize[_0xc79a('0x2')],'get':function(_0x57ade3){return this[_0xc79a('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xc79a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc79a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xc79a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc79a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xc79a('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xc79a('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x1cb2=['long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','getDataValue','INTEGER','STRING','BLOB'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x1cb2,0x1e5));var _0x21cb=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x1cb2[_0x119280];return _0x481797;};'use strict';var Sequelize=require('sequelize');module[_0x21cb('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x281525){return this[_0x21cb('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x21cb('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x21cb('0x4')](_0x21cb('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x21cb('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x21cb('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 04dd109..f217655 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 _0x41c0=['map','type','key','name','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','VoiceMailMessage','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','save','update','then','error','stack','send','index'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x41c0,0x80));var _0x041c=function(_0x2a43b9,_0x2aa7ea){_0x2a43b9=_0x2a43b9-0x0;var _0x3b6c90=_0x41c0[_0x2a43b9];return _0x3b6c90;};'use strict';var emlformat=require(_0x041c('0x0'));var rimraf=require(_0x041c('0x1'));var zipdir=require(_0x041c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x041c('0x3'));var csv=require(_0x041c('0x4'));var ejs=require(_0x041c('0x5'));var fs=require('fs');var fs_extra=require(_0x041c('0x6'));var _=require('lodash');var squel=require(_0x041c('0x7'));var crypto=require(_0x041c('0x8'));var jsforce=require(_0x041c('0x9'));var deskjs=require(_0x041c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x041c('0xb'));var Papa=require('papaparse');var Redis=require(_0x041c('0xc'));var authService=require(_0x041c('0xd'));var qs=require(_0x041c('0xe'));var as=require(_0x041c('0xf'));var hardwareService=require(_0x041c('0x10'));var logger=require(_0x041c('0x11'))(_0x041c('0x12'));var utils=require(_0x041c('0x13'));var config=require(_0x041c('0x14'));var licenseUtil=require(_0x041c('0x15'));var db=require(_0x041c('0x16'))['db'];function respondWithStatusCode(_0x4bafb0,_0x482334){_0x482334=_0x482334||0xcc;return function(_0x2d81dc){if(_0x2d81dc){return _0x4bafb0[_0x041c('0x17')](_0x482334);}return _0x4bafb0['status'](_0x482334)[_0x041c('0x18')]();};}function respondWithResult(_0x387450,_0x3e29e0){_0x3e29e0=_0x3e29e0||0xc8;return function(_0x152b9e){if(_0x152b9e){return _0x387450[_0x041c('0x19')](_0x3e29e0)[_0x041c('0x1a')](_0x152b9e);}};}function respondWithFilteredResult(_0x4f4879,_0x122da7){return function(_0x4d939d){if(_0x4d939d){var _0x5412e4=typeof _0x122da7[_0x041c('0x1b')]===_0x041c('0x1c')&&typeof _0x122da7['limit']===_0x041c('0x1c');var _0x43b29b=_0x4d939d[_0x041c('0x1d')];var _0x4a933f=_0x5412e4?0x0:_0x122da7[_0x041c('0x1b')];var _0x47c7b0=_0x5412e4?_0x4d939d[_0x041c('0x1d')]:_0x122da7[_0x041c('0x1b')]+_0x122da7[_0x041c('0x1e')];var _0x3b39d2;if(_0x47c7b0>=_0x43b29b){_0x47c7b0=_0x43b29b;_0x3b39d2=0xc8;}else{_0x3b39d2=0xce;}_0x4f4879[_0x041c('0x19')](_0x3b39d2);return _0x4f4879[_0x041c('0x1f')]('Content-Range',_0x4a933f+'-'+_0x47c7b0+'/'+_0x43b29b)[_0x041c('0x1a')](_0x4d939d);}return null;};}function patchUpdates(_0x7291a1){return function(_0x8102f7){try{jsonpatch['apply'](_0x8102f7,_0x7291a1,!![]);}catch(_0x78f075){return BPromise[_0x041c('0x20')](_0x78f075);}return _0x8102f7[_0x041c('0x21')]();};}function saveUpdates(_0x30e164,_0x10e4ca){return function(_0x4cd0b9){if(_0x4cd0b9){return _0x4cd0b9[_0x041c('0x22')](_0x30e164)[_0x041c('0x23')](function(_0x29db76){return _0x29db76;});}return null;};}function removeEntity(_0x56763e,_0x4e21ed){return function(_0x3ac981){if(_0x3ac981){return _0x3ac981['destroy']()[_0x041c('0x23')](function(){_0x56763e[_0x041c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476869,_0x37a7c9){return function(_0x32d84b){if(!_0x32d84b){_0x476869[_0x041c('0x17')](0x194);}return _0x32d84b;};}function handleError(_0xdadd03,_0x3d7bc7){_0x3d7bc7=_0x3d7bc7||0x1f4;return function(_0x1b4d59){logger[_0x041c('0x24')](_0x1b4d59[_0x041c('0x25')]);if(_0x1b4d59['name']){delete _0x1b4d59['name'];}_0xdadd03['status'](_0x3d7bc7)[_0x041c('0x26')](_0x1b4d59);};}exports[_0x041c('0x27')]=function(_0x1f68d8,_0x3f9783){var _0x587d11={},_0x373f4f={},_0xff792e={'count':0x0,'rows':[]};var _0x50e905=_[_0x041c('0x28')](db['VoiceMailMessage']['rawAttributes'],function(_0x16536f){return{'name':_0x16536f['fieldName'],'type':_0x16536f[_0x041c('0x29')][_0x041c('0x2a')]};});_0x373f4f['model']=_['differenceBy'](_[_0x041c('0x28')](_0x50e905,_0x041c('0x2b')),['name']);_0x373f4f['query']=_['keys'](_0x1f68d8['query']);_0x373f4f['filters']=_[_0x041c('0x2c')](_0x373f4f['model'],_0x373f4f['query']);_0x587d11[_0x041c('0x2d')]=_['intersection'](_0x373f4f[_0x041c('0x2e')],qs[_0x041c('0x2f')](_0x1f68d8[_0x041c('0x30')][_0x041c('0x2f')]));_0x587d11[_0x041c('0x2d')]=_0x587d11[_0x041c('0x2d')][_0x041c('0x31')]?_0x587d11[_0x041c('0x2d')]:_0x373f4f['model'];if(!_0x1f68d8['query'][_0x041c('0x32')](_0x041c('0x33'))){_0x587d11[_0x041c('0x1e')]=qs[_0x041c('0x1e')](_0x1f68d8['query'][_0x041c('0x1e')]);_0x587d11[_0x041c('0x1b')]=qs[_0x041c('0x1b')](_0x1f68d8[_0x041c('0x30')]['offset']);}_0x587d11[_0x041c('0x34')]=qs[_0x041c('0x35')](_0x1f68d8[_0x041c('0x30')]['sort']);_0x587d11['where']=qs[_0x041c('0x36')](_[_0x041c('0x37')](_0x1f68d8[_0x041c('0x30')],_0x373f4f[_0x041c('0x36')]),_0x50e905);if(_0x1f68d8[_0x041c('0x30')]['filter']){_0x587d11['where']=_['merge'](_0x587d11[_0x041c('0x38')],{'$or':_[_0x041c('0x28')](_0x50e905,function(_0x2c6c39){if(_0x2c6c39[_0x041c('0x29')]!==_0x041c('0x39')){var _0x5c8458={};_0x5c8458[_0x2c6c39[_0x041c('0x2b')]]={'$like':'%'+_0x1f68d8['query'][_0x041c('0x3a')]+'%'};return _0x5c8458;}})});}_0x587d11=_[_0x041c('0x3b')]({},_0x587d11,_0x1f68d8[_0x041c('0x3c')]);var _0x5eb7e2={'where':_0x587d11[_0x041c('0x38')]};return db[_0x041c('0x3d')][_0x041c('0x1d')](_0x5eb7e2)[_0x041c('0x23')](function(_0x587c00){_0xff792e[_0x041c('0x1d')]=_0x587c00;if(_0x1f68d8[_0x041c('0x30')]['includeAll']){_0x587d11[_0x041c('0x3e')]=[{'all':!![]}];}return db[_0x041c('0x3d')][_0x041c('0x3f')](_0x587d11);})[_0x041c('0x23')](function(_0x1a0140){_0xff792e[_0x041c('0x40')]=_0x1a0140;return _0xff792e;})[_0x041c('0x23')](respondWithFilteredResult(_0x3f9783,_0x587d11))['catch'](handleError(_0x3f9783,null));};exports[_0x041c('0x41')]=function(_0x51808c,_0x271bec){var _0x2673cb={'raw':!![],'where':{'id':_0x51808c[_0x041c('0x42')]['id']}},_0x81b328={};_0x81b328[_0x041c('0x2e')]=_[_0x041c('0x43')](db[_0x041c('0x3d')][_0x041c('0x44')]);_0x81b328[_0x041c('0x30')]=_[_0x041c('0x43')](_0x51808c[_0x041c('0x30')]);_0x81b328['filters']=_[_0x041c('0x2c')](_0x81b328[_0x041c('0x2e')],_0x81b328[_0x041c('0x30')]);_0x2673cb[_0x041c('0x2d')]=_[_0x041c('0x2c')](_0x81b328[_0x041c('0x2e')],qs[_0x041c('0x2f')](_0x51808c[_0x041c('0x30')][_0x041c('0x2f')]));_0x2673cb[_0x041c('0x2d')]=_0x2673cb[_0x041c('0x2d')]['length']?_0x2673cb[_0x041c('0x2d')]:_0x81b328[_0x041c('0x2e')];if(_0x51808c['query'][_0x041c('0x45')]){_0x2673cb[_0x041c('0x3e')]=[{'all':!![]}];}_0x2673cb=_[_0x041c('0x3b')]({},_0x2673cb,_0x51808c['options']);return db[_0x041c('0x3d')][_0x041c('0x46')](_0x2673cb)['then'](handleEntityNotFound(_0x271bec,null))[_0x041c('0x23')](respondWithResult(_0x271bec,null))[_0x041c('0x47')](handleError(_0x271bec,null));};exports[_0x041c('0x48')]=function(_0x1ca89d,_0xf4d48){return db['VoiceMailMessage'][_0x041c('0x48')](_0x1ca89d['body'],{})[_0x041c('0x23')](respondWithResult(_0xf4d48,0xc9))[_0x041c('0x47')](handleError(_0xf4d48,null));};exports[_0x041c('0x22')]=function(_0x20b71d,_0x2e2d53){if(_0x20b71d[_0x041c('0x49')]['id']){delete _0x20b71d[_0x041c('0x49')]['id'];}return db[_0x041c('0x3d')][_0x041c('0x46')]({'where':{'id':_0x20b71d['params']['id']}})[_0x041c('0x23')](handleEntityNotFound(_0x2e2d53,null))[_0x041c('0x23')](saveUpdates(_0x20b71d['body'],null))['then'](respondWithResult(_0x2e2d53,null))[_0x041c('0x47')](handleError(_0x2e2d53,null));};exports['destroy']=function(_0x4f5deb,_0x1b04e0){return db['VoiceMailMessage'][_0x041c('0x46')]({'where':{'id':_0x4f5deb[_0x041c('0x42')]['id']}})[_0x041c('0x23')](handleEntityNotFound(_0x1b04e0,null))['then'](removeEntity(_0x1b04e0,null))[_0x041c('0x47')](handleError(_0x1b04e0,null));};exports[_0x041c('0x4a')]=function(_0x575671,_0x2e2e3c,_0x6dd668){return db[_0x041c('0x3d')][_0x041c('0x46')]({'where':{'id':_0x575671[_0x041c('0x42')]['id']},'attributes':['id',_0x041c('0x4b'),'msg_id']})[_0x041c('0x23')](handleEntityNotFound(_0x2e2e3c,null))[_0x041c('0x23')](function(_0xf5a73d){if(_0xf5a73d){if(!_0xf5a73d[_0x041c('0x4b')]){throw new db[(_0x041c('0x4c'))][(_0x041c('0x4d'))](_0x041c('0x4e'));}var _0x286510={'Content-Type':_0x041c('0x4f'),'Content-Disposition':'attachment'};if(_0xf5a73d[_0x041c('0x50')]){_0x286510[_0x041c('0x51')]=_0x041c('0x52')+_0xf5a73d[_0x041c('0x50')]+_0x041c('0x53');}_0x2e2e3c[_0x041c('0x1f')](_0x286510);return _0x2e2e3c[_0x041c('0x26')](new Buffer(_0xf5a73d[_0x041c('0x4b')]));}})[_0x041c('0x47')](handleError(_0x2e2e3c,null));}; \ No newline at end of file +var _0x7dfa=['type','key','model','query','keys','intersection','attributes','fields','length','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMailMessage','findAll','rows','catch','show','params','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x350fd7,_0x57eb45){var _0x10be78=function(_0x38e630){while(--_0x38e630){_0x350fd7['push'](_0x350fd7['shift']());}};_0x10be78(++_0x57eb45);}(_0x7dfa,0x176));var _0xa7df=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x7dfa[_0xfedc72];return _0x2c7c78;};'use strict';var emlformat=require(_0xa7df('0x0'));var rimraf=require(_0xa7df('0x1'));var zipdir=require(_0xa7df('0x2'));var jsonpatch=require(_0xa7df('0x3'));var rp=require(_0xa7df('0x4'));var moment=require(_0xa7df('0x5'));var BPromise=require(_0xa7df('0x6'));var Mustache=require(_0xa7df('0x7'));var util=require(_0xa7df('0x8'));var path=require('path');var sox=require(_0xa7df('0x9'));var csv=require(_0xa7df('0xa'));var ejs=require(_0xa7df('0xb'));var fs=require('fs');var fs_extra=require(_0xa7df('0xc'));var _=require(_0xa7df('0xd'));var squel=require('squel');var crypto=require(_0xa7df('0xe'));var jsforce=require(_0xa7df('0xf'));var deskjs=require(_0xa7df('0x10'));var toCsv=require(_0xa7df('0xa'));var querystring=require('querystring');var Papa=require(_0xa7df('0x11'));var Redis=require('ioredis');var authService=require(_0xa7df('0x12'));var qs=require(_0xa7df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7df('0x14'));var logger=require(_0xa7df('0x15'))(_0xa7df('0x16'));var utils=require(_0xa7df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa7df('0x18'));var db=require(_0xa7df('0x19'))['db'];function respondWithStatusCode(_0x3b7f1f,_0x1c4dcf){_0x1c4dcf=_0x1c4dcf||0xcc;return function(_0x3fe048){if(_0x3fe048){return _0x3b7f1f[_0xa7df('0x1a')](_0x1c4dcf);}return _0x3b7f1f[_0xa7df('0x1b')](_0x1c4dcf)[_0xa7df('0x1c')]();};}function respondWithResult(_0x3004da,_0x424120){_0x424120=_0x424120||0xc8;return function(_0xd11990){if(_0xd11990){return _0x3004da['status'](_0x424120)[_0xa7df('0x1d')](_0xd11990);}};}function respondWithFilteredResult(_0x1c8298,_0xd9546b){return function(_0x5a1e8f){if(_0x5a1e8f){var _0x123cae=typeof _0xd9546b[_0xa7df('0x1e')]===_0xa7df('0x1f')&&typeof _0xd9546b['limit']===_0xa7df('0x1f');var _0x38a697=_0x5a1e8f[_0xa7df('0x20')];var _0xd154c9=_0x123cae?0x0:_0xd9546b[_0xa7df('0x1e')];var _0x46ea3f=_0x123cae?_0x5a1e8f[_0xa7df('0x20')]:_0xd9546b[_0xa7df('0x1e')]+_0xd9546b['limit'];var _0x32e518;if(_0x46ea3f>=_0x38a697){_0x46ea3f=_0x38a697;_0x32e518=0xc8;}else{_0x32e518=0xce;}_0x1c8298[_0xa7df('0x1b')](_0x32e518);return _0x1c8298[_0xa7df('0x21')]('Content-Range',_0xd154c9+'-'+_0x46ea3f+'/'+_0x38a697)[_0xa7df('0x1d')](_0x5a1e8f);}return null;};}function patchUpdates(_0x210c28){return function(_0x49cb5a){try{jsonpatch[_0xa7df('0x22')](_0x49cb5a,_0x210c28,!![]);}catch(_0x22ca57){return BPromise[_0xa7df('0x23')](_0x22ca57);}return _0x49cb5a['save']();};}function saveUpdates(_0x385fdb,_0x54380f){return function(_0x46b619){if(_0x46b619){return _0x46b619[_0xa7df('0x24')](_0x385fdb)[_0xa7df('0x25')](function(_0x26c905){return _0x26c905;});}return null;};}function removeEntity(_0x458ede,_0x59b223){return function(_0x4118af){if(_0x4118af){return _0x4118af[_0xa7df('0x26')]()[_0xa7df('0x25')](function(){_0x458ede['status'](0xcc)[_0xa7df('0x1c')]();});}};}function handleEntityNotFound(_0x35b06,_0x4131fe){return function(_0x443a9e){if(!_0x443a9e){_0x35b06[_0xa7df('0x1a')](0x194);}return _0x443a9e;};}function handleError(_0x53076d,_0x1eb91c){_0x1eb91c=_0x1eb91c||0x1f4;return function(_0x18c9f7){logger[_0xa7df('0x27')](_0x18c9f7[_0xa7df('0x28')]);if(_0x18c9f7[_0xa7df('0x29')]){delete _0x18c9f7[_0xa7df('0x29')];}_0x53076d[_0xa7df('0x1b')](_0x1eb91c)[_0xa7df('0x2a')](_0x18c9f7);};}exports[_0xa7df('0x2b')]=function(_0x2b1ad6,_0x49b32d){var _0x359708={},_0x5b2db9={},_0x2fcc9d={'count':0x0,'rows':[]};var _0x2a6e4b=_[_0xa7df('0x2c')](db['VoiceMailMessage'][_0xa7df('0x2d')],function(_0x47b2cb){return{'name':_0x47b2cb['fieldName'],'type':_0x47b2cb[_0xa7df('0x2e')][_0xa7df('0x2f')]};});_0x5b2db9[_0xa7df('0x30')]=_['differenceBy'](_['map'](_0x2a6e4b,'name'),['name']);_0x5b2db9[_0xa7df('0x31')]=_[_0xa7df('0x32')](_0x2b1ad6['query']);_0x5b2db9['filters']=_[_0xa7df('0x33')](_0x5b2db9['model'],_0x5b2db9[_0xa7df('0x31')]);_0x359708[_0xa7df('0x34')]=_[_0xa7df('0x33')](_0x5b2db9[_0xa7df('0x30')],qs[_0xa7df('0x35')](_0x2b1ad6['query'][_0xa7df('0x35')]));_0x359708[_0xa7df('0x34')]=_0x359708[_0xa7df('0x34')][_0xa7df('0x36')]?_0x359708['attributes']:_0x5b2db9[_0xa7df('0x30')];if(!_0x2b1ad6[_0xa7df('0x31')]['hasOwnProperty']('nolimit')){_0x359708['limit']=qs[_0xa7df('0x37')](_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x37')]);_0x359708['offset']=qs[_0xa7df('0x1e')](_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x1e')]);}_0x359708[_0xa7df('0x38')]=qs['sort'](_0x2b1ad6['query'][_0xa7df('0x39')]);_0x359708[_0xa7df('0x3a')]=qs[_0xa7df('0x3b')](_[_0xa7df('0x3c')](_0x2b1ad6[_0xa7df('0x31')],_0x5b2db9[_0xa7df('0x3b')]),_0x2a6e4b);if(_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x3d')]){_0x359708[_0xa7df('0x3a')]=_[_0xa7df('0x3e')](_0x359708[_0xa7df('0x3a')],{'$or':_[_0xa7df('0x2c')](_0x2a6e4b,function(_0x35b338){if(_0x35b338[_0xa7df('0x2e')]!==_0xa7df('0x3f')){var _0x5166d3={};_0x5166d3[_0x35b338[_0xa7df('0x29')]]={'$like':'%'+_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x3d')]+'%'};return _0x5166d3;}})});}_0x359708=_[_0xa7df('0x3e')]({},_0x359708,_0x2b1ad6[_0xa7df('0x40')]);var _0x588985={'where':_0x359708[_0xa7df('0x3a')]};return db['VoiceMailMessage']['count'](_0x588985)[_0xa7df('0x25')](function(_0x3d005a){_0x2fcc9d[_0xa7df('0x20')]=_0x3d005a;if(_0x2b1ad6[_0xa7df('0x31')][_0xa7df('0x41')]){_0x359708[_0xa7df('0x42')]=[{'all':!![]}];}return db[_0xa7df('0x43')][_0xa7df('0x44')](_0x359708);})[_0xa7df('0x25')](function(_0x2d4f9e){_0x2fcc9d[_0xa7df('0x45')]=_0x2d4f9e;return _0x2fcc9d;})[_0xa7df('0x25')](respondWithFilteredResult(_0x49b32d,_0x359708))[_0xa7df('0x46')](handleError(_0x49b32d,null));};exports[_0xa7df('0x47')]=function(_0x59af09,_0x1edc5c){var _0x4e43ab={'raw':!![],'where':{'id':_0x59af09[_0xa7df('0x48')]['id']}},_0x91e28={};_0x91e28[_0xa7df('0x30')]=_['keys'](db['VoiceMailMessage'][_0xa7df('0x2d')]);_0x91e28[_0xa7df('0x31')]=_[_0xa7df('0x32')](_0x59af09[_0xa7df('0x31')]);_0x91e28[_0xa7df('0x3b')]=_[_0xa7df('0x33')](_0x91e28['model'],_0x91e28[_0xa7df('0x31')]);_0x4e43ab[_0xa7df('0x34')]=_[_0xa7df('0x33')](_0x91e28['model'],qs[_0xa7df('0x35')](_0x59af09[_0xa7df('0x31')][_0xa7df('0x35')]));_0x4e43ab[_0xa7df('0x34')]=_0x4e43ab[_0xa7df('0x34')][_0xa7df('0x36')]?_0x4e43ab['attributes']:_0x91e28[_0xa7df('0x30')];if(_0x59af09[_0xa7df('0x31')][_0xa7df('0x41')]){_0x4e43ab[_0xa7df('0x42')]=[{'all':!![]}];}_0x4e43ab=_[_0xa7df('0x3e')]({},_0x4e43ab,_0x59af09[_0xa7df('0x40')]);return db[_0xa7df('0x43')][_0xa7df('0x49')](_0x4e43ab)[_0xa7df('0x25')](handleEntityNotFound(_0x1edc5c,null))[_0xa7df('0x25')](respondWithResult(_0x1edc5c,null))[_0xa7df('0x46')](handleError(_0x1edc5c,null));};exports[_0xa7df('0x4a')]=function(_0x10d276,_0x517bb9){return db[_0xa7df('0x43')]['create'](_0x10d276['body'],{})[_0xa7df('0x25')](respondWithResult(_0x517bb9,0xc9))[_0xa7df('0x46')](handleError(_0x517bb9,null));};exports[_0xa7df('0x24')]=function(_0x50e093,_0x26e7a0){if(_0x50e093['body']['id']){delete _0x50e093[_0xa7df('0x4b')]['id'];}return db[_0xa7df('0x43')][_0xa7df('0x49')]({'where':{'id':_0x50e093['params']['id']}})[_0xa7df('0x25')](handleEntityNotFound(_0x26e7a0,null))[_0xa7df('0x25')](saveUpdates(_0x50e093[_0xa7df('0x4b')],null))[_0xa7df('0x25')](respondWithResult(_0x26e7a0,null))[_0xa7df('0x46')](handleError(_0x26e7a0,null));};exports['destroy']=function(_0x2b7b16,_0x3e72f0){return db[_0xa7df('0x43')]['find']({'where':{'id':_0x2b7b16[_0xa7df('0x48')]['id']}})[_0xa7df('0x25')](handleEntityNotFound(_0x3e72f0,null))[_0xa7df('0x25')](removeEntity(_0x3e72f0,null))[_0xa7df('0x46')](handleError(_0x3e72f0,null));};exports[_0xa7df('0x4c')]=function(_0x20f0a7,_0x1225b1,_0x15de9a){return db[_0xa7df('0x43')][_0xa7df('0x49')]({'where':{'id':_0x20f0a7[_0xa7df('0x48')]['id']},'attributes':['id','recording',_0xa7df('0x4d')]})[_0xa7df('0x25')](handleEntityNotFound(_0x1225b1,null))[_0xa7df('0x25')](function(_0x259176){if(_0x259176){if(!_0x259176[_0xa7df('0x4e')]){throw new db['Sequelize'][(_0xa7df('0x4f'))](_0xa7df('0x50'));}var _0x144789={'Content-Type':'audio/wav','Content-Disposition':_0xa7df('0x51')};if(_0x259176[_0xa7df('0x4d')]){_0x144789['Content-Disposition']=_0xa7df('0x52')+_0x259176[_0xa7df('0x4d')]+_0xa7df('0x53');}_0x1225b1[_0xa7df('0x21')](_0x144789);return _0x1225b1[_0xa7df('0x2a')](new Buffer(_0x259176['recording']));}})[_0xa7df('0x46')](handleError(_0x1225b1,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c576f3d..b2ad77d 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 _0x1a7d=['exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path','rimraf','./voiceMailMessage.attributes'];(function(_0x30bfb9,_0x530a63){var _0x1cc7f1=function(_0x1ad572){while(--_0x1ad572){_0x30bfb9['push'](_0x30bfb9['shift']());}};_0x1cc7f1(++_0x530a63);}(_0x1a7d,0x1a8));var _0xd1a7=function(_0x41dd96,_0x52a659){_0x41dd96=_0x41dd96-0x0;var _0x5b9bdf=_0x1a7d[_0x41dd96];return _0x5b9bdf;};'use strict';var _=require(_0xd1a7('0x0'));var util=require(_0xd1a7('0x1'));var logger=require('../../config/logger')(_0xd1a7('0x2'));var moment=require(_0xd1a7('0x3'));var BPromise=require(_0xd1a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1a7('0x5'));var rimraf=require(_0xd1a7('0x6'));var config=require('../../config/environment');var attributes=require(_0xd1a7('0x7'));module[_0xd1a7('0x8')]=function(_0x549789,_0x5728fd){return _0x549789['define'](_0xd1a7('0x9'),attributes,{'tableName':_0xd1a7('0xa'),'paranoid':![],'indexes':[{'name':_0xd1a7('0xb'),'fields':[_0xd1a7('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6895=['../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5e801a,_0x51bdab){var _0x70d9bf=function(_0x58d8a6){while(--_0x58d8a6){_0x5e801a['push'](_0x5e801a['shift']());}};_0x70d9bf(++_0x51bdab);}(_0x6895,0x158));var _0x5689=function(_0xd3617f,_0x1f8b09){_0xd3617f=_0xd3617f-0x0;var _0x4358db=_0x6895[_0xd3617f];return _0x4358db;};'use strict';var _=require(_0x5689('0x0'));var util=require(_0x5689('0x1'));var logger=require('../../config/logger')(_0x5689('0x2'));var moment=require('moment');var BPromise=require(_0x5689('0x3'));var rp=require(_0x5689('0x4'));var fs=require('fs');var path=require(_0x5689('0x5'));var rimraf=require(_0x5689('0x6'));var config=require(_0x5689('0x7'));var attributes=require(_0x5689('0x8'));module[_0x5689('0x9')]=function(_0x4ccf9a,_0x268c68){return _0x4ccf9a[_0x5689('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x5689('0xb'),'paranoid':![],'indexes':[{'name':_0x5689('0xc'),'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 2255e96..a8679f9 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 _0xea75=['stringify','error','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x51ced3,_0x2f0f1a){var _0x356845=function(_0x3ec632){while(--_0x3ec632){_0x51ced3['push'](_0x51ced3['shift']());}};_0x356845(++_0x2f0f1a);}(_0xea75,0x82));var _0x5ea7=function(_0x233e16,_0x9746c5){_0x233e16=_0x233e16-0x0;var _0x4d7755=_0xea75[_0x233e16];return _0x4d7755;};'use strict';var _=require(_0x5ea7('0x0'));var util=require(_0x5ea7('0x1'));var moment=require(_0x5ea7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ea7('0x3'))['db'];var utils=require(_0x5ea7('0x4'));var logger=require(_0x5ea7('0x5'))(_0x5ea7('0x6'));var config=require(_0x5ea7('0x7'));var jayson=require(_0x5ea7('0x8'));var client=jayson[_0x5ea7('0x9')][_0x5ea7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c05a0,_0x49eb7e,_0x174602){return new BPromise(function(_0x158495,_0x26e904){return client['request'](_0x4c05a0,_0x174602)[_0x5ea7('0xb')](function(_0x1ec6bb){logger[_0x5ea7('0xc')](_0x5ea7('0xd'),_0x49eb7e,_0x5ea7('0xe'));logger[_0x5ea7('0xf')](_0x5ea7('0x10'),_0x49eb7e,_0x5ea7('0xe'),JSON[_0x5ea7('0x11')](_0x1ec6bb));if(_0x1ec6bb[_0x5ea7('0x12')]){if(_0x1ec6bb['error']['code']===0x1f4){logger[_0x5ea7('0x12')](_0x5ea7('0xd'),_0x49eb7e,_0x1ec6bb[_0x5ea7('0x12')][_0x5ea7('0x13')]);return _0x26e904(_0x1ec6bb['error'][_0x5ea7('0x13')]);}logger[_0x5ea7('0x12')](_0x5ea7('0xd'),_0x49eb7e,_0x1ec6bb[_0x5ea7('0x12')][_0x5ea7('0x13')]);return _0x158495(_0x1ec6bb[_0x5ea7('0x12')][_0x5ea7('0x13')]);}else{logger[_0x5ea7('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x49eb7e,_0x5ea7('0xe'));_0x158495(_0x1ec6bb[_0x5ea7('0x14')][_0x5ea7('0x13')]);}})['catch'](function(_0x2d5674){logger[_0x5ea7('0x12')](_0x5ea7('0xd'),_0x49eb7e,_0x2d5674);_0x26e904(_0x2d5674);});});} \ No newline at end of file +var _0x76a5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x525513,_0x44220c){var _0x17f77f=function(_0x28473e){while(--_0x28473e){_0x525513['push'](_0x525513['shift']());}};_0x17f77f(++_0x44220c);}(_0x76a5,0xa7));var _0x576a=function(_0x36fe46,_0x40010c){_0x36fe46=_0x36fe46-0x0;var _0x4d2e9c=_0x76a5[_0x36fe46];return _0x4d2e9c;};'use strict';var _=require(_0x576a('0x0'));var util=require(_0x576a('0x1'));var moment=require(_0x576a('0x2'));var BPromise=require(_0x576a('0x3'));var rs=require(_0x576a('0x4'));var fs=require('fs');var Redis=require(_0x576a('0x5'));var db=require(_0x576a('0x6'))['db'];var utils=require(_0x576a('0x7'));var logger=require(_0x576a('0x8'))(_0x576a('0x9'));var config=require(_0x576a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x576a('0xb')][_0x576a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455ab5,_0x28156d,_0x414e7b){return new BPromise(function(_0x7bbecf,_0x515cc2){return client[_0x576a('0xd')](_0x455ab5,_0x414e7b)[_0x576a('0xe')](function(_0x3f0412){logger[_0x576a('0xf')](_0x576a('0x10'),_0x28156d,'request\x20sent');logger[_0x576a('0x11')](_0x576a('0x12'),_0x28156d,_0x576a('0x13'),JSON[_0x576a('0x14')](_0x3f0412));if(_0x3f0412[_0x576a('0x15')]){if(_0x3f0412[_0x576a('0x15')]['code']===0x1f4){logger[_0x576a('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x3f0412[_0x576a('0x15')][_0x576a('0x16')]);return _0x515cc2(_0x3f0412[_0x576a('0x15')][_0x576a('0x16')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x3f0412[_0x576a('0x15')]['message']);return _0x7bbecf(_0x3f0412['error'][_0x576a('0x16')]);}else{logger[_0x576a('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x28156d,_0x576a('0x13'));_0x7bbecf(_0x3f0412[_0x576a('0x17')][_0x576a('0x16')]);}})['catch'](function(_0x3ccbed){logger['error'](_0x576a('0x10'),_0x28156d,_0x3ccbed);_0x515cc2(_0x3ccbed);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c73c458..e3351ff 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 _0xbe64=['express','Router','fs-extra','../../components/interaction/service','index','get','/:id','show','/:id/sounds','getSounds','post','isAuthenticated','create','addSound','put','update','delete','exports','multer','connect-timeout'];(function(_0x98eb0f,_0x2237cb){var _0x3fbff4=function(_0xb30d37){while(--_0xb30d37){_0x98eb0f['push'](_0x98eb0f['shift']());}};_0x3fbff4(++_0x2237cb);}(_0xbe64,0x1b6));var _0x4be6=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xbe64[_0x39cf70];return _0x580424;};'use strict';var multer=require(_0x4be6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4be6('0x1'));var express=require(_0x4be6('0x2'));var router=express[_0x4be6('0x3')]();var fs_extra=require(_0x4be6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4be6('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4be6('0x6')]);router[_0x4be6('0x7')](_0x4be6('0x8'),auth['isAuthenticated'](),controller[_0x4be6('0x9')]);router[_0x4be6('0x7')](_0x4be6('0xa'),auth['isAuthenticated'](),controller[_0x4be6('0xb')]);router[_0x4be6('0xc')]('/',auth[_0x4be6('0xd')](),controller[_0x4be6('0xe')]);router[_0x4be6('0xc')]('/:id/sounds',auth[_0x4be6('0xd')](),controller[_0x4be6('0xf')]);router[_0x4be6('0x10')](_0x4be6('0x8'),auth['isAuthenticated'](),controller[_0x4be6('0x11')]);router['delete'](_0x4be6('0x8'),auth[_0x4be6('0xd')](),controller['destroy']);router[_0x4be6('0x12')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0x4be6('0x13')]=router; \ No newline at end of file +var _0x88be=['index','/:id','show','/:id/sounds','post','create','put','update','delete','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xee7e34,_0xff9a){var _0x3258c4=function(_0x2b1fbd){while(--_0x2b1fbd){_0xee7e34['push'](_0xee7e34['shift']());}};_0x3258c4(++_0xff9a);}(_0x88be,0x1af));var _0xe88b=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x88be[_0x363ef8];return _0x148822;};'use strict';var multer=require(_0xe88b('0x0'));var util=require('util');var path=require(_0xe88b('0x1'));var timeout=require(_0xe88b('0x2'));var express=require(_0xe88b('0x3'));var router=express[_0xe88b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe88b('0x5'));var interaction=require(_0xe88b('0x6'));var config=require(_0xe88b('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xe88b('0x8')]('/',auth[_0xe88b('0x9')](),controller[_0xe88b('0xa')]);router['get'](_0xe88b('0xb'),auth[_0xe88b('0x9')](),controller[_0xe88b('0xc')]);router[_0xe88b('0x8')](_0xe88b('0xd'),auth[_0xe88b('0x9')](),controller['getSounds']);router[_0xe88b('0xe')]('/',auth[_0xe88b('0x9')](),controller[_0xe88b('0xf')]);router[_0xe88b('0xe')](_0xe88b('0xd'),auth[_0xe88b('0x9')](),controller['addSound']);router[_0xe88b('0x10')]('/:id',auth[_0xe88b('0x9')](),controller[_0xe88b('0x11')]);router['delete']('/:id',auth[_0xe88b('0x9')](),controller['destroy']);router[_0xe88b('0x12')](_0xe88b('0x13'),auth[_0xe88b('0x9')](),controller[_0xe88b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 563d8d7..e22a990 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 _0x4f1d=['ENUM','mp3nb','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x5277ab,_0x227a36){var _0x161d82=function(_0x24a6eb){while(--_0x24a6eb){_0x5277ab['push'](_0x5277ab['shift']());}};_0x161d82(++_0x227a36);}(_0x4f1d,0x15c));var _0xd4f1=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x4f1d[_0x1f62c3];return _0x385c1c;};'use strict';var Sequelize=require(_0xd4f1('0x0'));module[_0xd4f1('0x1')]={'name':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':![],'unique':_0xd4f1('0x3')},'mode':{'type':Sequelize[_0xd4f1('0x4')]('custom','files',_0xd4f1('0x5'),_0xd4f1('0x6'),_0xd4f1('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xd4f1('0x8')},'directory':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':!![],'defaultValue':_0xd4f1('0x9')},'format':{'type':Sequelize[_0xd4f1('0x2')],'allowNull':!![]},'stamp':{'type':_0xd4f1('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x079d=['STRING','alpha','BOOLEAN','sequelize','name','ENUM','files','mp3nb','quietmp3','mp3'];(function(_0xa949c1,_0xcd9fd8){var _0x1dc656=function(_0x3b482a){while(--_0x3b482a){_0xa949c1['push'](_0xa949c1['shift']());}};_0x1dc656(++_0xcd9fd8);}(_0x079d,0x125));var _0xd079=function(_0x43ccfa,_0x24119c){_0x43ccfa=_0x43ccfa-0x0;var _0x2a0206=_0x079d[_0x43ccfa];return _0x2a0206;};'use strict';var Sequelize=require(_0xd079('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd079('0x1')},'mode':{'type':Sequelize[_0xd079('0x2')]('custom',_0xd079('0x3'),_0xd079('0x4'),'quietmp3nb',_0xd079('0x5'),_0xd079('0x6')),'allowNull':!![],'defaultValue':_0xd079('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd079('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd079('0x8')},'format':{'type':Sequelize[_0xd079('0x7')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xd079('0x9')],'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 77b9825..3f4a80f 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 _0x3a39=['directory','join','root','server/files/moh','create','0777','user','UserProfileSection','userProfileId','autoAssociation','error','readdirSync','unlinkSync','ValidationError','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','save_name','converted_format','Sequelize','message','removeSound','id2','getSounds','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','stack','name','send','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','sequelize','transaction','mode','files'];(function(_0x1ee4c4,_0x89a458){var _0x47733d=function(_0x113836){while(--_0x113836){_0x1ee4c4['push'](_0x1ee4c4['shift']());}};_0x47733d(++_0x89a458);}(_0x3a39,0x90));var _0x93a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3a39[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x93a3('0x0'));var rimraf=require(_0x93a3('0x1'));var zipdir=require(_0x93a3('0x2'));var jsonpatch=require(_0x93a3('0x3'));var rp=require(_0x93a3('0x4'));var moment=require(_0x93a3('0x5'));var BPromise=require(_0x93a3('0x6'));var Mustache=require(_0x93a3('0x7'));var util=require(_0x93a3('0x8'));var path=require(_0x93a3('0x9'));var sox=require(_0x93a3('0xa'));var csv=require(_0x93a3('0xb'));var ejs=require(_0x93a3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93a3('0xd'));var squel=require(_0x93a3('0xe'));var crypto=require(_0x93a3('0xf'));var jsforce=require(_0x93a3('0x10'));var deskjs=require(_0x93a3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x93a3('0x12'));var Papa=require('papaparse');var Redis=require(_0x93a3('0x13'));var authService=require(_0x93a3('0x14'));var qs=require(_0x93a3('0x15'));var as=require(_0x93a3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93a3('0x17'))(_0x93a3('0x18'));var utils=require(_0x93a3('0x19'));var config=require(_0x93a3('0x1a'));var licenseUtil=require(_0x93a3('0x1b'));var db=require(_0x93a3('0x1c'))['db'];function respondWithStatusCode(_0x29b240,_0x11d77c){_0x11d77c=_0x11d77c||0xcc;return function(_0x28d076){if(_0x28d076){return _0x29b240[_0x93a3('0x1d')](_0x11d77c);}return _0x29b240[_0x93a3('0x1e')](_0x11d77c)['end']();};}function respondWithResult(_0x5a598b,_0x33ad24){_0x33ad24=_0x33ad24||0xc8;return function(_0x158a5c){if(_0x158a5c){return _0x5a598b[_0x93a3('0x1e')](_0x33ad24)[_0x93a3('0x1f')](_0x158a5c);}};}function respondWithFilteredResult(_0x4ee25e,_0x171f5a){return function(_0x400a45){if(_0x400a45){var _0x5c41a4=typeof _0x171f5a[_0x93a3('0x20')]===_0x93a3('0x21')&&typeof _0x171f5a[_0x93a3('0x22')]===_0x93a3('0x21');var _0x5e9b2a=_0x400a45[_0x93a3('0x23')];var _0x5299a9=_0x5c41a4?0x0:_0x171f5a[_0x93a3('0x20')];var _0x2e8a62=_0x5c41a4?_0x400a45[_0x93a3('0x23')]:_0x171f5a[_0x93a3('0x20')]+_0x171f5a[_0x93a3('0x22')];var _0x253b02;if(_0x2e8a62>=_0x5e9b2a){_0x2e8a62=_0x5e9b2a;_0x253b02=0xc8;}else{_0x253b02=0xce;}_0x4ee25e['status'](_0x253b02);return _0x4ee25e[_0x93a3('0x24')](_0x93a3('0x25'),_0x5299a9+'-'+_0x2e8a62+'/'+_0x5e9b2a)[_0x93a3('0x1f')](_0x400a45);}return null;};}function patchUpdates(_0x2ca6b5){return function(_0x5c6e42){try{jsonpatch[_0x93a3('0x26')](_0x5c6e42,_0x2ca6b5,!![]);}catch(_0x28f6cd){return BPromise[_0x93a3('0x27')](_0x28f6cd);}return _0x5c6e42['save']();};}function saveUpdates(_0xd97f1c,_0x33a8e9){return function(_0x3cf09e){if(_0x3cf09e){return _0x3cf09e[_0x93a3('0x28')](_0xd97f1c)[_0x93a3('0x29')](function(_0x26ae85){return _0x26ae85;});}return null;};}function removeEntity(_0x1e8bb1,_0x29cb81){return function(_0x3498ec){if(_0x3498ec){return _0x3498ec[_0x93a3('0x2a')]()['then'](function(){var _0x1edfe0=_0x3498ec[_0x93a3('0x2b')]({'plain':!![]});var _0x43add3=_0x93a3('0x2c');return db[_0x93a3('0x2d')]['destroy']({'where':{'type':_0x43add3,'resourceId':_0x1edfe0['id']}})[_0x93a3('0x29')](function(){return _0x3498ec;});})['then'](function(){_0x1e8bb1[_0x93a3('0x1e')](0xcc)[_0x93a3('0x2e')]();});}};}function handleEntityNotFound(_0x34b28a,_0x863e75){return function(_0x13706b){if(!_0x13706b){_0x34b28a[_0x93a3('0x1d')](0x194);}return _0x13706b;};}function handleError(_0x15ca90,_0x28e53e){_0x28e53e=_0x28e53e||0x1f4;return function(_0x423a5a){logger['error'](_0x423a5a[_0x93a3('0x2f')]);if(_0x423a5a[_0x93a3('0x30')]){delete _0x423a5a[_0x93a3('0x30')];}_0x15ca90[_0x93a3('0x1e')](_0x28e53e)[_0x93a3('0x31')](_0x423a5a);};}exports['index']=function(_0x4e2b01,_0x37f19b){var _0x1166f5={},_0x521e93={},_0x241827={'count':0x0,'rows':[]};var _0x194520=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4b9c72){return{'name':_0x4b9c72['fieldName'],'type':_0x4b9c72[_0x93a3('0x32')][_0x93a3('0x33')]};});_0x521e93[_0x93a3('0x34')]=_[_0x93a3('0x35')](_0x194520,_0x93a3('0x30'));_0x521e93[_0x93a3('0x36')]=_[_0x93a3('0x37')](_0x4e2b01[_0x93a3('0x36')]);_0x521e93['filters']=_[_0x93a3('0x38')](_0x521e93[_0x93a3('0x34')],_0x521e93[_0x93a3('0x36')]);_0x1166f5[_0x93a3('0x39')]=_[_0x93a3('0x38')](_0x521e93[_0x93a3('0x34')],qs[_0x93a3('0x3a')](_0x4e2b01[_0x93a3('0x36')][_0x93a3('0x3a')]));_0x1166f5[_0x93a3('0x39')]=_0x1166f5[_0x93a3('0x39')][_0x93a3('0x3b')]?_0x1166f5[_0x93a3('0x39')]:_0x521e93[_0x93a3('0x34')];if(!_0x4e2b01[_0x93a3('0x36')][_0x93a3('0x3c')](_0x93a3('0x3d'))){_0x1166f5['limit']=qs[_0x93a3('0x22')](_0x4e2b01[_0x93a3('0x36')]['limit']);_0x1166f5['offset']=qs['offset'](_0x4e2b01['query'][_0x93a3('0x20')]);}_0x1166f5[_0x93a3('0x3e')]=qs[_0x93a3('0x3f')](_0x4e2b01[_0x93a3('0x36')][_0x93a3('0x3f')]);delete _0x4e2b01['query']['sort'];_0x1166f5[_0x93a3('0x40')]=qs[_0x93a3('0x41')](_['pick'](_0x4e2b01['query'],_0x521e93['filters']),_0x194520);if(_0x4e2b01['query'][_0x93a3('0x42')]){_0x1166f5['where']=_[_0x93a3('0x43')](_0x1166f5['where'],{'$or':_[_0x93a3('0x35')](_0x194520,function(_0x48e35e){if(_0x48e35e[_0x93a3('0x32')]!=='VIRTUAL'){var _0x3716ae={};_0x3716ae[_0x48e35e['name']]={'$like':'%'+_0x4e2b01[_0x93a3('0x36')]['filter']+'%'};return _0x3716ae;}})});}_0x1166f5=_[_0x93a3('0x43')]({},_0x1166f5,_0x4e2b01[_0x93a3('0x44')]);var _0x204f43={'where':_0x1166f5[_0x93a3('0x40')]};return db[_0x93a3('0x45')][_0x93a3('0x23')](_0x204f43)[_0x93a3('0x29')](function(_0x504f27){_0x241827[_0x93a3('0x23')]=_0x504f27;if(_0x4e2b01['query'][_0x93a3('0x46')]){_0x1166f5[_0x93a3('0x47')]=[{'all':!![]}];}return db[_0x93a3('0x45')][_0x93a3('0x48')](_0x1166f5);})[_0x93a3('0x29')](function(_0x46c038){_0x241827[_0x93a3('0x49')]=_0x46c038;return _0x241827;})[_0x93a3('0x29')](respondWithFilteredResult(_0x37f19b,_0x1166f5))['catch'](handleError(_0x37f19b,null));};exports[_0x93a3('0x4a')]=function(_0x5843bc,_0x49ff41){var _0x54d870={'raw':![],'where':{'id':_0x5843bc[_0x93a3('0x4b')]['id']}},_0x3df6fe={};_0x3df6fe[_0x93a3('0x34')]=_[_0x93a3('0x37')](db[_0x93a3('0x45')][_0x93a3('0x4c')]);_0x3df6fe[_0x93a3('0x36')]=_['keys'](_0x5843bc[_0x93a3('0x36')]);_0x3df6fe['filters']=_[_0x93a3('0x38')](_0x3df6fe[_0x93a3('0x34')],_0x3df6fe[_0x93a3('0x36')]);_0x54d870['attributes']=_[_0x93a3('0x38')](_0x3df6fe[_0x93a3('0x34')],qs['fields'](_0x5843bc[_0x93a3('0x36')][_0x93a3('0x3a')]));_0x54d870[_0x93a3('0x39')]=_0x54d870[_0x93a3('0x39')][_0x93a3('0x3b')]?_0x54d870[_0x93a3('0x39')]:_0x3df6fe[_0x93a3('0x34')];if(_0x5843bc[_0x93a3('0x36')]['includeAll']){_0x54d870[_0x93a3('0x47')]=[{'all':!![]}];}_0x54d870=_[_0x93a3('0x43')]({},_0x54d870,_0x5843bc[_0x93a3('0x44')]);return db[_0x93a3('0x45')][_0x93a3('0x4d')](_0x54d870)['then'](handleEntityNotFound(_0x49ff41,null))[_0x93a3('0x29')](respondWithResult(_0x49ff41,null))[_0x93a3('0x4e')](handleError(_0x49ff41,null));};exports[_0x93a3('0x28')]=function(_0x49f6c1,_0x51eaad){if(_0x49f6c1[_0x93a3('0x4f')]['id']){delete _0x49f6c1[_0x93a3('0x4f')]['id'];}return db[_0x93a3('0x45')][_0x93a3('0x4d')]({'where':{'id':_0x49f6c1['params']['id']}})[_0x93a3('0x29')](handleEntityNotFound(_0x51eaad,null))['then'](saveUpdates(_0x49f6c1[_0x93a3('0x4f')],null))[_0x93a3('0x29')](respondWithResult(_0x51eaad,null))[_0x93a3('0x4e')](handleError(_0x51eaad,null));};exports['create']=function(_0x50d7ff,_0x190f5d,_0x36b15c){return db[_0x93a3('0x50')][_0x93a3('0x51')](function(_0x4f9b31){if(_0x50d7ff[_0x93a3('0x4f')][_0x93a3('0x52')]===_0x93a3('0x53')){_0x50d7ff[_0x93a3('0x4f')][_0x93a3('0x54')]=path[_0x93a3('0x55')](config[_0x93a3('0x56')],_0x93a3('0x57'),_0x50d7ff[_0x93a3('0x4f')][_0x93a3('0x30')]);}return db['VoiceMusicOnHold'][_0x93a3('0x58')](_0x50d7ff[_0x93a3('0x4f')],{'transaction':_0x4f9b31})[_0x93a3('0x29')](function(_0xecafe3){if(_0x50d7ff['body'][_0x93a3('0x52')]===_0x93a3('0x53')){fs['mkdirSync'](_0xecafe3['directory'],parseInt(_0x93a3('0x59'),0x8));}var _0x2e32c1=_0x50d7ff[_0x93a3('0x5a')]['get']({'plain':!![]});if(!_0x2e32c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e32c1['role']===_0x93a3('0x5a')){var _0x1d90df=_0xecafe3[_0x93a3('0x2b')]({'plain':!![]});return db[_0x93a3('0x5b')][_0x93a3('0x4d')]({'where':{'name':_0x93a3('0x2c'),'userProfileId':_0x2e32c1[_0x93a3('0x5c')]},'raw':!![]})[_0x93a3('0x29')](function(_0x3a6a40){if(_0x3a6a40&&_0x3a6a40[_0x93a3('0x5d')]===0x0){return db[_0x93a3('0x2d')][_0x93a3('0x58')]({'name':_0x1d90df['name'],'resourceId':_0x1d90df['id'],'type':_0x3a6a40[_0x93a3('0x30')],'sectionId':_0x3a6a40['id']},{})[_0x93a3('0x29')](function(){return _0xecafe3;});}else{return _0xecafe3;}})[_0x93a3('0x4e')](function(_0x2ba723){logger[_0x93a3('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ba723);});}return _0xecafe3;});})[_0x93a3('0x29')](respondWithResult(_0x190f5d,0xc9))[_0x93a3('0x4e')](handleError(_0x190f5d,null));};exports['destroy']=function(_0x45ef58,_0x266ef3,_0xacf5af){var _0x12330e;return db[_0x93a3('0x45')][_0x93a3('0x4d')]({'where':{'id':_0x45ef58['params']['id']}})['then'](function(_0x35c196){if(_0x35c196){return db[_0x93a3('0x50')][_0x93a3('0x51')](function(_0x2a8cf6){return _0x35c196[_0x93a3('0x2a')]({'transaction':_0x2a8cf6,'raw':!![]})[_0x93a3('0x29')](function(_0x2ecdf8){if(_0x2ecdf8[_0x93a3('0x54')]){fs[_0x93a3('0x5f')](_0x2ecdf8[_0x93a3('0x54')])['forEach'](function(_0x488233){fs[_0x93a3('0x60')](path[_0x93a3('0x55')](_0x2ecdf8[_0x93a3('0x54')],_0x488233));});fs['rmdirSync'](_0x2ecdf8[_0x93a3('0x54')]);}return _0x2ecdf8;});})[_0x93a3('0x4e')](function(_0xbee433){throw new db['Sequelize'][(_0x93a3('0x61'))](_0xbee433['message']);});}})[_0x93a3('0x29')](handleEntityNotFound(_0x266ef3,null))['then'](removeEntity(_0x266ef3,null))[_0x93a3('0x4e')](handleError(_0x266ef3,null));};exports[_0x93a3('0x62')]=function(_0x5687b9,_0x1bcaec,_0x344206){return db[_0x93a3('0x50')]['transaction'](function(_0x53f863){var _0x324328;return db[_0x93a3('0x45')]['find']({'where':{'id':_0x5687b9[_0x93a3('0x4b')]['id']}})[_0x93a3('0x29')](function(_0x2df6e5){if(_0x2df6e5){_0x324328=_0x2df6e5;return _0x2df6e5[_0x93a3('0x62')](_0x5687b9[_0x93a3('0x4f')]['id'],{'transaction':_0x53f863});}})[_0x93a3('0x29')](function(_0x5cba6a){if(_0x5cba6a){return db[_0x93a3('0x63')][_0x93a3('0x64')]({'where':{'id':_0x5687b9['body']['id']},'attributes':['id',_0x93a3('0x30'),'save_name','converted_format',_0x93a3('0x65')],'raw':!![]});}})[_0x93a3('0x29')](function(_0x1c2024){if(_0x1c2024){var _0x4f6635=path[_0x93a3('0x55')](config[_0x93a3('0x56')],_0x93a3('0x66'),util[_0x93a3('0x67')](_0x93a3('0x68'),path[_0x93a3('0x69')](_0x1c2024['save_name'],path[_0x93a3('0x6a')](_0x1c2024[_0x93a3('0x6b')])),_0x1c2024[_0x93a3('0x6c')]));var _0x36f0a7=path['join'](config[_0x93a3('0x56')],_0x93a3('0x57'),_0x324328[_0x93a3('0x30')],util[_0x93a3('0x67')](_0x93a3('0x68'),_0x1c2024['name'],_0x1c2024[_0x93a3('0x6c')]));fs['symlinkSync'](_0x4f6635,_0x36f0a7);return _0x1c2024;}})[_0x93a3('0x4e')](function(_0x481289){throw new db[(_0x93a3('0x6d'))]['ValidationError'](_0x481289[_0x93a3('0x6e')]);});})['then'](handleEntityNotFound(_0x1bcaec,null))[_0x93a3('0x29')](respondWithResult(_0x1bcaec,0xc9))['catch'](handleError(_0x1bcaec,null));};exports[_0x93a3('0x6f')]=function(_0x44556a,_0x3fa56f,_0xff6b76){return db[_0x93a3('0x50')][_0x93a3('0x51')](function(_0x48be0f){var _0x51dee6;return db[_0x93a3('0x45')][_0x93a3('0x64')]({'where':{'id':_0x44556a[_0x93a3('0x4b')]['id']}})[_0x93a3('0x29')](handleEntityNotFound(_0x3fa56f,null))['then'](function(_0x130765){if(_0x130765){_0x51dee6=_0x130765;return _0x130765[_0x93a3('0x6f')](_0x44556a[_0x93a3('0x4b')][_0x93a3('0x70')]);}})['then'](function(_0x14dd0f){if(_0x14dd0f){return db[_0x93a3('0x63')][_0x93a3('0x64')]({'where':{'id':_0x44556a['params'][_0x93a3('0x70')]},'attributes':['id',_0x93a3('0x30'),'save_name',_0x93a3('0x6c'),_0x93a3('0x65')],'raw':!![]});}})[_0x93a3('0x29')](function(_0x4f02f0){if(_0x4f02f0){fs[_0x93a3('0x60')](path[_0x93a3('0x55')](_0x51dee6[_0x93a3('0x54')],util[_0x93a3('0x67')](_0x93a3('0x68'),_0x4f02f0[_0x93a3('0x30')],_0x4f02f0[_0x93a3('0x6c')])));return _0x4f02f0;}})[_0x93a3('0x4e')](function(_0x17e7d1){throw new db['Sequelize']['ValidationError'](_0x17e7d1['message']);});})['then'](handleEntityNotFound(_0x3fa56f,null))[_0x93a3('0x29')](respondWithStatusCode(_0x3fa56f,0xcc))['catch'](handleError(_0x3fa56f,null));};exports['getSounds']=function(_0x2c9138,_0x283e55,_0x204bf4){var _0x1913d0={};var _0x38eeff={};var _0x247fa0;var _0x46afbb;return db[_0x93a3('0x45')]['findOne']({'where':{'id':_0x2c9138[_0x93a3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x283e55,null))[_0x93a3('0x29')](function(_0x3890e2){if(_0x3890e2){_0x247fa0=_0x3890e2;_0x38eeff['model']=_[_0x93a3('0x37')](db[_0x93a3('0x63')]['rawAttributes']);_0x38eeff['query']=_[_0x93a3('0x37')](_0x2c9138[_0x93a3('0x36')]);_0x38eeff[_0x93a3('0x41')]=_[_0x93a3('0x38')](_0x38eeff[_0x93a3('0x34')],_0x38eeff[_0x93a3('0x36')]);_0x1913d0['attributes']=_['intersection'](_0x38eeff[_0x93a3('0x34')],qs[_0x93a3('0x3a')](_0x2c9138[_0x93a3('0x36')][_0x93a3('0x3a')]));_0x1913d0[_0x93a3('0x39')]=_0x1913d0[_0x93a3('0x39')][_0x93a3('0x3b')]?_0x1913d0[_0x93a3('0x39')]:_0x38eeff[_0x93a3('0x34')];_0x1913d0['order']=qs['sort'](_0x2c9138['query']['sort']);_0x1913d0[_0x93a3('0x40')]=qs[_0x93a3('0x41')](_['pick'](_0x2c9138['query'],_0x38eeff['filters']));if(_0x2c9138['query'][_0x93a3('0x42')]){_0x1913d0[_0x93a3('0x40')]=_[_0x93a3('0x43')](_0x1913d0[_0x93a3('0x40')],{'$or':_['map'](_0x1913d0[_0x93a3('0x39')],function(_0x5e28a9){var _0x5cf81a={};_0x5cf81a[_0x5e28a9]={'$like':'%'+_0x2c9138[_0x93a3('0x36')][_0x93a3('0x42')]+'%'};return _0x5cf81a;})});}_0x1913d0=_['merge']({},_0x1913d0,_0x2c9138['options']);return _0x247fa0[_0x93a3('0x71')](_0x1913d0);}})[_0x93a3('0x29')](function(_0xf49c50){if(_0xf49c50){_0x46afbb=_0xf49c50[_0x93a3('0x3b')];if(!_0x2c9138['query'][_0x93a3('0x3c')](_0x93a3('0x3d'))){_0x1913d0[_0x93a3('0x22')]=qs[_0x93a3('0x22')](_0x2c9138[_0x93a3('0x36')]['limit']);_0x1913d0[_0x93a3('0x20')]=qs[_0x93a3('0x20')](_0x2c9138[_0x93a3('0x36')][_0x93a3('0x20')]);}return _0x247fa0[_0x93a3('0x71')](_0x1913d0);}})[_0x93a3('0x29')](function(_0x76805b){if(_0x76805b){return _0x76805b?{'count':_0x46afbb,'rows':_0x76805b}:null;}})['then'](respondWithResult(_0x283e55,null))[_0x93a3('0x4e')](handleError(_0x283e55,null));}; \ No newline at end of file +var _0x035a=['extname','format','symlinkSync','Sequelize','findOne','removeSound','id2','%s.%s','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','catch','body','create','sequelize','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','ValidationError','message','addSound','Sound','converted_format','server/files/sounds/converted','save_name'];(function(_0x5adca1,_0x52e9d3){var _0x442afe=function(_0x32180d){while(--_0x32180d){_0x5adca1['push'](_0x5adca1['shift']());}};_0x442afe(++_0x52e9d3);}(_0x035a,0x7d));var _0xa035=function(_0x133a1e,_0x3e9a94){_0x133a1e=_0x133a1e-0x0;var _0x4bc62c=_0x035a[_0x133a1e];return _0x4bc62c;};'use strict';var emlformat=require(_0xa035('0x0'));var rimraf=require(_0xa035('0x1'));var zipdir=require(_0xa035('0x2'));var jsonpatch=require(_0xa035('0x3'));var rp=require(_0xa035('0x4'));var moment=require(_0xa035('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa035('0x6'));var util=require(_0xa035('0x7'));var path=require(_0xa035('0x8'));var sox=require(_0xa035('0x9'));var csv=require(_0xa035('0xa'));var ejs=require(_0xa035('0xb'));var fs=require('fs');var fs_extra=require(_0xa035('0xc'));var _=require(_0xa035('0xd'));var squel=require(_0xa035('0xe'));var crypto=require(_0xa035('0xf'));var jsforce=require(_0xa035('0x10'));var deskjs=require(_0xa035('0x11'));var toCsv=require(_0xa035('0xa'));var querystring=require(_0xa035('0x12'));var Papa=require(_0xa035('0x13'));var Redis=require('ioredis');var authService=require(_0xa035('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa035('0x15'));var hardwareService=require(_0xa035('0x16'));var logger=require(_0xa035('0x17'))(_0xa035('0x18'));var utils=require('../../config/utils');var config=require(_0xa035('0x19'));var licenseUtil=require(_0xa035('0x1a'));var db=require(_0xa035('0x1b'))['db'];function respondWithStatusCode(_0x3627ad,_0x5815cb){_0x5815cb=_0x5815cb||0xcc;return function(_0x3d9fa7){if(_0x3d9fa7){return _0x3627ad[_0xa035('0x1c')](_0x5815cb);}return _0x3627ad[_0xa035('0x1d')](_0x5815cb)[_0xa035('0x1e')]();};}function respondWithResult(_0x580a5e,_0x471f1b){_0x471f1b=_0x471f1b||0xc8;return function(_0x360baa){if(_0x360baa){return _0x580a5e[_0xa035('0x1d')](_0x471f1b)[_0xa035('0x1f')](_0x360baa);}};}function respondWithFilteredResult(_0x49e133,_0x3deb12){return function(_0x34fdaa){if(_0x34fdaa){var _0x2b33ac=typeof _0x3deb12[_0xa035('0x20')]===_0xa035('0x21')&&typeof _0x3deb12[_0xa035('0x22')]===_0xa035('0x21');var _0x142224=_0x34fdaa[_0xa035('0x23')];var _0xc19583=_0x2b33ac?0x0:_0x3deb12['offset'];var _0x57df0c=_0x2b33ac?_0x34fdaa['count']:_0x3deb12[_0xa035('0x20')]+_0x3deb12[_0xa035('0x22')];var _0x175eaf;if(_0x57df0c>=_0x142224){_0x57df0c=_0x142224;_0x175eaf=0xc8;}else{_0x175eaf=0xce;}_0x49e133['status'](_0x175eaf);return _0x49e133[_0xa035('0x24')](_0xa035('0x25'),_0xc19583+'-'+_0x57df0c+'/'+_0x142224)[_0xa035('0x1f')](_0x34fdaa);}return null;};}function patchUpdates(_0x434ae9){return function(_0xc4f785){try{jsonpatch[_0xa035('0x26')](_0xc4f785,_0x434ae9,!![]);}catch(_0x50c33c){return BPromise['reject'](_0x50c33c);}return _0xc4f785[_0xa035('0x27')]();};}function saveUpdates(_0x57bae3,_0x1ad430){return function(_0x4b79dd){if(_0x4b79dd){return _0x4b79dd[_0xa035('0x28')](_0x57bae3)[_0xa035('0x29')](function(_0x4e237d){return _0x4e237d;});}return null;};}function removeEntity(_0x562842,_0x54071b){return function(_0x3505fc){if(_0x3505fc){return _0x3505fc[_0xa035('0x2a')]()['then'](function(){var _0x1dd3ca=_0x3505fc[_0xa035('0x2b')]({'plain':!![]});var _0x5da2be=_0xa035('0x2c');return db[_0xa035('0x2d')][_0xa035('0x2a')]({'where':{'type':_0x5da2be,'resourceId':_0x1dd3ca['id']}})[_0xa035('0x29')](function(){return _0x3505fc;});})['then'](function(){_0x562842[_0xa035('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b833d,_0x3685b5){return function(_0x755f33){if(!_0x755f33){_0x4b833d[_0xa035('0x1c')](0x194);}return _0x755f33;};}function handleError(_0x354d50,_0x168673){_0x168673=_0x168673||0x1f4;return function(_0x5be07c){logger['error'](_0x5be07c[_0xa035('0x2e')]);if(_0x5be07c['name']){delete _0x5be07c[_0xa035('0x2f')];}_0x354d50[_0xa035('0x1d')](_0x168673)[_0xa035('0x30')](_0x5be07c);};}exports[_0xa035('0x31')]=function(_0x1935c7,_0x59f987){var _0x2e4031={},_0x268c70={},_0x4cb469={'count':0x0,'rows':[]};var _0x58d137=_['map'](db[_0xa035('0x32')][_0xa035('0x33')],function(_0x3aa4fc){return{'name':_0x3aa4fc[_0xa035('0x34')],'type':_0x3aa4fc['type']['key']};});_0x268c70[_0xa035('0x35')]=_[_0xa035('0x36')](_0x58d137,_0xa035('0x2f'));_0x268c70[_0xa035('0x37')]=_[_0xa035('0x38')](_0x1935c7['query']);_0x268c70[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x268c70[_0xa035('0x35')],_0x268c70['query']);_0x2e4031[_0xa035('0x3b')]=_['intersection'](_0x268c70['model'],qs[_0xa035('0x3c')](_0x1935c7[_0xa035('0x37')][_0xa035('0x3c')]));_0x2e4031[_0xa035('0x3b')]=_0x2e4031[_0xa035('0x3b')][_0xa035('0x3d')]?_0x2e4031['attributes']:_0x268c70[_0xa035('0x35')];if(!_0x1935c7['query'][_0xa035('0x3e')](_0xa035('0x3f'))){_0x2e4031[_0xa035('0x22')]=qs[_0xa035('0x22')](_0x1935c7[_0xa035('0x37')][_0xa035('0x22')]);_0x2e4031['offset']=qs[_0xa035('0x20')](_0x1935c7[_0xa035('0x37')]['offset']);}_0x2e4031[_0xa035('0x40')]=qs[_0xa035('0x41')](_0x1935c7[_0xa035('0x37')][_0xa035('0x41')]);delete _0x1935c7['query'][_0xa035('0x41')];_0x2e4031[_0xa035('0x42')]=qs['filters'](_[_0xa035('0x43')](_0x1935c7['query'],_0x268c70[_0xa035('0x39')]),_0x58d137);if(_0x1935c7[_0xa035('0x37')][_0xa035('0x44')]){_0x2e4031[_0xa035('0x42')]=_[_0xa035('0x45')](_0x2e4031[_0xa035('0x42')],{'$or':_[_0xa035('0x36')](_0x58d137,function(_0x303458){if(_0x303458[_0xa035('0x46')]!=='VIRTUAL'){var _0x513e29={};_0x513e29[_0x303458[_0xa035('0x2f')]]={'$like':'%'+_0x1935c7[_0xa035('0x37')]['filter']+'%'};return _0x513e29;}})});}_0x2e4031=_[_0xa035('0x45')]({},_0x2e4031,_0x1935c7[_0xa035('0x47')]);var _0x329d1f={'where':_0x2e4031[_0xa035('0x42')]};return db[_0xa035('0x32')]['count'](_0x329d1f)['then'](function(_0x41a8d7){_0x4cb469['count']=_0x41a8d7;if(_0x1935c7['query'][_0xa035('0x48')]){_0x2e4031[_0xa035('0x49')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa035('0x4a')](_0x2e4031);})[_0xa035('0x29')](function(_0x13b8be){_0x4cb469['rows']=_0x13b8be;return _0x4cb469;})[_0xa035('0x29')](respondWithFilteredResult(_0x59f987,_0x2e4031))['catch'](handleError(_0x59f987,null));};exports[_0xa035('0x4b')]=function(_0x9b2cfd,_0x59c8b1){var _0x348ecd={'raw':![],'where':{'id':_0x9b2cfd[_0xa035('0x4c')]['id']}},_0x56f002={};_0x56f002[_0xa035('0x35')]=_['keys'](db[_0xa035('0x32')][_0xa035('0x33')]);_0x56f002['query']=_['keys'](_0x9b2cfd[_0xa035('0x37')]);_0x56f002[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x56f002[_0xa035('0x35')],_0x56f002['query']);_0x348ecd[_0xa035('0x3b')]=_[_0xa035('0x3a')](_0x56f002[_0xa035('0x35')],qs[_0xa035('0x3c')](_0x9b2cfd[_0xa035('0x37')][_0xa035('0x3c')]));_0x348ecd[_0xa035('0x3b')]=_0x348ecd[_0xa035('0x3b')][_0xa035('0x3d')]?_0x348ecd[_0xa035('0x3b')]:_0x56f002[_0xa035('0x35')];if(_0x9b2cfd[_0xa035('0x37')][_0xa035('0x48')]){_0x348ecd[_0xa035('0x49')]=[{'all':!![]}];}_0x348ecd=_['merge']({},_0x348ecd,_0x9b2cfd['options']);return db['VoiceMusicOnHold']['find'](_0x348ecd)[_0xa035('0x29')](handleEntityNotFound(_0x59c8b1,null))[_0xa035('0x29')](respondWithResult(_0x59c8b1,null))[_0xa035('0x4d')](handleError(_0x59c8b1,null));};exports[_0xa035('0x28')]=function(_0xfec8d1,_0x5d4a07){if(_0xfec8d1[_0xa035('0x4e')]['id']){delete _0xfec8d1[_0xa035('0x4e')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0xfec8d1[_0xa035('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d4a07,null))[_0xa035('0x29')](saveUpdates(_0xfec8d1['body'],null))[_0xa035('0x29')](respondWithResult(_0x5d4a07,null))['catch'](handleError(_0x5d4a07,null));};exports[_0xa035('0x4f')]=function(_0x55fdbf,_0x5f1a14,_0x2c9e46){return db[_0xa035('0x50')]['transaction'](function(_0x31a52e){if(_0x55fdbf[_0xa035('0x4e')][_0xa035('0x51')]===_0xa035('0x52')){_0x55fdbf['body'][_0xa035('0x53')]=path[_0xa035('0x54')](config[_0xa035('0x55')],_0xa035('0x56'),_0x55fdbf[_0xa035('0x4e')][_0xa035('0x2f')]);}return db[_0xa035('0x32')]['create'](_0x55fdbf[_0xa035('0x4e')],{'transaction':_0x31a52e})[_0xa035('0x29')](function(_0xa9fc9){if(_0x55fdbf[_0xa035('0x4e')][_0xa035('0x51')]==='files'){fs['mkdirSync'](_0xa9fc9['directory'],parseInt(_0xa035('0x57'),0x8));}var _0x179eed=_0x55fdbf[_0xa035('0x58')][_0xa035('0x2b')]({'plain':!![]});if(!_0x179eed)throw new Error(_0xa035('0x59'));if(_0x179eed[_0xa035('0x5a')]===_0xa035('0x58')){var _0x20308e=_0xa9fc9[_0xa035('0x2b')]({'plain':!![]});return db[_0xa035('0x5b')][_0xa035('0x5c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x179eed[_0xa035('0x5d')]},'raw':!![]})[_0xa035('0x29')](function(_0x4e566a){if(_0x4e566a&&_0x4e566a[_0xa035('0x5e')]===0x0){return db[_0xa035('0x2d')]['create']({'name':_0x20308e['name'],'resourceId':_0x20308e['id'],'type':_0x4e566a[_0xa035('0x2f')],'sectionId':_0x4e566a['id']},{})['then'](function(){return _0xa9fc9;});}else{return _0xa9fc9;}})[_0xa035('0x4d')](function(_0x475baa){logger[_0xa035('0x5f')](_0xa035('0x60'),_0x475baa);});}return _0xa9fc9;});})[_0xa035('0x29')](respondWithResult(_0x5f1a14,0xc9))[_0xa035('0x4d')](handleError(_0x5f1a14,null));};exports[_0xa035('0x2a')]=function(_0x469b43,_0x2ffaa9,_0x13c428){var _0xf70cb8;return db[_0xa035('0x32')]['find']({'where':{'id':_0x469b43['params']['id']}})[_0xa035('0x29')](function(_0x222712){if(_0x222712){return db[_0xa035('0x50')][_0xa035('0x61')](function(_0x5be789){return _0x222712[_0xa035('0x2a')]({'transaction':_0x5be789,'raw':!![]})[_0xa035('0x29')](function(_0x534330){if(_0x534330[_0xa035('0x53')]){fs[_0xa035('0x62')](_0x534330[_0xa035('0x53')])['forEach'](function(_0x1852c9){fs[_0xa035('0x63')](path['join'](_0x534330[_0xa035('0x53')],_0x1852c9));});fs['rmdirSync'](_0x534330[_0xa035('0x53')]);}return _0x534330;});})[_0xa035('0x4d')](function(_0x2c6404){throw new db['Sequelize'][(_0xa035('0x64'))](_0x2c6404[_0xa035('0x65')]);});}})[_0xa035('0x29')](handleEntityNotFound(_0x2ffaa9,null))[_0xa035('0x29')](removeEntity(_0x2ffaa9,null))['catch'](handleError(_0x2ffaa9,null));};exports[_0xa035('0x66')]=function(_0x24f255,_0x2e6033,_0x5f001a){return db[_0xa035('0x50')][_0xa035('0x61')](function(_0x1eafd8){var _0x4bdfb9;return db[_0xa035('0x32')]['find']({'where':{'id':_0x24f255['params']['id']}})[_0xa035('0x29')](function(_0x22881f){if(_0x22881f){_0x4bdfb9=_0x22881f;return _0x22881f['addSound'](_0x24f255[_0xa035('0x4e')]['id'],{'transaction':_0x1eafd8});}})[_0xa035('0x29')](function(_0x240461){if(_0x240461){return db[_0xa035('0x67')]['findOne']({'where':{'id':_0x24f255[_0xa035('0x4e')]['id']},'attributes':['id',_0xa035('0x2f'),'save_name',_0xa035('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x1ae482){if(_0x1ae482){var _0xaa2d75=path[_0xa035('0x54')](config[_0xa035('0x55')],_0xa035('0x69'),util['format']('%s.%s',path['basename'](_0x1ae482[_0xa035('0x6a')],path[_0xa035('0x6b')](_0x1ae482['save_name'])),_0x1ae482[_0xa035('0x68')]));var _0x259c60=path[_0xa035('0x54')](config[_0xa035('0x55')],'server/files/moh',_0x4bdfb9[_0xa035('0x2f')],util[_0xa035('0x6c')]('%s.%s',_0x1ae482[_0xa035('0x2f')],_0x1ae482[_0xa035('0x68')]));fs[_0xa035('0x6d')](_0xaa2d75,_0x259c60);return _0x1ae482;}})[_0xa035('0x4d')](function(_0x7da265){throw new db[(_0xa035('0x6e'))]['ValidationError'](_0x7da265[_0xa035('0x65')]);});})['then'](handleEntityNotFound(_0x2e6033,null))[_0xa035('0x29')](respondWithResult(_0x2e6033,0xc9))[_0xa035('0x4d')](handleError(_0x2e6033,null));};exports['removeSound']=function(_0x2b8016,_0x23ad89,_0x1f0a72){return db['sequelize'][_0xa035('0x61')](function(_0xd04940){var _0x2459e9;return db[_0xa035('0x32')][_0xa035('0x6f')]({'where':{'id':_0x2b8016[_0xa035('0x4c')]['id']}})[_0xa035('0x29')](handleEntityNotFound(_0x23ad89,null))[_0xa035('0x29')](function(_0x4c3ef0){if(_0x4c3ef0){_0x2459e9=_0x4c3ef0;return _0x4c3ef0[_0xa035('0x70')](_0x2b8016['params'][_0xa035('0x71')]);}})['then'](function(_0x345437){if(_0x345437){return db[_0xa035('0x67')][_0xa035('0x6f')]({'where':{'id':_0x2b8016[_0xa035('0x4c')][_0xa035('0x71')]},'attributes':['id',_0xa035('0x2f'),_0xa035('0x6a'),_0xa035('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x5ac93e){if(_0x5ac93e){fs[_0xa035('0x63')](path[_0xa035('0x54')](_0x2459e9[_0xa035('0x53')],util['format'](_0xa035('0x72'),_0x5ac93e[_0xa035('0x2f')],_0x5ac93e[_0xa035('0x68')])));return _0x5ac93e;}})[_0xa035('0x4d')](function(_0x36877a){throw new db['Sequelize'][(_0xa035('0x64'))](_0x36877a[_0xa035('0x65')]);});})['then'](handleEntityNotFound(_0x23ad89,null))[_0xa035('0x29')](respondWithStatusCode(_0x23ad89,0xcc))['catch'](handleError(_0x23ad89,null));};exports[_0xa035('0x73')]=function(_0x8698e1,_0x235188,_0x34ca3e){var _0x4c39b5={};var _0x281948={};var _0x264b05;var _0x5567b7;return db[_0xa035('0x32')][_0xa035('0x6f')]({'where':{'id':_0x8698e1[_0xa035('0x4c')]['id']}})[_0xa035('0x29')](handleEntityNotFound(_0x235188,null))[_0xa035('0x29')](function(_0x50e397){if(_0x50e397){_0x264b05=_0x50e397;_0x281948[_0xa035('0x35')]=_['keys'](db[_0xa035('0x67')]['rawAttributes']);_0x281948['query']=_[_0xa035('0x38')](_0x8698e1[_0xa035('0x37')]);_0x281948[_0xa035('0x39')]=_[_0xa035('0x3a')](_0x281948[_0xa035('0x35')],_0x281948[_0xa035('0x37')]);_0x4c39b5[_0xa035('0x3b')]=_[_0xa035('0x3a')](_0x281948[_0xa035('0x35')],qs['fields'](_0x8698e1[_0xa035('0x37')][_0xa035('0x3c')]));_0x4c39b5['attributes']=_0x4c39b5[_0xa035('0x3b')][_0xa035('0x3d')]?_0x4c39b5[_0xa035('0x3b')]:_0x281948[_0xa035('0x35')];_0x4c39b5[_0xa035('0x40')]=qs[_0xa035('0x41')](_0x8698e1['query']['sort']);_0x4c39b5['where']=qs[_0xa035('0x39')](_[_0xa035('0x43')](_0x8698e1[_0xa035('0x37')],_0x281948[_0xa035('0x39')]));if(_0x8698e1[_0xa035('0x37')][_0xa035('0x44')]){_0x4c39b5[_0xa035('0x42')]=_[_0xa035('0x45')](_0x4c39b5[_0xa035('0x42')],{'$or':_[_0xa035('0x36')](_0x4c39b5[_0xa035('0x3b')],function(_0x35d062){var _0x3b745f={};_0x3b745f[_0x35d062]={'$like':'%'+_0x8698e1['query']['filter']+'%'};return _0x3b745f;})});}_0x4c39b5=_[_0xa035('0x45')]({},_0x4c39b5,_0x8698e1[_0xa035('0x47')]);return _0x264b05[_0xa035('0x73')](_0x4c39b5);}})[_0xa035('0x29')](function(_0x558935){if(_0x558935){_0x5567b7=_0x558935['length'];if(!_0x8698e1[_0xa035('0x37')][_0xa035('0x3e')]('nolimit')){_0x4c39b5[_0xa035('0x22')]=qs[_0xa035('0x22')](_0x8698e1[_0xa035('0x37')][_0xa035('0x22')]);_0x4c39b5[_0xa035('0x20')]=qs[_0xa035('0x20')](_0x8698e1[_0xa035('0x37')][_0xa035('0x20')]);}return _0x264b05[_0xa035('0x73')](_0x4c39b5);}})['then'](function(_0x5b2636){if(_0x5b2636){return _0x5b2636?{'count':_0x5567b7,'rows':_0x5b2636}:null;}})['then'](respondWithResult(_0x235188,null))['catch'](handleError(_0x235188,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 357df69..925fc1b 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 _0x8610=['util','../../config/logger','moment','bluebird','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x3071ba,_0x716382){var _0x40e290=function(_0x584903){while(--_0x584903){_0x3071ba['push'](_0x3071ba['shift']());}};_0x40e290(++_0x716382);}(_0x8610,0x154));var _0x0861=function(_0x444a6d,_0x9506f8){_0x444a6d=_0x444a6d-0x0;var _0x303667=_0x8610[_0x444a6d];return _0x303667;};'use strict';var _=require(_0x0861('0x0'));var util=require(_0x0861('0x1'));var logger=require(_0x0861('0x2'))('api');var moment=require(_0x0861('0x3'));var BPromise=require(_0x0861('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0861('0x5'));var config=require('../../config/environment');var attributes=require(_0x0861('0x6'));module[_0x0861('0x7')]=function(_0x5b4426,_0x53612b){return _0x5b4426[_0x0861('0x8')](_0x0861('0x9'),attributes,{'tableName':_0x0861('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9911=['define','VoiceMusicOnHold','voice_musiconhold','util','api','moment','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9911,0xc1));var _0x1991=function(_0x181777,_0x226350){_0x181777=_0x181777-0x0;var _0x43c330=_0x9911[_0x181777];return _0x43c330;};'use strict';var _=require('lodash');var util=require(_0x1991('0x0'));var logger=require('../../config/logger')(_0x1991('0x1'));var moment=require(_0x1991('0x2'));var BPromise=require(_0x1991('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1991('0x4'));var config=require(_0x1991('0x5'));var attributes=require(_0x1991('0x6'));module['exports']=function(_0x339a70,_0x5ea7d6){return _0x339a70[_0x1991('0x7')](_0x1991('0x8'),attributes,{'tableName':_0x1991('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 4bf6465..826c30a 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x14d16e,_0x31e5f2){var _0x41271e=function(_0x3ef708){while(--_0x3ef708){_0x14d16e['push'](_0x14d16e['shift']());}};_0x41271e(++_0x31e5f2);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x44cb4c,_0x587962){var _0x40adca=function(_0x15ebc7){while(--_0x15ebc7){_0x44cb4c['push'](_0x44cb4c['shift']());}};_0x40adca(++_0x587962);}(_0xedd9,0xfc));var _0x9edd=function(_0x5db499,_0x336195){_0x5db499=_0x5db499-0x0;var _0xac20f3=_0xedd9[_0x5db499];return _0xac20f3;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 69357d5..0361c4b 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 _0x7e16=['destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getAgents','/:id/teams','getTeams','/:id/users','addAgents','post','addTeams','put','update','delete'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x7e16,0x16f));var _0x67e1=function(_0x27a5f3,_0x1f8930){_0x27a5f3=_0x27a5f3-0x0;var _0x1f6faa=_0x7e16[_0x27a5f3];return _0x1f6faa;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require(_0x67e1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x67e1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var controller=require('./voicePrefix.controller');router[_0x67e1('0x7')]('/',auth[_0x67e1('0x8')](),controller[_0x67e1('0x9')]);router[_0x67e1('0x7')](_0x67e1('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x67e1('0xb'),auth[_0x67e1('0x8')](),controller[_0x67e1('0xc')]);router[_0x67e1('0x7')]('/:id/users',auth[_0x67e1('0x8')](),controller[_0x67e1('0xd')]);router[_0x67e1('0x7')](_0x67e1('0xe'),auth['isAuthenticated'](),controller[_0x67e1('0xf')]);router['post']('/',auth[_0x67e1('0x8')](),controller['create']);router['post'](_0x67e1('0x10'),auth[_0x67e1('0x8')](),controller[_0x67e1('0x11')]);router[_0x67e1('0x12')]('/:id/teams',auth[_0x67e1('0x8')](),controller[_0x67e1('0x13')]);router[_0x67e1('0x14')]('/:id',auth[_0x67e1('0x8')](),controller[_0x67e1('0x15')]);router[_0x67e1('0x16')](_0x67e1('0xb'),auth[_0x67e1('0x8')](),controller[_0x67e1('0x17')]);router[_0x67e1('0x16')](_0x67e1('0x10'),auth[_0x67e1('0x8')](),controller[_0x67e1('0x18')]);router['delete'](_0x67e1('0xe'),auth[_0x67e1('0x8')](),controller[_0x67e1('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb91a=['getTeams','post','create','addAgents','addTeams','put','update','delete','/:id','destroy','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','show','/:id/users','getAgents','/:id/teams'];(function(_0x39d474,_0x280fb6){var _0x5915ca=function(_0x5233c1){while(--_0x5233c1){_0x39d474['push'](_0x39d474['shift']());}};_0x5915ca(++_0x280fb6);}(_0xb91a,0xf4));var _0xab91=function(_0x408c7e,_0x4013ad){_0x408c7e=_0x408c7e-0x0;var _0x1c94f=_0xb91a[_0x408c7e];return _0x1c94f;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/describe',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xab91('0xd')]);router[_0xab91('0x9')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x9')](_0xab91('0x10'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);router[_0xab91('0x12')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0x13')]);router[_0xab91('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xab91('0x14')]);router[_0xab91('0x12')](_0xab91('0x10'),auth[_0xab91('0xa')](),controller[_0xab91('0x15')]);router[_0xab91('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xab91('0x17')]);router[_0xab91('0x18')](_0xab91('0x19'),auth[_0xab91('0xa')](),controller[_0xab91('0x1a')]);router[_0xab91('0x18')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller['removeAgents']);router['delete'](_0xab91('0x10'),auth['isAuthenticated'](),controller[_0xab91('0x1b')]);module[_0xab91('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 54c0e2d..541e506 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 _0xef49=['system-','getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0xef49,0x123));var _0x9ef4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xef49[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x9ef4('0x0'));module[_0x9ef4('0x1')]={'name':{'type':Sequelize[_0x9ef4('0x2')],'allowNull':![],'unique':_0x9ef4('0x3')},'prefix':{'type':Sequelize[_0x9ef4('0x4')],'get':function(_0x2f7558){return _0x9ef4('0x5')+this[_0x9ef4('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x9ef4('0x2')]},'callerIdAll':{'type':Sequelize[_0x9ef4('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9ef4('0x7')]}}; \ No newline at end of file +var _0xfa40=['getDataValue','name','INTEGER','sequelize','STRING','VIRTUAL','system-'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xfa40,0xce));var _0x0fa4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xfa40[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0fa4('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x0fa4('0x2')],'get':function(_0x2910fa){return _0x0fa4('0x3')+this[_0x0fa4('0x4')](_0x0fa4('0x5'))+'-';}},'description':{'type':Sequelize[_0x0fa4('0x1')]},'callerIdAll':{'type':Sequelize[_0x0fa4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x0fa4('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 130e9dd..53e647f 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 _0x5b12=['QueryTypes','SELECT','TeamId','includes','all','union','compact','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','context','from-sip','exten','app','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','merge','getTeams','Team','User','online','flatMap','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b12,0xa3));var _0x25b1=function(_0xf36979,_0x8060){_0xf36979=_0xf36979-0x0;var _0x4c59c4=_0x5b12[_0xf36979];return _0x4c59c4;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];config[_0x25b1('0x19')]=_[_0x25b1('0x1a')](config[_0x25b1('0x19')],{'host':_0x25b1('0x1b'),'port':0x18eb});var socket=require(_0x25b1('0x1c'))(new Redis(config[_0x25b1('0x19')]));require(_0x25b1('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c337a,_0x2559a1){_0x2559a1=_0x2559a1||0xcc;return function(_0x4de13f){if(_0x4de13f){return _0x2c337a[_0x25b1('0x1e')](_0x2559a1);}return _0x2c337a[_0x25b1('0x1f')](_0x2559a1)[_0x25b1('0x20')]();};}function respondWithResult(_0x4a5a58,_0x593165){_0x593165=_0x593165||0xc8;return function(_0x7b50ab){if(_0x7b50ab){return _0x4a5a58['status'](_0x593165)[_0x25b1('0x21')](_0x7b50ab);}};}function respondWithFilteredResult(_0x2ca567,_0x1be2d8){return function(_0x27ccc9){if(_0x27ccc9){var _0x1f78c2=typeof _0x1be2d8[_0x25b1('0x22')]===_0x25b1('0x23')&&typeof _0x1be2d8[_0x25b1('0x24')]==='undefined';var _0x4ecff1=_0x27ccc9[_0x25b1('0x25')];var _0x501dc8=_0x1f78c2?0x0:_0x1be2d8[_0x25b1('0x22')];var _0x50ae0f=_0x1f78c2?_0x27ccc9[_0x25b1('0x25')]:_0x1be2d8['offset']+_0x1be2d8[_0x25b1('0x24')];var _0x529310;if(_0x50ae0f>=_0x4ecff1){_0x50ae0f=_0x4ecff1;_0x529310=0xc8;}else{_0x529310=0xce;}_0x2ca567[_0x25b1('0x1f')](_0x529310);return _0x2ca567['set']('Content-Range',_0x501dc8+'-'+_0x50ae0f+'/'+_0x4ecff1)['json'](_0x27ccc9);}return null;};}function patchUpdates(_0x3bca9f){return function(_0x150436){try{jsonpatch['apply'](_0x150436,_0x3bca9f,!![]);}catch(_0x19bab8){return BPromise[_0x25b1('0x26')](_0x19bab8);}return _0x150436[_0x25b1('0x27')]();};}function saveUpdates(_0x246acd,_0x1aabbb){return function(_0x5e6b6b){if(_0x5e6b6b){return _0x5e6b6b[_0x25b1('0x28')](_0x246acd)[_0x25b1('0x29')](function(_0xd22469){return _0xd22469;});}return null;};}function removeEntity(_0x282187,_0x1f37ed){return function(_0x1292bf){if(_0x1292bf){return _0x1292bf['destroy']()[_0x25b1('0x29')](function(){var _0x27dd68=_0x1292bf[_0x25b1('0x2a')]({'plain':!![]});var _0x5bc8fc=_0x25b1('0x2b');return db[_0x25b1('0x2c')][_0x25b1('0x2d')]({'where':{'type':_0x5bc8fc,'resourceId':_0x27dd68['id']}})['then'](function(){return _0x1292bf;});})[_0x25b1('0x29')](function(){_0x282187['status'](0xcc)[_0x25b1('0x20')]();});}};}function handleEntityNotFound(_0x3febb8,_0x3a4475){return function(_0x293413){if(!_0x293413){_0x3febb8[_0x25b1('0x1e')](0x194);}return _0x293413;};}function handleError(_0x300a14,_0x46e429){_0x46e429=_0x46e429||0x1f4;return function(_0x4cd825){logger[_0x25b1('0x2e')](_0x4cd825[_0x25b1('0x2f')]);if(_0x4cd825[_0x25b1('0x30')]){delete _0x4cd825[_0x25b1('0x30')];}_0x300a14[_0x25b1('0x1f')](_0x46e429)['send'](_0x4cd825);};}exports[_0x25b1('0x31')]=function(_0x548dd0,_0x42441d){var _0x1622e8={},_0x1e1796={},_0x5a4234={'count':0x0,'rows':[]};var _0x5cbde5=_[_0x25b1('0x32')](db['VoicePrefix'][_0x25b1('0x33')],function(_0x391713){return{'name':_0x391713[_0x25b1('0x34')],'type':_0x391713['type']['key']};});_0x1e1796[_0x25b1('0x35')]=_[_0x25b1('0x32')](_0x5cbde5,_0x25b1('0x30'));_0x1e1796['query']=_[_0x25b1('0x36')](_0x548dd0[_0x25b1('0x37')]);_0x1e1796[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x1e1796['model'],_0x1e1796[_0x25b1('0x37')]);_0x1622e8[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1e1796['model'],qs['fields'](_0x548dd0[_0x25b1('0x37')]['fields']));_0x1622e8[_0x25b1('0x3a')]=_0x1622e8[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x1622e8[_0x25b1('0x3a')]:_0x1e1796[_0x25b1('0x35')];if(!_0x548dd0[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x1622e8[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x548dd0[_0x25b1('0x37')][_0x25b1('0x24')]);_0x1622e8[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x548dd0[_0x25b1('0x37')]['offset']);}_0x1622e8[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x548dd0['query'][_0x25b1('0x3f')]);_0x1622e8[_0x25b1('0x40')]=qs[_0x25b1('0x38')](_[_0x25b1('0x41')](_0x548dd0[_0x25b1('0x37')],_0x1e1796['filters']),_0x5cbde5);if(_0x548dd0[_0x25b1('0x37')]['filter']){_0x1622e8[_0x25b1('0x40')]=_['merge'](_0x1622e8[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x5cbde5,function(_0x1b354e){if(_0x1b354e[_0x25b1('0x42')]!==_0x25b1('0x43')){var _0x45713f={};_0x45713f[_0x1b354e[_0x25b1('0x30')]]={'$like':'%'+_0x548dd0[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x45713f;}})});}_0x1622e8=_['merge']({},_0x1622e8,_0x548dd0[_0x25b1('0x45')]);var _0x585c37={'where':_0x1622e8[_0x25b1('0x40')]};return db[_0x25b1('0x46')]['count'](_0x585c37)[_0x25b1('0x29')](function(_0x39b4c7){_0x5a4234[_0x25b1('0x25')]=_0x39b4c7;if(_0x548dd0[_0x25b1('0x37')][_0x25b1('0x47')]){_0x1622e8[_0x25b1('0x48')]=[{'all':!![]}];}return db[_0x25b1('0x46')][_0x25b1('0x49')](_0x1622e8);})[_0x25b1('0x29')](function(_0x453352){_0x5a4234[_0x25b1('0x4a')]=_0x453352;return _0x5a4234;})[_0x25b1('0x29')](respondWithFilteredResult(_0x42441d,_0x1622e8))[_0x25b1('0x4b')](handleError(_0x42441d,null));};exports[_0x25b1('0x4c')]=function(_0x21242a,_0x210cef){var _0x103953={'raw':![],'where':{'id':_0x21242a['params']['id']}},_0x210a13={};_0x210a13['model']=_['keys'](db[_0x25b1('0x46')]['rawAttributes']);_0x210a13[_0x25b1('0x37')]=_['keys'](_0x21242a[_0x25b1('0x37')]);_0x210a13[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x210a13[_0x25b1('0x35')],_0x210a13[_0x25b1('0x37')]);_0x103953[_0x25b1('0x3a')]=_['intersection'](_0x210a13[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x21242a[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x103953['attributes']=_0x103953[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x103953[_0x25b1('0x3a')]:_0x210a13['model'];if(_0x21242a[_0x25b1('0x37')]['includeAll']){_0x103953[_0x25b1('0x48')]=[{'all':!![]}];}_0x103953=_['merge']({},_0x103953,_0x21242a['options']);return db[_0x25b1('0x46')][_0x25b1('0x4e')](_0x103953)[_0x25b1('0x29')](handleEntityNotFound(_0x210cef,null))[_0x25b1('0x29')](respondWithResult(_0x210cef,null))['catch'](handleError(_0x210cef,null));};exports[_0x25b1('0x2d')]=function(_0x58e612,_0x7c30da){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x58e612[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x7c30da,null))['then'](removeEntity(_0x7c30da,null))[_0x25b1('0x4b')](handleError(_0x7c30da,null));};exports[_0x25b1('0x50')]=function(_0x354294,_0xf38a9e){return db[_0x25b1('0x46')][_0x25b1('0x50')]()['then'](respondWithResult(_0xf38a9e,null))[_0x25b1('0x4b')](handleError(_0xf38a9e,null));};exports[_0x25b1('0x51')]=function(_0x168931,_0x2311da){var _0x5e367;return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x40d574){return db[_0x25b1('0x46')][_0x25b1('0x51')](_0x168931[_0x25b1('0x54')],{'transaction':_0x40d574})[_0x25b1('0x29')](function(_0x4190a1){_0x5e367=_0x4190a1[_0x25b1('0x2a')]({'plain':!![]});return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x5e367[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5732a1){return createVoicePrefixExtensions(_0x5e367,_0x5732a1,_0x40d574);});});})[_0x25b1('0x29')](function(){var _0x16e61e=_0x168931[_0x25b1('0x57')][_0x25b1('0x2a')]({'plain':!![]});if(!_0x16e61e)throw new Error(_0x25b1('0x58'));if(_0x16e61e[_0x25b1('0x59')]==='user'){var _0x105587=_0x5e367;return db[_0x25b1('0x5a')][_0x25b1('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x16e61e[_0x25b1('0x5b')]},'raw':!![]})['then'](function(_0x5bd36b){if(_0x5bd36b&&_0x5bd36b['autoAssociation']===0x0){return db['UserProfileResource'][_0x25b1('0x51')]({'name':_0x105587['name'],'resourceId':_0x105587['id'],'type':_0x5bd36b[_0x25b1('0x30')],'sectionId':_0x5bd36b['id']},{})[_0x25b1('0x29')](function(){return _0x5e367;});}else{return _0x5e367;}})[_0x25b1('0x4b')](function(_0x439bab){logger[_0x25b1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439bab);throw _0x439bab;});}return _0x5e367;})[_0x25b1('0x29')](respondWithResult(_0x2311da,null))[_0x25b1('0x4b')](handleError(_0x2311da,null));};function Extension(_0x37b58d,_0x400ec9,_0x5ecc36,_0xcca343){this[_0x25b1('0x5c')]=_0x25b1('0x5d');this[_0x25b1('0x5e')]=_0x37b58d;this[_0x25b1('0x5f')]=_0x5ecc36;this[_0x25b1('0x42')]='system';this[_0x25b1('0x60')]='Voice\x20Prefix\x20Extension';this[_0x25b1('0x61')]=_0x400ec9;this[_0x25b1('0x62')]=_0xcca343;}function createVoicePrefixExtensions(_0x49052b,_0x42a81f,_0x3d8d33){return new BPromise(function(_0x551bed,_0x1351ea){var _0x303049=new Extension(formatPrefixName(_0x49052b[_0x25b1('0x63')]),0x1,_0x25b1('0x64'),_0x25b1('0x65'));_0x303049[_0x25b1('0x66')]=_0x49052b['id'];return db[_0x25b1('0x55')][_0x25b1('0x51')](_0x303049,{'transaction':_0x3d8d33})['then'](function(_0x6f1b1f){var _0x1e2dcb=_0x6f1b1f[_0x25b1('0x2a')]({'plain':!![]});var _0x1da588=_[_0x25b1('0x32')](addVoicePrefixExtensions(_0x49052b,_0x42a81f),function(_0x2b9223){_0x2b9223[_0x25b1('0x56')]=_0x1e2dcb['id'];_0x2b9223[_0x25b1('0x66')]=_0x49052b['id'];return _0x2b9223;});return db['VoiceExtension'][_0x25b1('0x67')](_0x1da588,{'transaction':_0x3d8d33})[_0x25b1('0x29')](function(_0x51f922){if(!_0x51f922){return _0x1351ea(_0x25b1('0x68'));}else{return _0x551bed(_0x51f922);}})[_0x25b1('0x4b')](function(_0x5b71e5){return _0x1351ea(_0x5b71e5);});});;});};function addVoicePrefixExtensions(_0x26e90c,_0x498aca){var _0x44aa87=[];var _0x4e62b5=formatPrefixName(_0x26e90c[_0x25b1('0x63')]);_0x44aa87['push'](new Extension(_0x4e62b5,0x2,_0x25b1('0x69'),_0x25b1('0x6a')+_0x26e90c[_0x25b1('0x30')]));if(_0x26e90c['callerIdAll']){_0x44aa87['push'](new Extension(_0x4e62b5,0x3,_0x25b1('0x69'),_0x25b1('0x6b')+_0x26e90c[_0x25b1('0x6c')]));}else{_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x3,_0x25b1('0x64'),_0x25b1('0x6e')));}_0x44aa87[_0x25b1('0x6d')](new Extension(_0x4e62b5,0x4,_0x25b1('0x6f'),_0x498aca[_0x25b1('0x5c')]+','+_0x25b1('0x70')+(0x8+_0x26e90c[_0x25b1('0x30')][_0x25b1('0x3b')])+'}'+','+0x1));return _0x44aa87;}function formatPrefixName(_0x3d06ab){var _0x975b85='_';for(var _0x1c22c4=0x0;_0x1c22c4<_0x3d06ab[_0x25b1('0x3b')];_0x1c22c4++){if(_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)=='-'){_0x975b85+=_0x3d06ab[_0x25b1('0x71')](_0x1c22c4);}else{_0x975b85+='['+_0x3d06ab[_0x25b1('0x71')](_0x1c22c4)+']';}}_0x975b85+='.';return _0x975b85;}exports[_0x25b1('0x28')]=function(_0x15272b,_0x2fe4a5,_0x584499){var _0x1a3368=_0x15272b['body'];_0x1a3368[_0x25b1('0x63')]=_0x25b1('0x72')+_0x1a3368[_0x25b1('0x30')]+'-';return db['sequelize']['transaction'](function(_0x3f9ca7){return db[_0x25b1('0x46')]['update'](_0x1a3368,{'where':{'id':_0x1a3368['id']},'transaction':_0x3f9ca7})[_0x25b1('0x29')](function(){return db[_0x25b1('0x55')][_0x25b1('0x2d')]({'where':{'VoicePrefixId':_0x1a3368['id']},'transaction':_0x3f9ca7})['then'](function(){return db[_0x25b1('0x55')][_0x25b1('0x4e')]({'where':{'id':_0x1a3368[_0x25b1('0x56')]},'raw':!![]})[_0x25b1('0x29')](function(_0x5f1fef){return createVoicePrefixExtensions(_0x1a3368,_0x5f1fef,_0x3f9ca7);});});});})[_0x25b1('0x29')](function(){return db[_0x25b1('0x46')][_0x25b1('0x73')](_0x1a3368['id']);})[_0x25b1('0x29')](respondWithResult(_0x2fe4a5,null))[_0x25b1('0x4b')](handleError(_0x2fe4a5,null));};exports[_0x25b1('0x74')]=function(_0x4a9fbf,_0x40400e,_0x3f77e0){return db['VoicePrefix']['find']({'where':{'id':_0x4a9fbf[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x40400e,null))[_0x25b1('0x29')](function(_0x3ff99d){if(_0x3ff99d){return _0x3ff99d[_0x25b1('0x74')](_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')],_['omit'](_0x4a9fbf[_0x25b1('0x54')],[_0x25b1('0x75'),'id'])||{})[_0x25b1('0x76')](function(_0x49fac2){for(var _0x1bbb9b=0x0;_0x1bbb9b<_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')]['length'];_0x1bbb9b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x78'),{'UserId':Number(_0x4a9fbf[_0x25b1('0x54')][_0x25b1('0x75')][_0x1bbb9b]),'VoicePrefixId':Number(_0x4a9fbf[_0x25b1('0x4f')]['id'])});}return _0x49fac2;});}})[_0x25b1('0x29')](respondWithResult(_0x40400e,null))[_0x25b1('0x4b')](handleError(_0x40400e,null));};exports[_0x25b1('0x79')]=function(_0x1a07cb,_0x18021f,_0x20b43f){return db['VoicePrefix'][_0x25b1('0x4e')]({'where':{'id':_0x1a07cb[_0x25b1('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18021f,null))[_0x25b1('0x29')](function(_0x45804b){if(_0x45804b){return _0x45804b[_0x25b1('0x79')](_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')])['then'](function(){if(_['isArray'](_0x1a07cb[_0x25b1('0x37')]['ids'])){for(var _0x3e7f2b=0x0;_0x3e7f2b<_0x1a07cb[_0x25b1('0x37')][_0x25b1('0x75')][_0x25b1('0x3b')];_0x3e7f2b+=0x1){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query'][_0x25b1('0x75')][_0x3e7f2b]),'VoicePrefixId':Number(_0x1a07cb[_0x25b1('0x4f')]['id'])});}}else{socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':Number(_0x1a07cb['query']['ids']),'VoicePrefixId':Number(_0x1a07cb['params']['id'])});}});}})[_0x25b1('0x29')](respondWithStatusCode(_0x18021f,null))[_0x25b1('0x4b')](handleError(_0x18021f,null));};exports['getAgents']=function(_0x49c2d3,_0x271837,_0x102b85){var _0x6bbd44={};var _0x67a4b7={};var _0x54e1a6;var _0x10409f;return db[_0x25b1('0x46')][_0x25b1('0x7b')]({'where':{'id':_0x49c2d3[_0x25b1('0x4f')]['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x271837,null))[_0x25b1('0x29')](function(_0x175c72){if(_0x175c72){_0x54e1a6=_0x175c72;_0x67a4b7[_0x25b1('0x35')]=_['keys'](db['User'][_0x25b1('0x33')]);_0x67a4b7[_0x25b1('0x37')]=_['keys'](_0x49c2d3['query']);_0x67a4b7[_0x25b1('0x38')]=_[_0x25b1('0x39')](_0x67a4b7['model'],_0x67a4b7[_0x25b1('0x37')]);_0x6bbd44[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x67a4b7[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x6bbd44['attributes']=_0x6bbd44[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x6bbd44[_0x25b1('0x3a')]:_0x67a4b7['model'];_0x6bbd44['order']=qs['sort'](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x6bbd44[_0x25b1('0x40')]=qs['filters'](_['pick'](_0x49c2d3[_0x25b1('0x37')],_0x67a4b7[_0x25b1('0x38')]));if(_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x44')]){_0x6bbd44[_0x25b1('0x40')]=_[_0x25b1('0x7c')](_0x6bbd44[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x6bbd44[_0x25b1('0x3a')],function(_0x4c74f8){var _0xb7494b={};_0xb7494b[_0x4c74f8]={'$like':'%'+_0x49c2d3[_0x25b1('0x37')]['filter']+'%'};return _0xb7494b;})});}_0x6bbd44=_['merge']({},_0x6bbd44,_0x49c2d3[_0x25b1('0x45')]);return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x133a5d){if(_0x133a5d){_0x10409f=_0x133a5d[_0x25b1('0x3b')];if(!_0x49c2d3['query']['hasOwnProperty']('nolimit')){_0x6bbd44[_0x25b1('0x24')]=qs[_0x25b1('0x24')](_0x49c2d3['query'][_0x25b1('0x24')]);_0x6bbd44[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x49c2d3[_0x25b1('0x37')][_0x25b1('0x22')]);}return _0x54e1a6['getAgents'](_0x6bbd44);}})[_0x25b1('0x29')](function(_0x954de5){if(_0x954de5){return _0x954de5?{'count':_0x10409f,'rows':_0x954de5}:null;}})['then'](respondWithResult(_0x271837,null))[_0x25b1('0x4b')](handleError(_0x271837,null));};exports['getTeams']=function(_0x198561,_0x4c2b9f,_0x5c7849){var _0x92b5d6={};var _0x1958c0={};var _0x4428d2;var _0x12e63d;return db[_0x25b1('0x46')]['findOne']({'where':{'id':_0x198561['params']['id']}})[_0x25b1('0x29')](handleEntityNotFound(_0x4c2b9f,null))['then'](function(_0x2890c1){if(_0x2890c1){_0x4428d2=_0x2890c1;_0x1958c0[_0x25b1('0x35')]=_[_0x25b1('0x36')](db['Team'][_0x25b1('0x33')]);_0x1958c0['query']=_['keys'](_0x198561['query']);_0x1958c0[_0x25b1('0x38')]=_['intersection'](_0x1958c0[_0x25b1('0x35')],_0x1958c0[_0x25b1('0x37')]);_0x92b5d6[_0x25b1('0x3a')]=_[_0x25b1('0x39')](_0x1958c0[_0x25b1('0x35')],qs[_0x25b1('0x4d')](_0x198561[_0x25b1('0x37')][_0x25b1('0x4d')]));_0x92b5d6[_0x25b1('0x3a')]=_0x92b5d6[_0x25b1('0x3a')][_0x25b1('0x3b')]?_0x92b5d6[_0x25b1('0x3a')]:_0x1958c0[_0x25b1('0x35')];_0x92b5d6[_0x25b1('0x3e')]=qs[_0x25b1('0x3f')](_0x198561[_0x25b1('0x37')][_0x25b1('0x3f')]);_0x92b5d6['where']=qs[_0x25b1('0x38')](_['pick'](_0x198561[_0x25b1('0x37')],_0x1958c0[_0x25b1('0x38')]));if(_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]){_0x92b5d6[_0x25b1('0x40')]=_['merge'](_0x92b5d6[_0x25b1('0x40')],{'$or':_[_0x25b1('0x32')](_0x92b5d6[_0x25b1('0x3a')],function(_0x5af2b6){var _0x339e82={};_0x339e82[_0x5af2b6]={'$like':'%'+_0x198561[_0x25b1('0x37')][_0x25b1('0x44')]+'%'};return _0x339e82;})});}_0x92b5d6=_[_0x25b1('0x7c')]({},_0x92b5d6,_0x198561['options']);return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x270f00){if(_0x270f00){_0x12e63d=_0x270f00['length'];if(!_0x198561[_0x25b1('0x37')][_0x25b1('0x3c')](_0x25b1('0x3d'))){_0x92b5d6['limit']=qs[_0x25b1('0x24')](_0x198561[_0x25b1('0x37')]['limit']);_0x92b5d6[_0x25b1('0x22')]=qs[_0x25b1('0x22')](_0x198561['query'][_0x25b1('0x22')]);}return _0x4428d2[_0x25b1('0x7d')](_0x92b5d6);}})[_0x25b1('0x29')](function(_0x14b909){if(_0x14b909){return _0x14b909?{'count':_0x12e63d,'rows':_0x14b909}:null;}})[_0x25b1('0x29')](respondWithResult(_0x4c2b9f,null))[_0x25b1('0x4b')](handleError(_0x4c2b9f,null));};exports['addTeams']=function(_0x3496a9,_0x30f1e9,_0x18211a){var _0x3038be=_0x3496a9[_0x25b1('0x54')][_0x25b1('0x75')];var _0x310a32;return db[_0x25b1('0x7e')][_0x25b1('0x49')]({'where':{'id':_0x3038be},'attributes':['id'],'include':[{'model':db[_0x25b1('0x7f')],'as':'Agents','attributes':['id',_0x25b1('0x30'),_0x25b1('0x80'),'voicePause','interface'],'raw':!![]}]})[_0x25b1('0x29')](function(_0x96a1b0){if(_0x96a1b0){_0x310a32=_0x96a1b0;var _0x2db4a9=_[_0x25b1('0x81')](_0x96a1b0,function(_0x58e166){var _0x4c6181=_0x58e166['get']({'plain':!![]});return _0x4c6181[_0x25b1('0x82')];});return db[_0x25b1('0x46')][_0x25b1('0x4e')]({'where':{'id':_0x3496a9['params']['id']}})['then'](function(_0x16702d){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x55f740){return _0x16702d[_0x25b1('0x83')](_0x3038be,{'transaction':_0x55f740})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x310a32,function(_0x2da0d9){return db[_0x25b1('0x85')][_0x25b1('0x86')]({'TeamId':_0x2da0d9['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},{'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){return BPromise[_0x25b1('0x84')](_0x2db4a9,function(_0x5c515b){return db[_0x25b1('0x87')][_0x25b1('0x88')]({'where':{'UserId':_0x5c515b['id'],'VoicePrefixId':_0x3496a9[_0x25b1('0x4f')]['id']},'transaction':_0x55f740});});})[_0x25b1('0x29')](function(){_0x2db4a9[_0x25b1('0x89')](function(_0x3c8c4e){socket[_0x25b1('0x77')]('userVoicePrefix:save',{'UserId':_0x3c8c4e['id'],'VoicePrefixId':_0x16702d['id']});});});});});}})[_0x25b1('0x29')](respondWithStatusCode(_0x30f1e9,null))['catch'](handleError(_0x30f1e9,null));};exports[_0x25b1('0x8a')]=function(_0x469405,_0x1010c4,_0x22d3e4){return db['Team']['findAll']({'where':{'id':_0x469405[_0x25b1('0x37')][_0x25b1('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1010c4,null))[_0x25b1('0x29')](function(_0xd05872){var _0x25c07f=_[_0x25b1('0x32')](_0xd05872,'id');var _0x1041d1=[];var _0x1f1160=[];var _0x29d8fe=squel[_0x25b1('0x8b')]();_0x29d8fe[_0x25b1('0x8c')](_0x25b1('0x8d'))[_0x25b1('0x8e')](_0x25b1('0x8f'),'tq')['join'](_0x25b1('0x90'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x25b1('0x40')](_0x25b1('0x91'),_0x469405[_0x25b1('0x4f')]['id']);for(var _0x1354c3=0x0;_0x1354c3<_0xd05872[_0x25b1('0x3b')];_0x1354c3+=0x1){let _0x3ccdab=_0xd05872[_0x1354c3];for(var _0x381a62=0x0;_0x381a62<_0x3ccdab[_0x25b1('0x82')]['length'];_0x381a62+=0x1){let _0x330ae7=_0x3ccdab[_0x25b1('0x82')][_0x381a62];var _0xbe6572=_0x29d8fe[_0x25b1('0x92')]();_0xbe6572[_0x25b1('0x40')](_0x25b1('0x93'),_0x330ae7['id']);_0x1f1160[_0x25b1('0x6d')](db['sequelize'][_0x25b1('0x37')](_0xbe6572[_0x25b1('0x94')](),{'type':db[_0x25b1('0x52')][_0x25b1('0x95')][_0x25b1('0x96')]})['then'](function(_0x4edb48){if(_0x4edb48[_0x25b1('0x3b')]===0x1){return _0x330ae7['id'];}else{var _0x2e924b=_['every'](_['map'](_0x4edb48,_0x25b1('0x97')),function(_0x16d969){return _[_0x25b1('0x98')](_0x25c07f,_0x16d969);});if(_0x2e924b){return _0x330ae7['id'];}}}));}}return BPromise[_0x25b1('0x99')](_0x1f1160)[_0x25b1('0x29')](function(_0x3128bd){_0x1041d1=_(_0x1041d1)[_0x25b1('0x9a')](_0x3128bd)[_0x25b1('0x9b')]()['value']();return db[_0x25b1('0x46')]['find']({'where':{'id':_0x469405['params']['id']}})[_0x25b1('0x29')](function(_0x4cf3e6){return db[_0x25b1('0x52')][_0x25b1('0x53')](function(_0x2c0147){return _0x4cf3e6[_0x25b1('0x8a')](_0x469405[_0x25b1('0x37')][_0x25b1('0x75')],{'transaction':_0x2c0147})[_0x25b1('0x29')](function(){if(!_['isEmpty'](_0x1041d1)){return _0x4cf3e6[_0x25b1('0x79')](_0x1041d1,{'transaction':_0x2c0147});}})[_0x25b1('0x29')](function(){_0x1041d1[_0x25b1('0x89')](function(_0x220f92){socket[_0x25b1('0x77')](_0x25b1('0x7a'),{'UserId':_0x220f92,'VoicePrefixId':_0x4cf3e6['id']});});});});});});})[_0x25b1('0x29')](respondWithStatusCode(_0x1010c4,null))[_0x25b1('0x4b')](handleError(_0x1010c4,null));}; \ No newline at end of file +var _0xda2d=['UserProfileResource','destroy','stack','name','index','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoicePrefix','includeAll','findAll','catch','show','params','rawAttributes','include','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','${EXTEN:','charAt','update','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','options','getTeams','findOne','Team','online','voicePause','interface','flatMap','Agents','addTeams','each','UserVoicePrefix','forEach','userVoicePrefix:save','removeTeams','field','tq.TeamId','from','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','TeamId','includes','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','VoicePrefixes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xda2d,0x102));var _0xdda2=function(_0x283e36,_0x4db06e){_0x283e36=_0x283e36-0x0;var _0x1d86f5=_0xda2d[_0x283e36];return _0x1d86f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdda2('0x19')](config[_0xdda2('0x1a')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x1a')]));require(_0xdda2('0x1d'))[_0xdda2('0x1e')](socket);function respondWithStatusCode(_0x4df902,_0x79c6d4){_0x79c6d4=_0x79c6d4||0xcc;return function(_0x4b0220){if(_0x4b0220){return _0x4df902[_0xdda2('0x1f')](_0x79c6d4);}return _0x4df902[_0xdda2('0x20')](_0x79c6d4)[_0xdda2('0x21')]();};}function respondWithResult(_0x457764,_0x1922b1){_0x1922b1=_0x1922b1||0xc8;return function(_0x5d8a83){if(_0x5d8a83){return _0x457764['status'](_0x1922b1)[_0xdda2('0x22')](_0x5d8a83);}};}function respondWithFilteredResult(_0x518c6d,_0x1a5192){return function(_0x1a3b35){if(_0x1a3b35){var _0x335fb5=typeof _0x1a5192[_0xdda2('0x23')]===_0xdda2('0x24')&&typeof _0x1a5192[_0xdda2('0x25')]===_0xdda2('0x24');var _0x351151=_0x1a3b35[_0xdda2('0x26')];var _0x337b0b=_0x335fb5?0x0:_0x1a5192[_0xdda2('0x23')];var _0x6fdede=_0x335fb5?_0x1a3b35['count']:_0x1a5192[_0xdda2('0x23')]+_0x1a5192['limit'];var _0xc4567c;if(_0x6fdede>=_0x351151){_0x6fdede=_0x351151;_0xc4567c=0xc8;}else{_0xc4567c=0xce;}_0x518c6d[_0xdda2('0x20')](_0xc4567c);return _0x518c6d[_0xdda2('0x27')]('Content-Range',_0x337b0b+'-'+_0x6fdede+'/'+_0x351151)[_0xdda2('0x22')](_0x1a3b35);}return null;};}function patchUpdates(_0x5a9bb8){return function(_0x425489){try{jsonpatch[_0xdda2('0x28')](_0x425489,_0x5a9bb8,!![]);}catch(_0x4ac3eb){return BPromise[_0xdda2('0x29')](_0x4ac3eb);}return _0x425489[_0xdda2('0x2a')]();};}function saveUpdates(_0x2528d7,_0x13b0f3){return function(_0x45ee9d){if(_0x45ee9d){return _0x45ee9d['update'](_0x2528d7)[_0xdda2('0x2b')](function(_0x4be5ea){return _0x4be5ea;});}return null;};}function removeEntity(_0x2391a5,_0x31d48b){return function(_0x5436d1){if(_0x5436d1){return _0x5436d1['destroy']()[_0xdda2('0x2b')](function(){var _0x4567e7=_0x5436d1[_0xdda2('0x2c')]({'plain':!![]});var _0x5e9e74=_0xdda2('0x2d');return db[_0xdda2('0x2e')][_0xdda2('0x2f')]({'where':{'type':_0x5e9e74,'resourceId':_0x4567e7['id']}})[_0xdda2('0x2b')](function(){return _0x5436d1;});})[_0xdda2('0x2b')](function(){_0x2391a5[_0xdda2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c37d,_0x255bbc){return function(_0x53acb5){if(!_0x53acb5){_0x24c37d[_0xdda2('0x1f')](0x194);}return _0x53acb5;};}function handleError(_0x2cfaca,_0x3b18b8){_0x3b18b8=_0x3b18b8||0x1f4;return function(_0x15e511){logger['error'](_0x15e511[_0xdda2('0x30')]);if(_0x15e511[_0xdda2('0x31')]){delete _0x15e511['name'];}_0x2cfaca[_0xdda2('0x20')](_0x3b18b8)['send'](_0x15e511);};}exports[_0xdda2('0x32')]=function(_0x55809a,_0x53ff76){var _0x510b7b={},_0x239c25={},_0x5bfc17={'count':0x0,'rows':[]};var _0x1b13f4=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4637c1){return{'name':_0x4637c1[_0xdda2('0x33')],'type':_0x4637c1[_0xdda2('0x34')][_0xdda2('0x35')]};});_0x239c25[_0xdda2('0x36')]=_[_0xdda2('0x37')](_0x1b13f4,_0xdda2('0x31'));_0x239c25[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x55809a[_0xdda2('0x38')]);_0x239c25['filters']=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],_0x239c25[_0xdda2('0x38')]);_0x510b7b[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x239c25[_0xdda2('0x36')],qs[_0xdda2('0x3c')](_0x55809a['query']['fields']));_0x510b7b[_0xdda2('0x3b')]=_0x510b7b[_0xdda2('0x3b')][_0xdda2('0x3d')]?_0x510b7b['attributes']:_0x239c25['model'];if(!_0x55809a[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x510b7b[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x55809a['query'][_0xdda2('0x25')]);_0x510b7b[_0xdda2('0x23')]=qs['offset'](_0x55809a['query'][_0xdda2('0x23')]);}_0x510b7b[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x55809a[_0xdda2('0x38')][_0xdda2('0x41')]);_0x510b7b['where']=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x55809a[_0xdda2('0x38')],_0x239c25[_0xdda2('0x42')]),_0x1b13f4);if(_0x55809a['query']['filter']){_0x510b7b[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x510b7b[_0xdda2('0x44')],{'$or':_['map'](_0x1b13f4,function(_0x1bb2a7){if(_0x1bb2a7['type']!==_0xdda2('0x46')){var _0x4c68d7={};_0x4c68d7[_0x1bb2a7[_0xdda2('0x31')]]={'$like':'%'+_0x55809a[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4c68d7;}})});}_0x510b7b=_[_0xdda2('0x45')]({},_0x510b7b,_0x55809a['options']);var _0x1c5195={'where':_0x510b7b['where']};return db[_0xdda2('0x48')]['count'](_0x1c5195)[_0xdda2('0x2b')](function(_0x12589b){_0x5bfc17[_0xdda2('0x26')]=_0x12589b;if(_0x55809a[_0xdda2('0x38')][_0xdda2('0x49')]){_0x510b7b['include']=[{'all':!![]}];}return db[_0xdda2('0x48')][_0xdda2('0x4a')](_0x510b7b);})['then'](function(_0x2caced){_0x5bfc17['rows']=_0x2caced;return _0x5bfc17;})[_0xdda2('0x2b')](respondWithFilteredResult(_0x53ff76,_0x510b7b))[_0xdda2('0x4b')](handleError(_0x53ff76,null));};exports[_0xdda2('0x4c')]=function(_0x355b6a,_0x3f1f9b){var _0x6718ea={'raw':![],'where':{'id':_0x355b6a[_0xdda2('0x4d')]['id']}},_0x550351={};_0x550351[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x48')][_0xdda2('0x4e')]);_0x550351[_0xdda2('0x38')]=_['keys'](_0x355b6a['query']);_0x550351['filters']=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],_0x550351['query']);_0x6718ea[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0x550351[_0xdda2('0x36')],qs['fields'](_0x355b6a[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x6718ea['attributes']=_0x6718ea['attributes'][_0xdda2('0x3d')]?_0x6718ea['attributes']:_0x550351[_0xdda2('0x36')];if(_0x355b6a['query'][_0xdda2('0x49')]){_0x6718ea[_0xdda2('0x4f')]=[{'all':!![]}];}_0x6718ea=_['merge']({},_0x6718ea,_0x355b6a['options']);return db[_0xdda2('0x48')][_0xdda2('0x50')](_0x6718ea)[_0xdda2('0x2b')](handleEntityNotFound(_0x3f1f9b,null))[_0xdda2('0x2b')](respondWithResult(_0x3f1f9b,null))['catch'](handleError(_0x3f1f9b,null));};exports[_0xdda2('0x2f')]=function(_0x3bba94,_0x3d2cb0){return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x3bba94['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x3d2cb0,null))[_0xdda2('0x2b')](removeEntity(_0x3d2cb0,null))['catch'](handleError(_0x3d2cb0,null));};exports[_0xdda2('0x51')]=function(_0x123c2d,_0x143670){return db[_0xdda2('0x48')][_0xdda2('0x51')]()[_0xdda2('0x2b')](respondWithResult(_0x143670,null))['catch'](handleError(_0x143670,null));};exports[_0xdda2('0x52')]=function(_0x4a9814,_0x361038){var _0x4a70ff;return db[_0xdda2('0x53')]['transaction'](function(_0x3b5bbf){return db[_0xdda2('0x48')][_0xdda2('0x52')](_0x4a9814[_0xdda2('0x54')],{'transaction':_0x3b5bbf})[_0xdda2('0x2b')](function(_0x2b45f3){_0x4a70ff=_0x2b45f3[_0xdda2('0x2c')]({'plain':!![]});return db[_0xdda2('0x55')]['find']({'where':{'id':_0x4a70ff[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x1b24f2){return createVoicePrefixExtensions(_0x4a70ff,_0x1b24f2,_0x3b5bbf);});});})['then'](function(){var _0xf380b0=_0x4a9814[_0xdda2('0x57')]['get']({'plain':!![]});if(!_0xf380b0)throw new Error(_0xdda2('0x58'));if(_0xf380b0['role']===_0xdda2('0x57')){var _0x10fbac=_0x4a70ff;return db[_0xdda2('0x59')][_0xdda2('0x50')]({'where':{'name':_0xdda2('0x2d'),'userProfileId':_0xf380b0['userProfileId']},'raw':!![]})['then'](function(_0x5c2cb2){if(_0x5c2cb2&&_0x5c2cb2[_0xdda2('0x5a')]===0x0){return db[_0xdda2('0x2e')]['create']({'name':_0x10fbac[_0xdda2('0x31')],'resourceId':_0x10fbac['id'],'type':_0x5c2cb2[_0xdda2('0x31')],'sectionId':_0x5c2cb2['id']},{})[_0xdda2('0x2b')](function(){return _0x4a70ff;});}else{return _0x4a70ff;}})['catch'](function(_0x3fd76c){logger[_0xdda2('0x5b')](_0xdda2('0x5c'),_0x3fd76c);throw _0x3fd76c;});}return _0x4a70ff;})['then'](respondWithResult(_0x361038,null))[_0xdda2('0x4b')](handleError(_0x361038,null));};function Extension(_0x4495e5,_0x7eb83f,_0x25c9a9,_0x5d8602){this[_0xdda2('0x5d')]='from-sip';this['exten']=_0x4495e5;this['app']=_0x25c9a9;this[_0xdda2('0x34')]=_0xdda2('0x5e');this[_0xdda2('0x5f')]=_0xdda2('0x60');this[_0xdda2('0x61')]=_0x7eb83f;this[_0xdda2('0x62')]=_0x5d8602;}function createVoicePrefixExtensions(_0x29a739,_0x3ac33a,_0x269ad1){return new BPromise(function(_0x138c2f,_0x26e7de){var _0x5e6dcf=new Extension(formatPrefixName(_0x29a739[_0xdda2('0x63')]),0x1,_0xdda2('0x64'),_0xdda2('0x65'));_0x5e6dcf[_0xdda2('0x66')]=_0x29a739['id'];return db[_0xdda2('0x55')][_0xdda2('0x52')](_0x5e6dcf,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x57fb41){var _0x23518f=_0x57fb41[_0xdda2('0x2c')]({'plain':!![]});var _0x19e650=_[_0xdda2('0x37')](addVoicePrefixExtensions(_0x29a739,_0x3ac33a),function(_0x44f619){_0x44f619['VoiceExtensionId']=_0x23518f['id'];_0x44f619[_0xdda2('0x66')]=_0x29a739['id'];return _0x44f619;});return db[_0xdda2('0x55')][_0xdda2('0x67')](_0x19e650,{'transaction':_0x269ad1})[_0xdda2('0x2b')](function(_0x21d0e4){if(!_0x21d0e4){return _0x26e7de('Extensions\x20creation\x20failed');}else{return _0x138c2f(_0x21d0e4);}})[_0xdda2('0x4b')](function(_0x18d251){return _0x26e7de(_0x18d251);});});;});};function addVoicePrefixExtensions(_0x3d49e8,_0x4530b7){var _0x1ac15a=[];var _0x5d34d7=formatPrefixName(_0x3d49e8[_0xdda2('0x63')]);_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x2,_0xdda2('0x69'),'CDR(prefix)='+_0x3d49e8[_0xdda2('0x31')]));if(_0x3d49e8['callerIdAll']){_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x69'),_0xdda2('0x6a')+_0x3d49e8['callerIdAll']));}else{_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x3,_0xdda2('0x64'),'No\x20callerid\x20available'));}_0x1ac15a[_0xdda2('0x68')](new Extension(_0x5d34d7,0x4,'goto',_0x4530b7[_0xdda2('0x5d')]+','+_0xdda2('0x6b')+(0x8+_0x3d49e8[_0xdda2('0x31')][_0xdda2('0x3d')])+'}'+','+0x1));return _0x1ac15a;}function formatPrefixName(_0x10d1de){var _0x4a061a='_';for(var _0x586ca1=0x0;_0x586ca1<_0x10d1de[_0xdda2('0x3d')];_0x586ca1++){if(_0x10d1de[_0xdda2('0x6c')](_0x586ca1)=='-'){_0x4a061a+=_0x10d1de['charAt'](_0x586ca1);}else{_0x4a061a+='['+_0x10d1de['charAt'](_0x586ca1)+']';}}_0x4a061a+='.';return _0x4a061a;}exports[_0xdda2('0x6d')]=function(_0x501336,_0x12a052,_0x1a33ba){var _0x4910a6=_0x501336[_0xdda2('0x54')];_0x4910a6[_0xdda2('0x63')]=_0xdda2('0x6e')+_0x4910a6[_0xdda2('0x31')]+'-';return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x4eebb0){return db[_0xdda2('0x48')][_0xdda2('0x6d')](_0x4910a6,{'where':{'id':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension'][_0xdda2('0x2f')]({'where':{'VoicePrefixId':_0x4910a6['id']},'transaction':_0x4eebb0})[_0xdda2('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x4910a6[_0xdda2('0x56')]},'raw':!![]})[_0xdda2('0x2b')](function(_0x2f03b9){return createVoicePrefixExtensions(_0x4910a6,_0x2f03b9,_0x4eebb0);});});});})['then'](function(){return db['VoicePrefix'][_0xdda2('0x70')](_0x4910a6['id']);})['then'](respondWithResult(_0x12a052,null))[_0xdda2('0x4b')](handleError(_0x12a052,null));};exports[_0xdda2('0x71')]=function(_0x19d92e,_0x12fd67,_0x597b09){return db[_0xdda2('0x48')]['find']({'where':{'id':_0x19d92e['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x12fd67,null))['then'](function(_0x2de01c){if(_0x2de01c){return _0x2de01c[_0xdda2('0x71')](_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')],_[_0xdda2('0x73')](_0x19d92e[_0xdda2('0x54')],[_0xdda2('0x72'),'id'])||{})[_0xdda2('0x74')](function(_0x37c547){for(var _0x495a28=0x0;_0x495a28<_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x495a28+=0x1){socket[_0xdda2('0x75')]('userVoicePrefix:save',{'UserId':Number(_0x19d92e[_0xdda2('0x54')][_0xdda2('0x72')][_0x495a28]),'VoicePrefixId':Number(_0x19d92e[_0xdda2('0x4d')]['id'])});}return _0x37c547;});}})[_0xdda2('0x2b')](respondWithResult(_0x12fd67,null))['catch'](handleError(_0x12fd67,null));};exports['removeAgents']=function(_0xe4110b,_0xdef266,_0x423e1f){return db[_0xdda2('0x48')]['find']({'where':{'id':_0xe4110b[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0xdef266,null))[_0xdda2('0x2b')](function(_0x152ba3){if(_0x152ba3){return _0x152ba3[_0xdda2('0x76')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])[_0xdda2('0x2b')](function(){if(_[_0xdda2('0x77')](_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')])){for(var _0x23a80a=0x0;_0x23a80a<_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')][_0xdda2('0x3d')];_0x23a80a+=0x1){socket['emit'](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')]['ids'][_0x23a80a]),'VoicePrefixId':Number(_0xe4110b['params']['id'])});}}else{socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':Number(_0xe4110b[_0xdda2('0x38')][_0xdda2('0x72')]),'VoicePrefixId':Number(_0xe4110b[_0xdda2('0x4d')]['id'])});}});}})[_0xdda2('0x2b')](respondWithStatusCode(_0xdef266,null))['catch'](handleError(_0xdef266,null));};exports[_0xdda2('0x79')]=function(_0x1f3abe,_0x447bd2,_0x2bb4f3){var _0x563be8={};var _0xbf1248={};var _0x5c3d67;var _0x20ebf7;return db[_0xdda2('0x48')]['findOne']({'where':{'id':_0x1f3abe[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x447bd2,null))[_0xdda2('0x2b')](function(_0x1dfe6d){if(_0x1dfe6d){_0x5c3d67=_0x1dfe6d;_0xbf1248[_0xdda2('0x36')]=_[_0xdda2('0x39')](db[_0xdda2('0x7a')][_0xdda2('0x4e')]);_0xbf1248[_0xdda2('0x38')]=_[_0xdda2('0x39')](_0x1f3abe[_0xdda2('0x38')]);_0xbf1248['filters']=_[_0xdda2('0x3a')](_0xbf1248[_0xdda2('0x36')],_0xbf1248[_0xdda2('0x38')]);_0x563be8[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xbf1248['model'],qs[_0xdda2('0x3c')](_0x1f3abe[_0xdda2('0x38')]['fields']));_0x563be8[_0xdda2('0x3b')]=_0x563be8[_0xdda2('0x3b')]['length']?_0x563be8['attributes']:_0xbf1248[_0xdda2('0x36')];_0x563be8[_0xdda2('0x40')]=qs[_0xdda2('0x41')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x41')]);_0x563be8[_0xdda2('0x44')]=qs['filters'](_[_0xdda2('0x43')](_0x1f3abe[_0xdda2('0x38')],_0xbf1248['filters']));if(_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]){_0x563be8['where']=_[_0xdda2('0x45')](_0x563be8[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x563be8['attributes'],function(_0xe6f37b){var _0x4a34ee={};_0x4a34ee[_0xe6f37b]={'$like':'%'+_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x47')]+'%'};return _0x4a34ee;})});}_0x563be8=_[_0xdda2('0x45')]({},_0x563be8,_0x1f3abe[_0xdda2('0x7b')]);return _0x5c3d67['getAgents'](_0x563be8);}})['then'](function(_0x2b8c0c){if(_0x2b8c0c){_0x20ebf7=_0x2b8c0c[_0xdda2('0x3d')];if(!_0x1f3abe['query'][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x563be8[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x25')]);_0x563be8[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x1f3abe[_0xdda2('0x38')][_0xdda2('0x23')]);}return _0x5c3d67[_0xdda2('0x79')](_0x563be8);}})[_0xdda2('0x2b')](function(_0x528185){if(_0x528185){return _0x528185?{'count':_0x20ebf7,'rows':_0x528185}:null;}})['then'](respondWithResult(_0x447bd2,null))['catch'](handleError(_0x447bd2,null));};exports[_0xdda2('0x7c')]=function(_0x4edf20,_0x2910b0,_0x323af8){var _0x2f18a0={};var _0xe797aa={};var _0x558ab6;var _0x374fc4;return db[_0xdda2('0x48')][_0xdda2('0x7d')]({'where':{'id':_0x4edf20['params']['id']}})[_0xdda2('0x2b')](handleEntityNotFound(_0x2910b0,null))[_0xdda2('0x2b')](function(_0x2588f5){if(_0x2588f5){_0x558ab6=_0x2588f5;_0xe797aa['model']=_['keys'](db[_0xdda2('0x7e')][_0xdda2('0x4e')]);_0xe797aa[_0xdda2('0x38')]=_['keys'](_0x4edf20[_0xdda2('0x38')]);_0xe797aa[_0xdda2('0x42')]=_[_0xdda2('0x3a')](_0xe797aa[_0xdda2('0x36')],_0xe797aa[_0xdda2('0x38')]);_0x2f18a0[_0xdda2('0x3b')]=_[_0xdda2('0x3a')](_0xe797aa['model'],qs[_0xdda2('0x3c')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3c')]));_0x2f18a0[_0xdda2('0x3b')]=_0x2f18a0['attributes'][_0xdda2('0x3d')]?_0x2f18a0[_0xdda2('0x3b')]:_0xe797aa[_0xdda2('0x36')];_0x2f18a0[_0xdda2('0x40')]=qs['sort'](_0x4edf20['query']['sort']);_0x2f18a0[_0xdda2('0x44')]=qs[_0xdda2('0x42')](_[_0xdda2('0x43')](_0x4edf20[_0xdda2('0x38')],_0xe797aa[_0xdda2('0x42')]));if(_0x4edf20[_0xdda2('0x38')]['filter']){_0x2f18a0[_0xdda2('0x44')]=_[_0xdda2('0x45')](_0x2f18a0[_0xdda2('0x44')],{'$or':_[_0xdda2('0x37')](_0x2f18a0[_0xdda2('0x3b')],function(_0x39ee74){var _0xcbf57f={};_0xcbf57f[_0x39ee74]={'$like':'%'+_0x4edf20[_0xdda2('0x38')]['filter']+'%'};return _0xcbf57f;})});}_0x2f18a0=_[_0xdda2('0x45')]({},_0x2f18a0,_0x4edf20['options']);return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x15066f){if(_0x15066f){_0x374fc4=_0x15066f['length'];if(!_0x4edf20[_0xdda2('0x38')][_0xdda2('0x3e')](_0xdda2('0x3f'))){_0x2f18a0[_0xdda2('0x25')]=qs[_0xdda2('0x25')](_0x4edf20[_0xdda2('0x38')][_0xdda2('0x25')]);_0x2f18a0[_0xdda2('0x23')]=qs[_0xdda2('0x23')](_0x4edf20['query'][_0xdda2('0x23')]);}return _0x558ab6[_0xdda2('0x7c')](_0x2f18a0);}})['then'](function(_0x42db44){if(_0x42db44){return _0x42db44?{'count':_0x374fc4,'rows':_0x42db44}:null;}})[_0xdda2('0x2b')](respondWithResult(_0x2910b0,null))[_0xdda2('0x4b')](handleError(_0x2910b0,null));};exports['addTeams']=function(_0x1702ae,_0x21ade3,_0x251408){var _0x311e34=_0x1702ae[_0xdda2('0x54')][_0xdda2('0x72')];var _0x4124a5;return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x311e34},'attributes':['id'],'include':[{'model':db[_0xdda2('0x7a')],'as':'Agents','attributes':['id',_0xdda2('0x31'),_0xdda2('0x7f'),_0xdda2('0x80'),_0xdda2('0x81')],'raw':!![]}]})[_0xdda2('0x2b')](function(_0x4c540d){if(_0x4c540d){_0x4124a5=_0x4c540d;var _0x320cf1=_[_0xdda2('0x82')](_0x4c540d,function(_0xdd343d){var _0x56cd13=_0xdd343d[_0xdda2('0x2c')]({'plain':!![]});return _0x56cd13[_0xdda2('0x83')];});return db[_0xdda2('0x48')]['find']({'where':{'id':_0x1702ae[_0xdda2('0x4d')]['id']}})['then'](function(_0x579fc9){return db[_0xdda2('0x53')][_0xdda2('0x6f')](function(_0x3752bf){return _0x579fc9[_0xdda2('0x84')](_0x311e34,{'transaction':_0x3752bf})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x4124a5,function(_0x14baa0){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x14baa0['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},{'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){return BPromise[_0xdda2('0x85')](_0x320cf1,function(_0x16b910){return db[_0xdda2('0x86')]['findOrCreate']({'where':{'UserId':_0x16b910['id'],'VoicePrefixId':_0x1702ae[_0xdda2('0x4d')]['id']},'transaction':_0x3752bf});});})[_0xdda2('0x2b')](function(){_0x320cf1[_0xdda2('0x87')](function(_0x233494){socket[_0xdda2('0x75')](_0xdda2('0x88'),{'UserId':_0x233494['id'],'VoicePrefixId':_0x579fc9['id']});});});});});}})[_0xdda2('0x2b')](respondWithStatusCode(_0x21ade3,null))[_0xdda2('0x4b')](handleError(_0x21ade3,null));};exports[_0xdda2('0x89')]=function(_0x44e93d,_0x2defb2,_0x53c44d){return db[_0xdda2('0x7e')][_0xdda2('0x4a')]({'where':{'id':_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdda2('0x83'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2defb2,null))[_0xdda2('0x2b')](function(_0x4f2d5c){var _0x240048=_['map'](_0x4f2d5c,'id');var _0x1da0dd=[];var _0xb93d3b=[];var _0x3d59cb=squel['select']();_0x3d59cb[_0xdda2('0x8a')](_0xdda2('0x8b'))[_0xdda2('0x8c')]('team_has_voice_prefixes','tq')['join'](_0xdda2('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdda2('0x44')](_0xdda2('0x8e'),_0x44e93d[_0xdda2('0x4d')]['id']);for(var _0x182570=0x0;_0x182570<_0x4f2d5c['length'];_0x182570+=0x1){let _0x28a217=_0x4f2d5c[_0x182570];for(var _0x54cd55=0x0;_0x54cd55<_0x28a217['Agents']['length'];_0x54cd55+=0x1){let _0x5235d5=_0x28a217[_0xdda2('0x83')][_0x54cd55];var _0x4a6058=_0x3d59cb[_0xdda2('0x8f')]();_0x4a6058[_0xdda2('0x44')]('ut.UserId\x20=\x20?',_0x5235d5['id']);_0xb93d3b['push'](db[_0xdda2('0x53')][_0xdda2('0x38')](_0x4a6058[_0xdda2('0x90')](),{'type':db[_0xdda2('0x53')]['QueryTypes']['SELECT']})[_0xdda2('0x2b')](function(_0x19c1eb){if(_0x19c1eb[_0xdda2('0x3d')]===0x1){return _0x5235d5['id'];}else{var _0x22e01a=_['every'](_[_0xdda2('0x37')](_0x19c1eb,_0xdda2('0x91')),function(_0x3867b3){return _[_0xdda2('0x92')](_0x240048,_0x3867b3);});if(_0x22e01a){return _0x5235d5['id'];}}}));}}return BPromise[_0xdda2('0x93')](_0xb93d3b)[_0xdda2('0x2b')](function(_0xa798dc){_0x1da0dd=_(_0x1da0dd)[_0xdda2('0x94')](_0xa798dc)[_0xdda2('0x95')]()[_0xdda2('0x96')]();return db[_0xdda2('0x48')][_0xdda2('0x50')]({'where':{'id':_0x44e93d[_0xdda2('0x4d')]['id']}})[_0xdda2('0x2b')](function(_0x3cb988){return db[_0xdda2('0x53')]['transaction'](function(_0xe54b68){return _0x3cb988[_0xdda2('0x89')](_0x44e93d[_0xdda2('0x38')][_0xdda2('0x72')],{'transaction':_0xe54b68})[_0xdda2('0x2b')](function(){if(!_[_0xdda2('0x97')](_0x1da0dd)){return _0x3cb988[_0xdda2('0x76')](_0x1da0dd,{'transaction':_0xe54b68});}})[_0xdda2('0x2b')](function(){_0x1da0dd[_0xdda2('0x87')](function(_0x1c008c){socket[_0xdda2('0x75')](_0xdda2('0x78'),{'UserId':_0x1c008c,'VoicePrefixId':_0x3cb988['id']});});});});});});})[_0xdda2('0x2b')](respondWithStatusCode(_0x2defb2,null))[_0xdda2('0x4b')](handleError(_0x2defb2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b52787e..9898901 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 _0xbdfb=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xbdfb,0x11e));var _0xbbdf=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0xbdfb[_0x219cc1];return _0x177034;};'use strict';var EventEmitter=require(_0xbbdf('0x0'));var VoicePrefix=require(_0xbbdf('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbbdf('0x2')](0x0);var events={'afterCreate':_0xbbdf('0x3'),'afterUpdate':_0xbbdf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x282f82){return function(_0x351703,_0x5e76dd,_0x4e60f2){VoicePrefixEvents[_0xbbdf('0x5')](_0x282f82+':'+_0x351703['id'],_0x351703);VoicePrefixEvents[_0xbbdf('0x5')](_0x282f82,_0x351703);_0x4e60f2(null);};}for(var e in events){if(events[_0xbbdf('0x6')](e)){var event=events[e];VoicePrefix[_0xbbdf('0x7')](e,emitEvent(event));}}module[_0xbbdf('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x4e5e=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x1916ea,_0x4f312c){var _0x1373f0=function(_0x25bd5e){while(--_0x25bd5e){_0x1916ea['push'](_0x1916ea['shift']());}};_0x1373f0(++_0x4f312c);}(_0x4e5e,0x193));var _0xe4e5=function(_0x51924d,_0x356028){_0x51924d=_0x51924d-0x0;var _0x52ed00=_0x4e5e[_0x51924d];return _0x52ed00;};'use strict';var EventEmitter=require(_0xe4e5('0x0'));var VoicePrefix=require(_0xe4e5('0x1'))['db'][_0xe4e5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe4e5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4e5('0x4'),'afterDestroy':_0xe4e5('0x5')};function emitEvent(_0x3daa35){return function(_0x5ebdfb,_0x5d3b56,_0x5122ab){VoicePrefixEvents[_0xe4e5('0x6')](_0x3daa35+':'+_0x5ebdfb['id'],_0x5ebdfb);VoicePrefixEvents[_0xe4e5('0x6')](_0x3daa35,_0x5ebdfb);_0x5122ab(null);};}for(var e in events){if(events[_0xe4e5('0x7')](e)){var event=events[e];VoicePrefix[_0xe4e5('0x8')](e,emitEvent(event));}}module[_0xe4e5('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index c59e8cf..97a0286 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 _0x0cb0=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x1d90cb,_0x1f5937){var _0x2dd2fd=function(_0x4a4a0a){while(--_0x4a4a0a){_0x1d90cb['push'](_0x1d90cb['shift']());}};_0x2dd2fd(++_0x1f5937);}(_0x0cb0,0x8e));var _0x00cb=function(_0x4176c8,_0x537620){_0x4176c8=_0x4176c8-0x0;var _0x22fa5a=_0x0cb0[_0x4176c8];return _0x22fa5a;};'use strict';var _=require(_0x00cb('0x0'));var util=require(_0x00cb('0x1'));var logger=require(_0x00cb('0x2'))(_0x00cb('0x3'));var moment=require('moment');var BPromise=require(_0x00cb('0x4'));var rp=require(_0x00cb('0x5'));var fs=require('fs');var path=require(_0x00cb('0x6'));var rimraf=require('rimraf');var config=require(_0x00cb('0x7'));var attributes=require(_0x00cb('0x8'));module['exports']=function(_0x1814fd,_0x45deac){return _0x1814fd[_0x00cb('0x9')](_0x00cb('0xa'),attributes,{'tableName':_0x00cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb907=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x460162,_0x32d95c){var _0xafe415=function(_0x1c1d09){while(--_0x1c1d09){_0x460162['push'](_0x460162['shift']());}};_0xafe415(++_0x32d95c);}(_0xb907,0x1ed));var _0x7b90=function(_0x12248d,_0x3d7302){_0x12248d=_0x12248d-0x0;var _0x3c4803=_0xb907[_0x12248d];return _0x3c4803;};'use strict';var _=require(_0x7b90('0x0'));var util=require(_0x7b90('0x1'));var logger=require(_0x7b90('0x2'))(_0x7b90('0x3'));var moment=require(_0x7b90('0x4'));var BPromise=require(_0x7b90('0x5'));var rp=require(_0x7b90('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b90('0x7'));var config=require(_0x7b90('0x8'));var attributes=require(_0x7b90('0x9'));module[_0x7b90('0xa')]=function(_0x3a8f65,_0x259d61){return _0x3a8f65[_0x7b90('0xb')](_0x7b90('0xc'),attributes,{'tableName':_0x7b90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4c2bf3d..e373536 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 _0x2178=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x3232e6,_0x2f9d20){var _0x2c914b=function(_0x54758f){while(--_0x54758f){_0x3232e6['push'](_0x3232e6['shift']());}};_0x2c914b(++_0x2f9d20);}(_0x2178,0x1b0));var _0x8217=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x2178[_0x543429];return _0x112a46;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var moment=require(_0x8217('0x1'));var BPromise=require(_0x8217('0x2'));var rs=require(_0x8217('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8217('0x4'))['db'];var utils=require(_0x8217('0x5'));var logger=require('../../config/logger')(_0x8217('0x6'));var config=require(_0x8217('0x7'));var jayson=require(_0x8217('0x8'));var client=jayson[_0x8217('0x9')][_0x8217('0xa')]({'port':0x232a});config[_0x8217('0xb')]=_[_0x8217('0xc')](config[_0x8217('0xb')],{'host':_0x8217('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8217('0xe'))[_0x8217('0xf')](socket);function respondWithRpcPromise(_0xe65a16,_0x5f2121,_0xe4d46c){return new BPromise(function(_0x5e5ff3,_0x569eba){return client[_0x8217('0x10')](_0xe65a16,_0xe4d46c)[_0x8217('0x11')](function(_0x3ab032){logger[_0x8217('0x12')](_0x8217('0x13'),_0x5f2121,_0x8217('0x14'));logger[_0x8217('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5f2121,'request\x20sent',JSON['stringify'](_0x3ab032));if(_0x3ab032[_0x8217('0x16')]){if(_0x3ab032[_0x8217('0x16')][_0x8217('0x17')]===0x1f4){logger[_0x8217('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5f2121,_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);return _0x569eba(_0x3ab032[_0x8217('0x16')]['message']);}logger[_0x8217('0x16')](_0x8217('0x13'),_0x5f2121,_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);return _0x5e5ff3(_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);}else{logger[_0x8217('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x5f2121,_0x8217('0x14'));_0x5e5ff3(_0x3ab032[_0x8217('0x19')]['message']);}})[_0x8217('0x1a')](function(_0x16d4a9){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5f2121,_0x16d4a9);_0x569eba(_0x16d4a9);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x5f34e6,_0x10c45f){_0x5f34e6=_0x5f34e6-0x0;var _0x59ff52=_0xd2f5[_0x5f34e6];return _0x59ff52;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});config[_0x5d2f('0xa')]=_['defaults'](config[_0x5d2f('0xa')],{'host':_0x5d2f('0xb'),'port':0x18eb});var socket=require(_0x5d2f('0xc'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x5d2f('0xd')](socket);function respondWithRpcPromise(_0x133332,_0x575f72,_0x1ee975){return new BPromise(function(_0x35f701,_0x5d7327){return client['request'](_0x133332,_0x1ee975)[_0x5d2f('0xe')](function(_0x458f43){logger['info'](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));logger[_0x5d2f('0x11')](_0x5d2f('0x12'),_0x575f72,_0x5d2f('0x10'),JSON[_0x5d2f('0x13')](_0x458f43));if(_0x458f43[_0x5d2f('0x14')]){if(_0x458f43['error']['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x575f72,_0x458f43[_0x5d2f('0x14')]['message']);return _0x5d7327(_0x458f43[_0x5d2f('0x14')][_0x5d2f('0x15')]);}logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x458f43['error'][_0x5d2f('0x15')]);return _0x35f701(_0x458f43[_0x5d2f('0x14')]['message']);}else{logger[_0x5d2f('0x16')](_0x5d2f('0xf'),_0x575f72,_0x5d2f('0x10'));_0x35f701(_0x458f43[_0x5d2f('0x17')][_0x5d2f('0x15')]);}})[_0x5d2f('0x18')](function(_0x12c3e3){logger[_0x5d2f('0x14')](_0x5d2f('0xf'),_0x575f72,_0x12c3e3);_0x5d7327(_0x12c3e3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c61a78b..4a53742 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 _0x902b=['register','./voicePrefix.events','remove','update','emit'];(function(_0x2f7beb,_0x2f6739){var _0x160307=function(_0x4ba6da){while(--_0x4ba6da){_0x2f7beb['push'](_0x2f7beb['shift']());}};_0x160307(++_0x2f6739);}(_0x902b,0x6a));var _0xb902=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x902b[_0x4b2436];return _0x4f5ab2;};'use strict';var VoicePrefixEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){VoicePrefixEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('voicePrefix:'+_0x5b0b74,_0x5d38bb);VoicePrefixEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file +var _0x6594=['register','voicePrefix:','emit'];(function(_0x355d05,_0x510a0b){var _0x4d63a4=function(_0x1db624){while(--_0x1db624){_0x355d05['push'](_0x355d05['shift']());}};_0x4d63a4(++_0x510a0b);}(_0x6594,0xcb));var _0x4659=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x6594[_0x2166a3];return _0x260035;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove','update'];function createListener(_0x309638,_0xda9ca2){return function(_0x365816){_0xda9ca2[_0x4659('0x0')](_0x309638,_0x365816);};}function removeListener(_0x2fa78c,_0x4eedfc){return function(){VoicePrefixEvents['removeListener'](_0x2fa78c,_0x4eedfc);};}exports[_0x4659('0x1')]=function(_0x2f59ce){for(var _0x246729=0x0,_0x45d2e8=events['length'];_0x246729<_0x45d2e8;_0x246729++){var _0x3adf40=events[_0x246729];var _0x39b740=createListener(_0x4659('0x2')+_0x3adf40,_0x2f59ce);VoicePrefixEvents['on'](_0x3adf40,_0x39b740);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4345532..6172d73 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xf90693,_0x5387b8){var _0x2a1412=function(_0x9732ce){while(--_0x9732ce){_0xf90693['push'](_0xf90693['shift']());}};_0x2a1412(++_0x5387b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0xb10b,0x12a));var _0xbb10=function(_0x502a32,_0x23d261){_0x502a32=_0x502a32-0x0;var _0x30191c=_0xb10b[_0x502a32];return _0x30191c;};'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 fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index cfdc1fb..1308d11 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 _0x3fe3=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','default','fewestcalls','rrmemory','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','preview','roundrobin','INTEGER','STRING','yes','once','TEXT','periodic_announce','joinempty','join','split','leavewhenempty'];(function(_0x1e797c,_0x623985){var _0x64c641=function(_0x476f76){while(--_0x476f76){_0x1e797c['push'](_0x1e797c['shift']());}};_0x64c641(++_0x623985);}(_0x3fe3,0x1b2));var _0x33fe=function(_0x195959,_0x2428ec){_0x195959=_0x195959-0x0;var _0x164aef=_0x3fe3[_0x195959];return _0x164aef;};'use strict';var Sequelize=require(_0x33fe('0x0'));module[_0x33fe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x33fe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x4'),_0x33fe('0x5')),'allowNull':![],'defaultValue':_0x33fe('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x33fe('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x33fe('0x3')]('rr','ringall','leastrecent',_0x33fe('0x7'),'random',_0x33fe('0x8'),'linear',_0x33fe('0x9'),_0x33fe('0xa')),'allowNull':![],'defaultValue':_0x33fe('0xb'),'set':function(_0x4961fd){this[_0x33fe('0xc')](_0x33fe('0xd'),_0x4961fd?_0x4961fd:_0x33fe('0x8'));},'get':function(){var _0x1844fe=this['getDataValue'](_0x33fe('0xe'));var _0x26df96=this[_0x33fe('0xf')]('dialMethod');var _0x1dfc7f=this[_0x33fe('0xf')](_0x33fe('0xd'));if(_0x1844fe===_0x33fe('0x5')){if(_0x26df96===_0x33fe('0x10')){return null;}if(_0x26df96==='booked'&&![_0x33fe('0x8'),_0x33fe('0x11')]['includes'](_0x1dfc7f)){this['setDataValue'](_0x33fe('0xd'),'rrmemory');}}return _0x1dfc7f;}},'servicelevel':{'type':Sequelize[_0x33fe('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x33fe('0x13')]},'weight':{'type':Sequelize[_0x33fe('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x33fe('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x33fe('0x14'),'no'),'defaultValue':_0x33fe('0x14')},'autopause':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x33fe('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x33fe('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x33fe('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x33fe('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x33fe('0x13')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x33fe('0x13')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x33fe('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x33fe('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no',_0x33fe('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x33fe('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x33fe('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x33fe('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x33fe('0x13')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x33fe('0x13')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x33fe('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x33fe('0x13')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x33fe('0x16')],'set':function(_0x5a7cc4){this[_0x33fe('0xc')]('periodic_announce',_0x5a7cc4?_0x5a7cc4['join'](','):[]);},'get':function(){return this[_0x33fe('0xf')](_0x33fe('0x17'))?this[_0x33fe('0xf')](_0x33fe('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':_0x33fe('0x14'),'set':function(_0x55a7d5){this[_0x33fe('0xc')](_0x33fe('0x18'),_0x55a7d5?_0x55a7d5[_0x33fe('0x19')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x33fe('0xf')](_0x33fe('0x18'))[_0x33fe('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1e6ff8){this['setDataValue'](_0x33fe('0x1b'),_0x1e6ff8?_0x1e6ff8[_0x33fe('0x19')](','):undefined);},'get':function(){return this[_0x33fe('0xf')](_0x33fe('0x1b'))?this[_0x33fe('0xf')](_0x33fe('0x1b'))[_0x33fe('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x33fe('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x33fe('0x13')]},'description':{'type':Sequelize[_0x33fe('0x13')]},'acw':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':0x0,'set':function(_0x1b739d){this[_0x33fe('0xc')](_0x33fe('0x1d'),_0x1b739d);if(_0x1b739d){if(this[_0x33fe('0xf')](_0x33fe('0x1e'))<0x2){this[_0x33fe('0xc')](_0x33fe('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':0x0,'comment':_0x33fe('0x1f')},'dialMethod':{'type':Sequelize[_0x33fe('0x3')]('preview',_0x33fe('0x20'),_0x33fe('0x21'),_0x33fe('0x22'),_0x33fe('0x23')),'defaultValue':_0x33fe('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x33fe('0x12')](0x4)[_0x33fe('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x33fe('0x25')},'dialLimitQueue':{'type':Sequelize[_0x33fe('0x12')](0x4)[_0x33fe('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x33fe('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x33fe('0x3')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0x33fe('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x33fe('0x28')](0x2)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x33fe('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x33fe('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x33fe('0x13')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x33fe('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x33fe('0x2b'),'comment':_0x33fe('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x2d')},'dialQueueProject':{'type':Sequelize[_0x33fe('0x13')],'comment':_0x33fe('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x33fe('0x32')},'dialTimezone':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':_0x33fe('0x33')},'dialPrefix':{'type':Sequelize[_0x33fe('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x33fe('0x34'),_0x33fe('0x35'),_0x33fe('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x33fe('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x33fe('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x33fe('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x33fe('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x33fe('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x33fe('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x33fe('0x12')](0x9)[_0x33fe('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x33fe('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x33fe('0x12')](0x9)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x33fe('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x33fe('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x33fe('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x33fe('0x12')](0x9)[_0x33fe('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x33fe('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x33fe('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':0x0,'comment':_0x33fe('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x33fe('0x3')]('DESC','ASC'),'defaultValue':_0x33fe('0x40')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x33fe('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x42')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x33fe('0x12')](0x3)[_0x33fe('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x33fe('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x33fe('0x12')](0x5)[_0x33fe('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x33fe('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x33fe('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':![],'comment':_0x33fe('0x4b'),'set':function(_0x7dd189){if(!_0x7dd189)this[_0x33fe('0xc')](_0x33fe('0x4c'),null);this[_0x33fe('0xc')]('mandatoryDisposition',_0x7dd189);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x33fe('0x12')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x33fe('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0x382e=['strategy','rrmemory','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','once','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','inbound','outbound','STRING','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue'];(function(_0x428800,_0x14f0b6){var _0x17e16e=function(_0x30b186){while(--_0x30b186){_0x428800['push'](_0x428800['shift']());}};_0x17e16e(++_0x14f0b6);}(_0x382e,0x17c));var _0xe382=function(_0x34b0a,_0x18640f){_0x34b0a=_0x34b0a-0x0;var _0x2e27f8=_0x382e[_0x34b0a];return _0x2e27f8;};'use strict';var Sequelize=require(_0xe382('0x0'));module[_0xe382('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x3'),_0xe382('0x4')),'allowNull':![],'defaultValue':_0xe382('0x3')},'musiconhold':{'type':Sequelize[_0xe382('0x5')],'defaultValue':_0xe382('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xe382('0x2')]('rr','ringall',_0xe382('0x7'),_0xe382('0x8'),_0xe382('0x9'),'rrmemory',_0xe382('0xa'),_0xe382('0xb'),_0xe382('0xc')),'allowNull':![],'defaultValue':_0xe382('0xd'),'set':function(_0x32cbd7){this[_0xe382('0xe')](_0xe382('0xf'),_0x32cbd7?_0x32cbd7:_0xe382('0x10'));},'get':function(){var _0x9a2872=this[_0xe382('0x11')](_0xe382('0x12'));var _0x445349=this[_0xe382('0x11')](_0xe382('0x13'));var _0x3cfc93=this[_0xe382('0x11')]('strategy');if(_0x9a2872===_0xe382('0x4')){if(_0x445349===_0xe382('0x14')){return null;}if(_0x445349===_0xe382('0x15')&&![_0xe382('0x10'),_0xe382('0x16')]['includes'](_0x3cfc93)){this[_0xe382('0xe')](_0xe382('0xf'),'rrmemory');}}return _0x3cfc93;}},'servicelevel':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe382('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xe382('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':_0xe382('0x18')},'autopause':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no',_0xe382('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe382('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe382('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe382('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe382('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no',_0xe382('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xe382('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe382('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe382('0x5')]},'queue_youarenext':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe382('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe382('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe382('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xe382('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4358d0){this[_0xe382('0xe')](_0xe382('0x1b'),_0x4358d0?_0x4358d0['join'](','):[]);},'get':function(){return this[_0xe382('0x11')](_0xe382('0x1b'))?this['getDataValue'](_0xe382('0x1b'))[_0xe382('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x28f7b6){this[_0xe382('0xe')](_0xe382('0x1d'),_0x28f7b6?_0x28f7b6['join'](','):undefined);},'get':function(){return this[_0xe382('0x11')](_0xe382('0x1d'))?this[_0xe382('0x11')](_0xe382('0x1d'))[_0xe382('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'no','set':function(_0x3c6629){this[_0xe382('0xe')](_0xe382('0x1e'),_0x3c6629?_0x3c6629[_0xe382('0x1f')](','):undefined);},'get':function(){return this['getDataValue'](_0xe382('0x1e'))?this[_0xe382('0x11')](_0xe382('0x1e'))[_0xe382('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe382('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe382('0x5')]},'description':{'type':Sequelize[_0xe382('0x5')]},'acw':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'set':function(_0x4290b5){this[_0xe382('0xe')]('acw',_0x4290b5);if(_0x4290b5){if(this['getDataValue'](_0xe382('0x21'))<0x2){this['setDataValue'](_0xe382('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x22')},'dialMethod':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x14'),'progressive',_0xe382('0x23'),_0xe382('0x24'),_0xe382('0x15')),'defaultValue':_0xe382('0x25'),'comment':_0xe382('0x26')},'dialLimitChannel':{'type':Sequelize[_0xe382('0x17')](0x4)[_0xe382('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xe382('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe382('0x28')},'dialPowerLevel':{'type':Sequelize[_0xe382('0x29')](0x2)[_0xe382('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe382('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xe382('0x2')]('agentBusyFactor','dropRate'),'defaultValue':_0xe382('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe382('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe382('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xe382('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe382('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe382('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xe382('0x5')],'defaultValue':_0xe382('0x2e'),'comment':_0xe382('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xe382('0x5')],'comment':_0xe382('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe382('0x34')},'dialTimezone':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe382('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xe382('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x35'),_0xe382('0x36'),_0xe382('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe382('0x39')},'dialAMDGreeting':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe382('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe382('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe382('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe382('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe382('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe382('0x17')](0x9)['UNSIGNED'],'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':_0xe382('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe382('0x17')](0x9)[_0xe382('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe382('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe382('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xe382('0x20')],'defaultValue':0x0,'comment':_0xe382('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe382('0x2')](_0xe382('0x42'),_0xe382('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xe382('0x5')],'comment':_0xe382('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe382('0x44')},'dialCutDigit':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe382('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe382('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe382('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe382('0x17')](0x5)[_0xe382('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe382('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe382('0x17')],'allowNull':!![],'comment':_0xe382('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x257350){if(!_0x257350)this[_0xe382('0xe')](_0xe382('0x4d'),null);this[_0xe382('0xe')](_0xe382('0x4e'),_0x257350);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe382('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe382('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe382('0x17')](0x3)[_0xe382('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe382('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 80b5743..8cd5762 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 _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x3b35e9,_0x168273){var _0x4120c6=function(_0x20c3b5){while(--_0x20c3b5){_0x3b35e9['push'](_0x3b35e9['shift']());}};_0x4120c6(++_0x168273);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x4b84[_0x23c6f2];return _0x4c270b;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c0cbfab..eb569fb 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 _0x5047=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hook','exports'];(function(_0x44f6ae,_0x1e84f9){var _0x40923f=function(_0x38bf32){while(--_0x38bf32){_0x44f6ae['push'](_0x44f6ae['shift']());}};_0x40923f(++_0x1e84f9);}(_0x5047,0x90));var _0x7504=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x5047[_0x3f6565];return _0x4abd23;};'use strict';var EventEmitter=require(_0x7504('0x0'));var VoiceQueue=require(_0x7504('0x1'))['db'][_0x7504('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7504('0x3')](0x0);var events={'afterCreate':_0x7504('0x4'),'afterUpdate':_0x7504('0x5'),'afterDestroy':'remove'};function emitEvent(_0x256160){return function(_0x2da9d4,_0xf449f4,_0x5e6082){VoiceQueueEvents[_0x7504('0x6')](_0x256160+':'+_0x2da9d4['id'],_0x2da9d4);VoiceQueueEvents[_0x7504('0x6')](_0x256160,_0x2da9d4);_0x5e6082(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x7504('0x7')](e,emitEvent(event));}}module[_0x7504('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3c24=['VoiceQueue','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x465b28,_0x2014d8){var _0x324114=function(_0x522638){while(--_0x522638){_0x465b28['push'](_0x465b28['shift']());}};_0x324114(++_0x2014d8);}(_0x3c24,0x1af));var _0x43c2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3c24[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x43c2('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x43c2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x43c2('0x2')](0x0);var events={'afterCreate':_0x43c2('0x3'),'afterUpdate':_0x43c2('0x4'),'afterDestroy':_0x43c2('0x5')};function emitEvent(_0x19835a){return function(_0x206419,_0x3aaf61,_0x22371e){VoiceQueueEvents['emit'](_0x19835a+':'+_0x206419['id'],_0x206419);VoiceQueueEvents[_0x43c2('0x6')](_0x19835a,_0x206419);_0x22371e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x43c2('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 a34ceb2..27cfe02 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x55ca,0x126));var _0xa55c=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x55ca[_0x1af98d];return _0x3553ea;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x11fbea,_0x1a75b2){var _0x3b0db9=function(_0x574ba7){while(--_0x574ba7){_0x11fbea['push'](_0x11fbea['shift']());}};_0x3b0db9(++_0x1a75b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ab24aad..d6d5473 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 _0x4dde=['map','model','then','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x1ba907,_0x256d25){var _0x4053dd=function(_0x55561c){while(--_0x55561c){_0x1ba907['push'](_0x1ba907['shift']());}};_0x4053dd(++_0x256d25);}(_0x4dde,0x163));var _0xe4dd=function(_0x140d21,_0x3c680e){_0x140d21=_0x140d21-0x0;var _0x5c568e=_0x4dde[_0x140d21];return _0x5c568e;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var moment=require(_0xe4dd('0x2'));var BPromise=require(_0xe4dd('0x3'));var rs=require(_0xe4dd('0x4'));var fs=require('fs');var Redis=require(_0xe4dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4dd('0x6'));var logger=require('../../config/logger')(_0xe4dd('0x7'));var config=require(_0xe4dd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe4dd('0x9')][_0xe4dd('0xa')]({'port':0x232a});config[_0xe4dd('0xb')]=_[_0xe4dd('0xc')](config[_0xe4dd('0xb')],{'host':_0xe4dd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4dd('0xb')]));require(_0xe4dd('0xe'))[_0xe4dd('0xf')](socket);function respondWithRpcPromise(_0x55c14a,_0x5ee87a,_0x46e882){return new BPromise(function(_0x381642,_0x1c121f){return client['request'](_0x55c14a,_0x46e882)['then'](function(_0x52d8d1){logger[_0xe4dd('0x10')](_0xe4dd('0x11'),_0x5ee87a,_0xe4dd('0x12'));logger[_0xe4dd('0x13')](_0xe4dd('0x14'),_0x5ee87a,_0xe4dd('0x12'),JSON[_0xe4dd('0x15')](_0x52d8d1));if(_0x52d8d1[_0xe4dd('0x16')]){if(_0x52d8d1['error'][_0xe4dd('0x17')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5ee87a,_0x52d8d1[_0xe4dd('0x16')][_0xe4dd('0x18')]);return _0x1c121f(_0x52d8d1[_0xe4dd('0x16')][_0xe4dd('0x18')]);}logger[_0xe4dd('0x16')](_0xe4dd('0x11'),_0x5ee87a,_0x52d8d1[_0xe4dd('0x16')][_0xe4dd('0x18')]);return _0x381642(_0x52d8d1['error'][_0xe4dd('0x18')]);}else{logger[_0xe4dd('0x10')](_0xe4dd('0x11'),_0x5ee87a,_0xe4dd('0x12'));_0x381642(_0x52d8d1['result'][_0xe4dd('0x18')]);}})[_0xe4dd('0x19')](function(_0x49b5b6){logger[_0xe4dd('0x16')](_0xe4dd('0x11'),_0x5ee87a,_0x49b5b6);_0x1c121f(_0x49b5b6);});});}exports[_0xe4dd('0x1a')]=function(_0x10c4c5){var _0x5dc7c3=this;return new Promise(function(_0x59cfa2,_0x43808e){return db[_0xe4dd('0x1b')][_0xe4dd('0x1c')]({'raw':_0x10c4c5['options']?_0x10c4c5[_0xe4dd('0x1d')][_0xe4dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x10c4c5[_0xe4dd('0x1d')]?_0x10c4c5['options'][_0xe4dd('0x1f')]||null:null,'attributes':_0x10c4c5[_0xe4dd('0x1d')]?_0x10c4c5[_0xe4dd('0x1d')][_0xe4dd('0x20')]||null:null,'limit':_0x10c4c5[_0xe4dd('0x1d')]?_0x10c4c5[_0xe4dd('0x1d')][_0xe4dd('0x21')]||null:null,'include':_0x10c4c5[_0xe4dd('0x1d')]?_0x10c4c5[_0xe4dd('0x1d')][_0xe4dd('0x22')]?_[_0xe4dd('0x23')](_0x10c4c5[_0xe4dd('0x1d')][_0xe4dd('0x22')],function(_0x45cf66){return{'model':db[_0x45cf66[_0xe4dd('0x24')]],'as':_0x45cf66['as'],'attributes':_0x45cf66['attributes'],'include':_0x45cf66[_0xe4dd('0x22')]?_[_0xe4dd('0x23')](_0x45cf66[_0xe4dd('0x22')],function(_0x4531e7){return{'model':db[_0x4531e7['model']],'as':_0x4531e7['as'],'attributes':_0x4531e7['attributes'],'include':_0x4531e7[_0xe4dd('0x22')]?_[_0xe4dd('0x23')](_0x4531e7[_0xe4dd('0x22')],function(_0x77d74e){return{'model':db[_0x77d74e[_0xe4dd('0x24')]],'as':_0x77d74e['as'],'attributes':_0x77d74e[_0xe4dd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4dd('0x25')](function(_0x52b131){logger['info']('GetVoiceQueue',_0x10c4c5);logger[_0xe4dd('0x13')](_0xe4dd('0x1a'),_0x10c4c5,JSON[_0xe4dd('0x15')](_0x52b131));_0x59cfa2(_0x52b131);})['catch'](function(_0x279e24){logger['error']('GetVoiceQueue',_0x279e24[_0xe4dd('0x18')],_0x10c4c5);_0x43808e(_0x5dc7c3[_0xe4dd('0x16')](0x1f4,_0x279e24['message']));});});};exports[_0xe4dd('0x26')]=function(_0x42767f){var _0x5bd394=this;return new Promise(function(_0x11e2fc,_0x10f04e){return db[_0xe4dd('0x1b')]['find']({'raw':_0x42767f['options']?_0x42767f['options'][_0xe4dd('0x1e')]===undefined?!![]:![]:!![],'where':_0x42767f[_0xe4dd('0x1d')]?_0x42767f[_0xe4dd('0x1d')]['where']||null:null,'attributes':_0x42767f['options']?_0x42767f[_0xe4dd('0x1d')][_0xe4dd('0x20')]||null:null,'include':_0x42767f[_0xe4dd('0x1d')]?_0x42767f[_0xe4dd('0x1d')][_0xe4dd('0x22')]?_['map'](_0x42767f['options'][_0xe4dd('0x22')],function(_0x3b08b8){return{'model':db[_0x3b08b8['model']],'as':_0x3b08b8['as'],'attributes':_0x3b08b8['attributes'],'include':_0x3b08b8[_0xe4dd('0x22')]?_['map'](_0x3b08b8['include'],function(_0x46be91){return{'model':db[_0x46be91['model']],'as':_0x46be91['as'],'attributes':_0x46be91[_0xe4dd('0x20')],'include':_0x46be91[_0xe4dd('0x22')]?_['map'](_0x46be91[_0xe4dd('0x22')],function(_0x646cc4){return{'model':db[_0x646cc4[_0xe4dd('0x24')]],'as':_0x646cc4['as'],'attributes':_0x646cc4[_0xe4dd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4dd('0x25')](function(_0x27939a){logger[_0xe4dd('0x10')](_0xe4dd('0x26'),_0x42767f);logger[_0xe4dd('0x13')]('ShowVoiceQueue',_0x42767f,JSON[_0xe4dd('0x15')](_0x27939a));_0x11e2fc(_0x27939a);})[_0xe4dd('0x19')](function(_0x3d0612){logger['error']('ShowVoiceQueue',_0x3d0612[_0xe4dd('0x18')],_0x42767f);_0x10f04e(_0x5bd394[_0xe4dd('0x16')](0x1f4,_0x3d0612['message']));});});}; \ No newline at end of file +var _0x75cc=['GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x75cc,0xd4));var _0xc75c=function(_0x1ee286,_0x36de03){_0x1ee286=_0x1ee286-0x0;var _0x397326=_0x75cc[_0x1ee286];return _0x397326;};'use strict';var _=require('lodash');var util=require(_0xc75c('0x0'));var moment=require(_0xc75c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc75c('0x2'));var fs=require('fs');var Redis=require(_0xc75c('0x3'));var db=require(_0xc75c('0x4'))['db'];var utils=require(_0xc75c('0x5'));var logger=require(_0xc75c('0x6'))(_0xc75c('0x7'));var config=require('../../config/environment');var jayson=require(_0xc75c('0x8'));var client=jayson[_0xc75c('0x9')][_0xc75c('0xa')]({'port':0x232a});config['redis']=_[_0xc75c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc75c('0xc'))(new Redis(config[_0xc75c('0xd')]));require('./voiceQueue.socket')[_0xc75c('0xe')](socket);function respondWithRpcPromise(_0x1061e5,_0x3a1b5c,_0x30ed2e){return new BPromise(function(_0x1ba8bf,_0x2f8c46){return client[_0xc75c('0xf')](_0x1061e5,_0x30ed2e)[_0xc75c('0x10')](function(_0x14217d){logger[_0xc75c('0x11')](_0xc75c('0x12'),_0x3a1b5c,_0xc75c('0x13'));logger[_0xc75c('0x14')](_0xc75c('0x15'),_0x3a1b5c,_0xc75c('0x13'),JSON[_0xc75c('0x16')](_0x14217d));if(_0x14217d[_0xc75c('0x17')]){if(_0x14217d['error'][_0xc75c('0x18')]===0x1f4){logger[_0xc75c('0x17')](_0xc75c('0x12'),_0x3a1b5c,_0x14217d[_0xc75c('0x17')]['message']);return _0x2f8c46(_0x14217d['error'][_0xc75c('0x19')]);}logger[_0xc75c('0x17')](_0xc75c('0x12'),_0x3a1b5c,_0x14217d[_0xc75c('0x17')][_0xc75c('0x19')]);return _0x1ba8bf(_0x14217d[_0xc75c('0x17')]['message']);}else{logger[_0xc75c('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x3a1b5c,'request\x20sent');_0x1ba8bf(_0x14217d[_0xc75c('0x1a')][_0xc75c('0x19')]);}})[_0xc75c('0x1b')](function(_0x4ec7b9){logger['error'](_0xc75c('0x12'),_0x3a1b5c,_0x4ec7b9);_0x2f8c46(_0x4ec7b9);});});}exports[_0xc75c('0x1c')]=function(_0x21d387){var _0x499f8c=this;return new Promise(function(_0x1f8ce0,_0x40df49){return db['VoiceQueue'][_0xc75c('0x1d')]({'raw':_0x21d387[_0xc75c('0x1e')]?_0x21d387[_0xc75c('0x1e')][_0xc75c('0x1f')]===undefined?!![]:![]:!![],'where':_0x21d387['options']?_0x21d387['options'][_0xc75c('0x20')]||null:null,'attributes':_0x21d387[_0xc75c('0x1e')]?_0x21d387['options'][_0xc75c('0x21')]||null:null,'limit':_0x21d387['options']?_0x21d387['options']['limit']||null:null,'include':_0x21d387['options']?_0x21d387[_0xc75c('0x1e')][_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x21d387[_0xc75c('0x1e')][_0xc75c('0x22')],function(_0x238657){return{'model':db[_0x238657['model']],'as':_0x238657['as'],'attributes':_0x238657[_0xc75c('0x21')],'include':_0x238657['include']?_[_0xc75c('0x23')](_0x238657[_0xc75c('0x22')],function(_0x1c4785){return{'model':db[_0x1c4785['model']],'as':_0x1c4785['as'],'attributes':_0x1c4785[_0xc75c('0x21')],'include':_0x1c4785[_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x1c4785['include'],function(_0x53953f){return{'model':db[_0x53953f[_0xc75c('0x24')]],'as':_0x53953f['as'],'attributes':_0x53953f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc75c('0x10')](function(_0x4d60dd){logger[_0xc75c('0x11')](_0xc75c('0x1c'),_0x21d387);logger[_0xc75c('0x14')]('GetVoiceQueue',_0x21d387,JSON[_0xc75c('0x16')](_0x4d60dd));_0x1f8ce0(_0x4d60dd);})[_0xc75c('0x1b')](function(_0x23dcfa){logger[_0xc75c('0x17')](_0xc75c('0x1c'),_0x23dcfa['message'],_0x21d387);_0x40df49(_0x499f8c[_0xc75c('0x17')](0x1f4,_0x23dcfa['message']));});});};exports[_0xc75c('0x25')]=function(_0x519cf0){var _0x2acc58=this;return new Promise(function(_0x22cde5,_0x22e8f6){return db[_0xc75c('0x26')][_0xc75c('0x27')]({'raw':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x1f')]===undefined?!![]:![]:!![],'where':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x20')]||null:null,'attributes':_0x519cf0[_0xc75c('0x1e')]?_0x519cf0[_0xc75c('0x1e')][_0xc75c('0x21')]||null:null,'include':_0x519cf0['options']?_0x519cf0[_0xc75c('0x1e')]['include']?_['map'](_0x519cf0['options'][_0xc75c('0x22')],function(_0x122f69){return{'model':db[_0x122f69['model']],'as':_0x122f69['as'],'attributes':_0x122f69[_0xc75c('0x21')],'include':_0x122f69['include']?_[_0xc75c('0x23')](_0x122f69[_0xc75c('0x22')],function(_0x530259){return{'model':db[_0x530259['model']],'as':_0x530259['as'],'attributes':_0x530259[_0xc75c('0x21')],'include':_0x530259[_0xc75c('0x22')]?_[_0xc75c('0x23')](_0x530259[_0xc75c('0x22')],function(_0x3581c9){return{'model':db[_0x3581c9[_0xc75c('0x24')]],'as':_0x3581c9['as'],'attributes':_0x3581c9[_0xc75c('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27cb49){logger[_0xc75c('0x11')]('ShowVoiceQueue',_0x519cf0);logger[_0xc75c('0x14')](_0xc75c('0x25'),_0x519cf0,JSON[_0xc75c('0x16')](_0x27cb49));_0x22cde5(_0x27cb49);})[_0xc75c('0x1b')](function(_0x1a2e8e){logger[_0xc75c('0x17')]('ShowVoiceQueue',_0x1a2e8e[_0xc75c('0x19')],_0x519cf0);_0x22e8f6(_0x2acc58[_0xc75c('0x17')](0x1f4,_0x1a2e8e[_0xc75c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4517e46..ee4a81e 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 _0xe11f=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe11f,0x15d));var _0xfe11=function(_0x5b5f97,_0x46b15e){_0x5b5f97=_0x5b5f97-0x0;var _0x2f6001=_0xe11f[_0x5b5f97];return _0x2f6001;};'use strict';var VoiceQueueEvents=require(_0xfe11('0x0'));var events=[_0xfe11('0x1'),_0xfe11('0x2'),_0xfe11('0x3')];function createListener(_0x990257,_0x4eec2b){return function(_0x3d73db){_0x4eec2b[_0xfe11('0x4')](_0x990257,_0x3d73db);};}function removeListener(_0x595967,_0x36d60e){return function(){VoiceQueueEvents['removeListener'](_0x595967,_0x36d60e);};}exports[_0xfe11('0x5')]=function(_0x5806f2){for(var _0x1d24f9=0x0,_0x21815e=events[_0xfe11('0x6')];_0x1d24f9<_0x21815e;_0x1d24f9++){var _0x131793=events[_0x1d24f9];var _0x2f6e26=createListener(_0xfe11('0x7')+_0x131793,_0x5806f2);VoiceQueueEvents['on'](_0x131793,_0x2f6e26);}}; \ No newline at end of file +var _0x36a0=['remove','removeListener','register','save'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x36a0,0x17b));var _0x036a=function(_0x2ae655,_0x9dae){_0x2ae655=_0x2ae655-0x0;var _0x388125=_0x36a0[_0x2ae655];return _0x388125;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x036a('0x0'),_0x036a('0x1'),'update'];function createListener(_0x31177e,_0x35dc71){return function(_0x25f288){_0x35dc71['emit'](_0x31177e,_0x25f288);};}function removeListener(_0x3857f1,_0x1a5b95){return function(){VoiceQueueEvents[_0x036a('0x2')](_0x3857f1,_0x1a5b95);};}exports[_0x036a('0x3')]=function(_0x53a51d){for(var _0x33ca91=0x0,_0x2c623d=events['length'];_0x33ca91<_0x2c623d;_0x33ca91++){var _0x106d13=events[_0x33ca91];var _0x7ed5e5=createListener('voiceQueue:'+_0x106d13,_0x53a51d);VoiceQueueEvents['on'](_0x106d13,_0x7ed5e5);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 39c70eb..7458453 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 _0xb77d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','getVoiceQueuesReport','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb77d,0x12e));var _0xdb77=function(_0x4d9255,_0x374413){_0x4d9255=_0x4d9255-0x0;var _0x19442c=_0xb77d[_0x4d9255];return _0x19442c;};'use strict';var multer=require(_0xdb77('0x0'));var util=require('util');var path=require(_0xdb77('0x1'));var timeout=require(_0xdb77('0x2'));var express=require(_0xdb77('0x3'));var router=express[_0xdb77('0x4')]();var fs_extra=require(_0xdb77('0x5'));var auth=require(_0xdb77('0x6'));var interaction=require(_0xdb77('0x7'));var config=require(_0xdb77('0x8'));var controller=require(_0xdb77('0x9'));router[_0xdb77('0xa')]('/',auth[_0xdb77('0xb')](),controller['index']);router[_0xdb77('0xa')](_0xdb77('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdb77('0xa')]('/index',auth[_0xdb77('0xb')](),controller[_0xdb77('0xd')]);router['get']('/:id',auth[_0xdb77('0xb')](),controller['show']);router[_0xdb77('0xe')]('/',auth[_0xdb77('0xb')](),controller[_0xdb77('0xf')]);router[_0xdb77('0x10')](_0xdb77('0x11'),auth[_0xdb77('0xb')](),controller[_0xdb77('0x12')]);router[_0xdb77('0x13')]('/:id',auth[_0xdb77('0xb')](),controller[_0xdb77('0x14')]);module[_0xdb77('0x15')]=router; \ No newline at end of file +var _0xee58=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','show','post'];(function(_0xed8ae6,_0x1eb5f0){var _0xc3b924=function(_0x3b2ded){while(--_0x3b2ded){_0xed8ae6['push'](_0xed8ae6['shift']());}};_0xc3b924(++_0x1eb5f0);}(_0xee58,0xe0));var _0x8ee5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee58[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x8ee5('0x0'));var path=require(_0x8ee5('0x1'));var timeout=require(_0x8ee5('0x2'));var express=require(_0x8ee5('0x3'));var router=express[_0x8ee5('0x4')]();var fs_extra=require(_0x8ee5('0x5'));var auth=require(_0x8ee5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8ee5('0x7'));var controller=require(_0x8ee5('0x8'));router[_0x8ee5('0x9')]('/',auth[_0x8ee5('0xa')](),controller[_0x8ee5('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8ee5('0x9')](_0x8ee5('0xc'),auth[_0x8ee5('0xa')](),controller['getVoiceQueuesReport']);router[_0x8ee5('0x9')](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0xe')]);router[_0x8ee5('0xf')]('/',auth[_0x8ee5('0xa')](),controller['create']);router['put'](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0x10')]);router[_0x8ee5('0x11')](_0x8ee5('0xd'),auth[_0x8ee5('0xa')](),controller[_0x8ee5('0x12')]);module[_0x8ee5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b876434..599fd55 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 _0x689d=['sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0xc24b83,_0x51b8a9){var _0x17e5ad=function(_0x351b35){while(--_0x351b35){_0xc24b83['push'](_0xc24b83['shift']());}};_0x17e5ad(++_0x51b8a9);}(_0x689d,0x121));var _0xd689=function(_0x74895e,_0x298c35){_0x74895e=_0x74895e-0x0;var _0x40bc2a=_0x689d[_0x74895e];return _0x40bc2a;};'use strict';var Sequelize=require(_0xd689('0x0'));var moment=require('moment');module[_0xd689('0x1')]={'type':{'type':Sequelize[_0xd689('0x2')]},'uniqueid':{'type':Sequelize[_0xd689('0x2')]},'calleridnum':{'type':Sequelize[_0xd689('0x2')]},'calleridname':{'type':Sequelize[_0xd689('0x2')]},'queue':{'type':Sequelize[_0xd689('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xd689('0x3')],'set':function(_0x309241){var _0x52e15e=moment(_0x309241);var _0x1cc252=moment(this[_0xd689('0x4')](_0xd689('0x5')))[_0xd689('0x6')](_0xd689('0x7'));var _0x2efc90=_0x52e15e[_0xd689('0x8')](_0x1cc252,_0xd689('0x9'));this['setDataValue'](_0xd689('0xa'),_0x309241);this[_0xd689('0xb')](_0xd689('0xc'),_0x2efc90||null);}},'position':{'type':Sequelize[_0xd689('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd689('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd689('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xd689('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd689('0x3')]},'queuecallerexit':{'type':Sequelize[_0xd689('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd689('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xd689('0x2')],'comment':_0xd689('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xd689('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd689('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd689('0x2')]},'context':{'type':Sequelize[_0xd689('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd689('0x2')]},'holdtime':{'type':Sequelize[_0xd689('0xd')]},'mohtime':{'type':Sequelize[_0xd689('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd689('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd689('0x2')]},'transfer':{'type':Sequelize[_0xd689('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd689('0x2')],'comment':_0xd689('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd689('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd689('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xd689('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xd689('0x2')]}}; \ No newline at end of file +var _0xece3=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0xece3,0x1d0));var _0x3ece=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xece3[_0x29d2d2];return _0x3f6476;};'use strict';var Sequelize=require(_0x3ece('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3ece('0x1')]},'calleridnum':{'type':Sequelize[_0x3ece('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3ece('0x1')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x3ece('0x2')],'set':function(_0x382650){var _0x28b1cd=moment(_0x382650);var _0x2cbf0e=moment(this[_0x3ece('0x3')](_0x3ece('0x4')))[_0x3ece('0x5')](_0x3ece('0x6'));var _0x1afc24=_0x28b1cd[_0x3ece('0x7')](_0x2cbf0e,_0x3ece('0x8'));this[_0x3ece('0x9')](_0x3ece('0xa'),_0x382650);this[_0x3ece('0x9')]('holdtime',_0x1afc24||null);}},'position':{'type':Sequelize[_0x3ece('0xb')]},'count':{'type':Sequelize[_0x3ece('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3ece('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3ece('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3ece('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3ece('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3ece('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3ece('0x1')]},'exten':{'type':Sequelize[_0x3ece('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3ece('0xb')]},'mohtime':{'type':Sequelize[_0x3ece('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3ece('0x1')]},'transfer':{'type':Sequelize[_0x3ece('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3ece('0x1')],'comment':_0x3ece('0xd')},'transferexten':{'type':Sequelize[_0x3ece('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3ece('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3ece('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x3ece('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3ece('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8c4be32..45a0138 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 _0x4ed3=['apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueueReport','fieldName','type','key','model','query','intersection','fields','attributes','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4ed3,0x81));var _0x34ed=function(_0xb9404d,_0xb9c541){_0xb9404d=_0xb9404d-0x0;var _0x5cfcf7=_0x4ed3[_0xb9404d];return _0x5cfcf7;};'use strict';var emlformat=require(_0x34ed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34ed('0x1'));var jsonpatch=require(_0x34ed('0x2'));var rp=require(_0x34ed('0x3'));var moment=require(_0x34ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ed('0x5'));var util=require(_0x34ed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x34ed('0x7'));var ejs=require(_0x34ed('0x8'));var fs=require('fs');var fs_extra=require(_0x34ed('0x9'));var _=require(_0x34ed('0xa'));var squel=require(_0x34ed('0xb'));var crypto=require('crypto');var jsforce=require(_0x34ed('0xc'));var deskjs=require(_0x34ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x34ed('0xe'));var Papa=require(_0x34ed('0xf'));var Redis=require(_0x34ed('0x10'));var authService=require(_0x34ed('0x11'));var qs=require(_0x34ed('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ed('0x13'));var logger=require(_0x34ed('0x14'))(_0x34ed('0x15'));var utils=require(_0x34ed('0x16'));var config=require(_0x34ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x34ed('0x18')](config[_0x34ed('0x19')],{'host':_0x34ed('0x1a'),'port':0x18eb});var socket=require(_0x34ed('0x1b'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x34ed('0x1c')](socket);function respondWithStatusCode(_0xd52c04,_0x3d3f59){_0x3d3f59=_0x3d3f59||0xcc;return function(_0x22b78a){if(_0x22b78a){return _0xd52c04[_0x34ed('0x1d')](_0x3d3f59);}return _0xd52c04[_0x34ed('0x1e')](_0x3d3f59)[_0x34ed('0x1f')]();};}function respondWithResult(_0x78fe57,_0x552a52){_0x552a52=_0x552a52||0xc8;return function(_0x4d8fe6){if(_0x4d8fe6){return _0x78fe57[_0x34ed('0x1e')](_0x552a52)[_0x34ed('0x20')](_0x4d8fe6);}};}function respondWithFilteredResult(_0x9abd74,_0xe4ce3e){return function(_0x2ab260){if(_0x2ab260){var _0x1e62f4=typeof _0xe4ce3e[_0x34ed('0x21')]===_0x34ed('0x22')&&typeof _0xe4ce3e[_0x34ed('0x23')]===_0x34ed('0x22');var _0x2e3103=_0x2ab260[_0x34ed('0x24')];var _0x3be852=_0x1e62f4?0x0:_0xe4ce3e['offset'];var _0x49b162=_0x1e62f4?_0x2ab260[_0x34ed('0x24')]:_0xe4ce3e['offset']+_0xe4ce3e[_0x34ed('0x23')];var _0x3c2946;if(_0x49b162>=_0x2e3103){_0x49b162=_0x2e3103;_0x3c2946=0xc8;}else{_0x3c2946=0xce;}_0x9abd74['status'](_0x3c2946);return _0x9abd74[_0x34ed('0x25')](_0x34ed('0x26'),_0x3be852+'-'+_0x49b162+'/'+_0x2e3103)[_0x34ed('0x20')](_0x2ab260);}return null;};}function patchUpdates(_0x3cd7a1){return function(_0x5630de){try{jsonpatch[_0x34ed('0x27')](_0x5630de,_0x3cd7a1,!![]);}catch(_0x521a96){return BPromise[_0x34ed('0x28')](_0x521a96);}return _0x5630de[_0x34ed('0x29')]();};}function saveUpdates(_0x4036af,_0x40f651){return function(_0x2d708e){if(_0x2d708e){return _0x2d708e[_0x34ed('0x2a')](_0x4036af)[_0x34ed('0x2b')](function(_0x571982){return _0x571982;});}return null;};}function removeEntity(_0x3b0c30,_0x434004){return function(_0x1025d4){if(_0x1025d4){return _0x1025d4[_0x34ed('0x2c')]()[_0x34ed('0x2b')](function(){_0x3b0c30[_0x34ed('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad5e0,_0x2eab42){return function(_0x3ebd70){if(!_0x3ebd70){_0x4ad5e0[_0x34ed('0x1d')](0x194);}return _0x3ebd70;};}function handleError(_0x5db915,_0x1368b6){_0x1368b6=_0x1368b6||0x1f4;return function(_0x2ef6a2){logger[_0x34ed('0x2d')](_0x2ef6a2[_0x34ed('0x2e')]);if(_0x2ef6a2[_0x34ed('0x2f')]){delete _0x2ef6a2[_0x34ed('0x2f')];}_0x5db915[_0x34ed('0x1e')](_0x1368b6)['send'](_0x2ef6a2);};}exports[_0x34ed('0x30')]=function(_0x586176,_0x2bdf7f){var _0x30c9d1={},_0x4fce5d={},_0x4c84f1={'count':0x0,'rows':[]};var _0x24a6af=_[_0x34ed('0x31')](db[_0x34ed('0x32')]['rawAttributes'],function(_0x249249){return{'name':_0x249249[_0x34ed('0x33')],'type':_0x249249[_0x34ed('0x34')][_0x34ed('0x35')]};});_0x4fce5d[_0x34ed('0x36')]=_[_0x34ed('0x31')](_0x24a6af,_0x34ed('0x2f'));_0x4fce5d[_0x34ed('0x37')]=_['keys'](_0x586176['query']);_0x4fce5d['filters']=_[_0x34ed('0x38')](_0x4fce5d['model'],_0x4fce5d[_0x34ed('0x37')]);_0x30c9d1['attributes']=_[_0x34ed('0x38')](_0x4fce5d['model'],qs['fields'](_0x586176[_0x34ed('0x37')][_0x34ed('0x39')]));_0x30c9d1[_0x34ed('0x3a')]=_0x30c9d1[_0x34ed('0x3a')]['length']?_0x30c9d1[_0x34ed('0x3a')]:_0x4fce5d[_0x34ed('0x36')];if(!_0x586176[_0x34ed('0x37')]['hasOwnProperty']('nolimit')){_0x30c9d1[_0x34ed('0x23')]=qs[_0x34ed('0x23')](_0x586176[_0x34ed('0x37')][_0x34ed('0x23')]);_0x30c9d1['offset']=qs['offset'](_0x586176[_0x34ed('0x37')][_0x34ed('0x21')]);}_0x30c9d1['order']=qs[_0x34ed('0x3b')](_0x586176[_0x34ed('0x37')][_0x34ed('0x3b')]);_0x30c9d1[_0x34ed('0x3c')]=qs[_0x34ed('0x3d')](_[_0x34ed('0x3e')](_0x586176[_0x34ed('0x37')],_0x4fce5d[_0x34ed('0x3d')]),_0x24a6af);if(_0x586176[_0x34ed('0x37')][_0x34ed('0x3f')]){_0x30c9d1[_0x34ed('0x3c')]=_[_0x34ed('0x40')](_0x30c9d1[_0x34ed('0x3c')],{'$or':_[_0x34ed('0x31')](_0x24a6af,function(_0x317229){if(_0x317229[_0x34ed('0x34')]!==_0x34ed('0x41')){var _0xff8620={};_0xff8620[_0x317229[_0x34ed('0x2f')]]={'$like':'%'+_0x586176[_0x34ed('0x37')]['filter']+'%'};return _0xff8620;}})});}_0x30c9d1=_[_0x34ed('0x40')]({},_0x30c9d1,_0x586176['options']);var _0x5ea214={'where':_0x30c9d1['where']};return db[_0x34ed('0x32')][_0x34ed('0x24')](_0x5ea214)[_0x34ed('0x2b')](function(_0x3730fa){_0x4c84f1['count']=_0x3730fa;if(_0x586176['query'][_0x34ed('0x42')]){_0x30c9d1[_0x34ed('0x43')]=[{'all':!![]}];}return db[_0x34ed('0x32')][_0x34ed('0x44')](_0x30c9d1);})[_0x34ed('0x2b')](function(_0x3f26a7){_0x4c84f1[_0x34ed('0x45')]=_0x3f26a7;return _0x4c84f1;})[_0x34ed('0x2b')](respondWithFilteredResult(_0x2bdf7f,_0x30c9d1))[_0x34ed('0x46')](handleError(_0x2bdf7f,null));};exports[_0x34ed('0x47')]=function(_0x43cb88,_0x100e1c){var _0x2c8a17={'raw':![],'where':{'id':_0x43cb88[_0x34ed('0x48')]['id']}},_0x4d2d9f={};_0x4d2d9f[_0x34ed('0x36')]=_[_0x34ed('0x49')](db[_0x34ed('0x32')][_0x34ed('0x4a')]);_0x4d2d9f['query']=_['keys'](_0x43cb88[_0x34ed('0x37')]);_0x4d2d9f[_0x34ed('0x3d')]=_[_0x34ed('0x38')](_0x4d2d9f[_0x34ed('0x36')],_0x4d2d9f[_0x34ed('0x37')]);_0x2c8a17[_0x34ed('0x3a')]=_[_0x34ed('0x38')](_0x4d2d9f['model'],qs['fields'](_0x43cb88['query'][_0x34ed('0x39')]));_0x2c8a17['attributes']=_0x2c8a17[_0x34ed('0x3a')][_0x34ed('0x4b')]?_0x2c8a17[_0x34ed('0x3a')]:_0x4d2d9f['model'];if(_0x43cb88[_0x34ed('0x37')][_0x34ed('0x42')]){_0x2c8a17[_0x34ed('0x43')]=[{'all':!![]}];}_0x2c8a17=_['merge']({},_0x2c8a17,_0x43cb88[_0x34ed('0x4c')]);return db['VoiceQueueReport'][_0x34ed('0x4d')](_0x2c8a17)['then'](handleEntityNotFound(_0x100e1c,null))[_0x34ed('0x2b')](respondWithResult(_0x100e1c,null))[_0x34ed('0x46')](handleError(_0x100e1c,null));};exports[_0x34ed('0x4e')]=function(_0x3b8530,_0x5d9cae){return db[_0x34ed('0x32')][_0x34ed('0x4e')](_0x3b8530[_0x34ed('0x4f')],{})[_0x34ed('0x2b')](respondWithResult(_0x5d9cae,0xc9))[_0x34ed('0x46')](handleError(_0x5d9cae,null));};exports[_0x34ed('0x2a')]=function(_0x40ad55,_0x531e9b){if(_0x40ad55[_0x34ed('0x4f')]['id']){delete _0x40ad55[_0x34ed('0x4f')]['id'];}return db[_0x34ed('0x32')][_0x34ed('0x4d')]({'where':{'id':_0x40ad55[_0x34ed('0x48')]['id']}})[_0x34ed('0x2b')](handleEntityNotFound(_0x531e9b,null))[_0x34ed('0x2b')](saveUpdates(_0x40ad55[_0x34ed('0x4f')],null))[_0x34ed('0x2b')](respondWithResult(_0x531e9b,null))[_0x34ed('0x46')](handleError(_0x531e9b,null));};exports[_0x34ed('0x2c')]=function(_0x31d60f,_0x158e24){return db['VoiceQueueReport'][_0x34ed('0x4d')]({'where':{'id':_0x31d60f[_0x34ed('0x48')]['id']}})[_0x34ed('0x2b')](handleEntityNotFound(_0x158e24,null))[_0x34ed('0x2b')](removeEntity(_0x158e24,null))[_0x34ed('0x46')](handleError(_0x158e24,null));};exports[_0x34ed('0x50')]=function(_0xfa971,_0x280d9e){return db[_0x34ed('0x32')][_0x34ed('0x50')]()[_0x34ed('0x2b')](respondWithResult(_0x280d9e,null))[_0x34ed('0x46')](handleError(_0x280d9e,null));};exports[_0x34ed('0x51')]=function(_0xc4b455,_0x122bb6){var _0x4943ee={},_0x4fc84a={},_0x54c941={'count':0x0,'rows':[]};_0x4fc84a[_0x34ed('0x36')]=_['keys'](db[_0x34ed('0x32')]['rawAttributes']);_0x4fc84a[_0x34ed('0x37')]=_['keys'](_0xc4b455[_0x34ed('0x37')]);_0x4fc84a[_0x34ed('0x3d')]=_[_0x34ed('0x38')](_0x4fc84a[_0x34ed('0x36')],_0x4fc84a[_0x34ed('0x37')]);_0x4943ee['attributes']=_[_0x34ed('0x38')](_0x4fc84a['model'],qs['fields'](_0xc4b455[_0x34ed('0x37')][_0x34ed('0x39')]));_0x4943ee[_0x34ed('0x3a')]=_0x4943ee[_0x34ed('0x3a')][_0x34ed('0x4b')]?_0x4943ee[_0x34ed('0x3a')]:_0x4fc84a[_0x34ed('0x36')];if(!_0xc4b455[_0x34ed('0x37')][_0x34ed('0x52')]('nolimit')){_0x4943ee[_0x34ed('0x23')]=qs['limit'](_0xc4b455[_0x34ed('0x37')][_0x34ed('0x23')]);_0x4943ee[_0x34ed('0x21')]=qs['offset'](_0xc4b455[_0x34ed('0x37')][_0x34ed('0x21')]);}_0x4943ee[_0x34ed('0x53')]=qs[_0x34ed('0x3b')](_0xc4b455[_0x34ed('0x37')][_0x34ed('0x3b')]);_0x4943ee[_0x34ed('0x3c')]=qs[_0x34ed('0x3d')](_[_0x34ed('0x3e')](_0xc4b455[_0x34ed('0x37')],_0x4fc84a[_0x34ed('0x3d')]));if(_0xc4b455[_0x34ed('0x37')]['filter']){_0x4943ee['where']=_[_0x34ed('0x40')](_0x4943ee['where'],{'$or':_[_0x34ed('0x31')](_0x4943ee['attributes'],function(_0xec20d0){var _0x359efa={};_0x359efa[_0xec20d0]={'$like':'%'+_0xc4b455[_0x34ed('0x37')][_0x34ed('0x3f')]+'%'};return _0x359efa;})});}_0x4943ee=_[_0x34ed('0x40')]({},_0x4943ee,_0xc4b455[_0x34ed('0x4c')]);var _0x2cdf5f={'where':_0x4943ee[_0x34ed('0x3c')]};return db[_0x34ed('0x32')][_0x34ed('0x24')](_0x2cdf5f)[_0x34ed('0x2b')](function(_0x404c5c){_0x54c941[_0x34ed('0x24')]=_0x404c5c;if(_0xc4b455[_0x34ed('0x37')][_0x34ed('0x42')]){_0x4943ee[_0x34ed('0x43')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x34ed('0x44')](_0x4943ee);})['then'](function(_0x210848){_0x54c941['rows']=_0x210848;return _0x54c941;})['then'](respondWithFilteredResult(_0x122bb6,_0x4943ee,_0x34ed('0x51')))[_0x34ed('0x46')](handleError(_0x122bb6,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xd026=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','send','map','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','VoiceQueueReport','rows','catch','find','create','body','params','describe','rawAttributes','pick','includeAll','findAll','getVoiceQueuesReport','eml-format'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd026,0xa3));var _0x6d02=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd026[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x6d02('0x0'));var rimraf=require(_0x6d02('0x1'));var zipdir=require(_0x6d02('0x2'));var jsonpatch=require(_0x6d02('0x3'));var rp=require(_0x6d02('0x4'));var moment=require('moment');var BPromise=require(_0x6d02('0x5'));var Mustache=require('mustache');var util=require(_0x6d02('0x6'));var path=require(_0x6d02('0x7'));var sox=require(_0x6d02('0x8'));var csv=require(_0x6d02('0x9'));var ejs=require(_0x6d02('0xa'));var fs=require('fs');var fs_extra=require(_0x6d02('0xb'));var _=require(_0x6d02('0xc'));var squel=require('squel');var crypto=require(_0x6d02('0xd'));var jsforce=require(_0x6d02('0xe'));var deskjs=require(_0x6d02('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d02('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d02('0x11'));var as=require(_0x6d02('0x12'));var hardwareService=require(_0x6d02('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6d02('0x14'));var config=require(_0x6d02('0x15'));var licenseUtil=require(_0x6d02('0x16'));var db=require(_0x6d02('0x17'))['db'];config[_0x6d02('0x18')]=_[_0x6d02('0x19')](config[_0x6d02('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d02('0x1a'))(new Redis(config[_0x6d02('0x18')]));require(_0x6d02('0x1b'))[_0x6d02('0x1c')](socket);function respondWithStatusCode(_0x3d197f,_0x2c7a8e){_0x2c7a8e=_0x2c7a8e||0xcc;return function(_0x2f7979){if(_0x2f7979){return _0x3d197f[_0x6d02('0x1d')](_0x2c7a8e);}return _0x3d197f[_0x6d02('0x1e')](_0x2c7a8e)['end']();};}function respondWithResult(_0x5e3706,_0x5b42c6){_0x5b42c6=_0x5b42c6||0xc8;return function(_0x4027cd){if(_0x4027cd){return _0x5e3706[_0x6d02('0x1e')](_0x5b42c6)[_0x6d02('0x1f')](_0x4027cd);}};}function respondWithFilteredResult(_0x33901e,_0x594669){return function(_0x378c9e){if(_0x378c9e){var _0x3c839a=typeof _0x594669[_0x6d02('0x20')]===_0x6d02('0x21')&&typeof _0x594669['limit']===_0x6d02('0x21');var _0x46f12c=_0x378c9e[_0x6d02('0x22')];var _0x2fdcb5=_0x3c839a?0x0:_0x594669[_0x6d02('0x20')];var _0x1e8baf=_0x3c839a?_0x378c9e[_0x6d02('0x22')]:_0x594669[_0x6d02('0x20')]+_0x594669[_0x6d02('0x23')];var _0x2064ec;if(_0x1e8baf>=_0x46f12c){_0x1e8baf=_0x46f12c;_0x2064ec=0xc8;}else{_0x2064ec=0xce;}_0x33901e['status'](_0x2064ec);return _0x33901e[_0x6d02('0x24')](_0x6d02('0x25'),_0x2fdcb5+'-'+_0x1e8baf+'/'+_0x46f12c)[_0x6d02('0x1f')](_0x378c9e);}return null;};}function patchUpdates(_0x2b9db1){return function(_0x11f018){try{jsonpatch[_0x6d02('0x26')](_0x11f018,_0x2b9db1,!![]);}catch(_0x2e824c){return BPromise[_0x6d02('0x27')](_0x2e824c);}return _0x11f018[_0x6d02('0x28')]();};}function saveUpdates(_0x27f78a,_0x537396){return function(_0x54ca7d){if(_0x54ca7d){return _0x54ca7d['update'](_0x27f78a)['then'](function(_0x284d80){return _0x284d80;});}return null;};}function removeEntity(_0x2e67c8,_0x531b13){return function(_0x58fb4f){if(_0x58fb4f){return _0x58fb4f[_0x6d02('0x29')]()[_0x6d02('0x2a')](function(){_0x2e67c8[_0x6d02('0x1e')](0xcc)[_0x6d02('0x2b')]();});}};}function handleEntityNotFound(_0xe05c2f,_0x2c5438){return function(_0x3a6cb6){if(!_0x3a6cb6){_0xe05c2f[_0x6d02('0x1d')](0x194);}return _0x3a6cb6;};}function handleError(_0x42ec8e,_0x1becb3){_0x1becb3=_0x1becb3||0x1f4;return function(_0x5717a9){logger[_0x6d02('0x2c')](_0x5717a9['stack']);if(_0x5717a9['name']){delete _0x5717a9['name'];}_0x42ec8e[_0x6d02('0x1e')](_0x1becb3)[_0x6d02('0x2d')](_0x5717a9);};}exports['index']=function(_0x44f91a,_0x4cd22a){var _0x35fcd6={},_0x401b3d={},_0x456a9a={'count':0x0,'rows':[]};var _0xd2ecee=_[_0x6d02('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x82113c){return{'name':_0x82113c[_0x6d02('0x2f')],'type':_0x82113c['type'][_0x6d02('0x30')]};});_0x401b3d[_0x6d02('0x31')]=_[_0x6d02('0x2e')](_0xd2ecee,_0x6d02('0x32'));_0x401b3d[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x44f91a[_0x6d02('0x33')]);_0x401b3d[_0x6d02('0x35')]=_[_0x6d02('0x36')](_0x401b3d[_0x6d02('0x31')],_0x401b3d[_0x6d02('0x33')]);_0x35fcd6['attributes']=_[_0x6d02('0x36')](_0x401b3d['model'],qs[_0x6d02('0x37')](_0x44f91a['query'][_0x6d02('0x37')]));_0x35fcd6[_0x6d02('0x38')]=_0x35fcd6[_0x6d02('0x38')][_0x6d02('0x39')]?_0x35fcd6['attributes']:_0x401b3d['model'];if(!_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3a')](_0x6d02('0x3b'))){_0x35fcd6[_0x6d02('0x23')]=qs['limit'](_0x44f91a[_0x6d02('0x33')][_0x6d02('0x23')]);_0x35fcd6[_0x6d02('0x20')]=qs['offset'](_0x44f91a['query'][_0x6d02('0x20')]);}_0x35fcd6[_0x6d02('0x3c')]=qs[_0x6d02('0x3d')](_0x44f91a['query']['sort']);_0x35fcd6[_0x6d02('0x3e')]=qs[_0x6d02('0x35')](_['pick'](_0x44f91a['query'],_0x401b3d[_0x6d02('0x35')]),_0xd2ecee);if(_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3f')]){_0x35fcd6[_0x6d02('0x3e')]=_[_0x6d02('0x40')](_0x35fcd6[_0x6d02('0x3e')],{'$or':_['map'](_0xd2ecee,function(_0x2fbc5b){if(_0x2fbc5b[_0x6d02('0x41')]!==_0x6d02('0x42')){var _0x4b3202={};_0x4b3202[_0x2fbc5b[_0x6d02('0x32')]]={'$like':'%'+_0x44f91a[_0x6d02('0x33')][_0x6d02('0x3f')]+'%'};return _0x4b3202;}})});}_0x35fcd6=_[_0x6d02('0x40')]({},_0x35fcd6,_0x44f91a[_0x6d02('0x43')]);var _0xcfbd2={'where':_0x35fcd6[_0x6d02('0x3e')]};return db['VoiceQueueReport']['count'](_0xcfbd2)[_0x6d02('0x2a')](function(_0x1ac1d7){_0x456a9a['count']=_0x1ac1d7;if(_0x44f91a[_0x6d02('0x33')]['includeAll']){_0x35fcd6[_0x6d02('0x44')]=[{'all':!![]}];}return db[_0x6d02('0x45')]['findAll'](_0x35fcd6);})[_0x6d02('0x2a')](function(_0x31be3a){_0x456a9a[_0x6d02('0x46')]=_0x31be3a;return _0x456a9a;})[_0x6d02('0x2a')](respondWithFilteredResult(_0x4cd22a,_0x35fcd6))[_0x6d02('0x47')](handleError(_0x4cd22a,null));};exports['show']=function(_0x5f1246,_0x47ab4c){var _0x5bd210={'raw':![],'where':{'id':_0x5f1246['params']['id']}},_0x33f3c0={};_0x33f3c0['model']=_[_0x6d02('0x34')](db[_0x6d02('0x45')]['rawAttributes']);_0x33f3c0[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x5f1246[_0x6d02('0x33')]);_0x33f3c0[_0x6d02('0x35')]=_['intersection'](_0x33f3c0[_0x6d02('0x31')],_0x33f3c0[_0x6d02('0x33')]);_0x5bd210['attributes']=_[_0x6d02('0x36')](_0x33f3c0[_0x6d02('0x31')],qs[_0x6d02('0x37')](_0x5f1246[_0x6d02('0x33')][_0x6d02('0x37')]));_0x5bd210['attributes']=_0x5bd210[_0x6d02('0x38')]['length']?_0x5bd210[_0x6d02('0x38')]:_0x33f3c0[_0x6d02('0x31')];if(_0x5f1246[_0x6d02('0x33')]['includeAll']){_0x5bd210[_0x6d02('0x44')]=[{'all':!![]}];}_0x5bd210=_[_0x6d02('0x40')]({},_0x5bd210,_0x5f1246[_0x6d02('0x43')]);return db[_0x6d02('0x45')][_0x6d02('0x48')](_0x5bd210)[_0x6d02('0x2a')](handleEntityNotFound(_0x47ab4c,null))[_0x6d02('0x2a')](respondWithResult(_0x47ab4c,null))[_0x6d02('0x47')](handleError(_0x47ab4c,null));};exports[_0x6d02('0x49')]=function(_0x2f9ee6,_0x29909e){return db[_0x6d02('0x45')][_0x6d02('0x49')](_0x2f9ee6['body'],{})['then'](respondWithResult(_0x29909e,0xc9))[_0x6d02('0x47')](handleError(_0x29909e,null));};exports['update']=function(_0x5ce41f,_0x4da002){if(_0x5ce41f['body']['id']){delete _0x5ce41f[_0x6d02('0x4a')]['id'];}return db[_0x6d02('0x45')][_0x6d02('0x48')]({'where':{'id':_0x5ce41f[_0x6d02('0x4b')]['id']}})[_0x6d02('0x2a')](handleEntityNotFound(_0x4da002,null))['then'](saveUpdates(_0x5ce41f[_0x6d02('0x4a')],null))[_0x6d02('0x2a')](respondWithResult(_0x4da002,null))[_0x6d02('0x47')](handleError(_0x4da002,null));};exports[_0x6d02('0x29')]=function(_0x5e83fb,_0x258cad){return db['VoiceQueueReport'][_0x6d02('0x48')]({'where':{'id':_0x5e83fb[_0x6d02('0x4b')]['id']}})[_0x6d02('0x2a')](handleEntityNotFound(_0x258cad,null))[_0x6d02('0x2a')](removeEntity(_0x258cad,null))[_0x6d02('0x47')](handleError(_0x258cad,null));};exports[_0x6d02('0x4c')]=function(_0x269ebb,_0x548579){return db[_0x6d02('0x45')][_0x6d02('0x4c')]()[_0x6d02('0x2a')](respondWithResult(_0x548579,null))[_0x6d02('0x47')](handleError(_0x548579,null));};exports['getVoiceQueuesReport']=function(_0x4a80b5,_0x3d3b84){var _0x266262={},_0x5471de={},_0x2acd96={'count':0x0,'rows':[]};_0x5471de[_0x6d02('0x31')]=_[_0x6d02('0x34')](db['VoiceQueueReport'][_0x6d02('0x4d')]);_0x5471de[_0x6d02('0x33')]=_[_0x6d02('0x34')](_0x4a80b5[_0x6d02('0x33')]);_0x5471de[_0x6d02('0x35')]=_[_0x6d02('0x36')](_0x5471de[_0x6d02('0x31')],_0x5471de[_0x6d02('0x33')]);_0x266262[_0x6d02('0x38')]=_['intersection'](_0x5471de[_0x6d02('0x31')],qs[_0x6d02('0x37')](_0x4a80b5['query'][_0x6d02('0x37')]));_0x266262['attributes']=_0x266262['attributes']['length']?_0x266262[_0x6d02('0x38')]:_0x5471de[_0x6d02('0x31')];if(!_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3a')]('nolimit')){_0x266262[_0x6d02('0x23')]=qs[_0x6d02('0x23')](_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x23')]);_0x266262[_0x6d02('0x20')]=qs[_0x6d02('0x20')](_0x4a80b5['query'][_0x6d02('0x20')]);}_0x266262[_0x6d02('0x3c')]=qs[_0x6d02('0x3d')](_0x4a80b5['query'][_0x6d02('0x3d')]);_0x266262[_0x6d02('0x3e')]=qs[_0x6d02('0x35')](_[_0x6d02('0x4e')](_0x4a80b5[_0x6d02('0x33')],_0x5471de[_0x6d02('0x35')]));if(_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3f')]){_0x266262['where']=_[_0x6d02('0x40')](_0x266262[_0x6d02('0x3e')],{'$or':_[_0x6d02('0x2e')](_0x266262['attributes'],function(_0x3b7659){var _0x52d5d2={};_0x52d5d2[_0x3b7659]={'$like':'%'+_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x3f')]+'%'};return _0x52d5d2;})});}_0x266262=_['merge']({},_0x266262,_0x4a80b5['options']);var _0x5d1194={'where':_0x266262[_0x6d02('0x3e')]};return db[_0x6d02('0x45')][_0x6d02('0x22')](_0x5d1194)[_0x6d02('0x2a')](function(_0x476a87){_0x2acd96[_0x6d02('0x22')]=_0x476a87;if(_0x4a80b5[_0x6d02('0x33')][_0x6d02('0x4f')]){_0x266262[_0x6d02('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6d02('0x50')](_0x266262);})[_0x6d02('0x2a')](function(_0x5a627d){_0x2acd96[_0x6d02('0x46')]=_0x5a627d;return _0x2acd96;})[_0x6d02('0x2a')](respondWithFilteredResult(_0x3d3b84,_0x266262,_0x6d02('0x51')))[_0x6d02('0x47')](handleError(_0x3d3b84,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 61aed1a..9baf4da 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 _0x4ff5=['update','remove','emit','hook','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0x4ff5,0x184));var _0x54ff=function(_0x19f242,_0x3f137a){_0x19f242=_0x19f242-0x0;var _0x16da06=_0x4ff5[_0x19f242];return _0x16da06;};'use strict';var EventEmitter=require(_0x54ff('0x0'));var VoiceQueueReport=require(_0x54ff('0x1'))['db'][_0x54ff('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54ff('0x3'),'afterUpdate':_0x54ff('0x4'),'afterDestroy':_0x54ff('0x5')};function emitEvent(_0x2c2f03){return function(_0x41d9c3,_0x396cac,_0x1c75ca){VoiceQueueReportEvents['emit'](_0x2c2f03+':'+_0x41d9c3['id'],_0x41d9c3);VoiceQueueReportEvents[_0x54ff('0x6')](_0x2c2f03,_0x41d9c3);_0x1c75ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x54ff('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x2cc5=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4f8a18,_0x4a5d74){var _0x4c5092=function(_0xec3d73){while(--_0xec3d73){_0x4f8a18['push'](_0x4f8a18['shift']());}};_0x4c5092(++_0x4a5d74);}(_0x2cc5,0x80));var _0x52cc=function(_0x2f823d,_0x2e39f6){_0x2f823d=_0x2f823d-0x0;var _0x2d5a59=_0x2cc5[_0x2f823d];return _0x2d5a59;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x52cc('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x52cc('0x1')](0x0);var events={'afterCreate':_0x52cc('0x2'),'afterUpdate':_0x52cc('0x3'),'afterDestroy':_0x52cc('0x4')};function emitEvent(_0x494113){return function(_0x61c95f,_0x546322,_0x5b780b){VoiceQueueReportEvents[_0x52cc('0x5')](_0x494113+':'+_0x61c95f['id'],_0x61c95f);VoiceQueueReportEvents[_0x52cc('0x5')](_0x494113,_0x61c95f);_0x5b780b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x52cc('0x6')](e,emitEvent(event));}}module[_0x52cc('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 10beff2..a21a86e 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 _0x84e4=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define','calleridnum','lodash'];(function(_0x11ed69,_0x4e1f98){var _0x4e12de=function(_0x20ed9e){while(--_0x20ed9e){_0x11ed69['push'](_0x11ed69['shift']());}};_0x4e12de(++_0x4e1f98);}(_0x84e4,0xef));var _0x484e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x84e4[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x484e('0x0'));var util=require(_0x484e('0x1'));var logger=require(_0x484e('0x2'))(_0x484e('0x3'));var moment=require(_0x484e('0x4'));var BPromise=require(_0x484e('0x5'));var rp=require(_0x484e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x484e('0x7'));var config=require(_0x484e('0x8'));var attributes=require(_0x484e('0x9'));module['exports']=function(_0x15212b,_0x39e1f7){return _0x15212b[_0x484e('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x484e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64dc=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x25390b,_0x1771ca){var _0x490180=function(_0x54d40f){while(--_0x54d40f){_0x25390b['push'](_0x25390b['shift']());}};_0x490180(++_0x1771ca);}(_0x64dc,0x1d7));var _0xc64d=function(_0x37e368,_0x3b1ec9){_0x37e368=_0x37e368-0x0;var _0x43a1a3=_0x64dc[_0x37e368];return _0x43a1a3;};'use strict';var _=require(_0xc64d('0x0'));var util=require(_0xc64d('0x1'));var logger=require('../../config/logger')(_0xc64d('0x2'));var moment=require('moment');var BPromise=require(_0xc64d('0x3'));var rp=require(_0xc64d('0x4'));var fs=require('fs');var path=require(_0xc64d('0x5'));var rimraf=require(_0xc64d('0x6'));var config=require(_0xc64d('0x7'));var attributes=require(_0xc64d('0x8'));module[_0xc64d('0x9')]=function(_0x14d280,_0x5967bd){return _0x14d280[_0xc64d('0xa')](_0xc64d('0xb'),attributes,{'tableName':_0xc64d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc64d('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a7bcca9..44d3d78 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 _0x6876=['include','map','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','options','raw','attributes'];(function(_0x415dd2,_0x369726){var _0x122e03=function(_0x59da16){while(--_0x59da16){_0x415dd2['push'](_0x415dd2['shift']());}};_0x122e03(++_0x369726);}(_0x6876,0x8c));var _0x6687=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0x6876[_0x5decec];return _0x35e1b4;};'use strict';var _=require(_0x6687('0x0'));var util=require(_0x6687('0x1'));var moment=require(_0x6687('0x2'));var BPromise=require(_0x6687('0x3'));var rs=require(_0x6687('0x4'));var fs=require('fs');var Redis=require(_0x6687('0x5'));var db=require(_0x6687('0x6'))['db'];var utils=require(_0x6687('0x7'));var logger=require('../../config/logger')(_0x6687('0x8'));var config=require(_0x6687('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6687('0xa')]['http']({'port':0x232a});config[_0x6687('0xb')]=_[_0x6687('0xc')](config[_0x6687('0xb')],{'host':_0x6687('0xd'),'port':0x18eb});var socket=require(_0x6687('0xe'))(new Redis(config[_0x6687('0xb')]));require(_0x6687('0xf'))[_0x6687('0x10')](socket);function respondWithRpcPromise(_0x38573f,_0x512cea,_0x37c658){return new BPromise(function(_0xe4aeb0,_0x5b5517){return client['request'](_0x38573f,_0x37c658)[_0x6687('0x11')](function(_0x2022d6){logger[_0x6687('0x12')](_0x6687('0x13'),_0x512cea,_0x6687('0x14'));logger['debug'](_0x6687('0x15'),_0x512cea,_0x6687('0x14'),JSON[_0x6687('0x16')](_0x2022d6));if(_0x2022d6[_0x6687('0x17')]){if(_0x2022d6[_0x6687('0x17')][_0x6687('0x18')]===0x1f4){logger[_0x6687('0x17')](_0x6687('0x13'),_0x512cea,_0x2022d6[_0x6687('0x17')][_0x6687('0x19')]);return _0x5b5517(_0x2022d6[_0x6687('0x17')][_0x6687('0x19')]);}logger[_0x6687('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x512cea,_0x2022d6[_0x6687('0x17')][_0x6687('0x19')]);return _0xe4aeb0(_0x2022d6['error'][_0x6687('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x512cea,_0x6687('0x14'));_0xe4aeb0(_0x2022d6[_0x6687('0x1a')]['message']);}})[_0x6687('0x1b')](function(_0x3336e0){logger[_0x6687('0x17')](_0x6687('0x13'),_0x512cea,_0x3336e0);_0x5b5517(_0x3336e0);});});}exports['GetVoiceQueueReport']=function(_0x36757f){var _0xa942b2=this;return new Promise(function(_0x587caf,_0x3efe17){return db[_0x6687('0x1c')]['findAll']({'raw':_0x36757f[_0x6687('0x1d')]?_0x36757f[_0x6687('0x1d')][_0x6687('0x1e')]===undefined?!![]:![]:!![],'where':_0x36757f[_0x6687('0x1d')]?_0x36757f[_0x6687('0x1d')]['where']||null:null,'attributes':_0x36757f[_0x6687('0x1d')]?_0x36757f[_0x6687('0x1d')][_0x6687('0x1f')]||null:null,'limit':_0x36757f[_0x6687('0x1d')]?_0x36757f['options']['limit']||null:null,'include':_0x36757f[_0x6687('0x1d')]?_0x36757f[_0x6687('0x1d')][_0x6687('0x20')]?_[_0x6687('0x21')](_0x36757f[_0x6687('0x1d')]['include'],function(_0x4f3f2d){return{'model':db[_0x4f3f2d['model']],'as':_0x4f3f2d['as'],'attributes':_0x4f3f2d['attributes'],'include':_0x4f3f2d['include']?_[_0x6687('0x21')](_0x4f3f2d['include'],function(_0xc9ddbe){return{'model':db[_0xc9ddbe[_0x6687('0x22')]],'as':_0xc9ddbe['as'],'attributes':_0xc9ddbe[_0x6687('0x1f')],'include':_0xc9ddbe[_0x6687('0x20')]?_[_0x6687('0x21')](_0xc9ddbe[_0x6687('0x20')],function(_0x383d68){return{'model':db[_0x383d68[_0x6687('0x22')]],'as':_0x383d68['as'],'attributes':_0x383d68[_0x6687('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6687('0x11')](function(_0x32f1da){logger[_0x6687('0x12')](_0x6687('0x23'),_0x36757f);logger[_0x6687('0x24')](_0x6687('0x23'),_0x36757f,JSON[_0x6687('0x16')](_0x32f1da));_0x587caf(_0x32f1da);})['catch'](function(_0x62ee1f){logger[_0x6687('0x17')]('GetVoiceQueueReport',_0x62ee1f['message'],_0x36757f);_0x3efe17(_0xa942b2[_0x6687('0x17')](0x1f4,_0x62ee1f[_0x6687('0x19')]));});});};exports[_0x6687('0x25')]=function(_0x279dc8){var _0x55b234=this;return new Promise(function(_0xb6c4e,_0x475257){return db[_0x6687('0x1c')][_0x6687('0x26')](_0x279dc8['body'],{'raw':_0x279dc8[_0x6687('0x1d')]?_0x279dc8['options']['raw']===undefined?!![]:![]:!![]})[_0x6687('0x11')](function(_0x561b86){logger[_0x6687('0x12')](_0x6687('0x25'),_0x279dc8);logger[_0x6687('0x24')]('CreateVoiceQueueReport',_0x279dc8,JSON[_0x6687('0x16')](_0x561b86));_0xb6c4e(_0x561b86);})[_0x6687('0x1b')](function(_0x123361){logger[_0x6687('0x17')](_0x6687('0x25'),_0x123361[_0x6687('0x19')],_0x279dc8);_0x475257(_0x55b234[_0x6687('0x17')](0x1f4,_0x123361[_0x6687('0x19')]));});});};exports[_0x6687('0x27')]=function(_0x2e3470){var _0x45ceda=this;return new Promise(function(_0x3cdf62,_0x4a6080){return db[_0x6687('0x1c')][_0x6687('0x28')](_0x2e3470[_0x6687('0x29')],{'raw':_0x2e3470[_0x6687('0x1d')]?_0x2e3470[_0x6687('0x1d')][_0x6687('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e3470[_0x6687('0x1d')]?_0x2e3470[_0x6687('0x1d')][_0x6687('0x2a')]||null:null,'attributes':_0x2e3470[_0x6687('0x1d')]?_0x2e3470[_0x6687('0x1d')][_0x6687('0x1f')]||null:null,'limit':_0x2e3470[_0x6687('0x1d')]?_0x2e3470['options']['limit']||null:null})[_0x6687('0x11')](function(_0x4148ad){logger[_0x6687('0x12')](_0x6687('0x27'),_0x2e3470);logger[_0x6687('0x24')]('UpdateVoiceQueueReport',_0x2e3470,JSON[_0x6687('0x16')](_0x4148ad));_0x3cdf62(_0x4148ad);})[_0x6687('0x1b')](function(_0x53d963){logger['error'](_0x6687('0x27'),_0x53d963['message'],_0x2e3470);_0x4a6080(_0x45ceda[_0x6687('0x17')](0x1f4,_0x53d963[_0x6687('0x19')]));});});}; \ No newline at end of file +var _0xa828=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','then','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','where','lodash','bluebird','randomstring'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa828,0xa1));var _0x8a82=function(_0x3e255a,_0x18a2c3){_0x3e255a=_0x3e255a-0x0;var _0xf0f7d3=_0xa828[_0x3e255a];return _0xf0f7d3;};'use strict';var _=require(_0x8a82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a82('0x1'));var rs=require(_0x8a82('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a82('0x3'))['db'];var utils=require(_0x8a82('0x4'));var logger=require(_0x8a82('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a82('0x6'));var client=jayson[_0x8a82('0x7')]['http']({'port':0x232a});config[_0x8a82('0x8')]=_[_0x8a82('0x9')](config[_0x8a82('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a82('0xa'))(new Redis(config[_0x8a82('0x8')]));require(_0x8a82('0xb'))[_0x8a82('0xc')](socket);function respondWithRpcPromise(_0x27fe9,_0x303001,_0x7bd625){return new BPromise(function(_0x9d9579,_0x3bb4c1){return client[_0x8a82('0xd')](_0x27fe9,_0x7bd625)['then'](function(_0x1f1f06){logger[_0x8a82('0xe')](_0x8a82('0xf'),_0x303001,_0x8a82('0x10'));logger[_0x8a82('0x11')](_0x8a82('0x12'),_0x303001,_0x8a82('0x10'),JSON['stringify'](_0x1f1f06));if(_0x1f1f06['error']){if(_0x1f1f06['error'][_0x8a82('0x13')]===0x1f4){logger[_0x8a82('0x14')](_0x8a82('0xf'),_0x303001,_0x1f1f06['error'][_0x8a82('0x15')]);return _0x3bb4c1(_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);}logger['error'](_0x8a82('0xf'),_0x303001,_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);return _0x9d9579(_0x1f1f06[_0x8a82('0x14')][_0x8a82('0x15')]);}else{logger[_0x8a82('0xe')](_0x8a82('0xf'),_0x303001,_0x8a82('0x10'));_0x9d9579(_0x1f1f06[_0x8a82('0x16')]['message']);}})[_0x8a82('0x17')](function(_0x42f620){logger[_0x8a82('0x14')](_0x8a82('0xf'),_0x303001,_0x42f620);_0x3bb4c1(_0x42f620);});});}exports[_0x8a82('0x18')]=function(_0x30545a){var _0xeaefe3=this;return new Promise(function(_0x156ca8,_0x531b0f){return db[_0x8a82('0x19')][_0x8a82('0x1a')]({'raw':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1c')]===undefined?!![]:![]:!![],'where':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')]['where']||null:null,'attributes':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1d')]||null:null,'limit':_0x30545a['options']?_0x30545a[_0x8a82('0x1b')]['limit']||null:null,'include':_0x30545a[_0x8a82('0x1b')]?_0x30545a[_0x8a82('0x1b')][_0x8a82('0x1e')]?_[_0x8a82('0x1f')](_0x30545a['options'][_0x8a82('0x1e')],function(_0xcbaaf5){return{'model':db[_0xcbaaf5[_0x8a82('0x20')]],'as':_0xcbaaf5['as'],'attributes':_0xcbaaf5[_0x8a82('0x1d')],'include':_0xcbaaf5['include']?_['map'](_0xcbaaf5[_0x8a82('0x1e')],function(_0x5f079e){return{'model':db[_0x5f079e['model']],'as':_0x5f079e['as'],'attributes':_0x5f079e[_0x8a82('0x1d')],'include':_0x5f079e[_0x8a82('0x1e')]?_[_0x8a82('0x1f')](_0x5f079e[_0x8a82('0x1e')],function(_0x2bfcb4){return{'model':db[_0x2bfcb4[_0x8a82('0x20')]],'as':_0x2bfcb4['as'],'attributes':_0x2bfcb4[_0x8a82('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8a82('0x21')](function(_0x40ec83){logger[_0x8a82('0xe')](_0x8a82('0x18'),_0x30545a);logger[_0x8a82('0x11')](_0x8a82('0x18'),_0x30545a,JSON['stringify'](_0x40ec83));_0x156ca8(_0x40ec83);})['catch'](function(_0x81a651){logger['error'](_0x8a82('0x18'),_0x81a651[_0x8a82('0x15')],_0x30545a);_0x531b0f(_0xeaefe3[_0x8a82('0x14')](0x1f4,_0x81a651[_0x8a82('0x15')]));});});};exports[_0x8a82('0x22')]=function(_0x3339b0){var _0x1c5da7=this;return new Promise(function(_0x606092,_0x5e7c9c){return db[_0x8a82('0x19')][_0x8a82('0x23')](_0x3339b0[_0x8a82('0x24')],{'raw':_0x3339b0[_0x8a82('0x1b')]?_0x3339b0['options'][_0x8a82('0x1c')]===undefined?!![]:![]:!![]})[_0x8a82('0x21')](function(_0x979a06){logger[_0x8a82('0xe')]('CreateVoiceQueueReport',_0x3339b0);logger['debug']('CreateVoiceQueueReport',_0x3339b0,JSON[_0x8a82('0x25')](_0x979a06));_0x606092(_0x979a06);})[_0x8a82('0x17')](function(_0x367a64){logger[_0x8a82('0x14')](_0x8a82('0x22'),_0x367a64[_0x8a82('0x15')],_0x3339b0);_0x5e7c9c(_0x1c5da7[_0x8a82('0x14')](0x1f4,_0x367a64[_0x8a82('0x15')]));});});};exports[_0x8a82('0x26')]=function(_0x4d0131){var _0x1cf234=this;return new Promise(function(_0x516d5b,_0x3265bc){return db[_0x8a82('0x19')][_0x8a82('0x27')](_0x4d0131[_0x8a82('0x24')],{'raw':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')][_0x8a82('0x28')]||null:null,'attributes':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')][_0x8a82('0x1d')]||null:null,'limit':_0x4d0131[_0x8a82('0x1b')]?_0x4d0131[_0x8a82('0x1b')]['limit']||null:null})['then'](function(_0x2816d4){logger[_0x8a82('0xe')](_0x8a82('0x26'),_0x4d0131);logger[_0x8a82('0x11')](_0x8a82('0x26'),_0x4d0131,JSON['stringify'](_0x2816d4));_0x516d5b(_0x2816d4);})[_0x8a82('0x17')](function(_0x495fc4){logger['error'](_0x8a82('0x26'),_0x495fc4[_0x8a82('0x15')],_0x4d0131);_0x3265bc(_0x1cf234[_0x8a82('0x14')](0x1f4,_0x495fc4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a7d0631..b4df861 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 _0x10c4=['register','length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0x41cf2f,_0x584728){var _0x141d66=function(_0x2b4518){while(--_0x2b4518){_0x41cf2f['push'](_0x41cf2f['shift']());}};_0x141d66(++_0x584728);}(_0x10c4,0x16b));var _0x410c=function(_0xe70123,_0x200cb1){_0xe70123=_0xe70123-0x0;var _0x4fbcda=_0x10c4[_0xe70123];return _0x4fbcda;};'use strict';var VoiceQueueReportEvents=require(_0x410c('0x0'));var events=['save',_0x410c('0x1'),_0x410c('0x2')];function createListener(_0x2a1ad1,_0xc180b3){return function(_0x29ce8a){_0xc180b3[_0x410c('0x3')](_0x2a1ad1,_0x29ce8a);};}function removeListener(_0x551326,_0x11ba89){return function(){VoiceQueueReportEvents[_0x410c('0x4')](_0x551326,_0x11ba89);};}exports[_0x410c('0x5')]=function(_0xff4178){for(var _0xa9bd5d=0x0,_0xa21a21=events[_0x410c('0x6')];_0xa9bd5d<_0xa21a21;_0xa9bd5d++){var _0xe8295b=events[_0xa9bd5d];var _0x5027fe=createListener(_0x410c('0x7')+_0xe8295b,_0xff4178);VoiceQueueReportEvents['on'](_0xe8295b,_0x5027fe);}}; \ No newline at end of file +var _0x3937=['register','length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3937,0xbf));var _0x7393=function(_0x31a171,_0x1bf70f){_0x31a171=_0x31a171-0x0;var _0x21f35e=_0x3937[_0x31a171];return _0x21f35e;};'use strict';var VoiceQueueReportEvents=require(_0x7393('0x0'));var events=['save',_0x7393('0x1'),_0x7393('0x2')];function createListener(_0x49aa96,_0x45cd02){return function(_0x503841){_0x45cd02[_0x7393('0x3')](_0x49aa96,_0x503841);};}function removeListener(_0x4c9c71,_0x992b15){return function(){VoiceQueueReportEvents[_0x7393('0x4')](_0x4c9c71,_0x992b15);};}exports[_0x7393('0x5')]=function(_0x1f538f){for(var _0x15eabd=0x0,_0x42bdd1=events[_0x7393('0x6')];_0x15eabd<_0x42bdd1;_0x15eabd++){var _0x26668a=events[_0x15eabd];var _0x944b0b=createListener('voiceQueueReport:'+_0x26668a,_0x1f538f);VoiceQueueReportEvents['on'](_0x26668a,_0x944b0b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3889feb..1584461 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 _0x8f69=['path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x237070,_0x210cda){var _0x35bb75=function(_0x25c9fc){while(--_0x25c9fc){_0x237070['push'](_0x237070['shift']());}};_0x35bb75(++_0x210cda);}(_0x8f69,0xfa));var _0x98f6=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x8f69[_0x588011];return _0x3b3773;};'use strict';var multer=require(_0x98f6('0x0'));var util=require(_0x98f6('0x1'));var path=require(_0x98f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x98f6('0x3'));var router=express[_0x98f6('0x4')]();var fs_extra=require(_0x98f6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98f6('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x98f6('0x7')]('/',auth[_0x98f6('0x8')](),controller[_0x98f6('0x9')]);router[_0x98f6('0x7')]('/:id',auth[_0x98f6('0x8')](),controller[_0x98f6('0xa')]);router[_0x98f6('0xb')]('/',auth[_0x98f6('0x8')](),controller[_0x98f6('0xc')]);router['put'](_0x98f6('0xd'),auth[_0x98f6('0x8')](),controller[_0x98f6('0xe')]);router[_0x98f6('0xf')]('/:id',auth[_0x98f6('0x8')](),controller[_0x98f6('0x10')]);module[_0x98f6('0x11')]=router; \ No newline at end of file +var _0x62ee=['isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','get','index'];(function(_0xeeaea0,_0x26add7){var _0xc42514=function(_0x26bff9){while(--_0x26bff9){_0xeeaea0['push'](_0xeeaea0['shift']());}};_0xc42514(++_0x26add7);}(_0x62ee,0x13a));var _0xe62e=function(_0x43a493,_0x5e38e9){_0x43a493=_0x43a493-0x0;var _0x296719=_0x62ee[_0x43a493];return _0x296719;};'use strict';var multer=require(_0xe62e('0x0'));var util=require(_0xe62e('0x1'));var path=require(_0xe62e('0x2'));var timeout=require(_0xe62e('0x3'));var express=require('express');var router=express[_0xe62e('0x4')]();var fs_extra=require(_0xe62e('0x5'));var auth=require(_0xe62e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe62e('0x7'));router[_0xe62e('0x8')]('/',auth['isAuthenticated'](),controller[_0xe62e('0x9')]);router[_0xe62e('0x8')]('/:id',auth[_0xe62e('0xa')](),controller[_0xe62e('0xb')]);router[_0xe62e('0xc')]('/',auth[_0xe62e('0xa')](),controller[_0xe62e('0xd')]);router['put'](_0xe62e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe62e('0xf')](_0xe62e('0xe'),auth[_0xe62e('0xa')](),controller[_0xe62e('0x10')]);module[_0xe62e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7e1d418..c9c1c0c 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 _0x7de4=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x7de4,0x87));var _0x47de=function(_0x54cd86,_0x39c927){_0x54cd86=_0x54cd86-0x0;var _0xc94f81=_0x7de4[_0x54cd86];return _0xc94f81;};'use strict';var Sequelize=require(_0x47de('0x0'));var moment=require(_0x47de('0x1'));module['exports']={'time':{'type':Sequelize[_0x47de('0x2')]},'callid':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x47de('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x47de('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x47de('0x4')](_0x47de('0x5'))}}; \ No newline at end of file +var _0x6e6b=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','STRING','DATE'];(function(_0x274e82,_0x2b3e01){var _0x361183=function(_0x419b3c){while(--_0x419b3c){_0x274e82['push'](_0x274e82['shift']());}};_0x361183(++_0x2b3e01);}(_0x6e6b,0x131));var _0xb6e6=function(_0x1655b9,_0xaa1be5){_0x1655b9=_0x1655b9-0x0;var _0x51988d=_0x6e6b[_0x1655b9];return _0x51988d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb6e6('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb6e6('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb6e6('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xb6e6('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f54bb02..f24cc2f 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 _0xda1a=['pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda1a,0x141));var _0xada1=function(_0x139428,_0x5ce0e7){_0x139428=_0x139428-0x0;var _0x1b2a2b=_0xda1a[_0x139428];return _0x1b2a2b;};'use strict';var emlformat=require(_0xada1('0x0'));var rimraf=require(_0xada1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xada1('0x2'));var rp=require(_0xada1('0x3'));var moment=require(_0xada1('0x4'));var BPromise=require(_0xada1('0x5'));var Mustache=require(_0xada1('0x6'));var util=require(_0xada1('0x7'));var path=require(_0xada1('0x8'));var sox=require(_0xada1('0x9'));var csv=require(_0xada1('0xa'));var ejs=require(_0xada1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xada1('0xc'));var squel=require(_0xada1('0xd'));var crypto=require(_0xada1('0xe'));var jsforce=require(_0xada1('0xf'));var deskjs=require(_0xada1('0x10'));var toCsv=require(_0xada1('0xa'));var querystring=require(_0xada1('0x11'));var Papa=require(_0xada1('0x12'));var Redis=require(_0xada1('0x13'));var authService=require(_0xada1('0x14'));var qs=require(_0xada1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xada1('0x16'));var logger=require(_0xada1('0x17'))('api');var utils=require(_0xada1('0x18'));var config=require(_0xada1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xada1('0x1a'))['db'];function respondWithStatusCode(_0x53f8a1,_0x1028bd){_0x1028bd=_0x1028bd||0xcc;return function(_0x45309f){if(_0x45309f){return _0x53f8a1[_0xada1('0x1b')](_0x1028bd);}return _0x53f8a1[_0xada1('0x1c')](_0x1028bd)[_0xada1('0x1d')]();};}function respondWithResult(_0x39c01c,_0x17df0b){_0x17df0b=_0x17df0b||0xc8;return function(_0x3aa8d8){if(_0x3aa8d8){return _0x39c01c['status'](_0x17df0b)[_0xada1('0x1e')](_0x3aa8d8);}};}function respondWithFilteredResult(_0x59f990,_0x37167c){return function(_0xb4646f){if(_0xb4646f){var _0x1050a0=typeof _0x37167c[_0xada1('0x1f')]===_0xada1('0x20')&&typeof _0x37167c[_0xada1('0x21')]===_0xada1('0x20');var _0x3e55c2=_0xb4646f['count'];var _0x42e722=_0x1050a0?0x0:_0x37167c[_0xada1('0x1f')];var _0x2b7419=_0x1050a0?_0xb4646f[_0xada1('0x22')]:_0x37167c['offset']+_0x37167c[_0xada1('0x21')];var _0x1bbb68;if(_0x2b7419>=_0x3e55c2){_0x2b7419=_0x3e55c2;_0x1bbb68=0xc8;}else{_0x1bbb68=0xce;}_0x59f990[_0xada1('0x1c')](_0x1bbb68);return _0x59f990['set'](_0xada1('0x23'),_0x42e722+'-'+_0x2b7419+'/'+_0x3e55c2)[_0xada1('0x1e')](_0xb4646f);}return null;};}function patchUpdates(_0x6aee3f){return function(_0x216baf){try{jsonpatch['apply'](_0x216baf,_0x6aee3f,!![]);}catch(_0x3ea6c){return BPromise['reject'](_0x3ea6c);}return _0x216baf['save']();};}function saveUpdates(_0x1b8a6a,_0x38f575){return function(_0x5a5845){if(_0x5a5845){return _0x5a5845['update'](_0x1b8a6a)[_0xada1('0x24')](function(_0x429760){return _0x429760;});}return null;};}function removeEntity(_0x22062a,_0x2f1ba1){return function(_0xc83165){if(_0xc83165){return _0xc83165['destroy']()['then'](function(){_0x22062a[_0xada1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a5cd,_0x26ae19){return function(_0x5c8158){if(!_0x5c8158){_0x55a5cd[_0xada1('0x1b')](0x194);}return _0x5c8158;};}function handleError(_0x29170f,_0x314903){_0x314903=_0x314903||0x1f4;return function(_0x3ada4f){logger['error'](_0x3ada4f[_0xada1('0x25')]);if(_0x3ada4f[_0xada1('0x26')]){delete _0x3ada4f[_0xada1('0x26')];}_0x29170f[_0xada1('0x1c')](_0x314903)[_0xada1('0x27')](_0x3ada4f);};}exports[_0xada1('0x28')]=function(_0x365580,_0x2e4e47){var _0x175711={},_0x470b27={},_0x208f7e={'count':0x0,'rows':[]};var _0x36ca7b=_[_0xada1('0x29')](db[_0xada1('0x2a')][_0xada1('0x2b')],function(_0x205e8f){return{'name':_0x205e8f[_0xada1('0x2c')],'type':_0x205e8f[_0xada1('0x2d')][_0xada1('0x2e')]};});_0x470b27[_0xada1('0x2f')]=_[_0xada1('0x29')](_0x36ca7b,'name');_0x470b27[_0xada1('0x30')]=_['keys'](_0x365580[_0xada1('0x30')]);_0x470b27[_0xada1('0x31')]=_[_0xada1('0x32')](_0x470b27[_0xada1('0x2f')],_0x470b27[_0xada1('0x30')]);_0x175711[_0xada1('0x33')]=_['intersection'](_0x470b27[_0xada1('0x2f')],qs['fields'](_0x365580[_0xada1('0x30')][_0xada1('0x34')]));_0x175711[_0xada1('0x33')]=_0x175711[_0xada1('0x33')][_0xada1('0x35')]?_0x175711[_0xada1('0x33')]:_0x470b27[_0xada1('0x2f')];if(!_0x365580['query'][_0xada1('0x36')](_0xada1('0x37'))){_0x175711[_0xada1('0x21')]=qs[_0xada1('0x21')](_0x365580['query'][_0xada1('0x21')]);_0x175711[_0xada1('0x1f')]=qs[_0xada1('0x1f')](_0x365580['query'][_0xada1('0x1f')]);}_0x175711[_0xada1('0x38')]=qs[_0xada1('0x39')](_0x365580[_0xada1('0x30')][_0xada1('0x39')]);_0x175711[_0xada1('0x3a')]=qs[_0xada1('0x31')](_[_0xada1('0x3b')](_0x365580[_0xada1('0x30')],_0x470b27['filters']),_0x36ca7b);if(_0x365580[_0xada1('0x30')][_0xada1('0x3c')]){_0x175711[_0xada1('0x3a')]=_['merge'](_0x175711[_0xada1('0x3a')],{'$or':_[_0xada1('0x29')](_0x36ca7b,function(_0x411926){if(_0x411926[_0xada1('0x2d')]!==_0xada1('0x3d')){var _0xe0d2e5={};_0xe0d2e5[_0x411926[_0xada1('0x26')]]={'$like':'%'+_0x365580[_0xada1('0x30')][_0xada1('0x3c')]+'%'};return _0xe0d2e5;}})});}_0x175711=_[_0xada1('0x3e')]({},_0x175711,_0x365580[_0xada1('0x3f')]);var _0xfc1c1b={'where':_0x175711[_0xada1('0x3a')]};return db[_0xada1('0x2a')][_0xada1('0x22')](_0xfc1c1b)[_0xada1('0x24')](function(_0x2af435){_0x208f7e[_0xada1('0x22')]=_0x2af435;if(_0x365580['query']['includeAll']){_0x175711['include']=[{'all':!![]}];}return db[_0xada1('0x2a')][_0xada1('0x40')](_0x175711);})[_0xada1('0x24')](function(_0x2744fe){_0x208f7e[_0xada1('0x41')]=_0x2744fe;return _0x208f7e;})[_0xada1('0x24')](respondWithFilteredResult(_0x2e4e47,_0x175711))[_0xada1('0x42')](handleError(_0x2e4e47,null));};exports[_0xada1('0x43')]=function(_0x5a7e99,_0x3819ec){var _0x2ad252={'raw':!![],'where':{'id':_0x5a7e99[_0xada1('0x44')]['id']}},_0x2b17f3={};_0x2b17f3[_0xada1('0x2f')]=_[_0xada1('0x45')](db['VoiceQueuesLog'][_0xada1('0x2b')]);_0x2b17f3[_0xada1('0x30')]=_['keys'](_0x5a7e99[_0xada1('0x30')]);_0x2b17f3[_0xada1('0x31')]=_[_0xada1('0x32')](_0x2b17f3[_0xada1('0x2f')],_0x2b17f3[_0xada1('0x30')]);_0x2ad252[_0xada1('0x33')]=_[_0xada1('0x32')](_0x2b17f3[_0xada1('0x2f')],qs[_0xada1('0x34')](_0x5a7e99[_0xada1('0x30')]['fields']));_0x2ad252[_0xada1('0x33')]=_0x2ad252['attributes']['length']?_0x2ad252[_0xada1('0x33')]:_0x2b17f3[_0xada1('0x2f')];if(_0x5a7e99[_0xada1('0x30')][_0xada1('0x46')]){_0x2ad252['include']=[{'all':!![]}];}_0x2ad252=_[_0xada1('0x3e')]({},_0x2ad252,_0x5a7e99[_0xada1('0x3f')]);return db[_0xada1('0x2a')][_0xada1('0x47')](_0x2ad252)[_0xada1('0x24')](handleEntityNotFound(_0x3819ec,null))[_0xada1('0x24')](respondWithResult(_0x3819ec,null))[_0xada1('0x42')](handleError(_0x3819ec,null));};exports['create']=function(_0x2ab03a,_0x29f76b){return db[_0xada1('0x2a')][_0xada1('0x48')](_0x2ab03a[_0xada1('0x49')],{})[_0xada1('0x24')](respondWithResult(_0x29f76b,0xc9))['catch'](handleError(_0x29f76b,null));};exports[_0xada1('0x4a')]=function(_0x2100c4,_0x536fa6){if(_0x2100c4[_0xada1('0x49')]['id']){delete _0x2100c4[_0xada1('0x49')]['id'];}return db[_0xada1('0x2a')]['find']({'where':{'id':_0x2100c4['params']['id']}})[_0xada1('0x24')](handleEntityNotFound(_0x536fa6,null))['then'](saveUpdates(_0x2100c4['body'],null))[_0xada1('0x24')](respondWithResult(_0x536fa6,null))['catch'](handleError(_0x536fa6,null));};exports[_0xada1('0x4b')]=function(_0x37dc91,_0x798816){return db[_0xada1('0x2a')][_0xada1('0x47')]({'where':{'id':_0x37dc91[_0xada1('0x44')]['id']}})[_0xada1('0x24')](handleEntityNotFound(_0x798816,null))[_0xada1('0x24')](removeEntity(_0x798816,null))[_0xada1('0x42')](handleError(_0x798816,null));}; \ No newline at end of file +var _0xdd83=['to-csv','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','length','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4816df,_0x49a7fa){var _0x4cc86b=function(_0x622b41){while(--_0x622b41){_0x4816df['push'](_0x4816df['shift']());}};_0x4cc86b(++_0x49a7fa);}(_0xdd83,0xc4));var _0x3dd8=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdd83[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x3dd8('0x0'));var rimraf=require(_0x3dd8('0x1'));var zipdir=require(_0x3dd8('0x2'));var jsonpatch=require(_0x3dd8('0x3'));var rp=require(_0x3dd8('0x4'));var moment=require(_0x3dd8('0x5'));var BPromise=require(_0x3dd8('0x6'));var Mustache=require(_0x3dd8('0x7'));var util=require(_0x3dd8('0x8'));var path=require(_0x3dd8('0x9'));var sox=require(_0x3dd8('0xa'));var csv=require(_0x3dd8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dd8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3dd8('0xb'));var querystring=require(_0x3dd8('0xd'));var Papa=require(_0x3dd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3dd8('0xf'));var as=require(_0x3dd8('0x10'));var hardwareService=require(_0x3dd8('0x11'));var logger=require(_0x3dd8('0x12'))('api');var utils=require(_0x3dd8('0x13'));var config=require(_0x3dd8('0x14'));var licenseUtil=require(_0x3dd8('0x15'));var db=require(_0x3dd8('0x16'))['db'];function respondWithStatusCode(_0x4390a5,_0x4d460c){_0x4d460c=_0x4d460c||0xcc;return function(_0x23361b){if(_0x23361b){return _0x4390a5[_0x3dd8('0x17')](_0x4d460c);}return _0x4390a5[_0x3dd8('0x18')](_0x4d460c)[_0x3dd8('0x19')]();};}function respondWithResult(_0x373516,_0x57044c){_0x57044c=_0x57044c||0xc8;return function(_0x445d00){if(_0x445d00){return _0x373516[_0x3dd8('0x18')](_0x57044c)[_0x3dd8('0x1a')](_0x445d00);}};}function respondWithFilteredResult(_0x390d8e,_0x56af76){return function(_0x5a70e4){if(_0x5a70e4){var _0x266d11=typeof _0x56af76[_0x3dd8('0x1b')]==='undefined'&&typeof _0x56af76['limit']===_0x3dd8('0x1c');var _0xd107e9=_0x5a70e4[_0x3dd8('0x1d')];var _0x1c427b=_0x266d11?0x0:_0x56af76[_0x3dd8('0x1b')];var _0x481b0e=_0x266d11?_0x5a70e4[_0x3dd8('0x1d')]:_0x56af76[_0x3dd8('0x1b')]+_0x56af76[_0x3dd8('0x1e')];var _0xd5013a;if(_0x481b0e>=_0xd107e9){_0x481b0e=_0xd107e9;_0xd5013a=0xc8;}else{_0xd5013a=0xce;}_0x390d8e[_0x3dd8('0x18')](_0xd5013a);return _0x390d8e['set'](_0x3dd8('0x1f'),_0x1c427b+'-'+_0x481b0e+'/'+_0xd107e9)[_0x3dd8('0x1a')](_0x5a70e4);}return null;};}function patchUpdates(_0x12a130){return function(_0x1b9186){try{jsonpatch[_0x3dd8('0x20')](_0x1b9186,_0x12a130,!![]);}catch(_0xc185a0){return BPromise[_0x3dd8('0x21')](_0xc185a0);}return _0x1b9186[_0x3dd8('0x22')]();};}function saveUpdates(_0x581c6a,_0x1f2cf9){return function(_0x3788a9){if(_0x3788a9){return _0x3788a9['update'](_0x581c6a)[_0x3dd8('0x23')](function(_0x44aa30){return _0x44aa30;});}return null;};}function removeEntity(_0xc264e8,_0x1584a1){return function(_0xa54c6){if(_0xa54c6){return _0xa54c6['destroy']()[_0x3dd8('0x23')](function(){_0xc264e8[_0x3dd8('0x18')](0xcc)[_0x3dd8('0x19')]();});}};}function handleEntityNotFound(_0x178c10,_0x52114f){return function(_0x1602e5){if(!_0x1602e5){_0x178c10['sendStatus'](0x194);}return _0x1602e5;};}function handleError(_0xc961cc,_0xc5c57c){_0xc5c57c=_0xc5c57c||0x1f4;return function(_0x587525){logger[_0x3dd8('0x24')](_0x587525[_0x3dd8('0x25')]);if(_0x587525[_0x3dd8('0x26')]){delete _0x587525[_0x3dd8('0x26')];}_0xc961cc[_0x3dd8('0x18')](_0xc5c57c)[_0x3dd8('0x27')](_0x587525);};}exports['index']=function(_0x433920,_0x16e9ac){var _0xdf2643={},_0x522396={},_0x30db0c={'count':0x0,'rows':[]};var _0x56f652=_[_0x3dd8('0x28')](db[_0x3dd8('0x29')][_0x3dd8('0x2a')],function(_0x56614b){return{'name':_0x56614b[_0x3dd8('0x2b')],'type':_0x56614b['type']['key']};});_0x522396[_0x3dd8('0x2c')]=_[_0x3dd8('0x28')](_0x56f652,_0x3dd8('0x26'));_0x522396[_0x3dd8('0x2d')]=_[_0x3dd8('0x2e')](_0x433920['query']);_0x522396['filters']=_[_0x3dd8('0x2f')](_0x522396[_0x3dd8('0x2c')],_0x522396[_0x3dd8('0x2d')]);_0xdf2643['attributes']=_[_0x3dd8('0x2f')](_0x522396[_0x3dd8('0x2c')],qs[_0x3dd8('0x30')](_0x433920['query']['fields']));_0xdf2643[_0x3dd8('0x31')]=_0xdf2643['attributes']['length']?_0xdf2643[_0x3dd8('0x31')]:_0x522396[_0x3dd8('0x2c')];if(!_0x433920['query']['hasOwnProperty'](_0x3dd8('0x32'))){_0xdf2643[_0x3dd8('0x1e')]=qs[_0x3dd8('0x1e')](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x1e')]);_0xdf2643[_0x3dd8('0x1b')]=qs['offset'](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x1b')]);}_0xdf2643['order']=qs[_0x3dd8('0x33')](_0x433920[_0x3dd8('0x2d')][_0x3dd8('0x33')]);_0xdf2643['where']=qs[_0x3dd8('0x34')](_['pick'](_0x433920[_0x3dd8('0x2d')],_0x522396[_0x3dd8('0x34')]),_0x56f652);if(_0x433920['query'][_0x3dd8('0x35')]){_0xdf2643[_0x3dd8('0x36')]=_['merge'](_0xdf2643[_0x3dd8('0x36')],{'$or':_['map'](_0x56f652,function(_0x381e44){if(_0x381e44[_0x3dd8('0x37')]!==_0x3dd8('0x38')){var _0x3de15b={};_0x3de15b[_0x381e44[_0x3dd8('0x26')]]={'$like':'%'+_0x433920['query'][_0x3dd8('0x35')]+'%'};return _0x3de15b;}})});}_0xdf2643=_[_0x3dd8('0x39')]({},_0xdf2643,_0x433920[_0x3dd8('0x3a')]);var _0x206680={'where':_0xdf2643[_0x3dd8('0x36')]};return db[_0x3dd8('0x29')][_0x3dd8('0x1d')](_0x206680)['then'](function(_0x1bb4c5){_0x30db0c['count']=_0x1bb4c5;if(_0x433920['query'][_0x3dd8('0x3b')]){_0xdf2643[_0x3dd8('0x3c')]=[{'all':!![]}];}return db[_0x3dd8('0x29')]['findAll'](_0xdf2643);})[_0x3dd8('0x23')](function(_0x10ad48){_0x30db0c[_0x3dd8('0x3d')]=_0x10ad48;return _0x30db0c;})[_0x3dd8('0x23')](respondWithFilteredResult(_0x16e9ac,_0xdf2643))['catch'](handleError(_0x16e9ac,null));};exports['show']=function(_0x2e2d8b,_0x322739){var _0x162dcb={'raw':!![],'where':{'id':_0x2e2d8b['params']['id']}},_0x23a189={};_0x23a189['model']=_[_0x3dd8('0x2e')](db[_0x3dd8('0x29')][_0x3dd8('0x2a')]);_0x23a189['query']=_[_0x3dd8('0x2e')](_0x2e2d8b[_0x3dd8('0x2d')]);_0x23a189[_0x3dd8('0x34')]=_['intersection'](_0x23a189[_0x3dd8('0x2c')],_0x23a189['query']);_0x162dcb[_0x3dd8('0x31')]=_[_0x3dd8('0x2f')](_0x23a189[_0x3dd8('0x2c')],qs[_0x3dd8('0x30')](_0x2e2d8b[_0x3dd8('0x2d')]['fields']));_0x162dcb[_0x3dd8('0x31')]=_0x162dcb[_0x3dd8('0x31')][_0x3dd8('0x3e')]?_0x162dcb['attributes']:_0x23a189[_0x3dd8('0x2c')];if(_0x2e2d8b[_0x3dd8('0x2d')][_0x3dd8('0x3b')]){_0x162dcb['include']=[{'all':!![]}];}_0x162dcb=_[_0x3dd8('0x39')]({},_0x162dcb,_0x2e2d8b['options']);return db['VoiceQueuesLog'][_0x3dd8('0x3f')](_0x162dcb)[_0x3dd8('0x23')](handleEntityNotFound(_0x322739,null))[_0x3dd8('0x23')](respondWithResult(_0x322739,null))[_0x3dd8('0x40')](handleError(_0x322739,null));};exports[_0x3dd8('0x41')]=function(_0xfd0f35,_0x5e3625){return db['VoiceQueuesLog'][_0x3dd8('0x41')](_0xfd0f35[_0x3dd8('0x42')],{})[_0x3dd8('0x23')](respondWithResult(_0x5e3625,0xc9))[_0x3dd8('0x40')](handleError(_0x5e3625,null));};exports['update']=function(_0x1c96d2,_0x28bf2d){if(_0x1c96d2['body']['id']){delete _0x1c96d2['body']['id'];}return db[_0x3dd8('0x29')][_0x3dd8('0x3f')]({'where':{'id':_0x1c96d2[_0x3dd8('0x43')]['id']}})['then'](handleEntityNotFound(_0x28bf2d,null))[_0x3dd8('0x23')](saveUpdates(_0x1c96d2[_0x3dd8('0x42')],null))[_0x3dd8('0x23')](respondWithResult(_0x28bf2d,null))[_0x3dd8('0x40')](handleError(_0x28bf2d,null));};exports[_0x3dd8('0x44')]=function(_0x514af6,_0x37bdfa){return db[_0x3dd8('0x29')][_0x3dd8('0x3f')]({'where':{'id':_0x514af6[_0x3dd8('0x43')]['id']}})[_0x3dd8('0x23')](handleEntityNotFound(_0x37bdfa,null))[_0x3dd8('0x23')](removeEntity(_0x37bdfa,null))['catch'](handleError(_0x37bdfa,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9433b27..e4ba095 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 _0x6788=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','../../config/logger','api'];(function(_0x54cd9e,_0x43a812){var _0x4ad30d=function(_0x57e30c){while(--_0x57e30c){_0x54cd9e['push'](_0x54cd9e['shift']());}};_0x4ad30d(++_0x43a812);}(_0x6788,0x1bd));var _0x8678=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x6788[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x8678('0x0'));var util=require('util');var logger=require(_0x8678('0x1'))(_0x8678('0x2'));var moment=require(_0x8678('0x3'));var BPromise=require(_0x8678('0x4'));var rp=require(_0x8678('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8678('0x6'));var config=require(_0x8678('0x7'));var attributes=require(_0x8678('0x8'));module[_0x8678('0x9')]=function(_0x529058,_0x3c4839){return _0x529058['define'](_0x8678('0xa'),attributes,{'tableName':_0x8678('0xb'),'paranoid':![],'indexes':[{'name':_0x8678('0xc'),'fields':['event',_0x8678('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8d4c=['../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4294ce,_0x277093){var _0x232aaa=function(_0x3f5916){while(--_0x3f5916){_0x4294ce['push'](_0x4294ce['shift']());}};_0x232aaa(++_0x277093);}(_0x8d4c,0x173));var _0xc8d4=function(_0x47c0c1,_0x2fd98f){_0x47c0c1=_0x47c0c1-0x0;var _0x48e551=_0x8d4c[_0x47c0c1];return _0x48e551;};'use strict';var _=require(_0xc8d4('0x0'));var util=require('util');var logger=require(_0xc8d4('0x1'))(_0xc8d4('0x2'));var moment=require(_0xc8d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8d4('0x4'));var fs=require('fs');var path=require(_0xc8d4('0x5'));var rimraf=require(_0xc8d4('0x6'));var config=require(_0xc8d4('0x7'));var attributes=require(_0xc8d4('0x8'));module[_0xc8d4('0x9')]=function(_0x1838f5,_0x4258ec){return _0x1838f5[_0xc8d4('0xa')](_0xc8d4('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc8d4('0xc'),'fields':[_0xc8d4('0xd'),'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 b4260c4..4a381f8 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 _0x191a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird'];(function(_0xa0c1cd,_0x51c281){var _0x71bc07=function(_0x46f48e){while(--_0x46f48e){_0xa0c1cd['push'](_0xa0c1cd['shift']());}};_0x71bc07(++_0x51c281);}(_0x191a,0xef));var _0xa191=function(_0x563b1c,_0x3d52d5){_0x563b1c=_0x563b1c-0x0;var _0x519e31=_0x191a[_0x563b1c];return _0x519e31;};'use strict';var _=require(_0xa191('0x0'));var util=require('util');var moment=require(_0xa191('0x1'));var BPromise=require(_0xa191('0x2'));var rs=require(_0xa191('0x3'));var fs=require('fs');var Redis=require(_0xa191('0x4'));var db=require(_0xa191('0x5'))['db'];var utils=require(_0xa191('0x6'));var logger=require(_0xa191('0x7'))(_0xa191('0x8'));var config=require(_0xa191('0x9'));var jayson=require(_0xa191('0xa'));var client=jayson[_0xa191('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae6ee,_0xe1de49,_0x5d340a){return new BPromise(function(_0xfab268,_0x2216ae){return client['request'](_0x3ae6ee,_0x5d340a)[_0xa191('0xc')](function(_0x23f34a){logger[_0xa191('0xd')](_0xa191('0xe'),_0xe1de49,'request\x20sent');logger[_0xa191('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xe1de49,'request\x20sent',JSON[_0xa191('0x10')](_0x23f34a));if(_0x23f34a[_0xa191('0x11')]){if(_0x23f34a[_0xa191('0x11')][_0xa191('0x12')]===0x1f4){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x23f34a[_0xa191('0x11')]['message']);return _0x2216ae(_0x23f34a[_0xa191('0x11')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xe1de49,_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);return _0xfab268(_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);}else{logger['info'](_0xa191('0xe'),_0xe1de49,_0xa191('0x14'));_0xfab268(_0x23f34a['result'][_0xa191('0x13')]);}})[_0xa191('0x15')](function(_0x1c179b){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x1c179b);_0x2216ae(_0x1c179b);});});} \ No newline at end of file +var _0x622f=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x622f,0x172));var _0xf622=function(_0x395073,_0x2ee068){_0x395073=_0x395073-0x0;var _0x1300d3=_0x622f[_0x395073];return _0x1300d3;};'use strict';var _=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var moment=require('moment');var BPromise=require(_0xf622('0x2'));var rs=require(_0xf622('0x3'));var fs=require('fs');var Redis=require(_0xf622('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf622('0x5'));var logger=require('../../config/logger')(_0xf622('0x6'));var config=require(_0xf622('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x847984,_0x540b19,_0x4211d8){return new BPromise(function(_0x8b4fab,_0x54a7bc){return client['request'](_0x847984,_0x4211d8)[_0xf622('0x9')](function(_0x54f10a){logger[_0xf622('0xa')](_0xf622('0xb'),_0x540b19,_0xf622('0xc'));logger[_0xf622('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x540b19,_0xf622('0xc'),JSON[_0xf622('0xe')](_0x54f10a));if(_0x54f10a[_0xf622('0xf')]){if(_0x54f10a[_0xf622('0xf')]['code']===0x1f4){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')]['message']);return _0x54a7bc(_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);}logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);return _0x8b4fab(_0x54f10a['error'][_0xf622('0x10')]);}else{logger['info'](_0xf622('0xb'),_0x540b19,'request\x20sent');_0x8b4fab(_0x54f10a[_0xf622('0x11')][_0xf622('0x10')]);}})[_0xf622('0x12')](function(_0x52c66f){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x52c66f);_0x54a7bc(_0x52c66f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index fa4fff7..bd242ae 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 _0x1755=['/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe'];(function(_0x3b9dbb,_0x2c9a7f){var _0x418b65=function(_0xe6c239){while(--_0xe6c239){_0x3b9dbb['push'](_0x3b9dbb['shift']());}};_0x418b65(++_0x2c9a7f);}(_0x1755,0x184));var _0x5175=function(_0x4b7fe9,_0x261101){_0x4b7fe9=_0x4b7fe9-0x0;var _0x583945=_0x1755[_0x4b7fe9];return _0x583945;};'use strict';var multer=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var path=require(_0x5175('0x2'));var timeout=require(_0x5175('0x3'));var express=require(_0x5175('0x4'));var router=express['Router']();var fs_extra=require(_0x5175('0x5'));var auth=require(_0x5175('0x6'));var interaction=require(_0x5175('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5175('0x8')](_0x5175('0x9'),auth[_0x5175('0xa')](),controller[_0x5175('0xb')]);router['get'](_0x5175('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5175('0x8')](_0x5175('0xd'),auth[_0x5175('0xa')](),controller[_0x5175('0xe')]);router[_0x5175('0x8')](_0x5175('0xf'),controller[_0x5175('0x10')]);router['get'](_0x5175('0x11'),auth['isAuthenticated'](),controller[_0x5175('0x12')]);router[_0x5175('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5175('0x13')](_0x5175('0x11'),auth[_0x5175('0xa')](),controller[_0x5175('0x14')]);router[_0x5175('0x15')](_0x5175('0xc'),auth['isAuthenticated'](),controller[_0x5175('0x16')]);router[_0x5175('0x17')](_0x5175('0xc'),auth[_0x5175('0xa')](),controller['destroy']);module[_0x5175('0x18')]=router; \ No newline at end of file +var _0x81a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','runTranscribe','put','/:id','destroy','exports','util','path','express','Router'];(function(_0x4bd835,_0x49b203){var _0x3d1bc4=function(_0x5f15c){while(--_0x5f15c){_0x4bd835['push'](_0x4bd835['shift']());}};_0x3d1bc4(++_0x49b203);}(_0x81a4,0x110));var _0x481a=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x81a4[_0x4207f4];return _0x29a621;};'use strict';var multer=require('multer');var util=require(_0x481a('0x0'));var path=require(_0x481a('0x1'));var timeout=require('connect-timeout');var express=require(_0x481a('0x2'));var router=express[_0x481a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x481a('0x4'));var interaction=require(_0x481a('0x5'));var config=require(_0x481a('0x6'));var controller=require('./voiceRecording.controller');router[_0x481a('0x7')]('/',auth[_0x481a('0x8')](),controller[_0x481a('0x9')]);router[_0x481a('0x7')](_0x481a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x481a('0x7')]('/:id',auth[_0x481a('0x8')](),controller[_0x481a('0xb')]);router[_0x481a('0x7')](_0x481a('0xc'),auth['isAuthenticated'](),controller[_0x481a('0xd')]);router[_0x481a('0x7')](_0x481a('0xe'),controller['downloads']);router[_0x481a('0x7')](_0x481a('0xf'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x481a('0x10')]('/',auth[_0x481a('0x8')](),controller[_0x481a('0x11')]);router[_0x481a('0x10')]('/:id/transcribe',auth[_0x481a('0x8')](),controller[_0x481a('0x12')]);router[_0x481a('0x13')](_0x481a('0x14'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x481a('0x14'),auth[_0x481a('0x8')](),controller[_0x481a('0x15')]);module[_0x481a('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 7f7aca3..a0b15d1 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 _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index dfcb2ec..d6b8133 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 _0x3957=['TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','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','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','update','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3957,0x163));var _0x7395=function(_0x5e465a,_0x3e0f32){_0x5e465a=_0x5e465a-0x0;var _0x52c7db=_0x3957[_0x5e465a];return _0x52c7db;};'use strict';var emlformat=require(_0x7395('0x0'));var rimraf=require(_0x7395('0x1'));var zipdir=require(_0x7395('0x2'));var jsonpatch=require(_0x7395('0x3'));var rp=require(_0x7395('0x4'));var moment=require(_0x7395('0x5'));var BPromise=require(_0x7395('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7395('0x7'));var sox=require('sox');var csv=require(_0x7395('0x8'));var ejs=require(_0x7395('0x9'));var fs=require('fs');var fs_extra=require(_0x7395('0xa'));var _=require(_0x7395('0xb'));var squel=require(_0x7395('0xc'));var crypto=require(_0x7395('0xd'));var jsforce=require(_0x7395('0xe'));var deskjs=require(_0x7395('0xf'));var toCsv=require(_0x7395('0x8'));var querystring=require(_0x7395('0x10'));var Papa=require('papaparse');var AWS=require(_0x7395('0x11'));var uuidv4=require(_0x7395('0x12'));var Redis=require(_0x7395('0x13'));var authService=require(_0x7395('0x14'));var qs=require(_0x7395('0x15'));var as=require(_0x7395('0x16'));var hardwareService=require(_0x7395('0x17'));var logger=require('../../config/logger')(_0x7395('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7395('0x19'));var db=require(_0x7395('0x1a'))['db'];function respondWithStatusCode(_0x72c30,_0x3f7b40){_0x3f7b40=_0x3f7b40||0xcc;return function(_0x323648){if(_0x323648){return _0x72c30[_0x7395('0x1b')](_0x3f7b40);}return _0x72c30['status'](_0x3f7b40)[_0x7395('0x1c')]();};}function respondWithResult(_0x711215,_0x33cc3c){_0x33cc3c=_0x33cc3c||0xc8;return function(_0x44a30f){if(_0x44a30f){return _0x711215['status'](_0x33cc3c)['json'](_0x44a30f);}};}function respondWithFilteredResult(_0x86083e,_0x3d899b){return function(_0x19da16){if(_0x19da16){var _0x27bfa6=typeof _0x3d899b[_0x7395('0x1d')]===_0x7395('0x1e')&&typeof _0x3d899b[_0x7395('0x1f')]==='undefined';var _0x4648e4=_0x19da16['count'];var _0x1c6ee1=_0x27bfa6?0x0:_0x3d899b['offset'];var _0x3cd783=_0x27bfa6?_0x19da16[_0x7395('0x20')]:_0x3d899b['offset']+_0x3d899b['limit'];var _0x1977d1;if(_0x3cd783>=_0x4648e4){_0x3cd783=_0x4648e4;_0x1977d1=0xc8;}else{_0x1977d1=0xce;}_0x86083e[_0x7395('0x21')](_0x1977d1);return _0x86083e[_0x7395('0x22')](_0x7395('0x23'),_0x1c6ee1+'-'+_0x3cd783+'/'+_0x4648e4)[_0x7395('0x24')](_0x19da16);}return null;};}function patchUpdates(_0x5d2683){return function(_0x163cd3){try{jsonpatch[_0x7395('0x25')](_0x163cd3,_0x5d2683,!![]);}catch(_0x3cef26){return BPromise['reject'](_0x3cef26);}return _0x163cd3[_0x7395('0x26')]();};}function saveUpdates(_0x5b1680,_0x2a40b0){return function(_0x1a3a07){if(_0x1a3a07){return _0x1a3a07['update'](_0x5b1680)[_0x7395('0x27')](function(_0x521ece){return _0x521ece;});}return null;};}function removeEntity(_0x162fb5,_0x1483d2){return function(_0xc06b46){if(_0xc06b46){return _0xc06b46[_0x7395('0x28')]()[_0x7395('0x27')](function(){_0x162fb5[_0x7395('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1521,_0xcb6ec3){return function(_0x28754b){if(!_0x28754b){_0x1e1521['sendStatus'](0x194);}return _0x28754b;};}function handleError(_0x44c850,_0x3258f1){_0x3258f1=_0x3258f1||0x1f4;return function(_0x3cc381){logger[_0x7395('0x29')](_0x3cc381[_0x7395('0x2a')]);if(_0x3cc381[_0x7395('0x2b')]){delete _0x3cc381['name'];}_0x44c850[_0x7395('0x21')](_0x3258f1)[_0x7395('0x2c')](_0x3cc381);};}exports[_0x7395('0x2d')]=function(_0x478f08,_0x2d5d47){var _0x2728d6={},_0x2d6db9={},_0xc4d8c7={'count':0x0,'rows':[]};var _0x1daac3=_[_0x7395('0x2e')](db[_0x7395('0x2f')][_0x7395('0x30')],function(_0x284301){return{'name':_0x284301[_0x7395('0x31')],'type':_0x284301[_0x7395('0x32')][_0x7395('0x33')]};});_0x2d6db9[_0x7395('0x34')]=_[_0x7395('0x35')](_['map'](_0x1daac3,_0x7395('0x2b')),['format']);_0x2d6db9['query']=_['keys'](_0x478f08[_0x7395('0x36')]);_0x2d6db9['filters']=_[_0x7395('0x37')](_0x2d6db9[_0x7395('0x34')],_0x2d6db9['query']);_0x2728d6[_0x7395('0x38')]=_[_0x7395('0x37')](_0x2d6db9[_0x7395('0x34')],qs[_0x7395('0x39')](_0x478f08[_0x7395('0x36')][_0x7395('0x39')]));_0x2728d6[_0x7395('0x38')]=_0x2728d6[_0x7395('0x38')][_0x7395('0x3a')]?_0x2728d6[_0x7395('0x38')]:_0x2d6db9[_0x7395('0x34')];if(!_0x478f08['query'][_0x7395('0x3b')]('nolimit')){_0x2728d6[_0x7395('0x1f')]=qs[_0x7395('0x1f')](_0x478f08[_0x7395('0x36')][_0x7395('0x1f')]);_0x2728d6[_0x7395('0x1d')]=qs[_0x7395('0x1d')](_0x478f08[_0x7395('0x36')][_0x7395('0x1d')]);}_0x2728d6['order']=qs[_0x7395('0x3c')](_0x478f08['query']['sort']);_0x2728d6['where']=qs[_0x7395('0x3d')](_[_0x7395('0x3e')](_0x478f08[_0x7395('0x36')],_0x2d6db9[_0x7395('0x3d')]),_0x1daac3);if(_0x478f08['query'][_0x7395('0x3f')]){_0x2728d6[_0x7395('0x40')]=_[_0x7395('0x41')](_0x2728d6[_0x7395('0x40')],{'$or':_[_0x7395('0x2e')](_0x1daac3,function(_0x547ff6){if(_0x547ff6[_0x7395('0x32')]!==_0x7395('0x42')){var _0x65ae6={};_0x65ae6[_0x547ff6[_0x7395('0x2b')]]={'$like':'%'+_0x478f08['query'][_0x7395('0x3f')]+'%'};return _0x65ae6;}})});}_0x2728d6=_[_0x7395('0x41')]({},_0x2728d6,_0x478f08[_0x7395('0x43')]);var _0x142459={'where':_0x2728d6[_0x7395('0x40')]};return db['VoiceRecording']['count'](_0x142459)[_0x7395('0x27')](function(_0x5a1c0c){_0xc4d8c7[_0x7395('0x20')]=_0x5a1c0c;if(_0x478f08[_0x7395('0x36')][_0x7395('0x44')]){_0x2728d6[_0x7395('0x45')]=[{'all':!![]}];}return db[_0x7395('0x2f')]['findAll'](_0x2728d6);})[_0x7395('0x27')](function(_0x511978){_0xc4d8c7[_0x7395('0x46')]=_0x511978;return _0xc4d8c7;})[_0x7395('0x27')](respondWithFilteredResult(_0x2d5d47,_0x2728d6))[_0x7395('0x47')](handleError(_0x2d5d47,null));};exports[_0x7395('0x48')]=function(_0x5ec7ab,_0x32faf5){var _0x232118={'raw':![],'where':{'id':_0x5ec7ab[_0x7395('0x49')]['id']}},_0x3d252a={};_0x3d252a[_0x7395('0x34')]=_[_0x7395('0x4a')](db[_0x7395('0x2f')][_0x7395('0x30')]);_0x3d252a[_0x7395('0x36')]=_['keys'](_0x5ec7ab[_0x7395('0x36')]);_0x3d252a[_0x7395('0x3d')]=_[_0x7395('0x37')](_0x3d252a['model'],_0x3d252a[_0x7395('0x36')]);_0x232118['attributes']=_[_0x7395('0x37')](_0x3d252a[_0x7395('0x34')],qs[_0x7395('0x39')](_0x5ec7ab[_0x7395('0x36')][_0x7395('0x39')]));_0x232118[_0x7395('0x38')]=_0x232118['attributes'][_0x7395('0x3a')]?_0x232118[_0x7395('0x38')]:_0x3d252a[_0x7395('0x34')];if(_0x5ec7ab[_0x7395('0x36')]['includeAll']){_0x232118[_0x7395('0x45')]=[{'all':!![]}];}_0x232118=_[_0x7395('0x41')]({},_0x232118,_0x5ec7ab[_0x7395('0x43')]);return db['VoiceRecording']['find'](_0x232118)[_0x7395('0x27')](handleEntityNotFound(_0x32faf5,null))['then'](respondWithResult(_0x32faf5,null))['catch'](handleError(_0x32faf5,null));};exports['create']=function(_0x564fca,_0xd452bc){return db[_0x7395('0x2f')][_0x7395('0x4b')](_0x564fca[_0x7395('0x4c')],{})['then'](respondWithResult(_0xd452bc,0xc9))[_0x7395('0x47')](handleError(_0xd452bc,null));};exports[_0x7395('0x4d')]=function(_0xb1ac2d,_0x18bf76){if(_0xb1ac2d[_0x7395('0x4c')]['id']){delete _0xb1ac2d[_0x7395('0x4c')]['id'];}return db['VoiceRecording'][_0x7395('0x4e')]({'where':{'id':_0xb1ac2d['params']['id']}})[_0x7395('0x27')](handleEntityNotFound(_0x18bf76,null))[_0x7395('0x27')](saveUpdates(_0xb1ac2d[_0x7395('0x4c')],null))[_0x7395('0x27')](respondWithResult(_0x18bf76,null))['catch'](handleError(_0x18bf76,null));};exports[_0x7395('0x4f')]=function(_0x30fa43,_0x1480d8){return db[_0x7395('0x2f')]['describe']()[_0x7395('0x27')](respondWithResult(_0x1480d8,null))[_0x7395('0x47')](handleError(_0x1480d8,null));};exports[_0x7395('0x50')]=function(_0x3a292d,_0x58659e,_0x12debb){var _0x34ce1a=require(_0x7395('0x51'));var _0x5f5843=![];var _0x4381e2={};if(_0x3a292d[_0x7395('0x36')][_0x7395('0x32')]&&_0x3a292d[_0x7395('0x36')][_0x7395('0x32')]===_0x7395('0x52')){_0x4381e2['uniqueid']=_0x3a292d[_0x7395('0x49')]['id'];}else{_0x4381e2['id']=_0x3a292d[_0x7395('0x49')]['id'];}return db[_0x7395('0x2f')][_0x7395('0x4e')]({'where':_0x4381e2,'attributes':['id',_0x7395('0x53')],'raw':!![]})[_0x7395('0x27')](handleEntityNotFound(_0x58659e,null))[_0x7395('0x27')](function(_0x2a6562){if(_0x2a6562){var _0x533ec2=_0x2a6562[_0x7395('0x53')];var _0x51d97a=util[_0x7395('0x54')](_0x7395('0x55'),_0x533ec2);if(fs['existsSync'](_0x51d97a)){_0x5f5843=!![];return _0x34ce1a[_0x7395('0x56')](_0x51d97a,_0x533ec2,config[_0x7395('0x57')][_0x7395('0x58')])[_0x7395('0x27')](function(){return _0x2a6562;});}return _0x2a6562;}})[_0x7395('0x27')](function(_0x42df7f){if(_0x42df7f){var _0x185b09=_0x42df7f[_0x7395('0x53')];if(!fs[_0x7395('0x59')](_0x185b09)){throw new db[(_0x7395('0x5a'))][(_0x7395('0x5b'))](_0x7395('0x5c'));}if(_0x42df7f[_0x7395('0x5d')]){return _0x58659e[_0x7395('0x50')](_0x185b09,_0x42df7f[_0x7395('0x5d')]+path[_0x7395('0x5e')](_0x185b09),function(){if(_0x5f5843){fs[_0x7395('0x5f')](_0x185b09);}});}else{return _0x58659e['download'](_0x185b09,function(_0x3f5d65){if(_0x5f5843){fs[_0x7395('0x5f')](_0x185b09);}});}}})['catch'](function(_0xe33689){if(_0xe33689[_0x7395('0x60')]==='VoiceRecording\x20not\x20found'){_0x58659e[_0x7395('0x21')](0x194)[_0x7395('0x2c')](_0x7395('0x61'));}else{return handleError(_0x58659e,null);}});};exports['downloads']=function(_0x954b4b,_0x1748e9,_0x15b159){var _0x3a6b8f=require('../../components/encryptor');var _0x4f68fd=![];var _0x2e136e={'$and':[db[_0x7395('0x62')][_0x7395('0x40')](db[_0x7395('0x62')]['fn'](_0x7395('0x63'),db['sequelize'][_0x7395('0x64')]('uniqueid')),_0x954b4b[_0x7395('0x36')][_0x7395('0x65')])]};if(_0x954b4b[_0x7395('0x36')]['type']&&_0x954b4b['query'][_0x7395('0x32')]===_0x7395('0x52')){_0x2e136e[_0x7395('0x66')][_0x7395('0x67')]({'uniqueid':_0x954b4b[_0x7395('0x49')]['id']});}else{_0x2e136e[_0x7395('0x66')][_0x7395('0x67')]({'id':_0x954b4b[_0x7395('0x49')]['id']});}return db[_0x7395('0x2f')][_0x7395('0x4e')]({'where':_0x2e136e,'attributes':['id',_0x7395('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x1748e9,null))[_0x7395('0x27')](function(_0x197933){if(_0x197933){var _0x5fb73d=util['format'](_0x7395('0x55'),_0x197933[_0x7395('0x53')]);if(fs[_0x7395('0x59')](_0x5fb73d)){_0x4f68fd=!![];return _0x3a6b8f[_0x7395('0x56')](_0x5fb73d,_0x197933[_0x7395('0x53')],config[_0x7395('0x57')][_0x7395('0x58')])['then'](function(){return _0x197933;});}return _0x197933;}})['then'](function(_0x52d9f4){if(_0x52d9f4){if(!fs['existsSync'](_0x52d9f4[_0x7395('0x53')])){throw new db[(_0x7395('0x5a'))][(_0x7395('0x5b'))]('VoiceRecording\x20not\x20found');}if(_0x52d9f4[_0x7395('0x5d')]){return _0x1748e9['download'](_0x52d9f4[_0x7395('0x53')],_0x52d9f4[_0x7395('0x5d')]+path['extname'](_0x52d9f4[_0x7395('0x53')]),function(){if(_0x4f68fd){fs[_0x7395('0x5f')](_0x52d9f4[_0x7395('0x53')]);}});}else{return _0x1748e9[_0x7395('0x50')](_0x52d9f4['value'],function(_0x2c4d3b){if(_0x4f68fd){fs[_0x7395('0x5f')](_0x52d9f4[_0x7395('0x53')]);}});}}})[_0x7395('0x47')](handleError(_0x1748e9,null));};exports['destroy']=function(_0x229ed6,_0x3e65f8){return db[_0x7395('0x2f')]['find']({'where':{'id':_0x229ed6[_0x7395('0x49')]['id']}})[_0x7395('0x27')](function(_0x2d3969){if(_['isNil'](_0x2d3969)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2d3969;})[_0x7395('0x27')](function(_0x40757c){var _0x4f3098=_0x40757c[_0x7395('0x53')];logger[_0x7395('0x68')](_0x7395('0x69'),_0x4f3098);if(!_[_0x7395('0x6a')](_0x40757c[_0x7395('0x53')])&&fs[_0x7395('0x59')](_0x4f3098)){logger[_0x7395('0x68')](_0x7395('0x6b')+_0x4f3098+_0x7395('0x6c'));fs[_0x7395('0x6d')](_0x4f3098);}_0x4f3098=_0x4f3098+_0x7395('0x6e');if(!_[_0x7395('0x6a')](_0x40757c['value'])&&fs[_0x7395('0x59')](_0x4f3098)){logger[_0x7395('0x68')](_0x7395('0x6b')+_0x4f3098+_0x7395('0x6c'));fs[_0x7395('0x6d')](_0x4f3098);}return _0x40757c;})[_0x7395('0x27')](function(_0x241872){if(!_0x241872)throw new InternalError();return _0x241872['destroy']();})[_0x7395('0x27')](function(){_0x3e65f8[_0x7395('0x21')](0xcc)[_0x7395('0x1c')]();})[_0x7395('0x47')](handleError(_0x3e65f8,null));};function getBucketslist(_0x11a584,_0xe51d10,_0x10fb88){return new Promise(function(_0x1006a6,_0x4efba4){var _0x3f36b6=new AWS['S3']({'accessKeyId':_0xe51d10,'secretAccessKey':_0x11a584,'region':_0x10fb88});_0x3f36b6[_0x7395('0x6f')]({},function(_0x31942f,_0x330099){if(_0x31942f){return _0x4efba4(_0x31942f);}else{return _0x1006a6(_0x330099);}});});}function createBucket(_0x510b91,_0x2d5777,_0x5a4856,_0x20efed){return new Promise(function(_0x3ca2b3,_0x3bb4e4){var _0x791e0=new AWS['S3']({'accessKeyId':_0x2d5777,'secretAccessKey':_0x510b91,'region':_0x5a4856});_0x791e0[_0x7395('0x70')]({'Bucket':_0x20efed},function(_0x552ec3,_0x45befb){if(_0x552ec3){return _0x3bb4e4(_0x552ec3);}else{return _0x3ca2b3(_0x45befb);}});});}function uploadFile(_0x4a6025,_0x3b9ef9,_0x1bbd8a,_0x1ea7b5,_0x21e75c,_0x469f0c){return new Promise(function(_0x5cbfc1,_0x6fcb89){var _0x1c3b04=new AWS['S3']({'accessKeyId':_0x3b9ef9,'secretAccessKey':_0x4a6025,'region':_0x1bbd8a});_0x1c3b04[_0x7395('0x71')]({'Bucket':_0x1ea7b5,'Key':_0x21e75c,'Body':_0x469f0c},function(_0xc5f793,_0x336048){if(_0xc5f793){return _0x6fcb89(_0xc5f793);}else{return _0x5cbfc1(_0x336048);}});});}function startTranscribe(_0x1ca77a,_0x297fae,_0xcfe723,_0x114aa7,_0x4af02b,_0xacc9f5){return new Promise(function(_0x1eb429,_0x9483ce){var _0x2b1de1=new AWS[(_0x7395('0x72'))]({'accessKeyId':_0x297fae,'secretAccessKey':_0x1ca77a,'region':_0xcfe723});_0x2b1de1[_0x7395('0x73')]({'TranscriptionJobName':_0x114aa7,'LanguageCode':_0x4af02b,'Media':{'MediaFileUri':_0xacc9f5}},function(_0x1be843,_0x28ab87){if(_0x1be843){return _0x9483ce(_0x1be843);}else{return _0x1eb429(_0x28ab87);}});});}function transcribe(_0xa4156e,_0x6889ad,_0x35afe0,_0xb9614c,_0x30d101,_0x251367,_0x4fea2d){return new Promise(function(_0x3cddaf,_0x371926){var _0x1a502f={};logger[_0x7395('0x68')](util[_0x7395('0x54')](_0x7395('0x74'),_0xa4156e,_0x30d101));return uploadFile(_0x6889ad,_0x35afe0,_0xb9614c,_0x30d101,path[_0x7395('0x75')](_0x251367),fs[_0x7395('0x76')](_0x251367))[_0x7395('0x27')](function(_0x2076b6){logger[_0x7395('0x68')](util[_0x7395('0x54')](_0x7395('0x77'),_0xa4156e,_0x30d101,_0x2076b6[_0x7395('0x78')]));_0x1a502f[_0x7395('0x79')]=_0x2076b6[_0x7395('0x7a')];_0x1a502f[_0x7395('0x7b')]=_0x2076b6[_0x7395('0x78')];logger[_0x7395('0x68')](util[_0x7395('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xa4156e));return startTranscribe(_0x6889ad,_0x35afe0,_0xb9614c,uuidv4(),_0x4fea2d,_0x2076b6['Location']);})[_0x7395('0x27')](function(_0x28bee4){logger['info'](util[_0x7395('0x54')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xa4156e,_0x28bee4[_0x7395('0x7c')][_0x7395('0x7d')]));_0x1a502f[_0x7395('0x7e')]=_0x28bee4[_0x7395('0x7c')][_0x7395('0x7d')];_0x1a502f[_0x7395('0x7f')]=_0x28bee4[_0x7395('0x7c')][_0x7395('0x80')];return _0x3cddaf(_0x1a502f);})[_0x7395('0x47')](function(_0x12defb){return _0x371926(_0x12defb);});});}exports[_0x7395('0x81')]=function(_0x572d83,_0x5bad7e,_0x177e40){var _0x4bae89;var _0xfb8cb8;var _0x3bd6eb;var _0x4cba79=require(_0x7395('0x51'));return db['VoiceRecording'][_0x7395('0x82')]({'where':{'id':_0x572d83[_0x7395('0x49')]['id']}})[_0x7395('0x27')](function(_0xa7ac12){if(_0xa7ac12){var _0x5b9c55=util[_0x7395('0x54')](_0x7395('0x55'),_0xa7ac12[_0x7395('0x53')]);if(fs[_0x7395('0x59')](_0x5b9c55)){cypher=!![];return _0x4cba79['decryptFile'](_0x5b9c55,_0xa7ac12[_0x7395('0x53')],config[_0x7395('0x57')][_0x7395('0x58')])[_0x7395('0x27')](function(){return _0xa7ac12;});}return _0xa7ac12;}})[_0x7395('0x27')](function(_0x30b8b2){if(!_0x30b8b2){throw new db['Sequelize'][(_0x7395('0x5b'))](_0x7395('0x83'));}_0xfb8cb8=_0x30b8b2;return db['Setting'][_0x7395('0x82')]({'where':{'id':0x1}});})[_0x7395('0x27')](handleEntityNotFound(_0x5bad7e,null))[_0x7395('0x27')](function(_0x115705){if(_0x115705){_0x4bae89=_0x115705;if(!_0x4bae89[_0x7395('0x84')]||!_0x4bae89[_0x7395('0x85')]||!_0x4bae89[_0x7395('0x86')]||!_0x4bae89[_0x7395('0x87')]||!_0x4bae89[_0x7395('0x79')]){throw new db[(_0x7395('0x5a'))][(_0x7395('0x5b'))](_0x7395('0x88'));}if(_0x572d83[_0x7395('0x4c')][_0x7395('0x89')]&&(!_0x4bae89['sentiment']||!_0x4bae89[_0x7395('0x8a')]||!_0x4bae89[_0x7395('0x8b')]||!_0x4bae89['language']||!_0x4bae89['bucket'])){throw new db['Sequelize'][(_0x7395('0x5b'))](_0x7395('0x8c'));}return db[_0x7395('0x8d')][_0x7395('0x82')]({'where':{'id':_0x4bae89[_0x7395('0x85')]}});}})[_0x7395('0x27')](function(_0x1f1910){if(!_0x1f1910){throw new db['Sequelize'][(_0x7395('0x5b'))](_0x7395('0x8e'));}if(!_0x1f1910[_0x7395('0x8f')]||!_0x1f1910['data2']){throw new db['Sequelize'][(_0x7395('0x5b'))](_0x7395('0x90'));}_0x3bd6eb=_0x1f1910;return getBucketslist(_0x3bd6eb[_0x7395('0x8f')],_0x3bd6eb[_0x7395('0x91')],_0x4bae89[_0x7395('0x86')]);})[_0x7395('0x27')](function(_0x1d4a60){if(_0x1d4a60&&_0x1d4a60['Buckets']){var _0x31d118=_[_0x7395('0x4e')](_0x1d4a60[_0x7395('0x92')],function(_0x4d6d5b){return _0x4d6d5b[_0x7395('0x93')]===_0x4bae89[_0x7395('0x79')];});if(!_0x31d118){logger[_0x7395('0x68')](util[_0x7395('0x54')](_0x7395('0x94'),_0x572d83[_0x7395('0x49')]['id'],_0x4bae89[_0x7395('0x79')]));return createBucket(_0x3bd6eb[_0x7395('0x8f')],_0x3bd6eb[_0x7395('0x91')],_0x4bae89[_0x7395('0x86')],_0x4bae89['bucket']);}logger[_0x7395('0x68')](util[_0x7395('0x54')](_0x7395('0x95'),_0x572d83[_0x7395('0x49')]['id'],_0x4bae89[_0x7395('0x79')]));return;}})[_0x7395('0x27')](function(_0x42d574){if(_0xfb8cb8[_0x7395('0x7f')]===_0x7395('0x96')){return transcribe(_0x572d83[_0x7395('0x49')]['id'],_0x3bd6eb['data1'],_0x3bd6eb[_0x7395('0x91')],_0x4bae89['transcribeRegion'],_0x4bae89[_0x7395('0x79')],_0xfb8cb8[_0x7395('0x53')],_0x4bae89[_0x7395('0x87')]);}else{logger[_0x7395('0x68')](util['format'](_0x7395('0x97'),_0x572d83['params']['id']));return{'transcribeStatus':_0x7395('0x98')};}})[_0x7395('0x27')](function(_0x59ce0e){if(_0x59ce0e){_0x59ce0e[_0x7395('0x99')]=_0x572d83[_0x7395('0x4c')]['runSentiment'];return _0xfb8cb8[_0x7395('0x9a')](_0x59ce0e);}})['then'](respondWithResult(_0x5bad7e,null))[_0x7395('0x47')](handleError(_0x5bad7e,null));};function writeFile(_0x16bc63,_0x43080f){return new Promise(function(_0x5e1929,_0xaf10ba){fs[_0x7395('0x9b')](_0x43080f,_0x16bc63,function(_0x166c58,_0xeee304){if(_0x166c58){return _0xaf10ba(_0x166c58);}else{return _0x5e1929(_0xeee304);}});});}exports[_0x7395('0x9c')]=function(_0x50e020,_0x286fc2,_0x3a674c){return db[_0x7395('0x2f')][_0x7395('0x82')]({'where':{'id':_0x50e020[_0x7395('0x49')]['id']}})[_0x7395('0x27')](handleEntityNotFound(_0x286fc2))[_0x7395('0x27')](function(_0x1d4d82){if(_0x1d4d82&&_0x1d4d82[_0x7395('0x9d')]){var _0xabf48f=_0x1d4d82[_0x7395('0x9d')];var _0x1b43d0=config[_0x7395('0x9e')]+_0x7395('0x9f')+_0x1d4d82['id']+'.txt';if(fs[_0x7395('0x59')](_0x1b43d0)){return _0x1b43d0;}return writeFile(_0xabf48f,_0x1b43d0)[_0x7395('0x27')](function(){return _0x1b43d0;});}else{throw new db[(_0x7395('0x5a'))][(_0x7395('0x5b'))]('Transcript\x20not\x20available');}})[_0x7395('0x27')](function(_0x2b5527){return _0x286fc2[_0x7395('0x50')](_0x2b5527);})[_0x7395('0x47')](handleError(_0x286fc2));}; \ No newline at end of file +var _0xee4c=['filename','download','unlink','message','downloads','sequelize','MD5','token','$and','push','secrets','recording','Sequelize','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','tempSentiment','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','model','differenceBy','format','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','VoiceRecording','includeAll','findAll','rows','catch','params','include','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found'];(function(_0x12f451,_0x3b618f){var _0x5e9589=function(_0x3153d2){while(--_0x3153d2){_0x12f451['push'](_0x12f451['shift']());}};_0x5e9589(++_0x3b618f);}(_0xee4c,0x1f3));var _0xcee4=function(_0x57d5a8,_0x21553a){_0x57d5a8=_0x57d5a8-0x0;var _0x46fdc7=_0xee4c[_0x57d5a8];return _0x46fdc7;};'use strict';var emlformat=require(_0xcee4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcee4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcee4('0x2'));var moment=require('moment');var BPromise=require(_0xcee4('0x3'));var Mustache=require('mustache');var util=require(_0xcee4('0x4'));var path=require('path');var sox=require(_0xcee4('0x5'));var csv=require(_0xcee4('0x6'));var ejs=require(_0xcee4('0x7'));var fs=require('fs');var fs_extra=require(_0xcee4('0x8'));var _=require(_0xcee4('0x9'));var squel=require(_0xcee4('0xa'));var crypto=require(_0xcee4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcee4('0x6'));var querystring=require(_0xcee4('0xc'));var Papa=require(_0xcee4('0xd'));var AWS=require(_0xcee4('0xe'));var uuidv4=require(_0xcee4('0xf'));var Redis=require('ioredis');var authService=require(_0xcee4('0x10'));var qs=require(_0xcee4('0x11'));var as=require(_0xcee4('0x12'));var hardwareService=require(_0xcee4('0x13'));var logger=require(_0xcee4('0x14'))(_0xcee4('0x15'));var utils=require(_0xcee4('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcee4('0x17'))['db'];function respondWithStatusCode(_0x4a8880,_0x398b2d){_0x398b2d=_0x398b2d||0xcc;return function(_0x3a792e){if(_0x3a792e){return _0x4a8880[_0xcee4('0x18')](_0x398b2d);}return _0x4a8880['status'](_0x398b2d)[_0xcee4('0x19')]();};}function respondWithResult(_0x5e7f2f,_0x157962){_0x157962=_0x157962||0xc8;return function(_0x5aedd4){if(_0x5aedd4){return _0x5e7f2f[_0xcee4('0x1a')](_0x157962)[_0xcee4('0x1b')](_0x5aedd4);}};}function respondWithFilteredResult(_0x5b76cf,_0x1d8208){return function(_0x381143){if(_0x381143){var _0x45144a=typeof _0x1d8208[_0xcee4('0x1c')]==='undefined'&&typeof _0x1d8208[_0xcee4('0x1d')]===_0xcee4('0x1e');var _0x82eb35=_0x381143['count'];var _0x3674be=_0x45144a?0x0:_0x1d8208[_0xcee4('0x1c')];var _0x522bc9=_0x45144a?_0x381143[_0xcee4('0x1f')]:_0x1d8208[_0xcee4('0x1c')]+_0x1d8208[_0xcee4('0x1d')];var _0x51ce68;if(_0x522bc9>=_0x82eb35){_0x522bc9=_0x82eb35;_0x51ce68=0xc8;}else{_0x51ce68=0xce;}_0x5b76cf['status'](_0x51ce68);return _0x5b76cf[_0xcee4('0x20')]('Content-Range',_0x3674be+'-'+_0x522bc9+'/'+_0x82eb35)['json'](_0x381143);}return null;};}function patchUpdates(_0x40f43c){return function(_0x3b7e45){try{jsonpatch[_0xcee4('0x21')](_0x3b7e45,_0x40f43c,!![]);}catch(_0x379b33){return BPromise[_0xcee4('0x22')](_0x379b33);}return _0x3b7e45['save']();};}function saveUpdates(_0x2f3483,_0x137371){return function(_0x1d9e74){if(_0x1d9e74){return _0x1d9e74[_0xcee4('0x23')](_0x2f3483)[_0xcee4('0x24')](function(_0x24967a){return _0x24967a;});}return null;};}function removeEntity(_0x15cca5,_0x3f9477){return function(_0xb12efe){if(_0xb12efe){return _0xb12efe[_0xcee4('0x25')]()[_0xcee4('0x24')](function(){_0x15cca5[_0xcee4('0x1a')](0xcc)[_0xcee4('0x19')]();});}};}function handleEntityNotFound(_0x259747,_0x25dbbd){return function(_0x335e1e){if(!_0x335e1e){_0x259747[_0xcee4('0x18')](0x194);}return _0x335e1e;};}function handleError(_0x39aa06,_0x115ee6){_0x115ee6=_0x115ee6||0x1f4;return function(_0x24f72c){logger[_0xcee4('0x26')](_0x24f72c['stack']);if(_0x24f72c[_0xcee4('0x27')]){delete _0x24f72c[_0xcee4('0x27')];}_0x39aa06['status'](_0x115ee6)[_0xcee4('0x28')](_0x24f72c);};}exports[_0xcee4('0x29')]=function(_0x14c490,_0x74ba6){var _0x56fc00={},_0x47f66b={},_0x18d988={'count':0x0,'rows':[]};var _0x579222=_[_0xcee4('0x2a')](db['VoiceRecording'][_0xcee4('0x2b')],function(_0x5cb8b8){return{'name':_0x5cb8b8[_0xcee4('0x2c')],'type':_0x5cb8b8['type']['key']};});_0x47f66b[_0xcee4('0x2d')]=_[_0xcee4('0x2e')](_[_0xcee4('0x2a')](_0x579222,'name'),[_0xcee4('0x2f')]);_0x47f66b[_0xcee4('0x30')]=_[_0xcee4('0x31')](_0x14c490[_0xcee4('0x30')]);_0x47f66b['filters']=_['intersection'](_0x47f66b['model'],_0x47f66b[_0xcee4('0x30')]);_0x56fc00[_0xcee4('0x32')]=_[_0xcee4('0x33')](_0x47f66b[_0xcee4('0x2d')],qs[_0xcee4('0x34')](_0x14c490[_0xcee4('0x30')]['fields']));_0x56fc00[_0xcee4('0x32')]=_0x56fc00[_0xcee4('0x32')][_0xcee4('0x35')]?_0x56fc00['attributes']:_0x47f66b[_0xcee4('0x2d')];if(!_0x14c490[_0xcee4('0x30')][_0xcee4('0x36')](_0xcee4('0x37'))){_0x56fc00[_0xcee4('0x1d')]=qs['limit'](_0x14c490[_0xcee4('0x30')][_0xcee4('0x1d')]);_0x56fc00[_0xcee4('0x1c')]=qs[_0xcee4('0x1c')](_0x14c490[_0xcee4('0x30')]['offset']);}_0x56fc00[_0xcee4('0x38')]=qs['sort'](_0x14c490[_0xcee4('0x30')][_0xcee4('0x39')]);_0x56fc00['where']=qs[_0xcee4('0x3a')](_[_0xcee4('0x3b')](_0x14c490[_0xcee4('0x30')],_0x47f66b['filters']),_0x579222);if(_0x14c490[_0xcee4('0x30')][_0xcee4('0x3c')]){_0x56fc00[_0xcee4('0x3d')]=_['merge'](_0x56fc00[_0xcee4('0x3d')],{'$or':_[_0xcee4('0x2a')](_0x579222,function(_0x5e5ad8){if(_0x5e5ad8[_0xcee4('0x3e')]!==_0xcee4('0x3f')){var _0x1d39ad={};_0x1d39ad[_0x5e5ad8[_0xcee4('0x27')]]={'$like':'%'+_0x14c490['query'][_0xcee4('0x3c')]+'%'};return _0x1d39ad;}})});}_0x56fc00=_[_0xcee4('0x40')]({},_0x56fc00,_0x14c490[_0xcee4('0x41')]);var _0x2aecad={'where':_0x56fc00['where']};return db[_0xcee4('0x42')][_0xcee4('0x1f')](_0x2aecad)[_0xcee4('0x24')](function(_0x41a7ff){_0x18d988[_0xcee4('0x1f')]=_0x41a7ff;if(_0x14c490[_0xcee4('0x30')][_0xcee4('0x43')]){_0x56fc00['include']=[{'all':!![]}];}return db[_0xcee4('0x42')][_0xcee4('0x44')](_0x56fc00);})[_0xcee4('0x24')](function(_0xf6aab0){_0x18d988[_0xcee4('0x45')]=_0xf6aab0;return _0x18d988;})['then'](respondWithFilteredResult(_0x74ba6,_0x56fc00))[_0xcee4('0x46')](handleError(_0x74ba6,null));};exports['show']=function(_0x431074,_0x4a897b){var _0x236b24={'raw':![],'where':{'id':_0x431074[_0xcee4('0x47')]['id']}},_0x34b3e2={};_0x34b3e2[_0xcee4('0x2d')]=_[_0xcee4('0x31')](db[_0xcee4('0x42')][_0xcee4('0x2b')]);_0x34b3e2[_0xcee4('0x30')]=_['keys'](_0x431074['query']);_0x34b3e2[_0xcee4('0x3a')]=_[_0xcee4('0x33')](_0x34b3e2[_0xcee4('0x2d')],_0x34b3e2[_0xcee4('0x30')]);_0x236b24['attributes']=_[_0xcee4('0x33')](_0x34b3e2[_0xcee4('0x2d')],qs[_0xcee4('0x34')](_0x431074['query'][_0xcee4('0x34')]));_0x236b24[_0xcee4('0x32')]=_0x236b24[_0xcee4('0x32')][_0xcee4('0x35')]?_0x236b24[_0xcee4('0x32')]:_0x34b3e2['model'];if(_0x431074['query']['includeAll']){_0x236b24[_0xcee4('0x48')]=[{'all':!![]}];}_0x236b24=_['merge']({},_0x236b24,_0x431074[_0xcee4('0x41')]);return db[_0xcee4('0x42')][_0xcee4('0x49')](_0x236b24)[_0xcee4('0x24')](handleEntityNotFound(_0x4a897b,null))[_0xcee4('0x24')](respondWithResult(_0x4a897b,null))[_0xcee4('0x46')](handleError(_0x4a897b,null));};exports[_0xcee4('0x4a')]=function(_0x1b299a,_0x58d3f9){return db[_0xcee4('0x42')][_0xcee4('0x4a')](_0x1b299a[_0xcee4('0x4b')],{})[_0xcee4('0x24')](respondWithResult(_0x58d3f9,0xc9))[_0xcee4('0x46')](handleError(_0x58d3f9,null));};exports['update']=function(_0x3b2399,_0x57349e){if(_0x3b2399[_0xcee4('0x4b')]['id']){delete _0x3b2399[_0xcee4('0x4b')]['id'];}return db[_0xcee4('0x42')]['find']({'where':{'id':_0x3b2399[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](handleEntityNotFound(_0x57349e,null))[_0xcee4('0x24')](saveUpdates(_0x3b2399[_0xcee4('0x4b')],null))['then'](respondWithResult(_0x57349e,null))[_0xcee4('0x46')](handleError(_0x57349e,null));};exports[_0xcee4('0x4c')]=function(_0x30d80d,_0x1f1706){return db[_0xcee4('0x42')][_0xcee4('0x4c')]()[_0xcee4('0x24')](respondWithResult(_0x1f1706,null))[_0xcee4('0x46')](handleError(_0x1f1706,null));};exports['download']=function(_0x435667,_0x4825f9,_0x51dad7){var _0x218cae=require(_0xcee4('0x4d'));var _0x569b97=![];var _0x2a04af={};if(_0x435667['query'][_0xcee4('0x3e')]&&_0x435667[_0xcee4('0x30')][_0xcee4('0x3e')]===_0xcee4('0x4e')){_0x2a04af[_0xcee4('0x4e')]=_0x435667['params']['id'];}else{_0x2a04af['id']=_0x435667[_0xcee4('0x47')]['id'];}return db[_0xcee4('0x42')][_0xcee4('0x49')]({'where':_0x2a04af,'attributes':['id',_0xcee4('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x4825f9,null))[_0xcee4('0x24')](function(_0x5830c2){if(_0x5830c2){var _0x4c9f33=_0x5830c2[_0xcee4('0x4f')];var _0xdfc55b=util[_0xcee4('0x2f')](_0xcee4('0x50'),_0x4c9f33);if(fs[_0xcee4('0x51')](_0xdfc55b)){_0x569b97=!![];return _0x218cae[_0xcee4('0x52')](_0xdfc55b,_0x4c9f33,config['secrets']['recording'])[_0xcee4('0x24')](function(){return _0x5830c2;});}return _0x5830c2;}})[_0xcee4('0x24')](function(_0x2da1b2){if(_0x2da1b2){var _0x447fac=_0x2da1b2['value'];if(!fs[_0xcee4('0x51')](_0x447fac)){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x54'));}if(_0x2da1b2[_0xcee4('0x55')]){return _0x4825f9[_0xcee4('0x56')](_0x447fac,_0x2da1b2[_0xcee4('0x55')]+path['extname'](_0x447fac),function(){if(_0x569b97){fs[_0xcee4('0x57')](_0x447fac);}});}else{return _0x4825f9[_0xcee4('0x56')](_0x447fac,function(_0x2e9df8){if(_0x569b97){fs[_0xcee4('0x57')](_0x447fac);}});}}})[_0xcee4('0x46')](function(_0x46c422){if(_0x46c422[_0xcee4('0x58')]===_0xcee4('0x54')){_0x4825f9[_0xcee4('0x1a')](0x194)[_0xcee4('0x28')]('Not\x20found');}else{return handleError(_0x4825f9,null);}});};exports[_0xcee4('0x59')]=function(_0x3b88c5,_0x23e32b,_0x35c1c9){var _0x1434eb=require(_0xcee4('0x4d'));var _0x500b02=![];var _0x1abf86={'$and':[db[_0xcee4('0x5a')][_0xcee4('0x3d')](db[_0xcee4('0x5a')]['fn'](_0xcee4('0x5b'),db[_0xcee4('0x5a')]['col']('uniqueid')),_0x3b88c5[_0xcee4('0x30')][_0xcee4('0x5c')])]};if(_0x3b88c5[_0xcee4('0x30')]['type']&&_0x3b88c5['query'][_0xcee4('0x3e')]===_0xcee4('0x4e')){_0x1abf86[_0xcee4('0x5d')][_0xcee4('0x5e')]({'uniqueid':_0x3b88c5[_0xcee4('0x47')]['id']});}else{_0x1abf86[_0xcee4('0x5d')]['push']({'id':_0x3b88c5[_0xcee4('0x47')]['id']});}return db[_0xcee4('0x42')]['find']({'where':_0x1abf86,'attributes':['id','value'],'raw':!![]})[_0xcee4('0x24')](handleEntityNotFound(_0x23e32b,null))[_0xcee4('0x24')](function(_0x49db3c){if(_0x49db3c){var _0x1a4ecb=util[_0xcee4('0x2f')](_0xcee4('0x50'),_0x49db3c[_0xcee4('0x4f')]);if(fs['existsSync'](_0x1a4ecb)){_0x500b02=!![];return _0x1434eb[_0xcee4('0x52')](_0x1a4ecb,_0x49db3c['value'],config[_0xcee4('0x5f')][_0xcee4('0x60')])[_0xcee4('0x24')](function(){return _0x49db3c;});}return _0x49db3c;}})[_0xcee4('0x24')](function(_0x49f65b){if(_0x49f65b){if(!fs[_0xcee4('0x51')](_0x49f65b[_0xcee4('0x4f')])){throw new db[(_0xcee4('0x61'))][(_0xcee4('0x53'))](_0xcee4('0x54'));}if(_0x49f65b[_0xcee4('0x55')]){return _0x23e32b['download'](_0x49f65b['value'],_0x49f65b[_0xcee4('0x55')]+path[_0xcee4('0x62')](_0x49f65b[_0xcee4('0x4f')]),function(){if(_0x500b02){fs[_0xcee4('0x57')](_0x49f65b[_0xcee4('0x4f')]);}});}else{return _0x23e32b[_0xcee4('0x56')](_0x49f65b[_0xcee4('0x4f')],function(_0x54a681){if(_0x500b02){fs[_0xcee4('0x57')](_0x49f65b[_0xcee4('0x4f')]);}});}}})[_0xcee4('0x46')](handleError(_0x23e32b,null));};exports[_0xcee4('0x25')]=function(_0x4d2e98,_0x387547){return db[_0xcee4('0x42')][_0xcee4('0x49')]({'where':{'id':_0x4d2e98[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](function(_0x3c2082){if(_['isNil'](_0x3c2082)){throw new ReferenceError(_0xcee4('0x63'));}return _0x3c2082;})[_0xcee4('0x24')](function(_0x302dc3){var _0x428167=_0x302dc3[_0xcee4('0x4f')];logger[_0xcee4('0x64')](_0xcee4('0x65'),_0x428167);if(!_[_0xcee4('0x66')](_0x302dc3[_0xcee4('0x4f')])&&fs['existsSync'](_0x428167)){logger[_0xcee4('0x64')](_0xcee4('0x67')+_0x428167+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcee4('0x68')](_0x428167);}_0x428167=_0x428167+'.cypher';if(!_[_0xcee4('0x66')](_0x302dc3['value'])&&fs[_0xcee4('0x51')](_0x428167)){logger['info']('File:\x20\x22'+_0x428167+_0xcee4('0x69'));fs['unlinkSync'](_0x428167);}return _0x302dc3;})[_0xcee4('0x24')](function(_0x5b9368){if(!_0x5b9368)throw new InternalError();return _0x5b9368[_0xcee4('0x25')]();})[_0xcee4('0x24')](function(){_0x387547[_0xcee4('0x1a')](0xcc)[_0xcee4('0x19')]();})['catch'](handleError(_0x387547,null));};function getBucketslist(_0x128e25,_0x4e24a7,_0x2f65ea){return new Promise(function(_0x3a751e,_0x3bf0f5){var _0x1e9dec=new AWS['S3']({'accessKeyId':_0x4e24a7,'secretAccessKey':_0x128e25,'region':_0x2f65ea});_0x1e9dec['listBuckets']({},function(_0x4c5b99,_0x1f36c4){if(_0x4c5b99){return _0x3bf0f5(_0x4c5b99);}else{return _0x3a751e(_0x1f36c4);}});});}function createBucket(_0x167608,_0x5b77e4,_0x4f165e,_0x379804){return new Promise(function(_0x13ba9d,_0x18faf1){var _0xc04649=new AWS['S3']({'accessKeyId':_0x5b77e4,'secretAccessKey':_0x167608,'region':_0x4f165e});_0xc04649[_0xcee4('0x6a')]({'Bucket':_0x379804},function(_0x294a86,_0x3b5f5b){if(_0x294a86){return _0x18faf1(_0x294a86);}else{return _0x13ba9d(_0x3b5f5b);}});});}function uploadFile(_0x29f9a2,_0x513cd1,_0x22ed07,_0xc4fe1c,_0x408661,_0x567e21){return new Promise(function(_0x4a3014,_0x4d2df9){var _0x56cba1=new AWS['S3']({'accessKeyId':_0x513cd1,'secretAccessKey':_0x29f9a2,'region':_0x22ed07});_0x56cba1['upload']({'Bucket':_0xc4fe1c,'Key':_0x408661,'Body':_0x567e21},function(_0x1fdb7c,_0x1923a0){if(_0x1fdb7c){return _0x4d2df9(_0x1fdb7c);}else{return _0x4a3014(_0x1923a0);}});});}function startTranscribe(_0x2d1647,_0x43416a,_0x36adb4,_0x10f6fa,_0x2df8c2,_0x347829){return new Promise(function(_0x1e9c8c,_0x2ed883){var _0x243e7d=new AWS[(_0xcee4('0x6b'))]({'accessKeyId':_0x43416a,'secretAccessKey':_0x2d1647,'region':_0x36adb4});_0x243e7d[_0xcee4('0x6c')]({'TranscriptionJobName':_0x10f6fa,'LanguageCode':_0x2df8c2,'Media':{'MediaFileUri':_0x347829}},function(_0x4994a0,_0x22356f){if(_0x4994a0){return _0x2ed883(_0x4994a0);}else{return _0x1e9c8c(_0x22356f);}});});}function transcribe(_0x462125,_0x4574c0,_0x1682c5,_0x311162,_0x3a05f4,_0x4cda4e,_0x19d701){return new Promise(function(_0x4512ff,_0x2fdce5){var _0x523d8={};logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x462125,_0x3a05f4));return uploadFile(_0x4574c0,_0x1682c5,_0x311162,_0x3a05f4,path[_0xcee4('0x6d')](_0x4cda4e),fs[_0xcee4('0x6e')](_0x4cda4e))[_0xcee4('0x24')](function(_0x51bd60){logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x462125,_0x3a05f4,_0x51bd60[_0xcee4('0x6f')]));_0x523d8[_0xcee4('0x70')]=_0x51bd60[_0xcee4('0x71')];_0x523d8[_0xcee4('0x72')]=_0x51bd60[_0xcee4('0x6f')];logger[_0xcee4('0x64')](util[_0xcee4('0x2f')](_0xcee4('0x73'),_0x462125));return startTranscribe(_0x4574c0,_0x1682c5,_0x311162,uuidv4(),_0x19d701,_0x51bd60['Location']);})[_0xcee4('0x24')](function(_0x407ef5){logger[_0xcee4('0x64')](util['format'](_0xcee4('0x74'),_0x462125,_0x407ef5[_0xcee4('0x75')][_0xcee4('0x76')]));_0x523d8[_0xcee4('0x77')]=_0x407ef5['TranscriptionJob'][_0xcee4('0x76')];_0x523d8['transcribeStatus']=_0x407ef5[_0xcee4('0x75')][_0xcee4('0x78')];return _0x4512ff(_0x523d8);})[_0xcee4('0x46')](function(_0x1c7881){return _0x2fdce5(_0x1c7881);});});}exports[_0xcee4('0x79')]=function(_0x221b1b,_0x39caae,_0x8e092c){var _0x577c01;var _0xfe3b54;var _0x376402;var _0x323648=require(_0xcee4('0x4d'));return db['VoiceRecording'][_0xcee4('0x7a')]({'where':{'id':_0x221b1b['params']['id']}})[_0xcee4('0x24')](function(_0x11810d){if(_0x11810d){var _0x13e7f8=util['format'](_0xcee4('0x50'),_0x11810d[_0xcee4('0x4f')]);if(fs['existsSync'](_0x13e7f8)){cypher=!![];return _0x323648['decryptFile'](_0x13e7f8,_0x11810d[_0xcee4('0x4f')],config[_0xcee4('0x5f')]['recording'])[_0xcee4('0x24')](function(){return _0x11810d;});}return _0x11810d;}})[_0xcee4('0x24')](function(_0x4f72b4){if(!_0x4f72b4){throw new db[(_0xcee4('0x61'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0xfe3b54=_0x4f72b4;return db[_0xcee4('0x7b')]['findOne']({'where':{'id':0x1}});})[_0xcee4('0x24')](handleEntityNotFound(_0x39caae,null))['then'](function(_0x5f5325){if(_0x5f5325){_0x577c01=_0x5f5325;if(!_0x577c01[_0xcee4('0x7c')]||!_0x577c01[_0xcee4('0x7d')]||!_0x577c01[_0xcee4('0x7e')]||!_0x577c01[_0xcee4('0x7f')]||!_0x577c01[_0xcee4('0x70')]){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x80'));}if(_0x221b1b[_0xcee4('0x4b')][_0xcee4('0x81')]&&(!_0x577c01[_0xcee4('0x82')]||!_0x577c01[_0xcee4('0x83')]||!_0x577c01[_0xcee4('0x84')]||!_0x577c01[_0xcee4('0x7f')]||!_0x577c01[_0xcee4('0x70')])){throw new db['Sequelize'][(_0xcee4('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xcee4('0x7a')]({'where':{'id':_0x577c01[_0xcee4('0x7d')]}});}})['then'](function(_0xf8c7dd){if(!_0xf8c7dd){throw new db['Sequelize'][(_0xcee4('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xf8c7dd[_0xcee4('0x85')]||!_0xf8c7dd[_0xcee4('0x86')]){throw new db['Sequelize'][(_0xcee4('0x53'))](_0xcee4('0x87'));}_0x376402=_0xf8c7dd;return getBucketslist(_0x376402[_0xcee4('0x85')],_0x376402[_0xcee4('0x86')],_0x577c01[_0xcee4('0x7e')]);})[_0xcee4('0x24')](function(_0x4a3b95){if(_0x4a3b95&&_0x4a3b95[_0xcee4('0x88')]){var _0x430f09=_['find'](_0x4a3b95[_0xcee4('0x88')],function(_0x478351){return _0x478351['Name']===_0x577c01[_0xcee4('0x70')];});if(!_0x430f09){logger[_0xcee4('0x64')](util[_0xcee4('0x2f')](_0xcee4('0x89'),_0x221b1b['params']['id'],_0x577c01[_0xcee4('0x70')]));return createBucket(_0x376402['data1'],_0x376402[_0xcee4('0x86')],_0x577c01[_0xcee4('0x7e')],_0x577c01[_0xcee4('0x70')]);}logger['info'](util[_0xcee4('0x2f')](_0xcee4('0x8a'),_0x221b1b[_0xcee4('0x47')]['id'],_0x577c01[_0xcee4('0x70')]));return;}})['then'](function(_0x11d93a){if(_0xfe3b54[_0xcee4('0x8b')]==='NEW'){return transcribe(_0x221b1b[_0xcee4('0x47')]['id'],_0x376402['data1'],_0x376402['data2'],_0x577c01[_0xcee4('0x7e')],_0x577c01['bucket'],_0xfe3b54['value'],_0x577c01[_0xcee4('0x7f')]);}else{logger[_0xcee4('0x64')](util[_0xcee4('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x221b1b['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcee4('0x24')](function(_0x394163){if(_0x394163){_0x394163[_0xcee4('0x8c')]=_0x221b1b[_0xcee4('0x4b')][_0xcee4('0x81')];return _0xfe3b54[_0xcee4('0x8d')](_0x394163);}})[_0xcee4('0x24')](respondWithResult(_0x39caae,null))[_0xcee4('0x46')](handleError(_0x39caae,null));};function writeFile(_0x2850d9,_0x12e121){return new Promise(function(_0x1e1503,_0x4212a0){fs[_0xcee4('0x8e')](_0x12e121,_0x2850d9,function(_0x59c38a,_0x44372d){if(_0x59c38a){return _0x4212a0(_0x59c38a);}else{return _0x1e1503(_0x44372d);}});});}exports['downloadTranscribe']=function(_0x4a620b,_0x5ebd05,_0x3a265d){return db[_0xcee4('0x42')][_0xcee4('0x7a')]({'where':{'id':_0x4a620b[_0xcee4('0x47')]['id']}})[_0xcee4('0x24')](handleEntityNotFound(_0x5ebd05))[_0xcee4('0x24')](function(_0x27305f){if(_0x27305f&&_0x27305f[_0xcee4('0x8f')]){var _0x4215d3=_0x27305f[_0xcee4('0x8f')];var _0x1116ba=config[_0xcee4('0x90')]+'/server/files/transcribes/transcribe_'+_0x27305f['id']+'.txt';if(fs[_0xcee4('0x51')](_0x1116ba)){return _0x1116ba;}return writeFile(_0x4215d3,_0x1116ba)[_0xcee4('0x24')](function(){return _0x1116ba;});}else{throw new db[(_0xcee4('0x61'))]['ValidationError'](_0xcee4('0x91'));}})[_0xcee4('0x24')](function(_0x45ce7f){return _0x5ebd05[_0xcee4('0x56')](_0x45ce7f);})[_0xcee4('0x46')](handleError(_0x5ebd05));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index fb4382b..853a276 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 _0xf9bb=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x566dd5,_0x491250){_0x566dd5=_0x566dd5-0x0;var _0x184612=_0xf9bb[_0x566dd5];return _0x184612;};'use strict';var attributes=require(_0xbf9b('0x0'));module[_0xbf9b('0x1')]=function(_0x26844f,_0x49c7ee){return _0x26844f[_0xbf9b('0x2')](_0xbf9b('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbf9b('0x4')]},{'name':_0xbf9b('0x5'),'fields':[_0xbf9b('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ddd=['uniqueid','transcribeStatus','define','VoiceRecording'];(function(_0x428b5c,_0x5bf52){var _0x28f7f3=function(_0x546df5){while(--_0x546df5){_0x428b5c['push'](_0x428b5c['shift']());}};_0x28f7f3(++_0x5bf52);}(_0x6ddd,0xae));var _0xd6dd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6ddd[_0x3947c9];return _0x2e7871;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x468b4c,_0x3f88f7){return _0x468b4c[_0xd6dd('0x0')](_0xd6dd('0x1'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd6dd('0x2'),'fields':['uniqueid']},{'name':_0xd6dd('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 25239b5..fc1357b 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59b1f3,_0x38a596){var _0x52f133=function(_0x92c385){while(--_0x92c385){_0x59b1f3['push'](_0x59b1f3['shift']());}};_0x52f133(++_0x38a596);}(_0x5c3c,0x132));var _0xc5c3=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x5c3c[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x8267d3,_0x123e50){var _0x4343b9=function(_0x44a174){while(--_0x44a174){_0x8267d3['push'](_0x8267d3['shift']());}};_0x4343b9(++_0x123e50);}(_0x5430,0x10c));var _0x0543=function(_0xf79383,_0x35ace4){_0xf79383=_0xf79383-0x0;var _0x22b937=_0x5430[_0xf79383];return _0x22b937;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e0ff454..bd9d598 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 _0x180f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x180f,0x6c));var _0xf180=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x180f[_0x1ca9e9];return _0x309f3c;};'use strict';var multer=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var path=require(_0xf180('0x2'));var timeout=require(_0xf180('0x3'));var express=require(_0xf180('0x4'));var router=express[_0xf180('0x5')]();var fs_extra=require(_0xf180('0x6'));var auth=require(_0xf180('0x7'));var interaction=require(_0xf180('0x8'));var config=require(_0xf180('0x9'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xf180('0xa')](),controller['index']);router[_0xf180('0xb')](_0xf180('0xc'),auth[_0xf180('0xa')](),controller['describe']);router['get'](_0xf180('0xd'),auth[_0xf180('0xa')](),controller['show']);router[_0xf180('0xe')]('/',auth[_0xf180('0xa')](),controller[_0xf180('0xf')]);router[_0xf180('0x10')]('/:id',auth[_0xf180('0xa')](),controller[_0xf180('0x11')]);router['delete']('/:id',auth[_0xf180('0xa')](),controller['destroy']);module[_0xf180('0x12')]=router; \ No newline at end of file +var _0xfc32=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xfc32,0xa1));var _0x2fc3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xfc32[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x2fc3('0x0'));var util=require(_0x2fc3('0x1'));var path=require(_0x2fc3('0x2'));var timeout=require(_0x2fc3('0x3'));var express=require(_0x2fc3('0x4'));var router=express[_0x2fc3('0x5')]();var fs_extra=require(_0x2fc3('0x6'));var auth=require(_0x2fc3('0x7'));var interaction=require(_0x2fc3('0x8'));var config=require(_0x2fc3('0x9'));var controller=require(_0x2fc3('0xa'));router[_0x2fc3('0xb')]('/',auth[_0x2fc3('0xc')](),controller[_0x2fc3('0xd')]);router['get'](_0x2fc3('0xe'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0xf')]);router[_0x2fc3('0xb')](_0x2fc3('0x10'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x11')]);router[_0x2fc3('0x12')]('/',auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x13')]);router[_0x2fc3('0x14')](_0x2fc3('0x10'),auth[_0x2fc3('0xc')](),controller[_0x2fc3('0x15')]);router[_0x2fc3('0x16')](_0x2fc3('0x10'),auth['isAuthenticated'](),controller[_0x2fc3('0x17')]);module[_0x2fc3('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5c4b16c..0b5ef6a 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 _0xd12b=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x403798,_0x357f26){var _0xcfd6e9=function(_0xf311c2){while(--_0xf311c2){_0x403798['push'](_0x403798['shift']());}};_0xcfd6e9(++_0x357f26);}(_0xd12b,0x1dc));var _0xbd12=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xd12b[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xbd12('0x0'));var moment=require(_0xbd12('0x1'));module[_0xbd12('0x2')]={'type':{'type':Sequelize[_0xbd12('0x3')](_0xbd12('0x4'),_0xbd12('0x5'))},'result':{'type':Sequelize[_0xbd12('0x6')]},'transfererchannel':{'type':Sequelize[_0xbd12('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xbd12('0x6')]},'transferercalleridname':{'type':Sequelize[_0xbd12('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbd12('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xbd12('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xbd12('0x6')]},'transfererexten':{'type':Sequelize[_0xbd12('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xbd12('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xbd12('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xbd12('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbd12('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbd12('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xbd12('0x6')]},'transfereeexten':{'type':Sequelize[_0xbd12('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xbd12('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xbd12('0x7'),'No')},'context':{'type':Sequelize[_0xbd12('0x6')]},'extension':{'type':Sequelize[_0xbd12('0x6')]}}; \ No newline at end of file +var _0x9d77=['moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9d77,0x9a));var _0x79d7=function(_0x56b492,_0x3c7eee){_0x56b492=_0x56b492-0x0;var _0x1e250c=_0x9d77[_0x56b492];return _0x1e250c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x79d7('0x0'));module[_0x79d7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x79d7('0x2'),_0x79d7('0x3'))},'result':{'type':Sequelize[_0x79d7('0x4')]},'transfererchannel':{'type':Sequelize[_0x79d7('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x79d7('0x4')]},'transferercalleridname':{'type':Sequelize[_0x79d7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x79d7('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x79d7('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x79d7('0x4')]},'transfereechannel':{'type':Sequelize[_0x79d7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x79d7('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x79d7('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x79d7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x79d7('0x4')]},'transfereecontext':{'type':Sequelize[_0x79d7('0x4')]},'transfereeexten':{'type':Sequelize[_0x79d7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x79d7('0x4')]},'isexternal':{'type':Sequelize[_0x79d7('0x5')](_0x79d7('0x6'),'No')},'context':{'type':Sequelize[_0x79d7('0x4')]},'extension':{'type':Sequelize[_0x79d7('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 283f8f2..fe42285 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 _0x8cd1=['util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','status','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','options','includeAll','include','VoiceTransferReport','findAll','rows','show','params','merge','find','catch','create','body','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0x8cd1,0xe8));var _0x18cd=function(_0x3c0988,_0x3e3f83){_0x3c0988=_0x3c0988-0x0;var _0x4c2405=_0x8cd1[_0x3c0988];return _0x4c2405;};'use strict';var emlformat=require(_0x18cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x18cd('0x2'));var BPromise=require(_0x18cd('0x3'));var Mustache=require(_0x18cd('0x4'));var util=require(_0x18cd('0x5'));var path=require(_0x18cd('0x6'));var sox=require(_0x18cd('0x7'));var csv=require('to-csv');var ejs=require(_0x18cd('0x8'));var fs=require('fs');var fs_extra=require(_0x18cd('0x9'));var _=require(_0x18cd('0xa'));var squel=require(_0x18cd('0xb'));var crypto=require(_0x18cd('0xc'));var jsforce=require(_0x18cd('0xd'));var deskjs=require(_0x18cd('0xe'));var toCsv=require(_0x18cd('0xf'));var querystring=require(_0x18cd('0x10'));var Papa=require(_0x18cd('0x11'));var Redis=require('ioredis');var authService=require(_0x18cd('0x12'));var qs=require(_0x18cd('0x13'));var as=require(_0x18cd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18cd('0x15'))(_0x18cd('0x16'));var utils=require(_0x18cd('0x17'));var config=require(_0x18cd('0x18'));var licenseUtil=require(_0x18cd('0x19'));var db=require(_0x18cd('0x1a'))['db'];function respondWithStatusCode(_0x32f8ca,_0x19f260){_0x19f260=_0x19f260||0xcc;return function(_0xf54308){if(_0xf54308){return _0x32f8ca[_0x18cd('0x1b')](_0x19f260);}return _0x32f8ca['status'](_0x19f260)[_0x18cd('0x1c')]();};}function respondWithResult(_0x499b36,_0x30d48d){_0x30d48d=_0x30d48d||0xc8;return function(_0x3880e6){if(_0x3880e6){return _0x499b36['status'](_0x30d48d)[_0x18cd('0x1d')](_0x3880e6);}};}function respondWithFilteredResult(_0x39a590,_0x1ab883){return function(_0x4621cf){if(_0x4621cf){var _0x5b7451=typeof _0x1ab883[_0x18cd('0x1e')]===_0x18cd('0x1f')&&typeof _0x1ab883[_0x18cd('0x20')]===_0x18cd('0x1f');var _0x38ca43=_0x4621cf[_0x18cd('0x21')];var _0x4883ba=_0x5b7451?0x0:_0x1ab883['offset'];var _0x11c216=_0x5b7451?_0x4621cf['count']:_0x1ab883[_0x18cd('0x1e')]+_0x1ab883[_0x18cd('0x20')];var _0xc23636;if(_0x11c216>=_0x38ca43){_0x11c216=_0x38ca43;_0xc23636=0xc8;}else{_0xc23636=0xce;}_0x39a590['status'](_0xc23636);return _0x39a590[_0x18cd('0x22')](_0x18cd('0x23'),_0x4883ba+'-'+_0x11c216+'/'+_0x38ca43)[_0x18cd('0x1d')](_0x4621cf);}return null;};}function patchUpdates(_0x22bbdf){return function(_0x541e6a){try{jsonpatch[_0x18cd('0x24')](_0x541e6a,_0x22bbdf,!![]);}catch(_0x3acb0c){return BPromise[_0x18cd('0x25')](_0x3acb0c);}return _0x541e6a['save']();};}function saveUpdates(_0x46fe41,_0x3aa34f){return function(_0x3b80cf){if(_0x3b80cf){return _0x3b80cf['update'](_0x46fe41)[_0x18cd('0x26')](function(_0x9d156d){return _0x9d156d;});}return null;};}function removeEntity(_0x4ebb1b,_0xaeb7db){return function(_0x268ab8){if(_0x268ab8){return _0x268ab8['destroy']()['then'](function(){_0x4ebb1b[_0x18cd('0x27')](0xcc)[_0x18cd('0x1c')]();});}};}function handleEntityNotFound(_0x83c93d,_0x28c4f2){return function(_0x3c4460){if(!_0x3c4460){_0x83c93d[_0x18cd('0x1b')](0x194);}return _0x3c4460;};}function handleError(_0xd3c213,_0x3c84ab){_0x3c84ab=_0x3c84ab||0x1f4;return function(_0x4cbd45){logger[_0x18cd('0x28')](_0x4cbd45['stack']);if(_0x4cbd45[_0x18cd('0x29')]){delete _0x4cbd45['name'];}_0xd3c213['status'](_0x3c84ab)[_0x18cd('0x2a')](_0x4cbd45);};}exports[_0x18cd('0x2b')]=function(_0x233aaa,_0x103a26){var _0x3fdc1a={},_0x28f351={},_0x1529ee={'count':0x0,'rows':[]};var _0x5de0e1=_['map'](db['VoiceTransferReport'][_0x18cd('0x2c')],function(_0x468151){return{'name':_0x468151[_0x18cd('0x2d')],'type':_0x468151[_0x18cd('0x2e')][_0x18cd('0x2f')]};});_0x28f351[_0x18cd('0x30')]=_['map'](_0x5de0e1,_0x18cd('0x29'));_0x28f351[_0x18cd('0x31')]=_[_0x18cd('0x32')](_0x233aaa[_0x18cd('0x31')]);_0x28f351['filters']=_[_0x18cd('0x33')](_0x28f351[_0x18cd('0x30')],_0x28f351[_0x18cd('0x31')]);_0x3fdc1a[_0x18cd('0x34')]=_[_0x18cd('0x33')](_0x28f351[_0x18cd('0x30')],qs[_0x18cd('0x35')](_0x233aaa['query']['fields']));_0x3fdc1a[_0x18cd('0x34')]=_0x3fdc1a[_0x18cd('0x34')][_0x18cd('0x36')]?_0x3fdc1a['attributes']:_0x28f351[_0x18cd('0x30')];if(!_0x233aaa[_0x18cd('0x31')][_0x18cd('0x37')](_0x18cd('0x38'))){_0x3fdc1a[_0x18cd('0x20')]=qs[_0x18cd('0x20')](_0x233aaa[_0x18cd('0x31')][_0x18cd('0x20')]);_0x3fdc1a[_0x18cd('0x1e')]=qs[_0x18cd('0x1e')](_0x233aaa[_0x18cd('0x31')][_0x18cd('0x1e')]);}_0x3fdc1a[_0x18cd('0x39')]=qs[_0x18cd('0x3a')](_0x233aaa[_0x18cd('0x31')][_0x18cd('0x3a')]);_0x3fdc1a[_0x18cd('0x3b')]=qs[_0x18cd('0x3c')](_[_0x18cd('0x3d')](_0x233aaa[_0x18cd('0x31')],_0x28f351[_0x18cd('0x3c')]),_0x5de0e1);if(_0x233aaa[_0x18cd('0x31')][_0x18cd('0x3e')]){_0x3fdc1a['where']=_['merge'](_0x3fdc1a[_0x18cd('0x3b')],{'$or':_[_0x18cd('0x3f')](_0x5de0e1,function(_0x1fe121){if(_0x1fe121[_0x18cd('0x2e')]!=='VIRTUAL'){var _0x217de5={};_0x217de5[_0x1fe121['name']]={'$like':'%'+_0x233aaa[_0x18cd('0x31')][_0x18cd('0x3e')]+'%'};return _0x217de5;}})});}_0x3fdc1a=_['merge']({},_0x3fdc1a,_0x233aaa[_0x18cd('0x40')]);var _0x298746={'where':_0x3fdc1a[_0x18cd('0x3b')]};return db['VoiceTransferReport'][_0x18cd('0x21')](_0x298746)[_0x18cd('0x26')](function(_0x535836){_0x1529ee[_0x18cd('0x21')]=_0x535836;if(_0x233aaa[_0x18cd('0x31')][_0x18cd('0x41')]){_0x3fdc1a[_0x18cd('0x42')]=[{'all':!![]}];}return db[_0x18cd('0x43')][_0x18cd('0x44')](_0x3fdc1a);})[_0x18cd('0x26')](function(_0x518bc6){_0x1529ee[_0x18cd('0x45')]=_0x518bc6;return _0x1529ee;})['then'](respondWithFilteredResult(_0x103a26,_0x3fdc1a))['catch'](handleError(_0x103a26,null));};exports[_0x18cd('0x46')]=function(_0x50fe77,_0x476b8c){var _0x31c41d={'raw':!![],'where':{'id':_0x50fe77[_0x18cd('0x47')]['id']}},_0x5c1736={};_0x5c1736[_0x18cd('0x30')]=_['keys'](db[_0x18cd('0x43')]['rawAttributes']);_0x5c1736[_0x18cd('0x31')]=_['keys'](_0x50fe77['query']);_0x5c1736[_0x18cd('0x3c')]=_['intersection'](_0x5c1736[_0x18cd('0x30')],_0x5c1736[_0x18cd('0x31')]);_0x31c41d[_0x18cd('0x34')]=_[_0x18cd('0x33')](_0x5c1736[_0x18cd('0x30')],qs[_0x18cd('0x35')](_0x50fe77[_0x18cd('0x31')]['fields']));_0x31c41d[_0x18cd('0x34')]=_0x31c41d[_0x18cd('0x34')][_0x18cd('0x36')]?_0x31c41d[_0x18cd('0x34')]:_0x5c1736['model'];if(_0x50fe77[_0x18cd('0x31')][_0x18cd('0x41')]){_0x31c41d[_0x18cd('0x42')]=[{'all':!![]}];}_0x31c41d=_[_0x18cd('0x48')]({},_0x31c41d,_0x50fe77['options']);return db[_0x18cd('0x43')][_0x18cd('0x49')](_0x31c41d)[_0x18cd('0x26')](handleEntityNotFound(_0x476b8c,null))['then'](respondWithResult(_0x476b8c,null))[_0x18cd('0x4a')](handleError(_0x476b8c,null));};exports[_0x18cd('0x4b')]=function(_0xcb8137,_0x3de620){return db['VoiceTransferReport'][_0x18cd('0x4b')](_0xcb8137[_0x18cd('0x4c')],{})['then'](respondWithResult(_0x3de620,0xc9))[_0x18cd('0x4a')](handleError(_0x3de620,null));};exports['update']=function(_0x2d5474,_0x17bb5a){if(_0x2d5474['body']['id']){delete _0x2d5474[_0x18cd('0x4c')]['id'];}return db[_0x18cd('0x43')]['find']({'where':{'id':_0x2d5474[_0x18cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x17bb5a,null))[_0x18cd('0x26')](saveUpdates(_0x2d5474[_0x18cd('0x4c')],null))[_0x18cd('0x26')](respondWithResult(_0x17bb5a,null))[_0x18cd('0x4a')](handleError(_0x17bb5a,null));};exports[_0x18cd('0x4d')]=function(_0x108eb8,_0x599477){return db[_0x18cd('0x43')][_0x18cd('0x49')]({'where':{'id':_0x108eb8['params']['id']}})['then'](handleEntityNotFound(_0x599477,null))['then'](removeEntity(_0x599477,null))[_0x18cd('0x4a')](handleError(_0x599477,null));};exports[_0x18cd('0x4e')]=function(_0x1b57f0,_0x1ab980){return db[_0x18cd('0x43')][_0x18cd('0x4e')]()[_0x18cd('0x26')](respondWithResult(_0x1ab980,null))[_0x18cd('0x4a')](handleError(_0x1ab980,null));}; \ No newline at end of file +var _0x7274=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','VoiceTransferReport','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel'];(function(_0x16dfa3,_0x118719){var _0x1209aa=function(_0x104df2){while(--_0x104df2){_0x16dfa3['push'](_0x16dfa3['shift']());}};_0x1209aa(++_0x118719);}(_0x7274,0x8d));var _0x4727=function(_0x2428e8,_0x30492c){_0x2428e8=_0x2428e8-0x0;var _0x42500b=_0x7274[_0x2428e8];return _0x42500b;};'use strict';var emlformat=require(_0x4727('0x0'));var rimraf=require(_0x4727('0x1'));var zipdir=require(_0x4727('0x2'));var jsonpatch=require(_0x4727('0x3'));var rp=require(_0x4727('0x4'));var moment=require(_0x4727('0x5'));var BPromise=require(_0x4727('0x6'));var Mustache=require('mustache');var util=require(_0x4727('0x7'));var path=require(_0x4727('0x8'));var sox=require(_0x4727('0x9'));var csv=require(_0x4727('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4727('0xb'));var squel=require(_0x4727('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4727('0xd'));var toCsv=require(_0x4727('0xa'));var querystring=require('querystring');var Papa=require(_0x4727('0xe'));var Redis=require(_0x4727('0xf'));var authService=require(_0x4727('0x10'));var qs=require(_0x4727('0x11'));var as=require(_0x4727('0x12'));var hardwareService=require(_0x4727('0x13'));var logger=require('../../config/logger')(_0x4727('0x14'));var utils=require(_0x4727('0x15'));var config=require(_0x4727('0x16'));var licenseUtil=require(_0x4727('0x17'));var db=require(_0x4727('0x18'))['db'];function respondWithStatusCode(_0x417672,_0x3faf71){_0x3faf71=_0x3faf71||0xcc;return function(_0x2d947f){if(_0x2d947f){return _0x417672[_0x4727('0x19')](_0x3faf71);}return _0x417672['status'](_0x3faf71)[_0x4727('0x1a')]();};}function respondWithResult(_0x3d791c,_0x2cc9a9){_0x2cc9a9=_0x2cc9a9||0xc8;return function(_0x369c1f){if(_0x369c1f){return _0x3d791c[_0x4727('0x1b')](_0x2cc9a9)[_0x4727('0x1c')](_0x369c1f);}};}function respondWithFilteredResult(_0x5d055c,_0x4408a7){return function(_0xd802ef){if(_0xd802ef){var _0x86e98a=typeof _0x4408a7[_0x4727('0x1d')]===_0x4727('0x1e')&&typeof _0x4408a7[_0x4727('0x1f')]===_0x4727('0x1e');var _0x5cb4a0=_0xd802ef[_0x4727('0x20')];var _0x33edf8=_0x86e98a?0x0:_0x4408a7['offset'];var _0xae2862=_0x86e98a?_0xd802ef[_0x4727('0x20')]:_0x4408a7[_0x4727('0x1d')]+_0x4408a7['limit'];var _0x119191;if(_0xae2862>=_0x5cb4a0){_0xae2862=_0x5cb4a0;_0x119191=0xc8;}else{_0x119191=0xce;}_0x5d055c[_0x4727('0x1b')](_0x119191);return _0x5d055c[_0x4727('0x21')](_0x4727('0x22'),_0x33edf8+'-'+_0xae2862+'/'+_0x5cb4a0)[_0x4727('0x1c')](_0xd802ef);}return null;};}function patchUpdates(_0x5f15c5){return function(_0x2aa0b5){try{jsonpatch[_0x4727('0x23')](_0x2aa0b5,_0x5f15c5,!![]);}catch(_0x7ffa56){return BPromise['reject'](_0x7ffa56);}return _0x2aa0b5[_0x4727('0x24')]();};}function saveUpdates(_0x5ca89a,_0x57ec2b){return function(_0x54c189){if(_0x54c189){return _0x54c189[_0x4727('0x25')](_0x5ca89a)[_0x4727('0x26')](function(_0x4da850){return _0x4da850;});}return null;};}function removeEntity(_0xbc6b6b,_0x20618f){return function(_0x496cdb){if(_0x496cdb){return _0x496cdb[_0x4727('0x27')]()['then'](function(){_0xbc6b6b['status'](0xcc)[_0x4727('0x1a')]();});}};}function handleEntityNotFound(_0x20bc7a,_0x4fa291){return function(_0xb9eacf){if(!_0xb9eacf){_0x20bc7a['sendStatus'](0x194);}return _0xb9eacf;};}function handleError(_0x3c0c2c,_0x31cd6b){_0x31cd6b=_0x31cd6b||0x1f4;return function(_0x1889d3){logger[_0x4727('0x28')](_0x1889d3[_0x4727('0x29')]);if(_0x1889d3['name']){delete _0x1889d3[_0x4727('0x2a')];}_0x3c0c2c['status'](_0x31cd6b)['send'](_0x1889d3);};}exports['index']=function(_0x5c662e,_0x207308){var _0x6a480d={},_0x447e4d={},_0x1019b5={'count':0x0,'rows':[]};var _0x5c04c5=_['map'](db['VoiceTransferReport'][_0x4727('0x2b')],function(_0x16814a){return{'name':_0x16814a[_0x4727('0x2c')],'type':_0x16814a['type']['key']};});_0x447e4d[_0x4727('0x2d')]=_[_0x4727('0x2e')](_0x5c04c5,'name');_0x447e4d['query']=_[_0x4727('0x2f')](_0x5c662e[_0x4727('0x30')]);_0x447e4d[_0x4727('0x31')]=_[_0x4727('0x32')](_0x447e4d[_0x4727('0x2d')],_0x447e4d[_0x4727('0x30')]);_0x6a480d[_0x4727('0x33')]=_['intersection'](_0x447e4d[_0x4727('0x2d')],qs[_0x4727('0x34')](_0x5c662e[_0x4727('0x30')][_0x4727('0x34')]));_0x6a480d[_0x4727('0x33')]=_0x6a480d['attributes'][_0x4727('0x35')]?_0x6a480d[_0x4727('0x33')]:_0x447e4d[_0x4727('0x2d')];if(!_0x5c662e[_0x4727('0x30')][_0x4727('0x36')](_0x4727('0x37'))){_0x6a480d[_0x4727('0x1f')]=qs[_0x4727('0x1f')](_0x5c662e[_0x4727('0x30')]['limit']);_0x6a480d[_0x4727('0x1d')]=qs['offset'](_0x5c662e[_0x4727('0x30')][_0x4727('0x1d')]);}_0x6a480d[_0x4727('0x38')]=qs[_0x4727('0x39')](_0x5c662e[_0x4727('0x30')]['sort']);_0x6a480d[_0x4727('0x3a')]=qs[_0x4727('0x31')](_[_0x4727('0x3b')](_0x5c662e[_0x4727('0x30')],_0x447e4d[_0x4727('0x31')]),_0x5c04c5);if(_0x5c662e[_0x4727('0x30')]['filter']){_0x6a480d['where']=_[_0x4727('0x3c')](_0x6a480d[_0x4727('0x3a')],{'$or':_[_0x4727('0x2e')](_0x5c04c5,function(_0x452cf6){if(_0x452cf6[_0x4727('0x3d')]!==_0x4727('0x3e')){var _0x122481={};_0x122481[_0x452cf6[_0x4727('0x2a')]]={'$like':'%'+_0x5c662e['query'][_0x4727('0x3f')]+'%'};return _0x122481;}})});}_0x6a480d=_[_0x4727('0x3c')]({},_0x6a480d,_0x5c662e['options']);var _0x26b8dd={'where':_0x6a480d['where']};return db[_0x4727('0x40')][_0x4727('0x20')](_0x26b8dd)[_0x4727('0x26')](function(_0x3ec12b){_0x1019b5[_0x4727('0x20')]=_0x3ec12b;if(_0x5c662e[_0x4727('0x30')]['includeAll']){_0x6a480d[_0x4727('0x41')]=[{'all':!![]}];}return db[_0x4727('0x40')][_0x4727('0x42')](_0x6a480d);})['then'](function(_0x415731){_0x1019b5[_0x4727('0x43')]=_0x415731;return _0x1019b5;})[_0x4727('0x26')](respondWithFilteredResult(_0x207308,_0x6a480d))[_0x4727('0x44')](handleError(_0x207308,null));};exports[_0x4727('0x45')]=function(_0x4b7f48,_0x1e197a){var _0x282d6d={'raw':!![],'where':{'id':_0x4b7f48[_0x4727('0x46')]['id']}},_0x469f7a={};_0x469f7a[_0x4727('0x2d')]=_[_0x4727('0x2f')](db['VoiceTransferReport']['rawAttributes']);_0x469f7a[_0x4727('0x30')]=_[_0x4727('0x2f')](_0x4b7f48[_0x4727('0x30')]);_0x469f7a[_0x4727('0x31')]=_['intersection'](_0x469f7a['model'],_0x469f7a[_0x4727('0x30')]);_0x282d6d['attributes']=_[_0x4727('0x32')](_0x469f7a[_0x4727('0x2d')],qs[_0x4727('0x34')](_0x4b7f48['query'][_0x4727('0x34')]));_0x282d6d['attributes']=_0x282d6d[_0x4727('0x33')]['length']?_0x282d6d[_0x4727('0x33')]:_0x469f7a['model'];if(_0x4b7f48[_0x4727('0x30')][_0x4727('0x47')]){_0x282d6d[_0x4727('0x41')]=[{'all':!![]}];}_0x282d6d=_['merge']({},_0x282d6d,_0x4b7f48[_0x4727('0x48')]);return db['VoiceTransferReport']['find'](_0x282d6d)[_0x4727('0x26')](handleEntityNotFound(_0x1e197a,null))['then'](respondWithResult(_0x1e197a,null))[_0x4727('0x44')](handleError(_0x1e197a,null));};exports[_0x4727('0x49')]=function(_0x454d80,_0xcad93d){return db[_0x4727('0x40')]['create'](_0x454d80[_0x4727('0x4a')],{})['then'](respondWithResult(_0xcad93d,0xc9))[_0x4727('0x44')](handleError(_0xcad93d,null));};exports[_0x4727('0x25')]=function(_0x289376,_0x2b654a){if(_0x289376[_0x4727('0x4a')]['id']){delete _0x289376[_0x4727('0x4a')]['id'];}return db[_0x4727('0x40')][_0x4727('0x4b')]({'where':{'id':_0x289376['params']['id']}})[_0x4727('0x26')](handleEntityNotFound(_0x2b654a,null))['then'](saveUpdates(_0x289376[_0x4727('0x4a')],null))[_0x4727('0x26')](respondWithResult(_0x2b654a,null))[_0x4727('0x44')](handleError(_0x2b654a,null));};exports['destroy']=function(_0x126dfd,_0x3a00cf){return db[_0x4727('0x40')][_0x4727('0x4b')]({'where':{'id':_0x126dfd[_0x4727('0x46')]['id']}})[_0x4727('0x26')](handleEntityNotFound(_0x3a00cf,null))[_0x4727('0x26')](removeEntity(_0x3a00cf,null))[_0x4727('0x44')](handleError(_0x3a00cf,null));};exports[_0x4727('0x4c')]=function(_0x408589,_0x343b61){return db[_0x4727('0x40')]['describe']()[_0x4727('0x26')](respondWithResult(_0x343b61,null))[_0x4727('0x44')](handleError(_0x343b61,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6abd982..d459569 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 _0x0659=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x2343e9,_0x500119){var _0x14be37=function(_0x33a5f2){while(--_0x33a5f2){_0x2343e9['push'](_0x2343e9['shift']());}};_0x14be37(++_0x500119);}(_0x0659,0xa9));var _0x9065=function(_0x243f64,_0x510ea8){_0x243f64=_0x243f64-0x0;var _0x44d876=_0x0659[_0x243f64];return _0x44d876;};'use strict';var _=require(_0x9065('0x0'));var util=require(_0x9065('0x1'));var logger=require(_0x9065('0x2'))(_0x9065('0x3'));var moment=require(_0x9065('0x4'));var BPromise=require(_0x9065('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9065('0x6'));var rimraf=require(_0x9065('0x7'));var config=require('../../config/environment');var attributes=require(_0x9065('0x8'));module[_0x9065('0x9')]=function(_0x2f8164,_0x3a1ab1){return _0x2f8164[_0x9065('0xa')](_0x9065('0xb'),attributes,{'tableName':_0x9065('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf0=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceTransferReport.attributes'];(function(_0x4b40a2,_0x4a8b83){var _0x5d2478=function(_0x3255f4){while(--_0x3255f4){_0x4b40a2['push'](_0x4b40a2['shift']());}};_0x5d2478(++_0x4a8b83);}(_0x1bf0,0x10c));var _0x01bf=function(_0xcb179d,_0x4e4fc8){_0xcb179d=_0xcb179d-0x0;var _0x41a6b5=_0x1bf0[_0xcb179d];return _0x41a6b5;};'use strict';var _=require(_0x01bf('0x0'));var util=require(_0x01bf('0x1'));var logger=require(_0x01bf('0x2'))(_0x01bf('0x3'));var moment=require('moment');var BPromise=require(_0x01bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01bf('0x5'));var rimraf=require('rimraf');var config=require(_0x01bf('0x6'));var attributes=require(_0x01bf('0x7'));module[_0x01bf('0x8')]=function(_0x446979,_0x443094){return _0x446979[_0x01bf('0x9')](_0x01bf('0xa'),attributes,{'tableName':_0x01bf('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 cb2de72..67455bf 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 _0x196f=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceTransferReport','create','options','raw','util','moment','bluebird','randomstring','ioredis'];(function(_0x1de8d8,_0xca0c0c){var _0x5ad51f=function(_0xc3533a){while(--_0xc3533a){_0x1de8d8['push'](_0x1de8d8['shift']());}};_0x5ad51f(++_0xca0c0c);}(_0x196f,0x190));var _0xf196=function(_0x129e8b,_0x2100dd){_0x129e8b=_0x129e8b-0x0;var _0x3d8f35=_0x196f[_0x129e8b];return _0x3d8f35;};'use strict';var _=require('lodash');var util=require(_0xf196('0x0'));var moment=require(_0xf196('0x1'));var BPromise=require(_0xf196('0x2'));var rs=require(_0xf196('0x3'));var fs=require('fs');var Redis=require(_0xf196('0x4'));var db=require(_0xf196('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf196('0x6'))(_0xf196('0x7'));var config=require(_0xf196('0x8'));var jayson=require(_0xf196('0x9'));var client=jayson[_0xf196('0xa')][_0xf196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b8992,_0x2291da,_0x1c6e60){return new BPromise(function(_0x386b6f,_0x4cd667){return client['request'](_0x5b8992,_0x1c6e60)[_0xf196('0xc')](function(_0xca8003){logger[_0xf196('0xd')](_0xf196('0xe'),_0x2291da,_0xf196('0xf'));logger[_0xf196('0x10')](_0xf196('0x11'),_0x2291da,'request\x20sent',JSON['stringify'](_0xca8003));if(_0xca8003[_0xf196('0x12')]){if(_0xca8003[_0xf196('0x12')][_0xf196('0x13')]===0x1f4){logger['error'](_0xf196('0xe'),_0x2291da,_0xca8003[_0xf196('0x12')][_0xf196('0x14')]);return _0x4cd667(_0xca8003['error'][_0xf196('0x14')]);}logger['error'](_0xf196('0xe'),_0x2291da,_0xca8003['error'][_0xf196('0x14')]);return _0x386b6f(_0xca8003[_0xf196('0x12')][_0xf196('0x14')]);}else{logger[_0xf196('0xd')](_0xf196('0xe'),_0x2291da,_0xf196('0xf'));_0x386b6f(_0xca8003[_0xf196('0x15')]['message']);}})[_0xf196('0x16')](function(_0x1fb28c){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2291da,_0x1fb28c);_0x4cd667(_0x1fb28c);});});}exports[_0xf196('0x17')]=function(_0x2d1f0b){var _0x451ef3=this;return new Promise(function(_0x1da348,_0x4ea277){return db['VoiceTransferReport'][_0xf196('0x18')](_0x2d1f0b['body'],{'raw':_0x2d1f0b[_0xf196('0x19')]?_0x2d1f0b[_0xf196('0x19')][_0xf196('0x1a')]===undefined?!![]:![]:!![]})[_0xf196('0xc')](function(_0x36b534){logger[_0xf196('0xd')](_0xf196('0x17'),_0x2d1f0b);logger[_0xf196('0x10')](_0xf196('0x17'),_0x2d1f0b,JSON['stringify'](_0x36b534));_0x1da348(_0x36b534);})[_0xf196('0x16')](function(_0x4338ed){logger['error'](_0xf196('0x17'),_0x4338ed[_0xf196('0x14')],_0x2d1f0b);_0x4ea277(_0x451ef3[_0xf196('0x12')](0x1f4,_0x4338ed[_0xf196('0x14')]));});});}; \ No newline at end of file +var _0x86d7=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0x5769ff,_0x199df5){var _0x4341b0=function(_0x1762cb){while(--_0x1762cb){_0x5769ff['push'](_0x5769ff['shift']());}};_0x4341b0(++_0x199df5);}(_0x86d7,0xe8));var _0x786d=function(_0x198a85,_0x31bf8b){_0x198a85=_0x198a85-0x0;var _0x4ca50d=_0x86d7[_0x198a85];return _0x4ca50d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x786d('0x0'));var BPromise=require('bluebird');var rs=require(_0x786d('0x1'));var fs=require('fs');var Redis=require(_0x786d('0x2'));var db=require(_0x786d('0x3'))['db'];var utils=require(_0x786d('0x4'));var logger=require(_0x786d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x786d('0x6'));var client=jayson[_0x786d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ae2d9,_0x4f5f31,_0x3843db){return new BPromise(function(_0x41dbaf,_0xae38c1){return client[_0x786d('0x8')](_0x4ae2d9,_0x3843db)[_0x786d('0x9')](function(_0x4107c0){logger[_0x786d('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f5f31,_0x786d('0xb'));logger[_0x786d('0xc')](_0x786d('0xd'),_0x4f5f31,_0x786d('0xb'),JSON[_0x786d('0xe')](_0x4107c0));if(_0x4107c0[_0x786d('0xf')]){if(_0x4107c0[_0x786d('0xf')][_0x786d('0x10')]===0x1f4){logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);return _0xae38c1(_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);}logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);return _0x41dbaf(_0x4107c0[_0x786d('0xf')][_0x786d('0x12')]);}else{logger[_0x786d('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f5f31,'request\x20sent');_0x41dbaf(_0x4107c0[_0x786d('0x13')][_0x786d('0x12')]);}})[_0x786d('0x14')](function(_0x5849ca){logger[_0x786d('0xf')](_0x786d('0x11'),_0x4f5f31,_0x5849ca);_0xae38c1(_0x5849ca);});});}exports[_0x786d('0x15')]=function(_0x11b922){var _0x51f120=this;return new Promise(function(_0x44dac3,_0x126d84){return db[_0x786d('0x16')][_0x786d('0x17')](_0x11b922[_0x786d('0x18')],{'raw':_0x11b922[_0x786d('0x19')]?_0x11b922[_0x786d('0x19')][_0x786d('0x1a')]===undefined?!![]:![]:!![]})[_0x786d('0x9')](function(_0x50f16d){logger[_0x786d('0xa')]('CreateVoiceTransferReport',_0x11b922);logger['debug']('CreateVoiceTransferReport',_0x11b922,JSON['stringify'](_0x50f16d));_0x44dac3(_0x50f16d);})[_0x786d('0x14')](function(_0x48a6e0){logger[_0x786d('0xf')](_0x786d('0x15'),_0x48a6e0[_0x786d('0x12')],_0x11b922);_0x126d84(_0x51f120[_0x786d('0xf')](0x1f4,_0x48a6e0[_0x786d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 92ed2ce..9d748e3 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3a5a91,_0x58b1a3){_0x3a5a91=_0x3a5a91-0x0;var _0x21a593=_0xb43b[_0x3a5a91];return _0x21a593;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x5ca8fa,_0x58516a){var _0x4cf9c1=function(_0x2dc668){while(--_0x2dc668){_0x5ca8fa['push'](_0x5ca8fa['shift']());}};_0x4cf9c1(++_0x58516a);}(_0x54ef,0x112));var _0xf54e=function(_0x20bc28,_0x268791){_0x20bc28=_0x20bc28-0x0;var _0x337859=_0x54ef[_0x20bc28];return _0x337859;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c5f1897..47d0630 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 _0x70e0=['rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','body','userId','callNumber','callerId','info','entityFound:','user:%s','json','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:'];(function(_0xf4579e,_0xe8ea79){var _0x185070=function(_0x3657d0){while(--_0x3657d0){_0xf4579e['push'](_0xf4579e['shift']());}};_0x185070(++_0xe8ea79);}(_0x70e0,0x17b));var _0x070e=function(_0x205f7b,_0x5b08c4){_0x205f7b=_0x205f7b-0x0;var _0x28c727=_0x70e0[_0x205f7b];return _0x28c727;};'use strict';var path=require(_0x070e('0x0'));var fs=require('fs');var _=require(_0x070e('0x1'));var db=require(_0x070e('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x070e('0x3'));var jayson=require(_0x070e('0x4'));var amiClient=jayson[_0x070e('0x5')][_0x070e('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x070e('0x7'));var Redis=require('ioredis');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var Schema=require(_0x070e('0xa'));var originateValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'callNumber':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xf')]},'transferNumber':{'type':_0x070e('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]}});function emit(_0xeae1a5,_0x180897,_0x19d9da){logger['info'](_0xeae1a5,_0x180897,JSON['stringify'](_0x19d9da));io['to'](_0xeae1a5)[_0x070e('0x10')](_0x180897,_0x19d9da);}function handleError(_0x2bd937){return function(_0x38f6e6){console[_0x070e('0x11')](_0x070e('0x12'),_0x38f6e6,_0x38f6e6 instanceof RangeError);logger['error'](_0x38f6e6[_0x070e('0x13')]);if(_0x38f6e6 instanceof RangeError){if(_0x38f6e6[_0x070e('0x14')]){delete _0x38f6e6[_0x070e('0x14')];}_0x2bd937[_0x070e('0x15')](0x194)[_0x070e('0x16')](_0x38f6e6);}else{if(_0x38f6e6['name']){delete _0x38f6e6['name'];}_0x2bd937['status'](0x1f4)[_0x070e('0x16')](_0x38f6e6);}};}function checkError(){return function(_0x3004f0){if(!_0x3004f0){throw new RangeError(_0x070e('0x17'));}return _0x3004f0;};}function respondWithRpcPromise(_0x4be0d7,_0x5b184){return new BPromise(function(_0x5dc5d2,_0xf8dd5d){var _0x3f6985=amiClient;return _0x3f6985[_0x070e('0x18')](_0x4be0d7,_0x5b184)[_0x070e('0x19')](function(_0x28a1c3){if(_0x28a1c3[_0x070e('0x1a')]){if(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1b')]===0x1f4){return _0xf8dd5d(_0x28a1c3['error'][_0x070e('0x1c')]);}return _0x5dc5d2(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1c')]);}else{_0x5dc5d2(_0x28a1c3['result']);}})[_0x070e('0x1d')](function(_0x5f3e9d){_0xf8dd5d(_0x5f3e9d);});});}function getAgent(_0x4a2dbd){return db[_0x070e('0x1e')][_0x070e('0x1f')]({'where':{'id':_0x4a2dbd,'role':_0x070e('0x20')}})[_0x070e('0x19')](checkError());}function getAgentCheckSession(_0x4763c6,_0x497f58){return new BPromise(function(_0x374c54,_0x219e48){var _0x1d72d6=respondWithRpcPromise(_0x070e('0x21'));var _0x43dd96=getAgent(_0x4763c6);Promise[_0x070e('0x22')]([_0x1d72d6,_0x43dd96])[_0x070e('0x19')](function(_0x26373b){var _0x5e8326=_0x26373b[0x0];var _0x282344=_0x26373b[0x1];var _0x351641=_[_0x070e('0x23')](_0x5e8326['rows'],function(_0x5c5f0d){return _0x5c5f0d[_0x070e('0x24')]==_0x282344['id']&&_0x5c5f0d[_0x070e('0x25')]==_0x497f58;});if(_0x351641[_0x070e('0x26')]==0x1){_0x374c54(_0x282344);}else{_0x219e48(new RangeError('sessionId\x20'+_0x497f58+_0x070e('0x27')));}});});}exports[_0x070e('0x28')]=function(_0x3a9425,_0x5f2bee){logger['info']('originate\x20fired:',_0x3a9425['body']);var _0x59c5b4=originateValidation[_0x070e('0xa')](_0x3a9425['body']);if(_0x59c5b4[_0x070e('0x26')]>0x0){return _0x5f2bee[_0x070e('0x15')](0x190)['json'](_0x59c5b4);}var _0x47a739=_0x3a9425[_0x070e('0x29')][_0x070e('0x2a')];var _0x55288a=_0x3a9425['body'][_0x070e('0x2b')];var _0x27dd1f=_0x3a9425[_0x070e('0x29')][_0x070e('0x2c')];var _0x18f0ad=_0x3a9425['body']['callbackUrl'];return getAgent(_0x47a739)[_0x070e('0x19')](function(_0x3011c4){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x3011c4[_0x070e('0x14')]);emit(util['format'](_0x070e('0x2f'),_0x3011c4[_0x070e('0x14')]),'webbar:originate',{'callNumber':_0x55288a,'callerId':_0x27dd1f,'callbackUrl':_0x18f0ad});return _0x5f2bee[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x5f2bee));};exports['hangup']=function(_0x363bff,_0x3dfbf7){logger[_0x070e('0x2d')](_0x070e('0x31'),_0x363bff[_0x070e('0x29')]);var _0x5e3827=hangupValidation[_0x070e('0xa')](_0x363bff[_0x070e('0x29')]);if(_0x5e3827[_0x070e('0x26')]>0x0){return _0x3dfbf7['status'](0x190)[_0x070e('0x30')](_0x5e3827);}var _0x72cbc7=_0x363bff[_0x070e('0x29')]['userId'];var _0x13982f=_0x363bff[_0x070e('0x29')]['sessionId'];return getAgent(_0x72cbc7)[_0x070e('0x19')](function(_0x5d689b){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x5d689b[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x5d689b['name']),_0x070e('0x33'),{'sessionId':_0x13982f});return _0x3dfbf7['status'](0xc8)['json']({'error':![],'message':_0x070e('0x34')});})[_0x070e('0x1d')](handleError(_0x3dfbf7));};exports[_0x070e('0x35')]=function(_0x4d52ff,_0x2ad56c){logger[_0x070e('0x2d')](_0x070e('0x36'),_0x4d52ff[_0x070e('0x29')]);var _0x4a4ee3=answerValidation[_0x070e('0xa')](_0x4d52ff['body']);if(_0x4a4ee3['length']>0x0){return _0x2ad56c['status'](0x190)[_0x070e('0x30')](_0x4a4ee3);}var _0x926533=_0x4d52ff[_0x070e('0x29')][_0x070e('0x2a')];var _0x34f23e=_0x4d52ff['body'][_0x070e('0x25')];return getAgent(_0x926533)['then'](function(_0x23dac5){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x23dac5['name']);emit(util['format'](_0x070e('0x2f'),_0x23dac5['name']),_0x070e('0x37'),{'sessionId':_0x34f23e});return _0x2ad56c[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0x070e('0x1d')](handleError(_0x2ad56c));};exports[_0x070e('0x38')]=function(_0x48d836,_0x589b97){logger[_0x070e('0x2d')](_0x070e('0x39'),_0x48d836[_0x070e('0x29')]);var _0x1fc7c4=holdValidation[_0x070e('0xa')](_0x48d836['body']);if(_0x1fc7c4[_0x070e('0x26')]>0x0){return _0x589b97[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1fc7c4);}var _0x391dee=_0x48d836[_0x070e('0x29')][_0x070e('0x2a')];var _0x1f54d5=_0x48d836[_0x070e('0x29')][_0x070e('0x25')];return getAgent(_0x391dee)[_0x070e('0x19')](function(_0x210c4d){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x210c4d[_0x070e('0x14')]);emit(util[_0x070e('0x32')]('user:%s',_0x210c4d[_0x070e('0x14')]),_0x070e('0x3a'),{'sessionId':_0x1f54d5});return _0x589b97[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x3b')});})[_0x070e('0x1d')](handleError(_0x589b97));};exports[_0x070e('0x3c')]=function(_0x35dbaf,_0x1c64d2){logger['info'](_0x070e('0x3d'),_0x35dbaf['body']);var _0x1acddb=unholdValidation[_0x070e('0xa')](_0x35dbaf['body']);if(_0x1acddb[_0x070e('0x26')]>0x0){return _0x1c64d2[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1acddb);}var _0xa74805=_0x35dbaf[_0x070e('0x29')][_0x070e('0x2a')];var _0x83f21e=_0x35dbaf['body'][_0x070e('0x25')];return getAgent(_0xa74805)['then'](function(_0x516161){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x516161[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x516161[_0x070e('0x14')]),_0x070e('0x3e'),{'sessionId':_0x83f21e});return _0x1c64d2[_0x070e('0x15')](0xc8)['json']({'error':![],'message':_0x070e('0x3f')});})['catch'](handleError(_0x1c64d2));};exports['calls']=function(_0x3a76e2,_0x20acc6){logger['info'](_0x070e('0x40'),_0x20acc6[_0x070e('0x29')]);var _0x210f4a=callsValidation[_0x070e('0xa')](_0x3a76e2[_0x070e('0x29')]);if(_0x210f4a[_0x070e('0x26')]>0x0){return _0x20acc6[_0x070e('0x15')](0x190)['json'](_0x210f4a);}var _0x5874cd=_0x3a76e2['body'][_0x070e('0x2a')];var _0x1948a5=respondWithRpcPromise(_0x070e('0x21'));var _0x2f8fcb=getAgent(_0x5874cd);return Promise['all']([_0x1948a5,_0x2f8fcb])[_0x070e('0x19')](function(_0x5d3c3a){var _0x212710=_0x5d3c3a[0x0];var _0x1cbb7e=_0x5d3c3a[0x1];var _0x476804=_[_0x070e('0x23')](_0x212710[_0x070e('0x41')],function(_0x15dbc4){return _0x15dbc4['UserId']==_0x1cbb7e['id'];});return _0x20acc6[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'count':_0x476804[_0x070e('0x26')],'rows':_0x476804});})['catch'](handleError(_0x20acc6));};exports[_0x070e('0x42')]=function(_0x1da803,_0x5cd534){logger[_0x070e('0x2d')]('conference\x20fired:',_0x1da803[_0x070e('0x29')]);var _0x569f92=conferenceValidation['validate'](_0x1da803['body']);if(_0x569f92[_0x070e('0x26')]>0x0){return _0x5cd534[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x569f92);}var _0x122198=_0x1da803[_0x070e('0x29')][_0x070e('0x2a')];return getAgent(_0x122198)['then'](function(_0x841c89){logger['info'](_0x070e('0x2e'),_0x841c89['name']);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x841c89['name']),_0x070e('0x43'));return _0x5cd534['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x44')});})[_0x070e('0x1d')](handleError(_0x5cd534));};exports[_0x070e('0x45')]=function(_0x764b06,_0x20c772){logger[_0x070e('0x2d')](_0x070e('0x46'),_0x764b06[_0x070e('0x29')]);var _0x3332d0=transferValidation[_0x070e('0xa')](_0x764b06[_0x070e('0x29')]);if(_0x3332d0[_0x070e('0x26')]>0x0){return _0x20c772[_0x070e('0x15')](0x190)['json'](_0x3332d0);}var _0x45bf20=_0x764b06[_0x070e('0x29')][_0x070e('0x2a')];var _0x93301a=_0x764b06['body'][_0x070e('0x25')];var _0x4e8e58=_0x764b06[_0x070e('0x29')][_0x070e('0x47')];return getAgent(_0x45bf20)[_0x070e('0x19')](function(_0x12a58f){logger['info'](_0x070e('0x2e'),_0x12a58f[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x12a58f['name']),_0x070e('0x48'),{'sessionId':_0x93301a,'transferNumber':_0x4e8e58});return _0x20c772['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x49')});})[_0x070e('0x1d')](handleError(_0x20c772));}; \ No newline at end of file +var _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0xa588,0xe1));var _0x8a58=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0xa588[_0x59ab65];return _0x57db9b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8cd7ded..3b6c4e6 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 _0x1c6c=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update'];(function(_0x1fd2b1,_0x725f97){var _0x24bef1=function(_0x594f13){while(--_0x594f13){_0x1fd2b1['push'](_0x1fd2b1['shift']());}};_0x24bef1(++_0x725f97);}(_0x1c6c,0xc9));var _0xc1c6=function(_0x8dbc23,_0x33f226){_0x8dbc23=_0x8dbc23-0x0;var _0x386179=_0x1c6c[_0x8dbc23];return _0x386179;};'use strict';var multer=require('multer');var util=require(_0xc1c6('0x0'));var path=require(_0xc1c6('0x1'));var timeout=require(_0xc1c6('0x2'));var express=require(_0xc1c6('0x3'));var router=express['Router']();var fs_extra=require(_0xc1c6('0x4'));var auth=require(_0xc1c6('0x5'));var interaction=require(_0xc1c6('0x6'));var config=require('../../config/environment');var controller=require(_0xc1c6('0x7'));router[_0xc1c6('0x8')]('/',auth[_0xc1c6('0x9')](),controller[_0xc1c6('0xa')]);router[_0xc1c6('0x8')](_0xc1c6('0xb'),auth[_0xc1c6('0x9')](),controller['describe']);router[_0xc1c6('0x8')](_0xc1c6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc1c6('0x8')](_0xc1c6('0xd'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0xe')]);router[_0xc1c6('0x8')](_0xc1c6('0xf'),auth['isAuthenticated'](),controller[_0xc1c6('0x10')]);router[_0xc1c6('0x8')](_0xc1c6('0x11'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x12')]);router[_0xc1c6('0x8')](_0xc1c6('0x13'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x14')]);router[_0xc1c6('0x15')]('/',auth['isAuthenticated'](),controller[_0xc1c6('0x16')]);router[_0xc1c6('0x15')](_0xc1c6('0xd'),auth['isAuthenticated'](),controller[_0xc1c6('0x17')]);router['post'](_0xc1c6('0xf'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x18')]);router['post']('/:id/users',auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x19')]);router[_0xc1c6('0x15')]('/:id/applications',auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x1a')]);router[_0xc1c6('0x15')](_0xc1c6('0x1b'),controller[_0xc1c6('0x1c')]);router[_0xc1c6('0x15')](_0xc1c6('0x1d'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x1e')]);router[_0xc1c6('0x1f')](_0xc1c6('0xc'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x20')]);router[_0xc1c6('0x21')](_0xc1c6('0xc'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x22')]);router[_0xc1c6('0x21')]('/:id/dispositions',auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x23')]);router[_0xc1c6('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc1c6('0x24')]);router['delete'](_0xc1c6('0x11'),auth[_0xc1c6('0x9')](),controller[_0xc1c6('0x25')]);module[_0xc1c6('0x26')]=router; \ No newline at end of file +var _0xd135=['./whatsappAccount.controller','get','index','describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x429a87,_0x3a32da){var _0x2a7cd2=function(_0x29e2f1){while(--_0x29e2f1){_0x429a87['push'](_0x429a87['shift']());}};_0x2a7cd2(++_0x3a32da);}(_0xd135,0xd1));var _0x5d13=function(_0x496ec2,_0x2aabee){_0x496ec2=_0x496ec2-0x0;var _0x32653a=_0xd135[_0x496ec2];return _0x32653a;};'use strict';var multer=require('multer');var util=require(_0x5d13('0x0'));var path=require(_0x5d13('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d13('0x2'));var router=express[_0x5d13('0x3')]();var fs_extra=require(_0x5d13('0x4'));var auth=require(_0x5d13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5d13('0x6'));var controller=require(_0x5d13('0x7'));router[_0x5d13('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d13('0x9')]);router[_0x5d13('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5d13('0xa')]);router[_0x5d13('0x8')]('/:id',auth[_0x5d13('0xb')](),controller['show']);router[_0x5d13('0x8')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller[_0x5d13('0xd')]);router[_0x5d13('0x8')](_0x5d13('0xe'),auth[_0x5d13('0xb')](),controller[_0x5d13('0xf')]);router[_0x5d13('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x5d13('0x8')](_0x5d13('0x10'),auth['isAuthenticated'](),controller[_0x5d13('0x11')]);router['post']('/',auth[_0x5d13('0xb')](),controller[_0x5d13('0x12')]);router[_0x5d13('0x13')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x14')]);router[_0x5d13('0x13')](_0x5d13('0xe'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x15')]);router[_0x5d13('0x13')](_0x5d13('0x16'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x17')]);router[_0x5d13('0x13')](_0x5d13('0x10'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x18')]);router['post'](_0x5d13('0x19'),controller[_0x5d13('0x1a')]);router['post'](_0x5d13('0x1b'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x1c')]);router[_0x5d13('0x1d')](_0x5d13('0x1e'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x1f')]);router[_0x5d13('0x20')](_0x5d13('0x1e'),auth[_0x5d13('0xb')](),controller['destroy']);router[_0x5d13('0x20')](_0x5d13('0xc'),auth[_0x5d13('0xb')](),controller['removeDispositions']);router[_0x5d13('0x20')](_0x5d13('0xe'),auth['isAuthenticated'](),controller[_0x5d13('0x21')]);router['delete'](_0x5d13('0x16'),auth[_0x5d13('0xb')](),controller[_0x5d13('0x22')]);module[_0x5d13('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2e374d0..c4b91fd 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 _0x7d9f=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x2de41e,_0x12a7dc){var _0x2e70d1=function(_0x3e77ba){while(--_0x3e77ba){_0x2de41e['push'](_0x2de41e['shift']());}};_0x2e70d1(++_0x12a7dc);}(_0x7d9f,0x135));var _0xf7d9=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x7d9f[_0x2fb87c];return _0x43038b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf7d9('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf7d9('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf7d9('0x2')],'defaultValue':function(){return rs[_0xf7d9('0x4')]();}},'phone':{'type':Sequelize[_0xf7d9('0x2')]},'type':{'type':Sequelize[_0xf7d9('0x5')](_0xf7d9('0x6'),_0xf7d9('0x7'))},'accountSid':{'type':Sequelize[_0xf7d9('0x2')]},'baseUrl':{'type':Sequelize[_0xf7d9('0x2')]},'authToken':{'type':Sequelize[_0xf7d9('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf7d9('0x8')],'defaultValue':function(){return _0xf7d9('0x9');}},'notificationSound':{'type':Sequelize[_0xf7d9('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf7d9('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf7d9('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf7d9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf7d9('0xb')],'comment':_0xf7d9('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xf7d9('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2f93da){if(!_0x2f93da){this[_0xf7d9('0xd')](_0xf7d9('0xe'),null);}this[_0xf7d9('0xd')](_0xf7d9('0xf'),_0x2f93da);}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file +var _0x3df2=['twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate'];(function(_0x429a21,_0x43b4e0){var _0x3a8c04=function(_0x589489){while(--_0x589489){_0x429a21['push'](_0x429a21['shift']());}};_0x3a8c04(++_0x43b4e0);}(_0x3df2,0x97));var _0x23df=function(_0x2f142d,_0xf79993){_0x2f142d=_0x2f142d-0x0;var _0x2fc586=_0x3df2[_0x2f142d];return _0x2fc586;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x23df('0x0'));module[_0x23df('0x1')]={'name':{'type':Sequelize[_0x23df('0x2')],'unique':_0x23df('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x23df('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x23df('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x23df('0x4')]();}},'phone':{'type':Sequelize[_0x23df('0x2')]},'type':{'type':Sequelize['ENUM'](_0x23df('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0x23df('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x23df('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x23df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x23df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x23df('0x7')],'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[_0x23df('0x7')],'comment':_0x23df('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x23df('0x6')],'defaultValue':![],'comment':_0x23df('0x9'),'set':function(_0x30b1ba){if(!_0x30b1ba){this[_0x23df('0xa')](_0x23df('0xb'),null);}this['setDataValue']('mandatoryDisposition',_0x30b1ba);}},'description':{'type':Sequelize[_0x23df('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 587b4a8..9b846a9 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 _0x2993=['defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','mandatoryDispositionPause','keys','include','find','create','body','user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','from','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','WhatsappInteraction','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x165a8e,_0x2d019d){var _0x5a657f=function(_0x53e707){while(--_0x53e707){_0x165a8e['push'](_0x165a8e['shift']());}};_0x5a657f(++_0x2d019d);}(_0x2993,0xb1));var _0x3299=function(_0x57f1e2,_0xf4234a){_0x57f1e2=_0x57f1e2-0x0;var _0x2e3f09=_0x2993[_0x57f1e2];return _0x2e3f09;};'use strict';var emlformat=require(_0x3299('0x0'));var rimraf=require(_0x3299('0x1'));var zipdir=require(_0x3299('0x2'));var jsonpatch=require(_0x3299('0x3'));var rp=require(_0x3299('0x4'));var moment=require(_0x3299('0x5'));var BPromise=require(_0x3299('0x6'));var Mustache=require(_0x3299('0x7'));var util=require(_0x3299('0x8'));var path=require(_0x3299('0x9'));var sox=require(_0x3299('0xa'));var csv=require(_0x3299('0xb'));var ejs=require(_0x3299('0xc'));var fs=require('fs');var fs_extra=require(_0x3299('0xd'));var _=require(_0x3299('0xe'));var squel=require(_0x3299('0xf'));var crypto=require('crypto');var jsforce=require(_0x3299('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3299('0xb'));var querystring=require(_0x3299('0x11'));var Papa=require(_0x3299('0x12'));var Redis=require(_0x3299('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3299('0x14'));var as=require(_0x3299('0x15'));var hardwareService=require(_0x3299('0x16'));var logger=require('../../config/logger')(_0x3299('0x17'));var utils=require('../../config/utils');var config=require(_0x3299('0x18'));var licenseUtil=require(_0x3299('0x19'));var db=require(_0x3299('0x1a'))['db'];config[_0x3299('0x1b')]=_[_0x3299('0x1c')](config[_0x3299('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3299('0x1d'))(new Redis(config[_0x3299('0x1b')]));require(_0x3299('0x1e'))[_0x3299('0x1f')](socket);var jayson=require(_0x3299('0x20'));var client=jayson[_0x3299('0x21')][_0x3299('0x22')]({'port':0x232c});function respondWithRpcPromise(_0xbb007a,_0x1b1dc7,_0x569638,_0x2afd64){return new BPromise(function(_0x420c5f,_0x3e4e0f){var _0x3c2924=_0x2afd64||client;return _0x3c2924[_0x3299('0x23')](_0xbb007a,_0x569638)[_0x3299('0x24')](function(_0x29c16f){logger['info'](_0x3299('0x25'),_0x1b1dc7,'request\x20sent');logger[_0x3299('0x26')](_0x3299('0x27'),_0x1b1dc7,'request\x20sent',JSON[_0x3299('0x28')](_0x29c16f));if(_0x29c16f[_0x3299('0x29')]){if(_0x29c16f['error'][_0x3299('0x2a')]===0x1f4){logger[_0x3299('0x29')](_0x3299('0x25'),_0x1b1dc7,_0x29c16f['error'][_0x3299('0x2b')]);return _0x3e4e0f(_0x29c16f[_0x3299('0x29')][_0x3299('0x2b')]);}logger[_0x3299('0x29')](_0x3299('0x25'),_0x1b1dc7,_0x29c16f[_0x3299('0x29')][_0x3299('0x2b')]);return _0x420c5f(_0x29c16f['error'][_0x3299('0x2b')]);}else{logger['info'](_0x3299('0x25'),_0x1b1dc7,_0x3299('0x2c'));_0x420c5f(_0x29c16f[_0x3299('0x2d')][_0x3299('0x2b')]);}})[_0x3299('0x2e')](function(_0x54e1e4){logger[_0x3299('0x29')](_0x3299('0x25'),_0x1b1dc7,_0x54e1e4);_0x3e4e0f(_0x54e1e4);});});}function respondWithStatusCode(_0x585f20,_0x3c1622){_0x3c1622=_0x3c1622||0xcc;return function(_0x45227a){if(_0x45227a){return _0x585f20[_0x3299('0x2f')](_0x3c1622);}return _0x585f20[_0x3299('0x30')](_0x3c1622)[_0x3299('0x31')]();};}function respondWithResult(_0x4a7b94,_0x45d81b){_0x45d81b=_0x45d81b||0xc8;return function(_0xec7643){if(_0xec7643){return _0x4a7b94[_0x3299('0x30')](_0x45d81b)[_0x3299('0x32')](_0xec7643);}};}function respondWithFilteredResult(_0x7e7c3b,_0x13e12f){return function(_0x1cb9db){if(_0x1cb9db){var _0x2ee30e=typeof _0x13e12f[_0x3299('0x33')]===_0x3299('0x34')&&typeof _0x13e12f[_0x3299('0x35')]===_0x3299('0x34');var _0x15fbf9=_0x1cb9db[_0x3299('0x36')];var _0x334705=_0x2ee30e?0x0:_0x13e12f['offset'];var _0x1f850d=_0x2ee30e?_0x1cb9db[_0x3299('0x36')]:_0x13e12f['offset']+_0x13e12f[_0x3299('0x35')];var _0x3b84bc;if(_0x1f850d>=_0x15fbf9){_0x1f850d=_0x15fbf9;_0x3b84bc=0xc8;}else{_0x3b84bc=0xce;}_0x7e7c3b[_0x3299('0x30')](_0x3b84bc);return _0x7e7c3b[_0x3299('0x37')]('Content-Range',_0x334705+'-'+_0x1f850d+'/'+_0x15fbf9)[_0x3299('0x32')](_0x1cb9db);}return null;};}function patchUpdates(_0x52ebd9){return function(_0x500268){try{jsonpatch['apply'](_0x500268,_0x52ebd9,!![]);}catch(_0x55f26b){return BPromise[_0x3299('0x38')](_0x55f26b);}return _0x500268['save']();};}function saveUpdates(_0x3aaa66,_0x272bde){return function(_0x45f924){if(_0x45f924){return _0x45f924[_0x3299('0x39')](_0x3aaa66)['then'](function(_0x201000){return _0x201000;});}return null;};}function removeEntity(_0x119af5,_0x155ec7){return function(_0x5de4bd){if(_0x5de4bd){return _0x5de4bd[_0x3299('0x3a')]()[_0x3299('0x24')](function(){var _0xde32e9=_0x5de4bd[_0x3299('0x3b')]({'plain':!![]});var _0x48090c='WhatsappAccounts';return db[_0x3299('0x3c')][_0x3299('0x3a')]({'where':{'type':_0x48090c,'resourceId':_0xde32e9['id']}})[_0x3299('0x24')](function(){return _0x5de4bd;});})[_0x3299('0x24')](function(){_0x119af5[_0x3299('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589493,_0x2f4bdf){return function(_0x177691){if(!_0x177691){_0x589493[_0x3299('0x2f')](0x194);}return _0x177691;};}function handleError(_0x3835b5,_0x21883f){_0x21883f=_0x21883f||0x1f4;return function(_0x444bdf){logger[_0x3299('0x29')](_0x444bdf['stack']);if(_0x444bdf[_0x3299('0x3d')]){delete _0x444bdf['name'];}_0x3835b5[_0x3299('0x30')](_0x21883f)[_0x3299('0x3e')](_0x444bdf);};}exports[_0x3299('0x3f')]=function(_0x112c5a,_0x2bc53d){var _0x856ce9={'include':[{'model':db[_0x3299('0x40')],'as':'mandatoryDispositionPause'}]},_0x4c28ba={},_0x3f922a={'count':0x0,'rows':[]};var _0xdca8ca=_[_0x3299('0x41')](db[_0x3299('0x42')][_0x3299('0x43')],function(_0x2a5cb0){return{'name':_0x2a5cb0[_0x3299('0x44')],'type':_0x2a5cb0[_0x3299('0x45')][_0x3299('0x46')]};});_0x4c28ba[_0x3299('0x47')]=_[_0x3299('0x41')](_0xdca8ca,'name');_0x4c28ba[_0x3299('0x48')]=_['keys'](_0x112c5a[_0x3299('0x48')]);_0x4c28ba['filters']=_[_0x3299('0x49')](_0x4c28ba['model'],_0x4c28ba[_0x3299('0x48')]);_0x856ce9['attributes']=_['intersection'](_0x4c28ba[_0x3299('0x47')],qs[_0x3299('0x4a')](_0x112c5a[_0x3299('0x48')][_0x3299('0x4a')]));_0x856ce9[_0x3299('0x4b')]=_0x856ce9[_0x3299('0x4b')][_0x3299('0x4c')]?_0x856ce9[_0x3299('0x4b')]:_0x4c28ba['model'];if(!_0x112c5a[_0x3299('0x48')]['hasOwnProperty'](_0x3299('0x4d'))){_0x856ce9[_0x3299('0x35')]=qs[_0x3299('0x35')](_0x112c5a[_0x3299('0x48')][_0x3299('0x35')]);_0x856ce9[_0x3299('0x33')]=qs[_0x3299('0x33')](_0x112c5a[_0x3299('0x48')][_0x3299('0x33')]);}_0x856ce9['order']=qs[_0x3299('0x4e')](_0x112c5a['query'][_0x3299('0x4e')]);_0x856ce9[_0x3299('0x4f')]=qs['filters'](_['pick'](_0x112c5a[_0x3299('0x48')],_0x4c28ba[_0x3299('0x50')]),_0xdca8ca);if(_0x112c5a[_0x3299('0x48')][_0x3299('0x51')]){_0x856ce9[_0x3299('0x4f')]=_[_0x3299('0x52')](_0x856ce9[_0x3299('0x4f')],{'$or':_[_0x3299('0x41')](_0xdca8ca,function(_0x58f4c7){if(_0x58f4c7[_0x3299('0x45')]!==_0x3299('0x53')){var _0x27b953={};_0x27b953[_0x58f4c7[_0x3299('0x3d')]]={'$like':'%'+_0x112c5a[_0x3299('0x48')][_0x3299('0x51')]+'%'};return _0x27b953;}})});}_0x856ce9=_[_0x3299('0x52')]({},_0x856ce9,_0x112c5a[_0x3299('0x54')]);var _0x326322={'where':_0x856ce9[_0x3299('0x4f')]};return db[_0x3299('0x42')][_0x3299('0x36')](_0x326322)[_0x3299('0x24')](function(_0x2d41af){_0x3f922a[_0x3299('0x36')]=_0x2d41af;if(_0x112c5a[_0x3299('0x48')][_0x3299('0x55')]){_0x856ce9['include']=[{'all':!![]}];}return db[_0x3299('0x42')][_0x3299('0x56')](_0x856ce9);})['then'](function(_0xae4e05){_0x3f922a[_0x3299('0x57')]=_0xae4e05;return _0x3f922a;})[_0x3299('0x24')](respondWithFilteredResult(_0x2bc53d,_0x856ce9))[_0x3299('0x2e')](handleError(_0x2bc53d,null));};exports['show']=function(_0xd1abd,_0x3e4b20){var _0x151dc5={'raw':![],'where':{'id':_0xd1abd['params']['id']},'include':[{'model':db['Pause'],'as':_0x3299('0x58')}]},_0x4428db={};_0x4428db[_0x3299('0x47')]=_[_0x3299('0x59')](db[_0x3299('0x42')][_0x3299('0x43')]);_0x4428db[_0x3299('0x48')]=_[_0x3299('0x59')](_0xd1abd[_0x3299('0x48')]);_0x4428db['filters']=_['intersection'](_0x4428db[_0x3299('0x47')],_0x4428db['query']);_0x151dc5['attributes']=_[_0x3299('0x49')](_0x4428db[_0x3299('0x47')],qs[_0x3299('0x4a')](_0xd1abd['query'][_0x3299('0x4a')]));_0x151dc5[_0x3299('0x4b')]=_0x151dc5[_0x3299('0x4b')][_0x3299('0x4c')]?_0x151dc5['attributes']:_0x4428db[_0x3299('0x47')];if(_0xd1abd['query']['includeAll']){_0x151dc5[_0x3299('0x5a')]=[{'all':!![]}];}_0x151dc5=_[_0x3299('0x52')]({},_0x151dc5,_0xd1abd[_0x3299('0x54')]);return db[_0x3299('0x42')][_0x3299('0x5b')](_0x151dc5)[_0x3299('0x24')](handleEntityNotFound(_0x3e4b20,null))[_0x3299('0x24')](respondWithResult(_0x3e4b20,null))['catch'](handleError(_0x3e4b20,null));};exports[_0x3299('0x5c')]=function(_0x5168ab,_0x112c70){return db[_0x3299('0x42')][_0x3299('0x5c')](_0x5168ab[_0x3299('0x5d')],{})[_0x3299('0x24')](function(_0x28841b){var _0x159021=_0x5168ab[_0x3299('0x5e')][_0x3299('0x3b')]({'plain':!![]});if(!_0x159021)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159021[_0x3299('0x5f')]===_0x3299('0x5e')){var _0x3b01f3=_0x28841b[_0x3299('0x3b')]({'plain':!![]});var _0x544691=_0x3299('0x60');return db[_0x3299('0x61')][_0x3299('0x5b')]({'where':{'name':_0x544691,'userProfileId':_0x159021[_0x3299('0x62')]},'raw':!![]})[_0x3299('0x24')](function(_0x91eca2){if(_0x91eca2&&_0x91eca2[_0x3299('0x63')]===0x0){return db[_0x3299('0x3c')][_0x3299('0x5c')]({'name':_0x3b01f3[_0x3299('0x3d')],'resourceId':_0x3b01f3['id'],'type':_0x91eca2[_0x3299('0x3d')],'sectionId':_0x91eca2['id']},{})[_0x3299('0x24')](function(){return _0x28841b;});}else{return _0x28841b;}})[_0x3299('0x2e')](function(_0x574a49){logger[_0x3299('0x29')](_0x3299('0x64'),_0x574a49);throw _0x574a49;});}return _0x28841b;})[_0x3299('0x24')](respondWithResult(_0x112c70,0xc9))[_0x3299('0x2e')](handleError(_0x112c70,null));};exports[_0x3299('0x39')]=function(_0xc5c866,_0x3824eb){if(_0xc5c866[_0x3299('0x5d')]['id']){delete _0xc5c866['body']['id'];}return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0xc5c866[_0x3299('0x65')]['id']},'include':[{'model':db[_0x3299('0x40')],'as':'mandatoryDispositionPause'}]})[_0x3299('0x24')](handleEntityNotFound(_0x3824eb,null))['then'](saveUpdates(_0xc5c866[_0x3299('0x5d')],null))['then'](respondWithResult(_0x3824eb,null))['catch'](handleError(_0x3824eb,null));};exports[_0x3299('0x3a')]=function(_0x3af000,_0x19bf0c){return db[_0x3299('0x42')]['find']({'where':{'id':_0x3af000[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x19bf0c,null))[_0x3299('0x24')](removeEntity(_0x19bf0c,null))['catch'](handleError(_0x19bf0c,null));};exports['describe']=function(_0x16396a,_0x5c1724){return db[_0x3299('0x42')][_0x3299('0x66')]()['then'](respondWithResult(_0x5c1724,null))['catch'](handleError(_0x5c1724,null));};exports[_0x3299('0x67')]=function(_0x18e3c5,_0x5a8fd5,_0x19be61){if(_0x18e3c5[_0x3299('0x5d')]['id']){delete _0x18e3c5[_0x3299('0x5d')]['id'];}return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0x18e3c5[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x5a8fd5,null))[_0x3299('0x24')](function(_0x461556){if(_0x461556){_0x18e3c5['body'][_0x3299('0x68')]=_0x461556['id'];return db[_0x3299('0x69')][_0x3299('0x5c')](_0x18e3c5[_0x3299('0x5d')]);}})[_0x3299('0x24')](respondWithResult(_0x5a8fd5,null))['catch'](handleError(_0x5a8fd5,null));};exports[_0x3299('0x6a')]=function(_0x1ee4f1,_0x1c53ad,_0x538885){var _0x5b1d05={'raw':![],'where':{}};var _0x3f598a={};var _0xa3cfaf={'count':0x0,'rows':[]};return db[_0x3299('0x42')][_0x3299('0x6b')]({'where':{'id':_0x1ee4f1[_0x3299('0x65')]['id']}})['then'](handleEntityNotFound(_0x1c53ad,null))[_0x3299('0x24')](function(_0x1af49a){if(_0x1af49a){_0x3f598a[_0x3299('0x47')]=_[_0x3299('0x59')](db[_0x3299('0x69')][_0x3299('0x43')]);_0x3f598a[_0x3299('0x48')]=_['keys'](_0x1ee4f1[_0x3299('0x48')]);_0x3f598a[_0x3299('0x50')]=_[_0x3299('0x49')](_0x3f598a[_0x3299('0x47')],_0x3f598a['query']);_0x5b1d05[_0x3299('0x4b')]=_[_0x3299('0x49')](_0x3f598a[_0x3299('0x47')],qs[_0x3299('0x4a')](_0x1ee4f1[_0x3299('0x48')][_0x3299('0x4a')]));_0x5b1d05[_0x3299('0x4b')]=_0x5b1d05['attributes']['length']?_0x5b1d05[_0x3299('0x4b')]:_0x3f598a[_0x3299('0x47')];if(!_0x1ee4f1[_0x3299('0x48')][_0x3299('0x6c')](_0x3299('0x4d'))){_0x5b1d05['limit']=qs[_0x3299('0x35')](_0x1ee4f1[_0x3299('0x48')][_0x3299('0x35')]);_0x5b1d05[_0x3299('0x33')]=qs['offset'](_0x1ee4f1['query'][_0x3299('0x33')]);}_0x5b1d05[_0x3299('0x6d')]=qs[_0x3299('0x4e')](_0x1ee4f1[_0x3299('0x48')][_0x3299('0x4e')]);_0x5b1d05['where']=qs[_0x3299('0x50')](_['pick'](_0x1ee4f1['query'],_0x3f598a[_0x3299('0x50')]));_0x5b1d05[_0x3299('0x4f')]['WhatsappAccountId']=_0x1af49a['id'];if(_0x1ee4f1['query'][_0x3299('0x51')]){_0x5b1d05['where']=_[_0x3299('0x52')](_0x5b1d05[_0x3299('0x4f')],{'$or':_['map'](_0x5b1d05[_0x3299('0x4b')],function(_0x2760fe){var _0xaac437={};_0xaac437[_0x2760fe]={'$like':'%'+_0x1ee4f1['query'][_0x3299('0x51')]+'%'};return _0xaac437;})});}_0x5b1d05=_[_0x3299('0x52')]({},_0x5b1d05,_0x1ee4f1[_0x3299('0x54')]);return db['Disposition'][_0x3299('0x36')]({'where':_0x5b1d05['where']})[_0x3299('0x24')](function(_0x425a5d){_0xa3cfaf[_0x3299('0x36')]=_0x425a5d;if(_0x1ee4f1[_0x3299('0x48')][_0x3299('0x55')]){_0x5b1d05[_0x3299('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x3299('0x56')](_0x5b1d05);})['then'](function(_0x51fc96){_0xa3cfaf[_0x3299('0x57')]=_0x51fc96;return _0xa3cfaf;});}})[_0x3299('0x24')](respondWithFilteredResult(_0x1c53ad,_0x5b1d05))[_0x3299('0x2e')](handleError(_0x1c53ad,null));};exports[_0x3299('0x6e')]=function(_0x153426,_0x309c6a,_0x268774){return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0x153426[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x309c6a,null))['then'](function(_0xbc2b6d){if(_0xbc2b6d){return _0xbc2b6d[_0x3299('0x6e')](_0x153426['query'][_0x3299('0x6f')]);}})[_0x3299('0x24')](respondWithStatusCode(_0x309c6a,null))[_0x3299('0x2e')](handleError(_0x309c6a,null));};exports[_0x3299('0x70')]=function(_0x3b55e2,_0x2a172e,_0x37ea5d){if(_0x3b55e2[_0x3299('0x5d')]['id']){delete _0x3b55e2[_0x3299('0x5d')]['id'];}return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0x3b55e2[_0x3299('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a172e,null))[_0x3299('0x24')](function(_0x1b81ab){if(_0x1b81ab){_0x3b55e2[_0x3299('0x5d')]['WhatsappAccountId']=_0x1b81ab['id'];return db[_0x3299('0x71')][_0x3299('0x5c')](_0x3b55e2['body']);}})[_0x3299('0x24')](respondWithResult(_0x2a172e,null))[_0x3299('0x2e')](handleError(_0x2a172e,null));};exports[_0x3299('0x72')]=function(_0x425c8a,_0x258c63,_0x222b91){var _0x5d1635={'raw':![],'where':{}};var _0x3b8ea9={};var _0x543499={'count':0x0,'rows':[]};return db[_0x3299('0x42')][_0x3299('0x6b')]({'where':{'id':_0x425c8a[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x258c63,null))[_0x3299('0x24')](function(_0x5e811b){if(_0x5e811b){_0x3b8ea9['model']=_[_0x3299('0x59')](db['CannedAnswer'][_0x3299('0x43')]);_0x3b8ea9[_0x3299('0x48')]=_['keys'](_0x425c8a[_0x3299('0x48')]);_0x3b8ea9['filters']=_[_0x3299('0x49')](_0x3b8ea9[_0x3299('0x47')],_0x3b8ea9[_0x3299('0x48')]);_0x5d1635[_0x3299('0x4b')]=_[_0x3299('0x49')](_0x3b8ea9[_0x3299('0x47')],qs[_0x3299('0x4a')](_0x425c8a['query'][_0x3299('0x4a')]));_0x5d1635[_0x3299('0x4b')]=_0x5d1635[_0x3299('0x4b')][_0x3299('0x4c')]?_0x5d1635[_0x3299('0x4b')]:_0x3b8ea9['model'];if(!_0x425c8a[_0x3299('0x48')][_0x3299('0x6c')](_0x3299('0x4d'))){_0x5d1635[_0x3299('0x35')]=qs['limit'](_0x425c8a[_0x3299('0x48')][_0x3299('0x35')]);_0x5d1635['offset']=qs[_0x3299('0x33')](_0x425c8a[_0x3299('0x48')][_0x3299('0x33')]);}_0x5d1635[_0x3299('0x6d')]=qs[_0x3299('0x4e')](_0x425c8a[_0x3299('0x48')][_0x3299('0x4e')]);_0x5d1635[_0x3299('0x4f')]=qs[_0x3299('0x50')](_[_0x3299('0x73')](_0x425c8a[_0x3299('0x48')],_0x3b8ea9[_0x3299('0x50')]));_0x5d1635[_0x3299('0x4f')][_0x3299('0x68')]=_0x5e811b['id'];if(_0x425c8a['query'][_0x3299('0x51')]){_0x5d1635['where']=_[_0x3299('0x52')](_0x5d1635[_0x3299('0x4f')],{'$or':_[_0x3299('0x41')](_0x5d1635[_0x3299('0x4b')],function(_0x2c20af){var _0x1b8538={};_0x1b8538[_0x2c20af]={'$like':'%'+_0x425c8a[_0x3299('0x48')][_0x3299('0x51')]+'%'};return _0x1b8538;})});}_0x5d1635=_[_0x3299('0x52')]({},_0x5d1635,_0x425c8a[_0x3299('0x54')]);return db[_0x3299('0x71')][_0x3299('0x36')]({'where':_0x5d1635['where']})['then'](function(_0x526b66){_0x543499[_0x3299('0x36')]=_0x526b66;if(_0x425c8a[_0x3299('0x48')][_0x3299('0x55')]){_0x5d1635['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x3299('0x56')](_0x5d1635);})['then'](function(_0x34e9d8){_0x543499[_0x3299('0x57')]=_0x34e9d8;return _0x543499;});}})[_0x3299('0x24')](respondWithFilteredResult(_0x258c63,_0x5d1635))[_0x3299('0x2e')](handleError(_0x258c63,null));};exports[_0x3299('0x74')]=function(_0x18e9e1,_0x5c3636,_0x104599){return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0x18e9e1['params']['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x5c3636,null))[_0x3299('0x24')](function(_0x41dbc1){if(_0x41dbc1){return _0x41dbc1[_0x3299('0x74')](_0x18e9e1[_0x3299('0x48')]['ids']);}})[_0x3299('0x24')](respondWithStatusCode(_0x5c3636,null))[_0x3299('0x2e')](handleError(_0x5c3636,null));};exports[_0x3299('0x75')]=function(_0xe930f9,_0x2d624f,_0x36bd02){return db[_0x3299('0x42')][_0x3299('0x5b')]({'where':{'id':_0xe930f9[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x2d624f,null))[_0x3299('0x24')](function(_0x240555){if(_0x240555){return _0x240555[_0x3299('0x75')](_0xe930f9[_0x3299('0x5d')][_0x3299('0x6f')],_[_0x3299('0x76')](_0xe930f9[_0x3299('0x5d')],[_0x3299('0x6f'),'id'])||{})[_0x3299('0x77')](function(_0x44df22){for(var _0x30f4cb=0x0;_0x30f4cb<_0xe930f9[_0x3299('0x5d')]['ids'][_0x3299('0x4c')];_0x30f4cb+=0x1){socket[_0x3299('0x78')](_0x3299('0x79'),{'UserId':Number(_0xe930f9[_0x3299('0x5d')][_0x3299('0x6f')][_0x30f4cb]),'WhatsappAccountId':Number(_0xe930f9[_0x3299('0x65')]['id'])});}return _0x44df22;});}})[_0x3299('0x24')](respondWithResult(_0x2d624f,null))[_0x3299('0x2e')](handleError(_0x2d624f,null));};exports[_0x3299('0x7a')]=function(_0x3f1e36,_0x3a4663,_0x2e58b9){return db['WhatsappAccount'][_0x3299('0x5b')]({'where':{'id':_0x3f1e36[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x3a4663,null))[_0x3299('0x24')](function(_0x1c7d6c){if(_0x1c7d6c){return _0x1c7d6c[_0x3299('0x7a')](_0x3f1e36['query'][_0x3299('0x6f')])[_0x3299('0x24')](function(){if(_[_0x3299('0x7b')](_0x3f1e36[_0x3299('0x48')]['ids'])){for(var _0x125c12=0x0;_0x125c12<_0x3f1e36[_0x3299('0x48')][_0x3299('0x6f')][_0x3299('0x4c')];_0x125c12+=0x1){socket[_0x3299('0x78')](_0x3299('0x7c'),{'UserId':Number(_0x3f1e36[_0x3299('0x48')]['ids'][_0x125c12]),'WhatsappAccountId':Number(_0x3f1e36[_0x3299('0x65')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x3f1e36['query'][_0x3299('0x6f')]),'WhatsappAccountId':Number(_0x3f1e36[_0x3299('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a4663,null))[_0x3299('0x2e')](handleError(_0x3a4663,null));};exports[_0x3299('0x7d')]=function(_0x2c6c90,_0x209b96,_0x358ab9){var _0x580a1f={};var _0x5ddd09={};var _0x1a6c1e;var _0x14cfd0;return db[_0x3299('0x42')][_0x3299('0x6b')]({'where':{'id':_0x2c6c90['params']['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x209b96,null))['then'](function(_0x28d5cd){if(_0x28d5cd){_0x1a6c1e=_0x28d5cd;_0x5ddd09[_0x3299('0x47')]=_[_0x3299('0x59')](db[_0x3299('0x7e')][_0x3299('0x43')]);_0x5ddd09[_0x3299('0x48')]=_[_0x3299('0x59')](_0x2c6c90['query']);_0x5ddd09['filters']=_[_0x3299('0x49')](_0x5ddd09[_0x3299('0x47')],_0x5ddd09['query']);_0x580a1f[_0x3299('0x4b')]=_[_0x3299('0x49')](_0x5ddd09[_0x3299('0x47')],qs['fields'](_0x2c6c90[_0x3299('0x48')][_0x3299('0x4a')]));_0x580a1f[_0x3299('0x4b')]=_0x580a1f[_0x3299('0x4b')][_0x3299('0x4c')]?_0x580a1f['attributes']:_0x5ddd09['model'];_0x580a1f['order']=qs[_0x3299('0x4e')](_0x2c6c90[_0x3299('0x48')]['sort']);_0x580a1f[_0x3299('0x4f')]=qs[_0x3299('0x50')](_[_0x3299('0x73')](_0x2c6c90[_0x3299('0x48')],_0x5ddd09[_0x3299('0x50')]));if(_0x2c6c90[_0x3299('0x48')][_0x3299('0x51')]){_0x580a1f['where']=_[_0x3299('0x52')](_0x580a1f[_0x3299('0x4f')],{'$or':_[_0x3299('0x41')](_0x580a1f[_0x3299('0x4b')],function(_0x5444d8){var _0x46867f={};_0x46867f[_0x5444d8]={'$like':'%'+_0x2c6c90[_0x3299('0x48')][_0x3299('0x51')]+'%'};return _0x46867f;})});}_0x580a1f=_[_0x3299('0x52')]({},_0x580a1f,_0x2c6c90[_0x3299('0x54')]);return _0x1a6c1e[_0x3299('0x7d')](_0x580a1f);}})[_0x3299('0x24')](function(_0xb67ee1){if(_0xb67ee1){_0x14cfd0=_0xb67ee1[_0x3299('0x4c')];if(!_0x2c6c90['query'][_0x3299('0x6c')](_0x3299('0x4d'))){_0x580a1f[_0x3299('0x35')]=qs[_0x3299('0x35')](_0x2c6c90[_0x3299('0x48')][_0x3299('0x35')]);_0x580a1f[_0x3299('0x33')]=qs[_0x3299('0x33')](_0x2c6c90[_0x3299('0x48')]['offset']);}return _0x1a6c1e['getAgents'](_0x580a1f);}})[_0x3299('0x24')](function(_0x171a7e){if(_0x171a7e){return _0x171a7e?{'count':_0x14cfd0,'rows':_0x171a7e}:null;}})[_0x3299('0x24')](respondWithResult(_0x209b96,null))[_0x3299('0x2e')](handleError(_0x209b96,null));};exports[_0x3299('0x7f')]=function(_0x5edf85,_0x550d05){var _0x13446d=_0x5edf85[_0x3299('0x65')]['id'];var _0x146f95=_0x5edf85[_0x3299('0x5d')];var _0x5e51a4=0xc8;var _0x3b8547=null;return db[_0x3299('0x80')][_0x3299('0x81')]({'isolationLevel':db[_0x3299('0x80')][_0x3299('0x82')][_0x3299('0x83')][_0x3299('0x84')]},function(_0x5f5bdd){return db[_0x3299('0x42')][_0x3299('0x6b')]({'where':{'id':_0x13446d},'transaction':_0x5f5bdd})[_0x3299('0x24')](function(_0x643ad5){if(_0x643ad5){return db['WhatsappApplication'][_0x3299('0x3a')]({'where':{'WhatsappAccountId':_0x13446d},'transaction':_0x5f5bdd})[_0x3299('0x24')](function(){var _0x364100=_['map'](_0x146f95,function(_0x37f358){_0x37f358['WhatsappAccountId']=_0x13446d;return _0x37f358;});return db['WhatsappApplication'][_0x3299('0x85')](_0x364100,{'transaction':_0x5f5bdd});});}else{_0x5e51a4=0x194;_0x3b8547=[];}});})[_0x3299('0x24')](function(){if(_0x5e51a4!==0x194){return db[_0x3299('0x86')][_0x3299('0x87')]({'where':{'WhatsappAccountId':_0x13446d},'order':_0x3299('0x88')})[_0x3299('0x24')](function(_0x2d3971){_0x3b8547=_0x2d3971;});}})[_0x3299('0x2e')](function(_0x101b7a){_0x5e51a4=0x1f4;logger[_0x3299('0x29')](_0x101b7a['stack']);if(_0x101b7a['name']){delete _0x101b7a[_0x3299('0x3d')];}_0x3b8547=_0x101b7a;})[_0x3299('0x89')](function(){if(_0x3b8547===null){_0x550d05[_0x3299('0x2f')](_0x5e51a4);}else{if(_0x5e51a4===0x1f4){_0x550d05['status'](_0x5e51a4)[_0x3299('0x3e')](_0x3b8547);}else{_0x550d05['status'](_0x5e51a4)[_0x3299('0x32')](_0x3b8547);}}});};exports[_0x3299('0x8a')]=function(_0x5576d3,_0x36475,_0x190fc4){var _0x2ee255={};var _0x58bfbc={};var _0x10d1a4;var _0x1f71c1;return db[_0x3299('0x42')][_0x3299('0x6b')]({'where':{'id':_0x5576d3[_0x3299('0x65')]['id']}})[_0x3299('0x24')](handleEntityNotFound(_0x36475,null))[_0x3299('0x24')](function(_0x369fa2){if(_0x369fa2){_0x10d1a4=_0x369fa2;_0x58bfbc['model']=_['keys'](db[_0x3299('0x86')]['rawAttributes']);_0x58bfbc['query']=_[_0x3299('0x59')](_0x5576d3['query']);_0x58bfbc[_0x3299('0x50')]=_[_0x3299('0x49')](_0x58bfbc[_0x3299('0x47')],_0x58bfbc[_0x3299('0x48')]);_0x2ee255[_0x3299('0x4b')]=_['intersection'](_0x58bfbc[_0x3299('0x47')],qs[_0x3299('0x4a')](_0x5576d3[_0x3299('0x48')][_0x3299('0x4a')]));_0x2ee255[_0x3299('0x4b')]=_0x2ee255[_0x3299('0x4b')][_0x3299('0x4c')]?_0x2ee255[_0x3299('0x4b')]:_0x58bfbc[_0x3299('0x47')];_0x2ee255[_0x3299('0x6d')]=qs['sort'](_0x5576d3['query'][_0x3299('0x4e')]);_0x2ee255[_0x3299('0x4f')]=qs[_0x3299('0x50')](_[_0x3299('0x73')](_0x5576d3[_0x3299('0x48')],_0x58bfbc[_0x3299('0x50')]));if(_0x5576d3[_0x3299('0x48')][_0x3299('0x51')]){_0x2ee255[_0x3299('0x4f')]=_[_0x3299('0x52')](_0x2ee255['where'],{'$or':_[_0x3299('0x41')](_0x2ee255[_0x3299('0x4b')],function(_0x5f22ec){var _0x5a8f61={};_0x5a8f61[_0x5f22ec]={'$like':'%'+_0x5576d3[_0x3299('0x48')][_0x3299('0x51')]+'%'};return _0x5a8f61;})});}_0x2ee255=_[_0x3299('0x52')]({},_0x2ee255,_0x5576d3['options']);return _0x10d1a4[_0x3299('0x8a')](_0x2ee255);}})[_0x3299('0x24')](function(_0x39240d){if(_0x39240d){_0x1f71c1=_0x39240d['length'];if(!_0x5576d3[_0x3299('0x48')]['hasOwnProperty']('nolimit')){_0x2ee255['limit']=qs['limit'](_0x5576d3[_0x3299('0x48')][_0x3299('0x35')]);_0x2ee255[_0x3299('0x33')]=qs['offset'](_0x5576d3[_0x3299('0x48')][_0x3299('0x33')]);}return _0x10d1a4[_0x3299('0x8a')](_0x2ee255);}})[_0x3299('0x24')](function(_0x541637){if(_0x541637){return _0x541637?{'count':_0x1f71c1,'rows':_0x541637}:null;}})[_0x3299('0x24')](respondWithResult(_0x36475,null))['catch'](handleError(_0x36475,null));};exports[_0x3299('0x8b')]=function(_0x15d4f8,_0x53cbab,_0x4aeb05){var _0x219c88={'channel':_0x3299('0x8c')};var _0x2b7786=[];var _0x55de6a=[];var _0x195d19={};return db['WhatsappAccount'][_0x3299('0x5b')]({'where':{'id':_0x15d4f8['params']['id']},'include':[{'model':db[_0x3299('0x86')],'as':'Applications'}]})[_0x3299('0x24')](handleEntityNotFound(_0x53cbab,null))['then'](function(_0xec0e8f){_0x219c88['account']=_0xec0e8f;if(_0x219c88[_0x3299('0x8d')]&&_0x219c88[_0x3299('0x8d')]['type']===_0x3299('0x8e')&&_0x15d4f8[_0x3299('0x5d')][_0x3299('0x8f')]){if(_0x15d4f8[_0x3299('0x5d')]['statuses']['length']===0x0)return;if(_0x15d4f8['body'][_0x3299('0x8f')][0x0][_0x3299('0x90')]!==_0x3299('0x91'))return;return db[_0x3299('0x92')][_0x3299('0x39')]({'read':!![],'readAt':_0x15d4f8['body'][_0x3299('0x8f')][0x0][_0x3299('0x93')]},{'where':{'messageId':_0x15d4f8['body'][_0x3299('0x8f')][0x0][_0x3299('0x94')]},'individualHooks':!![]})[_0x3299('0x24')](function(_0x2ae101){return _0x53cbab['status'](0xc8)[_0x3299('0x32')](_0x2ae101);});}_0x219c88['applications']=_['orderBy'](_0xec0e8f[_0x3299('0x95')],[_0x3299('0x88')],['asc']);if(_0x219c88['account'][_0x3299('0x95')]){delete _0x219c88[_0x3299('0x8d')][_0x3299('0x95')];}return db[_0x3299('0x96')][_0x3299('0x66')]()['then'](function(_0x5af5ed){if(!_0x5af5ed){throw new db[(_0x3299('0x97'))][(_0x3299('0x98'))](_0x3299('0x99'));}_0x2b7786=_['difference'](_[_0x3299('0x59')](_0x5af5ed),[_0x3299('0x9a'),_0x3299('0x9b')]);_0x55de6a=_[_0x3299('0x9c')](_[_0x3299('0x59')](_0x5af5ed),[_0x3299('0x9a'),_0x3299('0x9b'),_0x3299('0x9d'),_0x3299('0x9e')]);_0x219c88[_0x3299('0x5d')]={'mapKey':'mobile'};if(_0x219c88[_0x3299('0x8d')]&&_0x219c88[_0x3299('0x8d')][_0x3299('0x45')]===_0x3299('0x9f')){_0x219c88[_0x3299('0x5d')]['from']=_0x15d4f8['body'][_0x3299('0xa0')][_0x3299('0xa1')](_0x3299('0xa2'),'');_0x219c88[_0x3299('0x5d')][_0x3299('0x5d')]=_0x15d4f8[_0x3299('0x5d')][_0x3299('0xa3')];_0x219c88[_0x3299('0x5d')][_0x3299('0xa4')]=_0x15d4f8[_0x3299('0x5d')][_0x3299('0xa5')];}if(_0x219c88[_0x3299('0x8d')]&&_0x219c88[_0x3299('0x8d')][_0x3299('0x45')]==='sinch'){_0x219c88[_0x3299('0x5d')]['from']=_0x15d4f8['body'][_0x3299('0xa6')][0x0][_0x3299('0xa7')];_0x219c88[_0x3299('0x5d')][_0x3299('0x5d')]=_0x15d4f8[_0x3299('0x5d')][_0x3299('0xa6')][0x0][_0x3299('0x2b')][_0x3299('0x5d')];_0x219c88[_0x3299('0x5d')][_0x3299('0xa4')]=_0x15d4f8['body'][_0x3299('0xa6')][0x0]['message_id'];}if(_0x219c88['body']['id']){delete _0x219c88[_0x3299('0x5d')]['id'];}if(_[_0x3299('0xa8')](_0x219c88['body']['from'])){throw new db[(_0x3299('0x97'))][(_0x3299('0x98'))](_0x3299('0xa9'));}if(_[_0x3299('0xa8')](_0x219c88[_0x3299('0x5d')][_0x3299('0x5d')])||_0x219c88[_0x3299('0x5d')][_0x3299('0x5d')]===''){throw new db[(_0x3299('0x97'))][(_0x3299('0x98'))](_0x3299('0xaa'));}if(_[_0x3299('0xa8')](_0x219c88[_0x3299('0x5d')]['mapKey'])){throw new db[(_0x3299('0x97'))][(_0x3299('0x98'))](_0x3299('0xab')+_0x55de6a);}if(!_[_0x3299('0xac')](_0x55de6a,_0x219c88[_0x3299('0x5d')][_0x3299('0xad')])){throw new db[(_0x3299('0x97'))][(_0x3299('0x98'))](_0x3299('0xae')+_0x55de6a);}_0x195d19[_0x219c88[_0x3299('0x5d')][_0x3299('0xad')]]=_0x219c88['body']['from'];return db['CmList']['find']({'where':{'id':_0x219c88[_0x3299('0x8d')][_0x3299('0x9e')]},'include':[{'model':db[_0x3299('0x96')],'as':_0x3299('0xaf'),'where':_0x195d19,'limit':0x1,'order':[[_0x3299('0x9b'),_0x3299('0xb0')]]}]});})[_0x3299('0x24')](handleEntityNotFound(_0x53cbab,null))[_0x3299('0x24')](function(_0x3431f0){if(_0x3431f0){_0x219c88[_0x3299('0xb1')]=_[_0x3299('0x76')](_0x3431f0,['Contacts']);if(_0x3431f0['Contacts'][_0x3299('0x4c')]){return _0x3431f0[_0x3299('0xaf')][0x0];}var _0x53db88=_['defaults'](_0x219c88[_0x3299('0x5d')],{'firstName':_0x219c88[_0x3299('0x5d')][_0x3299('0xa7')],'ListId':_0x3431f0['id']});_0x53db88[_0x219c88['body'][_0x3299('0xad')]]=_0x219c88[_0x3299('0x5d')][_0x3299('0xa7')];return db[_0x3299('0x96')][_0x3299('0x5c')](_0x53db88,{'fields':_0x2b7786,'raw':!![]});}})['then'](handleEntityNotFound(_0x53cbab,null))[_0x3299('0x24')](function(_0x3abb18){if(_0x3abb18){_0x219c88['contact']=_0x3abb18;var _0x4f46ee={'ContactId':_0x3abb18['id'],'phone':_0x219c88[_0x3299('0x5d')][_0x3299('0xa7')],'WhatsappAccountId':_0x15d4f8['params']['id']};var _0x28d202={'ContactId':_0x3abb18['id'],'WhatsappAccountId':_0x15d4f8[_0x3299('0x65')]['id'],'closed':![]};return db[_0x3299('0xb2')][_0x3299('0x5b')]({'where':_0x28d202})['then'](function(_0x5a11fd){if(_0x5a11fd){return[_0x5a11fd,![]];}return db['WhatsappInteraction'][_0x3299('0x5c')](_0x4f46ee)['then'](function(_0x3da731){return[_0x3da731,!![]];});});}})['spread'](function(_0x26f366,_0x1572ce){_0x219c88[_0x3299('0xb3')]=_0x26f366[_0x3299('0x3b')]({'plain':!![]});_0x219c88[_0x3299('0xb3')]['created']=![];if(_0x1572ce){if(_0x219c88[_0x3299('0x8d')][_0x3299('0xb4')]){_0x219c88[_0x3299('0xb5')][_0x3299('0xb6')]({'id':0x0,'priority':_0x219c88[_0x3299('0xb5')]['length']+0x1,'app':_0x3299('0xb7'),'appdata':_0x3299('0xb8'),'interval':_0x3299('0xb9')});}_0x219c88['interaction'][_0x3299('0xba')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x219c88['body']['from'],'messageId':_0x219c88[_0x3299('0x5d')][_0x3299('0xa4')],'body':_0x219c88['body']['body'],'WhatsappAccountId':_0x15d4f8[_0x3299('0x65')]['id'],'WhatsappInteractionId':_0x26f366['id'],'direction':'in','ContactId':_0x26f366['ContactId'],'AttachmentId':_0x219c88[_0x3299('0x5d')]['AttachmentId']});})[_0x3299('0x24')](function(_0x45f32c){_0x219c88['message']=_0x45f32c;if(!_0x219c88[_0x3299('0xb3')][_0x3299('0xbb')])return;return db['User']['find']({'attributes':['id',_0x3299('0x3d')],'where':{'id':_0x219c88[_0x3299('0xb3')][_0x3299('0xbb')]}});})[_0x3299('0x24')](function(_0x37a7d4){if(_0x37a7d4){_0x219c88['applications'][_0x3299('0xbc')]({'id':0x0,'priority':0x0,'app':_0x3299('0xbd'),'appdata':_0x37a7d4['name']+','+(_0x219c88[_0x3299('0x8d')][_0x3299('0xbe')]||0xa),'interval':_0x3299('0xb9')});}if(!_0x219c88[_0x3299('0xb3')][_0x3299('0xbf')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x3299('0x3d')],'where':{'id':_0x219c88[_0x3299('0xb3')]['queueId']}});})[_0x3299('0x24')](function(_0x321616){if(_0x321616){_0x219c88['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x3299('0xc0'),'appdata':_0x321616[_0x3299('0x3d')]+','+(_0x219c88[_0x3299('0x8d')][_0x3299('0xc1')]||0x12c),'interval':_0x3299('0xb9')});}return respondWithRpcPromise(_0x3299('0xc2'),_0x3299('0xc3'),_0x219c88);})[_0x3299('0x24')](function(_0x2f6c8a){if(_0x2f6c8a){var _0x3bd879=0xc8;var _0x481a40='receiveMessage';logger[_0x3299('0xc4')](_0x3299('0x27'),_0x481a40,_0x3bd879,_0x3299('0xc5'));logger[_0x3299('0x26')](_0x3299('0xc6'),_0x481a40,_0x3bd879,_0x3299('0xc5'),JSON[_0x3299('0x28')](_0x2f6c8a));if(_0x219c88['account']['type']==='twilio'){return _0x53cbab[_0x3299('0x30')](_0x3bd879)[_0x3299('0x37')]('Content-Type','text/xml')['send'](_0x3299('0xc7'));}else{return _0x53cbab[_0x3299('0x30')](_0x3bd879)[_0x3299('0x32')](_0x2f6c8a);}}});})[_0x3299('0x2e')](handleError(_0x53cbab,null));};exports['send']=function(_0x247f1f,_0x7d1c11,_0x25e1f5){var _0x40089f,_0x4ccd71,_0x4506df;if(_[_0x3299('0xa8')](_0x247f1f[_0x3299('0x5d')][_0x3299('0x5d')])||_0x247f1f['body'][_0x3299('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x3299('0xaa'));}if(_[_0x3299('0xa8')](_0x247f1f[_0x3299('0x5d')]['to'])){throw new db[(_0x3299('0x97'))]['ValidationError']('to\x20is\x20mandatory');}_0x40089f=_0x247f1f['body']['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x247f1f[_0x3299('0x65')]['id']},'include':[{'model':db[_0x3299('0xc8')],'as':_0x3299('0xc9'),'include':[{'model':db[_0x3299('0x96')],'as':_0x3299('0xaf'),'where':{'mobile':_0x40089f},'limit':0x1,'order':[[_0x3299('0x9b'),_0x3299('0xb0')]]}]}]})[_0x3299('0x24')](handleEntityNotFound(_0x7d1c11,null))[_0x3299('0x24')](function(_0x3affb7){if(_0x3affb7&&_0x3affb7[_0x3299('0xc9')]){_0x4ccd71=_0x3affb7[_0x3299('0x3b')]({'plain':!![]});if(_0x4ccd71[_0x3299('0xc9')]&&_0x4ccd71[_0x3299('0xc9')][_0x3299('0xaf')]['length']){return _0x4ccd71[_0x3299('0xc9')][_0x3299('0xaf')][0x0];}return db[_0x3299('0x96')][_0x3299('0x5c')](_[_0x3299('0x1c')](_0x247f1f[_0x3299('0x5d')],{'firstName':_0x40089f,'mobile':_0x40089f,'phone':_0x40089f,'ListId':_0x4ccd71['ListId']}));}})['then'](handleEntityNotFound(_0x7d1c11,null))[_0x3299('0x24')](function(_0x5e5dfb){if(_0x5e5dfb){_0x4506df=_0x5e5dfb;return db[_0x3299('0xb2')][_0x3299('0x5b')]({'where':{'ContactId':_0x4506df['id'],'closed':![],'WhatsappAccountId':_0x4ccd71['id']}})['then'](function(_0xfeaae5){if(_0xfeaae5){return[_0xfeaae5,![]];}return db[_0x3299('0xb2')][_0x3299('0x5c')]({'UserId':_0x247f1f[_0x3299('0x5e')]['id'],'ContactId':_0x4506df['id'],'WhatsappAccountId':_0x4ccd71['id'],'phone':_0x40089f,'firstMsgDirection':_0x3299('0xca'),'Messages':[_[_0x3299('0x52')](_0x247f1f[_0x3299('0x5d')],{'read':![],'body':_0x247f1f[_0x3299('0x5d')][_0x3299('0x5d')],'phone':_0x40089f,'WhatsappAccountId':_0x4ccd71['id'],'UserId':_0x247f1f[_0x3299('0x5e')]['id'],'ContactId':_0x4506df['id']})]},{'include':[{'model':db[_0x3299('0x92')],'as':_0x3299('0xcb')}]})[_0x3299('0x24')](function(_0x248a62){return[_0x248a62,!![]];});});}})[_0x3299('0x77')](function(_0x4c9c6d,_0xaeb0c){if(_0xaeb0c){return _0x4c9c6d;}return db[_0x3299('0x92')][_0x3299('0x5c')](_[_0x3299('0x52')](_0x247f1f[_0x3299('0x5d')],{'read':![],'body':_0x247f1f[_0x3299('0x5d')][_0x3299('0x5d')],'phone':_0x40089f,'WhatsappAccountId':_0x4ccd71['id'],'WhatsappInteractionId':_0x4c9c6d['id'],'UserId':_0x247f1f['user']['id'],'ContactId':_0x4506df['id']}))[_0x3299('0x24')](function(_0x379c58){_0x4c9c6d[_0x3299('0xcc')][_0x3299('0xcb')]=[];_0x4c9c6d[_0x3299('0xcc')]['Messages'][_0x3299('0xb6')](_0x379c58[_0x3299('0xcc')]);return _0x4c9c6d;});})[_0x3299('0x24')](respondWithResult(_0x7d1c11,null))['catch'](handleError(_0x7d1c11,null));}; \ No newline at end of file +var _0x3df4=['user','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','body','describe','WhatsappAccountId','Disposition','findOne','order','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','ids','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','timestamp','message_id','orderBy','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','MessageSid','notifications','messageId','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','Contacts','DESC','list','omit','WhatsappInteraction','interaction','created','autoclose','applications','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','name','send','Pause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','WhatsappAccount','findAll','rows','show','params','fields','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3816a7,_0x24ab6b){var _0x1ade71=function(_0x1859e9){while(--_0x1859e9){_0x3816a7['push'](_0x3816a7['shift']());}};_0x1ade71(++_0x24ab6b);}(_0x3df4,0x12b));var _0x43df=function(_0x3e7721,_0x20cafc){_0x3e7721=_0x3e7721-0x0;var _0x2a7fc3=_0x3df4[_0x3e7721];return _0x2a7fc3;};'use strict';var emlformat=require(_0x43df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43df('0x1'));var jsonpatch=require(_0x43df('0x2'));var rp=require(_0x43df('0x3'));var moment=require('moment');var BPromise=require(_0x43df('0x4'));var Mustache=require('mustache');var util=require(_0x43df('0x5'));var path=require(_0x43df('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43df('0x7'));var _=require('lodash');var squel=require(_0x43df('0x8'));var crypto=require(_0x43df('0x9'));var jsforce=require(_0x43df('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x43df('0xb'));var Papa=require(_0x43df('0xc'));var Redis=require(_0x43df('0xd'));var authService=require(_0x43df('0xe'));var qs=require(_0x43df('0xf'));var as=require(_0x43df('0x10'));var hardwareService=require(_0x43df('0x11'));var logger=require('../../config/logger')(_0x43df('0x12'));var utils=require(_0x43df('0x13'));var config=require(_0x43df('0x14'));var licenseUtil=require(_0x43df('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x43df('0x16')](config[_0x43df('0x17')],{'host':_0x43df('0x18'),'port':0x18eb});var socket=require(_0x43df('0x19'))(new Redis(config[_0x43df('0x17')]));require(_0x43df('0x1a'))['register'](socket);var jayson=require(_0x43df('0x1b'));var client=jayson[_0x43df('0x1c')][_0x43df('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5b8f37,_0x2021a7,_0x4be769,_0x929881){return new BPromise(function(_0x39fe52,_0x3a4c92){var _0x25b0d7=_0x929881||client;return _0x25b0d7['request'](_0x5b8f37,_0x4be769)[_0x43df('0x1e')](function(_0x42da28){logger['info'](_0x43df('0x1f'),_0x2021a7,_0x43df('0x20'));logger[_0x43df('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2021a7,_0x43df('0x20'),JSON[_0x43df('0x22')](_0x42da28));if(_0x42da28[_0x43df('0x23')]){if(_0x42da28['error'][_0x43df('0x24')]===0x1f4){logger[_0x43df('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x2021a7,_0x42da28[_0x43df('0x23')][_0x43df('0x25')]);return _0x3a4c92(_0x42da28['error'][_0x43df('0x25')]);}logger['error'](_0x43df('0x1f'),_0x2021a7,_0x42da28[_0x43df('0x23')][_0x43df('0x25')]);return _0x39fe52(_0x42da28['error'][_0x43df('0x25')]);}else{logger['info'](_0x43df('0x1f'),_0x2021a7,_0x43df('0x20'));_0x39fe52(_0x42da28[_0x43df('0x26')]['message']);}})[_0x43df('0x27')](function(_0x1dad9c){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2021a7,_0x1dad9c);_0x3a4c92(_0x1dad9c);});});}function respondWithStatusCode(_0x29dece,_0x24990a){_0x24990a=_0x24990a||0xcc;return function(_0xb72c9e){if(_0xb72c9e){return _0x29dece[_0x43df('0x28')](_0x24990a);}return _0x29dece[_0x43df('0x29')](_0x24990a)[_0x43df('0x2a')]();};}function respondWithResult(_0x414388,_0x350a1f){_0x350a1f=_0x350a1f||0xc8;return function(_0x130568){if(_0x130568){return _0x414388[_0x43df('0x29')](_0x350a1f)[_0x43df('0x2b')](_0x130568);}};}function respondWithFilteredResult(_0x1df6c2,_0x265f59){return function(_0x3e5846){if(_0x3e5846){var _0x17d9f2=typeof _0x265f59[_0x43df('0x2c')]===_0x43df('0x2d')&&typeof _0x265f59[_0x43df('0x2e')]===_0x43df('0x2d');var _0x2870e0=_0x3e5846['count'];var _0x52222f=_0x17d9f2?0x0:_0x265f59[_0x43df('0x2c')];var _0x3c8c1c=_0x17d9f2?_0x3e5846[_0x43df('0x2f')]:_0x265f59[_0x43df('0x2c')]+_0x265f59[_0x43df('0x2e')];var _0x1e8a78;if(_0x3c8c1c>=_0x2870e0){_0x3c8c1c=_0x2870e0;_0x1e8a78=0xc8;}else{_0x1e8a78=0xce;}_0x1df6c2['status'](_0x1e8a78);return _0x1df6c2[_0x43df('0x30')](_0x43df('0x31'),_0x52222f+'-'+_0x3c8c1c+'/'+_0x2870e0)['json'](_0x3e5846);}return null;};}function patchUpdates(_0x54cb26){return function(_0x25012c){try{jsonpatch[_0x43df('0x32')](_0x25012c,_0x54cb26,!![]);}catch(_0x123c36){return BPromise['reject'](_0x123c36);}return _0x25012c[_0x43df('0x33')]();};}function saveUpdates(_0x5f4a5a,_0xb35698){return function(_0x345a6f){if(_0x345a6f){return _0x345a6f[_0x43df('0x34')](_0x5f4a5a)[_0x43df('0x1e')](function(_0xb9a5e2){return _0xb9a5e2;});}return null;};}function removeEntity(_0x169670,_0x311e36){return function(_0x248341){if(_0x248341){return _0x248341[_0x43df('0x35')]()[_0x43df('0x1e')](function(){var _0xb96012=_0x248341[_0x43df('0x36')]({'plain':!![]});var _0x5a4bea='WhatsappAccounts';return db[_0x43df('0x37')][_0x43df('0x35')]({'where':{'type':_0x5a4bea,'resourceId':_0xb96012['id']}})[_0x43df('0x1e')](function(){return _0x248341;});})[_0x43df('0x1e')](function(){_0x169670['status'](0xcc)[_0x43df('0x2a')]();});}};}function handleEntityNotFound(_0x1c2e26,_0x51e9e0){return function(_0x364a5c){if(!_0x364a5c){_0x1c2e26[_0x43df('0x28')](0x194);}return _0x364a5c;};}function handleError(_0xbf2f52,_0x3f3869){_0x3f3869=_0x3f3869||0x1f4;return function(_0x369891){logger[_0x43df('0x23')](_0x369891['stack']);if(_0x369891[_0x43df('0x38')]){delete _0x369891[_0x43df('0x38')];}_0xbf2f52['status'](_0x3f3869)[_0x43df('0x39')](_0x369891);};}exports['index']=function(_0x2c612d,_0x1da30a){var _0x32eb24={'include':[{'model':db[_0x43df('0x3a')],'as':'mandatoryDispositionPause'}]},_0x2fff0d={},_0x3ff779={'count':0x0,'rows':[]};var _0xc81c5e=_[_0x43df('0x3b')](db['WhatsappAccount'][_0x43df('0x3c')],function(_0x3546cc){return{'name':_0x3546cc[_0x43df('0x3d')],'type':_0x3546cc[_0x43df('0x3e')][_0x43df('0x3f')]};});_0x2fff0d['model']=_[_0x43df('0x3b')](_0xc81c5e,_0x43df('0x38'));_0x2fff0d[_0x43df('0x40')]=_[_0x43df('0x41')](_0x2c612d[_0x43df('0x40')]);_0x2fff0d['filters']=_[_0x43df('0x42')](_0x2fff0d[_0x43df('0x43')],_0x2fff0d[_0x43df('0x40')]);_0x32eb24['attributes']=_[_0x43df('0x42')](_0x2fff0d[_0x43df('0x43')],qs['fields'](_0x2c612d[_0x43df('0x40')]['fields']));_0x32eb24[_0x43df('0x44')]=_0x32eb24['attributes']['length']?_0x32eb24[_0x43df('0x44')]:_0x2fff0d[_0x43df('0x43')];if(!_0x2c612d[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x32eb24[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x2c612d[_0x43df('0x40')][_0x43df('0x2e')]);_0x32eb24[_0x43df('0x2c')]=qs['offset'](_0x2c612d['query'][_0x43df('0x2c')]);}_0x32eb24['order']=qs[_0x43df('0x47')](_0x2c612d[_0x43df('0x40')][_0x43df('0x47')]);_0x32eb24[_0x43df('0x48')]=qs[_0x43df('0x49')](_['pick'](_0x2c612d[_0x43df('0x40')],_0x2fff0d[_0x43df('0x49')]),_0xc81c5e);if(_0x2c612d[_0x43df('0x40')][_0x43df('0x4a')]){_0x32eb24[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x32eb24[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0xc81c5e,function(_0x2a01bf){if(_0x2a01bf[_0x43df('0x3e')]!==_0x43df('0x4c')){var _0xaa86da={};_0xaa86da[_0x2a01bf[_0x43df('0x38')]]={'$like':'%'+_0x2c612d['query']['filter']+'%'};return _0xaa86da;}})});}_0x32eb24=_[_0x43df('0x4b')]({},_0x32eb24,_0x2c612d[_0x43df('0x4d')]);var _0x5c4182={'where':_0x32eb24[_0x43df('0x48')]};return db['WhatsappAccount'][_0x43df('0x2f')](_0x5c4182)[_0x43df('0x1e')](function(_0x57abdd){_0x3ff779[_0x43df('0x2f')]=_0x57abdd;if(_0x2c612d[_0x43df('0x40')]['includeAll']){_0x32eb24[_0x43df('0x4e')]=[{'all':!![]}];}return db[_0x43df('0x4f')][_0x43df('0x50')](_0x32eb24);})[_0x43df('0x1e')](function(_0x67410e){_0x3ff779[_0x43df('0x51')]=_0x67410e;return _0x3ff779;})[_0x43df('0x1e')](respondWithFilteredResult(_0x1da30a,_0x32eb24))[_0x43df('0x27')](handleError(_0x1da30a,null));};exports[_0x43df('0x52')]=function(_0x230a62,_0x144328){var _0x32db9a={'raw':![],'where':{'id':_0x230a62[_0x43df('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4bc54e={};_0x4bc54e[_0x43df('0x43')]=_[_0x43df('0x41')](db[_0x43df('0x4f')][_0x43df('0x3c')]);_0x4bc54e['query']=_[_0x43df('0x41')](_0x230a62[_0x43df('0x40')]);_0x4bc54e['filters']=_[_0x43df('0x42')](_0x4bc54e[_0x43df('0x43')],_0x4bc54e[_0x43df('0x40')]);_0x32db9a[_0x43df('0x44')]=_[_0x43df('0x42')](_0x4bc54e['model'],qs[_0x43df('0x54')](_0x230a62[_0x43df('0x40')]['fields']));_0x32db9a[_0x43df('0x44')]=_0x32db9a[_0x43df('0x44')][_0x43df('0x55')]?_0x32db9a[_0x43df('0x44')]:_0x4bc54e[_0x43df('0x43')];if(_0x230a62[_0x43df('0x40')][_0x43df('0x56')]){_0x32db9a[_0x43df('0x4e')]=[{'all':!![]}];}_0x32db9a=_[_0x43df('0x4b')]({},_0x32db9a,_0x230a62[_0x43df('0x4d')]);return db['WhatsappAccount'][_0x43df('0x57')](_0x32db9a)[_0x43df('0x1e')](handleEntityNotFound(_0x144328,null))[_0x43df('0x1e')](respondWithResult(_0x144328,null))[_0x43df('0x27')](handleError(_0x144328,null));};exports[_0x43df('0x58')]=function(_0x28d890,_0x5a2e81){return db[_0x43df('0x4f')][_0x43df('0x58')](_0x28d890['body'],{})[_0x43df('0x1e')](function(_0x359137){var _0x443c0b=_0x28d890['user'][_0x43df('0x36')]({'plain':!![]});if(!_0x443c0b)throw new Error(_0x43df('0x59'));if(_0x443c0b[_0x43df('0x5a')]===_0x43df('0x5b')){var _0xa78e36=_0x359137[_0x43df('0x36')]({'plain':!![]});var _0x437b3e=_0x43df('0x5c');return db['UserProfileSection'][_0x43df('0x57')]({'where':{'name':_0x437b3e,'userProfileId':_0x443c0b[_0x43df('0x5d')]},'raw':!![]})[_0x43df('0x1e')](function(_0x2f5a3a){if(_0x2f5a3a&&_0x2f5a3a[_0x43df('0x5e')]===0x0){return db[_0x43df('0x37')]['create']({'name':_0xa78e36[_0x43df('0x38')],'resourceId':_0xa78e36['id'],'type':_0x2f5a3a[_0x43df('0x38')],'sectionId':_0x2f5a3a['id']},{})[_0x43df('0x1e')](function(){return _0x359137;});}else{return _0x359137;}})[_0x43df('0x27')](function(_0x4958e8){logger[_0x43df('0x23')](_0x43df('0x5f'),_0x4958e8);throw _0x4958e8;});}return _0x359137;})[_0x43df('0x1e')](respondWithResult(_0x5a2e81,0xc9))['catch'](handleError(_0x5a2e81,null));};exports['update']=function(_0x2b8526,_0x180161){if(_0x2b8526['body']['id']){delete _0x2b8526['body']['id'];}return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x2b8526[_0x43df('0x53')]['id']},'include':[{'model':db[_0x43df('0x3a')],'as':_0x43df('0x60')}]})['then'](handleEntityNotFound(_0x180161,null))[_0x43df('0x1e')](saveUpdates(_0x2b8526[_0x43df('0x61')],null))[_0x43df('0x1e')](respondWithResult(_0x180161,null))['catch'](handleError(_0x180161,null));};exports['destroy']=function(_0x393927,_0x33503f){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x393927[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x33503f,null))[_0x43df('0x1e')](removeEntity(_0x33503f,null))[_0x43df('0x27')](handleError(_0x33503f,null));};exports[_0x43df('0x62')]=function(_0xa734b9,_0x1ec510){return db['WhatsappAccount'][_0x43df('0x62')]()['then'](respondWithResult(_0x1ec510,null))[_0x43df('0x27')](handleError(_0x1ec510,null));};exports['addDisposition']=function(_0x48c8ea,_0x1a0cdc,_0x44c3de){if(_0x48c8ea[_0x43df('0x61')]['id']){delete _0x48c8ea[_0x43df('0x61')]['id'];}return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x48c8ea[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x1a0cdc,null))[_0x43df('0x1e')](function(_0x4a068a){if(_0x4a068a){_0x48c8ea['body'][_0x43df('0x63')]=_0x4a068a['id'];return db[_0x43df('0x64')][_0x43df('0x58')](_0x48c8ea[_0x43df('0x61')]);}})[_0x43df('0x1e')](respondWithResult(_0x1a0cdc,null))[_0x43df('0x27')](handleError(_0x1a0cdc,null));};exports['getDispositions']=function(_0x1cb474,_0xaa55ba,_0x9a7dc6){var _0x45e70e={'raw':![],'where':{}};var _0x49bd19={};var _0x24dda1={'count':0x0,'rows':[]};return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x1cb474[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0xaa55ba,null))[_0x43df('0x1e')](function(_0x4b048f){if(_0x4b048f){_0x49bd19['model']=_['keys'](db[_0x43df('0x64')]['rawAttributes']);_0x49bd19[_0x43df('0x40')]=_[_0x43df('0x41')](_0x1cb474[_0x43df('0x40')]);_0x49bd19[_0x43df('0x49')]=_[_0x43df('0x42')](_0x49bd19[_0x43df('0x43')],_0x49bd19[_0x43df('0x40')]);_0x45e70e['attributes']=_[_0x43df('0x42')](_0x49bd19[_0x43df('0x43')],qs['fields'](_0x1cb474[_0x43df('0x40')][_0x43df('0x54')]));_0x45e70e['attributes']=_0x45e70e[_0x43df('0x44')]['length']?_0x45e70e[_0x43df('0x44')]:_0x49bd19[_0x43df('0x43')];if(!_0x1cb474[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x45e70e[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x1cb474[_0x43df('0x40')]['limit']);_0x45e70e[_0x43df('0x2c')]=qs[_0x43df('0x2c')](_0x1cb474[_0x43df('0x40')][_0x43df('0x2c')]);}_0x45e70e[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x1cb474[_0x43df('0x40')][_0x43df('0x47')]);_0x45e70e[_0x43df('0x48')]=qs['filters'](_[_0x43df('0x67')](_0x1cb474[_0x43df('0x40')],_0x49bd19[_0x43df('0x49')]));_0x45e70e[_0x43df('0x48')][_0x43df('0x63')]=_0x4b048f['id'];if(_0x1cb474['query'][_0x43df('0x4a')]){_0x45e70e[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x45e70e['where'],{'$or':_[_0x43df('0x3b')](_0x45e70e[_0x43df('0x44')],function(_0x2bb96c){var _0x9578bf={};_0x9578bf[_0x2bb96c]={'$like':'%'+_0x1cb474['query'][_0x43df('0x4a')]+'%'};return _0x9578bf;})});}_0x45e70e=_[_0x43df('0x4b')]({},_0x45e70e,_0x1cb474[_0x43df('0x4d')]);return db[_0x43df('0x64')][_0x43df('0x2f')]({'where':_0x45e70e[_0x43df('0x48')]})[_0x43df('0x1e')](function(_0x5b3401){_0x24dda1[_0x43df('0x2f')]=_0x5b3401;if(_0x1cb474[_0x43df('0x40')][_0x43df('0x56')]){_0x45e70e['include']=[{'all':!![]}];}return db[_0x43df('0x64')][_0x43df('0x50')](_0x45e70e);})[_0x43df('0x1e')](function(_0x5a850f){_0x24dda1['rows']=_0x5a850f;return _0x24dda1;});}})[_0x43df('0x1e')](respondWithFilteredResult(_0xaa55ba,_0x45e70e))[_0x43df('0x27')](handleError(_0xaa55ba,null));};exports['removeDispositions']=function(_0x32469b,_0x244176,_0x3e95e2){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x32469b[_0x43df('0x53')]['id']}})['then'](handleEntityNotFound(_0x244176,null))[_0x43df('0x1e')](function(_0x2826ae){if(_0x2826ae){return _0x2826ae[_0x43df('0x68')](_0x32469b[_0x43df('0x40')]['ids']);}})[_0x43df('0x1e')](respondWithStatusCode(_0x244176,null))['catch'](handleError(_0x244176,null));};exports[_0x43df('0x69')]=function(_0x22f414,_0x41cb07,_0xf6567a){if(_0x22f414[_0x43df('0x61')]['id']){delete _0x22f414[_0x43df('0x61')]['id'];}return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x22f414[_0x43df('0x53')]['id']}})['then'](handleEntityNotFound(_0x41cb07,null))[_0x43df('0x1e')](function(_0x20162a){if(_0x20162a){_0x22f414['body'][_0x43df('0x63')]=_0x20162a['id'];return db[_0x43df('0x6a')]['create'](_0x22f414[_0x43df('0x61')]);}})[_0x43df('0x1e')](respondWithResult(_0x41cb07,null))[_0x43df('0x27')](handleError(_0x41cb07,null));};exports[_0x43df('0x6b')]=function(_0x756ddf,_0x351358,_0x459de7){var _0x6b5b69={'raw':![],'where':{}};var _0x2d3570={};var _0x2ba1da={'count':0x0,'rows':[]};return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x756ddf['params']['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x351358,null))[_0x43df('0x1e')](function(_0x46d480){if(_0x46d480){_0x2d3570[_0x43df('0x43')]=_[_0x43df('0x41')](db[_0x43df('0x6a')]['rawAttributes']);_0x2d3570[_0x43df('0x40')]=_['keys'](_0x756ddf[_0x43df('0x40')]);_0x2d3570['filters']=_['intersection'](_0x2d3570[_0x43df('0x43')],_0x2d3570[_0x43df('0x40')]);_0x6b5b69[_0x43df('0x44')]=_['intersection'](_0x2d3570[_0x43df('0x43')],qs['fields'](_0x756ddf[_0x43df('0x40')][_0x43df('0x54')]));_0x6b5b69[_0x43df('0x44')]=_0x6b5b69[_0x43df('0x44')][_0x43df('0x55')]?_0x6b5b69[_0x43df('0x44')]:_0x2d3570[_0x43df('0x43')];if(!_0x756ddf[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x6b5b69['limit']=qs[_0x43df('0x2e')](_0x756ddf[_0x43df('0x40')][_0x43df('0x2e')]);_0x6b5b69['offset']=qs['offset'](_0x756ddf[_0x43df('0x40')][_0x43df('0x2c')]);}_0x6b5b69[_0x43df('0x66')]=qs['sort'](_0x756ddf[_0x43df('0x40')]['sort']);_0x6b5b69[_0x43df('0x48')]=qs[_0x43df('0x49')](_[_0x43df('0x67')](_0x756ddf[_0x43df('0x40')],_0x2d3570[_0x43df('0x49')]));_0x6b5b69[_0x43df('0x48')]['WhatsappAccountId']=_0x46d480['id'];if(_0x756ddf['query'][_0x43df('0x4a')]){_0x6b5b69[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x6b5b69[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x6b5b69[_0x43df('0x44')],function(_0x32ed8b){var _0x4163e9={};_0x4163e9[_0x32ed8b]={'$like':'%'+_0x756ddf[_0x43df('0x40')][_0x43df('0x4a')]+'%'};return _0x4163e9;})});}_0x6b5b69=_[_0x43df('0x4b')]({},_0x6b5b69,_0x756ddf['options']);return db['CannedAnswer'][_0x43df('0x2f')]({'where':_0x6b5b69[_0x43df('0x48')]})[_0x43df('0x1e')](function(_0x29169c){_0x2ba1da['count']=_0x29169c;if(_0x756ddf[_0x43df('0x40')][_0x43df('0x56')]){_0x6b5b69['include']=[{'all':!![]}];}return db[_0x43df('0x6a')][_0x43df('0x50')](_0x6b5b69);})[_0x43df('0x1e')](function(_0x298453){_0x2ba1da[_0x43df('0x51')]=_0x298453;return _0x2ba1da;});}})[_0x43df('0x1e')](respondWithFilteredResult(_0x351358,_0x6b5b69))[_0x43df('0x27')](handleError(_0x351358,null));};exports[_0x43df('0x6c')]=function(_0x197f5b,_0x2e130c,_0x16fd0d){return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x197f5b['params']['id']}})['then'](handleEntityNotFound(_0x2e130c,null))[_0x43df('0x1e')](function(_0x5227d0){if(_0x5227d0){return _0x5227d0[_0x43df('0x6c')](_0x197f5b['query']['ids']);}})['then'](respondWithStatusCode(_0x2e130c,null))[_0x43df('0x27')](handleError(_0x2e130c,null));};exports[_0x43df('0x6d')]=function(_0x9539d7,_0x519452,_0x54b97d){return db[_0x43df('0x4f')]['find']({'where':{'id':_0x9539d7[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x519452,null))[_0x43df('0x1e')](function(_0x5d3efc){if(_0x5d3efc){return _0x5d3efc[_0x43df('0x6d')](_0x9539d7[_0x43df('0x61')][_0x43df('0x6e')],_['omit'](_0x9539d7['body'],[_0x43df('0x6e'),'id'])||{})[_0x43df('0x6f')](function(_0x4e8673){for(var _0x1ff682=0x0;_0x1ff682<_0x9539d7[_0x43df('0x61')]['ids']['length'];_0x1ff682+=0x1){socket['emit'](_0x43df('0x70'),{'UserId':Number(_0x9539d7[_0x43df('0x61')][_0x43df('0x6e')][_0x1ff682]),'WhatsappAccountId':Number(_0x9539d7['params']['id'])});}return _0x4e8673;});}})['then'](respondWithResult(_0x519452,null))[_0x43df('0x27')](handleError(_0x519452,null));};exports[_0x43df('0x71')]=function(_0x58fdd8,_0xb26bc6,_0x4ddf27){return db['WhatsappAccount'][_0x43df('0x57')]({'where':{'id':_0x58fdd8[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0xb26bc6,null))['then'](function(_0x5e6121){if(_0x5e6121){return _0x5e6121[_0x43df('0x71')](_0x58fdd8['query'][_0x43df('0x6e')])['then'](function(){if(_['isArray'](_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')])){for(var _0x4bfab1=0x0;_0x4bfab1<_0x58fdd8[_0x43df('0x40')]['ids'][_0x43df('0x55')];_0x4bfab1+=0x1){socket[_0x43df('0x72')](_0x43df('0x73'),{'UserId':Number(_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')][_0x4bfab1]),'WhatsappAccountId':Number(_0x58fdd8[_0x43df('0x53')]['id'])});}}else{socket[_0x43df('0x72')](_0x43df('0x73'),{'UserId':Number(_0x58fdd8[_0x43df('0x40')][_0x43df('0x6e')]),'WhatsappAccountId':Number(_0x58fdd8[_0x43df('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0xb26bc6,null))[_0x43df('0x27')](handleError(_0xb26bc6,null));};exports[_0x43df('0x74')]=function(_0x1126ba,_0x5b4e64,_0x20f95b){var _0x3f7fcd={};var _0x2bae9b={};var _0xd7ee95;var _0x106bfc;return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x1126ba[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x5b4e64,null))[_0x43df('0x1e')](function(_0x117156){if(_0x117156){_0xd7ee95=_0x117156;_0x2bae9b['model']=_[_0x43df('0x41')](db[_0x43df('0x75')][_0x43df('0x3c')]);_0x2bae9b['query']=_[_0x43df('0x41')](_0x1126ba[_0x43df('0x40')]);_0x2bae9b[_0x43df('0x49')]=_[_0x43df('0x42')](_0x2bae9b[_0x43df('0x43')],_0x2bae9b[_0x43df('0x40')]);_0x3f7fcd[_0x43df('0x44')]=_[_0x43df('0x42')](_0x2bae9b[_0x43df('0x43')],qs['fields'](_0x1126ba[_0x43df('0x40')]['fields']));_0x3f7fcd[_0x43df('0x44')]=_0x3f7fcd[_0x43df('0x44')][_0x43df('0x55')]?_0x3f7fcd[_0x43df('0x44')]:_0x2bae9b[_0x43df('0x43')];_0x3f7fcd[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x1126ba[_0x43df('0x40')][_0x43df('0x47')]);_0x3f7fcd[_0x43df('0x48')]=qs['filters'](_[_0x43df('0x67')](_0x1126ba[_0x43df('0x40')],_0x2bae9b['filters']));if(_0x1126ba[_0x43df('0x40')][_0x43df('0x4a')]){_0x3f7fcd[_0x43df('0x48')]=_['merge'](_0x3f7fcd[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x3f7fcd[_0x43df('0x44')],function(_0x580491){var _0x4322ad={};_0x4322ad[_0x580491]={'$like':'%'+_0x1126ba[_0x43df('0x40')]['filter']+'%'};return _0x4322ad;})});}_0x3f7fcd=_[_0x43df('0x4b')]({},_0x3f7fcd,_0x1126ba[_0x43df('0x4d')]);return _0xd7ee95['getAgents'](_0x3f7fcd);}})[_0x43df('0x1e')](function(_0x258a1f){if(_0x258a1f){_0x106bfc=_0x258a1f[_0x43df('0x55')];if(!_0x1126ba[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x3f7fcd[_0x43df('0x2e')]=qs[_0x43df('0x2e')](_0x1126ba[_0x43df('0x40')][_0x43df('0x2e')]);_0x3f7fcd[_0x43df('0x2c')]=qs[_0x43df('0x2c')](_0x1126ba['query']['offset']);}return _0xd7ee95[_0x43df('0x74')](_0x3f7fcd);}})[_0x43df('0x1e')](function(_0x3a36ca){if(_0x3a36ca){return _0x3a36ca?{'count':_0x106bfc,'rows':_0x3a36ca}:null;}})[_0x43df('0x1e')](respondWithResult(_0x5b4e64,null))[_0x43df('0x27')](handleError(_0x5b4e64,null));};exports[_0x43df('0x76')]=function(_0x52d8b4,_0x34e49f){var _0x2d5fe4=_0x52d8b4['params']['id'];var _0x496c3f=_0x52d8b4[_0x43df('0x61')];var _0x41fea3=0xc8;var _0x5a4334=null;return db[_0x43df('0x77')][_0x43df('0x78')]({'isolationLevel':db['sequelize'][_0x43df('0x79')][_0x43df('0x7a')][_0x43df('0x7b')]},function(_0xbe9208){return db[_0x43df('0x4f')][_0x43df('0x65')]({'where':{'id':_0x2d5fe4},'transaction':_0xbe9208})[_0x43df('0x1e')](function(_0x15adbe){if(_0x15adbe){return db[_0x43df('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x2d5fe4},'transaction':_0xbe9208})[_0x43df('0x1e')](function(){var _0x11f850=_[_0x43df('0x3b')](_0x496c3f,function(_0x3e2f68){_0x3e2f68[_0x43df('0x63')]=_0x2d5fe4;return _0x3e2f68;});return db[_0x43df('0x7c')]['bulkCreate'](_0x11f850,{'transaction':_0xbe9208});});}else{_0x41fea3=0x194;_0x5a4334=[];}});})['then'](function(){if(_0x41fea3!==0x194){return db[_0x43df('0x7c')][_0x43df('0x7d')]({'where':{'WhatsappAccountId':_0x2d5fe4},'order':_0x43df('0x7e')})['then'](function(_0x10df8e){_0x5a4334=_0x10df8e;});}})[_0x43df('0x27')](function(_0xa25412){_0x41fea3=0x1f4;logger[_0x43df('0x23')](_0xa25412[_0x43df('0x7f')]);if(_0xa25412[_0x43df('0x38')]){delete _0xa25412[_0x43df('0x38')];}_0x5a4334=_0xa25412;})['finally'](function(){if(_0x5a4334===null){_0x34e49f['sendStatus'](_0x41fea3);}else{if(_0x41fea3===0x1f4){_0x34e49f['status'](_0x41fea3)[_0x43df('0x39')](_0x5a4334);}else{_0x34e49f[_0x43df('0x29')](_0x41fea3)[_0x43df('0x2b')](_0x5a4334);}}});};exports[_0x43df('0x80')]=function(_0x311761,_0x272d4f,_0x4f056d){var _0x15c2d7={};var _0x3faeb2={};var _0x19e6b9;var _0x27d4b0;return db[_0x43df('0x4f')]['findOne']({'where':{'id':_0x311761[_0x43df('0x53')]['id']}})[_0x43df('0x1e')](handleEntityNotFound(_0x272d4f,null))[_0x43df('0x1e')](function(_0x30108b){if(_0x30108b){_0x19e6b9=_0x30108b;_0x3faeb2[_0x43df('0x43')]=_['keys'](db[_0x43df('0x7c')]['rawAttributes']);_0x3faeb2[_0x43df('0x40')]=_[_0x43df('0x41')](_0x311761[_0x43df('0x40')]);_0x3faeb2[_0x43df('0x49')]=_[_0x43df('0x42')](_0x3faeb2[_0x43df('0x43')],_0x3faeb2[_0x43df('0x40')]);_0x15c2d7[_0x43df('0x44')]=_[_0x43df('0x42')](_0x3faeb2[_0x43df('0x43')],qs['fields'](_0x311761[_0x43df('0x40')]['fields']));_0x15c2d7[_0x43df('0x44')]=_0x15c2d7['attributes'][_0x43df('0x55')]?_0x15c2d7['attributes']:_0x3faeb2[_0x43df('0x43')];_0x15c2d7[_0x43df('0x66')]=qs[_0x43df('0x47')](_0x311761[_0x43df('0x40')][_0x43df('0x47')]);_0x15c2d7[_0x43df('0x48')]=qs[_0x43df('0x49')](_[_0x43df('0x67')](_0x311761[_0x43df('0x40')],_0x3faeb2[_0x43df('0x49')]));if(_0x311761['query'][_0x43df('0x4a')]){_0x15c2d7[_0x43df('0x48')]=_[_0x43df('0x4b')](_0x15c2d7[_0x43df('0x48')],{'$or':_[_0x43df('0x3b')](_0x15c2d7['attributes'],function(_0xe1bd27){var _0x3c0b6c={};_0x3c0b6c[_0xe1bd27]={'$like':'%'+_0x311761['query'][_0x43df('0x4a')]+'%'};return _0x3c0b6c;})});}_0x15c2d7=_[_0x43df('0x4b')]({},_0x15c2d7,_0x311761['options']);return _0x19e6b9[_0x43df('0x80')](_0x15c2d7);}})['then'](function(_0x390ca8){if(_0x390ca8){_0x27d4b0=_0x390ca8[_0x43df('0x55')];if(!_0x311761[_0x43df('0x40')][_0x43df('0x45')](_0x43df('0x46'))){_0x15c2d7[_0x43df('0x2e')]=qs['limit'](_0x311761[_0x43df('0x40')][_0x43df('0x2e')]);_0x15c2d7[_0x43df('0x2c')]=qs['offset'](_0x311761[_0x43df('0x40')][_0x43df('0x2c')]);}return _0x19e6b9[_0x43df('0x80')](_0x15c2d7);}})[_0x43df('0x1e')](function(_0x26ce2f){if(_0x26ce2f){return _0x26ce2f?{'count':_0x27d4b0,'rows':_0x26ce2f}:null;}})['then'](respondWithResult(_0x272d4f,null))[_0x43df('0x27')](handleError(_0x272d4f,null));};exports[_0x43df('0x81')]=function(_0x3d6e20,_0x4514ad,_0x7a13a6){var _0x661d25={'channel':'whatsapp'};var _0x2b6a66=[];var _0x4dbd41=[];var _0x17e149={};return db[_0x43df('0x4f')]['find']({'where':{'id':_0x3d6e20[_0x43df('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x43df('0x82')}]})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x391632){_0x661d25[_0x43df('0x83')]=_0x391632;if(_0x661d25['account']&&_0x661d25[_0x43df('0x83')]['type']==='sinch'&&_0x3d6e20[_0x43df('0x61')]['statuses']){if(_0x3d6e20[_0x43df('0x61')][_0x43df('0x84')][_0x43df('0x55')]===0x0)return;if(_0x3d6e20[_0x43df('0x61')][_0x43df('0x84')][0x0][_0x43df('0x85')]!=='read')return;return db[_0x43df('0x86')][_0x43df('0x34')]({'read':!![],'readAt':_0x3d6e20['body'][_0x43df('0x84')][0x0][_0x43df('0x87')]},{'where':{'messageId':_0x3d6e20['body'][_0x43df('0x84')][0x0][_0x43df('0x88')]},'individualHooks':!![]})['then'](function(_0x21cd09){return _0x4514ad['status'](0xc8)[_0x43df('0x2b')](_0x21cd09);});}_0x661d25['applications']=_[_0x43df('0x89')](_0x391632[_0x43df('0x82')],[_0x43df('0x7e')],['asc']);if(_0x661d25[_0x43df('0x83')][_0x43df('0x82')]){delete _0x661d25[_0x43df('0x83')][_0x43df('0x82')];}return db[_0x43df('0x8a')]['describe']()[_0x43df('0x1e')](function(_0x3a4663){if(!_0x3a4663){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))]('no\x20available\x20attributes');}_0x2b6a66=_[_0x43df('0x8d')](_['keys'](_0x3a4663),[_0x43df('0x8e'),'updatedAt']);_0x4dbd41=_[_0x43df('0x8d')](_['keys'](_0x3a4663),[_0x43df('0x8e'),_0x43df('0x8f'),_0x43df('0x90'),'ListId']);_0x661d25[_0x43df('0x61')]={'mapKey':_0x43df('0x91')};if(_0x661d25[_0x43df('0x83')]&&_0x661d25['account'][_0x43df('0x3e')]===_0x43df('0x92')){_0x661d25[_0x43df('0x61')][_0x43df('0x93')]=_0x3d6e20[_0x43df('0x61')][_0x43df('0x94')]['replace'](_0x43df('0x95'),'');_0x661d25[_0x43df('0x61')]['body']=_0x3d6e20[_0x43df('0x61')]['Body'];_0x661d25[_0x43df('0x61')]['messageId']=_0x3d6e20[_0x43df('0x61')][_0x43df('0x96')];}if(_0x661d25[_0x43df('0x83')]&&_0x661d25[_0x43df('0x83')][_0x43df('0x3e')]==='sinch'){_0x661d25[_0x43df('0x61')][_0x43df('0x93')]=_0x3d6e20[_0x43df('0x61')]['notifications'][0x0]['from'];_0x661d25[_0x43df('0x61')][_0x43df('0x61')]=_0x3d6e20[_0x43df('0x61')][_0x43df('0x97')][0x0][_0x43df('0x25')][_0x43df('0x61')];_0x661d25[_0x43df('0x61')][_0x43df('0x98')]=_0x3d6e20[_0x43df('0x61')]['notifications'][0x0][_0x43df('0x88')];}if(_0x661d25[_0x43df('0x61')]['id']){delete _0x661d25[_0x43df('0x61')]['id'];}if(_[_0x43df('0x99')](_0x661d25[_0x43df('0x61')][_0x43df('0x93')])){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9a'));}if(_[_0x43df('0x99')](_0x661d25['body'][_0x43df('0x61')])||_0x661d25['body'][_0x43df('0x61')]===''){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9b'));}if(_[_0x43df('0x99')](_0x661d25[_0x43df('0x61')][_0x43df('0x9c')])){throw new db[(_0x43df('0x8b'))]['ValidationError'](_0x43df('0x9d')+_0x4dbd41);}if(!_[_0x43df('0x9e')](_0x4dbd41,_0x661d25[_0x43df('0x61')][_0x43df('0x9c')])){throw new db[(_0x43df('0x8b'))]['ValidationError'](_0x43df('0x9f')+_0x4dbd41);}_0x17e149[_0x661d25[_0x43df('0x61')][_0x43df('0x9c')]]=_0x661d25[_0x43df('0x61')]['from'];return db[_0x43df('0xa0')]['find']({'where':{'id':_0x661d25['account'][_0x43df('0xa1')]},'include':[{'model':db[_0x43df('0x8a')],'as':_0x43df('0xa2'),'where':_0x17e149,'limit':0x1,'order':[['updatedAt',_0x43df('0xa3')]]}]});})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x319253){if(_0x319253){_0x661d25[_0x43df('0xa4')]=_[_0x43df('0xa5')](_0x319253,[_0x43df('0xa2')]);if(_0x319253[_0x43df('0xa2')][_0x43df('0x55')]){return _0x319253[_0x43df('0xa2')][0x0];}var _0x4ca568=_[_0x43df('0x16')](_0x661d25[_0x43df('0x61')],{'firstName':_0x661d25[_0x43df('0x61')]['from'],'ListId':_0x319253['id']});_0x4ca568[_0x661d25[_0x43df('0x61')][_0x43df('0x9c')]]=_0x661d25[_0x43df('0x61')]['from'];return db[_0x43df('0x8a')][_0x43df('0x58')](_0x4ca568,{'fields':_0x2b6a66,'raw':!![]});}})[_0x43df('0x1e')](handleEntityNotFound(_0x4514ad,null))[_0x43df('0x1e')](function(_0x22437f){if(_0x22437f){_0x661d25['contact']=_0x22437f;var _0x2be04b={'ContactId':_0x22437f['id'],'phone':_0x661d25[_0x43df('0x61')]['from'],'WhatsappAccountId':_0x3d6e20[_0x43df('0x53')]['id']};var _0x40bb74={'ContactId':_0x22437f['id'],'WhatsappAccountId':_0x3d6e20[_0x43df('0x53')]['id'],'closed':![]};return db[_0x43df('0xa6')][_0x43df('0x57')]({'where':_0x40bb74})[_0x43df('0x1e')](function(_0x43d56f){if(_0x43d56f){return[_0x43d56f,![]];}return db[_0x43df('0xa6')][_0x43df('0x58')](_0x2be04b)[_0x43df('0x1e')](function(_0x153b8e){return[_0x153b8e,!![]];});});}})[_0x43df('0x6f')](function(_0x2e4103,_0x5552c8){_0x661d25[_0x43df('0xa7')]=_0x2e4103[_0x43df('0x36')]({'plain':!![]});_0x661d25[_0x43df('0xa7')][_0x43df('0xa8')]=![];if(_0x5552c8){if(_0x661d25[_0x43df('0x83')][_0x43df('0xa9')]){_0x661d25[_0x43df('0xaa')][_0x43df('0xab')]({'id':0x0,'priority':_0x661d25[_0x43df('0xaa')]['length']+0x1,'app':_0x43df('0xac'),'appdata':'unmanaged','interval':_0x43df('0xad')});}_0x661d25[_0x43df('0xa7')][_0x43df('0xa8')]=!![];}return db[_0x43df('0x86')][_0x43df('0x58')]({'phone':_0x661d25[_0x43df('0x61')][_0x43df('0x93')],'messageId':_0x661d25[_0x43df('0x61')][_0x43df('0x98')],'body':_0x661d25['body']['body'],'WhatsappAccountId':_0x3d6e20['params']['id'],'WhatsappInteractionId':_0x2e4103['id'],'direction':'in','ContactId':_0x2e4103[_0x43df('0xae')],'AttachmentId':_0x661d25[_0x43df('0x61')][_0x43df('0xaf')]});})[_0x43df('0x1e')](function(_0x4592ef){_0x661d25[_0x43df('0x25')]=_0x4592ef;if(!_0x661d25[_0x43df('0xa7')][_0x43df('0xb0')])return;return db[_0x43df('0x75')][_0x43df('0x57')]({'attributes':['id',_0x43df('0x38')],'where':{'id':_0x661d25[_0x43df('0xa7')][_0x43df('0xb0')]}});})['then'](function(_0x5db347){if(_0x5db347){_0x661d25[_0x43df('0xaa')][_0x43df('0xb1')]({'id':0x0,'priority':0x0,'app':_0x43df('0xb2'),'appdata':_0x5db347[_0x43df('0x38')]+','+(_0x661d25[_0x43df('0x83')][_0x43df('0xb3')]||0xa),'interval':_0x43df('0xad')});}if(!_0x661d25[_0x43df('0xa7')]['queueId'])return;return db[_0x43df('0xb4')][_0x43df('0x57')]({'attributes':['id',_0x43df('0x38')],'where':{'id':_0x661d25[_0x43df('0xa7')]['queueId']}});})[_0x43df('0x1e')](function(_0x3e2099){if(_0x3e2099){_0x661d25[_0x43df('0xaa')][_0x43df('0xb1')]({'id':0x0,'priority':0x1,'app':_0x43df('0xb5'),'appdata':_0x3e2099[_0x43df('0x38')]+','+(_0x661d25[_0x43df('0x83')][_0x43df('0xb6')]||0x12c),'interval':_0x43df('0xad')});}return respondWithRpcPromise(_0x43df('0xb7'),_0x43df('0xb8'),_0x661d25);})['then'](function(_0x300d2c){if(_0x300d2c){var _0x1aeb0e=0xc8;var _0x2ea899='receiveMessage';logger['info'](_0x43df('0xb9'),_0x2ea899,_0x1aeb0e,_0x43df('0xba'));logger['debug'](_0x43df('0xbb'),_0x2ea899,_0x1aeb0e,_0x43df('0xba'),JSON[_0x43df('0x22')](_0x300d2c));if(_0x661d25[_0x43df('0x83')]['type']===_0x43df('0x92')){return _0x4514ad[_0x43df('0x29')](_0x1aeb0e)[_0x43df('0x30')](_0x43df('0xbc'),_0x43df('0xbd'))['send']('\x0a');}else{return _0x4514ad['status'](_0x1aeb0e)[_0x43df('0x2b')](_0x300d2c);}}});})['catch'](handleError(_0x4514ad,null));};exports[_0x43df('0x39')]=function(_0x15eff8,_0x1afe2a,_0x5cf45c){var _0x310c21,_0x1901ff,_0x105f5e;if(_[_0x43df('0x99')](_0x15eff8[_0x43df('0x61')][_0x43df('0x61')])||_0x15eff8['body']['body']===''){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0x9b'));}if(_[_0x43df('0x99')](_0x15eff8[_0x43df('0x61')]['to'])){throw new db[(_0x43df('0x8b'))][(_0x43df('0x8c'))](_0x43df('0xbe'));}_0x310c21=_0x15eff8[_0x43df('0x61')]['to'];return db[_0x43df('0x4f')][_0x43df('0x57')]({'where':{'id':_0x15eff8[_0x43df('0x53')]['id']},'include':[{'model':db[_0x43df('0xa0')],'as':'List','include':[{'model':db[_0x43df('0x8a')],'as':_0x43df('0xa2'),'where':{'mobile':_0x310c21},'limit':0x1,'order':[['updatedAt',_0x43df('0xa3')]]}]}]})[_0x43df('0x1e')](handleEntityNotFound(_0x1afe2a,null))['then'](function(_0x51c2f4){if(_0x51c2f4&&_0x51c2f4[_0x43df('0xbf')]){_0x1901ff=_0x51c2f4['get']({'plain':!![]});if(_0x1901ff[_0x43df('0xbf')]&&_0x1901ff[_0x43df('0xbf')][_0x43df('0xa2')]['length']){return _0x1901ff[_0x43df('0xbf')][_0x43df('0xa2')][0x0];}return db[_0x43df('0x8a')]['create'](_['defaults'](_0x15eff8['body'],{'firstName':_0x310c21,'mobile':_0x310c21,'phone':_0x310c21,'ListId':_0x1901ff['ListId']}));}})['then'](handleEntityNotFound(_0x1afe2a,null))[_0x43df('0x1e')](function(_0x2e730e){if(_0x2e730e){_0x105f5e=_0x2e730e;return db[_0x43df('0xa6')]['find']({'where':{'ContactId':_0x105f5e['id'],'closed':![],'WhatsappAccountId':_0x1901ff['id']}})[_0x43df('0x1e')](function(_0x40ddb3){if(_0x40ddb3){return[_0x40ddb3,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x15eff8['user']['id'],'ContactId':_0x105f5e['id'],'WhatsappAccountId':_0x1901ff['id'],'phone':_0x310c21,'firstMsgDirection':_0x43df('0xc0'),'Messages':[_[_0x43df('0x4b')](_0x15eff8[_0x43df('0x61')],{'read':![],'body':_0x15eff8[_0x43df('0x61')][_0x43df('0x61')],'phone':_0x310c21,'WhatsappAccountId':_0x1901ff['id'],'UserId':_0x15eff8[_0x43df('0x5b')]['id'],'ContactId':_0x105f5e['id']})]},{'include':[{'model':db[_0x43df('0x86')],'as':'Messages'}]})[_0x43df('0x1e')](function(_0x3777e5){return[_0x3777e5,!![]];});});}})[_0x43df('0x6f')](function(_0x1655dd,_0x35b414){if(_0x35b414){return _0x1655dd;}return db['WhatsappMessage'][_0x43df('0x58')](_[_0x43df('0x4b')](_0x15eff8['body'],{'read':![],'body':_0x15eff8[_0x43df('0x61')][_0x43df('0x61')],'phone':_0x310c21,'WhatsappAccountId':_0x1901ff['id'],'WhatsappInteractionId':_0x1655dd['id'],'UserId':_0x15eff8[_0x43df('0x5b')]['id'],'ContactId':_0x105f5e['id']}))[_0x43df('0x1e')](function(_0x16ffdb){_0x1655dd[_0x43df('0xc1')][_0x43df('0xc2')]=[];_0x1655dd['dataValues'][_0x43df('0xc2')]['push'](_0x16ffdb['dataValues']);return _0x1655dd;});})['then'](respondWithResult(_0x1afe2a,null))[_0x43df('0x27')](handleError(_0x1afe2a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b1e0495..e99ee40 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 _0x862f=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x862f,0x137));var _0xf862=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x862f[_0x3cb3ca];return _0x214366;};'use strict';var EventEmitter=require(_0xf862('0x0'));var WhatsappAccount=require(_0xf862('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf862('0x2'),'afterUpdate':_0xf862('0x3'),'afterDestroy':_0xf862('0x4')};function emitEvent(_0x21c64a){return function(_0x595c93,_0x543e61,_0x4050f9){WhatsappAccountEvents[_0xf862('0x5')](_0x21c64a+':'+_0x595c93['id'],_0x595c93);WhatsappAccountEvents[_0xf862('0x5')](_0x21c64a,_0x595c93);_0x4050f9(null);};}for(var e in events){if(events[_0xf862('0x6')](e)){var event=events[e];WhatsappAccount[_0xf862('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xa476=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x37a513,_0xfbf741){var _0x59d8a5=function(_0x2d4683){while(--_0x2d4683){_0x37a513['push'](_0x37a513['shift']());}};_0x59d8a5(++_0xfbf741);}(_0xa476,0x9a));var _0x6a47=function(_0x430645,_0x453b78){_0x430645=_0x430645-0x0;var _0x478100=_0xa476[_0x430645];return _0x478100;};'use strict';var EventEmitter=require(_0x6a47('0x0'));var WhatsappAccount=require(_0x6a47('0x1'))['db'][_0x6a47('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a47('0x3'),'afterUpdate':_0x6a47('0x4'),'afterDestroy':_0x6a47('0x5')};function emitEvent(_0x2ad929){return function(_0x52ff5e,_0x2112e4,_0x41cf10){WhatsappAccountEvents['emit'](_0x2ad929+':'+_0x52ff5e['id'],_0x52ff5e);WhatsappAccountEvents[_0x6a47('0x6')](_0x2ad929,_0x52ff5e);_0x41cf10(null);};}for(var e in events){if(events[_0x6a47('0x7')](e)){var event=events[e];WhatsappAccount[_0x6a47('0x8')](e,emitEvent(event));}}module[_0x6a47('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e623437..ad2a48c 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 _0x378a=['path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','lodash','api','moment'];(function(_0x2e083c,_0xe3a1b6){var _0x18507a=function(_0xf468ef){while(--_0xf468ef){_0x2e083c['push'](_0x2e083c['shift']());}};_0x18507a(++_0xe3a1b6);}(_0x378a,0x153));var _0xa378=function(_0x428882,_0x4c31be){_0x428882=_0x428882-0x0;var _0x5aae12=_0x378a[_0x428882];return _0x5aae12;};'use strict';var _=require(_0xa378('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa378('0x1'));var moment=require(_0xa378('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa378('0x3'));var rimraf=require(_0xa378('0x4'));var config=require(_0xa378('0x5'));var attributes=require(_0xa378('0x6'));module['exports']=function(_0x36b795,_0x3802cf){return _0x36b795[_0xa378('0x7')](_0xa378('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed78=['whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xed78,0xd9));var _0x8ed7=function(_0x373f8c,_0x427eae){_0x373f8c=_0x373f8c-0x0;var _0xc86f7a=_0xed78[_0x373f8c];return _0xc86f7a;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var logger=require(_0x8ed7('0x2'))(_0x8ed7('0x3'));var moment=require('moment');var BPromise=require(_0x8ed7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ed7('0x5'));var rimraf=require(_0x8ed7('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ed7('0x7'));module[_0x8ed7('0x8')]=function(_0x29ee44,_0x5f0b1a){return _0x29ee44[_0x8ed7('0x9')](_0x8ed7('0xa'),attributes,{'tableName':_0x8ed7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 4c6a0ce..1a38e4f 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 _0xe952=['include','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','options','raw','where','attributes','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe952,0x19b));var _0x2e95=function(_0x5d05c2,_0x42e966){_0x5d05c2=_0x5d05c2-0x0;var _0xf8877f=_0xe952[_0x5d05c2];return _0xf8877f;};'use strict';var _=require(_0x2e95('0x0'));var util=require(_0x2e95('0x1'));var moment=require(_0x2e95('0x2'));var BPromise=require(_0x2e95('0x3'));var rs=require(_0x2e95('0x4'));var fs=require('fs');var Redis=require(_0x2e95('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e95('0x6'));var logger=require('../../config/logger')(_0x2e95('0x7'));var config=require(_0x2e95('0x8'));var jayson=require(_0x2e95('0x9'));var client=jayson[_0x2e95('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2e95('0xb')],{'host':_0x2e95('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e95('0xb')]));require(_0x2e95('0xd'))['register'](socket);function respondWithRpcPromise(_0xa79a14,_0x5d6309,_0x707253){return new BPromise(function(_0x5190b3,_0x4686a7){return client[_0x2e95('0xe')](_0xa79a14,_0x707253)[_0x2e95('0xf')](function(_0x2c40ea){logger[_0x2e95('0x10')](_0x2e95('0x11'),_0x5d6309,_0x2e95('0x12'));logger['debug'](_0x2e95('0x13'),_0x5d6309,'request\x20sent',JSON[_0x2e95('0x14')](_0x2c40ea));if(_0x2c40ea['error']){if(_0x2c40ea[_0x2e95('0x15')][_0x2e95('0x16')]===0x1f4){logger['error'](_0x2e95('0x11'),_0x5d6309,_0x2c40ea[_0x2e95('0x15')]['message']);return _0x4686a7(_0x2c40ea[_0x2e95('0x15')][_0x2e95('0x17')]);}logger['error'](_0x2e95('0x11'),_0x5d6309,_0x2c40ea[_0x2e95('0x15')]['message']);return _0x5190b3(_0x2c40ea[_0x2e95('0x15')][_0x2e95('0x17')]);}else{logger[_0x2e95('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x5d6309,_0x2e95('0x12'));_0x5190b3(_0x2c40ea[_0x2e95('0x18')][_0x2e95('0x17')]);}})['catch'](function(_0x9bf791){logger[_0x2e95('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5d6309,_0x9bf791);_0x4686a7(_0x9bf791);});});}exports[_0x2e95('0x19')]=function(_0x5c8936){var _0x26df0d=this;return new Promise(function(_0x5d19ce,_0xcb9c68){return db['WhatsappAccount']['find']({'raw':_0x5c8936[_0x2e95('0x1a')]?_0x5c8936['options'][_0x2e95('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c8936['options']?_0x5c8936[_0x2e95('0x1a')][_0x2e95('0x1c')]||null:null,'attributes':_0x5c8936[_0x2e95('0x1a')]?_0x5c8936[_0x2e95('0x1a')][_0x2e95('0x1d')]||null:null,'include':_0x5c8936[_0x2e95('0x1a')]?_0x5c8936[_0x2e95('0x1a')]['include']?_[_0x2e95('0x1e')](_0x5c8936['options'][_0x2e95('0x1f')],function(_0x1c8cf2){return{'model':db[_0x1c8cf2[_0x2e95('0x20')]],'as':_0x1c8cf2['as'],'attributes':_0x1c8cf2[_0x2e95('0x1d')],'include':_0x1c8cf2['include']?_[_0x2e95('0x1e')](_0x1c8cf2[_0x2e95('0x1f')],function(_0x5ac6e6){return{'model':db[_0x5ac6e6[_0x2e95('0x20')]],'as':_0x5ac6e6['as'],'attributes':_0x5ac6e6[_0x2e95('0x1d')],'include':_0x5ac6e6[_0x2e95('0x1f')]?_[_0x2e95('0x1e')](_0x5ac6e6[_0x2e95('0x1f')],function(_0x518e2d){return{'model':db[_0x518e2d[_0x2e95('0x20')]],'as':_0x518e2d['as'],'attributes':_0x518e2d[_0x2e95('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e95('0xf')](function(_0x4884b6){logger[_0x2e95('0x10')](_0x2e95('0x19'),_0x5c8936);logger['debug'](_0x2e95('0x19'),_0x5c8936,JSON['stringify'](_0x4884b6));_0x5d19ce(_0x4884b6);})[_0x2e95('0x21')](function(_0x270fd2){logger[_0x2e95('0x15')]('ShowWhatsappAccount',_0x270fd2[_0x2e95('0x17')],_0x5c8936);_0xcb9c68(_0x26df0d['error'](0x1f4,_0x270fd2[_0x2e95('0x17')]));});});}; \ No newline at end of file +var _0x7017=['WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','model','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x3590a4,_0x2eea94){var _0x17a579=function(_0x185371){while(--_0x185371){_0x3590a4['push'](_0x3590a4['shift']());}};_0x17a579(++_0x2eea94);}(_0x7017,0x187));var _0x7701=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7017[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x7701('0x0'));var moment=require(_0x7701('0x1'));var BPromise=require(_0x7701('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7701('0x3'));var db=require(_0x7701('0x4'))['db'];var utils=require(_0x7701('0x5'));var logger=require(_0x7701('0x6'))(_0x7701('0x7'));var config=require(_0x7701('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7701('0x9')][_0x7701('0xa')]({'port':0x232a});config[_0x7701('0xb')]=_['defaults'](config[_0x7701('0xb')],{'host':_0x7701('0xc'),'port':0x18eb});var socket=require(_0x7701('0xd'))(new Redis(config[_0x7701('0xb')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x50b54a,_0x233ab8,_0x34b1e9){return new BPromise(function(_0x28ad43,_0x42f29e){return client[_0x7701('0xe')](_0x50b54a,_0x34b1e9)[_0x7701('0xf')](function(_0x1306e1){logger[_0x7701('0x10')](_0x7701('0x11'),_0x233ab8,'request\x20sent');logger[_0x7701('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x233ab8,_0x7701('0x13'),JSON[_0x7701('0x14')](_0x1306e1));if(_0x1306e1[_0x7701('0x15')]){if(_0x1306e1[_0x7701('0x15')][_0x7701('0x16')]===0x1f4){logger[_0x7701('0x15')](_0x7701('0x11'),_0x233ab8,_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);return _0x42f29e(_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);}logger['error'](_0x7701('0x11'),_0x233ab8,_0x1306e1[_0x7701('0x15')][_0x7701('0x17')]);return _0x28ad43(_0x1306e1['error'][_0x7701('0x17')]);}else{logger[_0x7701('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x233ab8,'request\x20sent');_0x28ad43(_0x1306e1[_0x7701('0x18')][_0x7701('0x17')]);}})[_0x7701('0x19')](function(_0x455645){logger[_0x7701('0x15')](_0x7701('0x11'),_0x233ab8,_0x455645);_0x42f29e(_0x455645);});});}exports[_0x7701('0x1a')]=function(_0x3f3740){var _0x309e90=this;return new Promise(function(_0x490ff1,_0x579801){return db['WhatsappAccount'][_0x7701('0x1b')]({'raw':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3f3740['options']?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1d')]||null:null,'attributes':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1e')]||null:null,'include':_0x3f3740[_0x7701('0x1c')]?_0x3f3740[_0x7701('0x1c')][_0x7701('0x1f')]?_['map'](_0x3f3740[_0x7701('0x1c')][_0x7701('0x1f')],function(_0x16fe06){return{'model':db[_0x16fe06[_0x7701('0x20')]],'as':_0x16fe06['as'],'attributes':_0x16fe06[_0x7701('0x1e')],'include':_0x16fe06[_0x7701('0x1f')]?_[_0x7701('0x21')](_0x16fe06[_0x7701('0x1f')],function(_0xe3c9a8){return{'model':db[_0xe3c9a8[_0x7701('0x20')]],'as':_0xe3c9a8['as'],'attributes':_0xe3c9a8['attributes'],'include':_0xe3c9a8[_0x7701('0x1f')]?_[_0x7701('0x21')](_0xe3c9a8['include'],function(_0x1ccc79){return{'model':db[_0x1ccc79[_0x7701('0x20')]],'as':_0x1ccc79['as'],'attributes':_0x1ccc79[_0x7701('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7701('0xf')](function(_0x1b50da){logger[_0x7701('0x10')](_0x7701('0x1a'),_0x3f3740);logger['debug'](_0x7701('0x1a'),_0x3f3740,JSON[_0x7701('0x14')](_0x1b50da));_0x490ff1(_0x1b50da);})[_0x7701('0x19')](function(_0xf00fe1){logger[_0x7701('0x15')]('ShowWhatsappAccount',_0xf00fe1[_0x7701('0x17')],_0x3f3740);_0x579801(_0x309e90[_0x7701('0x15')](0x1f4,_0xf00fe1['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index fd89d68..e9fe0dc 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 _0xe8cf=['removeListener','length','remove','update','emit'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xe8cf,0x1ce));var _0xfe8c=function(_0x43f2ed,_0x18ef91){_0x43f2ed=_0x43f2ed-0x0;var _0x5f452f=_0xe8cf[_0x43f2ed];return _0x5f452f;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xfe8c('0x0'),_0xfe8c('0x1')];function createListener(_0x248cfc,_0x2ccf9a){return function(_0x50d69d){_0x2ccf9a[_0xfe8c('0x2')](_0x248cfc,_0x50d69d);};}function removeListener(_0x16f57f,_0x3a3931){return function(){WhatsappAccountEvents[_0xfe8c('0x3')](_0x16f57f,_0x3a3931);};}exports['register']=function(_0x32bb26){for(var _0x48c103=0x0,_0x163e73=events[_0xfe8c('0x4')];_0x48c103<_0x163e73;_0x48c103++){var _0x141fd2=events[_0x48c103];var _0xbf3f47=createListener('whatsappAccount:'+_0x141fd2,_0x32bb26);WhatsappAccountEvents['on'](_0x141fd2,_0xbf3f47);}}; \ No newline at end of file +var _0xebf9=['whatsappAccount:','save','remove','update','emit','removeListener','length'];(function(_0x45efc3,_0x21cf51){var _0x34f990=function(_0x4b6f81){while(--_0x4b6f81){_0x45efc3['push'](_0x45efc3['shift']());}};_0x34f990(++_0x21cf51);}(_0xebf9,0x143));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9ebf('0x0'),_0x9ebf('0x1'),_0x9ebf('0x2')];function createListener(_0x4ee8c3,_0x3ad430){return function(_0xcf9f82){_0x3ad430[_0x9ebf('0x3')](_0x4ee8c3,_0xcf9f82);};}function removeListener(_0x30040f,_0x3da1f5){return function(){WhatsappAccountEvents[_0x9ebf('0x4')](_0x30040f,_0x3da1f5);};}exports['register']=function(_0x23548f){for(var _0x2633ff=0x0,_0x131b63=events[_0x9ebf('0x5')];_0x2633ff<_0x131b63;_0x2633ff++){var _0x511953=events[_0x2633ff];var _0x269e20=createListener(_0x9ebf('0x6')+_0x511953,_0x23548f);WhatsappAccountEvents['on'](_0x511953,_0x269e20);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 27faeed..c1c86c6 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 _0xa86b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x408f66,_0x734bdd){var _0x1685c9=function(_0x40b860){while(--_0x40b860){_0x408f66['push'](_0x408f66['shift']());}};_0x1685c9(++_0x734bdd);}(_0xa86b,0xb0));var _0xba86=function(_0x2c46cc,_0x2f2bd7){_0x2c46cc=_0x2c46cc-0x0;var _0x4f8906=_0xa86b[_0x2c46cc];return _0x4f8906;};'use strict';var multer=require('multer');var util=require(_0xba86('0x0'));var path=require(_0xba86('0x1'));var timeout=require('connect-timeout');var express=require(_0xba86('0x2'));var router=express[_0xba86('0x3')]();var fs_extra=require(_0xba86('0x4'));var auth=require(_0xba86('0x5'));var interaction=require(_0xba86('0x6'));var config=require(_0xba86('0x7'));var controller=require(_0xba86('0x8'));router[_0xba86('0x9')]('/',auth[_0xba86('0xa')](),controller[_0xba86('0xb')]);router[_0xba86('0x9')](_0xba86('0xc'),auth[_0xba86('0xa')](),controller[_0xba86('0xd')]);router[_0xba86('0xe')]('/',auth[_0xba86('0xa')](),controller['create']);router[_0xba86('0xf')](_0xba86('0xc'),auth[_0xba86('0xa')](),controller[_0xba86('0x10')]);router[_0xba86('0x11')](_0xba86('0xc'),auth[_0xba86('0xa')](),controller[_0xba86('0x12')]);module[_0xba86('0x13')]=router; \ No newline at end of file +var _0x6373=['path','connect-timeout','express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xfae484,_0x252de4){var _0x1718d7=function(_0x1cc401){while(--_0x1cc401){_0xfae484['push'](_0xfae484['shift']());}};_0x1718d7(++_0x252de4);}(_0x6373,0x1b8));var _0x3637=function(_0x3ad0fa,_0x1de705){_0x3ad0fa=_0x3ad0fa-0x0;var _0x358665=_0x6373[_0x3ad0fa];return _0x358665;};'use strict';var multer=require(_0x3637('0x0'));var util=require(_0x3637('0x1'));var path=require(_0x3637('0x2'));var timeout=require(_0x3637('0x3'));var express=require(_0x3637('0x4'));var router=express[_0x3637('0x5')]();var fs_extra=require(_0x3637('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x3637('0x7')](),controller['index']);router[_0x3637('0x8')](_0x3637('0x9'),auth[_0x3637('0x7')](),controller[_0x3637('0xa')]);router[_0x3637('0xb')]('/',auth['isAuthenticated'](),controller[_0x3637('0xc')]);router[_0x3637('0xd')](_0x3637('0x9'),auth[_0x3637('0x7')](),controller[_0x3637('0xe')]);router[_0x3637('0xf')]('/:id',auth[_0x3637('0x7')](),controller[_0x3637('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 593c407..18045be 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 _0x496e=['sequelize','exports','noop','TEXT','STRING'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x496e,0x127));var _0xe496=function(_0x122620,_0x28559d){_0x122620=_0x122620-0x0;var _0x4bde35=_0x496e[_0x122620];return _0x4bde35;};'use strict';var Sequelize=require(_0xe496('0x0'));module[_0xe496('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe496('0x2')},'appdata':{'type':Sequelize[_0xe496('0x3')]()},'description':{'type':Sequelize[_0xe496('0x4')]},'interval':{'type':Sequelize[_0xe496('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb4f6=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x3d703a,_0x4f627d){var _0x5a39cd=function(_0x5c57e2){while(--_0x5c57e2){_0x3d703a['push'](_0x3d703a['shift']());}};_0x5a39cd(++_0x4f627d);}(_0xb4f6,0x197));var _0x6b4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4f6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6b4f('0x0'));module[_0x6b4f('0x1')]={'priority':{'type':Sequelize[_0x6b4f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6b4f('0x3')],'allowNull':![],'defaultValue':_0x6b4f('0x4')},'appdata':{'type':Sequelize[_0x6b4f('0x5')]()},'description':{'type':Sequelize[_0x6b4f('0x3')]},'interval':{'type':Sequelize[_0x6b4f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 68c22cf..f295d45 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 _0x9aac=['set','save','then','name','send','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x9aac,0x135));var _0xc9aa=function(_0x535cd3,_0x35dd6d){_0x535cd3=_0x535cd3-0x0;var _0x25c646=_0x9aac[_0x535cd3];return _0x25c646;};'use strict';var emlformat=require(_0xc9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9aa('0x1'));var jsonpatch=require(_0xc9aa('0x2'));var rp=require('request-promise');var moment=require(_0xc9aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc9aa('0x4'));var util=require('util');var path=require(_0xc9aa('0x5'));var sox=require(_0xc9aa('0x6'));var csv=require('to-csv');var ejs=require(_0xc9aa('0x7'));var fs=require('fs');var fs_extra=require(_0xc9aa('0x8'));var _=require(_0xc9aa('0x9'));var squel=require('squel');var crypto=require(_0xc9aa('0xa'));var jsforce=require(_0xc9aa('0xb'));var deskjs=require(_0xc9aa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc9aa('0xd'));var Papa=require(_0xc9aa('0xe'));var Redis=require(_0xc9aa('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc9aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9aa('0x11'))(_0xc9aa('0x12'));var utils=require(_0xc9aa('0x13'));var config=require(_0xc9aa('0x14'));var licenseUtil=require(_0xc9aa('0x15'));var db=require(_0xc9aa('0x16'))['db'];function respondWithStatusCode(_0x21e9c3,_0x2b38da){_0x2b38da=_0x2b38da||0xcc;return function(_0xfc9acd){if(_0xfc9acd){return _0x21e9c3[_0xc9aa('0x17')](_0x2b38da);}return _0x21e9c3[_0xc9aa('0x18')](_0x2b38da)[_0xc9aa('0x19')]();};}function respondWithResult(_0x39331d,_0x406422){_0x406422=_0x406422||0xc8;return function(_0x2b5708){if(_0x2b5708){return _0x39331d[_0xc9aa('0x18')](_0x406422)[_0xc9aa('0x1a')](_0x2b5708);}};}function respondWithFilteredResult(_0x53834b,_0x129cc1){return function(_0x4ed0c1){if(_0x4ed0c1){var _0x5b351f=typeof _0x129cc1[_0xc9aa('0x1b')]===_0xc9aa('0x1c')&&typeof _0x129cc1[_0xc9aa('0x1d')]===_0xc9aa('0x1c');var _0x4b42a4=_0x4ed0c1[_0xc9aa('0x1e')];var _0x28a1a0=_0x5b351f?0x0:_0x129cc1[_0xc9aa('0x1b')];var _0x4bacb3=_0x5b351f?_0x4ed0c1[_0xc9aa('0x1e')]:_0x129cc1[_0xc9aa('0x1b')]+_0x129cc1[_0xc9aa('0x1d')];var _0x22ad7f;if(_0x4bacb3>=_0x4b42a4){_0x4bacb3=_0x4b42a4;_0x22ad7f=0xc8;}else{_0x22ad7f=0xce;}_0x53834b[_0xc9aa('0x18')](_0x22ad7f);return _0x53834b[_0xc9aa('0x1f')]('Content-Range',_0x28a1a0+'-'+_0x4bacb3+'/'+_0x4b42a4)[_0xc9aa('0x1a')](_0x4ed0c1);}return null;};}function patchUpdates(_0x55037f){return function(_0x2c634a){try{jsonpatch['apply'](_0x2c634a,_0x55037f,!![]);}catch(_0x7c837f){return BPromise['reject'](_0x7c837f);}return _0x2c634a[_0xc9aa('0x20')]();};}function saveUpdates(_0x3f8bfd,_0x214c09){return function(_0x465f52){if(_0x465f52){return _0x465f52['update'](_0x3f8bfd)[_0xc9aa('0x21')](function(_0x122d0c){return _0x122d0c;});}return null;};}function removeEntity(_0xbb6dc1,_0x1b4246){return function(_0x3f5347){if(_0x3f5347){return _0x3f5347['destroy']()[_0xc9aa('0x21')](function(){_0xbb6dc1[_0xc9aa('0x18')](0xcc)[_0xc9aa('0x19')]();});}};}function handleEntityNotFound(_0x59dcfe,_0x1f6646){return function(_0x13cb3f){if(!_0x13cb3f){_0x59dcfe[_0xc9aa('0x17')](0x194);}return _0x13cb3f;};}function handleError(_0x4dab46,_0x44108f){_0x44108f=_0x44108f||0x1f4;return function(_0x40e628){logger['error'](_0x40e628['stack']);if(_0x40e628[_0xc9aa('0x22')]){delete _0x40e628[_0xc9aa('0x22')];}_0x4dab46[_0xc9aa('0x18')](_0x44108f)[_0xc9aa('0x23')](_0x40e628);};}exports[_0xc9aa('0x24')]=function(_0x12e908,_0x1251e1){var _0x5865b5={},_0x1d1215={},_0x3446aa={'count':0x0,'rows':[]};var _0x25d3e5=_[_0xc9aa('0x25')](db[_0xc9aa('0x26')][_0xc9aa('0x27')],function(_0x363394){return{'name':_0x363394['fieldName'],'type':_0x363394[_0xc9aa('0x28')][_0xc9aa('0x29')]};});_0x1d1215[_0xc9aa('0x2a')]=_[_0xc9aa('0x25')](_0x25d3e5,_0xc9aa('0x22'));_0x1d1215[_0xc9aa('0x2b')]=_[_0xc9aa('0x2c')](_0x12e908[_0xc9aa('0x2b')]);_0x1d1215[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x1d1215[_0xc9aa('0x2a')],_0x1d1215['query']);_0x5865b5['attributes']=_[_0xc9aa('0x2e')](_0x1d1215['model'],qs[_0xc9aa('0x2f')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x2f')]));_0x5865b5['attributes']=_0x5865b5[_0xc9aa('0x30')][_0xc9aa('0x31')]?_0x5865b5['attributes']:_0x1d1215[_0xc9aa('0x2a')];if(!_0x12e908[_0xc9aa('0x2b')]['hasOwnProperty'](_0xc9aa('0x32'))){_0x5865b5[_0xc9aa('0x1d')]=qs[_0xc9aa('0x1d')](_0x12e908[_0xc9aa('0x2b')]['limit']);_0x5865b5[_0xc9aa('0x1b')]=qs[_0xc9aa('0x1b')](_0x12e908['query'][_0xc9aa('0x1b')]);}_0x5865b5[_0xc9aa('0x33')]=qs[_0xc9aa('0x34')](_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x34')]);_0x5865b5[_0xc9aa('0x35')]=qs['filters'](_['pick'](_0x12e908[_0xc9aa('0x2b')],_0x1d1215[_0xc9aa('0x2d')]),_0x25d3e5);if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x36')]){_0x5865b5[_0xc9aa('0x35')]=_[_0xc9aa('0x37')](_0x5865b5[_0xc9aa('0x35')],{'$or':_['map'](_0x25d3e5,function(_0x3631ef){if(_0x3631ef[_0xc9aa('0x28')]!==_0xc9aa('0x38')){var _0x2c680b={};_0x2c680b[_0x3631ef['name']]={'$like':'%'+_0x12e908['query']['filter']+'%'};return _0x2c680b;}})});}_0x5865b5=_[_0xc9aa('0x37')]({},_0x5865b5,_0x12e908[_0xc9aa('0x39')]);var _0x311a2c={'where':_0x5865b5[_0xc9aa('0x35')]};return db[_0xc9aa('0x26')][_0xc9aa('0x1e')](_0x311a2c)[_0xc9aa('0x21')](function(_0x55bd4f){_0x3446aa[_0xc9aa('0x1e')]=_0x55bd4f;if(_0x12e908[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x5865b5[_0xc9aa('0x3b')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x5865b5);})[_0xc9aa('0x21')](function(_0x5699c3){_0x3446aa[_0xc9aa('0x3c')]=_0x5699c3;return _0x3446aa;})[_0xc9aa('0x21')](respondWithFilteredResult(_0x1251e1,_0x5865b5))[_0xc9aa('0x3d')](handleError(_0x1251e1,null));};exports[_0xc9aa('0x3e')]=function(_0x51c85e,_0x6cf2dd){var _0x59006b={'raw':!![],'where':{'id':_0x51c85e[_0xc9aa('0x3f')]['id']}},_0x2990f0={};_0x2990f0[_0xc9aa('0x2a')]=_[_0xc9aa('0x2c')](db[_0xc9aa('0x26')]['rawAttributes']);_0x2990f0[_0xc9aa('0x2b')]=_['keys'](_0x51c85e[_0xc9aa('0x2b')]);_0x2990f0[_0xc9aa('0x2d')]=_[_0xc9aa('0x2e')](_0x2990f0[_0xc9aa('0x2a')],_0x2990f0[_0xc9aa('0x2b')]);_0x59006b[_0xc9aa('0x30')]=_[_0xc9aa('0x2e')](_0x2990f0['model'],qs['fields'](_0x51c85e[_0xc9aa('0x2b')]['fields']));_0x59006b[_0xc9aa('0x30')]=_0x59006b['attributes'][_0xc9aa('0x31')]?_0x59006b[_0xc9aa('0x30')]:_0x2990f0[_0xc9aa('0x2a')];if(_0x51c85e[_0xc9aa('0x2b')][_0xc9aa('0x3a')]){_0x59006b[_0xc9aa('0x3b')]=[{'all':!![]}];}_0x59006b=_[_0xc9aa('0x37')]({},_0x59006b,_0x51c85e[_0xc9aa('0x39')]);return db[_0xc9aa('0x26')][_0xc9aa('0x40')](_0x59006b)[_0xc9aa('0x21')](handleEntityNotFound(_0x6cf2dd,null))[_0xc9aa('0x21')](respondWithResult(_0x6cf2dd,null))['catch'](handleError(_0x6cf2dd,null));};exports[_0xc9aa('0x41')]=function(_0x16851c,_0x575c7b){return db['WhatsappApplication']['create'](_0x16851c['body'],{})['then'](respondWithResult(_0x575c7b,0xc9))['catch'](handleError(_0x575c7b,null));};exports['update']=function(_0x53f5f1,_0x44c5db){if(_0x53f5f1[_0xc9aa('0x42')]['id']){delete _0x53f5f1[_0xc9aa('0x42')]['id'];}return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x53f5f1[_0xc9aa('0x3f')]['id']}})[_0xc9aa('0x21')](handleEntityNotFound(_0x44c5db,null))[_0xc9aa('0x21')](saveUpdates(_0x53f5f1['body'],null))[_0xc9aa('0x21')](respondWithResult(_0x44c5db,null))[_0xc9aa('0x3d')](handleError(_0x44c5db,null));};exports[_0xc9aa('0x43')]=function(_0x5e99e0,_0x1855d5){return db[_0xc9aa('0x26')][_0xc9aa('0x40')]({'where':{'id':_0x5e99e0[_0xc9aa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1855d5,null))['then'](removeEntity(_0x1855d5,null))[_0xc9aa('0x3d')](handleError(_0x1855d5,null));}; \ No newline at end of file +var _0xc648=['include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','fields'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xc648,0x171));var _0x8c64=function(_0x512c97,_0x2f105d){_0x512c97=_0x512c97-0x0;var _0x5c80d3=_0xc648[_0x512c97];return _0x5c80d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c64('0x0'));var zipdir=require(_0x8c64('0x1'));var jsonpatch=require(_0x8c64('0x2'));var rp=require(_0x8c64('0x3'));var moment=require(_0x8c64('0x4'));var BPromise=require(_0x8c64('0x5'));var Mustache=require(_0x8c64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8c64('0x7'));var ejs=require(_0x8c64('0x8'));var fs=require('fs');var fs_extra=require(_0x8c64('0x9'));var _=require(_0x8c64('0xa'));var squel=require('squel');var crypto=require(_0x8c64('0xb'));var jsforce=require(_0x8c64('0xc'));var deskjs=require(_0x8c64('0xd'));var toCsv=require(_0x8c64('0x7'));var querystring=require(_0x8c64('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c64('0xf'));var authService=require(_0x8c64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c64('0x11'));var hardwareService=require(_0x8c64('0x12'));var logger=require(_0x8c64('0x13'))(_0x8c64('0x14'));var utils=require(_0x8c64('0x15'));var config=require(_0x8c64('0x16'));var licenseUtil=require(_0x8c64('0x17'));var db=require(_0x8c64('0x18'))['db'];function respondWithStatusCode(_0x3834e6,_0x19a173){_0x19a173=_0x19a173||0xcc;return function(_0x54e0f0){if(_0x54e0f0){return _0x3834e6[_0x8c64('0x19')](_0x19a173);}return _0x3834e6[_0x8c64('0x1a')](_0x19a173)[_0x8c64('0x1b')]();};}function respondWithResult(_0x36e227,_0x3a4cbf){_0x3a4cbf=_0x3a4cbf||0xc8;return function(_0xeb374){if(_0xeb374){return _0x36e227[_0x8c64('0x1a')](_0x3a4cbf)['json'](_0xeb374);}};}function respondWithFilteredResult(_0x14df4a,_0x16c84e){return function(_0x4dbf8d){if(_0x4dbf8d){var _0xfacf06=typeof _0x16c84e[_0x8c64('0x1c')]==='undefined'&&typeof _0x16c84e[_0x8c64('0x1d')]===_0x8c64('0x1e');var _0x511608=_0x4dbf8d['count'];var _0x20931c=_0xfacf06?0x0:_0x16c84e[_0x8c64('0x1c')];var _0x4be59b=_0xfacf06?_0x4dbf8d[_0x8c64('0x1f')]:_0x16c84e[_0x8c64('0x1c')]+_0x16c84e['limit'];var _0x4d7350;if(_0x4be59b>=_0x511608){_0x4be59b=_0x511608;_0x4d7350=0xc8;}else{_0x4d7350=0xce;}_0x14df4a['status'](_0x4d7350);return _0x14df4a[_0x8c64('0x20')]('Content-Range',_0x20931c+'-'+_0x4be59b+'/'+_0x511608)['json'](_0x4dbf8d);}return null;};}function patchUpdates(_0x45839d){return function(_0x6d288f){try{jsonpatch[_0x8c64('0x21')](_0x6d288f,_0x45839d,!![]);}catch(_0x2c837c){return BPromise[_0x8c64('0x22')](_0x2c837c);}return _0x6d288f[_0x8c64('0x23')]();};}function saveUpdates(_0x4e7853,_0x28b7dd){return function(_0x51c459){if(_0x51c459){return _0x51c459[_0x8c64('0x24')](_0x4e7853)['then'](function(_0x2624dc){return _0x2624dc;});}return null;};}function removeEntity(_0x3f9a8a,_0x4b2f7b){return function(_0x400bf7){if(_0x400bf7){return _0x400bf7[_0x8c64('0x25')]()[_0x8c64('0x26')](function(){_0x3f9a8a['status'](0xcc)[_0x8c64('0x1b')]();});}};}function handleEntityNotFound(_0x4ddd8f,_0x282f6e){return function(_0xd3001c){if(!_0xd3001c){_0x4ddd8f[_0x8c64('0x19')](0x194);}return _0xd3001c;};}function handleError(_0x153d86,_0x328da5){_0x328da5=_0x328da5||0x1f4;return function(_0x56e847){logger[_0x8c64('0x27')](_0x56e847['stack']);if(_0x56e847['name']){delete _0x56e847[_0x8c64('0x28')];}_0x153d86['status'](_0x328da5)[_0x8c64('0x29')](_0x56e847);};}exports[_0x8c64('0x2a')]=function(_0x1cf017,_0x5570cf){var _0x87f610={},_0x2d7548={},_0x13f0b0={'count':0x0,'rows':[]};var _0x1bb974=_[_0x8c64('0x2b')](db[_0x8c64('0x2c')][_0x8c64('0x2d')],function(_0x1e2706){return{'name':_0x1e2706['fieldName'],'type':_0x1e2706['type']['key']};});_0x2d7548[_0x8c64('0x2e')]=_[_0x8c64('0x2b')](_0x1bb974,_0x8c64('0x28'));_0x2d7548[_0x8c64('0x2f')]=_['keys'](_0x1cf017[_0x8c64('0x2f')]);_0x2d7548[_0x8c64('0x30')]=_['intersection'](_0x2d7548[_0x8c64('0x2e')],_0x2d7548['query']);_0x87f610['attributes']=_[_0x8c64('0x31')](_0x2d7548[_0x8c64('0x2e')],qs['fields'](_0x1cf017['query']['fields']));_0x87f610[_0x8c64('0x32')]=_0x87f610[_0x8c64('0x32')][_0x8c64('0x33')]?_0x87f610[_0x8c64('0x32')]:_0x2d7548[_0x8c64('0x2e')];if(!_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x34')](_0x8c64('0x35'))){_0x87f610[_0x8c64('0x1d')]=qs['limit'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1d')]);_0x87f610[_0x8c64('0x1c')]=qs['offset'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1c')]);}_0x87f610[_0x8c64('0x36')]=qs['sort'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x37')]);_0x87f610[_0x8c64('0x38')]=qs[_0x8c64('0x30')](_[_0x8c64('0x39')](_0x1cf017[_0x8c64('0x2f')],_0x2d7548[_0x8c64('0x30')]),_0x1bb974);if(_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]){_0x87f610[_0x8c64('0x38')]=_[_0x8c64('0x3b')](_0x87f610[_0x8c64('0x38')],{'$or':_[_0x8c64('0x2b')](_0x1bb974,function(_0x3142ee){if(_0x3142ee['type']!=='VIRTUAL'){var _0x444a5b={};_0x444a5b[_0x3142ee[_0x8c64('0x28')]]={'$like':'%'+_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]+'%'};return _0x444a5b;}})});}_0x87f610=_['merge']({},_0x87f610,_0x1cf017[_0x8c64('0x3c')]);var _0x430d82={'where':_0x87f610[_0x8c64('0x38')]};return db[_0x8c64('0x2c')][_0x8c64('0x1f')](_0x430d82)['then'](function(_0x3b9f51){_0x13f0b0[_0x8c64('0x1f')]=_0x3b9f51;if(_0x1cf017['query'][_0x8c64('0x3d')]){_0x87f610['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x8c64('0x3e')](_0x87f610);})[_0x8c64('0x26')](function(_0x5f3c6d){_0x13f0b0[_0x8c64('0x3f')]=_0x5f3c6d;return _0x13f0b0;})[_0x8c64('0x26')](respondWithFilteredResult(_0x5570cf,_0x87f610))[_0x8c64('0x40')](handleError(_0x5570cf,null));};exports[_0x8c64('0x41')]=function(_0x15bb03,_0x452644){var _0x433d5b={'raw':!![],'where':{'id':_0x15bb03[_0x8c64('0x42')]['id']}},_0x311803={};_0x311803[_0x8c64('0x2e')]=_[_0x8c64('0x43')](db['WhatsappApplication'][_0x8c64('0x2d')]);_0x311803[_0x8c64('0x2f')]=_[_0x8c64('0x43')](_0x15bb03['query']);_0x311803[_0x8c64('0x30')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],_0x311803['query']);_0x433d5b[_0x8c64('0x32')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],qs[_0x8c64('0x44')](_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x44')]));_0x433d5b['attributes']=_0x433d5b[_0x8c64('0x32')][_0x8c64('0x33')]?_0x433d5b[_0x8c64('0x32')]:_0x311803[_0x8c64('0x2e')];if(_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x3d')]){_0x433d5b[_0x8c64('0x45')]=[{'all':!![]}];}_0x433d5b=_[_0x8c64('0x3b')]({},_0x433d5b,_0x15bb03[_0x8c64('0x3c')]);return db[_0x8c64('0x2c')][_0x8c64('0x46')](_0x433d5b)[_0x8c64('0x26')](handleEntityNotFound(_0x452644,null))[_0x8c64('0x26')](respondWithResult(_0x452644,null))[_0x8c64('0x40')](handleError(_0x452644,null));};exports[_0x8c64('0x47')]=function(_0x4f7f1b,_0x163a29){return db[_0x8c64('0x2c')][_0x8c64('0x47')](_0x4f7f1b[_0x8c64('0x48')],{})[_0x8c64('0x26')](respondWithResult(_0x163a29,0xc9))[_0x8c64('0x40')](handleError(_0x163a29,null));};exports['update']=function(_0x2503a7,_0x19d248){if(_0x2503a7[_0x8c64('0x48')]['id']){delete _0x2503a7[_0x8c64('0x48')]['id'];}return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2503a7[_0x8c64('0x42')]['id']}})['then'](handleEntityNotFound(_0x19d248,null))[_0x8c64('0x26')](saveUpdates(_0x2503a7[_0x8c64('0x48')],null))['then'](respondWithResult(_0x19d248,null))['catch'](handleError(_0x19d248,null));};exports[_0x8c64('0x25')]=function(_0x2987cb,_0x219494){return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2987cb[_0x8c64('0x42')]['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0x219494,null))['then'](removeEntity(_0x219494,null))[_0x8c64('0x40')](handleError(_0x219494,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1805d56..6ffdff4 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 _0x294b=['exports','define','whatsapp_applications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes'];(function(_0x6b7bad,_0x381b03){var _0x540ee3=function(_0xfeab15){while(--_0xfeab15){_0x6b7bad['push'](_0x6b7bad['shift']());}};_0x540ee3(++_0x381b03);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var logger=require(_0xb294('0x1'))(_0xb294('0x2'));var moment=require(_0xb294('0x3'));var BPromise=require(_0xb294('0x4'));var rp=require(_0xb294('0x5'));var fs=require('fs');var path=require(_0xb294('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb294('0x7'));module[_0xb294('0x8')]=function(_0xaa6a67,_0x181f5e){return _0xaa6a67[_0xb294('0x9')]('WhatsappApplication',attributes,{'tableName':_0xb294('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb7cf=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xb7cf,0xca));var _0xfb7c=function(_0x3b59d5,_0x1e23f2){_0x3b59d5=_0x3b59d5-0x0;var _0x30cc91=_0xb7cf[_0x3b59d5];return _0x30cc91;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var logger=require(_0xfb7c('0x2'))(_0xfb7c('0x3'));var moment=require(_0xfb7c('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb7c('0x5'));var fs=require('fs');var path=require(_0xfb7c('0x6'));var rimraf=require(_0xfb7c('0x7'));var config=require(_0xfb7c('0x8'));var attributes=require(_0xfb7c('0x9'));module[_0xfb7c('0xa')]=function(_0x2e245c,_0x135394){return _0x2e245c[_0xfb7c('0xb')](_0xfb7c('0xc'),attributes,{'tableName':_0xfb7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb7c('0xe'),'collate':_0xfb7c('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 12fc848..e9f61a3 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 _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3435cb,_0x2232c4){var _0x5aa5d7=function(_0x1448df){while(--_0x1448df){_0x3435cb['push'](_0x3435cb['shift']());}};_0x5aa5d7(++_0x2232c4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4ac7ae,_0x54cbdd){_0x4ac7ae=_0x4ac7ae-0x0;var _0x148b01=_0x9bde[_0x4ac7ae];return _0x148b01;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5658af,_0x5e6939){var _0x6ef8ad=function(_0x596028){while(--_0x596028){_0x5658af['push'](_0x5658af['shift']());}};_0x6ef8ad(++_0x5e6939);}(_0x9bde,0xe1));var _0xe9bd=function(_0x56b624,_0x47f71d){_0x56b624=_0x56b624-0x0;var _0x17bc9c=_0x9bde[_0x56b624];return _0x17bc9c;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e398f76..d547d27 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 _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xa1f6[_0x1778e1];return _0x2bc4c6;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x3baf=['put','/:id','tracked','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3baf,0xf7));var _0xf3ba=function(_0x11a2dd,_0x5bf4bc){_0x11a2dd=_0x11a2dd-0x0;var _0x4bc0e2=_0x3baf[_0x11a2dd];return _0x4bc0e2;};'use strict';var multer=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var path=require(_0xf3ba('0x2'));var timeout=require(_0xf3ba('0x3'));var express=require(_0xf3ba('0x4'));var router=express[_0xf3ba('0x5')]();var fs_extra=require(_0xf3ba('0x6'));var auth=require(_0xf3ba('0x7'));var interaction=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var controller=require(_0xf3ba('0xa'));router[_0xf3ba('0xb')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xd')]);router[_0xf3ba('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf3ba('0xb')]('/:id',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xe')]);router[_0xf3ba('0xb')](_0xf3ba('0xf'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x10')]);router[_0xf3ba('0xb')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x12')]);router[_0xf3ba('0x13')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x14')]);router[_0xf3ba('0x13')](_0xf3ba('0xf'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x15')]);router[_0xf3ba('0x13')]('/:id/tags',auth[_0xf3ba('0xc')](),interaction['tracked'](_0xf3ba('0x16'),_0xf3ba('0x17')),controller[_0xf3ba('0x18')]);router[_0xf3ba('0x19')](_0xf3ba('0x1a'),auth['isAuthenticated'](),interaction[_0xf3ba('0x1b')](_0xf3ba('0x16'),_0xf3ba('0x1c')),controller['update']);router[_0xf3ba('0x1d')](_0xf3ba('0x1a'),auth[_0xf3ba('0xc')](),interaction[_0xf3ba('0x1b')]('whatsapp',_0xf3ba('0x1e')),controller[_0xf3ba('0x1f')]);router['delete']('/:id/tags',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x20')]);module[_0xf3ba('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d4588b7..25eecb9 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 _0xdf5d=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports'];(function(_0x116e07,_0x4383ae){var _0x1c2c74=function(_0xf1aa72){while(--_0xf1aa72){_0x116e07['push'](_0x116e07['shift']());}};_0x1c2c74(++_0x4383ae);}(_0xdf5d,0x126));var _0xddf5=function(_0x4280a9,_0x18bc53){_0x4280a9=_0x4280a9-0x0;var _0x5e272d=_0xdf5d[_0x4280a9];return _0x5e272d;};'use strict';var Sequelize=require(_0xddf5('0x0'));var moment=require(_0xddf5('0x1'));module[_0xddf5('0x2')]={'closed':{'type':Sequelize[_0xddf5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xddf5('0x4')]},'disposition':{'type':Sequelize[_0xddf5('0x5')]},'secondDisposition':{'type':Sequelize[_0xddf5('0x5')]},'thirdDisposition':{'type':Sequelize[_0xddf5('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xddf5('0x5')]},'read1stAt':{'type':Sequelize[_0xddf5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xddf5('0x6')]('in',_0xddf5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xddf5('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xddf5('0x6')]('in',_0xddf5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xddf5('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xddf5('0x8')]}}; \ No newline at end of file +var _0xf7d9=['out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x5ea887,_0x5bb376){var _0x45c71b=function(_0x2353a3){while(--_0x2353a3){_0x5ea887['push'](_0x5ea887['shift']());}};_0x45c71b(++_0x5bb376);}(_0xf7d9,0x122));var _0x9f7d=function(_0x28010c,_0x358367){_0x28010c=_0x28010c-0x0;var _0x5b0de6=_0xf7d9[_0x28010c];return _0x5b0de6;};'use strict';var Sequelize=require(_0x9f7d('0x0'));var moment=require(_0x9f7d('0x1'));module[_0x9f7d('0x2')]={'closed':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9f7d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9f7d('0x4')]},'phone':{'type':Sequelize[_0x9f7d('0x4')]},'read1stAt':{'type':Sequelize[_0x9f7d('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x9f7d('0x6')]('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f7d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9f7d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9f7d('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index bddfb24..76a2f37 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 _0xe534=['Content-Range','update','then','destroy','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','create','body','params','describe','WhatsappMessage','ids','omit','findOne','length','order','sort','pick','WhatsappInteractionId','filter','where','$gte','split','format','findAll','rows','addTags','setTags','spread','color','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','Whatsapp','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','value','renderFile','views','transcript-','.pdf','download','err','rimraf','zip-dir','moment','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xe534,0x1de));var _0x4e53=function(_0x4254c3,_0x2d2dd2){_0x4254c3=_0x4254c3-0x0;var _0x238691=_0xe534[_0x4254c3];return _0x238691;};'use strict';var rimraf=require(_0x4e53('0x0'));var zipdir=require(_0x4e53('0x1'));var moment=require(_0x4e53('0x2'));var BPromise=require(_0x4e53('0x3'));var util=require(_0x4e53('0x4'));var path=require('path');var ejs=require(_0x4e53('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4e53('0x6'));var interaction=require(_0x4e53('0x7'));var qs=require(_0x4e53('0x8'));var pdf=require(_0x4e53('0x9'));var logger=require(_0x4e53('0xa'))('api');var config=require('../../config/environment');var db=require(_0x4e53('0xb'))['db'];config[_0x4e53('0xc')]=_[_0x4e53('0xd')](config[_0x4e53('0xc')],{'host':_0x4e53('0xe'),'port':0x18eb});var socket=require(_0x4e53('0xf'))(new Redis(config[_0x4e53('0xc')]));require(_0x4e53('0x10'))['register'](socket);function respondWithStatusCode(_0x224e8a,_0x5282cb){_0x5282cb=_0x5282cb||0xcc;return function(_0x1a1996){if(_0x1a1996){return _0x224e8a[_0x4e53('0x11')](_0x5282cb);}return _0x224e8a[_0x4e53('0x12')](_0x5282cb)[_0x4e53('0x13')]();};}function respondWithResult(_0x427af8,_0x154225){_0x154225=_0x154225||0xc8;return function(_0x2f303a){if(_0x2f303a){return _0x427af8[_0x4e53('0x12')](_0x154225)[_0x4e53('0x14')](_0x2f303a);}};}function respondWithFilteredResult(_0x1e8d5b,_0x364246){return function(_0x2bfe93){if(_0x2bfe93){var _0x4ba674=typeof _0x364246['offset']===_0x4e53('0x15')&&typeof _0x364246[_0x4e53('0x16')]===_0x4e53('0x15');var _0x1d0d3a=_0x2bfe93[_0x4e53('0x17')];var _0x1cd2d2=_0x4ba674?0x0:_0x364246[_0x4e53('0x18')];var _0xfcd55e=_0x4ba674?_0x2bfe93[_0x4e53('0x17')]:_0x364246['offset']+_0x364246[_0x4e53('0x16')];var _0x341a34;if(_0xfcd55e>=_0x1d0d3a){_0xfcd55e=_0x1d0d3a;_0x341a34=0xc8;}else{_0x341a34=0xce;}_0x1e8d5b[_0x4e53('0x12')](_0x341a34);return _0x1e8d5b[_0x4e53('0x19')](_0x4e53('0x1a'),_0x1cd2d2+'-'+_0xfcd55e+'/'+_0x1d0d3a)[_0x4e53('0x14')](_0x2bfe93);}return null;};}function saveUpdates(_0x1a92bd){return function(_0x4c4715){if(_0x4c4715){return _0x4c4715[_0x4e53('0x1b')](_0x1a92bd)[_0x4e53('0x1c')](function(_0x42b3e0){return _0x42b3e0;});}return null;};}function removeEntity(_0xf3cd16){return function(_0x35137f){if(_0x35137f){return _0x35137f[_0x4e53('0x1d')]()[_0x4e53('0x1c')](function(){_0xf3cd16[_0x4e53('0x12')](0xcc)[_0x4e53('0x13')]();});}};}function handleEntityNotFound(_0x15aa0c){return function(_0x1bd102){if(!_0x1bd102){_0x15aa0c[_0x4e53('0x11')](0x194);}return _0x1bd102;};}function handleError(_0x31407c,_0x47d3cc){_0x47d3cc=_0x47d3cc||0x1f4;return function(_0x2e6ece){logger[_0x4e53('0x1e')](_0x2e6ece[_0x4e53('0x1f')]);if(_0x2e6ece[_0x4e53('0x20')]){delete _0x2e6ece[_0x4e53('0x20')];}_0x31407c['status'](_0x47d3cc)[_0x4e53('0x21')](_0x2e6ece);};}exports['index']=function(_0x45f790,_0x37cb0a){var _0x2adc9f={};var _0x511caf=_[_0x4e53('0x22')](db[_0x4e53('0x23')][_0x4e53('0x24')],function(_0x2fa2cc){return{'name':_0x2fa2cc[_0x4e53('0x25')],'type':_0x2fa2cc[_0x4e53('0x26')][_0x4e53('0x27')]};});_0x2adc9f=qs[_0x4e53('0x28')](_0x511caf,_0x45f790);return interaction['findAll'](_0x4e53('0x29'),_0x45f790[_0x4e53('0x2a')],_0x45f790[_0x4e53('0x2b')],_0x2adc9f,_0x511caf)[_0x4e53('0x1c')](respondWithFilteredResult(_0x37cb0a,_0x2adc9f))[_0x4e53('0x2c')](handleError(_0x37cb0a,null));};exports[_0x4e53('0x2d')]=function(_0x27f008,_0x351d4d){var _0x503819={'raw':![],'where':{'id':_0x27f008['params']['id']}},_0x19aa62={};_0x19aa62['model']=_[_0x4e53('0x2e')](db[_0x4e53('0x23')][_0x4e53('0x24')]);_0x19aa62[_0x4e53('0x2a')]=_[_0x4e53('0x2e')](_0x27f008[_0x4e53('0x2a')]);_0x19aa62[_0x4e53('0x2f')]=_[_0x4e53('0x30')](_0x19aa62[_0x4e53('0x31')],_0x19aa62['query']);_0x503819[_0x4e53('0x32')]=_[_0x4e53('0x30')](_0x19aa62[_0x4e53('0x31')],qs[_0x4e53('0x33')](_0x27f008[_0x4e53('0x2a')][_0x4e53('0x33')]));_0x503819[_0x4e53('0x32')]=_0x503819[_0x4e53('0x32')]['length']?_0x503819['attributes']:_0x19aa62[_0x4e53('0x31')];if(_0x27f008[_0x4e53('0x2a')][_0x4e53('0x34')]){_0x503819[_0x4e53('0x35')]=[{'all':!![]}];}_0x503819=_[_0x4e53('0x36')]({},_0x503819,_0x27f008[_0x4e53('0x37')]);return db['WhatsappInteraction'][_0x4e53('0x38')](_0x503819)[_0x4e53('0x1c')](handleEntityNotFound(_0x351d4d,null))[_0x4e53('0x1c')](respondWithResult(_0x351d4d,null))['catch'](handleError(_0x351d4d,null));};exports[_0x4e53('0x39')]=function(_0x1f528a,_0x1d513a){return db[_0x4e53('0x23')]['create'](_0x1f528a['body'],{})[_0x4e53('0x1c')](respondWithResult(_0x1d513a,0xc9))['catch'](handleError(_0x1d513a,null));};exports[_0x4e53('0x1b')]=function(_0x3ac28b,_0x4f1b23){if(_0x3ac28b[_0x4e53('0x3a')]['id']){delete _0x3ac28b[_0x4e53('0x3a')]['id'];}return db[_0x4e53('0x23')]['find']({'where':{'id':_0x3ac28b[_0x4e53('0x3b')]['id']}})[_0x4e53('0x1c')](handleEntityNotFound(_0x4f1b23,null))['then'](saveUpdates(_0x3ac28b[_0x4e53('0x3a')],null))[_0x4e53('0x1c')](respondWithResult(_0x4f1b23,null))[_0x4e53('0x2c')](handleError(_0x4f1b23,null));};exports[_0x4e53('0x1d')]=function(_0x1a3f24,_0x367405){return db[_0x4e53('0x23')][_0x4e53('0x38')]({'where':{'id':_0x1a3f24[_0x4e53('0x3b')]['id']}})[_0x4e53('0x1c')](handleEntityNotFound(_0x367405,null))['then'](removeEntity(_0x367405,null))[_0x4e53('0x2c')](handleError(_0x367405,null));};exports[_0x4e53('0x3c')]=function(_0x338b83,_0x4e8cbc){return db[_0x4e53('0x23')]['describe']()['then'](respondWithResult(_0x4e8cbc,null))[_0x4e53('0x2c')](handleError(_0x4e8cbc,null));};exports['addMessage']=function(_0xb400b6,_0x5e3ab4){return db[_0x4e53('0x3d')][_0x4e53('0x38')]({'where':{'id':_0xb400b6[_0x4e53('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5e3ab4,null))[_0x4e53('0x1c')](function(_0xb7157e){if(_0xb7157e){return _0xb7157e['addMessage'](_0xb400b6[_0x4e53('0x3a')][_0x4e53('0x3e')],_[_0x4e53('0x3f')](_0xb400b6[_0x4e53('0x3a')],[_0x4e53('0x3e'),'id'])||{});}})[_0x4e53('0x1c')](respondWithResult(_0x5e3ab4,null))['catch'](handleError(_0x5e3ab4,null));};exports['getMessages']=function(_0x2a0335,_0x123c57){var _0x119c5e={'raw':![],'where':{}};var _0x5bffa9={};var _0x4a453e={'count':0x0,'rows':[]};return db[_0x4e53('0x23')][_0x4e53('0x40')]({'where':{'id':_0x2a0335[_0x4e53('0x3b')]['id']}})[_0x4e53('0x1c')](handleEntityNotFound(_0x123c57,null))[_0x4e53('0x1c')](function(_0x451470){if(_0x451470){_0x5bffa9[_0x4e53('0x31')]=_[_0x4e53('0x2e')](db[_0x4e53('0x3d')][_0x4e53('0x24')]);_0x5bffa9[_0x4e53('0x2a')]=_[_0x4e53('0x2e')](_0x2a0335[_0x4e53('0x2a')]);_0x5bffa9[_0x4e53('0x2f')]=_[_0x4e53('0x30')](_0x5bffa9[_0x4e53('0x31')],_0x5bffa9['query']);_0x119c5e[_0x4e53('0x32')]=_['intersection'](_0x5bffa9[_0x4e53('0x31')],qs[_0x4e53('0x33')](_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x33')]));_0x119c5e[_0x4e53('0x32')]=_0x119c5e[_0x4e53('0x32')][_0x4e53('0x41')]?_0x119c5e[_0x4e53('0x32')]:_0x5bffa9[_0x4e53('0x31')];if(!_0x2a0335[_0x4e53('0x2a')]['hasOwnProperty']('nolimit')){_0x119c5e[_0x4e53('0x16')]=qs[_0x4e53('0x16')](_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x16')]);_0x119c5e[_0x4e53('0x18')]=qs[_0x4e53('0x18')](_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x18')]);}_0x119c5e[_0x4e53('0x42')]=qs[_0x4e53('0x43')](_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x43')]);_0x119c5e['where']=qs['filters'](_[_0x4e53('0x44')](_0x2a0335[_0x4e53('0x2a')],_0x5bffa9['filters']));_0x119c5e['where'][_0x4e53('0x45')]=_0x451470['id'];if(_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x46')]){_0x119c5e[_0x4e53('0x47')]=_[_0x4e53('0x36')](_0x119c5e['where'],{'$or':_['map'](_0x119c5e['attributes'],function(_0x7df7e9){var _0x4080a6={};_0x4080a6[_0x7df7e9]={'$like':'%'+_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x46')]+'%'};return _0x4080a6;})});}if(_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x48')]){var _0x2ec693=_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x48')][_0x4e53('0x49')](',');var _0xdafad4={};_0xdafad4[_0x2ec693[0x0]]={'$gte':moment(_0x2ec693[0x1])[_0x4e53('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x119c5e[_0x4e53('0x47')]=_[_0x4e53('0x36')](_0x119c5e[_0x4e53('0x47')],_0xdafad4);}_0x119c5e=_[_0x4e53('0x36')]({},_0x119c5e,_0x2a0335[_0x4e53('0x37')]);return db[_0x4e53('0x3d')][_0x4e53('0x17')]({'where':_0x119c5e[_0x4e53('0x47')]})[_0x4e53('0x1c')](function(_0x526813){_0x4a453e[_0x4e53('0x17')]=_0x526813;if(_0x2a0335[_0x4e53('0x2a')][_0x4e53('0x34')]){_0x119c5e[_0x4e53('0x35')]=[{'all':!![]}];}return db[_0x4e53('0x3d')][_0x4e53('0x4b')](_0x119c5e);})[_0x4e53('0x1c')](function(_0xf5d0b7){_0x4a453e[_0x4e53('0x4c')]=_0xf5d0b7;return _0x4a453e;});}})[_0x4e53('0x1c')](respondWithFilteredResult(_0x123c57,_0x119c5e))['catch'](handleError(_0x123c57,null));};exports[_0x4e53('0x4d')]=function(_0x39a86d,_0x1891ab){return db[_0x4e53('0x23')]['find']({'where':{'id':_0x39a86d[_0x4e53('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1891ab,null))['then'](function(_0x2658fc){if(_0x2658fc){return _0x2658fc[_0x4e53('0x4e')](_0x39a86d[_0x4e53('0x3a')][_0x4e53('0x3e')],_['omit'](_0x39a86d['body'],[_0x4e53('0x3e'),'id'])||{})[_0x4e53('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0x4e53('0x20'),_0x4e53('0x50')],'where':{'id':_0x39a86d[_0x4e53('0x3a')][_0x4e53('0x3e')]}});})['then'](function(_0x16c75b){socket['emit'](_0x4e53('0x51'),{'id':Number(_0x39a86d[_0x4e53('0x3b')]['id']),'tags':_0x16c75b||[]});return{'id':Number(_0x39a86d[_0x4e53('0x3b')]['id']),'tags':_0x16c75b||[]};});}})[_0x4e53('0x1c')](respondWithResult(_0x1891ab,null))['catch'](handleError(_0x1891ab,null));};exports['removeTags']=function(_0x3fdd5e,_0x1c1639){return db['WhatsappInteraction'][_0x4e53('0x38')]({'where':{'id':_0x3fdd5e[_0x4e53('0x3b')]['id']}})[_0x4e53('0x1c')](handleEntityNotFound(_0x1c1639,null))['then'](function(_0x54c83c){if(_0x54c83c){return _0x54c83c[_0x4e53('0x52')](_0x3fdd5e['query'][_0x4e53('0x3e')]);}})[_0x4e53('0x1c')](respondWithStatusCode(_0x1c1639,null))[_0x4e53('0x2c')](handleError(_0x1c1639,null));};exports['download']=function(_0x5004a0,_0x47abe1){var _0x3f995f=moment()[_0x4e53('0x53')]()[_0x4e53('0x54')]();var _0xfea87e=path[_0x4e53('0x55')](config[_0x4e53('0x56')],_0x4e53('0x57'),_0x4e53('0x58'),_0x4e53('0x59'));var _0x5634c6=path[_0x4e53('0x55')](config[_0x4e53('0x56')],_0x4e53('0x57'),_0x4e53('0x58'),_0x4e53('0x5a'));var _0x2e422f=path[_0x4e53('0x55')](_0xfea87e,_0x3f995f);var _0x2764e0=util['format'](_0x4e53('0x5b'),_0x5004a0[_0x4e53('0x3b')]['id'],_0x3f995f);var _0x4840e0=path[_0x4e53('0x55')](_0xfea87e,_0x2764e0);var _0xaf2979=[];_0xaf2979[_0x4e53('0x5c')]({'model':db[_0x4e53('0x5d')],'as':'User','attributes':['id',_0x4e53('0x5e')],'raw':!![]});_0xaf2979['push']({'model':db[_0x4e53('0x5f')],'as':_0x4e53('0x60'),'attributes':['id',_0x4e53('0x61'),_0x4e53('0x62')],'raw':!![]});if(_0x5004a0[_0x4e53('0x2a')][_0x4e53('0x5a')]){_0xaf2979[_0x4e53('0x5c')]({'model':db[_0x4e53('0x63')],'as':_0x4e53('0x63'),'raw':!![]});}var _0x5dd74c=[{'model':db[_0x4e53('0x3d')],'as':_0x4e53('0x64'),'attributes':['id',_0x4e53('0x3a'),_0x4e53('0x65'),_0x4e53('0x66'),_0x4e53('0x67'),'read'],'include':_0xaf2979}];_0x5dd74c['push']({'model':db[_0x4e53('0x68')],'as':_0x4e53('0x69'),'attributes':['id','name']});_0x5dd74c[_0x4e53('0x5c')]({'model':db[_0x4e53('0x5d')],'as':_0x4e53('0x6a'),'attributes':['id',_0x4e53('0x5e')]});return db['WhatsappInteraction'][_0x4e53('0x38')]({'where':{'id':_0x5004a0['params']['id']},'include':_0x5dd74c})['then'](handleEntityNotFound(_0x47abe1,null))[_0x4e53('0x1c')](function(_0xb64c2b){if(_0xb64c2b){var _0x37d69b=_0xb64c2b[_0x4e53('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x2e422f);var _0xf071b6={'channel':_0x4e53('0x6c'),'account':_0x37d69b[_0x4e53('0x69')][_0x4e53('0x20')],'agent':_0x37d69b[_0x4e53('0x6a')]?_0x37d69b[_0x4e53('0x6a')][_0x4e53('0x5e')]:'N.A.','createdAt':moment(_0x37d69b[_0x4e53('0x65')])[_0x4e53('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x37d69b['closed']?moment(_0x37d69b[_0x4e53('0x6d')])['format'](_0x4e53('0x6e'))[_0x4e53('0x54')]():'','disposition':_0x37d69b[_0x4e53('0x6f')],'messages':_(_0x37d69b[_0x4e53('0x64')])['filter']({'secret':![]})[_0x4e53('0x22')](function(_0x1257ca){if(_0x1257ca[_0x4e53('0x63')]){var _0x1e77e3=path[_0x4e53('0x55')](_0x5634c6,_0x1257ca['Attachment'][_0x4e53('0x70')]);if(fs[_0x4e53('0x71')](_0x1e77e3)){fs[_0x4e53('0x72')](_0x1e77e3)[_0x4e53('0x73')](fs[_0x4e53('0x74')](path[_0x4e53('0x55')](_0x2e422f,_0x1257ca[_0x4e53('0x63')][_0x4e53('0x70')])));}}return{'date':moment(_0x1257ca[_0x4e53('0x65')])[_0x4e53('0x4a')](_0x4e53('0x6e'))[_0x4e53('0x54')](),'sender':_0x1257ca[_0x4e53('0x66')]==='out'?_0x1257ca[_0x4e53('0x5d')]?_0x1257ca[_0x4e53('0x5d')][_0x4e53('0x5e')]:_0x4e53('0x75'):_0x1257ca[_0x4e53('0x60')]['firstName']+(_0x1257ca[_0x4e53('0x60')]['lastName']?'\x20'+_0x1257ca[_0x4e53('0x60')][_0x4e53('0x62')]:''),'body':_0x1257ca['Attachment']?_0x1257ca[_0x4e53('0x63')][_0x4e53('0x70')]:_0x1257ca[_0x4e53('0x3a')],'direction':_0x1257ca[_0x4e53('0x66')]===_0x4e53('0x76')?'A':'C','secret':_0x1257ca[_0x4e53('0x67')],'read':_0x1257ca['read'],'attachment':_0x1257ca['Attachment']};})[_0x4e53('0x77')]()};return ejs[_0x4e53('0x78')](path['join'](config[_0x4e53('0x56')],_0x4e53('0x57'),_0x4e53('0x79'),'downloadInteraction.ejs'),{'interaction':_0xf071b6})[_0x4e53('0x1c')](function(_0x51146d){var _0x3a9c53=path['join'](_0x2e422f,_0x4e53('0x7a')+_0x37d69b['id']+'-'+_0x3f995f+_0x4e53('0x7b'));var _0x19ca08={'path':_0x3a9c53,'channel':_0x4e53('0x6c'),'interactionId':_0x37d69b['id']};return pdf['createPdfFromHTML'](_0x51146d,_0x19ca08);})[_0x4e53('0x1c')](function(){return new BPromise(function(_0x3655db,_0x42322b){zipdir(_0x2e422f,{'saveTo':_0x4840e0},function(_0x3aa483,_0x44a93e){if(_0x3aa483)return _0x42322b(_0x3aa483);return _0x3655db(_0x44a93e);});})['then'](function(){return new BPromise(function(_0x4f7f78,_0x43cfce){rimraf(_0x2e422f,function(_0x476889){if(_0x476889)_0x43cfce(_0x476889);return _0x4f7f78();});});})[_0x4e53('0x1c')](function(){return _0x47abe1[_0x4e53('0x7c')](_0x4840e0,_0x2764e0,function(_0x1a8071){if(_0x1a8071){console['log'](_0x4e53('0x7d'),_0x1a8071);}else{fs['unlinkSync'](_0x4840e0);}});});});}else{return _0x47abe1['sendStatus'](0xc8);}})[_0x4e53('0x2c')](handleError(_0x47abe1,null));}; \ No newline at end of file +var _0xb793=['length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','Contact','firstName','lastName','Attachment','createdAt','direction','read','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','format','closed','disposition','Messages','basename','pipe','createWriteStream','System','out','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','then','catch','show','params','keys','filters','intersection','model','fields','attributes'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xb793,0x1d2));var _0x3b79=function(_0x1195f8,_0x22dadc){_0x1195f8=_0x1195f8-0x0;var _0x36629b=_0xb793[_0x1195f8];return _0x36629b;};'use strict';var rimraf=require(_0x3b79('0x0'));var zipdir=require(_0x3b79('0x1'));var moment=require(_0x3b79('0x2'));var BPromise=require(_0x3b79('0x3'));var util=require(_0x3b79('0x4'));var path=require(_0x3b79('0x5'));var ejs=require(_0x3b79('0x6'));var fs=require('fs');var _=require(_0x3b79('0x7'));var Redis=require(_0x3b79('0x8'));var interaction=require(_0x3b79('0x9'));var qs=require(_0x3b79('0xa'));var pdf=require(_0x3b79('0xb'));var logger=require(_0x3b79('0xc'))(_0x3b79('0xd'));var config=require(_0x3b79('0xe'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b79('0xf'))(new Redis(config[_0x3b79('0x10')]));require(_0x3b79('0x11'))[_0x3b79('0x12')](socket);function respondWithStatusCode(_0x42a0a1,_0x26c599){_0x26c599=_0x26c599||0xcc;return function(_0x36b24f){if(_0x36b24f){return _0x42a0a1[_0x3b79('0x13')](_0x26c599);}return _0x42a0a1[_0x3b79('0x14')](_0x26c599)['end']();};}function respondWithResult(_0x872811,_0x365fbc){_0x365fbc=_0x365fbc||0xc8;return function(_0x738474){if(_0x738474){return _0x872811['status'](_0x365fbc)[_0x3b79('0x15')](_0x738474);}};}function respondWithFilteredResult(_0x1b4654,_0x48ae2e){return function(_0x21985e){if(_0x21985e){var _0x354a3d=typeof _0x48ae2e[_0x3b79('0x16')]===_0x3b79('0x17')&&typeof _0x48ae2e['limit']===_0x3b79('0x17');var _0x394ef3=_0x21985e[_0x3b79('0x18')];var _0x40576c=_0x354a3d?0x0:_0x48ae2e['offset'];var _0x38c269=_0x354a3d?_0x21985e[_0x3b79('0x18')]:_0x48ae2e[_0x3b79('0x16')]+_0x48ae2e[_0x3b79('0x19')];var _0x55bac5;if(_0x38c269>=_0x394ef3){_0x38c269=_0x394ef3;_0x55bac5=0xc8;}else{_0x55bac5=0xce;}_0x1b4654['status'](_0x55bac5);return _0x1b4654[_0x3b79('0x1a')](_0x3b79('0x1b'),_0x40576c+'-'+_0x38c269+'/'+_0x394ef3)[_0x3b79('0x15')](_0x21985e);}return null;};}function saveUpdates(_0x6d029c){return function(_0x10ab7d){if(_0x10ab7d){return _0x10ab7d[_0x3b79('0x1c')](_0x6d029c)['then'](function(_0x219bd3){return _0x219bd3;});}return null;};}function removeEntity(_0x2344a0){return function(_0x4ee633){if(_0x4ee633){return _0x4ee633[_0x3b79('0x1d')]()['then'](function(){_0x2344a0['status'](0xcc)[_0x3b79('0x1e')]();});}};}function handleEntityNotFound(_0x12c669){return function(_0x1b38d4){if(!_0x1b38d4){_0x12c669[_0x3b79('0x13')](0x194);}return _0x1b38d4;};}function handleError(_0x4f18e7,_0x5a6cb1){_0x5a6cb1=_0x5a6cb1||0x1f4;return function(_0x3b4fed){logger[_0x3b79('0x1f')](_0x3b4fed['stack']);if(_0x3b4fed[_0x3b79('0x20')]){delete _0x3b4fed[_0x3b79('0x20')];}_0x4f18e7[_0x3b79('0x14')](_0x5a6cb1)[_0x3b79('0x21')](_0x3b4fed);};}exports[_0x3b79('0x22')]=function(_0x4cd5ac,_0x4754ca){var _0x310ae8={};var _0x4b2b0e=_[_0x3b79('0x23')](db[_0x3b79('0x24')][_0x3b79('0x25')],function(_0x1a247e){return{'name':_0x1a247e[_0x3b79('0x26')],'type':_0x1a247e['type'][_0x3b79('0x27')]};});_0x310ae8=qs[_0x3b79('0x28')](_0x4b2b0e,_0x4cd5ac);return interaction[_0x3b79('0x29')](_0x3b79('0x2a'),_0x4cd5ac[_0x3b79('0x2b')],_0x4cd5ac['user'],_0x310ae8,_0x4b2b0e)[_0x3b79('0x2c')](respondWithFilteredResult(_0x4754ca,_0x310ae8))[_0x3b79('0x2d')](handleError(_0x4754ca,null));};exports[_0x3b79('0x2e')]=function(_0x29a933,_0x33e519){var _0x539b8c={'raw':![],'where':{'id':_0x29a933[_0x3b79('0x2f')]['id']}},_0x4e4ac9={};_0x4e4ac9['model']=_[_0x3b79('0x30')](db['WhatsappInteraction'][_0x3b79('0x25')]);_0x4e4ac9[_0x3b79('0x2b')]=_[_0x3b79('0x30')](_0x29a933[_0x3b79('0x2b')]);_0x4e4ac9[_0x3b79('0x31')]=_[_0x3b79('0x32')](_0x4e4ac9[_0x3b79('0x33')],_0x4e4ac9['query']);_0x539b8c['attributes']=_[_0x3b79('0x32')](_0x4e4ac9['model'],qs[_0x3b79('0x34')](_0x29a933[_0x3b79('0x2b')][_0x3b79('0x34')]));_0x539b8c['attributes']=_0x539b8c[_0x3b79('0x35')][_0x3b79('0x36')]?_0x539b8c[_0x3b79('0x35')]:_0x4e4ac9[_0x3b79('0x33')];if(_0x29a933[_0x3b79('0x2b')][_0x3b79('0x37')]){_0x539b8c[_0x3b79('0x38')]=[{'all':!![]}];}_0x539b8c=_[_0x3b79('0x39')]({},_0x539b8c,_0x29a933[_0x3b79('0x3a')]);return db[_0x3b79('0x24')][_0x3b79('0x3b')](_0x539b8c)['then'](handleEntityNotFound(_0x33e519,null))[_0x3b79('0x2c')](respondWithResult(_0x33e519,null))['catch'](handleError(_0x33e519,null));};exports['create']=function(_0x30f3b2,_0x448cec){return db[_0x3b79('0x24')][_0x3b79('0x3c')](_0x30f3b2[_0x3b79('0x3d')],{})[_0x3b79('0x2c')](respondWithResult(_0x448cec,0xc9))[_0x3b79('0x2d')](handleError(_0x448cec,null));};exports[_0x3b79('0x1c')]=function(_0x251b5f,_0x15acb6){if(_0x251b5f['body']['id']){delete _0x251b5f[_0x3b79('0x3d')]['id'];}return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x251b5f[_0x3b79('0x2f')]['id']}})['then'](handleEntityNotFound(_0x15acb6,null))[_0x3b79('0x2c')](saveUpdates(_0x251b5f['body'],null))[_0x3b79('0x2c')](respondWithResult(_0x15acb6,null))[_0x3b79('0x2d')](handleError(_0x15acb6,null));};exports['destroy']=function(_0x4e0bb5,_0x59b8d3){return db[_0x3b79('0x24')]['find']({'where':{'id':_0x4e0bb5[_0x3b79('0x2f')]['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x59b8d3,null))[_0x3b79('0x2c')](removeEntity(_0x59b8d3,null))[_0x3b79('0x2d')](handleError(_0x59b8d3,null));};exports[_0x3b79('0x3e')]=function(_0x52aaae,_0x3d7b66){return db[_0x3b79('0x24')]['describe']()[_0x3b79('0x2c')](respondWithResult(_0x3d7b66,null))[_0x3b79('0x2d')](handleError(_0x3d7b66,null));};exports[_0x3b79('0x3f')]=function(_0x36fb79,_0x448d6e){return db['WhatsappMessage'][_0x3b79('0x3b')]({'where':{'id':_0x36fb79[_0x3b79('0x2f')]['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x448d6e,null))[_0x3b79('0x2c')](function(_0x5cf9c8){if(_0x5cf9c8){return _0x5cf9c8[_0x3b79('0x3f')](_0x36fb79['body'][_0x3b79('0x40')],_[_0x3b79('0x41')](_0x36fb79[_0x3b79('0x3d')],[_0x3b79('0x40'),'id'])||{});}})['then'](respondWithResult(_0x448d6e,null))[_0x3b79('0x2d')](handleError(_0x448d6e,null));};exports[_0x3b79('0x42')]=function(_0xa199c4,_0x413098){var _0x356ba1={'raw':![],'where':{}};var _0x3ad51f={};var _0xce0f0f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3b79('0x43')]({'where':{'id':_0xa199c4['params']['id']}})['then'](handleEntityNotFound(_0x413098,null))[_0x3b79('0x2c')](function(_0x39cfcf){if(_0x39cfcf){_0x3ad51f[_0x3b79('0x33')]=_[_0x3b79('0x30')](db[_0x3b79('0x44')][_0x3b79('0x25')]);_0x3ad51f[_0x3b79('0x2b')]=_[_0x3b79('0x30')](_0xa199c4[_0x3b79('0x2b')]);_0x3ad51f['filters']=_[_0x3b79('0x32')](_0x3ad51f[_0x3b79('0x33')],_0x3ad51f['query']);_0x356ba1[_0x3b79('0x35')]=_['intersection'](_0x3ad51f[_0x3b79('0x33')],qs[_0x3b79('0x34')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x34')]));_0x356ba1[_0x3b79('0x35')]=_0x356ba1[_0x3b79('0x35')]['length']?_0x356ba1['attributes']:_0x3ad51f[_0x3b79('0x33')];if(!_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x45')](_0x3b79('0x46'))){_0x356ba1[_0x3b79('0x19')]=qs[_0x3b79('0x19')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x19')]);_0x356ba1[_0x3b79('0x16')]=qs[_0x3b79('0x16')](_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x16')]);}_0x356ba1[_0x3b79('0x47')]=qs[_0x3b79('0x48')](_0xa199c4[_0x3b79('0x2b')]['sort']);_0x356ba1[_0x3b79('0x49')]=qs[_0x3b79('0x31')](_[_0x3b79('0x4a')](_0xa199c4[_0x3b79('0x2b')],_0x3ad51f[_0x3b79('0x31')]));_0x356ba1[_0x3b79('0x49')][_0x3b79('0x4b')]=_0x39cfcf['id'];if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4c')]){_0x356ba1[_0x3b79('0x49')]=_['merge'](_0x356ba1['where'],{'$or':_[_0x3b79('0x23')](_0x356ba1[_0x3b79('0x35')],function(_0x1ee1ce){var _0x4a8f1d={};_0x4a8f1d[_0x1ee1ce]={'$like':'%'+_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4c')]+'%'};return _0x4a8f1d;})});}if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x4d')]){var _0x3a80ff=_0xa199c4[_0x3b79('0x2b')]['$gte'][_0x3b79('0x4e')](',');var _0x41d58c={};_0x41d58c[_0x3a80ff[0x0]]={'$gte':moment(_0x3a80ff[0x1])['format'](_0x3b79('0x4f'))};_0x356ba1['where']=_[_0x3b79('0x39')](_0x356ba1[_0x3b79('0x49')],_0x41d58c);}_0x356ba1=_[_0x3b79('0x39')]({},_0x356ba1,_0xa199c4[_0x3b79('0x3a')]);return db['WhatsappMessage'][_0x3b79('0x18')]({'where':_0x356ba1[_0x3b79('0x49')]})[_0x3b79('0x2c')](function(_0x7b7213){_0xce0f0f[_0x3b79('0x18')]=_0x7b7213;if(_0xa199c4[_0x3b79('0x2b')][_0x3b79('0x37')]){_0x356ba1[_0x3b79('0x38')]=[{'all':!![]}];}return db[_0x3b79('0x44')]['findAll'](_0x356ba1);})[_0x3b79('0x2c')](function(_0x3f1fba){_0xce0f0f[_0x3b79('0x50')]=_0x3f1fba;return _0xce0f0f;});}})[_0x3b79('0x2c')](respondWithFilteredResult(_0x413098,_0x356ba1))[_0x3b79('0x2d')](handleError(_0x413098,null));};exports[_0x3b79('0x51')]=function(_0x2cb615,_0x358431){return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x2cb615['params']['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x358431,null))[_0x3b79('0x2c')](function(_0x5e67ad){if(_0x5e67ad){return _0x5e67ad[_0x3b79('0x52')](_0x2cb615['body']['ids'],_['omit'](_0x2cb615['body'],[_0x3b79('0x40'),'id'])||{})[_0x3b79('0x53')](function(){return db[_0x3b79('0x54')][_0x3b79('0x29')]({'attributes':['id',_0x3b79('0x20'),_0x3b79('0x55')],'where':{'id':_0x2cb615[_0x3b79('0x3d')][_0x3b79('0x40')]}});})[_0x3b79('0x2c')](function(_0x5ca909){socket[_0x3b79('0x56')]('whatsappInteractionTags:save',{'id':Number(_0x2cb615['params']['id']),'tags':_0x5ca909||[]});return{'id':Number(_0x2cb615[_0x3b79('0x2f')]['id']),'tags':_0x5ca909||[]};});}})[_0x3b79('0x2c')](respondWithResult(_0x358431,null))['catch'](handleError(_0x358431,null));};exports[_0x3b79('0x57')]=function(_0x8f8878,_0x2158f3){return db['WhatsappInteraction'][_0x3b79('0x3b')]({'where':{'id':_0x8f8878['params']['id']}})[_0x3b79('0x2c')](handleEntityNotFound(_0x2158f3,null))['then'](function(_0x4f1498){if(_0x4f1498){return _0x4f1498['removeTags'](_0x8f8878[_0x3b79('0x2b')][_0x3b79('0x40')]);}})[_0x3b79('0x2c')](respondWithStatusCode(_0x2158f3,null))[_0x3b79('0x2d')](handleError(_0x2158f3,null));};exports['download']=function(_0x3dd50d,_0x7d1ec8){var _0x1204b0=moment()[_0x3b79('0x58')]()[_0x3b79('0x59')]();var _0x1fa711=path[_0x3b79('0x5a')](config[_0x3b79('0x5b')],_0x3b79('0x5c'),_0x3b79('0x5d'),_0x3b79('0x5e'));var _0x304487=path['join'](config[_0x3b79('0x5b')],_0x3b79('0x5c'),_0x3b79('0x5d'),_0x3b79('0x5f'));var _0x278751=path[_0x3b79('0x5a')](_0x1fa711,_0x1204b0);var _0x3a97b0=util['format'](_0x3b79('0x60'),_0x3dd50d['params']['id'],_0x1204b0);var _0x4ca1c6=path[_0x3b79('0x5a')](_0x1fa711,_0x3a97b0);var _0x33c187=[];_0x33c187['push']({'model':db[_0x3b79('0x61')],'as':_0x3b79('0x61'),'attributes':['id','fullname'],'raw':!![]});_0x33c187[_0x3b79('0x62')]({'model':db['CmContact'],'as':_0x3b79('0x63'),'attributes':['id',_0x3b79('0x64'),_0x3b79('0x65')],'raw':!![]});if(_0x3dd50d[_0x3b79('0x2b')][_0x3b79('0x5f')]){_0x33c187['push']({'model':db['Attachment'],'as':_0x3b79('0x66'),'raw':!![]});}var _0x2c34a2=[{'model':db[_0x3b79('0x44')],'as':'Messages','attributes':['id',_0x3b79('0x3d'),_0x3b79('0x67'),_0x3b79('0x68'),'secret',_0x3b79('0x69')],'include':_0x33c187}];_0x2c34a2[_0x3b79('0x62')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x3b79('0x20')]});_0x2c34a2[_0x3b79('0x62')]({'model':db[_0x3b79('0x61')],'as':_0x3b79('0x6a'),'attributes':['id',_0x3b79('0x6b')]});return db[_0x3b79('0x24')][_0x3b79('0x3b')]({'where':{'id':_0x3dd50d[_0x3b79('0x2f')]['id']},'include':_0x2c34a2})[_0x3b79('0x2c')](handleEntityNotFound(_0x7d1ec8,null))[_0x3b79('0x2c')](function(_0x1285d4){if(_0x1285d4){var _0x4daec6=_0x1285d4[_0x3b79('0x6c')]({'plain':!![]});fs[_0x3b79('0x6d')](_0x278751);var _0x3d7681={'channel':_0x3b79('0x6e'),'account':_0x4daec6[_0x3b79('0x6f')][_0x3b79('0x20')],'agent':_0x4daec6['Owner']?_0x4daec6[_0x3b79('0x6a')]['fullname']:_0x3b79('0x70'),'createdAt':moment(_0x4daec6[_0x3b79('0x67')])[_0x3b79('0x71')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b79('0x59')](),'closedAt':_0x4daec6[_0x3b79('0x72')]?moment(_0x4daec6['closedAt'])['format'](_0x3b79('0x4f'))['toString']():'','disposition':_0x4daec6[_0x3b79('0x73')],'messages':_(_0x4daec6[_0x3b79('0x74')])[_0x3b79('0x4c')]({'secret':![]})[_0x3b79('0x23')](function(_0x18120d){if(_0x18120d[_0x3b79('0x66')]){var _0x388d24=path['join'](_0x304487,_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')]);if(fs['existsSync'](_0x388d24)){fs['createReadStream'](_0x388d24)[_0x3b79('0x76')](fs[_0x3b79('0x77')](path['join'](_0x278751,_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')])));}}return{'date':moment(_0x18120d[_0x3b79('0x67')])[_0x3b79('0x71')](_0x3b79('0x4f'))[_0x3b79('0x59')](),'sender':_0x18120d[_0x3b79('0x68')]==='out'?_0x18120d[_0x3b79('0x61')]?_0x18120d[_0x3b79('0x61')][_0x3b79('0x6b')]:_0x3b79('0x78'):_0x18120d['Contact'][_0x3b79('0x64')]+(_0x18120d[_0x3b79('0x63')][_0x3b79('0x65')]?'\x20'+_0x18120d[_0x3b79('0x63')]['lastName']:''),'body':_0x18120d[_0x3b79('0x66')]?_0x18120d[_0x3b79('0x66')][_0x3b79('0x75')]:_0x18120d[_0x3b79('0x3d')],'direction':_0x18120d['direction']===_0x3b79('0x79')?'A':'C','secret':_0x18120d[_0x3b79('0x7a')],'read':_0x18120d[_0x3b79('0x69')],'attachment':_0x18120d[_0x3b79('0x66')]};})[_0x3b79('0x7b')]()};return ejs[_0x3b79('0x7c')](path[_0x3b79('0x5a')](config[_0x3b79('0x5b')],'server',_0x3b79('0x7d'),_0x3b79('0x7e')),{'interaction':_0x3d7681})[_0x3b79('0x2c')](function(_0x456f3b){var _0x534e96=path[_0x3b79('0x5a')](_0x278751,_0x3b79('0x7f')+_0x4daec6['id']+'-'+_0x1204b0+'.pdf');var _0x1ddd37={'path':_0x534e96,'channel':'Whatsapp','interactionId':_0x4daec6['id']};return pdf[_0x3b79('0x80')](_0x456f3b,_0x1ddd37);})[_0x3b79('0x2c')](function(){return new BPromise(function(_0x5420bd,_0x363720){zipdir(_0x278751,{'saveTo':_0x4ca1c6},function(_0x1f68ef,_0x4e6e5){if(_0x1f68ef)return _0x363720(_0x1f68ef);return _0x5420bd(_0x4e6e5);});})[_0x3b79('0x2c')](function(){return new BPromise(function(_0x4c5450,_0x260f0f){rimraf(_0x278751,function(_0x4d1007){if(_0x4d1007)_0x260f0f(_0x4d1007);return _0x4c5450();});});})[_0x3b79('0x2c')](function(){return _0x7d1ec8['download'](_0x4ca1c6,_0x3a97b0,function(_0x25715e){if(_0x25715e){console['log']('err',_0x25715e);}else{fs[_0x3b79('0x81')](_0x4ca1c6);}});});});}else{return _0x7d1ec8[_0x3b79('0x13')](0xc8);}})[_0x3b79('0x2d')](handleError(_0x7d1ec8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 73b1289..6a5e7d1 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 _0xb0d9=['setMaxListeners','update','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x41799b,_0x3f6360){_0x41799b=_0x41799b-0x0;var _0x50d7c7=_0xb0d9[_0x41799b];return _0x50d7c7;};'use strict';var EventEmitter=require(_0x9b0d('0x0'));var WhatsappInteraction=require(_0x9b0d('0x1'))['db'][_0x9b0d('0x2')];var WhatsappMessage=require(_0x9b0d('0x1'))['db'][_0x9b0d('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9b0d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b0d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d327a){return function(_0x587535,_0x389816,_0x3994a1){_0x587535[_0x9b0d('0x6')]({'attributes':['id'],'raw':!![]})[_0x9b0d('0x7')](function(_0x2c519d){_0x587535[_0x9b0d('0x8')](_0x9b0d('0x9'),_0x2c519d[_0x9b0d('0xa')](function(_0x3152da){return{'id':_0x3152da['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x587535['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x193597){_0x587535[_0x9b0d('0x8')]('unreadMessages',_0x193597[_0x9b0d('0xb')]);WhatsappInteractionEvents[_0x9b0d('0xc')](_0x4d327a+':'+_0x587535['id'],_0x587535);WhatsappInteractionEvents['emit'](_0x4d327a,_0x587535);_0x3994a1(null);})[_0x9b0d('0xd')](_0x3994a1(null));};}for(var e in events){if(events[_0x9b0d('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x9b0d('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xcc73=['unreadMessages','length','emit','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','update','getUsers','then','setDataValue','Users','map'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xcc73[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x3cc7('0x0'))['db'][_0x3cc7('0x1')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3cc7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3cc7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5de4be){return function(_0x3c87d4,_0xd060f7,_0x1ccad1){_0x3c87d4[_0x3cc7('0x4')]({'attributes':['id'],'raw':!![]})[_0x3cc7('0x5')](function(_0x5604df){_0x3c87d4[_0x3cc7('0x6')](_0x3cc7('0x7'),_0x5604df[_0x3cc7('0x8')](function(_0x26aa1a){return{'id':_0x26aa1a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3c87d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3cc7('0x5')](function(_0x44005b){_0x3c87d4[_0x3cc7('0x6')](_0x3cc7('0x9'),_0x44005b[_0x3cc7('0xa')]);WhatsappInteractionEvents[_0x3cc7('0xb')](_0x5de4be+':'+_0x3c87d4['id'],_0x3c87d4);WhatsappInteractionEvents[_0x3cc7('0xb')](_0x5de4be,_0x3c87d4);_0x1ccad1(null);})['catch'](_0x1ccad1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x3cc7('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 51b43e4..3ac9587 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 _0x7cbd=['./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xe2049f,_0x4f487e){var _0x409298=function(_0x3c46cc){while(--_0x3c46cc){_0xe2049f['push'](_0xe2049f['shift']());}};_0x409298(++_0x4f487e);}(_0x7cbd,0xb9));var _0xd7cb=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7cbd[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xd7cb('0x0'));var util=require(_0xd7cb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd7cb('0x2'));var BPromise=require(_0xd7cb('0x3'));var rp=require(_0xd7cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7cb('0x5'));var config=require(_0xd7cb('0x6'));var attributes=require(_0xd7cb('0x7'));module['exports']=function(_0x56417a,_0x54c7b3){return _0x56417a[_0xd7cb('0x8')](_0xd7cb('0x9'),attributes,{'tableName':_0xd7cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2087a5,_0x45ca00,_0x5d11d6){if(_0x2087a5[_0xd7cb('0xb')](_0xd7cb('0xc'))){_0x2087a5[_0xd7cb('0xd')]=moment()[_0xd7cb('0xe')](_0xd7cb('0xf'));}_0x5d11d6(null,_0x2087a5);}}});}; \ No newline at end of file +var _0x76d8=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format'];(function(_0x2b8a4e,_0x5bad23){var _0x28cb72=function(_0x318e7e){while(--_0x318e7e){_0x2b8a4e['push'](_0x2b8a4e['shift']());}};_0x28cb72(++_0x5bad23);}(_0x76d8,0xbc));var _0x876d=function(_0x29bedf,_0x3e6957){_0x29bedf=_0x29bedf-0x0;var _0xa73d4b=_0x76d8[_0x29bedf];return _0xa73d4b;};'use strict';var _=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var logger=require(_0x876d('0x2'))(_0x876d('0x3'));var moment=require('moment');var BPromise=require(_0x876d('0x4'));var rp=require(_0x876d('0x5'));var fs=require('fs');var path=require(_0x876d('0x6'));var rimraf=require(_0x876d('0x7'));var config=require('../../config/environment');var attributes=require(_0x876d('0x8'));module[_0x876d('0x9')]=function(_0x306ff2,_0x3ae91f){return _0x306ff2[_0x876d('0xa')](_0x876d('0xb'),attributes,{'tableName':_0x876d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e3942,_0x1e8bf5,_0x17b685){if(_0x3e3942[_0x876d('0xd')](_0x876d('0xe'))){_0x3e3942['closedAt']=moment()[_0x876d('0xf')](_0x876d('0x10'));}_0x17b685(null,_0x3e3942);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 721d066..0105140 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 _0xcb34=['ids','omit','spread','AddTags','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','debug','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','update','options','raw','where','attributes','limit','stringify','WhatsappInteraction','find','then','body'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xcb34,0x1e5));var _0x4cb3=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xcb34[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0x4cb3('0x0'));var util=require(_0x4cb3('0x1'));var moment=require('moment');var BPromise=require(_0x4cb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cb3('0x3'))['db'];var utils=require(_0x4cb3('0x4'));var logger=require(_0x4cb3('0x5'))(_0x4cb3('0x6'));var config=require(_0x4cb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4cb3('0x8')][_0x4cb3('0x9')]({'port':0x232a});config[_0x4cb3('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4cb3('0xb'))(new Redis(config[_0x4cb3('0xa')]));require(_0x4cb3('0xc'))[_0x4cb3('0xd')](socket);function respondWithRpcPromise(_0x341a40,_0x52272d,_0x5d132c){return new BPromise(function(_0x24cc12,_0x268b58){return client[_0x4cb3('0xe')](_0x341a40,_0x5d132c)['then'](function(_0x539897){logger[_0x4cb3('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x52272d,_0x4cb3('0x10'));logger[_0x4cb3('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x52272d,'request\x20sent',JSON['stringify'](_0x539897));if(_0x539897[_0x4cb3('0x12')]){if(_0x539897[_0x4cb3('0x12')][_0x4cb3('0x13')]===0x1f4){logger['error'](_0x4cb3('0x14'),_0x52272d,_0x539897[_0x4cb3('0x12')][_0x4cb3('0x15')]);return _0x268b58(_0x539897[_0x4cb3('0x12')]['message']);}logger[_0x4cb3('0x12')](_0x4cb3('0x14'),_0x52272d,_0x539897[_0x4cb3('0x12')][_0x4cb3('0x15')]);return _0x24cc12(_0x539897[_0x4cb3('0x12')][_0x4cb3('0x15')]);}else{logger[_0x4cb3('0xf')](_0x4cb3('0x14'),_0x52272d,_0x4cb3('0x10'));_0x24cc12(_0x539897[_0x4cb3('0x16')][_0x4cb3('0x15')]);}})['catch'](function(_0x141712){logger['error'](_0x4cb3('0x14'),_0x52272d,_0x141712);_0x268b58(_0x141712);});});}exports[_0x4cb3('0x17')]=function(_0x40cdf7){var _0x28644c=this;return new Promise(function(_0x2c5463,_0x5a4b55){return db['WhatsappInteraction'][_0x4cb3('0x18')](_0x40cdf7['body'],{'raw':_0x40cdf7[_0x4cb3('0x19')]?_0x40cdf7['options'][_0x4cb3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40cdf7['options']?_0x40cdf7[_0x4cb3('0x19')][_0x4cb3('0x1b')]||null:null,'attributes':_0x40cdf7[_0x4cb3('0x19')]?_0x40cdf7[_0x4cb3('0x19')][_0x4cb3('0x1c')]||null:null,'limit':_0x40cdf7['options']?_0x40cdf7[_0x4cb3('0x19')][_0x4cb3('0x1d')]||null:null})['then'](function(_0x118235){logger[_0x4cb3('0xf')](_0x4cb3('0x17'),_0x40cdf7);logger[_0x4cb3('0x11')](_0x4cb3('0x17'),_0x40cdf7,JSON[_0x4cb3('0x1e')](_0x118235));_0x2c5463(_0x118235);})['catch'](function(_0x2c0838){logger['error'](_0x4cb3('0x17'),_0x2c0838[_0x4cb3('0x15')],_0x40cdf7);_0x5a4b55(_0x28644c[_0x4cb3('0x12')](0x1f4,_0x2c0838[_0x4cb3('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x201527){return new Promise(function(_0x1a09c4,_0x235612){return db[_0x4cb3('0x1f')][_0x4cb3('0x20')]({'where':_0x201527['options']?_0x201527[_0x4cb3('0x19')][_0x4cb3('0x1b')]||null:null})[_0x4cb3('0x21')](function(_0x15b630){if(_0x15b630){return _0x15b630['addTags'](_0x201527[_0x4cb3('0x22')][_0x4cb3('0x23')],_[_0x4cb3('0x24')](_0x201527[_0x4cb3('0x22')],[_0x4cb3('0x23'),'id'])||{});}})[_0x4cb3('0x25')](function(_0x5a78e3){logger[_0x4cb3('0xf')](_0x4cb3('0x26'),_0x201527);logger[_0x4cb3('0x11')]('AddTags',_0x201527,JSON['stringify'](_0x5a78e3));_0x1a09c4(_0x5a78e3);})[_0x4cb3('0x27')](function(_0x42991d){logger['error']('AddTags',_0x42991d[_0x4cb3('0x15')],_0x201527);_0x235612(_this[_0x4cb3('0x12')](0x1f4,_0x42991d[_0x4cb3('0x15')]));});});}; \ No newline at end of file +var _0x8574=['update','body','options','raw','then','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction'];(function(_0x393b45,_0xca6983){var _0x50e652=function(_0xba738b){while(--_0xba738b){_0x393b45['push'](_0x393b45['shift']());}};_0x50e652(++_0xca6983);}(_0x8574,0xfd));var _0x4857=function(_0x271191,_0x3486bf){_0x271191=_0x271191-0x0;var _0x2765db=_0x8574[_0x271191];return _0x2765db;};'use strict';var _=require(_0x4857('0x0'));var util=require(_0x4857('0x1'));var moment=require(_0x4857('0x2'));var BPromise=require(_0x4857('0x3'));var rs=require(_0x4857('0x4'));var fs=require('fs');var Redis=require(_0x4857('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4857('0x6'));var logger=require(_0x4857('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4857('0x8')][_0x4857('0x9')]({'port':0x232a});config[_0x4857('0xa')]=_['defaults'](config[_0x4857('0xa')],{'host':_0x4857('0xb'),'port':0x18eb});var socket=require(_0x4857('0xc'))(new Redis(config[_0x4857('0xa')]));require(_0x4857('0xd'))[_0x4857('0xe')](socket);function respondWithRpcPromise(_0x429c46,_0xd8face,_0x28c836){return new BPromise(function(_0x2bd6ed,_0x4db0a6){return client[_0x4857('0xf')](_0x429c46,_0x28c836)['then'](function(_0x152ac4){logger[_0x4857('0x10')](_0x4857('0x11'),_0xd8face,_0x4857('0x12'));logger[_0x4857('0x13')](_0x4857('0x14'),_0xd8face,_0x4857('0x12'),JSON[_0x4857('0x15')](_0x152ac4));if(_0x152ac4[_0x4857('0x16')]){if(_0x152ac4[_0x4857('0x16')][_0x4857('0x17')]===0x1f4){logger[_0x4857('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xd8face,_0x152ac4['error'][_0x4857('0x18')]);return _0x4db0a6(_0x152ac4[_0x4857('0x16')]['message']);}logger['error'](_0x4857('0x11'),_0xd8face,_0x152ac4[_0x4857('0x16')][_0x4857('0x18')]);return _0x2bd6ed(_0x152ac4[_0x4857('0x16')][_0x4857('0x18')]);}else{logger[_0x4857('0x10')](_0x4857('0x11'),_0xd8face,_0x4857('0x12'));_0x2bd6ed(_0x152ac4['result'][_0x4857('0x18')]);}})[_0x4857('0x19')](function(_0x3d83eb){logger[_0x4857('0x16')](_0x4857('0x11'),_0xd8face,_0x3d83eb);_0x4db0a6(_0x3d83eb);});});}exports[_0x4857('0x1a')]=function(_0x36a7af){var _0x5ce267=this;return new Promise(function(_0xcf5957,_0x2dfaf9){return db['WhatsappInteraction'][_0x4857('0x1b')](_0x36a7af[_0x4857('0x1c')],{'raw':_0x36a7af['options']?_0x36a7af[_0x4857('0x1d')][_0x4857('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a7af['options']?_0x36a7af[_0x4857('0x1d')]['where']||null:null,'attributes':_0x36a7af[_0x4857('0x1d')]?_0x36a7af[_0x4857('0x1d')]['attributes']||null:null,'limit':_0x36a7af[_0x4857('0x1d')]?_0x36a7af[_0x4857('0x1d')]['limit']||null:null})[_0x4857('0x1f')](function(_0x2403d1){logger[_0x4857('0x10')](_0x4857('0x1a'),_0x36a7af);logger[_0x4857('0x13')](_0x4857('0x1a'),_0x36a7af,JSON[_0x4857('0x15')](_0x2403d1));_0xcf5957(_0x2403d1);})[_0x4857('0x19')](function(_0xbb0887){logger['error'](_0x4857('0x1a'),_0xbb0887['message'],_0x36a7af);_0x2dfaf9(_0x5ce267[_0x4857('0x16')](0x1f4,_0xbb0887[_0x4857('0x18')]));});});};exports[_0x4857('0x20')]=function(_0x23e2a0){return new Promise(function(_0xecbc3,_0x5d3824){return db[_0x4857('0x21')][_0x4857('0x22')]({'where':_0x23e2a0['options']?_0x23e2a0[_0x4857('0x1d')]['where']||null:null})['then'](function(_0x17b8a2){if(_0x17b8a2){return _0x17b8a2[_0x4857('0x23')](_0x23e2a0[_0x4857('0x1c')][_0x4857('0x24')],_[_0x4857('0x25')](_0x23e2a0['body'],['ids','id'])||{});}})[_0x4857('0x26')](function(_0x2b5915){logger[_0x4857('0x10')](_0x4857('0x27'),_0x23e2a0);logger[_0x4857('0x13')](_0x4857('0x27'),_0x23e2a0,JSON[_0x4857('0x15')](_0x2b5915));_0xecbc3(_0x2b5915);})[_0x4857('0x19')](function(_0x2a2a1c){logger[_0x4857('0x16')](_0x4857('0x27'),_0x2a2a1c['message'],_0x23e2a0);_0x5d3824(_this['error'](0x1f4,_0x2a2a1c[_0x4857('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 16e2877..30bdd51 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 _0x5926=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x6cd664,_0x1530bb){var _0x53f0d6=function(_0x3c3f6c){while(--_0x3c3f6c){_0x6cd664['push'](_0x6cd664['shift']());}};_0x53f0d6(++_0x1530bb);}(_0x5926,0x12f));var _0x6592=function(_0x295487,_0x51a87a){_0x295487=_0x295487-0x0;var _0x1cacad=_0x5926[_0x295487];return _0x1cacad;};'use strict';var WhatsappInteractionEvents=require(_0x6592('0x0'));var events=[_0x6592('0x1'),_0x6592('0x2'),'update'];function createListener(_0x1b2799,_0x4c14eb){return function(_0x55792d){_0x4c14eb['emit'](_0x1b2799,_0x55792d);};}function removeListener(_0x13ac09,_0x581bd3){return function(){WhatsappInteractionEvents['removeListener'](_0x13ac09,_0x581bd3);};}exports[_0x6592('0x3')]=function(_0xa61ad){for(var _0x4e1e3c=0x0,_0x2868a0=events[_0x6592('0x4')];_0x4e1e3c<_0x2868a0;_0x4e1e3c++){var _0x4d3e35=events[_0x4e1e3c];var _0x4b86ef=createListener(_0x6592('0x5')+_0x4d3e35,_0xa61ad);WhatsappInteractionEvents['on'](_0x4d3e35,_0x4b86ef);}}; \ No newline at end of file +var _0xbe40=['save','remove','update','emit','removeListener','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbe40,0xea));var _0x0be4=function(_0x251624,_0xff4d0b){_0x251624=_0x251624-0x0;var _0x59a3a4=_0xbe40[_0x251624];return _0x59a3a4;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0be4('0x0'),_0x0be4('0x1'),_0x0be4('0x2')];function createListener(_0x4e33b3,_0x3e89ea){return function(_0x5aa2d6){_0x3e89ea[_0x0be4('0x3')](_0x4e33b3,_0x5aa2d6);};}function removeListener(_0x4a9ad0,_0xddacca){return function(){WhatsappInteractionEvents[_0x0be4('0x4')](_0x4a9ad0,_0xddacca);};}exports['register']=function(_0x49a765){for(var _0x4dcdd2=0x0,_0x35efb6=events[_0x0be4('0x5')];_0x4dcdd2<_0x35efb6;_0x4dcdd2++){var _0x36db5a=events[_0x4dcdd2];var _0x16eff5=createListener('whatsappInteraction:'+_0x36db5a,_0x49a765);WhatsappInteractionEvents['on'](_0x36db5a,_0x16eff5);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index cef379b..b0932d1 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 _0x45f7=['../../config/environment','get','index','/describe','isAuthenticated','describe','show','tracked','whatsapp','create','post','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3ba9ae,_0x3ece10){var _0x35482c=function(_0x5074f9){while(--_0x5074f9){_0x3ba9ae['push'](_0x3ba9ae['shift']());}};_0x35482c(++_0x3ece10);}(_0x45f7,0xb6));var _0x745f=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x45f7[_0x32f26d];return _0x5d9ddc;};'use strict';var multer=require(_0x745f('0x0'));var util=require(_0x745f('0x1'));var path=require(_0x745f('0x2'));var timeout=require(_0x745f('0x3'));var express=require('express');var router=express[_0x745f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x745f('0x5'));var interaction=require(_0x745f('0x6'));var config=require(_0x745f('0x7'));var controller=require('./whatsappMessage.controller');router[_0x745f('0x8')]('/',auth['isAuthenticated'](),controller[_0x745f('0x9')]);router[_0x745f('0x8')](_0x745f('0xa'),auth[_0x745f('0xb')](),controller[_0x745f('0xc')]);router['get']('/:id',auth[_0x745f('0xb')](),controller[_0x745f('0xd')]);router['post']('/',auth[_0x745f('0xb')](),interaction[_0x745f('0xe')](_0x745f('0xf'),'whatsappmessage:create'),controller[_0x745f('0x10')]);router[_0x745f('0x11')](_0x745f('0x12'),controller['status']);router[_0x745f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x745f('0x14')]);router[_0x745f('0x13')](_0x745f('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x745f('0x13')](_0x745f('0x16'),auth['isAuthenticated'](),controller[_0x745f('0x17')]);router[_0x745f('0x18')]('/:id',auth[_0x745f('0xb')](),controller[_0x745f('0x19')]);module[_0x745f('0x1a')]=router; \ No newline at end of file +var _0x5492=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','post','tracked','whatsapp','create','status','put','update','/:id/accept','reject','destroy','multer','path','connect-timeout','express','Router'];(function(_0x22ffd9,_0x3a7b97){var _0x4f6586=function(_0x125b50){while(--_0x125b50){_0x22ffd9['push'](_0x22ffd9['shift']());}};_0x4f6586(++_0x3a7b97);}(_0x5492,0xab));var _0x2549=function(_0x2b7dcf,_0x4f9a4f){_0x2b7dcf=_0x2b7dcf-0x0;var _0x448baf=_0x5492[_0x2b7dcf];return _0x448baf;};'use strict';var multer=require(_0x2549('0x0'));var util=require('util');var path=require(_0x2549('0x1'));var timeout=require(_0x2549('0x2'));var express=require(_0x2549('0x3'));var router=express[_0x2549('0x4')]();var fs_extra=require(_0x2549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2549('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x2549('0x7')]('/',auth[_0x2549('0x8')](),controller[_0x2549('0x9')]);router[_0x2549('0x7')]('/describe',auth[_0x2549('0x8')](),controller[_0x2549('0xa')]);router[_0x2549('0x7')](_0x2549('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2549('0xc')]('/',auth[_0x2549('0x8')](),interaction[_0x2549('0xd')](_0x2549('0xe'),'whatsappmessage:create'),controller[_0x2549('0xf')]);router[_0x2549('0xc')]('/:id/status',controller[_0x2549('0x10')]);router[_0x2549('0x11')](_0x2549('0xb'),auth['isAuthenticated'](),controller[_0x2549('0x12')]);router[_0x2549('0x11')](_0x2549('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0x2549('0x8')](),controller[_0x2549('0x14')]);router['delete'](_0x2549('0xb'),auth[_0x2549('0x8')](),controller[_0x2549('0x15')]);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 66b26ad..97df5fc 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 _0xcbcc=['sequelize','medium','BOOLEAN','out','STRING','TEXT'];(function(_0x294e59,_0x4e6606){var _0x350bdc=function(_0x200cd3){while(--_0x200cd3){_0x294e59['push'](_0x294e59['shift']());}};_0x350bdc(++_0x4e6606);}(_0xcbcc,0x198));var _0xccbc=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xcbcc[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xccbc('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xccbc('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xccbc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xccbc('0x3')),'defaultValue':_0xccbc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xccbc('0x4')](0xbe)},'phone':{'type':Sequelize[_0xccbc('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xccbc('0x5')]}}; \ No newline at end of file +var _0x064e=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x3fcd6a,_0xa644a2){var _0x41996c=function(_0x35e404){while(--_0x35e404){_0x3fcd6a['push'](_0x3fcd6a['shift']());}};_0x41996c(++_0xa644a2);}(_0x064e,0xd2));var _0xe064=function(_0x2d3c54,_0x3692ce){_0x2d3c54=_0x2d3c54-0x0;var _0xbe006=_0x064e[_0x2d3c54];return _0xbe006;};'use strict';var Sequelize=require(_0xe064('0x0'));module[_0xe064('0x1')]={'body':{'type':Sequelize[_0xe064('0x2')](_0xe064('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe064('0x4')]('in',_0xe064('0x5')),'defaultValue':_0xe064('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe064('0x6')]},'readAt':{'type':Sequelize[_0xe064('0x7')]},'secret':{'type':Sequelize[_0xe064('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe064('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index be8c95b..7714ee4 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 _0x4aaa=['register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','include','findAll','show','params','includeAll','find','create','body','update','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket'];(function(_0x35cddc,_0x3a3466){var _0x22d86a=function(_0x51e69c){while(--_0x51e69c){_0x35cddc['push'](_0x35cddc['shift']());}};_0x22d86a(++_0x3a3466);}(_0x4aaa,0x18c));var _0xa4aa=function(_0x19ffbb,_0x485c74){_0x19ffbb=_0x19ffbb-0x0;var _0x14aa5f=_0x4aaa[_0x19ffbb];return _0x14aa5f;};'use strict';var emlformat=require(_0xa4aa('0x0'));var rimraf=require(_0xa4aa('0x1'));var zipdir=require(_0xa4aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa4aa('0x3'));var BPromise=require(_0xa4aa('0x4'));var Mustache=require('mustache');var util=require(_0xa4aa('0x5'));var path=require(_0xa4aa('0x6'));var sox=require(_0xa4aa('0x7'));var csv=require(_0xa4aa('0x8'));var ejs=require(_0xa4aa('0x9'));var fs=require('fs');var fs_extra=require(_0xa4aa('0xa'));var _=require(_0xa4aa('0xb'));var squel=require(_0xa4aa('0xc'));var crypto=require(_0xa4aa('0xd'));var jsforce=require(_0xa4aa('0xe'));var deskjs=require(_0xa4aa('0xf'));var toCsv=require(_0xa4aa('0x8'));var querystring=require(_0xa4aa('0x10'));var Papa=require(_0xa4aa('0x11'));var Redis=require(_0xa4aa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa4aa('0x13'));var as=require(_0xa4aa('0x14'));var hardwareService=require(_0xa4aa('0x15'));var logger=require('../../config/logger')(_0xa4aa('0x16'));var utils=require(_0xa4aa('0x17'));var config=require(_0xa4aa('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4aa('0x19'))['db'];config[_0xa4aa('0x1a')]=_[_0xa4aa('0x1b')](config[_0xa4aa('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4aa('0x1c'))(new Redis(config[_0xa4aa('0x1a')]));require(_0xa4aa('0x1d'))[_0xa4aa('0x1e')](socket);var jayson=require(_0xa4aa('0x1f'));var client=jayson[_0xa4aa('0x20')][_0xa4aa('0x21')]({'port':0x232c});var client9002=jayson[_0xa4aa('0x20')][_0xa4aa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x539af1,_0x56e764,_0xa3adea,_0x52e620){return new BPromise(function(_0x534bfc,_0x2323c9){var _0x159577=_0x52e620||client;return _0x159577[_0xa4aa('0x22')](_0x539af1,_0xa3adea)[_0xa4aa('0x23')](function(_0x5262f7){logger[_0xa4aa('0x24')](_0xa4aa('0x25'),_0x56e764,_0xa4aa('0x26'));logger[_0xa4aa('0x27')](_0xa4aa('0x28'),_0x56e764,_0xa4aa('0x26'),JSON[_0xa4aa('0x29')](_0x5262f7));if(_0x5262f7['error']){if(_0x5262f7[_0xa4aa('0x2a')][_0xa4aa('0x2b')]===0x1f4){logger[_0xa4aa('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x56e764,_0x5262f7[_0xa4aa('0x2a')][_0xa4aa('0x2c')]);return _0x2323c9(_0x5262f7[_0xa4aa('0x2a')]['message']);}logger[_0xa4aa('0x2a')](_0xa4aa('0x25'),_0x56e764,_0x5262f7[_0xa4aa('0x2a')][_0xa4aa('0x2c')]);return _0x534bfc(_0x5262f7[_0xa4aa('0x2a')][_0xa4aa('0x2c')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x56e764,_0xa4aa('0x26'));_0x534bfc(_0x5262f7[_0xa4aa('0x2d')][_0xa4aa('0x2c')]);}})[_0xa4aa('0x2e')](function(_0x3ce39d){logger[_0xa4aa('0x2a')](_0xa4aa('0x25'),_0x56e764,_0x3ce39d);_0x2323c9(_0x3ce39d);});});}function respondWithStatusCode(_0x3e36fd,_0x3dc924){_0x3dc924=_0x3dc924||0xcc;return function(_0x2362ce){if(_0x2362ce){return _0x3e36fd[_0xa4aa('0x2f')](_0x3dc924);}return _0x3e36fd[_0xa4aa('0x30')](_0x3dc924)['end']();};}function respondWithResult(_0x1dbe34,_0x5f4cc2){_0x5f4cc2=_0x5f4cc2||0xc8;return function(_0x192085){if(_0x192085){return _0x1dbe34[_0xa4aa('0x30')](_0x5f4cc2)[_0xa4aa('0x31')](_0x192085);}};}function respondWithFilteredResult(_0x3ed5e8,_0x5bc58a){return function(_0x459f20){if(_0x459f20){var _0x28f840=typeof _0x5bc58a[_0xa4aa('0x32')]===_0xa4aa('0x33')&&typeof _0x5bc58a['limit']===_0xa4aa('0x33');var _0x2b2047=_0x459f20[_0xa4aa('0x34')];var _0xc3a7d9=_0x28f840?0x0:_0x5bc58a[_0xa4aa('0x32')];var _0x58396a=_0x28f840?_0x459f20[_0xa4aa('0x34')]:_0x5bc58a['offset']+_0x5bc58a[_0xa4aa('0x35')];var _0x14e255;if(_0x58396a>=_0x2b2047){_0x58396a=_0x2b2047;_0x14e255=0xc8;}else{_0x14e255=0xce;}_0x3ed5e8[_0xa4aa('0x30')](_0x14e255);return _0x3ed5e8[_0xa4aa('0x36')](_0xa4aa('0x37'),_0xc3a7d9+'-'+_0x58396a+'/'+_0x2b2047)['json'](_0x459f20);}return null;};}function patchUpdates(_0x2c99bf){return function(_0xbec842){try{jsonpatch['apply'](_0xbec842,_0x2c99bf,!![]);}catch(_0x3497d7){return BPromise[_0xa4aa('0x38')](_0x3497d7);}return _0xbec842[_0xa4aa('0x39')]();};}function saveUpdates(_0x1c086a,_0x3b90c1){return function(_0x146027){if(_0x146027){return _0x146027['update'](_0x1c086a)[_0xa4aa('0x23')](function(_0x51f32a){return _0x51f32a;});}return null;};}function removeEntity(_0x4c7570,_0x510794){return function(_0x42fec6){if(_0x42fec6){return _0x42fec6[_0xa4aa('0x3a')]()[_0xa4aa('0x23')](function(){_0x4c7570[_0xa4aa('0x30')](0xcc)[_0xa4aa('0x3b')]();});}};}function handleEntityNotFound(_0x29f3fb,_0x40e79d){return function(_0x44d19b){if(!_0x44d19b){_0x29f3fb[_0xa4aa('0x2f')](0x194);}return _0x44d19b;};}function handleError(_0x5670ab,_0x3c3234){_0x3c3234=_0x3c3234||0x1f4;return function(_0x534dec){logger[_0xa4aa('0x2a')](_0x534dec[_0xa4aa('0x3c')]);if(_0x534dec[_0xa4aa('0x3d')]){delete _0x534dec['name'];}_0x5670ab['status'](_0x3c3234)[_0xa4aa('0x3e')](_0x534dec);};}exports[_0xa4aa('0x3f')]=function(_0x26d9f3,_0x202869){var _0x53cacb={},_0x350c20={},_0x253b89={'count':0x0,'rows':[]};var _0x348781=_[_0xa4aa('0x40')](db[_0xa4aa('0x41')][_0xa4aa('0x42')],function(_0x51671e){return{'name':_0x51671e[_0xa4aa('0x43')],'type':_0x51671e[_0xa4aa('0x44')][_0xa4aa('0x45')]};});_0x350c20[_0xa4aa('0x46')]=_[_0xa4aa('0x40')](_0x348781,_0xa4aa('0x3d'));_0x350c20[_0xa4aa('0x47')]=_[_0xa4aa('0x48')](_0x26d9f3[_0xa4aa('0x47')]);_0x350c20[_0xa4aa('0x49')]=_[_0xa4aa('0x4a')](_0x350c20[_0xa4aa('0x46')],_0x350c20['query']);_0x53cacb[_0xa4aa('0x4b')]=_['intersection'](_0x350c20[_0xa4aa('0x46')],qs['fields'](_0x26d9f3[_0xa4aa('0x47')][_0xa4aa('0x4c')]));_0x53cacb[_0xa4aa('0x4b')]=_0x53cacb[_0xa4aa('0x4b')][_0xa4aa('0x4d')]?_0x53cacb[_0xa4aa('0x4b')]:_0x350c20[_0xa4aa('0x46')];if(!_0x26d9f3[_0xa4aa('0x47')]['hasOwnProperty'](_0xa4aa('0x4e'))){_0x53cacb[_0xa4aa('0x35')]=qs[_0xa4aa('0x35')](_0x26d9f3[_0xa4aa('0x47')][_0xa4aa('0x35')]);_0x53cacb[_0xa4aa('0x32')]=qs[_0xa4aa('0x32')](_0x26d9f3['query'][_0xa4aa('0x32')]);}_0x53cacb[_0xa4aa('0x4f')]=qs[_0xa4aa('0x50')](_0x26d9f3[_0xa4aa('0x47')][_0xa4aa('0x50')]);_0x53cacb[_0xa4aa('0x51')]=qs[_0xa4aa('0x49')](_[_0xa4aa('0x52')](_0x26d9f3[_0xa4aa('0x47')],_0x350c20[_0xa4aa('0x49')]),_0x348781);if(_0x26d9f3[_0xa4aa('0x47')]['filter']){_0x53cacb['where']=_[_0xa4aa('0x53')](_0x53cacb[_0xa4aa('0x51')],{'$or':_[_0xa4aa('0x40')](_0x348781,function(_0x3383d1){if(_0x3383d1[_0xa4aa('0x44')]!=='VIRTUAL'){var _0x3e7745={};_0x3e7745[_0x3383d1['name']]={'$like':'%'+_0x26d9f3[_0xa4aa('0x47')]['filter']+'%'};return _0x3e7745;}})});}_0x53cacb=_[_0xa4aa('0x53')]({},_0x53cacb,_0x26d9f3[_0xa4aa('0x54')]);var _0x2e2aba={'where':_0x53cacb[_0xa4aa('0x51')]};return db[_0xa4aa('0x41')][_0xa4aa('0x34')](_0x2e2aba)[_0xa4aa('0x23')](function(_0x5f5a26){_0x253b89[_0xa4aa('0x34')]=_0x5f5a26;if(_0x26d9f3[_0xa4aa('0x47')]['includeAll']){_0x53cacb[_0xa4aa('0x55')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xa4aa('0x56')](_0x53cacb);})[_0xa4aa('0x23')](function(_0x2ad32f){_0x253b89['rows']=_0x2ad32f;return _0x253b89;})[_0xa4aa('0x23')](respondWithFilteredResult(_0x202869,_0x53cacb))['catch'](handleError(_0x202869,null));};exports[_0xa4aa('0x57')]=function(_0x5bc47f,_0x1d6225){var _0x48eab2={'raw':!![],'where':{'id':_0x5bc47f[_0xa4aa('0x58')]['id']}},_0x56f4a2={};_0x56f4a2[_0xa4aa('0x46')]=_['keys'](db[_0xa4aa('0x41')]['rawAttributes']);_0x56f4a2[_0xa4aa('0x47')]=_[_0xa4aa('0x48')](_0x5bc47f[_0xa4aa('0x47')]);_0x56f4a2[_0xa4aa('0x49')]=_[_0xa4aa('0x4a')](_0x56f4a2['model'],_0x56f4a2[_0xa4aa('0x47')]);_0x48eab2[_0xa4aa('0x4b')]=_[_0xa4aa('0x4a')](_0x56f4a2[_0xa4aa('0x46')],qs[_0xa4aa('0x4c')](_0x5bc47f['query'][_0xa4aa('0x4c')]));_0x48eab2[_0xa4aa('0x4b')]=_0x48eab2[_0xa4aa('0x4b')][_0xa4aa('0x4d')]?_0x48eab2[_0xa4aa('0x4b')]:_0x56f4a2[_0xa4aa('0x46')];if(_0x5bc47f[_0xa4aa('0x47')][_0xa4aa('0x59')]){_0x48eab2[_0xa4aa('0x55')]=[{'all':!![]}];}_0x48eab2=_[_0xa4aa('0x53')]({},_0x48eab2,_0x5bc47f['options']);return db['WhatsappMessage'][_0xa4aa('0x5a')](_0x48eab2)[_0xa4aa('0x23')](handleEntityNotFound(_0x1d6225,null))['then'](respondWithResult(_0x1d6225,null))[_0xa4aa('0x2e')](handleError(_0x1d6225,null));};exports['create']=function(_0xee720f,_0x352feb){return db[_0xa4aa('0x41')][_0xa4aa('0x5b')](_0xee720f[_0xa4aa('0x5c')],{})[_0xa4aa('0x23')](respondWithResult(_0x352feb,0xc9))[_0xa4aa('0x2e')](handleError(_0x352feb,null));};exports[_0xa4aa('0x5d')]=function(_0x19c89c,_0x151e84){if(_0x19c89c[_0xa4aa('0x5c')]['id']){delete _0x19c89c[_0xa4aa('0x5c')]['id'];}return db[_0xa4aa('0x41')][_0xa4aa('0x5a')]({'where':{'id':_0x19c89c['params']['id']}})[_0xa4aa('0x23')](handleEntityNotFound(_0x151e84,null))[_0xa4aa('0x23')](saveUpdates(_0x19c89c[_0xa4aa('0x5c')],null))[_0xa4aa('0x23')](respondWithResult(_0x151e84,null))['catch'](handleError(_0x151e84,null));};exports[_0xa4aa('0x3a')]=function(_0x5307da,_0x4c34fe){return db[_0xa4aa('0x41')][_0xa4aa('0x5a')]({'where':{'id':_0x5307da[_0xa4aa('0x58')]['id']}})[_0xa4aa('0x23')](handleEntityNotFound(_0x4c34fe,null))[_0xa4aa('0x23')](removeEntity(_0x4c34fe,null))[_0xa4aa('0x2e')](handleError(_0x4c34fe,null));};exports[_0xa4aa('0x5e')]=function(_0x293477,_0x31e218){return db[_0xa4aa('0x41')][_0xa4aa('0x5e')]()[_0xa4aa('0x23')](respondWithResult(_0x31e218,null))['catch'](handleError(_0x31e218,null));};var interaction_log=require(_0xa4aa('0x5f'))(_0xa4aa('0x60'));exports[_0xa4aa('0x61')]=function(_0x1a6ec4,_0x542266,_0x356916){var _0x447148={'agent':{},'channel':_0xa4aa('0x62')};if(_0x1a6ec4[_0xa4aa('0x5c')]['id']){delete _0x1a6ec4['body']['id'];}_0x1a6ec4['body'][_0xa4aa('0x63')]=!![];_0x1a6ec4[_0xa4aa('0x5c')][_0xa4aa('0x64')]=moment()[_0xa4aa('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a6ec4['body']['UserId']=_0x1a6ec4[_0xa4aa('0x5c')][_0xa4aa('0x66')]||_0x1a6ec4[_0xa4aa('0x67')]['id'];_0x447148[_0xa4aa('0x68')]['id']=_0x1a6ec4[_0xa4aa('0x5c')][_0xa4aa('0x66')];return db[_0xa4aa('0x41')][_0xa4aa('0x5a')]({'where':{'id':_0x1a6ec4[_0xa4aa('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x542266,null))[_0xa4aa('0x23')](saveUpdates(_0x1a6ec4[_0xa4aa('0x5c')],null))['then'](function(_0x12bd6b){if(_0x12bd6b){_0x447148[_0xa4aa('0x2c')]=_0x12bd6b[_0xa4aa('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0xa4aa('0x5a')]({'where':{'id':_0x12bd6b[_0xa4aa('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x542266,null))[_0xa4aa('0x23')](function(_0x43996c){if(_0x43996c){return _0x43996c[_0xa4aa('0x5d')]({'UserId':_0x1a6ec4['body']['UserId'],'read1stAt':_['isNil'](_0x43996c[_0xa4aa('0x6b')])?moment()[_0xa4aa('0x65')](_0xa4aa('0x6c')):undefined});}return null;})[_0xa4aa('0x23')](function(_0xaec340){if(_0xaec340){_0x447148['interaction']=_0xaec340[_0xa4aa('0x69')]({'plain':!![]});interaction_log[_0xa4aa('0x24')](_0xa4aa('0x6d'),_0x1a6ec4[_0xa4aa('0x67')]['id'],_0x1a6ec4[_0xa4aa('0x67')][_0xa4aa('0x3d')],_0x1a6ec4['user'][_0xa4aa('0x6e')],_0x447148[_0xa4aa('0x6f')]['id'],_0x1a6ec4['body']?JSON['stringify'](_0x1a6ec4['body']):_0xa4aa('0x70'));return respondWithRpcPromise(_0xa4aa('0x71'),_0xa4aa('0x72'),_0x447148);}return null;})[_0xa4aa('0x23')](function(_0x595b45){var _0x16c153=_0xa4aa('0x73')+_0x595b45[_0xa4aa('0x2c')][_0xa4aa('0x74')];return db['sequelize']['query'](_0x16c153,{'type':db['Sequelize'][_0xa4aa('0x75')][_0xa4aa('0x76')],'raw':!![]})[_0xa4aa('0x23')](function(_0x583878){return _0x583878;});})[_0xa4aa('0x23')](function(_0x47871b){if(_0x47871b){_0x447148[_0xa4aa('0x2c')][_0xa4aa('0x77')]=_0x47871b[0x0];if(!_0x1a6ec4[_0xa4aa('0x5c')][_0xa4aa('0x66')])return;return db[_0xa4aa('0x78')]['find']({'where':{'id':_0x1a6ec4[_0xa4aa('0x5c')][_0xa4aa('0x66')],'role':_0xa4aa('0x68')},'attributes':['id',_0xa4aa('0x3d'),_0xa4aa('0x79'),_0xa4aa('0x7a'),_0xa4aa('0x7b')],'raw':!![]});}return null;})[_0xa4aa('0x23')](function(_0x57b75a){if(!_0x57b75a)return null;_0x447148['message'][_0xa4aa('0x68')]=_0x57b75a;return _0x447148;})['then'](function(_0x531168){if(_0x531168){if(_0x1a6ec4['body'][_0xa4aa('0x7c')]){_0x447148['message']['interface']=util['format']('SIP/%s',_0x1a6ec4[_0xa4aa('0x67')][_0xa4aa('0x3d')]);_0x447148[_0xa4aa('0x2c')][_0xa4aa('0x7d')]=_0x447148[_0xa4aa('0x7d')];_0x447148['message']['motionChannel']=_0x447148[_0xa4aa('0x7d')];_0x447148[_0xa4aa('0x2c')][_0xa4aa('0x7e')]='accept';return respondWithRpcPromise(_0xa4aa('0x7f'),_0xa4aa('0x7f'),{'event':_0xa4aa('0x80'),'message':_0x447148[_0xa4aa('0x2c')]},client9002)[_0xa4aa('0x23')](function(){return _0x447148;});}return _0x447148;}return null;})[_0xa4aa('0x23')](respondWithResult(_0x542266,null))['catch'](handleError(_0x542266,null));};var interaction_log=require('../../config/logger')(_0xa4aa('0x60'));exports[_0xa4aa('0x38')]=function(_0x68e4b,_0x2f329d,_0x8393a5){var _0x27945f={'agent':{},'channel':'whatsapp'};if(_0x68e4b[_0xa4aa('0x5c')]['id']){delete _0x68e4b[_0xa4aa('0x5c')]['id'];}_0x68e4b[_0xa4aa('0x5c')][_0xa4aa('0x66')]=_0x68e4b[_0xa4aa('0x5c')]['UserId']||_0x68e4b['user']['id'];_0x27945f['agent']['id']=_0x68e4b[_0xa4aa('0x5c')][_0xa4aa('0x66')];return db[_0xa4aa('0x41')][_0xa4aa('0x5a')]({'where':{'id':_0x68e4b['params']['id'],'UserId':null}})[_0xa4aa('0x23')](handleEntityNotFound(_0x2f329d,null))[_0xa4aa('0x23')](function(_0x48c818){if(_0x48c818){_0x27945f[_0xa4aa('0x2c')]=_0x48c818['get']({'plain':!![]});return db[_0xa4aa('0x81')][_0xa4aa('0x5a')]({'where':{'id':_0x48c818['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2f329d,null))[_0xa4aa('0x23')](function(_0x1368ab){if(_0x1368ab){_0x27945f['interaction']=_0x1368ab[_0xa4aa('0x69')]({'plain':!![]});interaction_log['info'](_0xa4aa('0x82'),_0x68e4b[_0xa4aa('0x67')]['id'],_0x68e4b[_0xa4aa('0x67')][_0xa4aa('0x3d')],_0x68e4b[_0xa4aa('0x67')][_0xa4aa('0x6e')],_0x27945f[_0xa4aa('0x6f')]['id'],_0x68e4b[_0xa4aa('0x5c')]?JSON[_0xa4aa('0x29')](_0x68e4b[_0xa4aa('0x5c')]):_0xa4aa('0x70'));return respondWithRpcPromise(_0xa4aa('0x83'),'rejectMessage',_0x27945f);}return null;})[_0xa4aa('0x23')](function(_0x4df4db){var _0x82b5da='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df4db['message'][_0xa4aa('0x74')];return db['sequelize'][_0xa4aa('0x47')](_0x82b5da,{'type':db['Sequelize'][_0xa4aa('0x75')][_0xa4aa('0x76')],'raw':!![]})[_0xa4aa('0x23')](function(_0x40603d){return _0x40603d;});})['then'](function(_0x5cb46d){if(_0x5cb46d){_0x27945f[_0xa4aa('0x2c')][_0xa4aa('0x77')]=_0x5cb46d[0x0];if(!_0x68e4b['body'][_0xa4aa('0x66')])return;return db['User'][_0xa4aa('0x5a')]({'where':{'id':_0x68e4b[_0xa4aa('0x5c')][_0xa4aa('0x66')],'role':_0xa4aa('0x68')},'attributes':['id','name',_0xa4aa('0x79'),_0xa4aa('0x7a'),_0xa4aa('0x7b')],'raw':!![]});}return null;})[_0xa4aa('0x23')](function(_0x324072){if(!_0x324072)return null;_0x27945f[_0xa4aa('0x2c')][_0xa4aa('0x68')]=_0x324072;return _0x27945f;})['then'](function(_0x4e5001){if(_0x4e5001){_0x4e5001[_0xa4aa('0x2c')][_0xa4aa('0x84')]=util[_0xa4aa('0x65')]('SIP/%s',_0x68e4b['user'][_0xa4aa('0x3d')]);_0x4e5001['message']['channel']=_0x27945f[_0xa4aa('0x7d')];_0x4e5001[_0xa4aa('0x2c')]['motionChannel']=_0x27945f['channel'];_0x4e5001[_0xa4aa('0x2c')][_0xa4aa('0x7e')]=_0xa4aa('0x38');respondWithRpcPromise('EventManager',_0xa4aa('0x7f'),{'event':_0xa4aa('0x85'),'message':_0x4e5001[_0xa4aa('0x2c')]},client9002);return _0x27945f;}return null;})[_0xa4aa('0x23')](respondWithResult(_0x2f329d,null))[_0xa4aa('0x2e')](handleError(_0x2f329d,null));};exports['status']=function(_0x7a636b,_0x3cca43,_0xaf91f2){if(_0x7a636b[_0xa4aa('0x5c')]['id']){delete _0x7a636b[_0xa4aa('0x5c')]['id'];}var _0x578737;return db[_0xa4aa('0x41')][_0xa4aa('0x5a')]({'where':{'id':_0x7a636b[_0xa4aa('0x58')]['id']}})[_0xa4aa('0x23')](handleEntityNotFound(_0x3cca43,null))['then'](function(_0x33cc7e){if(_0x33cc7e){_0x578737=_0x33cc7e;return db[_0xa4aa('0x86')][_0xa4aa('0x5a')]({'where':{'id':_0x33cc7e['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x3cca43,null))['then'](function(_0x48c5e7){if(_0x48c5e7){logger[_0xa4aa('0x27')](_0xa4aa('0x87'),_0xa4aa('0x30'),_0xa4aa('0x88'),_0x48c5e7[_0xa4aa('0x44')],util[_0xa4aa('0x89')](_0x7a636b['body'],{'showHidden':![],'depth':null}));switch(_0x48c5e7[_0xa4aa('0x44')]){case'twilio':if(_0x7a636b[_0xa4aa('0x5c')]['MessageSid']&&_0x7a636b[_0xa4aa('0x5c')][_0xa4aa('0x8a')]===_0x578737[_0xa4aa('0x8b')]&&_0x7a636b['body'][_0xa4aa('0x8c')]&&_0x7a636b[_0xa4aa('0x5c')][_0xa4aa('0x8c')]===_0xa4aa('0x63')){return _0x578737[_0xa4aa('0x5d')]({'read':!![]});}else{logger[_0xa4aa('0x2a')](_0xa4aa('0x8d'),'status','twilio',util[_0xa4aa('0x89')](_0x7a636b[_0xa4aa('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x578737;}})[_0xa4aa('0x23')](respondWithResult(_0x3cca43,null))['catch'](handleError(_0x3cca43,null));}; \ No newline at end of file +var _0xa03d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','WhatsappMessage','includeAll','findAll','params','keys','include','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','messageId','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa03d,0x79));var _0xda03=function(_0x39c4d8,_0x5b71d3){_0x39c4d8=_0x39c4d8-0x0;var _0x262245=_0xa03d[_0x39c4d8];return _0x262245;};'use strict';var emlformat=require(_0xda03('0x0'));var rimraf=require(_0xda03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda03('0x2'));var rp=require(_0xda03('0x3'));var moment=require(_0xda03('0x4'));var BPromise=require(_0xda03('0x5'));var Mustache=require('mustache');var util=require(_0xda03('0x6'));var path=require(_0xda03('0x7'));var sox=require(_0xda03('0x8'));var csv=require(_0xda03('0x9'));var ejs=require(_0xda03('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda03('0xb'));var squel=require('squel');var crypto=require(_0xda03('0xc'));var jsforce=require(_0xda03('0xd'));var deskjs=require(_0xda03('0xe'));var toCsv=require(_0xda03('0x9'));var querystring=require(_0xda03('0xf'));var Papa=require(_0xda03('0x10'));var Redis=require('ioredis');var authService=require(_0xda03('0x11'));var qs=require(_0xda03('0x12'));var as=require(_0xda03('0x13'));var hardwareService=require(_0xda03('0x14'));var logger=require('../../config/logger')(_0xda03('0x15'));var utils=require(_0xda03('0x16'));var config=require(_0xda03('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xda03('0x18'))['db'];config[_0xda03('0x19')]=_[_0xda03('0x1a')](config['redis'],{'host':_0xda03('0x1b'),'port':0x18eb});var socket=require(_0xda03('0x1c'))(new Redis(config['redis']));require(_0xda03('0x1d'))['register'](socket);var jayson=require(_0xda03('0x1e'));var client=jayson[_0xda03('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xda03('0x1f')][_0xda03('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x324c94,_0x682cf6,_0x36079a,_0x4c7fbf){return new BPromise(function(_0x3ff167,_0x4fac46){var _0x42ddfe=_0x4c7fbf||client;return _0x42ddfe[_0xda03('0x21')](_0x324c94,_0x36079a)[_0xda03('0x22')](function(_0x10852d){logger[_0xda03('0x23')](_0xda03('0x24'),_0x682cf6,_0xda03('0x25'));logger[_0xda03('0x26')](_0xda03('0x27'),_0x682cf6,_0xda03('0x25'),JSON['stringify'](_0x10852d));if(_0x10852d[_0xda03('0x28')]){if(_0x10852d[_0xda03('0x28')][_0xda03('0x29')]===0x1f4){logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);return _0x4fac46(_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);}logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x10852d['error'][_0xda03('0x2a')]);return _0x3ff167(_0x10852d[_0xda03('0x28')][_0xda03('0x2a')]);}else{logger[_0xda03('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x682cf6,_0xda03('0x25'));_0x3ff167(_0x10852d[_0xda03('0x2b')][_0xda03('0x2a')]);}})[_0xda03('0x2c')](function(_0x350465){logger[_0xda03('0x28')](_0xda03('0x24'),_0x682cf6,_0x350465);_0x4fac46(_0x350465);});});}function respondWithStatusCode(_0x45c784,_0x5333d6){_0x5333d6=_0x5333d6||0xcc;return function(_0x38d673){if(_0x38d673){return _0x45c784[_0xda03('0x2d')](_0x5333d6);}return _0x45c784[_0xda03('0x2e')](_0x5333d6)[_0xda03('0x2f')]();};}function respondWithResult(_0x374a3b,_0xef715e){_0xef715e=_0xef715e||0xc8;return function(_0x50115e){if(_0x50115e){return _0x374a3b[_0xda03('0x2e')](_0xef715e)[_0xda03('0x30')](_0x50115e);}};}function respondWithFilteredResult(_0xd33d,_0x35a86f){return function(_0x4f82d0){if(_0x4f82d0){var _0x3b24b5=typeof _0x35a86f[_0xda03('0x31')]==='undefined'&&typeof _0x35a86f['limit']===_0xda03('0x32');var _0x52558=_0x4f82d0[_0xda03('0x33')];var _0x4f334b=_0x3b24b5?0x0:_0x35a86f['offset'];var _0x3b0c23=_0x3b24b5?_0x4f82d0[_0xda03('0x33')]:_0x35a86f[_0xda03('0x31')]+_0x35a86f[_0xda03('0x34')];var _0x3e0f93;if(_0x3b0c23>=_0x52558){_0x3b0c23=_0x52558;_0x3e0f93=0xc8;}else{_0x3e0f93=0xce;}_0xd33d[_0xda03('0x2e')](_0x3e0f93);return _0xd33d[_0xda03('0x35')](_0xda03('0x36'),_0x4f334b+'-'+_0x3b0c23+'/'+_0x52558)[_0xda03('0x30')](_0x4f82d0);}return null;};}function patchUpdates(_0x232bc2){return function(_0x44f1e6){try{jsonpatch[_0xda03('0x37')](_0x44f1e6,_0x232bc2,!![]);}catch(_0x209bd7){return BPromise[_0xda03('0x38')](_0x209bd7);}return _0x44f1e6['save']();};}function saveUpdates(_0x5dcd78,_0xf0f098){return function(_0x59cc7f){if(_0x59cc7f){return _0x59cc7f['update'](_0x5dcd78)[_0xda03('0x22')](function(_0x4235be){return _0x4235be;});}return null;};}function removeEntity(_0x3e5ca7,_0xe108d6){return function(_0x239939){if(_0x239939){return _0x239939[_0xda03('0x39')]()[_0xda03('0x22')](function(){_0x3e5ca7[_0xda03('0x2e')](0xcc)[_0xda03('0x2f')]();});}};}function handleEntityNotFound(_0x539514,_0x10a395){return function(_0x2afb3b){if(!_0x2afb3b){_0x539514[_0xda03('0x2d')](0x194);}return _0x2afb3b;};}function handleError(_0x1c7754,_0x43d7b6){_0x43d7b6=_0x43d7b6||0x1f4;return function(_0x50f619){logger[_0xda03('0x28')](_0x50f619[_0xda03('0x3a')]);if(_0x50f619[_0xda03('0x3b')]){delete _0x50f619[_0xda03('0x3b')];}_0x1c7754[_0xda03('0x2e')](_0x43d7b6)[_0xda03('0x3c')](_0x50f619);};}exports['index']=function(_0x474897,_0x1f89f1){var _0x1a5fbe={},_0x376857={},_0x332191={'count':0x0,'rows':[]};var _0x2d50b3=_['map'](db['WhatsappMessage'][_0xda03('0x3d')],function(_0x3023e2){return{'name':_0x3023e2[_0xda03('0x3e')],'type':_0x3023e2[_0xda03('0x3f')][_0xda03('0x40')]};});_0x376857[_0xda03('0x41')]=_[_0xda03('0x42')](_0x2d50b3,_0xda03('0x3b'));_0x376857[_0xda03('0x43')]=_['keys'](_0x474897['query']);_0x376857[_0xda03('0x44')]=_[_0xda03('0x45')](_0x376857[_0xda03('0x41')],_0x376857['query']);_0x1a5fbe[_0xda03('0x46')]=_[_0xda03('0x45')](_0x376857[_0xda03('0x41')],qs['fields'](_0x474897[_0xda03('0x43')][_0xda03('0x47')]));_0x1a5fbe[_0xda03('0x46')]=_0x1a5fbe[_0xda03('0x46')][_0xda03('0x48')]?_0x1a5fbe[_0xda03('0x46')]:_0x376857[_0xda03('0x41')];if(!_0x474897['query'][_0xda03('0x49')](_0xda03('0x4a'))){_0x1a5fbe[_0xda03('0x34')]=qs['limit'](_0x474897[_0xda03('0x43')][_0xda03('0x34')]);_0x1a5fbe[_0xda03('0x31')]=qs[_0xda03('0x31')](_0x474897[_0xda03('0x43')][_0xda03('0x31')]);}_0x1a5fbe[_0xda03('0x4b')]=qs[_0xda03('0x4c')](_0x474897['query'][_0xda03('0x4c')]);_0x1a5fbe[_0xda03('0x4d')]=qs[_0xda03('0x44')](_[_0xda03('0x4e')](_0x474897[_0xda03('0x43')],_0x376857['filters']),_0x2d50b3);if(_0x474897[_0xda03('0x43')][_0xda03('0x4f')]){_0x1a5fbe[_0xda03('0x4d')]=_[_0xda03('0x50')](_0x1a5fbe[_0xda03('0x4d')],{'$or':_[_0xda03('0x42')](_0x2d50b3,function(_0x59ae71){if(_0x59ae71[_0xda03('0x3f')]!=='VIRTUAL'){var _0x47103e={};_0x47103e[_0x59ae71['name']]={'$like':'%'+_0x474897[_0xda03('0x43')][_0xda03('0x4f')]+'%'};return _0x47103e;}})});}_0x1a5fbe=_[_0xda03('0x50')]({},_0x1a5fbe,_0x474897[_0xda03('0x51')]);var _0x409f3f={'where':_0x1a5fbe[_0xda03('0x4d')]};return db[_0xda03('0x52')][_0xda03('0x33')](_0x409f3f)[_0xda03('0x22')](function(_0x1606e4){_0x332191['count']=_0x1606e4;if(_0x474897['query'][_0xda03('0x53')]){_0x1a5fbe['include']=[{'all':!![]}];}return db[_0xda03('0x52')][_0xda03('0x54')](_0x1a5fbe);})[_0xda03('0x22')](function(_0x5ec23e){_0x332191['rows']=_0x5ec23e;return _0x332191;})[_0xda03('0x22')](respondWithFilteredResult(_0x1f89f1,_0x1a5fbe))['catch'](handleError(_0x1f89f1,null));};exports['show']=function(_0x4e5a57,_0x1b6ab2){var _0x5cd269={'raw':!![],'where':{'id':_0x4e5a57[_0xda03('0x55')]['id']}},_0x8926b5={};_0x8926b5[_0xda03('0x41')]=_[_0xda03('0x56')](db['WhatsappMessage']['rawAttributes']);_0x8926b5[_0xda03('0x43')]=_['keys'](_0x4e5a57[_0xda03('0x43')]);_0x8926b5[_0xda03('0x44')]=_[_0xda03('0x45')](_0x8926b5[_0xda03('0x41')],_0x8926b5[_0xda03('0x43')]);_0x5cd269[_0xda03('0x46')]=_[_0xda03('0x45')](_0x8926b5[_0xda03('0x41')],qs[_0xda03('0x47')](_0x4e5a57[_0xda03('0x43')][_0xda03('0x47')]));_0x5cd269[_0xda03('0x46')]=_0x5cd269[_0xda03('0x46')][_0xda03('0x48')]?_0x5cd269[_0xda03('0x46')]:_0x8926b5['model'];if(_0x4e5a57['query'][_0xda03('0x53')]){_0x5cd269[_0xda03('0x57')]=[{'all':!![]}];}_0x5cd269=_[_0xda03('0x50')]({},_0x5cd269,_0x4e5a57[_0xda03('0x51')]);return db[_0xda03('0x52')]['find'](_0x5cd269)['then'](handleEntityNotFound(_0x1b6ab2,null))[_0xda03('0x22')](respondWithResult(_0x1b6ab2,null))[_0xda03('0x2c')](handleError(_0x1b6ab2,null));};exports[_0xda03('0x58')]=function(_0x204905,_0x5aadde){return db[_0xda03('0x52')][_0xda03('0x58')](_0x204905[_0xda03('0x59')],{})['then'](respondWithResult(_0x5aadde,0xc9))[_0xda03('0x2c')](handleError(_0x5aadde,null));};exports[_0xda03('0x5a')]=function(_0x106f77,_0x228951){if(_0x106f77[_0xda03('0x59')]['id']){delete _0x106f77['body']['id'];}return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x106f77['params']['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x228951,null))['then'](saveUpdates(_0x106f77[_0xda03('0x59')],null))[_0xda03('0x22')](respondWithResult(_0x228951,null))[_0xda03('0x2c')](handleError(_0x228951,null));};exports['destroy']=function(_0x5e8c4e,_0x4dda6a){return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x5e8c4e[_0xda03('0x55')]['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x4dda6a,null))['then'](removeEntity(_0x4dda6a,null))[_0xda03('0x2c')](handleError(_0x4dda6a,null));};exports[_0xda03('0x5c')]=function(_0x4eeedb,_0xfda7f4){return db[_0xda03('0x52')]['describe']()['then'](respondWithResult(_0xfda7f4,null))['catch'](handleError(_0xfda7f4,null));};var interaction_log=require('../../config/logger')(_0xda03('0x5d'));exports[_0xda03('0x5e')]=function(_0x5e167a,_0x4a90f1,_0x5c5ef9){var _0x17d18d={'agent':{},'channel':_0xda03('0x5f')};if(_0x5e167a[_0xda03('0x59')]['id']){delete _0x5e167a[_0xda03('0x59')]['id'];}_0x5e167a[_0xda03('0x59')][_0xda03('0x60')]=!![];_0x5e167a[_0xda03('0x59')][_0xda03('0x61')]=moment()[_0xda03('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e167a[_0xda03('0x59')]['UserId']=_0x5e167a[_0xda03('0x59')][_0xda03('0x63')]||_0x5e167a[_0xda03('0x64')]['id'];_0x17d18d['agent']['id']=_0x5e167a[_0xda03('0x59')][_0xda03('0x63')];return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0x5e167a[_0xda03('0x55')]['id'],'UserId':null}})[_0xda03('0x22')](handleEntityNotFound(_0x4a90f1,null))[_0xda03('0x22')](saveUpdates(_0x5e167a[_0xda03('0x59')],null))[_0xda03('0x22')](function(_0x106ef0){if(_0x106ef0){_0x17d18d[_0xda03('0x2a')]=_0x106ef0[_0xda03('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xda03('0x5b')]({'where':{'id':_0x106ef0[_0xda03('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4a90f1,null))[_0xda03('0x22')](function(_0x3e78df){if(_0x3e78df){return _0x3e78df[_0xda03('0x5a')]({'UserId':_0x5e167a[_0xda03('0x59')][_0xda03('0x63')],'read1stAt':_[_0xda03('0x67')](_0x3e78df[_0xda03('0x68')])?moment()[_0xda03('0x62')](_0xda03('0x69')):undefined});}return null;})[_0xda03('0x22')](function(_0x5dfa1a){if(_0x5dfa1a){_0x17d18d[_0xda03('0x6a')]=_0x5dfa1a[_0xda03('0x65')]({'plain':!![]});interaction_log[_0xda03('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e167a[_0xda03('0x64')]['id'],_0x5e167a[_0xda03('0x64')]['name'],_0x5e167a[_0xda03('0x64')][_0xda03('0x6b')],_0x17d18d['interaction']['id'],_0x5e167a[_0xda03('0x59')]?JSON['stringify'](_0x5e167a[_0xda03('0x59')]):_0xda03('0x6c'));return respondWithRpcPromise(_0xda03('0x6d'),'acceptMessage',_0x17d18d);}return null;})['then'](function(_0x4e761d){var _0x47221e=_0xda03('0x6e')+_0x4e761d[_0xda03('0x2a')][_0xda03('0x6f')];return db[_0xda03('0x70')][_0xda03('0x43')](_0x47221e,{'type':db[_0xda03('0x71')][_0xda03('0x72')][_0xda03('0x73')],'raw':!![]})[_0xda03('0x22')](function(_0x108003){return _0x108003;});})[_0xda03('0x22')](function(_0x4cb514){if(_0x4cb514){_0x17d18d[_0xda03('0x2a')][_0xda03('0x74')]=_0x4cb514[0x0];if(!_0x5e167a[_0xda03('0x59')][_0xda03('0x63')])return;return db['User'][_0xda03('0x5b')]({'where':{'id':_0x5e167a[_0xda03('0x59')][_0xda03('0x63')],'role':_0xda03('0x75')},'attributes':['id',_0xda03('0x3b'),_0xda03('0x76'),_0xda03('0x77'),_0xda03('0x78')],'raw':!![]});}return null;})[_0xda03('0x22')](function(_0x4e3915){if(!_0x4e3915)return null;_0x17d18d[_0xda03('0x2a')][_0xda03('0x75')]=_0x4e3915;return _0x17d18d;})[_0xda03('0x22')](function(_0x2af1e4){if(_0x2af1e4){if(_0x5e167a[_0xda03('0x59')][_0xda03('0x79')]){_0x17d18d[_0xda03('0x2a')][_0xda03('0x7a')]=util['format'](_0xda03('0x7b'),_0x5e167a['user'][_0xda03('0x3b')]);_0x17d18d['message'][_0xda03('0x7c')]=_0x17d18d[_0xda03('0x7c')];_0x17d18d[_0xda03('0x2a')][_0xda03('0x7d')]=_0x17d18d[_0xda03('0x7c')];_0x17d18d[_0xda03('0x2a')]['event']=_0xda03('0x5e');return respondWithRpcPromise('EventManager',_0xda03('0x7e'),{'event':_0xda03('0x7f'),'message':_0x17d18d['message']},client9002)[_0xda03('0x22')](function(){return _0x17d18d;});}return _0x17d18d;}return null;})['then'](respondWithResult(_0x4a90f1,null))[_0xda03('0x2c')](handleError(_0x4a90f1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['reject']=function(_0x369787,_0x19536f,_0x511238){var _0x52cca5={'agent':{},'channel':_0xda03('0x5f')};if(_0x369787[_0xda03('0x59')]['id']){delete _0x369787[_0xda03('0x59')]['id'];}_0x369787['body'][_0xda03('0x63')]=_0x369787[_0xda03('0x59')][_0xda03('0x63')]||_0x369787[_0xda03('0x64')]['id'];_0x52cca5[_0xda03('0x75')]['id']=_0x369787[_0xda03('0x59')][_0xda03('0x63')];return db[_0xda03('0x52')]['find']({'where':{'id':_0x369787[_0xda03('0x55')]['id'],'UserId':null}})[_0xda03('0x22')](handleEntityNotFound(_0x19536f,null))[_0xda03('0x22')](function(_0xace867){if(_0xace867){_0x52cca5[_0xda03('0x2a')]=_0xace867['get']({'plain':!![]});return db['WhatsappInteraction'][_0xda03('0x5b')]({'where':{'id':_0xace867[_0xda03('0x66')]}});}return null;})[_0xda03('0x22')](handleEntityNotFound(_0x19536f,null))[_0xda03('0x22')](function(_0xd3642){if(_0xd3642){_0x52cca5[_0xda03('0x6a')]=_0xd3642['get']({'plain':!![]});interaction_log['info'](_0xda03('0x80'),_0x369787[_0xda03('0x64')]['id'],_0x369787[_0xda03('0x64')][_0xda03('0x3b')],_0x369787[_0xda03('0x64')]['role'],_0x52cca5[_0xda03('0x6a')]['id'],_0x369787[_0xda03('0x59')]?JSON['stringify'](_0x369787[_0xda03('0x59')]):_0xda03('0x6c'));return respondWithRpcPromise(_0xda03('0x81'),'rejectMessage',_0x52cca5);}return null;})[_0xda03('0x22')](function(_0x1a3d27){var _0x5be866=_0xda03('0x6e')+_0x1a3d27[_0xda03('0x2a')][_0xda03('0x6f')];return db[_0xda03('0x70')][_0xda03('0x43')](_0x5be866,{'type':db['Sequelize'][_0xda03('0x72')][_0xda03('0x73')],'raw':!![]})['then'](function(_0x1f9429){return _0x1f9429;});})[_0xda03('0x22')](function(_0x59bd80){if(_0x59bd80){_0x52cca5[_0xda03('0x2a')][_0xda03('0x74')]=_0x59bd80[0x0];if(!_0x369787['body'][_0xda03('0x63')])return;return db['User']['find']({'where':{'id':_0x369787[_0xda03('0x59')][_0xda03('0x63')],'role':'agent'},'attributes':['id',_0xda03('0x3b'),'fullname',_0xda03('0x77'),_0xda03('0x78')],'raw':!![]});}return null;})['then'](function(_0x47f752){if(!_0x47f752)return null;_0x52cca5[_0xda03('0x2a')][_0xda03('0x75')]=_0x47f752;return _0x52cca5;})[_0xda03('0x22')](function(_0x4d9369){if(_0x4d9369){_0x4d9369['message'][_0xda03('0x7a')]=util[_0xda03('0x62')](_0xda03('0x7b'),_0x369787['user'][_0xda03('0x3b')]);_0x4d9369['message'][_0xda03('0x7c')]=_0x52cca5[_0xda03('0x7c')];_0x4d9369[_0xda03('0x2a')][_0xda03('0x7d')]=_0x52cca5['channel'];_0x4d9369[_0xda03('0x2a')][_0xda03('0x82')]=_0xda03('0x38');respondWithRpcPromise('EventManager',_0xda03('0x7e'),{'event':_0xda03('0x83'),'message':_0x4d9369['message']},client9002);return _0x52cca5;}return null;})[_0xda03('0x22')](respondWithResult(_0x19536f,null))['catch'](handleError(_0x19536f,null));};exports['status']=function(_0xce66ef,_0x23131f,_0x54ed5e){if(_0xce66ef[_0xda03('0x59')]['id']){delete _0xce66ef['body']['id'];}var _0x51331a;return db[_0xda03('0x52')][_0xda03('0x5b')]({'where':{'id':_0xce66ef['params']['id']}})[_0xda03('0x22')](handleEntityNotFound(_0x23131f,null))[_0xda03('0x22')](function(_0x1f50df){if(_0x1f50df){_0x51331a=_0x1f50df;return db[_0xda03('0x84')][_0xda03('0x5b')]({'where':{'id':_0x1f50df['WhatsappAccountId']}});}})[_0xda03('0x22')](handleEntityNotFound(_0x23131f,null))[_0xda03('0x22')](function(_0x17c570){if(_0x17c570){logger['debug'](_0xda03('0x85'),_0xda03('0x2e'),_0xda03('0x86'),_0x17c570['type'],util[_0xda03('0x87')](_0xce66ef[_0xda03('0x59')],{'showHidden':![],'depth':null}));switch(_0x17c570[_0xda03('0x3f')]){case'twilio':if(_0xce66ef[_0xda03('0x59')]['MessageSid']&&_0xce66ef[_0xda03('0x59')]['MessageSid']===_0x51331a[_0xda03('0x88')]&&_0xce66ef[_0xda03('0x59')][_0xda03('0x89')]&&_0xce66ef['body']['MessageStatus']===_0xda03('0x60')){return _0x51331a[_0xda03('0x5a')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xda03('0x2e'),'twilio',util[_0xda03('0x87')](_0xce66ef[_0xda03('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x51331a;}})[_0xda03('0x22')](respondWithResult(_0x23131f,null))['catch'](handleError(_0x23131f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a76186f..4f0442b 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 _0x9ffd=['events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5ec8db,_0x5630e7){var _0xdd089a=function(_0x116f6e){while(--_0x116f6e){_0x5ec8db['push'](_0x5ec8db['shift']());}};_0xdd089a(++_0x5630e7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1fea5b,_0x1d04d6){_0x1fea5b=_0x1fea5b-0x0;var _0x25ace0=_0x9ffd[_0x1fea5b];return _0x25ace0;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var WhatsappMessage=require(_0xd9ff('0x1'))['db'][_0xd9ff('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9ff('0x3'),'afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x5493ae){return function(_0x53e962,_0x1c9460,_0x111697){WhatsappMessageEvents['emit'](_0x5493ae+':'+_0x53e962['id'],_0x53e962);WhatsappMessageEvents[_0xd9ff('0x6')](_0x5493ae,_0x53e962);_0x111697(null);};}for(var e in events){if(events[_0xd9ff('0x7')](e)){var event=events[e];WhatsappMessage[_0xd9ff('0x8')](e,emitEvent(event));}}module[_0xd9ff('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x24cf=['WhatsappMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x217605,_0x347798){var _0x13b50e=function(_0x462e40){while(--_0x462e40){_0x217605['push'](_0x217605['shift']());}};_0x13b50e(++_0x347798);}(_0x24cf,0x1d5));var _0xf24c=function(_0xb5401d,_0x16617e){_0xb5401d=_0xb5401d-0x0;var _0x3ec2c8=_0x24cf[_0xb5401d];return _0x3ec2c8;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf24c('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf24c('0x1')](0x0);var events={'afterCreate':_0xf24c('0x2'),'afterUpdate':_0xf24c('0x3'),'afterDestroy':_0xf24c('0x4')};function emitEvent(_0x4cc9b1){return function(_0x3cfc01,_0x417bb2,_0x1eafb4){WhatsappMessageEvents[_0xf24c('0x5')](_0x4cc9b1+':'+_0x3cfc01['id'],_0x3cfc01);WhatsappMessageEvents['emit'](_0x4cc9b1,_0x3cfc01);_0x1eafb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf24c('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e71175c..4694290 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 _0x594d=['createdAt','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x594d,0x1e6));var _0xd594=function(_0x2ad543,_0x4159b1){_0x2ad543=_0x2ad543-0x0;var _0xe1c52e=_0x594d[_0x2ad543];return _0xe1c52e;};'use strict';var _=require('lodash');var util=require(_0xd594('0x0'));var logger=require(_0xd594('0x1'))(_0xd594('0x2'));var moment=require(_0xd594('0x3'));var BPromise=require(_0xd594('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xd594('0x5'));var rimraf=require('rimraf');var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module[_0xd594('0x8')]=function(_0x4dbf08,_0x335c67){return _0x4dbf08[_0xd594('0x9')](_0xd594('0xa'),attributes,{'tableName':_0xd594('0xb'),'paranoid':![],'indexes':[{'name':_0xd594('0xc'),'fields':['messageId']},{'name':_0xd594('0xd'),'fields':[_0xd594('0xe')],'type':_0xd594('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22db20,_0x150c6e,_0x1bb4ed){var _0x47adc5=_0x4dbf08[_0xd594('0x10')];var _0x2b3eec=_0x22db20['get']({'plain':!![]});if(_0x2b3eec[_0xd594('0x11')][_0xd594('0x12')]()==='in'||_0x2b3eec[_0xd594('0x11')][_0xd594('0x12')]()===_0xd594('0x13')&&!_0x2b3eec[_0xd594('0x14')]&&!_[_0xd594('0x15')](_0x2b3eec[_0xd594('0x16')])){_0x47adc5[_0xd594('0x17')][_0xd594('0x18')]({'where':{'id':_0x2b3eec['WhatsappInteractionId']}})[_0xd594('0x19')](function(_0x42d101){if(_0x42d101){_0x42d101[_0xd594('0x1a')]({'lastMsgAt':_0x2b3eec[_0xd594('0x1b')],'lastMsgDirection':_0x2b3eec[_0xd594('0x11')]['toLowerCase']()});}})['catch'](function(_0x518998){console[_0xd594('0x1c')](_0x518998);});}if(_0x2b3eec[_0xd594('0x11')]===_0xd594('0x13')&&!_0x2b3eec[_0xd594('0x14')]){var _0x191e8c;_0x47adc5['WhatsappAccount'][_0xd594('0x1d')]({'where':{'id':_0x2b3eec[_0xd594('0x1e')]},'raw':!![]})[_0xd594('0x19')](function(_0x4b6dce){_0x191e8c=_0x4b6dce;if(_0x191e8c&&_0x191e8c[_0xd594('0x1f')]){switch(_0x191e8c[_0xd594('0x1f')]){case _0xd594('0x20'):var _0x4d11f0=require(_0xd594('0x20'));if(_0x191e8c[_0xd594('0x21')]&&_0x191e8c[_0xd594('0x22')]&&_0x191e8c[_0xd594('0x23')]){var _0x2d1c70=new _0x4d11f0(_0x191e8c[_0xd594('0x21')],_0x191e8c[_0xd594('0x22')]);_0x2d1c70[_0xd594('0x24')][_0xd594('0x25')]({'body':_0x2b3eec[_0xd594('0xe')],'to':_0xd594('0x26')+_0x2b3eec[_0xd594('0x23')],'from':_0xd594('0x26')+_0x191e8c['phone'],'statusCallback':_0x191e8c[_0xd594('0x27')]+_0xd594('0x28')+_0x2b3eec['id']+'/status?token='+_0x191e8c['token']})['then'](function(_0x29d77d){if(_0x29d77d[_0xd594('0x29')]){return _0x22db20['update']({'messageId':_0x29d77d[_0xd594('0x29')]});}})[_0xd594('0x2a')](function(_0x5ea1e1){logger['error'](_0xd594('0x2b'),_0xd594('0x2c'),_0xd594('0x20'),util['inspect'](_0x5ea1e1,{'showHidden':![],'depth':null}));});}else{logger[_0xd594('0x1c')](_0xd594('0x2b'),_0xd594('0x2c'),_0xd594('0x20'),_0xd594('0x2d'));}break;case'sinch':var _0x37c943=_0x191e8c[_0xd594('0x21')];var _0x300c00=_0x191e8c[_0xd594('0x22')];var _0x4862e7=_0x191e8c[_0xd594('0x2e')]+_0xd594('0x2f')+_0x37c943+_0xd594('0x30');var _0x721429={'to':[_0x2b3eec[_0xd594('0x23')]],'message':{'type':_0xd594('0x31'),'text':_0x2b3eec[_0xd594('0xe')]}};var _0xfb8b83={'method':_0xd594('0x32'),'uri':_0x4862e7,'headers':{'Authorization':'Bearer\x20'+_0x300c00,'Content-Type':_0xd594('0x33')},'body':_0x721429,'json':!![]};rp(_0xfb8b83)[_0xd594('0x19')](function(_0x163c53){if(_0x163c53[_0xd594('0x34')][0x0][_0xd594('0x35')]){return _0x22db20[_0xd594('0x1a')]({'messageId':_0x163c53['statuses'][0x0][_0xd594('0x35')]});}})[_0xd594('0x2a')](function(_0x42a36a){logger[_0xd594('0x36')]('WhatsappMessage,\x20%s',_0x42a36a);});break;}}})[_0xd594('0x37')](function(){_0x1bb4ed();});}else{_0x1bb4ed();}}},'charset':'utf8mb4','collate':_0xd594('0x38')});}; \ No newline at end of file +var _0x63a3=['baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','catch','error','WhatsappAccount','find','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x63a3,0x15b));var _0x363a=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x63a3[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x363a('0x0'));var util=require(_0x363a('0x1'));var logger=require(_0x363a('0x2'))(_0x363a('0x3'));var moment=require(_0x363a('0x4'));var BPromise=require(_0x363a('0x5'));var rp=require(_0x363a('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x363a('0x7'));var rimraf=require(_0x363a('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x363a('0x9')]=function(_0x31cbc9,_0x12c445){return _0x31cbc9[_0x363a('0xa')](_0x363a('0xb'),attributes,{'tableName':_0x363a('0xc'),'paranoid':![],'indexes':[{'name':_0x363a('0xd'),'fields':['messageId']},{'name':_0x363a('0xe'),'fields':['body'],'type':_0x363a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54cc8f,_0x1f226e,_0x275ff4){var _0x4f21e5=_0x31cbc9['models'];var _0x4be9ec=_0x54cc8f[_0x363a('0x10')]({'plain':!![]});if(_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()==='in'||_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()===_0x363a('0x13')&&!_0x4be9ec[_0x363a('0x14')]&&!_[_0x363a('0x15')](_0x4be9ec[_0x363a('0x16')])){_0x4f21e5['WhatsappInteraction'][_0x363a('0x17')]({'where':{'id':_0x4be9ec['WhatsappInteractionId']}})[_0x363a('0x18')](function(_0x28ec14){if(_0x28ec14){_0x28ec14[_0x363a('0x19')]({'lastMsgAt':_0x4be9ec['createdAt'],'lastMsgDirection':_0x4be9ec[_0x363a('0x11')][_0x363a('0x12')]()});}})[_0x363a('0x1a')](function(_0x25b655){console[_0x363a('0x1b')](_0x25b655);});}if(_0x4be9ec[_0x363a('0x11')]===_0x363a('0x13')&&!_0x4be9ec[_0x363a('0x14')]){var _0x3f41fd;_0x4f21e5[_0x363a('0x1c')][_0x363a('0x1d')]({'where':{'id':_0x4be9ec['WhatsappAccountId']},'raw':!![]})[_0x363a('0x18')](function(_0x508629){_0x3f41fd=_0x508629;if(_0x3f41fd&&_0x3f41fd['type']){switch(_0x3f41fd['type']){case _0x363a('0x1e'):var _0x32cf19=require('twilio');if(_0x3f41fd[_0x363a('0x1f')]&&_0x3f41fd[_0x363a('0x20')]&&_0x3f41fd[_0x363a('0x21')]){var _0x5c4770=new _0x32cf19(_0x3f41fd[_0x363a('0x1f')],_0x3f41fd['authToken']);_0x5c4770['messages'][_0x363a('0x22')]({'body':_0x4be9ec['body'],'to':_0x363a('0x23')+_0x4be9ec[_0x363a('0x21')],'from':'whatsapp:'+_0x3f41fd['phone'],'statusCallback':_0x3f41fd[_0x363a('0x24')]+_0x363a('0x25')+_0x4be9ec['id']+_0x363a('0x26')+_0x3f41fd['token']})[_0x363a('0x18')](function(_0x11801a){if(_0x11801a[_0x363a('0x27')]){return _0x54cc8f['update']({'messageId':_0x11801a['sid']});}})[_0x363a('0x1a')](function(_0x23b5ac){logger[_0x363a('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x363a('0x28'),'twilio',util[_0x363a('0x29')](_0x23b5ac,{'showHidden':![],'depth':null}));});}else{logger[_0x363a('0x1b')](_0x363a('0x2a'),_0x363a('0x28'),_0x363a('0x1e'),_0x363a('0x2b'));}break;case _0x363a('0x2c'):var _0x43820a=_0x3f41fd[_0x363a('0x1f')];var _0x21c4e1=_0x3f41fd[_0x363a('0x20')];var _0x51d476=_0x3f41fd[_0x363a('0x2d')]+_0x363a('0x2e')+_0x43820a+_0x363a('0x2f');var _0x3ece3f={'to':[_0x4be9ec[_0x363a('0x21')]],'message':{'type':'text','text':_0x4be9ec['body']}};var _0x50cb90={'method':_0x363a('0x30'),'uri':_0x51d476,'headers':{'Authorization':_0x363a('0x31')+_0x21c4e1,'Content-Type':'application/json'},'body':_0x3ece3f,'json':!![]};rp(_0x50cb90)['then'](function(_0x1d16a6){if(_0x1d16a6[_0x363a('0x32')][0x0]['message_id']){return _0x54cc8f['update']({'messageId':_0x1d16a6['statuses'][0x0][_0x363a('0x33')]});}})[_0x363a('0x1a')](function(_0x57dd6e){logger[_0x363a('0x34')](_0x363a('0x35'),_0x57dd6e);});break;}}})[_0x363a('0x36')](function(){_0x275ff4();});}else{_0x275ff4();}}},'charset':'utf8mb4','collate':_0x363a('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b6c89d1..a793dac 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 _0xf602=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','options','raw','debug','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info'];(function(_0x1ab603,_0x54bb82){var _0x121785=function(_0x340c2a){while(--_0x340c2a){_0x1ab603['push'](_0x1ab603['shift']());}};_0x121785(++_0x54bb82);}(_0xf602,0x124));var _0x2f60=function(_0x876461,_0x167763){_0x876461=_0x876461-0x0;var _0xb7f63f=_0xf602[_0x876461];return _0xb7f63f;};'use strict';var _=require(_0x2f60('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f60('0x1'));var rs=require(_0x2f60('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f60('0x3'))['db'];var utils=require(_0x2f60('0x4'));var logger=require(_0x2f60('0x5'))(_0x2f60('0x6'));var config=require('../../config/environment');var jayson=require(_0x2f60('0x7'));var client=jayson[_0x2f60('0x8')][_0x2f60('0x9')]({'port':0x232a});config[_0x2f60('0xa')]=_['defaults'](config['redis'],{'host':_0x2f60('0xb'),'port':0x18eb});var socket=require(_0x2f60('0xc'))(new Redis(config[_0x2f60('0xa')]));require(_0x2f60('0xd'))[_0x2f60('0xe')](socket);function respondWithRpcPromise(_0x415606,_0x5082ff,_0xc9af47){return new BPromise(function(_0x41a82a,_0x323526){return client[_0x2f60('0xf')](_0x415606,_0xc9af47)[_0x2f60('0x10')](function(_0x21a76d){logger[_0x2f60('0x11')](_0x2f60('0x12'),_0x5082ff,_0x2f60('0x13'));logger['debug'](_0x2f60('0x14'),_0x5082ff,_0x2f60('0x13'),JSON['stringify'](_0x21a76d));if(_0x21a76d[_0x2f60('0x15')]){if(_0x21a76d['error'][_0x2f60('0x16')]===0x1f4){logger[_0x2f60('0x15')](_0x2f60('0x12'),_0x5082ff,_0x21a76d[_0x2f60('0x15')]['message']);return _0x323526(_0x21a76d[_0x2f60('0x15')][_0x2f60('0x17')]);}logger[_0x2f60('0x15')](_0x2f60('0x12'),_0x5082ff,_0x21a76d[_0x2f60('0x15')][_0x2f60('0x17')]);return _0x41a82a(_0x21a76d[_0x2f60('0x15')]['message']);}else{logger['info'](_0x2f60('0x12'),_0x5082ff,_0x2f60('0x13'));_0x41a82a(_0x21a76d[_0x2f60('0x18')][_0x2f60('0x17')]);}})[_0x2f60('0x19')](function(_0x4d256c){logger[_0x2f60('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5082ff,_0x4d256c);_0x323526(_0x4d256c);});});}exports[_0x2f60('0x1a')]=function(_0x416ef4){var _0x3be92e=this;return new Promise(function(_0x4e5f56,_0x3887f3){return db['WhatsappMessage']['create'](_0x416ef4['body'],{'raw':_0x416ef4[_0x2f60('0x1b')]?_0x416ef4[_0x2f60('0x1b')][_0x2f60('0x1c')]===undefined?!![]:![]:!![]})[_0x2f60('0x10')](function(_0x516164){logger[_0x2f60('0x11')](_0x2f60('0x1a'),_0x416ef4);logger[_0x2f60('0x1d')]('CreateWhatsappMessage',_0x416ef4,JSON[_0x2f60('0x1e')](_0x516164));_0x4e5f56(_0x516164);})[_0x2f60('0x19')](function(_0x325103){logger[_0x2f60('0x15')](_0x2f60('0x1a'),_0x325103[_0x2f60('0x17')],_0x416ef4);_0x3887f3(_0x3be92e[_0x2f60('0x15')](0x1f4,_0x325103[_0x2f60('0x17')]));});});}; \ No newline at end of file +var _0xd5c6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util'];(function(_0xa8ae60,_0x36af36){var _0x340cd9=function(_0x51372a){while(--_0x51372a){_0xa8ae60['push'](_0xa8ae60['shift']());}};_0x340cd9(++_0x36af36);}(_0xd5c6,0x15c));var _0x6d5c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd5c6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6d5c('0x0'));var util=require(_0x6d5c('0x1'));var moment=require(_0x6d5c('0x2'));var BPromise=require(_0x6d5c('0x3'));var rs=require(_0x6d5c('0x4'));var fs=require('fs');var Redis=require(_0x6d5c('0x5'));var db=require(_0x6d5c('0x6'))['db'];var utils=require(_0x6d5c('0x7'));var logger=require(_0x6d5c('0x8'))(_0x6d5c('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d5c('0xa'));var client=jayson[_0x6d5c('0xb')][_0x6d5c('0xc')]({'port':0x232a});config['redis']=_[_0x6d5c('0xd')](config[_0x6d5c('0xe')],{'host':_0x6d5c('0xf'),'port':0x18eb});var socket=require(_0x6d5c('0x10'))(new Redis(config['redis']));require(_0x6d5c('0x11'))['register'](socket);function respondWithRpcPromise(_0x10307c,_0x5a9d66,_0x5b04e3){return new BPromise(function(_0x20ad1a,_0x27126a){return client[_0x6d5c('0x12')](_0x10307c,_0x5b04e3)[_0x6d5c('0x13')](function(_0x540d17){logger[_0x6d5c('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x5a9d66,_0x6d5c('0x15'));logger['debug'](_0x6d5c('0x16'),_0x5a9d66,_0x6d5c('0x15'),JSON[_0x6d5c('0x17')](_0x540d17));if(_0x540d17[_0x6d5c('0x18')]){if(_0x540d17['error'][_0x6d5c('0x19')]===0x1f4){logger[_0x6d5c('0x18')](_0x6d5c('0x1a'),_0x5a9d66,_0x540d17[_0x6d5c('0x18')][_0x6d5c('0x1b')]);return _0x27126a(_0x540d17[_0x6d5c('0x18')]['message']);}logger[_0x6d5c('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x5a9d66,_0x540d17[_0x6d5c('0x18')]['message']);return _0x20ad1a(_0x540d17[_0x6d5c('0x18')]['message']);}else{logger[_0x6d5c('0x14')](_0x6d5c('0x1a'),_0x5a9d66,_0x6d5c('0x15'));_0x20ad1a(_0x540d17[_0x6d5c('0x1c')][_0x6d5c('0x1b')]);}})[_0x6d5c('0x1d')](function(_0x4d88d4){logger[_0x6d5c('0x18')](_0x6d5c('0x1a'),_0x5a9d66,_0x4d88d4);_0x27126a(_0x4d88d4);});});}exports[_0x6d5c('0x1e')]=function(_0x398263){var _0x307c77=this;return new Promise(function(_0xbf2c42,_0x508202){return db[_0x6d5c('0x1f')][_0x6d5c('0x20')](_0x398263['body'],{'raw':_0x398263[_0x6d5c('0x21')]?_0x398263[_0x6d5c('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6d5c('0x13')](function(_0x8c4cb9){logger[_0x6d5c('0x14')](_0x6d5c('0x1e'),_0x398263);logger[_0x6d5c('0x22')]('CreateWhatsappMessage',_0x398263,JSON['stringify'](_0x8c4cb9));_0xbf2c42(_0x8c4cb9);})[_0x6d5c('0x1d')](function(_0x82877a){logger[_0x6d5c('0x18')](_0x6d5c('0x1e'),_0x82877a[_0x6d5c('0x1b')],_0x398263);_0x508202(_0x307c77[_0x6d5c('0x18')](0x1f4,_0x82877a[_0x6d5c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 140328f..92e303b 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 _0x1e26=['remove','update','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x578240,_0x59e966){var _0x2385c3=function(_0x1a8703){while(--_0x1a8703){_0x578240['push'](_0x578240['shift']());}};_0x2385c3(++_0x59e966);}(_0x1e26,0x96));var _0x61e2=function(_0x5c9c05,_0x2a8025){_0x5c9c05=_0x5c9c05-0x0;var _0x884b1e=_0x1e26[_0x5c9c05];return _0x884b1e;};'use strict';var WhatsappMessageEvents=require(_0x61e2('0x0'));var events=[_0x61e2('0x1'),_0x61e2('0x2'),_0x61e2('0x3')];function createListener(_0x314120,_0x21591f){return function(_0xbd9528){_0x21591f['emit'](_0x314120,_0xbd9528);};}function removeListener(_0x2788e3,_0x308777){return function(){WhatsappMessageEvents[_0x61e2('0x4')](_0x2788e3,_0x308777);};}exports[_0x61e2('0x5')]=function(_0x454e17){for(var _0x9f3c0b=0x0,_0x34f6cf=events[_0x61e2('0x6')];_0x9f3c0b<_0x34f6cf;_0x9f3c0b++){var _0x1ef0bf=events[_0x9f3c0b];var _0x42b27a=createListener(_0x61e2('0x7')+_0x1ef0bf,_0x454e17);WhatsappMessageEvents['on'](_0x1ef0bf,_0x42b27a);}}; \ No newline at end of file +var _0x6bc4=['removeListener','register','length','./whatsappMessage.events','remove','update'];(function(_0xa392f8,_0x37f8e7){var _0xc5216c=function(_0x16964d){while(--_0x16964d){_0xa392f8['push'](_0xa392f8['shift']());}};_0xc5216c(++_0x37f8e7);}(_0x6bc4,0x195));var _0x46bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc4[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require(_0x46bc('0x0'));var events=['save',_0x46bc('0x1'),_0x46bc('0x2')];function createListener(_0x7372f7,_0x35147d){return function(_0x21a6ad){_0x35147d['emit'](_0x7372f7,_0x21a6ad);};}function removeListener(_0x183646,_0x4b61ec){return function(){WhatsappMessageEvents[_0x46bc('0x3')](_0x183646,_0x4b61ec);};}exports[_0x46bc('0x4')]=function(_0x42888c){for(var _0x461dd9=0x0,_0x4c5d20=events[_0x46bc('0x5')];_0x461dd9<_0x4c5d20;_0x461dd9++){var _0x70233c=events[_0x461dd9];var _0x4fe10c=createListener('whatsappMessage:'+_0x70233c,_0x42888c);WhatsappMessageEvents['on'](_0x70233c,_0x4fe10c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e0cea44..4ce2134 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 _0xe919=['/:id/members','getMembers','/:id/teams','/:id/users','post','addAgents','/:id','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x1e9447,_0x2756eb){var _0x332863=function(_0x2126fc){while(--_0x2126fc){_0x1e9447['push'](_0x1e9447['shift']());}};_0x332863(++_0x2756eb);}(_0xe919,0xec));var _0x9e91=function(_0x3f8720,_0x1c812c){_0x3f8720=_0x3f8720-0x0;var _0x197a82=_0xe919[_0x3f8720];return _0x197a82;};'use strict';var multer=require(_0x9e91('0x0'));var util=require(_0x9e91('0x1'));var path=require(_0x9e91('0x2'));var timeout=require(_0x9e91('0x3'));var express=require(_0x9e91('0x4'));var router=express[_0x9e91('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9e91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e91('0x7'));router[_0x9e91('0x8')]('/',auth[_0x9e91('0x9')](),controller[_0x9e91('0xa')]);router[_0x9e91('0x8')](_0x9e91('0xb'),auth['isAuthenticated'](),controller[_0x9e91('0xc')]);router['get']('/:id',auth[_0x9e91('0x9')](),controller[_0x9e91('0xd')]);router[_0x9e91('0x8')](_0x9e91('0xe'),auth[_0x9e91('0x9')](),controller[_0x9e91('0xf')]);router[_0x9e91('0x8')](_0x9e91('0x10'),auth[_0x9e91('0x9')](),controller['getTeams']);router[_0x9e91('0x8')](_0x9e91('0x11'),auth[_0x9e91('0x9')](),controller['getAgents']);router['post']('/',auth[_0x9e91('0x9')](),controller['create']);router[_0x9e91('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x9e91('0x11'),auth[_0x9e91('0x9')](),controller[_0x9e91('0x13')]);router['put'](_0x9e91('0x14'),auth[_0x9e91('0x9')](),controller['update']);router['delete']('/:id',auth[_0x9e91('0x9')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x9e91('0x9')](),controller[_0x9e91('0x15')]);router[_0x9e91('0x16')](_0x9e91('0x11'),auth[_0x9e91('0x9')](),controller[_0x9e91('0x17')]);module[_0x9e91('0x18')]=router; \ No newline at end of file +var _0x1dc0=['delete','removeTeams','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put','/:id','update','destroy'];(function(_0x2e7cba,_0x3771c3){var _0x32a862=function(_0x4fcc34){while(--_0x4fcc34){_0x2e7cba['push'](_0x2e7cba['shift']());}};_0x32a862(++_0x3771c3);}(_0x1dc0,0x1ce));var _0x01dc=function(_0x36e26f,_0x93ce22){_0x36e26f=_0x36e26f-0x0;var _0x2dd6c2=_0x1dc0[_0x36e26f];return _0x2dd6c2;};'use strict';var multer=require('multer');var util=require(_0x01dc('0x0'));var path=require(_0x01dc('0x1'));var timeout=require(_0x01dc('0x2'));var express=require(_0x01dc('0x3'));var router=express['Router']();var fs_extra=require(_0x01dc('0x4'));var auth=require(_0x01dc('0x5'));var interaction=require(_0x01dc('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x01dc('0x7')]('/',auth[_0x01dc('0x8')](),controller[_0x01dc('0x9')]);router[_0x01dc('0x7')]('/describe',auth[_0x01dc('0x8')](),controller[_0x01dc('0xa')]);router[_0x01dc('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x01dc('0x7')]('/:id/members',auth[_0x01dc('0x8')](),controller[_0x01dc('0xb')]);router['get'](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0xd')]);router[_0x01dc('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x01dc('0xe')]('/',auth[_0x01dc('0x8')](),controller['create']);router['post'](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0xf')]);router[_0x01dc('0xe')](_0x01dc('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x01dc('0x11')](_0x01dc('0x12'),auth['isAuthenticated'](),controller[_0x01dc('0x13')]);router['delete'](_0x01dc('0x12'),auth[_0x01dc('0x8')](),controller[_0x01dc('0x14')]);router[_0x01dc('0x15')](_0x01dc('0xc'),auth[_0x01dc('0x8')](),controller[_0x01dc('0x16')]);router[_0x01dc('0x15')]('/:id/users',auth[_0x01dc('0x8')](),controller['removeAgents']);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 3c113c1..07bb2da 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 _0x1be1=['STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1ccc62,_0x5bfcf3){var _0x2eb85d=function(_0x2cefb9){while(--_0x2cefb9){_0x1ccc62['push'](_0x1ccc62['shift']());}};_0x2eb85d(++_0x5bfcf3);}(_0x1be1,0x192));var _0x11be=function(_0xce4987,_0x2dc96b){_0xce4987=_0xce4987-0x0;var _0x34ae8d=_0x1be1[_0xce4987];return _0x34ae8d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')],'unique':_0x11be('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11be('0x2')](_0x11be('0x3'),_0x11be('0x4'),_0x11be('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0b40=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0b40,0xba));var _0x00b4=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x0b40[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require('sequelize');module[_0x00b4('0x0')]={'name':{'type':Sequelize[_0x00b4('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x00b4('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00b4('0x3')](_0x00b4('0x4'),_0x00b4('0x5'),_0x00b4('0x6'))},'description':{'type':Sequelize[_0x00b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5e8c65f..1271fc2 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 _0xb134=['stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','findOne','UserWhatsappQueue','length','limit','sort','pick','WhatsappQueueId','filter','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','options','hasOwnProperty','nolimit','addTeams','ids','Team','Agents','online','interface','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','destroy','then','get','UserProfileResource','error'];(function(_0x2fcd9a,_0xcf5482){var _0x3f61d2=function(_0x5778c2){while(--_0x5778c2){_0x2fcd9a['push'](_0x2fcd9a['shift']());}};_0x3f61d2(++_0xcf5482);}(_0xb134,0xd7));var _0x4b13=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xb134[_0x43aee5];return _0x76d1d0;};'use strict';var BPromise=require(_0x4b13('0x0'));var util=require('util');var _=require(_0x4b13('0x1'));var squel=require('squel');var Redis=require(_0x4b13('0x2'));var qs=require(_0x4b13('0x3'));var logger=require(_0x4b13('0x4'))(_0x4b13('0x5'));var config=require(_0x4b13('0x6'));var db=require(_0x4b13('0x7'))['db'];config[_0x4b13('0x8')]=_['defaults'](config[_0x4b13('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b13('0x8')]));require(_0x4b13('0x9'))[_0x4b13('0xa')](socket);function respondWithStatusCode(_0x58ad7c,_0x2bd556){_0x2bd556=_0x2bd556||0xcc;return function(_0x597bf5){if(_0x597bf5){return _0x58ad7c[_0x4b13('0xb')](_0x2bd556);}return _0x58ad7c[_0x4b13('0xc')](_0x2bd556)[_0x4b13('0xd')]();};}function respondWithResult(_0x3f0436,_0xf677c8){_0xf677c8=_0xf677c8||0xc8;return function(_0x646e80){if(_0x646e80){return _0x3f0436[_0x4b13('0xc')](_0xf677c8)[_0x4b13('0xe')](_0x646e80);}};}function respondWithFilteredResult(_0x3f26f6,_0x49074b){return function(_0x12226b){if(_0x12226b){var _0x53a12f=typeof _0x49074b['offset']===_0x4b13('0xf')&&typeof _0x49074b['limit']===_0x4b13('0xf');var _0x2b828f=_0x12226b[_0x4b13('0x10')];var _0x4f7f62=_0x53a12f?0x0:_0x49074b[_0x4b13('0x11')];var _0x4b7c6d=_0x53a12f?_0x12226b[_0x4b13('0x10')]:_0x49074b[_0x4b13('0x11')]+_0x49074b['limit'];var _0x58ae6f;if(_0x4b7c6d>=_0x2b828f){_0x4b7c6d=_0x2b828f;_0x58ae6f=0xc8;}else{_0x58ae6f=0xce;}_0x3f26f6[_0x4b13('0xc')](_0x58ae6f);return _0x3f26f6[_0x4b13('0x12')](_0x4b13('0x13'),_0x4f7f62+'-'+_0x4b7c6d+'/'+_0x2b828f)[_0x4b13('0xe')](_0x12226b);}return null;};}function saveUpdates(_0x1246b0){return function(_0x2bc665){if(_0x2bc665){return _0x2bc665['update'](_0x1246b0)['then'](function(_0x5ba89c){return _0x5ba89c;});}return null;};}function removeEntity(_0x5927b8){return function(_0x6dfebd){if(_0x6dfebd){return _0x6dfebd[_0x4b13('0x14')]()[_0x4b13('0x15')](function(){var _0x2fc68d=_0x6dfebd[_0x4b13('0x16')]({'plain':!![]});var _0x2d9d6c='WhatsappQueues';return db[_0x4b13('0x17')][_0x4b13('0x14')]({'where':{'type':_0x2d9d6c,'resourceId':_0x2fc68d['id']}})[_0x4b13('0x15')](function(){return _0x6dfebd;});})['then'](function(){_0x5927b8[_0x4b13('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2a9b){return function(_0x18b5c1){if(!_0x18b5c1){_0x2c2a9b[_0x4b13('0xb')](0x194);}return _0x18b5c1;};}function handleError(_0x2d2aa0,_0x5bc27a){_0x5bc27a=_0x5bc27a||0x1f4;return function(_0x19850d){logger[_0x4b13('0x18')](_0x19850d[_0x4b13('0x19')]);if(_0x19850d[_0x4b13('0x1a')]){delete _0x19850d[_0x4b13('0x1a')];}_0x2d2aa0[_0x4b13('0xc')](_0x5bc27a)['send'](_0x19850d);};}exports[_0x4b13('0x1b')]=function(_0x3cae24,_0x447f6c){var _0x2f72fb={};var _0x5c49ba={'count':0x0,'rows':[]};var _0x383b2c=_[_0x4b13('0x1c')](db[_0x4b13('0x1d')][_0x4b13('0x1e')],function(_0x416b43){return{'name':_0x416b43[_0x4b13('0x1f')],'type':_0x416b43['type'][_0x4b13('0x20')]};});_0x2f72fb=qs['getOptions'](_0x383b2c,_0x3cae24);var _0x9190cc={'where':_0x2f72fb[_0x4b13('0x21')]};return db[_0x4b13('0x1d')][_0x4b13('0x10')](_0x9190cc)[_0x4b13('0x15')](function(_0x3fbe2f){_0x5c49ba['count']=_0x3fbe2f;_0x2f72fb[_0x4b13('0x22')]=qs[_0x4b13('0x22')](_0x3cae24[_0x4b13('0x23')]);return db['WhatsappQueue'][_0x4b13('0x24')](_0x2f72fb);})[_0x4b13('0x15')](function(_0x1b299e){_0x5c49ba[_0x4b13('0x25')]=_0x1b299e;return _0x5c49ba;})['then'](respondWithFilteredResult(_0x447f6c,_0x2f72fb))[_0x4b13('0x26')](handleError(_0x447f6c,null));};exports[_0x4b13('0x27')]=function(_0x69cca9,_0x47fed8){var _0x141444={'raw':!![],'where':{'id':_0x69cca9[_0x4b13('0x28')]['id']}},_0xf5df91={};_0xf5df91[_0x4b13('0x29')]=_['keys'](db[_0x4b13('0x1d')]['rawAttributes']);_0xf5df91[_0x4b13('0x23')]=_[_0x4b13('0x2a')](_0x69cca9[_0x4b13('0x23')]);_0xf5df91[_0x4b13('0x2b')]=_['intersection'](_0xf5df91[_0x4b13('0x29')],_0xf5df91[_0x4b13('0x23')]);_0x141444[_0x4b13('0x2c')]=_[_0x4b13('0x2d')](_0xf5df91['model'],qs['fields'](_0x69cca9[_0x4b13('0x23')][_0x4b13('0x2e')]));_0x141444[_0x4b13('0x2c')]=_0x141444[_0x4b13('0x2c')]['length']?_0x141444[_0x4b13('0x2c')]:_0xf5df91[_0x4b13('0x29')];if(_0x69cca9[_0x4b13('0x23')]['includeAll']){_0x141444['include']=[{'all':!![]}];}_0x141444=_[_0x4b13('0x2f')]({},_0x141444,_0x69cca9['options']);return db['WhatsappQueue']['find'](_0x141444)[_0x4b13('0x15')](handleEntityNotFound(_0x47fed8,null))[_0x4b13('0x15')](respondWithResult(_0x47fed8,null))[_0x4b13('0x26')](handleError(_0x47fed8,null));};exports[_0x4b13('0x30')]=function(_0x518d88,_0x282c43){return db[_0x4b13('0x1d')][_0x4b13('0x30')](_0x518d88[_0x4b13('0x31')],{})[_0x4b13('0x15')](function(_0x1a79bf){var _0x40f27e=_0x518d88['user'][_0x4b13('0x16')]({'plain':!![]});if(!_0x40f27e)throw new Error(_0x4b13('0x32'));if(_0x40f27e['role']===_0x4b13('0x33')){var _0x27e110=_0x1a79bf[_0x4b13('0x16')]({'plain':!![]});var _0x5ac1ad=_0x4b13('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x5ac1ad,'userProfileId':_0x40f27e[_0x4b13('0x35')]},'raw':!![]})[_0x4b13('0x15')](function(_0x2b2339){if(_0x2b2339&&_0x2b2339[_0x4b13('0x36')]===0x0){return db[_0x4b13('0x17')]['create']({'name':_0x27e110[_0x4b13('0x1a')],'resourceId':_0x27e110['id'],'type':_0x2b2339['name'],'sectionId':_0x2b2339['id']},{})[_0x4b13('0x15')](function(){return _0x1a79bf;});}else{return _0x1a79bf;}})[_0x4b13('0x26')](function(_0x5bcf91){logger[_0x4b13('0x18')](_0x4b13('0x37'),_0x5bcf91);throw _0x5bcf91;});}return _0x1a79bf;})['then'](respondWithResult(_0x282c43,0xc9))[_0x4b13('0x26')](handleError(_0x282c43,null));};exports[_0x4b13('0x38')]=function(_0xc2ac90,_0x5adb44){if(_0xc2ac90[_0x4b13('0x31')]['id']){delete _0xc2ac90['body']['id'];}return db[_0x4b13('0x1d')][_0x4b13('0x39')]({'where':{'id':_0xc2ac90[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](handleEntityNotFound(_0x5adb44,null))[_0x4b13('0x15')](saveUpdates(_0xc2ac90[_0x4b13('0x31')],null))['then'](respondWithResult(_0x5adb44,null))[_0x4b13('0x26')](handleError(_0x5adb44,null));};exports[_0x4b13('0x14')]=function(_0x536435,_0x1e2edc){return db['WhatsappQueue']['find']({'where':{'id':_0x536435[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](handleEntityNotFound(_0x1e2edc,null))[_0x4b13('0x15')](removeEntity(_0x1e2edc,null))[_0x4b13('0x26')](handleError(_0x1e2edc,null));};exports[_0x4b13('0x3a')]=function(_0x5f4354,_0x18d907){return db['WhatsappQueue'][_0x4b13('0x3a')]()[_0x4b13('0x15')](respondWithResult(_0x18d907,null))[_0x4b13('0x26')](handleError(_0x18d907,null));};exports['getMembers']=function(_0x14f044,_0x47b427){var _0x57d34c={'raw':!![],'where':{}},_0x425908={},_0x19e20d;return db[_0x4b13('0x1d')][_0x4b13('0x3b')]({'where':{'id':_0x14f044['params']['id']}})[_0x4b13('0x15')](handleEntityNotFound(_0x47b427,null))['then'](function(_0x48ce08){if(_0x48ce08){_0x19e20d=_0x48ce08[_0x4b13('0x16')]({'plain':!![]});_0x425908['model']=_['keys'](db[_0x4b13('0x3c')][_0x4b13('0x1e')]);_0x425908[_0x4b13('0x23')]=_[_0x4b13('0x2a')](_0x14f044[_0x4b13('0x23')]);_0x425908['filters']=_[_0x4b13('0x2d')](_0x425908[_0x4b13('0x29')],_0x425908['query']);_0x57d34c['attributes']=_[_0x4b13('0x2d')](_0x425908[_0x4b13('0x29')],qs[_0x4b13('0x2e')](_0x14f044[_0x4b13('0x23')]['fields']));_0x57d34c[_0x4b13('0x2c')]=_0x57d34c['attributes'][_0x4b13('0x3d')]?_0x57d34c[_0x4b13('0x2c')]:_0x425908['model'];if(!_0x14f044[_0x4b13('0x23')]['hasOwnProperty']('nolimit')){_0x57d34c['limit']=qs[_0x4b13('0x3e')](_0x14f044[_0x4b13('0x23')][_0x4b13('0x3e')]);_0x57d34c[_0x4b13('0x11')]=qs[_0x4b13('0x11')](_0x14f044[_0x4b13('0x23')][_0x4b13('0x11')]);}_0x57d34c['order']=qs[_0x4b13('0x3f')](_0x14f044[_0x4b13('0x23')][_0x4b13('0x3f')]);_0x57d34c[_0x4b13('0x21')]=qs['filters'](_[_0x4b13('0x40')](_0x14f044['query'],_0x425908[_0x4b13('0x2b')]));_0x57d34c[_0x4b13('0x21')][_0x4b13('0x41')]=_0x48ce08['id'];if(_0x14f044[_0x4b13('0x23')][_0x4b13('0x42')]){_0x57d34c[_0x4b13('0x21')]=_[_0x4b13('0x2f')](_0x57d34c['where'],{'$or':_[_0x4b13('0x1c')](_0x57d34c[_0x4b13('0x2c')],function(_0x5a25c5){var _0x517166={};_0x517166[_0x5a25c5]={'$like':'%'+_0x14f044[_0x4b13('0x23')][_0x4b13('0x42')]+'%'};return _0x517166;})});}_0x57d34c=_[_0x4b13('0x2f')]({},_0x57d34c,_0x14f044['options']);return db[_0x4b13('0x3c')][_0x4b13('0x24')](_0x57d34c);}})['then'](function(_0x461e2e){if(_0x461e2e){return db[_0x4b13('0x43')]['findAndCountAll']({'where':{'id':_[_0x4b13('0x1c')](_0x461e2e,_0x4b13('0x44')),'role':'agent'},'attributes':['id',_0x4b13('0x1a'),_0x4b13('0x45'),_0x4b13('0x46'),_0x4b13('0x47')]});}})['then'](function(_0x215449){if(_0x215449){return{'count':_0x215449[_0x4b13('0x10')],'rows':_[_0x4b13('0x1c')](_0x215449[_0x4b13('0x25')],function(_0x3b3bb4){return{'membername':_0x3b3bb4[_0x4b13('0x1a')],'UserId':_0x3b3bb4['id'],'queue_name':_0x19e20d[_0x4b13('0x1a')],'WhatsappQueueId':_0x19e20d['id'],'interface':util[_0x4b13('0x48')](_0x4b13('0x49'),_0x4b13('0x4a'),_0x3b3bb4[_0x4b13('0x1a')]),'penalty':0x0,'paused':_0x3b3bb4[_0x4b13('0x45')],'createdAt':_0x3b3bb4['createdAt'],'updatedAt':_0x3b3bb4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b13('0x15')](respondWithFilteredResult(_0x47b427,_0x57d34c))['catch'](handleError(_0x47b427,null));};exports[_0x4b13('0x4b')]=function(_0x161dd8,_0x3862dc){var _0xcb6a1d={};var _0x392ef0={};var _0xfa5bf;var _0x3cd4ba;return db[_0x4b13('0x1d')]['findOne']({'where':{'id':_0x161dd8['params']['id']}})['then'](handleEntityNotFound(_0x3862dc,null))[_0x4b13('0x15')](function(_0x48a5fe){if(_0x48a5fe){_0xfa5bf=_0x48a5fe;_0x392ef0[_0x4b13('0x29')]=_[_0x4b13('0x2a')](db['Team'][_0x4b13('0x1e')]);_0x392ef0[_0x4b13('0x23')]=_[_0x4b13('0x2a')](_0x161dd8[_0x4b13('0x23')]);_0x392ef0['filters']=_[_0x4b13('0x2d')](_0x392ef0[_0x4b13('0x29')],_0x392ef0[_0x4b13('0x23')]);_0xcb6a1d[_0x4b13('0x2c')]=_['intersection'](_0x392ef0['model'],qs[_0x4b13('0x2e')](_0x161dd8[_0x4b13('0x23')][_0x4b13('0x2e')]));_0xcb6a1d['attributes']=_0xcb6a1d[_0x4b13('0x2c')][_0x4b13('0x3d')]?_0xcb6a1d[_0x4b13('0x2c')]:_0x392ef0[_0x4b13('0x29')];_0xcb6a1d['order']=qs['sort'](_0x161dd8[_0x4b13('0x23')]['sort']);_0xcb6a1d[_0x4b13('0x21')]=qs['filters'](_[_0x4b13('0x40')](_0x161dd8['query'],_0x392ef0['filters']));if(_0x161dd8['query'][_0x4b13('0x42')]){_0xcb6a1d['where']=_[_0x4b13('0x2f')](_0xcb6a1d[_0x4b13('0x21')],{'$or':_[_0x4b13('0x1c')](_0xcb6a1d[_0x4b13('0x2c')],function(_0x513005){var _0x1035a5={};_0x1035a5[_0x513005]={'$like':'%'+_0x161dd8['query'][_0x4b13('0x42')]+'%'};return _0x1035a5;})});}_0xcb6a1d=_[_0x4b13('0x2f')]({},_0xcb6a1d,_0x161dd8[_0x4b13('0x4c')]);return _0xfa5bf['getTeams'](_0xcb6a1d);}})[_0x4b13('0x15')](function(_0xbf98c0){if(_0xbf98c0){_0x3cd4ba=_0xbf98c0[_0x4b13('0x3d')];if(!_0x161dd8['query'][_0x4b13('0x4d')](_0x4b13('0x4e'))){_0xcb6a1d[_0x4b13('0x3e')]=qs[_0x4b13('0x3e')](_0x161dd8[_0x4b13('0x23')][_0x4b13('0x3e')]);_0xcb6a1d[_0x4b13('0x11')]=qs['offset'](_0x161dd8['query'][_0x4b13('0x11')]);}return _0xfa5bf[_0x4b13('0x4b')](_0xcb6a1d);}})[_0x4b13('0x15')](function(_0x2639b0){if(_0x2639b0){return _0x2639b0?{'count':_0x3cd4ba,'rows':_0x2639b0}:null;}})['then'](respondWithResult(_0x3862dc,null))[_0x4b13('0x26')](handleError(_0x3862dc,null));};exports[_0x4b13('0x4f')]=function(_0x46ca62,_0x4a8889){var _0x348e76=_0x46ca62['body'][_0x4b13('0x50')];return db[_0x4b13('0x51')][_0x4b13('0x24')]({'where':{'id':_0x348e76},'attributes':['id'],'include':[{'model':db[_0x4b13('0x43')],'as':_0x4b13('0x52'),'attributes':['id',_0x4b13('0x1a'),_0x4b13('0x53'),'voicePause',_0x4b13('0x54')],'raw':!![]}]})[_0x4b13('0x15')](function(_0x2b7a78){if(_0x2b7a78){var _0x17f080=_['flatMap'](_0x2b7a78,function(_0x9f85e8){var _0x3b94ee=_0x9f85e8['get']({'plain':!![]});return _0x3b94ee[_0x4b13('0x52')];});return db[_0x4b13('0x1d')][_0x4b13('0x39')]({'where':{'id':_0x46ca62[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](function(_0x14f968){return db['sequelize'][_0x4b13('0x55')](function(_0x57bbd9){return _0x14f968['addTeams'](_0x348e76,{'transaction':_0x57bbd9})[_0x4b13('0x15')](function(){return BPromise[_0x4b13('0x56')](_0x17f080,function(_0x387c98){return db['UserWhatsappQueue'][_0x4b13('0x57')]({'where':{'UserId':_0x387c98['id'],'WhatsappQueueId':_0x46ca62[_0x4b13('0x28')]['id']},'transaction':_0x57bbd9});});})[_0x4b13('0x15')](function(){_0x17f080['forEach'](function(_0x1ba73f){socket[_0x4b13('0x58')](_0x4b13('0x59'),{'UserId':_0x1ba73f['id'],'WhatsappQueueId':_0x14f968['id']});});});});});}})[_0x4b13('0x15')](respondWithStatusCode(_0x4a8889,null))[_0x4b13('0x26')](handleError(_0x4a8889,null));};exports[_0x4b13('0x5a')]=function(_0x271f84,_0xd68fc){return db[_0x4b13('0x51')]['findAll']({'where':{'id':_0x271f84[_0x4b13('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4b13('0x43')],'as':_0x4b13('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xd68fc,null))['then'](function(_0x1892f0){var _0x41b4ed=_[_0x4b13('0x1c')](_0x1892f0,'id');var _0x19b572=[];var _0x1adba9=[];var _0x300db3=squel[_0x4b13('0x5b')]();_0x300db3[_0x4b13('0x5c')]('tq.TeamId')[_0x4b13('0x5d')]('team_has_whatsapp_queues','tq')[_0x4b13('0x5e')](_0x4b13('0x5f'),'ut',_0x4b13('0x60'))[_0x4b13('0x21')](_0x4b13('0x61'),_0x271f84[_0x4b13('0x28')]['id']);for(var _0x4dae31=0x0;_0x4dae31<_0x1892f0[_0x4b13('0x3d')];_0x4dae31+=0x1){let _0x38c8a0=_0x1892f0[_0x4dae31];for(var _0x276dda=0x0;_0x276dda<_0x38c8a0[_0x4b13('0x52')]['length'];_0x276dda+=0x1){let _0x5e2520=_0x38c8a0[_0x4b13('0x52')][_0x276dda];var _0x2aefea=_0x300db3[_0x4b13('0x62')]();_0x2aefea[_0x4b13('0x21')](_0x4b13('0x63'),_0x5e2520['id']);_0x1adba9['push'](db[_0x4b13('0x64')][_0x4b13('0x23')](_0x2aefea[_0x4b13('0x65')](),{'type':db['sequelize']['QueryTypes'][_0x4b13('0x66')]})[_0x4b13('0x15')](function(_0x35a9eb){if(_0x35a9eb['length']===0x1){return _0x5e2520['id'];}else{var _0x1270cc=_[_0x4b13('0x67')](_[_0x4b13('0x1c')](_0x35a9eb,_0x4b13('0x68')),function(_0x4c373f){return _[_0x4b13('0x69')](_0x41b4ed,_0x4c373f);});if(_0x1270cc){return _0x5e2520['id'];}}}));}}return BPromise[_0x4b13('0x6a')](_0x1adba9)[_0x4b13('0x15')](function(_0x5004ea){_0x19b572=_(_0x19b572)[_0x4b13('0x6b')](_0x5004ea)[_0x4b13('0x6c')]()[_0x4b13('0x6d')]();return db[_0x4b13('0x1d')]['find']({'where':{'id':_0x271f84[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](function(_0x5c6955){return db[_0x4b13('0x64')]['transaction'](function(_0xaefe25){return _0x5c6955[_0x4b13('0x5a')](_0x271f84[_0x4b13('0x23')][_0x4b13('0x50')],{'transaction':_0xaefe25})[_0x4b13('0x15')](function(){if(!_[_0x4b13('0x6e')](_0x19b572)){return _0x5c6955[_0x4b13('0x6f')](_0x19b572,{'transaction':_0xaefe25});}})[_0x4b13('0x15')](function(){_0x19b572[_0x4b13('0x70')](function(_0x316666){socket['emit'](_0x4b13('0x71'),{'UserId':_0x316666,'WhatsappQueueId':_0x5c6955['id']});});});});});});})['then'](respondWithStatusCode(_0xd68fc,null))['catch'](handleError(_0xd68fc,null));};exports['addAgents']=function(_0x3076ab,_0x188092){return db[_0x4b13('0x1d')]['find']({'where':{'id':_0x3076ab['params']['id']}})['then'](handleEntityNotFound(_0x188092,null))[_0x4b13('0x15')](function(_0xfcabad){if(_0xfcabad){return _0xfcabad[_0x4b13('0x72')](_0x3076ab[_0x4b13('0x31')][_0x4b13('0x50')],_[_0x4b13('0x73')](_0x3076ab[_0x4b13('0x31')],['ids','id'])||{})[_0x4b13('0x74')](function(_0x38432f){for(var _0x566856=0x0;_0x566856<_0x3076ab[_0x4b13('0x31')][_0x4b13('0x50')][_0x4b13('0x3d')];_0x566856+=0x1){socket[_0x4b13('0x58')](_0x4b13('0x59'),{'UserId':Number(_0x3076ab[_0x4b13('0x31')]['ids'][_0x566856]),'WhatsappQueueId':Number(_0x3076ab[_0x4b13('0x28')]['id'])});}return _0x38432f;});}})['then'](respondWithResult(_0x188092,null))[_0x4b13('0x26')](handleError(_0x188092,null));};exports[_0x4b13('0x6f')]=function(_0x52d391,_0x2b0863){return db[_0x4b13('0x1d')][_0x4b13('0x39')]({'where':{'id':_0x52d391[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](handleEntityNotFound(_0x2b0863,null))[_0x4b13('0x15')](function(_0x30f7f9){if(_0x30f7f9){return _0x30f7f9[_0x4b13('0x6f')](_0x52d391[_0x4b13('0x23')][_0x4b13('0x50')])['then'](function(){if(_[_0x4b13('0x75')](_0x52d391[_0x4b13('0x23')][_0x4b13('0x50')])){for(var _0x1c21c5=0x0;_0x1c21c5<_0x52d391['query'][_0x4b13('0x50')]['length'];_0x1c21c5+=0x1){socket[_0x4b13('0x58')](_0x4b13('0x71'),{'UserId':Number(_0x52d391['query']['ids'][_0x1c21c5]),'WhatsappQueueId':Number(_0x52d391['params']['id'])});}}else{socket[_0x4b13('0x58')]('userWhatsappQueue:remove',{'UserId':Number(_0x52d391[_0x4b13('0x23')]['ids']),'WhatsappQueueId':Number(_0x52d391[_0x4b13('0x28')]['id'])});}});}})[_0x4b13('0x15')](respondWithStatusCode(_0x2b0863,null))[_0x4b13('0x26')](handleError(_0x2b0863,null));};exports[_0x4b13('0x76')]=function(_0x38f73d,_0x33ed91){var _0x26f5b4={};var _0x4fbf37={};var _0x723bcc;var _0x3a0d64;return db['WhatsappQueue'][_0x4b13('0x3b')]({'where':{'id':_0x38f73d[_0x4b13('0x28')]['id']}})[_0x4b13('0x15')](handleEntityNotFound(_0x33ed91,null))[_0x4b13('0x15')](function(_0x4d8541){if(_0x4d8541){_0x723bcc=_0x4d8541;_0x4fbf37['model']=_[_0x4b13('0x2a')](db['User']['rawAttributes']);_0x4fbf37[_0x4b13('0x23')]=_[_0x4b13('0x2a')](_0x38f73d[_0x4b13('0x23')]);_0x4fbf37[_0x4b13('0x2b')]=_['intersection'](_0x4fbf37[_0x4b13('0x29')],_0x4fbf37[_0x4b13('0x23')]);_0x26f5b4[_0x4b13('0x2c')]=_[_0x4b13('0x2d')](_0x4fbf37[_0x4b13('0x29')],qs['fields'](_0x38f73d[_0x4b13('0x23')][_0x4b13('0x2e')]));_0x26f5b4[_0x4b13('0x2c')]=_0x26f5b4[_0x4b13('0x2c')][_0x4b13('0x3d')]?_0x26f5b4['attributes']:_0x4fbf37['model'];_0x26f5b4[_0x4b13('0x77')]=qs[_0x4b13('0x3f')](_0x38f73d[_0x4b13('0x23')][_0x4b13('0x3f')]);_0x26f5b4['where']=qs[_0x4b13('0x2b')](_[_0x4b13('0x40')](_0x38f73d['query'],_0x4fbf37['filters']));if(_0x38f73d['query']['filter']){_0x26f5b4['where']=_['merge'](_0x26f5b4[_0x4b13('0x21')],{'$or':_[_0x4b13('0x1c')](_0x26f5b4['attributes'],function(_0x867597){var _0x266bd6={};_0x266bd6[_0x867597]={'$like':'%'+_0x38f73d[_0x4b13('0x23')]['filter']+'%'};return _0x266bd6;})});}_0x26f5b4=_[_0x4b13('0x2f')]({},_0x26f5b4,_0x38f73d['options']);return _0x723bcc[_0x4b13('0x76')](_0x26f5b4);}})[_0x4b13('0x15')](function(_0x51416d){if(_0x51416d){_0x3a0d64=_0x51416d[_0x4b13('0x3d')];if(!_0x38f73d[_0x4b13('0x23')][_0x4b13('0x4d')](_0x4b13('0x4e'))){_0x26f5b4['limit']=qs['limit'](_0x38f73d['query']['limit']);_0x26f5b4[_0x4b13('0x11')]=qs['offset'](_0x38f73d['query'][_0x4b13('0x11')]);}return _0x723bcc[_0x4b13('0x76')](_0x26f5b4);}})[_0x4b13('0x15')](function(_0x3db5ba){if(_0x3db5ba){return _0x3db5ba?{'count':_0x3a0d64,'rows':_0x3db5ba}:null;}})['then'](respondWithResult(_0x33ed91,null))[_0x4b13('0x26')](handleError(_0x33ed91,null));}; \ No newline at end of file +var _0x9090=['key','getOptions','where','include','findAll','rows','catch','params','query','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','options','addTeams','voicePause','interface','sequelize','transaction','each','forEach','emit','ids','Agents','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9090,0x1bf));var _0x0909=function(_0x53bd6e,_0x4565d7){_0x53bd6e=_0x53bd6e-0x0;var _0x452812=_0x9090[_0x53bd6e];return _0x452812;};'use strict';var BPromise=require(_0x0909('0x0'));var util=require(_0x0909('0x1'));var _=require(_0x0909('0x2'));var squel=require(_0x0909('0x3'));var Redis=require(_0x0909('0x4'));var qs=require(_0x0909('0x5'));var logger=require(_0x0909('0x6'))(_0x0909('0x7'));var config=require('../../config/environment');var db=require(_0x0909('0x8'))['db'];config['redis']=_['defaults'](config[_0x0909('0x9')],{'host':_0x0909('0xa'),'port':0x18eb});var socket=require(_0x0909('0xb'))(new Redis(config['redis']));require(_0x0909('0xc'))['register'](socket);function respondWithStatusCode(_0x428b65,_0x31e8bf){_0x31e8bf=_0x31e8bf||0xcc;return function(_0x3d0325){if(_0x3d0325){return _0x428b65[_0x0909('0xd')](_0x31e8bf);}return _0x428b65['status'](_0x31e8bf)[_0x0909('0xe')]();};}function respondWithResult(_0x191315,_0x525ee7){_0x525ee7=_0x525ee7||0xc8;return function(_0x1b529b){if(_0x1b529b){return _0x191315[_0x0909('0xf')](_0x525ee7)[_0x0909('0x10')](_0x1b529b);}};}function respondWithFilteredResult(_0x5e519e,_0x381d72){return function(_0x540b18){if(_0x540b18){var _0x6287ef=typeof _0x381d72[_0x0909('0x11')]===_0x0909('0x12')&&typeof _0x381d72[_0x0909('0x13')]===_0x0909('0x12');var _0x2810e4=_0x540b18[_0x0909('0x14')];var _0x3b87ae=_0x6287ef?0x0:_0x381d72[_0x0909('0x11')];var _0x36fb2e=_0x6287ef?_0x540b18[_0x0909('0x14')]:_0x381d72['offset']+_0x381d72[_0x0909('0x13')];var _0x194139;if(_0x36fb2e>=_0x2810e4){_0x36fb2e=_0x2810e4;_0x194139=0xc8;}else{_0x194139=0xce;}_0x5e519e[_0x0909('0xf')](_0x194139);return _0x5e519e[_0x0909('0x15')](_0x0909('0x16'),_0x3b87ae+'-'+_0x36fb2e+'/'+_0x2810e4)[_0x0909('0x10')](_0x540b18);}return null;};}function saveUpdates(_0x5de227){return function(_0x489bc8){if(_0x489bc8){return _0x489bc8[_0x0909('0x17')](_0x5de227)[_0x0909('0x18')](function(_0x47c3bf){return _0x47c3bf;});}return null;};}function removeEntity(_0x31f5f4){return function(_0xc9876b){if(_0xc9876b){return _0xc9876b[_0x0909('0x19')]()[_0x0909('0x18')](function(){var _0x5b8c3b=_0xc9876b[_0x0909('0x1a')]({'plain':!![]});var _0x364415=_0x0909('0x1b');return db[_0x0909('0x1c')][_0x0909('0x19')]({'where':{'type':_0x364415,'resourceId':_0x5b8c3b['id']}})[_0x0909('0x18')](function(){return _0xc9876b;});})[_0x0909('0x18')](function(){_0x31f5f4['status'](0xcc)[_0x0909('0xe')]();});}};}function handleEntityNotFound(_0x5880ad){return function(_0x49cd96){if(!_0x49cd96){_0x5880ad[_0x0909('0xd')](0x194);}return _0x49cd96;};}function handleError(_0xfa7d06,_0x66bd93){_0x66bd93=_0x66bd93||0x1f4;return function(_0x4f8fa1){logger[_0x0909('0x1d')](_0x4f8fa1['stack']);if(_0x4f8fa1[_0x0909('0x1e')]){delete _0x4f8fa1[_0x0909('0x1e')];}_0xfa7d06[_0x0909('0xf')](_0x66bd93)[_0x0909('0x1f')](_0x4f8fa1);};}exports[_0x0909('0x20')]=function(_0x3b3dbc,_0x3fa297){var _0x21f5e4={};var _0x4534ad={'count':0x0,'rows':[]};var _0x504969=_[_0x0909('0x21')](db[_0x0909('0x22')][_0x0909('0x23')],function(_0x361ecc){return{'name':_0x361ecc[_0x0909('0x24')],'type':_0x361ecc['type'][_0x0909('0x25')]};});_0x21f5e4=qs[_0x0909('0x26')](_0x504969,_0x3b3dbc);var _0x221db6={'where':_0x21f5e4[_0x0909('0x27')]};return db[_0x0909('0x22')][_0x0909('0x14')](_0x221db6)[_0x0909('0x18')](function(_0x5b9669){_0x4534ad[_0x0909('0x14')]=_0x5b9669;_0x21f5e4['include']=qs[_0x0909('0x28')](_0x3b3dbc['query']);return db[_0x0909('0x22')][_0x0909('0x29')](_0x21f5e4);})[_0x0909('0x18')](function(_0x96b62){_0x4534ad[_0x0909('0x2a')]=_0x96b62;return _0x4534ad;})[_0x0909('0x18')](respondWithFilteredResult(_0x3fa297,_0x21f5e4))[_0x0909('0x2b')](handleError(_0x3fa297,null));};exports['show']=function(_0x547eff,_0x40f092){var _0x16caa0={'raw':!![],'where':{'id':_0x547eff[_0x0909('0x2c')]['id']}},_0x6639d1={};_0x6639d1['model']=_['keys'](db[_0x0909('0x22')][_0x0909('0x23')]);_0x6639d1[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x547eff['query']);_0x6639d1[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x6639d1[_0x0909('0x31')],_0x6639d1[_0x0909('0x2d')]);_0x16caa0[_0x0909('0x32')]=_[_0x0909('0x30')](_0x6639d1[_0x0909('0x31')],qs['fields'](_0x547eff[_0x0909('0x2d')][_0x0909('0x33')]));_0x16caa0[_0x0909('0x32')]=_0x16caa0[_0x0909('0x32')][_0x0909('0x34')]?_0x16caa0[_0x0909('0x32')]:_0x6639d1[_0x0909('0x31')];if(_0x547eff[_0x0909('0x2d')][_0x0909('0x35')]){_0x16caa0[_0x0909('0x28')]=[{'all':!![]}];}_0x16caa0=_[_0x0909('0x36')]({},_0x16caa0,_0x547eff['options']);return db[_0x0909('0x22')][_0x0909('0x37')](_0x16caa0)[_0x0909('0x18')](handleEntityNotFound(_0x40f092,null))['then'](respondWithResult(_0x40f092,null))['catch'](handleError(_0x40f092,null));};exports[_0x0909('0x38')]=function(_0x29205d,_0x2ff370){return db[_0x0909('0x22')][_0x0909('0x38')](_0x29205d[_0x0909('0x39')],{})[_0x0909('0x18')](function(_0x538aa7){var _0x5950fa=_0x29205d[_0x0909('0x3a')][_0x0909('0x1a')]({'plain':!![]});if(!_0x5950fa)throw new Error(_0x0909('0x3b'));if(_0x5950fa[_0x0909('0x3c')]===_0x0909('0x3a')){var _0x3a9315=_0x538aa7['get']({'plain':!![]});var _0x23ff6b='WhatsappQueues';return db[_0x0909('0x3d')]['find']({'where':{'name':_0x23ff6b,'userProfileId':_0x5950fa[_0x0909('0x3e')]},'raw':!![]})[_0x0909('0x18')](function(_0x50cdf0){if(_0x50cdf0&&_0x50cdf0[_0x0909('0x3f')]===0x0){return db[_0x0909('0x1c')][_0x0909('0x38')]({'name':_0x3a9315[_0x0909('0x1e')],'resourceId':_0x3a9315['id'],'type':_0x50cdf0['name'],'sectionId':_0x50cdf0['id']},{})[_0x0909('0x18')](function(){return _0x538aa7;});}else{return _0x538aa7;}})[_0x0909('0x2b')](function(_0x113354){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113354);throw _0x113354;});}return _0x538aa7;})[_0x0909('0x18')](respondWithResult(_0x2ff370,0xc9))[_0x0909('0x2b')](handleError(_0x2ff370,null));};exports[_0x0909('0x17')]=function(_0x562a16,_0x2b3889){if(_0x562a16[_0x0909('0x39')]['id']){delete _0x562a16[_0x0909('0x39')]['id'];}return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x562a16[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x2b3889,null))[_0x0909('0x18')](saveUpdates(_0x562a16['body'],null))[_0x0909('0x18')](respondWithResult(_0x2b3889,null))[_0x0909('0x2b')](handleError(_0x2b3889,null));};exports[_0x0909('0x19')]=function(_0x41dab1,_0x5232ca){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x41dab1[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x5232ca,null))['then'](removeEntity(_0x5232ca,null))[_0x0909('0x2b')](handleError(_0x5232ca,null));};exports[_0x0909('0x40')]=function(_0x3d701e,_0x208286){return db['WhatsappQueue'][_0x0909('0x40')]()[_0x0909('0x18')](respondWithResult(_0x208286,null))[_0x0909('0x2b')](handleError(_0x208286,null));};exports['getMembers']=function(_0x2fc061,_0x39a654){var _0x51dd54={'raw':!![],'where':{}},_0x167b62={},_0x3b826e;return db[_0x0909('0x22')][_0x0909('0x41')]({'where':{'id':_0x2fc061[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x39a654,null))[_0x0909('0x18')](function(_0x47742d){if(_0x47742d){_0x3b826e=_0x47742d[_0x0909('0x1a')]({'plain':!![]});_0x167b62[_0x0909('0x31')]=_[_0x0909('0x2e')](db[_0x0909('0x42')][_0x0909('0x23')]);_0x167b62[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x2fc061[_0x0909('0x2d')]);_0x167b62[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x167b62[_0x0909('0x31')],_0x167b62['query']);_0x51dd54[_0x0909('0x32')]=_['intersection'](_0x167b62['model'],qs[_0x0909('0x33')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x33')]));_0x51dd54[_0x0909('0x32')]=_0x51dd54[_0x0909('0x32')][_0x0909('0x34')]?_0x51dd54[_0x0909('0x32')]:_0x167b62['model'];if(!_0x2fc061[_0x0909('0x2d')][_0x0909('0x43')](_0x0909('0x44'))){_0x51dd54[_0x0909('0x13')]=qs[_0x0909('0x13')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x13')]);_0x51dd54[_0x0909('0x11')]=qs[_0x0909('0x11')](_0x2fc061[_0x0909('0x2d')][_0x0909('0x11')]);}_0x51dd54[_0x0909('0x45')]=qs['sort'](_0x2fc061[_0x0909('0x2d')][_0x0909('0x46')]);_0x51dd54['where']=qs[_0x0909('0x2f')](_[_0x0909('0x47')](_0x2fc061[_0x0909('0x2d')],_0x167b62[_0x0909('0x2f')]));_0x51dd54[_0x0909('0x27')][_0x0909('0x48')]=_0x47742d['id'];if(_0x2fc061[_0x0909('0x2d')][_0x0909('0x49')]){_0x51dd54[_0x0909('0x27')]=_[_0x0909('0x36')](_0x51dd54[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x51dd54[_0x0909('0x32')],function(_0x329a3b){var _0x1f747e={};_0x1f747e[_0x329a3b]={'$like':'%'+_0x2fc061[_0x0909('0x2d')][_0x0909('0x49')]+'%'};return _0x1f747e;})});}_0x51dd54=_[_0x0909('0x36')]({},_0x51dd54,_0x2fc061['options']);return db['UserWhatsappQueue'][_0x0909('0x29')](_0x51dd54);}})['then'](function(_0x22577e){if(_0x22577e){return db[_0x0909('0x4a')][_0x0909('0x4b')]({'where':{'id':_[_0x0909('0x21')](_0x22577e,_0x0909('0x4c')),'role':_0x0909('0x4d')},'attributes':['id',_0x0909('0x1e'),'whatsappPause',_0x0909('0x4e'),_0x0909('0x4f')]});}})[_0x0909('0x18')](function(_0x243181){if(_0x243181){return{'count':_0x243181[_0x0909('0x14')],'rows':_[_0x0909('0x21')](_0x243181[_0x0909('0x2a')],function(_0x114828){return{'membername':_0x114828[_0x0909('0x1e')],'UserId':_0x114828['id'],'queue_name':_0x3b826e[_0x0909('0x1e')],'WhatsappQueueId':_0x3b826e['id'],'interface':util[_0x0909('0x50')](_0x0909('0x51'),_0x0909('0x52'),_0x114828[_0x0909('0x1e')]),'penalty':0x0,'paused':_0x114828[_0x0909('0x53')],'createdAt':_0x114828[_0x0909('0x4f')],'updatedAt':_0x114828[_0x0909('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0909('0x18')](respondWithFilteredResult(_0x39a654,_0x51dd54))[_0x0909('0x2b')](handleError(_0x39a654,null));};exports[_0x0909('0x54')]=function(_0x4ddf00,_0x12c4ac){var _0x4cedbe={};var _0x50f23d={};var _0x4a16e5;var _0x19bca2;return db[_0x0909('0x22')][_0x0909('0x41')]({'where':{'id':_0x4ddf00[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x12c4ac,null))[_0x0909('0x18')](function(_0x5d7cf4){if(_0x5d7cf4){_0x4a16e5=_0x5d7cf4;_0x50f23d['model']=_['keys'](db[_0x0909('0x55')][_0x0909('0x23')]);_0x50f23d[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x4ddf00[_0x0909('0x2d')]);_0x50f23d[_0x0909('0x2f')]=_[_0x0909('0x30')](_0x50f23d[_0x0909('0x31')],_0x50f23d[_0x0909('0x2d')]);_0x4cedbe[_0x0909('0x32')]=_[_0x0909('0x30')](_0x50f23d[_0x0909('0x31')],qs[_0x0909('0x33')](_0x4ddf00[_0x0909('0x2d')][_0x0909('0x33')]));_0x4cedbe[_0x0909('0x32')]=_0x4cedbe[_0x0909('0x32')][_0x0909('0x34')]?_0x4cedbe['attributes']:_0x50f23d[_0x0909('0x31')];_0x4cedbe[_0x0909('0x45')]=qs['sort'](_0x4ddf00['query'][_0x0909('0x46')]);_0x4cedbe[_0x0909('0x27')]=qs[_0x0909('0x2f')](_[_0x0909('0x47')](_0x4ddf00[_0x0909('0x2d')],_0x50f23d[_0x0909('0x2f')]));if(_0x4ddf00[_0x0909('0x2d')][_0x0909('0x49')]){_0x4cedbe['where']=_['merge'](_0x4cedbe[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x4cedbe[_0x0909('0x32')],function(_0x35b7a8){var _0x402c1a={};_0x402c1a[_0x35b7a8]={'$like':'%'+_0x4ddf00[_0x0909('0x2d')]['filter']+'%'};return _0x402c1a;})});}_0x4cedbe=_[_0x0909('0x36')]({},_0x4cedbe,_0x4ddf00[_0x0909('0x56')]);return _0x4a16e5[_0x0909('0x54')](_0x4cedbe);}})[_0x0909('0x18')](function(_0x2203eb){if(_0x2203eb){_0x19bca2=_0x2203eb['length'];if(!_0x4ddf00[_0x0909('0x2d')][_0x0909('0x43')]('nolimit')){_0x4cedbe['limit']=qs[_0x0909('0x13')](_0x4ddf00['query']['limit']);_0x4cedbe[_0x0909('0x11')]=qs[_0x0909('0x11')](_0x4ddf00['query'][_0x0909('0x11')]);}return _0x4a16e5[_0x0909('0x54')](_0x4cedbe);}})[_0x0909('0x18')](function(_0x5eec4d){if(_0x5eec4d){return _0x5eec4d?{'count':_0x19bca2,'rows':_0x5eec4d}:null;}})[_0x0909('0x18')](respondWithResult(_0x12c4ac,null))['catch'](handleError(_0x12c4ac,null));};exports[_0x0909('0x57')]=function(_0x585776,_0x250977){var _0x3d6988=_0x585776[_0x0909('0x39')]['ids'];return db[_0x0909('0x55')]['findAll']({'where':{'id':_0x3d6988},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0909('0x1e'),'online',_0x0909('0x58'),_0x0909('0x59')],'raw':!![]}]})[_0x0909('0x18')](function(_0x1d63e1){if(_0x1d63e1){var _0x412e5f=_['flatMap'](_0x1d63e1,function(_0x5b81d7){var _0x5bd961=_0x5b81d7['get']({'plain':!![]});return _0x5bd961['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x585776[_0x0909('0x2c')]['id']}})['then'](function(_0x5c3bb){return db[_0x0909('0x5a')][_0x0909('0x5b')](function(_0x1a30d5){return _0x5c3bb[_0x0909('0x57')](_0x3d6988,{'transaction':_0x1a30d5})[_0x0909('0x18')](function(){return BPromise[_0x0909('0x5c')](_0x412e5f,function(_0x4535ed){return db[_0x0909('0x42')]['findOrCreate']({'where':{'UserId':_0x4535ed['id'],'WhatsappQueueId':_0x585776[_0x0909('0x2c')]['id']},'transaction':_0x1a30d5});});})['then'](function(){_0x412e5f[_0x0909('0x5d')](function(_0x3b5719){socket[_0x0909('0x5e')]('userWhatsappQueue:save',{'UserId':_0x3b5719['id'],'WhatsappQueueId':_0x5c3bb['id']});});});});});}})[_0x0909('0x18')](respondWithStatusCode(_0x250977,null))[_0x0909('0x2b')](handleError(_0x250977,null));};exports['removeTeams']=function(_0x266f84,_0x48407b){return db[_0x0909('0x55')][_0x0909('0x29')]({'where':{'id':_0x266f84[_0x0909('0x2d')][_0x0909('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x0909('0x4a')],'as':_0x0909('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x48407b,null))[_0x0909('0x18')](function(_0x3b3e80){var _0x420194=_[_0x0909('0x21')](_0x3b3e80,'id');var _0x2b1b31=[];var _0x1f73dd=[];var _0x44fe6d=squel[_0x0909('0x61')]();_0x44fe6d[_0x0909('0x62')](_0x0909('0x63'))['from'](_0x0909('0x64'),'tq')[_0x0909('0x65')](_0x0909('0x66'),'ut',_0x0909('0x67'))['where'](_0x0909('0x68'),_0x266f84[_0x0909('0x2c')]['id']);for(var _0x4ac299=0x0;_0x4ac299<_0x3b3e80[_0x0909('0x34')];_0x4ac299+=0x1){let _0x56ab0e=_0x3b3e80[_0x4ac299];for(var _0x250810=0x0;_0x250810<_0x56ab0e[_0x0909('0x60')]['length'];_0x250810+=0x1){let _0x3a0e3e=_0x56ab0e[_0x0909('0x60')][_0x250810];var _0x575e34=_0x44fe6d[_0x0909('0x69')]();_0x575e34[_0x0909('0x27')](_0x0909('0x6a'),_0x3a0e3e['id']);_0x1f73dd[_0x0909('0x6b')](db[_0x0909('0x5a')][_0x0909('0x2d')](_0x575e34['toString'](),{'type':db[_0x0909('0x5a')][_0x0909('0x6c')][_0x0909('0x6d')]})[_0x0909('0x18')](function(_0x8d9b52){if(_0x8d9b52[_0x0909('0x34')]===0x1){return _0x3a0e3e['id'];}else{var _0x269834=_['every'](_[_0x0909('0x21')](_0x8d9b52,'TeamId'),function(_0x318673){return _[_0x0909('0x6e')](_0x420194,_0x318673);});if(_0x269834){return _0x3a0e3e['id'];}}}));}}return BPromise[_0x0909('0x6f')](_0x1f73dd)[_0x0909('0x18')](function(_0x2146ab){_0x2b1b31=_(_0x2b1b31)['union'](_0x2146ab)['compact']()['value']();return db[_0x0909('0x22')]['find']({'where':{'id':_0x266f84[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](function(_0x3382f6){return db[_0x0909('0x5a')][_0x0909('0x5b')](function(_0x393ff2){return _0x3382f6[_0x0909('0x70')](_0x266f84['query'][_0x0909('0x5f')],{'transaction':_0x393ff2})['then'](function(){if(!_[_0x0909('0x71')](_0x2b1b31)){return _0x3382f6['removeAgents'](_0x2b1b31,{'transaction':_0x393ff2});}})[_0x0909('0x18')](function(){_0x2b1b31[_0x0909('0x5d')](function(_0x449893){socket[_0x0909('0x5e')](_0x0909('0x72'),{'UserId':_0x449893,'WhatsappQueueId':_0x3382f6['id']});});});});});});})['then'](respondWithStatusCode(_0x48407b,null))[_0x0909('0x2b')](handleError(_0x48407b,null));};exports[_0x0909('0x73')]=function(_0x1cc5fb,_0x22ca64){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x1cc5fb['params']['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x22ca64,null))[_0x0909('0x18')](function(_0x34b772){if(_0x34b772){return _0x34b772[_0x0909('0x73')](_0x1cc5fb[_0x0909('0x39')][_0x0909('0x5f')],_[_0x0909('0x74')](_0x1cc5fb['body'],[_0x0909('0x5f'),'id'])||{})[_0x0909('0x75')](function(_0x2aadd2){for(var _0x54df04=0x0;_0x54df04<_0x1cc5fb[_0x0909('0x39')][_0x0909('0x5f')][_0x0909('0x34')];_0x54df04+=0x1){socket[_0x0909('0x5e')](_0x0909('0x76'),{'UserId':Number(_0x1cc5fb[_0x0909('0x39')]['ids'][_0x54df04]),'WhatsappQueueId':Number(_0x1cc5fb[_0x0909('0x2c')]['id'])});}return _0x2aadd2;});}})[_0x0909('0x18')](respondWithResult(_0x22ca64,null))[_0x0909('0x2b')](handleError(_0x22ca64,null));};exports['removeAgents']=function(_0x3151e0,_0x160356){return db[_0x0909('0x22')][_0x0909('0x37')]({'where':{'id':_0x3151e0[_0x0909('0x2c')]['id']}})['then'](handleEntityNotFound(_0x160356,null))[_0x0909('0x18')](function(_0x479262){if(_0x479262){return _0x479262['removeAgents'](_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')])[_0x0909('0x18')](function(){if(_[_0x0909('0x77')](_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')])){for(var _0x1117a5=0x0;_0x1117a5<_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')][_0x0909('0x34')];_0x1117a5+=0x1){socket[_0x0909('0x5e')]('userWhatsappQueue:remove',{'UserId':Number(_0x3151e0[_0x0909('0x2d')]['ids'][_0x1117a5]),'WhatsappQueueId':Number(_0x3151e0[_0x0909('0x2c')]['id'])});}}else{socket[_0x0909('0x5e')]('userWhatsappQueue:remove',{'UserId':Number(_0x3151e0[_0x0909('0x2d')][_0x0909('0x5f')]),'WhatsappQueueId':Number(_0x3151e0['params']['id'])});}});}})[_0x0909('0x18')](respondWithStatusCode(_0x160356,null))[_0x0909('0x2b')](handleError(_0x160356,null));};exports['getAgents']=function(_0x540cad,_0x4fc3ce){var _0x9def75={};var _0x490c4a={};var _0x51752c;var _0x58661f;return db['WhatsappQueue'][_0x0909('0x41')]({'where':{'id':_0x540cad[_0x0909('0x2c')]['id']}})[_0x0909('0x18')](handleEntityNotFound(_0x4fc3ce,null))[_0x0909('0x18')](function(_0x5be934){if(_0x5be934){_0x51752c=_0x5be934;_0x490c4a['model']=_[_0x0909('0x2e')](db[_0x0909('0x4a')][_0x0909('0x23')]);_0x490c4a[_0x0909('0x2d')]=_[_0x0909('0x2e')](_0x540cad[_0x0909('0x2d')]);_0x490c4a['filters']=_[_0x0909('0x30')](_0x490c4a[_0x0909('0x31')],_0x490c4a[_0x0909('0x2d')]);_0x9def75[_0x0909('0x32')]=_[_0x0909('0x30')](_0x490c4a[_0x0909('0x31')],qs[_0x0909('0x33')](_0x540cad['query'][_0x0909('0x33')]));_0x9def75[_0x0909('0x32')]=_0x9def75['attributes']['length']?_0x9def75[_0x0909('0x32')]:_0x490c4a[_0x0909('0x31')];_0x9def75[_0x0909('0x45')]=qs[_0x0909('0x46')](_0x540cad[_0x0909('0x2d')][_0x0909('0x46')]);_0x9def75[_0x0909('0x27')]=qs['filters'](_[_0x0909('0x47')](_0x540cad[_0x0909('0x2d')],_0x490c4a[_0x0909('0x2f')]));if(_0x540cad[_0x0909('0x2d')][_0x0909('0x49')]){_0x9def75[_0x0909('0x27')]=_[_0x0909('0x36')](_0x9def75[_0x0909('0x27')],{'$or':_[_0x0909('0x21')](_0x9def75[_0x0909('0x32')],function(_0x37396d){var _0x4fd6d9={};_0x4fd6d9[_0x37396d]={'$like':'%'+_0x540cad[_0x0909('0x2d')][_0x0909('0x49')]+'%'};return _0x4fd6d9;})});}_0x9def75=_['merge']({},_0x9def75,_0x540cad[_0x0909('0x56')]);return _0x51752c[_0x0909('0x78')](_0x9def75);}})['then'](function(_0x4b0e32){if(_0x4b0e32){_0x58661f=_0x4b0e32['length'];if(!_0x540cad[_0x0909('0x2d')][_0x0909('0x43')](_0x0909('0x44'))){_0x9def75[_0x0909('0x13')]=qs[_0x0909('0x13')](_0x540cad[_0x0909('0x2d')][_0x0909('0x13')]);_0x9def75['offset']=qs[_0x0909('0x11')](_0x540cad[_0x0909('0x2d')][_0x0909('0x11')]);}return _0x51752c['getAgents'](_0x9def75);}})[_0x0909('0x18')](function(_0x19108b){if(_0x19108b){return _0x19108b?{'count':_0x58661f,'rows':_0x19108b}:null;}})['then'](respondWithResult(_0x4fc3ce,null))[_0x0909('0x2b')](handleError(_0x4fc3ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 77f2122..4276fc5 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 _0x10ac=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue'];(function(_0x32094a,_0x261d78){var _0x1e8e23=function(_0x4c725f){while(--_0x4c725f){_0x32094a['push'](_0x32094a['shift']());}};_0x1e8e23(++_0x261d78);}(_0x10ac,0xe6));var _0xc10a=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x10ac[_0x4a6156];return _0x12c1f6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xc10a('0x0'))['db'][_0xc10a('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc10a('0x2'),'afterDestroy':_0xc10a('0x3')};function emitEvent(_0x7d4ac5){return function(_0x2ad888,_0x7794b0,_0x32465c){WhatsappQueueEvents[_0xc10a('0x4')](_0x7d4ac5+':'+_0x2ad888['id'],_0x2ad888);WhatsappQueueEvents[_0xc10a('0x4')](_0x7d4ac5,_0x2ad888);_0x32465c(null);};}for(var e in events){if(events[_0xc10a('0x5')](e)){var event=events[e];WhatsappQueue[_0xc10a('0x6')](e,emitEvent(event));}}module[_0xc10a('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xdfa2=['update','emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xdfa2,0x187));var _0x2dfa=function(_0x14ee9f,_0x346b12){_0x14ee9f=_0x14ee9f-0x0;var _0x3b69ba=_0xdfa2[_0x14ee9f];return _0x3b69ba;};'use strict';var EventEmitter=require(_0x2dfa('0x0'));var WhatsappQueue=require(_0x2dfa('0x1'))['db'][_0x2dfa('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2dfa('0x3')](0x0);var events={'afterCreate':_0x2dfa('0x4'),'afterUpdate':_0x2dfa('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4995c3){return function(_0x251a16,_0x33ffdf,_0xd4a517){WhatsappQueueEvents[_0x2dfa('0x6')](_0x4995c3+':'+_0x251a16['id'],_0x251a16);WhatsappQueueEvents['emit'](_0x4995c3,_0x251a16);_0xd4a517(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x2dfa('0x7')](e,emitEvent(event));}}module[_0x2dfa('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 ce52778..f3a568e 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 _0x92b0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','../../config/logger'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0x92b0,0x18a));var _0x092b=function(_0x230971,_0x409eec){_0x230971=_0x230971-0x0;var _0x1d51be=_0x92b0[_0x230971];return _0x1d51be;};'use strict';var _=require(_0x092b('0x0'));var util=require('util');var logger=require(_0x092b('0x1'))(_0x092b('0x2'));var moment=require(_0x092b('0x3'));var BPromise=require(_0x092b('0x4'));var rp=require(_0x092b('0x5'));var fs=require('fs');var path=require(_0x092b('0x6'));var rimraf=require(_0x092b('0x7'));var config=require(_0x092b('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x092b('0x9')]=function(_0x50013e,_0x47690a){return _0x50013e['define']('WhatsappQueue',attributes,{'tableName':_0x092b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca4e=['util','../../config/logger','api','moment','bluebird','path','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca4e,0x1e3));var _0xeca4=function(_0x51acb8,_0x345f17){_0x51acb8=_0x51acb8-0x0;var _0x325396=_0xca4e[_0x51acb8];return _0x325396;};'use strict';var _=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var logger=require(_0xeca4('0x2'))(_0xeca4('0x3'));var moment=require(_0xeca4('0x4'));var BPromise=require(_0xeca4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeca4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeca4('0x7'));module[_0xeca4('0x8')]=function(_0x59e6ec,_0x21d80e){return _0x59e6ec[_0xeca4('0x9')]('WhatsappQueue',attributes,{'tableName':_0xeca4('0xa'),'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 b38fbbb..f8a5a5f 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 _0xe208=['then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','limit','map','include','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','find','where','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x4b54fb,_0x2150e4){var _0x375eb4=function(_0x461679){while(--_0x461679){_0x4b54fb['push'](_0x4b54fb['shift']());}};_0x375eb4(++_0x2150e4);}(_0xe208,0x169));var _0x8e20=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xe208[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x8e20('0x0'));var util=require(_0x8e20('0x1'));var moment=require(_0x8e20('0x2'));var BPromise=require(_0x8e20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e20('0x5'));var logger=require(_0x8e20('0x6'))('rpc');var config=require(_0x8e20('0x7'));var jayson=require(_0x8e20('0x8'));var client=jayson[_0x8e20('0x9')][_0x8e20('0xa')]({'port':0x232a});config[_0x8e20('0xb')]=_[_0x8e20('0xc')](config[_0x8e20('0xb')],{'host':_0x8e20('0xd'),'port':0x18eb});var socket=require(_0x8e20('0xe'))(new Redis(config[_0x8e20('0xb')]));require('./whatsappQueue.socket')[_0x8e20('0xf')](socket);function respondWithRpcPromise(_0xf8a80e,_0x5d0ce8,_0x45d0f1){return new BPromise(function(_0x289da7,_0x2406e8){return client[_0x8e20('0x10')](_0xf8a80e,_0x45d0f1)[_0x8e20('0x11')](function(_0x37cee2){logger[_0x8e20('0x12')](_0x8e20('0x13'),_0x5d0ce8,'request\x20sent');logger[_0x8e20('0x14')](_0x8e20('0x15'),_0x5d0ce8,_0x8e20('0x16'),JSON['stringify'](_0x37cee2));if(_0x37cee2[_0x8e20('0x17')]){if(_0x37cee2[_0x8e20('0x17')][_0x8e20('0x18')]===0x1f4){logger[_0x8e20('0x17')](_0x8e20('0x13'),_0x5d0ce8,_0x37cee2[_0x8e20('0x17')]['message']);return _0x2406e8(_0x37cee2[_0x8e20('0x17')][_0x8e20('0x19')]);}logger[_0x8e20('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x5d0ce8,_0x37cee2[_0x8e20('0x17')]['message']);return _0x289da7(_0x37cee2[_0x8e20('0x17')][_0x8e20('0x19')]);}else{logger[_0x8e20('0x12')](_0x8e20('0x13'),_0x5d0ce8,_0x8e20('0x16'));_0x289da7(_0x37cee2[_0x8e20('0x1a')]['message']);}})[_0x8e20('0x1b')](function(_0x1ec3f2){logger['error'](_0x8e20('0x13'),_0x5d0ce8,_0x1ec3f2);_0x2406e8(_0x1ec3f2);});});}exports['GetWhatsappQueue']=function(_0x4829db){var _0x653ec6=this;return new Promise(function(_0x49ad60,_0x362070){return db[_0x8e20('0x1c')][_0x8e20('0x1d')]({'raw':_0x4829db['options']?_0x4829db[_0x8e20('0x1e')][_0x8e20('0x1f')]===undefined?!![]:![]:!![],'where':_0x4829db[_0x8e20('0x1e')]?_0x4829db[_0x8e20('0x1e')]['where']||null:null,'attributes':_0x4829db[_0x8e20('0x1e')]?_0x4829db['options']['attributes']||null:null,'limit':_0x4829db[_0x8e20('0x1e')]?_0x4829db[_0x8e20('0x1e')][_0x8e20('0x20')]||null:null,'include':_0x4829db[_0x8e20('0x1e')]?_0x4829db[_0x8e20('0x1e')]['include']?_[_0x8e20('0x21')](_0x4829db[_0x8e20('0x1e')][_0x8e20('0x22')],function(_0x4e8c2d){return{'model':db[_0x4e8c2d[_0x8e20('0x23')]],'as':_0x4e8c2d['as'],'attributes':_0x4e8c2d[_0x8e20('0x24')],'include':_0x4e8c2d[_0x8e20('0x22')]?_[_0x8e20('0x21')](_0x4e8c2d[_0x8e20('0x22')],function(_0x59a466){return{'model':db[_0x59a466[_0x8e20('0x23')]],'as':_0x59a466['as'],'attributes':_0x59a466[_0x8e20('0x24')],'include':_0x59a466[_0x8e20('0x22')]?_['map'](_0x59a466[_0x8e20('0x22')],function(_0xe2ed8b){return{'model':db[_0xe2ed8b[_0x8e20('0x23')]],'as':_0xe2ed8b['as'],'attributes':_0xe2ed8b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e20('0x11')](function(_0xd36771){logger[_0x8e20('0x12')](_0x8e20('0x25'),_0x4829db);logger['debug'](_0x8e20('0x25'),_0x4829db,JSON['stringify'](_0xd36771));_0x49ad60(_0xd36771);})[_0x8e20('0x1b')](function(_0x27f8d0){logger[_0x8e20('0x17')](_0x8e20('0x25'),_0x27f8d0[_0x8e20('0x19')],_0x4829db);_0x362070(_0x653ec6['error'](0x1f4,_0x27f8d0['message']));});});};exports[_0x8e20('0x26')]=function(_0x396844){var _0x3e3825=this;return new Promise(function(_0x21f417,_0x4d8119){return db[_0x8e20('0x1c')][_0x8e20('0x27')]({'raw':_0x396844[_0x8e20('0x1e')]?_0x396844[_0x8e20('0x1e')][_0x8e20('0x1f')]===undefined?!![]:![]:!![],'where':_0x396844[_0x8e20('0x1e')]?_0x396844[_0x8e20('0x1e')][_0x8e20('0x28')]||null:null,'attributes':_0x396844['options']?_0x396844[_0x8e20('0x1e')]['attributes']||null:null,'include':_0x396844['options']?_0x396844[_0x8e20('0x1e')][_0x8e20('0x22')]?_[_0x8e20('0x21')](_0x396844[_0x8e20('0x1e')][_0x8e20('0x22')],function(_0x215d34){return{'model':db[_0x215d34[_0x8e20('0x23')]],'as':_0x215d34['as'],'attributes':_0x215d34[_0x8e20('0x24')],'include':_0x215d34[_0x8e20('0x22')]?_[_0x8e20('0x21')](_0x215d34[_0x8e20('0x22')],function(_0x491152){return{'model':db[_0x491152[_0x8e20('0x23')]],'as':_0x491152['as'],'attributes':_0x491152[_0x8e20('0x24')],'include':_0x491152[_0x8e20('0x22')]?_[_0x8e20('0x21')](_0x491152[_0x8e20('0x22')],function(_0xc9d3ef){return{'model':db[_0xc9d3ef[_0x8e20('0x23')]],'as':_0xc9d3ef['as'],'attributes':_0xc9d3ef[_0x8e20('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8e20('0x11')](function(_0x1934f9){logger[_0x8e20('0x12')](_0x8e20('0x26'),_0x396844);logger[_0x8e20('0x14')]('ShowWhatsappQueue',_0x396844,JSON[_0x8e20('0x29')](_0x1934f9));_0x21f417(_0x1934f9);})['catch'](function(_0x3f6cb6){logger['error'](_0x8e20('0x26'),_0x3f6cb6[_0x8e20('0x19')],_0x396844);_0x4d8119(_0x3e3825['error'](0x1f4,_0x3f6cb6[_0x8e20('0x19')]));});});}; \ No newline at end of file +var _0x5b43=['request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','model','info','debug','ShowWhatsappQueue','WhatsappQueue','find','raw','where','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x5b43,0x1f1));var _0x35b4=function(_0x51feb8,_0x111afa){_0x51feb8=_0x51feb8-0x0;var _0xdc900e=_0x5b43[_0x51feb8];return _0xdc900e;};'use strict';var _=require(_0x35b4('0x0'));var util=require(_0x35b4('0x1'));var moment=require(_0x35b4('0x2'));var BPromise=require(_0x35b4('0x3'));var rs=require(_0x35b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b4('0x5'))['db'];var utils=require(_0x35b4('0x6'));var logger=require('../../config/logger')(_0x35b4('0x7'));var config=require(_0x35b4('0x8'));var jayson=require(_0x35b4('0x9'));var client=jayson[_0x35b4('0xa')][_0x35b4('0xb')]({'port':0x232a});config[_0x35b4('0xc')]=_['defaults'](config['redis'],{'host':_0x35b4('0xd'),'port':0x18eb});var socket=require(_0x35b4('0xe'))(new Redis(config['redis']));require(_0x35b4('0xf'))[_0x35b4('0x10')](socket);function respondWithRpcPromise(_0x58cb5d,_0x507700,_0x4c9a8a){return new BPromise(function(_0x40efb5,_0x8a232){return client[_0x35b4('0x11')](_0x58cb5d,_0x4c9a8a)[_0x35b4('0x12')](function(_0x9e4126){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x507700,_0x35b4('0x13'));logger['debug'](_0x35b4('0x14'),_0x507700,_0x35b4('0x13'),JSON[_0x35b4('0x15')](_0x9e4126));if(_0x9e4126['error']){if(_0x9e4126['error'][_0x35b4('0x16')]===0x1f4){logger[_0x35b4('0x17')](_0x35b4('0x18'),_0x507700,_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);return _0x8a232(_0x9e4126['error']['message']);}logger[_0x35b4('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x507700,_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);return _0x40efb5(_0x9e4126[_0x35b4('0x17')][_0x35b4('0x19')]);}else{logger['info'](_0x35b4('0x18'),_0x507700,_0x35b4('0x13'));_0x40efb5(_0x9e4126[_0x35b4('0x1a')][_0x35b4('0x19')]);}})[_0x35b4('0x1b')](function(_0x12c4bf){logger[_0x35b4('0x17')](_0x35b4('0x18'),_0x507700,_0x12c4bf);_0x8a232(_0x12c4bf);});});}exports[_0x35b4('0x1c')]=function(_0x2f5234){var _0x64e748=this;return new Promise(function(_0x27c19e,_0x57bafc){return db['WhatsappQueue'][_0x35b4('0x1d')]({'raw':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')]['where']||null:null,'attributes':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234['options'][_0x35b4('0x1f')]||null:null,'limit':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')][_0x35b4('0x20')]||null:null,'include':_0x2f5234[_0x35b4('0x1e')]?_0x2f5234[_0x35b4('0x1e')][_0x35b4('0x21')]?_['map'](_0x2f5234['options'][_0x35b4('0x21')],function(_0x537e58){return{'model':db[_0x537e58[_0x35b4('0x22')]],'as':_0x537e58['as'],'attributes':_0x537e58[_0x35b4('0x1f')],'include':_0x537e58['include']?_['map'](_0x537e58[_0x35b4('0x21')],function(_0x17fc1f){return{'model':db[_0x17fc1f[_0x35b4('0x22')]],'as':_0x17fc1f['as'],'attributes':_0x17fc1f['attributes'],'include':_0x17fc1f[_0x35b4('0x21')]?_['map'](_0x17fc1f[_0x35b4('0x21')],function(_0x5cba2b){return{'model':db[_0x5cba2b[_0x35b4('0x22')]],'as':_0x5cba2b['as'],'attributes':_0x5cba2b[_0x35b4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x35b4('0x12')](function(_0x39391a){logger[_0x35b4('0x23')]('GetWhatsappQueue',_0x2f5234);logger[_0x35b4('0x24')](_0x35b4('0x1c'),_0x2f5234,JSON['stringify'](_0x39391a));_0x27c19e(_0x39391a);})['catch'](function(_0x2ca3e2){logger[_0x35b4('0x17')](_0x35b4('0x1c'),_0x2ca3e2[_0x35b4('0x19')],_0x2f5234);_0x57bafc(_0x64e748[_0x35b4('0x17')](0x1f4,_0x2ca3e2[_0x35b4('0x19')]));});});};exports[_0x35b4('0x25')]=function(_0x500e1f){var _0x37ba10=this;return new Promise(function(_0x1204ad,_0x3bd4b5){return db[_0x35b4('0x26')][_0x35b4('0x27')]({'raw':_0x500e1f['options']?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x28')]===undefined?!![]:![]:!![],'where':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x29')]||null:null,'attributes':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x1f')]||null:null,'include':_0x500e1f[_0x35b4('0x1e')]?_0x500e1f[_0x35b4('0x1e')][_0x35b4('0x21')]?_['map'](_0x500e1f['options']['include'],function(_0x421ca5){return{'model':db[_0x421ca5[_0x35b4('0x22')]],'as':_0x421ca5['as'],'attributes':_0x421ca5[_0x35b4('0x1f')],'include':_0x421ca5[_0x35b4('0x21')]?_['map'](_0x421ca5[_0x35b4('0x21')],function(_0x1d03c2){return{'model':db[_0x1d03c2['model']],'as':_0x1d03c2['as'],'attributes':_0x1d03c2[_0x35b4('0x1f')],'include':_0x1d03c2['include']?_[_0x35b4('0x2a')](_0x1d03c2[_0x35b4('0x21')],function(_0x14a87e){return{'model':db[_0x14a87e['model']],'as':_0x14a87e['as'],'attributes':_0x14a87e[_0x35b4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21ed73){logger[_0x35b4('0x23')](_0x35b4('0x25'),_0x500e1f);logger[_0x35b4('0x24')]('ShowWhatsappQueue',_0x500e1f,JSON['stringify'](_0x21ed73));_0x1204ad(_0x21ed73);})['catch'](function(_0x4071f1){logger['error']('ShowWhatsappQueue',_0x4071f1[_0x35b4('0x19')],_0x500e1f);_0x3bd4b5(_0x37ba10[_0x35b4('0x17')](0x1f4,_0x4071f1[_0x35b4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 703b21d..a6f7d3c 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 _0xef09=['length','whatsappQueue:','./whatsappQueue.events','save','remove','removeListener'];(function(_0x13db7a,_0xf6be54){var _0x257183=function(_0xed8449){while(--_0xed8449){_0x13db7a['push'](_0x13db7a['shift']());}};_0x257183(++_0xf6be54);}(_0xef09,0x6e));var _0x9ef0=function(_0x177a3f,_0x422597){_0x177a3f=_0x177a3f-0x0;var _0x159a01=_0xef09[_0x177a3f];return _0x159a01;};'use strict';var WhatsappQueueEvents=require(_0x9ef0('0x0'));var events=[_0x9ef0('0x1'),_0x9ef0('0x2'),'update'];function createListener(_0x48120f,_0x24559b){return function(_0x2b02ca){_0x24559b['emit'](_0x48120f,_0x2b02ca);};}function removeListener(_0x331364,_0x14e5b8){return function(){WhatsappQueueEvents[_0x9ef0('0x3')](_0x331364,_0x14e5b8);};}exports['register']=function(_0x5050b4){for(var _0x4b96b9=0x0,_0xa02902=events[_0x9ef0('0x4')];_0x4b96b9<_0xa02902;_0x4b96b9++){var _0x424898=events[_0x4b96b9];var _0x2a56d5=createListener(_0x9ef0('0x5')+_0x424898,_0x5050b4);WhatsappQueueEvents['on'](_0x424898,_0x2a56d5);}}; \ No newline at end of file +var _0x5b63=['emit','register','length','whatsappQueue:','save','update'];(function(_0x353b9d,_0x2c89df){var _0x22fde7=function(_0x102e86){while(--_0x102e86){_0x353b9d['push'](_0x353b9d['shift']());}};_0x22fde7(++_0x2c89df);}(_0x5b63,0x172));var _0x35b6=function(_0x4ddd4a,_0x23cae2){_0x4ddd4a=_0x4ddd4a-0x0;var _0x13c9aa=_0x5b63[_0x4ddd4a];return _0x13c9aa;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x35b6('0x0'),'remove',_0x35b6('0x1')];function createListener(_0x177b07,_0x3ab9c7){return function(_0x716024){_0x3ab9c7[_0x35b6('0x2')](_0x177b07,_0x716024);};}function removeListener(_0x34860c,_0x2a8eec){return function(){WhatsappQueueEvents['removeListener'](_0x34860c,_0x2a8eec);};}exports[_0x35b6('0x3')]=function(_0xd1f042){for(var _0x4fbcb2=0x0,_0x2e62ba=events[_0x35b6('0x4')];_0x4fbcb2<_0x2e62ba;_0x4fbcb2++){var _0x4bf573=events[_0x4fbcb2];var _0x24ee09=createListener(_0x35b6('0x5')+_0x4bf573,_0xd1f042);WhatsappQueueEvents['on'](_0x4bf573,_0x24ee09);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e85ad51..bda32b7 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 _0x9ed8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','destroy','exports','multer','util','path'];(function(_0x4e00d0,_0x246fd4){var _0x5f20ee=function(_0x2b2337){while(--_0x2b2337){_0x4e00d0['push'](_0x4e00d0['shift']());}};_0x5f20ee(++_0x246fd4);}(_0x9ed8,0x95));var _0x89ed=function(_0x348e36,_0x47691f){_0x348e36=_0x348e36-0x0;var _0x23e17e=_0x9ed8[_0x348e36];return _0x23e17e;};'use strict';var multer=require(_0x89ed('0x0'));var util=require(_0x89ed('0x1'));var path=require(_0x89ed('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89ed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89ed('0x4'));var interaction=require(_0x89ed('0x5'));var config=require(_0x89ed('0x6'));var controller=require(_0x89ed('0x7'));router[_0x89ed('0x8')]('/',auth[_0x89ed('0x9')](),controller[_0x89ed('0xa')]);router[_0x89ed('0x8')](_0x89ed('0xb'),auth[_0x89ed('0x9')](),controller[_0x89ed('0xc')]);router['get'](_0x89ed('0xd'),auth[_0x89ed('0x9')](),controller['show']);router[_0x89ed('0xe')]('/',auth[_0x89ed('0x9')](),controller['create']);router['put'](_0x89ed('0xd'),auth[_0x89ed('0x9')](),controller[_0x89ed('0xf')]);router[_0x89ed('0x10')](_0x89ed('0xd'),auth[_0x89ed('0x9')](),controller[_0x89ed('0x11')]);module[_0x89ed('0x12')]=router; \ No newline at end of file +var _0x3e10=['put','delete','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x3e10,0x1a4));var _0x03e1=function(_0x78306e,_0xe7d336){_0x78306e=_0x78306e-0x0;var _0x3da728=_0x3e10[_0x78306e];return _0x3da728;};'use strict';var multer=require('multer');var util=require(_0x03e1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03e1('0x1'));var router=express[_0x03e1('0x2')]();var fs_extra=require(_0x03e1('0x3'));var auth=require(_0x03e1('0x4'));var interaction=require(_0x03e1('0x5'));var config=require(_0x03e1('0x6'));var controller=require(_0x03e1('0x7'));router[_0x03e1('0x8')]('/',auth[_0x03e1('0x9')](),controller[_0x03e1('0xa')]);router[_0x03e1('0x8')](_0x03e1('0xb'),auth[_0x03e1('0x9')](),controller[_0x03e1('0xc')]);router[_0x03e1('0x8')](_0x03e1('0xd'),auth['isAuthenticated'](),controller[_0x03e1('0xe')]);router[_0x03e1('0xf')]('/',auth[_0x03e1('0x9')](),controller[_0x03e1('0x10')]);router[_0x03e1('0x11')](_0x03e1('0xd'),auth[_0x03e1('0x9')](),controller['update']);router[_0x03e1('0x12')](_0x03e1('0xd'),auth[_0x03e1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e1f7546..d56878d 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x26d3ba,_0xb15f44){var _0x3b67f0=function(_0x18e8f0){while(--_0x18e8f0){_0x26d3ba['push'](_0x26d3ba['shift']());}};_0x3b67f0(++_0xb15f44);}(_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')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x240460,_0x426f69){var _0x30b289=function(_0x19b8ba){while(--_0x19b8ba){_0x240460['push'](_0x240460['shift']());}};_0x30b289(++_0x426f69);}(_0x7a54,0x106));var _0x47a5=function(_0x464e16,_0x3ec8f7){_0x464e16=_0x464e16-0x0;var _0x59d8a1=_0x7a54[_0x464e16];return _0x59d8a1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 5ff357a..fd4c9dd 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 _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x3239c8,_0x2d4aa0){var _0x4ed35e=function(_0x20c81c){while(--_0x20c81c){_0x3239c8['push'](_0x3239c8['shift']());}};_0x4ed35e(++_0x2d4aa0);}(_0x02ce,0x1ac));var _0xe02c=function(_0x174303,_0x3a4e80){_0x174303=_0x174303-0x0;var _0x1c2692=_0x02ce[_0x174303];return _0x1c2692;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file +var _0xbaf0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x377ead,_0x33321c){var _0x135bc3=function(_0x19491c){while(--_0x19491c){_0x377ead['push'](_0x377ead['shift']());}};_0x135bc3(++_0x33321c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x34e264,_0x19d9fd){return function(_0x3a1ba1){if(!_0x3a1ba1){_0x34e264['sendStatus'](0x194);}return _0x3a1ba1;};}function handleError(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0x1f4;return function(_0x1ca35a){logger[_0x0baf('0x28')](_0x1ca35a[_0x0baf('0x29')]);if(_0x1ca35a[_0x0baf('0x2a')]){delete _0x1ca35a[_0x0baf('0x2a')];}_0x448617['status'](_0x4681c5)[_0x0baf('0x2b')](_0x1ca35a);};}exports[_0x0baf('0x2c')]=function(_0xcaf13d,_0x265915){var _0x55c715={},_0x29dbdf={},_0x34a58a={'count':0x0,'rows':[]};var _0x5d9d7f=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0xb4dbb1){return{'name':_0xb4dbb1[_0x0baf('0x30')],'type':_0xb4dbb1[_0x0baf('0x31')][_0x0baf('0x32')]};});_0x29dbdf['model']=_[_0x0baf('0x2d')](_0x5d9d7f,_0x0baf('0x2a'));_0x29dbdf[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0xcaf13d[_0x0baf('0x33')]);_0x29dbdf[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],_0x29dbdf[_0x0baf('0x33')]);_0x55c715[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0xcaf13d[_0x0baf('0x33')]['fields']));_0x55c715[_0x0baf('0x38')]=_0x55c715['attributes'][_0x0baf('0x3a')]?_0x55c715[_0x0baf('0x38')]:_0x29dbdf[_0x0baf('0x37')];if(!_0xcaf13d[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3b'))){_0x55c715[_0x0baf('0x21')]=qs['limit'](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x21')]);_0x55c715[_0x0baf('0x1f')]=qs[_0x0baf('0x1f')](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x55c715[_0x0baf('0x3c')]=qs[_0x0baf('0x3d')](_0xcaf13d['query'][_0x0baf('0x3d')]);_0x55c715[_0x0baf('0x3e')]=qs['filters'](_[_0x0baf('0x3f')](_0xcaf13d['query'],_0x29dbdf['filters']),_0x5d9d7f);if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]){_0x55c715['where']=_['merge'](_0x55c715[_0x0baf('0x3e')],{'$or':_[_0x0baf('0x2d')](_0x5d9d7f,function(_0x3412bc){if(_0x3412bc[_0x0baf('0x31')]!==_0x0baf('0x41')){var _0x2028ad={};_0x2028ad[_0x3412bc[_0x0baf('0x2a')]]={'$like':'%'+_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]+'%'};return _0x2028ad;}})});}_0x55c715=_[_0x0baf('0x42')]({},_0x55c715,_0xcaf13d[_0x0baf('0x43')]);var _0x148540={'where':_0x55c715[_0x0baf('0x3e')]};return db[_0x0baf('0x2e')]['count'](_0x148540)[_0x0baf('0x44')](function(_0x1435d5){_0x34a58a['count']=_0x1435d5;if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x45')]){_0x55c715[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x2e')][_0x0baf('0x47')](_0x55c715);})[_0x0baf('0x44')](function(_0x57b581){_0x34a58a[_0x0baf('0x48')]=_0x57b581;return _0x34a58a;})[_0x0baf('0x44')](respondWithFilteredResult(_0x265915,_0x55c715))['catch'](handleError(_0x265915,null));};exports[_0x0baf('0x49')]=function(_0x412e6f,_0x45c6aa){var _0x57903e={'raw':!![],'where':{'id':_0x412e6f[_0x0baf('0x4a')]['id']}},_0x504031={};_0x504031[_0x0baf('0x37')]=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x504031[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x412e6f[_0x0baf('0x33')]);_0x504031[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x504031['model'],_0x504031[_0x0baf('0x33')]);_0x57903e[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x504031[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0x412e6f['query'][_0x0baf('0x39')]));_0x57903e[_0x0baf('0x38')]=_0x57903e[_0x0baf('0x38')][_0x0baf('0x3a')]?_0x57903e[_0x0baf('0x38')]:_0x504031['model'];if(_0x412e6f[_0x0baf('0x33')][_0x0baf('0x45')]){_0x57903e[_0x0baf('0x46')]=[{'all':!![]}];}_0x57903e=_[_0x0baf('0x42')]({},_0x57903e,_0x412e6f[_0x0baf('0x43')]);return db[_0x0baf('0x2e')][_0x0baf('0x4b')](_0x57903e)['then'](handleEntityNotFound(_0x45c6aa,null))[_0x0baf('0x44')](respondWithResult(_0x45c6aa,null))[_0x0baf('0x4c')](handleError(_0x45c6aa,null));};exports[_0x0baf('0x4d')]=function(_0x57008f,_0x3c9de3){return db[_0x0baf('0x2e')][_0x0baf('0x4d')](_0x57008f[_0x0baf('0x4e')],{})[_0x0baf('0x44')](respondWithResult(_0x3c9de3,0xc9))[_0x0baf('0x4c')](handleError(_0x3c9de3,null));};exports[_0x0baf('0x27')]=function(_0x5a54bb,_0x22c451){if(_0x5a54bb[_0x0baf('0x4e')]['id']){delete _0x5a54bb[_0x0baf('0x4e')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x5a54bb[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x22c451,null))[_0x0baf('0x44')](saveUpdates(_0x5a54bb[_0x0baf('0x4e')],null))[_0x0baf('0x44')](respondWithResult(_0x22c451,null))[_0x0baf('0x4c')](handleError(_0x22c451,null));};exports['destroy']=function(_0x528ff6,_0x354329){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x528ff6[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x354329,null))[_0x0baf('0x44')](removeEntity(_0x354329,null))[_0x0baf('0x4c')](handleError(_0x354329,null));};exports['describe']=function(_0x3fe534,_0x2ef4c1){return db[_0x0baf('0x2e')][_0x0baf('0x4f')]()[_0x0baf('0x44')](respondWithResult(_0x2ef4c1,null))[_0x0baf('0x4c')](handleError(_0x2ef4c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c4700f1..104553e 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 _0xb82c=['../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x550879,_0x33220b){var _0xcc6310=function(_0x223d31){while(--_0x223d31){_0x550879['push'](_0x550879['shift']());}};_0xcc6310(++_0x33220b);}(_0xb82c,0xe2));var _0xcb82=function(_0x10807e,_0x2bba67){_0x10807e=_0x10807e-0x0;var _0xa69618=_0xb82c[_0x10807e];return _0xa69618;};'use strict';var _=require(_0xcb82('0x0'));var util=require(_0xcb82('0x1'));var logger=require(_0xcb82('0x2'))(_0xcb82('0x3'));var moment=require(_0xcb82('0x4'));var BPromise=require('bluebird');var rp=require(_0xcb82('0x5'));var fs=require('fs');var path=require(_0xcb82('0x6'));var rimraf=require(_0xcb82('0x7'));var config=require(_0xcb82('0x8'));var attributes=require(_0xcb82('0x9'));module[_0xcb82('0xa')]=function(_0x1c657b,_0x3169da){return _0x1c657b['define'](_0xcb82('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xcb82('0xc'),'fields':[_0xcb82('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcbd=['util','../../config/logger','api','moment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x36ecbb,_0x1d44d9){var _0x324b0e=function(_0x1454d1){while(--_0x1454d1){_0x36ecbb['push'](_0x36ecbb['shift']());}};_0x324b0e(++_0x1d44d9);}(_0xdcbd,0x199));var _0xddcb=function(_0x3cc244,_0x20461e){_0x3cc244=_0x3cc244-0x0;var _0x6856b0=_0xdcbd[_0x3cc244];return _0x6856b0;};'use strict';var _=require(_0xddcb('0x0'));var util=require(_0xddcb('0x1'));var logger=require(_0xddcb('0x2'))(_0xddcb('0x3'));var moment=require(_0xddcb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xddcb('0x5'));module[_0xddcb('0x6')]=function(_0x3bd062,_0x197add){return _0x3bd062['define'](_0xddcb('0x7'),attributes,{'tableName':_0xddcb('0x8'),'paranoid':![],'indexes':[{'name':_0xddcb('0x9'),'fields':[_0xddcb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a75e340..e2f0d71 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 _0x1009=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','create','body','options','then','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','raw','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x1f9eeb,_0x4207a4){var _0x466d26=function(_0x58055d){while(--_0x58055d){_0x1f9eeb['push'](_0x1f9eeb['shift']());}};_0x466d26(++_0x4207a4);}(_0x1009,0xb4));var _0x9100=function(_0x246f65,_0x205ed4){_0x246f65=_0x246f65-0x0;var _0x12a196=_0x1009[_0x246f65];return _0x12a196;};'use strict';var _=require(_0x9100('0x0'));var util=require(_0x9100('0x1'));var moment=require(_0x9100('0x2'));var BPromise=require(_0x9100('0x3'));var rs=require(_0x9100('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9100('0x5'))['db'];var utils=require(_0x9100('0x6'));var logger=require(_0x9100('0x7'))(_0x9100('0x8'));var config=require(_0x9100('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9100('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c04a0,_0x108558,_0x31a756){return new BPromise(function(_0xd352c,_0x507583){return client[_0x9100('0xb')](_0x2c04a0,_0x31a756)['then'](function(_0x246f18){logger[_0x9100('0xc')](_0x9100('0xd'),_0x108558,_0x9100('0xe'));logger[_0x9100('0xf')](_0x9100('0x10'),_0x108558,'request\x20sent',JSON['stringify'](_0x246f18));if(_0x246f18[_0x9100('0x11')]){if(_0x246f18[_0x9100('0x11')][_0x9100('0x12')]===0x1f4){logger[_0x9100('0x11')](_0x9100('0xd'),_0x108558,_0x246f18[_0x9100('0x11')][_0x9100('0x13')]);return _0x507583(_0x246f18[_0x9100('0x11')]['message']);}logger[_0x9100('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x108558,_0x246f18[_0x9100('0x11')]['message']);return _0xd352c(_0x246f18[_0x9100('0x11')][_0x9100('0x13')]);}else{logger[_0x9100('0xc')](_0x9100('0xd'),_0x108558,'request\x20sent');_0xd352c(_0x246f18[_0x9100('0x14')][_0x9100('0x13')]);}})['catch'](function(_0x4552d1){logger[_0x9100('0x11')](_0x9100('0xd'),_0x108558,_0x4552d1);_0x507583(_0x4552d1);});});}exports['CreateWhatsappQueueReport']=function(_0x5ed1c9){var _0x4c5bc1=this;return new Promise(function(_0x2143df,_0x5b7c08){return db['WhatsappQueueReport'][_0x9100('0x15')](_0x5ed1c9[_0x9100('0x16')],{'raw':_0x5ed1c9[_0x9100('0x17')]?_0x5ed1c9[_0x9100('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x9100('0x18')](function(_0x574630){logger[_0x9100('0xc')](_0x9100('0x19'),_0x5ed1c9);logger[_0x9100('0xf')](_0x9100('0x19'),_0x5ed1c9,JSON[_0x9100('0x1a')](_0x574630));_0x2143df(_0x574630);})['catch'](function(_0x4fb516){logger[_0x9100('0x11')](_0x9100('0x19'),_0x4fb516[_0x9100('0x13')],_0x5ed1c9);_0x5b7c08(_0x4c5bc1['error'](0x1f4,_0x4fb516['message']));});});};exports[_0x9100('0x1b')]=function(_0x3a2bde){var _0x3a3f25=this;return new Promise(function(_0x12de39,_0x56a491){return db[_0x9100('0x1c')]['update'](_0x3a2bde['body'],{'raw':_0x3a2bde[_0x9100('0x17')]?_0x3a2bde[_0x9100('0x17')][_0x9100('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a2bde[_0x9100('0x17')]?_0x3a2bde[_0x9100('0x17')]['where']||null:null,'attributes':_0x3a2bde[_0x9100('0x17')]?_0x3a2bde[_0x9100('0x17')][_0x9100('0x1e')]||null:null,'limit':_0x3a2bde[_0x9100('0x17')]?_0x3a2bde['options']['limit']||null:null})['then'](function(_0x16b8f2){logger[_0x9100('0xc')]('UpdateWhatsappQueueReport',_0x3a2bde);logger['debug'](_0x9100('0x1b'),_0x3a2bde,JSON['stringify'](_0x16b8f2));_0x12de39(_0x16b8f2);})[_0x9100('0x1f')](function(_0x4da81c){logger['error'](_0x9100('0x1b'),_0x4da81c['message'],_0x3a2bde);_0x56a491(_0x3a3f25[_0x9100('0x11')](0x1f4,_0x4da81c[_0x9100('0x13')]));});});}; \ No newline at end of file +var _0xf2a4=['http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','WhatsappQueueReport','create','body','options','raw','then','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5440ca,_0x12fe99){var _0x57b432=function(_0x4ca1b7){while(--_0x4ca1b7){_0x5440ca['push'](_0x5440ca['shift']());}};_0x57b432(++_0x12fe99);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x486579,_0x77e571){_0x486579=_0x486579-0x0;var _0x4821e8=_0xf2a4[_0x486579];return _0x4821e8;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require('moment');var BPromise=require(_0x4f2a('0x2'));var rs=require(_0x4f2a('0x3'));var fs=require('fs');var Redis=require(_0x4f2a('0x4'));var db=require(_0x4f2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2a('0x6'))(_0x4f2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f2a('0x8'));var client=jayson[_0x4f2a('0x9')][_0x4f2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6757,_0x511463,_0x4bd1a7){return new BPromise(function(_0x465bfb,_0x2e3bd2){return client[_0x4f2a('0xb')](_0x3e6757,_0x4bd1a7)['then'](function(_0x3ab9f0){logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));logger[_0x4f2a('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x511463,_0x4f2a('0xe'),JSON[_0x4f2a('0x10')](_0x3ab9f0));if(_0x3ab9f0[_0x4f2a('0x11')]){if(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x12')]===0x1f4){logger[_0x4f2a('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x511463,_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);return _0x2e3bd2(_0x3ab9f0[_0x4f2a('0x11')]['message']);}logger[_0x4f2a('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x511463,_0x3ab9f0['error'][_0x4f2a('0x13')]);return _0x465bfb(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);}else{logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));_0x465bfb(_0x3ab9f0[_0x4f2a('0x14')][_0x4f2a('0x13')]);}})['catch'](function(_0x18980b){logger[_0x4f2a('0x11')](_0x4f2a('0xd'),_0x511463,_0x18980b);_0x2e3bd2(_0x18980b);});});}exports['CreateWhatsappQueueReport']=function(_0x388f7b){var _0x505a6e=this;return new Promise(function(_0x48573a,_0x4451c2){return db[_0x4f2a('0x15')][_0x4f2a('0x16')](_0x388f7b[_0x4f2a('0x17')],{'raw':_0x388f7b[_0x4f2a('0x18')]?_0x388f7b['options'][_0x4f2a('0x19')]===undefined?!![]:![]:!![]})[_0x4f2a('0x1a')](function(_0x2ebc8c){logger[_0x4f2a('0xc')](_0x4f2a('0x1b'),_0x388f7b);logger[_0x4f2a('0xf')](_0x4f2a('0x1b'),_0x388f7b,JSON[_0x4f2a('0x10')](_0x2ebc8c));_0x48573a(_0x2ebc8c);})[_0x4f2a('0x1c')](function(_0x55d715){logger[_0x4f2a('0x11')](_0x4f2a('0x1b'),_0x55d715[_0x4f2a('0x13')],_0x388f7b);_0x4451c2(_0x505a6e[_0x4f2a('0x11')](0x1f4,_0x55d715[_0x4f2a('0x13')]));});});};exports[_0x4f2a('0x1d')]=function(_0xcf156b){var _0x4ec9ef=this;return new Promise(function(_0x7b67b5,_0x548d62){return db[_0x4f2a('0x15')]['update'](_0xcf156b[_0x4f2a('0x17')],{'raw':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b[_0x4f2a('0x18')][_0x4f2a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b[_0x4f2a('0x18')][_0x4f2a('0x1e')]||null:null,'attributes':_0xcf156b['options']?_0xcf156b['options'][_0x4f2a('0x1f')]||null:null,'limit':_0xcf156b[_0x4f2a('0x18')]?_0xcf156b['options'][_0x4f2a('0x20')]||null:null})['then'](function(_0xa53711){logger[_0x4f2a('0xc')]('UpdateWhatsappQueueReport',_0xcf156b);logger[_0x4f2a('0xf')]('UpdateWhatsappQueueReport',_0xcf156b,JSON[_0x4f2a('0x10')](_0xa53711));_0x7b67b5(_0xa53711);})[_0x4f2a('0x1c')](function(_0x494919){logger['error']('UpdateWhatsappQueueReport',_0x494919[_0x4f2a('0x13')],_0xcf156b);_0x548d62(_0x4ec9ef[_0x4f2a('0x11')](0x1f4,_0x494919[_0x4f2a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3489e7f..ab36f05 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 _0x8d9e=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xff138c,_0x5ba6f0){var _0x459f18=function(_0x18e613){while(--_0x18e613){_0xff138c['push'](_0xff138c['shift']());}};_0x459f18(++_0x5ba6f0);}(_0x8d9e,0x17f));var _0xe8d9=function(_0x398236,_0x523080){_0x398236=_0x398236-0x0;var _0x35f905=_0x8d9e[_0x398236];return _0x35f905;};'use strict';var multer=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var path=require(_0xe8d9('0x2'));var timeout=require(_0xe8d9('0x3'));var express=require(_0xe8d9('0x4'));var router=express[_0xe8d9('0x5')]();var fs_extra=require(_0xe8d9('0x6'));var auth=require(_0xe8d9('0x7'));var interaction=require(_0xe8d9('0x8'));var config=require(_0xe8d9('0x9'));var controller=require(_0xe8d9('0xa'));router[_0xe8d9('0xb')]('/',auth['isAuthenticated'](),controller[_0xe8d9('0xc')]);router[_0xe8d9('0xb')](_0xe8d9('0xd'),auth[_0xe8d9('0xe')](),controller[_0xe8d9('0xf')]);router['get'](_0xe8d9('0x10'),auth[_0xe8d9('0xe')](),controller[_0xe8d9('0x11')]);router['post']('/',auth[_0xe8d9('0xe')](),controller[_0xe8d9('0x12')]);router[_0xe8d9('0x13')]('/:id',auth[_0xe8d9('0xe')](),controller[_0xe8d9('0x14')]);router[_0xe8d9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe8d9('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2941=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','index','get','isAuthenticated','/:id','create','put','update','delete','multer'];(function(_0x38a94d,_0x236266){var _0x3dcef3=function(_0x44ba6f){while(--_0x44ba6f){_0x38a94d['push'](_0x38a94d['shift']());}};_0x3dcef3(++_0x236266);}(_0x2941,0x1cf));var _0x1294=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x2941[_0x18d50f];return _0x8ce385;};'use strict';var multer=require(_0x1294('0x0'));var util=require('util');var path=require(_0x1294('0x1'));var timeout=require(_0x1294('0x2'));var express=require(_0x1294('0x3'));var router=express['Router']();var fs_extra=require(_0x1294('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1294('0x5'));var config=require(_0x1294('0x6'));var controller=require(_0x1294('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1294('0x8')]);router[_0x1294('0x9')]('/describe',auth[_0x1294('0xa')](),controller['describe']);router[_0x1294('0x9')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1294('0xc')]);router[_0x1294('0xd')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller[_0x1294('0xe')]);router[_0x1294('0xf')](_0x1294('0xb'),auth[_0x1294('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a224688..8de6422 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 _0x0a48=['queue','DATE','sequelize','exports','ENUM','account','agent'];(function(_0x243480,_0x2fbbd4){var _0x3f3d3c=function(_0x102e4d){while(--_0x102e4d){_0x243480['push'](_0x243480['shift']());}};_0x3f3d3c(++_0x2fbbd4);}(_0x0a48,0x95));var _0x80a4=function(_0x3b0b23,_0x3d7ec9){_0x3b0b23=_0x3b0b23-0x0;var _0x38fc20=_0x0a48[_0x3b0b23];return _0x38fc20;};'use strict';var Sequelize=require(_0x80a4('0x0'));module[_0x80a4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x80a4('0x2')](_0x80a4('0x3'),_0x80a4('0x4'),_0x80a4('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x80a4('0x6')]}}; \ No newline at end of file +var _0x5236=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x9fc0cb,_0x2bffa0){var _0xb201c0=function(_0x3f82b9){while(--_0x3f82b9){_0x9fc0cb['push'](_0x9fc0cb['shift']());}};_0xb201c0(++_0x2bffa0);}(_0x5236,0x109));var _0x6523=function(_0x225ffa,_0xa92946){_0x225ffa=_0x225ffa-0x0;var _0x5f560a=_0x5236[_0x225ffa];return _0x5f560a;};'use strict';var Sequelize=require(_0x6523('0x0'));module[_0x6523('0x1')]={'uniqueid':{'type':Sequelize[_0x6523('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6523('0x3')](_0x6523('0x4'),'agent',_0x6523('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6523('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2c6638e..4680196 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 _0x3144=['map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x1efe99,_0x43e03b){var _0x38eede=function(_0x28a7e2){while(--_0x28a7e2){_0x1efe99['push'](_0x1efe99['shift']());}};_0x38eede(++_0x43e03b);}(_0x3144,0x1dd));var _0x4314=function(_0x1a7778,_0x4df50b){_0x1a7778=_0x1a7778-0x0;var _0x53aad3=_0x3144[_0x1a7778];return _0x53aad3;};'use strict';var emlformat=require(_0x4314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4314('0x1'));var jsonpatch=require(_0x4314('0x2'));var rp=require(_0x4314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4314('0x4'));var util=require(_0x4314('0x5'));var path=require(_0x4314('0x6'));var sox=require('sox');var csv=require(_0x4314('0x7'));var ejs=require(_0x4314('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4314('0x9'));var squel=require('squel');var crypto=require(_0x4314('0xa'));var jsforce=require(_0x4314('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4314('0x7'));var querystring=require(_0x4314('0xc'));var Papa=require(_0x4314('0xd'));var Redis=require(_0x4314('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4314('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4314('0x10'))(_0x4314('0x11'));var utils=require(_0x4314('0x12'));var config=require(_0x4314('0x13'));var licenseUtil=require(_0x4314('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dc0e,_0x515702){_0x515702=_0x515702||0xcc;return function(_0x2510dc){if(_0x2510dc){return _0x51dc0e[_0x4314('0x15')](_0x515702);}return _0x51dc0e[_0x4314('0x16')](_0x515702)[_0x4314('0x17')]();};}function respondWithResult(_0x29b9e2,_0x2d6dbe){_0x2d6dbe=_0x2d6dbe||0xc8;return function(_0x2415fb){if(_0x2415fb){return _0x29b9e2['status'](_0x2d6dbe)[_0x4314('0x18')](_0x2415fb);}};}function respondWithFilteredResult(_0x3f5c30,_0x296f36){return function(_0x4de855){if(_0x4de855){var _0x365ec3=typeof _0x296f36[_0x4314('0x19')]==='undefined'&&typeof _0x296f36['limit']===_0x4314('0x1a');var _0x7ea8e9=_0x4de855['count'];var _0x41078e=_0x365ec3?0x0:_0x296f36[_0x4314('0x19')];var _0x6da36c=_0x365ec3?_0x4de855[_0x4314('0x1b')]:_0x296f36[_0x4314('0x19')]+_0x296f36[_0x4314('0x1c')];var _0x5cf5cb;if(_0x6da36c>=_0x7ea8e9){_0x6da36c=_0x7ea8e9;_0x5cf5cb=0xc8;}else{_0x5cf5cb=0xce;}_0x3f5c30[_0x4314('0x16')](_0x5cf5cb);return _0x3f5c30[_0x4314('0x1d')](_0x4314('0x1e'),_0x41078e+'-'+_0x6da36c+'/'+_0x7ea8e9)['json'](_0x4de855);}return null;};}function patchUpdates(_0x4a1b77){return function(_0x4507d9){try{jsonpatch[_0x4314('0x1f')](_0x4507d9,_0x4a1b77,!![]);}catch(_0x68a221){return BPromise[_0x4314('0x20')](_0x68a221);}return _0x4507d9[_0x4314('0x21')]();};}function saveUpdates(_0x541e50,_0x3e7468){return function(_0x34d655){if(_0x34d655){return _0x34d655[_0x4314('0x22')](_0x541e50)[_0x4314('0x23')](function(_0x154b97){return _0x154b97;});}return null;};}function removeEntity(_0x17dc4b,_0x3e342e){return function(_0x222f78){if(_0x222f78){return _0x222f78[_0x4314('0x24')]()[_0x4314('0x23')](function(){_0x17dc4b['status'](0xcc)[_0x4314('0x17')]();});}};}function handleEntityNotFound(_0x564496,_0x294dce){return function(_0x50eba3){if(!_0x50eba3){_0x564496[_0x4314('0x15')](0x194);}return _0x50eba3;};}function handleError(_0x565e3e,_0x18fe8e){_0x18fe8e=_0x18fe8e||0x1f4;return function(_0x4cbafe){logger[_0x4314('0x25')](_0x4cbafe['stack']);if(_0x4cbafe[_0x4314('0x26')]){delete _0x4cbafe[_0x4314('0x26')];}_0x565e3e['status'](_0x18fe8e)[_0x4314('0x27')](_0x4cbafe);};}exports[_0x4314('0x28')]=function(_0x27b50a,_0x2b9b5b){var _0x4e96d4={},_0x5e49c7={},_0x154ff7={'count':0x0,'rows':[]};var _0x34f3ed=_[_0x4314('0x29')](db['WhatsappTransferReport'][_0x4314('0x2a')],function(_0x3c0691){return{'name':_0x3c0691['fieldName'],'type':_0x3c0691[_0x4314('0x2b')][_0x4314('0x2c')]};});_0x5e49c7[_0x4314('0x2d')]=_[_0x4314('0x29')](_0x34f3ed,_0x4314('0x26'));_0x5e49c7[_0x4314('0x2e')]=_['keys'](_0x27b50a[_0x4314('0x2e')]);_0x5e49c7[_0x4314('0x2f')]=_[_0x4314('0x30')](_0x5e49c7[_0x4314('0x2d')],_0x5e49c7[_0x4314('0x2e')]);_0x4e96d4[_0x4314('0x31')]=_[_0x4314('0x30')](_0x5e49c7[_0x4314('0x2d')],qs[_0x4314('0x32')](_0x27b50a['query'][_0x4314('0x32')]));_0x4e96d4[_0x4314('0x31')]=_0x4e96d4[_0x4314('0x31')][_0x4314('0x33')]?_0x4e96d4['attributes']:_0x5e49c7[_0x4314('0x2d')];if(!_0x27b50a[_0x4314('0x2e')][_0x4314('0x34')](_0x4314('0x35'))){_0x4e96d4[_0x4314('0x1c')]=qs[_0x4314('0x1c')](_0x27b50a[_0x4314('0x2e')][_0x4314('0x1c')]);_0x4e96d4[_0x4314('0x19')]=qs[_0x4314('0x19')](_0x27b50a[_0x4314('0x2e')][_0x4314('0x19')]);}_0x4e96d4[_0x4314('0x36')]=qs[_0x4314('0x37')](_0x27b50a['query'][_0x4314('0x37')]);_0x4e96d4[_0x4314('0x38')]=qs[_0x4314('0x2f')](_['pick'](_0x27b50a[_0x4314('0x2e')],_0x5e49c7[_0x4314('0x2f')]),_0x34f3ed);if(_0x27b50a['query'][_0x4314('0x39')]){_0x4e96d4[_0x4314('0x38')]=_[_0x4314('0x3a')](_0x4e96d4[_0x4314('0x38')],{'$or':_[_0x4314('0x29')](_0x34f3ed,function(_0x50463c){if(_0x50463c[_0x4314('0x2b')]!==_0x4314('0x3b')){var _0x215104={};_0x215104[_0x50463c[_0x4314('0x26')]]={'$like':'%'+_0x27b50a[_0x4314('0x2e')][_0x4314('0x39')]+'%'};return _0x215104;}})});}_0x4e96d4=_[_0x4314('0x3a')]({},_0x4e96d4,_0x27b50a[_0x4314('0x3c')]);var _0x4f790c={'where':_0x4e96d4[_0x4314('0x38')]};return db[_0x4314('0x3d')][_0x4314('0x1b')](_0x4f790c)[_0x4314('0x23')](function(_0x152fff){_0x154ff7[_0x4314('0x1b')]=_0x152fff;if(_0x27b50a['query'][_0x4314('0x3e')]){_0x4e96d4[_0x4314('0x3f')]=[{'all':!![]}];}return db[_0x4314('0x3d')][_0x4314('0x40')](_0x4e96d4);})[_0x4314('0x23')](function(_0x3f551c){_0x154ff7[_0x4314('0x41')]=_0x3f551c;return _0x154ff7;})[_0x4314('0x23')](respondWithFilteredResult(_0x2b9b5b,_0x4e96d4))[_0x4314('0x42')](handleError(_0x2b9b5b,null));};exports[_0x4314('0x43')]=function(_0x1857ce,_0x5f0c90){var _0x2161bc={'raw':!![],'where':{'id':_0x1857ce[_0x4314('0x44')]['id']}},_0x4a7ec8={};_0x4a7ec8[_0x4314('0x2d')]=_['keys'](db[_0x4314('0x3d')]['rawAttributes']);_0x4a7ec8['query']=_[_0x4314('0x45')](_0x1857ce[_0x4314('0x2e')]);_0x4a7ec8[_0x4314('0x2f')]=_[_0x4314('0x30')](_0x4a7ec8['model'],_0x4a7ec8[_0x4314('0x2e')]);_0x2161bc[_0x4314('0x31')]=_[_0x4314('0x30')](_0x4a7ec8[_0x4314('0x2d')],qs[_0x4314('0x32')](_0x1857ce[_0x4314('0x2e')]['fields']));_0x2161bc[_0x4314('0x31')]=_0x2161bc[_0x4314('0x31')][_0x4314('0x33')]?_0x2161bc[_0x4314('0x31')]:_0x4a7ec8[_0x4314('0x2d')];if(_0x1857ce[_0x4314('0x2e')][_0x4314('0x3e')]){_0x2161bc[_0x4314('0x3f')]=[{'all':!![]}];}_0x2161bc=_[_0x4314('0x3a')]({},_0x2161bc,_0x1857ce[_0x4314('0x3c')]);return db['WhatsappTransferReport'][_0x4314('0x46')](_0x2161bc)[_0x4314('0x23')](handleEntityNotFound(_0x5f0c90,null))[_0x4314('0x23')](respondWithResult(_0x5f0c90,null))[_0x4314('0x42')](handleError(_0x5f0c90,null));};exports[_0x4314('0x47')]=function(_0x4ec233,_0x11d346){return db[_0x4314('0x3d')][_0x4314('0x47')](_0x4ec233[_0x4314('0x48')],{})[_0x4314('0x23')](respondWithResult(_0x11d346,0xc9))[_0x4314('0x42')](handleError(_0x11d346,null));};exports[_0x4314('0x22')]=function(_0x27b607,_0x358bba){if(_0x27b607[_0x4314('0x48')]['id']){delete _0x27b607[_0x4314('0x48')]['id'];}return db[_0x4314('0x3d')]['find']({'where':{'id':_0x27b607[_0x4314('0x44')]['id']}})[_0x4314('0x23')](handleEntityNotFound(_0x358bba,null))['then'](saveUpdates(_0x27b607[_0x4314('0x48')],null))[_0x4314('0x23')](respondWithResult(_0x358bba,null))[_0x4314('0x42')](handleError(_0x358bba,null));};exports[_0x4314('0x24')]=function(_0xae006d,_0x1394d3){return db[_0x4314('0x3d')][_0x4314('0x46')]({'where':{'id':_0xae006d['params']['id']}})[_0x4314('0x23')](handleEntityNotFound(_0x1394d3,null))[_0x4314('0x23')](removeEntity(_0x1394d3,null))['catch'](handleError(_0x1394d3,null));};exports[_0x4314('0x49')]=function(_0x339d98,_0x2d1737){return db['WhatsappTransferReport'][_0x4314('0x49')]()['then'](respondWithResult(_0x2d1737,null))[_0x4314('0x42')](handleError(_0x2d1737,null));}; \ No newline at end of file +var _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1f1611,_0x8e92b0){_0x1f1611=_0x1f1611-0x0;var _0xd79ac6=_0xbbbc[_0x1f1611];return _0xd79ac6;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['WhatsappTransferReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['WhatsappTransferReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f021246..75a6c33 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 _0x3a92=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a92,0x14a));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23a9('0x0'));var util=require(_0x23a9('0x1'));var logger=require(_0x23a9('0x2'))(_0x23a9('0x3'));var moment=require(_0x23a9('0x4'));var BPromise=require(_0x23a9('0x5'));var rp=require(_0x23a9('0x6'));var fs=require('fs');var path=require(_0x23a9('0x7'));var rimraf=require(_0x23a9('0x8'));var config=require(_0x23a9('0x9'));var attributes=require(_0x23a9('0xa'));module[_0x23a9('0xb')]=function(_0x89103d,_0x456ceb){return _0x89103d[_0x23a9('0xc')](_0x23a9('0xd'),attributes,{'tableName':_0x23a9('0xe'),'paranoid':![],'indexes':[{'name':_0x23a9('0xf'),'fields':[_0x23a9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x214f=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x56fd4d,_0x2b1ade){var _0x2a5fbf=function(_0x386a03){while(--_0x386a03){_0x56fd4d['push'](_0x56fd4d['shift']());}};_0x2a5fbf(++_0x2b1ade);}(_0x214f,0x155));var _0xf214=function(_0x5cd3d4,_0x282954){_0x5cd3d4=_0x5cd3d4-0x0;var _0xaf9193=_0x214f[_0x5cd3d4];return _0xaf9193;};'use strict';var _=require('lodash');var util=require(_0xf214('0x0'));var logger=require(_0xf214('0x1'))(_0xf214('0x2'));var moment=require(_0xf214('0x3'));var BPromise=require('bluebird');var rp=require(_0xf214('0x4'));var fs=require('fs');var path=require(_0xf214('0x5'));var rimraf=require('rimraf');var config=require(_0xf214('0x6'));var attributes=require(_0xf214('0x7'));module[_0xf214('0x8')]=function(_0x3e78dd,_0xf2d852){return _0x3e78dd[_0xf214('0x9')](_0xf214('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf214('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 9b2cf08..4d0365f 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 _0x8deb=['http','request','info','request\x20sent','debug','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x4604f0,_0x285cc7){var _0x130dc7=function(_0x4417db){while(--_0x4417db){_0x4604f0['push'](_0x4604f0['shift']());}};_0x130dc7(++_0x285cc7);}(_0x8deb,0x187));var _0xb8de=function(_0x3e7059,_0x2bd859){_0x3e7059=_0x3e7059-0x0;var _0x38284b=_0x8deb[_0x3e7059];return _0x38284b;};'use strict';var _=require(_0xb8de('0x0'));var util=require(_0xb8de('0x1'));var moment=require(_0xb8de('0x2'));var BPromise=require(_0xb8de('0x3'));var rs=require(_0xb8de('0x4'));var fs=require('fs');var Redis=require(_0xb8de('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8de('0x6'));var config=require(_0xb8de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb8de('0x8')][_0xb8de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3969fb,_0x387682,_0x1d6e79){return new BPromise(function(_0x5904e2,_0x2b7b3e){return client[_0xb8de('0xa')](_0x3969fb,_0x1d6e79)['then'](function(_0x45ff9e){logger[_0xb8de('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x387682,_0xb8de('0xc'));logger[_0xb8de('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x387682,_0xb8de('0xc'),JSON[_0xb8de('0xe')](_0x45ff9e));if(_0x45ff9e[_0xb8de('0xf')]){if(_0x45ff9e['error'][_0xb8de('0x10')]===0x1f4){logger[_0xb8de('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x387682,_0x45ff9e[_0xb8de('0xf')][_0xb8de('0x11')]);return _0x2b7b3e(_0x45ff9e['error'][_0xb8de('0x11')]);}logger[_0xb8de('0xf')](_0xb8de('0x12'),_0x387682,_0x45ff9e[_0xb8de('0xf')][_0xb8de('0x11')]);return _0x5904e2(_0x45ff9e['error']['message']);}else{logger[_0xb8de('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x387682,_0xb8de('0xc'));_0x5904e2(_0x45ff9e['result'][_0xb8de('0x11')]);}})[_0xb8de('0x13')](function(_0x9e2cc1){logger[_0xb8de('0xf')](_0xb8de('0x12'),_0x387682,_0x9e2cc1);_0x2b7b3e(_0x9e2cc1);});});} \ No newline at end of file +var _0x24db=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x806a28,_0x132ee5){var _0x59ebbd=function(_0x50f840){while(--_0x50f840){_0x806a28['push'](_0x806a28['shift']());}};_0x59ebbd(++_0x132ee5);}(_0x24db,0x11b));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb24d('0x0'));var moment=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb24d('0x4'))['db'];var utils=require(_0xb24d('0x5'));var logger=require(_0xb24d('0x6'))(_0xb24d('0x7'));var config=require(_0xb24d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb24d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e6fa9,_0xf0dd7a,_0x3f36be){return new BPromise(function(_0x425abc,_0x1ac481){return client['request'](_0x1e6fa9,_0x3f36be)[_0xb24d('0xa')](function(_0x1bd5a7){logger[_0xb24d('0xb')](_0xb24d('0xc'),_0xf0dd7a,_0xb24d('0xd'));logger[_0xb24d('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xf0dd7a,_0xb24d('0xd'),JSON[_0xb24d('0xf')](_0x1bd5a7));if(_0x1bd5a7['error']){if(_0x1bd5a7[_0xb24d('0x10')][_0xb24d('0x11')]===0x1f4){logger['error'](_0xb24d('0xc'),_0xf0dd7a,_0x1bd5a7[_0xb24d('0x10')]['message']);return _0x1ac481(_0x1bd5a7['error']['message']);}logger[_0xb24d('0x10')](_0xb24d('0xc'),_0xf0dd7a,_0x1bd5a7[_0xb24d('0x10')]['message']);return _0x425abc(_0x1bd5a7[_0xb24d('0x10')]['message']);}else{logger[_0xb24d('0xb')](_0xb24d('0xc'),_0xf0dd7a,_0xb24d('0xd'));_0x425abc(_0x1bd5a7[_0xb24d('0x12')][_0xb24d('0x13')]);}})[_0xb24d('0x14')](function(_0x429bf8){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0xf0dd7a,_0x429bf8);_0x1ac481(_0x429bf8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8f6f4b4..448c3c5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9f=['default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x17e6a5,_0x4193d7){var _0x365ee8=function(_0x4d0615){while(--_0x4d0615){_0x17e6a5['push'](_0x17e6a5['shift']());}};_0x365ee8(++_0x4193d7);}(_0x0f9f,0xae));var _0xf0f9=function(_0x3892e3,_0x24cfbc){_0x3892e3=_0x3892e3-0x0;var _0x35ba3c=_0x0f9f[_0x3892e3];return _0x35ba3c;};'use strict';var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var seedDb=require(_0xf0f9('0x2'));var checkLicense=require(_0xf0f9('0x3'));var rpc=require(_0xf0f9('0x4'));var config=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var pm2=require(_0xf0f9('0x8'));var pm2Config=require(_0xf0f9('0x9'));var schedule=require(_0xf0f9('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf0f9('0xb'));var transcribe=require(_0xf0f9('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xf0f9('0xd')][_0xf0f9('0xe')]()[_0xf0f9('0xf')](function(){if(config['seedDB']){return seedDb[_0xf0f9('0x10')]();}})[_0xf0f9('0xf')](function(){return checkLicense['default']();})[_0xf0f9('0xf')](function(){return rpc[_0xf0f9('0x11')]();})[_0xf0f9('0xf')](function(_0x3be7af){logger[_0xf0f9('0x12')](_0x3be7af);return chat[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return whatsapp[_0xf0f9('0x13')]();})['then'](function(){return schedule[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return transcribe[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return provider['start']();})[_0xf0f9('0xf')](function(_0xd4e645){logger['info'](_0xd4e645);return pm2[_0xf0f9('0x13')](pm2Config);})['then'](function(_0x538864){var _0x2c832a=_0x538864['filter'](function(_0x3e1587){return typeof _0x3e1587['exitCode']===_0xf0f9('0x14')&&_0x3e1587[_0xf0f9('0x15')]>=0x0;});if(_0x2c832a[_0xf0f9('0x16')]>0x0){throw new Error(_0x2c832a[_0xf0f9('0x16')]+_0xf0f9('0x17')+_[_0xf0f9('0x18')](_0x2c832a,function(_0x10dae6){return'\x22'+_0x10dae6['pm2_env'][_0xf0f9('0x19')]+'\x22';}));}logger[_0xf0f9('0x12')](_0xf0f9('0x1a'),_[_0xf0f9('0x18')](_[_0xf0f9('0x1b')](_0x538864,{'status':_0xf0f9('0x1c')}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]());logger['info'](_0xf0f9('0x1e'),_['map'](_[_0xf0f9('0x1b')](_0x538864,function(_0x510119){return _0x510119[_0xf0f9('0x1f')]!==_0xf0f9('0x1c');}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]()||_0xf0f9('0x20'));console[_0xf0f9('0x21')]('App\x20Ready!');})[_0xf0f9('0x22')](function(_0x535c2c){console[_0xf0f9('0x21')](_0xf0f9('0x23'),_0x535c2c);logger['error'](_0xf0f9('0x24'),_0x535c2c);process[_0xf0f9('0x25')](0x1);});}main(); \ No newline at end of file +var _0x93bb=['map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x93bb,0x135));var _0xb93b=function(_0xfcffa0,_0x24e248){_0xfcffa0=_0xfcffa0-0x0;var _0x2c1745=_0x93bb[_0xfcffa0];return _0x2c1745;};'use strict';var _=require(_0xb93b('0x0'));var db=require(_0xb93b('0x1'))['db'];var seedDb=require(_0xb93b('0x2'));var checkLicense=require(_0xb93b('0x3'));var rpc=require(_0xb93b('0x4'));var config=require(_0xb93b('0x5'));var logger=require(_0xb93b('0x6'))(_0xb93b('0x7'));var pm2=require(_0xb93b('0x8'));var pm2Config=require(_0xb93b('0x9'));var schedule=require('./config/schedule');var chat=require(_0xb93b('0xa'));var whatsapp=require(_0xb93b('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb93b('0xc'));function main(){return db[_0xb93b('0xd')]['sync']()[_0xb93b('0xe')](function(){if(config[_0xb93b('0xf')]){return seedDb[_0xb93b('0x10')]();}})[_0xb93b('0xe')](function(){return checkLicense[_0xb93b('0x10')]();})[_0xb93b('0xe')](function(){return rpc[_0xb93b('0x11')]();})[_0xb93b('0xe')](function(_0x22a3d6){logger[_0xb93b('0x12')](_0x22a3d6);return chat[_0xb93b('0x13')]();})['then'](function(){return whatsapp[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(){return schedule[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(){return transcribe['start']();})[_0xb93b('0xe')](function(){return provider[_0xb93b('0x13')]();})[_0xb93b('0xe')](function(_0x33b53){logger[_0xb93b('0x12')](_0x33b53);return pm2[_0xb93b('0x13')](pm2Config);})[_0xb93b('0xe')](function(_0x58c73b){var _0x1155ef=_0x58c73b[_0xb93b('0x14')](function(_0x4281b6){return typeof _0x4281b6[_0xb93b('0x15')]===_0xb93b('0x16')&&_0x4281b6[_0xb93b('0x15')]>=0x0;});if(_0x1155ef['length']>0x0){throw new Error(_0x1155ef[_0xb93b('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xb93b('0x18')](_0x1155ef,function(_0x1f4300){return'\x22'+_0x1f4300[_0xb93b('0x19')][_0xb93b('0x1a')]+'\x22';}));}logger[_0xb93b('0x12')](_0xb93b('0x1b'),_['map'](_[_0xb93b('0x14')](_0x58c73b,{'status':_0xb93b('0x1c')}),_0xb93b('0x1a'))[_0xb93b('0x1d')]());logger[_0xb93b('0x12')](_0xb93b('0x1e'),_['map'](_['filter'](_0x58c73b,function(_0x50f944){return _0x50f944['status']!==_0xb93b('0x1c');}),'name')['join']()||_0xb93b('0x1f'));console[_0xb93b('0x20')](_0xb93b('0x21'));})['catch'](function(_0x2a3e28){console[_0xb93b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x2a3e28);logger[_0xb93b('0x22')](_0xb93b('0x23'),_0x2a3e28);process[_0xb93b('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e0c07af..63271ba 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 _0xf4f4=['isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','User','find','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','payload','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x5da6cf,_0x1eb9cf){var _0x114710=function(_0x24a2e7){while(--_0x24a2e7){_0x5da6cf['push'](_0x5da6cf['shift']());}};_0x114710(++_0x1eb9cf);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x27c1e7,_0x78ade7){_0x27c1e7=_0x27c1e7-0x0;var _0x1b30a7=_0xf4f4[_0x27c1e7];return _0x1b30a7;};'use strict';var db=require(_0x4f4f('0x0'))['db'];var config=require(_0x4f4f('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x4f4f('0x2'));var encryptor=require(_0x4f4f('0x3'));var _=require(_0x4f4f('0x4'));var jwt=require(_0x4f4f('0x5'));var expressJwt=require(_0x4f4f('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x4f4f('0x7'));var crypto=require('crypto');var BPromise=require(_0x4f4f('0x8'));var util=require(_0x4f4f('0x9'));var moment=require(_0x4f4f('0xa'));var validateJwt=expressJwt({'secret':config[_0x4f4f('0xb')][_0x4f4f('0xc')]});var userAttributes=['id',_0x4f4f('0xd'),_0x4f4f('0xe'),_0x4f4f('0xf'),'internal',_0x4f4f('0x10'),_0x4f4f('0x11'),_0x4f4f('0x12'),_0x4f4f('0x13'),_0x4f4f('0x14'),_0x4f4f('0x15'),_0x4f4f('0x16'),_0x4f4f('0x17'),'smsPause','openchannelPause',_0x4f4f('0x18'),_0x4f4f('0x19'),_0x4f4f('0x1a'),_0x4f4f('0x1b'),_0x4f4f('0x1c'),_0x4f4f('0x1d'),'passwordResetAt',_0x4f4f('0x1e'),'phoneBarAutoAnswer',_0x4f4f('0x1f'),_0x4f4f('0x20'),_0x4f4f('0x21'),_0x4f4f('0x22'),'phoneBarEnableSettings',_0x4f4f('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x4f4f('0x24'),_0x4f4f('0x25'),_0x4f4f('0x26'),_0x4f4f('0x27'),_0x4f4f('0x28'),_0x4f4f('0x29'),_0x4f4f('0x2a'),_0x4f4f('0x2b'),_0x4f4f('0x2c'),_0x4f4f('0x2d'),_0x4f4f('0x2e'),_0x4f4f('0x2f'),'chatAutoanswerDelay',_0x4f4f('0x30'),_0x4f4f('0x31'),_0x4f4f('0x32'),_0x4f4f('0x33'),_0x4f4f('0x34'),_0x4f4f('0x35'),_0x4f4f('0x36'),_0x4f4f('0x37'),_0x4f4f('0x38'),_0x4f4f('0x39'),_0x4f4f('0x3a')];exports[_0x4f4f('0x3b')]=function(){return this[_0x4f4f('0x3c')](!![])[_0x4f4f('0x3d')](function(_0x5bda88,_0x4f7261,_0x525529){if(_0x5bda88[_0x4f4f('0x3e')]){_0x525529();}else{return db[_0x4f4f('0x3f')]['findOne']({'where':{'id':_0x5bda88[_0x4f4f('0x40')]['id']},'attributes':['id',_0x4f4f('0x41'),_0x4f4f('0x42')],'raw':!![]})[_0x4f4f('0x43')](function(_0x113ff7){if(_0x113ff7&&_0x113ff7[_0x4f4f('0x41')]){return _0x4f7261[_0x4f4f('0x44')](_0x113ff7['disposition']===_0x4f4f('0x45')?0x195:0x193)[_0x4f4f('0x46')]({'message':_0x113ff7[_0x4f4f('0x42')]===_0x4f4f('0x45')?_0x4f4f('0x47'):'Forbidden.'});}else{_0x525529();}})[_0x4f4f('0x48')](function(_0xaf3de1){_0x525529(_0xaf3de1);});}});};exports[_0x4f4f('0x3c')]=function isAuthenticated(_0x5deda9){return compose()['use'](function(_0x4c2490,_0x73b8bb,_0x5b4f6a){var _0x354266;if(_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')]){if(_['startsWith'](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],'Basic')){var _0x413b71=basicAuth(_0x4c2490);db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'name':_0x413b71['name']}})[_0x4f4f('0x43')](function(_0x343c75){if(!_0x343c75||!_0x343c75['authenticate'](_0x413b71['pass'])){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x4d')});}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x343c75['id']};_0x5b4f6a();})[_0x4f4f('0x48')](function(_0x8d0f53){_0x5b4f6a(_0x8d0f53);});}else if(_[_0x4f4f('0x4e')](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],_0x4f4f('0x4f'))){validateJwt(_0x4c2490,_0x73b8bb,_0x5b4f6a);}else{if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)['json']({'message':_0x4f4f('0x50')});}}}else if(_0x4c2490['query'][_0x4f4f('0x51')]){try{var _0x423c89={'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};verifyJwt(_0x4c2490[_0x4f4f('0x53')][_0x4f4f('0x51')],_0x423c89)[_0x4f4f('0x43')](function(_0x24834a){return db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'id':_0x24834a[_0x4f4f('0x54')]}})[_0x4f4f('0x43')](function(_0x492fac){_0x354266=_0x492fac;return db[_0x4f4f('0x55')][_0x4f4f('0x56')]({'where':{'id':0x1},'attributes':[_0x4f4f('0x57'),_0x4f4f('0x58')],'raw':!![]});})[_0x4f4f('0x43')](function(_0x34fe84){if(!_0x354266||!_[_0x4f4f('0x59')](_0x354266[_0x4f4f('0x5a')],_0x24834a[_0x4f4f('0x5b')])){return _0x73b8bb['status'](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5c')});}if(_0x354266[_0x4f4f('0x5d')]){return _0x73b8bb['status'](0x191)['json']({'message':_0x4f4f('0x5e')});}if(_0x354266[_0x4f4f('0x5f')]){if(_0x34fe84[_0x4f4f('0x58')]>0x0){if(moment(_0x354266[_0x4f4f('0x60')])[_0x4f4f('0x61')](_0x34fe84[_0x4f4f('0x58')],_0x4f4f('0x62'))>moment()){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});}}else{return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x354266['id']};_0x5b4f6a();});})[_0x4f4f('0x48')](function(){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});});}catch(_0x598d65){_0x5b4f6a(_0x598d65);}}else if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x50')});}})[_0x4f4f('0x3d')](function(_0xa8f1a5,_0x4a4184,_0x1aaf2c){if(_0xa8f1a5['user']){db[_0x4f4f('0x4b')]['find']({'where':{'id':_0xa8f1a5['user']['id']},'attributes':userAttributes})[_0x4f4f('0x43')](function(_0x4f3a0f){if(!_0x4f3a0f){return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':'User\x20not\x20found.'});}_0xa8f1a5[_0x4f4f('0x3e')]=_0x4f3a0f;_0x1aaf2c();})[_0x4f4f('0x48')](function(_0x4e782c){_0x1aaf2c(_0x4e782c);});}else if(_0x5deda9){_0x1aaf2c();}else{return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x63')});}});};exports[_0x4f4f('0x64')]=function canUpdate(){return compose()[_0x4f4f('0x3d')](function(_0x62b468,_0xb0d1b2,_0x15f0a1){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0x475969){if(_0x475969[_0x4f4f('0x66')]){_0x15f0a1();}else{return _0xb0d1b2[_0x4f4f('0x44')](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x67')});}})['catch'](function(_0x636b63){_0x15f0a1(_0x636b63);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x31349a,_0x4363c9,_0x5cf4da){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0xea9617){if(_0xea9617[_0x4f4f('0x68')]){_0x5cf4da();}else{return _0x4363c9[_0x4f4f('0x44')](0x193)['json']({'message':_0x4f4f('0x67')});}})[_0x4f4f('0x48')](function(_0x30674f){_0x5cf4da(_0x30674f);});});};exports[_0x4f4f('0x69')]=function(_0x196426,_0x433787,_0x29314b){_0x196426[_0x4f4f('0x69')]=!![];return _0x29314b();};exports[_0x4f4f('0x6a')]=function signToken(_0x540b3c){return signJwt(_0x540b3c);};exports[_0x4f4f('0x6b')]=function(_0xd3b763,_0x4b33a5){if(!_0xd3b763['user']){return _0x4b33a5['status'](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x6c')});}var _0x3a2ae3={'payload':{'id':_0xd3b763['user']['id'],'role':_0xd3b763[_0x4f4f('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3a2ae3)[_0x4f4f('0x43')](function(_0x1c181e){_0x4b33a5[_0x4f4f('0x6d')](_0x4f4f('0x6e'),_0x1c181e);_0x4b33a5[_0x4f4f('0x6f')](_0x4f4f('0x70'));})[_0x4f4f('0x48')](function(_0x88054a){return _0x4b33a5[_0x4f4f('0x44')](0x1f4)['send'](_0x88054a);});};exports['retrieveApiKey']=function(_0x36cfcf){if(_[_0x4f4f('0x71')](_0x36cfcf['apiKeyNonce'])||_['isNil'](_0x36cfcf[_0x4f4f('0x72')])){return null;}else{return createJwt(_0x36cfcf);}};exports[_0x4f4f('0x73')]=function(_0x15fd73){_0x15fd73['apiKeyNonce']=generateNonce();_0x15fd73['apiKeyIat']=generateIssuedAt();return createJwt(_0x15fd73);};exports[_0x4f4f('0x74')]=function(_0x3205ef,_0x179998){var _0x3bd569=_0x3205ef[_0x4f4f('0x53')][_0x4f4f('0x51')];if(_0x3bd569){var _0xe66fc={'nonce':_0x179998[_0x4f4f('0x5a')],'iat':_0x179998[_0x4f4f('0x72')],'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};return verifyJwt(_0x3bd569,_0xe66fc)['then'](function(){return generateApiKey(_0x179998);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x4f4f('0x75')]=function(_0x136d83){var _0x161943=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x161943[_0x4f4f('0x76')](_0x136d83))throw new db['Sequelize'][(_0x4f4f('0x77'))]('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[_0x4f4f('0x78')]=function(_0x3f57c2,_0x1c6489,_0x4901f5){var _0x550342=encryptor[_0x4f4f('0x79')](_0x1c6489)[_0x4f4f('0x7a')](',');for(var _0x4f26af=0x0;_0x4f26af<_0x4901f5;_0x4f26af++){if(!_0x550342[_0x4f26af])break;if(_0x3f57c2[_0x4f4f('0x7b')]()===_0x550342[_0x4f26af][_0x4f4f('0x7b')]()){var _0x1d48fb=util['format'](_0x4f4f('0x7c'),_0x4901f5);if(_0x4901f5===0x1){_0x1d48fb=_0x4f4f('0x7d');}throw new db[(_0x4f4f('0x7e'))]['ValidationError'](_0x1d48fb);}}return;};exports[_0x4f4f('0x7f')]=function(_0x5418cd,_0x35701d){var _0x3b637d=_0x35701d?encryptor[_0x4f4f('0x79')](_0x35701d)[_0x4f4f('0x7a')](','):[];if(_0x3b637d[_0x4f4f('0x80')]===0x5){_0x3b637d[_0x4f4f('0x81')](-0x1,0x1);}_0x3b637d[_0x4f4f('0x82')](_0x5418cd);return encryptor[_0x4f4f('0x83')](_0x3b637d[_0x4f4f('0x84')](','));};function signJwt(_0x36f369){var _0x269e0d=BPromise['promisify'](jwt[_0x4f4f('0x85')],{'context':jwt});var _0x297c9c=_0x36f369[_0x4f4f('0x86')]||config['secrets'][_0x4f4f('0xc')];return new BPromise(function(_0x43908e,_0x151c75){_0x269e0d(_0x36f369[_0x4f4f('0x87')],_0x297c9c,_0x36f369['options'])[_0x4f4f('0x43')](function(_0x213163){_0x43908e(_0x213163);})[_0x4f4f('0x48')](function(_0x24928a){_0x151c75(_0x24928a);});});}function verifyJwt(_0x157af6,_0x5e2ef4,_0xe105e9){var _0x484ae2=BPromise[_0x4f4f('0x88')](jwt[_0x4f4f('0x89')],{'context':jwt});var _0x2da4ea=_0xe105e9||config[_0x4f4f('0xb')][_0x4f4f('0xc')];return new BPromise(function(_0x23366b,_0x4bbbf6){_0x484ae2(_0x157af6,_0x2da4ea,_0x5e2ef4)['then'](function(_0x15c86f){_0x23366b(_0x15c86f);})['catch'](function(_0x4252fa){_0x4bbbf6(_0x4252fa);});});}function generateNonce(){return crypto[_0x4f4f('0x8a')](0x10)[_0x4f4f('0x8b')](_0x4f4f('0x8c'));}function generateIssuedAt(){return Math[_0x4f4f('0x8d')](Date[_0x4f4f('0x8e')]()/0x3e8)[_0x4f4f('0x8b')]();}function createJwt(_0x346ebb){var _0x356224={'payload':{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')]},'options':{'algorithm':'HS512','subject':_0x346ebb['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4f4f('0x52')]()}};return signJwt(_0x356224)[_0x4f4f('0x43')](function(_0x49c7c4){return{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')],'token':_0x49c7c4};});} \ No newline at end of file +var _0x4cf8=['Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','verify','randomBytes','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x4cf8[_0x367995];return _0x22daa8;};'use strict';var db=require(_0x84cf('0x0'))['db'];var config=require(_0x84cf('0x1'));var hardwareConf=require(_0x84cf('0x2'));var licenseUtil=require(_0x84cf('0x3'));var encryptor=require(_0x84cf('0x4'));var _=require(_0x84cf('0x5'));var jwt=require(_0x84cf('0x6'));var expressJwt=require(_0x84cf('0x7'));var compose=require(_0x84cf('0x8'));var basicAuth=require(_0x84cf('0x9'));var crypto=require(_0x84cf('0xa'));var BPromise=require(_0x84cf('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x84cf('0xc')]['session']});var userAttributes=['id',_0x84cf('0xd'),_0x84cf('0xe'),'name',_0x84cf('0xf'),_0x84cf('0x10'),'userpic',_0x84cf('0x11'),_0x84cf('0x12'),_0x84cf('0x13'),_0x84cf('0x14'),'mailPause',_0x84cf('0x15'),_0x84cf('0x16'),'openchannelPause','pauseType',_0x84cf('0x17'),_0x84cf('0x18'),_0x84cf('0x19'),_0x84cf('0x1a'),_0x84cf('0x1b'),_0x84cf('0x1c'),_0x84cf('0x1d'),_0x84cf('0x1e'),_0x84cf('0x1f'),_0x84cf('0x20'),_0x84cf('0x21'),_0x84cf('0x22'),_0x84cf('0x23'),_0x84cf('0x24'),_0x84cf('0x25'),_0x84cf('0x26'),_0x84cf('0x27'),_0x84cf('0x28'),_0x84cf('0x29'),'userProfileId',_0x84cf('0x2a'),_0x84cf('0x2b'),_0x84cf('0x2c'),_0x84cf('0x2d'),_0x84cf('0x2e'),_0x84cf('0x2f'),_0x84cf('0x30'),'selectRecallMeCampaign','chatAutoanswer',_0x84cf('0x31'),_0x84cf('0x32'),_0x84cf('0x33'),_0x84cf('0x34'),_0x84cf('0x35'),'openchannelAutoanswer',_0x84cf('0x36'),_0x84cf('0x37'),_0x84cf('0x38'),_0x84cf('0x39'),_0x84cf('0x3a'),'messengerSoundNotification'];exports[_0x84cf('0x3b')]=function(){return this[_0x84cf('0x3c')](!![])[_0x84cf('0x3d')](function(_0x23e1e7,_0x3e5e94,_0x29e9e1){if(_0x23e1e7[_0x84cf('0x3e')]){_0x29e9e1();}else{return db['ChatInteraction'][_0x84cf('0x3f')]({'where':{'id':_0x23e1e7[_0x84cf('0x40')]['id']},'attributes':['id',_0x84cf('0x41'),_0x84cf('0x42')],'raw':!![]})[_0x84cf('0x43')](function(_0x44d4bf){if(_0x44d4bf&&_0x44d4bf[_0x84cf('0x41')]){return _0x3e5e94[_0x84cf('0x44')](_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?0x195:0x193)['json']({'message':_0x44d4bf[_0x84cf('0x42')]===_0x84cf('0x45')?_0x84cf('0x46'):_0x84cf('0x47')});}else{_0x29e9e1();}})['catch'](function(_0x1595dd){_0x29e9e1(_0x1595dd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x29455e){return compose()[_0x84cf('0x3d')](function(_0x43b41b,_0xc15298,_0x51adcf){var _0x20de4b;if(_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')]){if(_[_0x84cf('0x4a')](_0x43b41b[_0x84cf('0x48')][_0x84cf('0x49')],_0x84cf('0x4b'))){var _0x18243d=basicAuth(_0x43b41b);db[_0x84cf('0x4c')]['find']({'where':{'name':_0x18243d['name']}})[_0x84cf('0x43')](function(_0x25de3a){if(!_0x25de3a||!_0x25de3a[_0x84cf('0x4d')](_0x18243d[_0x84cf('0x4e')])){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x50')});}_0x43b41b[_0x84cf('0x3e')]={'id':_0x25de3a['id']};_0x51adcf();})['catch'](function(_0x113b3e){_0x51adcf(_0x113b3e);});}else if(_[_0x84cf('0x4a')](_0x43b41b['headers'][_0x84cf('0x49')],'Bearer')){validateJwt(_0x43b41b,_0xc15298,_0x51adcf);}else{if(_0x29455e){_0x51adcf();}else{return _0xc15298[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}}}else if(_0x43b41b[_0x84cf('0x52')][_0x84cf('0x53')]){try{var _0x49d415={'audience':hardwareConf[_0x84cf('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x43b41b['query'][_0x84cf('0x53')],_0x49d415)[_0x84cf('0x43')](function(_0x4c4676){return db[_0x84cf('0x4c')][_0x84cf('0x55')]({'where':{'id':_0x4c4676[_0x84cf('0x56')]}})[_0x84cf('0x43')](function(_0xd13908){_0x20de4b=_0xd13908;return db[_0x84cf('0x57')]['findOne']({'where':{'id':0x1},'attributes':[_0x84cf('0x58'),_0x84cf('0x59')],'raw':!![]});})[_0x84cf('0x43')](function(_0x32cff6){if(!_0x20de4b||!_[_0x84cf('0x5a')](_0x20de4b[_0x84cf('0x5b')],_0x4c4676['nonce'])){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5c')});}if(_0x20de4b[_0x84cf('0x5d')]){return _0xc15298[_0x84cf('0x44')](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}if(_0x20de4b[_0x84cf('0x5f')]){if(_0x32cff6[_0x84cf('0x59')]>0x0){if(moment(_0x20de4b[_0x84cf('0x60')])[_0x84cf('0x61')](_0x32cff6['blockDuration'],_0x84cf('0x62'))>moment()){return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':_0x84cf('0x5e')});}}else{return _0xc15298['status'](0x191)[_0x84cf('0x4f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x43b41b[_0x84cf('0x3e')]={'id':_0x20de4b['id']};_0x51adcf();});})['catch'](function(){return _0xc15298[_0x84cf('0x44')](0x191)['json']({'message':_0x84cf('0x5e')});});}catch(_0x40ae50){_0x51adcf(_0x40ae50);}}else if(_0x29455e){_0x51adcf();}else{return _0xc15298['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x51')});}})[_0x84cf('0x3d')](function(_0x5ef5fb,_0x3c1314,_0x5f1b8e){if(_0x5ef5fb[_0x84cf('0x3e')]){db['User']['find']({'where':{'id':_0x5ef5fb['user']['id']},'attributes':userAttributes})[_0x84cf('0x43')](function(_0xcf14ba){if(!_0xcf14ba){return _0x3c1314['status'](0x194)[_0x84cf('0x4f')]({'message':'User\x20not\x20found.'});}_0x5ef5fb[_0x84cf('0x3e')]=_0xcf14ba;_0x5f1b8e();})[_0x84cf('0x63')](function(_0x5ce309){_0x5f1b8e(_0x5ce309);});}else if(_0x29455e){_0x5f1b8e();}else{return _0x3c1314[_0x84cf('0x44')](0x194)['json']({'message':_0x84cf('0x64')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d8b69,_0x5498ec,_0x585644){return licenseUtil['getLicense']()['then'](function(_0x210d9b){if(_0x210d9b[_0x84cf('0x65')]){_0x585644();}else{return _0x5498ec[_0x84cf('0x44')](0x193)[_0x84cf('0x4f')]({'message':'Forbidden'});}})[_0x84cf('0x63')](function(_0x4af229){_0x585644(_0x4af229);});});};exports[_0x84cf('0x66')]=function isWebrtcLicence(){return compose()[_0x84cf('0x3d')](function(_0x1533a7,_0x253464,_0x121bb9){return licenseUtil[_0x84cf('0x67')]()['then'](function(_0x2f7da6){if(_0x2f7da6[_0x84cf('0x68')]){_0x121bb9();}else{return _0x253464['status'](0x193)[_0x84cf('0x4f')]({'message':_0x84cf('0x69')});}})[_0x84cf('0x63')](function(_0x5212ec){_0x121bb9(_0x5212ec);});});};exports['isMiddleware']=function(_0x5499f9,_0x1cf3f6,_0x104421){_0x5499f9[_0x84cf('0x6a')]=!![];return _0x104421();};exports[_0x84cf('0x6b')]=function signToken(_0x271cc3){return signJwt(_0x271cc3);};exports[_0x84cf('0x6c')]=function(_0x51d725,_0x350985){if(!_0x51d725['user']){return _0x350985[_0x84cf('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x46c595={'payload':{'id':_0x51d725[_0x84cf('0x3e')]['id'],'role':_0x51d725[_0x84cf('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x46c595)['then'](function(_0x290a4d){_0x350985[_0x84cf('0x6d')](_0x84cf('0x6e'),_0x290a4d);_0x350985[_0x84cf('0x6f')](_0x84cf('0x70'));})['catch'](function(_0xcfe28f){return _0x350985[_0x84cf('0x44')](0x1f4)['send'](_0xcfe28f);});};exports[_0x84cf('0x71')]=function(_0x5baea8){if(_['isNil'](_0x5baea8[_0x84cf('0x5b')])||_[_0x84cf('0x72')](_0x5baea8['apiKeyIat'])){return null;}else{return createJwt(_0x5baea8);}};exports['generateApiKey']=function(_0x31176c){_0x31176c[_0x84cf('0x5b')]=generateNonce();_0x31176c[_0x84cf('0x73')]=generateIssuedAt();return createJwt(_0x31176c);};exports[_0x84cf('0x74')]=function(_0x406c33,_0x3edaec){var _0x3a0eb4=_0x406c33[_0x84cf('0x52')]['apikey'];if(_0x3a0eb4){var _0x1bc15c={'nonce':_0x3edaec[_0x84cf('0x5b')],'iat':_0x3edaec['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x84cf('0x54')]()};return verifyJwt(_0x3a0eb4,_0x1bc15c)[_0x84cf('0x43')](function(){return generateApiKey(_0x3edaec);});}else{throw{'message':_0x84cf('0x75')};}};exports[_0x84cf('0x76')]=function(_0x340915){var _0xfec87d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xfec87d[_0x84cf('0x77')](_0x340915))throw new db['Sequelize'][(_0x84cf('0x78'))]('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[_0x84cf('0x79')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){var _0x55d8c4=encryptor[_0x84cf('0x7a')](_0x2a60bc)[_0x84cf('0x7b')](',');for(var _0x52a3f1=0x0;_0x52a3f1<_0x1c2f1b;_0x52a3f1++){if(!_0x55d8c4[_0x52a3f1])break;if(_0x5c0122[_0x84cf('0x7c')]()===_0x55d8c4[_0x52a3f1]['toLowerCase']()){var _0x577d55=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x1c2f1b);if(_0x1c2f1b===0x1){_0x577d55=_0x84cf('0x7d');}throw new db[(_0x84cf('0x7e'))][(_0x84cf('0x78'))](_0x577d55);}}return;};exports[_0x84cf('0x7f')]=function(_0x480c3e,_0x32aa8b){var _0x3c1c55=_0x32aa8b?encryptor['decryptString'](_0x32aa8b)[_0x84cf('0x7b')](','):[];if(_0x3c1c55[_0x84cf('0x80')]===0x5){_0x3c1c55[_0x84cf('0x81')](-0x1,0x1);}_0x3c1c55[_0x84cf('0x82')](_0x480c3e);return encryptor[_0x84cf('0x83')](_0x3c1c55[_0x84cf('0x84')](','));};function signJwt(_0x1f1f76){var _0x39a336=BPromise['promisify'](jwt[_0x84cf('0x85')],{'context':jwt});var _0x58a96a=_0x1f1f76[_0x84cf('0x86')]||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x276ab1,_0x2602b7){_0x39a336(_0x1f1f76['payload'],_0x58a96a,_0x1f1f76[_0x84cf('0x88')])[_0x84cf('0x43')](function(_0xe1a1d9){_0x276ab1(_0xe1a1d9);})['catch'](function(_0xdb9b0c){_0x2602b7(_0xdb9b0c);});});}function verifyJwt(_0x240cca,_0x4e6077,_0x84d9cb){var _0x482958=BPromise[_0x84cf('0x89')](jwt[_0x84cf('0x8a')],{'context':jwt});var _0x57f1f2=_0x84d9cb||config[_0x84cf('0xc')][_0x84cf('0x87')];return new BPromise(function(_0x4a7905,_0x40b33e){_0x482958(_0x240cca,_0x57f1f2,_0x4e6077)[_0x84cf('0x43')](function(_0x262ae1){_0x4a7905(_0x262ae1);})[_0x84cf('0x63')](function(_0x577ade){_0x40b33e(_0x577ade);});});}function generateNonce(){return crypto[_0x84cf('0x8b')](0x10)[_0x84cf('0x8c')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x84cf('0x8c')]();}function createJwt(_0x8399f4){var _0xfcd0d={'payload':{'iat':_0x8399f4['apiKeyIat'],'nonce':_0x8399f4['apiKeyNonce']},'options':{'algorithm':_0x84cf('0x8d'),'subject':_0x8399f4['id'][_0x84cf('0x8c')](),'issuer':hardwareConf[_0x84cf('0x54')](),'audience':hardwareConf[_0x84cf('0x54')]()}};return signJwt(_0xfcd0d)[_0x84cf('0x43')](function(_0x39bd44){return{'iat':_0x8399f4[_0x84cf('0x73')],'nonce':_0x8399f4[_0x84cf('0x5b')],'token':_0x39bd44};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 7d9d862..63f4bf3 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ac=['describe','CmContact','keys','startsWith','cf_','slice','all','length','fieldType','type','map','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','catch'];(function(_0x11ef51,_0x21d6f0){var _0x392c35=function(_0xac57f0){while(--_0xac57f0){_0x11ef51['push'](_0x11ef51['shift']());}};_0x392c35(++_0x21d6f0);}(_0x54ac,0x18c));var _0xc54a=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x54ac[_0x141e03];return _0x2074e3;};'use strict';var _=require('lodash');var sqlUtils=require(_0xc54a('0x0'));var db=require('../../mysqldb')['db'];exports[_0xc54a('0x1')]=function(_0x34d392,_0x357c16,_0x536fb4,_0x2450f2){var _0x41faef={'count':0x0,'rows':[]};var _0x380445=sqlUtils[_0xc54a('0x2')](_0x357c16,_0x34d392);if(_0x380445){return Promise[_0xc54a('0x3')](_0x41faef);}var _0x4d69a6=sqlUtils[_0xc54a('0x4')]();var _0x2c4e58={};var _0x1dc204=![];var _0x286236=![];return Promise['resolve']()[_0xc54a('0x5')](function(){if(_0x34d392[_0xc54a('0x6')]){return sqlUtils[_0xc54a('0x7')](_0x34d392[_0xc54a('0x6')],_0x2450f2);}else{return sqlUtils['parseQueryParameters'](_0x34d392,_0x2450f2);}})['then'](function(_0x53535f){_0x4d69a6[_0xc54a('0x8')](_0x53535f[_0xc54a('0x9')]);_0x4d69a6['where'](_0x53535f[_0xc54a('0xa')]);_0x4d69a6[_0xc54a('0x8')](_0x53535f[_0xc54a('0xb')]);_0x4d69a6[_0xc54a('0x8')](_0x53535f[_0xc54a('0xc')][_0xc54a('0xd')]);_0x2c4e58=_0x53535f[_0xc54a('0xe')];_0x286236=_0x53535f['user'][_0xc54a('0xf')];return sqlUtils[_0xc54a('0x10')](_0x357c16,_0x34d392,_0x286236);})[_0xc54a('0x5')](function(_0x4eb8a3){_0x4d69a6['where'](_0x4eb8a3);var _0x1e0156=_0x34d392[_0xc54a('0x6')]?_0x2c4e58[_0xc54a('0x11')]:_0x34d392[_0xc54a('0x12')];_0x1dc204=_0x1e0156?!![]:![];return sqlUtils[_0xc54a('0x13')](_0x4d69a6,_0x1e0156);})[_0xc54a('0x5')](function(_0x40b6f7){_0x41faef['count']=_0x40b6f7;if(_0x41faef[_0xc54a('0x14')]===0x0){return;}if(_0x34d392[_0xc54a('0x15')]){_0x286236=!![];}return sqlUtils[_0xc54a('0x16')](_0x4d69a6,_0x34d392[_0xc54a('0xa')],_0x536fb4,_0x1dc204,_0x2c4e58[_0xc54a('0xd')],_0x286236);})[_0xc54a('0x5')](function(_0x47a5a9){if(!_0x47a5a9){return[];}return sqlUtils['getFilteredContacts'](_0x47a5a9,_0x34d392,_0x536fb4);})[_0xc54a('0x5')](function(_0x37d186){_0x41faef['rows']=_0x37d186;return _0x41faef;})[_0xc54a('0x17')](function(_0x4a151e){throw _0x4a151e;});};exports[_0xc54a('0x18')]=function(){var _0x549afb={};var _0x4bb063=[];return db[_0xc54a('0x19')]['describe']()['then'](function(_0x55ca0b){_0x549afb=_0x55ca0b;var _0x17dd9d=Object[_0xc54a('0x1a')](_0x549afb)[_0xc54a('0xb')](function(_0x54efff){return _[_0xc54a('0x1b')](_0x54efff,_0xc54a('0x1c'))?_0x54efff:undefined;});var _0x219ba2=_0x17dd9d['map'](function(_0x2e9456){return db['CmCustomField']['findOne']({'where':{'id':_0x2e9456[_0xc54a('0x1d')](0x3)},'raw':!![]});});return Promise[_0xc54a('0x1e')](_0x219ba2);})[_0xc54a('0x5')](function(_0x53dbde){for(var _0x475abd=0x0;_0x475abd<_0x53dbde[_0xc54a('0x1f')];_0x475abd++){if(_0x53dbde[_0x475abd]){var _0xe1dad5=_0xc54a('0x1c')+_0x53dbde[_0x475abd]['id'];_0x549afb[_0xe1dad5][_0xc54a('0x20')]=_0x53dbde[_0x475abd][_0xc54a('0x21')];}}_0x4bb063=_[_0xc54a('0x22')](Object[_0xc54a('0x1a')](_0x549afb),function(_0x4ce524){return{'name':_0x4ce524,'type':_0x549afb[_0x4ce524][_0xc54a('0x21')]};});return _0x4bb063;})[_0xc54a('0x17')](function(_0x3183d3){throw _0x3183d3;});}; \ No newline at end of file +var _0x6c3d=['describe','keys','filter','startsWith','CmCustomField','findOne','slice','all','length','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','search','parseAdvancedSearchFilter','then','where','default','user','tags','skip','checkListsRestrictions','ids','count','User','fields','clause','getFilteredContacts','rows','catch'];(function(_0x136a7b,_0x4ec17f){var _0x302ce3=function(_0x1a1e54){while(--_0x1a1e54){_0x136a7b['push'](_0x136a7b['shift']());}};_0x302ce3(++_0x4ec17f);}(_0x6c3d,0xb1));var _0xd6c3=function(_0x5a6e9c,_0x2ebafe){_0x5a6e9c=_0x5a6e9c-0x0;var _0x566fc5=_0x6c3d[_0x5a6e9c];return _0x566fc5;};'use strict';var _=require(_0xd6c3('0x0'));var sqlUtils=require(_0xd6c3('0x1'));var db=require(_0xd6c3('0x2'))['db'];exports['findAll']=function(_0x491065,_0x545e29,_0x26dc03,_0x19c17e){var _0x46dee3={'count':0x0,'rows':[]};var _0x5a1d3b=sqlUtils[_0xd6c3('0x3')](_0x545e29,_0x491065);if(_0x5a1d3b){return Promise['resolve'](_0x46dee3);}var _0x5720ae=sqlUtils['getContactsSubquery']();var _0x489af5={};var _0x52b244=![];var _0x2ba6c0=![];return Promise['resolve']()['then'](function(){if(_0x491065[_0xd6c3('0x4')]){return sqlUtils[_0xd6c3('0x5')](_0x491065[_0xd6c3('0x4')],_0x19c17e);}else{return sqlUtils['parseQueryParameters'](_0x491065,_0x19c17e);}})[_0xd6c3('0x6')](function(_0x4b39e9){_0x5720ae[_0xd6c3('0x7')](_0x4b39e9[_0xd6c3('0x8')]);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9['fields']);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9['filter']);_0x5720ae[_0xd6c3('0x7')](_0x4b39e9[_0xd6c3('0x9')]['clause']);_0x489af5=_0x4b39e9[_0xd6c3('0xa')];_0x2ba6c0=_0x4b39e9[_0xd6c3('0x9')][_0xd6c3('0xb')];return sqlUtils[_0xd6c3('0xc')](_0x545e29,_0x491065,_0x2ba6c0);})['then'](function(_0x21a90a){_0x5720ae[_0xd6c3('0x7')](_0x21a90a);var _0x192639=_0x491065[_0xd6c3('0x4')]?_0x489af5[_0xd6c3('0xd')]:_0x491065['tag'];_0x52b244=_0x192639?!![]:![];return sqlUtils['countFilteredContacts'](_0x5720ae,_0x192639);})[_0xd6c3('0x6')](function(_0x14c51f){_0x46dee3['count']=_0x14c51f;if(_0x46dee3[_0xd6c3('0xe')]===0x0){return;}if(_0x491065[_0xd6c3('0xf')]){_0x2ba6c0=!![];}return sqlUtils['buildContactsQuery'](_0x5720ae,_0x491065[_0xd6c3('0x10')],_0x26dc03,_0x52b244,_0x489af5[_0xd6c3('0x11')],_0x2ba6c0);})[_0xd6c3('0x6')](function(_0x386af6){if(!_0x386af6){return[];}return sqlUtils[_0xd6c3('0x12')](_0x386af6,_0x491065,_0x26dc03);})[_0xd6c3('0x6')](function(_0x16ecf4){_0x46dee3[_0xd6c3('0x13')]=_0x16ecf4;return _0x46dee3;})[_0xd6c3('0x14')](function(_0x2b1f5){throw _0x2b1f5;});};exports[_0xd6c3('0x15')]=function(){var _0x41e6a8={};var _0x5358b5=[];return db['CmContact'][_0xd6c3('0x15')]()['then'](function(_0x363950){_0x41e6a8=_0x363950;var _0x15f222=Object[_0xd6c3('0x16')](_0x41e6a8)[_0xd6c3('0x17')](function(_0x3378be){return _[_0xd6c3('0x18')](_0x3378be,'cf_')?_0x3378be:undefined;});var _0x349a8b=_0x15f222['map'](function(_0x5218c0){return db[_0xd6c3('0x19')][_0xd6c3('0x1a')]({'where':{'id':_0x5218c0[_0xd6c3('0x1b')](0x3)},'raw':!![]});});return Promise[_0xd6c3('0x1c')](_0x349a8b);})[_0xd6c3('0x6')](function(_0xef2607){for(var _0x465e4c=0x0;_0x465e4c<_0xef2607[_0xd6c3('0x1d')];_0x465e4c++){if(_0xef2607[_0x465e4c]){var _0x38ffa2=_0xd6c3('0x1e')+_0xef2607[_0x465e4c]['id'];_0x41e6a8[_0x38ffa2][_0xd6c3('0x1f')]=_0xef2607[_0x465e4c][_0xd6c3('0x20')];}}_0x5358b5=_['map'](Object[_0xd6c3('0x16')](_0x41e6a8),function(_0x4888fa){return{'name':_0x4888fa,'type':_0x41e6a8[_0x4888fa]['type']};});return _0x5358b5;})[_0xd6c3('0x14')](function(_0x5da468){throw _0x5da468;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ff4f2e0..eb4fc7b 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8197=['c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','length','find','name','dateOfBirth','datetime','castTo','buildExpression','type','default','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','skip','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','agent','getLists','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','t.id\x20IN\x20?','exports','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','email','CompanyId','updatedAt','TagIds','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8197,0xaf));var _0x7819=function(_0x63a99,_0x3cafc7){_0x63a99=_0x63a99-0x0;var _0x12b973=_0x8197[_0x63a99];return _0x12b973;};'use strict';var _=require('lodash');var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x7819('0x0'));var utils=require(_0x7819('0x1'));var db=require(_0x7819('0x2'))['db'];function skipContactsQuery(_0x4ab450,_0x522ab8){var _0x4559f3=![];if(_0x4ab450[_0x7819('0x3')]==='agent'&&!_0x522ab8[_0x7819('0x4')]&&!_0x522ab8[_0x7819('0x5')]&&_0x522ab8[_0x7819('0x6')]!==_0x7819('0x7')){_0x4559f3=!![];}return _0x4559f3;}function getContactsSubquery(){return squel[_0x7819('0x8')]()[_0x7819('0x9')]('cm_contacts','c')[_0x7819('0xa')](_0x7819('0xb'));}function applyJoinClauses(_0x461edd,_0x467098){var _0x1a875b=_0x467098?'c':_0x7819('0xc');_0x461edd[_0x7819('0xd')](_0x7819('0xe'),'uc',_0x7819('0xf')+_0x1a875b+_0x7819('0x10'))[_0x7819('0xd')]('cm_contact_has_tags','ct',_0x7819('0x11')+_0x1a875b+_0x7819('0x10'))['left_join'](_0x7819('0x12'),'t',_0x7819('0x13'));return _0x461edd;}function addFieldsToQuery(_0x474424,_0x632d3,_0x4e5355,_0x554d09,_0x3677fc){var _0x22e98e=_0x3677fc?'c':_0x7819('0xc');if(!_0x632d3){_0x632d3=['id',_0x7819('0x14'),_0x7819('0x15'),_0x7819('0x16'),'mobile','fax',_0x7819('0x17'),_0x7819('0x5'),_0x7819('0x18'),'createdAt',_0x7819('0x19'),'deletedAt',_0x7819('0x1a')];}else if(!_0x632d3['includes']('id')){_0x632d3[_0x7819('0x1b')]('id');}var _0x6bb7e8=_0x4e5355&&_0x3677fc||!_0x4e5355&&!_0x3677fc;if(_0x554d09){_0x6bb7e8=_0x554d09&&_0x3677fc||!_0x554d09&&!_0x3677fc;}_0x632d3['forEach'](function(_0xf9b2ee){if(_0xf9b2ee===_0x7819('0x1a')){if(_0x6bb7e8){_0x474424[_0x7819('0x1c')](_0x7819('0x1d'),_0xf9b2ee);}else if(_0x4e5355||_0x554d09){_0x474424[_0x7819('0x1c')](_0x22e98e+'.'+_0xf9b2ee);}}else{_0x474424[_0x7819('0x1c')](_0x22e98e+'.'+_0xf9b2ee);}});return _0x474424;}function getSqlClauses(){var _0x3c0582={'default':squel[_0x7819('0x1e')](),'fields':squel['expr'](),'filter':squel[_0x7819('0x1e')](),'tags':{'clause':squel[_0x7819('0x1e')](),'ids':null},'user':{'clause':squel[_0x7819('0x1e')](),'skip':![]}};return _0x3c0582;}function parseTagParameter(_0xdb40b2){var _0xbf5b8b=squel['expr']();if(_0xdb40b2){var _0x3c08ba=utils[_0x7819('0x1f')](_0xdb40b2);_0x3c08ba[_0x7819('0x20')](function(_0x3b1fa9){_0xbf5b8b['or'](_0x7819('0x21'),'%,'+_0x3b1fa9+',%');});}return _0xbf5b8b;}function parseSearchFilter(_0x448560){var _0x3270fa=squel['expr']();if(_0x448560){var _0x263c0c=_0x448560[_0x7819('0x22')]('\x5c','\x5c\x5c')[_0x7819('0x22')](/'/g,'\x27\x27');if(_0x263c0c[_0x7819('0x23')]('\x20')['length']>0x1){_0x3270fa['or'](_0x7819('0x24'),qs['getFullTextValue'](_0x263c0c,!![]),null);}else{if(qs[_0x7819('0x25')](_0x263c0c)){_0x3270fa['or'](_0x7819('0x26'),_0x263c0c+'%');_0x3270fa['or'](_0x7819('0x27'),_0x263c0c+'%');_0x3270fa['or'](_0x7819('0x28'),_0x263c0c+'%');_0x3270fa['or'](_0x7819('0x29'),_0x263c0c+'%');}else if(qs[_0x7819('0x2a')](_0x263c0c)){_0x3270fa['or'](_0x7819('0x2b'),_0x263c0c+'%');}else{_0x3270fa['or']('c.firstName\x20LIKE\x20?','%'+_0x263c0c+'%');_0x3270fa['or'](_0x7819('0x2c'),'%'+_0x263c0c+'%');_0x3270fa['or'](_0x7819('0x2b'),'%'+_0x263c0c+'%');}}}return _0x3270fa;}function parseAdvancedSearchFilter(_0x5848fe,_0x24d9c4){var _0xefc7dd=getSqlClauses();var _0x647a77=as[_0x7819('0x2d')](_0x5848fe);var _0x1b9fe0=_0x647a77['sqlOperator'];for(var _0xa15eef=0x0;_0xa15eef<_0x647a77[_0x7819('0x2e')][_0x7819('0x2f')];_0xa15eef++){var _0xea9b24=_0x647a77[_0x7819('0x2e')][_0xa15eef];var _0x48d6da='c';var _0x383ef4=_[_0x7819('0x30')](_0x24d9c4,[_0x7819('0x31'),_0xea9b24['field']]);if(_0x383ef4){if(_0xea9b24[_0x7819('0x1c')]===_0x7819('0x32')||_0x383ef4['fieldType']===_0x7819('0x33')){_0xea9b24[_0x7819('0x34')]='DATE';}var _0x227c1a=as[_0x7819('0x35')](_0x48d6da,_0x383ef4[_0x7819('0x36')],_0xea9b24);_0xefc7dd[_0x7819('0x37')][_0x1b9fe0](_0x227c1a['text'],_0x227c1a[_0x7819('0x38')][_0x7819('0x39')],_0x227c1a[_0x7819('0x38')][_0x7819('0x3a')]);}else{if(_0xea9b24['field']===_0x7819('0x3b')){var _0x4e59fa=_0xea9b24[_0x7819('0x38')][_0x7819('0x23')](',')[_0x7819('0x3c')](function(_0x3d74c){return Number(_0x3d74c);});var _0x3c0dad=parseTagParameter(_0x4e59fa);_0xefc7dd[_0x7819('0x3d')][_0x7819('0x3e')][_0x7819('0x3f')](_0x3c0dad);_0xefc7dd[_0x7819('0x3d')][_0x7819('0x40')]=_0x4e59fa;}else if(_0xea9b24[_0x7819('0x1c')]===_0x7819('0x41')){_0xefc7dd['user'][_0x7819('0x3e')][_0x7819('0x3f')](_0x7819('0x42'),_0xea9b24['value']);_0xefc7dd[_0x7819('0x43')][_0x7819('0x44')]=!![];}}}return _0xefc7dd;}function parseModelFields(_0x182db4,_0x12a3ae){var _0x5840a4=squel['expr']();var _0x5b3463=_(_0x182db4)['keys']()[_0x7819('0x3c')](function(_0xf98552){return _[_0x7819('0x45')](_0x12a3ae,['name',_0xf98552])?_0xf98552:undefined;})[_0x7819('0x46')]()[_0x7819('0x38')]();if(_0x182db4[_0x7819('0x47')]){_0x5b3463[_0x7819('0x1b')](_0x7819('0x47'));}if(_0x182db4['User']){_0x5b3463[_0x7819('0x1b')](_0x7819('0x41'));}if(_0x5b3463['length']>0x0){_0x5b3463[_0x7819('0x20')](function(_0x1038e5){if(_0x1038e5===_0x7819('0x5')){_0x5840a4[_0x7819('0x3f')](_0x7819('0x48'),[][_0x7819('0x49')](_0x182db4[_0x1038e5]));}else if(_0x1038e5===_0x7819('0x47')){var _0x475316='%'+_0x182db4[_0x1038e5]+'%';_0x5840a4[_0x7819('0x3f')](_0x7819('0x4a'),_0x475316);}else if(_0x1038e5===_0x7819('0x41')){_0x5840a4[_0x7819('0x3f')](_0x7819('0x42'),_0x182db4[_0x1038e5]);}else{_0x5840a4[_0x7819('0x3f')]('c.'+_0x1038e5+_0x7819('0x4b'),_0x182db4[_0x1038e5]);}});}return _0x5840a4;}function parseQueryParameters(_0x597747,_0x3ec78d){var _0x457a93=getSqlClauses();return Promise[_0x7819('0x4c')]()[_0x7819('0x4d')](function(){return parseModelFields(_0x597747,_0x3ec78d);})['then'](function(_0x67c70f){_0x457a93[_0x7819('0x4e')][_0x7819('0x3f')](_0x67c70f);return parseTagParameter(_0x597747[_0x7819('0x4f')]);})[_0x7819('0x4d')](function(_0x3340c7){_0x457a93[_0x7819('0x3d')]['clause'][_0x7819('0x3f')](_0x3340c7);return parseSearchFilter(_0x597747[_0x7819('0x50')]);})[_0x7819('0x4d')](function(_0x1717b1){_0x457a93[_0x7819('0x50')]=_0x1717b1;return _0x457a93;});}function checkListsRestrictions(_0x4d9dbf,_0xb791d6,_0x3c1b0d){var _0x3840ff=squel[_0x7819('0x1e')]();return Promise[_0x7819('0x4c')]()[_0x7819('0x4d')](function(){if(_0xb791d6[_0x7819('0x4')]&&_0x4d9dbf[_0x7819('0x3')]===_0x7819('0x51')&&!_0x3c1b0d){return _0x4d9dbf[_0x7819('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x525737){if(_0x525737){if(_0x525737['length']===0x0){_0x3840ff[_0x7819('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x3840ff['and']('c.ListId\x20IN\x20?',_[_0x7819('0x3c')](_0x525737,'id'));}}})[_0x7819('0x4d')](function(){return _0x3840ff;});}function buildContactsQuery(_0x2d25b9,_0x926a97,_0x1f1151,_0x4deedc,_0x542b24,_0x2fab28){if(_0x926a97){_0x926a97=_0x1f1151[_0x7819('0x53')];}_0x2d25b9=addFieldsToQuery(_0x2d25b9,_0x926a97,_0x4deedc,_0x2fab28,!![]);var _0x28d049=squel[_0x7819('0x8')]();_0x28d049=addFieldsToQuery(_0x28d049,_0x926a97,_0x4deedc,_0x2fab28,![]);if(_0x4deedc||_0x2fab28){_0x2d25b9=applyJoinClauses(_0x2d25b9,!![]);_0x2d25b9[_0x7819('0x54')](_0x7819('0x55'));if(_0x1f1151[_0x7819('0x56')]){_0x28d049['limit'](_0x1f1151[_0x7819('0x56')]);}if(_0x1f1151[_0x7819('0x57')]){_0x28d049[_0x7819('0x57')](_0x1f1151[_0x7819('0x57')]);}}else{_0x28d049=applyJoinClauses(_0x28d049,![]);_0x28d049[_0x7819('0x54')]('subqry.id');if(_0x1f1151['limit']){_0x2d25b9[_0x7819('0x56')](_0x1f1151[_0x7819('0x56')]);}if(_0x1f1151[_0x7819('0x57')]){_0x2d25b9[_0x7819('0x57')](_0x1f1151['offset']);}}_0x28d049[_0x7819('0x58')](_0x542b24);if(_0x1f1151[_0x7819('0x59')]){_0x1f1151[_0x7819('0x59')]['forEach'](function(_0x38e547){_0x2d25b9['order']('c.'+_0x38e547[0x0],_0x38e547[0x1]===_0x7819('0x5a')?![]:!![]);_0x28d049['order'](_0x7819('0x5b')+_0x38e547[0x0],_0x38e547[0x1]==='DESC'?![]:!![]);});}_0x28d049[_0x7819('0x9')](_0x2d25b9,_0x7819('0xc'));return _0x28d049;}function getFilteredContacts(_0x57fc52){var _0x1278f8=[];return db[_0x7819('0x3b')][_0x7819('0x5c')]({'attributes':['id',_0x7819('0x31'),_0x7819('0x5d')],'raw':!![]})[_0x7819('0x4d')](function(_0x417c75){_0x1278f8=_[_0x7819('0x5e')](_0x417c75,'id');var _0x583bd2={'type':db[_0x7819('0x5f')][_0x7819('0x60')][_0x7819('0x61')],'model':db[_0x7819('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7819('0x63')][_0x7819('0x64')](_0x57fc52[_0x7819('0x65')](),_0x583bd2);})[_0x7819('0x4d')](function(_0x2a078a){_0x2a078a[_0x7819('0x20')](function(_0x1cddd2){if(_0x1cddd2[_0x7819('0x1a')]){_0x1cddd2[_0x7819('0x66')]=[];_0x1cddd2['TagIds'][_0x7819('0x23')](',')[_0x7819('0x20')](function(_0x10e4fb){_0x1cddd2[_0x7819('0x66')][_0x7819('0x1b')](_0x1278f8[_0x10e4fb]);});}delete _0x1cddd2[_0x7819('0x1a')];});return _0x2a078a;});}function countFilteredContacts(_0x47a8ba,_0x209e8d){var _0x4f866d=_0x47a8ba[_0x7819('0x67')]();_0x4f866d[_0x7819('0x1c')](_0x7819('0x68'));_0x4f866d=applyJoinClauses(_0x4f866d,!![]);_0x47a8ba[_0x7819('0x54')](_0x7819('0x55'));var _0x5331fb=utils[_0x7819('0x1f')](_0x209e8d);if(!_['isEmpty'](_0x5331fb)){_0x4f866d[_0x7819('0xa')](_0x7819('0x69'),_0x5331fb);}var _0x268734={'type':db[_0x7819('0x5f')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0x7819('0x64')](_0x4f866d[_0x7819('0x65')](),_0x268734)[_0x7819('0x4d')](function(_0x3c74e2){return _0x3c74e2[0x0]['COUNT(*)'];});}module[_0x7819('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x1fc3=['order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','SELECT','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','from','cm_contacts','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','ct.CmContactId\x20=\x20','tools_tags','subqry','fax','email','CompanyId','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','fieldType','datetime','castTo','DATE','default','value','start','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','keys','some','compact','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','search','attributes','group','c.id','limit','offset','subqry.id','having'];(function(_0x112cfd,_0x546fcf){var _0xe1b824=function(_0xb15f0e){while(--_0xb15f0e){_0x112cfd['push'](_0x112cfd['shift']());}};_0xe1b824(++_0x546fcf);}(_0x1fc3,0xe7));var _0x31fc=function(_0x1c20f6,_0x257bc5){_0x1c20f6=_0x1c20f6-0x0;var _0x5e6a21=_0x1fc3[_0x1c20f6];return _0x5e6a21;};'use strict';var _=require(_0x31fc('0x0'));var squel=require(_0x31fc('0x1'));var as=require(_0x31fc('0x2'));var qs=require(_0x31fc('0x3'));var utils=require(_0x31fc('0x4'));var db=require(_0x31fc('0x5'))['db'];function skipContactsQuery(_0x29ca00,_0x294f9f){var _0x2bc6cf=![];if(_0x29ca00[_0x31fc('0x6')]===_0x31fc('0x7')&&!_0x294f9f['search']&&!_0x294f9f['ListId']&&_0x294f9f[_0x31fc('0x8')]!==_0x31fc('0x9')){_0x2bc6cf=!![];}return _0x2bc6cf;}function getContactsSubquery(){return squel['select']()[_0x31fc('0xa')](_0x31fc('0xb'),'c')['where'](_0x31fc('0xc'));}function applyJoinClauses(_0x217352,_0x36c9c9){var _0x56e909=_0x36c9c9?'c':'subqry';_0x217352['left_join'](_0x31fc('0xd'),'uc',_0x31fc('0xe')+_0x56e909+_0x31fc('0xf'))[_0x31fc('0x10')]('cm_contact_has_tags','ct',_0x31fc('0x11')+_0x56e909+'.id')[_0x31fc('0x10')](_0x31fc('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x217352;}function addFieldsToQuery(_0x36503c,_0x4738d7,_0x57dce3,_0x395320,_0x322afb){var _0x376b83=_0x322afb?'c':_0x31fc('0x13');if(!_0x4738d7){_0x4738d7=['id','firstName','lastName','phone','mobile',_0x31fc('0x14'),_0x31fc('0x15'),'ListId',_0x31fc('0x16'),'createdAt',_0x31fc('0x17'),_0x31fc('0x18'),_0x31fc('0x19')];}else if(!_0x4738d7['includes']('id')){_0x4738d7[_0x31fc('0x1a')]('id');}var _0x3ee906=_0x57dce3&&_0x322afb||!_0x57dce3&&!_0x322afb;if(_0x395320){_0x3ee906=_0x395320&&_0x322afb||!_0x395320&&!_0x322afb;}_0x4738d7[_0x31fc('0x1b')](function(_0x3b9573){if(_0x3b9573===_0x31fc('0x19')){if(_0x3ee906){_0x36503c[_0x31fc('0x1c')](_0x31fc('0x1d'),_0x3b9573);}else if(_0x57dce3||_0x395320){_0x36503c['field'](_0x376b83+'.'+_0x3b9573);}}else{_0x36503c[_0x31fc('0x1c')](_0x376b83+'.'+_0x3b9573);}});return _0x36503c;}function getSqlClauses(){var _0x4857a0={'default':squel[_0x31fc('0x1e')](),'fields':squel[_0x31fc('0x1e')](),'filter':squel[_0x31fc('0x1e')](),'tags':{'clause':squel[_0x31fc('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x4857a0;}function parseTagParameter(_0x5cb01d){var _0xc296d=squel[_0x31fc('0x1e')]();if(_0x5cb01d){var _0x8efbf5=utils[_0x31fc('0x1f')](_0x5cb01d);_0x8efbf5[_0x31fc('0x1b')](function(_0x5b0bfe){_0xc296d['or'](_0x31fc('0x20'),'%,'+_0x5b0bfe+',%');});}return _0xc296d;}function parseSearchFilter(_0x37238f){var _0x134b95=squel[_0x31fc('0x1e')]();if(_0x37238f){var _0x178134=_0x37238f[_0x31fc('0x21')]('\x5c','\x5c\x5c')[_0x31fc('0x21')](/'/g,'\x27\x27');if(_0x178134[_0x31fc('0x22')]('\x20')[_0x31fc('0x23')]>0x1){_0x134b95['or'](_0x31fc('0x24'),qs[_0x31fc('0x25')](_0x178134,!![]),null);}else{if(qs[_0x31fc('0x26')](_0x178134)){_0x134b95['or'](_0x31fc('0x27'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x28'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x29'),_0x178134+'%');_0x134b95['or'](_0x31fc('0x2a'),_0x178134+'%');}else if(qs[_0x31fc('0x2b')](_0x178134)){_0x134b95['or'](_0x31fc('0x2c'),_0x178134+'%');}else{_0x134b95['or'](_0x31fc('0x2d'),'%'+_0x178134+'%');_0x134b95['or'](_0x31fc('0x2e'),'%'+_0x178134+'%');_0x134b95['or'](_0x31fc('0x2c'),'%'+_0x178134+'%');}}}return _0x134b95;}function parseAdvancedSearchFilter(_0x1953cc,_0x55232e){var _0x547cae=getSqlClauses();var _0x4f7924=as['parseSearch'](_0x1953cc);var _0x111893=_0x4f7924[_0x31fc('0x2f')];for(var _0x4d9cc0=0x0;_0x4d9cc0<_0x4f7924[_0x31fc('0x30')][_0x31fc('0x23')];_0x4d9cc0++){var _0xbcb292=_0x4f7924[_0x31fc('0x30')][_0x4d9cc0];var _0x15c307='c';var _0x574a31=_[_0x31fc('0x31')](_0x55232e,[_0x31fc('0x32'),_0xbcb292[_0x31fc('0x1c')]]);if(_0x574a31){if(_0xbcb292[_0x31fc('0x1c')]==='dateOfBirth'||_0x574a31[_0x31fc('0x33')]===_0x31fc('0x34')){_0xbcb292[_0x31fc('0x35')]=_0x31fc('0x36');}var _0x307cb0=as['buildExpression'](_0x15c307,_0x574a31['type'],_0xbcb292);_0x547cae[_0x31fc('0x37')][_0x111893](_0x307cb0['text'],_0x307cb0[_0x31fc('0x38')][_0x31fc('0x39')],_0x307cb0['value']['end']);}else{if(_0xbcb292[_0x31fc('0x1c')]==='Tag'){var _0x4b5856=_0xbcb292[_0x31fc('0x38')][_0x31fc('0x22')](',')[_0x31fc('0x3a')](function(_0x31eaff){return Number(_0x31eaff);});var _0x211381=parseTagParameter(_0x4b5856);_0x547cae[_0x31fc('0x3b')][_0x31fc('0x3c')][_0x31fc('0x3d')](_0x211381);_0x547cae[_0x31fc('0x3b')][_0x31fc('0x3e')]=_0x4b5856;}else if(_0xbcb292[_0x31fc('0x1c')]===_0x31fc('0x3f')){_0x547cae['user'][_0x31fc('0x3c')]['and'](_0x31fc('0x40'),_0xbcb292[_0x31fc('0x38')]);_0x547cae[_0x31fc('0x41')]['skip']=!![];}}}return _0x547cae;}function parseModelFields(_0x158af5,_0x109bdd){var _0x40fa1e=squel[_0x31fc('0x1e')]();var _0x2537bf=_(_0x158af5)[_0x31fc('0x42')]()[_0x31fc('0x3a')](function(_0x2c1eda){return _[_0x31fc('0x43')](_0x109bdd,[_0x31fc('0x32'),_0x2c1eda])?_0x2c1eda:undefined;})[_0x31fc('0x44')]()[_0x31fc('0x38')]();if(_0x158af5[_0x31fc('0x45')]){_0x2537bf[_0x31fc('0x1a')]('Contact');}if(_0x158af5[_0x31fc('0x3f')]){_0x2537bf[_0x31fc('0x1a')](_0x31fc('0x3f'));}if(_0x2537bf[_0x31fc('0x23')]>0x0){_0x2537bf[_0x31fc('0x1b')](function(_0x5bc99a){if(_0x5bc99a===_0x31fc('0x46')){_0x40fa1e['and'](_0x31fc('0x47'),[][_0x31fc('0x48')](_0x158af5[_0x5bc99a]));}else if(_0x5bc99a==='Contact'){var _0x3484e5='%'+_0x158af5[_0x5bc99a]+'%';_0x40fa1e[_0x31fc('0x3d')](_0x31fc('0x49'),_0x3484e5);}else if(_0x5bc99a==='User'){_0x40fa1e[_0x31fc('0x3d')](_0x31fc('0x40'),_0x158af5[_0x5bc99a]);}else{_0x40fa1e[_0x31fc('0x3d')]('c.'+_0x5bc99a+'\x20=\x20?',_0x158af5[_0x5bc99a]);}});}return _0x40fa1e;}function parseQueryParameters(_0x157210,_0x2f489d){var _0x3a464f=getSqlClauses();return Promise[_0x31fc('0x4a')]()[_0x31fc('0x4b')](function(){return parseModelFields(_0x157210,_0x2f489d);})[_0x31fc('0x4b')](function(_0xae9ff4){_0x3a464f[_0x31fc('0x4c')]['and'](_0xae9ff4);return parseTagParameter(_0x157210[_0x31fc('0x4d')]);})[_0x31fc('0x4b')](function(_0x4148ac){_0x3a464f[_0x31fc('0x3b')][_0x31fc('0x3c')][_0x31fc('0x3d')](_0x4148ac);return parseSearchFilter(_0x157210[_0x31fc('0x4e')]);})[_0x31fc('0x4b')](function(_0x2957f8){_0x3a464f[_0x31fc('0x4e')]=_0x2957f8;return _0x3a464f;});}function checkListsRestrictions(_0x2e0d7f,_0x188a79,_0x25e66e){var _0x48c2c6=squel['expr']();return Promise['resolve']()[_0x31fc('0x4b')](function(){if(_0x188a79[_0x31fc('0x4f')]&&_0x2e0d7f[_0x31fc('0x6')]===_0x31fc('0x7')&&!_0x25e66e){return _0x2e0d7f['getLists']({'attributes':['id'],'raw':!![]});}})[_0x31fc('0x4b')](function(_0x12507e){if(_0x12507e){if(_0x12507e[_0x31fc('0x23')]===0x0){_0x48c2c6[_0x31fc('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x48c2c6[_0x31fc('0x3d')](_0x31fc('0x47'),_[_0x31fc('0x3a')](_0x12507e,'id'));}}})[_0x31fc('0x4b')](function(){return _0x48c2c6;});}function buildContactsQuery(_0x3a94e8,_0x315b1c,_0x373a7,_0x58b66c,_0x749bb8,_0x1d1631){if(_0x315b1c){_0x315b1c=_0x373a7[_0x31fc('0x50')];}_0x3a94e8=addFieldsToQuery(_0x3a94e8,_0x315b1c,_0x58b66c,_0x1d1631,!![]);var _0x1c2180=squel['select']();_0x1c2180=addFieldsToQuery(_0x1c2180,_0x315b1c,_0x58b66c,_0x1d1631,![]);if(_0x58b66c||_0x1d1631){_0x3a94e8=applyJoinClauses(_0x3a94e8,!![]);_0x3a94e8[_0x31fc('0x51')](_0x31fc('0x52'));if(_0x373a7[_0x31fc('0x53')]){_0x1c2180[_0x31fc('0x53')](_0x373a7[_0x31fc('0x53')]);}if(_0x373a7[_0x31fc('0x54')]){_0x1c2180[_0x31fc('0x54')](_0x373a7['offset']);}}else{_0x1c2180=applyJoinClauses(_0x1c2180,![]);_0x1c2180[_0x31fc('0x51')](_0x31fc('0x55'));if(_0x373a7[_0x31fc('0x53')]){_0x3a94e8[_0x31fc('0x53')](_0x373a7[_0x31fc('0x53')]);}if(_0x373a7[_0x31fc('0x54')]){_0x3a94e8[_0x31fc('0x54')](_0x373a7['offset']);}}_0x1c2180[_0x31fc('0x56')](_0x749bb8);if(_0x373a7['order']){_0x373a7[_0x31fc('0x57')][_0x31fc('0x1b')](function(_0xc2ea4c){_0x3a94e8['order']('c.'+_0xc2ea4c[0x0],_0xc2ea4c[0x1]===_0x31fc('0x58')?![]:!![]);_0x1c2180[_0x31fc('0x57')](_0x31fc('0x59')+_0xc2ea4c[0x0],_0xc2ea4c[0x1]==='DESC'?![]:!![]);});}_0x1c2180[_0x31fc('0xa')](_0x3a94e8,_0x31fc('0x13'));return _0x1c2180;}function getFilteredContacts(_0x50bced){var _0x2daba9=[];return db['Tag'][_0x31fc('0x5a')]({'attributes':['id',_0x31fc('0x32'),_0x31fc('0x5b')],'raw':!![]})[_0x31fc('0x4b')](function(_0x410bd2){_0x2daba9=_[_0x31fc('0x5c')](_0x410bd2,'id');var _0x28f759={'type':db[_0x31fc('0x5d')][_0x31fc('0x5e')]['SELECT'],'model':db[_0x31fc('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x31fc('0x60')][_0x31fc('0x61')](_0x50bced[_0x31fc('0x62')](),_0x28f759);})[_0x31fc('0x4b')](function(_0x1908a0){_0x1908a0['forEach'](function(_0x5b907c){if(_0x5b907c[_0x31fc('0x19')]){_0x5b907c[_0x31fc('0x63')]=[];_0x5b907c[_0x31fc('0x19')][_0x31fc('0x22')](',')['forEach'](function(_0x5c45f2){_0x5b907c[_0x31fc('0x63')][_0x31fc('0x1a')](_0x2daba9[_0x5c45f2]);});}delete _0x5b907c[_0x31fc('0x19')];});return _0x1908a0;});}function countFilteredContacts(_0x5c2b7f,_0x28595b){var _0x5b81ae=_0x5c2b7f[_0x31fc('0x64')]();_0x5b81ae[_0x31fc('0x1c')](_0x31fc('0x65'));_0x5b81ae=applyJoinClauses(_0x5b81ae,!![]);_0x5c2b7f[_0x31fc('0x51')](_0x31fc('0x52'));var _0x1c65ef=utils['getSelectedTags'](_0x28595b);if(!_[_0x31fc('0x66')](_0x1c65ef)){_0x5b81ae[_0x31fc('0x67')](_0x31fc('0x68'),_0x1c65ef);}var _0x34318e={'type':db[_0x31fc('0x5d')][_0x31fc('0x5e')][_0x31fc('0x69')],'raw':!![]};return db[_0x31fc('0x60')][_0x31fc('0x61')](_0x5b81ae[_0x31fc('0x62')](),_0x34318e)[_0x31fc('0x4b')](function(_0x412502){return _0x412502[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 571c701..c21c79b 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 _0x6c58=['lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','encryptString','secret','utf8','base64','decryptString','crypto','bluebird'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0x6c58,0x1b8));var _0x86c5=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x6c58[_0x2cf2e9];return _0xd3670d;};'use strict';var crypto=require(_0x86c5('0x0'));var fs=require('fs');var BPromise=require(_0x86c5('0x1'));var _=require(_0x86c5('0x2'));var config=require('../../config/environment');var logger=require(_0x86c5('0x3'))(_0x86c5('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x86c5('0x5')][_0x86c5('0x6')],'algorithm':_0x86c5('0x7')};const fileOptions={'algorithm':_0x86c5('0x8')};if(config[_0x86c5('0x9')]&&config[_0x86c5('0x9')][_0x86c5('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x86c5('0xa')]);if(isSupported){fileOptions[_0x86c5('0xa')]=config[_0x86c5('0x9')][_0x86c5('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x86c5('0xb')](config[_0x86c5('0x9')][_0x86c5('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x50fa52){return AES_SUPPORTED_RX[_0x86c5('0xc')](_0x50fa52);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x86c5('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x579d6d){return getSupportedCiphers()[_0x86c5('0xe')](_0x579d6d)>-0x1;}function combineOptions(_0x9c4ad5){var _0x96967c={};for(var _0x1fbce3 in fileOptions){if(fileOptions[_0x86c5('0xf')](_0x1fbce3)){_0x96967c[_0x1fbce3]=fileOptions[_0x1fbce3];}}if(_0x9c4ad5){for(var _0x31682e in _0x9c4ad5){if(_0x9c4ad5['hasOwnProperty'](_0x31682e)){_0x96967c[_0x31682e]=_0x9c4ad5[_0x31682e];}}}return _0x96967c;}exports[_0x86c5('0x10')]=function(_0x98925c,_0x387bd3,_0x4fe997,_0x4a6fc8){return new BPromise(function(_0x3a9119,_0x3fbba1){_0x4a6fc8=combineOptions(_0x4a6fc8);var _0x88c28b=new Buffer(_0x4fe997);var _0xfe67b7=fs[_0x86c5('0x11')](_0x98925c);var _0x3cf6d9=fs['createWriteStream'](_0x387bd3);var _0x103e7d=crypto[_0x86c5('0x12')](_0x4a6fc8[_0x86c5('0xa')],_0x88c28b);_0xfe67b7['on'](_0x86c5('0x13'),function(_0x518d61){var _0x45f745=new Buffer(_0x103e7d['update'](_0x518d61),_0x86c5('0x14'));_0x3cf6d9[_0x86c5('0x15')](_0x45f745);});_0xfe67b7['on'](_0x86c5('0x16'),function(){try{var _0x558272=new Buffer(_0x103e7d[_0x86c5('0x17')](_0x86c5('0x14')),_0x86c5('0x14'));_0x3cf6d9[_0x86c5('0x15')](_0x558272);_0x3cf6d9[_0x86c5('0x16')]();_0x3cf6d9['on'](_0x86c5('0x18'),function(){return _0x3a9119(_0x387bd3);});}catch(_0x91df40){fs[_0x86c5('0x19')](_0x387bd3);return _0x3fbba1(_0x91df40);}});});};exports[_0x86c5('0x1a')]=function(_0x5d7a28,_0x137e9d,_0x42e55d,_0xc83be0){return new BPromise(function(_0x2f58ea,_0x2b3f27){_0xc83be0=combineOptions(_0xc83be0);var _0x5c1d0c=new Buffer(_0x42e55d);var _0x5df24e=fs[_0x86c5('0x11')](_0x5d7a28);var _0x116f66=fs['createWriteStream'](_0x137e9d);var _0x1dfd3d=crypto[_0x86c5('0x1b')](_0xc83be0[_0x86c5('0xa')],_0x5c1d0c);_0x5df24e['on'](_0x86c5('0x13'),function(_0x57efc5){var _0x5f4ce7=new Buffer(_0x1dfd3d[_0x86c5('0x1c')](_0x57efc5),_0x86c5('0x14'));_0x116f66['write'](_0x5f4ce7);});_0x5df24e['on']('end',function(){try{var _0x389f97=new Buffer(_0x1dfd3d[_0x86c5('0x17')](_0x86c5('0x14')),'binary');_0x116f66['write'](_0x389f97);_0x116f66['end']();_0x116f66['on'](_0x86c5('0x18'),function(){return _0x2f58ea(_0x137e9d);});}catch(_0xab4c66){fs[_0x86c5('0x19')](_0x137e9d);return _0x2b3f27(_0xab4c66);}});});};exports[_0x86c5('0x1d')]=function(_0x1bf0ad,_0x2cbce4,_0x52f887){var _0x53f359=_0x52f887||stringOptions[_0x86c5('0xa')];var _0x5e423e=_0x2cbce4||stringOptions[_0x86c5('0x1e')];var _0x3e0452=crypto[_0x86c5('0x12')](_0x53f359,_0x5e423e);var _0x15e360=_0x3e0452[_0x86c5('0x1c')](_0x1bf0ad,_0x86c5('0x1f'),_0x86c5('0x20'));_0x15e360+=_0x3e0452['final']('base64');return _0x15e360;};exports[_0x86c5('0x21')]=function(_0x4b4a03,_0x5490d5,_0xa6d66c){var _0x499cbc=_0xa6d66c||stringOptions[_0x86c5('0xa')];var _0x3e86bc=_0x5490d5||stringOptions[_0x86c5('0x1e')];var _0x4263f4=crypto[_0x86c5('0x1b')](_0x499cbc,_0x3e86bc);var _0x1989fe=_0x4263f4[_0x86c5('0x1c')](_0x4b4a03,_0x86c5('0x20'),_0x86c5('0x1f'));_0x1989fe+=_0x4263f4[_0x86c5('0x17')](_0x86c5('0x1f'));return _0x1989fe;}; \ No newline at end of file +var _0xcf0c=['write','end','close','unlink','decryptFile','createWriteStream','createDecipher','data','secret','base64','final','decryptString','utf8','bluebird','lodash','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','update','binary'];(function(_0x594483,_0x55b15b){var _0x1b0efc=function(_0x329c6f){while(--_0x329c6f){_0x594483['push'](_0x594483['shift']());}};_0x1b0efc(++_0x55b15b);}(_0xcf0c,0x18d));var _0xccf0=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xcf0c[_0x31ced5];return _0x10d9e5;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xccf0('0x0'));var _=require(_0xccf0('0x1'));var config=require('../../config/environment');var logger=require(_0xccf0('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xccf0('0x3')][_0xccf0('0x4')],'algorithm':_0xccf0('0x5')};const fileOptions={'algorithm':_0xccf0('0x6')};if(config['encrypt']&&config[_0xccf0('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xccf0('0x7')][_0xccf0('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xccf0('0x7')][_0xccf0('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xccf0('0x9')](config[_0xccf0('0x7')][_0xccf0('0x8')],_0xccf0('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x40d61f){return AES_SUPPORTED_RX['test'](_0x40d61f);}function getSupportedCiphers(){return crypto[_0xccf0('0xb')]()[_0xccf0('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x231d86){return getSupportedCiphers()['indexOf'](_0x231d86)>-0x1;}function combineOptions(_0x319078){var _0x13c771={};for(var _0xb87d4c in fileOptions){if(fileOptions[_0xccf0('0xd')](_0xb87d4c)){_0x13c771[_0xb87d4c]=fileOptions[_0xb87d4c];}}if(_0x319078){for(var _0x29771d in _0x319078){if(_0x319078[_0xccf0('0xd')](_0x29771d)){_0x13c771[_0x29771d]=_0x319078[_0x29771d];}}}return _0x13c771;}exports[_0xccf0('0xe')]=function(_0xa5baa6,_0x4464fe,_0x5fba07,_0x393a0c){return new BPromise(function(_0x30cf44,_0x503a95){_0x393a0c=combineOptions(_0x393a0c);var _0x7316c3=new Buffer(_0x5fba07);var _0x5d186d=fs[_0xccf0('0xf')](_0xa5baa6);var _0x51849a=fs['createWriteStream'](_0x4464fe);var _0x248885=crypto[_0xccf0('0x10')](_0x393a0c['algorithm'],_0x7316c3);_0x5d186d['on']('data',function(_0x4fd39b){var _0xc008e2=new Buffer(_0x248885[_0xccf0('0x11')](_0x4fd39b),_0xccf0('0x12'));_0x51849a[_0xccf0('0x13')](_0xc008e2);});_0x5d186d['on'](_0xccf0('0x14'),function(){try{var _0x5709e2=new Buffer(_0x248885['final'](_0xccf0('0x12')),_0xccf0('0x12'));_0x51849a[_0xccf0('0x13')](_0x5709e2);_0x51849a[_0xccf0('0x14')]();_0x51849a['on'](_0xccf0('0x15'),function(){return _0x30cf44(_0x4464fe);});}catch(_0x259332){fs[_0xccf0('0x16')](_0x4464fe);return _0x503a95(_0x259332);}});});};exports[_0xccf0('0x17')]=function(_0x483426,_0x21ceea,_0x462514,_0x3ed08a){return new BPromise(function(_0x4c042a,_0x3a6d76){_0x3ed08a=combineOptions(_0x3ed08a);var _0x34b3f1=new Buffer(_0x462514);var _0x4a66be=fs[_0xccf0('0xf')](_0x483426);var _0x5e876e=fs[_0xccf0('0x18')](_0x21ceea);var _0x357d40=crypto[_0xccf0('0x19')](_0x3ed08a[_0xccf0('0x8')],_0x34b3f1);_0x4a66be['on'](_0xccf0('0x1a'),function(_0x21a6ff){var _0x4b70cd=new Buffer(_0x357d40['update'](_0x21a6ff),_0xccf0('0x12'));_0x5e876e[_0xccf0('0x13')](_0x4b70cd);});_0x4a66be['on']('end',function(){try{var _0xd758bc=new Buffer(_0x357d40['final']('binary'),_0xccf0('0x12'));_0x5e876e[_0xccf0('0x13')](_0xd758bc);_0x5e876e[_0xccf0('0x14')]();_0x5e876e['on'](_0xccf0('0x15'),function(){return _0x4c042a(_0x21ceea);});}catch(_0x232213){fs['unlink'](_0x21ceea);return _0x3a6d76(_0x232213);}});});};exports['encryptString']=function(_0x138731,_0x191a3b,_0x397545){var _0xaa8a3b=_0x397545||stringOptions[_0xccf0('0x8')];var _0x45420d=_0x191a3b||stringOptions[_0xccf0('0x1b')];var _0x46e45f=crypto[_0xccf0('0x10')](_0xaa8a3b,_0x45420d);var _0x1df34a=_0x46e45f['update'](_0x138731,'utf8',_0xccf0('0x1c'));_0x1df34a+=_0x46e45f[_0xccf0('0x1d')]('base64');return _0x1df34a;};exports[_0xccf0('0x1e')]=function(_0x4da1c0,_0x3df233,_0x14773c){var _0x331aed=_0x14773c||stringOptions[_0xccf0('0x8')];var _0x5c8835=_0x3df233||stringOptions['secret'];var _0x3634d3=crypto['createDecipher'](_0x331aed,_0x5c8835);var _0xf9f1df=_0x3634d3[_0xccf0('0x11')](_0x4da1c0,_0xccf0('0x1c'),_0xccf0('0x1f'));_0xf9f1df+=_0x3634d3['final'](_0xccf0('0x1f'));return _0xf9f1df;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index a41ab73..daad650 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 _0x87b9=['bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','lodash','to-csv'];(function(_0xfa8991,_0xdb8118){var _0x18d032=function(_0x1b4302){while(--_0x1b4302){_0xfa8991['push'](_0xfa8991['shift']());}};_0x18d032(++_0xdb8118);}(_0x87b9,0xb9));var _0x987b=function(_0x598622,_0x39985c){_0x598622=_0x598622-0x0;var _0x50df2f=_0x87b9[_0x598622];return _0x50df2f;};'use strict';var util=require(_0x987b('0x0'));var path=require('path');var _=require(_0x987b('0x1'));var csv=require(_0x987b('0x2'));var fs=require('fs');var BPromise=require(_0x987b('0x3'));var zipdir=require(_0x987b('0x4'));var rimraf=require(_0x987b('0x5'));var db=require(_0x987b('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x987b('0x7'))(_0x987b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x987b('0x9')][0x2]);var QUERY=process[_0x987b('0x9')][0x3];var PATH=process[_0x987b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x42c6ef,_0x56540c){var _0x2b0e2b={'status':_0x42c6ef};var _0x537ccb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x56540c){_0x2b0e2b[_0x987b('0xa')]=_0x56540c;}return db['AnalyticExtractedReport']['update'](_0x2b0e2b,_0x537ccb);}function main(){var _0xea42ba=0x1388;var _0x3c831c;logger['info'](util['format'](_0x987b('0xb'),EXTRACTED_REPORT_ID,_0x987b('0xc')));return db[_0x987b('0xd')][_0x987b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x987b('0xf'),_0x987b('0x10')]})['then'](function(_0x4446f4){if(_0x4446f4){_0x3c831c=_0x4446f4;_0xea42ba=_0x3c831c[_0x987b('0x10')]||0x1388;}})[_0x987b('0x11')](function(){return dbH[_0x987b('0x12')][_0x987b('0x13')](util[_0x987b('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x987b('0x12')][_0x987b('0x15')][_0x987b('0x16')]});})[_0x987b('0x11')](function(_0x1d77eb){if(!_0x1d77eb[0x0][_0x987b('0x17')]){return analyticExtractedReport(_0x987b('0x18'));}var _0x1f5e0b=[];var _0xc39ec4=0x0;if(_0x3c831c['split']){if(_0x1d77eb&&_0x1d77eb['length']){var _0xfc85c=_[_0x987b('0x19')](_0x1d77eb[0x0]['num']/_0xea42ba);var _0x5ad488=Number[_0x987b('0x1a')](_0x1d77eb[0x0][_0x987b('0x17')]/_0xea42ba)?_0x1d77eb[0x0][_0x987b('0x17')]%_0xea42ba:0x0;_0xfc85c[_0x987b('0x1b')](function(_0x36377f){if(_0x36377f>0x0){_0xc39ec4+=_0xea42ba;}_0x1f5e0b[_0x987b('0x1c')](dbH[_0x987b('0x12')]['query'](util[_0x987b('0x14')](_0x987b('0x1d'),QUERY,_0xea42ba,_0xc39ec4),{'type':dbH[_0x987b('0x12')][_0x987b('0x15')]['SELECT']}));});if(_0x5ad488>0x0){_0xc39ec4+=_0xea42ba;_0x1f5e0b[_0x987b('0x1c')](dbH['sequelize']['query'](util[_0x987b('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5ad488,_0xc39ec4),{'type':dbH['sequelize'][_0x987b('0x15')][_0x987b('0x16')]}));}}}else{_0x1f5e0b[_0x987b('0x1c')](dbH[_0x987b('0x12')][_0x987b('0x13')](QUERY,{'type':dbH[_0x987b('0x12')][_0x987b('0x15')][_0x987b('0x16')]}));}var _0x366c0b=path['dirname'](PATH);var _0xb0fbb=path[_0x987b('0x1e')](PATH,'.csv');var _0x2bf99f=_0x3c831c[_0x987b('0xf')]&&_0x1f5e0b[_0x987b('0x1f')]>0x1;var _0xa62511=[];if(!fs[_0x987b('0x20')](path[_0x987b('0x21')](_0x366c0b,_0xb0fbb))&&_0x2bf99f){fs[_0x987b('0x22')](path[_0x987b('0x21')](_0x366c0b,_0xb0fbb));}return BPromise[_0x987b('0x23')](_0x1f5e0b,function(_0x415433){_0xa62511[_0x987b('0x1c')](_0x415433);})[_0x987b('0x11')](function(){for(var _0x2f989d=0x0;_0x2f989d<_0xa62511[_0x987b('0x1f')];_0x2f989d+=0x1){var _0x2c1cda;var _0x43d660=_0xa62511[_0x2f989d];if(_0x2bf99f){_0x2c1cda=path[_0x987b('0x21')](_0x366c0b,_0xb0fbb,util[_0x987b('0x14')]('%s%d.%s',_0xb0fbb,_0x2f989d,_0x987b('0x24')));}else{_0x2c1cda=path['join'](_0x366c0b,util['format'](_0x987b('0x25'),_0xb0fbb,_0x987b('0x24')));}fs[_0x987b('0x26')](_0x2c1cda,csv(_0x43d660));}})[_0x987b('0x11')](function(){if(_0x2bf99f){return new Promise(function(_0x2e349d){zipdir(path['join'](_0x366c0b,_0xb0fbb),{'saveTo':path[_0x987b('0x21')](_0x366c0b,util[_0x987b('0x14')](_0x987b('0x25'),_0xb0fbb,_0x987b('0x27')))},function(_0x117434,_0x2f0dac){rimraf(path[_0x987b('0x21')](_0x366c0b,_0xb0fbb),function(){});_0x2e349d(_0x987b('0x28'));});});}})[_0x987b('0x11')](function(){logger['info'](util[_0x987b('0x14')](_0x987b('0x29'),EXTRACTED_REPORT_ID,_0x987b('0xc')));return analyticExtractedReport(_0x987b('0x2a'),_0x2bf99f?util[_0x987b('0x14')](_0x987b('0x25'),_0xb0fbb,_0x2bf99f?'zip':_0x987b('0x24')):null);});})[_0x987b('0x2b')](function(_0x410d63){logger[_0x987b('0x2c')](util[_0x987b('0x14')](_0x987b('0x2d'),EXTRACTED_REPORT_ID,_0x987b('0xc')),util['inspect'](_0x410d63,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x987b('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0c20=['range','isInteger','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length'];(function(_0x13d815,_0x5572c2){var _0x4fd8c3=function(_0x598d0b){while(--_0x598d0b){_0x13d815['push'](_0x13d815['shift']());}};_0x4fd8c3(++_0x5572c2);}(_0x0c20,0xad));var _0x00c2=function(_0xe05571,_0x392c0e){_0xe05571=_0xe05571-0x0;var _0x67ca7f=_0x0c20[_0xe05571];return _0x67ca7f;};'use strict';var util=require(_0x00c2('0x0'));var path=require(_0x00c2('0x1'));var _=require('lodash');var csv=require(_0x00c2('0x2'));var fs=require('fs');var BPromise=require(_0x00c2('0x3'));var zipdir=require(_0x00c2('0x4'));var rimraf=require('rimraf');var db=require(_0x00c2('0x5'))['db'];var dbH=require(_0x00c2('0x5'))[_0x00c2('0x6')];var logger=require(_0x00c2('0x7'))(_0x00c2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x00c2('0x9')][0x2]);var QUERY=process[_0x00c2('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x272ebb,_0x5f50bb){var _0x370db5={'status':_0x272ebb};var _0x108803={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f50bb){_0x370db5[_0x00c2('0xa')]=_0x5f50bb;}return db[_0x00c2('0xb')][_0x00c2('0xc')](_0x370db5,_0x108803);}function main(){var _0x3d1f8f=0x1388;var _0x12a5b8;logger[_0x00c2('0xd')](util[_0x00c2('0xe')](_0x00c2('0xf'),EXTRACTED_REPORT_ID,_0x00c2('0x10')));return db[_0x00c2('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x00c2('0x12')]})[_0x00c2('0x13')](function(_0xc55927){if(_0xc55927){_0x12a5b8=_0xc55927;_0x3d1f8f=_0x12a5b8[_0x00c2('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x00c2('0x14')](util[_0x00c2('0xe')](_0x00c2('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x00c2('0x16')]});})[_0x00c2('0x13')](function(_0x5c50cc){if(!_0x5c50cc[0x0][_0x00c2('0x17')]){return analyticExtractedReport(_0x00c2('0x18'));}var _0x4e15d1=[];var _0x54fd91=0x0;if(_0x12a5b8[_0x00c2('0x19')]){if(_0x5c50cc&&_0x5c50cc[_0x00c2('0x1a')]){var _0x2a0de5=_[_0x00c2('0x1b')](_0x5c50cc[0x0][_0x00c2('0x17')]/_0x3d1f8f);var _0x21ce24=Number[_0x00c2('0x1c')](_0x5c50cc[0x0]['num']/_0x3d1f8f)?_0x5c50cc[0x0]['num']%_0x3d1f8f:0x0;_0x2a0de5[_0x00c2('0x1d')](function(_0x418d4c){if(_0x418d4c>0x0){_0x54fd91+=_0x3d1f8f;}_0x4e15d1['push'](dbH[_0x00c2('0x1e')][_0x00c2('0x14')](util[_0x00c2('0xe')](_0x00c2('0x1f'),QUERY,_0x3d1f8f,_0x54fd91),{'type':dbH[_0x00c2('0x1e')][_0x00c2('0x20')]['SELECT']}));});if(_0x21ce24>0x0){_0x54fd91+=_0x3d1f8f;_0x4e15d1[_0x00c2('0x21')](dbH[_0x00c2('0x1e')]['query'](util[_0x00c2('0xe')](_0x00c2('0x1f'),QUERY,_0x21ce24,_0x54fd91),{'type':dbH[_0x00c2('0x1e')][_0x00c2('0x20')]['SELECT']}));}}}else{_0x4e15d1[_0x00c2('0x21')](dbH[_0x00c2('0x1e')][_0x00c2('0x14')](QUERY,{'type':dbH['sequelize'][_0x00c2('0x20')][_0x00c2('0x16')]}));}var _0x3c9714=path['dirname'](PATH);var _0x12835f=path[_0x00c2('0x22')](PATH,_0x00c2('0x23'));var _0x140641=_0x12a5b8[_0x00c2('0x19')]&&_0x4e15d1[_0x00c2('0x1a')]>0x1;var _0x5637d4=[];if(!fs[_0x00c2('0x24')](path['join'](_0x3c9714,_0x12835f))&&_0x140641){fs['mkdirSync'](path[_0x00c2('0x25')](_0x3c9714,_0x12835f));}return BPromise[_0x00c2('0x26')](_0x4e15d1,function(_0x13d9c3){_0x5637d4[_0x00c2('0x21')](_0x13d9c3);})[_0x00c2('0x13')](function(){for(var _0x47cc4f=0x0;_0x47cc4f<_0x5637d4[_0x00c2('0x1a')];_0x47cc4f+=0x1){var _0x312c02;var _0xc0d738=_0x5637d4[_0x47cc4f];if(_0x140641){_0x312c02=path[_0x00c2('0x25')](_0x3c9714,_0x12835f,util[_0x00c2('0xe')](_0x00c2('0x27'),_0x12835f,_0x47cc4f,_0x00c2('0x28')));}else{_0x312c02=path['join'](_0x3c9714,util['format'](_0x00c2('0x29'),_0x12835f,'csv'));}fs[_0x00c2('0x2a')](_0x312c02,csv(_0xc0d738));}})[_0x00c2('0x13')](function(){if(_0x140641){return new Promise(function(_0x8b0815){zipdir(path[_0x00c2('0x25')](_0x3c9714,_0x12835f),{'saveTo':path[_0x00c2('0x25')](_0x3c9714,util[_0x00c2('0xe')](_0x00c2('0x29'),_0x12835f,'zip'))},function(_0x13bf36,_0x37171d){rimraf(path['join'](_0x3c9714,_0x12835f),function(){});_0x8b0815(_0x00c2('0x2b'));});});}})[_0x00c2('0x13')](function(){logger['info'](util[_0x00c2('0xe')](_0x00c2('0x2c'),EXTRACTED_REPORT_ID,_0x00c2('0x10')));return analyticExtractedReport(_0x00c2('0x2d'),_0x140641?util['format'](_0x00c2('0x29'),_0x12835f,_0x140641?'zip':_0x00c2('0x28')):null);});})[_0x00c2('0x2e')](function(_0x5ae55a){logger[_0x00c2('0xd')](util[_0x00c2('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x00c2('0x10')),util['inspect'](_0x5ae55a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x00c2('0x2f'));})[_0x00c2('0x30')](function(){process[_0x00c2('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9beb289..e5fc7d6 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 _0x031d=['range','num','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','.pdf','join','each','flatten','createPdfKitDocument','pdf','all','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','finally','exit','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','lodash','util','path','moment','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','pick','fill','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','before','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','split','splitSizePdf','then','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x031d,0xcd));var _0xd031=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x031d[_0x2300f2];return _0x6bd508;};'use strict';var _=require(_0xd031('0x0'));var fs=require('fs');var util=require(_0xd031('0x1'));var path=require(_0xd031('0x2'));var moment=require(_0xd031('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xd031('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xd031('0x5'))[_0xd031('0x6')];var window=new JSDOM('')[_0xd031('0x7')];var BPromise=require('bluebird');var db=require(_0xd031('0x8'))['db'];var dbH=require('../../mysqldb')[_0xd031('0x9')];var logger=require(_0xd031('0xa'))(_0xd031('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd031('0xc')][0x3];var PATH=process[_0xd031('0xc')][0x4];var NAME=process[_0xd031('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a609a,_0x46cda6){var _0x475f9c={'status':_0x2a609a};var _0x4dc575={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46cda6){_0x475f9c[_0xd031('0xd')]=_0x46cda6;}return db[_0xd031('0xe')]['update'](_0x475f9c,_0x4dc575);}function getHeaders(_0x4ddf55){return _[_0xd031('0xf')](_0x4ddf55,function(_0x131649){return{'text':_0x131649,'style':'tableHeader'};});}function getRows(_0x5401c0,_0x14bdc5){return _[_0xd031('0xf')](_0x14bdc5,function(_0x3348b5){return _(_0x3348b5)[_0xd031('0x10')](_0x5401c0)[_0xd031('0xf')](function(_0x4ba4fa){return _0x4ba4fa?_['toString'](_0x4ba4fa):'';})['value']();});}function createTable(_0xa4601,_0x4e74f5){var _0x45e420={'widths':_[_0xd031('0x11')](Array(_0xa4601['length']),0x91),'heights':function(_0x499b3d){return _0x499b3d===0x0?_0xd031('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x57134f=getHeaders(_0xa4601);_0x45e420[_0xd031('0x13')][_0xd031('0x14')](_0x57134f);var _0x4fecf2=getRows(_0xa4601,_0x4e74f5);_0x45e420['body']=_0x45e420['body'][_0xd031('0x15')](_0x4fecf2);return _0x45e420;}function createTables(_0x2795ee){var _0x2fe16f=[];var _0x3813ce=_['chunk'](Object[_0xd031('0x16')](_0x2795ee[0x0]),0x5);_0x3813ce[_0xd031('0x17')](function(_0x1719ab){_0x2fe16f['push'](createTable(_0x1719ab,_0x2795ee));});return _0x2fe16f;}function getPDFDocDefinition(_0x280ea2){var _0x37d56c=util[_0xd031('0x18')](_0xd031('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xd031('0x1a')])['format'](FORMAT));var _0x4a6bd2=[];for(var _0xdeb6ed=0x0;_0xdeb6ed<_0x280ea2['length'];_0xdeb6ed++){var _0x3aa3da=[];if(_0xdeb6ed===0x0){_0x3aa3da['push']({'text':_0x37d56c,'style':_0xd031('0x1b')});}var _0x21852d={'table':_0x280ea2[_0xdeb6ed]};if(_0xdeb6ed>0x0){_0x21852d['pageBreak']=_0xd031('0x1c');_0x21852d[_0xd031('0x1d')]=[0x0,0x46,0x0,0x0];}_0x3aa3da['push'](_0x21852d);_0x4a6bd2[_0xd031('0x14')](_0x3aa3da);}return{'pageSize':'A4','pageOrientation':_0xd031('0x1e'),'content':_0x4a6bd2,'footer':function(_0x63f819,_0x49256b){return{'text':_0x63f819[_0xd031('0x1f')]()+_0xd031('0x20')+_0x49256b,'style':_0xd031('0x21')};},'defaultStyle':{'font':_0xd031('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd031('0x23')},'footer':{'alignment':_0xd031('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5337de){var _0x30d72c=0x1388;var _0x4eef99;if(!_0x5337de[0x0]['num']){return analyticExtractedReport(_0xd031('0x25'));}return db[_0xd031('0x26')][_0xd031('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd031('0x28'),_0xd031('0x29')]})[_0xd031('0x2a')](function(_0x251339){if(_0x251339){_0x4eef99=_0x251339;_0x30d72c=_0x4eef99[_0xd031('0x29')]||0x3e8;}})[_0xd031('0x2a')](function(){var _0x448655=[];var _0x1f0320=0x0;if(_0x4eef99[_0xd031('0x28')]){if(_0x5337de&&_0x5337de[_0xd031('0x2b')]){var _0x37ba0e=_[_0xd031('0x2c')](_0x5337de[0x0][_0xd031('0x2d')]/_0x30d72c);var _0x5e16b9=Number[_0xd031('0x2e')](_0x5337de[0x0][_0xd031('0x2d')]/_0x30d72c)?_0x5337de[0x0][_0xd031('0x2d')]%_0x30d72c:0x0;_0x37ba0e[_0xd031('0x17')](function(_0x2b0c66){if(_0x2b0c66>0x0){_0x1f0320+=_0x30d72c;}_0x448655[_0xd031('0x14')](dbH['sequelize']['query'](util[_0xd031('0x18')](_0xd031('0x2f'),QUERY,_0x30d72c,_0x1f0320),{'type':dbH[_0xd031('0x30')][_0xd031('0x31')][_0xd031('0x32')]}));});if(_0x5e16b9>0x0){_0x1f0320+=_0x30d72c;_0x448655[_0xd031('0x14')](dbH['sequelize']['query'](util['format'](_0xd031('0x2f'),QUERY,_0x5e16b9,_0x1f0320),{'type':dbH[_0xd031('0x30')][_0xd031('0x31')][_0xd031('0x32')]}));}}}else{_0x448655[_0xd031('0x14')](dbH[_0xd031('0x30')][_0xd031('0x33')](QUERY,{'type':dbH[_0xd031('0x30')][_0xd031('0x31')][_0xd031('0x32')]}));}var _0x45ed33=path[_0xd031('0x34')](PATH);var _0x414e13=path['basename'](PATH,_0xd031('0x35'));var _0x218ec4=_0x4eef99['split']&&_0x448655['length']>0x1;var _0x3a6bbb=[];if(!fs['existsSync'](path[_0xd031('0x36')](_0x45ed33,_0x414e13))&&_0x218ec4){fs['mkdirSync'](path[_0xd031('0x36')](_0x45ed33,_0x414e13));}return BPromise[_0xd031('0x37')](_0x448655,function(_0x3c2d7c){_0x3a6bbb[_0xd031('0x14')](_0x3c2d7c);})[_0xd031('0x2a')](function(){var _0x9df0df=[];for(var _0x3153b7=0x0;_0x3153b7<_0x3a6bbb[_0xd031('0x2b')];_0x3153b7+=0x1){var _0x305231=_0x3a6bbb[_0x3153b7];var _0x56ae43=createTables(_[_0xd031('0x38')](_0x305231));var _0x19516b;var _0x130b39=getPDFDocDefinition(_0x56ae43);var _0x4d253d=getPDFPrinter();var _0x12c910=_0x4d253d[_0xd031('0x39')](_0x130b39);if(_0x218ec4){_0x19516b=path['join'](_0x45ed33,_0x414e13,util['format']('%s%d.%s',_0x414e13,_0x3153b7,_0xd031('0x3a')));}else{_0x19516b=path[_0xd031('0x36')](_0x45ed33,util['format']('%s.%s',_0x414e13,'pdf'));}_0x9df0df[_0xd031('0x14')](writePDFDocument(_0x12c910,_0x19516b));}return Promise[_0xd031('0x3b')](_0x9df0df);})[_0xd031('0x2a')](function(){if(_0x218ec4){return new Promise(function(_0x47028f){zipdir(path[_0xd031('0x36')](_0x45ed33,_0x414e13),{'saveTo':path[_0xd031('0x36')](_0x45ed33,util['format'](_0xd031('0x3c'),_0x414e13,'zip'))},function(){rimraf(path[_0xd031('0x36')](_0x45ed33,_0x414e13),function(){});_0x47028f(_0xd031('0x3d'));});});}})[_0xd031('0x2a')](function(){if(!_0x218ec4)return;rimraf(path[_0xd031('0x36')](_0x45ed33,_0x414e13),function(){});})['then'](function(){logger['info'](util[_0xd031('0x18')](_0xd031('0x3e'),EXTRACTED_REPORT_ID,_0xd031('0x3f')));return analyticExtractedReport(_0xd031('0x40'),_0x218ec4?util[_0xd031('0x18')](_0xd031('0x3c'),_0x414e13,_0x218ec4?'zip':_0xd031('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xd031('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0xd031('0xe')][_0xd031('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd031('0x2a')](function(_0x4bcd67){EXTRACTED_REPORT=_0x4bcd67;return dbH[_0xd031('0x30')][_0xd031('0x33')](util['format'](_0xd031('0x42'),QUERY),{'type':dbH[_0xd031('0x30')][_0xd031('0x31')]['SELECT']});})[_0xd031('0x2a')](extractReport)[_0xd031('0x43')](function(_0x3fa54c){logger[_0xd031('0x44')](util[_0xd031('0x18')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xd031('0x45')](_0x3fa54c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd031('0x46')](function(){process[_0xd031('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x390c1b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xd031('0x48'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x390c1b;}function getPDFDocDefinitionFromHTML(_0xb076d3,_0x42ce90){var _0x290410=util[_0xd031('0x18')](_0xd031('0x49'),_0x42ce90['channel'],_0x42ce90[_0xd031('0x4a')]);var _0x4216df=moment()[_0xd031('0x18')](_0xd031('0x4b'))[_0xd031('0x1f')]();var _0x257cac=htmlToPdfmake(_0xb076d3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x257cac],'defaultStyle':{'font':_0xd031('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd031('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd031('0x4c')}},'header':function(){return[{'text':_0xd031('0x4d'),'style':_0xd031('0x1b')}];},'footer':function(_0x2b11f9,_0x25d68c){return[{'text':util[_0xd031('0x18')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x290410,_0x2b11f9,_0x25d68c,_0x4216df),'style':'footer'}];}};}function writePDFDocument(_0x80fa9b,_0x5c5d52){return new Promise(function(_0x1c293e,_0x23068d){var _0x376d79=_0x80fa9b[_0xd031('0x4e')](fs[_0xd031('0x4f')](_0x5c5d52));_0x376d79['on'](_0xd031('0x50'),function(){_0x1c293e('finish');});_0x376d79['on'](_0xd031('0x51'),function(_0x29d35d){_0x23068d(_0x29d35d);});_0x80fa9b[_0xd031('0x52')]();});}exports['createPdfFromHTML']=function(_0x27a92b,_0x5b3784){var _0x1be817=getPDFPrinter();var _0x54da2e=getPDFDocDefinitionFromHTML(_0x27a92b,_0x5b3784);var _0x5045a0=_0x1be817[_0xd031('0x39')](_0x54da2e);return writePDFDocument(_0x5045a0,_0x5b3784[_0xd031('0x2')])[_0xd031('0x43')](function(_0x370da8){throw _0x370da8;});}; \ No newline at end of file +var _0x8279=['.pdf','join','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','JSDOM','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','landscape','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','QueryTypes','SELECT'];(function(_0x265eb3,_0x16940a){var _0x11981e=function(_0x3c8849){while(--_0x3c8849){_0x265eb3['push'](_0x265eb3['shift']());}};_0x11981e(++_0x16940a);}(_0x8279,0x164));var _0x9827=function(_0x2ea2b9,_0x48f001){_0x2ea2b9=_0x2ea2b9-0x0;var _0xa3e4b0=_0x8279[_0x2ea2b9];return _0xa3e4b0;};'use strict';var _=require(_0x9827('0x0'));var fs=require('fs');var util=require(_0x9827('0x1'));var path=require(_0x9827('0x2'));var moment=require(_0x9827('0x3'));var htmlToPdfmake=require(_0x9827('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9827('0x5'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x9827('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x9827('0x7'))['db'];var dbH=require(_0x9827('0x7'))[_0x9827('0x8')];var logger=require(_0x9827('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9827('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9827('0xa')][0x4];var NAME=process[_0x9827('0xa')][0x5];var FORMAT=_0x9827('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x24458e,_0xa862e7){var _0x42ef43={'status':_0x24458e};var _0x375980={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa862e7){_0x42ef43['savename']=_0xa862e7;}return db['AnalyticExtractedReport'][_0x9827('0xc')](_0x42ef43,_0x375980);}function getHeaders(_0x3f2907){return _[_0x9827('0xd')](_0x3f2907,function(_0xbc4880){return{'text':_0xbc4880,'style':'tableHeader'};});}function getRows(_0x1adc27,_0x513a06){return _[_0x9827('0xd')](_0x513a06,function(_0x18009a){return _(_0x18009a)[_0x9827('0xe')](_0x1adc27)[_0x9827('0xd')](function(_0x16a460){return _0x16a460?_[_0x9827('0xf')](_0x16a460):'';})[_0x9827('0x10')]();});}function createTable(_0x3ab88a,_0x2dccfb){var _0x1dde93={'widths':_[_0x9827('0x11')](Array(_0x3ab88a[_0x9827('0x12')]),0x91),'heights':function(_0x46ceae){return _0x46ceae===0x0?_0x9827('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x44be18=getHeaders(_0x3ab88a);_0x1dde93[_0x9827('0x14')]['push'](_0x44be18);var _0x47adf9=getRows(_0x3ab88a,_0x2dccfb);_0x1dde93['body']=_0x1dde93[_0x9827('0x14')][_0x9827('0x15')](_0x47adf9);return _0x1dde93;}function createTables(_0x3d6cad){var _0x23d651=[];var _0x5d0fa5=_[_0x9827('0x16')](Object[_0x9827('0x17')](_0x3d6cad[0x0]),0x5);_0x5d0fa5[_0x9827('0x18')](function(_0x5b40b6){_0x23d651[_0x9827('0x19')](createTable(_0x5b40b6,_0x3d6cad));});return _0x23d651;}function getPDFDocDefinition(_0x549200){var _0x279957=util['format'](_0x9827('0x1a'),NAME,EXTRACTED_REPORT[_0x9827('0x1b')],moment(EXTRACTED_REPORT[_0x9827('0x1c')])[_0x9827('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x9827('0x1e')])[_0x9827('0x1d')](FORMAT));var _0x17b4c8=[];for(var _0x5863fe=0x0;_0x5863fe<_0x549200[_0x9827('0x12')];_0x5863fe++){var _0x48bcd1=[];if(_0x5863fe===0x0){_0x48bcd1[_0x9827('0x19')]({'text':_0x279957,'style':_0x9827('0x1f')});}var _0x2a87a6={'table':_0x549200[_0x5863fe]};if(_0x5863fe>0x0){_0x2a87a6['pageBreak']='before';_0x2a87a6['margin']=[0x0,0x46,0x0,0x0];}_0x48bcd1[_0x9827('0x19')](_0x2a87a6);_0x17b4c8[_0x9827('0x19')](_0x48bcd1);}return{'pageSize':'A4','pageOrientation':_0x9827('0x20'),'content':_0x17b4c8,'footer':function(_0x3b03ac,_0x2c766a){return{'text':_0x3b03ac['toString']()+'\x20/\x20'+_0x2c766a,'style':_0x9827('0x21')};},'defaultStyle':{'font':_0x9827('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9827('0x23')},'footer':{'alignment':_0x9827('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2f9765){var _0x4b8a7b=0x1388;var _0x5da253;if(!_0x2f9765[0x0][_0x9827('0x25')]){return analyticExtractedReport(_0x9827('0x26'));}return db[_0x9827('0x27')][_0x9827('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9827('0x29'),_0x9827('0x2a')]})[_0x9827('0x2b')](function(_0x5d5c7d){if(_0x5d5c7d){_0x5da253=_0x5d5c7d;_0x4b8a7b=_0x5da253[_0x9827('0x2a')]||0x3e8;}})['then'](function(){var _0x3f0bfa=[];var _0x2cfef9=0x0;if(_0x5da253[_0x9827('0x29')]){if(_0x2f9765&&_0x2f9765[_0x9827('0x12')]){var _0x3571a4=_['range'](_0x2f9765[0x0][_0x9827('0x25')]/_0x4b8a7b);var _0x4134e7=Number[_0x9827('0x2c')](_0x2f9765[0x0][_0x9827('0x25')]/_0x4b8a7b)?_0x2f9765[0x0]['num']%_0x4b8a7b:0x0;_0x3571a4[_0x9827('0x18')](function(_0x355aea){if(_0x355aea>0x0){_0x2cfef9+=_0x4b8a7b;}_0x3f0bfa[_0x9827('0x19')](dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b8a7b,_0x2cfef9),{'type':dbH[_0x9827('0x2d')][_0x9827('0x2f')][_0x9827('0x30')]}));});if(_0x4134e7>0x0){_0x2cfef9+=_0x4b8a7b;_0x3f0bfa[_0x9827('0x19')](dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4134e7,_0x2cfef9),{'type':dbH['sequelize'][_0x9827('0x2f')][_0x9827('0x30')]}));}}}else{_0x3f0bfa['push'](dbH[_0x9827('0x2d')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x327855=path['dirname'](PATH);var _0x6cb1dc=path['basename'](PATH,_0x9827('0x31'));var _0x1081c4=_0x5da253['split']&&_0x3f0bfa[_0x9827('0x12')]>0x1;var _0x14a0eb=[];if(!fs['existsSync'](path['join'](_0x327855,_0x6cb1dc))&&_0x1081c4){fs['mkdirSync'](path[_0x9827('0x32')](_0x327855,_0x6cb1dc));}return BPromise['each'](_0x3f0bfa,function(_0x14280b){_0x14a0eb[_0x9827('0x19')](_0x14280b);})['then'](function(){var _0xddc24a=[];for(var _0x58aa52=0x0;_0x58aa52<_0x14a0eb[_0x9827('0x12')];_0x58aa52+=0x1){var _0x29a003=_0x14a0eb[_0x58aa52];var _0x508673=createTables(_[_0x9827('0x33')](_0x29a003));var _0x3be7c3;var _0x4a2f69=getPDFDocDefinition(_0x508673);var _0x227b8e=getPDFPrinter();var _0x544589=_0x227b8e[_0x9827('0x34')](_0x4a2f69);if(_0x1081c4){_0x3be7c3=path[_0x9827('0x32')](_0x327855,_0x6cb1dc,util[_0x9827('0x1d')](_0x9827('0x35'),_0x6cb1dc,_0x58aa52,_0x9827('0x36')));}else{_0x3be7c3=path[_0x9827('0x32')](_0x327855,util['format']('%s.%s',_0x6cb1dc,'pdf'));}_0xddc24a[_0x9827('0x19')](writePDFDocument(_0x544589,_0x3be7c3));}return Promise[_0x9827('0x37')](_0xddc24a);})[_0x9827('0x2b')](function(){if(_0x1081c4){return new Promise(function(_0x4b2053){zipdir(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),{'saveTo':path[_0x9827('0x32')](_0x327855,util['format'](_0x9827('0x38'),_0x6cb1dc,'zip'))},function(){rimraf(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),function(){});_0x4b2053(_0x9827('0x39'));});});}})['then'](function(){if(!_0x1081c4)return;rimraf(path[_0x9827('0x32')](_0x327855,_0x6cb1dc),function(){});})[_0x9827('0x2b')](function(){logger[_0x9827('0x3a')](util[_0x9827('0x1d')](_0x9827('0x3b'),EXTRACTED_REPORT_ID,_0x9827('0x3c')));return analyticExtractedReport('Completed',_0x1081c4?util[_0x9827('0x1d')]('%s.%s',_0x6cb1dc,_0x1081c4?_0x9827('0x3d'):_0x9827('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9827('0x3a')](util[_0x9827('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9827('0x3c')));return db[_0x9827('0x3e')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9827('0x2b')](function(_0x470210){EXTRACTED_REPORT=_0x470210;return dbH[_0x9827('0x2d')][_0x9827('0x2e')](util[_0x9827('0x1d')](_0x9827('0x3f'),QUERY),{'type':dbH[_0x9827('0x2d')]['QueryTypes'][_0x9827('0x30')]});})[_0x9827('0x2b')](extractReport)[_0x9827('0x40')](function(_0x585831){logger[_0x9827('0x3a')](util[_0x9827('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9827('0x3c')),util[_0x9827('0x41')](_0x585831,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9827('0x42')](function(){process[_0x9827('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x38bab3=new PdfPrinter({'Arial':{'normal':__dirname+_0x9827('0x44'),'bold':__dirname+_0x9827('0x45'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9827('0x46')}});return _0x38bab3;}function getPDFDocDefinitionFromHTML(_0x316c6a,_0x3c074d){var _0x270b11=util[_0x9827('0x1d')](_0x9827('0x47'),_0x3c074d[_0x9827('0x48')],_0x3c074d[_0x9827('0x49')]);var _0x35a960=moment()['format']('YYYY-MM-DD')['toString']();var _0x3f1a13=htmlToPdfmake(_0x316c6a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3f1a13],'defaultStyle':{'font':_0x9827('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9827('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x9827('0x1f')}];},'footer':function(_0x502931,_0x3d3d2c){return[{'text':util[_0x9827('0x1d')](_0x9827('0x4b'),_0x270b11,_0x502931,_0x3d3d2c,_0x35a960),'style':_0x9827('0x21')}];}};}function writePDFDocument(_0x14aacd,_0x268329){return new Promise(function(_0x4c8a25,_0x48e6ff){var _0x2010d0=_0x14aacd[_0x9827('0x4c')](fs['createWriteStream'](_0x268329));_0x2010d0['on'](_0x9827('0x4d'),function(){_0x4c8a25('finish');});_0x2010d0['on'](_0x9827('0x4e'),function(_0x39dab1){_0x48e6ff(_0x39dab1);});_0x14aacd[_0x9827('0x4f')]();});}exports[_0x9827('0x50')]=function(_0x418af1,_0x2ebc84){var _0x5e543d=getPDFPrinter();var _0x3cb699=getPDFDocDefinitionFromHTML(_0x418af1,_0x2ebc84);var _0x108502=_0x5e543d['createPdfKitDocument'](_0x3cb699);return writePDFDocument(_0x108502,_0x2ebc84[_0x9827('0x2')])[_0x9827('0x40')](function(_0x5337ca){throw _0x5337ca;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d271354..b4bb23c 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 _0xcd78=['bluebird','zip-dir','rimraf','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','path','json2xls'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcd78,0xa9));var _0x8cd7=function(_0x3f70af,_0x1df3dc){_0x3f70af=_0x3f70af-0x0;var _0x54ab77=_0xcd78[_0x3f70af];return _0x54ab77;};'use strict';var util=require(_0x8cd7('0x0'));var path=require(_0x8cd7('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x8cd7('0x2'));var BPromise=require(_0x8cd7('0x3'));var zipdir=require(_0x8cd7('0x4'));var rimraf=require(_0x8cd7('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x8cd7('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8cd7('0x7')][0x2]);var QUERY=process[_0x8cd7('0x7')][0x3];var PATH=process[_0x8cd7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x574bf9,_0x4e73e4){var _0x529ecd={'status':_0x574bf9};var _0x165873={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e73e4){_0x529ecd[_0x8cd7('0x8')]=_0x4e73e4;}return db[_0x8cd7('0x9')]['update'](_0x529ecd,_0x165873);}function main(){var _0x546880=0x1388;var _0x481817;logger[_0x8cd7('0xa')](util[_0x8cd7('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8cd7('0xc'),_0x8cd7('0xd')]})[_0x8cd7('0xe')](function(_0x1e1816){if(_0x1e1816){_0x481817=_0x1e1816;_0x546880=_0x481817[_0x8cd7('0xd')]||0x1388;}})[_0x8cd7('0xe')](function(){return dbH[_0x8cd7('0xf')]['query'](util[_0x8cd7('0xb')](_0x8cd7('0x10'),QUERY),{'type':dbH['sequelize'][_0x8cd7('0x11')]['SELECT']});})[_0x8cd7('0xe')](function(_0x46222c){if(!_0x46222c[0x0][_0x8cd7('0x12')]){return analyticExtractedReport('Empty');}var _0x47eacb=[];var _0x18ebbc=0x0;if(_0x481817[_0x8cd7('0xc')]){if(_0x46222c&&_0x46222c[_0x8cd7('0x13')]){var _0x4f0e06=_['range'](_0x46222c[0x0]['num']/_0x546880);var _0x39b142=Number[_0x8cd7('0x14')](_0x46222c[0x0]['num']/_0x546880)?_0x46222c[0x0]['num']%_0x546880:0x0;_0x4f0e06[_0x8cd7('0x15')](function(_0x12b05d){if(_0x12b05d>0x0){_0x18ebbc+=_0x546880;}_0x47eacb['push'](dbH[_0x8cd7('0xf')][_0x8cd7('0x16')](util['format'](_0x8cd7('0x17'),QUERY,_0x546880,_0x18ebbc),{'type':dbH['sequelize']['QueryTypes'][_0x8cd7('0x18')]}));});if(_0x39b142>0x0){_0x18ebbc+=_0x546880;_0x47eacb[_0x8cd7('0x19')](dbH['sequelize'][_0x8cd7('0x16')](util[_0x8cd7('0xb')](_0x8cd7('0x17'),QUERY,_0x39b142,_0x18ebbc),{'type':dbH['sequelize']['QueryTypes'][_0x8cd7('0x18')]}));}}}else{_0x47eacb[_0x8cd7('0x19')](dbH[_0x8cd7('0xf')][_0x8cd7('0x16')](QUERY,{'type':dbH['sequelize'][_0x8cd7('0x11')]['SELECT']}));}var _0x46ba49=path['dirname'](PATH);var _0xba3de=path[_0x8cd7('0x1a')](PATH,_0x8cd7('0x1b'));var _0xfb57ea=_0x481817[_0x8cd7('0xc')]&&_0x47eacb[_0x8cd7('0x13')]>0x1;var _0x5cbedb=[];if(!fs['existsSync'](path[_0x8cd7('0x1c')](_0x46ba49,_0xba3de))&&_0xfb57ea){fs['mkdirSync'](path['join'](_0x46ba49,_0xba3de));}return BPromise[_0x8cd7('0x1d')](_0x47eacb,function(_0x3decd4){_0x5cbedb[_0x8cd7('0x19')](_0x3decd4);})[_0x8cd7('0xe')](function(){for(var _0x427811=0x0;_0x427811<_0x5cbedb[_0x8cd7('0x13')];_0x427811+=0x1){var _0x31ad86;var _0x4331db=_0x5cbedb[_0x427811];if(_0xfb57ea){_0x31ad86=path[_0x8cd7('0x1c')](_0x46ba49,_0xba3de,util['format'](_0x8cd7('0x1e'),_0xba3de,_0x427811,_0x8cd7('0x1f')));}else{_0x31ad86=path[_0x8cd7('0x1c')](_0x46ba49,util[_0x8cd7('0xb')](_0x8cd7('0x20'),_0xba3de,'xlsx'));}fs[_0x8cd7('0x21')](_0x31ad86,json2xls(_0x4331db),_0x8cd7('0x22'));}})[_0x8cd7('0xe')](function(){if(_0xfb57ea){return new Promise(function(_0x1ccad0){zipdir(path[_0x8cd7('0x1c')](_0x46ba49,_0xba3de),{'saveTo':path[_0x8cd7('0x1c')](_0x46ba49,util['format'](_0x8cd7('0x20'),_0xba3de,_0x8cd7('0x23')))},function(_0x3d8fee,_0x947081){rimraf(path[_0x8cd7('0x1c')](_0x46ba49,_0xba3de),function(){});_0x1ccad0(_0x8cd7('0x24'));});});}})[_0x8cd7('0xe')](function(){logger[_0x8cd7('0xa')](util[_0x8cd7('0xb')](_0x8cd7('0x25'),EXTRACTED_REPORT_ID,_0x8cd7('0x26')));return analyticExtractedReport(_0x8cd7('0x27'),_0xfb57ea?util[_0x8cd7('0xb')](_0x8cd7('0x20'),_0xba3de,_0xfb57ea?_0x8cd7('0x23'):_0x8cd7('0x1f')):null);});})[_0x8cd7('0x28')](function(_0x4203c7){logger[_0x8cd7('0xa')](util[_0x8cd7('0xb')](_0x8cd7('0x29'),EXTRACTED_REPORT_ID,_0x8cd7('0x26')),util['inspect'](_0x4203c7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8cd7('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb455=['util','path','lodash','json2xls','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit'];(function(_0x5c642b,_0x4a3540){var _0xe94dfa=function(_0x22f8c0){while(--_0x22f8c0){_0x5c642b['push'](_0x5c642b['shift']());}};_0xe94dfa(++_0x4a3540);}(_0xb455,0x104));var _0x5b45=function(_0x25de65,_0x4e1c19){_0x25de65=_0x25de65-0x0;var _0x275a22=_0xb455[_0x25de65];return _0x275a22;};'use strict';var util=require(_0x5b45('0x0'));var path=require(_0x5b45('0x1'));var _=require(_0x5b45('0x2'));var fs=require('fs');var json2xls=require(_0x5b45('0x3'));var BPromise=require(_0x5b45('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x5b45('0x5'))[_0x5b45('0x6')];var logger=require(_0x5b45('0x7'))(_0x5b45('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5b45('0x9')][0x2]);var QUERY=process[_0x5b45('0x9')][0x3];var PATH=process[_0x5b45('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x474120,_0x2e3618){var _0xd51a90={'status':_0x474120};var _0x352be2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e3618){_0xd51a90[_0x5b45('0xa')]=_0x2e3618;}return db[_0x5b45('0xb')][_0x5b45('0xc')](_0xd51a90,_0x352be2);}function main(){var _0x6b2597=0x1388;var _0x4bd4f8;logger[_0x5b45('0xd')](util[_0x5b45('0xe')](_0x5b45('0xf'),EXTRACTED_REPORT_ID,_0x5b45('0x10')));return db[_0x5b45('0x11')][_0x5b45('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5b45('0x13'),'splitSizeXlsx']})[_0x5b45('0x14')](function(_0x2fd3d9){if(_0x2fd3d9){_0x4bd4f8=_0x2fd3d9;_0x6b2597=_0x4bd4f8[_0x5b45('0x15')]||0x1388;}})[_0x5b45('0x14')](function(){return dbH[_0x5b45('0x16')][_0x5b45('0x17')](util[_0x5b45('0xe')](_0x5b45('0x18'),QUERY),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]});})[_0x5b45('0x14')](function(_0x15f0a6){if(!_0x15f0a6[0x0][_0x5b45('0x1b')]){return analyticExtractedReport(_0x5b45('0x1c'));}var _0x2a30ef=[];var _0x24329a=0x0;if(_0x4bd4f8[_0x5b45('0x13')]){if(_0x15f0a6&&_0x15f0a6[_0x5b45('0x1d')]){var _0x4da897=_[_0x5b45('0x1e')](_0x15f0a6[0x0][_0x5b45('0x1b')]/_0x6b2597);var _0x3930eb=Number[_0x5b45('0x1f')](_0x15f0a6[0x0][_0x5b45('0x1b')]/_0x6b2597)?_0x15f0a6[0x0][_0x5b45('0x1b')]%_0x6b2597:0x0;_0x4da897['forEach'](function(_0x5e92a1){if(_0x5e92a1>0x0){_0x24329a+=_0x6b2597;}_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')][_0x5b45('0x17')](util[_0x5b45('0xe')](_0x5b45('0x21'),QUERY,_0x6b2597,_0x24329a),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]}));});if(_0x3930eb>0x0){_0x24329a+=_0x6b2597;_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')]['query'](util[_0x5b45('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3930eb,_0x24329a),{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')][_0x5b45('0x1a')]}));}}}else{_0x2a30ef[_0x5b45('0x20')](dbH[_0x5b45('0x16')][_0x5b45('0x17')](QUERY,{'type':dbH[_0x5b45('0x16')][_0x5b45('0x19')]['SELECT']}));}var _0x52f7b6=path['dirname'](PATH);var _0x53c9a7=path[_0x5b45('0x22')](PATH,_0x5b45('0x23'));var _0x29ce29=_0x4bd4f8[_0x5b45('0x13')]&&_0x2a30ef[_0x5b45('0x1d')]>0x1;var _0x2843fd=[];if(!fs[_0x5b45('0x24')](path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7))&&_0x29ce29){fs['mkdirSync'](path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7));}return BPromise[_0x5b45('0x26')](_0x2a30ef,function(_0x524e23){_0x2843fd[_0x5b45('0x20')](_0x524e23);})[_0x5b45('0x14')](function(){for(var _0x39834e=0x0;_0x39834e<_0x2843fd[_0x5b45('0x1d')];_0x39834e+=0x1){var _0x116cd1;var _0x3b29d6=_0x2843fd[_0x39834e];if(_0x29ce29){_0x116cd1=path['join'](_0x52f7b6,_0x53c9a7,util['format'](_0x5b45('0x27'),_0x53c9a7,_0x39834e,_0x5b45('0x28')));}else{_0x116cd1=path['join'](_0x52f7b6,util[_0x5b45('0xe')](_0x5b45('0x29'),_0x53c9a7,_0x5b45('0x28')));}fs[_0x5b45('0x2a')](_0x116cd1,json2xls(_0x3b29d6),_0x5b45('0x2b'));}})['then'](function(){if(_0x29ce29){return new Promise(function(_0x776381){zipdir(path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7),{'saveTo':path[_0x5b45('0x25')](_0x52f7b6,util['format']('%s.%s',_0x53c9a7,'zip'))},function(_0x207051,_0x458d89){rimraf(path[_0x5b45('0x25')](_0x52f7b6,_0x53c9a7),function(){});_0x776381('zip\x20finished');});});}})[_0x5b45('0x14')](function(){logger[_0x5b45('0xd')](util[_0x5b45('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5b45('0x10')));return analyticExtractedReport(_0x5b45('0x2c'),_0x29ce29?util[_0x5b45('0xe')](_0x5b45('0x29'),_0x53c9a7,_0x29ce29?_0x5b45('0x2d'):_0x5b45('0x28')):null);});})[_0x5b45('0x2e')](function(_0x488d3e){logger[_0x5b45('0xd')](util[_0x5b45('0xe')](_0x5b45('0x2f'),EXTRACTED_REPORT_ID,_0x5b45('0x10')),util[_0x5b45('0x30')](_0x488d3e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5b45('0x31'));})[_0x5b45('0x32')](function(){process[_0x5b45('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f96f1e7..a2d6e4b 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 _0x763a=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','catch','rewrite','lodash','util','models','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat'];(function(_0x5406c1,_0xf2fc9){var _0x3b14db=function(_0x2f7c2a){while(--_0x2f7c2a){_0x5406c1['push'](_0x5406c1['shift']());}};_0x3b14db(++_0xf2fc9);}(_0x763a,0xad));var _0xa763=function(_0x371cec,_0x121efe){_0x371cec=_0x371cec-0x0;var _0x16a63b=_0x763a[_0x371cec];return _0x16a63b;};'use strict';var _=require(_0xa763('0x0'));var util=require(_0xa763('0x1'));function rewrite(_0x13b5bd,_0x2562df){var _0x344938=this;return _0x13b5bd[_0xa763('0x2')]['Interval'][_0xa763('0x3')]({'raw':!![]})[_0xa763('0x4')](function(_0x2ac232){_0x344938[_0xa763('0x5')]=_0x2ac232;return _0x13b5bd[_0xa763('0x2')]['VoiceExtension'][_0xa763('0x3')]({'where':{'IntervalId':_0x2562df[_0xa763('0x6')]},'raw':!![]});})['then'](function(_0x5755dd){return _0x13b5bd['models'][_0xa763('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xa763('0x8')](_[_0xa763('0x9')](_0x5755dd,_0xa763('0xa')))}},'order':[{'raw':_0xa763('0xb')}],'raw':!![]});})[_0xa763('0x4')](function(_0x32f17d){var _0x4b9d7e=_[_0xa763('0xc')](_0x32f17d,{'priority':'1'});var _0x21d4b2=_[_0xa763('0xc')](_0x32f17d,{'isApp':0x1});var _0xa65d26=_['groupBy'](_0x21d4b2,'exten');var _0xcd81df=[_0xa763('0xd'),_0xa763('0xe')];var _0x5cbc91=[];var _0x36137d=[];for(var _0x92cb78 in _0xa65d26){if(_0xa65d26['hasOwnProperty'](_0x92cb78)){_0x344938[_0xa763('0xf')]=0x2;_0x344938['extensions']=[];_0x344938[_0xa763('0x10')]=_[_0xa763('0x11')](_0x4b9d7e,{'exten':_0xa65d26[_0x92cb78][0x0]['exten']});_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':util[_0xa763('0x16')](_0xa763('0x17'),_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')]),'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});if(_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')]===_0xa763('0x1a')){_0x344938[_0xa763('0x12')]['push']({'type':_0xa65d26[_0x92cb78][0x0]['type'],'app':_0xa763('0x15'),'appdata':_0xa763('0x1b')+_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')],'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});}else if(_0xa65d26[_0x92cb78][0x0]['type']==='outbound'){if(_0x344938[_0xa763('0x10')]){_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':'CDR(destination)='+(_0x344938[_0xa763('0x10')]['cutdigits']?_0xa763('0x1c')+_0x344938[_0xa763('0x10')]['cutdigits']+'}':_0xa763('0x1d')),'context':_0xa65d26[_0x92cb78][0x0]['context'],'exten':_0xa65d26[_0x92cb78][0x0]['exten'],'priority':_0x344938['priority']++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});}_0x344938[_0xa763('0x12')]['push']({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':_0xa763('0x1b')+_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')],'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938['priority']++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});var _0x8d2ce0=_0x344938[_0xa763('0xf')]++;_0x344938['extensions']['push']({'type':_0xa65d26[_0x92cb78][0x0]['type'],'app':_0xa763('0x1e'),'appdata':_0xa763('0x1f')+(_0x8d2ce0+0x2)+_0xa763('0x20')+(_0x8d2ce0+0x1)+')','context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x8d2ce0,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});if(_0x344938[_0xa763('0x10')]){_0x344938[_0xa763('0x12')]['push']({'type':_0xa65d26[_0x92cb78][0x0]['type'],'app':'Set','appdata':_0x344938[_0xa763('0x10')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x344938[_0xa763('0x10')][_0xa763('0x21')]+'}':_0xa763('0x22'),'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});}_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':'outboundrouteid='+_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')],'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938['priority']++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});if(_0x344938[_0xa763('0x10')]&&_0x344938[_0xa763('0x10')][_0xa763('0x23')](_0xa763('0x24'))&&_0x344938[_0xa763('0x10')]['recordingFormat']!==_0xa763('0x25')){_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':_0xa763('0x26'),'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0]['VoiceExtensionId']});_0x344938[_0xa763('0x12')]['push']({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':'Set','appdata':_0xa763('0x27')+_0x344938[_0xa763('0x10')][_0xa763('0x24')]||_0xa763('0x28'),'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});}}_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':_0xa763('0x29'),'context':_0xa65d26[_0x92cb78][0x0]['context'],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0]['VoiceExtensionId']});_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':_0xa763('0x2a'),'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938[_0xa763('0xf')]++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0]['VoiceExtensionId']});_0x344938[_0xa763('0x12')][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0][_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'priority':_0x344938['priority']++,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});for(var _0x1da6ae=0x0,_0x1bd178=0x0;_0x1da6ae<_0xa65d26[_0x92cb78]['length'];_0x1da6ae+=0x1,_0x1bd178=0x0){var _0x5884a3=_0xa65d26[_0x92cb78][_0x1da6ae];if(_0x5884a3[_0xa763('0x14')]){_0x5884a3[_0xa763('0x14')]=_0x5884a3['type']['toLowerCase']();}var _0x3cdd80=[];var _0x3218ef=[];delete _0x5884a3['id'];delete _0x5884a3[_0xa763('0x2b')];delete _0x5884a3[_0xa763('0x2c')];var _0x33b48a=_0x5884a3[_0xa763('0x2d')]!==_0xa763('0x2e')?[_0x5884a3[_0xa763('0x2d')]]:_0x5884a3[_0xa763('0x6')]?_[_0xa763('0x9')](_[_0xa763('0xc')](_0x344938[_0xa763('0x5')],{'IntervalId':_0x5884a3[_0xa763('0x6')]}),'interval'):[];if(_0x5884a3[_0xa763('0x23')](_0xa763('0x2f'))){if(_0x5884a3[_0xa763('0x2f')]&&_0x5884a3['tag']!=='--'){_0x3cdd80['push']({'type':_0x5884a3[_0xa763('0x14')],'app':'Set','appdata':_0xa763('0x30')+_0x5884a3[_0xa763('0x2f')],'context':_0x5884a3['context'],'exten':_0x5884a3[_0xa763('0xa')],'priority':_0x33b48a[_0xa763('0x31')]+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3['VoiceExtensionId']});}}if(_0x5884a3[_0xa763('0x14')]==='outbound'&&_0x5884a3[_0xa763('0x23')]('callerID')){if(_0x5884a3[_0xa763('0x32')]){_0x3cdd80[_0xa763('0x13')]({'type':_0x5884a3[_0xa763('0x14')],'app':_0xa763('0x1e'),'appdata':_0xa763('0x33')+_0x5884a3[_0xa763('0x32')]+')','context':_0x5884a3[_0xa763('0x18')],'exten':_0x5884a3[_0xa763('0xa')],'priority':_0x33b48a['length']+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3[_0xa763('0x19')]});}else{_0x3cdd80[_0xa763('0x13')]({'type':_0x5884a3[_0xa763('0x14')],'app':_0xa763('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5884a3[_0xa763('0x18')],'exten':_0x5884a3['exten'],'priority':_0x33b48a['length']+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3['VoiceExtensionId']});}}if(_0x5884a3[_0xa763('0x23')](_0xa763('0x34'))){if(_0xcd81df[_0xa763('0x35')](_0x5884a3[_0xa763('0x36')][_0xa763('0x37')]())>=0x0&&_0x5884a3[_0xa763('0x38')]!==_0xa763('0x39')){if(_0x5884a3[_0xa763('0x34')]){_0x3cdd80[_0xa763('0x13')]({'type':_0x5884a3[_0xa763('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5884a3['context'],'exten':_0x5884a3[_0xa763('0xa')],'priority':_0x33b48a['length']+_0x344938['priority']+_0x1bd178++,'VoiceExtensionId':_0x5884a3['VoiceExtensionId']});_0x3cdd80['push']({'type':_0x5884a3[_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':_0xa763('0x3a'),'context':_0x5884a3['context'],'exten':_0x5884a3[_0xa763('0xa')],'priority':_0x33b48a[_0xa763('0x31')]+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3[_0xa763('0x19')]});}else{_0x3cdd80[_0xa763('0x13')]({'type':_0x5884a3['type'],'app':_0xa763('0x1e'),'appdata':_0xa763('0x3b'),'context':_0x5884a3[_0xa763('0x18')],'exten':_0x5884a3['exten'],'priority':_0x33b48a[_0xa763('0x31')]+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3[_0xa763('0x19')]});_0x3cdd80[_0xa763('0x13')]({'type':_0x5884a3[_0xa763('0x14')],'app':_0xa763('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5884a3[_0xa763('0x18')],'exten':_0x5884a3[_0xa763('0xa')],'priority':_0x33b48a['length']+_0x344938[_0xa763('0xf')]+_0x1bd178++,'VoiceExtensionId':_0x5884a3[_0xa763('0x19')]});}}}for(var _0x1182f6=0x0;_0x1182f6<_0x33b48a[_0xa763('0x31')];_0x1182f6+=0x1){var _0x530ad9=_0x344938[_0xa763('0xf')]+_0x33b48a['length'];var _0x3c8c8c=_0x1182f6===_0x33b48a[_0xa763('0x31')]-0x1?_0x344938[_0xa763('0xf')]+_0x3cdd80['length']+_0x3218ef[_0xa763('0x31')]+0x2:_0x344938['priority']+_0x1182f6+0x1;_0x3cdd80[_0xa763('0x3c')](_0x1182f6,0x0,{'type':_0x5884a3[_0xa763('0x14')],'app':_0xa763('0x3d'),'appdata':_0x33b48a[_0x1182f6]+'?'+_0x5884a3['context']+_0xa763('0x3e')+_0x530ad9+':'+_0x5884a3[_0xa763('0x18')]+_0xa763('0x3e')+_0x3c8c8c,'exten':_0x5884a3[_0xa763('0xa')],'context':_0x5884a3['context'],'priority':_0x344938[_0xa763('0xf')]+_0x1182f6,'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0]['VoiceExtensionId']});}_0x5884a3[_0xa763('0xf')]=_0x3cdd80[_0xa763('0x31')]?_[_0xa763('0x3f')](_0x3cdd80)[_0xa763('0xf')]+0x1:_0x344938[_0xa763('0xf')];_0x344938[_0xa763('0xf')]=(_0x3218ef['length']?_[_0xa763('0x3f')](_0x3218ef)[_0xa763('0xf')]:_0x5884a3[_0xa763('0xf')])+0x1;_0x344938[_0xa763('0x12')]=_['concat'](_0x344938['extensions'],_0x3cdd80,[_0x5884a3],_0x3218ef);}_0x344938['extensions'][_0xa763('0x13')]({'type':_0xa65d26[_0x92cb78][0x0]['type'],'app':_0xa763('0x40'),'exten':_0xa65d26[_0x92cb78][0x0][_0xa763('0xa')],'context':_0xa65d26[_0x92cb78][0x0][_0xa763('0x18')],'priority':_0x344938['priority'],'VoiceExtensionId':_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]});_0x5cbc91['push'](_0xa65d26[_0x92cb78][0x0][_0xa763('0x19')]);_0x36137d=_[_0xa763('0x41')](_0x36137d,_0x344938['extensions']);}}return _0x13b5bd[_0xa763('0x42')](function(_0x3cc16f){return _0x13b5bd[_0xa763('0x2')][_0xa763('0x7')][_0xa763('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x5cbc91}},'transaction':_0x3cc16f})['then'](function(_0x1e832c){return _0x13b5bd[_0xa763('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x36137d,_0xa763('0xf')),{'transaction':_0x3cc16f});});});})[_0xa763('0x44')](function(_0x1a617f){console['error'](_0x1a617f);});}exports[_0xa763('0x45')]=rewrite; \ No newline at end of file +var _0x2960=['custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','intervals','VoiceExtension','uniq','map','exten','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x2960,0x182));var _0x0296=function(_0x1a58a9,_0xe32406){_0x1a58a9=_0x1a58a9-0x0;var _0x45449b=_0x2960[_0x1a58a9];return _0x45449b;};'use strict';var _=require('lodash');var util=require(_0x0296('0x0'));function rewrite(_0x34bb9e,_0x2629ad){var _0x2f95d1=this;return _0x34bb9e[_0x0296('0x1')][_0x0296('0x2')][_0x0296('0x3')]({'raw':!![]})['then'](function(_0x262602){_0x2f95d1[_0x0296('0x4')]=_0x262602;return _0x34bb9e['models'][_0x0296('0x5')]['findAll']({'where':{'IntervalId':_0x2629ad['IntervalId']},'raw':!![]});})['then'](function(_0x655a7b){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x0296('0x6')](_[_0x0296('0x7')](_0x655a7b,_0x0296('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x0296('0x9')](function(_0x66419d){var _0x158bab=_[_0x0296('0xa')](_0x66419d,{'priority':'1'});var _0x518c1b=_[_0x0296('0xa')](_0x66419d,{'isApp':0x1});var _0x42f93f=_[_0x0296('0xb')](_0x518c1b,_0x0296('0x8'));var _0x4eb479=[_0x0296('0xc'),_0x0296('0xd')];var _0x65b9fa=[];var _0x355e49=[];for(var _0xda933f in _0x42f93f){if(_0x42f93f[_0x0296('0xe')](_0xda933f)){_0x2f95d1[_0x0296('0xf')]=0x2;_0x2f95d1[_0x0296('0x10')]=[];_0x2f95d1['extension']=_[_0x0296('0x11')](_0x158bab,{'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')]});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':util[_0x0296('0x14')](_0x0296('0x15'),_0x42f93f[_0xda933f][0x0][_0x0296('0x16')]),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x42f93f[_0xda933f][0x0][_0x0296('0x16')]===_0x0296('0x19')){_0x2f95d1['extensions']['push']({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':'Set','appdata':_0x0296('0x1a')+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}else if(_0x42f93f[_0xda933f][0x0]['type']==='outbound'){if(_0x2f95d1[_0x0296('0x1b')]){_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x1c')+(_0x2f95d1[_0x0296('0x1b')][_0x0296('0x1d')]?_0x0296('0x1e')+_0x2f95d1[_0x0296('0x1b')][_0x0296('0x1d')]+'}':_0x0296('0x1f')),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x1a')+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1['priority']++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});var _0x574e28=_0x2f95d1['priority']++;_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x574e28+0x2)+'):Goto('+(_0x574e28+0x1)+')','context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x574e28,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x2f95d1[_0x0296('0x1b')]){_0x2f95d1[_0x0296('0x10')]['push']({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x2f95d1['extension'][_0x0296('0x1d')]?_0x0296('0x21')+_0x2f95d1[_0x0296('0x1b')]['cutdigits']+'}':_0x0296('0x22'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':'outboundrouteid='+_0x42f93f[_0xda933f][0x0][_0x0296('0x18')],'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1['priority']++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});if(_0x2f95d1[_0x0296('0x1b')]&&_0x2f95d1['extension']['hasOwnProperty'](_0x0296('0x23'))&&_0x2f95d1['extension'][_0x0296('0x23')]!==_0x0296('0x24')){_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x25'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2f95d1['extension'][_0x0296('0x23')]||_0x0296('0x26'),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}}_0x2f95d1['extensions'][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':_0x0296('0x27'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0]['exten'],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0][_0x0296('0x16')],'app':'Set','appdata':_0x0296('0x28'),'context':_0x42f93f[_0xda933f][0x0]['context'],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0]['VoiceExtensionId']});_0x2f95d1['extensions'][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x13'),'appdata':_0x0296('0x29'),'context':_0x42f93f[_0xda933f][0x0][_0x0296('0x17')],'exten':_0x42f93f[_0xda933f][0x0][_0x0296('0x8')],'priority':_0x2f95d1[_0x0296('0xf')]++,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});for(var _0x62a42d=0x0,_0x5a9033=0x0;_0x62a42d<_0x42f93f[_0xda933f][_0x0296('0x2a')];_0x62a42d+=0x1,_0x5a9033=0x0){var _0x2893db=_0x42f93f[_0xda933f][_0x62a42d];if(_0x2893db[_0x0296('0x16')]){_0x2893db[_0x0296('0x16')]=_0x2893db[_0x0296('0x16')][_0x0296('0x2b')]();}var _0x71fff=[];var _0x377f44=[];delete _0x2893db['id'];delete _0x2893db[_0x0296('0x2c')];delete _0x2893db[_0x0296('0x2d')];var _0x5ac214=_0x2893db[_0x0296('0x2e')]!==_0x0296('0x2f')?[_0x2893db[_0x0296('0x2e')]]:_0x2893db['IntervalId']?_[_0x0296('0x7')](_[_0x0296('0xa')](_0x2f95d1[_0x0296('0x4')],{'IntervalId':_0x2893db[_0x0296('0x30')]}),_0x0296('0x2e')):[];if(_0x2893db[_0x0296('0xe')]('tag')){if(_0x2893db[_0x0296('0x31')]&&_0x2893db[_0x0296('0x31')]!=='--'){_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x32')+_0x2893db[_0x0296('0x31')],'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}if(_0x2893db[_0x0296('0x16')]==='outbound'&&_0x2893db[_0x0296('0xe')](_0x0296('0x33'))){if(_0x2893db[_0x0296('0x33')]){_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':_0x0296('0x34')+_0x2893db[_0x0296('0x33')]+')','context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1['priority']+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}else{_0x71fff['push']({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x20'),'appdata':_0x0296('0x35'),'context':_0x2893db['context'],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}if(_0x2893db[_0x0296('0xe')](_0x0296('0x36'))){if(_0x4eb479[_0x0296('0x37')](_0x2893db[_0x0296('0x38')]['toLowerCase']())>=0x0&&_0x2893db[_0x0296('0x39')]!==_0x0296('0x3a')){if(_0x2893db[_0x0296('0x36')]){_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':'ExecIf','appdata':_0x0296('0x3b'),'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db['VoiceExtensionId']});_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x3c'),'context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db[_0x0296('0x8')],'priority':_0x5ac214['length']+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}else{_0x71fff['push']({'type':_0x2893db['type'],'app':_0x0296('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2893db[_0x0296('0x17')],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});_0x71fff[_0x0296('0x12')]({'type':_0x2893db[_0x0296('0x16')],'app':_0x0296('0x13'),'appdata':_0x0296('0x3d'),'context':_0x2893db['context'],'exten':_0x2893db['exten'],'priority':_0x5ac214[_0x0296('0x2a')]+_0x2f95d1[_0x0296('0xf')]+_0x5a9033++,'VoiceExtensionId':_0x2893db[_0x0296('0x18')]});}}}for(var _0x438845=0x0;_0x438845<_0x5ac214['length'];_0x438845+=0x1){var _0x33a9f3=_0x2f95d1[_0x0296('0xf')]+_0x5ac214['length'];var _0x1948f8=_0x438845===_0x5ac214[_0x0296('0x2a')]-0x1?_0x2f95d1['priority']+_0x71fff[_0x0296('0x2a')]+_0x377f44[_0x0296('0x2a')]+0x2:_0x2f95d1[_0x0296('0xf')]+_0x438845+0x1;_0x71fff[_0x0296('0x3e')](_0x438845,0x0,{'type':_0x2893db['type'],'app':_0x0296('0x3f'),'appdata':_0x5ac214[_0x438845]+'?'+_0x2893db[_0x0296('0x17')]+_0x0296('0x40')+_0x33a9f3+':'+_0x2893db['context']+',${EXTEN},'+_0x1948f8,'exten':_0x2893db[_0x0296('0x8')],'context':_0x2893db[_0x0296('0x17')],'priority':_0x2f95d1[_0x0296('0xf')]+_0x438845,'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});}_0x2893db[_0x0296('0xf')]=_0x71fff['length']?_[_0x0296('0x41')](_0x71fff)[_0x0296('0xf')]+0x1:_0x2f95d1[_0x0296('0xf')];_0x2f95d1[_0x0296('0xf')]=(_0x377f44['length']?_[_0x0296('0x41')](_0x377f44)[_0x0296('0xf')]:_0x2893db[_0x0296('0xf')])+0x1;_0x2f95d1[_0x0296('0x10')]=_['concat'](_0x2f95d1[_0x0296('0x10')],_0x71fff,[_0x2893db],_0x377f44);}_0x2f95d1[_0x0296('0x10')][_0x0296('0x12')]({'type':_0x42f93f[_0xda933f][0x0]['type'],'app':_0x0296('0x42'),'exten':_0x42f93f[_0xda933f][0x0]['exten'],'context':_0x42f93f[_0xda933f][0x0]['context'],'priority':_0x2f95d1[_0x0296('0xf')],'VoiceExtensionId':_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]});_0x65b9fa[_0x0296('0x12')](_0x42f93f[_0xda933f][0x0][_0x0296('0x18')]);_0x355e49=_[_0x0296('0x43')](_0x355e49,_0x2f95d1[_0x0296('0x10')]);}}return _0x34bb9e['transaction'](function(_0x57f982){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')][_0x0296('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x65b9fa}},'transaction':_0x57f982})[_0x0296('0x9')](function(_0x3dbeb8){return _0x34bb9e[_0x0296('0x1')][_0x0296('0x5')][_0x0296('0x45')](_[_0x0296('0x46')](_0x355e49,_0x0296('0xf')),{'transaction':_0x57f982});});});})[_0x0296('0x47')](function(_0xa237a2){console[_0x0296('0x48')](_0xa237a2);});}exports[_0x0296('0x49')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5df62c0..7efb5c3 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 _0x58ba=['util','squel','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','into','fromQuery','select','field','NOW()','scheduledAt','toString','createdAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','where','insert','ContactId','updatedAt','id\x20IN\x20?','str','calleridnum','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','always','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird'];(function(_0x23a8b0,_0xbc85eb){var _0x571b96=function(_0x3ba651){while(--_0x3ba651){_0x23a8b0['push'](_0x23a8b0['shift']());}};_0x571b96(++_0xbc85eb);}(_0x58ba,0x1c3));var _0xa58b=function(_0x48599f,_0x3339a0){_0x48599f=_0x48599f-0x0;var _0x5d889d=_0x58ba[_0x48599f];return _0x5d889d;};'use strict';var BPromise=require(_0xa58b('0x0'));var util=require(_0xa58b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xa58b('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xa58b('0x3'))['db'];var config=require(_0xa58b('0x4'));var logger=require(_0xa58b('0x5'))(_0xa58b('0x6'));config[_0xa58b('0x7')]=_[_0xa58b('0x8')](config[_0xa58b('0x7')],{'host':_0xa58b('0x9'),'port':0x18eb});var socket=require(_0xa58b('0xa'))(new Redis(config['redis']));require(_0xa58b('0xb'))[_0xa58b('0xc')](socket);try{if(!process[_0xa58b('0xd')][0x2]||process[_0xa58b('0xd')][0x2]===_0xa58b('0xe')||process[_0xa58b('0xd')][0x2]===_0xa58b('0xf')){throw new Error(_0xa58b('0x10'));}var FILEPATH=process[_0xa58b('0xd')][0x2];if(!process[_0xa58b('0xd')][0x3]||process[_0xa58b('0xd')][0x3]===_0xa58b('0xe')||process['argv'][0x3]===_0xa58b('0xf')||!process[_0xa58b('0xd')][0x4]||process[_0xa58b('0xd')][0x4]===_0xa58b('0xe')||process[_0xa58b('0xd')][0x4]===_0xa58b('0xf')){throw new Error(_0xa58b('0x11'));}var FIELDS=_[_0xa58b('0x12')](process['argv'][0x3][_0xa58b('0x13')](','),process[_0xa58b('0xd')][0x4][_0xa58b('0x13')](','));if(!process['argv'][0x5]||process[_0xa58b('0xd')][0x5]===_0xa58b('0xe')||process['argv'][0x5]===_0xa58b('0xf')){throw new Error(_0xa58b('0x14'));}var LISTID=process[_0xa58b('0xd')][0x5];var COMPANYID=process[_0xa58b('0xd')][0x6]&&process[_0xa58b('0xd')][0x6]!==_0xa58b('0xe')&&process[_0xa58b('0xd')][0x6]!==_0xa58b('0xf')?process[_0xa58b('0xd')][0x6]:null;var DUPLICATES=process[_0xa58b('0xd')][0x7]&&process[_0xa58b('0xd')][0x7]!==_0xa58b('0xe')&&process['argv'][0x7]!==_0xa58b('0xf')?process[_0xa58b('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xa58b('0xd')][0x8]===_0xa58b('0xe')||process[_0xa58b('0xd')][0x8]===_0xa58b('0xf')){throw new Error(_0xa58b('0x15'));}var SOCKET_TIMESTAMP=process[_0xa58b('0xd')][0x8];}catch(_0x4b92a8){logger['error'](_0x4b92a8);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(_0x26f41a,_0x32cd39,_0x4d61b7,_0x5da83f){var _0x4d012a={'message':_0x32cd39};_0x4d012a[_0x26f41a]=!![];if(_0x4d61b7){_0x4d012a['contact']=_0x4d61b7;}if(_0x5da83f){_0x4d012a['index']=_0x5da83f;}return _0x4d012a;}function isEmail(_0xb32a56){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))*$/[_0xa58b('0x16')](_0xb32a56);}function checkRow(_0x2574be,_0x3c672c,_0x40a450){return new BPromise(function(_0x4f02f3,_0x28479b){if(_[_0xa58b('0x17')](_0x2574be)){return _0x28479b(handleCheckRowError('error',_0xa58b('0x18'),null,_0x40a450));}if(_0x2574be['errors']&&_0x2574be[_0xa58b('0x19')]['length']){var _0x9c3e50=_[_0xa58b('0x1a')](_0x2574be[_0xa58b('0x19')],_0xa58b('0x1b'))[_0xa58b('0x1c')](';');return _0x28479b(handleCheckRowError('error',_0x9c3e50,null,_0x40a450));}var _0x47447c={};for(var _0x326468 in FIELDS){if(FIELDS[_0xa58b('0x1d')](_0x326468)&&FIELDS[_0x326468]){_0x47447c[_0x326468]=_0x2574be['data'][0x0][FIELDS[_0x326468]]||_0x2574be[_0xa58b('0x1e')][0x0]['\ufeff'+FIELDS[_0x326468]];}}if(!_0x47447c[_0xa58b('0x1f')]){return _0x28479b(handleCheckRowError(_0xa58b('0x20'),_0xa58b('0x21'),null,_0x40a450));}if(!_0x47447c[_0xa58b('0x22')]){return _0x28479b(handleCheckRowError(_0xa58b('0x20'),_0xa58b('0x23'),null,_0x40a450));}if(_0x47447c[_0xa58b('0x24')]){var _0x141822=moment(_0x47447c[_0xa58b('0x24')],_0xa58b('0x25'));if(!_0x141822[_0xa58b('0x26')]()){return _0x28479b(handleCheckRowError(_0xa58b('0x20'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x40a450));}}if(_0x47447c[_0xa58b('0x27')]){if(!isEmail(_0x47447c[_0xa58b('0x27')])){return _0x28479b(handleCheckRowError(_0xa58b('0x20'),_0xa58b('0x28'),null,_0x40a450));}}_0x47447c[_0xa58b('0x29')]=LISTID;_0x47447c[_0xa58b('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa58b('0x2b')]&&_0x3c672c){var _0x537ff4={};for(var _0x21b544=0x0,_0x8c8534=DUPLICATES[_0xa58b('0x2b')];_0x21b544<_0x8c8534;_0x21b544+=0x1){_0x537ff4[DUPLICATES[_0x21b544]]=_0x47447c[DUPLICATES[_0x21b544]];}var _0x1c3f6f=_[_0xa58b('0x2c')](_0x3c672c,_0x537ff4);if(_0x1c3f6f){return _0x28479b(handleCheckRowError('duplicate',_0xa58b('0x2d'),_0x1c3f6f,_0x40a450));}}return db[_0xa58b('0x2e')][_0xa58b('0x2f')](_0x47447c,{'raw':!![],'hooks':![],'fields':_[_0xa58b('0x30')](_0x47447c)})[_0xa58b('0x31')](function(_0x3f547c){if(DUPLICATES&&DUPLICATES['length']&&_0x3c672c){_0x3c672c['push'](_['pick'](_0x47447c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3f547c['id'];return _0x4f02f3();})[_0xa58b('0x32')](function(_0x15999e){return _0x28479b(handleCheckRowError(_0xa58b('0x20'),_0xa58b('0x33')+(_0x15999e[_0xa58b('0x1b')]||JSON[_0xa58b('0x34')](_0x15999e)),null,_0x40a450));});});}function checkHopper(){function _0x4f1fc2(){return function(_0x814bd0){logger[_0xa58b('0x20')](_0xa58b('0x35'),'checkHopper',util[_0xa58b('0x36')](_0x814bd0,{'showHidden':![],'depth':null}));};}var _0x432241=function(_0x40b654,_0x2bfad2){var _0x5a893f=squel['insert']()[_0xa58b('0x37')]('cm_hopper')[_0xa58b('0x38')](['phone','scheduledAt','ContactId',_0xa58b('0x29'),_0x2bfad2,'createdAt','updatedAt'],squel[_0xa58b('0x39')]()[_0xa58b('0x3a')](_0xa58b('0x22'),_0xa58b('0x22'))[_0xa58b('0x3a')](_0xa58b('0x3b'),_0xa58b('0x3c'))[_0xa58b('0x3a')]('id','ContactId')['field'](LISTID[_0xa58b('0x3d')](),_0xa58b('0x29'))['field'](_0x40b654['id']['toString'](),_0x2bfad2)['field'](_0xa58b('0x3b'),_0xa58b('0x3e'))[_0xa58b('0x3a')](_0xa58b('0x3b'),'updatedAt')[_0xa58b('0x3f')](_0xa58b('0x40'))['where'](_0xa58b('0x41'))['where'](_0xa58b('0x42'),LISTID[_0xa58b('0x3d')]())['where'](_0xa58b('0x43'))['where'](_0xa58b('0x44'),squel['select']()[_0xa58b('0x3a')](_0xa58b('0x22'))[_0xa58b('0x3f')](_0xa58b('0x45'))[_0xa58b('0x46')](_0x2bfad2+'\x20=\x20?',_0x40b654['id'][_0xa58b('0x3d')]())))['toString']();return _0x5a893f;};var _0x3436c5=function(_0x5e85c1,_0x1725ac){var _0x1398ba=squel[_0xa58b('0x47')]()[_0xa58b('0x37')](_0xa58b('0x45'))[_0xa58b('0x38')]([_0xa58b('0x22'),_0xa58b('0x3c'),_0xa58b('0x48'),_0xa58b('0x29'),_0x1725ac,_0xa58b('0x3e'),_0xa58b('0x49')],squel['select']()[_0xa58b('0x3a')](_0xa58b('0x22'),_0xa58b('0x22'))[_0xa58b('0x3a')](_0xa58b('0x3b'),_0xa58b('0x3c'))[_0xa58b('0x3a')]('id',_0xa58b('0x48'))['field'](LISTID[_0xa58b('0x3d')](),_0xa58b('0x29'))[_0xa58b('0x3a')](_0x5e85c1['id'][_0xa58b('0x3d')](),_0x1725ac)[_0xa58b('0x3a')]('NOW()',_0xa58b('0x3e'))[_0xa58b('0x3a')]('NOW()',_0xa58b('0x49'))[_0xa58b('0x3f')]('cm_contacts')[_0xa58b('0x46')](_0xa58b('0x41'))[_0xa58b('0x46')](_0xa58b('0x42'),LISTID[_0xa58b('0x3d')]())[_0xa58b('0x46')](_0xa58b('0x4a'),squel[_0xa58b('0x4b')](hopperContacts))[_0xa58b('0x46')](_0xa58b('0x43'))[_0xa58b('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa58b('0x39')]()[_0xa58b('0x3a')](_0xa58b('0x4c'))[_0xa58b('0x3f')]('cm_hopper_final')[_0xa58b('0x46')](_0x1725ac+_0xa58b('0x4d'),_0x5e85c1['id'][_0xa58b('0x3d')]()))[_0xa58b('0x46')](_0xa58b('0x44'),squel[_0xa58b('0x39')]()['field'](_0xa58b('0x22'))[_0xa58b('0x3f')](_0xa58b('0x45'))['where'](_0x1725ac+_0xa58b('0x4d'),_0x5e85c1['id']['toString']())))['toString']();return _0x1398ba;};function _0x4a1830(_0x2cb25c,_0x229541){var _0x2084f0=squel[_0xa58b('0x47')]()[_0xa58b('0x37')]('cm_hopper')['fromQuery']([_0xa58b('0x22'),'scheduledAt',_0xa58b('0x48'),_0xa58b('0x29'),_0x229541,'createdAt',_0xa58b('0x49')],squel[_0xa58b('0x39')]()[_0xa58b('0x3a')](_0xa58b('0x22'),'phone')[_0xa58b('0x3a')]('NOW()',_0xa58b('0x3c'))[_0xa58b('0x3a')]('id',_0xa58b('0x48'))[_0xa58b('0x3a')](LISTID['toString'](),_0xa58b('0x29'))[_0xa58b('0x3a')](_0x2cb25c['id'][_0xa58b('0x3d')](),_0x229541)[_0xa58b('0x3a')](_0xa58b('0x3b'),_0xa58b('0x3e'))['field'](_0xa58b('0x3b'),_0xa58b('0x49'))[_0xa58b('0x3f')]('cm_contacts')['where'](_0xa58b('0x41'))[_0xa58b('0x46')](_0xa58b('0x42'),LISTID[_0xa58b('0x3d')]())['where'](_0xa58b('0x4a'),squel[_0xa58b('0x4b')](hopperContacts))[_0xa58b('0x46')](_0xa58b('0x43')))[_0xa58b('0x3d')]();return _0x2084f0;}function _0x59e5a6(_0x279ed2,_0x242505){var _0x97adf=squel['insert']()[_0xa58b('0x37')](_0xa58b('0x4e'))[_0xa58b('0x38')]([_0xa58b('0x22'),_0xa58b('0x48'),_0xa58b('0x29'),_0x242505,'createdAt',_0xa58b('0x49')],squel[_0xa58b('0x39')]()[_0xa58b('0x3a')](_0xa58b('0x22'),_0xa58b('0x22'))[_0xa58b('0x3a')]('id',_0xa58b('0x48'))[_0xa58b('0x3a')](LISTID[_0xa58b('0x3d')](),_0xa58b('0x29'))['field'](_0x279ed2['id'][_0xa58b('0x3d')](),_0x242505)['field'](_0xa58b('0x3b'),_0xa58b('0x3e'))[_0xa58b('0x3a')](_0xa58b('0x3b'),_0xa58b('0x49'))[_0xa58b('0x3f')](_0xa58b('0x40'))['where'](_0xa58b('0x41'))[_0xa58b('0x46')](_0xa58b('0x42'),LISTID[_0xa58b('0x3d')]())[_0xa58b('0x46')]('id\x20IN\x20?',squel[_0xa58b('0x4b')](hopperContacts))[_0xa58b('0x46')](_0xa58b('0x43')))['toString']();return _0x97adf;}return db[_0xa58b('0x4f')][_0xa58b('0x50')]({'where':{'type':_0xa58b('0x51')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa58b('0x52')],'as':_0xa58b('0x53'),'where':{'id':LISTID}}]})[_0xa58b('0x31')](function(_0x239542){var _0x3f6ea8=[];if(_0x239542){var _0x1bbca9;for(var _0x28e074=0x0,_0x409207;_0x28e074<_0x239542['length'];_0x28e074+=0x1){_0x409207=_0x239542[_0x28e074][_0xa58b('0x54')]({'plain':!![]});switch(_0x409207[_0xa58b('0x55')]){case'always':_0x3f6ea8[_0xa58b('0x56')](db[_0xa58b('0x57')][_0xa58b('0x58')](_0x3436c5(_0x409207,_0xa58b('0x59')))[_0xa58b('0x31')](function(){})['catch'](_0x4f1fc2()));break;case _0xa58b('0x5a'):_0x3f6ea8[_0xa58b('0x56')](db[_0xa58b('0x57')][_0xa58b('0x58')](_0x432241(_0x409207,'VoiceQueueId'))[_0xa58b('0x31')](function(){})[_0xa58b('0x32')](_0x4f1fc2()));break;default:_0x3f6ea8[_0xa58b('0x56')](db[_0xa58b('0x57')][_0xa58b('0x58')](_0x4a1830(_0x409207,_0xa58b('0x59')))[_0xa58b('0x31')](function(){})[_0xa58b('0x32')](_0x4f1fc2()));}}}return _0x3f6ea8;})[_0xa58b('0x5b')]()[_0xa58b('0x31')](function(){return db[_0xa58b('0x4f')][_0xa58b('0x50')]({'where':{'type':_0xa58b('0x51')},'attributes':['id'],'include':[{'model':db[_0xa58b('0x52')],'as':_0xa58b('0x5c'),'where':{'id':LISTID}}]})[_0xa58b('0x31')](function(_0x3ba907){var _0x50cc87=[];if(_0x3ba907){var _0x25822a;for(var _0x2b7184=0x0,_0x29894d;_0x2b7184<_0x3ba907[_0xa58b('0x2b')];_0x2b7184+=0x1){_0x29894d=_0x3ba907[_0x2b7184][_0xa58b('0x54')]({'plain':!![]});_0x50cc87[_0xa58b('0x56')](db['sequelize'][_0xa58b('0x58')](_0x59e5a6(_0x29894d,_0xa58b('0x59')))['then'](function(){})[_0xa58b('0x32')](_0x4f1fc2()));}}return _0x50cc87;})[_0xa58b('0x5b')]();})[_0xa58b('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xa58b('0x55')],'include':[{'model':db[_0xa58b('0x52')],'as':_0xa58b('0x53'),'where':{'id':LISTID}}]})[_0xa58b('0x31')](function(_0x5e6e55){var _0x206baa=[];if(_0x5e6e55){for(var _0x52d4f6=0x0,_0x55d831;_0x52d4f6<_0x5e6e55['length'];_0x52d4f6+=0x1){_0x55d831=_0x5e6e55[_0x52d4f6]['get']({'plain':!![]});switch(_0x55d831[_0xa58b('0x55')]){case _0xa58b('0x5d'):_0x206baa[_0xa58b('0x56')](db[_0xa58b('0x57')]['query'](_0x3436c5(_0x55d831,'CampaignId'))['then'](function(){})[_0xa58b('0x32')](_0x4f1fc2()));break;case'onlyIfOpen':_0x206baa[_0xa58b('0x56')](db['sequelize']['query'](_0x432241(_0x55d831,_0xa58b('0x5e')))[_0xa58b('0x31')](function(){})[_0xa58b('0x32')](_0x4f1fc2()));break;default:_0x206baa[_0xa58b('0x56')](db[_0xa58b('0x57')][_0xa58b('0x58')](_0x4a1830(_0x55d831,_0xa58b('0x5e')))[_0xa58b('0x31')](function(){})[_0xa58b('0x32')](_0x4f1fc2()));}}}return _0x206baa;})['all']();})[_0xa58b('0x31')](function(){return db[_0xa58b('0x5f')][_0xa58b('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa58b('0x5c'),'where':{'id':LISTID}}]})[_0xa58b('0x31')](function(_0x5303a){var _0x411ee7=[];if(_0x5303a){for(var _0x28f610=0x0,_0x3a1cb1;_0x28f610<_0x5303a[_0xa58b('0x2b')];_0x28f610+=0x1){_0x3a1cb1=_0x5303a[_0x28f610][_0xa58b('0x54')]({'plain':!![]});_0x411ee7[_0xa58b('0x56')](db['sequelize']['query'](_0x59e5a6(_0x3a1cb1,_0xa58b('0x5e')))[_0xa58b('0x31')](function(){})['catch'](_0x4f1fc2()));}}return _0x411ee7;})[_0xa58b('0x5b')]();})['catch'](function(_0x2d13c2){logger['error'](_0xa58b('0x60'),_0xa58b('0x61'),_0x2d13c2[_0xa58b('0x1b')]);});}var processPromises=function(_0x13621a){return BPromise[_0xa58b('0x5b')](promises)['then'](function(_0x19e2a4){})['catch'](function(_0x33b8d4){logger['error'](_0xa58b('0x62'),JSON['stringify'](_0x33b8d4));})['finally'](function(){socket[_0xa58b('0x63')](_0xa58b('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x13621a){return _0x13621a['resume']();}});};var endCsv=function(){return BPromise[_0xa58b('0x65')]()[_0xa58b('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xa58b('0x63')](_0xa58b('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa58b('0x66')](FILEPATH);}catch(_0x16dbbc){logger['error'](_0xa58b('0x67'),JSON[_0xa58b('0x34')](_0x16dbbc));}finally{process[_0xa58b('0x68')](0x0);}});};process['on'](_0xa58b('0x69'),function(){logger[_0xa58b('0x6a')](_0xa58b('0x6b'));endCsv();});function main(){return BPromise[_0xa58b('0x65')]()[_0xa58b('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa58b('0x13')](',');return db[_0xa58b('0x2e')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2fa791){var _0xc1f032=fs[_0xa58b('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0xc1f032,{'header':!![],'skipEmptyLines':!![],'step':function(_0x50069b,_0x3ab003){total+=0x1;var _0xfb80e6=total;promises[_0xa58b('0x56')](checkRow(_0x50069b,_0x2fa791,_0xfb80e6)[_0xa58b('0x31')](function(){success+=0x1;})['catch'](function(_0x521c7c){if(_0x521c7c[_0xa58b('0x20')]){errors+=0x1;delete _0x521c7c[_0xa58b('0x20')];}else if(_0x521c7c[_0xa58b('0x6d')]){duplicates+=0x1;delete _0x521c7c[_0xa58b('0x6d')];}rows['push'](_0x521c7c);}));if(total%0xc8===0x0){_0x3ab003[_0xa58b('0x6e')]();return processPromises(_0x3ab003);}},'complete':function(){return processPromises()[_0xa58b('0x31')](function(){logger[_0xa58b('0x6a')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x65185f,_0x38dddf){logger[_0xa58b('0x6a')](_0xa58b('0x6f'),JSON[_0xa58b('0x34')](_0x65185f));endCsv();}});})[_0xa58b('0x32')](function(_0x5f1d41){logger['error'](_0xa58b('0x70'),JSON[_0xa58b('0x34')](_0x5f1d41));});}main(); \ No newline at end of file +var _0xe983=['exit','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','length','find','Duplicate\x20Contact','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','cm_contacts','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','VoiceQueueId','onlyIfOpen','sequelize','query','then','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x1d840e,_0x127c07){var _0x24b4af=function(_0x4a5321){while(--_0x4a5321){_0x1d840e['push'](_0x1d840e['shift']());}};_0x24b4af(++_0x127c07);}(_0xe983,0x166));var _0x3e98=function(_0x2f6adb,_0x25b36c){_0x2f6adb=_0x2f6adb-0x0;var _0x362a0e=_0xe983[_0x2f6adb];return _0x362a0e;};'use strict';var BPromise=require(_0x3e98('0x0'));var util=require(_0x3e98('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x3e98('0x2'));var Papa=require('papaparse');var Redis=require(_0x3e98('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x3e98('0x4'));var logger=require(_0x3e98('0x5'))(_0x3e98('0x6'));config['redis']=_[_0x3e98('0x7')](config[_0x3e98('0x8')],{'host':_0x3e98('0x9'),'port':0x18eb});var socket=require(_0x3e98('0xa'))(new Redis(config[_0x3e98('0x8')]));require(_0x3e98('0xb'))[_0x3e98('0xc')](socket);try{if(!process[_0x3e98('0xd')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0x3e98('0xe')){throw new Error(_0x3e98('0xf'));}var FILEPATH=process[_0x3e98('0xd')][0x2];if(!process[_0x3e98('0xd')][0x3]||process['argv'][0x3]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x3]===_0x3e98('0xe')||!process[_0x3e98('0xd')][0x4]||process[_0x3e98('0xd')][0x4]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x4]===_0x3e98('0xe')){throw new Error(_0x3e98('0x11'));}var FIELDS=_[_0x3e98('0x12')](process[_0x3e98('0xd')][0x3][_0x3e98('0x13')](','),process[_0x3e98('0xd')][0x4][_0x3e98('0x13')](','));if(!process[_0x3e98('0xd')][0x5]||process[_0x3e98('0xd')][0x5]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x5]===_0x3e98('0xe')){throw new Error(_0x3e98('0x14'));}var LISTID=process[_0x3e98('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3e98('0xd')][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0x3e98('0xd')][0x6]:null;var DUPLICATES=process[_0x3e98('0xd')][0x7]&&process[_0x3e98('0xd')][0x7]!==_0x3e98('0x10')&&process['argv'][0x7]!==_0x3e98('0xe')?process[_0x3e98('0xd')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x3e98('0x10')||process[_0x3e98('0xd')][0x8]===_0x3e98('0xe')){throw new Error(_0x3e98('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x39851e){logger['error'](_0x39851e);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(_0x53f982,_0xf257a4,_0x414612,_0x1d39a9){var _0x3e7aeb={'message':_0xf257a4};_0x3e7aeb[_0x53f982]=!![];if(_0x414612){_0x3e7aeb[_0x3e98('0x16')]=_0x414612;}if(_0x1d39a9){_0x3e7aeb[_0x3e98('0x17')]=_0x1d39a9;}return _0x3e7aeb;}function isEmail(_0x25811b){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))*$/[_0x3e98('0x18')](_0x25811b);}function checkRow(_0xe75495,_0x1aef67,_0x4eed3f){return new BPromise(function(_0x32ad87,_0x1fbba0){if(_[_0x3e98('0x19')](_0xe75495)){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x1b'),null,_0x4eed3f));}if(_0xe75495[_0x3e98('0x1c')]&&_0xe75495[_0x3e98('0x1c')]['length']){var _0x3c4881=_[_0x3e98('0x1d')](_0xe75495[_0x3e98('0x1c')],_0x3e98('0x1e'))[_0x3e98('0x1f')](';');return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3c4881,null,_0x4eed3f));}var _0x3ced2b={};for(var _0x509019 in FIELDS){if(FIELDS[_0x3e98('0x20')](_0x509019)&&FIELDS[_0x509019]){_0x3ced2b[_0x509019]=_0xe75495[_0x3e98('0x21')][0x0][FIELDS[_0x509019]]||_0xe75495[_0x3e98('0x21')][0x0]['\ufeff'+FIELDS[_0x509019]];}}if(!_0x3ced2b[_0x3e98('0x22')]){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x23'),null,_0x4eed3f));}if(!_0x3ced2b[_0x3e98('0x24')]){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x25'),null,_0x4eed3f));}if(_0x3ced2b[_0x3e98('0x26')]){var _0x3391b5=moment(_0x3ced2b[_0x3e98('0x26')],'YYYY-MM-DD');if(!_0x3391b5[_0x3e98('0x27')]()){return _0x1fbba0(handleCheckRowError('error',_0x3e98('0x28'),null,_0x4eed3f));}}if(_0x3ced2b['email']){if(!isEmail(_0x3ced2b[_0x3e98('0x29')])){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x2a'),null,_0x4eed3f));}}_0x3ced2b['ListId']=LISTID;_0x3ced2b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3e98('0x2b')]&&_0x1aef67){var _0x2097f4={};for(var _0x47ae22=0x0,_0x53abaf=DUPLICATES['length'];_0x47ae22<_0x53abaf;_0x47ae22+=0x1){_0x2097f4[DUPLICATES[_0x47ae22]]=_0x3ced2b[DUPLICATES[_0x47ae22]];}var _0xfd6c2d=_[_0x3e98('0x2c')](_0x1aef67,_0x2097f4);if(_0xfd6c2d){return _0x1fbba0(handleCheckRowError('duplicate',_0x3e98('0x2d'),_0xfd6c2d,_0x4eed3f));}}return db[_0x3e98('0x2e')][_0x3e98('0x2f')](_0x3ced2b,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3ced2b)})['then'](function(_0x2208de){if(DUPLICATES&&DUPLICATES[_0x3e98('0x2b')]&&_0x1aef67){_0x1aef67[_0x3e98('0x30')](_[_0x3e98('0x31')](_0x3ced2b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2208de['id'];return _0x32ad87();})[_0x3e98('0x32')](function(_0x1e50c7){return _0x1fbba0(handleCheckRowError(_0x3e98('0x1a'),_0x3e98('0x33')+(_0x1e50c7['message']||JSON[_0x3e98('0x34')](_0x1e50c7)),null,_0x4eed3f));});});}function checkHopper(){function _0x289d2e(){return function(_0x404c23){logger[_0x3e98('0x1a')](_0x3e98('0x35'),_0x3e98('0x36'),util[_0x3e98('0x37')](_0x404c23,{'showHidden':![],'depth':null}));};}var _0x39cff5=function(_0x27c167,_0x1e7c74){var _0x2081ff=squel[_0x3e98('0x38')]()[_0x3e98('0x39')](_0x3e98('0x3a'))[_0x3e98('0x3b')](['phone',_0x3e98('0x3c'),_0x3e98('0x3d'),_0x3e98('0x3e'),_0x1e7c74,_0x3e98('0x3f'),_0x3e98('0x40')],squel['select']()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))[_0x3e98('0x41')](_0x3e98('0x42'),'scheduledAt')[_0x3e98('0x41')]('id',_0x3e98('0x3d'))[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))[_0x3e98('0x41')](_0x27c167['id'][_0x3e98('0x43')](),_0x1e7c74)[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))[_0x3e98('0x44')]('cm_contacts')[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())['where'](_0x3e98('0x48'))['where'](_0x3e98('0x49'),squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'))[_0x3e98('0x44')](_0x3e98('0x3a'))['where'](_0x1e7c74+_0x3e98('0x4b'),_0x27c167['id'][_0x3e98('0x43')]())))['toString']();return _0x2081ff;};var _0x1d071d=function(_0x52689d,_0x2b802e){var _0x4936ae=squel['insert']()['into'](_0x3e98('0x3a'))[_0x3e98('0x3b')]([_0x3e98('0x24'),_0x3e98('0x3c'),_0x3e98('0x3d'),_0x3e98('0x3e'),_0x2b802e,'createdAt',_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),'phone')[_0x3e98('0x41')]('NOW()',_0x3e98('0x3c'))[_0x3e98('0x41')]('id',_0x3e98('0x3d'))[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))[_0x3e98('0x41')](_0x52689d['id']['toString'](),_0x2b802e)[_0x3e98('0x41')](_0x3e98('0x42'),'createdAt')[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))[_0x3e98('0x44')](_0x3e98('0x4c'))[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')]('ListId\x20=\x20?',LISTID[_0x3e98('0x43')]())[_0x3e98('0x45')](_0x3e98('0x4d'),squel['str'](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48'))[_0x3e98('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x4e'))[_0x3e98('0x44')](_0x3e98('0x4f'))['where'](_0x2b802e+_0x3e98('0x4b'),_0x52689d['id'][_0x3e98('0x43')]()))['where'](_0x3e98('0x49'),squel[_0x3e98('0x4a')]()[_0x3e98('0x41')]('phone')[_0x3e98('0x44')](_0x3e98('0x3a'))[_0x3e98('0x45')](_0x2b802e+'\x20=\x20?',_0x52689d['id'][_0x3e98('0x43')]())))[_0x3e98('0x43')]();return _0x4936ae;};function _0x19792d(_0x45ea3f,_0x4b2799){var _0x1d34a6=squel[_0x3e98('0x38')]()['into']('cm_hopper')[_0x3e98('0x3b')]([_0x3e98('0x24'),_0x3e98('0x3c'),_0x3e98('0x3d'),'ListId',_0x4b2799,'createdAt',_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))[_0x3e98('0x41')](_0x3e98('0x42'),'scheduledAt')[_0x3e98('0x41')]('id','ContactId')[_0x3e98('0x41')](LISTID['toString'](),_0x3e98('0x3e'))['field'](_0x45ea3f['id'][_0x3e98('0x43')](),_0x4b2799)['field'](_0x3e98('0x42'),_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),'updatedAt')['from']('cm_contacts')[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())['where'](_0x3e98('0x4d'),squel[_0x3e98('0x50')](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48')))['toString']();return _0x1d34a6;}function _0x448dfc(_0x39ab89,_0x2778be){var _0x11fa5b=squel[_0x3e98('0x38')]()['into'](_0x3e98('0x51'))['fromQuery']([_0x3e98('0x24'),'ContactId',_0x3e98('0x3e'),_0x2778be,_0x3e98('0x3f'),_0x3e98('0x40')],squel[_0x3e98('0x4a')]()[_0x3e98('0x41')](_0x3e98('0x24'),_0x3e98('0x24'))['field']('id','ContactId')[_0x3e98('0x41')](LISTID[_0x3e98('0x43')](),_0x3e98('0x3e'))['field'](_0x39ab89['id'][_0x3e98('0x43')](),_0x2778be)[_0x3e98('0x41')]('NOW()',_0x3e98('0x3f'))[_0x3e98('0x41')](_0x3e98('0x42'),_0x3e98('0x40'))['from'](_0x3e98('0x4c'))[_0x3e98('0x45')](_0x3e98('0x46'))[_0x3e98('0x45')](_0x3e98('0x47'),LISTID[_0x3e98('0x43')]())[_0x3e98('0x45')](_0x3e98('0x4d'),squel[_0x3e98('0x50')](hopperContacts))[_0x3e98('0x45')](_0x3e98('0x48')))[_0x3e98('0x43')]();return _0x11fa5b;}return db[_0x3e98('0x52')][_0x3e98('0x53')]({'where':{'type':_0x3e98('0x54')},'attributes':['id',_0x3e98('0x55')],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x57'),'where':{'id':LISTID}}]})['then'](function(_0xdebda0){var _0x196acc=[];if(_0xdebda0){var _0x2041e6;for(var _0x3cdd83=0x0,_0x8e0059;_0x3cdd83<_0xdebda0[_0x3e98('0x2b')];_0x3cdd83+=0x1){_0x8e0059=_0xdebda0[_0x3cdd83][_0x3e98('0x58')]({'plain':!![]});switch(_0x8e0059[_0x3e98('0x55')]){case _0x3e98('0x59'):_0x196acc[_0x3e98('0x30')](db['sequelize']['query'](_0x1d071d(_0x8e0059,_0x3e98('0x5a')))['then'](function(){})[_0x3e98('0x32')](_0x289d2e()));break;case _0x3e98('0x5b'):_0x196acc['push'](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x39cff5(_0x8e0059,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));break;default:_0x196acc[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x19792d(_0x8e0059,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})['catch'](_0x289d2e()));}}}return _0x196acc;})[_0x3e98('0x5f')]()[_0x3e98('0x5e')](function(){return db[_0x3e98('0x52')]['findAll']({'where':{'type':_0x3e98('0x54')},'attributes':['id'],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x60'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x24d83e){var _0xffb009=[];if(_0x24d83e){var _0x1bfbc4;for(var _0x645f33=0x0,_0x3e2619;_0x645f33<_0x24d83e['length'];_0x645f33+=0x1){_0x3e2619=_0x24d83e[_0x645f33][_0x3e98('0x58')]({'plain':!![]});_0xffb009[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x448dfc(_0x3e2619,_0x3e98('0x5a')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));}}return _0xffb009;})[_0x3e98('0x5f')]();})[_0x3e98('0x5e')](function(){return db[_0x3e98('0x61')][_0x3e98('0x53')]({'attributes':['id',_0x3e98('0x55')],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x57'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x947608){var _0x3e48b9=[];if(_0x947608){for(var _0x3ebe99=0x0,_0x445e2c;_0x3ebe99<_0x947608[_0x3e98('0x2b')];_0x3ebe99+=0x1){_0x445e2c=_0x947608[_0x3ebe99][_0x3e98('0x58')]({'plain':!![]});switch(_0x445e2c[_0x3e98('0x55')]){case'always':_0x3e48b9[_0x3e98('0x30')](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x1d071d(_0x445e2c,_0x3e98('0x62')))['then'](function(){})['catch'](_0x289d2e()));break;case _0x3e98('0x5b'):_0x3e48b9[_0x3e98('0x30')](db['sequelize'][_0x3e98('0x5d')](_0x39cff5(_0x445e2c,_0x3e98('0x62')))[_0x3e98('0x5e')](function(){})[_0x3e98('0x32')](_0x289d2e()));break;default:_0x3e48b9['push'](db[_0x3e98('0x5c')][_0x3e98('0x5d')](_0x19792d(_0x445e2c,_0x3e98('0x62')))['then'](function(){})[_0x3e98('0x32')](_0x289d2e()));}}}return _0x3e48b9;})[_0x3e98('0x5f')]();})[_0x3e98('0x5e')](function(){return db[_0x3e98('0x61')][_0x3e98('0x53')]({'attributes':['id'],'include':[{'model':db[_0x3e98('0x56')],'as':_0x3e98('0x60'),'where':{'id':LISTID}}]})[_0x3e98('0x5e')](function(_0x3a4cfe){var _0x25e1e9=[];if(_0x3a4cfe){for(var _0x222933=0x0,_0x3eee01;_0x222933<_0x3a4cfe[_0x3e98('0x2b')];_0x222933+=0x1){_0x3eee01=_0x3a4cfe[_0x222933]['get']({'plain':!![]});_0x25e1e9['push'](db[_0x3e98('0x5c')]['query'](_0x448dfc(_0x3eee01,_0x3e98('0x62')))['then'](function(){})['catch'](_0x289d2e()));}}return _0x25e1e9;})[_0x3e98('0x5f')]();})[_0x3e98('0x32')](function(_0x24399e){logger['error'](_0x3e98('0x63'),'generalCheckHopper',_0x24399e[_0x3e98('0x1e')]);});}var processPromises=function(_0x10404d){return BPromise['all'](promises)[_0x3e98('0x5e')](function(_0x527fa7){})['catch'](function(_0x1648a9){logger[_0x3e98('0x1a')](_0x3e98('0x64'),JSON['stringify'](_0x1648a9));})[_0x3e98('0x65')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x10404d){return _0x10404d['resume']();}});};var endCsv=function(){return BPromise[_0x3e98('0x66')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3e98('0x5e')](function(){socket['emit'](_0x3e98('0x67')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3e98('0x68')](FILEPATH);}catch(_0xdcc71f){logger[_0x3e98('0x1a')](_0x3e98('0x69'),JSON['stringify'](_0xdcc71f));}finally{process[_0x3e98('0x6a')](0x0);}});};process['on'](_0x3e98('0x6b'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3e98('0x66')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x19c2a0){var _0xef3de6=fs[_0x3e98('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3e98('0x6d')](_0xef3de6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x56a761,_0xe64a28){total+=0x1;var _0x70f4cb=total;promises[_0x3e98('0x30')](checkRow(_0x56a761,_0x19c2a0,_0x70f4cb)[_0x3e98('0x5e')](function(){success+=0x1;})[_0x3e98('0x32')](function(_0x555d3d){if(_0x555d3d[_0x3e98('0x1a')]){errors+=0x1;delete _0x555d3d[_0x3e98('0x1a')];}else if(_0x555d3d[_0x3e98('0x6e')]){duplicates+=0x1;delete _0x555d3d['duplicate'];}rows['push'](_0x555d3d);}));if(total%0xc8===0x0){_0xe64a28[_0x3e98('0x6f')]();return processPromises(_0xe64a28);}},'complete':function(){return processPromises()[_0x3e98('0x5e')](function(){logger[_0x3e98('0x70')](_0x3e98('0x71'));endCsv();});},'error':function(_0x14e8ac,_0xedb5a2){logger[_0x3e98('0x70')](_0x3e98('0x72'),JSON[_0x3e98('0x34')](_0x14e8ac));endCsv();}});})[_0x3e98('0x32')](function(_0xdf3e1f){logger[_0x3e98('0x1a')](_0x3e98('0x73'),JSON[_0x3e98('0x34')](_0xdf3e1f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 90eb214..b1a92f6 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 _0xe898=['email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','hasOwnProperty','trim','replace','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','CampaignId','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','push','all','split','length','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','cm_contacts.phone','cm_contacts.id','insert','.CmListId','toString','date_add(cm_contacts.scheduledat,interval\x20','scheduledat','UserId','recallme','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','code','info','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','query','spread','voice_queues.id','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header','ContactItemType','findAll','name','AdditionalPhones','writeFileSync','parse','data','rows','errors','find','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xe898,0xf3));var _0x8e89=function(_0xb77d35,_0x291854){_0xb77d35=_0xb77d35-0x0;var _0x5389a8=_0xe898[_0xb77d35];return _0x5389a8;};'use strict';var fs=require('fs');var path=require(_0x8e89('0x0'));var _=require(_0x8e89('0x1'));var Papa=require(_0x8e89('0x2'));var util=require(_0x8e89('0x3'));var BPromise=require(_0x8e89('0x4'));var moment=require(_0x8e89('0x5'));var squel=require(_0x8e89('0x6'));var Redis=require(_0x8e89('0x7'));var db=require(_0x8e89('0x8'))['db'];var config=require('../../../config/environment');var shared=require(_0x8e89('0x9'));var logger=require('../../../config/logger')(_0x8e89('0xa'));config['redis']=_[_0x8e89('0xb')](config[_0x8e89('0xc')],{'host':_0x8e89('0xd'),'port':0x18eb});var socket=require(_0x8e89('0xe'))(new Redis(config[_0x8e89('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x8e89('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8e89('0x10')](_0x8e89('0xf'));function isEmail(_0x5745f7){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))*$/[_0x8e89('0x11')](_0x5745f7);}function selectNotIn(_0x25cc9d,_0x90e4aa,_0x307cc1,_0x3b72ef,_0x1b36ea){return squel[_0x8e89('0x12')]()[_0x8e89('0x13')](_0x8e89('0x14'))['from'](_0x3b72ef)[_0x8e89('0x15')](_0x90e4aa,null,_0x90e4aa+_0x8e89('0x16')+_0x3b72ef+'.'+_0x307cc1)[_0x8e89('0x17')](_0x3b72ef+'.'+_0x307cc1+_0x8e89('0x18')+_0x25cc9d+'.'+_0x307cc1)[_0x8e89('0x17')](_0x90e4aa+_0x8e89('0x19')+_0x1b36ea[_0x8e89('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5f1fe7,_0x544009){promisesAdditionalPhones=[];return db[_0x8e89('0x1a')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8e89('0x1b')](function(_0x27679e){if(_0x27679e!==null){var _0x42619c=[];for(var _0x1cbdcd=0x0;_0x1cbdcd<_0x27679e['length'];_0x1cbdcd++){var _0x2bd9b2=_0x27679e[_0x1cbdcd];_0x42619c[_0x8e89('0x1c')](insertAdditionalPhones(_0x2bd9b2));}}Promise[_0x8e89('0x1d')](_0x42619c)[_0x8e89('0x1b')](function(){_0x5f1fe7({'val':0x1});});});});}function insertAdditionalPhones(_0x212eb8){return new Promise(function(_0x47b863,_0x1f7556){var _0x148ab7=_0x212eb8['AdditionalPhones'];var _0x39c78e=_0x148ab7[_0x8e89('0x1e')](';');var _0xae7f4=[];orderBy=0x0;for(var _0x177e7a=0x0;_0x177e7a<_0x39c78e[_0x8e89('0x1f')];_0x177e7a++){_0xae7f4[_0x8e89('0x1c')](splitAdditionalPhone(_0x212eb8['id'],_0x39c78e[_0x177e7a]));}Promise[_0x8e89('0x1d')](_0xae7f4)[_0x8e89('0x1b')](function(){_0x47b863({'val':_0x39c78e[_0x8e89('0x1f')]});});});}function splitAdditionalPhone(_0x1ba59e,_0x58fff3){return new Promise(function(_0x415cb6,_0x5c649b){var _0x3ae68b=_0x58fff3[_0x8e89('0x1e')](':');var _0x50ec14=_0x3ae68b[0x0];var _0x41cba4=_0x3ae68b[0x1];if(!_[_0x8e89('0x20')](_0x41cba4)){var _0x4a1cc1=_0x41cba4[_0x8e89('0x1e')]('|');var _0x348e98=[];for(var _0x33ba04=0x0;_0x33ba04<_0x4a1cc1[_0x8e89('0x1f')];_0x33ba04++){if(_0x4a1cc1[_0x33ba04]!==''){var _0x40dab2=_[_0x8e89('0x21')](promisesAdditionalPhones,{'contactId':_0x1ba59e,'phone':_0x4a1cc1[_0x33ba04]});if(_0x40dab2['length']==0x0){orderBy++;promisesAdditionalPhones[_0x8e89('0x1c')]({'contactId':_0x1ba59e,'contactTypeId':_0x50ec14,'phone':_0x4a1cc1[_0x33ba04],'orderBy':orderBy});}}}_0x415cb6({'ok':0x1});}else _0x415cb6({'res':0x0});});}function createAdditionalPhone(_0x2bf0ba,_0x2bc80e,_0x264f6f,_0x21d70b){var _0x447094='';var _0x3c4479='';var _0x9ac127=_0x264f6f[_0x8e89('0x1e')]('§');_0x447094=_0x9ac127[0x0];if(_0x9ac127[_0x8e89('0x1f')]==0x2)_0x3c4479=_0x9ac127[0x1];return new Promise(function(_0x2fc2b2,_0x1f1fb7){return db[_0x8e89('0x22')][_0x8e89('0x23')]({'where':{'CmContactId':_0x2bf0ba,'item':_0x447094}})[_0x8e89('0x1b')](function(_0x4760ad){if(_0x4760ad){return db[_0x8e89('0x22')][_0x8e89('0x24')]({'ItemTypeId':_0x2bc80e,'description':_0x3c4479,'OrderBy':_0x21d70b},{'where':{'CmContactId':_0x2bf0ba,'item':_0x447094}})[_0x8e89('0x1b')](function(_0xbb8716){_0x2fc2b2({'res':_0x8e89('0x25')});});}else{return db[_0x8e89('0x22')][_0x8e89('0x26')]({'CmContactId':_0x2bf0ba,'item':_0x447094,'description':_0x3c4479,'ItemTypeId':_0x2bc80e,'OrderBy':_0x21d70b,'ItemClass':_0x8e89('0x27')})[_0x8e89('0x1b')](function(_0x8abc5b){_0x2fc2b2({'res':'inserted'});});}});});}function insertCmHopper(_0x295aaf,_0x15c36c,_0x5ec770,_0x222fea,_0x5933ee){var _0x6d2aa7=['cm_contacts.phone',_0x8e89('0x28'),'cm_contacts.id',_0x8e89('0x29'),_0x15c36c+'.'+_0x222fea,_0x8e89('0x2a'),_0x8e89('0x2b'),_0x8e89('0x2c'),_0x8e89('0x2d'),'\x22'+_0x5933ee+'\x22'];return squel['insert']()[_0x8e89('0x2e')]('cm_hopper')[_0x8e89('0x2f')]([_0x8e89('0x14'),'scheduledat',_0x8e89('0x30'),_0x8e89('0x31'),_0x222fea,_0x8e89('0x32'),_0x8e89('0x33'),_0x8e89('0x34'),'UserId','recallme'],squel[_0x8e89('0x12')]()[_0x8e89('0x35')](_0x6d2aa7)[_0x8e89('0x36')](_0x15c36c)[_0x8e89('0x15')](_0x8e89('0x37'),null,_0x8e89('0x38')+_0x15c36c+'.CmListId')[_0x8e89('0x15')](_0x5ec770,null,_0x5ec770+_0x8e89('0x16')+_0x15c36c+'.'+_0x222fea)['where'](_0x15c36c+_0x8e89('0x39'),_0x295aaf)[_0x8e89('0x17')](_0x8e89('0x3a'),NOW)[_0x8e89('0x17')](_0x8e89('0x3b'),selectNotIn(_0x15c36c,_0x5ec770,_0x222fea,'cm_hopper',[_0x8e89('0x3c'),_0x8e89('0x3d')]))[_0x8e89('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x15c36c,_0x5ec770,_0x222fea,_0x8e89('0x3e'),[_0x8e89('0x3c')])))['toString']();}function insertCmHopperBlack(_0x54f34d,_0x10cbf0,_0x571e90,_0x1bd9f5){var _0x5a1d39=[_0x8e89('0x3f'),_0x8e89('0x40'),_0x8e89('0x29'),_0x10cbf0+'.'+_0x1bd9f5,_0x8e89('0x2a'),_0x8e89('0x2b')];return squel[_0x8e89('0x41')]()['into']('cm_hopper_black')[_0x8e89('0x2f')]([_0x8e89('0x14'),_0x8e89('0x30'),'ListId',_0x1bd9f5,'createdAt',_0x8e89('0x33')],squel[_0x8e89('0x12')]()['fields'](_0x5a1d39)[_0x8e89('0x36')](_0x10cbf0)['join'](_0x8e89('0x37'),null,_0x8e89('0x38')+_0x10cbf0+_0x8e89('0x42'))[_0x8e89('0x15')](_0x571e90,null,_0x571e90+_0x8e89('0x16')+_0x10cbf0+'.'+_0x1bd9f5)[_0x8e89('0x17')](_0x10cbf0+_0x8e89('0x39'),_0x54f34d)[_0x8e89('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8e89('0x17')](_0x8e89('0x3b'),squel[_0x8e89('0x12')]()[_0x8e89('0x13')](_0x8e89('0x14'))[_0x8e89('0x36')]('cm_hopper_black')[_0x8e89('0x17')]('ListId\x20=\x20?',_0x54f34d)[_0x8e89('0x17')](_0x1bd9f5+_0x8e89('0x18')+_0x10cbf0+'.'+_0x1bd9f5)))[_0x8e89('0x43')]();}function insertTzCmHopper(_0x43ecf9,_0x21e3de,_0x7e312,_0x226b4d,_0x2d71d2,_0x3b0b9b){var _0x527987=[_0x8e89('0x3f'),_0x8e89('0x44')+_0x3b0b9b+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x8e89('0x29'),_0x21e3de+'.'+_0x226b4d,_0x8e89('0x2a'),'cm_contacts.updatedAt','cm_contacts.priority',_0x8e89('0x2d'),'\x22'+_0x2d71d2+'\x22'];var _0x4dca21=squel['insert']()[_0x8e89('0x2e')]('cm_hopper')[_0x8e89('0x2f')]([_0x8e89('0x14'),_0x8e89('0x45'),'ContactId',_0x8e89('0x31'),_0x226b4d,_0x8e89('0x32'),_0x8e89('0x33'),_0x8e89('0x34'),_0x8e89('0x46'),_0x8e89('0x47')],squel[_0x8e89('0x12')]()[_0x8e89('0x35')](_0x527987)[_0x8e89('0x36')](_0x21e3de)[_0x8e89('0x15')]('cm_contacts',null,_0x8e89('0x38')+_0x21e3de+_0x8e89('0x42'))[_0x8e89('0x15')](_0x7e312,null,_0x7e312+_0x8e89('0x16')+_0x21e3de+'.'+_0x226b4d)[_0x8e89('0x15')](_0x3b0b9b,null,_0x3b0b9b+_0x8e89('0x16')+_0x21e3de+'.'+_0x226b4d)[_0x8e89('0x17')](_0x21e3de+_0x8e89('0x39'),_0x43ecf9)[_0x8e89('0x17')](_0x8e89('0x3a'),NOW)['where'](_0x8e89('0x3b'),selectNotIn(_0x21e3de,_0x7e312,_0x226b4d,_0x8e89('0x3e'),['\x22always\x22',_0x8e89('0x3d')]))[_0x8e89('0x17')](_0x8e89('0x3b'),selectNotIn(_0x21e3de,_0x7e312,_0x226b4d,'cm_hopper',[_0x8e89('0x3c')])))[_0x8e89('0x43')]();return _0x4dca21;}function insertTzCmHopperBlack(_0x234293,_0x3790bf,_0xd6a0da,_0x232692){var _0x1774a1=[_0x8e89('0x3f'),'cm_contacts.id',_0x8e89('0x29'),_0x3790bf+'.'+_0x232692,_0x8e89('0x2a'),_0x8e89('0x2b')];return squel[_0x8e89('0x41')]()[_0x8e89('0x2e')](_0x8e89('0x48'))['fromQuery'](['phone',_0x8e89('0x30'),_0x8e89('0x31'),_0x232692,_0x8e89('0x32'),_0x8e89('0x33')],squel['select']()['fields'](_0x1774a1)['from'](_0x3790bf)[_0x8e89('0x15')](_0x8e89('0x37'),null,_0x8e89('0x38')+_0x3790bf+_0x8e89('0x42'))[_0x8e89('0x15')](_0xd6a0da,null,_0xd6a0da+_0x8e89('0x16')+_0x3790bf+'.'+_0x232692)[_0x8e89('0x17')](_0x3790bf+_0x8e89('0x39'),_0x234293)[_0x8e89('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8e89('0x17')](_0x8e89('0x3b'),squel[_0x8e89('0x12')]()['field']('phone')[_0x8e89('0x36')](_0x8e89('0x48'))[_0x8e89('0x17')](_0x8e89('0x49'),_0x234293)[_0x8e89('0x17')](_0x232692+'\x20=\x20'+_0x3790bf+'.'+_0x232692)))[_0x8e89('0x43')]();}function insertCmHopperAdditionalPhones(_0x22f3fc){var _0x121265=[_0x8e89('0x4a'),_0x8e89('0x4b'),_0x8e89('0x4c'),_0x8e89('0x4d'),_0x8e89('0x4e')];return squel[_0x8e89('0x41')]()['into']('cm_hopper_additional_phones')[_0x8e89('0x2f')](['CmHopperId','phone',_0x8e89('0x4f'),'createdAt',_0x8e89('0x33')],squel[_0x8e89('0x12')]()['fields'](_0x121265)[_0x8e89('0x36')]('cm_hopper')[_0x8e89('0x15')]('cm_contacts',null,_0x8e89('0x50'))[_0x8e89('0x15')](_0x8e89('0x51'),null,_0x8e89('0x52'))['where'](_0x8e89('0x53'),_0x22f3fc)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x244011,_0x583989,_0x432c89,_0x5b7ed0){var _0x4de12=_[_0x8e89('0x54')](_['keys'](_0x5b7ed0),[_0x8e89('0x31'),_0x8e89('0x55'),'createdAt',_0x8e89('0x33'),_0x8e89('0x56')]);return squel['insert']()[_0x8e89('0x2e')](_0x8e89('0x37'))[_0x8e89('0x2f')](_0x4de12,squel[_0x8e89('0x12')]()[_0x8e89('0x35')](_0x4de12)[_0x8e89('0x36')](_0x583989)[_0x8e89('0x17')]('('+_0x432c89[_0x8e89('0x15')](',')+_0x8e89('0x57'),squel['select']()[_0x8e89('0x35')](_0x432c89)[_0x8e89('0x36')](_0x8e89('0x37'))[_0x8e89('0x17')]('ListId\x20=\x20?',_0x244011)[_0x8e89('0x17')](_0x8e89('0x58')))[_0x8e89('0x17')](_0x8e89('0x59'),squel[_0x8e89('0x12')]()[_0x8e89('0x13')](_0x8e89('0x5a'),_0x8e89('0x5b'))['from'](_0x583989)[_0x8e89('0x5c')](_0x432c89[_0x8e89('0x15')](','))))[_0x8e89('0x43')]();}function handleStop(){logger['info'](_0x8e89('0x5d'));stopped=!![];}function handleUncaughtException(_0x24e7e7){logger[_0x8e89('0x5e')](_0x24e7e7[_0x8e89('0x5f')]);process[_0x8e89('0x60')](0x1);}function handleError(_0x3ea526,_0x90e66){stats['errors'][_0x8e89('0x1c')]({'name':_0x90e66[_0x8e89('0x61')],'message':_0x90e66[_0x8e89('0x5f')],'row':_0x3ea526});}function handleQuery(_0x2a7035){logger[_0x8e89('0x62')](_0x2a7035);return db['sequelize']['query'](_0x2a7035)['spread'](function(_0x2bc54f){results[_0x8e89('0x1c')](_0x2bc54f);})[_0x8e89('0x63')](function(_0x467781){logger['error'](_0x467781[_0x8e89('0x5f')]);});}function updateTzCampaigns(_0x4889f0){return new Promise(function(_0xec2c54,_0x52920c){var _0x2cf9a7=squel[_0x8e89('0x12')]()[_0x8e89('0x35')]([_0x8e89('0x64'),_0x8e89('0x65')])['from'](_0x8e89('0x66'))[_0x8e89('0x15')](_0x8e89('0x67'),null,_0x8e89('0x68'))[_0x8e89('0x17')]('campaigns_has_cm_lists.CmListId='+_0x4889f0);db[_0x8e89('0x69')][_0x8e89('0x6a')](_0x2cf9a7[_0x8e89('0x43')]())[_0x8e89('0x6b')](function(_0xab34b4){var _0x2ceb40=[];for(var _0x401f93=0x0;_0x401f93<_0xab34b4[_0x8e89('0x1f')];_0x401f93++){_0x2ceb40[_0x8e89('0x1c')](getTimezoneData(_0xab34b4[_0x401f93],tmp_campaigns));}BPromise['all'](_0x2ceb40)[_0x8e89('0x1b')](function(){_0xec2c54({'val':0x1});});})['catch'](function(_0x599519){logger[_0x8e89('0x5e')](_0x599519[_0x8e89('0x5f')]);_0xec2c54({'val':0x0});});});}function updateTzVoiceQueues(_0xf79203){return new Promise(function(_0xac1cb,_0x155466){var _0x4d704=squel[_0x8e89('0x12')]()[_0x8e89('0x35')]([_0x8e89('0x6c'),'voice_queues.dialTimezone'])['from'](_0x8e89('0x6d'))['join'](_0x8e89('0x6e'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x8e89('0x17')]('voice_queues_has_cm_lists.CmListId='+_0xf79203);db[_0x8e89('0x69')][_0x8e89('0x6a')](_0x4d704[_0x8e89('0x43')]())[_0x8e89('0x6b')](function(_0x42b54a){var _0x5ac1ad=[];for(var _0x29fc3f=0x0;_0x29fc3f<_0x42b54a['length'];_0x29fc3f++){_0x5ac1ad[_0x8e89('0x1c')](getTimezoneData(_0x42b54a[_0x29fc3f],tmp_voice_queues));}BPromise[_0x8e89('0x1d')](_0x5ac1ad)['then'](function(){_0xac1cb({'val':0x1});});})[_0x8e89('0x63')](function(_0x59524f){logger[_0x8e89('0x5e')](_0x59524f[_0x8e89('0x5f')]);_0xac1cb({'val':0x0});});});}function getTimezoneData(_0x509d7a,_0x418855){return new Promise(function(_0x1acc71,_0x5f1250){var _0x257625=shared[_0x8e89('0x6f')];var _0x252957=_0x257625[_0x509d7a[_0x8e89('0x70')]];if(_['isNil'](_0x252957)){_0x1acc71({'ret':0x1});}else{var _0x4071e5=_0x252957[_0x8e89('0x71')];var _0x255957=squel[_0x8e89('0x41')]()[_0x8e89('0x2e')](_0x418855)[_0x8e89('0x72')]('id',_0x509d7a['id'])['set'](_0x8e89('0x73'),_0x4071e5)[_0x8e89('0x72')](_0x8e89('0x70'),_0x509d7a['dialTimezone'])[_0x8e89('0x43')]();return db[_0x8e89('0x69')]['query'](_0x255957)[_0x8e89('0x6b')](function(_0x3bbf25){_0x1acc71({'ret':0x1});})[_0x8e89('0x63')](function(_0x5b277a){logger['error'](_0x5b277a[_0x8e89('0x5f')]);_0x5f1250({'ret':0x1});});}});}function handleTZQuery(_0x3b767e){logger[_0x8e89('0x62')](_0x3b767e);return db[_0x8e89('0x69')][_0x8e89('0x6a')](_0x3b767e)[_0x8e89('0x6b')](function(_0x3088b2){})[_0x8e89('0x63')](function(_0x3c5fa8){logger['error'](_0x3c5fa8[_0x8e89('0x5f')]);});}function main(_0x391d90,_0x381967,_0x2d46d9,_0x11521a){logger[_0x8e89('0x62')](_0x8e89('0x74'),_0x391d90,JSON[_0x8e89('0x75')](_0x381967));process[_0x8e89('0x76')](_0x8e89('0x77'));var _0x2ff02b=_0x381967['binding'];var _0x4921d4=_[_0x8e89('0x78')](_0x2ff02b);var _0x392494=_0x381967[_0x8e89('0x79')];var _0x566ae1=path[_0x8e89('0x15')](config[_0x8e89('0x7a')],_0x8e89('0x7b'),_0x392494+_0x8e89('0x7c'));hasTZ=_[_0x8e89('0x7d')](_0x2ff02b)[_0x8e89('0x7e')](_0x8e89('0x70'));var _0x58bddd=_[_0x8e89('0x7d')](_0x2ff02b)[_0x8e89('0x15')]();logger[_0x8e89('0x62')](_0x8e89('0x7f'),_0x58bddd);db[_0x8e89('0x80')][_0x8e89('0x81')]({'raw':!![],'attributes':['id',_0x8e89('0x82')]})[_0x8e89('0x1b')](function(_0x50113d){for(var _0x3f1595=0x0;_0x3f1595<_0x50113d[_0x8e89('0x1f')];_0x3f1595++){if(_0x50113d[_0x3f1595][_0x8e89('0x82')]in _0x2ff02b){contactItemTypes[_0x8e89('0x1c')](_0x50113d[_0x3f1595]);delete _0x4921d4[_0x50113d[_0x3f1595][_0x8e89('0x82')]];hasAdditionalPhones=!![];}for(var _0x5aa0eb in _0x2ff02b){if(_0x50113d[_0x3f1595][_0x8e89('0x82')]+'_description'===_0x5aa0eb){phoneDescriptions['push']({'itemTypeId':_0x50113d[_0x3f1595]['id'],'description':_0x5aa0eb});delete _0x4921d4[_0x5aa0eb];}}}if(hasAdditionalPhones)_0x4921d4[_0x8e89('0x83')]='';var _0x1df8b2=_[_0x8e89('0x7d')](_0x4921d4)['join']();logger[_0x8e89('0x62')](_0x8e89('0x7f'),_0x1df8b2);fs[_0x8e89('0x84')](_0x566ae1,_0x1df8b2+'\x0a');Papa[_0x8e89('0x85')](fs['createReadStream'](_0x391d90),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3477cb,_0x33889a){try{for(var _0x48aa98=0x0,_0xe05162=[];_0x48aa98<_0x3477cb[_0x8e89('0x86')][_0x8e89('0x1f')];_0x48aa98++){stats[_0x8e89('0x87')]+=0x1;if(_0x3477cb['errors'][_0x48aa98]){handleError(_0x3477cb[_0x8e89('0x86')][_0x48aa98],_0x3477cb[_0x8e89('0x88')][_0x48aa98]);}else{var _0x349a98=[];var _0xe2a0cf=[];var _0x10532c={};for(var _0x52c07e in _0x2ff02b){let _0x305eab=contactItemTypes[_0x8e89('0x89')](_0x3f55ea=>_0x3f55ea[_0x8e89('0x82')]===_0x52c07e);let _0x37925d=contactItemTypes[_0x8e89('0x89')](_0x17eb48=>_0x17eb48[_0x8e89('0x82')]+'_description'===_0x52c07e);if(_[_0x8e89('0x20')](_0x305eab)&&_[_0x8e89('0x20')](_0x37925d)){if(_0x2ff02b['hasOwnProperty'](_0x52c07e)){if(_0x3477cb[_0x8e89('0x86')][_0x48aa98][_0x2ff02b[_0x52c07e]]){var _0x4f3396=_['trim'](_0x3477cb[_0x8e89('0x86')][_0x48aa98][_0x2ff02b[_0x52c07e]]['replace'](/"/g,'\x27'));switch(_0x52c07e){case'scheduledat':var _0x18610b=moment(_0x4f3396,_0x8e89('0xf'),!![]);if(_0x18610b[_0x8e89('0x8a')]()){_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');}else{_0x349a98[_0x8e89('0x1c')](_0x8e89('0x8b'));}break;case'priority':var _0x13e4fc=parseInt(_0x4f3396);_0x4f3396=_[_0x8e89('0x8c')](_0x13e4fc)||_0x13e4fc<0x0||_0x13e4fc>0x4?_0x11521a?0x3:0x2:_0x13e4fc;_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');break;case _0x8e89('0x46'):var _0x114bd1=parseInt(_0x4f3396);if(_[_0x8e89('0x8d')](_0x114bd1)&&_['includes'](_0x2d46d9,_0x114bd1)){_0xe05162['push']('\x22'+_0x114bd1+'\x22');}else{_0x349a98[_0x8e89('0x1c')]('agent\x20not\x20exists');}break;case _0x8e89('0x8e'):if(isEmail(_0x4f3396)){_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');}else{_0x349a98[_0x8e89('0x1c')](_0x8e89('0x8f'));}break;case _0x8e89('0x90'):var _0x476f33=moment(_0x4f3396,_0x8e89('0x91'),!![]);if(_0x476f33[_0x8e89('0x8a')]()){_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');}else{_0x349a98[_0x8e89('0x1c')](_0x8e89('0x92'));}break;case _0x8e89('0x70'):var _0x16109b=shared[_0x8e89('0x6f')];var _0x8c26e5=_0x16109b[_0x4f3396];if(!_[_0x8e89('0x20')](_0x8c26e5)){var _0x38e814=_0x8c26e5[_0x8e89('0x71')];_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');_0xe05162['push']('\x22'+_0x38e814+'\x22');}break;default:_0xe05162[_0x8e89('0x1c')]('\x22'+_0x4f3396+'\x22');}}else{switch(_0x52c07e){case'firstName':case _0x8e89('0x14'):_0x349a98[_0x8e89('0x1c')](_0x52c07e+'\x20not\x20specified');break;default:_0xe05162[_0x8e89('0x1c')]('\x22\x22');}}}}else{var _0x24733c='';if(!_[_0x8e89('0x20')](_0x305eab)){if(!_0x10532c[_0x8e89('0x93')](_0x305eab['id'])){if(!_[_0x8e89('0x20')](_0x3477cb['data'][_0x48aa98][_0x2ff02b[_0x52c07e]])){var _0x4f3396=_[_0x8e89('0x94')](_0x3477cb[_0x8e89('0x86')][_0x48aa98][_0x2ff02b[_0x52c07e]][_0x8e89('0x95')](/"/g,'\x27'));var _0x87ef66=phoneDescriptions[_0x8e89('0x89')](_0x260c67=>_0x260c67['itemTypeId']===_0x305eab['id']);if(!_[_0x8e89('0x20')](_0x87ef66)){var _0x2ddcde=_['trim'](_0x3477cb[_0x8e89('0x86')][_0x48aa98][_0x2ff02b[_0x87ef66[_0x8e89('0x96')]]][_0x8e89('0x95')](/"/g,'\x27'));if(!_[_0x8e89('0x20')](_0x2ddcde))_0x4f3396=_0x4f3396+'§'+_0x2ddcde;}if(_0x24733c=='')_0x24733c=_0x4f3396;else _0x24733c+='|'+_0x4f3396;}_0xe2a0cf[_0x8e89('0x1c')](_0x305eab['id']+':'+_0x24733c);_0x10532c[_0x305eab['id']]=0x1;}}}}if(hasAdditionalPhones){_0xe05162[_0x8e89('0x1c')]('\x22'+_0xe2a0cf['join'](';')+'\x22');}if(_0x349a98[_0x8e89('0x1f')]){handleError(_0x3477cb[_0x8e89('0x86')][_0x48aa98],{'code':_0x8e89('0x97'),'message':_0x349a98['join']()});}else{fs[_0x8e89('0x98')](_0x566ae1,_0xe05162['join']()+'\x0a');}_0xe05162=[];}if(!(stats[_0x8e89('0x87')]%0xc8)){socket[_0x8e89('0x99')](_0x8e89('0x9a')+_0x392494,stats);stats['errors']=[];}}if(stopped){logger[_0x8e89('0x62')](_0x8e89('0x9b'));_0x33889a['abort']();}}catch(_0x51429e){handleError(_0x3477cb[_0x8e89('0x86')][_0x48aa98],{'code':_0x8e89('0x9c'),'message':_0x51429e[_0x8e89('0x5f')]});logger['error'](_0x8e89('0x9d'),_0x51429e[_0x8e89('0x5f')]);}},'complete':function(){try{var _0x4cc828=[];var _0xb1e316=[];var _0x2d4884='cm_contacts';if(_0x381967[_0x8e89('0x9e')]&&_0x381967[_0x8e89('0x9e')][_0x8e89('0x1f')]){_0x2d4884=_0x8e89('0x9f')+_0x392494;_0x4cc828[_0x8e89('0x1c')](_0x8e89('0xa0')+_0x2d4884+_0x8e89('0xa1'));}tmp_campaigns=_0x8e89('0xa2')+_0x392494;tmp_voice_queues=_0x8e89('0xa3')+_0x392494;_0xb1e316[_0x8e89('0x1c')](_0x8e89('0xa0')+tmp_campaigns+_0x8e89('0xa4'));_0xb1e316[_0x8e89('0x1c')](_0x8e89('0xa0')+tmp_voice_queues+_0x8e89('0xa4'));BPromise['each'](_0xb1e316,handleTZQuery)[_0x8e89('0x1b')](function(_0x5d31b9){updateTzCampaigns(_0x381967[_0x8e89('0x31')])[_0x8e89('0x1b')](function(_0x50b829){updateTzVoiceQueues(_0x381967[_0x8e89('0x31')])['then'](function(_0x1ae6bf){if(hasTZ)_0x1df8b2=_0x1df8b2[_0x8e89('0x95')]('dialTimezone',_0x8e89('0xa5'));var _0x2162c8=util[_0x8e89('0x10')](_0x8e89('0xa6'),_0x566ae1,_0x2d4884,_0x1df8b2,_0x381967[_0x8e89('0x31')],_0x381967['CompanyId']||null,NOW,NOW);if(_[_0x8e89('0x20')](_0x2ff02b[_0x8e89('0x45')])){_0x2162c8+=_0x8e89('0xa7');}_0x4cc828[_0x8e89('0x1c')](_0x2162c8);if(_0x381967['duplicates']&&_0x381967[_0x8e89('0x9e')]['length']){_0x4cc828[_0x8e89('0x1c')](insertCmContact(_0x381967[_0x8e89('0x31')],_0x2d4884,_0x381967[_0x8e89('0x9e')],_0x2ff02b));_0x4cc828[_0x8e89('0x1c')](_0x8e89('0xa8')+_0x2d4884+';');}BPromise[_0x8e89('0xa9')](_0x4cc828,handleQuery)[_0x8e89('0x1b')](function(_0x11db80){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x4cc828=[];for(var _0x584615=0x0;_0x584615\x20\x20','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','length','push','all','AdditionalPhones','split','filter','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','insert','cm_hopper_black','updatedAt','fields','from','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.createdAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error'];(function(_0x3a1c16,_0xd3d0){var _0x2977ce=function(_0x42e4b7){while(--_0x42e4b7){_0x3a1c16['push'](_0x3a1c16['shift']());}};_0x2977ce(++_0xd3d0);}(_0x89b9,0x112));var _0x989b=function(_0x4f9506,_0x499ab0){_0x4f9506=_0x4f9506-0x0;var _0x23037b=_0x89b9[_0x4f9506];return _0x23037b;};'use strict';var fs=require('fs');var path=require(_0x989b('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0x989b('0x1'));var squel=require('squel');var Redis=require(_0x989b('0x2'));var db=require(_0x989b('0x3'))['db'];var config=require(_0x989b('0x4'));var shared=require(_0x989b('0x5'));var logger=require(_0x989b('0x6'))(_0x989b('0x7'));config['redis']=_['defaults'](config[_0x989b('0x8')],{'host':_0x989b('0x9'),'port':0x18eb});var socket=require(_0x989b('0xa'))(new Redis(config[_0x989b('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x989b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x989b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x88debd){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))*$/[_0x989b('0xc')](_0x88debd);}function selectNotIn(_0x5edd22,_0xcce11d,_0xa7b6a8,_0xa66ae0,_0x5e2eb4){return squel[_0x989b('0xd')]()[_0x989b('0xe')](_0x989b('0xf'))['from'](_0xa66ae0)[_0x989b('0x10')](_0xcce11d,null,_0xcce11d+_0x989b('0x11')+_0xa66ae0+'.'+_0xa7b6a8)[_0x989b('0x12')](_0xa66ae0+'.'+_0xa7b6a8+_0x989b('0x13')+_0x5edd22+'.'+_0xa7b6a8)[_0x989b('0x12')](_0xcce11d+_0x989b('0x14')+_0x5e2eb4[_0x989b('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5982a4,_0x1ca255){promisesAdditionalPhones=[];return db[_0x989b('0x15')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x989b('0x16')](function(_0x3ddfef){if(_0x3ddfef!==null){var _0x2a3a21=[];for(var _0x261e30=0x0;_0x261e30<_0x3ddfef[_0x989b('0x17')];_0x261e30++){var _0x368f3d=_0x3ddfef[_0x261e30];_0x2a3a21[_0x989b('0x18')](insertAdditionalPhones(_0x368f3d));}}Promise[_0x989b('0x19')](_0x2a3a21)['then'](function(){_0x5982a4({'val':0x1});});});});}function insertAdditionalPhones(_0x21994c){return new Promise(function(_0x1051ea,_0x4d0893){var _0x196e78=_0x21994c[_0x989b('0x1a')];var _0xaa452c=_0x196e78[_0x989b('0x1b')](';');var _0x3d9195=[];orderBy=0x0;for(var _0x19d6b8=0x0;_0x19d6b8<_0xaa452c[_0x989b('0x17')];_0x19d6b8++){_0x3d9195[_0x989b('0x18')](splitAdditionalPhone(_0x21994c['id'],_0xaa452c[_0x19d6b8]));}Promise['all'](_0x3d9195)[_0x989b('0x16')](function(){_0x1051ea({'val':_0xaa452c[_0x989b('0x17')]});});});}function splitAdditionalPhone(_0x2bc5b8,_0x400023){return new Promise(function(_0x5f13e8,_0x289aa3){var _0x2df7b6=_0x400023['split'](':');var _0x190c6c=_0x2df7b6[0x0];var _0x1003a5=_0x2df7b6[0x1];if(!_['isNil'](_0x1003a5)){var _0x1ff54b=_0x1003a5['split']('|');var _0x522727=[];for(var _0x4e7ab8=0x0;_0x4e7ab8<_0x1ff54b[_0x989b('0x17')];_0x4e7ab8++){if(_0x1ff54b[_0x4e7ab8]!==''){var _0x4238db=_[_0x989b('0x1c')](promisesAdditionalPhones,{'contactId':_0x2bc5b8,'phone':_0x1ff54b[_0x4e7ab8]});if(_0x4238db['length']==0x0){orderBy++;promisesAdditionalPhones[_0x989b('0x18')]({'contactId':_0x2bc5b8,'contactTypeId':_0x190c6c,'phone':_0x1ff54b[_0x4e7ab8],'orderBy':orderBy});}}}_0x5f13e8({'ok':0x1});}else _0x5f13e8({'res':0x0});});}function createAdditionalPhone(_0x5bdf0a,_0x31bad6,_0x2d7914,_0x4ea24b){var _0x2a3f16='';var _0x177e21='';var _0x3f28db=_0x2d7914[_0x989b('0x1b')]('§');_0x2a3f16=_0x3f28db[0x0];if(_0x3f28db[_0x989b('0x17')]==0x2)_0x177e21=_0x3f28db[0x1];return new Promise(function(_0xf8990c,_0x3b8591){return db[_0x989b('0x1d')]['findOne']({'where':{'CmContactId':_0x5bdf0a,'item':_0x2a3f16}})[_0x989b('0x16')](function(_0xdc864){if(_0xdc864){return db[_0x989b('0x1d')][_0x989b('0x1e')]({'ItemTypeId':_0x31bad6,'description':_0x177e21,'OrderBy':_0x4ea24b},{'where':{'CmContactId':_0x5bdf0a,'item':_0x2a3f16}})[_0x989b('0x16')](function(_0x2111b9){_0xf8990c({'res':'updated'});});}else{return db['CmContactHasItem'][_0x989b('0x1f')]({'CmContactId':_0x5bdf0a,'item':_0x2a3f16,'description':_0x177e21,'ItemTypeId':_0x31bad6,'OrderBy':_0x4ea24b,'ItemClass':_0x989b('0x20')})[_0x989b('0x16')](function(_0x53bff2){_0xf8990c({'res':_0x989b('0x21')});});}});});}function insertCmHopper(_0x5a465d,_0x5d9ce1,_0x376031,_0x320f7d,_0x351382){var _0x536343=[_0x989b('0x22'),_0x989b('0x23'),_0x989b('0x24'),_0x989b('0x25'),_0x5d9ce1+'.'+_0x320f7d,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x989b('0x26'),_0x989b('0x27'),'\x22'+_0x351382+'\x22'];return squel['insert']()[_0x989b('0x28')](_0x989b('0x29'))[_0x989b('0x2a')]([_0x989b('0xf'),_0x989b('0x2b'),_0x989b('0x2c'),_0x989b('0x2d'),_0x320f7d,_0x989b('0x2e'),'updatedAt',_0x989b('0x2f'),_0x989b('0x30'),_0x989b('0x31')],squel[_0x989b('0xd')]()['fields'](_0x536343)['from'](_0x5d9ce1)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x5d9ce1+_0x989b('0x34'))['join'](_0x376031,null,_0x376031+_0x989b('0x11')+_0x5d9ce1+'.'+_0x320f7d)[_0x989b('0x12')](_0x5d9ce1+_0x989b('0x35'),_0x5a465d)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x5d9ce1,_0x376031,_0x320f7d,'cm_hopper',[_0x989b('0x38'),_0x989b('0x39')]))[_0x989b('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d9ce1,_0x376031,_0x320f7d,_0x989b('0x29'),[_0x989b('0x38')])))[_0x989b('0x3a')]();}function insertCmHopperBlack(_0x4517a2,_0x11278e,_0x4dacc6,_0x22e0ce){var _0x2f7f48=[_0x989b('0x22'),_0x989b('0x24'),_0x989b('0x25'),_0x11278e+'.'+_0x22e0ce,'cm_contacts.createdAt',_0x989b('0x3b')];return squel[_0x989b('0x3c')]()['into'](_0x989b('0x3d'))[_0x989b('0x2a')]([_0x989b('0xf'),_0x989b('0x2c'),_0x989b('0x2d'),_0x22e0ce,'createdAt',_0x989b('0x3e')],squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x2f7f48)[_0x989b('0x40')](_0x11278e)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x11278e+_0x989b('0x34'))[_0x989b('0x10')](_0x4dacc6,null,_0x4dacc6+_0x989b('0x11')+_0x11278e+'.'+_0x22e0ce)[_0x989b('0x12')](_0x11278e+_0x989b('0x35'),_0x4517a2)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x989b('0xd')]()[_0x989b('0xe')]('phone')[_0x989b('0x40')](_0x989b('0x3d'))[_0x989b('0x12')](_0x989b('0x41'),_0x4517a2)[_0x989b('0x12')](_0x22e0ce+'\x20=\x20'+_0x11278e+'.'+_0x22e0ce)))[_0x989b('0x3a')]();}function insertTzCmHopper(_0x55c84d,_0x3d2fcc,_0x4e1e51,_0x2f11f4,_0x90221c,_0x476ee9){var _0x399470=[_0x989b('0x22'),_0x989b('0x42')+_0x476ee9+'.offset-cm_contacts.utcOffset\x20minute)',_0x989b('0x24'),_0x989b('0x25'),_0x3d2fcc+'.'+_0x2f11f4,_0x989b('0x43'),_0x989b('0x3b'),_0x989b('0x26'),'cm_contacts.UserId','\x22'+_0x90221c+'\x22'];var _0x560eec=squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x29'))[_0x989b('0x2a')](['phone',_0x989b('0x2b'),_0x989b('0x2c'),_0x989b('0x2d'),_0x2f11f4,_0x989b('0x2e'),'updatedAt',_0x989b('0x2f'),_0x989b('0x30'),'recallme'],squel['select']()[_0x989b('0x3f')](_0x399470)['from'](_0x3d2fcc)[_0x989b('0x10')](_0x989b('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x3d2fcc+_0x989b('0x34'))[_0x989b('0x10')](_0x4e1e51,null,_0x4e1e51+_0x989b('0x11')+_0x3d2fcc+'.'+_0x2f11f4)['join'](_0x476ee9,null,_0x476ee9+_0x989b('0x11')+_0x3d2fcc+'.'+_0x2f11f4)['where'](_0x3d2fcc+_0x989b('0x35'),_0x55c84d)['where'](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x3d2fcc,_0x4e1e51,_0x2f11f4,_0x989b('0x29'),[_0x989b('0x38'),'\x22onlyIfOpen\x22']))[_0x989b('0x12')](_0x989b('0x37'),selectNotIn(_0x3d2fcc,_0x4e1e51,_0x2f11f4,'cm_hopper',[_0x989b('0x38')])))[_0x989b('0x3a')]();return _0x560eec;}function insertTzCmHopperBlack(_0x3c7688,_0x483473,_0x449c17,_0x4ed766){var _0x180a43=[_0x989b('0x22'),_0x989b('0x24'),'cm_contacts.ListId',_0x483473+'.'+_0x4ed766,'cm_contacts.createdAt',_0x989b('0x3b')];return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x3d'))[_0x989b('0x2a')]([_0x989b('0xf'),'ContactId',_0x989b('0x2d'),_0x4ed766,'createdAt',_0x989b('0x3e')],squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x180a43)[_0x989b('0x40')](_0x483473)[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x33')+_0x483473+_0x989b('0x34'))[_0x989b('0x10')](_0x449c17,null,_0x449c17+_0x989b('0x11')+_0x483473+'.'+_0x4ed766)[_0x989b('0x12')](_0x483473+_0x989b('0x35'),_0x3c7688)[_0x989b('0x12')](_0x989b('0x36'),NOW)[_0x989b('0x12')](_0x989b('0x37'),squel[_0x989b('0xd')]()[_0x989b('0xe')]('phone')['from'](_0x989b('0x3d'))[_0x989b('0x12')](_0x989b('0x41'),_0x3c7688)['where'](_0x4ed766+_0x989b('0x13')+_0x483473+'.'+_0x4ed766)))[_0x989b('0x3a')]();}function insertCmHopperAdditionalPhones(_0x108f57){var _0x2a79a6=[_0x989b('0x44'),_0x989b('0x45'),_0x989b('0x46'),'cm_contact_has_items.createdAt',_0x989b('0x47')];return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x48'))[_0x989b('0x2a')](['CmHopperId',_0x989b('0xf'),_0x989b('0x49'),_0x989b('0x2e'),_0x989b('0x3e')],squel['select']()[_0x989b('0x3f')](_0x2a79a6)['from'](_0x989b('0x29'))[_0x989b('0x10')](_0x989b('0x32'),null,_0x989b('0x4a'))[_0x989b('0x10')]('cm_contact_has_items',null,_0x989b('0x4b'))['where'](_0x989b('0x4c'),_0x108f57)['where'](_0x989b('0x36'),NOW))['toString']();}function insertCmContact(_0x5c3ba6,_0x1ccfa4,_0x5a8d3c,_0x43f4f0){var _0x26c380=_['concat'](_['keys'](_0x43f4f0),[_0x989b('0x2d'),_0x989b('0x4d'),'createdAt',_0x989b('0x3e'),'scheduledAt']);return squel[_0x989b('0x3c')]()[_0x989b('0x28')](_0x989b('0x32'))[_0x989b('0x2a')](_0x26c380,squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x26c380)[_0x989b('0x40')](_0x1ccfa4)[_0x989b('0x12')]('('+_0x5a8d3c['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x989b('0xd')]()[_0x989b('0x3f')](_0x5a8d3c)['from'](_0x989b('0x32'))['where'](_0x989b('0x41'),_0x5c3ba6)['where'](_0x989b('0x4e')))[_0x989b('0x12')](_0x989b('0x4f'),squel[_0x989b('0xd')]()[_0x989b('0xe')](_0x989b('0x50'),_0x989b('0x51'))[_0x989b('0x40')](_0x1ccfa4)[_0x989b('0x52')](_0x5a8d3c[_0x989b('0x10')](','))))['toString']();}function handleStop(){logger[_0x989b('0x53')](_0x989b('0x54'));stopped=!![];}function handleUncaughtException(_0x138aad){logger[_0x989b('0x55')](_0x138aad[_0x989b('0x56')]);process['exit'](0x1);}function handleError(_0x1bfdc0,_0x3d19c3){stats[_0x989b('0x57')][_0x989b('0x18')]({'name':_0x3d19c3['code'],'message':_0x3d19c3[_0x989b('0x56')],'row':_0x1bfdc0});}function handleQuery(_0x5723bf){logger[_0x989b('0x53')](_0x5723bf);return db[_0x989b('0x58')][_0x989b('0x59')](_0x5723bf)['spread'](function(_0x105882){results['push'](_0x105882);})['catch'](function(_0x2c6d89){logger[_0x989b('0x55')](_0x2c6d89['message']);});}function updateTzCampaigns(_0x27eafc){return new Promise(function(_0x2a6a90,_0x445886){var _0x50f2d5=squel['select']()[_0x989b('0x3f')]([_0x989b('0x5a'),_0x989b('0x5b')])[_0x989b('0x40')](_0x989b('0x5c'))[_0x989b('0x10')](_0x989b('0x5d'),null,_0x989b('0x5e'))[_0x989b('0x12')](_0x989b('0x5f')+_0x27eafc);db[_0x989b('0x58')][_0x989b('0x59')](_0x50f2d5[_0x989b('0x3a')]())[_0x989b('0x60')](function(_0x288d6b){var _0x1a1317=[];for(var _0x3c76cb=0x0;_0x3c76cb<_0x288d6b[_0x989b('0x17')];_0x3c76cb++){_0x1a1317[_0x989b('0x18')](getTimezoneData(_0x288d6b[_0x3c76cb],tmp_campaigns));}BPromise['all'](_0x1a1317)[_0x989b('0x16')](function(){_0x2a6a90({'val':0x1});});})['catch'](function(_0x519827){logger[_0x989b('0x55')](_0x519827['message']);_0x2a6a90({'val':0x0});});});}function updateTzVoiceQueues(_0x522df3){return new Promise(function(_0xcf286a,_0x29205d){var _0x1f3155=squel[_0x989b('0xd')]()[_0x989b('0x3f')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0x989b('0x61'))[_0x989b('0x10')](_0x989b('0x62'),null,_0x989b('0x63'))[_0x989b('0x12')](_0x989b('0x64')+_0x522df3);db[_0x989b('0x58')][_0x989b('0x59')](_0x1f3155[_0x989b('0x3a')]())[_0x989b('0x60')](function(_0x20aa21){var _0x2446e5=[];for(var _0x183aea=0x0;_0x183aea<_0x20aa21[_0x989b('0x17')];_0x183aea++){_0x2446e5[_0x989b('0x18')](getTimezoneData(_0x20aa21[_0x183aea],tmp_voice_queues));}BPromise[_0x989b('0x19')](_0x2446e5)[_0x989b('0x16')](function(){_0xcf286a({'val':0x1});});})[_0x989b('0x65')](function(_0x134d1b){logger[_0x989b('0x55')](_0x134d1b['message']);_0xcf286a({'val':0x0});});});}function getTimezoneData(_0x58586d,_0x2a16d3){return new Promise(function(_0x57e0c8,_0xd575f9){var _0x555f25=shared[_0x989b('0x66')];var _0x42c520=_0x555f25[_0x58586d['dialTimezone']];if(_[_0x989b('0x67')](_0x42c520)){_0x57e0c8({'ret':0x1});}else{var _0x40e0c6=_0x42c520['utcOffset'];var _0x372ec7=squel['insert']()[_0x989b('0x28')](_0x2a16d3)['set']('id',_0x58586d['id'])[_0x989b('0x68')](_0x989b('0x69'),_0x40e0c6)[_0x989b('0x68')]('dialTimezone',_0x58586d[_0x989b('0x6a')])[_0x989b('0x3a')]();return db[_0x989b('0x58')][_0x989b('0x59')](_0x372ec7)[_0x989b('0x60')](function(_0x46928f){_0x57e0c8({'ret':0x1});})[_0x989b('0x65')](function(_0x347172){logger[_0x989b('0x55')](_0x347172['message']);_0xd575f9({'ret':0x1});});}});}function handleTZQuery(_0x5e45b7){logger['info'](_0x5e45b7);return db[_0x989b('0x58')]['query'](_0x5e45b7)['spread'](function(_0x2cb90c){})[_0x989b('0x65')](function(_0x2d57ec){logger['error'](_0x2d57ec[_0x989b('0x56')]);});}function main(_0x470c99,_0x521c4d,_0x2c6799,_0x3aa4ca){logger[_0x989b('0x53')](_0x989b('0x6b'),_0x470c99,JSON[_0x989b('0x6c')](_0x521c4d));process['send'](_0x989b('0x6d'));var _0x5baad9=_0x521c4d[_0x989b('0x6e')];var _0x28e622=_['clone'](_0x5baad9);var _0x626512=_0x521c4d[_0x989b('0x6f')];var _0x5b57ff=path[_0x989b('0x10')](config[_0x989b('0x70')],_0x989b('0x71'),_0x626512+_0x989b('0x72'));hasTZ=_[_0x989b('0x73')](_0x5baad9)[_0x989b('0x74')]('dialTimezone');var _0x432734=_[_0x989b('0x73')](_0x5baad9)['join']();logger['info'](_0x989b('0x75'),_0x432734);db['ContactItemType'][_0x989b('0x76')]({'raw':!![],'attributes':['id',_0x989b('0x77')]})[_0x989b('0x16')](function(_0x21c835){for(var _0x281f78=0x0;_0x281f78<_0x21c835[_0x989b('0x17')];_0x281f78++){if(_0x21c835[_0x281f78]['name']in _0x5baad9){contactItemTypes[_0x989b('0x18')](_0x21c835[_0x281f78]);delete _0x28e622[_0x21c835[_0x281f78]['name']];hasAdditionalPhones=!![];}for(var _0x41aab1 in _0x5baad9){if(_0x21c835[_0x281f78][_0x989b('0x77')]+_0x989b('0x78')===_0x41aab1){phoneDescriptions[_0x989b('0x18')]({'itemTypeId':_0x21c835[_0x281f78]['id'],'description':_0x41aab1});delete _0x28e622[_0x41aab1];}}}if(hasAdditionalPhones)_0x28e622[_0x989b('0x1a')]='';var _0x1dc110=_[_0x989b('0x73')](_0x28e622)[_0x989b('0x10')]();logger[_0x989b('0x53')](_0x989b('0x75'),_0x1dc110);fs['writeFileSync'](_0x5b57ff,_0x1dc110+'\x0a');Papa[_0x989b('0x79')](fs['createReadStream'](_0x470c99),{'header':!![],'skipEmptyLines':!![],'step':function(_0xabe682,_0x19697f){try{for(var _0x5d9916=0x0,_0x2fee89=[];_0x5d9916<_0xabe682[_0x989b('0x7a')][_0x989b('0x17')];_0x5d9916++){stats[_0x989b('0x7b')]+=0x1;if(_0xabe682[_0x989b('0x57')][_0x5d9916]){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],_0xabe682['errors'][_0x5d9916]);}else{var _0x3d9cb5=[];var _0x258d67=[];var _0xef8a98={};for(var _0x5351ae in _0x5baad9){let _0x21147e=contactItemTypes[_0x989b('0x7c')](_0xeac59d=>_0xeac59d[_0x989b('0x77')]===_0x5351ae);let _0x1ba03a=contactItemTypes['find'](_0x3b4876=>_0x3b4876[_0x989b('0x77')]+_0x989b('0x78')===_0x5351ae);if(_['isNil'](_0x21147e)&&_[_0x989b('0x67')](_0x1ba03a)){if(_0x5baad9[_0x989b('0x7d')](_0x5351ae)){if(_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]]){var _0x110dab=_['trim'](_0xabe682['data'][_0x5d9916][_0x5baad9[_0x5351ae]][_0x989b('0x7e')](/"/g,'\x27'));switch(_0x5351ae){case _0x989b('0x2b'):var _0x4d25f9=moment(_0x110dab,_0x989b('0x7f'),!![]);if(_0x4d25f9[_0x989b('0x80')]()){_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5[_0x989b('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x989b('0x2f'):var _0x29433f=parseInt(_0x110dab);_0x110dab=_[_0x989b('0x81')](_0x29433f)||_0x29433f<0x0||_0x29433f>0x4?_0x3aa4ca?0x3:0x2:_0x29433f;_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');break;case'UserId':var _0x11fdc2=parseInt(_0x110dab);if(_[_0x989b('0x82')](_0x11fdc2)&&_[_0x989b('0x74')](_0x2c6799,_0x11fdc2)){_0x2fee89[_0x989b('0x18')]('\x22'+_0x11fdc2+'\x22');}else{_0x3d9cb5['push'](_0x989b('0x83'));}break;case _0x989b('0x84'):if(isEmail(_0x110dab)){_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5[_0x989b('0x18')]('email\x20wrong\x20format');}break;case _0x989b('0x85'):var _0x450757=moment(_0x110dab,_0x989b('0x86'),!![]);if(_0x450757[_0x989b('0x80')]()){_0x2fee89['push']('\x22'+_0x110dab+'\x22');}else{_0x3d9cb5['push'](_0x989b('0x87'));}break;case'dialTimezone':var _0x4bf4ad=shared[_0x989b('0x66')];var _0x35c922=_0x4bf4ad[_0x110dab];if(!_[_0x989b('0x67')](_0x35c922)){var _0x2d5530=_0x35c922[_0x989b('0x88')];_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');_0x2fee89['push']('\x22'+_0x2d5530+'\x22');}break;default:_0x2fee89[_0x989b('0x18')]('\x22'+_0x110dab+'\x22');}}else{switch(_0x5351ae){case _0x989b('0x89'):case _0x989b('0xf'):_0x3d9cb5[_0x989b('0x18')](_0x5351ae+_0x989b('0x8a'));break;default:_0x2fee89[_0x989b('0x18')]('\x22\x22');}}}}else{var _0x43c3bc='';if(!_[_0x989b('0x67')](_0x21147e)){if(!_0xef8a98[_0x989b('0x7d')](_0x21147e['id'])){if(!_[_0x989b('0x67')](_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]])){var _0x110dab=_[_0x989b('0x8b')](_0xabe682[_0x989b('0x7a')][_0x5d9916][_0x5baad9[_0x5351ae]][_0x989b('0x7e')](/"/g,'\x27'));var _0x2d64d1=phoneDescriptions['find'](_0x147517=>_0x147517[_0x989b('0x8c')]===_0x21147e['id']);if(!_[_0x989b('0x67')](_0x2d64d1)){var _0x2d5cc6=_['trim'](_0xabe682['data'][_0x5d9916][_0x5baad9[_0x2d64d1['description']]]['replace'](/"/g,'\x27'));if(!_[_0x989b('0x67')](_0x2d5cc6))_0x110dab=_0x110dab+'§'+_0x2d5cc6;}if(_0x43c3bc=='')_0x43c3bc=_0x110dab;else _0x43c3bc+='|'+_0x110dab;}_0x258d67[_0x989b('0x18')](_0x21147e['id']+':'+_0x43c3bc);_0xef8a98[_0x21147e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2fee89[_0x989b('0x18')]('\x22'+_0x258d67[_0x989b('0x10')](';')+'\x22');}if(_0x3d9cb5['length']){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],{'code':'SystemRow','message':_0x3d9cb5[_0x989b('0x10')]()});}else{fs['appendFileSync'](_0x5b57ff,_0x2fee89[_0x989b('0x10')]()+'\x0a');}_0x2fee89=[];}if(!(stats[_0x989b('0x7b')]%0xc8)){socket[_0x989b('0x8d')](_0x989b('0x8e')+_0x626512,stats);stats[_0x989b('0x57')]=[];}}if(stopped){logger[_0x989b('0x53')](_0x989b('0x8f'));_0x19697f[_0x989b('0x90')]();}}catch(_0x3f3c48){handleError(_0xabe682[_0x989b('0x7a')][_0x5d9916],{'code':_0x989b('0x91'),'message':_0x3f3c48[_0x989b('0x56')]});logger[_0x989b('0x55')](_0x989b('0x92'),_0x3f3c48[_0x989b('0x56')]);}},'complete':function(){try{var _0x3b879d=[];var _0x5006bc=[];var _0x1f0b70=_0x989b('0x32');if(_0x521c4d[_0x989b('0x93')]&&_0x521c4d[_0x989b('0x93')]['length']){_0x1f0b70=_0x989b('0x94')+_0x626512;_0x3b879d[_0x989b('0x18')]('CREATE\x20TABLE\x20'+_0x1f0b70+_0x989b('0x95'));}tmp_campaigns=_0x989b('0x96')+_0x626512;tmp_voice_queues=_0x989b('0x97')+_0x626512;_0x5006bc[_0x989b('0x18')](_0x989b('0x98')+tmp_campaigns+_0x989b('0x99'));_0x5006bc['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x989b('0x99'));BPromise[_0x989b('0x9a')](_0x5006bc,handleTZQuery)['then'](function(_0x32a8c4){updateTzCampaigns(_0x521c4d[_0x989b('0x2d')])['then'](function(_0x68f6a9){updateTzVoiceQueues(_0x521c4d[_0x989b('0x2d')])['then'](function(_0x400985){if(hasTZ)_0x1dc110=_0x1dc110[_0x989b('0x7e')](_0x989b('0x6a'),_0x989b('0x9b'));var _0x44d7f2=util[_0x989b('0xb')](_0x989b('0x9c'),_0x5b57ff,_0x1f0b70,_0x1dc110,_0x521c4d[_0x989b('0x2d')],_0x521c4d['CompanyId']||null,NOW,NOW);if(_[_0x989b('0x67')](_0x5baad9[_0x989b('0x2b')])){_0x44d7f2+=_0x989b('0x9d');}_0x3b879d[_0x989b('0x18')](_0x44d7f2);if(_0x521c4d[_0x989b('0x93')]&&_0x521c4d['duplicates'][_0x989b('0x17')]){_0x3b879d['push'](insertCmContact(_0x521c4d[_0x989b('0x2d')],_0x1f0b70,_0x521c4d['duplicates'],_0x5baad9));_0x3b879d[_0x989b('0x18')](_0x989b('0x9e')+_0x1f0b70+';');}BPromise['each'](_0x3b879d,handleQuery)[_0x989b('0x16')](function(_0x9b95cf){BPromise['all']([handleAdditionalPhones()])[_0x989b('0x16')](function(){_0x3b879d=[];for(var _0x38b849=0x0;_0x38b849_0x5dd156[_0x4c22('0x68')]===_0xfd519);let _0x329c7f=contactItemTypes['find'](_0x5c6a0a=>_0x5c6a0a[_0x4c22('0x68')]+'_description'===_0xfd519);if(_[_0x4c22('0x1d')](_0x5c1797)&&_[_0x4c22('0x1d')](_0x329c7f)){if(_0x5f19be[_0x4c22('0x70')](_0xfd519)){if(_0x48ad14['data'][_0x1baef7][_0x5f19be[_0xfd519]]){var _0x5f0626=_['trim'](_0x48ad14[_0x4c22('0x6d')][_0x1baef7][_0x5f19be[_0xfd519]][_0x4c22('0x71')](/"/g,'\x27'));switch(_0xfd519){case _0x4c22('0x34'):var _0x5e50e9=moment(_0x5f0626,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5e50e9[_0x4c22('0x72')]()){_0x1299f2['push']('\x22'+_0x5f0626+'\x22');}else{_0x15f320[_0x4c22('0x1f')](_0x4c22('0x73'));}break;case _0x4c22('0x74'):var _0x1db2fb=parseInt(_0x5f0626);_0x5f0626=_['isNaN'](_0x1db2fb)||_0x1db2fb<0x0||_0x1db2fb>0x4?_0x3757c7?0x3:0x2:_0x1db2fb;_0x1299f2['push']('\x22'+_0x5f0626+'\x22');break;case _0x4c22('0x75'):var _0x424fda=parseInt(_0x5f0626);if(_[_0x4c22('0x76')](_0x424fda)&&_['includes'](_0x1369f0,_0x424fda)){_0x1299f2['push']('\x22'+_0x424fda+'\x22');}else{_0x15f320[_0x4c22('0x1f')](_0x4c22('0x77'));}break;case _0x4c22('0x78'):if(isEmail(_0x5f0626)){_0x1299f2[_0x4c22('0x1f')]('\x22'+_0x5f0626+'\x22');}else{_0x15f320[_0x4c22('0x1f')](_0x4c22('0x79'));}break;case _0x4c22('0x7a'):var _0x457600=moment(_0x5f0626,_0x4c22('0x7b'),!![]);if(_0x457600[_0x4c22('0x72')]()){_0x1299f2[_0x4c22('0x1f')]('\x22'+_0x5f0626+'\x22');}else{_0x15f320[_0x4c22('0x1f')](_0x4c22('0x7c'));}break;default:_0x1299f2[_0x4c22('0x1f')]('\x22'+_0x5f0626+'\x22');}}else{switch(_0xfd519){case _0x4c22('0x7d'):case _0x4c22('0x13'):_0x15f320[_0x4c22('0x1f')](_0xfd519+'\x20not\x20specified');break;default:_0x1299f2[_0x4c22('0x1f')]('\x22\x22');}}}}else{var _0x3b1761='';if(!_[_0x4c22('0x1d')](_0x5c1797)){if(!_0x45e4d9[_0x4c22('0x70')](_0x5c1797['id'])){for(var _0x1dd348=0x0;_0x1dd348<_0x5f19be[_0xfd519]['length'];_0x1dd348++){var _0x5f0626=_[_0x4c22('0x7e')](_0x48ad14['data'][_0x1baef7][_0x5f19be[_0xfd519][_0x1dd348]][_0x4c22('0x71')](/"/g,'\x27'));var _0x25cf2a=phoneDescriptions['find'](_0x55a9ab=>_0x55a9ab['itemTypeId']===_0x5c1797['id']);if(!_[_0x4c22('0x1d')](_0x25cf2a)){var _0x5e9915=_[_0x4c22('0x7e')](_0x48ad14[_0x4c22('0x6d')][_0x1baef7][_0x5f19be[_0x25cf2a[_0x4c22('0x7f')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x4c22('0x1d')](_0x5e9915))_0x5f0626=_0x5f0626+'§'+_0x5e9915;}if(_0x3b1761=='')_0x3b1761=_0x5f0626;else _0x3b1761+='|'+_0x5f0626;}_0x56a46f[_0x4c22('0x1f')](_0x5c1797['id']+':'+_0x3b1761);_0x45e4d9[_0x5c1797['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1299f2[_0x4c22('0x1f')]('\x22'+_0x56a46f[_0x4c22('0x15')](';')+'\x22');}if(_0x15f320[_0x4c22('0x1c')]){handleError(_0x48ad14[_0x4c22('0x6d')][_0x1baef7],{'code':'SystemRow','message':_0x15f320[_0x4c22('0x15')]()});}else{fs[_0x4c22('0x80')](_0x458891,_0x1299f2[_0x4c22('0x15')]()+'\x0a');}_0x1299f2=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x4c22('0x81')+_0x265916,stats);stats[_0x4c22('0x5d')]=[];}}if(stopped){logger[_0x4c22('0x5a')](_0x4c22('0x82'));_0x725d8c[_0x4c22('0x83')]();}}catch(_0x138ab4){handleError(_0x48ad14[_0x4c22('0x6d')][_0x1baef7],{'code':_0x4c22('0x84'),'message':_0x138ab4[_0x4c22('0x24')]});logger[_0x4c22('0x23')](_0x4c22('0x85'),_0x138ab4[_0x4c22('0x24')]);}},'complete':function(){try{var _0x3fc987=[];var _0x128e1d=tempTableName;_0x3fc987['push'](_0x4c22('0x86')+_0x128e1d+_0x4c22('0x87'));logger['info'](_0x4c22('0x88'),contactItemTypes[_0x4c22('0x1c')]);var _0x406067=util[_0x4c22('0xc')](_0x4c22('0x89'),_0x458891,_0x128e1d,_0x9dfc22,_0x545328[_0x4c22('0x45')],_0x545328[_0x4c22('0x55')]||null,NOW,NOW);if(_[_0x4c22('0x1d')](_0x5f19be['scheduledat'])){_0x406067+=_0x4c22('0x8a');}_0x3fc987[_0x4c22('0x1f')](_0x406067);BPromise[_0x4c22('0x8b')](_0x3fc987,handleQuery)[_0x4c22('0x21')](function(_0x579b55){BPromise[_0x4c22('0x20')]([handleAdditionalPhones()])['then'](function(){_0x3fc987=[];for(var _0x3316e6=0x0;_0x3316e6\x20\x20');}var _0x422b8c=path[_0x4c22('0x15')](config[_0x4c22('0x94')],_0x4c22('0x95'),process[_0x4c22('0x93')][0x2]);if(!fs[_0x4c22('0x96')](_0x422b8c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x294737={};try{_0x294737=JSON[_0x4c22('0x6b')](process[_0x4c22('0x93')][0x3]);if(!_0x294737[_0x4c22('0x97')]){throw new Error(_0x4c22('0x98'));}var _0x2938b4=0x0;if(_0x294737[_0x4c22('0x97')]['UserId']){_0x2938b4=0x1;}if(!_0x294737[_0x4c22('0x45')]){throw new Error(_0x4c22('0x99'));}}catch(_0x46fd75){throw new Error(_0x4c22('0x9a'));}var _0x218397=[];try{_0x218397=_[_0x4c22('0x9b')](JSON[_0x4c22('0x6b')](process['argv'][0x4]),'id');}catch(_0x2896c3){logger[_0x4c22('0x5a')](_0x4c22('0x9c'));}main(_0x422b8c,_0x294737,_0x218397,_0x2938b4);}validate();process['on']('SIGINT',handleStop);process['on'](_0x4c22('0x9d'),handleUncaughtException); \ No newline at end of file +var _0xbaf7=['file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','createdAt','.CmListId\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','into','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','fields','MIN(id)','min_id','group','info','message','code','main','stringify','start','binding','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','errors','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','description','SystemRow','appendFileSync','emit','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync'];(function(_0x3332c4,_0x475b4f){var _0x4c8d92=function(_0x428db6){while(--_0x428db6){_0x3332c4['push'](_0x3332c4['shift']());}};_0x4c8d92(++_0x475b4f);}(_0xbaf7,0x137));var _0x7baf=function(_0xf1fb44,_0x20e887){_0xf1fb44=_0xf1fb44-0x0;var _0x1d4d36=_0xbaf7[_0xf1fb44];return _0x1d4d36;};'use strict';var fs=require('fs');var path=require(_0x7baf('0x0'));var _=require(_0x7baf('0x1'));var Papa=require(_0x7baf('0x2'));var util=require(_0x7baf('0x3'));var BPromise=require(_0x7baf('0x4'));var moment=require('moment');var squel=require(_0x7baf('0x5'));var Redis=require(_0x7baf('0x6'));var db=require(_0x7baf('0x7'))['db'];var config=require(_0x7baf('0x8'));var logger=require(_0x7baf('0x9'))(_0x7baf('0xa'));config[_0x7baf('0xb')]=_['defaults'](config[_0x7baf('0xb')],{'host':_0x7baf('0xc'),'port':0x18eb});var socket=require(_0x7baf('0xd'))(new Redis(config[_0x7baf('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x7baf('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x7baf('0xe')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1e472a){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'](_0x1e472a);}function selectNotIn(_0x59303b,_0x1dd133,_0x1dadf8,_0x1d09c3,_0x48cf41){return squel[_0x7baf('0xf')]()[_0x7baf('0x10')](_0x7baf('0x11'))[_0x7baf('0x12')](_0x1d09c3)[_0x7baf('0x13')](_0x1dd133,null,_0x1dd133+_0x7baf('0x14')+_0x1d09c3+'.'+_0x1dadf8)[_0x7baf('0x15')](_0x1d09c3+'.'+_0x1dadf8+_0x7baf('0x16')+_0x59303b+'.'+_0x1dadf8)['where'](_0x1dd133+_0x7baf('0x17')+_0x48cf41['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x38df2e,_0x3be400){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7baf('0x18')]['query'](_0x7baf('0x19')+tempTableName)[_0x7baf('0x1a')](function(_0x2bacad){if(_0x2bacad!==null){var _0x3b70fd=[];for(var _0x4748ca=0x0;_0x4748ca<_0x2bacad[_0x7baf('0x1b')];_0x4748ca++){var _0x184aa5=_0x2bacad[_0x4748ca];if(!_[_0x7baf('0x1c')](_0x184aa5[_0x7baf('0x11')])){if(!_[_0x7baf('0x1c')](_0x184aa5[_0x7baf('0x1d')]))_0x3b70fd[_0x7baf('0x1e')](insertAdditionalPhones(_0x184aa5));promisesContact[_0x7baf('0x1e')]({'contact':_0x184aa5});}}}Promise[_0x7baf('0x1f')](_0x3b70fd)[_0x7baf('0x20')](function(){_0x38df2e({'val':0x1});});})[_0x7baf('0x21')](function(_0x33c58e){logger[_0x7baf('0x22')](_0x33c58e['message']);});});}function insertAdditionalPhones(_0x9a8f82){return new Promise(function(_0x4cb942,_0x4800c4){var _0x3428a4=_0x9a8f82[_0x7baf('0x1d')];if(_[_0x7baf('0x1c')](_0x3428a4))_0x4800c4({'val':0x0});else{var _0xaca134=_0x3428a4[_0x7baf('0x23')](';');var _0xd324a=[];orderBy=0x0;for(var _0x341dbd=0x0;_0x341dbd<_0xaca134[_0x7baf('0x1b')];_0x341dbd++){_0xd324a[_0x7baf('0x1e')](splitAdditionalPhone(_0x9a8f82['id'],_0xaca134[_0x341dbd]));}Promise['all'](_0xd324a)['then'](function(){_0x4cb942({'val':_0xaca134[_0x7baf('0x1b')]});});}});}function splitAdditionalPhone(_0x485171,_0x15eb2a){return new Promise(function(_0x116224,_0xa4bfad){var _0x594094=_0x15eb2a[_0x7baf('0x23')](':');var _0x5cedc5=_0x594094[0x0];var _0x3a7691=_0x594094[0x1];if(_0x3a7691!==''){var _0x539ebf=_0x3a7691[_0x7baf('0x23')]('|');var _0x4f1d52=[];for(var _0x4d64e5=0x0;_0x4d64e5<_0x539ebf[_0x7baf('0x1b')];_0x4d64e5++){if(_0x539ebf[_0x4d64e5]!==''){var _0x5b9c9c=_[_0x7baf('0x24')](promisesAdditionalPhones,{'contactId':_0x485171,'phone':_0x539ebf[_0x4d64e5]});if(_0x5b9c9c[_0x7baf('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x7baf('0x1e')]({'contactId':_0x485171,'contactTypeId':_0x5cedc5,'phone':_0x539ebf[_0x4d64e5],'orderBy':orderBy});}}}_0x116224({'ok':0x1});}else _0x116224({'res':0x0});});}function createAdditionalPhone(_0x1cf5be,_0x1c9f3d,_0x415484,_0x144e9c){var _0x4b0b3b='';var _0x267809='';var _0x34bfd8=_0x415484[_0x7baf('0x23')]('§');_0x4b0b3b=_0x34bfd8[0x0];if(_0x34bfd8[_0x7baf('0x1b')]==0x2)_0x267809=_0x34bfd8[0x1];return new Promise(function(_0x16f8fb,_0x363080){return db[_0x7baf('0x25')][_0x7baf('0x26')]({'where':{'CmContactId':_0x1cf5be,'item':_0x4b0b3b}})[_0x7baf('0x20')](function(_0x54943e){if(_0x54943e){return db[_0x7baf('0x25')][_0x7baf('0x27')]({'ItemTypeId':_0x1c9f3d,'description':_0x267809,'OrderBy':_0x144e9c},{'where':{'CmContactId':_0x1cf5be,'item':_0x4b0b3b}})[_0x7baf('0x20')](function(_0xe3e562){_0x16f8fb({'res':_0x7baf('0x28')});});}else{return db[_0x7baf('0x25')]['create']({'CmContactId':_0x1cf5be,'item':_0x4b0b3b,'ItemTypeId':_0x1c9f3d,'description':_0x267809,'OrderBy':_0x144e9c,'ItemClass':_0x7baf('0x29')})[_0x7baf('0x20')](function(_0x4cf568){_0x16f8fb({'res':_0x7baf('0x2a')});});}});});}function updateContact(_0xddaebf){return new Promise(function(_0x335f97,_0x29da9d){var _0x5898a0=_0xddaebf['id'];delete _0xddaebf['id'];return db[_0x7baf('0x2b')][_0x7baf('0x27')](_0xddaebf,{'where':{'id':_0x5898a0}})[_0x7baf('0x20')](function(_0x39c124){updatedRows+=0x1;return db['CmHopper'][_0x7baf('0x27')]({'phone':_0xddaebf['phone']},{'where':{'ContactId':_0x5898a0}})[_0x7baf('0x20')](function(_0x42d1a3){_0x335f97({'ret':'OK'});});});});}function insertCmHopper(_0x2c9256,_0x480e6d,_0x40fcdd,_0x5893ac,_0x45b29c){var _0x4a07cc=[_0x7baf('0x2c'),_0x7baf('0x2d'),_0x7baf('0x2e'),_0x7baf('0x2f'),_0x480e6d+'.'+_0x5893ac,_0x7baf('0x30'),_0x7baf('0x31'),_0x7baf('0x32'),'cm_contacts.UserId','\x22'+_0x45b29c+'\x22'];return squel[_0x7baf('0x33')]()['into'](_0x7baf('0x34'))['fromQuery']([_0x7baf('0x11'),_0x7baf('0x35'),_0x7baf('0x36'),_0x7baf('0x37'),_0x5893ac,'createdAt',_0x7baf('0x38'),_0x7baf('0x39'),_0x7baf('0x3a'),_0x7baf('0x3b')],squel[_0x7baf('0xf')]()['fields'](_0x4a07cc)[_0x7baf('0x12')](_0x480e6d)[_0x7baf('0x13')](_0x7baf('0x3c'),null,_0x7baf('0x3d')+_0x480e6d+_0x7baf('0x3e'))[_0x7baf('0x13')](_0x40fcdd,null,_0x40fcdd+'.id\x20=\x20'+_0x480e6d+'.'+_0x5893ac)['where'](_0x480e6d+'.CmListId\x20=\x20?',_0x2c9256)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW)[_0x7baf('0x15')](_0x7baf('0x40'),selectNotIn(_0x480e6d,_0x40fcdd,_0x5893ac,_0x7baf('0x34'),[_0x7baf('0x41'),_0x7baf('0x42')]))['where'](_0x7baf('0x40'),selectNotIn(_0x480e6d,_0x40fcdd,_0x5893ac,'cm_hopper',[_0x7baf('0x41')])))[_0x7baf('0x43')]();}function insertCmHopperBlack(_0xa98a9b,_0x4793c7,_0x5f0326,_0x2f225e){var _0x273b43=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x4793c7+'.'+_0x2f225e,'cm_contacts.createdAt',_0x7baf('0x31')];return squel[_0x7baf('0x33')]()['into'](_0x7baf('0x44'))[_0x7baf('0x45')](['phone','ContactId','ListId',_0x2f225e,_0x7baf('0x46'),_0x7baf('0x38')],squel[_0x7baf('0xf')]()['fields'](_0x273b43)[_0x7baf('0x12')](_0x4793c7)['join'](_0x7baf('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x4793c7+_0x7baf('0x3e'))[_0x7baf('0x13')](_0x5f0326,null,_0x5f0326+'.id\x20=\x20'+_0x4793c7+'.'+_0x2f225e)[_0x7baf('0x15')](_0x4793c7+_0x7baf('0x47'),_0xa98a9b)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW)[_0x7baf('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7baf('0x10')]('phone')[_0x7baf('0x12')](_0x7baf('0x44'))[_0x7baf('0x15')](_0x7baf('0x48'),_0xa98a9b)[_0x7baf('0x15')](_0x2f225e+'\x20=\x20?',_0x4793c7+'.'+_0x2f225e)))[_0x7baf('0x43')]();}function insertCmHopperAdditionalPhones(_0x4ab023){var _0x20628d=[_0x7baf('0x49'),_0x7baf('0x4a'),_0x7baf('0x4b'),_0x7baf('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x7baf('0x33')]()[_0x7baf('0x4d')](_0x7baf('0x4e'))['fromQuery']([_0x7baf('0x4f'),_0x7baf('0x11'),'OrderBy',_0x7baf('0x46'),_0x7baf('0x38')],squel['select']()['fields'](_0x20628d)[_0x7baf('0x12')](_0x7baf('0x34'))[_0x7baf('0x13')](_0x7baf('0x3c'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x7baf('0x50'))[_0x7baf('0x15')](_0x7baf('0x51'),_0x4ab023)[_0x7baf('0x15')](_0x7baf('0x3f'),NOW))[_0x7baf('0x43')]();}function insertCmContact(_0x41d022,_0x1fb86f,_0x42ca0d,_0x788c5d){var _0x142a55=_[_0x7baf('0x52')](_[_0x7baf('0x53')](_0x788c5d),[_0x7baf('0x37'),_0x7baf('0x54'),_0x7baf('0x46'),_0x7baf('0x38')]);return squel['insert']()['into'](_0x7baf('0x3c'))[_0x7baf('0x45')](_0x142a55,squel['select']()['fields'](_0x142a55)[_0x7baf('0x12')](_0x1fb86f)[_0x7baf('0x15')]('('+_0x42ca0d['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x7baf('0xf')]()[_0x7baf('0x55')](_0x42ca0d)['from']('cm_contacts')['where']('ListId\x20=\x20?',_0x41d022))[_0x7baf('0x15')]('id\x20IN\x20?',squel[_0x7baf('0xf')]()[_0x7baf('0x10')](_0x7baf('0x56'),_0x7baf('0x57'))['from'](_0x1fb86f)[_0x7baf('0x58')](_0x42ca0d['join'](','))))[_0x7baf('0x43')]();}function handleStop(){logger[_0x7baf('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x393e78){logger['error'](_0x393e78[_0x7baf('0x5a')]);process['exit'](0x1);}function handleError(_0x7ae1d5,_0x3b82a5){stats['errors'][_0x7baf('0x1e')]({'name':_0x3b82a5[_0x7baf('0x5b')],'message':_0x3b82a5[_0x7baf('0x5a')],'row':_0x7ae1d5});}function handleQuery(_0x280c87){logger['info'](_0x280c87);return db['sequelize']['query'](_0x280c87)[_0x7baf('0x1a')](function(_0x6fd6c2){results['push'](_0x6fd6c2);})['catch'](function(_0x5dc42d){logger[_0x7baf('0x22')](_0x5dc42d[_0x7baf('0x5a')]);});}function main(_0x39bee7,_0x300248,_0x331781,_0x111321){logger['info'](_0x7baf('0x5c'),_0x39bee7,JSON[_0x7baf('0x5d')](_0x300248));process['send'](_0x7baf('0x5e'));var _0x415003=_0x300248[_0x7baf('0x5f')];var _0x2730f2=_['clone'](_0x415003);var _0xa0c0c4=_0x300248['socket_timestamp'];var _0x12a030=path[_0x7baf('0x13')](config[_0x7baf('0x60')],_0x7baf('0x61'),_0xa0c0c4+_0x7baf('0x62'));logger[_0x7baf('0x59')](_0x7baf('0x63'),_0x300248);db[_0x7baf('0x64')][_0x7baf('0x65')]({'raw':!![],'attributes':['id',_0x7baf('0x66')]})[_0x7baf('0x20')](function(_0x570a9b){for(var _0x2cca09=0x0;_0x2cca09<_0x570a9b[_0x7baf('0x1b')];_0x2cca09++){if(_0x570a9b[_0x2cca09][_0x7baf('0x66')]in _0x415003){contactItemTypes['push'](_0x570a9b[_0x2cca09]);delete _0x2730f2[_0x570a9b[_0x2cca09][_0x7baf('0x66')]];hasAdditionalPhones=!![];}for(var _0x26560a in _0x415003){if(_0x570a9b[_0x2cca09][_0x7baf('0x66')]+_0x7baf('0x67')===_0x26560a){phoneDescriptions[_0x7baf('0x1e')]({'itemTypeId':_0x570a9b[_0x2cca09]['id'],'description':_0x26560a});delete _0x2730f2[_0x26560a];}}}if(hasAdditionalPhones)_0x2730f2[_0x7baf('0x1d')]='';var _0x5da221=_[_0x7baf('0x53')](_0x2730f2)[_0x7baf('0x13')]();logger[_0x7baf('0x59')]('header',_0x5da221);fs['writeFileSync'](_0x12a030,_0x5da221+'\x0a');Papa[_0x7baf('0x68')](fs[_0x7baf('0x69')](_0x39bee7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x44c330,_0x2f862d){try{for(var _0x499dda=0x0,_0x1bf0c3=[];_0x499dda<_0x44c330[_0x7baf('0x6a')]['length'];_0x499dda++){stats[_0x7baf('0x6b')]+=0x1;if(_0x44c330['errors'][_0x499dda]){handleError(_0x44c330[_0x7baf('0x6a')][_0x499dda],_0x44c330[_0x7baf('0x6c')][_0x499dda]);}else{var _0x208fd6=[];var _0x3c3ab4=[];var _0x1a8eb0={};for(var _0x1dbbe6 in _0x415003){let _0x172661=contactItemTypes[_0x7baf('0x6d')](_0x41682a=>_0x41682a[_0x7baf('0x66')]===_0x1dbbe6);let _0x53bb0b=contactItemTypes[_0x7baf('0x6d')](_0x4005e8=>_0x4005e8[_0x7baf('0x66')]+_0x7baf('0x67')===_0x1dbbe6);if(_[_0x7baf('0x1c')](_0x172661)&&_[_0x7baf('0x1c')](_0x53bb0b)){if(_0x415003['hasOwnProperty'](_0x1dbbe6)){if(_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x1dbbe6]]){var _0x4fce7f=_[_0x7baf('0x6e')](_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x1dbbe6]][_0x7baf('0x6f')](/"/g,'\x27'));switch(_0x1dbbe6){case'scheduledat':var _0x238c23=moment(_0x4fce7f,_0x7baf('0x70'),!![]);if(_0x238c23[_0x7baf('0x71')]()){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x72'));}break;case'priority':var _0x5c8210=parseInt(_0x4fce7f);_0x4fce7f=_[_0x7baf('0x73')](_0x5c8210)||_0x5c8210<0x0||_0x5c8210>0x4?_0x111321?0x3:0x2:_0x5c8210;_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');break;case'UserId':var _0x486b69=parseInt(_0x4fce7f);if(_[_0x7baf('0x74')](_0x486b69)&&_[_0x7baf('0x75')](_0x331781,_0x486b69)){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x486b69+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x76'));}break;case _0x7baf('0x77'):if(isEmail(_0x4fce7f)){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6[_0x7baf('0x1e')](_0x7baf('0x78'));}break;case _0x7baf('0x79'):var _0x5af0b2=moment(_0x4fce7f,_0x7baf('0x7a'),!![]);if(_0x5af0b2[_0x7baf('0x71')]()){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}else{_0x208fd6['push'](_0x7baf('0x7b'));}break;default:_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x4fce7f+'\x22');}}else{switch(_0x1dbbe6){case'firstName':case'phone':_0x208fd6['push'](_0x1dbbe6+_0x7baf('0x7c'));break;default:_0x1bf0c3[_0x7baf('0x1e')]('\x22\x22');}}}}else{var _0x18d5da='';if(!_[_0x7baf('0x1c')](_0x172661)){if(!_0x1a8eb0[_0x7baf('0x7d')](_0x172661['id'])){for(var _0x2b5c1e=0x0;_0x2b5c1e<_0x415003[_0x1dbbe6][_0x7baf('0x1b')];_0x2b5c1e++){var _0x4fce7f=_[_0x7baf('0x6e')](_0x44c330['data'][_0x499dda][_0x415003[_0x1dbbe6][_0x2b5c1e]][_0x7baf('0x6f')](/"/g,'\x27'));var _0x2b801c=phoneDescriptions[_0x7baf('0x6d')](_0x2d3cf0=>_0x2d3cf0['itemTypeId']===_0x172661['id']);if(!_[_0x7baf('0x1c')](_0x2b801c)){var _0x3a7702=_[_0x7baf('0x6e')](_0x44c330[_0x7baf('0x6a')][_0x499dda][_0x415003[_0x2b801c[_0x7baf('0x7e')]][0x0]][_0x7baf('0x6f')](/"/g,'\x27'));if(!_[_0x7baf('0x1c')](_0x3a7702))_0x4fce7f=_0x4fce7f+'§'+_0x3a7702;}if(_0x18d5da=='')_0x18d5da=_0x4fce7f;else _0x18d5da+='|'+_0x4fce7f;}_0x3c3ab4['push'](_0x172661['id']+':'+_0x18d5da);_0x1a8eb0[_0x172661['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bf0c3[_0x7baf('0x1e')]('\x22'+_0x3c3ab4[_0x7baf('0x13')](';')+'\x22');}if(_0x208fd6[_0x7baf('0x1b')]){handleError(_0x44c330['data'][_0x499dda],{'code':_0x7baf('0x7f'),'message':_0x208fd6['join']()});}else{fs[_0x7baf('0x80')](_0x12a030,_0x1bf0c3[_0x7baf('0x13')]()+'\x0a');}_0x1bf0c3=[];}if(!(stats[_0x7baf('0x6b')]%0xc8)){socket[_0x7baf('0x81')]('contact:import:'+_0xa0c0c4,stats);stats[_0x7baf('0x6c')]=[];}}if(stopped){logger[_0x7baf('0x59')]('Abort\x20parser');_0x2f862d[_0x7baf('0x82')]();}}catch(_0x53fe1c){handleError(_0x44c330[_0x7baf('0x6a')][_0x499dda],{'code':_0x7baf('0x83'),'message':_0x53fe1c[_0x7baf('0x5a')]});logger[_0x7baf('0x22')](_0x7baf('0x84'),_0x53fe1c['message']);}},'complete':function(){try{var _0x3b6cf0=[];var _0x599487=tempTableName;_0x3b6cf0[_0x7baf('0x1e')](_0x7baf('0x85')+_0x599487+'\x20LIKE\x20cm_contacts;');logger['info'](_0x7baf('0x86'),contactItemTypes[_0x7baf('0x1b')]);var _0x2bf60f=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x12a030,_0x599487,_0x5da221,_0x300248[_0x7baf('0x37')],_0x300248[_0x7baf('0x54')]||null,NOW,NOW);if(_[_0x7baf('0x1c')](_0x415003['scheduledat'])){_0x2bf60f+=_0x7baf('0x87');}_0x3b6cf0['push'](_0x2bf60f);BPromise[_0x7baf('0x88')](_0x3b6cf0,handleQuery)['then'](function(_0x30b9a9){BPromise[_0x7baf('0x1f')]([handleAdditionalPhones()])['then'](function(){_0x3b6cf0=[];for(var _0x23d115=0x0;_0x23d115\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_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','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.ContactId','i.UserId','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','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','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)'];(function(_0x303e91,_0x3ed9fd){var _0x52da5f=function(_0x4f8286){while(--_0x4f8286){_0x303e91['push'](_0x303e91['shift']());}};_0x52da5f(++_0x3ed9fd);}(_0x8240,0x151));var _0x0824=function(_0x10edeb,_0x1b93b8){_0x10edeb=_0x10edeb-0x0;var _0x1c5fea=_0x8240[_0x10edeb];return _0x1c5fea;};'use strict';var _=require('lodash');var squel=require(_0x0824('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x0824('0x1'));var updateInteraction=require(_0x0824('0x2'))['updateInteraction'];var utils=require('./utils');var db=require(_0x0824('0x3'))['db'];function skipInteractionsQuery(_0xc098a,_0x1319a0,_0x1c3d04){var _0x186f6b=![];var _0x131f0a=utils[_0x0824('0x4')](_0xc098a);if(_0x1319a0[_0x0824('0x5')]===_0x0824('0x6')&&!_0x1c3d04[_0x0824('0x7')]&&!_0x1c3d04[_0x131f0a]){_0x186f6b=!![];}return _0x186f6b;}function getTagsQuery(){return squel[_0x0824('0x8')]()[_0x0824('0x9')]('id')[_0x0824('0x9')](_0x0824('0xa'))['field']('color')[_0x0824('0xb')]('tools_tags');}function getUsersQuery(_0x52b875,_0x4911fd){var _0x3c55ec=utils[_0x0824('0xc')](_0x52b875);var _0x2ca469='user_has_'+_0x52b875+_0x0824('0xd');var _0x3efc85=squel[_0x0824('0x8')]()['field'](_0x0824('0xe'))[_0x0824('0x9')](_0x0824('0xf'))['field'](_0x0824('0x10')+_0x3c55ec)[_0x0824('0xb')](_0x2ca469,'ui')['left_join']('users','u',_0x0824('0x11'));if(_0x4911fd[_0x0824('0x12')]>0x0){_0x3efc85[_0x0824('0x13')](_0x0824('0x10')+_0x3c55ec+_0x0824('0x14'),_[_0x0824('0x15')](_0x4911fd,'id'));}return _0x3efc85;}function getInteractionsQuery(_0x426559){var _0x355904=utils[_0x0824('0x16')](_0x426559);var _0x245406=utils['getAccountFK'](_0x426559);var _0x457e0f=utils['getInteractionFK'](_0x426559);return squel['select']()[_0x0824('0xb')](_0x355904['interactions'],'i')[_0x0824('0x17')](_0x0824('0x18'),'c',_0x0824('0x19'))[_0x0824('0x17')](_0x0824('0x1a'),'o',_0x0824('0x1b'))[_0x0824('0x17')](_0x355904[_0x0824('0x1c')],'a','a.id\x20=\x20i.'+_0x245406)[_0x0824('0x17')](_0x355904['messages'],'me','me.'+_0x457e0f+'\x20=\x20i.id')[_0x0824('0x17')](_0x355904[_0x0824('0x1d')],'it',_0x0824('0x1e')+_0x457e0f+_0x0824('0x1f'))[_0x0824('0x17')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x246d8e={'body':squel[_0x0824('0x20')](),'contact':squel[_0x0824('0x20')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x0824('0x20')](),'tags':{'clause':squel[_0x0824('0x20')](),'ids':null},'user':squel[_0x0824('0x20')]()};return _0x246d8e;}function parseTagParameter(_0x8f367e){var _0x57a206=squel[_0x0824('0x20')]();if(_0x8f367e){var _0x1ec181=utils[_0x0824('0x21')](_0x8f367e);_0x1ec181[_0x0824('0x22')](function(_0x58feba){_0x57a206['or'](_0x0824('0x23'),'%,'+_0x58feba+',%');});}return _0x57a206;}function parseReadParameter(_0x49e76e){var _0x54bc43='';if(_0x49e76e){_0x54bc43=_0x0824('0x24');if(_0x49e76e==='1'){_0x54bc43=_0x54bc43[_0x0824('0x25')](_0x0824('0x26'),'=');}else{_0x54bc43=_0x54bc43[_0x0824('0x25')](_0x0824('0x26'),'>');}}return _0x54bc43;}function parseSearchFilter(_0x4defc,_0x1119a4){var _0x2ac4e9=squel[_0x0824('0x20')]();if(_0x1119a4){var _0x6c5a11=_0x1119a4[_0x0824('0x25')]('\x5c','\x5c\x5c')[_0x0824('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x6c5a11)){_0x2ac4e9['or'](_0x0824('0x27'),_0x6c5a11+'%');if([_0x0824('0x28'),'whatsapp'][_0x0824('0x29')](_0x4defc)){_0x2ac4e9['or']('i.phone\x20LIKE\x20?',_0x6c5a11+'%');}else if(_0x4defc===_0x0824('0x2a')){_0x2ac4e9['or'](_0x0824('0x2b'),_0x6c5a11+'%');}else if(_0x4defc===_0x0824('0x2c')){_0x2ac4e9['or'](_0x0824('0x2d'),_0x6c5a11+'%');}}else if(_0x4defc===_0x0824('0x2e')&&qs[_0x0824('0x2f')](_0x6c5a11)){_0x2ac4e9['or'](_0x0824('0x30'),_0x6c5a11+'%');}else{if(_0x4defc===_0x0824('0x2e')){_0x2ac4e9['or'](_0x0824('0x31'),qs[_0x0824('0x32')](_0x6c5a11,!![]))['or'](_0x0824('0x33'),qs[_0x0824('0x32')](_0x6c5a11));}else if(_0x4defc!==_0x0824('0x2a')){_0x2ac4e9['or'](_0x0824('0x34'),qs[_0x0824('0x32')](_0x6c5a11));}_0x2ac4e9['or'](_0x0824('0x35'),qs['getFullTextValue'](_0x6c5a11,!![]),null);}}return _0x2ac4e9;}function parseAdvancedSearchFilter(_0x37b94a,_0x54729d){var _0x39b083=getSqlClauses();var _0x20f364=as['parseSearch'](_0x37b94a);var _0x34c1f8=_0x20f364[_0x0824('0x36')];for(var _0x1edba7=0x0;_0x1edba7<_0x20f364[_0x0824('0x37')]['length'];_0x1edba7++){var _0x31bd09=_0x20f364[_0x0824('0x37')][_0x1edba7];var _0x1230cf='i';var _0x1f1fe1=_[_0x0824('0x38')](_0x54729d,['name',_0x31bd09[_0x0824('0x9')]]);if(_0x1f1fe1){var _0xb2d887=as[_0x0824('0x39')](_0x1230cf,_0x1f1fe1['type'],_0x31bd09);_0x39b083[_0x0824('0x3a')][_0x34c1f8](_0xb2d887['text'],_0xb2d887[_0x0824('0x3b')][_0x0824('0x3c')],_0xb2d887[_0x0824('0x3b')][_0x0824('0x3d')]);}else{switch(_0x31bd09[_0x0824('0x9')]){case _0x0824('0x3e'):var _0xc4b4d9=parseReadParameter(_0x31bd09[_0x0824('0x3b')]);_0x39b083[_0x0824('0x3f')][_0x0824('0x40')](_0xc4b4d9);break;case _0x0824('0x41'):if(_0x31bd09[_0x0824('0x42')]===_0x0824('0x43')){if(_0x31bd09[_0x0824('0x3b')][_0x0824('0x44')]('\x20')[_0x0824('0x12')]>0x1){_0x39b083['contact'][_0x34c1f8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0824('0x32')](_0x31bd09[_0x0824('0x3b')],!![]),null);}else{var _0x32e72e='%'+_0x31bd09[_0x0824('0x3b')]+'%';_0x39b083['contact'][_0x34c1f8](_0x0824('0x45'),_0x32e72e,_0x32e72e,_0x32e72e);}}else{_0x1f1fe1=_[_0x0824('0x38')](_0x54729d,['name',_0x0824('0x46')]);_0x31bd09['field']=_0x0824('0x46');_0xb2d887=as[_0x0824('0x39')](_0x1230cf,_0x1f1fe1[_0x0824('0x47')],_0x31bd09);_0x39b083['contact'][_0x34c1f8](_0xb2d887[_0x0824('0x48')],_0xb2d887['value'][_0x0824('0x3c')],_0xb2d887[_0x0824('0x3b')][_0x0824('0x3d')]);}break;case'Tag':var _0x427ec8=_0x31bd09[_0x0824('0x3b')][_0x0824('0x44')](',')[_0x0824('0x15')](function(_0x307bee){return Number(_0x307bee);});var _0x2b51d9=parseTagParameter(_0x427ec8);_0x39b083['tags'][_0x0824('0x49')][_0x0824('0x40')](_0x2b51d9);_0x39b083[_0x0824('0x4a')][_0x0824('0x4b')]=_0x427ec8;break;case _0x0824('0x4c'):if(_0x31bd09['operator']===_0x0824('0x43')){_0x39b083[_0x0824('0x4d')][_0x34c1f8](_0x0824('0x4e'),'%'+_0x31bd09[_0x0824('0x3b')]+'%',null);}else{_0x1f1fe1=_['find'](_0x54729d,[_0x0824('0xa'),'UserId']);_0x31bd09[_0x0824('0x9')]=_0x0824('0x4f');_0xb2d887=as[_0x0824('0x39')](_0x1230cf,_0x1f1fe1[_0x0824('0x47')],_0x31bd09);_0x39b083[_0x0824('0x4d')][_0x34c1f8](_0xb2d887[_0x0824('0x48')],_0xb2d887[_0x0824('0x3b')]['start'],_0xb2d887[_0x0824('0x3b')][_0x0824('0x3d')]);}break;case _0x0824('0x50'):case _0x0824('0x51'):_0xb2d887=as[_0x0824('0x39')]('me',null,_0x31bd09);_0x39b083[_0x0824('0x50')][_0x34c1f8](_0xb2d887['text'],_0xb2d887[_0x0824('0x3b')]['start'],_0xb2d887[_0x0824('0x3b')]['end']);break;}}}return _0x39b083;}function parseModelFields(_0x147ff1,_0x312053,_0x15e1fe){var _0x20fa04=utils['getAccountFK'](_0x147ff1);var _0x2e9dcd=squel[_0x0824('0x20')]();var _0xbcce87=_(_0x312053)['keys']()[_0x0824('0x15')](function(_0x173128){return _[_0x0824('0x52')](_0x15e1fe,[_0x0824('0xa'),_0x173128])?_0x173128:undefined;})[_0x0824('0x53')]()[_0x0824('0x3b')]();if(_0xbcce87[_0x0824('0x12')]>0x0){_0xbcce87['forEach'](function(_0x11c11d){if(_0x11c11d===_0x20fa04){_0x2e9dcd['and']('i.'+_0x20fa04+_0x0824('0x14'),[][_0x0824('0x54')](_0x312053[_0x11c11d]));}else if(_0x11c11d===_0x0824('0x55')){var _0x293c98=JSON[_0x0824('0x56')](_0x312053[_0x11c11d])[_0x0824('0x57')];var _0x5e6f34=JSON[_0x0824('0x56')](_0x312053[_0x11c11d])[_0x0824('0x58')];_0x2e9dcd[_0x0824('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x293c98,_0x5e6f34);}else{if(_0x312053[_0x11c11d]===_0x0824('0x59')){_0x2e9dcd[_0x0824('0x40')]('i.'+_0x11c11d+'\x20IS\x20NULL');}else{_0x2e9dcd[_0x0824('0x40')]('i.'+_0x11c11d+_0x0824('0x5a'),_0x312053[_0x11c11d]);}}});}return _0x2e9dcd;}function parseQueryParameters(_0x2fbe62,_0x5d63b6,_0x2fbc69){var _0x4b7a1f=getSqlClauses();return Promise[_0x0824('0x5b')]()[_0x0824('0x5c')](function(){return parseModelFields(_0x2fbe62,_0x5d63b6,_0x2fbc69);})['then'](function(_0x219aec){_0x4b7a1f[_0x0824('0x5d')]['and'](_0x219aec);return parseReadParameter(_0x5d63b6[_0x0824('0x3f')]);})[_0x0824('0x5c')](function(_0x485208){_0x4b7a1f[_0x0824('0x3f')]['and'](_0x485208);return parseTagParameter(_0x5d63b6[_0x0824('0x5e')]);})[_0x0824('0x5c')](function(_0x29357d){_0x4b7a1f[_0x0824('0x4a')][_0x0824('0x49')][_0x0824('0x40')](_0x29357d);return parseSearchFilter(_0x2fbe62,_0x5d63b6['filter']);})[_0x0824('0x5c')](function(_0x5e55bb){_0x4b7a1f[_0x0824('0x5f')]=_0x5e55bb;return _0x4b7a1f;});}function checkAccountsRestrictions(_0x5e5ab2,_0x174ceb,_0xe0d606){var _0x369cfa=utils[_0x0824('0x4')](_0x5e5ab2);var _0xf05758=_0x0824('0x60')+_[_0x0824('0x61')](_0x5e5ab2)+(_0x5e5ab2==='chat'?_0x0824('0x62'):'Accounts');var _0x23a2d0=squel[_0x0824('0x20')]();return Promise['resolve']()[_0x0824('0x5c')](function(){if(_0xe0d606[_0x0824('0x7')]&&_0x174ceb[_0x0824('0x5')]===_0x0824('0x6')){return _0x174ceb[_0xf05758]({'attributes':['id'],'raw':!![]});}})[_0x0824('0x5c')](function(_0x3e2676){if(_0x3e2676){if(_0x3e2676[_0x0824('0x12')]===0x0){_0x23a2d0['and']('i.'+_0x369cfa+'\x20IS\x20NULL');}else{_0x23a2d0[_0x0824('0x40')]('i.'+_0x369cfa+_0x0824('0x14'),_[_0x0824('0x15')](_0x3e2676,'id'));}}else if(!_0xe0d606[_0x369cfa]){_0x23a2d0[_0x0824('0x40')]('i.'+_0x369cfa+_0x0824('0x63'));}})['then'](function(){return _0x23a2d0;});}function getClosedOrderClause(_0x397734,_0x45e0fd){var _0x382c13='';var _0x5aba0a=[_0x0824('0x64'),'i.secondDisposition',_0x0824('0x65')];if(_0x397734==='mail'){_0x5aba0a['unshift'](_0x0824('0x66'));}if(_0x45e0fd[_0x0824('0x67')]==='0'&&_0x397734==='mail'){_0x382c13=_0x0824('0x66');}else{if(_0x45e0fd['closed']==='1'){_0x5aba0a[_0x0824('0x68')]();}_0x382c13='CONCAT_WS(\x27\x27,\x20'+_0x5aba0a[_0x0824('0x69')](',\x20')+')';}return _0x382c13;}function getFilteredInteractions(_0xdb6d00,_0x576e04,_0x29e656,_0x4ea267){var _0x10e798=utils[_0x0824('0xc')](_0xdb6d00);var _0xde36fe=_[_0x0824('0x61')](_0xdb6d00)+_0x0824('0x6a');var _0x56c04c=[];var _0x4f2c6c=getTagsQuery();var _0x3edb4c={'type':db[_0x0824('0x6b')][_0x0824('0x6c')]['SELECT'],'raw':!![]};var _0x233226=[];var _0x3fecc9=[];return db[_0x0824('0x6d')][_0x0824('0x6e')](_0x4f2c6c[_0x0824('0x6f')](),_0x3edb4c)['then'](function(_0x458995){_0x56c04c=_[_0x0824('0x70')](_0x458995,'id');_0x3edb4c=_[_0x0824('0x71')](_0x3edb4c,{'model':db[_0xde36fe],'mapToModel':!![],'nest':!![]});if(_0x29e656['fields']){_0x4ea267[_0x0824('0x72')]['forEach'](function(_0x22b34b){_0x576e04[_0x0824('0x9')]('i.'+_0x22b34b);});}else{_0x576e04[_0x0824('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0824('0x3e'));_0x576e04[_0x0824('0x9')](_0x0824('0x73'),'Account.key');_0x576e04[_0x0824('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0xdb6d00===_0x0824('0x2e')){_0x576e04[_0x0824('0x9')](_0x0824('0x74'),_0x0824('0x75'));_0x576e04[_0x0824('0x9')](_0x0824('0x76'),_0x0824('0x77'));_0x576e04['field'](_0x0824('0x78'));_0x576e04[_0x0824('0x9')](_0x0824('0x79'));_0x576e04[_0x0824('0x9')](_0x0824('0x7a'));_0x576e04[_0x0824('0x9')](_0x0824('0x7b'));_0x576e04[_0x0824('0x9')](_0x0824('0x7c'));_0x576e04[_0x0824('0x9')](_0x0824('0x7d'));_0x576e04[_0x0824('0x9')](_0x0824('0x7e'));_0x576e04[_0x0824('0x9')](_0x0824('0x7f'));_0x576e04['field'](_0x0824('0x80'));_0x576e04['field'](_0x0824('0x65'));_0x576e04[_0x0824('0x9')](_0x0824('0x81'));_0x576e04[_0x0824('0x9')]('i.thirdDisposition');_0x576e04[_0x0824('0x9')](_0x0824('0x66'));_0x576e04[_0x0824('0x9')]('i.to');_0x576e04[_0x0824('0x9')](_0x0824('0x82'));_0x576e04[_0x0824('0x9')]('i.MailAccountId');_0x576e04['field'](_0x0824('0x83'));}else if(_0xdb6d00==='openchannel'){_0x576e04['field'](_0x0824('0x84'),_0x0824('0x77'));}else{_0x576e04[_0x0824('0x9')](_0x0824('0x85'),_0x0824('0x77'));}if(_0xdb6d00!=='mail'){_0x576e04['field'](_0x0824('0x86'));}_0x576e04[_0x0824('0x9')](_0x0824('0x87'),_0x0824('0x88'));_0x576e04[_0x0824('0x9')](_0x0824('0x89'),'Contact.lastName');_0x576e04['field'](_0x0824('0x8a'),_0x0824('0x8b'));_0x576e04[_0x0824('0x9')]('c.phone',_0x0824('0x8c'));_0x576e04[_0x0824('0x9')](_0x0824('0x8d'),_0x0824('0x8e'));_0x576e04[_0x0824('0x9')]('c.fax',_0x0824('0x8f'));_0x576e04[_0x0824('0x9')](_0x0824('0x90'),_0x0824('0x91'));_0x576e04['field'](_0x0824('0x92'),_0x0824('0x93'));_0x576e04[_0x0824('0x9')](_0x0824('0x94'),_0x0824('0x95'));}if(_0x4ea267[_0x0824('0x96')]){_0x576e04[_0x0824('0x96')](_0x4ea267[_0x0824('0x96')]);}if(_0x4ea267['offset']){_0x576e04[_0x0824('0x97')](_0x4ea267[_0x0824('0x97')]);}return db[_0x0824('0x6d')][_0x0824('0x6e')](_0x576e04[_0x0824('0x6f')](),_0x3edb4c);})['then'](function(_0x3eba3b){_0x233226=_0x3eba3b;var _0x3161a3=getUsersQuery(_0xdb6d00,_0x233226);return db[_0x0824('0x6d')][_0x0824('0x6e')](_0x3161a3[_0x0824('0x6f')](),_0x3edb4c);})[_0x0824('0x5c')](function(_0x31167a){_0x3fecc9=_['groupBy'](_0x31167a,_0x10e798);if(_0xdb6d00===_0x0824('0x2e')){return db[_0x0824('0x98')]['findOne']({'attributes':[_0x0824('0x99')],'raw':!![]});}})[_0x0824('0x5c')](function(_0x392699){var _0xf2e79b=_0x392699?_0x392699[_0x0824('0x99')]:undefined;var _0x565ffd=_0x233226[_0x0824('0x15')](function(_0xea3680){return updateInteraction(_0xea3680,_0x56c04c,_0x3fecc9,_0xf2e79b);});return Promise[_0x0824('0x9a')](_0x565ffd);});}function countFilteredInteractions(_0x426408,_0x586553){var _0x3adc84=_0x426408[_0x0824('0x9b')]();_0x3adc84[_0x0824('0x9')](_0x0824('0x9c'));_0x3adc84['field'](_0x0824('0x9d'),_0x0824('0x3e'));var _0x3a0e12=utils[_0x0824('0x21')](_0x586553);if(!_[_0x0824('0x9e')](_0x3a0e12)){_0x3adc84['where'](_0x0824('0x9f'),_0x3a0e12);}var _0x468325={'type':db[_0x0824('0x6b')]['QueryTypes'][_0x0824('0xa0')],'raw':!![]};return db[_0x0824('0x6d')]['query'](_0x3adc84[_0x0824('0x6f')](),_0x468325);}module[_0x0824('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xba10=['UserId','end','keys','some','compact','\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','join','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_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','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','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','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.lastName','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)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','getAccountFK','role','search','select','field','name','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','u.id\x20=\x20ui.UserId','where','map','getInteractionsTables','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','type','default','value','start','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xba10,0xea));var _0x0ba1=function(_0x5cfa18,_0x23738e){_0x5cfa18=_0x5cfa18-0x0;var _0x26b274=_0xba10[_0x5cfa18];return _0x26b274;};'use strict';var _=require('lodash');var squel=require(_0x0ba1('0x0'));var as=require(_0x0ba1('0x1'));var qs=require(_0x0ba1('0x2'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require(_0x0ba1('0x3'))['db'];function skipInteractionsQuery(_0x2aa788,_0x57d76a,_0x2a7750){var _0x4d25d1=![];var _0x3f7194=utils[_0x0ba1('0x4')](_0x2aa788);if(_0x57d76a[_0x0ba1('0x5')]==='agent'&&!_0x2a7750[_0x0ba1('0x6')]&&!_0x2a7750[_0x3f7194]){_0x4d25d1=!![];}return _0x4d25d1;}function getTagsQuery(){return squel[_0x0ba1('0x7')]()[_0x0ba1('0x8')]('id')[_0x0ba1('0x8')](_0x0ba1('0x9'))['field']('color')['from']('tools_tags');}function getUsersQuery(_0x3e6b52,_0x30120e){var _0x307d88=utils[_0x0ba1('0xa')](_0x3e6b52);var _0x1ed0c3=_0x0ba1('0xb')+_0x3e6b52+_0x0ba1('0xc');var _0x54177c=squel[_0x0ba1('0x7')]()[_0x0ba1('0x8')]('u.id')[_0x0ba1('0x8')](_0x0ba1('0xd'))[_0x0ba1('0x8')](_0x0ba1('0xe')+_0x307d88)[_0x0ba1('0xf')](_0x1ed0c3,'ui')['left_join']('users','u',_0x0ba1('0x10'));if(_0x30120e['length']>0x0){_0x54177c[_0x0ba1('0x11')]('ui.'+_0x307d88+'\x20IN\x20?',_[_0x0ba1('0x12')](_0x30120e,'id'));}return _0x54177c;}function getInteractionsQuery(_0x177287){var _0x282c4a=utils[_0x0ba1('0x13')](_0x177287);var _0xbde5b5=utils[_0x0ba1('0x4')](_0x177287);var _0x1ee3c5=utils[_0x0ba1('0xa')](_0x177287);return squel[_0x0ba1('0x7')]()[_0x0ba1('0xf')](_0x282c4a['interactions'],'i')[_0x0ba1('0x14')](_0x0ba1('0x15'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x0ba1('0x16'),'o',_0x0ba1('0x17'))['left_join'](_0x282c4a[_0x0ba1('0x18')],'a','a.id\x20=\x20i.'+_0xbde5b5)[_0x0ba1('0x14')](_0x282c4a['messages'],'me',_0x0ba1('0x19')+_0x1ee3c5+_0x0ba1('0x1a'))[_0x0ba1('0x14')](_0x282c4a['interactionsTags'],'it',_0x0ba1('0x1b')+_0x1ee3c5+_0x0ba1('0x1a'))['left_join']('tools_tags','t',_0x0ba1('0x1c'));}function getSqlClauses(){var _0x563362={'body':squel['expr'](),'contact':squel[_0x0ba1('0x1d')](),'default':squel[_0x0ba1('0x1d')](),'fields':squel[_0x0ba1('0x1d')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x0ba1('0x1d')](),'ids':null},'user':squel[_0x0ba1('0x1d')]()};return _0x563362;}function parseTagParameter(_0x1a1b44){var _0x6b8685=squel[_0x0ba1('0x1d')]();if(_0x1a1b44){var _0x58b61b=utils[_0x0ba1('0x1e')](_0x1a1b44);_0x58b61b[_0x0ba1('0x1f')](function(_0x2c1b33){_0x6b8685['or'](_0x0ba1('0x20'),'%,'+_0x2c1b33+',%');});}return _0x6b8685;}function parseReadParameter(_0x46f794){var _0x1104cc='';if(_0x46f794){_0x1104cc='unreadMessages\x20{OPERATOR}\x200';if(_0x46f794==='1'){_0x1104cc=_0x1104cc[_0x0ba1('0x21')]('{OPERATOR}','=');}else{_0x1104cc=_0x1104cc['replace'](_0x0ba1('0x22'),'>');}}return _0x1104cc;}function parseSearchFilter(_0x5e2be,_0x33106c){var _0x15db60=squel[_0x0ba1('0x1d')]();if(_0x33106c){var _0x3bcfd1=_0x33106c[_0x0ba1('0x21')]('\x5c','\x5c\x5c')[_0x0ba1('0x21')](/'/g,'\x27\x27');if(qs[_0x0ba1('0x23')](_0x3bcfd1)){_0x15db60['or'](_0x0ba1('0x24'),_0x3bcfd1+'%');if([_0x0ba1('0x25'),_0x0ba1('0x26')][_0x0ba1('0x27')](_0x5e2be)){_0x15db60['or']('i.phone\x20LIKE\x20?',_0x3bcfd1+'%');}else if(_0x5e2be===_0x0ba1('0x28')){_0x15db60['or'](_0x0ba1('0x29'),_0x3bcfd1+'%');}else if(_0x5e2be==='openchannel'){_0x15db60['or']('i.from\x20LIKE\x20?',_0x3bcfd1+'%');}}else if(_0x5e2be===_0x0ba1('0x2a')&&qs['isEmail'](_0x3bcfd1)){_0x15db60['or']('c.email\x20LIKE\x20?',_0x3bcfd1+'%');}else{if(_0x5e2be===_0x0ba1('0x2a')){_0x15db60['or'](_0x0ba1('0x2b'),qs[_0x0ba1('0x2c')](_0x3bcfd1,!![]))['or'](_0x0ba1('0x2d'),qs[_0x0ba1('0x2c')](_0x3bcfd1));}else if(_0x5e2be!==_0x0ba1('0x28')){_0x15db60['or'](_0x0ba1('0x2e'),qs[_0x0ba1('0x2c')](_0x3bcfd1));}_0x15db60['or'](_0x0ba1('0x2f'),qs[_0x0ba1('0x2c')](_0x3bcfd1,!![]),null);}}return _0x15db60;}function parseAdvancedSearchFilter(_0x2d2690,_0x33a359){var _0x109b5c=getSqlClauses();var _0x46cb6c=as[_0x0ba1('0x30')](_0x2d2690);var _0x19d46a=_0x46cb6c[_0x0ba1('0x31')];for(var _0x5d8789=0x0;_0x5d8789<_0x46cb6c[_0x0ba1('0x32')][_0x0ba1('0x33')];_0x5d8789++){var _0x35045d=_0x46cb6c['conditions'][_0x5d8789];var _0x1d5142='i';var _0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x35045d[_0x0ba1('0x8')]]);if(_0x4ab388){var _0x10ce56=as['buildExpression'](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x36')][_0x19d46a](_0x10ce56['text'],_0x10ce56[_0x0ba1('0x37')][_0x0ba1('0x38')],_0x10ce56[_0x0ba1('0x37')]['end']);}else{switch(_0x35045d[_0x0ba1('0x8')]){case _0x0ba1('0x39'):var _0x1690c4=parseReadParameter(_0x35045d[_0x0ba1('0x37')]);_0x109b5c[_0x0ba1('0x3a')][_0x0ba1('0x3b')](_0x1690c4);break;case _0x0ba1('0x3c'):if(_0x35045d[_0x0ba1('0x3d')]===_0x0ba1('0x3e')){if(_0x35045d[_0x0ba1('0x37')][_0x0ba1('0x3f')]('\x20')['length']>0x1){_0x109b5c[_0x0ba1('0x40')][_0x19d46a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0ba1('0x2c')](_0x35045d[_0x0ba1('0x37')],!![]),null);}else{var _0x36af74='%'+_0x35045d[_0x0ba1('0x37')]+'%';_0x109b5c[_0x0ba1('0x40')][_0x19d46a](_0x0ba1('0x41'),_0x36af74,_0x36af74,_0x36af74);}}else{_0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x0ba1('0x42')]);_0x35045d[_0x0ba1('0x8')]=_0x0ba1('0x42');_0x10ce56=as[_0x0ba1('0x43')](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x40')][_0x19d46a](_0x10ce56[_0x0ba1('0x44')],_0x10ce56['value'][_0x0ba1('0x38')],_0x10ce56[_0x0ba1('0x37')]['end']);}break;case _0x0ba1('0x45'):var _0x35ad31=_0x35045d[_0x0ba1('0x37')][_0x0ba1('0x3f')](',')[_0x0ba1('0x12')](function(_0x3a7ea2){return Number(_0x3a7ea2);});var _0x4c5e8f=parseTagParameter(_0x35ad31);_0x109b5c[_0x0ba1('0x46')][_0x0ba1('0x47')][_0x0ba1('0x3b')](_0x4c5e8f);_0x109b5c[_0x0ba1('0x46')][_0x0ba1('0x48')]=_0x35ad31;break;case _0x0ba1('0x49'):if(_0x35045d[_0x0ba1('0x3d')]===_0x0ba1('0x3e')){_0x109b5c[_0x0ba1('0x4a')][_0x19d46a](_0x0ba1('0x4b'),'%'+_0x35045d['value']+'%',null);}else{_0x4ab388=_[_0x0ba1('0x34')](_0x33a359,[_0x0ba1('0x9'),_0x0ba1('0x4c')]);_0x35045d[_0x0ba1('0x8')]=_0x0ba1('0x4c');_0x10ce56=as[_0x0ba1('0x43')](_0x1d5142,_0x4ab388[_0x0ba1('0x35')],_0x35045d);_0x109b5c[_0x0ba1('0x4a')][_0x19d46a](_0x10ce56['text'],_0x10ce56[_0x0ba1('0x37')][_0x0ba1('0x38')],_0x10ce56['value'][_0x0ba1('0x4d')]);}break;case'body':case'plainBody':_0x10ce56=as[_0x0ba1('0x43')]('me',null,_0x35045d);_0x109b5c['body'][_0x19d46a](_0x10ce56['text'],_0x10ce56['value']['start'],_0x10ce56[_0x0ba1('0x37')]['end']);break;}}}return _0x109b5c;}function parseModelFields(_0x1285b3,_0xa393c9,_0x1bd4ae){var _0x442b21=utils[_0x0ba1('0x4')](_0x1285b3);var _0x1fd297=squel['expr']();var _0x153eb1=_(_0xa393c9)[_0x0ba1('0x4e')]()['map'](function(_0x34b845){return _[_0x0ba1('0x4f')](_0x1bd4ae,[_0x0ba1('0x9'),_0x34b845])?_0x34b845:undefined;})[_0x0ba1('0x50')]()[_0x0ba1('0x37')]();if(_0x153eb1[_0x0ba1('0x33')]>0x0){_0x153eb1['forEach'](function(_0x423ad2){if(_0x423ad2===_0x442b21){_0x1fd297[_0x0ba1('0x3b')]('i.'+_0x442b21+_0x0ba1('0x51'),[][_0x0ba1('0x52')](_0xa393c9[_0x423ad2]));}else if(_0x423ad2==='createdAt'){var _0x6b4df0=JSON[_0x0ba1('0x53')](_0xa393c9[_0x423ad2])['$gte'];var _0x48c9cc=JSON[_0x0ba1('0x53')](_0xa393c9[_0x423ad2])[_0x0ba1('0x54')];_0x1fd297[_0x0ba1('0x3b')](_0x0ba1('0x55'),_0x6b4df0,_0x48c9cc);}else{if(_0xa393c9[_0x423ad2]===_0x0ba1('0x56')){_0x1fd297['and']('i.'+_0x423ad2+_0x0ba1('0x57'));}else{_0x1fd297[_0x0ba1('0x3b')]('i.'+_0x423ad2+'\x20=\x20?',_0xa393c9[_0x423ad2]);}}});}return _0x1fd297;}function parseQueryParameters(_0x21ed8b,_0x3f545e,_0x394772){var _0x99605f=getSqlClauses();return Promise[_0x0ba1('0x58')]()[_0x0ba1('0x59')](function(){return parseModelFields(_0x21ed8b,_0x3f545e,_0x394772);})[_0x0ba1('0x59')](function(_0x2eb8bd){_0x99605f[_0x0ba1('0x5a')]['and'](_0x2eb8bd);return parseReadParameter(_0x3f545e[_0x0ba1('0x3a')]);})['then'](function(_0x5dda2e){_0x99605f['read'][_0x0ba1('0x3b')](_0x5dda2e);return parseTagParameter(_0x3f545e[_0x0ba1('0x5b')]);})['then'](function(_0x5a8bbf){_0x99605f['tags'][_0x0ba1('0x47')][_0x0ba1('0x3b')](_0x5a8bbf);return parseSearchFilter(_0x21ed8b,_0x3f545e[_0x0ba1('0x5c')]);})['then'](function(_0x332026){_0x99605f[_0x0ba1('0x5c')]=_0x332026;return _0x99605f;});}function checkAccountsRestrictions(_0x43a171,_0x37239c,_0x3f3f25){var _0x3c5885=utils['getAccountFK'](_0x43a171);var _0x540e12=_0x0ba1('0x5d')+_[_0x0ba1('0x5e')](_0x43a171)+(_0x43a171===_0x0ba1('0x5f')?_0x0ba1('0x60'):_0x0ba1('0x61'));var _0x4578d0=squel[_0x0ba1('0x1d')]();return Promise[_0x0ba1('0x58')]()['then'](function(){if(_0x3f3f25[_0x0ba1('0x6')]&&_0x37239c[_0x0ba1('0x5')]===_0x0ba1('0x62')){return _0x37239c[_0x540e12]({'attributes':['id'],'raw':!![]});}})[_0x0ba1('0x59')](function(_0x5cc2b0){if(_0x5cc2b0){if(_0x5cc2b0[_0x0ba1('0x33')]===0x0){_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x57'));}else{_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x51'),_[_0x0ba1('0x12')](_0x5cc2b0,'id'));}}else if(!_0x3f3f25[_0x3c5885]){_0x4578d0[_0x0ba1('0x3b')]('i.'+_0x3c5885+_0x0ba1('0x63'));}})[_0x0ba1('0x59')](function(){return _0x4578d0;});}function getClosedOrderClause(_0x8d26fa,_0xe9cd56){var _0x1aa92e='';var _0x168ee2=['i.thirdDisposition',_0x0ba1('0x64'),_0x0ba1('0x65')];if(_0x8d26fa===_0x0ba1('0x2a')){_0x168ee2[_0x0ba1('0x66')](_0x0ba1('0x67'));}if(_0xe9cd56['closed']==='0'&&_0x8d26fa===_0x0ba1('0x2a')){_0x1aa92e=_0x0ba1('0x67');}else{if(_0xe9cd56['closed']==='1'){_0x168ee2['shift']();}_0x1aa92e='CONCAT_WS(\x27\x27,\x20'+_0x168ee2[_0x0ba1('0x68')](',\x20')+')';}return _0x1aa92e;}function getFilteredInteractions(_0x24f6c4,_0x1d2fba,_0x82362b,_0x357895){var _0xdb6605=utils['getInteractionFK'](_0x24f6c4);var _0x14d019=_[_0x0ba1('0x5e')](_0x24f6c4)+'Interaction';var _0x52a335=[];var _0x1c215e=getTagsQuery();var _0x1e8315={'type':db[_0x0ba1('0x69')][_0x0ba1('0x6a')][_0x0ba1('0x6b')],'raw':!![]};var _0x4b9b14=[];var _0x5f4311=[];return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x1c215e[_0x0ba1('0x6e')](),_0x1e8315)[_0x0ba1('0x59')](function(_0x547333){_0x52a335=_[_0x0ba1('0x6f')](_0x547333,'id');_0x1e8315=_[_0x0ba1('0x70')](_0x1e8315,{'model':db[_0x14d019],'mapToModel':!![],'nest':!![]});if(_0x82362b[_0x0ba1('0x5a')]){_0x357895['attributes']['forEach'](function(_0x3237a4){_0x1d2fba[_0x0ba1('0x8')]('i.'+_0x3237a4);});}else{_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x71'),_0x0ba1('0x39'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x72'),_0x0ba1('0x73'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x74'),'Account.mandatoryDisposition');if(_0x24f6c4===_0x0ba1('0x2a')){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x75'),'Account.email');_0x1d2fba['field'](_0x0ba1('0x76'),_0x0ba1('0x77'));_0x1d2fba[_0x0ba1('0x8')]('i.id');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x78'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x79'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7a'));_0x1d2fba[_0x0ba1('0x8')]('i.closedAt');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7b'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7c'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7d'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x7e'));_0x1d2fba[_0x0ba1('0x8')]('i.disposition');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x64'));_0x1d2fba['field'](_0x0ba1('0x7f'));_0x1d2fba['field'](_0x0ba1('0x67'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x80'));_0x1d2fba[_0x0ba1('0x8')]('i.ContactId');_0x1d2fba[_0x0ba1('0x8')]('i.MailAccountId');_0x1d2fba[_0x0ba1('0x8')]('i.UserId');}else if(_0x24f6c4==='openchannel'){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x81'),'contactName');}else{_0x1d2fba['field'](_0x0ba1('0x82'),_0x0ba1('0x77'));}if(_0x24f6c4!==_0x0ba1('0x2a')){_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x83'));}_0x1d2fba[_0x0ba1('0x8')]('c.firstName','Contact.firstName');_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x84'),_0x0ba1('0x85'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x86'),_0x0ba1('0x87'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x88'),_0x0ba1('0x89'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x8a'),_0x0ba1('0x8b'));_0x1d2fba[_0x0ba1('0x8')]('c.fax',_0x0ba1('0x8c'));_0x1d2fba[_0x0ba1('0x8')](_0x0ba1('0x8d'),_0x0ba1('0x8e'));_0x1d2fba['field'](_0x0ba1('0x8f'),_0x0ba1('0x90'));_0x1d2fba['field'](_0x0ba1('0x91'),_0x0ba1('0x92'));}if(_0x357895[_0x0ba1('0x93')]){_0x1d2fba[_0x0ba1('0x93')](_0x357895[_0x0ba1('0x93')]);}if(_0x357895['offset']){_0x1d2fba[_0x0ba1('0x94')](_0x357895[_0x0ba1('0x94')]);}return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x1d2fba[_0x0ba1('0x6e')](),_0x1e8315);})['then'](function(_0x228cf7){_0x4b9b14=_0x228cf7;var _0x218dd8=getUsersQuery(_0x24f6c4,_0x4b9b14);return db[_0x0ba1('0x6c')]['query'](_0x218dd8[_0x0ba1('0x6e')](),_0x1e8315);})['then'](function(_0x232962){_0x5f4311=_[_0x0ba1('0x95')](_0x232962,_0xdb6605);if(_0x24f6c4==='mail'){return db[_0x0ba1('0x96')]['findOne']({'attributes':[_0x0ba1('0x97')],'raw':!![]});}})['then'](function(_0x1839ed){var _0x4c3373=_0x1839ed?_0x1839ed['enableEmailPreview']:undefined;var _0x2c1671=_0x4b9b14['map'](function(_0x53c4fe){return updateInteraction(_0x53c4fe,_0x52a335,_0x5f4311,_0x4c3373);});return Promise[_0x0ba1('0x98')](_0x2c1671);});}function countFilteredInteractions(_0x141567,_0x3f6807){var _0x431f37=_0x141567['clone']();_0x431f37[_0x0ba1('0x8')]('COUNT(*)');_0x431f37[_0x0ba1('0x8')](_0x0ba1('0x71'),'unreadMessages');var _0x38ea86=utils['getSelectedTags'](_0x3f6807);if(!_[_0x0ba1('0x99')](_0x38ea86)){_0x431f37[_0x0ba1('0x11')](_0x0ba1('0x9a'),_0x38ea86);}var _0x559498={'type':db[_0x0ba1('0x69')]['QueryTypes'][_0x0ba1('0x6b')],'raw':!![]};return db[_0x0ba1('0x6c')][_0x0ba1('0x6d')](_0x431f37[_0x0ba1('0x6e')](),_0x559498);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 59e5f40..dc7700f 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75a5=['then','plainBody','lastMsgText','trimStart','Users','TagIds','Tags','catch','lodash','map','fullname','split','push','waiting','talking','unmanaged','abandoned','total','closed','UserId','answered','disposition','MailMessage','findOne','-id'];(function(_0x5217d5,_0x553d54){var _0x1818eb=function(_0x24e3e4){while(--_0x24e3e4){_0x5217d5['push'](_0x5217d5['shift']());}};_0x1818eb(++_0x553d54);}(_0x75a5,0x17f));var _0x575a=function(_0x3adb51,_0x478244){_0x3adb51=_0x3adb51-0x0;var _0x588c11=_0x75a5[_0x3adb51];return _0x588c11;};'use strict';var _=require(_0x575a('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4a4041,_0x68d0fd){return new Promise(function(_0x659ddf,_0x50b6e2){try{var _0x1bf231=[];if(_0x68d0fd[_0x4a4041]){_0x1bf231=_0x68d0fd[_0x4a4041][_0x575a('0x1')](function(_0x3d29da){return{'id':_0x3d29da['id'],'fullname':_0x3d29da[_0x575a('0x2')]};});}return _0x659ddf(_0x1bf231);}catch(_0x5008be){_0x50b6e2(_0x5008be);}});}function getInteractionTags(_0x301f51,_0x219476){var _0x593801=[];if(_0x301f51){_0x301f51[_0x575a('0x3')](',')['forEach'](function(_0x1ceef5){_0x593801[_0x575a('0x4')](_0x219476[_0x1ceef5]);});}return _0x593801;}function updateWaitingCounter(_0x106341){if(_0x106341[_0x575a('0x5')]){_0x106341[_0x575a('0x5')]-=0x1;}}function updateInteractionCounters(_0x31615e){_0x31615e[_0x575a('0x5')]=0x0;_0x31615e[_0x575a('0x6')]=0x0;_0x31615e['answered']=0x0;_0x31615e[_0x575a('0x7')]=0x0;_0x31615e[_0x575a('0x8')]=0x0;_0x31615e[_0x575a('0x9')]=0x0;if(_0x31615e[_0x575a('0xa')]){if(_0x31615e['disposition']==='abandoned'){_0x31615e[_0x575a('0x8')]+=0x1;updateWaitingCounter(_0x31615e);}if(_0x31615e[_0x575a('0xb')]){_0x31615e[_0x575a('0xc')]+=0x1;if(_0x31615e[_0x575a('0x6')]){_0x31615e[_0x575a('0x6')]-=0x1;}}else{if(_0x31615e[_0x575a('0xd')]){_0x31615e[_0x575a('0x7')]+=0x1;updateWaitingCounter(_0x31615e);}}}else{if(!_0x31615e['UserId']){_0x31615e[_0x575a('0x5')]+=0x1;}if(_0x31615e[_0x575a('0xb')]){_0x31615e[_0x575a('0x6')]+=0x1;updateWaitingCounter(_0x31615e);}}_0x31615e[_0x575a('0x9')]+=0x1;return _0x31615e;}function getLastMessageText(_0x4e6887){return db[_0x575a('0xe')][_0x575a('0xf')]({'where':{'$and':[{'MailInteractionId':_0x4e6887['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x575a('0x10'),'raw':!![]})[_0x575a('0x11')](function(_0x413c79){if(_0x413c79&&_0x413c79[_0x575a('0x12')]){_0x4e6887[_0x575a('0x13')]=_[_0x575a('0x14')](_0x413c79[_0x575a('0x12')]);}return _0x4e6887;})['catch'](function(_0x4374c8){throw _0x4374c8;});}exports['updateInteraction']=function(_0x38ff97,_0x1fa59f,_0x4dd5c6,_0x38554b){return new Promise(function(_0x57944b,_0x10bd9d){return getInteractionUsers(_0x38ff97['id'],_0x4dd5c6)[_0x575a('0x11')](function(_0x3664f4){_0x38ff97[_0x575a('0x15')]=_0x3664f4;return getInteractionTags(_0x38ff97[_0x575a('0x16')],_0x1fa59f);})[_0x575a('0x11')](function(_0x2f8c51){_0x38ff97[_0x575a('0x17')]=_0x2f8c51;delete _0x38ff97[_0x575a('0x16')];return updateInteractionCounters(_0x38ff97);})['then'](function(_0x31e723){if(_0x38554b){return getLastMessageText(_0x31e723);}else{return _0x31e723;}})[_0x575a('0x11')](function(_0x1d0e5c){_0x57944b(_0x1d0e5c);})[_0x575a('0x18')](function(_0x358af6){_0x10bd9d(_0x358af6);});});}; \ No newline at end of file +var _0x6a88=['updateInteraction','Users','TagIds','then','Tags','lodash','map','fullname','split','forEach','talking','unmanaged','total','closed','disposition','abandoned','UserId','answered','waiting','MailMessage','out','plainBody','-id','lastMsgText','trimStart'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x6a88,0x14a));var _0x86a8=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0x6a88[_0x38f5f8];return _0x34e820;};'use strict';var _=require(_0x86a8('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x382660,_0x4133ba){return new Promise(function(_0x12d967,_0x1cedd9){try{var _0xc0ad17=[];if(_0x4133ba[_0x382660]){_0xc0ad17=_0x4133ba[_0x382660][_0x86a8('0x1')](function(_0x182214){return{'id':_0x182214['id'],'fullname':_0x182214[_0x86a8('0x2')]};});}return _0x12d967(_0xc0ad17);}catch(_0x364874){_0x1cedd9(_0x364874);}});}function getInteractionTags(_0x22ec03,_0x7d519){var _0x3a9a02=[];if(_0x22ec03){_0x22ec03[_0x86a8('0x3')](',')[_0x86a8('0x4')](function(_0x5a866b){_0x3a9a02['push'](_0x7d519[_0x5a866b]);});}return _0x3a9a02;}function updateWaitingCounter(_0x248257){if(_0x248257['waiting']){_0x248257['waiting']-=0x1;}}function updateInteractionCounters(_0x12ac05){_0x12ac05['waiting']=0x0;_0x12ac05[_0x86a8('0x5')]=0x0;_0x12ac05['answered']=0x0;_0x12ac05[_0x86a8('0x6')]=0x0;_0x12ac05['abandoned']=0x0;_0x12ac05[_0x86a8('0x7')]=0x0;if(_0x12ac05[_0x86a8('0x8')]){if(_0x12ac05[_0x86a8('0x9')]===_0x86a8('0xa')){_0x12ac05['abandoned']+=0x1;updateWaitingCounter(_0x12ac05);}if(_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0xc')]+=0x1;if(_0x12ac05['talking']){_0x12ac05[_0x86a8('0x5')]-=0x1;}}else{if(_0x12ac05[_0x86a8('0x9')]){_0x12ac05['unmanaged']+=0x1;updateWaitingCounter(_0x12ac05);}}}else{if(!_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0xd')]+=0x1;}if(_0x12ac05[_0x86a8('0xb')]){_0x12ac05[_0x86a8('0x5')]+=0x1;updateWaitingCounter(_0x12ac05);}}_0x12ac05[_0x86a8('0x7')]+=0x1;return _0x12ac05;}function getLastMessageText(_0x2ec5b9){return db[_0x86a8('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2ec5b9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x86a8('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x86a8('0x10')],'order':_0x86a8('0x11'),'raw':!![]})['then'](function(_0x59b216){if(_0x59b216&&_0x59b216[_0x86a8('0x10')]){_0x2ec5b9[_0x86a8('0x12')]=_[_0x86a8('0x13')](_0x59b216['plainBody']);}return _0x2ec5b9;})['catch'](function(_0x180f3f){throw _0x180f3f;});}exports[_0x86a8('0x14')]=function(_0x3032ab,_0x7c893b,_0x53764c,_0x2faee4){return new Promise(function(_0x74750e,_0x4eaaab){return getInteractionUsers(_0x3032ab['id'],_0x53764c)['then'](function(_0xd93e10){_0x3032ab[_0x86a8('0x15')]=_0xd93e10;return getInteractionTags(_0x3032ab[_0x86a8('0x16')],_0x7c893b);})[_0x86a8('0x17')](function(_0xee59ab){_0x3032ab[_0x86a8('0x18')]=_0xee59ab;delete _0x3032ab['TagIds'];return updateInteractionCounters(_0x3032ab);})[_0x86a8('0x17')](function(_0x4406cd){if(_0x2faee4){return getLastMessageText(_0x4406cd);}else{return _0x4406cd;}})['then'](function(_0xb382f){_0x74750e(_0xb382f);})['catch'](function(_0x213c7f){_0x4eaaab(_0x213c7f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f6f551b..bdedc7b 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a4b=['whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','accounts','_interaction_has_tags','_messages','_interactions','isArray','toLowerCase','toUpperCase','role','stringify','Interaction','then','update','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions'];(function(_0x491192,_0x43417b){var _0x24a1e1=function(_0x3a833f){while(--_0x3a833f){_0x491192['push'](_0x491192['shift']());}};_0x24a1e1(++_0x43417b);}(_0x6a4b,0xb0));var _0xb6a4=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x6a4b[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xb6a4('0x0'));var db=require(_0xb6a4('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xb6a4('0x2'))(_0xb6a4('0x3')),'fax':require(_0xb6a4('0x2'))(_0xb6a4('0x4')),'sms':require(_0xb6a4('0x2'))(_0xb6a4('0x5')),'chat':require(_0xb6a4('0x2'))('chat-interactions'),'whatsapp':require(_0xb6a4('0x2'))(_0xb6a4('0x6'))};function getAccountFK(_0x420e4d){return _[_0xb6a4('0x7')](_0x420e4d)+(_0x420e4d===_0xb6a4('0x8')?_0xb6a4('0x9'):_0xb6a4('0xa'))+'Id';}function getInteractionFK(_0x350860){return _[_0xb6a4('0x7')](_0x350860)+'InteractionId';}function getInteractionId(_0x10b72a,_0x400b20,_0x4fa32d){if(_0x10b72a&&_0x10b72a[_[_0xb6a4('0xb')](_0x4fa32d)+_0xb6a4('0xc')]){return _0x10b72a[_[_0xb6a4('0xb')](_0x4fa32d)+_0xb6a4('0xc')];}else if(_0x10b72a&&_0x10b72a['id']){return _0x10b72a['id'];}else if(_0x400b20&&_0x400b20['id']){return _0x400b20['id'];}else{return _0xb6a4('0xd');}}function getInteractionsTables(_0x18c568){return{'accounts':_0x18c568+'_'+(_0x18c568===_0xb6a4('0x8')?'websites':_0xb6a4('0xe')),'interactions':_0x18c568+'_interactions','interactionsTags':_0x18c568+_0xb6a4('0xf'),'messages':_0x18c568+_0xb6a4('0x10'),'userInteractions':'user_has_'+_0x18c568+_0xb6a4('0x11')};}function getSelectedTags(_0x90817f){var _0x40787b=[];if(_0x90817f){_0x40787b=Array[_0xb6a4('0x12')](_0x90817f)?_0x90817f:[_0x90817f];}return _0x40787b;}function log(_0x552124,_0x331be1,_0x3de58c,_0x4e10dd,_0x18f37e,_0x581c72){loggers[_0x18f37e[_0xb6a4('0x13')]()][_0x552124]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x581c72[_0xb6a4('0x14')](),_0x331be1?_0x331be1['id']:null,_0x331be1?_0x331be1['name']:null,_0x331be1?_0x331be1[_0xb6a4('0x15')]:null,getInteractionId(_0x3de58c,_0x4e10dd,_0x18f37e),_0x3de58c?JSON[_0xb6a4('0x16')](_0x3de58c):'null');}function updateUser(_0x3b622f,_0x16597e,_0x8ccd40,_0x57a1a5,_0x206502){db[_[_0xb6a4('0xb')](_0x57a1a5)+_0xb6a4('0x17')]['findOne']({'where':{'id':getInteractionId(_0x16597e,_0x8ccd40,_0x57a1a5)}})[_0xb6a4('0x18')](function(_0x1798e3){if(_0x1798e3){return _0x1798e3[_0xb6a4('0x19')]({'UserId':_0x3b622f?_0x3b622f['id']:null});}})[_0xb6a4('0x18')](function(_0x23a038){if(_0x23a038){log('info',_0x3b622f,_0x16597e,_0x8ccd40,_0x57a1a5,_0x206502);}})['catch'](function(){log('error',_0x3b622f,_0x16597e,_0x8ccd40,_0x57a1a5,_0x206502);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x98c2=['Interaction','findOne','update','info','catch','error','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null'];(function(_0x486338,_0x2ab3f9){var _0x4c8298=function(_0x21130d){while(--_0x21130d){_0x486338['push'](_0x486338['shift']());}};_0x4c8298(++_0x2ab3f9);}(_0x98c2,0x128));var _0x298c=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x98c2[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var db=require(_0x298c('0x0'))['db'];var loggers={'openchannel':require(_0x298c('0x1'))(_0x298c('0x2')),'mail':require(_0x298c('0x1'))(_0x298c('0x3')),'fax':require(_0x298c('0x1'))(_0x298c('0x4')),'sms':require(_0x298c('0x1'))(_0x298c('0x5')),'chat':require(_0x298c('0x1'))('chat-interactions'),'whatsapp':require(_0x298c('0x1'))(_0x298c('0x6'))};function getAccountFK(_0x318b9b){return _[_0x298c('0x7')](_0x318b9b)+(_0x318b9b===_0x298c('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x451b6a){return _[_0x298c('0x7')](_0x451b6a)+_0x298c('0x9');}function getInteractionId(_0x1a2313,_0x517637,_0x150eca){if(_0x1a2313&&_0x1a2313[_[_0x298c('0xa')](_0x150eca)+_0x298c('0x9')]){return _0x1a2313[_[_0x298c('0xa')](_0x150eca)+_0x298c('0x9')];}else if(_0x1a2313&&_0x1a2313['id']){return _0x1a2313['id'];}else if(_0x517637&&_0x517637['id']){return _0x517637['id'];}else{return'unknown';}}function getInteractionsTables(_0x44b539){return{'accounts':_0x44b539+'_'+(_0x44b539===_0x298c('0x8')?_0x298c('0xb'):_0x298c('0xc')),'interactions':_0x44b539+_0x298c('0xd'),'interactionsTags':_0x44b539+_0x298c('0xe'),'messages':_0x44b539+_0x298c('0xf'),'userInteractions':_0x298c('0x10')+_0x44b539+_0x298c('0xd')};}function getSelectedTags(_0x4a260a){var _0x288199=[];if(_0x4a260a){_0x288199=Array['isArray'](_0x4a260a)?_0x4a260a:[_0x4a260a];}return _0x288199;}function log(_0x2e4761,_0x66d41e,_0x432079,_0x15df96,_0x449b18,_0x588cfc){loggers[_0x449b18[_0x298c('0x11')]()][_0x2e4761](_0x298c('0x12'),_0x588cfc[_0x298c('0x13')](),_0x66d41e?_0x66d41e['id']:null,_0x66d41e?_0x66d41e['name']:null,_0x66d41e?_0x66d41e[_0x298c('0x14')]:null,getInteractionId(_0x432079,_0x15df96,_0x449b18),_0x432079?JSON[_0x298c('0x15')](_0x432079):_0x298c('0x16'));}function updateUser(_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31){db[_['upperFirst'](_0x20ea9b)+_0x298c('0x17')][_0x298c('0x18')]({'where':{'id':getInteractionId(_0x364891,_0x5c6bcc,_0x20ea9b)}})['then'](function(_0x28842c){if(_0x28842c){return _0x28842c[_0x298c('0x19')]({'UserId':_0x26c2af?_0x26c2af['id']:null});}})['then'](function(_0x2b1ad9){if(_0x2b1ad9){log(_0x298c('0x1a'),_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31);}})[_0x298c('0x1b')](function(){log(_0x298c('0x1c'),_0x26c2af,_0x364891,_0x5c6bcc,_0x20ea9b,_0x313b31);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 61ac808..e6cb456 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 _0xcc87=['User','isUserLimit','crypto','../../mysqldb','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xcc87,0x160));var _0x7cc8=function(_0x3423f8,_0x4ff1e6){_0x3423f8=_0x3423f8-0x0;var _0x29704e=_0xcc87[_0x3423f8];return _0x29704e;};'use strict';var crypto=require(_0x7cc8('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x7cc8('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x195501,_0x34914c){if(_0x195501&&_0x34914c){if(_0x34914c[_0x7cc8('0x2')]&&_0x34914c[_0x7cc8('0x3')]){var _0x5a6ab0=_0x34914c[_0x7cc8('0x2')];var _0x2f8122=_0x34914c[_0x7cc8('0x3')];var _0x2e2a0e=_0x5a6ab0['split']('-')[0x4];var _0x22a292=_0x5a6ab0[_0x7cc8('0x4')]('-')[0x0];var _0x516d85=crypto[_0x7cc8('0x5')]('aes-256-ctr',util[_0x7cc8('0x6')](_0x7cc8('0x7'),_0x2e2a0e,_0x5a6ab0,_0x22a292));var _0x3caff0=_0x516d85[_0x7cc8('0x8')](_0x2f8122,_0x7cc8('0x9'),_0x7cc8('0xa'));_0x3caff0+=_0x516d85[_0x7cc8('0xb')](_0x7cc8('0xa'));var _0x1ccb94=JSON[_0x7cc8('0xc')](_0x3caff0);return _0x1ccb94[_0x7cc8('0xd')](_0x195501)?_0x1ccb94[_0x195501]:null;}}return null;}function isLimit(_0x2f36a2,_0x4d9364,_0x2a89a1,_0x5d7de2){var _0x232c70=_0x4d9364;return compose()[_0x7cc8('0xe')](function(_0xe9f266,_0x5157d0,_0x4f3b99){return db[_0x7cc8('0xf')][_0x7cc8('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x7cc8('0x11')](function(_0x30305e){var _0x6682be=getValueFromLicense(_0x2f36a2,_0x30305e);return _0x6682be?_0x6682be:_0x232c70;})[_0x7cc8('0x11')](function(_0x1988a5){_0x232c70=_0x1988a5;return _0x2a89a1[_0x7cc8('0x12')](_0x5d7de2);})[_0x7cc8('0x11')](function(_0x2abe99){if(_0x2abe99>=_0x232c70){return _0x5157d0['status'](0x193)[_0x7cc8('0x13')]({'message':util[_0x7cc8('0x6')](_0x7cc8('0x14'),_0x2f36a2)});}_0x4f3b99();})[_0x7cc8('0x15')](function(_0x5c693d){_0x4f3b99(_0x5c693d);});});}function isUserLimit(){return isLimit(_0x7cc8('0x16'),0x1,db[_0x7cc8('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x7cc8('0x18')]=isUserLimit; \ No newline at end of file +var _0x2776=['findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License'];(function(_0x277b55,_0x8ba28){var _0xff0d15=function(_0x1beefc){while(--_0x1beefc){_0x277b55['push'](_0x277b55['shift']());}};_0xff0d15(++_0x8ba28);}(_0x2776,0x118));var _0x6277=function(_0x4d1f98,_0x1486b5){_0x4d1f98=_0x4d1f98-0x0;var _0x1992bf=_0x2776[_0x4d1f98];return _0x1992bf;};'use strict';var crypto=require(_0x6277('0x0'));var util=require(_0x6277('0x1'));var compose=require(_0x6277('0x2'));var db=require(_0x6277('0x3'))['db'];var config=require(_0x6277('0x4'));function getValueFromLicense(_0x528b0b,_0x5a08c9){if(_0x528b0b&&_0x5a08c9){if(_0x5a08c9[_0x6277('0x5')]&&_0x5a08c9[_0x6277('0x6')]){var _0xd02b4c=_0x5a08c9[_0x6277('0x5')];var _0xa6a27=_0x5a08c9['license'];var _0x188b27=_0xd02b4c['split']('-')[0x4];var _0x2abcdf=_0xd02b4c['split']('-')[0x0];var _0x2273ef=crypto['createDecipher'](_0x6277('0x7'),util[_0x6277('0x8')](_0x6277('0x9'),_0x188b27,_0xd02b4c,_0x2abcdf));var _0xf6ead7=_0x2273ef[_0x6277('0xa')](_0xa6a27,_0x6277('0xb'),_0x6277('0xc'));_0xf6ead7+=_0x2273ef[_0x6277('0xd')]('utf8');var _0x590a64=JSON[_0x6277('0xe')](_0xf6ead7);return _0x590a64['hasOwnProperty'](_0x528b0b)?_0x590a64[_0x528b0b]:null;}}return null;}function isLimit(_0x46e76e,_0x7032b5,_0x5d248c,_0x195d13){var _0x215473=_0x7032b5;return compose()[_0x6277('0xf')](function(_0x595169,_0x2787bf,_0x4b65d0){return db[_0x6277('0x10')][_0x6277('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x6277('0x12')](function(_0x3d8888){var _0x6dc55=getValueFromLicense(_0x46e76e,_0x3d8888);return _0x6dc55?_0x6dc55:_0x215473;})[_0x6277('0x12')](function(_0x53aeff){_0x215473=_0x53aeff;return _0x5d248c[_0x6277('0x13')](_0x195d13);})[_0x6277('0x12')](function(_0x178033){if(_0x178033>=_0x215473){return _0x2787bf['status'](0x193)[_0x6277('0x14')]({'message':util['format'](_0x6277('0x15'),_0x46e76e)});}_0x4b65d0();})['catch'](function(_0x2b76a1){_0x4b65d0(_0x2b76a1);});});}function isUserLimit(){return isLimit(_0x6277('0x16'),0x1,db[_0x6277('0x17')],{'where':{'$or':[{'role':_0x6277('0x18')},{'role':_0x6277('0x19')}]}});}exports[_0x6277('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c4fc46f..65247e4 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 _0x7876=['<>\x20?','$startsWith','$lt','<\x20?','$gt','>\x20?','BETWEEN\x20?\x20AND\x20?','$in','$substring','start','$endsWith','pop','utcOffset','hours','minutes','format','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','indexOf','conditions','push','DATE','operator','$eq','$between','value','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x5da8e9,_0x3beb32){var _0x24a605=function(_0x284ab3){while(--_0x284ab3){_0x5da8e9['push'](_0x5da8e9['shift']());}};_0x24a605(++_0x3beb32);}(_0x7876,0x14e));var _0x6787=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0x7876[_0x4f3f71];return _0x559c25;};'use strict';var _=require(_0x6787('0x0'));var moment=require(_0x6787('0x1'));exports[_0x6787('0x2')]=function(_0x50b62e){var _0x3d697c={'conditions':[]};_0x3d697c[_0x6787('0x3')]=_[_0x6787('0x4')](_0x50b62e,_0x6787('0x5'))?'or':_0x6787('0x6');var _0x4e4a49=_0x50b62e[_0x6787('0x7')](_0x6787('0x8'),'')['replace'](_0x6787('0x5'),'')[_0x6787('0x9')]('||');for(var _0x5d48c4=0x0;_0x5d48c4<_0x4e4a49[_0x6787('0xa')];_0x5d48c4++){var _0x55471e=_0x4e4a49[_0x5d48c4][_0x6787('0x9')](':=');var _0xafb9c3=_0x55471e[0x0];var _0x4967c2=_0x55471e['slice'](0x1);_0x4967c2[_0x6787('0xb')](function(_0x3624cb){var _0x54da98=_0x3624cb['split']('[')[_0x6787('0xc')]();var _0x5e972c=_0x3624cb[_0x6787('0xd')](/\[(.*?)\]/g);_0x5e972c['forEach'](function(_0x13003b){var _0x3ca0cf=_0x13003b['split']('[')['filter'](function(_0x14c09b){return _0x14c09b[_0x6787('0xe')](']')>-0x1;})['map'](function(_0x45bd38){return _0x45bd38['split'](']')[0x0];})[0x0];_0x3d697c[_0x6787('0xf')][_0x6787('0x10')]({'field':_0xafb9c3,'operator':_0x54da98,'value':_0x3ca0cf});});});}return _0x3d697c;};exports['buildExpression']=function(_0x141c0d,_0x4300de,_0xd957e2){var _0x37a7dd={};if(_0x4300de===_0x6787('0x11')){if(_0xd957e2[_0x6787('0x12')]===_0x6787('0x13')){_0xd957e2[_0x6787('0x12')]=_0x6787('0x14');_0xd957e2[_0x6787('0x15')]+=','+_0xd957e2[_0x6787('0x15')];}else if(_['includes'](['$gt',_0x6787('0x16')],_0xd957e2[_0x6787('0x12')])){_0xd957e2['value']=moment(_0xd957e2[_0x6787('0x15')])[_0x6787('0x17')](0x1,_0x6787('0x18'))['format'](_0x6787('0x19'));}}if(_0xd957e2[_0x6787('0x1a')]){_0x4300de=_0xd957e2[_0x6787('0x1a')];_0x37a7dd[_0x6787('0x1b')]=_0x6787('0x1c')+_0x141c0d+'.'+_0xd957e2[_0x6787('0x1d')]+_0x6787('0x1e')+_0xd957e2[_0x6787('0x1a')]+')\x20'+parseOperator(_0xd957e2[_0x6787('0x12')]);}else{_0x37a7dd['text']=_0x141c0d+'.'+_0xd957e2[_0x6787('0x1d')]+'\x20'+parseOperator(_0xd957e2[_0x6787('0x12')]);}if(_['includes']([_0x6787('0x1f'),_0x6787('0x20')],_0xd957e2[_0x6787('0x12')]))_0x37a7dd[_0x6787('0x1b')]='('+_0x37a7dd['text']+'\x20OR\x20'+_0x141c0d+'.'+_0xd957e2[_0x6787('0x1d')]+_0x6787('0x21');_0x37a7dd[_0x6787('0x15')]=parseValue(_0x4300de,_0xd957e2[_0x6787('0x12')],_0xd957e2['value']);return _0x37a7dd;};function parseOperator(_0x48a45b){var _0x26c329;switch(_0x48a45b){case'$in':_0x26c329=_0x6787('0x22');break;case _0x6787('0x20'):_0x26c329=_0x6787('0x23');break;case _0x6787('0x13'):_0x26c329=_0x6787('0x24');break;case _0x6787('0x1f'):_0x26c329=_0x6787('0x25');break;case'$substring':case _0x6787('0x26'):case'$endsWith':_0x26c329='LIKE\x20?';break;case _0x6787('0x27'):_0x26c329=_0x6787('0x28');break;case _0x6787('0x29'):_0x26c329=_0x6787('0x2a');break;case _0x6787('0x16'):_0x26c329='<=\x20?';break;case'$gte':_0x26c329='>=\x20?';break;case'$between':_0x26c329=_0x6787('0x2b');break;}return _0x26c329;}function parseValue(_0x585a22,_0x362842,_0x17a102){var _0x3f8b91={'start':undefined,'end':undefined};switch(_0x362842){case _0x6787('0x2c'):case _0x6787('0x20'):_0x3f8b91['start']=_0x17a102[_0x6787('0x9')](',');break;case _0x6787('0x2d'):_0x3f8b91[_0x6787('0x2e')]='%'+_0x17a102+'%';break;case _0x6787('0x26'):_0x3f8b91[_0x6787('0x2e')]=_0x17a102+'%';break;case _0x6787('0x2f'):_0x3f8b91['start']='%'+_0x17a102;break;case _0x6787('0x14'):var _0x311c98=_0x17a102[_0x6787('0x9')](',');var _0x17a102=_0x311c98[_0x6787('0xc')]();var _0x359b00=_0x311c98[_0x6787('0x30')]();if(_0x585a22===_0x6787('0x11')){_0x17a102=moment(_0x17a102)[_0x6787('0x31')](0x0,!![])['format']();_0x359b00=moment(_0x359b00)['utcOffset'](0x0,!![])[_0x6787('0x17')](0x17,_0x6787('0x32'))[_0x6787('0x17')](0x3b,_0x6787('0x33'))[_0x6787('0x17')](0x3b,'seconds')[_0x6787('0x34')]();}_0x3f8b91={'start':_0x17a102,'end':_0x359b00};break;default:_0x3f8b91['start']=_0x17a102;break;}return _0x3f8b91;} \ No newline at end of file +var _0xb323=['$gt','$lte','add','format','castTo','text','CAST(','field','includes','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$in','start','utcOffset','minutes','seconds','moment','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value'];(function(_0x5dc191,_0x27363c){var _0x1716be=function(_0x4aaa8b){while(--_0x4aaa8b){_0x5dc191['push'](_0x5dc191['shift']());}};_0x1716be(++_0x27363c);}(_0xb323,0x1ac));var _0x3b32=function(_0x5e71a6,_0x5487ce){_0x5e71a6=_0x5e71a6-0x0;var _0x292b4d=_0xb323[_0x5e71a6];return _0x292b4d;};'use strict';var _=require('lodash');var moment=require(_0x3b32('0x0'));exports['parseSearch']=function(_0x3c761d){var _0x5c55a6={'conditions':[]};_0x5c55a6['sqlOperator']=_[_0x3b32('0x1')](_0x3c761d,_0x3b32('0x2'))?'or':_0x3b32('0x3');var _0x332952=_0x3c761d[_0x3b32('0x4')](_0x3b32('0x5'),'')['replace']('[$or]','')[_0x3b32('0x6')]('||');for(var _0x44d41d=0x0;_0x44d41d<_0x332952[_0x3b32('0x7')];_0x44d41d++){var _0x2d9333=_0x332952[_0x44d41d][_0x3b32('0x6')](':=');var _0x58fd48=_0x2d9333[0x0];var _0x504322=_0x2d9333[_0x3b32('0x8')](0x1);_0x504322[_0x3b32('0x9')](function(_0x333462){var _0x490be0=_0x333462[_0x3b32('0x6')]('[')[_0x3b32('0xa')]();var _0x462492=_0x333462[_0x3b32('0xb')](/\[(.*?)\]/g);_0x462492[_0x3b32('0x9')](function(_0x171911){var _0x4ac7b2=_0x171911[_0x3b32('0x6')]('[')['filter'](function(_0x249171){return _0x249171[_0x3b32('0xc')](']')>-0x1;})[_0x3b32('0xd')](function(_0x490858){return _0x490858[_0x3b32('0x6')](']')[0x0];})[0x0];_0x5c55a6[_0x3b32('0xe')][_0x3b32('0xf')]({'field':_0x58fd48,'operator':_0x490be0,'value':_0x4ac7b2});});});}return _0x5c55a6;};exports[_0x3b32('0x10')]=function(_0x2d289b,_0x5aed12,_0x4f82bc){var _0x4f439b={};if(_0x5aed12===_0x3b32('0x11')){if(_0x4f82bc[_0x3b32('0x12')]===_0x3b32('0x13')){_0x4f82bc[_0x3b32('0x12')]=_0x3b32('0x14');_0x4f82bc[_0x3b32('0x15')]+=','+_0x4f82bc[_0x3b32('0x15')];}else if(_['includes']([_0x3b32('0x16'),_0x3b32('0x17')],_0x4f82bc['operator'])){_0x4f82bc[_0x3b32('0x15')]=moment(_0x4f82bc[_0x3b32('0x15')])[_0x3b32('0x18')](0x1,'days')[_0x3b32('0x19')]('YYYY-MM-DD');}}if(_0x4f82bc[_0x3b32('0x1a')]){_0x5aed12=_0x4f82bc[_0x3b32('0x1a')];_0x4f439b[_0x3b32('0x1b')]=_0x3b32('0x1c')+_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+'\x20AS\x20'+_0x4f82bc[_0x3b32('0x1a')]+')\x20'+parseOperator(_0x4f82bc[_0x3b32('0x12')]);}else{_0x4f439b['text']=_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+'\x20'+parseOperator(_0x4f82bc['operator']);}if(_[_0x3b32('0x1e')]([_0x3b32('0x1f'),_0x3b32('0x20')],_0x4f82bc['operator']))_0x4f439b[_0x3b32('0x1b')]='('+_0x4f439b[_0x3b32('0x1b')]+'\x20OR\x20'+_0x2d289b+'.'+_0x4f82bc[_0x3b32('0x1d')]+_0x3b32('0x21');_0x4f439b[_0x3b32('0x15')]=parseValue(_0x5aed12,_0x4f82bc[_0x3b32('0x12')],_0x4f82bc[_0x3b32('0x15')]);return _0x4f439b;};function parseOperator(_0x5f3e38){var _0x4e4afa;switch(_0x5f3e38){case'$in':_0x4e4afa=_0x3b32('0x22');break;case'$notIn':_0x4e4afa='NOT\x20IN\x20?';break;case _0x3b32('0x13'):_0x4e4afa=_0x3b32('0x23');break;case'$ne':_0x4e4afa=_0x3b32('0x24');break;case _0x3b32('0x25'):case _0x3b32('0x26'):case _0x3b32('0x27'):_0x4e4afa='LIKE\x20?';break;case _0x3b32('0x28'):_0x4e4afa=_0x3b32('0x29');break;case'$gt':_0x4e4afa=_0x3b32('0x2a');break;case _0x3b32('0x17'):_0x4e4afa=_0x3b32('0x2b');break;case'$gte':_0x4e4afa=_0x3b32('0x2c');break;case _0x3b32('0x14'):_0x4e4afa='BETWEEN\x20?\x20AND\x20?';break;}return _0x4e4afa;}function parseValue(_0x53c2cc,_0x1ae4dd,_0x21a072){var _0x31de5b={'start':undefined,'end':undefined};switch(_0x1ae4dd){case _0x3b32('0x2d'):case'$notIn':_0x31de5b['start']=_0x21a072[_0x3b32('0x6')](',');break;case _0x3b32('0x25'):_0x31de5b[_0x3b32('0x2e')]='%'+_0x21a072+'%';break;case _0x3b32('0x26'):_0x31de5b[_0x3b32('0x2e')]=_0x21a072+'%';break;case _0x3b32('0x27'):_0x31de5b[_0x3b32('0x2e')]='%'+_0x21a072;break;case _0x3b32('0x14'):var _0x5e65a0=_0x21a072[_0x3b32('0x6')](',');var _0x21a072=_0x5e65a0[_0x3b32('0xa')]();var _0x19eaa8=_0x5e65a0['pop']();if(_0x53c2cc==='DATE'){_0x21a072=moment(_0x21a072)[_0x3b32('0x2f')](0x0,!![])[_0x3b32('0x19')]();_0x19eaa8=moment(_0x19eaa8)[_0x3b32('0x2f')](0x0,!![])[_0x3b32('0x18')](0x17,'hours')[_0x3b32('0x18')](0x3b,_0x3b32('0x30'))[_0x3b32('0x18')](0x3b,_0x3b32('0x31'))[_0x3b32('0x19')]();}_0x31de5b={'start':_0x21a072,'end':_0x19eaa8};break;default:_0x31de5b['start']=_0x21a072;break;}return _0x31de5b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3454b91..cb43eda 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 _0x3c70=['lodash','sequelize','moment','parse','keys','model','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','$gte','YYYY-MM-DD','utc','format','subtract','name','isArray','offset','map','indexOf','priority','col','unsigned','DESC','cast','ASC','omit','isObject','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','join','getOptions','query','$id','intersection','attributes','nolimit','limit','order','sort','where','pick','filter','object','includes','columns','value','merge','VIRTUAL','lower','options','include','includeAll'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x3c70,0x10c));var _0x03c7=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x3c70[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x03c7('0x0'));var sequelize=require(_0x03c7('0x1'));var moment=require(_0x03c7('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1168b3){var _0x15adad=['ne'];try{var _0x1cd556=JSON[_0x03c7('0x3')](_0x1168b3);var _0x38a36b=Object[_0x03c7('0x4')](_0x1cd556)[0x0];return _0x15adad['includes'](_0x38a36b);}catch(_0x1e9745){return![];}}function getOperatorValue(_0x4f774e){var _0x5b6c32=JSON[_0x03c7('0x3')](_0x4f774e);var _0x44022f=Object['keys'](_0x5b6c32)[0x0];var _0x263185=_0x5b6c32[_0x44022f];return{['$'+_0x44022f]:_0x263185};}function parseIncludeModel(_0x1b6acc){var _0x332fb3=JSON['parse'](_0x1b6acc);return{'model':db[_0x332fb3[_0x03c7('0x5')]],'as':_0x332fb3['alias'],'attributes':_0x332fb3[_0x03c7('0x6')],'raw':_0x332fb3[_0x03c7('0x7')]};}exports['fields']=function(_0x856199){var _0x2b62fb=null;if(_0x856199){_0x2b62fb=_0x856199[_0x03c7('0x8')](',');}return _0x2b62fb;};exports[_0x03c7('0x9')]=function(_0x19fbd,_0x563270){var _0x4a376b={};if(!_[_0x03c7('0xa')](_0x19fbd)){_[_0x03c7('0xb')](_0x19fbd,function(_0x49697f,_0x44ba3d){try{if(_0x563270){var _0x35b1d1=_[_0x03c7('0xc')](_0x563270,{'name':_0x44ba3d})||{};if(hasSequelizeOperator(_0x49697f)){_0x4a376b[_0x44ba3d]=getOperatorValue(_0x49697f);}else if(_0x35b1d1[_0x03c7('0xd')]===_0x03c7('0xe')&&_['isPlainObject'](_0x49697f)){var _0x23b568=JSON['parse'](_0x49697f);var _0xdc48a7={'$gte':moment(moment(_0x23b568[_0x03c7('0xf')])['format'](_0x03c7('0x10')))[_0x03c7('0x11')]()[_0x03c7('0x12')](),'$lte':moment(moment(_0x23b568['$lte'])[_0x03c7('0x12')](_0x03c7('0x10')))[_0x03c7('0x11')]()[_0x03c7('0x13')](0x1,'s')[_0x03c7('0x12')]()};_0x4a376b[_0x44ba3d]=_0xdc48a7;}else if(_0x35b1d1[_0x03c7('0x14')]==='uniqueid'){_0x4a376b[_0x44ba3d]=_0x49697f;}else{_0x4a376b[_0x44ba3d]=_['isArray'](_0x49697f)?_0x49697f:JSON[_0x03c7('0x3')](_0x49697f);}}else{_0x4a376b[_0x44ba3d]=_[_0x03c7('0x15')](_0x49697f)?_0x49697f:JSON[_0x03c7('0x3')](_0x49697f);}}catch(_0x2f4a9d){_0x4a376b[_0x44ba3d]=_0x49697f[_0x03c7('0x8')](',');}});}return _0x4a376b;};exports['limit']=function(_0x1e3de1){_0x1e3de1=parseInt(_0x1e3de1,0xa);if(!_0x1e3de1||_0x1e3de1<0x0){_0x1e3de1=LIMIT_VALUE;}return _0x1e3de1;};exports[_0x03c7('0x16')]=function(_0x5416da){_0x5416da=parseInt(_0x5416da,0xa);if(!_0x5416da||_0x5416da<0x0){_0x5416da=0x0;}return _0x5416da;};exports['sort']=function(_0x518d04){var _0x562e62,_0x734b3b=null;if(_0x518d04){_0x562e62=_0x518d04[_0x03c7('0x8')](',');_0x734b3b=_[_0x03c7('0x17')](_0x562e62,function(_0x29bb19){if(_0x29bb19[_0x03c7('0x18')]('-')===0x0){return[_0x29bb19===_0x03c7('0x19')?sequelize['cast'](sequelize[_0x03c7('0x1a')]('priority'),_0x03c7('0x1b')):_0x29bb19['substr'](0x1),_0x03c7('0x1c')];}else{return[_0x29bb19==='priority'?sequelize[_0x03c7('0x1d')](sequelize[_0x03c7('0x1a')](_0x03c7('0x19')),'unsigned'):_0x29bb19,_0x03c7('0x1e')];}});}return _0x734b3b;};exports[_0x03c7('0x1f')]=function(_0x222912,_0x982af1){if(_['isEmpty'](_0x222912)){return _0x222912;}if(_['isArray'](_0x222912)){for(var _0x270b9a=0x0;_0x270b9a<_0x222912['length'];_0x270b9a+=0x1){_0x222912[_0x270b9a]=this[_0x03c7('0x1f')](_0x222912[_0x270b9a],_0x982af1);}return _0x222912;}if(!_[_0x03c7('0x20')](_0x222912)){return _0x222912;}if(_['isString'](_0x982af1)){_0x982af1=[_0x982af1];}if(!_[_0x03c7('0x15')](_0x982af1)){return _0x222912;}for(var _0x462f08=0x0;_0x462f08<_0x982af1[_0x03c7('0x21')];_0x462f08+=0x1){_[_0x03c7('0x22')](_0x222912,_0x982af1[_0x462f08]);}for(var _0x1e2b90 in _0x222912){if(_0x222912[_0x03c7('0x23')](_0x1e2b90)){_0x222912[_0x1e2b90]=this[_0x03c7('0x1f')](_0x222912[_0x1e2b90],_0x982af1);}}return _0x222912;};exports[_0x03c7('0x24')]=function(_0x306699){return _0x306699[_0x03c7('0x25')](RegExp(_0x03c7('0x26')))?!![]:![];};exports['isEmail']=function(_0x19c3ff){return _0x19c3ff[_0x03c7('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x03c7('0x27')]=function(_0x5ed9ca,_0x4d6871){var _0x54e183=[];var _0x3ab0c9=/[ `!@#$%^&*()_\-?~]/;var _0x5de139=_0x4d6871?_0x03c7('0x28'):_0x03c7('0x29');_0x5ed9ca[_0x03c7('0x8')](/[ ,]+/)['forEach'](function(_0x1e575a){_0x1e575a=_0x1e575a[_0x03c7('0x2a')](/([^:]")"+/g,'$1');_0x1e575a='+'+_0x1e575a+'*';var _0x35b143=_0x1e575a['match'](_0x3ab0c9);if(_0x35b143){_0x1e575a='\x22'+_0x1e575a+'\x22';}_0x54e183[_0x03c7('0x2b')](_0x1e575a);});_0x5de139=_0x5de139[_0x03c7('0x2a')]('{EXPR}',_0x54e183[_0x03c7('0x2c')]('\x20'));return _0x5de139;};exports[_0x03c7('0x2d')]=function(_0x522b3e,_0xb59d6a,_0x28048b){var _0x2f9001={},_0x48a30b={};if(_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x2f')]){_0xb59d6a[_0x03c7('0x2e')]['id']=_0xb59d6a[_0x03c7('0x2e')]['$id'];delete _0xb59d6a[_0x03c7('0x2e')]['$id'];}_0x2f9001[_0x03c7('0x5')]=_[_0x03c7('0x17')](_0x522b3e,_0x03c7('0x14'));_0x2f9001[_0x03c7('0x2e')]=_[_0x03c7('0x4')](_0xb59d6a[_0x03c7('0x2e')]);_0x2f9001['filters']=_['intersection'](_0x2f9001[_0x03c7('0x5')],_0x2f9001[_0x03c7('0x2e')]);_0x48a30b['attributes']=_[_0x03c7('0x30')](_0x2f9001[_0x03c7('0x5')],this[_0x03c7('0x6')](_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x6')]));_0x48a30b[_0x03c7('0x31')]=_0x48a30b[_0x03c7('0x31')]['length']?_0x48a30b['attributes']:_0x2f9001[_0x03c7('0x5')];if(!_0xb59d6a['query']['hasOwnProperty'](_0x03c7('0x32'))){_0x48a30b[_0x03c7('0x33')]=this[_0x03c7('0x33')](_0xb59d6a[_0x03c7('0x2e')]['limit']);_0x48a30b[_0x03c7('0x16')]=this['offset'](_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x16')]);}_0x48a30b[_0x03c7('0x34')]=this[_0x03c7('0x35')](_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x35')]);_0x48a30b[_0x03c7('0x36')]=this[_0x03c7('0x9')](_[_0x03c7('0x37')](_0xb59d6a['query'],_0x2f9001['filters']),_0x522b3e);if(_0xb59d6a[_0x03c7('0x2e')]['filter']){var _0x57a59e=_0x522b3e;var _0x129bbe=_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x38')];if(typeof _0x129bbe===_0x03c7('0x39')){_0x57a59e=_['filter'](_0x522b3e,function(_0x12f1d2){return _[_0x03c7('0x3a')](_0x129bbe[_0x03c7('0x3b')],_0x12f1d2['name']);});_0x129bbe=_0x129bbe[_0x03c7('0x3c')];}_0x48a30b[_0x03c7('0x36')]=_[_0x03c7('0x3d')](_0x48a30b[_0x03c7('0x36')],{'$or':_[_0x03c7('0x17')](_0x57a59e,function(_0x552940){if(_0x552940['type']!==_0x03c7('0x3e')){if(_0x28048b){return sequelize[_0x03c7('0x36')](sequelize['fn'](_0x03c7('0x3f'),sequelize['col'](_0x552940[_0x03c7('0x14')])),{'$like':sequelize['fn']('lower','%'+_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x38')]+'%')});}else{var _0x1258e={};_0x1258e[_0x552940['name']]={'$like':'%'+_0xb59d6a[_0x03c7('0x2e')][_0x03c7('0x38')]+'%'};return _0x1258e;}}})});}_0x48a30b=_[_0x03c7('0x3d')]({},_0x48a30b,_0xb59d6a[_0x03c7('0x40')]);return _0x48a30b;};exports[_0x03c7('0x41')]=function(_0x5d75f9){var _0x3b177d=[];if(_0x5d75f9[_0x03c7('0x42')]){_0x3b177d[_0x03c7('0x2b')]({'all':!![]});}else if(_0x5d75f9[_0x03c7('0x41')]){if(Array[_0x03c7('0x15')](_0x5d75f9['include'])){_0x3b177d=Object[_0x03c7('0x4')](_0x5d75f9[_0x03c7('0x41')])[_0x03c7('0x17')](function(_0x46668e){return parseIncludeModel(_0x5d75f9[_0x03c7('0x41')][_0x46668e]);});}else{var _0x1bd6ed=parseIncludeModel(_0x5d75f9[_0x03c7('0x41')]);_0x3b177d[_0x03c7('0x2b')](_0x1bd6ed);}}return _0x3b177d;}; \ No newline at end of file +var _0x7604=['VIRTUAL','lower','options','include','includeAll','map','lodash','sequelize','moment','../../mysqldb','parse','includes','keys','model','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','$lte','YYYY-MM-DD','utc','uniqueid','isArray','limit','offset','sort','priority','cast','substr','DESC','unsigned','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','name','attributes','intersection','order','where','pick','filter','object','columns','value','merge'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7604,0xd2));var _0x4760=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7604[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x4760('0x0'));var sequelize=require(_0x4760('0x1'));var moment=require(_0x4760('0x2'));var db=require(_0x4760('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4be602){var _0x49c9cd=['ne'];try{var _0xfa7b99=JSON[_0x4760('0x4')](_0x4be602);var _0x18d2bf=Object['keys'](_0xfa7b99)[0x0];return _0x49c9cd[_0x4760('0x5')](_0x18d2bf);}catch(_0x202417){return![];}}function getOperatorValue(_0x4b0681){var _0x3d707b=JSON[_0x4760('0x4')](_0x4b0681);var _0x5b139b=Object[_0x4760('0x6')](_0x3d707b)[0x0];var _0xc10f20=_0x3d707b[_0x5b139b];return{['$'+_0x5b139b]:_0xc10f20};}function parseIncludeModel(_0xe0edfa){var _0xeef9eb=JSON[_0x4760('0x4')](_0xe0edfa);return{'model':db[_0xeef9eb[_0x4760('0x7')]],'as':_0xeef9eb['alias'],'attributes':_0xeef9eb[_0x4760('0x8')],'raw':_0xeef9eb[_0x4760('0x9')]};}exports[_0x4760('0x8')]=function(_0x13a434){var _0x30437e=null;if(_0x13a434){_0x30437e=_0x13a434[_0x4760('0xa')](',');}return _0x30437e;};exports[_0x4760('0xb')]=function(_0x221b3f,_0x22e06b){var _0x2661bf={};if(!_[_0x4760('0xc')](_0x221b3f)){_[_0x4760('0xd')](_0x221b3f,function(_0x5b3871,_0x159624){try{if(_0x22e06b){var _0xe44c17=_[_0x4760('0xe')](_0x22e06b,{'name':_0x159624})||{};if(hasSequelizeOperator(_0x5b3871)){_0x2661bf[_0x159624]=getOperatorValue(_0x5b3871);}else if(_0xe44c17[_0x4760('0xf')]===_0x4760('0x10')&&_[_0x4760('0x11')](_0x5b3871)){var _0x7e399=JSON[_0x4760('0x4')](_0x5b3871);var _0x33b509={'$gte':moment(moment(_0x7e399['$gte'])[_0x4760('0x12')]('YYYY-MM-DD'))['utc']()[_0x4760('0x12')](),'$lte':moment(moment(_0x7e399[_0x4760('0x13')])[_0x4760('0x12')](_0x4760('0x14')))[_0x4760('0x15')]()['subtract'](0x1,'s')['format']()};_0x2661bf[_0x159624]=_0x33b509;}else if(_0xe44c17['name']===_0x4760('0x16')){_0x2661bf[_0x159624]=_0x5b3871;}else{_0x2661bf[_0x159624]=_[_0x4760('0x17')](_0x5b3871)?_0x5b3871:JSON[_0x4760('0x4')](_0x5b3871);}}else{_0x2661bf[_0x159624]=_[_0x4760('0x17')](_0x5b3871)?_0x5b3871:JSON['parse'](_0x5b3871);}}catch(_0x2b4656){_0x2661bf[_0x159624]=_0x5b3871[_0x4760('0xa')](',');}});}return _0x2661bf;};exports[_0x4760('0x18')]=function(_0x3f5739){_0x3f5739=parseInt(_0x3f5739,0xa);if(!_0x3f5739||_0x3f5739<0x0){_0x3f5739=LIMIT_VALUE;}return _0x3f5739;};exports[_0x4760('0x19')]=function(_0x31e76f){_0x31e76f=parseInt(_0x31e76f,0xa);if(!_0x31e76f||_0x31e76f<0x0){_0x31e76f=0x0;}return _0x31e76f;};exports[_0x4760('0x1a')]=function(_0x316666){var _0x723e12,_0x348c6d=null;if(_0x316666){_0x723e12=_0x316666[_0x4760('0xa')](',');_0x348c6d=_['map'](_0x723e12,function(_0x190cce){if(_0x190cce['indexOf']('-')===0x0){return[_0x190cce===_0x4760('0x1b')?sequelize[_0x4760('0x1c')](sequelize['col'](_0x4760('0x1b')),'unsigned'):_0x190cce[_0x4760('0x1d')](0x1),_0x4760('0x1e')];}else{return[_0x190cce===_0x4760('0x1b')?sequelize[_0x4760('0x1c')](sequelize['col'](_0x4760('0x1b')),_0x4760('0x1f')):_0x190cce,_0x4760('0x20')];}});}return _0x348c6d;};exports[_0x4760('0x21')]=function(_0x358594,_0x45afb7){if(_[_0x4760('0xc')](_0x358594)){return _0x358594;}if(_[_0x4760('0x17')](_0x358594)){for(var _0x5caae7=0x0;_0x5caae7<_0x358594['length'];_0x5caae7+=0x1){_0x358594[_0x5caae7]=this[_0x4760('0x21')](_0x358594[_0x5caae7],_0x45afb7);}return _0x358594;}if(!_[_0x4760('0x22')](_0x358594)){return _0x358594;}if(_[_0x4760('0x23')](_0x45afb7)){_0x45afb7=[_0x45afb7];}if(!_[_0x4760('0x17')](_0x45afb7)){return _0x358594;}for(var _0x6b9bf4=0x0;_0x6b9bf4<_0x45afb7[_0x4760('0x24')];_0x6b9bf4+=0x1){_['unset'](_0x358594,_0x45afb7[_0x6b9bf4]);}for(var _0x5e3d4d in _0x358594){if(_0x358594[_0x4760('0x25')](_0x5e3d4d)){_0x358594[_0x5e3d4d]=this['omit'](_0x358594[_0x5e3d4d],_0x45afb7);}}return _0x358594;};exports[_0x4760('0x26')]=function(_0x35b132){return _0x35b132[_0x4760('0x27')](RegExp(_0x4760('0x28')))?!![]:![];};exports['isEmail']=function(_0x42df78){return _0x42df78[_0x4760('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x4760('0x29')]=function(_0x1b0e92,_0x5710d9){var _0x47096c=[];var _0x5a905e=/[ `!@#$%^&*()_\-?~]/;var _0x4f9123=_0x5710d9?_0x4760('0x2a'):_0x4760('0x2b');_0x1b0e92['split'](/[ ,]+/)[_0x4760('0x2c')](function(_0xcf9e04){_0xcf9e04=_0xcf9e04[_0x4760('0x2d')](/([^:]")"+/g,'$1');_0xcf9e04='+'+_0xcf9e04+'*';var _0x2758ad=_0xcf9e04[_0x4760('0x27')](_0x5a905e);if(_0x2758ad){_0xcf9e04='\x22'+_0xcf9e04+'\x22';}_0x47096c[_0x4760('0x2e')](_0xcf9e04);});_0x4f9123=_0x4f9123[_0x4760('0x2d')](_0x4760('0x2b'),_0x47096c[_0x4760('0x2f')]('\x20'));return _0x4f9123;};exports[_0x4760('0x30')]=function(_0x2a7024,_0xa48dfa,_0x57517f){var _0x2e637e={},_0x1651f0={};if(_0xa48dfa[_0x4760('0x31')][_0x4760('0x32')]){_0xa48dfa[_0x4760('0x31')]['id']=_0xa48dfa[_0x4760('0x31')][_0x4760('0x32')];delete _0xa48dfa[_0x4760('0x31')][_0x4760('0x32')];}_0x2e637e[_0x4760('0x7')]=_['map'](_0x2a7024,_0x4760('0x33'));_0x2e637e[_0x4760('0x31')]=_[_0x4760('0x6')](_0xa48dfa[_0x4760('0x31')]);_0x2e637e[_0x4760('0xb')]=_['intersection'](_0x2e637e[_0x4760('0x7')],_0x2e637e[_0x4760('0x31')]);_0x1651f0[_0x4760('0x34')]=_[_0x4760('0x35')](_0x2e637e[_0x4760('0x7')],this[_0x4760('0x8')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x8')]));_0x1651f0[_0x4760('0x34')]=_0x1651f0[_0x4760('0x34')][_0x4760('0x24')]?_0x1651f0['attributes']:_0x2e637e[_0x4760('0x7')];if(!_0xa48dfa['query'][_0x4760('0x25')]('nolimit')){_0x1651f0[_0x4760('0x18')]=this[_0x4760('0x18')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x18')]);_0x1651f0[_0x4760('0x19')]=this[_0x4760('0x19')](_0xa48dfa[_0x4760('0x31')]['offset']);}_0x1651f0[_0x4760('0x36')]=this[_0x4760('0x1a')](_0xa48dfa[_0x4760('0x31')][_0x4760('0x1a')]);_0x1651f0[_0x4760('0x37')]=this[_0x4760('0xb')](_[_0x4760('0x38')](_0xa48dfa['query'],_0x2e637e[_0x4760('0xb')]),_0x2a7024);if(_0xa48dfa[_0x4760('0x31')][_0x4760('0x39')]){var _0x30b39f=_0x2a7024;var _0xd8e960=_0xa48dfa['query'][_0x4760('0x39')];if(typeof _0xd8e960===_0x4760('0x3a')){_0x30b39f=_['filter'](_0x2a7024,function(_0x391024){return _['includes'](_0xd8e960[_0x4760('0x3b')],_0x391024[_0x4760('0x33')]);});_0xd8e960=_0xd8e960[_0x4760('0x3c')];}_0x1651f0[_0x4760('0x37')]=_[_0x4760('0x3d')](_0x1651f0[_0x4760('0x37')],{'$or':_['map'](_0x30b39f,function(_0x44153f){if(_0x44153f[_0x4760('0xf')]!==_0x4760('0x3e')){if(_0x57517f){return sequelize[_0x4760('0x37')](sequelize['fn'](_0x4760('0x3f'),sequelize['col'](_0x44153f[_0x4760('0x33')])),{'$like':sequelize['fn'](_0x4760('0x3f'),'%'+_0xa48dfa[_0x4760('0x31')][_0x4760('0x39')]+'%')});}else{var _0x415178={};_0x415178[_0x44153f['name']]={'$like':'%'+_0xa48dfa[_0x4760('0x31')]['filter']+'%'};return _0x415178;}}})});}_0x1651f0=_[_0x4760('0x3d')]({},_0x1651f0,_0xa48dfa[_0x4760('0x40')]);return _0x1651f0;};exports[_0x4760('0x41')]=function(_0x248ebf){var _0x3d06f3=[];if(_0x248ebf[_0x4760('0x42')]){_0x3d06f3[_0x4760('0x2e')]({'all':!![]});}else if(_0x248ebf['include']){if(Array[_0x4760('0x17')](_0x248ebf['include'])){_0x3d06f3=Object[_0x4760('0x6')](_0x248ebf[_0x4760('0x41')])[_0x4760('0x43')](function(_0xa17b22){return parseIncludeModel(_0x248ebf[_0x4760('0x41')][_0xa17b22]);});}else{var _0x52c2e9=parseIncludeModel(_0x248ebf[_0x4760('0x41')]);_0x3d06f3[_0x4760('0x2e')](_0x52c2e9);}}return _0x3d06f3;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 85cb462..7ffa395 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','faxStatusTime','smsStatusTime','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','every','filter','length','idle','unavailable','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','unknown','pause','*pause','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','resolve','includes','User','findAll','name','fullname','whatsappPause'];(function(_0x45518c,_0x37eac4){var _0x2288ea=function(_0x31f551){while(--_0x31f551){_0x45518c['push'](_0x45518c['shift']());}};_0x2288ea(++_0x37eac4);}(_0xf494,0x1c6));var _0x4f49=function(_0x11861e,_0x53194b){_0x11861e=_0x11861e-0x0;var _0x86710a=_0xf494[_0x11861e];return _0x86710a;};'use strict';var _=require(_0x4f49('0x0'));var jayson=require(_0x4f49('0x1'));var db=require(_0x4f49('0x2'))['db'];var amiClient=jayson['client'][_0x4f49('0x3')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x4')][_0x4f49('0x3')]({'port':0x232c});function isAgentPaused(_0x25677c,_0x20c0d7){var _0x2a15fb=[_0x25677c[_0x4f49('0x5')],_0x25677c[_0x4f49('0x6')],_0x25677c[_0x4f49('0x7')],_0x25677c[_0x4f49('0x8')],_0x25677c[_0x4f49('0x9')],_0x25677c['voicePause'],_0x25677c['whatsappPause']];if(!_0x20c0d7)return _[_0x4f49('0xa')](_0x2a15fb);var _0x327bd5=_[_0x4f49('0xb')](_0x2a15fb);return _0x327bd5[_0x4f49('0xc')]>0x0&&_0x327bd5[_0x4f49('0xc')]<_0x2a15fb[_0x4f49('0xc')]?!![]:![];}function isIdle(_0x151d8c){return _0x151d8c===_0x4f49('0xd')||_0x151d8c==='unknown'||_0x151d8c===_0x4f49('0xe')||_0x151d8c===_0x4f49('0xf')||_['isNil'](_0x151d8c);}function isAgentIdle(_0x15e7a1){if(_0x15e7a1['voiceStatus']!=='idle'&&_0x15e7a1[_0x4f49('0x10')]){_0x15e7a1[_0x4f49('0x11')]='pause';return![];}return _[_0x4f49('0xa')]([_0x15e7a1[_0x4f49('0x12')],_0x15e7a1[_0x4f49('0x13')],_0x15e7a1[_0x4f49('0x14')],_0x15e7a1[_0x4f49('0x15')],_0x15e7a1[_0x4f49('0x16')],_0x15e7a1[_0x4f49('0x11')],_0x15e7a1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x4f49('0x17')](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x5878f4){if(_0x5878f4['error']){throw new Error(_0x4f49('0x1a'));}var _0x2ecaaa=_0x5878f4[_0x4f49('0x1b')];return routingClient['request'](_0x4f49('0x18'),{})[_0x4f49('0x19')](function(_0x4e85df){if(_0x4e85df['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x560592=_0x4e85df['result'];return _[_0x4f49('0x1c')]({},_0x2ecaaa,_0x560592);});})[_0x4f49('0x1d')](function(_0x1c2d70){throw _0x1c2d70;});}exports[_0x4f49('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5793ac){var _0x416893=_0x4f49('0x1f');if(isAgentPaused(_0x5793ac))_0x416893=_0x4f49('0x20');else if(isAgentPaused(_0x5793ac,!![]))_0x416893=_0x4f49('0x21');else if(isAgentIdle(_0x5793ac))_0x416893=_0x4f49('0xd');else _0x416893='busy';return _0x416893;}exports[_0x4f49('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x357446,_0x3ae590){var _0x53b57d=_[_0x4f49('0x23')](_0x357446)?_0x357446:[_0x357446];var _0x1d70a7=_[_0x4f49('0x24')](_0x3ae590)+_0x4f49('0x25');var _0x9d30aa=_[_0x4f49('0x26')](_0x53b57d,function(_0x559d98){return db[_0x1d70a7]['findOne']({'where':{'id':_0x559d98}})[_0x4f49('0x19')](function(_0x429de7){if(!_0x429de7)return[];return _0x429de7['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f49('0x27')](_0x9d30aa)[_0x4f49('0x19')](function(_0x35f8e0){var _0x525950=_(_0x35f8e0)[_0x4f49('0x28')]()[_0x4f49('0x26')]('id')[_0x4f49('0x29')]()[_0x4f49('0x2a')]();return _0x525950;});}exports[_0x4f49('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x122404,_0x4915af,_0x50c571){try{if(_0x4915af[_0x4f49('0xc')]>0x0){_0x122404=_0x122404[_0x4f49('0xb')](function(_0x605c91){return _0x4915af['includes'](_0x605c91['id']);});}var _0x3cbfbd=_0x122404[_0x4f49('0xb')](function(_0x43d8e3){var _0x506b20='busy';if(isAgentIdle(_0x43d8e3)){_0x506b20=_0x4f49('0xd');}return _0x506b20===_0x50c571;});return _[_0x4f49('0x26')](_0x3cbfbd,'id');}catch(_0x7a6ea0){throw _0x7a6ea0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1eaac6,_0x35aa33,_0x173657){return Promise[_0x4f49('0x2c')]()[_0x4f49('0x19')](function(){if(_0x35aa33[_0x4f49('0xc')]>0x0){_0x1eaac6=_0x1eaac6[_0x4f49('0xb')](function(_0x45ae19){return _0x35aa33[_0x4f49('0x2d')](_0x45ae19['id']);});}return _0x1eaac6;})[_0x4f49('0x19')](function(){return db[_0x4f49('0x2e')][_0x4f49('0x2f')]({'attributes':['id',_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9'),'voicePause',_0x4f49('0x32'),_0x4f49('0x33')],'where':{'id':{'$in':_[_0x4f49('0x26')](_0x1eaac6,'id')}},'raw':!![]});})[_0x4f49('0x19')](function(_0x1c3af8){return _0x1c3af8[_0x4f49('0x26')](function(_0x2cbe4e){var _0x3ad6a7=_[_0x4f49('0x34')](_0x1eaac6,['id',_0x2cbe4e['id']]);var _0x338db8=filterAgentAttributes(_0x3ad6a7);_[_0x4f49('0x1c')](_0x2cbe4e,_0x338db8);_0x2cbe4e[_0x4f49('0x35')]=getAgentStatus(_0x2cbe4e);return _0x2cbe4e;});})[_0x4f49('0x19')](function(_0x4d2d57){var _0x371282=sortAgentsByStatus(_0x4d2d57,_0x173657);return _[_0x4f49('0x26')](_0x371282,'id');})[_0x4f49('0x1d')](function(_0x26014f){throw _0x26014f;});}exports[_0x4f49('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ee818){var _0xe1b662={'fields':[],'order':null};var _0x25fdf8=_0x3ee818[_0x4f49('0x37')](',');_0xe1b662[_0x4f49('0x38')]=_[_0x4f49('0xb')](_0x25fdf8,function(_0x141db){if(!_0x141db[_0x4f49('0x2d')](_0x4f49('0x35'))){return!![];}_0xe1b662['order']=_[_0x4f49('0x39')](_0x141db,'-')?_0x4f49('0x3a'):'ASC';return![];});return _0xe1b662;}exports[_0x4f49('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xbf05f3){if(!_0xbf05f3){_0xbf05f3='fullname,internal';}if(_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x31'))&&!_0xbf05f3[_0x4f49('0x2d')](_0x4f49('0x3c'))){var _0x3bfe7e=_0xbf05f3[_0x4f49('0x3d')](0x0,_0xbf05f3[_0x4f49('0x3e')]('fullname'));_0xbf05f3+=','+_0x3bfe7e+'internal';}return _0xbf05f3;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x15e4b3,_0x15b280){var _0x2e4355=_0x15e4b3[_0x4f49('0x3f')](function(_0x1053b2,_0x1ecf6c){if(_0x1053b2[_0x4f49('0x35')]===_0x1ecf6c[_0x4f49('0x35')]){if(_0x1053b2[_0x4f49('0x35')]==='pause'){if(_0x15b280==='DESC'){return(_0x1053b2[_0x4f49('0x33')]||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')]['toLowerCase']()>_0x1ecf6c[_0x4f49('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x1053b2['pauseType']||'')<(_0x1ecf6c[_0x4f49('0x33')]||'')||_0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()>_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2['fullname'][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x31')][_0x4f49('0x40')]()<_0x1ecf6c['fullname'][_0x4f49('0x40')]()?-0x1:0x1;}}}else{if(_0x15b280===_0x4f49('0x3a')){return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?0x1:-0x1;}else{return _0x1053b2[_0x4f49('0x35')]<_0x1ecf6c[_0x4f49('0x35')]?-0x1:0x1;}}});return _0x2e4355;}exports[_0x4f49('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x356785){var _0x435192=[_0x4f49('0x42'),'online',_0x4f49('0x43'),_0x4f49('0x44'),'pauseType',_0x4f49('0x44'),'internal',_0x4f49('0x45'),_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),'smsPause',_0x4f49('0x32'),_0x4f49('0x6'),_0x4f49('0x10'),_0x4f49('0x46'),_0x4f49('0x47'),_0x4f49('0x48'),_0x4f49('0x49'),_0x4f49('0x4a'),_0x4f49('0x4b'),_0x4f49('0x4c'),_0x4f49('0x4d'),_0x4f49('0x4e'),_0x4f49('0x4f'),_0x4f49('0x50'),_0x4f49('0x51'),_0x4f49('0x12'),'openchannelStatus','mailStatus',_0x4f49('0x16'),_0x4f49('0x52'),_0x4f49('0x13'),_0x4f49('0x11'),_0x4f49('0x53'),_0x4f49('0x54'),_0x4f49('0x55'),'smsStatusTime',_0x4f49('0x56'),'faxStatusTime',_0x4f49('0x57'),_0x4f49('0x58'),_0x4f49('0x59'),_0x4f49('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0x4f49('0x5b'),'routealias'];var _0x52d18c=[_0x4f49('0x5'),_0x4f49('0x8'),_0x4f49('0x7'),_0x4f49('0x9'),'whatsappPause','faxPause',_0x4f49('0x10'),_0x4f49('0x5c')];var _0x5cb187=_(_0x356785)[_0x4f49('0x5d')](_0x52d18c)['pick'](_0x435192)['value']();return _0x5cb187;}exports[_0x4f49('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x4f49('0x31'),'role',_0x4f49('0x3c'),_0x4f49('0x5c'),_0x4f49('0x35'),_0x4f49('0x42'),_0x4f49('0x43'),_0x4f49('0x33'),_0x4f49('0x44'),_0x4f49('0x6'),'chatPause',_0x4f49('0x7'),'openchannelPause',_0x4f49('0x9'),_0x4f49('0x10'),_0x4f49('0x32'),_0x4f49('0x12'),_0x4f49('0x13'),_0x4f49('0x14'),'openchannelStatus',_0x4f49('0x16'),_0x4f49('0x11'),'whatsappStatus','chatStatusTime',_0x4f49('0x5f'),_0x4f49('0x55'),_0x4f49('0x54'),_0x4f49('0x60'),_0x4f49('0x57'),'whatsappStatusTime',_0x4f49('0x46'),'faxCapacity',_0x4f49('0x48'),_0x4f49('0x47'),_0x4f49('0x49'),'whatsappCapacity',_0x4f49('0x4c'),_0x4f49('0x51'),_0x4f49('0x4e'),_0x4f49('0x4d'),'smsCurrentCapacity',_0x4f49('0x50'),_0x4f49('0x61'),'phoneBarEnableAutomaticScreenRecording',_0x4f49('0x59'),_0x4f49('0x62'),_0x4f49('0x58'),_0x4f49('0x63'),_0x4f49('0x5a')];}exports[_0x4f49('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x7217=['onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','then','getAgents','all','flatten','value','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','pauseType','find','getSortedAgentsIdsByStatus','globalStatus','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','online','pick','filterAgentAttributes','role','smsStatusTime','whatsappCapacity','chatCurrentCapacity','phoneBarEnableAutomaticScreenRecording'];(function(_0x6e07ab,_0x523c27){var _0x652ed1=function(_0x49226f){while(--_0x49226f){_0x6e07ab['push'](_0x6e07ab['shift']());}};_0x652ed1(++_0x523c27);}(_0x7217,0x19e));var _0x7721=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7217[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7721('0x0'));var jayson=require('jayson/promise');var db=require(_0x7721('0x1'))['db'];var amiClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232a});var routingClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232c});function isAgentPaused(_0x4d6446,_0x5bf160){var _0x472a96=[_0x4d6446[_0x7721('0x4')],_0x4d6446[_0x7721('0x5')],_0x4d6446[_0x7721('0x6')],_0x4d6446[_0x7721('0x7')],_0x4d6446[_0x7721('0x8')],_0x4d6446[_0x7721('0x9')],_0x4d6446[_0x7721('0xa')]];if(!_0x5bf160)return _[_0x7721('0xb')](_0x472a96);var _0x2f99ed=_[_0x7721('0xc')](_0x472a96);return _0x2f99ed[_0x7721('0xd')]>0x0&&_0x2f99ed[_0x7721('0xd')]<_0x472a96[_0x7721('0xd')]?!![]:![];}function isIdle(_0x2c3986){return _0x2c3986==='idle'||_0x2c3986===_0x7721('0xe')||_0x2c3986===_0x7721('0xf')||_0x2c3986===_0x7721('0x10')||_[_0x7721('0x11')](_0x2c3986);}function isAgentIdle(_0xa8977c){if(_0xa8977c[_0x7721('0x12')]!==_0x7721('0x13')&&_0xa8977c[_0x7721('0x9')]){_0xa8977c['voiceStatus']=_0x7721('0x14');return![];}return _[_0x7721('0xb')]([_0xa8977c['chatStatus'],_0xa8977c[_0x7721('0x15')],_0xa8977c[_0x7721('0x16')],_0xa8977c[_0x7721('0x17')],_0xa8977c[_0x7721('0x18')],_0xa8977c['voiceStatus'],_0xa8977c[_0x7721('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7721('0x1a')]('Agents',{})['then'](function(_0x4b183e){if(_0x4b183e[_0x7721('0x1b')]){throw new Error(_0x7721('0x1c'));}var _0x3cc909=_0x4b183e[_0x7721('0x1d')];return routingClient['request'](_0x7721('0x1e'),{})['then'](function(_0x3fc09e){if(_0x3fc09e['error']){throw new Error(_0x7721('0x1f'));}var _0x4e96fb=_0x3fc09e[_0x7721('0x1d')];return _[_0x7721('0x20')]({},_0x3cc909,_0x4e96fb);});})[_0x7721('0x21')](function(_0x40af90){throw _0x40af90;});}exports[_0x7721('0x22')]=getRealtimeAgents;function getAgentStatus(_0x413263){var _0x3b29ac=_0x7721('0xe');if(isAgentPaused(_0x413263))_0x3b29ac='pause';else if(isAgentPaused(_0x413263,!![]))_0x3b29ac=_0x7721('0x23');else if(isAgentIdle(_0x413263))_0x3b29ac=_0x7721('0x13');else _0x3b29ac=_0x7721('0x24');return _0x3b29ac;}exports[_0x7721('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0x57140c,_0x28f5a6){var _0x512f31=_[_0x7721('0x26')](_0x57140c)?_0x57140c:[_0x57140c];var _0x288e3a=_[_0x7721('0x27')](_0x28f5a6)+_0x7721('0x28');var _0x121cc4=_[_0x7721('0x29')](_0x512f31,function(_0x2c6b7b){return db[_0x288e3a]['findOne']({'where':{'id':_0x2c6b7b}})[_0x7721('0x2a')](function(_0x1abedb){if(!_0x1abedb)return[];return _0x1abedb[_0x7721('0x2b')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7721('0x2c')](_0x121cc4)[_0x7721('0x2a')](function(_0x16355a){var _0x424e05=_(_0x16355a)[_0x7721('0x2d')]()[_0x7721('0x29')]('id')['uniq']()[_0x7721('0x2e')]();return _0x424e05;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x499b87,_0x315202,_0x343c19){try{if(_0x315202[_0x7721('0xd')]>0x0){_0x499b87=_0x499b87[_0x7721('0xc')](function(_0x1ea4d){return _0x315202[_0x7721('0x2f')](_0x1ea4d['id']);});}var _0xd7d703=_0x499b87[_0x7721('0xc')](function(_0x5c54f0){var _0x471651=_0x7721('0x24');if(isAgentIdle(_0x5c54f0)){_0x471651='idle';}return _0x471651===_0x343c19;});return _['map'](_0xd7d703,'id');}catch(_0xfde9ec){throw _0xfde9ec;}}exports[_0x7721('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x48f329,_0x46f772,_0x4651b5){return Promise[_0x7721('0x31')]()['then'](function(){if(_0x46f772[_0x7721('0xd')]>0x0){_0x48f329=_0x48f329[_0x7721('0xc')](function(_0x1492d4){return _0x46f772[_0x7721('0x2f')](_0x1492d4['id']);});}return _0x48f329;})[_0x7721('0x2a')](function(){return db['User'][_0x7721('0x32')]({'attributes':['id',_0x7721('0x33'),_0x7721('0x34'),'chatPause',_0x7721('0x5'),_0x7721('0x6'),'openchannelPause',_0x7721('0x8'),'voicePause',_0x7721('0xa'),_0x7721('0x35')],'where':{'id':{'$in':_[_0x7721('0x29')](_0x48f329,'id')}},'raw':!![]});})[_0x7721('0x2a')](function(_0x1c84c0){return _0x1c84c0[_0x7721('0x29')](function(_0x2f1fe0){var _0x15545a=_[_0x7721('0x36')](_0x48f329,['id',_0x2f1fe0['id']]);var _0x3a2eb7=filterAgentAttributes(_0x15545a);_[_0x7721('0x20')](_0x2f1fe0,_0x3a2eb7);_0x2f1fe0['globalStatus']=getAgentStatus(_0x2f1fe0);return _0x2f1fe0;});})[_0x7721('0x2a')](function(_0x5e6663){var _0x212384=sortAgentsByStatus(_0x5e6663,_0x4651b5);return _[_0x7721('0x29')](_0x212384,'id');})[_0x7721('0x21')](function(_0x1d03de){throw _0x1d03de;});}exports[_0x7721('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x378ba5){var _0x482b70={'fields':[],'order':null};var _0x557c34=_0x378ba5['split'](',');_0x482b70['fields']=_[_0x7721('0xc')](_0x557c34,function(_0x1b3f8d){if(!_0x1b3f8d[_0x7721('0x2f')](_0x7721('0x38'))){return!![];}_0x482b70['order']=_[_0x7721('0x39')](_0x1b3f8d,'-')?'DESC':_0x7721('0x3a');return![];});return _0x482b70;}exports[_0x7721('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x5a278e){if(!_0x5a278e){_0x5a278e=_0x7721('0x3c');}if(_0x5a278e[_0x7721('0x2f')]('fullname')&&!_0x5a278e['includes'](_0x7721('0x3d'))){var _0xfc4dc4=_0x5a278e[_0x7721('0x3e')](0x0,_0x5a278e[_0x7721('0x3f')]('fullname'));_0x5a278e+=','+_0xfc4dc4+_0x7721('0x3d');}return _0x5a278e;}exports[_0x7721('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x40ce8c,_0x337abf){var _0x196051=_0x40ce8c['sort'](function(_0x490d4,_0x4a2c28){if(_0x490d4[_0x7721('0x38')]===_0x4a2c28['globalStatus']){if(_0x490d4[_0x7721('0x38')]===_0x7721('0x14')){if(_0x337abf===_0x7721('0x41')){return(_0x490d4['pauseType']||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28['fullname'][_0x7721('0x42')]()?0x1:-0x1;}else{return(_0x490d4[_0x7721('0x35')]||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}else{if(_0x337abf==='DESC'){return _0x490d4['fullname'][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?0x1:-0x1;}else{return _0x490d4[_0x7721('0x34')][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}}else{if(_0x337abf===_0x7721('0x41')){return _0x490d4[_0x7721('0x38')]<_0x4a2c28[_0x7721('0x38')]?0x1:-0x1;}else{return _0x490d4['globalStatus']<_0x4a2c28['globalStatus']?-0x1:0x1;}}});return _0x196051;}exports[_0x7721('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x6a4664){var _0x151f69=[_0x7721('0x44'),'online',_0x7721('0x45'),_0x7721('0x46'),'pauseType',_0x7721('0x46'),'internal',_0x7721('0x47'),'chatPause',_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),'whatsappPause',_0x7721('0x5'),_0x7721('0x9'),'chatCapacity',_0x7721('0x48'),_0x7721('0x49'),_0x7721('0x4a'),'whatsappCapacity',_0x7721('0x4b'),'chatCurrentCapacity',_0x7721('0x4c'),_0x7721('0x4d'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x50'),_0x7721('0x51'),_0x7721('0x17'),_0x7721('0x16'),_0x7721('0x18'),_0x7721('0x19'),_0x7721('0x15'),_0x7721('0x12'),_0x7721('0x52'),_0x7721('0x53'),_0x7721('0x54'),'smsStatusTime',_0x7721('0x55'),_0x7721('0x56'),_0x7721('0x57'),_0x7721('0x58'),_0x7721('0x59'),_0x7721('0x5a'),_0x7721('0x5b'),'phoneBarEnableAutomaticScreenRecording',_0x7721('0x5c')];var _0x17036e=[_0x7721('0x4'),_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),_0x7721('0xa'),_0x7721('0x5'),_0x7721('0x9'),_0x7721('0x5d')];var _0x8eca10=_(_0x6a4664)['omit'](_0x17036e)[_0x7721('0x5e')](_0x151f69)[_0x7721('0x2e')]();return _0x8eca10;}exports[_0x7721('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7721('0x33'),_0x7721('0x34'),_0x7721('0x60'),_0x7721('0x3d'),_0x7721('0x5d'),_0x7721('0x38'),_0x7721('0x44'),_0x7721('0x45'),_0x7721('0x35'),_0x7721('0x46'),_0x7721('0x5'),_0x7721('0x4'),'mailPause','openchannelPause','smsPause',_0x7721('0x9'),'whatsappPause','chatStatus','faxStatus','mailStatus',_0x7721('0x17'),_0x7721('0x18'),_0x7721('0x12'),'whatsappStatus',_0x7721('0x52'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x7721('0x61'),'voiceStatusTime','whatsappStatusTime','chatCapacity',_0x7721('0x4b'),_0x7721('0x49'),_0x7721('0x48'),'smsCapacity',_0x7721('0x62'),_0x7721('0x63'),_0x7721('0x50'),_0x7721('0x4d'),_0x7721('0x4c'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x5b'),_0x7721('0x64'),_0x7721('0x59'),_0x7721('0x65'),_0x7721('0x58'),_0x7721('0x5c'),_0x7721('0x5a')];}exports[_0x7721('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e2d8796..7faaa9a 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe76=['loggedIn','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','available','find','merge','pick','initializeQueues','lodash','util','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfe76,0x1bc));var _0x6fe7=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xfe76[_0xb875ee];return _0x4c7f3a;};'use strict';var _=require(_0x6fe7('0x0'));var jayson=require('jayson/promise');var util=require(_0x6fe7('0x1'));var amiClient=jayson[_0x6fe7('0x2')][_0x6fe7('0x3')]({'port':0x232a});var routingClient=jayson[_0x6fe7('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x6fe7('0x4'),_0x6fe7('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x6fe7('0x6'),_0x6fe7('0x7'),_0x6fe7('0x8'),_0x6fe7('0x9'),_0x6fe7('0xa'),_0x6fe7('0xb'),_0x6fe7('0xc'),_0x6fe7('0xd'),'talking',_0x6fe7('0xe'),_0x6fe7('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6fe7('0x10'),_0x6fe7('0x11'),_0x6fe7('0x12'),'statusMessage',_0x6fe7('0x13'),_0x6fe7('0x14'),_0x6fe7('0x15'),_0x6fe7('0x16'),'startProgressive',_0x6fe7('0x17'),_0x6fe7('0x18'),_0x6fe7('0x19'),_0x6fe7('0x1a'),_0x6fe7('0x1b'),_0x6fe7('0x1c'),_0x6fe7('0x1d'),_0x6fe7('0x1e'),_0x6fe7('0x1f'),_0x6fe7('0x20'),_0x6fe7('0x21'),_0x6fe7('0x22'),_0x6fe7('0x23'),_0x6fe7('0x24')];function getRealtimeQueues(_0x946ee6,_0x3e03c1){var _0x55ae81=_0x3e03c1===_0x6fe7('0x25')?amiClient:routingClient;return _0x55ae81[_0x6fe7('0x26')](_[_0x6fe7('0x27')](_0x3e03c1)+_0x6fe7('0x28'),_0x946ee6)['then'](function(_0x4e5058){if(_0x4e5058[_0x6fe7('0x29')])throw new Error(util[_0x6fe7('0x2a')](_0x6fe7('0x2b'),_0x3e03c1));return _0x4e5058['result'];})[_0x6fe7('0x2c')](function(_0x122c2d){throw _0x122c2d;});}exports[_0x6fe7('0x2d')]=getRealtimeQueues;function initializeQueues(_0x453f8a,_0x5d49f2,_0x2480c5,_0xcc1aa8){var _0x4fc18a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2480c5==='voice'){if(_0xcc1aa8===_0x6fe7('0x2e')){_0x4fc18a=_0x4fc18a[_0x6fe7('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xcc1aa8===_0x6fe7('0x30')){_0x4fc18a=_0x4fc18a[_0x6fe7('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x453f8a[_0x6fe7('0x31')](function(_0x312e04){var _0x2d63fc=_0x312e04[_0x6fe7('0x32')]({'plain':!![]});_0x2d63fc[_0x6fe7('0x5')]=0x0;_0x2d63fc[_0x6fe7('0x9')]=0x0;_0x2d63fc['loggedIn']=0x0;_0x2d63fc[_0x6fe7('0x33')]=0x0;_0x2d63fc['waiting']=0x0;if(_0x2480c5===_0x6fe7('0x25')){_0x2d63fc['talking']=0x0;_0x2d63fc[_0x6fe7('0x6')]=0x0;if(_0xcc1aa8===_0x6fe7('0x30')){_0x2d63fc['pTalking']=0x0;_0x2d63fc[_0x6fe7('0x11')]=0x0;}}var _0x1b64ca=_[_0x6fe7('0x34')](_0x5d49f2,['id',_0x2d63fc['id']]);if(_0x1b64ca){_[_0x6fe7('0x35')](_0x2d63fc,_[_0x6fe7('0x36')](_0x1b64ca,_0x4fc18a));}return _0x2d63fc;});}exports[_0x6fe7('0x37')]=initializeQueues; \ No newline at end of file +var _0x0cf2=['inbound','concat','map','get','waiting','busy','find','merge','lodash','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch'];(function(_0x107740,_0x39cffa){var _0xe6aee9=function(_0x1fa726){while(--_0x1fa726){_0x107740['push'](_0x107740['shift']());}};_0xe6aee9(++_0x39cffa);}(_0x0cf2,0x9b));var _0x20cf=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x0cf2[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x20cf('0x0'));var jayson=require(_0x20cf('0x1'));var util=require(_0x20cf('0x2'));var amiClient=jayson[_0x20cf('0x3')][_0x20cf('0x4')]({'port':0x232a});var routingClient=jayson[_0x20cf('0x3')][_0x20cf('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x20cf('0x5'),_0x20cf('0x6'),_0x20cf('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x20cf('0x8'),_0x20cf('0x9'),_0x20cf('0xa'),_0x20cf('0xb'),_0x20cf('0xc'),_0x20cf('0xd'),'ringInUse',_0x20cf('0xe'),'unavailable',_0x20cf('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x20cf('0x10'),_0x20cf('0x11'),_0x20cf('0x12'),_0x20cf('0x13'),_0x20cf('0x14'),_0x20cf('0x15'),'Trunk',_0x20cf('0x16'),_0x20cf('0x17'),_0x20cf('0x18'),'erlangCallToSecond',_0x20cf('0x19'),_0x20cf('0x1a'),'dialPredictiveInterval',_0x20cf('0x1b'),'dialPredictiveIntervalMinThreshold',_0x20cf('0x1c'),_0x20cf('0x1d'),_0x20cf('0x1e'),_0x20cf('0x1f'),_0x20cf('0x20'),'predictiveIntervalAvgHoldtime',_0x20cf('0x21')];function getRealtimeQueues(_0x821fcc,_0x2ed04e){var _0x15bf9f=_0x2ed04e===_0x20cf('0x22')?amiClient:routingClient;return _0x15bf9f[_0x20cf('0x23')](_[_0x20cf('0x24')](_0x2ed04e)+_0x20cf('0x25'),_0x821fcc)['then'](function(_0x388b86){if(_0x388b86['error'])throw new Error(util['format'](_0x20cf('0x26'),_0x2ed04e));return _0x388b86[_0x20cf('0x27')];})[_0x20cf('0x28')](function(_0x450181){throw _0x450181;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x414757,_0x462b87,_0x2f6bbc,_0x1be965){var _0x5890ee=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2f6bbc==='voice'){if(_0x1be965===_0x20cf('0x29')){_0x5890ee=_0x5890ee[_0x20cf('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1be965==='outbound'){_0x5890ee=_0x5890ee[_0x20cf('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x414757[_0x20cf('0x2b')](function(_0x516a8b){var _0x3f9f18=_0x516a8b[_0x20cf('0x2c')]({'plain':!![]});_0x3f9f18['paused']=0x0;_0x3f9f18['loggedInDb']=0x0;_0x3f9f18[_0x20cf('0x6')]=0x0;_0x3f9f18['available']=0x0;_0x3f9f18[_0x20cf('0x2d')]=0x0;if(_0x2f6bbc===_0x20cf('0x22')){_0x3f9f18[_0x20cf('0xe')]=0x0;_0x3f9f18[_0x20cf('0x2e')]=0x0;if(_0x1be965==='outbound'){_0x3f9f18['pTalking']=0x0;_0x3f9f18[_0x20cf('0x11')]=0x0;}}var _0x288e90=_[_0x20cf('0x2f')](_0x462b87,['id',_0x3f9f18['id']]);if(_0x288e90){_[_0x20cf('0x30')](_0x3f9f18,_['pick'](_0x288e90,_0x5890ee));}return _0x3f9f18;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f53a83f..af11f50 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2cc9e6,_0x17e138){var _0x4b0d89=function(_0x3c5c44){while(--_0x3c5c44){_0x2cc9e6['push'](_0x2cc9e6['shift']());}};_0x4b0d89(++_0x17e138);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index dff9387..c15ffda 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 _0xcab4=['mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','getUuid','platform','test','licenseToken','win32','utf8','replace','hostname','macAddress','md5','update','digest','substring','lodash','child_process','execSync','../environment','networkInterfaces','orderBy','filter','family','IPv4','concat','head'];(function(_0x5bb32f,_0x3ca51f){var _0x1edb43=function(_0x316ff4){while(--_0x316ff4){_0x5bb32f['push'](_0x5bb32f['shift']());}};_0x1edb43(++_0x3ca51f);}(_0xcab4,0x175));var _0x4cab=function(_0x5b7444,_0x28b55c){_0x5b7444=_0x5b7444-0x0;var _0x9e14d=_0xcab4[_0x5b7444];return _0x9e14d;};'use strict';var _=require(_0x4cab('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x4cab('0x1'))[_0x4cab('0x2')];var config=require(_0x4cab('0x3'));function getInterfaces(){var _0x3d5fa7=[];var _0x413361=os[_0x4cab('0x4')]();var _0x383c72=_[_0x4cab('0x5')](_['keys'](_0x413361));for(var _0x597a78=0x0;_0x597a78<_0x383c72['length'];_0x597a78++){var _0x4a6eee=_0x413361[_0x383c72[_0x597a78]][_0x4cab('0x6')](function(_0x30a222){return _0x30a222[_0x4cab('0x7')]===_0x4cab('0x8')&&_0x30a222['internal']===![];});_0x3d5fa7=_0x3d5fa7[_0x4cab('0x9')](_0x4a6eee);}return _0x3d5fa7;}function getFirstInterface(){var _0x5199de=_[_0x4cab('0xa')](getInterfaces());return{'macAddress':_0x5199de&&_0x5199de['mac']?_0x5199de[_0x4cab('0xb')]:_0x4cab('0xc'),'ipAddress':_0x5199de&&_0x5199de[_0x4cab('0xd')]?_0x5199de[_0x4cab('0xd')]:_0x4cab('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5b5303=_['orderBy'](os[_0x4cab('0xf')]()['map'](function(_0x2cd86f){return _0x2cd86f[_0x4cab('0x10')];}))[_0x4cab('0x11')](':');return crypto[_0x4cab('0x12')]('md5')['update'](_0x5b5303)['digest']('hex');}exports[_0x4cab('0x13')]=function(){var _0x2156cc=os[_0x4cab('0x14')]();var _0x1a97bf=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1a97bf[_0x4cab('0x15')](config[_0x4cab('0x16')])){return config[_0x4cab('0x16')];}else if(_0x2156cc===_0x4cab('0x17')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4cab('0x18')})[_0x4cab('0x19')]('\x0d\x0a','');}else{var _0x46e69c=getFirstInterface();var _0x5c3458=getCPUhash();var _0x3a2d41=_0x5c3458+'|'+os[_0x4cab('0x1a')]()+'|'+_0x46e69c[_0x4cab('0x1b')]+'|'+_0x46e69c['ipAddress'];var _0x4292ef=crypto[_0x4cab('0x12')](_0x4cab('0x1c'))[_0x4cab('0x1d')](_0x3a2d41)[_0x4cab('0x1e')]('hex');return _0x4292ef[_0x4cab('0x1f')](0x0,0x8)+'-'+_0x4292ef['substring'](0x8,0xc)+'-'+_0x4292ef[_0x4cab('0x1f')](0xc,0x10)+'-'+_0x4292ef[_0x4cab('0x1f')](0x10,0x14)+'-'+_0x4292ef[_0x4cab('0x1f')](0x14);}}; \ No newline at end of file +var _0x72d4=['crypto','execSync','../environment','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','substring','lodash'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x72d4,0x1cd));var _0x472d=function(_0x1f19a6,_0x37aa8d){_0x1f19a6=_0x1f19a6-0x0;var _0x10218d=_0x72d4[_0x1f19a6];return _0x10218d;};'use strict';var _=require(_0x472d('0x0'));var os=require('os');var crypto=require(_0x472d('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x472d('0x2')];var config=require(_0x472d('0x3'));function getInterfaces(){var _0x11757c=[];var _0x1c19d4=os['networkInterfaces']();var _0x213fcb=_[_0x472d('0x4')](_[_0x472d('0x5')](_0x1c19d4));for(var _0x2861fd=0x0;_0x2861fd<_0x213fcb['length'];_0x2861fd++){var _0x371903=_0x1c19d4[_0x213fcb[_0x2861fd]][_0x472d('0x6')](function(_0x214c9c){return _0x214c9c[_0x472d('0x7')]===_0x472d('0x8')&&_0x214c9c[_0x472d('0x9')]===![];});_0x11757c=_0x11757c[_0x472d('0xa')](_0x371903);}return _0x11757c;}function getFirstInterface(){var _0x16d4df=_[_0x472d('0xb')](getInterfaces());return{'macAddress':_0x16d4df&&_0x16d4df[_0x472d('0xc')]?_0x16d4df[_0x472d('0xc')]:_0x472d('0xd'),'ipAddress':_0x16d4df&&_0x16d4df[_0x472d('0xe')]?_0x16d4df[_0x472d('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5e587a=_['orderBy'](os['cpus']()[_0x472d('0xf')](function(_0x19df32){return _0x19df32[_0x472d('0x10')];}))[_0x472d('0x11')](':');return crypto[_0x472d('0x12')](_0x472d('0x13'))[_0x472d('0x14')](_0x5e587a)[_0x472d('0x15')](_0x472d('0x16'));}exports[_0x472d('0x17')]=function(){var _0x172b35=os[_0x472d('0x18')]();var _0x2ea492=/[0-9a-f-]{36}/;if(config[_0x472d('0x19')]&&_0x2ea492[_0x472d('0x1a')](config[_0x472d('0x19')])){return config[_0x472d('0x19')];}else if(_0x172b35===_0x472d('0x1b')){return exec(_0x472d('0x1c'),{'encoding':_0x472d('0x1d')})['replace']('\x0d\x0a','');}else{var _0x3ec0ed=getFirstInterface();var _0x36aea3=getCPUhash();var _0x1b6942=_0x36aea3+'|'+os[_0x472d('0x1e')]()+'|'+_0x3ec0ed[_0x472d('0x1f')]+'|'+_0x3ec0ed['ipAddress'];var _0x2dba3e=crypto[_0x472d('0x12')](_0x472d('0x13'))[_0x472d('0x14')](_0x1b6942)[_0x472d('0x15')](_0x472d('0x16'));return _0x2dba3e[_0x472d('0x20')](0x0,0x8)+'-'+_0x2dba3e['substring'](0x8,0xc)+'-'+_0x2dba3e[_0x472d('0x20')](0xc,0x10)+'-'+_0x2dba3e['substring'](0x10,0x14)+'-'+_0x2dba3e['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9c53ea1..261e416 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 _0x5b95=['SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','findOrCreate','spread'];(function(_0x3c6601,_0x4448b8){var _0x33c880=function(_0x56eb1b){while(--_0x56eb1b){_0x3c6601['push'](_0x3c6601['shift']());}};_0x33c880(++_0x4448b8);}(_0x5b95,0x1d0));var _0x55b9=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x5b95[_0x36ed48];return _0x51c63a;};'use strict';var util=require(_0x55b9('0x0'));var moment=require(_0x55b9('0x1'));var rp=require(_0x55b9('0x2'));var BPromise=require(_0x55b9('0x3'));var pkginfo=require(_0x55b9('0x4'))(module,_0x55b9('0x5'));var db=require(_0x55b9('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x55b9('0x7'));var logger=require('../logger')('license');var HOST=_0x55b9('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x459761){return new BPromise(function(_0x578832,_0x12be5e){var _0x553b0b=util[_0x55b9('0x9')](_0x55b9('0xa'),HOST,_0x459761,module[_0x55b9('0xb')][_0x55b9('0x5')]);if(oldToken){_0x553b0b=util['format'](_0x55b9('0xc'),HOST,_0x459761,module[_0x55b9('0xb')][_0x55b9('0x5')],oldToken);}var _0x3377a9={'uri':_0x553b0b,'method':_0x55b9('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3377a9)[_0x55b9('0xe')](function(_0x464b49){_0x578832(_0x464b49);})[_0x55b9('0xf')](function(_0x46b165){_0x12be5e(_0x46b165);});});}function manageLicense(_0x1696c9,_0x42d7e6){var _0x36bf45=_0x42d7e6[_0x55b9('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x36bf45[_0x55b9('0x11')]!==_0x1696c9&&!_0x36bf45[_0x55b9('0x12')]){oldToken=_0x36bf45['data1'];}httpRequest(_0x1696c9)[_0x55b9('0xe')](function(_0x171dec){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x171dec['active']){isOldTokenSent=![];if(!_0x36bf45[_0x55b9('0x13')]&&_0x36bf45['license']!=_0x171dec['license']||_0x36bf45[_0x55b9('0x13')]&&_0x36bf45[_0x55b9('0x12')]){logger['info'](_0x55b9('0x14'));}if(_0x36bf45[_0x55b9('0x13')]&&!_0x36bf45['data2']&&_0x36bf45['license']!=_0x171dec[_0x55b9('0x13')]){logger[_0x55b9('0x15')](_0x55b9('0x16'));}if(_0x36bf45[_0x55b9('0x13')]&&!_0x36bf45[_0x55b9('0x12')]&&_0x36bf45[_0x55b9('0x13')]==_0x171dec['license']){return _0x42d7e6;}return _0x42d7e6[_0x55b9('0x17')]({'data1':_0x1696c9,'data2':null,'license':_0x171dec['license']});}else{if(_0x171dec[_0x55b9('0x13')]||_0x36bf45[_0x55b9('0x13')]){if(!_0x36bf45['data2']){if(_0x36bf45[_0x55b9('0x11')]==_0x1696c9){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x55b9('0x18'));}else{GRAY_PERIOD_REASON=_0x55b9('0x19');logger[_0x55b9('0x15')](_0x55b9('0x1a'),_0x36bf45[_0x55b9('0x11')],_0x1696c9);}logger[_0x55b9('0x15')](_0x55b9('0x1b'),GRAY_PERIOD_REASON[_0x55b9('0x1c')](),moment()['format'](_0x55b9('0x1d')));return _0x42d7e6[_0x55b9('0x17')]({'data2':encryptor[_0x55b9('0x1e')](moment()['format'](_0x55b9('0x1d')))});}else{if(moment()[_0x55b9('0x1f')](encryptor[_0x55b9('0x20')](_0x36bf45[_0x55b9('0x12')]),_0x55b9('0x21'))>DAYS){logger['info'](_0x55b9('0x22'),moment()[_0x55b9('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x42d7e6[_0x55b9('0x17')]({'data1':_0x1696c9,'data2':null,'license':null});}}}else{if(_0x36bf45[_0x55b9('0x11')]!=_0x1696c9){logger[_0x55b9('0x15')](_0x55b9('0x1a'),_0x36bf45['data1'],_0x1696c9);return _0x42d7e6[_0x55b9('0x17')]({'data1':_0x1696c9,'data2':null,'license':null});}}}return _0x42d7e6;})['then'](function(_0x1ef8d3){_0x42d7e6=_0x1ef8d3;})[_0x55b9('0xf')](function(_0xb251e4){logger['error'](_0xb251e4[_0x55b9('0x23')]);})[_0x55b9('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x55b9('0x25')](),_0x42d7e6);},TIME);});}function defaultLicense(){var _0x3b4a73=hardware[_0x55b9('0x25')]();if(_0x3b4a73){return db['License'][_0x55b9('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3b4a73}})[_0x55b9('0x27')](function(_0x4c9711,_0x32d51d){logger['info'](_0x55b9('0x28'),_0x3b4a73);manageLicense(_0x3b4a73,_0x4c9711);})[_0x55b9('0xf')](function(_0x38f434){logger['error'](_0x38f434['message']);});}}exports[_0x55b9('0x29')]=defaultLicense; \ No newline at end of file +var _0x96e4=['message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x56110a,_0x3f9cdb){var _0x26731f=function(_0x130d2e){while(--_0x130d2e){_0x56110a['push'](_0x56110a['shift']());}};_0x26731f(++_0x3f9cdb);}(_0x96e4,0xd3));var _0x496e=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x96e4[_0x2ec2bf];return _0x2c279c;};'use strict';var util=require(_0x496e('0x0'));var moment=require('moment');var rp=require(_0x496e('0x1'));var BPromise=require(_0x496e('0x2'));var pkginfo=require(_0x496e('0x3'))(module,_0x496e('0x4'));var db=require(_0x496e('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x496e('0x6'));var logger=require(_0x496e('0x7'))(_0x496e('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2966f7){return new BPromise(function(_0x5303c6,_0x470de2){var _0x3e86e4=util[_0x496e('0x9')](_0x496e('0xa'),HOST,_0x2966f7,module[_0x496e('0xb')]['version']);if(oldToken){_0x3e86e4=util[_0x496e('0x9')](_0x496e('0xc'),HOST,_0x2966f7,module['exports']['version'],oldToken);}var _0x101409={'uri':_0x3e86e4,'method':_0x496e('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x101409)[_0x496e('0xe')](function(_0x14fed4){_0x5303c6(_0x14fed4);})[_0x496e('0xf')](function(_0x4c13e0){_0x470de2(_0x4c13e0);});});}function manageLicense(_0x1a8bd4,_0x159c50){var _0x2e38d9=_0x159c50[_0x496e('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x2e38d9['data1']!==_0x1a8bd4&&!_0x2e38d9[_0x496e('0x11')]){oldToken=_0x2e38d9[_0x496e('0x12')];}httpRequest(_0x1a8bd4)[_0x496e('0xe')](function(_0x124b1f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x124b1f[_0x496e('0x13')]){isOldTokenSent=![];if(!_0x2e38d9[_0x496e('0x8')]&&_0x2e38d9['license']!=_0x124b1f['license']||_0x2e38d9[_0x496e('0x8')]&&_0x2e38d9[_0x496e('0x11')]){logger[_0x496e('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2e38d9[_0x496e('0x8')]&&!_0x2e38d9[_0x496e('0x11')]&&_0x2e38d9[_0x496e('0x8')]!=_0x124b1f[_0x496e('0x8')]){logger[_0x496e('0x14')](_0x496e('0x15'));}if(_0x2e38d9[_0x496e('0x8')]&&!_0x2e38d9[_0x496e('0x11')]&&_0x2e38d9['license']==_0x124b1f[_0x496e('0x8')]){return _0x159c50;}return _0x159c50[_0x496e('0x16')]({'data1':_0x1a8bd4,'data2':null,'license':_0x124b1f[_0x496e('0x8')]});}else{if(_0x124b1f[_0x496e('0x8')]||_0x2e38d9[_0x496e('0x8')]){if(!_0x2e38d9['data2']){if(_0x2e38d9['data1']==_0x1a8bd4){GRAY_PERIOD_REASON=_0x496e('0x17');logger[_0x496e('0x14')](_0x496e('0x18'));}else{GRAY_PERIOD_REASON=_0x496e('0x19');logger['info'](_0x496e('0x1a'),_0x2e38d9[_0x496e('0x12')],_0x1a8bd4);}logger[_0x496e('0x14')](_0x496e('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x496e('0x9')](_0x496e('0x1c')));return _0x159c50[_0x496e('0x16')]({'data2':encryptor[_0x496e('0x1d')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x496e('0x1e')](encryptor[_0x496e('0x1f')](_0x2e38d9['data2']),_0x496e('0x20'))>DAYS){logger['info'](_0x496e('0x21'),moment()[_0x496e('0x9')](_0x496e('0x1c')));isOldTokenSent=![];return _0x159c50['update']({'data1':_0x1a8bd4,'data2':null,'license':null});}}}else{if(_0x2e38d9[_0x496e('0x12')]!=_0x1a8bd4){logger['info'](_0x496e('0x1a'),_0x2e38d9['data1'],_0x1a8bd4);return _0x159c50[_0x496e('0x16')]({'data1':_0x1a8bd4,'data2':null,'license':null});}}}return _0x159c50;})['then'](function(_0x29532e){_0x159c50=_0x29532e;})['catch'](function(_0x3b82d8){logger[_0x496e('0x22')](_0x3b82d8[_0x496e('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x496e('0x24')](),_0x159c50);},TIME);});}function defaultLicense(){var _0x1df8b9=hardware['getUuid']();if(_0x1df8b9){return db[_0x496e('0x25')][_0x496e('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x1df8b9}})['spread'](function(_0x46c217,_0x4f7e36){logger[_0x496e('0x14')](_0x496e('0x27'),_0x1df8b9);manageLicense(_0x1df8b9,_0x46c217);})[_0x496e('0xf')](function(_0x700843){logger['error'](_0x700843[_0x496e('0x23')]);});}}exports[_0x496e('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e7302c2..5d8eacd 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 _0xb70a=['bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','changed','message','User','role','sequelize','col','count','user','telephone','users','telephones','forEach','admin','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util'];(function(_0x3fda60,_0x7224a1){var _0xb30ca=function(_0x50dc7f){while(--_0x50dc7f){_0x3fda60['push'](_0x3fda60['shift']());}};_0xb30ca(++_0x7224a1);}(_0xb70a,0x1c1));var _0xab70=function(_0x37e08b,_0x54a3e2){_0x37e08b=_0x37e08b-0x0;var _0x4c223c=_0xb70a[_0x37e08b];return _0x4c223c;};'use strict';var util=require(_0xab70('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xab70('0x1'));var hardware=require(_0xab70('0x2'));var encryptor=require(_0xab70('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xab70('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xab70('0x5'),'machineUuid':hardware[_0xab70('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xab70('0x7'),'machineUuid':hardware[_0xab70('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf19f21){return new BPromise(function(_0x2aa9d7,_0x53931d){return db[_0xab70('0x8')][_0xab70('0x9')](_[_0xab70('0xa')](_0xf19f21,{'raw':!![],'where':{'id':0x1}}))[_0xab70('0xb')](function(_0xe261db){return checkLicense(_0xe261db,null);})[_0xab70('0xb')](function(_0x59b8d3){_0x2aa9d7(_0x59b8d3);return;})[_0xab70('0xc')](function(_0x4e0a64){_0x53931d(_0x4e0a64);});});}function checkLicense(_0x479050,_0x12a3db){if(!_0x479050){demoLicense[_0xab70('0xd')]=_0x479050[_0xab70('0xe')];return demoLicense;}try{var _0x70b7cb=_0x12a3db||_0x479050[_0xab70('0xf')];if(_[_0xab70('0x10')](_0x70b7cb)){throw new Error(_0xab70('0x11'));}var _0x78e562=_0x479050[_0xab70('0xe')];var _0x2e924e=_0x479050[_0xab70('0x12')];var _0x3652f7=_0x78e562[_0xab70('0x13')]('-')[0x4];var _0x4f8923=_0x78e562[_0xab70('0x13')]('-')[0x0];var _0x5dc0c6=encryptor[_0xab70('0x14')](_0x70b7cb,util[_0xab70('0x15')](_0xab70('0x16'),_0x3652f7,_0x78e562,_0x4f8923));var _0x238e0c=JSON[_0xab70('0x17')](_0x5dc0c6);_0x238e0c[_0xab70('0x18')]=![];_0x238e0c['uuid']=_0x78e562;_0x238e0c[_0xab70('0x19')]=hardware[_0xab70('0x6')]();if(_0x2e924e){var _0x508bfd=encryptor['decryptString'](_0x2e924e);_0x238e0c['gray']=_0x508bfd;_0x238e0c[_0xab70('0x1a')]=moment(_0x508bfd)[_0xab70('0x1b')](0x7,'days')[_0xab70('0x15')]();_0x238e0c['grayReason']=_0x238e0c[_0xab70('0xd')]!=_0x238e0c[_0xab70('0x19')]?_0xab70('0x1c'):'disabled';}return _0x238e0c;}catch(_0x13e620){breakingLicense[_0xab70('0xd')]=_0x479050[_0xab70('0xe')];breakingLicense[_0xab70('0x1d')]=_0x13e620['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3fe56f,_0x339457){getLicense()['then'](function(_0x3376a0){return db[_0xab70('0x1e')]['findAll']({'attributes':[_0xab70('0x1f'),[db[_0xab70('0x20')]['fn']('COUNT',db[_0xab70('0x20')][_0xab70('0x21')]('role')),_0xab70('0x22')]],'group':_0xab70('0x1f'),'where':{'role':{'$or':['admin',_0xab70('0x23'),_0xab70('0x24')]}},'raw':!![]})[_0xab70('0xb')](function(_0x4c7f8c){var _0x1b5d39={'user':_0x3376a0[_0xab70('0x25')]||0x0,'telephone':_0x3376a0[_0xab70('0x26')]||0x0};_0x4c7f8c[_0xab70('0x27')](function(_0x252f6a){var _0x39287d=_0x252f6a[_0xab70('0x1f')]===_0xab70('0x28')?_0xab70('0x23'):_0x252f6a[_0xab70('0x1f')];_0x1b5d39[_0x39287d]-=_0x252f6a['count'];if(_0x1b5d39[_0x39287d]<0x0)_0x1b5d39[_0x39287d]=0x0;});_0x3fe56f(_0x1b5d39);return;});})[_0xab70('0xc')](function(_0x2de2b6){_0x339457(_0x2de2b6);});});}function checkUserLimits(_0x3a393b){return new BPromise(function(_0x11fbe6,_0xe47e14){getLimits()[_0xab70('0xb')](function(_0x15bb4e){var _0x2e8d0e=_['pick'](_[_0xab70('0x29')](_0x3a393b,'role'),[_0xab70('0x28'),_0xab70('0x23'),'telephone']);var _0x4299d6=(_0x2e8d0e['admin']||0x0)+(_0x2e8d0e['user']||0x0);var _0x213f2c=_0x2e8d0e[_0xab70('0x24')]||0x0;if(_0x4299d6>_0x15bb4e[_0xab70('0x23')])return _0xe47e14(_0xab70('0x2a'));if(_0x213f2c>_0x15bb4e[_0xab70('0x24')])return _0xe47e14(_0xab70('0x2b'));return _0x11fbe6();})[_0xab70('0xc')](function(_0x40b6cd){_0xe47e14(_0x40b6cd);});});}module[_0xab70('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8a59=['COUNT','role','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','sequelize'];(function(_0x4f5ef9,_0x2eaea0){var _0x4e43c1=function(_0x5845ca){while(--_0x5845ca){_0x4f5ef9['push'](_0x4f5ef9['shift']());}};_0x4e43c1(++_0x2eaea0);}(_0x8a59,0x15e));var _0x98a5=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x8a59[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x98a5('0x0'));var _=require(_0x98a5('0x1'));var moment=require('moment');var BPromise=require(_0x98a5('0x2'));var hardware=require('./hardware');var encryptor=require(_0x98a5('0x3'));var db=require(_0x98a5('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x98a5('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x98a5('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x98a5('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4c2239){return new BPromise(function(_0x50298c,_0x565f2e){return db['License'][_0x98a5('0x8')](_[_0x98a5('0x9')](_0x4c2239,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x282aed){return checkLicense(_0x282aed,null);})[_0x98a5('0xa')](function(_0x4bbf50){_0x50298c(_0x4bbf50);return;})[_0x98a5('0xb')](function(_0x52045f){_0x565f2e(_0x52045f);});});}function checkLicense(_0x50306c,_0x1ed503){if(!_0x50306c){demoLicense[_0x98a5('0xc')]=_0x50306c[_0x98a5('0xd')];return demoLicense;}try{var _0x37790f=_0x1ed503||_0x50306c[_0x98a5('0xe')];if(_[_0x98a5('0xf')](_0x37790f)){throw new Error(_0x98a5('0x10'));}var _0x204da8=_0x50306c[_0x98a5('0xd')];var _0x4a7592=_0x50306c[_0x98a5('0x11')];var _0x119480=_0x204da8[_0x98a5('0x12')]('-')[0x4];var _0x5e3137=_0x204da8[_0x98a5('0x12')]('-')[0x0];var _0x147541=encryptor[_0x98a5('0x13')](_0x37790f,util[_0x98a5('0x14')](_0x98a5('0x15'),_0x119480,_0x204da8,_0x5e3137));var _0x286a61=JSON['parse'](_0x147541);_0x286a61[_0x98a5('0x16')]=![];_0x286a61['uuid']=_0x204da8;_0x286a61[_0x98a5('0x17')]=hardware['getUuid']();if(_0x4a7592){var _0x19b0c9=encryptor['decryptString'](_0x4a7592);_0x286a61[_0x98a5('0x18')]=_0x19b0c9;_0x286a61[_0x98a5('0x19')]=moment(_0x19b0c9)[_0x98a5('0x1a')](0x7,'days')[_0x98a5('0x14')]();_0x286a61[_0x98a5('0x1b')]=_0x286a61[_0x98a5('0xc')]!=_0x286a61['machineUuid']?_0x98a5('0x1c'):_0x98a5('0x1d');}return _0x286a61;}catch(_0x4d9c03){breakingLicense[_0x98a5('0xc')]=_0x50306c[_0x98a5('0xd')];breakingLicense[_0x98a5('0x1e')]=_0x4d9c03[_0x98a5('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x236f15,_0x4ff3c5){getLicense()[_0x98a5('0xa')](function(_0x3b258f){return db[_0x98a5('0x1f')][_0x98a5('0x20')]({'attributes':['role',[db[_0x98a5('0x21')]['fn'](_0x98a5('0x22'),db[_0x98a5('0x21')]['col'](_0x98a5('0x23'))),_0x98a5('0x24')]],'group':_0x98a5('0x23'),'where':{'role':{'$or':[_0x98a5('0x25'),_0x98a5('0x26'),_0x98a5('0x27')]}},'raw':!![]})[_0x98a5('0xa')](function(_0x5d96ee){var _0x148a61={'user':_0x3b258f[_0x98a5('0x28')]||0x0,'telephone':_0x3b258f[_0x98a5('0x29')]||0x0};_0x5d96ee[_0x98a5('0x2a')](function(_0x5e6a07){var _0x2c3290=_0x5e6a07[_0x98a5('0x23')]===_0x98a5('0x25')?'user':_0x5e6a07[_0x98a5('0x23')];_0x148a61[_0x2c3290]-=_0x5e6a07['count'];if(_0x148a61[_0x2c3290]<0x0)_0x148a61[_0x2c3290]=0x0;});_0x236f15(_0x148a61);return;});})[_0x98a5('0xb')](function(_0x32b93e){_0x4ff3c5(_0x32b93e);});});}function checkUserLimits(_0x295e40){return new BPromise(function(_0x44784a,_0x36f9ca){getLimits()[_0x98a5('0xa')](function(_0x56eece){var _0x44a0bc=_[_0x98a5('0x2b')](_[_0x98a5('0x2c')](_0x295e40,_0x98a5('0x23')),[_0x98a5('0x25'),_0x98a5('0x26'),'telephone']);var _0x5d1a62=(_0x44a0bc[_0x98a5('0x25')]||0x0)+(_0x44a0bc[_0x98a5('0x26')]||0x0);var _0x6db50a=_0x44a0bc[_0x98a5('0x27')]||0x0;if(_0x5d1a62>_0x56eece[_0x98a5('0x26')])return _0x36f9ca(_0x98a5('0x2d'));if(_0x6db50a>_0x56eece['telephone'])return _0x36f9ca(_0x98a5('0x2e'));return _0x44784a();})['catch'](function(_0x97bc6a){_0x36f9ca(_0x97bc6a);});});}module[_0x98a5('0x2f')]={'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 0c75333..d353634 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 _0x5fdc=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x538f21,_0xf5e88a){var _0xf6d3e3=function(_0x53ba2a){while(--_0x53ba2a){_0x538f21['push'](_0x538f21['shift']());}};_0xf6d3e3(++_0xf5e88a);}(_0x5fdc,0x127));var _0xc5fd=function(_0x34a8d7,_0x1102c3){_0x34a8d7=_0x34a8d7-0x0;var _0x358bfc=_0x5fdc[_0x34a8d7];return _0x358bfc;};'use strict';module[_0xc5fd('0x0')]={'DOMAIN':_0xc5fd('0x1'),'SESSION_SECRET':_0xc5fd('0x2'),'GOOGLE_ID':_0xc5fd('0x3'),'GOOGLE_SECRET':_0xc5fd('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x8aad=['http://localhost:9000','app-id','exports'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0x8aad,0x146));var _0xd8aa=function(_0x288b89,_0x12409a){_0x288b89=_0x288b89-0x0;var _0x2cf310=_0x8aad[_0x288b89];return _0x2cf310;};'use strict';module[_0xd8aa('0x0')]={'DOMAIN':_0xd8aa('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd8aa('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e31207f..35bb045 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4967=['../utils/loggers','fileLogger','exports'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x4967,0xb1));var _0x7496=function(_0x2cb08e,_0x48f58a){_0x2cb08e=_0x2cb08e-0x0;var _0x3b5f48=_0x4967[_0x2cb08e];return _0x3b5f48;};'use strict';var fileLogger=require(_0x7496('0x0'))[_0x7496('0x1')];module[_0x7496('0x2')]=fileLogger; \ No newline at end of file +var _0x74b0=['fileLogger','exports','../utils/loggers'];(function(_0x44be58,_0x24ce24){var _0x331b81=function(_0x50d012){while(--_0x50d012){_0x44be58['push'](_0x44be58['shift']());}};_0x331b81(++_0x24ce24);}(_0x74b0,0x10a));var _0x074b=function(_0x5b5fb1,_0x130d94){_0x5b5fb1=_0x5b5fb1-0x0;var _0x2fc9e5=_0x74b0[_0x5b5fb1];return _0x2fc9e5;};'use strict';var fileLogger=require(_0x074b('0x0'))[_0x074b('0x1')];module[_0x074b('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index ee2db74..fe4517f 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 _0x60cf=['root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','exports','path','../../config/environment','join'];(function(_0x1f6bc2,_0x50161b){var _0x390a81=function(_0x2c19aa){while(--_0x2c19aa){_0x1f6bc2['push'](_0x1f6bc2['shift']());}};_0x390a81(++_0x50161b);}(_0x60cf,0x169));var _0xf60c=function(_0x501dbc,_0x112a28){_0x501dbc=_0x501dbc-0x0;var _0x304d18=_0x60cf[_0x501dbc];return _0x304d18;};'use strict';var path=require(_0xf60c('0x0'));var cfg=require(_0xf60c('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xf60c('0x2')](cfg[_0xf60c('0x3')],_0xf60c('0x4')))};var pm2config={'apps':[{'name':_0xf60c('0x5'),'script':path['join'](__dirname,_0xf60c('0x6')),'env':env},{'name':'ami','script':path[_0xf60c('0x2')](__dirname,_0xf60c('0x7')),'env':env},{'name':_0xf60c('0x8'),'script':path[_0xf60c('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xf60c('0x9'),'script':path[_0xf60c('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xf60c('0xa'),'script':path[_0xf60c('0x2')](__dirname,_0xf60c('0xb')),'env':env},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xf60c('0xc')]=pm2config; \ No newline at end of file +var _0x5144=['path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports'];(function(_0x3f6034,_0x49af58){var _0x840784=function(_0x519c21){while(--_0x519c21){_0x3f6034['push'](_0x3f6034['shift']());}};_0x840784(++_0x49af58);}(_0x5144,0x168));var _0x4514=function(_0x239d47,_0x3ac236){_0x239d47=_0x239d47-0x0;var _0x1753e5=_0x5144[_0x239d47];return _0x1753e5;};'use strict';var path=require(_0x4514('0x0'));var cfg=require(_0x4514('0x1'));var env={'NODE_PATH':path[_0x4514('0x2')](path[_0x4514('0x3')](cfg[_0x4514('0x4')],_0x4514('0x5')))};var pm2config={'apps':[{'name':_0x4514('0x6'),'script':path[_0x4514('0x3')](__dirname,_0x4514('0x7')),'env':env},{'name':'ami','script':path[_0x4514('0x3')](__dirname,_0x4514('0x8')),'env':env},{'name':'agi','script':path[_0x4514('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x4514('0x9'),'script':path[_0x4514('0x3')](__dirname,_0x4514('0xa')),'env':env},{'name':_0x4514('0xb'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x4514('0xc'),'script':path['join'](__dirname,_0x4514('0xd')),'env':env}]};module[_0x4514('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9b69e86..481414e 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 _0x5d5e=['list','describe','delete','dump','saved','bluebird','./config','start','then','disconnect','stop','restart'];(function(_0x7e509a,_0x52675a){var _0x3af289=function(_0x2480b7){while(--_0x2480b7){_0x7e509a['push'](_0x7e509a['shift']());}};_0x3af289(++_0x52675a);}(_0x5d5e,0xf5));var _0xe5d5=function(_0x4a912b,_0x5dcc7e){_0x4a912b=_0x4a912b-0x0;var _0x15674e=_0x5d5e[_0x4a912b];return _0x15674e;};'use strict';var pm2=require('pm2');var BPromise=require(_0xe5d5('0x0'));var config=require(_0xe5d5('0x1'));function connect(){return new BPromise(function(_0x3c2bbf,_0x3eaa0a){return pm2['connect'](function(_0x42c819){if(_0x42c819){return _0x3eaa0a(_0x42c819);}return _0x3c2bbf('connected');});});};exports[_0xe5d5('0x2')]=function(_0x41ff6f){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x5b1100,_0x2d5711){return pm2[_0xe5d5('0x2')](_0x41ff6f,function(_0x1e556c,_0x1e3d84){if(_0x1e556c){return _0x2d5711(_0x1e556c);}pm2[_0xe5d5('0x4')]();return _0x5b1100(_0x1e3d84);});});});};exports[_0xe5d5('0x5')]=function(_0xbbe9c2){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x1603de,_0x43b085){return pm2[_0xe5d5('0x5')](_0xbbe9c2,function(_0xa59165,_0x46f50d){if(_0xa59165){return _0x43b085(_0xa59165);}pm2[_0xe5d5('0x4')]();return _0x1603de(_0x46f50d);});});});};exports[_0xe5d5('0x6')]=function(_0xe13d90){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x430b56,_0x710430){return pm2[_0xe5d5('0x6')](_0xe13d90,function(_0x2b27bb,_0x300724){if(_0x2b27bb){return _0x710430(_0x2b27bb);}pm2[_0xe5d5('0x4')]();return _0x430b56(_0x300724);});});});};exports[_0xe5d5('0x7')]=function(){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x16a85f,_0x2b841c){return pm2[_0xe5d5('0x7')](function(_0x1dab4c,_0x358ebf){if(_0x1dab4c){return _0x2b841c(_0x1dab4c);}pm2['disconnect']();return _0x16a85f(_0x358ebf);});});});};exports[_0xe5d5('0x8')]=function(_0x58cbe8){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x4b78aa,_0x4120bc){return pm2[_0xe5d5('0x8')](_0x58cbe8,function(_0x1fa0f1,_0x50b132){if(_0x1fa0f1){return _0x4120bc(_0x1fa0f1);}pm2[_0xe5d5('0x4')]();return _0x4b78aa(_0x50b132);});});});};exports['delete']=function(_0x1e3a81){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x384902,_0x26c281){return pm2[_0xe5d5('0x9')](_0x1e3a81,function(_0x116831,_0x19085f){if(_0x116831){return _0x26c281(_0x116831);}pm2[_0xe5d5('0x4')]();return _0x384902(_0x19085f);});});});};exports['dump']=function(){return connect()[_0xe5d5('0x3')](function(){return new BPromise(function(_0x1584a6,_0x534c2c){return pm2[_0xe5d5('0xa')](function(_0x1425c){if(_0x1425c){return _0x534c2c(_0x1425c);}return _0x1584a6(_0xe5d5('0xb'));});});});}; \ No newline at end of file +var _0x9e8d=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x28613d,_0x40b9d5){var _0x2fe13b=function(_0x464b22){while(--_0x464b22){_0x28613d['push'](_0x28613d['shift']());}};_0x2fe13b(++_0x40b9d5);}(_0x9e8d,0x195));var _0xd9e8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9e8d[_0x5c351c];return _0x26f3b3;};'use strict';var pm2=require(_0xd9e8('0x0'));var BPromise=require(_0xd9e8('0x1'));var config=require(_0xd9e8('0x2'));function connect(){return new BPromise(function(_0x1f8465,_0x43cdd3){return pm2[_0xd9e8('0x3')](function(_0x329747){if(_0x329747){return _0x43cdd3(_0x329747);}return _0x1f8465(_0xd9e8('0x4'));});});};exports[_0xd9e8('0x5')]=function(_0x2fb8ed){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x12acfa,_0x4ac702){return pm2[_0xd9e8('0x5')](_0x2fb8ed,function(_0x350009,_0x15847a){if(_0x350009){return _0x4ac702(_0x350009);}pm2[_0xd9e8('0x7')]();return _0x12acfa(_0x15847a);});});});};exports[_0xd9e8('0x8')]=function(_0x35e1d8){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x239959,_0x1a0954){return pm2[_0xd9e8('0x8')](_0x35e1d8,function(_0x505164,_0x10c06e){if(_0x505164){return _0x1a0954(_0x505164);}pm2[_0xd9e8('0x7')]();return _0x239959(_0x10c06e);});});});};exports['restart']=function(_0x452866){return connect()['then'](function(){return new BPromise(function(_0x38b02e,_0x32cb21){return pm2[_0xd9e8('0x9')](_0x452866,function(_0x1651d1,_0x3c540c){if(_0x1651d1){return _0x32cb21(_0x1651d1);}pm2[_0xd9e8('0x7')]();return _0x38b02e(_0x3c540c);});});});};exports[_0xd9e8('0xa')]=function(){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x1a1505,_0x1e8334){return pm2[_0xd9e8('0xa')](function(_0x588a70,_0x4ec7eb){if(_0x588a70){return _0x1e8334(_0x588a70);}pm2[_0xd9e8('0x7')]();return _0x1a1505(_0x4ec7eb);});});});};exports[_0xd9e8('0xb')]=function(_0x107959){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x215826,_0x280ca3){return pm2[_0xd9e8('0xb')](_0x107959,function(_0x56328e,_0x322ddc){if(_0x56328e){return _0x280ca3(_0x56328e);}pm2[_0xd9e8('0x7')]();return _0x215826(_0x322ddc);});});});};exports[_0xd9e8('0xc')]=function(_0x42abae){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x47c797,_0x266755){return pm2[_0xd9e8('0xc')](_0x42abae,function(_0x3297dc,_0x73286b){if(_0x3297dc){return _0x266755(_0x3297dc);}pm2[_0xd9e8('0x7')]();return _0x47c797(_0x73286b);});});});};exports[_0xd9e8('0xd')]=function(){return connect()[_0xd9e8('0x6')](function(){return new BPromise(function(_0x174b19,_0x3ce4a0){return pm2[_0xd9e8('0xd')](function(_0x43a59d){if(_0x43a59d){return _0x3ce4a0(_0x43a59d);}return _0x174b19(_0xd9e8('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4898fd9..52aa749 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 _0x74ac=['lastMsgAt','subtract','length','map','info','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','lodash','ioredis','util','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','then'];(function(_0xf96560,_0x1aa54b){var _0x1a7dc3=function(_0x670a97){while(--_0x670a97){_0xf96560['push'](_0xf96560['shift']());}};_0x1a7dc3(++_0x1aa54b);}(_0x74ac,0x17a));var _0xc74a=function(_0x594609,_0x30836c){_0x594609=_0x594609-0x0;var _0x1550ff=_0x74ac[_0x594609];return _0x1550ff;};'use strict';var _=require(_0xc74a('0x0'));var moment=require('moment');var Redis=require(_0xc74a('0x1'));var util=require(_0xc74a('0x2'));var config=require(_0xc74a('0x3'));var db=require(_0xc74a('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xc74a('0x5')](config[_0xc74a('0x6')],{'host':_0xc74a('0x7'),'port':0x18eb});var io=require(_0xc74a('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x237810=0x0;var _0x29f3cd=[];return db[_0xc74a('0x9')]['find']({'raw':!![],'attributes':['id',_0xc74a('0xa')],'where':{'id':0x1}})[_0xc74a('0xb')](function(_0x144f04){_0x237810=_0x144f04['chatTimeout'];if(_0x237810){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0xc74a('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc74a('0xd')](_0x144f04['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x1e2c0f){if(_0x1e2c0f&&_0x1e2c0f[_0xc74a('0xe')]){_0x29f3cd=_[_0xc74a('0xf')](_0x1e2c0f||[],'id');logger[_0xc74a('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x29f3cd[_0xc74a('0x11')]());return db[_0xc74a('0x12')][_0xc74a('0x13')]({'closeReason':_0xc74a('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc74a('0x15')](_0xc74a('0x16'))},{'where':{'id':_0x29f3cd}});}})[_0xc74a('0xb')](function(){if(_0x29f3cd&&_0x29f3cd[_0xc74a('0xe')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x29f3cd[_0xc74a('0x11')]());for(var _0x67f936=0x0;_0x67f936<_0x29f3cd[_0xc74a('0xe')];_0x67f936++){io[_0xc74a('0x17')](_0xc74a('0x18'),{'id':_0x29f3cd[_0x67f936],'closed':!![]});}}})[_0xc74a('0x19')](function(_0x27c69a){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x27c69a?util['inspect'](_0x27c69a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5996=['emit','catch','error','start','moment','ioredis','util','../../config/environment','../logger','redis','defaults','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x2c86e0,_0x5a3dac){var _0x10aa30=function(_0x203482){while(--_0x203482){_0x2c86e0['push'](_0x2c86e0['shift']());}};_0x10aa30(++_0x5a3dac);}(_0x5996,0x1e4));var _0x6599=function(_0x6f17e2,_0x234774){_0x6f17e2=_0x6f17e2-0x0;var _0x1b1bb0=_0x5996[_0x6f17e2];return _0x1b1bb0;};'use strict';var _=require('lodash');var moment=require(_0x6599('0x0'));var Redis=require(_0x6599('0x1'));var util=require(_0x6599('0x2'));var config=require(_0x6599('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6599('0x4'))('schedule');config[_0x6599('0x5')]=_[_0x6599('0x6')](config[_0x6599('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6599('0x7'))(new Redis(config[_0x6599('0x5')]));function closeInteractions(){var _0x4c7be8=0x0;var _0x3573de=[];return db['Setting'][_0x6599('0x8')]({'raw':!![],'attributes':['id',_0x6599('0x9')],'where':{'id':0x1}})['then'](function(_0x3f6a9f){_0x4c7be8=_0x3f6a9f[_0x6599('0x9')];if(_0x4c7be8){return db[_0x6599('0xa')][_0x6599('0xb')]({'raw':!![],'attributes':['id',_0x6599('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6599('0xd')](_0x3f6a9f[_0x6599('0x9')],_0x6599('0xe'))}}});}else{return[];}})['then'](function(_0x41af23){if(_0x41af23&&_0x41af23[_0x6599('0xf')]){_0x3573de=_[_0x6599('0x10')](_0x41af23||[],'id');logger[_0x6599('0x11')](_0x6599('0x12'),_0x3573de[_0x6599('0x13')]());return db[_0x6599('0xa')]['update']({'closeReason':_0x6599('0x14'),'disposition':_0x6599('0x15'),'closed':!![],'closedAt':moment()[_0x6599('0x16')](_0x6599('0x17'))},{'where':{'id':_0x3573de}});}})[_0x6599('0x18')](function(){if(_0x3573de&&_0x3573de[_0x6599('0xf')]){logger['info'](_0x6599('0x19'),_0x3573de['join']());for(var _0x12bc5c=0x0;_0x12bc5c<_0x3573de[_0x6599('0xf')];_0x12bc5c++){io[_0x6599('0x1a')]('chatInteraction:update',{'id':_0x3573de[_0x12bc5c],'closed':!![]});}}})[_0x6599('0x1b')](function(_0x572084){logger[_0x6599('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x572084?util['inspect'](_0x572084,{'showHidden':![],'depth':null}):'');});}exports[_0x6599('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 52fc44d..9f1bc11 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff42=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x14ce12,_0x28d27f){var _0x2b0d1c=function(_0x417e4c){while(--_0x417e4c){_0x14ce12['push'](_0x14ce12['shift']());}};_0x2b0d1c(++_0x28d27f);}(_0xff42,0x171));var _0x2ff4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xff42[_0x20a584];return _0x4b41a8;};'use strict';function start(){var _0x3405e4=require(_0x2ff4('0x0'));return _0x3405e4['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +'use strict';function start(){var _0x343c49=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x343c49['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5c23a5b..1a76109 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 _0xe125=['output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','update','update\x20cron','run','util','lodash','moment','jayson/promise','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled'];(function(_0x3bfead,_0x569ba6){var _0x6fabb4=function(_0x3d1641){while(--_0x3d1641){_0x3bfead['push'](_0x3bfead['shift']());}};_0x6fabb4(++_0x569ba6);}(_0xe125,0x166));var _0x5e12=function(_0x5b4089,_0x407182){_0x5b4089=_0x5b4089-0x0;var _0x26b840=_0xe125[_0x5b4089];return _0x26b840;};'use strict';var fs=require('fs');var util=require(_0x5e12('0x0'));var path=require('path');var _=require(_0x5e12('0x1'));var moment=require(_0x5e12('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x5e12('0x3'));var BPromise=require('bluebird');var logger=require('../logger')(_0x5e12('0x4'));var db=require(_0x5e12('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5e12('0x6'));var client=jayson[_0x5e12('0x7')][_0x5e12('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4567bd,_0xa3416f){return function(){logger[_0x5e12('0x9')](_0x5e12('0xa'),_0x4567bd[_0x5e12('0xb')]);var _0xc32207=!![];var _0x4be654=_0x4567bd[_0x5e12('0xc')][_0x5e12('0xd')]();var _0x3a9103={'account':_0x4be654,'message':{'from':util[_0x5e12('0xe')](_0x5e12('0xf'),_0x4567bd[_0x5e12('0xc')][_0x5e12('0x10')],_0x4567bd['MailAccount'][_0x5e12('0xb')]||_0x4567bd[_0x5e12('0xc')][_0x5e12('0x11')]['user']),'to':_0x4567bd[_0x5e12('0xb')],'cc':_0x4567bd['cc'],'bcc':_0x4567bd['bcc'],'subject':util[_0x5e12('0xe')](_0x5e12('0x12'),_0xa3416f[_0x5e12('0x10')],_0x4567bd[_0x5e12('0x13')],_0x4567bd[_0x5e12('0x14')])}};var _0x61eae3=path[_0x5e12('0x15')](__dirname,_0x5e12('0x16'));var _0x301604=_0xa3416f[_0x5e12('0x17')];var _0x5a46b7=util[_0x5e12('0xe')](_0x5e12('0x18'),path[_0x5e12('0x19')](_0xa3416f[_0x5e12('0x17')],path['extname'](_0xa3416f[_0x5e12('0x17')])),_0x5e12('0x1a'));var _0x1c2c65=path[_0x5e12('0x15')](_0x61eae3,_0x301604);var _0x2b20c0=path[_0x5e12('0x15')](_0x61eae3,_0x5a46b7);if(fs[_0x5e12('0x1b')](_0x1c2c65)){_0xa3416f[_0x5e12('0x1c')]='Sent';_0x3a9103['message']['attachments']=[{'filename':_0x301604,'path':_0x1c2c65}];_0x3a9103[_0x5e12('0x1d')][_0x5e12('0x1e')]=util[_0x5e12('0xe')](_0x5e12('0x1f'),JSON[_0x5e12('0x20')](_0xa3416f,null,0x2));}else if(fs[_0x5e12('0x1b')](_0x2b20c0)){_0xa3416f['status']=_0x5e12('0x21');_0x3a9103[_0x5e12('0x1d')]['attachments']=[{'filename':_0x5a46b7,'path':_0x2b20c0}];}else{_0x3a9103[_0x5e12('0x1d')][_0x5e12('0x1e')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4567bd['sendIfEmpty']){_0xc32207=![];logger['info'](_0x5e12('0x22'));}}if(_0xc32207){return client[_0x5e12('0x23')]('SendMail',_0x3a9103)[_0x5e12('0x24')](function(_0x2e5872){if(_0x2e5872['error']){return logger[_0x5e12('0x25')](_0x5e12('0x26'),JSON[_0x5e12('0x20')](_0x2e5872));}return logger[_0x5e12('0x9')](_0x5e12('0x27'));})[_0x5e12('0x28')](function(_0x41950a){return logger['error'](_0x5e12('0x26'),JSON[_0x5e12('0x20')](_0x41950a));});}};}function handleError(){return function(_0x5eadf3){return logger[_0x5e12('0x25')](JSON['stringify'](_0x5eadf3));};}function handleResult(_0x2f2246){return function(_0x432528){logger[_0x5e12('0x9')](_0x5e12('0x29'),JSON[_0x5e12('0x20')](_0x432528));if(_0x2f2246[_0x5e12('0xc')]&&_0x2f2246[_0x5e12('0xc')][_0x5e12('0x11')]&&!_[_0x5e12('0x2a')](_0x2f2246[_0x5e12('0xb')])){setTimeout(handleSendEmail(_0x2f2246,_0x432528),0x3c*0x3e8);}};}function handleJob(_0x2c6e68){return function(){try{if(_[_0x5e12('0x2a')](_0x2c6e68[_0x5e12('0x13')])){return logger[_0x5e12('0x9')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x5e12('0x2a')](_0x2c6e68[_0x5e12('0x14')])){return logger['info'](_0x5e12('0x2b'));}var _0x1e8751={'startDate':moment()[_0x5e12('0x2c')](_0x2c6e68['subtractNumber'],_0x2c6e68['subtractUnit'])[_0x5e12('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x5e12('0xe')](_0x5e12('0x2d')),'type':_0x5e12('0x2e'),'output':_0x2c6e68[_0x5e12('0x2f')],'name':_0x2c6e68[_0x5e12('0x10')]};if(!_[_0x5e12('0x2a')](_0x2c6e68[_0x5e12('0x30')])){logger[_0x5e12('0x9')](_0x5e12('0x31'),_0x2c6e68['DefaultReportId']);return analyticDefaultReportController[_0x5e12('0x32')]({'id':_0x2c6e68['DefaultReportId']},_0x1e8751)['then'](handleResult(_0x2c6e68))[_0x5e12('0x28')](handleError());}if(!_[_0x5e12('0x2a')](_0x2c6e68[_0x5e12('0x33')])){logger[_0x5e12('0x9')](_0x5e12('0x34'),_0x2c6e68[_0x5e12('0x33')]);return analyticCustomReportController[_0x5e12('0x32')]({'id':_0x2c6e68['CustomReportId']},_0x1e8751)['then'](handleResult(_0x2c6e68))[_0x5e12('0x28')](handleError());}}catch(_0x491118){logger[_0x5e12('0x25')](JSON[_0x5e12('0x20')](_0x491118));}return logger[_0x5e12('0x9')](_0x5e12('0x35'));};}function getJobs(_0x29ad4d){var _0x5a17e4={};if(_0x29ad4d){_0x5a17e4['id']=_0x29ad4d;}return db[_0x5e12('0x36')]['findAll']({'where':_0x5a17e4,'include':[{'model':db[_0x5e12('0xc')],'attributes':['id',_0x5e12('0x10'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x5e12('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x5e12('0x37')}]}]}]})[_0x5e12('0x24')](function(_0x5d5811){var _0x498246=_[_0x5e12('0x38')](manager[_0x5e12('0x39')]);var _0x263b91=_['map'](_0x5d5811,function(_0x19103a){return _0x19103a['id']['toString']();});var _0x3e93ef=_[_0x5e12('0x3a')](_0x5d5811,function(_0x2b1856){return _0x2b1856['id'][_0x5e12('0x3b')]();});var _0x4947d9=_0x29ad4d?_0x263b91:_[_0x5e12('0x3c')](_0x263b91,_0x498246);var _0x4c77ec=_[_0x5e12('0x3d')](_0x263b91,_0x498246);var _0x2ca786=_[_0x5e12('0x3c')](_0x498246,_0x263b91);var _0x22261c;var _0x46c7b2;for(_0x22261c=0x0;_0x22261c<_0x2ca786[_0x5e12('0x3e')]&&!_0x29ad4d;_0x22261c+=0x1){_0x46c7b2=_0x2ca786[_0x22261c][_0x5e12('0x3b')]();if(manager[_0x5e12('0x3f')](_0x46c7b2)){manager[_0x5e12('0x40')](_0x46c7b2);manager[_0x5e12('0x41')](_0x46c7b2);logger['info']('delete\x20cron',_0x46c7b2);}}logger[_0x5e12('0x9')](_0x5e12('0x42'),JSON[_0x5e12('0x20')](_0x4947d9));for(_0x22261c=0x0;_0x22261c<_0x4947d9[_0x5e12('0x3e')];_0x22261c+=0x1){_0x46c7b2=_0x4947d9[_0x22261c][_0x5e12('0x3b')]();logger['info'](_0x5e12('0x43'),_0x46c7b2);if(_0x29ad4d){logger[_0x5e12('0x9')](_0x5e12('0x44'),_0x29ad4d);logger[_0x5e12('0x9')](JSON[_0x5e12('0x20')](_0x3e93ef[_0x46c7b2]));BPromise[_0x5e12('0x45')]()['then'](handleJob(_0x3e93ef[_0x46c7b2]));logger[_0x5e12('0x9')](_0x5e12('0x46'),_0x3e93ef[_0x46c7b2][_0x5e12('0x10')],_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]);}else if(_0x3e93ef[_0x46c7b2]['cron']&&_0x3e93ef[_0x46c7b2][_0x5e12('0x48')]&&moment()['isBetween'](_0x3e93ef[_0x46c7b2][_0x5e12('0x49')],_0x3e93ef[_0x46c7b2][_0x5e12('0x4a')])){manager[_0x5e12('0x4b')](_0x46c7b2,_0x3e93ef[_0x46c7b2][_0x5e12('0x47')],handleJob(_0x3e93ef[_0x46c7b2]));manager[_0x5e12('0x4c')](_0x46c7b2);logger[_0x5e12('0x9')](_0x5e12('0x4d'),_0x3e93ef[_0x46c7b2][_0x5e12('0x10')],_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]);}else if(manager[_0x5e12('0x3f')](_0x46c7b2)){manager['stop'](_0x46c7b2);manager[_0x5e12('0x41')](_0x46c7b2);logger[_0x5e12('0x9')]('stop\x20cron',_0x3e93ef[_0x46c7b2]['name'],_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]);}}for(_0x22261c=0x0,_0x46c7b2;_0x22261c<_0x4c77ec[_0x5e12('0x3e')]&&!_0x29ad4d;_0x22261c+=0x1){_0x46c7b2=_0x4c77ec[_0x22261c]['toString']();if(manager[_0x5e12('0x3f')](_0x46c7b2)){if(_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]&&_0x3e93ef[_0x46c7b2][_0x5e12('0x48')]&&moment()['isBetween'](_0x3e93ef[_0x46c7b2][_0x5e12('0x49')],_0x3e93ef[_0x46c7b2][_0x5e12('0x4a')])){manager[_0x5e12('0x4e')](_0x46c7b2,_0x3e93ef[_0x46c7b2][_0x5e12('0x47')],handleJob(_0x3e93ef[_0x46c7b2]));logger[_0x5e12('0x9')](_0x5e12('0x4f'),_0x3e93ef[_0x46c7b2][_0x5e12('0x10')],_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]);}else{manager['stop'](_0x46c7b2);manager[_0x5e12('0x41')](_0x46c7b2);logger[_0x5e12('0x9')]('stop\x20cron',_0x3e93ef[_0x46c7b2][_0x5e12('0x10')],_0x3e93ef[_0x46c7b2][_0x5e12('0x47')]);}}}})['catch'](function(_0x190ab5){logger[_0x5e12('0x25')](JSON[_0x5e12('0x20')](_0x190ab5));});}exports[_0x5e12('0x50')]=function(_0x3d2ca7){return getJobs(_0x3d2ca7);};exports[_0x5e12('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x47a6=['%s.%s','basename','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','isNil','exec\x20custom\x20report\x20id:%s','CustomReportId','then','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','exists','stop','delete\x20cron','length','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','path','moment','jayson/promise','bluebird','schedule','../../mysqldb','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','savename'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x47a6,0x84));var _0x647a=function(_0x163c1c,_0x4737e6){_0x163c1c=_0x163c1c-0x0;var _0x354bb1=_0x47a6[_0x163c1c];return _0x354bb1;};'use strict';var fs=require('fs');var util=require(_0x647a('0x0'));var path=require(_0x647a('0x1'));var _=require('lodash');var moment=require(_0x647a('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x647a('0x3'));var BPromise=require(_0x647a('0x4'));var logger=require('../logger')(_0x647a('0x5'));var db=require(_0x647a('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x647a('0x7')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x418661,_0x25ecac){return function(){logger['info'](_0x647a('0x8'),_0x418661[_0x647a('0x9')]);var _0x26d3d1=!![];var _0x4a870b=_0x418661[_0x647a('0xa')]['getSmtpOptions']();var _0x5e1674={'account':_0x4a870b,'message':{'from':util[_0x647a('0xb')](_0x647a('0xc'),_0x418661[_0x647a('0xa')]['name'],_0x418661['MailAccount'][_0x647a('0x9')]||_0x418661[_0x647a('0xa')][_0x647a('0xd')][_0x647a('0xe')]),'to':_0x418661[_0x647a('0x9')],'cc':_0x418661['cc'],'bcc':_0x418661[_0x647a('0xf')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x25ecac[_0x647a('0x10')],_0x418661[_0x647a('0x11')],_0x418661[_0x647a('0x12')])}};var _0x3f7e9a=path[_0x647a('0x13')](__dirname,_0x647a('0x14'));var _0x45fd71=_0x25ecac[_0x647a('0x15')];var _0x4b944a=util[_0x647a('0xb')](_0x647a('0x16'),path[_0x647a('0x17')](_0x25ecac[_0x647a('0x15')],path['extname'](_0x25ecac['savename'])),'zip');var _0x3d1902=path[_0x647a('0x13')](_0x3f7e9a,_0x45fd71);var _0x1b617f=path[_0x647a('0x13')](_0x3f7e9a,_0x4b944a);if(fs[_0x647a('0x18')](_0x3d1902)){_0x25ecac[_0x647a('0x19')]=_0x647a('0x1a');_0x5e1674[_0x647a('0x1b')][_0x647a('0x1c')]=[{'filename':_0x45fd71,'path':_0x3d1902}];_0x5e1674[_0x647a('0x1b')][_0x647a('0x1d')]=util[_0x647a('0xb')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x647a('0x1e')](_0x25ecac,null,0x2));}else if(fs[_0x647a('0x18')](_0x1b617f)){_0x25ecac[_0x647a('0x19')]=_0x647a('0x1a');_0x5e1674['message']['attachments']=[{'filename':_0x4b944a,'path':_0x1b617f}];}else{_0x5e1674[_0x647a('0x1b')][_0x647a('0x1d')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x418661[_0x647a('0x1f')]){_0x26d3d1=![];logger[_0x647a('0x20')](_0x647a('0x21'));}}if(_0x26d3d1){return client[_0x647a('0x22')]('SendMail',_0x5e1674)['then'](function(_0xfb0662){if(_0xfb0662[_0x647a('0x23')]){return logger[_0x647a('0x23')](_0x647a('0x24'),JSON['stringify'](_0xfb0662));}return logger[_0x647a('0x20')](_0x647a('0x25'));})[_0x647a('0x26')](function(_0x1d063f){return logger['error']('error\x20mail',JSON[_0x647a('0x1e')](_0x1d063f));});}};}function handleError(){return function(_0x5f20b2){return logger[_0x647a('0x23')](JSON['stringify'](_0x5f20b2));};}function handleResult(_0x2ec975){return function(_0x16c1db){logger[_0x647a('0x20')](_0x647a('0x27'),JSON['stringify'](_0x16c1db));if(_0x2ec975[_0x647a('0xa')]&&_0x2ec975[_0x647a('0xa')][_0x647a('0xd')]&&!_['isNil'](_0x2ec975[_0x647a('0x9')])){setTimeout(handleSendEmail(_0x2ec975,_0x16c1db),0x3c*0x3e8);}};}function handleJob(_0x5f2a01){return function(){try{if(_['isNil'](_0x5f2a01[_0x647a('0x11')])){return logger[_0x647a('0x20')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x5f2a01['subtractUnit'])){return logger[_0x647a('0x20')](_0x647a('0x28'));}var _0xdc4cde={'startDate':moment()[_0x647a('0x29')](_0x5f2a01[_0x647a('0x11')],_0x5f2a01[_0x647a('0x12')])[_0x647a('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x647a('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x647a('0x2a'),'output':_0x5f2a01[_0x647a('0x2b')],'name':_0x5f2a01[_0x647a('0x10')]};if(!_['isNil'](_0x5f2a01[_0x647a('0x2c')])){logger[_0x647a('0x20')](_0x647a('0x2d'),_0x5f2a01[_0x647a('0x2c')]);return analyticDefaultReportController[_0x647a('0x2e')]({'id':_0x5f2a01['DefaultReportId']},_0xdc4cde)['then'](handleResult(_0x5f2a01))[_0x647a('0x26')](handleError());}if(!_[_0x647a('0x2f')](_0x5f2a01['CustomReportId'])){logger[_0x647a('0x20')](_0x647a('0x30'),_0x5f2a01['CustomReportId']);return analyticCustomReportController[_0x647a('0x2e')]({'id':_0x5f2a01[_0x647a('0x31')]},_0xdc4cde)[_0x647a('0x32')](handleResult(_0x5f2a01))['catch'](handleError());}}catch(_0x56857b){logger[_0x647a('0x23')](JSON['stringify'](_0x56857b));}return logger[_0x647a('0x20')](_0x647a('0x33'));};}function getJobs(_0x3e63b2){var _0x282cc1={};if(_0x3e63b2){_0x282cc1['id']=_0x3e63b2;}return db[_0x647a('0x34')][_0x647a('0x35')]({'where':_0x282cc1,'include':[{'model':db[_0x647a('0xa')],'attributes':['id',_0x647a('0x10'),_0x647a('0x9')],'include':[{'model':db['MailServerOut'],'as':_0x647a('0xd'),'include':[{'model':db[_0x647a('0x36')],'as':_0x647a('0x36')}]}]}]})[_0x647a('0x32')](function(_0x476ed7){var _0x5907e1=_[_0x647a('0x37')](manager[_0x647a('0x38')]);var _0x3d349b=_[_0x647a('0x39')](_0x476ed7,function(_0x37c68d){return _0x37c68d['id'][_0x647a('0x3a')]();});var _0x28f221=_['keyBy'](_0x476ed7,function(_0x4a9e4f){return _0x4a9e4f['id'][_0x647a('0x3a')]();});var _0x4e3b32=_0x3e63b2?_0x3d349b:_[_0x647a('0x3b')](_0x3d349b,_0x5907e1);var _0xb8e372=_['intersection'](_0x3d349b,_0x5907e1);var _0x59d0b1=_[_0x647a('0x3b')](_0x5907e1,_0x3d349b);var _0xaa148b;var _0x10f299;for(_0xaa148b=0x0;_0xaa148b<_0x59d0b1['length']&&!_0x3e63b2;_0xaa148b+=0x1){_0x10f299=_0x59d0b1[_0xaa148b][_0x647a('0x3a')]();if(manager[_0x647a('0x3c')](_0x10f299)){manager[_0x647a('0x3d')](_0x10f299);manager['deleteJob'](_0x10f299);logger['info'](_0x647a('0x3e'),_0x10f299);}}logger[_0x647a('0x20')]('toRun',JSON[_0x647a('0x1e')](_0x4e3b32));for(_0xaa148b=0x0;_0xaa148b<_0x4e3b32[_0x647a('0x3f')];_0xaa148b+=0x1){_0x10f299=_0x4e3b32[_0xaa148b]['toString']();logger[_0x647a('0x20')]('index',_0x10f299);if(_0x3e63b2){logger[_0x647a('0x20')](_0x647a('0x40'),_0x3e63b2);logger[_0x647a('0x20')](JSON[_0x647a('0x1e')](_0x28f221[_0x10f299]));BPromise['resolve']()[_0x647a('0x32')](handleJob(_0x28f221[_0x10f299]));logger[_0x647a('0x20')]('run\x20job',_0x28f221[_0x10f299]['name'],_0x28f221[_0x10f299][_0x647a('0x41')]);}else if(_0x28f221[_0x10f299]['cron']&&_0x28f221[_0x10f299][_0x647a('0x42')]&&moment()[_0x647a('0x43')](_0x28f221[_0x10f299][_0x647a('0x44')],_0x28f221[_0x10f299][_0x647a('0x45')])){manager[_0x647a('0x46')](_0x10f299,_0x28f221[_0x10f299]['cron'],handleJob(_0x28f221[_0x10f299]));manager[_0x647a('0x47')](_0x10f299);logger[_0x647a('0x20')](_0x647a('0x48'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}else if(manager[_0x647a('0x3c')](_0x10f299)){manager['stop'](_0x10f299);manager[_0x647a('0x49')](_0x10f299);logger[_0x647a('0x20')](_0x647a('0x4a'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}}for(_0xaa148b=0x0,_0x10f299;_0xaa148b<_0xb8e372['length']&&!_0x3e63b2;_0xaa148b+=0x1){_0x10f299=_0xb8e372[_0xaa148b][_0x647a('0x3a')]();if(manager['exists'](_0x10f299)){if(_0x28f221[_0x10f299][_0x647a('0x41')]&&_0x28f221[_0x10f299][_0x647a('0x42')]&&moment()[_0x647a('0x43')](_0x28f221[_0x10f299][_0x647a('0x44')],_0x28f221[_0x10f299][_0x647a('0x45')])){manager['update'](_0x10f299,_0x28f221[_0x10f299][_0x647a('0x41')],handleJob(_0x28f221[_0x10f299]));logger['info'](_0x647a('0x4b'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}else{manager[_0x647a('0x3d')](_0x10f299);manager[_0x647a('0x49')](_0x10f299);logger['info'](_0x647a('0x4a'),_0x28f221[_0x10f299][_0x647a('0x10')],_0x28f221[_0x10f299][_0x647a('0x41')]);}}}})[_0x647a('0x26')](function(_0x479f51){logger['error'](JSON['stringify'](_0x479f51));});}exports[_0x647a('0x4c')]=function(_0xc2cd0e){return getJobs(_0xc2cd0e);};exports['start']=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 944d983..9e44985 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 _0xd9dc=['[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','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','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','sentiment','sentimentAccountId','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','findOne','catch','name','error'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x560247,_0xff219b){_0x560247=_0x560247-0x0;var _0x577a0e=_0xd9dc[_0x560247];return _0x577a0e;};var _=require('lodash');var AWS=require(_0xcd9d('0x0'));var rp=require(_0xcd9d('0x1'));var util=require('util');var BPromise=require(_0xcd9d('0x2'));var db=require(_0xcd9d('0x3'))['db'];var logger=require(_0xcd9d('0x4'))('transcribe');function getTranscriptionJob(_0x39581e,_0x12aae1,_0x2c0be0,_0x15c0e2){return new Promise(function(_0x8cc2e4,_0x50f1e2){var _0x288482=new AWS[(_0xcd9d('0x5'))]({'accessKeyId':_0x12aae1,'secretAccessKey':_0x39581e,'region':_0x2c0be0});_0x288482[_0xcd9d('0x6')]({'TranscriptionJobName':_0x15c0e2},function(_0x285e75,_0x45130c){if(_0x285e75){return _0x50f1e2(_0x285e75);}else{return _0x8cc2e4(_0x45130c);}});});}function sentiment(_0x549558,_0x1e6612,_0x114a7c,_0x32dce7,_0x112c01){return new Promise(function(_0x18f6a7,_0x2bbf4e){var _0x23b23b=new AWS[(_0xcd9d('0x7'))]({'accessKeyId':_0x1e6612,'secretAccessKey':_0x549558,'region':_0x114a7c});_0x23b23b['detectSentiment']({'Text':_0x32dce7,'LanguageCode':_0x112c01[_0xcd9d('0x8')](0x0,0x2)},function(_0x588a3d,_0x2770cf){if(_0x588a3d){return _0x2bbf4e(_0x588a3d);}else{return _0x18f6a7(_0x2770cf);}});});}function checkTranscribeJob(_0x516686,_0x1ec955,_0x3ab0af){var _0x2fa1d0;return new BPromise(function(_0x49028e,_0x1d07c7){logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0xa'),_0x516686['id'],_0x516686[_0xcd9d('0xb')]));return getTranscriptionJob(_0x3ab0af['data1'],_0x3ab0af[_0xcd9d('0xc')],_0x1ec955[_0xcd9d('0xd')],_0x516686['transcribeName'])[_0xcd9d('0xe')](function(_0x5a7248){logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x10'),_0x516686['id'],_0x516686[_0xcd9d('0xb')],_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')]));if(!_0x516686[_0xcd9d('0x13')]){switch(_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')]){case _0xcd9d('0x14'):var _0x1f7c8f={'transcribeStatus':_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x12')],'fileUri':_0x5a7248['TranscriptionJob'][_0xcd9d('0x15')][_0xcd9d('0x16')]};logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x17'),_0x516686['id']));return rp({'uri':_0x5a7248[_0xcd9d('0x11')][_0xcd9d('0x15')][_0xcd9d('0x16')],'json':!![]})[_0xcd9d('0xe')](function(_0x2891b6){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x516686['id']));if(_0x2891b6&&_0x2891b6['results']&&_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')]&&_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')]['length']){_0x1f7c8f[_0xcd9d('0x13')]='';for(var _0x2ecff5=0x0;_0x2ecff5<_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')][_0xcd9d('0x1a')];_0x2ecff5++){_0x1f7c8f[_0xcd9d('0x13')]+=_0x2891b6[_0xcd9d('0x18')][_0xcd9d('0x19')][_0x2ecff5][_0xcd9d('0x1b')]+'';}}return _0x516686[_0xcd9d('0x1c')](_0x1f7c8f);})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x516686['id']));if(!_0x516686[_0xcd9d('0x1d')]){throw new db[(_0xcd9d('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1ec955[_0xcd9d('0x1f')]||!_0x1ec955[_0xcd9d('0x20')]||!_0x1ec955['sentimentRegion']||!_0x1ec955[_0xcd9d('0x21')]||!_0x1ec955[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x24'));}if(!_0x1f7c8f['fileText']){throw new Error(_0xcd9d('0x25'));}if(_0x1ec955[_0xcd9d('0x20')]===_0x3ab0af['id']){return _0x3ab0af;}else{return db[_0xcd9d('0x26')]['findOne']({'where':{'id':_settings[_0xcd9d('0x20')]}});}})[_0xcd9d('0xe')](function(_0x38e3e2){if(!_0x38e3e2){throw new db['Sequelize'][(_0xcd9d('0x23'))](_0xcd9d('0x27'));}if(!_0x38e3e2[_0xcd9d('0x28')]||!_0x38e3e2[_0xcd9d('0xc')]){throw new db['Sequelize']['ValidationError'](_0xcd9d('0x29'));}_0x2fa1d0=_0x38e3e2;logger['info'](util['format'](_0xcd9d('0x2a'),_0x516686['id']));return sentiment(_0x2fa1d0[_0xcd9d('0x28')],_0x2fa1d0[_0xcd9d('0xc')],_0x1ec955[_0xcd9d('0x2b')],_0x1f7c8f['fileText'],_0x1ec955['language']);})[_0xcd9d('0xe')](function(_0x8e354c){logger[_0xcd9d('0xf')](util['format'](_0xcd9d('0x2c'),_0x516686['id']));return _0x516686[_0xcd9d('0x1c')]({'sentiment':_0x8e354c[_0xcd9d('0x2d')],'sPositive':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x2f')],'sNegative':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x30')],'sMixed':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x31')],'sNeutral':_0x8e354c[_0xcd9d('0x2e')][_0xcd9d('0x32')]});})[_0xcd9d('0xe')](function(){logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});case'FAILED':return _0x516686['update']({'transcribeStatus':_0xcd9d('0x34'),'failureReason':_0x5a7248['TranscriptionJob']['FailureReason']})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});default:logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x35'),_0x516686['id']));break;}}else{return BPromise['resolve']()[_0xcd9d('0xe')](function(){if(!_0x516686[_0xcd9d('0x1d')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1ec955['sentiment']||!_0x1ec955[_0xcd9d('0x20')]||!_0x1ec955['sentimentRegion']||!_0x1ec955[_0xcd9d('0x21')]||!_0x1ec955[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x24'));}if(!_0x516686[_0xcd9d('0x13')]){throw new Error(_0xcd9d('0x25'));}if(_0x1ec955[_0xcd9d('0x20')]===_0x3ab0af['id']){return _0x3ab0af;}else{return db[_0xcd9d('0x26')][_0xcd9d('0x36')]({'where':{'id':_settings[_0xcd9d('0x20')]}});}})[_0xcd9d('0xe')](function(_0x127eb8){if(!_0x127eb8){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x127eb8['data1']||!_0x127eb8['data2']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x29'));}_0x2fa1d0=_0x127eb8;logger['info'](util[_0xcd9d('0x9')](_0xcd9d('0x2a'),_0x516686['id']));return sentiment(_0x2fa1d0['data1'],_0x2fa1d0[_0xcd9d('0xc')],_0x1ec955['sentimentRegion'],_0x516686[_0xcd9d('0x13')],_0x1ec955[_0xcd9d('0x21')]);})['then'](function(_0x5224c1){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x2c'),_0x516686['id']));return _0x516686[_0xcd9d('0x1c')]({'sentiment':_0x5224c1[_0xcd9d('0x2d')],'sPositive':_0x5224c1[_0xcd9d('0x2e')]['Positive'],'sNegative':_0x5224c1['SentimentScore']['Negative'],'sMixed':_0x5224c1[_0xcd9d('0x2e')][_0xcd9d('0x31')],'sNeutral':_0x5224c1['SentimentScore'][_0xcd9d('0x32')],'transcribeStatus':_0xcd9d('0x14')});})[_0xcd9d('0xe')](function(){logger[_0xcd9d('0xf')](util[_0xcd9d('0x9')](_0xcd9d('0x33'),_0x516686['id']));_0x49028e();});}})[_0xcd9d('0x37')](function(_0x172c10){if(_0x172c10){if(!_0x172c10[_0xcd9d('0x38')]||_0x172c10[_0xcd9d('0x38')]!=='SequelizeValidationError'){logger[_0xcd9d('0x39')](util[_0xcd9d('0x9')](_0xcd9d('0x3a'),_0x516686['id']),util[_0xcd9d('0x3b')](_0x172c10,{'showHidden':![],'depth':null}));}}_0x49028e();});});}function checkTranscribe(){var _0x2011af;var _0x1ca33e;var _0xc8f38a;return db[_0xcd9d('0x3c')]['findAll']({'where':{'transcribeStatus':_0xcd9d('0x3d')}})[_0xcd9d('0xe')](function(_0x46a5d6){if(!_0x46a5d6||!_0x46a5d6['length']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x3e'));}_0x2011af=_0x46a5d6;return db[_0xcd9d('0x3f')][_0xcd9d('0x36')]({'where':{'id':0x1}});})[_0xcd9d('0xe')](function(_0x153666){if(!_0x153666){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x40'));}_0x1ca33e=_0x153666;if(!_0x1ca33e[_0xcd9d('0x41')]||!_0x1ca33e[_0xcd9d('0x42')]||!_0x1ca33e[_0xcd9d('0xd')]||!_0x1ca33e['language']||!_0x1ca33e[_0xcd9d('0x22')]){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))](_0xcd9d('0x43'));}return db['CloudProvider'][_0xcd9d('0x36')]({'where':{'id':_0x1ca33e[_0xcd9d('0x42')]}});})[_0xcd9d('0xe')](function(_0x425e86){if(!_0x425e86){throw new db[(_0xcd9d('0x1e'))]['ValidationError'](_0xcd9d('0x27'));}if(!_0x425e86[_0xcd9d('0x28')]||!_0x425e86['data2']){throw new db[(_0xcd9d('0x1e'))][(_0xcd9d('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0xc8f38a=_0x425e86;var _0x22b8f9=[];_0x2011af[_0xcd9d('0x44')](function(_0x28f4bd){_0x22b8f9[_0xcd9d('0x45')](checkTranscribeJob(_0x28f4bd,_0x1ca33e,_0xc8f38a));});return BPromise[_0xcd9d('0x46')](_0x22b8f9);})[_0xcd9d('0x37')](function(_0x5ebe93){if(_0x5ebe93){if(!_0x5ebe93['name']||_0x5ebe93['name']!==_0xcd9d('0x47')){logger[_0xcd9d('0x39')](util[_0xcd9d('0x3b')](_0x5ebe93,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3c2c=['push','all','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','Comprehend','substring','format','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','findOne','forEach'];(function(_0x1e16b5,_0x83e227){var _0x719844=function(_0x435b01){while(--_0x435b01){_0x1e16b5['push'](_0x1e16b5['shift']());}};_0x719844(++_0x83e227);}(_0x3c2c,0x160));var _0xc3c2=function(_0x1cea01,_0x271a69){_0x1cea01=_0x1cea01-0x0;var _0x51dd7d=_0x3c2c[_0x1cea01];return _0x51dd7d;};var _=require(_0xc3c2('0x0'));var AWS=require(_0xc3c2('0x1'));var rp=require(_0xc3c2('0x2'));var util=require(_0xc3c2('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xc3c2('0x4'))(_0xc3c2('0x5'));function getTranscriptionJob(_0x2f4e7e,_0x3bb44f,_0x50d730,_0x312ebf){return new Promise(function(_0x158a5f,_0x234da9){var _0x21fa50=new AWS[(_0xc3c2('0x6'))]({'accessKeyId':_0x3bb44f,'secretAccessKey':_0x2f4e7e,'region':_0x50d730});_0x21fa50['getTranscriptionJob']({'TranscriptionJobName':_0x312ebf},function(_0x5daa76,_0x55840b){if(_0x5daa76){return _0x234da9(_0x5daa76);}else{return _0x158a5f(_0x55840b);}});});}function sentiment(_0x1ecb0c,_0x3c249d,_0x5bf3d4,_0x2ef4d1,_0x5c60cc){return new Promise(function(_0x5b81e6,_0x1c5e1c){var _0x15477c=new AWS[(_0xc3c2('0x7'))]({'accessKeyId':_0x3c249d,'secretAccessKey':_0x1ecb0c,'region':_0x5bf3d4});_0x15477c['detectSentiment']({'Text':_0x2ef4d1,'LanguageCode':_0x5c60cc[_0xc3c2('0x8')](0x0,0x2)},function(_0x3ed3ab,_0x124560){if(_0x3ed3ab){return _0x1c5e1c(_0x3ed3ab);}else{return _0x5b81e6(_0x124560);}});});}function checkTranscribeJob(_0x28b548,_0x578ac4,_0x3920e7){var _0x1befad;return new BPromise(function(_0x515bbc,_0x17df20){logger['info'](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x28b548['id'],_0x28b548[_0xc3c2('0xa')]));return getTranscriptionJob(_0x3920e7['data1'],_0x3920e7[_0xc3c2('0xb')],_0x578ac4[_0xc3c2('0xc')],_0x28b548['transcribeName'])[_0xc3c2('0xd')](function(_0x36f10f){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0xf'),_0x28b548['id'],_0x28b548[_0xc3c2('0xa')],_0x36f10f['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x28b548['fileText']){switch(_0x36f10f[_0xc3c2('0x10')][_0xc3c2('0x11')]){case _0xc3c2('0x12'):var _0x164a52={'transcribeStatus':_0x36f10f[_0xc3c2('0x10')]['TranscriptionJobStatus'],'fileUri':_0x36f10f['TranscriptionJob'][_0xc3c2('0x13')][_0xc3c2('0x14')]};logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x15'),_0x28b548['id']));return rp({'uri':_0x36f10f['TranscriptionJob'][_0xc3c2('0x13')][_0xc3c2('0x14')],'json':!![]})[_0xc3c2('0xd')](function(_0x57458a){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x16'),_0x28b548['id']));if(_0x57458a&&_0x57458a['results']&&_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')]&&_0x57458a[_0xc3c2('0x17')]['transcripts'][_0xc3c2('0x19')]){_0x164a52['fileText']='';for(var _0x323daf=0x0;_0x323daf<_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')][_0xc3c2('0x19')];_0x323daf++){_0x164a52[_0xc3c2('0x1a')]+=_0x57458a[_0xc3c2('0x17')][_0xc3c2('0x18')][_0x323daf]['transcript']+'';}}return _0x28b548['update'](_0x164a52);})['then'](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));if(!_0x28b548['tempSentiment']){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x1e'));}if(!_0x578ac4[_0xc3c2('0x1f')]||!_0x578ac4[_0xc3c2('0x20')]||!_0x578ac4[_0xc3c2('0x21')]||!_0x578ac4[_0xc3c2('0x22')]||!_0x578ac4[_0xc3c2('0x23')]){throw new db['Sequelize'][(_0xc3c2('0x1d'))](_0xc3c2('0x24'));}if(!_0x164a52[_0xc3c2('0x1a')]){throw new Error(_0xc3c2('0x25'));}if(_0x578ac4[_0xc3c2('0x20')]===_0x3920e7['id']){return _0x3920e7;}else{return db[_0xc3c2('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc3c2('0xd')](function(_0x487619){if(!_0x487619){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x27'));}if(!_0x487619['data1']||!_0x487619['data2']){throw new db['Sequelize']['ValidationError'](_0xc3c2('0x28'));}_0x1befad=_0x487619;logger['info'](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x28b548['id']));return sentiment(_0x1befad[_0xc3c2('0x29')],_0x1befad['data2'],_0x578ac4['sentimentRegion'],_0x164a52[_0xc3c2('0x1a')],_0x578ac4[_0xc3c2('0x22')]);})[_0xc3c2('0xd')](function(_0x41e683){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x2a'),_0x28b548['id']));return _0x28b548[_0xc3c2('0x2b')]({'sentiment':_0x41e683[_0xc3c2('0x2c')],'sPositive':_0x41e683['SentimentScore']['Positive'],'sNegative':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x2e')],'sMixed':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x2f')],'sNeutral':_0x41e683[_0xc3c2('0x2d')][_0xc3c2('0x30')]});})['then'](function(){logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});case _0xc3c2('0x31'):return _0x28b548['update']({'transcribeStatus':_0xc3c2('0x31'),'failureReason':_0x36f10f[_0xc3c2('0x10')]['FailureReason']})[_0xc3c2('0xd')](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});default:logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x32'),_0x28b548['id']));break;}}else{return BPromise[_0xc3c2('0x33')]()['then'](function(){if(!_0x28b548[_0xc3c2('0x34')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x1e'));}if(!_0x578ac4[_0xc3c2('0x1f')]||!_0x578ac4[_0xc3c2('0x20')]||!_0x578ac4[_0xc3c2('0x21')]||!_0x578ac4[_0xc3c2('0x22')]||!_0x578ac4[_0xc3c2('0x23')]){throw new db[(_0xc3c2('0x1c'))]['ValidationError'](_0xc3c2('0x24'));}if(!_0x28b548[_0xc3c2('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x578ac4[_0xc3c2('0x20')]===_0x3920e7['id']){return _0x3920e7;}else{return db[_0xc3c2('0x26')]['findOne']({'where':{'id':_settings[_0xc3c2('0x20')]}});}})['then'](function(_0x2a4369){if(!_0x2a4369){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x27'));}if(!_0x2a4369[_0xc3c2('0x29')]||!_0x2a4369[_0xc3c2('0xb')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1befad=_0x2a4369;logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x35'),_0x28b548['id']));return sentiment(_0x1befad[_0xc3c2('0x29')],_0x1befad['data2'],_0x578ac4['sentimentRegion'],_0x28b548['fileText'],_0x578ac4[_0xc3c2('0x22')]);})[_0xc3c2('0xd')](function(_0x4b4ae7){logger[_0xc3c2('0xe')](util['format'](_0xc3c2('0x2a'),_0x28b548['id']));return _0x28b548['update']({'sentiment':_0x4b4ae7[_0xc3c2('0x2c')],'sPositive':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x36')],'sNegative':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x2e')],'sMixed':_0x4b4ae7['SentimentScore']['Mixed'],'sNeutral':_0x4b4ae7[_0xc3c2('0x2d')][_0xc3c2('0x30')],'transcribeStatus':_0xc3c2('0x12')});})[_0xc3c2('0xd')](function(){logger[_0xc3c2('0xe')](util[_0xc3c2('0x9')](_0xc3c2('0x1b'),_0x28b548['id']));_0x515bbc();});}})[_0xc3c2('0x37')](function(_0x3e77d7){if(_0x3e77d7){if(!_0x3e77d7[_0xc3c2('0x38')]||_0x3e77d7[_0xc3c2('0x38')]!==_0xc3c2('0x39')){logger[_0xc3c2('0x3a')](util[_0xc3c2('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x28b548['id']),util[_0xc3c2('0x3b')](_0x3e77d7,{'showHidden':![],'depth':null}));}}_0x515bbc();});});}function checkTranscribe(){var _0x348758;var _0x1d5bde;var _0x444d41;return db[_0xc3c2('0x3c')][_0xc3c2('0x3d')]({'where':{'transcribeStatus':_0xc3c2('0x3e')}})[_0xc3c2('0xd')](function(_0x188332){if(!_0x188332||!_0x188332[_0xc3c2('0x19')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x348758=_0x188332;return db[_0xc3c2('0x3f')]['findOne']({'where':{'id':0x1}});})[_0xc3c2('0xd')](function(_0x34cae8){if(!_0x34cae8){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x40'));}_0x1d5bde=_0x34cae8;if(!_0x1d5bde['transcribe']||!_0x1d5bde[_0xc3c2('0x41')]||!_0x1d5bde[_0xc3c2('0xc')]||!_0x1d5bde[_0xc3c2('0x22')]||!_0x1d5bde[_0xc3c2('0x23')]){throw new db['Sequelize'][(_0xc3c2('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0xc3c2('0x26')][_0xc3c2('0x42')]({'where':{'id':_0x1d5bde[_0xc3c2('0x41')]}});})[_0xc3c2('0xd')](function(_0x27235b){if(!_0x27235b){throw new db[(_0xc3c2('0x1c'))]['ValidationError'](_0xc3c2('0x27'));}if(!_0x27235b[_0xc3c2('0x29')]||!_0x27235b[_0xc3c2('0xb')]){throw new db[(_0xc3c2('0x1c'))][(_0xc3c2('0x1d'))](_0xc3c2('0x28'));}_0x444d41=_0x27235b;var _0x3b4917=[];_0x348758[_0xc3c2('0x43')](function(_0x3eee01){_0x3b4917[_0xc3c2('0x44')](checkTranscribeJob(_0x3eee01,_0x1d5bde,_0x444d41));});return BPromise[_0xc3c2('0x45')](_0x3b4917);})[_0xc3c2('0x37')](function(_0x25f44a){if(_0x25f44a){if(!_0x25f44a[_0xc3c2('0x38')]||_0x25f44a['name']!==_0xc3c2('0x39')){logger['error'](util[_0xc3c2('0x3b')](_0x25f44a,{'showHidden':![],'depth':null}));}}});}exports['start']=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 ea8edfd..ecfe7ac 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 _0xfd16=['redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0xfd16,0x113));var _0x6fd1=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xfd16[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x6fd1('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x6fd1('0x1'));var db=require(_0x6fd1('0x2'))['db'];var logger=require(_0x6fd1('0x3'))(_0x6fd1('0x4'));config[_0x6fd1('0x5')]=_[_0x6fd1('0x6')](config[_0x6fd1('0x5')],{'host':_0x6fd1('0x7'),'port':0x18eb});var io=require(_0x6fd1('0x8'))(new Redis(config[_0x6fd1('0x5')]));function closeInteractions(){var _0x258c84=[];return db[_0x6fd1('0x9')][_0x6fd1('0xa')]({'raw':!![],'attributes':['id',_0x6fd1('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6fd1('0xc')](0x18,_0x6fd1('0xd'))}}})[_0x6fd1('0xe')](function(_0x1af64b){if(_0x1af64b&&_0x1af64b[_0x6fd1('0xf')]){_0x258c84=_[_0x6fd1('0x10')](_0x1af64b||[],'id');logger[_0x6fd1('0x11')](_0x6fd1('0x12'),_0x258c84[_0x6fd1('0x13')]());return db[_0x6fd1('0x9')][_0x6fd1('0x14')]({'closeReason':'system','disposition':_0x6fd1('0x15'),'closed':!![],'closedAt':moment()[_0x6fd1('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x258c84}});}})[_0x6fd1('0xe')](function(){if(_0x258c84&&_0x258c84['length']){logger['info'](_0x6fd1('0x17'),_0x258c84[_0x6fd1('0x13')]());for(var _0x4b8c9f=0x0;_0x4b8c9f<_0x258c84['length'];_0x4b8c9f++){io[_0x6fd1('0x18')](_0x6fd1('0x19'),{'id':_0x258c84[_0x4b8c9f],'closed':!![]});}}})['catch'](function(_0x3d9af1){logger['error'](_0x6fd1('0x1a'),_0x3d9af1?util['inspect'](_0x3d9af1,{'showHidden':![],'depth':null}):'');});}exports[_0x6fd1('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe790=['localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x10751e,_0x1e937d){var _0x2d04fc=function(_0x3673a0){while(--_0x3673a0){_0x10751e['push'](_0x10751e['shift']());}};_0x2d04fc(++_0x1e937d);}(_0xe790,0x189));var _0x0e79=function(_0x5008c0,_0x5571c3){_0x5008c0=_0x5008c0-0x0;var _0x3092f6=_0xe790[_0x5008c0];return _0x3092f6;};'use strict';var _=require(_0x0e79('0x0'));var moment=require(_0x0e79('0x1'));var Redis=require(_0x0e79('0x2'));var util=require(_0x0e79('0x3'));var config=require(_0x0e79('0x4'));var db=require(_0x0e79('0x5'))['db'];var logger=require(_0x0e79('0x6'))(_0x0e79('0x7'));config[_0x0e79('0x8')]=_[_0x0e79('0x9')](config[_0x0e79('0x8')],{'host':_0x0e79('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x1b9d31=[];return db[_0x0e79('0xb')][_0x0e79('0xc')]({'raw':!![],'attributes':['id',_0x0e79('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0e79('0xe')](0x18,_0x0e79('0xf'))}}})[_0x0e79('0x10')](function(_0x12e7e7){if(_0x12e7e7&&_0x12e7e7[_0x0e79('0x11')]){_0x1b9d31=_[_0x0e79('0x12')](_0x12e7e7||[],'id');logger[_0x0e79('0x13')](_0x0e79('0x14'),_0x1b9d31[_0x0e79('0x15')]());return db[_0x0e79('0xb')][_0x0e79('0x16')]({'closeReason':_0x0e79('0x17'),'disposition':_0x0e79('0x18'),'closed':!![],'closedAt':moment()[_0x0e79('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1b9d31}});}})[_0x0e79('0x10')](function(){if(_0x1b9d31&&_0x1b9d31[_0x0e79('0x11')]){logger[_0x0e79('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1b9d31['join']());for(var _0x2c4502=0x0;_0x2c4502<_0x1b9d31[_0x0e79('0x11')];_0x2c4502++){io['emit'](_0x0e79('0x1a'),{'id':_0x1b9d31[_0x2c4502],'closed':!![]});}}})['catch'](function(_0x5900d1){logger[_0x0e79('0x1b')](_0x0e79('0x1c'),_0x5900d1?util[_0x0e79('0x1d')](_0x5900d1,{'showHidden':![],'depth':null}):'');});}exports[_0x0e79('0x1e')]=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 e002f9b..f777888 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf86=['CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0xcf86,0x1cc));var _0x6cf8=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xcf86[_0x580576];return _0x3f55a0;};'use strict';var util=require(_0x6cf8('0x0'));var db=require(_0x6cf8('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6cf8('0x2')]({'id':i,'firstName':_0x6cf8('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6cf8('0x4')+i+_0x6cf8('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6cf8('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6cf8('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6cf8('0x6')](),'updatedAt':Date[_0x6cf8('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x6cf8('0x7')+i,'phone':0xf879fb460+i,'email':_0x6cf8('0x4')+i+_0x6cf8('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6cf8('0x6')]()});}db[_0x6cf8('0x8')][_0x6cf8('0x9')]({'where':{}})[_0x6cf8('0xa')](function(){return db['CmContact'][_0x6cf8('0xb')](contacts);})['then'](function(){console['log'](_0x6cf8('0xc'),_0x6cf8('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0x6cf8('0xa')](function(){return db[_0x6cf8('0xe')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0x6cf8('0xc'),'hopper1');return db['CmContact'][_0x6cf8('0xb')](contacts2);})['then'](function(){console['log']('finished\x20populating','contacts2');return db[_0x6cf8('0xe')][_0x6cf8('0xb')](hopper2);})[_0x6cf8('0xa')](function(){console[_0x6cf8('0xf')](_0x6cf8('0xc'),_0x6cf8('0x10'));})[_0x6cf8('0x11')](function(_0x4dda81){console['log'](_0x4dda81);}); \ No newline at end of file +var _0x0d6e=['then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy'];(function(_0x270429,_0x14e109){var _0x449d75=function(_0x1db260){while(--_0x1db260){_0x270429['push'](_0x270429['shift']());}};_0x449d75(++_0x14e109);}(_0x0d6e,0xd4));var _0xe0d6=function(_0x312cb7,_0x344e89){_0x312cb7=_0x312cb7-0x0;var _0x1dbd54=_0x0d6e[_0x312cb7];return _0x1dbd54;};'use strict';var util=require(_0xe0d6('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe0d6('0x1')]({'id':i,'firstName':_0xe0d6('0x2')+i,'lastName':_0xe0d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xe0d6('0x4')+i+_0xe0d6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe0d6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe0d6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe0d6('0x1')]({'id':i,'firstName':_0xe0d6('0x2')+i,'lastName':_0xe0d6('0x3')+i,'phone':0xf879fb460+i,'email':_0xe0d6('0x4')+i+_0xe0d6('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe0d6('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe0d6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe0d6('0x6')](),'updatedAt':Date[_0xe0d6('0x6')]()});}db[_0xe0d6('0x7')][_0xe0d6('0x8')]({'where':{}})[_0xe0d6('0x9')](function(){return db['CmContact'][_0xe0d6('0xa')](contacts);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),'contacts1');return db[_0xe0d6('0xd')]['destroy']({'where':{}});})[_0xe0d6('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),_0xe0d6('0xe'));return db[_0xe0d6('0x7')][_0xe0d6('0xa')](contacts2);})[_0xe0d6('0x9')](function(){console['log'](_0xe0d6('0xc'),_0xe0d6('0xf'));return db['CmHopper'][_0xe0d6('0xa')](hopper2);})[_0xe0d6('0x9')](function(){console[_0xe0d6('0xb')](_0xe0d6('0xc'),_0xe0d6('0x10'));})['catch'](function(_0x1530b1){console[_0xe0d6('0xb')](_0x1530b1);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1211a0d..744d956 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65d1=['log','add\x20user','catch','util','push','%s%s','format','%s%s@xcally.com','agent','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x65d1,0x1e6));var _0x165d=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x65d1[_0x289c3e];return _0x25a4b3;};'use strict';var util=require(_0x165d('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x165d('0x1')]({'name':util['format'](_0x165d('0x2'),'agent',i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x165d('0x3')](_0x165d('0x4'),_0x165d('0x5'),i),'role':'agent','password':_0x165d('0x6'),'internal':0xfa0+i,'type':_0x165d('0x7'),'transport':[_0x165d('0x8'),'ws',_0x165d('0x9')],'disallow':[_0x165d('0xa')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x165d('0x5'),i),'encryption':'yes','avpf':_0x165d('0xb'),'force_avp':_0x165d('0xb'),'icesupport':_0x165d('0xb'),'dtlsenable':_0x165d('0xb'),'dtlsverify':'no','dtlscertfile':_0x165d('0xc'),'dtlsprivatekey':_0x165d('0xd'),'dtlssetup':'actpass','callerid':util[_0x165d('0x3')](_0x165d('0xe'),util[_0x165d('0x3')](_0x165d('0x2'),_0x165d('0x5'),i),0xfa0+i)});}db[_0x165d('0xf')][_0x165d('0x10')](users)[_0x165d('0x11')](function(){console[_0x165d('0x12')](_0x165d('0x13'));})[_0x165d('0x14')](function(_0x449a46){console[_0x165d('0x12')](_0x449a46);}); \ No newline at end of file +var _0x2da6=['../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x2da6,0xaf));var _0x62da=function(_0x4ebb0a,_0x1368fe){_0x4ebb0a=_0x4ebb0a-0x0;var _0x1ff8f8=_0x2da6[_0x4ebb0a];return _0x1ff8f8;};'use strict';var util=require(_0x62da('0x0'));var db=require(_0x62da('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x62da('0x2')]({'name':util[_0x62da('0x3')]('%s%s',_0x62da('0x4'),i),'fullname':util[_0x62da('0x3')]('%s%s',_0x62da('0x4'),i),'email':util['format'](_0x62da('0x5'),_0x62da('0x4'),i),'role':_0x62da('0x4'),'password':_0x62da('0x6'),'internal':0xfa0+i,'type':_0x62da('0x7'),'transport':[_0x62da('0x8'),'ws',_0x62da('0x9')],'disallow':[_0x62da('0xa')],'allow':[_0x62da('0xb')],'defaultuser':util[_0x62da('0x3')](_0x62da('0xc'),_0x62da('0x4'),i),'encryption':_0x62da('0xd'),'avpf':_0x62da('0xd'),'force_avp':'yes','icesupport':_0x62da('0xd'),'dtlsenable':_0x62da('0xd'),'dtlsverify':'no','dtlscertfile':_0x62da('0xe'),'dtlsprivatekey':_0x62da('0xf'),'dtlssetup':'actpass','callerid':util[_0x62da('0x3')](_0x62da('0x10'),util[_0x62da('0x3')](_0x62da('0xc'),_0x62da('0x4'),i),0xfa0+i)});}db[_0x62da('0x11')][_0x62da('0x12')](users)[_0x62da('0x13')](function(){console[_0x62da('0x14')]('add\x20user');})[_0x62da('0x15')](function(_0x25e0fc){console[_0x62da('0x14')](_0x25e0fc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4e34ad6..1a6b144 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe367=['resourceId','map','User','where','Campaign','format','length','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','user:%s','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueue','MailQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','address','request','remoteAddress','remotePort','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe367,0x10f));var _0x7e36=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xe367[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x7e36('0x0'));var util=require(_0x7e36('0x1'));var BPromise=require(_0x7e36('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7e36('0x3')],'include':[{'as':_0x7e36('0x4'),'model':db['User'],'attributes':['id',_0x7e36('0x3'),_0x7e36('0x5')],'raw':!![],'where':{'role':_0x7e36('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x7e36('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7e36('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7e36('0x3')],'where':{'role':_0x7e36('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7e36('0x3'),_0x7e36('0x8')],'where':{'type':_0x7e36('0x9')}};function getAssociatedResources(_0x469389,_0x377bb7,_0x38f75e){return db[_0x7e36('0xa')][_0x7e36('0xb')]({'where':{'name':_0x469389,'userProfileId':_0x377bb7},'raw':!![]})[_0x7e36('0xc')](function(_0x301d27){if(_0x301d27){if(_0x301d27['autoAssociation']){switch(_0x469389){case _0x7e36('0xd'):case _0x7e36('0xe'):case _0x7e36('0xf'):case _0x7e36('0x10'):case'MailQueues':case _0x7e36('0x11'):case'WhatsappQueues':return db[_0x38f75e][_0x7e36('0x12')](queryQueues);case _0x7e36('0x13'):return db[_0x38f75e][_0x7e36('0x12')](queryTelephones);case _0x7e36('0x14'):return db[_0x38f75e]['findAll'](queryTrunks);case _0x7e36('0x15'):return db[_0x38f75e][_0x7e36('0x12')](queryCampaigns);}}else{return db[_0x7e36('0x16')][_0x7e36('0x12')]({'attributes':[_0x7e36('0x17')],'where':{'sectionId':_0x301d27['id']},'raw':!![]})[_0x7e36('0xc')](function(_0x4decab){if(_0x4decab){var _0x118ef6={'where':{'id':_[_0x7e36('0x18')](_0x4decab,_0x7e36('0x17'))},'raw':!![]};switch(_0x38f75e){case _0x7e36('0x19'):_0x118ef6[_0x7e36('0x1a')]['role']=_0x7e36('0x7');break;case _0x7e36('0x1b'):_0x118ef6[_0x7e36('0x1a')][_0x7e36('0x8')]=_0x7e36('0x9');break;}return db[_0x38f75e][_0x7e36('0x12')](_0x118ef6);}else{return[];}});}}else{return[];}})[_0x7e36('0xc')](function(_0x19de98){return _0x19de98;});}function joinOrLeaveQueues(_0x27fe31,_0x1b2e26,_0xadf5e7,_0x17017a){_0x27fe31[_0x1b2e26](util[_0x7e36('0x1c')]('%s:queue:%s',_0xadf5e7,_0x17017a[_0x7e36('0x3')]));if(_0x17017a[_0x7e36('0x4')]){for(var _0x219d55=0x0;_0x219d55<_0x17017a[_0x7e36('0x4')][_0x7e36('0x1d')];_0x219d55+=0x1){_0x27fe31[_0x1b2e26](util[_0x7e36('0x1c')]('user:%s',_0x17017a[_0x7e36('0x4')][_0x219d55]['name']));}}}function joinOrLeave(_0x55a55f,_0x3f0b1c,_0x46e941){var _0x431f3e;if(_0x55a55f[_0x7e36('0x1e')]['query']['id']){db[_0x7e36('0x19')][_0x7e36('0x1f')]({'attributes':['id','name',_0x7e36('0x5'),_0x7e36('0x20')],'where':{'id':_0x55a55f[_0x7e36('0x1e')][_0x7e36('0x21')]['id']},'include':[{'model':db[_0x7e36('0x22')],'as':_0x7e36('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x7e36('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7e36('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7e36('0x26')],'as':_0x7e36('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x5b8282){if(_0x5b8282){_0x431f3e=_0x5b8282;_0x55a55f[_0x3f0b1c](util[_0x7e36('0x1c')](_0x7e36('0x28'),_0x5b8282[_0x7e36('0x3')]));var _0x383763=[];switch(_0x5b8282['role']){case _0x7e36('0x29'):_0x55a55f[_0x3f0b1c](_0x7e36('0x2a'));_0x55a55f[_0x3f0b1c](_0x7e36('0x2b'));if(queryQueues['hasOwnProperty'](_0x7e36('0x2c'))){delete queryQueues[_0x7e36('0x2c')];}_0x383763['push'](db[_0x7e36('0x2d')][_0x7e36('0x12')](queryQueues));_0x383763['push'](db['ChatQueue'][_0x7e36('0x12')](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x2f')][_0x7e36('0x12')](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x30')][_0x7e36('0x12')](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x31')][_0x7e36('0x12')](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x32')]['findAll'](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x33')][_0x7e36('0x12')](queryQueues));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x19')]['findAll'](queryTelephones));_0x383763['push'](db[_0x7e36('0x34')]['findAll'](queryTrunks));_0x383763['push'](db['Campaign'][_0x7e36('0x12')](queryCampaigns));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x19')]['findAll'](queryAgents));break;case _0x7e36('0x35'):_0x55a55f[_0x3f0b1c](_0x7e36('0x2a'));_0x55a55f[_0x3f0b1c](_0x7e36('0x2b'));_0x383763['push'](getAssociatedResources('VoiceQueues',_0x5b8282[_0x7e36('0x20')],_0x7e36('0x2d')));_0x383763[_0x7e36('0x2e')](getAssociatedResources('ChatQueues',_0x5b8282[_0x7e36('0x20')],_0x7e36('0x36')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0xf'),_0x5b8282[_0x7e36('0x20')],_0x7e36('0x2f')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x10'),_0x5b8282[_0x7e36('0x20')],'SmsQueue'));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x37'),_0x5b8282[_0x7e36('0x20')],_0x7e36('0x31')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x11'),_0x5b8282['userProfileId'],_0x7e36('0x32')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x38'),_0x5b8282[_0x7e36('0x20')],_0x7e36('0x33')));_0x383763[_0x7e36('0x2e')](getAssociatedResources('Telephones',_0x5b8282[_0x7e36('0x20')],_0x7e36('0x19')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x14'),_0x5b8282[_0x7e36('0x20')],_0x7e36('0x34')));_0x383763[_0x7e36('0x2e')](getAssociatedResources(_0x7e36('0x15'),_0x5b8282[_0x7e36('0x20')],_0x7e36('0x1b')));_0x383763[_0x7e36('0x2e')](db[_0x7e36('0x19')][_0x7e36('0x12')](queryAgents));break;case'agent':_0x55a55f[_0x3f0b1c](_0x7e36('0x2a'));_0x55a55f[_0x3f0b1c]('voice:outbound');_0x383763[_0x7e36('0x2e')](_0x5b8282[_0x7e36('0x39')]({'attributes':['id','name']}));_0x383763[_0x7e36('0x2e')](_0x5b8282[_0x7e36('0x3a')]({'attributes':['id','name']}));_0x383763[_0x7e36('0x2e')](_0x5b8282[_0x7e36('0x3b')]({'attributes':['id',_0x7e36('0x3')]}));_0x383763[_0x7e36('0x2e')](_0x5b8282[_0x7e36('0x3c')]({'attributes':['id',_0x7e36('0x3')]}));_0x383763[_0x7e36('0x2e')](_0x5b8282[_0x7e36('0x3d')]({'attributes':['id',_0x7e36('0x3')]}));_0x383763['push'](_0x5b8282[_0x7e36('0x3e')]({'attributes':['id',_0x7e36('0x3')]}));_0x383763['push'](_0x5b8282['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x7e36('0x3f')](_0x383763);}})[_0x7e36('0xc')](function(_0x328d36){if(_0x328d36&&_0x328d36['length']){for(var _0x4d4cc2=0x0;_0x4d4cc2<_0x328d36[_0x7e36('0x1d')];_0x4d4cc2+=0x1){for(var _0x1b7fae=0x0;_0x1b7fae<_0x328d36[_0x4d4cc2]['length'];_0x1b7fae+=0x1){switch(_0x4d4cc2){case 0x0:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,_0x7e36('0x40'),_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x1:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,_0x7e36('0x41'),_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x2:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,_0x7e36('0x42'),_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x3:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,'sms',_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x4:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,_0x7e36('0x43'),_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x5:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,'openchannel',_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x6:joinOrLeaveQueues(_0x55a55f,_0x3f0b1c,_0x7e36('0x44'),_0x328d36[_0x4d4cc2][_0x1b7fae]);break;case 0x7:if(_0x431f3e[_0x7e36('0x5')]!==_0x7e36('0x6'))_0x55a55f[_0x3f0b1c](util[_0x7e36('0x1c')]('telephone:%s',_0x328d36[_0x4d4cc2][_0x1b7fae][_0x7e36('0x3')]));break;case 0x8:if(_0x431f3e[_0x7e36('0x5')]!=='agent')_0x55a55f[_0x3f0b1c](util[_0x7e36('0x1c')](_0x7e36('0x45'),_0x328d36[_0x4d4cc2][_0x1b7fae][_0x7e36('0x3')]));break;case 0x9:if(_0x431f3e[_0x7e36('0x5')]!==_0x7e36('0x6'))_0x55a55f[_0x3f0b1c](util[_0x7e36('0x1c')](_0x7e36('0x46'),_0x328d36[_0x4d4cc2][_0x1b7fae][_0x7e36('0x8')],_0x328d36[_0x4d4cc2][_0x1b7fae][_0x7e36('0x3')]));break;case 0xa:_0x55a55f[_0x3f0b1c](util[_0x7e36('0x1c')]('user:%s',_0x328d36[_0x4d4cc2][_0x1b7fae]['name']));break;}}}}})[_0x7e36('0xc')](function(){if(_0x3f0b1c===_0x7e36('0x47')){var _0x230e7b=_['map'](_0x431f3e[_0x7e36('0x23')],'id');return _0x431f3e[_0x7e36('0x48')](_0x230e7b)[_0x7e36('0xc')](function(){for(var _0x3c91df=0x0;_0x3c91df<_0x230e7b[_0x7e36('0x1d')];_0x3c91df+=0x1){_0x46e941[_0x7e36('0x49')](_0x7e36('0x4a'),{'ChatInteractionId':Number(_0x230e7b[_0x3c91df]),'UserId':Number(_0x431f3e['id'])});}});}})[_0x7e36('0xc')](function(){if(_0x3f0b1c===_0x7e36('0x47')){var _0x286bed=_[_0x7e36('0x18')](_0x431f3e[_0x7e36('0x4b')],'id');return _0x431f3e[_0x7e36('0x4c')](_0x286bed)[_0x7e36('0xc')](function(){for(var _0x21c577=0x0;_0x21c577<_0x286bed['length'];_0x21c577+=0x1){_0x46e941[_0x7e36('0x49')](_0x7e36('0x4d'),{'MailInteractionId':Number(_0x286bed[_0x21c577]),'UserId':Number(_0x431f3e['id'])});}});}})[_0x7e36('0xc')](function(){if(_0x3f0b1c==='leave'){var _0x214aa5=_[_0x7e36('0x18')](_0x431f3e[_0x7e36('0x4e')],'id');return _0x431f3e[_0x7e36('0x4f')](_0x214aa5)[_0x7e36('0xc')](function(){for(var _0x1b6d29=0x0;_0x1b6d29<_0x214aa5[_0x7e36('0x1d')];_0x1b6d29+=0x1){_0x46e941[_0x7e36('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x214aa5[_0x1b6d29]),'UserId':Number(_0x431f3e['id'])});}});}})[_0x7e36('0xc')](function(){if(_0x3f0b1c===_0x7e36('0x47')){var _0x47ca4d=_[_0x7e36('0x18')](_0x431f3e['SmsInteractions'],'id');return _0x431f3e[_0x7e36('0x50')](_0x47ca4d)['then'](function(){for(var _0x591ac6=0x0;_0x591ac6<_0x47ca4d[_0x7e36('0x1d')];_0x591ac6+=0x1){_0x46e941['emit'](_0x7e36('0x51'),{'SmsInteractionId':Number(_0x47ca4d[_0x591ac6]),'UserId':Number(_0x431f3e['id'])});}});}})[_0x7e36('0xc')](function(){if(_0x3f0b1c===_0x7e36('0x47')){var _0x49e9db=_[_0x7e36('0x18')](_0x431f3e[_0x7e36('0x27')],'id');return _0x431f3e[_0x7e36('0x52')](_0x49e9db)[_0x7e36('0xc')](function(){for(var _0x2cc5b2=0x0;_0x2cc5b2<_0x49e9db[_0x7e36('0x1d')];_0x2cc5b2+=0x1){_0x46e941['emit'](_0x7e36('0x53'),{'OpenchannelInteractionId':Number(_0x49e9db[_0x2cc5b2]),'UserId':Number(_0x431f3e['id'])});}});}})[_0x7e36('0xc')](function(){if(_0x3f0b1c===_0x7e36('0x47')){var _0x3f876e=_['map'](_0x431f3e[_0x7e36('0x54')],'id');return _0x431f3e['removeWhatsappInteractions'](_0x3f876e)[_0x7e36('0xc')](function(){for(var _0xa3d786=0x0;_0xa3d786<_0x3f876e[_0x7e36('0x1d')];_0xa3d786+=0x1){_0x46e941[_0x7e36('0x49')](_0x7e36('0x55'),{'WhatsappInteractionId':Number(_0x3f876e[_0xa3d786]),'UserId':Number(_0x431f3e['id'])});}});}})['catch'](function(_0xaf6d46){_0x55a55f['log'](_0xaf6d46);});}}function onDisconnect(_0x445264,_0x3e270e){joinOrLeave(_0x445264,_0x7e36('0x47'),_0x3e270e);}function onConnect(_0x15356a){joinOrLeave(_0x15356a,_0x7e36('0x56'));}exports[_0x7e36('0x57')]=function(_0x14d533){_0x14d533['on'](_0x7e36('0x58'),function(_0x204a35){_0x204a35['setMaxListeners'](0x0);_0x204a35[_0x7e36('0x59')]=_0x204a35[_0x7e36('0x5a')]['connection'][_0x7e36('0x5b')]+':'+_0x204a35[_0x7e36('0x5a')][_0x7e36('0x58')][_0x7e36('0x5c')];_0x204a35['connectedAt']=new Date();_0x204a35[_0x7e36('0x5d')]=function(_0x4a0687){console[_0x7e36('0x5d')]('SocketIO\x20'+_0x204a35[_0x7e36('0x5e')][_0x7e36('0x3')]+'['+_0x204a35[_0x7e36('0x59')]+']',_0x4a0687);};_0x204a35['on'](_0x7e36('0x5f'),function(){onDisconnect(_0x204a35,_0x14d533);_0x204a35['log'](_0x7e36('0x60'));});onConnect(_0x204a35);_0x204a35[_0x7e36('0x5d')](_0x7e36('0x61'));});}; \ No newline at end of file +var _0x782b=['VoiceQueue','Telephones','Trunks','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','mail','whatsapp','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','default','address','request','connection','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','bluebird','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','User','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user'];(function(_0x394c3b,_0x8a2e1f){var _0x2265fb=function(_0x205943){while(--_0x205943){_0x394c3b['push'](_0x394c3b['shift']());}};_0x2265fb(++_0x8a2e1f);}(_0x782b,0x89));var _0xb782=function(_0x14fb6d,_0x18bf23){_0x14fb6d=_0x14fb6d-0x0;var _0x357d9c=_0x782b[_0x14fb6d];return _0x357d9c;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xb782('0x0'));var db=require('../mysqldb')['db'];var config=require(_0xb782('0x1'));var queryQueues={'attributes':['id',_0xb782('0x2')],'include':[{'as':_0xb782('0x3'),'model':db['User'],'attributes':['id',_0xb782('0x2'),_0xb782('0x4')],'raw':!![],'where':{'role':_0xb782('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb782('0x2')],'where':{'role':_0xb782('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb782('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xb782('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb782('0x2'),_0xb782('0x7')],'where':{'type':_0xb782('0x8')}};function getAssociatedResources(_0x169b41,_0x51eb88,_0x357905){return db[_0xb782('0x9')][_0xb782('0xa')]({'where':{'name':_0x169b41,'userProfileId':_0x51eb88},'raw':!![]})[_0xb782('0xb')](function(_0x5cee45){if(_0x5cee45){if(_0x5cee45[_0xb782('0xc')]){switch(_0x169b41){case _0xb782('0xd'):case _0xb782('0xe'):case _0xb782('0xf'):case _0xb782('0x10'):case _0xb782('0x11'):case _0xb782('0x12'):case _0xb782('0x13'):return db[_0x357905]['findAll'](queryQueues);case'Telephones':return db[_0x357905][_0xb782('0x14')](queryTelephones);case'Trunks':return db[_0x357905]['findAll'](queryTrunks);case _0xb782('0x15'):return db[_0x357905][_0xb782('0x14')](queryCampaigns);}}else{return db[_0xb782('0x16')][_0xb782('0x14')]({'attributes':[_0xb782('0x17')],'where':{'sectionId':_0x5cee45['id']},'raw':!![]})['then'](function(_0x172e22){if(_0x172e22){var _0x980c17={'where':{'id':_[_0xb782('0x18')](_0x172e22,_0xb782('0x17'))},'raw':!![]};switch(_0x357905){case'User':_0x980c17[_0xb782('0x19')][_0xb782('0x4')]='telephone';break;case _0xb782('0x1a'):_0x980c17['where'][_0xb782('0x7')]='ivr';break;}return db[_0x357905][_0xb782('0x14')](_0x980c17);}else{return[];}});}}else{return[];}})['then'](function(_0x1292ce){return _0x1292ce;});}function joinOrLeaveQueues(_0x3a299d,_0x3e8b46,_0x273385,_0x11aba8){_0x3a299d[_0x3e8b46](util[_0xb782('0x1b')](_0xb782('0x1c'),_0x273385,_0x11aba8[_0xb782('0x2')]));if(_0x11aba8[_0xb782('0x3')]){for(var _0x25be39=0x0;_0x25be39<_0x11aba8[_0xb782('0x3')][_0xb782('0x1d')];_0x25be39+=0x1){_0x3a299d[_0x3e8b46](util[_0xb782('0x1b')](_0xb782('0x1e'),_0x11aba8[_0xb782('0x3')][_0x25be39][_0xb782('0x2')]));}}}function joinOrLeave(_0x1ec1d4,_0x2816d3,_0x490749){var _0x411a0a;if(_0x1ec1d4[_0xb782('0x1f')][_0xb782('0x20')]['id']){db[_0xb782('0x21')][_0xb782('0x22')]({'attributes':['id',_0xb782('0x2'),'role',_0xb782('0x23')],'where':{'id':_0x1ec1d4['handshake'][_0xb782('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xb782('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x25')],'as':_0xb782('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xb782('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x28')],'as':_0xb782('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x2a')],'as':_0xb782('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb782('0x2c')],'as':_0xb782('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xb782('0xb')](function(_0x48a0a3){if(_0x48a0a3){_0x411a0a=_0x48a0a3;_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x1e'),_0x48a0a3[_0xb782('0x2')]));var _0x10f776=[];switch(_0x48a0a3[_0xb782('0x4')]){case'admin':_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3](_0xb782('0x2f'));if(queryQueues[_0xb782('0x30')](_0xb782('0x31'))){delete queryQueues[_0xb782('0x31')];}_0x10f776[_0xb782('0x32')](db['VoiceQueue'][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x33')][_0xb782('0x14')](queryQueues));_0x10f776['push'](db[_0xb782('0x34')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x35')][_0xb782('0x14')](queryQueues));_0x10f776['push'](db[_0xb782('0x36')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db['OpenchannelQueue'][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x37')][_0xb782('0x14')](queryQueues));_0x10f776[_0xb782('0x32')](db[_0xb782('0x21')][_0xb782('0x14')](queryTelephones));_0x10f776['push'](db['Trunk'][_0xb782('0x14')](queryTrunks));_0x10f776['push'](db[_0xb782('0x1a')]['findAll'](queryCampaigns));_0x10f776[_0xb782('0x32')](db['User'][_0xb782('0x14')](queryAgents));break;case _0xb782('0x38'):_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3]('voice:outbound');_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0xd'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x39')));_0x10f776['push'](getAssociatedResources('ChatQueues',_0x48a0a3['userProfileId'],_0xb782('0x33')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0xf'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x34')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x10'),_0x48a0a3[_0xb782('0x23')],'SmsQueue'));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x11'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x36')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x12'),_0x48a0a3[_0xb782('0x23')],'OpenchannelQueue'));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x13'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x37')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x3a'),_0x48a0a3[_0xb782('0x23')],_0xb782('0x21')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x3b'),_0x48a0a3['userProfileId'],_0xb782('0x3c')));_0x10f776[_0xb782('0x32')](getAssociatedResources(_0xb782('0x15'),_0x48a0a3['userProfileId'],_0xb782('0x1a')));_0x10f776[_0xb782('0x32')](db[_0xb782('0x21')]['findAll'](queryAgents));break;case _0xb782('0x5'):_0x1ec1d4[_0x2816d3](_0xb782('0x2e'));_0x1ec1d4[_0x2816d3](_0xb782('0x2f'));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x3d')]({'attributes':['id','name']}));_0x10f776['push'](_0x48a0a3[_0xb782('0x3e')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x3f')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3['getSmsQueues']({'attributes':['id',_0xb782('0x2')]}));_0x10f776['push'](_0x48a0a3[_0xb782('0x40')]({'attributes':['id','name']}));_0x10f776[_0xb782('0x32')](_0x48a0a3[_0xb782('0x41')]({'attributes':['id',_0xb782('0x2')]}));_0x10f776[_0xb782('0x32')](_0x48a0a3['getWhatsappQueues']({'attributes':['id',_0xb782('0x2')]}));break;}return BPromise[_0xb782('0x42')](_0x10f776);}})[_0xb782('0xb')](function(_0x13d95a){if(_0x13d95a&&_0x13d95a['length']){for(var _0x1c2285=0x0;_0x1c2285<_0x13d95a['length'];_0x1c2285+=0x1){for(var _0x3077da=0x0;_0x3077da<_0x13d95a[_0x1c2285][_0xb782('0x1d')];_0x3077da+=0x1){switch(_0x1c2285){case 0x0:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x43'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x1:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x44'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x2:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x45'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x3:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,'sms',_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x4:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x46'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x5:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,'openchannel',_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x6:joinOrLeaveQueues(_0x1ec1d4,_0x2816d3,_0xb782('0x47'),_0x13d95a[_0x1c2285][_0x3077da]);break;case 0x7:if(_0x411a0a[_0xb782('0x4')]!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')]('telephone:%s',_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0x8:if(_0x411a0a[_0xb782('0x4')]!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x48'),_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0x9:if(_0x411a0a['role']!==_0xb782('0x5'))_0x1ec1d4[_0x2816d3](util[_0xb782('0x1b')](_0xb782('0x49'),_0x13d95a[_0x1c2285][_0x3077da][_0xb782('0x7')],_0x13d95a[_0x1c2285][_0x3077da]['name']));break;case 0xa:_0x1ec1d4[_0x2816d3](util['format'](_0xb782('0x1e'),_0x13d95a[_0x1c2285][_0x3077da][_0xb782('0x2')]));break;}}}}})[_0xb782('0xb')](function(){if(_0x2816d3==='leave'){var _0x3361b8=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x24')],'id');return _0x411a0a[_0xb782('0x4a')](_0x3361b8)[_0xb782('0xb')](function(){for(var _0x4c9943=0x0;_0x4c9943<_0x3361b8['length'];_0x4c9943+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x4c'),{'ChatInteractionId':Number(_0x3361b8[_0x4c9943]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x46ca5d=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x26')],'id');return _0x411a0a[_0xb782('0x4e')](_0x46ca5d)['then'](function(){for(var _0x495f17=0x0;_0x495f17<_0x46ca5d[_0xb782('0x1d')];_0x495f17+=0x1){_0x490749[_0xb782('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x46ca5d[_0x495f17]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x447311=_['map'](_0x411a0a[_0xb782('0x27')],'id');return _0x411a0a[_0xb782('0x4f')](_0x447311)[_0xb782('0xb')](function(){for(var _0x59669d=0x0;_0x59669d<_0x447311['length'];_0x59669d+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x50'),{'FaxInteractionId':Number(_0x447311[_0x59669d]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x47eb4b=_[_0xb782('0x18')](_0x411a0a[_0xb782('0x29')],'id');return _0x411a0a['removeSmsInteractions'](_0x47eb4b)[_0xb782('0xb')](function(){for(var _0x5a8546=0x0;_0x5a8546<_0x47eb4b['length'];_0x5a8546+=0x1){_0x490749['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x47eb4b[_0x5a8546]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3===_0xb782('0x4d')){var _0x46012d=_['map'](_0x411a0a['OpenchannelInteractions'],'id');return _0x411a0a[_0xb782('0x51')](_0x46012d)[_0xb782('0xb')](function(){for(var _0x3a08d=0x0;_0x3a08d<_0x46012d[_0xb782('0x1d')];_0x3a08d+=0x1){_0x490749[_0xb782('0x4b')](_0xb782('0x52'),{'OpenchannelInteractionId':Number(_0x46012d[_0x3a08d]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0xb')](function(){if(_0x2816d3==='leave'){var _0x28c451=_[_0xb782('0x18')](_0x411a0a['WhatsappInteractions'],'id');return _0x411a0a[_0xb782('0x53')](_0x28c451)[_0xb782('0xb')](function(){for(var _0x4c55b3=0x0;_0x4c55b3<_0x28c451[_0xb782('0x1d')];_0x4c55b3+=0x1){_0x490749[_0xb782('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x28c451[_0x4c55b3]),'UserId':Number(_0x411a0a['id'])});}});}})[_0xb782('0x54')](function(_0x156883){_0x1ec1d4[_0xb782('0x55')](_0x156883);});}}function onDisconnect(_0x5326b6,_0x3968d4){joinOrLeave(_0x5326b6,_0xb782('0x4d'),_0x3968d4);}function onConnect(_0x4c7327){joinOrLeave(_0x4c7327,'join');}exports[_0xb782('0x56')]=function(_0x208112){_0x208112['on']('connection',function(_0x366334){_0x366334['setMaxListeners'](0x0);_0x366334[_0xb782('0x57')]=_0x366334[_0xb782('0x58')][_0xb782('0x59')][_0xb782('0x5a')]+':'+_0x366334[_0xb782('0x58')]['connection']['remotePort'];_0x366334[_0xb782('0x5b')]=new Date();_0x366334['log']=function(_0x6ab32c){console[_0xb782('0x55')](_0xb782('0x5c')+_0x366334[_0xb782('0x5d')][_0xb782('0x2')]+'['+_0x366334['address']+']',_0x6ab32c);};_0x366334['on'](_0xb782('0x5e'),function(){onDisconnect(_0x366334,_0x208112);_0x366334[_0xb782('0x55')](_0xb782('0x5f'));});onConnect(_0x366334);_0x366334[_0xb782('0x55')](_0xb782('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 23e27ec..7ad34ec 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 _0xbf57=['agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','get','offlineMessage','opened','interface','changed','closed','substatus','User','find','fullname','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','request','EventManager','then','error','Trigger,\x20%s','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','SIP/%s','name'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xbf57,0xf6));var _0x7bf5=function(_0x4e0157,_0x147213){_0x4e0157=_0x4e0157-0x0;var _0x13a010=_0xbf57[_0x4e0157];return _0x13a010;};'use strict';var util=require(_0x7bf5('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x7bf5('0x1'))(_0x7bf5('0x2'));var client=jayson[_0x7bf5('0x3')][_0x7bf5('0x4')]({'port':0x232a});var triggers=[{'channel':_0x7bf5('0x5'),'model':_0x7bf5('0x6'),'event':_0x7bf5('0x7'),'condition':_0x7bf5('0x8'),'callback':afterCreate},{'channel':_0x7bf5('0x5'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':_0x7bf5('0x5'),'model':_0x7bf5('0xa'),'event':_0x7bf5('0x7'),'condition':_0x7bf5('0xb'),'callback':afterCreateMessage},{'channel':_0x7bf5('0x5'),'model':_0x7bf5('0xc'),'event':'afterCreate','condition':_0x7bf5('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x7bf5('0xd'),'model':'SmsInteraction','event':_0x7bf5('0x7'),'condition':_0x7bf5('0x8'),'callback':afterCreate},{'channel':_0x7bf5('0xd'),'model':_0x7bf5('0xe'),'event':_0x7bf5('0xf'),'condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x7bf5('0x10'),'event':_0x7bf5('0x7'),'condition':_0x7bf5('0xb'),'callback':afterCreateMessage},{'channel':_0x7bf5('0x11'),'model':_0x7bf5('0x12'),'event':_0x7bf5('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7bf5('0x11'),'model':_0x7bf5('0x12'),'event':_0x7bf5('0xf'),'condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x7bf5('0x13'),'event':'afterCreate','condition':_0x7bf5('0xb'),'callback':afterCreateMessage},{'channel':_0x7bf5('0x14'),'model':_0x7bf5('0x15'),'event':_0x7bf5('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7bf5('0x14'),'model':_0x7bf5('0x15'),'event':_0x7bf5('0xf'),'condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':_0x7bf5('0x14'),'model':_0x7bf5('0x16'),'event':_0x7bf5('0x7'),'condition':_0x7bf5('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x7bf5('0x17'),'event':_0x7bf5('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7bf5('0x18'),'model':'MailInteraction','event':_0x7bf5('0xf'),'condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':_0x7bf5('0x18'),'model':'MailMessage','event':_0x7bf5('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7bf5('0x19'),'model':_0x7bf5('0x1a'),'event':_0x7bf5('0x7'),'condition':_0x7bf5('0x8'),'callback':afterCreate},{'channel':_0x7bf5('0x19'),'model':_0x7bf5('0x1a'),'event':'afterUpdate','condition':_0x7bf5('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x7bf5('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x553e9d){return client[_0x7bf5('0x1b')](_0x7bf5('0x1c'),_0x553e9d)[_0x7bf5('0x1d')](function(_0x4677d0){logger['info']('Trigger,\x20%s',_0x7bf5('0x1c'),_0x4677d0);if(_0x4677d0[_0x7bf5('0x1e')]){if(_0x4677d0[_0x7bf5('0x1e')]['code']===0x1f4){logger['error'](_0x7bf5('0x1f'),_0x7bf5('0x1c'),_0x4677d0[_0x7bf5('0x1e')]);}}})['catch'](function(_0xb30a5c){logger[_0x7bf5('0x1e')](_0x7bf5('0x1f'),_0x7bf5('0x1c'),_0xb30a5c);});}function afterCreateMessage(_0x4bd0aa){return function(_0x1bdb7d){_0x1bdb7d=_0x1bdb7d['get']({'plain':!![]});_0x1bdb7d[_0x7bf5('0x20')]=_0x4bd0aa;_0x1bdb7d[_0x7bf5('0x21')]=_0x4bd0aa;_0x1bdb7d[_0x7bf5('0x22')]=_0x1bdb7d[_0x7bf5('0x23')];Promise[_0x7bf5('0x24')]()[_0x7bf5('0x1d')](function(){if(typeof _0x1bdb7d[_0x7bf5('0x25')]===_0x7bf5('0x26'))return null;var _0xf9b60a=_0x7bf5('0x27')+_0x1bdb7d[_0x7bf5('0x25')];return db[_0x7bf5('0x28')][_0x7bf5('0x29')](_0xf9b60a,{'type':db[_0x7bf5('0x2a')][_0x7bf5('0x2b')][_0x7bf5('0x2c')],'raw':!![]});})[_0x7bf5('0x1d')](function(_0x16cf1d){if(_0x16cf1d){_0x1bdb7d[_0x7bf5('0x2d')]=_0x16cf1d[0x0];}if(typeof _0x1bdb7d[_0x7bf5('0x2e')]===_0x7bf5('0x26'))return;return getAgent(_0x1bdb7d['UserId']);})[_0x7bf5('0x1d')](function(_0x27b859){if(_0x27b859){_0x1bdb7d['interface']=util[_0x7bf5('0x2f')](_0x7bf5('0x30'),_0x27b859[_0x7bf5('0x31')]);_0x1bdb7d[_0x7bf5('0x32')]=_0x27b859;_0x1bdb7d[_0x7bf5('0x20')]=_0x4bd0aa;return request({'event':_0x7bf5('0x33'),'message':_0x1bdb7d});}else{return request({'event':_0x7bf5('0x34'),'message':_0x1bdb7d});}})[_0x7bf5('0x35')](function(_0x125fea){logger['error'](_0x7bf5('0x1f'),_0x7bf5('0x36'),_0x125fea);});};}function afterCreateOfflineMessage(_0xa249a2){return function(_0x11ddb2){_0x11ddb2=_0x11ddb2[_0x7bf5('0x37')]({'plain':!![]});_0x11ddb2['channel']=_0xa249a2;_0x11ddb2[_0x7bf5('0x21')]=_0xa249a2;_0x11ddb2[_0x7bf5('0x22')]=_0x7bf5('0x38');return request({'event':_0x11ddb2['event'],'message':_0x11ddb2});};}function afterCreate(_0x3060f9,_0x1bbdc1){return function(_0x2ddcc2){_0x2ddcc2=_0x2ddcc2[_0x7bf5('0x37')]({'plain':!![]});_0x2ddcc2[_0x7bf5('0x20')]=_0x3060f9;_0x2ddcc2[_0x7bf5('0x21')]=_0x3060f9;_0x2ddcc2[_0x7bf5('0x22')]=_0x7bf5('0x39');Promise['resolve']()[_0x7bf5('0x1d')](function(){var _0x73b2df=_0x7bf5('0x27')+_0x2ddcc2['ContactId'];return db[_0x7bf5('0x28')][_0x7bf5('0x29')](_0x73b2df,{'type':db['Sequelize']['QueryTypes'][_0x7bf5('0x2c')],'raw':!![]});})[_0x7bf5('0x1d')](function(_0x477af5){if(_0x477af5){_0x2ddcc2[_0x7bf5('0x2d')]=_0x477af5[0x0];}if(typeof _0x2ddcc2[_0x7bf5('0x2e')]===_0x7bf5('0x26'))return;return getAgent(_0x2ddcc2['UserId']);})['then'](function(_0xd51afd){if(_0xd51afd){_0x2ddcc2[_0x7bf5('0x3a')]=util[_0x7bf5('0x2f')]('SIP/%s',_0xd51afd[_0x7bf5('0x31')]);_0x2ddcc2[_0x7bf5('0x32')]=_0xd51afd;}return request({'event':_0x1bbdc1,'message':_0x2ddcc2});})[_0x7bf5('0x35')](function(_0x45160e){logger['error'](_0x7bf5('0x1f'),'AfterCreate',_0x45160e);});};}function afterUpdate(_0x4391f5){return function(_0x4919e5){var _0x1959b0=_0x4919e5[_0x7bf5('0x3b')]('closed')&&_0x4919e5[_0x7bf5('0x3c')];var _0x425636=_0x4919e5[_0x7bf5('0x3b')]('substatus');if(_0x1959b0||_0x425636){var _0x330b54=_0x1959b0?_0x7bf5('0x9'):_0x7bf5('0x3d');var _0x36a12a=_0x4919e5[_0x7bf5('0x37')]({'plain':!![]});_0x36a12a[_0x7bf5('0x20')]=_0x4391f5;_0x36a12a[_0x7bf5('0x21')]=_0x4391f5;_0x36a12a[_0x7bf5('0x22')]=_0x1959b0?'closed':_0x7bf5('0x3d');var _0x504f23=_0x7bf5('0x27')+_0x36a12a['ContactId'];return db[_0x7bf5('0x28')][_0x7bf5('0x29')](_0x504f23,{'type':db[_0x7bf5('0x2a')][_0x7bf5('0x2b')][_0x7bf5('0x2c')],'raw':!![]})[_0x7bf5('0x1d')](function(_0x45b3c3){if(_0x45b3c3){_0x36a12a[_0x7bf5('0x2d')]=_0x45b3c3[0x0];}if(typeof _0x36a12a[_0x7bf5('0x2e')]===_0x7bf5('0x26'))return;return getAgent(_0x36a12a[_0x7bf5('0x2e')]);})[_0x7bf5('0x1d')](function(_0x3292b5){if(_0x3292b5){_0x36a12a['interface']=util[_0x7bf5('0x2f')](_0x7bf5('0x30'),_0x3292b5[_0x7bf5('0x31')]);_0x36a12a['agent']=_0x3292b5;}return request({'event':_0x330b54,'message':_0x36a12a});})[_0x7bf5('0x35')](function(_0x44ab9f){logger[_0x7bf5('0x1e')](_0x7bf5('0x1f'),'AfterUpdate',_0x44ab9f);});}};}function getAgent(_0x20f25d){return db[_0x7bf5('0x3e')][_0x7bf5('0x3f')]({'where':{'id':_0x20f25d},'attributes':['id',_0x7bf5('0x31'),_0x7bf5('0x40'),_0x7bf5('0x41'),_0x7bf5('0x42')],'raw':!![]})['then'](function(_0x4bd22d){return _0x4bd22d;});}exports[_0x7bf5('0x43')]=function(){for(var _0xde6af7=0x0;_0xde6af7=_0x26c10b['agents']){throw Error(_0xb386('0x15'));}_0x1bd4a3(_0x551085);})[_0xb386('0x16')](function(_0x4e8a27){_0x3bcccf(_0x4e8a27);});});}; \ No newline at end of file +var _0x6321=['role','then','getLicense','agents','catch','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','toLowerCase','includes','isUndefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6321,0x101));var _0x1632=function(_0x178e05,_0x3ae699){_0x178e05=_0x178e05-0x0;var _0x37746c=_0x6321[_0x178e05];return _0x37746c;};'use strict';var _=require('lodash');var BPromise=require(_0x1632('0x0'));var db=require(_0x1632('0x1'))['db'];var util=require(_0x1632('0x2'));var channels=['voice',_0x1632('0x3'),_0x1632('0x4'),_0x1632('0x5'),_0x1632('0x6'),_0x1632('0x7'),_0x1632('0x8')];exports[_0x1632('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0xe5f697){_0xe5f697=_0xe5f697[_0x1632('0xa')]();return _[_0x1632('0xb')](channels,_0xe5f697);};exports['clearBlockUser']=function(_0x193848,_0x23158b,_0x3471de,_0x30f965){var _0xaf1f6f={'loginAttempts':_0x23158b,'blocked':_0x3471de};if(!_[_0x1632('0xc')](_0x30f965)){_0xaf1f6f['blockedAt']=_0x30f965;}return _0x193848['updateAttributes'](_0xaf1f6f);};exports['getLicense']=function(_0x4a7982){return new BPromise(function(_0x43c0f6,_0x39a50a){var _0x303d4b=0x0;if(_0x4a7982[_0x1632('0xd')]!=='agent'){_0x43c0f6(_0x4a7982);}db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4a7982['id']}}})[_0x1632('0xe')](function(_0x311332){_0x303d4b=_0x311332;return util[_0x1632('0xf')]();})[_0x1632('0xe')](function(_0x54f116){if(_0x54f116&&_0x54f116['agents']&&_0x303d4b>=_0x54f116[_0x1632('0x10')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x43c0f6(_0x4a7982);})[_0x1632('0x11')](function(_0x51d848){_0x39a50a(_0x51d848);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 00f8079..6555064 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x2e0df3,_0x46ef93){var _0xc10d93=function(_0x2e05fc){while(--_0x2e05fc){_0x2e0df3['push'](_0x2e0df3['shift']());}};_0xc10d93(++_0x46ef93);}(_0xadb5,0xad));var _0x5adb=function(_0x56a2a0,_0x130f87){_0x56a2a0=_0x56a2a0-0x0;var _0x299fb1=_0xadb5[_0x56a2a0];return _0x299fb1;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x47b493,_0x429ada){var _0xb7f5be=function(_0x20eb88){while(--_0x20eb88){_0x47b493['push'](_0x47b493['shift']());}};_0xb7f5be(++_0x429ada);}(_0x814b,0x1a2));var _0xb814=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0x814b[_0x21c068];return _0x5cf199;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c424e87..f40cd29 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7013=['status','send','exports','404'];(function(_0x4119dd,_0x5727d4){var _0xedab14=function(_0x317ff7){while(--_0x317ff7){_0x4119dd['push'](_0x4119dd['shift']());}};_0xedab14(++_0x5727d4);}(_0x7013,0x7e));var _0x3701=function(_0x487bd2,_0x488fa9){_0x487bd2=_0x487bd2-0x0;var _0x10f253=_0x7013[_0x487bd2];return _0x10f253;};'use strict';module[_0x3701('0x0')][0x194]=function pageNotFound(_0x28f7cb,_0x4aac74){var _0xf76ab4=_0x3701('0x1');var _0x4e9757=0x194;var _0xcdcacb={'status':_0x4e9757};_0x4aac74[_0x3701('0x2')](_0xcdcacb['status']);_0x4aac74['render'](_0xf76ab4,{},function(_0x101083,_0x23bf55){if(_0x101083){return _0x4aac74[_0x3701('0x2')](_0xcdcacb[_0x3701('0x2')])['json'](_0xcdcacb);}_0x4aac74[_0x3701('0x3')](_0x23bf55);});}; \ No newline at end of file +var _0x6eb8=['exports','404','status','json','send'];(function(_0x542c91,_0x30cf38){var _0x2ddb1f=function(_0x3c2183){while(--_0x3c2183){_0x542c91['push'](_0x542c91['shift']());}};_0x2ddb1f(++_0x30cf38);}(_0x6eb8,0xeb));var _0x86eb=function(_0x3e9c0a,_0x401e67){_0x3e9c0a=_0x3e9c0a-0x0;var _0x53e838=_0x6eb8[_0x3e9c0a];return _0x53e838;};'use strict';module[_0x86eb('0x0')][0x194]=function pageNotFound(_0xeb5e9,_0x528214){var _0x3806b5=_0x86eb('0x1');var _0x572377=0x194;var _0x2c209b={'status':_0x572377};_0x528214[_0x86eb('0x2')](_0x2c209b[_0x86eb('0x2')]);_0x528214['render'](_0x3806b5,{},function(_0x1900a8,_0x280198){if(_0x1900a8){return _0x528214[_0x86eb('0x2')](_0x2c209b[_0x86eb('0x2')])[_0x86eb('0x3')](_0x2c209b);}_0x528214[_0x86eb('0x4')](_0x280198);});}; \ No newline at end of file diff --git a/server/migrations/2.6.20.js b/server/migrations/2.6.20.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.20.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/migrations/2.6.21.js b/server/migrations/2.6.21.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.21.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/migrations/2.6.22.js b/server/migrations/2.6.22.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.22.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 66d7919..e91c95e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 84ea34e..09270d3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x195e=['/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/automations','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/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/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/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/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/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/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','/snippet','snippet','3.5.0','/plugins','root','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport'];(function(_0x475048,_0x11e175){var _0x4fbcb1=function(_0x40f68f){while(--_0x40f68f){_0x475048['push'](_0x475048['shift']());}};_0x4fbcb1(++_0x11e175);}(_0x195e,0xfb));var _0xe195=function(_0x59c75e,_0x32ffc9){_0x59c75e=_0x59c75e-0x0;var _0x4279dd=_0x195e[_0x59c75e];return _0x4279dd;};'use strict';var path=require(_0xe195('0x0'));var express=require(_0xe195('0x1'));var errors=require(_0xe195('0x2'));var config=require(_0xe195('0x3'));var setupLoggers=require(_0xe195('0x4'))[_0xe195('0x5')];var clientSideLogs=require(_0xe195('0x6'));exports[_0xe195('0x7')]=function(_0x2243e9){return setupLoggers(_0x2243e9)[_0xe195('0x8')](function(){_0x2243e9[_0xe195('0x9')](_0xe195('0xa'),require(_0xe195('0xb')));_0x2243e9['use'](_0xe195('0xc'),require(_0xe195('0xd')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe'),require(_0xe195('0xf')));_0x2243e9['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x2243e9[_0xe195('0x9')](_0xe195('0x10'),require(_0xe195('0x11')));_0x2243e9[_0xe195('0x9')]('/api/voice/queues',require(_0xe195('0x12')));_0x2243e9[_0xe195('0x9')](_0xe195('0x13'),require('./api/voiceRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0x14'),require('./api/screenRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0x15'),require(_0xe195('0x16')));_0x2243e9[_0xe195('0x9')]('/api/voice/mails/messages',require(_0xe195('0x17')));_0x2243e9[_0xe195('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2243e9[_0xe195('0x9')]('/api/voice/dials/reports',require(_0xe195('0x18')));_0x2243e9['use']('/api/voice/agents/reports',require(_0xe195('0x19')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1a'),require(_0xe195('0x1b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1c'),require(_0xe195('0x1d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1e'),require(_0xe195('0x1f')));_0x2243e9['use'](_0xe195('0x20'),require(_0xe195('0x21')));_0x2243e9[_0xe195('0x9')](_0xe195('0x22'),require(_0xe195('0x23')));_0x2243e9[_0xe195('0x9')]('/api/mail/accounts',require(_0xe195('0x24')));_0x2243e9[_0xe195('0x9')](_0xe195('0x25'),require(_0xe195('0x26')));_0x2243e9['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x2243e9[_0xe195('0x9')](_0xe195('0x27'),require(_0xe195('0x28')));_0x2243e9[_0xe195('0x9')](_0xe195('0x29'),require(_0xe195('0x2a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x2b'),require(_0xe195('0x2c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x2d'),require(_0xe195('0x2e')));_0x2243e9[_0xe195('0x9')]('/api/dashboards',require(_0xe195('0x2f')));_0x2243e9[_0xe195('0x9')](_0xe195('0x30'),require(_0xe195('0x31')));_0x2243e9[_0xe195('0x9')](_0xe195('0x32'),require(_0xe195('0x33')));_0x2243e9[_0xe195('0x9')](_0xe195('0x34'),require(_0xe195('0x35')));_0x2243e9['use'](_0xe195('0x36'),require(_0xe195('0x37')));_0x2243e9[_0xe195('0x9')](_0xe195('0x38'),require(_0xe195('0x39')));_0x2243e9['use']('/api/fax/queues',require(_0xe195('0x3a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x3b'),require(_0xe195('0x3c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x3d'),require('./api/smsAccount'));_0x2243e9[_0xe195('0x9')](_0xe195('0x3e'),require(_0xe195('0x3f')));_0x2243e9['use'](_0xe195('0x40'),require('./api/smsInteraction'));_0x2243e9[_0xe195('0x9')](_0xe195('0x41'),require('./api/smsMessage'));_0x2243e9[_0xe195('0x9')](_0xe195('0x42'),require(_0xe195('0x43')));_0x2243e9['use'](_0xe195('0x44'),require(_0xe195('0x45')));_0x2243e9[_0xe195('0x9')](_0xe195('0x46'),require(_0xe195('0x47')));_0x2243e9[_0xe195('0x9')]('/api/openchannel/interactions',require(_0xe195('0x48')));_0x2243e9[_0xe195('0x9')](_0xe195('0x49'),require(_0xe195('0x4a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x4b'),require(_0xe195('0x4c')));_0x2243e9['use'](_0xe195('0x4d'),require(_0xe195('0x4e')));_0x2243e9['use'](_0xe195('0x4f'),require(_0xe195('0x50')));_0x2243e9['use'](_0xe195('0x51'),require('./api/chatApplication'));_0x2243e9[_0xe195('0x9')](_0xe195('0x52'),require(_0xe195('0x53')));_0x2243e9[_0xe195('0x9')](_0xe195('0x54'),require(_0xe195('0x55')));_0x2243e9['use'](_0xe195('0x56'),require(_0xe195('0x57')));_0x2243e9[_0xe195('0x9')]('/api/chat/queues',require(_0xe195('0x58')));_0x2243e9[_0xe195('0x9')]('/api/chat/groups',require(_0xe195('0x59')));_0x2243e9[_0xe195('0x9')]('/api/chat/proactive_actions',require(_0xe195('0x5a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x5b'),require('./api/cmCompany'));_0x2243e9[_0xe195('0x9')](_0xe195('0x5c'),require(_0xe195('0x5d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x5e'),require(_0xe195('0x5f')));_0x2243e9[_0xe195('0x9')](_0xe195('0x60'),require(_0xe195('0x61')));_0x2243e9[_0xe195('0x9')](_0xe195('0x62'),require(_0xe195('0x63')));_0x2243e9['use'](_0xe195('0x64'),require(_0xe195('0x65')));_0x2243e9[_0xe195('0x9')](_0xe195('0x66'),require(_0xe195('0x67')));_0x2243e9['use']('/api/actions',require('./api/action'));_0x2243e9['use'](_0xe195('0x68'),require('./api/automation'));_0x2243e9[_0xe195('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x2243e9[_0xe195('0x9')](_0xe195('0x69'),require(_0xe195('0x6a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x6b'),require(_0xe195('0x6c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x6d'),require('./api/interval'));_0x2243e9['use'](_0xe195('0x6e'),require(_0xe195('0x6f')));_0x2243e9['use'](_0xe195('0x70'),require(_0xe195('0x71')));_0x2243e9[_0xe195('0x9')](_0xe195('0x72'),require(_0xe195('0x73')));_0x2243e9[_0xe195('0x9')](_0xe195('0x74'),require(_0xe195('0x75')));_0x2243e9[_0xe195('0x9')](_0xe195('0x76'),require(_0xe195('0x77')));_0x2243e9[_0xe195('0x9')]('/api/tags',require(_0xe195('0x78')));_0x2243e9[_0xe195('0x9')](_0xe195('0x79'),require(_0xe195('0x7a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x7b'),require(_0xe195('0x7c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x7d'),require(_0xe195('0x7e')));_0x2243e9[_0xe195('0x9')]('/api/templates',require(_0xe195('0x7f')));_0x2243e9['use'](_0xe195('0x80'),require(_0xe195('0x81')));_0x2243e9[_0xe195('0x9')]('/api/variables',require('./api/variable'));_0x2243e9[_0xe195('0x9')](_0xe195('0x82'),require(_0xe195('0x83')));_0x2243e9[_0xe195('0x9')](_0xe195('0x84'),require(_0xe195('0x85')));_0x2243e9[_0xe195('0x9')](_0xe195('0x86'),require(_0xe195('0x87')));_0x2243e9[_0xe195('0x9')](_0xe195('0x88'),require(_0xe195('0x89')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8a'),require(_0xe195('0x8b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8c'),require(_0xe195('0x8d')));_0x2243e9[_0xe195('0x9')]('/api/analytics/field_reports',require(_0xe195('0x8e')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8f'),require(_0xe195('0x90')));_0x2243e9[_0xe195('0x9')](_0xe195('0x91'),require('./api/intSalesforceAccount'));_0x2243e9['use'](_0xe195('0x92'),require(_0xe195('0x93')));_0x2243e9[_0xe195('0x9')]('/api/integrations/salesforce/fields',require(_0xe195('0x94')));_0x2243e9[_0xe195('0x9')]('/api/integrations/sugarcrm/accounts',require(_0xe195('0x95')));_0x2243e9[_0xe195('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xe195('0x96')));_0x2243e9['use'](_0xe195('0x97'),require(_0xe195('0x98')));_0x2243e9[_0xe195('0x9')](_0xe195('0x99'),require(_0xe195('0x9a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x9b'),require('./api/intDeskConfiguration'));_0x2243e9[_0xe195('0x9')](_0xe195('0x9c'),require(_0xe195('0x9d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x9e'),require(_0xe195('0x9f')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa0'),require(_0xe195('0xa1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa2'),require(_0xe195('0xa3')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa4'),require(_0xe195('0xa5')));_0x2243e9['use'](_0xe195('0xa6'),require(_0xe195('0xa7')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa8'),require(_0xe195('0xa9')));_0x2243e9['use'](_0xe195('0xaa'),require(_0xe195('0xab')));_0x2243e9[_0xe195('0x9')](_0xe195('0xac'),require(_0xe195('0xad')));_0x2243e9[_0xe195('0x9')](_0xe195('0xae'),require(_0xe195('0xaf')));_0x2243e9[_0xe195('0x9')](_0xe195('0xb0'),require(_0xe195('0xb1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xb2'),require(_0xe195('0xb3')));_0x2243e9['use'](_0xe195('0xb4'),require('./api/intVtigerField'));_0x2243e9[_0xe195('0x9')]('/api/integrations/servicenow/accounts',require(_0xe195('0xb5')));_0x2243e9[_0xe195('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb6'),require('./api/intServicenowField'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb7'),require('./api/intDynamics365Account'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb8'),require(_0xe195('0xb9')));_0x2243e9[_0xe195('0x9')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x2243e9['use'](_0xe195('0xba'),require('./api/intFreshsalesAccount'));_0x2243e9['use'](_0xe195('0xbb'),require(_0xe195('0xbc')));_0x2243e9[_0xe195('0x9')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x2243e9[_0xe195('0x9')](_0xe195('0xbd'),require(_0xe195('0xbe')));_0x2243e9['use'](_0xe195('0xbf'),require(_0xe195('0xc0')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc1'),require(_0xe195('0xc2')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc3'),require(_0xe195('0xc4')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc5'),require('./api/jscriptyQuestionReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xc6'),require(_0xe195('0xc7')));_0x2243e9[_0xe195('0x9')]('/api/sms/reports/queue',require(_0xe195('0xc8')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc9'),require(_0xe195('0xca')));_0x2243e9[_0xe195('0x9')](_0xe195('0xcb'),require(_0xe195('0xcc')));_0x2243e9['use'](_0xe195('0xcd'),require(_0xe195('0xce')));_0x2243e9[_0xe195('0x9')](_0xe195('0xcf'),require('./api/setting'));_0x2243e9['use'](_0xe195('0xd0'),require(_0xe195('0xd1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd2'),require(_0xe195('0xd3')));_0x2243e9[_0xe195('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0xd4'),require(_0xe195('0xd5')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd6'),require(_0xe195('0xd7')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd8'),require('./api/license'));_0x2243e9[_0xe195('0x9')](_0xe195('0xd9'),require(_0xe195('0xda')));_0x2243e9[_0xe195('0x9')](_0xe195('0xdb'),require('./api/migration'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdc'),require('./api/attachment'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdd'),require('./api/plugin'));_0x2243e9[_0xe195('0x9')](_0xe195('0xde'),require('./api/mailTransferReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdf'),require(_0xe195('0xe0')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe1'),require(_0xe195('0xe2')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe3'),require(_0xe195('0xe4')));_0x2243e9[_0xe195('0x9')]('/api/sms/reports/transfer',require(_0xe195('0xe5')));_0x2243e9['use'](_0xe195('0xe6'),require('./api/cmList'));_0x2243e9['use'](_0xe195('0xe7'),require(_0xe195('0xe8')));_0x2243e9[_0xe195('0x9')]('/api/userProfiles',require(_0xe195('0xe9')));_0x2243e9[_0xe195('0x9')](_0xe195('0xea'),require(_0xe195('0xeb')));_0x2243e9[_0xe195('0x9')](_0xe195('0xec'),require(_0xe195('0xed')));_0x2243e9[_0xe195('0x9')](_0xe195('0xee'),require(_0xe195('0xef')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf0'),require('./api/whatsappAccount'));_0x2243e9[_0xe195('0x9')]('/api/whatsapp/applications',require(_0xe195('0xf1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf2'),require(_0xe195('0xf3')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf4'),require(_0xe195('0xf5')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf6'),require('./api/whatsappQueueReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xf7'),require(_0xe195('0xf8')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf9'),require(_0xe195('0xfa')));_0x2243e9[_0xe195('0x9')](_0xe195('0xfb'),require('./api/cloudProvider'));_0x2243e9[_0xe195('0x9')](_0xe195('0xfc'),require('./api/realtime'));_0x2243e9[_0xe195('0x9')]('/api/user-settings',require(_0xe195('0xfd')));_0x2243e9['use'](_0xe195('0xfe'),require('./api/authLocal'));_0x2243e9[_0xe195('0x9')](_0xe195('0xff'),require(_0xe195('0x100')));_0x2243e9[_0xe195('0x9')]('/api/auth/activedirectory',require(_0xe195('0x101')));_0x2243e9[_0xe195('0x9')](_0xe195('0x102'),require(_0xe195('0x103')));_0x2243e9[_0xe195('0x9')](_0xe195('0x104'),require(_0xe195('0x105')));_0x2243e9[_0xe195('0x9')](_0xe195('0x106'),require(_0xe195('0x107')));_0x2243e9['use']('/api/system',require(_0xe195('0x108')));_0x2243e9['use'](_0xe195('0x109'),require('./api/pm2'));_0x2243e9[_0xe195('0x9')](_0xe195('0x10a'),require(_0xe195('0x10b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x10c'),clientSideLogs);_0x2243e9['use'](_0xe195('0x10d'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config['root'],_0xe195('0x10d'))));_0x2243e9[_0xe195('0x9')](_0xe195('0x110'),express[_0xe195('0x10e')](path['join'](config['root'],_0xe195('0x110'))));_0x2243e9['use'](_0xe195('0x111'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config['root'],_0xe195('0x111'))));_0x2243e9[_0xe195('0x9')](_0xe195('0x112'),express['static'](path['join'](config['root'],_0xe195('0x113'),_0xe195('0x114'))));_0x2243e9['use'](_0xe195('0x115'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config[_0xe195('0x116')],'/server/files/plugins')));_0x2243e9[_0xe195('0x117')](_0xe195('0x118'))[_0xe195('0x119')](errors[0x194]);_0x2243e9['route']('/*')[_0xe195('0x119')](function(_0x426c9d,_0x1aa68a){_0x1aa68a[_0xe195('0x11a')](path[_0xe195('0x11b')](_0x2243e9[_0xe195('0x119')](_0xe195('0x11c'))+'/index.html'));});return _0x2243e9;});}; \ No newline at end of file +var _0x192f=['./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./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/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/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication'];(function(_0x185a56,_0x2e35f0){var _0x3815cf=function(_0x3c95a5){while(--_0x3c95a5){_0x185a56['push'](_0x185a56['shift']());}};_0x3815cf(++_0x2e35f0);}(_0x192f,0xd6));var _0xf192=function(_0x5eaae7,_0x577c09){_0x5eaae7=_0x5eaae7-0x0;var _0x591743=_0x192f[_0x5eaae7];return _0x591743;};'use strict';var path=require(_0xf192('0x0'));var express=require('express');var errors=require(_0xf192('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xf192('0x2'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xf192('0x3')]=function(_0x3b704f){return setupLoggers(_0x3b704f)[_0xf192('0x4')](function(){_0x3b704f[_0xf192('0x5')](_0xf192('0x6'),require(_0xf192('0x7')));_0x3b704f['use'](_0xf192('0x8'),require(_0xf192('0x9')));_0x3b704f['use'](_0xf192('0xa'),require(_0xf192('0xb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc'),require(_0xf192('0xd')));_0x3b704f['use']('/api/voice/mohs',require(_0xf192('0xe')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf'),require(_0xf192('0x10')));_0x3b704f[_0xf192('0x5')](_0xf192('0x11'),require(_0xf192('0x12')));_0x3b704f[_0xf192('0x5')]('/api/screen/recordings',require(_0xf192('0x13')));_0x3b704f[_0xf192('0x5')](_0xf192('0x14'),require(_0xf192('0x15')));_0x3b704f[_0xf192('0x5')](_0xf192('0x16'),require(_0xf192('0x17')));_0x3b704f[_0xf192('0x5')](_0xf192('0x18'),require(_0xf192('0x19')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1a'),require('./api/voiceDialReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1b'),require('./api/voiceAgentReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x1c'),require(_0xf192('0x1d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x1e'),require(_0xf192('0x1f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x20'),require(_0xf192('0x21')));_0x3b704f[_0xf192('0x5')](_0xf192('0x22'),require(_0xf192('0x23')));_0x3b704f['use'](_0xf192('0x24'),require(_0xf192('0x25')));_0x3b704f[_0xf192('0x5')](_0xf192('0x26'),require(_0xf192('0x27')));_0x3b704f[_0xf192('0x5')](_0xf192('0x28'),require(_0xf192('0x29')));_0x3b704f['use'](_0xf192('0x2a'),require(_0xf192('0x2b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x2c'),require('./api/mailInteraction'));_0x3b704f[_0xf192('0x5')]('/api/mail/messages',require(_0xf192('0x2d')));_0x3b704f['use'](_0xf192('0x2e'),require(_0xf192('0x2f')));_0x3b704f[_0xf192('0x5')](_0xf192('0x30'),require(_0xf192('0x31')));_0x3b704f[_0xf192('0x5')](_0xf192('0x32'),require(_0xf192('0x33')));_0x3b704f['use'](_0xf192('0x34'),require(_0xf192('0x35')));_0x3b704f[_0xf192('0x5')]('/api/fax/accounts',require('./api/faxAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x36'),require(_0xf192('0x37')));_0x3b704f[_0xf192('0x5')]('/api/fax/interactions',require(_0xf192('0x38')));_0x3b704f['use'](_0xf192('0x39'),require('./api/faxMessage'));_0x3b704f['use'](_0xf192('0x3a'),require(_0xf192('0x3b')));_0x3b704f['use']('/api/fax/reports/queue',require(_0xf192('0x3c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x3d'),require('./api/smsAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0x3e'),require(_0xf192('0x3f')));_0x3b704f[_0xf192('0x5')]('/api/sms/interactions',require(_0xf192('0x40')));_0x3b704f[_0xf192('0x5')](_0xf192('0x41'),require('./api/smsMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x42'),require(_0xf192('0x43')));_0x3b704f[_0xf192('0x5')](_0xf192('0x44'),require(_0xf192('0x45')));_0x3b704f[_0xf192('0x5')]('/api/openchannel/applications',require(_0xf192('0x46')));_0x3b704f[_0xf192('0x5')](_0xf192('0x47'),require('./api/openchannelInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0x48'),require(_0xf192('0x49')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4a'),require('./api/openchannelQueue'));_0x3b704f[_0xf192('0x5')](_0xf192('0x4b'),require(_0xf192('0x4c')));_0x3b704f['use'](_0xf192('0x4d'),require(_0xf192('0x4e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x4f'),require(_0xf192('0x50')));_0x3b704f[_0xf192('0x5')](_0xf192('0x51'),require('./api/chatInteraction'));_0x3b704f[_0xf192('0x5')]('/api/chat/messages',require('./api/chatMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0x52'),require(_0xf192('0x53')));_0x3b704f[_0xf192('0x5')](_0xf192('0x54'),require(_0xf192('0x55')));_0x3b704f[_0xf192('0x5')](_0xf192('0x56'),require(_0xf192('0x57')));_0x3b704f[_0xf192('0x5')](_0xf192('0x58'),require(_0xf192('0x59')));_0x3b704f['use']('/api/cm/companies',require('./api/cmCompany'));_0x3b704f['use'](_0xf192('0x5a'),require(_0xf192('0x5b')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5c'),require(_0xf192('0x5d')));_0x3b704f[_0xf192('0x5')](_0xf192('0x5e'),require(_0xf192('0x5f')));_0x3b704f['use']('/api/cm/hopper_final',require(_0xf192('0x60')));_0x3b704f[_0xf192('0x5')](_0xf192('0x61'),require(_0xf192('0x62')));_0x3b704f['use'](_0xf192('0x63'),require(_0xf192('0x64')));_0x3b704f[_0xf192('0x5')](_0xf192('0x65'),require(_0xf192('0x66')));_0x3b704f[_0xf192('0x5')]('/api/automations',require('./api/automation'));_0x3b704f[_0xf192('0x5')](_0xf192('0x67'),require(_0xf192('0x68')));_0x3b704f['use'](_0xf192('0x69'),require(_0xf192('0x6a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6b'),require(_0xf192('0x6c')));_0x3b704f[_0xf192('0x5')](_0xf192('0x6d'),require(_0xf192('0x6e')));_0x3b704f['use'](_0xf192('0x6f'),require('./api/pause'));_0x3b704f[_0xf192('0x5')](_0xf192('0x70'),require(_0xf192('0x71')));_0x3b704f[_0xf192('0x5')](_0xf192('0x72'),require(_0xf192('0x73')));_0x3b704f[_0xf192('0x5')](_0xf192('0x74'),require(_0xf192('0x75')));_0x3b704f[_0xf192('0x5')]('/api/sounds',require(_0xf192('0x76')));_0x3b704f[_0xf192('0x5')](_0xf192('0x77'),require(_0xf192('0x78')));_0x3b704f['use'](_0xf192('0x79'),require('./api/contactItemType'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7a'),require('./api/cmContactHasItem'));_0x3b704f[_0xf192('0x5')](_0xf192('0x7b'),require(_0xf192('0x7c')));_0x3b704f['use'](_0xf192('0x7d'),require(_0xf192('0x7e')));_0x3b704f['use'](_0xf192('0x7f'),require(_0xf192('0x80')));_0x3b704f[_0xf192('0x5')]('/api/variables',require(_0xf192('0x81')));_0x3b704f[_0xf192('0x5')](_0xf192('0x82'),require(_0xf192('0x83')));_0x3b704f['use'](_0xf192('0x84'),require(_0xf192('0x85')));_0x3b704f['use'](_0xf192('0x86'),require(_0xf192('0x87')));_0x3b704f[_0xf192('0x5')](_0xf192('0x88'),require(_0xf192('0x89')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8a'),require('./api/analyticExtractedReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0x8b'),require(_0xf192('0x8c')));_0x3b704f['use'](_0xf192('0x8d'),require(_0xf192('0x8e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x8f'),require(_0xf192('0x90')));_0x3b704f[_0xf192('0x5')](_0xf192('0x91'),require(_0xf192('0x92')));_0x3b704f['use'](_0xf192('0x93'),require(_0xf192('0x94')));_0x3b704f[_0xf192('0x5')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x95'),require(_0xf192('0x96')));_0x3b704f[_0xf192('0x5')]('/api/integrations/sugarcrm/configurations',require(_0xf192('0x97')));_0x3b704f[_0xf192('0x5')](_0xf192('0x98'),require('./api/intSugarcrmField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x99'),require('./api/intDeskAccount'));_0x3b704f['use']('/api/integrations/desk/configurations',require(_0xf192('0x9a')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9b'),require('./api/intDeskField'));_0x3b704f[_0xf192('0x5')](_0xf192('0x9c'),require(_0xf192('0x9d')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zoho/configurations',require(_0xf192('0x9e')));_0x3b704f[_0xf192('0x5')](_0xf192('0x9f'),require(_0xf192('0xa0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa1'),require(_0xf192('0xa2')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/configurations',require(_0xf192('0xa3')));_0x3b704f[_0xf192('0x5')]('/api/integrations/zendesk/fields',require(_0xf192('0xa4')));_0x3b704f[_0xf192('0x5')]('/api/integrations/freshdesk/accounts',require(_0xf192('0xa5')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa6'),require(_0xf192('0xa7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xa8'),require(_0xf192('0xa9')));_0x3b704f[_0xf192('0x5')]('/api/integrations/vtiger/accounts',require(_0xf192('0xaa')));_0x3b704f[_0xf192('0x5')](_0xf192('0xab'),require(_0xf192('0xac')));_0x3b704f['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3b704f[_0xf192('0x5')](_0xf192('0xad'),require('./api/intServicenowAccount'));_0x3b704f[_0xf192('0x5')](_0xf192('0xae'),require(_0xf192('0xaf')));_0x3b704f['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3b704f[_0xf192('0x5')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3b704f[_0xf192('0x5')](_0xf192('0xb0'),require(_0xf192('0xb1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb2'),require(_0xf192('0xb3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb4'),require(_0xf192('0xb5')));_0x3b704f['use'](_0xf192('0xb6'),require(_0xf192('0xb7')));_0x3b704f['use']('/api/integrations/freshsales/fields',require(_0xf192('0xb8')));_0x3b704f[_0xf192('0x5')](_0xf192('0xb9'),require(_0xf192('0xba')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/queue',require(_0xf192('0xbb')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbc'),require(_0xf192('0xbd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xbe'),require('./api/jscriptyAnswerReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xbf'),require(_0xf192('0xc0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc1'),require(_0xf192('0xc2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc3'),require(_0xf192('0xc4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xc5'),require('./api/squareReport'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc6'),require('./api/squareReportDetail'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc7'),require(_0xf192('0xc8')));_0x3b704f['use']('/api/settings',require('./api/setting'));_0x3b704f[_0xf192('0x5')](_0xf192('0xc9'),require('./api/squareOdbc'));_0x3b704f[_0xf192('0x5')](_0xf192('0xca'),require('./api/squareProject'));_0x3b704f[_0xf192('0x5')](_0xf192('0xcb'),require(_0xf192('0xcc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xcd'),require('./api/squareMessage'));_0x3b704f[_0xf192('0x5')](_0xf192('0xce'),require(_0xf192('0xcf')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd0'),require(_0xf192('0xd1')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd2'),require(_0xf192('0xd3')));_0x3b704f[_0xf192('0x5')](_0xf192('0xd4'),require(_0xf192('0xd5')));_0x3b704f[_0xf192('0x5')]('/api/attachments',require('./api/attachment'));_0x3b704f[_0xf192('0x5')](_0xf192('0xd6'),require(_0xf192('0xd7')));_0x3b704f['use'](_0xf192('0xd8'),require(_0xf192('0xd9')));_0x3b704f[_0xf192('0x5')]('/api/chat/reports/transfer',require(_0xf192('0xda')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdb'),require(_0xf192('0xdc')));_0x3b704f[_0xf192('0x5')](_0xf192('0xdd'),require(_0xf192('0xde')));_0x3b704f['use'](_0xf192('0xdf'),require(_0xf192('0xe0')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe1'),require(_0xf192('0xe2')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe3'),require(_0xf192('0xe4')));_0x3b704f[_0xf192('0x5')](_0xf192('0xe5'),require('./api/userProfile'));_0x3b704f[_0xf192('0x5')](_0xf192('0xe6'),require(_0xf192('0xe7')));_0x3b704f[_0xf192('0x5')]('/api/userProfile/resources',require(_0xf192('0xe8')));_0x3b704f['use'](_0xf192('0xe9'),require(_0xf192('0xea')));_0x3b704f[_0xf192('0x5')](_0xf192('0xeb'),require(_0xf192('0xec')));_0x3b704f[_0xf192('0x5')](_0xf192('0xed'),require(_0xf192('0xee')));_0x3b704f[_0xf192('0x5')](_0xf192('0xef'),require('./api/whatsappInteraction'));_0x3b704f[_0xf192('0x5')](_0xf192('0xf0'),require('./api/whatsappMessage'));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/queue',require(_0xf192('0xf1')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/reports/transfer',require(_0xf192('0xf2')));_0x3b704f[_0xf192('0x5')]('/api/whatsapp/queues',require(_0xf192('0xf3')));_0x3b704f['use'](_0xf192('0xf4'),require(_0xf192('0xf5')));_0x3b704f['use']('/api/realtime',require('./api/realtime'));_0x3b704f['use'](_0xf192('0xf6'),require(_0xf192('0xf7')));_0x3b704f[_0xf192('0x5')](_0xf192('0xf8'),require(_0xf192('0xf9')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfa'),require(_0xf192('0xfb')));_0x3b704f['use'](_0xf192('0xfc'),require(_0xf192('0xfd')));_0x3b704f[_0xf192('0x5')](_0xf192('0xfe'),require(_0xf192('0xff')));_0x3b704f[_0xf192('0x5')](_0xf192('0x100'),require(_0xf192('0x101')));_0x3b704f[_0xf192('0x5')]('/api/version',require(_0xf192('0x102')));_0x3b704f[_0xf192('0x5')](_0xf192('0x103'),require(_0xf192('0x104')));_0x3b704f[_0xf192('0x5')]('/api/pm2',require('./api/pm2'));_0x3b704f[_0xf192('0x5')](_0xf192('0x105'),require(_0xf192('0x106')));_0x3b704f[_0xf192('0x5')]('/api/logs',clientSideLogs);_0x3b704f[_0xf192('0x5')](_0xf192('0x107'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x107'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10b'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10b'))));_0x3b704f[_0xf192('0x5')](_0xf192('0x10c'),express[_0xf192('0x108')](path['join'](config['root'],'/demo')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10d'),express['static'](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x10e'),'3.5.0')));_0x3b704f[_0xf192('0x5')](_0xf192('0x10f'),express[_0xf192('0x108')](path[_0xf192('0x109')](config[_0xf192('0x10a')],_0xf192('0x110'))));_0x3b704f[_0xf192('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xf192('0x112')](errors[0x194]);_0x3b704f[_0xf192('0x111')]('/*')[_0xf192('0x112')](function(_0x56af80,_0x3479e2){_0x3479e2['sendFile'](path[_0xf192('0x113')](_0x3b704f['get'](_0xf192('0x114'))+_0xf192('0x115')));});return _0x3b704f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7fc29c0..142eff0 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4107=['server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.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/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc'];(function(_0xb1e485,_0x4c541a){var _0x1eb50a=function(_0x18f8f6){while(--_0x18f8f6){_0xb1e485['push'](_0xb1e485['shift']());}};_0x1eb50a(++_0x4c541a);}(_0x4107,0x177));var _0x7410=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x4107[_0x5751e6];return _0x4199e4;};'use strict';var jayson=require('jayson/promise');var _=require(_0x7410('0x0'));var config=require(_0x7410('0x1'));exports[_0x7410('0x2')]=function(){return new Promise(function(_0x2e367a,_0x4c957d){var _0x4d642c={};_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x4')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x5')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/voiceQueue/voiceQueue.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x6')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x7')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x8')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x9')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xa')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xb')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xc')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xd')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xe')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0xf')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x10')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/mailInteraction/mailInteraction.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x11')));_0x4d642c=_['merge'](_0x4d642c,require('../api/mailApplication/mailApplication.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x12')));_0x4d642c=_['merge'](_0x4d642c,require('../api/faxAccount/faxAccount.rpc'));_0x4d642c=_['merge'](_0x4d642c,require('../api/faxApplication/faxApplication.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x13')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/faxMessage/faxMessage.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/faxQueue/faxQueue.rpc'));_0x4d642c=_['merge'](_0x4d642c,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x14')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x15')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x16')));_0x4d642c=_['merge'](_0x4d642c,require('../api/smsQueue/smsQueue.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x17')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x18')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x19')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x1a')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x1b')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/chatInteraction/chatInteraction.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x1c')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x1d')));_0x4d642c=_['merge'](_0x4d642c,require('../api/cmContact/cmContact.rpc'));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x1e')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x1f')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x20')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x21')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x22')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x23')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x24')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x25')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x26')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x27')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x28')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x29')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x2a')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x2b')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x2c')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x2d')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x2e')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x2f')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x30')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x31')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x32')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x33')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x34')));_0x4d642c=_['merge'](_0x4d642c,require('../api/squareOdbc/squareOdbc.rpc'));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x35')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x36')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x37')));_0x4d642c=_['merge'](_0x4d642c,require(_0x7410('0x38')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x39')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x3a')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x3b')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x3c')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x3d')));_0x4d642c=_[_0x7410('0x3')](_0x4d642c,require(_0x7410('0x3e')));_0x4d642c=_['merge'](_0x4d642c,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3846dc=jayson[_0x7410('0x3f')](_0x4d642c)[_0x7410('0x40')]();var _0x5f1198=config[_0x7410('0x41')]['port']||config[_0x7410('0x42')]+0x1;var _0x385daf=config[_0x7410('0x41')]['ip']||_0x7410('0x43');_0x3846dc['on']('error',function(_0xa569e8){return _0x4c957d(_0xa569e8);});_0x3846dc[_0x7410('0x2')](_0x5f1198,_0x385daf,function(){console[_0x7410('0x44')](_0x7410('0x45'),_0x385daf,_0x5f1198);require(_0x7410('0x46'))[_0x7410('0x47')]();return _0x2e367a(_0x7410('0x48')+_0x385daf+':'+_0x5f1198);});});}; \ No newline at end of file +var _0xb2b0=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0xb2b0,0x72));var _0x0b2b=function(_0x46aa37,_0x166763){_0x46aa37=_0x46aa37-0x0;var _0x5567a6=_0xb2b0[_0x46aa37];return _0x5567a6;};'use strict';var jayson=require(_0x0b2b('0x0'));var _=require(_0x0b2b('0x1'));var config=require(_0x0b2b('0x2'));exports[_0x0b2b('0x3')]=function(){return new Promise(function(_0x4e4eaf,_0x4e4c4f){var _0x12f7d2={};_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x5')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x6')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x7')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x8')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x9')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xa')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xb')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xc')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xd')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/trunk/trunk.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xe')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/mailServerIn/mailServerIn.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0xf')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/mailQueue/mailQueue.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x10')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x11')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x12')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x13')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x14')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x15')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x16')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x17')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x18')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x19')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1b')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1c')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x1d')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x1f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x20')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x21')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/chatInteraction/chatInteraction.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x22')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x23')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmContact/cmContact.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x24')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x25')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x26')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x27')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x28')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x29')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/template/template.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2b')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2c')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2d')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x2e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x2f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x30')));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x31')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x32')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x12f7d2=_['merge'](_0x12f7d2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x33')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x34')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x35')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x36')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x37')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x38')));_0x12f7d2=_['merge'](_0x12f7d2,require(_0x0b2b('0x39')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3a')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3b')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3c')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3d')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3e')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require(_0x0b2b('0x3f')));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x12f7d2=_[_0x0b2b('0x4')](_0x12f7d2,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1031b4=jayson[_0x0b2b('0x40')](_0x12f7d2)[_0x0b2b('0x41')]();var _0x504381=config['rpc'][_0x0b2b('0x42')]||config[_0x0b2b('0x42')]+0x1;var _0xba6ba8=config[_0x0b2b('0x43')]['ip']||_0x0b2b('0x44');_0x1031b4['on']('error',function(_0x1c2b77){return _0x4e4c4f(_0x1c2b77);});_0x1031b4['listen'](_0x504381,_0xba6ba8,function(){console[_0x0b2b('0x45')](_0x0b2b('0x46'),_0xba6ba8,_0x504381);require(_0x0b2b('0x47'))['default']();return _0x4e4eaf('RPC\x20listening\x20on\x20'+_0xba6ba8+':'+_0x504381);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e5574aa..4bee605 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 _0x4209=['emit','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','answer','ANSWER','getData','beep','sendRequest','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','call','utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error'];(function(_0x31b03f,_0xd08176){var _0x558c34=function(_0x5c6841){while(--_0x5c6841){_0x31b03f['push'](_0x31b03f['shift']());}};_0x558c34(++_0xd08176);}(_0x4209,0x11c));var _0x9420=function(_0x5e3bb1,_0x3cfe7c){_0x5e3bb1=_0x5e3bb1-0x0;var _0x4c1278=_0x4209[_0x5e3bb1];return _0x4c1278;};'use strict';var util=require(_0x9420('0x0'));var _=require(_0x9420('0x1'));var EventEmitter=require('events')[_0x9420('0x2')];var AGIReply=require(_0x9420('0x3'));var AGIError=require('./error');function AGIChannel(_0x13fb2a){var _0x331968=this,_0x1f9d87=new AGIReply(),_0x32953f=![],_0x1a98a2={};EventEmitter[_0x9420('0x4')](_0x331968);_0x13fb2a['setEncoding'](_0x9420('0x5'));_0x13fb2a[_0x9420('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1f9d87[_0x9420('0x7')](_0x9420('0x5'));_0x1f9d87['on']('headers',function(_0x688091){for(var _0x3b8e0a in _0x688091){_0x331968[_0x3b8e0a]=_0x688091[_0x3b8e0a];}_0x331968['emit'](_0x9420('0x8'));});_0x1f9d87['on'](_0x9420('0x9'),function(_0x5ef10a){if(_0x5ef10a[_0x9420('0xa')]()==_0x9420('0xb')){_0x331968['emit'](_0x9420('0xb'));return;}if(_0x5ef10a[_0x9420('0xc')](0x0,0xb)==_0x9420('0xd')){_0x32953f=!![];}if(_0x32953f){_0x1a98a2['rx']+=_0x5ef10a+'\x0a';if(_0x5ef10a['search']('520\x20End\x20of\x20proper')!=-0x1){_0x32953f=![];}}else{_0x1a98a2['rx']=_0x5ef10a;}if(_0x32953f){return;}if(typeof _0x1a98a2['cb']==_0x9420('0xe')){var _0x1e0204=_0x1a98a2['rx'][_0x9420('0xc')](0x0,0x3),_0x556585=null,_0x2a2472=null;_0x1e0204=parseInt(_0x1e0204);if(isNaN(_0x1e0204)){_0x1a98a2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9420('0xf')});return;}if(_0x1e0204!=0xc8){_0x1a98a2['cb'](null,{'code':_0x1e0204,'result':-0x1,'extra':'KO'});return;}_0x556585=_0x1a98a2['rx'][_0x9420('0xc')](0x4)[_0x9420('0x10')](_0x9420('0x11'),'');if(_0x556585[_0x9420('0x12')]('\x20')!=-0x1){_0x556585=_0x556585['substr'](0x0,_0x556585[_0x9420('0x12')]('\x20'));}if(_[_0x9420('0x13')](_0x556585,'-1')){_0x556585=parseInt(_0x556585);}_0x2a2472=_0x1a98a2['rx'][_0x9420('0x14')]('\x20');if(_0x2a2472[_0x9420('0x15')]==0x3){_0x2a2472=_0x2a2472[0x2][_0x9420('0xc')](0x1,_0x2a2472[0x2][_0x9420('0x15')]-0x1);}else if(_0x2a2472[_0x9420('0x15')]>0x3){var _0x11671f=/\((.+)\)/;var _0x3c8671=_0x1a98a2['rx'][_0x9420('0x16')](_0x11671f);if(_0x3c8671){_0x2a2472=_0x3c8671[0x1];}else{_0x2a2472=null;}}else{_0x2a2472=null;}_0x1a98a2['cb'](null,{'code':_0x1e0204,'result':_0x556585,'extra':_0x2a2472});}});_0x13fb2a['on'](_0x9420('0x17'),function(_0x191700){_0x331968[_0x9420('0x18')]('error',new AGIError(_0x9420('0x19'),_0x191700['code']));});_0x13fb2a['on'](_0x9420('0x1a'),function(){_0x331968[_0x9420('0x18')](_0x9420('0x1a'),new AGIError(_0x9420('0x1b')));});_0x13fb2a['on']('timeout',function(){_0x331968[_0x9420('0x18')](_0x9420('0x1c'),new AGIError(_0x9420('0x1d')));_0x13fb2a['destroy']();});_0x13fb2a[_0x9420('0x1e')](_0x1f9d87);this[_0x9420('0x1f')]=function(_0x3a85da,_0x5704e2){var _0x3a85da=_0x3a85da||'',_0x5704e2=typeof _0x5704e2==_0x9420('0xe')?_0x5704e2:new Function();_0x1a98a2={'tx':_0x3a85da,'rx':'','cb':_0x5704e2};_0x13fb2a[_0x9420('0x20')](_0x3a85da+'\x0a');},this['close']=function(){_0x13fb2a[_0x9420('0x21')]();};}util[_0x9420('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x9420('0x23')]['sendRequest']=function(_0x5b50a0){return this[_0x9420('0x1f')]['sync'](this,_0x5b50a0);};AGIChannel[_0x9420('0x23')][_0x9420('0x24')]=function(){return this['sendRequest'](_0x9420('0x25'));};AGIChannel['prototype'][_0x9420('0x26')]=function(_0x5a2311,_0x4d9941,_0x3db693){_0x5a2311=_0x5a2311===undefined?_0x9420('0x27'):_0x5a2311;_0x4d9941=_0x4d9941===undefined?'5':_0x4d9941;_0x3db693=_0x3db693===undefined?'1':_0x3db693;return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x2a'),_0x5a2311,_0x4d9941*0x3e8,_0x3db693));};AGIChannel[_0x9420('0x23')]['noop']=function(_0x8e0d00){_0x8e0d00=_0x8e0d00||_0x9420('0x2b');return this[_0x9420('0x28')](util['format']('VERBOSE\x20\x22%s\x22',_0x8e0d00));};AGIChannel[_0x9420('0x23')][_0x9420('0x2c')]=function(_0x3beb37,_0x4fed9e){if(_[_0x9420('0x2d')](_0x4fed9e)){return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x2e'),_0x3beb37,_0x4fed9e[_0x9420('0x2f')](',')));}return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x2e'),_0x3beb37,_0x4fed9e));};AGIChannel[_0x9420('0x23')][_0x9420('0x30')]=function(_0x2f8048){return this['sendRequest'](util['format'](_0x9420('0x31'),_0x2f8048));};AGIChannel[_0x9420('0x23')]['setExtension']=function(_0x52b877){return this[_0x9420('0x28')](util[_0x9420('0x29')]('SET\x20EXTENSION\x20%s',_0x52b877));};AGIChannel[_0x9420('0x23')]['setPriority']=function(_0x15a9c6){return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x32'),_0x15a9c6));};AGIChannel['prototype'][_0x9420('0xb')]=function(){return this[_0x9420('0x28')](_0x9420('0x33'));};AGIChannel[_0x9420('0x23')][_0x9420('0x34')]=function(_0x4db637,_0x569644){var _0x2d344e=_['isBoolean'](_0x569644)||_[_0x9420('0x35')](_0x569644)?_0x569644[_0x9420('0x36')]():_0x569644;return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x37'),_0x4db637,_0x2d344e?_0x2d344e[_0x9420('0x36')]()[_0x9420('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9420('0x23')]['sayNumber']=function(_0x2b21a9,_0x17a778){return this['sendRequest'](util['format'](_0x9420('0x38'),_0x2b21a9,_0x17a778));};AGIChannel[_0x9420('0x23')][_0x9420('0x39')]=function(_0x5749c2,_0x3dd5cc){return this[_0x9420('0x28')](util['format'](_0x9420('0x3a'),_0x5749c2,_0x3dd5cc));};AGIChannel['prototype'][_0x9420('0x3b')]=function(_0x482709,_0x566fb3){return this['sendRequest'](util[_0x9420('0x29')](_0x9420('0x3c'),_0x482709,_0x566fb3));};AGIChannel[_0x9420('0x23')]['continueAt']=function(_0xc6e358,_0x38a98c,_0x3f11f1){_0x38a98c=_0x38a98c||this[_0x9420('0x3d')];_0x3f11f1=_0x3f11f1||0x1;this[_0x9420('0x30')](_0xc6e358);this[_0x9420('0x3e')](_0x38a98c);this['setPriority'](_0x3f11f1);return this[_0x9420('0x3f')](util[_0x9420('0x29')](_0x9420('0x40'),_0xc6e358,_0x38a98c,_0x3f11f1));};AGIChannel[_0x9420('0x23')]['getVariable']=function(_0x537046){return this[_0x9420('0x28')](util['format'](_0x9420('0x41'),_0x537046));};AGIChannel[_0x9420('0x23')][_0x9420('0x42')]=function(_0x4c4fe5,_0x328304,_0x29a3c0,_0x5e7a5f,_0x4fe47,_0x43e8ef){_0x328304=_0x328304||_0x9420('0x43');_0x29a3c0=_0x29a3c0||'';_0x5e7a5f=_0x5e7a5f===undefined?-0x1:_0x5e7a5f==='-1'?-0x1:_0x5e7a5f*0x3e8;_0x4fe47=_0x4fe47===undefined?'':'s='+_0x4fe47;_0x43e8ef=_0x43e8ef?_0x9420('0x44'):'';return this['sendRequest'](util[_0x9420('0x29')](_0x9420('0x45'),_0x4c4fe5,_0x328304,_0x29a3c0,_0x5e7a5f,_0x43e8ef,_0x4fe47));};AGIChannel[_0x9420('0x23')]['streamFile']=function(_0x50a293,_0x20ff24){_0x20ff24=_0x20ff24||'';return this[_0x9420('0x28')](util[_0x9420('0x29')](_0x9420('0x46'),_0x50a293,_0x20ff24));};AGIChannel['prototype']['agi']=function(_0x505f01){return this[_0x9420('0x2c')](_0x9420('0x47'),_0x505f01);};AGIChannel[_0x9420('0x23')][_0x9420('0x48')]=function(_0x2283cf){return this['exec'](_0x9420('0x49'),_0x2283cf);};AGIChannel[_0x9420('0x23')]['error']=function(_0x48ff64,_0x72cf55){this['noop'](util[_0x9420('0x29')](_0x9420('0x4a'),_0x48ff64['id'],_0x48ff64[_0x9420('0x4b')],_0x72cf55));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9420('0x4c')]=AGIChannel; \ No newline at end of file +var _0xaa37=['indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','destroy','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','replace','result='];(function(_0x4084fe,_0x19aad9){var _0x598649=function(_0xa81c8f){while(--_0xa81c8f){_0x4084fe['push'](_0x4084fe['shift']());}};_0x598649(++_0x19aad9);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xaa37[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0x7aa3('0x0'));var _=require(_0x7aa3('0x1'));var EventEmitter=require(_0x7aa3('0x2'))[_0x7aa3('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7aa3('0x4'));function AGIChannel(_0x27adcf){var _0x27333d=this,_0x11e64c=new AGIReply(),_0x334919=![],_0x2801a2={};EventEmitter[_0x7aa3('0x5')](_0x27333d);_0x27adcf['setEncoding'](_0x7aa3('0x6'));_0x27adcf[_0x7aa3('0x7')](0x8*0x3c*0x3c*0x3e8);_0x11e64c['setEncoding'](_0x7aa3('0x6'));_0x11e64c['on'](_0x7aa3('0x8'),function(_0x394097){for(var _0x4f43f1 in _0x394097){_0x27333d[_0x4f43f1]=_0x394097[_0x4f43f1];}_0x27333d[_0x7aa3('0x9')](_0x7aa3('0xa'));});_0x11e64c['on'](_0x7aa3('0xb'),function(_0x1725d1){if(_0x1725d1[_0x7aa3('0xc')]()==_0x7aa3('0xd')){_0x27333d['emit']('hangup');return;}if(_0x1725d1[_0x7aa3('0xe')](0x0,0xb)=='520-Invalid'){_0x334919=!![];}if(_0x334919){_0x2801a2['rx']+=_0x1725d1+'\x0a';if(_0x1725d1[_0x7aa3('0xf')](_0x7aa3('0x10'))!=-0x1){_0x334919=![];}}else{_0x2801a2['rx']=_0x1725d1;}if(_0x334919){return;}if(typeof _0x2801a2['cb']=='function'){var _0x3c68b8=_0x2801a2['rx']['substring'](0x0,0x3),_0xc11cd3=null,_0x552ec9=null;_0x3c68b8=parseInt(_0x3c68b8);if(isNaN(_0x3c68b8)){_0x2801a2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3c68b8!=0xc8){_0x2801a2['cb'](null,{'code':_0x3c68b8,'result':-0x1,'extra':'KO'});return;}_0xc11cd3=_0x2801a2['rx'][_0x7aa3('0xe')](0x4)[_0x7aa3('0x11')](_0x7aa3('0x12'),'');if(_0xc11cd3[_0x7aa3('0x13')]('\x20')!=-0x1){_0xc11cd3=_0xc11cd3[_0x7aa3('0x14')](0x0,_0xc11cd3['indexOf']('\x20'));}if(_[_0x7aa3('0x15')](_0xc11cd3,'-1')){_0xc11cd3=parseInt(_0xc11cd3);}_0x552ec9=_0x2801a2['rx'][_0x7aa3('0x16')]('\x20');if(_0x552ec9[_0x7aa3('0x17')]==0x3){_0x552ec9=_0x552ec9[0x2][_0x7aa3('0xe')](0x1,_0x552ec9[0x2]['length']-0x1);}else if(_0x552ec9['length']>0x3){var _0x3fab08=/\((.+)\)/;var _0x50ab9e=_0x2801a2['rx'][_0x7aa3('0x18')](_0x3fab08);if(_0x50ab9e){_0x552ec9=_0x50ab9e[0x1];}else{_0x552ec9=null;}}else{_0x552ec9=null;}_0x2801a2['cb'](null,{'code':_0x3c68b8,'result':_0xc11cd3,'extra':_0x552ec9});}});_0x27adcf['on'](_0x7aa3('0x19'),function(_0x4dcefa){_0x27333d[_0x7aa3('0x9')](_0x7aa3('0x19'),new AGIError(_0x7aa3('0x1a'),_0x4dcefa[_0x7aa3('0x1b')]));});_0x27adcf['on'](_0x7aa3('0x1c'),function(){_0x27333d['emit'](_0x7aa3('0x1c'),new AGIError(_0x7aa3('0x1d')));});_0x27adcf['on'](_0x7aa3('0x1e'),function(){_0x27333d[_0x7aa3('0x9')](_0x7aa3('0x1e'),new AGIError(_0x7aa3('0x1f')));_0x27adcf['destroy']();});_0x27adcf[_0x7aa3('0x20')](_0x11e64c);this[_0x7aa3('0x21')]=function(_0x35f0f8,_0x4177b9){var _0x35f0f8=_0x35f0f8||'',_0x4177b9=typeof _0x4177b9==_0x7aa3('0x22')?_0x4177b9:new Function();_0x2801a2={'tx':_0x35f0f8,'rx':'','cb':_0x4177b9};_0x27adcf[_0x7aa3('0x23')](_0x35f0f8+'\x0a');},this[_0x7aa3('0x1c')]=function(){_0x27adcf[_0x7aa3('0x24')]();};}util[_0x7aa3('0x25')](AGIChannel,EventEmitter);AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x27')]=function(_0x40645e){return this[_0x7aa3('0x21')][_0x7aa3('0x28')](this,_0x40645e);};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x29')]=function(){return this[_0x7aa3('0x27')]('ANSWER');};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x2a')]=function(_0x3c1422,_0x32e551,_0x183ffc){_0x3c1422=_0x3c1422===undefined?_0x7aa3('0x2b'):_0x3c1422;_0x32e551=_0x32e551===undefined?'5':_0x32e551;_0x183ffc=_0x183ffc===undefined?'1':_0x183ffc;return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x2d'),_0x3c1422,_0x32e551*0x3e8,_0x183ffc));};AGIChannel[_0x7aa3('0x26')]['noop']=function(_0x409194){_0x409194=_0x409194||_0x7aa3('0x2e');return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x2f'),_0x409194));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x30')]=function(_0x370e46,_0x24a38d){if(_[_0x7aa3('0x31')](_0x24a38d)){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x32'),_0x370e46,_0x24a38d[_0x7aa3('0x33')](',')));}return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x32'),_0x370e46,_0x24a38d));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x34')]=function(_0x2af928){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x35'),_0x2af928));};AGIChannel[_0x7aa3('0x26')]['setExtension']=function(_0x295b73){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x36'),_0x295b73));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x37')]=function(_0x2e48d6){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x38'),_0x2e48d6));};AGIChannel[_0x7aa3('0x26')]['hangup']=function(){return this[_0x7aa3('0x27')](_0x7aa3('0x39'));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x3a')]=function(_0x89d47,_0x1029eb){var _0x1c8d0e=_[_0x7aa3('0x3b')](_0x1029eb)||_[_0x7aa3('0x3c')](_0x1029eb)?_0x1029eb[_0x7aa3('0x3d')]():_0x1029eb;return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x3e'),_0x89d47,_0x1c8d0e?_0x1c8d0e[_0x7aa3('0x3d')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x3f')]=function(_0xbdc351,_0x46ddd7){return this['sendRequest'](util[_0x7aa3('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0xbdc351,_0x46ddd7));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x40')]=function(_0x63b4a9,_0x1177b4){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x41'),_0x63b4a9,_0x1177b4));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x42')]=function(_0x32783c,_0x5ee53c){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')](_0x7aa3('0x43'),_0x32783c,_0x5ee53c));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x44')]=function(_0x143d77,_0x453735,_0x3f0fcf){_0x453735=_0x453735||this[_0x7aa3('0x45')];_0x3f0fcf=_0x3f0fcf||0x1;this[_0x7aa3('0x34')](_0x143d77);this[_0x7aa3('0x46')](_0x453735);this[_0x7aa3('0x37')](_0x3f0fcf);return this[_0x7aa3('0x47')](util[_0x7aa3('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x143d77,_0x453735,_0x3f0fcf));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x48')]=function(_0x4999d5){return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x4999d5));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x49')]=function(_0x24b42e,_0x20b2f6,_0x59830f,_0x4bd8ee,_0x2b19af,_0x50900c){_0x20b2f6=_0x20b2f6||_0x7aa3('0x4a');_0x59830f=_0x59830f||'';_0x4bd8ee=_0x4bd8ee===undefined?-0x1:_0x4bd8ee==='-1'?-0x1:_0x4bd8ee*0x3e8;_0x2b19af=_0x2b19af===undefined?'':'s='+_0x2b19af;_0x50900c=_0x50900c?'BEEP':'';return this['sendRequest'](util[_0x7aa3('0x2c')](_0x7aa3('0x4b'),_0x24b42e,_0x20b2f6,_0x59830f,_0x4bd8ee,_0x50900c,_0x2b19af));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x4c')]=function(_0x384a75,_0x4e472d){_0x4e472d=_0x4e472d||'';return this[_0x7aa3('0x27')](util[_0x7aa3('0x2c')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x384a75,_0x4e472d));};AGIChannel[_0x7aa3('0x26')][_0x7aa3('0x4d')]=function(_0x3cdcfe){return this['exec'](_0x7aa3('0x4e'),_0x3cdcfe);};AGIChannel[_0x7aa3('0x26')]['wait']=function(_0x2cc4aa){return this[_0x7aa3('0x30')]('WAIT',_0x2cc4aa);};AGIChannel['prototype'][_0x7aa3('0x19')]=function(_0x1a990,_0x41f9fe){this[_0x7aa3('0x47')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1a990['id'],_0x1a990[_0x7aa3('0x4f')],_0x41f9fe));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7aa3('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0d54170..0ddaaf0 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 _0xf246=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xf246,0x143));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6f24('0x0'));var error={'E_AGI_UNDEFINED':_0x6f24('0x1'),'E_AGI_ARGUMENT_PORT':_0x6f24('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6f24('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6f24('0x4'),'E_AGI_SOCKET_ERROR':_0x6f24('0x5'),'E_AGI_SOCKET_CLOSE':_0x6f24('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x6f24('0x7'),'E_AGI_COMMAND_EMPTY':_0x6f24('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6f24('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5f55b3){var _0x5f55b3=_0x5f55b3||null,_0x3b9921=_0x3b9921||[],_0x109d4f=0x1,_0x51cb79='';if(!error[_0x5f55b3]){_0x5f55b3='E_AGI_UNDEFINED';}_0x3b9921[_0x6f24('0xa')](error[_0x5f55b3]);while(arguments[_0x109d4f]){_0x3b9921[_0x6f24('0xa')](arguments[_0x109d4f]);_0x109d4f++;}_0x51cb79=util[_0x6f24('0xb')]['apply'](util,_0x3b9921);this[_0x6f24('0xc')]=_0x51cb79;this[_0x6f24('0xd')]=_0x5f55b3;}module[_0x6f24('0xe')]=AGIError; \ No newline at end of file +var _0x6145=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x3897f6,_0x4ebde7){var _0x5b8072=function(_0x16bbaf){while(--_0x16bbaf){_0x3897f6['push'](_0x3897f6['shift']());}};_0x5b8072(++_0x4ebde7);}(_0x6145,0x131));var _0x5614=function(_0x28c7ac,_0x22173d){_0x28c7ac=_0x28c7ac-0x0;var _0x47fcfa=_0x6145[_0x28c7ac];return _0x47fcfa;};'use strict';var util=require(_0x5614('0x0'));var error={'E_AGI_UNDEFINED':_0x5614('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x5614('0x2'),'E_AGI_SERVER_CLOSE':_0x5614('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5614('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x5614('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x5614('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x5614('0x7'),'E_AGI_COMMAND_EMPTY':_0x5614('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x5614('0x9')};function AGIError(_0x2051ca){var _0x2051ca=_0x2051ca||null,_0x5ed0ab=_0x5ed0ab||[],_0x48e7c4=0x1,_0x5e0e06='';if(!error[_0x2051ca]){_0x2051ca=_0x5614('0xa');}_0x5ed0ab[_0x5614('0xb')](error[_0x2051ca]);while(arguments[_0x48e7c4]){_0x5ed0ab[_0x5614('0xb')](arguments[_0x48e7c4]);_0x48e7c4++;}_0x5e0e06=util[_0x5614('0xc')]['apply'](util,_0x5ed0ab);this['message']=_0x5e0e06;this[_0x5614('0xd')]=_0x2051ca;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 47a6be3..53fa293 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7f9=['parse','projectUpdate','error','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','E_AGI_SERVER_ERROR','message','agi'];(function(_0x15093,_0x4b9f43){var _0x3f1a5b=function(_0x4cadfd){while(--_0x4cadfd){_0x15093['push'](_0x15093['shift']());}};_0x3f1a5b(++_0x4b9f43);}(_0xd7f9,0xae));var _0x9d7f=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0xd7f9[_0xe501ff];return _0x17135d;};'use strict';var _=require(_0x9d7f('0x0'));var EventEmitter=require('events')[_0x9d7f('0x1')];var Redis=require(_0x9d7f('0x2'));var AGIError=require(_0x9d7f('0x3'));var config=require(_0x9d7f('0x4'));config[_0x9d7f('0x5')]=_[_0x9d7f('0x6')](config[_0x9d7f('0x5')],{'host':_0x9d7f('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x9d7f('0x5')]);sub[_0x9d7f('0x8')]('agi',function(_0x52c56c){if(_0x52c56c)return eventEmitter[_0x9d7f('0x9')]('error',new AGIError(_0x9d7f('0xa'),_0x52c56c));});sub['on'](_0x9d7f('0xb'),function(_0x4a3471,_0x194bc4){if(_0x4a3471!==_0x9d7f('0xc'))return;try{var _0x244698=JSON[_0x9d7f('0xd')](_0x194bc4);eventEmitter['emit'](_0x9d7f('0xe'),_0x244698);}catch(_0x36ccc3){eventEmitter[_0x9d7f('0x9')](_0x9d7f('0xf'),new AGIError('E_AGI_SERVER_ERROR',_0x36ccc3));}});module[_0x9d7f('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3e38=['../../config/environment','defaults','redis','localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','emit','exports','EventEmitter'];(function(_0x5b1abf,_0x54a986){var _0x2a20da=function(_0x3b6c97){while(--_0x3b6c97){_0x5b1abf['push'](_0x5b1abf['shift']());}};_0x2a20da(++_0x54a986);}(_0x3e38,0x1c2));var _0x83e3=function(_0x545282,_0x32ac19){_0x545282=_0x545282-0x0;var _0xc46381=_0x3e38[_0x545282];return _0xc46381;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x83e3('0x0')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x83e3('0x1'));config['redis']=_[_0x83e3('0x2')](config[_0x83e3('0x3')],{'host':_0x83e3('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x83e3('0x3')]);sub[_0x83e3('0x5')](_0x83e3('0x6'),function(_0x50df7d){if(_0x50df7d)return eventEmitter['emit']('error',new AGIError(_0x83e3('0x7'),_0x50df7d));});sub['on'](_0x83e3('0x8'),function(_0x5a6448,_0x12c2e8){if(_0x5a6448!==_0x83e3('0x6'))return;try{var _0x5db2c0=JSON['parse'](_0x12c2e8);eventEmitter[_0x83e3('0x9')]('projectUpdate',_0x5db2c0);}catch(_0x412803){eventEmitter[_0x83e3('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x412803));}});module[_0x83e3('0xa')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index cc143f3..e1b5e73 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 _0x1816=['no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','menu','invalid','traverseBFS','includes','condition\x20not\x20found','exports','../../../config/logger','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0xd7daae,_0x5b4575){var _0x57dee8=function(_0x16d822){while(--_0x16d822){_0xd7daae['push'](_0xd7daae['shift']());}};_0x57dee8(++_0x5b4575);}(_0x1816,0x16c));var _0x6181=function(_0x5b36a8,_0x432acc){_0x5b36a8=_0x5b36a8-0x0;var _0x7d9670=_0x1816[_0x5b36a8];return _0x7d9670;};'use strict';var _=require('lodash');var logger=require(_0x6181('0x0'))('agi');var verticesWithRetry=['menu','getdigits',_0x6181('0x1')];var Graph=function(){this[_0x6181('0x2')]={};this[_0x6181('0x3')]={};this[_0x6181('0x4')]=0x0;};Graph[_0x6181('0x5')][_0x6181('0x6')]=function(_0x59e64f){this[_0x6181('0x2')][_0x59e64f['id']]=_0x59e64f;this[_0x6181('0x3')][_0x59e64f['id']]=[];};Graph[_0x6181('0x5')][_0x6181('0x7')]=function(_0x3ff3ef,_0x43a1e3,_0x8e4ddc){this[_0x6181('0x3')][_0x3ff3ef][_0x6181('0x8')]({'target':_0x43a1e3,'condition':_0x8e4ddc});this[_0x6181('0x4')]+=0x1;};Graph['prototype'][_0x6181('0x9')]=function(){return _[_0x6181('0x9')](this[_0x6181('0x2')]);};Graph[_0x6181('0x5')]['relations']=function(){return this['numberOfEdges'];};Graph['prototype'][_0x6181('0xa')]=function(_0x1d3432){return this[_0x6181('0x2')][_0x1d3432];};Graph[_0x6181('0x5')]['traverseBFS']=function(_0x1b5fd1,_0x311d69){if(!this[_0x6181('0x2')][_0x1b5fd1]){return logger[_0x6181('0xb')](_0x6181('0xc'));}var _0x1f7ae7=_0x311d69(this[_0x6181('0x2')][_0x1b5fd1]);if(!_0x1f7ae7){return logger[_0x6181('0xb')](_0x6181('0xd'));}if(this['edges'][_0x1b5fd1]['length']===0x0){return logger[_0x6181('0xb')](_0x6181('0xe'));}for(var _0x5c5bda=0x0,_0x1c0c21=[],_0x22d423=![];_0x5c5bda\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','createSquareReport','catch','indexOf','substring','debug','variables','find','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','connection','close','lodash','syncho'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x5697,0x9d));var _0x7569=function(_0x2ef608,_0x53a7b1){_0x2ef608=_0x2ef608-0x0;var _0x56aa07=_0x5697[_0x2ef608];return _0x56aa07;};'use strict';var _=require(_0x7569('0x0'));var syncho=require(_0x7569('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x7569('0x2'))(_0x7569('0x3'));var utilLicense=require(_0x7569('0x4'));var rpc=require(_0x7569('0x5'));var Project=require(_0x7569('0x6'));var AGIEmitter=require(_0x7569('0x7'))[_0x7569('0x8')];var projects=[];config[_0x7569('0x3')]=_[_0x7569('0x9')](config['agi'],{'ip':_0x7569('0xa'),'port':0x11dd});AGIEmitter['on'](_0x7569('0xb'),projectUpdateHandler);function connectionHandler(_0x13e470){process[_0x7569('0xc')](function(){syncho(function(){try{setChannelVariables(_0x13e470);agiHandler(_0x13e470);}catch(_0x2f8d36){logger[_0x7569('0xd')](_0x2f8d36[_0x7569('0xe')]);}});});}function projectUpdateHandler(_0x2c7bd0){try{var _0x1ed782=_[_0x7569('0xf')](projects,['id',_0x2c7bd0['id']]);if(_0x1ed782>-0x1){if(_0x2c7bd0['deleted']===!![]){projects[_0x7569('0x10')](_0x1ed782,0x1);}else{projects[_0x1ed782]=_0x2c7bd0;}}else{projects[_0x7569('0x11')](_0x2c7bd0);}}catch(_0x14cd8d){logger['error'](_0x14cd8d['stack']);}}function listeningHandler(){console[_0x7569('0x12')](_0x7569('0x13'),config[_0x7569('0x3')][_0x7569('0x14')]);logger[_0x7569('0x15')](util[_0x7569('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7569('0x3')]['ip'],config[_0x7569('0x3')]['port']));}function errorHandler(_0x3a0376){if(_0x3a0376&&_0x3a0376[_0x7569('0x17')]&&_0x3a0376['message']){logger[_0x7569('0xd')](util[_0x7569('0x16')](_0x7569('0x18'),_0x3a0376[_0x7569('0x17')],_0x3a0376[_0x7569('0x19')]));}else{logger[_0x7569('0xd')](util[_0x7569('0x16')]('[ERROR]\x20%s',_0x3a0376[_0x7569('0xe')]));}}function closeHandler(){logger[_0x7569('0x15')](util[_0x7569('0x16')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7569('0x1a')],this[_0x7569('0x1b')],this['callerid'],this[_0x7569('0x1c')],this[_0x7569('0x1d')]));try{createSquareReport(this);}catch(_0x1734c2){logger[_0x7569('0xd')](_0x1734c2[_0x7569('0xe')]);}}function timeoutHandler(){logger[_0x7569('0x15')](util[_0x7569('0x16')](_0x7569('0x1e'),this[_0x7569('0x1a')],this[_0x7569('0x1b')],this[_0x7569('0x1f')],this[_0x7569('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0x7569('0x15')](util[_0x7569('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7569('0x1a')],this[_0x7569('0x1b')],this['callerid'],this[_0x7569('0x1c')],this[_0x7569('0x1d')]));this[_0x7569('0x20')]=!![];}function createSquareReport(_0x3e03f2,_0x436465){rpc[_0x7569('0x21')](_0x3e03f2)['then'](function(_0x51aad3){if(_0x436465){_0x436465(null,_0x51aad3);}})[_0x7569('0x22')](function(_0x778816){if(_0x436465){_0x436465(null,_0x778816);}});}function setChannelVariables(_0x2cf03e){for(var _0x48bc3f in _0x2cf03e){if(_0x2cf03e['hasOwnProperty'](_0x48bc3f)){if(_0x48bc3f[_0x7569('0x23')]('agi_')===0x0){_0x2cf03e[_0x48bc3f[_0x7569('0x24')](0x4)]=_0x2cf03e[_0x48bc3f];delete _0x2cf03e[_0x48bc3f];}}}}function agiHandler(_0xedc125){logger[_0x7569('0x25')](_0x7569('0x26'),JSON['stringify'](_0xedc125,null,0x2));logger['info'](util[_0x7569('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xedc125[_0x7569('0x1a')],_0xedc125[_0x7569('0x1b')],_0xedc125[_0x7569('0x1f')],_0xedc125[_0x7569('0x1c')],_0xedc125[_0x7569('0x1d')]));_0xedc125['on'](_0x7569('0xd'),errorHandler);_0xedc125['on']('close',closeHandler);_0xedc125['on']('timeout',timeoutHandler);_0xedc125[_0x7569('0x20')]=![];_0xedc125['on']('hangup',hangupHandler);var _0x8fde88=_[_0x7569('0x27')](projects,['name',_0xedc125[_0x7569('0x1a')]]);if(!_0x8fde88)return Project[_0x7569('0x28')](_0xedc125);if(!_0x8fde88['production'])return Project[_0x7569('0x29')](_0xedc125);return Project[_0x7569('0x2a')](_0x8fde88,_0xedc125);}function main(){var _0x41dbaf;return utilLicense[_0x7569('0x2b')]()[_0x7569('0x2c')](function(_0x2706aa){if(!_0x2706aa)return;if(_0x2706aa[_0x7569('0x2d')]){if(_0x2706aa[_0x7569('0x2e')]&&_0x2706aa[_0x7569('0x2e')]>0x0){logger[_0x7569('0x15')](util[_0x7569('0x16')](_0x7569('0x2f'),_0x2706aa[_0x7569('0x2e')]));_0x41dbaf=_0x2706aa[_0x7569('0x2e')];}else{logger[_0x7569('0x15')](_0x7569('0x30'));}}else{logger[_0x7569('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x41dbaf=-0x1;}})[_0x7569('0x2c')](function(){return Project[_0x7569('0x31')]();})[_0x7569('0x2c')](function(_0x47e62a){projects=_0x47e62a;return;})[_0x7569('0x22')](function(_0x53bfe1){logger[_0x7569('0xd')](_0x7569('0x32'),_0x53bfe1[_0x7569('0xe')]);})['finally'](function(){var _0x2c9266=require('./server')(config[_0x7569('0x3')][_0x7569('0x14')],config['agi']['ip'],_0x41dbaf);_0x2c9266['on'](_0x7569('0xd'),errorHandler);_0x2c9266['on']('listening',listeningHandler);_0x2c9266['on'](_0x7569('0x33'),connectionHandler);_0x2c9266['on'](_0x7569('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0xb132=['deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','initialize','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','close','lodash','syncho','util','../../config/logger','agi','./rpc','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','findIndex'];(function(_0xe9e158,_0x502c2e){var _0x2d0591=function(_0x4b0ed1){while(--_0x4b0ed1){_0xe9e158['push'](_0xe9e158['shift']());}};_0x2d0591(++_0x502c2e);}(_0xb132,0x1eb));var _0x2b13=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xb132[_0xed5f9c];return _0x3a1c43;};'use strict';var _=require(_0x2b13('0x0'));var syncho=require(_0x2b13('0x1'));var util=require(_0x2b13('0x2'));var config=require('../../config/environment');var logger=require(_0x2b13('0x3'))(_0x2b13('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x2b13('0x5'));var Project=require('./project');var AGIEmitter=require('./events')[_0x2b13('0x6')];var projects=[];config['agi']=_[_0x2b13('0x7')](config[_0x2b13('0x4')],{'ip':_0x2b13('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x47a79c){process[_0x2b13('0x9')](function(){syncho(function(){try{setChannelVariables(_0x47a79c);agiHandler(_0x47a79c);}catch(_0x5a12bc){logger[_0x2b13('0xa')](_0x5a12bc[_0x2b13('0xb')]);}});});}function projectUpdateHandler(_0x23010e){try{var _0x2abd23=_[_0x2b13('0xc')](projects,['id',_0x23010e['id']]);if(_0x2abd23>-0x1){if(_0x23010e[_0x2b13('0xd')]===!![]){projects[_0x2b13('0xe')](_0x2abd23,0x1);}else{projects[_0x2abd23]=_0x23010e;}}else{projects[_0x2b13('0xf')](_0x23010e);}}catch(_0x1f7c7e){logger[_0x2b13('0xa')](_0x1f7c7e['stack']);}}function listeningHandler(){console[_0x2b13('0x10')](_0x2b13('0x11'),config[_0x2b13('0x4')][_0x2b13('0x12')]);logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x15'),config[_0x2b13('0x4')]['ip'],config['agi'][_0x2b13('0x12')]));}function errorHandler(_0x309a86){if(_0x309a86&&_0x309a86[_0x2b13('0x16')]&&_0x309a86[_0x2b13('0x17')]){logger[_0x2b13('0xa')](util[_0x2b13('0x14')](_0x2b13('0x18'),_0x309a86['name'],_0x309a86[_0x2b13('0x17')]));}else{logger[_0x2b13('0xa')](util[_0x2b13('0x14')](_0x2b13('0x19'),_0x309a86[_0x2b13('0xb')]));}}function closeHandler(){logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x1a'),this[_0x2b13('0x1b')],this['calleridname'],this['callerid'],this[_0x2b13('0x1c')],this[_0x2b13('0x1d')]));try{createSquareReport(this);}catch(_0x209e29){logger[_0x2b13('0xa')](_0x209e29[_0x2b13('0xb')]);}}function timeoutHandler(){logger['info'](util[_0x2b13('0x14')](_0x2b13('0x1e'),this['arg_1'],this[_0x2b13('0x1f')],this[_0x2b13('0x20')],this['dnid'],this[_0x2b13('0x1d')]));}function hangupHandler(){logger[_0x2b13('0x13')](util[_0x2b13('0x14')](_0x2b13('0x21'),this[_0x2b13('0x1b')],this[_0x2b13('0x1f')],this[_0x2b13('0x20')],this[_0x2b13('0x1c')],this[_0x2b13('0x1d')]));this[_0x2b13('0x22')]=!![];}function createSquareReport(_0x9d3347,_0x5e2ec5){rpc[_0x2b13('0x23')](_0x9d3347)[_0x2b13('0x24')](function(_0x17a5f0){if(_0x5e2ec5){_0x5e2ec5(null,_0x17a5f0);}})[_0x2b13('0x25')](function(_0x226b52){if(_0x5e2ec5){_0x5e2ec5(null,_0x226b52);}});}function setChannelVariables(_0x298eb7){for(var _0x142552 in _0x298eb7){if(_0x298eb7['hasOwnProperty'](_0x142552)){if(_0x142552[_0x2b13('0x26')](_0x2b13('0x27'))===0x0){_0x298eb7[_0x142552['substring'](0x4)]=_0x298eb7[_0x142552];delete _0x298eb7[_0x142552];}}}}function agiHandler(_0x27f763){logger['debug']('variables',JSON[_0x2b13('0x28')](_0x27f763,null,0x2));logger['info'](util['format'](_0x2b13('0x29'),_0x27f763[_0x2b13('0x1b')],_0x27f763['calleridname'],_0x27f763[_0x2b13('0x20')],_0x27f763[_0x2b13('0x1c')],_0x27f763['uniqueid']));_0x27f763['on'](_0x2b13('0xa'),errorHandler);_0x27f763['on']('close',closeHandler);_0x27f763['on'](_0x2b13('0x2a'),timeoutHandler);_0x27f763[_0x2b13('0x22')]=![];_0x27f763['on'](_0x2b13('0x2b'),hangupHandler);var _0x3c0bd6=_[_0x2b13('0x2c')](projects,['name',_0x27f763['arg_1']]);if(!_0x3c0bd6)return Project[_0x2b13('0x2d')](_0x27f763);if(!_0x3c0bd6['production'])return Project['handleUnpublished'](_0x27f763);return Project[_0x2b13('0x2e')](_0x3c0bd6,_0x27f763);}function main(){var _0x4b4932;return utilLicense['getLicense']()[_0x2b13('0x24')](function(_0x3fd2ab){if(!_0x3fd2ab)return;if(_0x3fd2ab[_0x2b13('0x2f')]){if(_0x3fd2ab['callysquare']&&_0x3fd2ab[_0x2b13('0x30')]>0x0){logger[_0x2b13('0x13')](util[_0x2b13('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3fd2ab[_0x2b13('0x30')]));_0x4b4932=_0x3fd2ab[_0x2b13('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2b13('0x13')](_0x2b13('0x31'));_0x4b4932=-0x1;}})[_0x2b13('0x24')](function(){return Project[_0x2b13('0x32')]();})['then'](function(_0x37f1e0){projects=_0x37f1e0;return;})[_0x2b13('0x25')](function(_0x5ad37a){logger[_0x2b13('0xa')]('[LICENSE]',_0x5ad37a[_0x2b13('0xb')]);})[_0x2b13('0x33')](function(){var _0x38aea2=require(_0x2b13('0x34'))(config[_0x2b13('0x4')]['port'],config[_0x2b13('0x4')]['ip'],_0x4b4932);_0x38aea2['on'](_0x2b13('0xa'),errorHandler);_0x38aea2['on'](_0x2b13('0x35'),listeningHandler);_0x38aea2['on'](_0x2b13('0x36'),connectionHandler);_0x38aea2['on'](_0x2b13('0x37'),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 dbd256e..acf662f 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 _0xd028=['error','message','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x40691a,_0x585f09){var _0x3df5ca=function(_0x529619){while(--_0x529619){_0x40691a['push'](_0x40691a['shift']());}};_0x3df5ca(++_0x585f09);}(_0xd028,0x11b));var _0x8d02=function(_0x1fb494,_0xcc10b0){_0x1fb494=_0x1fb494-0x0;var _0x586f75=_0xd028[_0x1fb494];return _0x586f75;};'use strict';var BPromise=require(_0x8d02('0x0'));var jayson=require(_0x8d02('0x1'));var client=jayson[_0x8d02('0x2')][_0x8d02('0x3')]({'port':0x232b});function request(_0x1bda57,_0x3eac27){return new BPromise(function(_0x1778e4,_0x4bc535){return client[_0x8d02('0x4')](_0x1bda57,_0x3eac27)['then'](function(_0x2cd0c2){if(_0x2cd0c2[_0x8d02('0x5')]){return _0x4bc535(_0x2cd0c2[_0x8d02('0x5')][_0x8d02('0x6')]);}else{return _0x1778e4(_0x2cd0c2['result']);}})['catch'](function(_0x3b4f74){return _0x4bc535(_0x3b4f74);});});}exports[_0x8d02('0x7')]=function(_0x551e11,_0x134708){return request(_0x8d02('0x8'),{'account':_0x551e11,'message':_0x134708});}; \ No newline at end of file +var _0x3824=['then','error','message','catch','SendMail','bluebird','jayson/promise','client','http'];(function(_0x45367f,_0x2525a0){var _0x778927=function(_0x27e586){while(--_0x27e586){_0x45367f['push'](_0x45367f['shift']());}};_0x778927(++_0x2525a0);}(_0x3824,0xd4));var _0x4382=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x3824[_0x3186aa];return _0x2d8c36;};'use strict';var BPromise=require(_0x4382('0x0'));var jayson=require(_0x4382('0x1'));var client=jayson[_0x4382('0x2')][_0x4382('0x3')]({'port':0x232b});function request(_0x25d86c,_0xee445e){return new BPromise(function(_0x300a6e,_0xd58a2d){return client['request'](_0x25d86c,_0xee445e)[_0x4382('0x4')](function(_0xbc22e6){if(_0xbc22e6[_0x4382('0x5')]){return _0xd58a2d(_0xbc22e6[_0x4382('0x5')][_0x4382('0x6')]);}else{return _0x300a6e(_0xbc22e6['result']);}})[_0x4382('0x7')](function(_0xb069a3){return _0xd58a2d(_0xb069a3);});});}exports['sendMailMessage']=function(_0x77cb7b,_0x3dd592){return request(_0x4382('0x8'),{'account':_0x77cb7b,'message':_0x3dd592});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index c95329e..a5cd831 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab7f=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','traverseBFS','vertex','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','exports','lodash','moment','xml2json','../../config/logger','agi','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','root','stringify','format','info','callerid','dnid','uniqueid','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','toString','agicommand\x20not\x20found'];(function(_0x12511e,_0x451f7d){var _0x42471d=function(_0x4467a6){while(--_0x4467a6){_0x12511e['push'](_0x12511e['shift']());}};_0x42471d(++_0x451f7d);}(_0xab7f,0x1a2));var _0xfab7=function(_0x2dba6b,_0x349b3a){_0x2dba6b=_0x2dba6b-0x0;var _0x26004a=_0xab7f[_0x2dba6b];return _0x26004a;};'use strict';var _=require(_0xfab7('0x0'));var moment=require(_0xfab7('0x1'));var parser=require(_0xfab7('0x2'));var util=require('util');var logger=require(_0xfab7('0x3'))(_0xfab7('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xfab7('0x5')]()[_0xfab7('0x6')](function(_0x1b92ae){logger[_0xfab7('0x7')](_0xfab7('0x8'),_0x1b92ae[_0xfab7('0x9')]);return[];});}function addVertex(_0x4c1e5e,_0x507682,_0x1e5bc4){_0x507682[_0xfab7('0xa')]=_0x1e5bc4;if(_0x507682['hasOwnProperty'](_0xfab7('0xb'))){_0x507682[_0xfab7('0xc')]=parseInt(_0x507682[_0xfab7('0xb')],0xa);}_0x4c1e5e[_0xfab7('0xd')](_[_0xfab7('0xe')](_0x507682,_0xfab7('0xf')));}function initGraph(_0x3808f8,_0x3f4e80){var _0x5e58d5=new Graph();for(var _0x122d48 in _0x3808f8){if(_0x3808f8[_0xfab7('0x10')](_0x122d48)){if(_[_0xfab7('0x11')](_0x3808f8[_0x122d48])){for(var _0x158e2e=0x0;_0x158e2e<_0x3808f8[_0x122d48][_0xfab7('0x12')];_0x158e2e+=0x1){addVertex(_0x5e58d5,_0x3808f8[_0x122d48][_0x158e2e],_0x122d48);}}else{addVertex(_0x5e58d5,_0x3808f8[_0x122d48],_0x122d48);}}}for(var _0x1d273f=0x0;_0x1d273f<_0x3f4e80['length'];_0x1d273f+=0x1){if(_0x3f4e80[_0x1d273f][_0xfab7('0x13')]&&_0x3f4e80[_0x1d273f][_0xfab7('0x14')]){_0x5e58d5[_0xfab7('0x15')](_0x3f4e80[_0x1d273f]['source'],_0x3f4e80[_0x1d273f][_0xfab7('0x14')],_0x3f4e80[_0x1d273f][_0xfab7('0x16')]);}}return _0x5e58d5;}function getRoot(_0x1c1cf7){return parser[_0xfab7('0x17')](_0x1c1cf7,{'object':!![]})[_0xfab7('0x18')]['root'];}function inspect(_0x16b414){return util[_0xfab7('0x19')](_0x16b414,{'showHidden':![],'depth':null});}function initialize(_0x342f4a,_0x8c360d){var _0x320b89=getRoot(_0x342f4a[_0xfab7('0x1a')]);if(!_0x320b89||!_0x320b89[_0xfab7('0x1b')])return;var _0x2c13e9,_0x5c9c18,_0x101ded;logger[_0xfab7('0x1c')](_0xfab7('0x1d'),JSON[_0xfab7('0x1e')](_0x320b89,null,0x2));_0x8c360d['joinAt']=moment()[_0xfab7('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c13e9=initGraph(_[_0xfab7('0xe')](_0x320b89,_0xfab7('0xf')),_0x320b89['mxCell']);_0x5c9c18=new Vertices(_0x8c360d,rpc,mailRpc);logger[_0xfab7('0x20')](util[_0xfab7('0x1f')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x8c360d['arg_1'],_0x8c360d['calleridname'],_0x8c360d[_0xfab7('0x21')],_0x8c360d[_0xfab7('0x22')],_0x8c360d[_0xfab7('0x23')]));_0x2c13e9['traverseBFS'](_0x320b89['start']['id'],function(_0x44d561){try{_0x44d561=_0x5c9c18[_0xfab7('0x24')](_0x44d561);logger['debug']('vertex',JSON['stringify'](_0x44d561,null,0x2));if(_0x44d561[_0xfab7('0xa')]==='gotoc'){logger[_0xfab7('0x20')](_0xfab7('0x25'));_0x8c360d[_0xfab7('0x26')]=_0x44d561[_0xfab7('0x26')]||_0x8c360d[_0xfab7('0x26')];_0x8c360d[_0xfab7('0x27')]=_0x44d561[_0xfab7('0x27')];_0x8c360d[_0xfab7('0x28')]=_0x44d561[_0xfab7('0x28')]?_0x44d561[_0xfab7('0x28')]-0x1:0x1;return null;}else if(_0x44d561&&_0x5c9c18[_0x44d561['agicommand']]){_0x101ded=_0x5c9c18[_0x44d561[_0xfab7('0xa')]](_0x44d561);logger[_0xfab7('0x20')](_0xfab7('0x29'),JSON['stringify'](_0x101ded,null,0x2));if(_0x101ded&&_0x101ded['code']===AGI_CODE_SUCCESS&&_0x101ded[_0xfab7('0x2a')]!==AGI_RESULT_ERROR&&!_0x8c360d[_0xfab7('0x2b')]){logger[_0xfab7('0x1c')](_0xfab7('0x29'),inspect(_0x101ded));return _['isUndefined'](_0x101ded[_0xfab7('0x2a')])?null:_0x101ded[_0xfab7('0x2a')][_0xfab7('0x2c')]();}else{logger[_0xfab7('0x7')](_0xfab7('0x29'),inspect(_0x101ded));return null;}}else{logger[_0xfab7('0x7')](_0xfab7('0x2d'));return null;}}catch(_0x4f60fa){logger['error'](_0x4f60fa[_0xfab7('0x9')]);return null;}});if(_0x320b89[_0xfab7('0x2e')]){logger[_0xfab7('0x20')](util[_0xfab7('0x1f')](_0xfab7('0x2f'),_0x8c360d[_0xfab7('0x30')],_0x8c360d[_0xfab7('0x31')],_0x8c360d['callerid'],_0x8c360d['dnid'],_0x8c360d[_0xfab7('0x23')]));_0x2c13e9[_0xfab7('0x32')](_0x320b89[_0xfab7('0x2e')]['id'],function(_0x59ff19){try{_0x59ff19=_0x5c9c18['clear'](_0x59ff19);logger[_0xfab7('0x1c')](_0xfab7('0x33'),JSON[_0xfab7('0x1e')](_0x59ff19,null,0x2));if(_0x59ff19&&_0x5c9c18[_0x59ff19['agicommand']]){_0x101ded=_0x5c9c18[_0x59ff19['agicommand']](_0x59ff19);if(_0x101ded){logger['debug'](_0xfab7('0x29'),inspect(_0x101ded));return _[_0xfab7('0x34')](_0x101ded[_0xfab7('0x2a')])?null:_0x101ded[_0xfab7('0x2a')]['toString']();}else{logger[_0xfab7('0x7')](_0xfab7('0x29'),inspect(_0x101ded));return null;}}else{logger[_0xfab7('0x7')]('agicommand\x20not\x20found');return null;}}catch(_0x22ab8f){logger[_0xfab7('0x7')](_0x22ab8f[_0xfab7('0x9')]);return null;}});}logger['info'](util['format'](_0xfab7('0x35'),_0x8c360d[_0xfab7('0x30')],_0x8c360d[_0xfab7('0x31')],_0x8c360d[_0xfab7('0x21')],_0x8c360d[_0xfab7('0x22')],_0x8c360d[_0xfab7('0x23')]));logger[_0xfab7('0x20')](util[_0xfab7('0x1f')](_0xfab7('0x36'),_0x8c360d['context'],_0x8c360d[_0xfab7('0x27')],parseInt(_0x8c360d[_0xfab7('0x28')],0xa)+0x1));_0x8c360d[_0xfab7('0x37')](_0x8c360d[_0xfab7('0x26')],_0x8c360d[_0xfab7('0x27')],parseInt(_0x8c360d[_0xfab7('0x28')],0xa)+0x1);_0x8c360d[_0xfab7('0x38')]();}function handleNotFound(_0x43e799){logger['error'](util[_0xfab7('0x1f')]('Project\x20%s\x20not\x20found',_0x43e799[_0xfab7('0x30')]));_0x43e799[_0xfab7('0x37')](_0x43e799[_0xfab7('0x26')],_0x43e799[_0xfab7('0x27')],parseInt(_0x43e799['priority'],0xa)+0x1);_0x43e799[_0xfab7('0x38')]();}function handleUnpublished(_0x4793a3){logger[_0xfab7('0x7')](util[_0xfab7('0x1f')]('Project\x20%s\x20not\x20published',_0x4793a3[_0xfab7('0x30')]));_0x4793a3[_0xfab7('0x37')](_0x4793a3[_0xfab7('0x26')],_0x4793a3[_0xfab7('0x27')],parseInt(_0x4793a3[_0xfab7('0x28')],0xa)+0x1);_0x4793a3[_0xfab7('0x38')]();}module[_0xfab7('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x8a20=['Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','arg_1','callerid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8a20,0xba));var _0x08a2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8a20[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x08a2('0x0'));var moment=require(_0x08a2('0x1'));var parser=require(_0x08a2('0x2'));var util=require(_0x08a2('0x3'));var logger=require(_0x08a2('0x4'))(_0x08a2('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x08a2('0x6'));var Graph=require(_0x08a2('0x7'));var Vertices=require(_0x08a2('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x08a2('0x9')]()[_0x08a2('0xa')](function(_0x561346){logger[_0x08a2('0xb')](_0x08a2('0xc'),_0x561346[_0x08a2('0xd')]);return[];});}function addVertex(_0x56eb9f,_0x3ed5a5,_0x503348){_0x3ed5a5[_0x08a2('0xe')]=_0x503348;if(_0x3ed5a5[_0x08a2('0xf')](_0x08a2('0x10'))){_0x3ed5a5[_0x08a2('0x11')]=parseInt(_0x3ed5a5[_0x08a2('0x10')],0xa);}_0x56eb9f[_0x08a2('0x12')](_[_0x08a2('0x13')](_0x3ed5a5,_0x08a2('0x14')));}function initGraph(_0x3c6d91,_0x10d8ef){var _0x584dc9=new Graph();for(var _0x283637 in _0x3c6d91){if(_0x3c6d91[_0x08a2('0xf')](_0x283637)){if(_[_0x08a2('0x15')](_0x3c6d91[_0x283637])){for(var _0x4db6a1=0x0;_0x4db6a1<_0x3c6d91[_0x283637][_0x08a2('0x16')];_0x4db6a1+=0x1){addVertex(_0x584dc9,_0x3c6d91[_0x283637][_0x4db6a1],_0x283637);}}else{addVertex(_0x584dc9,_0x3c6d91[_0x283637],_0x283637);}}}for(var _0x3c6fc2=0x0;_0x3c6fc2<_0x10d8ef[_0x08a2('0x16')];_0x3c6fc2+=0x1){if(_0x10d8ef[_0x3c6fc2][_0x08a2('0x17')]&&_0x10d8ef[_0x3c6fc2][_0x08a2('0x18')]){_0x584dc9[_0x08a2('0x19')](_0x10d8ef[_0x3c6fc2][_0x08a2('0x17')],_0x10d8ef[_0x3c6fc2]['target'],_0x10d8ef[_0x3c6fc2][_0x08a2('0x1a')]);}}return _0x584dc9;}function getRoot(_0x11073d){return parser[_0x08a2('0x1b')](_0x11073d,{'object':!![]})[_0x08a2('0x1c')][_0x08a2('0x1d')];}function inspect(_0x2b7a55){return util[_0x08a2('0x1e')](_0x2b7a55,{'showHidden':![],'depth':null});}function initialize(_0x237b7e,_0x183e65){var _0x518bed=getRoot(_0x237b7e[_0x08a2('0x1f')]);if(!_0x518bed||!_0x518bed[_0x08a2('0x20')])return;var _0x11f4d9,_0x519280,_0x5e8447;logger[_0x08a2('0x21')](_0x08a2('0x1d'),JSON[_0x08a2('0x22')](_0x518bed,null,0x2));_0x183e65['joinAt']=moment()[_0x08a2('0x23')](_0x08a2('0x24'));_0x11f4d9=initGraph(_[_0x08a2('0x13')](_0x518bed,'mxCell'),_0x518bed[_0x08a2('0x14')]);_0x519280=new Vertices(_0x183e65,rpc,mailRpc);logger[_0x08a2('0x25')](util[_0x08a2('0x23')](_0x08a2('0x26'),_0x183e65['arg_1'],_0x183e65[_0x08a2('0x27')],_0x183e65['callerid'],_0x183e65[_0x08a2('0x28')],_0x183e65[_0x08a2('0x29')]));_0x11f4d9['traverseBFS'](_0x518bed[_0x08a2('0x20')]['id'],function(_0x266d7a){try{_0x266d7a=_0x519280[_0x08a2('0x2a')](_0x266d7a);logger[_0x08a2('0x21')]('vertex',JSON[_0x08a2('0x22')](_0x266d7a,null,0x2));if(_0x266d7a[_0x08a2('0xe')]==='gotoc'){logger[_0x08a2('0x25')](_0x08a2('0x2b'));_0x183e65[_0x08a2('0x2c')]=_0x266d7a[_0x08a2('0x2c')]||_0x183e65['context'];_0x183e65[_0x08a2('0x2d')]=_0x266d7a[_0x08a2('0x2d')];_0x183e65[_0x08a2('0x2e')]=_0x266d7a[_0x08a2('0x2e')]?_0x266d7a['priority']-0x1:0x1;return null;}else if(_0x266d7a&&_0x519280[_0x266d7a[_0x08a2('0xe')]]){_0x5e8447=_0x519280[_0x266d7a['agicommand']](_0x266d7a);logger[_0x08a2('0x25')](_0x08a2('0x2f'),JSON[_0x08a2('0x22')](_0x5e8447,null,0x2));if(_0x5e8447&&_0x5e8447[_0x08a2('0x30')]===AGI_CODE_SUCCESS&&_0x5e8447[_0x08a2('0x31')]!==AGI_RESULT_ERROR&&!_0x183e65['evtHangup']){logger['debug']('response',inspect(_0x5e8447));return _['isUndefined'](_0x5e8447[_0x08a2('0x31')])?null:_0x5e8447['result'][_0x08a2('0x32')]();}else{logger[_0x08a2('0xb')](_0x08a2('0x2f'),inspect(_0x5e8447));return null;}}else{logger[_0x08a2('0xb')](_0x08a2('0x33'));return null;}}catch(_0x3678fc){logger[_0x08a2('0xb')](_0x3678fc[_0x08a2('0xd')]);return null;}});if(_0x518bed[_0x08a2('0x34')]){logger['info'](util[_0x08a2('0x23')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x183e65[_0x08a2('0x35')],_0x183e65[_0x08a2('0x27')],_0x183e65[_0x08a2('0x36')],_0x183e65[_0x08a2('0x28')],_0x183e65['uniqueid']));_0x11f4d9['traverseBFS'](_0x518bed['finally']['id'],function(_0x12543c){try{_0x12543c=_0x519280[_0x08a2('0x2a')](_0x12543c);logger[_0x08a2('0x21')]('vertex',JSON[_0x08a2('0x22')](_0x12543c,null,0x2));if(_0x12543c&&_0x519280[_0x12543c[_0x08a2('0xe')]]){_0x5e8447=_0x519280[_0x12543c['agicommand']](_0x12543c);if(_0x5e8447){logger[_0x08a2('0x21')](_0x08a2('0x2f'),inspect(_0x5e8447));return _['isUndefined'](_0x5e8447[_0x08a2('0x31')])?null:_0x5e8447[_0x08a2('0x31')][_0x08a2('0x32')]();}else{logger['error'](_0x08a2('0x2f'),inspect(_0x5e8447));return null;}}else{logger[_0x08a2('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x4eb05f){logger[_0x08a2('0xb')](_0x4eb05f[_0x08a2('0xd')]);return null;}});}logger[_0x08a2('0x25')](util[_0x08a2('0x23')](_0x08a2('0x37'),_0x183e65['arg_1'],_0x183e65[_0x08a2('0x27')],_0x183e65[_0x08a2('0x36')],_0x183e65[_0x08a2('0x28')],_0x183e65['uniqueid']));logger['info'](util['format'](_0x08a2('0x38'),_0x183e65['context'],_0x183e65['extension'],parseInt(_0x183e65['priority'],0xa)+0x1));_0x183e65['continueAt'](_0x183e65[_0x08a2('0x2c')],_0x183e65['extension'],parseInt(_0x183e65['priority'],0xa)+0x1);_0x183e65[_0x08a2('0x39')]();}function handleNotFound(_0x3f7f50){logger[_0x08a2('0xb')](util['format'](_0x08a2('0x3a'),_0x3f7f50[_0x08a2('0x35')]));_0x3f7f50[_0x08a2('0x3b')](_0x3f7f50[_0x08a2('0x2c')],_0x3f7f50[_0x08a2('0x2d')],parseInt(_0x3f7f50['priority'],0xa)+0x1);_0x3f7f50[_0x08a2('0x39')]();}function handleUnpublished(_0xd7961){logger[_0x08a2('0xb')](util[_0x08a2('0x23')](_0x08a2('0x3c'),_0xd7961[_0x08a2('0x35')]));_0xd7961['continueAt'](_0xd7961[_0x08a2('0x2c')],_0xd7961['extension'],parseInt(_0xd7961['priority'],0xa)+0x1);_0xd7961['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index dc687eb..c6848a7 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 _0x5025=['exports','util','stream','call','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5025,0x177));var _0x5502=function(_0x3f4875,_0x1eee06){_0x3f4875=_0x3f4875-0x0;var _0x1727cf=_0x5025[_0x3f4875];return _0x1727cf;};'use strict';var util=require(_0x5502('0x0'));var Transform=require(_0x5502('0x1'))['Transform'];function AGIReply(_0x3142fc){Transform[_0x5502('0x2')](this,_0x3142fc);this['_localBuffer']='';this['_inBody']=![];}util[_0x5502('0x3')](AGIReply,Transform);AGIReply[_0x5502('0x4')][_0x5502('0x5')]=function(_0x3aeead,_0x1909dd,_0x1b4c66){var _0xf2f00c='\x0a',_0x14663f=['\x0a\x0a',_0x5502('0x6')],_0x5a476b=-0x1,_0x43bdfc=-0x1,_0x4adc7a='',_0x504756=0x0,_0x29bf89='',_0x2a0f7f='';this[_0x5502('0x7')]+=_0x3aeead['toString']();_0x29bf89=this[_0x5502('0x7')];if(!this[_0x5502('0x8')]){_0x504756=0x0;while(_0x14663f[_0x504756]){while((_0x43bdfc=_0x29bf89[_0x5502('0x9')](_0x14663f[_0x504756]))!=-0x1){_0x4adc7a=_0x14663f[_0x504756];_0x2a0f7f=_0x29bf89['substring'](0x0,_0x43bdfc);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x43bdfc+_0x4adc7a[_0x5502('0xb')]);var _0x5d0261=_0x2a0f7f[_0x5502('0xc')](_0xf2f00c),_0x1dc31a=0x0,_0x5ebf28={},_0x2c4a92='',_0x27ab63='',_0xc13729=-0x1;while(_0x5d0261[_0x1dc31a]){_0xc13729=_0x5d0261[_0x1dc31a][_0x5502('0x9')](':');if(_0xc13729!=-0x1){_0x2c4a92=_0x5d0261[_0x1dc31a][_0x5502('0xd')](0x0,_0xc13729)['trim']();_0x27ab63=_0x5d0261[_0x1dc31a][_0x5502('0xd')](_0xc13729+0x1)[_0x5502('0xe')]();if(_0x2c4a92[_0x5502('0xb')]>0x0){_0x5ebf28[_0x2c4a92]=_0x27ab63;}}else{}_0x1dc31a++;}this['emit']('headers',_0x5ebf28);this['_inBody']=!![];}_0x504756++;}this[_0x5502('0x7')]=_0x29bf89;}else{while((_0x5a476b=_0x29bf89['indexOf'](_0xf2f00c))!=-0x1){_0x2a0f7f=_0x29bf89[_0x5502('0xa')](0x0,_0x5a476b);this[_0x5502('0xf')]('line',_0x2a0f7f);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x5a476b+_0xf2f00c[_0x5502('0xb')]);}this[_0x5502('0x7')]=_0x29bf89;}_0x1b4c66();};module[_0x5502('0x10')]=AGIReply; \ No newline at end of file +var _0x930e=['indexOf','trim','slice','length','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','split'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x930e,0x66));var _0xe930=function(_0x38930b,_0x6e19f8){_0x38930b=_0x38930b-0x0;var _0x5ae224=_0x930e[_0x38930b];return _0x5ae224;};'use strict';var util=require(_0xe930('0x0'));var Transform=require(_0xe930('0x1'))[_0xe930('0x2')];function AGIReply(_0x543103){Transform[_0xe930('0x3')](this,_0x543103);this[_0xe930('0x4')]='';this[_0xe930('0x5')]=![];}util[_0xe930('0x6')](AGIReply,Transform);AGIReply[_0xe930('0x7')][_0xe930('0x8')]=function(_0x552b00,_0x39bdcc,_0x3ddc5d){var _0x2ea589='\x0a',_0x453cf7=['\x0a\x0a',_0xe930('0x9')],_0xf524f2=-0x1,_0x5b3f10=-0x1,_0x4043ee='',_0x1f19eb=0x0,_0x4985d4='',_0x2403a4='';this[_0xe930('0x4')]+=_0x552b00['toString']();_0x4985d4=this[_0xe930('0x4')];if(!this['_inBody']){_0x1f19eb=0x0;while(_0x453cf7[_0x1f19eb]){while((_0x5b3f10=_0x4985d4['indexOf'](_0x453cf7[_0x1f19eb]))!=-0x1){_0x4043ee=_0x453cf7[_0x1f19eb];_0x2403a4=_0x4985d4[_0xe930('0xa')](0x0,_0x5b3f10);_0x4985d4=_0x4985d4[_0xe930('0xa')](_0x5b3f10+_0x4043ee['length']);var _0x4b6726=_0x2403a4[_0xe930('0xb')](_0x2ea589),_0x2375b8=0x0,_0x529d20={},_0x5e56e8='',_0x5f58e6='',_0xf126a6=-0x1;while(_0x4b6726[_0x2375b8]){_0xf126a6=_0x4b6726[_0x2375b8][_0xe930('0xc')](':');if(_0xf126a6!=-0x1){_0x5e56e8=_0x4b6726[_0x2375b8]['slice'](0x0,_0xf126a6)[_0xe930('0xd')]();_0x5f58e6=_0x4b6726[_0x2375b8][_0xe930('0xe')](_0xf126a6+0x1)['trim']();if(_0x5e56e8[_0xe930('0xf')]>0x0){_0x529d20[_0x5e56e8]=_0x5f58e6;}}else{}_0x2375b8++;}this[_0xe930('0x10')]('headers',_0x529d20);this['_inBody']=!![];}_0x1f19eb++;}this[_0xe930('0x4')]=_0x4985d4;}else{while((_0xf524f2=_0x4985d4[_0xe930('0xc')](_0x2ea589))!=-0x1){_0x2403a4=_0x4985d4[_0xe930('0xa')](0x0,_0xf524f2);this[_0xe930('0x10')](_0xe930('0x11'),_0x2403a4);_0x4985d4=_0x4985d4[_0xe930('0xa')](_0xf524f2+_0x2ea589[_0xe930('0xf')]);}this['_localBuffer']=_0x4985d4;}_0x3ddc5d();};module[_0xe930('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7dec2e2..69ce77f 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 _0x1cc7=['Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval'];(function(_0x4c79aa,_0x456fcd){var _0x28e73a=function(_0x2f9084){while(--_0x2f9084){_0x4c79aa['push'](_0x4c79aa['shift']());}};_0x28e73a(++_0x456fcd);}(_0x1cc7,0x15a));var _0x71cc=function(_0x158831,_0x3dbddd){_0x158831=_0x158831-0x0;var _0x31e2fd=_0x1cc7[_0x158831];return _0x31e2fd;};'use strict';var _=require(_0x71cc('0x0'));var moment=require(_0x71cc('0x1'));var jayson=require(_0x71cc('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x547fe6,_0xe5d54e){return new Promise(function(_0x1fac93,_0x402191){return client['request'](_0x547fe6,_0xe5d54e)['then'](function(_0x47ec3b){if(_0x47ec3b[_0x71cc('0x3')]){return _0x402191(_0x47ec3b['error'][_0x71cc('0x4')]);}else{return _0x1fac93(_0x47ec3b[_0x71cc('0x5')]);}})[_0x71cc('0x6')](function(_0x2e70f0){return _0x402191(_0x2e70f0);});});}exports[_0x71cc('0x7')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x71cc('0x8'),_0x71cc('0x9')]}});};exports[_0x71cc('0xa')]=function(_0x5ae8e7){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5ae8e7},'attributes':['production']}});};exports['getMailAccountById']=function(_0xeb4747){return request(_0x71cc('0xb'),{'options':{'raw':![],'where':{'id':_0xeb4747},'include':[{'model':_0x71cc('0xc'),'as':'Smtp','include':[{'model':_0x71cc('0xd'),'as':'CloudProvider'}]}],'attributes':['id',_0x71cc('0x8'),'email'],'smtp':!![]}});};exports[_0x71cc('0xe')]=function(_0x5afe4f){return request(_0x71cc('0xf'),{'options':{'where':{'id':_0x5afe4f},'attributes':[_0x71cc('0x8')]}});};exports[_0x71cc('0x10')]=function(_0xd16032){return request(_0x71cc('0x11'),{'options':{'where':{'id':_0xd16032},'attributes':['name']}});};exports[_0x71cc('0x12')]=function(_0x292d0c){return request(_0x71cc('0x13'),{'options':{'where':{'id':_0x292d0c},'attributes':[_0x71cc('0x8')]}});};exports[_0x71cc('0x14')]=function(_0x14087c){return request(_0x71cc('0x15'),{'options':{'where':{'id':_0x14087c},'attributes':['dsn']}});};exports[_0x71cc('0x16')]=function(_0x14788d){return request(_0x71cc('0x17'),{'options':{'where':{'id':_0x14788d},'attributes':[_0x71cc('0x8')]}});};exports[_0x71cc('0x18')]=function(_0x10da0a){return request('GetContactByPhone',{'options':{'where':{'phone':_0x10da0a[_0x71cc('0x19')]},'attributes':['id']}});};exports[_0x71cc('0x1a')]=function(_0x4fc0a9){return request('ShowTrunk',{'options':{'where':{'id':_0x4fc0a9},'attributes':[_0x71cc('0x8')]}});};exports[_0x71cc('0x1b')]=function(_0x1612f1){return request(_0x71cc('0x1c'),{'options':{'where':{'id':_0x1612f1},'attributes':[_0x71cc('0x1d')]}});};exports[_0x71cc('0x1e')]=function(_0x363ecb){return request(_0x71cc('0x1f'),{'options':{'raw':![],'where':{'id':_0x363ecb},'include':[{'model':'Interval','as':_0x71cc('0x20')}]}});};exports[_0x71cc('0x21')]=function(_0x587a0b){return request(_0x71cc('0x22'),{'options':{'where':{'id':_0x587a0b},'attributes':['id',_0x71cc('0x8')]}});};exports[_0x71cc('0x23')]=function(_0x1a9b4f){return request(_0x71cc('0x24'),{'body':_0x1a9b4f});};exports[_0x71cc('0x25')]=function(_0x4a0abc){return request(_0x71cc('0x26'),{'body':_0x4a0abc});};exports[_0x71cc('0x27')]=function(_0x446580){return request(_0x71cc('0x28'),{'body':_[_0x71cc('0x29')](_0x446580,{'project_name':_0x446580[_0x71cc('0x2a')],'prev_project_name':_0x446580[_0x71cc('0x2b')]||'','is_subproject':_0x446580[_0x71cc('0x2b')]?!![]:![],'leaveAt':moment()[_0x71cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x71cc('0x2d')]=function(_0x43c155){return request(_0x71cc('0x2e'),{'body':_0x43c155});};exports[_0x71cc('0x2f')]=function(_0x20b093){return request(_0x71cc('0x30'),{'body':_0x20b093});};exports[_0x71cc('0x31')]=function(_0x9a7ca3){return request(_0x71cc('0x32'),{'options':{'raw':![],'where':{'phone':_0x9a7ca3[_0x71cc('0x19')],'ListId':_0x9a7ca3[_0x71cc('0x33')]}}})[_0x71cc('0x34')](function(_0x1d5805){if(_0x1d5805){return _0x1d5805;}return request(_0x71cc('0x35'),{'body':_0x9a7ca3});});};exports[_0x71cc('0x36')]=function(_0x5fa0e0){return request('ShowPause',{'options':{'where':{'id':_0x5fa0e0},'attributes':[_0x71cc('0x8')]}});};exports[_0x71cc('0x37')]=function(_0x34c6bc,_0x184a51){return request(_0x71cc('0x38'),{'body':{'interface':_0x184a51},'options':{'where':_0x34c6bc}});};exports[_0x71cc('0x39')]=function(_0x4a44c1,_0x3110e3,_0x11bd4e){return request(_0x71cc('0x3a'),{'body':{'type':_0x3110e3,'uniqueid':_0x11bd4e},'options':{'where':_0x4a44c1}});};exports[_0x71cc('0x3b')]=function(_0x3b11ba){return request(_0x71cc('0x3c'),{'body':{},'options':{'where':_0x3b11ba}});};exports[_0x71cc('0x3d')]=function(_0x4eed9f){return request(_0x71cc('0x3e'),{'body':{},'options':{'where':_0x4eed9f}});}; \ No newline at end of file +var _0x8388=['dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','error','message','result','catch','getSquareProjects','production','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0x8388,0x18d));var _0x8838=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x8388[_0x46a3e8];return _0xf1442e;};'use strict';var _=require(_0x8838('0x0'));var moment=require(_0x8838('0x1'));var jayson=require(_0x8838('0x2'));var client=jayson[_0x8838('0x3')]['http']({'port':0x2329});function request(_0x140ee6,_0x3dbcd4){return new Promise(function(_0x316297,_0x20a813){return client[_0x8838('0x4')](_0x140ee6,_0x3dbcd4)['then'](function(_0x303377){if(_0x303377[_0x8838('0x5')]){return _0x20a813(_0x303377['error'][_0x8838('0x6')]);}else{return _0x316297(_0x303377[_0x8838('0x7')]);}})[_0x8838('0x8')](function(_0x56596f){return _0x20a813(_0x56596f);});});}exports[_0x8838('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x8838('0xa')]}});};exports['getSquareProject']=function(_0x4aedc9){return request(_0x8838('0xb'),{'options':{'raw':![],'where':{'name':_0x4aedc9},'attributes':[_0x8838('0xa')]}});};exports[_0x8838('0xc')]=function(_0x35096b){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x35096b},'include':[{'model':_0x8838('0xd'),'as':_0x8838('0xe'),'include':[{'model':_0x8838('0xf'),'as':_0x8838('0xf')}]}],'attributes':['id','name',_0x8838('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x530bac){return request(_0x8838('0xb'),{'options':{'where':{'id':_0x530bac},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x12')]=function(_0x43b446){return request(_0x8838('0x13'),{'options':{'where':{'id':_0x43b446},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x14')]=function(_0x8daaab){return request('ShowVariable',{'options':{'where':{'id':_0x8daaab},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x15')]=function(_0x5eecf2){return request(_0x8838('0x16'),{'options':{'where':{'id':_0x5eecf2},'attributes':[_0x8838('0x17')]}});};exports[_0x8838('0x18')]=function(_0x4d0c2e){return request(_0x8838('0x19'),{'options':{'where':{'id':_0x4d0c2e},'attributes':['name']}});};exports[_0x8838('0x1a')]=function(_0x204120){return request(_0x8838('0x1b'),{'options':{'where':{'phone':_0x204120['phone']},'attributes':['id']}});};exports[_0x8838('0x1c')]=function(_0x7b836e){return request('ShowTrunk',{'options':{'where':{'id':_0x7b836e},'attributes':[_0x8838('0x11')]}});};exports[_0x8838('0x1d')]=function(_0x4c5bed){return request(_0x8838('0x1e'),{'options':{'where':{'id':_0x4c5bed},'attributes':[_0x8838('0x1f')]}});};exports['getIntervalById']=function(_0x55ccbc){return request(_0x8838('0x20'),{'options':{'raw':![],'where':{'id':_0x55ccbc},'include':[{'model':_0x8838('0x21'),'as':_0x8838('0x22')}]}});};exports[_0x8838('0x23')]=function(_0x109341){return request(_0x8838('0x24'),{'options':{'where':{'id':_0x109341},'attributes':['id',_0x8838('0x11')]}});};exports[_0x8838('0x25')]=function(_0x46b603){return request('CreateSmsMessage',{'body':_0x46b603});};exports[_0x8838('0x26')]=function(_0x584779){return request(_0x8838('0x27'),{'body':_0x584779});};exports[_0x8838('0x28')]=function(_0x4c58a1){return request('CreateSquareReport',{'body':_[_0x8838('0x29')](_0x4c58a1,{'project_name':_0x4c58a1[_0x8838('0x2a')],'prev_project_name':_0x4c58a1[_0x8838('0x2b')]||'','is_subproject':_0x4c58a1[_0x8838('0x2b')]?!![]:![],'leaveAt':moment()[_0x8838('0x2c')](_0x8838('0x2d'))})});};exports[_0x8838('0x2e')]=function(_0x1fe141){return request(_0x8838('0x2f'),{'body':_0x1fe141});};exports[_0x8838('0x30')]=function(_0x5921eb){return request('CreateSquareMessage',{'body':_0x5921eb});};exports[_0x8838('0x31')]=function(_0x52907a){return request(_0x8838('0x32'),{'options':{'raw':![],'where':{'phone':_0x52907a[_0x8838('0x33')],'ListId':_0x52907a['ListId']}}})['then'](function(_0x2ac2b1){if(_0x2ac2b1){return _0x2ac2b1;}return request('CreateCmContact',{'body':_0x52907a});});};exports['getPauseById']=function(_0x1b605d){return request(_0x8838('0x34'),{'options':{'where':{'id':_0x1b605d},'attributes':['name']}});};exports[_0x8838('0x35')]=function(_0x296ba1,_0x4d8007){return request(_0x8838('0x36'),{'body':{'interface':_0x4d8007},'options':{'where':_0x296ba1}});};exports[_0x8838('0x37')]=function(_0x229aef,_0xdd28e2,_0x508ed4){return request(_0x8838('0x38'),{'body':{'type':_0xdd28e2,'uniqueid':_0x508ed4},'options':{'where':_0x229aef}});};exports[_0x8838('0x39')]=function(_0x4a263b){return request('UnpauseUser',{'body':{},'options':{'where':_0x4a263b}});};exports[_0x8838('0x3a')]=function(_0x5f5890){return request(_0x8838('0x3b'),{'body':{},'options':{'where':_0x5f5890}});}; \ 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 7335129..83cd1d5 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 _0xd69e=['exports','./polly','./lex'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xd69e,0xa0));var _0xed69=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xd69e[_0x4a53d];return _0x27410e;};var polly=require(_0xed69('0x0'));var lex=require(_0xed69('0x1'));module[_0xed69('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5fab=['./lex','./polly'];(function(_0x195e46,_0x37e025){var _0x17a5b0=function(_0x182d18){while(--_0x182d18){_0x195e46['push'](_0x195e46['shift']());}};_0x17a5b0(++_0x37e025);}(_0x5fab,0x177));var _0xb5fa=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0x5fab[_0x388914];return _0x1f9111;};var polly=require(_0xb5fa('0x0'));var lex=require(_0xb5fa('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index abcbc85..068c332 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237){return lex(_0x1ffbbf,_0x18bf2d,_0x26844b,_0x1ba0bb,_0x455700,_0x2ad237);}; \ No newline at end of file +var _0xd64b=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd64b,0xc1));var _0xbd64=function(_0x36f3df,_0x2b1621){_0x36f3df=_0x36f3df-0x0;var _0xcfb7b7=_0xd64b[_0x36f3df];return _0xcfb7b7;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ 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 ed5e149..33a756b 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 _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x550f71,_0xd143d1){var _0x3d07d4=function(_0x156b7a){while(--_0x156b7a){_0x550f71['push'](_0x550f71['shift']());}};_0x3d07d4(++_0xd143d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x11772a,_0x30ae74){var _0xb540e7=function(_0x13be0f){while(--_0x13be0f){_0x11772a['push'](_0x11772a['shift']());}};_0xb540e7(++_0x30ae74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ 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 399d57d..acc55ca 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 _0x0049=['exports'];(function(_0x28e25e,_0x29f62b){var _0x552700=function(_0x57c0a2){while(--_0x57c0a2){_0x28e25e['push'](_0x28e25e['shift']());}};_0x552700(++_0x29f62b);}(_0x0049,0x1e8));var _0x9004=function(_0x27f9be,_0x268da6){_0x27f9be=_0x27f9be-0x0;var _0x3783a6=_0x0049[_0x27f9be];return _0x3783a6;};'use strict';var polly=require('./lib/api');module[_0x9004('0x0')]=function(_0x1f343b,_0x4072e2,_0x190eaf,_0x4d2559,_0x392dae,_0x116fa9,_0x1c7e10){return polly(_0x1f343b,_0x4072e2,_0x190eaf,_0x4d2559,_0x392dae,_0x116fa9,_0x1c7e10);}; \ No newline at end of file +var _0x041b=['exports','./lib/api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x041b,0x1e5));var _0xb041=function(_0x57d1bd,_0x5d43ad){_0x57d1bd=_0x57d1bd-0x0;var _0x2f943d=_0x041b[_0x57d1bd];return _0x2f943d;};'use strict';var polly=require(_0xb041('0x0'));module[_0xb041('0x1')]=function(_0x3e661f,_0x58f782,_0x578c57,_0x518814,_0x1a2b55,_0x7f19b8,_0x59ce37){return polly(_0x3e661f,_0x58f782,_0x578c57,_0x518814,_0x1a2b55,_0x7f19b8,_0x59ce37);}; \ 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 a68d683..ff6a871 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 _0x91d8=['mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','text'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0x91d8,0x189));var _0x891d=function(_0x259d6f,_0x5b1cd1){_0x259d6f=_0x259d6f-0x0;var _0x1b4c1b=_0x91d8[_0x259d6f];return _0x1b4c1b;};'use strict';var fs=require('fs');var path=require(_0x891d('0x0'));var BPromise=require('bluebird');var rs=require(_0x891d('0x1'));var AWS=require(_0x891d('0x2'));function pollyResult(_0x35f4c8,_0x469b8e,_0x215888){return new BPromise(function(_0x4f9fb9,_0x269e70){_0x35f4c8[_0x891d('0x3')](_0x469b8e,function(_0x4737aa,_0x46a041){if(_0x4737aa){_0x269e70(_0x4737aa);}else if(_0x46a041){if(_0x46a041[_0x891d('0x4')]instanceof Buffer){fs[_0x891d('0x5')](_0x215888,_0x46a041[_0x891d('0x4')],function(_0x473846){if(_0x473846){_0x269e70(_0x473846);}else{_0x4f9fb9();}});}else{_0x269e70(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x269e70(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x179f75,_0x497214,_0x1c6988,_0x3f27c9,_0x4ec10a,_0x3ab44f,_0x3e75bb){var _0x3743f4=new AWS['Polly']({'accessKeyId':_0x179f75,'secretAccessKey':_0x497214,'region':_0x1c6988});var _0x16e1a7={'Text':_0x4ec10a,'TextType':_0x3ab44f||_0x891d('0x6'),'OutputFormat':_0x891d('0x7'),'VoiceId':_0x3f27c9};return pollyResult(_0x3743f4,_0x16e1a7,_0x3e75bb);}; \ No newline at end of file +var _0xeebc=['Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3e26cf,_0x39943d){var _0x258d3c=function(_0x4faf7e){while(--_0x4faf7e){_0x3e26cf['push'](_0x3e26cf['shift']());}};_0x258d3c(++_0x39943d);}(_0xeebc,0x189));var _0xceeb=function(_0x42938c,_0x254ff8){_0x42938c=_0x42938c-0x0;var _0x372571=_0xeebc[_0x42938c];return _0x372571;};'use strict';var fs=require('fs');var path=require(_0xceeb('0x0'));var BPromise=require(_0xceeb('0x1'));var rs=require(_0xceeb('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3e878b,_0x89dc88,_0x55c3da){return new BPromise(function(_0x5a11b0,_0xdff1b){_0x3e878b[_0xceeb('0x3')](_0x89dc88,function(_0x5b11df,_0x21e097){if(_0x5b11df){_0xdff1b(_0x5b11df);}else if(_0x21e097){if(_0x21e097[_0xceeb('0x4')]instanceof Buffer){fs[_0xceeb('0x5')](_0x55c3da,_0x21e097[_0xceeb('0x4')],function(_0x3a606e){if(_0x3a606e){_0xdff1b(_0x3a606e);}else{_0x5a11b0();}});}else{_0xdff1b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xdff1b(new Error(_0xceeb('0x6')));}});});}module['exports']=function(_0x200efe,_0x12e1ca,_0x169ef4,_0x580f9b,_0x3b8be7,_0x20e309,_0x53c1db){var _0x3aa7af=new AWS[(_0xceeb('0x7'))]({'accessKeyId':_0x200efe,'secretAccessKey':_0x12e1ca,'region':_0x169ef4});var _0x1ce8d5={'Text':_0x3b8be7,'TextType':_0x20e309||_0xceeb('0x8'),'OutputFormat':_0xceeb('0x9'),'VoiceId':_0x580f9b};return pollyResult(_0x3aa7af,_0x1ce8d5,_0x53c1db);}; \ 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 38d4962..53a27a3 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 _0x028b=['./lib/api'];(function(_0x1ec03a,_0x7e327c){var _0x467c39=function(_0x4423cf){while(--_0x4423cf){_0x1ec03a['push'](_0x1ec03a['shift']());}};_0x467c39(++_0x7e327c);}(_0x028b,0x13e));var _0xb028=function(_0x306613,_0x2b7123){_0x306613=_0x306613-0x0;var _0x291ae3=_0x028b[_0x306613];return _0x291ae3;};'use strict';var asr=require(_0xb028('0x0'));module['exports']=function(_0x9cc47e,_0x59a392,_0x3b808c,_0x237a1f){return asr(_0x9cc47e,_0x59a392,_0x3b808c);}; \ No newline at end of file +var _0x15c7=['exports','./lib/api'];(function(_0x52ca7a,_0x3d33c3){var _0x575fd0=function(_0x5142dc){while(--_0x5142dc){_0x52ca7a['push'](_0x52ca7a['shift']());}};_0x575fd0(++_0x3d33c3);}(_0x15c7,0x87));var _0x715c=function(_0x258912,_0x278937){_0x258912=_0x258912-0x0;var _0x1b3840=_0x15c7[_0x258912];return _0x1b3840;};'use strict';var asr=require(_0x715c('0x0'));module[_0x715c('0x1')]=function(_0x4be1cb,_0x4f19b3,_0x5ed378,_0x750555){return asr(_0x4be1cb,_0x4f19b3,_0x5ed378);}; \ 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 67ed071..c27a9de 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 _0x9de3=['url','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x48e885,_0x1b7f8a){var _0x3830a4=function(_0x27a583){while(--_0x27a583){_0x48e885['push'](_0x48e885['shift']());}};_0x3830a4(++_0x1b7f8a);}(_0x9de3,0xea));var _0x39de=function(_0x379e78,_0x87d91e){_0x379e78=_0x379e78-0x0;var _0x30cff5=_0x9de3[_0x379e78];return _0x30cff5;};'use strict';var url=require(_0x39de('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x39de('0x1');module[_0x39de('0x2')]=function(_0x33c312,_0x4f43f9,_0x3c8483){return new BPromise(function(_0x515fba,_0x1010da){var _0x433e79;if(typeof _0x33c312!==_0x39de('0x3')||_0x33c312[_0x39de('0x4')]===0x0){return _0x1010da('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4f43f9!==_0x39de('0x3')||_0x4f43f9[_0x39de('0x4')]===0x0){return _0x1010da(_0x39de('0x5'));}if(typeof _0x3c8483!==_0x39de('0x6')&&(typeof _0x3c8483!==_0x39de('0x3')||_0x3c8483['length']===0x0)){return _0x1010da('lang\x20should\x20be\x20a\x20string');}try{_0x433e79=fs['readFileSync'](_0x33c312)[_0x39de('0x7')](_0x39de('0x8'));}catch(_0x3e92d9){return _0x1010da(_0x3e92d9);}return _0x515fba({'method':_0x39de('0x9'),'uri':host+_0x39de('0xa')+_0x4f43f9,'body':{'config':{'encoding':_0x39de('0xb'),'sampleRateHertz':_0x39de('0xc'),'languageCode':_0x3c8483},'audio':{'content':_0x433e79}},'json':!![]});});}; \ No newline at end of file +var _0x0a9a=['POST','8000','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0a9a,0x183));var _0xa0a9=function(_0xfba51c,_0x349204){_0xfba51c=_0xfba51c-0x0;var _0x105686=_0x0a9a[_0xfba51c];return _0x105686;};'use strict';var url=require('url');var BPromise=require(_0xa0a9('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xa0a9('0x1')]=function(_0x3cff22,_0x34801b,_0x49162f){return new BPromise(function(_0x4ba993,_0x317a94){var _0x360be5;if(typeof _0x3cff22!=='string'||_0x3cff22[_0xa0a9('0x2')]===0x0){return _0x317a94(_0xa0a9('0x3'));}if(typeof _0x34801b!==_0xa0a9('0x4')||_0x34801b[_0xa0a9('0x2')]===0x0){return _0x317a94('key\x20should\x20be\x20a\x20string');}if(typeof _0x49162f!==_0xa0a9('0x5')&&(typeof _0x49162f!=='string'||_0x49162f[_0xa0a9('0x2')]===0x0)){return _0x317a94(_0xa0a9('0x6'));}try{_0x360be5=fs[_0xa0a9('0x7')](_0x3cff22)[_0xa0a9('0x8')]('base64');}catch(_0x2ba0ac){return _0x317a94(_0x2ba0ac);}return _0x4ba993({'method':_0xa0a9('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x34801b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xa0a9('0xa'),'languageCode':_0x49162f},'audio':{'content':_0x360be5}},'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 49c2609..1c16a6d 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 _0xecbe=['exports'];(function(_0x127bb2,_0x849c5f){var _0x596034=function(_0x307a4c){while(--_0x307a4c){_0x127bb2['push'](_0x127bb2['shift']());}};_0x596034(++_0x849c5f);}(_0xecbe,0x1d9));var _0xeecb=function(_0x3e2d49,_0x29b1ea){_0x3e2d49=_0x3e2d49-0x0;var _0x47f51b=_0xecbe[_0x3e2d49];return _0x47f51b;};var asr=require('./asr');module[_0xeecb('0x0')]={'asr':asr}; \ No newline at end of file +var _0xf652=['./asr','exports'];(function(_0x2f37ea,_0x16d608){var _0x331762=function(_0x2bc195){while(--_0x2bc195){_0x2f37ea['push'](_0x2f37ea['shift']());}};_0x331762(++_0x16d608);}(_0xf652,0x90));var _0x2f65=function(_0x33b4ec,_0x3e1117){_0x33b4ec=_0x33b4ec-0x0;var _0x3c25d4=_0xf652[_0x33b4ec];return _0x3c25d4;};var asr=require(_0x2f65('0x0'));module[_0x2f65('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a4ebcd9..1f03ec1 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 _0x2da8=['endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20transcription','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','dialogflow','https','path','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish\x20download\x20file','unlink','download\x20error','end','protocol','get','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','chmodSync','googleCloudTTS\x20path','utf8','POST','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','googleDialogflow','textRequest','result','source','action','speech','score','status','metadata'];(function(_0x2d41ea,_0x13f5cc){var _0x57a65b=function(_0x3da55a){while(--_0x3da55a){_0x2d41ea['push'](_0x2d41ea['shift']());}};_0x57a65b(++_0x13f5cc);}(_0x2da8,0x124));var _0x82da=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2da8[_0x4a9fb1];return _0x348672;};'use strict';var apiai=require(_0x82da('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x82da('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x82da('0x2'));var md5=require('md5');var path=require(_0x82da('0x3'));var querystring=require('querystring');var rp=require(_0x82da('0x4'));var rs=require(_0x82da('0x5'));var sox=require(_0x82da('0x6'));var tts=require(_0x82da('0x7'));var urlParse=require('url')[_0x82da('0x8')];var util=require(_0x82da('0x9'));var aws=require(_0x82da('0xa'));var google=require(_0x82da('0xb'));var sestek=require('./sestek');var tilde=require(_0x82da('0xc'));var logger=require('../../../config/logger')(_0x82da('0xd'));var ISPEECH_API=_0x82da('0xe');function downloadFile(_0x5e5c57,_0x574790){return new BPromise(function(_0xb85ce3,_0x3ee9d6){var _0x500252=urlParse(_0x5e5c57);var _0x5f2e17=_0x500252['protocol']===_0x82da('0xf')?https:http;var _0x5f48f8={'host':_0x500252[_0x82da('0x10')],'path':_0x500252['path'],'headers':{'user-agent':_0x82da('0x11')}};_0x5f2e17['get'](_0x5f48f8,function(_0x5eb4fb){if(_0x5eb4fb['statusCode']!==0xc8){logger[_0x82da('0x12')](_0x82da('0x13')+_0x5e5c57+_0x82da('0x14')+_0x5eb4fb[_0x82da('0x15')]+'\x20('+_0x5eb4fb[_0x82da('0x16')]+')');_0x3ee9d6(new Error('request\x20to\x20'+_0x5e5c57+_0x82da('0x14')+_0x5eb4fb[_0x82da('0x15')]+'\x20('+_0x5eb4fb[_0x82da('0x16')]+')'));return;}var _0x3bb277=fs['createWriteStream'](_0x574790);_0x3bb277['on']('finish',function(){logger['info'](_0x82da('0x17'));_0x3bb277['close'](_0xb85ce3);});_0x3bb277['on'](_0x82da('0x12'),function(_0x359c5c){fs[_0x82da('0x18')](_0x574790);logger['error'](_0x82da('0x19'),_0x359c5c);_0x3ee9d6(_0x359c5c);});_0x5eb4fb['pipe'](_0x3bb277);})['on'](_0x82da('0x12'),function(_0x29a87a){logger[_0x82da('0x12')](_0x29a87a);_0x3ee9d6(_0x29a87a);})[_0x82da('0x1a')]();});}function uploadFile(_0x572cd9){return new BPromise(function(_0x55ee52,_0x5c1486){var _0x99964b=urlParse(_0x572cd9);var _0x3ed28b=_0x99964b[_0x82da('0x1b')]===_0x82da('0xf')?https:http;var _0x362d5f={'host':_0x99964b[_0x82da('0x10')],'path':_0x99964b[_0x82da('0x3')],'headers':{'user-agent':_0x82da('0x11')}};_0x3ed28b[_0x82da('0x1c')](_0x362d5f,function(_0x3e54fe){if(_0x3e54fe[_0x82da('0x15')]!==0xc8){_0x5c1486(new Error(_0x82da('0x13')+_0x572cd9+_0x82da('0x14')+_0x3e54fe[_0x82da('0x15')]+'\x20('+_0x3e54fe[_0x82da('0x16')]+')'));return;}var _0x90866='';_0x3e54fe['on'](_0x82da('0x1d'),function(_0x3a00fc){_0x90866+=_0x3a00fc;});_0x3e54fe['on'](_0x82da('0x1a'),function(){_0x55ee52(_0x90866);});})['on'](_0x82da('0x12'),function(_0x5b111e){_0x5c1486(_0x5b111e);})[_0x82da('0x1a')]();});}function convertFile(_0x584285,_0x1b7d29){return new BPromise(function(_0x465077,_0x5ae049){var _0x1ffdeb=sox[_0x82da('0x1e')](_0x584285,_0x1b7d29,{'sampleRate':0x1f40,'format':_0x82da('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ffdeb['on'](_0x82da('0x12'),function(_0x3861f3){logger[_0x82da('0x12')](_0x82da('0x20'),_0x3861f3);_0x5ae049(_0x3861f3);});_0x1ffdeb['on'](_0x82da('0x1a'),function(){logger[_0x82da('0x21')](_0x82da('0x22'));_0x465077();});_0x1ffdeb[_0x82da('0x23')]();});}function base64Decode(_0x4ad5e5,_0x1ac2f5){var _0x2decf7=path[_0x82da('0x24')](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x27'));fs[_0x82da('0x28')](_0x2decf7,_0x4ad5e5,'base64');return convertFile(_0x2decf7,_0x1ac2f5)[_0x82da('0x29')](function(){try{fs[_0x82da('0x18')](_0x2decf7);fs['chmodSync'](_0x1ac2f5,_0x82da('0x2a'));}catch(_0x21b43d){logger[_0x82da('0x12')](_0x21b43d);}return _0x1ac2f5[_0x82da('0x2b')]('.')[0x0];});}function base64Encode(_0x2a3f35){var _0x4de783=fs[_0x82da('0x2c')](_0x2a3f35);return new Buffer(_0x4de783)[_0x82da('0x2d')]('base64');}exports['googleCloudTTS']=function(_0x358442,_0xcbc28b,_0x1cd7c8,_0x276725,_0x42e096,_0x3fc504){var _0x2591e0,_0x4aeac5;var _0x316936=_0x82da('0x2e');var _0xd50749='?key='+_0x358442;var _0x3f18cd={};if(_0xcbc28b===_0x82da('0x2f')){_0x3f18cd[_0x82da('0x30')]={'ssml':_0x1cd7c8};}else{_0x3f18cd[_0x82da('0x30')]={'text':_0x1cd7c8};};_0x3f18cd[_0x82da('0x31')]={'languageCode':_0x276725,'ssmlGender':_0x42e096};_0x3f18cd[_0x82da('0x32')]={'audioEncoding':_0x82da('0x33'),'sampleRateHertz':0x1f40};var _0x3f425e={'url':_0x316936+_0x82da('0x34')+_0xd50749,'method':'POST','json':!![],'body':_0x3f18cd};return rp(_0x3f425e)['then'](function(_0x56d1fa){return new BPromise(function(_0x408477,_0x1bb537){_0x2591e0=path[_0x82da('0x24')](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x35'));var _0x32b913=Buffer[_0x82da('0x36')](_0x56d1fa[_0x82da('0x37')],'base64');return fs['writeFile'](_0x2591e0,_0x32b913,function(_0x1ac8ff){_0x1bb537(_0x1ac8ff);},function(_0x16a834){fs[_0x82da('0x38')](_0x2591e0,_0x82da('0x2a'));_0x408477(_0x16a834);});});})[_0x82da('0x29')](function(_0x223c1e){_0x4aeac5=path['resolve'](__dirname,'tmp',rs[_0x82da('0x26')](0x4)+_0x82da('0x27'));return convertFile(_0x2591e0,_0x4aeac5);})['then'](function(){try{fs[_0x82da('0x18')](_0x2591e0);fs[_0x82da('0x38')](_0x4aeac5,_0x82da('0x2a'));}catch(_0x65b135){logger[_0x82da('0x12')](_0x65b135);}logger[_0x82da('0x21')](_0x82da('0x39'),_0x4aeac5[_0x82da('0x2b')]('.')[0x0]);return _0x4aeac5[_0x82da('0x2b')]('.')[0x0];});};exports['googleTTS']=function(_0x150072,_0x170b7c){var _0x45a09e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xa47da0,_0x5c863c;var _0x4543d9;var _0x586649={'encoding':_0x82da('0x3a'),'method':_0x82da('0x3b'),'timeout':0x2710,'url':_0x45a09e,'headers':{'Content-Type':_0x82da('0x3c')},'body':_0x82da('0x3d')+encodeURIComponent(JSON['stringify']([[[_0x82da('0x3e'),JSON[_0x82da('0x3f')]([_0x150072,_0x170b7c||'en',![],_0x82da('0x40')]),null,_0x82da('0x41')]]]))};return rp(_0x586649)['then'](function(_0x9a1e29){try{_0x4543d9=eval(_0x9a1e29['slice'](0x5))[0x0][0x2];}catch(_0x1334be){throw new Error(_0x82da('0x42')+_0x9a1e29[_0x82da('0x1d')]);}if(!_0x4543d9){if(_0x150072[_0x82da('0x43')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x82da('0x44')+_0x170b7c+_0x82da('0x45'));}}try{_0x4543d9=eval(_0x4543d9)[0x0];}catch(_0x77a9a7){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x82da('0x1d')]);}const _0x4f8160=_0x4543d9;_0xa47da0=path['resolve'](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x35'));fs[_0x82da('0x28')](_0xa47da0,_0x4543d9,{'encoding':'base64'});_0x5c863c=path[_0x82da('0x24')](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x27'));return convertFile(_0xa47da0,_0x5c863c);})[_0x82da('0x29')](function(){try{fs['unlink'](_0xa47da0);fs[_0x82da('0x38')](_0x5c863c,'777');}catch(_0x4f91a8){logger['error'](_0x4f91a8);}logger[_0x82da('0x21')](_0x82da('0x46'),_0x5c863c[_0x82da('0x2b')]('.')[0x0]);return _0x5c863c[_0x82da('0x2b')]('.')[0x0];});};exports[_0x82da('0x47')]=function(_0x2e42e8,_0x5ec849,_0x5d8f5a){return google[_0x82da('0x48')](_0x2e42e8,_0x5ec849,_0x5d8f5a)['then'](function(_0x573f01){logger[_0x82da('0x21')](_0x573f01['uri']);return rp(_0x573f01);})[_0x82da('0x29')](function(_0x80e068){var _0x59910e='';var _0x255434=0x0;try{fs[_0x82da('0x18')](_0x2e42e8);}catch(_0xc71a61){logger[_0x82da('0x12')](_0xc71a61);}if(_0x80e068&&_0x80e068[_0x82da('0x49')]){_0x59910e=_0x80e068['results'][_0x82da('0x4a')](function(_0x365a1b){return _0x365a1b&&_0x365a1b[_0x82da('0x4b')][0x0]&&_0x365a1b[_0x82da('0x4b')][0x0][_0x82da('0x4c')]?_0x365a1b[_0x82da('0x4b')][0x0][_0x82da('0x4c')]:'';})[_0x82da('0x4d')]('\x0a');_0x255434=_0x80e068[_0x82da('0x49')][_0x82da('0x4a')](function(_0x1066f6){return _0x1066f6&&_0x1066f6[_0x82da('0x4b')][0x0]&&_0x1066f6['alternatives'][0x0]['confidence']?_0x1066f6['alternatives'][0x0][_0x82da('0x4e')]:0x0;})[_0x82da('0x4d')]('\x0a');}logger['info'](_0x82da('0x4f'),_0x59910e);logger['info'](_0x82da('0x50'),_0x255434);return{'transcript':_0x59910e,'confidence':_0x255434};})[_0x82da('0x51')](function(_0x17362e){logger[_0x82da('0x12')]('[%s]\x20%s:%s',_0x17362e['statusCode'],_0x17362e[_0x82da('0x52')],_0x17362e['message']);});};exports[_0x82da('0x53')]=function(_0x546fd6,_0x59ca79,_0x2ab8b4,_0x2921ee){var _0xb778e8=apiai(_0x59ca79,{'language':_0x2921ee||'en'});return _0xb778e8[_0x82da('0x54')](_0x2ab8b4,{'sessionId':md5(_0x546fd6)})[_0x82da('0x29')](function(_0x3fd4d4){logger[_0x82da('0x21')](JSON[_0x82da('0x3f')](_0x3fd4d4));return{'source':_0x3fd4d4[_0x82da('0x55')][_0x82da('0x56')],'resolvedQuery':_0x3fd4d4[_0x82da('0x55')]['resolvedQuery'],'action':_0x3fd4d4['result'][_0x82da('0x57')],'actionIncomplete':_0x3fd4d4[_0x82da('0x55')]['actionIncomplete'],'speech':_0x3fd4d4[_0x82da('0x55')]['fulfillment'][_0x82da('0x58')],'score':_0x3fd4d4['result'][_0x82da('0x59')],'statusCode':_0x3fd4d4[_0x82da('0x5a')]['code'],'endConversation':_0x3fd4d4['result'][_0x82da('0x5b')][_0x82da('0x5c')]||![],'isFallbackIntent':_0x3fd4d4[_0x82da('0x55')][_0x82da('0x5b')][_0x82da('0x5d')]};});};exports[_0x82da('0x5e')]=function(_0x4826f6,_0xea94b4,_0x47eb77,_0x5c60fe,_0x5644a0,_0x3ed078){var _0x5de57f=_0x5c60fe[_0x82da('0x5f')](/\\n/g,'\x0a');var _0x49d23f={'credentials':{'private_key':_0x5de57f,'client_email':_0x47eb77}};var _0x484bef=new dialogflow[(_0x82da('0x60'))](_0x49d23f);var _0x223c28=_0x484bef[_0x82da('0x61')](_0xea94b4,md5(_0x4826f6));var _0x767011={'session':_0x223c28,'queryInput':{'text':{'text':_0x5644a0,'languageCode':_0x3ed078}}};return _0x484bef[_0x82da('0x62')](_0x767011)[_0x82da('0x29')](function(_0x1b95ce){if(_0x1b95ce&&_0x1b95ce[_0x82da('0x43')]){logger[_0x82da('0x21')](_0x82da('0x63'),JSON[_0x82da('0x3f')](_0x1b95ce));var _0x36513f=_0x1b95ce[0x0];if(_0x36513f){var _0xcde5cc={'action':_0x36513f[_0x82da('0x64')][_0x82da('0x57')],'allRequiredParamsPresent':_0x36513f['queryResult'][_0x82da('0x65')],'endConversation':_0x36513f[_0x82da('0x64')]['diagnosticInfo']&&_0x36513f['queryResult'][_0x82da('0x66')][_0x82da('0x67')]?_0x36513f[_0x82da('0x64')]['diagnosticInfo']['fields'][_0x82da('0x68')][_0x82da('0x69')]:![],'fulfillmentText':_0x36513f[_0x82da('0x64')]['fulfillmentText'],'intentName':_0x36513f['queryResult'][_0x82da('0x6a')][_0x82da('0x52')],'intentDisplayName':_0x36513f[_0x82da('0x64')][_0x82da('0x6a')][_0x82da('0x6b')],'isFallbackIntent':_0x36513f[_0x82da('0x64')]['intent'][_0x82da('0x6c')],'languageCode':_0x36513f[_0x82da('0x64')][_0x82da('0x6d')],'queryText':_0x36513f[_0x82da('0x64')][_0x82da('0x6e')],'responseId':_0x36513f[_0x82da('0x6f')],'score':_0x36513f[_0x82da('0x64')]['intentDetectionConfidence'],'speech':_0x36513f[_0x82da('0x64')][_0x82da('0x70')],'providerResponse':JSON[_0x82da('0x3f')](_0x1b95ce)};return _0xcde5cc;}}});};exports['tildeASR']=function(_0x1585ca,_0x4df870,_0x3bb367,_0x4089d8){return tilde[_0x82da('0x48')](_0x1585ca,_0x4df870,_0x3bb367,_0x4089d8)[_0x82da('0x29')](function(_0x1b2afb){try{fs[_0x82da('0x18')](_0x1585ca);}catch(_0x2e1438){logger['error'](_0x2e1438);}logger[_0x82da('0x21')](_0x82da('0x71'),_0x1b2afb[_0x82da('0x4c')]);logger[_0x82da('0x21')]('Tilde\x20ASR\x20confidence',_0x1b2afb[_0x82da('0x4e')]);return _0x1b2afb;});};exports[_0x82da('0x72')]=function(_0x25e813,_0x1b034b,_0x33c719,_0x252811,_0x3e568b,_0x137f16){var _0x5a37f0=path[_0x82da('0x24')](__dirname,'tmp',rs[_0x82da('0x26')](0x4)+_0x82da('0x35'));var _0x4041aa;return aws['polly'](_0x25e813,_0x1b034b,_0x33c719,_0x252811,_0x3e568b,_0x137f16,_0x5a37f0)['then'](function(){_0x4041aa=path[_0x82da('0x24')](__dirname,'tmp',rs[_0x82da('0x26')](0x4)+_0x82da('0x27'));return convertFile(_0x5a37f0,_0x4041aa);})[_0x82da('0x29')](function(){try{fs['unlink'](_0x5a37f0);fs[_0x82da('0x38')](_0x4041aa,_0x82da('0x2a'));}catch(_0x1da019){logger[_0x82da('0x12')](_0x1da019);}return _0x4041aa[_0x82da('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x78c1ca,_0x254ad6,_0x1e8f94,_0x1d76a4,_0x30609d,_0x28fcb2){return aws[_0x82da('0x73')](_0x78c1ca,_0x254ad6,_0x1e8f94,_0x1d76a4,_0x30609d,_0x28fcb2)[_0x82da('0x29')](function(_0x3b6390){logger['info'](JSON[_0x82da('0x3f')](_0x3b6390));return _0x3b6390;});};exports[_0x82da('0x74')]=function(_0x3a04f8,_0x33bdfb,_0x461211,_0x53a120){var _0x189954=util[_0x82da('0x75')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3a04f8,encodeURIComponent(_0x33bdfb),_0x461211,_0x53a120);var _0x5527e5=path[_0x82da('0x24')](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x35'));var _0x21e18c;return downloadFile(_0x189954,_0x5527e5)['then'](function(){_0x21e18c=path[_0x82da('0x24')](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x27'));return convertFile(_0x5527e5,_0x21e18c);})[_0x82da('0x29')](function(){try{fs['unlink'](_0x5527e5);fs['chmodSync'](_0x21e18c,_0x82da('0x2a'));}catch(_0x2ad12b){logger['error'](_0x2ad12b);}return _0x21e18c[_0x82da('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x5a08d4,_0x12bd64,_0x264a44,_0x3c9958){var _0x4ff5f5=util[_0x82da('0x75')](_0x82da('0x76'),ISPEECH_API,_0x12bd64,_0x264a44,base64Encode(_0x5a08d4),_0x3c9958?util[_0x82da('0x75')](_0x82da('0x77'),encodeURIComponent(_0x3c9958)):'freeform=3');return uploadFile(_0x4ff5f5)[_0x82da('0x29')](function(_0x369653){return querystring[_0x82da('0x8')](_0x369653);});};exports[_0x82da('0x78')]=function(_0xc0fd63,_0x23e4d7){return sestek[_0x82da('0x79')](_0xc0fd63,_0x23e4d7)[_0x82da('0x29')](function(_0x352808){logger[_0x82da('0x21')](JSON[_0x82da('0x3f')](_0x352808));var _0x287c03={'speech':_0x352808[_0x82da('0x7a')],'action':_0x352808['channelData']?_0x352808[_0x82da('0x7b')][_0x82da('0x7c')]:undefined,'actiondata':_0x352808[_0x82da('0x7b')]?_0x352808['channelData']['CustomActionData']:undefined};if(_0x352808[_0x82da('0x7b')]&&_0x352808[_0x82da('0x7b')]['AudioFromTts']){return base64Decode(_0x352808[_0x82da('0x7b')][_0x82da('0x7d')][_0x82da('0x7e')],path['resolve'](__dirname,_0x82da('0x25'),rs[_0x82da('0x26')](0x4)+_0x82da('0x27')))[_0x82da('0x29')](function(_0x2f0eca){_0x287c03[_0x82da('0x7f')]=_0x2f0eca;return _0x287c03;});}return _0x287c03;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x0a52=['randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','request\x20to\x20','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','tmp','.mp3','from','writeFile','777','split','googleTTS','utf8','f.req=','jQ1olc','stringify','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','endConversation','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','text','channelData','Data','audiofile','bluebird','dialogflow','http','https','querystring','request-promise'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x0a52,0x7e));var _0x20a5=function(_0x293fd1,_0x3a764f){_0x293fd1=_0x293fd1-0x0;var _0x3e6604=_0x0a52[_0x293fd1];return _0x3e6604;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x20a5('0x0'));var dialogflow=require(_0x20a5('0x1'));var fs=require('fs');var http=require(_0x20a5('0x2'));var https=require(_0x20a5('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0x20a5('0x4'));var rp=require(_0x20a5('0x5'));var rs=require(_0x20a5('0x6'));var sox=require(_0x20a5('0x7'));var tts=require(_0x20a5('0x8'));var urlParse=require(_0x20a5('0x9'))['parse'];var util=require(_0x20a5('0xa'));var aws=require(_0x20a5('0xb'));var google=require(_0x20a5('0xc'));var sestek=require(_0x20a5('0xd'));var tilde=require(_0x20a5('0xe'));var logger=require('../../../config/logger')(_0x20a5('0xf'));var ISPEECH_API=_0x20a5('0x10');function downloadFile(_0x15115f,_0x4709cd){return new BPromise(function(_0x2eed3c,_0x15ae59){var _0x81260f=urlParse(_0x15115f);var _0x9b828=_0x81260f[_0x20a5('0x11')]===_0x20a5('0x12')?https:http;var _0x5a4263={'host':_0x81260f[_0x20a5('0x13')],'path':_0x81260f[_0x20a5('0x14')],'headers':{'user-agent':_0x20a5('0x15')}};_0x9b828[_0x20a5('0x16')](_0x5a4263,function(_0x485d02){if(_0x485d02['statusCode']!==0xc8){logger[_0x20a5('0x17')]('request\x20to\x20'+_0x15115f+'\x20failed,\x20status\x20code\x20=\x20'+_0x485d02[_0x20a5('0x18')]+'\x20('+_0x485d02[_0x20a5('0x19')]+')');_0x15ae59(new Error('request\x20to\x20'+_0x15115f+_0x20a5('0x1a')+_0x485d02[_0x20a5('0x18')]+'\x20('+_0x485d02['statusMessage']+')'));return;}var _0x53dea9=fs['createWriteStream'](_0x4709cd);_0x53dea9['on'](_0x20a5('0x1b'),function(){logger[_0x20a5('0x1c')](_0x20a5('0x1d'));_0x53dea9[_0x20a5('0x1e')](_0x2eed3c);});_0x53dea9['on'](_0x20a5('0x17'),function(_0x3ecdc8){fs[_0x20a5('0x1f')](_0x4709cd);logger[_0x20a5('0x17')](_0x20a5('0x20'),_0x3ecdc8);_0x15ae59(_0x3ecdc8);});_0x485d02[_0x20a5('0x21')](_0x53dea9);})['on'](_0x20a5('0x17'),function(_0x2219ac){logger[_0x20a5('0x17')](_0x2219ac);_0x15ae59(_0x2219ac);})[_0x20a5('0x22')]();});}function uploadFile(_0x1fdca2){return new BPromise(function(_0x6b4b69,_0xa46669){var _0x24a0d5=urlParse(_0x1fdca2);var _0x14d0b5=_0x24a0d5['protocol']===_0x20a5('0x12')?https:http;var _0x5275af={'host':_0x24a0d5[_0x20a5('0x13')],'path':_0x24a0d5[_0x20a5('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0x14d0b5[_0x20a5('0x16')](_0x5275af,function(_0x249a1d){if(_0x249a1d['statusCode']!==0xc8){_0xa46669(new Error(_0x20a5('0x23')+_0x1fdca2+'\x20failed,\x20status\x20code\x20=\x20'+_0x249a1d[_0x20a5('0x18')]+'\x20('+_0x249a1d[_0x20a5('0x19')]+')'));return;}var _0x203be8='';_0x249a1d['on'](_0x20a5('0x24'),function(_0x2285e8){_0x203be8+=_0x2285e8;});_0x249a1d['on'](_0x20a5('0x22'),function(){_0x6b4b69(_0x203be8);});})['on']('error',function(_0x4fe821){_0xa46669(_0x4fe821);})[_0x20a5('0x22')]();});}function convertFile(_0x3fc615,_0x42618b){return new BPromise(function(_0x2d6ea5,_0x182176){var _0x31aabf=sox[_0x20a5('0x25')](_0x3fc615,_0x42618b,{'sampleRate':0x1f40,'format':_0x20a5('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x31aabf['on']('error',function(_0x39e4ef){logger['error']('error\x20convert',_0x39e4ef);_0x182176(_0x39e4ef);});_0x31aabf['on'](_0x20a5('0x22'),function(){logger[_0x20a5('0x1c')](_0x20a5('0x27'));_0x2d6ea5();});_0x31aabf[_0x20a5('0x28')]();});}function base64Decode(_0x494b18,_0x5eb146){var _0x3dc70c=path[_0x20a5('0x29')](__dirname,'tmp',rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));fs[_0x20a5('0x2c')](_0x3dc70c,_0x494b18,_0x20a5('0x2d'));return convertFile(_0x3dc70c,_0x5eb146)[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x3dc70c);fs[_0x20a5('0x2f')](_0x5eb146,'777');}catch(_0x28a79c){logger[_0x20a5('0x17')](_0x28a79c);}return _0x5eb146['split']('.')[0x0];});}function base64Encode(_0x3a25b1){var _0x22faaa=fs['readFileSync'](_0x3a25b1);return new Buffer(_0x22faaa)[_0x20a5('0x30')]('base64');}exports[_0x20a5('0x31')]=function(_0x1de453,_0x317632,_0x32786e,_0x48ce33,_0x5015f5,_0x2ef382){var _0x1d32eb,_0x1cb851;var _0x2a47fa=_0x20a5('0x32');var _0x599ec2=_0x20a5('0x33')+_0x1de453;var _0x4e75df={};if(_0x317632===_0x20a5('0x34')){_0x4e75df[_0x20a5('0x35')]={'ssml':_0x32786e};}else{_0x4e75df[_0x20a5('0x35')]={'text':_0x32786e};};_0x4e75df[_0x20a5('0x36')]={'languageCode':_0x48ce33,'ssmlGender':_0x5015f5};_0x4e75df['audioConfig']={'audioEncoding':_0x20a5('0x37'),'sampleRateHertz':0x1f40};var _0x361762={'url':_0x2a47fa+'text:synthesize'+_0x599ec2,'method':_0x20a5('0x38'),'json':!![],'body':_0x4e75df};return rp(_0x361762)['then'](function(_0x3d89a0){return new BPromise(function(_0x5fa11c,_0x403a01){_0x1d32eb=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x3a'));var _0x101947=Buffer[_0x20a5('0x3b')](_0x3d89a0['audioContent'],'base64');return fs[_0x20a5('0x3c')](_0x1d32eb,_0x101947,function(_0x225cd2){_0x403a01(_0x225cd2);},function(_0x29fcb0){fs[_0x20a5('0x2f')](_0x1d32eb,_0x20a5('0x3d'));_0x5fa11c(_0x29fcb0);});});})[_0x20a5('0x2e')](function(_0x5b6f6c){_0x1cb851=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x1d32eb,_0x1cb851);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x1d32eb);fs[_0x20a5('0x2f')](_0x1cb851,_0x20a5('0x3d'));}catch(_0x211cb8){logger[_0x20a5('0x17')](_0x211cb8);}logger[_0x20a5('0x1c')]('googleCloudTTS\x20path',_0x1cb851['split']('.')[0x0]);return _0x1cb851[_0x20a5('0x3e')]('.')[0x0];});};exports[_0x20a5('0x3f')]=function(_0x12499c,_0x4fe661){var _0x3c3d9e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5d2232,_0x17147d;var _0x12bd18;var _0x3cd91b={'encoding':_0x20a5('0x40'),'method':_0x20a5('0x38'),'timeout':0x2710,'url':_0x3c3d9e,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x20a5('0x41')+encodeURIComponent(JSON['stringify']([[[_0x20a5('0x42'),JSON[_0x20a5('0x43')]([_0x12499c,_0x4fe661||'en',![],'null']),null,'generic']]]))};return rp(_0x3cd91b)['then'](function(_0x786190){try{_0x12bd18=eval(_0x786190['slice'](0x5))[0x0][0x2];}catch(_0x3540ae){throw new Error(_0x20a5('0x44')+_0x786190[_0x20a5('0x24')]);}if(!_0x12bd18){if(_0x12499c[_0x20a5('0x45')]>0xc8){throw new Error(_0x20a5('0x46'));}else{throw new Error(_0x20a5('0x47')+_0x4fe661+'\x22\x20might\x20not\x20exist');}}try{_0x12bd18=eval(_0x12bd18)[0x0];}catch(_0x3e43fb){throw new Error(_0x20a5('0x44')+res[_0x20a5('0x24')]);}const _0x263269=_0x12bd18;_0x5d2232=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+'.mp3');fs['writeFileSync'](_0x5d2232,_0x12bd18,{'encoding':_0x20a5('0x2d')});_0x17147d=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x5d2232,_0x17147d);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x5d2232);fs[_0x20a5('0x2f')](_0x17147d,_0x20a5('0x3d'));}catch(_0x1f497d){logger[_0x20a5('0x17')](_0x1f497d);}logger['info'](_0x20a5('0x48'),_0x17147d[_0x20a5('0x3e')]('.')[0x0]);return _0x17147d['split']('.')[0x0];});};exports['googleASR']=function(_0x592a0c,_0xa7d198,_0x114840){return google[_0x20a5('0x49')](_0x592a0c,_0xa7d198,_0x114840)[_0x20a5('0x2e')](function(_0x5758d8){logger['info'](_0x5758d8[_0x20a5('0x4a')]);return rp(_0x5758d8);})[_0x20a5('0x2e')](function(_0xee5ac0){var _0x102fa9='';var _0xaab9d7=0x0;try{fs[_0x20a5('0x1f')](_0x592a0c);}catch(_0x5b62a0){logger[_0x20a5('0x17')](_0x5b62a0);}if(_0xee5ac0&&_0xee5ac0[_0x20a5('0x4b')]){_0x102fa9=_0xee5ac0[_0x20a5('0x4b')][_0x20a5('0x4c')](function(_0x2eb7f0){return _0x2eb7f0&&_0x2eb7f0[_0x20a5('0x4d')][0x0]&&_0x2eb7f0[_0x20a5('0x4d')][0x0][_0x20a5('0x4e')]?_0x2eb7f0[_0x20a5('0x4d')][0x0][_0x20a5('0x4e')]:'';})[_0x20a5('0x4f')]('\x0a');_0xaab9d7=_0xee5ac0[_0x20a5('0x4b')][_0x20a5('0x4c')](function(_0x43fa8f){return _0x43fa8f&&_0x43fa8f[_0x20a5('0x4d')][0x0]&&_0x43fa8f[_0x20a5('0x4d')][0x0][_0x20a5('0x50')]?_0x43fa8f['alternatives'][0x0][_0x20a5('0x50')]:0x0;})[_0x20a5('0x4f')]('\x0a');}logger[_0x20a5('0x1c')](_0x20a5('0x51'),_0x102fa9);logger[_0x20a5('0x1c')](_0x20a5('0x52'),_0xaab9d7);return{'transcript':_0x102fa9,'confidence':_0xaab9d7};})[_0x20a5('0x53')](function(_0x2dd843){logger['error'](_0x20a5('0x54'),_0x2dd843[_0x20a5('0x18')],_0x2dd843[_0x20a5('0x55')],_0x2dd843[_0x20a5('0x56')]);});};exports['googleDialogflow']=function(_0x133e2c,_0x1bc9d1,_0x802b0b,_0x4cb5b9){var _0x29e34a=apiai(_0x1bc9d1,{'language':_0x4cb5b9||'en'});return _0x29e34a[_0x20a5('0x57')](_0x802b0b,{'sessionId':md5(_0x133e2c)})['then'](function(_0x458eac){logger[_0x20a5('0x1c')](JSON['stringify'](_0x458eac));return{'source':_0x458eac[_0x20a5('0x58')][_0x20a5('0x59')],'resolvedQuery':_0x458eac[_0x20a5('0x58')][_0x20a5('0x5a')],'action':_0x458eac['result'][_0x20a5('0x5b')],'actionIncomplete':_0x458eac[_0x20a5('0x58')][_0x20a5('0x5c')],'speech':_0x458eac[_0x20a5('0x58')]['fulfillment'][_0x20a5('0x5d')],'score':_0x458eac['result'][_0x20a5('0x5e')],'statusCode':_0x458eac[_0x20a5('0x5f')]['code'],'endConversation':_0x458eac['result'][_0x20a5('0x60')][_0x20a5('0x61')]||![],'isFallbackIntent':_0x458eac[_0x20a5('0x58')][_0x20a5('0x60')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x3855b4,_0x2669ec,_0x54698d,_0x4f18c5,_0x2f74ad,_0x1ab5aa){var _0x4b39b6=_0x4f18c5[_0x20a5('0x62')](/\\n/g,'\x0a');var _0x3d9e12={'credentials':{'private_key':_0x4b39b6,'client_email':_0x54698d}};var _0x528c30=new dialogflow[(_0x20a5('0x63'))](_0x3d9e12);var _0x34cd9b=_0x528c30['sessionPath'](_0x2669ec,md5(_0x3855b4));var _0x3e17bc={'session':_0x34cd9b,'queryInput':{'text':{'text':_0x2f74ad,'languageCode':_0x1ab5aa}}};return _0x528c30[_0x20a5('0x64')](_0x3e17bc)['then'](function(_0x2de1f3){if(_0x2de1f3&&_0x2de1f3[_0x20a5('0x45')]){logger[_0x20a5('0x1c')](_0x20a5('0x65'),JSON['stringify'](_0x2de1f3));var _0x234c88=_0x2de1f3[0x0];if(_0x234c88){var _0x5ca040={'action':_0x234c88[_0x20a5('0x66')][_0x20a5('0x5b')],'allRequiredParamsPresent':_0x234c88[_0x20a5('0x66')][_0x20a5('0x67')],'endConversation':_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')]&&_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')][_0x20a5('0x69')]?_0x234c88[_0x20a5('0x66')][_0x20a5('0x68')]['fields'][_0x20a5('0x6a')][_0x20a5('0x6b')]:![],'fulfillmentText':_0x234c88['queryResult'][_0x20a5('0x6c')],'intentName':_0x234c88['queryResult'][_0x20a5('0x6d')][_0x20a5('0x55')],'intentDisplayName':_0x234c88['queryResult']['intent']['displayName'],'isFallbackIntent':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6d')][_0x20a5('0x6e')],'languageCode':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6f')],'queryText':_0x234c88[_0x20a5('0x66')][_0x20a5('0x70')],'responseId':_0x234c88[_0x20a5('0x71')],'score':_0x234c88['queryResult'][_0x20a5('0x72')],'speech':_0x234c88[_0x20a5('0x66')][_0x20a5('0x6c')],'providerResponse':JSON[_0x20a5('0x43')](_0x2de1f3)};return _0x5ca040;}}});};exports[_0x20a5('0x73')]=function(_0x38eaeb,_0x387093,_0x171968,_0x12860e){return tilde[_0x20a5('0x49')](_0x38eaeb,_0x387093,_0x171968,_0x12860e)[_0x20a5('0x2e')](function(_0x1072b0){try{fs[_0x20a5('0x1f')](_0x38eaeb);}catch(_0x46d4ae){logger['error'](_0x46d4ae);}logger['info']('Tilde\x20ASR\x20transcription',_0x1072b0['transcript']);logger['info'](_0x20a5('0x74'),_0x1072b0[_0x20a5('0x50')]);return _0x1072b0;});};exports[_0x20a5('0x75')]=function(_0x261ced,_0x59baa0,_0x4373d3,_0x48da4f,_0x326b3b,_0x5f215c){var _0x521740=path['resolve'](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x3a'));var _0x4a8296;return aws[_0x20a5('0x76')](_0x261ced,_0x59baa0,_0x4373d3,_0x48da4f,_0x326b3b,_0x5f215c,_0x521740)[_0x20a5('0x2e')](function(){_0x4a8296=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x521740,_0x4a8296);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x521740);fs[_0x20a5('0x2f')](_0x4a8296,_0x20a5('0x3d'));}catch(_0x3fba0a){logger[_0x20a5('0x17')](_0x3fba0a);}return _0x4a8296['split']('.')[0x0];});};exports[_0x20a5('0x77')]=function(_0x1c7192,_0x20cb76,_0x49d760,_0x4a459e,_0x29b557,_0x4beac7){return aws[_0x20a5('0x78')](_0x1c7192,_0x20cb76,_0x49d760,_0x4a459e,_0x29b557,_0x4beac7)[_0x20a5('0x2e')](function(_0x378b9e){logger['info'](JSON['stringify'](_0x378b9e));return _0x378b9e;});};exports[_0x20a5('0x79')]=function(_0x40d10e,_0x1f2815,_0x95dbfc,_0x30cf18){var _0xb530b6=util[_0x20a5('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x40d10e,encodeURIComponent(_0x1f2815),_0x95dbfc,_0x30cf18);var _0x37b0e9=path[_0x20a5('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x20a5('0x3a'));var _0x4489c9;return downloadFile(_0xb530b6,_0x37b0e9)[_0x20a5('0x2e')](function(){_0x4489c9=path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b'));return convertFile(_0x37b0e9,_0x4489c9);})[_0x20a5('0x2e')](function(){try{fs[_0x20a5('0x1f')](_0x37b0e9);fs['chmodSync'](_0x4489c9,_0x20a5('0x3d'));}catch(_0x2e1d8e){logger[_0x20a5('0x17')](_0x2e1d8e);}return _0x4489c9[_0x20a5('0x3e')]('.')[0x0];});};exports['ispeechASR']=function(_0x4d0043,_0x206a50,_0x5c09a3,_0x2b0358){var _0x1d8b10=util[_0x20a5('0x7a')](_0x20a5('0x7b'),ISPEECH_API,_0x206a50,_0x5c09a3,base64Encode(_0x4d0043),_0x2b0358?util[_0x20a5('0x7a')]('model=%s',encodeURIComponent(_0x2b0358)):_0x20a5('0x7c'));return uploadFile(_0x1d8b10)[_0x20a5('0x2e')](function(_0x47f85d){return querystring[_0x20a5('0x7d')](_0x47f85d);});};exports[_0x20a5('0x7e')]=function(_0x5a3bf2,_0x53d3b4){return sestek[_0x20a5('0x7f')](_0x5a3bf2,_0x53d3b4)[_0x20a5('0x2e')](function(_0x102f99){logger[_0x20a5('0x1c')](JSON['stringify'](_0x102f99));var _0x51e22e={'speech':_0x102f99[_0x20a5('0x80')],'action':_0x102f99[_0x20a5('0x81')]?_0x102f99[_0x20a5('0x81')]['CustomAction']:undefined,'actiondata':_0x102f99['channelData']?_0x102f99[_0x20a5('0x81')]['CustomActionData']:undefined};if(_0x102f99[_0x20a5('0x81')]&&_0x102f99[_0x20a5('0x81')]['AudioFromTts']){return base64Decode(_0x102f99[_0x20a5('0x81')]['AudioFromTts'][_0x20a5('0x82')],path[_0x20a5('0x29')](__dirname,_0x20a5('0x39'),rs[_0x20a5('0x2a')](0x4)+_0x20a5('0x2b')))[_0x20a5('0x2e')](function(_0x4ec298){_0x51e22e[_0x20a5('0x83')]=_0x4ec298;return _0x51e22e;});}return _0x51e22e;});};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 f18b92b..6c643e2 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 _0x5d81=['./nda'];(function(_0x441ab7,_0x522f19){var _0x2d15e8=function(_0x420e8a){while(--_0x420e8a){_0x441ab7['push'](_0x441ab7['shift']());}};_0x2d15e8(++_0x522f19);}(_0x5d81,0xd2));var _0x15d8=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x5d81[_0x2a56ad];return _0x425175;};var nda=require(_0x15d8('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x4e6a=['exports','./nda'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e6a,0x12d));var _0xa4e6=function(_0x2941af,_0x3e6116){_0x2941af=_0x2941af-0x0;var _0x4e0bf0=_0x4e6a[_0x2941af];return _0x4e0bf0;};var nda=require(_0xa4e6('0x0'));module[_0xa4e6('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 26e181e..1eea0e1 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 _0x6f7a=['resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','dnid','text','Bearer\x20','access_token','project','channelData','ndagenerate_audio','body','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','request-promise','url','../../../../../config/logger','agi','POST'];(function(_0x4f69ab,_0x154839){var _0x4074b7=function(_0x4c5cfb){while(--_0x4c5cfb){_0x4f69ab['push'](_0x4f69ab['shift']());}};_0x4074b7(++_0x154839);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x33331b,_0x274f4c){_0x33331b=_0x33331b-0x0;var _0x636b6f=_0x6f7a[_0x33331b];return _0x636b6f;};'use strict';var rp=require(_0xa6f7('0x0'));var url=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));module['exports']=function(_0x93614a,_0x407de3){var _0x12ecb8={'method':_0xa6f7('0x4'),'uri':url[_0xa6f7('0x5')](_0x407de3[_0xa6f7('0x6')],_0xa6f7('0x7')),'form':{'grant_type':_0xa6f7('0x8'),'username':_0x407de3[_0xa6f7('0x9')],'password':_0x407de3[_0xa6f7('0x8')]},'json':!![]};return rp(_0x12ecb8)[_0xa6f7('0xa')](function(_0x481a8c){var _0x4b4f9e={'method':_0xa6f7('0x4'),'uri':url[_0xa6f7('0x5')](_0x407de3[_0xa6f7('0xb')],_0xa6f7('0xc')),'body':{'type':_0x407de3[_0xa6f7('0xd')]||'message','channelId':'Nda','conversation':{'id':_0x93614a[_0xa6f7('0xe')]},'from':{'id':_0x93614a[_0xa6f7('0xf')],'name':_0x93614a['calleridname']},'recipient':{'id':_0x93614a[_0xa6f7('0x10')],'name':_0x93614a['extension']},'text':_0x407de3[_0xa6f7('0x11')],'channelData':{}},'headers':{'Authorization':_0xa6f7('0x12')+_0x481a8c[_0xa6f7('0x13')]},'json':!![]};if(_0x407de3[_0xa6f7('0x14')]){_0x4b4f9e['body'][_0xa6f7('0x15')]['ProjectName']=_0x407de3[_0xa6f7('0x14')];}if(_0x407de3[_0xa6f7('0x16')]=='1'){_0x4b4f9e[_0xa6f7('0x17')]['channelData'][_0xa6f7('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x407de3[_0xa6f7('0x19')]){_0x4b4f9e['body'][_0xa6f7('0x15')][_0xa6f7('0x1a')]=_0x407de3[_0xa6f7('0x19')];if(_0x407de3['custom_action_data']){_0x4b4f9e[_0xa6f7('0x17')][_0xa6f7('0x15')][_0xa6f7('0x1b')]=_0x407de3[_0xa6f7('0x1c')];}}logger['info'](JSON['stringify'](_0x4b4f9e));return rp(_0x4b4f9e);});}; \ No newline at end of file +var _0xc9c3=['then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname','dnid','extension','text','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','body','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username'];(function(_0x24ddd5,_0x4933ec){var _0x35e166=function(_0x6868ca){while(--_0x6868ca){_0x24ddd5['push'](_0x24ddd5['shift']());}};_0x35e166(++_0x4933ec);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x38a366,_0x1416d0){_0x38a366=_0x38a366-0x0;var _0x3e5711=_0xc9c3[_0x38a366];return _0x3e5711;};'use strict';var rp=require('request-promise');var url=require(_0x3c9c('0x0'));var logger=require(_0x3c9c('0x1'))(_0x3c9c('0x2'));module['exports']=function(_0x4a1db1,_0x2ca714){var _0x11d161={'method':'POST','uri':url[_0x3c9c('0x3')](_0x2ca714[_0x3c9c('0x4')],_0x3c9c('0x5')),'form':{'grant_type':_0x3c9c('0x6'),'username':_0x2ca714[_0x3c9c('0x7')],'password':_0x2ca714[_0x3c9c('0x6')]},'json':!![]};return rp(_0x11d161)[_0x3c9c('0x8')](function(_0x4eaaf4){var _0x5a15f7={'method':_0x3c9c('0x9'),'uri':url[_0x3c9c('0x3')](_0x2ca714['ndassistant_url'],_0x3c9c('0xa')),'body':{'type':_0x2ca714[_0x3c9c('0xb')]||_0x3c9c('0xc'),'channelId':_0x3c9c('0xd'),'conversation':{'id':_0x4a1db1['uniqueid']},'from':{'id':_0x4a1db1['callerid'],'name':_0x4a1db1[_0x3c9c('0xe')]},'recipient':{'id':_0x4a1db1[_0x3c9c('0xf')],'name':_0x4a1db1[_0x3c9c('0x10')]},'text':_0x2ca714[_0x3c9c('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4eaaf4['access_token']},'json':!![]};if(_0x2ca714['project']){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x13')]=_0x2ca714['project'];}if(_0x2ca714[_0x3c9c('0x14')]=='1'){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3c9c('0x16')};}if(_0x2ca714['custom_action']){_0x5a15f7[_0x3c9c('0x17')]['channelData'][_0x3c9c('0x18')]=_0x2ca714['custom_action'];if(_0x2ca714[_0x3c9c('0x19')]){_0x5a15f7[_0x3c9c('0x17')][_0x3c9c('0x12')]['CustomActionData']=_0x2ca714[_0x3c9c('0x19')];}}logger['info'](JSON[_0x3c9c('0x1a')](_0x5a15f7));return rp(_0x5a15f7);});}; \ 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 0dae06e..e5364b1 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 _0x1458=['exports','./lib/api'];(function(_0x3f1ad5,_0x4a1f09){var _0x1be1a2=function(_0x2769ab){while(--_0x2769ab){_0x3f1ad5['push'](_0x3f1ad5['shift']());}};_0x1be1a2(++_0x4a1f09);}(_0x1458,0x69));var _0x8145=function(_0x3c148b,_0x276697){_0x3c148b=_0x3c148b-0x0;var _0x11e854=_0x1458[_0x3c148b];return _0x11e854;};'use strict';var asr=require(_0x8145('0x0'));module[_0x8145('0x1')]=function(_0x55cd9b,_0x51c748,_0x586ec3,_0x324068){return asr(_0x55cd9b,_0x51c748,_0x586ec3,_0x324068);}; \ No newline at end of file +var _0x0c87=['exports'];(function(_0x4d9a42,_0x4baeaa){var _0x5833d3=function(_0x28f854){while(--_0x28f854){_0x4d9a42['push'](_0x4d9a42['shift']());}};_0x5833d3(++_0x4baeaa);}(_0x0c87,0x88));var _0x70c8=function(_0x4cd08f,_0x1c4741){_0x4cd08f=_0x4cd08f-0x0;var _0x19e94e=_0x0c87[_0x4cd08f];return _0x19e94e;};'use strict';var asr=require('./lib/api');module[_0x70c8('0x0')]=function(_0x442e3a,_0x570444,_0x5e994e,_0x19ba4d){return asr(_0x442e3a,_0x570444,_0x5e994e,_0x19ba4d);}; \ 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 0d13778..cf37cc3 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 _0x15d7=['createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','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'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x15d7,0xf3));var _0x715d=function(_0x2374f5,_0xa1c689){_0x2374f5=_0x2374f5-0x0;var _0x404196=_0x15d7[_0x2374f5];return _0x404196;};'use strict';var BPromise=require(_0x715d('0x0'));var _=require(_0x715d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x715d('0x2'));var crypto=require('crypto');var logger=require(_0x715d('0x3'))(_0x715d('0x4'));module[_0x715d('0x5')]=function(_0x336b5a,_0x394754,_0x1fd9da,_0x49e023){return new BPromise(function(_0x2f02ad,_0x18ab77){logger[_0x715d('0x6')]('Tilde\x20URI',_0x49e023||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2364cb=new WebSocket(_0x49e023||_0x715d('0x7'),{'perMessageDeflate':![]});var _0x5f1d87='';var _0x222988='0';var _0x394c6e='1';var _0x164dfc=_0x715d('0x8');function _0x2b3fa3(_0x19828c){var _0x1ba15d=crypto[_0x715d('0x9')](_0x715d('0xa'));_0x1ba15d[_0x715d('0xb')](_0x19828c);return _0x1ba15d[_0x715d('0xc')](_0x715d('0xd'));}function _0x2febb5(){try{logger['info'](_0x715d('0xe'));var _0x4cfb12=moment()[_0x715d('0xf')]();var _0x52b71f=_0x2b3fa3(_0x4cfb12+_0x394754+_0x1fd9da);_0x2364cb['send'](JSON[_0x715d('0x10')]({'appID':_0x394754,'timestamp':_0x4cfb12,'appKey':_0x52b71f}));var _0x466901=fs[_0x715d('0x11')](_0x336b5a);_0x466901['on']('data',function(_0x2bb882){_0x2364cb[_0x715d('0x12')](_0x2bb882);});_0x466901['on'](_0x715d('0x13'),function(){_0x2364cb['send'](_0x715d('0x14'));});}catch(_0x2936de){logger[_0x715d('0x15')](_0x715d('0x16'),JSON[_0x715d('0x10')](_0x2936de));_0x2364cb[_0x715d('0x17')]();}}function _0x2d2e0b(_0x26653d){try{if(_0x26653d){var _0xfc2eab=JSON[_0x715d('0x18')](_0x26653d);switch(_0xfc2eab[_0x715d('0x19')]){case 0x0:if(_0xfc2eab[_0x715d('0x1a')]){if(_0xfc2eab[_0x715d('0x1a')][_0x715d('0x1b')]){logger['info'](_0x715d('0x1c'),JSON[_0x715d('0x10')](_0xfc2eab['result'][_0x715d('0x1d')]));_0x5f1d87=_0xfc2eab[_0x715d('0x1a')][_0x715d('0x1d')][0x0][_0x715d('0x1e')];_0x222988=_0xfc2eab['result'][_0x715d('0x1d')][0x0][_0x715d('0x1f')];_0x394c6e='0';_0x164dfc=_0x715d('0x20');_0x2364cb['terminate']();}}break;case 0x1:logger['info'](_0x715d('0x8'));_0x394c6e='1';_0x164dfc=_0x715d('0x8');break;case 0x2:logger['info'](_0x715d('0x21'));_0x394c6e='2';_0x164dfc='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x715d('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x394c6e='9';_0x164dfc=_0x715d('0x22');break;case 0xa:logger[_0x715d('0x6')](_0x715d('0x23'));_0x394c6e='10';_0x164dfc=_0x715d('0x23');break;case 0xb:logger['info'](_0x715d('0x24'));_0x394c6e='11';_0x164dfc=_0x715d('0x24');}}}catch(_0x52e8ac){logger[_0x715d('0x15')](_0x715d('0x25'),JSON[_0x715d('0x10')](_0x52e8ac));_0x2364cb['terminate']();}}function _0x4eeea6(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x2f02ad({'transcript':_0x5f1d87,'confidence':_0x222988,'status':_0x394c6e,'status_message':_0x164dfc});}function _0x885e5f(_0x5217de){logger['error'](_0x715d('0x26'));if(!_[_0x715d('0x27')](_0x5217de)){logger['error'](_[_0x715d('0x28')](_0x5217de)?JSON[_0x715d('0x10')](_0x5217de):_0x5217de);}}_0x2364cb['on']('open',_0x2febb5);_0x2364cb['on'](_0x715d('0x29'),_0x2d2e0b);_0x2364cb['on'](_0x715d('0x13'),_0x4eeea6);_0x2364cb['on'](_0x715d('0x15'),_0x885e5f);});}; \ No newline at end of file +var _0x7ac6=['isObject','open','message','moment','crypto','../../../../../../config/logger','agi','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','stringify','createReadStream','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','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'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x7ac6,0x114));var _0x67ac=function(_0x70a300,_0x31e904){_0x70a300=_0x70a300-0x0;var _0xe2c6f6=_0x7ac6[_0x70a300];return _0xe2c6f6;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x67ac('0x0'));var crypto=require(_0x67ac('0x1'));var logger=require(_0x67ac('0x2'))(_0x67ac('0x3'));module['exports']=function(_0x5274f7,_0x5b2ca2,_0xbdd132,_0x27adbf){return new BPromise(function(_0x23e30b,_0x1cd9e2){logger[_0x67ac('0x4')](_0x67ac('0x5'),_0x27adbf||_0x67ac('0x6'));var _0xd481b1=new WebSocket(_0x27adbf||_0x67ac('0x6'),{'perMessageDeflate':![]});var _0x8dc5f3='';var _0x5f1a27='0';var _0x4ec42d='1';var _0x3a081d=_0x67ac('0x7');function _0x56c827(_0x1c3a12){var _0x12f913=crypto['createHash'](_0x67ac('0x8'));_0x12f913[_0x67ac('0x9')](_0x1c3a12);return _0x12f913[_0x67ac('0xa')](_0x67ac('0xb'));}function _0x1f6ded(){try{logger[_0x67ac('0x4')](_0x67ac('0xc'));var _0x4394a7=moment()[_0x67ac('0xd')]();var _0x18f1c1=_0x56c827(_0x4394a7+_0x5b2ca2+_0xbdd132);_0xd481b1[_0x67ac('0xe')](JSON[_0x67ac('0xf')]({'appID':_0x5b2ca2,'timestamp':_0x4394a7,'appKey':_0x18f1c1}));var _0x28aae9=fs[_0x67ac('0x10')](_0x5274f7);_0x28aae9['on']('data',function(_0x31f59){_0xd481b1[_0x67ac('0xe')](_0x31f59);});_0x28aae9['on'](_0x67ac('0x11'),function(){_0xd481b1[_0x67ac('0xe')](_0x67ac('0x12'));});}catch(_0x400c96){logger[_0x67ac('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x67ac('0xf')](_0x400c96));_0xd481b1[_0x67ac('0x14')]();}}function _0x13eecc(_0x502cc4){try{if(_0x502cc4){var _0x4e701f=JSON[_0x67ac('0x15')](_0x502cc4);switch(_0x4e701f[_0x67ac('0x16')]){case 0x0:if(_0x4e701f[_0x67ac('0x17')]){if(_0x4e701f['result'][_0x67ac('0x18')]){logger[_0x67ac('0x4')](_0x67ac('0x19'),JSON['stringify'](_0x4e701f[_0x67ac('0x17')][_0x67ac('0x1a')]));_0x8dc5f3=_0x4e701f[_0x67ac('0x17')]['hypotheses'][0x0]['transcript'];_0x5f1a27=_0x4e701f['result'][_0x67ac('0x1a')][0x0][_0x67ac('0x1b')];_0x4ec42d='0';_0x3a081d=_0x67ac('0x1c');_0xd481b1[_0x67ac('0x14')]();}}break;case 0x1:logger[_0x67ac('0x4')](_0x67ac('0x7'));_0x4ec42d='1';_0x3a081d=_0x67ac('0x7');break;case 0x2:logger[_0x67ac('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4ec42d='2';_0x3a081d=_0x67ac('0x1d');break;case 0x9:logger[_0x67ac('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x4ec42d='9';_0x3a081d=_0x67ac('0x1e');break;case 0xa:logger['info'](_0x67ac('0x1f'));_0x4ec42d='10';_0x3a081d=_0x67ac('0x1f');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4ec42d='11';_0x3a081d=_0x67ac('0x20');}}}catch(_0x18f63f){logger['error'](_0x67ac('0x21'),JSON[_0x67ac('0xf')](_0x18f63f));_0xd481b1[_0x67ac('0x14')]();}}function _0x3ed8e0(){logger[_0x67ac('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x23e30b({'transcript':_0x8dc5f3,'confidence':_0x5f1a27,'status':_0x4ec42d,'status_message':_0x3a081d});}function _0x53184e(_0x35e31e){logger[_0x67ac('0x13')](_0x67ac('0x22'));if(!_[_0x67ac('0x23')](_0x35e31e)){logger['error'](_[_0x67ac('0x24')](_0x35e31e)?JSON['stringify'](_0x35e31e):_0x35e31e);}}_0xd481b1['on'](_0x67ac('0x25'),_0x1f6ded);_0xd481b1['on'](_0x67ac('0x26'),_0x13eecc);_0xd481b1['on'](_0x67ac('0x11'),_0x3ed8e0);_0xd481b1['on'](_0x67ac('0x13'),_0x53184e);});}; \ 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 7732d86..9779f3d 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 _0x0794=['./asr'];(function(_0x4cb086,_0x4cc048){var _0x10d1af=function(_0x296e16){while(--_0x296e16){_0x4cb086['push'](_0x4cb086['shift']());}};_0x10d1af(++_0x4cc048);}(_0x0794,0x1d3));var _0x4079=function(_0x5be56a,_0x51da65){_0x5be56a=_0x5be56a-0x0;var _0x5521ef=_0x0794[_0x5be56a];return _0x5521ef;};var asr=require(_0x4079('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9611=['exports','./asr'];(function(_0x238b1f,_0x31402c){var _0x57b6c6=function(_0x5da173){while(--_0x5da173){_0x238b1f['push'](_0x238b1f['shift']());}};_0x57b6c6(++_0x31402c);}(_0x9611,0xef));var _0x1961=function(_0x1a55d2,_0x2ac9b8){_0x1a55d2=_0x1a55d2-0x0;var _0x3c51b4=_0x9611[_0x1a55d2];return _0x3c51b4;};var asr=require(_0x1961('0x0'));module[_0x1961('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 87fa23a..b527be6 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x32bcda,_0x156e9c){var _0x4e6191=function(_0xcbf3a0){while(--_0xcbf3a0){_0x32bcda['push'](_0x32bcda['shift']());}};_0x4e6191(++_0x156e9c);}(_0x34e8,0x12c));var _0x834e=function(_0x33dad6,_0x38fe05){_0x33dad6=_0x33dad6-0x0;var _0x4c164f=_0x34e8[_0x33dad6];return _0x4c164f;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 56e006a..ebca649 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 _0x6f7f=['google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','ispeech_asr_language','model','aws_access_key_id','aws_polly_voice','Amy','awsLex','aws_secret_access_key','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','isArray','format','setVariable','split','replaceAll','getVariable','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','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','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\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','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','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','%s/recordings/%s','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','no\x20sms\x20account\x20configured','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','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','rpc','getVariableById','then','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','channel','arg_1','createSquareRecording','uniqueid','callerid','accountcode','dnid','file','createSquareMessage','isNil','random','isEmpty','lastName','phone','list_id','callback','scheduledAt','callback_priority','getPause','agentPause','agentUnpause','agentLogout','agent','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey'];(function(_0x2656be,_0x41b00b){var _0x391715=function(_0x13b6fd){while(--_0x13b6fd){_0x2656be['push'](_0x2656be['shift']());}};_0x391715(++_0x41b00b);}(_0x6f7f,0x177));var _0xf6f7=function(_0x184649,_0x3d0f83){_0x184649=_0x184649-0x0;var _0x363c23=_0x6f7f[_0x184649];return _0x363c23;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xf6f7('0x0'));var sh=require(_0xf6f7('0x1'));var odbc=require(_0xf6f7('0x2'))();var rs=require(_0xf6f7('0x3'));var moment=require(_0xf6f7('0x4'));var Mustache=require('mustache');var rp=require(_0xf6f7('0x5'));var logger=require('../../config/logger')(_0xf6f7('0x6'));var config=require(_0xf6f7('0x7'));var scripts=require(_0xf6f7('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xf6f7('0x9'),'rawBody'];var verticesWithRetry=[_0xf6f7('0xa'),_0xf6f7('0xb'),_0xf6f7('0xc')];var AGIVertices=function(_0x279ed7,_0x2bf166,_0x1cfa51){this['channel']=_0x279ed7;this[_0xf6f7('0xd')]=_0x2bf166;this['mailRpc']=_0x1cfa51;};AGIVertices['prototype']['getVariable']=function(_0x304e45,_0x43082f){this[_0xf6f7('0xd')][_0xf6f7('0xe')](_0x304e45)[_0xf6f7('0xf')](function(_0xbd642){_0x43082f(null,_0xbd642?_0xbd642['name']:![]);})['catch'](function(_0x2493ec){_0x43082f(_0x2493ec);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x11')]=function(_0x4fe21e,_0x5f2aee){this['rpc'][_0xf6f7('0x12')](_0x4fe21e)['then'](function(_0x87ae1a){_0x5f2aee(null,_0x87ae1a?_0x87ae1a['name']:![]);})[_0xf6f7('0x13')](function(_0x2ca201){_0x5f2aee(_0x2ca201);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x14')]=function(_0x16cde1,_0x4b8eb2){this[_0xf6f7('0xd')][_0xf6f7('0x15')](_0x16cde1)['then'](function(_0x2e5fa3){_0x4b8eb2(null,_0x2e5fa3?_0x2e5fa3[_0xf6f7('0x16')]:![]);})[_0xf6f7('0x13')](function(_0x5cc7a1){_0x4b8eb2(_0x5cc7a1);});};AGIVertices['prototype'][_0xf6f7('0x17')]=function(_0x1db91d,_0x512b07){this[_0xf6f7('0xd')][_0xf6f7('0x18')](_0x1db91d)[_0xf6f7('0xf')](function(_0x173a27){_0x512b07(null,_0x173a27?_0x173a27[_0xf6f7('0x19')]:![]);})[_0xf6f7('0x13')](function(_0x3ec9c4){_0x512b07(_0x3ec9c4);});};AGIVertices['prototype'][_0xf6f7('0x1a')]=function(_0x5b6d3f,_0x58ca0f){this[_0xf6f7('0xd')]['getUserById'](_0x5b6d3f)[_0xf6f7('0xf')](function(_0x183b06){_0x58ca0f(null,_0x183b06?_0x183b06['name']:![]);})[_0xf6f7('0x13')](function(_0x5ec44f){_0x58ca0f(_0x5ec44f);});};AGIVertices['prototype'][_0xf6f7('0x1b')]=function(_0xc2de1c,_0x2d5079){this[_0xf6f7('0xd')][_0xf6f7('0x1c')](_0xc2de1c)['then'](function(_0x4c1ecd){_0x2d5079(null,_0x4c1ecd?_0x4c1ecd[_0xf6f7('0x16')]:![]);})[_0xf6f7('0x13')](function(_0x277023){_0x2d5079(_0x277023);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1d')]=function(_0x2c93c8,_0x4b6e82){var _0x49dd11=this;this[_0xf6f7('0xd')][_0xf6f7('0x1e')](_0x2c93c8)[_0xf6f7('0xf')](function(_0x35a384){_0x4b6e82(null,_0x35a384?_0x49dd11[_0xf6f7('0x1f')](_0x35a384[_0xf6f7('0x20')]):![]);})['catch'](function(_0x47f9ef){_0x4b6e82(_0x47f9ef);});};AGIVertices['prototype'][_0xf6f7('0x21')]=function(_0x51aa91,_0x29661e){this[_0xf6f7('0xd')]['getMailAccountById'](_0x51aa91)['then'](function(_0x3b85db){_0x29661e(null,_0x3b85db?_0x3b85db:![]);})[_0xf6f7('0x13')](function(_0x3da512){_0x29661e(_0x3da512);});};AGIVertices['prototype'][_0xf6f7('0x22')]=function(_0x505b20,_0x34b223,_0x2b0faf){this[_0xf6f7('0x23')][_0xf6f7('0x22')](_0x505b20,_0x34b223)[_0xf6f7('0xf')](function(){_0x2b0faf(null);})[_0xf6f7('0x13')](function(_0x14fb82){_0x2b0faf(_0x14fb82);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x24')]=function(_0x174730,_0xd755e6){this[_0xf6f7('0xd')]['getIntervalById'](_0x174730)[_0xf6f7('0xf')](function(_0x55e336){if(_0x55e336){if(_0x55e336[_0xf6f7('0x25')]){_0xd755e6(null,[_0x55e336[_0xf6f7('0x26')]]);}else{_0xd755e6(null,_[_0xf6f7('0x27')](_0x55e336[_0xf6f7('0x28')],_0xf6f7('0x26')));}}else{_0xd755e6(null,![]);}})[_0xf6f7('0x13')](function(_0x12f1ba){_0xd755e6(_0x12f1ba);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1f')]=function(_0x503fb9){return util['format'](_0xf6f7('0x29'),FILES_PATH,_0x503fb9);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x2a')]=function(_0x342309,_0x1c629e,_0x41975f){odbc[_0xf6f7('0x2b')](_0x342309,function(_0x21c4fc){if(_0x21c4fc){logger[_0xf6f7('0x2c')](_0xf6f7('0x2d'),_0x21c4fc);_0x41975f(_0x21c4fc);}else{logger[_0xf6f7('0x2e')](_0xf6f7('0x2f'));odbc[_0xf6f7('0x30')](_0x1c629e,function(_0x2cbcc7,_0x12488c){if(_0x2cbcc7){logger[_0xf6f7('0x2e')]('Error\x20executing\x20query\x20%s',_0x1c629e);_0x41975f(_0x2cbcc7);}else{logger['info'](_0xf6f7('0x31'),_0x1c629e);odbc[_0xf6f7('0x32')](function(_0x9dde0a){if(_0x9dde0a){logger[_0xf6f7('0x2c')](_0xf6f7('0x33'),_0x9dde0a);}_0x41975f(null,_0x12488c);});}});}});};AGIVertices[_0xf6f7('0x10')]['getSmsAccount']=function(_0x309002,_0x329648){this[_0xf6f7('0xd')][_0xf6f7('0x34')](_0x309002)['then'](function(_0x489c39){_0x329648(null,_0x489c39?_0x489c39:![]);})[_0xf6f7('0x13')](function(_0x5c3a79){_0x329648(_0x5c3a79);});};AGIVertices['prototype'][_0xf6f7('0x35')]=function(_0xb52be8,_0x2cbc89){this['rpc'][_0xf6f7('0x35')](_0xb52be8)[_0xf6f7('0xf')](function(_0x3717a0){_0x2cbc89(null,_0x3717a0);})[_0xf6f7('0x13')](function(_0x4b4817){_0x2cbc89(_0x4b4817);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x36')]=function(_0x49bfca,_0x4788f0,_0x4720fc){this['rpc'][_0xf6f7('0x36')]({'uniqueid':this['channel']['uniqueid'],'node':_0x49bfca['label'],'application':_0x49bfca[_0xf6f7('0x37')],'data':_0x4788f0||null,'project_name':this[_0xf6f7('0x38')][_0xf6f7('0x39')],'callerid':this[_0xf6f7('0x38')]['callerid']})[_0xf6f7('0xf')](function(_0x59389e){if(_0x4720fc){_0x4720fc(null,_0x59389e);}})[_0xf6f7('0x13')](function(_0x4b0b5c){if(_0x4720fc){_0x4720fc(_0x4b0b5c);}});};AGIVertices['prototype'][_0xf6f7('0x3a')]=function(_0x1351d7,_0xff8a0f,_0x491fa8,_0x45a203){this[_0xf6f7('0xd')]['createSquareRecording']({'uniqueid':this['channel'][_0xf6f7('0x3b')],'callerid':this['channel'][_0xf6f7('0x3c')],'calleridname':this['channel']['calleridname'],'context':this[_0xf6f7('0x38')]['context'],'extension':this[_0xf6f7('0x38')]['extension'],'priority':this[_0xf6f7('0x38')]['priority'],'accountcode':this['channel'][_0xf6f7('0x3d')],'dnid':this[_0xf6f7('0x38')][_0xf6f7('0x3e')],'projectName':this[_0xf6f7('0x38')][_0xf6f7('0x39')],'saveName':_0xff8a0f,'filename':_0x1351d7[_0xf6f7('0x3f')]||_0xff8a0f,'savePath':_0x491fa8})[_0xf6f7('0xf')](function(_0xa5a85){_0x45a203(null,_0xa5a85);})[_0xf6f7('0x13')](function(_0x38ae7a){_0x45a203(_0x38ae7a);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x40')]=function(_0x50c120,_0x4003b7,_0x583109,_0x429129,_0x3312b3){this[_0xf6f7('0xd')]['createSquareMessage']({'uniqueid':this[_0xf6f7('0x38')][_0xf6f7('0x3b')],'body':_0x50c120,'direction':_0x4003b7,'providerName':_0x583109,'providerResponse':_0x429129})[_0xf6f7('0xf')](function(_0x2f4955){if(_0x3312b3){_0x3312b3(null,_0x2f4955);}})[_0xf6f7('0x13')](function(_0x54228d){if(_0x3312b3){_0x3312b3(_0x54228d);}});};AGIVertices[_0xf6f7('0x10')]['createCmContact']=function(_0xda555f,_0x1bfc9a){this[_0xf6f7('0xd')]['createCmContact']({'firstName':_['isEmpty'](_0xda555f[_0xf6f7('0x16')])||_[_0xf6f7('0x41')](_0xda555f[_0xf6f7('0x16')])?'callback_'+Math[_0xf6f7('0x42')]():_0xda555f[_0xf6f7('0x16')],'lastName':_[_0xf6f7('0x43')](_0xda555f[_0xf6f7('0x44')])||_[_0xf6f7('0x41')](_0xda555f[_0xf6f7('0x44')])?null:_0xda555f['lastName'],'phone':_0xda555f[_0xf6f7('0x45')],'ListId':_0xda555f[_0xf6f7('0x46')],'scheduledat':_0xda555f['scheduledAt'],'callbackUniqueid':this['channel'][_0xf6f7('0x3b')],'tags':_0xf6f7('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0xda555f[_0xf6f7('0x48')]['toString'](),'priority':_0xda555f[_0xf6f7('0x49')]})[_0xf6f7('0xf')](function(_0x32cbfc){_0x1bfc9a(null,_0x32cbfc);})[_0xf6f7('0x13')](function(_0x12ed5a){_0x1bfc9a(_0x12ed5a);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x4a')]=function(_0x3ddfd2,_0x58ed71){this['rpc']['getPauseById'](_0x3ddfd2)[_0xf6f7('0xf')](function(_0x2a2fdb){_0x58ed71(null,_0x2a2fdb?_0x2a2fdb[_0xf6f7('0x16')]:![]);})[_0xf6f7('0x13')](function(_0x552fa6){_0x58ed71(_0x552fa6);});};AGIVertices[_0xf6f7('0x10')]['agentPause']=function(_0x117ec1,_0x10a570,_0x8065df){var _0x2b4423={'role':'agent'};_0x2b4423[_0x117ec1]=this[_0xf6f7('0x38')][_0xf6f7('0x3c')];this[_0xf6f7('0xd')][_0xf6f7('0x4b')](_0x2b4423,_0x10a570,this[_0xf6f7('0x38')][_0xf6f7('0x3b')])[_0xf6f7('0xf')](function(_0x48d456){_0x8065df(null,_['isNil'](_0x48d456)?![]:!![]);})['catch'](function(_0x20b843){logger[_0xf6f7('0x2c')](_0x20b843);_0x8065df(null,![]);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x4c')]=function(_0xb6a71d,_0x27aa99){var _0x3fa2dc={'role':'agent'};_0x3fa2dc[_0xb6a71d]=this['channel'][_0xf6f7('0x3c')];this[_0xf6f7('0xd')]['agentUnpause'](_0x3fa2dc)[_0xf6f7('0xf')](function(_0x515560){_0x27aa99(null,_['isNil'](_0x515560)?![]:!![]);})[_0xf6f7('0x13')](function(_0xc497c0){logger[_0xf6f7('0x2c')](_0xc497c0);_0x27aa99(null,![]);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x4d')]=function(_0x2588c1,_0xdf9070){var _0x42fe22={'role':_0xf6f7('0x4e')};_0x42fe22[_0x2588c1]=this[_0xf6f7('0x38')][_0xf6f7('0x3c')];this[_0xf6f7('0xd')][_0xf6f7('0x4d')](_0x42fe22)['then'](function(_0x504b0d){_0xdf9070(null,_[_0xf6f7('0x41')](_0x504b0d)?![]:!![]);})['catch'](function(_0x250912){logger[_0xf6f7('0x2c')](_0x250912);_0xdf9070(null,![]);});};AGIVertices[_0xf6f7('0x10')]['agentLogin']=function(_0x1e078d,_0x1fcc10){var _0x128c98={'role':_0xf6f7('0x4e')};_0x128c98[_0x1e078d]=this['channel'][_0xf6f7('0x3c')];var _0x350f64=_0x1e078d!='internal'?util['format'](_0xf6f7('0x4f'),'LOCAL',this['channel'][_0xf6f7('0x3c')]):undefined;this['rpc'][_0xf6f7('0x50')](_0x128c98,_0x350f64)[_0xf6f7('0xf')](function(_0xf885a8){_0x1fcc10(null,_['isNil'](_0xf885a8)?![]:!![]);})[_0xf6f7('0x13')](function(_0x28bb3d){logger[_0xf6f7('0x2c')](_0x28bb3d);_0x1fcc10(null,![]);});};AGIVertices['prototype'][_0xf6f7('0x51')]=function(_0x4a7023,_0x3d6cc5){sh[_0xf6f7('0x52')](_[_0xf6f7('0x53')](_0x4a7023),function(_0x27c118,_0x31ca78){var _0x34a616=_0x31ca78['replace'](/(\r\n|\n|\r)/gm,'');_0x3d6cc5(null,_0x34a616);});};AGIVertices['prototype'][_0xf6f7('0x54')]=function(_0x29fb2b,_0x4a9779){scripts['googleCloudTTS'](_0x29fb2b[_0xf6f7('0x55')],_0x29fb2b[_0xf6f7('0x56')]||_0xf6f7('0x57'),_0x29fb2b[_0xf6f7('0x57')],_0x29fb2b[_0xf6f7('0x58')]||_0xf6f7('0x59'),_0x29fb2b['ssmlGender']||_0xf6f7('0x5a'),_0x29fb2b[_0xf6f7('0x5b')]||_0xf6f7('0x5c'))[_0xf6f7('0xf')](function(_0x6c3ced){_0x4a9779(null,_0x6c3ced);})['catch'](function(_0x2531ad){_0x4a9779(_0x2531ad);});};AGIVertices[_0xf6f7('0x10')]['googleTTS']=function(_0x27621a,_0x1eb0fc){scripts[_0xf6f7('0x5d')](_0x27621a[_0xf6f7('0x57')],_0x27621a[_0xf6f7('0x5e')]||'en',0x1)[_0xf6f7('0xf')](function(_0x199ba7){_0x1eb0fc(null,_0x199ba7);})['catch'](function(_0x3f5d65){_0x1eb0fc(_0x3f5d65);});};AGIVertices['prototype']['restAPI']=function(_0x19923d,_0x240e0f){var _0x1590e6={'uri':_0x19923d['url'],'method':_0x19923d[_0xf6f7('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x19923d[_0xf6f7('0x60')])===_0xf6f7('0x61')&&parseInt(_0x19923d[_0xf6f7('0x60')])>=0x1?parseInt(_0x19923d[_0xf6f7('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xf6f7('0x62')]([_0xf6f7('0x63'),_0xf6f7('0x64')],_0x1590e6[_0xf6f7('0x5f')]['toUpperCase']())){try{_0x1590e6['body']=_0x19923d[_0xf6f7('0x65')]?JSON[_0xf6f7('0x66')](_0x19923d[_0xf6f7('0x65')]):{};}catch(_0x47b455){logger[_0xf6f7('0x2c')](_0xf6f7('0x67'),_0x47b455);}}try{_0x1590e6[_0xf6f7('0x68')]=_0x19923d[_0xf6f7('0x9')]?JSON[_0xf6f7('0x66')](_0x19923d[_0xf6f7('0x9')]):{};}catch(_0x3ba00c){logger[_0xf6f7('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ba00c);}if(_0x19923d[_0xf6f7('0x69')]){try{var _0xbeeef1=require(_0x19923d['computedVariables'])['sync'](this,_0x1590e6);_0x1590e6[_0xf6f7('0x6a')]=Mustache['render'](_0x19923d['url'],_0xbeeef1,{},['$$','$$']);if(_0x1590e6['headers']){_0x1590e6[_0xf6f7('0x68')]=JSON[_0xf6f7('0x66')](Mustache[_0xf6f7('0x6b')](JSON[_0xf6f7('0x6c')](_0x1590e6[_0xf6f7('0x68')]),_0xbeeef1,{},['$$','$$']));}if(_0x1590e6[_0xf6f7('0x6d')]){_0x1590e6[_0xf6f7('0x6d')]=JSON[_0xf6f7('0x66')](Mustache[_0xf6f7('0x6b')](JSON[_0xf6f7('0x6c')](_0x1590e6[_0xf6f7('0x6d')]),_0xbeeef1,{},['$$','$$']));}}catch(_0xe0b0b0){logger['error'](_0xf6f7('0x6e'),_0xe0b0b0);}}rp(_0x1590e6)[_0xf6f7('0xf')](function(_0x5452bd){var _0x39f210={'statusCode':_0x5452bd[_0xf6f7('0x6f')]||0xc8,'statusMessage':_0x5452bd[_0xf6f7('0x70')]||'OK','headers':_0x5452bd[_0xf6f7('0x68')]||{},'body':_0x5452bd[_0xf6f7('0x6d')]||{}};_0x240e0f(null,_0x39f210);})[_0xf6f7('0x13')](function(_0x5d30cc){var _0x441874={'statusCode':_0x5d30cc[_0xf6f7('0x6f')]||0x1f4,'statusMessage':_0x5d30cc[_0xf6f7('0x71')]||_0xf6f7('0x72'),'headers':_0x5d30cc[_0xf6f7('0x73')][_0xf6f7('0x68')]||{},'body':_0x5d30cc[_0xf6f7('0x73')]['body']||{}};_0x240e0f(null,_0x441874);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x74')]=function(_0x59ce46,_0x2d2921){scripts[_0xf6f7('0x74')](this['channel'][_0xf6f7('0x3b')],_0x59ce46['key'],_0x59ce46['text'],_0x59ce46['dialogflow_language']||'en')[_0xf6f7('0xf')](function(_0x13eb4c){_0x2d2921(null,_0x13eb4c);})[_0xf6f7('0x13')](function(_0x5805c4){_0x2d2921(_0x5805c4);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x75')]=function(_0x1e2adf,_0x291e55){scripts[_0xf6f7('0x75')](this[_0xf6f7('0x38')][_0xf6f7('0x3b')],_0x1e2adf[_0xf6f7('0x76')],_0x1e2adf[_0xf6f7('0x77')],_0x1e2adf[_0xf6f7('0x78')],_0x1e2adf[_0xf6f7('0x57')],_0x1e2adf[_0xf6f7('0x79')]||'en')[_0xf6f7('0xf')](function(_0x584b90){_0x291e55(null,_0x584b90);})[_0xf6f7('0x13')](function(_0x57f573){_0x291e55(_0x57f573);});};AGIVertices[_0xf6f7('0x10')]['sestekNDA']=function(_0x4a5f00,_0x5e210d){scripts[_0xf6f7('0x7a')](this[_0xf6f7('0x38')],_0x4a5f00)[_0xf6f7('0xf')](function(_0x22578c){_0x5e210d(null,_0x22578c);})[_0xf6f7('0x13')](function(_0x5d973f){_0x5e210d(_0x5d973f);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x7b')]=function(_0x4ec6dd,_0x267a6a){scripts[_0xf6f7('0x7b')](_0x4ec6dd['key'],_0x4ec6dd[_0xf6f7('0x57')],_0x4ec6dd[_0xf6f7('0x7c')]||_0xf6f7('0x59'),_0x4ec6dd[_0xf6f7('0x7d')])[_0xf6f7('0xf')](function(_0x3e9444){_0x267a6a(null,_0x3e9444);})[_0xf6f7('0x13')](function(_0x2cf52b){_0x267a6a(_0x2cf52b);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x7e')]=function(_0x44a049,_0xfecfbd,_0x53586e){scripts[_0xf6f7('0x7e')](_0xfecfbd,_0x44a049[_0xf6f7('0x7f')],_0x44a049[_0xf6f7('0x80')]||_0xf6f7('0x59'),this['isConfigured'](_0x44a049[_0xf6f7('0x81')])?_0x44a049['model']:undefined)[_0xf6f7('0xf')](function(_0x2bc534){_0x53586e(null,_0x2bc534);})[_0xf6f7('0x13')](function(_0x31eae1){_0x53586e(_0x31eae1);});};AGIVertices[_0xf6f7('0x10')]['awsPolly']=function(_0xb7b893,_0x1cc053){scripts['awsPolly'](_0xb7b893[_0xf6f7('0x82')],_0xb7b893['aws_secret_access_key'],_0xb7b893['aws_polly_region'],_0xb7b893[_0xf6f7('0x83')]||_0xf6f7('0x84'),_0xb7b893[_0xf6f7('0x57')],_0xb7b893['aws_text_type']||_0xf6f7('0x57'))['then'](function(_0x2df55a){_0x1cc053(null,_0x2df55a);})[_0xf6f7('0x13')](function(_0x258912){_0x1cc053(_0x258912);});};AGIVertices['prototype'][_0xf6f7('0x85')]=function(_0x5a9a79,_0x3fa371){scripts[_0xf6f7('0x85')](this[_0xf6f7('0x38')][_0xf6f7('0x3b')],_0x5a9a79[_0xf6f7('0x82')],_0x5a9a79[_0xf6f7('0x86')],_0x5a9a79['aws_lex_region'],_0x5a9a79[_0xf6f7('0x57')],_0x5a9a79['aws_bot_name'])[_0xf6f7('0xf')](function(_0x58f889){_0x3fa371(null,_0x58f889);})[_0xf6f7('0x13')](function(_0x4fbe68){_0x3fa371(_0x4fbe68);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x87')]=function(_0x19f459,_0x15692d,_0x466392){scripts[_0xf6f7('0x87')](_0x15692d,_0x19f459[_0xf6f7('0x7f')],_0x19f459[_0xf6f7('0x88')]||_0xf6f7('0x59'))['then'](function(_0x46562c){_0x466392(null,_0x46562c);})[_0xf6f7('0x13')](function(_0x38ceaa){_0x466392(_0x38ceaa);});};AGIVertices['prototype'][_0xf6f7('0x89')]=function(_0x3eff25,_0x169a92,_0x37a821){scripts[_0xf6f7('0x89')](_0x169a92,_0x3eff25[_0xf6f7('0x8a')],_0x3eff25['appsecret'],_0x3eff25[_0xf6f7('0x6a')])[_0xf6f7('0xf')](function(_0x1c8568){_0x37a821(null,_0x1c8568);})[_0xf6f7('0x13')](function(_0x119edf){_0x37a821(_0x119edf);});};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x8b')]=function(_0x2f300e){var _0x31f7e6=_[_0xf6f7('0x62')](verticesWithRetry,_0x2f300e['agicommand'])?_0x2f300e:_[_0xf6f7('0x8c')](_0x2f300e);for(var _0x356aaa in _0x31f7e6){if(_0x31f7e6['hasOwnProperty'](_0x356aaa)){if(_0x31f7e6[_0x356aaa]&&_[_0xf6f7('0x8d')](_0x31f7e6[_0x356aaa])){if(_[_0xf6f7('0x62')](recursiveMapAttributes,_0x356aaa)){_0x31f7e6[_0x356aaa]=this[_0xf6f7('0x8e')](_0x31f7e6[_0x356aaa]);}else{_0x31f7e6[_0x356aaa]=this[_0xf6f7('0x8f')](_0x31f7e6[_0x356aaa]);}}}}return _0x31f7e6;};AGIVertices['prototype'][_0xf6f7('0x90')]=function(_0x3dde24){for(var _0x3b1d6a in _0x3dde24){if(_0x3dde24[_0xf6f7('0x91')](_0x3b1d6a)){if(_[_0xf6f7('0x92')](_0x3dde24[_0x3b1d6a])){this[_0xf6f7('0x90')](_0x3dde24[_0x3b1d6a]);}else if(_['isArray'](_0x3dde24[_0x3b1d6a])){for(var _0xce06a0=0x0;_0xce06a0<_0x3dde24[_0x3b1d6a][_0xf6f7('0x93')];_0xce06a0++){this[_0xf6f7('0x90')](_0x3dde24[_0x3b1d6a][_0xce06a0]);}}else if(_[_0xf6f7('0x8d')](_0x3dde24[_0x3b1d6a])){_0x3dde24[_0x3b1d6a]=this[_0xf6f7('0x8f')](_0x3dde24[_0x3b1d6a]);}}}};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x94')]=function(_0x51ee84,_0x276db4){for(var _0x3069a7 in _0x51ee84){if(_0x51ee84['hasOwnProperty'](_0x3069a7)){if(_[_0xf6f7('0x92')](_0x51ee84[_0x3069a7])){if(!_[_0xf6f7('0x43')](_0x51ee84[_0x3069a7])){this['saveRestApiResult'](_0x51ee84[_0x3069a7],util['format'](_0xf6f7('0x95'),_0x276db4,_0x3069a7));}}else if(_[_0xf6f7('0x96')](_0x51ee84[_0x3069a7])){for(var _0x50657f=0x0;_0x50657f<_0x51ee84[_0x3069a7][_0xf6f7('0x93')];_0x50657f++){this[_0xf6f7('0x94')](_0x51ee84[_0x3069a7][_0x50657f],util[_0xf6f7('0x97')](_0xf6f7('0x95'),_0x276db4,_0x3069a7+'['+_0x50657f+']'));}}else{if(!_[_0xf6f7('0x41')](_0x51ee84[_0x3069a7])){this['channel'][_0xf6f7('0x98')](util['format'](_0xf6f7('0x95'),_0x276db4,_0x3069a7),_0x51ee84[_0x3069a7]);}}}}};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x8e')]=function(_0x31290a){try{var _0x29361f=JSON[_0xf6f7('0x66')](_0x31290a);this[_0xf6f7('0x90')](_0x29361f);return JSON['stringify'](_0x29361f);}catch(_0x1c1d2d){return this['replaceAllVariables'](_0x31290a);}};AGIVertices[_0xf6f7('0x10')]['replaceAllVariables']=function(_0x109c95){var _0x450873=_0x109c95[_0xf6f7('0x99')]('{');for(var _0x1b09c2=0x1;_0x1b09c2<_0x450873[_0xf6f7('0x93')];_0x1b09c2+=0x1){var _0x405b28=_0x450873[_0x1b09c2][_0xf6f7('0x99')]('}');if(_0x405b28['length']>0x1){_0x109c95=_0x109c95[_0xf6f7('0x9a')]('{'+_0x405b28[0x0]+'}',this[_0xf6f7('0x38')][_0xf6f7('0x9b')](_0x405b28[0x0])[_0xf6f7('0x9c')]||_0x405b28[0x0]);}}if(_0x450873[_0xf6f7('0x93')]===0x1){return _0x109c95[_0xf6f7('0x9d')]();}return this[_0xf6f7('0x8f')](_0x109c95);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x9e')]=function(_0x3746d9,_0x4238a4){var _0x3c9b22=this[_0xf6f7('0x38')]['getVariable'](_0x3746d9);if(_0x3c9b22[_0xf6f7('0x9f')]===-0x1){return _0x3c9b22;}logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xa0'),_0x4238a4,_0x3c9b22[_0xf6f7('0x9c')]));return this[_0xf6f7('0x38')][_0xf6f7('0x98')](_0x4238a4,_0x3c9b22[_0xf6f7('0x9c')]);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xa1')]=function(_0xf0bf45){return _0xf0bf45&&_0xf0bf45!=='0'&&_0xf0bf45!=='-1'&&_0xf0bf45!=='';};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xa2')]=function(_0x5abdf0){this['createSquareDetailsReport'][_0xf6f7('0xa3')](this,_0x5abdf0,'-');_0x5abdf0[_0xf6f7('0xa4')]=_0x5abdf0['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x37921c){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xa5'),_0x37921c['label']));if(!this[_0xf6f7('0xa1')](_0x37921c['text'])){return this['channel'][_0xf6f7('0xa6')]('no\x20text\x20configured');}var _0x2e9c17='\x22'+_0x37921c[_0xf6f7('0x57')]+'\x22';if(this[_0xf6f7('0xa1')](_0x37921c[_0xf6f7('0x73')])){_0x2e9c17+=','+_0x37921c['options'];}var _0x2fee40=this[_0xf6f7('0x38')]['exec']('MRCPSynth',_0x2e9c17);if(_0x2fee40['result']===-0x1){return _0x2fee40;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xa7'),_0x2e9c17));};AGIVertices['prototype'][_0xf6f7('0xa8')]=function(_0xd67f3){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0xa9'),_0xd67f3[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0xd67f3[_0xf6f7('0xab')])){return this['channel'][_0xf6f7('0xa6')](_0xf6f7('0xac'));}var _0x340b27=_0xd67f3[_0xf6f7('0xab')];if(this[_0xf6f7('0xa1')](_0xd67f3[_0xf6f7('0x73')])){_0x340b27+=','+_0xd67f3[_0xf6f7('0x73')];}var _0x2d5f6d=this[_0xf6f7('0x38')][_0xf6f7('0x52')]('MRCPRecog',_0x340b27);if(_0x2d5f6d[_0xf6f7('0x9f')]===-0x1){return _0x2d5f6d;}var _0x572e69=this[_0xf6f7('0x9e')](_0xf6f7('0xad'),_0xf6f7('0xae'));if(_0x572e69[_0xf6f7('0x9f')]===-0x1){return _0x572e69;}var _0x45cce2=this[_0xf6f7('0x9e')](_0xf6f7('0xaf'),_0xf6f7('0xb0'));if(_0x45cce2[_0xf6f7('0x9f')]===-0x1){return _0x45cce2;}var _0x3c4d09=this[_0xf6f7('0x9e')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x3c4d09[_0xf6f7('0x9f')]===-0x1){return _0x3c4d09;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xb1'),_0x340b27));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x6')]=function(_0x561279){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x561279[_0xf6f7('0xaa')]));return this[_0xf6f7('0x38')]['agi']([_0x561279[_0xf6f7('0xb2')],_0x561279[_0xf6f7('0xb3')]]);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xb4')]=function(_0x10bb3a){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0xb5'),_0x10bb3a['label']));if(this[_0xf6f7('0xa1')](_0x10bb3a[_0xf6f7('0x60')])){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0xb6'),_0x10bb3a[_0xf6f7('0x60')]));var _0x300f59=this[_0xf6f7('0x38')]['wait'](_0x10bb3a[_0xf6f7('0x60')]);if(_0x300f59[_0xf6f7('0x9f')]===-0x1){return _0x300f59;}}return this[_0xf6f7('0x38')]['answer']();};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x47')]=function(_0x40d085){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xb7'),_0x40d085[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x40d085['list_id'])){return this['channel']['error'](_0x40d085,_0xf6f7('0xb8'));}_0x40d085[_0xf6f7('0x48')]=moment();if(this[_0xf6f7('0xa1')](_0x40d085[_0xf6f7('0xb9')])){_0x40d085[_0xf6f7('0x48')]=moment()[_0xf6f7('0xba')](_0x40d085[_0xf6f7('0xb9')],_0xf6f7('0xbb'));}if(!this[_0xf6f7('0xa1')](_0x40d085['callback_priority'])){_0x40d085[_0xf6f7('0x49')]=0x2;}this['createCmContact'][_0xf6f7('0xa3')](this,_0x40d085);return this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0xbc'),_0x40d085[_0xf6f7('0x45')],_0x40d085[_0xf6f7('0x46')],_0x40d085[_0xf6f7('0x48')]));};AGIVertices['prototype'][_0xf6f7('0xbd')]=function(_0x2b6454){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xbe'),_0x2b6454[_0xf6f7('0xaa')]));var _0x4ced87=this['channel'][_0xf6f7('0x52')](_0x2b6454[_0xf6f7('0xbf')],_0x2b6454[_0xf6f7('0x73')]);if(_0x4ced87[_0xf6f7('0x9f')]===-0x1){return _0x4ced87;}return this['channel']['noop'](util[_0xf6f7('0x97')](_0xf6f7('0xc0'),_0x2b6454[_0xf6f7('0xbf')],_0x2b6454[_0xf6f7('0x73')]));};AGIVertices[_0xf6f7('0x10')]['lumenvoxtts']=function(_0x12097f){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xc1'),_0x12097f[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x12097f[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0xc2'));}var _0x5a8911='\x22'+_0x12097f[_0xf6f7('0x57')]+'\x22';if(this[_0xf6f7('0xa1')](_0x12097f[_0xf6f7('0x73')])){_0x5a8911+=','+_0x12097f[_0xf6f7('0x73')];}var _0x5e22ea=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0xc3'),_0x5a8911);if(_0x5e22ea[_0xf6f7('0x9f')]===-0x1){return _0x5e22ea;}return this[_0xf6f7('0x38')]['noop'](util['format'](_0xf6f7('0xa7'),_0x5a8911));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xc4')]=function(_0x2a9a4b){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xc5'),_0x2a9a4b[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x2a9a4b[_0xf6f7('0x57')])){return this['channel']['noop'](_0xf6f7('0xc2'));}var _0x1d8b81='\x22'+_0x2a9a4b['text']+'\x22';if(this[_0xf6f7('0xa1')](_0x2a9a4b[_0xf6f7('0x73')])){_0x1d8b81+=','+_0x2a9a4b['options'];}var _0x31bf0b=this['channel'][_0xf6f7('0x52')](_0xf6f7('0xc3'),_0x1d8b81);if(_0x31bf0b[_0xf6f7('0x9f')]===-0x1){return _0x31bf0b;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xa7'),_0x1d8b81));};AGIVertices['prototype'][_0xf6f7('0xc6')]=function(_0x50c735){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0xc7'),_0x50c735['label']));if(!this['isConfigured'](_0x50c735[_0xf6f7('0xab')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xac'));}var _0x1eb58a=_0x50c735[_0xf6f7('0xab')];if(this['isConfigured'](_0x50c735[_0xf6f7('0x73')])){_0x1eb58a+=','+_0x50c735[_0xf6f7('0x73')];}var _0x391094=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0xc8'),_0x1eb58a);if(_0x391094['result']===-0x1){return _0x391094;}var _0x149081=this['getAndSetVariable'](_0xf6f7('0xad'),_0xf6f7('0xc9'));if(_0x149081[_0xf6f7('0x9f')]===-0x1){return _0x149081;}var _0x3e7aa9=this['getAndSetVariable'](_0xf6f7('0xaf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3e7aa9[_0xf6f7('0x9f')]===-0x1){return _0x3e7aa9;}var _0x4c5ea5=this[_0xf6f7('0x9e')](_0xf6f7('0xca'),_0xf6f7('0xcb'));if(_0x4c5ea5[_0xf6f7('0x9f')]===-0x1){return _0x4c5ea5;}return this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0xb1'),_0x1eb58a));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xcc')]=function(_0x9d4b09){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0xcd'),_0x9d4b09[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x9d4b09[_0xf6f7('0xab')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xac'));}var _0x9e4209=_0x9d4b09[_0xf6f7('0xab')];if(this['isConfigured'](_0x9d4b09[_0xf6f7('0x73')])){_0x9e4209+=','+_0x9d4b09['options'];}var _0x2edf47=this['channel'][_0xf6f7('0x52')]('MRCPRecog',_0x9e4209);if(_0x2edf47[_0xf6f7('0x9f')]===-0x1){return _0x2edf47;}var _0x3368b7=this[_0xf6f7('0x9e')](_0xf6f7('0xad'),_0xf6f7('0xce'));if(_0x3368b7[_0xf6f7('0x9f')]===-0x1){return _0x3368b7;}var _0x459fcb=this[_0xf6f7('0x9e')](_0xf6f7('0xaf'),_0xf6f7('0xcf'));if(_0x459fcb[_0xf6f7('0x9f')]===-0x1){return _0x459fcb;}var _0xd2e47=this[_0xf6f7('0x9e')](_0xf6f7('0xca'),_0xf6f7('0xd0'));if(_0xd2e47['result']===-0x1){return _0xd2e47;}return this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0xb1'),_0x9e4209));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xd1')]=function(_0x5f21b9){logger['info'](util['format'](_0xf6f7('0xd2'),_0x5f21b9['label']));if(!this['isConfigured'](_0x5f21b9[_0xf6f7('0xd3')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x5f21b9,_0xf6f7('0xd4'));}var _0x40d73d=this[_0xf6f7('0x17')][_0xf6f7('0xa3')](this,_0x5f21b9[_0xf6f7('0xd3')]);if(!_0x40d73d){return this[_0xf6f7('0x38')]['error'](_0x5f21b9,_0xf6f7('0xd5'));}if(!this[_0xf6f7('0xa1')](_0x5f21b9[_0xf6f7('0x30')])){return this[_0xf6f7('0x38')]['error'](_0x5f21b9,_0xf6f7('0xd6'));}var _0x2ac268=_0x5f21b9['query'][_0xf6f7('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xd8'),_0x2ac268));var _0x47f42=this[_0xf6f7('0x2a')]['sync'](this,_0x40d73d,_0x2ac268);this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x5f21b9,_0x2ac268);if(!this['isConfigured'](_0x5f21b9[_0xf6f7('0xd9')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0xda'));}var _0xe2017f=this[_0xf6f7('0x9b')][_0xf6f7('0xa3')](this,_0x5f21b9[_0xf6f7('0xd9')]);if(!_0xe2017f){return this[_0xf6f7('0x38')]['error'](_0x5f21b9,_0xf6f7('0xdb'));}var _0x5bcb2d=this;_0x47f42[_0xf6f7('0xdc')](function(_0xbf9946,_0x5d1397){Object[_0xf6f7('0xdd')](_0xbf9946)[_0xf6f7('0xdc')](function(_0x4895f3){_0x5bcb2d['channel']['setVariable'](util[_0xf6f7('0x97')](_0xf6f7('0xde'),_0xe2017f,_0x5d1397,_0x4895f3),_0xbf9946[_0x4895f3]);});});this[_0xf6f7('0x38')][_0xf6f7('0x98')](util['format'](_0xf6f7('0xdf'),_0xe2017f),_0x47f42[_0xf6f7('0x93')]);return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0xe0'),_0xe2017f));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xe1')]=function(_0x17260f){logger[_0xf6f7('0xe2')](util[_0xf6f7('0x97')](_0xf6f7('0xe3'),_0x17260f[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x17260f[_0xf6f7('0xe4')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x17260f,_0xf6f7('0xe5'));}var _0x4a265e=this[_0xf6f7('0x1a')][_0xf6f7('0xa3')](this,_0x17260f[_0xf6f7('0xe4')]);if(!_0x4a265e){return this['channel'][_0xf6f7('0x2c')](_0x17260f,_0xf6f7('0xe6'));}var _0xcd0d3c=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0xe7'),[util[_0xf6f7('0x97')](_0xf6f7('0xe8'),_0x4a265e),_0x17260f[_0xf6f7('0x60')],_0x17260f['opts'],_0x17260f[_0xf6f7('0xe9')]]);if(_0xcd0d3c['result']===-0x1){return _0xcd0d3c;}return this['channel'][_0xf6f7('0xa6')](util['format'](_0xf6f7('0xea'),_0xf6f7('0xe7')));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xeb')]=function(_0x214c83){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0xec'),_0x214c83[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x214c83[_0xf6f7('0x7f')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('no\x20key\x20configured');}if(!this[_0xf6f7('0xa1')](_0x214c83[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('no\x20text\x20configured');}this[_0xf6f7('0x38')][_0xf6f7('0xed')]=!![];this[_0xf6f7('0x36')](_0x214c83);this[_0xf6f7('0x40')](_0x214c83[_0xf6f7('0x57')],'in','','');this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0xee'),_0x214c83[_0xf6f7('0x57')]));var _0x4e26c3=this[_0xf6f7('0x74')][_0xf6f7('0xa3')](this,_0x214c83);if(_0x4e26c3){for(var _0x4d0d05 in _0x4e26c3){if(_0x4e26c3[_0xf6f7('0x91')](_0x4d0d05)){this['channel'][_0xf6f7('0x98')](util['format'](_0xf6f7('0xef'),_0x4d0d05[_0xf6f7('0xf0')]()),_0x4e26c3[_0x4d0d05]);}}this[_0xf6f7('0x40')](_0x4e26c3[_0xf6f7('0xf1')],_0xf6f7('0xf2'),_0xf6f7('0xeb'),'');return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xf3'),_0x4e26c3[_0xf6f7('0xf1')]));}return this[_0xf6f7('0x38')]['error'](_0x214c83,_0xf6f7('0xf4'));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xf5')]=function(_0x14977a){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0xf6'),_0x14977a[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x14977a['dialogflowV2_project_id'])){return this['channel'][_0xf6f7('0xa6')](_0xf6f7('0xf7'));}if(!this[_0xf6f7('0xa1')](_0x14977a['client_email'])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xf8'));}if(!this['isConfigured'](_0x14977a['private_key'])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xf9'));}if(!this[_0xf6f7('0xa1')](_0x14977a[_0xf6f7('0x79')])){return this[_0xf6f7('0x38')]['noop']('no\x20anguage\x20configured');}if(!this[_0xf6f7('0xa1')](_0x14977a[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xc2'));}this['channel'][_0xf6f7('0xed')]=!![];this['createSquareDetailsReport'](_0x14977a);this[_0xf6f7('0x40')](_0x14977a[_0xf6f7('0x57')],'in','','');this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xfa'),_0x14977a['text']));var _0x2aafbf=this['googleDialogflowV2']['sync'](this,_0x14977a);if(_0x2aafbf){for(var _0x5c8610 in _0x2aafbf){if(_0x2aafbf[_0xf6f7('0x91')](_0x5c8610)){if(_0x5c8610!==_0xf6f7('0xfb')){this[_0xf6f7('0x38')][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0xef'),_0x5c8610[_0xf6f7('0xf0')]()),_0x2aafbf[_0x5c8610]);}}}this[_0xf6f7('0x40')](_0x2aafbf['speech'],_0xf6f7('0xf2'),_0xf6f7('0xf5'),_0x2aafbf['providerResponse']);return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format']('DialogflowV2\x20Result\x20%s',_0x2aafbf[_0xf6f7('0xf1')]));}return this[_0xf6f7('0x38')]['error'](_0x14977a,_0xf6f7('0xfc'));};AGIVertices['prototype'][_0xf6f7('0xfd')]=function(_0x4f92f9){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0xfe'),_0x4f92f9[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x4f92f9[_0xf6f7('0xff')])){return this[_0xf6f7('0x38')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x4f92f9[_0xf6f7('0x100')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x101'));}if(!this[_0xf6f7('0xa1')](_0x4f92f9[_0xf6f7('0x102')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0x103'));}if(!this[_0xf6f7('0xa1')](_0x4f92f9['ndassistant_url'])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xc2'));}this['channel'][_0xf6f7('0xed')]=!![];this[_0xf6f7('0x36')](_0x4f92f9);this[_0xf6f7('0x40')](_0x4f92f9[_0xf6f7('0x57')],'in','','');this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x104'),_0x4f92f9[_0xf6f7('0x57')]));var _0xcd4540=this[_0xf6f7('0x7a')][_0xf6f7('0xa3')](this,_0x4f92f9);if(_0xcd4540){for(var _0x12a95f in _0xcd4540){if(_0xcd4540[_0xf6f7('0x91')](_0x12a95f)){this['channel'][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x105'),_0x12a95f[_0xf6f7('0xf0')]()),_0xcd4540[_0x12a95f]);}}this[_0xf6f7('0x40')](_0xcd4540[_0xf6f7('0xf1')],_0xf6f7('0xf2'),_0xf6f7('0xfd'),'');if(_0xcd4540[_0xf6f7('0x106')]){this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x107'),_0xcd4540[_0xf6f7('0x106')]));var _0xecc6bf=this[_0xf6f7('0x38')][_0xf6f7('0x108')](_0xcd4540[_0xf6f7('0x106')]);try{fs[_0xf6f7('0x109')](_0xcd4540['audiofile']+_0xf6f7('0x10a'));}catch(_0x38839f){logger[_0xf6f7('0x2c')](_0x38839f);}return _0xecc6bf;}else{return this['channel']['noop'](util['format'](_0xf6f7('0x10b'),_0xcd4540[_0xf6f7('0xf1')]));}}return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4f92f9,_0xf6f7('0x10c'));};AGIVertices['prototype'][_0xf6f7('0x10d')]=function(_0x16d9f9){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0x10e'),_0x16d9f9['label']));return this['channel'][_0xf6f7('0xa6')]('end');};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x10f')]=function(_0x25a1ff){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x110'),_0x25a1ff[_0xf6f7('0xaa')]));var _0x5dcd1b='';if(_0x25a1ff[_0xf6f7('0x111')]){if(!this[_0xf6f7('0xa1')](_0x25a1ff[_0xf6f7('0x111')])){return this[_0xf6f7('0x38')]['error'](_0x25a1ff,_0xf6f7('0x112'));}else{var _0x7ea332=parseInt(_0x25a1ff['trunk_id'],0xa);if(isNaN(_0x7ea332)){_0x5dcd1b=_0x25a1ff['trunk_id'];}else{_0x5dcd1b=this['getTrunk'][_0xf6f7('0xa3')](this,_0x25a1ff[_0xf6f7('0x111')]);if(!_0x5dcd1b){return this[_0xf6f7('0x38')]['error'](_0x25a1ff,_0xf6f7('0x113'));}}}}else if(_0x25a1ff[_0xf6f7('0x114')]){_0x5dcd1b=_0x25a1ff[_0xf6f7('0x114')];}else{return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x25a1ff,_0xf6f7('0x112'));}var _0x5b9980=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0xe7'),[util['format'](_0xf6f7('0x115'),_0x5dcd1b,_0x25a1ff[_0xf6f7('0x45')]),_0x25a1ff[_0xf6f7('0x60')],_0x25a1ff[_0xf6f7('0x116')],_0x25a1ff['url']]);if(_0x5b9980[_0xf6f7('0x9f')]===-0x1){return _0x5b9980;}return this['channel']['noop'](util[_0xf6f7('0x97')](_0xf6f7('0xea'),_0xf6f7('0xe7')));};AGIVertices[_0xf6f7('0x10')]['finally']=function(_0x573cac){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x117'),_0x573cac[_0xf6f7('0xaa')]));return this['channel']['noop'](_0xf6f7('0x118'));};AGIVertices['prototype'][_0xf6f7('0xb')]=function(_0x4c033c){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x119'),_0x4c033c[_0xf6f7('0xaa')]));if(_0x4c033c[_0xf6f7('0xa4')]===0x0){return this['maxRetry'](_0x4c033c);}_0x4c033c[_0xf6f7('0xa4')]-=0x1;if(!this[_0xf6f7('0xa1')](_0x4c033c[_0xf6f7('0x11a')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4c033c,_0xf6f7('0x11b'));}var _0x4ce0c2=this[_0xf6f7('0x1d')]['sync'](this,_0x4c033c[_0xf6f7('0x11a')]);if(!_0x4ce0c2){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4c033c,_0xf6f7('0x11c'));}if(!this[_0xf6f7('0xa1')](_0x4c033c[_0xf6f7('0xd9')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0xf6f7('0xda'));}var _0xfeccb9=this[_0xf6f7('0x38')][_0xf6f7('0x11d')](_0x4ce0c2,_0x4c033c[_0xf6f7('0x11e')],_0x4c033c[_0xf6f7('0x11f')]);var _0x192bee=_0xfeccb9['result']?_0xfeccb9[_0xf6f7('0x9f')][_0xf6f7('0x9d')]():'';logger[_0xf6f7('0x2e')]('test',JSON[_0xf6f7('0x6c')](_0xfeccb9));if(_0xfeccb9[_0xf6f7('0x9f')]===-0x1){this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x4c033c,_0x192bee);return _0xfeccb9;}else if(_0xfeccb9[_0xf6f7('0x9c')]===_0xf6f7('0x60')){_0xfeccb9[_0xf6f7('0x9f')]=_0x192bee[_0xf6f7('0x93')]>=parseInt(_0x4c033c[_0xf6f7('0x120')])?'x':'i';}else{_0xfeccb9[_0xf6f7('0x9f')]=_0x192bee[_0xf6f7('0x93')]>=parseInt(_0x4c033c[_0xf6f7('0x120')])&&_0x192bee[_0xf6f7('0x93')]<=parseInt(_0x4c033c[_0xf6f7('0x11f')])?'x':'i';}var _0x10f532=this['getVariable'][_0xf6f7('0xa3')](this,_0x4c033c[_0xf6f7('0xd9')]);if(!_0x10f532){return this['channel'][_0xf6f7('0x2c')](_0x4c033c,_0xf6f7('0xdb'));}this['channel']['setVariable'](_0x10f532,_0x192bee);if(this[_0xf6f7('0xa1')](_0x4c033c['hiddendigitsnum'])){var _0xd56b7b=parseInt(_0x4c033c[_0xf6f7('0x121')],0xa);var _0x33eaa2=rs[_0xf6f7('0x122')]({'charset':'*','length':_0xd56b7b});var _0x1faa73=_0x192bee[_0xf6f7('0x93')];if(_0x1faa73>0x0){if(_0x1faa73>_0xd56b7b){this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x4c033c,_0x4c033c[_0xf6f7('0x123')]===_0xf6f7('0x124')?_0x33eaa2+_0x192bee[_0xf6f7('0x125')](_0xd56b7b):_0x192bee[_0xf6f7('0x125')](0x0,_0x1faa73-_0xd56b7b)+_0x33eaa2);}else{this['createSquareDetailsReport'][_0xf6f7('0xa3')](this,_0x4c033c,rs[_0xf6f7('0x122')]({'charset':'*','length':_0x1faa73}));}}else{this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x4c033c,'');}}else{this[_0xf6f7('0x36')]['sync'](this,_0x4c033c,_0x192bee);}return _0xfeccb9;};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xc')]=function(_0x3b9f2a){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x126'),_0x3b9f2a[_0xf6f7('0xaa')]));return this[_0xf6f7('0xb')](_0x3b9f2a);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x127')]=function(_0x5555a1){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x128'),_0x5555a1[_0xf6f7('0xaa')]));this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x5555a1,_0x5555a1['goalname']);return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format']('GOAL\x20%s',_0x5555a1[_0xf6f7('0x129')]));};AGIVertices['prototype']['awspolly']=function(_0x4d9465){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4d9465[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x4d9465[_0xf6f7('0x82')])||!this[_0xf6f7('0xa1')](_0x4d9465[_0xf6f7('0x86')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x12a'));}if(!this[_0xf6f7('0xa1')](_0x4d9465[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xc2'));}this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x12b'),_0x4d9465[_0xf6f7('0x57')]));var _0x2a2eb9=this[_0xf6f7('0x12c')][_0xf6f7('0xa3')](this,_0x4d9465);if(_0x2a2eb9){this['channel']['noop'](util['format'](_0xf6f7('0x12d'),_0x2a2eb9));var _0x42c400=this[_0xf6f7('0x38')]['streamFile'](_0x2a2eb9);try{fs['unlink'](_0x2a2eb9+_0xf6f7('0x10a'));}catch(_0x35b06a){logger[_0xf6f7('0x2c')](_0x35b06a);}return _0x42c400;}return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4d9465,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf6f7('0x10')]['awslex']=function(_0x4b7072){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4b7072[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x4b7072[_0xf6f7('0x82')])||!this[_0xf6f7('0xa1')](_0x4b7072[_0xf6f7('0x86')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0x12a'));}if(!this['isConfigured'](_0x4b7072[_0xf6f7('0x12e')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0x12f'));}if(!this[_0xf6f7('0xa1')](_0x4b7072[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0xc2'));}this[_0xf6f7('0x38')][_0xf6f7('0xed')]=!![];this[_0xf6f7('0x36')](_0x4b7072);this[_0xf6f7('0x40')](_0x4b7072[_0xf6f7('0x57')],'in','','');this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x130'),_0x4b7072[_0xf6f7('0x57')]));var _0x3afbee=this[_0xf6f7('0x85')][_0xf6f7('0xa3')](this,_0x4b7072);if(_0x3afbee){for(var _0x44df02 in _0x3afbee){if(_0x3afbee[_0xf6f7('0x91')](_0x44df02)&&_['isString'](_0x3afbee[_0x44df02])){this[_0xf6f7('0x38')][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x131'),_0x44df02[_0xf6f7('0xf0')]()),_0x3afbee[_0x44df02]);}}if(_[_0xf6f7('0x41')](_0x3afbee[_0xf6f7('0x71')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3afbee['message'],_0xf6f7('0xf2'),'amazonlex','');return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0x132'),_0x3afbee['message']));}}return this['channel']['error'](_0x4b7072,_0xf6f7('0x133'));};AGIVertices[_0xf6f7('0x10')]['googleasr']=function(_0x5cd6af){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x134'),_0x5cd6af[_0xf6f7('0xaa')],_0x5cd6af[_0xf6f7('0x60')]));if(!this['isConfigured'](_0x5cd6af[_0xf6f7('0x7f')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x135'));}var _0x505ba6=_0xf6f7('0x136');var _0x2ac050=util[_0xf6f7('0x97')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x549704=util['format'](_0xf6f7('0x95'),_0x2ac050,_0x505ba6);var _0x113721=!![];if(_0x5cd6af[_0xf6f7('0x137')]==='NOBEEP'){_0x113721=![];}var _0x2fa4b4=this[_0xf6f7('0x38')]['recordFile'](_0x2ac050,_0x505ba6,_0x5cd6af['intKey'],_0x5cd6af[_0xf6f7('0x60')],undefined,_0x113721);if(_0x2fa4b4[_0xf6f7('0x9f')]!==-0x1){this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')]('google\x20%s\x20file\x20created',_0x549704));var _0x4a3097=this['googleASR']['sync'](this,_0x5cd6af,_0x549704);if(_0x4a3097){for(var _0xef9856 in _0x4a3097){if(_0x4a3097['hasOwnProperty'](_0xef9856)){this[_0xf6f7('0x38')][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x138'),_0xef9856[_0xf6f7('0xf0')]()),_0x4a3097[_0xef9856]);}}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x139'),JSON[_0xf6f7('0x6c')](_0x4a3097)));}}return _0x2fa4b4;};AGIVertices[_0xf6f7('0x10')]['tildeasr']=function(_0x1f9fe1){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x13a'),_0x1f9fe1[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x1f9fe1[_0xf6f7('0x8a')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x13b'));}if(!this[_0xf6f7('0xa1')](_0x1f9fe1[_0xf6f7('0x13c')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('no\x20appsecret\x20configured');}var _0x8a2007='wav';var _0x6b7662=util['format'](_0xf6f7('0x13d'),FILES_PATH,rs[_0xf6f7('0x122')](0x4));var _0x2891ce=util[_0xf6f7('0x97')](_0xf6f7('0x95'),_0x6b7662,_0x8a2007);var _0x17024d=!![];if(_0x1f9fe1[_0xf6f7('0x137')]===_0xf6f7('0x13e')){_0x17024d=![];}var _0x25a96d=this[_0xf6f7('0x38')]['recordFile'](_0x6b7662,_0x8a2007,_0x1f9fe1['intKey'],_0x1f9fe1[_0xf6f7('0x60')],undefined,_0x17024d);if(_0x25a96d[_0xf6f7('0x9f')]!==-0x1){this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x13f'),_0x2891ce));var _0x10ff24=this[_0xf6f7('0x89')][_0xf6f7('0xa3')](this,_0x1f9fe1,_0x2891ce);if(_0x10ff24){for(var _0x5a2c82 in _0x10ff24){if(_0x10ff24[_0xf6f7('0x91')](_0x5a2c82)){this[_0xf6f7('0x38')][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x140'),_0x5a2c82[_0xf6f7('0xf0')]()),_0x10ff24[_0x5a2c82]);}}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x141'),JSON[_0xf6f7('0x6c')](_0x10ff24)));}}return _0x25a96d;};AGIVertices[_0xf6f7('0x10')]['gotoc']=function(_0x50f191){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x142'),_0x50f191['label']));return this[_0xf6f7('0x38')][_0xf6f7('0x143')](_0x50f191[_0xf6f7('0x144')],_0x50f191[_0xf6f7('0x145')],_0x50f191[_0xf6f7('0x146')]);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x147')]=function(_0x16b19f){logger['info'](util['format'](_0xf6f7('0x148'),_0x16b19f[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x16b19f[_0xf6f7('0x149')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x16b19f,_0xf6f7('0x14a'));}try{var _0xbf6ea=eval(_0x16b19f[_0xf6f7('0x149')])?_0xf6f7('0x14b'):'false';this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x14c'),_0x16b19f[_0xf6f7('0x149')],_0xbf6ea));return{'code':0xc8,'result':_0xbf6ea};}catch(_0x5040a6){return{'code':0xc8,'result':_0xf6f7('0x14d')};}};AGIVertices['prototype'][_0xf6f7('0x14e')]=function(_0x5a4742){logger['info'](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a4742[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x5a4742[_0xf6f7('0x14f')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x5a4742,'no\x20interval\x20configured');}var _0x319e14=this['getIntervals'][_0xf6f7('0xa3')](this,_0x5a4742[_0xf6f7('0x14f')]);if(!_0x319e14){return this[_0xf6f7('0x38')]['error'](_0x5a4742,'no\x20intervals\x20found');}for(var _0x1805b1=0x0;_0x1805b1<_0x319e14[_0xf6f7('0x93')];_0x1805b1+=0x1){var _0x4ca351=this[_0xf6f7('0x38')][_0xf6f7('0x9b')](util[_0xf6f7('0x97')](_0xf6f7('0x150'),_0x319e14[_0x1805b1]));if(_0x4ca351[_0xf6f7('0x9f')]===-0x1){return _0x4ca351;}logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x151'),_0x319e14[_0x1805b1],_0x4ca351[_0xf6f7('0x9c')]));if(_0x4ca351[_0xf6f7('0x9c')]===_0xf6f7('0x14b')){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x151'),_0x319e14[_0x1805b1],_0xf6f7('0x14b')));this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x151'),_0x319e14[_0x1805b1],_0xf6f7('0x14b')));return{'code':0xc8,'result':'true'};}else{logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x151'),_0x319e14[_0x1805b1],_0xf6f7('0x14d')));this[_0xf6f7('0x38')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x319e14[_0x1805b1],_0xf6f7('0x14d')));}}return{'code':0xc8,'result':_0xf6f7('0x14d')};};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x152')]=function(_0x5be61f){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5be61f['label']));return this['channel'][_0xf6f7('0x152')]();};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x153')]=function(_0x265a3f){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x154'),_0x265a3f['label']));if(!this[_0xf6f7('0xa1')](_0x265a3f[_0xf6f7('0x7f')])){return this['channel'][_0xf6f7('0xa6')](_0xf6f7('0x135'));}var _0x54383d=_0xf6f7('0x136');var _0xbcf3d1=util[_0xf6f7('0x97')](_0xf6f7('0x13d'),FILES_PATH,rs[_0xf6f7('0x122')](0x4));var _0xb6f6b0=util[_0xf6f7('0x97')]('%s.%s',_0xbcf3d1,_0x54383d);var _0x36846c=!![];if(_0x265a3f[_0xf6f7('0x137')]===_0xf6f7('0x13e')){_0x36846c=![];}var _0x120fe4=this[_0xf6f7('0x38')]['recordFile'](_0xbcf3d1,_0x54383d,_0x265a3f[_0xf6f7('0x155')],_0x265a3f[_0xf6f7('0x60')],undefined,_0x36846c);if(_0x120fe4[_0xf6f7('0x9f')]!==-0x1){this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x156'),_0xb6f6b0));var _0x3a4b38=this[_0xf6f7('0x7e')][_0xf6f7('0xa3')](this,_0x265a3f,_0xb6f6b0);if(_0x3a4b38){for(var _0x1d8d63 in _0x3a4b38){if(_0x3a4b38[_0xf6f7('0x91')](_0x1d8d63)){this['channel'][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x157'),_0x1d8d63[_0xf6f7('0xf0')]()),_0x3a4b38[_0x1d8d63]);}}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0x158'),JSON['stringify'](_0x3a4b38)));}}return _0x120fe4;};AGIVertices[_0xf6f7('0x10')]['ispeechtts']=function(_0x4df1fc){logger[_0xf6f7('0x2e')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4df1fc[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x4df1fc[_0xf6f7('0x7f')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x135'));}if(!this[_0xf6f7('0xa1')](_0x4df1fc[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('no\x20text\x20configured');}this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x159'),_0x4df1fc[_0xf6f7('0x57')]));var _0x2a3e65=this[_0xf6f7('0x7b')][_0xf6f7('0xa3')](this,_0x4df1fc);if(_0x2a3e65){this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x156'),_0x2a3e65));var _0x5d3c06=this[_0xf6f7('0x38')]['streamFile'](_0x2a3e65,_0x4df1fc[_0xf6f7('0x155')]);try{fs[_0xf6f7('0x109')](_0x2a3e65+_0xf6f7('0x10a'));}catch(_0x3efbeb){logger['error'](_0x3efbeb);}return _0x5d3c06;}return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4df1fc,_0xf6f7('0x15a'));};AGIVertices[_0xf6f7('0x10')]['login']=function(_0x1d8b9c){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1d8b9c[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x1d8b9c['findBy'])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x1d8b9c,_0xf6f7('0x15b'));}logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x15c'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x1d8b9c[_0xf6f7('0x15d')]));var _0xb60b9b=this[_0xf6f7('0x50')]['sync'](this,_0x1d8b9c['findBy']);if(_0xb60b9b){logger['info'](util[_0xf6f7('0x97')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x1d8b9c[_0xf6f7('0x15d')]));this['channel']['noop'](util['format'](_0xf6f7('0x15e'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x1d8b9c[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x15f')};}else{logger[_0xf6f7('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf6f7('0x38')]['callerid'],_0x1d8b9c[_0xf6f7('0x15d')]));this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0x160'),this['channel']['callerid'],_0x1d8b9c[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x161')};}};AGIVertices[_0xf6f7('0x10')]['logout']=function(_0x2282cb){logger['info'](util['format'](_0xf6f7('0x162'),_0x2282cb['label']));if(!this[_0xf6f7('0xa1')](_0x2282cb[_0xf6f7('0x15d')])){return this['channel'][_0xf6f7('0x2c')](_0x2282cb,_0xf6f7('0x15b'));}logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xf6f7('0x3c')],_0x2282cb[_0xf6f7('0x15d')]));var _0x14a9eb=this[_0xf6f7('0x4d')][_0xf6f7('0xa3')](this,_0x2282cb['findBy']);if(_0x14a9eb){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x2282cb[_0xf6f7('0x15d')]));this['channel']['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x15e'),this[_0xf6f7('0x38')]['callerid'],_0x2282cb[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x15f')};}else{logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x160'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x2282cb[_0xf6f7('0x15d')]));this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x160'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x2282cb[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x161')};}};AGIVertices[_0xf6f7('0x10')]['math']=function(_0x56286e){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x56286e[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x56286e['operation'])){return this['channel'][_0xf6f7('0x2c')](_0x56286e,'no\x20operation\x20configured');}this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x163'),_0x56286e[_0xf6f7('0x164')]));var _0x59eff0=eval(_0x56286e['operation']);if(!this['isConfigured'](_0x56286e[_0xf6f7('0xd9')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xda'));}var _0x4b7aa8=this['getVariable'][_0xf6f7('0xa3')](this,_0x56286e['variable_id']);if(!_0x4b7aa8){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x56286e,_0xf6f7('0xdb'));}if(_[_0xf6f7('0x96')](_0x59eff0)){var _0x5bf8c8=this;_0x59eff0['forEach'](function(_0x3af3d5,_0x450ffe){_0x5bf8c8[_0xf6f7('0x38')][_0xf6f7('0x98')](util[_0xf6f7('0x97')](_0xf6f7('0x165'),_0x4b7aa8,_0x450ffe),_0x3af3d5);});return this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x166'),_0x4b7aa8));}else{return this[_0xf6f7('0x38')]['setVariable'](_0x4b7aa8,_0x59eff0);}};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xa')]=function(_0x364518){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x167'),_0x364518['label']));if(_0x364518['retry']===0x0){return this[_0xf6f7('0xa2')](_0x364518);}_0x364518['retry']-=0x1;if(!this[_0xf6f7('0xa1')](_0x364518[_0xf6f7('0x11a')])){return this['channel'][_0xf6f7('0x2c')](_0x364518,'no\x20file\x20audio\x20selected');}var _0x5d8391=this[_0xf6f7('0x1d')][_0xf6f7('0xa3')](this,_0x364518[_0xf6f7('0x11a')]);if(!_0x5d8391){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x364518,_0xf6f7('0x11c'));}var _0x23b9ef=this[_0xf6f7('0x38')][_0xf6f7('0x11d')](_0x5d8391,_0x364518[_0xf6f7('0x11e')],_0x364518[_0xf6f7('0x168')]);var _0x1414e3=_0x23b9ef['result'];if(_0x23b9ef['result']===-0x1){this[_0xf6f7('0x36')]['sync'](this,_0x364518,'-1');return _0x23b9ef;}else if(_0x23b9ef[_0xf6f7('0x9c')]==='timeout'){_0x23b9ef['result']=_0x23b9ef[_0xf6f7('0x9f')][_0xf6f7('0x93')]>0x0?_0x23b9ef[_0xf6f7('0x9f')]:'t';}else if(_[_0xf6f7('0x43')](_0x23b9ef[_0xf6f7('0x9f')])){_0x23b9ef['result']='#';_0x1414e3='#';}if(!this[_0xf6f7('0xa1')](_0x364518[_0xf6f7('0xd9')])){this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xda'));}else{var _0x5c94c7=this[_0xf6f7('0x9b')][_0xf6f7('0xa3')](this,_0x364518[_0xf6f7('0xd9')]);if(!_0x5c94c7){return this[_0xf6f7('0x38')]['error'](_0x364518,_0xf6f7('0xdb'));}this[_0xf6f7('0x38')][_0xf6f7('0x98')](_0x5c94c7,_0x1414e3);}this['createSquareDetailsReport']['sync'](this,_0x364518,_0x1414e3);return _0x23b9ef;};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0xa6')]=function(_0x4c82dc){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x169'),_0x4c82dc['label']));return this['channel'][_0xf6f7('0xa6')](_0x4c82dc['output']||_0x4c82dc['label']);};AGIVertices[_0xf6f7('0x10')]['pause']=function(_0x3542b1){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0x16a'),_0x3542b1[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x3542b1['findBy'])){return this[_0xf6f7('0x38')]['error'](_0x3542b1,'no\x20find\x20by\x20configured');}logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x15c'),this[_0xf6f7('0x38')]['callerid'],_0x3542b1['findBy']));var _0x16ff0a=this[_0xf6f7('0x4a')][_0xf6f7('0xa3')](this,_0x3542b1[_0xf6f7('0x16b')]);var _0x139b04=this[_0xf6f7('0x4b')]['sync'](this,_0x3542b1[_0xf6f7('0x15d')],_0x16ff0a);if(_0x139b04){logger[_0xf6f7('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xf6f7('0x3c')],_0x3542b1[_0xf6f7('0x15d')]));this['channel']['noop'](util['format'](_0xf6f7('0x15e'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x3542b1['findBy']));return{'code':0xc8,'result':_0xf6f7('0x15f')};}else{logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x160'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x3542b1[_0xf6f7('0x15d')]));this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x15e'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x3542b1['findBy']));return{'code':0xc8,'result':_0xf6f7('0x161')};}};AGIVertices[_0xf6f7('0x10')]['playback']=function(_0xdc87c9){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x16c'),_0xdc87c9[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0xdc87c9[_0xf6f7('0x11a')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0xdc87c9,'no\x20file\x20audio\x20selected');}var _0x57689b=this[_0xf6f7('0x1d')][_0xf6f7('0xa3')](this,_0xdc87c9['file_id']);if(!_0x57689b){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0xdc87c9,_0xf6f7('0x11c'));}var _0x3461ee=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0x16d'),[_0x57689b,_0xdc87c9[_0xf6f7('0x116')]]);if(_0x3461ee[_0xf6f7('0x9f')]===-0x1){return _0x3461ee;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xc0'),_0xf6f7('0x16d'),_0x57689b));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x16e')]=function(_0x457659){logger[_0xf6f7('0x2e')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x457659[_0xf6f7('0xaa')]));if(!this['isConfigured'](_0x457659['queue_id'])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x457659,'no\x20queue\x20selected');}var _0x5006bf='';var _0x101afa=parseInt(_0x457659[_0xf6f7('0x16f')],0xa);if(isNaN(_0x101afa)){_0x5006bf=_0x457659[_0xf6f7('0x16f')];}else{_0x5006bf=this['getVoiceQueue'][_0xf6f7('0xa3')](this,_0x457659['queue_id']);if(!_0x5006bf){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x457659,_0xf6f7('0x170'));}}var _0x391534='';if(this[_0xf6f7('0xa1')](_0x457659[_0xf6f7('0x11a')])){var _0x208006=this[_0xf6f7('0x1d')][_0xf6f7('0xa3')](this,_0x457659[_0xf6f7('0x11a')]);if(_0x208006){_0x391534=_0x208006;}}this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x457659,_0x5006bf);if(_0x457659['opts'][_0xf6f7('0x171')]('x')<0x0){_0x457659[_0xf6f7('0x116')]+='x';}if(_0x457659[_0xf6f7('0x116')][_0xf6f7('0x171')]('X')<0x0){_0x457659[_0xf6f7('0x116')]+='X';}this[_0xf6f7('0x38')]['setVariable'](_0xf6f7('0x172'),_0x5006bf?_0x5006bf[_0xf6f7('0x173')]():'');var _0x4edf9d=this[_0xf6f7('0x38')][_0xf6f7('0x52')](_0xf6f7('0x174'),[_0x5006bf,_0x457659[_0xf6f7('0x116')],_0x457659['url'],_0x391534,_0x457659['timeout'],_0x457659[_0xf6f7('0x6')],_0x457659[_0xf6f7('0x175')],_0x457659[_0xf6f7('0x176')],'',_0x457659[_0xf6f7('0x177')]]);if(_0x4edf9d[_0xf6f7('0x9f')]===-0x1){return _0x4edf9d;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xc0'),'QUEUE',_0x5006bf));};AGIVertices[_0xf6f7('0x10')]['record']=function(_0x1b5526){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x178'),_0x1b5526[_0xf6f7('0xaa')]));var _0x2e236c=_0x1b5526[_0xf6f7('0x179')]||_0xf6f7('0x136');var _0x78dad4=util[_0xf6f7('0x97')]('%s_%s',this['channel'][_0xf6f7('0x3b')],rs['generate'](0x5));var _0x552fc2=util[_0xf6f7('0x97')](_0xf6f7('0x17a'),FILES_PATH,_0x78dad4,_0x2e236c);var _0x50769f=util[_0xf6f7('0x97')]('%s/recordings/%s',FILES_PATH,_0x78dad4);this[_0xf6f7('0x3a')][_0xf6f7('0xa3')](this,_0x1b5526,_0x78dad4,_0x552fc2);this['channel'][_0xf6f7('0x98')](_0xf6f7('0x17b'),_0x78dad4);logger[_0xf6f7('0x2e')](_0xf6f7('0x17c'),_0x50769f,_0x2e236c,_0x1b5526[_0xf6f7('0x17d')],_0x1b5526[_0xf6f7('0x60')]);return this[_0xf6f7('0x38')][_0xf6f7('0x17e')](_0x50769f,_0x2e236c,_0x1b5526[_0xf6f7('0x17d')],_0x1b5526[_0xf6f7('0x60')],undefined,!![]);};AGIVertices['prototype'][_0xf6f7('0x17f')]=function(_0x3f9722){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x180'),_0x3f9722[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x3f9722[_0xf6f7('0xe9')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x181'));}var _0x1d9ebe=this[_0xf6f7('0x182')][_0xf6f7('0xa3')](this,_0x3f9722);logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x183'),util['inspect'](_0x1d9ebe,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3f9722[_0xf6f7('0xd9')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x184'));}var _0x17583d=this[_0xf6f7('0x9b')]['sync'](this,_0x3f9722['variable_id']);if(!_0x17583d){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x3f9722,_0xf6f7('0xdb'));}this['channel']['setVariable'](util[_0xf6f7('0x97')](_0xf6f7('0x185'),_0x17583d),_0x1d9ebe[_0xf6f7('0x6f')]?_0x1d9ebe[_0xf6f7('0x6f')]:_0xf6f7('0x186'));this['channel']['setVariable'](util['format'](_0xf6f7('0x187'),_0x17583d),_0x1d9ebe[_0xf6f7('0x70')]?_0x1d9ebe[_0xf6f7('0x70')]:'OK');if(_0x1d9ebe[_0xf6f7('0x6d')]){try{this[_0xf6f7('0x94')](_0x1d9ebe[_0xf6f7('0x6d')],_0x17583d);}catch(_0x26392e){logger['error'](util['format'](_0xf6f7('0x188'),_0x17583d));}}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')]('variable\x20%s\x20set',_0x17583d));};AGIVertices['prototype'][_0xf6f7('0x189')]=function(_0x5cb98a){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5cb98a['label']));return this[_0xf6f7('0x38')]['sayDigits'](_0x5cb98a[_0xf6f7('0x18a')][_0xf6f7('0xd7')](/\s+/g,''),_0x5cb98a[_0xf6f7('0x17d')]);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x18b')]=function(_0x31ac23){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x18c'),_0x31ac23['label']));return this[_0xf6f7('0x38')][_0xf6f7('0x18d')](_0x31ac23['number'][_0xf6f7('0xd7')](/\s+/g,''),_0x31ac23[_0xf6f7('0x17d')]);};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x18e')]=function(_0x37a2c2){logger['info'](util[_0xf6f7('0x97')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x37a2c2['label']));return this[_0xf6f7('0x38')][_0xf6f7('0x18f')](_0x37a2c2['text'],_0x37a2c2['escape_digits']);};AGIVertices['prototype'][_0xf6f7('0x190')]=function(_0x539c53){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x191'),_0x539c53[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x539c53[_0xf6f7('0x192')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('no\x20mail\x20account\x20configured');}var _0xd43b8d=this[_0xf6f7('0x21')][_0xf6f7('0xa3')](this,_0x539c53[_0xf6f7('0x192')]);if(!_0xd43b8d||!_0xd43b8d[_0xf6f7('0x193')]){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x539c53,_0xf6f7('0x194'));}var _0x5bbec7={'from':util[_0xf6f7('0x97')](_0xf6f7('0x195'),_0xd43b8d['name'],_0xd43b8d[_0xf6f7('0x196')]||_0xd43b8d[_0xf6f7('0x193')][_0xf6f7('0x197')]),'to':_0x539c53['to']||'','cc':_0x539c53['cc']||'','bcc':_0x539c53[_0xf6f7('0x198')]||'','subject':_0x539c53['subject'],'html':_0x539c53[_0xf6f7('0x57')],'text':_0x539c53[_0xf6f7('0x57')]};if(this[_0xf6f7('0xa1')](_0x539c53[_0xf6f7('0x199')])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x5bbec7));this['createSquareDetailsReport'][_0xf6f7('0xa3')](this,_0x539c53,_0x539c53['account_id']);this['channel']['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x19a'),_0xd43b8d[_0xf6f7('0x16')]));this['sendMailMessage'][_0xf6f7('0xa3')](this,_0xd43b8d[_0xf6f7('0x19b')],_0x5bbec7);return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x19c')]=function(_0x2af612){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x19d'),_0x2af612[_0xf6f7('0xaa')]));return this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x19e')]=function(_0x3b7c1a){logger[_0xf6f7('0x2e')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3b7c1a[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x3b7c1a['sms_account_id'])){return this['channel'][_0xf6f7('0xa6')](_0xf6f7('0x19f'));}var _0xeeb26a=this['getSmsAccount'][_0xf6f7('0xa3')](this,_0x3b7c1a[_0xf6f7('0x1a0')]);if(!_0xeeb26a){return this[_0xf6f7('0x38')]['error'](_0x3b7c1a,_0xf6f7('0x1a1'));}var _0x34c2ea={'body':_0x3b7c1a[_0xf6f7('0x1a2')],'phone':_0x3b7c1a['to']||'','SmsAccountId':_0xeeb26a['id']};logger['debug'](_0xf6f7('0x1a3'),JSON[_0xf6f7('0x6c')](_0x34c2ea));this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x3b7c1a,_0x3b7c1a[_0xf6f7('0x1a0')]);this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x1a4'),_0xeeb26a[_0xf6f7('0x16')]));this[_0xf6f7('0x35')][_0xf6f7('0xa3')](this,_0x34c2ea);return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x1a5'));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1a6')]=function(_0x512c64){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x1a7'),_0x512c64[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x512c64[_0xf6f7('0xd9')])){return this['channel'][_0xf6f7('0x2c')](_0x512c64,_0xf6f7('0x1a8'));}var _0x35f533=this['getVariable'][_0xf6f7('0xa3')](this,_0x512c64[_0xf6f7('0xd9')]);if(!_0x35f533){return this['channel'][_0xf6f7('0x2c')](_0x512c64,_0xf6f7('0xdb'));}return this[_0xf6f7('0x38')][_0xf6f7('0x98')](_0x35f533,_0x512c64[_0xf6f7('0x1a9')]);};AGIVertices[_0xf6f7('0x10')]['start']=function(_0x5cbc64){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x1aa'),_0x5cbc64['label']));this[_0xf6f7('0x38')][_0xf6f7('0xa6')]('START\x20CALLY\x20SQUARE');var _0x2ed3fb=this[_0xf6f7('0x38')]['getVariable'](_0xf6f7('0x1ab'));if(!_[_0xf6f7('0x43')](_0x2ed3fb[_0xf6f7('0x9c')])){this[_0xf6f7('0x38')]['uniqueid']=_0x2ed3fb[_0xf6f7('0x9c')];}if(_0x5cbc64[_0xf6f7('0xb4')]===_0xf6f7('0x1ac')){this['channel'][_0xf6f7('0xa6')](_0xf6f7('0x1ad'));return this[_0xf6f7('0x38')]['answer']();}return this[_0xf6f7('0x38')]['noop'](_0xf6f7('0x1ae'));};AGIVertices[_0xf6f7('0x10')]['subproject']=function(_0x5aa1fb){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x1af'),_0x5aa1fb['label']));if(!this[_0xf6f7('0xa1')](_0x5aa1fb[_0xf6f7('0x1b0')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x5aa1fb,_0xf6f7('0x1b1'));}var _0x35e57b=this[_0xf6f7('0x14')][_0xf6f7('0xa3')](this,_0x5aa1fb[_0xf6f7('0x1b0')]);if(!this['isConfigured'](_0x35e57b)){return this['channel'][_0xf6f7('0x2c')](_0x5aa1fb,util[_0xf6f7('0x97')](_0xf6f7('0x1b2'),_0x5aa1fb[_0xf6f7('0x1b0')]));}if(_0x35e57b===this[_0xf6f7('0x38')][_0xf6f7('0x39')]){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x5aa1fb,_0xf6f7('0x1b3'));}this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x5aa1fb,_0x35e57b);var _0x2e02f7=this['channel'][_0xf6f7('0x52')](_0xf6f7('0x1b4'),util[_0xf6f7('0x97')](_0xf6f7('0x1b5'),config[_0xf6f7('0x6')][_0xf6f7('0x1b6')]||'127.0.0.1',_0x35e57b,this[_0xf6f7('0x38')][_0xf6f7('0x39')]));if(_0x2e02f7[_0xf6f7('0x9f')]===-0x1){return _0x2e02f7;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xc0'),_0xf6f7('0x1b4'),_0x35e57b));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1b7')]=function(_0x11238b){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0x1b8'),_0x11238b[_0xf6f7('0xaa')]));var _0x58200c=this['shellCommand']['sync'](this,_0x11238b[_0xf6f7('0xb2')]);this[_0xf6f7('0x36')][_0xf6f7('0xa3')](this,_0x11238b,_0x11238b[_0xf6f7('0xb2')]);if(this[_0xf6f7('0xa1')](_0x11238b['variable_id'])){var _0x37d47e=this[_0xf6f7('0x9b')][_0xf6f7('0xa3')](this,_0x11238b[_0xf6f7('0xd9')]);if(_0x37d47e){this[_0xf6f7('0x38')][_0xf6f7('0x98')](_0x37d47e,_0x58200c);return this[_0xf6f7('0x38')]['noop'](util[_0xf6f7('0x97')](_0xf6f7('0x1b9'),_0x11238b[_0xf6f7('0xb2')],_0x37d47e));}}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x1ba'),_0x11238b[_0xf6f7('0xb2')]));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1bb')]=function(_0x13f441){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x1bc'),_0x13f441['label']));_0x13f441['text']=_0x13f441[_0xf6f7('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf6f7('0xa1')](_0x13f441['apiKey'])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0x1bd'));}if(!this['isConfigured'](_0x13f441['text'])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xc2'));}this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x1be'),_0x13f441[_0xf6f7('0x57')]));var _0x175755=this[_0xf6f7('0x54')][_0xf6f7('0xa3')](this,_0x13f441);if(_0x175755){this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x1bf'),_0x175755));var _0x73b8b5=this[_0xf6f7('0x38')][_0xf6f7('0x108')](_0x175755);try{fs[_0xf6f7('0x109')](_0x175755+_0xf6f7('0x10a'));}catch(_0x1038ad){logger[_0xf6f7('0x2c')](_0x1038ad);}return _0x73b8b5;}return this['channel']['error'](_0x13f441,_0xf6f7('0x1c0'));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1c1')]=function(_0x435bb6){logger[_0xf6f7('0x2e')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x435bb6[_0xf6f7('0xaa')]));_0x435bb6[_0xf6f7('0x57')]=_0x435bb6['text'][_0xf6f7('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf6f7('0xa1')](_0x435bb6[_0xf6f7('0x57')])){return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](_0xf6f7('0xc2'));}this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x1c2'),_0x435bb6['text']));var _0x542b7d=this[_0xf6f7('0x5d')][_0xf6f7('0xa3')](this,_0x435bb6);if(_0x542b7d){this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')]('Google\x20TTS\x20%s\x20file\x20created',_0x542b7d));var _0x1c93ef=this[_0xf6f7('0x38')][_0xf6f7('0x108')](_0x542b7d);try{fs[_0xf6f7('0x109')](_0x542b7d+'.wav');}catch(_0x4d9354){logger['error'](_0x4d9354);}return _0x1c93ef;}return this[_0xf6f7('0x38')]['error'](_0x435bb6,_0xf6f7('0x1c3'));};AGIVertices[_0xf6f7('0x10')]['unpause']=function(_0x4b4de0){logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x1c4'),_0x4b4de0[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x4b4de0[_0xf6f7('0x15d')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x4b4de0,_0xf6f7('0x15b'));}logger['info'](util[_0xf6f7('0x97')](_0xf6f7('0x15c'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x4b4de0['findBy']));var _0x255072=this[_0xf6f7('0x4c')][_0xf6f7('0xa3')](this,_0x4b4de0['findBy']);if(_0x255072){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x15e'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x4b4de0[_0xf6f7('0x15d')]));this['channel'][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0x15e'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x4b4de0[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x15f')};}else{logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x4b4de0[_0xf6f7('0x15d')]));this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util['format'](_0xf6f7('0x160'),this[_0xf6f7('0x38')][_0xf6f7('0x3c')],_0x4b4de0[_0xf6f7('0x15d')]));return{'code':0xc8,'result':_0xf6f7('0x161')};}};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1c5')]=function(_0x1ab39c){logger[_0xf6f7('0x2e')](util['format'](_0xf6f7('0x1c6'),_0x1ab39c[_0xf6f7('0xaa')]));var _0x59b15e=this[_0xf6f7('0x38')][_0xf6f7('0x52')]('VOICEMAIL',[_0x1ab39c[_0xf6f7('0x1c7')],_0x1ab39c[_0xf6f7('0x73')]]);if(_0x59b15e['result']===-0x1){return _0x59b15e;}return this[_0xf6f7('0x38')][_0xf6f7('0xa6')](util[_0xf6f7('0x97')](_0xf6f7('0xc0'),_0xf6f7('0x1c8'),_0x1ab39c[_0xf6f7('0x1c7')]));};AGIVertices[_0xf6f7('0x10')][_0xf6f7('0x1c9')]=function(_0x3f089b){logger[_0xf6f7('0x2e')](util[_0xf6f7('0x97')](_0xf6f7('0x1ca'),_0x3f089b[_0xf6f7('0xaa')]));if(!this[_0xf6f7('0xa1')](_0x3f089b[_0xf6f7('0xd9')])){return this[_0xf6f7('0x38')][_0xf6f7('0x2c')](_0x3f089b,_0xf6f7('0x1a8'));}var _0x1ac636=this['getVariable'][_0xf6f7('0xa3')](this,_0x3f089b[_0xf6f7('0xd9')]);if(!_0x1ac636){return this['channel'][_0xf6f7('0x2c')](_0x3f089b,_0xf6f7('0xdb'));}var _0x444021=this[_0xf6f7('0x38')][_0xf6f7('0x9b')](_0x1ac636);return{'code':0xc8,'result':_0x444021[_0xf6f7('0x9c')]?_0x444021['extra']:'-'};};String[_0xf6f7('0x10')][_0xf6f7('0x9a')]=function(_0x546033,_0x116d6b){return this[_0xf6f7('0x99')](_0x546033)[_0xf6f7('0x1cb')](_0x116d6b);};module[_0xf6f7('0x1cc')]=AGIVertices; \ No newline at end of file +var _0x9957=['Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Skipped\x20Answer','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','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','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','priority','accountcode','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','url','method','timeout','number','includes','POST','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','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','model','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','getdigits','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','awsPolly','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr'];(function(_0x481503,_0x5cd37a){var _0x365670=function(_0x2425b2){while(--_0x2425b2){_0x481503['push'](_0x481503['shift']());}};_0x365670(++_0x5cd37a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var fs=require('fs');var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var sh=require(_0x7995('0x2'));var odbc=require(_0x7995('0x3'))();var rs=require('randomstring');var moment=require(_0x7995('0x4'));var Mustache=require(_0x7995('0x5'));var rp=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('agi');var config=require(_0x7995('0x8'));var scripts=require(_0x7995('0x9'));var FILES_PATH=_0x7995('0xa');var recursiveMapAttributes=[_0x7995('0xb'),_0x7995('0xc')];var verticesWithRetry=[_0x7995('0xd'),'getdigits',_0x7995('0xe')];var AGIVertices=function(_0x1cad37,_0x4a64f7,_0xa2e5f0){this[_0x7995('0xf')]=_0x1cad37;this[_0x7995('0x10')]=_0x4a64f7;this[_0x7995('0x11')]=_0xa2e5f0;};AGIVertices[_0x7995('0x12')][_0x7995('0x13')]=function(_0x341672,_0x524f7b){this[_0x7995('0x10')][_0x7995('0x14')](_0x341672)['then'](function(_0xb0c872){_0x524f7b(null,_0xb0c872?_0xb0c872[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x385f00){_0x524f7b(_0x385f00);});};AGIVertices[_0x7995('0x12')][_0x7995('0x17')]=function(_0x2bbe7a,_0x4cc004){this['rpc'][_0x7995('0x18')](_0x2bbe7a)[_0x7995('0x19')](function(_0x24b5bb){_0x4cc004(null,_0x24b5bb?_0x24b5bb[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x1a5310){_0x4cc004(_0x1a5310);});};AGIVertices[_0x7995('0x12')][_0x7995('0x1a')]=function(_0x5377e5,_0x2eeacc){this['rpc'][_0x7995('0x1b')](_0x5377e5)[_0x7995('0x19')](function(_0x43d4b8){_0x2eeacc(null,_0x43d4b8?_0x43d4b8[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x37a7d4){_0x2eeacc(_0x37a7d4);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x2536c8,_0x5e6f90){this['rpc'][_0x7995('0x1c')](_0x2536c8)[_0x7995('0x19')](function(_0x4cbe10){_0x5e6f90(null,_0x4cbe10?_0x4cbe10[_0x7995('0x1d')]:![]);})['catch'](function(_0x4b1a8e){_0x5e6f90(_0x4b1a8e);});};AGIVertices[_0x7995('0x12')][_0x7995('0x1e')]=function(_0x350fd9,_0x1a8568){this[_0x7995('0x10')][_0x7995('0x1f')](_0x350fd9)['then'](function(_0x32a09a){_0x1a8568(null,_0x32a09a?_0x32a09a[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x285437){_0x1a8568(_0x285437);});};AGIVertices[_0x7995('0x12')][_0x7995('0x20')]=function(_0x475351,_0x472195){this['rpc'][_0x7995('0x21')](_0x475351)[_0x7995('0x19')](function(_0x401dc3){_0x472195(null,_0x401dc3?_0x401dc3[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x2a307e){_0x472195(_0x2a307e);});};AGIVertices['prototype'][_0x7995('0x22')]=function(_0x5911c3,_0x229742){var _0x49bc7e=this;this[_0x7995('0x10')][_0x7995('0x23')](_0x5911c3)[_0x7995('0x19')](function(_0x4b6f99){_0x229742(null,_0x4b6f99?_0x49bc7e[_0x7995('0x24')](_0x4b6f99['save_name']):![]);})[_0x7995('0x16')](function(_0x3250e0){_0x229742(_0x3250e0);});};AGIVertices[_0x7995('0x12')]['getMailAccount']=function(_0x530611,_0x48e573){this[_0x7995('0x10')][_0x7995('0x25')](_0x530611)[_0x7995('0x19')](function(_0x2b874d){_0x48e573(null,_0x2b874d?_0x2b874d:![]);})[_0x7995('0x16')](function(_0x1ca460){_0x48e573(_0x1ca460);});};AGIVertices['prototype']['sendMailMessage']=function(_0xfa8f15,_0x5524af,_0x553671){this[_0x7995('0x11')][_0x7995('0x26')](_0xfa8f15,_0x5524af)[_0x7995('0x19')](function(){_0x553671(null);})[_0x7995('0x16')](function(_0x510841){_0x553671(_0x510841);});};AGIVertices[_0x7995('0x12')][_0x7995('0x27')]=function(_0x5dd802,_0x48db25){this['rpc'][_0x7995('0x28')](_0x5dd802)[_0x7995('0x19')](function(_0x4a176f){if(_0x4a176f){if(_0x4a176f[_0x7995('0x29')]){_0x48db25(null,[_0x4a176f['interval']]);}else{_0x48db25(null,_[_0x7995('0x2a')](_0x4a176f[_0x7995('0x2b')],_0x7995('0x2c')));}}else{_0x48db25(null,![]);}})['catch'](function(_0x52d76d){_0x48db25(_0x52d76d);});};AGIVertices[_0x7995('0x12')]['getSoundPath']=function(_0x5d2428){return util[_0x7995('0x2d')](_0x7995('0x2e'),FILES_PATH,_0x5d2428);};AGIVertices['prototype'][_0x7995('0x2f')]=function(_0x1922b4,_0x2b772f,_0x18667c){odbc[_0x7995('0x30')](_0x1922b4,function(_0x53002a){if(_0x53002a){logger[_0x7995('0x31')](_0x7995('0x32'),_0x53002a);_0x18667c(_0x53002a);}else{logger[_0x7995('0x33')](_0x7995('0x34'));odbc['query'](_0x2b772f,function(_0x2be2c0,_0x235df7){if(_0x2be2c0){logger[_0x7995('0x33')](_0x7995('0x35'),_0x2b772f);_0x18667c(_0x2be2c0);}else{logger[_0x7995('0x33')](_0x7995('0x36'),_0x2b772f);odbc['close'](function(_0x183a68){if(_0x183a68){logger[_0x7995('0x31')](_0x7995('0x37'),_0x183a68);}_0x18667c(null,_0x235df7);});}});}});};AGIVertices[_0x7995('0x12')][_0x7995('0x38')]=function(_0x298fc2,_0x14d638){this[_0x7995('0x10')][_0x7995('0x39')](_0x298fc2)[_0x7995('0x19')](function(_0x6fe77b){_0x14d638(null,_0x6fe77b?_0x6fe77b:![]);})[_0x7995('0x16')](function(_0x7b4e67){_0x14d638(_0x7b4e67);});};AGIVertices['prototype']['createSmsMessage']=function(_0x334dff,_0x7325e8){this['rpc']['createSmsMessage'](_0x334dff)[_0x7995('0x19')](function(_0x4a9fef){_0x7325e8(null,_0x4a9fef);})['catch'](function(_0x23da6b){_0x7325e8(_0x23da6b);});};AGIVertices[_0x7995('0x12')][_0x7995('0x3a')]=function(_0x576b96,_0x46ac4f,_0x5e85b9){this[_0x7995('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x7995('0x3b')],'node':_0x576b96[_0x7995('0x3c')],'application':_0x576b96[_0x7995('0x3d')],'data':_0x46ac4f||null,'project_name':this[_0x7995('0xf')]['arg_1'],'callerid':this[_0x7995('0xf')][_0x7995('0x3e')]})[_0x7995('0x19')](function(_0x6c7bec){if(_0x5e85b9){_0x5e85b9(null,_0x6c7bec);}})['catch'](function(_0x5f28e7){if(_0x5e85b9){_0x5e85b9(_0x5f28e7);}});};AGIVertices[_0x7995('0x12')]['createSquareRecording']=function(_0x23c41d,_0x59c153,_0x2f435e,_0x4c1127){this[_0x7995('0x10')][_0x7995('0x3f')]({'uniqueid':this['channel'][_0x7995('0x3b')],'callerid':this[_0x7995('0xf')][_0x7995('0x3e')],'calleridname':this[_0x7995('0xf')]['calleridname'],'context':this[_0x7995('0xf')][_0x7995('0x40')],'extension':this[_0x7995('0xf')]['extension'],'priority':this[_0x7995('0xf')][_0x7995('0x41')],'accountcode':this[_0x7995('0xf')][_0x7995('0x42')],'dnid':this[_0x7995('0xf')]['dnid'],'projectName':this[_0x7995('0xf')][_0x7995('0x43')],'saveName':_0x59c153,'filename':_0x23c41d['file']||_0x59c153,'savePath':_0x2f435e})[_0x7995('0x19')](function(_0x5843ba){_0x4c1127(null,_0x5843ba);})[_0x7995('0x16')](function(_0x187735){_0x4c1127(_0x187735);});};AGIVertices[_0x7995('0x12')][_0x7995('0x44')]=function(_0xddf537,_0x14b537,_0x1579b9,_0x4d46bc,_0x427dcf){this[_0x7995('0x10')][_0x7995('0x44')]({'uniqueid':this['channel'][_0x7995('0x3b')],'body':_0xddf537,'direction':_0x14b537,'providerName':_0x1579b9,'providerResponse':_0x4d46bc})[_0x7995('0x19')](function(_0x12d4b8){if(_0x427dcf){_0x427dcf(null,_0x12d4b8);}})['catch'](function(_0x4ec548){if(_0x427dcf){_0x427dcf(_0x4ec548);}});};AGIVertices['prototype'][_0x7995('0x45')]=function(_0x1fd1ca,_0x4cf5db){this[_0x7995('0x10')][_0x7995('0x45')]({'firstName':_[_0x7995('0x46')](_0x1fd1ca[_0x7995('0x15')])||_[_0x7995('0x47')](_0x1fd1ca['name'])?_0x7995('0x48')+Math['random']():_0x1fd1ca[_0x7995('0x15')],'lastName':_[_0x7995('0x46')](_0x1fd1ca[_0x7995('0x49')])||_['isNil'](_0x1fd1ca['lastName'])?null:_0x1fd1ca['lastName'],'phone':_0x1fd1ca['phone'],'ListId':_0x1fd1ca[_0x7995('0x4a')],'scheduledat':_0x1fd1ca[_0x7995('0x4b')],'callbackUniqueid':this[_0x7995('0xf')][_0x7995('0x3b')],'tags':_0x7995('0x4c'),'description':_0x7995('0x4d')+_0x1fd1ca[_0x7995('0x4b')][_0x7995('0x4e')](),'priority':_0x1fd1ca[_0x7995('0x4f')]})[_0x7995('0x19')](function(_0xa7af8c){_0x4cf5db(null,_0xa7af8c);})[_0x7995('0x16')](function(_0x3da72b){_0x4cf5db(_0x3da72b);});};AGIVertices[_0x7995('0x12')][_0x7995('0x50')]=function(_0x416133,_0x447a2b){this[_0x7995('0x10')][_0x7995('0x51')](_0x416133)['then'](function(_0x56a374){_0x447a2b(null,_0x56a374?_0x56a374[_0x7995('0x15')]:![]);})[_0x7995('0x16')](function(_0x32c0d3){_0x447a2b(_0x32c0d3);});};AGIVertices['prototype']['agentPause']=function(_0x402fa0,_0x197b52,_0x5b9467){var _0x332a85={'role':'agent'};_0x332a85[_0x402fa0]=this[_0x7995('0xf')][_0x7995('0x3e')];this[_0x7995('0x10')][_0x7995('0x52')](_0x332a85,_0x197b52,this['channel']['uniqueid'])[_0x7995('0x19')](function(_0x398fac){_0x5b9467(null,_[_0x7995('0x47')](_0x398fac)?![]:!![]);})[_0x7995('0x16')](function(_0x37072){logger[_0x7995('0x31')](_0x37072);_0x5b9467(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x53')]=function(_0x984c23,_0x50caf5){var _0x18f230={'role':_0x7995('0x54')};_0x18f230[_0x984c23]=this[_0x7995('0xf')][_0x7995('0x3e')];this['rpc']['agentUnpause'](_0x18f230)[_0x7995('0x19')](function(_0xebb5c8){_0x50caf5(null,_['isNil'](_0xebb5c8)?![]:!![]);})[_0x7995('0x16')](function(_0x375fc9){logger[_0x7995('0x31')](_0x375fc9);_0x50caf5(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x55')]=function(_0x4ed662,_0x457d09){var _0x564fca={'role':_0x7995('0x54')};_0x564fca[_0x4ed662]=this[_0x7995('0xf')][_0x7995('0x3e')];this[_0x7995('0x10')][_0x7995('0x55')](_0x564fca)[_0x7995('0x19')](function(_0x2b3c1d){_0x457d09(null,_[_0x7995('0x47')](_0x2b3c1d)?![]:!![]);})[_0x7995('0x16')](function(_0x3f2bde){logger[_0x7995('0x31')](_0x3f2bde);_0x457d09(null,![]);});};AGIVertices[_0x7995('0x12')]['agentLogin']=function(_0x45351d,_0x23bbc1){var _0x293480={'role':_0x7995('0x54')};_0x293480[_0x45351d]=this[_0x7995('0xf')]['callerid'];var _0x4b54f2=_0x45351d!=_0x7995('0x56')?util[_0x7995('0x2d')](_0x7995('0x57'),_0x7995('0x58'),this['channel'][_0x7995('0x3e')]):undefined;this['rpc']['agentLogin'](_0x293480,_0x4b54f2)[_0x7995('0x19')](function(_0x36d27d){_0x23bbc1(null,_[_0x7995('0x47')](_0x36d27d)?![]:!![]);})[_0x7995('0x16')](function(_0x290eae){logger[_0x7995('0x31')](_0x290eae);_0x23bbc1(null,![]);});};AGIVertices[_0x7995('0x12')][_0x7995('0x59')]=function(_0x3fde86,_0x2466df){sh['exec'](_[_0x7995('0x5a')](_0x3fde86),function(_0x8908cd,_0x3c5802){var _0x4cc247=_0x3c5802[_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2466df(null,_0x4cc247);});};AGIVertices[_0x7995('0x12')][_0x7995('0x5c')]=function(_0x3a7d9d,_0x3b0d30){scripts[_0x7995('0x5c')](_0x3a7d9d[_0x7995('0x5d')],_0x3a7d9d[_0x7995('0x5e')]||_0x7995('0x5f'),_0x3a7d9d[_0x7995('0x5f')],_0x3a7d9d[_0x7995('0x60')]||'en-US',_0x3a7d9d['ssmlGender']||_0x7995('0x61'),_0x3a7d9d[_0x7995('0x62')]||_0x7995('0x63'))[_0x7995('0x19')](function(_0x4dbab8){_0x3b0d30(null,_0x4dbab8);})[_0x7995('0x16')](function(_0x2c9eb6){_0x3b0d30(_0x2c9eb6);});};AGIVertices['prototype']['googleTTS']=function(_0x3253b5,_0x305b5a){scripts['googleTTS'](_0x3253b5[_0x7995('0x5f')],_0x3253b5['google_tts_language']||'en',0x1)[_0x7995('0x19')](function(_0xea9aba){_0x305b5a(null,_0xea9aba);})['catch'](function(_0x5d9d33){_0x305b5a(_0x5d9d33);});};AGIVertices[_0x7995('0x12')]['restAPI']=function(_0x31b9e6,_0xa41fff){var _0x3dd197={'uri':_0x31b9e6[_0x7995('0x64')],'method':_0x31b9e6[_0x7995('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x31b9e6[_0x7995('0x66')])===_0x7995('0x67')&&parseInt(_0x31b9e6[_0x7995('0x66')])>=0x1?parseInt(_0x31b9e6[_0x7995('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x7995('0x68')]([_0x7995('0x69'),_0x7995('0x6a')],_0x3dd197[_0x7995('0x65')][_0x7995('0x6b')]())){try{_0x3dd197[_0x7995('0x6c')]=_0x31b9e6[_0x7995('0xc')]?JSON[_0x7995('0x6d')](_0x31b9e6[_0x7995('0xc')]):{};}catch(_0x2ff7ba){logger[_0x7995('0x31')](_0x7995('0x6e'),_0x2ff7ba);}}try{_0x3dd197[_0x7995('0x6f')]=_0x31b9e6[_0x7995('0xb')]?JSON[_0x7995('0x6d')](_0x31b9e6[_0x7995('0xb')]):{};}catch(_0x33479a){logger[_0x7995('0x31')](_0x7995('0x70'),_0x33479a);}if(_0x31b9e6['computedVariables']){try{var _0x3fdb4b=require(_0x31b9e6[_0x7995('0x71')])['sync'](this,_0x3dd197);_0x3dd197['uri']=Mustache[_0x7995('0x72')](_0x31b9e6[_0x7995('0x64')],_0x3fdb4b,{},['$$','$$']);if(_0x3dd197[_0x7995('0x6f')]){_0x3dd197[_0x7995('0x6f')]=JSON[_0x7995('0x6d')](Mustache[_0x7995('0x72')](JSON['stringify'](_0x3dd197[_0x7995('0x6f')]),_0x3fdb4b,{},['$$','$$']));}if(_0x3dd197[_0x7995('0x6c')]){_0x3dd197[_0x7995('0x6c')]=JSON[_0x7995('0x6d')](Mustache[_0x7995('0x72')](JSON[_0x7995('0x73')](_0x3dd197[_0x7995('0x6c')]),_0x3fdb4b,{},['$$','$$']));}}catch(_0xc93dcb){logger['error'](_0x7995('0x74'),_0xc93dcb);}}rp(_0x3dd197)[_0x7995('0x19')](function(_0x5c04c9){var _0x479271={'statusCode':_0x5c04c9[_0x7995('0x75')]||0xc8,'statusMessage':_0x5c04c9[_0x7995('0x76')]||'OK','headers':_0x5c04c9[_0x7995('0x6f')]||{},'body':_0x5c04c9[_0x7995('0x6c')]||{}};_0xa41fff(null,_0x479271);})[_0x7995('0x16')](function(_0x4a02ea){var _0x35f6cb={'statusCode':_0x4a02ea[_0x7995('0x75')]||0x1f4,'statusMessage':_0x4a02ea['message']||_0x7995('0x77'),'headers':_0x4a02ea[_0x7995('0x78')]['headers']||{},'body':_0x4a02ea[_0x7995('0x78')]['body']||{}};_0xa41fff(null,_0x35f6cb);});};AGIVertices[_0x7995('0x12')][_0x7995('0x79')]=function(_0x3ab421,_0x428a1b){scripts[_0x7995('0x79')](this['channel'][_0x7995('0x3b')],_0x3ab421[_0x7995('0x7a')],_0x3ab421[_0x7995('0x5f')],_0x3ab421['dialogflow_language']||'en')[_0x7995('0x19')](function(_0x3f3434){_0x428a1b(null,_0x3f3434);})[_0x7995('0x16')](function(_0x308a26){_0x428a1b(_0x308a26);});};AGIVertices['prototype'][_0x7995('0x7b')]=function(_0xf59a39,_0x3a5f5e){scripts['googleDialogflowV2'](this['channel'][_0x7995('0x3b')],_0xf59a39[_0x7995('0x7c')],_0xf59a39['client_email'],_0xf59a39['private_key'],_0xf59a39[_0x7995('0x5f')],_0xf59a39[_0x7995('0x7d')]||'en')[_0x7995('0x19')](function(_0x2384c1){_0x3a5f5e(null,_0x2384c1);})[_0x7995('0x16')](function(_0x551b5e){_0x3a5f5e(_0x551b5e);});};AGIVertices['prototype'][_0x7995('0x7e')]=function(_0x54fad4,_0x588df7){scripts[_0x7995('0x7e')](this[_0x7995('0xf')],_0x54fad4)[_0x7995('0x19')](function(_0x5eb360){_0x588df7(null,_0x5eb360);})[_0x7995('0x16')](function(_0x3cb1d2){_0x588df7(_0x3cb1d2);});};AGIVertices[_0x7995('0x12')][_0x7995('0x7f')]=function(_0x267a7f,_0x5799d1){scripts[_0x7995('0x7f')](_0x267a7f[_0x7995('0x7a')],_0x267a7f[_0x7995('0x5f')],_0x267a7f[_0x7995('0x80')]||'en-US',_0x267a7f[_0x7995('0x81')])[_0x7995('0x19')](function(_0x522110){_0x5799d1(null,_0x522110);})[_0x7995('0x16')](function(_0x20683e){_0x5799d1(_0x20683e);});};AGIVertices['prototype'][_0x7995('0x82')]=function(_0x50efab,_0x1b4b34,_0x51e7d7){scripts[_0x7995('0x82')](_0x1b4b34,_0x50efab['key'],_0x50efab[_0x7995('0x83')]||_0x7995('0x84'),this['isConfigured'](_0x50efab[_0x7995('0x85')])?_0x50efab['model']:undefined)['then'](function(_0x7b9e26){_0x51e7d7(null,_0x7b9e26);})[_0x7995('0x16')](function(_0x784492){_0x51e7d7(_0x784492);});};AGIVertices[_0x7995('0x12')]['awsPolly']=function(_0x1ea76d,_0x35044a){scripts['awsPolly'](_0x1ea76d['aws_access_key_id'],_0x1ea76d[_0x7995('0x86')],_0x1ea76d['aws_polly_region'],_0x1ea76d[_0x7995('0x87')]||_0x7995('0x88'),_0x1ea76d[_0x7995('0x5f')],_0x1ea76d['aws_text_type']||'text')[_0x7995('0x19')](function(_0x553c71){_0x35044a(null,_0x553c71);})[_0x7995('0x16')](function(_0x44891e){_0x35044a(_0x44891e);});};AGIVertices[_0x7995('0x12')][_0x7995('0x89')]=function(_0x4ff5e7,_0x52d102){scripts['awsLex'](this[_0x7995('0xf')][_0x7995('0x3b')],_0x4ff5e7[_0x7995('0x8a')],_0x4ff5e7[_0x7995('0x86')],_0x4ff5e7[_0x7995('0x8b')],_0x4ff5e7[_0x7995('0x5f')],_0x4ff5e7['aws_bot_name'])['then'](function(_0x1a2902){_0x52d102(null,_0x1a2902);})['catch'](function(_0x4cfd78){_0x52d102(_0x4cfd78);});};AGIVertices[_0x7995('0x12')]['googleASR']=function(_0x57a164,_0x35c3f3,_0x3541d7){scripts[_0x7995('0x8c')](_0x35c3f3,_0x57a164['key'],_0x57a164[_0x7995('0x8d')]||_0x7995('0x84'))[_0x7995('0x19')](function(_0x340f6d){_0x3541d7(null,_0x340f6d);})[_0x7995('0x16')](function(_0x178746){_0x3541d7(_0x178746);});};AGIVertices[_0x7995('0x12')][_0x7995('0x8e')]=function(_0x19d746,_0x570b71,_0x3eb3fa){scripts[_0x7995('0x8e')](_0x570b71,_0x19d746[_0x7995('0x8f')],_0x19d746[_0x7995('0x90')],_0x19d746[_0x7995('0x91')])['then'](function(_0x1ea316){_0x3eb3fa(null,_0x1ea316);})[_0x7995('0x16')](function(_0x21fe4f){_0x3eb3fa(_0x21fe4f);});};AGIVertices['prototype']['clear']=function(_0x5e04ed){var _0xb28dea=_[_0x7995('0x68')](verticesWithRetry,_0x5e04ed[_0x7995('0x3d')])?_0x5e04ed:_[_0x7995('0x92')](_0x5e04ed);for(var _0x16a94d in _0xb28dea){if(_0xb28dea[_0x7995('0x93')](_0x16a94d)){if(_0xb28dea[_0x16a94d]&&_['isString'](_0xb28dea[_0x16a94d])){if(_[_0x7995('0x68')](recursiveMapAttributes,_0x16a94d)){_0xb28dea[_0x16a94d]=this['replaceObjectAllVariables'](_0xb28dea[_0x16a94d]);}else{_0xb28dea[_0x16a94d]=this[_0x7995('0x94')](_0xb28dea[_0x16a94d]);}}}}return _0xb28dea;};AGIVertices[_0x7995('0x12')][_0x7995('0x95')]=function(_0x2cc9a4){for(var _0x162993 in _0x2cc9a4){if(_0x2cc9a4[_0x7995('0x93')](_0x162993)){if(_[_0x7995('0x96')](_0x2cc9a4[_0x162993])){this[_0x7995('0x95')](_0x2cc9a4[_0x162993]);}else if(_[_0x7995('0x97')](_0x2cc9a4[_0x162993])){for(var _0x1b34fe=0x0;_0x1b34fe<_0x2cc9a4[_0x162993][_0x7995('0x98')];_0x1b34fe++){this['recursiveNodeIndex'](_0x2cc9a4[_0x162993][_0x1b34fe]);}}else if(_[_0x7995('0x99')](_0x2cc9a4[_0x162993])){_0x2cc9a4[_0x162993]=this['replaceAllVariables'](_0x2cc9a4[_0x162993]);}}}};AGIVertices[_0x7995('0x12')][_0x7995('0x9a')]=function(_0x592ae3,_0x493e74){for(var _0x2a25eb in _0x592ae3){if(_0x592ae3[_0x7995('0x93')](_0x2a25eb)){if(_[_0x7995('0x96')](_0x592ae3[_0x2a25eb])){if(!_[_0x7995('0x46')](_0x592ae3[_0x2a25eb])){this[_0x7995('0x9a')](_0x592ae3[_0x2a25eb],util[_0x7995('0x2d')](_0x7995('0x9b'),_0x493e74,_0x2a25eb));}}else if(_[_0x7995('0x97')](_0x592ae3[_0x2a25eb])){for(var _0x2b586f=0x0;_0x2b586f<_0x592ae3[_0x2a25eb][_0x7995('0x98')];_0x2b586f++){this[_0x7995('0x9a')](_0x592ae3[_0x2a25eb][_0x2b586f],util[_0x7995('0x2d')]('%s.%s',_0x493e74,_0x2a25eb+'['+_0x2b586f+']'));}}else{if(!_['isNil'](_0x592ae3[_0x2a25eb])){this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0x9b'),_0x493e74,_0x2a25eb),_0x592ae3[_0x2a25eb]);}}}}};AGIVertices[_0x7995('0x12')]['replaceObjectAllVariables']=function(_0xe8c08e){try{var _0x459777=JSON['parse'](_0xe8c08e);this[_0x7995('0x95')](_0x459777);return JSON['stringify'](_0x459777);}catch(_0x37416c){return this[_0x7995('0x94')](_0xe8c08e);}};AGIVertices[_0x7995('0x12')]['replaceAllVariables']=function(_0x3501ac){var _0x1cd9a0=_0x3501ac[_0x7995('0x9d')]('{');for(var _0x15ca94=0x1;_0x15ca94<_0x1cd9a0[_0x7995('0x98')];_0x15ca94+=0x1){var _0x8a5aa8=_0x1cd9a0[_0x15ca94][_0x7995('0x9d')]('}');if(_0x8a5aa8['length']>0x1){_0x3501ac=_0x3501ac['replaceAll']('{'+_0x8a5aa8[0x0]+'}',this['channel'][_0x7995('0x13')](_0x8a5aa8[0x0])[_0x7995('0x9e')]||_0x8a5aa8[0x0]);}}if(_0x1cd9a0['length']===0x1){return _0x3501ac['toString']();}return this[_0x7995('0x94')](_0x3501ac);};AGIVertices[_0x7995('0x12')]['getAndSetVariable']=function(_0x4b07de,_0x538bd3){var _0x5b591b=this[_0x7995('0xf')][_0x7995('0x13')](_0x4b07de);if(_0x5b591b[_0x7995('0x9f')]===-0x1){return _0x5b591b;}logger[_0x7995('0x33')](util['format'](_0x7995('0xa0'),_0x538bd3,_0x5b591b[_0x7995('0x9e')]));return this['channel'][_0x7995('0x9c')](_0x538bd3,_0x5b591b[_0x7995('0x9e')]);};AGIVertices[_0x7995('0x12')]['isConfigured']=function(_0x2fe20d){return _0x2fe20d&&_0x2fe20d!=='0'&&_0x2fe20d!=='-1'&&_0x2fe20d!=='';};AGIVertices[_0x7995('0x12')]['maxRetry']=function(_0x3615ac){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3615ac,'-');_0x3615ac[_0x7995('0xa2')]=_0x3615ac[_0x7995('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7995('0x12')][_0x7995('0xa4')]=function(_0x114f3c){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xa5'),_0x114f3c[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x114f3c['text'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}var _0x3c551f='\x22'+_0x114f3c['text']+'\x22';if(this[_0x7995('0xa6')](_0x114f3c[_0x7995('0x78')])){_0x3c551f+=','+_0x114f3c[_0x7995('0x78')];}var _0x52af9b=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x3c551f);if(_0x52af9b[_0x7995('0x9f')]===-0x1){return _0x52af9b;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3c551f));};AGIVertices[_0x7995('0x12')]['mrcprecog']=function(_0x101bc6){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x101bc6[_0x7995('0x3c')]));if(!this['isConfigured'](_0x101bc6['grammar'])){return this['channel']['noop'](_0x7995('0xab'));}var _0x1fbb84=_0x101bc6['grammar'];if(this[_0x7995('0xa6')](_0x101bc6[_0x7995('0x78')])){_0x1fbb84+=','+_0x101bc6['options'];}var _0x151893=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xac'),_0x1fbb84);if(_0x151893[_0x7995('0x9f')]===-0x1){return _0x151893;}var _0x56b5ff=this[_0x7995('0xad')](_0x7995('0xae'),_0x7995('0xaf'));if(_0x56b5ff[_0x7995('0x9f')]===-0x1){return _0x56b5ff;}var _0x55387b=this[_0x7995('0xad')](_0x7995('0xb0'),_0x7995('0xb1'));if(_0x55387b[_0x7995('0x9f')]===-0x1){return _0x55387b;}var _0x370bd9=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xb3'));if(_0x370bd9[_0x7995('0x9f')]===-0x1){return _0x370bd9;}return this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1fbb84));};AGIVertices[_0x7995('0x12')][_0x7995('0xb4')]=function(_0x2a9264){logger['info'](util['format'](_0x7995('0xb5'),_0x2a9264[_0x7995('0x3c')]));return this['channel'][_0x7995('0xb4')]([_0x2a9264['command'],_0x2a9264[_0x7995('0xb6')]]);};AGIVertices[_0x7995('0x12')][_0x7995('0xb7')]=function(_0x4e5667){logger['info'](util['format'](_0x7995('0xb8'),_0x4e5667[_0x7995('0x3c')]));if(this[_0x7995('0xa6')](_0x4e5667[_0x7995('0x66')])){logger['info'](util[_0x7995('0x2d')](_0x7995('0xb9'),_0x4e5667[_0x7995('0x66')]));var _0x241427=this[_0x7995('0xf')]['wait'](_0x4e5667['timeout']);if(_0x241427['result']===-0x1){return _0x241427;}}return this[_0x7995('0xf')][_0x7995('0xb7')]();};AGIVertices['prototype'][_0x7995('0x4c')]=function(_0x5635d6){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xba'),_0x5635d6[_0x7995('0x3c')]));if(!this['isConfigured'](_0x5635d6[_0x7995('0x4a')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x5635d6,_0x7995('0xbb'));}_0x5635d6[_0x7995('0x4b')]=moment();if(this[_0x7995('0xa6')](_0x5635d6[_0x7995('0xbc')])){_0x5635d6[_0x7995('0x4b')]=moment()[_0x7995('0xbd')](_0x5635d6[_0x7995('0xbc')],_0x7995('0xbe'));}if(!this[_0x7995('0xa6')](_0x5635d6[_0x7995('0x4f')])){_0x5635d6[_0x7995('0x4f')]=0x2;}this['createCmContact'][_0x7995('0xa1')](this,_0x5635d6);return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5635d6[_0x7995('0xbf')],_0x5635d6['list_id'],_0x5635d6[_0x7995('0x4b')]));};AGIVertices[_0x7995('0x12')]['custom_app']=function(_0x4985f3){logger['info'](util[_0x7995('0x2d')](_0x7995('0xc0'),_0x4985f3[_0x7995('0x3c')]));var _0x2b7bc2=this['channel'][_0x7995('0xa9')](_0x4985f3[_0x7995('0xc1')],_0x4985f3[_0x7995('0x78')]);if(_0x2b7bc2[_0x7995('0x9f')]===-0x1){return _0x2b7bc2;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),_0x4985f3['application'],_0x4985f3[_0x7995('0x78')]));};AGIVertices[_0x7995('0x12')][_0x7995('0xc3')]=function(_0x35f0f8){logger['info'](util[_0x7995('0x2d')](_0x7995('0xc4'),_0x35f0f8[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x35f0f8[_0x7995('0x5f')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xa8'));}var _0x2ee5d8='\x22'+_0x35f0f8[_0x7995('0x5f')]+'\x22';if(this[_0x7995('0xa6')](_0x35f0f8[_0x7995('0x78')])){_0x2ee5d8+=','+_0x35f0f8[_0x7995('0x78')];}var _0x2401b3=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x2ee5d8);if(_0x2401b3[_0x7995('0x9f')]===-0x1){return _0x2401b3;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc5'),_0x2ee5d8));};AGIVertices[_0x7995('0x12')][_0x7995('0xc6')]=function(_0x1f254d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xc7'),_0x1f254d['label']));if(!this['isConfigured'](_0x1f254d[_0x7995('0x5f')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xa8'));}var _0x4c251c='\x22'+_0x1f254d[_0x7995('0x5f')]+'\x22';if(this['isConfigured'](_0x1f254d[_0x7995('0x78')])){_0x4c251c+=','+_0x1f254d[_0x7995('0x78')];}var _0x32c379=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xaa'),_0x4c251c);if(_0x32c379[_0x7995('0x9f')]===-0x1){return _0x32c379;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4c251c));};AGIVertices[_0x7995('0x12')][_0x7995('0xc8')]=function(_0x1d0481){logger[_0x7995('0x33')](util['format'](_0x7995('0xc9'),_0x1d0481[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x1d0481[_0x7995('0xca')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xab'));}var _0x31d0e9=_0x1d0481[_0x7995('0xca')];if(this[_0x7995('0xa6')](_0x1d0481[_0x7995('0x78')])){_0x31d0e9+=','+_0x1d0481[_0x7995('0x78')];}var _0x36ad5e=this[_0x7995('0xf')]['exec'](_0x7995('0xac'),_0x31d0e9);if(_0x36ad5e['result']===-0x1){return _0x36ad5e;}var _0x363aad=this[_0x7995('0xad')](_0x7995('0xae'),_0x7995('0xcb'));if(_0x363aad['result']===-0x1){return _0x363aad;}var _0x40a98f=this[_0x7995('0xad')](_0x7995('0xb0'),_0x7995('0xcc'));if(_0x40a98f[_0x7995('0x9f')]===-0x1){return _0x40a98f;}var _0x1b808f=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xcd'));if(_0x1b808f[_0x7995('0x9f')]===-0x1){return _0x1b808f;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xce'),_0x31d0e9));};AGIVertices['prototype']['sestekasr']=function(_0xdfc11d){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xdfc11d[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0xdfc11d[_0x7995('0xca')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xab'));}var _0x34b03e=_0xdfc11d[_0x7995('0xca')];if(this[_0x7995('0xa6')](_0xdfc11d[_0x7995('0x78')])){_0x34b03e+=','+_0xdfc11d[_0x7995('0x78')];}var _0x503d2b=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0xac'),_0x34b03e);if(_0x503d2b['result']===-0x1){return _0x503d2b;}var _0x580571=this[_0x7995('0xad')]('RECOG_CONFIDENCE()',_0x7995('0xcf'));if(_0x580571[_0x7995('0x9f')]===-0x1){return _0x580571;}var _0x311859=this[_0x7995('0xad')](_0x7995('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0x311859['result']===-0x1){return _0x311859;}var _0x3b1e29=this[_0x7995('0xad')](_0x7995('0xb2'),_0x7995('0xd0'));if(_0x3b1e29[_0x7995('0x9f')]===-0x1){return _0x3b1e29;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xce'),_0x34b03e));};AGIVertices[_0x7995('0x12')]['database']=function(_0x2ebf7c){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xd1'),_0x2ebf7c['label']));if(!this['isConfigured'](_0x2ebf7c['odbc_id'])){return this['channel']['error'](_0x2ebf7c,_0x7995('0xd2'));}var _0x5d2883=this['getSquareOdbc'][_0x7995('0xa1')](this,_0x2ebf7c[_0x7995('0xd3')]);if(!_0x5d2883){return this[_0x7995('0xf')]['error'](_0x2ebf7c,_0x7995('0xd4'));}if(!this['isConfigured'](_0x2ebf7c[_0x7995('0xd5')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2ebf7c,'no\x20query\x20configured');}var _0x453957=_0x2ebf7c[_0x7995('0xd5')][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xd6'),_0x453957));var _0x141fb5=this[_0x7995('0x2f')]['sync'](this,_0x5d2883,_0x453957);this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x2ebf7c,_0x453957);if(!this[_0x7995('0xa6')](_0x2ebf7c['variable_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xd7'));}var _0x3ba033=this[_0x7995('0x13')]['sync'](this,_0x2ebf7c[_0x7995('0xd8')]);if(!_0x3ba033){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2ebf7c,_0x7995('0xd9'));}var _0x2bc786=this;_0x141fb5[_0x7995('0xda')](function(_0x43bf71,_0x5baca7){Object['keys'](_0x43bf71)[_0x7995('0xda')](function(_0x273dad){_0x2bc786['channel']['setVariable'](util[_0x7995('0x2d')](_0x7995('0xdb'),_0x3ba033,_0x5baca7,_0x273dad),_0x43bf71[_0x273dad]);});});this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0xdc'),_0x3ba033),_0x141fb5[_0x7995('0x98')]);return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xdd'),_0x3ba033));};AGIVertices[_0x7995('0x12')][_0x7995('0xde')]=function(_0x3b017b){logger['debug'](util[_0x7995('0x2d')](_0x7995('0xdf'),_0x3b017b[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3b017b[_0x7995('0xe0')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3b017b,'no\x20user\x20selected');}var _0x8c33c0=this[_0x7995('0x1e')][_0x7995('0xa1')](this,_0x3b017b[_0x7995('0xe0')]);if(!_0x8c33c0){return this['channel'][_0x7995('0x31')](_0x3b017b,'no\x20user\x20found');}var _0x21ba9b=this[_0x7995('0xf')]['exec']('DIAL',[util['format'](_0x7995('0xe1'),_0x8c33c0),_0x3b017b[_0x7995('0x66')],_0x3b017b[_0x7995('0xe2')],_0x3b017b[_0x7995('0x64')]]);if(_0x21ba9b[_0x7995('0x9f')]===-0x1){return _0x21ba9b;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe3'),_0x7995('0xe4')));};AGIVertices[_0x7995('0x12')][_0x7995('0xe5')]=function(_0x5dccc8){logger['info'](util[_0x7995('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5dccc8['label']));if(!this[_0x7995('0xa6')](_0x5dccc8[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}if(!this[_0x7995('0xa6')](_0x5dccc8[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this['createSquareDetailsReport'](_0x5dccc8);this[_0x7995('0x44')](_0x5dccc8[_0x7995('0x5f')],'in','','');this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe8'),_0x5dccc8[_0x7995('0x5f')]));var _0x551480=this[_0x7995('0x79')][_0x7995('0xa1')](this,_0x5dccc8);if(_0x551480){for(var _0x59a107 in _0x551480){if(_0x551480[_0x7995('0x93')](_0x59a107)){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')]('DIALOGFLOW_%s',_0x59a107[_0x7995('0x6b')]()),_0x551480[_0x59a107]);}}this[_0x7995('0x44')](_0x551480[_0x7995('0xe9')],'out',_0x7995('0xe5'),'');return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xea'),_0x551480[_0x7995('0xe9')]));}return this[_0x7995('0xf')]['error'](_0x5dccc8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')][_0x7995('0xeb')]=function(_0x31eaee){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0xec'),_0x31eaee['label']));if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x7c')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x31eaee[_0x7995('0xed')])){return this[_0x7995('0xf')]['noop'](_0x7995('0xee'));}if(!this[_0x7995('0xa6')](_0x31eaee['private_key'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xef'));}if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x7d')])){return this['channel']['noop'](_0x7995('0xf0'));}if(!this[_0x7995('0xa6')](_0x31eaee[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x31eaee);this[_0x7995('0x44')](_0x31eaee[_0x7995('0x5f')],'in','','');this['channel']['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x31eaee[_0x7995('0x5f')]));var _0x318a40=this['googleDialogflowV2'][_0x7995('0xa1')](this,_0x31eaee);if(_0x318a40){for(var _0x2f8674 in _0x318a40){if(_0x318a40['hasOwnProperty'](_0x2f8674)){if(_0x2f8674!=='providerResponse'){this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0xf1'),_0x2f8674[_0x7995('0x6b')]()),_0x318a40[_0x2f8674]);}}}this[_0x7995('0x44')](_0x318a40[_0x7995('0xe9')],'out','dialogflowV2',_0x318a40[_0x7995('0xf2')]);return this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0xf3'),_0x318a40[_0x7995('0xe9')]));}return this[_0x7995('0xf')][_0x7995('0x31')](_0x31eaee,_0x7995('0xf4'));};AGIVertices[_0x7995('0x12')][_0x7995('0xf5')]=function(_0x1b4cab){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1b4cab[_0x7995('0x3c')]));if(!this['isConfigured'](_0x1b4cab[_0x7995('0xf6')])){return this['channel'][_0x7995('0xa7')](_0x7995('0xf7'));}if(!this[_0x7995('0xa6')](_0x1b4cab['username'])){return this['channel'][_0x7995('0xa7')](_0x7995('0xf8'));}if(!this[_0x7995('0xa6')](_0x1b4cab[_0x7995('0xf9')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xfa'));}if(!this[_0x7995('0xa6')](_0x1b4cab[_0x7995('0xfb')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x1b4cab);this[_0x7995('0x44')](_0x1b4cab[_0x7995('0x5f')],'in','','');this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xfc'),_0x1b4cab[_0x7995('0x5f')]));var _0x3f3128=this[_0x7995('0x7e')][_0x7995('0xa1')](this,_0x1b4cab);if(_0x3f3128){for(var _0x2b812f in _0x3f3128){if(_0x3f3128[_0x7995('0x93')](_0x2b812f)){this['channel']['setVariable'](util[_0x7995('0x2d')](_0x7995('0xfd'),_0x2b812f[_0x7995('0x6b')]()),_0x3f3128[_0x2b812f]);}}this[_0x7995('0x44')](_0x3f3128[_0x7995('0xe9')],'out',_0x7995('0xf5'),'');if(_0x3f3128[_0x7995('0xfe')]){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xff'),_0x3f3128[_0x7995('0xfe')]));var _0x45d3c6=this[_0x7995('0xf')]['streamFile'](_0x3f3128['audiofile']);try{fs[_0x7995('0x100')](_0x3f3128[_0x7995('0xfe')]+_0x7995('0x101'));}catch(_0x296643){logger[_0x7995('0x31')](_0x296643);}return _0x45d3c6;}else{return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('SestekNDA\x20Result\x20%s',_0x3f3128['speech']));}}return this[_0x7995('0xf')][_0x7995('0x31')](_0x1b4cab,_0x7995('0x102'));};AGIVertices[_0x7995('0x12')]['end']=function(_0x580476){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x103'),_0x580476[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x104'));};AGIVertices[_0x7995('0x12')][_0x7995('0x105')]=function(_0x2c3179){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x2c3179['label']));var _0x24111a='';if(_0x2c3179[_0x7995('0x106')]){if(!this[_0x7995('0xa6')](_0x2c3179[_0x7995('0x106')])){return this['channel'][_0x7995('0x31')](_0x2c3179,'no\x20trunk\x20selected');}else{var _0x2e460c=parseInt(_0x2c3179[_0x7995('0x106')],0xa);if(isNaN(_0x2e460c)){_0x24111a=_0x2c3179[_0x7995('0x106')];}else{_0x24111a=this[_0x7995('0x20')][_0x7995('0xa1')](this,_0x2c3179[_0x7995('0x106')]);if(!_0x24111a){return this['channel'][_0x7995('0x31')](_0x2c3179,_0x7995('0x107'));}}}}else if(_0x2c3179[_0x7995('0x108')]){_0x24111a=_0x2c3179[_0x7995('0x108')];}else{return this['channel']['error'](_0x2c3179,_0x7995('0x109'));}var _0xbc2f6=this[_0x7995('0xf')][_0x7995('0xa9')]('DIAL',[util[_0x7995('0x2d')](_0x7995('0x10a'),_0x24111a,_0x2c3179[_0x7995('0xbf')]),_0x2c3179['timeout'],_0x2c3179[_0x7995('0xe2')],_0x2c3179[_0x7995('0x64')]]);if(_0xbc2f6[_0x7995('0x9f')]===-0x1){return _0xbc2f6;}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xe3'),_0x7995('0xe4')));};AGIVertices[_0x7995('0x12')][_0x7995('0x10b')]=function(_0x1f6c3e){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1f6c3e[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x10b'));};AGIVertices['prototype'][_0x7995('0x10c')]=function(_0x25494f){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x25494f[_0x7995('0x3c')]));if(_0x25494f[_0x7995('0xa2')]===0x0){return this[_0x7995('0xa3')](_0x25494f);}_0x25494f[_0x7995('0xa2')]-=0x1;if(!this[_0x7995('0xa6')](_0x25494f[_0x7995('0x10d')])){return this[_0x7995('0xf')]['error'](_0x25494f,_0x7995('0x10e'));}var _0x3b0327=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x25494f[_0x7995('0x10d')]);if(!_0x3b0327){return this['channel'][_0x7995('0x31')](_0x25494f,'no\x20file\x20audio\x20found');}if(!this[_0x7995('0xa6')](_0x25494f[_0x7995('0xd8')])){return this[_0x7995('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x533742=this[_0x7995('0xf')][_0x7995('0x10f')](_0x3b0327,_0x25494f[_0x7995('0x110')],_0x25494f[_0x7995('0x111')]);var _0x17fab0=_0x533742[_0x7995('0x9f')]?_0x533742['result'][_0x7995('0x4e')]():'';logger[_0x7995('0x33')](_0x7995('0x112'),JSON[_0x7995('0x73')](_0x533742));if(_0x533742['result']===-0x1){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,_0x17fab0);return _0x533742;}else if(_0x533742['extra']===_0x7995('0x66')){_0x533742['result']=_0x17fab0[_0x7995('0x98')]>=parseInt(_0x25494f[_0x7995('0x113')])?'x':'i';}else{_0x533742[_0x7995('0x9f')]=_0x17fab0['length']>=parseInt(_0x25494f['mindigit'])&&_0x17fab0[_0x7995('0x98')]<=parseInt(_0x25494f[_0x7995('0x111')])?'x':'i';}var _0x90ad8=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x25494f[_0x7995('0xd8')]);if(!_0x90ad8){return this[_0x7995('0xf')][_0x7995('0x31')](_0x25494f,_0x7995('0xd9'));}this[_0x7995('0xf')][_0x7995('0x9c')](_0x90ad8,_0x17fab0);if(this['isConfigured'](_0x25494f['hiddendigitsnum'])){var _0x6e3230=parseInt(_0x25494f[_0x7995('0x114')],0xa);var _0x164203=rs[_0x7995('0x115')]({'charset':'*','length':_0x6e3230});var _0x480d85=_0x17fab0['length'];if(_0x480d85>0x0){if(_0x480d85>_0x6e3230){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,_0x25494f['hiddendigitspos']==='first'?_0x164203+_0x17fab0[_0x7995('0x116')](_0x6e3230):_0x17fab0[_0x7995('0x116')](0x0,_0x480d85-_0x6e3230)+_0x164203);}else{this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x25494f,rs[_0x7995('0x115')]({'charset':'*','length':_0x480d85}));}}else{this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x25494f,'');}}else{this[_0x7995('0x3a')]['sync'](this,_0x25494f,_0x17fab0);}return _0x533742;};AGIVertices[_0x7995('0x12')][_0x7995('0xe')]=function(_0x21649a){logger['info'](util[_0x7995('0x2d')](_0x7995('0x117'),_0x21649a[_0x7995('0x3c')]));return this[_0x7995('0x10c')](_0x21649a);};AGIVertices[_0x7995('0x12')]['goal']=function(_0x4bbb1a){logger[_0x7995('0x33')](util['format'](_0x7995('0x118'),_0x4bbb1a['label']));this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x4bbb1a,_0x4bbb1a[_0x7995('0x119')]);return this['channel']['noop'](util['format'](_0x7995('0x11a'),_0x4bbb1a[_0x7995('0x119')]));};AGIVertices[_0x7995('0x12')]['awspolly']=function(_0x2a9738){logger[_0x7995('0x33')](util['format'](_0x7995('0x11b'),_0x2a9738[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2a9738[_0x7995('0x8a')])||!this[_0x7995('0xa6')](_0x2a9738['aws_secret_access_key'])){return this['channel'][_0x7995('0xa7')](_0x7995('0x11c'));}if(!this[_0x7995('0xa6')](_0x2a9738[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x2a9738[_0x7995('0x5f')]));var _0x1faf9b=this[_0x7995('0x11d')][_0x7995('0xa1')](this,_0x2a9738);if(_0x1faf9b){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x1faf9b));var _0x5d0fe6=this[_0x7995('0xf')][_0x7995('0x11e')](_0x1faf9b);try{fs[_0x7995('0x100')](_0x1faf9b+_0x7995('0x101'));}catch(_0x55ce63){logger['error'](_0x55ce63);}return _0x5d0fe6;}return this['channel'][_0x7995('0x31')](_0x2a9738,_0x7995('0x11f'));};AGIVertices['prototype'][_0x7995('0x120')]=function(_0x2265cf){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x121'),_0x2265cf[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2265cf[_0x7995('0x8a')])||!this['isConfigured'](_0x2265cf[_0x7995('0x86')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7995('0xa6')](_0x2265cf['aws_bot_name'])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x7995('0xa6')](_0x2265cf['text'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this[_0x7995('0xf')][_0x7995('0xe7')]=!![];this[_0x7995('0x3a')](_0x2265cf);this[_0x7995('0x44')](_0x2265cf['text'],'in','','');this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x122'),_0x2265cf[_0x7995('0x5f')]));var _0x12abbb=this[_0x7995('0x89')][_0x7995('0xa1')](this,_0x2265cf);if(_0x12abbb){for(var _0x30d2af in _0x12abbb){if(_0x12abbb[_0x7995('0x93')](_0x30d2af)&&_[_0x7995('0x99')](_0x12abbb[_0x30d2af])){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')](_0x7995('0x123'),_0x30d2af['toUpperCase']()),_0x12abbb[_0x30d2af]);}}if(_[_0x7995('0x47')](_0x12abbb[_0x7995('0x124')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x125'));}else{this[_0x7995('0x44')](_0x12abbb['message'],_0x7995('0x126'),'amazonlex','');return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x127'),_0x12abbb[_0x7995('0x124')]));}}return this[_0x7995('0xf')]['error'](_0x2265cf,_0x7995('0x128'));};AGIVertices[_0x7995('0x12')][_0x7995('0x129')]=function(_0x4c2faf){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x12a'),_0x4c2faf[_0x7995('0x3c')],_0x4c2faf[_0x7995('0x66')]));if(!this[_0x7995('0xa6')](_0x4c2faf[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}var _0xaafd4='wav';var _0x125233=util[_0x7995('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x3a1e88=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x125233,_0xaafd4);var _0x258f87=!![];if(_0x4c2faf['beep']===_0x7995('0x12b')){_0x258f87=![];}var _0x22d9ce=this[_0x7995('0xf')][_0x7995('0x12c')](_0x125233,_0xaafd4,_0x4c2faf[_0x7995('0x12d')],_0x4c2faf[_0x7995('0x66')],undefined,_0x258f87);if(_0x22d9ce[_0x7995('0x9f')]!==-0x1){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x12e'),_0x3a1e88));var _0x3d2c0d=this[_0x7995('0x8c')]['sync'](this,_0x4c2faf,_0x3a1e88);if(_0x3d2c0d){for(var _0x247b71 in _0x3d2c0d){if(_0x3d2c0d[_0x7995('0x93')](_0x247b71)){this[_0x7995('0xf')][_0x7995('0x9c')](util['format'](_0x7995('0x12f'),_0x247b71[_0x7995('0x6b')]()),_0x3d2c0d[_0x247b71]);}}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x130'),JSON[_0x7995('0x73')](_0x3d2c0d)));}}return _0x22d9ce;};AGIVertices['prototype'][_0x7995('0x131')]=function(_0x5511f7){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x132'),_0x5511f7['label']));if(!this['isConfigured'](_0x5511f7[_0x7995('0x8f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20appid\x20configured');}if(!this[_0x7995('0xa6')](_0x5511f7['appsecret'])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x133'));}var _0x35ee8c=_0x7995('0x134');var _0x1917dd=util['format'](_0x7995('0x135'),FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x51b607=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x1917dd,_0x35ee8c);var _0x46fbd5=!![];if(_0x5511f7[_0x7995('0x136')]===_0x7995('0x12b')){_0x46fbd5=![];}var _0x1e279e=this[_0x7995('0xf')][_0x7995('0x12c')](_0x1917dd,_0x35ee8c,_0x5511f7[_0x7995('0x12d')],_0x5511f7[_0x7995('0x66')],undefined,_0x46fbd5);if(_0x1e279e[_0x7995('0x9f')]!==-0x1){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x137'),_0x51b607));var _0x3d7e89=this[_0x7995('0x8e')]['sync'](this,_0x5511f7,_0x51b607);if(_0x3d7e89){for(var _0x49a3e6 in _0x3d7e89){if(_0x3d7e89[_0x7995('0x93')](_0x49a3e6)){this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')](_0x7995('0x138'),_0x49a3e6['toUpperCase']()),_0x3d7e89[_0x49a3e6]);}}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x139'),JSON[_0x7995('0x73')](_0x3d7e89)));}}return _0x1e279e;};AGIVertices[_0x7995('0x12')][_0x7995('0x13a')]=function(_0x1b3920){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x13b'),_0x1b3920['label']));return this[_0x7995('0xf')][_0x7995('0x13c')](_0x1b3920[_0x7995('0x40')],_0x1b3920[_0x7995('0x13d')],_0x1b3920[_0x7995('0x41')]);};AGIVertices[_0x7995('0x12')][_0x7995('0x13e')]=function(_0x537930){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x13f'),_0x537930['label']));if(!this[_0x7995('0xa6')](_0x537930[_0x7995('0x140')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x537930,_0x7995('0x141'));}try{var _0x29fb9e=eval(_0x537930['condition'])?_0x7995('0x142'):'false';this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x537930['condition'],_0x29fb9e));return{'code':0xc8,'result':_0x29fb9e};}catch(_0x41c2a0){return{'code':0xc8,'result':_0x7995('0x143')};}};AGIVertices[_0x7995('0x12')]['gotoiftime']=function(_0x449231){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x144'),_0x449231[_0x7995('0x3c')]));if(!this['isConfigured'](_0x449231[_0x7995('0x145')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x449231,_0x7995('0x146'));}var _0x132c1a=this[_0x7995('0x27')][_0x7995('0xa1')](this,_0x449231[_0x7995('0x145')]);if(!_0x132c1a){return this['channel']['error'](_0x449231,_0x7995('0x147'));}for(var _0x5673e3=0x0;_0x5673e3<_0x132c1a[_0x7995('0x98')];_0x5673e3+=0x1){var _0xe4da2d=this[_0x7995('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x132c1a[_0x5673e3]));if(_0xe4da2d[_0x7995('0x9f')]===-0x1){return _0xe4da2d;}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],_0xe4da2d[_0x7995('0x9e')]));if(_0xe4da2d[_0x7995('0x9e')]===_0x7995('0x142')){logger[_0x7995('0x33')](util['format']('IFTIME\x20%s\x20%s',_0x132c1a[_0x5673e3],'true'));this[_0x7995('0xf')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x132c1a[_0x5673e3],_0x7995('0x142')));return{'code':0xc8,'result':_0x7995('0x142')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],'false'));this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x148'),_0x132c1a[_0x5673e3],_0x7995('0x143')));}}return{'code':0xc8,'result':_0x7995('0x143')};};AGIVertices[_0x7995('0x12')][_0x7995('0x149')]=function(_0x2371ef){logger[_0x7995('0x33')](util['format'](_0x7995('0x14a'),_0x2371ef[_0x7995('0x3c')]));return this['channel'][_0x7995('0x149')]();};AGIVertices[_0x7995('0x12')][_0x7995('0x14b')]=function(_0x2529da){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x14c'),_0x2529da[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2529da['key'])){return this['channel']['noop'](_0x7995('0xe6'));}var _0x47032d='wav';var _0x4e910f=util['format'](_0x7995('0x135'),FILES_PATH,rs[_0x7995('0x115')](0x4));var _0x47ec0a=util[_0x7995('0x2d')](_0x7995('0x9b'),_0x4e910f,_0x47032d);var _0xfc0e72=!![];if(_0x2529da[_0x7995('0x136')]==='NOBEEP'){_0xfc0e72=![];}var _0x3ef225=this['channel'][_0x7995('0x12c')](_0x4e910f,_0x47032d,_0x2529da['intKey'],_0x2529da[_0x7995('0x66')],undefined,_0xfc0e72);if(_0x3ef225[_0x7995('0x9f')]!==-0x1){this['channel'][_0x7995('0xa7')](util['format'](_0x7995('0x14d'),_0x47ec0a));var _0x20da12=this[_0x7995('0x82')][_0x7995('0xa1')](this,_0x2529da,_0x47ec0a);if(_0x20da12){for(var _0x32d594 in _0x20da12){if(_0x20da12[_0x7995('0x93')](_0x32d594)){this['channel']['setVariable'](util['format']('ISPEECH_ASR_%s',_0x32d594[_0x7995('0x6b')]()),_0x20da12[_0x32d594]);}}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0x7995('0x73')](_0x20da12)));}}return _0x3ef225;};AGIVertices['prototype'][_0x7995('0x14e')]=function(_0x5a0510){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x14f'),_0x5a0510[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x5a0510[_0x7995('0x7a')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xe6'));}if(!this[_0x7995('0xa6')](_0x5a0510[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0xa8'));}this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x5a0510[_0x7995('0x5f')]));var _0x3603f5=this[_0x7995('0x7f')]['sync'](this,_0x5a0510);if(_0x3603f5){this[_0x7995('0xf')]['noop'](util[_0x7995('0x2d')](_0x7995('0x14d'),_0x3603f5));var _0xa6d830=this[_0x7995('0xf')]['streamFile'](_0x3603f5,_0x5a0510[_0x7995('0x12d')]);try{fs[_0x7995('0x100')](_0x3603f5+'.wav');}catch(_0x579faf){logger['error'](_0x579faf);}return _0xa6d830;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x5a0510,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')]['login']=function(_0x3c5a7e){logger['info'](util[_0x7995('0x2d')](_0x7995('0x150'),_0x3c5a7e['label']));if(!this['isConfigured'](_0x3c5a7e[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3c5a7e,'no\x20find\x20by\x20configured');}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));var _0x30a99f=this[_0x7995('0x153')][_0x7995('0xa1')](this,_0x3c5a7e['findBy']);if(_0x30a99f){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x3c5a7e[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices['prototype'][_0x7995('0x157')]=function(_0x318bf0){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x158'),_0x318bf0[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x318bf0[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x318bf0,_0x7995('0x159'));}logger['info'](util[_0x7995('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));var _0x256c33=this['agentLogout'][_0x7995('0xa1')](this,_0x318bf0['findBy']);if(_0x256c33){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x155'),this['channel']['callerid'],_0x318bf0['findBy']));this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x318bf0[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x15b')]=function(_0x3d52af){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x15c'),_0x3d52af[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3d52af['operation'])){return this['channel'][_0x7995('0x31')](_0x3d52af,'no\x20operation\x20configured');}this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x15d'),_0x3d52af['operation']));var _0x440306=eval(_0x3d52af[_0x7995('0x15e')]);if(!this[_0x7995('0xa6')](_0x3d52af['variable_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x592c0d=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x3d52af['variable_id']);if(!_0x592c0d){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3d52af,_0x7995('0xd9'));}if(_[_0x7995('0x97')](_0x440306)){var _0x5e5c7d=this;_0x440306[_0x7995('0xda')](function(_0x224d43,_0x47f884){_0x5e5c7d[_0x7995('0xf')][_0x7995('0x9c')](util['format'](_0x7995('0x15f'),_0x592c0d,_0x47f884),_0x224d43);});return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x160'),_0x592c0d));}else{return this[_0x7995('0xf')]['setVariable'](_0x592c0d,_0x440306);}};AGIVertices[_0x7995('0x12')]['menu']=function(_0x14c1c0){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x161'),_0x14c1c0[_0x7995('0x3c')]));if(_0x14c1c0[_0x7995('0xa2')]===0x0){return this['maxRetry'](_0x14c1c0);}_0x14c1c0[_0x7995('0xa2')]-=0x1;if(!this[_0x7995('0xa6')](_0x14c1c0[_0x7995('0x10d')])){return this[_0x7995('0xf')]['error'](_0x14c1c0,_0x7995('0x10e'));}var _0x470b9b=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x14c1c0[_0x7995('0x10d')]);if(!_0x470b9b){return this[_0x7995('0xf')][_0x7995('0x31')](_0x14c1c0,_0x7995('0x162'));}var _0x40a3a0=this[_0x7995('0xf')]['getData'](_0x470b9b,_0x14c1c0[_0x7995('0x110')],_0x14c1c0[_0x7995('0x163')]);var _0x50b260=_0x40a3a0[_0x7995('0x9f')];if(_0x40a3a0[_0x7995('0x9f')]===-0x1){this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x14c1c0,'-1');return _0x40a3a0;}else if(_0x40a3a0[_0x7995('0x9e')]===_0x7995('0x66')){_0x40a3a0[_0x7995('0x9f')]=_0x40a3a0['result']['length']>0x0?_0x40a3a0[_0x7995('0x9f')]:'t';}else if(_[_0x7995('0x46')](_0x40a3a0[_0x7995('0x9f')])){_0x40a3a0[_0x7995('0x9f')]='#';_0x50b260='#';}if(!this[_0x7995('0xa6')](_0x14c1c0[_0x7995('0xd8')])){this[_0x7995('0xf')]['noop'](_0x7995('0xd7'));}else{var _0x444c63=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x14c1c0['variable_id']);if(!_0x444c63){return this[_0x7995('0xf')][_0x7995('0x31')](_0x14c1c0,'no\x20variable\x20found');}this[_0x7995('0xf')]['setVariable'](_0x444c63,_0x50b260);}this['createSquareDetailsReport']['sync'](this,_0x14c1c0,_0x50b260);return _0x40a3a0;};AGIVertices[_0x7995('0x12')][_0x7995('0xa7')]=function(_0x4285ea){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4285ea[_0x7995('0x3c')]));return this['channel'][_0x7995('0xa7')](_0x4285ea[_0x7995('0x164')]||_0x4285ea[_0x7995('0x3c')]);};AGIVertices[_0x7995('0x12')][_0x7995('0x165')]=function(_0x3834cb){logger['info'](util['format'](_0x7995('0x166'),_0x3834cb[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x3834cb[_0x7995('0x151')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3834cb,_0x7995('0x159'));}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this['channel'][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));var _0x809714=this[_0x7995('0x50')][_0x7995('0xa1')](this,_0x3834cb['pause_id']);var _0x59dcb7=this[_0x7995('0x52')][_0x7995('0xa1')](this,_0x3834cb[_0x7995('0x151')],_0x809714);if(_0x59dcb7){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel']['callerid'],_0x3834cb[_0x7995('0x151')]));this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x154'),this['channel'][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x3834cb[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x167')]=function(_0x46f98d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x168'),_0x46f98d['label']));if(!this[_0x7995('0xa6')](_0x46f98d[_0x7995('0x10d')])){return this['channel']['error'](_0x46f98d,_0x7995('0x10e'));}var _0x581f8d=this[_0x7995('0x22')][_0x7995('0xa1')](this,_0x46f98d[_0x7995('0x10d')]);if(!_0x581f8d){return this[_0x7995('0xf')][_0x7995('0x31')](_0x46f98d,_0x7995('0x162'));}var _0x36e464=this[_0x7995('0xf')]['exec']('PLAYBACK',[_0x581f8d,_0x46f98d['opts']]);if(_0x36e464[_0x7995('0x9f')]===-0x1){return _0x36e464;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),'PLAYBACK',_0x581f8d));};AGIVertices[_0x7995('0x12')]['queue']=function(_0x35e820){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x35e820['label']));if(!this['isConfigured'](_0x35e820['queue_id'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x35e820,_0x7995('0x169'));}var _0x5dfc42='';var _0x4a1669=parseInt(_0x35e820[_0x7995('0x16a')],0xa);if(isNaN(_0x4a1669)){_0x5dfc42=_0x35e820[_0x7995('0x16a')];}else{_0x5dfc42=this['getVoiceQueue'][_0x7995('0xa1')](this,_0x35e820[_0x7995('0x16a')]);if(!_0x5dfc42){return this[_0x7995('0xf')][_0x7995('0x31')](_0x35e820,_0x7995('0x16b'));}}var _0x189645='';if(this[_0x7995('0xa6')](_0x35e820[_0x7995('0x10d')])){var _0x33ce52=this['getSound']['sync'](this,_0x35e820[_0x7995('0x10d')]);if(_0x33ce52){_0x189645=_0x33ce52;}}this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x35e820,_0x5dfc42);if(_0x35e820[_0x7995('0xe2')][_0x7995('0x16c')]('x')<0x0){_0x35e820[_0x7995('0xe2')]+='x';}if(_0x35e820[_0x7995('0xe2')][_0x7995('0x16c')]('X')<0x0){_0x35e820[_0x7995('0xe2')]+='X';}this[_0x7995('0xf')][_0x7995('0x9c')]('XMCS-QUEUE',_0x5dfc42?_0x5dfc42['toLowerCase']():'');var _0x5dee7a=this[_0x7995('0xf')][_0x7995('0xa9')](_0x7995('0x16d'),[_0x5dfc42,_0x35e820[_0x7995('0xe2')],_0x35e820[_0x7995('0x64')],_0x189645,_0x35e820['timeout'],_0x35e820[_0x7995('0xb4')],_0x35e820[_0x7995('0x16e')],_0x35e820[_0x7995('0x16f')],'',_0x35e820[_0x7995('0x170')]]);if(_0x5dee7a[_0x7995('0x9f')]===-0x1){return _0x5dee7a;}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xc2'),_0x7995('0x16d'),_0x5dfc42));};AGIVertices['prototype']['record']=function(_0x57dff9){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x171'),_0x57dff9['label']));var _0x15b5da=_0x57dff9['recordingFormat']||_0x7995('0x134');var _0x6ff635=util[_0x7995('0x2d')](_0x7995('0x172'),this[_0x7995('0xf')]['uniqueid'],rs[_0x7995('0x115')](0x5));var _0x5d1459=util[_0x7995('0x2d')](_0x7995('0x173'),FILES_PATH,_0x6ff635,_0x15b5da);var _0x29ceb8=util['format'](_0x7995('0x135'),FILES_PATH,_0x6ff635);this[_0x7995('0x3f')][_0x7995('0xa1')](this,_0x57dff9,_0x6ff635,_0x5d1459);this[_0x7995('0xf')][_0x7995('0x9c')](_0x7995('0x174'),_0x6ff635);logger[_0x7995('0x33')](_0x7995('0x175'),_0x29ceb8,_0x15b5da,_0x57dff9['escape_digits'],_0x57dff9['timeout']);return this[_0x7995('0xf')][_0x7995('0x12c')](_0x29ceb8,_0x15b5da,_0x57dff9[_0x7995('0x176')],_0x57dff9[_0x7995('0x66')],undefined,!![]);};AGIVertices[_0x7995('0x12')][_0x7995('0x177')]=function(_0xeae7ec){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xeae7ec[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0xeae7ec[_0x7995('0x64')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x178'));}var _0x481ce1=this['restAPI'][_0x7995('0xa1')](this,_0xeae7ec);logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x179'),util[_0x7995('0x17a')](_0x481ce1,{'showHidden':![],'depth':null})));if(!this[_0x7995('0xa6')](_0xeae7ec[_0x7995('0xd8')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x17b'));}var _0x527023=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0xeae7ec['variable_id']);if(!_0x527023){return this[_0x7995('0xf')]['error'](_0xeae7ec,'no\x20variable\x20found');}this[_0x7995('0xf')][_0x7995('0x9c')](util[_0x7995('0x2d')](_0x7995('0x17c'),_0x527023),_0x481ce1[_0x7995('0x75')]?_0x481ce1['statusCode']:_0x7995('0x17d'));this[_0x7995('0xf')]['setVariable'](util[_0x7995('0x2d')]('%s_STATUS_MESSAGE',_0x527023),_0x481ce1['statusMessage']?_0x481ce1[_0x7995('0x76')]:'OK');if(_0x481ce1[_0x7995('0x6c')]){try{this[_0x7995('0x9a')](_0x481ce1[_0x7995('0x6c')],_0x527023);}catch(_0x2b3dad){logger[_0x7995('0x31')](util[_0x7995('0x2d')](_0x7995('0x17e'),_0x527023));}}return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0xdd'),_0x527023));};AGIVertices[_0x7995('0x12')][_0x7995('0x17f')]=function(_0x1aee3d){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x180'),_0x1aee3d[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0x181')](_0x1aee3d[_0x7995('0x182')][_0x7995('0x5b')](/\s+/g,''),_0x1aee3d[_0x7995('0x176')]);};AGIVertices['prototype'][_0x7995('0x183')]=function(_0x440afa){logger['info'](util[_0x7995('0x2d')](_0x7995('0x184'),_0x440afa['label']));return this[_0x7995('0xf')]['sayNumber'](_0x440afa['number'][_0x7995('0x5b')](/\s+/g,''),_0x440afa[_0x7995('0x176')]);};AGIVertices[_0x7995('0x12')]['sayphonetic']=function(_0x9ee5b7){logger['info'](util['format'](_0x7995('0x185'),_0x9ee5b7[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0x186')](_0x9ee5b7[_0x7995('0x5f')],_0x9ee5b7[_0x7995('0x176')]);};AGIVertices['prototype'][_0x7995('0x187')]=function(_0x3de4fc){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x188'),_0x3de4fc['label']));if(!this[_0x7995('0xa6')](_0x3de4fc[_0x7995('0x189')])){return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x18a'));}var _0x3769e4=this[_0x7995('0x18b')][_0x7995('0xa1')](this,_0x3de4fc[_0x7995('0x189')]);if(!_0x3769e4||!_0x3769e4[_0x7995('0x18c')]){return this[_0x7995('0xf')][_0x7995('0x31')](_0x3de4fc,_0x7995('0x18d'));}var _0x2a4a1d={'from':util[_0x7995('0x2d')](_0x7995('0x18e'),_0x3769e4['name'],_0x3769e4[_0x7995('0x18f')]||_0x3769e4[_0x7995('0x18c')]['user']),'to':_0x3de4fc['to']||'','cc':_0x3de4fc['cc']||'','bcc':_0x3de4fc[_0x7995('0x190')]||'','subject':_0x3de4fc[_0x7995('0x191')],'html':_0x3de4fc[_0x7995('0x5f')],'text':_0x3de4fc[_0x7995('0x5f')]};if(this['isConfigured'](_0x3de4fc[_0x7995('0x192')])){}logger['debug']('sendMail\x20message',JSON[_0x7995('0x73')](_0x2a4a1d));this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3de4fc,_0x3de4fc[_0x7995('0x189')]);this[_0x7995('0xf')][_0x7995('0xa7')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x3769e4[_0x7995('0x15')]));this['sendMailMessage'][_0x7995('0xa1')](this,_0x3769e4['smtpOptions'],_0x2a4a1d);return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x193'));};AGIVertices[_0x7995('0x12')][_0x7995('0x194')]=function(_0x4127d4){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x195'),_0x4127d4[_0x7995('0x3c')]));return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x196'));};AGIVertices[_0x7995('0x12')][_0x7995('0x197')]=function(_0x5b9bc8){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5b9bc8['label']));if(!this[_0x7995('0xa6')](_0x5b9bc8['sms_account_id'])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20sms\x20account\x20configured');}var _0x281a99=this['getSmsAccount'][_0x7995('0xa1')](this,_0x5b9bc8[_0x7995('0x198')]);if(!_0x281a99){return this[_0x7995('0xf')][_0x7995('0x31')](_0x5b9bc8,_0x7995('0x199'));}var _0x59a164={'body':_0x5b9bc8[_0x7995('0x19a')],'phone':_0x5b9bc8['to']||'','SmsAccountId':_0x281a99['id']};logger[_0x7995('0x19b')](_0x7995('0x19c'),JSON[_0x7995('0x73')](_0x59a164));this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x5b9bc8,_0x5b9bc8['sms_account_id']);this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x19d'),_0x281a99[_0x7995('0x15')]));this[_0x7995('0x19e')][_0x7995('0xa1')](this,_0x59a164);return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x19f'));};AGIVertices[_0x7995('0x12')][_0x7995('0x1a0')]=function(_0x1bc621){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1a1'),_0x1bc621['label']));if(!this['isConfigured'](_0x1bc621['variable_id'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x1bc621,_0x7995('0x1a2'));}var _0x53330d=this[_0x7995('0x13')][_0x7995('0xa1')](this,_0x1bc621['variable_id']);if(!_0x53330d){return this['channel'][_0x7995('0x31')](_0x1bc621,_0x7995('0xd9'));}return this[_0x7995('0xf')]['setVariable'](_0x53330d,_0x1bc621['variable_value']);};AGIVertices[_0x7995('0x12')][_0x7995('0x1a3')]=function(_0x4a1d16){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1a4'),_0x4a1d16[_0x7995('0x3c')]));this[_0x7995('0xf')][_0x7995('0xa7')]('START\x20CALLY\x20SQUARE');var _0x998404=this[_0x7995('0xf')][_0x7995('0x13')](_0x7995('0x1a5'));if(!_[_0x7995('0x46')](_0x998404['extra'])){this[_0x7995('0xf')][_0x7995('0x3b')]=_0x998404[_0x7995('0x9e')];}if(_0x4a1d16[_0x7995('0xb7')]===_0x7995('0x1a6')){this[_0x7995('0xf')][_0x7995('0xa7')]('Answer');return this[_0x7995('0xf')][_0x7995('0xb7')]();}return this[_0x7995('0xf')][_0x7995('0xa7')](_0x7995('0x1a7'));};AGIVertices[_0x7995('0x12')]['subproject']=function(_0x2a9e52){logger[_0x7995('0x33')](util[_0x7995('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a9e52[_0x7995('0x3c')]));if(!this[_0x7995('0xa6')](_0x2a9e52[_0x7995('0x1a8')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,'no\x20subproject\x20selected');}var _0x47a637=this[_0x7995('0x1a')][_0x7995('0xa1')](this,_0x2a9e52['project_id']);if(!this[_0x7995('0xa6')](_0x47a637)){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,util[_0x7995('0x2d')](_0x7995('0x1a9'),_0x2a9e52['project_id']));}if(_0x47a637===this['channel'][_0x7995('0x43')]){return this[_0x7995('0xf')][_0x7995('0x31')](_0x2a9e52,_0x7995('0x1aa'));}this['createSquareDetailsReport'][_0x7995('0xa1')](this,_0x2a9e52,_0x47a637);var _0x35c160=this[_0x7995('0xf')]['exec'](_0x7995('0x1ab'),util[_0x7995('0x2d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x7995('0x1ac')]||_0x7995('0x1ad'),_0x47a637,this[_0x7995('0xf')][_0x7995('0x43')]));if(_0x35c160[_0x7995('0x9f')]===-0x1){return _0x35c160;}return this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('Executed\x20command\x20%s\x20%s',_0x7995('0x1ab'),_0x47a637));};AGIVertices[_0x7995('0x12')][_0x7995('0x1ae')]=function(_0x3c40f7){logger[_0x7995('0x33')](util['format'](_0x7995('0x1af'),_0x3c40f7[_0x7995('0x3c')]));var _0x1103bd=this[_0x7995('0x59')]['sync'](this,_0x3c40f7[_0x7995('0x1b0')]);this[_0x7995('0x3a')][_0x7995('0xa1')](this,_0x3c40f7,_0x3c40f7[_0x7995('0x1b0')]);if(this[_0x7995('0xa6')](_0x3c40f7[_0x7995('0xd8')])){var _0x357e43=this['getVariable'][_0x7995('0xa1')](this,_0x3c40f7['variable_id']);if(_0x357e43){this['channel'][_0x7995('0x9c')](_0x357e43,_0x1103bd);return this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1b1'),_0x3c40f7[_0x7995('0x1b0')],_0x357e43));}}return this['channel']['noop'](util[_0x7995('0x2d')](_0x7995('0x1b2'),_0x3c40f7[_0x7995('0x1b0')]));};AGIVertices[_0x7995('0x12')][_0x7995('0x1b3')]=function(_0x42f70e){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1b4'),_0x42f70e[_0x7995('0x3c')]));_0x42f70e[_0x7995('0x5f')]=_0x42f70e['text'][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7995('0xa6')](_0x42f70e[_0x7995('0x5d')])){return this['channel'][_0x7995('0xa7')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x42f70e[_0x7995('0x5f')])){return this[_0x7995('0xf')][_0x7995('0xa7')]('no\x20text\x20configured');}this['channel'][_0x7995('0xa7')](util[_0x7995('0x2d')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x42f70e['text']));var _0x1a3d21=this[_0x7995('0x5c')][_0x7995('0xa1')](this,_0x42f70e);if(_0x1a3d21){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1b5'),_0x1a3d21));var _0x277e1f=this[_0x7995('0xf')][_0x7995('0x11e')](_0x1a3d21);try{fs[_0x7995('0x100')](_0x1a3d21+_0x7995('0x101'));}catch(_0x43d909){logger[_0x7995('0x31')](_0x43d909);}return _0x277e1f;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x42f70e,_0x7995('0x1b6'));};AGIVertices['prototype'][_0x7995('0x1b7')]=function(_0x117740){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1b8'),_0x117740[_0x7995('0x3c')]));_0x117740[_0x7995('0x5f')]=_0x117740[_0x7995('0x5f')][_0x7995('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7995('0xa6')](_0x117740[_0x7995('0x5f')])){return this['channel']['noop'](_0x7995('0xa8'));}this['channel'][_0x7995('0xa7')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x117740[_0x7995('0x5f')]));var _0x55c6ec=this[_0x7995('0x1b9')][_0x7995('0xa1')](this,_0x117740);if(_0x55c6ec){this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x1ba'),_0x55c6ec));var _0x4801db=this['channel']['streamFile'](_0x55c6ec);try{fs[_0x7995('0x100')](_0x55c6ec+_0x7995('0x101'));}catch(_0x24ad6d){logger['error'](_0x24ad6d);}return _0x4801db;}return this[_0x7995('0xf')][_0x7995('0x31')](_0x117740,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7995('0x12')][_0x7995('0x1bb')]=function(_0x29c90f){logger[_0x7995('0x33')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x29c90f[_0x7995('0x3c')]));if(!this['isConfigured'](_0x29c90f['findBy'])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x29c90f,_0x7995('0x159'));}logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x152'),this[_0x7995('0xf')]['callerid'],_0x29c90f[_0x7995('0x151')]));var _0x239d26=this[_0x7995('0x53')][_0x7995('0xa1')](this,_0x29c90f['findBy']);if(_0x239d26){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f['findBy']));this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0x154'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f[_0x7995('0x151')]));return{'code':0xc8,'result':_0x7995('0x15a')};}else{logger[_0x7995('0x33')](util[_0x7995('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f[_0x7995('0x151')]));this[_0x7995('0xf')][_0x7995('0xa7')](util[_0x7995('0x2d')](_0x7995('0x155'),this[_0x7995('0xf')][_0x7995('0x3e')],_0x29c90f['findBy']));return{'code':0xc8,'result':_0x7995('0x156')};}};AGIVertices[_0x7995('0x12')][_0x7995('0x1bc')]=function(_0xd36d08){logger[_0x7995('0x33')](util['format'](_0x7995('0x1bd'),_0xd36d08[_0x7995('0x3c')]));var _0xf4f561=this['channel']['exec'](_0x7995('0x1be'),[_0xd36d08[_0x7995('0x1bf')],_0xd36d08[_0x7995('0x78')]]);if(_0xf4f561[_0x7995('0x9f')]===-0x1){return _0xf4f561;}return this[_0x7995('0xf')][_0x7995('0xa7')](util['format'](_0x7995('0xc2'),'VOICEMAIL',_0xd36d08[_0x7995('0x1bf')]));};AGIVertices[_0x7995('0x12')][_0x7995('0x1c0')]=function(_0x4cda76){logger[_0x7995('0x33')](util[_0x7995('0x2d')](_0x7995('0x1c1'),_0x4cda76[_0x7995('0x3c')]));if(!this['isConfigured'](_0x4cda76[_0x7995('0xd8')])){return this[_0x7995('0xf')][_0x7995('0x31')](_0x4cda76,_0x7995('0x1a2'));}var _0x2b143f=this['getVariable'][_0x7995('0xa1')](this,_0x4cda76[_0x7995('0xd8')]);if(!_0x2b143f){return this[_0x7995('0xf')][_0x7995('0x31')](_0x4cda76,'no\x20variable\x20found');}var _0x2f3ebf=this[_0x7995('0xf')][_0x7995('0x13')](_0x2b143f);return{'code':0xc8,'result':_0x2f3ebf[_0x7995('0x9e')]?_0x2f3ebf[_0x7995('0x9e')]:'-'};};String[_0x7995('0x12')][_0x7995('0x1c2')]=function(_0x1cea51,_0x949896){return this['split'](_0x1cea51)[_0x7995('0x1c3')](_0x949896);};module[_0x7995('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8605e55..244590b 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 _0x3098=['ACW','mandatoryDispositionPause','resolve','getAgent','voicePause','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x3098,0x86));var _0x8309=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x3098[_0x45161c];return _0x186581;};'use strict';var _=require(_0x8309('0x0'));var moment=require(_0x8309('0x1'));var ami=require(_0x8309('0x2'));var logger=require(_0x8309('0x3'))('acw');var RpcUser=require(_0x8309('0x4'));var RpcVoiceAgentReport=require(_0x8309('0x5'));function Acw(_0x9aa807){this[_0x8309('0x6')]=_0x9aa807[_0x8309('0x6')];this[_0x8309('0x7')]=_0x9aa807[_0x8309('0x7')];this[_0x8309('0x8')]=_0x9aa807[_0x8309('0x8')];this[_0x8309('0x9')]={};ami['on']('agentconnect',this[_0x8309('0xa')]['bind'](this));ami['on'](_0x8309('0xb'),this[_0x8309('0xc')]['bind'](this));ami['on']('hangup',this[_0x8309('0xd')][_0x8309('0xe')](this));ami['on'](_0x8309('0xf'),this[_0x8309('0x10')][_0x8309('0xe')](this));ami['on']('attendedtransfer',this[_0x8309('0x11')][_0x8309('0xe')](this));ami['on'](_0x8309('0x12'),this[_0x8309('0x13')][_0x8309('0xe')](this));ami['on']('custom:agentConnectPreview',this[_0x8309('0x14')]['bind'](this));}function getDiff(_0x27ae25){var _0x57b2d3=moment()[_0x8309('0x15')](0x0);var _0x38bbc0=moment(_0x27ae25)[_0x8309('0x15')](0x0);return _0x57b2d3[_0x8309('0x16')](_0x38bbc0,_0x8309('0x17'));}Acw[_0x8309('0x18')][_0x8309('0x19')]=function(_0x5424cd,_0x49e8a7){var _0x2aefda=this;var _0x27d4ca=getDiff(_0x2aefda[_0x8309('0x8')][_0x5424cd][_0x8309('0x1a')]);clearTimeout(_0x2aefda[_0x8309('0x8')][_0x5424cd][_0x8309('0x1b')]);_0x2aefda[_0x8309('0x8')][_0x5424cd][_0x8309('0x1b')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x27d4ca},_0x2aefda[_0x8309('0x8')][_0x5424cd][_0x8309('0x1c')],_0x5424cd)[_0x8309('0x1d')](function(_0x3d0c28){logger[_0x8309('0x1e')](_0x8309('0x1f'),_0x49e8a7,_0x27d4ca,_0x3d0c28);})[_0x8309('0x20')](function(_0x158aec){logger[_0x8309('0x21')](_0x8309('0x22'),_0x49e8a7,_0x158aec);})[_0x8309('0x23')](function(){delete _0x2aefda[_0x8309('0x8')][_0x5424cd];});};Acw['prototype']['startAcw']=function(_0xa5faa2){try{var _0x1ffe6e=this;var _0x39989f=this[_0x8309('0x9')][_0xa5faa2][_0x8309('0x24')];var _0x2e2a94=this['channels'][_0xa5faa2][_0x8309('0x25')];var _0x350f51=this[_0x8309('0x6')][_0x2e2a94];var _0x5b5306=![];var _0x30d242=_0x8309('0x26');if(_0x350f51['mandatoryDisposition']&&_0x350f51[_0x8309('0x27')]['name']){_0x5b5306=!![];_0x30d242=_0x350f51[_0x8309('0x27')]['name'];}if(!_0x1ffe6e[_0x8309('0x7')][_0x39989f]){return Promise[_0x8309('0x28')]();}return RpcUser[_0x8309('0x29')](_0x1ffe6e[_0x8309('0x7')][_0x39989f]['id'])['then'](function(_0xe44493){if(!_0xe44493||_0xe44493[_0x8309('0x2a')]){logger[_0x8309('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0xa5faa2,_0x39989f,_0x2e2a94);return;}logger[_0x8309('0x1e')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xa5faa2,_0x39989f,_0x2e2a94);var _0x14765b=_0x1ffe6e[_0x8309('0x9')][_0xa5faa2][_0x8309('0x2b')]&&_0x1ffe6e[_0x8309('0x9')][_0xa5faa2][_0x8309('0x2c')]?_0x1ffe6e[_0x8309('0x9')][_0xa5faa2][_0x8309('0x2c')]:_0xa5faa2;return RpcUser[_0x8309('0x2d')](_0x1ffe6e[_0x8309('0x7')][_0x39989f],_0x30d242,_0x14765b);})['then'](function(_0x5680d8){if(_0x5b5306||!_0x5680d8){return;}_0x1ffe6e[_0x8309('0x8')][_0x39989f]={};logger[_0x8309('0x1e')](_0x8309('0x2e'),_0xa5faa2,_0x1ffe6e[_0x8309('0x6')][_0x2e2a94][_0x8309('0x2f')],_0x39989f,_0x2e2a94);_0x1ffe6e[_0x8309('0x8')][_0x39989f][_0x8309('0x1b')]=setTimeout(_0x1ffe6e['stopAcw'][_0x8309('0xe')](_0x1ffe6e,_0x39989f),_0x1ffe6e[_0x8309('0x6')][_0x2e2a94][_0x8309('0x2f')]*0x3e8);_0x1ffe6e[_0x8309('0x8')][_0x39989f][_0x8309('0x1a')]=moment()[_0x8309('0x30')](_0x8309('0x31'));_0x1ffe6e['timers'][_0x39989f]['uniqueid']=_0xa5faa2;_0x1ffe6e['timers'][_0x39989f]['queue']=_0x2e2a94;_0x1ffe6e['timers'][_0x39989f][_0x8309('0x19')]=_0x1ffe6e[_0x8309('0x19')][_0x8309('0xe')](_0x1ffe6e,_0x39989f,_0xa5faa2);})[_0x8309('0x20')](function(){logger[_0x8309('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xa5faa2,_0x1ffe6e[_0x8309('0x6')][_0x2e2a94][_0x8309('0x2f')],_0x39989f,_0x2e2a94);})['finally'](function(){delete _0x1ffe6e[_0x8309('0x9')][_0xa5faa2];});}catch(_0x20204d){logger[_0x8309('0x21')](_0x8309('0x32'),_0x20204d[_0x8309('0x33')]);}};Acw['prototype']['stopAcw']=function(_0x2065e7){try{var _0x4bebeb=this;if(_0x4bebeb[_0x8309('0x8')][_0x2065e7]){_0x4bebeb[_0x8309('0x8')][_0x2065e7][_0x8309('0x1b')]=![];var _0x50cafd=_0x4bebeb[_0x8309('0x8')][_0x2065e7]['uniqueid'];var _0x137ec0=_0x4bebeb[_0x8309('0x8')][_0x2065e7][_0x8309('0x25')];var _0x1b48de=_0x4bebeb[_0x8309('0x6')][_0x137ec0][_0x8309('0x2f')];logger[_0x8309('0x1e')](_0x8309('0x34'),_0x50cafd,_0x2065e7);RpcUser[_0x8309('0x29')](this[_0x8309('0x7')][_0x2065e7]['id'])['then'](function(_0xac2fc4){if(_0xac2fc4[_0x8309('0x35')]===_0x8309('0x26')){return RpcUser[_0x8309('0x36')](_0x4bebeb['agents'][_0x2065e7]);}});RpcVoiceAgentReport[_0x8309('0x37')]({'acwtime':_0x1b48de,'agentacw':!![]},_0x50cafd,_0x2065e7)['then'](function(_0x3c8f61){logger[_0x8309('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x50cafd,_0x1b48de,_0x3c8f61);})[_0x8309('0x20')](function(_0x469ef4){logger[_0x8309('0x21')](_0x8309('0x22'),_0x50cafd,_0x469ef4);});}else{logger[_0x8309('0x21')](_0x8309('0x38'),_0x2065e7);if(_0x4bebeb[_0x8309('0x8')]){logger[_0x8309('0x1e')](_0x8309('0x39'),JSON[_0x8309('0x3a')](_0x4bebeb[_0x8309('0x8')]));}}}catch(_0x481f0f){logger[_0x8309('0x21')](_0x8309('0x3b'),_0x481f0f[_0x8309('0x33')]);}};Acw[_0x8309('0x18')]['syncAgentConnect']=function(_0x1c7017){try{if(this[_0x8309('0x6')][_0x1c7017[_0x8309('0x25')]]&&(this[_0x8309('0x6')][_0x1c7017['queue']][_0x8309('0x3c')]||this[_0x8309('0x6')][_0x1c7017['queue']]['mandatoryDisposition'])){if(this['agents'][_0x1c7017[_0x8309('0x24')]]){this[_0x8309('0x9')][_0x1c7017['uniqueid']]={'queue':_0x1c7017['queue'],'interface':_0x1c7017[_0x8309('0x24')],'destlinkedid':_0x1c7017[_0x8309('0x2c')]};}}}catch(_0x7db781){logger[_0x8309('0x21')](_0x8309('0x3d'),_0x7db781[_0x8309('0x33')]);}};Acw[_0x8309('0x18')][_0x8309('0x14')]=function(_0x26b6e6){try{if(this[_0x8309('0x6')][_0x26b6e6[_0x8309('0x25')]]&&(this[_0x8309('0x6')][_0x26b6e6['queue']][_0x8309('0x3c')]||this[_0x8309('0x6')][_0x26b6e6['queue']]['mandatoryDisposition'])){if(this[_0x8309('0x7')][_0x26b6e6[_0x8309('0x24')]]){this[_0x8309('0x9')][_0x26b6e6['uniqueid']]={'queue':_0x26b6e6['queue'],'interface':_0x26b6e6[_0x8309('0x24')]};}}}catch(_0x5798c){logger[_0x8309('0x21')](_0x8309('0x3e'),_0x5798c[_0x8309('0x33')]);}};Acw[_0x8309('0x18')][_0x8309('0xc')]=function(_0xa4b1c){try{if(this[_0x8309('0x9')][_0xa4b1c['uniqueid']]&&_[_0x8309('0x3f')](this[_0x8309('0x9')][_0xa4b1c[_0x8309('0x1c')]]['attended'])){logger[_0x8309('0x1e')](_0x8309('0x40'),_0xa4b1c['uniqueid']);this[_0x8309('0x41')](_0xa4b1c[_0x8309('0x1c')]);}else if(this[_0x8309('0x9')][_0xa4b1c[_0x8309('0x42')]]&&_[_0x8309('0x3f')](this[_0x8309('0x9')][_0xa4b1c[_0x8309('0x42')]][_0x8309('0x2b')])){logger[_0x8309('0x1e')](_0x8309('0x43'),_0xa4b1c['linkedid']);this[_0x8309('0x41')](_0xa4b1c[_0x8309('0x42')]);}}catch(_0x3977ad){logger['error'](_0x8309('0x44'),_0x3977ad[_0x8309('0x33')]);}};Acw[_0x8309('0x18')][_0x8309('0xd')]=function(_0x2ac775){try{if(this[_0x8309('0x9')][_0x2ac775['uniqueid']]&&this[_0x8309('0x9')][_0x2ac775['uniqueid']]['attended']){logger[_0x8309('0x1e')](_0x8309('0x45'),_0x2ac775['uniqueid']);this[_0x8309('0x41')](_0x2ac775[_0x8309('0x1c')]);}else if(this[_0x8309('0x9')][_0x2ac775[_0x8309('0x42')]]&&this[_0x8309('0x9')][_0x2ac775[_0x8309('0x42')]][_0x8309('0x2b')]){logger[_0x8309('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2ac775[_0x8309('0x42')]);this[_0x8309('0x41')](_0x2ac775[_0x8309('0x42')]);}}catch(_0x5c2b01){logger[_0x8309('0x21')](_0x8309('0x46'),_0x5c2b01[_0x8309('0x33')]);}};Acw['prototype'][_0x8309('0x11')]=function(_0x4a247e){try{if(!_[_0x8309('0x47')](this[_0x8309('0x9')][_0x4a247e[_0x8309('0x48')]])){this['startAcw'](_0x4a247e['transfereeuniqueid']);if(this[_0x8309('0x9')][_0x4a247e['secondtransfereruniqueid']]){this['channels'][_0x4a247e[_0x8309('0x49')]]['attended']=!![];this[_0x8309('0x9')][_0x4a247e[_0x8309('0x4a')]]=this[_0x8309('0x9')][_0x4a247e[_0x8309('0x49')]];delete this[_0x8309('0x9')][_0x4a247e[_0x8309('0x49')]];}}else if(!_[_0x8309('0x47')](this[_0x8309('0x9')][_0x4a247e['transfertargetuniqueid']])){this[_0x8309('0x41')](_0x4a247e[_0x8309('0x4a')]);if(this['channels'][_0x4a247e[_0x8309('0x4b')]]){this['channels'][_0x4a247e[_0x8309('0x4b')]]['attended']=!![];this[_0x8309('0x9')][_0x4a247e['transfereeuniqueid']]=this['channels'][_0x4a247e['origtransfereruniqueid']];delete this['channels'][_0x4a247e[_0x8309('0x4b')]];}}}catch(_0x368947){logger['error'](_0x8309('0x4c'),_0x368947[_0x8309('0x33')]);}};Acw[_0x8309('0x18')][_0x8309('0x13')]=function(_0xf74702){try{if(this[_0x8309('0x9')][_0xf74702['transfereruniqueid']]){logger[_0x8309('0x1e')](_0x8309('0x4d'),JSON[_0x8309('0x3a')](_0xf74702[_0x8309('0x4e')]));this[_0x8309('0x41')](_0xf74702[_0x8309('0x4e')]);}else if(this[_0x8309('0x9')][_0xf74702['transfererlinkedid']]){logger[_0x8309('0x1e')](_0x8309('0x4f'),JSON[_0x8309('0x3a')](_0xf74702[_0x8309('0x50')]));this[_0x8309('0x41')](_0xf74702[_0x8309('0x50')]);}}catch(_0x1a6a3d){logger[_0x8309('0x21')](_0x8309('0x51'),_0x1a6a3d['message']);}};Acw['prototype'][_0x8309('0x10')]=function(_0x5cb14e){try{if(this['voiceQueues'][_0x5cb14e[_0x8309('0x25')]]&&this['voiceQueues'][_0x5cb14e['queue']]['autopause']==='all'){if(this['agents'][_0x5cb14e[_0x8309('0x24')]]){logger[_0x8309('0x1e')](_0x8309('0x52'),_0x5cb14e[_0x8309('0x1c')],_0x5cb14e[_0x8309('0x24')],_0x5cb14e[_0x8309('0x25')]);return RpcUser[_0x8309('0x2d')](this[_0x8309('0x7')][_0x5cb14e[_0x8309('0x24')]],_0x8309('0x53'),_0x5cb14e[_0x8309('0x1c')]);}}}catch(_0x4794d8){logger[_0x8309('0x21')](_0x8309('0x54'),_0x4794d8[_0x8309('0x33')]);}};module[_0x8309('0x55')]=Acw; \ No newline at end of file +var _0xd101=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','catch','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid'];(function(_0xe03984,_0x2fd729){var _0x365f67=function(_0x56d9e3){while(--_0x56d9e3){_0xe03984['push'](_0xe03984['shift']());}};_0x365f67(++_0x2fd729);}(_0xd101,0xc1));var _0x1d10=function(_0x407b20,_0x4ca4ff){_0x407b20=_0x407b20-0x0;var _0xa0b0f7=_0xd101[_0x407b20];return _0xa0b0f7;};'use strict';var _=require(_0x1d10('0x0'));var moment=require('moment');var ami=require(_0x1d10('0x1'));var logger=require(_0x1d10('0x2'))(_0x1d10('0x3'));var RpcUser=require(_0x1d10('0x4'));var RpcVoiceAgentReport=require(_0x1d10('0x5'));function Acw(_0x25b425){this[_0x1d10('0x6')]=_0x25b425[_0x1d10('0x6')];this['agents']=_0x25b425[_0x1d10('0x7')];this[_0x1d10('0x8')]=_0x25b425[_0x1d10('0x8')];this[_0x1d10('0x9')]={};ami['on'](_0x1d10('0xa'),this[_0x1d10('0xb')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0xd'),this[_0x1d10('0xe')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0xf'),this[_0x1d10('0x10')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x11'),this[_0x1d10('0x12')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x13'),this['syncAttendedTransfer'][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x14'),this[_0x1d10('0x15')][_0x1d10('0xc')](this));ami['on'](_0x1d10('0x16'),this['syncAgentConnectPreview'][_0x1d10('0xc')](this));}function getDiff(_0x1f6f83){var _0x1a6586=moment()[_0x1d10('0x17')](0x0);var _0x2224ff=moment(_0x1f6f83)[_0x1d10('0x17')](0x0);return _0x1a6586['diff'](_0x2224ff,_0x1d10('0x18'));}Acw[_0x1d10('0x19')][_0x1d10('0x1a')]=function(_0x2ad3c0,_0x4f014a){var _0x3aedf7=this;var _0x3fe555=getDiff(_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1b')]);clearTimeout(_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1c')]);_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0]['timer']=![];return RpcVoiceAgentReport[_0x1d10('0x1d')]({'acwtime':_0x3fe555},_0x3aedf7[_0x1d10('0x8')][_0x2ad3c0][_0x1d10('0x1e')],_0x2ad3c0)[_0x1d10('0x1f')](function(_0x42e1a8){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x4f014a,_0x3fe555,_0x42e1a8);})[_0x1d10('0x20')](function(_0x57ec1c){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x4f014a,_0x57ec1c);})[_0x1d10('0x21')](function(){delete _0x3aedf7[_0x1d10('0x8')][_0x2ad3c0];});};Acw[_0x1d10('0x19')][_0x1d10('0x22')]=function(_0x4ce84a){try{var _0x5e5315=this;var _0x140147=this['channels'][_0x4ce84a][_0x1d10('0x23')];var _0x474321=this[_0x1d10('0x9')][_0x4ce84a][_0x1d10('0x24')];var _0x127b37=this[_0x1d10('0x6')][_0x474321];var _0x2305c8=![];var _0x3af06d=_0x1d10('0x25');if(_0x127b37[_0x1d10('0x26')]&&_0x127b37[_0x1d10('0x27')]['name']){_0x2305c8=!![];_0x3af06d=_0x127b37[_0x1d10('0x27')][_0x1d10('0x28')];}if(!_0x5e5315[_0x1d10('0x7')][_0x140147]){return Promise[_0x1d10('0x29')]();}return RpcUser[_0x1d10('0x2a')](_0x5e5315[_0x1d10('0x7')][_0x140147]['id'])[_0x1d10('0x1f')](function(_0xaa8ab6){if(!_0xaa8ab6||_0xaa8ab6['voicePause']){logger[_0x1d10('0x2b')](_0x1d10('0x2c'),_0x4ce84a,_0x140147,_0x474321);return;}logger['info'](_0x1d10('0x2d'),_0x4ce84a,_0x140147,_0x474321);var _0x52d514=_0x5e5315['channels'][_0x4ce84a][_0x1d10('0x2e')]&&_0x5e5315['channels'][_0x4ce84a][_0x1d10('0x2f')]?_0x5e5315[_0x1d10('0x9')][_0x4ce84a][_0x1d10('0x2f')]:_0x4ce84a;return RpcUser[_0x1d10('0x30')](_0x5e5315[_0x1d10('0x7')][_0x140147],_0x3af06d,_0x52d514);})[_0x1d10('0x1f')](function(_0x4b5400){if(_0x2305c8||!_0x4b5400){return;}_0x5e5315['timers'][_0x140147]={};logger[_0x1d10('0x2b')](_0x1d10('0x31'),_0x4ce84a,_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')],_0x140147,_0x474321);_0x5e5315[_0x1d10('0x8')][_0x140147][_0x1d10('0x1c')]=setTimeout(_0x5e5315[_0x1d10('0x33')][_0x1d10('0xc')](_0x5e5315,_0x140147),_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')]*0x3e8);_0x5e5315['timers'][_0x140147][_0x1d10('0x1b')]=moment()['format'](_0x1d10('0x34'));_0x5e5315[_0x1d10('0x8')][_0x140147]['uniqueid']=_0x4ce84a;_0x5e5315[_0x1d10('0x8')][_0x140147]['queue']=_0x474321;_0x5e5315[_0x1d10('0x8')][_0x140147][_0x1d10('0x1a')]=_0x5e5315[_0x1d10('0x1a')][_0x1d10('0xc')](_0x5e5315,_0x140147,_0x4ce84a);})[_0x1d10('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4ce84a,_0x5e5315[_0x1d10('0x6')][_0x474321][_0x1d10('0x32')],_0x140147,_0x474321);})[_0x1d10('0x21')](function(){delete _0x5e5315['channels'][_0x4ce84a];});}catch(_0x4a9cde){logger['error'](_0x1d10('0x35'),_0x4a9cde['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x33')]=function(_0x3fad02){try{var _0x296dcf=this;if(_0x296dcf['timers'][_0x3fad02]){_0x296dcf['timers'][_0x3fad02][_0x1d10('0x1c')]=![];var _0x13049a=_0x296dcf[_0x1d10('0x8')][_0x3fad02][_0x1d10('0x1e')];var _0x549e83=_0x296dcf[_0x1d10('0x8')][_0x3fad02]['queue'];var _0x336088=_0x296dcf[_0x1d10('0x6')][_0x549e83][_0x1d10('0x32')];logger[_0x1d10('0x2b')](_0x1d10('0x36'),_0x13049a,_0x3fad02);RpcUser[_0x1d10('0x37')](this[_0x1d10('0x7')][_0x3fad02]);RpcVoiceAgentReport[_0x1d10('0x1d')]({'acwtime':_0x336088,'agentacw':!![]},_0x13049a,_0x3fad02)[_0x1d10('0x1f')](function(_0x2d9acc){logger[_0x1d10('0x2b')](_0x1d10('0x38'),_0x13049a,_0x336088,_0x2d9acc);})[_0x1d10('0x20')](function(_0x5db620){logger['error'](_0x1d10('0x39'),_0x13049a,_0x5db620);});}else{logger[_0x1d10('0x3a')](_0x1d10('0x3b'),_0x3fad02);if(_0x296dcf[_0x1d10('0x8')]){logger[_0x1d10('0x2b')](_0x1d10('0x3c'),JSON[_0x1d10('0x3d')](_0x296dcf['timers']));}}}catch(_0x1a67e9){logger[_0x1d10('0x3a')](_0x1d10('0x3e'),_0x1a67e9['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0xb')]=function(_0x2ee987){try{if(this['voiceQueues'][_0x2ee987['queue']]&&(this[_0x1d10('0x6')][_0x2ee987[_0x1d10('0x24')]][_0x1d10('0x3')]||this[_0x1d10('0x6')][_0x2ee987[_0x1d10('0x24')]][_0x1d10('0x26')])){if(this[_0x1d10('0x7')][_0x2ee987['interface']]){this[_0x1d10('0x9')][_0x2ee987[_0x1d10('0x1e')]]={'queue':_0x2ee987['queue'],'interface':_0x2ee987[_0x1d10('0x23')],'destlinkedid':_0x2ee987['destlinkedid']};}}}catch(_0x3d1563){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x3d1563[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0x40')]=function(_0x46d508){try{if(this[_0x1d10('0x6')][_0x46d508[_0x1d10('0x24')]]&&(this[_0x1d10('0x6')][_0x46d508[_0x1d10('0x24')]][_0x1d10('0x3')]||this['voiceQueues'][_0x46d508['queue']][_0x1d10('0x26')])){if(this[_0x1d10('0x7')][_0x46d508[_0x1d10('0x23')]]){this[_0x1d10('0x9')][_0x46d508[_0x1d10('0x1e')]]={'queue':_0x46d508[_0x1d10('0x24')],'interface':_0x46d508['interface']};}}}catch(_0x2db27f){logger[_0x1d10('0x3a')](_0x1d10('0x41'),_0x2db27f[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0xe')]=function(_0x8226b4){try{if(this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x1e')]]&&_[_0x1d10('0x42')](this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x1e')]][_0x1d10('0x2e')])){logger[_0x1d10('0x2b')]('[%s][HANGUP:UNIQUEID]',_0x8226b4['uniqueid']);this[_0x1d10('0x22')](_0x8226b4['uniqueid']);}else if(this['channels'][_0x8226b4[_0x1d10('0x43')]]&&_[_0x1d10('0x42')](this[_0x1d10('0x9')][_0x8226b4[_0x1d10('0x43')]][_0x1d10('0x2e')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x8226b4['linkedid']);this['startAcw'](_0x8226b4[_0x1d10('0x43')]);}}catch(_0x438477){logger[_0x1d10('0x3a')](_0x1d10('0x44'),_0x438477['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x10')]=function(_0x3ee24d){try{if(this['channels'][_0x3ee24d[_0x1d10('0x1e')]]&&this['channels'][_0x3ee24d[_0x1d10('0x1e')]][_0x1d10('0x2e')]){logger[_0x1d10('0x2b')](_0x1d10('0x45'),_0x3ee24d['uniqueid']);this[_0x1d10('0x22')](_0x3ee24d[_0x1d10('0x1e')]);}else if(this[_0x1d10('0x9')][_0x3ee24d[_0x1d10('0x43')]]&&this[_0x1d10('0x9')][_0x3ee24d[_0x1d10('0x43')]]['attended']){logger[_0x1d10('0x2b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3ee24d[_0x1d10('0x43')]);this['startAcw'](_0x3ee24d[_0x1d10('0x43')]);}}catch(_0x14e19){logger[_0x1d10('0x3a')](_0x1d10('0x46'),_0x14e19['message']);}};Acw[_0x1d10('0x19')][_0x1d10('0x47')]=function(_0x2c9fb0){try{if(!_[_0x1d10('0x48')](this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x49')]])){this[_0x1d10('0x22')](_0x2c9fb0[_0x1d10('0x49')]);if(this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]]){this[_0x1d10('0x9')][_0x2c9fb0['secondtransfereruniqueid']][_0x1d10('0x2e')]=!![];this['channels'][_0x2c9fb0[_0x1d10('0x4b')]]=this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]];delete this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4a')]];}}else if(!_[_0x1d10('0x48')](this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4b')]])){this[_0x1d10('0x22')](_0x2c9fb0[_0x1d10('0x4b')]);if(this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]]){this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]][_0x1d10('0x2e')]=!![];this['channels'][_0x2c9fb0[_0x1d10('0x49')]]=this[_0x1d10('0x9')][_0x2c9fb0[_0x1d10('0x4c')]];delete this['channels'][_0x2c9fb0[_0x1d10('0x4c')]];}}}catch(_0x403c2){logger[_0x1d10('0x3a')](_0x1d10('0x4d'),_0x403c2[_0x1d10('0x3f')]);}};Acw[_0x1d10('0x19')][_0x1d10('0x15')]=function(_0x72b74d){try{if(this[_0x1d10('0x9')][_0x72b74d['transfereruniqueid']]){logger[_0x1d10('0x2b')](_0x1d10('0x4e'),JSON[_0x1d10('0x3d')](_0x72b74d[_0x1d10('0x4f')]));this[_0x1d10('0x22')](_0x72b74d[_0x1d10('0x4f')]);}else if(this[_0x1d10('0x9')][_0x72b74d['transfererlinkedid']]){logger[_0x1d10('0x2b')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1d10('0x3d')](_0x72b74d[_0x1d10('0x50')]));this[_0x1d10('0x22')](_0x72b74d[_0x1d10('0x50')]);}}catch(_0x3035c0){logger[_0x1d10('0x3a')](_0x1d10('0x51'),_0x3035c0['message']);}};Acw['prototype'][_0x1d10('0x12')]=function(_0x5dce9d){try{if(this[_0x1d10('0x6')][_0x5dce9d[_0x1d10('0x24')]]&&this[_0x1d10('0x6')][_0x5dce9d[_0x1d10('0x24')]]['autopause']===_0x1d10('0x52')){if(this['agents'][_0x5dce9d[_0x1d10('0x23')]]){logger[_0x1d10('0x2b')](_0x1d10('0x53'),_0x5dce9d[_0x1d10('0x1e')],_0x5dce9d['interface'],_0x5dce9d['queue']);return RpcUser['savePause'](this['agents'][_0x5dce9d[_0x1d10('0x23')]],_0x1d10('0x54'),_0x5dce9d['uniqueid']);}}}catch(_0x54b8e5){logger['error'](_0x1d10('0x55'),_0x54b8e5['message']);}};module[_0x1d10('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5fb59d9..640e4d1 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 _0x20bb=['format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','../../config/logger','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect'];(function(_0x39998f,_0x4b1a9e){var _0x296d5a=function(_0x374196){while(--_0x374196){_0x39998f['push'](_0x39998f['shift']());}};_0x296d5a(++_0x4b1a9e);}(_0x20bb,0x1b9));var _0xb20b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20bb[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0xb20b('0x0'));var BPromise=require('bluebird');var util=require(_0xb20b('0x1'));var logger=require(_0xb20b('0x2'))('ami');var config=require(_0xb20b('0x3'));var ami=new Manager(config[_0xb20b('0x4')][_0xb20b('0x5')],config[_0xb20b('0x4')]['ip'],config[_0xb20b('0x4')]['username'],config[_0xb20b('0x4')][_0xb20b('0x6')],!![]);ami[_0xb20b('0x7')]();ami[_0xb20b('0x8')]=BPromise[_0xb20b('0x9')](ami[_0xb20b('0xa')]);function error(_0x343243){logger[_0xb20b('0xb')](util['format'](_0xb20b('0xc'),config[_0xb20b('0x4')][_0xb20b('0xd')],config[_0xb20b('0x4')]['ip'],config[_0xb20b('0x4')][_0xb20b('0x5')],util[_0xb20b('0xe')](_0x343243,![],null)));}function close(){logger[_0xb20b('0xb')](util[_0xb20b('0xf')](_0xb20b('0x10'),config['asterisk'][_0xb20b('0xd')],config[_0xb20b('0x4')]['ip'],config[_0xb20b('0x4')][_0xb20b('0x5')]));}ami[_0xb20b('0x11')]=function(){return function(){return ami['Action']({'action':_0xb20b('0x12')});};};ami[_0xb20b('0x13')]=function(){return function(){return ami[_0xb20b('0x8')]({'action':_0xb20b('0x14')});};};ami[_0xb20b('0x15')]=function(){return function(){return ami[_0xb20b('0x8')]({'action':_0xb20b('0x16')});};};ami[_0xb20b('0x17')]=function(){return function(){return ami[_0xb20b('0x8')]({'action':_0xb20b('0x18')});};};ami[_0xb20b('0x19')]=function(){return function(){return ami[_0xb20b('0x8')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0xb20b('0xf')](_0xb20b('0x1a'),config[_0xb20b('0x4')]['username'],config['asterisk']['ip'],config[_0xb20b('0x4')][_0xb20b('0x5')]));ami[_0xb20b('0x1b')](_0xb20b('0xb'),error);ami[_0xb20b('0x1b')]('close',close);}ami['on'](_0xb20b('0x1c'),connect);ami['on'](_0xb20b('0x1d'),function(_0x54430b){logger['info'](util[_0xb20b('0xf')](_0xb20b('0x1e'),config[_0xb20b('0x4')][_0xb20b('0xd')],config[_0xb20b('0x4')]['ip'],config[_0xb20b('0x4')][_0xb20b('0x5')],util[_0xb20b('0xe')](_0x54430b,![],null)));});ami['on'](_0xb20b('0x1f'),function(){logger[_0xb20b('0x20')](util[_0xb20b('0xf')](_0xb20b('0x21'),config[_0xb20b('0x4')][_0xb20b('0xd')],config['asterisk']['ip'],config[_0xb20b('0x4')][_0xb20b('0x5')]));return Promise['resolve']()[_0xb20b('0x22')](ami[_0xb20b('0x11')]())['then'](ami[_0xb20b('0x13')]())[_0xb20b('0x22')](ami[_0xb20b('0x15')]())['then'](ami[_0xb20b('0x17')]())[_0xb20b('0x22')](ami['actionCoreShowChannels']())[_0xb20b('0x23')](function(_0x220af8){logger[_0xb20b('0xb')](_0xb20b('0x24'),util[_0xb20b('0xe')](_0x220af8,{'showHidden':![],'depth':null}));});});ami['once'](_0xb20b('0xb'),error);ami[_0xb20b('0x1b')]('close',close);module[_0xb20b('0x25')]=ami; \ No newline at end of file +var _0xb099=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb099,0xda));var _0x9b09=function(_0x37018d,_0x95e1f8){_0x37018d=_0x37018d-0x0;var _0x1c72b8=_0xb099[_0x37018d];return _0x1c72b8;};'use strict';var Manager=require(_0x9b09('0x0'));var BPromise=require(_0x9b09('0x1'));var util=require(_0x9b09('0x2'));var logger=require(_0x9b09('0x3'))(_0x9b09('0x4'));var config=require(_0x9b09('0x5'));var ami=new Manager(config[_0x9b09('0x6')][_0x9b09('0x7')],config['asterisk']['ip'],config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')][_0x9b09('0x9')],!![]);ami[_0x9b09('0xa')]();ami[_0x9b09('0xb')]=BPromise[_0x9b09('0xc')](ami[_0x9b09('0xd')]);function error(_0x5c9e2e){logger['error'](util[_0x9b09('0xe')](_0x9b09('0xf'),config['asterisk'][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config['asterisk'][_0x9b09('0x7')],util[_0x9b09('0x10')](_0x5c9e2e,![],null)));}function close(){logger[_0x9b09('0x11')](util[_0x9b09('0xe')](_0x9b09('0x12'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')]));}ami[_0x9b09('0x13')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x14')});};};ami[_0x9b09('0x15')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':'devicestatelist'});};};ami[_0x9b09('0x16')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x17')});};};ami[_0x9b09('0x18')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x19')});};};ami[_0x9b09('0x1a')]=function(){return function(){return ami[_0x9b09('0xb')]({'action':_0x9b09('0x1b')});};};function connect(){logger[_0x9b09('0x1c')](util[_0x9b09('0xe')](_0x9b09('0x1d'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')]['port']));ami[_0x9b09('0x1e')]('error',error);ami['once'](_0x9b09('0x1f'),close);}ami['on'](_0x9b09('0x20'),connect);ami['on'](_0x9b09('0x21'),function(_0x2b1065){logger[_0x9b09('0x1c')](util[_0x9b09('0xe')](_0x9b09('0x22'),config[_0x9b09('0x6')][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')],util['inspect'](_0x2b1065,![],null)));});ami['on'](_0x9b09('0x23'),function(){logger['info'](util[_0x9b09('0xe')](_0x9b09('0x24'),config['asterisk'][_0x9b09('0x8')],config[_0x9b09('0x6')]['ip'],config[_0x9b09('0x6')][_0x9b09('0x7')]));return Promise[_0x9b09('0x25')]()['then'](ami[_0x9b09('0x13')]())[_0x9b09('0x26')](ami[_0x9b09('0x15')]())[_0x9b09('0x26')](ami[_0x9b09('0x16')]())[_0x9b09('0x26')](ami[_0x9b09('0x18')]())[_0x9b09('0x26')](ami[_0x9b09('0x1a')]())[_0x9b09('0x27')](function(_0x2f3858){logger[_0x9b09('0x11')](_0x9b09('0x28'),util[_0x9b09('0x10')](_0x2f3858,{'showHidden':![],'depth':null}));});});ami[_0x9b09('0x1e')]('error',error);ami[_0x9b09('0x1e')](_0x9b09('0x1f'),close);module[_0x9b09('0x29')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index fd33169..c592806 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xb7e7[_0x487b0c];return _0x1adbdc;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 308a3d3..b39f391 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 _0x9907=['uniqueid','ivr','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','merge','idHopper','[unlock][syncQueueStatusComplete]','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','custom:amd','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','createStateFinal','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','running','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','busyFactor','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','getContactDialer','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','queuesSummary','bind','syncQueueCallerAbandon','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','inspect','checkContactLowerLimitOriginate','temp','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','syncAgentConnect'];(function(_0xcb6f77,_0x344429){var _0x32fbdb=function(_0x26f5fa){while(--_0x26f5fa){_0xcb6f77['push'](_0xcb6f77['shift']());}};_0x32fbdb(++_0x344429);}(_0x9907,0x16e));var _0x7990=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x9907[_0x1627ae];return _0x34b38f;};'use strict';var util=require(_0x7990('0x0'));var _=require(_0x7990('0x1'));var uuid=require(_0x7990('0x2'));var moment=require(_0x7990('0x3'));var rr=require('rr');var Redis=require(_0x7990('0x4'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0x7990('0x5'));var config=require(_0x7990('0x6'));var logger=require(_0x7990('0x7'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x7990('0x7'))(_0x7990('0x8'));var loggerPredictiveCalls=require(_0x7990('0x7'))(_0x7990('0x9'));var loggerSyncQueueSummary=require(_0x7990('0x7'))(_0x7990('0xa'));var ami=require('../ami');config[_0x7990('0xb')]=_['defaults'](config['redis'],{'host':_0x7990('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x7990('0xd'));var voiceQueueRt=require(_0x7990('0xe'));var RpcSetting=require(_0x7990('0xf'));var Interval=require(_0x7990('0x10'));var Action=require(_0x7990('0x11'));var History=require(_0x7990('0x12'));var Final=require(_0x7990('0x13'));var AgentComplete=require(_0x7990('0x14'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x7990('0x15'));var ipAgi=process[_0x7990('0x16')][_0x7990('0x17')]||_0x7990('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x7990('0x19')]=function(_0x18be59){this[_0x7990('0x1a')]=this[_0x7990('0x1a')]?this[_0x7990('0x1a')][_0x7990('0x1b')](_0x18be59):_0x18be59();};function Dialer(_0x2f90ac,_0x7f2f23){this[_0x7990('0x1c')]=new Sequence();this[_0x7990('0x1d')]=_0x7f2f23;this[_0x7990('0x1e')]=_0x2f90ac['voiceQueues'];this[_0x7990('0x1f')]=_0x2f90ac['campaigns'];this[_0x7990('0x20')]=_0x2f90ac[_0x7990('0x20')];this['trunks']=_0x2f90ac[_0x7990('0x21')];this[_0x7990('0x22')]=config['maxNumberOriginate']||0x2;this[_0x7990('0x23')]={};this['actions']={};this[_0x7990('0x24')]={};this[_0x7990('0x25')]={};this[_0x7990('0x26')]={};this[_0x7990('0x27')]={};this[_0x7990('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x7990('0x29')]={};this[_0x7990('0x2a')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x7990('0x2b')](this));ami['on']('queuecallerabandon',this[_0x7990('0x2c')][_0x7990('0x2b')](this));ami['on']('originateresponse',this[_0x7990('0x2d')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x7990('0x2b')](this));ami['on'](_0x7990('0x2e'),this[_0x7990('0xa')][_0x7990('0x2b')](this));ami['on'](_0x7990('0x2f'),this[_0x7990('0x30')]['bind'](this));ami['on'](_0x7990('0x31'),this[_0x7990('0x32')][_0x7990('0x2b')](this));ami['on'](_0x7990('0x33'),this[_0x7990('0x34')][_0x7990('0x2b')](this));ami['on']('varset',this['syncVarSet'][_0x7990('0x2b')](this));ami['on']('queuemember',this['syncQueueMember'][_0x7990('0x2b')](this));ami['on'](_0x7990('0x35'),this[_0x7990('0x36')]['bind'](this));this[_0x7990('0x37')]();this[_0x7990('0x38')]();RpcSetting[_0x7990('0x39')]()[_0x7990('0x3a')](function(_0x283c13){previewRecallmeReminderInterval=_0x283c13[_0x7990('0x3b')];});}function isNotNull(_0x554b5e){return _0x554b5e!==null&&!_[_0x7990('0x3c')](_0x554b5e);}function msgResponse(_0x2324ae,_0x37dc5b,_0x31bd8c){return{'action':_0x2324ae,'response':_0x37dc5b,'message':_0x31bd8c,'stack':_0x31bd8c};}function emit(_0x529f69,_0xcb85c0,_0x362480){io['to'](_0x529f69)[_0x7990('0x3d')](_0xcb85c0,_0x362480);}function emitOutboundVoiceQueueSummary(_0x1e7e55){if(_0x1e7e55[_0x7990('0x3e')]===_0x7990('0x3f')){logger[_0x7990('0x40')](_0x7990('0x41'),util['inspect'](_0x1e7e55,{'showHidden':![],'depth':null}));emit(util[_0x7990('0x42')](_0x7990('0x43'),_0x1e7e55[_0x7990('0x44')]),_0x7990('0x45'),_0x1e7e55);}}function checkGetDataPredictive(_0x1bd23e){if(isNotNull(_0x1bd23e)&&!_[_0x7990('0x46')](_0x1bd23e)){loggerPredictive['info'](_0x7990('0x47'));loggerPredictive[_0x7990('0x48')](_0x7990('0x49'),_0x1bd23e[_0x7990('0x4a')]);loggerPredictive[_0x7990('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bd23e[_0x7990('0x4b')]);loggerPredictive[_0x7990('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bd23e[_0x7990('0x4c')]);loggerPredictive[_0x7990('0x48')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bd23e[_0x7990('0x4d')]);loggerPredictive[_0x7990('0x48')](_0x7990('0x4e'),_0x1bd23e[_0x7990('0x4f')]);loggerPredictive[_0x7990('0x48')](_0x7990('0x50'),_0x1bd23e[_0x7990('0x51')]);loggerPredictive[_0x7990('0x48')](_0x7990('0x52'));if(_0x1bd23e[_0x7990('0x4a')]>0x0){if(!_['isUndefined'](_0x1bd23e['predictiveIntervalAvgTalktime'])&&_0x1bd23e[_0x7990('0x51')]>0x0){return!![];}loggerPredictive[_0x7990('0x48')](_0x7990('0x53'));if(!_[_0x7990('0x3c')](_0x1bd23e[_0x7990('0x4f')])&&_0x1bd23e[_0x7990('0x4f')]>0x0){return!![];}loggerPredictive[_0x7990('0x48')](_0x7990('0x54'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x7990('0x55'));}return![];}function mergeDataErlangB(_0x22291e){return function(_0x58bc99){loggerPredictive[_0x7990('0x48')](_0x7990('0x56'));loggerPredictive[_0x7990('0x48')](_0x7990('0x57'),_0x58bc99[_0x7990('0x58')]);loggerPredictive[_0x7990('0x48')](_0x7990('0x59'),_0x58bc99[_0x7990('0x5a')]);loggerPredictive[_0x7990('0x48')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58bc99['erlangAbandonmentRate']);loggerPredictive['info'](_0x7990('0x5b'),_0x58bc99[_0x7990('0x5c')]);loggerPredictive[_0x7990('0x48')](_0x7990('0x5d'),_0x58bc99['erlangAbandonmentRate']);loggerPredictive['info'](_0x7990('0x52'));_['merge'](_0x22291e,_0x58bc99);};}function ifInterval(_0x525410,_0x3182ed){if(_[_0x7990('0x3c')](_0x3182ed)){return![];}return utils[_0x7990('0x5e')](undefined,_0x3182ed)<_0x525410*0x3c;}function clearPredictiveAttributes(_0x3d3e3a){if(_0x3d3e3a['startProgressive']){_0x3d3e3a[_0x7990('0x28')]=undefined;loggerPredictive[_0x7990('0x40')](_0x3d3e3a[_0x7990('0x44')],_0x7990('0x5f'));}if(_0x3d3e3a[_0x7990('0x27')]){_0x3d3e3a[_0x7990('0x27')]=undefined;loggerPredictive[_0x7990('0x40')](_0x3d3e3a['name'],_0x7990('0x60'));}if(_0x3d3e3a[_0x7990('0x61')]){clearInterval(_0x3d3e3a['handlePredictive']);_0x3d3e3a[_0x7990('0x61')]=undefined;loggerPredictive['debug'](_0x3d3e3a[_0x7990('0x44')],_0x7990('0x62'));}}function loggerCatchPredictive(_0x53f8b4,_0x2ce889){return function(_0x15b2c4){loggerPredictive[_0x7990('0x63')](_0x2ce889[_0x7990('0x44')],_0x53f8b4);loggerPredictive[_0x7990('0x63')](_0x15b2c4['stack']);clearPredictiveAttributes(_0x2ce889);};}function loggerCatch(_0x13cd00){return function(_0x571b78){logger[_0x7990('0x63')](_0x13cd00,util[_0x7990('0x64')](_0x571b78,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x205b28,_0x293cf4,_0x46dcd1){return function(_0x30c61b){utils[_0x7990('0x65')](_0x293cf4,_0x46dcd1,0x0);_0x293cf4[_0x7990('0x66')]=0x0;logger['error'](_0x205b28,util[_0x7990('0x64')](_0x30c61b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x447294){return function(_0x4ffefb){if(isNotNull(_0x4ffefb)&&isNotNull(_0x4ffefb[0x0])){if(_0x4ffefb[0x0]['contactsRescheduled']>0x0){_0x447294[_0x7990('0x67')]=utils['CAMPAIGN_STATUS'][_0x7990('0x68')];logger[_0x7990('0x48')](_0x7990('0x69')+_0x447294[_0x7990('0x44')],_0x4ffefb[0x0][_0x7990('0x6a')],_0x7990('0x6b'));}else{_0x447294[_0x7990('0x67')]=utils[_0x7990('0x6c')][_0x7990('0x6d')];logger[_0x7990('0x48')](_0x7990('0x6e')+_0x447294['name']);}}};}function createObjHistory(_0x56e6ca,_0x1babb7,_0x45ad1a,_0x53993f,_0x27bab2){_0x56e6ca[_0x7990('0x67')]=_0x45ad1a;var _0x1b54ba=new Action(_0x56e6ca,_0x1babb7);var _0x4085d1=new History(_0x1b54ba);_0x4085d1[_0x7990('0x6f')]=_0x53993f;_0x4085d1[_0x7990('0x70')]=_0x27bab2;_0x4085d1[_0x7990('0x71')]=_0x1b54ba[_0x7990('0x72')];return _0x4085d1;}function unlockQueueStatus(_0x5866c8,_0x188c07){setTimeout(function(){if(_['isUndefined'](_0x5866c8[_0x7990('0x73')])){loggerBooked[_0x7990('0x63')](_0x7990('0x74'),_0x188c07);}_0x5866c8[_0x7990('0x73')]=!![];loggerBooked[_0x7990('0x48')](_0x7990('0x75'),_0x188c07,JSON[_0x7990('0x76')](_[_0x7990('0x77')](_0x5866c8,[_0x7990('0x44'),_0x7990('0x73')])));},0x1f3);}function checkInterval(_0x2396f8){return function(){if(!isNotNull(_0x2396f8[_0x7990('0x78')])){_0x2396f8[_0x7990('0x67')]=utils[_0x7990('0x6c')][_0x7990('0x79')];throw _0x2396f8[_0x7990('0x44')]+_0x7990('0x7a');}if(!isNotNull(_0x2396f8[_0x7990('0x78')]['Intervals'])){_0x2396f8['message']=utils[_0x7990('0x6c')][_0x7990('0x79')];throw _0x2396f8['name']+_0x7990('0x7a');}if(!isNotNull(_[_0x7990('0x46')](_0x2396f8[_0x7990('0x78')][_0x7990('0x7b')]))){_0x2396f8[_0x7990('0x67')]=utils[_0x7990('0x6c')][_0x7990('0x79')];throw _0x2396f8['name']+_0x7990('0x7a');}};}function checkIsIVRCampaignActive(_0xa5bda1){return function(){if(!utils['isIVRCampaignActive'](_0xa5bda1)){_0xa5bda1[_0x7990('0x67')]=utils['CAMPAIGN_STATUS'][_0x7990('0x7c')];throw _0xa5bda1[_0x7990('0x44')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x5a03c1){if(utils[_0x7990('0x7d')](_0x5a03c1)){emit(util[_0x7990('0x42')](_0x7990('0x7e'),_0x5a03c1['name']),'campaign:save',_0x5a03c1);}}function loggerCatchQueueSummary(_0xcd4570,_0x1fd511){return function(_0x46c82d){clearPredictiveAttributes(_0x1fd511);emitCampaignSummary(_0x1fd511);loggerSyncQueueSummary[_0x7990('0x40')](_0xcd4570,util['inspect'](_0x46c82d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x462de3){if(_0x462de3[_0x7990('0x7f')]){if(_0x462de3['originated']===0x0){_0x462de3[_0x7990('0x7f')]=![];_0x462de3[_0x7990('0x67')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary['debug'](_0x7990('0x80'),_0x462de3[_0x7990('0x44')],_0x7990('0x81'));}else{_0x462de3['message']=utils['CAMPAIGN_STATUS'][_0x7990('0x82')];loggerSyncQueueSummary[_0x7990('0x40')](_0x7990('0x80'),_0x462de3[_0x7990('0x44')],'is\x20disactive');}emitCampaignSummary(_0x462de3);}}function myreject(_0x362785){return function(_0x44a935){return _0x362785(msgResponse('[ifTime][Action]',_0x7990('0x83'),JSON['stringify'](_0x44a935)));};}Dialer[_0x7990('0x84')][_0x7990('0x85')]=function(_0x4a559b){return!_[_0x7990('0x3c')](_0x4a559b)&&_0x4a559b&&!_[_0x7990('0x3c')](_0x4a559b[_0x7990('0x44')])&&!_[_0x7990('0x3c')](_0x4a559b['active'])&&_0x4a559b[_0x7990('0x86')]&&(this['trunks'][util[_0x7990('0x42')](_0x7990('0x87'),_0x4a559b[_0x7990('0x44')])][_0x7990('0x88')]===_0x7990('0x89')||this[_0x7990('0x21')][util[_0x7990('0x42')](_0x7990('0x87'),_0x4a559b[_0x7990('0x44')])]['status']===_0x7990('0x8a'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x293c0b){var _0x42c457=this;return function(){if(!_0x42c457[_0x7990('0x85')](_0x293c0b['Trunk'])){if(!_0x42c457[_0x7990('0x85')](_0x293c0b[_0x7990('0x8b')])){_0x293c0b[_0x7990('0x67')]=utils['CAMPAIGN_STATUS'][_0x7990('0x8c')];throw _0x293c0b[_0x7990('0x44')]+_0x7990('0x8d');}}};};Dialer[_0x7990('0x84')][_0x7990('0x8e')]=function(_0x1ca910,_0x13690a,_0xe866f2,_0x23ba61){var _0x3d7c26=this;return function(){var _0x49478c=!![];return _0x3d7c26[_0x7990('0x8f')](_0x1ca910,_0x13690a,_0xe866f2,_0x23ba61,_0x49478c);};};Dialer[_0x7990('0x84')][_0x7990('0x90')]=function(_0x361c09,_0x21508e,_0x370bbd,_0x3a45ee){var _0x3eb9a5=this;return function(){var _0x2c9530=![];return _0x3eb9a5[_0x7990('0x8f')](_0x361c09[_0x7990('0x7b')],_0x21508e,_0x370bbd,_0x3a45ee,_0x2c9530);};};Dialer[_0x7990('0x84')]['ifTimeIvr']=function(_0x180534,_0x4a25a0,_0x2750d7,_0x5b050f,_0x437579){var _0x411423=[];return new Promise(function(_0x2c8430,_0x6bfe09){if(!isNotNull(_0x180534)){_0x5b050f['message']=utils['CAMPAIGN_STATUS'][_0x7990('0x79')];return _0x6bfe09(msgResponse(_0x7990('0x91'),_0x7990('0x92'),_0x2750d7+_0x7990('0x93')));}if(_[_0x7990('0x46')](_0x180534)){_0x5b050f[_0x7990('0x67')]=utils[_0x7990('0x6c')][_0x7990('0x94')];return _0x6bfe09(msgResponse(_0x7990('0x91'),_0x7990('0x92'),_0x2750d7+_0x7990('0x95')));}if(_0x4a25a0&&_[_0x7990('0x3c')](config['timezones'][_0x4a25a0])){_0x5b050f[_0x7990('0x67')]=utils[_0x7990('0x6c')]['UNKNOWN_TIMEZONE'];return _0x6bfe09(msgResponse('ifTime',_0x7990('0x92'),_0x2750d7+_0x7990('0x96')+_0x4a25a0));}if(_[_0x7990('0x97')](_0x180534)){for(var _0x51fffe=0x0;_0x51fffe<_0x180534[_0x7990('0x98')];_0x51fffe+=0x1){_0x411423[_0x7990('0x99')](ami[_0x7990('0x9a')]({'action':_0x7990('0x9b'),'command':util[_0x7990('0x42')](_0x7990('0x9c'),_0x180534[_0x51fffe][_0x7990('0x9d')],!_['isUndefined'](config[_0x7990('0x9e')][_0x4a25a0])?_0x4a25a0:'')})[_0x7990('0x3a')](function(_0x846862){return _0x846862[_0x7990('0x9f')]['indexOf'](_0x7990('0xa0'))>=0x0;})[_0x7990('0xa1')](myreject(_0x6bfe09)));}}else{_0x411423[_0x7990('0x99')](ami[_0x7990('0x9a')]({'action':_0x7990('0x9b'),'command':util[_0x7990('0x42')](_0x7990('0x9c'),_0x180534,!_[_0x7990('0x3c')](config['timezones'][_0x4a25a0])?_0x4a25a0:'')})[_0x7990('0x3a')](function(_0x5ca021){return _0x5ca021[_0x7990('0x9f')]['indexOf']('true')>=0x0;})[_0x7990('0xa1')](myreject(_0x6bfe09)));}Promise[_0x7990('0xa2')](_0x411423)[_0x7990('0x3a')](function(_0x352f5e){var _0x4f9d06=_[_0x7990('0xa3')](_0x352f5e);if(_0x4f9d06){return _0x2c8430(_0x4f9d06);}else{_0x5b050f[_0x7990('0x67')]=_0x437579?utils['CAMPAIGN_STATUS'][_0x7990('0xa4')]:utils[_0x7990('0x6c')]['OVERTIME_INTERVAL'];return _0x6bfe09(msgResponse(_0x7990('0xa5'),_0x7990('0x92'),'Global:\x20'+_0x437579+'\x20'+_0x2750d7+_0x7990('0xa6')+util[_0x7990('0x64')](_0x180534,{'showHidden':![],'depth':null})+_0x7990('0xa7')+_0x4a25a0));}})[_0x7990('0xa1')](function(_0x457fb2){return _0x6bfe09(msgResponse(_0x7990('0x91'),'Failure',JSON[_0x7990('0x76')](_0x457fb2)));});});};Dialer[_0x7990('0x84')][_0x7990('0x37')]=function(){var _0x4e7832=this;return cmHopper[_0x7990('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x7990('0x3a')](function(){setInterval(function(){_0x4e7832[_0x7990('0xa9')]();},0x3e8);});};Dialer[_0x7990('0x84')][_0x7990('0xa9')]=function(){var _0x506a9e=this;var _0x97f4e4;for(var _0x3b748d in this[_0x7990('0x1f')]){if(typeof this[_0x7990('0x1f')][_0x3b748d]!==_0x7990('0xaa')){_0x97f4e4=this['campaigns'][_0x3b748d];if(utils['isIVRCampaign'](_0x97f4e4)&&utils['isIVRCampaignActive'](_0x97f4e4)){_0x97f4e4[_0x7990('0x7f')]=!![];Promise['resolve']()[_0x7990('0x3a')](checkIsIVRCampaignActive(_0x97f4e4))[_0x7990('0x3a')](checkInterval(_0x97f4e4))[_0x7990('0x3a')](_0x506a9e[_0x7990('0xab')](_0x97f4e4))['then'](_0x506a9e[_0x7990('0x8e')](_0x97f4e4[_0x7990('0xac')],_0x97f4e4[_0x7990('0xad')],_0x97f4e4[_0x7990('0x44')],_0x97f4e4))[_0x7990('0x3a')](_0x506a9e[_0x7990('0x90')](_0x97f4e4[_0x7990('0x78')],_0x97f4e4[_0x7990('0xad')],_0x97f4e4['name'],_0x97f4e4))['then'](_0x506a9e[_0x7990('0xae')](_0x97f4e4))[_0x7990('0xa1')](loggerCatchQueueSummary(_0x7990('0xaf'),_0x97f4e4));}else{notSendMessagesCampaign(_0x97f4e4);}}}};Dialer[_0x7990('0x84')][_0x7990('0xb0')]=function(_0x497c28){if(_0x497c28[_0x7990('0xb1')]!=='predictive'){clearPredictiveAttributes(_0x497c28);}switch(_0x497c28[_0x7990('0xb1')]){case'progressive':this[_0x7990('0xb2')](_0x497c28,0x1);break;case _0x7990('0xb3'):this[_0x7990('0xb2')](_0x497c28,_0x497c28[_0x7990('0xb4')]);break;case _0x7990('0x8'):this[_0x7990('0x8')](_0x497c28);break;case _0x7990('0xb5'):this[_0x7990('0xb2')](_0x497c28,0x1);break;default:logger[_0x7990('0x63')](_0x7990('0xb6'),_0x497c28[_0x7990('0x44')],_0x7990('0xb7'));}};Dialer[_0x7990('0x84')][_0x7990('0x91')]=function(_0x571361,_0x26690c){var _0x17728f=_0x571361[_0x7990('0xad')];var _0x5e5794=_0x26690c?_0x571361[_0x7990('0xac')]:_0x571361[_0x7990('0x78')][_0x7990('0x7b')];logger['silly'](_0x7990('0xb8'),_0x5e5794,_0x17728f,_0x571361[_0x7990('0x44')],util[_0x7990('0x42')]('Voice\x20Queue\x20%s\x20$s',_0x571361[_0x7990('0x44')],_0x571361['id']));var _0x2ec5a5=null;return Interval[_0x7990('0xb9')](_0x5e5794,_0x17728f)['then'](function(_0x41b3dc){if(_0x41b3dc===!![]){return _0x41b3dc;}else{_0x571361[_0x7990('0x67')]=_0x26690c?utils['CAMPAIGN_STATUS'][_0x7990('0xa4')]:utils[_0x7990('0x6c')][_0x7990('0xba')];_0x2ec5a5=msgResponse(_0x7990('0xa5'),_0x7990('0x92'),_0x7990('0xbb')+_0x26690c+'\x20'+_0x571361['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7990('0x64')](_0x5e5794,{'showHidden':![],'depth':null})+_0x7990('0xa7')+_0x17728f);}if(_0x2ec5a5!==null){logger[_0x7990('0xbc')](_0x7990('0xbd'),_0x2ec5a5);_0x2ec5a5[_0x7990('0xbe')]=_0x26690c;throw _0x2ec5a5;}})[_0x7990('0xa1')](function(_0x26476b){logger[_0x7990('0x63')](_0x7990('0xbf'),_0x26476b);throw msgResponse(_0x7990('0xc0'),_0x7990('0x83'),util[_0x7990('0x64')](_0x26476b,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x7990('0xc1')]=function(_0x19d9e6){if(this['voiceQueues'][_0x19d9e6['queue']]){if(this[_0x7990('0x25')][_0x19d9e6[_0x7990('0xc2')]]&&this[_0x7990('0x25')][_0x19d9e6[_0x7990('0xc2')]][_0x7990('0x3e')]!==_0x7990('0xc3')){this['updateOriginated'](this[_0x7990('0x1e')][_0x19d9e6[_0x7990('0xc4')]]);this[_0x7990('0x25')][_0x19d9e6[_0x7990('0xc2')]][_0x7990('0xc5')]=moment()[_0x7990('0x42')](_0x7990('0xc6'));}}};Dialer[_0x7990('0x84')][_0x7990('0xc7')]=function(_0x3867ce){var _0x19989a=this[_0x7990('0x25')][_0x3867ce[_0x7990('0xc2')]];if(this[_0x7990('0x1e')][_0x3867ce[_0x7990('0xc4')]]){if(_0x19989a&&_0x19989a[_0x7990('0x3e')]!==_0x7990('0xc3')){delete this[_0x7990('0x25')][_0x3867ce['uniqueid']];this['voiceQueues'][_0x3867ce[_0x7990('0xc4')]][_0x7990('0xc8')]+=0x1;var _0x356c64=new AgentComplete(_0x19989a,_0x3867ce);if(_0x3867ce[_0x7990('0xc9')]==='agent'){_0x356c64[_0x7990('0xca')]=this['voiceQueues'][_0x3867ce[_0x7990('0xc4')]][_0x7990('0xcb')]&&this[_0x7990('0x1e')][_0x3867ce[_0x7990('0xc4')]][_0x7990('0xcc')]?moment()[_0x7990('0x42')](_0x7990('0xc6')):undefined;}hopperUtils[_0x7990('0xcd')](_0x356c64)[_0x7990('0xa1')](loggerCatch(_0x7990('0xce')));hopperUtils[_0x7990('0xcf')](_0x356c64)[_0x7990('0xa1')](loggerCatch(_0x7990('0xd0')));}}};Dialer[_0x7990('0x84')][_0x7990('0x2c')]=function(_0x3c726b){var _0x50c5ee=this['uniqueId'][_0x3c726b['uniqueid']];var _0x52e19b=this;var _0x122107=![];var _0x82aa80;var _0x37d41b;if(this[_0x7990('0x1e')][_0x3c726b['queue']]){if(_0x50c5ee&&_0x50c5ee[_0x7990('0x3e')]!==_0x7990('0xc3')){delete this[_0x7990('0x25')][_0x3c726b[_0x7990('0xc2')]];this[_0x7990('0xd1')](this[_0x7990('0x1e')][_0x3c726b['queue']]);_0x50c5ee[_0x7990('0xd2')]=moment()['format'](_0x7990('0xc6'));var _0x21d7a8=new QueueCallerAbandon(_0x50c5ee,_0x3c726b);if(utils['getSeconds'](_0x50c5ee[_0x7990('0xd2')],_0x50c5ee[_0x7990('0xd3')])>=_0x50c5ee['dialQueueTimeout']){this[_0x7990('0x1e')][_0x3c726b['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x3c726b['queue']][_0x7990('0xd4')]+=0x1;this[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xd5')]+=0x1;_0x21d7a8[_0x7990('0x6f')]=0xa;_0x21d7a8['statedesc']=_0x7990('0xd6');_0x21d7a8[_0x7990('0xd7')]=_0x7990('0xd8');_0x21d7a8['agiafterat']=this[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xcb')]?moment()[_0x7990('0x42')](_0x7990('0xc6')):undefined;_0x21d7a8[_0x7990('0xd9')]+=0x1;_0x21d7a8[_0x7990('0xda')]+=0x1;_0x82aa80=this[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xdb')];_0x37d41b=this['voiceQueues'][_0x3c726b['queue']][_0x7990('0xdc')];hopperUtils[_0x7990('0xdd')](_0x21d7a8,_0x21d7a8[_0x7990('0x6f')],_0x50c5ee[_0x7990('0xde')])[_0x7990('0x3a')](function(_0x2e4656){_0x122107=_0x2e4656[_0x7990('0xdf')]==0x1;if(_0x21d7a8['countdropretry']>=_0x52e19b[_0x7990('0x1e')][_0x3c726b['queue']][_0x7990('0xe0')]){_0x52e19b[_0x7990('0xe1')](_0x21d7a8,_0x2e4656['additional']);}else{hopperUtils[_0x7990('0xe2')]({'active':![],'countdropretry':_0x21d7a8['countdropretry'],'scheduledat':moment()[_0x7990('0xe3')](_0x52e19b['voiceQueues'][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xdb')],'minutes')[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x50c5ee[_0x7990('0xe4')],'ListId':_0x50c5ee[_0x7990('0xe5')],'VoiceQueueId':_0x50c5ee[_0x7990('0xe6')]||undefined,'CampaignId':_0x50c5ee[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x5e0a44=new History(_0x21d7a8);_0x5e0a44[_0x7990('0x6f')]=0xa;_0x5e0a44['statedesc']=_0x7990('0xd6');_0x5e0a44['starttime']=moment()[_0x7990('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e0a44[_0x7990('0x71')]=_0x5e0a44[_0x7990('0x72')];_0x5e0a44[_0x7990('0xe8')]=_0x21d7a8['calleridname'];_0x5e0a44[_0x7990('0xe9')]=_0x21d7a8[_0x7990('0xe9')];hopperUtils[_0x7990('0xcd')](_0x5e0a44)['catch'](loggerCatch(_0x7990('0xea')));}})[_0x7990('0x3a')](function(){if(_0x122107)hopperUtils[_0x7990('0xeb')](_0x21d7a8,_0x82aa80,_0x37d41b)[_0x7990('0x3a')](function(){return 0x1;});});}else{this[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]][_0x7990('0x4d')]+=0x1;this['voiceQueues'][_0x3c726b['queue']][_0x7990('0xec')]+=0x1;_0x21d7a8[_0x7990('0x6f')]=0xb;_0x21d7a8[_0x7990('0x70')]=_0x7990('0xed');_0x21d7a8[_0x7990('0xd7')]=_0x7990('0xee');_0x21d7a8[_0x7990('0xef')]+=0x1;_0x21d7a8[_0x7990('0xda')]+=0x1;_0x82aa80=this['voiceQueues'][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xf0')];_0x37d41b=this[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xdc')];hopperUtils[_0x7990('0xdd')](_0x21d7a8,_0x21d7a8[_0x7990('0x6f')],_0x50c5ee[_0x7990('0xde')])[_0x7990('0x3a')](function(_0x5ba9f3){if(_0x21d7a8[_0x7990('0xef')]>=_0x52e19b[_0x7990('0x1e')][_0x3c726b[_0x7990('0xc4')]]['dialAbandonedMaxRetry']){_0x52e19b[_0x7990('0xe1')](_0x21d7a8,_0x5ba9f3[_0x7990('0xdf')]);}else{hopperUtils[_0x7990('0xe2')]({'active':![],'countabandonedretry':_0x21d7a8['countabandonedretry'],'scheduledat':moment()[_0x7990('0xe3')](_0x52e19b['voiceQueues'][_0x3c726b[_0x7990('0xc4')]][_0x7990('0xf0')],_0x7990('0xf1'))['format'](_0x7990('0xc6')),'ContactId':_0x50c5ee[_0x7990('0xe4')],'ListId':_0x50c5ee[_0x7990('0xe5')],'VoiceQueueId':_0x50c5ee[_0x7990('0xe6')]||undefined,'CampaignId':_0x50c5ee['CampaignId']||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0xf2')));var _0xd843c8=new History(_0x21d7a8);_0xd843c8[_0x7990('0x6f')]=0xb;_0xd843c8['statedesc']=_0x7990('0xed');_0xd843c8[_0x7990('0x72')]=moment()[_0x7990('0x42')](_0x7990('0xc6'));_0xd843c8['endtime']=_0xd843c8[_0x7990('0x72')];_0xd843c8['calleridname']=_0x21d7a8[_0x7990('0xe8')];_0xd843c8['calleridnum']=_0x21d7a8[_0x7990('0xe9')];hopperUtils['createHistory'](_0xd843c8)['catch'](loggerCatch(_0x7990('0xf3')));}})[_0x7990('0x3a')](function(){if(_0x122107)hopperUtils['swapAdditionalPhones'](_0x21d7a8,_0x82aa80,_0x37d41b)[_0x7990('0x3a')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x7990('0x34')]=function(_0xa52b5f){if(this['actions'][_0xa52b5f[_0x7990('0xc2')]]){this[_0x7990('0xf4')][_0xa52b5f[_0x7990('0xc2')]][_0x7990('0xf5')]=_0xa52b5f['channel'];}if(this[_0x7990('0x25')][_0xa52b5f['uniqueid']]){this[_0x7990('0x25')][_0xa52b5f['uniqueid']][_0x7990('0xf5')]=_0xa52b5f['channel'];}};Dialer[_0x7990('0x84')][_0x7990('0xf6')]=function(_0x9aeae2){if(!this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]]){return;}var _0x5381c4=this[_0x7990('0x1e')][this[_0x7990('0xf4')][_0x9aeae2['actionid']][_0x7990('0xc4')]][_0x7990('0xf8')]||_0x7990('0xf9');if(_0x5381c4===_0x7990('0xfa')){if(this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]]&&_['isNil'](this['actions'][_0x9aeae2['actionid']][_0x7990('0xfb')])&&_0x9aeae2[_0x7990('0x88')]==='1'&&_0x9aeae2[_0x7990('0xfc')]==='0'){if(this[_0x7990('0x20')][_0x9aeae2[_0x7990('0xfd')]]){if(!this[_0x7990('0x20')][_0x9aeae2['stateinterface']]['locked']){this[_0x7990('0x20')][_0x9aeae2[_0x7990('0xfd')]][_0x7990('0xfb')]=!![];this['actions'][_0x9aeae2[_0x7990('0xf7')]][_0x7990('0xfb')]=!![];this[_0x7990('0xf4')][_0x9aeae2['actionid']][_0x7990('0xfd')]=_0x9aeae2[_0x7990('0xfd')];}}}}else if(_0x5381c4===_0x7990('0xf9')){if(this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]]){if(this['agents'][_0x9aeae2[_0x7990('0xfd')]]){this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]][_0x7990('0xfd')]=_0x9aeae2[_0x7990('0xfd')];if(_[_0x7990('0xfe')](this[_0x7990('0xff')][this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]][_0x7990('0xc4')]])){this[_0x7990('0xff')][this[_0x7990('0xf4')][_0x9aeae2[_0x7990('0xf7')]]['queue']]=[];}this[_0x7990('0xff')][this['actions'][_0x9aeae2[_0x7990('0xf7')]][_0x7990('0xc4')]]['push'](_[_0x7990('0x100')](_[_0x7990('0x77')](this['actions'][_0x9aeae2['actionid']],['idHopper',_0x7990('0xfd')]),{'status':_0x9aeae2[_0x7990('0x88')],'paused':_0x9aeae2[_0x7990('0xfc')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x4b5d5d){if(!this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]){return;}var _0x5fd637=this;var _0x271054=this['voiceQueues'][this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]['queue']];var _0x105d31=_0x271054[_0x7990('0xf8')]||'rrmemory';if(_0x105d31===_0x7990('0xfa')){if(this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]&&this['actions'][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xfd')]){this[_0x7990('0x1d')]['run'](this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0x101')],this[_0x7990('0xf4')][_0x4b5d5d['actionid']][_0x7990('0xfd')])[_0x7990('0xa1')](function(_0x1d7ee7){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x7990('0x64')](_0x1d7ee7,{'showHidden':![],'depth':null}));})[_0x7990('0x1b')](function(){_0x5fd637[_0x7990('0xd1')](_0x5fd637[_0x7990('0x1e')][_0x5fd637[_0x7990('0xf4')][_0x4b5d5d['actionid']]['queue']]);_0x5fd637[_0x7990('0x20')][_0x5fd637[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xfd')]][_0x7990('0xfb')]=![];delete _0x5fd637[_0x7990('0xf4')][_0x4b5d5d['actionid']];unlockQueueStatus(_0x271054);});}else{this[_0x7990('0xd1')](this[_0x7990('0x1e')][this['actions'][_0x4b5d5d['actionid']][_0x7990('0xc4')]]);hopperUtils[_0x7990('0xe2')]({'active':![],'ContactId':this[_0x7990('0xf4')][_0x4b5d5d['actionid']]['ContactId'],'ListId':this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xe5')],'VoiceQueueId':this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xe6')]||undefined,'CampaignId':this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x102')));delete this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]];unlockQueueStatus(_0x271054);}}else if(_0x105d31===_0x7990('0xf9')){var _0x4f4ef8;if(this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]&&!_[_0x7990('0x46')](this[_0x7990('0xff')][this[_0x7990('0xf4')][_0x4b5d5d['actionid']][_0x7990('0xc4')]])){if(this[_0x7990('0x29')][_0x5fd637[_0x7990('0xf4')][_0x4b5d5d['actionid']][_0x7990('0xc4')]]){this['queueBookedRR'][_0x5fd637[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xc4')]]=this[_0x7990('0x29')][this['actions'][_0x4b5d5d['actionid']][_0x7990('0xc4')]]?this[_0x7990('0x29')][this[_0x7990('0xf4')][_0x4b5d5d['actionid']][_0x7990('0xc4')]]:this[_0x7990('0xff')][this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xc4')]]?this[_0x7990('0xff')][this['actions'][_0x4b5d5d[_0x7990('0xf7')]][_0x7990('0xc4')]]['_rr']||0x0:0x0;}this[_0x7990('0xff')][this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]['queue']]['_rr']=this[_0x7990('0x29')][this[_0x7990('0xf4')][_0x4b5d5d[_0x7990('0xf7')]]['queue']];for(var _0x3318ad=0x0;_0x3318ad=_0x39d15b[_0x7990('0x126')]){_0x4a77de[_0x7990('0x127')](_0x1cde01,_0x77f684,_0x33e358,_0x7990('0x128'));}else{if(_0x1cde01[_0x7990('0x129')]>=_0x39d15b['dialMachineMaxRetry']){_0x4a77de[_0x7990('0x12a')](_0x1cde01,_0x77f684,_0x33e358,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1cde01[_0x7990('0x129')],'scheduledat':moment()['add'](_0x39d15b['dialMachineRetryFrequency'],_0x7990('0xf1'))[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x1cde01[_0x7990('0xe4')],'ListId':_0x1cde01['ListId'],'VoiceQueueId':_0x1cde01[_0x7990('0xe6')]||undefined,'CampaignId':_0x1cde01['CampaignId']||undefined})['catch'](loggerCatch(_0x7990('0x12b')));_0x77f684({'reschedule':0x1});}}});}if(_0x3fe71e[_0x7990('0x3e')]===_0x7990('0xc3')&&this[_0x7990('0x1f')][_0x3fe71e[_0x7990('0xc4')]][_0x7990('0x117')]&&_0x38f01f['value']===_0x7990('0x119')){delete this['uniqueId'][_0x38f01f[_0x7990('0xc2')]];this[_0x7990('0xd1')](this[_0x7990('0x1f')][_0x3fe71e[_0x7990('0xc4')]]);_0x2789f9=new Hangup(_0x3fe71e,_0x38f01f);_0x2789f9[_0x7990('0x6f')]=0x12;_0x2789f9[_0x7990('0x70')]=_0x7990('0x11a');_0x2789f9['membername']=_0x7990('0x12c');ami[_0x7990('0x3d')](_0x7990('0x122'),ut[_0x7990('0x11c')](_0x2789f9,_0x7990('0x123')));this['saveInDb'](_0x2789f9,_0x7990('0x12d'),_0x7990('0x12e'));}if(_0x3fe71e[_0x7990('0x3e')]===_0x7990('0xc3')&&this[_0x7990('0x1f')][_0x3fe71e[_0x7990('0xc4')]]['dialAMDActive']&&_0x38f01f['value']===_0x7990('0x120')){return new Promise(function(_0x5cb535,_0x8e64e2){delete _0x4a77de['uniqueId'][_0x38f01f[_0x7990('0xc2')]];_0x4a77de[_0x7990('0xd1')](_0x4a77de[_0x7990('0x1f')][_0x3fe71e[_0x7990('0xc4')]]);_0x4a77de[_0x7990('0x1f')][_0x3fe71e[_0x7990('0xc4')]][_0x7990('0xc8')]+=0x1;_0x4a77de['campaigns'][_0x3fe71e[_0x7990('0xc4')]][_0x7990('0x12f')]+=0x1;var _0x453c41=_0x4a77de['campaigns'][_0x3fe71e[_0x7990('0xc4')]];var _0x77995a=new Hangup(_0x3fe71e,_0x38f01f);_0x77995a[_0x7990('0x6f')]=0x13;_0x77995a['statedesc']=_0x7990('0x121');_0x77995a[_0x7990('0x11b')]=_0x7990('0x12c');_0x77995a[_0x7990('0x129')]+=0x1;_0x77995a[_0x7990('0xda')]+=0x1;_0x77995a[_0x7990('0x123')]=!![];ami[_0x7990('0x3d')]('custom:amd',ut[_0x7990('0x11c')](_0x77995a,_0x7990('0x123')));hopperUtils['createHistory'](_0x77995a)['catch'](loggerCatch(_0x7990('0x124')));if(_0x77995a[_0x7990('0x130')]+_0x77995a[_0x7990('0x125')]+_0x77995a[_0x7990('0x131')]+_0x77995a[_0x7990('0x132')]+_0x77995a[_0x7990('0xd9')]+_0x77995a['countabandonedretry']+_0x77995a[_0x7990('0x129')]+_0x77995a[_0x7990('0x133')]>=_0x453c41[_0x7990('0x126')]){_0x4a77de['stateGlobal'](_0x77995a,_0x5cb535,_0x8e64e2,_0x7990('0x128'));}else{if(_0x77995a[_0x7990('0x129')]>=_0x453c41[_0x7990('0x134')]){_0x4a77de['createStateFinal'](_0x77995a,_0x5cb535,_0x8e64e2,_0x7990('0x135'));}else{hopperUtils[_0x7990('0xe2')]({'active':![],'countmachineretry':_0x77995a['countmachineretry'],'scheduledat':moment()[_0x7990('0xe3')](_0x453c41[_0x7990('0x136')],_0x7990('0xf1'))[_0x7990('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x77995a['ContactId'],'ListId':_0x77995a[_0x7990('0xe5')],'VoiceQueueId':_0x77995a[_0x7990('0xe6')]||undefined,'CampaignId':_0x77995a[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x12b')));_0x5cb535({'reschedule':0x1});}}});}}};Dialer[_0x7990('0x84')][_0x7990('0x32')]=function(_0x4cf8fb){var _0x2cc183=this[_0x7990('0x25')][_0x4cf8fb[_0x7990('0xc2')]];var _0x8d5ca7;if(_0x2cc183&&_0x2cc183['type']===_0x7990('0xc3')){delete this[_0x7990('0x25')][_0x4cf8fb['uniqueid']];this[_0x7990('0xd1')](this['campaigns'][_0x2cc183[_0x7990('0xc4')]]);this[_0x7990('0x1f')][_0x2cc183['queue']][_0x7990('0x137')]+=0x1;_0x8d5ca7=new Hangup(_0x2cc183,_0x4cf8fb);hopperUtils['createHistory'](_0x8d5ca7)[_0x7990('0xa1')](loggerCatch(_0x7990('0x138')));hopperUtils[_0x7990('0xcf')](_0x8d5ca7)[_0x7990('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0x2cc183&&_0x2cc183[_0x7990('0x3e')]!==_0x7990('0xc3')&&isNotNull(this[_0x7990('0x1e')][_0x2cc183[_0x7990('0xc4')]][_0x7990('0x139')])){delete this[_0x7990('0x25')][_0x4cf8fb[_0x7990('0xc2')]];this[_0x7990('0xd1')](this[_0x7990('0x1e')][_0x2cc183[_0x7990('0xc4')]]);this[_0x7990('0x1e')][_0x2cc183[_0x7990('0xc4')]][_0x7990('0xc8')]+=0x1;this['voiceQueues'][_0x2cc183['queue']][_0x7990('0x12f')]+=0x1;_0x8d5ca7=new Hangup(_0x2cc183,_0x4cf8fb);_0x8d5ca7[_0x7990('0x6f')]=0x10;_0x8d5ca7[_0x7990('0x70')]=_0x7990('0x13a');_0x8d5ca7[_0x7990('0x11b')]=_0x7990('0x13b');hopperUtils[_0x7990('0xcd')](_0x8d5ca7)['catch'](loggerCatch(_0x7990('0x138')));hopperUtils[_0x7990('0xcf')](_0x8d5ca7)['catch'](loggerCatch(_0x7990('0x13c')));}if(_0x2cc183&&_0x2cc183[_0x7990('0x3e')]!==_0x7990('0xc3')&&!isNotNull(this[_0x7990('0x1e')][_0x2cc183[_0x7990('0xc4')]][_0x7990('0x139')])){delete this[_0x7990('0x25')][_0x4cf8fb[_0x7990('0xc2')]];this[_0x7990('0xd1')](this['voiceQueues'][_0x2cc183[_0x7990('0xc4')]]);this['voiceQueues'][_0x2cc183[_0x7990('0xc4')]]['outboundUnknownCallsDay']+=0x1;_0x8d5ca7=new Hangup(_0x2cc183,_0x4cf8fb);_0x8d5ca7[_0x7990('0x6f')]=0xc;_0x8d5ca7[_0x7990('0x70')]=_0x4cf8fb[_0x7990('0x13d')];_0x8d5ca7[_0x7990('0x11b')]=_0x7990('0x13e');hopperUtils['createHistory'](_0x8d5ca7)['catch'](loggerCatch(_0x7990('0x138')));hopperUtils[_0x7990('0xcf')](_0x8d5ca7)[_0x7990('0xa1')](loggerCatch(_0x7990('0x13c')));}};Dialer[_0x7990('0x84')]['syncQueueSummary']=function(_0x2d84cc){var _0x33ad99=this;if(!_0x33ad99[_0x7990('0x2a')][_0x2d84cc[_0x7990('0x44')]]){_0x33ad99[_0x7990('0x2a')][_0x2d84cc[_0x7990('0x44')]]={'running':![]};}else if(_0x33ad99['queuesSummary'][_0x2d84cc['name']][_0x7990('0x13f')]===!![]){return;}else if(_0x33ad99[_0x7990('0x2a')][_0x2d84cc[_0x7990('0x44')]][_0x7990('0x13f')]===![]){_0x33ad99[_0x7990('0x2a')][_0x2d84cc[_0x7990('0x44')]][_0x7990('0x13f')]=!![];}var _0x412a54=_0x33ad99[_0x7990('0x1e')][_0x2d84cc[_0x7990('0x44')]];var _0x220e6e=_0x412a54[_0x7990('0x67')]!==utils[_0x7990('0x6c')][_0x7990('0x7c')];var _0x2ca422=utils['isPreviewCampaign'](_0x412a54);_0x412a54[_0x7990('0x140')]=utils[_0x7990('0x141')](_0x412a54,_0x33ad99[_0x7990('0x21')]);Promise[_0x7990('0x142')]()[_0x7990('0x3a')](function(){if(_0x412a54['statusMessage']===utils[_0x7990('0x6c')][_0x7990('0x7c')]){if(_0x220e6e){clearPredictiveAttributes(_0x412a54);_0x2d84cc[_0x7990('0x27')]=undefined;_0x2d84cc[_0x7990('0x28')]=undefined;}if(_0x412a54[_0x7990('0x140')]===utils[_0x7990('0x6c')]['INACTIVE']){_0x2d84cc[_0x7990('0x143')]=0x0;_0x2d84cc[_0x7990('0xfc')]=0x0;_0x2d84cc[_0x7990('0x144')]=0x0;_0x2d84cc[_0x7990('0x145')]=0x0;_0x2d84cc[_0x7990('0x146')]=0x0;}}else if(_0x412a54['statusMessage']===utils['CAMPAIGN_STATUS'][_0x7990('0x147')]&&!_0x2ca422){return _0x33ad99['ifTime'](_0x412a54,!![])[_0x7990('0x3a')](function(){return _0x33ad99[_0x7990('0x91')](_0x412a54,![]);})[_0x7990('0x3a')](function(){return _0x33ad99[_0x7990('0xb0')](_0x412a54);})[_0x7990('0xa1')](function(_0x4a9811){loggerSyncQueueSummary['debug'](_0x7990('0x148'),util['inspect'](_0x4a9811,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x412a54);});}else{clearPredictiveAttributes(_0x412a54);}})[_0x7990('0x3a')](function(){var _0x535df3=_0x2d84cc[_0x7990('0x149')](_0x412a54);if(_0x535df3||_0x412a54[_0x7990('0x14a')]){_0x412a54[_0x7990('0x14a')]=![];_0x2d84cc['updateReportFromOutboundQueue'](_0x412a54);Object['assign'](_0x412a54,_0x2d84cc);emitOutboundVoiceQueueSummary(_0x2d84cc);}_0x33ad99[_0x7990('0x2a')][_0x412a54[_0x7990('0x44')]][_0x7990('0x13f')]=![];})[_0x7990('0xa1')](function(_0x93ccc4){logger['error'](_0x7990('0x148'),util[_0x7990('0x64')](_0x93ccc4,{'showHidden':![],'depth':null}));_0x33ad99[_0x7990('0x2a')][_0x412a54[_0x7990('0x44')]]['running']=![];});};Dialer[_0x7990('0x84')][_0x7990('0x30')]=_['throttle'](function(){var _0xa03b07=_['filter'](this[_0x7990('0x1e')],function(_0x5cdcfe){return _0x5cdcfe[_0x7990('0x14b')];});var _0x57538e=_[_0x7990('0x14c')](this[_0x7990('0x20')],function(_0x3b6526){return _0x3b6526[_0x7990('0x14d')]&&_0x3b6526[_0x7990('0x88')]===_0x7990('0x89');});if(_0xa03b07['length']>0x0&&_0x57538e['length']>0x0){return Promise[_0x7990('0x142')]()[_0x7990('0x3a')](cmHopper[_0x7990('0x14e')](_[_0x7990('0x14f')](_0xa03b07,'id'),previewRecallmeReminderInterval,_[_0x7990('0x14f')](_0x57538e,'id')))[_0x7990('0x3a')](function(_0x1096d7){for(var _0x13f43b=0x0;_0x13f43b<_0x1096d7[_0x7990('0x98')];_0x13f43b++){var _0x4fbb06=_0x1096d7[_0x13f43b][_0x7990('0x150')][_0x7990('0x44')];if(_0x4fbb06)io['to'](util['format'](_0x7990('0x151'),_0x4fbb06))[_0x7990('0x3d')](_0x7990('0x152'),{'hopper':_0x1096d7[_0x13f43b]});}})['catch'](function(_0x4e3f1b){logger[_0x7990('0x63')](_0x7990('0x153'),_0x4e3f1b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7990('0x84')][_0x7990('0x38')]=function(){var _0x142dcc=this;setInterval(function(){_0x142dcc[_0x7990('0x154')](_0x142dcc[_0x7990('0x25')],_0x7990('0x155'));_0x142dcc['clearZombieChannels'](_0x142dcc['actions'],_0x7990('0x156'));},0x32c8);};Dialer[_0x7990('0x84')][_0x7990('0x154')]=function(_0x25fac4,_0x58f28d){var _0x560e45=this;for(var _0x355e9f in _0x25fac4){if(typeof _0x25fac4[_0x355e9f]!==_0x7990('0xaa')){this['sequence'][_0x7990('0x19')](function(){if(!_[_0x7990('0xfe')](_0x25fac4[_0x355e9f])){return ami[_0x7990('0x9a')]({'action':_0x7990('0x88'),'channel':_0x25fac4[_0x355e9f][_0x7990('0xf5')]})[_0x7990('0xa1')](function(_0x2b47e5){if(_0x2b47e5['message']===_0x7990('0x157')){setTimeout(function(){if(_0x25fac4[_0x355e9f]&&_0x25fac4[_0x355e9f][_0x7990('0x3e')]!==_0x7990('0xc3')){_0x560e45['updateOriginated'](_0x560e45[_0x7990('0x1e')][_0x25fac4[_0x355e9f][_0x7990('0xc4')]]);logger[_0x7990('0x63')](_0x7990('0x158'),_0x58f28d,_0x355e9f,_0x25fac4[_0x355e9f]['queue']);delete _0x25fac4[_0x355e9f];}if(_0x25fac4[_0x355e9f]&&_0x25fac4[_0x355e9f][_0x7990('0x3e')]===_0x7990('0xc3')){_0x560e45[_0x7990('0xd1')](_0x560e45[_0x7990('0x1f')][_0x25fac4[_0x355e9f][_0x7990('0xc4')]]);logger[_0x7990('0x63')](_0x7990('0x159'),_0x58f28d,_0x355e9f,_0x25fac4[_0x355e9f][_0x7990('0xc4')]);delete _0x25fac4[_0x355e9f];}},0x2328);}});}});}}};Dialer[_0x7990('0x84')]['getVoiceQueueRtPauses']=function(_0x1f9550){return Promise[_0x7990('0x142')]()[_0x7990('0x3a')](voiceQueueRt['getVoiceQueueRtPauses'](_0x1f9550))[_0x7990('0xa1')](loggerCatch(_0x7990('0x15a')));};Dialer[_0x7990('0x84')]['updateOriginated']=function(_0x384d18){if(!_[_0x7990('0x3c')](_0x384d18)&&_0x384d18!==null){if(typeof _0x384d18['originated']!==_0x7990('0xaa')){if(_0x384d18[_0x7990('0x15b')]>0x0){_0x384d18[_0x7990('0x15b')]-=0x1;}else{logger[_0x7990('0x63')](_0x7990('0x15c'));}}}else{logger[_0x7990('0x63')](_0x7990('0x15d'));}};Dialer[_0x7990('0x84')][_0x7990('0x15e')]=function(_0x224043,_0x35b29d){var _0x524cef=this;return function(_0x9e1525){_0x524cef[_0x7990('0xd1')](_0x35b29d);logger[_0x7990('0x63')](_0x224043,util[_0x7990('0x64')](_0x9e1525,{'showHidden':![],'depth':null}));};};Dialer[_0x7990('0x84')][_0x7990('0x15f')]=function(_0x3dc7a0,_0x507945,_0x506dca){var _0x136f58={'state':0x19,'statedesc':_0x7990('0x160')};this[_0x7990('0xd1')](_0x507945);this[_0x7990('0x11d')](_[_0x7990('0x100')](_0x136f58,_[_0x7990('0x77')](_0x506dca,[_0x7990('0xe4'),_0x7990('0xe5'),_0x7990('0x161'),_0x7990('0xe6'),'CampaignId'])),_0x7990('0x162'),_0x7990('0x163'));logger[_0x7990('0x63')](_0x3dc7a0);};Dialer[_0x7990('0x84')][_0x7990('0x11d')]=function(_0x4c37f6,_0x53e0d1,_0x2ce121){hopperUtils[_0x7990('0xcd')](_0x4c37f6)['catch'](loggerCatch(_0x53e0d1));hopperUtils[_0x7990('0xcf')](_0x4c37f6)[_0x7990('0xa1')](loggerCatch(_0x2ce121));};Dialer[_0x7990('0x84')]['queueCallerAbandonCreateState']=function(_0x1828b1,_0x59214a){hopperUtils['createHistory'](_0x1828b1)[_0x7990('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x59214a==0x0){hopperUtils[_0x7990('0xcf')](_0x1828b1)[_0x7990('0xa1')](loggerCatch(_0x7990('0x164')));}};Dialer[_0x7990('0x84')]['checkPreviewRecallReminder']=function(_0x84f780){return Promise[_0x7990('0x142')]()[_0x7990('0x3a')](cmHopper[_0x7990('0x14e')](_0x84f780['id'],previewRecallmeReminderInterval))[_0x7990('0x3a')](function(_0x43f66f){for(var _0x29d299=0x0;_0x29d299<_0x43f66f['length'];_0x29d299++){var _0x1e07c1=_0x43f66f[_0x29d299][_0x7990('0x150')][_0x7990('0x44')];if(_0x1e07c1)io['to'](util[_0x7990('0x42')]('user:%s',_0x1e07c1))[_0x7990('0x3d')](_0x7990('0x152'),{'hopper':_0x43f66f[_0x29d299]});}})['catch'](function(){});};Dialer[_0x7990('0x84')][_0x7990('0xae')]=function(_0x24e053){var _0x3ad8c1=this;return function(){_0x3ad8c1[_0x7990('0x165')](_0x24e053);};};Dialer[_0x7990('0x84')]['actionOriginate']=function(_0x1c6e72,_0x2d468c){var _0x51cc4b=this;var _0x49a413=uuid['v4']();this[_0x7990('0xf4')][_0x49a413]=new Action(_0x1c6e72,_0x2d468c,_0x49a413);return new Promise(function(_0x324fa9,_0x279446){if(_[_0x7990('0x3c')](_0x1c6e72)&&typeof _0x1c6e72!=='object'){return _0x279446(msgResponse(_0x7990('0x166'),_0x7990('0x92'),_0x7990('0x167')));}if(_['isUndefined'](_0x2d468c[_0x7990('0x168')])||_0x2d468c[_0x7990('0x168')]===null){return _0x279446(msgResponse(_0x7990('0x166'),_0x7990('0x92'),_0x7990('0x169')));}var _0x1b02ae={'XMD-CALLERID':_0x51cc4b['actions'][_0x49a413][_0x7990('0x16a')](),'XMD-AGI':_0x1c6e72[_0x7990('0x139')]?util[_0x7990('0x42')](_0x7990('0x16b'),ipAgi,_0x1c6e72[_0x7990('0x139')]):_0x7990('0x16c'),'XMD-AGIAFTER':_0x1c6e72['dialQueueProject2']?util[_0x7990('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1c6e72[_0x7990('0xcb')]):_0x7990('0x16c'),'XMD-QUEUE':utils['isOutboundQueue'](_0x1c6e72)?util[_0x7990('0x42')]('\x22%s,%s%s,,,%s\x22',_0x1c6e72['name'],_0x1c6e72['dialQueueOptions']||'',_0x1c6e72['dialAgiAfterHangupAgent']?'c':'',_0x1c6e72[_0x7990('0x16d')]||0x3):_0x7990('0x16c'),'XMD-CONTACTID':_0x2d468c[_0x7990('0xe4')],'XMD-CDRTYPE':_0x7990('0x16e'),'CALLERID(all)':_0x51cc4b[_0x7990('0xf4')][_0x49a413][_0x7990('0x16a')](),'XMD-AMD':_0x1c6e72[_0x7990('0x117')]?_0x7990('0x147'):'NONE','XMD-DESTINATION':_0x7990('0x116')};if(_0x1c6e72[_0x7990('0x117')]){_0x1b02ae[_0x7990('0x16f')]=_0x1c6e72[_0x7990('0x170')]||0x9c4;_0x1b02ae['XMD-AMDGREETING']=_0x1c6e72[_0x7990('0x171')]||0x5dc;_0x1b02ae[_0x7990('0x172')]=_0x1c6e72[_0x7990('0x173')]||0x320;_0x1b02ae[_0x7990('0x174')]=_0x1c6e72[_0x7990('0x175')]||0x1388;_0x1b02ae['XMD-AMDMINWORDLENGTH']=_0x1c6e72['dialAMDMinWordLength']||0x64;_0x1b02ae[_0x7990('0x176')]=_0x1c6e72[_0x7990('0x177')]||0x32;_0x1b02ae[_0x7990('0x178')]=_0x1c6e72[_0x7990('0x179')]||0x3;_0x1b02ae['XMD-AMDSILENCETHRESHOLD']=_0x1c6e72[_0x7990('0x17a')]||0x100;_0x1b02ae[_0x7990('0x17b')]=_0x1c6e72[_0x7990('0x17c')]||0x1388;}if(utils[_0x7990('0x17d')](_0x1c6e72)){_0x1b02ae['XMD-VOICEQUEUEID']=_0x2d468c['VoiceQueueId'];}else{_0x1b02ae[_0x7990('0x17e')]=_0x2d468c[_0x7990('0xe7')];}var _0x3baf7f=utils[_0x7990('0x17f')](_0x2d468c[_0x7990('0x180')]);Object[_0x7990('0x181')](_0x1b02ae,_0x3baf7f);var _0x4ac1eb=_0x51cc4b['isTrunkReachable'](_0x1c6e72[_0x7990('0x182')])?utils[_0x7990('0x183')](_0x1c6e72[_0x7990('0x182')][_0x7990('0x184')],_0x1c6e72[_0x7990('0x185')],_0x1c6e72[_0x7990('0x186')]>0x0?utils[_0x7990('0x187')](_0x1c6e72[_0x7990('0x188')],_0x1c6e72[_0x7990('0x186')]):_0x1c6e72['dialOriginateCallerIdNumber']):utils[_0x7990('0x183')](_[_0x7990('0xfe')](_0x1c6e72['TrunkBackup'])?_0x1c6e72[_0x7990('0x182')]['callerid']:_0x1c6e72[_0x7990('0x8b')][_0x7990('0x184')],_0x1c6e72[_0x7990('0x185')],_0x1c6e72['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x7990('0x187')](_0x1c6e72[_0x7990('0x188')],_0x1c6e72['dialRandomLastDigitCallerIdNumber']):_0x1c6e72[_0x7990('0x188')]);if(_0x4ac1eb){_0x1b02ae[_0x7990('0x189')]=_0x51cc4b['actions'][_0x49a413]['originatecalleridname']=utils[_0x7990('0x18a')](_0x4ac1eb);_0x1b02ae[_0x7990('0x18b')]=_0x2d468c[_0x7990('0x168')];}_0x1c6e72[_0x7990('0x18c')]=_0x1b02ae;return ami[_0x7990('0x9a')]({'actionid':_0x49a413,'action':_0x7990('0x166'),'channel':_0x51cc4b[_0x7990('0x85')](_0x1c6e72[_0x7990('0x182')])?util['format'](_0x7990('0x18d'),_0x1c6e72[_0x7990('0x182')][_0x7990('0x44')],isNotNull(_0x1c6e72[_0x7990('0x18e')])?_0x1c6e72[_0x7990('0x18e')][_0x7990('0x18f')]()||'':'',_0x1c6e72[_0x7990('0x190')]>0x0?_0x2d468c[_0x7990('0x168')][_0x7990('0x191')](_0x1c6e72[_0x7990('0x190')]):_0x2d468c['phone']):util[_0x7990('0x42')](_0x7990('0x18d'),_[_0x7990('0xfe')](_0x1c6e72[_0x7990('0x8b')])?_0x1c6e72['Trunk'][_0x7990('0x44')]:_0x1c6e72[_0x7990('0x8b')]['name'],isNotNull(_0x1c6e72['dialPrefix'])?_0x1c6e72['dialPrefix'][_0x7990('0x18f')]()||'':'',_0x1c6e72[_0x7990('0x190')]>0x0?_0x2d468c['phone'][_0x7990('0x191')](_0x1c6e72['dialCutDigit']):_0x2d468c[_0x7990('0x168')]),'callerid':_0x4ac1eb,'Exten':_0x7990('0x116'),'Context':_0x7990('0x192'),'Priority':'1','variable':_0x1b02ae,'timeout':(_0x1c6e72[_0x7990('0x193')]||0x1e)*0x3e8,'async':!![],'channelid':_0x49a413})['then'](function(_0x3a5128){return _0x324fa9(_0x3a5128);})[_0x7990('0xa1')](function(_0x49892c){_0x1c6e72[_0x7990('0x194')]+=0x1;var _0x59ab3e=new History(_0x51cc4b[_0x7990('0xf4')][_0x49a413]);logger['error'](util[_0x7990('0x42')](_0x7990('0x195'),JSON['stringify'](_0x49892c)));_0x59ab3e['state']=0xe;_0x59ab3e[_0x7990('0x70')]=_0x7990('0x196');_0x59ab3e['starttime']=moment()[_0x7990('0x42')](_0x7990('0xc6'));_0x59ab3e[_0x7990('0x71')]=_0x59ab3e[_0x7990('0x72')];hopperUtils[_0x7990('0xcd')](_0x59ab3e)[_0x7990('0xa1')](loggerCatch(_0x7990('0x197')));_0x51cc4b['moveContactManagedDialer'](_0x59ab3e)['catch'](loggerCatch(_0x7990('0x197')))[_0x7990('0x1b')](function(){delete _0x51cc4b['actions'][_0x49a413];return _0x279446(msgResponse(_0x7990('0x166'),_0x7990('0x83'),_0x7990('0x198')));});});});};Dialer[_0x7990('0x84')][_0x7990('0x199')]=function(_0x2f5283,_0x4b424d,_0xb32f9a){var _0x2566f8=new History(_0x4b424d);if(_0x2566f8['countbusyretry']+_0x2566f8[_0x7990('0x125')]+_0x2566f8[_0x7990('0x131')]+_0x2566f8[_0x7990('0x132')]+_0x2566f8['countdropretry']+_0x2566f8[_0x7990('0xef')]+_0x2566f8[_0x7990('0x129')]+_0x2566f8['countagentrejectretry']>=_0xb32f9a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2f5283){case 0x3:if(_0x2566f8['countnoanswerretry']>=_0xb32f9a[_0x7990('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2566f8[_0x7990('0x131')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a['dialNoAnswerRetryFrequency'],_0x7990('0xf1'))[_0x7990('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2566f8[_0x7990('0xe4')],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8['CampaignId']||undefined})['catch'](loggerCatch(_0x7990('0x19b')));break;case 0x5:if(_0x2566f8['countbusyretry']>=_0xb32f9a[_0x7990('0x19c')]-0x1){return!![];}hopperUtils[_0x7990('0xe2')]({'active':![],'countbusyretry':_0x2566f8['countbusyretry']+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0x19d')],'minutes')['format'](_0x7990('0xc6')),'ContactId':_0x2566f8[_0x7990('0xe4')],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x19e')));break;case 0x8:if(_0x2566f8[_0x7990('0x125')]>=_0xb32f9a['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x7990('0xe2')]({'active':![],'countcongestionretry':_0x2566f8[_0x7990('0x125')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0x19f')],_0x7990('0xf1'))[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x2566f8['ContactId'],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x1a0')));break;case 0x0:if(_0x2566f8['countnosuchnumberretry']>=_0xb32f9a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x7990('0xe2')]({'active':![],'countnosuchnumberretry':_0x2566f8[_0x7990('0x132')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0x1a1')],'minutes')[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x2566f8[_0x7990('0xe4')],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8['CampaignId']||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x1a2')));}break;case 0xa:if(_0x2566f8[_0x7990('0xd9')]>=_0xb32f9a[_0x7990('0xe0')]-0x1){return!![];}hopperUtils[_0x7990('0xe2')]({'active':![],'countdropretry':_0x2566f8[_0x7990('0xd9')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0xdb')],'minutes')[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x2566f8[_0x7990('0xe4')],'ListId':_0x2566f8['ListId'],'VoiceQueueId':_0x2566f8['VoiceQueueId']||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x1a3')));break;case 0xb:if(_0x2566f8[_0x7990('0xef')]>=_0xb32f9a[_0x7990('0x1a4')]-0x1){return!![];}hopperUtils[_0x7990('0xe2')]({'active':![],'countabandonedretry':_0x2566f8[_0x7990('0xef')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0xf0')],_0x7990('0xf1'))[_0x7990('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2566f8['ContactId'],'ListId':_0x2566f8['ListId'],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})['catch'](loggerCatch(_0x7990('0xf2')));break;case 0x13:if(_0x2566f8[_0x7990('0x129')]>=_0xb32f9a[_0x7990('0x134')]-0x1){return!![];}hopperUtils[_0x7990('0xe2')]({'active':![],'countmachineretry':_0x2566f8[_0x7990('0x129')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0x136')],'minutes')[_0x7990('0x42')](_0x7990('0xc6')),'ContactId':_0x2566f8['ContactId'],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x12b')));break;case 0x14:if(_0x2566f8[_0x7990('0x133')]>=_0xb32f9a[_0x7990('0x1a5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x2566f8[_0x7990('0x133')]+=0x1,'scheduledat':moment()[_0x7990('0xe3')](_0xb32f9a[_0x7990('0x1a6')],_0x7990('0xf1'))[_0x7990('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2566f8[_0x7990('0xe4')],'ListId':_0x2566f8[_0x7990('0xe5')],'VoiceQueueId':_0x2566f8[_0x7990('0xe6')]||undefined,'CampaignId':_0x2566f8[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x1a7')));break;default:return!![];}};Dialer['prototype'][_0x7990('0x111')]=function(_0x1c119e,_0x407130,_0x63e943){var _0x485e68=this;var _0x461d56=new History(_0x1c119e);var _0x20a548=![];var _0x1dc792;var _0x26b2bf;return new Promise(function(_0x19f288,_0x4d814d){if(_[_0x7990('0x3c')](_0x407130)&&typeof _0x407130!==_0x7990('0x1a8')){return _0x4d814d(msgResponse(_0x7990('0x1a9'),_0x7990('0x92'),'entity\x20is\x20undefine'));}if(_[_0x7990('0x3c')](_0x63e943)&&typeof _0x63e943!==_0x7990('0x1a8')){return _0x4d814d(msgResponse(_0x7990('0x1a9'),_0x7990('0x92'),_0x7990('0x1aa')));}hopperUtils[_0x7990('0xdd')](_0x461d56,_0x63e943[_0x7990('0xc9')],_0x407130)[_0x7990('0x3a')](function(_0x5d8ce4){if(_0x5d8ce4[_0x7990('0xdf')]==0x1)_0x20a548=!![];switch(_0x63e943[_0x7990('0xc9')]){case'0':_0x407130[_0x7990('0x1ab')]+=0x1;_0x461d56[_0x7990('0x6f')]=0x0;_0x461d56[_0x7990('0x70')]=_0x7990('0x1ac');_0x461d56['countnosuchnumberretry']+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;ami[_0x7990('0x3d')](_0x7990('0x1ad'),ut[_0x7990('0x11c')](_0x1c119e,'nosuchnumber'));_0x1dc792=_0x407130[_0x7990('0x1a1')];_0x26b2bf=_0x407130[_0x7990('0xdc')];hopperUtils['createHistory'](_0x461d56)[_0x7990('0xa1')](loggerCatch(_0x7990('0x124')));if(_0x485e68[_0x7990('0x199')](0x0,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0x132')]>=_0x407130['dialNoSuchNumberMaxRetry']){_0x485e68[_0x7990('0x12a')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1ae'));}else{_0x485e68[_0x7990('0x127')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1ae'));}}break;case'3':_0x407130[_0x7990('0x1af')]+=0x1;_0x461d56[_0x7990('0x6f')]=0x3;_0x461d56[_0x7990('0x70')]=_0x7990('0x1b0');_0x461d56[_0x7990('0x131')]+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;var _0x4aad40=ut[_0x7990('0x1b1')](_0x1c119e,_0x407130);ami[_0x7990('0x3d')](_0x7990('0x1b2'),_0x4aad40);_0x1dc792=_0x407130[_0x7990('0x1b3')];_0x26b2bf=_0x407130[_0x7990('0xdc')];hopperUtils[_0x7990('0xcd')](_0x461d56)[_0x7990('0xa1')](loggerCatch(_0x7990('0x1b4')));if(_0x485e68[_0x7990('0x199')](0x3,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0x131')]>=_0x407130[_0x7990('0x19a')]){_0x485e68[_0x7990('0x12a')](_0x461d56,_0x19f288,_0x4d814d,'reason\x203\x20ringing\x20no\x20answer');}else{_0x485e68[_0x7990('0x127')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1b5'));}}break;case'5':_0x407130[_0x7990('0x1b6')]+=0x1;_0x461d56[_0x7990('0x6f')]=0x5;_0x461d56[_0x7990('0x70')]=_0x7990('0x1b7');_0x461d56['countbusyretry']+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;ami[_0x7990('0x3d')](_0x7990('0x1b8'),ut[_0x7990('0x11c')](_0x1c119e,'busy'));_0x1dc792=_0x407130[_0x7990('0x19d')];_0x26b2bf=_0x407130[_0x7990('0xdc')];hopperUtils[_0x7990('0xcd')](_0x461d56)[_0x7990('0xa1')](loggerCatch(_0x7990('0x1b9')));if(_0x485e68[_0x7990('0x199')](0x5,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56['countbusyretry']>=_0x407130[_0x7990('0x19c')]){_0x485e68[_0x7990('0x12a')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1ba'));}else{_0x485e68['stateGlobal'](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1ba'));}}break;case'8':_0x407130[_0x7990('0x1bb')]+=0x1;_0x461d56[_0x7990('0x6f')]=0x8;_0x461d56[_0x7990('0x70')]=_0x7990('0x1bc');_0x461d56[_0x7990('0x125')]+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;_0x1dc792=_0x407130[_0x7990('0x19f')];_0x26b2bf=_0x407130[_0x7990('0xdc')];ami['emit'](_0x7990('0x1bd'),ut[_0x7990('0x11c')](_0x1c119e,_0x7990('0x1be')));hopperUtils[_0x7990('0xcd')](_0x461d56)['catch'](loggerCatch(_0x7990('0x1bf')));if(_0x485e68['checkRetriveMax'](0x8,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0x125')]>=_0x407130[_0x7990('0x1c0')]){_0x485e68[_0x7990('0x12a')](_0x461d56,_0x19f288,_0x4d814d,'reason\x208\x20congestion');}else{_0x485e68[_0x7990('0x127')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1c1'));}}break;case'11':_0x407130[_0x7990('0x1c2')]+=0x1;_0x461d56[_0x7990('0x6f')]=0xb;_0x461d56['statedesc']='Abandoned';_0x461d56[_0x7990('0xef')]+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;_0x1dc792=_0x407130[_0x7990('0xf0')];_0x26b2bf=_0x407130['callAdditionalPhoneAfterMin'];hopperUtils[_0x7990('0xcd')](_0x461d56)[_0x7990('0xa1')](loggerCatch(_0x7990('0xf3')));if(_0x485e68[_0x7990('0x199')](0xb,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0xef')]>=_0x407130[_0x7990('0x1a4')]){_0x485e68['createStateFinal'](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1c3'));}else{_0x485e68[_0x7990('0x127')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1c3'));}}break;case'20':_0x407130[_0x7990('0x1c4')]+=0x1;_0x461d56[_0x7990('0x6f')]=0x14;_0x461d56[_0x7990('0x70')]=_0x7990('0x1c5');_0x461d56[_0x7990('0x133')]+=0x1;_0x461d56[_0x7990('0xda')]+=0x1;_0x1dc792=_0x407130['dialAgentRejectRetryFrequency'];_0x26b2bf=_0x407130[_0x7990('0xdc')];ami['emit'](_0x7990('0x1c6'),ut[_0x7990('0x11c')](_0x1c119e,_0x7990('0x1c7')));hopperUtils[_0x7990('0xcd')](_0x461d56)[_0x7990('0xa1')](loggerCatch(_0x7990('0x1c8')));if(_0x485e68[_0x7990('0x199')](0x14,_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0x133')]>=_0x407130[_0x7990('0x1a5')]){_0x485e68['createStateFinal'](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1c9'));}else{_0x485e68[_0x7990('0x127')](_0x461d56,_0x19f288,_0x4d814d,_0x7990('0x1c9'));}}break;default:_0x407130['outboundUnknownCallsDay']+=0x1;_0x461d56[_0x7990('0x6f')]=0xc;_0x461d56[_0x7990('0x70')]=_0x63e943['reason'];_0x1dc792=_0x407130[_0x7990('0x1a6')];_0x26b2bf=_0x407130['callAdditionalPhoneAfterMin'];hopperUtils[_0x7990('0xcd')](_0x461d56)[_0x7990('0xa1')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x485e68[_0x7990('0x199')](_0x63e943[_0x7990('0xc9')],_0x1c119e,_0x407130)&&!_0x20a548){if(_0x461d56[_0x7990('0x130')]+_0x461d56[_0x7990('0x125')]+_0x461d56[_0x7990('0x131')]+_0x461d56['countnosuchnumberretry']+_0x461d56[_0x7990('0xd9')]+_0x461d56[_0x7990('0xef')]+_0x461d56[_0x7990('0x129')]+_0x461d56[_0x7990('0x133')]>=_0x407130['dialGlobalMaxRetry']){_0x485e68['stateGlobal'](_0x461d56,_0x19f288,_0x4d814d,_0x63e943[_0x7990('0xc9')]);}else{_0x485e68[_0x7990('0x12a')](_0x461d56,_0x19f288,_0x4d814d,_0x63e943[_0x7990('0xc9')]);}}}})['then'](function(){if(_0x20a548){hopperUtils[_0x7990('0xeb')](_0x461d56,_0x1dc792,_0x26b2bf)[_0x7990('0x3a')](function(){return _0x19f288(0x1);});}});});};Dialer[_0x7990('0x84')][_0x7990('0x127')]=function(_0x45c4f8,_0x2ae076,_0x443f8e,_0x2e0766){var _0x561c37=new Final(_0x45c4f8);_0x561c37[_0x7990('0x6f')]=0xf;_0x561c37[_0x7990('0x70')]=_0x7990('0x1ca');this[_0x7990('0x12a')](_0x561c37,_0x2ae076,_0x443f8e,_0x2e0766);};Dialer[_0x7990('0x84')]['createStateFinal']=function(_0x2e4351,_0x1162cb,_0x365628,_0x442571){hopperUtils[_0x7990('0xcf')](_0x2e4351)[_0x7990('0x3a')](function(){return _0x1162cb(msgResponse(_0x7990('0x1a9'),_0x7990('0x110'),_0x442571));})[_0x7990('0xa1')](function(){return _0x365628(msgResponse(_0x7990('0x1cb'),_0x7990('0x92'),_0x7990('0x1cc')));});};Dialer['prototype'][_0x7990('0x8')]=function(_0x56c598){var _0x143715=_0x56c598['dialPredictiveOptimizationPercentage']/0x64;var _0x2bcc19=_0x56c598[_0x7990('0xd4')]/(_0x56c598[_0x7990('0xd4')]+_0x56c598[_0x7990('0xc8')]);var _0x55d134=Math[_0x7990('0x1cd')](_0x56c598[_0x7990('0x1ce')]*(_0x56c598['predictiveIntervalMaxThreshold']/0x64));var _0x3e775c=Math[_0x7990('0x1cd')](_0x56c598[_0x7990('0x1ce')]*(_0x56c598['predictiveIntervalMinThreshold']/0x64));var _0x2f48c8=_0x56c598[_0x7990('0x143')]+_0x56c598['talking'];var _0x28ed52=Math[_0x7990('0x1cf')](_0x56c598[_0x7990('0x58')]*_0x56c598[_0x7990('0x1d0')]*_0x56c598[_0x7990('0x1d1')]*_0x56c598[_0x7990('0x1d2')]);if(_[_0x7990('0x3c')](_0x56c598['startProgressive'])){if(!_[_0x7990('0x3c')](_0x56c598[_0x7990('0x27')])){_0x56c598[_0x7990('0x27')]=undefined;loggerPredictive[_0x7990('0x63')](_0x7990('0x1d3'),_0x7990('0x1d4'));}if(!_['isUndefined'](_0x56c598['handlePredictive'])){loggerPredictive[_0x7990('0x63')](_0x7990('0x1d3'),_0x7990('0x1d5'));clearInterval(_0x56c598[_0x7990('0x61')]);_0x56c598['handlePredictive']=undefined;}_0x56c598['startProgressive']=moment()[_0x7990('0x42')](_0x7990('0xc6'));loggerPredictive[_0x7990('0x48')](_0x56c598[_0x7990('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x56c598[_0x7990('0x28')]);this['handlePower'](_0x56c598,0x1);}else if(ifInterval(_0x56c598[_0x7990('0x1d6')],_0x56c598[_0x7990('0x28')])){this[_0x7990('0xb2')](_0x56c598,0x1);loggerPredictiveCalls[_0x7990('0x48')]('[startMethodPredictive][StartProgressive][Loop]',_0x56c598['startProgressive'],_0x56c598[_0x7990('0x44')]);_0x56c598['erlangCalls']=0x0;_0x56c598[_0x7990('0xd5')]=0x0;}else if(_0x143715<_0x2bcc19&&_0x56c598['dialPredictiveOptimization']===_0x7990('0x1d7')){clearPredictiveAttributes(_0x56c598);loggerPredictive[_0x7990('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7990('0x1d8'),_0x2bcc19,'startProgressive',_0x56c598[_0x7990('0x44')]);}else if(_0x28ed52<_0x56c598['predictiveIntervalErlangCallsDroppedCalls']&&_0x56c598[_0x7990('0x1d9')]===_0x7990('0x1d7')){clearPredictiveAttributes(_0x56c598);loggerPredictive[_0x7990('0x48')](_0x7990('0x1da'),_0x7990('0x1db'),_0x28ed52,_0x7990('0x1dc'),_0x56c598[_0x7990('0xd5')],_0x7990('0x28'),_0x56c598[_0x7990('0x44')]);}else if(!ifInterval(_0x56c598[_0x7990('0x1d6')],_0x56c598[_0x7990('0x28')])&&_[_0x7990('0x3c')](_0x56c598[_0x7990('0x27')])&&!_[_0x7990('0x3c')](_0x56c598[_0x7990('0x28')])){_0x56c598[_0x7990('0x27')]=moment()[_0x7990('0x42')](_0x7990('0xc6'));loggerPredictive[_0x7990('0x48')](_0x56c598[_0x7990('0x44')],_0x7990('0x1dd'),_0x56c598['startPredictive']);hopperUtils['avgHandleTime'](_0x56c598[_0x7990('0x1d6')])[_0x7990('0x3a')](this[_0x7990('0x1de')](_0x56c598))['then'](mergeDataErlangB(_0x56c598))[_0x7990('0x3a')](this[_0x7990('0x1df')](_0x56c598))[_0x7990('0xa1')](loggerCatchPredictive(_0x7990('0x1e0'),_0x56c598));}else if(!ifInterval(_0x56c598[_0x7990('0x1d6')],_0x56c598[_0x7990('0x27')])){_0x56c598[_0x7990('0xd5')]=0x0;_0x56c598[_0x7990('0x27')]=moment()[_0x7990('0x42')](_0x7990('0xc6'));loggerPredictive[_0x7990('0x48')](_0x56c598['name'],_0x7990('0x1e1'),_0x56c598[_0x7990('0x27')]);clearInterval(_0x56c598[_0x7990('0x61')]);_0x56c598['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x56c598[_0x7990('0x1d6')])['then'](this[_0x7990('0x1de')](_0x56c598))['then'](mergeDataErlangB(_0x56c598))[_0x7990('0x3a')](this[_0x7990('0x1df')](_0x56c598))[_0x7990('0xa1')](loggerCatchPredictive(_0x7990('0x1e2'),_0x56c598));}else if(_0x56c598[_0x7990('0x1ce')]&&_0x2f48c8<_0x56c598[_0x7990('0x1ce')]-_0x3e775c){clearPredictiveAttributes(_0x56c598);loggerPredictive['info'](_0x56c598[_0x7990('0x44')],_0x7990('0x1e3'),_0x2f48c8,_0x7990('0x1e4'),_0x56c598[_0x7990('0x1ce')],'-',_0x3e775c,'=',_0x56c598[_0x7990('0x1ce')]-_0x3e775c,')');}else if(_0x56c598[_0x7990('0x1ce')]&&_0x2f48c8>_0x56c598['predictiveIntervalAvailable']+_0x55d134){clearPredictiveAttributes(_0x56c598);loggerPredictive['info'](_0x56c598['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2f48c8,_0x7990('0x1e5'),_0x56c598[_0x7990('0x1ce')],'+',_0x55d134,'=',_0x56c598[_0x7990('0x1ce')]+_0x55d134,')');}};Dialer[_0x7990('0x84')][_0x7990('0x1de')]=function(_0x3f5d0b){var _0x2c663c=this;return function(_0xbd1da6){return new Promise(function(_0x15bb18,_0x568855){_[_0x7990('0x100')](_0x3f5d0b,_0xbd1da6[0x0]);if(checkGetDataPredictive(_0xbd1da6[0x0])){var _0x4cfff7=_0x3f5d0b[_0x7990('0x1ce')]=_0x3f5d0b[_0x7990('0x145')]+_0x3f5d0b[_0x7990('0x143')];var _0x57dffd=_0x3f5d0b[_0x7990('0x1d6')]*0x3c;var _0x2d33fd=_0xbd1da6[0x0]['predictiveIntervalAvgTalktime']+_0xbd1da6[0x0][_0x7990('0x4f')];var _0xca68df=(_0xbd1da6[0x0][_0x7990('0x4b')]+_0xbd1da6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xbd1da6[0x0][_0x7990('0x4d')])/_0xbd1da6[0x0][_0x7990('0x4a')];_0x3f5d0b['predictiveIntervalHitRate']=_0xca68df>0x0?_0xca68df:0x1;switch(_0x3f5d0b[_0x7990('0x1d9')]){case'dropRate':var _0x26b7ae=_0x3f5d0b[_0x7990('0x1e6')]/0x64;return _0x2c663c[_0x7990('0x1e7')](_0x4cfff7,_0x57dffd,_0x2d33fd,_0xca68df,_0x26b7ae)[_0x7990('0x3a')](function(_0x153949){return _0x15bb18(_0x153949);});case _0x7990('0x1e8'):var _0x557fbd=_0x3f5d0b[_0x7990('0x1e6')]/0x64;return _0x2c663c['busyFactor'](_0x4cfff7,_0x57dffd,_0x2d33fd,_0xca68df,_0x557fbd)[_0x7990('0x3a')](function(_0x2f032f){return _0x15bb18(_0x2f032f);});default:return _0x568855(msgResponse('[getDataPredictive]',_0x7990('0x92'),'Unknown\x20Predictive'));}}else{return _0x568855(msgResponse(_0x7990('0x1e9'),_0x7990('0x92'),'check\x20failure'));}});};};Dialer[_0x7990('0x84')]['getDataPredictiveOld']=function(_0x48e3c2){var _0x2816ae=this;return function(_0x117b61){return new Promise(function(_0x66a2e3,_0xa154f4){_[_0x7990('0x100')](_0x48e3c2,_0x117b61[0x0]);if(checkGetDataPredictive(_0x117b61[0x0])){loggerPredictive[_0x7990('0x48')](JSON[_0x7990('0x76')](_0x117b61[0x0]));if(_0x48e3c2[_0x7990('0x1d9')]===_0x7990('0x1d7')){return _0x2816ae[_0x7990('0x1ea')](_0x48e3c2['id'])[_0x7990('0x3a')](function(_0xd13e47){var _0x317a83=_0x48e3c2['loggedIn']-_0xd13e47[0x0][_0x7990('0x1eb')];var _0x246b72=_0x48e3c2[_0x7990('0x1d6')]*0x3c;var _0x9c7210=_0x117b61[0x0]['predictiveIntervalAvgTalktime']+_0x117b61[0x0][_0x7990('0x4f')];var _0x3310ff=(_0x117b61[0x0][_0x7990('0x4b')]+_0x117b61[0x0][_0x7990('0x4c')]+_0x117b61[0x0][_0x7990('0x4d')])/_0x117b61[0x0]['predictiveIntervalTotalCalls'];var _0x591d83=_0x48e3c2['dialPredictiveOptimizationPercentage']/0x64;_0x48e3c2['predictiveIntervalPauses']=_0xd13e47[0x0][_0x7990('0x1eb')]||0x0;_0x48e3c2['predictiveIntervalHitRate']=_0x3310ff>0x0?_0x3310ff:0x1;return _0x2816ae['abandonmentRate'](_0x317a83,_0x246b72,_0x9c7210,_0x3310ff,_0x591d83);})[_0x7990('0x3a')](function(_0x5be2ad){return _0x66a2e3(_0x5be2ad);})['catch'](function(_0x4f6b79){return _0xa154f4(msgResponse(_0x7990('0x1ec'),_0x7990('0x92'),JSON[_0x7990('0x76')](_0x4f6b79)));});}if(_0x48e3c2[_0x7990('0x1d9')]===_0x7990('0x1e8')){return _0x2816ae[_0x7990('0x1ea')](_0x48e3c2['id'])[_0x7990('0x3a')](function(_0x212aa1){var _0x51d8d3=_0x48e3c2['loggedIn']-_0x212aa1[0x0]['outboundQueuePauses'];var _0x2848c2=_0x48e3c2[_0x7990('0x1d6')]*0x3c;var _0x26cdd1=_0x117b61[0x0][_0x7990('0x51')]+_0x117b61[0x0][_0x7990('0x4f')];var _0x5edd9b=(_0x117b61[0x0][_0x7990('0x4b')]+_0x117b61[0x0][_0x7990('0x4c')]+_0x117b61[0x0][_0x7990('0x4d')])/_0x117b61[0x0][_0x7990('0x4a')];var _0x13307a=_0x48e3c2['dialPredictiveOptimizationPercentage']/0x64;_0x48e3c2[_0x7990('0x1ed')]=_0x212aa1[0x0]['outboundQueuePauses']||0x0;_0x48e3c2['predictiveIntervalHitRate']=_0x5edd9b>0x0?_0x5edd9b:0x1;return _0x2816ae[_0x7990('0x1ee')](_0x51d8d3,_0x2848c2,_0x26cdd1,_0x5edd9b,_0x13307a);})[_0x7990('0x3a')](function(_0x4115cc){return _0x66a2e3(_0x4115cc);})['catch'](function(_0x432a5a){return _0xa154f4(msgResponse('[CatchErlangB]',_0x7990('0x92'),JSON[_0x7990('0x76')](_0x432a5a)));});}}else{return _0xa154f4(msgResponse(_0x7990('0x1e9'),_0x7990('0x92'),_0x7990('0x1ef')));}});};};Dialer[_0x7990('0x84')][_0x7990('0x1df')]=function(_0x1f0321){var _0x21b195=this;return function(){var _0x4262cd=0x0;var _0x413526=Math[_0x7990('0x1cf')](_0x1f0321['erlangCallToSecond']*0x3e8);if(_0x413526>0x0){_0x413526=_0x413526<0x64?0x64:_0x413526;loggerPredictive[_0x7990('0x48')](_0x1f0321[_0x7990('0x44')],_0x7990('0x1f0'),_0x413526,_0x7990('0x1f1'));_0x1f0321['handlePredictive']=setInterval(function(){_0x21b195['handlePredictive'](_0x1f0321);loggerPredictiveCalls['info'](_0x7990('0x1f2'),_0x4262cd+=0x1);},_0x413526);}else{loggerPredictive[_0x7990('0x48')](_0x1f0321[_0x7990('0x44')],_0x7990('0x1f3'));}};};Dialer['prototype'][_0x7990('0x1f4')]=function(_0x3829b0,_0x24bb30){var _0x4445c6=this;return function(_0x315ef3){if(_[_0x7990('0x46')](_0x315ef3)){if(_[_0x7990('0xfe')](_0x24bb30[_0x7990('0x161')])||!_0x24bb30[_0x7990('0x1f5')]){if(_0x3829b0[_0x7990('0xb1')]===_0x7990('0xb5')){_0x3829b0[_0x7990('0x73')]=_[_0x7990('0x3c')](_0x3829b0['queueStatusComplete'])?!![]:_0x3829b0[_0x7990('0x73')];var _0x2972a3=uuid['v4']();_0x4445c6[_0x7990('0xf4')][_0x2972a3]=new Action(_0x3829b0,_0x24bb30,_0x2972a3);loggerBooked['info']('[booked][checkContactBlack]',_0x2972a3,_0x7990('0x1f6'),JSON[_0x7990('0x76')](_0x3829b0['queueStatusComplete']),_0x7990('0x1f7'),_0x3829b0[_0x7990('0x44')]);if(_0x3829b0['queueStatusComplete']){_0x3829b0['queueStatusComplete']=![];_0x4445c6['queueBooked'][_0x4445c6[_0x7990('0xf4')][_0x2972a3][_0x7990('0xc4')]]=[];ami[_0x7990('0x9a')]({'actionid':_0x2972a3,'action':_0x7990('0x1f8'),'queue':_0x3829b0[_0x7990('0x44')]})[_0x7990('0xa1')](function(){_0x4445c6[_0x7990('0xd1')](_0x3829b0);hopperUtils[_0x7990('0xe2')]({'active':![],'ContactId':_0x4445c6[_0x7990('0xf4')][_0x2972a3]['ContactId'],'ListId':_0x4445c6['actions'][_0x2972a3][_0x7990('0xe5')],'VoiceQueueId':_0x4445c6[_0x7990('0xf4')][_0x2972a3]['VoiceQueueId']||undefined,'CampaignId':_0x4445c6[_0x7990('0xf4')][_0x2972a3][_0x7990('0xe7')]||undefined})['catch'](loggerCatch(_0x7990('0x1f9')));delete _0x4445c6['actions'][_0x2972a3];});}else{loggerBooked[_0x7990('0x48')](_0x7990('0x1fa'),JSON[_0x7990('0x76')](_0x3829b0[_0x7990('0x73')]),_0x7990('0x1f7'),_0x3829b0[_0x7990('0x44')]);_0x4445c6['updateOriginated'](_0x3829b0);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4445c6[_0x7990('0xf4')][_0x2972a3]['ContactId'],'ListId':_0x4445c6[_0x7990('0xf4')][_0x2972a3]['ListId'],'VoiceQueueId':_0x4445c6['actions'][_0x2972a3]['VoiceQueueId']||undefined,'CampaignId':_0x4445c6[_0x7990('0xf4')][_0x2972a3][_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x1f9')));delete _0x4445c6['actions'][_0x2972a3];}}else{return _0x4445c6[_0x7990('0x1fb')](_0x3829b0,_0x24bb30);}}else{if(utils['getSeconds'](undefined,_0x24bb30[_0x7990('0x1fc')])<_0x3829b0[_0x7990('0x1fd')]*0x3c){if(_0x24bb30[_0x7990('0x150')]&&!_0x24bb30[_0x7990('0x150')][_0x7990('0x1fe')]){_0x4445c6[_0x7990('0x1d')][_0x7990('0x107')](_0x24bb30['id'])[_0x7990('0x1b')](function(){_0x4445c6['updateOriginated'](_0x3829b0);});}else{hopperUtils['unlockContact']({'active':![]},_0x24bb30['id'],0x1)[_0x7990('0x1b')](function(){_0x4445c6['updateOriginated'](_0x3829b0);});}}else{_0x3829b0[_0x7990('0x1ff')]+=0x1;_0x4445c6[_0x7990('0xd1')](_0x3829b0);if(_0x3829b0['dialRecallInQueue']){hopperUtils[_0x7990('0xe2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x24bb30[_0x7990('0xe4')],'ListId':_0x24bb30[_0x7990('0xe5')],'VoiceQueueId':_0x24bb30['VoiceQueueId']||undefined,'CampaignId':_0x24bb30[_0x7990('0xe7')]||undefined})[_0x7990('0xa1')](loggerCatch(_0x7990('0x200')));hopperUtils[_0x7990('0xcd')](createObjHistory(_0x3829b0,_0x24bb30,utils[_0x7990('0x6c')]['QUEUE_RECALL'],0x17,_0x7990('0x201')))[_0x7990('0xa1')](loggerCatch(_0x7990('0x202')));}else{_0x4445c6[_0x7990('0x11d')](createObjHistory(_0x3829b0,_0x24bb30,utils[_0x7990('0x6c')][_0x7990('0x203')],0x16,_0x7990('0x204')),_0x7990('0x205'),_0x7990('0x206'));}}}}else{_0x3829b0[_0x7990('0x207')]+=0x1;_0x4445c6[_0x7990('0x11d')](createObjHistory(_0x3829b0,_0x24bb30,utils['CAMPAIGN_STATUS'][_0x7990('0x208')],0xd,_0x7990('0x209')),_0x7990('0x20a'),_0x7990('0x20b'));throw _0x7990('0x20c');}};};Dialer[_0x7990('0x84')]['handleIvr']=function(_0x32d764){var _0x1cbd41=this;var _0x51750c=_0x32d764[_0x7990('0x20d')]-_0x32d764[_0x7990('0x15b')];emitCampaignSummary(_0x32d764);if(_0x51750c>0x0&&_0x32d764[_0x7990('0x66')]==0x0){if(_0x51750c>this[_0x7990('0x22')]){_0x51750c=this[_0x7990('0x22')];}_0x32d764['temp']=0x1;hopperUtils[_0x7990('0x20e')](_0x32d764,_0x51750c)['then'](function(_0x565462){_0x32d764[_0x7990('0x66')]=0x0;if(_0x565462){if(!utils[_0x7990('0x20f')](_0x565462)){_0x32d764[_0x7990('0x67')]=utils[_0x7990('0x6c')]['NO_AVAILABLE_CONTACTS'];logger[_0x7990('0x48')]('[getContactCampaign2][Empty]'+_0x32d764[_0x7990('0x44')]);}else{_0x32d764[_0x7990('0x15b')]+=_0x565462[_0x7990('0x98')];_0x32d764[_0x7990('0x67')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x16dd39=0x0;_0x16dd39<_0x565462[_0x7990('0x98')];_0x16dd39+=0x1){_0x32d764[_0x7990('0x210')]+=0x1;if(_[_0x7990('0xfe')](_0x565462[_0x16dd39])||_[_0x7990('0xfe')](_0x565462[_0x16dd39][_0x7990('0x180')])||_[_0x7990('0xfe')](_0x565462[_0x16dd39][_0x7990('0x168')])){_0x1cbd41[_0x7990('0x15f')](_0x7990('0x211'),_0x32d764,_0x565462[_0x16dd39]);}else{hopperUtils[_0x7990('0x212')](_[_0x7990('0x77')](_0x565462[_0x16dd39],[_0x7990('0xe7'),_0x7990('0x168')]))['then'](_0x1cbd41[_0x7990('0x1f4')](_0x32d764,_0x565462[_0x16dd39]))[_0x7990('0xa1')](_0x1cbd41[_0x7990('0x15e')](_0x7990('0x213'),_0x32d764));}}}}})[_0x7990('0xa1')](loggerGetContactDialer('[getContactCampaign2]',_0x32d764,_0x51750c));}};Dialer[_0x7990('0x84')][_0x7990('0xb2')]=function(_0x26d9c1,_0x454364){var _0x1266a5=this;var _0x46acb5=[];if(_0x454364<0x1||_0x26d9c1[_0x7990('0xb1')]==='booked'){_0x454364=0x1;}var _0x1898a1=Math[_0x7990('0x1cf')](_0x26d9c1[_0x7990('0x143')]*_0x454364)-_0x26d9c1[_0x7990('0x15b')];if(_0x26d9c1['dialLimitQueue']>0x0){var _0x2ceab3=_0x26d9c1[_0x7990('0x214')]-_0x26d9c1[_0x7990('0x15b')]-_0x26d9c1[_0x7990('0x145')]-_0x26d9c1[_0x7990('0x146')];if(_0x1898a1>_0x2ceab3){_0x1898a1=_0x2ceab3;}}if(_0x1898a1>0x0&&_0x26d9c1[_0x7990('0x66')]==0x0){if(_0x26d9c1[_0x7990('0xb1')]===_0x7990('0xb5')){_0x1898a1=0x1;}if(_0x1898a1>this[_0x7990('0x22')]){_0x1898a1=this[_0x7990('0x22')];}for(var _0x2a8fd6 in this[_0x7990('0x20')]){if(typeof this[_0x7990('0x20')][_0x2a8fd6]!==_0x7990('0xaa')){if(this['agents'][_0x2a8fd6]['state']==='not_inuse'&&this[_0x7990('0x20')][_0x2a8fd6][_0x7990('0x88')]===_0x7990('0x89')){_0x46acb5[_0x7990('0x99')](this[_0x7990('0x20')][_0x2a8fd6]['id']);}}}_0x26d9c1[_0x7990('0x66')]=0x1;hopperUtils['getContactDialer'](_0x26d9c1,_0x46acb5,_0x1898a1)[_0x7990('0x3a')](function(_0x18b1aa){_0x26d9c1[_0x7990('0x66')]=0x0;if(_0x18b1aa){if(!utils[_0x7990('0x20f')](_0x18b1aa)){hopperUtils[_0x7990('0x215')](_0x26d9c1)[_0x7990('0x3a')](sendMessageReschedule(_0x26d9c1))[_0x7990('0xa1')](loggerCatch(_0x7990('0x216')));}else{_0x26d9c1[_0x7990('0x15b')]+=_0x18b1aa['length'];_0x26d9c1[_0x7990('0x67')]=_0x26d9c1['dialMethod']==='booked'?utils[_0x7990('0x6c')][_0x7990('0x147')]:utils[_0x7990('0x6c')][_0x7990('0x217')];for(var _0x134660=0x0;_0x134660<_0x18b1aa[_0x7990('0x98')];_0x134660+=0x1){if(_['isNil'](_0x18b1aa[_0x134660])||_[_0x7990('0xfe')](_0x18b1aa[_0x134660]['Contact'])||_[_0x7990('0xfe')](_0x18b1aa[_0x134660][_0x7990('0x168')])){_0x1266a5[_0x7990('0x15f')]('[actionOriginate]\x20',_0x26d9c1,_0x18b1aa[_0x134660]);}else{hopperUtils[_0x7990('0x218')](_[_0x7990('0x77')](_0x18b1aa[_0x134660],[_0x7990('0xe6'),_0x7990('0x168')]))[_0x7990('0x3a')](_0x1266a5[_0x7990('0x1f4')](_0x26d9c1,_0x18b1aa[_0x134660]))[_0x7990('0xa1')](_0x1266a5[_0x7990('0x15e')](_0x7990('0x211'),_0x26d9c1));}}}}})[_0x7990('0xa1')](loggerGetContactDialer(_0x7990('0x219'),_0x26d9c1,_0x1898a1));}};Dialer[_0x7990('0x84')][_0x7990('0x61')]=function(_0x3ac9a3){if(_0x3ac9a3['dialLimitQueue']>0x0){var _0x27a695=_0x3ac9a3[_0x7990('0x214')]-_0x3ac9a3['originated']-_0x3ac9a3[_0x7990('0x145')];if(_0x27a695>0x0&&_0x3ac9a3[_0x7990('0x66')]==0x0){this['tryOriginatePredictive'](_0x3ac9a3);}else{loggerPredictiveCalls[_0x7990('0x48')](_0x7990('0x21a'));}}else{this[_0x7990('0x21b')](_0x3ac9a3);}};Dialer[_0x7990('0x84')][_0x7990('0x21b')]=function(_0x205ab1){var _0x120f98=this;var _0x70dab3=[];_0x205ab1[_0x7990('0x15b')]+=0x1;for(var _0x5cf1c4 in this[_0x7990('0x20')]){if(typeof this['agents'][_0x5cf1c4]!=='undefined'){if(this[_0x7990('0x20')][_0x5cf1c4]['state']===_0x7990('0x21c')&&this[_0x7990('0x20')][_0x5cf1c4][_0x7990('0x88')]===_0x7990('0x89')){_0x70dab3[_0x7990('0x99')](this[_0x7990('0x20')][_0x5cf1c4]['id']);}}}_0x205ab1['temp']=0x1;return this[_0x7990('0x21d')](_0x205ab1['id'],_0x70dab3,0x1,_0x205ab1[_0x7990('0x21e')],_0x205ab1)[_0x7990('0x3a')](function(_0x59e291){_0x205ab1['temp']=0x1;if(_0x59e291){if(!utils[_0x7990('0x20f')](_0x59e291)){utils[_0x7990('0x65')](_0x205ab1,0x1,0x0);return hopperUtils[_0x7990('0x215')](_0x205ab1)[_0x7990('0x3a')](sendMessageReschedule(_0x205ab1))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x205ab1[_0x7990('0x67')]=utils[_0x7990('0x6c')][_0x7990('0x217')];if(_[_0x7990('0xfe')](_0x59e291[0x0])||_[_0x7990('0xfe')](_0x59e291[0x0][_0x7990('0x180')])||_['isNil'](_0x59e291[0x0][_0x7990('0x168')])){_0x120f98[_0x7990('0x15f')]('[actionOriginate]\x20',_0x205ab1,_0x59e291[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x7990('0x77')](_0x59e291[0x0],[_0x7990('0xe6'),_0x7990('0x168')]))['then'](_0x120f98[_0x7990('0x1f4')](_0x205ab1,_0x59e291[0x0]))[_0x7990('0xa1')](_0x120f98[_0x7990('0x15e')]('[actionOriginatePredictive]\x20',_0x205ab1));}}}})[_0x7990('0xa1')](loggerGetContactDialer(_0x7990('0x21f'),_0x205ab1,0x1));};Dialer[_0x7990('0x84')][_0x7990('0x1e7')]=function(_0xe3d275,_0x59cb02,_0x377929,_0x4d3cd2,_0x30518e,_0x2428a8){loggerPredictive[_0x7990('0x48')](_0x7990('0x220'));loggerPredictive[_0x7990('0x48')]('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',_0xe3d275);loggerPredictive[_0x7990('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59cb02);loggerPredictive[_0x7990('0x48')]('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',_0x377929);loggerPredictive['info'](_0x7990('0x221'),_0x4d3cd2);loggerPredictive[_0x7990('0x48')](_0x7990('0x222'),_0x30518e);loggerPredictive['info'](_0x7990('0x52'));return new Promise(function(_0x38a141,_0x325956){if(_0xe3d275<=0x0||isNaN(_0xe3d275)){return _0x325956(msgResponse(_0x7990('0x223'),_0x7990('0x83'),_0x7990('0x224')+_0xe3d275));}if(_0x377929<=0x0||isNaN(_0x377929)){return _0x325956(msgResponse(_0x7990('0x223'),_0x7990('0x83'),'Ts\x20=\x20'+_0x377929));}if(_0x4d3cd2<=0x0||isNaN(_0x4d3cd2)){return _0x325956(msgResponse(_0x7990('0x223'),_0x7990('0x83'),_0x7990('0x225')+_0x4d3cd2));}if(_0x59cb02<=0x0||isNaN(_0x59cb02)){return _0x325956(msgResponse(_0x7990('0x223'),_0x7990('0x83'),_0x7990('0x226')+_0x59cb02));}if(_0x30518e<=0x0||isNaN(_0x30518e)){return _0x325956(msgResponse(_0x7990('0x223'),_0x7990('0x83'),_0x7990('0x227')+_0x30518e));}_0x2428a8=_0x2428a8||0x0;var _0x33c23a=0x1/_0x377929;var _0x3a2f64=0x0;var _0x1e24a8=0x0;var _0x383099=0x0;var _0x55f7ec=0x0;for(var _0x1c7db9=0x0;_0x383099<_0x30518e;_0x1c7db9+=0x1){_0x1e24a8=_0x1c7db9/_0x59cb02;_0x3a2f64=(_0x4d3cd2*_0x1e24a8+_0x2428a8)/_0x33c23a;_0x383099=utils[_0x7990('0x228')](_0x3a2f64,_0xe3d275);_0x55f7ec=_0x3a2f64/_0xe3d275*(0x1-utils['erlangb'](_0x3a2f64,_0xe3d275));}return _0x38a141({'erlangCalls':_0x1c7db9,'erlangCallToSecond':_0x59cb02/_0x1c7db9,'erlangAbandonmentRate':_0x383099,'erlangBusyFactor':_0x55f7ec});});};Dialer[_0x7990('0x84')]['busyFactor']=function(_0x43ae7a,_0x41efa0,_0x2feca1,_0x141ee7,_0x114d91,_0x248e9a){loggerPredictive['info'](_0x7990('0x229'));loggerPredictive[_0x7990('0x48')]('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',_0x43ae7a);loggerPredictive[_0x7990('0x48')](_0x7990('0x22a'),_0x41efa0);loggerPredictive[_0x7990('0x48')](_0x7990('0x22b'),_0x2feca1);loggerPredictive[_0x7990('0x48')](_0x7990('0x221'),_0x141ee7);loggerPredictive[_0x7990('0x48')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x114d91);loggerPredictive['info']('---------------------------');return new Promise(function(_0x5c250c,_0xd7c95b){if(_0x43ae7a<=0x0||isNaN(_0x43ae7a)){return _0xd7c95b(msgResponse(_0x7990('0x22c'),'Error',_0x7990('0x224')+_0x43ae7a));}if(_0x2feca1<=0x0||isNaN(_0x2feca1)){return _0xd7c95b(msgResponse(_0x7990('0x22c'),'Error',_0x7990('0x22d')+_0x2feca1));}if(_0x141ee7<=0x0||isNaN(_0x141ee7)){return _0xd7c95b(msgResponse(_0x7990('0x22c'),_0x7990('0x83'),'p\x20=\x20'+_0x141ee7));}if(_0x41efa0<=0x0||isNaN(_0x41efa0)){return _0xd7c95b(msgResponse(_0x7990('0x22c'),_0x7990('0x83'),_0x7990('0x226')+_0x41efa0));}if(_0x114d91<=0x0||isNaN(_0x114d91)){return _0xd7c95b(msgResponse(_0x7990('0x22c'),_0x7990('0x83'),_0x7990('0x22e')+_0x114d91));}_0x248e9a=_0x248e9a||0x0;var _0x88d158=0x1/_0x2feca1;var _0x4b78f3=0x0;var _0x1bd616=0x0;var _0x5c0af3=0x0;var _0x4df141=0x0;for(var _0x4bb2e9=0x0;_0x4df141<_0x114d91;_0x4bb2e9+=0x1){_0x1bd616=_0x4bb2e9/_0x41efa0;_0x4b78f3=(_0x141ee7*_0x1bd616+_0x248e9a)/_0x88d158;_0x5c0af3=utils[_0x7990('0x228')](_0x4b78f3,_0x43ae7a);_0x4df141=_0x4b78f3/_0x43ae7a*(0x1-utils[_0x7990('0x228')](_0x4b78f3,_0x43ae7a));}return _0x5c250c({'erlangCalls':_0x4bb2e9,'erlangCallToSecond':_0x41efa0/_0x4bb2e9,'erlangAbandonmentRate':_0x5c0af3,'erlangBusyFactor':_0x4df141});});};module[_0x7990('0x22f')]=Dialer; \ No newline at end of file +var _0x9a1a=['voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','isTrunkReachable','active','reachable','status','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','Intervals','ifTime','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','Action','command','content','indexOf','true','push','iftime\x20%s,%s','catch','all','some','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls','undefined','resolve','checkIfTime','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','stateinterface','idHopper','paused','strategy','roundrobin','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','pick','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','amd','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','value','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','assign','Trunk','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','createStateFinal','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','talking','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','inspect','format','voice:queue:%s','name'];(function(_0x3f6fd7,_0xcedd75){var _0xe580e7=function(_0x2b4102){while(--_0x2b4102){_0x3f6fd7['push'](_0x3f6fd7['shift']());}};_0xe580e7(++_0xcedd75);}(_0x9a1a,0x1d9));var _0xa9a1=function(_0x2df370,_0x47464a){_0x2df370=_0x2df370-0x0;var _0x48961a=_0x9a1a[_0x2df370];return _0x48961a;};'use strict';var util=require(_0xa9a1('0x0'));var _=require(_0xa9a1('0x1'));var uuid=require(_0xa9a1('0x2'));var moment=require(_0xa9a1('0x3'));var rr=require('rr');var Redis=require(_0xa9a1('0x4'));var utils=require('./utils');var hopperUtils=require(_0xa9a1('0x5'));var ut=require(_0xa9a1('0x6'));var config=require(_0xa9a1('0x7'));var logger=require(_0xa9a1('0x8'))(_0xa9a1('0x9'));var loggerBooked=require(_0xa9a1('0x8'))('booked');var loggerPredictive=require(_0xa9a1('0x8'))(_0xa9a1('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xa9a1('0xb'));var loggerSyncQueueSummary=require(_0xa9a1('0x8'))(_0xa9a1('0xc'));var ami=require(_0xa9a1('0xd'));config[_0xa9a1('0xe')]=_[_0xa9a1('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa9a1('0x10'))(new Redis(config[_0xa9a1('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xa9a1('0x11'));var RpcSetting=require(_0xa9a1('0x12'));var Interval=require(_0xa9a1('0x13'));var Action=require('./models/action');var History=require(_0xa9a1('0x14'));var Final=require(_0xa9a1('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xa9a1('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0xa9a1('0x17')][_0xa9a1('0x18')]||_0xa9a1('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa9a1('0x1a')][_0xa9a1('0x1b')]=function(_0x13bbfb){this['tail']=this['tail']?this[_0xa9a1('0x1c')][_0xa9a1('0x1d')](_0x13bbfb):_0x13bbfb();};function Dialer(_0x1c41e4,_0x5db591){this[_0xa9a1('0x1e')]=new Sequence();this['preview']=_0x5db591;this[_0xa9a1('0x1f')]=_0x1c41e4['voiceQueues'];this[_0xa9a1('0x20')]=_0x1c41e4['campaigns'];this[_0xa9a1('0x21')]=_0x1c41e4['agents'];this[_0xa9a1('0x22')]=_0x1c41e4[_0xa9a1('0x22')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xa9a1('0x23')]={};this[_0xa9a1('0x24')]={};this[_0xa9a1('0x25')]={};this[_0xa9a1('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this[_0xa9a1('0x27')]={};this[_0xa9a1('0x28')]={};this[_0xa9a1('0x29')]={};this[_0xa9a1('0x2a')]={};this[_0xa9a1('0x2b')]={};ami['on'](_0xa9a1('0x2c'),this[_0xa9a1('0x2d')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x2f'),this[_0xa9a1('0x30')][_0xa9a1('0x2e')](this));ami['on']('originateresponse',this[_0xa9a1('0x31')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x32'),this[_0xa9a1('0x33')]['bind'](this));ami['on'](_0xa9a1('0x34'),this['syncQueueSummary'][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x35'),this[_0xa9a1('0x36')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x37'),this[_0xa9a1('0x38')]['bind'](this));ami['on']('newexten',this[_0xa9a1('0x39')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3a'),this['syncVarSet'][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3b'),this[_0xa9a1('0x3c')][_0xa9a1('0x2e')](this));ami['on'](_0xa9a1('0x3d'),this[_0xa9a1('0x3e')][_0xa9a1('0x2e')](this));this[_0xa9a1('0x3f')]();this[_0xa9a1('0x40')]();RpcSetting[_0xa9a1('0x41')]()[_0xa9a1('0x42')](function(_0x4a609a){previewRecallmeReminderInterval=_0x4a609a[_0xa9a1('0x43')];});}function isNotNull(_0x2279d1){return _0x2279d1!==null&&!_['isUndefined'](_0x2279d1);}function msgResponse(_0x266009,_0x5c2a7f,_0x42403a){return{'action':_0x266009,'response':_0x5c2a7f,'message':_0x42403a,'stack':_0x42403a};}function emit(_0x4e775c,_0x598095,_0x133206){io['to'](_0x4e775c)[_0xa9a1('0x44')](_0x598095,_0x133206);}function emitOutboundVoiceQueueSummary(_0x4d656b){if(_0x4d656b[_0xa9a1('0x45')]===_0xa9a1('0x46')){logger[_0xa9a1('0x47')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xa9a1('0x48')](_0x4d656b,{'showHidden':![],'depth':null}));emit(util[_0xa9a1('0x49')](_0xa9a1('0x4a'),_0x4d656b[_0xa9a1('0x4b')]),_0xa9a1('0x4c'),_0x4d656b);}}function checkGetDataPredictive(_0x19cc87){if(isNotNull(_0x19cc87)&&!_[_0xa9a1('0x4d')](_0x19cc87)){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x4f'));loggerPredictive[_0xa9a1('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19cc87[_0xa9a1('0x50')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x51'),_0x19cc87[_0xa9a1('0x52')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x53'),_0x19cc87[_0xa9a1('0x54')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x55'),_0x19cc87[_0xa9a1('0x56')]);loggerPredictive[_0xa9a1('0x4e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19cc87[_0xa9a1('0x57')]);loggerPredictive['info'](_0xa9a1('0x58'),_0x19cc87[_0xa9a1('0x59')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));if(_0x19cc87[_0xa9a1('0x50')]>0x0){if(!_[_0xa9a1('0x5b')](_0x19cc87[_0xa9a1('0x59')])&&_0x19cc87[_0xa9a1('0x59')]>0x0){return!![];}loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5c'));if(!_[_0xa9a1('0x5b')](_0x19cc87['predictiveIntervalAvgHoldtime'])&&_0x19cc87[_0xa9a1('0x57')]>0x0){return!![];}loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5d'));}else{loggerPredictive['info'](_0xa9a1('0x5e'));}}else{loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5f'));}return![];}function mergeDataErlangB(_0x2f6121){return function(_0x2fad61){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x60'));loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x61'),_0x2fad61['erlangCalls']);loggerPredictive[_0xa9a1('0x4e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2fad61['erlangCallToSecond']);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x62'),_0x2fad61[_0xa9a1('0x63')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x64'),_0x2fad61[_0xa9a1('0x65')]);loggerPredictive['info'](_0xa9a1('0x62'),_0x2fad61[_0xa9a1('0x63')]);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));_[_0xa9a1('0x66')](_0x2f6121,_0x2fad61);};}function ifInterval(_0x3b21d7,_0x417885){if(_[_0xa9a1('0x5b')](_0x417885)){return![];}return utils[_0xa9a1('0x67')](undefined,_0x417885)<_0x3b21d7*0x3c;}function clearPredictiveAttributes(_0x4eff51){if(_0x4eff51[_0xa9a1('0x27')]){_0x4eff51[_0xa9a1('0x27')]=undefined;loggerPredictive[_0xa9a1('0x47')](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x68'));}if(_0x4eff51[_0xa9a1('0x69')]){_0x4eff51[_0xa9a1('0x69')]=undefined;loggerPredictive[_0xa9a1('0x47')](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x6a'));}if(_0x4eff51[_0xa9a1('0x6b')]){clearInterval(_0x4eff51[_0xa9a1('0x6b')]);_0x4eff51[_0xa9a1('0x6b')]=undefined;loggerPredictive['debug'](_0x4eff51[_0xa9a1('0x4b')],_0xa9a1('0x6c'));}}function loggerCatchPredictive(_0x54dfd3,_0x2227cf){return function(_0x15f868){loggerPredictive[_0xa9a1('0x6d')](_0x2227cf['name'],_0x54dfd3);loggerPredictive[_0xa9a1('0x6d')](_0x15f868[_0xa9a1('0x6e')]);clearPredictiveAttributes(_0x2227cf);};}function loggerCatch(_0x3d7c19){return function(_0x355451){logger[_0xa9a1('0x6d')](_0x3d7c19,util[_0xa9a1('0x48')](_0x355451,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x19a296,_0x348ac9,_0x2d0af4){return function(_0x354cf9){utils[_0xa9a1('0x6f')](_0x348ac9,_0x2d0af4,0x0);_0x348ac9[_0xa9a1('0x70')]=0x0;logger[_0xa9a1('0x6d')](_0x19a296,util[_0xa9a1('0x48')](_0x354cf9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e0e2d){return function(_0x39a0e4){if(isNotNull(_0x39a0e4)&&isNotNull(_0x39a0e4[0x0])){if(_0x39a0e4[0x0][_0xa9a1('0x71')]>0x0){_0x3e0e2d[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x74')];logger[_0xa9a1('0x4e')](_0xa9a1('0x75')+_0x3e0e2d[_0xa9a1('0x4b')],_0x39a0e4[0x0][_0xa9a1('0x71')],_0xa9a1('0x76'));}else{_0x3e0e2d['message']=utils[_0xa9a1('0x73')]['NO_AVAILABLE_CONTACTS'];logger[_0xa9a1('0x4e')](_0xa9a1('0x77')+_0x3e0e2d[_0xa9a1('0x4b')]);}}};}function createObjHistory(_0x365112,_0x28ccf9,_0x1c0240,_0x5262cc,_0x2a2ea3){_0x365112[_0xa9a1('0x72')]=_0x1c0240;var _0x5f2f13=new Action(_0x365112,_0x28ccf9);var _0xd47f5=new History(_0x5f2f13);_0xd47f5[_0xa9a1('0x78')]=_0x5262cc;_0xd47f5['statedesc']=_0x2a2ea3;_0xd47f5[_0xa9a1('0x79')]=_0x5f2f13[_0xa9a1('0x7a')];return _0xd47f5;}function unlockQueueStatus(_0xd7ec52,_0x498332){setTimeout(function(){if(_['isUndefined'](_0xd7ec52[_0xa9a1('0x7b')])){loggerBooked[_0xa9a1('0x6d')](_0xa9a1('0x7c'),_0x498332);}_0xd7ec52['queueStatusComplete']=!![];loggerBooked[_0xa9a1('0x4e')](_0xa9a1('0x7d'),_0x498332,JSON[_0xa9a1('0x7e')](_['pick'](_0xd7ec52,[_0xa9a1('0x4b'),_0xa9a1('0x7b')])));},0x1f3);}function checkInterval(_0x382c36){return function(){if(!isNotNull(_0x382c36[_0xa9a1('0x7f')])){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['NULL_INTERVAL'];throw _0x382c36['name']+_0xa9a1('0x80');}if(!isNotNull(_0x382c36['Interval']['Intervals'])){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['NULL_INTERVAL'];throw _0x382c36[_0xa9a1('0x4b')]+_0xa9a1('0x80');}if(!isNotNull(_[_0xa9a1('0x4d')](_0x382c36[_0xa9a1('0x7f')]['Intervals']))){_0x382c36[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x81')];throw _0x382c36['name']+_0xa9a1('0x80');}};}function checkIsIVRCampaignActive(_0x688d07){return function(){if(!utils[_0xa9a1('0x82')](_0x688d07)){_0x688d07[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['INACTIVE'];throw _0x688d07[_0xa9a1('0x4b')]+_0xa9a1('0x83');}};}function emitCampaignSummary(_0x596cb5){if(utils[_0xa9a1('0x84')](_0x596cb5)){emit(util[_0xa9a1('0x49')](_0xa9a1('0x85'),_0x596cb5['name']),'campaign:save',_0x596cb5);}}function loggerCatchQueueSummary(_0x28f2ab,_0x410ff5){return function(_0x23e32d){clearPredictiveAttributes(_0x410ff5);emitCampaignSummary(_0x410ff5);loggerSyncQueueSummary[_0xa9a1('0x47')](_0x28f2ab,util['inspect'](_0x23e32d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x559439){if(_0x559439[_0xa9a1('0x86')]){if(_0x559439[_0xa9a1('0x87')]===0x0){_0x559439[_0xa9a1('0x86')]=![];_0x559439[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x88')];loggerSyncQueueSummary[_0xa9a1('0x47')](_0xa9a1('0x89'),_0x559439[_0xa9a1('0x4b')],_0xa9a1('0x8a'));}else{_0x559439[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x8b')];loggerSyncQueueSummary[_0xa9a1('0x47')](_0xa9a1('0x89'),_0x559439['name'],_0xa9a1('0x8c'));}emitCampaignSummary(_0x559439);}}function myreject(_0x872318){return function(_0x4add52){return _0x872318(msgResponse('[ifTime][Action]',_0xa9a1('0x8d'),JSON[_0xa9a1('0x7e')](_0x4add52)));};}Dialer[_0xa9a1('0x1a')][_0xa9a1('0x8e')]=function(_0x1b7e8f){return!_['isUndefined'](_0x1b7e8f)&&_0x1b7e8f&&!_['isUndefined'](_0x1b7e8f[_0xa9a1('0x4b')])&&!_[_0xa9a1('0x5b')](_0x1b7e8f[_0xa9a1('0x8f')])&&_0x1b7e8f[_0xa9a1('0x8f')]&&(this[_0xa9a1('0x22')][util['format']('SIP/%s',_0x1b7e8f[_0xa9a1('0x4b')])]['status']===_0xa9a1('0x90')||this['trunks'][util[_0xa9a1('0x49')]('SIP/%s',_0x1b7e8f['name'])][_0xa9a1('0x91')]===_0xa9a1('0x92'));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x93')]=function(_0x3bd074){var _0x2010cd=this;return function(){if(!_0x2010cd[_0xa9a1('0x8e')](_0x3bd074['Trunk'])){if(!_0x2010cd[_0xa9a1('0x8e')](_0x3bd074[_0xa9a1('0x94')])){_0x3bd074[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['TRUNK_NOT_REACHABLE'];throw _0x3bd074[_0xa9a1('0x4b')]+_0xa9a1('0x95');}}};};Dialer[_0xa9a1('0x1a')]['checkIfTime']=function(_0x259d5c,_0x349591,_0x55aaca,_0x39314d){var _0x3a38cb=this;return function(){var _0x54bd58=!![];return _0x3a38cb[_0xa9a1('0x96')](_0x259d5c,_0x349591,_0x55aaca,_0x39314d,_0x54bd58);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x97')]=function(_0xf81ec5,_0x5d50f0,_0x26586e,_0x5ce307){var _0x3715ce=this;return function(){var _0x561f19=![];return _0x3715ce[_0xa9a1('0x96')](_0xf81ec5[_0xa9a1('0x98')],_0x5d50f0,_0x26586e,_0x5ce307,_0x561f19);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x96')]=function(_0xef13b9,_0x3187c8,_0x345d8f,_0x45a444,_0x3502d0){var _0x428c95=[];return new Promise(function(_0xb7f47f,_0x36dda3){if(!isNotNull(_0xef13b9)){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x81')];return _0x36dda3(msgResponse(_0xa9a1('0x99'),'Failure',_0x345d8f+_0xa9a1('0x9a')));}if(_[_0xa9a1('0x4d')](_0xef13b9)){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')]['EMPTY_INTERVAL'];return _0x36dda3(msgResponse(_0xa9a1('0x99'),'Failure',_0x345d8f+_0xa9a1('0x9b')));}if(_0x3187c8&&_[_0xa9a1('0x5b')](config[_0xa9a1('0x9c')][_0x3187c8])){_0x45a444[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x9d')];return _0x36dda3(msgResponse('ifTime',_0xa9a1('0x9e'),_0x345d8f+_0xa9a1('0x9f')+_0x3187c8));}if(_['isArray'](_0xef13b9)){for(var _0x3d1a0b=0x0;_0x3d1a0b<_0xef13b9['length'];_0x3d1a0b+=0x1){_0x428c95['push'](ami[_0xa9a1('0xa0')]({'action':_0xa9a1('0xa1'),'command':util[_0xa9a1('0x49')]('iftime\x20%s,%s',_0xef13b9[_0x3d1a0b]['interval'],!_[_0xa9a1('0x5b')](config['timezones'][_0x3187c8])?_0x3187c8:'')})['then'](function(_0x43d185){return _0x43d185[_0xa9a1('0xa2')][_0xa9a1('0xa3')](_0xa9a1('0xa4'))>=0x0;})['catch'](myreject(_0x36dda3)));}}else{_0x428c95[_0xa9a1('0xa5')](ami['Action']({'action':_0xa9a1('0xa1'),'command':util[_0xa9a1('0x49')](_0xa9a1('0xa6'),_0xef13b9,!_[_0xa9a1('0x5b')](config[_0xa9a1('0x9c')][_0x3187c8])?_0x3187c8:'')})[_0xa9a1('0x42')](function(_0x422ad1){return _0x422ad1[_0xa9a1('0xa2')]['indexOf'](_0xa9a1('0xa4'))>=0x0;})[_0xa9a1('0xa7')](myreject(_0x36dda3)));}Promise[_0xa9a1('0xa8')](_0x428c95)[_0xa9a1('0x42')](function(_0x4845aa){var _0x5dc419=_[_0xa9a1('0xa9')](_0x4845aa);if(_0x5dc419){return _0xb7f47f(_0x5dc419);}else{_0x45a444[_0xa9a1('0x72')]=_0x3502d0?utils[_0xa9a1('0x73')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xa9a1('0x73')][_0xa9a1('0xaa')];return _0x36dda3(msgResponse('[ifTime][promiseAll]','Failure',_0xa9a1('0xab')+_0x3502d0+'\x20'+_0x345d8f+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa9a1('0x48')](_0xef13b9,{'showHidden':![],'depth':null})+_0xa9a1('0xac')+_0x3187c8));}})['catch'](function(_0x523274){return _0x36dda3(msgResponse(_0xa9a1('0x99'),_0xa9a1('0x9e'),JSON['stringify'](_0x523274)));});});};Dialer['prototype'][_0xa9a1('0x3f')]=function(){var _0x891fcf=this;return cmHopper[_0xa9a1('0xad')]({'active':![]},{'where':{'active':!![]}})[_0xa9a1('0x42')](function(){setInterval(function(){_0x891fcf['syncCampaigns']();},0x3e8);});};Dialer[_0xa9a1('0x1a')]['syncCampaigns']=function(){var _0x88649f=this;var _0x2e394e;for(var _0x585a57 in this['campaigns']){if(typeof this[_0xa9a1('0x20')][_0x585a57]!==_0xa9a1('0xae')){_0x2e394e=this[_0xa9a1('0x20')][_0x585a57];if(utils['isIVRCampaign'](_0x2e394e)&&utils[_0xa9a1('0x82')](_0x2e394e)){_0x2e394e[_0xa9a1('0x86')]=!![];Promise[_0xa9a1('0xaf')]()['then'](checkIsIVRCampaignActive(_0x2e394e))[_0xa9a1('0x42')](checkInterval(_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0x93')](_0x2e394e))['then'](_0x88649f[_0xa9a1('0xb0')](_0x2e394e['dialGlobalInterval'],_0x2e394e[_0xa9a1('0xb1')],_0x2e394e[_0xa9a1('0x4b')],_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0x97')](_0x2e394e['Interval'],_0x2e394e[_0xa9a1('0xb1')],_0x2e394e['name'],_0x2e394e))[_0xa9a1('0x42')](_0x88649f[_0xa9a1('0xb2')](_0x2e394e))[_0xa9a1('0xa7')](loggerCatchQueueSummary(_0xa9a1('0xb3'),_0x2e394e));}else{notSendMessagesCampaign(_0x2e394e);}}}};Dialer[_0xa9a1('0x1a')]['checkDialMethod']=function(_0x460fb5){if(_0x460fb5[_0xa9a1('0xb4')]!=='predictive'){clearPredictiveAttributes(_0x460fb5);}switch(_0x460fb5['dialMethod']){case _0xa9a1('0xb5'):this[_0xa9a1('0xb6')](_0x460fb5,0x1);break;case _0xa9a1('0xb7'):this[_0xa9a1('0xb6')](_0x460fb5,_0x460fb5[_0xa9a1('0xb8')]);break;case _0xa9a1('0xa'):this['predictive'](_0x460fb5);break;case _0xa9a1('0xb9'):this[_0xa9a1('0xb6')](_0x460fb5,0x1);break;default:logger[_0xa9a1('0x6d')](_0xa9a1('0xba'),_0x460fb5[_0xa9a1('0x4b')],_0xa9a1('0xbb'));}};Dialer[_0xa9a1('0x1a')]['ifTime']=function(_0x358dc2,_0x566fb6){var _0x5e56f3=_0x358dc2[_0xa9a1('0xb1')];var _0x1e4208=_0x566fb6?_0x358dc2[_0xa9a1('0xbc')]:_0x358dc2['Interval'][_0xa9a1('0x98')];logger['silly'](_0xa9a1('0xbd'),_0x1e4208,_0x5e56f3,_0x358dc2['name'],util[_0xa9a1('0x49')](_0xa9a1('0xbe'),_0x358dc2['name'],_0x358dc2['id']));var _0x34d966=null;return Interval[_0xa9a1('0xbf')](_0x1e4208,_0x5e56f3)[_0xa9a1('0x42')](function(_0x4cfce8){if(_0x4cfce8===!![]){return _0x4cfce8;}else{_0x358dc2[_0xa9a1('0x72')]=_0x566fb6?utils[_0xa9a1('0x73')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xa9a1('0xaa')];_0x34d966=msgResponse(_0xa9a1('0xc0'),_0xa9a1('0x9e'),_0xa9a1('0xab')+_0x566fb6+'\x20'+_0x358dc2[_0xa9a1('0x4b')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa9a1('0x48')](_0x1e4208,{'showHidden':![],'depth':null})+_0xa9a1('0xac')+_0x5e56f3);}if(_0x34d966!==null){logger[_0xa9a1('0xc1')](_0xa9a1('0xc2'),_0x34d966);_0x34d966[_0xa9a1('0xc3')]=_0x566fb6;throw _0x34d966;}})[_0xa9a1('0xa7')](function(_0x5e889e){logger[_0xa9a1('0x6d')](_0xa9a1('0xc4'),_0x5e889e);throw msgResponse(_0xa9a1('0xc5'),_0xa9a1('0x8d'),util[_0xa9a1('0x48')](_0x5e889e,{'showHidden':![],'depth':null}));});};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x2d')]=function(_0x256cb7){if(this[_0xa9a1('0x1f')][_0x256cb7['queue']]){if(this[_0xa9a1('0x26')][_0x256cb7[_0xa9a1('0xc6')]]&&this[_0xa9a1('0x26')][_0x256cb7['uniqueid']][_0xa9a1('0x45')]!==_0xa9a1('0xc7')){this[_0xa9a1('0xc8')](this[_0xa9a1('0x1f')][_0x256cb7[_0xa9a1('0xc9')]]);this[_0xa9a1('0x26')][_0x256cb7[_0xa9a1('0xc6')]][_0xa9a1('0xca')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));}}};Dialer[_0xa9a1('0x1a')]['syncAgentComplete']=function(_0x26be2f){var _0x5a7b9c=this['uniqueId'][_0x26be2f['uniqueid']];if(this[_0xa9a1('0x1f')][_0x26be2f['queue']]){if(_0x5a7b9c&&_0x5a7b9c[_0xa9a1('0x45')]!==_0xa9a1('0xc7')){delete this['uniqueId'][_0x26be2f['uniqueid']];this[_0xa9a1('0x1f')][_0x26be2f['queue']][_0xa9a1('0xcc')]+=0x1;var _0x38635c=new AgentComplete(_0x5a7b9c,_0x26be2f);if(_0x26be2f[_0xa9a1('0xcd')]===_0xa9a1('0xce')){_0x38635c[_0xa9a1('0xcf')]=this[_0xa9a1('0x1f')][_0x26be2f['queue']][_0xa9a1('0xd0')]&&this['voiceQueues'][_0x26be2f[_0xa9a1('0xc9')]][_0xa9a1('0xd1')]?moment()['format'](_0xa9a1('0xcb')):undefined;}hopperUtils[_0xa9a1('0xd2')](_0x38635c)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xa9a1('0xd3')](_0x38635c)['catch'](loggerCatch(_0xa9a1('0xd4')));}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x30')]=function(_0x30134b){var _0x2615e7=this['uniqueId'][_0x30134b[_0xa9a1('0xc6')]];var _0x1cdab1=this;var _0x13231b=![];var _0x5ccda2;var _0x10c39a;if(this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]){if(_0x2615e7&&_0x2615e7[_0xa9a1('0x45')]!=='ivr'){delete this[_0xa9a1('0x26')][_0x30134b[_0xa9a1('0xc6')]];this['updateOriginated'](this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]);_0x2615e7[_0xa9a1('0xd5')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));var _0x498741=new QueueCallerAbandon(_0x2615e7,_0x30134b);if(utils[_0xa9a1('0x67')](_0x2615e7[_0xa9a1('0xd5')],_0x2615e7[_0xa9a1('0xd6')])>=_0x2615e7[_0xa9a1('0xd7')]){this[_0xa9a1('0x1f')][_0x30134b['queue']][_0xa9a1('0x54')]+=0x1;this[_0xa9a1('0x1f')][_0x30134b['queue']][_0xa9a1('0xd8')]+=0x1;this[_0xa9a1('0x1f')][_0x30134b['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x498741[_0xa9a1('0x78')]=0xa;_0x498741[_0xa9a1('0xd9')]=_0xa9a1('0xda');_0x498741[_0xa9a1('0xdb')]='TIMEOUT';_0x498741[_0xa9a1('0xcf')]=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]['dialQueueProject2']?moment()[_0xa9a1('0x49')](_0xa9a1('0xcb')):undefined;_0x498741[_0xa9a1('0xdc')]+=0x1;_0x498741[_0xa9a1('0xdd')]+=0x1;_0x5ccda2=this['voiceQueues'][_0x30134b['queue']]['dialDropRetryFrequency'];_0x10c39a=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xa9a1('0xde')](_0x498741,_0x498741['state'],_0x2615e7[_0xa9a1('0xdf')])[_0xa9a1('0x42')](function(_0x13999e){_0x13231b=_0x13999e[_0xa9a1('0xe0')]==0x1;if(_0x498741[_0xa9a1('0xdc')]>=_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xe1')]){_0x1cdab1[_0xa9a1('0xe2')](_0x498741,_0x13999e['additional']);}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countdropretry':_0x498741[_0xa9a1('0xdc')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xe5')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x2615e7[_0xa9a1('0xe7')],'ListId':_0x2615e7[_0xa9a1('0xe8')],'VoiceQueueId':_0x2615e7[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2615e7[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xeb')));var _0x3a8b7b=new History(_0x498741);_0x3a8b7b[_0xa9a1('0x78')]=0xa;_0x3a8b7b[_0xa9a1('0xd9')]='Drop';_0x3a8b7b[_0xa9a1('0x7a')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));_0x3a8b7b['endtime']=_0x3a8b7b[_0xa9a1('0x7a')];_0x3a8b7b['calleridname']=_0x498741[_0xa9a1('0xec')];_0x3a8b7b['calleridnum']=_0x498741[_0xa9a1('0xed')];hopperUtils['createHistory'](_0x3a8b7b)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xee')));}})['then'](function(){if(_0x13231b)hopperUtils[_0xa9a1('0xef')](_0x498741,_0x5ccda2,_0x10c39a)[_0xa9a1('0x42')](function(){return 0x1;});});}else{this['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0x56')]+=0x1;this['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf0')]+=0x1;_0x498741['state']=0xb;_0x498741['statedesc']=_0xa9a1('0xf1');_0x498741['dropreason']=_0xa9a1('0xf2');_0x498741[_0xa9a1('0xf3')]+=0x1;_0x498741[_0xa9a1('0xdd')]+=0x1;_0x5ccda2=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf4')];_0x10c39a=this[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xde')](_0x498741,_0x498741[_0xa9a1('0x78')],_0x2615e7[_0xa9a1('0xdf')])['then'](function(_0x467f19){if(_0x498741[_0xa9a1('0xf3')]>=_0x1cdab1[_0xa9a1('0x1f')][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf6')]){_0x1cdab1[_0xa9a1('0xe2')](_0x498741,_0x467f19[_0xa9a1('0xe0')]);}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countabandonedretry':_0x498741[_0xa9a1('0xf3')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x1cdab1['voiceQueues'][_0x30134b[_0xa9a1('0xc9')]][_0xa9a1('0xf4')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x2615e7['ContactId'],'ListId':_0x2615e7['ListId'],'VoiceQueueId':_0x2615e7['VoiceQueueId']||undefined,'CampaignId':_0x2615e7[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xf7')));var _0xcfd5c9=new History(_0x498741);_0xcfd5c9[_0xa9a1('0x78')]=0xb;_0xcfd5c9['statedesc']='Abandoned';_0xcfd5c9[_0xa9a1('0x7a')]=moment()[_0xa9a1('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xcfd5c9['endtime']=_0xcfd5c9['starttime'];_0xcfd5c9[_0xa9a1('0xec')]=_0x498741[_0xa9a1('0xec')];_0xcfd5c9[_0xa9a1('0xed')]=_0x498741[_0xa9a1('0xed')];hopperUtils[_0xa9a1('0xd2')](_0xcfd5c9)['catch'](loggerCatch(_0xa9a1('0xf8')));}})[_0xa9a1('0x42')](function(){if(_0x13231b)hopperUtils['swapAdditionalPhones'](_0x498741,_0x5ccda2,_0x10c39a)[_0xa9a1('0x42')](function(){return 0x1;});});}}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x39')]=function(_0x47e91c){if(this[_0xa9a1('0x24')][_0x47e91c['uniqueid']]){this['actions'][_0x47e91c['uniqueid']][_0xa9a1('0xf9')]=_0x47e91c['channel'];}if(this[_0xa9a1('0x26')][_0x47e91c[_0xa9a1('0xc6')]]){this[_0xa9a1('0x26')][_0x47e91c[_0xa9a1('0xc6')]][_0xa9a1('0xf9')]=_0x47e91c[_0xa9a1('0xf9')];}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x3c')]=function(_0x392a98){if(!this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]){return;}var _0x434cd0=this[_0xa9a1('0x1f')][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]['queue']]['strategy']||_0xa9a1('0xfb');if(_0x434cd0==='roundrobin'){if(this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]&&_[_0xa9a1('0xfc')](this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfd')])&&_0x392a98[_0xa9a1('0x91')]==='1'&&_0x392a98['paused']==='0'){if(this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]]){if(!this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]][_0xa9a1('0xfd')]){this[_0xa9a1('0x21')][_0x392a98[_0xa9a1('0xfe')]][_0xa9a1('0xfd')]=!![];this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfd')]=!![];this['actions'][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]=_0x392a98[_0xa9a1('0xfe')];}}}}else if(_0x434cd0===_0xa9a1('0xfb')){if(this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]]){if(this[_0xa9a1('0x21')][_0x392a98['stateinterface']]){this[_0xa9a1('0x24')][_0x392a98['actionid']][_0xa9a1('0xfe')]=_0x392a98[_0xa9a1('0xfe')];if(_['isNil'](this['queueBooked'][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]])){this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x392a98['actionid']][_0xa9a1('0xc9')]]=[];}this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]['push'](_[_0xa9a1('0x66')](_['pick'](this[_0xa9a1('0x24')][_0x392a98[_0xa9a1('0xfa')]],[_0xa9a1('0xff'),_0xa9a1('0xfe')]),{'status':_0x392a98[_0xa9a1('0x91')],'paused':_0x392a98[_0xa9a1('0x100')]}));}}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x3e')]=function(_0x95e789){if(!this['actions'][_0x95e789[_0xa9a1('0xfa')]]){return;}var _0x4d4b95=this;var _0x30a438=this[_0xa9a1('0x1f')][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]];var _0x34e194=_0x30a438[_0xa9a1('0x101')]||_0xa9a1('0xfb');if(_0x34e194===_0xa9a1('0x102')){if(this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]]&&this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]){this[_0xa9a1('0x103')][_0xa9a1('0x104')](this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xff')],this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')])[_0xa9a1('0xa7')](function(_0x2f2106){logger[_0xa9a1('0x6d')](_0xa9a1('0x105'),util['inspect'](_0x2f2106,{'showHidden':![],'depth':null}));})[_0xa9a1('0x1d')](function(){_0x4d4b95[_0xa9a1('0xc8')](_0x4d4b95[_0xa9a1('0x1f')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]);_0x4d4b95[_0xa9a1('0x21')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xfe')]]['locked']=![];delete _0x4d4b95[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]];unlockQueueStatus(_0x30a438);});}else{this[_0xa9a1('0xc8')](this[_0xa9a1('0x1f')][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xe7')],'ListId':this['actions'][_0x95e789['actionid']][_0xa9a1('0xe8')],'VoiceQueueId':this[_0xa9a1('0x24')][_0x95e789['actionid']][_0xa9a1('0xe9')]||undefined,'CampaignId':this['actions'][_0x95e789['actionid']][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x106')));delete this[_0xa9a1('0x24')][_0x95e789['actionid']];unlockQueueStatus(_0x30a438);}}else if(_0x34e194===_0xa9a1('0xfb')){var _0x2502de;if(this[_0xa9a1('0x24')][_0x95e789['actionid']]&&!_[_0xa9a1('0x4d')](this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]])){if(this['queueBookedRR'][_0x4d4b95[_0xa9a1('0x24')][_0x95e789['actionid']][_0xa9a1('0xc9')]]){this[_0xa9a1('0x2a')][_0x4d4b95[_0xa9a1('0x24')][_0x95e789['actionid']]['queue']]=this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]?this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]:this['queueBooked'][this['actions'][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]]?this[_0xa9a1('0x29')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]][_0xa9a1('0x107')]||0x0:0x0;}this['queueBooked'][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]][_0xa9a1('0x107')]=this[_0xa9a1('0x2a')][this[_0xa9a1('0x24')][_0x95e789[_0xa9a1('0xfa')]][_0xa9a1('0xc9')]];for(var _0x25d9b8=0x0;_0x25d9b8=_0x1f5b39[_0xa9a1('0x12d')]){_0x4ee8c2[_0xa9a1('0x12e')](_0x397343,_0x4e4895,_0x4f4871,_0xa9a1('0x12f'));}else{if(_0x397343[_0xa9a1('0x125')]>=_0x1f5b39[_0xa9a1('0x130')]){_0x4ee8c2['createStateFinal'](_0x397343,_0x4e4895,_0x4f4871,_0xa9a1('0x131'));}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countmachineretry':_0x397343['countmachineretry'],'scheduledat':moment()['add'](_0x1f5b39[_0xa9a1('0x132')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x397343[_0xa9a1('0xe7')],'ListId':_0x397343['ListId'],'VoiceQueueId':_0x397343[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x397343[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4e4895({'reschedule':0x1});}}});}if(_0x55019f['type']===_0xa9a1('0xc7')&&this[_0xa9a1('0x20')][_0x55019f['queue']][_0xa9a1('0x11b')]&&_0x12b645[_0xa9a1('0x133')]===_0xa9a1('0x11c')){delete this[_0xa9a1('0x26')][_0x12b645[_0xa9a1('0xc6')]];this[_0xa9a1('0xc8')](this['campaigns'][_0x55019f['queue']]);_0x1a0c5b=new Hangup(_0x55019f,_0x12b645);_0x1a0c5b[_0xa9a1('0x78')]=0x12;_0x1a0c5b['statedesc']=_0xa9a1('0x11e');_0x1a0c5b[_0xa9a1('0x11f')]=_0xa9a1('0x120');ami['emit'](_0xa9a1('0x127'),ut[_0xa9a1('0x121')](_0x1a0c5b,_0xa9a1('0x126')));this[_0xa9a1('0x134')](_0x1a0c5b,_0xa9a1('0x135'),_0xa9a1('0x136'));}if(_0x55019f[_0xa9a1('0x45')]===_0xa9a1('0xc7')&&this[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]][_0xa9a1('0x11b')]&&_0x12b645[_0xa9a1('0x133')]===_0xa9a1('0x137')){return new Promise(function(_0x73f63d,_0x332fa2){delete _0x4ee8c2[_0xa9a1('0x26')][_0x12b645['uniqueid']];_0x4ee8c2['updateOriginated'](_0x4ee8c2[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]]);_0x4ee8c2[_0xa9a1('0x20')][_0x55019f['queue']][_0xa9a1('0xcc')]+=0x1;_0x4ee8c2['campaigns'][_0x55019f['queue']][_0xa9a1('0x11d')]+=0x1;var _0x308b3a=_0x4ee8c2[_0xa9a1('0x20')][_0x55019f[_0xa9a1('0xc9')]];var _0x3307fa=new Hangup(_0x55019f,_0x12b645);_0x3307fa[_0xa9a1('0x78')]=0x13;_0x3307fa[_0xa9a1('0xd9')]=_0xa9a1('0x124');_0x3307fa[_0xa9a1('0x11f')]=_0xa9a1('0x120');_0x3307fa[_0xa9a1('0x125')]+=0x1;_0x3307fa[_0xa9a1('0xdd')]+=0x1;_0x3307fa['amd']=!![];ami[_0xa9a1('0x44')](_0xa9a1('0x127'),ut['buildObj'](_0x3307fa,_0xa9a1('0x126')));hopperUtils['createHistory'](_0x3307fa)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x128')));if(_0x3307fa['countbusyretry']+_0x3307fa['countcongestionretry']+_0x3307fa[_0xa9a1('0x12a')]+_0x3307fa[_0xa9a1('0x12b')]+_0x3307fa[_0xa9a1('0xdc')]+_0x3307fa['countabandonedretry']+_0x3307fa['countmachineretry']+_0x3307fa['countagentrejectretry']>=_0x308b3a['dialGlobalMaxRetry']){_0x4ee8c2['stateGlobal'](_0x3307fa,_0x73f63d,_0x332fa2,_0xa9a1('0x12f'));}else{if(_0x3307fa[_0xa9a1('0x125')]>=_0x308b3a['dialMachineMaxRetry']){_0x4ee8c2['createStateFinal'](_0x3307fa,_0x73f63d,_0x332fa2,_0xa9a1('0x131'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3307fa[_0xa9a1('0x125')],'scheduledat':moment()[_0xa9a1('0xe4')](_0x308b3a['dialMachineRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0x3307fa[_0xa9a1('0xe7')],'ListId':_0x3307fa[_0xa9a1('0xe8')],'VoiceQueueId':_0x3307fa[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x3307fa['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x138')));_0x73f63d({'reschedule':0x1});}}});}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x38')]=function(_0x5a7851){var _0x2f215a=this[_0xa9a1('0x26')][_0x5a7851[_0xa9a1('0xc6')]];var _0x58ea24;if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]===_0xa9a1('0xc7')){delete this[_0xa9a1('0x26')][_0x5a7851[_0xa9a1('0xc6')]];this[_0xa9a1('0xc8')](this['campaigns'][_0x2f215a[_0xa9a1('0xc9')]]);this['campaigns'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x139')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13b')));}if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]!==_0xa9a1('0xc7')&&isNotNull(this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13c')])){delete this['uniqueId'][_0x5a7851[_0xa9a1('0xc6')]];this['updateOriginated'](this[_0xa9a1('0x1f')][_0x2f215a[_0xa9a1('0xc9')]]);this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x11d')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);_0x58ea24[_0xa9a1('0x78')]=0x10;_0x58ea24[_0xa9a1('0xd9')]='AnswerAGI';_0x58ea24['membername']=_0xa9a1('0x13d');hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch('[syncHangupIvr]'));}if(_0x2f215a&&_0x2f215a[_0xa9a1('0x45')]!==_0xa9a1('0xc7')&&!isNotNull(this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13c')])){delete this['uniqueId'][_0x5a7851['uniqueid']];this[_0xa9a1('0xc8')](this['voiceQueues'][_0x2f215a[_0xa9a1('0xc9')]]);this[_0xa9a1('0x1f')][_0x2f215a[_0xa9a1('0xc9')]][_0xa9a1('0x13e')]+=0x1;_0x58ea24=new Hangup(_0x2f215a,_0x5a7851);_0x58ea24[_0xa9a1('0x78')]=0xc;_0x58ea24[_0xa9a1('0xd9')]=_0x5a7851['cause-txt'];_0x58ea24['membername']='Unknow';hopperUtils[_0xa9a1('0xd2')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x13a')));hopperUtils[_0xa9a1('0xd3')](_0x58ea24)[_0xa9a1('0xa7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xa9a1('0x1a')]['syncQueueSummary']=function(_0x393df6){var _0x54dd9d=this;if(!_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]]){_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]]={'running':![]};}else if(_0x54dd9d['queuesSummary'][_0x393df6['name']][_0xa9a1('0x13f')]===!![]){return;}else if(_0x54dd9d[_0xa9a1('0x2b')][_0x393df6['name']][_0xa9a1('0x13f')]===![]){_0x54dd9d[_0xa9a1('0x2b')][_0x393df6[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=!![];}var _0x3fe200=_0x54dd9d[_0xa9a1('0x1f')][_0x393df6[_0xa9a1('0x4b')]];var _0x370a95=_0x3fe200['message']!==utils['CAMPAIGN_STATUS'][_0xa9a1('0x88')];var _0x3095a6=utils[_0xa9a1('0x140')](_0x3fe200);_0x3fe200[_0xa9a1('0x141')]=utils[_0xa9a1('0x142')](_0x3fe200,_0x54dd9d['trunks']);Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](function(){if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')]['INACTIVE']){if(_0x370a95){clearPredictiveAttributes(_0x3fe200);_0x393df6[_0xa9a1('0x69')]=undefined;_0x393df6['startProgressive']=undefined;}if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')]['INACTIVE']){_0x393df6[_0xa9a1('0x143')]=0x0;_0x393df6[_0xa9a1('0x100')]=0x0;_0x393df6[_0xa9a1('0x144')]=0x0;_0x393df6['talking']=0x0;_0x393df6[_0xa9a1('0x145')]=0x0;}}else if(_0x3fe200[_0xa9a1('0x141')]===utils[_0xa9a1('0x73')][_0xa9a1('0x146')]&&!_0x3095a6){return _0x54dd9d[_0xa9a1('0x99')](_0x3fe200,!![])[_0xa9a1('0x42')](function(){return _0x54dd9d[_0xa9a1('0x99')](_0x3fe200,![]);})[_0xa9a1('0x42')](function(){return _0x54dd9d['checkDialMethod'](_0x3fe200);})['catch'](function(_0x243590){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0xa9a1('0x48')](_0x243590,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3fe200);});}else{clearPredictiveAttributes(_0x3fe200);}})[_0xa9a1('0x42')](function(){var _0x1affd5=_0x393df6[_0xa9a1('0x147')](_0x3fe200);if(_0x1affd5||_0x3fe200['queueSummaryCountersUpdated']){_0x3fe200[_0xa9a1('0x148')]=![];_0x393df6['updateReportFromOutboundQueue'](_0x3fe200);Object['assign'](_0x3fe200,_0x393df6);emitOutboundVoiceQueueSummary(_0x393df6);}_0x54dd9d[_0xa9a1('0x2b')][_0x3fe200[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=![];})[_0xa9a1('0xa7')](function(_0x1901b9){logger[_0xa9a1('0x6d')]('[syncQueueSummary]',util['inspect'](_0x1901b9,{'showHidden':![],'depth':null}));_0x54dd9d[_0xa9a1('0x2b')][_0x3fe200[_0xa9a1('0x4b')]][_0xa9a1('0x13f')]=![];});};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x36')]=_[_0xa9a1('0x149')](function(){var _0x5a45af=_[_0xa9a1('0x14a')](this[_0xa9a1('0x1f')],function(_0x1597e8){return _0x1597e8[_0xa9a1('0x14b')];});var _0x529dc4=_[_0xa9a1('0x14a')](this[_0xa9a1('0x21')],function(_0x5bbfc0){return _0x5bbfc0[_0xa9a1('0x14c')]&&_0x5bbfc0[_0xa9a1('0x91')]===_0xa9a1('0x90');});if(_0x5a45af[_0xa9a1('0x108')]>0x0&&_0x529dc4[_0xa9a1('0x108')]>0x0){return Promise['resolve']()['then'](cmHopper[_0xa9a1('0x14d')](_[_0xa9a1('0x14e')](_0x5a45af,'id'),previewRecallmeReminderInterval,_[_0xa9a1('0x14e')](_0x529dc4,'id')))[_0xa9a1('0x42')](function(_0x5d42bd){for(var _0xd255ae=0x0;_0xd255ae<_0x5d42bd[_0xa9a1('0x108')];_0xd255ae++){var _0x3ed74e=_0x5d42bd[_0xd255ae][_0xa9a1('0x14f')][_0xa9a1('0x4b')];if(_0x3ed74e)io['to'](util[_0xa9a1('0x49')]('user:%s',_0x3ed74e))[_0xa9a1('0x44')](_0xa9a1('0x150'),{'hopper':_0x5d42bd[_0xd255ae]});}})[_0xa9a1('0xa7')](function(_0xa8902f){logger[_0xa9a1('0x6d')](_0xa9a1('0x151'),_0xa8902f);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5c41d4=this;setInterval(function(){_0x5c41d4[_0xa9a1('0x152')](_0x5c41d4[_0xa9a1('0x26')],_0xa9a1('0x153'));_0x5c41d4['clearZombieChannels'](_0x5c41d4[_0xa9a1('0x24')],_0xa9a1('0x154'));},0x32c8);};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x152')]=function(_0x1bcfc3,_0x54d2ef){var _0x53642d=this;for(var _0xa57324 in _0x1bcfc3){if(typeof _0x1bcfc3[_0xa57324]!==_0xa9a1('0xae')){this['sequence'][_0xa9a1('0x1b')](function(){if(!_[_0xa9a1('0xfc')](_0x1bcfc3[_0xa57324])){return ami[_0xa9a1('0xa0')]({'action':_0xa9a1('0x91'),'channel':_0x1bcfc3[_0xa57324]['channel']})[_0xa9a1('0xa7')](function(_0x23e65c){if(_0x23e65c[_0xa9a1('0x72')]===_0xa9a1('0x155')){setTimeout(function(){if(_0x1bcfc3[_0xa57324]&&_0x1bcfc3[_0xa57324]['type']!==_0xa9a1('0xc7')){_0x53642d[_0xa9a1('0xc8')](_0x53642d['voiceQueues'][_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]]);logger[_0xa9a1('0x6d')](_0xa9a1('0x156'),_0x54d2ef,_0xa57324,_0x1bcfc3[_0xa57324]['queue']);delete _0x1bcfc3[_0xa57324];}if(_0x1bcfc3[_0xa57324]&&_0x1bcfc3[_0xa57324][_0xa9a1('0x45')]===_0xa9a1('0xc7')){_0x53642d[_0xa9a1('0xc8')](_0x53642d[_0xa9a1('0x20')][_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]]);logger[_0xa9a1('0x6d')](_0xa9a1('0x157'),_0x54d2ef,_0xa57324,_0x1bcfc3[_0xa57324][_0xa9a1('0xc9')]);delete _0x1bcfc3[_0xa57324];}},0x2328);}});}});}}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x158')]=function(_0x3a0e88){return Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](voiceQueueRt[_0xa9a1('0x158')](_0x3a0e88))[_0xa9a1('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0xc8')]=function(_0x5fe129){if(!_[_0xa9a1('0x5b')](_0x5fe129)&&_0x5fe129!==null){if(typeof _0x5fe129[_0xa9a1('0x87')]!==_0xa9a1('0xae')){if(_0x5fe129[_0xa9a1('0x87')]>0x0){_0x5fe129[_0xa9a1('0x87')]-=0x1;}else{logger[_0xa9a1('0x6d')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xa9a1('0x6d')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xa9a1('0x1a')]['loggerHandler']=function(_0xf4f097,_0x5d7960){var _0x1db4c7=this;return function(_0x384c30){_0x1db4c7[_0xa9a1('0xc8')](_0x5d7960);logger[_0xa9a1('0x6d')](_0xf4f097,util[_0xa9a1('0x48')](_0x384c30,{'showHidden':![],'depth':null}));};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x159')]=function(_0xafd1df,_0xb95713,_0x1103cf){var _0x41538f={'state':0x19,'statedesc':_0xa9a1('0x15a')};this[_0xa9a1('0xc8')](_0xb95713);this[_0xa9a1('0x134')](_[_0xa9a1('0x66')](_0x41538f,_['pick'](_0x1103cf,[_0xa9a1('0xe7'),_0xa9a1('0xe8'),_0xa9a1('0x15b'),'VoiceQueueId',_0xa9a1('0xea')])),_0xa9a1('0x15c'),_0xa9a1('0x15d'));logger[_0xa9a1('0x6d')](_0xafd1df);};Dialer[_0xa9a1('0x1a')]['saveInDb']=function(_0x8d4efc,_0x69a546,_0x22ec85){hopperUtils[_0xa9a1('0xd2')](_0x8d4efc)['catch'](loggerCatch(_0x69a546));hopperUtils[_0xa9a1('0xd3')](_0x8d4efc)[_0xa9a1('0xa7')](loggerCatch(_0x22ec85));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0xe2')]=function(_0x292562,_0x3f7b71){hopperUtils[_0xa9a1('0xd2')](_0x292562)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x15e')));if(_0x3f7b71==0x0){hopperUtils[_0xa9a1('0xd3')](_0x292562)[_0xa9a1('0xa7')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xa9a1('0x1a')]['checkPreviewRecallReminder']=function(_0x3a89c4){return Promise[_0xa9a1('0xaf')]()[_0xa9a1('0x42')](cmHopper[_0xa9a1('0x14d')](_0x3a89c4['id'],previewRecallmeReminderInterval))[_0xa9a1('0x42')](function(_0x3e3f9e){for(var _0x4ae57b=0x0;_0x4ae57b<_0x3e3f9e[_0xa9a1('0x108')];_0x4ae57b++){var _0xec2055=_0x3e3f9e[_0x4ae57b][_0xa9a1('0x14f')][_0xa9a1('0x4b')];if(_0xec2055)io['to'](util['format'](_0xa9a1('0x15f'),_0xec2055))[_0xa9a1('0x44')](_0xa9a1('0x150'),{'hopper':_0x3e3f9e[_0x4ae57b]});}})['catch'](function(){});};Dialer[_0xa9a1('0x1a')]['launchHandleIvr']=function(_0x57d371){var _0x286e70=this;return function(){_0x286e70[_0xa9a1('0x160')](_0x57d371);};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x161')]=function(_0x2510ce,_0xdd7919){var _0x2f4e4a=this;var _0xd030e9=uuid['v4']();this[_0xa9a1('0x24')][_0xd030e9]=new Action(_0x2510ce,_0xdd7919,_0xd030e9);return new Promise(function(_0x57702a,_0x38f6ba){if(_[_0xa9a1('0x5b')](_0x2510ce)&&typeof _0x2510ce!==_0xa9a1('0x162')){return _0x38f6ba(msgResponse(_0xa9a1('0x163'),_0xa9a1('0x9e'),_0xa9a1('0x164')));}if(_['isUndefined'](_0xdd7919[_0xa9a1('0x165')])||_0xdd7919[_0xa9a1('0x165')]===null){return _0x38f6ba(msgResponse('originate',_0xa9a1('0x9e'),_0xa9a1('0x166')));}var _0x4db7e9={'XMD-CALLERID':_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x167')](),'XMD-AGI':_0x2510ce[_0xa9a1('0x13c')]?util[_0xa9a1('0x49')](_0xa9a1('0x168'),ipAgi,_0x2510ce[_0xa9a1('0x13c')]):_0xa9a1('0x169'),'XMD-AGIAFTER':_0x2510ce[_0xa9a1('0xd0')]?util[_0xa9a1('0x49')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2510ce[_0xa9a1('0xd0')]):_0xa9a1('0x169'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2510ce)?util['format']('\x22%s,%s%s,,,%s\x22',_0x2510ce['name'],_0x2510ce[_0xa9a1('0x16a')]||'',_0x2510ce[_0xa9a1('0xd1')]?'c':'',_0x2510ce[_0xa9a1('0xd7')]||0x3):_0xa9a1('0x169'),'XMD-CONTACTID':_0xdd7919['ContactId'],'XMD-CDRTYPE':_0xa9a1('0x9'),'CALLERID(all)':_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x167')](),'XMD-AMD':_0x2510ce['dialAMDActive']?_0xa9a1('0x146'):_0xa9a1('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2510ce[_0xa9a1('0x11b')]){_0x4db7e9[_0xa9a1('0x16b')]=_0x2510ce[_0xa9a1('0x16c')]||0x9c4;_0x4db7e9['XMD-AMDGREETING']=_0x2510ce[_0xa9a1('0x16d')]||0x5dc;_0x4db7e9[_0xa9a1('0x16e')]=_0x2510ce['dialAMDAfterGreetingSilence']||0x320;_0x4db7e9[_0xa9a1('0x16f')]=_0x2510ce[_0xa9a1('0x170')]||0x1388;_0x4db7e9['XMD-AMDMINWORDLENGTH']=_0x2510ce[_0xa9a1('0x171')]||0x64;_0x4db7e9[_0xa9a1('0x172')]=_0x2510ce['dialAMDBetweenWordsSilence']||0x32;_0x4db7e9[_0xa9a1('0x173')]=_0x2510ce[_0xa9a1('0x174')]||0x3;_0x4db7e9[_0xa9a1('0x175')]=_0x2510ce[_0xa9a1('0x176')]||0x100;_0x4db7e9[_0xa9a1('0x177')]=_0x2510ce['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xa9a1('0x178')](_0x2510ce)){_0x4db7e9['XMD-VOICEQUEUEID']=_0xdd7919[_0xa9a1('0xe9')];}else{_0x4db7e9[_0xa9a1('0x179')]=_0xdd7919['CampaignId'];}var _0x16305d=utils[_0xa9a1('0x17a')](_0xdd7919['Contact']);Object[_0xa9a1('0x17b')](_0x4db7e9,_0x16305d);var _0x59d7f6=_0x2f4e4a[_0xa9a1('0x8e')](_0x2510ce[_0xa9a1('0x17c')])?utils[_0xa9a1('0x17d')](_0x2510ce[_0xa9a1('0x17c')]['callerid'],_0x2510ce['dialOriginateCallerIdName'],_0x2510ce[_0xa9a1('0x17e')]>0x0?utils[_0xa9a1('0x17f')](_0x2510ce[_0xa9a1('0x180')],_0x2510ce[_0xa9a1('0x17e')]):_0x2510ce[_0xa9a1('0x180')]):utils['getCallerId'](_[_0xa9a1('0xfc')](_0x2510ce[_0xa9a1('0x94')])?_0x2510ce[_0xa9a1('0x17c')][_0xa9a1('0x181')]:_0x2510ce[_0xa9a1('0x94')]['callerid'],_0x2510ce[_0xa9a1('0x182')],_0x2510ce['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2510ce[_0xa9a1('0x180')],_0x2510ce[_0xa9a1('0x17e')]):_0x2510ce[_0xa9a1('0x180')]);if(_0x59d7f6){_0x4db7e9[_0xa9a1('0x183')]=_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9][_0xa9a1('0x184')]=utils[_0xa9a1('0x185')](_0x59d7f6);_0x4db7e9['XMD-ORIGINATECALLERIDNUM']=_0xdd7919[_0xa9a1('0x165')];}_0x2510ce[_0xa9a1('0x186')]=_0x4db7e9;return ami[_0xa9a1('0xa0')]({'actionid':_0xd030e9,'action':_0xa9a1('0x163'),'channel':_0x2f4e4a['isTrunkReachable'](_0x2510ce['Trunk'])?util[_0xa9a1('0x49')](_0xa9a1('0x187'),_0x2510ce['Trunk']['name'],isNotNull(_0x2510ce[_0xa9a1('0x188')])?_0x2510ce[_0xa9a1('0x188')][_0xa9a1('0x189')]()||'':'',_0x2510ce[_0xa9a1('0x18a')]>0x0?_0xdd7919['phone'][_0xa9a1('0x18b')](_0x2510ce[_0xa9a1('0x18a')]):_0xdd7919[_0xa9a1('0x165')]):util['format'](_0xa9a1('0x187'),_['isNil'](_0x2510ce['TrunkBackup'])?_0x2510ce[_0xa9a1('0x17c')]['name']:_0x2510ce[_0xa9a1('0x94')][_0xa9a1('0x4b')],isNotNull(_0x2510ce[_0xa9a1('0x188')])?_0x2510ce[_0xa9a1('0x188')][_0xa9a1('0x189')]()||'':'',_0x2510ce['dialCutDigit']>0x0?_0xdd7919[_0xa9a1('0x165')][_0xa9a1('0x18b')](_0x2510ce[_0xa9a1('0x18a')]):_0xdd7919[_0xa9a1('0x165')]),'callerid':_0x59d7f6,'Exten':_0xa9a1('0x11a'),'Context':_0xa9a1('0x18c'),'Priority':'1','variable':_0x4db7e9,'timeout':(_0x2510ce['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xd030e9})[_0xa9a1('0x42')](function(_0x13b6a5){return _0x57702a(_0x13b6a5);})[_0xa9a1('0xa7')](function(_0x3005d7){_0x2510ce[_0xa9a1('0x18d')]+=0x1;var _0x350cd0=new History(_0x2f4e4a[_0xa9a1('0x24')][_0xd030e9]);logger[_0xa9a1('0x6d')](util[_0xa9a1('0x49')](_0xa9a1('0x18e'),JSON[_0xa9a1('0x7e')](_0x3005d7)));_0x350cd0[_0xa9a1('0x78')]=0xe;_0x350cd0['statedesc']=_0xa9a1('0x18f');_0x350cd0['starttime']=moment()['format'](_0xa9a1('0xcb'));_0x350cd0[_0xa9a1('0x79')]=_0x350cd0[_0xa9a1('0x7a')];hopperUtils[_0xa9a1('0xd2')](_0x350cd0)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x190')));_0x2f4e4a[_0xa9a1('0xd3')](_0x350cd0)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x190')))[_0xa9a1('0x1d')](function(){delete _0x2f4e4a[_0xa9a1('0x24')][_0xd030e9];return _0x38f6ba(msgResponse(_0xa9a1('0x163'),'Error',_0xa9a1('0x191')));});});});};Dialer['prototype'][_0xa9a1('0x192')]=function(_0x53954a,_0x2c93bc,_0x283a9c){var _0xafc85f=new History(_0x2c93bc);if(_0xafc85f[_0xa9a1('0x193')]+_0xafc85f['countcongestionretry']+_0xafc85f['countnoanswerretry']+_0xafc85f[_0xa9a1('0x12b')]+_0xafc85f[_0xa9a1('0xdc')]+_0xafc85f['countabandonedretry']+_0xafc85f[_0xa9a1('0x125')]+_0xafc85f[_0xa9a1('0x12c')]>=_0x283a9c[_0xa9a1('0x12d')]-0x1){return!![];}switch(_0x53954a){case 0x3:if(_0xafc85f[_0xa9a1('0x12a')]>=_0x283a9c[_0xa9a1('0x194')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countnoanswerretry':_0xafc85f['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x195')],_0xa9a1('0xe6'))['format'](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xafc85f[_0xa9a1('0x193')]>=_0x283a9c[_0xa9a1('0x196')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countbusyretry':_0xafc85f['countbusyretry']+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x197')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x198')));break;case 0x8:if(_0xafc85f[_0xa9a1('0x129')]>=_0x283a9c[_0xa9a1('0x199')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countcongestionretry':_0xafc85f[_0xa9a1('0x129')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c['dialCongestionRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x19a')));break;case 0x0:if(_0xafc85f[_0xa9a1('0x12b')]>=_0x283a9c[_0xa9a1('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa9a1('0xe3')]({'active':![],'countnosuchnumberretry':_0xafc85f[_0xa9a1('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x283a9c['dialNoSuchNumberRetryFrequency'],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x19c')));}break;case 0xa:if(_0xafc85f[_0xa9a1('0xdc')]>=_0x283a9c[_0xa9a1('0xe1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xafc85f[_0xa9a1('0xdc')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0xe5')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xafc85f['countabandonedretry']>=_0x283a9c[_0xa9a1('0xf6')]-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countabandonedretry':_0xafc85f[_0xa9a1('0xf3')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c['dialAbandonedRetryFrequency'],_0xa9a1('0xe6'))['format'](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f[_0xa9a1('0xe8')],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})['catch'](loggerCatch(_0xa9a1('0xf7')));break;case 0x13:if(_0xafc85f[_0xa9a1('0x125')]>=_0x283a9c['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xa9a1('0xe3')]({'active':![],'countmachineretry':_0xafc85f[_0xa9a1('0x125')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x132')],_0xa9a1('0xe6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f['ListId'],'VoiceQueueId':_0xafc85f[_0xa9a1('0xe9')]||undefined,'CampaignId':_0xafc85f[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x138')));break;case 0x14:if(_0xafc85f['countagentrejectretry']>=_0x283a9c[_0xa9a1('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xafc85f[_0xa9a1('0x12c')]+=0x1,'scheduledat':moment()[_0xa9a1('0xe4')](_0x283a9c[_0xa9a1('0x19e')],_0xa9a1('0xe6'))[_0xa9a1('0x49')](_0xa9a1('0xcb')),'ContactId':_0xafc85f[_0xa9a1('0xe7')],'ListId':_0xafc85f['ListId'],'VoiceQueueId':_0xafc85f['VoiceQueueId']||undefined,'CampaignId':_0xafc85f['CampaignId']||undefined})[_0xa9a1('0xa7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x115')]=function(_0x4eb5df,_0x3aaadf,_0x580c28){var _0x471e6e=this;var _0x3db44a=new History(_0x4eb5df);var _0xedb442=![];var _0x10f82c;var _0x392cf4;return new Promise(function(_0x2fad99,_0x62407e){if(_[_0xa9a1('0x5b')](_0x3aaadf)&&typeof _0x3aaadf!==_0xa9a1('0x162')){return _0x62407e(msgResponse('[callProgressDetecting]',_0xa9a1('0x9e'),_0xa9a1('0x19f')));}if(_[_0xa9a1('0x5b')](_0x580c28)&&typeof _0x580c28!==_0xa9a1('0x162')){return _0x62407e(msgResponse(_0xa9a1('0x1a0'),'Failure','evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x3db44a,_0x580c28[_0xa9a1('0xcd')],_0x3aaadf)['then'](function(_0x58493d){if(_0x58493d[_0xa9a1('0xe0')]==0x1)_0xedb442=!![];switch(_0x580c28['reason']){case'0':_0x3aaadf[_0xa9a1('0x1a1')]+=0x1;_0x3db44a['state']=0x0;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1a2');_0x3db44a[_0xa9a1('0x12b')]+=0x1;_0x3db44a['countglobal']+=0x1;ami[_0xa9a1('0x44')](_0xa9a1('0x1a3'),ut[_0xa9a1('0x121')](_0x4eb5df,_0xa9a1('0x1a4')));_0x10f82c=_0x3aaadf[_0xa9a1('0x1a5')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x128')));if(_0x471e6e[_0xa9a1('0x192')](0x0,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a['countnosuchnumberretry']>=_0x3aaadf['dialNoSuchNumberMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x200\x20no\x20such\x20number....');}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3aaadf[_0xa9a1('0x1a7')]+=0x1;_0x3db44a['state']=0x3;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1a8');_0x3db44a[_0xa9a1('0x12a')]+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;var _0x1d2ba0=ut[_0xa9a1('0x1a9')](_0x4eb5df,_0x3aaadf);ami['emit']('custom:agentnoanswer',_0x1d2ba0);_0x10f82c=_0x3aaadf[_0xa9a1('0x195')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1aa')));if(_0x471e6e[_0xa9a1('0x192')](0x3,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x12a')]>=_0x3aaadf['dialNoAnswerMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1ab'));}else{_0x471e6e['stateGlobal'](_0x3db44a,_0x2fad99,_0x62407e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3aaadf[_0xa9a1('0x1ac')]+=0x1;_0x3db44a['state']=0x5;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1ad');_0x3db44a['countbusyretry']+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;ami[_0xa9a1('0x44')]('custom:agentbusy',ut[_0xa9a1('0x121')](_0x4eb5df,'busy'));_0x10f82c=_0x3aaadf[_0xa9a1('0x197')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils['createHistory'](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ae')));if(_0x471e6e[_0xa9a1('0x192')](0x5,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x193')]>=_0x3aaadf['dialBusyMaxRetry']){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1af'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1af'));}}break;case'8':_0x3aaadf[_0xa9a1('0x1b0')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0x8;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1b1');_0x3db44a['countcongestionretry']+=0x1;_0x3db44a['countglobal']+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0x1b2')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];ami[_0xa9a1('0x44')](_0xa9a1('0x1b3'),ut[_0xa9a1('0x121')](_0x4eb5df,'congestion'));hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1b4')));if(_0x471e6e[_0xa9a1('0x192')](0x8,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x129')]>=_0x3aaadf[_0xa9a1('0x199')]){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1b5'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1b5'));}}break;case'11':_0x3aaadf[_0xa9a1('0x1b6')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0xb;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0xf1');_0x3db44a['countabandonedretry']+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0xf4')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils['createHistory'](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0xf8')));if(_0x471e6e[_0xa9a1('0x192')](0xb,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0xf3')]>=_0x3aaadf[_0xa9a1('0xf6')]){_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x2011\x20abandoned');}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,'reason\x2011\x20abandoned');}}break;case'20':_0x3aaadf[_0xa9a1('0x1b7')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0x14;_0x3db44a[_0xa9a1('0xd9')]=_0xa9a1('0x1b8');_0x3db44a[_0xa9a1('0x12c')]+=0x1;_0x3db44a[_0xa9a1('0xdd')]+=0x1;_0x10f82c=_0x3aaadf[_0xa9a1('0x19e')];_0x392cf4=_0x3aaadf['callAdditionalPhoneAfterMin'];ami[_0xa9a1('0x44')](_0xa9a1('0x1b9'),ut[_0xa9a1('0x121')](_0x4eb5df,_0xa9a1('0x1ba')));hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x471e6e[_0xa9a1('0x192')](0x14,_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a[_0xa9a1('0x12c')]>=_0x3aaadf[_0xa9a1('0x19d')]){_0x471e6e['createStateFinal'](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1bb'));}else{_0x471e6e[_0xa9a1('0x12e')](_0x3db44a,_0x2fad99,_0x62407e,_0xa9a1('0x1bb'));}}break;default:_0x3aaadf[_0xa9a1('0x13e')]+=0x1;_0x3db44a[_0xa9a1('0x78')]=0xc;_0x3db44a[_0xa9a1('0xd9')]=_0x580c28[_0xa9a1('0xcd')];_0x10f82c=_0x3aaadf[_0xa9a1('0x19e')];_0x392cf4=_0x3aaadf[_0xa9a1('0xf5')];hopperUtils[_0xa9a1('0xd2')](_0x3db44a)[_0xa9a1('0xa7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x471e6e[_0xa9a1('0x192')](_0x580c28[_0xa9a1('0xcd')],_0x4eb5df,_0x3aaadf)&&!_0xedb442){if(_0x3db44a['countbusyretry']+_0x3db44a[_0xa9a1('0x129')]+_0x3db44a['countnoanswerretry']+_0x3db44a[_0xa9a1('0x12b')]+_0x3db44a[_0xa9a1('0xdc')]+_0x3db44a['countabandonedretry']+_0x3db44a[_0xa9a1('0x125')]+_0x3db44a[_0xa9a1('0x12c')]>=_0x3aaadf[_0xa9a1('0x12d')]){_0x471e6e['stateGlobal'](_0x3db44a,_0x2fad99,_0x62407e,_0x580c28['reason']);}else{_0x471e6e[_0xa9a1('0x1a6')](_0x3db44a,_0x2fad99,_0x62407e,_0x580c28[_0xa9a1('0xcd')]);}}}})['then'](function(){if(_0xedb442){hopperUtils[_0xa9a1('0xef')](_0x3db44a,_0x10f82c,_0x392cf4)[_0xa9a1('0x42')](function(){return _0x2fad99(0x1);});}});});};Dialer['prototype'][_0xa9a1('0x12e')]=function(_0x6aacd2,_0x4e1d0c,_0x2f05af,_0x255fa0){var _0x4ec4fd=new Final(_0x6aacd2);_0x4ec4fd[_0xa9a1('0x78')]=0xf;_0x4ec4fd[_0xa9a1('0xd9')]=_0xa9a1('0x1bc');this[_0xa9a1('0x1a6')](_0x4ec4fd,_0x4e1d0c,_0x2f05af,_0x255fa0);};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1a6')]=function(_0x28ebcb,_0x12bb4c,_0x4a87fb,_0x557052){hopperUtils[_0xa9a1('0xd3')](_0x28ebcb)['then'](function(){return _0x12bb4c(msgResponse('[callProgressDetecting]','Success',_0x557052));})[_0xa9a1('0xa7')](function(){return _0x4a87fb(msgResponse(_0xa9a1('0x1bd'),_0xa9a1('0x9e'),'contact\x20not\x20moved'));});};Dialer[_0xa9a1('0x1a')]['predictive']=function(_0x345b98){var _0x441bdc=_0x345b98[_0xa9a1('0x1be')]/0x64;var _0x18d9f9=_0x345b98[_0xa9a1('0xd8')]/(_0x345b98['outboundDropCallsDayTimeout']+_0x345b98[_0xa9a1('0xcc')]);var _0x5bbaea=Math['round'](_0x345b98[_0xa9a1('0x1bf')]*(_0x345b98[_0xa9a1('0x1c0')]/0x64));var _0x3db33b=Math[_0xa9a1('0x1c1')](_0x345b98[_0xa9a1('0x1bf')]*(_0x345b98[_0xa9a1('0x1c2')]/0x64));var _0x3ab922=_0x345b98['available']+_0x345b98['talking'];var _0x12a699=Math[_0xa9a1('0x1c3')](_0x345b98[_0xa9a1('0x1c4')]*_0x345b98[_0xa9a1('0x63')]*_0x345b98[_0xa9a1('0x1c5')]*_0x345b98[_0xa9a1('0x1c6')]);if(_[_0xa9a1('0x5b')](_0x345b98['startProgressive'])){if(!_[_0xa9a1('0x5b')](_0x345b98[_0xa9a1('0x69')])){_0x345b98[_0xa9a1('0x69')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xa9a1('0x1c7'));}if(!_[_0xa9a1('0x5b')](_0x345b98[_0xa9a1('0x6b')])){loggerPredictive[_0xa9a1('0x6d')](_0xa9a1('0x1c8'),_0xa9a1('0x1c9'));clearInterval(_0x345b98[_0xa9a1('0x6b')]);_0x345b98[_0xa9a1('0x6b')]=undefined;}_0x345b98['startProgressive']=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1ca'),_0x345b98['startProgressive']);this[_0xa9a1('0xb6')](_0x345b98,0x1);}else if(ifInterval(_0x345b98['dialPredictiveInterval'],_0x345b98['startProgressive'])){this[_0xa9a1('0xb6')](_0x345b98,0x1);loggerPredictiveCalls[_0xa9a1('0x4e')](_0xa9a1('0x1cb'),_0x345b98['startProgressive'],_0x345b98[_0xa9a1('0x4b')]);_0x345b98[_0xa9a1('0x1c4')]=0x0;_0x345b98['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x441bdc<_0x18d9f9&&_0x345b98[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){clearPredictiveAttributes(_0x345b98);loggerPredictive[_0xa9a1('0x4e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x18d9f9,'startProgressive',_0x345b98[_0xa9a1('0x4b')]);}else if(_0x12a699<_0x345b98[_0xa9a1('0x1ce')]&&_0x345b98[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){clearPredictiveAttributes(_0x345b98);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x1cf'),_0xa9a1('0x1d0'),_0x12a699,_0xa9a1('0x1d1'),_0x345b98[_0xa9a1('0x1ce')],'startProgressive',_0x345b98['name']);}else if(!ifInterval(_0x345b98['dialPredictiveInterval'],_0x345b98[_0xa9a1('0x27')])&&_[_0xa9a1('0x5b')](_0x345b98['startPredictive'])&&!_['isUndefined'](_0x345b98[_0xa9a1('0x27')])){_0x345b98[_0xa9a1('0x69')]=moment()[_0xa9a1('0x49')](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1d2'),_0x345b98['startPredictive']);hopperUtils[_0xa9a1('0x1d3')](_0x345b98['dialPredictiveInterval'])[_0xa9a1('0x42')](this['getDataPredictive'](_0x345b98))[_0xa9a1('0x42')](mergeDataErlangB(_0x345b98))['then'](this[_0xa9a1('0x1d4')](_0x345b98))[_0xa9a1('0xa7')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x345b98));}else if(!ifInterval(_0x345b98[_0xa9a1('0x1d5')],_0x345b98[_0xa9a1('0x69')])){_0x345b98['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x345b98[_0xa9a1('0x69')]=moment()['format'](_0xa9a1('0xcb'));loggerPredictive[_0xa9a1('0x4e')](_0x345b98[_0xa9a1('0x4b')],_0xa9a1('0x1d6'),_0x345b98[_0xa9a1('0x69')]);clearInterval(_0x345b98[_0xa9a1('0x6b')]);_0x345b98['handlePredictive']=undefined;hopperUtils[_0xa9a1('0x1d3')](_0x345b98[_0xa9a1('0x1d5')])[_0xa9a1('0x42')](this['getDataPredictive'](_0x345b98))['then'](mergeDataErlangB(_0x345b98))['then'](this['startMethodPredictive'](_0x345b98))[_0xa9a1('0xa7')](loggerCatchPredictive(_0xa9a1('0x1d7'),_0x345b98));}else if(_0x345b98[_0xa9a1('0x1bf')]&&_0x3ab922<_0x345b98['predictiveIntervalAvailable']-_0x3db33b){clearPredictiveAttributes(_0x345b98);loggerPredictive['info'](_0x345b98[_0xa9a1('0x4b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3ab922,')\x20are\x20less\x20than\x20threshold\x20(',_0x345b98[_0xa9a1('0x1bf')],'-',_0x3db33b,'=',_0x345b98[_0xa9a1('0x1bf')]-_0x3db33b,')');}else if(_0x345b98[_0xa9a1('0x1bf')]&&_0x3ab922>_0x345b98['predictiveIntervalAvailable']+_0x5bbaea){clearPredictiveAttributes(_0x345b98);loggerPredictive['info'](_0x345b98['name'],_0xa9a1('0x1d8'),_0x3ab922,_0xa9a1('0x1d9'),_0x345b98[_0xa9a1('0x1bf')],'+',_0x5bbaea,'=',_0x345b98['predictiveIntervalAvailable']+_0x5bbaea,')');}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1da')]=function(_0x4a9569){var _0x44c310=this;return function(_0x526da2){return new Promise(function(_0x3ac34f,_0x44c6b7){_['merge'](_0x4a9569,_0x526da2[0x0]);if(checkGetDataPredictive(_0x526da2[0x0])){var _0x2a3859=_0x4a9569['predictiveIntervalAvailable']=_0x4a9569[_0xa9a1('0x1db')]+_0x4a9569[_0xa9a1('0x143')];var _0x3865d9=_0x4a9569[_0xa9a1('0x1d5')]*0x3c;var _0x2d3440=_0x526da2[0x0][_0xa9a1('0x59')]+_0x526da2[0x0][_0xa9a1('0x57')];var _0x48bb44=(_0x526da2[0x0][_0xa9a1('0x52')]+_0x526da2[0x0][_0xa9a1('0x54')]+_0x526da2[0x0][_0xa9a1('0x56')])/_0x526da2[0x0][_0xa9a1('0x50')];_0x4a9569[_0xa9a1('0x1c5')]=_0x48bb44>0x0?_0x48bb44:0x1;switch(_0x4a9569[_0xa9a1('0x1cc')]){case _0xa9a1('0x1cd'):var _0x516ac8=_0x4a9569[_0xa9a1('0x1be')]/0x64;return _0x44c310[_0xa9a1('0x1dc')](_0x2a3859,_0x3865d9,_0x2d3440,_0x48bb44,_0x516ac8)['then'](function(_0x1e63ed){return _0x3ac34f(_0x1e63ed);});case _0xa9a1('0x1dd'):var _0xbe4fb5=_0x4a9569['dialPredictiveOptimizationPercentage']/0x64;return _0x44c310[_0xa9a1('0x1de')](_0x2a3859,_0x3865d9,_0x2d3440,_0x48bb44,_0xbe4fb5)[_0xa9a1('0x42')](function(_0x296b2b){return _0x3ac34f(_0x296b2b);});default:return _0x44c6b7(msgResponse(_0xa9a1('0x1df'),_0xa9a1('0x9e'),'Unknown\x20Predictive'));}}else{return _0x44c6b7(msgResponse(_0xa9a1('0x1df'),'Failure',_0xa9a1('0x1e0')));}});};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1e1')]=function(_0x5e9f16){var _0x368cf2=this;return function(_0x19781f){return new Promise(function(_0x32cd88,_0x28fd2e){_[_0xa9a1('0x66')](_0x5e9f16,_0x19781f[0x0]);if(checkGetDataPredictive(_0x19781f[0x0])){loggerPredictive['info'](JSON[_0xa9a1('0x7e')](_0x19781f[0x0]));if(_0x5e9f16[_0xa9a1('0x1cc')]===_0xa9a1('0x1cd')){return _0x368cf2[_0xa9a1('0x158')](_0x5e9f16['id'])[_0xa9a1('0x42')](function(_0x5416ca){var _0x190d7a=_0x5e9f16[_0xa9a1('0x1e2')]-_0x5416ca[0x0][_0xa9a1('0x1e3')];var _0x4dd20f=_0x5e9f16['dialPredictiveInterval']*0x3c;var _0x1c92bd=_0x19781f[0x0][_0xa9a1('0x59')]+_0x19781f[0x0][_0xa9a1('0x57')];var _0x4d3ade=(_0x19781f[0x0][_0xa9a1('0x52')]+_0x19781f[0x0][_0xa9a1('0x54')]+_0x19781f[0x0][_0xa9a1('0x56')])/_0x19781f[0x0]['predictiveIntervalTotalCalls'];var _0x44fa39=_0x5e9f16['dialPredictiveOptimizationPercentage']/0x64;_0x5e9f16[_0xa9a1('0x1e4')]=_0x5416ca[0x0][_0xa9a1('0x1e3')]||0x0;_0x5e9f16[_0xa9a1('0x1c5')]=_0x4d3ade>0x0?_0x4d3ade:0x1;return _0x368cf2[_0xa9a1('0x1dc')](_0x190d7a,_0x4dd20f,_0x1c92bd,_0x4d3ade,_0x44fa39);})[_0xa9a1('0x42')](function(_0x197e2c){return _0x32cd88(_0x197e2c);})[_0xa9a1('0xa7')](function(_0x55aed8){return _0x28fd2e(msgResponse(_0xa9a1('0x1e5'),'Failure',JSON[_0xa9a1('0x7e')](_0x55aed8)));});}if(_0x5e9f16[_0xa9a1('0x1cc')]===_0xa9a1('0x1dd')){return _0x368cf2[_0xa9a1('0x158')](_0x5e9f16['id'])[_0xa9a1('0x42')](function(_0xc519b6){var _0x2c3238=_0x5e9f16[_0xa9a1('0x1e2')]-_0xc519b6[0x0]['outboundQueuePauses'];var _0x3ba225=_0x5e9f16[_0xa9a1('0x1d5')]*0x3c;var _0xaa4400=_0x19781f[0x0][_0xa9a1('0x59')]+_0x19781f[0x0][_0xa9a1('0x57')];var _0x5978dd=(_0x19781f[0x0]['predictiveIntervalAnsweredCalls']+_0x19781f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x19781f[0x0][_0xa9a1('0x56')])/_0x19781f[0x0]['predictiveIntervalTotalCalls'];var _0xf8879c=_0x5e9f16[_0xa9a1('0x1be')]/0x64;_0x5e9f16[_0xa9a1('0x1e4')]=_0xc519b6[0x0][_0xa9a1('0x1e3')]||0x0;_0x5e9f16['predictiveIntervalHitRate']=_0x5978dd>0x0?_0x5978dd:0x1;return _0x368cf2[_0xa9a1('0x1de')](_0x2c3238,_0x3ba225,_0xaa4400,_0x5978dd,_0xf8879c);})[_0xa9a1('0x42')](function(_0x8feb16){return _0x32cd88(_0x8feb16);})[_0xa9a1('0xa7')](function(_0x51c10f){return _0x28fd2e(msgResponse('[CatchErlangB]',_0xa9a1('0x9e'),JSON[_0xa9a1('0x7e')](_0x51c10f)));});}}else{return _0x28fd2e(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1d4')]=function(_0x3c9860){var _0x3c7924=this;return function(){var _0x409e7=0x0;var _0x117995=Math[_0xa9a1('0x1c3')](_0x3c9860[_0xa9a1('0x1e6')]*0x3e8);if(_0x117995>0x0){_0x117995=_0x117995<0x64?0x64:_0x117995;loggerPredictive[_0xa9a1('0x4e')](_0x3c9860[_0xa9a1('0x4b')],_0xa9a1('0x1e7'),_0x117995,'milliseconds');_0x3c9860[_0xa9a1('0x6b')]=setInterval(function(){_0x3c7924['handlePredictive'](_0x3c9860);loggerPredictiveCalls[_0xa9a1('0x4e')]('[handlePredictive]',_0x409e7+=0x1);},_0x117995);}else{loggerPredictive[_0xa9a1('0x4e')](_0x3c9860[_0xa9a1('0x4b')],_0xa9a1('0x1e8'));}};};Dialer['prototype'][_0xa9a1('0x1e9')]=function(_0x205f63,_0x4db374){var _0x2536d3=this;return function(_0x413483){if(_['isEmpty'](_0x413483)){if(_[_0xa9a1('0xfc')](_0x4db374[_0xa9a1('0x15b')])||!_0x4db374[_0xa9a1('0x1ea')]){if(_0x205f63[_0xa9a1('0xb4')]===_0xa9a1('0xb9')){_0x205f63[_0xa9a1('0x7b')]=_[_0xa9a1('0x5b')](_0x205f63[_0xa9a1('0x7b')])?!![]:_0x205f63['queueStatusComplete'];var _0x4990bd=uuid['v4']();_0x2536d3[_0xa9a1('0x24')][_0x4990bd]=new Action(_0x205f63,_0x4db374,_0x4990bd);loggerBooked[_0xa9a1('0x4e')](_0xa9a1('0x1eb'),_0x4990bd,_0xa9a1('0x1ec'),JSON['stringify'](_0x205f63[_0xa9a1('0x7b')]),'Queue:\x20',_0x205f63['name']);if(_0x205f63[_0xa9a1('0x7b')]){_0x205f63[_0xa9a1('0x7b')]=![];_0x2536d3[_0xa9a1('0x29')][_0x2536d3['actions'][_0x4990bd]['queue']]=[];ami['Action']({'actionid':_0x4990bd,'action':'queuestatus','queue':_0x205f63['name']})[_0xa9a1('0xa7')](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe7')],'ListId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe8')],'VoiceQueueId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2536d3['actions'][_0x4990bd][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ed')));delete _0x2536d3['actions'][_0x4990bd];});}else{loggerBooked['info'](_0xa9a1('0x1ee'),JSON[_0xa9a1('0x7e')](_0x205f63['queueStatusComplete']),_0xa9a1('0x1ef'),_0x205f63[_0xa9a1('0x4b')]);_0x2536d3[_0xa9a1('0xc8')](_0x205f63);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe7')],'ListId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd]['ListId'],'VoiceQueueId':_0x2536d3[_0xa9a1('0x24')][_0x4990bd][_0xa9a1('0xe9')]||undefined,'CampaignId':_0x2536d3['actions'][_0x4990bd][_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1ed')));delete _0x2536d3['actions'][_0x4990bd];}}else{return _0x2536d3[_0xa9a1('0x161')](_0x205f63,_0x4db374);}}else{if(utils[_0xa9a1('0x67')](undefined,_0x4db374[_0xa9a1('0x1f0')])<_0x205f63[_0xa9a1('0x1f1')]*0x3c){if(_0x4db374[_0xa9a1('0x14f')]&&!_0x4db374[_0xa9a1('0x14f')]['voicePause']){_0x2536d3[_0xa9a1('0x103')]['run'](_0x4db374['id'])[_0xa9a1('0x1d')](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);});}else{hopperUtils[_0xa9a1('0x1f2')]({'active':![]},_0x4db374['id'],0x1)['finally'](function(){_0x2536d3[_0xa9a1('0xc8')](_0x205f63);});}}else{_0x205f63[_0xa9a1('0x1f3')]+=0x1;_0x2536d3[_0xa9a1('0xc8')](_0x205f63);if(_0x205f63[_0xa9a1('0x1f4')]){hopperUtils[_0xa9a1('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4db374['ContactId'],'ListId':_0x4db374[_0xa9a1('0xe8')],'VoiceQueueId':_0x4db374[_0xa9a1('0xe9')]||undefined,'CampaignId':_0x4db374[_0xa9a1('0xea')]||undefined})[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1f5')));hopperUtils['createHistory'](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1f6')],0x17,_0xa9a1('0x1f7')))[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x1f8')));}else{_0x2536d3[_0xa9a1('0x134')](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1f9')],0x16,'RecallFailedTimeout'),_0xa9a1('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x205f63[_0xa9a1('0x1fb')]+=0x1;_0x2536d3[_0xa9a1('0x134')](createObjHistory(_0x205f63,_0x4db374,utils[_0xa9a1('0x73')][_0xa9a1('0x1fc')],0xd,'Blacklist'),_0xa9a1('0x1fd'),'[Originate][MoveBlacklist]');throw _0xa9a1('0x1fe');}};};Dialer['prototype'][_0xa9a1('0x160')]=function(_0x59bd70){var _0x44efb6=this;var _0x2b9af9=_0x59bd70[_0xa9a1('0x1ff')]-_0x59bd70[_0xa9a1('0x87')];emitCampaignSummary(_0x59bd70);if(_0x2b9af9>0x0&&_0x59bd70[_0xa9a1('0x70')]==0x0){if(_0x2b9af9>this[_0xa9a1('0x200')]){_0x2b9af9=this[_0xa9a1('0x200')];}_0x59bd70[_0xa9a1('0x70')]=0x1;hopperUtils[_0xa9a1('0x201')](_0x59bd70,_0x2b9af9)[_0xa9a1('0x42')](function(_0x40c24a){_0x59bd70[_0xa9a1('0x70')]=0x0;if(_0x40c24a){if(!utils[_0xa9a1('0x202')](_0x40c24a)){_0x59bd70[_0xa9a1('0x72')]=utils['CAMPAIGN_STATUS'][_0xa9a1('0x203')];logger[_0xa9a1('0x4e')](_0xa9a1('0x204')+_0x59bd70[_0xa9a1('0x4b')]);}else{_0x59bd70['originated']+=_0x40c24a[_0xa9a1('0x108')];_0x59bd70[_0xa9a1('0x72')]=utils[_0xa9a1('0x73')][_0xa9a1('0x205')];for(var _0x3b8eff=0x0;_0x3b8eff<_0x40c24a[_0xa9a1('0x108')];_0x3b8eff+=0x1){_0x59bd70[_0xa9a1('0x206')]+=0x1;if(_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff])||_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff][_0xa9a1('0x207')])||_[_0xa9a1('0xfc')](_0x40c24a[_0x3b8eff][_0xa9a1('0x165')])){_0x44efb6[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x59bd70,_0x40c24a[_0x3b8eff]);}else{hopperUtils[_0xa9a1('0x209')](_[_0xa9a1('0x10b')](_0x40c24a[_0x3b8eff],[_0xa9a1('0xea'),_0xa9a1('0x165')]))[_0xa9a1('0x42')](_0x44efb6[_0xa9a1('0x1e9')](_0x59bd70,_0x40c24a[_0x3b8eff]))['catch'](_0x44efb6[_0xa9a1('0x20a')]('[actionOriginateIvr]\x20',_0x59bd70));}}}}})[_0xa9a1('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x59bd70,_0x2b9af9));}};Dialer[_0xa9a1('0x1a')]['handlePower']=function(_0x45fc89,_0x267d5d){var _0x3687c2=this;var _0x2ede89=[];if(_0x267d5d<0x1||_0x45fc89['dialMethod']===_0xa9a1('0xb9')){_0x267d5d=0x1;}var _0x36e66a=Math['floor'](_0x45fc89[_0xa9a1('0x143')]*_0x267d5d)-_0x45fc89[_0xa9a1('0x87')];if(_0x45fc89['dialLimitQueue']>0x0){var _0x1210df=_0x45fc89[_0xa9a1('0x20b')]-_0x45fc89['originated']-_0x45fc89[_0xa9a1('0x1db')]-_0x45fc89[_0xa9a1('0x145')];if(_0x36e66a>_0x1210df){_0x36e66a=_0x1210df;}}if(_0x36e66a>0x0&&_0x45fc89[_0xa9a1('0x70')]==0x0){if(_0x45fc89[_0xa9a1('0xb4')]===_0xa9a1('0xb9')){_0x36e66a=0x1;}if(_0x36e66a>this[_0xa9a1('0x200')]){_0x36e66a=this[_0xa9a1('0x200')];}for(var _0x25fa35 in this['agents']){if(typeof this[_0xa9a1('0x21')][_0x25fa35]!==_0xa9a1('0xae')){if(this[_0xa9a1('0x21')][_0x25fa35][_0xa9a1('0x78')]===_0xa9a1('0x20c')&&this[_0xa9a1('0x21')][_0x25fa35]['status']===_0xa9a1('0x90')){_0x2ede89[_0xa9a1('0xa5')](this[_0xa9a1('0x21')][_0x25fa35]['id']);}}}_0x45fc89['temp']=0x1;hopperUtils[_0xa9a1('0x20d')](_0x45fc89,_0x2ede89,_0x36e66a)[_0xa9a1('0x42')](function(_0x4a4471){_0x45fc89[_0xa9a1('0x70')]=0x0;if(_0x4a4471){if(!utils[_0xa9a1('0x202')](_0x4a4471)){hopperUtils[_0xa9a1('0x20e')](_0x45fc89)[_0xa9a1('0x42')](sendMessageReschedule(_0x45fc89))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x45fc89[_0xa9a1('0x87')]+=_0x4a4471[_0xa9a1('0x108')];_0x45fc89[_0xa9a1('0x72')]=_0x45fc89[_0xa9a1('0xb4')]==='booked'?utils[_0xa9a1('0x73')][_0xa9a1('0x146')]:utils[_0xa9a1('0x73')][_0xa9a1('0x205')];for(var _0x5ac67f=0x0;_0x5ac67f<_0x4a4471[_0xa9a1('0x108')];_0x5ac67f+=0x1){if(_[_0xa9a1('0xfc')](_0x4a4471[_0x5ac67f])||_['isNil'](_0x4a4471[_0x5ac67f][_0xa9a1('0x207')])||_['isNil'](_0x4a4471[_0x5ac67f][_0xa9a1('0x165')])){_0x3687c2[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x45fc89,_0x4a4471[_0x5ac67f]);}else{hopperUtils[_0xa9a1('0x20f')](_[_0xa9a1('0x10b')](_0x4a4471[_0x5ac67f],[_0xa9a1('0xe9'),_0xa9a1('0x165')]))['then'](_0x3687c2[_0xa9a1('0x1e9')](_0x45fc89,_0x4a4471[_0x5ac67f]))['catch'](_0x3687c2[_0xa9a1('0x20a')](_0xa9a1('0x208'),_0x45fc89));}}}}})['catch'](loggerGetContactDialer(_0xa9a1('0x210'),_0x45fc89,_0x36e66a));}};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x6b')]=function(_0x410be1){if(_0x410be1[_0xa9a1('0x20b')]>0x0){var _0x2dac52=_0x410be1[_0xa9a1('0x20b')]-_0x410be1[_0xa9a1('0x87')]-_0x410be1[_0xa9a1('0x1db')];if(_0x2dac52>0x0&&_0x410be1[_0xa9a1('0x70')]==0x0){this[_0xa9a1('0x211')](_0x410be1);}else{loggerPredictiveCalls['info'](_0xa9a1('0x212'));}}else{this[_0xa9a1('0x211')](_0x410be1);}};Dialer[_0xa9a1('0x1a')]['tryOriginatePredictive']=function(_0x4f75c7){var _0x4967d4=this;var _0x365a5a=[];_0x4f75c7[_0xa9a1('0x87')]+=0x1;for(var _0x5f1660 in this[_0xa9a1('0x21')]){if(typeof this['agents'][_0x5f1660]!=='undefined'){if(this['agents'][_0x5f1660]['state']===_0xa9a1('0x20c')&&this[_0xa9a1('0x21')][_0x5f1660][_0xa9a1('0x91')]==='reachable'){_0x365a5a[_0xa9a1('0xa5')](this[_0xa9a1('0x21')][_0x5f1660]['id']);}}}_0x4f75c7[_0xa9a1('0x70')]=0x1;return this[_0xa9a1('0x20d')](_0x4f75c7['id'],_0x365a5a,0x1,_0x4f75c7['dialOrderByScheduledAt'],_0x4f75c7)['then'](function(_0x293eb1){_0x4f75c7['temp']=0x1;if(_0x293eb1){if(!utils[_0xa9a1('0x202')](_0x293eb1)){utils['checkContactLowerLimitOriginate'](_0x4f75c7,0x1,0x0);return hopperUtils[_0xa9a1('0x20e')](_0x4f75c7)[_0xa9a1('0x42')](sendMessageReschedule(_0x4f75c7))[_0xa9a1('0xa7')](loggerCatch(_0xa9a1('0x213')));}else{_0x4f75c7['message']=utils['CAMPAIGN_STATUS'][_0xa9a1('0x205')];if(_['isNil'](_0x293eb1[0x0])||_[_0xa9a1('0xfc')](_0x293eb1[0x0]['Contact'])||_['isNil'](_0x293eb1[0x0][_0xa9a1('0x165')])){_0x4967d4[_0xa9a1('0x159')](_0xa9a1('0x208'),_0x4f75c7,_0x293eb1[0x0]);}else{return hopperUtils[_0xa9a1('0x20f')](_[_0xa9a1('0x10b')](_0x293eb1[0x0],['VoiceQueueId',_0xa9a1('0x165')]))[_0xa9a1('0x42')](_0x4967d4[_0xa9a1('0x1e9')](_0x4f75c7,_0x293eb1[0x0]))[_0xa9a1('0xa7')](_0x4967d4['loggerHandler']('[actionOriginatePredictive]\x20',_0x4f75c7));}}}})[_0xa9a1('0xa7')](loggerGetContactDialer(_0xa9a1('0x214'),_0x4f75c7,0x1));};Dialer[_0xa9a1('0x1a')][_0xa9a1('0x1dc')]=function(_0x535eab,_0x59f953,_0x72edc8,_0x3f33f2,_0x43bd47,_0x3a0345){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x215'));loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x216'),_0x535eab);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59f953);loggerPredictive[_0xa9a1('0x4e')]('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',_0x72edc8);loggerPredictive['info'](_0xa9a1('0x217'),_0x3f33f2);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x218'),_0x43bd47);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x5a'));return new Promise(function(_0xc28b49,_0x164a4e){if(_0x535eab<=0x0||isNaN(_0x535eab)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),'m\x20=\x20'+_0x535eab));}if(_0x72edc8<=0x0||isNaN(_0x72edc8)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),_0xa9a1('0x21a')+_0x72edc8));}if(_0x3f33f2<=0x0||isNaN(_0x3f33f2)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),_0xa9a1('0x8d'),_0xa9a1('0x21b')+_0x3f33f2));}if(_0x59f953<=0x0||isNaN(_0x59f953)){return _0x164a4e(msgResponse(_0xa9a1('0x219'),'Error','interval\x20=\x20'+_0x59f953));}if(_0x43bd47<=0x0||isNaN(_0x43bd47)){return _0x164a4e(msgResponse('[abandonmentRate]',_0xa9a1('0x8d'),_0xa9a1('0x21c')+_0x43bd47));}_0x3a0345=_0x3a0345||0x0;var _0x18fcc4=0x1/_0x72edc8;var _0x5ce02b=0x0;var _0x4492a7=0x0;var _0x472b25=0x0;var _0x55e362=0x0;for(var _0x381272=0x0;_0x472b25<_0x43bd47;_0x381272+=0x1){_0x4492a7=_0x381272/_0x59f953;_0x5ce02b=(_0x3f33f2*_0x4492a7+_0x3a0345)/_0x18fcc4;_0x472b25=utils[_0xa9a1('0x21d')](_0x5ce02b,_0x535eab);_0x55e362=_0x5ce02b/_0x535eab*(0x1-utils['erlangb'](_0x5ce02b,_0x535eab));}return _0xc28b49({'erlangCalls':_0x381272,'erlangCallToSecond':_0x59f953/_0x381272,'erlangAbandonmentRate':_0x472b25,'erlangBusyFactor':_0x55e362});});};Dialer['prototype'][_0xa9a1('0x1de')]=function(_0x7972bc,_0x6721e0,_0x13528b,_0x46bcc2,_0x30965a,_0x49e637){loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x21e'));loggerPredictive['info'](_0xa9a1('0x216'),_0x7972bc);loggerPredictive['info'](_0xa9a1('0x21f'),_0x6721e0);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x220'),_0x13528b);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x217'),_0x46bcc2);loggerPredictive[_0xa9a1('0x4e')](_0xa9a1('0x221'),_0x30965a);loggerPredictive[_0xa9a1('0x4e')]('---------------------------');return new Promise(function(_0x3ab54c,_0x56250d){if(_0x7972bc<=0x0||isNaN(_0x7972bc)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),'m\x20=\x20'+_0x7972bc));}if(_0x13528b<=0x0||isNaN(_0x13528b)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),_0xa9a1('0x21a')+_0x13528b));}if(_0x46bcc2<=0x0||isNaN(_0x46bcc2)){return _0x56250d(msgResponse(_0xa9a1('0x222'),_0xa9a1('0x8d'),'p\x20=\x20'+_0x46bcc2));}if(_0x6721e0<=0x0||isNaN(_0x6721e0)){return _0x56250d(msgResponse(_0xa9a1('0x222'),'Error','interval\x20=\x20'+_0x6721e0));}if(_0x30965a<=0x0||isNaN(_0x30965a)){return _0x56250d(msgResponse('[busyFactor]','Error',_0xa9a1('0x223')+_0x30965a));}_0x49e637=_0x49e637||0x0;var _0x5e3de2=0x1/_0x13528b;var _0x311420=0x0;var _0x573795=0x0;var _0x30dbc5=0x0;var _0x2a7008=0x0;for(var _0x4e81d6=0x0;_0x2a7008<_0x30965a;_0x4e81d6+=0x1){_0x573795=_0x4e81d6/_0x6721e0;_0x311420=(_0x46bcc2*_0x573795+_0x49e637)/_0x5e3de2;_0x30dbc5=utils[_0xa9a1('0x21d')](_0x311420,_0x7972bc);_0x2a7008=_0x311420/_0x7972bc*(0x1-utils[_0xa9a1('0x21d')](_0x311420,_0x7972bc));}return _0x3ab54c({'erlangCalls':_0x4e81d6,'erlangCallToSecond':_0x6721e0/_0x4e81d6,'erlangAbandonmentRate':_0x30dbc5,'erlangBusyFactor':_0x2a7008});});};module[_0xa9a1('0x224')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 5212e8a..0e88027 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ebc=['callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','lodash','isNil','string','voiceQueue','Contact','phone','firstName','lastName','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x6ebc,0x18f));var _0xc6eb=function(_0x29a578,_0x406599){_0x29a578=_0x29a578-0x0;var _0x1cebfe=_0x6ebc[_0x29a578];return _0x1cebfe;};'use strict';var util=require('util');var _=require(_0xc6eb('0x0'));var moment=require('moment');function checkNameSurname(_0x98316b,_0x4cfbec,_0x4e210f){var _0x48718b='';if(!_[_0xc6eb('0x1')](_0x4cfbec)&&_0xc6eb('0x2')===typeof _0x4cfbec){_0x48718b+=_0x4cfbec;}if(!_[_0xc6eb('0x1')](_0x4e210f)&&_0xc6eb('0x2')===typeof _0x4e210f){_0x48718b+='\x20'+_0x4e210f;}if(_0x48718b!==''){return _0x48718b;}return _0x98316b;}function Action(_0x3e8f1d,_0x20e3ae,_0x5b93b3){this[_0xc6eb('0x3')]=_0x3e8f1d;this['uniqueid']=_0x5b93b3||undefined;this['name']=checkNameSurname(_0x20e3ae[_0xc6eb('0x4')][_0xc6eb('0x5')],_0x20e3ae[_0xc6eb('0x4')][_0xc6eb('0x6')],_0x20e3ae[_0xc6eb('0x4')][_0xc6eb('0x7')]);this['number']=_0x20e3ae[_0xc6eb('0x5')];this[_0xc6eb('0x8')]=_0x3e8f1d[_0xc6eb('0x9')];this[_0xc6eb('0xa')]=_0x20e3ae[_0xc6eb('0xa')]||![];this['type']=_0x3e8f1d['type'];this['dialQueueTimeout']=_0x3e8f1d[_0xc6eb('0xb')]||0x3;this[_0xc6eb('0xc')]=_0x20e3ae[_0xc6eb('0xc')];this[_0xc6eb('0xd')]=_0x20e3ae[_0xc6eb('0xd')];this[_0xc6eb('0xe')]=_0x20e3ae[_0xc6eb('0xe')];this['countnoanswerretry']=_0x20e3ae['countnoanswerretry'];this[_0xc6eb('0xf')]=_0x20e3ae[_0xc6eb('0xf')];this['countdropretry']=_0x20e3ae[_0xc6eb('0x10')];this['countabandonedretry']=_0x20e3ae['countabandonedretry'];this[_0xc6eb('0x11')]=_0x20e3ae[_0xc6eb('0x11')];this[_0xc6eb('0x12')]=_0x20e3ae[_0xc6eb('0x12')];this[_0xc6eb('0x13')]=_0x20e3ae[_0xc6eb('0x13')];this[_0xc6eb('0x14')]=_0x20e3ae[_0xc6eb('0x14')];this[_0xc6eb('0x15')]=_0x20e3ae[_0xc6eb('0x15')];this[_0xc6eb('0x16')]=_0x20e3ae[_0xc6eb('0x16')];this[_0xc6eb('0x17')]=_0x20e3ae[_0xc6eb('0x17')];this[_0xc6eb('0x18')]=_0x20e3ae['id'];this[_0xc6eb('0x19')]=_0x20e3ae[_0xc6eb('0x4')]['firstName']||'';this[_0xc6eb('0x1a')]=moment()[_0xc6eb('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc6eb('0x1c')]=_0x20e3ae[_0xc6eb('0x1c')];this['callbackuniqueid']=_0x20e3ae[_0xc6eb('0x1d')];this[_0xc6eb('0x1e')]=_0x20e3ae[_0xc6eb('0x1e')];this[_0xc6eb('0x1f')]=_0x20e3ae[_0xc6eb('0x1f')];this['originatecalleridnum']='';this[_0xc6eb('0x20')]='';}Action[_0xc6eb('0x21')]['getCaller']=function(){return util[_0xc6eb('0x1b')](_0xc6eb('0x22'),this['name'],this[_0xc6eb('0x3')][_0xc6eb('0x23')]>0x0?this[_0xc6eb('0x24')][_0xc6eb('0x25')](this['voiceQueue']['dialCutDigit']):this['number']);};Action[_0xc6eb('0x21')][_0xc6eb('0x26')]=function(){return this[_0xc6eb('0x8')];};module['exports']=Action; \ No newline at end of file +var _0x30b9=['countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','phone','Contact','firstName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x384cc5,_0x455808){var _0x168506=function(_0x120216){while(--_0x120216){_0x384cc5['push'](_0x384cc5['shift']());}};_0x168506(++_0x455808);}(_0x30b9,0xc8));var _0x930b=function(_0x2df7de,_0x39c21c){_0x2df7de=_0x2df7de-0x0;var _0xc03169=_0x30b9[_0x2df7de];return _0xc03169;};'use strict';var util=require(_0x930b('0x0'));var _=require('lodash');var moment=require(_0x930b('0x1'));function checkNameSurname(_0x3f0941,_0x5378a6,_0x317edf){var _0x54672c='';if(!_[_0x930b('0x2')](_0x5378a6)&&_0x930b('0x3')===typeof _0x5378a6){_0x54672c+=_0x5378a6;}if(!_[_0x930b('0x2')](_0x317edf)&&_0x930b('0x3')===typeof _0x317edf){_0x54672c+='\x20'+_0x317edf;}if(_0x54672c!==''){return _0x54672c;}return _0x3f0941;}function Action(_0xff4fca,_0x1a3ea2,_0x2734d5){this[_0x930b('0x4')]=_0xff4fca;this['uniqueid']=_0x2734d5||undefined;this['name']=checkNameSurname(_0x1a3ea2['Contact'][_0x930b('0x5')],_0x1a3ea2[_0x930b('0x6')][_0x930b('0x7')],_0x1a3ea2['Contact']['lastName']);this[_0x930b('0x8')]=_0x1a3ea2['phone'];this['queue']=_0xff4fca[_0x930b('0x9')];this[_0x930b('0xa')]=_0x1a3ea2[_0x930b('0xa')]||![];this['type']=_0xff4fca[_0x930b('0xb')];this[_0x930b('0xc')]=_0xff4fca[_0x930b('0xc')]||0x3;this[_0x930b('0xd')]=_0x1a3ea2['scheduledat'];this['countbusyretry']=_0x1a3ea2[_0x930b('0xe')];this[_0x930b('0xf')]=_0x1a3ea2[_0x930b('0xf')];this[_0x930b('0x10')]=_0x1a3ea2[_0x930b('0x10')];this[_0x930b('0x11')]=_0x1a3ea2['countnosuchnumberretry'];this[_0x930b('0x12')]=_0x1a3ea2[_0x930b('0x12')];this[_0x930b('0x13')]=_0x1a3ea2[_0x930b('0x13')];this[_0x930b('0x14')]=_0x1a3ea2[_0x930b('0x14')];this[_0x930b('0x15')]=_0x1a3ea2['countagentrejectretry'];this[_0x930b('0x16')]=_0x1a3ea2[_0x930b('0x16')];this[_0x930b('0x17')]=_0x1a3ea2[_0x930b('0x17')];this[_0x930b('0x18')]=_0x1a3ea2[_0x930b('0x18')];this[_0x930b('0x19')]=_0x1a3ea2[_0x930b('0x19')];this[_0x930b('0x1a')]=_0x1a3ea2[_0x930b('0x1a')];this[_0x930b('0x1b')]=_0x1a3ea2['id'];this[_0x930b('0x1c')]=_0x1a3ea2[_0x930b('0x6')][_0x930b('0x7')]||'';this['starttime']=moment()[_0x930b('0x1d')](_0x930b('0x1e'));this['callback']=_0x1a3ea2[_0x930b('0x1f')];this[_0x930b('0x20')]=_0x1a3ea2[_0x930b('0x20')];this[_0x930b('0x21')]=_0x1a3ea2[_0x930b('0x21')];this[_0x930b('0x22')]=_0x1a3ea2[_0x930b('0x22')];this[_0x930b('0x23')]='';this[_0x930b('0x24')]='';}Action[_0x930b('0x25')][_0x930b('0x26')]=function(){return util[_0x930b('0x1d')](_0x930b('0x27'),this[_0x930b('0x9')],this[_0x930b('0x4')][_0x930b('0x28')]>0x0?this[_0x930b('0x8')]['substring'](this[_0x930b('0x4')][_0x930b('0x28')]):this[_0x930b('0x8')]);};Action[_0x930b('0x25')][_0x930b('0x29')]=function(){return this[_0x930b('0x2a')];};module[_0x930b('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index d26823d..1b3f7c9 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94f2=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x395da8,_0x2e076d){var _0x9029a4=function(_0x1e2159){while(--_0x1e2159){_0x395da8['push'](_0x395da8['shift']());}};_0x9029a4(++_0x2e076d);}(_0x94f2,0x1b6));var _0x294f=function(_0x379f9f,_0x41024b){_0x379f9f=_0x379f9f-0x0;var _0x575ca9=_0x94f2[_0x379f9f];return _0x575ca9;};'use strict';var moment=require('moment');var utils=require(_0x294f('0x0'));function AgentComplete(_0x4d6441,_0x168107){this[_0x294f('0x1')]=0x4;this[_0x294f('0x2')]=_0x294f('0x3');this[_0x294f('0x4')]=_0x4d6441[_0x294f('0x4')];this[_0x294f('0x5')]=_0x4d6441[_0x294f('0x5')];this[_0x294f('0x6')]=_0x4d6441[_0x294f('0x5')]===_0x294f('0x7')?'queue':_0x4d6441['type'];this[_0x294f('0x8')]=_0x4d6441[_0x294f('0x8')];this[_0x294f('0x9')]=_0x4d6441['countcongestionretry'];this[_0x294f('0xa')]=_0x4d6441[_0x294f('0xa')];this['countglobal']=_0x4d6441['countbusyretry']+_0x4d6441[_0x294f('0x9')]+_0x4d6441['countnoanswerretry']+_0x4d6441['countnosuchnumberretry']+_0x4d6441['countdropretry']+_0x4d6441[_0x294f('0xb')]+_0x4d6441[_0x294f('0xc')]+_0x4d6441[_0x294f('0xd')];this[_0x294f('0xe')]=_0x4d6441[_0x294f('0xe')];this[_0x294f('0xf')]=_0x4d6441[_0x294f('0xf')];this[_0x294f('0xb')]=_0x4d6441[_0x294f('0xb')];this[_0x294f('0xc')]=_0x4d6441['countmachineretry'];this[_0x294f('0xd')]=_0x4d6441[_0x294f('0xd')];this[_0x294f('0x10')]=_0x168107[_0x294f('0x10')];this[_0x294f('0x11')]=_0x4d6441[_0x294f('0x12')];this[_0x294f('0x13')]=_0x4d6441[_0x294f('0x14')];this[_0x294f('0x15')]=_0x4d6441[_0x294f('0x15')];this['responsetime']=_0x4d6441[_0x294f('0x16')];this['answertime']=_0x4d6441[_0x294f('0x17')];this[_0x294f('0x18')]=moment()[_0x294f('0x19')](_0x294f('0x1a'));this[_0x294f('0x1b')]=utils['getSeconds'](_0x4d6441[_0x294f('0x16')],_0x4d6441['starttime']);this['holdtime']=utils['getSeconds'](_0x4d6441[_0x294f('0x17')],_0x4d6441[_0x294f('0x16')]);this[_0x294f('0x1c')]=utils[_0x294f('0x1d')](this['endtime'],_0x4d6441[_0x294f('0x17')]);this[_0x294f('0x1e')]=_0x168107[_0x294f('0x1e')];this[_0x294f('0x1f')]=_0x168107[_0x294f('0x1f')];this['reason']=_0x168107[_0x294f('0x20')];this['callback']=_0x4d6441[_0x294f('0x21')];this[_0x294f('0x22')]=_0x4d6441['callbackuniqueid'];this[_0x294f('0x23')]=_0x4d6441[_0x294f('0x23')];this['recallme']=_0x4d6441[_0x294f('0x24')];this[_0x294f('0x25')]=_0x4d6441[_0x294f('0x25')];this['ListId']=_0x4d6441[_0x294f('0x26')];this['UserId']=_0x4d6441[_0x294f('0x27')];this[_0x294f('0x28')]=_0x4d6441[_0x294f('0x28')];this[_0x294f('0x29')]=_0x4d6441[_0x294f('0x29')];this[_0x294f('0x2a')]=_0x4d6441[_0x294f('0x2a')]||'';this[_0x294f('0x2b')]=_0x4d6441[_0x294f('0x2b')]||'';this[_0x294f('0x2c')]=_0x4d6441[_0x294f('0x2c')];}module[_0x294f('0x2d')]=AgentComplete; \ No newline at end of file +var _0x7dd6=['holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','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','ringtime'];(function(_0xeeae19,_0x352c6b){var _0x30e449=function(_0x273325){while(--_0x273325){_0xeeae19['push'](_0xeeae19['shift']());}};_0x30e449(++_0x352c6b);}(_0x7dd6,0x13b));var _0x67dd=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x7dd6[_0x1e3c16];return _0x47a0c9;};'use strict';var moment=require('moment');var utils=require(_0x67dd('0x0'));function AgentComplete(_0x3046d6,_0x3f3e2f){this[_0x67dd('0x1')]=0x4;this[_0x67dd('0x2')]=_0x67dd('0x3');this[_0x67dd('0x4')]=_0x3046d6[_0x67dd('0x4')];this[_0x67dd('0x5')]=_0x3046d6[_0x67dd('0x5')];this[_0x67dd('0x6')]=_0x3046d6[_0x67dd('0x5')]===_0x67dd('0x7')?_0x67dd('0x8'):_0x3046d6[_0x67dd('0x5')];this['countbusyretry']=_0x3046d6[_0x67dd('0x9')];this[_0x67dd('0xa')]=_0x3046d6[_0x67dd('0xa')];this[_0x67dd('0xb')]=_0x3046d6[_0x67dd('0xb')];this[_0x67dd('0xc')]=_0x3046d6['countbusyretry']+_0x3046d6[_0x67dd('0xa')]+_0x3046d6[_0x67dd('0xb')]+_0x3046d6[_0x67dd('0xd')]+_0x3046d6[_0x67dd('0xe')]+_0x3046d6[_0x67dd('0xf')]+_0x3046d6[_0x67dd('0x10')]+_0x3046d6['countagentrejectretry'];this[_0x67dd('0xd')]=_0x3046d6['countnosuchnumberretry'];this['countdropretry']=_0x3046d6[_0x67dd('0xe')];this[_0x67dd('0xf')]=_0x3046d6[_0x67dd('0xf')];this[_0x67dd('0x10')]=_0x3046d6[_0x67dd('0x10')];this[_0x67dd('0x11')]=_0x3046d6[_0x67dd('0x11')];this['uniqueid']=_0x3f3e2f[_0x67dd('0x12')];this[_0x67dd('0x13')]=_0x3046d6[_0x67dd('0x14')];this[_0x67dd('0x15')]=_0x3046d6[_0x67dd('0x16')];this[_0x67dd('0x17')]=_0x3046d6[_0x67dd('0x17')];this[_0x67dd('0x18')]=_0x3046d6[_0x67dd('0x18')];this['answertime']=_0x3046d6[_0x67dd('0x19')];this[_0x67dd('0x1a')]=moment()['format'](_0x67dd('0x1b'));this[_0x67dd('0x1c')]=utils['getSeconds'](_0x3046d6[_0x67dd('0x18')],_0x3046d6['starttime']);this[_0x67dd('0x1d')]=utils[_0x67dd('0x1e')](_0x3046d6[_0x67dd('0x19')],_0x3046d6[_0x67dd('0x18')]);this['talktime']=utils[_0x67dd('0x1e')](this[_0x67dd('0x1a')],_0x3046d6[_0x67dd('0x19')]);this[_0x67dd('0x8')]=_0x3f3e2f[_0x67dd('0x8')];this[_0x67dd('0x1f')]=_0x3f3e2f['membername'];this[_0x67dd('0x20')]=_0x3f3e2f[_0x67dd('0x20')];this[_0x67dd('0x21')]=_0x3046d6[_0x67dd('0x21')];this[_0x67dd('0x22')]=_0x3046d6['callbackuniqueid'];this['callbackat']=_0x3046d6[_0x67dd('0x23')];this[_0x67dd('0x24')]=_0x3046d6['recallme'];this['ContactId']=_0x3046d6['ContactId'];this['ListId']=_0x3046d6['ListId'];this[_0x67dd('0x25')]=_0x3046d6['UserId'];this['VoiceQueueId']=_0x3046d6['VoiceQueueId'];this[_0x67dd('0x26')]=_0x3046d6['CampaignId'];this[_0x67dd('0x27')]=_0x3046d6[_0x67dd('0x27')]||'';this[_0x67dd('0x28')]=_0x3046d6['originatecalleridname']||'';this['agiafterat']=_0x3046d6[_0x67dd('0x29')];}module[_0x67dd('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index a85ed1a..5a936ea 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fa5=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry'];(function(_0x17b39c,_0x4d030b){var _0x171c0e=function(_0x599145){while(--_0x599145){_0x17b39c['push'](_0x17b39c['shift']());}};_0x171c0e(++_0x4d030b);}(_0x2fa5,0x1ea));var _0x52fa=function(_0x5f15f4,_0x5efcaf){_0x5f15f4=_0x5f15f4-0x0;var _0x17d662=_0x2fa5[_0x5f15f4];return _0x17d662;};'use strict';function Final(_0x4ea694){this[_0x52fa('0x0')]=_0x4ea694[_0x52fa('0x0')];this[_0x52fa('0x1')]=_0x4ea694[_0x52fa('0x1')];this[_0x52fa('0x2')]=_0x4ea694[_0x52fa('0x2')];this[_0x52fa('0x3')]=_0x4ea694[_0x52fa('0x2')]==='outbound'?'queue':_0x4ea694[_0x52fa('0x2')];this[_0x52fa('0x4')]=_0x4ea694['countbusyretry'];this[_0x52fa('0x5')]=_0x4ea694['countcongestionretry'];this[_0x52fa('0x6')]=_0x4ea694[_0x52fa('0x6')];this['countglobal']=_0x4ea694[_0x52fa('0x4')]+_0x4ea694[_0x52fa('0x5')]+_0x4ea694[_0x52fa('0x6')]+_0x4ea694[_0x52fa('0x7')]+_0x4ea694[_0x52fa('0x8')]+_0x4ea694['countabandonedretry']+_0x4ea694[_0x52fa('0x9')]+_0x4ea694[_0x52fa('0xa')];this['countnosuchnumberretry']=_0x4ea694['countnosuchnumberretry'];this[_0x52fa('0x8')]=_0x4ea694[_0x52fa('0x8')];this[_0x52fa('0xb')]=_0x4ea694[_0x52fa('0xb')];this['countmachineretry']=_0x4ea694['countmachineretry'];this[_0x52fa('0xa')]=_0x4ea694['countagentrejectretry'];this[_0x52fa('0xc')]=_0x4ea694[_0x52fa('0xc')];this[_0x52fa('0xd')]=_0x4ea694[_0x52fa('0xd')];this['calleridnum']=_0x4ea694[_0x52fa('0xe')];this[_0x52fa('0xf')]=_0x4ea694['starttime'];this[_0x52fa('0x10')]=_0x4ea694['responsetime'];this[_0x52fa('0x11')]=_0x4ea694[_0x52fa('0x10')];this[_0x52fa('0x12')]=_0x4ea694[_0x52fa('0x12')]||0x0;this[_0x52fa('0x13')]=_0x4ea694[_0x52fa('0x13')]||0x0;this[_0x52fa('0x14')]=_0x4ea694['talktime']||0x0;this[_0x52fa('0x15')]=_0x4ea694[_0x52fa('0x15')];this[_0x52fa('0x16')]=_0x4ea694[_0x52fa('0x16')];this[_0x52fa('0x17')]=_0x4ea694['callbackat'];this['recallme']=_0x4ea694[_0x52fa('0x18')];this['ContactId']=_0x4ea694[_0x52fa('0x19')];this[_0x52fa('0x1a')]=_0x4ea694[_0x52fa('0x1a')];this['UserId']=_0x4ea694['UserId'];this[_0x52fa('0x1b')]=_0x4ea694[_0x52fa('0x1b')];this['CampaignId']=_0x4ea694[_0x52fa('0x1c')];this[_0x52fa('0x1d')]=_0x4ea694[_0x52fa('0x1d')]||'';this[_0x52fa('0x1e')]=_0x4ea694[_0x52fa('0x1e')]||'';this[_0x52fa('0x1f')]=_0x4ea694[_0x52fa('0x1f')];this['statedesc']=_0x4ea694['statedesc'];}module[_0x52fa('0x20')]=Final; \ No newline at end of file +var _0x0900=['state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0900,0x93));var _0x0090=function(_0x28f689,_0xc1004c){_0x28f689=_0x28f689-0x0;var _0x1a4500=_0x0900[_0x28f689];return _0x1a4500;};'use strict';function Final(_0x339b8e){this[_0x0090('0x0')]=_0x339b8e[_0x0090('0x0')];this[_0x0090('0x1')]=_0x339b8e['scheduledat'];this[_0x0090('0x2')]=_0x339b8e[_0x0090('0x2')];this[_0x0090('0x3')]=_0x339b8e[_0x0090('0x2')]===_0x0090('0x4')?_0x0090('0x5'):_0x339b8e[_0x0090('0x2')];this['countbusyretry']=_0x339b8e[_0x0090('0x6')];this[_0x0090('0x7')]=_0x339b8e[_0x0090('0x7')];this[_0x0090('0x8')]=_0x339b8e[_0x0090('0x8')];this[_0x0090('0x9')]=_0x339b8e['countbusyretry']+_0x339b8e[_0x0090('0x7')]+_0x339b8e['countnoanswerretry']+_0x339b8e['countnosuchnumberretry']+_0x339b8e[_0x0090('0xa')]+_0x339b8e['countabandonedretry']+_0x339b8e['countmachineretry']+_0x339b8e[_0x0090('0xb')];this['countnosuchnumberretry']=_0x339b8e[_0x0090('0xc')];this[_0x0090('0xa')]=_0x339b8e[_0x0090('0xa')];this[_0x0090('0xd')]=_0x339b8e[_0x0090('0xd')];this['countmachineretry']=_0x339b8e['countmachineretry'];this[_0x0090('0xb')]=_0x339b8e['countagentrejectretry'];this[_0x0090('0x5')]=_0x339b8e['queue'];this[_0x0090('0xe')]=_0x339b8e[_0x0090('0xe')];this[_0x0090('0xf')]=_0x339b8e[_0x0090('0xf')];this[_0x0090('0x10')]=_0x339b8e[_0x0090('0x10')];this['responsetime']=_0x339b8e[_0x0090('0x11')];this[_0x0090('0x12')]=_0x339b8e[_0x0090('0x11')];this[_0x0090('0x13')]=_0x339b8e['ringtime']||0x0;this['holdtime']=_0x339b8e[_0x0090('0x14')]||0x0;this['talktime']=_0x339b8e[_0x0090('0x15')]||0x0;this[_0x0090('0x16')]=_0x339b8e[_0x0090('0x16')];this[_0x0090('0x17')]=_0x339b8e[_0x0090('0x17')];this[_0x0090('0x18')]=_0x339b8e[_0x0090('0x18')];this[_0x0090('0x19')]=_0x339b8e[_0x0090('0x19')];this[_0x0090('0x1a')]=_0x339b8e[_0x0090('0x1a')];this[_0x0090('0x1b')]=_0x339b8e[_0x0090('0x1b')];this[_0x0090('0x1c')]=_0x339b8e['UserId'];this[_0x0090('0x1d')]=_0x339b8e[_0x0090('0x1d')];this[_0x0090('0x1e')]=_0x339b8e[_0x0090('0x1e')];this[_0x0090('0x1f')]=_0x339b8e[_0x0090('0x1f')]||'';this[_0x0090('0x20')]=_0x339b8e[_0x0090('0x20')]||'';this[_0x0090('0x21')]=_0x339b8e[_0x0090('0x21')];this[_0x0090('0x22')]=_0x339b8e['statedesc'];}module[_0x0090('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index d3146e0..5968852 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb15=['exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xdb15,0x13c));var _0x5db1=function(_0x2c8e16,_0x2de666){_0x2c8e16=_0x2c8e16-0x0;var _0x845896=_0xdb15[_0x2c8e16];return _0x845896;};'use strict';var moment=require(_0x5db1('0x0'));var utils=require(_0x5db1('0x1'));function Hangup(_0x4067aa,_0x406dd8){this[_0x5db1('0x2')]=0x4;this[_0x5db1('0x3')]=_0x5db1('0x4');this[_0x5db1('0x5')]=_0x4067aa[_0x5db1('0x5')];this[_0x5db1('0x6')]=_0x4067aa['type'];this[_0x5db1('0x7')]=_0x4067aa[_0x5db1('0x6')]===_0x5db1('0x8')?_0x5db1('0x9'):_0x4067aa[_0x5db1('0x6')];this[_0x5db1('0xa')]=_0x4067aa[_0x5db1('0xa')]||![];this[_0x5db1('0xb')]=_0x4067aa[_0x5db1('0xb')];this['countcongestionretry']=_0x4067aa[_0x5db1('0xc')];this['countnoanswerretry']=_0x4067aa['countnoanswerretry'];this['countglobal']=_0x4067aa[_0x5db1('0xb')]+_0x4067aa[_0x5db1('0xc')]+_0x4067aa[_0x5db1('0xd')]+_0x4067aa['countnosuchnumberretry']+_0x4067aa[_0x5db1('0xe')]+_0x4067aa[_0x5db1('0xf')]+_0x4067aa['countmachineretry']+_0x4067aa[_0x5db1('0x10')];this[_0x5db1('0x11')]=_0x4067aa[_0x5db1('0x11')];this['countdropretry']=_0x4067aa[_0x5db1('0xe')];this[_0x5db1('0xf')]=_0x4067aa['countabandonedretry'];this[_0x5db1('0x12')]=_0x4067aa[_0x5db1('0x12')];this[_0x5db1('0x10')]=_0x4067aa[_0x5db1('0x10')];this['uniqueid']=_0x406dd8[_0x5db1('0x13')];this[_0x5db1('0x14')]=_0x4067aa[_0x5db1('0x15')];this['calleridnum']=_0x4067aa[_0x5db1('0x16')];this[_0x5db1('0x17')]=_0x4067aa[_0x5db1('0x17')];this[_0x5db1('0x18')]=_0x4067aa['responsetime'];this[_0x5db1('0x19')]=moment()[_0x5db1('0x1a')](_0x5db1('0x1b'));this[_0x5db1('0x1c')]=utils[_0x5db1('0x1d')](_0x4067aa['responsetime'],_0x4067aa[_0x5db1('0x17')]);this[_0x5db1('0x1e')]=0x0;this[_0x5db1('0x1f')]=utils['getSeconds'](this['endtime'],_0x4067aa[_0x5db1('0x18')]);this[_0x5db1('0x9')]=_0x4067aa['queue'];this[_0x5db1('0x20')]='IVR';this[_0x5db1('0x21')]=_0x406dd8[_0x5db1('0x22')];this[_0x5db1('0x23')]=_0x4067aa['callback'];this['callbackuniqueid']=_0x4067aa[_0x5db1('0x24')];this[_0x5db1('0x25')]=_0x4067aa[_0x5db1('0x25')];this[_0x5db1('0x26')]=_0x4067aa['recallme'];this['ContactId']=_0x4067aa[_0x5db1('0x27')];this[_0x5db1('0x28')]=_0x4067aa['ListId'];this[_0x5db1('0x29')]=_0x4067aa[_0x5db1('0x29')];this['VoiceQueueId']=_0x4067aa[_0x5db1('0x2a')];this[_0x5db1('0x2b')]=_0x4067aa[_0x5db1('0x2b')];}module[_0x5db1('0x2c')]=Hangup; \ No newline at end of file +var _0xe18a=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','IVR','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','scheduledat','type','outbound'];(function(_0x15f5be,_0x449e1d){var _0x3e2687=function(_0xc732a8){while(--_0xc732a8){_0x15f5be['push'](_0x15f5be['shift']());}};_0x3e2687(++_0x449e1d);}(_0xe18a,0xc2));var _0xae18=function(_0x587ec7,_0x4102e5){_0x587ec7=_0x587ec7-0x0;var _0x52a7c4=_0xe18a[_0x587ec7];return _0x52a7c4;};'use strict';var moment=require(_0xae18('0x0'));var utils=require('../utils');function Hangup(_0x26cf66,_0x4bd316){this[_0xae18('0x1')]=0x4;this[_0xae18('0x2')]='Answer';this[_0xae18('0x3')]=_0x26cf66[_0xae18('0x3')];this[_0xae18('0x4')]=_0x26cf66[_0xae18('0x4')];this['campaigntype']=_0x26cf66[_0xae18('0x4')]===_0xae18('0x5')?'queue':_0x26cf66[_0xae18('0x4')];this['amd']=_0x26cf66[_0xae18('0x6')]||![];this[_0xae18('0x7')]=_0x26cf66['countbusyretry'];this[_0xae18('0x8')]=_0x26cf66[_0xae18('0x8')];this[_0xae18('0x9')]=_0x26cf66[_0xae18('0x9')];this[_0xae18('0xa')]=_0x26cf66[_0xae18('0x7')]+_0x26cf66[_0xae18('0x8')]+_0x26cf66['countnoanswerretry']+_0x26cf66['countnosuchnumberretry']+_0x26cf66['countdropretry']+_0x26cf66[_0xae18('0xb')]+_0x26cf66[_0xae18('0xc')]+_0x26cf66[_0xae18('0xd')];this[_0xae18('0xe')]=_0x26cf66[_0xae18('0xe')];this[_0xae18('0xf')]=_0x26cf66['countdropretry'];this[_0xae18('0xb')]=_0x26cf66['countabandonedretry'];this[_0xae18('0xc')]=_0x26cf66['countmachineretry'];this['countagentrejectretry']=_0x26cf66[_0xae18('0xd')];this[_0xae18('0x10')]=_0x4bd316['uniqueid'];this[_0xae18('0x11')]=_0x26cf66[_0xae18('0x12')];this[_0xae18('0x13')]=_0x26cf66[_0xae18('0x14')];this[_0xae18('0x15')]=_0x26cf66[_0xae18('0x15')];this[_0xae18('0x16')]=_0x26cf66[_0xae18('0x16')];this[_0xae18('0x17')]=moment()['format'](_0xae18('0x18'));this['ringtime']=utils[_0xae18('0x19')](_0x26cf66['responsetime'],_0x26cf66[_0xae18('0x15')]);this[_0xae18('0x1a')]=0x0;this['talktime']=utils[_0xae18('0x19')](this['endtime'],_0x26cf66[_0xae18('0x16')]);this[_0xae18('0x1b')]=_0x26cf66[_0xae18('0x1b')];this[_0xae18('0x1c')]=_0xae18('0x1d');this['reason']=_0x4bd316[_0xae18('0x1e')];this['callback']=_0x26cf66[_0xae18('0x1f')];this['callbackuniqueid']=_0x26cf66['callbackuniqueid'];this['callbackat']=_0x26cf66[_0xae18('0x20')];this['recallme']=_0x26cf66[_0xae18('0x21')];this[_0xae18('0x22')]=_0x26cf66[_0xae18('0x22')];this[_0xae18('0x23')]=_0x26cf66[_0xae18('0x23')];this[_0xae18('0x24')]=_0x26cf66[_0xae18('0x24')];this['VoiceQueueId']=_0x26cf66[_0xae18('0x25')];this[_0xae18('0x26')]=_0x26cf66[_0xae18('0x26')];}module[_0xae18('0x27')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index b1fcef6..67c2481 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25e3=['ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','number','starttime','responsetime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x446c4c,_0x35b71e){var _0x153f60=function(_0x2cbef9){while(--_0x2cbef9){_0x446c4c['push'](_0x446c4c['shift']());}};_0x153f60(++_0x35b71e);}(_0x25e3,0xf0));var _0x325e=function(_0x764990,_0x281ab8){_0x764990=_0x764990-0x0;var _0x5ba769=_0x25e3[_0x764990];return _0x5ba769;};'use strict';var utils=require(_0x325e('0x0'));function History(_0x1fe9a2){this[_0x325e('0x1')]=_0x1fe9a2['uniqueid'];this[_0x325e('0x2')]=_0x1fe9a2[_0x325e('0x2')]||undefined;this[_0x325e('0x3')]=_0x1fe9a2['type'];this[_0x325e('0x4')]=_0x1fe9a2['type']==='outbound'?'queue':_0x1fe9a2[_0x325e('0x3')];this['countbusyretry']=_0x1fe9a2[_0x325e('0x5')];this[_0x325e('0x6')]=_0x1fe9a2['countcongestionretry'];this[_0x325e('0x7')]=_0x1fe9a2[_0x325e('0x7')];this[_0x325e('0x8')]=_0x1fe9a2[_0x325e('0x5')]+_0x1fe9a2[_0x325e('0x6')]+_0x1fe9a2[_0x325e('0x7')]+_0x1fe9a2[_0x325e('0x9')]+_0x1fe9a2[_0x325e('0xa')]+_0x1fe9a2['countabandonedretry']+_0x1fe9a2[_0x325e('0xb')]+_0x1fe9a2[_0x325e('0xc')];this[_0x325e('0x9')]=_0x1fe9a2[_0x325e('0x9')];this[_0x325e('0xa')]=_0x1fe9a2['countdropretry'];this[_0x325e('0xd')]=_0x1fe9a2[_0x325e('0xd')];this[_0x325e('0xb')]=_0x1fe9a2[_0x325e('0xb')];this[_0x325e('0xc')]=_0x1fe9a2[_0x325e('0xc')];this[_0x325e('0xe')]=_0x1fe9a2[_0x325e('0xe')];this['calleridname']=_0x1fe9a2['name'];this['calleridnum']=_0x1fe9a2[_0x325e('0xf')];this[_0x325e('0x10')]=_0x1fe9a2[_0x325e('0x10')];this['responsetime']=_0x1fe9a2[_0x325e('0x11')];this['endtime']=_0x1fe9a2[_0x325e('0x11')];this['ringtime']=utils[_0x325e('0x12')](_0x1fe9a2[_0x325e('0x11')],_0x1fe9a2[_0x325e('0x10')]);this['holdtime']=0x0;this[_0x325e('0x13')]=0x0;this['callback']=_0x1fe9a2[_0x325e('0x14')];this[_0x325e('0x15')]=_0x1fe9a2[_0x325e('0x15')];this['callbackat']=_0x1fe9a2[_0x325e('0x16')];this[_0x325e('0x17')]=_0x1fe9a2[_0x325e('0x17')];this[_0x325e('0x18')]=_0x1fe9a2[_0x325e('0x18')];this[_0x325e('0x19')]=_0x1fe9a2['ListId'];this['UserId']=_0x1fe9a2['UserId'];this[_0x325e('0x1a')]=_0x1fe9a2['VoiceQueueId'];this[_0x325e('0x1b')]=_0x1fe9a2[_0x325e('0x1b')];this[_0x325e('0x1c')]=_0x1fe9a2[_0x325e('0x1c')]||'';this[_0x325e('0x1d')]=_0x1fe9a2[_0x325e('0x1d')]||'';this['state']=_0x1fe9a2[_0x325e('0x1e')];this[_0x325e('0x1f')]=_0x1fe9a2[_0x325e('0x1f')];}module[_0x325e('0x20')]=History; \ No newline at end of file +var _0xeeec=['getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x5c12b1,_0x41da52){var _0xc604c9=function(_0x5cd8bc){while(--_0x5cd8bc){_0x5c12b1['push'](_0x5c12b1['shift']());}};_0xc604c9(++_0x41da52);}(_0xeeec,0xc8));var _0xceee=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xeeec[_0x176329];return _0x31997c;};'use strict';var utils=require('../utils');function History(_0x803041){this[_0xceee('0x0')]=_0x803041[_0xceee('0x0')];this[_0xceee('0x1')]=_0x803041['scheduledat']||undefined;this[_0xceee('0x2')]=_0x803041[_0xceee('0x2')];this[_0xceee('0x3')]=_0x803041['type']===_0xceee('0x4')?_0xceee('0x5'):_0x803041['type'];this[_0xceee('0x6')]=_0x803041['countbusyretry'];this['countcongestionretry']=_0x803041[_0xceee('0x7')];this[_0xceee('0x8')]=_0x803041[_0xceee('0x8')];this[_0xceee('0x9')]=_0x803041['countbusyretry']+_0x803041[_0xceee('0x7')]+_0x803041[_0xceee('0x8')]+_0x803041['countnosuchnumberretry']+_0x803041[_0xceee('0xa')]+_0x803041[_0xceee('0xb')]+_0x803041['countmachineretry']+_0x803041['countagentrejectretry'];this[_0xceee('0xc')]=_0x803041['countnosuchnumberretry'];this[_0xceee('0xa')]=_0x803041[_0xceee('0xa')];this[_0xceee('0xb')]=_0x803041['countabandonedretry'];this[_0xceee('0xd')]=_0x803041[_0xceee('0xd')];this[_0xceee('0xe')]=_0x803041[_0xceee('0xe')];this['queue']=_0x803041[_0xceee('0x5')];this[_0xceee('0xf')]=_0x803041[_0xceee('0x10')];this[_0xceee('0x11')]=_0x803041[_0xceee('0x12')];this[_0xceee('0x13')]=_0x803041[_0xceee('0x13')];this[_0xceee('0x14')]=_0x803041[_0xceee('0x14')];this[_0xceee('0x15')]=_0x803041[_0xceee('0x14')];this['ringtime']=utils[_0xceee('0x16')](_0x803041['responsetime'],_0x803041[_0xceee('0x13')]);this[_0xceee('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x803041[_0xceee('0x18')];this[_0xceee('0x19')]=_0x803041[_0xceee('0x19')];this[_0xceee('0x1a')]=_0x803041[_0xceee('0x1a')];this[_0xceee('0x1b')]=_0x803041[_0xceee('0x1b')];this[_0xceee('0x1c')]=_0x803041['ContactId'];this[_0xceee('0x1d')]=_0x803041['ListId'];this['UserId']=_0x803041[_0xceee('0x1e')];this[_0xceee('0x1f')]=_0x803041[_0xceee('0x1f')];this[_0xceee('0x20')]=_0x803041[_0xceee('0x20')];this[_0xceee('0x21')]=_0x803041[_0xceee('0x21')]||'';this[_0xceee('0x22')]=_0x803041['originatecalleridname']||'';this[_0xceee('0x23')]=_0x803041['state'];this[_0xceee('0x24')]=_0x803041['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index c822db2..e481c2d 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78ab=['name','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname'];(function(_0x2f97b6,_0x280440){var _0x5955b7=function(_0x226df3){while(--_0x226df3){_0x2f97b6['push'](_0x2f97b6['shift']());}};_0x5955b7(++_0x280440);}(_0x78ab,0x73));var _0xb78a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x78ab[_0x59ee6f];return _0x4c0979;};'use strict';var utils=require(_0xb78a('0x0'));function QueueCallerAbandon(_0x2c59a4,_0x515b){this['scheduledat']=_0x2c59a4[_0xb78a('0x1')];this[_0xb78a('0x2')]=_0x2c59a4[_0xb78a('0x2')];this[_0xb78a('0x3')]=_0x2c59a4[_0xb78a('0x2')]===_0xb78a('0x4')?_0xb78a('0x5'):_0x2c59a4[_0xb78a('0x2')];this[_0xb78a('0x6')]=_0x2c59a4[_0xb78a('0x6')];this[_0xb78a('0x7')]=_0x2c59a4[_0xb78a('0x7')];this[_0xb78a('0x8')]=_0x2c59a4[_0xb78a('0x8')];this[_0xb78a('0x9')]=_0x2c59a4[_0xb78a('0x6')]+_0x2c59a4['countcongestionretry']+_0x2c59a4[_0xb78a('0x8')]+_0x2c59a4[_0xb78a('0xa')]+_0x2c59a4['countdropretry']+_0x2c59a4[_0xb78a('0xb')]+_0x2c59a4[_0xb78a('0xc')]+_0x2c59a4[_0xb78a('0xd')];this['countnosuchnumberretry']=_0x2c59a4[_0xb78a('0xa')];this[_0xb78a('0xe')]=_0x2c59a4['countdropretry'];this[_0xb78a('0xb')]=_0x2c59a4['countabandonedretry'];this[_0xb78a('0xc')]=_0x2c59a4['countmachineretry'];this[_0xb78a('0xd')]=_0x2c59a4[_0xb78a('0xd')];this['uniqueid']=_0x515b[_0xb78a('0xf')];this[_0xb78a('0x10')]=_0x2c59a4[_0xb78a('0x11')];this['calleridnum']=_0x2c59a4[_0xb78a('0x12')];this['starttime']=_0x2c59a4[_0xb78a('0x13')];this[_0xb78a('0x14')]=_0x2c59a4[_0xb78a('0x14')];this[_0xb78a('0x15')]=_0x2c59a4[_0xb78a('0x15')];this['dropreason']=_0x2c59a4[_0xb78a('0x16')];this['endtime']=this[_0xb78a('0x15')];this[_0xb78a('0x17')]=utils[_0xb78a('0x18')](_0x2c59a4[_0xb78a('0x14')],_0x2c59a4[_0xb78a('0x13')]);this[_0xb78a('0x19')]=utils['getSeconds'](this[_0xb78a('0x15')],_0x2c59a4[_0xb78a('0x14')]);this[_0xb78a('0x1a')]=0x0;this[_0xb78a('0x5')]=_0x515b[_0xb78a('0x5')];this[_0xb78a('0x1b')]=_0x515b['connectedlinename'];this[_0xb78a('0x1c')]=_0x515b[_0xb78a('0x1c')];this['callback']=_0x2c59a4[_0xb78a('0x1d')];this[_0xb78a('0x1e')]=_0x2c59a4[_0xb78a('0x1e')];this[_0xb78a('0x1f')]=_0x2c59a4['callbackat'];this['recallme']=_0x2c59a4[_0xb78a('0x20')];this[_0xb78a('0x21')]=_0x2c59a4['ContactId'];this[_0xb78a('0x22')]=_0x2c59a4[_0xb78a('0x22')];this[_0xb78a('0x23')]=_0x2c59a4[_0xb78a('0x23')];this[_0xb78a('0x24')]=_0x2c59a4[_0xb78a('0x24')];this['CampaignId']=_0x2c59a4[_0xb78a('0x25')];this[_0xb78a('0x26')]=_0x2c59a4[_0xb78a('0x26')]||'';this[_0xb78a('0x27')]=_0x2c59a4[_0xb78a('0x27')]||'';this['agiafterat']=_0x2c59a4[_0xb78a('0x28')];this[_0xb78a('0x29')]=_0x2c59a4['state'];this[_0xb78a('0x2a')]=_0x2c59a4[_0xb78a('0x2a')];}module[_0xb78a('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x3c2f=['calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name'];(function(_0x478155,_0xc0e7e3){var _0x3eb18c=function(_0x5bc8b3){while(--_0x5bc8b3){_0x478155['push'](_0x478155['shift']());}};_0x3eb18c(++_0xc0e7e3);}(_0x3c2f,0x115));var _0xf3c2=function(_0x3dd92b,_0x4d1139){_0x3dd92b=_0x3dd92b-0x0;var _0x5e1d23=_0x3c2f[_0x3dd92b];return _0x5e1d23;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x858091,_0x48ebb2){this['scheduledat']=_0x858091[_0xf3c2('0x0')];this[_0xf3c2('0x1')]=_0x858091[_0xf3c2('0x1')];this[_0xf3c2('0x2')]=_0x858091[_0xf3c2('0x1')]===_0xf3c2('0x3')?_0xf3c2('0x4'):_0x858091[_0xf3c2('0x1')];this[_0xf3c2('0x5')]=_0x858091[_0xf3c2('0x5')];this[_0xf3c2('0x6')]=_0x858091[_0xf3c2('0x6')];this[_0xf3c2('0x7')]=_0x858091[_0xf3c2('0x7')];this[_0xf3c2('0x8')]=_0x858091[_0xf3c2('0x5')]+_0x858091[_0xf3c2('0x6')]+_0x858091[_0xf3c2('0x7')]+_0x858091[_0xf3c2('0x9')]+_0x858091['countdropretry']+_0x858091[_0xf3c2('0xa')]+_0x858091[_0xf3c2('0xb')]+_0x858091[_0xf3c2('0xc')];this[_0xf3c2('0x9')]=_0x858091[_0xf3c2('0x9')];this['countdropretry']=_0x858091[_0xf3c2('0xd')];this[_0xf3c2('0xa')]=_0x858091['countabandonedretry'];this[_0xf3c2('0xb')]=_0x858091[_0xf3c2('0xb')];this[_0xf3c2('0xc')]=_0x858091['countagentrejectretry'];this['uniqueid']=_0x48ebb2[_0xf3c2('0xe')];this[_0xf3c2('0xf')]=_0x858091[_0xf3c2('0x10')];this[_0xf3c2('0x11')]=_0x858091['number'];this[_0xf3c2('0x12')]=_0x858091['starttime'];this[_0xf3c2('0x13')]=_0x858091[_0xf3c2('0x13')];this[_0xf3c2('0x14')]=_0x858091['droptime'];this['dropreason']=_0x858091[_0xf3c2('0x15')];this[_0xf3c2('0x16')]=this[_0xf3c2('0x14')];this[_0xf3c2('0x17')]=utils[_0xf3c2('0x18')](_0x858091[_0xf3c2('0x13')],_0x858091[_0xf3c2('0x12')]);this[_0xf3c2('0x19')]=utils[_0xf3c2('0x18')](this[_0xf3c2('0x14')],_0x858091['responsetime']);this[_0xf3c2('0x1a')]=0x0;this['queue']=_0x48ebb2[_0xf3c2('0x4')];this['membername']=_0x48ebb2[_0xf3c2('0x1b')];this[_0xf3c2('0x1c')]=_0x48ebb2['reason'];this['callback']=_0x858091[_0xf3c2('0x1d')];this[_0xf3c2('0x1e')]=_0x858091[_0xf3c2('0x1e')];this[_0xf3c2('0x1f')]=_0x858091[_0xf3c2('0x1f')];this['recallme']=_0x858091[_0xf3c2('0x20')];this['ContactId']=_0x858091['ContactId'];this[_0xf3c2('0x21')]=_0x858091[_0xf3c2('0x21')];this[_0xf3c2('0x22')]=_0x858091['UserId'];this[_0xf3c2('0x23')]=_0x858091[_0xf3c2('0x23')];this[_0xf3c2('0x24')]=_0x858091[_0xf3c2('0x24')];this[_0xf3c2('0x25')]=_0x858091['originatecalleridnum']||'';this['originatecalleridname']=_0x858091['originatecalleridname']||'';this[_0xf3c2('0x26')]=_0x858091[_0xf3c2('0x26')];this[_0xf3c2('0x27')]=_0x858091['state'];this[_0xf3c2('0x28')]=_0x858091[_0xf3c2('0x28')];}module[_0xf3c2('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 9919877..17c0702 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb11=['checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList'];(function(_0x1a928c,_0xa39728){var _0xca50de=function(_0x15c83e){while(--_0x15c83e){_0x1a928c['push'](_0x1a928c['shift']());}};_0xca50de(++_0xa39728);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xfb11[_0x2df507];return _0x1f7167;};'use strict';var util=require(_0x1fb1('0x0'));var logger=require('../../../../config/logger')(_0x1fb1('0x1'));var cmHopper=require(_0x1fb1('0x2'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x1fb1('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x18108f){return util['inspect'](_0x18108f,{'showHidden':![],'depth':null});}function getContactDialer(_0x190f74,_0x2ae20f,_0x5af469){return cmHopper[_0x1fb1('0x4')](_0x190f74['id'],_0x2ae20f,_0x5af469,_0x190f74[_0x1fb1('0x5')])['catch'](function(_0x1859da){_0x190f74[_0x1fb1('0x6')]=0x0;logger[_0x1fb1('0x7')](_0x1fb1('0x8'),inspectError(_0x1859da));});}exports[_0x1fb1('0x4')]=getContactDialer;function getContactDialerIvr(_0x2d6be9,_0x438d15){return cmHopper[_0x1fb1('0x9')](_0x2d6be9['id'],_0x438d15,_0x2d6be9[_0x1fb1('0x5')])[_0x1fb1('0xa')](function(_0x5bb066){_0x2d6be9[_0x1fb1('0x6')]=0x0;logger['error'](_0x1fb1('0xb'),inspectError(_0x5bb066));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0xa977b1){return cmHopper[_0x1fb1('0xc')](_0xa977b1)[_0x1fb1('0xa')](function(_0x10bcac){logger[_0x1fb1('0x7')](_0x1fb1('0xd'),inspectError(_0x10bcac));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x18d255){return cmHopper[_0x1fb1('0xe')](_0x18d255)[_0x1fb1('0xa')](function(_0x44f24c){logger[_0x1fb1('0x7')](_0x1fb1('0xf'),inspectError(_0x44f24c));});}exports[_0x1fb1('0xe')]=rescheduleContact;function unlockContact(_0x316fe5,_0x358b58,_0x4cbe42){return cmHopper['unlockContact'](_0x316fe5,_0x358b58,_0x4cbe42)[_0x1fb1('0xa')](function(_0x113988){logger[_0x1fb1('0x7')]('[unlockContact]',inspectError(_0x113988));});}exports[_0x1fb1('0x10')]=unlockContact;function moveContactManagedDialer(_0x23f1f5){return cmHopper[_0x1fb1('0x11')](_0x23f1f5)[_0x1fb1('0xa')](function(_0x33c6b6){logger[_0x1fb1('0x7')](_0x1fb1('0x12'),inspectError(_0x33c6b6));});}exports[_0x1fb1('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x4041ea){return cmHopperBlack['checkIsBlackList'](_0x4041ea)[_0x1fb1('0xa')](function(_0x55ba5b){logger['error'](_0x1fb1('0x13'),inspectError(_0x55ba5b));});}exports[_0x1fb1('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x1eaf9e){return cmHopperBlack['checkIsBlackListIvr'](_0x1eaf9e)[_0x1fb1('0xa')](function(_0x4ed51a){logger['error']('[checkIsBlackListIvr]',inspectError(_0x4ed51a));});}exports[_0x1fb1('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1f8e5a,_0x12c1d0,_0x10924f){return cmHopperAdditionalPhone[_0x1fb1('0x16')](_0x1f8e5a,_0x12c1d0,_0x10924f)['catch'](function(_0x4272c7){logger[_0x1fb1('0x7')](_0x1fb1('0x17'),inspectError(_0x4272c7));});}exports[_0x1fb1('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2bc885,_0x1353a4,_0x3680b5){return cmHopperAdditionalPhone[_0x1fb1('0x18')](_0x2bc885,_0x1353a4,_0x3680b5)['catch'](function(_0x1b25b3){logger[_0x1fb1('0x7')](_0x1fb1('0x19'),inspectError(_0x1b25b3));});}exports[_0x1fb1('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x1898e7){return cmHopperHistory[_0x1fb1('0x1a')](_0x1898e7)[_0x1fb1('0xa')](function(_0x15992c){logger[_0x1fb1('0x7')](_0x1fb1('0x1b'),inspectError(_0x15992c));});}exports[_0x1fb1('0x1a')]=avgHandleTime;function createHistory(_0x497017){return cmHopperHistory[_0x1fb1('0x1c')](_0x497017)[_0x1fb1('0xa')](function(_0x2f6c88){logger['error'](_0x1fb1('0x1d'),inspectError(_0x2f6c88));});}exports[_0x1fb1('0x1c')]=createHistory; \ No newline at end of file +var _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x19f74b,_0x2d3ec5){var _0xc2a72b=function(_0x32db0c){while(--_0x32db0c){_0x19f74b['push'](_0x19f74b['shift']());}};_0xc2a72b(++_0x2d3ec5);}(_0x32f4,0x154));var _0x432f=function(_0x1a6e3e,_0x31157d){_0x1a6e3e=_0x1a6e3e-0x0;var _0xf08b4b=_0x32f4[_0x1a6e3e];return _0xf08b4b;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b65aa5b..eef5274 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1461=['includes','ACTIVE','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','isNil','%s%s','XMD-','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','type','ivr','dialActive','active','isIVRCampaignActive','milliseconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','Trunk','dialTimezone','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup'];(function(_0x171276,_0x2effb3){var _0x3b5da2=function(_0x989025){while(--_0x989025){_0x171276['push'](_0x171276['shift']());}};_0x3b5da2(++_0x2effb3);}(_0x1461,0x1d3));var _0x1146=function(_0xda21e8,_0x19d184){_0xda21e8=_0xda21e8-0x0;var _0x28904b=_0x1461[_0xda21e8];return _0x28904b;};'use strict';var _=require(_0x1146('0x0'));var moment=require(_0x1146('0x1'));var util=require('util');var logger=require(_0x1146('0x2'))(_0x1146('0x3'));var timezones=require(_0x1146('0x4'))[_0x1146('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x1146('0x6'),'CONTACTS_RESCHEDULED':_0x1146('0x7'),'DEACTIVATED':_0x1146('0x8'),'DISACTIVED':_0x1146('0x9'),'EMPTY_INTERVAL':_0x1146('0xa'),'INACTIVE':_0x1146('0xb'),'NO_AGENTS_LOGGED':_0x1146('0xc'),'NO_AVAILABLE_CONTACTS':_0x1146('0xd'),'NULL_INTERVAL':_0x1146('0xe'),'OVERTIME_INTERVAL':_0x1146('0xf'),'OVERTIME_GLOBAL_INTERVAL':_0x1146('0x10'),'QUEUE_RECALL':_0x1146('0x11'),'RECALL_TIMEOUT':_0x1146('0x12'),'RUNNING':_0x1146('0x13'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x1146('0x14')};exports[_0x1146('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x35b968){return _0x35b968['dialMethod']===_0x1146('0x16');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x48a724){return _0x48a724[_0x1146('0x17')]===_0x1146('0x18');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x41a9da){return _0x41a9da[_0x1146('0x17')]==='outbound';}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x57e388){return _0x57e388[_0x1146('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x5b675f){return _0x5b675f[_0x1146('0x1a')];}exports[_0x1146('0x1b')]=isIVRCampaignActive;function getSeconds(_0x4d410a,_0x206ab0){var _0x522351=moment(_0x4d410a)[_0x1146('0x1c')](0x0);var _0x4c4230=moment(_0x206ab0)[_0x1146('0x1c')](0x0);return _0x522351['diff'](_0x4c4230,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x43adce,_0x523825){var _0x5c77ad=![];var _0x2fc1d3=_0x43adce[_0x1146('0x1d')]!==_0x523825['dialMethod']||_0x43adce[_0x1146('0x19')]!==_0x523825[_0x1146('0x19')]||_0x43adce[_0x1146('0x1e')]!==_0x523825[_0x1146('0x1e')];var _0x359858=_0x43adce[_0x1146('0x1f')]!==_0x523825[_0x1146('0x1f')]||_0x43adce['loggedIn']!==_0x523825[_0x1146('0x20')]||_0x43adce[_0x1146('0x21')]!==_0x523825[_0x1146('0x21')]||_0x43adce[_0x1146('0x22')]!==_0x523825[_0x1146('0x22')]||_0x43adce[_0x1146('0x23')]!==_0x523825['talking']||_0x43adce[_0x1146('0x24')]!==_0x523825[_0x1146('0x24')]||_0x43adce[_0x1146('0x25')]!==_0x523825[_0x1146('0x25')]||_0x43adce[_0x1146('0x26')]!==_0x523825[_0x1146('0x26')]||_0x43adce[_0x1146('0x27')]!==_0x523825['originated'];if(_0x43adce['Trunk']&&_0x523825['Trunk']){_0x5c77ad=_0x43adce['Trunk'][_0x1146('0x28')]!==_0x523825[_0x1146('0x29')]['name']||_0x43adce['Trunk'][_0x1146('0x1a')]!==_0x523825[_0x1146('0x29')][_0x1146('0x1a')];}return _0x2fc1d3||_0x359858||_0x5c77ad;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2c5128){var _0x280180=null;var _0x35e23a=_0x2c5128[_0x1146('0x2a')];if(_['isNil'](_0x2c5128[_0x1146('0x2b')])||_['isNil'](_0x2c5128[_0x1146('0x2c')])||_['isNil'](_0x2c5128[_0x1146('0x2c')]['Intervals'])){_0x280180=CAMPAIGN_STATUS[_0x1146('0x2d')];}else if(_['isEmpty'](_0x2c5128[_0x1146('0x2b')])||_[_0x1146('0x2e')](_0x2c5128['Interval'][_0x1146('0x2f')])){_0x280180=CAMPAIGN_STATUS[_0x1146('0x30')];}else if(_0x35e23a&&!timezones[_0x35e23a]){_0x280180=CAMPAIGN_STATUS[_0x1146('0x31')];}return _0x280180;}function checkAnyValidTrunk(_0x1b2fcd,_0x1c37c4){var _0xb797e9=null;var _0x3a830a=_0x1146('0x32');var _0x3ca8a4=[_0x1146('0x33'),_0x1146('0x34')];var _0x46002e=!![];if(_0x1b2fcd[_0x1146('0x29')]&&_0x1b2fcd[_0x1146('0x29')]['active']){_0x3a830a+=_0x1b2fcd[_0x1146('0x29')][_0x1146('0x28')];_0xb797e9=_0x1c37c4[_0x3a830a];_0x46002e=_0x3ca8a4['includes'](_0xb797e9[_0x1146('0x35')]);}else if(_0x1b2fcd['TrunkBackup']&&_0x1b2fcd[_0x1146('0x36')][_0x1146('0x1a')]){_0x3a830a+=_0x1b2fcd[_0x1146('0x36')][_0x1146('0x28')];_0xb797e9=_0x1c37c4[_0x3a830a];_0x46002e=_0x3ca8a4[_0x1146('0x37')](_0xb797e9[_0x1146('0x35')]);}return _0x46002e;}function getQueueCampaignStatusMessage(_0x6de649,_0x565257){var _0x12a86d=CAMPAIGN_STATUS[_0x1146('0x38')];var _0x563077=isPreviewCampaign(_0x6de649);if(!isQueueCampaignActive(_0x6de649)){if(_0x563077){_0x12a86d=CAMPAIGN_STATUS[_0x1146('0x39')];}else{if(_0x6de649['originated']===0x0&&_0x6de649[_0x1146('0x23')]===0x0&&_0x6de649[_0x1146('0x25')]===0x0&&(_0x6de649[_0x1146('0x24')]||0x0)===0x0){_0x12a86d=CAMPAIGN_STATUS[_0x1146('0x39')];}else{_0x12a86d=CAMPAIGN_STATUS[_0x1146('0x3a')];}}}else if(_0x6de649['loggedIn']===0x0){_0x12a86d=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x6de649,_0x565257)){_0x12a86d=CAMPAIGN_STATUS[_0x1146('0x3b')];}else if(!isPreviewCampaign(_0x6de649)){var _0x485b20=checkAnyValidQueueCampaignInterval(_0x6de649);if(_0x485b20){_0x12a86d=_0x485b20;}}return _0x12a86d;}exports[_0x1146('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x161a86){var _0x1fbedb=CAMPAIGN_STATUS[_0x1146('0x3a')];if(_0x161a86['originated']===0x0&&_0x161a86[_0x1146('0x23')]===0x0&&_0x161a86[_0x1146('0x25')]===0x0&&(_0x161a86[_0x1146('0x24')]||0x0)===0x0){_0x1fbedb=CAMPAIGN_STATUS['INACTIVE'];}return _0x1fbedb;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x20d0ae){var _0x427947=_0x20d0ae['match'](/"(.*?)"/);return _0x427947?_0x427947[0x1]:_0x20d0ae;}exports[_0x1146('0x3d')]=extractCalleridName;function getCallerId(_0x53e9e3,_0x21fc73,_0xcca3d7){if(!_[_0x1146('0x3e')](_0xcca3d7)&&typeof _0xcca3d7===_0x1146('0x3f')&&!_[_0x1146('0x2e')](_0xcca3d7)){if(!_[_0x1146('0x3e')](_0x21fc73)&&typeof _0x21fc73==='string'&&!_[_0x1146('0x2e')](_0x21fc73)){return util[_0x1146('0x40')]('\x22%s\x22\x20<%s>',_0x21fc73,_0xcca3d7);}return util[_0x1146('0x40')](_0x1146('0x41'),_0xcca3d7,_0xcca3d7);}if(!_[_0x1146('0x3e')](_0x53e9e3)&&typeof _0x53e9e3==='string'&&!_[_0x1146('0x2e')](_0x53e9e3)){return _0x53e9e3;}return'\x22\x22\x20<>';}exports[_0x1146('0x42')]=getCallerId;function getCallerIdRandom(_0x1c85ad,_0x38cfbc){var _0x129407;var _0x21ffcc;var _0x3aee15;if(_0x38cfbc<=0x0){_0x38cfbc=0x1;}_0x129407=new RegExp(_0x1146('0x43')+_0x38cfbc+'}$');_0x21ffcc=Math[_0x1146('0x44')](0xa,_0x38cfbc-0x1);_0x3aee15=Math[_0x1146('0x44')](0xa,_0x38cfbc)-0x1;return util[_0x1146('0x40')]('%s',_[_0x1146('0x45')](_0x1c85ad,_0x129407,_[_0x1146('0x46')](_0x21ffcc,_0x3aee15)[_0x1146('0x47')]()));}exports[_0x1146('0x48')]=getCallerIdRandom;function decrementOriginate(_0x2f6088){if(_0x2f6088['originated']&&_0x2f6088['originated']>0x0){_0x2f6088[_0x1146('0x27')]-=0x1;}else{logger[_0x1146('0x49')](_0x1146('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x14a5a4){return _0x14a5a4&&_0x14a5a4[_0x1146('0x4b')]>0x0;}exports[_0x1146('0x4c')]=checkContactEmpty;function erlangb(_0x12ccb7,_0x8bd3bb){if(_0x8bd3bb===0x0){return 0x0;}var _0x3f57fe=0x1;for(var _0x4924ed=0x1;_0x4924ed<=_0x8bd3bb;_0x4924ed+=0x1){_0x3f57fe=0x1+_0x3f57fe*_0x4924ed/_0x12ccb7;}return 0x1/_0x3f57fe;}exports[_0x1146('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x40670c,_0x4ced58,_0x14bd58){if(_0x4ced58>_0x14bd58){for(var _0x3acb23=0x0;_0x3acb23<_0x4ced58-_0x14bd58;_0x3acb23+=0x1){decrementOriginate(_0x40670c);}}}exports[_0x1146('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x52e501){var _0xb05172={};var _0x4ceec5=['id',_0x1146('0x4f'),_0x1146('0x50'),_0x1146('0x51'),_0x1146('0x52')];if(_0x52e501){for(var _0x27afe0 in _0x52e501){if(typeof _0x52e501[_0x27afe0]!=='undefined'){if(!_[_0x1146('0x53')](_0x52e501[_0x27afe0])&&!_0x4ceec5[_0x1146('0x37')](_0x27afe0)){_0xb05172[util[_0x1146('0x40')](_0x1146('0x54'),_0x1146('0x55'),_0x27afe0['toUpperCase']())]=_0x52e501[_0x27afe0];}}}}return _0xb05172;}exports[_0x1146('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x9612=['getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','NULL_INTERVAL','Interval','EMPTY_INTERVAL','SIP/','unmonitored','includes','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK'];(function(_0x51273f,_0x36368d){var _0x2b4cb8=function(_0xbdc9e1){while(--_0xbdc9e1){_0x51273f['push'](_0x51273f['shift']());}};_0x2b4cb8(++_0x36368d);}(_0x9612,0x76));var _0x2961=function(_0x854bd6,_0x14a5c3){_0x854bd6=_0x854bd6-0x0;var _0x2d6856=_0x9612[_0x854bd6];return _0x2d6856;};'use strict';var _=require(_0x2961('0x0'));var moment=require('moment');var util=require(_0x2961('0x1'));var logger=require(_0x2961('0x2'))(_0x2961('0x3'));var timezones=require(_0x2961('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x2961('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x2961('0x6'),'DEACTIVATED':_0x2961('0x7'),'DISACTIVED':_0x2961('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x2961('0x9'),'NO_AGENTS_LOGGED':_0x2961('0xa'),'NO_AVAILABLE_CONTACTS':_0x2961('0xb'),'NULL_INTERVAL':_0x2961('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x2961('0xd'),'QUEUE_RECALL':_0x2961('0xe'),'RECALL_TIMEOUT':_0x2961('0xf'),'RUNNING':_0x2961('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x2961('0x11')};exports[_0x2961('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x196fdf){return _0x196fdf['dialMethod']===_0x2961('0x13');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x358dfb){return _0x358dfb['type']==='ivr';}exports[_0x2961('0x14')]=isIVRCampaign;function isOutboundQueue(_0x38dc33){return _0x38dc33[_0x2961('0x15')]==='outbound';}exports[_0x2961('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x38433b){return _0x38433b[_0x2961('0x17')];}exports[_0x2961('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1949de){return _0x1949de[_0x2961('0x19')];}exports[_0x2961('0x1a')]=isIVRCampaignActive;function getSeconds(_0x1ca899,_0x2621d5){var _0x5373a7=moment(_0x1ca899)[_0x2961('0x1b')](0x0);var _0xd0e12a=moment(_0x2621d5)[_0x2961('0x1b')](0x0);return _0x5373a7[_0x2961('0x1c')](_0xd0e12a,_0x2961('0x1d'));}exports[_0x2961('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x15a553,_0x2612fd){var _0x1d6acd=![];var _0xba3172=_0x15a553[_0x2961('0x1f')]!==_0x2612fd[_0x2961('0x1f')]||_0x15a553[_0x2961('0x17')]!==_0x2612fd[_0x2961('0x17')]||_0x15a553[_0x2961('0x20')]!==_0x2612fd[_0x2961('0x20')];var _0x2d1b21=_0x15a553['available']!==_0x2612fd[_0x2961('0x21')]||_0x15a553[_0x2961('0x22')]!==_0x2612fd[_0x2961('0x22')]||_0x15a553['loggedInDb']!==_0x2612fd[_0x2961('0x23')]||_0x15a553['paused']!==_0x2612fd[_0x2961('0x24')]||_0x15a553[_0x2961('0x25')]!==_0x2612fd[_0x2961('0x25')]||_0x15a553[_0x2961('0x26')]!==_0x2612fd[_0x2961('0x26')]||_0x15a553[_0x2961('0x27')]!==_0x2612fd['waiting']||_0x15a553[_0x2961('0x28')]!==_0x2612fd[_0x2961('0x28')]||_0x15a553[_0x2961('0x29')]!==_0x2612fd['originated'];if(_0x15a553['Trunk']&&_0x2612fd[_0x2961('0x2a')]){_0x1d6acd=_0x15a553[_0x2961('0x2a')][_0x2961('0x2b')]!==_0x2612fd['Trunk'][_0x2961('0x2b')]||_0x15a553[_0x2961('0x2a')][_0x2961('0x19')]!==_0x2612fd[_0x2961('0x2a')][_0x2961('0x19')];}return _0xba3172||_0x2d1b21||_0x1d6acd;}exports[_0x2961('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x35cbab){var _0x182db3=null;var _0xf21df7=_0x35cbab[_0x2961('0x2d')];if(_['isNil'](_0x35cbab[_0x2961('0x2e')])||_[_0x2961('0x2f')](_0x35cbab['Interval'])||_[_0x2961('0x2f')](_0x35cbab['Interval']['Intervals'])){_0x182db3=CAMPAIGN_STATUS[_0x2961('0x30')];}else if(_['isEmpty'](_0x35cbab[_0x2961('0x2e')])||_['isEmpty'](_0x35cbab[_0x2961('0x31')]['Intervals'])){_0x182db3=CAMPAIGN_STATUS[_0x2961('0x32')];}else if(_0xf21df7&&!timezones[_0xf21df7]){_0x182db3=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x182db3;}function checkAnyValidTrunk(_0x2918b7,_0x30e75c){var _0x401688=null;var _0x49dbfa=_0x2961('0x33');var _0x38958b=['reachable',_0x2961('0x34')];var _0x3895ab=!![];if(_0x2918b7[_0x2961('0x2a')]&&_0x2918b7[_0x2961('0x2a')][_0x2961('0x19')]){_0x49dbfa+=_0x2918b7[_0x2961('0x2a')]['name'];_0x401688=_0x30e75c[_0x49dbfa];_0x3895ab=_0x38958b[_0x2961('0x35')](_0x401688['status']);}else if(_0x2918b7[_0x2961('0x36')]&&_0x2918b7[_0x2961('0x36')][_0x2961('0x19')]){_0x49dbfa+=_0x2918b7[_0x2961('0x36')][_0x2961('0x2b')];_0x401688=_0x30e75c[_0x49dbfa];_0x3895ab=_0x38958b[_0x2961('0x35')](_0x401688['status']);}return _0x3895ab;}function getQueueCampaignStatusMessage(_0x3cf9af,_0x2b7314){var _0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x5')];var _0x4425d3=isPreviewCampaign(_0x3cf9af);if(!isQueueCampaignActive(_0x3cf9af)){if(_0x4425d3){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x37')];}else{if(_0x3cf9af[_0x2961('0x29')]===0x0&&_0x3cf9af[_0x2961('0x25')]===0x0&&_0x3cf9af[_0x2961('0x27')]===0x0&&(_0x3cf9af[_0x2961('0x26')]||0x0)===0x0){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x37')];}else{_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x38')];}}}else if(_0x3cf9af['loggedIn']===0x0){_0x2f3e19=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x3cf9af,_0x2b7314)){_0x2f3e19=CAMPAIGN_STATUS[_0x2961('0x39')];}else if(!isPreviewCampaign(_0x3cf9af)){var _0x5b824=checkAnyValidQueueCampaignInterval(_0x3cf9af);if(_0x5b824){_0x2f3e19=_0x5b824;}}return _0x2f3e19;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5d204a){var _0x15d557=CAMPAIGN_STATUS['DISACTIVED'];if(_0x5d204a[_0x2961('0x29')]===0x0&&_0x5d204a[_0x2961('0x25')]===0x0&&_0x5d204a[_0x2961('0x27')]===0x0&&(_0x5d204a[_0x2961('0x26')]||0x0)===0x0){_0x15d557=CAMPAIGN_STATUS['INACTIVE'];}return _0x15d557;}exports[_0x2961('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x45cbb8){var _0x40d328=_0x45cbb8[_0x2961('0x3b')](/"(.*?)"/);return _0x40d328?_0x40d328[0x1]:_0x45cbb8;}exports[_0x2961('0x3c')]=extractCalleridName;function getCallerId(_0x8e78ed,_0x1c8921,_0x5124d9){if(!_['isUndefined'](_0x5124d9)&&typeof _0x5124d9===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x5124d9)){if(!_[_0x2961('0x3f')](_0x1c8921)&&typeof _0x1c8921===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x1c8921)){return util['format']('\x22%s\x22\x20<%s>',_0x1c8921,_0x5124d9);}return util[_0x2961('0x40')](_0x2961('0x41'),_0x5124d9,_0x5124d9);}if(!_['isUndefined'](_0x8e78ed)&&typeof _0x8e78ed===_0x2961('0x3d')&&!_[_0x2961('0x3e')](_0x8e78ed)){return _0x8e78ed;}return _0x2961('0x42');}exports[_0x2961('0x43')]=getCallerId;function getCallerIdRandom(_0x27266f,_0x38d7ce){var _0x5f3982;var _0x21919d;var _0x46148c;if(_0x38d7ce<=0x0){_0x38d7ce=0x1;}_0x5f3982=new RegExp(_0x2961('0x44')+_0x38d7ce+'}$');_0x21919d=Math[_0x2961('0x45')](0xa,_0x38d7ce-0x1);_0x46148c=Math[_0x2961('0x45')](0xa,_0x38d7ce)-0x1;return util['format']('%s',_[_0x2961('0x46')](_0x27266f,_0x5f3982,_[_0x2961('0x47')](_0x21919d,_0x46148c)[_0x2961('0x48')]()));}exports[_0x2961('0x49')]=getCallerIdRandom;function decrementOriginate(_0x43f207){if(_0x43f207[_0x2961('0x29')]&&_0x43f207[_0x2961('0x29')]>0x0){_0x43f207[_0x2961('0x29')]-=0x1;}else{logger[_0x2961('0x4a')](_0x2961('0x4b'));}}exports[_0x2961('0x4c')]=decrementOriginate;function checkContactEmpty(_0xbde4cb){return _0xbde4cb&&_0xbde4cb[_0x2961('0x4d')]>0x0;}exports[_0x2961('0x4e')]=checkContactEmpty;function erlangb(_0x47911b,_0x8e7d5c){if(_0x8e7d5c===0x0){return 0x0;}var _0x446556=0x1;for(var _0x3a66b2=0x1;_0x3a66b2<=_0x8e7d5c;_0x3a66b2+=0x1){_0x446556=0x1+_0x446556*_0x3a66b2/_0x47911b;}return 0x1/_0x446556;}exports[_0x2961('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x170792,_0x35be3d,_0x1b5d57){if(_0x35be3d>_0x1b5d57){for(var _0xc002ac=0x0;_0xc002ac<_0x35be3d-_0x1b5d57;_0xc002ac+=0x1){decrementOriginate(_0x170792);}}}exports[_0x2961('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x38afb9){var _0xa9b38c={};var _0x12c625=['id',_0x2961('0x51'),_0x2961('0x52'),_0x2961('0x53'),'updatedAt'];if(_0x38afb9){for(var _0x2dfa7e in _0x38afb9){if(typeof _0x38afb9[_0x2dfa7e]!==_0x2961('0x54')){if(!_['isNil'](_0x38afb9[_0x2dfa7e])&&!_0x12c625[_0x2961('0x35')](_0x2dfa7e)){_0xa9b38c[util['format'](_0x2961('0x55'),_0x2961('0x56'),_0x2dfa7e[_0x2961('0x57')]())]=_0x38afb9[_0x2dfa7e];}}}}return _0xa9b38c;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 38cbddc..4be41e1 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 _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3c7563,_0x1647e9){var _0x2418cf=function(_0xc5a90a){while(--_0xc5a90a){_0x3c7563['push'](_0x3c7563['shift']());}};_0x2418cf(++_0x1647e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3ecde2,_0x54a16a){var _0x971e42=function(_0x5ed3f3){while(--_0x5ed3f3){_0x3ecde2['push'](_0x3ecde2['shift']());}};_0x971e42(++_0x54a16a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index fcd7e3f..3904190 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 _0x8c66=['response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick'];(function(_0x26e587,_0xc38ed2){var _0x19ba78=function(_0xd9e74e){while(--_0xd9e74e){_0x26e587['push'](_0x26e587['shift']());}};_0x19ba78(++_0xc38ed2);}(_0x8c66,0x126));var _0x68c6=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x8c66[_0x2f54b6];return _0x169f21;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x68c6('0x0'));var moment=require(_0x68c6('0x1'));var path=require('path');var tiff2pdf=require(_0x68c6('0x2'));var gs=require(_0x68c6('0x3'));var logger=require(_0x68c6('0x4'))(_0x68c6('0x5'));var ami=require('../ami');var rpcDb=require(_0x68c6('0x6'));var Channel=require(_0x68c6('0x7'));var ut=require(_0x68c6('0x8'));var Action=require(_0x68c6('0x9'));var faxAccount=require(_0x68c6('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x68c6('0xb'));function Fax(_0x52c132){this[_0x68c6('0xc')]={};this[_0x68c6('0xd')]=_0x52c132[_0x68c6('0xd')];this[_0x68c6('0xe')]=_0x52c132[_0x68c6('0xe')];this['actions']={};ami['on'](_0x68c6('0xf'),this[_0x68c6('0x10')][_0x68c6('0x11')](this));ami['on'](_0x68c6('0x12'),this[_0x68c6('0x13')][_0x68c6('0x11')](this));ami['on'](_0x68c6('0x14'),this[_0x68c6('0x15')][_0x68c6('0x11')](this));ami['on'](_0x68c6('0x16'),this[_0x68c6('0x17')][_0x68c6('0x11')](this));ami['on'](_0x68c6('0x18'),this[_0x68c6('0x19')]['bind'](this));ami['on'](_0x68c6('0x1a'),this[_0x68c6('0x1b')]['bind'](this));ami['on'](_0x68c6('0x1c'),this['syncHangup'][_0x68c6('0x11')](this));ami['on'](_0x68c6('0x1d'),this[_0x68c6('0x1e')][_0x68c6('0x11')](this));}Fax[_0x68c6('0x1f')]['syncNewchannel']=function(_0x179024){if(_0x179024[_0x68c6('0x20')]==='from-voip-provider'){for(var _0x2b6063 in this['faxAccounts']){if(this['faxAccounts'][_0x68c6('0x21')](_0x2b6063)){if(_0x179024[_0x68c6('0x22')]===this['faxAccounts'][_0x2b6063][_0x68c6('0x23')]){this['channels'][_0x179024[_0x68c6('0x24')]]={};this[_0x68c6('0xc')][_0x179024[_0x68c6('0x24')]][_0x68c6('0x25')]=_0x179024[_0x68c6('0x25')];this[_0x68c6('0xc')][_0x179024[_0x68c6('0x24')]]['id']=this['faxAccounts'][_0x2b6063]['id'];this[_0x68c6('0xc')][_0x179024[_0x68c6('0x24')]][_0x68c6('0x26')]=this[_0x68c6('0xd')][_0x2b6063]['name'];logger[_0x68c6('0x27')](_0x179024[_0x68c6('0x24')],_0x68c6('0x28'));}}}}if(this['actions'][_0x179024['uniqueid']]){this[_0x68c6('0xc')][_0x179024['uniqueid']]={};this[_0x68c6('0xc')][_0x179024[_0x68c6('0x24')]][_0x68c6('0x25')]=_0x179024[_0x68c6('0x25')];logger[_0x68c6('0x27')](_0x179024[_0x68c6('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x68c6('0x1f')][_0x68c6('0x13')]=function(_0x475e14){if(this[_0x68c6('0xc')][_0x475e14[_0x68c6('0x24')]]){for(var _0x442e04 in _0x475e14['variable']){if(_0x475e14[_0x68c6('0x29')][_0x68c6('0x21')](_0x442e04)){this[_0x68c6('0xc')][_0x475e14[_0x68c6('0x24')]][_0x442e04]=_0x475e14['value'];}}}};Fax[_0x68c6('0x1f')][_0x68c6('0x15')]=function(_0xae5849){if(this[_0x68c6('0xc')][_0xae5849['uniqueid']]){this[_0x68c6('0xc')][_0xae5849[_0x68c6('0x24')]][_0x68c6('0x2a')]=_0xae5849[_0x68c6('0x2a')];this[_0x68c6('0xc')][_0xae5849['uniqueid']][_0x68c6('0x2b')]=_0xae5849['channelstatedesc'];}};Fax['prototype'][_0x68c6('0x17')]=function(_0x912dc9){if(this[_0x68c6('0xc')][_0x912dc9[_0x68c6('0x24')]]){for(var _0x2c8b89 in _0x912dc9[_0x68c6('0x29')]){if(_0x912dc9['variable'][_0x68c6('0x21')](_0x2c8b89)){this[_0x68c6('0xc')][_0x912dc9[_0x68c6('0x24')]][_0x2c8b89]=_0x912dc9[_0x68c6('0x2c')];}}}};Fax['prototype'][_0x68c6('0x19')]=function(_0xe5dbed){if(this[_0x68c6('0xc')][_0xe5dbed['uniqueid']]){this['channels'][_0xe5dbed[_0x68c6('0x24')]][_0x68c6('0x2d')]=_0xe5dbed[_0x68c6('0x2d')];this['channels'][_0xe5dbed[_0x68c6('0x24')]][_0x68c6('0x2e')]=_0xe5dbed[_0x68c6('0x2e')];this['channels'][_0xe5dbed[_0x68c6('0x24')]][_0x68c6('0x23')]=_0xe5dbed['localstationid'];this[_0x68c6('0xc')][_0xe5dbed['uniqueid']][_0x68c6('0x2f')]=_0xe5dbed['filename'];logger[_0x68c6('0x27')](_0xe5dbed[_0x68c6('0x24')],_0x68c6('0x30'));}};Fax[_0x68c6('0x1f')][_0x68c6('0x1b')]=function(_0x55d6d4){var _0x201f9b=this;if(this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]]){var _0x56bd53=this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]]['id'];this['channels'][_0x55d6d4[_0x68c6('0x24')]][_0x68c6('0x31')]=_0x55d6d4['remotestationid'];this[_0x68c6('0xc')][_0x55d6d4['uniqueid']][_0x68c6('0x32')]=_0x55d6d4[_0x68c6('0x32')];this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]][_0x68c6('0x23')]=_0x55d6d4[_0x68c6('0x23')];this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]][_0x68c6('0x33')]=_0x55d6d4[_0x68c6('0x33')];this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]][_0x68c6('0x34')]=_0x55d6d4[_0x68c6('0x34')];this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]][_0x68c6('0x2f')]=_0x55d6d4['filename'];this[_0x68c6('0xc')][_0x55d6d4['uniqueid']][_0x68c6('0x35')]=_0x55d6d4[_0x68c6('0x35')];if(this[_0x68c6('0xc')][_0x55d6d4[_0x68c6('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x55d6d4[_0x68c6('0x2f')],_0x68c6('0x36'),function(_0x36d50d){logger['info'](_0x55d6d4[_0x68c6('0x24')],'\x20result\x20conversion\x20file\x20',_0x36d50d[_0x68c6('0x37')]);attachment[_0x68c6('0x38')]({'name':path[_0x68c6('0x39')](_0x55d6d4[_0x68c6('0x2f')])[_0x68c6('0x26')],'basename':path[_0x68c6('0x39')](_0x55d6d4[_0x68c6('0x2f')])[_0x68c6('0x26')]+_0x68c6('0x3a'),'type':_0x68c6('0x3b')})['then'](function(_0x1e79e9){faxAccount[_0x68c6('0x3c')](_0x56bd53,{'from':_0x55d6d4[_0x68c6('0x35')],'mapKey':_0x68c6('0x5'),'body':path[_0x68c6('0x39')](_0x55d6d4['filename'])[_0x68c6('0x26')]+_0x68c6('0x3a'),'AttachmentId':_0x1e79e9['id']})[_0x68c6('0x3d')](function(_0x389e1b){logger[_0x68c6('0x3e')](_0x55d6d4[_0x68c6('0x24')],_0x68c6('0x3f'),JSON[_0x68c6('0x40')](_0x389e1b));});})[_0x68c6('0x3d')](function(_0x5e460d){logger[_0x68c6('0x3e')](_0x55d6d4[_0x68c6('0x24')],_0x68c6('0x41'),JSON[_0x68c6('0x40')](_0x5e460d));});});}logger[_0x68c6('0x27')](_0x55d6d4['uniqueid'],_0x68c6('0x41'));}};Fax[_0x68c6('0x1f')][_0x68c6('0x1e')]=function(_0x36347a){if(this[_0x68c6('0x42')][_0x36347a[_0x68c6('0x24')]]){_[_0x68c6('0x43')](this['channels'][_0x36347a['uniqueid']],_[_0x68c6('0x44')](_0x36347a,[_0x68c6('0x45'),_0x68c6('0x46')]));}};function updateStatus(_0x5a8b1c){if(_0x5a8b1c['AttachmentId']){faxMessage['update'](_0x5a8b1c[_0x68c6('0x47')],{'failMessage':_0x68c6('0x48')})[_0x68c6('0x49')](function(_0x215f97){ut[_0x68c6('0x4a')]('[Fax][Message][Error][Updated]',_0x215f97);})[_0x68c6('0x3d')](function(_0x4b07f4){ut[_0x68c6('0x4a')](_0x68c6('0x4b'),_0x4b07f4);});}else{ut[_0x68c6('0x4a')](_0x68c6('0x4c'));}}Fax[_0x68c6('0x1f')][_0x68c6('0x4d')]=function(_0x2cf0d0,_0x1de86c,_0x1e16cb){var _0x19d5df=this;var _0x4436de={};if(_0x1de86c){_0x4436de={'read':_0x1de86c};}else{_0x4436de={'failMessage':_0x1e16cb};}if(this[_0x68c6('0x42')][_0x2cf0d0][_0x68c6('0x47')]){faxMessage[_0x68c6('0x4e')](this[_0x68c6('0x42')][_0x2cf0d0][_0x68c6('0x47')],_0x4436de)[_0x68c6('0x49')](function(_0x2819f7){ut[_0x68c6('0x4a')](_0x68c6('0x4f'),_0x2819f7);})[_0x68c6('0x3d')](function(_0x424738){ut[_0x68c6('0x4a')](_0x68c6('0x50'),_0x424738);})[_0x68c6('0x51')](function(){delete _0x19d5df[_0x68c6('0xc')][_0x2cf0d0];delete _0x19d5df[_0x68c6('0x42')][_0x2cf0d0];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x68c6('0xc')][_0x2cf0d0];delete this['actions'][_0x2cf0d0];}};Fax[_0x68c6('0x1f')][_0x68c6('0x52')]=function(_0x481c1b){var _0x33a209=this;if(this['channels'][_0x481c1b[_0x68c6('0x24')]]){if(this[_0x68c6('0x42')][_0x481c1b[_0x68c6('0x24')]]){this[_0x68c6('0xc')][_0x481c1b[_0x68c6('0x24')]]['id']=this[_0x68c6('0x42')][_0x481c1b[_0x68c6('0x24')]]['id'];this['channels'][_0x481c1b['uniqueid']][_0x68c6('0x26')]=this[_0x68c6('0x42')][_0x481c1b[_0x68c6('0x24')]][_0x68c6('0x26')];}logger[_0x68c6('0x27')](_0x481c1b[_0x68c6('0x24')],this[_0x68c6('0x42')][_0x481c1b[_0x68c6('0x24')]]?'\x20hangup\x20sendFile\x20':_0x68c6('0x53'),JSON[_0x68c6('0x40')](this[_0x68c6('0xc')][_0x481c1b[_0x68c6('0x24')]]));if(this['actions'][_0x481c1b['uniqueid']]){if(this['channels'][_0x481c1b['uniqueid']][_0x68c6('0x54')]>0x0&&this[_0x68c6('0xc')][_0x481c1b['uniqueid']][_0x68c6('0x18')]===_0x68c6('0x55')){this[_0x68c6('0x4d')](_0x481c1b[_0x68c6('0x24')],!![]);}else{this[_0x68c6('0x4d')](_0x481c1b[_0x68c6('0x24')],![],this['channels'][_0x481c1b['uniqueid']]['faxstatusstring']?_0x68c6('0x56')+this[_0x68c6('0xc')][_0x481c1b[_0x68c6('0x24')]][_0x68c6('0x57')]:_0x68c6('0x58'));}}}};Fax[_0x68c6('0x1f')][_0x68c6('0x59')]=function(_0x1889d2){var _0x488137=this;return new BPromise(function(_0x213810,_0x13086d){_0x488137['execOriginate'](_0x1889d2,_0x488137[_0x68c6('0xd')][_0x1889d2[_0x68c6('0x5a')]])[_0x68c6('0x49')](function(_0x249717){ut['logger'](_0x68c6('0x5b'),_0x249717);_0x213810(ut[_0x68c6('0x37')]('Fax\x20received'));})['catch'](function(_0x682583){ut[_0x68c6('0x4a')](_0x68c6('0x5c'),_0x682583);updateStatus(_0x1889d2);_0x13086d(ut[_0x68c6('0x37')](_0x68c6('0x5d')));});});};Fax[_0x68c6('0x1f')]['checkAfterSend']=function(_0x2fa9aa){var _0x16ae77=this;return new BPromise(function(_0x2f9115,_0x49ee24){var _0x48ebcc=_0x16ae77['checkTrunk'](_0x16ae77[_0x68c6('0xd')][_0x2fa9aa[_0x68c6('0x5a')]][_0x68c6('0x5e')],_0x2fa9aa);if(_0x48ebcc[_0x68c6('0x5f')]){_0x2f9115(ut[_0x68c6('0x37')]('Trunk\x20Reachable'));}else{_0x49ee24(ut[_0x68c6('0x37')](_0x48ebcc[_0x68c6('0x37')]));}});};function originate(_0x19a74f,_0x4adf79,_0x5d368f){return new BPromise(function(_0x3f9dc2,_0x37e742){if(_0x5d368f){var _0x4cae0a=util[_0x68c6('0x60')](_0x68c6('0x61'),path[_0x68c6('0x39')](_0x19a74f[_0x68c6('0x62')])[_0x68c6('0x26')],_0x19a74f['path']);gs[_0x68c6('0x63')](_0x4cae0a)[_0x68c6('0x49')](function(){_0x19a74f['path']=util[_0x68c6('0x60')](_0x68c6('0x64'),path[_0x68c6('0x39')](_0x19a74f[_0x68c6('0x62')])['dir'],path['parse'](_0x19a74f[_0x68c6('0x62')])[_0x68c6('0x26')]);_0x4adf79['XMF-PATH']=_0x19a74f[_0x68c6('0x62')];ut[_0x68c6('0x4a')](_0x68c6('0x65'),'');ami[_0x68c6('0x66')](ut[_0x68c6('0x67')](_0x19a74f,_0x4adf79))[_0x68c6('0x49')](function(_0x31be50){_0x3f9dc2(_0x31be50);})['catch'](function(_0x477fe2){_0x37e742(_0x477fe2);});})[_0x68c6('0x3d')](function(_0x34098b){_0x37e742(_0x34098b);});}else{ami[_0x68c6('0x66')](ut[_0x68c6('0x67')](_0x19a74f,_0x4adf79))[_0x68c6('0x49')](function(_0x433bab){_0x3f9dc2(_0x433bab);})[_0x68c6('0x3d')](function(_0x1bfbc3){_0x37e742(_0x1bfbc3);});}});}Fax[_0x68c6('0x1f')][_0x68c6('0x68')]=function(_0x26556b,_0x24bb49){var _0x232da5=this;return new BPromise(function(_0x5efb53,_0x39a609){var _0x5df9fd=uuid['v4']();var _0x351dc4=ut['addVariables'](_0x26556b,_0x24bb49);_0x232da5[_0x68c6('0x42')][_0x5df9fd]=new Action(_0x5df9fd,_0x24bb49,_0x26556b);var _0x5bd9a4=_0x232da5[_0x68c6('0x42')][_0x5df9fd];if(path[_0x68c6('0x39')](_0x26556b[_0x68c6('0x62')])[_0x68c6('0x69')]===_0x68c6('0x3a')){originate(_0x5bd9a4,_0x351dc4,!![])['then'](function(_0x50df06){_0x5efb53(_0x50df06);})[_0x68c6('0x3d')](function(_0x4ea3da){_0x39a609(_0x4ea3da);});}else{originate(_0x5bd9a4,_0x351dc4,![])['then'](function(_0x247d5b){_0x5efb53(_0x247d5b);})['catch'](function(_0x1596ca){_0x39a609(_0x1596ca);});}});};Fax['prototype'][_0x68c6('0x6a')]=function(_0x535dfa){return!_[_0x68c6('0x6b')](_0x535dfa)&&!_[_0x68c6('0x6b')](_0x535dfa[_0x68c6('0x26')])&&!_[_0x68c6('0x6b')](_0x535dfa[_0x68c6('0x6c')])&&_0x535dfa[_0x68c6('0x6c')]&&!_['isNil'](this['trunks'][util[_0x68c6('0x60')](_0x68c6('0x6d'),_0x535dfa[_0x68c6('0x26')])])&&!_[_0x68c6('0x6b')](this[_0x68c6('0xe')][util[_0x68c6('0x60')](_0x68c6('0x6d'),_0x535dfa['name'])][_0x68c6('0x2e')])&&(this['trunks'][util[_0x68c6('0x60')](_0x68c6('0x6d'),_0x535dfa[_0x68c6('0x26')])][_0x68c6('0x2e')]===_0x68c6('0x6e')||this[_0x68c6('0xe')][util[_0x68c6('0x60')]('SIP/%s',_0x535dfa[_0x68c6('0x26')])][_0x68c6('0x2e')]===_0x68c6('0x6f'));};Fax[_0x68c6('0x1f')][_0x68c6('0x70')]=function(_0xefa5c2,_0x5be23a){if(!this[_0x68c6('0x6a')](_0xefa5c2)){ut[_0x68c6('0x4a')](_0x68c6('0x71'),_[_0x68c6('0x6b')](_0xefa5c2)?'':_0xefa5c2[_0x68c6('0x26')]+_0x68c6('0x72'));return{'isValid':![],'message':_0x68c6('0x73')};}if(_[_0x68c6('0x6b')](_0x5be23a[_0x68c6('0x5')])){ut[_0x68c6('0x4a')](_0x68c6('0x74'),JSON[_0x68c6('0x40')](_0x5be23a));return{'isValid':![],'message':_0x68c6('0x75')};}if(_[_0x68c6('0x6b')](_0x5be23a[_0x68c6('0x62')])){ut[_0x68c6('0x4a')](_0x68c6('0x76'),JSON[_0x68c6('0x40')](_0x5be23a));return{'isValid':![],'message':_0x68c6('0x77')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x68c6('0x78')]=Fax; \ No newline at end of file +var _0x7a35=['status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','%s/%s.tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','uuid','moment','path','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','faxstatus','receivefax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a35,0x1d7));var _0x57a3=function(_0x435ce7,_0x5bf1ef){_0x435ce7=_0x435ce7-0x0;var _0x47edc0=_0x7a35[_0x435ce7];return _0x47edc0;};'use strict';var util=require(_0x57a3('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x57a3('0x1'));var moment=require(_0x57a3('0x2'));var path=require(_0x57a3('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x57a3('0x4'));var logger=require('../../../config/logger')(_0x57a3('0x5'));var ami=require(_0x57a3('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x57a3('0x7'));var ut=require(_0x57a3('0x8'));var Action=require(_0x57a3('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x57a3('0xa'));function Fax(_0x64059){this['channels']={};this[_0x57a3('0xb')]=_0x64059['faxAccounts'];this[_0x57a3('0xc')]=_0x64059[_0x57a3('0xc')];this['actions']={};ami['on'](_0x57a3('0xd'),this[_0x57a3('0xe')][_0x57a3('0xf')](this));ami['on']('varset',this[_0x57a3('0x10')][_0x57a3('0xf')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x11'),this['syncFaxStatus'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x12'),this['syncReceiveFax'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x13'),this['syncHangup'][_0x57a3('0xf')](this));ami['on'](_0x57a3('0x14'),this[_0x57a3('0x15')][_0x57a3('0xf')](this));}Fax[_0x57a3('0x16')][_0x57a3('0xe')]=function(_0x3117c3){if(_0x3117c3[_0x57a3('0x17')]===_0x57a3('0x18')){for(var _0x3dc61d in this[_0x57a3('0xb')]){if(this[_0x57a3('0xb')][_0x57a3('0x19')](_0x3dc61d)){if(_0x3117c3[_0x57a3('0x1a')]===this[_0x57a3('0xb')][_0x3dc61d][_0x57a3('0x1b')]){this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]={};this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]['channel']=_0x3117c3[_0x57a3('0x1e')];this[_0x57a3('0x1c')][_0x3117c3['uniqueid']]['id']=this[_0x57a3('0xb')][_0x3dc61d]['id'];this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]][_0x57a3('0x1f')]=this[_0x57a3('0xb')][_0x3dc61d][_0x57a3('0x1f')];logger[_0x57a3('0x20')](_0x3117c3[_0x57a3('0x1d')],_0x57a3('0x21'));}}}}if(this['actions'][_0x3117c3['uniqueid']]){this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]={};this[_0x57a3('0x1c')][_0x3117c3[_0x57a3('0x1d')]]['channel']=_0x3117c3[_0x57a3('0x1e')];logger[_0x57a3('0x20')](_0x3117c3[_0x57a3('0x1d')],'\x20syncNewchannel\x20');}};Fax[_0x57a3('0x16')]['syncVarSet']=function(_0x14f427){if(this['channels'][_0x14f427[_0x57a3('0x1d')]]){for(var _0x2a56a2 in _0x14f427[_0x57a3('0x22')]){if(_0x14f427['variable']['hasOwnProperty'](_0x2a56a2)){this[_0x57a3('0x1c')][_0x14f427[_0x57a3('0x1d')]][_0x2a56a2]=_0x14f427[_0x57a3('0x23')];}}}};Fax[_0x57a3('0x16')]['syncNewState']=function(_0x5cdace){if(this[_0x57a3('0x1c')][_0x5cdace[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x5cdace['uniqueid']][_0x57a3('0x24')]=_0x5cdace[_0x57a3('0x24')];this[_0x57a3('0x1c')][_0x5cdace['uniqueid']][_0x57a3('0x25')]=_0x5cdace[_0x57a3('0x25')];}};Fax['prototype']['syncNewExten']=function(_0x3f70b8){if(this[_0x57a3('0x1c')][_0x3f70b8[_0x57a3('0x1d')]]){for(var _0x479cc0 in _0x3f70b8['variable']){if(_0x3f70b8['variable']['hasOwnProperty'](_0x479cc0)){this[_0x57a3('0x1c')][_0x3f70b8[_0x57a3('0x1d')]][_0x479cc0]=_0x3f70b8[_0x57a3('0x23')];}}}};Fax[_0x57a3('0x16')]['syncFaxStatus']=function(_0x55759d){if(this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]][_0x57a3('0x26')]=_0x55759d['operation'];this[_0x57a3('0x1c')][_0x55759d['uniqueid']][_0x57a3('0x27')]=_0x55759d[_0x57a3('0x27')];this[_0x57a3('0x1c')][_0x55759d[_0x57a3('0x1d')]][_0x57a3('0x1b')]=_0x55759d[_0x57a3('0x1b')];this[_0x57a3('0x1c')][_0x55759d['uniqueid']][_0x57a3('0x28')]=_0x55759d[_0x57a3('0x28')];logger[_0x57a3('0x20')](_0x55759d['uniqueid'],_0x57a3('0x29'));}};Fax['prototype']['syncReceiveFax']=function(_0x295d4e){var _0x227fd9=this;if(this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]]){var _0xc73a32=this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]]['id'];this['channels'][_0x295d4e[_0x57a3('0x1d')]]['remotestationid']=_0x295d4e['remotestationid'];this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2a')]=_0x295d4e[_0x57a3('0x2a')];this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x1b')]=_0x295d4e[_0x57a3('0x1b')];this[_0x57a3('0x1c')][_0x295d4e['uniqueid']]['resolution']=_0x295d4e[_0x57a3('0x2b')];this['channels'][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2c')]=_0x295d4e[_0x57a3('0x2c')];this['channels'][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x28')]=_0x295d4e[_0x57a3('0x28')];this[_0x57a3('0x1c')][_0x295d4e['uniqueid']][_0x57a3('0x2d')]=_0x295d4e[_0x57a3('0x2d')];if(this[_0x57a3('0x1c')][_0x295d4e[_0x57a3('0x1d')]][_0x57a3('0x2a')]>0x0){tiff2pdf(_0x295d4e['filename'],_0x57a3('0x2e'),function(_0x2db266){logger[_0x57a3('0x20')](_0x295d4e[_0x57a3('0x1d')],_0x57a3('0x2f'),_0x2db266[_0x57a3('0x30')]);attachment['create']({'name':path['parse'](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')],'basename':path[_0x57a3('0x31')](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')]+'.pdf','type':_0x57a3('0x32')})[_0x57a3('0x33')](function(_0x4cf676){faxAccount[_0x57a3('0x34')](_0xc73a32,{'from':_0x295d4e[_0x57a3('0x2d')],'mapKey':_0x57a3('0x5'),'body':path[_0x57a3('0x31')](_0x295d4e[_0x57a3('0x28')])[_0x57a3('0x1f')]+_0x57a3('0x35'),'AttachmentId':_0x4cf676['id']})[_0x57a3('0x36')](function(_0x2432e4){logger[_0x57a3('0x37')](_0x295d4e['uniqueid'],_0x57a3('0x38'),JSON[_0x57a3('0x39')](_0x2432e4));});})['catch'](function(_0x4f1b93){logger[_0x57a3('0x37')](_0x295d4e[_0x57a3('0x1d')],'\x20receiveFax\x20',JSON[_0x57a3('0x39')](_0x4f1b93));});});}logger[_0x57a3('0x20')](_0x295d4e[_0x57a3('0x1d')],_0x57a3('0x3a'));}};Fax[_0x57a3('0x16')][_0x57a3('0x15')]=function(_0x164d51){if(this[_0x57a3('0x3b')][_0x164d51[_0x57a3('0x1d')]]){_[_0x57a3('0x3c')](this[_0x57a3('0x1c')][_0x164d51['uniqueid']],_[_0x57a3('0x3d')](_0x164d51,['response','reason']));}};function updateStatus(_0x1818fb){if(_0x1818fb['AttachmentId']){faxMessage[_0x57a3('0x3e')](_0x1818fb[_0x57a3('0x3f')],{'failMessage':_0x57a3('0x40')})['then'](function(_0x341427){ut[_0x57a3('0x41')]('[Fax][Message][Error][Updated]',_0x341427);})[_0x57a3('0x36')](function(_0x2ca175){ut['logger'](_0x57a3('0x42'),_0x2ca175);});}else{ut[_0x57a3('0x41')](_0x57a3('0x43'));}}Fax[_0x57a3('0x16')][_0x57a3('0x44')]=function(_0xbe4b43,_0x2ee2a5,_0x3a482b){var _0x35e2fd=this;var _0x29ddff={};if(_0x2ee2a5){_0x29ddff={'read':_0x2ee2a5};}else{_0x29ddff={'failMessage':_0x3a482b};}if(this[_0x57a3('0x3b')][_0xbe4b43][_0x57a3('0x3f')]){faxMessage[_0x57a3('0x3e')](this[_0x57a3('0x3b')][_0xbe4b43][_0x57a3('0x3f')],_0x29ddff)['then'](function(_0x120e42){ut[_0x57a3('0x41')](_0x57a3('0x45'),_0x120e42);})[_0x57a3('0x36')](function(_0x122008){ut[_0x57a3('0x41')]('[Fax][Message][NoUpdate1]',_0x122008);})[_0x57a3('0x46')](function(){delete _0x35e2fd[_0x57a3('0x1c')][_0xbe4b43];delete _0x35e2fd['actions'][_0xbe4b43];});}else{ut[_0x57a3('0x41')](_0x57a3('0x47'));delete this[_0x57a3('0x1c')][_0xbe4b43];delete this[_0x57a3('0x3b')][_0xbe4b43];}};Fax['prototype'][_0x57a3('0x48')]=function(_0x6fc4fb){var _0x3764c1=this;if(this[_0x57a3('0x1c')][_0x6fc4fb['uniqueid']]){if(this[_0x57a3('0x3b')][_0x6fc4fb[_0x57a3('0x1d')]]){this[_0x57a3('0x1c')][_0x6fc4fb['uniqueid']]['id']=this[_0x57a3('0x3b')][_0x6fc4fb['uniqueid']]['id'];this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x1f')]=this['actions'][_0x6fc4fb['uniqueid']][_0x57a3('0x1f')];}logger['info'](_0x6fc4fb[_0x57a3('0x1d')],this[_0x57a3('0x3b')][_0x6fc4fb[_0x57a3('0x1d')]]?'\x20hangup\x20sendFile\x20':_0x57a3('0x49'),JSON[_0x57a3('0x39')](this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]));if(this['actions'][_0x6fc4fb[_0x57a3('0x1d')]]){if(this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]['faxpages']>0x0&&this['channels'][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x11')]===_0x57a3('0x4a')){this[_0x57a3('0x44')](_0x6fc4fb[_0x57a3('0x1d')],!![]);}else{this['updateStatus'](_0x6fc4fb[_0x57a3('0x1d')],![],this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]]['faxstatusstring']?_0x57a3('0x4b')+this[_0x57a3('0x1c')][_0x6fc4fb[_0x57a3('0x1d')]][_0x57a3('0x4c')]:'SENDING\x20FAILED');}}}};Fax[_0x57a3('0x16')][_0x57a3('0x4d')]=function(_0x481105){var _0x3bcc72=this;return new BPromise(function(_0x40bd7d,_0x168bd3){_0x3bcc72[_0x57a3('0x4e')](_0x481105,_0x3bcc72['faxAccounts'][_0x481105['FaxAccountId']])[_0x57a3('0x33')](function(_0x7ec7bf){ut[_0x57a3('0x41')](_0x57a3('0x4f'),_0x7ec7bf);_0x40bd7d(ut['message']('Fax\x20received'));})[_0x57a3('0x36')](function(_0x1f1af9){ut['logger']('[Fax][execOriginate][failure]',_0x1f1af9);updateStatus(_0x481105);_0x168bd3(ut[_0x57a3('0x30')](_0x57a3('0x50')));});});};Fax['prototype'][_0x57a3('0x51')]=function(_0x20da92){var _0x57cbe3=this;return new BPromise(function(_0x55aed5,_0x251ad1){var _0x381f92=_0x57cbe3[_0x57a3('0x52')](_0x57cbe3['faxAccounts'][_0x20da92[_0x57a3('0x53')]]['Trunk'],_0x20da92);if(_0x381f92['isValid']){_0x55aed5(ut['message']('Trunk\x20Reachable'));}else{_0x251ad1(ut[_0x57a3('0x30')](_0x381f92[_0x57a3('0x30')]));}});};function originate(_0x47336e,_0x181444,_0x2ee3d1){return new BPromise(function(_0x1c0a6f,_0xe6565a){if(_0x2ee3d1){var _0x59d945=util[_0x57a3('0x54')](_0x57a3('0x55'),path['parse'](_0x47336e[_0x57a3('0x3')])[_0x57a3('0x1f')],_0x47336e[_0x57a3('0x3')]);gs['execute'](_0x59d945)['then'](function(){_0x47336e[_0x57a3('0x3')]=util[_0x57a3('0x54')](_0x57a3('0x56'),path[_0x57a3('0x31')](_0x47336e[_0x57a3('0x3')])['dir'],path[_0x57a3('0x31')](_0x47336e[_0x57a3('0x3')])[_0x57a3('0x1f')]);_0x181444['XMF-PATH']=_0x47336e[_0x57a3('0x3')];ut[_0x57a3('0x41')]('Convert\x20pdf\x20to\x20tif','');ami[_0x57a3('0x57')](ut[_0x57a3('0x58')](_0x47336e,_0x181444))[_0x57a3('0x33')](function(_0x50446c){_0x1c0a6f(_0x50446c);})[_0x57a3('0x36')](function(_0x4e022e){_0xe6565a(_0x4e022e);});})[_0x57a3('0x36')](function(_0x22adf3){_0xe6565a(_0x22adf3);});}else{ami[_0x57a3('0x57')](ut[_0x57a3('0x58')](_0x47336e,_0x181444))[_0x57a3('0x33')](function(_0x5ee33e){_0x1c0a6f(_0x5ee33e);})[_0x57a3('0x36')](function(_0x5b9792){_0xe6565a(_0x5b9792);});}});}Fax[_0x57a3('0x16')][_0x57a3('0x4e')]=function(_0xfd5d5,_0x483e6f){var _0x1d671f=this;return new BPromise(function(_0x440aca,_0x455e88){var _0xfe4381=uuid['v4']();var _0x20abb6=ut[_0x57a3('0x59')](_0xfd5d5,_0x483e6f);_0x1d671f['actions'][_0xfe4381]=new Action(_0xfe4381,_0x483e6f,_0xfd5d5);var _0x22aa7d=_0x1d671f[_0x57a3('0x3b')][_0xfe4381];if(path[_0x57a3('0x31')](_0xfd5d5['path'])[_0x57a3('0x5a')]===_0x57a3('0x35')){originate(_0x22aa7d,_0x20abb6,!![])[_0x57a3('0x33')](function(_0x10ffa8){_0x440aca(_0x10ffa8);})[_0x57a3('0x36')](function(_0x15393b){_0x455e88(_0x15393b);});}else{originate(_0x22aa7d,_0x20abb6,![])['then'](function(_0x1da862){_0x440aca(_0x1da862);})[_0x57a3('0x36')](function(_0x905ed1){_0x455e88(_0x905ed1);});}});};Fax[_0x57a3('0x16')][_0x57a3('0x5b')]=function(_0x29488d){return!_[_0x57a3('0x5c')](_0x29488d)&&!_[_0x57a3('0x5c')](_0x29488d[_0x57a3('0x1f')])&&!_[_0x57a3('0x5c')](_0x29488d[_0x57a3('0x5d')])&&_0x29488d['active']&&!_[_0x57a3('0x5c')](this[_0x57a3('0xc')][util[_0x57a3('0x54')](_0x57a3('0x5e'),_0x29488d[_0x57a3('0x1f')])])&&!_[_0x57a3('0x5c')](this[_0x57a3('0xc')][util['format'](_0x57a3('0x5e'),_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')])&&(this['trunks'][util[_0x57a3('0x54')]('SIP/%s',_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')]===_0x57a3('0x5f')||this[_0x57a3('0xc')][util[_0x57a3('0x54')]('SIP/%s',_0x29488d[_0x57a3('0x1f')])][_0x57a3('0x27')]===_0x57a3('0x60'));};Fax['prototype'][_0x57a3('0x52')]=function(_0x3e9b84,_0x11597e){if(!this[_0x57a3('0x5b')](_0x3e9b84)){ut[_0x57a3('0x41')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x57a3('0x5c')](_0x3e9b84)?'':_0x3e9b84[_0x57a3('0x1f')]+_0x57a3('0x61'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x57a3('0x5c')](_0x11597e['fax'])){ut[_0x57a3('0x41')](_0x57a3('0x62'),JSON[_0x57a3('0x39')](_0x11597e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x57a3('0x5c')](_0x11597e[_0x57a3('0x3')])){ut[_0x57a3('0x41')](_0x57a3('0x63'),JSON[_0x57a3('0x39')](_0x11597e));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x57a3('0x64')};};module[_0x57a3('0x65')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 96f4883..dbba089 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 _0xc2c1=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc2c1,0x15b));var _0x1c2c=function(_0x9dec39,_0x5302b9){_0x9dec39=_0x9dec39-0x0;var _0x49cabb=_0xc2c1[_0x9dec39];return _0x49cabb;};'use strict';var util=require('util');var BPromise=require(_0x1c2c('0x0'));var logger=require(_0x1c2c('0x1'))(_0x1c2c('0x2'));var _=require(_0x1c2c('0x3'));var faxAccount=require(_0x1c2c('0x4'));function loggerCatch(_0x108c52){return function(_0x4e3ae2){logger[_0x1c2c('0x5')](_0x108c52,util[_0x1c2c('0x6')](_0x4e3ae2,{'showHidden':![],'depth':null}));};}exports[_0x1c2c('0x7')]=function(_0x4d6159,_0x554247){return BPromise[_0x1c2c('0x8')]()[_0x1c2c('0x9')](faxAccount[_0x1c2c('0x7')](_0x4d6159,_0x554247))[_0x1c2c('0xa')](loggerCatch(_0x1c2c('0xb')));}; \ No newline at end of file +var _0x25c5=['inspect','notify','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','error'];(function(_0x3b3077,_0x306f5d){var _0x35df63=function(_0x30a5e0){while(--_0x30a5e0){_0x3b3077['push'](_0x3b3077['shift']());}};_0x35df63(++_0x306f5d);}(_0x25c5,0x127));var _0x525c=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x25c5[_0x5c4e16];return _0x36044a;};'use strict';var util=require(_0x525c('0x0'));var BPromise=require('bluebird');var logger=require(_0x525c('0x1'))(_0x525c('0x2'));var _=require(_0x525c('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x9529da){return function(_0x35d36b){logger[_0x525c('0x4')](_0x9529da,util[_0x525c('0x5')](_0x35d36b,{'showHidden':![],'depth':null}));};}exports[_0x525c('0x6')]=function(_0x1ef7b0,_0xf0cf42){return BPromise['resolve']()[_0x525c('0x7')](faxAccount[_0x525c('0x6')](_0x1ef7b0,_0xf0cf42))[_0x525c('0x8')](loggerCatch(_0x525c('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 86c8885..d5b969c 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 _0x3844=['Exec\x20gs','info','\x20Error\x20:','util','fax','bluebird','child_process','execute'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3844,0x1d3));var _0x4384=function(_0x3866db,_0xe15717){_0x3866db=_0x3866db-0x0;var _0x4b15de=_0x3844[_0x3866db];return _0x4b15de;};'use strict';var util=require(_0x4384('0x0'));var logger=require('../../../../config/logger')(_0x4384('0x1'));var BPromise=require(_0x4384('0x2'));var exec=require(_0x4384('0x3'))['exec'];exports[_0x4384('0x4')]=function(_0x25e9b0){return new BPromise(function(_0x4241a4,_0x5c40f0){exec(_0x25e9b0,function(_0x19fe29,_0x17c3b3,_0x2f0049){logger['info'](_0x4384('0x5'),_0x17c3b3);if(_0x19fe29){logger[_0x4384('0x6')](_0x4384('0x5'),_0x4384('0x7'),util['inspect'](_0x19fe29,{'showHidden':![],'depth':null}),_0x17c3b3,_0x2f0049);_0x5c40f0(_0x19fe29);}_0x4241a4(_0x17c3b3);});});}; \ No newline at end of file +var _0xc507=['fax','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x388a9e,_0x318bec){var _0x14c623=function(_0xd3ecf0){while(--_0xd3ecf0){_0x388a9e['push'](_0x388a9e['shift']());}};_0x14c623(++_0x318bec);}(_0xc507,0x17f));var _0x7c50=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xc507[_0x31dde9];return _0x1fbf2d;};'use strict';var util=require(_0x7c50('0x0'));var logger=require('../../../../config/logger')(_0x7c50('0x1'));var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports[_0x7c50('0x2')]=function(_0x34240e){return new BPromise(function(_0x2fadfa,_0x1e0f76){exec(_0x34240e,function(_0x2f0dcf,_0xbe618a,_0x17a920){logger[_0x7c50('0x3')](_0x7c50('0x4'),_0xbe618a);if(_0x2f0dcf){logger[_0x7c50('0x3')](_0x7c50('0x4'),_0x7c50('0x5'),util['inspect'](_0x2f0dcf,{'showHidden':![],'depth':null}),_0xbe618a,_0x17a920);_0x1e0f76(_0x2f0dcf);}_0x2fadfa(_0xbe618a);});});}; \ 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 7c0ac0c..9e43ad4 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 _0x38fc=['moment','../../../../config/logger','fax','message','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','lodash'];(function(_0x1e770c,_0x450e0a){var _0x418372=function(_0x201f4c){while(--_0x201f4c){_0x1e770c['push'](_0x1e770c['shift']());}};_0x418372(++_0x450e0a);}(_0x38fc,0x107));var _0xc38f=function(_0x5c6573,_0x4bac44){_0x5c6573=_0x5c6573-0x0;var _0x3ca540=_0x38fc[_0x5c6573];return _0x3ca540;};'use strict';var util=require('util');var _=require(_0xc38f('0x0'));var moment=require(_0xc38f('0x1'));var logger=require(_0xc38f('0x2'))(_0xc38f('0x3'));exports[_0xc38f('0x4')]=function(_0x236840){return{'message':_0x236840};};exports['logger']=function(_0x636d8,_0x348f9f){logger['info'](_0x636d8,util[_0xc38f('0x5')](_0x348f9f,{'showHidden':![],'depth':null}));};exports[_0xc38f('0x6')]=function(_0x263bce,_0x2eac5b){var _0x837b39={'XMF-ECM':_0x2eac5b[_0xc38f('0x7')],'XMF-HEADERINFO':_0x2eac5b[_0xc38f('0x8')],'XMF-MINRATE':_0x2eac5b[_0xc38f('0x9')],'XMF-MAXRATE':_0x2eac5b[_0xc38f('0xa')],'XMF-MODEM':util['format'](_0xc38f('0xb'),_0x2eac5b[_0xc38f('0xc')]),'XMF-GATEWAY':_0x2eac5b[_0xc38f('0xd')],'XMF-FAXDETECT':_0x2eac5b[_0xc38f('0xe')],'XMF-T38TIMEOUT':_0x2eac5b[_0xc38f('0xf')],'XMF-LOCALSTATIONID':_0x2eac5b[_0xc38f('0x10')],'XMF-PATH':_0x263bce['path']};return _0x837b39;};exports[_0xc38f('0x11')]=function(_0x149033,_0x412e46){return{'actionid':_0x149033[_0xc38f('0x12')],'action':_0xc38f('0x13'),'channel':_0x149033[_0xc38f('0x14')],'Exten':'xcally-motion-fax','Context':_0xc38f('0x15'),'Priority':'1','callerid':util[_0xc38f('0x16')](_0xc38f('0x17'),_0x149033[_0xc38f('0x8')]?_0x149033[_0xc38f('0x8')]:'',_0x149033[_0xc38f('0x10')]),'variable':_0x412e46,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x149033[_0xc38f('0x12')]};}; \ No newline at end of file +var _0x37bb=['gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22','modem'];(function(_0x46b442,_0x3f31bf){var _0x250194=function(_0x5d5a2b){while(--_0x5d5a2b){_0x46b442['push'](_0x46b442['shift']());}};_0x250194(++_0x3f31bf);}(_0x37bb,0x1c3));var _0xb37b=function(_0x22e825,_0x41b89e){_0x22e825=_0x22e825-0x0;var _0x23cb70=_0x37bb[_0x22e825];return _0x23cb70;};'use strict';var util=require(_0xb37b('0x0'));var _=require(_0xb37b('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x4be54b){return{'message':_0x4be54b};};exports[_0xb37b('0x2')]=function(_0x363e23,_0x15ce7d){logger[_0xb37b('0x3')](_0x363e23,util[_0xb37b('0x4')](_0x15ce7d,{'showHidden':![],'depth':null}));};exports[_0xb37b('0x5')]=function(_0x651172,_0x5dff44){var _0x2ad607={'XMF-ECM':_0x5dff44[_0xb37b('0x6')],'XMF-HEADERINFO':_0x5dff44[_0xb37b('0x7')],'XMF-MINRATE':_0x5dff44['minrate'],'XMF-MAXRATE':_0x5dff44['maxrate'],'XMF-MODEM':util[_0xb37b('0x8')](_0xb37b('0x9'),_0x5dff44[_0xb37b('0xa')]),'XMF-GATEWAY':_0x5dff44[_0xb37b('0xb')],'XMF-FAXDETECT':_0x5dff44[_0xb37b('0xc')],'XMF-T38TIMEOUT':_0x5dff44[_0xb37b('0xd')],'XMF-LOCALSTATIONID':_0x5dff44[_0xb37b('0xe')],'XMF-PATH':_0x651172[_0xb37b('0xf')]};return _0x2ad607;};exports[_0xb37b('0x10')]=function(_0x1a9053,_0xf1c3f4){return{'actionid':_0x1a9053[_0xb37b('0x11')],'action':_0xb37b('0x12'),'channel':_0x1a9053[_0xb37b('0x13')],'Exten':_0xb37b('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0xb37b('0x8')](_0xb37b('0x15'),_0x1a9053[_0xb37b('0x7')]?_0x1a9053[_0xb37b('0x7')]:'',_0x1a9053[_0xb37b('0xe')]),'variable':_0xf1c3f4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a9053['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 49a547f..41a5865 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 _0x8fc2=['hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get'];(function(_0x37300b,_0x5c4f0e){var _0x1da725=function(_0x2b9c2c){while(--_0x2b9c2c){_0x37300b['push'](_0x37300b['shift']());}};_0x1da725(++_0x5c4f0e);}(_0x8fc2,0x1c8));var _0x28fc=function(_0x45e504,_0xf89f95){_0x45e504=_0x45e504-0x0;var _0x556d3=_0x8fc2[_0x45e504];return _0x556d3;};'use strict';var util=require(_0x28fc('0x0'));var moment=require(_0x28fc('0x1'));var server=require(_0x28fc('0x2'));var Realtime=require(_0x28fc('0x3'));var Report=require(_0x28fc('0x4'));var Acw=require(_0x28fc('0x5'));var Trigger=require(_0x28fc('0x6'));var Dialer=require(_0x28fc('0x7'));var Preview=require(_0x28fc('0x8'));var Fax=require(_0x28fc('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0x28fc('0xa'));var voiceQueueReport=require(_0x28fc('0xb'));var voiceCallReport=require(_0x28fc('0xc'));var trunk=require(_0x28fc('0xd'));var trigger=require(_0x28fc('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x28fc('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x28fc('0x10'));var zendesk=require(_0x28fc('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x28fc('0x12'));var freshdesk=require(_0x28fc('0x13'));var desk=require(_0x28fc('0x14'));var zoho=require(_0x28fc('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x28fc('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x28fc('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 logger=require(_0x28fc('0x18'))(_0x28fc('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x28fc('0x1a')](_0x28fc('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x28fc('0x1a')](_0x28fc('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x28fc('0x1c')]()[_0x28fc('0x1d')](user[_0x28fc('0x1e')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x1f')]())['then'](user[_0x28fc('0x20')]())[_0x28fc('0x1d')](realtime['initTelephones']())[_0x28fc('0x1d')](trunk[_0x28fc('0x21')]())['then'](realtime['initTrunks']())[_0x28fc('0x1d')](voiceQueue[_0x28fc('0x22')]())['then'](realtime['initVoiceQueues']())[_0x28fc('0x1d')](trigger['getTriggers']())['then'](realtime[_0x28fc('0x23')]())[_0x28fc('0x1d')](template[_0x28fc('0x24')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x25')]())[_0x28fc('0x1d')](zendesk[_0x28fc('0x26')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x27')]())[_0x28fc('0x1d')](salesforce[_0x28fc('0x28')]())['then'](realtime[_0x28fc('0x29')]())['then'](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x28fc('0x2a')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x2b')]())['then'](desk['getDeskAccounts']())[_0x28fc('0x1d')](realtime[_0x28fc('0x2c')]())[_0x28fc('0x1d')](zoho[_0x28fc('0x2d')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x2e')]())[_0x28fc('0x1d')](vtiger[_0x28fc('0x2f')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x30')]())['then'](freshsales[_0x28fc('0x31')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x32')]())[_0x28fc('0x1d')](servicenow[_0x28fc('0x33')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x34')]())[_0x28fc('0x1d')](dynamics365[_0x28fc('0x35')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x36')]())[_0x28fc('0x1d')](campaign[_0x28fc('0x37')]())['then'](realtime[_0x28fc('0x38')]())[_0x28fc('0x1d')](voiceExtension[_0x28fc('0x39')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x3a')]())[_0x28fc('0x1d')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())[_0x28fc('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x28fc('0x1c')]()['then'](voiceQueueReport[_0x28fc('0x3b')]())[_0x28fc('0x1d')](realtime['initVoiceQueueReports']())[_0x28fc('0x1d')](cmHopperHistory[_0x28fc('0x3c')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x3d')]())[_0x28fc('0x1d')](cmHopperHistory[_0x28fc('0x3e')]())[_0x28fc('0x1d')](realtime[_0x28fc('0x3f')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x28fc('0x1d')](realtime['initVoiceCallReports']())[_0x28fc('0x40')](function(_0x4c9624){logger[_0x28fc('0x41')]('[index.js][initParams]',util[_0x28fc('0x42')](_0x4c9624,{'showHidden':![],'depth':null}));});}function main(){return server[_0x28fc('0x43')](realtime,preview,fax)[_0x28fc('0x1d')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x28fc('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x28fc('0x40')](function(_0x22fba2){logger[_0x28fc('0x41')](_0x28fc('0x44'),util[_0x28fc('0x42')](_0x22fba2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xdb32=['getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','moment','./server','./realtime','./acw','./trigger','./preview','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xdb32,0x17d));var _0x2db3=function(_0x39c2ff,_0x2ddc46){_0x39c2ff=_0x39c2ff-0x0;var _0x12ba24=_0xdb32[_0x39c2ff];return _0x12ba24;};'use strict';var util=require('util');var moment=require(_0x2db3('0x0'));var server=require(_0x2db3('0x1'));var Realtime=require(_0x2db3('0x2'));var Report=require('./report');var Acw=require(_0x2db3('0x3'));var Trigger=require(_0x2db3('0x4'));var Dialer=require('./dialer');var Preview=require(_0x2db3('0x5'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x2db3('0x6'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x2db3('0x7'));var trigger=require(_0x2db3('0x8'));var template=require(_0x2db3('0x9'));var cmHopperHistory=require(_0x2db3('0xa'));var campaign=require(_0x2db3('0xb'));var voiceExtension=require(_0x2db3('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x2db3('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2db3('0xe'));var freshdesk=require(_0x2db3('0xf'));var desk=require(_0x2db3('0x10'));var zoho=require(_0x2db3('0x11'));var vtiger=require(_0x2db3('0x12'));var freshsales=require(_0x2db3('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2db3('0x14'))(_0x2db3('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2db3('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2db3('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2db3('0x18')]()[_0x2db3('0x19')](user[_0x2db3('0x1a')]())[_0x2db3('0x19')](realtime[_0x2db3('0x1b')]())[_0x2db3('0x19')](user[_0x2db3('0x1c')]())['then'](realtime['initTelephones']())['then'](trunk[_0x2db3('0x1d')]())['then'](realtime['initTrunks']())[_0x2db3('0x19')](voiceQueue['getVoiceQueues']())[_0x2db3('0x19')](realtime[_0x2db3('0x1e')]())[_0x2db3('0x19')](trigger[_0x2db3('0x1f')]())[_0x2db3('0x19')](realtime['initTriggers']())[_0x2db3('0x19')](template[_0x2db3('0x20')]())['then'](realtime[_0x2db3('0x21')]())[_0x2db3('0x19')](zendesk[_0x2db3('0x22')]())[_0x2db3('0x19')](realtime[_0x2db3('0x23')]())[_0x2db3('0x19')](salesforce[_0x2db3('0x24')]())[_0x2db3('0x19')](realtime[_0x2db3('0x25')]())[_0x2db3('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x2db3('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk['getFreshdeskAccounts']())[_0x2db3('0x19')](realtime[_0x2db3('0x26')]())[_0x2db3('0x19')](desk[_0x2db3('0x27')]())[_0x2db3('0x19')](realtime[_0x2db3('0x28')]())[_0x2db3('0x19')](zoho[_0x2db3('0x29')]())[_0x2db3('0x19')](realtime['initZohoAccounts']())[_0x2db3('0x19')](vtiger[_0x2db3('0x2a')]())[_0x2db3('0x19')](realtime[_0x2db3('0x2b')]())[_0x2db3('0x19')](freshsales[_0x2db3('0x2c')]())[_0x2db3('0x19')](realtime['initFreshsalesAccounts']())[_0x2db3('0x19')](servicenow[_0x2db3('0x2d')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0x2db3('0x19')](realtime[_0x2db3('0x2e')]())[_0x2db3('0x19')](campaign['getCampaigns']())[_0x2db3('0x19')](realtime[_0x2db3('0x2f')]())['then'](voiceExtension[_0x2db3('0x30')]())[_0x2db3('0x19')](realtime[_0x2db3('0x31')]())[_0x2db3('0x19')](faxAccount[_0x2db3('0x32')]())[_0x2db3('0x19')](realtime[_0x2db3('0x33')]())[_0x2db3('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x2db3('0x18')]()[_0x2db3('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x2db3('0x19')](realtime[_0x2db3('0x34')]())[_0x2db3('0x19')](cmHopperHistory[_0x2db3('0x35')]())[_0x2db3('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x2db3('0x19')](realtime['initCampaignHopperHistory']())[_0x2db3('0x19')](voiceCallReport[_0x2db3('0x36')]())['then'](realtime[_0x2db3('0x37')]())[_0x2db3('0x38')](function(_0x40e187){logger[_0x2db3('0x39')](_0x2db3('0x3a'),util['inspect'](_0x40e187,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2db3('0x3b')](realtime,preview,fax)[_0x2db3('0x19')](function(){return initRealtime();})[_0x2db3('0x19')](function(){return initParams();})['then'](function(){report[_0x2db3('0x3c')]();setInterval(initRealtime,0x1388);})[_0x2db3('0x38')](function(_0x2dfbb2){logger[_0x2db3('0x39')](_0x2db3('0x3d'),util['inspect'](_0x2dfbb2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 7fcfe8d..243f6f8 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 _0x3048=['unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','not_inuse','idle','inuse','talking','voiceStatus','statePause','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x4e3079,_0x2e48ea){var _0x4356fb=function(_0x3f31e0){while(--_0x3f31e0){_0x4e3079['push'](_0x4e3079['shift']());}};_0x4356fb(++_0x2e48ea);}(_0x3048,0x112));var _0x8304=function(_0x4abf85,_0x4fa266){_0x4abf85=_0x4abf85-0x0;var _0x4a531b=_0x3048[_0x4abf85];return _0x4a531b;};'use strict';var _=require(_0x8304('0x0'));var util=require(_0x8304('0x1'));var moment=require(_0x8304('0x2'));var md5=require(_0x8304('0x3'));var Redis=require(_0x8304('0x4'));var config=require(_0x8304('0x5'));config[_0x8304('0x6')]=_[_0x8304('0x7')](config[_0x8304('0x6')],{'host':_0x8304('0x8'),'port':0x18eb});var io=require(_0x8304('0x9'))(new Redis(config[_0x8304('0x6')]));function Agent(_0x440bcc){this['id']=_0x440bcc['id']||0x0;this[_0x8304('0xa')]=_0x440bcc[_0x8304('0xa')]||'';this[_0x8304('0xb')]=_0x440bcc[_0x8304('0xb')]||'';this[_0x8304('0xc')]=_0x440bcc[_0x8304('0xc')]||'';this['fullname']=_0x440bcc['fullname']||'';this['state']=_0x8304('0xd');this[_0x8304('0xe')]=0x0;this[_0x8304('0xf')]=_0x8304('0xd');this[_0x8304('0x10')]='';this[_0x8304('0x11')]='';this[_0x8304('0x12')]='';this[_0x8304('0x13')]='';this['online']=_0x440bcc[_0x8304('0x14')]||![];this['voiceStatus']=_0x8304('0xd');this[_0x8304('0x15')]=0x0;this[_0x8304('0x16')]='';this[_0x8304('0x17')]='';this[_0x8304('0x18')]=![];this[_0x8304('0x19')]=![];this[_0x8304('0x3')]='';}Agent[_0x8304('0x1a')]['updateStatusRealtime']=function(_0x321f60){var _0x2ac1ce;if(_0x321f60&&_0x321f60[_0x8304('0x1b')]){_0x2ac1ce=_0x321f60[_0x8304('0x1b')]['toLowerCase']();switch(_0x2ac1ce){case _0x8304('0x1c'):_0x2ac1ce=_0x8304('0x1d');break;case _0x8304('0x1e'):_0x2ac1ce=_0x8304('0x1f');break;}}if(_0x2ac1ce&&this[_0x8304('0x20')]!==_0x2ac1ce||_0x321f60[_0x8304('0x21')]){this[_0x8304('0x15')]=_['toNumber'](moment()[_0x8304('0x22')]('x'));}if(_0x2ac1ce){this['voiceStatus']=_0x2ac1ce;}var _0x421e8e={'id':this['id'],'name':this[_0x8304('0xa')],'email':this[_0x8304('0xb')],'accountcode':this[_0x8304('0xc')],'fullname':this['fullname'],'state':this[_0x8304('0x1b')],'stateTime':this['stateTime'],'status':this[_0x8304('0xf')],'address':this[_0x8304('0x10')],'online':this[_0x8304('0x14')],'voiceStatus':this[_0x8304('0x20')],'voiceStatusTime':this[_0x8304('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8304('0x17')],'interface':this[_0x8304('0x13')],'onhold':this[_0x8304('0x18')]};var _0x4d5c4b=md5(JSON['stringify'](_0x421e8e));if(this['md5']!==_0x4d5c4b){this['md5']=_0x4d5c4b;io['to'](util[_0x8304('0x22')](_0x8304('0x23'),_0x421e8e[_0x8304('0xa')]))[_0x8304('0x24')](_0x8304('0x25'),_[_0x8304('0x26')](_0x421e8e,[_0x8304('0x14')]));io[_0x8304('0x24')](_0x8304('0x27'),_0x421e8e);}};module[_0x8304('0x28')]=Agent; \ No newline at end of file +var _0x2ef7=['prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','status','onhold','user:%s','emit','user:presence','util','moment','md5','ioredis','../../../config/environment','redis','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x40af01,_0x5c3554){var _0x4adcde=function(_0x1e3aaa){while(--_0x1e3aaa){_0x40af01['push'](_0x40af01['shift']());}};_0x4adcde(++_0x5c3554);}(_0x2ef7,0x182));var _0x72ef=function(_0x117163,_0x27e684){_0x117163=_0x117163-0x0;var _0x583d2d=_0x2ef7[_0x117163];return _0x583d2d;};'use strict';var _=require('lodash');var util=require(_0x72ef('0x0'));var moment=require(_0x72ef('0x1'));var md5=require(_0x72ef('0x2'));var Redis=require(_0x72ef('0x3'));var config=require(_0x72ef('0x4'));config[_0x72ef('0x5')]=_['defaults'](config[_0x72ef('0x5')],{'host':_0x72ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x72ef('0x5')]));function Agent(_0x57c607){this['id']=_0x57c607['id']||0x0;this[_0x72ef('0x7')]=_0x57c607[_0x72ef('0x7')]||'';this[_0x72ef('0x8')]=_0x57c607[_0x72ef('0x8')]||'';this[_0x72ef('0x9')]=_0x57c607[_0x72ef('0x9')]||'';this[_0x72ef('0xa')]=_0x57c607[_0x72ef('0xa')]||'';this[_0x72ef('0xb')]=_0x72ef('0xc');this[_0x72ef('0xd')]=0x0;this['status']=_0x72ef('0xc');this[_0x72ef('0xe')]='';this[_0x72ef('0xf')]='';this['mobile']='';this[_0x72ef('0x10')]='';this[_0x72ef('0x11')]=_0x57c607['online']||![];this['voiceStatus']=_0x72ef('0xc');this['voiceStatusTime']=0x0;this[_0x72ef('0x12')]='';this[_0x72ef('0x13')]='';this['onhold']=![];this[_0x72ef('0x14')]=![];this[_0x72ef('0x2')]='';}Agent[_0x72ef('0x15')][_0x72ef('0x16')]=function(_0x3646c7){var _0x49af27;if(_0x3646c7&&_0x3646c7[_0x72ef('0xb')]){_0x49af27=_0x3646c7[_0x72ef('0xb')][_0x72ef('0x17')]();switch(_0x49af27){case _0x72ef('0x18'):_0x49af27='idle';break;case _0x72ef('0x19'):_0x49af27=_0x72ef('0x1a');break;}}if(_0x49af27&&this[_0x72ef('0x1b')]!==_0x49af27||_0x3646c7[_0x72ef('0x1c')]){this[_0x72ef('0x1d')]=_[_0x72ef('0x1e')](moment()[_0x72ef('0x1f')]('x'));}if(_0x49af27){this['voiceStatus']=_0x49af27;}var _0x5cd8c3={'id':this['id'],'name':this[_0x72ef('0x7')],'email':this['email'],'accountcode':this[_0x72ef('0x9')],'fullname':this[_0x72ef('0xa')],'state':this[_0x72ef('0xb')],'stateTime':this['stateTime'],'status':this[_0x72ef('0x20')],'address':this[_0x72ef('0xe')],'online':this[_0x72ef('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x72ef('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x72ef('0x13')],'interface':this['interface'],'onhold':this[_0x72ef('0x21')]};var _0x19cafb=md5(JSON['stringify'](_0x5cd8c3));if(this[_0x72ef('0x2')]!==_0x19cafb){this[_0x72ef('0x2')]=_0x19cafb;io['to'](util['format'](_0x72ef('0x22'),_0x5cd8c3[_0x72ef('0x7')]))[_0x72ef('0x23')]('user:ami:update',_['omit'](_0x5cd8c3,['online']));io[_0x72ef('0x23')](_0x72ef('0x24'),_0x5cd8c3);}};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 40d5450..3750324 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 _0x3dce=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0xf7f60a,_0x15f736){var _0x2567ad=function(_0x396850){while(--_0x396850){_0xf7f60a['push'](_0xf7f60a['shift']());}};_0x2567ad(++_0x15f736);}(_0x3dce,0x1ce));var _0xe3dc=function(_0x36fb58,_0x4212a9){_0x36fb58=_0x36fb58-0x0;var _0x1ec07f=_0x3dce[_0x36fb58];return _0x1ec07f;};'use strict';function Campaign(_0x595428){this['id']=_0x595428['id']||0x0;this[_0xe3dc('0x0')]=_0x595428[_0xe3dc('0x0')]||'';this['type']=_0x595428[_0xe3dc('0x1')]||'campaign';this[_0xe3dc('0x2')]=0x0;this[_0xe3dc('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xe3dc('0x4')]=!![];this[_0xe3dc('0x5')]=_0x595428[_0xe3dc('0x5')];this[_0xe3dc('0x6')]=_0x595428[_0xe3dc('0x6')];this[_0xe3dc('0x7')]=_0x595428['dialTimezone']||null;this['dialGlobalInterval']=_0x595428['dialGlobalInterval']?_0x595428[_0xe3dc('0x8')]:null;this[_0xe3dc('0x9')]=_0x595428[_0xe3dc('0x9')];this[_0xe3dc('0xa')]=_0x595428[_0xe3dc('0xa')];this[_0xe3dc('0xb')]=_0x595428['dialOriginateTimeout']||0x1e;this[_0xe3dc('0xc')]=_0x595428[_0xe3dc('0xc')];this[_0xe3dc('0xd')]=_0x595428[_0xe3dc('0xd')];this[_0xe3dc('0xe')]=_0x595428[_0xe3dc('0xe')];this[_0xe3dc('0xf')]=_0x595428[_0xe3dc('0xf')];this['dialNoAnswerMaxRetry']=_0x595428[_0xe3dc('0x10')];this['dialNoAnswerRetryFrequency']=_0x595428['dialNoAnswerRetryFrequency'];this[_0xe3dc('0x11')]=_0x595428[_0xe3dc('0x11')];this[_0xe3dc('0x12')]=_0x595428[_0xe3dc('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x595428[_0xe3dc('0x13')]||0x96;this['dialDropMaxRetry']=_0x595428[_0xe3dc('0x14')]||0x3;this[_0xe3dc('0x15')]=_0x595428['dialDropRetryFrequency']||0x96;this[_0xe3dc('0x16')]=_0x595428[_0xe3dc('0x16')]||0x3;this[_0xe3dc('0x17')]=_0x595428[_0xe3dc('0x17')]||0x96;this['dialMachineMaxRetry']=_0x595428[_0xe3dc('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x595428['dialMachineRetryFrequency']||0x96;this[_0xe3dc('0x19')]=_0x595428['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x595428[_0xe3dc('0x1a')]||0x96;this[_0xe3dc('0x1b')]=_0x595428[_0xe3dc('0x1b')]||_0xe3dc('0x1c');this['dialPrefix']=_0x595428[_0xe3dc('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x595428[_0xe3dc('0x1e')]||undefined;this[_0xe3dc('0x1f')]=_0x595428[_0xe3dc('0x1f')]||undefined;this[_0xe3dc('0x20')]=_0x595428['TrunkBackup']?_0x595428[_0xe3dc('0x20')]:undefined;this[_0xe3dc('0x21')]=_0x595428['Trunk']?_0x595428[_0xe3dc('0x21')]:undefined;this[_0xe3dc('0x22')]=_0x595428['Interval']?_0x595428[_0xe3dc('0x22')]:undefined;this[_0xe3dc('0x23')]=_0x595428[_0xe3dc('0x23')]?_0x595428[_0xe3dc('0x23')]:undefined;this['dialQueueProject']=_0x595428[_0xe3dc('0x23')]?_0x595428[_0xe3dc('0x23')][_0xe3dc('0x0')]:undefined;this[_0xe3dc('0x24')]=_0x595428[_0xe3dc('0x24')]||![];this[_0xe3dc('0x25')]=_0x595428['dialAMDInitialSilence'];this[_0xe3dc('0x26')]=_0x595428[_0xe3dc('0x26')];this[_0xe3dc('0x27')]=_0x595428['dialAMDAfterGreetingSilence'];this[_0xe3dc('0x28')]=_0x595428[_0xe3dc('0x28')];this[_0xe3dc('0x29')]=_0x595428['dialAMDMinWordLength'];this[_0xe3dc('0x2a')]=_0x595428[_0xe3dc('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x595428[_0xe3dc('0x2b')];this[_0xe3dc('0x2c')]=_0x595428[_0xe3dc('0x2c')];this['dialAMDMaximumWordLength']=_0x595428[_0xe3dc('0x2d')];}module[_0xe3dc('0x2e')]=Campaign; \ No newline at end of file +var _0xbbb1=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xbbb1,0xaf));var _0x1bbb=function(_0x4d544a,_0x3aa5cd){_0x4d544a=_0x4d544a-0x0;var _0x21b3f6=_0xbbb1[_0x4d544a];return _0x21b3f6;};'use strict';function Campaign(_0x138872){this['id']=_0x138872['id']||0x0;this[_0x1bbb('0x0')]=_0x138872[_0x1bbb('0x0')]||'';this[_0x1bbb('0x1')]=_0x138872[_0x1bbb('0x1')]||_0x1bbb('0x2');this['originated']=0x0;this[_0x1bbb('0x3')]=0x0;this[_0x1bbb('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1bbb('0x5')]='';this[_0x1bbb('0x6')]=!![];this[_0x1bbb('0x7')]=_0x138872[_0x1bbb('0x7')];this['limitCalls']=_0x138872['limitCalls'];this[_0x1bbb('0x8')]=_0x138872['dialTimezone']||null;this[_0x1bbb('0x9')]=_0x138872[_0x1bbb('0x9')]?_0x138872['dialGlobalInterval']:null;this[_0x1bbb('0xa')]=_0x138872['dialOriginateCallerIdName'];this[_0x1bbb('0xb')]=_0x138872['dialOriginateCallerIdNumber'];this[_0x1bbb('0xc')]=_0x138872[_0x1bbb('0xc')]||0x1e;this[_0x1bbb('0xd')]=_0x138872[_0x1bbb('0xd')];this[_0x1bbb('0xe')]=_0x138872['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x138872['dialBusyMaxRetry'];this[_0x1bbb('0xf')]=_0x138872[_0x1bbb('0xf')];this[_0x1bbb('0x10')]=_0x138872['dialNoAnswerMaxRetry'];this[_0x1bbb('0x11')]=_0x138872[_0x1bbb('0x11')];this[_0x1bbb('0x12')]=_0x138872[_0x1bbb('0x12')];this[_0x1bbb('0x13')]=_0x138872[_0x1bbb('0x13')]||0x3;this[_0x1bbb('0x14')]=_0x138872[_0x1bbb('0x14')]||0x96;this[_0x1bbb('0x15')]=_0x138872['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x138872[_0x1bbb('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x138872[_0x1bbb('0x17')]||0x3;this[_0x1bbb('0x18')]=_0x138872[_0x1bbb('0x18')]||0x96;this[_0x1bbb('0x19')]=_0x138872[_0x1bbb('0x19')]||0x3;this[_0x1bbb('0x1a')]=_0x138872['dialMachineRetryFrequency']||0x96;this[_0x1bbb('0x1b')]=_0x138872[_0x1bbb('0x1b')]||0x3;this[_0x1bbb('0x1c')]=_0x138872['dialAgentRejectRetryFrequency']||0x96;this[_0x1bbb('0x1d')]=_0x138872[_0x1bbb('0x1d')]||_0x1bbb('0x1e');this[_0x1bbb('0x1f')]=_0x138872[_0x1bbb('0x1f')]||undefined;this[_0x1bbb('0x20')]=_0x138872[_0x1bbb('0x20')]||undefined;this[_0x1bbb('0x21')]=_0x138872[_0x1bbb('0x21')]||undefined;this[_0x1bbb('0x22')]=_0x138872[_0x1bbb('0x22')]?_0x138872['TrunkBackup']:undefined;this['Trunk']=_0x138872[_0x1bbb('0x23')]?_0x138872[_0x1bbb('0x23')]:undefined;this['Interval']=_0x138872[_0x1bbb('0x24')]?_0x138872[_0x1bbb('0x24')]:undefined;this[_0x1bbb('0x25')]=_0x138872[_0x1bbb('0x25')]?_0x138872[_0x1bbb('0x25')]:undefined;this[_0x1bbb('0x26')]=_0x138872['SquareProject']?_0x138872[_0x1bbb('0x25')][_0x1bbb('0x0')]:undefined;this['dialAMDActive']=_0x138872[_0x1bbb('0x27')]||![];this['dialAMDInitialSilence']=_0x138872[_0x1bbb('0x28')];this[_0x1bbb('0x29')]=_0x138872['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x138872[_0x1bbb('0x2a')];this[_0x1bbb('0x2b')]=_0x138872[_0x1bbb('0x2b')];this[_0x1bbb('0x2c')]=_0x138872['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x138872[_0x1bbb('0x2d')];this[_0x1bbb('0x2e')]=_0x138872[_0x1bbb('0x2e')];this[_0x1bbb('0x2f')]=_0x138872[_0x1bbb('0x2f')];this['dialAMDMaximumWordLength']=_0x138872[_0x1bbb('0x30')];}module[_0x1bbb('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index daada8f..5b0aed6 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 _0x4849=['connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x5e0f60,_0x198e2c){var _0x2e318d=function(_0x1eef5e){while(--_0x1eef5e){_0x5e0f60['push'](_0x5e0f60['shift']());}};_0x2e318d(++_0x198e2c);}(_0x4849,0xf8));var _0x9484=function(_0xab0b30,_0x56a72a){_0xab0b30=_0xab0b30-0x0;var _0x13d302=_0x4849[_0xab0b30];return _0x13d302;};'use strict';function Channel(){this[_0x9484('0x0')]=null;this[_0x9484('0x1')]='';this[_0x9484('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x9484('0x3')]=undefined;this[_0x9484('0x4')]=undefined;this[_0x9484('0x5')]=0x0;this[_0x9484('0x6')]='';this[_0x9484('0x7')]=0x0;this[_0x9484('0x8')]=0x0;this[_0x9484('0x9')]=0x0;this[_0x9484('0xa')]=![];this[_0x9484('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x9484('0xc')]=![];this['lastapplication']='';this[_0x9484('0xd')]='';this[_0x9484('0xe')]=0x0;this[_0x9484('0xf')]=0x0;this[_0x9484('0x10')]=0x0;this[_0x9484('0x11')]=null;this[_0x9484('0x12')]=null;this[_0x9484('0x13')]=null;this[_0x9484('0x14')]=![];this[_0x9484('0x15')]=null;this[_0x9484('0x16')]=null;this[_0x9484('0x17')]=[];this[_0x9484('0x18')]=undefined;this[_0x9484('0x19')]=undefined;this[_0x9484('0x1a')]=undefined;this[_0x9484('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xb98e=['tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type'];(function(_0x40a849,_0x4fe974){var _0x530ebe=function(_0x5c4024){while(--_0x5c4024){_0x40a849['push'](_0x40a849['shift']());}};_0x530ebe(++_0x4fe974);}(_0xb98e,0x184));var _0xeb98=function(_0x509060,_0x19413e){_0x509060=_0x509060-0x0;var _0x10f5fc=_0xb98e[_0x509060];return _0x10f5fc;};'use strict';function Channel(){this[_0xeb98('0x0')]=null;this[_0xeb98('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0xeb98('0x2')]='';this[_0xeb98('0x3')]=undefined;this[_0xeb98('0x4')]=undefined;this['accountcode']=0x0;this[_0xeb98('0x5')]='';this[_0xeb98('0x6')]=0x0;this[_0xeb98('0x7')]=0x0;this['exten']=0x0;this[_0xeb98('0x8')]=![];this['answertime']=null;this[_0xeb98('0x9')]=null;this['unmanaged']=![];this[_0xeb98('0xa')]=![];this[_0xeb98('0xb')]='';this[_0xeb98('0xc')]='';this[_0xeb98('0xd')]=0x0;this[_0xeb98('0xe')]=0x0;this[_0xeb98('0xf')]=0x0;this[_0xeb98('0x10')]=null;this[_0xeb98('0x11')]=null;this['disposition']=null;this[_0xeb98('0x12')]=![];this[_0xeb98('0x13')]=null;this[_0xeb98('0x14')]=null;this[_0xeb98('0x15')]=[];this[_0xeb98('0x16')]=undefined;this[_0xeb98('0x17')]=undefined;this[_0xeb98('0x18')]=undefined;this[_0xeb98('0x19')]=0x0;}module[_0xeb98('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 4adf813..33b0fdf 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 _0xb12e=['type','serverUrl','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4242b8,_0x222703){var _0x47c1c8=function(_0x1ef3b0){while(--_0x1ef3b0){_0x4242b8['push'](_0x4242b8['shift']());}};_0x47c1c8(++_0x222703);}(_0xb12e,0x98));var _0xeb12=function(_0x334b1a,_0x57117d){_0x334b1a=_0x334b1a-0x0;var _0x42a39c=_0xb12e[_0x334b1a];return _0x42a39c;};'use strict';function DeskAccount(_0x2bed29){this['id']=_0x2bed29['id']||0x0;this[_0xeb12('0x0')]=_0x2bed29[_0xeb12('0x0')]||'';this[_0xeb12('0x1')]=_0x2bed29[_0xeb12('0x1')]||'';this[_0xeb12('0x2')]=_0x2bed29[_0xeb12('0x2')]||'';this['authType']=_0x2bed29['authType']||'';this[_0xeb12('0x3')]=_0x2bed29['password']||'';this[_0xeb12('0x4')]=_0x2bed29['consumerKey']||'';this[_0xeb12('0x5')]=_0x2bed29[_0xeb12('0x5')]||'';this['token']=_0x2bed29[_0xeb12('0x6')]||'';this[_0xeb12('0x7')]=_0x2bed29[_0xeb12('0x7')]||'';this[_0xeb12('0x8')]=_0x2bed29[_0xeb12('0x8')]||'';this[_0xeb12('0x9')]=_0x2bed29[_0xeb12('0x9')]||'';this['Configurations']=_0x2bed29['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xa095=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x4a3986,_0x56fbc9){var _0x4cb64a=function(_0xba1b7d){while(--_0xba1b7d){_0x4a3986['push'](_0x4a3986['shift']());}};_0x4cb64a(++_0x56fbc9);}(_0xa095,0x15a));var _0x5a09=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0xa095[_0x1966f3];return _0x17575f;};'use strict';function DeskAccount(_0xba8148){this['id']=_0xba8148['id']||0x0;this[_0x5a09('0x0')]=_0xba8148[_0x5a09('0x0')]||'';this[_0x5a09('0x1')]=_0xba8148[_0x5a09('0x1')]||'';this[_0x5a09('0x2')]=_0xba8148['remoteUri']||'';this['authType']=_0xba8148['authType']||'';this[_0x5a09('0x3')]=_0xba8148[_0x5a09('0x3')]||'';this[_0x5a09('0x4')]=_0xba8148['consumerKey']||'';this[_0x5a09('0x5')]=_0xba8148[_0x5a09('0x5')]||'';this[_0x5a09('0x6')]=_0xba8148[_0x5a09('0x6')]||'';this[_0x5a09('0x7')]=_0xba8148[_0x5a09('0x7')]||'';this[_0x5a09('0x8')]=_0xba8148[_0x5a09('0x8')]||'';this[_0x5a09('0x9')]=_0xba8148[_0x5a09('0x9')]||'';this[_0x5a09('0xa')]=_0xba8148[_0x5a09('0xa')]||{};}module[_0x5a09('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 12dfb7c..2bd16c1 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 _0x7a16=['username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x343dfb,_0xed8587){var _0x297fe2=function(_0x19cbbd){while(--_0x19cbbd){_0x343dfb['push'](_0x343dfb['shift']());}};_0x297fe2(++_0xed8587);}(_0x7a16,0x103));var _0x67a1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7a16[_0x17d9e3];return _0x14192d;};'use strict';function Dynamics365Account(_0x234fdf){this['id']=_0x234fdf['id']||0x0;this[_0x67a1('0x0')]=_0x234fdf[_0x67a1('0x0')]||'';this[_0x67a1('0x1')]=_0x234fdf['username']||'';this[_0x67a1('0x2')]=_0x234fdf[_0x67a1('0x2')]||'';this[_0x67a1('0x3')]=_0x234fdf[_0x67a1('0x3')]||'';this['tenantId']=_0x234fdf[_0x67a1('0x4')]||'';this['clientId']=_0x234fdf['clientId']||'';this['clientSecret']=_0x234fdf[_0x67a1('0x5')]||{};this[_0x67a1('0x6')]=_0x234fdf[_0x67a1('0x6')]||'';this['modernAuthentication']=_0x234fdf[_0x67a1('0x7')]||![];this['Configurations']=_0x234fdf[_0x67a1('0x8')]||{};this['CloudProvider']=_0x234fdf[_0x67a1('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xbd0d=['tenantId','clientId','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x396b75,_0x29953d){var _0x40d0ad=function(_0x3291ad){while(--_0x3291ad){_0x396b75['push'](_0x396b75['shift']());}};_0x40d0ad(++_0x29953d);}(_0xbd0d,0xa1));var _0xdbd0=function(_0x54bf67,_0x5381e5){_0x54bf67=_0x54bf67-0x0;var _0x5f18a9=_0xbd0d[_0x54bf67];return _0x5f18a9;};'use strict';function Dynamics365Account(_0x921a1a){this['id']=_0x921a1a['id']||0x0;this[_0xdbd0('0x0')]=_0x921a1a['name']||'';this[_0xdbd0('0x1')]=_0x921a1a[_0xdbd0('0x1')]||'';this[_0xdbd0('0x2')]=_0x921a1a[_0xdbd0('0x2')]||'';this[_0xdbd0('0x3')]=_0x921a1a[_0xdbd0('0x3')]||'';this['tenantId']=_0x921a1a[_0xdbd0('0x4')]||'';this['clientId']=_0x921a1a[_0xdbd0('0x5')]||'';this['clientSecret']=_0x921a1a['clientSecret']||{};this[_0xdbd0('0x6')]=_0x921a1a[_0xdbd0('0x6')]||'';this['modernAuthentication']=_0x921a1a[_0xdbd0('0x7')]||![];this[_0xdbd0('0x8')]=_0x921a1a[_0xdbd0('0x8')]||{};this[_0xdbd0('0x9')]=_0x921a1a[_0xdbd0('0x9')]||{};}module[_0xdbd0('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c742dbb..dd274cd 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 _0x39b9=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x39b9,0x181));var _0x939b=function(_0x3655fc,_0x167d5d){_0x3655fc=_0x3655fc-0x0;var _0x535e43=_0x39b9[_0x3655fc];return _0x535e43;};'use strict';function FaxAccount(_0x5949ab){this['id']=_0x5949ab['id']||0x0;this[_0x939b('0x0')]=_0x5949ab['name']||'';this[_0x939b('0x1')]=_0x5949ab[_0x939b('0x1')];this[_0x939b('0x2')]=_0x5949ab['ecm'];this[_0x939b('0x3')]=_0x5949ab[_0x939b('0x3')];this[_0x939b('0x4')]=_0x5949ab[_0x939b('0x4')];this[_0x939b('0x5')]=_0x5949ab[_0x939b('0x5')]||0x960;this[_0x939b('0x6')]=_0x5949ab['maxrate']||0x3840;this[_0x939b('0x7')]=_0x5949ab[_0x939b('0x7')]||'v17,v27,v29';this[_0x939b('0x8')]=_0x5949ab[_0x939b('0x8')]||'no';this[_0x939b('0x9')]=_0x5949ab['faxdetect']||'no';this[_0x939b('0xa')]=_0x5949ab[_0x939b('0xa')]||0x1388;this[_0x939b('0xb')]=_0x5949ab['tech']||'SIP';this[_0x939b('0xc')]=_0x5949ab[_0x939b('0xc')]?_0x5949ab[_0x939b('0xc')]:undefined;this['ListId']=_0x5949ab['ListId'];this['key']=_0x5949ab[_0x939b('0xd')];}module[_0x939b('0xe')]=FaxAccount; \ No newline at end of file +var _0x97df=['name','description','ecm','headerinfo','minrate','modem','gateway','faxdetect','t38timeout','tech','SIP','ListId','key','exports'];(function(_0x3fc8b1,_0x50e94f){var _0x5f18a9=function(_0x592070){while(--_0x592070){_0x3fc8b1['push'](_0x3fc8b1['shift']());}};_0x5f18a9(++_0x50e94f);}(_0x97df,0x196));var _0xf97d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x97df[_0x5b644e];return _0x49c6bf;};'use strict';function FaxAccount(_0x176a91){this['id']=_0x176a91['id']||0x0;this[_0xf97d('0x0')]=_0x176a91['name']||'';this[_0xf97d('0x1')]=_0x176a91[_0xf97d('0x1')];this[_0xf97d('0x2')]=_0x176a91[_0xf97d('0x2')];this['headerinfo']=_0x176a91[_0xf97d('0x3')];this['localstationid']=_0x176a91['localstationid'];this['minrate']=_0x176a91[_0xf97d('0x4')]||0x960;this['maxrate']=_0x176a91['maxrate']||0x3840;this[_0xf97d('0x5')]=_0x176a91[_0xf97d('0x5')]||'v17,v27,v29';this[_0xf97d('0x6')]=_0x176a91[_0xf97d('0x6')]||'no';this[_0xf97d('0x7')]=_0x176a91[_0xf97d('0x7')]||'no';this[_0xf97d('0x8')]=_0x176a91['t38timeout']||0x1388;this[_0xf97d('0x9')]=_0x176a91[_0xf97d('0x9')]||_0xf97d('0xa');this['Trunk']=_0x176a91['Trunk']?_0x176a91['Trunk']:undefined;this[_0xf97d('0xb')]=_0x176a91[_0xf97d('0xb')];this[_0xf97d('0xc')]=_0x176a91[_0xf97d('0xc')];}module[_0xf97d('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index a565117..51d67f1 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 _0x813f=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3ff6fa,_0x1455bc){var _0xccc492=function(_0x186789){while(--_0x186789){_0x3ff6fa['push'](_0x3ff6fa['shift']());}};_0xccc492(++_0x1455bc);}(_0x813f,0x71));var _0xf813=function(_0x30361b,_0x59bbf4){_0x30361b=_0x30361b-0x0;var _0x7a35d7=_0x813f[_0x30361b];return _0x7a35d7;};'use strict';function FreshdeskAccount(_0xe3d37e){this['id']=_0xe3d37e['id']||0x0;this[_0xf813('0x0')]=_0xe3d37e['name']||'';this[_0xf813('0x1')]=_0xe3d37e[_0xf813('0x1')]||'';this[_0xf813('0x2')]=_0xe3d37e[_0xf813('0x3')]||'';this[_0xf813('0x4')]=_0xe3d37e['remoteUri']||'';this[_0xf813('0x5')]=_0xe3d37e['serverUrl']||'';this['Configurations']=_0xe3d37e[_0xf813('0x6')]||{};}module[_0xf813('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x6795=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x40be88,_0x297064){var _0x34bc86=function(_0x213fc1){while(--_0x213fc1){_0x40be88['push'](_0x40be88['shift']());}};_0x34bc86(++_0x297064);}(_0x6795,0x19f));var _0x5679=function(_0x9c75f4,_0xc54e83){_0x9c75f4=_0x9c75f4-0x0;var _0x57f1db=_0x6795[_0x9c75f4];return _0x57f1db;};'use strict';function FreshdeskAccount(_0x20171a){this['id']=_0x20171a['id']||0x0;this[_0x5679('0x0')]=_0x20171a['name']||'';this[_0x5679('0x1')]=_0x20171a[_0x5679('0x1')]||'';this[_0x5679('0x2')]=_0x20171a[_0x5679('0x3')]||'';this[_0x5679('0x4')]=_0x20171a[_0x5679('0x4')]||'';this[_0x5679('0x5')]=_0x20171a[_0x5679('0x5')]||'';this['Configurations']=_0x20171a[_0x5679('0x6')]||{};}module[_0x5679('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 35e4e9c..fd07b69 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 _0x4491=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x4491,0x1bb));var _0x1449=function(_0x3ba744,_0x4163e8){_0x3ba744=_0x3ba744-0x0;var _0x441766=_0x4491[_0x3ba744];return _0x441766;};'use strict';function FreshsalesAccount(_0x8e450b){this['id']=_0x8e450b['id']||0x0;this['name']=_0x8e450b[_0x1449('0x0')]||'';this['username']=_0x8e450b[_0x1449('0x1')]||'';this[_0x1449('0x2')]=_0x8e450b[_0x1449('0x3')]||'';this[_0x1449('0x4')]=_0x8e450b[_0x1449('0x4')]||'';this[_0x1449('0x5')]=_0x8e450b['serverUrl']||'';this[_0x1449('0x6')]=_0x8e450b['Configurations']||{};}module[_0x1449('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x9fd4=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x5872a8,_0x43d517){var _0x397ee9=function(_0x5bed01){while(--_0x5bed01){_0x5872a8['push'](_0x5872a8['shift']());}};_0x397ee9(++_0x43d517);}(_0x9fd4,0x16c));var _0x49fd=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x9fd4[_0x30a31e];return _0x170879;};'use strict';function FreshsalesAccount(_0x478dc7){this['id']=_0x478dc7['id']||0x0;this[_0x49fd('0x0')]=_0x478dc7[_0x49fd('0x0')]||'';this[_0x49fd('0x1')]=_0x478dc7[_0x49fd('0x1')]||'';this[_0x49fd('0x2')]=_0x478dc7[_0x49fd('0x3')]||'';this[_0x49fd('0x4')]=_0x478dc7[_0x49fd('0x4')]||'';this['serverUrl']=_0x478dc7['serverUrl']||'';this[_0x49fd('0x5')]=_0x478dc7[_0x49fd('0x5')]||{};}module[_0x49fd('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ece86bd..d6fc57d 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 _0x3f8b=['connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','routealias','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x3df548,_0x2b8767){var _0xc27204=function(_0xa2b77f){while(--_0xa2b77f){_0x3df548['push'](_0x3df548['shift']());}};_0xc27204(++_0x2b8767);}(_0x3f8b,0x179));var _0xb3f8=function(_0x393ad5,_0x2a7a68){_0x393ad5=_0x393ad5-0x0;var _0x31f723=_0x3f8b[_0x393ad5];return _0x31f723;};'use strict';function QueueReport(){this['type']=_0xb3f8('0x0');this[_0xb3f8('0x1')]='';this['calleridnum']='';this[_0xb3f8('0x2')]='';this[_0xb3f8('0x3')]='';this[_0xb3f8('0x4')]=null;this[_0xb3f8('0x5')]=null;this[_0xb3f8('0x6')]=0x1;this[_0xb3f8('0x7')]=0x1;this[_0xb3f8('0x8')]=![];this[_0xb3f8('0x9')]=null;this[_0xb3f8('0xa')]=![];this[_0xb3f8('0xb')]=null;this[_0xb3f8('0xc')]=![];this[_0xb3f8('0xd')]=null;this[_0xb3f8('0xe')]=0x1;this['channel']='';this[_0xb3f8('0xf')]='';this[_0xb3f8('0x10')]='';this[_0xb3f8('0x11')]='';this[_0xb3f8('0x12')]='';this[_0xb3f8('0x13')]='';this[_0xb3f8('0x14')]='';this[_0xb3f8('0x15')]=0x0;this['assigned']=![];this[_0xb3f8('0x16')]='';this[_0xb3f8('0x17')]=_0xb3f8('0x18');this[_0xb3f8('0x19')]=null;this['mohtime']=0x0;this[_0xb3f8('0x1a')]={};}module[_0xb3f8('0x1b')]=QueueReport; \ No newline at end of file +var _0x3954=['position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x141fc9,_0x55220e){var _0x666f38=function(_0x5cb21e){while(--_0x5cb21e){_0x141fc9['push'](_0x141fc9['shift']());}};_0x666f38(++_0x55220e);}(_0x3954,0x121));var _0x4395=function(_0x483cb8,_0x26d6df){_0x483cb8=_0x483cb8-0x0;var _0xdd3ca8=_0x3954[_0x483cb8];return _0xdd3ca8;};'use strict';function QueueReport(){this[_0x4395('0x0')]=_0x4395('0x1');this[_0x4395('0x2')]='';this[_0x4395('0x3')]='';this[_0x4395('0x4')]='';this[_0x4395('0x5')]='';this[_0x4395('0x6')]=null;this[_0x4395('0x7')]=null;this[_0x4395('0x8')]=0x1;this[_0x4395('0x9')]=0x1;this[_0x4395('0xa')]=![];this[_0x4395('0xb')]=null;this[_0x4395('0xc')]=![];this['queuecallercompleteAt']=null;this[_0x4395('0xd')]=![];this['queuecallerexitAt']=null;this[_0x4395('0xe')]=0x1;this[_0x4395('0xf')]='';this[_0x4395('0x10')]='';this[_0x4395('0x11')]='';this[_0x4395('0x12')]='';this['context']='';this[_0x4395('0x13')]='';this[_0x4395('0x14')]='';this['holdtime']=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x4395('0x15')]=_0x4395('0x16');this[_0x4395('0x17')]=null;this[_0x4395('0x18')]=0x0;this[_0x4395('0x19')]={};}module[_0x4395('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 11097c7..b4bafd7 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 _0xf263=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x16952e,_0x55df1c){var _0x2eb48c=function(_0x585258){while(--_0x585258){_0x16952e['push'](_0x16952e['shift']());}};_0x2eb48c(++_0x55df1c);}(_0xf263,0x141));var _0x3f26=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xf263[_0xdaab62];return _0x13d767;};'use strict';function SalesforceAccount(_0x2eec20){this['id']=_0x2eec20['id']||0x0;this['name']=_0x2eec20[_0x3f26('0x0')]||'';this[_0x3f26('0x1')]=_0x2eec20[_0x3f26('0x1')]||'';this[_0x3f26('0x2')]=_0x2eec20['remoteUri']||'';this[_0x3f26('0x3')]=_0x2eec20[_0x3f26('0x3')]||'';this[_0x3f26('0x4')]=_0x2eec20[_0x3f26('0x4')]||'';this['clientSecret']=_0x2eec20[_0x3f26('0x5')]||'';this[_0x3f26('0x6')]=_0x2eec20[_0x3f26('0x6')]||'';this['type']=_0x2eec20[_0x3f26('0x7')]||_0x3f26('0x8');this[_0x3f26('0x9')]=_0x2eec20[_0x3f26('0x9')]||'';this[_0x3f26('0xa')]=_0x2eec20[_0x3f26('0xa')]||{};}module[_0x3f26('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x471a=['exports','name','username','remoteUri','password','clientSecret','type','integrationTab','serverUrl'];(function(_0x2283fc,_0xa206f9){var _0x4e6f2c=function(_0x1a44d3){while(--_0x1a44d3){_0x2283fc['push'](_0x2283fc['shift']());}};_0x4e6f2c(++_0xa206f9);}(_0x471a,0x18d));var _0xa471=function(_0x9eb62c,_0x10fd6a){_0x9eb62c=_0x9eb62c-0x0;var _0x32ee4f=_0x471a[_0x9eb62c];return _0x32ee4f;};'use strict';function SalesforceAccount(_0x111399){this['id']=_0x111399['id']||0x0;this[_0xa471('0x0')]=_0x111399[_0xa471('0x0')]||'';this['username']=_0x111399[_0xa471('0x1')]||'';this[_0xa471('0x2')]=_0x111399[_0xa471('0x2')]||'';this[_0xa471('0x3')]=_0x111399['password']||'';this['clientId']=_0x111399['clientId']||'';this[_0xa471('0x4')]=_0x111399['clientSecret']||'';this['securityToken']=_0x111399['securityToken']||'';this[_0xa471('0x5')]=_0x111399[_0xa471('0x5')]||_0xa471('0x6');this['serverUrl']=_0x111399[_0xa471('0x7')]||'';this['Configurations']=_0x111399['Configurations']||{};}module[_0xa471('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8ff1e95..4a3a092 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 _0xfa9f=['password','remoteUri','serverUrl','Configurations','name'];(function(_0x5bb8f9,_0x5e978c){var _0x56c449=function(_0x3c027b){while(--_0x3c027b){_0x5bb8f9['push'](_0x5bb8f9['shift']());}};_0x56c449(++_0x5e978c);}(_0xfa9f,0xbd));var _0xffa9=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0xfa9f[_0x1fc18b];return _0x16a351;};'use strict';function ServicenowAccount(_0x9b0c4f){this['id']=_0x9b0c4f['id']||0x0;this['name']=_0x9b0c4f[_0xffa9('0x0')]||'';this['username']=_0x9b0c4f['username']||'';this[_0xffa9('0x1')]=_0x9b0c4f['password']||'';this['remoteUri']=_0x9b0c4f[_0xffa9('0x2')]||'';this[_0xffa9('0x3')]=_0x9b0c4f[_0xffa9('0x3')]||'';this[_0xffa9('0x4')]=_0x9b0c4f['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x35ff=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x41f073,_0x507baf){var _0x4eafa3=function(_0x1e97f3){while(--_0x1e97f3){_0x41f073['push'](_0x41f073['shift']());}};_0x4eafa3(++_0x507baf);}(_0x35ff,0x1cd));var _0xf35f=function(_0x1f25a3,_0x2a9c8d){_0x1f25a3=_0x1f25a3-0x0;var _0xc97ed6=_0x35ff[_0x1f25a3];return _0xc97ed6;};'use strict';function ServicenowAccount(_0x19c67b){this['id']=_0x19c67b['id']||0x0;this[_0xf35f('0x0')]=_0x19c67b['name']||'';this[_0xf35f('0x1')]=_0x19c67b[_0xf35f('0x1')]||'';this['password']=_0x19c67b[_0xf35f('0x2')]||'';this['remoteUri']=_0x19c67b[_0xf35f('0x3')]||'';this['serverUrl']=_0x19c67b[_0xf35f('0x4')]||'';this['Configurations']=_0x19c67b['Configurations']||{};}module[_0xf35f('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 d63b5da..cc691e3 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 _0x7f1d=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7f1d,0x180));var _0xd7f1=function(_0x1273bb,_0x193a23){_0x1273bb=_0x1273bb-0x0;var _0x107662=_0x7f1d[_0x1273bb];return _0x107662;};'use strict';function SugarcrmAccount(_0x32a8b0){this['id']=_0x32a8b0['id']||0x0;this[_0xd7f1('0x0')]=_0x32a8b0[_0xd7f1('0x0')]||'';this[_0xd7f1('0x1')]=_0x32a8b0[_0xd7f1('0x1')]||'';this['password']=_0x32a8b0[_0xd7f1('0x2')]||'';this[_0xd7f1('0x3')]=_0x32a8b0['remoteUri']||'';this[_0xd7f1('0x4')]=_0x32a8b0[_0xd7f1('0x4')]||'';this[_0xd7f1('0x5')]=_0x32a8b0[_0xd7f1('0x5')]||{};}module[_0xd7f1('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x3916=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x40dc83,_0x2afdda){var _0x3694b5=function(_0x12d464){while(--_0x12d464){_0x40dc83['push'](_0x40dc83['shift']());}};_0x3694b5(++_0x2afdda);}(_0x3916,0x18d));var _0x6391=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x3916[_0x265aa2];return _0x447a3a;};'use strict';function SugarcrmAccount(_0x5b654a){this['id']=_0x5b654a['id']||0x0;this['name']=_0x5b654a[_0x6391('0x0')]||'';this[_0x6391('0x1')]=_0x5b654a['username']||'';this[_0x6391('0x2')]=_0x5b654a[_0x6391('0x2')]||'';this[_0x6391('0x3')]=_0x5b654a['remoteUri']||'';this[_0x6391('0x4')]=_0x5b654a[_0x6391('0x4')]||'';this['Configurations']=_0x5b654a[_0x6391('0x5')]||{};}module[_0x6391('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 8b9cd52..486bd89 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 _0xab75=['state','unknown','stateTime','address','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab75,0x11f));var _0x5ab7=function(_0x199b1c,_0xabae0b){_0x199b1c=_0x199b1c-0x0;var _0x269e51=_0xab75[_0x199b1c];return _0x269e51;};'use strict';function Telephone(_0x250543){this['id']=_0x250543['id']||0x0;this[_0x5ab7('0x0')]=_0x250543[_0x5ab7('0x0')]||'';this['accountcode']=_0x250543['accountcode']||'';this[_0x5ab7('0x1')]=_0x5ab7('0x2');this[_0x5ab7('0x3')]=0x0;this['status']=_0x5ab7('0x2');this[_0x5ab7('0x4')]='';}module[_0x5ab7('0x5')]=Telephone; \ No newline at end of file +var _0xfc45=['accountcode','state','stateTime','status','unknown','address','exports'];(function(_0x11de87,_0x34f940){var _0x567fbd=function(_0x262932){while(--_0x262932){_0x11de87['push'](_0x11de87['shift']());}};_0x567fbd(++_0x34f940);}(_0xfc45,0x7e));var _0x5fc4=function(_0x7f90e5,_0x37af4f){_0x7f90e5=_0x7f90e5-0x0;var _0x4ed55f=_0xfc45[_0x7f90e5];return _0x4ed55f;};'use strict';function Telephone(_0x40bb88){this['id']=_0x40bb88['id']||0x0;this['name']=_0x40bb88['name']||'';this['accountcode']=_0x40bb88[_0x5fc4('0x0')]||'';this[_0x5fc4('0x1')]='unknown';this[_0x5fc4('0x2')]=0x0;this[_0x5fc4('0x3')]=_0x5fc4('0x4');this[_0x5fc4('0x5')]='';}module[_0x5fc4('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index cc5a123..f9b8377 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 _0xb10b=['name','html'];(function(_0x566e36,_0xd48bb3){var _0x722b59=function(_0x35925a){while(--_0x35925a){_0x566e36['push'](_0x566e36['shift']());}};_0x722b59(++_0xd48bb3);}(_0xb10b,0x12a));var _0xbb10=function(_0x34596a,_0x4f5372){_0x34596a=_0x34596a-0x0;var _0x1695ec=_0xb10b[_0x34596a];return _0x1695ec;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1753ee,_0x1dab7e){var _0x596d65=function(_0xbcb988){while(--_0xbcb988){_0x1753ee['push'](_0x1753ee['shift']());}};_0x596d65(++_0x1dab7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d005650..b477635 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3b72f0,_0x3200e6){var _0x537593=function(_0x44dd90){while(--_0x44dd90){_0x3b72f0['push'](_0x3b72f0['shift']());}};_0x537593(++_0x3200e6);}(_0x8603,0x190));var _0x3860=function(_0x135c6a,_0x2c1862){_0x135c6a=_0x135c6a-0x0;var _0xee75ab=_0x8603[_0x135c6a];return _0xee75ab;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xc87fc2,_0x6f3574){var _0x2892db=function(_0x3f7d32){while(--_0x3f7d32){_0xc87fc2['push'](_0xc87fc2['shift']());}};_0x2892db(++_0x6f3574);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x372b7c,_0x27c13b){_0x372b7c=_0x372b7c-0x0;var _0x184a96=_0x9ffd[_0x372b7c];return _0x184a96;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 2a98601..bc3c6e0 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 _0x80be=['unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x80be,0x18a));var _0xe80b=function(_0x12effc,_0x25e2cf){_0x12effc=_0x12effc-0x0;var _0x53cac2=_0x80be[_0x12effc];return _0x53cac2;};'use strict';function Trunk(_0x274dbb){this['id']=_0x274dbb['id']||0x0;this[_0xe80b('0x0')]=_0x274dbb[_0xe80b('0x0')]||![];this['name']=_0x274dbb[_0xe80b('0x1')]||'';this['state']=_0xe80b('0x2');this[_0xe80b('0x3')]=0x0;this[_0xe80b('0x4')]=_0xe80b('0x2');this['registry']=_0x274dbb[_0xe80b('0x5')]&&_0x274dbb[_0xe80b('0x5')][_0xe80b('0x6')](':')?_0x274dbb[_0xe80b('0x5')][_0xe80b('0x7')](':')[0x0]:'';this[_0xe80b('0x8')]='';this[_0xe80b('0x9')]='';this[_0xe80b('0xa')]='';this[_0xe80b('0xb')]='';this[_0xe80b('0xc')]='';this[_0xe80b('0xd')]='unknown';this[_0xe80b('0xe')]='';this[_0xe80b('0xf')]='';this[_0xe80b('0x10')]=_0x274dbb['defaultuser']||'';}module[_0xe80b('0x11')]=Trunk; \ No newline at end of file +var _0x6fda=['indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','registry'];(function(_0x3373e3,_0x56e530){var _0x5aa21b=function(_0x3d6938){while(--_0x3d6938){_0x3373e3['push'](_0x3373e3['shift']());}};_0x5aa21b(++_0x56e530);}(_0x6fda,0x13b));var _0xa6fd=function(_0x3f28c2,_0x403615){_0x3f28c2=_0x3f28c2-0x0;var _0x5506be=_0x6fda[_0x3f28c2];return _0x5506be;};'use strict';function Trunk(_0x52304d){this['id']=_0x52304d['id']||0x0;this[_0xa6fd('0x0')]=_0x52304d[_0xa6fd('0x0')]||![];this[_0xa6fd('0x1')]=_0x52304d[_0xa6fd('0x1')]||'';this[_0xa6fd('0x2')]=_0xa6fd('0x3');this['stateTime']=0x0;this['status']=_0xa6fd('0x3');this['registry']=_0x52304d[_0xa6fd('0x4')]&&_0x52304d[_0xa6fd('0x4')][_0xa6fd('0x5')](':')?_0x52304d[_0xa6fd('0x4')][_0xa6fd('0x6')](':')[0x0]:'';this[_0xa6fd('0x7')]='';this[_0xa6fd('0x8')]='';this[_0xa6fd('0x9')]='';this['domainport']='';this[_0xa6fd('0xa')]='';this[_0xa6fd('0xb')]=_0xa6fd('0x3');this[_0xa6fd('0xc')]='';this[_0xa6fd('0xd')]='';this[_0xa6fd('0xe')]=_0x52304d[_0xa6fd('0xe')]||'';}module[_0xa6fd('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 ee28301..3c12f37 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 _0x03be=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x26f081,_0x4277f3){var _0x4bf032=function(_0x1e49d8){while(--_0x1e49d8){_0x26f081['push'](_0x26f081['shift']());}};_0x4bf032(++_0x4277f3);}(_0x03be,0xc1));var _0xe03b=function(_0x490661,_0x1e9997){_0x490661=_0x490661-0x0;var _0x5d0f71=_0x03be[_0x490661];return _0x5d0f71;};'use strict';function voiceExtension(_0x1758a7){this['id']=_0x1758a7['id']||0x0;this[_0xe03b('0x0')]=_0x1758a7[_0xe03b('0x0')]||'';this[_0xe03b('0x1')]=_0x1758a7[_0xe03b('0x1')]||_0xe03b('0x2');this['mandatoryDisposition']=_0x1758a7[_0xe03b('0x3')]||![];}module[_0xe03b('0x4')]=voiceExtension; \ No newline at end of file +var _0xd24b=['exten','recordingFormat','none','exports'];(function(_0x51d9f5,_0x2e1d73){var _0x5bf36b=function(_0x3f3c60){while(--_0x3f3c60){_0x51d9f5['push'](_0x51d9f5['shift']());}};_0x5bf36b(++_0x2e1d73);}(_0xd24b,0x118));var _0xbd24=function(_0x3a9193,_0x5d388b){_0x3a9193=_0x3a9193-0x0;var _0x5198e6=_0xd24b[_0x3a9193];return _0x5198e6;};'use strict';function voiceExtension(_0x1f51a1){this['id']=_0x1f51a1['id']||0x0;this[_0xbd24('0x0')]=_0x1f51a1['exten']||'';this[_0xbd24('0x1')]=_0x1f51a1[_0xbd24('0x1')]||_0xbd24('0x2');this['mandatoryDisposition']=_0x1f51a1['mandatoryDisposition']||![];}module[_0xbd24('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 96b25c8..96d3305 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 _0x6cfa=['outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','fewestcalls','linear','random','rrordered','wrandom','name','monitor_format','type','waiting','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','busy','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','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','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x3a1256,_0x1fe2db){_0x3a1256=_0x3a1256-0x0;var _0x1bd352=_0x6cfa[_0x3a1256];return _0x1bd352;};'use strict';var monitorFormat={'wav':_0xa6cf('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0xa6cf('0x1'),'leastrecent':'leastrecent','linear':_0xa6cf('0x2'),'random':_0xa6cf('0x3'),'ringall':'ringall','rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0xa6cf('0x4'),'wrandom':_0xa6cf('0x5')};function VoiceQueue(_0x27ca7e){this['id']=_0x27ca7e['id']||0x0;this[_0xa6cf('0x6')]=_0x27ca7e[_0xa6cf('0x6')]||'';this[_0xa6cf('0x7')]=_0x27ca7e[_0xa6cf('0x7')]||'';this['type']=_0x27ca7e[_0xa6cf('0x8')]||'inbound';this[_0xa6cf('0x9')]=0x0;this['total']=0x0;this[_0xa6cf('0xa')]=0x0;this[_0xa6cf('0xb')]=0x0;this[_0xa6cf('0xc')]=0x0;this[_0xa6cf('0xd')]=0x0;this['unmanaged']=0x0;this[_0xa6cf('0xe')]=0x0;this[_0xa6cf('0xf')]=0x0;this[_0xa6cf('0x10')]=0x0;this[_0xa6cf('0x11')]=0x0;this[_0xa6cf('0x12')]=0x0;this['loggedIn']=0x0;this[_0xa6cf('0x13')]=0x0;this[_0xa6cf('0x14')]=0x0;this[_0xa6cf('0x15')]=0x0;this[_0xa6cf('0x16')]=0x0;this[_0xa6cf('0x17')]=0x0;this[_0xa6cf('0x18')]=0x0;this[_0xa6cf('0x19')]=0x0;this['unknown']=0x0;this['acw']=_0x27ca7e[_0xa6cf('0x1a')]||![];this[_0xa6cf('0x1b')]=_0x27ca7e['acwTimeout']||0xa;this[_0xa6cf('0x1c')]=_0x27ca7e[_0xa6cf('0x1c')]||'no';this[_0xa6cf('0x1d')]=!![];this[_0xa6cf('0x1e')]='';this[_0xa6cf('0x1f')]='';this['originated']=0x0;this[_0xa6cf('0x20')]=0x0;this['dialTimezone']=_0x27ca7e[_0xa6cf('0x21')]||null;this[_0xa6cf('0x22')]=_0x27ca7e[_0xa6cf('0x22')]?_0x27ca7e[_0xa6cf('0x22')]:null;this[_0xa6cf('0x23')]=_0x27ca7e[_0xa6cf('0x23')];this[_0xa6cf('0x24')]=_0x27ca7e[_0xa6cf('0x24')]||_0xa6cf('0x25');this[_0xa6cf('0x26')]=_0x27ca7e[_0xa6cf('0x26')]||0x0;this[_0xa6cf('0x27')]=_0x27ca7e[_0xa6cf('0x27')]||0x0;this['dialPowerLevel']=_0x27ca7e[_0xa6cf('0x28')]||0x1;this['dialPredictiveOptimization']=_0x27ca7e[_0xa6cf('0x29')]||_0xa6cf('0x2a');this[_0xa6cf('0x2b')]=_0x27ca7e['dialPredictiveOptimizationPercentage']||0.03;this[_0xa6cf('0x2c')]=_0x27ca7e[_0xa6cf('0x2c')]||0x258;this[_0xa6cf('0x2d')]=_0x27ca7e[_0xa6cf('0x2d')]||'anonymous';this[_0xa6cf('0x2e')]=_0x27ca7e['dialOriginateCallerIdNumber']||_0xa6cf('0x2f');this[_0xa6cf('0x30')]=_0x27ca7e[_0xa6cf('0x30')]||0x1e;this[_0xa6cf('0x31')]=_0x27ca7e[_0xa6cf('0x31')]||_0xa6cf('0x32');this['dialQueueTimeout']=_0x27ca7e[_0xa6cf('0x33')]||0x3;this[_0xa6cf('0x34')]=_0x27ca7e[_0xa6cf('0x34')]||undefined;this[_0xa6cf('0x35')]=_0x27ca7e[_0xa6cf('0x35')]||0x3;this['dialCongestionRetryFrequency']=_0x27ca7e[_0xa6cf('0x36')]||0x96;this[_0xa6cf('0x37')]=_0x27ca7e[_0xa6cf('0x37')]||0x3;this[_0xa6cf('0x38')]=_0x27ca7e[_0xa6cf('0x38')]||0x96;this[_0xa6cf('0x39')]=_0x27ca7e['dialNoAnswerMaxRetry']||0x3;this[_0xa6cf('0x3a')]=_0x27ca7e[_0xa6cf('0x3a')]||0x96;this[_0xa6cf('0x3b')]=_0x27ca7e[_0xa6cf('0x3b')]||0x3;this[_0xa6cf('0x3c')]=_0x27ca7e[_0xa6cf('0x3c')]||0x96;this['dialDropMaxRetry']=_0x27ca7e[_0xa6cf('0x3d')]||0x3;this[_0xa6cf('0x3e')]=_0x27ca7e[_0xa6cf('0x3e')]||0x96;this[_0xa6cf('0x3f')]=_0x27ca7e['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x27ca7e['dialAbandonedRetryFrequency']||0x96;this[_0xa6cf('0x40')]=_0x27ca7e['dialMachineMaxRetry']||0x3;this[_0xa6cf('0x41')]=_0x27ca7e[_0xa6cf('0x41')]||0x96;this[_0xa6cf('0x42')]=_0x27ca7e[_0xa6cf('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x27ca7e[_0xa6cf('0x43')]||0x96;this[_0xa6cf('0x44')]=_0x27ca7e[_0xa6cf('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x27ca7e[_0xa6cf('0x45')]||0x4;this[_0xa6cf('0x46')]=_0x27ca7e[_0xa6cf('0x46')]?_0x27ca7e['Trunk']:undefined;this['TrunkBackup']=_0x27ca7e[_0xa6cf('0x47')]?_0x27ca7e[_0xa6cf('0x47')]:undefined;this[_0xa6cf('0x48')]=_0x27ca7e[_0xa6cf('0x48')]||undefined;this[_0xa6cf('0x49')]=_0x27ca7e[_0xa6cf('0x49')]?_0x27ca7e[_0xa6cf('0x49')]:undefined;this[_0xa6cf('0x4a')]=_0x27ca7e[_0xa6cf('0x4a')]||'DESC';this[_0xa6cf('0x4b')]=_0x27ca7e[_0xa6cf('0x4b')]||undefined;this[_0xa6cf('0x4c')]=_0x27ca7e[_0xa6cf('0x4c')]||undefined;this['strategy']=strategy[_0x27ca7e[_0xa6cf('0x4d')]];this[_0xa6cf('0x4e')]=!![];this[_0xa6cf('0x4f')]=_0x27ca7e[_0xa6cf('0x4f')]||![];this[_0xa6cf('0x50')]=_0x27ca7e[_0xa6cf('0x50')];this[_0xa6cf('0x51')]=_0x27ca7e['dialAMDGreeting'];this[_0xa6cf('0x52')]=_0x27ca7e[_0xa6cf('0x52')];this[_0xa6cf('0x53')]=_0x27ca7e['dialAMDTotalAnalysisTime'];this[_0xa6cf('0x54')]=_0x27ca7e[_0xa6cf('0x54')];this['dialAMDBetweenWordsSilence']=_0x27ca7e[_0xa6cf('0x55')];this[_0xa6cf('0x56')]=_0x27ca7e[_0xa6cf('0x56')];this['dialAMDSilenceThreshold']=_0x27ca7e['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x27ca7e[_0xa6cf('0x57')];this[_0xa6cf('0x58')]=0x0;this[_0xa6cf('0x59')]=0x0;this[_0xa6cf('0x5a')]=_0x27ca7e[_0xa6cf('0x5a')];this[_0xa6cf('0x5b')]=0x0;this[_0xa6cf('0x5c')]=0x0;this[_0xa6cf('0x5d')]=0x0;this[_0xa6cf('0x5e')]=0x0;this[_0xa6cf('0x5f')]=0x0;this[_0xa6cf('0x60')]=0x0;this[_0xa6cf('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa6cf('0x62')]=0x0;this[_0xa6cf('0x63')]=0x0;this[_0xa6cf('0x64')]=0x0;this[_0xa6cf('0x65')]=0x0;this[_0xa6cf('0x66')]=0x0;this[_0xa6cf('0x67')]=0x0;this[_0xa6cf('0x68')]=undefined;this['startPredictive']=undefined;this[_0xa6cf('0x69')]=undefined;this[_0xa6cf('0x6a')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xa6cf('0x6b')]=0x0;this[_0xa6cf('0x6c')]=0x0;this[_0xa6cf('0x6d')]=0x0;this[_0xa6cf('0x6e')]=0x0;this[_0xa6cf('0x6f')]=0x0;this[_0xa6cf('0x70')]=0x0;this[_0xa6cf('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x27ca7e[_0xa6cf('0x72')]||0x14;this[_0xa6cf('0x73')]=_0x27ca7e[_0xa6cf('0x72')]||0xa;this[_0xa6cf('0x74')]=0x0;this[_0xa6cf('0x75')]=0x0;this[_0xa6cf('0x76')]=0x1;this[_0xa6cf('0x77')]=0x0;this[_0xa6cf('0x78')]=0x0;this[_0xa6cf('0x79')]=0x0;this[_0xa6cf('0x7a')]=0x0;this[_0xa6cf('0x7b')]=_0x27ca7e[_0xa6cf('0x7b')]||0x1e;this['dialRecallInQueue']=_0x27ca7e['dialRecallInQueue']||![];this[_0xa6cf('0x7c')]=!!_0x27ca7e['dialPreviewAutoRecallMe']||![];this[_0xa6cf('0x7d')]=!!_0x27ca7e[_0xa6cf('0x7d')]||![];this[_0xa6cf('0x7e')]=_0x27ca7e[_0xa6cf('0x7e')]||undefined;this[_0xa6cf('0x7f')]=_0x27ca7e[_0xa6cf('0x7f')]||![];this[_0xa6cf('0x80')]=_0x27ca7e['dialAgiAfterHangupAgent']||![];this[_0xa6cf('0x7')]=monitorFormat[_0x27ca7e[_0xa6cf('0x7')]]?monitorFormat[_0x27ca7e[_0xa6cf('0x7')]]:undefined;this[_0xa6cf('0x81')]=_0x27ca7e['mandatoryDisposition']||![];this[_0xa6cf('0x82')]=_0x27ca7e[_0xa6cf('0x82')]?_0x27ca7e[_0xa6cf('0x82')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa6cf('0x83')]=VoiceQueue; \ No newline at end of file +var _0x27af=['outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x27af,0x199));var _0xf27a=function(_0x412833,_0x2b4012){_0x412833=_0x412833-0x0;var _0xb37474=_0x27af[_0x412833];return _0xb37474;};'use strict';var monitorFormat={'wav':_0xf27a('0x0'),'wav49':_0xf27a('0x1'),'gsm':_0xf27a('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xf27a('0x3'),'linear':_0xf27a('0x4'),'random':'random','ringall':'ringall','rr':_0xf27a('0x5'),'rrmemory':_0xf27a('0x6'),'rrordered':_0xf27a('0x7'),'wrandom':_0xf27a('0x8')};function VoiceQueue(_0x2a8645){this['id']=_0x2a8645['id']||0x0;this[_0xf27a('0x9')]=_0x2a8645[_0xf27a('0x9')]||'';this[_0xf27a('0xa')]=_0x2a8645['monitor_format']||'';this['type']=_0x2a8645[_0xf27a('0xb')]||_0xf27a('0xc');this[_0xf27a('0xd')]=0x0;this[_0xf27a('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xf27a('0xf')]=0x0;this[_0xf27a('0x10')]=0x0;this[_0xf27a('0x11')]=0x0;this[_0xf27a('0x12')]=0x0;this[_0xf27a('0x13')]=0x0;this[_0xf27a('0x14')]=0x0;this[_0xf27a('0x15')]=0x0;this[_0xf27a('0x16')]=0x0;this[_0xf27a('0x17')]=0x0;this[_0xf27a('0x18')]=0x0;this[_0xf27a('0x19')]=0x0;this[_0xf27a('0x1a')]=0x0;this['ringing']=0x0;this[_0xf27a('0x1b')]=0x0;this['talking']=0x0;this[_0xf27a('0x1c')]=0x0;this[_0xf27a('0x1d')]=0x0;this['acw']=_0x2a8645[_0xf27a('0x1e')]||![];this[_0xf27a('0x1f')]=_0x2a8645['acwTimeout']||0xa;this['autopause']=_0x2a8645[_0xf27a('0x20')]||'no';this['sendMessageOneNotActive']=!![];this[_0xf27a('0x21')]='';this['statusMessage']='';this['originated']=0x0;this[_0xf27a('0x22')]=0x0;this['dialTimezone']=_0x2a8645[_0xf27a('0x23')]||null;this[_0xf27a('0x24')]=_0x2a8645['dialGlobalInterval']?_0x2a8645[_0xf27a('0x24')]:null;this[_0xf27a('0x25')]=_0x2a8645[_0xf27a('0x25')];this['dialMethod']=_0x2a8645['dialMethod']||_0xf27a('0x26');this[_0xf27a('0x27')]=_0x2a8645['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x2a8645[_0xf27a('0x28')]||0x0;this[_0xf27a('0x29')]=_0x2a8645[_0xf27a('0x29')]||0x1;this['dialPredictiveOptimization']=_0x2a8645['dialPredictiveOptimization']||_0xf27a('0x2a');this['dialPredictiveOptimizationPercentage']=_0x2a8645[_0xf27a('0x2b')]||0.03;this[_0xf27a('0x2c')]=_0x2a8645['dialPredictiveInterval']||0x258;this[_0xf27a('0x2d')]=_0x2a8645[_0xf27a('0x2d')]||_0xf27a('0x2e');this[_0xf27a('0x2f')]=_0x2a8645[_0xf27a('0x2f')]||_0xf27a('0x2e');this[_0xf27a('0x30')]=_0x2a8645['dialOriginateTimeout']||0x1e;this[_0xf27a('0x31')]=_0x2a8645[_0xf27a('0x31')]||_0xf27a('0x32');this[_0xf27a('0x33')]=_0x2a8645[_0xf27a('0x33')]||0x3;this['dialQueueProject']=_0x2a8645[_0xf27a('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x2a8645['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x2a8645['dialCongestionRetryFrequency']||0x96;this[_0xf27a('0x35')]=_0x2a8645[_0xf27a('0x35')]||0x3;this[_0xf27a('0x36')]=_0x2a8645[_0xf27a('0x36')]||0x96;this[_0xf27a('0x37')]=_0x2a8645['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x2a8645[_0xf27a('0x38')]||0x96;this[_0xf27a('0x39')]=_0x2a8645['dialNoSuchNumberMaxRetry']||0x3;this[_0xf27a('0x3a')]=_0x2a8645[_0xf27a('0x3a')]||0x96;this[_0xf27a('0x3b')]=_0x2a8645[_0xf27a('0x3b')]||0x3;this[_0xf27a('0x3c')]=_0x2a8645[_0xf27a('0x3c')]||0x96;this['dialAbandonedMaxRetry']=_0x2a8645['dialAbandonedMaxRetry']||0x3;this[_0xf27a('0x3d')]=_0x2a8645[_0xf27a('0x3d')]||0x96;this[_0xf27a('0x3e')]=_0x2a8645[_0xf27a('0x3e')]||0x3;this[_0xf27a('0x3f')]=_0x2a8645['dialMachineRetryFrequency']||0x96;this[_0xf27a('0x40')]=_0x2a8645[_0xf27a('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2a8645['dialAgentRejectRetryFrequency']||0x96;this[_0xf27a('0x41')]=_0x2a8645[_0xf27a('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x2a8645[_0xf27a('0x42')]||0x4;this[_0xf27a('0x43')]=_0x2a8645['Trunk']?_0x2a8645['Trunk']:undefined;this[_0xf27a('0x44')]=_0x2a8645[_0xf27a('0x44')]?_0x2a8645[_0xf27a('0x44')]:undefined;this[_0xf27a('0x45')]=_0x2a8645['dialPrefix']||undefined;this['Interval']=_0x2a8645[_0xf27a('0x46')]?_0x2a8645['Interval']:undefined;this[_0xf27a('0x47')]=_0x2a8645['dialOrderByScheduledAt']||_0xf27a('0x48');this[_0xf27a('0x49')]=_0x2a8645[_0xf27a('0x49')]||undefined;this[_0xf27a('0x4a')]=_0x2a8645[_0xf27a('0x4a')]||undefined;this[_0xf27a('0x4b')]=strategy[_0x2a8645[_0xf27a('0x4b')]];this[_0xf27a('0x4c')]=!![];this[_0xf27a('0x4d')]=_0x2a8645['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2a8645['dialAMDInitialSilence'];this[_0xf27a('0x4e')]=_0x2a8645[_0xf27a('0x4e')];this[_0xf27a('0x4f')]=_0x2a8645[_0xf27a('0x4f')];this[_0xf27a('0x50')]=_0x2a8645[_0xf27a('0x50')];this[_0xf27a('0x51')]=_0x2a8645[_0xf27a('0x51')];this[_0xf27a('0x52')]=_0x2a8645[_0xf27a('0x52')];this[_0xf27a('0x53')]=_0x2a8645[_0xf27a('0x53')];this[_0xf27a('0x54')]=_0x2a8645['dialAMDSilenceThreshold'];this[_0xf27a('0x55')]=_0x2a8645['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xf27a('0x56')]=0x0;this[_0xf27a('0x57')]=_0x2a8645['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xf27a('0x58')]=0x0;this[_0xf27a('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xf27a('0x5a')]=0x0;this[_0xf27a('0x5b')]=0x0;this[_0xf27a('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf27a('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xf27a('0x5e')]=0x0;this[_0xf27a('0x5f')]=0x0;this[_0xf27a('0x60')]=0x0;this[_0xf27a('0x61')]=0x0;this['startProgressive']=undefined;this[_0xf27a('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xf27a('0x63')]=1.05;this[_0xf27a('0x64')]=0x0;this[_0xf27a('0x65')]=0x0;this[_0xf27a('0x66')]=0x0;this[_0xf27a('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf27a('0x68')]=0x0;this[_0xf27a('0x69')]=0x0;this[_0xf27a('0x6a')]=0x0;this[_0xf27a('0x6b')]=_0x2a8645['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf27a('0x6c')]=_0x2a8645[_0xf27a('0x6d')]||0xa;this[_0xf27a('0x6e')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf27a('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0xf27a('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xf27a('0x71')]=0x0;this[_0xf27a('0x72')]=_0x2a8645[_0xf27a('0x72')]||0x1e;this[_0xf27a('0x73')]=_0x2a8645['dialRecallInQueue']||![];this[_0xf27a('0x74')]=!!_0x2a8645[_0xf27a('0x74')]||![];this['dialPreviewRecallmeReminder']=!!_0x2a8645[_0xf27a('0x75')]||![];this[_0xf27a('0x76')]=_0x2a8645['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2a8645[_0xf27a('0x77')]||![];this[_0xf27a('0x78')]=_0x2a8645[_0xf27a('0x78')]||![];this[_0xf27a('0xa')]=monitorFormat[_0x2a8645[_0xf27a('0xa')]]?monitorFormat[_0x2a8645[_0xf27a('0xa')]]:undefined;this[_0xf27a('0x79')]=_0x2a8645[_0xf27a('0x79')]||![];this[_0xf27a('0x7a')]=_0x2a8645[_0xf27a('0x7a')]?_0x2a8645['mandatoryDispositionPause']:undefined;this[_0xf27a('0x7b')]=![];}module[_0xf27a('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index cc0a978..b0190fd 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9576=['type','unavailable','unknown','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','statusMessage','Trunk','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','message','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime'];(function(_0x43a068,_0x41ec16){var _0x4d980d=function(_0x3524ec){while(--_0x3524ec){_0x43a068['push'](_0x43a068['shift']());}};_0x4d980d(++_0x41ec16);}(_0x9576,0x182));var _0x6957=function(_0x51395b,_0x1d54e4){_0x51395b=_0x51395b-0x0;var _0x7ec520=_0x9576[_0x51395b];return _0x7ec520;};'use strict';var INBOUND_COUNTERS=[_0x6957('0x0'),_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x3'),'ringing','talking',_0x6957('0x4')];var OUTBOUND_COUNTERS=[_0x6957('0x0'),_0x6957('0x5'),_0x6957('0x6'),_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x7'),'outboundAbandonedCallsDay',_0x6957('0x8'),_0x6957('0x9'),_0x6957('0xa'),_0x6957('0xb'),_0x6957('0xc'),_0x6957('0xd'),'outboundReCallsDay',_0x6957('0xe'),_0x6957('0xf'),'paused','pTalking',_0x6957('0x10'),_0x6957('0x11'),_0x6957('0x12'),_0x6957('0x13'),_0x6957('0x4')];function VoiceQueueSummary(_0xe5f20b){this['id']=_0xe5f20b['id'];this[_0x6957('0x14')]=_0xe5f20b['name'];this['strategy']=_0xe5f20b['strategy'];this[_0x6957('0x15')]=_0xe5f20b[_0x6957('0x15')]||0x0;this[_0x6957('0x5')]=_0xe5f20b[_0x6957('0x5')]||0x0;this[_0x6957('0x0')]=_0xe5f20b[_0x6957('0x0')]||0x0;this[_0x6957('0x16')]=_0xe5f20b['busy']||0x0;this['inUse']=_0xe5f20b['inUse']||0x0;this[_0x6957('0x17')]=_0xe5f20b[_0x6957('0x17')]||0x0;this[_0x6957('0x1')]=_0xe5f20b[_0x6957('0x1')]||0x0;this['loggedInDb']=_0xe5f20b[_0x6957('0x2')]||0x0;this['onHold']=_0xe5f20b[_0x6957('0x18')]||0x0;this[_0x6957('0x19')]=_0xe5f20b['notInUse']||0x0;this[_0x6957('0x3')]=_0xe5f20b[_0x6957('0x3')]||0x0;this[_0x6957('0x1a')]=_0xe5f20b['ringing']||0x0;this[_0x6957('0x1b')]=_0xe5f20b[_0x6957('0x1b')];this[_0x6957('0x11')]=_0xe5f20b[_0x6957('0x11')];this[_0x6957('0x12')]=_0xe5f20b[_0x6957('0x12')];this[_0x6957('0x1c')]=_0xe5f20b[_0x6957('0x1c')]||0x0;this['talking']=_0xe5f20b['talking']||0x0;this[_0x6957('0x13')]=_0xe5f20b[_0x6957('0x13')]||0x0;this[_0x6957('0x1d')]=_0xe5f20b[_0x6957('0x1d')];this[_0x6957('0x1e')]=_0xe5f20b[_0x6957('0x1e')]||0x0;this[_0x6957('0x1f')]=_0xe5f20b[_0x6957('0x1f')]||0x0;this['unmanaged']=_0xe5f20b[_0x6957('0x20')]||0x0;this[_0x6957('0x4')]=_0xe5f20b[_0x6957('0x4')]||0x0;if(_0xe5f20b[_0x6957('0x1d')]==='outbound'){this['pTalking']=_0xe5f20b[_0x6957('0x21')]||0x0;this[_0x6957('0x22')]=_0xe5f20b['dialActive'];this['dialMethod']=_0xe5f20b[_0x6957('0x23')];this[_0x6957('0x24')]=_0xe5f20b[_0x6957('0x24')];this['dialOriginateCallerIdNumber']=_0xe5f20b[_0x6957('0x25')];this[_0x6957('0x26')]=_0xe5f20b[_0x6957('0x26')];this[_0x6957('0x27')]=_0xe5f20b[_0x6957('0x27')];this[_0x6957('0x28')]=_0xe5f20b[_0x6957('0x28')];this[_0x6957('0x29')]=_0xe5f20b['outboundAnswerAgiCallsDay'];this[_0x6957('0x8')]=_0xe5f20b[_0x6957('0x8')];this[_0x6957('0x9')]=_0xe5f20b[_0x6957('0x9')];this[_0x6957('0xa')]=_0xe5f20b[_0x6957('0xa')];this[_0x6957('0xb')]=_0xe5f20b[_0x6957('0xb')];this[_0x6957('0x2a')]=_0xe5f20b[_0x6957('0x2a')];this[_0x6957('0x2b')]=_0xe5f20b['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0xe5f20b[_0x6957('0x2c')];this[_0x6957('0xc')]=_0xe5f20b[_0x6957('0xc')];this[_0x6957('0xd')]=_0xe5f20b['outboundNoSuchCallsDay'];this[_0x6957('0x2d')]=_0xe5f20b[_0x6957('0x2d')];this[_0x6957('0x2e')]=_0xe5f20b['outboundReCallsDay'];this['outboundRejectCallsDay']=_0xe5f20b[_0x6957('0xe')];this[_0x6957('0xf')]=_0xe5f20b[_0x6957('0xf')];this['predictiveIntervalAnsweredCalls']=_0xe5f20b[_0x6957('0x2f')];this[_0x6957('0x30')]=_0xe5f20b[_0x6957('0x30')];this[_0x6957('0x31')]=_0xe5f20b[_0x6957('0x31')];this[_0x6957('0x32')]=_0xe5f20b[_0x6957('0x32')];this[_0x6957('0x33')]=_0xe5f20b[_0x6957('0x33')];this['predictiveIntervalErlangCalls']=_0xe5f20b[_0x6957('0x34')];this[_0x6957('0x35')]=_0xe5f20b[_0x6957('0x35')];this['predictiveIntervalHitRate']=_0xe5f20b['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0xe5f20b[_0x6957('0x36')];this['predictiveIntervalPauses']=_0xe5f20b['predictiveIntervalPauses'];this[_0x6957('0x37')]=_0xe5f20b[_0x6957('0x37')];this['predictiveIntervalTotalCalls']=_0xe5f20b['predictiveIntervalTotalCalls'];this[_0x6957('0x7')]=_0xe5f20b[_0x6957('0x7')];this[_0x6957('0x38')]=_0xe5f20b[_0x6957('0x38')];this[_0x6957('0x39')]=_0xe5f20b['erlangCallToSecond'];this[_0x6957('0x3a')]=_0xe5f20b['erlangAbandonmentRate'];this['erlangBusyFactor']=_0xe5f20b['erlangBusyFactor'];this['startPredictive']=_0xe5f20b['startPredictive'];this['startProgressive']=_0xe5f20b['startProgressive'];this['message']=_0xe5f20b['message'];this[_0x6957('0x3b')]=_0xe5f20b[_0x6957('0x3b')];}if(_0xe5f20b[_0x6957('0x3c')]){this[_0x6957('0x3c')]={'id':_0xe5f20b[_0x6957('0x3c')]['id'],'name':_0xe5f20b[_0x6957('0x3c')][_0x6957('0x14')],'active':_0xe5f20b[_0x6957('0x3c')]['active'],'callerid':_0xe5f20b[_0x6957('0x3c')]['callerid']};}}VoiceQueueSummary[_0x6957('0x3d')][_0x6957('0x3e')]=function(_0x22ec26,_0x2298e0,_0x41a1ba,_0x2d1d22){this[_0x6957('0x2')]=0x0;this[_0x6957('0x10')]=0x0;this[_0x6957('0x3')]=0x0;this[_0x6957('0x1f')]=0x0;this[_0x6957('0x19')]=0x0;this[_0x6957('0x6')]=0x0;this[_0x6957('0x16')]=0x0;this[_0x6957('0x17')]=0x0;this[_0x6957('0x1e')]=0x0;this[_0x6957('0x1a')]=0x0;this['ringInUse']=0x0;this[_0x6957('0x18')]=0x0;if(_0x41a1ba){if(_0x41a1ba['available']){this['available']=Number(_0x41a1ba[_0x6957('0x0')]);}if(_0x41a1ba['loggedin']){this['loggedIn']=Number(_0x41a1ba[_0x6957('0x3f')]);}if(_0x41a1ba[_0x6957('0x40')]){this[_0x6957('0x4')]=Number(_0x41a1ba[_0x6957('0x40')]);}}for(var _0x31ca13=0x0;_0x31ca13<_0x22ec26[_0x6957('0x41')];_0x31ca13++){var _0x1588d6=_0x2298e0[_0x6957('0x42')+_0x22ec26[_0x31ca13][_0x6957('0x14')]];if(_0x1588d6&&_0x1588d6[_0x6957('0x43')]){this['loggedInDb']+=0x1;}if(_0x22ec26[_0x31ca13]['incall']==='1'){this[_0x6957('0x10')]+=0x1;}if(_0x22ec26[_0x31ca13]['paused']==='1'&&!['2','7','8'][_0x6957('0x44')](_0x22ec26[_0x31ca13][_0x6957('0x45')])){this['paused']+=0x1;}switch(_0x22ec26[_0x31ca13][_0x6957('0x45')]){case'0':this[_0x6957('0x1f')]+=0x1;break;case'1':this[_0x6957('0x19')]+=0x1;break;case'2':this[_0x6957('0x6')]+=0x1;break;case'3':this[_0x6957('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x6957('0x1e')]+=0x1;break;case'6':this[_0x6957('0x1a')]+=0x1;break;case'7':this[_0x6957('0x1b')]+=0x1;break;case'8':this[_0x6957('0x18')]+=0x1;break;}}if(this['dialMethod']===_0x6957('0x46')){var _0x7d8248=Object['keys'](_0x2d1d22);for(var _0x1768ba=0x0;_0x1768ba<_0x7d8248[_0x6957('0x41')];_0x1768ba++){var _0x3b1aac=_0x7d8248[_0x1768ba];var _0x118616=_0x2d1d22[_0x3b1aac];if(_0x118616['queue']===this['name']&&_0x118616[_0x6957('0x1d')]===_0x6957('0x47')&&_0x118616[_0x6957('0x48')]===_0x6957('0x49')){this['talking']+=0x1;}}if(this[_0x6957('0x10')]>this[_0x6957('0x6')]){this[_0x6957('0x10')]=this['inUse'];}this[_0x6957('0x21')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x6957('0x4a')]=function(_0x4858b4){var _0x52128f=![];if(_0x4858b4){_0x52128f=INBOUND_COUNTERS[_0x6957('0x4b')](function(_0x371e29){return this[_0x371e29]!==_0x4858b4[_0x371e29];},this);}return _0x52128f;};VoiceQueueSummary[_0x6957('0x3d')][_0x6957('0x4c')]=function(_0x1d5854){var _0x2d9273=![];var _0x2dba35=![];var _0x1006a5=![];if(_0x1d5854){_0x2d9273=this[_0x6957('0x23')]!==_0x1d5854[_0x6957('0x23')]||this['dialActive']!==_0x1d5854[_0x6957('0x22')]||this[_0x6957('0x4d')]!==_0x1d5854[_0x6957('0x4d')]||this['statusMessage']!==_0x1d5854[_0x6957('0x3b')];_0x2dba35=OUTBOUND_COUNTERS['some'](function(_0xa73e4){return this[_0xa73e4]!==_0x1d5854[_0xa73e4];},this);if(this[_0x6957('0x3c')]&&_0x1d5854['Trunk']){_0x1006a5=this[_0x6957('0x3c')][_0x6957('0x14')]!==_0x1d5854[_0x6957('0x3c')][_0x6957('0x14')]||this[_0x6957('0x3c')][_0x6957('0x4e')]!==_0x1d5854[_0x6957('0x3c')][_0x6957('0x4e')];}}return _0x2d9273||_0x2dba35||_0x1006a5;};VoiceQueueSummary['prototype'][_0x6957('0x4f')]=function(_0x59f156){this[_0x6957('0x5')]=_0x59f156[_0x6957('0x5')];this[_0x6957('0x4d')]=_0x59f156['message'];this[_0x6957('0x3b')]=_0x59f156[_0x6957('0x3b')];this[_0x6957('0x7')]=_0x59f156['originated'];this[_0x6957('0x50')]=_0x59f156[_0x6957('0x50')];this[_0x6957('0x8')]=_0x59f156[_0x6957('0x8')];this['outboundBlacklistCallsDay']=_0x59f156[_0x6957('0x9')];this['outboundBusyCallsDay']=_0x59f156[_0x6957('0xa')];this[_0x6957('0xb')]=_0x59f156[_0x6957('0xb')];this['outboundNoAnswerCallsDay']=_0x59f156[_0x6957('0xc')];this['outboundNoSuchCallsDay']=_0x59f156[_0x6957('0xd')];this[_0x6957('0x2e')]=_0x59f156['outboundReCallsDay'];this[_0x6957('0xe')]=_0x59f156[_0x6957('0xe')];this[_0x6957('0xf')]=_0x59f156[_0x6957('0xf')];this['sumBillable']=_0x59f156[_0x6957('0x11')];this['sumDuration']=_0x59f156['sumDuration'];this[_0x6957('0x13')]=_0x59f156['total'];if(this[_0x6957('0x23')]===_0x6957('0x51')){this[_0x6957('0x21')]=_0x59f156[_0x6957('0x21')];}};module[_0x6957('0x52')]=VoiceQueueSummary; \ No newline at end of file +var _0xfb8f=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','onHold','loggedin','callers','online','incall','status','booked','length','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','exports','loggedIn','ringing','talking','waiting','available','answered','loggedInDb','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','paused','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','inUse','invalid','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive'];(function(_0x40a7c9,_0x3d6333){var _0xa376f8=function(_0x3e3036){while(--_0x3e3036){_0x40a7c9['push'](_0x40a7c9['shift']());}};_0xa376f8(++_0x3d6333);}(_0xfb8f,0x18c));var _0xffb8=function(_0x286d33,_0x1cbd64){_0x286d33=_0x286d33-0x0;var _0x45a787=_0xfb8f[_0x286d33];return _0x45a787;};'use strict';var INBOUND_COUNTERS=['available',_0xffb8('0x0'),'loggedInDb','paused',_0xffb8('0x1'),_0xffb8('0x2'),_0xffb8('0x3')];var OUTBOUND_COUNTERS=[_0xffb8('0x4'),_0xffb8('0x5'),'inUse',_0xffb8('0x0'),_0xffb8('0x6'),_0xffb8('0x7'),_0xffb8('0x8'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0xffb8('0x9'),_0xffb8('0xa'),_0xffb8('0xb'),_0xffb8('0xc'),_0xffb8('0xd'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xffb8('0xe'),_0xffb8('0xf'),_0xffb8('0x2'),_0xffb8('0x10'),_0xffb8('0x11'),'total',_0xffb8('0x3')];function VoiceQueueSummary(_0xb605b3){this['id']=_0xb605b3['id'];this[_0xffb8('0x12')]=_0xb605b3[_0xffb8('0x12')];this[_0xffb8('0x13')]=_0xb605b3['strategy'];this[_0xffb8('0x14')]=_0xb605b3[_0xffb8('0x14')]||0x0;this[_0xffb8('0x5')]=_0xb605b3['answered']||0x0;this[_0xffb8('0x4')]=_0xb605b3['available']||0x0;this['busy']=_0xb605b3[_0xffb8('0x15')]||0x0;this[_0xffb8('0x16')]=_0xb605b3[_0xffb8('0x16')]||0x0;this[_0xffb8('0x17')]=_0xb605b3[_0xffb8('0x17')]||0x0;this[_0xffb8('0x0')]=_0xb605b3[_0xffb8('0x0')]||0x0;this[_0xffb8('0x6')]=_0xb605b3[_0xffb8('0x6')]||0x0;this['onHold']=_0xb605b3['onHold']||0x0;this[_0xffb8('0x18')]=_0xb605b3['notInUse']||0x0;this['paused']=_0xb605b3['paused']||0x0;this['ringing']=_0xb605b3[_0xffb8('0x1')]||0x0;this[_0xffb8('0x19')]=_0xb605b3[_0xffb8('0x19')];this[_0xffb8('0x10')]=_0xb605b3['sumBillable'];this[_0xffb8('0x11')]=_0xb605b3[_0xffb8('0x11')];this[_0xffb8('0x1a')]=_0xb605b3['sumHoldTime']||0x0;this[_0xffb8('0x2')]=_0xb605b3['talking']||0x0;this[_0xffb8('0x1b')]=_0xb605b3[_0xffb8('0x1b')]||0x0;this['type']=_0xb605b3[_0xffb8('0x1c')];this[_0xffb8('0x1d')]=_0xb605b3[_0xffb8('0x1d')]||0x0;this[_0xffb8('0x1e')]=_0xb605b3[_0xffb8('0x1e')]||0x0;this[_0xffb8('0x1f')]=_0xb605b3[_0xffb8('0x1f')]||0x0;this['waiting']=_0xb605b3[_0xffb8('0x3')]||0x0;if(_0xb605b3['type']===_0xffb8('0x20')){this[_0xffb8('0xf')]=_0xb605b3['pTalking']||0x0;this['dialActive']=_0xb605b3[_0xffb8('0x21')];this[_0xffb8('0x22')]=_0xb605b3['dialMethod'];this[_0xffb8('0x23')]=_0xb605b3[_0xffb8('0x23')];this['dialOriginateCallerIdNumber']=_0xb605b3[_0xffb8('0x24')];this['dialOriginateTimeout']=_0xb605b3['dialOriginateTimeout'];this[_0xffb8('0x25')]=_0xb605b3[_0xffb8('0x25')];this[_0xffb8('0x26')]=_0xb605b3['temp'];this['outboundAnswerAgiCallsDay']=_0xb605b3[_0xffb8('0x27')];this[_0xffb8('0x28')]=_0xb605b3[_0xffb8('0x28')];this[_0xffb8('0x29')]=_0xb605b3[_0xffb8('0x29')];this[_0xffb8('0x9')]=_0xb605b3['outboundBusyCallsDay'];this[_0xffb8('0xa')]=_0xb605b3['outboundCongestionCallsDay'];this[_0xffb8('0x2a')]=_0xb605b3[_0xffb8('0x2a')];this['outboundDropCallsDayCallersExit']=_0xb605b3[_0xffb8('0x2b')];this[_0xffb8('0x2c')]=_0xb605b3[_0xffb8('0x2c')];this[_0xffb8('0xb')]=_0xb605b3[_0xffb8('0xb')];this[_0xffb8('0xc')]=_0xb605b3['outboundNoSuchCallsDay'];this[_0xffb8('0x2d')]=_0xb605b3[_0xffb8('0x2d')];this[_0xffb8('0xd')]=_0xb605b3[_0xffb8('0xd')];this[_0xffb8('0x2e')]=_0xb605b3[_0xffb8('0x2e')];this[_0xffb8('0x2f')]=_0xb605b3[_0xffb8('0x2f')];this['predictiveIntervalAnsweredCalls']=_0xb605b3['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0xb605b3[_0xffb8('0x30')];this[_0xffb8('0x31')]=_0xb605b3[_0xffb8('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0xb605b3[_0xffb8('0x32')];this[_0xffb8('0x33')]=_0xb605b3['predictiveIntervalDroppedCallsTimeout'];this[_0xffb8('0x34')]=_0xb605b3[_0xffb8('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0xb605b3['predictiveIntervalErlangCallsDroppedCalls'];this[_0xffb8('0x35')]=_0xb605b3[_0xffb8('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0xb605b3[_0xffb8('0x36')];this[_0xffb8('0x37')]=_0xb605b3['predictiveIntervalPauses'];this[_0xffb8('0x38')]=_0xb605b3[_0xffb8('0x38')];this[_0xffb8('0x39')]=_0xb605b3[_0xffb8('0x39')];this[_0xffb8('0x7')]=_0xb605b3[_0xffb8('0x7')];this[_0xffb8('0x3a')]=_0xb605b3['erlangCalls'];this['erlangCallToSecond']=_0xb605b3[_0xffb8('0x3b')];this[_0xffb8('0x3c')]=_0xb605b3['erlangAbandonmentRate'];this['erlangBusyFactor']=_0xb605b3[_0xffb8('0x3d')];this[_0xffb8('0x3e')]=_0xb605b3['startPredictive'];this[_0xffb8('0x3f')]=_0xb605b3[_0xffb8('0x3f')];this[_0xffb8('0x40')]=_0xb605b3['message'];this[_0xffb8('0x41')]=_0xb605b3[_0xffb8('0x41')];}if(_0xb605b3[_0xffb8('0x42')]){this[_0xffb8('0x42')]={'id':_0xb605b3[_0xffb8('0x42')]['id'],'name':_0xb605b3['Trunk'][_0xffb8('0x12')],'active':_0xb605b3[_0xffb8('0x42')][_0xffb8('0x43')],'callerid':_0xb605b3[_0xffb8('0x42')][_0xffb8('0x44')]};}}VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x46')]=function(_0x179770,_0x2b441d,_0x3ad842,_0x3f57f1){this[_0xffb8('0x6')]=0x0;this[_0xffb8('0x2')]=0x0;this[_0xffb8('0xe')]=0x0;this[_0xffb8('0x1e')]=0x0;this[_0xffb8('0x18')]=0x0;this[_0xffb8('0x16')]=0x0;this[_0xffb8('0x15')]=0x0;this[_0xffb8('0x17')]=0x0;this[_0xffb8('0x1d')]=0x0;this['ringing']=0x0;this[_0xffb8('0x19')]=0x0;this[_0xffb8('0x47')]=0x0;if(_0x3ad842){if(_0x3ad842[_0xffb8('0x4')]){this[_0xffb8('0x4')]=Number(_0x3ad842['available']);}if(_0x3ad842['loggedin']){this[_0xffb8('0x0')]=Number(_0x3ad842[_0xffb8('0x48')]);}if(_0x3ad842[_0xffb8('0x49')]){this[_0xffb8('0x3')]=Number(_0x3ad842['callers']);}}for(var _0x31cd7d=0x0;_0x31cd7d<_0x179770['length'];_0x31cd7d++){var _0x27ec7a=_0x2b441d['SIP/'+_0x179770[_0x31cd7d][_0xffb8('0x12')]];if(_0x27ec7a&&_0x27ec7a[_0xffb8('0x4a')]){this[_0xffb8('0x6')]+=0x1;}if(_0x179770[_0x31cd7d][_0xffb8('0x4b')]==='1'){this['talking']+=0x1;}if(_0x179770[_0x31cd7d]['paused']==='1'&&!['2','7','8']['includes'](_0x179770[_0x31cd7d][_0xffb8('0x4c')])){this['paused']+=0x1;}switch(_0x179770[_0x31cd7d][_0xffb8('0x4c')]){case'0':this[_0xffb8('0x1e')]+=0x1;break;case'1':this[_0xffb8('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xffb8('0x15')]+=0x1;break;case'4':this[_0xffb8('0x17')]+=0x1;break;case'5':this[_0xffb8('0x1d')]+=0x1;break;case'6':this[_0xffb8('0x1')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xffb8('0x4d')){var _0x22b1e0=Object['keys'](_0x3f57f1);for(var _0x298b3d=0x0;_0x298b3d<_0x22b1e0[_0xffb8('0x4e')];_0x298b3d++){var _0x2a8717=_0x22b1e0[_0x298b3d];var _0x35b40b=_0x3f57f1[_0x2a8717];if(_0x35b40b[_0xffb8('0x4f')]===this[_0xffb8('0x12')]&&_0x35b40b[_0xffb8('0x1c')]==='dialer'&&_0x35b40b[_0xffb8('0x50')]===_0xffb8('0x51')){this['talking']+=0x1;}}if(this[_0xffb8('0x2')]>this[_0xffb8('0x16')]){this[_0xffb8('0x2')]=this[_0xffb8('0x16')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x52')]=function(_0x46d7cd){var _0x2c3b05=![];if(_0x46d7cd){_0x2c3b05=INBOUND_COUNTERS[_0xffb8('0x53')](function(_0x40fe7b){return this[_0x40fe7b]!==_0x46d7cd[_0x40fe7b];},this);}return _0x2c3b05;};VoiceQueueSummary[_0xffb8('0x45')][_0xffb8('0x54')]=function(_0x1cb3ee){var _0x4bb597=![];var _0x53b156=![];var _0x38a755=![];if(_0x1cb3ee){_0x4bb597=this[_0xffb8('0x22')]!==_0x1cb3ee[_0xffb8('0x22')]||this[_0xffb8('0x21')]!==_0x1cb3ee[_0xffb8('0x21')]||this['message']!==_0x1cb3ee[_0xffb8('0x40')]||this[_0xffb8('0x41')]!==_0x1cb3ee[_0xffb8('0x41')];_0x53b156=OUTBOUND_COUNTERS[_0xffb8('0x53')](function(_0xc674f6){return this[_0xc674f6]!==_0x1cb3ee[_0xc674f6];},this);if(this['Trunk']&&_0x1cb3ee[_0xffb8('0x42')]){_0x38a755=this[_0xffb8('0x42')][_0xffb8('0x12')]!==_0x1cb3ee[_0xffb8('0x42')][_0xffb8('0x12')]||this[_0xffb8('0x42')]['active']!==_0x1cb3ee[_0xffb8('0x42')][_0xffb8('0x43')];}}return _0x4bb597||_0x53b156||_0x38a755;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0xe9d828){this['answered']=_0xe9d828[_0xffb8('0x5')];this[_0xffb8('0x40')]=_0xe9d828[_0xffb8('0x40')];this['statusMessage']=_0xe9d828['statusMessage'];this[_0xffb8('0x7')]=_0xe9d828['originated'];this[_0xffb8('0x8')]=_0xe9d828[_0xffb8('0x8')];this[_0xffb8('0x28')]=_0xe9d828[_0xffb8('0x28')];this[_0xffb8('0x29')]=_0xe9d828[_0xffb8('0x29')];this[_0xffb8('0x9')]=_0xe9d828[_0xffb8('0x9')];this[_0xffb8('0xa')]=_0xe9d828[_0xffb8('0xa')];this[_0xffb8('0xb')]=_0xe9d828['outboundNoAnswerCallsDay'];this[_0xffb8('0xc')]=_0xe9d828[_0xffb8('0xc')];this[_0xffb8('0xd')]=_0xe9d828['outboundReCallsDay'];this['outboundRejectCallsDay']=_0xe9d828[_0xffb8('0x2e')];this[_0xffb8('0x2f')]=_0xe9d828[_0xffb8('0x2f')];this[_0xffb8('0x10')]=_0xe9d828[_0xffb8('0x10')];this[_0xffb8('0x11')]=_0xe9d828['sumDuration'];this['total']=_0xe9d828[_0xffb8('0x1b')];if(this['dialMethod']==='preview'){this[_0xffb8('0xf')]=_0xe9d828[_0xffb8('0xf')];}};module[_0xffb8('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3040d21..d3bf96e 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 _0xb765=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0xb765,0x9f));var _0x5b76=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb765[_0x199572];return _0x13cfa3;};'use strict';function VtigerAccount(_0x14899c){this['id']=_0x14899c['id']||0x0;this[_0x5b76('0x0')]=_0x14899c[_0x5b76('0x0')]||'';this['username']=_0x14899c[_0x5b76('0x1')]||'';this['accessKey']=_0x14899c[_0x5b76('0x2')]||'';this[_0x5b76('0x3')]=_0x14899c[_0x5b76('0x3')]||'';this[_0x5b76('0x4')]=_0x14899c[_0x5b76('0x4')]||'';this[_0x5b76('0x5')]=_0x14899c['Configurations']||{};}module[_0x5b76('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6943=['exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x129a7c,_0x5c7eae){var _0x33d5cc=function(_0x24988b){while(--_0x24988b){_0x129a7c['push'](_0x129a7c['shift']());}};_0x33d5cc(++_0x5c7eae);}(_0x6943,0xa3));var _0x3694=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0x6943[_0x23c3f4];return _0x82f0f1;};'use strict';function VtigerAccount(_0x5b30be){this['id']=_0x5b30be['id']||0x0;this[_0x3694('0x0')]=_0x5b30be[_0x3694('0x0')]||'';this['username']=_0x5b30be[_0x3694('0x1')]||'';this[_0x3694('0x2')]=_0x5b30be['accessKey']||'';this[_0x3694('0x3')]=_0x5b30be[_0x3694('0x3')]||'';this[_0x3694('0x4')]=_0x5b30be['serverUrl']||'';this['Configurations']=_0x5b30be['Configurations']||{};}module[_0x3694('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 1f4d444..0b4e6b4 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 _0x2733=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x2bf53b,_0x188d3e){var _0x2deb52=function(_0x35c31a){while(--_0x35c31a){_0x2bf53b['push'](_0x2bf53b['shift']());}};_0x2deb52(++_0x188d3e);}(_0x2733,0x169));var _0x3273=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2733[_0x2c91e9];return _0x13f0ff;};'use strict';function ZendeskAccount(_0x1df6ce){this['id']=_0x1df6ce['id']||0x0;this[_0x3273('0x0')]=_0x1df6ce[_0x3273('0x0')]||'';this[_0x3273('0x1')]=_0x1df6ce[_0x3273('0x1')]||'';this[_0x3273('0x2')]=_0x1df6ce[_0x3273('0x2')]||'';this[_0x3273('0x3')]=_0x1df6ce[_0x3273('0x3')]||'';this[_0x3273('0x4')]=_0x1df6ce[_0x3273('0x4')]||'';this[_0x3273('0x5')]=_0x1df6ce[_0x3273('0x5')]||'';this[_0x3273('0x6')]=_0x1df6ce[_0x3273('0x6')]||'integrationTab';this[_0x3273('0x7')]=_0x1df6ce[_0x3273('0x7')]||'';this[_0x3273('0x8')]=_0x1df6ce[_0x3273('0x8')]||{};}module[_0x3273('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x6cd1=['Configurations','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x3d70bd,_0x1751f2){var _0x38afd5=function(_0x440587){while(--_0x440587){_0x3d70bd['push'](_0x3d70bd['shift']());}};_0x38afd5(++_0x1751f2);}(_0x6cd1,0xa1));var _0x16cd=function(_0x12c4cd,_0xdebe29){_0x12c4cd=_0x12c4cd-0x0;var _0x18a029=_0x6cd1[_0x12c4cd];return _0x18a029;};'use strict';function ZendeskAccount(_0x150b90){this['id']=_0x150b90['id']||0x0;this[_0x16cd('0x0')]=_0x150b90[_0x16cd('0x0')]||'';this[_0x16cd('0x1')]=_0x150b90['username']||'';this[_0x16cd('0x2')]=_0x150b90[_0x16cd('0x2')]||'';this[_0x16cd('0x3')]=_0x150b90[_0x16cd('0x3')]||'';this[_0x16cd('0x4')]=_0x150b90['remoteUri']||'';this[_0x16cd('0x5')]=_0x150b90['authType']||'';this[_0x16cd('0x6')]=_0x150b90[_0x16cd('0x6')]||_0x16cd('0x7');this[_0x16cd('0x8')]=_0x150b90[_0x16cd('0x8')]||'';this[_0x16cd('0x9')]=_0x150b90['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 36c8963..7bb8a45 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 _0xe6b6=['refreshToken','Configurations','zone','clientId','clientSecret','serverUrl','code'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe6b6,0x1ad));var _0x6e6b=function(_0x1f63e3,_0x417627){_0x1f63e3=_0x1f63e3-0x0;var _0xe85906=_0xe6b6[_0x1f63e3];return _0xe85906;};'use strict';function ZohoAccount(_0x20de34){this['id']=_0x20de34['id']||0x0;this['name']=_0x20de34['name']||'';this['description']=_0x20de34['description']||'';this['host']=_0x20de34['host']||'';this[_0x6e6b('0x0')]=_0x20de34[_0x6e6b('0x0')]||'';this[_0x6e6b('0x1')]=_0x20de34['clientId']||'';this[_0x6e6b('0x2')]=_0x20de34['clientSecret']||'';this['serverUrl']=_0x20de34[_0x6e6b('0x3')]||'';this[_0x6e6b('0x4')]=_0x20de34[_0x6e6b('0x4')]||'';this[_0x6e6b('0x5')]=_0x20de34[_0x6e6b('0x5')]||'';this[_0x6e6b('0x6')]=_0x20de34[_0x6e6b('0x6')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x535a=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x535a,0x125));var _0xa535=function(_0x421544,_0x5e319d){_0x421544=_0x421544-0x0;var _0x37ab89=_0x535a[_0x421544];return _0x37ab89;};'use strict';function ZohoAccount(_0x2870c9){this['id']=_0x2870c9['id']||0x0;this['name']=_0x2870c9[_0xa535('0x0')]||'';this[_0xa535('0x1')]=_0x2870c9['description']||'';this[_0xa535('0x2')]=_0x2870c9[_0xa535('0x2')]||'';this['zone']=_0x2870c9[_0xa535('0x3')]||'';this[_0xa535('0x4')]=_0x2870c9[_0xa535('0x4')]||'';this[_0xa535('0x5')]=_0x2870c9[_0xa535('0x5')]||'';this[_0xa535('0x6')]=_0x2870c9[_0xa535('0x6')]||'';this[_0xa535('0x7')]=_0x2870c9['code']||'';this[_0xa535('0x8')]=_0x2870c9['refreshToken']||'';this[_0xa535('0x9')]=_0x2870c9[_0xa535('0x9')]||{};}module[_0xa535('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index bccb2ea..0f4d945 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 _0xd117=['lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','format','calleridname','number','exports','util'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0xd117,0x182));var _0x7d11=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0xd117[_0x7880d2];return _0x35ebbe;};'use strict';var util=require(_0x7d11('0x0'));var _=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));function checkNameSurname(_0x45ee65,_0x454387,_0x26e0f0){var _0x306ae4='';if(!_[_0x7d11('0x3')](_0x454387)&&_0x7d11('0x4')===typeof _0x454387){_0x306ae4+=_0x454387;}if(!_[_0x7d11('0x3')](_0x26e0f0)&&_0x7d11('0x4')===typeof _0x26e0f0){_0x306ae4+='\x20'+_0x26e0f0;}if(_0x306ae4!==''){return _0x306ae4;}return _0x45ee65;}function Action(_0x2689c6,_0x27d7e8,_0x40c3c4,_0x345602,_0x3c8d66){this['uniqueid']=_0x40c3c4||undefined;this[_0x7d11('0x5')]=_0x2689c6['id'];this[_0x7d11('0x6')]=_0x27d7e8[_0x7d11('0x7')];this['type']=_0x27d7e8[_0x7d11('0x8')];this[_0x7d11('0x9')]=_0x7d11('0x6');this['dialAnswer']=![];this[_0x7d11('0xa')]=_['isNil'](_0x2689c6['Agent'])?undefined:_0x2689c6[_0x7d11('0xb')]['name'];this['channelAgent']=this[_0x7d11('0xa')]?util['format'](_0x7d11('0xc'),this[_0x7d11('0xa')]):_0x345602||undefined;this['calleridname']=checkNameSurname(_0x2689c6[_0x7d11('0xd')][_0x7d11('0xe')],_0x2689c6['Contact'][_0x7d11('0xf')],_0x2689c6[_0x7d11('0xd')][_0x7d11('0x10')]);this[_0x7d11('0x11')]=_0x2689c6[_0x7d11('0x11')]||![];this[_0x7d11('0x12')]=_0x2689c6[_0x7d11('0xe')];this[_0x7d11('0x13')]=_0x2689c6['scheduledat'];this[_0x7d11('0x14')]=_0x2689c6[_0x7d11('0x14')]||0x0;this[_0x7d11('0x15')]=_0x2689c6[_0x7d11('0x15')]||0x0;this[_0x7d11('0x16')]=_0x2689c6['countnoanswerretry']||0x0;this[_0x7d11('0x17')]=(_0x2689c6[_0x7d11('0x14')]||0x0)+(_0x2689c6['countcongestionretry']||0x0)+(_0x2689c6['countnoanswerretry']||0x0)+(_0x2689c6[_0x7d11('0x18')]||0x0)+(_0x2689c6['countdropretry']||0x0)+(_0x2689c6[_0x7d11('0x19')]||0x0)+(_0x2689c6['countmachineretry']||0x0)+(_0x2689c6[_0x7d11('0x1a')]||0x0);this[_0x7d11('0x18')]=_0x2689c6[_0x7d11('0x18')]||0x0;this[_0x7d11('0x1b')]=_0x2689c6[_0x7d11('0x1b')]||0x0;this[_0x7d11('0x19')]=_0x2689c6[_0x7d11('0x19')]||0x0;this[_0x7d11('0x1c')]=_0x2689c6['countmachineretry']||0x0;this[_0x7d11('0x1a')]=_0x2689c6['countagentrejectretry']||0x0;this['callback']=_0x2689c6['callback'];this[_0x7d11('0x1d')]=_0x2689c6[_0x7d11('0x1d')];this[_0x7d11('0x1e')]=_0x2689c6[_0x7d11('0x1e')];this[_0x7d11('0x1f')]=_0x2689c6[_0x7d11('0x1f')];this[_0x7d11('0x20')]=_0x2689c6[_0x7d11('0x20')];this['ListId']=_0x2689c6[_0x7d11('0x21')];this['UserId']=_['isNil'](_0x2689c6['Agent'])?_0x2689c6[_0x7d11('0x22')]:_0x2689c6['Agent']['id'];this[_0x7d11('0x23')]=_0x2689c6[_0x7d11('0x23')];this[_0x7d11('0x24')]='';this['originatecalleridname']='';}Action[_0x7d11('0x25')][_0x7d11('0x26')]=function(){return util[_0x7d11('0x27')]('\x22%s\x22\x20<%s>',this[_0x7d11('0x28')],this[_0x7d11('0x29')]);};module[_0x7d11('0x2a')]=Action; \ No newline at end of file +var _0x2032=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','string','isNil','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','format','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5ae268,_0x4b3d90){var _0x3fea8b=function(_0x4a0c9c){while(--_0x4a0c9c){_0x5ae268['push'](_0x5ae268['shift']());}};_0x3fea8b(++_0x4b3d90);}(_0x2032,0xd9));var _0x2203=function(_0x13df6c,_0x2452db){_0x13df6c=_0x13df6c-0x0;var _0x25047c=_0x2032[_0x13df6c];return _0x25047c;};'use strict';var util=require('util');var _=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));function checkNameSurname(_0xcd892f,_0x4c28da,_0x486390){var _0x228a29='';if(!_['isNil'](_0x4c28da)&&_0x2203('0x2')===typeof _0x4c28da){_0x228a29+=_0x4c28da;}if(!_[_0x2203('0x3')](_0x486390)&&_0x2203('0x2')===typeof _0x486390){_0x228a29+='\x20'+_0x486390;}if(_0x228a29!==''){return _0x228a29;}return _0xcd892f;}function Action(_0x201796,_0x3f7ba1,_0x13367a,_0x2e0f63,_0x2676aa){this[_0x2203('0x4')]=_0x13367a||undefined;this[_0x2203('0x5')]=_0x201796['id'];this[_0x2203('0x6')]=_0x3f7ba1['name'];this['type']=_0x3f7ba1[_0x2203('0x7')];this['campaigntype']=_0x2203('0x6');this[_0x2203('0x8')]=![];this[_0x2203('0x9')]=_['isNil'](_0x201796[_0x2203('0xa')])?undefined:_0x201796['Agent'][_0x2203('0xb')];this['channelAgent']=this[_0x2203('0x9')]?util[_0x2203('0xc')]('SIP/%s',this['membername']):_0x2e0f63||undefined;this['calleridname']=checkNameSurname(_0x201796['Contact']['phone'],_0x201796[_0x2203('0xd')]['firstName'],_0x201796['Contact'][_0x2203('0xe')]);this[_0x2203('0xf')]=_0x201796[_0x2203('0xf')]||![];this[_0x2203('0x10')]=_0x201796[_0x2203('0x11')];this[_0x2203('0x12')]=_0x201796[_0x2203('0x12')];this[_0x2203('0x13')]=_0x201796[_0x2203('0x13')]||0x0;this[_0x2203('0x14')]=_0x201796['countcongestionretry']||0x0;this[_0x2203('0x15')]=_0x201796[_0x2203('0x15')]||0x0;this['countglobal']=(_0x201796[_0x2203('0x13')]||0x0)+(_0x201796[_0x2203('0x14')]||0x0)+(_0x201796['countnoanswerretry']||0x0)+(_0x201796[_0x2203('0x16')]||0x0)+(_0x201796['countdropretry']||0x0)+(_0x201796[_0x2203('0x17')]||0x0)+(_0x201796[_0x2203('0x18')]||0x0)+(_0x201796[_0x2203('0x19')]||0x0);this[_0x2203('0x16')]=_0x201796[_0x2203('0x16')]||0x0;this[_0x2203('0x1a')]=_0x201796['countdropretry']||0x0;this[_0x2203('0x17')]=_0x201796['countabandonedretry']||0x0;this['countmachineretry']=_0x201796[_0x2203('0x18')]||0x0;this['countagentrejectretry']=_0x201796[_0x2203('0x19')]||0x0;this[_0x2203('0x1b')]=_0x201796['callback'];this[_0x2203('0x1c')]=_0x201796['callbackuniqueid'];this['callbackat']=_0x201796[_0x2203('0x1d')];this[_0x2203('0x1e')]=_0x201796[_0x2203('0x1e')];this[_0x2203('0x1f')]=_0x201796[_0x2203('0x1f')];this[_0x2203('0x20')]=_0x201796[_0x2203('0x20')];this[_0x2203('0x21')]=_['isNil'](_0x201796[_0x2203('0xa')])?_0x201796[_0x2203('0x21')]:_0x201796[_0x2203('0xa')]['id'];this['VoiceQueueId']=_0x201796[_0x2203('0x22')];this[_0x2203('0x23')]='';this['originatecalleridname']='';}Action[_0x2203('0x24')][_0x2203('0x25')]=function(){return util[_0x2203('0xc')](_0x2203('0x26'),this[_0x2203('0x27')],this[_0x2203('0x28')]);};module[_0x2203('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index da53651..41831ce 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 _0x9e0c=['[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','unmonitored','execRun','pick','unlockContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','execCall','Trunk','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','variablesAction','Action','OriginateError','[originateFailure][logOriginateFailure]','linkedid','actionid','lookAgent','logLookAgent','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','filterKey','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','defaults','localhost','socket.io-emitter','redis','enqueue','tail','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','CAMPAIGN_STATUS','DEACTIVATED','logger','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','preview','dialActive','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','createAgentHistory','AnswerAGI'];(function(_0x1ce2af,_0x1a1b2c){var _0x32fbf0=function(_0x130690){while(--_0x130690){_0x1ce2af['push'](_0x1ce2af['shift']());}};_0x32fbf0(++_0x1a1b2c);}(_0x9e0c,0x194));var _0xc9e0=function(_0x382bd8,_0x318a50){_0x382bd8=_0x382bd8-0x0;var _0x1d618a=_0x9e0c[_0x382bd8];return _0x1d618a;};'use strict';var util=require(_0xc9e0('0x0'));var _=require(_0xc9e0('0x1'));var uuid=require('uuid');var moment=require(_0xc9e0('0x2'));var Redis=require(_0xc9e0('0x3'));var config=require(_0xc9e0('0x4'));var logger=require(_0xc9e0('0x5'))('preview');var loggerAction=require(_0xc9e0('0x5'))('actionPreview');var ami=require(_0xc9e0('0x6'));var rpcDb=require(_0xc9e0('0x7'));var cmHopperAdditionalPhone=require(_0xc9e0('0x8'));var Action=require('./action');var ut=require(_0xc9e0('0x9'));var utils=require('../dialer/utils');config['redis']=_[_0xc9e0('0xa')](config['redis'],{'host':_0xc9e0('0xb'),'port':0x18eb});var io=require(_0xc9e0('0xc'))(new Redis(config[_0xc9e0('0xd')]));var Sequence=function(){};Sequence['prototype'][_0xc9e0('0xe')]=function(_0x989cf9){this['tail']=this[_0xc9e0('0xf')]?this[_0xc9e0('0xf')]['finally'](_0x989cf9):_0x989cf9();};function Preview(_0x47018c){this[_0xc9e0('0x10')]=new Sequence();this[_0xc9e0('0x11')]=_0x47018c['voiceQueues'];this['trunks']=_0x47018c[_0xc9e0('0x12')];this[_0xc9e0('0x13')]={};this[_0xc9e0('0x14')]=_0x47018c[_0xc9e0('0x14')];this[_0xc9e0('0x15')]=0x0;ami['on']('originateresponse',this[_0xc9e0('0x16')][_0xc9e0('0x17')](this));ami['on'](_0xc9e0('0x18'),this[_0xc9e0('0x19')][_0xc9e0('0x17')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xc9e0('0x17')](this));ami['on'](_0xc9e0('0x1a'),this[_0xc9e0('0x1b')][_0xc9e0('0x17')](this));ami['on']('newexten',this[_0xc9e0('0x1c')][_0xc9e0('0x17')](this));ami['on'](_0xc9e0('0x1d'),this[_0xc9e0('0x1e')][_0xc9e0('0x17')](this));ami['on'](_0xc9e0('0x1f'),this[_0xc9e0('0x20')]['bind'](this));ami['on'](_0xc9e0('0x21'),this[_0xc9e0('0x22')][_0xc9e0('0x17')](this));this[_0xc9e0('0x23')](this[_0xc9e0('0x11')]);}function emit(_0x47cb01,_0x43cdbd,_0x3a99c3){io['to'](_0x47cb01)[_0xc9e0('0x24')](_0x43cdbd,_0x3a99c3);}function emitVoiceQueueChannelRemove(_0x465556){logger[_0xc9e0('0x25')](_0xc9e0('0x26'),JSON[_0xc9e0('0x27')](_0x465556));emit(util[_0xc9e0('0x28')](_0xc9e0('0x29'),_0x465556[_0xc9e0('0x2a')]),'voice_queue_channel:remove',_0x465556);io[_0xc9e0('0x24')](_0xc9e0('0x2b'),_0x465556);}function notSendMessagesQueue(_0xe7f2b8){if(_0xe7f2b8[_0xc9e0('0x2c')]){if(_0xe7f2b8[_0xc9e0('0x2d')]===0x0&&_0xe7f2b8[_0xc9e0('0x2e')]===0x0){_0xe7f2b8[_0xc9e0('0x2c')]=![];_0xe7f2b8['available']=0x0;_0xe7f2b8[_0xc9e0('0x2f')]=0x0;_0xe7f2b8['message']=utils['CAMPAIGN_STATUS'][_0xc9e0('0x30')];ut['logger'](_0xc9e0('0x31'),_0xe7f2b8[_0xc9e0('0x2a')]+'\x20is\x20not\x20active');}else{_0xe7f2b8[_0xc9e0('0x32')]=utils[_0xc9e0('0x33')][_0xc9e0('0x34')];ut[_0xc9e0('0x35')](_0xc9e0('0x31'),_0xe7f2b8[_0xc9e0('0x2a')]+_0xc9e0('0x36'));}}}Preview[_0xc9e0('0x37')][_0xc9e0('0x23')]=function(){var _0x248b9a=this;setInterval(function(){_0x248b9a[_0xc9e0('0x38')]();},0x7cf);};Preview[_0xc9e0('0x37')][_0xc9e0('0x38')]=function(){var _0x12059e=this[_0xc9e0('0x11')];this[_0xc9e0('0x15')]+=0x1;for(var _0x301d28 in _0x12059e){if(_0x12059e[_0xc9e0('0x39')](_0x301d28)&&(_0x12059e[_0x301d28][_0xc9e0('0x3a')]==='preview'||_0x12059e[_0x301d28][_0xc9e0('0x3a')]==='booked')&&_0x12059e[_0x301d28][_0xc9e0('0x3b')]===_0xc9e0('0x3c')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x12059e[_0xc9e0('0x39')](_0x301d28)&&_0x12059e[_0x301d28][_0xc9e0('0x3a')]===_0xc9e0('0x3d')&&_0x12059e[_0x301d28][_0xc9e0('0x3b')]==='outbound'){if(_0x12059e[_0x301d28][_0xc9e0('0x3e')]){this['setMessage'](_0x12059e[_0x301d28]);if(_0x12059e[_0x301d28]['dialPreviewAutoRecallMe'])this[_0xc9e0('0x3f')](_0x12059e[_0x301d28]);}else{notSendMessagesQueue(_0x12059e[_0x301d28]);}}}};Preview['prototype'][_0xc9e0('0x40')]=function(_0x1cdfb9){var _0x263e2d=this;this[_0xc9e0('0x10')][_0xc9e0('0xe')](function(){if(!_[_0xc9e0('0x41')](_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9])){loggerAction[_0xc9e0('0x25')]('[clearZombieChannels][talking]',_0x1cdfb9,_0xc9e0('0x42'),_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x43')],_0xc9e0('0x44'),JSON['stringify'](_0x263e2d[_0xc9e0('0x11')][_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x43')]][_0xc9e0('0x2d')]),'pTalking:\x20',JSON[_0xc9e0('0x27')](_0x263e2d[_0xc9e0('0x11')][_0x263e2d['actions'][_0x1cdfb9]['queue']][_0xc9e0('0x2e')]),JSON['stringify'](_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x45')]),JSON[_0xc9e0('0x27')](_['pick'](_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9],[_0xc9e0('0x46'),_0xc9e0('0x47'),_0xc9e0('0x48'),'ListId'])));return ami['Action']({'action':'status','channel':_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x49')]})[_0xc9e0('0x4a')](function(_0x20b387){if(_0x20b387[_0xc9e0('0x32')]===_0xc9e0('0x4b')){setTimeout(function(){if(_0x263e2d['actions'][_0x1cdfb9]){ut[_0xc9e0('0x4c')](_0x263e2d[_0xc9e0('0x11')][_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x43')]],'[clearZombieChannel]');if(_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x45')]===!![]){ut['decrementTalkink'](_0x263e2d['campaignsPreview'][_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9]['queue']],'[clearZombieChannel]');ut['loggerError'](_0xc9e0('0x4d')+_0x1cdfb9,_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x43')]);}ut[_0xc9e0('0x4e')](_0xc9e0('0x4f')+_0x1cdfb9,_0x263e2d[_0xc9e0('0x13')][_0x1cdfb9][_0xc9e0('0x43')]);delete _0x263e2d[_0xc9e0('0x13')][_0x1cdfb9];}},0x2328);}});}});};Preview[_0xc9e0('0x37')][_0xc9e0('0x50')]=function(){var _0x6646e2=this;loggerAction[_0xc9e0('0x25')]('[action]',_[_0xc9e0('0x51')](this['actions']));for(var _0x783045 in this['actions']){if(_0x6646e2[_0xc9e0('0x13')]['hasOwnProperty'](_0x783045)){_0x6646e2[_0xc9e0('0x40')](_0x783045);}}};Preview[_0xc9e0('0x37')]['recallMe']=function(_0x2cf062){var _0x1d55d3=this;rpcDb[_0xc9e0('0x52')](_0x2cf062['id'],ut[_0xc9e0('0x53')](this[_0xc9e0('0x14')]))[_0xc9e0('0x54')](function(_0x92f4ca){if(!_[_0xc9e0('0x41')](_0x92f4ca)){for(var _0x171b58=0x0;_0x171b58<_0x92f4ca[_0xc9e0('0x55')];_0x171b58+=0x1){if(ut['getDiff'](_0x92f4ca[_0x171b58][_0xc9e0('0x56')])<_0x2cf062['dialRecallMeTimeout']*0x3c){if(_0x92f4ca[_0x171b58][_0xc9e0('0x57')]&&!_0x92f4ca[_0x171b58][_0xc9e0('0x57')][_0xc9e0('0x58')]){_0x1d55d3[_0xc9e0('0x59')](_0x92f4ca[_0x171b58]['id'])[_0xc9e0('0x54')](ut['logger2'](_0xc9e0('0x5a')))[_0xc9e0('0x4a')](ut['logger2'](_0xc9e0('0x5a')));}else{rpcDb[_0xc9e0('0x5b')](_0x92f4ca[_0x171b58]['id']);}}else{var _0x4cc916=new Action(_0x92f4ca[_0x171b58],_0x2cf062);_0x4cc916[_0xc9e0('0x5c')]=moment()[_0xc9e0('0x28')](_0xc9e0('0x5d'));_0x2cf062[_0xc9e0('0x5e')]+=0x1;ut['logCustomer'](_0x4cc916,0x17,_0xc9e0('0x5f'));if(_0x2cf062[_0xc9e0('0x60')]){rpcDb[_0xc9e0('0x61')](ut[_0xc9e0('0x62')](_0x92f4ca[_0x171b58]));rpcDb[_0xc9e0('0x63')](_0x4cc916,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xc9e0('0x64')](_0x4cc916,0x16,_0xc9e0('0x65'));rpcDb['createCustomerHistory'](_0x4cc916,_0xc9e0('0x66'));rpcDb[_0xc9e0('0x67')](_0x4cc916,_0xc9e0('0x66'));}}}}})[_0xc9e0('0x4a')](ut[_0xc9e0('0x68')](_0xc9e0('0x69')));};Preview[_0xc9e0('0x37')][_0xc9e0('0x6a')]=function(_0x1f3609){_0x1f3609[_0xc9e0('0x2c')]=!![];if(ut[_0xc9e0('0x6b')](_0x1f3609[_0xc9e0('0x6c')])){_0x1f3609[_0xc9e0('0x32')]=utils[_0xc9e0('0x33')][_0xc9e0('0x6d')];}else if(!ut[_0xc9e0('0x6e')](_0x1f3609[_0xc9e0('0x3e')])){_0x1f3609[_0xc9e0('0x32')]=utils['CAMPAIGN_STATUS'][_0xc9e0('0x30')];}else if(!this[_0xc9e0('0x6f')](_0x1f3609['Trunk'])){if(!this[_0xc9e0('0x6f')](_0x1f3609['TrunkBackup'])){_0x1f3609[_0xc9e0('0x32')]=utils[_0xc9e0('0x33')][_0xc9e0('0x70')];}else{_0x1f3609[_0xc9e0('0x32')]=utils[_0xc9e0('0x33')][_0xc9e0('0x71')];}}else{_0x1f3609[_0xc9e0('0x32')]=utils['CAMPAIGN_STATUS'][_0xc9e0('0x71')];}};Preview[_0xc9e0('0x37')][_0xc9e0('0x72')]=function(_0x45606b,_0xd78f68,_0x20b658){var _0x40d1a8=this;var _0x5565e2=this[_0xc9e0('0x13')][_0xd78f68];var _0x5abcb8=this['campaignsPreview'][_0x5565e2[_0xc9e0('0x43')]];var _0x4218f8;var _0x2947c6=![];var _0x3dae0e=0x2;var _0x4bfb8e=0x3;if(_0x5abcb8){switch(_0x20b658){case'1':_0x5abcb8['outboundNoSuchCallsDay']+=0x1;_0x5565e2['countnosuchnumberretry']+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0x0,_0xc9e0('0x75'));ami[_0xc9e0('0x24')](_0xc9e0('0x76'),ut[_0xc9e0('0x77')](_0x5565e2,_0xc9e0('0x78')));rpcDb[_0xc9e0('0x63')](_0x5565e2,_0xc9e0('0x79'));_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'0',_0x5abcb8)[_0xc9e0('0x54')](function(_0x1b6615){_0x2947c6=_0x1b6615[_0xc9e0('0x7b')]==0x1;_0x3dae0e=_0x5abcb8[_0xc9e0('0x7c')];_0x4bfb8e=_0x5abcb8[_0xc9e0('0x7d')];if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut['cloneAction'](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb[_0xc9e0('0x67')](_0x4218f8,_0xc9e0('0x80'));}else{if(_0x5565e2['countnosuchnumberretry']>=_0x5abcb8[_0xc9e0('0x81')]){rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0x80'));}else{rpcDb[_0xc9e0('0x82')](ut[_0xc9e0('0x83')](_0x5565e2,_0xc9e0('0x84'),_0x5abcb8[_0xc9e0('0x7c')]),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}delete this[_0xc9e0('0x13')][_0x45606b['linkedid']];}else{_0x5565e2[_0xc9e0('0x84')]++;logger['info']('actioncountonusuch',_0x5565e2[_0xc9e0('0x84')]);logger[_0xc9e0('0x25')]('id',_0x5565e2[_0xc9e0('0x87')]);_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countnosuchnumberretry':_0x5565e2[_0xc9e0('0x84')]}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)[_0xc9e0('0x54')](function(){});});}});break;case'ANSWER':var _0x1e3c11=moment()[_0xc9e0('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x5565e2[_0xc9e0('0x8a')]=_0x1e3c11;_0x5565e2[_0xc9e0('0x8b')]=_0x1e3c11;_0x5565e2['dialAnswer']=!![];_0x5abcb8[_0xc9e0('0x2e')]+=0x1;logger[_0xc9e0('0x25')](_0xc9e0('0x8c'),_0x5565e2[_0xc9e0('0x8d')],'\x20Queue',_0x5abcb8[_0xc9e0('0x2a')],_0xc9e0('0x8e'),_0x5abcb8[_0xc9e0('0x2e')]);ami[_0xc9e0('0x24')](_0xc9e0('0x8f'),ut[_0xc9e0('0x77')](_0x5565e2,_0xc9e0('0x90'),this[_0xc9e0('0x11')][_0x5565e2[_0xc9e0('0x43')]]));if(_0x5abcb8['acw']){ami[_0xc9e0('0x24')](_0xc9e0('0x91'),ut[_0xc9e0('0x92')](_0x5565e2));}break;case'16':ami['emit'](_0xc9e0('0x93'),ut['buildObj'](_0x5565e2,_0xc9e0('0x94'),this[_0xc9e0('0x11')][_0x5565e2['queue']]));emitVoiceQueueChannelRemove(ut[_0xc9e0('0x77')](_0x5565e2,'complete'));_0x5abcb8[_0xc9e0('0x95')]+=0x1;_0x5abcb8['total']+=0x1;_0x5abcb8[_0xc9e0('0x96')]+=0x1;ut['decrementTalkink'](_0x5abcb8,_0xc9e0('0x97'));_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut['logCustomer'](_0x5565e2,0x4,_0xc9e0('0x98'));rpcDb['createCustomerHistory'](_0x5565e2,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0x99'));rpcDb[_0xc9e0('0x9a')](_0x5565e2);_0x5abcb8[_0xc9e0('0x9b')]+=_0x5565e2[_0xc9e0('0x9c')];_0x5abcb8['sumBillable']+=_0x5565e2[_0xc9e0('0x9c')];logger[_0xc9e0('0x25')](_0xc9e0('0x9d'),_0x5565e2['uniqueid'],_0xc9e0('0x9e'),_0x5abcb8['name'],_0xc9e0('0x8e'),_0x5abcb8[_0xc9e0('0x2e')]);delete this[_0xc9e0('0x13')][_0x45606b['linkedid']];break;case _0xc9e0('0x9f'):_0x5abcb8[_0xc9e0('0xa0')]+=0x1;_0x5565e2[_0xc9e0('0xa1')]+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut['logCustomer'](_0x5565e2,0x5,_0xc9e0('0xa2'));_0x3dae0e=_0x5abcb8[_0xc9e0('0xa3')];_0x4bfb8e=_0x5abcb8['callAdditionalPhoneAfterMin'];ami[_0xc9e0('0x24')]('custom:agentbusy',ut[_0xc9e0('0x77')](_0x5565e2,_0xc9e0('0xa4')));rpcDb[_0xc9e0('0x63')](_0x5565e2,'[callProgressDetectingCustomer][logBusy]');_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'5',_0x5abcb8)[_0xc9e0('0x54')](function(_0x2e5a50){_0x2947c6=_0x2e5a50['additional']==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb['createCustomerFinal'](_0x4218f8,_0xc9e0('0xa6'));}else{if(_0x5565e2['countbusyretry']>=_0x5abcb8[_0xc9e0('0xa7')]){rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xa8'));}else{rpcDb[_0xc9e0('0x82')](ut[_0xc9e0('0x83')](_0x5565e2,'countbusyretry',_0x5abcb8['dialBusyRetryFrequency']),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}}else{_0x5565e2[_0xc9e0('0xa1')]++;_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countbusyretry':_0x5565e2[_0xc9e0('0xa1')]}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)['then'](function(){});});}});break;case _0xc9e0('0xa9'):_0x5abcb8[_0xc9e0('0xaa')]+=0x1;_0x5565e2['countnoanswerretry']+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0x3,_0xc9e0('0xab'));_0x3dae0e=_0x5abcb8[_0xc9e0('0xac')];_0x4bfb8e=_0x5abcb8[_0xc9e0('0x7d')];var _0x59cf4b=ut[_0xc9e0('0xad')](_0x5565e2,_0x5abcb8);ami[_0xc9e0('0x24')]('custom:agentnoanswer',_0x59cf4b);rpcDb[_0xc9e0('0x63')](_0x5565e2,_0xc9e0('0xae'));_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'3',_0x5abcb8)[_0xc9e0('0x54')](function(_0x5b7035){_0x2947c6=_0x5b7035[_0xc9e0('0x7b')]==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb['createCustomerFinal'](_0x4218f8,_0xc9e0('0xaf'));}else{if(_0x5565e2[_0xc9e0('0xb0')]>=_0x5abcb8[_0xc9e0('0xb1')]){rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xae'));}else{rpcDb[_0xc9e0('0x82')](ut[_0xc9e0('0x83')](_0x5565e2,_0xc9e0('0xb0'),_0x5abcb8['dialNoAnswerRetryFrequency']),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}}else{_0x5565e2[_0xc9e0('0xb0')]++;_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countnoanswerretry':_0x5565e2['countnoanswerretry']}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)['then'](function(){});});}});break;case _0xc9e0('0xb2'):_0x5abcb8['outboundCongestionCallsDay']+=0x1;_0x5565e2['countcongestionretry']+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut['totalGlobal'](_0x5565e2);ut['logCustomer'](_0x5565e2,0x8,_0xc9e0('0xb3'));_0x3dae0e=_0x5abcb8[_0xc9e0('0xb4')];_0x4bfb8e=_0x5abcb8[_0xc9e0('0x7d')];ami[_0xc9e0('0x24')](_0xc9e0('0xb5'),ut[_0xc9e0('0x77')](_0x5565e2,'congestion'));rpcDb[_0xc9e0('0x63')](_0x5565e2,_0xc9e0('0xb6'));_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'8',_0x5abcb8)['then'](function(_0x41f348){_0x2947c6=_0x41f348[_0xc9e0('0x7b')]==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb[_0xc9e0('0x67')](_0x4218f8,_0xc9e0('0xb7'));}else{if(_0x5565e2['countcongestionretry']>=_0x5abcb8['dialCongestionMaxRetry']){rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xb6'));}else{rpcDb[_0xc9e0('0x82')](ut[_0xc9e0('0x83')](_0x5565e2,_0xc9e0('0xb8'),_0x5abcb8[_0xc9e0('0xa3')]),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}}else{_0x5565e2[_0xc9e0('0xb8')]++;_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countcongestionretry':_0x5565e2[_0xc9e0('0xb8')]}})['then'](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)[_0xc9e0('0x54')](function(){});});}});break;case _0xc9e0('0xb9'):_0x5abcb8[_0xc9e0('0xba')]+=0x1;_0x5565e2[_0xc9e0('0xbb')]+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0x14,'AgentReject');_0x3dae0e=_0x5abcb8['dialAgentRejectRetryFrequency'];_0x4bfb8e=_0x5abcb8['callAdditionalPhoneAfterMin'];ami[_0xc9e0('0x24')](_0xc9e0('0xbc'),ut['buildObj'](_0x5565e2,_0xc9e0('0xbd')));rpcDb[_0xc9e0('0x63')](_0x5565e2,_0xc9e0('0xbe'));_0x40d1a8['verifyAdditionalPhones'](_0x5565e2,'20',_0x5abcb8)[_0xc9e0('0x54')](function(_0x5c2af6){_0x2947c6=_0x5c2af6[_0xc9e0('0x7b')]==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8['dialGlobalMaxRetry']){_0x4218f8=ut['cloneAction'](_0x5565e2,0x14,_0xc9e0('0xbf'));rpcDb[_0xc9e0('0x67')](_0x4218f8,_0xc9e0('0xc0'));}else{if(_0x5565e2[_0xc9e0('0xbb')]>=_0x5abcb8['dialAgentRejectMaxRetry']){rpcDb[_0xc9e0('0x67')](_0x5565e2,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xc9e0('0x82')](ut[_0xc9e0('0x83')](_0x5565e2,_0xc9e0('0xbb'),_0x5abcb8[_0xc9e0('0xc1')]),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}}else{_0x5565e2['countnoanswerretry']++;_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countnoanswerretry':_0x5565e2[_0xc9e0('0xb0')]}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)[_0xc9e0('0x54')](function(){});});}});break;case _0xc9e0('0xc2'):_0x5abcb8[_0xc9e0('0xc3')]+=0x1;_0x5565e2[_0xc9e0('0xc4')]+=0x1;_0x5565e2['countglobal']=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0xb,_0xc9e0('0xc5'));rpcDb[_0xc9e0('0x63')](_0x5565e2,'[callProgressDetectingCustomer][logAbandoned]');_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'11',_0x5abcb8)['then'](function(_0x4f1346){_0x2947c6=_0x4f1346[_0xc9e0('0x7b')]==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8['dialGlobalMaxRetry']){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb[_0xc9e0('0x67')](_0x4218f8,_0xc9e0('0xc6'));}else{if(_0x5565e2[_0xc9e0('0xc7')]>=_0x5abcb8[_0xc9e0('0xc8')]){rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xc9e0('0x83')](_0x5565e2,_0xc9e0('0xc4'),_0x5abcb8[_0xc9e0('0xc9')]),_0x5565e2[_0xc9e0('0x85')],_0x5565e2[_0xc9e0('0x86')]);}}}else{_0x5565e2[_0xc9e0('0xb0')]++;_0x40d1a8['incrementPreviewCounters']({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countnoanswerretry':_0x5565e2['countnoanswerretry']}})['then'](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)['then'](function(){});});}});break;case'18':_0x5abcb8[_0xc9e0('0xca')]+=0x1;_0x5565e2['countmachineretry']+=0x1;_0x5565e2['countglobal']=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0x12,_0x45606b[_0xc9e0('0xcb')]||_0x45606b[_0xc9e0('0xcc')]);ami[_0xc9e0('0x24')](_0xc9e0('0xcd'),ut[_0xc9e0('0x77')](_0x5565e2,_0xc9e0('0xce')));rpcDb[_0xc9e0('0x63')](_0x5565e2,'[callProgressDetectingCustomer][hangupInAMD]');_0x40d1a8['verifyAdditionalPhones'](_0x5565e2,'18',_0x5abcb8)[_0xc9e0('0x54')](function(_0x42549d){_0x2947c6=_0x42549d['additional']==0x1;if(!_0x2947c6){if(ut['totalGlobal'](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut['cloneAction'](_0x5565e2,0x12,_0xc9e0('0x7f'));rpcDb[_0xc9e0('0x67')](_0x4218f8,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xcf'));}}else{_0x5565e2[_0xc9e0('0xb0')]++;_0x40d1a8[_0xc9e0('0x88')]({'id':_0x5565e2[_0xc9e0('0x87')],'field':{'countnoanswerretry':_0x5565e2['countnoanswerretry']}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)['then'](function(){});});}});delete this[_0xc9e0('0x13')][_0x45606b['linkedid']];break;case'19':_0x5abcb8[_0xc9e0('0xca')]+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut['totalGlobal'](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0x13,_0x45606b['cause-txt']||_0x45606b[_0xc9e0('0xcc')]);ami[_0xc9e0('0x24')](_0xc9e0('0xcd'),ut[_0xc9e0('0x77')](_0x5565e2,_0xc9e0('0xce')));rpcDb[_0xc9e0('0x63')](_0x5565e2,'[callProgressDetectingCustomer][machine]');_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'18',_0x5abcb8)[_0xc9e0('0x54')](function(_0x376e33){_0x2947c6=_0x376e33[_0xc9e0('0x7b')]==0x1;if(!_0x2947c6){if(ut[_0xc9e0('0x74')](_0x5565e2)>=_0x5abcb8['dialGlobalMaxRetry']){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,_0xc9e0('0x7f'));rpcDb[_0xc9e0('0x67')](_0x4218f8,_0xc9e0('0xd0'));}else{rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xd0'));}}else{_0x5565e2[_0xc9e0('0xb0')]++;_0x40d1a8['incrementPreviewCounters']({'id':_0x5565e2['idContact'],'field':{'countnoanswerretry':_0x5565e2[_0xc9e0('0xb0')]}})[_0xc9e0('0x54')](function(){_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)[_0xc9e0('0x54')](function(){});});}});delete this[_0xc9e0('0x13')][_0x45606b['linkedid']];break;default:if(_0x5565e2[_0xc9e0('0x45')]){ut[_0xc9e0('0xd1')](_0x5abcb8,_0xc9e0('0xd2'));ut[_0xc9e0('0x4e')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5abcb8['name'],_0x45606b);}_0x5abcb8[_0xc9e0('0xca')]+=0x1;_0x5565e2[_0xc9e0('0x73')]=ut[_0xc9e0('0x74')](_0x5565e2);ut[_0xc9e0('0x64')](_0x5565e2,0xc,_0x45606b['cause-txt']||_0x45606b[_0xc9e0('0xcc')]);_0x3dae0e=_0x5abcb8[_0xc9e0('0xc1')];_0x4bfb8e=_0x5abcb8[_0xc9e0('0x7d')];rpcDb[_0xc9e0('0x63')](_0x5565e2,_0xc9e0('0xd3'));_0x40d1a8[_0xc9e0('0x7a')](_0x5565e2,'20',_0x5abcb8)[_0xc9e0('0x54')](function(_0x364991){_0x2947c6=_0x364991['additional']==0x1;if(!_0x2947c6){if(ut['totalGlobal'](_0x5565e2)>=_0x5abcb8[_0xc9e0('0x7e')]){_0x4218f8=ut[_0xc9e0('0xa5')](_0x5565e2,0xf,'Global');rpcDb['createCustomerFinal'](_0x4218f8,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xc9e0('0x67')](_0x5565e2,_0xc9e0('0xd4'));}delete this['actions'][_0x45606b['linkedid']];}else{_0x40d1a8[_0xc9e0('0x89')](_0x5565e2,_0x3dae0e,_0x4bfb8e)[_0xc9e0('0x54')](function(){});}});}if(!(_0x5565e2['dialAnswer']&&_0x20b658==='16')){ut[_0xc9e0('0x4c')](_0x5abcb8,'[callProgressDetectingCustomer]');logger[_0xc9e0('0x25')](_0xc9e0('0xd5'),_0x5565e2[_0xc9e0('0x8d')],'\x20Queue',_0x5abcb8[_0xc9e0('0x2a')],_0xc9e0('0x44'),_0x5abcb8[_0xc9e0('0x2d')]);}if(_0x20b658!==_0xc9e0('0xd6')){delete this[_0xc9e0('0x13')][_0x45606b['linkedid']];delete this['actions'][_0x45606b[_0xc9e0('0xd7')]];}_0x5abcb8['queueSummaryCountersUpdated']=!![];}};Preview[_0xc9e0('0x37')][_0xc9e0('0xd8')]=function(_0x1771a8,_0x2673b4,_0x17ac6d){if(_[_0xc9e0('0xd9')](_0x2673b4)&&'object'!==typeof _0x2673b4){return;}if(_[_0xc9e0('0xd9')](_0x17ac6d)&&_0xc9e0('0xda')!==typeof _0x17ac6d){return;}switch(_0x17ac6d[_0xc9e0('0xdb')]){case'0':ut[_0xc9e0('0xdc')](_0x1771a8,0x0,_0xc9e0('0x75'));rpcDb['createAgentHistory'](_0x1771a8,_0xc9e0('0xdd'));break;case'3':ut[_0xc9e0('0xdc')](_0x1771a8,0x3,_0xc9e0('0xab'));rpcDb['createAgentHistory'](_0x1771a8,_0xc9e0('0xde'));break;case'5':ut[_0xc9e0('0xdc')](_0x1771a8,0x5,_0xc9e0('0xa2'));rpcDb['createAgentHistory'](_0x1771a8,_0xc9e0('0xdf'));break;case'8':ut[_0xc9e0('0xdc')](_0x1771a8,0x8,'Congestion');rpcDb[_0xc9e0('0xe0')](_0x1771a8,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xc9e0('0xdc')](_0x1771a8,0x16,_0xc9e0('0xe1'));rpcDb['createAgentHistory'](_0x1771a8,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xc9e0('0xdc')](_0x1771a8,0xc,_0x17ac6d[_0xc9e0('0xdb')]);rpcDb[_0xc9e0('0xe0')](_0x1771a8,'[callProgressDetectingAgent][logCongestion]');}ut[_0xc9e0('0x4c')](_0x2673b4,'[callProgressDetectingAgent]');logger[_0xc9e0('0x25')](_0xc9e0('0xe2'),_0x1771a8[_0xc9e0('0x8d')],_0xc9e0('0x9e'),_0x2673b4[_0xc9e0('0x2a')],_0xc9e0('0x44'),_0x2673b4[_0xc9e0('0x2d')]);delete this['actions'][_0x1771a8['uniqueid']];};Preview[_0xc9e0('0x37')][_0xc9e0('0x7a')]=function(_0x594410,_0x3651ad,_0x2a8247){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x594410,_0x3651ad,_0x2a8247)['catch'](logger[_0xc9e0('0x25')](_0xc9e0('0xe3')));};Preview[_0xc9e0('0x37')][_0xc9e0('0x89')]=function(_0x1e574e,_0x4fb912,_0x18de7a){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1e574e,_0x4fb912,_0x18de7a)[_0xc9e0('0x4a')](logger[_0xc9e0('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0xc9e0('0x37')][_0xc9e0('0x88')]=function(_0x53526d){return Promise[_0xc9e0('0xe4')]()[_0xc9e0('0x54')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x53526d))[_0xc9e0('0x4a')](logger[_0xc9e0('0x25')]('[incrementPreviewCounters]\x20'));};Preview[_0xc9e0('0x37')]['checkInBlack']=function(_0x222e6d,_0xf73853,_0x6398e6,_0x4579a8,_0x5b019c){var _0x348221=this;return new Promise(function(_0x494677,_0x7ba9e0){if(_[_0xc9e0('0x41')](_0xf73853)||_['isNil'](_0xf73853[_0xc9e0('0xe5')])||_[_0xc9e0('0x41')](_0xf73853[_0xc9e0('0xe6')])||_[_0xc9e0('0x41')](_0xf73853[_0xc9e0('0x48')])){_0x7ba9e0(ut[_0xc9e0('0x32')](_0xc9e0('0xe7'),_0x4579a8,_0x5b019c));return;}var _0x70ab12=uuid['v4']();var _0xf9a5b2=_0x348221['campaignsPreview'][_0xf73853[_0xc9e0('0x42')][_0xc9e0('0x2a')]];var _0x4cd6f1=_0x6398e6?_0x348221[_0xc9e0('0x14')][_0x6398e6]['id']:undefined;_0x348221[_0xc9e0('0x13')][_0x70ab12]=new Action(_0xf73853,_0xf9a5b2,_0x70ab12,_0x6398e6,_0x4cd6f1);var _0x40bf39=_0x348221[_0xc9e0('0x13')][_0x70ab12];_0x40bf39['unlockAgent']=_0x4579a8;_0x40bf39['activeContact']=_0x5b019c;_0x40bf39['lookAgent']=_0x6398e6;if(_[_0xc9e0('0xe8')](_0x222e6d)){_0x348221['execCall'](_0x40bf39,_0xf9a5b2,_0xf73853,_0x6398e6)[_0xc9e0('0x54')](function(_0x3a90d1){logger[_0xc9e0('0x25')](_0xc9e0('0xe9'),_0xc9e0('0xea')+_0x40bf39[_0xc9e0('0x43')]+'\x20IdHopper:\x20'+_0x40bf39[_0xc9e0('0x87')],JSON[_0xc9e0('0x27')](_0x3a90d1));ami[_0xc9e0('0x24')]('custom:agentcalled',ut['buildObj'](_0x40bf39,_0xc9e0('0xeb'),_0x348221[_0xc9e0('0x11')][_0x40bf39['queue']]));_0x494677(ut[_0xc9e0('0x32')](_0xc9e0('0xec')));})['catch'](function(_0x3910ca){ut['logger'](_0xc9e0('0xed'),_0x3910ca);_0x7ba9e0(ut[_0xc9e0('0x32')]('Call\x20failed',_0x4579a8,_0x5b019c));});}else{_0xf9a5b2[_0xc9e0('0xee')]+=0x1;ut[_0xc9e0('0xef')](_0x40bf39);rpcDb[_0xc9e0('0xf0')](_0x40bf39,_0xc9e0('0xf1'));delete _0x348221['actions'][_0x70ab12];_0x7ba9e0(ut['message']('Contact\x20in\x20black\x20List',_0x4579a8,_0x5b019c));}});};Preview[_0xc9e0('0x37')][_0xc9e0('0x6f')]=function(_0x37e418){return!_['isNil'](_0x37e418)&&!_[_0xc9e0('0x41')](_0x37e418[_0xc9e0('0x2a')])&&!_[_0xc9e0('0x41')](_0x37e418[_0xc9e0('0xf2')])&&_0x37e418[_0xc9e0('0xf2')]&&!_[_0xc9e0('0x41')](this[_0xc9e0('0x12')][util['format'](_0xc9e0('0xf3'),_0x37e418[_0xc9e0('0x2a')])])&&!_[_0xc9e0('0x41')](this[_0xc9e0('0x12')][util[_0xc9e0('0x28')](_0xc9e0('0xf3'),_0x37e418[_0xc9e0('0x2a')])][_0xc9e0('0xf4')])&&(this['trunks'][util[_0xc9e0('0x28')](_0xc9e0('0xf3'),_0x37e418[_0xc9e0('0x2a')])][_0xc9e0('0xf4')]==='reachable'||this[_0xc9e0('0x12')][util[_0xc9e0('0x28')](_0xc9e0('0xf3'),_0x37e418[_0xc9e0('0x2a')])][_0xc9e0('0xf4')]===_0xc9e0('0xf5'));};Preview[_0xc9e0('0x37')][_0xc9e0('0x59')]=function(_0x583a3c,_0x16feba){return this[_0xc9e0('0xf6')](_0x583a3c,_0x16feba)[_0xc9e0('0x54')](function(_0xb66877){return _[_0xc9e0('0xf7')](_0xb66877,[_0xc9e0('0x32')]);})[_0xc9e0('0x4a')](function(_0x2c4aa4){if(_0x2c4aa4['unlock']){rpcDb[_0xc9e0('0xf8')](_0x583a3c);}if(_0x2c4aa4[_0xc9e0('0xf2')]){rpcDb[_0xc9e0('0x5b')](_0x583a3c);}throw _[_0xc9e0('0xf7')](_0x2c4aa4,[_0xc9e0('0x32')]);});};Preview[_0xc9e0('0x37')][_0xc9e0('0xf6')]=function(_0x3409f4,_0x276595){var _0x3fc018=this;var _0x1e9f22,_0x83c9f;return rpcDb[_0xc9e0('0xf9')](_0x3409f4)[_0xc9e0('0x54')](function(_0xffa894){if(!_[_0xc9e0('0x41')](_0xffa894[0x0])){_0x83c9f=_0xffa894[0x0][_0xc9e0('0xfa')]?![]:!![];_0x1e9f22=_0xffa894[0x0][_0xc9e0('0xfa')]?!![]:![];_0x1e9f22=_0x276595?!![]:_0x1e9f22;}var _0x1b2588=_0x3fc018[_0xc9e0('0xfb')](_0xffa894);if(_0x1b2588[_0xc9e0('0xfc')]){rpcDb['checkIsBlackList'](_[_0xc9e0('0xf7')](_0xffa894[0x0],[_0xc9e0('0x48'),'phone']))['then'](function(_0x1d57ed){_0x3fc018['checkInBlack'](_0x1d57ed,_0xffa894[0x0],_0x276595,_0x83c9f,_0x1e9f22)['then'](function(_0x3991c3){return _0x3991c3;})[_0xc9e0('0x4a')](function(_0x44cfdf){throw _0x44cfdf;});})[_0xc9e0('0x4a')](function(_0x2d32f9){ut[_0xc9e0('0x35')](_0xc9e0('0xfd'),_0x2d32f9);throw ut[_0xc9e0('0x32')](_0xc9e0('0xfe'),_0x83c9f,_0x1e9f22);});}else{throw ut[_0xc9e0('0x32')](_0x1b2588[_0xc9e0('0x32')],_0x83c9f,_0x1e9f22);}})[_0xc9e0('0x4a')](function(_0x3455be){ut[_0xc9e0('0x35')](_0xc9e0('0xff'),_0x3455be);throw ut[_0xc9e0('0x32')](_0xc9e0('0xfe'),![],!![]);});};Preview['prototype']['validateContact']=function(_0x51c469){if(_['isNil'](_0x51c469)||_['isEmpty'](_0x51c469)||!_[_0xc9e0('0x41')](_0x51c469[0x0][_0xc9e0('0x57')])&&_[_0xc9e0('0x41')](_0x51c469[0x0][_0xc9e0('0x57')][_0xc9e0('0x2a')])){ut[_0xc9e0('0x35')](_0xc9e0('0x100'),_0x51c469);return{'isValid':![],'message':_0xc9e0('0x101')};}var _0x237009=this[_0xc9e0('0x11')][_0x51c469[0x0]['Queue'][_0xc9e0('0x2a')]];_0x237009[_0xc9e0('0x32')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xc9e0('0x41')](_0x237009)){ut[_0xc9e0('0x35')](_0xc9e0('0x102'),_0x237009);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xc9e0('0x6f')](_0x237009['Trunk'])){ut[_0xc9e0('0x35')](_0xc9e0('0x103'),'campaign\x20Name:\x20'+_0x237009[_0xc9e0('0x2a')]+_0xc9e0('0x104'));if(!this[_0xc9e0('0x6f')](_0x237009[_0xc9e0('0x105')])){ut[_0xc9e0('0x35')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x237009[_0xc9e0('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xc9e0('0x106')};}}if(!ut[_0xc9e0('0x6e')](_0x237009[_0xc9e0('0x3e')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x237009[_0xc9e0('0x2a')]+_0xc9e0('0x107'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x237009[_0xc9e0('0x2a')]+_0xc9e0('0x107')};}return{'isValid':!![],'message':_0xc9e0('0x108')};};Preview['prototype'][_0xc9e0('0x109')]=function(_0x1005e7,_0x2d0a67,_0x14ed38,_0x4e6d4f){var _0x400152=this;return new Promise(function(_0x221260,_0x4cf948){var _0x38125b=_0x1005e7['uniqueid'];var _0x584d17=_0x400152[_0xc9e0('0x6f')](_0x2d0a67[_0xc9e0('0x10a')])?util[_0xc9e0('0x28')](_0xc9e0('0x10b'),_0x2d0a67[_0xc9e0('0x10a')]['name'],_[_0xc9e0('0x41')](_0x2d0a67[_0xc9e0('0x10c')])?'':_0x2d0a67[_0xc9e0('0x10c')]['trim']()||'',_0x2d0a67[_0xc9e0('0x10d')]>0x0?_0x14ed38[_0xc9e0('0xe6')][_0xc9e0('0x10e')](_0x2d0a67['dialCutDigit']):_0x14ed38['phone']):util['format'](_0xc9e0('0x10b'),_[_0xc9e0('0x41')](_0x2d0a67['TrunkBackup'])?_0x2d0a67[_0xc9e0('0x10a')][_0xc9e0('0x2a')]:_0x2d0a67[_0xc9e0('0x105')][_0xc9e0('0x2a')],_[_0xc9e0('0x41')](_0x2d0a67[_0xc9e0('0x10c')])?'':_0x2d0a67['dialPrefix'][_0xc9e0('0x10f')]()||'',_0x2d0a67[_0xc9e0('0x10d')]>0x0?_0x14ed38[_0xc9e0('0xe6')][_0xc9e0('0x10e')](_0x2d0a67['dialCutDigit']):_0x14ed38[_0xc9e0('0xe6')]);var _0xd88812=_0x400152['isTrunkReachable'](_0x2d0a67[_0xc9e0('0x10a')])?ut[_0xc9e0('0x110')](_0x2d0a67['Trunk'][_0xc9e0('0x111')],_0x2d0a67[_0xc9e0('0x112')],_0x2d0a67[_0xc9e0('0x113')]>0x0?ut['getCallerIdRandom'](_0x2d0a67[_0xc9e0('0x114')],_0x2d0a67[_0xc9e0('0x113')]):_0x2d0a67['dialOriginateCallerIdNumber']):ut[_0xc9e0('0x110')](_[_0xc9e0('0x41')](_0x2d0a67['TrunkBackup'])?_0x2d0a67[_0xc9e0('0x10a')]['callerid']:_0x2d0a67[_0xc9e0('0x105')][_0xc9e0('0x111')],_0x2d0a67['dialOriginateCallerIdName'],_0x2d0a67[_0xc9e0('0x113')]>0x0?ut[_0xc9e0('0x115')](_0x2d0a67[_0xc9e0('0x114')],_0x2d0a67['dialRandomLastDigitCallerIdNumber']):_0x2d0a67['dialOriginateCallerIdNumber']);if(_0xd88812){_0x1005e7[_0xc9e0('0x116')]=ut[_0xc9e0('0x117')](_0xd88812);_0x1005e7[_0xc9e0('0x118')]=ut[_0xc9e0('0x119')](_0xd88812);}var _0x30f293=ut[_0xc9e0('0x11a')](_0x2d0a67,_0x14ed38,_0x584d17,_0xd88812,_0x38125b,_0x1005e7);var _0xcfb1e6=utils[_0xc9e0('0x11b')](_0x14ed38['Contact']);Object[_0xc9e0('0x11c')](_0x30f293,_0xcfb1e6);_[_0xc9e0('0x11d')](_0x1005e7,ut['toLowerVariables'](_0x30f293));_0x1005e7[_0xc9e0('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d0a67[_0xc9e0('0x11e')]=_0x30f293;var _0x5169ab=ut[_0xc9e0('0x11f')](_0x1005e7,_0x2d0a67,_0x30f293,_0x1005e7[_0xc9e0('0x86')],_0x4e6d4f);return ami[_0xc9e0('0x120')](_0x5169ab)[_0xc9e0('0x54')](function(_0x268693){_0x2d0a67[_0xc9e0('0x2d')]+=0x1;logger[_0xc9e0('0x25')]('[originated][increment]',_0x38125b,_0xc9e0('0x9e'),_0x2d0a67['name'],_0xc9e0('0x44'),_0x2d0a67[_0xc9e0('0x2d')]);_0x221260(_0x268693);})[_0xc9e0('0x4a')](function(_0x12cd25){ut[_0xc9e0('0xdc')](_0x1005e7,0xe,_0xc9e0('0x121'));rpcDb[_0xc9e0('0xe0')](_0x1005e7,_0xc9e0('0x122'));_0x4cf948(_0x12cd25);});});};Preview[_0xc9e0('0x37')][_0xc9e0('0x1c')]=function(_0xc718ae){if(this['actions'][_0xc718ae[_0xc9e0('0x123')]]){this['actions'][_0xc718ae[_0xc9e0('0x123')]][_0xc9e0('0x49')]=_0xc718ae[_0xc9e0('0x49')];}};Preview['prototype'][_0xc9e0('0x16')]=function(_0xcf2164){var _0x521574=this;var _0x1605b2=this[_0xc9e0('0x13')][_0xcf2164[_0xc9e0('0x124')]];if(_0x1605b2){if(_0x1605b2[_0xc9e0('0x125')]&&this[_0xc9e0('0x14')][_0x1605b2[_0xc9e0('0x125')]]){ut[_0xc9e0('0x126')](_0x1605b2,this[_0xc9e0('0x14')][_0x1605b2['lookAgent']]['name'],this[_0xc9e0('0x14')][_0x1605b2['lookAgent']]['id']);}var _0x6cfa72=_['clone'](_0x1605b2);_0x6cfa72[_0xc9e0('0x8a')]=moment()['format'](_0xc9e0('0x5d'));var _0x49ca05=_0x521574[_0xc9e0('0x11')][_0x1605b2[_0xc9e0('0x43')]];if(ut['isFailure'](_0xcf2164[_0xc9e0('0x127')])){if(_0x1605b2[_0xc9e0('0x85')]){rpcDb[_0xc9e0('0xf8')](_0x1605b2[_0xc9e0('0x87')]);}if(_0x1605b2[_0xc9e0('0x86')]){rpcDb[_0xc9e0('0x5b')](_0x1605b2[_0xc9e0('0x87')]);}ami[_0xc9e0('0x24')](_0xc9e0('0x128'),ut[_0xc9e0('0x77')](_0x1605b2,_0xc9e0('0x129'),this[_0xc9e0('0x11')][_0x1605b2['queue']]));this[_0xc9e0('0xd8')](_0x6cfa72,_0x49ca05,_0xcf2164);}else{_0x1605b2[_0xc9e0('0x5c')]=moment()[_0xc9e0('0x28')](_0xc9e0('0x5d'));ut[_0xc9e0('0xdc')](_0x6cfa72,0x4,_0xc9e0('0x98'));rpcDb[_0xc9e0('0xe0')](_0x6cfa72,_0xc9e0('0x12a'));}}};Preview[_0xc9e0('0x37')][_0xc9e0('0x19')]=function(_0x594090){var _0x5d7103=this[_0xc9e0('0x13')][_0x594090['linkedid']];var _0x24749f;if(_0x5d7103){_0x24749f=this['campaignsPreview'][_0x5d7103[_0xc9e0('0x43')]];logger[_0xc9e0('0x25')](_0xc9e0('0x12b'),_0x594090[_0xc9e0('0x123')],'\x20Queue',_0x24749f[_0xc9e0('0x2a')],'pTalking:\x20',_0x24749f[_0xc9e0('0x2e')]);}if(this[_0xc9e0('0x13')][_0x594090['linkedid']]&&_0x594090[_0xc9e0('0x123')]!==_0x594090[_0xc9e0('0x8d')]){if(_0x594090[_0xc9e0('0x12c')]==='16'&&this[_0xc9e0('0x13')][_0x594090[_0xc9e0('0x123')]]['dialAnswer']){this[_0xc9e0('0x72')](_0x594090,_0x594090[_0xc9e0('0x123')],_0x594090[_0xc9e0('0x12c')]);}else if(this[_0xc9e0('0x13')][_0x594090[_0xc9e0('0x123')]][_0xc9e0('0x45')]){logger[_0xc9e0('0x25')](_0xc9e0('0x12d'),_0x594090[_0xc9e0('0x123')],_0x594090[_0xc9e0('0x12c')],'\x20Queue',_0x24749f[_0xc9e0('0x2a')],_0xc9e0('0x8e'),_0x24749f[_0xc9e0('0x2e')]);this[_0xc9e0('0x72')](_0x594090,_0x594090['linkedid'],_0x594090[_0xc9e0('0x12c')]);}}else if(_0x5d7103&&_[_0xc9e0('0x41')](_0x5d7103[_0xc9e0('0x12e')])&&_0x24749f['dialQueueProject']&&_0x594090[_0xc9e0('0x123')]===_0x594090[_0xc9e0('0x8d')]&&_[_0xc9e0('0x41')](_0x594090[_0xc9e0('0xdb')])&&_0x594090['cause']==='16'&&_0x594090[_0xc9e0('0x12f')]==='6'&&_[_0xc9e0('0xd9')](_0x5d7103[_0xc9e0('0x130')])){if(_0x5d7103[_0xc9e0('0x85')]){rpcDb[_0xc9e0('0xf8')](_0x5d7103['idContact']);}if(_0x5d7103['activeContact']){rpcDb[_0xc9e0('0x5b')](_0x5d7103[_0xc9e0('0x87')]);}_0x594090[_0xc9e0('0xdb')]='22';this[_0xc9e0('0xd8')](_0x5d7103,_0x24749f,_0x594090);}else if(_0x5d7103&&_0x5d7103[_0xc9e0('0x130')]){if(_0x594090[_0xc9e0('0x12c')]==='16'&&this['actions'][_0x594090['linkedid']][_0xc9e0('0x45')]){logger[_0xc9e0('0x25')](_0xc9e0('0x131'),_0x594090['linkedid'],_0x594090['cause'],'\x20Queue',_0x24749f[_0xc9e0('0x2a')],_0xc9e0('0x8e'),_0x24749f[_0xc9e0('0x2e')]);this[_0xc9e0('0x72')](_0x594090,_0x594090['linkedid'],_0x594090[_0xc9e0('0x12c')]);}else if(this['actions'][_0x594090[_0xc9e0('0x123')]]['dialAnswer']){logger[_0xc9e0('0x25')](_0xc9e0('0x12d'),_0x594090[_0xc9e0('0x123')],_0x594090['cause'],_0xc9e0('0x9e'),_0x24749f[_0xc9e0('0x2a')],_0xc9e0('0x8e'),_0x24749f[_0xc9e0('0x2e')]);this[_0xc9e0('0x72')](_0x594090,_0x594090[_0xc9e0('0x123')],_0x594090[_0xc9e0('0x12c')]);}}};Preview[_0xc9e0('0x37')][_0xc9e0('0x1b')]=function(_0x11af2a){if(this['actions'][_0x11af2a[_0xc9e0('0xd7')]]&&_0x11af2a[_0xc9e0('0xd7')]!==_0x11af2a[_0xc9e0('0x132')]){this['callProgressDetectingCustomer'](_0x11af2a,_0x11af2a['destlinkedid'],_0x11af2a[_0xc9e0('0xcc')]);}};Preview[_0xc9e0('0x37')][_0xc9e0('0x133')]=function(_0x1a6f3a){if(this[_0xc9e0('0x13')][_0x1a6f3a[_0xc9e0('0x123')]]&&_0x1a6f3a['linkedid']!==_0x1a6f3a[_0xc9e0('0x8d')]&&!this['actions'][_0x1a6f3a[_0xc9e0('0x123')]][_0xc9e0('0x45')]){if(_0x1a6f3a[_0xc9e0('0x12c')]==='1'){this[_0xc9e0('0x72')](_0x1a6f3a,_0x1a6f3a[_0xc9e0('0x123')],_0x1a6f3a[_0xc9e0('0x12c')]);}}};Preview[_0xc9e0('0x37')]['addVariable']=function(_0x1fbb8d,_0x17c4a9,_0x26557b){if(this[_0xc9e0('0x13')][_0x1fbb8d]){if(_[_0xc9e0('0x41')](this[_0xc9e0('0x13')][_0x1fbb8d][_0xc9e0('0x11e')])){this[_0xc9e0('0x13')][_0x1fbb8d]['variables']={};}this['actions'][_0x1fbb8d][_0xc9e0('0x11e')][_0x17c4a9]=_0x26557b;}};Preview[_0xc9e0('0x37')]['syncVarSet']=function(_0x2b7177){try{if(!_[_0xc9e0('0x41')](_0x2b7177)){if(ut[_0xc9e0('0x134')](_[_0xc9e0('0x135')](_0x2b7177['variable'])[0x0])){this['addVariable'](_0x2b7177['uniqueid'],_['keys'](_0x2b7177['variable'])[0x0],_0x2b7177[_0xc9e0('0x136')]);}}}catch(_0x2d9f14){logger[_0xc9e0('0x137')](_0xc9e0('0x138'),util['inspect'](_0x2d9f14,{'showHidden':![],'depth':null}));}};Preview[_0xc9e0('0x37')]['syncAttendedTransfer']=function(_0x57da8d){if(_0x57da8d){if(this[_0xc9e0('0x13')][_0x57da8d[_0xc9e0('0x139')]]){this[_0xc9e0('0x13')][_0x57da8d[_0xc9e0('0x139')]][_0xc9e0('0x130')]=!![];}}};Preview[_0xc9e0('0x37')]['syncBlindTransfer']=function(_0x31a9aa){if(_0x31a9aa){if(this[_0xc9e0('0x13')][_0x31a9aa['transfererlinkedid']]){this[_0xc9e0('0x13')][_0x31a9aa['transfererlinkedid']][_0xc9e0('0x130')]=!![];}}};module[_0xc9e0('0x13a')]=Preview; \ No newline at end of file +var _0xbee9=['countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlockContact','active','disableContact','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','isFailure','response','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','channelstate','transfer','destuniqueid','addVariable','syncVarSet','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','lodash','uuid','moment','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','stringify','pTalking:\x20','pTalking','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','logger2','[RecallMe]','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbee9,0x1dc));var _0x9bee=function(_0x31b469,_0x104e6d){_0x31b469=_0x31b469-0x0;var _0x456faa=_0xbee9[_0x31b469];return _0x456faa;};'use strict';var util=require(_0x9bee('0x0'));var _=require(_0x9bee('0x1'));var uuid=require(_0x9bee('0x2'));var moment=require(_0x9bee('0x3'));var Redis=require('ioredis');var config=require(_0x9bee('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x9bee('0x5'))(_0x9bee('0x6'));var ami=require('../ami');var rpcDb=require(_0x9bee('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require('./util/util');var utils=require(_0x9bee('0x8'));config[_0x9bee('0x9')]=_['defaults'](config[_0x9bee('0x9')],{'host':_0x9bee('0xa'),'port':0x18eb});var io=require(_0x9bee('0xb'))(new Redis(config[_0x9bee('0x9')]));var Sequence=function(){};Sequence[_0x9bee('0xc')][_0x9bee('0xd')]=function(_0x138b17){this[_0x9bee('0xe')]=this[_0x9bee('0xe')]?this[_0x9bee('0xe')][_0x9bee('0xf')](_0x138b17):_0x138b17();};function Preview(_0x2c677c){this[_0x9bee('0x10')]=new Sequence();this[_0x9bee('0x11')]=_0x2c677c[_0x9bee('0x12')];this[_0x9bee('0x13')]=_0x2c677c[_0x9bee('0x13')];this['actions']={};this[_0x9bee('0x14')]=_0x2c677c['agents'];this[_0x9bee('0x15')]=0x0;ami['on'](_0x9bee('0x16'),this[_0x9bee('0x17')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x19'),this[_0x9bee('0x1a')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1b'),this[_0x9bee('0x1c')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1d'),this[_0x9bee('0x1e')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x1f'),this[_0x9bee('0x20')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x21'),this['syncVarSet'][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x22'),this[_0x9bee('0x23')][_0x9bee('0x18')](this));ami['on'](_0x9bee('0x24'),this[_0x9bee('0x25')]['bind'](this));this['loopCampaigns'](this[_0x9bee('0x11')]);}function emit(_0x3cbae9,_0x4792f5,_0x3b1269){io['to'](_0x3cbae9)[_0x9bee('0x26')](_0x4792f5,_0x3b1269);}function emitVoiceQueueChannelRemove(_0x47f82b){logger[_0x9bee('0x27')](_0x9bee('0x28'),JSON['stringify'](_0x47f82b));emit(util[_0x9bee('0x29')](_0x9bee('0x2a'),_0x47f82b[_0x9bee('0x2b')]),_0x9bee('0x2c'),_0x47f82b);io['emit'](_0x9bee('0x2d'),_0x47f82b);}function notSendMessagesQueue(_0x21db28){if(_0x21db28[_0x9bee('0x2e')]){if(_0x21db28[_0x9bee('0x2f')]===0x0&&_0x21db28['pTalking']===0x0){_0x21db28[_0x9bee('0x2e')]=![];_0x21db28[_0x9bee('0x30')]=0x0;_0x21db28[_0x9bee('0x31')]=0x0;_0x21db28['message']=utils[_0x9bee('0x32')]['INACTIVE'];ut[_0x9bee('0x33')](_0x9bee('0x34'),_0x21db28[_0x9bee('0x2b')]+_0x9bee('0x35'));}else{_0x21db28[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x37')];ut[_0x9bee('0x33')](_0x9bee('0x34'),_0x21db28['name']+'\x20is\x20deactivated');}}}Preview[_0x9bee('0xc')][_0x9bee('0x38')]=function(){var _0x3235bf=this;setInterval(function(){_0x3235bf[_0x9bee('0x39')]();},0x7cf);};Preview[_0x9bee('0xc')][_0x9bee('0x39')]=function(){var _0x31f7d7=this[_0x9bee('0x11')];this[_0x9bee('0x15')]+=0x1;for(var _0x553ba7 in _0x31f7d7){if(_0x31f7d7[_0x9bee('0x3a')](_0x553ba7)&&(_0x31f7d7[_0x553ba7][_0x9bee('0x3b')]===_0x9bee('0x3c')||_0x31f7d7[_0x553ba7][_0x9bee('0x3b')]===_0x9bee('0x3d'))&&_0x31f7d7[_0x553ba7][_0x9bee('0x3e')]===_0x9bee('0x3f')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x9bee('0x40')]();}}if(_0x31f7d7[_0x9bee('0x3a')](_0x553ba7)&&_0x31f7d7[_0x553ba7]['dialMethod']===_0x9bee('0x3c')&&_0x31f7d7[_0x553ba7]['type']===_0x9bee('0x3f')){if(_0x31f7d7[_0x553ba7][_0x9bee('0x41')]){this[_0x9bee('0x42')](_0x31f7d7[_0x553ba7]);if(_0x31f7d7[_0x553ba7][_0x9bee('0x43')])this[_0x9bee('0x44')](_0x31f7d7[_0x553ba7]);}else{notSendMessagesQueue(_0x31f7d7[_0x553ba7]);}}}};Preview[_0x9bee('0xc')][_0x9bee('0x45')]=function(_0x2b6045){var _0x1faffb=this;this[_0x9bee('0x10')][_0x9bee('0xd')](function(){if(!_['isNil'](_0x1faffb['actions'][_0x2b6045])){loggerAction[_0x9bee('0x27')](_0x9bee('0x46'),_0x2b6045,_0x9bee('0x47'),_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x49')],'originated:\x20',JSON[_0x9bee('0x4a')](_0x1faffb[_0x9bee('0x11')][_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x49')]][_0x9bee('0x2f')]),_0x9bee('0x4b'),JSON[_0x9bee('0x4a')](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]][_0x9bee('0x4c')]),JSON['stringify'](_0x1faffb['actions'][_0x2b6045][_0x9bee('0x4d')]),JSON['stringify'](_[_0x9bee('0x4e')](_0x1faffb['actions'][_0x2b6045],['contactId',_0x9bee('0x4f'),'VoiceQueueId',_0x9bee('0x50')])));return ami[_0x9bee('0x51')]({'action':_0x9bee('0x52'),'channel':_0x1faffb[_0x9bee('0x48')][_0x2b6045][_0x9bee('0x53')]})[_0x9bee('0x54')](function(_0x22061c){if(_0x22061c[_0x9bee('0x36')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1faffb[_0x9bee('0x48')][_0x2b6045]){ut[_0x9bee('0x55')](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]],_0x9bee('0x56'));if(_0x1faffb['actions'][_0x2b6045]['dialAnswer']===!![]){ut['decrementTalkink'](_0x1faffb[_0x9bee('0x11')][_0x1faffb['actions'][_0x2b6045]['queue']],'[clearZombieChannel]');ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x2b6045,_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]);}ut[_0x9bee('0x57')](_0x9bee('0x58')+_0x2b6045,_0x1faffb['actions'][_0x2b6045][_0x9bee('0x49')]);delete _0x1faffb[_0x9bee('0x48')][_0x2b6045];}},0x2328);}});}});};Preview[_0x9bee('0xc')][_0x9bee('0x40')]=function(){var _0x45ff98=this;loggerAction[_0x9bee('0x27')](_0x9bee('0x59'),_['size'](this[_0x9bee('0x48')]));for(var _0x16b56e in this['actions']){if(_0x45ff98['actions'][_0x9bee('0x3a')](_0x16b56e)){_0x45ff98[_0x9bee('0x45')](_0x16b56e);}}};Preview['prototype'][_0x9bee('0x44')]=function(_0x3d0fc6){var _0x51a8cb=this;rpcDb[_0x9bee('0x5a')](_0x3d0fc6['id'],ut[_0x9bee('0x5b')](this['agents']))[_0x9bee('0x5c')](function(_0x441531){if(!_[_0x9bee('0x5d')](_0x441531)){for(var _0x578566=0x0;_0x578566<_0x441531[_0x9bee('0x5e')];_0x578566+=0x1){if(ut[_0x9bee('0x5f')](_0x441531[_0x578566][_0x9bee('0x60')])<_0x3d0fc6['dialRecallMeTimeout']*0x3c){if(_0x441531[_0x578566][_0x9bee('0x61')]&&!_0x441531[_0x578566][_0x9bee('0x61')]['voicePause']){_0x51a8cb['run'](_0x441531[_0x578566]['id'])['then'](ut[_0x9bee('0x62')](_0x9bee('0x63')))['catch'](ut[_0x9bee('0x62')](_0x9bee('0x63')));}else{rpcDb['disableContact'](_0x441531[_0x578566]['id']);}}else{var _0x24e7ad=new Action(_0x441531[_0x578566],_0x3d0fc6);_0x24e7ad[_0x9bee('0x64')]=moment()[_0x9bee('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d0fc6[_0x9bee('0x65')]+=0x1;ut[_0x9bee('0x66')](_0x24e7ad,0x17,'RecallInQueue');if(_0x3d0fc6[_0x9bee('0x67')]){rpcDb[_0x9bee('0x68')](ut[_0x9bee('0x69')](_0x441531[_0x578566]));rpcDb['createCustomerHistory'](_0x24e7ad,_0x9bee('0x6a'));}else{ut[_0x9bee('0x66')](_0x24e7ad,0x16,_0x9bee('0x6b'));rpcDb[_0x9bee('0x6c')](_0x24e7ad,_0x9bee('0x6d'));rpcDb[_0x9bee('0x6e')](_0x24e7ad,_0x9bee('0x6d'));}}}}})[_0x9bee('0x54')](ut[_0x9bee('0x62')](_0x9bee('0x6f')));};Preview[_0x9bee('0xc')][_0x9bee('0x42')]=function(_0x4134ac){_0x4134ac['sendMessageOneNotActive']=!![];if(ut[_0x9bee('0x70')](_0x4134ac[_0x9bee('0x71')])){_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x9bee('0x72')](_0x4134ac[_0x9bee('0x41')])){_0x4134ac[_0x9bee('0x36')]=utils['CAMPAIGN_STATUS'][_0x9bee('0x73')];}else if(!this[_0x9bee('0x74')](_0x4134ac['Trunk'])){if(!this['isTrunkReachable'](_0x4134ac['TrunkBackup'])){_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x75')];}else{_0x4134ac[_0x9bee('0x36')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x4134ac[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x76')];}};Preview[_0x9bee('0xc')]['callProgressDetectingCustomer']=function(_0x47b2e8,_0x193907,_0x1636e1){var _0x3e1fbd=this;var _0x39a2c1=this[_0x9bee('0x48')][_0x193907];var _0x2d735e=this[_0x9bee('0x11')][_0x39a2c1['queue']];var _0x158d7d;var _0x221e32=![];var _0x446475=0x2;var _0x181df1=0x3;if(_0x2d735e){switch(_0x1636e1){case'1':_0x2d735e[_0x9bee('0x77')]+=0x1;_0x39a2c1[_0x9bee('0x78')]+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x0,_0x9bee('0x7a'));ami[_0x9bee('0x26')](_0x9bee('0x7b'),ut['buildObj'](_0x39a2c1,_0x9bee('0x7c')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0x7d'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'0',_0x2d735e)[_0x9bee('0x5c')](function(_0x223087){_0x221e32=_0x223087[_0x9bee('0x7e')]==0x1;_0x446475=_0x2d735e[_0x9bee('0x7f')];_0x181df1=_0x2d735e[_0x9bee('0x80')];if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0x84'));}else{if(_0x39a2c1['countnosuchnumberretry']>=_0x2d735e[_0x9bee('0x85')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x9bee('0x86')](_0x39a2c1,'countnosuchnumberretry',_0x2d735e[_0x9bee('0x7f')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];}else{_0x39a2c1['countnosuchnumberretry']++;logger[_0x9bee('0x27')](_0x9bee('0x8a'),_0x39a2c1[_0x9bee('0x78')]);logger[_0x9bee('0x27')]('id',_0x39a2c1[_0x9bee('0x8b')]);_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1['idContact'],'field':{'countnosuchnumberretry':_0x39a2c1[_0x9bee('0x78')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0x8e'):var _0x109fb2=moment()[_0x9bee('0x29')](_0x9bee('0x8f'));_0x39a2c1[_0x9bee('0x90')]=_0x109fb2;_0x39a2c1['answertime']=_0x109fb2;_0x39a2c1[_0x9bee('0x4d')]=!![];_0x2d735e[_0x9bee('0x4c')]+=0x1;logger[_0x9bee('0x27')](_0x9bee('0x91'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e['name'],_0x9bee('0x4b'),_0x2d735e[_0x9bee('0x4c')]);ami['emit'](_0x9bee('0x94'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0x96'),this[_0x9bee('0x11')][_0x39a2c1[_0x9bee('0x49')]]));if(_0x2d735e[_0x9bee('0x97')]){ami['emit'](_0x9bee('0x98'),ut[_0x9bee('0x99')](_0x39a2c1));}break;case'16':ami[_0x9bee('0x26')]('custom:agentcomplete',ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0x9a'),this['campaignsPreview'][_0x39a2c1['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x39a2c1,_0x9bee('0x9a')));_0x2d735e[_0x9bee('0x9b')]+=0x1;_0x2d735e[_0x9bee('0x9c')]+=0x1;_0x2d735e[_0x9bee('0x9d')]+=0x1;ut['decrementTalkink'](_0x2d735e,_0x9bee('0x9e'));_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x4,_0x9bee('0xa0'));rpcDb['createCustomerHistory'](_0x39a2c1,_0x9bee('0xa1'));rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x39a2c1);_0x2d735e[_0x9bee('0xa2')]+=_0x39a2c1[_0x9bee('0xa3')];_0x2d735e[_0x9bee('0xa4')]+=_0x39a2c1[_0x9bee('0xa3')];logger[_0x9bee('0x27')](_0x9bee('0xa5'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e[_0x9bee('0x2b')],'pTalking:\x20',_0x2d735e['pTalking']);delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];break;case _0x9bee('0xa6'):_0x2d735e[_0x9bee('0xa7')]+=0x1;_0x39a2c1[_0x9bee('0xa8')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x5,'Busy');_0x446475=_0x2d735e['dialBusyRetryFrequency'];_0x181df1=_0x2d735e['callAdditionalPhoneAfterMin'];ami[_0x9bee('0x26')](_0x9bee('0xa9'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0xaa')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xab'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'5',_0x2d735e)[_0x9bee('0x5c')](function(_0x18792a){_0x221e32=_0x18792a[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x39a2c1[_0x9bee('0xa8')]>=_0x2d735e[_0x9bee('0xad')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,'countbusyretry',_0x2d735e[_0x9bee('0xaf')]),_0x39a2c1['unlockAgent'],_0x39a2c1['activeContact']);}}}else{_0x39a2c1[_0x9bee('0xa8')]++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countbusyretry':_0x39a2c1[_0x9bee('0xa8')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)['then'](function(){});});}});break;case _0x9bee('0xb0'):_0x2d735e[_0x9bee('0xb1')]+=0x1;_0x39a2c1['countnoanswerretry']+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x3,'NoAnswer');_0x446475=_0x2d735e[_0x9bee('0xb2')];_0x181df1=_0x2d735e[_0x9bee('0x80')];var _0x3617b4=ut[_0x9bee('0xb3')](_0x39a2c1,_0x2d735e);ami['emit'](_0x9bee('0xb4'),_0x3617b4);rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xb5'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'3',_0x2d735e)['then'](function(_0x301d22){_0x221e32=_0x301d22[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xb6'));}else{if(_0x39a2c1[_0x9bee('0xb7')]>=_0x2d735e[_0x9bee('0xb8')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xb5'));}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,_0x9bee('0xb7'),_0x2d735e['dialNoAnswerRetryFrequency']),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1['activeContact']);}}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countnoanswerretry':_0x39a2c1['countnoanswerretry']}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)['then'](function(){});});}});break;case'CONGESTION':_0x2d735e[_0x9bee('0xb9')]+=0x1;_0x39a2c1['countcongestionretry']+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x8,_0x9bee('0xba'));_0x446475=_0x2d735e[_0x9bee('0xbb')];_0x181df1=_0x2d735e[_0x9bee('0x80')];ami[_0x9bee('0x26')](_0x9bee('0xbc'),ut[_0x9bee('0x95')](_0x39a2c1,'congestion'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xbd'));_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'8',_0x2d735e)[_0x9bee('0x5c')](function(_0x36c06e){_0x221e32=_0x36c06e[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xbe'));}else{if(_0x39a2c1[_0x9bee('0xbf')]>=_0x2d735e[_0x9bee('0xc0')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x39a2c1,'countcongestionretry',_0x2d735e[_0x9bee('0xaf')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}}else{_0x39a2c1['countcongestionretry']++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countcongestionretry':_0x39a2c1[_0x9bee('0xbf')]}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0xc1'):_0x2d735e['outboundRejectCallsDay']+=0x1;_0x39a2c1[_0x9bee('0xc2')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x14,'AgentReject');_0x446475=_0x2d735e[_0x9bee('0xc3')];_0x181df1=_0x2d735e[_0x9bee('0x80')];ami[_0x9bee('0x26')]('custom:agentreject',ut[_0x9bee('0x95')](_0x39a2c1,'agentreject'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xc4'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'20',_0x2d735e)[_0x9bee('0x5c')](function(_0x275870){_0x221e32=_0x275870['additional']==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0x14,_0x9bee('0xc5'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xc6'));}else{if(_0x39a2c1['countagentrejectretry']>=_0x2d735e[_0x9bee('0xc7')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xc6'));}else{rpcDb[_0x9bee('0xae')](ut[_0x9bee('0x86')](_0x39a2c1,'countagentrejectretry',_0x2d735e[_0x9bee('0xc3')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1['activeContact']);}}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})['then'](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case _0x9bee('0xc8'):_0x2d735e[_0x9bee('0xc9')]+=0x1;_0x39a2c1[_0x9bee('0xca')]+=0x1;_0x39a2c1['countglobal']=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0xb,_0x9bee('0xcb'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xcc'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'11',_0x2d735e)[_0x9bee('0x5c')](function(_0x191711){_0x221e32=_0x191711[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xcc'));}else{if(_0x39a2c1[_0x9bee('0xcd')]>=_0x2d735e[_0x9bee('0xce')]){rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x9bee('0x86')](_0x39a2c1,_0x9bee('0xca'),_0x2d735e[_0x9bee('0xcf')]),_0x39a2c1[_0x9bee('0x87')],_0x39a2c1[_0x9bee('0x88')]);}}}else{_0x39a2c1[_0x9bee('0xb7')]++;_0x3e1fbd['incrementPreviewCounters']({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})['then'](function(){_0x3e1fbd['swapAdditionalPhones'](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});break;case'18':_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1['countmachineretry']+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut['logCustomer'](_0x39a2c1,0x12,_0x47b2e8[_0x9bee('0xd1')]||_0x47b2e8[_0x9bee('0xd2')]);ami[_0x9bee('0x26')](_0x9bee('0xd3'),ut[_0x9bee('0x95')](_0x39a2c1,'amd'));rpcDb[_0x9bee('0x6c')](_0x39a2c1,'[callProgressDetectingCustomer][hangupInAMD]');_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'18',_0x2d735e)[_0x9bee('0x5c')](function(_0x1ac89b){_0x221e32=_0x1ac89b[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e['dialGlobalMaxRetry']){_0x158d7d=ut['cloneAction'](_0x39a2c1,0x12,_0x9bee('0x83'));rpcDb['createCustomerFinal'](_0x158d7d,_0x9bee('0xd4'));}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xd4'));}}else{_0x39a2c1['countnoanswerretry']++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1['idContact'],'field':{'countnoanswerretry':_0x39a2c1[_0x9bee('0xb7')]}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];break;case'19':_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0x13,_0x47b2e8[_0x9bee('0xd1')]||_0x47b2e8[_0x9bee('0xd2')]);ami[_0x9bee('0x26')](_0x9bee('0xd3'),ut[_0x9bee('0x95')](_0x39a2c1,_0x9bee('0xd5')));rpcDb[_0x9bee('0x6c')](_0x39a2c1,'[callProgressDetectingCustomer][machine]');_0x3e1fbd['verifyAdditionalPhones'](_0x39a2c1,'18',_0x2d735e)['then'](function(_0x1413be){_0x221e32=_0x1413be['additional']==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut[_0x9bee('0x82')](_0x39a2c1,0xf,'Global');rpcDb[_0x9bee('0x6e')](_0x158d7d,_0x9bee('0xd6'));}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xd6'));}}else{_0x39a2c1[_0x9bee('0xb7')]++;_0x3e1fbd[_0x9bee('0x8c')]({'id':_0x39a2c1[_0x9bee('0x8b')],'field':{'countnoanswerretry':_0x39a2c1['countnoanswerretry']}})[_0x9bee('0x5c')](function(){_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});});}});delete this['actions'][_0x47b2e8[_0x9bee('0x89')]];break;default:if(_0x39a2c1[_0x9bee('0x4d')]){ut['decrementTalkink'](_0x2d735e,_0x9bee('0xd7'));ut[_0x9bee('0x57')](_0x9bee('0xd8')+_0x2d735e[_0x9bee('0x2b')],_0x47b2e8);}_0x2d735e[_0x9bee('0xd0')]+=0x1;_0x39a2c1[_0x9bee('0x9f')]=ut[_0x9bee('0x79')](_0x39a2c1);ut[_0x9bee('0x66')](_0x39a2c1,0xc,_0x47b2e8['cause-txt']||_0x47b2e8[_0x9bee('0xd2')]);_0x446475=_0x2d735e[_0x9bee('0xc3')];_0x181df1=_0x2d735e[_0x9bee('0x80')];rpcDb[_0x9bee('0x6c')](_0x39a2c1,_0x9bee('0xd9'));_0x3e1fbd[_0x9bee('0xac')](_0x39a2c1,'20',_0x2d735e)[_0x9bee('0x5c')](function(_0x185dcd){_0x221e32=_0x185dcd[_0x9bee('0x7e')]==0x1;if(!_0x221e32){if(ut[_0x9bee('0x79')](_0x39a2c1)>=_0x2d735e[_0x9bee('0x81')]){_0x158d7d=ut['cloneAction'](_0x39a2c1,0xf,_0x9bee('0x83'));rpcDb[_0x9bee('0x6e')](_0x158d7d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9bee('0x6e')](_0x39a2c1,_0x9bee('0xda'));}delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];}else{_0x3e1fbd[_0x9bee('0x8d')](_0x39a2c1,_0x446475,_0x181df1)[_0x9bee('0x5c')](function(){});}});}if(!(_0x39a2c1['dialAnswer']&&_0x1636e1==='16')){ut[_0x9bee('0x55')](_0x2d735e,'[callProgressDetectingCustomer]');logger[_0x9bee('0x27')](_0x9bee('0xdb'),_0x39a2c1[_0x9bee('0x92')],_0x9bee('0x93'),_0x2d735e[_0x9bee('0x2b')],_0x9bee('0xdc'),_0x2d735e['originated']);}if(_0x1636e1!=='ANSWER'){delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0x89')]];delete this[_0x9bee('0x48')][_0x47b2e8[_0x9bee('0xdd')]];}_0x2d735e['queueSummaryCountersUpdated']=!![];}};Preview[_0x9bee('0xc')][_0x9bee('0xde')]=function(_0x1eccd9,_0x185497,_0x26d080){if(_[_0x9bee('0xdf')](_0x185497)&&_0x9bee('0xe0')!==typeof _0x185497){return;}if(_[_0x9bee('0xdf')](_0x26d080)&&_0x9bee('0xe0')!==typeof _0x26d080){return;}switch(_0x26d080[_0x9bee('0xe1')]){case'0':ut['logAgent'](_0x1eccd9,0x0,_0x9bee('0x7a'));rpcDb[_0x9bee('0xe2')](_0x1eccd9,_0x9bee('0xe3'));break;case'3':ut[_0x9bee('0xe4')](_0x1eccd9,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x1eccd9,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x9bee('0xe4')](_0x1eccd9,0x5,_0x9bee('0xe5'));rpcDb[_0x9bee('0xe2')](_0x1eccd9,_0x9bee('0xe6'));break;case'8':ut[_0x9bee('0xe4')](_0x1eccd9,0x8,_0x9bee('0xba'));rpcDb['createAgentHistory'](_0x1eccd9,_0x9bee('0xe7'));break;case'22':ut[_0x9bee('0xe4')](_0x1eccd9,0x16,'AnswerAGI');rpcDb[_0x9bee('0xe2')](_0x1eccd9,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x9bee('0xe4')](_0x1eccd9,0xc,_0x26d080[_0x9bee('0xe1')]);rpcDb['createAgentHistory'](_0x1eccd9,_0x9bee('0xe7'));}ut['updateOriginated'](_0x185497,'[callProgressDetectingAgent]');logger[_0x9bee('0x27')](_0x9bee('0xe8'),_0x1eccd9[_0x9bee('0x92')],_0x9bee('0x93'),_0x185497[_0x9bee('0x2b')],'originated:\x20',_0x185497['originated']);delete this[_0x9bee('0x48')][_0x1eccd9[_0x9bee('0x92')]];};Preview[_0x9bee('0xc')]['verifyAdditionalPhones']=function(_0x2b6cf3,_0x87e675,_0x51f00b){return cmHopperAdditionalPhone[_0x9bee('0xac')](_0x2b6cf3,_0x87e675,_0x51f00b)[_0x9bee('0x54')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x9bee('0xc')][_0x9bee('0x8d')]=function(_0x568c26,_0x32f4ed,_0x47b071){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x568c26,_0x32f4ed,_0x47b071)['catch'](logger['info'](_0x9bee('0xe9')));};Preview[_0x9bee('0xc')][_0x9bee('0x8c')]=function(_0x1d8102){return Promise[_0x9bee('0xea')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1d8102))['catch'](logger[_0x9bee('0x27')](_0x9bee('0xeb')));};Preview[_0x9bee('0xc')]['checkInBlack']=function(_0x23c821,_0x3b5523,_0x1415fe,_0x2d4357,_0x55ff31){var _0x30852e=this;return new Promise(function(_0x429c52,_0x3e32cd){if(_['isNil'](_0x3b5523)||_['isNil'](_0x3b5523['Contact'])||_['isNil'](_0x3b5523[_0x9bee('0xec')])||_[_0x9bee('0x5d')](_0x3b5523[_0x9bee('0xed')])){_0x3e32cd(ut[_0x9bee('0x36')]('Contact\x20is\x20undefined',_0x2d4357,_0x55ff31));return;}var _0x1af863=uuid['v4']();var _0x2c80dd=_0x30852e[_0x9bee('0x11')][_0x3b5523[_0x9bee('0x47')][_0x9bee('0x2b')]];var _0x651637=_0x1415fe?_0x30852e[_0x9bee('0x14')][_0x1415fe]['id']:undefined;_0x30852e['actions'][_0x1af863]=new Action(_0x3b5523,_0x2c80dd,_0x1af863,_0x1415fe,_0x651637);var _0x4693ac=_0x30852e[_0x9bee('0x48')][_0x1af863];_0x4693ac[_0x9bee('0x87')]=_0x2d4357;_0x4693ac['activeContact']=_0x55ff31;_0x4693ac[_0x9bee('0xee')]=_0x1415fe;if(_[_0x9bee('0xef')](_0x23c821)){_0x30852e[_0x9bee('0xf0')](_0x4693ac,_0x2c80dd,_0x3b5523,_0x1415fe)[_0x9bee('0x5c')](function(_0x5ee58b){logger[_0x9bee('0x27')](_0x9bee('0xf1'),'Queue:\x20'+_0x4693ac[_0x9bee('0x49')]+_0x9bee('0xf2')+_0x4693ac[_0x9bee('0x8b')],JSON[_0x9bee('0x4a')](_0x5ee58b));ami[_0x9bee('0x26')](_0x9bee('0xf3'),ut[_0x9bee('0x95')](_0x4693ac,'called',_0x30852e[_0x9bee('0x11')][_0x4693ac['queue']]));_0x429c52(ut[_0x9bee('0x36')](_0x9bee('0xf4')));})[_0x9bee('0x54')](function(_0x31168f){ut[_0x9bee('0x33')]('[Preview][execCall][failure]',_0x31168f);_0x3e32cd(ut['message'](_0x9bee('0xf5'),_0x2d4357,_0x55ff31));});}else{_0x2c80dd['outboundBlacklistCallsDay']+=0x1;ut[_0x9bee('0xf6')](_0x4693ac);rpcDb[_0x9bee('0xf7')](_0x4693ac,_0x9bee('0xf8'));delete _0x30852e[_0x9bee('0x48')][_0x1af863];_0x3e32cd(ut[_0x9bee('0x36')](_0x9bee('0xf9'),_0x2d4357,_0x55ff31));}});};Preview[_0x9bee('0xc')][_0x9bee('0x74')]=function(_0x2e9663){return!_[_0x9bee('0x5d')](_0x2e9663)&&!_[_0x9bee('0x5d')](_0x2e9663[_0x9bee('0x2b')])&&!_[_0x9bee('0x5d')](_0x2e9663['active'])&&_0x2e9663['active']&&!_[_0x9bee('0x5d')](this[_0x9bee('0x13')][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])])&&!_[_0x9bee('0x5d')](this[_0x9bee('0x13')][util['format'](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])]['status'])&&(this['trunks'][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])][_0x9bee('0x52')]==='reachable'||this['trunks'][util[_0x9bee('0x29')](_0x9bee('0xfa'),_0x2e9663[_0x9bee('0x2b')])][_0x9bee('0x52')]===_0x9bee('0xfb'));};Preview['prototype']['run']=function(_0x187eb6,_0x153f71){return this[_0x9bee('0xfc')](_0x187eb6,_0x153f71)['then'](function(_0x2e1bd0){return _[_0x9bee('0x4e')](_0x2e1bd0,[_0x9bee('0x36')]);})['catch'](function(_0x122974){if(_0x122974['unlock']){rpcDb[_0x9bee('0xfd')](_0x187eb6);}if(_0x122974[_0x9bee('0xfe')]){rpcDb[_0x9bee('0xff')](_0x187eb6);}throw _[_0x9bee('0x4e')](_0x122974,[_0x9bee('0x36')]);});};Preview[_0x9bee('0xc')][_0x9bee('0xfc')]=function(_0xef560a,_0x2b536e){var _0x229225=this;var _0x49557b,_0x2b61b5;return rpcDb['getContactPreview'](_0xef560a)[_0x9bee('0x5c')](function(_0x165b12){if(!_['isNil'](_0x165b12[0x0])){_0x2b61b5=_0x165b12[0x0][_0x9bee('0x100')]?![]:!![];_0x49557b=_0x165b12[0x0][_0x9bee('0x100')]?!![]:![];_0x49557b=_0x2b536e?!![]:_0x49557b;}var _0x6e5a34=_0x229225[_0x9bee('0x101')](_0x165b12);if(_0x6e5a34[_0x9bee('0x102')]){rpcDb[_0x9bee('0x103')](_[_0x9bee('0x4e')](_0x165b12[0x0],['VoiceQueueId',_0x9bee('0xec')]))[_0x9bee('0x5c')](function(_0x5ee4e9){_0x229225[_0x9bee('0x104')](_0x5ee4e9,_0x165b12[0x0],_0x2b536e,_0x2b61b5,_0x49557b)[_0x9bee('0x5c')](function(_0x2ba7bf){return _0x2ba7bf;})['catch'](function(_0x2d7e2f){throw _0x2d7e2f;});})['catch'](function(_0x1c84cf){ut[_0x9bee('0x33')](_0x9bee('0x105'),_0x1c84cf);throw ut['message'](_0x9bee('0x106'),_0x2b61b5,_0x49557b);});}else{throw ut[_0x9bee('0x36')](_0x6e5a34[_0x9bee('0x36')],_0x2b61b5,_0x49557b);}})[_0x9bee('0x54')](function(_0x4fcd84){ut['logger'](_0x9bee('0x107'),_0x4fcd84);throw ut['message'](_0x9bee('0x106'),![],!![]);});};Preview[_0x9bee('0xc')]['validateContact']=function(_0x1dac2f){if(_[_0x9bee('0x5d')](_0x1dac2f)||_[_0x9bee('0xef')](_0x1dac2f)||!_[_0x9bee('0x5d')](_0x1dac2f[0x0]['Agent'])&&_[_0x9bee('0x5d')](_0x1dac2f[0x0]['Agent']['name'])){ut[_0x9bee('0x33')](_0x9bee('0x108'),_0x1dac2f);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3f7289=this[_0x9bee('0x11')][_0x1dac2f[0x0][_0x9bee('0x47')][_0x9bee('0x2b')]];_0x3f7289[_0x9bee('0x36')]=utils[_0x9bee('0x32')][_0x9bee('0x76')];if(_[_0x9bee('0x5d')](_0x3f7289)){ut['logger'](_0x9bee('0x109'),_0x3f7289);return{'isValid':![],'message':_0x9bee('0x10a')};}if(!this[_0x9bee('0x74')](_0x3f7289[_0x9bee('0x10b')])){ut[_0x9bee('0x33')](_0x9bee('0x10c'),'campaign\x20Name:\x20'+_0x3f7289['name']+_0x9bee('0x10d'));if(!this[_0x9bee('0x74')](_0x3f7289[_0x9bee('0x10e')])){ut['logger'](_0x9bee('0x10c'),_0x3f7289[_0x9bee('0x2b')]+_0x9bee('0x10f'));return{'isValid':![],'message':_0x9bee('0x110')};}}if(!ut[_0x9bee('0x72')](_0x3f7289[_0x9bee('0x41')])){ut[_0x9bee('0x33')]('[Preview][validateContact][Campaign\x20Active]',_0x3f7289['name']+_0x9bee('0x111'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3f7289['name']+_0x9bee('0x111')};}return{'isValid':!![],'message':_0x9bee('0x112')};};Preview['prototype'][_0x9bee('0xf0')]=function(_0x5057fb,_0x10fb80,_0xcd393a,_0x1335b6){var _0xef4c6=this;return new Promise(function(_0x44057c,_0x228d59){var _0x47175a=_0x5057fb['uniqueid'];var _0x582bfe=_0xef4c6['isTrunkReachable'](_0x10fb80['Trunk'])?util[_0x9bee('0x29')](_0x9bee('0x113'),_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x2b')],_[_0x9bee('0x5d')](_0x10fb80[_0x9bee('0x114')])?'':_0x10fb80[_0x9bee('0x114')]['trim']()||'',_0x10fb80['dialCutDigit']>0x0?_0xcd393a[_0x9bee('0xec')][_0x9bee('0x115')](_0x10fb80['dialCutDigit']):_0xcd393a[_0x9bee('0xec')]):util[_0x9bee('0x29')](_0x9bee('0x113'),_['isNil'](_0x10fb80[_0x9bee('0x10e')])?_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x2b')]:_0x10fb80[_0x9bee('0x10e')][_0x9bee('0x2b')],_[_0x9bee('0x5d')](_0x10fb80[_0x9bee('0x114')])?'':_0x10fb80[_0x9bee('0x114')][_0x9bee('0x116')]()||'',_0x10fb80['dialCutDigit']>0x0?_0xcd393a[_0x9bee('0xec')][_0x9bee('0x115')](_0x10fb80[_0x9bee('0x117')]):_0xcd393a[_0x9bee('0xec')]);var _0x3eb6f9=_0xef4c6[_0x9bee('0x74')](_0x10fb80[_0x9bee('0x10b')])?ut[_0x9bee('0x118')](_0x10fb80[_0x9bee('0x10b')]['callerid'],_0x10fb80[_0x9bee('0x119')],_0x10fb80[_0x9bee('0x11a')]>0x0?ut[_0x9bee('0x11b')](_0x10fb80[_0x9bee('0x11c')],_0x10fb80['dialRandomLastDigitCallerIdNumber']):_0x10fb80[_0x9bee('0x11c')]):ut['getCallerId'](_['isNil'](_0x10fb80[_0x9bee('0x10e')])?_0x10fb80[_0x9bee('0x10b')][_0x9bee('0x11d')]:_0x10fb80[_0x9bee('0x10e')]['callerid'],_0x10fb80[_0x9bee('0x119')],_0x10fb80[_0x9bee('0x11a')]>0x0?ut[_0x9bee('0x11b')](_0x10fb80[_0x9bee('0x11c')],_0x10fb80[_0x9bee('0x11a')]):_0x10fb80['dialOriginateCallerIdNumber']);if(_0x3eb6f9){_0x5057fb[_0x9bee('0x11e')]=ut[_0x9bee('0x11f')](_0x3eb6f9);_0x5057fb[_0x9bee('0x120')]=ut[_0x9bee('0x121')](_0x3eb6f9);}var _0x29dab7=ut[_0x9bee('0x122')](_0x10fb80,_0xcd393a,_0x582bfe,_0x3eb6f9,_0x47175a,_0x5057fb);var _0x52f951=utils[_0x9bee('0x123')](_0xcd393a['Contact']);Object[_0x9bee('0x124')](_0x29dab7,_0x52f951);_[_0x9bee('0x125')](_0x5057fb,ut[_0x9bee('0x126')](_0x29dab7));_0x5057fb[_0x9bee('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x10fb80[_0x9bee('0x127')]=_0x29dab7;var _0x1f6e54=ut[_0x9bee('0x128')](_0x5057fb,_0x10fb80,_0x29dab7,_0x5057fb[_0x9bee('0x88')],_0x1335b6);return ami[_0x9bee('0x51')](_0x1f6e54)[_0x9bee('0x5c')](function(_0x1a89e3){_0x10fb80[_0x9bee('0x2f')]+=0x1;logger[_0x9bee('0x27')](_0x9bee('0x129'),_0x47175a,_0x9bee('0x93'),_0x10fb80[_0x9bee('0x2b')],_0x9bee('0xdc'),_0x10fb80['originated']);_0x44057c(_0x1a89e3);})[_0x9bee('0x54')](function(_0x9b645a){ut[_0x9bee('0xe4')](_0x5057fb,0xe,_0x9bee('0x12a'));rpcDb[_0x9bee('0xe2')](_0x5057fb,_0x9bee('0x12b'));_0x228d59(_0x9b645a);});});};Preview[_0x9bee('0xc')][_0x9bee('0x20')]=function(_0x99fb13){if(this[_0x9bee('0x48')][_0x99fb13[_0x9bee('0x89')]]){this['actions'][_0x99fb13[_0x9bee('0x89')]][_0x9bee('0x53')]=_0x99fb13[_0x9bee('0x53')];}};Preview[_0x9bee('0xc')][_0x9bee('0x17')]=function(_0x34c249){var _0x579844=this;var _0x5adeac=this[_0x9bee('0x48')][_0x34c249['actionid']];if(_0x5adeac){if(_0x5adeac[_0x9bee('0xee')]&&this[_0x9bee('0x14')][_0x5adeac[_0x9bee('0xee')]]){ut[_0x9bee('0x12c')](_0x5adeac,this[_0x9bee('0x14')][_0x5adeac[_0x9bee('0xee')]]['name'],this['agents'][_0x5adeac[_0x9bee('0xee')]]['id']);}var _0x4756f0=_['clone'](_0x5adeac);_0x4756f0[_0x9bee('0x90')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xbc8223=_0x579844['campaignsPreview'][_0x5adeac[_0x9bee('0x49')]];if(ut[_0x9bee('0x12d')](_0x34c249[_0x9bee('0x12e')])){if(_0x5adeac['unlockAgent']){rpcDb[_0x9bee('0xfd')](_0x5adeac[_0x9bee('0x8b')]);}if(_0x5adeac[_0x9bee('0x88')]){rpcDb[_0x9bee('0xff')](_0x5adeac[_0x9bee('0x8b')]);}ami[_0x9bee('0x26')]('custom:agentringnoanswer',ut[_0x9bee('0x95')](_0x5adeac,_0x9bee('0x12f'),this[_0x9bee('0x11')][_0x5adeac[_0x9bee('0x49')]]));this['callProgressDetectingAgent'](_0x4756f0,_0xbc8223,_0x34c249);}else{_0x5adeac[_0x9bee('0x64')]=moment()['format'](_0x9bee('0x8f'));ut[_0x9bee('0xe4')](_0x4756f0,0x4,'Answer');rpcDb[_0x9bee('0xe2')](_0x4756f0,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x9bee('0xc')][_0x9bee('0x1a')]=function(_0x23b2b7){var _0x2e790a=this[_0x9bee('0x48')][_0x23b2b7['linkedid']];var _0x57f3e2;if(_0x2e790a){_0x57f3e2=this[_0x9bee('0x11')][_0x2e790a[_0x9bee('0x49')]];logger['info'](_0x9bee('0x130'),_0x23b2b7[_0x9bee('0x89')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],_0x9bee('0x4b'),_0x57f3e2[_0x9bee('0x4c')]);}if(this['actions'][_0x23b2b7[_0x9bee('0x89')]]&&_0x23b2b7[_0x9bee('0x89')]!==_0x23b2b7['uniqueid']){if(_0x23b2b7[_0x9bee('0x131')]==='16'&&this[_0x9bee('0x48')][_0x23b2b7[_0x9bee('0x89')]][_0x9bee('0x4d')]){this['callProgressDetectingCustomer'](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}else if(this[_0x9bee('0x48')][_0x23b2b7['linkedid']]['dialAnswer']){logger[_0x9bee('0x27')](_0x9bee('0x132'),_0x23b2b7['linkedid'],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2['name'],_0x9bee('0x4b'),_0x57f3e2['pTalking']);this[_0x9bee('0x133')](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}}else if(_0x2e790a&&_[_0x9bee('0x5d')](_0x2e790a[_0x9bee('0x134')])&&_0x57f3e2['dialQueueProject']&&_0x23b2b7[_0x9bee('0x89')]===_0x23b2b7[_0x9bee('0x92')]&&_[_0x9bee('0x5d')](_0x23b2b7[_0x9bee('0xe1')])&&_0x23b2b7[_0x9bee('0x131')]==='16'&&_0x23b2b7[_0x9bee('0x135')]==='6'&&_[_0x9bee('0xdf')](_0x2e790a[_0x9bee('0x136')])){if(_0x2e790a['unlockAgent']){rpcDb[_0x9bee('0xfd')](_0x2e790a['idContact']);}if(_0x2e790a[_0x9bee('0x88')]){rpcDb['disableContact'](_0x2e790a[_0x9bee('0x8b')]);}_0x23b2b7[_0x9bee('0xe1')]='22';this['callProgressDetectingAgent'](_0x2e790a,_0x57f3e2,_0x23b2b7);}else if(_0x2e790a&&_0x2e790a[_0x9bee('0x136')]){if(_0x23b2b7[_0x9bee('0x131')]==='16'&&this[_0x9bee('0x48')][_0x23b2b7[_0x9bee('0x89')]][_0x9bee('0x4d')]){logger['info']('[syncHangup][talking][transfer]',_0x23b2b7['linkedid'],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],_0x9bee('0x4b'),_0x57f3e2['pTalking']);this[_0x9bee('0x133')](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}else if(this['actions'][_0x23b2b7[_0x9bee('0x89')]]['dialAnswer']){logger[_0x9bee('0x27')](_0x9bee('0x132'),_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')],_0x9bee('0x93'),_0x57f3e2[_0x9bee('0x2b')],'pTalking:\x20',_0x57f3e2[_0x9bee('0x4c')]);this['callProgressDetectingCustomer'](_0x23b2b7,_0x23b2b7[_0x9bee('0x89')],_0x23b2b7[_0x9bee('0x131')]);}}};Preview[_0x9bee('0xc')][_0x9bee('0x1e')]=function(_0xdee9e){if(this[_0x9bee('0x48')][_0xdee9e[_0x9bee('0xdd')]]&&_0xdee9e[_0x9bee('0xdd')]!==_0xdee9e[_0x9bee('0x137')]){this[_0x9bee('0x133')](_0xdee9e,_0xdee9e[_0x9bee('0xdd')],_0xdee9e[_0x9bee('0xd2')]);}};Preview[_0x9bee('0xc')][_0x9bee('0x1c')]=function(_0x2389ca){if(this[_0x9bee('0x48')][_0x2389ca[_0x9bee('0x89')]]&&_0x2389ca[_0x9bee('0x89')]!==_0x2389ca[_0x9bee('0x92')]&&!this[_0x9bee('0x48')][_0x2389ca['linkedid']][_0x9bee('0x4d')]){if(_0x2389ca[_0x9bee('0x131')]==='1'){this[_0x9bee('0x133')](_0x2389ca,_0x2389ca[_0x9bee('0x89')],_0x2389ca[_0x9bee('0x131')]);}}};Preview['prototype'][_0x9bee('0x138')]=function(_0x2f09fe,_0x1eebce,_0x3a6d01){if(this[_0x9bee('0x48')][_0x2f09fe]){if(_[_0x9bee('0x5d')](this['actions'][_0x2f09fe]['variables'])){this[_0x9bee('0x48')][_0x2f09fe][_0x9bee('0x127')]={};}this['actions'][_0x2f09fe][_0x9bee('0x127')][_0x1eebce]=_0x3a6d01;}};Preview[_0x9bee('0xc')][_0x9bee('0x139')]=function(_0x14ba83){try{if(!_[_0x9bee('0x5d')](_0x14ba83)){if(ut[_0x9bee('0x13a')](_['keys'](_0x14ba83[_0x9bee('0x13b')])[0x0])){this[_0x9bee('0x138')](_0x14ba83[_0x9bee('0x92')],_[_0x9bee('0x13c')](_0x14ba83['variable'])[0x0],_0x14ba83[_0x9bee('0x13d')]);}}}catch(_0x5ecc20){logger[_0x9bee('0x13e')](_0x9bee('0x13f'),util[_0x9bee('0x140')](_0x5ecc20,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x9c77d){if(_0x9c77d){if(this[_0x9bee('0x48')][_0x9c77d[_0x9bee('0x141')]]){this['actions'][_0x9c77d[_0x9bee('0x141')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x50fc52){if(_0x50fc52){if(this[_0x9bee('0x48')][_0x50fc52['transfererlinkedid']]){this[_0x9bee('0x48')][_0x50fc52['transfererlinkedid']][_0x9bee('0x136')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ee172af..468ace7 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 _0x3b9c=['../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','then','createHistory','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper'];(function(_0x5095ac,_0x2500d5){var _0x53627e=function(_0x431a9b){while(--_0x431a9b){_0x5095ac['push'](_0x5095ac['shift']());}};_0x53627e(++_0x2500d5);}(_0x3b9c,0x177));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc3b9('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xc3b9('0x1'));var cmHopper=require(_0xc3b9('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xc3b9('0x3'));var voiceQueueReport=require(_0xc3b9('0x4'));function loggerCatch(_0x55fdba){return function(_0x201522){logger[_0xc3b9('0x5')](_0x55fdba,util[_0xc3b9('0x6')](_0x201522,{'showHidden':![],'depth':null}));};}function create(_0x2ee53e){return cmHopperHistory['createHistory'](_0x2ee53e)[_0xc3b9('0x7')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x3e675b){return BPromise['resolve']()[_0xc3b9('0x8')](agentReportPreview[_0xc3b9('0x9')](_0x3e675b))[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0xa')));}function moveContact(_0xe21e5f){return cmHopper[_0xc3b9('0xb')](_0xe21e5f,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc3b9('0xc')]=function(_0x6155f6){return cmHopperBlack[_0xc3b9('0xc')](_0x6155f6)[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0xd')));};exports[_0xc3b9('0xe')]=function(_0xea0a9d){return BPromise[_0xc3b9('0xf')]()[_0xc3b9('0x8')](cmHopper['getContactPreview'](_0xea0a9d))['catch'](loggerCatch(_0xc3b9('0x10')));};exports[_0xc3b9('0x9')]=function(_0x11f6e,_0x352851){create(_0x11f6e)['catch'](loggerCatch(_0x352851));moveContact(_0x11f6e)[_0xc3b9('0x7')](loggerCatch(_0x352851));};exports[_0xc3b9('0x11')]=function(_0x11e898,_0x561fca){createAgent(_0x11e898)[_0xc3b9('0x7')](loggerCatch(_0x561fca));};exports[_0xc3b9('0x12')]=function(_0x3bebcc,_0xaac924){create(_0x3bebcc)[_0xc3b9('0x7')](loggerCatch(_0xaac924));};exports[_0xc3b9('0x13')]=function(_0x3afcbc,_0x19c43d){moveContact(_0x3afcbc)['catch'](loggerCatch(_0x19c43d));};exports[_0xc3b9('0x14')]=function(_0x59046d,_0x14b6a6,_0x131387){if(_0x14b6a6){_0x59046d[_0xc3b9('0x15')]=null;}if(_0x131387){_0x59046d[_0xc3b9('0x16')]=![];}return cmHopper[_0xc3b9('0x14')](_0x59046d)[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x17')));};exports[_0xc3b9('0x18')]=function(_0x5d68dc){return cmHopper['countReScheduled'](_0x5d68dc)[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x19')));};exports[_0xc3b9('0x1a')]=function(_0x3c45c2){return cmHopper['unlockContact']({'UserId':null},_0x3c45c2,0x1)[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x1b')));};exports[_0xc3b9('0x1c')]=function(_0x3d04f7){return cmHopper['unlockContact']({'active':![]},_0x3d04f7,0x1)[_0xc3b9('0x7')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x4a67f9){var _0x41c178={};_0x41c178[_0xc3b9('0x1d')]=_0x4a67f9[_0xc3b9('0x1d')];_0x41c178[_0xc3b9('0x1e')]=_0x4a67f9[_0xc3b9('0x1e')];_0x41c178['calleridnum']=_0x4a67f9['calleridnum'];_0x41c178[_0xc3b9('0x1f')]=_0x4a67f9[_0xc3b9('0x1f')];_0x41c178[_0xc3b9('0x20')]=_0x4a67f9[_0xc3b9('0x20')];_0x41c178[_0xc3b9('0x21')]=_0x4a67f9[_0xc3b9('0x22')];_0x41c178[_0xc3b9('0x23')]=_0x4a67f9[_0xc3b9('0x22')];_0x41c178[_0xc3b9('0x24')]=0x1;_0x41c178[_0xc3b9('0x25')]=_0x4a67f9[_0xc3b9('0x26')];_0x41c178[_0xc3b9('0x27')]=_0x4a67f9['membername'];_0x41c178[_0xc3b9('0x28')]=_0xc3b9('0x29');_0x41c178[_0xc3b9('0x2a')]=_0xc3b9('0x2b');_0x41c178[_0xc3b9('0x2c')]=0x0;_0x41c178[_0xc3b9('0x2d')]=0x1;_0x41c178[_0xc3b9('0x2e')]=_0x4a67f9[_0xc3b9('0x2f')];_0x41c178['queuecallerexitreason']=_0xc3b9('0x30');return BPromise[_0xc3b9('0xf')]()[_0xc3b9('0x8')](voiceQueueReport['create'](_0x41c178))[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x31')));};exports['getContactRecallMe']=function(_0x405174,_0x388573){return BPromise[_0xc3b9('0xf')]()['then'](cmHopper[_0xc3b9('0x32')](_0x405174,_0x388573))[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x33')));};exports[_0xc3b9('0x34')]=function(_0xe199b1){return cmHopper['rescheduleContact'](_0xe199b1,!![],!![])[_0xc3b9('0x7')](loggerCatch(_0xc3b9('0x35')));}; \ No newline at end of file +var _0x1b07=['../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x1b07,0x1c1));var _0x71b0=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x1b07[_0x303c30];return _0x43161b;};'use strict';var util=require(_0x71b0('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x71b0('0x1'));function loggerCatch(_0x52155b){return function(_0x232a61){logger[_0x71b0('0x2')](_0x52155b,util[_0x71b0('0x3')](_0x232a61,{'showHidden':![],'depth':null}));};}function create(_0x107e90){return cmHopperHistory[_0x71b0('0x4')](_0x107e90)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x6')));}function createAgent(_0x35ac18){return BPromise['resolve']()[_0x71b0('0x7')](agentReportPreview['createHistory'](_0x35ac18))[_0x71b0('0x5')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2da91a){return cmHopper[_0x71b0('0x8')](_0x2da91a,!![])[_0x71b0('0x5')](loggerCatch(_0x71b0('0x9')));}exports[_0x71b0('0xa')]=function(_0x1eff07){return cmHopperBlack[_0x71b0('0xa')](_0x1eff07)[_0x71b0('0x5')](loggerCatch(_0x71b0('0xb')));};exports[_0x71b0('0xc')]=function(_0x45732a){return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](cmHopper['getContactPreview'](_0x45732a))[_0x71b0('0x5')](loggerCatch(_0x71b0('0xe')));};exports['createHistory']=function(_0x1231d0,_0x5a30f9){create(_0x1231d0)[_0x71b0('0x5')](loggerCatch(_0x5a30f9));moveContact(_0x1231d0)[_0x71b0('0x5')](loggerCatch(_0x5a30f9));};exports[_0x71b0('0xf')]=function(_0x1a7249,_0x380601){createAgent(_0x1a7249)['catch'](loggerCatch(_0x380601));};exports[_0x71b0('0x10')]=function(_0x1c7ce3,_0x32991a){create(_0x1c7ce3)[_0x71b0('0x5')](loggerCatch(_0x32991a));};exports[_0x71b0('0x11')]=function(_0x468219,_0x5bcfa9){moveContact(_0x468219)[_0x71b0('0x5')](loggerCatch(_0x5bcfa9));};exports[_0x71b0('0x12')]=function(_0x59c320,_0x1bc402,_0x3e42f8){if(_0x1bc402){_0x59c320[_0x71b0('0x13')]=null;}if(_0x3e42f8){_0x59c320[_0x71b0('0x14')]=![];}return cmHopper['rescheduleContact'](_0x59c320)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x15')));};exports[_0x71b0('0x16')]=function(_0x581fdd){return cmHopper[_0x71b0('0x16')](_0x581fdd)[_0x71b0('0x5')](loggerCatch('[countReScheduled]\x20'));};exports[_0x71b0('0x17')]=function(_0x397449){return cmHopper['unlockContact']({'UserId':null},_0x397449,0x1)[_0x71b0('0x5')](loggerCatch(_0x71b0('0x18')));};exports[_0x71b0('0x19')]=function(_0x3b4d3d){return cmHopper['unlockContact']({'active':![]},_0x3b4d3d,0x1)[_0x71b0('0x5')](loggerCatch('[activeContact]\x20'));};exports[_0x71b0('0x1a')]=function(_0x52be92){var _0x2b1408={};_0x2b1408[_0x71b0('0x1b')]=_0x52be92[_0x71b0('0x1b')];_0x2b1408[_0x71b0('0x1c')]=_0x52be92[_0x71b0('0x1c')];_0x2b1408[_0x71b0('0x1d')]=_0x52be92['calleridnum'];_0x2b1408[_0x71b0('0x1e')]=_0x52be92[_0x71b0('0x1e')];_0x2b1408[_0x71b0('0x1f')]=_0x52be92[_0x71b0('0x1f')];_0x2b1408[_0x71b0('0x20')]=_0x52be92['answertime'];_0x2b1408['queuecallerleaveAt']=_0x52be92[_0x71b0('0x21')];_0x2b1408[_0x71b0('0x22')]=0x1;_0x2b1408[_0x71b0('0x23')]=_0x52be92[_0x71b0('0x24')];_0x2b1408['connectedlinename']=_0x52be92[_0x71b0('0x25')];_0x2b1408[_0x71b0('0x26')]=_0x71b0('0x27');_0x2b1408['exten']=_0x71b0('0x28');_0x2b1408['holdtime']=0x0;_0x2b1408[_0x71b0('0x29')]=0x1;_0x2b1408[_0x71b0('0x2a')]=_0x52be92[_0x71b0('0x25')];_0x2b1408[_0x71b0('0x2b')]=_0x71b0('0x2c');return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](voiceQueueReport[_0x71b0('0x2d')](_0x2b1408))['catch'](loggerCatch(_0x71b0('0x2e')));};exports[_0x71b0('0x2f')]=function(_0x17464a,_0x5de739){return BPromise[_0x71b0('0xd')]()[_0x71b0('0x7')](cmHopper[_0x71b0('0x2f')](_0x17464a,_0x5de739))[_0x71b0('0x5')](loggerCatch(_0x71b0('0x30')));};exports['rescheduleContactInQueue']=function(_0x37f227){return cmHopper[_0x71b0('0x12')](_0x37f227,!![],!![])[_0x71b0('0x5')](loggerCatch(_0x71b0('0x31')));}; \ 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 3f38346..9100e08 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 _0x0019=['xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','error','logger','info','inspect','loggerError','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','talktime','answertime','getSeconds','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','queue','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','reachable','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0019,0x1be));var _0x9001=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x0019[_0x55d8c5];return _0x225ae5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9001('0x0'));var logger=require(_0x9001('0x1'))(_0x9001('0x2'));var ipAgi=process[_0x9001('0x3')][_0x9001('0x4')]||'127.0.0.1';var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x118f8d){return function(_0x529418){logger[_0x9001('0x5')](_0x118f8d,util['inspect'](_0x529418,{'showHidden':![],'depth':null}));};};exports[_0x9001('0x6')]=function(_0x1164ca,_0x53e75e){logger[_0x9001('0x7')](_0x1164ca,util[_0x9001('0x8')](_0x53e75e,{'showHidden':![],'depth':null}));};exports[_0x9001('0x9')]=function(_0xb2cccc,_0x2e3af3){logger[_0x9001('0x5')](_0xb2cccc,util['inspect'](_0x2e3af3,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2c59b4){return function(_0xef5b10){logger['info'](_0x2c59b4,util[_0x9001('0x8')](_0xef5b10,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1483ea,_0x36493d,_0x3194b9){return{'message':_0x1483ea,'unlock':_0x36493d,'active':_0x3194b9};};exports['getCallerId']=function(_0x340801,_0x446196,_0x25b99a){if(!_[_0x9001('0xa')](_0x25b99a)&&_0x9001('0xb')===typeof _0x25b99a&&!_[_0x9001('0xc')](_0x25b99a)){if(!_[_0x9001('0xa')](_0x446196)&&_0x9001('0xb')===typeof _0x446196&&!_[_0x9001('0xc')](_0x446196)){return util[_0x9001('0xd')]('\x22%s\x22\x20<%s>',_0x446196,_0x25b99a);}return util[_0x9001('0xd')](_0x9001('0xe'),_0x25b99a,_0x25b99a);}if(!_[_0x9001('0xa')](_0x340801)&&_0x9001('0xb')===typeof _0x340801&&!_[_0x9001('0xc')](_0x340801)){return _0x340801;}return _0x9001('0xf');};exports['isActive']=function(_0x44fedd){if(_['isNil'](_0x44fedd)){return![];}return _0x44fedd;};exports[_0x9001('0x10')]=function(_0x5d9a8f,_0x5d6013,_0x26f76e,_0x1c0f35,_0x4fa853,_0x119dea){var _0x3221ba={'XMD-QUEUE':_0x5d6013['Queue']?_0x5d6013[_0x9001('0x11')][_0x9001('0x12')]:'','XMD-CALLERID':_0x1c0f35,'XMD-CALLERID-PREVIEW':_0x119dea?util[_0x9001('0xd')]('\x22%s\x22\x20<%s>',_0x119dea[_0x9001('0x13')],_0x119dea[_0x9001('0x14')]):_0x1c0f35,'XMD-DIALID':_0x4fa853,'XMD-CONTACTID':_0x5d6013['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1c0f35,'XMD-VOICEQUEUEID':_0x5d6013[_0x9001('0x15')],'XMD-DIALCHANNEL':_0x26f76e,'XMD-DIALTIMEOUT':_0x5d9a8f[_0x9001('0x16')]||0x1e,'XMD-DIALOPTIONS':util[_0x9001('0xd')]('\x22rtTxX%s%s\x22',_0x5d9a8f['dialQueueProject2']?'g':'',_[_0x9001('0xc')](_0x5d9a8f['monitor_format'])?'':_0x9001('0x17')),'XMD-DIALURL':_0x5d9a8f[_0x9001('0x18')]||'','XMD-AGI':_0x5d9a8f[_0x9001('0x19')]?util[_0x9001('0xd')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d9a8f[_0x9001('0x19')]):_0x9001('0x1a'),'XMD-AGIAFTER':_0x5d9a8f[_0x9001('0x1b')]?util['format'](_0x9001('0x1c'),ipAgi,_0x5d9a8f[_0x9001('0x1b')]):_0x9001('0x1a'),'XMD-ORIGINATECALLERIDNUM':_0x119dea?_0x119dea['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x119dea?_0x119dea['originatecalleridname']:'','XMD-DESTINATION':_0x9001('0x1d'),'SIPADDHEADER':_0x9001('0x1e')};if(!_[_0x9001('0xc')](_0x5d9a8f[_0x9001('0x1f')])){_0x3221ba[util['format']('%s',_0x9001('0x20'))]=_0x5d9a8f['monitor_format'];_0x3221ba[util[_0x9001('0xd')]('%s',_0x9001('0x21'))]=_0x4fa853;}return _0x3221ba;};exports[_0x9001('0x22')]=function(_0x343ce2){var _0x3c771e={};for(var _0x4f4adc in _0x343ce2){if(_0x343ce2[_0x9001('0x23')](_0x4f4adc)){_0x3c771e[util[_0x9001('0xd')]('%s',_[_0x9001('0x24')](_0x4f4adc))]=_0x343ce2[_0x4f4adc];}}return{'variables':_0x3c771e};};exports[_0x9001('0x25')]=function(_0x459f7e,_0x1e52d8){if(!_[_0x9001('0x26')](_0x459f7e)){if(_0x459f7e[_0x9001('0x23')]('originated')){if(_0x459f7e[_0x9001('0x27')]>0x0){_0x459f7e[_0x9001('0x27')]-=0x1;}else{logger[_0x9001('0x5')](_0x9001('0x28'),_0x1e52d8);}}}else{logger[_0x9001('0x5')](_0x9001('0x29'),_0x1e52d8);}};exports[_0x9001('0x2a')]=function(_0x4b87d8){var _0x18c082=moment()[_0x9001('0xd')](_0x9001('0x2b'));_0x4b87d8[_0x9001('0x2c')]=0xd;_0x4b87d8[_0x9001('0x2d')]='Blacklist';_0x4b87d8[_0x9001('0x2e')]=_0x18c082;_0x4b87d8[_0x9001('0x2f')]=_0x18c082;_0x4b87d8[_0x9001('0x30')]=_0x18c082;};exports['logAgent']=function(_0x35c8c3,_0x20aabd,_0x2a6b68){var _0x4abd4a=moment()['format'](_0x9001('0x2b'));_0x35c8c3[_0x9001('0x2c')]=_0x20aabd;_0x35c8c3[_0x9001('0x2d')]=_0x2a6b68;_0x35c8c3[_0x9001('0x2f')]=_0x4abd4a;_0x35c8c3[_0x9001('0x31')]=utils['getSeconds'](_0x35c8c3['responsetime'],_0x35c8c3['starttime']);};exports[_0x9001('0x32')]=function(_0x5ec322,_0x397583,_0x1d1c92){_0x5ec322[_0x9001('0x33')]=_0x397583;_0x5ec322[_0x9001('0x34')]=_0x1d1c92;};exports['logCustomer']=function(_0x24ccff,_0x23d5aa,_0x4e9f75){var _0x4c0335=moment()[_0x9001('0xd')](_0x9001('0x2b'));_0x24ccff[_0x9001('0x2c')]=_0x23d5aa;_0x24ccff[_0x9001('0x2d')]=_0x4e9f75;_0x24ccff[_0x9001('0x2f')]=_0x24ccff['responsetime']?_0x24ccff[_0x9001('0x2f')]:_0x4c0335;_0x24ccff[_0x9001('0x30')]=_0x24ccff[_0x9001('0x30')]?_0x24ccff['endtime']:_0x4c0335;_0x24ccff[_0x9001('0x31')]=utils['getSeconds'](_0x24ccff[_0x9001('0x2f')]||0x0,_0x24ccff[_0x9001('0x2e')]||0x0);_0x24ccff[_0x9001('0x35')]=_0x24ccff[_0x9001('0x36')]?utils[_0x9001('0x37')](_0x24ccff['endtime'],_0x24ccff['answertime']):0x0;};exports[_0x9001('0x38')]=function(_0x2f7fde){return _0x2f7fde===_0x9001('0x39');};exports[_0x9001('0x3a')]=function(_0x53416b,_0x24e69b,_0x47e2a7,_0x4a9714,_0x361e18){var _0x53d545=_0x4a9714?_0x9001('0x3b'):_0x53416b[_0x9001('0x13')];_0x53d545=_0x361e18?_0x9001('0x3c'):_0x53d545;return{'actionid':_0x53416b[_0x9001('0x3d')],'action':_0x9001('0x3e'),'channel':_0x53416b['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x53d545,_0x53416b[_0x9001('0x14')]),'Exten':'xcally-motion-preview','Context':_0x9001('0x3f'),'Priority':'1','variable':_0x47e2a7,'timeout':(_0x24e69b[_0x9001('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x53416b['uniqueid']};};exports[_0x9001('0x41')]=function(_0x1ddac2){return _0x1ddac2['countbusyretry']+_0x1ddac2[_0x9001('0x42')]+_0x1ddac2[_0x9001('0x43')]+_0x1ddac2[_0x9001('0x44')]+_0x1ddac2['countnosuchnumberretry'];};exports[_0x9001('0x45')]=function(_0x3a8300){var _0x4bacf6=_[_0x9001('0x46')](_0x3a8300);_0x4bacf6['state']=0xf;_0x4bacf6[_0x9001('0x2d')]=_0x9001('0x47');return _0x4bacf6;};exports[_0x9001('0x48')]=function(_0x3bd715,_0x5d8c4c,_0x75a85a){var _0x3801bb={};_0x3801bb[_0x5d8c4c]=_0x3bd715[_0x5d8c4c];_0x3801bb['active']=![];_0x3801bb[_0x9001('0x49')]=moment()[_0x9001('0x4a')](_0x75a85a,_0x9001('0x4b'))[_0x9001('0xd')](_0x9001('0x2b'));_0x3801bb[_0x9001('0x4c')]=_0x3bd715[_0x9001('0x4c')];_0x3801bb[_0x9001('0x4d')]=_0x3bd715['ListId'];_0x3801bb[_0x9001('0x15')]=_0x3bd715[_0x9001('0x15')]||undefined;return _0x3801bb;};exports[_0x9001('0x4e')]=function(_0x93dbc9,_0x55aa68){if(!_[_0x9001('0x26')](_0x93dbc9)){if(_0x93dbc9[_0x9001('0x4f')]>0x0){_0x93dbc9[_0x9001('0x4f')]-=0x1;}else{logger[_0x9001('0x5')](_0x55aa68,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x9001('0x5')](_0x55aa68,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x270c7c){if(_0x270c7c<=0x0){return!![];}return![];};function buildObj(_0x43688f,_0x29e276,_0x8011ec){_0x43688f['lastevent']=_0x29e276;_0x43688f[_0x9001('0x12')]=_0x43688f[_0x9001('0x50')];_0x43688f['interface']=_0x43688f[_0x9001('0x51')];_0x43688f[_0x9001('0x52')]=_0x9001('0x53');if(_0x8011ec){_0x43688f[_0x9001('0x54')]=_0x8011ec[_0x9001('0x54')];}return _0x43688f;}exports[_0x9001('0x55')]=buildObj;exports[_0x9001('0x56')]=function(_0x1f9f8f){var _0x5e9aac={};_0x5e9aac[_0x9001('0x50')]=_0x1f9f8f['queue'];_0x5e9aac[_0x9001('0x57')]=_0x1f9f8f[_0x9001('0x51')];_0x5e9aac[_0x9001('0x3d')]=_0x1f9f8f[_0x9001('0x3d')];return _0x5e9aac;};exports[_0x9001('0x58')]=function(_0x4f3572){var _0x38dfd9=[];for(var _0x39101c in _0x4f3572){if(_0x4f3572[_0x9001('0x23')](_0x39101c)){if(!_[_0x9001('0x26')](_0x4f3572[_0x39101c])&&_0x4f3572[_0x39101c][_0x9001('0x2c')]===_0x9001('0x59')&&_0x4f3572[_0x39101c]['status']===_0x9001('0x5a')){_0x38dfd9['push'](_0x4f3572[_0x39101c]['id']);}}}return _0x38dfd9;};exports['getDiff']=function(_0x2f1081){var _0x691b64=moment()[_0x9001('0x5b')](0x0);var _0x4c6d0d=moment(_0x2f1081)['milliseconds'](0x0);return _0x691b64[_0x9001('0x5c')](_0x4c6d0d,_0x9001('0x5d'));};exports[_0x9001('0x5e')]=function(_0x25a3b9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x25a3b9[_0x9001('0x4c')],'ListId':_0x25a3b9[_0x9001('0x4d')],'VoiceQueueId':_0x25a3b9['VoiceQueueId']||undefined,'CampaignId':_0x25a3b9[_0x9001('0x5f')]||undefined};};exports[_0x9001('0x60')]=function(_0x224cf8){if(_0x224cf8===_0x9001('0x3d')||_0x224cf8===_0x9001('0x61')||_0x224cf8===_0x9001('0x50')||_0x224cf8==='type'||_0x224cf8===_0x9001('0x62')||_0x224cf8===_0x9001('0x63')||_0x224cf8===_0x9001('0x33')||_0x224cf8===_0x9001('0x51')||_0x224cf8===_0x9001('0x13')||_0x224cf8===_0x9001('0x64')||_0x224cf8===_0x9001('0x14')||_0x224cf8===_0x9001('0x49')||_0x224cf8===_0x9001('0x65')||_0x224cf8===_0x9001('0x42')||_0x224cf8===_0x9001('0x43')||_0x224cf8===_0x9001('0x66')||_0x224cf8===_0x9001('0x67')||_0x224cf8===_0x9001('0x68')||_0x224cf8===_0x9001('0x69')||_0x224cf8===_0x9001('0x6a')||_0x224cf8===_0x9001('0x4c')||_0x224cf8===_0x9001('0x4d')||_0x224cf8===_0x9001('0x34')||_0x224cf8===_0x9001('0x15')||_0x224cf8===_0x9001('0x6b')||_0x224cf8==='xmd-voicequeueid'||_0x224cf8===_0x9001('0x6c')||_0x224cf8===_0x9001('0x6d')||_0x224cf8==='xmd-listid'||_0x224cf8===_0x9001('0x6e')||_0x224cf8===_0x9001('0x6f')||_0x224cf8===_0x9001('0x70')||_0x224cf8===_0x9001('0x71')||_0x224cf8===_0x9001('0x72')||_0x224cf8===_0x9001('0x73')||_0x224cf8===_0x9001('0x74')||_0x224cf8===_0x9001('0x75')||_0x224cf8===_0x9001('0x76')||_0x224cf8==='xmd-agi'||_0x224cf8===_0x9001('0x77')||_0x224cf8===_0x9001('0x78')||_0x224cf8==='rtpaudioqosjitter'||_0x224cf8==='rtpaudioqosjitterbridged'||_0x224cf8==='rtpaudioqosloss'||_0x224cf8===_0x9001('0x79')||_0x224cf8==='rtpaudioqosrtt'||_0x224cf8===_0x9001('0x7a')||_0x224cf8===_0x9001('0x77')||_0x224cf8===_0x9001('0x78')||_0x224cf8===_0x9001('0x7b')||_0x224cf8==='rtpaudioqosjitterbridged'||_0x224cf8===_0x9001('0x7c')||_0x224cf8===_0x9001('0x79')||_0x224cf8==='rtpaudioqosrtt'||_0x224cf8===_0x9001('0x7a')||_0x224cf8===_0x9001('0x7d')||_0x224cf8===_0x9001('0x7e')||_0x224cf8==='state'||_0x224cf8==='statedesc'){return![];}return!![];};exports[_0x9001('0x7f')]=function(_0x338f32,_0x42f644){var _0x11c2e9,_0x5f5cca,_0x52ae15;if(_0x42f644<=0x0){_0x42f644=0x1;}_0x11c2e9=new RegExp(_0x9001('0x80')+_0x42f644+'}$');_0x5f5cca=Math[_0x9001('0x81')](0xa,_0x42f644-0x1);_0x52ae15=Math[_0x9001('0x81')](0xa,_0x42f644)-0x1;return util[_0x9001('0xd')]('%s',_[_0x9001('0x82')](_0x338f32,_0x11c2e9,_[_0x9001('0x83')](_0x5f5cca,_0x52ae15)));};exports[_0x9001('0x84')]=function(_0x87d994){var _0x408128=_0x87d994[_0x9001('0x85')](/"(.*?)"/);return _0x408128?_0x408128[0x1]:_0x87d994;};exports[_0x9001('0x86')]=function(_0x131e8a){var _0x3bff43=_0x131e8a[_0x9001('0x85')](/<(.*?)>/);return _0x3bff43?_0x3bff43[0x1]:_0x131e8a;};function buildNoAnswerEventPayload(_0x4eae81,_0x45750d){var _0x55372c=buildObj(_0x4eae81,_0x9001('0x87'));if(!_[_0x9001('0xc')](_0x45750d[_0x9001('0x88')])){Object[_0x9001('0x89')](_0x45750d[_0x9001('0x88')])[_0x9001('0x8a')](function(_0x5985d5){_0x55372c[_0x5985d5[_0x9001('0x8b')]()]=_0x45750d[_0x9001('0x88')][_0x5985d5];});}return _0x55372c;}exports[_0x9001('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xce11=['xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','ringtime','logLookAgent','membername','UserId','logCustomer','getSeconds','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','name','channelAgent','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','filterKey','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','env','../../dialer/utils','loggerCatch','error','inspect','info','message','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','format','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xce11,0x69));var _0x1ce1=function(_0xaead1,_0x200faa){_0xaead1=_0xaead1-0x0;var _0x1e47c7=_0xce11[_0xaead1];return _0x1e47c7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1ce1('0x0'));var logger=require('../../../../config/logger')(_0x1ce1('0x1'));var ipAgi=process[_0x1ce1('0x2')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x1ce1('0x3'));exports[_0x1ce1('0x4')]=function(_0x294e24){return function(_0x2e026e){logger[_0x1ce1('0x5')](_0x294e24,util[_0x1ce1('0x6')](_0x2e026e,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4c5e3e,_0xd6d8c1){logger[_0x1ce1('0x7')](_0x4c5e3e,util[_0x1ce1('0x6')](_0xd6d8c1,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x55937e,_0x5bb8c2){logger[_0x1ce1('0x5')](_0x55937e,util[_0x1ce1('0x6')](_0x5bb8c2,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2aef5c){return function(_0x352fe2){logger[_0x1ce1('0x7')](_0x2aef5c,util[_0x1ce1('0x6')](_0x352fe2,{'showHidden':![],'depth':null}));};};exports[_0x1ce1('0x8')]=function(_0x5d707d,_0x290c5b,_0x1a286f){return{'message':_0x5d707d,'unlock':_0x290c5b,'active':_0x1a286f};};exports['getCallerId']=function(_0x660058,_0x3709bc,_0x1dd7bf){if(!_['isUndefined'](_0x1dd7bf)&&'string'===typeof _0x1dd7bf&&!_[_0x1ce1('0x9')](_0x1dd7bf)){if(!_[_0x1ce1('0xa')](_0x3709bc)&&_0x1ce1('0xb')===typeof _0x3709bc&&!_['isEmpty'](_0x3709bc)){return util['format'](_0x1ce1('0xc'),_0x3709bc,_0x1dd7bf);}return util['format']('\x22%s\x22\x20<%s>',_0x1dd7bf,_0x1dd7bf);}if(!_[_0x1ce1('0xa')](_0x660058)&&_0x1ce1('0xb')===typeof _0x660058&&!_[_0x1ce1('0x9')](_0x660058)){return _0x660058;}return _0x1ce1('0xd');};exports[_0x1ce1('0xe')]=function(_0x3d4eac){if(_[_0x1ce1('0xf')](_0x3d4eac)){return![];}return _0x3d4eac;};exports['addVariables']=function(_0x298688,_0x1b34e5,_0x336f55,_0x594773,_0x220e10,_0x29827e){var _0x3d9024={'XMD-QUEUE':_0x1b34e5['Queue']?_0x1b34e5[_0x1ce1('0x10')]['name']:'','XMD-CALLERID':_0x594773,'XMD-CALLERID-PREVIEW':_0x29827e?util[_0x1ce1('0x11')]('\x22%s\x22\x20<%s>',_0x29827e[_0x1ce1('0x12')],_0x29827e[_0x1ce1('0x13')]):_0x594773,'XMD-DIALID':_0x220e10,'XMD-CONTACTID':_0x1b34e5[_0x1ce1('0x14')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x594773,'XMD-VOICEQUEUEID':_0x1b34e5[_0x1ce1('0x15')],'XMD-DIALCHANNEL':_0x336f55,'XMD-DIALTIMEOUT':_0x298688[_0x1ce1('0x16')]||0x1e,'XMD-DIALOPTIONS':util[_0x1ce1('0x11')](_0x1ce1('0x17'),_0x298688['dialQueueProject2']?'g':'',_['isEmpty'](_0x298688['monitor_format'])?'':_0x1ce1('0x18')),'XMD-DIALURL':_0x298688[_0x1ce1('0x19')]||'','XMD-AGI':_0x298688['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x298688[_0x1ce1('0x1a')]):_0x1ce1('0x1b'),'XMD-AGIAFTER':_0x298688[_0x1ce1('0x1c')]?util[_0x1ce1('0x11')](_0x1ce1('0x1d'),ipAgi,_0x298688[_0x1ce1('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x29827e?_0x29827e[_0x1ce1('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0x29827e?_0x29827e['originatecalleridname']:'','XMD-DESTINATION':_0x1ce1('0x1f'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x298688['monitor_format'])){_0x3d9024[util[_0x1ce1('0x11')]('%s',_0x1ce1('0x20'))]=_0x298688[_0x1ce1('0x21')];_0x3d9024[util[_0x1ce1('0x11')]('%s',_0x1ce1('0x22'))]=_0x220e10;}return _0x3d9024;};exports[_0x1ce1('0x23')]=function(_0x1f9fd9){var _0x370f1f={};for(var _0xb323df in _0x1f9fd9){if(_0x1f9fd9[_0x1ce1('0x24')](_0xb323df)){_0x370f1f[util[_0x1ce1('0x11')]('%s',_[_0x1ce1('0x25')](_0xb323df))]=_0x1f9fd9[_0xb323df];}}return{'variables':_0x370f1f};};exports[_0x1ce1('0x26')]=function(_0x43a64f,_0x38c4d4){if(!_[_0x1ce1('0xf')](_0x43a64f)){if(_0x43a64f[_0x1ce1('0x24')]('originated')){if(_0x43a64f[_0x1ce1('0x27')]>0x0){_0x43a64f[_0x1ce1('0x27')]-=0x1;}else{logger[_0x1ce1('0x5')](_0x1ce1('0x28'),_0x38c4d4);}}}else{logger[_0x1ce1('0x5')](_0x1ce1('0x29'),_0x38c4d4);}};exports['logBlacklist']=function(_0x15e474){var _0x525f9e=moment()[_0x1ce1('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x15e474['state']=0xd;_0x15e474[_0x1ce1('0x2a')]='Blacklist';_0x15e474[_0x1ce1('0x2b')]=_0x525f9e;_0x15e474[_0x1ce1('0x2c')]=_0x525f9e;_0x15e474[_0x1ce1('0x2d')]=_0x525f9e;};exports[_0x1ce1('0x2e')]=function(_0x27456d,_0x1a99e7,_0x47c3c2){var _0x5f312b=moment()['format'](_0x1ce1('0x2f'));_0x27456d[_0x1ce1('0x30')]=_0x1a99e7;_0x27456d[_0x1ce1('0x2a')]=_0x47c3c2;_0x27456d[_0x1ce1('0x2c')]=_0x5f312b;_0x27456d[_0x1ce1('0x31')]=utils['getSeconds'](_0x27456d[_0x1ce1('0x2c')],_0x27456d[_0x1ce1('0x2b')]);};exports[_0x1ce1('0x32')]=function(_0x3c7534,_0x345d74,_0x4dadcf){_0x3c7534[_0x1ce1('0x33')]=_0x345d74;_0x3c7534[_0x1ce1('0x34')]=_0x4dadcf;};exports[_0x1ce1('0x35')]=function(_0x28d6a0,_0x5532f1,_0x145981){var _0x1e4f09=moment()[_0x1ce1('0x11')](_0x1ce1('0x2f'));_0x28d6a0[_0x1ce1('0x30')]=_0x5532f1;_0x28d6a0['statedesc']=_0x145981;_0x28d6a0['responsetime']=_0x28d6a0[_0x1ce1('0x2c')]?_0x28d6a0['responsetime']:_0x1e4f09;_0x28d6a0[_0x1ce1('0x2d')]=_0x28d6a0[_0x1ce1('0x2d')]?_0x28d6a0[_0x1ce1('0x2d')]:_0x1e4f09;_0x28d6a0[_0x1ce1('0x31')]=utils['getSeconds'](_0x28d6a0[_0x1ce1('0x2c')]||0x0,_0x28d6a0[_0x1ce1('0x2b')]||0x0);_0x28d6a0['talktime']=_0x28d6a0['answertime']?utils[_0x1ce1('0x36')](_0x28d6a0[_0x1ce1('0x2d')],_0x28d6a0[_0x1ce1('0x37')]):0x0;};exports[_0x1ce1('0x38')]=function(_0x947166){return _0x947166===_0x1ce1('0x39');};exports['variablesAction']=function(_0x116aba,_0x21af8c,_0x4ac958,_0x536bfc,_0x5d63ad){var _0x5c81cd=_0x536bfc?_0x1ce1('0x3a'):_0x116aba['calleridname'];_0x5c81cd=_0x5d63ad?_0x1ce1('0x3b'):_0x5c81cd;return{'actionid':_0x116aba[_0x1ce1('0x3c')],'action':'originate','channel':_0x116aba['channelAgent'],'callerid':util['format'](_0x1ce1('0xc'),_0x5c81cd,_0x116aba[_0x1ce1('0x13')]),'Exten':'xcally-motion-preview','Context':_0x1ce1('0x3d'),'Priority':'1','variable':_0x4ac958,'timeout':(_0x21af8c[_0x1ce1('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x116aba[_0x1ce1('0x3c')]};};exports['totalGlobal']=function(_0x4960b1){return _0x4960b1[_0x1ce1('0x3f')]+_0x4960b1[_0x1ce1('0x40')]+_0x4960b1[_0x1ce1('0x41')]+_0x4960b1[_0x1ce1('0x42')]+_0x4960b1[_0x1ce1('0x43')];};exports[_0x1ce1('0x44')]=function(_0x37756b){var _0xa00cff=_[_0x1ce1('0x45')](_0x37756b);_0xa00cff[_0x1ce1('0x30')]=0xf;_0xa00cff['statedesc']=_0x1ce1('0x46');return _0xa00cff;};exports[_0x1ce1('0x47')]=function(_0xec07ac,_0x10ad23,_0x439df0){var _0x324ce9={};_0x324ce9[_0x10ad23]=_0xec07ac[_0x10ad23];_0x324ce9['active']=![];_0x324ce9[_0x1ce1('0x48')]=moment()[_0x1ce1('0x49')](_0x439df0,_0x1ce1('0x4a'))[_0x1ce1('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x324ce9[_0x1ce1('0x14')]=_0xec07ac[_0x1ce1('0x14')];_0x324ce9[_0x1ce1('0x4b')]=_0xec07ac[_0x1ce1('0x4b')];_0x324ce9[_0x1ce1('0x15')]=_0xec07ac['VoiceQueueId']||undefined;return _0x324ce9;};exports[_0x1ce1('0x4c')]=function(_0x552c0a,_0x1e1957){if(!_[_0x1ce1('0xf')](_0x552c0a)){if(_0x552c0a[_0x1ce1('0x4d')]>0x0){_0x552c0a[_0x1ce1('0x4d')]-=0x1;}else{logger[_0x1ce1('0x5')](_0x1e1957,_0x1ce1('0x4e'));}}else{logger[_0x1ce1('0x5')](_0x1e1957,_0x1ce1('0x4f'));}};exports[_0x1ce1('0x50')]=function(_0xfaf4a9){if(_0xfaf4a9<=0x0){return!![];}return![];};function buildObj(_0x52ffb4,_0x2b4074,_0x39c020){_0x52ffb4['lastevent']=_0x2b4074;_0x52ffb4[_0x1ce1('0x51')]=_0x52ffb4['queue'];_0x52ffb4['interface']=_0x52ffb4[_0x1ce1('0x52')];_0x52ffb4[_0x1ce1('0x53')]='voice';if(_0x39c020){_0x52ffb4['mandatoryDisposition']=_0x39c020[_0x1ce1('0x54')];}return _0x52ffb4;}exports[_0x1ce1('0x55')]=buildObj;exports[_0x1ce1('0x56')]=function(_0x827fc8){var _0x57c8ff={};_0x57c8ff['queue']=_0x827fc8[_0x1ce1('0x57')];_0x57c8ff['interface']=_0x827fc8[_0x1ce1('0x52')];_0x57c8ff[_0x1ce1('0x3c')]=_0x827fc8['uniqueid'];return _0x57c8ff;};exports[_0x1ce1('0x58')]=function(_0x486a35){var _0x2dc179=[];for(var _0x57926b in _0x486a35){if(_0x486a35[_0x1ce1('0x24')](_0x57926b)){if(!_[_0x1ce1('0xf')](_0x486a35[_0x57926b])&&_0x486a35[_0x57926b][_0x1ce1('0x30')]===_0x1ce1('0x59')&&_0x486a35[_0x57926b][_0x1ce1('0x5a')]===_0x1ce1('0x5b')){_0x2dc179[_0x1ce1('0x5c')](_0x486a35[_0x57926b]['id']);}}}return _0x2dc179;};exports[_0x1ce1('0x5d')]=function(_0x52f9ef){var _0x53889c=moment()['milliseconds'](0x0);var _0x5681fc=moment(_0x52f9ef)['milliseconds'](0x0);return _0x53889c[_0x1ce1('0x5e')](_0x5681fc,_0x1ce1('0x5f'));};exports['createBody']=function(_0x206408){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x206408[_0x1ce1('0x14')],'ListId':_0x206408[_0x1ce1('0x4b')],'VoiceQueueId':_0x206408['VoiceQueueId']||undefined,'CampaignId':_0x206408['CampaignId']||undefined};};exports[_0x1ce1('0x60')]=function(_0x423a89){if(_0x423a89==='uniqueid'||_0x423a89==='idContact'||_0x423a89===_0x1ce1('0x57')||_0x423a89===_0x1ce1('0x61')||_0x423a89===_0x1ce1('0x62')||_0x423a89===_0x1ce1('0x63')||_0x423a89===_0x1ce1('0x33')||_0x423a89===_0x1ce1('0x52')||_0x423a89===_0x1ce1('0x12')||_0x423a89==='active'||_0x423a89===_0x1ce1('0x13')||_0x423a89===_0x1ce1('0x48')||_0x423a89==='countbusyretry'||_0x423a89===_0x1ce1('0x40')||_0x423a89===_0x1ce1('0x41')||_0x423a89===_0x1ce1('0x64')||_0x423a89==='callback'||_0x423a89===_0x1ce1('0x65')||_0x423a89==='callbackat'||_0x423a89===_0x1ce1('0x66')||_0x423a89==='ContactId'||_0x423a89===_0x1ce1('0x4b')||_0x423a89==='UserId'||_0x423a89===_0x1ce1('0x15')||_0x423a89===_0x1ce1('0x67')||_0x423a89===_0x1ce1('0x68')||_0x423a89==='xmd-queue'||_0x423a89===_0x1ce1('0x69')||_0x423a89===_0x1ce1('0x6a')||_0x423a89===_0x1ce1('0x6b')||_0x423a89===_0x1ce1('0x6c')||_0x423a89===_0x1ce1('0x6d')||_0x423a89===_0x1ce1('0x6e')||_0x423a89===_0x1ce1('0x6f')||_0x423a89==='xmd-contactid'||_0x423a89===_0x1ce1('0x70')||_0x423a89===_0x1ce1('0x71')||_0x423a89===_0x1ce1('0x72')||_0x423a89===_0x1ce1('0x73')||_0x423a89===_0x1ce1('0x74')||_0x423a89===_0x1ce1('0x75')||_0x423a89===_0x1ce1('0x76')||_0x423a89==='rtpaudioqosjitterbridged'||_0x423a89==='rtpaudioqosloss'||_0x423a89===_0x1ce1('0x77')||_0x423a89===_0x1ce1('0x78')||_0x423a89==='rtpaudioqosrttbridged'||_0x423a89==='rtpaudioqos'||_0x423a89==='rtpaudioqosbridged'||_0x423a89===_0x1ce1('0x76')||_0x423a89===_0x1ce1('0x79')||_0x423a89==='rtpaudioqosloss'||_0x423a89===_0x1ce1('0x77')||_0x423a89===_0x1ce1('0x78')||_0x423a89===_0x1ce1('0x7a')||_0x423a89===_0x1ce1('0x7b')||_0x423a89==='bridgepvtcallid'||_0x423a89==='state'||_0x423a89===_0x1ce1('0x2a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x231755,_0x5e5bdf){var _0x4f56be,_0x592be3,_0x2100b2;if(_0x5e5bdf<=0x0){_0x5e5bdf=0x1;}_0x4f56be=new RegExp(_0x1ce1('0x7c')+_0x5e5bdf+'}$');_0x592be3=Math['pow'](0xa,_0x5e5bdf-0x1);_0x2100b2=Math[_0x1ce1('0x7d')](0xa,_0x5e5bdf)-0x1;return util[_0x1ce1('0x11')]('%s',_[_0x1ce1('0x7e')](_0x231755,_0x4f56be,_[_0x1ce1('0x7f')](_0x592be3,_0x2100b2)));};exports[_0x1ce1('0x80')]=function(_0x28503c){var _0x300e38=_0x28503c[_0x1ce1('0x81')](/"(.*?)"/);return _0x300e38?_0x300e38[0x1]:_0x28503c;};exports[_0x1ce1('0x82')]=function(_0x3fd927){var _0x428c13=_0x3fd927[_0x1ce1('0x81')](/<(.*?)>/);return _0x428c13?_0x428c13[0x1]:_0x3fd927;};function buildNoAnswerEventPayload(_0xe8d9c1,_0x1b6501){var _0x1d3f88=buildObj(_0xe8d9c1,_0x1ce1('0x83'));if(!_['isEmpty'](_0x1b6501[_0x1ce1('0x84')])){Object['keys'](_0x1b6501[_0x1ce1('0x84')])[_0x1ce1('0x85')](function(_0x185c9e){_0x1d3f88[_0x185c9e[_0x1ce1('0x86')]()]=_0x1b6501[_0x1ce1('0x84')][_0x185c9e];});}return _0x1d3f88;}exports[_0x1ce1('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 98f6d0e..4f9ccac 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 _0x6491=['number','boolean','queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0xce3465,_0x2299f7){var _0x329e9e=function(_0x2eb64e){while(--_0x2eb64e){_0xce3465['push'](_0xce3465['shift']());}};_0x329e9e(++_0x2299f7);}(_0x6491,0x9f));var _0x1649=function(_0x4b0af8,_0x21ea2c){_0x4b0af8=_0x4b0af8-0x0;var _0x5db4c8=_0x6491[_0x4b0af8];return _0x5db4c8;};'use strict';exports['queueadd']={'queue':{'type':_0x1649('0x0'),'required':!![]},'interface':{'type':_0x1649('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x1649('0x1'),'required':![]},'paused':{'type':_0x1649('0x2'),'required':![]}};exports[_0x1649('0x3')]={'queue':{'type':_0x1649('0x0'),'required':!![]},'interface':{'type':_0x1649('0x0'),'required':!![]}};exports[_0x1649('0x4')]={'interface':{'type':_0x1649('0x0'),'required':!![]},'paused':{'type':_0x1649('0x2')},'reason':{'type':_0x1649('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x1649('0x0'),'required':![]}};exports[_0x1649('0x5')]={'uniqueid':{'type':_0x1649('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x1649('0x0')},'mixmonitorid':{'type':_0x1649('0x0')}};exports[_0x1649('0x6')]={'uniqueid':{'type':_0x1649('0x0'),'required':!![]}};exports[_0x1649('0x7')]={'uniqueid':{'type':_0x1649('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x1649('0x0')}}; \ No newline at end of file +var _0xb1a8=['voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x4b4b1a,_0x276dd5){var _0x5056ec=function(_0x362ac7){while(--_0x362ac7){_0x4b4b1a['push'](_0x4b4b1a['shift']());}};_0x5056ec(++_0x276dd5);}(_0xb1a8,0x19b));var _0x8b1a=function(_0x529f16,_0xe289ae){_0x529f16=_0x529f16-0x0;var _0x953437=_0xb1a8[_0x529f16];return _0x953437;};'use strict';exports[_0x8b1a('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b1a('0x1'),'required':!![]},'membername':{'type':_0x8b1a('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8b1a('0x2'),'required':![]}};exports[_0x8b1a('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x4')]={'interface':{'type':_0x8b1a('0x1'),'required':!![]},'paused':{'type':_0x8b1a('0x2')},'reason':{'type':_0x8b1a('0x1'),'required':![]}};exports[_0x8b1a('0x5')]={'module':{'type':_0x8b1a('0x1'),'required':![]}};exports[_0x8b1a('0x6')]={'uniqueid':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8b1a('0x1')},'format':{'type':_0x8b1a('0x1')},'mixmonitorid':{'type':_0x8b1a('0x1')}};exports[_0x8b1a('0x8')]={'uniqueid':{'type':_0x8b1a('0x1'),'required':!![]}};exports[_0x8b1a('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8b1a('0x1'),'required':!![]},'context':{'type':_0x8b1a('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3d1fb3f..376865f 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x40365e,_0xf0ca06){var _0x4b81c3=function(_0xdc994d){while(--_0xdc994d){_0x40365e['push'](_0x40365e['shift']());}};_0x4b81c3(++_0xf0ca06);}(_0xadb5,0xad));var _0x5adb=function(_0x2b5d6b,_0x3e2934){_0x2b5d6b=_0x2b5d6b-0x0;var _0xeb2f1a=_0xadb5[_0x2b5d6b];return _0xeb2f1a;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../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/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2032,0xd9));var _0x2203=function(_0x5bd9b8,_0x26a8a4){_0x5bd9b8=_0x5bd9b8-0x0;var _0x472100=_0x2032[_0x5bd9b8];return _0x472100;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 102a0c1..ff91f86 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8e2=['hasOwnProperty','assign'];(function(_0xbca422,_0x373d86){var _0x590408=function(_0x2fad2c){while(--_0x2fad2c){_0xbca422['push'](_0xbca422['shift']());}};_0x590408(++_0x373d86);}(_0xa8e2,0xe9));var _0x2a8e=function(_0xbbf0bc,_0x5c8ae2){_0xbbf0bc=_0xbbf0bc-0x0;var _0x2cb5f4=_0xa8e2[_0xbbf0bc];return _0x2cb5f4;};'use strict';function mergeDBDataToRealtime(_0x2f44d2,_0x4f684b){var _0x5d7452=Object[_0x2a8e('0x0')]({},_0x2f44d2);for(var _0x49b8bb in _0x4f684b){if(_0x5d7452[_0x2a8e('0x1')](_0x49b8bb)){_0x5d7452[_0x49b8bb]=_0x4f684b[_0x49b8bb];}}return _0x5d7452;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x23fd=['mergeDBDataToRealtime'];(function(_0x2d058a,_0x18f217){var _0x220d8f=function(_0x3523d9){while(--_0x3523d9){_0x2d058a['push'](_0x2d058a['shift']());}};_0x220d8f(++_0x18f217);}(_0x23fd,0x7a));var _0xd23f=function(_0x4da3a6,_0x3c67c3){_0x4da3a6=_0x4da3a6-0x0;var _0x4fa4b2=_0x23fd[_0x4da3a6];return _0x4fa4b2;};'use strict';function mergeDBDataToRealtime(_0xd8b28c,_0x54ac82){var _0x9572c3=Object['assign']({},_0xd8b28c);for(var _0x3dc17f in _0x54ac82){if(_0x9572c3['hasOwnProperty'](_0x3dc17f)){_0x9572c3[_0x3dc17f]=_0x54ac82[_0x3dc17f];}}return _0x9572c3;}exports[_0xd23f('0x0')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f15e5bb..030c302 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 _0x69c2=['custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','name','accountcode','format','length','connectedlinenum','lastAssignedTo','interface','isNil','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','channel','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfereelinkedid','transfers','getCallType','UserId','split','membername','monitors','filename','createdAt','calleridname','connectedlinename','exten','isArray','Local','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0x42d221,_0x4ce4c2){var _0x183ef7=function(_0x3ba725){while(--_0x3ba725){_0x42d221['push'](_0x42d221['shift']());}};_0x183ef7(++_0x4ce4c2);}(_0x69c2,0x154));var _0x269c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x269c('0x0'));var moment=require(_0x269c('0x1'));var util=require(_0x269c('0x2'));var config=require(_0x269c('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x269c('0x4'));var RpcVoiceDialReport=require(_0x269c('0x5'));var RpcMemberReport=require(_0x269c('0x6'));var RpcVoiceQueueReport=require(_0x269c('0x7'));var RpcVoiceRecording=require(_0x269c('0x8'));var RpcVoiceTransferReport=require(_0x269c('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x269c('0xa'));var VoiceDialReport=require(_0x269c('0xb'));var UserReport=require(_0x269c('0xc'));function Report(_0x27e4f3){this[_0x269c('0xd')]=_0x27e4f3;this[_0x269c('0xe')]=_0x27e4f3[_0x269c('0xe')];this[_0x269c('0xf')]=_0x27e4f3[_0x269c('0xf')];}Report[_0x269c('0x10')][_0x269c('0x11')]=function(_0x20a39e){var _0x5b4b86=new VoiceQueueReport(this[_0x269c('0xd')]);var _0x37c8fd=new VoiceAgentReport(this[_0x269c('0xd')]);var _0x3a2667=new VoiceDialReport(this[_0x269c('0xd')]);var _0x471319=new VoiceCallReport(this[_0x269c('0xd')]);var _0x26b487=new UserReport(this[_0x269c('0xd')]);if(config[_0x269c('0x12')]&&config[_0x269c('0x12')][_0x269c('0x13')]){ami['on'](_0x269c('0x14'),this[_0x269c('0x15')][_0x269c('0x16')](this));ami['on'](_0x269c('0x17'),this[_0x269c('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x269c('0x19')][_0x269c('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x269c('0x1a')][_0x269c('0x16')](this));ami['on']('blindtransfer',this[_0x269c('0x1b')]['bind'](this));ami['on'](_0x269c('0x1c'),this['attendedTransfer'][_0x269c('0x16')](this));}};Report[_0x269c('0x10')][_0x269c('0x1d')]=function(_0x7bda37){var _0x4b41a4;_0x4b41a4=_[_0x269c('0x1e')](this['agents'],function(_0x584b13){return _0x584b13['accountcode']==_0x7bda37||_0x584b13[_0x269c('0x1f')]==_0x7bda37;});if(_['isNil'](_0x4b41a4)){var _0x438b78=_[_0x269c('0x1e')](this[_0x269c('0xf')],function(_0x3623f1){return _0x3623f1[_0x269c('0x20')]==_0x7bda37||_0x3623f1['name']==_0x7bda37;});if(_0x438b78){_0x4b41a4=_[_0x269c('0x1e')](this['agents'],function(_0x1c3f26){return _0x1c3f26['interface']==util[_0x269c('0x21')]('SIP/%s',_0x438b78['name']);});}}return _0x4b41a4;};Report[_0x269c('0x10')]['voiceQueueReport']=function(_0x1118c9){for(var _0x4d933e=0x0;_0x4d933e<_0x1118c9[_0x269c('0x22')];_0x4d933e+=0x1){var _0x148795=this[_0x269c('0x1d')](_0x1118c9[_0x4d933e][_0x269c('0x23')]);if(_0x148795){_0x1118c9[_0x4d933e][_0x269c('0x20')]=_0x148795[_0x269c('0x20')];_0x1118c9[_0x4d933e]['assigned']=!![];_0x1118c9[_0x4d933e][_0x269c('0x24')]=_0x148795['name'];_0x1118c9[_0x4d933e][_0x269c('0x25')]=_[_0x269c('0x26')](_0x148795[_0x269c('0x25')])?util[_0x269c('0x21')](_0x269c('0x27'),_0x148795[_0x269c('0x1f')]):_0x148795['interface'];if(_0x1118c9[_0x4d933e]['queuecallercomplete']){_0x1118c9[_0x4d933e][_0x269c('0x28')]=moment()[_0x269c('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1118c9[_0x4d933e][_0x269c('0x29')]){_0x1118c9[_0x4d933e][_0x269c('0x2a')]=moment()[_0x269c('0x21')](_0x269c('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x1118c9[_0x4d933e]);}RpcVoiceQueueReport[_0x269c('0x2c')](_0x1118c9[_0x4d933e]);}};function extractCalleridNumber(_0x2dcf8d){var _0x500681=_0x2dcf8d[_0x269c('0x2d')](/<(.*?)>/);return _0x500681?_0x500681[0x1]:_0x2dcf8d;}Report['prototype'][_0x269c('0x2e')]=function(_0x442ee9){for(var _0x1e699f=0x0;_0x1e699f','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','type','UserId','membername','monitor','monitors','filename','createdAt','connectedlinename','exten','isArray'];(function(_0x497a85,_0x2bd7cf){var _0x33207e=function(_0x56e9ec){while(--_0x56e9ec){_0x497a85['push'](_0x497a85['shift']());}};_0x33207e(++_0x2bd7cf);}(_0x83f8,0x1df));var _0x883f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x83f8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x883f('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x883f('0x1'));var ami=require(_0x883f('0x2'));var RpcVoiceAgentReport=require(_0x883f('0x3'));var RpcVoiceCallReport=require(_0x883f('0x4'));var RpcVoiceDialReport=require(_0x883f('0x5'));var RpcMemberReport=require(_0x883f('0x6'));var RpcVoiceQueueReport=require(_0x883f('0x7'));var RpcVoiceRecording=require(_0x883f('0x8'));var RpcVoiceTransferReport=require(_0x883f('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x883f('0xa'));var VoiceAgentReport=require(_0x883f('0xb'));var VoiceDialReport=require(_0x883f('0xc'));var UserReport=require(_0x883f('0xd'));function Report(_0x40b47a){this[_0x883f('0xe')]=_0x40b47a;this[_0x883f('0xf')]=_0x40b47a[_0x883f('0xf')];this['telephones']=_0x40b47a['telephones'];}Report['prototype'][_0x883f('0x10')]=function(_0x5d299d){var _0x201ded=new VoiceQueueReport(this[_0x883f('0xe')]);var _0x5d109e=new VoiceAgentReport(this[_0x883f('0xe')]);var _0x11f08c=new VoiceDialReport(this[_0x883f('0xe')]);var _0x693d8=new VoiceCallReport(this[_0x883f('0xe')]);var _0x484c7a=new UserReport(this['realtime']);if(config[_0x883f('0x11')]&&config['xdr'][_0x883f('0x12')]){ami['on'](_0x883f('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x883f('0x14'),this[_0x883f('0x15')][_0x883f('0x16')](this));ami['on'](_0x883f('0x17'),this[_0x883f('0x18')][_0x883f('0x16')](this));ami['on'](_0x883f('0x19'),this[_0x883f('0x1a')][_0x883f('0x16')](this));ami['on'](_0x883f('0x1b'),this[_0x883f('0x1c')]['bind'](this));ami['on'](_0x883f('0x1d'),this[_0x883f('0x1e')]['bind'](this));}};Report[_0x883f('0x1f')]['findAgent']=function(_0x2198ae){var _0x9578e8;_0x9578e8=_[_0x883f('0x20')](this[_0x883f('0xf')],function(_0x184dc4){return _0x184dc4[_0x883f('0x21')]==_0x2198ae||_0x184dc4['name']==_0x2198ae;});if(_['isNil'](_0x9578e8)){var _0x180355=_[_0x883f('0x20')](this[_0x883f('0x22')],function(_0x52b24b){return _0x52b24b['accountcode']==_0x2198ae||_0x52b24b['name']==_0x2198ae;});if(_0x180355){_0x9578e8=_[_0x883f('0x20')](this[_0x883f('0xf')],function(_0x204ee2){return _0x204ee2[_0x883f('0x23')]==util[_0x883f('0x24')](_0x883f('0x25'),_0x180355['name']);});}}return _0x9578e8;};Report['prototype'][_0x883f('0x26')]=function(_0x26e615){for(var _0x32dc43=0x0;_0x32dc43<_0x26e615['length'];_0x32dc43+=0x1){var _0x1a06ac=this['findAgent'](_0x26e615[_0x32dc43][_0x883f('0x27')]);if(_0x1a06ac){_0x26e615[_0x32dc43][_0x883f('0x21')]=_0x1a06ac[_0x883f('0x21')];_0x26e615[_0x32dc43]['assigned']=!![];_0x26e615[_0x32dc43]['lastAssignedTo']=_0x1a06ac[_0x883f('0x28')];_0x26e615[_0x32dc43]['interface']=_['isNil'](_0x1a06ac[_0x883f('0x23')])?util[_0x883f('0x24')](_0x883f('0x25'),_0x1a06ac[_0x883f('0x28')]):_0x1a06ac[_0x883f('0x23')];if(_0x26e615[_0x32dc43][_0x883f('0x29')]){_0x26e615[_0x32dc43]['queuecallercompleteAt']=moment()[_0x883f('0x24')](_0x883f('0x2a'));}if(_0x26e615[_0x32dc43][_0x883f('0x2b')]){_0x26e615[_0x32dc43][_0x883f('0x2c')]=moment()[_0x883f('0x24')](_0x883f('0x2a'));}RpcMemberReport[_0x883f('0x26')](_0x26e615[_0x32dc43]);}RpcVoiceQueueReport[_0x883f('0x2d')](_0x26e615[_0x32dc43]);}};function extractCalleridNumber(_0x4f8492){var _0x179d8c=_0x4f8492['match'](/<(.*?)>/);return _0x179d8c?_0x179d8c[0x1]:_0x4f8492;}Report[_0x883f('0x1f')][_0x883f('0x2e')]=function(_0x24ba5b){for(var _0x5cb9aa=0x0;_0x5cb9aa0x0?!![]:![];if(!_0x1a537b){return this['syncQueueSummaryComplete'](this[_0xab58('0x13')]['completeEvent']);}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x6d')]=function(_0x2c6fab){var _0x474166=this[_0xab58('0x13')]['id'];if(this[_0xab58('0x13')][_0xab58('0x5f')][_0x474166]&&this[_0xab58('0x13')][_0xab58('0x5f')][_0x474166][_0x2c6fab[_0xab58('0x5e')]]){this[_0xab58('0x13')]['queuestatus'][_0x474166][_0x2c6fab[_0xab58('0x5e')]]['agents'][_0xab58('0x6e')](_0x2c6fab);}};VoiceQueueReport[_0xab58('0xc')]['syncQueueSummary']=function(_0x19e300){var _0x137146=this;try{if(this[_0xab58('0x6f')](_0x19e300)&&this[_0xab58('0x6f')](_0x19e300['queue'])){logger['debug'](_0xab58('0x70'),util['inspect'](_0x19e300,{'showHidden':![],'depth':null}));var _0x59553f=this[_0xab58('0x11')][_0x19e300[_0xab58('0x51')]];if(_0x59553f){logger[_0xab58('0x4c')](_0xab58('0x71'),_0x59553f[_0xab58('0x63')]);this[_0xab58('0x13')][_0xab58('0x62')][_0x59553f[_0xab58('0x63')]]={'summaryEvent':_0x19e300};this['summary'][_0xab58('0x6c')]+=0x1;return ami['Action']({'action':_0xab58('0x5f'),'queue':_0x59553f['name']})['then'](function(_0xd1554f){if(!_0x137146[_0xab58('0x13')][_0xab58('0x5f')][_0x19e300['actionid']]){_0x137146[_0xab58('0x13')][_0xab58('0x5f')][_0x19e300[_0xab58('0x5e')]]={};}_0x137146['summary'][_0xab58('0x5f')][_0x19e300[_0xab58('0x5e')]][_0xd1554f['actionid']]={'queue':_0x59553f[_0xab58('0x63')],'agents':[]};})[_0xab58('0x60')](function(_0x199968){throw _0x199968;});}}}catch(_0x2df1ba){logger['error'](_0xab58('0x72'),util[_0xab58('0x41')](_0x2df1ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x17')]=function(_0x2b5abb){if(this[_0xab58('0x13')][_0xab58('0x6c')]>0x0){this[_0xab58('0x13')][_0xab58('0x73')]=_0x2b5abb;return;}logger[_0xab58('0x4c')](_0xab58('0x74'),util[_0xab58('0x41')](_0x2b5abb,{'showHidden':![],'depth':null}));this[_0xab58('0x13')]=initializeSummary();ami[_0xab58('0x4a')](_0xab58('0x75'),{});};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x1b')]=function(_0x3dc65d){try{if(this[_0xab58('0x6f')](_0x3dc65d)){logger[_0xab58('0x4c')](_0xab58('0x76'),_0x3dc65d[_0xab58('0x4e')],util[_0xab58('0x41')](_0x3dc65d,{'showHidden':![],'depth':null}));if(_[_0xab58('0x5a')](this[_0xab58('0x42')][_0x3dc65d[_0xab58('0x4e')]])){this[_0xab58('0x42')][_0x3dc65d[_0xab58('0x4e')]]=[];}if(_[_0xab58('0x5a')](this[_0xab58('0xf')][_0x3dc65d[_0xab58('0x4e')]])){this[_0xab58('0xf')][_0x3dc65d[_0xab58('0x4e')]]={};}var _0x1775eb=new QueueReport();_0x1775eb[_0xab58('0x51')]=_0x3dc65d[_0xab58('0x51')];_0x1775eb[_0xab58('0x69')]=this[_0xab58('0x11')][_0x1775eb[_0xab58('0x51')]]&&this[_0xab58('0x11')][_0x1775eb[_0xab58('0x51')]]['type']?this['voiceQueues'][_0x1775eb[_0xab58('0x51')]][_0xab58('0x69')]||_0xab58('0x6a'):_0xab58('0x6a');_0x1775eb['queuecallerjoinAt']=moment()['format'](_0xab58('0x77'));_0x1775eb[_0xab58('0x78')]=_0x3dc65d[_0xab58('0x78')];_0x1775eb[_0xab58('0x79')]=_0x3dc65d['count'];_0x1775eb[_0xab58('0x4e')]=_0x3dc65d['uniqueid'];_0x1775eb[_0xab58('0x7a')]=this[_0xab58('0xf')][_0x3dc65d[_0xab58('0x4e')]][_0xab58('0x7a')];logger[_0xab58('0x7b')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1775eb[_0xab58('0x51')],_0x1775eb[_0xab58('0x69')]);Object['assign'](_0x1775eb,_[_0xab58('0x7c')](_0x3dc65d,_['keys'](_0x1775eb)));this[_0xab58('0x42')][_0x3dc65d['uniqueid']][_0xab58('0x6e')](_0x1775eb);this[_0xab58('0xf')][_0x3dc65d[_0xab58('0x4e')]]=_0x1775eb;this[_0xab58('0x4b')](_0x1775eb,'queuecallerjoin');}}catch(_0x168fbc){logger[_0xab58('0x40')](_0xab58('0x76'),_0x3dc65d['uniqueid'],util[_0xab58('0x41')](_0x168fbc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x1d')]=function(_0x59b93d){try{if(this[_0xab58('0x6f')](_0x59b93d)){logger[_0xab58('0x4c')](_0xab58('0x7d'),_0x59b93d[_0xab58('0x4e')],util[_0xab58('0x41')](_0x59b93d,{'showHidden':![],'depth':null}));if(this[_0xab58('0x42')][_0x59b93d[_0xab58('0x4e')]]){var _0x36d0cb=_['last'](this[_0xab58('0x42')][_0x59b93d[_0xab58('0x4e')]]);_0x36d0cb['queuecallercomplete']=![];_0x36d0cb[_0xab58('0x7e')]=null;_0x36d0cb['holdtime']=_0x59b93d[_0xab58('0x7f')];_0x36d0cb[_0xab58('0x80')]=_0x59b93d[_0xab58('0x80')];_0x36d0cb[_0xab58('0x1c')]=!![];_0x36d0cb[_0xab58('0x81')]=moment()['format'](_0xab58('0x77'));_0x36d0cb[_0xab58('0x54')]=_0xab58('0x82');_0x36d0cb[_0xab58('0x83')]=null;logger[_0xab58('0x7b')](_0xab58('0x84'),_0x36d0cb['queue'],_0x36d0cb[_0xab58('0x69')]);this[_0xab58('0xf')][_0x59b93d['uniqueid']]=_0x36d0cb;this['emitVoiceQueueChannelRemove'](_0x36d0cb,'queuecallerabandon');}}}catch(_0x469836){logger[_0xab58('0x40')](_0xab58('0x7d'),_0x59b93d['uniqueid'],util['inspect'](_0x469836,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x1f')]=function(_0x469c03){try{if(this[_0xab58('0x6f')](_0x469c03)){logger[_0xab58('0x4c')]('[%s][voiceQueueReport][queuecallerleave]',_0x469c03[_0xab58('0x4e')],util[_0xab58('0x41')](_0x469c03,{'showHidden':![],'depth':null}));if(this[_0xab58('0x42')][_0x469c03[_0xab58('0x4e')]]){var _0x36689e=_[_0xab58('0x85')](this['queueReports'][_0x469c03[_0xab58('0x4e')]]);_0x36689e[_0xab58('0x86')]=moment()[_0xab58('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x36689e[_0xab58('0x87')]=_0x469c03[_0xab58('0x87')];_0x36689e[_0xab58('0x88')]=_0x469c03[_0xab58('0x88')];logger[_0xab58('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x36689e['queue'],_0x36689e[_0xab58('0x69')],_0x469c03[_0xab58('0x87')],_0x469c03[_0xab58('0x88')]);this['channels'][_0x469c03['uniqueid']]=_0x36689e;this['emitVoiceQueueChannelSave'](_0x36689e,'queuecallerleave');}}}catch(_0x1fd9c5){logger[_0xab58('0x40')](_0xab58('0x89'),_0x469c03[_0xab58('0x4e')],util[_0xab58('0x41')](_0x1fd9c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x8a')]=function(_0x38368f){try{if(this['isNotNull'](_0x38368f)){logger[_0xab58('0x4c')]('[%s][voiceQueueReport][agentconnect]',_0x38368f[_0xab58('0x4e')],util[_0xab58('0x41')](_0x38368f,{'showHidden':![],'depth':null}));if(this[_0xab58('0x42')][_0x38368f[_0xab58('0x4e')]]){var _0x23c91a=_[_0xab58('0x85')](this['queueReports'][_0x38368f[_0xab58('0x4e')]]);_0x23c91a[_0xab58('0x39')]=!![];_0x23c91a[_0xab58('0x54')]='COMPLETEDBYAGENT';logger[_0xab58('0x7b')](_0xab58('0x8b'),_0x23c91a['queue'],_0x23c91a['type']);}}}catch(_0x5c61e7){logger['error'](_0xab58('0x8c'),_0x38368f['uniqueid'],util[_0xab58('0x41')](_0x5c61e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0x21')]=function(_0x246b37){try{if(this[_0xab58('0x6f')](_0x246b37)){logger[_0xab58('0x4c')](_0xab58('0x8d'),_0x246b37[_0xab58('0x4e')],util[_0xab58('0x41')](_0x246b37,{'showHidden':![],'depth':null}));if(this[_0xab58('0x42')][_0x246b37[_0xab58('0x4e')]]){var _0x4ffa01=_[_0xab58('0x85')](this[_0xab58('0x42')][_0x246b37[_0xab58('0x4e')]]);_0x4ffa01[_0xab58('0x1c')]=![];_0x4ffa01[_0xab58('0x81')]=null;_0x4ffa01[_0xab58('0x8e')]=!![];_0x4ffa01['lastAssignedTo']=_0x246b37['membername'];_0x4ffa01[_0xab58('0x7f')]=_0x246b37[_0xab58('0x7f')];_0x4ffa01[_0xab58('0x39')]=!![];_0x4ffa01['queuecallerexit']=![];_0x4ffa01[_0xab58('0x8f')]=null;if(!_0x4ffa01[_0xab58('0x90')]){if(_0x246b37[_0xab58('0x91')]=='transfer'){_0x4ffa01['queuecallerexitreason']=_0xab58('0x92');logger[_0xab58('0x7b')](_0xab58('0x93'),_0x4ffa01['queue'],_0x4ffa01[_0xab58('0x69')]);}else{if(_['startsWith'](_0x246b37[_0xab58('0x3e')][_0xab58('0x94')](),_0xab58('0x95'))){if(this[_0xab58('0x42')][_0x246b37[_0xab58('0x96')]]){var _0xdbb695=_[_0xab58('0x85')](this['queueReports'][_0x246b37[_0xab58('0x96')]]);_0xdbb695[_0xab58('0x39')]=![];_0xdbb695[_0xab58('0x38')]=!![];_0xdbb695[_0xab58('0x8f')]=moment(_0x4ffa01['queuecallerjoinAt'])[_0xab58('0x97')](_0x246b37[_0xab58('0x7f')],_0xab58('0x98'))[_0xab58('0x4f')](_0xab58('0x77'));_0xdbb695[_0xab58('0x54')]=_0xab58('0x99');_0xdbb695[_0xab58('0x90')]=!![];_0xdbb695[_0xab58('0x9a')]=_0xab58('0x9b');_0xdbb695['transferexten']=_0x246b37['destexten'];_0xdbb695[_0xab58('0x9c')]=_0x246b37[_0xab58('0x4e')];logger[_0xab58('0x7b')](_0xab58('0x9d'),_0xdbb695[_0xab58('0x51')],_0xdbb695[_0xab58('0x69')]);var _0xfa8cb3=this[_0xab58('0x42')][_0x246b37[_0xab58('0x96')]];this['queueReports'][_0x246b37['linkedid']]=this[_0xab58('0x42')][_0x246b37[_0xab58('0x4e')]];this[_0xab58('0x42')][_0x246b37[_0xab58('0x4e')]]=_0xfa8cb3;}}else{_0x4ffa01[_0xab58('0x54')]=_0xab58('0x9e')+_0x246b37[_0xab58('0x91')][_0xab58('0x9f')]();logger[_0xab58('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4ffa01[_0xab58('0x51')],_0x4ffa01[_0xab58('0x69')],_0x4ffa01[_0xab58('0x54')]);}}}this[_0xab58('0xf')][_0x246b37[_0xab58('0x4e')]]=_0x4ffa01;}}}catch(_0x4d4087){logger[_0xab58('0x40')](_0xab58('0x8d'),_0x246b37[_0xab58('0x4e')],util['inspect'](_0x4d4087,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')]['syncVarSet']=function(_0x1c9b68){try{if(this['isNotNull'](_0x1c9b68)){logger[_0xab58('0x4c')](_0xab58('0xa0'),_0x1c9b68['uniqueid'],util[_0xab58('0x41')](_0x1c9b68,{'showHidden':![],'depth':null}));this[_0xab58('0xa1')](_0x1c9b68[_0xab58('0x4e')],_[_0xab58('0xa2')](_0x1c9b68[_0xab58('0xa3')])[0x0],_0x1c9b68['value']);if(this['queueReports'][_0x1c9b68['uniqueid']]){var _0x22bc0c=_['last'](this[_0xab58('0x42')][_0x1c9b68[_0xab58('0x4e')]]);if(_0x22bc0c){if(this[_0xab58('0x6f')](_0x1c9b68['variable'])&&this[_0xab58('0x6f')](_0x1c9b68[_0xab58('0xa3')][_0xab58('0x5f')])){switch(_0x1c9b68['value']){case'CONTINUE':_0x22bc0c[_0xab58('0x38')]=![];_0x22bc0c[_0xab58('0x8f')]=null;break;case _0xab58('0xa4'):_0x22bc0c[_0xab58('0xa5')]=_0xab58('0xa6');_0x22bc0c[_0xab58('0x38')]=!![];_0x22bc0c[_0xab58('0x8f')]=moment()[_0xab58('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x22bc0c[_0xab58('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xab58('0x4c')](_0xab58('0xa7'),_0x1c9b68['uniqueid'],util[_0xab58('0x41')](_0x22bc0c,{'showHidden':![],'depth':null}));ami[_0xab58('0x4a')]('custom:timeout',_0x22bc0c);break;default:_0x22bc0c[_0xab58('0x38')]=!![];_0x22bc0c['queuecallerexitAt']=moment()[_0xab58('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x22bc0c[_0xab58('0x86')]=moment()[_0xab58('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x22bc0c[_0xab58('0x1c')]=![];_0x22bc0c[_0xab58('0x81')]=null;_0x22bc0c[_0xab58('0x54')]=_0x1c9b68['value'];this['channels'][_0x1c9b68[_0xab58('0x4e')]]=_0x22bc0c;this[_0xab58('0x48')](_0x22bc0c,_0xab58('0x22'));}else if(this[_0xab58('0x6f')](_0x1c9b68[_0xab58('0xa3')])&&this[_0xab58('0x6f')](_0x1c9b68[_0xab58('0xa3')][_0xab58('0xa8')])){if(!_0x22bc0c[_0xab58('0x1c')]){_0x22bc0c['queuecallerexit']=!![];_0x22bc0c[_0xab58('0x8f')]=moment()[_0xab58('0x4f')](_0xab58('0x77'));_0x22bc0c[_0xab58('0x54')]='EXITWITHKEY';_0x22bc0c[_0xab58('0x86')]=moment()[_0xab58('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xab58('0xf')][_0x1c9b68['uniqueid']]=_0x22bc0c;}}logger[_0xab58('0x7b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1c9b68[_0xab58('0x4e')],_0x22bc0c[_0xab58('0x51')],_0x22bc0c['type'],_[_0xab58('0xa2')](_0x1c9b68['variable'])[0x0],_0x1c9b68[_0xab58('0xa9')]);_0x22bc0c[_0xab58('0x44')]=this['variables'][_0x1c9b68[_0xab58('0x4e')]];}}}}catch(_0x525a1e){logger[_0xab58('0x40')](_0xab58('0xa0'),_0x1c9b68[_0xab58('0x4e')],util[_0xab58('0x41')](_0x525a1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xab58('0xc')]['addVariable']=function(_0x41654a,_0x10354d,_0x215b8a){var _0x1b9242=[_0xab58('0xaa'),_0xab58('0xab'),_0xab58('0xac'),_0xab58('0xad'),_0xab58('0xae'),_0xab58('0xaf'),_0xab58('0xb0'),_0xab58('0xb1'),'sipcallid',_0xab58('0xb2'),_0xab58('0xb3'),'bridgepvtcallid','membercalls',_0xab58('0xb4'),_0xab58('0xb5'),'memberlastcall','membername',_0xab58('0xb6'),_0xab58('0xb7')];if(!_[_0xab58('0x3d')](_0x10354d)&&!_[_0xab58('0xb8')](_0x1b9242,_0x10354d)){if(_[_0xab58('0x5a')](this[_0xab58('0x44')][_0x41654a])){this['variables'][_0x41654a]={};}this[_0xab58('0x44')][_0x41654a][_0x10354d]=_0x215b8a;}};VoiceQueueReport[_0xab58('0xc')][_0xab58('0xb9')]=function(_0x57a054,_0x24140e,_0x417d5d){try{var _0x4e2272={};if(this[_0xab58('0x42')][_0x57a054]){for(var _0x5b2af2=0x0;_0x5b2af20x0?!![]:![];if(!_0x43c0a9){return this[_0x1ebb('0x1c')](this[_0x1ebb('0x17')][_0x1ebb('0x6d')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x2df6c0){var _0x200f75=this[_0x1ebb('0x17')]['id'];if(this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75]&&this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75][_0x2df6c0[_0x1ebb('0x61')]]){this[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x200f75][_0x2df6c0[_0x1ebb('0x61')]][_0x1ebb('0x12')][_0x1ebb('0x6e')](_0x2df6c0);}};VoiceQueueReport['prototype'][_0x1ebb('0x6f')]=function(_0x256824){var _0x2d8d3d=this;try{if(this['isNotNull'](_0x256824)&&this[_0x1ebb('0x70')](_0x256824[_0x1ebb('0x4f')])){logger[_0x1ebb('0x51')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x1ebb('0x45')](_0x256824,{'showHidden':![],'depth':null}));var _0x2afae7=this[_0x1ebb('0x15')][_0x256824[_0x1ebb('0x4f')]];if(_0x2afae7){logger[_0x1ebb('0x51')](_0x1ebb('0x71'),_0x2afae7[_0x1ebb('0x5c')]);this[_0x1ebb('0x17')][_0x1ebb('0x5f')][_0x2afae7[_0x1ebb('0x5c')]]={'summaryEvent':_0x256824};this['summary'][_0x1ebb('0x6c')]+=0x1;return ami[_0x1ebb('0x40')]({'action':'queuestatus','queue':_0x2afae7[_0x1ebb('0x5c')]})[_0x1ebb('0x72')](function(_0x123d18){if(!_0x2d8d3d[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x256824[_0x1ebb('0x61')]]){_0x2d8d3d[_0x1ebb('0x17')][_0x1ebb('0x6a')][_0x256824['actionid']]={};}_0x2d8d3d['summary'][_0x1ebb('0x6a')][_0x256824[_0x1ebb('0x61')]][_0x123d18['actionid']]={'queue':_0x2afae7['name'],'agents':[]};})[_0x1ebb('0x41')](function(_0x3a50e2){throw _0x3a50e2;});}}}catch(_0x2204bb){logger[_0x1ebb('0x44')](_0x1ebb('0x62'),util[_0x1ebb('0x45')](_0x2204bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['syncQueueSummaryComplete']=function(_0x1f2d2a){if(this['summary'][_0x1ebb('0x6c')]>0x0){this[_0x1ebb('0x17')][_0x1ebb('0x6d')]=_0x1f2d2a;return;}logger['debug'](_0x1ebb('0x73'),util[_0x1ebb('0x45')](_0x1f2d2a,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x1ebb('0x4b')](_0x1ebb('0x74'),{});};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x20')]=function(_0xf3abc4){try{if(this[_0x1ebb('0x70')](_0xf3abc4)){logger[_0x1ebb('0x51')](_0x1ebb('0x75'),_0xf3abc4[_0x1ebb('0x4d')],util['inspect'](_0xf3abc4,{'showHidden':![],'depth':null}));if(_[_0x1ebb('0x5e')](this[_0x1ebb('0x11')][_0xf3abc4['uniqueid']])){this[_0x1ebb('0x11')][_0xf3abc4[_0x1ebb('0x4d')]]=[];}if(_[_0x1ebb('0x5e')](this[_0x1ebb('0x13')][_0xf3abc4[_0x1ebb('0x4d')]])){this['channels'][_0xf3abc4[_0x1ebb('0x4d')]]={};}var _0x76ed0c=new QueueReport();_0x76ed0c[_0x1ebb('0x4f')]=_0xf3abc4[_0x1ebb('0x4f')];_0x76ed0c[_0x1ebb('0x59')]=this[_0x1ebb('0x15')][_0x76ed0c['queue']]&&this[_0x1ebb('0x15')][_0x76ed0c[_0x1ebb('0x4f')]]['type']?this['voiceQueues'][_0x76ed0c[_0x1ebb('0x4f')]][_0x1ebb('0x59')]||_0x1ebb('0x5a'):_0x1ebb('0x5a');_0x76ed0c[_0x1ebb('0x76')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x76ed0c[_0x1ebb('0x78')]=_0xf3abc4[_0x1ebb('0x78')];_0x76ed0c[_0x1ebb('0x79')]=_0xf3abc4[_0x1ebb('0x79')];_0x76ed0c[_0x1ebb('0x4d')]=_0xf3abc4[_0x1ebb('0x4d')];_0x76ed0c[_0x1ebb('0x7a')]=this[_0x1ebb('0x13')][_0xf3abc4[_0x1ebb('0x4d')]][_0x1ebb('0x7a')];logger[_0x1ebb('0x7b')](_0x1ebb('0x7c'),_0x76ed0c[_0x1ebb('0x4f')],_0x76ed0c[_0x1ebb('0x59')]);Object[_0x1ebb('0x68')](_0x76ed0c,_[_0x1ebb('0x7d')](_0xf3abc4,_[_0x1ebb('0x7e')](_0x76ed0c)));this['queueReports'][_0xf3abc4[_0x1ebb('0x4d')]]['push'](_0x76ed0c);this['channels'][_0xf3abc4[_0x1ebb('0x4d')]]=_0x76ed0c;this['emitVoiceQueueChannelSave'](_0x76ed0c,_0x1ebb('0x1f'));}}catch(_0x3ceea7){logger[_0x1ebb('0x44')](_0x1ebb('0x75'),_0xf3abc4[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0x3ceea7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x22')]=function(_0x41e11b){try{if(this[_0x1ebb('0x70')](_0x41e11b)){logger['debug'](_0x1ebb('0x7f'),_0x41e11b[_0x1ebb('0x4d')],util['inspect'](_0x41e11b,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x41e11b[_0x1ebb('0x4d')]]){var _0xd71258=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x41e11b[_0x1ebb('0x4d')]]);_0xd71258[_0x1ebb('0x81')]=![];_0xd71258[_0x1ebb('0x82')]=null;_0xd71258[_0x1ebb('0x83')]=_0x41e11b[_0x1ebb('0x83')];_0xd71258[_0x1ebb('0x84')]=_0x41e11b[_0x1ebb('0x84')];_0xd71258[_0x1ebb('0x21')]=!![];_0xd71258[_0x1ebb('0x85')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0xd71258[_0x1ebb('0x53')]='ABANDONED';_0xd71258['lastAssignedTo']=null;logger[_0x1ebb('0x7b')](_0x1ebb('0x86'),_0xd71258[_0x1ebb('0x4f')],_0xd71258[_0x1ebb('0x59')]);this[_0x1ebb('0x13')][_0x41e11b[_0x1ebb('0x4d')]]=_0xd71258;this[_0x1ebb('0x4a')](_0xd71258,'queuecallerabandon');}}}catch(_0x351db4){logger[_0x1ebb('0x44')](_0x1ebb('0x7f'),_0x41e11b['uniqueid'],util[_0x1ebb('0x45')](_0x351db4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x87')]=function(_0xaf12e5){try{if(this[_0x1ebb('0x70')](_0xaf12e5)){logger[_0x1ebb('0x51')](_0x1ebb('0x88'),_0xaf12e5[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0xaf12e5,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0xaf12e5[_0x1ebb('0x4d')]]){var _0x2a262a=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0xaf12e5[_0x1ebb('0x4d')]]);_0x2a262a[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x2a262a[_0x1ebb('0x8a')]=_0xaf12e5[_0x1ebb('0x8a')];_0x2a262a[_0x1ebb('0x8b')]=_0xaf12e5['connectedlinename'];logger[_0x1ebb('0x7b')](_0x1ebb('0x8c'),_0x2a262a[_0x1ebb('0x4f')],_0x2a262a[_0x1ebb('0x59')],_0xaf12e5['connectedlinenum'],_0xaf12e5['connectedlinename']);this['channels'][_0xaf12e5[_0x1ebb('0x4d')]]=_0x2a262a;this[_0x1ebb('0x8d')](_0x2a262a,'queuecallerleave');}}}catch(_0x19c8b2){logger[_0x1ebb('0x44')](_0x1ebb('0x88'),_0xaf12e5['uniqueid'],util[_0x1ebb('0x45')](_0x19c8b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x8e')]=function(_0x5280d5){try{if(this[_0x1ebb('0x70')](_0x5280d5)){logger[_0x1ebb('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x5280d5['uniqueid'],util[_0x1ebb('0x45')](_0x5280d5,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x5280d5[_0x1ebb('0x4d')]]){var _0x5c2053=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x5280d5[_0x1ebb('0x4d')]]);_0x5c2053[_0x1ebb('0x81')]=!![];_0x5c2053[_0x1ebb('0x53')]=_0x1ebb('0x8f');logger['info'](_0x1ebb('0x90'),_0x5c2053[_0x1ebb('0x4f')],_0x5c2053[_0x1ebb('0x59')]);}}}catch(_0x2ea378){logger[_0x1ebb('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x5280d5[_0x1ebb('0x4d')],util['inspect'](_0x2ea378,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['syncAgentComplete']=function(_0x2dee9e){try{if(this[_0x1ebb('0x70')](_0x2dee9e)){logger[_0x1ebb('0x51')](_0x1ebb('0x91'),_0x2dee9e[_0x1ebb('0x4d')],util['inspect'](_0x2dee9e,{'showHidden':![],'depth':null}));if(this[_0x1ebb('0x11')][_0x2dee9e['uniqueid']]){var _0x35d0b4=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]]);_0x35d0b4[_0x1ebb('0x21')]=![];_0x35d0b4[_0x1ebb('0x85')]=null;_0x35d0b4['assigned']=!![];_0x35d0b4['lastAssignedTo']=_0x2dee9e['membername'];_0x35d0b4[_0x1ebb('0x83')]=_0x2dee9e[_0x1ebb('0x83')];_0x35d0b4[_0x1ebb('0x81')]=!![];_0x35d0b4[_0x1ebb('0x3c')]=![];_0x35d0b4[_0x1ebb('0x92')]=null;if(!_0x35d0b4['transfer']){if(_0x2dee9e[_0x1ebb('0x93')]==_0x1ebb('0x94')){_0x35d0b4[_0x1ebb('0x53')]=_0x1ebb('0x95');logger[_0x1ebb('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x35d0b4['queue'],_0x35d0b4['type']);}else{if(_['startsWith'](_0x2dee9e[_0x1ebb('0x96')][_0x1ebb('0x97')](),_0x1ebb('0x98'))){if(this['queueReports'][_0x2dee9e[_0x1ebb('0x99')]]){var _0x269cf3=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x99')]]);_0x269cf3[_0x1ebb('0x81')]=![];_0x269cf3['queuecallerexit']=!![];_0x269cf3[_0x1ebb('0x92')]=moment(_0x35d0b4[_0x1ebb('0x76')])[_0x1ebb('0x9a')](_0x2dee9e[_0x1ebb('0x83')],_0x1ebb('0x9b'))[_0x1ebb('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x269cf3[_0x1ebb('0x53')]=_0x1ebb('0x9c');_0x269cf3[_0x1ebb('0x94')]=!![];_0x269cf3[_0x1ebb('0x9d')]=_0x1ebb('0x9e');_0x269cf3[_0x1ebb('0x9f')]=_0x2dee9e['destexten'];_0x269cf3['transferuniqueid']=_0x2dee9e[_0x1ebb('0x4d')];logger[_0x1ebb('0x7b')](_0x1ebb('0xa0'),_0x269cf3[_0x1ebb('0x4f')],_0x269cf3[_0x1ebb('0x59')]);var _0x216a8b=this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x99')]];this['queueReports'][_0x2dee9e[_0x1ebb('0x99')]]=this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]];this[_0x1ebb('0x11')][_0x2dee9e[_0x1ebb('0x4d')]]=_0x216a8b;}}else{_0x35d0b4[_0x1ebb('0x53')]=_0x1ebb('0xa1')+_0x2dee9e[_0x1ebb('0x93')][_0x1ebb('0xa2')]();logger['info'](_0x1ebb('0xa3'),_0x35d0b4[_0x1ebb('0x4f')],_0x35d0b4['type'],_0x35d0b4[_0x1ebb('0x53')]);}}}this[_0x1ebb('0x13')][_0x2dee9e[_0x1ebb('0x4d')]]=_0x35d0b4;}}}catch(_0x3b52e9){logger[_0x1ebb('0x44')](_0x1ebb('0x91'),_0x2dee9e[_0x1ebb('0x4d')],util[_0x1ebb('0x45')](_0x3b52e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')][_0x1ebb('0x26')]=function(_0x18576a){try{if(this['isNotNull'](_0x18576a)){logger['debug'](_0x1ebb('0xa4'),_0x18576a['uniqueid'],util[_0x1ebb('0x45')](_0x18576a,{'showHidden':![],'depth':null}));this[_0x1ebb('0xa5')](_0x18576a[_0x1ebb('0x4d')],_[_0x1ebb('0x7e')](_0x18576a['variable'])[0x0],_0x18576a['value']);if(this['queueReports'][_0x18576a[_0x1ebb('0x4d')]]){var _0x3d4f70=_[_0x1ebb('0x80')](this[_0x1ebb('0x11')][_0x18576a['uniqueid']]);if(_0x3d4f70){if(this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')])&&this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')]['queuestatus'])){switch(_0x18576a[_0x1ebb('0xa7')]){case _0x1ebb('0xa8'):_0x3d4f70[_0x1ebb('0x3c')]=![];_0x3d4f70[_0x1ebb('0x92')]=null;break;case _0x1ebb('0xa9'):_0x3d4f70[_0x1ebb('0xaa')]=_0x1ebb('0xab');_0x3d4f70[_0x1ebb('0x3c')]=!![];_0x3d4f70['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1ebb('0x51')](_0x1ebb('0xac'),_0x18576a['uniqueid'],util[_0x1ebb('0x45')](_0x3d4f70,{'showHidden':![],'depth':null}));ami[_0x1ebb('0x4b')](_0x1ebb('0xad'),_0x3d4f70);break;default:_0x3d4f70['queuecallerexit']=!![];_0x3d4f70[_0x1ebb('0x92')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));}_0x3d4f70[_0x1ebb('0x21')]=![];_0x3d4f70[_0x1ebb('0x85')]=null;_0x3d4f70[_0x1ebb('0x53')]=_0x18576a[_0x1ebb('0xa7')];this[_0x1ebb('0x13')][_0x18576a[_0x1ebb('0x4d')]]=_0x3d4f70;this[_0x1ebb('0x4a')](_0x3d4f70,_0x1ebb('0x25'));}else if(this[_0x1ebb('0x70')](_0x18576a['variable'])&&this[_0x1ebb('0x70')](_0x18576a[_0x1ebb('0xa6')][_0x1ebb('0xae')])){if(!_0x3d4f70[_0x1ebb('0x21')]){_0x3d4f70[_0x1ebb('0x3c')]=!![];_0x3d4f70[_0x1ebb('0x92')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));_0x3d4f70[_0x1ebb('0x53')]=_0x1ebb('0xaf');_0x3d4f70[_0x1ebb('0x89')]=moment()[_0x1ebb('0x4e')](_0x1ebb('0x77'));this[_0x1ebb('0x13')][_0x18576a[_0x1ebb('0x4d')]]=_0x3d4f70;}}logger[_0x1ebb('0x7b')](_0x1ebb('0xb0'),_0x18576a[_0x1ebb('0x4d')],_0x3d4f70['queue'],_0x3d4f70['type'],_[_0x1ebb('0x7e')](_0x18576a[_0x1ebb('0xa6')])[0x0],_0x18576a[_0x1ebb('0xa7')]);_0x3d4f70[_0x1ebb('0x18')]=this[_0x1ebb('0x18')][_0x18576a[_0x1ebb('0x4d')]];}}}}catch(_0x1e3a31){logger[_0x1ebb('0x44')](_0x1ebb('0xa4'),_0x18576a[_0x1ebb('0x4d')],util['inspect'](_0x1e3a31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1ebb('0xc')]['addVariable']=function(_0x7c8290,_0x48d2da,_0x38b253){var _0x2fafb9=[_0x1ebb('0xb1'),_0x1ebb('0xb2'),_0x1ebb('0xb3'),_0x1ebb('0xb4'),'rtpaudioqosloss',_0x1ebb('0xb5'),_0x1ebb('0xb6'),_0x1ebb('0xb7'),_0x1ebb('0xb8'),_0x1ebb('0xb9'),_0x1ebb('0xba'),_0x1ebb('0xbb'),'membercalls',_0x1ebb('0xbc'),_0x1ebb('0xbd'),_0x1ebb('0xbe'),_0x1ebb('0xbf'),_0x1ebb('0xc0'),'memberrealtime'];if(!_[_0x1ebb('0x3f')](_0x48d2da)&&!_[_0x1ebb('0xc1')](_0x2fafb9,_0x48d2da)){if(_['isUndefined'](this[_0x1ebb('0x18')][_0x7c8290])){this[_0x1ebb('0x18')][_0x7c8290]={};}this[_0x1ebb('0x18')][_0x7c8290][_0x48d2da]=_0x38b253;}};VoiceQueueReport['prototype'][_0x1ebb('0xc2')]=function(_0x4d7892,_0x3e4dcd,_0x37097e){try{var _0x286ca3={};if(this[_0x1ebb('0x11')][_0x4d7892]){for(var _0x46781c=0x0;_0x46781c=0x0?moment(_0x5ac678[_0xe5de('0x1c')])[_0xe5de('0x10')](_0x5ac678['starttime'],_0xe5de('0x11')):null,'data1':'outbound','data2':_0x5ac678[_0xe5de('0x16')],'data3':_0x5ac678[_0xe5de('0x1d')],'data4':_0x5ac678[_0xe5de('0x1e')]||null,'role':_0xe5de('0x1f'),'internal':_0x5ac678[_0xe5de('0x16')]?_[_0xe5de('0x15')](_0x5ac678[_0xe5de('0x16')]):undefined,'uniqueid':_0x5ac678[_0xe5de('0x17')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x2296=['outbound','exten','uniqueid','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','lastAssignedTo','isNil','format','SIP/%s','interface','queuecallerleaveAt','diff','seconds','calleridnum','queue','accountcode','toNumber','CreateMemberReport','voiceDialReport','starttime','endtime'];(function(_0x1e8383,_0x408c78){var _0x17254f=function(_0x12a7c5){while(--_0x12a7c5){_0x1e8383['push'](_0x1e8383['shift']());}};_0x17254f(++_0x408c78);}(_0x2296,0xed));var _0x6229=function(_0x58af59,_0x3f3f47){_0x58af59=_0x58af59-0x0;var _0x44d8d6=_0x2296[_0x58af59];return _0x44d8d6;};'use strict';var moment=require(_0x6229('0x0'));var _=require(_0x6229('0x1'));var util=require('util');var client=require(_0x6229('0x2'));exports[_0x6229('0x3')]=function(_0x42dfbb){var _0x8e9c43=_0x42dfbb[_0x6229('0x4')]||_0x42dfbb[_0x6229('0x5')];return client[_0x6229('0x6')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x42dfbb[_0x6229('0x7')],'interface':_[_0x6229('0x8')](_0x42dfbb['interface'])?util[_0x6229('0x9')](_0x6229('0xa'),_0x42dfbb[_0x6229('0x7')]):_0x42dfbb[_0x6229('0xb')],'type':'TALKING','enterAt':_0x42dfbb[_0x6229('0xc')],'exitAt':_0x8e9c43,'duration':moment(_0x8e9c43)[_0x6229('0xd')](_0x42dfbb[_0x6229('0xc')],_0x6229('0xe')),'data1':'inbound','data2':_0x42dfbb[_0x6229('0xf')],'data3':_0x42dfbb['exten'],'data4':null,'data5':_0x42dfbb[_0x6229('0x10')],'role':'agent','internal':_0x42dfbb[_0x6229('0x11')]?_[_0x6229('0x12')](_0x42dfbb[_0x6229('0x11')]):undefined,'uniqueid':_0x42dfbb['uniqueid']},'log':_0x6229('0x13')});};exports[_0x6229('0x14')]=function(_0x2ebe88){return client['Request'](_0x6229('0x13'),{'body':{'channel':'voice','membername':_0x2ebe88['membername'],'interface':_0x2ebe88[_0x6229('0xb')],'type':'TALKING','enterAt':_0x2ebe88[_0x6229('0x15')],'exitAt':_0x2ebe88[_0x6229('0x16')],'duration':moment(_0x2ebe88[_0x6229('0x16')])[_0x6229('0xd')](_0x2ebe88['starttime'],_0x6229('0xe'))>=0x0?moment(_0x2ebe88['endtime'])['diff'](_0x2ebe88[_0x6229('0x15')],_0x6229('0xe')):null,'data1':_0x6229('0x17'),'data2':_0x2ebe88[_0x6229('0x11')],'data3':_0x2ebe88[_0x6229('0x18')],'data4':_0x2ebe88['dialstring']||null,'role':'agent','internal':_0x2ebe88[_0x6229('0x11')]?_[_0x6229('0x12')](_0x2ebe88[_0x6229('0x11')]):undefined,'uniqueid':_0x2ebe88[_0x6229('0x19')]},'log':_0x6229('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5567cc9..0e93a82 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5689=['Request','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0xf09cdb,_0x2fa797){var _0x5c7f3b=function(_0x3f4cb7){while(--_0x3f4cb7){_0xf09cdb['push'](_0xf09cdb['shift']());}};_0x5c7f3b(++_0x2fa797);}(_0x5689,0xe0));var _0x9568=function(_0x4fed5b,_0x55cc98){_0x4fed5b=_0x4fed5b-0x0;var _0x177221=_0x5689[_0x4fed5b];return _0x177221;};'use strict';var client=require(_0x9568('0x0'));exports['getSettings']=function(){return client[_0x9568('0x1')](_0x9568('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x9568('0x3')]},'log':_0x9568('0x4')});}; \ No newline at end of file +var _0xd983=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd983,0x1df));var _0x3d98=function(_0x287512,_0x5a76ab){_0x287512=_0x287512-0x0;var _0x4f22a2=_0xd983[_0x287512];return _0x4f22a2;};'use strict';var client=require(_0x3d98('0x0'));exports[_0x3d98('0x1')]=function(){return client[_0x3d98('0x2')](_0x3d98('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3d98('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8af290d..1b4fbb3 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 _0xf79e=['GetTemplate','name','getTemplates'];(function(_0x3b0084,_0xd03947){var _0x55b219=function(_0x17e061){while(--_0x17e061){_0x3b0084['push'](_0x3b0084['shift']());}};_0x55b219(++_0xd03947);}(_0xf79e,0x185));var _0xef79=function(_0x4a8a12,_0x379fb6){_0x4a8a12=_0x4a8a12-0x0;var _0x418950=_0xf79e[_0x4a8a12];return _0x418950;};'use strict';var client=require('../client');exports[_0xef79('0x0')]=function(_0x9f4b6e){return function(_0x42079a){return client['Request'](_0xef79('0x1'),{'options':{'raw':!![],'attributes':['id',_0xef79('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xc04a=['GetTemplate','name','../client','Request'];(function(_0x48afad,_0x5efb38){var _0x297d00=function(_0x1bcf83){while(--_0x1bcf83){_0x48afad['push'](_0x48afad['shift']());}};_0x297d00(++_0x5efb38);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xac04('0x0'));exports['getTemplates']=function(_0x3967a7){return function(_0x480c09){return client[_0xac04('0x1')](_0xac04('0x2'),{'options':{'raw':!![],'attributes':['id',_0xac04('0x3'),'html']},'log':_0xac04('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e1f44e7..04a74e9 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 _0xf6e2=['AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data2','data3','data5','data6','data7','../client','getTriggers','Request','channel','status','Condition'];(function(_0x1bfe04,_0x31c376){var _0x40cc69=function(_0x4e78ca){while(--_0x4e78ca){_0x1bfe04['push'](_0x1bfe04['shift']());}};_0x40cc69(++_0x31c376);}(_0xf6e2,0x92));var _0x2f6e=function(_0x15fd54,_0x1f7896){_0x15fd54=_0x15fd54-0x0;var _0x26bcd3=_0xf6e2[_0x15fd54];return _0x26bcd3;};'use strict';var client=require(_0x2f6e('0x0'));exports[_0x2f6e('0x1')]=function(_0x2fbfd4){return function(_0x43f7f6){return client[_0x2f6e('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x2f6e('0x3'),_0x2f6e('0x4')],'include':[{'model':_0x2f6e('0x5'),'as':_0x2f6e('0x6'),'attributes':['id','field',_0x2f6e('0x7'),_0x2f6e('0x8')]},{'model':_0x2f6e('0x5'),'as':_0x2f6e('0x9'),'attributes':['id',_0x2f6e('0xa'),_0x2f6e('0x7'),'value']},{'model':_0x2f6e('0xb'),'as':_0x2f6e('0xc'),'attributes':['id','action',_0x2f6e('0xd'),_0x2f6e('0xe'),_0x2f6e('0xf'),'data4',_0x2f6e('0x10'),_0x2f6e('0x11'),_0x2f6e('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x9f32=['Action','Actions','data1','data2','data3','data4','data6','../client','Request','GetTrigger','status','AllConditions','field','operator','value','Condition','AnyConditions'];(function(_0x4abd2e,_0xdb57ae){var _0x39ecc1=function(_0x2a0b59){while(--_0x2a0b59){_0x4abd2e['push'](_0x4abd2e['shift']());}};_0x39ecc1(++_0xdb57ae);}(_0x9f32,0x117));var _0x29f3=function(_0x41f8cf,_0x4ab076){_0x41f8cf=_0x41f8cf-0x0;var _0x46047e=_0x9f32[_0x41f8cf];return _0x46047e;};'use strict';var client=require(_0x29f3('0x0'));exports['getTriggers']=function(_0x55c1fc){return function(_0x37aa60){return client[_0x29f3('0x1')](_0x29f3('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x29f3('0x3')],'include':[{'model':'Condition','as':_0x29f3('0x4'),'attributes':['id',_0x29f3('0x5'),_0x29f3('0x6'),_0x29f3('0x7')]},{'model':_0x29f3('0x8'),'as':_0x29f3('0x9'),'attributes':['id',_0x29f3('0x5'),_0x29f3('0x6'),_0x29f3('0x7')]},{'model':_0x29f3('0xa'),'as':_0x29f3('0xb'),'attributes':['id','action',_0x29f3('0xc'),_0x29f3('0xd'),_0x29f3('0xe'),_0x29f3('0xf'),'data5',_0x29f3('0x10'),'data7']}]},'log':_0x29f3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8c153a8..ac35915 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 _0x1301=['GetTrunk','name','../client','getTrunks','Request'];(function(_0x42f94d,_0x515205){var _0x38e5ff=function(_0x5b3fc5){while(--_0x5b3fc5){_0x42f94d['push'](_0x42f94d['shift']());}};_0x38e5ff(++_0x515205);}(_0x1301,0x70));var _0x1130=function(_0x45b0b1,_0x436c46){_0x45b0b1=_0x45b0b1-0x0;var _0x3bc111=_0x1301[_0x45b0b1];return _0x3bc111;};'use strict';var client=require(_0x1130('0x0'));exports[_0x1130('0x1')]=function(_0x4c0869){return function(_0x58fc8a){return client[_0x1130('0x2')](_0x1130('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1130('0x4'),'registry','defaultuser']},'log':_0x1130('0x3')});};}; \ No newline at end of file +var _0xece0=['name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x26367f,_0x3dd1f9){var _0x5121cd=function(_0x1bde49){while(--_0x1bde49){_0x26367f['push'](_0x26367f['shift']());}};_0x5121cd(++_0x3dd1f9);}(_0xece0,0xa5));var _0x0ece=function(_0x24bbd5,_0x34a7c4){_0x24bbd5=_0x24bbd5-0x0;var _0x8fb737=_0xece0[_0x24bbd5];return _0x8fb737;};'use strict';var client=require(_0x0ece('0x0'));exports[_0x0ece('0x1')]=function(_0x50b067){return function(_0x3feab2){return client[_0x0ece('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0ece('0x3'),_0x0ece('0x4'),_0x0ece('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ea791c4..94fe8b6 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1e2c19,_0x559638){var _0x154498=function(_0x2cc134){while(--_0x2cc134){_0x1e2c19['push'](_0x1e2c19['shift']());}};_0x154498(++_0x559638);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0xcb91[_0x4a4922];return _0x55a8c6;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0xe706[_0xd1f854];return _0x548294;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f8a8a31..54b74ae 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 _0x63c3=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x63c3,0x1bc));var _0x363c=function(_0x215363,_0x5bf4ca){_0x215363=_0x215363-0x0;var _0x51b396=_0x63c3[_0x215363];return _0x51b396;};'use strict';var client=require(_0x363c('0x0'));exports['create']=function(_0xae7757){return client[_0x363c('0x1')](_0x363c('0x2'),{'body':_0xae7757,'log':_0x363c('0x2')});};exports[_0x363c('0x3')]=function(_0x297c95,_0x5702f6,_0x490f8e){return client[_0x363c('0x1')](_0x363c('0x4'),{'body':_0x297c95,'options':{'where':{'uniqueid':_0x5702f6,'interface':_0x490f8e,'agentcomplete':!![]}},'log':_0x363c('0x4')});}; \ No newline at end of file +var _0x5601=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x5da875,_0x475a8b){var _0x25d687=function(_0xb8a423){while(--_0xb8a423){_0x5da875['push'](_0x5da875['shift']());}};_0x25d687(++_0x475a8b);}(_0x5601,0x13b));var _0x1560=function(_0x23110a,_0x328dd5){_0x23110a=_0x23110a-0x0;var _0x2c67f9=_0x5601[_0x23110a];return _0x2c67f9;};'use strict';var client=require(_0x1560('0x0'));exports[_0x1560('0x1')]=function(_0x50a9c4){return client[_0x1560('0x2')](_0x1560('0x3'),{'body':_0x50a9c4,'log':_0x1560('0x3')});};exports['update']=function(_0xdaa566,_0x5115e7,_0x2555de){return client[_0x1560('0x2')](_0x1560('0x4'),{'body':_0xdaa566,'options':{'where':{'uniqueid':_0x5115e7,'interface':_0x2555de,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index aaf9d4e..b0fc560 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 _0x40ae=['getVoiceCallReports','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION'];(function(_0x9d0ba8,_0x4a445d){var _0x1d6664=function(_0x3323b2){while(--_0x3323b2){_0x9d0ba8['push'](_0x9d0ba8['shift']());}};_0x1d6664(++_0x4a445d);}(_0x40ae,0x139));var _0xe40a=function(_0x63eafd,_0x25d866){_0x63eafd=_0x63eafd-0x0;var _0xf23c5c=_0x40ae[_0x63eafd];return _0xf23c5c;};'use strict';var moment=require('moment');var util=require(_0xe40a('0x0'));var _=require(_0xe40a('0x1'));var client=require('../client');exports[_0xe40a('0x2')]=function(_0x793c85){return client[_0xe40a('0x3')](_0xe40a('0x4'),{'body':_[_0xe40a('0x5')](_0x793c85,{'source':_0x793c85[_0xe40a('0x6')],'destinationcontext':_0x793c85[_0xe40a('0x7')],'callerid':_0x793c85[_0xe40a('0x8')],'amaflags':_0xe40a('0x9')}),'log':_0xe40a('0x4')});};exports[_0xe40a('0xa')]=function(){return function(){return client[_0xe40a('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe40a('0xb')]('day')['format'](_0xe40a('0xc')),moment()[_0xe40a('0xd')](_0xe40a('0xe'))['format'](_0xe40a('0xc'))]}},'attributes':[_0xe40a('0xf'),_0xe40a('0x10'),_0xe40a('0x11'),_0xe40a('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xc1f9=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','calleridnum','context'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0xc1f9,0x13b));var _0x9c1f=function(_0x362f9e,_0x341e0){_0x362f9e=_0x362f9e-0x0;var _0x328b21=_0xc1f9[_0x362f9e];return _0x328b21;};'use strict';var moment=require(_0x9c1f('0x0'));var util=require(_0x9c1f('0x1'));var _=require('lodash');var client=require(_0x9c1f('0x2'));exports[_0x9c1f('0x3')]=function(_0x22a8ef){return client[_0x9c1f('0x4')](_0x9c1f('0x5'),{'body':_['merge'](_0x22a8ef,{'source':_0x22a8ef[_0x9c1f('0x6')],'destinationcontext':_0x22a8ef[_0x9c1f('0x7')],'callerid':_0x22a8ef['callerid'],'amaflags':_0x9c1f('0x8')}),'log':_0x9c1f('0x5')});};exports[_0x9c1f('0x9')]=function(){return function(){return client['Request'](_0x9c1f('0xa'),{'options':{'where':{'type':[_0x9c1f('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x9c1f('0xc'))[_0x9c1f('0xd')](_0x9c1f('0xe')),moment()['endOf'](_0x9c1f('0xc'))[_0x9c1f('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9c1f('0xf'),'disposition','duration','billableseconds']},'log':_0x9c1f('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index defabb7..6e5a893 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 _0xf722=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5bb924,_0x5ae89a){var _0x4a92f9=function(_0x30b94a){while(--_0x30b94a){_0x5bb924['push'](_0x5bb924['shift']());}};_0x4a92f9(++_0x5ae89a);}(_0xf722,0xcc));var _0x2f72=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf722[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x2f72('0x0'));exports[_0x2f72('0x1')]=function(_0xc2013e){return client[_0x2f72('0x2')](_0x2f72('0x3'),{'body':_0xc2013e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x1cbb=['CreateVoiceDialReport','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cbb,0x133));var _0xb1cb=function(_0x78afb4,_0x1cbe4f){_0x78afb4=_0x78afb4-0x0;var _0x280e9a=_0x1cbb[_0x78afb4];return _0x280e9a;};'use strict';var client=require(_0xb1cb('0x0'));exports['create']=function(_0xac5f31){return client[_0xb1cb('0x1')]('CreateVoiceDialReport',{'body':_0xac5f31,'log':_0xb1cb('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 32b4635..2001b99 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 _0x8eeb=['recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x77df66,_0xf4e8a2){var _0x54f1da=function(_0x2060ee){while(--_0x2060ee){_0x77df66['push'](_0x77df66['shift']());}};_0x54f1da(++_0xf4e8a2);}(_0x8eeb,0x183));var _0xb8ee=function(_0x4164b7,_0x85034b){_0x4164b7=_0x4164b7-0x0;var _0x351831=_0x8eeb[_0x4164b7];return _0x351831;};'use strict';var client=require(_0xb8ee('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb8ee('0x1')](_0xb8ee('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xb8ee('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb8ee('0x4')});};}; \ No newline at end of file +var _0xf6e8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x3f9a09,_0x59befb){var _0xe1b0c1=function(_0x498382){while(--_0x498382){_0x3f9a09['push'](_0x3f9a09['shift']());}};_0xe1b0c1(++_0x59befb);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x1cb8f5,_0x41c5ef){_0x1cb8f5=_0x1cb8f5-0x0;var _0x32e8b4=_0xf6e8[_0x1cb8f5];return _0x32e8b4;};'use strict';var client=require('../client');exports[_0x8f6e('0x0')]=function(){return function(){return client[_0x8f6e('0x1')](_0x8f6e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8f6e('0x3'),_0x8f6e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x8f6e('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 59c47bd..cd4e2e5 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 _0x93b3=['dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x93b3,0x1c6));var _0x393b=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x93b3[_0x5d6b41];return _0x1c2dd6;};'use strict';var client=require(_0x393b('0x0'));exports[_0x393b('0x1')]=function(){return function(){return client[_0x393b('0x2')](_0x393b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x393b('0x4'),_0x393b('0x5'),'autopause',_0x393b('0x6'),_0x393b('0x7'),_0x393b('0x8'),_0x393b('0x9'),_0x393b('0xa'),'dialLimitQueue',_0x393b('0xb'),_0x393b('0xc'),_0x393b('0xd'),_0x393b('0xe'),_0x393b('0xf'),_0x393b('0x10'),_0x393b('0x11'),_0x393b('0x12'),_0x393b('0x13'),_0x393b('0x14'),_0x393b('0x15'),_0x393b('0x16'),'dialBusyMaxRetry',_0x393b('0x17'),_0x393b('0x18'),_0x393b('0x19'),_0x393b('0x1a'),'dialTimezone','dialGlobalInterval',_0x393b('0x1b'),_0x393b('0x1c'),_0x393b('0x1d'),_0x393b('0x1e'),_0x393b('0x1f'),_0x393b('0x20'),_0x393b('0x21'),_0x393b('0x22'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x393b('0x23'),_0x393b('0x24'),'timeout',_0x393b('0x25'),_0x393b('0x26'),'dialOrderByScheduledAt',_0x393b('0x27'),_0x393b('0x28'),_0x393b('0x29'),_0x393b('0x6'),_0x393b('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x393b('0x2b'),_0x393b('0x2c'),'dialNoSuchNumberRetryFrequency',_0x393b('0x2d'),_0x393b('0x2e'),_0x393b('0x2f'),_0x393b('0x30'),_0x393b('0x31'),_0x393b('0x32'),_0x393b('0x33'),'dialAgentRejectRetryFrequency',_0x393b('0x34'),_0x393b('0x35'),_0x393b('0x36'),'dialPreviewAutoRecallMe',_0x393b('0x37')],'include':[{'model':'Trunk','as':_0x393b('0x38'),'attributes':['id',_0x393b('0x39'),'callerid',_0x393b('0x3a')]},{'model':_0x393b('0x3b'),'as':_0x393b('0x3c'),'attributes':['id',_0x393b('0x39')]},{'model':_0x393b('0x38'),'as':_0x393b('0x3d'),'attributes':['id',_0x393b('0x39'),_0x393b('0x3e'),_0x393b('0x3a')]},{'model':_0x393b('0x3f'),'as':_0x393b('0x3f'),'attributes':['id',_0x393b('0x39')],'include':[{'model':_0x393b('0x3f'),'as':_0x393b('0x40'),'attributes':['id',_0x393b('0x39'),_0x393b('0x41')]}]}]},'log':_0x393b('0x1')});};}; \ No newline at end of file +var _0xbda2=['Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active'];(function(_0x5a4b64,_0x400ed4){var _0x3c2053=function(_0x45cb84){while(--_0x45cb84){_0x5a4b64['push'](_0x5a4b64['shift']());}};_0x3c2053(++_0x400ed4);}(_0xbda2,0x123));var _0x2bda=function(_0x5b20a7,_0x23e400){_0x5b20a7=_0x5b20a7-0x0;var _0x389187=_0xbda2[_0x5b20a7];return _0x389187;};'use strict';var client=require(_0x2bda('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x2bda('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2bda('0x2'),_0x2bda('0x3'),_0x2bda('0x4'),'autopause',_0x2bda('0x5'),_0x2bda('0x6'),_0x2bda('0x7'),_0x2bda('0x8'),_0x2bda('0x9'),'dialLimitQueue',_0x2bda('0xa'),_0x2bda('0xb'),_0x2bda('0xc'),_0x2bda('0xd'),_0x2bda('0xe'),_0x2bda('0xf'),_0x2bda('0x10'),_0x2bda('0x11'),_0x2bda('0x12'),'dialQueueProject',_0x2bda('0x13'),_0x2bda('0x14'),_0x2bda('0x15'),_0x2bda('0x16'),_0x2bda('0x17'),_0x2bda('0x18'),_0x2bda('0x19'),_0x2bda('0x1a'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive',_0x2bda('0x1b'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x2bda('0x1c'),'dialAMDMinWordLength',_0x2bda('0x1d'),_0x2bda('0x1e'),_0x2bda('0x1f'),_0x2bda('0x20'),_0x2bda('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0x2bda('0x22'),_0x2bda('0x23'),'dialAgiAfterHangupClient','dialQueueProject2',_0x2bda('0x5'),'strategy',_0x2bda('0x24'),_0x2bda('0x25'),'dialNoSuchNumberMaxRetry',_0x2bda('0x26'),_0x2bda('0x27'),_0x2bda('0x28'),'dialAbandonedMaxRetry',_0x2bda('0x29'),_0x2bda('0x2a'),'dialMachineRetryFrequency',_0x2bda('0x2b'),_0x2bda('0x2c'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x2bda('0x2d'),_0x2bda('0x2e'),_0x2bda('0x2f')],'include':[{'model':'Trunk','as':_0x2bda('0x30'),'attributes':['id','name',_0x2bda('0x31'),_0x2bda('0x32')]},{'model':_0x2bda('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0x2bda('0x2')]},{'model':_0x2bda('0x30'),'as':_0x2bda('0x34'),'attributes':['id',_0x2bda('0x2'),_0x2bda('0x31'),_0x2bda('0x32')]},{'model':_0x2bda('0x35'),'as':_0x2bda('0x35'),'attributes':['id',_0x2bda('0x2')],'include':[{'model':_0x2bda('0x35'),'as':_0x2bda('0x36'),'attributes':['id','name',_0x2bda('0x37')]}]}]},'log':_0x2bda('0x38')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 0a3d348..21ac233 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 _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x569eea,_0x322a1c){var _0x416e4b=function(_0x1d7804){while(--_0x1d7804){_0x569eea['push'](_0x569eea['shift']());}};_0x416e4b(++_0x322a1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1f73f,_0x470922){var _0x27ef94=function(_0x171d44){while(--_0x171d44){_0x1f73f['push'](_0x1f73f['shift']());}};_0x27ef94(++_0x470922);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 95e6cfe..39741d7 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 _0xf452=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x18da7f,_0x439986){var _0x1c5204=function(_0x15891e){while(--_0x15891e){_0x18da7f['push'](_0x18da7f['shift']());}};_0x1c5204(++_0x439986);}(_0xf452,0x83));var _0x2f45=function(_0x3156c1,_0x236d59){_0x3156c1=_0x3156c1-0x0;var _0x2f52ed=_0xf452[_0x3156c1];return _0x2f52ed;};'use strict';var client=require(_0x2f45('0x0'));exports[_0x2f45('0x1')]=function(_0x27ddcf){return function(){return client[_0x2f45('0x2')](_0x2f45('0x3'),{'options':{'where':{'VoiceQueueId':_0x27ddcf,'paused':!![]},'raw':!![]},'log':_0x2f45('0x1')});};}; \ No newline at end of file +var _0x3f95=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x476b15,_0x4a093a){var _0x54e8c6=function(_0x146c5a){while(--_0x146c5a){_0x476b15['push'](_0x476b15['shift']());}};_0x54e8c6(++_0x4a093a);}(_0x3f95,0xd0));var _0x53f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3f95[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x53f9('0x0')]=function(_0xcd9cab){return function(){return client[_0x53f9('0x1')](_0x53f9('0x2'),{'options':{'where':{'VoiceQueueId':_0xcd9cab,'paused':!![]},'raw':!![]},'log':_0x53f9('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 999d351..e27347f 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1d0cba,_0x512c6e){var _0x3bf7be=function(_0x54294d){while(--_0x54294d){_0x1d0cba['push'](_0x1d0cba['shift']());}};_0x3bf7be(++_0x512c6e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x50cb5f,_0x105798){var _0x251aa4=function(_0x21ec23){while(--_0x21ec23){_0x50cb5f['push'](_0x50cb5f['shift']());}};_0x251aa4(++_0x105798);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d802f32..3d3d750 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 _0x22d8=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','attended','transfers','blindTransfer','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x22d8,0x131));var _0x822d=function(_0xb4d947,_0x16b719){_0xb4d947=_0xb4d947-0x0;var _0x8c85d0=_0x22d8[_0xb4d947];return _0x8c85d0;};'use strict';var client=require('../client');exports[_0x822d('0x0')]={};exports[_0x822d('0x1')]=function(_0x117dc3){return client[_0x822d('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x117dc3['result'],'transfererchannel':_0x117dc3[_0x822d('0x3')],'transferercalleridnum':_0x117dc3[_0x822d('0x4')],'transferercalleridname':_0x117dc3[_0x822d('0x5')],'transfererconnectedlinenum':_0x117dc3[_0x822d('0x6')],'transfererconnectedlinename':_0x117dc3[_0x822d('0x7')],'transfereraccountcode':_0x117dc3[_0x822d('0x8')],'transferercontext':_0x117dc3[_0x822d('0x9')],'transfererexten':_0x117dc3['transfererexten'],'transfererlinkedid':_0x117dc3[_0x822d('0xa')],'transfereechannel':_0x117dc3[_0x822d('0xb')],'transfereecalleridnum':_0x117dc3['transfereecalleridnum'],'transfereecalleridname':_0x117dc3[_0x822d('0xc')],'transfereeconnectedlinenum':_0x117dc3['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x117dc3[_0x822d('0xd')],'transfereeaccountcode':_0x117dc3[_0x822d('0xe')],'transfereecontext':_0x117dc3['transfereecontext'],'transfereeexten':_0x117dc3[_0x822d('0xf')],'transfereelinkedid':_0x117dc3[_0x822d('0x10')],'isexternal':_0x117dc3['isexternal'],'context':_0x117dc3[_0x822d('0x11')],'extension':_0x117dc3[_0x822d('0x12')],'type':_0x822d('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0x822d('0x14')]=function(_0x13752e){return client[_0x822d('0x2')](_0x822d('0x15'),{'body':{'result':_0x13752e['result'],'transfererchannel':_0x13752e[_0x822d('0x16')],'transferercalleridnum':_0x13752e[_0x822d('0x17')],'transferercalleridname':_0x13752e['origtransferercalleridname'],'transfererconnectedlinenum':_0x13752e[_0x822d('0x18')],'transfererconnectedlinename':_0x13752e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x13752e[_0x822d('0x19')],'transferercontext':_0x13752e[_0x822d('0x1a')],'transfererexten':_0x13752e[_0x822d('0x1b')],'transfererlinkedid':_0x13752e[_0x822d('0x1c')],'transfereechannel':_0x13752e[_0x822d('0x1d')],'transfereecalleridnum':_0x13752e[_0x822d('0x1e')],'transfereecalleridname':_0x13752e[_0x822d('0x1f')],'transfereeconnectedlinenum':_0x13752e[_0x822d('0x20')],'transfereeconnectedlinename':_0x13752e[_0x822d('0x21')],'transfereeaccountcode':_0x13752e[_0x822d('0x22')],'transfereecontext':_0x13752e[_0x822d('0x23')],'transfereeexten':_0x13752e[_0x822d('0x24')],'transfereelinkedid':_0x13752e['transfertargetlinkedid'],'isexternal':_0x13752e[_0x822d('0x25')],'context':_0x13752e['origtransferercontext'],'extension':_0x13752e['origtransfererexten'],'type':_0x822d('0x26')},'log':_0x822d('0x15')});}; \ No newline at end of file +var _0x5c5f=['transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x1d62b6,_0xa0bba9){var _0x4339cf=function(_0x57c232){while(--_0x57c232){_0x1d62b6['push'](_0x1d62b6['shift']());}};_0x4339cf(++_0xa0bba9);}(_0x5c5f,0x6f));var _0xf5c5=function(_0x4285a7,_0x48e566){_0x4285a7=_0x4285a7-0x0;var _0x21d936=_0x5c5f[_0x4285a7];return _0x21d936;};'use strict';var client=require(_0xf5c5('0x0'));exports[_0xf5c5('0x1')]={};exports[_0xf5c5('0x2')]=function(_0x308a77){return client[_0xf5c5('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x308a77[_0xf5c5('0x4')],'transfererchannel':_0x308a77[_0xf5c5('0x5')],'transferercalleridnum':_0x308a77[_0xf5c5('0x6')],'transferercalleridname':_0x308a77[_0xf5c5('0x7')],'transfererconnectedlinenum':_0x308a77[_0xf5c5('0x8')],'transfererconnectedlinename':_0x308a77[_0xf5c5('0x9')],'transfereraccountcode':_0x308a77['transfereraccountcode'],'transferercontext':_0x308a77[_0xf5c5('0xa')],'transfererexten':_0x308a77[_0xf5c5('0xb')],'transfererlinkedid':_0x308a77[_0xf5c5('0xc')],'transfereechannel':_0x308a77[_0xf5c5('0xd')],'transfereecalleridnum':_0x308a77[_0xf5c5('0xe')],'transfereecalleridname':_0x308a77['transfereecalleridname'],'transfereeconnectedlinenum':_0x308a77[_0xf5c5('0xf')],'transfereeconnectedlinename':_0x308a77['transfereeconnectedlinename'],'transfereeaccountcode':_0x308a77[_0xf5c5('0x10')],'transfereecontext':_0x308a77[_0xf5c5('0x11')],'transfereeexten':_0x308a77[_0xf5c5('0x12')],'transfereelinkedid':_0x308a77['transfereelinkedid'],'isexternal':_0x308a77[_0xf5c5('0x13')],'context':_0x308a77[_0xf5c5('0x14')],'extension':_0x308a77[_0xf5c5('0x15')],'type':_0xf5c5('0x16')},'log':_0xf5c5('0x17')});};exports['attendedTransfer']=function(_0x35b770){return client['Request'](_0xf5c5('0x17'),{'body':{'result':_0x35b770[_0xf5c5('0x4')],'transfererchannel':_0x35b770[_0xf5c5('0x18')],'transferercalleridnum':_0x35b770['origtransferercalleridnum'],'transferercalleridname':_0x35b770[_0xf5c5('0x19')],'transfererconnectedlinenum':_0x35b770[_0xf5c5('0x1a')],'transfererconnectedlinename':_0x35b770[_0xf5c5('0x1b')],'transfereraccountcode':_0x35b770[_0xf5c5('0x1c')],'transferercontext':_0x35b770[_0xf5c5('0x1d')],'transfererexten':_0x35b770[_0xf5c5('0x1e')],'transfererlinkedid':_0x35b770[_0xf5c5('0x1f')],'transfereechannel':_0x35b770[_0xf5c5('0x20')],'transfereecalleridnum':_0x35b770[_0xf5c5('0x21')],'transfereecalleridname':_0x35b770[_0xf5c5('0x22')],'transfereeconnectedlinenum':_0x35b770['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x35b770['transfertargetconnectedlinename'],'transfereeaccountcode':_0x35b770[_0xf5c5('0x23')],'transfereecontext':_0x35b770[_0xf5c5('0x24')],'transfereeexten':_0x35b770[_0xf5c5('0x25')],'transfereelinkedid':_0x35b770[_0xf5c5('0x26')],'isexternal':_0x35b770[_0xf5c5('0x13')],'context':_0x35b770[_0xf5c5('0x27')],'extension':_0x35b770[_0xf5c5('0x28')],'type':_0xf5c5('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 404e161..ed3f15a 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x30347c,_0x4d6c70){var _0x12f64c=function(_0x5378ee){while(--_0x5378ee){_0x30347c['push'](_0x30347c['shift']());}};_0x12f64c(++_0x4d6c70);}(_0x7a54,0x106));var _0x47a5=function(_0x39575d,_0x111f4e){_0x39575d=_0x39575d-0x0;var _0xa31e27=_0x7a54[_0x39575d];return _0xa31e27;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5e0075,_0x92537b){var _0x5b5206=function(_0x2d4cd1){while(--_0x2d4cd1){_0x5e0075['push'](_0x5e0075['shift']());}};_0x5b5206(++_0x92537b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b046f,_0x8e5fa6){_0x1b046f=_0x1b046f-0x0;var _0x1f6c8f=_0xb10b[_0x1b046f];return _0x1f6c8f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 cf9d57b..1f6c38e 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 _0xdb12=['socket.io-emitter','info','stringify','emit','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','','calleridname','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','util','../../../../config/logger','redis','defaults','localhost'];(function(_0x1e46a5,_0x5b094e){var _0x35a2cf=function(_0x5e7c65){while(--_0x5e7c65){_0x1e46a5['push'](_0x1e46a5['shift']());}};_0x35a2cf(++_0x5b094e);}(_0xdb12,0xd2));var _0x2db1=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0xdb12[_0x43d701];return _0x2ec4c6;};'use strict';var _=require('lodash');var BPromise=require(_0x2db1('0x0'));var Redis=require('ioredis');var util=require(_0x2db1('0x1'));var config=require('../../../../config/environment');var logger=require(_0x2db1('0x2'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x2db1('0x3')]=_[_0x2db1('0x4')](config[_0x2db1('0x3')],{'host':_0x2db1('0x5'),'port':0x18eb});var io=require(_0x2db1('0x6'))(new Redis(config[_0x2db1('0x3')]));function emit(_0x41ea65,_0x35e640,_0xc6ca32,_0x4c2b8c,_0x1dbf1c){logger[_0x2db1('0x7')]('[CM][%s][%s]',_0x41ea65,_0x35e640['id'],_0xc6ca32,_0x4c2b8c,JSON[_0x2db1('0x8')](_0x1dbf1c));io['to'](_0xc6ca32)[_0x2db1('0x9')](_0x4c2b8c,_0x1dbf1c);}exports['exec']=function(_0x1a526b,_0x484be1,_0x1d028e,_0x398da8){var _0x2bb323,_0x4fc827;var _0x2330a9={};var _0x36ee19;var _0x12710b=Number(_0x1d028e[_0x2db1('0xa')]);var _0x2bb79a=_0x1d028e[_0x2db1('0xb')]?Boolean(Number(_0x1d028e[_0x2db1('0xb')])):![];var _0x493aec;var _0x15a4ae=![];if(!_['isNil'](_0x1d028e[_0x2db1('0xc')])){if(_0x1d028e[_0x2db1('0xc')]=='1')_0x15a4ae=!![];}if(!_0x15a4ae){if(_0x398da8[_0x2db1('0xd')]){_0x2330a9['id']=_0x398da8[_0x2db1('0xd')];}}if(!_0x2330a9['id']){_0x2330a9[_0x2db1('0xe')]=_0x12710b;_0x493aec=_0x1d028e[_0x2db1('0xf')]&&_0x1d028e[_0x2db1('0xf')]!=='0'?_0x1d028e[_0x2db1('0xf')][_0x2db1('0x10')](','):[_0x2db1('0x11')];_0x2330a9[_0x2db1('0x12')]=_['map'](_0x493aec,function(_0x31795f){var _0x4739ba={};_0x4739ba[_0x31795f]=_0x398da8[_0x2db1('0x13')]?_0x398da8[_0x2db1('0x14')]:_0x398da8[_0x2db1('0x15')];return _0x4739ba;});_0x36ee19=_0x398da8[_0x2db1('0x13')]?_0x398da8[_0x2db1('0x14')]:_0x398da8[_0x2db1('0x15')];}var _0x6f6976=['id','firstName',_0x2db1('0x16'),_0x2db1('0x11'),_0x2db1('0x17'),_0x2db1('0x18'),'ListId',_0x2db1('0x19'),_0x2db1('0x1a'),_0x2db1('0x1b')];var _0x156c90=_[_0x2db1('0x1c')](_0x6f6976,_0x493aec);BPromise[_0x2db1('0x1d')]()[_0x2db1('0x1e')](cmContactRpc['getContacts']({'attributes':_0x156c90,'where':_0x2330a9,'phone':_0x36ee19}))[_0x2db1('0x1e')](function(_0x18fea0){_0x4fc827=_0x18fea0;if(!_[_0x2db1('0x1f')](_0x4fc827)){if(_0x4fc827[_0x2db1('0x20')]===0x1){_0x2bb323=_0x4fc827[0x0];logger[_0x2db1('0x7')](_0x2db1('0x21'),_0x398da8['uniqueid'],_0x484be1['id'],_0x2bb323['id']);}else{logger[_0x2db1('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x398da8[_0x2db1('0x22')],_0x484be1['id'],_['map'](_0x4fc827,'id')[_0x2db1('0x23')](','));}return;}else{logger[_0x2db1('0x7')](_0x2db1('0x24'),_0x398da8[_0x2db1('0x22')],_0x484be1['id']);var _0x56e876={'ListId':_0x12710b};var _0x438f17=_0x1d028e['data4']&&_0x1d028e['data4']!=='0'?_0x1d028e['data4']:_0x2db1('0x11');if(_0x2bb79a){logger[_0x2db1('0x7')](_0x2db1('0x25'),_0x398da8[_0x2db1('0x22')],_0x484be1['id']);_0x56e876[_0x438f17]=_[_0x2db1('0x26')](_0x398da8['routeId'])?_0x398da8['calleridnum']:_0x398da8[_0x2db1('0x14')];if(_['isNil'](_0x398da8[_0x2db1('0x13')])){_0x56e876['firstName']=_0x398da8['calleridname']&&_0x398da8['calleridname']!==_0x2db1('0x27')?_0x398da8[_0x2db1('0x28')]:_0x2db1('0x29');}else{_0x56e876[_0x2db1('0x2a')]=_0x398da8[_0x2db1('0x2b')]&&_0x398da8[_0x2db1('0x2b')]!==_0x2db1('0x27')?_0x398da8[_0x2db1('0x2b')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x2db1('0x2c')](_0x56e876))[_0x2db1('0x1e')](function(_0x4b2c1a){_0x2bb323=_0x4b2c1a;_0x4fc827[_0x2db1('0x2d')](_0x4b2c1a);if(_0x2bb323){logger[_0x2db1('0x7')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x398da8['uniqueid'],_0x484be1['id'],_0x2bb323['id']);}return;});}else{logger[_0x2db1('0x7')](_0x2db1('0x2e'),_0x398da8[_0x2db1('0x22')],_0x484be1['id']);_0x56e876[_0x438f17]=_[_0x2db1('0x26')](_0x398da8[_0x2db1('0x13')])?_0x398da8['calleridnum']:_0x398da8[_0x2db1('0x14')];if(_[_0x2db1('0x26')](_0x398da8['routeId'])){_0x56e876[_0x2db1('0x2a')]=_0x398da8[_0x2db1('0x28')]&&_0x398da8[_0x2db1('0x28')]!==_0x2db1('0x27')?_0x398da8['calleridname']:_0x2db1('0x29');}else{_0x56e876['firstName']=_0x398da8[_0x2db1('0x2b')]&&_0x398da8[_0x2db1('0x2b')]!==_0x2db1('0x27')?_0x398da8['destcalleridname']:_0x2db1('0x29');}_0x2bb323=_0x56e876;_0x4fc827['push'](_0x56e876);return;}}})[_0x2db1('0x1e')](function(){if(_0x1a526b){emit(_0x398da8[_0x2db1('0x22')],_0x484be1,util[_0x2db1('0x2f')](_0x2db1('0x30'),_0x1a526b[_0x2db1('0x31')]),util[_0x2db1('0x2f')](_0x2db1('0x32'),_0x1d028e[_0x2db1('0x33')][_0x2db1('0x34')]()),{'evt':_[_0x2db1('0x35')](_0x398da8,{'autoCreate':_0x2bb79a}),'contact':_0x2bb323===undefined?{}:_0x2bb323,'contacts':_0x4fc827[_0x2db1('0x20')]===0x0?undefined:_0x4fc827});}});}; \ No newline at end of file +var _0x8135=['split','phone','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util','trigger','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3'];(function(_0x304dad,_0x246701){var _0x8ece72=function(_0x1f4f98){while(--_0x1f4f98){_0x304dad['push'](_0x304dad['shift']());}};_0x8ece72(++_0x246701);}(_0x8135,0x17b));var _0x5813=function(_0x191c4b,_0x24bde7){_0x191c4b=_0x191c4b-0x0;var _0x551fd3=_0x8135[_0x191c4b];return _0x551fd3;};'use strict';var _=require(_0x5813('0x0'));var BPromise=require(_0x5813('0x1'));var Redis=require(_0x5813('0x2'));var util=require(_0x5813('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5813('0x4'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x5813('0x5')](config[_0x5813('0x6')],{'host':_0x5813('0x7'),'port':0x18eb});var io=require(_0x5813('0x8'))(new Redis(config['redis']));function emit(_0x17e6cb,_0x4b77b3,_0x4ec8dd,_0x34f21d,_0x20ff48){logger[_0x5813('0x9')](_0x5813('0xa'),_0x17e6cb,_0x4b77b3['id'],_0x4ec8dd,_0x34f21d,JSON[_0x5813('0xb')](_0x20ff48));io['to'](_0x4ec8dd)[_0x5813('0xc')](_0x34f21d,_0x20ff48);}exports[_0x5813('0xd')]=function(_0x17b3aa,_0xe1d5c4,_0x3f7b01,_0x501acb){var _0x5c0d55,_0x495cf4;var _0x506516={};var _0x409d5d;var _0xed74f5=Number(_0x3f7b01[_0x5813('0xe')]);var _0x5be7b6=_0x3f7b01[_0x5813('0xf')]?Boolean(Number(_0x3f7b01[_0x5813('0xf')])):![];var _0x1c68d3;var _0x553b66=![];if(!_[_0x5813('0x10')](_0x3f7b01[_0x5813('0x11')])){if(_0x3f7b01[_0x5813('0x11')]=='1')_0x553b66=!![];}if(!_0x553b66){if(_0x501acb[_0x5813('0x12')]){_0x506516['id']=_0x501acb[_0x5813('0x12')];}}if(!_0x506516['id']){_0x506516['ListId']=_0xed74f5;_0x1c68d3=_0x3f7b01['data3']&&_0x3f7b01[_0x5813('0x13')]!=='0'?_0x3f7b01['data3'][_0x5813('0x14')](','):[_0x5813('0x15')];_0x506516['$or']=_['map'](_0x1c68d3,function(_0x349059){var _0x9f2dd8={};_0x9f2dd8[_0x349059]=_0x501acb['routeId']?_0x501acb[_0x5813('0x16')]:_0x501acb[_0x5813('0x17')];return _0x9f2dd8;});_0x409d5d=_0x501acb[_0x5813('0x18')]?_0x501acb[_0x5813('0x16')]:_0x501acb[_0x5813('0x17')];}var _0x20c4a3=['id',_0x5813('0x19'),_0x5813('0x1a'),_0x5813('0x15'),_0x5813('0x1b'),_0x5813('0x1c'),_0x5813('0x1d'),_0x5813('0x1e'),_0x5813('0x1f'),_0x5813('0x20')];var _0x4a92ed=_[_0x5813('0x21')](_0x20c4a3,_0x1c68d3);BPromise['resolve']()[_0x5813('0x22')](cmContactRpc[_0x5813('0x23')]({'attributes':_0x4a92ed,'where':_0x506516,'phone':_0x409d5d}))[_0x5813('0x22')](function(_0x2a5f35){_0x495cf4=_0x2a5f35;if(!_['isEmpty'](_0x495cf4)){if(_0x495cf4['length']===0x1){_0x5c0d55=_0x495cf4[0x0];logger[_0x5813('0x9')](_0x5813('0x24'),_0x501acb['uniqueid'],_0xe1d5c4['id'],_0x5c0d55['id']);}else{logger['info'](_0x5813('0x25'),_0x501acb[_0x5813('0x26')],_0xe1d5c4['id'],_[_0x5813('0x27')](_0x495cf4,'id')[_0x5813('0x28')](','));}return;}else{logger[_0x5813('0x9')](_0x5813('0x29'),_0x501acb['uniqueid'],_0xe1d5c4['id']);var _0x4cbb8e={'ListId':_0xed74f5};var _0x17e8e3=_0x3f7b01[_0x5813('0x2a')]&&_0x3f7b01[_0x5813('0x2a')]!=='0'?_0x3f7b01[_0x5813('0x2a')]:_0x5813('0x15');if(_0x5be7b6){logger[_0x5813('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x501acb['uniqueid'],_0xe1d5c4['id']);_0x4cbb8e[_0x17e8e3]=_[_0x5813('0x10')](_0x501acb['routeId'])?_0x501acb[_0x5813('0x17')]:_0x501acb['destcalleridnum'];if(_['isNil'](_0x501acb[_0x5813('0x18')])){_0x4cbb8e['firstName']=_0x501acb[_0x5813('0x2b')]&&_0x501acb[_0x5813('0x2b')]!==_0x5813('0x2c')?_0x501acb['calleridname']:_0x5813('0x2d');}else{_0x4cbb8e[_0x5813('0x19')]=_0x501acb[_0x5813('0x2e')]&&_0x501acb['destcalleridname']!==_0x5813('0x2c')?_0x501acb['destcalleridname']:_0x5813('0x2d');}return BPromise['resolve']()[_0x5813('0x22')](cmContactRpc[_0x5813('0x2f')](_0x4cbb8e))['then'](function(_0x52f849){_0x5c0d55=_0x52f849;_0x495cf4['push'](_0x52f849);if(_0x5c0d55){logger[_0x5813('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x501acb['uniqueid'],_0xe1d5c4['id'],_0x5c0d55['id']);}return;});}else{logger[_0x5813('0x9')](_0x5813('0x30'),_0x501acb[_0x5813('0x26')],_0xe1d5c4['id']);_0x4cbb8e[_0x17e8e3]=_[_0x5813('0x10')](_0x501acb['routeId'])?_0x501acb[_0x5813('0x17')]:_0x501acb['destcalleridnum'];if(_[_0x5813('0x10')](_0x501acb['routeId'])){_0x4cbb8e[_0x5813('0x19')]=_0x501acb[_0x5813('0x2b')]&&_0x501acb[_0x5813('0x2b')]!==''?_0x501acb['calleridname']:_0x5813('0x2d');}else{_0x4cbb8e['firstName']=_0x501acb['destcalleridname']&&_0x501acb['destcalleridname']!==''?_0x501acb['destcalleridname']:_0x5813('0x2d');}_0x5c0d55=_0x4cbb8e;_0x495cf4[_0x5813('0x31')](_0x4cbb8e);return;}}})['then'](function(){if(_0x17b3aa){emit(_0x501acb[_0x5813('0x26')],_0xe1d5c4,util[_0x5813('0x32')](_0x5813('0x33'),_0x17b3aa[_0x5813('0x34')]),util[_0x5813('0x32')](_0x5813('0x35'),_0x3f7b01['action'][_0x5813('0x36')]()),{'evt':_[_0x5813('0x37')](_0x501acb,{'autoCreate':_0x5be7b6}),'contact':_0x5c0d55===undefined?{}:_0x5c0d55,'contacts':_0x495cf4[_0x5813('0x38')]===0x0?undefined:_0x495cf4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6823f4e..f3427ba 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 _0x5e02=['inspect','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','action','motionbar','browser','TemplateId','html','templates','data2','render','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','800','data6','winApplication','winArguments','format','name','trigger:%s:%s','toLowerCase','data1','jscripty','user:%s','trigger:%s','contactmanager','exec','integration','accounts','routeId','urlforward','parse','query','search','replace','AllConditions','some','AnyConditions','checkConditions','channel','debug','checkTrigger:\x20trigger','evt','field','account','operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','event','queue','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','util','ioredis','./urlforward','./integration','./cmContact','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice'];(function(_0x8644ee,_0x22da5a){var _0x58cf5b=function(_0x52c097){while(--_0x52c097){_0x8644ee['push'](_0x8644ee['shift']());}};_0x58cf5b(++_0x22da5a);}(_0x5e02,0x1c7));var _0x25e0=function(_0x19a412,_0x1864d2){_0x19a412=_0x19a412-0x0;var _0x4b79d1=_0x5e02[_0x19a412];return _0x4b79d1;};'use strict';var util=require(_0x25e0('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require(_0x25e0('0x1'));var urlforward=require(_0x25e0('0x2'));var integration=require(_0x25e0('0x3'));var cmContact=require(_0x25e0('0x4'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x25e0('0x5'))(_0x25e0('0x6'));var ami=require('../ami');config[_0x25e0('0x7')]=_[_0x25e0('0x8')](config[_0x25e0('0x7')],{'host':_0x25e0('0x9'),'port':0x18eb});var io=require(_0x25e0('0xa'))(new Redis(config[_0x25e0('0x7')]));var operators={'equals':function(_0x4fd433,_0x51310f){return _0x4fd433==_0x51310f;},'not_equals':function(_0x4464b7,_0x1ddcf0){return _0x4464b7!=_0x1ddcf0;}};var barAndWebActions=[_0x25e0('0xb'),_0x25e0('0xc'),_0x25e0('0xd')];function Trigger(_0x10dc96){this[_0x25e0('0xe')]=_0x10dc96['triggers'];this[_0x25e0('0xf')]=_0x10dc96[_0x25e0('0xf')];this[_0x25e0('0x10')]=_0x10dc96['voiceQueues'];this['templates']=_0x10dc96['templates'];this['voiceExtensions']=_0x10dc96[_0x25e0('0x11')];this[_0x25e0('0x12')]=_0x10dc96['zendeskAccounts'];this[_0x25e0('0x13')]=_0x10dc96['freshdeskAccounts'];this[_0x25e0('0x14')]=_0x10dc96['salesforceAccounts'];this[_0x25e0('0x15')]=_0x10dc96['sugarcrmAccounts'];this[_0x25e0('0x16')]=_0x10dc96['zohoAccounts'];this[_0x25e0('0x17')]=_0x10dc96[_0x25e0('0x17')];this[_0x25e0('0x18')]=_0x10dc96[_0x25e0('0x18')];this[_0x25e0('0x19')]=_0x10dc96['servicenowAccounts'];this[_0x25e0('0x1a')]=_0x10dc96['dynamics365Accounts'];this['freshsalesAccounts']=_0x10dc96[_0x25e0('0x1b')];this['accounts']={'zendesk':this[_0x25e0('0x12')],'salesforce':this[_0x25e0('0x14')],'freshdesk':this[_0x25e0('0x13')],'sugarcrm':this[_0x25e0('0x15')],'zoho':this[_0x25e0('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0x25e0('0x18')],'dynamics365':this[_0x25e0('0x1a')],'freshsales':this[_0x25e0('0x1b')],'servicenow':this[_0x25e0('0x19')]};ami['on'](_0x25e0('0x1c'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentconnect',this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x1f'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x20'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x21'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on']('custom:agentnoanswer',this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x22'),this['syncCustomEvent'][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x23'),this[_0x25e0('0x1d')]['bind'](this));ami['on']('custom:agentreject',this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x24'),this['syncCustomEvent'][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x25'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x26'),this[_0x25e0('0x1d')]['bind'](this));ami['on'](_0x25e0('0x27'),this[_0x25e0('0x28')][_0x25e0('0x1e')](this));ami['on']('custom:dialconnect',this[_0x25e0('0x28')]['bind'](this));ami['on'](_0x25e0('0x29'),this[_0x25e0('0x28')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x2a'),this['syncCustomEvent'][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x2b'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x2c'),this['syncCustomEvent'][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x2d'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x2e'),this[_0x25e0('0x1d')]['bind'](this));ami['on'](_0x25e0('0x2f'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on'](_0x25e0('0x30'),this[_0x25e0('0x1d')][_0x25e0('0x1e')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent'][_0x25e0('0x1e')](this));}Trigger[_0x25e0('0x31')][_0x25e0('0x32')]=function(_0x3b87a3,_0x47c79d,_0x40a4f7){logger[_0x25e0('0x33')](_0x3b87a3,_0x47c79d,JSON[_0x25e0('0x34')](_0x40a4f7));io['to'](_0x3b87a3)[_0x25e0('0x32')](_0x47c79d,_0x40a4f7);};Trigger[_0x25e0('0x31')][_0x25e0('0x1d')]=function(_0x3240d6){var _0x4186a0=_[_0x25e0('0x35')](_0x3240d6);if(typeof _0x4186a0[_0x25e0('0x36')]===_0x25e0('0x37')){_0x4186a0[_0x25e0('0x36')]=_0x25e0('0x38');}logger['debug'](_0x25e0('0x1d'),util[_0x25e0('0x39')](_0x4186a0,{'showHidden':!![],'depth':null}));this[_0x25e0('0x3a')](_0x4186a0);};Trigger[_0x25e0('0x31')][_0x25e0('0x28')]=function(_0x54b133){if(this[_0x25e0('0xf')][_0x54b133[_0x25e0('0x3b')]]){this[_0x25e0('0x1d')](_0x54b133);}};Trigger[_0x25e0('0x31')][_0x25e0('0x3a')]=function(_0x7ff49e){var _0x41f4af;for(var _0xfc7a7e in this[_0x25e0('0xe')]){if(this[_0x25e0('0xe')]['hasOwnProperty'](_0xfc7a7e)){if(this['triggers'][_0xfc7a7e][_0x25e0('0x3c')]){_0x41f4af=this[_0x25e0('0x3d')](this['triggers'][_0xfc7a7e],_0x7ff49e);if(_0x41f4af){_[_0x25e0('0x3e')](_0x7ff49e,_0x7ff49e[_0x25e0('0x3f')]);for(var _0x278744=0x0,_0x3a145c,_0x2424f6,_0x3e2d07;_0x2787440x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x1497a2,_0x1b27c5){var _0x346ed0=function(_0x2b7967){while(--_0x2b7967){_0x1497a2['push'](_0x1497a2['shift']());}};_0x346ed0(++_0x1b27c5);}(_0x3e74,0x175));var _0x43e7=function(_0x173e34,_0x16f6f5){_0x173e34=_0x173e34-0x0;var _0x3b984e=_0x3e74[_0x173e34];return _0x3b984e;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 2bcb484..a78c0b8 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 _0x77db=['request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','calleridnum','/systemusers(','Bearer\x20','odata-entityid','lastIndexOf','enduserId','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','picklist','type','nameField','idField','substring','indexOf','incident','incidents','getString','Subjects','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','assign','Descriptions','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x2a0bf0,_0x247ffd){var _0x104fd6=function(_0x555e9b){while(--_0x555e9b){_0x2a0bf0['push'](_0x2a0bf0['shift']());}};_0x104fd6(++_0x247ffd);}(_0x77db,0xd7));var _0xb77d=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x77db[_0x5d6482];return _0x32e681;};'use strict';var _=require(_0xb77d('0x0'));var rp=require(_0xb77d('0x1'));var util=require(_0xb77d('0x2'));var intUtil=require(_0xb77d('0x3'));var md5=require(_0xb77d('0x4'));var Redis=require(_0xb77d('0x5'));var logger=require(_0xb77d('0x6'))(_0xb77d('0x7'));var config=require(_0xb77d('0x8'));config[_0xb77d('0x9')]=_['defaults'](config[_0xb77d('0x9')],{'host':_0xb77d('0xa'),'port':0x18eb});var io=require(_0xb77d('0xb'))(new Redis(config['redis']));function getAuthToken(_0x1ce423,_0x25f98a,_0x420c25){if(_0x1ce423['modernAuthentication']){_0x1ce423[_0xb77d('0xc')]=_0x1ce423[_0xb77d('0xd')][_0xb77d('0xe')];_0x1ce423[_0xb77d('0xf')]=_0x1ce423[_0xb77d('0xd')][_0xb77d('0x10')];return Promise[_0xb77d('0x11')](_0x1ce423[_0xb77d('0xd')][_0xb77d('0x12')]);}var _0x2bb9fb={'method':_0xb77d('0x13'),'uri':_0x25f98a,'form':{'client_id':_0x1ce423[_0xb77d('0x14')],'resource':_0x1ce423[_0xb77d('0xc')],'username':_0x1ce423[_0xb77d('0x15')],'password':_0x1ce423['password'],'grant_type':_0xb77d('0x16'),'client_secret':_0x1ce423['clientSecret']},'json':!![]};return rp(_0x2bb9fb)[_0xb77d('0x17')](function(_0x2079f5){return _0x2079f5[_0xb77d('0x18')];})[_0xb77d('0x19')](function(_0x1597b0){logger['error']('['+[_0x420c25[_0xb77d('0x1a')]()]+_0xb77d('0x1b'));return _0x1597b0['message'];});}function getUser(_0x2405d2,_0x17c589,_0x77f654,_0x3abe96,_0x10ec15,_0x1526ce){return new Promise(function(_0x4e055e,_0x299241){return getAuthToken(_0x17c589,_0x3abe96,_0x1526ce)['then'](function(_0x3d1a43){var _0x53b054={'method':'GET','uri':_0x10ec15+_0xb77d('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x3d1a43,'OData-Version':_0xb77d('0x1d')},'json':!![]};return rp(_0x53b054);})[_0xb77d('0x17')](function(_0x183dff){var _0x300be0=_0x183dff['value'];var _0x36e429=![];var _0x5f0c3e=null;if(!_[_0xb77d('0x1e')](_0x77f654)){if(intUtil['validateEmail'](_0x77f654[_0xb77d('0x1f')])){_0x2405d2[_0xb77d('0x20')]=_0x77f654['email'];for(_0x5f0c3e=0x0;_0x5f0c3e<_0x300be0[_0xb77d('0x21')];_0x5f0c3e++){if(_0x300be0[_0x5f0c3e][_0xb77d('0x22')]===_0x77f654['email']&&!_0x300be0[_0x5f0c3e][_0xb77d('0x23')]){_0x36e429=!![];logger[_0xb77d('0x24')]('['+[_0x1526ce[_0xb77d('0x1a')]()]+']\x20Agent\x20found\x20'+_0x300be0[_0x5f0c3e][_0xb77d('0x25')]+'!');_0x2405d2[_0xb77d('0x26')]=_0x300be0[_0x5f0c3e]['systemuserid'];}}}}if(!_0x36e429){logger[_0xb77d('0x24')]('['+[_0x1526ce[_0xb77d('0x1a')]()]+_0xb77d('0x27'));_0x2405d2[_0xb77d('0x20')]=_0x17c589['username'];for(_0x5f0c3e=0x0;_0x5f0c3e<_0x300be0[_0xb77d('0x21')];_0x5f0c3e++){if(_0x300be0[_0x5f0c3e][_0xb77d('0x22')]===_0x17c589[_0xb77d('0x15')]){_0x2405d2[_0xb77d('0x26')]=_0x300be0[_0x5f0c3e][_0xb77d('0x25')];}}}_0x4e055e(_0x2405d2);})[_0xb77d('0x19')](function(_0x51d50b){_0x299241(_0x51d50b[_0xb77d('0x28')]);});});}function createEndUser(_0x1f5dec,_0x4f503a,_0x59e3f1,_0x3bc2b5,_0x622873,_0x36702a,_0xb36211){return new Promise(function(_0x1d0ee8,_0x435d41){return getAuthToken(_0x4f503a,_0x59e3f1,_0x36702a)['then'](function(_0x4b327b){var _0x8fde44=_0x36702a['toLowerCase']()===_0xb77d('0x29')?_0x622873['destcalleridnum']:_0x622873[_0xb77d('0x2a')];var _0x33d8e1={'method':'POST','uri':_0x3bc2b5+'contacts','body':{'fullname':_0x8fde44,'firstname':_0x8fde44,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb77d('0x2b')+_0x1f5dec['userId']+')'},'headers':{'Authorization':_0xb77d('0x2c')+_0x4b327b,'OData-Version':_0xb77d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x33d8e1['body'][_0xb36211]=_0x8fde44;return rp(_0x33d8e1);})['then'](function(_0x259d4d){var _0x305ca9=_0x259d4d['headers'][_0xb77d('0x2d')];var _0x5bcdb2=_0x305ca9['substring'](_0x305ca9[_0xb77d('0x2e')]('(')+0x1,_0x305ca9[_0xb77d('0x2e')](')'));_0x1f5dec[_0xb77d('0x2f')]=_0x5bcdb2;_0x1d0ee8(_0x1f5dec);})[_0xb77d('0x19')](function(_0x21059f){_0x435d41(_0x21059f[_0xb77d('0x28')]);});});}function getEndUser(_0x32020a,_0x1c9985,_0xe93d37,_0x59a147,_0x1db4d7,_0x125ea8,_0x1b5f1e,_0x41c923){var _0xa917db=_0x125ea8['toLowerCase']()==='outbound'?_0x1db4d7[_0xb77d('0x30')]:_0x1db4d7['calleridnum'];return getAuthToken(_0x1c9985,_0xe93d37,_0x125ea8)['then'](function(_0x3c9087){_0x41c923=_0x41c923?_0x41c923:_0xb77d('0x31');var _0x2c6c65={'method':_0xb77d('0x32'),'uri':_0x59a147+_0xb77d('0x33')+_0x41c923+_0xb77d('0x34')+_0x41c923+_0xb77d('0x35')+_0xa917db[_0xb77d('0x36')]('+',_0xb77d('0x37'))+'\x27','headers':{'Authorization':_0xb77d('0x2c')+_0x3c9087,'If-None-Match':null,'OData-Version':_0xb77d('0x1d')},'json':!![]};return rp(_0x2c6c65);})[_0xb77d('0x17')](function(_0x1fb19d){var _0x5a9c1e=![];if(!_0x1fb19d)return _0x5a9c1e;var _0x2fab9=_0x1fb19d[_0xb77d('0x38')];for(var _0xc8eb0=0x0;_0xc8eb0<_0x2fab9[_0xb77d('0x21')];_0xc8eb0++){if(_0x2fab9[_0xc8eb0][_0x41c923]===_0xa917db){_0x5a9c1e=!![];_0x32020a['enduserId']=_0x2fab9[_0xc8eb0]['contactid'];}}return _0x5a9c1e;})[_0xb77d('0x17')](function(_0x2fccca){if(_0x2fccca)return _0x32020a;if(_0x1b5f1e===_0xb77d('0x39')){logger['info']('['+[_0x125ea8['toUpperCase']()]+_0xb77d('0x3a'));return _0x32020a;}return createEndUser(_0x32020a,_0x1c9985,_0xe93d37,_0x59a147,_0x1db4d7,_0x125ea8,_0x41c923)['then'](function(_0x572dc0){logger[_0xb77d('0x24')]('['+[_0x125ea8[_0xb77d('0x1a')]()]+']\x20Enduser\x20created!',_0x572dc0[_0xb77d('0x2f')]);return _0x572dc0;});});}function getCustomFields(_0x4dae62,_0x297d74,_0x5373ce){var _0x13ec7b={};if(_0x4dae62[_0xb77d('0x21')]>0x0){_['forEach'](_0x4dae62,function(_0x138fe5){if(_[_0xb77d('0x3b')](['string',_0xb77d('0x3c')],_0x138fe5[_0xb77d('0x3d')])&&_0x138fe5[_0xb77d('0x3e')]&&!_0x138fe5['customField']){var _0x272090=_0x138fe5[_0xb77d('0x3f')]['toLowerCase']();var _0x4e17b8=_0x272090[_0xb77d('0x40')](0x0,_0x272090[_0xb77d('0x41')]('_'));var _0x271b1e=_0x272090[_0xb77d('0x40')](_0x272090[_0xb77d('0x41')]('_')+0x1);if(_0x4e17b8===_0x5373ce){_0x13ec7b[_0x271b1e]=_0x138fe5['content'];}}});}return _0x13ec7b;}function getTicket(_0x45b3b6,_0x589d80,_0x253886,_0x17641d,_0x21f2c2,_0x220eb7,_0x5ca6f0){return new Promise(function(_0x7412a6,_0x24996c){var _0x1b9341;return getAuthToken(_0x589d80,_0x253886,_0x5ca6f0)['then'](function(_0x23d0e7){if(_0x220eb7['ticketType']===_0xb77d('0x42')){_0x1b9341={'method':_0xb77d('0x13'),'uri':_0x17641d+_0xb77d('0x43'),'body':Object['assign']({},{'title':intUtil[_0xb77d('0x44')](_0x220eb7[_0xb77d('0x45')],_0x21f2c2,'\x20'),'description':intUtil['getString'](_0x220eb7['Descriptions'],_0x21f2c2,'\x0a'),'customerid_contact@odata.bind':_0x45b3b6[_0xb77d('0x2f')]?_0xb77d('0x46')+_0x45b3b6[_0xb77d('0x2f')]+')':undefined,'ownerid@odata.bind':_0xb77d('0x2b')+_0x45b3b6['userId']+')','caseorigincode':'1'},getCustomFields(_0x220eb7[_0xb77d('0x47')],_0x21f2c2,_0x220eb7[_0xb77d('0x48')])),'headers':{'Authorization':_0xb77d('0x2c')+_0x23d0e7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x220eb7['ticketType']==='phonecall'){var _0x3cdc10=_0x45b3b6['enduserId']?[{'partyid_systemuser@odata.bind':_0xb77d('0x2b')+_0x45b3b6['userId']+')','participationtypemask':_0x45b3b6[_0xb77d('0x49')]===_0xb77d('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xb77d('0x46')+_0x45b3b6['enduserId']+')','participationtypemask':_0x45b3b6[_0xb77d('0x49')]===_0xb77d('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb77d('0x2b')+_0x45b3b6['userId']+')','participationtypemask':_0x45b3b6[_0xb77d('0x49')]===_0xb77d('0x4a')?0x2:0x1}];_0x1b9341={'method':'POST','uri':_0x17641d+_0xb77d('0x4b'),'body':Object[_0xb77d('0x4c')]({},{'subject':intUtil[_0xb77d('0x44')](_0x220eb7[_0xb77d('0x45')],_0x21f2c2,'\x20'),'phonenumber':String(_0x21f2c2[_0xb77d('0x2a')]),'description':intUtil[_0xb77d('0x44')](_0x220eb7[_0xb77d('0x4d')],_0x21f2c2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x45b3b6[_0xb77d('0x2f')]?_0xb77d('0x46')+_0x45b3b6['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x45b3b6[_0xb77d('0x26')]+')','directioncode':_0x45b3b6[_0xb77d('0x49')]===_0xb77d('0x4a')?![]:!![],'phonecall_activity_parties':_0x3cdc10},getCustomFields(_0x220eb7[_0xb77d('0x47')],_0x21f2c2,_0x220eb7['ticketType'])),'headers':{'Authorization':_0xb77d('0x2c')+_0x23d0e7,'OData-Version':_0xb77d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b9341);})[_0xb77d('0x17')](function(_0x4a4d7e){var _0x16b458=_0x4a4d7e[_0xb77d('0x4e')][_0xb77d('0x2d')];var _0x4fa9b4=_0x16b458[_0xb77d('0x40')](_0x16b458[_0xb77d('0x2e')]('(')+0x1,_0x16b458['lastIndexOf'](')'));_0x45b3b6[_0xb77d('0x4f')]=_0x4fa9b4;_0x7412a6(_0x45b3b6);})['catch'](function(_0x43f3aa){_0x24996c(_0x43f3aa[_0xb77d('0x28')]);});});}function emit(_0x3b45d8,_0x4b4452,_0x1ace21,_0x46bc86){var _0x1da5f0={'uri':util[_0xb77d('0x50')](_0xb77d('0x51'),_0x3b45d8,_0x1ace21,_0x46bc86)};io['to'](util['format'](_0xb77d('0x52'),_0x4b4452))['emit'](_0xb77d('0x53'),_0x1da5f0);}exports['cs']=function(_0x513256,_0x2463d3,_0x5a20c0,_0x4cc7b6,_0x509f96,_0x1c32af,_0x33b34e,_0x21ee91){var _0x11a3c0={};_0x1c32af[_0xb77d('0xc')]=_0x1c32af[_0xb77d('0x54')]?intUtil[_0xb77d('0x55')](_0x1c32af[_0xb77d('0xd')][_0xb77d('0xe')]):intUtil['stripTrailingSlash'](_0x1c32af[_0xb77d('0xc')]);_0x1c32af[_0xb77d('0x56')]=intUtil[_0xb77d('0x55')](_0x1c32af[_0xb77d('0x56')]);_0x11a3c0[_0xb77d('0x49')]=_0x21ee91===_0xb77d('0x4a')||_0x21ee91===_0xb77d('0x57')?_0xb77d('0x4a'):_0xb77d('0x29');var _0xa68c36=_0x1c32af[_0xb77d('0x54')]?util[_0xb77d('0x50')](_0xb77d('0x58'),_0x1c32af['CloudProvider'][_0xb77d('0xe')]):util['format'](_0xb77d('0x58'),_0x1c32af[_0xb77d('0xc')]);var _0x145c83=util[_0xb77d('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1c32af[_0xb77d('0xf')]);var _0x4babb8=util[_0xb77d('0x50')](_0xb77d('0x59'),_0x1c32af['serverUrl'],_0x2463d3[_0xb77d('0x5a')],md5(_0x2463d3[_0xb77d('0x5a')]));if(_0x509f96&&_0x509f96['monitor_format']){logger['info'](_0xb77d('0x5b'),'Recording\x20is\x20enabled!');_0x2463d3[_0xb77d('0x5c')]=_0x4babb8;}else if(_0x33b34e&&_0x33b34e[_0xb77d('0x5d')]&&_0x33b34e['recordingFormat']!=='none'){logger[_0xb77d('0x24')](_0xb77d('0x5e'),_0xb77d('0x5f'));_0x2463d3[_0xb77d('0x5c')]=_0x4babb8;}else{_0x2463d3['recordingURL']='';}return getUser(_0x11a3c0,_0x1c32af,_0x4cc7b6,_0x145c83,_0xa68c36,_0x21ee91)[_0xb77d('0x17')](function(_0x6dc06d){logger[_0xb77d('0x24')]('['+_0x21ee91[_0xb77d('0x1a')]()+_0xb77d('0x60'),_0x6dc06d[_0xb77d('0x26')]);logger[_0xb77d('0x24')]('['+_0x21ee91['toUpperCase']()+_0xb77d('0x61'),_0x6dc06d['userEmail']);return getEndUser(_0x6dc06d,_0x1c32af,_0x145c83,_0xa68c36,_0x2463d3,_0x21ee91,_0x5a20c0[_0xb77d('0x62')],_0x5a20c0[_0xb77d('0x63')]);})[_0xb77d('0x17')](function(_0x2ef7e5){logger['info']('['+_0x21ee91[_0xb77d('0x1a')]()+_0xb77d('0x64'),_0x2ef7e5[_0xb77d('0x2f')]);logger[_0xb77d('0x24')]('['+_0x21ee91[_0xb77d('0x1a')]()+_0xb77d('0x65'),_0x2463d3['calleridnum']);return getTicket(_0x2ef7e5,_0x1c32af,_0x145c83,_0xa68c36,_0x2463d3,_0x5a20c0,_0x21ee91);})[_0xb77d('0x17')](function(_0x187d76){logger[_0xb77d('0x24')](util[_0xb77d('0x50')]('['+_0x21ee91[_0xb77d('0x1a')]()+_0xb77d('0x66'),_0x5a20c0[_0xb77d('0x48')],_0x187d76[_0xb77d('0x4f')]));logger[_0xb77d('0x24')](util[_0xb77d('0x50')]('['+_0x21ee91['toUpperCase']()+_0xb77d('0x67'),_0x21ee91));if(_0x21ee91!=='unmanaged'&&_0x5a20c0[_0xb77d('0x68')]){logger[_0xb77d('0x24')]('['+_0x21ee91[_0xb77d('0x1a')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1c32af[_0xb77d('0xc')],_0x4cc7b6[_0xb77d('0x69')],_0x5a20c0['ticketType'],_0x187d76[_0xb77d('0x4f')]);}})['catch'](function(_0x619036){logger[_0xb77d('0x6a')]('['+_0x21ee91[_0xb77d('0x1a')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x619036[_0xb77d('0x28')]);console['error'](_0xb77d('0x6b'),_0x619036);});}; \ No newline at end of file +var _0x8faf=['user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','POST','clientId','clientSecret','then','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','length','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','catch','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','outbound','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','Subjects','getString','odata-entityid','ticketId','format'];(function(_0x9db6e0,_0x1b03d0){var _0x6222a=function(_0x4adbdd){while(--_0x4adbdd){_0x9db6e0['push'](_0x9db6e0['shift']());}};_0x6222a(++_0x1b03d0);}(_0x8faf,0xfd));var _0xf8fa=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x8faf[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0xf8fa('0x0'));var rp=require(_0xf8fa('0x1'));var util=require('util');var intUtil=require(_0xf8fa('0x2'));var md5=require(_0xf8fa('0x3'));var Redis=require(_0xf8fa('0x4'));var logger=require(_0xf8fa('0x5'))(_0xf8fa('0x6'));var config=require(_0xf8fa('0x7'));config[_0xf8fa('0x8')]=_['defaults'](config[_0xf8fa('0x8')],{'host':_0xf8fa('0x9'),'port':0x18eb});var io=require(_0xf8fa('0xa'))(new Redis(config[_0xf8fa('0x8')]));function getAuthToken(_0x1c4d34,_0x30aa0b,_0x5cbb62){if(_0x1c4d34[_0xf8fa('0xb')]){_0x1c4d34[_0xf8fa('0xc')]=_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0xe')];_0x1c4d34['tenantId']=_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0xf')];return Promise[_0xf8fa('0x10')](_0x1c4d34[_0xf8fa('0xd')][_0xf8fa('0x11')]);}var _0x4cf251={'method':_0xf8fa('0x12'),'uri':_0x30aa0b,'form':{'client_id':_0x1c4d34[_0xf8fa('0x13')],'resource':_0x1c4d34[_0xf8fa('0xc')],'username':_0x1c4d34['username'],'password':_0x1c4d34['password'],'grant_type':'password','client_secret':_0x1c4d34[_0xf8fa('0x14')]},'json':!![]};return rp(_0x4cf251)[_0xf8fa('0x15')](function(_0x45bd6c){return _0x45bd6c['access_token'];})['catch'](function(_0x112bd1){logger[_0xf8fa('0x16')]('['+[_0x5cbb62['toUpperCase']()]+_0xf8fa('0x17'));return _0x112bd1[_0xf8fa('0x18')];});}function getUser(_0x4102e1,_0x20be52,_0x43ac51,_0x24b3c9,_0x405cfe,_0x3d87e2){return new Promise(function(_0x4e483e,_0x57e161){return getAuthToken(_0x20be52,_0x24b3c9,_0x3d87e2)[_0xf8fa('0x15')](function(_0x7ea915){var _0x25d1de={'method':'GET','uri':_0x405cfe+_0xf8fa('0x19'),'headers':{'Authorization':_0xf8fa('0x1a')+_0x7ea915,'OData-Version':_0xf8fa('0x1b')},'json':!![]};return rp(_0x25d1de);})[_0xf8fa('0x15')](function(_0x11fe78){var _0x5730dd=_0x11fe78[_0xf8fa('0x1c')];var _0x524a12=![];var _0x2f24c8=null;if(!_[_0xf8fa('0x1d')](_0x43ac51)){if(intUtil[_0xf8fa('0x1e')](_0x43ac51['email'])){_0x4102e1[_0xf8fa('0x1f')]=_0x43ac51['email'];for(_0x2f24c8=0x0;_0x2f24c8<_0x5730dd[_0xf8fa('0x20')];_0x2f24c8++){if(_0x5730dd[_0x2f24c8]['internalemailaddress']===_0x43ac51['email']&&!_0x5730dd[_0x2f24c8][_0xf8fa('0x21')]){_0x524a12=!![];logger['info']('['+[_0x3d87e2[_0xf8fa('0x22')]()]+_0xf8fa('0x23')+_0x5730dd[_0x2f24c8][_0xf8fa('0x24')]+'!');_0x4102e1[_0xf8fa('0x25')]=_0x5730dd[_0x2f24c8][_0xf8fa('0x24')];}}}}if(!_0x524a12){logger[_0xf8fa('0x26')]('['+[_0x3d87e2[_0xf8fa('0x22')]()]+_0xf8fa('0x27'));_0x4102e1[_0xf8fa('0x1f')]=_0x20be52[_0xf8fa('0x28')];for(_0x2f24c8=0x0;_0x2f24c8<_0x5730dd['length'];_0x2f24c8++){if(_0x5730dd[_0x2f24c8][_0xf8fa('0x29')]===_0x20be52[_0xf8fa('0x28')]){_0x4102e1[_0xf8fa('0x25')]=_0x5730dd[_0x2f24c8][_0xf8fa('0x24')];}}}_0x4e483e(_0x4102e1);})[_0xf8fa('0x2a')](function(_0x2cb853){_0x57e161(_0x2cb853[_0xf8fa('0x18')]);});});}function createEndUser(_0x57ac8f,_0x1beb6a,_0x136a57,_0x3b662d,_0x96965d,_0x12ee47,_0x4e85f2){return new Promise(function(_0x19bac3,_0x22b126){return getAuthToken(_0x1beb6a,_0x136a57,_0x12ee47)[_0xf8fa('0x15')](function(_0x124be5){var _0x4cb290=_0x12ee47[_0xf8fa('0x2b')]()==='outbound'?_0x96965d[_0xf8fa('0x2c')]:_0x96965d[_0xf8fa('0x2d')];var _0x423c0e={'method':_0xf8fa('0x12'),'uri':_0x3b662d+_0xf8fa('0x2e'),'body':{'fullname':_0x4cb290,'firstname':_0x4cb290,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x57ac8f['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x124be5,'OData-Version':_0xf8fa('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x423c0e[_0xf8fa('0x30')][_0x4e85f2]=_0x4cb290;return rp(_0x423c0e);})['then'](function(_0x512f8c){var _0x16048f=_0x512f8c[_0xf8fa('0x31')]['odata-entityid'];var _0x39b9f6=_0x16048f[_0xf8fa('0x32')](_0x16048f[_0xf8fa('0x33')]('(')+0x1,_0x16048f['lastIndexOf'](')'));_0x57ac8f[_0xf8fa('0x34')]=_0x39b9f6;_0x19bac3(_0x57ac8f);})[_0xf8fa('0x2a')](function(_0x2573a1){_0x22b126(_0x2573a1[_0xf8fa('0x18')]);});});}function getEndUser(_0x32ca22,_0xd24b5e,_0x23f54e,_0x5b69d9,_0x264d48,_0x1b4b2f,_0x367973,_0x509715){var _0x507ae2=_0x1b4b2f[_0xf8fa('0x2b')]()===_0xf8fa('0x35')?_0x264d48['destcalleridnum']:_0x264d48[_0xf8fa('0x2d')];return getAuthToken(_0xd24b5e,_0x23f54e,_0x1b4b2f)[_0xf8fa('0x15')](function(_0x54aa36){_0x509715=_0x509715?_0x509715:_0xf8fa('0x36');var _0x12faff={'method':_0xf8fa('0x37'),'uri':_0x5b69d9+_0xf8fa('0x38')+_0x509715+_0xf8fa('0x39')+_0x509715+_0xf8fa('0x3a')+_0x507ae2['replace']('+',_0xf8fa('0x3b'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x54aa36,'If-None-Match':null,'OData-Version':_0xf8fa('0x1b')},'json':!![]};return rp(_0x12faff);})[_0xf8fa('0x15')](function(_0x3966dd){var _0x2e2980=![];if(!_0x3966dd)return _0x2e2980;var _0x15796e=_0x3966dd['value'];for(var _0x3f0303=0x0;_0x3f0303<_0x15796e[_0xf8fa('0x20')];_0x3f0303++){if(_0x15796e[_0x3f0303][_0x509715]===_0x507ae2){_0x2e2980=!![];_0x32ca22[_0xf8fa('0x34')]=_0x15796e[_0x3f0303][_0xf8fa('0x3c')];}}return _0x2e2980;})[_0xf8fa('0x15')](function(_0x128e8e){if(_0x128e8e)return _0x32ca22;if(_0x367973==='nothing'){logger[_0xf8fa('0x26')]('['+[_0x1b4b2f['toUpperCase']()]+_0xf8fa('0x3d'));return _0x32ca22;}return createEndUser(_0x32ca22,_0xd24b5e,_0x23f54e,_0x5b69d9,_0x264d48,_0x1b4b2f,_0x509715)[_0xf8fa('0x15')](function(_0x2c78e3){logger[_0xf8fa('0x26')]('['+[_0x1b4b2f[_0xf8fa('0x22')]()]+_0xf8fa('0x3e'),_0x2c78e3[_0xf8fa('0x34')]);return _0x2c78e3;});});}function getCustomFields(_0xe14451,_0x43630a,_0x53a42c){var _0x577e4f={};if(_0xe14451[_0xf8fa('0x20')]>0x0){_[_0xf8fa('0x3f')](_0xe14451,function(_0xa3215a){if(_['includes']([_0xf8fa('0x40'),_0xf8fa('0x41')],_0xa3215a[_0xf8fa('0x42')])&&_0xa3215a[_0xf8fa('0x43')]&&!_0xa3215a[_0xf8fa('0x44')]){var _0x1fdd12=_0xa3215a[_0xf8fa('0x45')][_0xf8fa('0x2b')]();var _0x137184=_0x1fdd12[_0xf8fa('0x32')](0x0,_0x1fdd12[_0xf8fa('0x46')]('_'));var _0x3427d6=_0x1fdd12[_0xf8fa('0x32')](_0x1fdd12[_0xf8fa('0x46')]('_')+0x1);if(_0x137184===_0x53a42c){_0x577e4f[_0x3427d6]=_0xa3215a[_0xf8fa('0x47')];}}});}return _0x577e4f;}function getTicket(_0x5ac073,_0x1c1bb4,_0x29e602,_0x39347d,_0x11c60e,_0x1cb862,_0x2155e1){return new Promise(function(_0x5ea92e,_0x5a50a6){var _0x443efc;return getAuthToken(_0x1c1bb4,_0x29e602,_0x2155e1)[_0xf8fa('0x15')](function(_0x2eb654){if(_0x1cb862[_0xf8fa('0x48')]===_0xf8fa('0x49')){_0x443efc={'method':_0xf8fa('0x12'),'uri':_0x39347d+'incidents','body':Object[_0xf8fa('0x4a')]({},{'title':intUtil['getString'](_0x1cb862['Subjects'],_0x11c60e,'\x20'),'description':intUtil['getString'](_0x1cb862[_0xf8fa('0x4b')],_0x11c60e,'\x0a'),'customerid_contact@odata.bind':_0x5ac073['enduserId']?_0xf8fa('0x4c')+_0x5ac073['enduserId']+')':undefined,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1cb862[_0xf8fa('0x4d')],_0x11c60e,_0x1cb862[_0xf8fa('0x48')])),'headers':{'Authorization':_0xf8fa('0x1a')+_0x2eb654,'OData-Version':_0xf8fa('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1cb862['ticketType']==='phonecall'){var _0x5ecdcd=_0x5ac073[_0xf8fa('0x34')]?[{'partyid_systemuser@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xf8fa('0x4c')+_0x5ac073[_0xf8fa('0x34')]+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf8fa('0x2f')+_0x5ac073['userId']+')','participationtypemask':_0x5ac073[_0xf8fa('0x4e')]===_0xf8fa('0x4f')?0x2:0x1}];_0x443efc={'method':_0xf8fa('0x12'),'uri':_0x39347d+_0xf8fa('0x50'),'body':Object[_0xf8fa('0x4a')]({},{'subject':intUtil['getString'](_0x1cb862[_0xf8fa('0x51')],_0x11c60e,'\x20'),'phonenumber':String(_0x11c60e['calleridnum']),'description':intUtil[_0xf8fa('0x52')](_0x1cb862[_0xf8fa('0x4b')],_0x11c60e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5ac073[_0xf8fa('0x34')]?_0xf8fa('0x4c')+_0x5ac073[_0xf8fa('0x34')]+')':undefined,'ownerid@odata.bind':_0xf8fa('0x2f')+_0x5ac073[_0xf8fa('0x25')]+')','directioncode':_0x5ac073[_0xf8fa('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5ecdcd},getCustomFields(_0x1cb862[_0xf8fa('0x4d')],_0x11c60e,_0x1cb862[_0xf8fa('0x48')])),'headers':{'Authorization':_0xf8fa('0x1a')+_0x2eb654,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x443efc);})[_0xf8fa('0x15')](function(_0x3cca03){var _0x3439ab=_0x3cca03[_0xf8fa('0x31')][_0xf8fa('0x53')];var _0x18fe86=_0x3439ab[_0xf8fa('0x32')](_0x3439ab[_0xf8fa('0x33')]('(')+0x1,_0x3439ab[_0xf8fa('0x33')](')'));_0x5ac073[_0xf8fa('0x54')]=_0x18fe86;_0x5ea92e(_0x5ac073);})[_0xf8fa('0x2a')](function(_0xb17aa2){_0x5a50a6(_0xb17aa2[_0xf8fa('0x18')]);});});}function emit(_0x1a3ff6,_0x4721be,_0x24be82,_0x5e424b){var _0x13753e={'uri':util[_0xf8fa('0x55')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1a3ff6,_0x24be82,_0x5e424b)};io['to'](util['format'](_0xf8fa('0x56'),_0x4721be))[_0xf8fa('0x57')](_0xf8fa('0x58'),_0x13753e);}exports['cs']=function(_0x2de061,_0xdbeeed,_0x357fa8,_0x2b5011,_0x4ae2a7,_0x10badd,_0x5ee473,_0x4bbc32){var _0x5ea21b={};_0x10badd[_0xf8fa('0xc')]=_0x10badd[_0xf8fa('0xb')]?intUtil[_0xf8fa('0x59')](_0x10badd[_0xf8fa('0xd')]['data7']):intUtil[_0xf8fa('0x59')](_0x10badd[_0xf8fa('0xc')]);_0x10badd[_0xf8fa('0x5a')]=intUtil['stripTrailingSlash'](_0x10badd['serverUrl']);_0x5ea21b[_0xf8fa('0x4e')]=_0x4bbc32===_0xf8fa('0x4f')||_0x4bbc32===_0xf8fa('0x5b')?'queue':_0xf8fa('0x35');var _0x30b2c2=_0x10badd['modernAuthentication']?util[_0xf8fa('0x55')](_0xf8fa('0x5c'),_0x10badd[_0xf8fa('0xd')]['data7']):util[_0xf8fa('0x55')](_0xf8fa('0x5c'),_0x10badd[_0xf8fa('0xc')]);var _0x29e33f=util[_0xf8fa('0x55')](_0xf8fa('0x5d'),_0x10badd[_0xf8fa('0x5e')]);var _0x926154=util[_0xf8fa('0x55')](_0xf8fa('0x5f'),_0x10badd[_0xf8fa('0x5a')],_0xdbeeed[_0xf8fa('0x60')],md5(_0xdbeeed['uniqueid']));if(_0x4ae2a7&&_0x4ae2a7[_0xf8fa('0x61')]){logger[_0xf8fa('0x26')](_0xf8fa('0x62'),_0xf8fa('0x63'));_0xdbeeed[_0xf8fa('0x64')]=_0x926154;}else if(_0x5ee473&&_0x5ee473['recordingFormat']&&_0x5ee473[_0xf8fa('0x65')]!==_0xf8fa('0x66')){logger[_0xf8fa('0x26')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xdbeeed[_0xf8fa('0x64')]=_0x926154;}else{_0xdbeeed['recordingURL']='';}return getUser(_0x5ea21b,_0x10badd,_0x2b5011,_0x29e33f,_0x30b2c2,_0x4bbc32)[_0xf8fa('0x15')](function(_0x175a02){logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x67'),_0x175a02[_0xf8fa('0x25')]);logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x68'),_0x175a02[_0xf8fa('0x1f')]);return getEndUser(_0x175a02,_0x10badd,_0x29e33f,_0x30b2c2,_0xdbeeed,_0x4bbc32,_0x357fa8['moduleCreate'],_0x357fa8[_0xf8fa('0x69')]);})[_0xf8fa('0x15')](function(_0x1d6afe){logger[_0xf8fa('0x26')]('['+_0x4bbc32['toUpperCase']()+_0xf8fa('0x6a'),_0x1d6afe['enduserId']);logger['info']('['+_0x4bbc32[_0xf8fa('0x22')]()+']\x20The\x20Enduser\x20phone\x20is:',_0xdbeeed['calleridnum']);return getTicket(_0x1d6afe,_0x10badd,_0x29e33f,_0x30b2c2,_0xdbeeed,_0x357fa8,_0x4bbc32);})['then'](function(_0x4452d5){logger[_0xf8fa('0x26')](util[_0xf8fa('0x55')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6b'),_0x357fa8['ticketType'],_0x4452d5[_0xf8fa('0x54')]));logger[_0xf8fa('0x26')](util[_0xf8fa('0x55')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6c'),_0x4bbc32));if(_0x4bbc32!==_0xf8fa('0x5b')&&_0x357fa8['openNewTab']){logger[_0xf8fa('0x26')]('['+_0x4bbc32[_0xf8fa('0x22')]()+']',_0xf8fa('0x6d'));emit(_0x10badd[_0xf8fa('0xc')],_0x2b5011[_0xf8fa('0x6e')],_0x357fa8['ticketType'],_0x4452d5[_0xf8fa('0x54')]);}})[_0xf8fa('0x2a')](function(_0x58a3b5){logger[_0xf8fa('0x16')]('['+_0x4bbc32[_0xf8fa('0x22')]()+_0xf8fa('0x6f'),_0x58a3b5[_0xf8fa('0x18')]);console[_0xf8fa('0x16')](_0xf8fa('0x70'),_0x58a3b5);});}; \ 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 537f8b2..569076e 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 _0x1f59=['lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','variable','variableName','Variable','push','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x1f59,0x1bf));var _0x91f5=function(_0x2f0af8,_0x4d7e8b){_0x2f0af8=_0x2f0af8-0x0;var _0x3f782f=_0x1f59[_0x2f0af8];return _0x3f782f;};'use strict';var _=require('lodash');var rp=require(_0x91f5('0x0'));var md5=require(_0x91f5('0x1'));var util=require(_0x91f5('0x2'));var Redis=require(_0x91f5('0x3'));var intUtil=require(_0x91f5('0x4'));var config=require(_0x91f5('0x5'));var logger=require('../../../../config/logger')(_0x91f5('0x6'));config[_0x91f5('0x7')]=_[_0x91f5('0x8')](config[_0x91f5('0x7')],{'host':_0x91f5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x91f5('0xa')};function emit(_0x578c04,_0x234f3d,_0x298571){io['to'](_0x578c04)[_0x91f5('0xb')](_0x234f3d,_0x298571);}function getTicket(_0x1931ec,_0x3d348e,_0x39203a,_0x13be6c,_0x3ded98){logger[_0x91f5('0xc')](_0x91f5('0xd'));var _0x2c4214=_['merge']({'responder_id':_0x3d348e['id'],'requester_id':_0x39203a['id'],'name':util[_0x91f5('0xe')](_0x91f5('0xf'),_0x3ded98[_0x91f5('0x10')]),'phone':_0x3ded98['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x91f5('0x11')](_0x13be6c['Subjects'],_0x3ded98,'\x20'),'description':intUtil[_0x91f5('0x11')](_0x13be6c[_0x91f5('0x12')],_0x3ded98,_0x91f5('0x13')),'tags':getTags(_0x13be6c['Tags'],_0x91f5('0x14'))},getCustomFields(_0x13be6c[_0x91f5('0x15')],_0x3ded98));_0x2c4214[_0x91f5('0x16')]=_[_0x91f5('0x17')](_[_0x91f5('0x18')](_0x2c4214[_0x91f5('0x16')],'id'),_0x91f5('0x19'));return request({'uri':util[_0x91f5('0xe')](_0x91f5('0x1a'),_0x1931ec[_0x91f5('0x1b')]),'method':_0x91f5('0x1c'),'body':_0x2c4214})[_0x91f5('0x1d')](function(_0x210ac5){logger[_0x91f5('0xc')](_0x91f5('0x1e'));return _0x210ac5;});}function getUser(_0x2d5d9d,_0x367f8c){if(intUtil['validateEmail'](_0x367f8c)){return request({'uri':util['format'](_0x91f5('0x1f'),_0x2d5d9d[_0x91f5('0x1b')]),'qs':{'email':_0x367f8c}})[_0x91f5('0x1d')](function(_0x295f0c){if(_0x295f0c[_0x91f5('0x20')]){logger[_0x91f5('0xc')]('Agent\x20found!');return _[_0x91f5('0x21')](_0x295f0c,function(_0x5431e4){return _0x5431e4[_0x91f5('0x22')]['email']===_0x367f8c;});}else{logger[_0x91f5('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x91f5('0xe')]('%s/api/v2/agents/me',_0x2d5d9d[_0x91f5('0x1b')])})[_0x91f5('0x1d')](function(_0x218771){logger[_0x91f5('0xc')](_0x91f5('0x23'));return _0x218771;});}});}else{logger[_0x91f5('0xc')](_0x91f5('0x24'));return request({'uri':util['format'](_0x91f5('0x25'),_0x2d5d9d[_0x91f5('0x1b')])})['then'](function(_0x2abe9f){logger[_0x91f5('0xc')](_0x91f5('0x23'));return _0x2abe9f;});}}function getEndUser(_0x3f5498,_0x1434ec,_0x57089a){logger[_0x91f5('0xc')](_0x91f5('0x26'),_0x57089a);return request({'uri':util['format'](_0x91f5('0x27'),_0x3f5498[_0x91f5('0x1b')]),'qs':{'phone':_0x57089a}})[_0x91f5('0x1d')](function(_0x1f78f1){if(_0x1f78f1['length']){logger[_0x91f5('0xc')]('Enduser\x20found!');return _[_0x91f5('0x21')](_0x1f78f1,{'phone':_0x57089a});}else{logger['info'](_0x91f5('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x3f5498['remoteUri']),'method':_0x91f5('0x1c'),'body':{'name':_0x1434ec,'phone':_0x57089a}})['then'](function(_0x4bfaeb){logger[_0x91f5('0xc')]('Enduser\x20created.');return _0x4bfaeb;});}});}function getAuth(_0x39f0ce){return util[_0x91f5('0xe')](_0x91f5('0x29'),new Buffer(_0x39f0ce[_0x91f5('0x2a')]+':X')[_0x91f5('0x2b')]('base64'));}function request(_0xa4993){logger['debug'](_0x91f5('0x2c'),JSON[_0x91f5('0x2d')](_0xa4993));return rp(_[_0x91f5('0x8')](_0xa4993,{'method':_0x91f5('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x5ac6a7,_0x4345ad){var _0x120fad=[];if(_0x5ac6a7&&_0x5ac6a7[_0x91f5('0x20')]>0x0){_0x120fad=_[_0x91f5('0x2f')](_0x5ac6a7,_0x4345ad);}return _0x120fad;}function getCustomFields(_0x4cd1e2,_0xdc332a){var _0xb0243b=[];var _0x3ce8e8={'custom_fields':[]};if(_0x4cd1e2['length']>0x0){_[_0x91f5('0x30')](_0x4cd1e2,function(_0x3ece95){if(_[_0x91f5('0x31')]([_0x91f5('0x32'),_0x91f5('0x33')],_0x3ece95['type'])&&_0x3ece95[_0x91f5('0x34')]&&!_0x3ece95[_0x91f5('0x35')]){_0x3ce8e8[_0x3ece95[_0x91f5('0x34')][_0x91f5('0x36')]()]=_0x3ece95[_0x91f5('0x37')][_0x91f5('0x2b')]();}else if(_['includes'](['string',_0x91f5('0x33')],_0x3ece95[_0x91f5('0x38')])&&_0x3ece95[_0x91f5('0x39')]&&_0x3ece95[_0x91f5('0x35')]){_0x3ce8e8[_0x91f5('0x16')]['push']({'id':_0x3ece95[_0x91f5('0x39')],'value':_0x3ece95[_0x91f5('0x37')][_0x91f5('0x2b')]()});}else if(_0x3ece95[_0x91f5('0x38')]===_0x91f5('0x3a')&&_0x3ece95['variableName']&&_0x3ece95['idField']&&_0x3ece95['customField']){_0xdc332a[_0x3ece95[_0x91f5('0x3b')]]&&_0x3ce8e8[_0x91f5('0x16')]['push']({'id':_0x3ece95[_0x91f5('0x39')],'value':_0xdc332a[_0x3ece95[_0x91f5('0x3b')]][_0x91f5('0x2b')]()});}else if(_0x3ece95[_0x91f5('0x38')]==='customVariable'&&_0x3ece95['Variable']&&_0x3ece95[_0x91f5('0x3c')]['name']&&_0x3ece95[_0x91f5('0x39')]&&_0x3ece95['customField']){_0xdc332a[_0x3ece95[_0x91f5('0x3c')][_0x91f5('0x14')][_0x91f5('0x36')]()]&&_0x3ce8e8['custom_fields'][_0x91f5('0x3d')]({'id':_0x3ece95[_0x91f5('0x39')],'value':_0xdc332a[_0x3ece95[_0x91f5('0x3c')][_0x91f5('0x14')][_0x91f5('0x36')]()][_0x91f5('0x2b')]()});}});}return _0x3ce8e8;}exports[_0x91f5('0x3e')]=function(_0x462c53,_0x405497,_0x246ef9,_0x5a3b27,_0x36486d,_0x39eba9){var _0x22b379,_0xe02978;_0x39eba9[_0x91f5('0x1b')]=intUtil['stripTrailingSlash'](_0x39eba9[_0x91f5('0x1b')]);_0x39eba9['serverUrl']=intUtil[_0x91f5('0x3f')](_0x39eba9['serverUrl']);if(_0x36486d&&_0x36486d[_0x91f5('0x40')]){logger['info'](_0x91f5('0x41'),_0x91f5('0x42'));_0x405497[_0x91f5('0x43')]=util[_0x91f5('0xe')](_0x91f5('0x44'),_0x39eba9[_0x91f5('0x45')],_0x405497[_0x91f5('0x46')],md5(_0x405497[_0x91f5('0x46')]));}else{_0x405497[_0x91f5('0x43')]='';}headers[_0x91f5('0x47')]=getAuth(_0x39eba9);return getUser(_0x39eba9,_0x5a3b27[_0x91f5('0x48')])[_0x91f5('0x1d')](function(_0x4ca98f){_0x22b379=_0x4ca98f;logger[_0x91f5('0xc')](_0x91f5('0x49'),_0x22b379['id']);return getEndUser(_0x39eba9,_0x405497[_0x91f5('0x10')],_0x405497[_0x91f5('0x4a')]);})['then'](function(_0x369dfc){_0xe02978=_0x369dfc;logger[_0x91f5('0xc')](_0x91f5('0x4b'),_0xe02978['id']);return getTicket(_0x39eba9,_0x22b379,_0xe02978,_0x246ef9,_0x405497);})['then'](function(_0x2ea29b){if(_0x2ea29b&&_0x2ea29b['id']){logger[_0x91f5('0xc')](_0x91f5('0x1e'));logger['info'](_0x91f5('0x4c'),_0x2ea29b['id']);logger[_0x91f5('0xc')](_0x91f5('0x41'),_0x91f5('0x4d'));emit(util[_0x91f5('0xe')](_0x91f5('0x4e'),_0x5a3b27[_0x91f5('0x14')]),_0x91f5('0x4f'),{'uri':util[_0x91f5('0xe')]('%s/helpdesk/tickets/%d',_0x39eba9[_0x91f5('0x1b')],_0x2ea29b['id'])});}})[_0x91f5('0x50')](function(_0x1d8702){logger[_0x91f5('0x51')](_0x91f5('0x41'),JSON[_0x91f5('0x2d')](_0x1d8702));});};exports[_0x91f5('0x52')]=function(_0x552428,_0x5bd3eb,_0x1b45bc,_0x45ef73,_0x5d8c01,_0x1d3beb,_0x1b2653){var _0x4d9c39,_0x5780b9;_0x1d3beb[_0x91f5('0x1b')]=intUtil[_0x91f5('0x3f')](_0x1d3beb[_0x91f5('0x1b')]);_0x1d3beb[_0x91f5('0x45')]=intUtil[_0x91f5('0x3f')](_0x1d3beb[_0x91f5('0x45')]);if(_0x1b2653&&_0x1b2653['recordingFormat']&&_0x1b2653[_0x91f5('0x53')]!==_0x91f5('0x54')){logger[_0x91f5('0xc')](_0x91f5('0x55'),_0x91f5('0x42'));_0x5bd3eb[_0x91f5('0x43')]=util['format'](_0x91f5('0x44'),_0x1d3beb[_0x91f5('0x45')],_0x5bd3eb['uniqueid'],md5(_0x5bd3eb[_0x91f5('0x46')]));}headers['Authorization']=getAuth(_0x1d3beb);return getUser(_0x1d3beb,_0x45ef73[_0x91f5('0x48')])['then'](function(_0x23f76d){_0x4d9c39=_0x23f76d;logger['info'](_0x91f5('0x49'),_0x4d9c39['id']);return getEndUser(_0x1d3beb,_0x5bd3eb['destcalleridname'],_0x5bd3eb[_0x91f5('0x56')]);})['then'](function(_0x523d99){_0x5780b9=_0x523d99;logger[_0x91f5('0xc')](_0x91f5('0x4b'),_0x5780b9['id']);return getTicket(_0x1d3beb,_0x4d9c39,_0x5780b9,_0x1b45bc,_0x5bd3eb);})[_0x91f5('0x1d')](function(_0x33997c){if(_0x33997c&&_0x33997c['id']){logger[_0x91f5('0xc')](_0x91f5('0x1e'));logger[_0x91f5('0xc')](_0x91f5('0x4c'),_0x33997c['id']);logger[_0x91f5('0xc')](_0x91f5('0x55'),_0x91f5('0x4d'));emit(util['format'](_0x91f5('0x4e'),_0x45ef73[_0x91f5('0x14')]),_0x91f5('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1d3beb[_0x91f5('0x1b')],_0x33997c['id'])});}})[_0x91f5('0x50')](function(_0x2a1fa8){logger[_0x91f5('0x51')](_0x91f5('0x55'),JSON[_0x91f5('0x2d')](_0x2a1fa8));});};exports['unmanaged']=function(_0xc06d6,_0x1e1eca,_0x58fbc8,_0x399fa5,_0x42cfb6,_0x45dfee){var _0x455a47,_0x2beb6c;_0x45dfee[_0x91f5('0x1b')]=intUtil[_0x91f5('0x3f')](_0x45dfee[_0x91f5('0x1b')]);_0x45dfee[_0x91f5('0x45')]=intUtil[_0x91f5('0x3f')](_0x45dfee[_0x91f5('0x45')]);if(_0x42cfb6&&_0x42cfb6[_0x91f5('0x40')]){logger[_0x91f5('0xc')]('['+_0x1e1eca[_0x91f5('0x57')][_0x91f5('0x58')]()+']',_0x91f5('0x42'));_0x1e1eca[_0x91f5('0x43')]=util[_0x91f5('0xe')](_0x91f5('0x44'),_0x45dfee['serverUrl'],_0x1e1eca[_0x91f5('0x46')],md5(_0x1e1eca[_0x91f5('0x46')]));}else{_0x1e1eca['recordingURL']='';}headers[_0x91f5('0x47')]=getAuth(_0x45dfee);return getUser(_0x45dfee,'')[_0x91f5('0x1d')](function(_0x233c91){_0x455a47=_0x233c91;logger[_0x91f5('0xc')](_0x91f5('0x49'),_0x455a47['id']);return getEndUser(_0x45dfee,_0x1e1eca[_0x91f5('0x10')],_0x1e1eca[_0x91f5('0x4a')]);})[_0x91f5('0x1d')](function(_0x1109c5){_0x2beb6c=_0x1109c5;logger[_0x91f5('0xc')](_0x91f5('0x4b'),_0x2beb6c['id']);return getTicket(_0x45dfee,_0x455a47,_0x2beb6c,_0x58fbc8,_0x1e1eca);})[_0x91f5('0x1d')](function(_0x48be6a){if(_0x48be6a){logger[_0x91f5('0xc')](_0x91f5('0x1e'));logger[_0x91f5('0xc')](_0x91f5('0x4c'),_0x48be6a['id']);}})[_0x91f5('0x50')](function(_0x4a4c6e){logger[_0x91f5('0x51')]('['+_0x1e1eca[_0x91f5('0x57')]['toUpperCase']()+']',JSON['stringify'](_0x4a4c6e));});}; \ No newline at end of file +var _0xb198=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','trigger:browser:url','error','lastevent','toUpperCase','request-promise','md5','util','./util','freshdesk','redis','localhost'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xb198,0xab));var _0x8b19=function(_0x80e0d6,_0x117ea7){_0x80e0d6=_0x80e0d6-0x0;var _0x3a5fc7=_0xb198[_0x80e0d6];return _0x3a5fc7;};'use strict';var _=require('lodash');var rp=require(_0x8b19('0x0'));var md5=require(_0x8b19('0x1'));var util=require(_0x8b19('0x2'));var Redis=require('ioredis');var intUtil=require(_0x8b19('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8b19('0x4'));config[_0x8b19('0x5')]=_['defaults'](config[_0x8b19('0x5')],{'host':_0x8b19('0x6'),'port':0x18eb});var io=require(_0x8b19('0x7'))(new Redis(config[_0x8b19('0x5')]));var headers={'Content-Type':_0x8b19('0x8'),'Accept':'application/json'};function emit(_0xf33c28,_0x4f7a2b,_0x572ba8){io['to'](_0xf33c28)[_0x8b19('0x9')](_0x4f7a2b,_0x572ba8);}function getTicket(_0x54a8b4,_0x294f8f,_0x4d865d,_0x134a39,_0x274876){logger[_0x8b19('0xa')](_0x8b19('0xb'));var _0x2f16ed=_[_0x8b19('0xc')]({'responder_id':_0x294f8f['id'],'requester_id':_0x4d865d['id'],'name':util[_0x8b19('0xd')](_0x8b19('0xe'),_0x274876[_0x8b19('0xf')]),'phone':_0x274876[_0x8b19('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8b19('0x11')](_0x134a39[_0x8b19('0x12')],_0x274876,'\x20'),'description':intUtil['getString'](_0x134a39[_0x8b19('0x13')],_0x274876,_0x8b19('0x14')),'tags':getTags(_0x134a39['Tags'],_0x8b19('0x15'))},getCustomFields(_0x134a39[_0x8b19('0x16')],_0x274876));_0x2f16ed[_0x8b19('0x17')]=_[_0x8b19('0x18')](_[_0x8b19('0x19')](_0x2f16ed[_0x8b19('0x17')],'id'),_0x8b19('0x1a'));return request({'uri':util['format'](_0x8b19('0x1b'),_0x54a8b4[_0x8b19('0x1c')]),'method':_0x8b19('0x1d'),'body':_0x2f16ed})[_0x8b19('0x1e')](function(_0x1200e7){logger[_0x8b19('0xa')]('Ticket\x20created!');return _0x1200e7;});}function getUser(_0x19b511,_0x474e23){if(intUtil['validateEmail'](_0x474e23)){return request({'uri':util['format']('%s/api/v2/agents',_0x19b511[_0x8b19('0x1c')]),'qs':{'email':_0x474e23}})[_0x8b19('0x1e')](function(_0x35779e){if(_0x35779e['length']){logger['info'](_0x8b19('0x1f'));return _[_0x8b19('0x20')](_0x35779e,function(_0x5da144){return _0x5da144['contact']['email']===_0x474e23;});}else{logger[_0x8b19('0xa')](_0x8b19('0x21'));return request({'uri':util[_0x8b19('0xd')]('%s/api/v2/agents/me',_0x19b511[_0x8b19('0x1c')])})[_0x8b19('0x1e')](function(_0x3fb64e){logger['info'](_0x8b19('0x22'));return _0x3fb64e;});}});}else{logger[_0x8b19('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8b19('0xd')](_0x8b19('0x23'),_0x19b511[_0x8b19('0x1c')])})[_0x8b19('0x1e')](function(_0x314982){logger[_0x8b19('0xa')]('Admin\x20account\x20selected.');return _0x314982;});}}function getEndUser(_0x4a8631,_0x11dea0,_0x1a0af2){logger[_0x8b19('0xa')](_0x8b19('0x24'),_0x1a0af2);return request({'uri':util['format'](_0x8b19('0x25'),_0x4a8631[_0x8b19('0x1c')]),'qs':{'phone':_0x1a0af2}})['then'](function(_0x591694){if(_0x591694[_0x8b19('0x26')]){logger['info'](_0x8b19('0x27'));return _[_0x8b19('0x20')](_0x591694,{'phone':_0x1a0af2});}else{logger[_0x8b19('0xa')](_0x8b19('0x28'));return request({'uri':util['format'](_0x8b19('0x25'),_0x4a8631[_0x8b19('0x1c')]),'method':_0x8b19('0x1d'),'body':{'name':_0x11dea0,'phone':_0x1a0af2}})[_0x8b19('0x1e')](function(_0x54b3e3){logger[_0x8b19('0xa')](_0x8b19('0x29'));return _0x54b3e3;});}});}function getAuth(_0x58a55c){return util['format'](_0x8b19('0x2a'),new Buffer(_0x58a55c['apiKey']+':X')[_0x8b19('0x2b')]('base64'));}function request(_0xc59596){logger[_0x8b19('0x2c')](_0x8b19('0x2d'),JSON[_0x8b19('0x2e')](_0xc59596));return rp(_[_0x8b19('0x2f')](_0xc59596,{'method':_0x8b19('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x1ec209,_0x186c3f){var _0x881512=[];if(_0x1ec209&&_0x1ec209[_0x8b19('0x26')]>0x0){_0x881512=_[_0x8b19('0x31')](_0x1ec209,_0x186c3f);}return _0x881512;}function getCustomFields(_0x15505f,_0x5efde7){var _0x4312bc=[];var _0x154987={'custom_fields':[]};if(_0x15505f[_0x8b19('0x26')]>0x0){_[_0x8b19('0x32')](_0x15505f,function(_0x215225){if(_[_0x8b19('0x33')](['string',_0x8b19('0x34')],_0x215225[_0x8b19('0x35')])&&_0x215225[_0x8b19('0x36')]&&!_0x215225[_0x8b19('0x37')]){_0x154987[_0x215225['nameField'][_0x8b19('0x38')]()]=_0x215225[_0x8b19('0x39')]['toString']();}else if(_[_0x8b19('0x33')]([_0x8b19('0x3a'),_0x8b19('0x34')],_0x215225[_0x8b19('0x35')])&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x154987['custom_fields'][_0x8b19('0x3c')]({'id':_0x215225['idField'],'value':_0x215225[_0x8b19('0x39')][_0x8b19('0x2b')]()});}else if(_0x215225['type']==='variable'&&_0x215225[_0x8b19('0x3d')]&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x5efde7[_0x215225[_0x8b19('0x3d')]]&&_0x154987[_0x8b19('0x17')][_0x8b19('0x3c')]({'id':_0x215225['idField'],'value':_0x5efde7[_0x215225[_0x8b19('0x3d')]][_0x8b19('0x2b')]()});}else if(_0x215225[_0x8b19('0x35')]==='customVariable'&&_0x215225['Variable']&&_0x215225[_0x8b19('0x3e')]['name']&&_0x215225[_0x8b19('0x3b')]&&_0x215225[_0x8b19('0x37')]){_0x5efde7[_0x215225['Variable'][_0x8b19('0x15')][_0x8b19('0x38')]()]&&_0x154987[_0x8b19('0x17')][_0x8b19('0x3c')]({'id':_0x215225[_0x8b19('0x3b')],'value':_0x5efde7[_0x215225[_0x8b19('0x3e')][_0x8b19('0x15')][_0x8b19('0x38')]()]['toString']()});}});}return _0x154987;}exports[_0x8b19('0x3f')]=function(_0xa39126,_0x503d5e,_0x335f08,_0x285c04,_0xf9c0d9,_0x3e7ddc){var _0x5758bd,_0xb8fe9d;_0x3e7ddc[_0x8b19('0x1c')]=intUtil[_0x8b19('0x40')](_0x3e7ddc[_0x8b19('0x1c')]);_0x3e7ddc[_0x8b19('0x41')]=intUtil['stripTrailingSlash'](_0x3e7ddc[_0x8b19('0x41')]);if(_0xf9c0d9&&_0xf9c0d9[_0x8b19('0x42')]){logger[_0x8b19('0xa')]('[QUEUE]',_0x8b19('0x43'));_0x503d5e['recordingURL']=util[_0x8b19('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e7ddc['serverUrl'],_0x503d5e[_0x8b19('0x44')],md5(_0x503d5e[_0x8b19('0x44')]));}else{_0x503d5e['recordingURL']='';}headers[_0x8b19('0x45')]=getAuth(_0x3e7ddc);return getUser(_0x3e7ddc,_0x285c04[_0x8b19('0x46')])[_0x8b19('0x1e')](function(_0x59fc3b){_0x5758bd=_0x59fc3b;logger['info'](_0x8b19('0x47'),_0x5758bd['id']);return getEndUser(_0x3e7ddc,_0x503d5e[_0x8b19('0xf')],_0x503d5e[_0x8b19('0x10')]);})['then'](function(_0x3e1e28){_0xb8fe9d=_0x3e1e28;logger[_0x8b19('0xa')](_0x8b19('0x48'),_0xb8fe9d['id']);return getTicket(_0x3e7ddc,_0x5758bd,_0xb8fe9d,_0x335f08,_0x503d5e);})[_0x8b19('0x1e')](function(_0x44744f){if(_0x44744f&&_0x44744f['id']){logger['info'](_0x8b19('0x49'));logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x44744f['id']);logger[_0x8b19('0xa')](_0x8b19('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8b19('0xd')]('user:%s',_0x285c04[_0x8b19('0x15')]),'trigger:browser:url',{'uri':util[_0x8b19('0xd')](_0x8b19('0x4c'),_0x3e7ddc[_0x8b19('0x1c')],_0x44744f['id'])});}})[_0x8b19('0x4d')](function(_0x3b033b){logger['error']('[QUEUE]',JSON['stringify'](_0x3b033b));});};exports[_0x8b19('0x4e')]=function(_0x1cce57,_0x12b977,_0x247a3c,_0x547ee8,_0x3a1e19,_0x17146e,_0x34ef57){var _0x16a935,_0xe8432e;_0x17146e[_0x8b19('0x1c')]=intUtil[_0x8b19('0x40')](_0x17146e[_0x8b19('0x1c')]);_0x17146e['serverUrl']=intUtil['stripTrailingSlash'](_0x17146e['serverUrl']);if(_0x34ef57&&_0x34ef57[_0x8b19('0x4f')]&&_0x34ef57[_0x8b19('0x4f')]!==_0x8b19('0x50')){logger[_0x8b19('0xa')](_0x8b19('0x51'),'Recording\x20is\x20enabled!');_0x12b977[_0x8b19('0x52')]=util[_0x8b19('0xd')](_0x8b19('0x53'),_0x17146e[_0x8b19('0x41')],_0x12b977[_0x8b19('0x44')],md5(_0x12b977[_0x8b19('0x44')]));}headers[_0x8b19('0x45')]=getAuth(_0x17146e);return getUser(_0x17146e,_0x547ee8[_0x8b19('0x46')])[_0x8b19('0x1e')](function(_0x10629c){_0x16a935=_0x10629c;logger['info'](_0x8b19('0x47'),_0x16a935['id']);return getEndUser(_0x17146e,_0x12b977[_0x8b19('0x54')],_0x12b977['destcalleridnum']);})['then'](function(_0x130c26){_0xe8432e=_0x130c26;logger[_0x8b19('0xa')]('The\x20Enduser\x20ID\x20is:',_0xe8432e['id']);return getTicket(_0x17146e,_0x16a935,_0xe8432e,_0x247a3c,_0x12b977);})['then'](function(_0x598079){if(_0x598079&&_0x598079['id']){logger[_0x8b19('0xa')](_0x8b19('0x49'));logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x598079['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8b19('0xd')]('user:%s',_0x547ee8['name']),_0x8b19('0x55'),{'uri':util[_0x8b19('0xd')]('%s/helpdesk/tickets/%d',_0x17146e[_0x8b19('0x1c')],_0x598079['id'])});}})['catch'](function(_0x40a63b){logger[_0x8b19('0x56')](_0x8b19('0x51'),JSON[_0x8b19('0x2e')](_0x40a63b));});};exports['unmanaged']=function(_0xbe2166,_0x3349ca,_0x17ed17,_0x37ea50,_0x8603c8,_0x4ec56e){var _0x352c23,_0x4bea9b;_0x4ec56e[_0x8b19('0x1c')]=intUtil['stripTrailingSlash'](_0x4ec56e[_0x8b19('0x1c')]);_0x4ec56e['serverUrl']=intUtil[_0x8b19('0x40')](_0x4ec56e[_0x8b19('0x41')]);if(_0x8603c8&&_0x8603c8[_0x8b19('0x42')]){logger[_0x8b19('0xa')]('['+_0x3349ca[_0x8b19('0x57')][_0x8b19('0x58')]()+']',_0x8b19('0x43'));_0x3349ca['recordingURL']=util[_0x8b19('0xd')](_0x8b19('0x53'),_0x4ec56e[_0x8b19('0x41')],_0x3349ca[_0x8b19('0x44')],md5(_0x3349ca[_0x8b19('0x44')]));}else{_0x3349ca[_0x8b19('0x52')]='';}headers['Authorization']=getAuth(_0x4ec56e);return getUser(_0x4ec56e,'')[_0x8b19('0x1e')](function(_0x1ef188){_0x352c23=_0x1ef188;logger[_0x8b19('0xa')](_0x8b19('0x47'),_0x352c23['id']);return getEndUser(_0x4ec56e,_0x3349ca['calleridname'],_0x3349ca[_0x8b19('0x10')]);})[_0x8b19('0x1e')](function(_0x2e862a){_0x4bea9b=_0x2e862a;logger[_0x8b19('0xa')]('The\x20Enduser\x20ID\x20is:',_0x4bea9b['id']);return getTicket(_0x4ec56e,_0x352c23,_0x4bea9b,_0x17ed17,_0x3349ca);})[_0x8b19('0x1e')](function(_0x35a0a0){if(_0x35a0a0){logger['info']('Ticket\x20created!');logger[_0x8b19('0xa')](_0x8b19('0x4a'),_0x35a0a0['id']);}})[_0x8b19('0x4d')](function(_0x2dc28d){logger['error']('['+_0x3349ca['lastevent']['toUpperCase']()+']',JSON[_0x8b19('0x2e')](_0x2dc28d));});}; \ 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 8aa3754..f8555d1 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 _0xf320=['format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','task','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','headers','info','then','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','Admin\x20selected','userId','/api/lookup?q=','&f=','&entities=contact','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts'];(function(_0x184d49,_0x31018c){var _0x28f3ef=function(_0x29a474){while(--_0x29a474){_0x184d49['push'](_0x184d49['shift']());}};_0x28f3ef(++_0x31018c);}(_0xf320,0x1d9));var _0x0f32=function(_0x3b6c59,_0x10c316){_0x3b6c59=_0x3b6c59-0x0;var _0x6d60c8=_0xf320[_0x3b6c59];return _0x6d60c8;};'use strict';var _=require(_0x0f32('0x0'));var rp=require(_0x0f32('0x1'));var md5=require(_0x0f32('0x2'));var util=require(_0x0f32('0x3'));var moment=require(_0x0f32('0x4'));var Promise=require(_0x0f32('0x5'));var Redis=require(_0x0f32('0x6'));var intUtil=require(_0x0f32('0x7'));var config=require(_0x0f32('0x8'));var logger=require(_0x0f32('0x9'))(_0x0f32('0xa'));config[_0x0f32('0xb')]=_['defaults'](config[_0x0f32('0xb')],{'host':_0x0f32('0xc'),'port':0x18eb});var io=require(_0x0f32('0xd'))(new Redis(config['redis']));function getAdminId(_0x231e7d,_0x429693,_0x2c93a5,_0x5ced4d){return new Promise(function(_0x2e277d,_0x17cf83){var _0x1a024a=![];var _0x1aae4c={'method':'GET','uri':_0x5ced4d+'/api/selector/owners','json':!![]};_0x1aae4c[_0x0f32('0xe')]=_0x2c93a5;logger[_0x0f32('0xf')]('Getting\x20admin\x20information');return rp(_0x1aae4c)[_0x0f32('0x10')](function(_0x1a90ed){if(_0x1a90ed){var _0x5e7f25=_0x1a90ed[_0x0f32('0x11')];var _0x5f43ed=null;for(_0x5f43ed=0x0;_0x5f43ed<_0x5e7f25[_0x0f32('0x12')];_0x5f43ed++){if(_0x5e7f25[_0x5f43ed]['email']===_0x231e7d[_0x0f32('0x13')]){_0x231e7d['adminId']=_0x5e7f25[_0x5f43ed]['id'];_0x1a024a=!![];}}if(_0x1a024a){logger['info'](_0x0f32('0x14'),_0x231e7d[_0x0f32('0x15')]);_0x2e277d(_0x231e7d);}else{_0x17cf83({'statusCode':0x194,'message':_0x0f32('0x16')});}}else{_0x17cf83({'statusCode':0x194,'message':_0x0f32('0x16')});}})[_0x0f32('0x17')](function(_0x282478){logger[_0x0f32('0x18')]('['+[_0x429693[_0x0f32('0x19')]()]+']',_0x282478[_0x0f32('0x1a')]);_0x17cf83(_0x282478);});});}function getUser(_0x49cf5,_0x595596,_0x331bb6){return function(_0x3776b7){return new Promise(function(_0xae8018,_0x3b029a){var _0x505c3c={'method':_0x0f32('0x1b'),'uri':_0x331bb6+_0x0f32('0x1c'),'json':!![]};_0x505c3c[_0x0f32('0xe')]=_0x595596;logger[_0x0f32('0xf')](_0x0f32('0x1d'));return rp(_0x505c3c)[_0x0f32('0x10')](function(_0x1a4ef2){if(_0x1a4ef2){var _0xc61a08=_0x1a4ef2[_0x0f32('0x11')];var _0x529362=![];var _0x9ce0f1=null;if(_0x3776b7[_0x0f32('0x1e')]!==null){logger[_0x0f32('0xf')](_0x0f32('0x1f'),_0x3776b7[_0x0f32('0x1e')]);_0x3776b7[_0x0f32('0x20')]=_0x3776b7[_0x0f32('0x1e')];for(_0x9ce0f1=0x0;_0x9ce0f1<_0xc61a08[_0x0f32('0x12')];_0x9ce0f1++){if(_0xc61a08[_0x9ce0f1][_0x0f32('0x21')]===_0x3776b7['agentEmail']){_0x529362=!![];_0x3776b7['userId']=_0xc61a08[_0x9ce0f1]['id'];logger[_0x0f32('0xf')](_0x0f32('0x22'),_0x3776b7['userId']);}}}if(!_0x529362){logger[_0x0f32('0xf')](_0x0f32('0x23'));_0x3776b7[_0x0f32('0x20')]=_0x3776b7[_0x0f32('0x13')];_0x3776b7[_0x0f32('0x24')]=_0x3776b7[_0x0f32('0x15')];_0x529362=!![];}if(_0x529362){_0xae8018(_0x3776b7);}else{_0x3b029a({'statusCode':0x194,'message':_0x0f32('0x16')});}}else{_0x3b029a({'statusCode':0x194,'message':_0x0f32('0x16')});}})[_0x0f32('0x17')](function(_0x50cb49){logger[_0x0f32('0x18')]('['+[_0x49cf5[_0x0f32('0x19')]()]+']',_0x50cb49['message']);_0x3b029a(_0x50cb49);});});};}function searchContact(_0x17ab4c,_0x3111c1,_0x4073aa,_0x290c0b){return new Promise(function(_0x26e6da,_0x2c6faf){var _0x5bef08={'method':_0x0f32('0x1b'),'headers':_0x3111c1,'uri':_0x17ab4c+_0x0f32('0x25')+_0x290c0b+_0x0f32('0x26')+_0x4073aa+_0x0f32('0x27'),'json':!![]};rp(_0x5bef08)[_0x0f32('0x10')](function(_0x416cf2){var _0x2a7bec=_[_0x0f32('0x28')](_0x416cf2[_0x0f32('0x29')][_0x0f32('0x29')],[_0x4073aa,_0x290c0b]);_0x26e6da(_0x2a7bec);})['catch'](function(_0x1cbec6){_0x2c6faf(_0x1cbec6);});});}function getEndUser(_0x301a0c,_0x488186,_0x507378){return function(_0x5064bf){return new Promise(function(_0x3d8677,_0x13fc9f){logger[_0x0f32('0xf')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x5064bf[_0x0f32('0x2a')]));searchContact(_0x507378,_0x488186,'mobile_number',_0x5064bf['contactNumber'])['then'](function(_0x4fdfa2){if(_0x4fdfa2){_0x5064bf[_0x0f32('0x2b')]=_0x4fdfa2['id'];logger[_0x0f32('0xf')](_0x0f32('0x2c'),_0x5064bf[_0x0f32('0x2b')]);return _0x3d8677(_0x5064bf);}searchContact(_0x507378,_0x488186,_0x0f32('0x2d'),_0x5064bf[_0x0f32('0x2a')])[_0x0f32('0x10')](function(_0x6de844){if(_0x6de844){_0x5064bf[_0x0f32('0x2b')]=_0x6de844['id'];logger[_0x0f32('0xf')](_0x0f32('0x2e'),_0x5064bf['endUserId']);return _0x3d8677(_0x5064bf);}createEndUser(_0x5064bf,_0x301a0c,_0x488186,_0x507378)[_0x0f32('0x10')](function(_0x2076a4){logger['info'](_0x0f32('0x2f'),_0x2076a4[_0x0f32('0x2b')]);return _0x3d8677(_0x2076a4);});});})[_0x0f32('0x17')](function(_0x264966){_0x13fc9f(_0x264966);});});};}function createEndUser(_0x3bb853,_0x948c40,_0x4d412d,_0x6f3642){return new Promise(function(_0x2393c4,_0x37523f){var _0x29fbda=moment();var _0x35cfd7={'method':'POST','uri':_0x6f3642+_0x0f32('0x30'),'body':{'contact':{'last_name':_0x3bb853[_0x0f32('0x2a')],'work_number':_0x3bb853[_0x0f32('0x2a')],'mobile_number':_0x3bb853['contactNumber'],'owner_id':_0x3bb853['userId'],'created_at':_0x29fbda[_0x0f32('0x31')](_0x0f32('0x32'))}},'json':!![]};_0x35cfd7[_0x0f32('0xe')]=_0x4d412d;logger[_0x0f32('0xf')](_0x0f32('0x33'));return rp(_0x35cfd7)['then'](function(_0x456ce3){_0x3bb853[_0x0f32('0x2b')]=_0x456ce3[_0x0f32('0x34')]['id'];_0x2393c4(_0x3bb853);})[_0x0f32('0x17')](function(_0x51b4c6){logger[_0x0f32('0x18')]('['+[_0x948c40['toUpperCase']()]+']',_0x51b4c6[_0x0f32('0x1a')]);_0x37523f(_0x51b4c6[_0x0f32('0x1a')]);});});}function getTicket(_0xa0ab98,_0xe5a1fc,_0xbbef69,_0x276923,_0x3a2a8d){return function(_0x1f5016){logger[_0x0f32('0xf')](_0x0f32('0x35'));return new Promise(function(_0x58482a,_0xeb782a){var _0x54a035=moment();var _0x2a902c={'method':'POST','uri':_0xbbef69+_0x0f32('0x36'),'body':{'title':intUtil[_0x0f32('0x37')](_0x276923['Subjects'],_0x3a2a8d,'\x20'),'description':intUtil['getString'](_0x276923[_0x0f32('0x38')],_0x3a2a8d,'\x0a'),'owner_id':_0x1f5016['userId'],'creater_id':_0x1f5016[_0x0f32('0x15')],'targetable_id':_0x1f5016[_0x0f32('0x2b')],'targetable_type':_0x0f32('0x39'),'created_at':_0x54a035[_0x0f32('0x31')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x54a035['add'](0x1e,'m')[_0x0f32('0x31')](_0x0f32('0x32'))},'json':!![]};_0x2a902c[_0x0f32('0xe')]=_0xe5a1fc;return rp(_0x2a902c)[_0x0f32('0x10')](function(_0x3e3b20){_0x1f5016['ticketId']=_0x3e3b20[_0x0f32('0x3a')]['id'];logger[_0x0f32('0xf')](_0x0f32('0x3b'),_0x1f5016[_0x0f32('0x3c')]);_0x58482a(_0x1f5016);})[_0x0f32('0x17')](function(_0x36fc9b){logger[_0x0f32('0x18')]('['+[_0xa0ab98[_0x0f32('0x19')]()]+']',_0x36fc9b[_0x0f32('0x1a')]);_0xeb782a(_0x36fc9b['message']);});});};}function emit(_0x5318e9,_0x37f096,_0x401820){var _0xc08b5e={'uri':_0x5318e9+'/contacts/'+_0x401820};io['to'](util['format'](_0x0f32('0x3d'),_0x37f096))[_0x0f32('0x3e')]('trigger:browser:url',_0xc08b5e);}exports['cs']=function(_0x77c5aa,_0x521d05,_0x32eee5,_0x5bd2cc,_0x3ff01e,_0x129351,_0x1203ea,_0xdbb232){var _0x1fddb1={};var _0x3b6381={'Authorization':_0x0f32('0x3f')+_0x129351[_0x0f32('0x40')]};_0x129351[_0x0f32('0x41')]=intUtil[_0x0f32('0x42')](_0x129351[_0x0f32('0x41')]);_0x129351[_0x0f32('0x43')]=intUtil[_0x0f32('0x42')](_0x129351['serverUrl']);var _0xad80c=_0x129351['remoteUri'];_0x1fddb1[_0x0f32('0x13')]=_0x129351[_0x0f32('0x44')];_0x1fddb1[_0x0f32('0x2a')]=_0xdbb232[_0x0f32('0x45')]()===_0x0f32('0x46')?_0x521d05['destcalleridnum']:_0x521d05[_0x0f32('0x47')];_0x1fddb1[_0x0f32('0x48')]=_0xdbb232===_0x0f32('0x49')||_0xdbb232===_0x0f32('0x4a')?_0x0f32('0x49'):_0x0f32('0x46');if(_0x5bd2cc){_0x1fddb1['agentEmail']=_0x5bd2cc['email'];}var _0x559cb3=util[_0x0f32('0x31')](_0x0f32('0x4b'),_0x129351[_0x0f32('0x43')],_0x521d05[_0x0f32('0x4c')],md5(_0x521d05[_0x0f32('0x4c')]));if(_0x3ff01e&&_0x3ff01e[_0x0f32('0x4d')]){logger[_0x0f32('0xf')](_0x0f32('0x4e'),'Recording\x20is\x20enabled!');_0x521d05['recordingURL']=_0x559cb3;}else if(_0x1203ea&&_0x1203ea[_0x0f32('0x4f')]&&_0x1203ea[_0x0f32('0x4f')]!==_0x0f32('0x50')){logger[_0x0f32('0xf')](_0x0f32('0x51'),'Recording\x20is\x20enabled!');_0x521d05[_0x0f32('0x52')]=_0x559cb3;}else{_0x521d05[_0x0f32('0x52')]='';}return getAdminId(_0x1fddb1,_0xdbb232,_0x3b6381,_0xad80c)['then'](getUser(_0xdbb232,_0x3b6381,_0xad80c))[_0x0f32('0x10')](getEndUser(_0xdbb232,_0x3b6381,_0xad80c))[_0x0f32('0x10')](getTicket(_0xdbb232,_0x3b6381,_0xad80c,_0x32eee5,_0x521d05))[_0x0f32('0x10')](function(_0x47a0f3){logger[_0x0f32('0xf')](util[_0x0f32('0x31')](_0x0f32('0x53'),_0x47a0f3[_0x0f32('0x3c')]));if(_0xdbb232!=='unmanaged'){logger[_0x0f32('0xf')]('['+[_0xdbb232[_0x0f32('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0xad80c,_0x5bd2cc[_0x0f32('0x54')],_0x47a0f3['endUserId']);}})[_0x0f32('0x17')](function(_0x48c7aa){logger['error']('['+[_0xdbb232[_0x0f32('0x19')]()]+_0x0f32('0x55'),util[_0x0f32('0x56')](_0x48c7aa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xed4d=['Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','GET','headers','Getting\x20admin\x20information','then','length','email','adminEmail','info','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminId','catch','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:'];(function(_0x22e740,_0x131a29){var _0x2f8d1a=function(_0x4ce65b){while(--_0x4ce65b){_0x22e740['push'](_0x22e740['shift']());}};_0x2f8d1a(++_0x131a29);}(_0xed4d,0x1a8));var _0xded4=function(_0x14d8b4,_0x4f4b03){_0x14d8b4=_0x14d8b4-0x0;var _0x585537=_0xed4d[_0x14d8b4];return _0x585537;};'use strict';var _=require(_0xded4('0x0'));var rp=require('request-promise');var md5=require(_0xded4('0x1'));var util=require('util');var moment=require(_0xded4('0x2'));var Promise=require('bluebird');var Redis=require(_0xded4('0x3'));var intUtil=require(_0xded4('0x4'));var config=require(_0xded4('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0xded4('0x6')]=_['defaults'](config['redis'],{'host':_0xded4('0x7'),'port':0x18eb});var io=require(_0xded4('0x8'))(new Redis(config[_0xded4('0x6')]));function getAdminId(_0x3df944,_0x1d23c2,_0x1722a1,_0x58e75a){return new Promise(function(_0x51f9c1,_0x12a8fe){var _0x4d66da=![];var _0x235067={'method':_0xded4('0x9'),'uri':_0x58e75a+'/api/selector/owners','json':!![]};_0x235067[_0xded4('0xa')]=_0x1722a1;logger['info'](_0xded4('0xb'));return rp(_0x235067)[_0xded4('0xc')](function(_0x2f7796){if(_0x2f7796){var _0x5a232d=_0x2f7796['users'];var _0x30988e=null;for(_0x30988e=0x0;_0x30988e<_0x5a232d[_0xded4('0xd')];_0x30988e++){if(_0x5a232d[_0x30988e][_0xded4('0xe')]===_0x3df944[_0xded4('0xf')]){_0x3df944['adminId']=_0x5a232d[_0x30988e]['id'];_0x4d66da=!![];}}if(_0x4d66da){logger[_0xded4('0x10')]('Admin\x20found:',_0x3df944['adminId']);_0x51f9c1(_0x3df944);}else{_0x12a8fe({'statusCode':0x194,'message':_0xded4('0x11')});}}else{_0x12a8fe({'statusCode':0x194,'message':_0xded4('0x11')});}})['catch'](function(_0x2d8d4c){logger[_0xded4('0x12')]('['+[_0x1d23c2[_0xded4('0x13')]()]+']',_0x2d8d4c[_0xded4('0x14')]);_0x12a8fe(_0x2d8d4c);});});}function getUser(_0x2e7b7b,_0x1ea5d2,_0x5c5d31){return function(_0x47eb58){return new Promise(function(_0x6aa398,_0x488a06){var _0x48ae66={'method':_0xded4('0x9'),'uri':_0x5c5d31+_0xded4('0x15'),'json':!![]};_0x48ae66[_0xded4('0xa')]=_0x1ea5d2;logger[_0xded4('0x10')](_0xded4('0x16'));return rp(_0x48ae66)[_0xded4('0xc')](function(_0x45d0a6){if(_0x45d0a6){var _0x5563c2=_0x45d0a6['users'];var _0xe02c9b=![];var _0x53279e=null;if(_0x47eb58[_0xded4('0x17')]!==null){logger[_0xded4('0x10')]('Getting\x20user\x20with\x20email',_0x47eb58['agentEmail']);_0x47eb58[_0xded4('0x18')]=_0x47eb58[_0xded4('0x17')];for(_0x53279e=0x0;_0x53279e<_0x5563c2[_0xded4('0xd')];_0x53279e++){if(_0x5563c2[_0x53279e][_0xded4('0xe')]===_0x47eb58[_0xded4('0x17')]){_0xe02c9b=!![];_0x47eb58[_0xded4('0x19')]=_0x5563c2[_0x53279e]['id'];logger[_0xded4('0x10')](_0xded4('0x1a'),_0x47eb58[_0xded4('0x19')]);}}}if(!_0xe02c9b){logger[_0xded4('0x10')](_0xded4('0x1b'));_0x47eb58[_0xded4('0x18')]=_0x47eb58[_0xded4('0xf')];_0x47eb58[_0xded4('0x19')]=_0x47eb58[_0xded4('0x1c')];_0xe02c9b=!![];}if(_0xe02c9b){_0x6aa398(_0x47eb58);}else{_0x488a06({'statusCode':0x194,'message':_0xded4('0x11')});}}else{_0x488a06({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xded4('0x1d')](function(_0x129b66){logger[_0xded4('0x12')]('['+[_0x2e7b7b[_0xded4('0x13')]()]+']',_0x129b66[_0xded4('0x14')]);_0x488a06(_0x129b66);});});};}function searchContact(_0x31c820,_0x2aba4d,_0xa043f5,_0x10f5ce){return new Promise(function(_0x548b7a,_0x4f1b31){var _0x1666c2={'method':_0xded4('0x9'),'headers':_0x2aba4d,'uri':_0x31c820+'/api/lookup?q='+_0x10f5ce+'&f='+_0xa043f5+'&entities=contact','json':!![]};rp(_0x1666c2)[_0xded4('0xc')](function(_0x32dccb){var _0x468967=_['find'](_0x32dccb['contacts'][_0xded4('0x1e')],[_0xa043f5,_0x10f5ce]);_0x548b7a(_0x468967);})[_0xded4('0x1d')](function(_0x4dfbac){_0x4f1b31(_0x4dfbac);});});}function getEndUser(_0x28ab56,_0x374fe2,_0x45b2b1){return function(_0x28884e){return new Promise(function(_0x49e840,_0x4c3c73){logger[_0xded4('0x10')](util[_0xded4('0x1f')]('Searching\x20contact\x20with\x20phone\x20%s',_0x28884e[_0xded4('0x20')]));searchContact(_0x45b2b1,_0x374fe2,_0xded4('0x21'),_0x28884e[_0xded4('0x20')])[_0xded4('0xc')](function(_0x5f5257){if(_0x5f5257){_0x28884e[_0xded4('0x22')]=_0x5f5257['id'];logger['info'](_0xded4('0x23'),_0x28884e[_0xded4('0x22')]);return _0x49e840(_0x28884e);}searchContact(_0x45b2b1,_0x374fe2,_0xded4('0x24'),_0x28884e[_0xded4('0x20')])[_0xded4('0xc')](function(_0x3629c7){if(_0x3629c7){_0x28884e[_0xded4('0x22')]=_0x3629c7['id'];logger[_0xded4('0x10')](_0xded4('0x25'),_0x28884e['endUserId']);return _0x49e840(_0x28884e);}createEndUser(_0x28884e,_0x28ab56,_0x374fe2,_0x45b2b1)[_0xded4('0xc')](function(_0x59e62f){logger[_0xded4('0x10')](_0xded4('0x26'),_0x59e62f[_0xded4('0x22')]);return _0x49e840(_0x59e62f);});});})[_0xded4('0x1d')](function(_0x553553){_0x4c3c73(_0x553553);});});};}function createEndUser(_0x19d696,_0x87946d,_0x39a41f,_0x1a68ce){return new Promise(function(_0x96ff15,_0x54d224){var _0x1a5e42=moment();var _0x159483={'method':_0xded4('0x27'),'uri':_0x1a68ce+_0xded4('0x28'),'body':{'contact':{'last_name':_0x19d696['contactNumber'],'work_number':_0x19d696[_0xded4('0x20')],'mobile_number':_0x19d696[_0xded4('0x20')],'owner_id':_0x19d696['userId'],'created_at':_0x1a5e42['format'](_0xded4('0x29'))}},'json':!![]};_0x159483[_0xded4('0xa')]=_0x39a41f;logger[_0xded4('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x159483)[_0xded4('0xc')](function(_0x1601a7){_0x19d696[_0xded4('0x22')]=_0x1601a7[_0xded4('0x2a')]['id'];_0x96ff15(_0x19d696);})[_0xded4('0x1d')](function(_0x3ae6d4){logger[_0xded4('0x12')]('['+[_0x87946d[_0xded4('0x13')]()]+']',_0x3ae6d4['message']);_0x54d224(_0x3ae6d4[_0xded4('0x14')]);});});}function getTicket(_0x8d687,_0x477993,_0x2d8128,_0x125845,_0x43486c){return function(_0x4d66b8){logger['info'](_0xded4('0x2b'));return new Promise(function(_0x533fd6,_0x3245c2){var _0x1f08ba=moment();var _0x4a9f99={'method':'POST','uri':_0x2d8128+_0xded4('0x2c'),'body':{'title':intUtil['getString'](_0x125845[_0xded4('0x2d')],_0x43486c,'\x20'),'description':intUtil['getString'](_0x125845[_0xded4('0x2e')],_0x43486c,'\x0a'),'owner_id':_0x4d66b8[_0xded4('0x19')],'creater_id':_0x4d66b8[_0xded4('0x1c')],'targetable_id':_0x4d66b8[_0xded4('0x22')],'targetable_type':_0xded4('0x2f'),'created_at':_0x1f08ba[_0xded4('0x1f')](_0xded4('0x29')),'due_date':_0x1f08ba[_0xded4('0x30')](0x1e,'m')[_0xded4('0x1f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4a9f99[_0xded4('0xa')]=_0x477993;return rp(_0x4a9f99)[_0xded4('0xc')](function(_0x102357){_0x4d66b8[_0xded4('0x31')]=_0x102357[_0xded4('0x32')]['id'];logger['info'](_0xded4('0x33'),_0x4d66b8[_0xded4('0x31')]);_0x533fd6(_0x4d66b8);})['catch'](function(_0x3c445d){logger[_0xded4('0x12')]('['+[_0x8d687['toUpperCase']()]+']',_0x3c445d['message']);_0x3245c2(_0x3c445d[_0xded4('0x14')]);});});};}function emit(_0x157073,_0x2b56be,_0x221fda){var _0x4abdc7={'uri':_0x157073+_0xded4('0x34')+_0x221fda};io['to'](util['format']('user:%s',_0x2b56be))[_0xded4('0x35')](_0xded4('0x36'),_0x4abdc7);}exports['cs']=function(_0x443fd0,_0x46f074,_0x4d7fd0,_0x4f469c,_0x3e206c,_0x154382,_0x398406,_0x44a14a){var _0x34a371={};var _0x207c2c={'Authorization':_0xded4('0x37')+_0x154382[_0xded4('0x38')]};_0x154382[_0xded4('0x39')]=intUtil[_0xded4('0x3a')](_0x154382['remoteUri']);_0x154382[_0xded4('0x3b')]=intUtil[_0xded4('0x3a')](_0x154382[_0xded4('0x3b')]);var _0x19b244=_0x154382[_0xded4('0x39')];_0x34a371[_0xded4('0xf')]=_0x154382[_0xded4('0x3c')];_0x34a371[_0xded4('0x20')]=_0x44a14a['toLowerCase']()===_0xded4('0x3d')?_0x46f074[_0xded4('0x3e')]:_0x46f074['calleridnum'];_0x34a371[_0xded4('0x3f')]=_0x44a14a===_0xded4('0x40')||_0x44a14a===_0xded4('0x41')?_0xded4('0x40'):_0xded4('0x3d');if(_0x4f469c){_0x34a371[_0xded4('0x17')]=_0x4f469c[_0xded4('0xe')];}var _0x1b165f=util[_0xded4('0x1f')](_0xded4('0x42'),_0x154382['serverUrl'],_0x46f074[_0xded4('0x43')],md5(_0x46f074[_0xded4('0x43')]));if(_0x3e206c&&_0x3e206c[_0xded4('0x44')]){logger[_0xded4('0x10')]('[QUEUE]',_0xded4('0x45'));_0x46f074[_0xded4('0x46')]=_0x1b165f;}else if(_0x398406&&_0x398406[_0xded4('0x47')]&&_0x398406[_0xded4('0x47')]!==_0xded4('0x48')){logger[_0xded4('0x10')](_0xded4('0x49'),'Recording\x20is\x20enabled!');_0x46f074['recordingURL']=_0x1b165f;}else{_0x46f074[_0xded4('0x46')]='';}return getAdminId(_0x34a371,_0x44a14a,_0x207c2c,_0x19b244)['then'](getUser(_0x44a14a,_0x207c2c,_0x19b244))[_0xded4('0xc')](getEndUser(_0x44a14a,_0x207c2c,_0x19b244))[_0xded4('0xc')](getTicket(_0x44a14a,_0x207c2c,_0x19b244,_0x4d7fd0,_0x46f074))[_0xded4('0xc')](function(_0x3c7069){logger[_0xded4('0x10')](util[_0xded4('0x1f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3c7069[_0xded4('0x31')]));if(_0x44a14a!=='unmanaged'){logger[_0xded4('0x10')]('['+[_0x44a14a[_0xded4('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x19b244,_0x4f469c[_0xded4('0x4a')],_0x3c7069['endUserId']);}})[_0xded4('0x1d')](function(_0x4dc477){logger[_0xded4('0x12')]('['+[_0x44a14a[_0xded4('0x13')]()]+_0xded4('0x4b'),util[_0xded4('0x4c')](_0x4dc477,{'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 9083633..903eb13 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 _0x810f=['desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','format','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm'];(function(_0x1ed388,_0x4c1474){var _0x356c7f=function(_0x19b7e1){while(--_0x19b7e1){_0x1ed388['push'](_0x1ed388['shift']());}};_0x356c7f(++_0x4c1474);}(_0x810f,0x114));var _0xf810=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x810f[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xf810('0x0'));var util=require(_0xf810('0x1'));var zendesk=require(_0xf810('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xf810('0x3'));var freshdesk=require(_0xf810('0x4'));var zoho=require('./zoho');var desk=require(_0xf810('0x5'));var vtiger=require(_0xf810('0x6'));var servicenow=require(_0xf810('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xf810('0x8'));var integrations=[_0xf810('0x9'),_0xf810('0xa'),'sugarcrm',_0xf810('0xb'),_0xf810('0xc'),'desk',_0xf810('0xd'),'dynamics365','freshsales',_0xf810('0xe')];exports[_0xf810('0xf')]=function(_0x44da34,_0x509bd8,_0x3668c8,_0x10549b,_0xf90730,_0x1dcedb){if(_0x3668c8){if(_['includes'](integrations,_0x44da34[_0xf810('0x10')][_0xf810('0x11')]())){try{var _0x255889=null;var _0x16c9cf='';var _0x175f87=_0x3668c8[_0x44da34[_0xf810('0x10')]['toLowerCase']()];if(_0x175f87){var _0x2ec483=_0x175f87[_0x44da34[_0xf810('0x12')]];if(_0x2ec483){var _0x37d2ab=_[_0xf810('0x13')](_0x2ec483[_0xf810('0x14')],{'id':parseInt(_0x44da34['data3'],0xa)});if(_0x37d2ab){if(_0x10549b){if(_0xf90730&&_0x509bd8[_0xf810('0x15')]){_0x16c9cf=_0xf810('0x15');}else if(_0x509bd8[_0xf810('0x16')]){_0x16c9cf=_0xf810('0x17');}else{console[_0xf810('0x18')](_0xf810('0x19'),_0x509bd8);}}else{_0x16c9cf=_0xf810('0x1a');}switch(_0x44da34[_0xf810('0x10')][_0xf810('0x11')]()){case _0xf810('0x9'):zendesk[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0xa'):salesforce[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0x1b'):sugarcrm[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0xb'):freshdesk[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0xc'):zoho[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0x1c'):desk[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0xd'):vtiger[_0x16c9cf](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb);break;case _0xf810('0x1d'):freshsales['cs'](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb,_0x16c9cf);break;case _0xf810('0xe'):servicenow['cs'](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb,_0x16c9cf);break;case _0xf810('0x1e'):dynamics365['cs'](_0x44da34,_0x509bd8,_0x37d2ab,_0x10549b,_0xf90730,_0x2ec483,_0x1dcedb,_0x16c9cf);break;default:console[_0xf810('0x18')](_0xf810('0x1f'));}}else{_0x255889=require(_0xf810('0x20'))(_0x44da34[_0xf810('0x10')]['toLowerCase']());_0x255889[_0xf810('0x21')](_0xf810('0x22'),util['format'](_0xf810('0x23'),_0x44da34[_0xf810('0x10')][_0xf810('0x11')](),_0x44da34[_0xf810('0x24')]));}}else{_0x255889=require(_0xf810('0x20'))(_0x44da34['data1'][_0xf810('0x11')]());_0x255889[_0xf810('0x21')](_0xf810('0x22'),util[_0xf810('0x25')]('%s\x20account\x20#%s\x20not\x20found',_0x44da34['data1'][_0xf810('0x11')](),_0x44da34[_0xf810('0x12')]));}}else{}}catch(_0x33e6ae){console[_0xf810('0x21')](_0x33e6ae);}}}}; \ No newline at end of file +var _0x7987=['lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','find','Configurations','data3','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','error'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x7987,0x181));var _0x7798=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x7987[_0x57e00e];return _0x415e60;};'use strict';var _=require(_0x7798('0x0'));var util=require(_0x7798('0x1'));var zendesk=require(_0x7798('0x2'));var salesforce=require(_0x7798('0x3'));var sugarcrm=require(_0x7798('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x7798('0x5'));var desk=require('./desk');var vtiger=require(_0x7798('0x6'));var servicenow=require(_0x7798('0x7'));var dynamics365=require(_0x7798('0x8'));var freshsales=require('./freshsales');var integrations=[_0x7798('0x9'),_0x7798('0xa'),_0x7798('0xb'),_0x7798('0xc'),_0x7798('0xd'),_0x7798('0xe'),_0x7798('0xf'),_0x7798('0x10'),_0x7798('0x11'),'servicenow'];exports['exec']=function(_0x4ca66f,_0x3c2344,_0xc4dc07,_0x2e87a6,_0x27e9fe,_0x3a67bb){if(_0xc4dc07){if(_[_0x7798('0x12')](integrations,_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]())){try{var _0x5dd3d9=null;var _0x86f43d='';var _0x39442d=_0xc4dc07[_0x4ca66f['data1'][_0x7798('0x14')]()];if(_0x39442d){var _0x16e56a=_0x39442d[_0x4ca66f['data2']];if(_0x16e56a){var _0x163ae1=_[_0x7798('0x15')](_0x16e56a[_0x7798('0x16')],{'id':parseInt(_0x4ca66f[_0x7798('0x17')],0xa)});if(_0x163ae1){if(_0x2e87a6){if(_0x27e9fe&&_0x3c2344['queue']){_0x86f43d='queue';}else if(_0x3c2344[_0x7798('0x18')]){_0x86f43d=_0x7798('0x19');}else{console[_0x7798('0x1a')](_0x7798('0x1b'),_0x3c2344);}}else{_0x86f43d=_0x7798('0x1c');}switch(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]()){case'zendesk':zendesk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xa'):salesforce[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xb'):sugarcrm[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case'freshdesk':freshdesk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xd'):zoho[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xe'):desk[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0xf'):vtiger[_0x86f43d](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb);break;case _0x7798('0x11'):freshsales['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;case _0x7798('0x1d'):servicenow['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;case _0x7798('0x10'):dynamics365['cs'](_0x4ca66f,_0x3c2344,_0x163ae1,_0x2e87a6,_0x27e9fe,_0x16e56a,_0x3a67bb,_0x86f43d);break;default:console[_0x7798('0x1a')](_0x7798('0x1e'));}}else{_0x5dd3d9=require(_0x7798('0x1f'))(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]());_0x5dd3d9['error'](_0x7798('0x20'),util[_0x7798('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')](),_0x4ca66f['data3']));}}else{_0x5dd3d9=require(_0x7798('0x1f'))(_0x4ca66f[_0x7798('0x13')][_0x7798('0x14')]());_0x5dd3d9[_0x7798('0x22')](_0x7798('0x20'),util[_0x7798('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x4ca66f['data1'][_0x7798('0x14')](),_0x4ca66f['data2']));}}else{}}catch(_0xe598fd){console['error'](_0xe598fd);}}}}; \ 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 dc47704..dd6f871 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 _0xd157=['AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','stripTrailingSlash','recordingFormat','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','ticketType','Task','ActivityDate','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0xd157,0x16a));var _0x7d15=function(_0x499dcd,_0x319706){_0x499dcd=_0x499dcd-0x0;var _0x28e190=_0xd157[_0x499dcd];return _0x28e190;};'use strict';var _=require(_0x7d15('0x0'));var rp=require(_0x7d15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7d15('0x2'));var jsforce=require('jsforce');var util=require(_0x7d15('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7d15('0x4'));var config=require(_0x7d15('0x5'));var logger=require(_0x7d15('0x6'))(_0x7d15('0x7'));config[_0x7d15('0x8')]=_[_0x7d15('0x9')](config[_0x7d15('0x8')],{'host':_0x7d15('0xa'),'port':0x18eb});var io=require(_0x7d15('0xb'))(new Redis(config[_0x7d15('0x8')]));function emit(_0x1f9e2e,_0x3e70b1,_0x4fc6c1){io['to'](_0x1f9e2e)['emit'](_0x3e70b1,_0x4fc6c1);}function getTicket(_0x47ee01,_0xc184f8,_0x225bd9,_0x399068,_0x8c6c70,_0x4880c8,_0x5c6028,_0x3bcd86){var _0x5bd489=Object['assign']({},{'OwnerId':_0xc184f8['id'],'Subject':intUtil[_0x7d15('0xc')](_0x399068[_0x7d15('0xd')],_0x8c6c70,'\x20'),'Description':intUtil[_0x7d15('0xc')](_0x399068['Descriptions'],_0x8c6c70,'\x0a')},getCustomFields(_0x4880c8,_0x8c6c70));if(_0x225bd9){if(_0x399068[_0x7d15('0xe')]===_0x7d15('0xf')){_0x5bd489[_0x7d15('0x10')]=moment['utc']();_0x5bd489['IsReminderSet']=![];_0x5bd489[_0x7d15('0x11')]=![];if(_0x225bd9[_0x7d15('0x12')]==='contact'||_0x225bd9[_0x7d15('0x12')]===_0x7d15('0x13')){_0x5bd489[_0x7d15('0x14')]=_0x225bd9['id'];}else if(_0x225bd9['endUserType']===_0x7d15('0x15')){_0x5bd489[_0x7d15('0x16')]=_0x225bd9['id'];}}else if(_0x399068[_0x7d15('0xe')]==='Case'){if(_0x225bd9[_0x7d15('0x12')]===_0x7d15('0x17')){_0x5bd489[_0x7d15('0x18')]=_0x225bd9['id'];}else if(_0x225bd9[_0x7d15('0x12')]===_0x7d15('0x15')){_0x5bd489[_0x7d15('0x19')]=_0x225bd9['id'];}else if(_0x225bd9['endUserType']===_0x7d15('0x13')&&_0x399068[_0x7d15('0x1a')]){_0x5bd489[_0x399068['leadId']]=_0x225bd9['id'];}else{logger[_0x7d15('0x1b')](_0x7d15('0x1c'));}}}return _0x5c6028[_0x7d15('0x1d')](_0x399068[_0x7d15('0xe')])[_0x7d15('0x1e')](_0x5bd489);}function getUser(_0x2a683e,_0x125dfe,_0x1a1c02){if(!_[_0x7d15('0x1f')](_0x125dfe)&&intUtil[_0x7d15('0x20')](_0x125dfe)){var _0xd6d670={'Email':_0x125dfe};var _0xbba441={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1a1c02['sobject'](_0x7d15('0x21'))[_0x7d15('0x22')](_0xd6d670,_0xbba441)[_0x7d15('0x23')]()[_0x7d15('0x24')](function(_0x3ea3a3){if(_0x3ea3a3[_0x7d15('0x25')]){var _0x44ad9b=_[_0x7d15('0x22')](_0x3ea3a3,function(_0x89401a){return _0x89401a[_0x7d15('0x26')]===_0x125dfe;});if(_0x44ad9b){logger[_0x7d15('0x1b')](_0x7d15('0x27'),_0x125dfe);return BPromise[_0x7d15('0x28')]({'id':_0x44ad9b['Id'],'name':_0x44ad9b[_0x7d15('0x29')]});}}else{logger['info'](_0x7d15('0x2a'),_0x125dfe);return _0x1a1c02[_0x7d15('0x2b')]()['then'](function(_0x170259){return BPromise['resolve']({'id':_0x170259[_0x7d15('0x2c')],'name':_0x170259[_0x7d15('0x2d')]});});}});}else{logger[_0x7d15('0x1b')](_0x7d15('0x2a'),_0x125dfe);return _0x1a1c02[_0x7d15('0x2b')]()[_0x7d15('0x24')](function(_0x328ddb){return BPromise[_0x7d15('0x28')]({'id':_0x328ddb['user_id'],'name':_0x328ddb['display_name']});});}}function getEndUser(_0x29eba9,_0x6abcf2,_0x150371,_0x509207,_0xabda4b){var _0x8f3a37={'$or':{'Phone':_0x509207}};var _0x486076={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7d15('0x24')](function(){logger[_0x7d15('0x1b')](_0x7d15('0x2e'),_0x509207,_0x6abcf2['moduleSearch']);switch(_0x6abcf2[_0x7d15('0x2f')]){case _0x7d15('0x30'):var _0x5a7ac9=_['cloneDeep'](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x31')]){var _0x16b8b6={};_0x16b8b6[_0x6abcf2[_0x7d15('0x31')]]=_0x509207;_[_0x7d15('0x32')](_0x5a7ac9['$or'],_0x16b8b6);}return _0xabda4b['sobject']('Contact')[_0x7d15('0x22')](_0x5a7ac9,_0x486076)['execute']()[_0x7d15('0x24')](function(_0xb626c2){if(_0xb626c2&&_0xb626c2[_0x7d15('0x25')]){return _0xb626c2;}else{var _0x5b907e=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x34')]){var _0x3e5d61={};_0x3e5d61[_0x6abcf2[_0x7d15('0x34')]]=_0x509207;_[_0x7d15('0x32')](_0x5b907e[_0x7d15('0x35')],_0x3e5d61);}return _0xabda4b['sobject'](_0x7d15('0x36'))[_0x7d15('0x22')](_0x5b907e,_0x486076);}});case _0x7d15('0x37'):var _0x30868a=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x38')]){var _0x16b8b6={};_0x16b8b6[_0x6abcf2[_0x7d15('0x38')]]=_0x509207;_['merge'](_0x30868a[_0x7d15('0x35')],_0x16b8b6);}return _0xabda4b[_0x7d15('0x1d')](_0x7d15('0x39'))[_0x7d15('0x22')](_0x30868a,_0x486076)['execute']()['then'](function(_0x277f54){if(_0x277f54&&_0x277f54['length']){return _0x277f54;}else{var _0x4df75e=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x31')]){var _0x251b30={};_0x251b30[_0x6abcf2[_0x7d15('0x31')]]=_0x509207;_[_0x7d15('0x32')](_0x4df75e[_0x7d15('0x35')],_0x251b30);}return _0xabda4b[_0x7d15('0x1d')](_0x7d15('0x3a'))[_0x7d15('0x22')](_0x4df75e,_0x486076)[_0x7d15('0x24')](function(_0x57e576){if(_0x57e576&&_0x57e576[_0x7d15('0x25')]){return _0x57e576;}else{var _0x483149=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x34')]){var _0x26a3f7={};_0x26a3f7[_0x6abcf2[_0x7d15('0x34')]]=_0x509207;_[_0x7d15('0x32')](_0x483149['$or'],_0x26a3f7);}return _0xabda4b[_0x7d15('0x1d')](_0x7d15('0x36'))[_0x7d15('0x22')](_0x483149,_0x486076);}});}});case _0x7d15('0x17'):var _0x5a7ac9=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x31')]){var _0x16b8b6={};_0x16b8b6[_0x6abcf2['additionalSearchContact']]=_0x509207;_[_0x7d15('0x32')](_0x5a7ac9['$or'],_0x16b8b6);}return _0xabda4b[_0x7d15('0x1d')](_0x7d15('0x3a'))[_0x7d15('0x22')](_0x5a7ac9,_0x486076)[_0x7d15('0x23')]();case'lead':var _0x56532a=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x34')]){var _0x16b8b6={};_0x16b8b6[_0x6abcf2[_0x7d15('0x34')]]=_0x509207;_[_0x7d15('0x32')](_0x56532a[_0x7d15('0x35')],_0x16b8b6);}return _0xabda4b['sobject']('Lead')['find'](_0x56532a,_0x486076);case'account':var _0x30868a=_[_0x7d15('0x33')](_0x8f3a37);if(_0x6abcf2[_0x7d15('0x38')]){var _0x16b8b6={};_0x16b8b6[_0x6abcf2[_0x7d15('0x38')]]=_0x509207;_[_0x7d15('0x32')](_0x30868a[_0x7d15('0x35')],_0x16b8b6);}return _0xabda4b[_0x7d15('0x1d')](_0x7d15('0x39'))[_0x7d15('0x22')](_0x30868a,_0x486076);default:return null;}})[_0x7d15('0x24')](function(_0x1c9761){if(_0x1c9761&&_0x1c9761[_0x7d15('0x25')]){var _0x3813cd=_[_0x7d15('0x3b')](_0x1c9761);if(_0x3813cd){return BPromise[_0x7d15('0x28')]({'id':_0x3813cd['Id'],'name':_0x3813cd[_0x7d15('0x29')],'phone':_0x3813cd[_0x7d15('0x3c')],'endUserType':_0x3813cd['attributes']['type'][_0x7d15('0x3d')]()});}}})[_0x7d15('0x24')](function(_0x3e53ec){if(_0x3e53ec){logger[_0x7d15('0x1b')](_0x7d15('0x3e'),_0x3e53ec['endUserType'],_0x509207);return BPromise['resolve'](_0x3e53ec);}else{logger[_0x7d15('0x1b')](_0x7d15('0x3f'),_0x509207);var _0x20e791={'Phone':_0x509207};if(_0x6abcf2['moduleCreate']){if(_0x6abcf2[_0x7d15('0x40')]===_0x7d15('0x17')){logger[_0x7d15('0x1b')](_0x7d15('0x41'),_0x509207,_0x6abcf2['moduleCreate']);_0x20e791[_0x7d15('0x42')]=_0x150371!==_0x7d15('0x43')?_0x150371:util[_0x7d15('0x44')](_0x7d15('0x45'),_0x509207);}else if(_0x6abcf2['moduleCreate']===_0x7d15('0x13')){logger[_0x7d15('0x1b')](_0x7d15('0x41'),_0x509207,_0x6abcf2['moduleCreate']);_0x20e791[_0x7d15('0x42')]=_0x150371!==_0x7d15('0x43')?_0x150371:util[_0x7d15('0x44')]('Caller\x20-\x20%s',_0x509207);_0x20e791[_0x7d15('0x46')]='No\x20Company';}else if(_0x6abcf2[_0x7d15('0x40')]===_0x7d15('0x15')){logger[_0x7d15('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x509207,_0x6abcf2['moduleCreate']);_0x20e791[_0x7d15('0x29')]=_0x150371!==''?_0x150371:util[_0x7d15('0x44')]('Caller\x20-\x20%s',_0x509207);}else{return null;}}return _0xabda4b[_0x7d15('0x1d')](_[_0x7d15('0x47')](_0x6abcf2[_0x7d15('0x40')]))[_0x7d15('0x1e')](_0x20e791)[_0x7d15('0x24')](function(_0x365928){return BPromise['resolve']({'id':_0x365928['id'],'endUserType':_0x6abcf2[_0x7d15('0x40')]});});}});}function getCustomFields(_0x27a373,_0xcf844f){var _0xcd58c5={};if(_0x27a373[_0x7d15('0x25')]>0x0){_[_0x7d15('0x48')](_0x27a373,function(_0x54dc65){if(_[_0x7d15('0x49')]([_0x7d15('0x4a'),'picklist'],_0x54dc65[_0x7d15('0x4b')])&&_0x54dc65['idField']){_0xcd58c5[_0x54dc65[_0x7d15('0x4c')]]=_0x54dc65[_0x7d15('0x4d')][_0x7d15('0x4e')]();}else if(_0x54dc65[_0x7d15('0x4b')]===_0x7d15('0x4f')&&_0x54dc65[_0x7d15('0x50')]&&_0x54dc65['idField']){_0xcf844f[_0x54dc65[_0x7d15('0x50')]]&&(_0xcd58c5[_0x54dc65[_0x7d15('0x4c')]]=_0xcf844f[_0x54dc65[_0x7d15('0x50')]]['toString']());}else if(_0x54dc65['type']===_0x7d15('0x51')&&_0x54dc65[_0x7d15('0x52')]&&_0x54dc65[_0x7d15('0x52')]['name']&&_0x54dc65[_0x7d15('0x4c')]){_0xcf844f[_0x54dc65[_0x7d15('0x52')][_0x7d15('0x53')][_0x7d15('0x3d')]()]&&(_0xcd58c5[_0x54dc65[_0x7d15('0x4c')]]=_0xcf844f[_0x54dc65[_0x7d15('0x52')][_0x7d15('0x53')][_0x7d15('0x3d')]()]['toString']());}});}return _0xcd58c5;}function getConnection(_0x484fc1){var _0x58c192=_0x484fc1[_0x7d15('0x54')][_0x7d15('0x55')](_0x484fc1[_0x7d15('0x56')]);var _0x11f64a=new jsforce[(_0x7d15('0x57'))]({'oauth2':{'loginUrl':_0x484fc1[_0x7d15('0x58')]||_0x7d15('0x59'),'clientId':_0x484fc1[_0x7d15('0x5a')],'clientSecret':_0x484fc1['clientSecret']}});return _0x11f64a[_0x7d15('0x5b')](_0x484fc1['username'],_0x58c192)[_0x7d15('0x24')](function(){logger[_0x7d15('0x1b')](_0x7d15('0x5c'));return _0x11f64a;});}exports[_0x7d15('0x5d')]=function(_0x1b58db,_0x507218,_0x53dec0,_0x47fda6,_0x34cec8,_0xabe32a){var _0x333572,_0x4587b0,_0xd5191a,_0x273374;_0xabe32a[_0x7d15('0x5e')]=intUtil['stripTrailingSlash'](_0xabe32a[_0x7d15('0x5e')]);_0xabe32a[_0x7d15('0x58')]=intUtil['stripTrailingSlash'](_0xabe32a[_0x7d15('0x58')]);if(_0x34cec8&&_0x34cec8[_0x7d15('0x5f')]){logger[_0x7d15('0x1b')](_0x7d15('0x60'),_0x7d15('0x61'));_0x507218[_0x7d15('0x62')]=util[_0x7d15('0x44')](_0x7d15('0x63'),_0xabe32a[_0x7d15('0x5e')],_0x507218[_0x7d15('0x64')],md5(_0x507218[_0x7d15('0x64')]));}else{_0x507218[_0x7d15('0x62')]='';}return getConnection(_0xabe32a)[_0x7d15('0x24')](function(_0x5a9794){_0x273374=_0x5a9794;return getUser(_0xabe32a,_0x47fda6['email'],_0x273374);})[_0x7d15('0x24')](function(_0x105f75){_0x333572=_0x105f75;return getEndUser(_0xabe32a,_0x53dec0,_0x507218[_0x7d15('0x65')],_0x507218[_0x7d15('0x66')],_0x273374);})[_0x7d15('0x24')](function(_0x335535){_0x4587b0=_0x335535;return getTicket(_0xabe32a,_0x333572,_0x4587b0,_0x53dec0,_0x507218,_0x53dec0['Fields'],_0x273374,_0x7d15('0x5d'));})[_0x7d15('0x24')](function(_0x54c6bb){_0xd5191a=_0x54c6bb;logger[_0x7d15('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0xd5191a['id']);logger[_0x7d15('0x1b')](_0x7d15('0x67'),_0xd5191a['id'],_0x47fda6[_0x7d15('0x53')],_0xabe32a['type']);switch(_0xabe32a[_0x7d15('0x4b')]){case _0x7d15('0x68'):emit(util[_0x7d15('0x44')](_0x7d15('0x69'),_0x47fda6[_0x7d15('0x53')]),'trigger:salesforce:display',{'recordId':_0xd5191a['id']});break;case _0x7d15('0x6a'):emit(util[_0x7d15('0x44')](_0x7d15('0x69'),_0x47fda6['name']),_0x7d15('0x6b'),{'uri':util['format'](_0x7d15('0x6c'),_0x273374[_0x7d15('0x6d')],_0xd5191a['id'])});break;default:logger[_0x7d15('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2da691){logger[_0x7d15('0x6e')](_0x7d15('0x60'),_0x2da691);});};exports[_0x7d15('0x6f')]=function(_0x20d572,_0x17c86c,_0x258bd6,_0xf1f68e,_0x2455da,_0x4633c5,_0x11ffeb){var _0x5a2828,_0x556325,_0x46af69,_0xdb8a40;_0x4633c5[_0x7d15('0x5e')]=intUtil[_0x7d15('0x70')](_0x4633c5[_0x7d15('0x5e')]);_0x4633c5['remoteUri']=intUtil[_0x7d15('0x70')](_0x4633c5[_0x7d15('0x58')]);if(_0x11ffeb&&_0x11ffeb[_0x7d15('0x71')]&&_0x11ffeb['recordingFormat']!=='none'){logger[_0x7d15('0x1b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x17c86c[_0x7d15('0x62')]=util['format'](_0x7d15('0x63'),_0x4633c5[_0x7d15('0x5e')],_0x17c86c[_0x7d15('0x64')],md5(_0x17c86c[_0x7d15('0x64')]));}return getConnection(_0x4633c5)[_0x7d15('0x24')](function(_0x1c95df){_0xdb8a40=_0x1c95df;return getUser(_0x4633c5,_0xf1f68e[_0x7d15('0x72')],_0xdb8a40);})[_0x7d15('0x24')](function(_0x3310a3){_0x5a2828=_0x3310a3;return getEndUser(_0x4633c5,_0x258bd6,_0x17c86c[_0x7d15('0x73')],_0x17c86c[_0x7d15('0x74')],_0xdb8a40);})[_0x7d15('0x24')](function(_0x3c9fa4){_0x556325=_0x3c9fa4;return getTicket(_0x4633c5,_0x5a2828,_0x556325,_0x258bd6,_0x17c86c,_0x258bd6[_0x7d15('0x75')],_0xdb8a40,_0x7d15('0x6f'));})['then'](function(_0x1a9488){_0x46af69=_0x1a9488;logger[_0x7d15('0x1b')](_0x7d15('0x76'),_0x46af69['id']);logger[_0x7d15('0x1b')](_0x7d15('0x77'),_0x46af69['id'],_0xf1f68e['name'],_0x4633c5['type']);switch(_0x4633c5[_0x7d15('0x4b')]){case _0x7d15('0x68'):emit(util[_0x7d15('0x44')](_0x7d15('0x69'),_0xf1f68e[_0x7d15('0x53')]),_0x7d15('0x78'),{'recordId':_0x46af69['id']});break;case _0x7d15('0x6a'):emit(util['format'](_0x7d15('0x69'),_0xf1f68e[_0x7d15('0x53')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0xdb8a40[_0x7d15('0x6d')],_0x46af69['id'])});break;default:logger[_0x7d15('0x6e')](_0x7d15('0x79'),_0x7d15('0x7a'));}})[_0x7d15('0x7b')](function(_0x1d4995){logger[_0x7d15('0x6e')](_0x7d15('0x79'),_0x1d4995);});};exports[_0x7d15('0x7c')]=function(_0x2f5490,_0x46b7b2,_0x4db39c,_0x1e7825,_0x476027,_0x301176){var _0x49716e,_0x2378b8,_0x3aab85,_0x107259;_0x301176[_0x7d15('0x5e')]=intUtil[_0x7d15('0x70')](_0x301176[_0x7d15('0x5e')]);_0x301176[_0x7d15('0x58')]=intUtil[_0x7d15('0x70')](_0x301176['remoteUri']);if(_0x476027&&_0x476027[_0x7d15('0x5f')]){logger[_0x7d15('0x1b')]('['+_0x46b7b2['lastevent'][_0x7d15('0x7d')]()+']','Recording\x20is\x20enabled!');_0x46b7b2[_0x7d15('0x62')]=util[_0x7d15('0x44')](_0x7d15('0x63'),_0x301176[_0x7d15('0x5e')],_0x46b7b2[_0x7d15('0x64')],md5(_0x46b7b2[_0x7d15('0x64')]));}else{_0x46b7b2['recordingURL']='';}return getConnection(_0x301176)['then'](function(_0x12d75e){_0x107259=_0x12d75e;if(!_[_0x7d15('0x1f')](_0x1e7825)){return getUser(_0x301176,_0x1e7825[_0x7d15('0x53')],_0x107259);}else{return getUser(_0x301176,null,_0x107259);}})[_0x7d15('0x24')](function(_0x4e0cb2){_0x49716e=_0x4e0cb2;return getEndUser(_0x301176,_0x4db39c,_0x46b7b2[_0x7d15('0x65')],_0x46b7b2[_0x7d15('0x66')],_0x107259);})['then'](function(_0x331302){_0x2378b8=_0x331302;return getTicket(_0x301176,_0x49716e,_0x2378b8,_0x4db39c,_0x46b7b2,_0x4db39c[_0x7d15('0x75')],_0x107259);})[_0x7d15('0x24')](function(_0xafa2ea){_0x3aab85=_0xafa2ea;logger[_0x7d15('0x1b')]('['+_0x46b7b2['lastevent'][_0x7d15('0x7d')]()+_0x7d15('0x7e'),_0x3aab85['id']);logger[_0x7d15('0x1b')]('['+_0x46b7b2[_0x7d15('0x7f')][_0x7d15('0x7d')]()+_0x7d15('0x80'),_0x301176[_0x7d15('0x4b')]);})['catch'](function(_0x24dc0b){logger[_0x7d15('0x6e')]('['+_0x46b7b2[_0x7d15('0x7f')][_0x7d15('0x7d')]()+']',_0x24dc0b);});}; \ No newline at end of file +var _0x0c31=['includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','unmanaged','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','endUserType','contact','lead','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','account_contact_lead','cloneDeep','additionalSearchAccount','Lead','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach'];(function(_0x470883,_0x613e70){var _0x2f4abb=function(_0x2e17e3){while(--_0x2e17e3){_0x470883['push'](_0x470883['shift']());}};_0x2f4abb(++_0x613e70);}(_0x0c31,0x135));var _0x10c3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c31[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x10c3('0x0'));var rp=require('request-promise');var moment=require(_0x10c3('0x1'));var BPromise=require(_0x10c3('0x2'));var md5=require(_0x10c3('0x3'));var jsforce=require(_0x10c3('0x4'));var util=require(_0x10c3('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x10c3('0x6'));var logger=require(_0x10c3('0x7'))(_0x10c3('0x8'));config[_0x10c3('0x9')]=_[_0x10c3('0xa')](config[_0x10c3('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x10c3('0xb'))(new Redis(config[_0x10c3('0x9')]));function emit(_0x1c1473,_0x26fdbb,_0x4828fa){io['to'](_0x1c1473)['emit'](_0x26fdbb,_0x4828fa);}function getTicket(_0x2ad306,_0x59dc10,_0xc5f56,_0x36045b,_0x413782,_0xa6a98d,_0x46c71c,_0x462044){var _0x4d096b=Object['assign']({},{'OwnerId':_0x59dc10['id'],'Subject':intUtil[_0x10c3('0xc')](_0x36045b[_0x10c3('0xd')],_0x413782,'\x20'),'Description':intUtil[_0x10c3('0xc')](_0x36045b[_0x10c3('0xe')],_0x413782,'\x0a')},getCustomFields(_0xa6a98d,_0x413782));if(_0xc5f56){if(_0x36045b[_0x10c3('0xf')]==='Task'){_0x4d096b['ActivityDate']=moment[_0x10c3('0x10')]();_0x4d096b[_0x10c3('0x11')]=![];_0x4d096b['IsRecurrence']=![];if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x13')||_0xc5f56['endUserType']===_0x10c3('0x14')){_0x4d096b['WhoId']=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x15')){_0x4d096b[_0x10c3('0x16')]=_0xc5f56['id'];}}else if(_0x36045b[_0x10c3('0xf')]===_0x10c3('0x17')){if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x13')){_0x4d096b['ContactId']=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]==='account'){_0x4d096b[_0x10c3('0x18')]=_0xc5f56['id'];}else if(_0xc5f56[_0x10c3('0x12')]===_0x10c3('0x14')&&_0x36045b['leadId']){_0x4d096b[_0x36045b[_0x10c3('0x19')]]=_0xc5f56['id'];}else{logger[_0x10c3('0x1a')](_0x10c3('0x1b'));}}}return _0x46c71c[_0x10c3('0x1c')](_0x36045b[_0x10c3('0xf')])[_0x10c3('0x1d')](_0x4d096b);}function getUser(_0x5bdc02,_0x2fc630,_0x523072){if(!_[_0x10c3('0x1e')](_0x2fc630)&&intUtil['validateEmail'](_0x2fc630)){var _0x239b19={'Email':_0x2fc630};var _0x154e95={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x523072['sobject'](_0x10c3('0x1f'))[_0x10c3('0x20')](_0x239b19,_0x154e95)['execute']()[_0x10c3('0x21')](function(_0x5e8f29){if(_0x5e8f29[_0x10c3('0x22')]){var _0x5b15f3=_[_0x10c3('0x20')](_0x5e8f29,function(_0x393fc3){return _0x393fc3[_0x10c3('0x23')]===_0x2fc630;});if(_0x5b15f3){logger['info'](_0x10c3('0x24'),_0x2fc630);return BPromise[_0x10c3('0x25')]({'id':_0x5b15f3['Id'],'name':_0x5b15f3['Name']});}}else{logger[_0x10c3('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2fc630);return _0x523072['identity']()[_0x10c3('0x21')](function(_0x2c938c){return BPromise[_0x10c3('0x25')]({'id':_0x2c938c[_0x10c3('0x26')],'name':_0x2c938c[_0x10c3('0x27')]});});}});}else{logger[_0x10c3('0x1a')](_0x10c3('0x28'),_0x2fc630);return _0x523072['identity']()[_0x10c3('0x21')](function(_0x3cd380){return BPromise[_0x10c3('0x25')]({'id':_0x3cd380[_0x10c3('0x26')],'name':_0x3cd380[_0x10c3('0x27')]});});}}function getEndUser(_0x1cbe8,_0x4a2c88,_0x486cb8,_0x3c5383,_0x175dcd){var _0x1fcdce={'$or':{'Phone':_0x3c5383}};var _0x2a1afd={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x10c3('0x25')]()[_0x10c3('0x21')](function(){logger[_0x10c3('0x1a')](_0x10c3('0x29'),_0x3c5383,_0x4a2c88[_0x10c3('0x2a')]);switch(_0x4a2c88[_0x10c3('0x2a')]){case _0x10c3('0x2b'):var _0x1f857f=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88['additionalSearchContact']]=_0x3c5383;_[_0x10c3('0x2d')](_0x1f857f[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd['sobject'](_0x10c3('0x2f'))[_0x10c3('0x20')](_0x1f857f,_0x2a1afd)[_0x10c3('0x30')]()['then'](function(_0x4963f5){if(_0x4963f5&&_0x4963f5[_0x10c3('0x22')]){return _0x4963f5;}else{var _0x12e197=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88['additionalSearchLead']){var _0x411d8b={};_0x411d8b[_0x4a2c88[_0x10c3('0x31')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x12e197['$or'],_0x411d8b);}return _0x175dcd[_0x10c3('0x1c')]('Lead')[_0x10c3('0x20')](_0x12e197,_0x2a1afd);}});case _0x10c3('0x32'):var _0x33a4b9=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x34')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x34')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x33a4b9[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')]('Account')[_0x10c3('0x20')](_0x33a4b9,_0x2a1afd)[_0x10c3('0x30')]()[_0x10c3('0x21')](function(_0x40b2a3){if(_0x40b2a3&&_0x40b2a3['length']){return _0x40b2a3;}else{var _0x596a01=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4b0ea3={};_0x4b0ea3[_0x4a2c88[_0x10c3('0x2c')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x596a01[_0x10c3('0x2e')],_0x4b0ea3);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x2f'))[_0x10c3('0x20')](_0x596a01,_0x2a1afd)[_0x10c3('0x21')](function(_0x3b9161){if(_0x3b9161&&_0x3b9161[_0x10c3('0x22')]){return _0x3b9161;}else{var _0x2bfb0c=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x31')]){var _0x377952={};_0x377952[_0x4a2c88['additionalSearchLead']]=_0x3c5383;_[_0x10c3('0x2d')](_0x2bfb0c['$or'],_0x377952);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x35'))[_0x10c3('0x20')](_0x2bfb0c,_0x2a1afd);}});}});case _0x10c3('0x13'):var _0x1f857f=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x2c')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x2c')]]=_0x3c5383;_['merge'](_0x1f857f[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')]('Contact')['find'](_0x1f857f,_0x2a1afd)[_0x10c3('0x30')]();case _0x10c3('0x14'):var _0x3cffb8=_[_0x10c3('0x33')](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x31')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x31')]]=_0x3c5383;_['merge'](_0x3cffb8[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x35'))[_0x10c3('0x20')](_0x3cffb8,_0x2a1afd);case _0x10c3('0x15'):var _0x33a4b9=_['cloneDeep'](_0x1fcdce);if(_0x4a2c88[_0x10c3('0x34')]){var _0x4f4d6b={};_0x4f4d6b[_0x4a2c88[_0x10c3('0x34')]]=_0x3c5383;_[_0x10c3('0x2d')](_0x33a4b9[_0x10c3('0x2e')],_0x4f4d6b);}return _0x175dcd[_0x10c3('0x1c')](_0x10c3('0x36'))[_0x10c3('0x20')](_0x33a4b9,_0x2a1afd);default:return null;}})[_0x10c3('0x21')](function(_0x5861ba){if(_0x5861ba&&_0x5861ba[_0x10c3('0x22')]){var _0x596a40=_[_0x10c3('0x37')](_0x5861ba);if(_0x596a40){return BPromise[_0x10c3('0x25')]({'id':_0x596a40['Id'],'name':_0x596a40[_0x10c3('0x38')],'phone':_0x596a40[_0x10c3('0x39')],'endUserType':_0x596a40[_0x10c3('0x3a')][_0x10c3('0x3b')][_0x10c3('0x3c')]()});}}})[_0x10c3('0x21')](function(_0x544e51){if(_0x544e51){logger['info'](_0x10c3('0x3d'),_0x544e51[_0x10c3('0x12')],_0x3c5383);return BPromise[_0x10c3('0x25')](_0x544e51);}else{logger[_0x10c3('0x1a')](_0x10c3('0x3e'),_0x3c5383);var _0x5ce758={'Phone':_0x3c5383};if(_0x4a2c88['moduleCreate']){if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x13')){logger[_0x10c3('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758['LastName']=_0x486cb8!==_0x10c3('0x40')?_0x486cb8:util[_0x10c3('0x41')]('Caller\x20-\x20%s',_0x3c5383);}else if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x14')){logger[_0x10c3('0x1a')](_0x10c3('0x42'),_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758[_0x10c3('0x43')]=_0x486cb8!==_0x10c3('0x40')?_0x486cb8:util[_0x10c3('0x41')](_0x10c3('0x44'),_0x3c5383);_0x5ce758['Company']=_0x10c3('0x45');}else if(_0x4a2c88[_0x10c3('0x3f')]===_0x10c3('0x15')){logger[_0x10c3('0x1a')](_0x10c3('0x42'),_0x3c5383,_0x4a2c88[_0x10c3('0x3f')]);_0x5ce758['Name']=_0x486cb8!==''?_0x486cb8:util['format'](_0x10c3('0x44'),_0x3c5383);}else{return null;}}return _0x175dcd[_0x10c3('0x1c')](_[_0x10c3('0x46')](_0x4a2c88['moduleCreate']))['create'](_0x5ce758)[_0x10c3('0x21')](function(_0x97a3ff){return BPromise[_0x10c3('0x25')]({'id':_0x97a3ff['id'],'endUserType':_0x4a2c88['moduleCreate']});});}});}function getCustomFields(_0x9b7a77,_0x3e374a){var _0x1431a0={};if(_0x9b7a77['length']>0x0){_[_0x10c3('0x47')](_0x9b7a77,function(_0x18f9da){if(_[_0x10c3('0x48')]([_0x10c3('0x49'),_0x10c3('0x4a')],_0x18f9da[_0x10c3('0x3b')])&&_0x18f9da[_0x10c3('0x4b')]){_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x18f9da['content'][_0x10c3('0x4c')]();}else if(_0x18f9da[_0x10c3('0x3b')]===_0x10c3('0x4d')&&_0x18f9da[_0x10c3('0x4e')]&&_0x18f9da[_0x10c3('0x4b')]){_0x3e374a[_0x18f9da[_0x10c3('0x4e')]]&&(_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x3e374a[_0x18f9da['variableName']][_0x10c3('0x4c')]());}else if(_0x18f9da[_0x10c3('0x3b')]===_0x10c3('0x4f')&&_0x18f9da[_0x10c3('0x50')]&&_0x18f9da[_0x10c3('0x50')][_0x10c3('0x51')]&&_0x18f9da[_0x10c3('0x4b')]){_0x3e374a[_0x18f9da[_0x10c3('0x50')][_0x10c3('0x51')][_0x10c3('0x3c')]()]&&(_0x1431a0[_0x18f9da[_0x10c3('0x4b')]]=_0x3e374a[_0x18f9da['Variable'][_0x10c3('0x51')][_0x10c3('0x3c')]()][_0x10c3('0x4c')]());}});}return _0x1431a0;}function getConnection(_0x10b95b){var _0x553df7=_0x10b95b[_0x10c3('0x52')][_0x10c3('0x53')](_0x10b95b[_0x10c3('0x54')]);var _0xb93fe8=new jsforce[(_0x10c3('0x55'))]({'oauth2':{'loginUrl':_0x10b95b[_0x10c3('0x56')]||_0x10c3('0x57'),'clientId':_0x10b95b[_0x10c3('0x58')],'clientSecret':_0x10b95b[_0x10c3('0x59')]}});return _0xb93fe8[_0x10c3('0x5a')](_0x10b95b[_0x10c3('0x5b')],_0x553df7)[_0x10c3('0x21')](function(){logger[_0x10c3('0x1a')](_0x10c3('0x5c'));return _0xb93fe8;});}exports[_0x10c3('0x5d')]=function(_0x86614a,_0x541253,_0x2b94ac,_0x523053,_0x22d208,_0x29e037){var _0x4250af,_0x356de1,_0x3c860e,_0x1fa5fe;_0x29e037[_0x10c3('0x5e')]=intUtil['stripTrailingSlash'](_0x29e037[_0x10c3('0x5e')]);_0x29e037[_0x10c3('0x56')]=intUtil['stripTrailingSlash'](_0x29e037['remoteUri']);if(_0x22d208&&_0x22d208[_0x10c3('0x5f')]){logger[_0x10c3('0x1a')](_0x10c3('0x60'),_0x10c3('0x61'));_0x541253[_0x10c3('0x62')]=util['format'](_0x10c3('0x63'),_0x29e037[_0x10c3('0x5e')],_0x541253[_0x10c3('0x64')],md5(_0x541253[_0x10c3('0x64')]));}else{_0x541253[_0x10c3('0x62')]='';}return getConnection(_0x29e037)[_0x10c3('0x21')](function(_0x5e77dc){_0x1fa5fe=_0x5e77dc;return getUser(_0x29e037,_0x523053[_0x10c3('0x65')],_0x1fa5fe);})[_0x10c3('0x21')](function(_0x3aa1ea){_0x4250af=_0x3aa1ea;return getEndUser(_0x29e037,_0x2b94ac,_0x541253['calleridname'],_0x541253[_0x10c3('0x66')],_0x1fa5fe);})[_0x10c3('0x21')](function(_0x17ab2c){_0x356de1=_0x17ab2c;return getTicket(_0x29e037,_0x4250af,_0x356de1,_0x2b94ac,_0x541253,_0x2b94ac[_0x10c3('0x67')],_0x1fa5fe,_0x10c3('0x5d'));})['then'](function(_0x2fd431){_0x3c860e=_0x2fd431;logger['info'](_0x10c3('0x68'),_0x3c860e['id']);logger['info'](_0x10c3('0x69'),_0x3c860e['id'],_0x523053[_0x10c3('0x51')],_0x29e037[_0x10c3('0x3b')]);switch(_0x29e037[_0x10c3('0x3b')]){case _0x10c3('0x6a'):emit(util[_0x10c3('0x41')](_0x10c3('0x6b'),_0x523053[_0x10c3('0x51')]),_0x10c3('0x6c'),{'recordId':_0x3c860e['id']});break;case'newTab':emit(util['format'](_0x10c3('0x6b'),_0x523053[_0x10c3('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x10c3('0x6d'),_0x1fa5fe[_0x10c3('0x6e')],_0x3c860e['id'])});break;default:logger[_0x10c3('0x6f')](_0x10c3('0x70'));}})[_0x10c3('0x71')](function(_0x23703b){logger['error'](_0x10c3('0x60'),_0x23703b);});};exports[_0x10c3('0x72')]=function(_0x40a937,_0x493cc3,_0x350b4b,_0x519db5,_0x4122d3,_0x57cef2,_0x567d74){var _0x399bc6,_0x31b36a,_0x247a78,_0x486efc;_0x57cef2['serverUrl']=intUtil[_0x10c3('0x73')](_0x57cef2[_0x10c3('0x5e')]);_0x57cef2[_0x10c3('0x56')]=intUtil[_0x10c3('0x73')](_0x57cef2[_0x10c3('0x56')]);if(_0x567d74&&_0x567d74['recordingFormat']&&_0x567d74['recordingFormat']!==_0x10c3('0x74')){logger[_0x10c3('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x493cc3[_0x10c3('0x62')]=util[_0x10c3('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57cef2['serverUrl'],_0x493cc3[_0x10c3('0x64')],md5(_0x493cc3[_0x10c3('0x64')]));}return getConnection(_0x57cef2)[_0x10c3('0x21')](function(_0x4bcac2){_0x486efc=_0x4bcac2;return getUser(_0x57cef2,_0x519db5['email'],_0x486efc);})['then'](function(_0x20dbe0){_0x399bc6=_0x20dbe0;return getEndUser(_0x57cef2,_0x350b4b,_0x493cc3[_0x10c3('0x75')],_0x493cc3['destcalleridnum'],_0x486efc);})[_0x10c3('0x21')](function(_0x1f50c0){_0x31b36a=_0x1f50c0;return getTicket(_0x57cef2,_0x399bc6,_0x31b36a,_0x350b4b,_0x493cc3,_0x350b4b['Fields'],_0x486efc,'outbound');})[_0x10c3('0x21')](function(_0x10a5d8){_0x247a78=_0x10a5d8;logger[_0x10c3('0x1a')](_0x10c3('0x76'),_0x247a78['id']);logger[_0x10c3('0x1a')](_0x10c3('0x77'),_0x247a78['id'],_0x519db5[_0x10c3('0x51')],_0x57cef2['type']);switch(_0x57cef2[_0x10c3('0x3b')]){case _0x10c3('0x6a'):emit(util[_0x10c3('0x41')]('user:%s',_0x519db5['name']),_0x10c3('0x6c'),{'recordId':_0x247a78['id']});break;case _0x10c3('0x78'):emit(util[_0x10c3('0x41')]('user:%s',_0x519db5['name']),'trigger:browser:url',{'uri':util[_0x10c3('0x41')]('%s/%s/e',_0x486efc[_0x10c3('0x6e')],_0x247a78['id'])});break;default:logger[_0x10c3('0x6f')](_0x10c3('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x10c3('0x71')](function(_0x1a83cf){logger[_0x10c3('0x6f')](_0x10c3('0x79'),_0x1a83cf);});};exports[_0x10c3('0x7a')]=function(_0x221cc2,_0x23831b,_0x6aac2d,_0x3659f2,_0x2b5fec,_0x16e290){var _0x334771,_0xd04c39,_0x52a943,_0x1d38a8;_0x16e290[_0x10c3('0x5e')]=intUtil[_0x10c3('0x73')](_0x16e290[_0x10c3('0x5e')]);_0x16e290['remoteUri']=intUtil[_0x10c3('0x73')](_0x16e290[_0x10c3('0x56')]);if(_0x2b5fec&&_0x2b5fec[_0x10c3('0x5f')]){logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')]['toUpperCase']()+']',_0x10c3('0x61'));_0x23831b[_0x10c3('0x62')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16e290['serverUrl'],_0x23831b[_0x10c3('0x64')],md5(_0x23831b['uniqueid']));}else{_0x23831b[_0x10c3('0x62')]='';}return getConnection(_0x16e290)[_0x10c3('0x21')](function(_0x381f33){_0x1d38a8=_0x381f33;if(!_[_0x10c3('0x1e')](_0x3659f2)){return getUser(_0x16e290,_0x3659f2[_0x10c3('0x51')],_0x1d38a8);}else{return getUser(_0x16e290,null,_0x1d38a8);}})['then'](function(_0x3af312){_0x334771=_0x3af312;return getEndUser(_0x16e290,_0x6aac2d,_0x23831b[_0x10c3('0x7c')],_0x23831b[_0x10c3('0x66')],_0x1d38a8);})[_0x10c3('0x21')](function(_0xdc309f){_0xd04c39=_0xdc309f;return getTicket(_0x16e290,_0x334771,_0xd04c39,_0x6aac2d,_0x23831b,_0x6aac2d[_0x10c3('0x67')],_0x1d38a8);})[_0x10c3('0x21')](function(_0x292089){_0x52a943=_0x292089;logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+_0x10c3('0x7e'),_0x52a943['id']);logger[_0x10c3('0x1a')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x16e290[_0x10c3('0x3b')]);})[_0x10c3('0x71')](function(_0x1fec07){logger[_0x10c3('0x6f')]('['+_0x23831b[_0x10c3('0x7b')][_0x10c3('0x7d')]()+']',_0x1fec07);});}; \ 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 65328e3..5633dc6 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 _0x14ae=[']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','result','sys_id','info','],\x20getAdminUser\x20crm','error','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','variableName','idField','customVariable','Variable','name'];(function(_0x3f92bc,_0x482ad4){var _0xa15d20=function(_0x1381be){while(--_0x1381be){_0x3f92bc['push'](_0x3f92bc['shift']());}};_0xa15d20(++_0x482ad4);}(_0x14ae,0x17f));var _0xe14a=function(_0x3c1510,_0x4afe7f){_0x3c1510=_0x3c1510-0x0;var _0x1883b5=_0x14ae[_0x3c1510];return _0x1883b5;};'use strict';var _=require('lodash');var Promise=require(_0xe14a('0x0'));var rp=require(_0xe14a('0x1'));var util=require(_0xe14a('0x2'));var md5=require(_0xe14a('0x3'));var Redis=require(_0xe14a('0x4'));var intUtil=require('./util');var config=require(_0xe14a('0x5'));var logger=require(_0xe14a('0x6'))(_0xe14a('0x7'));config[_0xe14a('0x8')]=_[_0xe14a('0x9')](config['redis'],{'host':_0xe14a('0xa'),'port':0x18eb});var io=require(_0xe14a('0xb'))(new Redis(config[_0xe14a('0x8')]));function getAdminUser(_0x38ac7c,_0x3fd231,_0x1b93b8,_0x30a344,_0x306a8d,_0x430fd0){return new Promise(function(_0x3ebd4d,_0x49066c){var _0x40d9df={'method':_0xe14a('0xc'),'uri':_0x30a344+_0xe14a('0xd')+'&'+_0x306a8d+'&'+_0x430fd0,'auth':_0x3fd231,'json':!![]};return rp(_0x40d9df)[_0xe14a('0xe')](function(_0x2df1c4){if(_0x2df1c4['result'][_0xe14a('0xf')]>0x0){_0x1b93b8['adminId']=_0x2df1c4[_0xe14a('0x10')][0x0][_0xe14a('0x11')];}logger[_0xe14a('0x12')]('['+[_0x38ac7c['toUpperCase']()]+_0xe14a('0x13'),_0x1b93b8);_0x3ebd4d(_0x1b93b8);})['catch'](function(_0xa302b0){logger[_0xe14a('0x14')]('['+[_0x38ac7c[_0xe14a('0x15')]()]+']',_0xa302b0[_0xe14a('0x16')]);_0x49066c(_0xa302b0[_0xe14a('0x16')]);});});}function getUser(_0x335c7b,_0x19c46a,_0x4d7605,_0x1e930c,_0x98a6f7){return function(_0x4b97ea){logger['info']('['+[_0x335c7b[_0xe14a('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x4b97ea);return new Promise(function(_0x4c9966,_0xd70ea3){if(intUtil[_0xe14a('0x17')](_0x4b97ea[_0xe14a('0x18')])){var _0x50c972={'method':'GET','uri':_0x4d7605+_0xe14a('0x19')+_0x4b97ea[_0xe14a('0x18')]+'&'+_0x1e930c+'&'+_0x98a6f7,'auth':_0x19c46a,'json':!![]};logger[_0xe14a('0x12')]('['+[_0x335c7b[_0xe14a('0x15')]()]+_0xe14a('0x1a'),_0x50c972);return rp(_0x50c972)[_0xe14a('0xe')](function(_0x408067){logger[_0xe14a('0x12')]('['+[_0x335c7b['toUpperCase']()]+_0xe14a('0x1b'),_0x408067);if(_0x408067[_0xe14a('0x10')][_0xe14a('0xf')]>0x0&&String(_0x408067['result'][0x0][_0xe14a('0x1c')])===_0xe14a('0x1d')){_0x4b97ea[_0xe14a('0x1e')]=_0x408067[_0xe14a('0x10')][0x0]['sys_id'];}else{_0x4b97ea[_0xe14a('0x1e')]=_0x4b97ea[_0xe14a('0x1f')];_0x4b97ea[_0xe14a('0x18')]=_0x4b97ea[_0xe14a('0x20')];}logger['info']('['+[_0x335c7b[_0xe14a('0x15')]()]+_0xe14a('0x21'),_0x4b97ea);_0x4c9966(_0x4b97ea);})[_0xe14a('0x22')](function(_0x50bbac){logger[_0xe14a('0x14')]('['+[_0x335c7b[_0xe14a('0x15')]()]+']',_0x50bbac['message']);_0xd70ea3(_0x50bbac[_0xe14a('0x16')]);});}else{logger[_0xe14a('0x12')]('['+[_0x335c7b[_0xe14a('0x15')]()]+_0xe14a('0x23'));_0x4b97ea[_0xe14a('0x1e')]=_0x4b97ea[_0xe14a('0x1f')];_0x4b97ea[_0xe14a('0x18')]=_0x4b97ea[_0xe14a('0x20')];_0x4c9966(_0x4b97ea);}});};}function createEndUser(_0x5da18b,_0x34d29e,_0x225910,_0x2356d3,_0x458d51){logger[_0xe14a('0x12')]('['+[_0x5da18b[_0xe14a('0x15')]()]+_0xe14a('0x24'),_0x225910);return new Promise(function(_0x46873b,_0x5517b4){var _0x3c95a2={'method':_0xe14a('0x25'),'uri':_0x2356d3+_0xe14a('0x26')+_0x458d51,'body':{'user_name':_0x225910[_0xe14a('0x27')],'roles':_0xe14a('0x28'),'first_name':_0x225910[_0xe14a('0x27')],'active':_0xe14a('0x1d'),'date_format':_0xe14a('0x29'),'phone':_0x225910[_0xe14a('0x27')]},'auth':_0x34d29e,'json':!![]};return rp(_0x3c95a2)[_0xe14a('0xe')](function(_0x1c6f94){logger['info']('['+[_0x5da18b[_0xe14a('0x15')]()]+_0xe14a('0x2a'),_0x1c6f94['result']);_0x225910[_0xe14a('0x2b')]=_0x1c6f94['result']['sys_id'];_0x46873b(_0x225910);})[_0xe14a('0x22')](function(_0x4db365){logger[_0xe14a('0x14')]('['+[_0x5da18b['toUpperCase']()]+']',_0x4db365['message']);_0x5517b4(_0x4db365[_0xe14a('0x16')]);});});}function getEndUser(_0xb06759,_0x5897f6,_0x4ae1b0,_0x535a1f,_0xeb9402){return function(_0x98cb5){logger['info']('['+[_0xb06759[_0xe14a('0x15')]()]+_0xe14a('0x2c'),_0x98cb5);return new Promise(function(_0x272310,_0x231e21){var _0xc87bb0={'method':'GET','uri':_0x4ae1b0+'sys_user?sysparm_query=phone%3D'+_0x98cb5[_0xe14a('0x27')]+'&'+_0x535a1f+'&'+_0xeb9402,'auth':_0x5897f6,'json':!![]};return rp(_0xc87bb0)[_0xe14a('0xe')](function(_0x313001){if(_0x313001[_0xe14a('0x10')][_0xe14a('0xf')]>0x0){_0x98cb5['endUserId']=_0x313001[_0xe14a('0x10')][0x0][_0xe14a('0x11')];logger[_0xe14a('0x12')]('['+[_0xb06759[_0xe14a('0x15')]()]+_0xe14a('0x2d'),_0x98cb5);_0x272310(_0x98cb5);}else{return createEndUser(_0xb06759,_0x5897f6,_0x98cb5,_0x4ae1b0,_0x535a1f)[_0xe14a('0xe')](function(_0xcff3b0){logger[_0xe14a('0x12')]('['+[_0xb06759[_0xe14a('0x15')]()]+_0xe14a('0x2e'),_0xcff3b0);_0x272310(_0xcff3b0);});}})[_0xe14a('0x22')](function(_0x13238d){logger['error']('['+[_0xb06759[_0xe14a('0x15')]()]+']',_0x13238d[_0xe14a('0x16')]);_0x231e21(_0x13238d[_0xe14a('0x16')]);});});};}function getCustomFields(_0xf08fae,_0x29be71){var _0x1aad47={};if(_0xf08fae[_0xe14a('0xf')]>0x0){_['forEach'](_0xf08fae,function(_0x4630dd){if(_[_0xe14a('0x2f')]([_0xe14a('0x30'),_0xe14a('0x31')],_0x4630dd['type'])&&_0x4630dd[_0xe14a('0x32')]&&!_0x4630dd[_0xe14a('0x33')]){_0x1aad47[_0x4630dd[_0xe14a('0x32')][_0xe14a('0x34')]()]=_0x4630dd[_0xe14a('0x35')]['toString']();}else if(_[_0xe14a('0x2f')]([_0xe14a('0x30'),_0xe14a('0x31')],_0x4630dd['type'])&&_0x4630dd['idField']&&_0x4630dd[_0xe14a('0x33')]){_0x1aad47[_0x4630dd['idField'][_0xe14a('0x34')]()]=_0x4630dd[_0xe14a('0x35')][_0xe14a('0x36')]();}else if(_0x4630dd[_0xe14a('0x37')]==='variable'&&_0x4630dd[_0xe14a('0x38')]&&_0x4630dd[_0xe14a('0x39')]&&_0x4630dd[_0xe14a('0x33')]){_0x1aad47[_0x4630dd['idField'][_0xe14a('0x34')]()]=_0x29be71[_0x4630dd[_0xe14a('0x38')]][_0xe14a('0x36')]();}else if(_0x4630dd[_0xe14a('0x37')]===_0xe14a('0x3a')&&_0x4630dd['Variable']&&_0x4630dd[_0xe14a('0x3b')][_0xe14a('0x3c')]&&_0x4630dd[_0xe14a('0x39')]&&_0x4630dd[_0xe14a('0x33')]){_0x1aad47[_0x4630dd['idField'][_0xe14a('0x34')]()]=_0x29be71[_0x4630dd[_0xe14a('0x3b')][_0xe14a('0x3c')][_0xe14a('0x34')]()][_0xe14a('0x36')]();}});}return _0x1aad47;}function getTicket(_0x2bbc35,_0x53567e,_0x24301d,_0x30d1d8,_0x28065b,_0x1846a0){return function(_0x3b9fe8){logger[_0xe14a('0x12')]('['+[_0x2bbc35[_0xe14a('0x15')]()]+_0xe14a('0x3d'),_0x3b9fe8);return new Promise(function(_0x15000d,_0x1a6d9d){var _0x59ee73=_0x2bbc35[_0xe14a('0x34')]()===_0xe14a('0x3e')?_0x3b9fe8[_0xe14a('0x1e')]:_0x3b9fe8[_0xe14a('0x2b')];var _0x3da51f={'method':_0xe14a('0x25'),'uri':_0x24301d+'incident'+'?'+_0x1846a0,'body':Object[_0xe14a('0x3f')]({},{'active':_0xe14a('0x1d'),'caller_id':_0x59ee73,'assigned_to':_0x3b9fe8[_0xe14a('0x1e')],'short_description':intUtil[_0xe14a('0x40')](_0x30d1d8[_0xe14a('0x41')],_0x28065b,'\x20'),'description':intUtil['getString'](_0x30d1d8[_0xe14a('0x42')],_0x28065b,'\x0a')},getCustomFields(_0x30d1d8[_0xe14a('0x43')],_0x28065b)),'auth':_0x53567e,'json':!![]};return rp(_0x3da51f)[_0xe14a('0xe')](function(_0x1ee910){logger['info']('['+[_0x2bbc35[_0xe14a('0x15')]()]+_0xe14a('0x44'),_0x1ee910[_0xe14a('0x10')]);_0x3b9fe8['ticketId']=_0x1ee910['result'][_0xe14a('0x11')];_0x3b9fe8[_0xe14a('0x45')]=_0x1ee910[_0xe14a('0x10')][_0xe14a('0x46')];logger[_0xe14a('0x12')]('['+[_0x2bbc35['toUpperCase']()]+_0xe14a('0x47'),_0x3b9fe8);_0x15000d(_0x3b9fe8);})[_0xe14a('0x22')](function(_0x398990){logger['error']('['+[_0x2bbc35[_0xe14a('0x15')]()]+']',_0x398990['message']);_0x1a6d9d(_0x398990[_0xe14a('0x16')]);});});};}function createRemoteTag(_0x4ef856,_0x88b056,_0x144a03,_0x13ac79){return new Promise(function(_0x2c355b,_0x29f5c9){var _0x3c8053={'method':_0xe14a('0x25'),'uri':_0x144a03+_0xe14a('0x48')+'?'+_0x13ac79,'body':{'short_description':_0x4ef856,'global':!![],'active':!![],'name':_0x4ef856},'auth':_0x88b056,'json':!![]};return rp(_0x3c8053)[_0xe14a('0xe')](function(_0x4188f9){var _0x494142=_0x4188f9[_0xe14a('0x10')]['sys_id'];_0x2c355b(_0x494142);});});}function getRemoteTag(_0xe832fd,_0x37391e,_0x11819d,_0x23e598,_0x47c040){return new Promise(function(_0x50355d,_0x18ab19){var _0x4b0fd7={'method':_0xe14a('0xc'),'uri':_0x11819d+'label'+_0xe14a('0x49')+_0xe832fd+'&'+_0x23e598,'auth':_0x37391e,'json':!![]};return rp(_0x4b0fd7)[_0xe14a('0xe')](function(_0x18d56d){if(_0x18d56d[_0xe14a('0x10')][_0xe14a('0xf')]>0x0){var _0x45c661=_0x18d56d[_0xe14a('0x10')][0x0][_0xe14a('0x11')];_0x50355d(_0x45c661);}else{return createRemoteTag(_0xe832fd,_0x37391e,_0x11819d,_0x23e598)[_0xe14a('0xe')](function(_0x2fad9a){_0x50355d(_0x2fad9a);});}});});}function assignTagToIncident(_0x547b10,_0x3e3bea,_0x582593,_0x2166b2,_0x27e721){return new Promise(function(_0x566032,_0x350d16){var _0x40d93a={'method':_0xe14a('0x25'),'uri':_0x582593+_0xe14a('0x4a')+'?'+_0x27e721,'body':{'label':_0x547b10,'table':'incident','id_type':_0xe14a('0x4b'),'table_key':_0x2166b2[_0xe14a('0x4c')],'title':_0xe14a('0x4d')+_0x2166b2[_0xe14a('0x45')],'id_display':_0x2166b2[_0xe14a('0x45')]},'auth':_0x3e3bea,'json':!![]};return rp(_0x40d93a)['then'](function(_0xc266e){_0x566032();})['catch'](function(){_0x566032();});});}function manageTags(_0x2be9b5,_0x171e57,_0x395823,_0x42ec3a,_0x25279b,_0x526a6e,_0x2beae3){return new Promise(function(_0x2669b1,_0x2b67c2){var _0x14dfbc=[];_0x171e57[_0xe14a('0x4e')](function(_0x495b22){_0x14dfbc[_0xe14a('0x4f')](getRemoteTag(_0x495b22,_0x395823,_0x42ec3a,_0x526a6e,_0x2beae3));});return Promise[_0xe14a('0x50')](_0x14dfbc)[_0xe14a('0xe')](function(_0x13b24a){if(_0x13b24a[_0xe14a('0xf')]){logger[_0xe14a('0x12')]('['+[_0x2be9b5[_0xe14a('0x15')]()]+_0xe14a('0x51'),_0x13b24a);var _0x39ad42=[];_0x13b24a['forEach'](function(_0x45fcc4){_0x39ad42[_0xe14a('0x4f')](assignTagToIncident(_0x45fcc4,_0x395823,_0x42ec3a,_0x25279b,_0x526a6e));});return Promise[_0xe14a('0x50')](_0x39ad42)['then'](function(){_0x2669b1();})[_0xe14a('0x22')](function(){_0x2669b1();});}else{_0x2669b1();}});});}function getTags(_0x38d59f,_0x84cfb5,_0x38b633,_0x5addf3,_0x49c265,_0x29f9c5){return function(_0x93f4b0){return new Promise(function(_0x15fe5f,_0x10ee76){var _0x37441c=[];var _0x44d61a=_0x5addf3[_0xe14a('0x52')];if(_0x44d61a&&_0x44d61a['length']>0x0){_0x37441c=_[_0xe14a('0x53')](_0x44d61a,_0xe14a('0x3c'));}if(_0x37441c[_0xe14a('0xf')]>0x0){return manageTags(_0x38d59f,_0x37441c,_0x84cfb5,_0x38b633,_0x93f4b0,_0x49c265,_0x29f9c5)[_0xe14a('0xe')](function(){_0x15fe5f(_0x93f4b0);});}else{_0x15fe5f(_0x93f4b0);}});};}function emit(_0x50d397,_0x1eaccb,_0x9bc1d3){var _0x47930b='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xe14a('0x54');var _0x7cb5e5={'uri':_0x50d397+_0xe14a('0x55')+_0x9bc1d3+_0x47930b};io['to'](util[_0xe14a('0x56')](_0xe14a('0x57'),_0x1eaccb))['emit'](_0xe14a('0x58'),_0x7cb5e5);}exports['cs']=function(_0x3fd9dd,_0x514134,_0x2f3e93,_0x37ee67,_0x46d7ae,_0x37d67a,_0x54be53,_0x4cb13d){var _0x322e74={};var _0x2cca50={'user':_0x37d67a[_0xe14a('0x59')],'pass':_0x37d67a['password']};var _0x46201a=_0xe14a('0x5a');var _0x2f197a=_0xe14a('0x5b');_0x37d67a[_0xe14a('0x5c')]=intUtil[_0xe14a('0x5d')](_0x37d67a[_0xe14a('0x5c')]);_0x37d67a[_0xe14a('0x5e')]=intUtil['stripTrailingSlash'](_0x37d67a[_0xe14a('0x5e')]);var _0x15fe18=util[_0xe14a('0x56')](_0xe14a('0x5f'),_0x37d67a[_0xe14a('0x5c')]);_0x322e74[_0xe14a('0x18')]=!_['isNil'](_0x37ee67)?_0x37ee67[_0xe14a('0x60')]:null;_0x322e74[_0xe14a('0x20')]=_0x37d67a[_0xe14a('0x60')];_0x322e74[_0xe14a('0x27')]=_0x4cb13d['toLowerCase']()==='outbound'?_0x514134['destcalleridnum']:_0x514134['calleridnum'];_0x322e74[_0xe14a('0x61')]=_0x4cb13d===_0xe14a('0x62')||_0x4cb13d===_0xe14a('0x63')?_0xe14a('0x62'):'outbound';var _0xf9ae25=util[_0xe14a('0x56')](_0xe14a('0x64'),_0x37d67a[_0xe14a('0x5e')],_0x514134[_0xe14a('0x65')],md5(_0x514134[_0xe14a('0x65')]));if(_0x46d7ae&&_0x46d7ae[_0xe14a('0x66')]){logger['info']('[QUEUE]',_0xe14a('0x67'));_0x514134[_0xe14a('0x68')]=_0xf9ae25;}else if(_0x54be53&&_0x54be53[_0xe14a('0x69')]&&_0x54be53[_0xe14a('0x69')]!==_0xe14a('0x6a')){logger['info']('[OUTBOUND]',_0xe14a('0x67'));_0x514134['recordingURL']=_0xf9ae25;}else{_0x514134['recordingURL']='';}return getAdminUser(_0x4cb13d,_0x2cca50,_0x322e74,_0x15fe18,_0x2f197a,_0x46201a)[_0xe14a('0xe')](getUser(_0x4cb13d,_0x2cca50,_0x15fe18,_0x2f197a,_0x46201a))[_0xe14a('0xe')](getEndUser(_0x4cb13d,_0x2cca50,_0x15fe18,_0x2f197a,_0x46201a))[_0xe14a('0xe')](getTicket(_0x4cb13d,_0x2cca50,_0x15fe18,_0x2f3e93,_0x514134,_0x2f197a))[_0xe14a('0xe')](function(_0x353691){logger['info'](util[_0xe14a('0x56')](_0xe14a('0x6b'),_0x353691['ticketId']));logger[_0xe14a('0x12')](util[_0xe14a('0x56')]('call\x20direction:\x20%s',_0x4cb13d));if(_0x4cb13d!==_0xe14a('0x63')){logger['info']('['+[_0x4cb13d[_0xe14a('0x15')]()]+']',_0xe14a('0x6c'));emit(_0x37d67a['remoteUri'],_0x37ee67[_0xe14a('0x3c')],_0x353691[_0xe14a('0x4c')]);}})[_0xe14a('0x22')](function(_0x7f2bd){logger['error']('['+[_0x4cb13d['toUpperCase']()]+_0xe14a('0x6d'),util[_0xe14a('0x6e')](_0x7f2bd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe147=['all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','string','picklist','type','nameField','customField','content','toString','includes','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push'];(function(_0x4b4dba,_0x50224d){var _0x14fc1b=function(_0x524b0d){while(--_0x524b0d){_0x4b4dba['push'](_0x4b4dba['shift']());}};_0x14fc1b(++_0x50224d);}(_0xe147,0xe7));var _0x7e14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe147[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7e14('0x0'));var Promise=require(_0x7e14('0x1'));var rp=require(_0x7e14('0x2'));var util=require(_0x7e14('0x3'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x7e14('0x4'));var config=require(_0x7e14('0x5'));var logger=require(_0x7e14('0x6'))(_0x7e14('0x7'));config[_0x7e14('0x8')]=_[_0x7e14('0x9')](config['redis'],{'host':_0x7e14('0xa'),'port':0x18eb});var io=require(_0x7e14('0xb'))(new Redis(config[_0x7e14('0x8')]));function getAdminUser(_0x38b54c,_0x513ff5,_0x52c5fc,_0x76c55a,_0x51594b,_0x1f79a0){return new Promise(function(_0x300e36,_0x1ef23a){var _0x1582af={'method':_0x7e14('0xc'),'uri':_0x76c55a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x51594b+'&'+_0x1f79a0,'auth':_0x513ff5,'json':!![]};return rp(_0x1582af)[_0x7e14('0xd')](function(_0x50035f){if(_0x50035f[_0x7e14('0xe')][_0x7e14('0xf')]>0x0){_0x52c5fc[_0x7e14('0x10')]=_0x50035f['result'][0x0]['sys_id'];}logger[_0x7e14('0x11')]('['+[_0x38b54c['toUpperCase']()]+_0x7e14('0x12'),_0x52c5fc);_0x300e36(_0x52c5fc);})[_0x7e14('0x13')](function(_0x467ab1){logger[_0x7e14('0x14')]('['+[_0x38b54c[_0x7e14('0x15')]()]+']',_0x467ab1[_0x7e14('0x16')]);_0x1ef23a(_0x467ab1[_0x7e14('0x16')]);});});}function getUser(_0x489fbe,_0x501572,_0x17751e,_0x50fbdf,_0x175964){return function(_0x4bca83){logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x17'),_0x4bca83);return new Promise(function(_0x32e6f8,_0x2a69b3){if(intUtil[_0x7e14('0x18')](_0x4bca83[_0x7e14('0x19')])){var _0x487e0c={'method':'GET','uri':_0x17751e+_0x7e14('0x1a')+_0x4bca83[_0x7e14('0x19')]+'&'+_0x50fbdf+'&'+_0x175964,'auth':_0x501572,'json':!![]};logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x1b'),_0x487e0c);return rp(_0x487e0c)[_0x7e14('0xd')](function(_0x1c158d){logger[_0x7e14('0x11')]('['+[_0x489fbe['toUpperCase']()]+'],\x20getUser\x20entity',_0x1c158d);if(_0x1c158d[_0x7e14('0xe')][_0x7e14('0xf')]>0x0&&String(_0x1c158d['result'][0x0]['active'])===_0x7e14('0x1c')){_0x4bca83[_0x7e14('0x1d')]=_0x1c158d[_0x7e14('0xe')][0x0][_0x7e14('0x1e')];}else{_0x4bca83[_0x7e14('0x1d')]=_0x4bca83[_0x7e14('0x10')];_0x4bca83['userEmail']=_0x4bca83[_0x7e14('0x1f')];}logger[_0x7e14('0x11')]('['+[_0x489fbe[_0x7e14('0x15')]()]+_0x7e14('0x20'),_0x4bca83);_0x32e6f8(_0x4bca83);})[_0x7e14('0x13')](function(_0x1988d6){logger['error']('['+[_0x489fbe[_0x7e14('0x15')]()]+']',_0x1988d6[_0x7e14('0x16')]);_0x2a69b3(_0x1988d6['message']);});}else{logger['info']('['+[_0x489fbe['toUpperCase']()]+_0x7e14('0x21'));_0x4bca83[_0x7e14('0x1d')]=_0x4bca83['adminId'];_0x4bca83[_0x7e14('0x19')]=_0x4bca83[_0x7e14('0x1f')];_0x32e6f8(_0x4bca83);}});};}function createEndUser(_0x330cf3,_0x27c647,_0x36275d,_0x3969fa,_0x5cadfb){logger['info']('['+[_0x330cf3[_0x7e14('0x15')]()]+'],\x20createEndUser\x20input\x20crm',_0x36275d);return new Promise(function(_0x33b7cc,_0x219276){var _0x57f551={'method':_0x7e14('0x22'),'uri':_0x3969fa+_0x7e14('0x23')+_0x5cadfb,'body':{'user_name':_0x36275d[_0x7e14('0x24')],'roles':_0x7e14('0x25'),'first_name':_0x36275d[_0x7e14('0x24')],'active':_0x7e14('0x1c'),'date_format':'System','phone':_0x36275d['endUserNumber']},'auth':_0x27c647,'json':!![]};return rp(_0x57f551)['then'](function(_0x318252){logger[_0x7e14('0x11')]('['+[_0x330cf3[_0x7e14('0x15')]()]+'],\x20EndUser\x20schema',_0x318252['result']);_0x36275d[_0x7e14('0x26')]=_0x318252[_0x7e14('0xe')]['sys_id'];_0x33b7cc(_0x36275d);})[_0x7e14('0x13')](function(_0x444c1e){logger[_0x7e14('0x14')]('['+[_0x330cf3[_0x7e14('0x15')]()]+']',_0x444c1e[_0x7e14('0x16')]);_0x219276(_0x444c1e[_0x7e14('0x16')]);});});}function getEndUser(_0x52544c,_0x3b7eca,_0x35403c,_0x2d1c3d,_0x1e6195){return function(_0x1229e3){logger[_0x7e14('0x11')]('['+[_0x52544c['toUpperCase']()]+_0x7e14('0x27'),_0x1229e3);return new Promise(function(_0x2b3486,_0x53319c){var _0xe03e6d={'method':_0x7e14('0xc'),'uri':_0x35403c+'sys_user?sysparm_query=phone%3D'+_0x1229e3[_0x7e14('0x24')]+'&'+_0x2d1c3d+'&'+_0x1e6195,'auth':_0x3b7eca,'json':!![]};return rp(_0xe03e6d)[_0x7e14('0xd')](function(_0x150c8f){if(_0x150c8f[_0x7e14('0xe')][_0x7e14('0xf')]>0x0){_0x1229e3[_0x7e14('0x26')]=_0x150c8f[_0x7e14('0xe')][0x0][_0x7e14('0x1e')];logger[_0x7e14('0x11')]('['+[_0x52544c[_0x7e14('0x15')]()]+_0x7e14('0x28'),_0x1229e3);_0x2b3486(_0x1229e3);}else{return createEndUser(_0x52544c,_0x3b7eca,_0x1229e3,_0x35403c,_0x2d1c3d)[_0x7e14('0xd')](function(_0x5082ef){logger['info']('['+[_0x52544c[_0x7e14('0x15')]()]+'],\x20createEndUser\x20crm',_0x5082ef);_0x2b3486(_0x5082ef);});}})[_0x7e14('0x13')](function(_0x2922a2){logger['error']('['+[_0x52544c[_0x7e14('0x15')]()]+']',_0x2922a2[_0x7e14('0x16')]);_0x53319c(_0x2922a2[_0x7e14('0x16')]);});});};}function getCustomFields(_0x479829,_0xd53ed4){var _0x504f0b={};if(_0x479829['length']>0x0){_[_0x7e14('0x29')](_0x479829,function(_0x3e7f70){if(_['includes']([_0x7e14('0x2a'),_0x7e14('0x2b')],_0x3e7f70[_0x7e14('0x2c')])&&_0x3e7f70[_0x7e14('0x2d')]&&!_0x3e7f70[_0x7e14('0x2e')]){_0x504f0b[_0x3e7f70[_0x7e14('0x2d')]['toLowerCase']()]=_0x3e7f70[_0x7e14('0x2f')][_0x7e14('0x30')]();}else if(_[_0x7e14('0x31')](['string',_0x7e14('0x2b')],_0x3e7f70['type'])&&_0x3e7f70['idField']&&_0x3e7f70['customField']){_0x504f0b[_0x3e7f70[_0x7e14('0x32')][_0x7e14('0x33')]()]=_0x3e7f70[_0x7e14('0x2f')][_0x7e14('0x30')]();}else if(_0x3e7f70[_0x7e14('0x2c')]===_0x7e14('0x34')&&_0x3e7f70[_0x7e14('0x35')]&&_0x3e7f70[_0x7e14('0x32')]&&_0x3e7f70[_0x7e14('0x2e')]){_0x504f0b[_0x3e7f70[_0x7e14('0x32')][_0x7e14('0x33')]()]=_0xd53ed4[_0x3e7f70['variableName']][_0x7e14('0x30')]();}else if(_0x3e7f70[_0x7e14('0x2c')]===_0x7e14('0x36')&&_0x3e7f70[_0x7e14('0x37')]&&_0x3e7f70[_0x7e14('0x37')][_0x7e14('0x38')]&&_0x3e7f70[_0x7e14('0x32')]&&_0x3e7f70['customField']){_0x504f0b[_0x3e7f70['idField']['toLowerCase']()]=_0xd53ed4[_0x3e7f70[_0x7e14('0x37')][_0x7e14('0x38')]['toLowerCase']()][_0x7e14('0x30')]();}});}return _0x504f0b;}function getTicket(_0x803f72,_0x30ef48,_0xa3e387,_0x191382,_0x4a6103,_0x1c388e){return function(_0x4037d5){logger['info']('['+[_0x803f72[_0x7e14('0x15')]()]+_0x7e14('0x39'),_0x4037d5);return new Promise(function(_0x50bb19,_0x16ac87){var _0x152469=_0x803f72[_0x7e14('0x33')]()==='outbound'?_0x4037d5[_0x7e14('0x1d')]:_0x4037d5['endUserId'];var _0x1078e5={'method':'POST','uri':_0xa3e387+'incident'+'?'+_0x1c388e,'body':Object[_0x7e14('0x3a')]({},{'active':_0x7e14('0x1c'),'caller_id':_0x152469,'assigned_to':_0x4037d5[_0x7e14('0x1d')],'short_description':intUtil['getString'](_0x191382['Subjects'],_0x4a6103,'\x20'),'description':intUtil[_0x7e14('0x3b')](_0x191382['Descriptions'],_0x4a6103,'\x0a')},getCustomFields(_0x191382['Fields'],_0x4a6103)),'auth':_0x30ef48,'json':!![]};return rp(_0x1078e5)['then'](function(_0x3dfcdb){logger['info']('['+[_0x803f72[_0x7e14('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3dfcdb[_0x7e14('0xe')]);_0x4037d5[_0x7e14('0x3c')]=_0x3dfcdb[_0x7e14('0xe')]['sys_id'];_0x4037d5[_0x7e14('0x3d')]=_0x3dfcdb[_0x7e14('0xe')][_0x7e14('0x3e')];logger[_0x7e14('0x11')]('['+[_0x803f72[_0x7e14('0x15')]()]+']\x20getTicket\x20crm',_0x4037d5);_0x50bb19(_0x4037d5);})[_0x7e14('0x13')](function(_0x3cd888){logger['error']('['+[_0x803f72[_0x7e14('0x15')]()]+']',_0x3cd888[_0x7e14('0x16')]);_0x16ac87(_0x3cd888[_0x7e14('0x16')]);});});};}function createRemoteTag(_0x53c5f2,_0x3db8db,_0xff5bfa,_0x438d5f){return new Promise(function(_0xff762,_0xa6fa3c){var _0x3c248b={'method':'POST','uri':_0xff5bfa+_0x7e14('0x3f')+'?'+_0x438d5f,'body':{'short_description':_0x53c5f2,'global':!![],'active':!![],'name':_0x53c5f2},'auth':_0x3db8db,'json':!![]};return rp(_0x3c248b)[_0x7e14('0xd')](function(_0xc763de){var _0x2b608b=_0xc763de['result']['sys_id'];_0xff762(_0x2b608b);});});}function getRemoteTag(_0x40d4dd,_0x394561,_0x308cc9,_0x22acda,_0x47c2e1){return new Promise(function(_0x3622d0,_0x2d69ec){var _0x4ec16a={'method':'GET','uri':_0x308cc9+_0x7e14('0x3f')+_0x7e14('0x40')+_0x40d4dd+'&'+_0x22acda,'auth':_0x394561,'json':!![]};return rp(_0x4ec16a)[_0x7e14('0xd')](function(_0xd39079){if(_0xd39079[_0x7e14('0xe')]['length']>0x0){var _0x329dba=_0xd39079['result'][0x0]['sys_id'];_0x3622d0(_0x329dba);}else{return createRemoteTag(_0x40d4dd,_0x394561,_0x308cc9,_0x22acda)[_0x7e14('0xd')](function(_0x340b95){_0x3622d0(_0x340b95);});}});});}function assignTagToIncident(_0x6357bb,_0x5c61b5,_0x37609b,_0x71dbcd,_0x18db94){return new Promise(function(_0x59ba51,_0x2ea1c1){var _0x1d98c2={'method':_0x7e14('0x22'),'uri':_0x37609b+_0x7e14('0x41')+'?'+_0x18db94,'body':{'label':_0x6357bb,'table':'incident','id_type':_0x7e14('0x42'),'table_key':_0x71dbcd['ticketId'],'title':'Incident\x20-\x20'+_0x71dbcd['ticketNumber'],'id_display':_0x71dbcd[_0x7e14('0x3d')]},'auth':_0x5c61b5,'json':!![]};return rp(_0x1d98c2)['then'](function(_0x2fb01e){_0x59ba51();})['catch'](function(){_0x59ba51();});});}function manageTags(_0x3073bb,_0x589fdf,_0x4f72f4,_0x14c0aa,_0x491e6b,_0x5a09c2,_0x57ce22){return new Promise(function(_0x3173c0,_0xff77d){var _0x2218dc=[];_0x589fdf['forEach'](function(_0x376dd6){_0x2218dc['push'](getRemoteTag(_0x376dd6,_0x4f72f4,_0x14c0aa,_0x5a09c2,_0x57ce22));});return Promise['all'](_0x2218dc)['then'](function(_0x3e73e2){if(_0x3e73e2[_0x7e14('0xf')]){logger['info']('['+[_0x3073bb['toUpperCase']()]+_0x7e14('0x43'),_0x3e73e2);var _0x5ec0ca=[];_0x3e73e2[_0x7e14('0x29')](function(_0x4e9ed1){_0x5ec0ca[_0x7e14('0x44')](assignTagToIncident(_0x4e9ed1,_0x4f72f4,_0x14c0aa,_0x491e6b,_0x5a09c2));});return Promise[_0x7e14('0x45')](_0x5ec0ca)[_0x7e14('0xd')](function(){_0x3173c0();})[_0x7e14('0x13')](function(){_0x3173c0();});}else{_0x3173c0();}});});}function getTags(_0x1786d4,_0x47abe9,_0x53ef73,_0x1fe408,_0x556cf8,_0x43e998){return function(_0x21ab43){return new Promise(function(_0x2dfe9f,_0x4d7568){var _0x2f5335=[];var _0x1f2baf=_0x1fe408[_0x7e14('0x46')];if(_0x1f2baf&&_0x1f2baf[_0x7e14('0xf')]>0x0){_0x2f5335=_[_0x7e14('0x47')](_0x1f2baf,_0x7e14('0x38'));}if(_0x2f5335[_0x7e14('0xf')]>0x0){return manageTags(_0x1786d4,_0x2f5335,_0x47abe9,_0x53ef73,_0x21ab43,_0x556cf8,_0x43e998)[_0x7e14('0xd')](function(){_0x2dfe9f(_0x21ab43);});}else{_0x2dfe9f(_0x21ab43);}});};}function emit(_0x196451,_0x505d7b,_0x5a0284){var _0x1263b6=_0x7e14('0x48')+_0x7e14('0x49')+_0x7e14('0x4a')+'%255EORDERBYDESCnumber';var _0x200cf3={'uri':_0x196451+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5a0284+_0x1263b6};io['to'](util[_0x7e14('0x4b')](_0x7e14('0x4c'),_0x505d7b))[_0x7e14('0x4d')](_0x7e14('0x4e'),_0x200cf3);}exports['cs']=function(_0x910f8b,_0x3fce22,_0x387433,_0x3e87a0,_0x4d1b5b,_0x1af0ce,_0x1e4461,_0x2dc00c){var _0x333a3a={};var _0x233dfc={'user':_0x1af0ce[_0x7e14('0x4f')],'pass':_0x1af0ce['password']};var _0x357df5=_0x7e14('0x50');var _0x333925=_0x7e14('0x51');_0x1af0ce[_0x7e14('0x52')]=intUtil[_0x7e14('0x53')](_0x1af0ce[_0x7e14('0x52')]);_0x1af0ce[_0x7e14('0x54')]=intUtil['stripTrailingSlash'](_0x1af0ce[_0x7e14('0x54')]);var _0xf46492=util[_0x7e14('0x4b')]('%s/api/now/table/',_0x1af0ce[_0x7e14('0x52')]);_0x333a3a[_0x7e14('0x19')]=!_[_0x7e14('0x55')](_0x3e87a0)?_0x3e87a0['email']:null;_0x333a3a[_0x7e14('0x1f')]=_0x1af0ce[_0x7e14('0x56')];_0x333a3a[_0x7e14('0x24')]=_0x2dc00c[_0x7e14('0x33')]()===_0x7e14('0x57')?_0x3fce22[_0x7e14('0x58')]:_0x3fce22[_0x7e14('0x59')];_0x333a3a['callDirection']=_0x2dc00c===_0x7e14('0x5a')||_0x2dc00c===_0x7e14('0x5b')?_0x7e14('0x5a'):_0x7e14('0x57');var _0x22a24a=util[_0x7e14('0x4b')](_0x7e14('0x5c'),_0x1af0ce[_0x7e14('0x54')],_0x3fce22[_0x7e14('0x5d')],md5(_0x3fce22[_0x7e14('0x5d')]));if(_0x4d1b5b&&_0x4d1b5b['monitor_format']){logger[_0x7e14('0x11')]('[QUEUE]',_0x7e14('0x5e'));_0x3fce22[_0x7e14('0x5f')]=_0x22a24a;}else if(_0x1e4461&&_0x1e4461[_0x7e14('0x60')]&&_0x1e4461['recordingFormat']!=='none'){logger[_0x7e14('0x11')]('[OUTBOUND]',_0x7e14('0x5e'));_0x3fce22['recordingURL']=_0x22a24a;}else{_0x3fce22['recordingURL']='';}return getAdminUser(_0x2dc00c,_0x233dfc,_0x333a3a,_0xf46492,_0x333925,_0x357df5)['then'](getUser(_0x2dc00c,_0x233dfc,_0xf46492,_0x333925,_0x357df5))[_0x7e14('0xd')](getEndUser(_0x2dc00c,_0x233dfc,_0xf46492,_0x333925,_0x357df5))[_0x7e14('0xd')](getTicket(_0x2dc00c,_0x233dfc,_0xf46492,_0x387433,_0x3fce22,_0x333925))['then'](function(_0x27cf0f){logger[_0x7e14('0x11')](util[_0x7e14('0x4b')](_0x7e14('0x61'),_0x27cf0f[_0x7e14('0x3c')]));logger[_0x7e14('0x11')](util[_0x7e14('0x4b')](_0x7e14('0x62'),_0x2dc00c));if(_0x2dc00c!==_0x7e14('0x5b')){logger[_0x7e14('0x11')]('['+[_0x2dc00c['toUpperCase']()]+']',_0x7e14('0x63'));emit(_0x1af0ce[_0x7e14('0x52')],_0x3e87a0[_0x7e14('0x38')],_0x27cf0f[_0x7e14('0x3c')]);}})[_0x7e14('0x13')](function(_0x58d7fa){logger[_0x7e14('0x14')]('['+[_0x2dc00c[_0x7e14('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x58d7fa,{'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 9ffe8f8..abed5d2 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 _0x19d0=['phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','content','string','customField','custom_fields','variable','Variable','toLowerCase','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','slice','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','stringify','Calls','apiKey','toString','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22'];(function(_0x3d44ab,_0x4446b8){var _0x25e8b8=function(_0x6e31cd){while(--_0x6e31cd){_0x3d44ab['push'](_0x3d44ab['shift']());}};_0x25e8b8(++_0x4446b8);}(_0x19d0,0x132));var _0x019d=function(_0x5e0809,_0x50fd05){_0x5e0809=_0x5e0809-0x0;var _0x49c015=_0x19d0[_0x5e0809];return _0x49c015;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x019d('0x0'));var md5=require(_0x019d('0x1'));var util=require(_0x019d('0x2'));var Redis=require('ioredis');var intUtil=require(_0x019d('0x3'));var config=require(_0x019d('0x4'));var logger=require('../../../../config/logger')(_0x019d('0x5'));config[_0x019d('0x6')]=_['defaults'](config['redis'],{'host':_0x019d('0x7'),'port':0x18eb});var io=require(_0x019d('0x8'))(new Redis(config[_0x019d('0x6')]));var def={'method':_0x019d('0x9'),'json':!![]};function emit(_0x2766ac,_0x1a5234,_0x233614){io['to'](_0x2766ac)[_0x019d('0xa')](_0x1a5234,_0x233614);}function getTicket(_0x183dc1,_0x47696e,_0x2f5202,_0x2c056b,_0x3f9af1,_0x3eda0e,_0x49fb30,_0x9ae858){logger[_0x019d('0xb')](_0x019d('0xc'));var _0x42137f=new Date();var _0x333fde=[{'name':_0x019d('0xd'),'value':intUtil[_0x019d('0xe')](_0x2c056b[_0x019d('0xf')],_0x3f9af1,'\x20')},{'name':'assigned_user_id','value':_0x47696e['id']},{'name':_0x019d('0x10'),'value':_0x47696e['id']},{'name':'description','value':intUtil[_0x019d('0xe')](_0x2c056b[_0x019d('0x11')],_0x3f9af1,'\x0a')},{'name':_0x019d('0x12'),'value':_0x42137f['toISOString']()[_0x019d('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x019d('0x14'),'value':_0x2f5202['id']},{'name':_0x019d('0x15'),'value':_0x019d('0x16')},{'name':_0x019d('0x17'),'value':_0x2f5202['name']},{'name':_0x019d('0x18'),'value':_0x9ae858}];if(_0x3eda0e[_0x019d('0x19')]){_[_0x019d('0x1a')](_0x3eda0e,function(_0x1953f4){if(_0x3f9af1[_0x1953f4[_0x019d('0x1b')]]){_0x333fde[_0x019d('0x1c')]({'name':_0x1953f4[_0x019d('0x1d')],'value':_0x3f9af1[_0x1953f4['variableName']]});}});}return request({'form':{'method':_0x019d('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x019d('0x1f')]({'session':_0x49fb30['id'],'module_name':_0x019d('0x20'),'name_value_list':_0x333fde})}});}function getAuth(_0x1f0423){return util['format']('Basic\x20%s',new Buffer(_0x1f0423[_0x019d('0x21')]+':X')[_0x019d('0x22')]('base64'));}function getServerInfo(_0x53d111){return request({'form':{'method':'get_server_info','input_type':_0x019d('0x23'),'response_type':_0x019d('0x23'),'rest_data':JSON[_0x019d('0x1f')]({'session':_0x53d111['id']})}});}function getUser(_0x52ab62,_0xebcb90,_0x2b682c){if(!_[_0x019d('0x24')](_0xebcb90)){logger['info'](_0x019d('0x25'),_0xebcb90);return request({'form':{'method':_0x019d('0x26'),'input_type':_0x019d('0x23'),'response_type':_0x019d('0x23'),'rest_data':JSON['stringify']({'session':_0x2b682c['id'],'module_name':_0x019d('0x27'),'query':util[_0x019d('0x28')](_0x019d('0x29'),_0xebcb90),'order_by':'','offset':'0','select_fields':['id',_0x019d('0xd'),_0x019d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x019d('0x2b')](function(_0x274a10){if(_0x274a10[_0x019d('0x2c')][_0x019d('0x19')]){var _0x4f3507=_[_0x019d('0x2d')](_0x274a10[_0x019d('0x2c')],function(_0x1dcb52){return _0x1dcb52[_0x019d('0x2e')]['user_name']['value']===_0xebcb90;});if(_0x4f3507){logger['info']('Agent\x20found!');return BPromise[_0x019d('0x2f')]({'id':_0x4f3507[_0x019d('0x2e')]['id'][_0x019d('0x30')],'name':_0x4f3507[_0x019d('0x2e')][_0x019d('0xd')][_0x019d('0x30')]});}}logger[_0x019d('0xb')](_0x019d('0x31'));return BPromise[_0x019d('0x2f')]({'id':_0x2b682c[_0x019d('0x2e')][_0x019d('0x32')][_0x019d('0x30')],'name':_0x2b682c[_0x019d('0x2e')][_0x019d('0x2a')]['value']});});}else{logger[_0x019d('0xb')](_0x019d('0x33'));return BPromise[_0x019d('0x2f')]({'id':_0x2b682c[_0x019d('0x2e')][_0x019d('0x32')][_0x019d('0x30')],'name':_0x2b682c['name_value_list'][_0x019d('0x2a')]['value']});}}function getEndUser(_0x3d9c04,_0x555026,_0x37d0dc,_0x47d0b2){logger['info'](_0x019d('0x34'),_0x37d0dc);return request({'form':{'method':_0x019d('0x26'),'input_type':_0x019d('0x23'),'response_type':_0x019d('0x23'),'rest_data':JSON['stringify']({'session':_0x47d0b2['id'],'module_name':'Contacts','query':util[_0x019d('0x28')](_0x019d('0x35'),_0x37d0dc),'order_by':'','offset':'0','select_fields':['id',_0x019d('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x019d('0x2b')](function(_0x2720d2){if(_0x2720d2[_0x019d('0x2c')][_0x019d('0x19')]){var _0x394189=_[_0x019d('0x2d')](_0x2720d2[_0x019d('0x2c')],function(_0xb9b687){return _0xb9b687[_0x019d('0x2e')][_0x019d('0x36')]['value']===_0x37d0dc;});if(_0x394189){logger[_0x019d('0xb')](_0x019d('0x37'));return BPromise[_0x019d('0x2f')]({'id':_0x394189[_0x019d('0x2e')]['id'][_0x019d('0x30')],'name':_0x394189['name_value_list'][_0x019d('0xd')]['value'],'phone':_0x394189[_0x019d('0x2e')][_0x019d('0x36')][_0x019d('0x30')]});}}else{logger[_0x019d('0xb')](_0x019d('0x38'));return request({'form':{'method':_0x019d('0x1e'),'input_type':'JSON','response_type':_0x019d('0x23'),'rest_data':JSON[_0x019d('0x1f')]({'session':_0x47d0b2['id'],'module_name':'Contacts','name_value_list':[{'name':_0x019d('0x39'),'value':_0x555026!==_0x019d('0x3a')?_0x555026:util[_0x019d('0x28')](_0x019d('0x3b'),_0x37d0dc)},{'name':_0x019d('0x36'),'value':_0x37d0dc}]})}})[_0x019d('0x2b')](function(_0x386aa7){logger[_0x019d('0xb')](_0x019d('0x3c'));return BPromise[_0x019d('0x2f')]({'id':_0x386aa7['id'],'name':_0x386aa7[_0x019d('0x2c')][_0x019d('0x39')][_0x019d('0x30')],'phone':_0x386aa7[_0x019d('0x2c')][_0x019d('0x36')][_0x019d('0x30')]});});}});}function request(_0x32da11){logger[_0x019d('0x3d')](_0x019d('0x3e'),JSON[_0x019d('0x1f')](_0x32da11));return rp(_[_0x019d('0x3f')](def,_0x32da11));}function getTags(_0x294c1c,_0xa1c0d1){var _0x42cb6c=[];if(_0x294c1c&&_0x294c1c['length']>0x0){_0x42cb6c=_['map'](_0x294c1c,_0xa1c0d1);}return _0x42cb6c;}function getCustomFields(_0x46dd97,_0x20fe3d){var _0x4b19a2=[];var _0x59e33b={'custom_fields':[]};if(_0x46dd97[_0x019d('0x19')]>0x0){_[_0x019d('0x1a')](_0x46dd97,function(_0x545edc){if(_0x545edc[_0x019d('0x40')]==='string'&&_0x545edc['nameField']&&!_0x545edc['customField']){_0x59e33b[_0x545edc[_0x019d('0x41')]['toLowerCase']()]=_0x545edc[_0x019d('0x42')][_0x019d('0x22')]();}else if(_0x545edc['type']===_0x019d('0x43')&&_0x545edc[_0x019d('0x1d')]&&_0x545edc[_0x019d('0x44')]){_0x59e33b[_0x019d('0x45')]['push']({'id':_0x545edc[_0x019d('0x1d')],'value':_0x545edc[_0x019d('0x42')][_0x019d('0x22')]()});}else if(_0x545edc[_0x019d('0x40')]===_0x019d('0x46')&&_0x545edc['variableName']&&_0x545edc[_0x019d('0x1d')]&&_0x545edc[_0x019d('0x44')]){_0x20fe3d[_0x545edc[_0x019d('0x1b')]]&&_0x59e33b[_0x019d('0x45')][_0x019d('0x1c')]({'id':_0x545edc[_0x019d('0x1d')],'value':_0x20fe3d[_0x545edc[_0x019d('0x1b')]][_0x019d('0x22')]()});}else if(_0x545edc['type']==='customVariable'&&_0x545edc[_0x019d('0x47')]&&_0x545edc[_0x019d('0x47')][_0x019d('0xd')]&&_0x545edc[_0x019d('0x1d')]&&_0x545edc[_0x019d('0x44')]){_0x20fe3d[_0x545edc['Variable'][_0x019d('0xd')][_0x019d('0x48')]()]&&_0x59e33b[_0x019d('0x45')]['push']({'id':_0x545edc['idField'],'value':_0x20fe3d[_0x545edc[_0x019d('0x47')]['name'][_0x019d('0x48')]()][_0x019d('0x22')]()});}});}return _0x59e33b;}function getConnection(_0x683ba1){return request({'method':_0x019d('0x9'),'form':{'method':_0x019d('0x49'),'input_type':_0x019d('0x23'),'response_type':_0x019d('0x23'),'rest_data':JSON[_0x019d('0x1f')]({'user_auth':{'user_name':_0x683ba1[_0x019d('0x4a')],'password':_0x683ba1[_0x019d('0x4b')],'encryption':'PLAIN'},'application':_0x019d('0x4c')})}})[_0x019d('0x2b')](function(_0x10d7c2){var _0x855686=_0x10d7c2;if(_0x855686['id']){def[_0x019d('0x4d')]=_0x855686['id'];return BPromise[_0x019d('0x2f')](_0x855686);}else{throw new Error(util[_0x019d('0x28')](_0x019d('0x4e'),_0x683ba1['id']));}});}function setRelationship(_0x3037b9,_0x5b9929,_0x334ad3,_0x2fa569){return request({'form':{'method':_0x019d('0x4f'),'input_type':_0x019d('0x23'),'response_type':_0x019d('0x23'),'rest_data':JSON['stringify']({'session':_0x3037b9['id'],'module_name':'Calls','module_id':_0x334ad3['id'],'link_field_name':_0x2fa569,'related_ids':[_0x5b9929['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x019d('0x50')]=function(_0x1b3fe5,_0x4752cd,_0x361e24,_0x5480f3,_0x462e1c,_0x384e4e){var _0x4912aa,_0x231c65,_0x296b12,_0x4911e0;_0x384e4e[_0x019d('0x51')]=intUtil[_0x019d('0x52')](_0x384e4e[_0x019d('0x51')]);_0x384e4e['serverUrl']=intUtil[_0x019d('0x52')](_0x384e4e[_0x019d('0x53')]);def[_0x019d('0x54')]=util[_0x019d('0x28')]('%s/service/v4_1/rest.php',_0x384e4e[_0x019d('0x51')]);if(_0x462e1c&&_0x462e1c[_0x019d('0x55')]){logger['info'](_0x019d('0x56'),_0x019d('0x57'));_0x4752cd['recordingURL']=util['format'](_0x019d('0x58'),_0x384e4e[_0x019d('0x53')],_0x4752cd['uniqueid'],md5(_0x4752cd[_0x019d('0x59')]));}else{_0x4752cd[_0x019d('0x5a')]='';}return getConnection(_0x384e4e)[_0x019d('0x2b')](function(_0x5fdbb6){_0x4911e0=_0x5fdbb6;return getUser(_0x384e4e,_0x5480f3['name'],_0x4911e0);})[_0x019d('0x2b')](function(_0x1ae28a){_0x4912aa=_0x1ae28a;logger['info'](_0x019d('0x5b'),_0x4912aa['id']);return getEndUser(_0x384e4e,_0x4752cd[_0x019d('0x5c')],_0x4752cd[_0x019d('0x5d')],_0x4911e0);})[_0x019d('0x2b')](function(_0x3b98b6){_0x231c65=_0x3b98b6;logger[_0x019d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x231c65['id']);return getTicket(_0x384e4e,_0x4912aa,_0x231c65,_0x361e24,_0x4752cd,_0x361e24[_0x019d('0x5e')],_0x4911e0,_0x019d('0x5f'));})[_0x019d('0x2b')](function(_0x5d5c7e){_0x296b12=_0x5d5c7e;logger['info'](_0x019d('0x60'));logger['info'](_0x019d('0x61'),_0x296b12['id']);return setRelationship(_0x4911e0,_0x4912aa,_0x296b12,_0x019d('0x62'));})['then'](function(){return setRelationship(_0x4911e0,_0x231c65,_0x296b12,_0x019d('0x63'));})[_0x019d('0x2b')](function(){return getServerInfo(_0x4911e0);})[_0x019d('0x2b')](function(_0x278a52){var _0x5eda60=parseInt(_0x278a52[_0x019d('0x64')][_0x019d('0x65')](0x0));var _0xa73dc5=util[_0x019d('0x28')](_0x019d('0x66'),_0x384e4e[_0x019d('0x51')],_0x296b12['id']);if(_0x5eda60>0x6){_0xa73dc5=util['format'](_0x019d('0x67'),_0x384e4e[_0x019d('0x51')],_0x296b12['id']);}logger['info']('[QUEUE]',_0x019d('0x68'));emit(util[_0x019d('0x28')](_0x019d('0x69'),_0x5480f3[_0x019d('0xd')]),_0x019d('0x6a'),{'uri':_0xa73dc5});})[_0x019d('0x6b')](function(_0x381aba){logger[_0x019d('0x6c')]('[QUEUE]',JSON[_0x019d('0x1f')](_0x381aba));});};exports[_0x019d('0x6d')]=function(_0x2f03ef,_0x54d44f,_0x52f51a,_0x39c1e5,_0x1663fc,_0x314b6c,_0x416c53){var _0xdc1fa1,_0x103afd,_0x5e8c40,_0x417f4b;_0x314b6c[_0x019d('0x51')]=intUtil[_0x019d('0x52')](_0x314b6c[_0x019d('0x51')]);_0x314b6c[_0x019d('0x53')]=intUtil[_0x019d('0x52')](_0x314b6c[_0x019d('0x53')]);def['uri']=util[_0x019d('0x28')](_0x019d('0x6e'),_0x314b6c[_0x019d('0x51')]);if(_0x416c53&&_0x416c53[_0x019d('0x6f')]&&_0x416c53['recordingFormat']!==_0x019d('0x70')){logger['info'](_0x019d('0x71'),_0x019d('0x57'));_0x54d44f[_0x019d('0x5a')]=util[_0x019d('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x314b6c[_0x019d('0x53')],_0x54d44f[_0x019d('0x59')],md5(_0x54d44f[_0x019d('0x59')]));}return getConnection(_0x314b6c)[_0x019d('0x2b')](function(_0x35c7ee){_0x417f4b=_0x35c7ee;return getUser(_0x314b6c,_0x39c1e5[_0x019d('0xd')],_0x417f4b);})['then'](function(_0x5a4dec){_0xdc1fa1=_0x5a4dec;logger[_0x019d('0xb')](_0x019d('0x5b'),_0xdc1fa1['id']);return getEndUser(_0x314b6c,_0x54d44f['destcalleridname'],_0x54d44f[_0x019d('0x72')],_0x417f4b);})['then'](function(_0x12a9b6){_0x103afd=_0x12a9b6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x103afd['id']);return getTicket(_0x314b6c,_0xdc1fa1,_0x103afd,_0x52f51a,_0x54d44f,_0x52f51a[_0x019d('0x5e')],_0x417f4b,_0x019d('0x73'));})[_0x019d('0x2b')](function(_0x262afb){_0x5e8c40=_0x262afb;logger['info'](_0x019d('0x60'));logger[_0x019d('0xb')](_0x019d('0x61'),_0x5e8c40['id']);return setRelationship(_0x417f4b,_0xdc1fa1,_0x5e8c40,'users');})[_0x019d('0x2b')](function(){return setRelationship(_0x417f4b,_0x103afd,_0x5e8c40,_0x019d('0x63'));})[_0x019d('0x2b')](function(){return getServerInfo(_0x417f4b);})[_0x019d('0x2b')](function(_0x3440d0){var _0x52a918=parseInt(_0x3440d0[_0x019d('0x64')]['charAt'](0x0));var _0x335971=util[_0x019d('0x28')](_0x019d('0x66'),_0x314b6c['remoteUri'],_0x5e8c40['id']);if(_0x52a918>0x6){_0x335971=util['format'](_0x019d('0x67'),_0x314b6c[_0x019d('0x51')],_0x5e8c40['id']);}logger[_0x019d('0xb')]('[OUTBOUND]',_0x019d('0x68'));emit(util[_0x019d('0x28')]('user:%s',_0x39c1e5['name']),_0x019d('0x6a'),{'uri':_0x335971});})[_0x019d('0x6b')](function(_0x32843b){logger['error'](_0x019d('0x71'),JSON[_0x019d('0x1f')](_0x32843b));});};exports[_0x019d('0x74')]=function(_0x48975b,_0x21fe99,_0x5e4388,_0x3caa93,_0x1f3ae2,_0x45e6e6){var _0x4a25b5,_0x52f75d,_0x596b7a,_0xa46ac;_0x45e6e6['remoteUri']=intUtil[_0x019d('0x52')](_0x45e6e6['remoteUri']);_0x45e6e6[_0x019d('0x53')]=intUtil[_0x019d('0x52')](_0x45e6e6[_0x019d('0x53')]);def[_0x019d('0x54')]=util[_0x019d('0x28')](_0x019d('0x6e'),_0x45e6e6[_0x019d('0x51')]);if(_0x1f3ae2&&_0x1f3ae2['monitor_format']){logger[_0x019d('0xb')]('['+_0x21fe99[_0x019d('0x75')][_0x019d('0x76')]()+']',_0x019d('0x57'));_0x21fe99[_0x019d('0x5a')]=util[_0x019d('0x28')](_0x019d('0x58'),_0x45e6e6[_0x019d('0x53')],_0x21fe99['uniqueid'],md5(_0x21fe99[_0x019d('0x59')]));}else{_0x21fe99[_0x019d('0x5a')]='';}return getConnection(_0x45e6e6)[_0x019d('0x2b')](function(_0x262165){_0xa46ac=_0x262165;if(!_['isNil'](_0x3caa93)){return getUser(_0x45e6e6,_0x3caa93['name'],_0xa46ac);}else{return getUser(_0x45e6e6,null,_0xa46ac);}})[_0x019d('0x2b')](function(_0x2ad911){_0x4a25b5=_0x2ad911;logger['info'](_0x019d('0x5b'),_0x4a25b5['id']);return getEndUser(_0x45e6e6,_0x21fe99[_0x019d('0x5c')],_0x21fe99[_0x019d('0x5d')],_0xa46ac);})[_0x019d('0x2b')](function(_0x5bdab1){_0x52f75d=_0x5bdab1;logger[_0x019d('0xb')](_0x019d('0x77'),_0x52f75d['id']);return getTicket(_0x45e6e6,_0x4a25b5,_0x52f75d,_0x5e4388,_0x21fe99,_0x5e4388[_0x019d('0x5e')],_0xa46ac,_0x019d('0x5f'));})[_0x019d('0x2b')](function(_0x364dc8){_0x596b7a=_0x364dc8;logger[_0x019d('0xb')](_0x019d('0x60'));logger[_0x019d('0xb')](_0x019d('0x61'),_0x596b7a['id']);return setRelationship(_0xa46ac,_0x4a25b5,_0x596b7a,'users');})[_0x019d('0x2b')](function(){return setRelationship(_0xa46ac,_0x52f75d,_0x596b7a,'contacts');})[_0x019d('0x2b')](function(){return getServerInfo(_0xa46ac);})['catch'](function(_0x336b82){logger[_0x019d('0x6c')]('['+_0x21fe99['lastevent'][_0x019d('0x76')]()+']',JSON[_0x019d('0x1f')](_0x336b82));});}; \ No newline at end of file +var _0x9ba5=['customField','toLowerCase','content','idField','custom_fields','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','catch','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','parent_id','Contacts','direction','length','forEach','variableName','set_entry','JSON','stringify','format','Basic\x20%s','toString','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9ba5,0x129));var _0x59ba=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9ba5[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x59ba('0x0'));var rp=require('request-promise');var BPromise=require(_0x59ba('0x1'));var md5=require(_0x59ba('0x2'));var util=require(_0x59ba('0x3'));var Redis=require(_0x59ba('0x4'));var intUtil=require('./util');var config=require(_0x59ba('0x5'));var logger=require(_0x59ba('0x6'))(_0x59ba('0x7'));config[_0x59ba('0x8')]=_[_0x59ba('0x9')](config[_0x59ba('0x8')],{'host':_0x59ba('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x59ba('0x8')]));var def={'method':_0x59ba('0xb'),'json':!![]};function emit(_0x18e658,_0x3a0c3d,_0x41ea6c){io['to'](_0x18e658)[_0x59ba('0xc')](_0x3a0c3d,_0x41ea6c);}function getTicket(_0x4bd5f7,_0x3d3cb6,_0x580e1f,_0x255935,_0x26605f,_0x49c50f,_0x33c2eb,_0xa9e40a){logger['info'](_0x59ba('0xd'));var _0xa9982a=new Date();var _0x10bba2=[{'name':_0x59ba('0xe'),'value':intUtil[_0x59ba('0xf')](_0x255935[_0x59ba('0x10')],_0x26605f,'\x20')},{'name':_0x59ba('0x11'),'value':_0x3d3cb6['id']},{'name':'created_by','value':_0x3d3cb6['id']},{'name':_0x59ba('0x12'),'value':intUtil[_0x59ba('0xf')](_0x255935[_0x59ba('0x13')],_0x26605f,'\x0a')},{'name':_0x59ba('0x14'),'value':_0xa9982a[_0x59ba('0x15')]()[_0x59ba('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x59ba('0x17'),'value':_0x580e1f['id']},{'name':'parent_type','value':_0x59ba('0x18')},{'name':'parent_name','value':_0x580e1f[_0x59ba('0xe')]},{'name':_0x59ba('0x19'),'value':_0xa9e40a}];if(_0x49c50f[_0x59ba('0x1a')]){_[_0x59ba('0x1b')](_0x49c50f,function(_0x299763){if(_0x26605f[_0x299763[_0x59ba('0x1c')]]){_0x10bba2['push']({'name':_0x299763['idField'],'value':_0x26605f[_0x299763[_0x59ba('0x1c')]]});}});}return request({'form':{'method':_0x59ba('0x1d'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x33c2eb['id'],'module_name':'Calls','name_value_list':_0x10bba2})}});}function getAuth(_0x14905){return util[_0x59ba('0x20')](_0x59ba('0x21'),new Buffer(_0x14905['apiKey']+':X')[_0x59ba('0x22')]('base64'));}function getServerInfo(_0xc02c8a){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0xc02c8a['id']})}});}function getUser(_0x4b0683,_0x59a309,_0x2b6921){if(!_[_0x59ba('0x23')](_0x59a309)){logger[_0x59ba('0x24')](_0x59ba('0x25'),_0x59a309);return request({'form':{'method':_0x59ba('0x26'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON['stringify']({'session':_0x2b6921['id'],'module_name':'Employees','query':util[_0x59ba('0x20')](_0x59ba('0x27'),_0x59a309),'order_by':'','offset':'0','select_fields':['id',_0x59ba('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ba('0x28')](function(_0x344b2e){if(_0x344b2e[_0x59ba('0x29')][_0x59ba('0x1a')]){var _0x431008=_[_0x59ba('0x2a')](_0x344b2e[_0x59ba('0x29')],function(_0x1f8e41){return _0x1f8e41[_0x59ba('0x2b')][_0x59ba('0x2c')][_0x59ba('0x2d')]===_0x59a309;});if(_0x431008){logger[_0x59ba('0x24')]('Agent\x20found!');return BPromise[_0x59ba('0x2e')]({'id':_0x431008[_0x59ba('0x2b')]['id'][_0x59ba('0x2d')],'name':_0x431008[_0x59ba('0x2b')][_0x59ba('0xe')][_0x59ba('0x2d')]});}}logger[_0x59ba('0x24')](_0x59ba('0x2f'));return BPromise[_0x59ba('0x2e')]({'id':_0x2b6921['name_value_list'][_0x59ba('0x30')][_0x59ba('0x2d')],'name':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x2c')][_0x59ba('0x2d')]});});}else{logger[_0x59ba('0x24')](_0x59ba('0x31'));return BPromise['resolve']({'id':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x30')][_0x59ba('0x2d')],'name':_0x2b6921[_0x59ba('0x2b')][_0x59ba('0x2c')]['value']});}}function getEndUser(_0x11eb41,_0x1d9ea3,_0x1a176c,_0x21a12a){logger['info'](_0x59ba('0x32'),_0x1a176c);return request({'form':{'method':_0x59ba('0x26'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x21a12a['id'],'module_name':_0x59ba('0x18'),'query':util[_0x59ba('0x20')](_0x59ba('0x33'),_0x1a176c),'order_by':'','offset':'0','select_fields':['id',_0x59ba('0xe'),_0x59ba('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x59ba('0x28')](function(_0x273679){if(_0x273679[_0x59ba('0x29')][_0x59ba('0x1a')]){var _0x1ac9c8=_[_0x59ba('0x2a')](_0x273679[_0x59ba('0x29')],function(_0x14dc3e){return _0x14dc3e['name_value_list']['phone_home'][_0x59ba('0x2d')]===_0x1a176c;});if(_0x1ac9c8){logger[_0x59ba('0x24')](_0x59ba('0x35'));return BPromise[_0x59ba('0x2e')]({'id':_0x1ac9c8[_0x59ba('0x2b')]['id']['value'],'name':_0x1ac9c8[_0x59ba('0x2b')][_0x59ba('0xe')][_0x59ba('0x2d')],'phone':_0x1ac9c8[_0x59ba('0x2b')][_0x59ba('0x34')][_0x59ba('0x2d')]});}}else{logger['info'](_0x59ba('0x36'));return request({'form':{'method':_0x59ba('0x1d'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x21a12a['id'],'module_name':_0x59ba('0x18'),'name_value_list':[{'name':_0x59ba('0x37'),'value':_0x1d9ea3!==_0x59ba('0x38')?_0x1d9ea3:util[_0x59ba('0x20')](_0x59ba('0x39'),_0x1a176c)},{'name':_0x59ba('0x34'),'value':_0x1a176c}]})}})[_0x59ba('0x28')](function(_0xa47384){logger[_0x59ba('0x24')](_0x59ba('0x3a'));return BPromise[_0x59ba('0x2e')]({'id':_0xa47384['id'],'name':_0xa47384[_0x59ba('0x29')]['first_name'][_0x59ba('0x2d')],'phone':_0xa47384['entry_list'][_0x59ba('0x34')][_0x59ba('0x2d')]});});}});}function request(_0x4eb57e){logger[_0x59ba('0x3b')](_0x59ba('0x3c'),JSON[_0x59ba('0x1f')](_0x4eb57e));return rp(_[_0x59ba('0x3d')](def,_0x4eb57e));}function getTags(_0x38376a,_0xf03474){var _0x4fd609=[];if(_0x38376a&&_0x38376a[_0x59ba('0x1a')]>0x0){_0x4fd609=_[_0x59ba('0x3e')](_0x38376a,_0xf03474);}return _0x4fd609;}function getCustomFields(_0x36e786,_0x2ee398){var _0x24125e=[];var _0x49395c={'custom_fields':[]};if(_0x36e786[_0x59ba('0x1a')]>0x0){_[_0x59ba('0x1b')](_0x36e786,function(_0x37adf6){if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x40')&&_0x37adf6[_0x59ba('0x41')]&&!_0x37adf6[_0x59ba('0x42')]){_0x49395c[_0x37adf6[_0x59ba('0x41')][_0x59ba('0x43')]()]=_0x37adf6[_0x59ba('0x44')][_0x59ba('0x22')]();}else if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x40')&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6['customField']){_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x37adf6[_0x59ba('0x44')]['toString']()});}else if(_0x37adf6['type']==='variable'&&_0x37adf6[_0x59ba('0x1c')]&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6[_0x59ba('0x42')]){_0x2ee398[_0x37adf6['variableName']]&&_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x2ee398[_0x37adf6[_0x59ba('0x1c')]][_0x59ba('0x22')]()});}else if(_0x37adf6[_0x59ba('0x3f')]===_0x59ba('0x48')&&_0x37adf6[_0x59ba('0x49')]&&_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')]&&_0x37adf6[_0x59ba('0x45')]&&_0x37adf6[_0x59ba('0x42')]){_0x2ee398[_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')][_0x59ba('0x43')]()]&&_0x49395c[_0x59ba('0x46')][_0x59ba('0x47')]({'id':_0x37adf6[_0x59ba('0x45')],'value':_0x2ee398[_0x37adf6[_0x59ba('0x49')][_0x59ba('0xe')][_0x59ba('0x43')]()][_0x59ba('0x22')]()});}});}return _0x49395c;}function getConnection(_0x430f85){return request({'method':_0x59ba('0xb'),'form':{'method':_0x59ba('0x4a'),'input_type':'JSON','response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'user_auth':{'user_name':_0x430f85[_0x59ba('0x4b')],'password':_0x430f85[_0x59ba('0x4c')],'encryption':_0x59ba('0x4d')},'application':_0x59ba('0x4e')})}})[_0x59ba('0x28')](function(_0x219e2f){var _0x48ffb0=_0x219e2f;if(_0x48ffb0['id']){def[_0x59ba('0x4f')]=_0x48ffb0['id'];return BPromise[_0x59ba('0x2e')](_0x48ffb0);}else{throw new Error(util[_0x59ba('0x20')](_0x59ba('0x50'),_0x430f85['id']));}});}function setRelationship(_0x488a18,_0xebd3b6,_0x1b6426,_0xfad942){return request({'form':{'method':_0x59ba('0x51'),'input_type':_0x59ba('0x1e'),'response_type':_0x59ba('0x1e'),'rest_data':JSON[_0x59ba('0x1f')]({'session':_0x488a18['id'],'module_name':_0x59ba('0x52'),'module_id':_0x1b6426['id'],'link_field_name':_0xfad942,'related_ids':[_0xebd3b6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x59ba('0x53')]=function(_0x167f55,_0x16dd53,_0x29ffb9,_0x277d57,_0x932e17,_0x56d049){var _0x3f11c9,_0x16354b,_0x5a1109,_0x4d4be0;_0x56d049['remoteUri']=intUtil[_0x59ba('0x54')](_0x56d049['remoteUri']);_0x56d049[_0x59ba('0x55')]=intUtil['stripTrailingSlash'](_0x56d049[_0x59ba('0x55')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x56d049[_0x59ba('0x56')]);if(_0x932e17&&_0x932e17[_0x59ba('0x57')]){logger[_0x59ba('0x24')](_0x59ba('0x58'),_0x59ba('0x59'));_0x16dd53[_0x59ba('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56d049[_0x59ba('0x55')],_0x16dd53['uniqueid'],md5(_0x16dd53[_0x59ba('0x5b')]));}else{_0x16dd53[_0x59ba('0x5a')]='';}return getConnection(_0x56d049)[_0x59ba('0x28')](function(_0x2deab1){_0x4d4be0=_0x2deab1;return getUser(_0x56d049,_0x277d57[_0x59ba('0xe')],_0x4d4be0);})[_0x59ba('0x28')](function(_0x25a4e9){_0x3f11c9=_0x25a4e9;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x3f11c9['id']);return getEndUser(_0x56d049,_0x16dd53[_0x59ba('0x5d')],_0x16dd53[_0x59ba('0x5e')],_0x4d4be0);})[_0x59ba('0x28')](function(_0x1aa319){_0x16354b=_0x1aa319;logger[_0x59ba('0x24')](_0x59ba('0x5f'),_0x16354b['id']);return getTicket(_0x56d049,_0x3f11c9,_0x16354b,_0x29ffb9,_0x16dd53,_0x29ffb9[_0x59ba('0x60')],_0x4d4be0,'Inbound');})[_0x59ba('0x28')](function(_0x3ecb23){_0x5a1109=_0x3ecb23;logger['info']('Ticket\x20created!');logger[_0x59ba('0x24')](_0x59ba('0x61'),_0x5a1109['id']);return setRelationship(_0x4d4be0,_0x3f11c9,_0x5a1109,_0x59ba('0x62'));})['then'](function(){return setRelationship(_0x4d4be0,_0x16354b,_0x5a1109,_0x59ba('0x63'));})[_0x59ba('0x28')](function(){return getServerInfo(_0x4d4be0);})[_0x59ba('0x28')](function(_0x131dac){var _0x4d7d6e=parseInt(_0x131dac['version'][_0x59ba('0x64')](0x0));var _0x312af6=util[_0x59ba('0x20')](_0x59ba('0x65'),_0x56d049['remoteUri'],_0x5a1109['id']);if(_0x4d7d6e>0x6){_0x312af6=util[_0x59ba('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x56d049[_0x59ba('0x56')],_0x5a1109['id']);}logger[_0x59ba('0x24')](_0x59ba('0x58'),_0x59ba('0x66'));emit(util['format'](_0x59ba('0x67'),_0x277d57['name']),_0x59ba('0x68'),{'uri':_0x312af6});})['catch'](function(_0x528e69){logger[_0x59ba('0x69')](_0x59ba('0x58'),JSON[_0x59ba('0x1f')](_0x528e69));});};exports['outbound']=function(_0x57934b,_0x249645,_0x44f870,_0x5d1866,_0x344f68,_0x59c901,_0x1d54b9){var _0x3fe1ef,_0x429353,_0x5779bd,_0x2e1a2b;_0x59c901[_0x59ba('0x56')]=intUtil[_0x59ba('0x54')](_0x59c901[_0x59ba('0x56')]);_0x59c901[_0x59ba('0x55')]=intUtil['stripTrailingSlash'](_0x59c901[_0x59ba('0x55')]);def[_0x59ba('0x6a')]=util[_0x59ba('0x20')]('%s/service/v4_1/rest.php',_0x59c901[_0x59ba('0x56')]);if(_0x1d54b9&&_0x1d54b9[_0x59ba('0x6b')]&&_0x1d54b9[_0x59ba('0x6b')]!==_0x59ba('0x6c')){logger[_0x59ba('0x24')](_0x59ba('0x6d'),_0x59ba('0x59'));_0x249645[_0x59ba('0x5a')]=util[_0x59ba('0x20')](_0x59ba('0x6e'),_0x59c901[_0x59ba('0x55')],_0x249645[_0x59ba('0x5b')],md5(_0x249645[_0x59ba('0x5b')]));}return getConnection(_0x59c901)[_0x59ba('0x28')](function(_0x17c53c){_0x2e1a2b=_0x17c53c;return getUser(_0x59c901,_0x5d1866[_0x59ba('0xe')],_0x2e1a2b);})['then'](function(_0x3b344e){_0x3fe1ef=_0x3b344e;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x3fe1ef['id']);return getEndUser(_0x59c901,_0x249645[_0x59ba('0x6f')],_0x249645[_0x59ba('0x70')],_0x2e1a2b);})[_0x59ba('0x28')](function(_0x337f4a){_0x429353=_0x337f4a;logger['info'](_0x59ba('0x5f'),_0x429353['id']);return getTicket(_0x59c901,_0x3fe1ef,_0x429353,_0x44f870,_0x249645,_0x44f870[_0x59ba('0x60')],_0x2e1a2b,_0x59ba('0x71'));})['then'](function(_0x241aa5){_0x5779bd=_0x241aa5;logger['info'](_0x59ba('0x72'));logger[_0x59ba('0x24')]('The\x20Ticket\x20ID\x20is:',_0x5779bd['id']);return setRelationship(_0x2e1a2b,_0x3fe1ef,_0x5779bd,_0x59ba('0x62'));})['then'](function(){return setRelationship(_0x2e1a2b,_0x429353,_0x5779bd,_0x59ba('0x63'));})['then'](function(){return getServerInfo(_0x2e1a2b);})['then'](function(_0x2986ab){var _0x3c9a33=parseInt(_0x2986ab['version'][_0x59ba('0x64')](0x0));var _0x178df4=util[_0x59ba('0x20')](_0x59ba('0x65'),_0x59c901[_0x59ba('0x56')],_0x5779bd['id']);if(_0x3c9a33>0x6){_0x178df4=util['format'](_0x59ba('0x73'),_0x59c901[_0x59ba('0x56')],_0x5779bd['id']);}logger[_0x59ba('0x24')](_0x59ba('0x6d'),_0x59ba('0x66'));emit(util[_0x59ba('0x20')](_0x59ba('0x67'),_0x5d1866[_0x59ba('0xe')]),_0x59ba('0x68'),{'uri':_0x178df4});})['catch'](function(_0x37092f){logger['error']('[OUTBOUND]',JSON[_0x59ba('0x1f')](_0x37092f));});};exports[_0x59ba('0x74')]=function(_0x5cff68,_0xa7caca,_0x32db6f,_0x5f2d4a,_0x54e2ba,_0x3bd0d1){var _0x16565f,_0x5099d4,_0x195c4e,_0x469abf;_0x3bd0d1['remoteUri']=intUtil[_0x59ba('0x54')](_0x3bd0d1[_0x59ba('0x56')]);_0x3bd0d1[_0x59ba('0x55')]=intUtil[_0x59ba('0x54')](_0x3bd0d1[_0x59ba('0x55')]);def[_0x59ba('0x6a')]=util['format'](_0x59ba('0x75'),_0x3bd0d1[_0x59ba('0x56')]);if(_0x54e2ba&&_0x54e2ba['monitor_format']){logger[_0x59ba('0x24')]('['+_0xa7caca[_0x59ba('0x76')][_0x59ba('0x77')]()+']',_0x59ba('0x59'));_0xa7caca['recordingURL']=util[_0x59ba('0x20')](_0x59ba('0x6e'),_0x3bd0d1[_0x59ba('0x55')],_0xa7caca[_0x59ba('0x5b')],md5(_0xa7caca[_0x59ba('0x5b')]));}else{_0xa7caca[_0x59ba('0x5a')]='';}return getConnection(_0x3bd0d1)[_0x59ba('0x28')](function(_0x23ac20){_0x469abf=_0x23ac20;if(!_[_0x59ba('0x23')](_0x5f2d4a)){return getUser(_0x3bd0d1,_0x5f2d4a[_0x59ba('0xe')],_0x469abf);}else{return getUser(_0x3bd0d1,null,_0x469abf);}})['then'](function(_0x22653e){_0x16565f=_0x22653e;logger[_0x59ba('0x24')](_0x59ba('0x5c'),_0x16565f['id']);return getEndUser(_0x3bd0d1,_0xa7caca[_0x59ba('0x5d')],_0xa7caca[_0x59ba('0x5e')],_0x469abf);})[_0x59ba('0x28')](function(_0x5fe4c3){_0x5099d4=_0x5fe4c3;logger[_0x59ba('0x24')](_0x59ba('0x5f'),_0x5099d4['id']);return getTicket(_0x3bd0d1,_0x16565f,_0x5099d4,_0x32db6f,_0xa7caca,_0x32db6f[_0x59ba('0x60')],_0x469abf,'Inbound');})[_0x59ba('0x28')](function(_0x4a9df4){_0x195c4e=_0x4a9df4;logger[_0x59ba('0x24')]('Ticket\x20created!');logger[_0x59ba('0x24')](_0x59ba('0x61'),_0x195c4e['id']);return setRelationship(_0x469abf,_0x16565f,_0x195c4e,'users');})[_0x59ba('0x28')](function(){return setRelationship(_0x469abf,_0x5099d4,_0x195c4e,'contacts');})['then'](function(){return getServerInfo(_0x469abf);})[_0x59ba('0x78')](function(_0x1ffaad){logger[_0x59ba('0x69')]('['+_0xa7caca[_0x59ba('0x76')]['toUpperCase']()+']',JSON[_0x59ba('0x1f')](_0x1ffaad));});}; \ 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 ef81d5b..790ebb0 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 _0xb57a=['%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','lodash','util','length','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent'];(function(_0x349ec0,_0x2381ae){var _0x4e5ebb=function(_0x1d4f89){while(--_0x1d4f89){_0x349ec0['push'](_0x349ec0['shift']());}};_0x4e5ebb(++_0x2381ae);}(_0xb57a,0x66));var _0xab57=function(_0x76d397,_0x552a0e){_0x76d397=_0x76d397-0x0;var _0x1497ff=_0xb57a[_0x76d397];return _0x1497ff;};'use strict';var _=require(_0xab57('0x0'));var util=require(_0xab57('0x1'));exports['getString']=function(_0xdf129e,_0x205c6c,_0x3fd8bb){var _0x27a8c6=[];if(_0xdf129e[_0xab57('0x2')]>0x0){var _0x5c6538=_[_0xab57('0x3')](_0xdf129e,['id']);for(var _0x2c4348=0x0;_0x2c4348<_0x5c6538[_0xab57('0x2')];_0x2c4348++){var _0xd63bb2=_0x5c6538[_0x2c4348];if(_0xd63bb2[_0xab57('0x4')]===_0xab57('0x5')){_0x27a8c6[_0xab57('0x6')](_0xd63bb2['content']);}else if(_0xd63bb2[_0xab57('0x4')]===_0xab57('0x7')&&_0xd63bb2[_0xab57('0x8')]){_0x205c6c[_0xd63bb2['variableName']]&&_0x27a8c6[_0xab57('0x6')](_0x205c6c[_0xd63bb2[_0xab57('0x8')]]['toString']());}else if(_0xd63bb2['type']===_0xab57('0x9')&&_0xd63bb2['Variable']&&_0xd63bb2[_0xab57('0xa')][_0xab57('0xb')]){_0x205c6c[_0xd63bb2[_0xab57('0xa')]['name'][_0xab57('0xc')]()]&&_0x27a8c6[_0xab57('0x6')](_0x205c6c[_0xd63bb2['Variable'][_0xab57('0xb')][_0xab57('0xc')]()]['toString']());}else if(_0xd63bb2[_0xab57('0x4')]===_0xab57('0xd')){if(_0xd63bb2[_0xab57('0xe')]==='string'&&_0xd63bb2[_0xab57('0xf')]){_0x27a8c6[_0xab57('0x6')](util[_0xab57('0x10')]('%s:\x20%s',_0xd63bb2[_0xab57('0xf')],_0xd63bb2[_0xab57('0x11')]));}else if(_0xd63bb2[_0xab57('0xe')]===_0xab57('0x7')&&_0xd63bb2[_0xab57('0x8')]&&_0xd63bb2[_0xab57('0xf')]){_0x205c6c[_0xd63bb2[_0xab57('0x8')]]&&_0x27a8c6[_0xab57('0x6')](util[_0xab57('0x10')](_0xab57('0x12'),_0xd63bb2['key'],_0x205c6c[_0xd63bb2[_0xab57('0x8')]]));}else if(_0xd63bb2[_0xab57('0xe')]==='customVariable'&&_0xd63bb2[_0xab57('0xa')]&&_0xd63bb2[_0xab57('0xa')][_0xab57('0xb')]&&_0xd63bb2['key']){_0x205c6c[_0xd63bb2[_0xab57('0xa')]['name'][_0xab57('0xc')]()]&&_0x27a8c6['push'](util[_0xab57('0x10')](_0xab57('0x12'),_0xd63bb2[_0xab57('0xf')],_0x205c6c[_0xd63bb2[_0xab57('0xa')]['name'][_0xab57('0xc')]()]));}}}}return _0x27a8c6[_0xab57('0x13')](_0x3fd8bb);};exports['stripTrailingSlash']=function(_0x3e19a7){var _0x297e76=_0x3e19a7[_0xab57('0x14')](-0x1);if(_0x297e76==='/'){_0x3e19a7=_0x3e19a7[_0xab57('0x15')](0x0,_0x3e19a7[_0xab57('0x16')](_0x297e76));}return _0x3e19a7;};exports[_0xab57('0x17')]=function(_0x4ab6df){if(!_['isNil'](_0x4ab6df)&&_0x4ab6df!==''){var _0x35b5d9=/^(([^<>()\[\]\\.,;:\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 _0x35b5d9['test'](String(_0x4ab6df)[_0xab57('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x720a=['type','string','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','push','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x720a,0x97));var _0xa720=function(_0x30f7d7,_0x298af2){_0x30f7d7=_0x30f7d7-0x0;var _0x5a164a=_0x720a[_0x30f7d7];return _0x5a164a;};'use strict';var _=require(_0xa720('0x0'));var util=require(_0xa720('0x1'));exports[_0xa720('0x2')]=function(_0x29a925,_0x3611f3,_0x5f2f6a){var _0x826b6b=[];if(_0x29a925[_0xa720('0x3')]>0x0){var _0x1f7d22=_[_0xa720('0x4')](_0x29a925,['id']);for(var _0x3a413e=0x0;_0x3a413e<_0x1f7d22['length'];_0x3a413e++){var _0x4a0b78=_0x1f7d22[_0x3a413e];if(_0x4a0b78[_0xa720('0x5')]===_0xa720('0x6')){_0x826b6b['push'](_0x4a0b78['content']);}else if(_0x4a0b78['type']===_0xa720('0x7')&&_0x4a0b78[_0xa720('0x8')]){_0x3611f3[_0x4a0b78[_0xa720('0x8')]]&&_0x826b6b['push'](_0x3611f3[_0x4a0b78[_0xa720('0x8')]][_0xa720('0x9')]());}else if(_0x4a0b78['type']===_0xa720('0xa')&&_0x4a0b78[_0xa720('0xb')]&&_0x4a0b78['Variable'][_0xa720('0xc')]){_0x3611f3[_0x4a0b78[_0xa720('0xb')][_0xa720('0xc')][_0xa720('0xd')]()]&&_0x826b6b['push'](_0x3611f3[_0x4a0b78[_0xa720('0xb')][_0xa720('0xc')][_0xa720('0xd')]()][_0xa720('0x9')]());}else if(_0x4a0b78[_0xa720('0x5')]==='keyValue'){if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0x6')&&_0x4a0b78[_0xa720('0xf')]){_0x826b6b['push'](util[_0xa720('0x10')](_0xa720('0x11'),_0x4a0b78[_0xa720('0xf')],_0x4a0b78['keyContent']));}else if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0x7')&&_0x4a0b78[_0xa720('0x8')]&&_0x4a0b78['key']){_0x3611f3[_0x4a0b78['variableName']]&&_0x826b6b[_0xa720('0x12')](util[_0xa720('0x10')](_0xa720('0x11'),_0x4a0b78['key'],_0x3611f3[_0x4a0b78[_0xa720('0x8')]]));}else if(_0x4a0b78[_0xa720('0xe')]===_0xa720('0xa')&&_0x4a0b78['Variable']&&_0x4a0b78[_0xa720('0xb')]['name']&&_0x4a0b78[_0xa720('0xf')]){_0x3611f3[_0x4a0b78['Variable']['name']['toLowerCase']()]&&_0x826b6b['push'](util['format']('%s:\x20%s',_0x4a0b78[_0xa720('0xf')],_0x3611f3[_0x4a0b78[_0xa720('0xb')]['name'][_0xa720('0xd')]()]));}}}}return _0x826b6b[_0xa720('0x13')](_0x5f2f6a);};exports[_0xa720('0x14')]=function(_0x58489d){var _0x4f05e0=_0x58489d[_0xa720('0x15')](-0x1);if(_0x4f05e0==='/'){_0x58489d=_0x58489d[_0xa720('0x16')](0x0,_0x58489d['lastIndexOf'](_0x4f05e0));}return _0x58489d;};exports[_0xa720('0x17')]=function(_0x18ded0){if(!_[_0xa720('0x18')](_0x18ded0)&&_0x18ded0!==''){var _0x41a365=/^(([^<>()\[\]\\.,;:\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 _0x41a365[_0xa720('0x19')](String(_0x18ded0)[_0xa720('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 1198b20..b26143a 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_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 BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xe706,0xa3));var _0x6e70=function(_0x23bc85,_0x19addc){_0x23bc85=_0x23bc85-0x0;var _0x177dfd=_0xe706[_0x23bc85];return _0x177dfd;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 be4fd55..98dfaa3 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 _0x7ba9=['The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variableName','Variable','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','none','[OUTBOUND]','recordingURL','Authorization','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ba9,0x1bc));var _0x97ba=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x7ba9[_0x3d8240];return _0x3d0372;};'use strict';var _=require('lodash');var rp=require(_0x97ba('0x0'));var md5=require(_0x97ba('0x1'));var util=require(_0x97ba('0x2'));var Redis=require(_0x97ba('0x3'));var intUtil=require(_0x97ba('0x4'));var config=require(_0x97ba('0x5'));var logger=require(_0x97ba('0x6'))(_0x97ba('0x7'));config[_0x97ba('0x8')]=_[_0x97ba('0x9')](config[_0x97ba('0x8')],{'host':_0x97ba('0xa'),'port':0x18eb});var io=require(_0x97ba('0xb'))(new Redis(config[_0x97ba('0x8')]));function emit(_0x204189,_0x3c6282,_0x10519b){io['to'](_0x204189)['emit'](_0x3c6282,_0x10519b);}var headers={'Content-Type':_0x97ba('0xc'),'Accept':_0x97ba('0xc')};function getTicket(_0x1e4026,_0x3c79cd,_0xed7785,_0x2acdd4,_0x1e0db6){logger[_0x97ba('0xd')](_0x97ba('0xe'));return request({'uri':util[_0x97ba('0xf')](_0x97ba('0x10'),_0x1e4026[_0x97ba('0x11')]),'method':_0x97ba('0x12'),'body':{'ticket':_[_0x97ba('0x13')]({'requester_id':_0xed7785['id'],'submitter_id':_0x3c79cd?_0x3c79cd['id']:undefined,'assignee_id':_0x3c79cd?_0x3c79cd['id']:undefined,'tags':getTags(_0x2acdd4[_0x97ba('0x14')],_0x97ba('0x15')),'subject':intUtil[_0x97ba('0x16')](_0x2acdd4['Subjects'],_0x1e0db6,'\x20'),'description':intUtil[_0x97ba('0x16')](_0x2acdd4['Descriptions'],_0x1e0db6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2acdd4[_0x97ba('0x17')],_0x1e0db6,'\x0a')}},getCustomFields(_0x2acdd4[_0x97ba('0x18')],_0x1e0db6))}})[_0x97ba('0x19')](function(_0x492d1d){logger['info']('Ticket\x20created!');return _0x492d1d[_0x97ba('0x1a')];});}function getUser(_0x2f4577,_0x5e53fb){if(intUtil[_0x97ba('0x1b')](_0x5e53fb)){logger[_0x97ba('0xd')](_0x97ba('0x1c'),_0x5e53fb);return request({'uri':util[_0x97ba('0xf')](_0x97ba('0x1d'),_0x2f4577[_0x97ba('0x11')]),'qs':{'query':util[_0x97ba('0xf')]('type:user\x20role:agent\x20email:%s',_0x5e53fb)}})[_0x97ba('0x19')](function(_0x6ac2f8){if(_0x6ac2f8[_0x97ba('0x1e')]){logger[_0x97ba('0xd')](_0x97ba('0x1f'));return _[_0x97ba('0x20')](_0x6ac2f8[_0x97ba('0x21')],{'email':_0x5e53fb,'role':_0x97ba('0x22')});}else{logger[_0x97ba('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x97ba('0xf')](_0x97ba('0x23'),_0x2f4577['remoteUri'])})['then'](function(_0x5766a6){logger[_0x97ba('0xd')]('Admin\x20account\x20selected.');return _0x5766a6[_0x97ba('0x24')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x97ba('0x23'),_0x2f4577[_0x97ba('0x11')])})[_0x97ba('0x19')](function(_0x37df3a){logger[_0x97ba('0xd')](_0x97ba('0x25'));return _0x37df3a[_0x97ba('0x24')];});}}function getEndUser(_0xa07527,_0x35ce9d,_0xe816b6){logger[_0x97ba('0xd')](_0x97ba('0x26'),_0xe816b6);return request({'uri':util['format'](_0x97ba('0x1d'),_0xa07527[_0x97ba('0x11')]),'qs':{'query':util[_0x97ba('0xf')](_0x97ba('0x27'),_0xe816b6)}})['then'](function(_0x43723f){var _0x1d0e68;if(_0x43723f['results'][_0x97ba('0x28')]){_0x43723f[_0x97ba('0x21')]=_[_0x97ba('0x29')](_0x43723f[_0x97ba('0x21')],{'suspended':![],'role':_0x97ba('0x2a')});if(_0x43723f[_0x97ba('0x21')][_0x97ba('0x28')]){_0x1d0e68=_[_0x97ba('0x2b')](_0x43723f['results']);}}if(_0x1d0e68){logger[_0x97ba('0xd')](_0x97ba('0x2c'));return _0x1d0e68;}else{logger[_0x97ba('0xd')](_0x97ba('0x2d'));return request({'uri':util[_0x97ba('0xf')](_0x97ba('0x2e'),_0xa07527['remoteUri']),'method':_0x97ba('0x12'),'body':{'user':{'role':_0x97ba('0x2a'),'name':util['format'](_0x97ba('0x2f'),_0x35ce9d||_0xe816b6),'phone':_0xe816b6}}})[_0x97ba('0x19')](function(_0x3f1544){logger[_0x97ba('0xd')](_0x97ba('0x30'));return _0x3f1544[_0x97ba('0x24')];});}});}function getAuth(_0x11c513){var _0x37530d;if(_0x11c513[_0x97ba('0x31')]===_0x97ba('0x32')){_0x37530d=util[_0x97ba('0xf')](_0x97ba('0x33'),_0x11c513['username'],_0x11c513[_0x97ba('0x32')]);}else if(_0x11c513[_0x97ba('0x31')]===_0x97ba('0x34')){_0x37530d=util[_0x97ba('0xf')]('%s/token:%s',_0x11c513[_0x97ba('0x35')],_0x11c513['token']);}return util[_0x97ba('0xf')](_0x97ba('0x36'),new Buffer(_0x37530d)[_0x97ba('0x37')](_0x97ba('0x38')));}function request(_0x568a2d){logger[_0x97ba('0x39')](_0x97ba('0x3a'),JSON[_0x97ba('0x3b')](_0x568a2d));return rp(_['defaults'](_0x568a2d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1130ef,_0x146027){var _0x46a18f=[];if(_0x1130ef&&_0x1130ef[_0x97ba('0x28')]>0x0){_0x46a18f=_[_0x97ba('0x3c')](_0x1130ef,_0x146027);}return _0x46a18f;}function getCustomFields(_0x3afeaa,_0x45ce06){var _0x5ec818=[];var _0x2e81ee={'custom_fields':[]};if(_0x3afeaa[_0x97ba('0x28')]>0x0){_['forEach'](_0x3afeaa,function(_0x243c4b){if(_[_0x97ba('0x3d')]([_0x97ba('0x3e'),_0x97ba('0x3f')],_0x243c4b[_0x97ba('0x40')])&&_0x243c4b[_0x97ba('0x41')]&&!_0x243c4b['customField']){_0x2e81ee[_0x243c4b[_0x97ba('0x41')][_0x97ba('0x42')]()]=_0x243c4b[_0x97ba('0x43')][_0x97ba('0x37')]();}else if(_[_0x97ba('0x3d')](['string',_0x97ba('0x3f')],_0x243c4b['type'])&&_0x243c4b[_0x97ba('0x44')]&&_0x243c4b[_0x97ba('0x45')]){_0x2e81ee[_0x97ba('0x46')][_0x97ba('0x47')]({'id':_0x243c4b[_0x97ba('0x44')],'value':_0x243c4b[_0x97ba('0x43')][_0x97ba('0x37')]()});}else if(_0x243c4b[_0x97ba('0x40')]==='variable'&&_0x243c4b['variableName']&&_0x243c4b[_0x97ba('0x44')]&&_0x243c4b['customField']){_0x45ce06[_0x243c4b['variableName']]&&_0x2e81ee['custom_fields'][_0x97ba('0x47')]({'id':_0x243c4b[_0x97ba('0x44')],'value':_0x45ce06[_0x243c4b[_0x97ba('0x48')]][_0x97ba('0x37')]()});}else if(_0x243c4b[_0x97ba('0x40')]==='customVariable'&&_0x243c4b[_0x97ba('0x49')]&&_0x243c4b[_0x97ba('0x49')]['name']&&_0x243c4b['idField']&&_0x243c4b[_0x97ba('0x45')]){_0x45ce06[_0x243c4b[_0x97ba('0x49')][_0x97ba('0x15')][_0x97ba('0x42')]()]&&_0x2e81ee[_0x97ba('0x46')][_0x97ba('0x47')]({'id':_0x243c4b['idField'],'value':_0x45ce06[_0x243c4b[_0x97ba('0x49')][_0x97ba('0x15')][_0x97ba('0x42')]()][_0x97ba('0x37')]()});}});}return _0x2e81ee;}exports[_0x97ba('0x4a')]=function(_0x14c79b,_0xeb81d4,_0x5607b8,_0x476ee1,_0x4de0bf,_0x51c001){var _0x1760c8,_0x3181fe;_0x51c001['remoteUri']=intUtil[_0x97ba('0x4b')](_0x51c001['remoteUri']);_0x51c001['serverUrl']=intUtil[_0x97ba('0x4b')](_0x51c001['serverUrl']);if(_0x4de0bf&&_0x4de0bf['monitor_format']){logger[_0x97ba('0xd')](_0x97ba('0x4c'),_0x97ba('0x4d'));_0xeb81d4['recordingURL']=util[_0x97ba('0xf')](_0x97ba('0x4e'),_0x51c001[_0x97ba('0x4f')],_0xeb81d4[_0x97ba('0x50')],md5(_0xeb81d4[_0x97ba('0x50')]));}else{_0xeb81d4['recordingURL']='';}headers['Authorization']=getAuth(_0x51c001);return getUser(_0x51c001,_0x476ee1[_0x97ba('0x51')])[_0x97ba('0x19')](function(_0x31c34e){_0x1760c8=_0x31c34e;logger[_0x97ba('0xd')](_0x97ba('0x52'),_0x1760c8['id']);return getEndUser(_0x51c001,_0xeb81d4[_0x97ba('0x53')],_0xeb81d4[_0x97ba('0x54')]);})[_0x97ba('0x19')](function(_0x598092){_0x3181fe=_0x598092;logger[_0x97ba('0xd')](_0x97ba('0x55'),_0x3181fe['id']);return getTicket(_0x51c001,_0x1760c8,_0x3181fe,_0x5607b8,_0xeb81d4);})[_0x97ba('0x19')](function(_0x2b382a){if(_0x2b382a){logger[_0x97ba('0xd')]('The\x20Ticket\x20ID\x20is:',_0x2b382a['id']);switch(_0x51c001['type']){case _0x97ba('0x56'):logger[_0x97ba('0xd')](_0x97ba('0x4c'),_0x97ba('0x57'));return request({'uri':util[_0x97ba('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x51c001[_0x97ba('0x11')],_0x1760c8['id'],_0x2b382a['id']),'method':_0x97ba('0x12')});case _0x97ba('0x58'):logger[_0x97ba('0xd')](_0x97ba('0x4c'),_0x97ba('0x59'));emit(util[_0x97ba('0xf')](_0x97ba('0x5a'),_0x476ee1[_0x97ba('0x15')]),_0x97ba('0x5b'),{'uri':util[_0x97ba('0xf')](_0x97ba('0x5c'),_0x51c001[_0x97ba('0x11')]['replace']('/api/v2',''),_0x2b382a['id'])});break;default:logger[_0x97ba('0x5d')](_0x97ba('0x4c'),_0x97ba('0x5e'));}}})[_0x97ba('0x5f')](function(_0x40364e){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x97ba('0x60')](_0x40364e,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4ce016,_0x47e4a7,_0x1a210d,_0x4cc13e,_0x30af98,_0x5b0204,_0x9f820){var _0x4770c6,_0x56fc9d;_0x5b0204['remoteUri']=intUtil[_0x97ba('0x4b')](_0x5b0204[_0x97ba('0x11')]);_0x5b0204[_0x97ba('0x4f')]=intUtil[_0x97ba('0x4b')](_0x5b0204['serverUrl']);if(_0x9f820&&_0x9f820['recordingFormat']&&_0x9f820['recordingFormat']!==_0x97ba('0x61')){logger[_0x97ba('0xd')](_0x97ba('0x62'),_0x97ba('0x4d'));_0x47e4a7[_0x97ba('0x63')]=util['format'](_0x97ba('0x4e'),_0x5b0204[_0x97ba('0x4f')],_0x47e4a7[_0x97ba('0x50')],md5(_0x47e4a7[_0x97ba('0x50')]));}headers[_0x97ba('0x64')]=getAuth(_0x5b0204);return getUser(_0x5b0204,_0x4cc13e[_0x97ba('0x51')])[_0x97ba('0x19')](function(_0x29adf6){_0x4770c6=_0x29adf6;logger[_0x97ba('0xd')](_0x97ba('0x52'),_0x4770c6['id']);return getEndUser(_0x5b0204,_0x47e4a7[_0x97ba('0x65')],_0x47e4a7[_0x97ba('0x66')]);})[_0x97ba('0x19')](function(_0x1c8b8e){_0x56fc9d=_0x1c8b8e;logger['info'](_0x97ba('0x55'),_0x56fc9d['id']);return getTicket(_0x5b0204,_0x4770c6,_0x56fc9d,_0x1a210d,_0x47e4a7);})['then'](function(_0x133c22){if(_0x133c22){logger[_0x97ba('0xd')]('The\x20Ticket\x20ID\x20is:',_0x133c22['id']);switch(_0x5b0204[_0x97ba('0x40')]){case _0x97ba('0x56'):logger[_0x97ba('0xd')]('[OUTBOUND]',_0x97ba('0x57'));return request({'uri':util[_0x97ba('0xf')](_0x97ba('0x67'),_0x5b0204[_0x97ba('0x11')],_0x4770c6['id'],_0x133c22['id']),'method':'POST'});case _0x97ba('0x58'):logger[_0x97ba('0xd')](_0x97ba('0x62'),_0x97ba('0x59'));emit(util[_0x97ba('0xf')](_0x97ba('0x5a'),_0x4cc13e['name']),_0x97ba('0x5b'),{'uri':util[_0x97ba('0xf')]('%s/agent/tickets/%s',_0x5b0204[_0x97ba('0x11')]['replace']('/api/v2',''),_0x133c22['id'])});break;default:logger[_0x97ba('0x5d')](_0x97ba('0x62'),_0x97ba('0x5e'));}}})[_0x97ba('0x5f')](function(_0x589f8){logger[_0x97ba('0x5d')](_0x97ba('0x68'),util['inspect'](_0x589f8,{'showHidden':!![],'depth':null}));});};exports[_0x97ba('0x69')]=function(_0x1ca3db,_0x4d9b54,_0x71a120,_0x507baa,_0x54b8c2,_0x48232e){var _0x16f6af,_0x1b6b2a;_0x48232e[_0x97ba('0x11')]=intUtil['stripTrailingSlash'](_0x48232e[_0x97ba('0x11')]);_0x48232e[_0x97ba('0x4f')]=intUtil['stripTrailingSlash'](_0x48232e[_0x97ba('0x4f')]);if(_0x54b8c2&&_0x54b8c2['monitor_format']){logger[_0x97ba('0xd')]('['+_0x4d9b54['lastevent']['toUpperCase']()+']',_0x97ba('0x4d'));_0x4d9b54[_0x97ba('0x63')]=util[_0x97ba('0xf')](_0x97ba('0x4e'),_0x48232e[_0x97ba('0x4f')],_0x4d9b54[_0x97ba('0x50')],md5(_0x4d9b54[_0x97ba('0x50')]));}else{_0x4d9b54[_0x97ba('0x63')]='';}headers[_0x97ba('0x64')]=getAuth(_0x48232e);return getUser(_0x48232e)[_0x97ba('0x19')](function(_0x4db207){_0x16f6af=_0x4db207;logger[_0x97ba('0xd')](_0x97ba('0x52'),_0x16f6af['id']);return getEndUser(_0x48232e,_0x4d9b54[_0x97ba('0x53')],_0x4d9b54['calleridnum']);})[_0x97ba('0x19')](function(_0x5cf948){_0x1b6b2a=_0x5cf948;logger[_0x97ba('0xd')](_0x97ba('0x55'),_0x1b6b2a['id']);return getTicket(_0x48232e,_0x16f6af,_0x1b6b2a,_0x71a120,_0x4d9b54);})[_0x97ba('0x19')](function(_0xc4612f){if(_0xc4612f){logger[_0x97ba('0xd')](_0x97ba('0x6a'),_0xc4612f['id']);}})[_0x97ba('0x5f')](function(_0x2f5adc){logger[_0x97ba('0x5d')]('['+_0x4d9b54[_0x97ba('0x6b')][_0x97ba('0x6c')]()+']'+_0x97ba('0x6d'),util[_0x97ba('0x60')](_0x2f5adc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6878=['The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','uniqueid','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[OUTBOUND]','replace','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','./util','../../../../config/logger','zendesk','redis','defaults','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','info','Ticket\x20created!','validateEmail','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','toString','base64','debug','stringify','GET','forEach','includes','picklist','type','customField','toLowerCase','string','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x4ad7ad,_0x4d202a){var _0x923901=function(_0x32ea52){while(--_0x32ea52){_0x4ad7ad['push'](_0x4ad7ad['shift']());}};_0x923901(++_0x4d202a);}(_0x6878,0x157));var _0x8687=function(_0x585e1a,_0x3f3279){_0x585e1a=_0x585e1a-0x0;var _0x19e94e=_0x6878[_0x585e1a];return _0x19e94e;};'use strict';var _=require(_0x8687('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x8687('0x1'));var Redis=require('ioredis');var intUtil=require(_0x8687('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8687('0x3'))(_0x8687('0x4'));config[_0x8687('0x5')]=_[_0x8687('0x6')](config[_0x8687('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8687('0x5')]));function emit(_0xbf9a87,_0x28da64,_0x327214){io['to'](_0xbf9a87)['emit'](_0x28da64,_0x327214);}var headers={'Content-Type':'application/json','Accept':_0x8687('0x7')};function getTicket(_0x18df74,_0x1fadf9,_0x775bb4,_0x28f2a5,_0xbd51b6){logger['info'](_0x8687('0x8'));return request({'uri':util[_0x8687('0x9')](_0x8687('0xa'),_0x18df74[_0x8687('0xb')]),'method':_0x8687('0xc'),'body':{'ticket':_[_0x8687('0xd')]({'requester_id':_0x775bb4['id'],'submitter_id':_0x1fadf9?_0x1fadf9['id']:undefined,'assignee_id':_0x1fadf9?_0x1fadf9['id']:undefined,'tags':getTags(_0x28f2a5[_0x8687('0xe')],_0x8687('0xf')),'subject':intUtil[_0x8687('0x10')](_0x28f2a5[_0x8687('0x11')],_0xbd51b6,'\x20'),'description':intUtil[_0x8687('0x10')](_0x28f2a5['Descriptions'],_0xbd51b6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x28f2a5['Descriptions'],_0xbd51b6,'\x0a')}},getCustomFields(_0x28f2a5['Fields'],_0xbd51b6))}})['then'](function(_0x1fbc83){logger[_0x8687('0x12')](_0x8687('0x13'));return _0x1fbc83['ticket'];});}function getUser(_0x30f9b0,_0x13e815){if(intUtil[_0x8687('0x14')](_0x13e815)){logger[_0x8687('0x12')]('Getting\x20agent\x20with\x20email',_0x13e815);return request({'uri':util['format']('%s/search.json',_0x30f9b0[_0x8687('0xb')]),'qs':{'query':util[_0x8687('0x9')](_0x8687('0x15'),_0x13e815)}})['then'](function(_0xf6fcfd){if(_0xf6fcfd[_0x8687('0x16')]){logger[_0x8687('0x12')](_0x8687('0x17'));return _[_0x8687('0x18')](_0xf6fcfd[_0x8687('0x19')],{'email':_0x13e815,'role':_0x8687('0x1a')});}else{logger[_0x8687('0x12')](_0x8687('0x1b'));return request({'uri':util[_0x8687('0x9')](_0x8687('0x1c'),_0x30f9b0['remoteUri'])})[_0x8687('0x1d')](function(_0x5a1e3f){logger['info']('Admin\x20account\x20selected.');return _0x5a1e3f['user'];});}});}else{logger[_0x8687('0x12')](_0x8687('0x1b'));return request({'uri':util[_0x8687('0x9')]('%s/users/me.json',_0x30f9b0[_0x8687('0xb')])})[_0x8687('0x1d')](function(_0x15d24e){logger[_0x8687('0x12')](_0x8687('0x1e'));return _0x15d24e[_0x8687('0x1f')];});}}function getEndUser(_0x33bb65,_0x2594e5,_0x231099){logger[_0x8687('0x12')]('Searching\x20enduser\x20with\x20phone',_0x231099);return request({'uri':util[_0x8687('0x9')](_0x8687('0x20'),_0x33bb65[_0x8687('0xb')]),'qs':{'query':util[_0x8687('0x9')](_0x8687('0x21'),_0x231099)}})[_0x8687('0x1d')](function(_0x5eb064){var _0x5c3614;if(_0x5eb064[_0x8687('0x19')][_0x8687('0x22')]){_0x5eb064['results']=_[_0x8687('0x23')](_0x5eb064[_0x8687('0x19')],{'suspended':![],'role':'end-user'});if(_0x5eb064['results'][_0x8687('0x22')]){_0x5c3614=_[_0x8687('0x24')](_0x5eb064['results']);}}if(_0x5c3614){logger[_0x8687('0x12')](_0x8687('0x25'));return _0x5c3614;}else{logger[_0x8687('0x12')](_0x8687('0x26'));return request({'uri':util['format'](_0x8687('0x27'),_0x33bb65['remoteUri']),'method':_0x8687('0xc'),'body':{'user':{'role':'end-user','name':util[_0x8687('0x9')](_0x8687('0x28'),_0x2594e5||_0x231099),'phone':_0x231099}}})[_0x8687('0x1d')](function(_0x1be763){logger['info'](_0x8687('0x29'));return _0x1be763[_0x8687('0x1f')];});}});}function getAuth(_0x3e4561){var _0x325a8f;if(_0x3e4561[_0x8687('0x2a')]===_0x8687('0x2b')){_0x325a8f=util[_0x8687('0x9')]('%s:%s',_0x3e4561['username'],_0x3e4561['password']);}else if(_0x3e4561[_0x8687('0x2a')]==='token'){_0x325a8f=util[_0x8687('0x9')]('%s/token:%s',_0x3e4561[_0x8687('0x2c')],_0x3e4561[_0x8687('0x2d')]);}return util['format']('Basic\x20%s',new Buffer(_0x325a8f)[_0x8687('0x2e')](_0x8687('0x2f')));}function request(_0x24ab78){logger[_0x8687('0x30')]('[HTTP]',JSON[_0x8687('0x31')](_0x24ab78));return rp(_[_0x8687('0x6')](_0x24ab78,{'method':_0x8687('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2a7f8f,_0x3c3b71){var _0x3ad694=[];if(_0x2a7f8f&&_0x2a7f8f[_0x8687('0x22')]>0x0){_0x3ad694=_['map'](_0x2a7f8f,_0x3c3b71);}return _0x3ad694;}function getCustomFields(_0x3337e8,_0x5c0ca6){var _0x5abbe3=[];var _0xb9dbd={'custom_fields':[]};if(_0x3337e8[_0x8687('0x22')]>0x0){_[_0x8687('0x33')](_0x3337e8,function(_0x147678){if(_[_0x8687('0x34')](['string',_0x8687('0x35')],_0x147678[_0x8687('0x36')])&&_0x147678['nameField']&&!_0x147678[_0x8687('0x37')]){_0xb9dbd[_0x147678['nameField'][_0x8687('0x38')]()]=_0x147678['content'][_0x8687('0x2e')]();}else if(_[_0x8687('0x34')]([_0x8687('0x39'),'picklist'],_0x147678['type'])&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0xb9dbd[_0x8687('0x3b')][_0x8687('0x3c')]({'id':_0x147678[_0x8687('0x3a')],'value':_0x147678[_0x8687('0x3d')][_0x8687('0x2e')]()});}else if(_0x147678['type']===_0x8687('0x3e')&&_0x147678[_0x8687('0x3f')]&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0x5c0ca6[_0x147678[_0x8687('0x3f')]]&&_0xb9dbd['custom_fields'][_0x8687('0x3c')]({'id':_0x147678['idField'],'value':_0x5c0ca6[_0x147678[_0x8687('0x3f')]][_0x8687('0x2e')]()});}else if(_0x147678[_0x8687('0x36')]===_0x8687('0x40')&&_0x147678[_0x8687('0x41')]&&_0x147678[_0x8687('0x41')][_0x8687('0xf')]&&_0x147678[_0x8687('0x3a')]&&_0x147678[_0x8687('0x37')]){_0x5c0ca6[_0x147678[_0x8687('0x41')][_0x8687('0xf')][_0x8687('0x38')]()]&&_0xb9dbd[_0x8687('0x3b')]['push']({'id':_0x147678[_0x8687('0x3a')],'value':_0x5c0ca6[_0x147678[_0x8687('0x41')][_0x8687('0xf')][_0x8687('0x38')]()][_0x8687('0x2e')]()});}});}return _0xb9dbd;}exports[_0x8687('0x42')]=function(_0x4c98b2,_0x30d68a,_0x708169,_0x53a535,_0x5d1816,_0x23e02d){var _0x296027,_0x5d555c;_0x23e02d['remoteUri']=intUtil[_0x8687('0x43')](_0x23e02d['remoteUri']);_0x23e02d[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x23e02d['serverUrl']);if(_0x5d1816&&_0x5d1816['monitor_format']){logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x46'));_0x30d68a[_0x8687('0x47')]=util[_0x8687('0x9')](_0x8687('0x48'),_0x23e02d[_0x8687('0x44')],_0x30d68a['uniqueid'],md5(_0x30d68a['uniqueid']));}else{_0x30d68a[_0x8687('0x47')]='';}headers['Authorization']=getAuth(_0x23e02d);return getUser(_0x23e02d,_0x53a535['email'])[_0x8687('0x1d')](function(_0x2cb5ab){_0x296027=_0x2cb5ab;logger['info'](_0x8687('0x49'),_0x296027['id']);return getEndUser(_0x23e02d,_0x30d68a[_0x8687('0x4a')],_0x30d68a[_0x8687('0x4b')]);})[_0x8687('0x1d')](function(_0x3b26b5){_0x5d555c=_0x3b26b5;logger[_0x8687('0x12')]('The\x20Enduser\x20ID\x20is:',_0x5d555c['id']);return getTicket(_0x23e02d,_0x296027,_0x5d555c,_0x708169,_0x30d68a);})[_0x8687('0x1d')](function(_0x336f7a){if(_0x336f7a){logger[_0x8687('0x12')]('The\x20Ticket\x20ID\x20is:',_0x336f7a['id']);switch(_0x23e02d[_0x8687('0x36')]){case'integrationTab':logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x4c'));return request({'uri':util[_0x8687('0x9')](_0x8687('0x4d'),_0x23e02d[_0x8687('0xb')],_0x296027['id'],_0x336f7a['id']),'method':_0x8687('0xc')});case _0x8687('0x4e'):logger[_0x8687('0x12')](_0x8687('0x45'),_0x8687('0x4f'));emit(util[_0x8687('0x9')](_0x8687('0x50'),_0x53a535['name']),_0x8687('0x51'),{'uri':util['format'](_0x8687('0x52'),_0x23e02d['remoteUri']['replace']('/api/v2',''),_0x336f7a['id'])});break;default:logger[_0x8687('0x53')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x8687('0x54')](function(_0x2ce8c4){logger['error'](_0x8687('0x55'),util['inspect'](_0x2ce8c4,{'showHidden':!![],'depth':null}));});};exports[_0x8687('0x56')]=function(_0x17acc7,_0x544b1b,_0x5c29ee,_0xa3c958,_0x12f30a,_0x3611a6,_0x22733e){var _0x179526,_0x4a185c;_0x3611a6[_0x8687('0xb')]=intUtil[_0x8687('0x43')](_0x3611a6[_0x8687('0xb')]);_0x3611a6[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x3611a6[_0x8687('0x44')]);if(_0x22733e&&_0x22733e[_0x8687('0x57')]&&_0x22733e[_0x8687('0x57')]!=='none'){logger[_0x8687('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x544b1b[_0x8687('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3611a6[_0x8687('0x44')],_0x544b1b[_0x8687('0x58')],md5(_0x544b1b['uniqueid']));}headers[_0x8687('0x59')]=getAuth(_0x3611a6);return getUser(_0x3611a6,_0xa3c958['email'])['then'](function(_0x5ac07d){_0x179526=_0x5ac07d;logger['info'](_0x8687('0x49'),_0x179526['id']);return getEndUser(_0x3611a6,_0x544b1b['destcalleridname'],_0x544b1b[_0x8687('0x5a')]);})[_0x8687('0x1d')](function(_0xd0ec75){_0x4a185c=_0xd0ec75;logger['info'](_0x8687('0x5b'),_0x4a185c['id']);return getTicket(_0x3611a6,_0x179526,_0x4a185c,_0x5c29ee,_0x544b1b);})[_0x8687('0x1d')](function(_0x436333){if(_0x436333){logger[_0x8687('0x12')]('The\x20Ticket\x20ID\x20is:',_0x436333['id']);switch(_0x3611a6[_0x8687('0x36')]){case _0x8687('0x5c'):logger[_0x8687('0x12')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8687('0x9')](_0x8687('0x4d'),_0x3611a6[_0x8687('0xb')],_0x179526['id'],_0x436333['id']),'method':_0x8687('0xc')});case _0x8687('0x4e'):logger[_0x8687('0x12')](_0x8687('0x5d'),_0x8687('0x4f'));emit(util[_0x8687('0x9')]('user:%s',_0xa3c958['name']),_0x8687('0x51'),{'uri':util['format'](_0x8687('0x52'),_0x3611a6[_0x8687('0xb')][_0x8687('0x5e')]('/api/v2',''),_0x436333['id'])});break;default:logger[_0x8687('0x53')](_0x8687('0x5d'),_0x8687('0x5f'));}}})['catch'](function(_0x4d635d){logger['error'](_0x8687('0x60'),util[_0x8687('0x61')](_0x4d635d,{'showHidden':!![],'depth':null}));});};exports[_0x8687('0x62')]=function(_0x4bd64f,_0x3a7259,_0x2ea9b5,_0x598192,_0x1e1192,_0x86e685){var _0x2fb096,_0x3e6f1e;_0x86e685['remoteUri']=intUtil[_0x8687('0x43')](_0x86e685['remoteUri']);_0x86e685[_0x8687('0x44')]=intUtil[_0x8687('0x43')](_0x86e685[_0x8687('0x44')]);if(_0x1e1192&&_0x1e1192[_0x8687('0x63')]){logger['info']('['+_0x3a7259[_0x8687('0x64')][_0x8687('0x65')]()+']',_0x8687('0x46'));_0x3a7259['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x86e685[_0x8687('0x44')],_0x3a7259[_0x8687('0x58')],md5(_0x3a7259[_0x8687('0x58')]));}else{_0x3a7259[_0x8687('0x47')]='';}headers[_0x8687('0x59')]=getAuth(_0x86e685);return getUser(_0x86e685)[_0x8687('0x1d')](function(_0x47fdc9){_0x2fb096=_0x47fdc9;logger[_0x8687('0x12')](_0x8687('0x49'),_0x2fb096['id']);return getEndUser(_0x86e685,_0x3a7259[_0x8687('0x4a')],_0x3a7259[_0x8687('0x4b')]);})[_0x8687('0x1d')](function(_0x44c2dc){_0x3e6f1e=_0x44c2dc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3e6f1e['id']);return getTicket(_0x86e685,_0x2fb096,_0x3e6f1e,_0x2ea9b5,_0x3a7259);})[_0x8687('0x1d')](function(_0x35faff){if(_0x35faff){logger[_0x8687('0x12')](_0x8687('0x66'),_0x35faff['id']);}})[_0x8687('0x54')](function(_0x40e73e){logger[_0x8687('0x53')]('['+_0x3a7259['lastevent'][_0x8687('0x65')]()+']'+_0x8687('0x67'),util[_0x8687('0x61')](_0x40e73e,{'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 24c1be3..ee662be 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 _0xa2c7=['stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','data','code','details','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','SUCCESS','log','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','com','destcalleridname','destcalleridnum','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','redis','emit','debug','[HTTP]','length','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','split','isNil','access_token','isBefore','expires_in','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','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x54b53c,_0x2d5b3b){var _0x4f846e=function(_0x16008d){while(--_0x16008d){_0x54b53c['push'](_0x54b53c['shift']());}};_0x4f846e(++_0x2d5b3b);}(_0xa2c7,0x195));var _0x7a2c=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xa2c7[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require(_0x7a2c('0x0'));var rp=require(_0x7a2c('0x1'));var md5=require(_0x7a2c('0x2'));var util=require(_0x7a2c('0x3'));var intUtil=require(_0x7a2c('0x4'));var moment=require(_0x7a2c('0x5'));var Redis=require(_0x7a2c('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x7a2c('0x7'))(_0x7a2c('0x8'));config[_0x7a2c('0x9')]=_['defaults'](config[_0x7a2c('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a2c('0x9')]));function emit(_0x17510a,_0x566031,_0x1610c7){io['to'](_0x17510a)[_0x7a2c('0xa')](_0x566031,_0x1610c7);}function request(_0x21c8c0){logger[_0x7a2c('0xb')](_0x7a2c('0xc'),JSON['stringify'](_0x21c8c0));return rp(_0x21c8c0);}function getCustomFields(_0xfa00c3,_0x11fe7b){var _0x102840={};if(_0xfa00c3[_0x7a2c('0xd')]>0x0){_['forEach'](_0xfa00c3,function(_0x100547){if(_['includes'](['string',_0x7a2c('0xe')],_0x100547[_0x7a2c('0xf')])&&_0x100547[_0x7a2c('0x10')]){_0x102840[_0x100547[_0x7a2c('0x10')]]=_0x100547[_0x7a2c('0x11')]['toString']();}else if(_0x100547[_0x7a2c('0xf')]===_0x7a2c('0x12')&&_0x100547[_0x7a2c('0x13')]&&_0x100547['idField']&&_0x11fe7b[_0x100547[_0x7a2c('0x13')]]){_0x102840[_0x100547['idField']]=_0x11fe7b[_0x100547[_0x7a2c('0x13')]][_0x7a2c('0x14')]();}else if(_0x100547[_0x7a2c('0xf')]===_0x7a2c('0x15')&&_0x100547['Variable']&&_0x100547['Variable']['name']&&_0x100547[_0x7a2c('0x10')]&&_0x11fe7b[_0x100547[_0x7a2c('0x16')][_0x7a2c('0x17')]['toLowerCase']()]){_0x102840[_0x100547['idField']]=_0x11fe7b[_0x100547[_0x7a2c('0x16')][_0x7a2c('0x17')]['toLowerCase']()][_0x7a2c('0x14')]();}});}return _0x102840;}function getName(_0xc66197){if(_0xc66197['indexOf']('\x20')>0x0){var _0x5c384a=_0xc66197[_0x7a2c('0x18')](/ (.+)/);if(_0x5c384a[0x1]){return _0x5c384a;}}return[_0xc66197,_0xc66197];}var accountsTokens={};function getAccessToken(_0x101b74){return new Promise(function(_0xf43d88,_0x340f84){if(!_[_0x7a2c('0x19')](accountsTokens[_0x101b74['id']])&&!_[_0x7a2c('0x19')](accountsTokens[_0x101b74['id']][_0x7a2c('0x1a')])){if(moment()[_0x7a2c('0x1b')](accountsTokens[_0x101b74['id']][_0x7a2c('0x1c')])){_0xf43d88(accountsTokens[_0x101b74['id']][_0x7a2c('0x1a')]);}}var _0x5dad9c;switch(_0x101b74[_0x7a2c('0x1d')]){case'US':_0x5dad9c=_0x7a2c('0x1e');break;case'AU':_0x5dad9c=_0x7a2c('0x1f');break;case'EU':_0x5dad9c='https://accounts.zoho.eu';break;case'IN':_0x5dad9c=_0x7a2c('0x20');break;case'CN':_0x5dad9c=_0x7a2c('0x21');break;default:_0x5dad9c=_0x7a2c('0x22');break;}var _0x2a1c50={'method':_0x7a2c('0x23'),'uri':_0x5dad9c+_0x7a2c('0x24'),'qs':{'refresh_token':_0x101b74[_0x7a2c('0x25')],'client_id':_0x101b74['clientId'],'client_secret':_0x101b74[_0x7a2c('0x26')],'grant_type':_0x7a2c('0x27')},'json':!![]};return rp(_0x2a1c50)[_0x7a2c('0x28')](function(_0x45e1f2){accountsTokens[_0x101b74['id']]={'access_token':_0x45e1f2[_0x7a2c('0x1a')],'expires_in':moment()['add'](_0x45e1f2[_0x7a2c('0x1c')],_0x7a2c('0x29'))};_0xf43d88(_0x45e1f2['access_token']);})[_0x7a2c('0x2a')](function(_0x4af72a){logger[_0x7a2c('0x2b')](_0x7a2c('0x2c'),_0x4af72a[_0x7a2c('0x2d')]);_0x340f84(_0x4af72a);});});}function getUser(_0x1e79f1,_0xe64d98,_0x45bc6b,_0x2cf2c6){logger['info'](_0x7a2c('0x2e'));return request({'method':_0x7a2c('0x2f'),'uri':util[_0x7a2c('0x30')](_0x7a2c('0x31'),_0xe64d98),'qs':{'type':_0x7a2c('0x32')},'headers':{'Authorization':_0x7a2c('0x33')+_0x1e79f1},'json':!![]})[_0x7a2c('0x28')](function(_0x1bb391){if(_0x1bb391[_0x7a2c('0x34')]){var _0x509919=-0x1;if(_['isArrayLikeObject'](_0x1bb391[_0x7a2c('0x34')])){if(!_[_0x7a2c('0x19')](_0x2cf2c6)){_0x509919=_[_0x7a2c('0x35')](_0x1bb391['users'],function(_0x540056){return _0x540056[_0x7a2c('0x36')]===_0x2cf2c6;});}if(_0x509919>=0x0){logger['info'](_0x7a2c('0x37'));}else{logger[_0x7a2c('0x38')](_0x7a2c('0x39'));_0x509919=_[_0x7a2c('0x35')](_0x1bb391[_0x7a2c('0x34')],function(_0x35e21d){return _0x35e21d[_0x7a2c('0x3a')][_0x7a2c('0x17')]===_0x7a2c('0x3b');});}return _0x1bb391[_0x7a2c('0x34')][_0x509919];}else{if(_0x1bb391['user'][_0x7a2c('0x3a')][_0x7a2c('0x17')]===_0x7a2c('0x3b')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1bb391[_0x7a2c('0x3c')];return user;}else{logger[_0x7a2c('0x2b')](_0x7a2c('0x3d'),JSON[_0x7a2c('0x3e')](_0x1bb391));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1bb391));}}}else{logger[_0x7a2c('0x2b')](_0x7a2c('0x3d'),JSON[_0x7a2c('0x3e')](_0x1bb391));throw new Error(_0x7a2c('0x3f')+JSON[_0x7a2c('0x3e')](_0x1bb391));}})[_0x7a2c('0x2a')](function(_0x7e838e){console[_0x7a2c('0x2b')](_0x7e838e);});}function getZohoUser(_0x11c302,_0x16f3bc){return new BPromise(function(_0x589ce5,_0x244083){request(_0x11c302)['then'](function(_0x5e900f){var _0x1015d0=null;if(_0x5e900f){_0x1015d0=_0x5e900f['data'][0x0];_0x1015d0[_0x7a2c('0x40')]=_0x16f3bc;}_0x589ce5(_0x1015d0);})[_0x7a2c('0x2a')](function(_0x4c43b2){_0x244083(_0x4c43b2);});});}function createEndUser(_0x37c2d6,_0x1dc8d9,_0x5e60de,_0x3f9ab3,_0x27ede7,_0x3401f7){var _0x5e60de=getName(_0x5e60de);return request({'method':_0x7a2c('0x23'),'uri':_0x7a2c('0x41')+_0x1dc8d9+_0x7a2c('0x42')+_[_0x7a2c('0x43')](_0x3401f7['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5e60de[0x1],'First_Name':_0x5e60de[0x0],'Phone':_0x3f9ab3,'Owner':{'name':!_[_0x7a2c('0x19')](_0x27ede7[_0x7a2c('0x44')][_0x7a2c('0x17')])?_0x27ede7[_0x7a2c('0x44')][_0x7a2c('0x17')]:!_[_0x7a2c('0x19')](_0x27ede7[_0x7a2c('0x45')])?_0x27ede7[_0x7a2c('0x45')]+'\x20'+_0x27ede7['last_name']:_0x27ede7[_0x7a2c('0x46')],'id':_0x27ede7['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x37c2d6},'json':!![]})[_0x7a2c('0x28')](function(_0x4c5bb){if(_0x4c5bb&&_0x4c5bb[_0x7a2c('0x47')][0x0][_0x7a2c('0x48')]==='SUCCESS'){var _0x32faf0=_0x4c5bb[_0x7a2c('0x47')][0x0][_0x7a2c('0x49')];_0x32faf0[_0x7a2c('0x40')]=_[_0x7a2c('0x43')](_0x3401f7['moduleCreate'])+'s';return _0x32faf0;}logger[_0x7a2c('0x2b')]('The\x20failing\x20result\x20is',JSON[_0x7a2c('0x3e')](data));throw new Error('Error:\x20'+JSON[_0x7a2c('0x3e')](data));})[_0x7a2c('0x2a')](function(_0x4da963){console['log'](_0x7a2c('0x4a'),_0x4da963);});}function getEndUser(_0x124a0d,_0x25bd88,_0x47c85d,_0x2ca8d8,_0x19bd32,_0x5ea780,_0x5e9e88){var _0x41c720={'method':_0x7a2c('0x2f'),'uri':'','headers':{'Authorization':_0x7a2c('0x33')+_0x124a0d},'json':!![]};switch(_0x5e9e88[_0x7a2c('0x4b')]){case'contact_lead':_0x41c720[_0x7a2c('0x4c')]=_0x7a2c('0x41')+_0x25bd88+_0x7a2c('0x4d')+_0x19bd32+'))';return getZohoUser(_0x41c720,_0x7a2c('0x4e'))[_0x7a2c('0x28')](function(_0x285c0e){if(_0x285c0e)return _0x285c0e;_0x41c720['uri']=_0x7a2c('0x41')+_0x25bd88+_0x7a2c('0x4f')+_0x19bd32+'))';return getZohoUser(_0x41c720,_0x7a2c('0x50'))[_0x7a2c('0x28')](function(_0x5ed112){if(_0x5ed112)return _0x5ed112;if(_0x5e9e88[_0x7a2c('0x51')]!=_0x7a2c('0x52')){return createEndUser(_0x124a0d,_0x25bd88,_0x2ca8d8,_0x19bd32,_0x5ea780,_0x5e9e88);}else{return{};}});});break;case _0x7a2c('0x53'):_0x41c720[_0x7a2c('0x4c')]=_0x7a2c('0x41')+_0x25bd88+_0x7a2c('0x4d')+_0x19bd32+'))';return getZohoUser(_0x41c720,_0x7a2c('0x4e'))[_0x7a2c('0x28')](function(_0x18c7bd){if(_0x18c7bd)return _0x18c7bd;if(_0x5e9e88[_0x7a2c('0x51')]!=_0x7a2c('0x52')){return createEndUser(_0x124a0d,_0x25bd88,_0x2ca8d8,_0x19bd32,_0x5ea780,_0x5e9e88);}else{return{};}});break;case'lead':_0x41c720[_0x7a2c('0x4c')]=_0x7a2c('0x41')+_0x25bd88+_0x7a2c('0x4f')+_0x19bd32+'))';return getZohoUser(_0x41c720,_0x7a2c('0x50'))[_0x7a2c('0x28')](function(_0x4fddb6){if(_0x4fddb6)return _0x4fddb6;if(_0x5e9e88[_0x7a2c('0x51')]!=_0x7a2c('0x52')){return createEndUser(_0x124a0d,_0x25bd88,_0x2ca8d8,_0x19bd32,_0x5ea780,_0x5e9e88);}else{return{};}});break;}}function getCall(_0x4638f9,_0x5a2f4f,_0x2b370a,_0x4f6f43,_0x47bc6c,_0x2f128e,_0x2e05c4,_0x9df848){logger[_0x7a2c('0x38')](_0x7a2c('0x54'));var _0x134cc3={};_0x134cc3[_0x7a2c('0x55')]={'name':!_[_0x7a2c('0x19')](_0x4f6f43['role']['name'])&&!_['isNil'](_0x4f6f43[_0x7a2c('0x3a')][_0x7a2c('0x17')])&&_0x4f6f43[_0x7a2c('0x3a')]['name']===_0x7a2c('0x56')?_0x4f6f43[_0x7a2c('0x44')][_0x7a2c('0x17')]:!_[_0x7a2c('0x19')](_0x4f6f43[_0x7a2c('0x45')])?_0x4f6f43[_0x7a2c('0x45')]+'\x20'+_0x4f6f43[_0x7a2c('0x46')]:_0x4f6f43[_0x7a2c('0x46')],'id':_0x4f6f43['id']};_0x134cc3[_0x7a2c('0x57')]=intUtil['getString'](_0x2f128e[_0x7a2c('0x58')],_0x2e05c4,'\x20');_0x134cc3[_0x7a2c('0x59')]=intUtil['getString'](_0x2f128e['Descriptions'],_0x2e05c4,'\x0a');if(_0x47bc6c[_0x7a2c('0x40')]===_0x7a2c('0x4e')){_0x134cc3['Who_Id']={'name':!_[_0x7a2c('0x19')](_0x47bc6c['Full_Name'])?_0x47bc6c['Full_Name']:!_[_0x7a2c('0x19')](_0x47bc6c[_0x7a2c('0x5a')])?_0x47bc6c[_0x7a2c('0x5a')]+'\x20'+_0x47bc6c[_0x7a2c('0x5b')]:_0x47bc6c[_0x7a2c('0x5b')],'id':_0x47bc6c['id']};}if(_0x47bc6c['enduserType']==='Leads'){_0x134cc3[_0x7a2c('0x5c')]={'name':!_[_0x7a2c('0x19')](_0x47bc6c[_0x7a2c('0x5d')])?_0x47bc6c['Full_Name']:!_[_0x7a2c('0x19')](_0x47bc6c['First_Name'])?_0x47bc6c[_0x7a2c('0x5a')]+'\x20'+_0x47bc6c['Last_Name']:_0x47bc6c[_0x7a2c('0x5b')],'id':_0x47bc6c['id']};_0x134cc3[_0x7a2c('0x5e')]=_['startCase'](_0x47bc6c[_0x7a2c('0x40')]);}if(_0x2e05c4[_0x7a2c('0x5f')]){_0x134cc3['Call_Duration']=moment[_0x7a2c('0x60')](parseInt(_0x2e05c4[_0x7a2c('0x5f')])*0x3e8)[_0x7a2c('0x30')](_0x7a2c('0x61'));}else if(_0x2e05c4[_0x7a2c('0x62')]&&_0x2e05c4['endtime']){_0x134cc3[_0x7a2c('0x63')]=moment[_0x7a2c('0x60')](moment(_0x2e05c4['endtime'],_0x7a2c('0x64'))[_0x7a2c('0x65')](moment(_0x2e05c4[_0x7a2c('0x66')],_0x7a2c('0x64'))))['format'](_0x7a2c('0x61'));}switch(_0x2e05c4[_0x7a2c('0x67')]){case _0x7a2c('0x68'):_0x134cc3[_0x7a2c('0x69')]=_0x7a2c('0x6a');break;case _0x7a2c('0x6b'):case _0x7a2c('0x6c'):_0x134cc3[_0x7a2c('0x69')]='Answered';break;case _0x7a2c('0x6d'):_0x134cc3['Call_Result']=_0x7a2c('0x6e');break;case _0x7a2c('0x6f'):_0x134cc3[_0x7a2c('0x69')]=_0x7a2c('0x70');break;case'timeout':_0x134cc3['Call_Result']=_0x7a2c('0x71');default:}_0x134cc3[_0x7a2c('0x72')]=(_0x9df848==='outbound'?moment(_0x2e05c4['starttime'])[_0x7a2c('0x30')](_0x7a2c('0x64')):moment(_0x2e05c4[_0x7a2c('0x73')])[_0x7a2c('0x30')](_0x7a2c('0x64')))||moment()['format'](_0x7a2c('0x64'));_0x134cc3['Call_Type']=_0x9df848||_0x7a2c('0x74');_0x134cc3=_[_0x7a2c('0x75')](_0x134cc3,getCustomFields(_0x2f128e[_0x7a2c('0x76')],_0x2e05c4));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x5a2f4f+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4638f9},'body':{'data':[_0x134cc3]},'json':!![]})['then'](function(_0x290753){if(_0x290753&&_0x290753['data'][0x0][_0x7a2c('0x48')]===_0x7a2c('0x77')){logger[_0x7a2c('0x38')]('Call\x20created!');return{'id':_0x290753[_0x7a2c('0x47')][0x0]['details']['id']};}})['catch'](function(_0x4c8a41){logger[_0x7a2c('0x38')]('err',_0x4c8a41['stack']);console[_0x7a2c('0x78')](_0x7a2c('0x79'),_0x4c8a41);});}exports[_0x7a2c('0x7a')]=function(_0x504704,_0x532185,_0x1553e3,_0x57e0fb,_0x2e2c35,_0x301963){var _0x2c1f68,_0x7c208d,_0x130eeb;_0x301963[_0x7a2c('0x7b')]=intUtil[_0x7a2c('0x7c')](_0x301963['host']);_0x301963[_0x7a2c('0x7d')]=intUtil[_0x7a2c('0x7c')](_0x301963['serverUrl']);if(_0x2e2c35&&_0x2e2c35[_0x7a2c('0x7e')]){logger['info'](_0x7a2c('0x7f'),_0x7a2c('0x80'));_0x532185[_0x7a2c('0x81')]=_0x301963[_0x7a2c('0x7d')]+_0x7a2c('0x82')+_0x532185[_0x7a2c('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x532185[_0x7a2c('0x83')]);}else{_0x532185[_0x7a2c('0x81')]='';}var _0x23ecf7=_0x301963['host']===_0x7a2c('0x84')?'eu':'com';return getAccessToken(_0x301963)[_0x7a2c('0x28')](function(_0x23c003){_0x130eeb=_0x23c003;return getUser(_0x130eeb,_0x23ecf7,_0x301963,_0x57e0fb[_0x7a2c('0x36')]);})[_0x7a2c('0x28')](function(_0x447749){_0x2c1f68=_0x447749;logger[_0x7a2c('0x38')](_0x7a2c('0x85'),_0x2c1f68['id']);return getEndUser(_0x130eeb,_0x23ecf7,_0x301963,_0x532185[_0x7a2c('0x86')],_0x532185[_0x7a2c('0x87')],_0x2c1f68,_0x1553e3);})[_0x7a2c('0x28')](function(_0xfc1bb2){_0x7c208d=_0xfc1bb2;return getCall(_0x130eeb,_0x23ecf7,_0x301963,_0x2c1f68,_0x7c208d,_0x1553e3,_0x532185,_0x7a2c('0x74'));})[_0x7a2c('0x28')](function(_0x3b6837){if(_0x3b6837){logger[_0x7a2c('0x38')](_0x7a2c('0x88'),_0x3b6837['id']);logger[_0x7a2c('0x38')](_0x7a2c('0x7f'),_0x7a2c('0x89'));emit(util[_0x7a2c('0x30')](_0x7a2c('0x8a'),_0x57e0fb[_0x7a2c('0x17')]),_0x7a2c('0x8b'),{'uri':_0x7a2c('0x8c')+_0x301963[_0x7a2c('0x7b')]+_0x7a2c('0x8d')+_0x3b6837['id']});}})[_0x7a2c('0x2a')](function(_0x4c1bb8){logger[_0x7a2c('0x2b')](_0x7a2c('0x7f'),JSON[_0x7a2c('0x3e')](_0x4c1bb8));});};exports[_0x7a2c('0x8e')]=function(_0x8b2e5b,_0x149a42,_0x39554c,_0x496223,_0x2e518b,_0x1d6a59,_0x57dc86){var _0x56c4cf,_0x2f793f,_0x3c03c6;_0x1d6a59[_0x7a2c('0x7b')]=intUtil[_0x7a2c('0x7c')](_0x1d6a59['host']);_0x1d6a59[_0x7a2c('0x7d')]=intUtil[_0x7a2c('0x7c')](_0x1d6a59[_0x7a2c('0x7d')]);if(_0x57dc86&&_0x57dc86[_0x7a2c('0x8f')]&&_0x57dc86['recordingFormat']!=='none'){logger[_0x7a2c('0x38')](_0x7a2c('0x90'),'Recording\x20is\x20enabled!');_0x149a42[_0x7a2c('0x81')]=_0x1d6a59[_0x7a2c('0x7d')]+_0x7a2c('0x82')+_0x149a42['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x149a42[_0x7a2c('0x83')]);}var _0x48dded=_0x1d6a59[_0x7a2c('0x7b')]===_0x7a2c('0x84')?'eu':_0x7a2c('0x91');return getAccessToken(_0x1d6a59)[_0x7a2c('0x28')](function(_0x3eb69b){_0x3c03c6=_0x3eb69b;return getUser(_0x3c03c6,_0x48dded,_0x1d6a59,_0x496223[_0x7a2c('0x36')]);})[_0x7a2c('0x28')](function(_0x5a9cc5){_0x56c4cf=_0x5a9cc5;logger[_0x7a2c('0x38')]('The\x20User\x20ID\x20is:',_0x56c4cf['id']);return getEndUser(_0x3c03c6,_0x48dded,_0x1d6a59,_0x149a42[_0x7a2c('0x92')],_0x149a42[_0x7a2c('0x93')],_0x56c4cf,_0x39554c);})[_0x7a2c('0x28')](function(_0x22847b){_0x2f793f=_0x22847b;return getCall(_0x3c03c6,_0x48dded,_0x1d6a59,_0x56c4cf,_0x2f793f,_0x39554c,_0x149a42,'Outbound');})[_0x7a2c('0x28')](function(_0x53752e){if(_0x53752e){logger[_0x7a2c('0x38')](_0x7a2c('0x88'),_0x53752e['id']);logger[_0x7a2c('0x38')]('[OUTBOUND]',_0x7a2c('0x89'));emit(util['format'](_0x7a2c('0x8a'),_0x496223[_0x7a2c('0x17')]),_0x7a2c('0x8b'),{'uri':_0x7a2c('0x8c')+_0x1d6a59[_0x7a2c('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x53752e['id']});}})['catch'](function(_0x2f1235){logger['error'](_0x7a2c('0x90'),JSON[_0x7a2c('0x3e')](_0x2f1235));});};exports[_0x7a2c('0x94')]=function(_0x22e788,_0x13e8c0,_0x8a14a7,_0x1002f9,_0xbb7bf6,_0x4e0a20){var _0x5e56c2,_0xeb3df5,_0x41f75a;_0x4e0a20[_0x7a2c('0x7b')]=intUtil[_0x7a2c('0x7c')](_0x4e0a20[_0x7a2c('0x7b')]);_0x4e0a20['serverUrl']=intUtil['stripTrailingSlash'](_0x4e0a20[_0x7a2c('0x7d')]);if(_0xbb7bf6&&_0xbb7bf6[_0x7a2c('0x7e')]){logger[_0x7a2c('0x38')]('['+_0x13e8c0['lastevent']['toUpperCase']()+']',_0x7a2c('0x80'));_0x13e8c0[_0x7a2c('0x81')]=_0x4e0a20[_0x7a2c('0x7d')]+_0x7a2c('0x82')+_0x13e8c0[_0x7a2c('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x13e8c0[_0x7a2c('0x83')]);}else{_0x13e8c0['recordingURL']='';}var _0x1604fc=_0x4e0a20[_0x7a2c('0x7b')]===_0x7a2c('0x84')?'eu':'com';return getAccessToken(_0x4e0a20)['then'](function(_0x150093){_0x41f75a=_0x150093;return getUser(_0x41f75a,_0x1604fc,_0x4e0a20);})[_0x7a2c('0x28')](function(_0x32d863){_0x5e56c2=_0x32d863;logger[_0x7a2c('0x38')](_0x7a2c('0x85'),_0x5e56c2['id']);return getEndUser(_0x41f75a,_0x1604fc,_0x4e0a20,_0x13e8c0['calleridname'],_0x13e8c0['calleridnum'],_0x5e56c2,_0x8a14a7);})[_0x7a2c('0x28')](function(_0x1da5d2){_0xeb3df5=_0x1da5d2;return getCall(_0x41f75a,_0x1604fc,_0x4e0a20,_0x5e56c2,_0xeb3df5,_0x8a14a7,_0x13e8c0,_0x7a2c('0x74'));})[_0x7a2c('0x28')](function(_0xde3626){if(_0xde3626){logger[_0x7a2c('0x38')]('The\x20Call\x20ID\x20is:',_0xde3626['id']);}})[_0x7a2c('0x2a')](function(_0x5505bc){logger[_0x7a2c('0x2b')]('['+_0x13e8c0[_0x7a2c('0x67')][_0x7a2c('0x95')]()+']',JSON['stringify'](_0x5505bc));});}; \ No newline at end of file +var _0x82f4=['CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','format','mm:ss','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','calleridname','calleridnum','lastevent','lodash','request-promise','md5','util','./util','moment','bluebird','zoho','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','refresh_token','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log'];(function(_0x953847,_0xa471e4){var _0x35d3a8=function(_0x300212){while(--_0x300212){_0x953847['push'](_0x953847['shift']());}};_0x35d3a8(++_0xa471e4);}(_0x82f4,0xed));var _0x482f=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0x82f4[_0x4d82e1];return _0x5f3bd9;};'use strict';var _=require(_0x482f('0x0'));var rp=require(_0x482f('0x1'));var md5=require(_0x482f('0x2'));var util=require(_0x482f('0x3'));var intUtil=require(_0x482f('0x4'));var moment=require(_0x482f('0x5'));var Redis=require('ioredis');var BPromise=require(_0x482f('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x482f('0x7'));config['redis']=_['defaults'](config[_0x482f('0x8')],{'host':_0x482f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x482f('0x8')]));function emit(_0xd431fc,_0xedc7ad,_0xe842bc){io['to'](_0xd431fc)[_0x482f('0xa')](_0xedc7ad,_0xe842bc);}function request(_0x4b94b8){logger[_0x482f('0xb')](_0x482f('0xc'),JSON[_0x482f('0xd')](_0x4b94b8));return rp(_0x4b94b8);}function getCustomFields(_0xf2eab2,_0x46803e){var _0x3605b6={};if(_0xf2eab2[_0x482f('0xe')]>0x0){_[_0x482f('0xf')](_0xf2eab2,function(_0x7dff9f){if(_[_0x482f('0x10')](['string','picklist'],_0x7dff9f[_0x482f('0x11')])&&_0x7dff9f[_0x482f('0x12')]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x7dff9f[_0x482f('0x13')]['toString']();}else if(_0x7dff9f[_0x482f('0x11')]===_0x482f('0x14')&&_0x7dff9f[_0x482f('0x15')]&&_0x7dff9f[_0x482f('0x12')]&&_0x46803e[_0x7dff9f[_0x482f('0x15')]]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x46803e[_0x7dff9f[_0x482f('0x15')]][_0x482f('0x16')]();}else if(_0x7dff9f[_0x482f('0x11')]==='customVariable'&&_0x7dff9f[_0x482f('0x17')]&&_0x7dff9f[_0x482f('0x17')][_0x482f('0x18')]&&_0x7dff9f['idField']&&_0x46803e[_0x7dff9f[_0x482f('0x17')][_0x482f('0x18')][_0x482f('0x19')]()]){_0x3605b6[_0x7dff9f[_0x482f('0x12')]]=_0x46803e[_0x7dff9f['Variable'][_0x482f('0x18')]['toLowerCase']()][_0x482f('0x16')]();}});}return _0x3605b6;}function getName(_0x5a774d){if(_0x5a774d['indexOf']('\x20')>0x0){var _0xfeb4d7=_0x5a774d[_0x482f('0x1a')](/ (.+)/);if(_0xfeb4d7[0x1]){return _0xfeb4d7;}}return[_0x5a774d,_0x5a774d];}var accountsTokens={};function getAccessToken(_0x4d5366){return new Promise(function(_0x9b65ad,_0x529651){if(!_[_0x482f('0x1b')](accountsTokens[_0x4d5366['id']])&&!_[_0x482f('0x1b')](accountsTokens[_0x4d5366['id']][_0x482f('0x1c')])){if(moment()[_0x482f('0x1d')](accountsTokens[_0x4d5366['id']]['expires_in'])){_0x9b65ad(accountsTokens[_0x4d5366['id']][_0x482f('0x1c')]);}}var _0xb62223;switch(_0x4d5366[_0x482f('0x1e')]){case'US':_0xb62223=_0x482f('0x1f');break;case'AU':_0xb62223=_0x482f('0x20');break;case'EU':_0xb62223=_0x482f('0x21');break;case'IN':_0xb62223=_0x482f('0x22');break;case'CN':_0xb62223='https://accounts.zoho.com.cn';break;default:_0xb62223=_0x482f('0x21');break;}var _0x47092c={'method':_0x482f('0x23'),'uri':_0xb62223+'/oauth/v2/token','qs':{'refresh_token':_0x4d5366[_0x482f('0x24')],'client_id':_0x4d5366['clientId'],'client_secret':_0x4d5366['clientSecret'],'grant_type':_0x482f('0x25')},'json':!![]};return rp(_0x47092c)[_0x482f('0x26')](function(_0x1affa5){accountsTokens[_0x4d5366['id']]={'access_token':_0x1affa5['access_token'],'expires_in':moment()['add'](_0x1affa5[_0x482f('0x27')],_0x482f('0x28'))};_0x9b65ad(_0x1affa5['access_token']);})[_0x482f('0x29')](function(_0x325e34){logger[_0x482f('0x2a')](_0x482f('0x2b'),_0x325e34[_0x482f('0x2c')]);_0x529651(_0x325e34);});});}function getUser(_0x355c04,_0x2c9e3b,_0x95e166,_0x2c1e22){logger['info'](_0x482f('0x2d'));return request({'method':_0x482f('0x2e'),'uri':util['format'](_0x482f('0x2f'),_0x2c9e3b),'qs':{'type':_0x482f('0x30')},'headers':{'Authorization':_0x482f('0x31')+_0x355c04},'json':!![]})[_0x482f('0x26')](function(_0x4cb068){if(_0x4cb068[_0x482f('0x32')]){var _0x4b21cd=-0x1;if(_[_0x482f('0x33')](_0x4cb068['users'])){if(!_[_0x482f('0x1b')](_0x2c1e22)){_0x4b21cd=_['findIndex'](_0x4cb068[_0x482f('0x32')],function(_0x44184d){return _0x44184d['email']===_0x2c1e22;});}if(_0x4b21cd>=0x0){logger[_0x482f('0x34')](_0x482f('0x35'));}else{logger[_0x482f('0x34')](_0x482f('0x36'));_0x4b21cd=_[_0x482f('0x37')](_0x4cb068['users'],function(_0x4ce294){return _0x4ce294[_0x482f('0x38')][_0x482f('0x18')]===_0x482f('0x39');});}return _0x4cb068[_0x482f('0x32')][_0x4b21cd];}else{if(_0x4cb068['user']['profile'][_0x482f('0x18')]===_0x482f('0x39')){logger[_0x482f('0x34')](_0x482f('0x36'));user=_0x4cb068[_0x482f('0x3a')];return user;}else{logger[_0x482f('0x2a')](_0x482f('0x3b'),JSON[_0x482f('0xd')](_0x4cb068));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x482f('0xd')](_0x4cb068));}}}else{logger['error'](_0x482f('0x3b'),JSON['stringify'](_0x4cb068));throw new Error(_0x482f('0x3c')+JSON[_0x482f('0xd')](_0x4cb068));}})[_0x482f('0x29')](function(_0x240335){console[_0x482f('0x2a')](_0x240335);});}function getZohoUser(_0x31451e,_0x36afb5){return new BPromise(function(_0x33c5c4,_0x5d3cda){request(_0x31451e)[_0x482f('0x26')](function(_0x47a06d){var _0x12595e=null;if(_0x47a06d){_0x12595e=_0x47a06d[_0x482f('0x3d')][0x0];_0x12595e['enduserType']=_0x36afb5;}_0x33c5c4(_0x12595e);})[_0x482f('0x29')](function(_0x295e15){_0x5d3cda(_0x295e15);});});}function createEndUser(_0x11bdbe,_0xc51a77,_0x1091f7,_0x548b43,_0x8aa55f,_0x48dcc0){var _0x1091f7=getName(_0x1091f7);return request({'method':_0x482f('0x23'),'uri':_0x482f('0x3e')+_0xc51a77+'/crm/v2/'+_['startCase'](_0x48dcc0[_0x482f('0x3f')])+'s','body':{'data':[{'Last_Name':_0x1091f7[0x1],'First_Name':_0x1091f7[0x0],'Phone':_0x548b43,'Owner':{'name':!_[_0x482f('0x1b')](_0x8aa55f[_0x482f('0x40')][_0x482f('0x18')])?_0x8aa55f[_0x482f('0x40')][_0x482f('0x18')]:!_[_0x482f('0x1b')](_0x8aa55f[_0x482f('0x41')])?_0x8aa55f['first_name']+'\x20'+_0x8aa55f[_0x482f('0x42')]:_0x8aa55f[_0x482f('0x42')],'id':_0x8aa55f['id']}}]},'headers':{'Authorization':_0x482f('0x31')+_0x11bdbe},'json':!![]})['then'](function(_0x2096bb){if(_0x2096bb&&_0x2096bb[_0x482f('0x3d')][0x0][_0x482f('0x43')]===_0x482f('0x44')){var _0x47a502=_0x2096bb[_0x482f('0x3d')][0x0][_0x482f('0x45')];_0x47a502['enduserType']=_[_0x482f('0x46')](_0x48dcc0['moduleCreate'])+'s';return _0x47a502;}logger['error'](_0x482f('0x3b'),JSON[_0x482f('0xd')](data));throw new Error(_0x482f('0x47')+JSON[_0x482f('0xd')](data));})['catch'](function(_0x44d016){console[_0x482f('0x48')](_0x482f('0x49'),_0x44d016);});}function getEndUser(_0x2509f6,_0x39fc82,_0xd93fc2,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22){var _0x3d8de3={'method':'GET','uri':'','headers':{'Authorization':_0x482f('0x31')+_0x2509f6},'json':!![]};switch(_0x95ea22['moduleSearch']){case _0x482f('0x4a'):_0x3d8de3['uri']='https://www.zohoapis.'+_0x39fc82+_0x482f('0x4b')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,'Contacts')['then'](function(_0xb1b477){if(_0xb1b477)return _0xb1b477;_0x3d8de3['uri']=_0x482f('0x3e')+_0x39fc82+_0x482f('0x4c')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x4d'))['then'](function(_0x2ca748){if(_0x2ca748)return _0x2ca748;if(_0x95ea22['moduleCreate']!=_0x482f('0x4e')){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});});break;case _0x482f('0x4f'):_0x3d8de3['uri']=_0x482f('0x3e')+_0x39fc82+_0x482f('0x4b')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x50'))[_0x482f('0x26')](function(_0x23c2fe){if(_0x23c2fe)return _0x23c2fe;if(_0x95ea22[_0x482f('0x3f')]!=_0x482f('0x4e')){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});break;case _0x482f('0x51'):_0x3d8de3['uri']='https://www.zohoapis.'+_0x39fc82+_0x482f('0x4c')+_0xebdbc5+'))';return getZohoUser(_0x3d8de3,_0x482f('0x4d'))[_0x482f('0x26')](function(_0x33b5dc){if(_0x33b5dc)return _0x33b5dc;if(_0x95ea22[_0x482f('0x3f')]!='nothing'){return createEndUser(_0x2509f6,_0x39fc82,_0x23318a,_0xebdbc5,_0x28369b,_0x95ea22);}else{return{};}});break;}}function getCall(_0x663b0b,_0x10551a,_0x1bdb5f,_0x13b1f9,_0x27c5a3,_0x54161a,_0x12c3d1,_0x176013){logger['info'](_0x482f('0x52'));var _0x39ec0d={};_0x39ec0d[_0x482f('0x53')]={'name':!_[_0x482f('0x1b')](_0x13b1f9[_0x482f('0x40')][_0x482f('0x18')])&&!_['isNil'](_0x13b1f9[_0x482f('0x38')][_0x482f('0x18')])&&_0x13b1f9[_0x482f('0x38')]['name']===_0x482f('0x54')?_0x13b1f9[_0x482f('0x40')]['name']:!_[_0x482f('0x1b')](_0x13b1f9[_0x482f('0x41')])?_0x13b1f9[_0x482f('0x41')]+'\x20'+_0x13b1f9[_0x482f('0x42')]:_0x13b1f9[_0x482f('0x42')],'id':_0x13b1f9['id']};_0x39ec0d[_0x482f('0x55')]=intUtil[_0x482f('0x56')](_0x54161a[_0x482f('0x57')],_0x12c3d1,'\x20');_0x39ec0d['Description']=intUtil[_0x482f('0x56')](_0x54161a[_0x482f('0x58')],_0x12c3d1,'\x0a');if(_0x27c5a3[_0x482f('0x59')]==='Contacts'){_0x39ec0d[_0x482f('0x5a')]={'name':!_['isNil'](_0x27c5a3[_0x482f('0x5b')])?_0x27c5a3['Full_Name']:!_[_0x482f('0x1b')](_0x27c5a3['First_Name'])?_0x27c5a3[_0x482f('0x5c')]+'\x20'+_0x27c5a3[_0x482f('0x5d')]:_0x27c5a3[_0x482f('0x5d')],'id':_0x27c5a3['id']};}if(_0x27c5a3['enduserType']===_0x482f('0x4d')){_0x39ec0d['What_Id']={'name':!_[_0x482f('0x1b')](_0x27c5a3[_0x482f('0x5b')])?_0x27c5a3[_0x482f('0x5b')]:!_['isNil'](_0x27c5a3['First_Name'])?_0x27c5a3[_0x482f('0x5c')]+'\x20'+_0x27c5a3[_0x482f('0x5d')]:_0x27c5a3[_0x482f('0x5d')],'id':_0x27c5a3['id']};_0x39ec0d[_0x482f('0x5e')]=_['startCase'](_0x27c5a3[_0x482f('0x59')]);}if(_0x12c3d1[_0x482f('0x5f')]){_0x39ec0d[_0x482f('0x60')]=moment['utc'](parseInt(_0x12c3d1['talktime'])*0x3e8)[_0x482f('0x61')](_0x482f('0x62'));}else if(_0x12c3d1[_0x482f('0x63')]&&_0x12c3d1['endtime']){_0x39ec0d[_0x482f('0x60')]=moment[_0x482f('0x64')](moment(_0x12c3d1[_0x482f('0x65')],_0x482f('0x66'))[_0x482f('0x67')](moment(_0x12c3d1[_0x482f('0x68')],'YYYY-MM-DDTHH:mm:ss')))[_0x482f('0x61')](_0x482f('0x62'));}switch(_0x12c3d1['lastevent']){case'called':_0x39ec0d[_0x482f('0x69')]=_0x482f('0x6a');break;case _0x482f('0x6b'):case _0x482f('0x6c'):_0x39ec0d[_0x482f('0x69')]=_0x482f('0x6d');break;case _0x482f('0x6e'):_0x39ec0d[_0x482f('0x69')]='Rejected';break;case _0x482f('0x6f'):_0x39ec0d['Call_Result']=_0x482f('0x70');break;case _0x482f('0x71'):_0x39ec0d['Call_Result']='Timeout';default:}_0x39ec0d[_0x482f('0x72')]=(_0x176013===_0x482f('0x73')?moment(_0x12c3d1[_0x482f('0x68')])['format'](_0x482f('0x66')):moment(_0x12c3d1[_0x482f('0x74')])[_0x482f('0x61')](_0x482f('0x66')))||moment()[_0x482f('0x61')](_0x482f('0x66'));_0x39ec0d[_0x482f('0x75')]=_0x176013||_0x482f('0x76');_0x39ec0d=_[_0x482f('0x77')](_0x39ec0d,getCustomFields(_0x54161a[_0x482f('0x78')],_0x12c3d1));return request({'method':_0x482f('0x23'),'uri':_0x482f('0x3e')+_0x10551a+_0x482f('0x79'),'headers':{'Authorization':_0x482f('0x31')+_0x663b0b},'body':{'data':[_0x39ec0d]},'json':!![]})[_0x482f('0x26')](function(_0x360257){if(_0x360257&&_0x360257['data'][0x0][_0x482f('0x43')]===_0x482f('0x44')){logger['info'](_0x482f('0x7a'));return{'id':_0x360257[_0x482f('0x3d')][0x0][_0x482f('0x45')]['id']};}})[_0x482f('0x29')](function(_0x330501){logger[_0x482f('0x34')]('err',_0x330501[_0x482f('0x2c')]);console['log'](_0x482f('0x7b'),_0x330501);});}exports['queue']=function(_0x7aedef,_0x2e886e,_0x7d91b2,_0x378791,_0x1c9a1c,_0x55f67b){var _0x547b8d,_0x1878ac,_0x419ff7;_0x55f67b[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x55f67b[_0x482f('0x7c')]);_0x55f67b[_0x482f('0x7e')]=intUtil[_0x482f('0x7d')](_0x55f67b[_0x482f('0x7e')]);if(_0x1c9a1c&&_0x1c9a1c['monitor_format']){logger['info'](_0x482f('0x7f'),_0x482f('0x80'));_0x2e886e[_0x482f('0x81')]=_0x55f67b['serverUrl']+_0x482f('0x82')+_0x2e886e[_0x482f('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x2e886e[_0x482f('0x83')]);}else{_0x2e886e['recordingURL']='';}var _0x4d6993=_0x55f67b[_0x482f('0x7c')]===_0x482f('0x84')?'eu':_0x482f('0x85');return getAccessToken(_0x55f67b)['then'](function(_0x355664){_0x419ff7=_0x355664;return getUser(_0x419ff7,_0x4d6993,_0x55f67b,_0x378791[_0x482f('0x86')]);})[_0x482f('0x26')](function(_0x153fc9){_0x547b8d=_0x153fc9;logger[_0x482f('0x34')](_0x482f('0x87'),_0x547b8d['id']);return getEndUser(_0x419ff7,_0x4d6993,_0x55f67b,_0x2e886e['calleridname'],_0x2e886e['calleridnum'],_0x547b8d,_0x7d91b2);})[_0x482f('0x26')](function(_0x21c472){_0x1878ac=_0x21c472;return getCall(_0x419ff7,_0x4d6993,_0x55f67b,_0x547b8d,_0x1878ac,_0x7d91b2,_0x2e886e,_0x482f('0x76'));})['then'](function(_0xa7a360){if(_0xa7a360){logger[_0x482f('0x34')]('The\x20Call\x20ID\x20is:',_0xa7a360['id']);logger[_0x482f('0x34')](_0x482f('0x7f'),_0x482f('0x88'));emit(util[_0x482f('0x61')](_0x482f('0x89'),_0x378791[_0x482f('0x18')]),_0x482f('0x8a'),{'uri':_0x482f('0x8b')+_0x55f67b[_0x482f('0x7c')]+_0x482f('0x8c')+_0xa7a360['id']});}})[_0x482f('0x29')](function(_0x44e008){logger[_0x482f('0x2a')](_0x482f('0x7f'),JSON[_0x482f('0xd')](_0x44e008));});};exports[_0x482f('0x73')]=function(_0x256566,_0x9f33fe,_0x3f76dd,_0x5a2a82,_0x1ec748,_0x363a71,_0x5d7dc6){var _0x3d6d24,_0x510c98,_0xf1af77;_0x363a71[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x363a71[_0x482f('0x7c')]);_0x363a71[_0x482f('0x7e')]=intUtil['stripTrailingSlash'](_0x363a71[_0x482f('0x7e')]);if(_0x5d7dc6&&_0x5d7dc6[_0x482f('0x8d')]&&_0x5d7dc6['recordingFormat']!==_0x482f('0x8e')){logger[_0x482f('0x34')]('[OUTBOUND]',_0x482f('0x80'));_0x9f33fe[_0x482f('0x81')]=_0x363a71['serverUrl']+'/api/voice/recordings/'+_0x9f33fe[_0x482f('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x9f33fe[_0x482f('0x83')]);}var _0x1f7dbe=_0x363a71[_0x482f('0x7c')]===_0x482f('0x84')?'eu':'com';return getAccessToken(_0x363a71)[_0x482f('0x26')](function(_0x244388){_0xf1af77=_0x244388;return getUser(_0xf1af77,_0x1f7dbe,_0x363a71,_0x5a2a82[_0x482f('0x86')]);})[_0x482f('0x26')](function(_0x10d5b6){_0x3d6d24=_0x10d5b6;logger['info'](_0x482f('0x87'),_0x3d6d24['id']);return getEndUser(_0xf1af77,_0x1f7dbe,_0x363a71,_0x9f33fe[_0x482f('0x8f')],_0x9f33fe[_0x482f('0x90')],_0x3d6d24,_0x3f76dd);})['then'](function(_0x2aea20){_0x510c98=_0x2aea20;return getCall(_0xf1af77,_0x1f7dbe,_0x363a71,_0x3d6d24,_0x510c98,_0x3f76dd,_0x9f33fe,_0x482f('0x91'));})[_0x482f('0x26')](function(_0x1d0fb3){if(_0x1d0fb3){logger[_0x482f('0x34')](_0x482f('0x92'),_0x1d0fb3['id']);logger['info'](_0x482f('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x482f('0x61')]('user:%s',_0x5a2a82[_0x482f('0x18')]),'trigger:browser:url',{'uri':_0x482f('0x8b')+_0x363a71[_0x482f('0x7c')]+_0x482f('0x8c')+_0x1d0fb3['id']});}})['catch'](function(_0x4c8540){logger['error'](_0x482f('0x93'),JSON[_0x482f('0xd')](_0x4c8540));});};exports[_0x482f('0x94')]=function(_0x403302,_0xf413df,_0x4ffbaa,_0x324810,_0x333461,_0x3e9b2b){var _0x336770,_0xea94db,_0x3fa3cd;_0x3e9b2b[_0x482f('0x7c')]=intUtil[_0x482f('0x7d')](_0x3e9b2b['host']);_0x3e9b2b[_0x482f('0x7e')]=intUtil[_0x482f('0x7d')](_0x3e9b2b[_0x482f('0x7e')]);if(_0x333461&&_0x333461[_0x482f('0x95')]){logger[_0x482f('0x34')]('['+_0xf413df['lastevent'][_0x482f('0x96')]()+']','Recording\x20is\x20enabled!');_0xf413df['recordingURL']=_0x3e9b2b[_0x482f('0x7e')]+_0x482f('0x82')+_0xf413df['uniqueid']+_0x482f('0x97')+md5(_0xf413df[_0x482f('0x83')]);}else{_0xf413df[_0x482f('0x81')]='';}var _0x5334eb=_0x3e9b2b[_0x482f('0x7c')]===_0x482f('0x84')?'eu':_0x482f('0x85');return getAccessToken(_0x3e9b2b)[_0x482f('0x26')](function(_0x23dbd7){_0x3fa3cd=_0x23dbd7;return getUser(_0x3fa3cd,_0x5334eb,_0x3e9b2b);})['then'](function(_0x526f5d){_0x336770=_0x526f5d;logger[_0x482f('0x34')]('The\x20User\x20ID\x20is:',_0x336770['id']);return getEndUser(_0x3fa3cd,_0x5334eb,_0x3e9b2b,_0xf413df[_0x482f('0x98')],_0xf413df[_0x482f('0x99')],_0x336770,_0x4ffbaa);})[_0x482f('0x26')](function(_0x3bb48e){_0xea94db=_0x3bb48e;return getCall(_0x3fa3cd,_0x5334eb,_0x3e9b2b,_0x336770,_0xea94db,_0x4ffbaa,_0xf413df,'Inbound');})[_0x482f('0x26')](function(_0x3d3583){if(_0x3d3583){logger[_0x482f('0x34')](_0x482f('0x92'),_0x3d3583['id']);}})[_0x482f('0x29')](function(_0x23b89c){logger[_0x482f('0x2a')]('['+_0xf413df[_0x482f('0x9a')]['toUpperCase']()+']',JSON[_0x482f('0xd')](_0x23b89c));});}; \ 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 2f73af6..ef8bb73 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 _0x0845=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x3b2f12,_0x1e7128){var _0x36a818=function(_0x5cca31){while(--_0x5cca31){_0x3b2f12['push'](_0x3b2f12['shift']());}};_0x36a818(++_0x1e7128);}(_0x0845,0x69));var _0x5084=function(_0x5495c0,_0x3197bd){_0x5495c0=_0x5495c0-0x0;var _0x4f8ab6=_0x0845[_0x5495c0];return _0x4f8ab6;};'use strict';var util=require(_0x5084('0x0'));var sh=require('shelljs');var Mustache=require(_0x5084('0x1'));var logger=require(_0x5084('0x2'))(_0x5084('0x3'));exports['exec']=function(_0x514638,_0x4a4099){var _0x401291=_0x514638[_0x5084('0x4')]?_0x514638[_0x5084('0x4')]:_0x5084('0x5');var _0x21742b=_0x514638[_0x5084('0x6')]?Mustache[_0x5084('0x7')](_0x514638[_0x5084('0x6')],_0x4a4099):_0x4a4099;sh[_0x5084('0x8')](_0x21742b,function(_0x194604,_0x28d488,_0x2167b8){if(_0x194604!==0x0){logger[_0x5084('0x9')](util['format'](_0x5084('0xa'),_0x401291,_0x21742b,_0x194604,_0x2167b8));}else{logger[_0x5084('0xb')](util['format'](_0x5084('0xc'),_0x401291,_0x21742b,_0x28d488));}});}; \ No newline at end of file +var _0x0db2=['exec','data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','trigger'];(function(_0x2d184a,_0x469cdf){var _0x5dfb30=function(_0x3a9a9a){while(--_0x3a9a9a){_0x2d184a['push'](_0x2d184a['shift']());}};_0x5dfb30(++_0x469cdf);}(_0x0db2,0x14b));var _0x20db=function(_0x173bb4,_0x103283){_0x173bb4=_0x173bb4-0x0;var _0xaa79c8=_0x0db2[_0x173bb4];return _0xaa79c8;};'use strict';var util=require(_0x20db('0x0'));var sh=require(_0x20db('0x1'));var Mustache=require(_0x20db('0x2'));var logger=require(_0x20db('0x3'))(_0x20db('0x4'));exports[_0x20db('0x5')]=function(_0x4bcb16,_0x58595a){var _0x1d4cce=_0x4bcb16[_0x20db('0x6')]?_0x4bcb16['data2']:_0x20db('0x7');var _0x135b5a=_0x4bcb16[_0x20db('0x8')]?Mustache['render'](_0x4bcb16[_0x20db('0x8')],_0x58595a):_0x58595a;sh[_0x20db('0x5')](_0x135b5a,function(_0x2e2bac,_0x5bae3c,_0x5c20a4){if(_0x2e2bac!==0x0){logger['error'](util[_0x20db('0x9')](_0x20db('0xa'),_0x1d4cce,_0x135b5a,_0x2e2bac,_0x5c20a4));}else{logger[_0x20db('0xb')](util[_0x20db('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1d4cce,_0x135b5a,_0x5bae3c));}});}; \ 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 9a24e4c..e8c5c68 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 _0x1a26=['data5','number','headers','data6','parse','render','stack','data1','GET','POST','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','format','%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','mustache','../../../../config/logger','trigger','exec','toUpperCase','data2'];(function(_0x486383,_0x5e4fe9){var _0x586086=function(_0x736ec4){while(--_0x736ec4){_0x486383['push'](_0x486383['shift']());}};_0x586086(++_0x5e4fe9);}(_0x1a26,0xa3));var _0x61a2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1a26[_0x263a74];return _0x2aa86c;};'use strict';var rp=require(_0x61a2('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x61a2('0x1'));var logger=require(_0x61a2('0x2'))(_0x61a2('0x3'));exports[_0x61a2('0x4')]=function(_0x75105a,_0x2808d7){var _0x538bfa,_0x3e036f;var _0x353131={'method':_0x75105a['data1'][_0x61a2('0x5')](),'uri':Mustache['render'](_0x75105a[_0x61a2('0x6')],_0x2808d7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x75105a[_0x61a2('0x7')])===_0x61a2('0x8')&&parseInt(_0x75105a[_0x61a2('0x7')])>=0x1&&parseInt(_0x75105a['data5'])<=0xa?parseInt(_0x75105a['data5'])*0x3e8:0x5*0x3e8};try{_0x353131[_0x61a2('0x9')]=_0x75105a[_0x61a2('0xa')]?JSON[_0x61a2('0xb')](Mustache[_0x61a2('0xc')](_0x75105a['data6'],_0x2808d7)):{};}catch(_0x4f39fe){logger['error'](_0x4f39fe[_0x61a2('0xd')]);}switch(_0x75105a[_0x61a2('0xe')][_0x61a2('0x5')]()){case _0x61a2('0xf'):case'DELETE':_0x538bfa=null;_0x353131['qs']=_0x2808d7;break;case _0x61a2('0x10'):case _0x61a2('0x11'):if(_0x75105a[_0x61a2('0x12')]){try{_0x538bfa=JSON['parse'](Mustache[_0x61a2('0xc')](_0x75105a[_0x61a2('0x12')],_0x2808d7));_0x353131['body']=_0x538bfa;}catch(_0x5b3b30){logger[_0x61a2('0x13')](_0x5b3b30['stack']);logger[_0x61a2('0x13')](_0x61a2('0x14'));}}else{_0x538bfa=_0x2808d7;_0x353131[_0x61a2('0x15')]=_0x538bfa;}break;}logger[_0x61a2('0x16')](util['format'](_0x61a2('0x17'),_0x75105a[_0x61a2('0xe')],_0x75105a[_0x61a2('0x6')],JSON[_0x61a2('0x18')](_0x353131)));rp(_0x353131)[_0x61a2('0x19')](function(_0x25efdb){_0x538bfa=!_[_0x61a2('0x1a')](_0x538bfa)?',\x20request\x20body:\x20'+_0x538bfa:'';_0x3e036f=typeof _0x25efdb[_0x61a2('0x15')]==='object'?JSON[_0x61a2('0x18')](_0x25efdb[_0x61a2('0x15')]):_0x25efdb[_0x61a2('0x15')];logger[_0x61a2('0x16')](util[_0x61a2('0x1b')](_0x61a2('0x1c'),_0x75105a[_0x61a2('0xe')],_0x75105a['data2'],_0x25efdb[_0x61a2('0x1d')],_0x3e036f));})[_0x61a2('0x1e')](function(_0x5db4da){logger[_0x61a2('0x13')](util[_0x61a2('0x1b')](_0x61a2('0x1f'),_0x75105a[_0x61a2('0xe')],_0x75105a['data2'],_0x5db4da['statusCode'],_0x5db4da[_0x61a2('0x20')],_0x5db4da[_0x61a2('0x21')]));});}; \ No newline at end of file +var _0x5da2=['parse','error','stack','toUpperCase','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','trigger','exec','data1','render','data2','data5','number','headers','data6'];(function(_0x499ca2,_0x1d697b){var _0x1259c0=function(_0x3de932){while(--_0x3de932){_0x499ca2['push'](_0x499ca2['shift']());}};_0x1259c0(++_0x1d697b);}(_0x5da2,0xc7));var _0x25da=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x5da2[_0x4a747d];return _0x3a5b5c;};'use strict';var rp=require(_0x25da('0x0'));var util=require('util');var _=require(_0x25da('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x25da('0x2'));exports[_0x25da('0x3')]=function(_0x3895cc,_0x792269){var _0x7f0d90,_0x4088a0;var _0x38c8ad={'method':_0x3895cc[_0x25da('0x4')]['toUpperCase'](),'uri':Mustache[_0x25da('0x5')](_0x3895cc[_0x25da('0x6')],_0x792269),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3895cc[_0x25da('0x7')])===_0x25da('0x8')&&parseInt(_0x3895cc[_0x25da('0x7')])>=0x1&&parseInt(_0x3895cc[_0x25da('0x7')])<=0xa?parseInt(_0x3895cc[_0x25da('0x7')])*0x3e8:0x5*0x3e8};try{_0x38c8ad[_0x25da('0x9')]=_0x3895cc[_0x25da('0xa')]?JSON[_0x25da('0xb')](Mustache[_0x25da('0x5')](_0x3895cc[_0x25da('0xa')],_0x792269)):{};}catch(_0x3525f4){logger[_0x25da('0xc')](_0x3525f4[_0x25da('0xd')]);}switch(_0x3895cc[_0x25da('0x4')][_0x25da('0xe')]()){case'GET':case _0x25da('0xf'):_0x7f0d90=null;_0x38c8ad['qs']=_0x792269;break;case'POST':case _0x25da('0x10'):if(_0x3895cc[_0x25da('0x11')]){try{_0x7f0d90=JSON[_0x25da('0xb')](Mustache['render'](_0x3895cc[_0x25da('0x11')],_0x792269));_0x38c8ad[_0x25da('0x12')]=_0x7f0d90;}catch(_0x43d7f8){logger['error'](_0x43d7f8['stack']);logger[_0x25da('0xc')](_0x25da('0x13'));}}else{_0x7f0d90=_0x792269;_0x38c8ad[_0x25da('0x12')]=_0x7f0d90;}break;}logger['info'](util[_0x25da('0x14')](_0x25da('0x15'),_0x3895cc[_0x25da('0x4')],_0x3895cc[_0x25da('0x6')],JSON[_0x25da('0x16')](_0x38c8ad)));rp(_0x38c8ad)['then'](function(_0x914c79){_0x7f0d90=!_['isNil'](_0x7f0d90)?_0x25da('0x17')+_0x7f0d90:'';_0x4088a0=typeof _0x914c79[_0x25da('0x12')]===_0x25da('0x18')?JSON['stringify'](_0x914c79['body']):_0x914c79[_0x25da('0x12')];logger[_0x25da('0x19')](util[_0x25da('0x14')](_0x25da('0x1a'),_0x3895cc['data1'],_0x3895cc['data2'],_0x914c79[_0x25da('0x1b')],_0x4088a0));})[_0x25da('0x1c')](function(_0x25a1dc){logger[_0x25da('0xc')](util[_0x25da('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3895cc[_0x25da('0x4')],_0x3895cc[_0x25da('0x6')],_0x25a1dc['statusCode'],_0x25a1dc[_0x25da('0x1d')],_0x25a1dc['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7a0dab4..9bebdd5 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 _0x7d12=['message','result','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','routing','error'];(function(_0x23f5b6,_0x2c145d){var _0x37f8d5=function(_0x359d21){while(--_0x359d21){_0x23f5b6['push'](_0x23f5b6['shift']());}};_0x37f8d5(++_0x2c145d);}(_0x7d12,0x1f2));var _0x27d1=function(_0x118bc3,_0x5ea08a){_0x118bc3=_0x118bc3-0x0;var _0x35d7f3=_0x7d12[_0x118bc3];return _0x35d7f3;};'use strict';var jayson=require(_0x27d1('0x0'));var BPromise=require(_0x27d1('0x1'));var logger=require(_0x27d1('0x2'))('routing');var client=jayson[_0x27d1('0x3')][_0x27d1('0x4')]({'port':0x2329});client[_0x27d1('0x5')]=function(_0x2115af,_0x187782){return new BPromise(function(_0x10fd7e,_0xee3941){return client[_0x27d1('0x6')](_0x2115af,_0x187782)[_0x27d1('0x7')](function(_0x3edba6){logger[_0x27d1('0x8')](_0x27d1('0x9'),_0x27d1('0xa'),_0x2115af,_0x187782,_0x3edba6);if(_0x3edba6[_0x27d1('0xb')]){logger[_0x27d1('0xb')](_0x27d1('0x9'),_0x27d1('0xa'),_0x2115af,_0x3edba6[_0x27d1('0xb')]['message'],_0x187782);return _0xee3941(_0x3edba6[_0x27d1('0xb')][_0x27d1('0xc')]);}else{return _0x10fd7e(_0x3edba6[_0x27d1('0xd')]);}})['catch'](function(_0x577673){logger[_0x27d1('0xb')](_0x27d1('0x9'),'routing',_0x2115af,_0x577673,_0x187782);return _0xee3941(_0x577673);});});};module[_0x27d1('0xe')]=client; \ No newline at end of file +var _0xd7c0=['exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch'];(function(_0x49eec1,_0x47d9a4){var _0x3b19f8=function(_0x502394){while(--_0x502394){_0x49eec1['push'](_0x49eec1['shift']());}};_0x3b19f8(++_0x47d9a4);}(_0xd7c0,0xfd));var _0x0d7c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd7c0[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0x0d7c('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x0d7c('0x1'));var client=jayson[_0x0d7c('0x2')][_0x0d7c('0x3')]({'port':0x2329});client[_0x0d7c('0x4')]=function(_0x223b05,_0xb4810d){return new BPromise(function(_0x4d8098,_0x549a7a){return client[_0x0d7c('0x5')](_0x223b05,_0xb4810d)[_0x0d7c('0x6')](function(_0xdffdbf){logger[_0x0d7c('0x7')](_0x0d7c('0x8'),'routing',_0x223b05,_0xb4810d,_0xdffdbf);if(_0xdffdbf[_0x0d7c('0x9')]){logger[_0x0d7c('0x9')]('rpc','routing',_0x223b05,_0xdffdbf[_0x0d7c('0x9')][_0x0d7c('0xa')],_0xb4810d);return _0x549a7a(_0xdffdbf['error']['message']);}else{return _0x4d8098(_0xdffdbf[_0x0d7c('0xb')]);}})[_0x0d7c('0xc')](function(_0x38b3ef){logger[_0x0d7c('0x9')]('rpc',_0x0d7c('0x1'),_0x223b05,_0x38b3ef,_0xb4810d);return _0x549a7a(_0x38b3ef);});});};module[_0x0d7c('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f617cdc..6d7d8ff 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 _0x5792=['./rpc/mailAccount','./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','./server','./realtime','./lib/email'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x5792,0x14d));var _0x2579=function(_0x33228f,_0x153773){_0x33228f=_0x33228f-0x0;var _0x27369d=_0x5792[_0x33228f];return _0x27369d;};'use strict';var server=require(_0x2579('0x0'));var Realtime=require(_0x2579('0x1'));var EmailChannel=require(_0x2579('0x2'));var mailAccount=require(_0x2579('0x3'));var setting=require(_0x2579('0x4'));var logger=require('../../config/logger')(_0x2579('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2579('0x6')]()[_0x2579('0x7')](mailAccount[_0x2579('0x8')]())[_0x2579('0x7')](realtime[_0x2579('0x9')]())[_0x2579('0x7')](function(){email[_0x2579('0xa')](realtime[_0x2579('0xb')]);return realtime;});}function main(){return server[_0x2579('0xc')](realtime,email)[_0x2579('0x7')](function(){return initRealtime();})[_0x2579('0x7')](function(){return setting[_0x2579('0xd')]();})[_0x2579('0x7')](function(_0x101ebc){return setInterval(initRealtime,_0x101ebc[_0x2579('0xe')]*0x3e8);})['catch'](function(_0xf774ae){logger[_0x2579('0xf')]('Email\x20service\x20initialization',_0xf774ae);});}main(); \ No newline at end of file +var _0x2eac=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x20396d,_0x4b1f7b){var _0x20baa5=function(_0x44650e){while(--_0x44650e){_0x20396d['push'](_0x20396d['shift']());}};_0x20baa5(++_0x4b1f7b);}(_0x2eac,0xe9));var _0xc2ea=function(_0x298714,_0x25f06a){_0x298714=_0x298714-0x0;var _0x3fa1aa=_0x2eac[_0x298714];return _0x3fa1aa;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xc2ea('0x0'));var mailAccount=require(_0xc2ea('0x1'));var setting=require(_0xc2ea('0x2'));var logger=require(_0xc2ea('0x3'))(_0xc2ea('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xc2ea('0x5')](mailAccount[_0xc2ea('0x6')]())[_0xc2ea('0x5')](realtime[_0xc2ea('0x7')]())[_0xc2ea('0x5')](function(){email[_0xc2ea('0x8')](realtime[_0xc2ea('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc2ea('0x5')](function(){return initRealtime();})[_0xc2ea('0x5')](function(){return setting[_0xc2ea('0xa')]();})['then'](function(_0x4488ea){return setInterval(initRealtime,_0x4488ea[_0xc2ea('0xb')]*0x3e8);})[_0xc2ea('0xc')](function(_0x5e838d){logger['error'](_0xc2ea('0xd'),_0x5e838d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3da28d5..a1f2c21 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 _0x90e5=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','status','Imap','messageStatus','refresh','service','provider','custom','hasOwnProperty','email','handleImapBox','handleImapEmail','handleImapEnd','bind','error','handleImapError','isNil','disabled','name','messages','total'];(function(_0x5508db,_0x22ecbe){var _0x54ce94=function(_0x389047){while(--_0x389047){_0x5508db['push'](_0x5508db['shift']());}};_0x54ce94(++_0x22ecbe);}(_0x90e5,0x7a));var _0x590e=function(_0x4a8e53,_0x22a74b){_0x4a8e53=_0x4a8e53-0x0;var _0x1809d3=_0x90e5[_0x4a8e53];return _0x1809d3;};'use strict';var _=require(_0x590e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x590e('0x1'));var Redis=require(_0x590e('0x2'));var config=require(_0x590e('0x3'));var logger=require('../../../config/logger')('email');config['redis']=_[_0x590e('0x4')](config[_0x590e('0x5')],{'host':_0x590e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x590e('0x5')]));var EmailImap=require(_0x590e('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x224327){logger[_0x590e('0x8')](_0x590e('0x9'));this[_0x590e('0xa')]=_0x224327['mailAccounts'];this[_0x590e('0xb')]={};this[_0x590e('0xc')]=new EmailSmtp();}EmailChannel[_0x590e('0xd')][_0x590e('0xe')]=function(_0x1c25ec){var _0x592553=this[_0x590e('0xa')][_0x1c25ec];var _0x357a50={'id':_0x592553['id'],'name':_0x592553['name'],'key':_0x592553[_0x590e('0xf')],'active':_0x592553[_0x590e('0x10')],'Imap':{'status':_0x592553['Imap'][_0x590e('0x11')],'messageStatus':_0x592553[_0x590e('0x12')][_0x590e('0x13')],'total':_0x592553[_0x590e('0x12')]['total']}};if(_['isNil'](md5Accounts[_0x1c25ec])){md5Accounts[_0x1c25ec]={};}var _0xf7732e=md5(JSON['stringify'](_0x357a50));if(md5Accounts[_0x1c25ec][_0x590e('0x1')]!==_0xf7732e){md5Accounts[_0x1c25ec][_0x590e('0x1')]=_0xf7732e;io[_0x590e('0xe')]('mailAccount:update',_0x357a50);}};EmailChannel[_0x590e('0xd')][_0x590e('0x14')]=function(_0x17f9ee){for(var _0x5e1004 in _0x17f9ee){if(_0x17f9ee['hasOwnProperty'](_0x5e1004)){if(_0x17f9ee[_0x5e1004][_0x590e('0x12')]&&_0x17f9ee[_0x5e1004][_0x590e('0x10')]){var _0x73df2d=_0x17f9ee[_0x5e1004][_0x590e('0x12')];if(!_0x73df2d[_0x590e('0x15')]&&_0x17f9ee[_0x5e1004][_0x590e('0x16')]!==_0x590e('0x17'))_0x73df2d[_0x590e('0x15')]=_0x17f9ee[_0x5e1004]['provider'];if(!this['imapAccounts'][_0x590e('0x18')](_0x73df2d['id'])){this[_0x590e('0xb')][_0x73df2d['id']]=new EmailImap(_0x73df2d,_0x17f9ee[_0x5e1004][_0x590e('0x19')]);this['imapAccounts'][_0x73df2d['id']]['on']('box',this[_0x590e('0x1a')]['bind'](this,_0x5e1004));this['imapAccounts'][_0x73df2d['id']]['on']('email',this[_0x590e('0x1b')]['bind'](this,_0x5e1004));this[_0x590e('0xb')][_0x73df2d['id']]['on']('end',this[_0x590e('0x1c')][_0x590e('0x1d')](this,_0x5e1004));this[_0x590e('0xb')][_0x73df2d['id']]['on'](_0x590e('0x1e'),this[_0x590e('0x1f')]['bind'](this,_0x5e1004));}}else{if(_[_0x590e('0x20')](this[_0x590e('0xa')][_0x5e1004][_0x590e('0x12')])){this[_0x590e('0xa')][_0x5e1004][_0x590e('0x12')]={};}this[_0x590e('0xa')][_0x5e1004][_0x590e('0x12')][_0x590e('0x11')]=_0x590e('0x21');this[_0x590e('0xa')][_0x5e1004]['Imap']['messageStatus']='';this[_0x590e('0xe')](_0x5e1004);}}}};EmailChannel[_0x590e('0xd')][_0x590e('0x1a')]=function(_0x8459fc,_0x16b696){if(this[_0x590e('0xa')][_0x8459fc]){this[_0x590e('0xa')][_0x8459fc]['Imap'][_0x590e('0x11')]='connected';this[_0x590e('0xa')][_0x8459fc][_0x590e('0x12')][_0x590e('0x13')]=_0x16b696[_0x590e('0x22')];if(_0x16b696[_0x590e('0x23')]){this[_0x590e('0xa')][_0x8459fc]['Imap'][_0x590e('0x24')]=_0x16b696[_0x590e('0x23')]['total'];}return this['emit'](_0x8459fc);}};EmailChannel[_0x590e('0xd')]['handleImapEmail']=function(_0xda0346,_0x52d84b){logger[_0x590e('0x8')](_0x590e('0x25'),_0x52d84b[_0x590e('0x26')],_0x52d84b[_0x590e('0x27')],_0x52d84b['from'],_0xda0346);if(this[_0x590e('0xa')][_0xda0346]){return mailAccount[_0x590e('0x28')](_0xda0346,_0x52d84b)['then'](function(_0x29fc13){if(_0x29fc13){logger[_0x590e('0x8')]('Mail\x20accepted\x20from\x20routing');}})[_0x590e('0x29')](function(_0x9d5eab){logger[_0x590e('0x1e')](_0x590e('0x2a'),JSON[_0x590e('0x2b')](_0x9d5eab));});}};EmailChannel[_0x590e('0xd')][_0x590e('0x1c')]=function(_0x79b41c){if(this[_0x590e('0xa')][_0x79b41c]&&this[_0x590e('0xa')][_0x79b41c]['Imap']){if(this[_0x590e('0xb')][this[_0x590e('0xa')][_0x79b41c][_0x590e('0x12')]['id']]){delete this['imapAccounts'][this[_0x590e('0xa')][_0x79b41c][_0x590e('0x12')]['id']];}this[_0x590e('0xa')][_0x79b41c][_0x590e('0x12')][_0x590e('0x2c')]=moment();this[_0x590e('0xe')](_0x79b41c);}};EmailChannel[_0x590e('0xd')][_0x590e('0x1f')]=function(_0x28ed7a,_0x2b4a52){if(this['mailAccounts'][_0x28ed7a]){this[_0x590e('0xa')][_0x28ed7a][_0x590e('0x12')][_0x590e('0x11')]='error';this['mailAccounts'][_0x28ed7a][_0x590e('0x12')]['messageStatus']=_0x2b4a52;return this['emit'](_0x28ed7a);}};EmailChannel[_0x590e('0xd')][_0x590e('0x2d')]=function(_0x3dc571,_0x21e789){return this[_0x590e('0xc')][_0x590e('0x2e')](_0x3dc571,_0x21e789);};EmailChannel['prototype'][_0x590e('0x2f')]=function(_0x4ae465){var _0x3c2ecb=this;if(this['mailAccounts'][_0x4ae465['id']]){if(_['isNil'](this['mailAccounts'][_0x4ae465['id']]['Smtp'])){this[_0x590e('0xa')][_0x4ae465['id']][_0x590e('0x30')]={};}this[_0x590e('0xa')][_0x4ae465['id']]['Smtp'][_0x590e('0x2c')]=moment();return new BPromise(function(_0x361a03,_0x2a2fe9){return _0x3c2ecb[_0x590e('0xc')][_0x590e('0x31')](_0x4ae465)[_0x590e('0x32')](function(_0xd9a637){_0x3c2ecb[_0x590e('0xa')][_0x4ae465['id']]['Smtp'][_0x590e('0x11')]=_0x590e('0x33');_0x3c2ecb[_0x590e('0xa')][_0x4ae465['id']]['Smtp'][_0x590e('0x13')]='';_0x3c2ecb[_0x590e('0xe')](_0x4ae465['id']);_0x361a03(_0xd9a637);})[_0x590e('0x29')](function(_0x29d10b){_0x3c2ecb[_0x590e('0xa')][_0x4ae465['id']]['Smtp'][_0x590e('0x11')]='error';_0x3c2ecb[_0x590e('0xa')][_0x4ae465['id']][_0x590e('0x30')][_0x590e('0x13')]=_0x29d10b;_0x3c2ecb[_0x590e('0xe')](_0x4ae465['id']);_0x2a2fe9(_0x29d10b);});});}return this[_0x590e('0xc')][_0x590e('0x31')](_0x4ae465);};module[_0x590e('0x34')]=EmailChannel; \ No newline at end of file +var _0x349f=['send','verifySmtp','Smtp','verified','verify','exports','moment','md5','ioredis','../../../config/environment','email','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','bind','handleImapEmail','end','error','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x349f,0x7a));var _0xf349=function(_0x43389d,_0x244dc6){_0x43389d=_0x43389d-0x0;var _0x124d06=_0x349f[_0x43389d];return _0x124d06;};'use strict';var _=require('lodash');var moment=require(_0xf349('0x0'));var BPromise=require('bluebird');var md5=require(_0xf349('0x1'));var Redis=require(_0xf349('0x2'));var config=require(_0xf349('0x3'));var logger=require('../../../config/logger')(_0xf349('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0xf349('0x5'),'port':0x18eb});var io=require(_0xf349('0x6'))(new Redis(config[_0xf349('0x7')]));var EmailImap=require(_0xf349('0x8'));var EmailSmtp=require(_0xf349('0x9'));var mailAccount=require(_0xf349('0xa'));var md5Accounts={};function EmailChannel(_0x2e1401){logger[_0xf349('0xb')]('start\x20email\x20channel');this['mailAccounts']=_0x2e1401[_0xf349('0xc')];this[_0xf349('0xd')]={};this[_0xf349('0xe')]=new EmailSmtp();}EmailChannel[_0xf349('0xf')][_0xf349('0x10')]=function(_0x38aae7){var _0x259b02=this[_0xf349('0xc')][_0x38aae7];var _0x5a71de={'id':_0x259b02['id'],'name':_0x259b02[_0xf349('0x11')],'key':_0x259b02[_0xf349('0x12')],'active':_0x259b02[_0xf349('0x13')],'Imap':{'status':_0x259b02['Imap'][_0xf349('0x14')],'messageStatus':_0x259b02[_0xf349('0x15')][_0xf349('0x16')],'total':_0x259b02[_0xf349('0x15')][_0xf349('0x17')]}};if(_[_0xf349('0x18')](md5Accounts[_0x38aae7])){md5Accounts[_0x38aae7]={};}var _0x4e4b4b=md5(JSON[_0xf349('0x19')](_0x5a71de));if(md5Accounts[_0x38aae7][_0xf349('0x1')]!==_0x4e4b4b){md5Accounts[_0x38aae7][_0xf349('0x1')]=_0x4e4b4b;io[_0xf349('0x10')](_0xf349('0x1a'),_0x5a71de);}};EmailChannel[_0xf349('0xf')][_0xf349('0x1b')]=function(_0x55efe6){for(var _0x5e19f3 in _0x55efe6){if(_0x55efe6[_0xf349('0x1c')](_0x5e19f3)){if(_0x55efe6[_0x5e19f3][_0xf349('0x15')]&&_0x55efe6[_0x5e19f3][_0xf349('0x13')]){var _0x2dbec7=_0x55efe6[_0x5e19f3][_0xf349('0x15')];if(!_0x2dbec7[_0xf349('0x1d')]&&_0x55efe6[_0x5e19f3][_0xf349('0x1e')]!==_0xf349('0x1f'))_0x2dbec7[_0xf349('0x1d')]=_0x55efe6[_0x5e19f3]['provider'];if(!this['imapAccounts'][_0xf349('0x1c')](_0x2dbec7['id'])){this['imapAccounts'][_0x2dbec7['id']]=new EmailImap(_0x2dbec7,_0x55efe6[_0x5e19f3][_0xf349('0x4')]);this[_0xf349('0xd')][_0x2dbec7['id']]['on'](_0xf349('0x20'),this['handleImapBox'][_0xf349('0x21')](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x4'),this[_0xf349('0x22')][_0xf349('0x21')](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x23'),this['handleImapEnd']['bind'](this,_0x5e19f3));this['imapAccounts'][_0x2dbec7['id']]['on'](_0xf349('0x24'),this['handleImapError']['bind'](this,_0x5e19f3));}}else{if(_[_0xf349('0x18')](this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')])){this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')]={};}this[_0xf349('0xc')][_0x5e19f3]['Imap']['status']=_0xf349('0x25');this[_0xf349('0xc')][_0x5e19f3][_0xf349('0x15')]['messageStatus']='';this[_0xf349('0x10')](_0x5e19f3);}}}};EmailChannel['prototype'][_0xf349('0x26')]=function(_0x2b08b8,_0x323fd3){if(this[_0xf349('0xc')][_0x2b08b8]){this['mailAccounts'][_0x2b08b8][_0xf349('0x15')][_0xf349('0x14')]=_0xf349('0x27');this['mailAccounts'][_0x2b08b8][_0xf349('0x15')]['messageStatus']=_0x323fd3['name'];if(_0x323fd3[_0xf349('0x28')]){this[_0xf349('0xc')][_0x2b08b8][_0xf349('0x15')][_0xf349('0x17')]=_0x323fd3[_0xf349('0x28')][_0xf349('0x17')];}return this[_0xf349('0x10')](_0x2b08b8);}};EmailChannel[_0xf349('0xf')][_0xf349('0x22')]=function(_0x320f14,_0x5d069e){logger[_0xf349('0xb')](_0xf349('0x29'),_0x5d069e['firstName'],_0x5d069e[_0xf349('0x2a')],_0x5d069e[_0xf349('0x2b')],_0x320f14);if(this['mailAccounts'][_0x320f14]){return mailAccount['notify'](_0x320f14,_0x5d069e)[_0xf349('0x2c')](function(_0x16eae5){if(_0x16eae5){logger['info'](_0xf349('0x2d'));}})[_0xf349('0x2e')](function(_0x2e6b36){logger[_0xf349('0x24')](_0xf349('0x2f'),JSON['stringify'](_0x2e6b36));});}};EmailChannel[_0xf349('0xf')][_0xf349('0x30')]=function(_0x1b6aab){if(this[_0xf349('0xc')][_0x1b6aab]&&this[_0xf349('0xc')][_0x1b6aab]['Imap']){if(this[_0xf349('0xd')][this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')]['id']]){delete this[_0xf349('0xd')][this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')]['id']];}this[_0xf349('0xc')][_0x1b6aab][_0xf349('0x15')][_0xf349('0x31')]=moment();this['emit'](_0x1b6aab);}};EmailChannel['prototype'][_0xf349('0x32')]=function(_0x202f2c,_0x317507){if(this[_0xf349('0xc')][_0x202f2c]){this['mailAccounts'][_0x202f2c][_0xf349('0x15')][_0xf349('0x14')]=_0xf349('0x24');this[_0xf349('0xc')][_0x202f2c][_0xf349('0x15')][_0xf349('0x16')]=_0x317507;return this['emit'](_0x202f2c);}};EmailChannel[_0xf349('0xf')][_0xf349('0x33')]=function(_0x5280a2,_0xaaca6a){return this[_0xf349('0xe')][_0xf349('0x34')](_0x5280a2,_0xaaca6a);};EmailChannel[_0xf349('0xf')][_0xf349('0x35')]=function(_0x407296){var _0x50393b=this;if(this[_0xf349('0xc')][_0x407296['id']]){if(_[_0xf349('0x18')](this['mailAccounts'][_0x407296['id']]['Smtp'])){this[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')]={};}this[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x31')]=moment();return new BPromise(function(_0x1b099d,_0x496d59){return _0x50393b[_0xf349('0xe')]['verify'](_0x407296)[_0xf349('0x2c')](function(_0x53ca1d){_0x50393b[_0xf349('0xc')][_0x407296['id']]['Smtp'][_0xf349('0x14')]=_0xf349('0x37');_0x50393b[_0xf349('0xc')][_0x407296['id']]['Smtp'][_0xf349('0x16')]='';_0x50393b[_0xf349('0x10')](_0x407296['id']);_0x1b099d(_0x53ca1d);})[_0xf349('0x2e')](function(_0x3a797f){_0x50393b[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x14')]=_0xf349('0x24');_0x50393b[_0xf349('0xc')][_0x407296['id']][_0xf349('0x36')][_0xf349('0x16')]=_0x3a797f;_0x50393b[_0xf349('0x10')](_0x407296['id']);_0x496d59(_0x3a797f);});});}return this[_0xf349('0xe')][_0xf349('0x38')](_0x407296);};module[_0xf349('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e71d5cc..fd4c6a2 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 _0xef90=['mailparser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','getAccount','account','once','ready','end','error','handleError','bind','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','password','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleReady','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap'];(function(_0x45d947,_0x370685){var _0x4ad6e9=function(_0x11bfea){while(--_0x11bfea){_0x45d947['push'](_0x45d947['shift']());}};_0x4ad6e9(++_0x370685);}(_0xef90,0xb8));var _0x0ef9=function(_0x1209c2,_0xfa409d){_0x1209c2=_0x1209c2-0x0;var _0x323afe=_0xef90[_0x1209c2];return _0x323afe;};'use strict';var _=require(_0x0ef9('0x0'));var util=require('util');var Imap=require(_0x0ef9('0x1'));var simpleParser=require(_0x0ef9('0x2'))['simpleParser'];var Iconv=require(_0x0ef9('0x3'))[_0x0ef9('0x4')];var EventEmitter=require('events')[_0x0ef9('0x5')];var utils=require(_0x0ef9('0x6'));var logger=require(_0x0ef9('0x7'))(_0x0ef9('0x8'));function EmailImap(_0x4559f5,_0x4cc794){this['mailbox']=_0x4559f5['mailbox'];this['account']=this[_0x0ef9('0x9')](_0x4559f5,_0x4cc794);this[_0x0ef9('0x1')]=new Imap(this[_0x0ef9('0xa')]);this[_0x0ef9('0x1')][_0x0ef9('0xb')](_0x0ef9('0xc'),this['handleReady']['bind'](this));this[_0x0ef9('0x1')]['once'](_0x0ef9('0xd'),this['handleEnd']['bind'](this));this[_0x0ef9('0x1')]['on'](_0x0ef9('0xe'),this[_0x0ef9('0xf')][_0x0ef9('0x10')](this));this[_0x0ef9('0x1')][_0x0ef9('0x11')]();}util[_0x0ef9('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0ef9('0x9')]=function(_0x3b1181,_0x15e1c0){var _0x1e1348={'connTimeout':_0x3b1181[_0x0ef9('0x13')]?_0x3b1181['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3b1181[_0x0ef9('0x14')]?_0x3b1181['authTimeout']*0x3e8:0x1388};if(_0x3b1181[_0x0ef9('0x15')]){_0x1e1348['user']=_0x3b1181[_0x0ef9('0x16')];if(_0x3b1181[_0x0ef9('0x17')]){_0x1e1348[_0x0ef9('0x18')]=utils['generateXOAuth2Token'](_0x3b1181[_0x0ef9('0x19')]['data5'],_0x3b1181[_0x0ef9('0x16')]);}else{_0x1e1348['password']=_0x3b1181[_0x0ef9('0x1a')];}}else{if(_0x3b1181['authentication']){_0x1e1348[_0x0ef9('0x16')]=_0x3b1181[_0x0ef9('0x16')];_0x1e1348[_0x0ef9('0x1a')]=_0x3b1181['password'];}}_0x1e1348[_0x0ef9('0x8')]=_0x15e1c0||_0x3b1181[_0x0ef9('0x16')]||_0x0ef9('0x1b');_0x1e1348[_0x0ef9('0x1c')]=_0x3b1181[_0x0ef9('0x1c')];_0x1e1348[_0x0ef9('0x1d')]=_0x3b1181[_0x0ef9('0x1d')]||0x3e1;if(_0x3b1181['tls']){_0x1e1348[_0x0ef9('0x1e')]=!![];}else{_0x1e1348[_0x0ef9('0x1e')]=![];_0x1e1348[_0x0ef9('0x1f')]=_0x0ef9('0x20');}return _0x1e1348;};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x22')]=function(){this[_0x0ef9('0x1')][_0x0ef9('0x23')](this[_0x0ef9('0x24')],![],this[_0x0ef9('0x25')][_0x0ef9('0x10')](this));};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x25')]=function(_0x2d5f49,_0x1769f3){if(_0x2d5f49){this[_0x0ef9('0xf')](_0x2d5f49,!![]);}else{this[_0x0ef9('0x26')](_0x0ef9('0x27'),_0x1769f3);this[_0x0ef9('0x28')]();}};EmailImap['prototype'][_0x0ef9('0x29')]=function(_0x1c60c7){if(_0x1c60c7){this[_0x0ef9('0xf')](_0x1c60c7,!![]);}else{this[_0x0ef9('0x1')]['end']();}};EmailImap['prototype'][_0x0ef9('0x28')]=function(){this[_0x0ef9('0x1')][_0x0ef9('0x2a')]([_0x0ef9('0x2b')],this[_0x0ef9('0x2c')]['bind'](this));};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x2c')]=function(_0x32d04f,_0x18525a){if(_0x32d04f){this[_0x0ef9('0xf')](_0x32d04f,!![]);}else{if(_0x18525a[_0x0ef9('0x2d')]){try{var _0x55b507=this[_0x0ef9('0x1')]['fetch'](_0x18525a,{'bodies':'','markSeen':!![]});_0x55b507['on'](_0x0ef9('0x2e'),this[_0x0ef9('0x2f')][_0x0ef9('0x10')](this));_0x55b507['once'](_0x0ef9('0xe'),this[_0x0ef9('0x30')]['bind'](this));_0x55b507[_0x0ef9('0xb')](_0x0ef9('0xd'),this[_0x0ef9('0x31')]['bind'](this));}catch(_0x10d4cd){logger[_0x0ef9('0xe')](_0x10d4cd);}}else{this['imap'][_0x0ef9('0x32')](!![],this['handleCloseBox'][_0x0ef9('0x10')](this));}}};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x2f')]=function(_0x54740f){_0x54740f['on']('body',this[_0x0ef9('0x33')][_0x0ef9('0x10')](this));_0x54740f[_0x0ef9('0xb')]('attributes',this[_0x0ef9('0x34')][_0x0ef9('0x10')](this));_0x54740f[_0x0ef9('0xb')](_0x0ef9('0xd'),this[_0x0ef9('0x35')][_0x0ef9('0x10')](this));};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x33')]=function(_0x13b905){simpleParser(_0x13b905,{'Iconv':Iconv},this[_0x0ef9('0x36')][_0x0ef9('0x10')](this));};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x34')]=function(){};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x35')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x5130e7,_0x4bc518){if(_0x5130e7){logger[_0x0ef9('0xe')](_0x5130e7);}else{var _0xc069a1=this;utils[_0x0ef9('0x37')](this[_0x0ef9('0xa')],_0x4bc518,function(_0x166db9){_0xc069a1['emit'](_0x0ef9('0x8'),_0x166db9);});}};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x31')]=function(){this[_0x0ef9('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x0ef9('0x10')](this));};EmailImap['prototype'][_0x0ef9('0x30')]=function(_0x1bced2){this['handleError'](_0x1bced2);this['imap'][_0x0ef9('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x0ef9('0x21')][_0x0ef9('0x38')]=function(){this[_0x0ef9('0x26')](_0x0ef9('0xd'));};EmailImap['prototype'][_0x0ef9('0xf')]=function(_0x530a8e,_0x251fbb){logger[_0x0ef9('0xe')](_0x0ef9('0xf'),this['account']['email'],JSON[_0x0ef9('0x39')](_0x530a8e));var _0x7daf42='';if(_0x530a8e){if(_0x530a8e[_0x0ef9('0x3a')]){_0x7daf42=_0x530a8e[_0x0ef9('0x3a')];}else{for(var _0xf76e56 in _0x530a8e){if(_0x530a8e[_0x0ef9('0x3b')](_0xf76e56)){_0x7daf42+=_[_0x0ef9('0x3c')](_0xf76e56)+':\x20'+_0x530a8e[_0xf76e56]+'\x0a';}}}}if(_0x251fbb){this[_0x0ef9('0x1')][_0x0ef9('0xd')]();}else{this[_0x0ef9('0x26')](_0x0ef9('0xe'),_0x7daf42);this[_0x0ef9('0x26')](_0x0ef9('0xd'));}};module[_0x0ef9('0x3d')]=EmailImap; \ No newline at end of file +var _0x33c5=['fetch','message','handleFetchMessage','handleFetchError','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleCloseBox','handleEnd','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','handleReady','bind','end','error','handleError','connect','inherits','connTimeout','authTimeout','service','xoauth2','data5','user','password','authentication','email','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','prototype','emit','search','handleReadUnseen'];(function(_0x39f0b2,_0x25047d){var _0x1f1f06=function(_0xbcbc78){while(--_0xbcbc78){_0x39f0b2['push'](_0x39f0b2['shift']());}};_0x1f1f06(++_0x25047d);}(_0x33c5,0x12d));var _0x533c=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x33c5[_0x512f81];return _0xa15099;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var Imap=require(_0x533c('0x1'));var simpleParser=require(_0x533c('0x2'))[_0x533c('0x3')];var Iconv=require('iconv')[_0x533c('0x4')];var EventEmitter=require(_0x533c('0x5'))[_0x533c('0x6')];var utils=require(_0x533c('0x7'));var logger=require(_0x533c('0x8'))('email');function EmailImap(_0x3bb582,_0x4e4b0f){this[_0x533c('0x9')]=_0x3bb582[_0x533c('0x9')];this[_0x533c('0xa')]=this[_0x533c('0xb')](_0x3bb582,_0x4e4b0f);this[_0x533c('0x1')]=new Imap(this[_0x533c('0xa')]);this[_0x533c('0x1')][_0x533c('0xc')](_0x533c('0xd'),this[_0x533c('0xe')][_0x533c('0xf')](this));this[_0x533c('0x1')][_0x533c('0xc')](_0x533c('0x10'),this['handleEnd'][_0x533c('0xf')](this));this[_0x533c('0x1')]['on'](_0x533c('0x11'),this[_0x533c('0x12')]['bind'](this));this[_0x533c('0x1')][_0x533c('0x13')]();}util[_0x533c('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x533c('0xb')]=function(_0x190fe3,_0x530f93){var _0x57ea66={'connTimeout':_0x190fe3['connTimeout']?_0x190fe3[_0x533c('0x15')]*0x3e8:0x2710,'authTimeout':_0x190fe3['authTimeout']?_0x190fe3[_0x533c('0x16')]*0x3e8:0x1388};if(_0x190fe3[_0x533c('0x17')]){_0x57ea66['user']=_0x190fe3['user'];if(_0x190fe3['modernAuthentication']){_0x57ea66[_0x533c('0x18')]=utils['generateXOAuth2Token'](_0x190fe3['CloudProvider'][_0x533c('0x19')],_0x190fe3[_0x533c('0x1a')]);}else{_0x57ea66['password']=_0x190fe3[_0x533c('0x1b')];}}else{if(_0x190fe3[_0x533c('0x1c')]){_0x57ea66[_0x533c('0x1a')]=_0x190fe3[_0x533c('0x1a')];_0x57ea66[_0x533c('0x1b')]=_0x190fe3[_0x533c('0x1b')];}}_0x57ea66[_0x533c('0x1d')]=_0x530f93||_0x190fe3['user']||_0x533c('0x1e');_0x57ea66[_0x533c('0x1f')]=_0x190fe3['host'];_0x57ea66[_0x533c('0x20')]=_0x190fe3[_0x533c('0x20')]||0x3e1;if(_0x190fe3[_0x533c('0x21')]){_0x57ea66[_0x533c('0x21')]=!![];}else{_0x57ea66[_0x533c('0x21')]=![];_0x57ea66['autotls']=_0x533c('0x22');}return _0x57ea66;};EmailImap['prototype']['handleReady']=function(){this[_0x533c('0x1')][_0x533c('0x23')](this[_0x533c('0x9')],![],this[_0x533c('0x24')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x24')]=function(_0x1c88a1,_0x170698){if(_0x1c88a1){this[_0x533c('0x12')](_0x1c88a1,!![]);}else{this[_0x533c('0x26')]('box',_0x170698);this['readUnseen']();}};EmailImap['prototype']['handleCloseBox']=function(_0x242f0e){if(_0x242f0e){this[_0x533c('0x12')](_0x242f0e,!![]);}else{this['imap'][_0x533c('0x10')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x533c('0x1')][_0x533c('0x27')](['UNSEEN'],this['handleReadUnseen'][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x28')]=function(_0x5ad47d,_0x2f384f){if(_0x5ad47d){this[_0x533c('0x12')](_0x5ad47d,!![]);}else{if(_0x2f384f['length']){try{var _0xaf4f73=this[_0x533c('0x1')][_0x533c('0x29')](_0x2f384f,{'bodies':'','markSeen':!![]});_0xaf4f73['on'](_0x533c('0x2a'),this[_0x533c('0x2b')][_0x533c('0xf')](this));_0xaf4f73['once'](_0x533c('0x11'),this[_0x533c('0x2c')][_0x533c('0xf')](this));_0xaf4f73[_0x533c('0xc')](_0x533c('0x10'),this['handleFetchEnd'][_0x533c('0xf')](this));}catch(_0x9a2a6c){logger[_0x533c('0x11')](_0x9a2a6c);}}else{this[_0x533c('0x1')][_0x533c('0x2d')](!![],this['handleCloseBox'][_0x533c('0xf')](this));}}};EmailImap[_0x533c('0x25')][_0x533c('0x2b')]=function(_0x58d1e3){_0x58d1e3['on']('body',this['handleMessageBody'][_0x533c('0xf')](this));_0x58d1e3[_0x533c('0xc')](_0x533c('0x2e'),this[_0x533c('0x2f')][_0x533c('0xf')](this));_0x58d1e3[_0x533c('0xc')](_0x533c('0x10'),this[_0x533c('0x30')]['bind'](this));};EmailImap[_0x533c('0x25')]['handleMessageBody']=function(_0x45a86e){simpleParser(_0x45a86e,{'Iconv':Iconv},this[_0x533c('0x31')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x533c('0x30')]=function(){};EmailImap[_0x533c('0x25')][_0x533c('0x31')]=function(_0x7d0b7e,_0x42d07d){if(_0x7d0b7e){logger['error'](_0x7d0b7e);}else{var _0x2381d9=this;utils['parser'](this['account'],_0x42d07d,function(_0xadfca5){_0x2381d9[_0x533c('0x26')](_0x533c('0x1d'),_0xadfca5);});}};EmailImap[_0x533c('0x25')][_0x533c('0x32')]=function(){this[_0x533c('0x1')][_0x533c('0x2d')](!![],this[_0x533c('0x33')]['bind'](this));};EmailImap[_0x533c('0x25')]['handleFetchError']=function(_0x32db8f){this[_0x533c('0x12')](_0x32db8f);this[_0x533c('0x1')][_0x533c('0x2d')](!![],this[_0x533c('0x33')][_0x533c('0xf')](this));};EmailImap[_0x533c('0x25')][_0x533c('0x34')]=function(){this[_0x533c('0x26')]('end');};EmailImap[_0x533c('0x25')]['handleError']=function(_0x1238fb,_0x3dd185){logger[_0x533c('0x11')](_0x533c('0x12'),this[_0x533c('0xa')][_0x533c('0x1d')],JSON[_0x533c('0x35')](_0x1238fb));var _0x6e30b9='';if(_0x1238fb){if(_0x1238fb[_0x533c('0x36')]){_0x6e30b9=_0x1238fb[_0x533c('0x36')];}else{for(var _0x59154d in _0x1238fb){if(_0x1238fb[_0x533c('0x37')](_0x59154d)){_0x6e30b9+=_['upperFirst'](_0x59154d)+':\x20'+_0x1238fb[_0x59154d]+'\x0a';}}}}if(_0x3dd185){this[_0x533c('0x1')][_0x533c('0x10')]();}else{this[_0x533c('0x26')](_0x533c('0x11'),_0x6e30b9);this['emit'](_0x533c('0x10'));}};module[_0x533c('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0024970..2a5ed6f 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 _0x9f91=['send','compile','toString','verify','createTransport','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x472780,_0x34c1a7){var _0x1502da=function(_0x5ee5f7){while(--_0x5ee5f7){_0x472780['push'](_0x472780['shift']());}};_0x1502da(++_0x34c1a7);}(_0x9f91,0x1bf));var _0x19f9=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x9f91[_0x1ca890];return _0x3f8e01;};'use strict';var nodemailer=require(_0x19f9('0x0'));var inlineBase64=require(_0x19f9('0x1'));function EmailSmtp(){}EmailSmtp[_0x19f9('0x2')][_0x19f9('0x3')]=function(_0xecb7e4,_0x515aab){return new Promise(function(_0x5de9cd,_0x319a9c){var _0x19a67f=nodemailer['createTransport'](_0xecb7e4);_0x19a67f['use'](_0x19f9('0x4'),inlineBase64());_0x19a67f['sendMail'](_0x515aab,function(_0x2d7893,_0x2dad33){if(_0x2d7893){_0x319a9c(_0x2d7893[_0x19f9('0x5')]());}else{_0x5de9cd(_0x2dad33);}});});};EmailSmtp['prototype'][_0x19f9('0x6')]=function(_0xf36173){return new Promise(function(_0x254976,_0xd5d03b){var _0x2220c9=nodemailer[_0x19f9('0x7')](_0xf36173);_0x2220c9['verify'](function(_0x4b7736,_0x500d1a){if(_0x4b7736){_0xd5d03b(_0x4b7736[_0x19f9('0x5')]());}else{if(_0x500d1a){_0x254976(_0x500d1a);}else{_0xd5d03b('Not\x20verifired');}}});});};module[_0x19f9('0x8')]=EmailSmtp; \ No newline at end of file +var _0x75ab=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x75ab,0xc7));var _0xb75a=function(_0x35aa5f,_0x527b85){_0x35aa5f=_0x35aa5f-0x0;var _0x2345c2=_0x75ab[_0x35aa5f];return _0x2345c2;};'use strict';var nodemailer=require(_0xb75a('0x0'));var inlineBase64=require(_0xb75a('0x1'));function EmailSmtp(){}EmailSmtp[_0xb75a('0x2')][_0xb75a('0x3')]=function(_0x14dc1b,_0x57f206){return new Promise(function(_0x59c70b,_0x1ce6f9){var _0x6fe262=nodemailer[_0xb75a('0x4')](_0x14dc1b);_0x6fe262[_0xb75a('0x5')](_0xb75a('0x6'),inlineBase64());_0x6fe262[_0xb75a('0x7')](_0x57f206,function(_0x2e6834,_0x1ecae1){if(_0x2e6834){_0x1ce6f9(_0x2e6834[_0xb75a('0x8')]());}else{_0x59c70b(_0x1ecae1);}});});};EmailSmtp[_0xb75a('0x2')][_0xb75a('0x9')]=function(_0x404810){return new Promise(function(_0x219683,_0x20b98d){var _0x3cbca8=nodemailer[_0xb75a('0x4')](_0x404810);_0x3cbca8[_0xb75a('0x9')](function(_0x22b2f8,_0x24733f){if(_0x22b2f8){_0x20b98d(_0x22b2f8['toString']());}else{if(_0x24733f){_0x219683(_0x24733f);}else{_0x20b98d(_0xb75a('0xa'));}}});});};module[_0xb75a('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 79d8a6c..e20c9b2 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 _0x3bfc=['join','Anonymous','pop','isEmpty','@xcally.com','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','name','substring','indexOf','split','slice'];(function(_0x56b0d9,_0x5e2285){var _0x45f280=function(_0x5a178f){while(--_0x5a178f){_0x56b0d9['push'](_0x56b0d9['shift']());}};_0x45f280(++_0x5e2285);}(_0x3bfc,0x11b));var _0xc3bf=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0x3bfc[_0x29d87d];return _0x1fd84b;};'use strict';var _=require(_0xc3bf('0x0'));var moment=require(_0xc3bf('0x1'));var random=require(_0xc3bf('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xc3bf('0x3'));var tnef=require(_0xc3bf('0x4'));var logger=require(_0xc3bf('0x5'))(_0xc3bf('0x6'));var config=require('../../../config/environment');function getAddress(_0x14d3ce){var _0x5cc248=_[_0xc3bf('0x7')](_0x14d3ce[_0xc3bf('0x8')]);return _0x5cc248&&_0x5cc248[_0xc3bf('0x9')]?_0x5cc248[_0xc3bf('0x9')]:_0xc3bf('0xa')+random[_0xc3bf('0xb')](0x6)+'@xcally.com';}function getFirstName(_0xe4d0d5){var _0x38c43b=_[_0xc3bf('0x7')](_0xe4d0d5['value']);if(_0x38c43b&&_0x38c43b['name']){if(_0x38c43b['name']==_0x38c43b[_0xc3bf('0x9')]){return _0x38c43b[_0xc3bf('0xc')][_0xc3bf('0xd')](0x0,_0x38c43b[_0xc3bf('0xc')][_0xc3bf('0xe')]('@'));}var _0x4ef03c=_0x38c43b[_0xc3bf('0xc')][_0xc3bf('0xf')](/\s+/);return _0x4ef03c['length']>0x1?_0x4ef03c[_0xc3bf('0x10')](0x0,-0x1)[_0xc3bf('0x11')]('\x20'):_0x38c43b[_0xc3bf('0xc')];}return _0xc3bf('0x12');}function getLastName(_0x51129c){var _0x1729ff=_[_0xc3bf('0x7')](_0x51129c[_0xc3bf('0x8')]);if(_0x1729ff&&_0x1729ff[_0xc3bf('0xc')]){var _0x57dd01=_0x1729ff[_0xc3bf('0xc')][_0xc3bf('0xf')](/\s+/);return _0x57dd01['length']>0x1?_0x57dd01[_0xc3bf('0x13')]():'';}return'';}function getMails(_0x39ce26,_0x27ab77){var _0x45f4ff='';for(var _0x52dfca=0x0;_0x52dfca<_0x27ab77[_0xc3bf('0x8')]['length'];_0x52dfca+=0x1){if(_0x27ab77[_0xc3bf('0x8')][_0x52dfca][_0xc3bf('0x9')]!==_0x39ce26){if(!_[_0xc3bf('0x14')](_0x45f4ff)){_0x45f4ff+=',';}_0x45f4ff+=_0x27ab77[_0xc3bf('0x8')][_0x52dfca][_0xc3bf('0xc')]||_0x27ab77[_0xc3bf('0x8')][_0x52dfca][_0xc3bf('0x9')]||'';_0x45f4ff+='\x20<';_0x45f4ff+=_0x27ab77['value'][_0x52dfca][_0xc3bf('0x9')]?_0x27ab77[_0xc3bf('0x8')][_0x52dfca][_0xc3bf('0x9')]:_0xc3bf('0xa')+random['generate'](0x6)+_0xc3bf('0x15');_0x45f4ff+='>';}}return _0x45f4ff;}function parseEmail(_0x15bcd5,_0x1d6cea,_0x8e02ba){if(_0x1d6cea['html']){var _0x34d930=/)<[^<]*)*<\/script>/gi;while(_0x34d930['test'](_0x1d6cea[_0xc3bf('0x16')])){_0x1d6cea[_0xc3bf('0x16')]=_0x1d6cea[_0xc3bf('0x16')]['replace'](_0x34d930,'');}if(_0x1d6cea['html'][_0xc3bf('0x17')](_0xc3bf('0x18'))){var _0x59f555=[];_0x1d6cea[_0xc3bf('0x19')][_0xc3bf('0x1a')](_0x1dbf69=>{_0x59f555[_0xc3bf('0x1b')](_0x1dbf69[_0xc3bf('0x1c')]);});var _0x2a1316=/]+>/g;var _0x12d839=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3ed0e7=_0x1d6cea['html'][_0xc3bf('0x1d')](_0x12d839,'_SRC');var _0x5f22fa=_0x3ed0e7[_0xc3bf('0x1d')](_0x2a1316,_0xc3bf('0x1e'));for(let _0x314d29=0x0;_0x314d29<_0x59f555[_0xc3bf('0x1f')];_0x314d29++){var _0x439c2f=_0x5f22fa[_0xc3bf('0x1d')](_0xc3bf('0x1e'),_0xc3bf('0x20')+_0x59f555[_0x314d29]+_0xc3bf('0x21'));_0x5f22fa=_0x439c2f;}_0x1d6cea['html']=_0x5f22fa;}_0x8e02ba[_0xc3bf('0x22')]=_0x1d6cea[_0xc3bf('0x16')];}else{_0x8e02ba['body']=_0x1d6cea[_0xc3bf('0x23')];}if(_0x8e02ba[_0xc3bf('0x22')]){_0x8e02ba[_0xc3bf('0x22')]=_0x8e02ba['body'][_0xc3bf('0x1d')](/0x0){var _0x516e7a=[_0xc3bf('0x32'),_0xc3bf('0x33'),_0xc3bf('0x34')];for(var _0x39a256=0x0;_0x39a256<_0x1d6cea['headerLines'][_0xc3bf('0x1f')];_0x39a256++){var _0x9549f4=_[_0xc3bf('0xe')](_0x516e7a,_0x1d6cea[_0xc3bf('0x31')][_0x39a256][_0xc3bf('0x35')]);if(_0x9549f4>=0x0){_0x8e02ba[_0xc3bf('0x36')]=!![];}}}return _0x8e02ba;}exports['parser']=function(_0x19a747,_0x293621,_0x396c9a){var _0x26e6e4={'from':getAddress(_0x293621[_0xc3bf('0x37')]),'firstName':getFirstName(_0x293621[_0xc3bf('0x37')]),'lastName':getLastName(_0x293621[_0xc3bf('0x37')]),'mapKey':_0xc3bf('0x6'),'message':{'from':getMails(_0x19a747[_0xc3bf('0x6')],_0x293621['from']),'to':_0x19a747['email'],'cc':'','subject':_0x293621[_0xc3bf('0x38')]||'','messageId':_0x293621[_0xc3bf('0x39')],'inReplyTo':_0x293621[_0xc3bf('0x3a')],'sentAt':moment(_0x293621[_0xc3bf('0x3b')])[_0xc3bf('0x2c')](_0xc3bf('0x3c')),'attach':![],'attachments':[]}};if(!_0x293621[_0xc3bf('0x16')]&&!_0x293621['textAsHtml']){var _0x509a66=_['filter'](_0x293621[_0xc3bf('0x19')],{'contentType':'application/ms-tnef'});if(_0x509a66[_0xc3bf('0x1f')]){logger[_0xc3bf('0x3d')](util[_0xc3bf('0x2c')](_0xc3bf('0x3e'),_0x293621[_0xc3bf('0x39')]));tnef[_0xc3bf('0x3f')](_[_0xc3bf('0x40')](_0x509a66)[_0xc3bf('0x30')],function(_0x1bbe6d,_0x9df51e){if(_0x9df51e){_0x293621[_0xc3bf('0x16')]=_0x9df51e[_0xc3bf('0x41')]||_0xc3bf('0x42');if(_0x9df51e[_0xc3bf('0x43')]){for(var _0x1197ff=0x0;_0x1197ff<_0x9df51e['Attachments'][_0xc3bf('0x1f')];_0x1197ff++){var _0x2b5042=_0x9df51e[_0xc3bf('0x43')][_0x1197ff];_0x26e6e4['message']['attachments']['push']({'filename':_0x2b5042[_0xc3bf('0x44')],'content':Buffer[_0xc3bf('0x37')](_0x2b5042['Data'])});}}}_0x396c9a(parseEmail(_0x19a747,_0x293621,_0x26e6e4));});}else{_0x293621[_0xc3bf('0x16')]=_0xc3bf('0x42');_0x396c9a(parseEmail(_0x19a747,_0x293621,_0x26e6e4));}}else{_0x396c9a(parseEmail(_0x19a747,_0x293621,_0x26e6e4));}};exports[_0xc3bf('0x45')]=function(_0x2ca3f5,_0x13f272){var _0x152ef2=[_0xc3bf('0x46')+(_0x13f272||''),_0xc3bf('0x47')+_0x2ca3f5,'',''];return Buffer[_0xc3bf('0x37')](_0x152ef2[_0xc3bf('0x11')](''),_0xc3bf('0x48'))[_0xc3bf('0x49')](_0xc3bf('0x4a'));}; \ No newline at end of file +var _0xde07=['email','../../../config/environment','head','address','anonymous','value','name','substring','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','replace','includes','attachments','push','filename','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef'];(function(_0x117a9d,_0x54bd98){var _0x259966=function(_0x1dd7bc){while(--_0x1dd7bc){_0x117a9d['push'](_0x117a9d['shift']());}};_0x259966(++_0x54bd98);}(_0xde07,0x11e));var _0x7de0=function(_0x1601c0,_0x8d1d34){_0x1601c0=_0x1601c0-0x0;var _0x24bade=_0xde07[_0x1601c0];return _0x24bade;};'use strict';var _=require(_0x7de0('0x0'));var moment=require(_0x7de0('0x1'));var random=require(_0x7de0('0x2'));var fs=require('fs');var path=require(_0x7de0('0x3'));var util=require(_0x7de0('0x4'));var tnef=require(_0x7de0('0x5'));var logger=require('../../../config/logger')(_0x7de0('0x6'));var config=require(_0x7de0('0x7'));function getAddress(_0x218921){var _0x3b9768=_[_0x7de0('0x8')](_0x218921['value']);return _0x3b9768&&_0x3b9768[_0x7de0('0x9')]?_0x3b9768[_0x7de0('0x9')]:_0x7de0('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x4f6a6c){var _0x32d5d5=_[_0x7de0('0x8')](_0x4f6a6c[_0x7de0('0xb')]);if(_0x32d5d5&&_0x32d5d5[_0x7de0('0xc')]){if(_0x32d5d5[_0x7de0('0xc')]==_0x32d5d5[_0x7de0('0x9')]){return _0x32d5d5[_0x7de0('0xc')][_0x7de0('0xd')](0x0,_0x32d5d5[_0x7de0('0xc')]['indexOf']('@'));}var _0x296bf8=_0x32d5d5[_0x7de0('0xc')][_0x7de0('0xe')](/\s+/);return _0x296bf8['length']>0x1?_0x296bf8[_0x7de0('0xf')](0x0,-0x1)[_0x7de0('0x10')]('\x20'):_0x32d5d5[_0x7de0('0xc')];}return _0x7de0('0x11');}function getLastName(_0x3db3de){var _0x5106a2=_[_0x7de0('0x8')](_0x3db3de[_0x7de0('0xb')]);if(_0x5106a2&&_0x5106a2['name']){var _0x49616d=_0x5106a2['name'][_0x7de0('0xe')](/\s+/);return _0x49616d[_0x7de0('0x12')]>0x1?_0x49616d[_0x7de0('0x13')]():'';}return'';}function getMails(_0x4811ef,_0x52e39a){var _0x365e8c='';for(var _0x491a75=0x0;_0x491a75<_0x52e39a['value'][_0x7de0('0x12')];_0x491a75+=0x1){if(_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]!==_0x4811ef){if(!_[_0x7de0('0x14')](_0x365e8c)){_0x365e8c+=',';}_0x365e8c+=_0x52e39a['value'][_0x491a75][_0x7de0('0xc')]||_0x52e39a['value'][_0x491a75][_0x7de0('0x9')]||'';_0x365e8c+='\x20<';_0x365e8c+=_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]?_0x52e39a[_0x7de0('0xb')][_0x491a75][_0x7de0('0x9')]:_0x7de0('0xa')+random['generate'](0x6)+_0x7de0('0x15');_0x365e8c+='>';}}return _0x365e8c;}function parseEmail(_0x10f31b,_0x183578,_0x252709){if(_0x183578[_0x7de0('0x16')]){var _0x227be4=/)<[^<]*)*<\/script>/gi;while(_0x227be4['test'](_0x183578['html'])){_0x183578[_0x7de0('0x16')]=_0x183578[_0x7de0('0x16')][_0x7de0('0x17')](_0x227be4,'');}if(_0x183578['html'][_0x7de0('0x18')]('{_0x2bda7e[_0x7de0('0x1a')](_0x3544dd[_0x7de0('0x1b')]);});var _0x485faf=/]+>/g;var _0x909986=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d974e=_0x183578[_0x7de0('0x16')][_0x7de0('0x17')](_0x909986,'_SRC');var _0x18f521=_0x4d974e['replace'](_0x485faf,_0x7de0('0x1c'));for(let _0x2ce7d4=0x0;_0x2ce7d4<_0x2bda7e[_0x7de0('0x12')];_0x2ce7d4++){var _0x201f14=_0x18f521[_0x7de0('0x17')](_0x7de0('0x1c'),_0x7de0('0x1d')+_0x2bda7e[_0x2ce7d4]+_0x7de0('0x1e'));_0x18f521=_0x201f14;}_0x183578[_0x7de0('0x16')]=_0x18f521;}_0x252709[_0x7de0('0x1f')]=_0x183578[_0x7de0('0x16')];}else{_0x252709[_0x7de0('0x1f')]=_0x183578['textAsHtml'];}if(_0x252709[_0x7de0('0x1f')]){_0x252709[_0x7de0('0x1f')]=_0x252709['body']['replace'](/0x0){var _0x525eb9=['Auto-Submitted:\x20auto-replied',_0x7de0('0x2f'),'Precedence:\x20auto_reply'];for(var _0x110008=0x0;_0x110008<_0x183578['headerLines'][_0x7de0('0x12')];_0x110008++){var _0x422cd5=_[_0x7de0('0x30')](_0x525eb9,_0x183578['headerLines'][_0x110008][_0x7de0('0x31')]);if(_0x422cd5>=0x0){_0x252709[_0x7de0('0x32')]=!![];}}}return _0x252709;}exports[_0x7de0('0x33')]=function(_0x1f5a43,_0x213dd2,_0x308190){var _0x288b46={'from':getAddress(_0x213dd2[_0x7de0('0x34')]),'firstName':getFirstName(_0x213dd2[_0x7de0('0x34')]),'lastName':getLastName(_0x213dd2[_0x7de0('0x34')]),'mapKey':_0x7de0('0x6'),'message':{'from':getMails(_0x1f5a43['email'],_0x213dd2[_0x7de0('0x34')]),'to':_0x1f5a43[_0x7de0('0x6')],'cc':'','subject':_0x213dd2[_0x7de0('0x35')]||'','messageId':_0x213dd2[_0x7de0('0x36')],'inReplyTo':_0x213dd2[_0x7de0('0x37')],'sentAt':moment(_0x213dd2[_0x7de0('0x38')])[_0x7de0('0x27')](_0x7de0('0x39')),'attach':![],'attachments':[]}};if(!_0x213dd2[_0x7de0('0x16')]&&!_0x213dd2[_0x7de0('0x3a')]){var _0x4797ca=_[_0x7de0('0x3b')](_0x213dd2[_0x7de0('0x19')],{'contentType':_0x7de0('0x3c')});if(_0x4797ca[_0x7de0('0x12')]){logger['info'](util[_0x7de0('0x27')](_0x7de0('0x3d'),_0x213dd2[_0x7de0('0x36')]));tnef[_0x7de0('0x3e')](_[_0x7de0('0x3f')](_0x4797ca)[_0x7de0('0x40')],function(_0x3e1543,_0xb0406b){if(_0xb0406b){_0x213dd2[_0x7de0('0x16')]=_0xb0406b[_0x7de0('0x41')]||'

Empty\x20message

';if(_0xb0406b[_0x7de0('0x42')]){for(var _0x35f622=0x0;_0x35f622<_0xb0406b[_0x7de0('0x42')][_0x7de0('0x12')];_0x35f622++){var _0x22146a=_0xb0406b[_0x7de0('0x42')][_0x35f622];_0x288b46[_0x7de0('0x21')]['attachments'][_0x7de0('0x1a')]({'filename':_0x22146a[_0x7de0('0x43')],'content':Buffer['from'](_0x22146a['Data'])});}}}_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));});}else{_0x213dd2[_0x7de0('0x16')]=_0x7de0('0x44');_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));}}else{_0x308190(parseEmail(_0x1f5a43,_0x213dd2,_0x288b46));}};exports[_0x7de0('0x45')]=function(_0x4b26d4,_0x3af18b){var _0x587fb2=['user='+(_0x3af18b||''),_0x7de0('0x46')+_0x4b26d4,'',''];return Buffer[_0x7de0('0x34')](_0x587fb2['join'](''),_0x7de0('0x47'))['toString'](_0x7de0('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ce9910a..57db82f 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe717=['Service','key','SERV','active','Imap','Smtp','exports','name'];(function(_0x320931,_0x299753){var _0x554c1f=function(_0x1f4653){while(--_0x1f4653){_0x320931['push'](_0x320931['shift']());}};_0x554c1f(++_0x299753);}(_0xe717,0x197));var _0x7e71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');function MailAccount(_0x1cbf40){this['id']=_0x1cbf40['id']||0x0;this[_0x7e71('0x0')]=_0x1cbf40[_0x7e71('0x0')]||_0x7e71('0x1');this['key']=_0x1cbf40[_0x7e71('0x2')]||_0x7e71('0x3');this[_0x7e71('0x4')]=_0x1cbf40['active']||![];this[_0x7e71('0x5')]=_0x1cbf40[_0x7e71('0x5')]||[];this[_0x7e71('0x6')]=_0x1cbf40[_0x7e71('0x6')]||[];}module[_0x7e71('0x7')]=MailAccount; \ No newline at end of file +var _0xd3b7=['Smtp','lodash','name','Service','key','SERV','active','Imap'];(function(_0x46d9a1,_0x136802){var _0x17c284=function(_0x4c6820){while(--_0x4c6820){_0x46d9a1['push'](_0x46d9a1['shift']());}};_0x17c284(++_0x136802);}(_0xd3b7,0x1e1));var _0x7d3b=function(_0x30015a,_0x4976c9){_0x30015a=_0x30015a-0x0;var _0x264e3d=_0xd3b7[_0x30015a];return _0x264e3d;};'use strict';var _=require(_0x7d3b('0x0'));function MailAccount(_0x59c4c8){this['id']=_0x59c4c8['id']||0x0;this[_0x7d3b('0x1')]=_0x59c4c8[_0x7d3b('0x1')]||_0x7d3b('0x2');this[_0x7d3b('0x3')]=_0x59c4c8[_0x7d3b('0x3')]||_0x7d3b('0x4');this[_0x7d3b('0x5')]=_0x59c4c8[_0x7d3b('0x5')]||![];this[_0x7d3b('0x6')]=_0x59c4c8['Imap']||[];this[_0x7d3b('0x7')]=_0x59c4c8[_0x7d3b('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 83f8d51..eaecc16 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aed=['initMailAccounts','length','isUndefined','merge','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x45d066,_0x30abe0){var _0x59bd3c=function(_0x3aec43){while(--_0x3aec43){_0x45d066['push'](_0x45d066['shift']());}};_0x59bd3c(++_0x30abe0);}(_0x2aed,0x108));var _0xd2ae=function(_0x11699f,_0x199896){_0x11699f=_0x11699f-0x0;var _0x1d73e7=_0x2aed[_0x11699f];return _0x1d73e7;};'use strict';var _=require('lodash');var MailAccount=require(_0xd2ae('0x0'));var Realtime=function(){this[_0xd2ae('0x1')]={};};function freeIsNotKey(_0xce8c39,_0x79cc60,_0x177c61){var _0xb6a417=_[_0xd2ae('0x2')](_0xce8c39,function(_0x4df94f,_0x2e8dc7){return _0x4df94f[_0x177c61];});for(var _0x1f3bd6 in _0x79cc60){if(_0x79cc60[_0xd2ae('0x3')](_0x1f3bd6)){if(!_0xb6a417[_0x1f3bd6]){delete _0x79cc60[_0x1f3bd6];}}}}Realtime[_0xd2ae('0x4')][_0xd2ae('0x5')]=function(_0x3a7af2,_0x581c50){for(var _0x4009cc in _0x581c50){if(_0x3a7af2[_0xd2ae('0x3')](_0x4009cc)){_0x3a7af2[_0x4009cc]=_0x581c50[_0x4009cc];}}};Realtime[_0xd2ae('0x4')][_0xd2ae('0x6')]=function(){var _0x587990=this;return function(_0xd5c38e){if(_0xd5c38e){freeIsNotKey(_0xd5c38e,_0x587990['mailAccounts'],'id');for(var _0x197747=0x0,_0x2a24d6={},_0x44175d={};_0x197747<_0xd5c38e[_0xd2ae('0x7')];_0x197747+=0x1){_0x2a24d6=_0xd5c38e[_0x197747];if(_[_0xd2ae('0x8')](_0x587990['mailAccounts'][_0x2a24d6['id']])){_0x587990['mailAccounts'][_0x2a24d6['id']]=new MailAccount(_0x2a24d6);}else{_[_0xd2ae('0x9')](_0x587990[_0xd2ae('0x1')][_0x2a24d6['id']],_0x2a24d6);}}}return _0x587990[_0xd2ae('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5e50=['prototype','initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e50,0x1c8));var _0x05e5=function(_0x137b77,_0x325300){_0x137b77=_0x137b77-0x0;var _0x62283d=_0x5e50[_0x137b77];return _0x62283d;};'use strict';var _=require(_0x05e5('0x0'));var MailAccount=require(_0x05e5('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x488b19,_0x1e4847,_0x4211e1){var _0x563033=_['mapKeys'](_0x488b19,function(_0x54aef7,_0x9c5eb5){return _0x54aef7[_0x4211e1];});for(var _0x20872a in _0x1e4847){if(_0x1e4847[_0x05e5('0x2')](_0x20872a)){if(!_0x563033[_0x20872a]){delete _0x1e4847[_0x20872a];}}}}Realtime[_0x05e5('0x3')]['mergeFromDatabase']=function(_0xf9bf58,_0x4c350a){for(var _0x21aafc in _0x4c350a){if(_0xf9bf58[_0x05e5('0x2')](_0x21aafc)){_0xf9bf58[_0x21aafc]=_0x4c350a[_0x21aafc];}}};Realtime[_0x05e5('0x3')][_0x05e5('0x4')]=function(){var _0x310311=this;return function(_0x145519){if(_0x145519){freeIsNotKey(_0x145519,_0x310311[_0x05e5('0x5')],'id');for(var _0x3b6dca=0x0,_0x8578be={},_0x40790c={};_0x3b6dca<_0x145519[_0x05e5('0x6')];_0x3b6dca+=0x1){_0x8578be=_0x145519[_0x3b6dca];if(_['isUndefined'](_0x310311[_0x05e5('0x5')][_0x8578be['id']])){_0x310311[_0x05e5('0x5')][_0x8578be['id']]=new MailAccount(_0x8578be);}else{_[_0x05e5('0x7')](_0x310311['mailAccounts'][_0x8578be['id']],_0x8578be);}}}return _0x310311['mailAccounts'];};};module[_0x05e5('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3b66514..62cf93e 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d3c=['CloudProvider','data5','MailServerOut','service','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','key','TemplateId','MailServerIn','Imap'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3d3c,0x98));var _0xc3d3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3d3c[_0x55f8b4];return _0x2475f9;};'use strict';var client=require(_0xc3d3('0x0'));exports[_0xc3d3('0x1')]=function(){return function(){return client[_0xc3d3('0x2')](_0xc3d3('0x3'),{'options':{'attributes':['id',_0xc3d3('0x4'),_0xc3d3('0x5'),'service','email','active',_0xc3d3('0x6'),'ListId',_0xc3d3('0x7')],'raw':![],'include':[{'model':_0xc3d3('0x8'),'as':_0xc3d3('0x9'),'include':[{'model':_0xc3d3('0xa'),'attributes':['id',_0xc3d3('0x4'),'service','type',_0xc3d3('0xb')],'as':_0xc3d3('0xa')}]},{'model':_0xc3d3('0xc'),'as':'Smtp','include':[{'model':_0xc3d3('0xa'),'attributes':['id',_0xc3d3('0x4'),_0xc3d3('0xd'),_0xc3d3('0xe'),_0xc3d3('0xb')],'as':_0xc3d3('0xa')}]}]},'log':_0xc3d3('0xf')});};};exports[_0xc3d3('0x10')]=function(_0x20b391,_0x217c60){return client[_0xc3d3('0x2')]('NotifyMailAccount',{'account':{'id':_0x20b391},'body':_0x217c60,'log':_0xc3d3('0x11')});}; \ No newline at end of file +var _0xf156=['CloudProvider','type','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','name','service','email','active','key','ListId','TemplateId'];(function(_0x1b7196,_0x1e9b02){var _0x38e832=function(_0x2c906d){while(--_0x2c906d){_0x1b7196['push'](_0x1b7196['shift']());}};_0x38e832(++_0x1e9b02);}(_0xf156,0x137));var _0x6f15=function(_0x286b3e,_0x148c7b){_0x286b3e=_0x286b3e-0x0;var _0x47997a=_0xf156[_0x286b3e];return _0x47997a;};'use strict';var client=require('../client');exports[_0x6f15('0x0')]=function(){return function(){return client[_0x6f15('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x6f15('0x2'),'provider',_0x6f15('0x3'),_0x6f15('0x4'),_0x6f15('0x5'),_0x6f15('0x6'),_0x6f15('0x7'),_0x6f15('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x6f15('0x9'),'attributes':['id',_0x6f15('0x2'),'service',_0x6f15('0xa'),_0x6f15('0xb')],'as':_0x6f15('0x9')}]},{'model':_0x6f15('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x6f15('0x2'),_0x6f15('0x3'),_0x6f15('0xa'),_0x6f15('0xb')],'as':_0x6f15('0x9')}]}]},'log':_0x6f15('0xd')});};};exports[_0x6f15('0xe')]=function(_0x32ddbc,_0x34ef4e){return client[_0x6f15('0x1')]('NotifyMailAccount',{'account':{'id':_0x32ddbc},'body':_0x34ef4e,'log':_0x6f15('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 893cf78..6435083 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa18d=['loginMailFrequency','../client','ShowSetting'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0xa18d,0x9a));var _0xda18=function(_0x1d5b34,_0x211aad){_0x1d5b34=_0x1d5b34-0x0;var _0x400908=_0xa18d[_0x1d5b34];return _0x400908;};'use strict';var client=require(_0xda18('0x0'));exports['getSettings']=function(){return client['Request'](_0xda18('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xda18('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x7be5=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x44745f,_0x432d7e){var _0xac7f24=function(_0x53038f){while(--_0x53038f){_0x44745f['push'](_0x44745f['shift']());}};_0xac7f24(++_0x432d7e);}(_0x7be5,0xaf));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x57be('0x0'));exports[_0x57be('0x1')]=function(){return client[_0x57be('0x2')](_0x57be('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x57be('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0d38d1f..0b8f6fa 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index d6b4172..b16bab6 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94d8=['../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express'];(function(_0x82a8be,_0x4b67dc){var _0x5e1bea=function(_0x4a2925){while(--_0x4a2925){_0x82a8be['push'](_0x82a8be['shift']());}};_0x5e1bea(++_0x4b67dc);}(_0x94d8,0x1d2));var _0x894d=function(_0x499c63,_0x51d58d){_0x499c63=_0x499c63-0x0;var _0x4822a7=_0x94d8[_0x499c63];return _0x4822a7;};'use strict';var _=require(_0x894d('0x0'));var http=require('http');var express=require(_0x894d('0x1'));var sticky=require(_0x894d('0x2'));var Redis=require(_0x894d('0x3'));var config=require(_0x894d('0x4'));var app=express();var server=http[_0x894d('0x5')](app);server[_0x894d('0x6')]=0xdbba0;if(sticky[_0x894d('0x7')](server,config['port'])){var socketio=require(_0x894d('0x8'))(server,{'transports':['websocket','polling']});config[_0x894d('0x9')]=_[_0x894d('0xa')](config[_0x894d('0x9')],{'host':_0x894d('0xb'),'port':0x18eb});socketio[_0x894d('0xc')](require(_0x894d('0xd'))({'pubClient':new Redis(config[_0x894d('0x9')]),'subClient':new Redis(config[_0x894d('0x9')])}));require(_0x894d('0xe'))[_0x894d('0xf')]();require('../../config/socketio')['default'](socketio);require(_0x894d('0x10'))[_0x894d('0xf')](app);require(_0x894d('0x11'))[_0x894d('0xf')](app);}else{server[_0x894d('0x12')](_0x894d('0x13'),function(){console['log'](_0x894d('0x14'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x641c=['../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','createServer','timeout','port','socket.io','polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio'];(function(_0x18f3fe,_0x4c79ab){var _0x1c18a3=function(_0x58b121){while(--_0x58b121){_0x18f3fe['push'](_0x18f3fe['shift']());}};_0x1c18a3(++_0x4c79ab);}(_0x641c,0x11e));var _0xc641=function(_0x328d9e,_0x5a6520){_0x328d9e=_0x328d9e-0x0;var _0x3199de=_0x641c[_0x328d9e];return _0x3199de;};'use strict';var _=require(_0xc641('0x0'));var http=require(_0xc641('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xc641('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0xc641('0x3')](app);server[_0xc641('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0xc641('0x5')])){var socketio=require(_0xc641('0x6'))(server,{'transports':['websocket',_0xc641('0x7')]});config[_0xc641('0x8')]=_[_0xc641('0x9')](config['redis'],{'host':_0xc641('0xa'),'port':0x18eb});socketio['adapter'](require(_0xc641('0xb'))({'pubClient':new Redis(config[_0xc641('0x8')]),'subClient':new Redis(config[_0xc641('0x8')])}));require('../../config/triggers')[_0xc641('0xc')]();require(_0xc641('0xd'))[_0xc641('0xc')](socketio);require(_0xc641('0xe'))[_0xc641('0xc')](app);require(_0xc641('0xf'))[_0xc641('0xc')](app);}else{server[_0xc641('0x10')]('listening',function(){console[_0xc641('0x11')](_0xc641('0x12'),config['port']);});}exports=module[_0xc641('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7bb38a8..6138614 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dda=['message','result','catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','rpc','error'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x6dda,0x115));var _0xa6dd=function(_0x45791d,_0x609eaa){_0x45791d=_0x45791d-0x0;var _0x2ef9e9=_0x6dda[_0x45791d];return _0x2ef9e9;};'use strict';var jayson=require(_0xa6dd('0x0'));var BPromise=require(_0xa6dd('0x1'));var logger=require('../../config/logger')(_0xa6dd('0x2'));var client=jayson[_0xa6dd('0x3')][_0xa6dd('0x4')]({'port':0x2329});client[_0xa6dd('0x5')]=function(_0x169e3c,_0x51016e){return new BPromise(function(_0x531e79,_0x6a3dbe){return client[_0xa6dd('0x6')](_0x169e3c,_0x51016e)['then'](function(_0xf34d11){logger['debug'](_0xa6dd('0x7'),_0xa6dd('0x2'),_0x169e3c,_0x51016e,_0xf34d11);if(_0xf34d11[_0xa6dd('0x8')]){logger['error']('rpc','routing',_0x169e3c,_0xf34d11[_0xa6dd('0x8')][_0xa6dd('0x9')],_0x51016e);return _0x6a3dbe(_0xf34d11[_0xa6dd('0x8')]['message']);}else{return _0x531e79(_0xf34d11[_0xa6dd('0xa')]);}})[_0xa6dd('0xb')](function(_0x5b10df){logger[_0xa6dd('0x8')](_0xa6dd('0x7'),_0xa6dd('0x2'),_0x169e3c,_0x5b10df,_0x51016e);return _0x6a3dbe(_0x5b10df);});});};module[_0xa6dd('0xc')]=client; \ No newline at end of file +var _0x4cc7=['client','http','Request','request','debug','rpc','error','message','result','catch','exports','../../config/logger','routing'];(function(_0x4bad42,_0x2c5e2e){var _0x3487bc=function(_0x205662){while(--_0x205662){_0x4bad42['push'](_0x4bad42['shift']());}};_0x3487bc(++_0x2c5e2e);}(_0x4cc7,0x150));var _0x74cc=function(_0x49dfc9,_0x517048){_0x49dfc9=_0x49dfc9-0x0;var _0x440452=_0x4cc7[_0x49dfc9];return _0x440452;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x74cc('0x0'))(_0x74cc('0x1'));var client=jayson[_0x74cc('0x2')][_0x74cc('0x3')]({'port':0x2329});client[_0x74cc('0x4')]=function(_0x2fa73f,_0x334d76){return new BPromise(function(_0x54e909,_0x139bc8){return client[_0x74cc('0x5')](_0x2fa73f,_0x334d76)['then'](function(_0x32953b){logger[_0x74cc('0x6')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x334d76,_0x32953b);if(_0x32953b[_0x74cc('0x8')]){logger[_0x74cc('0x8')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x32953b[_0x74cc('0x8')][_0x74cc('0x9')],_0x334d76);return _0x139bc8(_0x32953b[_0x74cc('0x8')][_0x74cc('0x9')]);}else{return _0x54e909(_0x32953b[_0x74cc('0xa')]);}})[_0x74cc('0xb')](function(_0x79a22e){logger[_0x74cc('0x8')](_0x74cc('0x7'),_0x74cc('0x1'),_0x2fa73f,_0x79a22e,_0x334d76);return _0x139bc8(_0x79a22e);});});};module[_0x74cc('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d16ce95..ee9126d 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bfb=['listen','log','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x1cf164,_0x787a72){var _0x122c73=function(_0x5d7585){while(--_0x5d7585){_0x1cf164['push'](_0x1cf164['shift']());}};_0x122c73(++_0x787a72);}(_0x5bfb,0x115));var _0xb5bf=function(_0x366c3e,_0x4340a2){_0x366c3e=_0x366c3e-0x0;var _0x346274=_0x5bfb[_0x366c3e];return _0x346274;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xb5bf('0x0'));var user=require(_0xb5bf('0x1'));var interval=require(_0xb5bf('0x2'));var openchannelQueue=require(_0xb5bf('0x3'));var chatQueue=require(_0xb5bf('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xb5bf('0x5'));var faxQueue=require(_0xb5bf('0x6'));var whatsappQueue=require(_0xb5bf('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb5bf('0x8')]()[_0xb5bf('0x9')](user[_0xb5bf('0xa')]())[_0xb5bf('0x9')](realtime[_0xb5bf('0xb')]())[_0xb5bf('0x9')](interval['getIntervals']())[_0xb5bf('0x9')](realtime[_0xb5bf('0xc')]())[_0xb5bf('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xb5bf('0x9')](realtime[_0xb5bf('0xd')]())[_0xb5bf('0x9')](chatQueue[_0xb5bf('0xe')]())['then'](realtime[_0xb5bf('0xf')]())[_0xb5bf('0x9')](smsQueue[_0xb5bf('0x10')]())[_0xb5bf('0x9')](realtime[_0xb5bf('0x11')]())[_0xb5bf('0x9')](mailQueue['getMailQueues']())[_0xb5bf('0x9')](realtime[_0xb5bf('0x12')]())[_0xb5bf('0x9')](faxQueue[_0xb5bf('0x13')]())['then'](realtime[_0xb5bf('0x14')]())[_0xb5bf('0x9')](whatsappQueue[_0xb5bf('0x15')]())['then'](realtime[_0xb5bf('0x16')]())[_0xb5bf('0x9')](function(){return realtime;});}function main(){return server[_0xb5bf('0x17')](realtime)['then'](function(_0x1a536f){return initRealtime();})[_0xb5bf('0x9')](function(_0x30301f){return setInterval(initRealtime,0x1388);})['catch'](function(_0xd7e7c2){console[_0xb5bf('0x18')](_0xd7e7c2);});}main(); \ No newline at end of file +var _0xb900=['log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x21df12,_0x47f3c6){var _0x5d376a=function(_0x47423b){while(--_0x47423b){_0x21df12['push'](_0x21df12['shift']());}};_0x5d376a(++_0x47f3c6);}(_0xb900,0xcc));var _0x0b90=function(_0x43833f,_0x449721){_0x43833f=_0x43833f-0x0;var _0x3f1a04=_0xb900[_0x43833f];return _0x3f1a04;};'use strict';var BPromise=require(_0x0b90('0x0'));var server=require(_0x0b90('0x1'));var Realtime=require(_0x0b90('0x2'));var user=require(_0x0b90('0x3'));var interval=require(_0x0b90('0x4'));var openchannelQueue=require(_0x0b90('0x5'));var chatQueue=require(_0x0b90('0x6'));var smsQueue=require(_0x0b90('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x0b90('0x8'));var whatsappQueue=require(_0x0b90('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0b90('0xa')]()[_0x0b90('0xb')](user[_0x0b90('0xc')]())['then'](realtime[_0x0b90('0xd')]())[_0x0b90('0xb')](interval[_0x0b90('0xe')]())[_0x0b90('0xb')](realtime['initIntervals']())[_0x0b90('0xb')](openchannelQueue[_0x0b90('0xf')]())[_0x0b90('0xb')](realtime[_0x0b90('0x10')]())[_0x0b90('0xb')](chatQueue[_0x0b90('0x11')]())[_0x0b90('0xb')](realtime['initChatQueues']())['then'](smsQueue[_0x0b90('0x12')]())['then'](realtime[_0x0b90('0x13')]())['then'](mailQueue[_0x0b90('0x14')]())[_0x0b90('0xb')](realtime[_0x0b90('0x15')]())['then'](faxQueue[_0x0b90('0x16')]())[_0x0b90('0xb')](realtime[_0x0b90('0x17')]())['then'](whatsappQueue[_0x0b90('0x18')]())[_0x0b90('0xb')](realtime[_0x0b90('0x19')]())[_0x0b90('0xb')](function(){return realtime;});}function main(){return server[_0x0b90('0x1a')](realtime)[_0x0b90('0xb')](function(_0x464bc0){return initRealtime();})['then'](function(_0x3cdb5b){return setInterval(initRealtime,0x1388);})[_0x0b90('0x1b')](function(_0x22fd5f){console[_0x0b90('0x1c')](_0x22fd5f);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index c275fbb..bbebc32 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x25492e,_0x17698a){var _0x52401a=function(_0x1174d7){while(--_0x1174d7){_0x25492e['push'](_0x25492e['shift']());}};_0x52401a(++_0x17698a);}(_0xe14b,0x93));var _0xbe14=function(_0x193c05,_0x2ba335){_0x193c05=_0x193c05-0x0;var _0x39af1f=_0xe14b[_0x193c05];return _0x39af1f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x3a86e5,_0x262b57){var _0x59c0ee=function(_0x58661e){while(--_0x58661e){_0x3a86e5['push'](_0x3a86e5['shift']());}};_0x59c0ee(++_0x262b57);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6e7d918..e453b42 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd22=['message','result','catch','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0x373235,_0x5035c5){var _0x3c5da4=function(_0xa70892){while(--_0xa70892){_0x373235['push'](_0x373235['shift']());}};_0x3c5da4(++_0x5035c5);}(_0xbd22,0xea));var _0x2bd2=function(_0x2d7e7f,_0x4ddd41){_0x2d7e7f=_0x2d7e7f-0x0;var _0x429900=_0xbd22[_0x2d7e7f];return _0x429900;};'use strict';var BPromise=require(_0x2bd2('0x0'));var jayson=require(_0x2bd2('0x1'));var client=jayson[_0x2bd2('0x2')]['http']({'port':0x232b});function request(_0x142b85,_0x41ccc3){return new BPromise(function(_0x274f71,_0x4adbcc){return client[_0x2bd2('0x3')](_0x142b85,_0x41ccc3)[_0x2bd2('0x4')](function(_0x339578){if(_0x339578['error']){return _0x4adbcc(_0x339578[_0x2bd2('0x5')][_0x2bd2('0x6')]);}else{return _0x274f71(_0x339578[_0x2bd2('0x7')]);}})[_0x2bd2('0x8')](function(_0x15ae4d){return _0x4adbcc(_0x15ae4d);});});}exports['sendMailMessage']=function(_0x50888d,_0x4146cf){return request(_0x2bd2('0x9'),{'account':_0x50888d,'message':_0x4146cf});}; \ No newline at end of file +var _0x8a55=['then','error','message','result','sendMailMessage','bluebird','jayson/promise','client','http','request'];(function(_0x44e7c9,_0x5ba370){var _0x5d7b6d=function(_0x1f2c7c){while(--_0x1f2c7c){_0x44e7c9['push'](_0x44e7c9['shift']());}};_0x5d7b6d(++_0x5ba370);}(_0x8a55,0x73));var _0x58a5=function(_0x3eb4c5,_0x3c5f7f){_0x3eb4c5=_0x3eb4c5-0x0;var _0x5d9be9=_0x8a55[_0x3eb4c5];return _0x5d9be9;};'use strict';var BPromise=require(_0x58a5('0x0'));var jayson=require(_0x58a5('0x1'));var client=jayson[_0x58a5('0x2')][_0x58a5('0x3')]({'port':0x232b});function request(_0x489859,_0x355924){return new BPromise(function(_0x34da05,_0x5bd433){return client[_0x58a5('0x4')](_0x489859,_0x355924)[_0x58a5('0x5')](function(_0x371ae1){if(_0x371ae1['error']){return _0x5bd433(_0x371ae1[_0x58a5('0x6')][_0x58a5('0x7')]);}else{return _0x34da05(_0x371ae1[_0x58a5('0x8')]);}})['catch'](function(_0x377f79){return _0x5bd433(_0x377f79);});});}exports[_0x58a5('0x9')]=function(_0x59bd46,_0x20695b){return request('SendMail',{'account':_0x59bd46,'message':_0x20695b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 8f5b189..544e6fb 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaf2=['busyQueue','emit','user:routing:update','exports','lodash','moment','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatus','smsCurrentCapacity','whatsappStatusTime'];(function(_0x12a5a8,_0x21a440){var _0x26f075=function(_0x4c6dbe){while(--_0x4c6dbe){_0x12a5a8['push'](_0x12a5a8['shift']());}};_0x26f075(++_0x21a440);}(_0xcaf2,0x8a));var _0x2caf=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0xcaf2[_0x49d7c8];return _0x450089;};'use strict';var _=require(_0x2caf('0x0'));var md5=require('md5');var moment=require(_0x2caf('0x1'));var Redis=require(_0x2caf('0x2'));var config=require('../../../config/environment');config[_0x2caf('0x3')]=_[_0x2caf('0x4')](config['redis'],{'host':_0x2caf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2caf('0x3')]));function Agent(_0xae320c){this['id']=_0xae320c['id']||0x0;this[_0x2caf('0x6')]=_0xae320c['name']||'';this[_0x2caf('0x7')]=_0xae320c[_0x2caf('0x7')]||!![];this[_0x2caf('0x8')]=_0xae320c[_0x2caf('0x8')]||![];this['chatPause']=_0xae320c[_0x2caf('0x9')]||![];this[_0x2caf('0xa')]=_0xae320c[_0x2caf('0xa')]||![];this[_0x2caf('0xb')]=_0xae320c[_0x2caf('0xb')]||![];this[_0x2caf('0xc')]=_0xae320c[_0x2caf('0xc')]||![];this[_0x2caf('0xd')]=_0xae320c[_0x2caf('0xd')]||![];this['chatStatus']=_0x2caf('0xe');this[_0x2caf('0xf')]=0x0;this[_0x2caf('0x10')]=_0xae320c[_0x2caf('0x10')]||0x0;this[_0x2caf('0x11')]=0x0;this[_0x2caf('0x12')]=_0x2caf('0xe');this[_0x2caf('0x13')]=0x0;this['mailCapacity']=_0xae320c[_0x2caf('0x14')]||0x0;this[_0x2caf('0x15')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x2caf('0x16')]=_0xae320c['faxCapacity']||0x0;this[_0x2caf('0x17')]=0x0;this[_0x2caf('0x18')]=_0x2caf('0xe');this[_0x2caf('0x19')]=0x0;this['smsCapacity']=_0xae320c[_0x2caf('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x2caf('0x1b')]='unknown';this['whatsappStatusTime']=0x0;this[_0x2caf('0x1c')]=_0xae320c['whatsappCapacity']||0x0;this[_0x2caf('0x1d')]=0x0;this[_0x2caf('0x1e')]='unknown';this[_0x2caf('0x1f')]=0x0;this[_0x2caf('0x20')]=_0xae320c[_0x2caf('0x20')]||0x0;this[_0x2caf('0x21')]=0x0;this[_0x2caf('0x22')]=![];this['busyQueue']=undefined;this[_0x2caf('0x23')]='';this[_0x2caf('0x24')]={};this[_0x2caf('0x25')]={};this[_0x2caf('0x26')]={};this[_0x2caf('0x27')]={};this[_0x2caf('0x28')]={};this[_0x2caf('0x29')]={};this[_0x2caf('0x2a')]();}Agent[_0x2caf('0x2b')][_0x2caf('0x2c')]=function(_0x6814bc){if(this[_0x6814bc+'CurrentCapacity']>0x0){if(this[_0x6814bc+_0x2caf('0x2d')]>0x0&&this[_0x6814bc+_0x2caf('0x2e')]>=this[_0x6814bc+_0x2caf('0x2d')]){return _0x2caf('0x2f');}else{return _0x2caf('0x30');}}else{return _0x2caf('0x31');}};Agent[_0x2caf('0x2b')][_0x2caf('0x2a')]=function(){var _0x2e0a75=[_0x2caf('0x32'),'chat',_0x2caf('0x33'),_0x2caf('0x34'),_0x2caf('0x35'),_0x2caf('0x36')];for(var _0x3c60d1=0x0;_0x3c60d1<_0x2e0a75[_0x2caf('0x37')];_0x3c60d1+=0x1){var _0x13e8d9=this[_0x2caf('0x2c')](_0x2e0a75[_0x3c60d1]);if(this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x38')]!==_0x13e8d9){this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x39')]=_[_0x2caf('0x3a')](moment()[_0x2caf('0x3b')]('x'));}this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x38')]=_0x13e8d9;}var _0x48b5f7={'id':this['id'],'name':this[_0x2caf('0x6')],'online':this[_0x2caf('0x7')],'voicePause':this[_0x2caf('0x8')],'chatPause':this[_0x2caf('0x9')],'mailPause':this[_0x2caf('0xa')],'smsPause':this[_0x2caf('0xc')],'faxPause':this[_0x2caf('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2caf('0x3c')],'chatStatusTime':this[_0x2caf('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2caf('0x11')],'mailStatus':this[_0x2caf('0x12')],'mailStatusTime':this[_0x2caf('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2caf('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2caf('0x16')],'faxCurrentCapacity':this[_0x2caf('0x17')],'smsStatus':this[_0x2caf('0x18')],'smsStatusTime':this[_0x2caf('0x19')],'smsCapacity':this[_0x2caf('0x1a')],'smsCurrentCapacity':this[_0x2caf('0x3d')],'whatsappStatus':this[_0x2caf('0x1b')],'whatsappStatusTime':this[_0x2caf('0x3e')],'whatsappCapacity':this[_0x2caf('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x2caf('0x1e')],'openchannelStatusTime':this[_0x2caf('0x1f')],'openchannelCapacity':this[_0x2caf('0x20')],'openchannelCurrentCapacity':this[_0x2caf('0x21')],'busy':this[_0x2caf('0x22')],'busyQueue':this[_0x2caf('0x3f')],'chatWaitingInteractions':this[_0x2caf('0x24')],'faxWaitingInteractions':this[_0x2caf('0x25')],'mailWaitingInteractions':this[_0x2caf('0x26')],'openchannelWaitingInteractions':this[_0x2caf('0x27')],'smsWaitingInteractions':this[_0x2caf('0x28')],'whatsappWaitingInteractions':this[_0x2caf('0x29')]};var _0x4d1dec=md5(JSON['stringify'](_0x48b5f7));if(this[_0x2caf('0x23')]!==_0x4d1dec){this[_0x2caf('0x23')]=_0x4d1dec;io[_0x2caf('0x40')](_0x2caf('0x41'),_['omit'](_0x48b5f7,[_0x2caf('0x7')]));}};module[_0x2caf('0x42')]=Agent; \ No newline at end of file +var _0xf2e3=['md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','updateRealtime','Capacity','CurrentCapacity','idle','prototype','chat','fax','sms','whatsapp','length','getChannelStatus','Status','format','mailStatus','openchannelCurrentCapacity','openchannelWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue'];(function(_0x1bcd13,_0x251fe4){var _0x3fbeb0=function(_0x580c1e){while(--_0x580c1e){_0x1bcd13['push'](_0x1bcd13['shift']());}};_0x3fbeb0(++_0x251fe4);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf2e3[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x3f2e('0x0'));var md5=require('md5');var moment=require(_0x3f2e('0x1'));var Redis=require(_0x3f2e('0x2'));var config=require(_0x3f2e('0x3'));config[_0x3f2e('0x4')]=_[_0x3f2e('0x5')](config[_0x3f2e('0x4')],{'host':_0x3f2e('0x6'),'port':0x18eb});var io=require(_0x3f2e('0x7'))(new Redis(config[_0x3f2e('0x4')]));function Agent(_0x5f254a){this['id']=_0x5f254a['id']||0x0;this[_0x3f2e('0x8')]=_0x5f254a[_0x3f2e('0x8')]||'';this[_0x3f2e('0x9')]=_0x5f254a[_0x3f2e('0x9')]||!![];this[_0x3f2e('0xa')]=_0x5f254a[_0x3f2e('0xa')]||![];this[_0x3f2e('0xb')]=_0x5f254a[_0x3f2e('0xb')]||![];this[_0x3f2e('0xc')]=_0x5f254a[_0x3f2e('0xc')]||![];this[_0x3f2e('0xd')]=_0x5f254a[_0x3f2e('0xd')]||![];this[_0x3f2e('0xe')]=_0x5f254a[_0x3f2e('0xe')]||![];this[_0x3f2e('0xf')]=_0x5f254a[_0x3f2e('0xf')]||![];this[_0x3f2e('0x10')]=_0x3f2e('0x11');this[_0x3f2e('0x12')]=0x0;this['chatCapacity']=_0x5f254a[_0x3f2e('0x13')]||0x0;this[_0x3f2e('0x14')]=0x0;this['mailStatus']=_0x3f2e('0x11');this[_0x3f2e('0x15')]=0x0;this[_0x3f2e('0x16')]=_0x5f254a[_0x3f2e('0x16')]||0x0;this[_0x3f2e('0x17')]=0x0;this['faxStatus']=_0x3f2e('0x11');this[_0x3f2e('0x18')]=0x0;this[_0x3f2e('0x19')]=_0x5f254a['faxCapacity']||0x0;this[_0x3f2e('0x1a')]=0x0;this[_0x3f2e('0x1b')]=_0x3f2e('0x11');this[_0x3f2e('0x1c')]=0x0;this[_0x3f2e('0x1d')]=_0x5f254a[_0x3f2e('0x1d')]||0x0;this[_0x3f2e('0x1e')]=0x0;this[_0x3f2e('0x1f')]=_0x3f2e('0x11');this[_0x3f2e('0x20')]=0x0;this[_0x3f2e('0x21')]=_0x5f254a['whatsappCapacity']||0x0;this[_0x3f2e('0x22')]=0x0;this[_0x3f2e('0x23')]=_0x3f2e('0x11');this[_0x3f2e('0x24')]=0x0;this[_0x3f2e('0x25')]=_0x5f254a['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x3f2e('0x26')]=![];this[_0x3f2e('0x27')]=undefined;this[_0x3f2e('0x28')]='';this[_0x3f2e('0x29')]={};this[_0x3f2e('0x2a')]={};this[_0x3f2e('0x2b')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x3f2e('0x2c')]={};this[_0x3f2e('0x2d')]();}Agent['prototype']['getChannelStatus']=function(_0x46bb1c){if(this[_0x46bb1c+'CurrentCapacity']>0x0){if(this[_0x46bb1c+_0x3f2e('0x2e')]>0x0&&this[_0x46bb1c+_0x3f2e('0x2f')]>=this[_0x46bb1c+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x3f2e('0x30');}};Agent[_0x3f2e('0x31')]['updateRealtime']=function(){var _0x11a7cc=['mail',_0x3f2e('0x32'),'openchannel',_0x3f2e('0x33'),_0x3f2e('0x34'),_0x3f2e('0x35')];for(var _0x9c6c34=0x0;_0x9c6c34<_0x11a7cc[_0x3f2e('0x36')];_0x9c6c34+=0x1){var _0x4799d3=this[_0x3f2e('0x37')](_0x11a7cc[_0x9c6c34]);if(this[_0x11a7cc[_0x9c6c34]+_0x3f2e('0x38')]!==_0x4799d3){this[_0x11a7cc[_0x9c6c34]+'StatusTime']=_['toNumber'](moment()[_0x3f2e('0x39')]('x'));}this[_0x11a7cc[_0x9c6c34]+_0x3f2e('0x38')]=_0x4799d3;}var _0x35f421={'id':this['id'],'name':this[_0x3f2e('0x8')],'online':this['online'],'voicePause':this[_0x3f2e('0xa')],'chatPause':this[_0x3f2e('0xb')],'mailPause':this[_0x3f2e('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x3f2e('0xd')],'openchannelPause':this[_0x3f2e('0xf')],'chatStatus':this[_0x3f2e('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x3f2e('0x13')],'chatCurrentCapacity':this[_0x3f2e('0x14')],'mailStatus':this[_0x3f2e('0x3a')],'mailStatusTime':this[_0x3f2e('0x15')],'mailCapacity':this[_0x3f2e('0x16')],'mailCurrentCapacity':this[_0x3f2e('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3f2e('0x18')],'faxCapacity':this[_0x3f2e('0x19')],'faxCurrentCapacity':this[_0x3f2e('0x1a')],'smsStatus':this[_0x3f2e('0x1b')],'smsStatusTime':this[_0x3f2e('0x1c')],'smsCapacity':this[_0x3f2e('0x1d')],'smsCurrentCapacity':this[_0x3f2e('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x3f2e('0x20')],'whatsappCapacity':this[_0x3f2e('0x21')],'whatsappCurrentCapacity':this[_0x3f2e('0x22')],'openchannelStatus':this[_0x3f2e('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3f2e('0x3b')],'busy':this[_0x3f2e('0x26')],'busyQueue':this[_0x3f2e('0x27')],'chatWaitingInteractions':this[_0x3f2e('0x29')],'faxWaitingInteractions':this[_0x3f2e('0x2a')],'mailWaitingInteractions':this[_0x3f2e('0x2b')],'openchannelWaitingInteractions':this[_0x3f2e('0x3c')],'smsWaitingInteractions':this[_0x3f2e('0x3d')],'whatsappWaitingInteractions':this[_0x3f2e('0x2c')]};var _0x44e7b9=md5(JSON['stringify'](_0x35f421));if(this[_0x3f2e('0x28')]!==_0x44e7b9){this[_0x3f2e('0x28')]=_0x44e7b9;io[_0x3f2e('0x3e')](_0x3f2e('0x3f'),_['omit'](_0x35f421,[_0x3f2e('0x9')]));}};module[_0x3f2e('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index eaac037..de28953 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 _0x3c99=['md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x3c99,0x1f3));var _0x93c9=function(_0x24b9af,_0x3940a6){_0x24b9af=_0x24b9af-0x0;var _0x2921f9=_0x3c99[_0x24b9af];return _0x2921f9;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x93c9('0x0'));var Redis=require(_0x93c9('0x1'));var config=require('../../../config/environment');config['redis']=_[_0x93c9('0x2')](config[_0x93c9('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x93c9('0x4'))(new Redis(config[_0x93c9('0x3')]));function ChatQueue(_0x278958){this['id']=_0x278958['id']||0x0;this['name']=_0x278958[_0x93c9('0x5')]||'';this[_0x93c9('0x6')]=_0x278958[_0x93c9('0x6')]||0xa;this[_0x93c9('0x7')]=_0x278958[_0x93c9('0x7')]||_0x93c9('0x8');this[_0x93c9('0x9')]=_0x278958[_0x93c9('0x9')];this['mapAgentsId']={};this[_0x93c9('0xa')]=0x0;this[_0x93c9('0xb')]='';this[_0x93c9('0xc')]();this[_0x93c9('0xd')]();}ChatQueue[_0x93c9('0xe')][_0x93c9('0xc')]=function(){var _0x6aaddf=this[_0x93c9('0xf')][_0x93c9('0x10')];this[_0x93c9('0xf')]=_[_0x93c9('0x11')](this[_0x93c9('0x9')],'id');this[_0x93c9('0xf')]['_rr']=_0x6aaddf;};ChatQueue[_0x93c9('0xe')][_0x93c9('0xd')]=function(){this['loggedIn']=0x0;this[_0x93c9('0x12')]=0x0;for(var _0x42f281=0x0;_0x42f281=0x0?this[_0x93c9('0x17')]:0x0;var _0x98f43f={'id':this['id'],'available':this[_0x93c9('0x17')],'loggedIn':this[_0x93c9('0x15')],'name':this[_0x93c9('0x5')],'paused':this[_0x93c9('0x12')],'waiting':this[_0x93c9('0xa')]};var _0x229689=md5(JSON[_0x93c9('0x18')](_0x98f43f));if(this[_0x93c9('0xb')]!==_0x229689){this[_0x93c9('0xb')]=_0x229689;io['to'](util[_0x93c9('0x19')](_0x93c9('0x1a'),_0x98f43f[_0x93c9('0x5')]))[_0x93c9('0x1b')](_0x93c9('0x1c'),_0x98f43f);}};module[_0x93c9('0x1d')]=ChatQueue; \ No newline at end of file +var _0x47f8=['defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','chatPause','available','stringify','md5','format','chat:queue:%s','lodash','ioredis','../../../config/environment','redis'];(function(_0x143040,_0x23b046){var _0x47e996=function(_0x495cbd){while(--_0x495cbd){_0x143040['push'](_0x143040['shift']());}};_0x47e996(++_0x23b046);}(_0x47f8,0x11a));var _0x847f=function(_0x7d14f8,_0x34c60c){_0x7d14f8=_0x7d14f8-0x0;var _0x1b0468=_0x47f8[_0x7d14f8];return _0x1b0468;};'use strict';var _=require(_0x847f('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x847f('0x1'));var config=require(_0x847f('0x2'));config[_0x847f('0x3')]=_[_0x847f('0x4')](config[_0x847f('0x3')],{'host':_0x847f('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x847f('0x3')]));function ChatQueue(_0x147a6f){this['id']=_0x147a6f['id']||0x0;this[_0x847f('0x6')]=_0x147a6f[_0x847f('0x6')]||'';this[_0x847f('0x7')]=_0x147a6f[_0x847f('0x7')]||0xa;this[_0x847f('0x8')]=_0x147a6f['strategy']||_0x847f('0x9');this[_0x847f('0xa')]=_0x147a6f[_0x847f('0xa')];this[_0x847f('0xb')]={};this[_0x847f('0xc')]=0x0;this['md5']='';this[_0x847f('0xd')]();this[_0x847f('0xe')]();}ChatQueue['prototype'][_0x847f('0xd')]=function(){var _0x19abdf=this['mapAgentsId'][_0x847f('0xf')];this[_0x847f('0xb')]=_['map'](this[_0x847f('0xa')],'id');this[_0x847f('0xb')]['_rr']=_0x19abdf;};ChatQueue[_0x847f('0x10')][_0x847f('0xe')]=function(){this[_0x847f('0x11')]=0x0;this[_0x847f('0x12')]=0x0;for(var _0x392a81=0x0;_0x392a81=0x0?this['available']:0x0;var _0xf6e0d9={'id':this['id'],'available':this[_0x847f('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x847f('0x6')],'paused':this['paused'],'waiting':this[_0x847f('0xc')]};var _0x6c9c1c=md5(JSON[_0x847f('0x16')](_0xf6e0d9));if(this[_0x847f('0x17')]!==_0x6c9c1c){this[_0x847f('0x17')]=_0x6c9c1c;io['to'](util[_0x847f('0x18')](_0x847f('0x19'),_0xf6e0d9[_0x847f('0x6')]))['emit']('chat_queue:save',_0xf6e0d9);}};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 c66aa71..710fc8e 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 _0x9d8d=['online','faxPause','paused','available','waiting','stringify','fax:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0x9d8d,0x181));var _0xd9d8=function(_0x57bed7,_0x51d299){_0x57bed7=_0x57bed7-0x0;var _0x42e01e=_0x9d8d[_0x57bed7];return _0x42e01e;};'use strict';var _=require(_0xd9d8('0x0'));var md5=require(_0xd9d8('0x1'));var util=require(_0xd9d8('0x2'));var Redis=require(_0xd9d8('0x3'));var config=require(_0xd9d8('0x4'));config[_0xd9d8('0x5')]=_[_0xd9d8('0x6')](config[_0xd9d8('0x5')],{'host':_0xd9d8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd9d8('0x5')]));function FaxQueue(_0x42fb0b){this['id']=_0x42fb0b['id']||0x0;this[_0xd9d8('0x8')]=_0x42fb0b[_0xd9d8('0x8')]||'';this['timeout']=_0x42fb0b[_0xd9d8('0x9')]||0xa;this[_0xd9d8('0xa')]=_0x42fb0b[_0xd9d8('0xa')]||_0xd9d8('0xb');this[_0xd9d8('0xc')]=_0x42fb0b['Agents'];this[_0xd9d8('0xd')]={};this['waiting']=0x0;this[_0xd9d8('0x1')]='';this[_0xd9d8('0xe')]();this[_0xd9d8('0xf')]();}FaxQueue['prototype'][_0xd9d8('0xe')]=function(){var _0x494417=this['mapAgentsId'][_0xd9d8('0x10')];this[_0xd9d8('0xd')]=_[_0xd9d8('0x11')](this[_0xd9d8('0xc')],'id');this[_0xd9d8('0xd')]['_rr']=_0x494417;};FaxQueue[_0xd9d8('0x12')][_0xd9d8('0xf')]=function(){this[_0xd9d8('0x13')]=0x0;this['paused']=0x0;for(var _0x3d229a=0x0;_0x3d229a=0x0?this[_0xd9d8('0x18')]:0x0;var _0xb5ba11={'id':this['id'],'available':this[_0xd9d8('0x18')],'loggedIn':this[_0xd9d8('0x13')],'name':this[_0xd9d8('0x8')],'paused':this[_0xd9d8('0x17')],'waiting':this[_0xd9d8('0x19')]};var _0x4c1815=md5(JSON[_0xd9d8('0x1a')](_0xb5ba11));if(this['md5']!==_0x4c1815){this['md5']=_0x4c1815;io['to'](util['format'](_0xd9d8('0x1b'),_0xb5ba11['name']))['emit']('fax_queue:save',_0xb5ba11);}};module[_0xd9d8('0x1c')]=FaxQueue; \ No newline at end of file +var _0xee1b=['paused','length','online','faxPause','available','stringify','format','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee1b,0x75));var _0xbee1=function(_0x431a22,_0x398615){_0x431a22=_0x431a22-0x0;var _0x3ce751=_0xee1b[_0x431a22];return _0x3ce751;};'use strict';var _=require(_0xbee1('0x0'));var md5=require(_0xbee1('0x1'));var util=require(_0xbee1('0x2'));var Redis=require('ioredis');var config=require(_0xbee1('0x3'));config[_0xbee1('0x4')]=_[_0xbee1('0x5')](config[_0xbee1('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbee1('0x6'))(new Redis(config['redis']));function FaxQueue(_0x48619){this['id']=_0x48619['id']||0x0;this['name']=_0x48619[_0xbee1('0x7')]||'';this[_0xbee1('0x8')]=_0x48619[_0xbee1('0x8')]||0xa;this[_0xbee1('0x9')]=_0x48619[_0xbee1('0x9')]||'beepall';this[_0xbee1('0xa')]=_0x48619['Agents'];this[_0xbee1('0xb')]={};this[_0xbee1('0xc')]=0x0;this[_0xbee1('0x1')]='';this[_0xbee1('0xd')]();this[_0xbee1('0xe')]();}FaxQueue[_0xbee1('0xf')][_0xbee1('0xd')]=function(){var _0x54d6e1=this[_0xbee1('0xb')][_0xbee1('0x10')];this[_0xbee1('0xb')]=_['map'](this[_0xbee1('0xa')],'id');this[_0xbee1('0xb')][_0xbee1('0x10')]=_0x54d6e1;};FaxQueue[_0xbee1('0xf')]['updateRealtime']=function(){this[_0xbee1('0x11')]=0x0;this[_0xbee1('0x12')]=0x0;for(var _0x2e64bc=0x0;_0x2e64bc=0x0?this[_0xbee1('0x16')]:0x0;var _0x2d103c={'id':this['id'],'available':this[_0xbee1('0x16')],'loggedIn':this[_0xbee1('0x11')],'name':this[_0xbee1('0x7')],'paused':this[_0xbee1('0x12')],'waiting':this[_0xbee1('0xc')]};var _0x324c9=md5(JSON[_0xbee1('0x17')](_0x2d103c));if(this[_0xbee1('0x1')]!==_0x324c9){this[_0xbee1('0x1')]=_0x324c9;io['to'](util[_0xbee1('0x18')]('fax:queue:%s',_0x2d103c['name']))[_0xbee1('0x19')]('fax_queue:save',_0x2d103c);}};module[_0xbee1('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 547fc4b..a0e8c24 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 _0xbc0a=['exports','name','Intervals'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0xbc0a,0x73));var _0xabc0=function(_0x31fcb2,_0x4918f4){_0x31fcb2=_0x31fcb2-0x0;var _0x4288d4=_0xbc0a[_0x31fcb2];return _0x4288d4;};'use strict';function Interval(_0x514518){this['id']=_0x514518['id']||0x0;this['name']=_0x514518[_0xabc0('0x0')]||'';this[_0xabc0('0x1')]=_0x514518[_0xabc0('0x1')]||{};}module[_0xabc0('0x2')]=Interval; \ No newline at end of file +var _0x8722=['Intervals','exports'];(function(_0x4e4d69,_0x440f08){var _0xf89658=function(_0x3c7c75){while(--_0x3c7c75){_0x4e4d69['push'](_0x4e4d69['shift']());}};_0xf89658(++_0x440f08);}(_0x8722,0x1c4));var _0x2872=function(_0x53895f,_0xbe8b6){_0x53895f=_0x53895f-0x0;var _0x56dcdf=_0x8722[_0x53895f];return _0x56dcdf;};'use strict';function Interval(_0x58e3bd){this['id']=_0x58e3bd['id']||0x0;this['name']=_0x58e3bd['name']||'';this[_0x2872('0x0')]=_0x58e3bd[_0x2872('0x0')]||{};}module[_0x2872('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 38f09b6..f1f7c84 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 _0xe64b=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','length','online','mailPause','paused','available','loggedIn','waiting','format','emit','exports','lodash','md5'];(function(_0x3b71e8,_0x2a1c2f){var _0x362fba=function(_0x2285d3){while(--_0x2285d3){_0x3b71e8['push'](_0x3b71e8['shift']());}};_0x362fba(++_0x2a1c2f);}(_0xe64b,0x120));var _0xbe64=function(_0x4d6fdb,_0x27ee6c){_0x4d6fdb=_0x4d6fdb-0x0;var _0x433ff5=_0xe64b[_0x4d6fdb];return _0x433ff5;};'use strict';var _=require(_0xbe64('0x0'));var md5=require(_0xbe64('0x1'));var util=require(_0xbe64('0x2'));var Redis=require(_0xbe64('0x3'));var config=require(_0xbe64('0x4'));config[_0xbe64('0x5')]=_[_0xbe64('0x6')](config[_0xbe64('0x5')],{'host':_0xbe64('0x7'),'port':0x18eb});var io=require(_0xbe64('0x8'))(new Redis(config['redis']));function MailQueue(_0x47ed17){this['id']=_0x47ed17['id']||0x0;this[_0xbe64('0x9')]=_0x47ed17['name']||'';this[_0xbe64('0xa')]=_0x47ed17[_0xbe64('0xa')]||0xa;this[_0xbe64('0xb')]=_0x47ed17[_0xbe64('0xb')]||'beepall';this[_0xbe64('0xc')]=_0x47ed17[_0xbe64('0xc')];this[_0xbe64('0xd')]={};this['waiting']=0x0;this[_0xbe64('0x1')]='';this[_0xbe64('0xe')]();this[_0xbe64('0xf')]();}MailQueue[_0xbe64('0x10')][_0xbe64('0xe')]=function(){var _0x57dd9e=this[_0xbe64('0xd')][_0xbe64('0x11')];this[_0xbe64('0xd')]=_[_0xbe64('0x12')](this['Agents'],'id');this[_0xbe64('0xd')][_0xbe64('0x11')]=_0x57dd9e;};MailQueue[_0xbe64('0x10')][_0xbe64('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5d29d9=0x0;_0x5d29d9=0x0?this[_0xbe64('0x17')]:0x0;var _0x6da668={'id':this['id'],'available':this[_0xbe64('0x17')],'loggedIn':this[_0xbe64('0x18')],'name':this[_0xbe64('0x9')],'paused':this[_0xbe64('0x16')],'waiting':this[_0xbe64('0x19')]};var _0x1fa2c5=md5(JSON['stringify'](_0x6da668));if(this[_0xbe64('0x1')]!==_0x1fa2c5){this[_0xbe64('0x1')]=_0x1fa2c5;io['to'](util[_0xbe64('0x1a')]('mail:queue:%s',_0x6da668[_0xbe64('0x9')]))[_0xbe64('0x1b')]('mail_queue:save',_0x6da668);}};module[_0xbe64('0x1c')]=MailQueue; \ No newline at end of file +var _0x2a15=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','paused','length','online','mailPause','available','loggedIn','stringify','format','mail:queue:%s','emit','mail_queue:save'];(function(_0x5c14d7,_0x19af24){var _0x54cf7c=function(_0x405795){while(--_0x405795){_0x5c14d7['push'](_0x5c14d7['shift']());}};_0x54cf7c(++_0x19af24);}(_0x2a15,0x16c));var _0x52a1=function(_0x493c46,_0x386eee){_0x493c46=_0x493c46-0x0;var _0x2d8d06=_0x2a15[_0x493c46];return _0x2d8d06;};'use strict';var _=require('lodash');var md5=require(_0x52a1('0x0'));var util=require('util');var Redis=require(_0x52a1('0x1'));var config=require(_0x52a1('0x2'));config[_0x52a1('0x3')]=_[_0x52a1('0x4')](config[_0x52a1('0x3')],{'host':_0x52a1('0x5'),'port':0x18eb});var io=require(_0x52a1('0x6'))(new Redis(config[_0x52a1('0x3')]));function MailQueue(_0x1782b7){this['id']=_0x1782b7['id']||0x0;this[_0x52a1('0x7')]=_0x1782b7[_0x52a1('0x7')]||'';this[_0x52a1('0x8')]=_0x1782b7[_0x52a1('0x8')]||0xa;this['strategy']=_0x1782b7[_0x52a1('0x9')]||_0x52a1('0xa');this[_0x52a1('0xb')]=_0x1782b7[_0x52a1('0xb')];this[_0x52a1('0xc')]={};this[_0x52a1('0xd')]=0x0;this[_0x52a1('0x0')]='';this[_0x52a1('0xe')]();this[_0x52a1('0xf')]();}MailQueue['prototype'][_0x52a1('0xe')]=function(){var _0x1109e0=this['mapAgentsId']['_rr'];this[_0x52a1('0xc')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x1109e0;};MailQueue[_0x52a1('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x52a1('0x11')]=0x0;for(var _0x1abc01=0x0;_0x1abc01=0x0?this[_0x52a1('0x15')]:0x0;var _0x17e4a4={'id':this['id'],'available':this[_0x52a1('0x15')],'loggedIn':this[_0x52a1('0x16')],'name':this[_0x52a1('0x7')],'paused':this[_0x52a1('0x11')],'waiting':this[_0x52a1('0xd')]};var _0x3e6d71=md5(JSON[_0x52a1('0x17')](_0x17e4a4));if(this[_0x52a1('0x0')]!==_0x3e6d71){this['md5']=_0x3e6d71;io['to'](util[_0x52a1('0x18')](_0x52a1('0x19'),_0x17e4a4[_0x52a1('0x7')]))[_0x52a1('0x1a')](_0x52a1('0x1b'),_0x17e4a4);}};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 51fea81..80dd0f8 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x326f,0xd1));var _0xf326=function(_0x36c0d7,_0x834de5){_0x36c0d7=_0x36c0d7-0x0;var _0x2197da=_0x326f[_0x36c0d7];return _0x2197da;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d92793d..3ba5794 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 _0x4d9e=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','available','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','ioredis','redis','localhost'];(function(_0x397256,_0x6514b1){var _0x4249ad=function(_0x1c44ef){while(--_0x1c44ef){_0x397256['push'](_0x397256['shift']());}};_0x4249ad(++_0x6514b1);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x2f42d6,_0x2912e8){_0x2f42d6=_0x2f42d6-0x0;var _0x40269c=_0x4d9e[_0x2f42d6];return _0x40269c;};'use strict';var _=require(_0xe4d9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xe4d9('0x1'));var config=require('../../../config/environment');config[_0xe4d9('0x2')]=_['defaults'](config[_0xe4d9('0x2')],{'host':_0xe4d9('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4d9('0x2')]));function SmsQueue(_0x3175e8){this['id']=_0x3175e8['id']||0x0;this[_0xe4d9('0x4')]=_0x3175e8[_0xe4d9('0x4')]||'';this[_0xe4d9('0x5')]=_0x3175e8[_0xe4d9('0x5')]||0xa;this['strategy']=_0x3175e8[_0xe4d9('0x6')]||_0xe4d9('0x7');this[_0xe4d9('0x8')]=_0x3175e8[_0xe4d9('0x8')];this[_0xe4d9('0x9')]={};this[_0xe4d9('0xa')]=0x0;this['md5']='';this[_0xe4d9('0xb')]();this[_0xe4d9('0xc')]();}SmsQueue[_0xe4d9('0xd')][_0xe4d9('0xb')]=function(){var _0xddd1fb=this[_0xe4d9('0x9')][_0xe4d9('0xe')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xddd1fb;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe4d9('0xf')]=0x0;for(var _0x3238d4=0x0;_0x3238d4=0x0?this[_0xe4d9('0x12')]:0x0;var _0x5ab3d1={'id':this['id'],'available':this[_0xe4d9('0x12')],'loggedIn':this['loggedIn'],'name':this[_0xe4d9('0x4')],'paused':this[_0xe4d9('0xf')],'waiting':this[_0xe4d9('0xa')]};var _0x2522f3=md5(JSON['stringify'](_0x5ab3d1));if(this[_0xe4d9('0x13')]!==_0x2522f3){this[_0xe4d9('0x13')]=_0x2522f3;io['to'](util[_0xe4d9('0x14')](_0xe4d9('0x15'),_0x5ab3d1[_0xe4d9('0x4')]))[_0xe4d9('0x16')](_0xe4d9('0x17'),_0x5ab3d1);}};module[_0xe4d9('0x18')]=SmsQueue; \ No newline at end of file +var _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x4ffede,_0xe8c9ef){var _0x2891bf=function(_0x52d218){while(--_0x52d218){_0x4ffede['push'](_0x4ffede['shift']());}};_0x2891bf(++_0xe8c9ef);}(_0x44ae,0x17d));var _0xe44a=function(_0x29bef7,_0x5127f0){_0x29bef7=_0x29bef7-0x0;var _0x1ba0c1=_0x44ae[_0x29bef7];return _0x1ba0c1;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 53caa31..8af6b97 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 _0x2027=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','paused','length','online','loggedIn','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x2027,0x1da));var _0x7202=function(_0x39346a,_0x5c3ed1){_0x39346a=_0x39346a-0x0;var _0x335564=_0x2027[_0x39346a];return _0x335564;};'use strict';var _=require(_0x7202('0x0'));var md5=require(_0x7202('0x1'));var util=require(_0x7202('0x2'));var Redis=require(_0x7202('0x3'));var config=require(_0x7202('0x4'));config[_0x7202('0x5')]=_[_0x7202('0x6')](config['redis'],{'host':_0x7202('0x7'),'port':0x18eb});var io=require(_0x7202('0x8'))(new Redis(config[_0x7202('0x5')]));function WhatsappQueue(_0x350c75){this['id']=_0x350c75['id']||0x0;this[_0x7202('0x9')]=_0x350c75['name']||'';this['timeout']=_0x350c75[_0x7202('0xa')]||0xa;this[_0x7202('0xb')]=_0x350c75[_0x7202('0xb')]||'beepall';this[_0x7202('0xc')]=_0x350c75[_0x7202('0xc')];this[_0x7202('0xd')]={};this[_0x7202('0xe')]=0x0;this['md5']='';this[_0x7202('0xf')]();this[_0x7202('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x44e9fe=this[_0x7202('0xd')][_0x7202('0x11')];this[_0x7202('0xd')]=_['map'](this['Agents'],'id');this[_0x7202('0xd')][_0x7202('0x11')]=_0x44e9fe;};WhatsappQueue[_0x7202('0x12')][_0x7202('0x10')]=function(){this['loggedIn']=0x0;this[_0x7202('0x13')]=0x0;for(var _0x40aeac=0x0;_0x40aeac=0x0?this[_0x7202('0x18')]:0x0;var _0x1a469f={'id':this['id'],'available':this[_0x7202('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x7202('0x9')],'paused':this[_0x7202('0x13')],'waiting':this[_0x7202('0xe')]};var _0x4ddeb5=md5(JSON[_0x7202('0x19')](_0x1a469f));if(this[_0x7202('0x1')]!==_0x4ddeb5){this[_0x7202('0x1')]=_0x4ddeb5;io['to'](util[_0x7202('0x1a')]('whatsapp:queue:%s',_0x1a469f['name']))[_0x7202('0x1b')](_0x7202('0x1c'),_0x1a469f);}};module[_0x7202('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x4b03=['updateRealtime','prototype','map','loggedIn','paused','online','available','format','emit','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0x4b03,0x1c1));var _0x34b0=function(_0x2e2b1f,_0x37c2a0){_0x2e2b1f=_0x2e2b1f-0x0;var _0x53306f=_0x4b03[_0x2e2b1f];return _0x53306f;};'use strict';var _=require('lodash');var md5=require(_0x34b0('0x0'));var util=require('util');var Redis=require(_0x34b0('0x1'));var config=require(_0x34b0('0x2'));config[_0x34b0('0x3')]=_['defaults'](config['redis'],{'host':_0x34b0('0x4'),'port':0x18eb});var io=require(_0x34b0('0x5'))(new Redis(config[_0x34b0('0x3')]));function WhatsappQueue(_0x20c5a7){this['id']=_0x20c5a7['id']||0x0;this[_0x34b0('0x6')]=_0x20c5a7[_0x34b0('0x6')]||'';this[_0x34b0('0x7')]=_0x20c5a7[_0x34b0('0x7')]||0xa;this[_0x34b0('0x8')]=_0x20c5a7[_0x34b0('0x8')]||'beepall';this[_0x34b0('0x9')]=_0x20c5a7[_0x34b0('0x9')];this[_0x34b0('0xa')]={};this[_0x34b0('0xb')]=0x0;this[_0x34b0('0x0')]='';this[_0x34b0('0xc')]();this[_0x34b0('0xd')]();}WhatsappQueue[_0x34b0('0xe')][_0x34b0('0xc')]=function(){var _0x5ca5ff=this[_0x34b0('0xa')]['_rr'];this['mapAgentsId']=_[_0x34b0('0xf')](this[_0x34b0('0x9')],'id');this[_0x34b0('0xa')]['_rr']=_0x5ca5ff;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x34b0('0x10')]=0x0;this[_0x34b0('0x11')]=0x0;for(var _0x82c515=0x0;_0x82c515=0x0?this[_0x34b0('0x13')]:0x0;var _0x1e93fb={'id':this['id'],'available':this[_0x34b0('0x13')],'loggedIn':this[_0x34b0('0x10')],'name':this[_0x34b0('0x6')],'paused':this[_0x34b0('0x11')],'waiting':this['waiting']};var _0x560b6e=md5(JSON['stringify'](_0x1e93fb));if(this[_0x34b0('0x0')]!==_0x560b6e){this['md5']=_0x560b6e;io['to'](util[_0x34b0('0x14')]('whatsapp:queue:%s',_0x1e93fb[_0x34b0('0x6')]))[_0x34b0('0x15')]('whatsapp_queue:save',_0x1e93fb);}};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 761814c..62889dd 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x34e124,_0x412d8a){var _0x11b127=function(_0x1e57a8){while(--_0x1e57a8){_0x34e124['push'](_0x34e124['shift']());}};_0x11b127(++_0x412d8a);}(_0xb10b,0x12a));var _0xbb10=function(_0x49684e,_0x9a24fb){_0x49684e=_0x49684e-0x0;var _0x54062f=_0xb10b[_0x49684e];return _0x54062f;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7140859..4e7496c 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 _0xe360=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xe360,0x121));var _0x0e36=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xe360[_0x46f1a6];return _0x38429a;};'use strict';var client=require(_0x0e36('0x0'));exports[_0x0e36('0x1')]=function(_0x45d5ba,_0x39f560){return client[_0x0e36('0x2')](_0x0e36('0x3'),{'body':_0x39f560,'options':{'where':{'id':_0x45d5ba}},'log':'updateChatInteraction'});};exports[_0x0e36('0x4')]=function(_0x506ea,_0x5278ab){return client[_0x0e36('0x2')](_0x0e36('0x5'),{'body':_0x5278ab,'options':{'where':{'id':_0x506ea}},'log':_0x0e36('0x6')});}; \ No newline at end of file +var _0x36d9=['UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x3fa45e,_0x8344d1){var _0x56c62d=function(_0x2faceb){while(--_0x2faceb){_0x3fa45e['push'](_0x3fa45e['shift']());}};_0x56c62d(++_0x8344d1);}(_0x36d9,0xcf));var _0x936d=function(_0x499005,_0x4ef901){_0x499005=_0x499005-0x0;var _0x29af04=_0x36d9[_0x499005];return _0x29af04;};'use strict';var client=require(_0x936d('0x0'));exports[_0x936d('0x1')]=function(_0x53396d,_0x582c3c){return client[_0x936d('0x2')](_0x936d('0x3'),{'body':_0x582c3c,'options':{'where':{'id':_0x53396d}},'log':'updateChatInteraction'});};exports[_0x936d('0x4')]=function(_0xa24bb6,_0x1daa39){return client['Request'](_0x936d('0x5'),{'body':_0x1daa39,'options':{'where':{'id':_0xa24bb6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 95c5b1d..c9af9cf 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 _0x96ce=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x635e28,_0x4eecc1){var _0x5bb9dc=function(_0x4e4486){while(--_0x4e4486){_0x635e28['push'](_0x635e28['shift']());}};_0x5bb9dc(++_0x4eecc1);}(_0x96ce,0x165));var _0xe96c=function(_0x2d33c7,_0x20e736){_0x2d33c7=_0x2d33c7-0x0;var _0x3f5a29=_0x96ce[_0x2d33c7];return _0x3f5a29;};'use strict';var client=require(_0xe96c('0x0'));exports[_0xe96c('0x1')]=function(_0x5d106f){return client[_0xe96c('0x2')](_0xe96c('0x3'),{'body':_0x5d106f,'log':_0xe96c('0x4')});}; \ No newline at end of file +var _0x85cd=['../client','create','CreateChatMessage'];(function(_0x25fb20,_0x10cf95){var _0x556205=function(_0x596c3d){while(--_0x596c3d){_0x25fb20['push'](_0x25fb20['shift']());}};_0x556205(++_0x10cf95);}(_0x85cd,0x16e));var _0xd85c=function(_0x494f96,_0x1a54ff){_0x494f96=_0x494f96-0x0;var _0x175677=_0x85cd[_0x494f96];return _0x175677;};'use strict';var client=require(_0xd85c('0x0'));exports[_0xd85c('0x1')]=function(_0x16cc24){return client['Request'](_0xd85c('0x2'),{'body':_0x16cc24,'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 3977140..99e338c 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 _0x8375=['Agents','chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x171cc3,_0x2fcf4b){var _0x184d96=function(_0x2e495c){while(--_0x2e495c){_0x171cc3['push'](_0x171cc3['shift']());}};_0x184d96(++_0x2fcf4b);}(_0x8375,0x132));var _0x5837=function(_0x5228ee,_0x3b747b){_0x5228ee=_0x5228ee-0x0;var _0x3f60e2=_0x8375[_0x5228ee];return _0x3f60e2;};'use strict';var client=require('../client');exports[_0x5837('0x0')]=function(){return function(){return client[_0x5837('0x1')](_0x5837('0x2'),{'options':{'raw':![],'attributes':['id',_0x5837('0x3'),_0x5837('0x4'),_0x5837('0x5')],'include':[{'model':'User','as':_0x5837('0x6'),'attributes':['id',_0x5837('0x3'),'online',_0x5837('0x7')]}]},'log':_0x5837('0x0')});};}; \ No newline at end of file +var _0x9ff4=['timeout','strategy','Agents','online','chatPause','getChatQueues','GetChatQueue','name'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x9ff4,0x196));var _0x49ff=function(_0x2ebeb2,_0x2a3024){_0x2ebeb2=_0x2ebeb2-0x0;var _0x33aab6=_0x9ff4[_0x2ebeb2];return _0x33aab6;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x49ff('0x0'),{'options':{'raw':![],'attributes':['id',_0x49ff('0x1'),_0x49ff('0x2'),_0x49ff('0x3')],'include':[{'model':'User','as':_0x49ff('0x4'),'attributes':['id',_0x49ff('0x1'),_0x49ff('0x5'),_0x49ff('0x6')]}]},'log':_0x49ff('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e2938c4..7697c61 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 _0xa0bc=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x457daa,_0x2a387a){var _0x16733f=function(_0x498c7a){while(--_0x498c7a){_0x457daa['push'](_0x457daa['shift']());}};_0x16733f(++_0x2a387a);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xca0b('0x0')]=function(_0x19838b){return client['Request'](_0xca0b('0x1'),{'body':_0x19838b,'log':_0xca0b('0x1')});};exports[_0xca0b('0x2')]=function(_0x68ff4,_0x2f7b56){return client[_0xca0b('0x3')](_0xca0b('0x4'),{'body':_0x2f7b56,'options':{'where':{'uniqueid':_0x68ff4},'order':[['id',_0xca0b('0x5')]],'limit':0x1},'log':_0xca0b('0x4')});}; \ No newline at end of file +var _0x50c1=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3eac0b,_0x522129){var _0x3c2b76=function(_0x5780a7){while(--_0x5780a7){_0x3eac0b['push'](_0x3eac0b['shift']());}};_0x3c2b76(++_0x522129);}(_0x50c1,0x1a5));var _0x150c=function(_0x16d162,_0x18dbec){_0x16d162=_0x16d162-0x0;var _0xf8a0d7=_0x50c1[_0x16d162];return _0xf8a0d7;};'use strict';var client=require(_0x150c('0x0'));exports['create']=function(_0x47d48d){return client[_0x150c('0x1')](_0x150c('0x2'),{'body':_0x47d48d,'log':_0x150c('0x2')});};exports[_0x150c('0x3')]=function(_0x24cd1b,_0x18c0bd){return client[_0x150c('0x1')](_0x150c('0x4'),{'body':_0x18c0bd,'options':{'where':{'uniqueid':_0x24cd1b},'order':[['id',_0x150c('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f5fc00e..5f05125 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x7a54,0x106));var _0x47a5=function(_0x82eff5,_0x1ec467){_0x82eff5=_0x82eff5-0x0;var _0x5c5a88=_0x7a54[_0x82eff5];return _0x5c5a88;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x225b4b,_0x252976){var _0xf46cae=function(_0x35b39a){while(--_0x35b39a){_0x225b4b['push'](_0x225b4b['shift']());}};_0xf46cae(++_0x252976);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 4143c43..3e6cc8b 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 _0xfe7a=['create','CreateFaxMessage','../client'];(function(_0x429c50,_0x5495d){var _0x121b69=function(_0x4b0d08){while(--_0x4b0d08){_0x429c50['push'](_0x429c50['shift']());}};_0x121b69(++_0x5495d);}(_0xfe7a,0x1ca));var _0xafe7=function(_0x45fcec,_0xd63c96){_0x45fcec=_0x45fcec-0x0;var _0x363ccf=_0xfe7a[_0x45fcec];return _0x363ccf;};'use strict';var client=require(_0xafe7('0x0'));exports[_0xafe7('0x1')]=function(_0x5d444f){return client['Request'](_0xafe7('0x2'),{'body':_0x5d444f,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x374d=['Request','CreateFaxMessage','../client','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x374d,0x12a));var _0xd374=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x374d[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0xd374('0x0'));exports[_0xd374('0x1')]=function(_0x4b6e47){return client[_0xd374('0x2')](_0xd374('0x3'),{'body':_0x4b6e47,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 8964a37..4fd90b2 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 _0xa1dd=['../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name','online','faxPause'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xa1dd,0x78));var _0xda1d=function(_0x58b3a6,_0x2242ec){_0x58b3a6=_0x58b3a6-0x0;var _0x4bba2a=_0xa1dd[_0x58b3a6];return _0x4bba2a;};'use strict';var client=require(_0xda1d('0x0'));exports[_0xda1d('0x1')]=function(){return function(){return client[_0xda1d('0x2')](_0xda1d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xda1d('0x4'),_0xda1d('0x5')],'include':[{'model':'User','as':_0xda1d('0x6'),'attributes':['id',_0xda1d('0x7'),_0xda1d('0x8'),_0xda1d('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xa128=['User','Agents','getFaxQueues','../client','Request','name','timeout','strategy'];(function(_0xf48dca,_0x4dd49d){var _0x26464e=function(_0x1f09e1){while(--_0x1f09e1){_0xf48dca['push'](_0xf48dca['shift']());}};_0x26464e(++_0x4dd49d);}(_0xa128,0x10b));var _0x8a12=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xa128[_0x1f9f37];return _0x21c080;};'use strict';var client=require(_0x8a12('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x8a12('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8a12('0x2'),_0x8a12('0x3'),_0x8a12('0x4')],'include':[{'model':_0x8a12('0x5'),'as':_0x8a12('0x6'),'attributes':['id',_0x8a12('0x2'),'online','faxPause']}]},'log':_0x8a12('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9c448ec..b9ff7e0 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 _0x31d2=['create','Request','CreateFaxQueueReport','DESC','../client'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x31d2,0x68));var _0x231d=function(_0x55cdca,_0x54fe8e){_0x55cdca=_0x55cdca-0x0;var _0x6b81bd=_0x31d2[_0x55cdca];return _0x6b81bd;};'use strict';var client=require(_0x231d('0x0'));exports[_0x231d('0x1')]=function(_0x5c2ae9){return client[_0x231d('0x2')]('CreateFaxQueueReport',{'body':_0x5c2ae9,'log':_0x231d('0x3')});};exports['update']=function(_0x40f532,_0x3d8612){return client['Request']('UpdateFaxQueueReport',{'body':_0x3d8612,'options':{'where':{'uniqueid':_0x40f532},'order':[['id',_0x231d('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x099b=['update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x317a39,_0x63272f){var _0x3c2dd6=function(_0x1257ac){while(--_0x1257ac){_0x317a39['push'](_0x317a39['shift']());}};_0x3c2dd6(++_0x63272f);}(_0x099b,0xa3));var _0xb099=function(_0x100589,_0x3c1988){_0x100589=_0x100589-0x0;var _0x250b51=_0x099b[_0x100589];return _0x250b51;};'use strict';var client=require('../client');exports[_0xb099('0x0')]=function(_0x31f726){return client[_0xb099('0x1')]('CreateFaxQueueReport',{'body':_0x31f726,'log':'CreateFaxQueueReport'});};exports[_0xb099('0x2')]=function(_0x142a8e,_0x2458c3){return client[_0xb099('0x1')](_0xb099('0x3'),{'body':_0x2458c3,'options':{'where':{'uniqueid':_0x142a8e},'order':[['id',_0xb099('0x4')]],'limit':0x1},'log':_0xb099('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 24de586..f0d20f4 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 _0x33a0=['Interval','interval','../client','getIntervals','Request','name'];(function(_0xf5b72f,_0x4d6d09){var _0x4b4d91=function(_0x260cb7){while(--_0x260cb7){_0xf5b72f['push'](_0xf5b72f['shift']());}};_0x4b4d91(++_0x4d6d09);}(_0x33a0,0x1a0));var _0x033a=function(_0x3740c8,_0x3a9c88){_0x3740c8=_0x3740c8-0x0;var _0x2f7acd=_0x33a0[_0x3740c8];return _0x2f7acd;};'use strict';var client=require(_0x033a('0x0'));exports[_0x033a('0x1')]=function(){return function(){return client[_0x033a('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x033a('0x3')],'include':[{'model':_0x033a('0x4'),'as':'Intervals','attributes':['id',_0x033a('0x3'),_0x033a('0x5')]}]},'log':_0x033a('0x1')});};}; \ No newline at end of file +var _0x746e=['Interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x746e,0x199));var _0xe746=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x746e[_0x912d27];return _0x31b918;};'use strict';var client=require(_0xe746('0x0'));exports[_0xe746('0x1')]=function(){return function(){return client[_0xe746('0x2')](_0xe746('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe746('0x4')],'include':[{'model':_0xe746('0x5'),'as':'Intervals','attributes':['id',_0xe746('0x4'),'interval']}]},'log':_0xe746('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 33b081b..b23f7cc 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 _0xf4f4=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x1c0ecf,_0x1c2efa){var _0x594ba8=function(_0x4e76dd){while(--_0x4e76dd){_0x1c0ecf['push'](_0x1c0ecf['shift']());}};_0x594ba8(++_0x1c2efa);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1479fa,_0x315d83){_0x1479fa=_0x1479fa-0x0;var _0x2c13d5=_0xf4f4[_0x1479fa];return _0x2c13d5;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(_0x533895,_0x16a496){return client[_0x4f4f('0x2')](_0x4f4f('0x3'),{'body':_0x16a496,'options':{'where':{'id':_0x533895}},'log':_0x4f4f('0x4')});};exports[_0x4f4f('0x5')]=function(_0x510b24,_0x5a752b){return client['Request'](_0x4f4f('0x6'),{'body':_0x5a752b,'options':{'where':{'id':_0x510b24}},'log':_0x4f4f('0x7')});}; \ No newline at end of file +var _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4746f7,_0x2dd6e0){var _0xab048f=function(_0x225739){while(--_0x225739){_0x4746f7['push'](_0x4746f7['shift']());}};_0xab048f(++_0x2dd6e0);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x229c04,_0x42251c){_0x229c04=_0x229c04-0x0;var _0x2b32a7=_0xcf2f[_0x229c04];return _0x2b32a7;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 770396a..47fe502 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 _0x00de=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x552035,_0x40eba9){var _0x34a170=function(_0x2e26d0){while(--_0x2e26d0){_0x552035['push'](_0x552035['shift']());}};_0x34a170(++_0x40eba9);}(_0x00de,0x178));var _0xe00d=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x00de[_0x10b48a];return _0x2c4533;};'use strict';var client=require('../client');exports[_0xe00d('0x0')]=function(_0x20a69c){return client[_0xe00d('0x1')](_0xe00d('0x2'),{'body':_0x20a69c,'log':_0xe00d('0x3')});}; \ No newline at end of file +var _0x1209=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x2d203a,_0x3bf40d){var _0xc00c7=function(_0x2b2bef){while(--_0x2b2bef){_0x2d203a['push'](_0x2d203a['shift']());}};_0xc00c7(++_0x3bf40d);}(_0x1209,0xc9));var _0x9120=function(_0x11d1f4,_0x1dfb4d){_0x11d1f4=_0x11d1f4-0x0;var _0x1140dd=_0x1209[_0x11d1f4];return _0x1140dd;};'use strict';var client=require(_0x9120('0x0'));exports['create']=function(_0x1c1830){return client[_0x9120('0x1')](_0x9120('0x2'),{'body':_0x1c1830,'log':_0x9120('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8f90218..deb223a 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 _0xe574=['online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x937b2b,_0x16b053){var _0x97582b=function(_0x5cba79){while(--_0x5cba79){_0x937b2b['push'](_0x937b2b['shift']());}};_0x97582b(++_0x16b053);}(_0xe574,0x100));var _0x4e57=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe574[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0x4e57('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4e57('0x1')](_0x4e57('0x2'),{'options':{'raw':![],'attributes':['id',_0x4e57('0x3'),_0x4e57('0x4'),_0x4e57('0x5')],'include':[{'model':_0x4e57('0x6'),'as':_0x4e57('0x7'),'attributes':['id',_0x4e57('0x3'),_0x4e57('0x8'),_0x4e57('0x9')]}]},'log':_0x4e57('0xa')});};}; \ No newline at end of file +var _0x349f=['User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x26c5a7,_0x328a59){var _0x287e2d=function(_0x261ecf){while(--_0x261ecf){_0x26c5a7['push'](_0x26c5a7['shift']());}};_0x287e2d(++_0x328a59);}(_0x349f,0xae));var _0xf349=function(_0x3b3650,_0x73a5a2){_0x3b3650=_0x3b3650-0x0;var _0x14f152=_0x349f[_0x3b3650];return _0x14f152;};'use strict';var client=require(_0xf349('0x0'));exports[_0xf349('0x1')]=function(){return function(){return client[_0xf349('0x2')](_0xf349('0x3'),{'options':{'raw':![],'attributes':['id',_0xf349('0x4'),'timeout',_0xf349('0x5')],'include':[{'model':_0xf349('0x6'),'as':'Agents','attributes':['id','name',_0xf349('0x7'),_0xf349('0x8')]}]},'log':_0xf349('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7de044b..f206df5 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 _0xb416=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x52e94f,_0x22e52d){var _0x127d43=function(_0x423f67){while(--_0x423f67){_0x52e94f['push'](_0x52e94f['shift']());}};_0x127d43(++_0x22e52d);}(_0xb416,0x9f));var _0x6b41=function(_0x17eb2a,_0x1e37e9){_0x17eb2a=_0x17eb2a-0x0;var _0x28aae6=_0xb416[_0x17eb2a];return _0x28aae6;};'use strict';var client=require(_0x6b41('0x0'));exports[_0x6b41('0x1')]=function(_0x1a2fc8){return client[_0x6b41('0x2')](_0x6b41('0x3'),{'body':_0x1a2fc8,'log':'CreateMailQueueReport'});};exports[_0x6b41('0x4')]=function(_0x364860,_0x30ca90){return client[_0x6b41('0x2')](_0x6b41('0x5'),{'body':_0x30ca90,'options':{'where':{'uniqueid':_0x364860},'order':[['id',_0x6b41('0x6')]],'limit':0x1},'log':_0x6b41('0x5')});}; \ No newline at end of file +var _0x1c1d=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1c1d,0x122));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd1c1('0x0'));exports[_0xd1c1('0x1')]=function(_0x87227b){return client['Request']('CreateMailQueueReport',{'body':_0x87227b,'log':_0xd1c1('0x2')});};exports[_0xd1c1('0x3')]=function(_0x46caae,_0x8b19f0){return client[_0xd1c1('0x4')](_0xd1c1('0x5'),{'body':_0x8b19f0,'options':{'where':{'uniqueid':_0x46caae},'order':[['id',_0xd1c1('0x6')]],'limit':0x1},'log':_0xd1c1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1e9f297..272a854 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 _0xbe41=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xbe41,0x17c));var _0x1be4=function(_0x214798,_0x15b588){_0x214798=_0x214798-0x0;var _0x3bc58a=_0xbe41[_0x214798];return _0x3bc58a;};'use strict';var client=require(_0x1be4('0x0'));exports[_0x1be4('0x1')]=function(_0x2683c8,_0x192dc7){return client[_0x1be4('0x2')]('UpdateOpenchannelInteraction',{'body':_0x192dc7,'options':{'where':{'id':_0x2683c8}},'log':_0x1be4('0x3')});};exports[_0x1be4('0x4')]=function(_0x4a0507,_0x2ae294){return client['Request'](_0x1be4('0x5'),{'body':_0x2ae294,'options':{'where':{'id':_0x4a0507}},'log':_0x1be4('0x6')});}; \ No newline at end of file +var _0x38f8=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x1cd65a,_0x29fa8f){var _0xf93849=function(_0x29fbe1){while(--_0x29fbe1){_0x1cd65a['push'](_0x1cd65a['shift']());}};_0xf93849(++_0x29fa8f);}(_0x38f8,0x193));var _0x838f=function(_0x18cf75,_0x20fa8e){_0x18cf75=_0x18cf75-0x0;var _0x203dff=_0x38f8[_0x18cf75];return _0x203dff;};'use strict';var client=require(_0x838f('0x0'));exports[_0x838f('0x1')]=function(_0x773cf8,_0x5b228e){return client[_0x838f('0x2')](_0x838f('0x3'),{'body':_0x5b228e,'options':{'where':{'id':_0x773cf8}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x1c9a2a,_0x47b451){return client[_0x838f('0x2')](_0x838f('0x4'),{'body':_0x47b451,'options':{'where':{'id':_0x1c9a2a}},'log':_0x838f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8ea2f58..2adbfeb 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 _0x74b4=['Request','CreateOpenchannelMessage','create'];(function(_0x20585c,_0x1ed8f1){var _0xfb08d2=function(_0x4d2132){while(--_0x4d2132){_0x20585c['push'](_0x20585c['shift']());}};_0xfb08d2(++_0x1ed8f1);}(_0x74b4,0x1a3));var _0x474b=function(_0x333459,_0x2aab50){_0x333459=_0x333459-0x0;var _0xb6ccc2=_0x74b4[_0x333459];return _0xb6ccc2;};'use strict';var client=require('../client');exports[_0x474b('0x0')]=function(_0x34fdc5){return client[_0x474b('0x1')](_0x474b('0x2'),{'body':_0x34fdc5,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x44d3=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x50f932,_0xf602d9){var _0x90ed4a=function(_0x115b31){while(--_0x115b31){_0x50f932['push'](_0x50f932['shift']());}};_0x90ed4a(++_0xf602d9);}(_0x44d3,0xf3));var _0x344d=function(_0x4ef78a,_0x1d1c22){_0x4ef78a=_0x4ef78a-0x0;var _0x188102=_0x44d3[_0x4ef78a];return _0x188102;};'use strict';var client=require(_0x344d('0x0'));exports[_0x344d('0x1')]=function(_0x1dedcd){return client['Request'](_0x344d('0x2'),{'body':_0x1dedcd,'log':_0x344d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index db21df8..2d2e11f 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 _0x2972=['../client','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2972,0x144));var _0x2297=function(_0x5c7dc8,_0x18d8c4){_0x5c7dc8=_0x5c7dc8-0x0;var _0x1fc5f0=_0x2972[_0x5c7dc8];return _0x1fc5f0;};'use strict';var client=require(_0x2297('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x2297('0x1'),{'options':{'raw':![],'attributes':['id',_0x2297('0x2'),_0x2297('0x3'),_0x2297('0x4')],'include':[{'model':'User','as':_0x2297('0x5'),'attributes':['id',_0x2297('0x2'),_0x2297('0x6'),_0x2297('0x7')]}]},'log':_0x2297('0x8')});};}; \ No newline at end of file +var _0x3f8d=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x25bb2f,_0x21c4ff){var _0x208b06=function(_0x2ca264){while(--_0x2ca264){_0x25bb2f['push'](_0x25bb2f['shift']());}};_0x208b06(++_0x21c4ff);}(_0x3f8d,0x162));var _0xd3f8=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x3f8d[_0x47b15f];return _0x55bf25;};'use strict';var client=require('../client');exports[_0xd3f8('0x0')]=function(){return function(){return client[_0xd3f8('0x1')](_0xd3f8('0x2'),{'options':{'raw':![],'attributes':['id',_0xd3f8('0x3'),_0xd3f8('0x4'),_0xd3f8('0x5')],'include':[{'model':_0xd3f8('0x6'),'as':_0xd3f8('0x7'),'attributes':['id',_0xd3f8('0x3'),_0xd3f8('0x8'),_0xd3f8('0x9')]}]},'log':_0xd3f8('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3af22e0..2bd59b6 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 _0x9ae6=['Request','UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0x18eca4,_0x16e96e){var _0x253767=function(_0x9d11dd){while(--_0x9d11dd){_0x18eca4['push'](_0x18eca4['shift']());}};_0x253767(++_0x16e96e);}(_0x9ae6,0x177));var _0x69ae=function(_0x4b80e5,_0x3553e6){_0x4b80e5=_0x4b80e5-0x0;var _0x298493=_0x9ae6[_0x4b80e5];return _0x298493;};'use strict';var client=require(_0x69ae('0x0'));exports[_0x69ae('0x1')]=function(_0x1f5d67){return client['Request'](_0x69ae('0x2'),{'body':_0x1f5d67,'log':_0x69ae('0x2')});};exports['update']=function(_0x54ea29,_0x196b64){return client[_0x69ae('0x3')](_0x69ae('0x4'),{'body':_0x196b64,'options':{'where':{'uniqueid':_0x54ea29},'order':[['id',_0x69ae('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xa100=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xa100,0x1b1));var _0x0a10=function(_0x1b3475,_0x311d88){_0x1b3475=_0x1b3475-0x0;var _0x2b846e=_0xa100[_0x1b3475];return _0x2b846e;};'use strict';var client=require(_0x0a10('0x0'));exports[_0x0a10('0x1')]=function(_0x288171){return client[_0x0a10('0x2')](_0x0a10('0x3'),{'body':_0x288171,'log':_0x0a10('0x3')});};exports[_0x0a10('0x4')]=function(_0x97bbd9,_0x2d20ca){return client[_0x0a10('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2d20ca,'options':{'where':{'uniqueid':_0x97bbd9},'order':[['id','DESC']],'limit':0x1},'log':_0x0a10('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8c28e51..01ea467 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 _0x0faf=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0faf,0x132));var _0xf0fa=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x0faf[_0x3b1b23];return _0x1efc85;};'use strict';var client=require(_0xf0fa('0x0'));exports['update']=function(_0x43fe7a,_0x1b4763){return client[_0xf0fa('0x1')](_0xf0fa('0x2'),{'body':_0x1b4763,'options':{'where':{'id':_0x43fe7a}},'log':_0xf0fa('0x3')});};exports[_0xf0fa('0x4')]=function(_0x515b12,_0xc83253){return client[_0xf0fa('0x1')]('AddTagsToSmsInteraction',{'body':_0xc83253,'options':{'where':{'id':_0x515b12}},'log':_0xf0fa('0x5')});}; \ No newline at end of file +var _0x943c=['update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x5588d9,_0x37a3ed){var _0x5a85cd=function(_0x3991c7){while(--_0x3991c7){_0x5588d9['push'](_0x5588d9['shift']());}};_0x5a85cd(++_0x37a3ed);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc943('0x0'));exports[_0xc943('0x1')]=function(_0x3ab205,_0x714ac3){return client['Request']('UpdateSmsInteraction',{'body':_0x714ac3,'options':{'where':{'id':_0x3ab205}},'log':_0xc943('0x2')});};exports[_0xc943('0x3')]=function(_0xa24827,_0x5b7d1d){return client[_0xc943('0x4')](_0xc943('0x5'),{'body':_0x5b7d1d,'options':{'where':{'id':_0xa24827}},'log':_0xc943('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 954f443..ccd5bf7 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 _0xf074=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x2b12b7,_0x2621a1){var _0x2c7af3=function(_0x4d3946){while(--_0x4d3946){_0x2b12b7['push'](_0x2b12b7['shift']());}};_0x2c7af3(++_0x2621a1);}(_0xf074,0x164));var _0x4f07=function(_0x5ba38a,_0x132834){_0x5ba38a=_0x5ba38a-0x0;var _0x28eebe=_0xf074[_0x5ba38a];return _0x28eebe;};'use strict';var client=require(_0x4f07('0x0'));exports[_0x4f07('0x1')]=function(_0x36e16f){return client['Request'](_0x4f07('0x2'),{'body':_0x36e16f,'log':_0x4f07('0x3')});}; \ No newline at end of file +var _0x828f=['Request','CreateSmsMessage','createSmsMessage','create'];(function(_0xccd9cc,_0x50ed31){var _0x11f890=function(_0x6c8099){while(--_0x6c8099){_0xccd9cc['push'](_0xccd9cc['shift']());}};_0x11f890(++_0x50ed31);}(_0x828f,0x14b));var _0xf828=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x828f[_0x30033a];return _0x5e3518;};'use strict';var client=require('../client');exports[_0xf828('0x0')]=function(_0x10ef98){return client[_0xf828('0x1')](_0xf828('0x2'),{'body':_0x10ef98,'log':_0xf828('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a85307f..0923ca2 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 04b3746..506b2aa 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xedd9,0xfc));var _0x9edd=function(_0x1b9c37,_0x22e2bf){_0x1b9c37=_0x1b9c37-0x0;var _0x353b39=_0xedd9[_0x1b9c37];return _0x353b39;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x20712d,_0x4c92c3){_0x20712d=_0x20712d-0x0;var _0x4c7140=_0xedd9[_0x20712d];return _0x4c7140;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 508df6c..721925c 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 _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x6425b3,_0x26d8eb){var _0x5f2198=function(_0x26319f){while(--_0x26319f){_0x6425b3['push'](_0x6425b3['shift']());}};_0x5f2198(++_0x26d8eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x1cbf33,_0x21f2ec){var _0x1ec7eb=function(_0x32ac45){while(--_0x32ac45){_0x1cbf33['push'](_0x1cbf33['shift']());}};_0x1ec7eb(++_0x21f2ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 61c137a..fea0178 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 _0xe714=['UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x245710,_0x4e9825){var _0x3dd3d1=function(_0xcfd178){while(--_0xcfd178){_0x245710['push'](_0x245710['shift']());}};_0x3dd3d1(++_0x4e9825);}(_0xe714,0xe2));var _0x4e71=function(_0x2ec3d1,_0x463a54){_0x2ec3d1=_0x2ec3d1-0x0;var _0x473431=_0xe714[_0x2ec3d1];return _0x473431;};'use strict';var client=require(_0x4e71('0x0'));exports['update']=function(_0x36da97,_0xa1f600){return client[_0x4e71('0x1')](_0x4e71('0x2'),{'body':_0xa1f600,'options':{'where':{'id':_0x36da97}},'log':'updateWhatsappInteraction'});};exports[_0x4e71('0x3')]=function(_0x59a685,_0xad5224){return client[_0x4e71('0x1')](_0x4e71('0x4'),{'body':_0xad5224,'options':{'where':{'id':_0x59a685}},'log':_0x4e71('0x5')});}; \ No newline at end of file +var _0xde81=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x2bf127,_0x5a4dfe){var _0x9ab9ed=function(_0x1848e7){while(--_0x1848e7){_0x2bf127['push'](_0x2bf127['shift']());}};_0x9ab9ed(++_0x5a4dfe);}(_0xde81,0x109));var _0x1de8=function(_0x3a6f93,_0xbff327){_0x3a6f93=_0x3a6f93-0x0;var _0x32e547=_0xde81[_0x3a6f93];return _0x32e547;};'use strict';var client=require(_0x1de8('0x0'));exports[_0x1de8('0x1')]=function(_0xa96d58,_0x3202df){return client[_0x1de8('0x2')](_0x1de8('0x3'),{'body':_0x3202df,'options':{'where':{'id':_0xa96d58}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xebfcf9,_0x5953a6){return client[_0x1de8('0x2')](_0x1de8('0x4'),{'body':_0x5953a6,'options':{'where':{'id':_0xebfcf9}},'log':_0x1de8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bd3c701..6e0b2c0 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 _0x591e=['CreateWhatsappMessage','../client','create','Request'];(function(_0x4abf1f,_0x3e7a20){var _0x538b69=function(_0x5a7b16){while(--_0x5a7b16){_0x4abf1f['push'](_0x4abf1f['shift']());}};_0x538b69(++_0x3e7a20);}(_0x591e,0x1c1));var _0xe591=function(_0x3d29ce,_0x1331c5){_0x3d29ce=_0x3d29ce-0x0;var _0x5e1223=_0x591e[_0x3d29ce];return _0x5e1223;};'use strict';var client=require(_0xe591('0x0'));exports[_0xe591('0x1')]=function(_0x44dc0f){return client[_0xe591('0x2')](_0xe591('0x3'),{'body':_0x44dc0f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x4bd8=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5448c9,_0x3c2fb8){var _0x1c3c91=function(_0x21cdd3){while(--_0x21cdd3){_0x5448c9['push'](_0x5448c9['shift']());}};_0x1c3c91(++_0x3c2fb8);}(_0x4bd8,0x12f));var _0x84bd=function(_0x45ad3a,_0x108d36){_0x45ad3a=_0x45ad3a-0x0;var _0x60d1e6=_0x4bd8[_0x45ad3a];return _0x60d1e6;};'use strict';var client=require(_0x84bd('0x0'));exports['create']=function(_0x3526e4){return client['Request'](_0x84bd('0x1'),{'body':_0x3526e4,'log':_0x84bd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f558f69..30a983d 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 _0x9a8d=['GetWhatsappQueue','timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x9a8d,0x11c));var _0xd9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd9a8('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xd9a8('0x1')](_0xd9a8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd9a8('0x3'),_0xd9a8('0x4')],'include':[{'model':_0xd9a8('0x5'),'as':_0xd9a8('0x6'),'attributes':['id',_0xd9a8('0x7'),_0xd9a8('0x8'),_0xd9a8('0x9')]}]},'log':_0xd9a8('0xa')});};}; \ No newline at end of file +var _0xb545=['GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x246564,_0x5bcbce){var _0x4eb0b6=function(_0x464b99){while(--_0x464b99){_0x246564['push'](_0x246564['shift']());}};_0x4eb0b6(++_0x5bcbce);}(_0xb545,0x1f2));var _0x5b54=function(_0x4aba49,_0x3da137){_0x4aba49=_0x4aba49-0x0;var _0x4ba51e=_0xb545[_0x4aba49];return _0x4ba51e;};'use strict';var client=require(_0x5b54('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x5b54('0x1')](_0x5b54('0x2'),{'options':{'raw':![],'attributes':['id',_0x5b54('0x3'),_0x5b54('0x4'),_0x5b54('0x5')],'include':[{'model':_0x5b54('0x6'),'as':'Agents','attributes':['id','name',_0x5b54('0x7'),_0x5b54('0x8')]}]},'log':_0x5b54('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index defce54..bc9e3cc 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 _0xf9d8=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x5adedf,_0x421f26){var _0x30c80b=function(_0x1b2aca){while(--_0x1b2aca){_0x5adedf['push'](_0x5adedf['shift']());}};_0x30c80b(++_0x421f26);}(_0xf9d8,0xee));var _0x8f9d=function(_0x4df8ce,_0x61894c){_0x4df8ce=_0x4df8ce-0x0;var _0x3b4749=_0xf9d8[_0x4df8ce];return _0x3b4749;};'use strict';var client=require(_0x8f9d('0x0'));exports[_0x8f9d('0x1')]=function(_0x1cec76){return client[_0x8f9d('0x2')](_0x8f9d('0x3'),{'body':_0x1cec76,'log':_0x8f9d('0x3')});};exports[_0x8f9d('0x4')]=function(_0x4778bc,_0x3adb9a){return client[_0x8f9d('0x2')](_0x8f9d('0x5'),{'body':_0x3adb9a,'options':{'where':{'uniqueid':_0x4778bc},'order':[['id','DESC']],'limit':0x1},'log':_0x8f9d('0x5')});}; \ No newline at end of file +var _0xe3cd=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x512e52,_0x121aed){var _0x210dbc=function(_0x4750cc){while(--_0x4750cc){_0x512e52['push'](_0x512e52['shift']());}};_0x210dbc(++_0x121aed);}(_0xe3cd,0x164));var _0xde3c=function(_0x563afd,_0xeb5160){_0x563afd=_0x563afd-0x0;var _0x3e2228=_0xe3cd[_0x563afd];return _0x3e2228;};'use strict';var client=require(_0xde3c('0x0'));exports[_0xde3c('0x1')]=function(_0x3db45f){return client[_0xde3c('0x2')](_0xde3c('0x3'),{'body':_0x3db45f,'log':_0xde3c('0x3')});};exports[_0xde3c('0x4')]=function(_0x218f9c,_0x3cab66){return client['Request'](_0xde3c('0x5'),{'body':_0x3cab66,'options':{'where':{'uniqueid':_0x218f9c},'order':[['id',_0xde3c('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index d813130..139bebb 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 _0x04b6=['complete','[%s][AGENT]\x20ROUTING\x20END','agent','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../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','consequence','length','error','message','join','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop'];(function(_0x2d97fa,_0x5b488a){var _0x575d9c=function(_0x168e96){while(--_0x168e96){_0x2d97fa['push'](_0x2d97fa['shift']());}};_0x575d9c(++_0x5b488a);}(_0x04b6,0xb9));var _0x604b=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x04b6[_0x548627];return _0x844a84;};'use strict';var schema=require(_0x604b('0x0'));var _=require(_0x604b('0x1'));var util=require(_0x604b('0x2'));var seqqueue=require(_0x604b('0x3'));var logger=require(_0x604b('0x4'))(_0x604b('0x5'));var strategy=require(_0x604b('0x6'));var queue=schema({'name':{'type':_0x604b('0x7'),'required':!![],'message':_0x604b('0x8')},'timeout':{'type':_0x604b('0x9'),'message':_0x604b('0xa')}});function writeLog(_0x241aa6,_0x392bb3,_0x101a6c){return logger[_0x604b('0xb')](util[_0x604b('0xc')](_0x604b('0xd'),_0x241aa6,_0x392bb3[_0x604b('0xe')],_0x101a6c));}function handleFindAgent(_0x1ab39d){return function(_0x59f213){return _0x59f213['name']['toLowerCase']()===_0x1ab39d['toLowerCase']();};}exports[_0x604b('0xf')]=function(_0x4a14ba,_0x1a9059,_0x4d7619,_0x174f83){return function(_0x5f126c){try{var _0xdb0a69={'name':_0x1a9059[0x0],'timeout':_0x1a9059[0x1]};var _0x999c41=queue[_0x604b('0x0')](_0xdb0a69,{'typecast':!![]});if(_0x999c41[_0x604b('0x10')]){logger[_0x604b('0x11')]('[%s][AGENT]\x20%s',_0x4a14ba,_['map'](_0x999c41,_0x604b('0x12'))[_0x604b('0x13')](',\x20'));_0x5f126c['stop']();}else{var _0xc010d3=_[_0x604b('0x14')](_0x4d7619[_0x604b('0x15')],handleFindAgent(_0xdb0a69['name']));if(_0xc010d3){var _0x1ea116=(_0xdb0a69[_0x604b('0x16')]||0xa)*0x3e8;var _0x50b89a,_0x5ac9a1;var _0x1d8848=seqqueue['createQueue'](_0x1ea116);_0x1d8848['id']=_0x4a14ba;_0x1d8848[_0x604b('0x17')]=_0x1ea116;_0x1d8848[_0x604b('0x18')]=_0x174f83[_0x604b('0x18')];writeLog(_0x4a14ba,_0xc010d3,util[_0x604b('0xc')](_0x604b('0x19'),_0x1ea116));_0x4d7619[_0x604b('0x1a')][_0x4a14ba]['on'](_0x604b('0x1b'),function(){logger[_0x604b('0xb')](_0x604b('0x1c'),_0x4a14ba);clearTimeout(_0x5ac9a1);_0x5ac9a1=undefined;_0x1d8848[_0x604b('0x1d')]();if(_0x4d7619['rules'][_0x4a14ba]){delete _0x4d7619['rules'][_0x4a14ba];}_0x5f126c[_0x604b('0x1e')]();});_0x4d7619[_0x604b('0x1a')][_0x4a14ba]['on'](_0x604b('0x1f'),function(){if(_0x4d7619[_0x604b('0x1a')][_0x4a14ba]){delete _0x4d7619[_0x604b('0x1a')][_0x4a14ba];}});_0x5ac9a1=setTimeout(function(){logger[_0x604b('0xb')](_0x604b('0x20'),_0x4a14ba);clearTimeout(_0x5ac9a1);_0x1d8848[_0x604b('0x1d')]();_0x5f126c['next']();},_0x1ea116);strategy[_0x604b('0x21')](_0x1d8848,_0xc010d3,_0x4d7619,_0x174f83);}else{logger[_0x604b('0x11')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4a14ba,_0xdb0a69[_0x604b('0xe')]);_0x5f126c[_0x604b('0x1e')]();}}}catch(_0xd731bf){console[_0x604b('0x22')](_0xd731bf);logger['error'](_0x604b('0x23'),_0x4a14ba,_0xd731bf['stack']);_0x5f126c['stop']();}};}; \ No newline at end of file +var _0xd677=['join','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','info','close','rules','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','routing','./strategy','number','format','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xd677,0x179));var _0x7d67=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd677[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require(_0x7d67('0x0'));var _=require('lodash');var util=require(_0x7d67('0x1'));var seqqueue=require(_0x7d67('0x2'));var logger=require('../../../../config/logger')(_0x7d67('0x3'));var strategy=require(_0x7d67('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7d67('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x9f7872,_0x50272b,_0x251b06){return logger['info'](util[_0x7d67('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x9f7872,_0x50272b[_0x7d67('0x7')],_0x251b06));}function handleFindAgent(_0x27a142){return function(_0xd6757a){return _0xd6757a[_0x7d67('0x7')][_0x7d67('0x8')]()===_0x27a142[_0x7d67('0x8')]();};}exports['consequence']=function(_0x4e95f8,_0x63d0c,_0x52aa59,_0xca3d9e){return function(_0x2d855f){try{var _0x42a72c={'name':_0x63d0c[0x0],'timeout':_0x63d0c[0x1]};var _0xf775f6=queue[_0x7d67('0x0')](_0x42a72c,{'typecast':!![]});if(_0xf775f6['length']){logger[_0x7d67('0x9')](_0x7d67('0xa'),_0x4e95f8,_[_0x7d67('0xb')](_0xf775f6,_0x7d67('0xc'))[_0x7d67('0xd')](',\x20'));_0x2d855f[_0x7d67('0xe')]();}else{var _0x4f1c25=_[_0x7d67('0xf')](_0x52aa59['agents'],handleFindAgent(_0x42a72c[_0x7d67('0x7')]));if(_0x4f1c25){var _0x39d4a5=(_0x42a72c[_0x7d67('0x10')]||0xa)*0x3e8;var _0x17d8da,_0x139324;var _0x1690d5=seqqueue[_0x7d67('0x11')](_0x39d4a5);_0x1690d5['id']=_0x4e95f8;_0x1690d5[_0x7d67('0x12')]=_0x39d4a5;_0x1690d5[_0x7d67('0x13')]=_0xca3d9e['channel'];writeLog(_0x4e95f8,_0x4f1c25,util[_0x7d67('0x6')](_0x7d67('0x14'),_0x39d4a5));_0x52aa59['rules'][_0x4e95f8]['on'](_0x7d67('0x15'),function(){logger[_0x7d67('0x16')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4e95f8);clearTimeout(_0x139324);_0x139324=undefined;_0x1690d5[_0x7d67('0x17')]();if(_0x52aa59[_0x7d67('0x18')][_0x4e95f8]){delete _0x52aa59[_0x7d67('0x18')][_0x4e95f8];}_0x2d855f['stop']();});_0x52aa59['rules'][_0x4e95f8]['on']('complete',function(){if(_0x52aa59['rules'][_0x4e95f8]){delete _0x52aa59[_0x7d67('0x18')][_0x4e95f8];}});_0x139324=setTimeout(function(){logger[_0x7d67('0x16')]('[%s][AGENT]\x20ROUTING\x20END',_0x4e95f8);clearTimeout(_0x139324);_0x1690d5[_0x7d67('0x17')]();_0x2d855f[_0x7d67('0x19')]();},_0x39d4a5);strategy[_0x7d67('0x1a')](_0x1690d5,_0x4f1c25,_0x52aa59,_0xca3d9e);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4e95f8,_0x42a72c[_0x7d67('0x7')]);_0x2d855f['stop']();}}}catch(_0x58e06c){console[_0x7d67('0x1b')](_0x58e06c);logger[_0x7d67('0x9')](_0x7d67('0x1c'),_0x4e95f8,_0x58e06c[_0x7d67('0x1d')]);_0x2d855f[_0x7d67('0xe')]();}};}; \ 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 b5a80c6..60b19c9 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 _0x45fc=['info','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','dialogState','Failed','catch','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x22019b,_0x268d80){var _0x2bfb25=function(_0x548595){while(--_0x548595){_0x22019b['push'](_0x22019b['shift']());}};_0x2bfb25(++_0x268d80);}(_0x45fc,0x1c9));var _0xc45f=function(_0x177bc0,_0x126f66){_0x177bc0=_0x177bc0-0x0;var _0x3490d6=_0x45fc[_0x177bc0];return _0x3490d6;};'use strict';var _=require(_0xc45f('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xc45f('0x1'));var rpc={'chatMessage':require(_0xc45f('0x2')),'openchannelMessage':require(_0xc45f('0x3')),'mailMessage':require(_0xc45f('0x4')),'smsMessage':require(_0xc45f('0x5')),'faxMessage':require(_0xc45f('0x6')),'whatsappMessage':require(_0xc45f('0x7'))};exports[_0xc45f('0x8')]=function(_0x4d5a77,_0x547507){return function(_0x17b279){try{if(!_[_0xc45f('0x9')](this['interaction'][_0xc45f('0xa')])){logger['info'](_0xc45f('0xb'),_0x4d5a77,_0xc45f('0xc'));return _0x17b279[_0xc45f('0xd')]();}var _0x38bdf3={'ContactId':this[_0xc45f('0xe')]['id'],'sentAt':moment()[_0xc45f('0xf')](_0xc45f('0x10')),'direction':_0xc45f('0x11')};if(this[_0xc45f('0x12')]===_0xc45f('0x13')||this[_0xc45f('0x12')]===_0xc45f('0x14')){_0x38bdf3[_0xc45f('0x15')]=this[_0xc45f('0x16')]['phone'];}var _0x1ed443=this[_0xc45f('0x12')];if(_0x1ed443==='chat'){_0x38bdf3[_0xc45f('0x17')]=this[_0xc45f('0x18')]['id'];}else{_0x38bdf3[_['upperFirst'](_0x1ed443)+'AccountId']=this['account']['id'];}_0x38bdf3[_[_0xc45f('0x19')](_0x1ed443)+_0xc45f('0x1a')]=this['interaction']['id'];if(this['interaction'][_0xc45f('0x1b')]){var _0x33e771=_0x547507[0x4];if(!_[_0xc45f('0x1c')](_0x33e771)){_0x38bdf3[_0xc45f('0x1d')]=utils[_0xc45f('0x1e')](_0x33e771,this);return rpc[_0x1ed443+_0xc45f('0x1f')]['create'](_0x38bdf3)[_0xc45f('0x20')](function(_0xa38f9f){logger[_0xc45f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x4d5a77,_0x38bdf3[_0xc45f('0x1d')]);})['catch'](function(_0x541bde){logger[_0xc45f('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4d5a77,JSON[_0xc45f('0x23')](_0x541bde));})[_0xc45f('0x24')](function(){logger[_0xc45f('0x21')](_0xc45f('0x25'),_0x4d5a77);_0x17b279['stop']();});}else{logger[_0xc45f('0x21')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4d5a77);_0x17b279[_0xc45f('0x26')]();}}else{var _0xa032c9=this;var _0x430cf9=new AWS[(_0xc45f('0x27'))]({'accessKeyId':_0x547507[0x0],'secretAccessKey':_0x547507[0x1],'region':_0x547507[0x2]});var _0x22fcad={'botAlias':_0xc45f('0x28'),'botName':_0x547507[0x3],'inputText':this[_0xc45f('0x29')][_0xc45f('0x1d')],'userId':this[_0xc45f('0x12')]+':'+this[_0xc45f('0x16')]['id'][_0xc45f('0x2a')]()};_0x430cf9[_0xc45f('0x2b')](_0x22fcad,function(_0x53e62a,_0x59a0fb){if(_0x53e62a){logger[_0xc45f('0x22')](_0xc45f('0xb'),_0x4d5a77,_0x53e62a[_0xc45f('0x29')]);_0x17b279[_0xc45f('0xd')]();}else if(_0x59a0fb&&_0x59a0fb[_0xc45f('0x29')]){_0xa032c9['body']['amazonlex']=_0x59a0fb;_0x38bdf3[_0xc45f('0x1d')]=_0x59a0fb[_0xc45f('0x29')];_0x38bdf3[_0xc45f('0x2c')]=_0xc45f('0x2d');_0x38bdf3['providerResponse']=JSON[_0xc45f('0x23')](_0x59a0fb);return rpc[_0x1ed443+'Message']['create'](_0x38bdf3)[_0xc45f('0x20')](function(_0x19356d){logger[_0xc45f('0x21')](_0xc45f('0xb'),_0x4d5a77,_0x38bdf3[_0xc45f('0x1d')]);if(_0x59a0fb[_0xc45f('0x2e')]==_0xc45f('0x2f')){_0x17b279[_0xc45f('0xd')]();}else{_0x17b279['stop']();}})[_0xc45f('0x30')](function(_0x4f326a){logger[_0xc45f('0x22')]('[%s][AMAZONLEX]\x20%s',_0x4d5a77,JSON[_0xc45f('0x23')](_0x4f326a));_0x17b279[_0xc45f('0xd')]();});}else{_0x17b279[_0xc45f('0xd')]();}});}}catch(_0x7aab9b){logger[_0xc45f('0x22')](_0xc45f('0xb'),_0x4d5a77,JSON['stringify'](_0x7aab9b));_0x17b279[_0xc45f('0x26')]();}};}; \ No newline at end of file +var _0xa804=['message','amazonlex','providerName','providerResponse','stringify','Message','Failed','stop','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','format','out','channel','sms','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','error','$LATEST','toString'];(function(_0x9f021c,_0x59b485){var _0x3f6ca8=function(_0x2d9b17){while(--_0x2d9b17){_0x9f021c['push'](_0x9f021c['shift']());}};_0x3f6ca8(++_0x59b485);}(_0xa804,0x65));var _0x4a80=function(_0x1cfb30,_0x40ce73){_0x1cfb30=_0x1cfb30-0x0;var _0x3ee601=_0xa804[_0x1cfb30];return _0x3ee601;};'use strict';var _=require(_0x4a80('0x0'));var moment=require(_0x4a80('0x1'));var AWS=require(_0x4a80('0x2'));var utils=require(_0x4a80('0x3'));var logger=require(_0x4a80('0x4'))(_0x4a80('0x5'));var rpc={'chatMessage':require(_0x4a80('0x6')),'openchannelMessage':require(_0x4a80('0x7')),'mailMessage':require(_0x4a80('0x8')),'smsMessage':require(_0x4a80('0x9')),'faxMessage':require(_0x4a80('0xa')),'whatsappMessage':require(_0x4a80('0xb'))};exports[_0x4a80('0xc')]=function(_0x619355,_0x3d29c9){return function(_0x1f6d9e){try{if(!_['isNil'](this[_0x4a80('0xd')][_0x4a80('0xe')])){logger['info'](_0x4a80('0xf'),_0x619355,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1f6d9e[_0x4a80('0x10')]();}var _0x878485={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4a80('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4a80('0x12')};if(this[_0x4a80('0x13')]===_0x4a80('0x14')||this['channel']==='whatsapp'){_0x878485[_0x4a80('0x15')]=this['interaction'][_0x4a80('0x15')];}var _0x1c0f2a=this[_0x4a80('0x13')];if(_0x1c0f2a===_0x4a80('0x16')){_0x878485['ChatWebsiteId']=this[_0x4a80('0x17')]['id'];}else{_0x878485[_[_0x4a80('0x18')](_0x1c0f2a)+_0x4a80('0x19')]=this[_0x4a80('0x17')]['id'];}_0x878485[_['upperFirst'](_0x1c0f2a)+_0x4a80('0x1a')]=this[_0x4a80('0xd')]['id'];if(this[_0x4a80('0xd')][_0x4a80('0x1b')]){var _0x1c6d73=_0x3d29c9[0x4];if(!_[_0x4a80('0x1c')](_0x1c6d73)){_0x878485[_0x4a80('0x1d')]=utils[_0x4a80('0x1e')](_0x1c6d73,this);return rpc[_0x1c0f2a+'Message'][_0x4a80('0x1f')](_0x878485)[_0x4a80('0x20')](function(_0x594503){logger[_0x4a80('0x21')](_0x4a80('0xf'),_0x619355,_0x878485['body']);})['catch'](function(_0x178afd){logger[_0x4a80('0x22')](_0x4a80('0xf'),_0x619355,JSON['stringify'](_0x178afd));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x619355);_0x1f6d9e['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x619355);_0x1f6d9e['stop']();}}else{var _0x2b016f=this;var _0x1f4bc2=new AWS['LexRuntime']({'accessKeyId':_0x3d29c9[0x0],'secretAccessKey':_0x3d29c9[0x1],'region':_0x3d29c9[0x2]});var _0x3ab61c={'botAlias':_0x4a80('0x23'),'botName':_0x3d29c9[0x3],'inputText':this['message']['body'],'userId':this[_0x4a80('0x13')]+':'+this[_0x4a80('0xd')]['id'][_0x4a80('0x24')]()};_0x1f4bc2['postText'](_0x3ab61c,function(_0x455a9f,_0x3482da){if(_0x455a9f){logger['error'](_0x4a80('0xf'),_0x619355,_0x455a9f[_0x4a80('0x25')]);_0x1f6d9e[_0x4a80('0x10')]();}else if(_0x3482da&&_0x3482da[_0x4a80('0x25')]){_0x2b016f['body'][_0x4a80('0x26')]=_0x3482da;_0x878485[_0x4a80('0x1d')]=_0x3482da[_0x4a80('0x25')];_0x878485[_0x4a80('0x27')]=_0x4a80('0x26');_0x878485[_0x4a80('0x28')]=JSON[_0x4a80('0x29')](_0x3482da);return rpc[_0x1c0f2a+_0x4a80('0x2a')][_0x4a80('0x1f')](_0x878485)[_0x4a80('0x20')](function(_0x23dde2){logger[_0x4a80('0x21')]('[%s][AMAZONLEX]\x20%s',_0x619355,_0x878485['body']);if(_0x3482da['dialogState']==_0x4a80('0x2b')){_0x1f6d9e[_0x4a80('0x10')]();}else{_0x1f6d9e[_0x4a80('0x2c')]();}})[_0x4a80('0x2d')](function(_0x5bdc78){logger[_0x4a80('0x22')]('[%s][AMAZONLEX]\x20%s',_0x619355,JSON[_0x4a80('0x29')](_0x5bdc78));_0x1f6d9e['next']();});}else{_0x1f6d9e[_0x4a80('0x10')]();}});}}catch(_0x3c3cd8){logger[_0x4a80('0x22')](_0x4a80('0xf'),_0x619355,JSON[_0x4a80('0x29')](_0x3c3cd8));_0x1f6d9e['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 6215735..e7cfe98 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 _0x23ae=['ChatWebsiteId','account','upperFirst','Message','messageId','html','','replace','';_0x35512f[_0xe23a('0x31')]={'Auto-Submitted':_0xe23a('0x32'),'X-Auto-Response-Suppress':'All','Precedence':_0xe23a('0x33')};return mailRpc['sendMailMessage'](this[_0xe23a('0x28')][_0xe23a('0x34')],_0x35512f)['then'](function(_0x57565c){logger['info'](_0xe23a('0x35'),_0x13d2b8);_0x35512f['messageId']=_0x57565c[_0xe23a('0x20')]['messageId'];return rpc[_0x144446+_0xe23a('0x2a')][_0xe23a('0x36')](_0x35512f);})[_0xe23a('0x37')](function(_0x3e1294){logger[_0xe23a('0x16')](_0xe23a('0x11'),_0x13d2b8,JSON[_0xe23a('0x38')](_0x3e1294));})[_0xe23a('0x39')](function(_0x57dcfd){logger[_0xe23a('0x3a')](_0xe23a('0x3b'),_0x13d2b8,JSON[_0xe23a('0x38')](_0x57dcfd));})[_0xe23a('0x3c')](function(){Promise[_0xe23a('0x3d')]()[_0xe23a('0x37')](function(){if(_0x59aa45[0x0]!=='2'||_0x576ba7[_0xe23a('0x18')])return;return rpc[_0x144446+'Interaction'][_0xe23a('0x3e')](_0x576ba7['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4cdca4){logger['info'](_0xe23a('0x19'),_0x13d2b8,JSON[_0xe23a('0x38')](_0x4cdca4));})['catch'](function(_0x19f0b2){logger[_0xe23a('0x3a')](_0xe23a('0x3f'),_0x13d2b8,JSON[_0xe23a('0x38')](_0x19f0b2));});})[_0xe23a('0x37')](function(){_0x121199[_0xe23a('0x17')]();});});}else{return rpc[this[_0xe23a('0x1d')]+'Message'][_0xe23a('0x36')](_0x35512f)[_0xe23a('0x37')](function(){logger[_0xe23a('0x16')](_0xe23a('0x11'),_0x13d2b8,_0x35512f['body']);})[_0xe23a('0x39')](function(_0x54ff29){logger['error'](_0xe23a('0x11'),_0x13d2b8,JSON['stringify'](_0x54ff29));})[_0xe23a('0x3c')](function(){Promise['resolve']()[_0xe23a('0x37')](function(){if(_0x59aa45[0x0]!=='2'||_0x576ba7[_0xe23a('0x18')])return;return rpc[_0x144446+_0xe23a('0x40')][_0xe23a('0x3e')](_0x576ba7['id'],{'autoreplyExecuted':!![]})[_0xe23a('0x37')](function(_0x16af39){logger['info'](_0xe23a('0x19'),_0x13d2b8,JSON['stringify'](_0x16af39));})[_0xe23a('0x39')](function(_0x3dc66e){logger[_0xe23a('0x3a')](_0xe23a('0x3f'),_0x13d2b8,JSON[_0xe23a('0x38')](_0x3dc66e));});})['then'](function(){_0x121199[_0xe23a('0x17')]();});});}}}catch(_0x3fc18c){logger[_0xe23a('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x13d2b8,JSON['stringify'](_0x3fc18c));_0x121199[_0xe23a('0x41')]();}};}; \ No newline at end of file +var _0x35c6=['update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','channel','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','html','','replace','','auto-replied','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','error','finally','autoreplyExecuted','Interaction'];(function(_0x31eeb6,_0xa9f9f2){var _0x4c6e05=function(_0x2f7d69){while(--_0x2f7d69){_0x31eeb6['push'](_0x31eeb6['shift']());}};_0x4c6e05(++_0xa9f9f2);}(_0x35c6,0x112));var _0x635c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x35c6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x635c('0x0'));var moment=require(_0x635c('0x1'));var utils=require(_0x635c('0x2'));var logger=require(_0x635c('0x3'))(_0x635c('0x4'));var rpc={'chatMessage':require(_0x635c('0x5')),'openchannelMessage':require(_0x635c('0x6')),'mailMessage':require(_0x635c('0x7')),'smsMessage':require(_0x635c('0x8')),'faxMessage':require(_0x635c('0x9')),'whatsappMessage':require(_0x635c('0xa')),'chatInteraction':require(_0x635c('0xb')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x635c('0xc')),'smsInteraction':require(_0x635c('0xd')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x635c('0xe'))};var mailRpc=require(_0x635c('0xf'));exports[_0x635c('0x10')]=function(_0x3629d5,_0x2667b5,_0x372f35,_0x440896){return function(_0xc9b7ef){try{var _0x3a531e=this['channel'];if(_0x3a531e==='mail'&&_0x440896['body'][_0x635c('0x11')]){logger[_0x635c('0x12')]('[%s][AUTOREPLY]\x20%s',_0x3629d5,_0x635c('0x13'));return _0xc9b7ef[_0x635c('0x14')]();}if(_0x2667b5[0x0]==='1'&&(_[_0x635c('0x15')](this[_0x635c('0x16')][_0x635c('0x17')])||!this[_0x635c('0x16')]['created'])){logger[_0x635c('0x12')](_0x635c('0x18'),_0x3629d5,'Autoreply\x20already\x20sent');return _0xc9b7ef[_0x635c('0x14')]();}if(_0x2667b5[0x0]==='2'&&this[_0x635c('0x16')]['autoreplyExecuted']){logger[_0x635c('0x12')](_0x635c('0x19'),_0x3629d5,_0x635c('0x1a'));return _0xc9b7ef[_0x635c('0x14')]();}var _0x3dd05c={'ContactId':this[_0x635c('0x1b')]['id'],'sentAt':moment()['format'](_0x635c('0x1c')),'direction':'out'};if(this[_0x635c('0x1d')]===_0x635c('0x1e')){_0x3dd05c[_0x635c('0x1f')]=utils[_0x635c('0x20')](_0x2667b5[0x2],this);}else{_0x3dd05c['body']=utils['getMustacheRender'](_0x2667b5[0x1],this);}if(this['message']){_0x3dd05c['to']=this[_0x635c('0x21')][_0x635c('0x22')]||'';if(this['channel']===_0x635c('0x1e')&&_0x2667b5[0x1]==='1'){_0x3dd05c['cc']=this[_0x635c('0x21')]['cc']||'';}_0x3dd05c[_0x635c('0x22')]=this[_0x635c('0x21')]['to']||'';_0x3dd05c['phone']=this[_0x635c('0x21')][_0x635c('0x23')]||'';_0x3dd05c[_0x635c('0x24')]=!![];if(this[_0x635c('0x21')]['subject']){_0x3dd05c[_0x635c('0x25')]='';_0x3dd05c[_0x635c('0x25')]+=_[_0x635c('0x26')](this['message'][_0x635c('0x25')],'Re:')?'':_0x635c('0x27');_0x3dd05c[_0x635c('0x25')]+=this[_0x635c('0x21')]['subject'];}}if(this['channel']===_0x635c('0x28')){_0x3dd05c[_0x635c('0x29')]=this[_0x635c('0x2a')]['id'];}else{_0x3dd05c[_[_0x635c('0x2b')](this[_0x635c('0x1d')])+_0x635c('0x2c')]=this[_0x635c('0x2a')]['id'];}_0x3dd05c[_[_0x635c('0x2b')](this[_0x635c('0x1d')])+_0x635c('0x2d')]=this[_0x635c('0x16')]['id'];var _0x124a74=this['interaction'];if(rpc[this[_0x635c('0x1d')]+'Message']){if(this[_0x635c('0x1d')]==='mail'){_0x3dd05c[_0x635c('0x2e')]=this[_0x635c('0x21')]['messageId'];_0x3dd05c[_0x635c('0x2f')]=_0x635c('0x30')+_[_0x635c('0x31')](_0x3dd05c[_0x635c('0x1f')],']+(>|$)/g,''),'priorityTrue':_0x409298[0x1],'priorityFalse':_0x409298[0x2]};var _0x2fb4cc=gotoif[_0x2b5d('0x0')](_0x8299ed,{'typecast':!![]});if(_0x2fb4cc[_0x2b5d('0xb')]){logger['error'](_0x2b5d('0xc'),_0x59f88a,_[_0x2b5d('0xd')](_0x2fb4cc,'message')['join'](',\x20'));_0xd79592[_0x2b5d('0xe')]();}else{try{var _0xcfb2e2=eval('('+_0x8299ed[_0x2b5d('0xf')]+')');var _0x264209=_0xcfb2e2?_0x8299ed['priorityTrue']:_0x8299ed[_0x2b5d('0x10')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x59f88a,_0x8299ed['condition'],_0xcfb2e2,_0x264209||_0x2b5d('0x11'));if(_0x264209){var _0x84fa14=_['findIndex'](_0xd79592[_0x2b5d('0x12')](),{'p':_0x264209});if(_0x84fa14>=0x0){logger['info'](_0x2b5d('0x13'),_0x59f88a,_0x264209||'next',_0x84fa14);_0xd79592['next'](_0x84fa14);}else{logger[_0x2b5d('0x14')](_0x2b5d('0x15'),_0x59f88a,_0x264209||'next');_0xd79592[_0x2b5d('0xe')]();}}else{_0xd79592[_0x2b5d('0x11')]();}}catch(_0x1ae0b9){logger[_0x2b5d('0x16')](_0x2b5d('0x17'),_0x59f88a,_0x1ae0b9['message']);_0xd79592[_0x2b5d('0xe')]();}}}catch(_0x595cc4){logger[_0x2b5d('0x16')](_0x2b5d('0xc'),_0x59f88a,JSON[_0x2b5d('0x18')](_0x595cc4));_0xd79592[_0x2b5d('0xe')]();}};}; \ No newline at end of file +var _0x229b=['priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x1c3c59,_0x5f251a){var _0x1100b7=function(_0x1cf80c){while(--_0x1cf80c){_0x1c3c59['push'](_0x1c3c59['shift']());}};_0x1100b7(++_0x5f251a);}(_0x229b,0xa7));var _0xb229=function(_0x149c9c,_0x191a50){_0x149c9c=_0x149c9c-0x0;var _0xc952de=_0x229b[_0x149c9c];return _0xc952de;};'use strict';var schema=require(_0xb229('0x0'));var _=require(_0xb229('0x1'));var htmlToText=require(_0xb229('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xb229('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xb229('0x4')},'priorityTrue':{'type':_0xb229('0x5'),'message':_0xb229('0x6')},'priorityFalse':{'type':_0xb229('0x5'),'message':_0xb229('0x7')}});exports['consequence']=function(_0x33b80d,_0x3c5d80){return function(_0x18be3f){try{var _0x4ddfc9={'condition':htmlToText[_0xb229('0x8')](utils[_0xb229('0x9')](_0x3c5d80[0x0],this),{'wordwrap':![]})[_0xb229('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c5d80[0x1],'priorityFalse':_0x3c5d80[0x2]};var _0x1692ff=gotoif['validate'](_0x4ddfc9,{'typecast':!![]});if(_0x1692ff[_0xb229('0xb')]){logger[_0xb229('0xc')](_0xb229('0xd'),_0x33b80d,_['map'](_0x1692ff,'message')[_0xb229('0xe')](',\x20'));_0x18be3f[_0xb229('0xf')]();}else{try{var _0x3dcff0=eval('('+_0x4ddfc9[_0xb229('0x10')]+')');var _0x26cd62=_0x3dcff0?_0x4ddfc9[_0xb229('0x11')]:_0x4ddfc9[_0xb229('0x12')];logger[_0xb229('0x13')](_0xb229('0x14'),_0x33b80d,_0x4ddfc9['condition'],_0x3dcff0,_0x26cd62||_0xb229('0x15'));if(_0x26cd62){var _0xa7fa33=_[_0xb229('0x16')](_0x18be3f[_0xb229('0x17')](),{'p':_0x26cd62});if(_0xa7fa33>=0x0){logger[_0xb229('0x13')](_0xb229('0x18'),_0x33b80d,_0x26cd62||_0xb229('0x15'),_0xa7fa33);_0x18be3f[_0xb229('0x15')](_0xa7fa33);}else{logger[_0xb229('0x13')](_0xb229('0x19'),_0x33b80d,_0x26cd62||_0xb229('0x15'));_0x18be3f['stop']();}}else{_0x18be3f['next']();}}catch(_0x39e86f){logger[_0xb229('0xc')](_0xb229('0x1a'),_0x33b80d,_0x39e86f[_0xb229('0x1b')]);_0x18be3f[_0xb229('0xf')]();}}}catch(_0x2621d0){logger[_0xb229('0xc')](_0xb229('0xd'),_0x33b80d,JSON[_0xb229('0x1c')](_0x2621d0));_0x18be3f['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 3a89882..56d9dd9 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 _0x1bd0=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next'];(function(_0x18164a,_0x499346){var _0x796236=function(_0x57d323){while(--_0x57d323){_0x18164a['push'](_0x18164a['shift']());}};_0x796236(++_0x499346);}(_0x1bd0,0x1b4));var _0x01bd=function(_0x54e2c1,_0x41e892){_0x54e2c1=_0x54e2c1-0x0;var _0xbcad90=_0x1bd0[_0x54e2c1];return _0xbcad90;};'use strict';var schema=require(_0x01bd('0x0'));var _=require(_0x01bd('0x1'));var logger=require('../../../../config/logger')(_0x01bd('0x2'));var gotop=schema({'priority':{'type':_0x01bd('0x3'),'required':!![],'message':_0x01bd('0x4')}});exports[_0x01bd('0x5')]=function(_0x53d1fe,_0xf50b0e){return function(_0x299a57){try{var _0x334d99={'priority':_0xf50b0e[0x0]};var _0x20fdf4=gotop[_0x01bd('0x0')](_0x334d99,{'typecast':!![]});if(_0x20fdf4['length']){logger['error'](_0x01bd('0x6'),_0x53d1fe,_['map'](_0x20fdf4,'message')[_0x01bd('0x7')](',\x20'));_0x299a57['stop']();}else{logger['info'](_0x01bd('0x8'),_0x53d1fe,_0x334d99['priority']);if(_0x334d99[_0x01bd('0x9')]){var _0x339d6d=_[_0x01bd('0xa')](_0x299a57[_0x01bd('0xb')](),{'p':_0x334d99['priority']});if(_0x339d6d>=0x0){logger[_0x01bd('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x53d1fe,_0x334d99[_0x01bd('0x9')]||'next',_0x339d6d);_0x299a57[_0x01bd('0xd')](_0x339d6d);}else{logger['info'](_0x01bd('0xe'),_0x53d1fe,_0x334d99['priority']||_0x01bd('0xd'));_0x299a57[_0x01bd('0xf')]();}}else{_0x299a57[_0x01bd('0xd')]();}}}catch(_0x3b2b2e){logger[_0x01bd('0x10')](_0x01bd('0x6'),_0x53d1fe,JSON[_0x01bd('0x11')](_0x3b2b2e));_0x299a57['stop']();}};}; \ No newline at end of file +var _0x0601=['[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','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'];(function(_0xc817c2,_0x584c72){var _0x41be1b=function(_0x561f96){while(--_0x561f96){_0xc817c2['push'](_0xc817c2['shift']());}};_0x41be1b(++_0x584c72);}(_0x0601,0x122));var _0x1060=function(_0xd685e,_0x360045){_0xd685e=_0xd685e-0x0;var _0x5ef5e0=_0x0601[_0xd685e];return _0x5ef5e0;};'use strict';var schema=require(_0x1060('0x0'));var _=require(_0x1060('0x1'));var logger=require('../../../../config/logger')(_0x1060('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x1060('0x3')}});exports['consequence']=function(_0x29a785,_0x1685df){return function(_0x44c7d7){try{var _0x44cecf={'priority':_0x1685df[0x0]};var _0x49c5df=gotop[_0x1060('0x0')](_0x44cecf,{'typecast':!![]});if(_0x49c5df[_0x1060('0x4')]){logger[_0x1060('0x5')]('[%s][GOTOP]\x20%s',_0x29a785,_[_0x1060('0x6')](_0x49c5df,'message')[_0x1060('0x7')](',\x20'));_0x44c7d7[_0x1060('0x8')]();}else{logger['info'](_0x1060('0x9'),_0x29a785,_0x44cecf[_0x1060('0xa')]);if(_0x44cecf[_0x1060('0xa')]){var _0x5d2c42=_['findIndex'](_0x44c7d7[_0x1060('0xb')](),{'p':_0x44cecf['priority']});if(_0x5d2c42>=0x0){logger[_0x1060('0xc')](_0x1060('0xd'),_0x29a785,_0x44cecf[_0x1060('0xa')]||_0x1060('0xe'),_0x5d2c42);_0x44c7d7['next'](_0x5d2c42);}else{logger[_0x1060('0xc')](_0x1060('0xf'),_0x29a785,_0x44cecf['priority']||_0x1060('0xe'));_0x44c7d7[_0x1060('0x8')]();}}else{_0x44c7d7[_0x1060('0xe')]();}}}catch(_0xb09140){logger[_0x1060('0x5')](_0x1060('0x10'),_0x29a785,JSON[_0x1060('0x11')](_0xb09140));_0x44c7d7[_0x1060('0x8')]();}};}; \ 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 233b115..a913eb8 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 _0x945a=['channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender'];(function(_0x47c3b7,_0x5eb94e){var _0x41d1d5=function(_0x3bee47){while(--_0x3bee47){_0x47c3b7['push'](_0x47c3b7['shift']());}};_0x41d1d5(++_0x5eb94e);}(_0x945a,0x1d2));var _0xa945=function(_0x55d244,_0x3bf14d){_0x55d244=_0x55d244-0x0;var _0x422d81=_0x945a[_0x55d244];return _0x422d81;};'use strict';var _=require('lodash');var utils=require(_0xa945('0x0'));var logger=require(_0xa945('0x1'))(_0xa945('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa945('0x3')),'mailMessage':require(_0xa945('0x4')),'smsMessage':require(_0xa945('0x5')),'faxMessage':require(_0xa945('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa945('0x7')]=function(_0x3b34a5,_0x24d1ef){return function(_0x26b382){try{var _0x401c7b={'body':utils[_0xa945('0x8')](_0x24d1ef[0x0],this),'ContactId':this['contact']['id']};if(this[_0xa945('0x9')]==='chat'){_0x401c7b[_0xa945('0xa')]=this[_0xa945('0xb')]['id'];}else{_0x401c7b[_['upperFirst'](this[_0xa945('0x9')])+_0xa945('0xc')]=this[_0xa945('0xb')]['id'];}_0x401c7b[_[_0xa945('0xd')](this[_0xa945('0x9')])+_0xa945('0xe')]=this[_0xa945('0xf')]['id'];if(rpc[this['channel']+_0xa945('0x10')]){return rpc[this[_0xa945('0x9')]+_0xa945('0x10')][_0xa945('0x11')](_0x401c7b)[_0xa945('0x12')](function(_0x2ce22b){logger['info']('[%s][MESSAGE]\x20%s',_0x3b34a5,_0x401c7b[_0xa945('0x13')]);_0x26b382[_0xa945('0x14')]();})[_0xa945('0x15')](function(_0x49308e){logger[_0xa945('0x16')]('[%s][MESSAGE]\x20%s',_0x3b34a5,JSON[_0xa945('0x17')](_0x49308e));_0x26b382['stop']();});}}catch(_0x3379e0){logger['error']('[%s][MESSAGE]\x20%s',_0x3b34a5,JSON['stringify'](_0x3379e0));_0x26b382[_0xa945('0x18')]();}};}; \ No newline at end of file +var _0x61ce=['getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61ce,0xeb));var _0xe61c=function(_0x47730b,_0x4044e1){_0x47730b=_0x47730b-0x0;var _0x593305=_0x61ce[_0x47730b];return _0x593305;};'use strict';var _=require('lodash');var utils=require(_0xe61c('0x0'));var logger=require(_0xe61c('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe61c('0x2')),'mailMessage':require(_0xe61c('0x3')),'smsMessage':require(_0xe61c('0x4')),'faxMessage':require(_0xe61c('0x5')),'whatsappMessage':require(_0xe61c('0x6'))};exports[_0xe61c('0x7')]=function(_0x18488d,_0x2b93cc){return function(_0x1f2797){try{var _0x547ad7={'body':utils[_0xe61c('0x8')](_0x2b93cc[0x0],this),'ContactId':this[_0xe61c('0x9')]['id']};if(this[_0xe61c('0xa')]===_0xe61c('0xb')){_0x547ad7[_0xe61c('0xc')]=this['account']['id'];}else{_0x547ad7[_[_0xe61c('0xd')](this[_0xe61c('0xa')])+_0xe61c('0xe')]=this[_0xe61c('0xf')]['id'];}_0x547ad7[_[_0xe61c('0xd')](this[_0xe61c('0xa')])+'InteractionId']=this[_0xe61c('0x10')]['id'];if(rpc[this[_0xe61c('0xa')]+'Message']){return rpc[this['channel']+_0xe61c('0x11')][_0xe61c('0x12')](_0x547ad7)[_0xe61c('0x13')](function(_0x3bd46b){logger['info'](_0xe61c('0x14'),_0x18488d,_0x547ad7[_0xe61c('0x15')]);_0x1f2797[_0xe61c('0x16')]();})[_0xe61c('0x17')](function(_0x349237){logger[_0xe61c('0x18')](_0xe61c('0x14'),_0x18488d,JSON[_0xe61c('0x19')](_0x349237));_0x1f2797[_0xe61c('0x1a')]();});}}catch(_0x20a1a1){logger[_0xe61c('0x18')](_0xe61c('0x14'),_0x18488d,JSON['stringify'](_0x20a1a1));_0x1f2797[_0xe61c('0x1a')]();}};}; \ 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 0583be0..5aa3670 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 _0xde30=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger'];(function(_0x1e8ef1,_0x4fbe5c){var _0x12cbaf=function(_0x5b2bb6){while(--_0x5b2bb6){_0x1e8ef1['push'](_0x1e8ef1['shift']());}};_0x12cbaf(++_0x4fbe5c);}(_0xde30,0x1d6));var _0x0de3=function(_0x26c4fc,_0x4e2b98){_0x26c4fc=_0x26c4fc-0x0;var _0xe862d6=_0xde30[_0x26c4fc];return _0xe862d6;};'use strict';var utils=require(_0x0de3('0x0'));var logger=require(_0x0de3('0x1'))('routing');exports[_0x0de3('0x2')]=function(_0xfca81f,_0x1b8321){return function(_0xc55c9c){try{logger['info'](_0x0de3('0x3'),_0xfca81f,utils[_0x0de3('0x4')](_0x1b8321[0x0],this));_0xc55c9c[_0x0de3('0x5')]();}catch(_0x488d78){logger[_0x0de3('0x6')](_0x0de3('0x3'),_0xfca81f,JSON['stringify'](_0x488d78));_0xc55c9c[_0x0de3('0x7')]();}};}; \ No newline at end of file +var _0x2ba9=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0xb46cee,_0x734f6b){var _0x5e44f0=function(_0x5c90a6){while(--_0x5c90a6){_0xb46cee['push'](_0xb46cee['shift']());}};_0x5e44f0(++_0x734f6b);}(_0x2ba9,0x10e));var _0x92ba=function(_0xd53b81,_0x1da761){_0xd53b81=_0xd53b81-0x0;var _0x52221a=_0x2ba9[_0xd53b81];return _0x52221a;};'use strict';var utils=require(_0x92ba('0x0'));var logger=require(_0x92ba('0x1'))(_0x92ba('0x2'));exports[_0x92ba('0x3')]=function(_0x35947f,_0x28c145){return function(_0x2fc733){try{logger[_0x92ba('0x4')]('[%s][NOOP]\x20%s',_0x35947f,utils[_0x92ba('0x5')](_0x28c145[0x0],this));_0x2fc733[_0x92ba('0x6')]();}catch(_0x6c9256){logger[_0x92ba('0x7')](_0x92ba('0x8'),_0x35947f,JSON[_0x92ba('0x9')](_0x6c9256));_0x2fc733[_0x92ba('0xa')]();}};}; \ 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 5cf4a90..6cbcbfd 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 _0xc99f=['atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','seq-queue','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','queue_id','account','from','emit','clone','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','pick','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','channel','QueueId','interaction','upperFirst','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','QueueReport','create','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','name','Interaction','update','then','catch','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','Queues','timeout','createQueue'];(function(_0x38ff8a,_0x2b9aa2){var _0x3deba8=function(_0x35c822){while(--_0x35c822){_0x38ff8a['push'](_0x38ff8a['shift']());}};_0x3deba8(++_0x2b9aa2);}(_0xc99f,0x19c));var _0xfc99=function(_0x321df4,_0x3efec5){_0x321df4=_0x321df4-0x0;var _0x50d06c=_0xc99f[_0x321df4];return _0x50d06c;};'use strict';var schema=require('validate');var _=require(_0xfc99('0x0'));var util=require('util');var seqqueue=require(_0xfc99('0x1'));var moment=require('moment');var Redis=require(_0xfc99('0x2'));var config=require('../../../../config/environment');var logger=require(_0xfc99('0x3'))('routing');var strategy=require('./strategy');config['redis']=_[_0xfc99('0x4')](config[_0xfc99('0x5')],{'host':_0xfc99('0x6'),'port':0x18eb});var io=require(_0xfc99('0x7'))(new Redis(config[_0xfc99('0x5')]));var attributes=['id',_0xfc99('0x8'),_0xfc99('0x9'),'queue',_0xfc99('0xa'),'joinAt'];function emit(_0x1e321f,_0xe1be93,_0x44de22){io['to'](_0x1e321f)[_0xfc99('0xb')](_0xe1be93,_0x44de22);}function emitChannelQueueInteraction(_0x55f7a3,_0x555498,_0x3c6017,_0x421f0c,_0x4041d2,_0xe5cd4e,_0x51b760,_0x15c3fb){var _0x32f5c0=_[_0xfc99('0xc')](_0x3c6017);_0x32f5c0['queue_id']=_0x15c3fb;_0x32f5c0[_0xfc99('0xd')]=_0x555498;_0x32f5c0[_0xfc99('0x9')]=_0x421f0c;_0x32f5c0['id']=_0x4041d2;if(_0xe5cd4e){attributes[_0xfc99('0xe')](_[_0xfc99('0xf')](_0x55f7a3)+_0xfc99('0x10'));_0x51b760[util[_0xfc99('0x11')](_0xfc99('0x12'),_0x55f7a3)][_0x4041d2]=_['pick'](_0x32f5c0,attributes);}else{delete _0x51b760[util['format']('%sQueuesWaitingInteractions',_0x55f7a3)][_0x4041d2];}emit(util[_0xfc99('0x11')](_0xfc99('0x13'),_0x55f7a3,_0x555498),util[_0xfc99('0x11')]('%s_queue_waiting_interaction:%s',_0x55f7a3,_0xe5cd4e?'save':'remove'),_[_0xfc99('0x14')](_0x32f5c0,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xfc99('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xfc99('0x16')),'faxQueueReport':require(_0xfc99('0x17')),'whatsappQueueReport':require(_0xfc99('0x18')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xfc99('0x19')),'mailInteraction':require(_0xfc99('0x1a')),'openchannelInteraction':require(_0xfc99('0x1b')),'smsInteraction':require(_0xfc99('0x1c')),'whatsappInteraction':require(_0xfc99('0x1d'))};var queue=schema({'name':{'type':_0xfc99('0x1e'),'required':!![],'message':_0xfc99('0x1f')},'timeout':{'type':_0xfc99('0x20'),'message':_0xfc99('0x21')}});function startRouting(_0x694f6,_0x2414c4,_0x13016c,_0x4fbf25){if(_0x694f6&&_0x2414c4&&_0x13016c){_0x2414c4['waiting']+=0x1;var _0x4d1c24={'uniqueid':_0x694f6,'from':_0x13016c[_0xfc99('0x22')]?_0x13016c[_0xfc99('0x22')][_0xfc99('0xa')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13016c[_0xfc99('0x23')]?_0x13016c[_0xfc99('0x23')]['id']:null,'ListId':_0x13016c[_0xfc99('0x24')]?_0x13016c[_0xfc99('0x24')]['id']:null};_0x4d1c24[_['upperFirst'](_0x13016c[_0xfc99('0x25')])+_0xfc99('0x26')]=_0x2414c4['id']||null;_0x4d1c24[_['upperFirst'](_0x13016c[_0xfc99('0x25')])+_0xfc99('0x10')]=_0x13016c[_0xfc99('0x27')]?_0x13016c[_0xfc99('0x27')]['id']:null;_0x4d1c24[_[_0xfc99('0x28')](_0x13016c[_0xfc99('0x25')])+'MessageId']=_0x13016c[_0xfc99('0x29')]?_0x13016c[_0xfc99('0x29')]['id']:null;_0x4d1c24[_['upperFirst'](_0x13016c[_0xfc99('0x25')])+(_0x13016c['channel']!=='chat'?_0xfc99('0x2a'):'WebsiteId')]=_0x13016c['account']?_0x13016c[_0xfc99('0x9')]['id']:null;logger[_0xfc99('0x2b')](util[_0xfc99('0x11')](_0xfc99('0x2c'),_0x694f6,_0x2414c4['name']));emitChannelQueueInteraction(_0x13016c[_0xfc99('0x25')],_0x2414c4['name'],_0x4d1c24,_0x13016c[_0xfc99('0x9')]['name'],_0x13016c[_0xfc99('0x29')]['id'],!![],_0x4fbf25,_0x2414c4['id']);if(rpc[_0x13016c[_0xfc99('0x25')]+_0xfc99('0x2d')]){return rpc[_0x13016c[_0xfc99('0x25')]+'QueueReport'][_0xfc99('0x2e')](_0x4d1c24)['catch'](function(_0x5aa1d0){logger[_0xfc99('0x2f')]('create\x20queue\x20report',_0x5aa1d0);});}}}function stopRouting(_0x4a31f6,_0x36ffda,_0x1fd7a1,_0x3b9be2){if(_0x4a31f6&&_0x36ffda){_0x36ffda[_0xfc99('0x30')]-=0x1;var _0x308952={'leaveAt':moment()[_0xfc99('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xfc99('0x11')](_0xfc99('0x31')),'reason':_0xfc99('0x32')};logger[_0xfc99('0x2b')](util[_0xfc99('0x11')](_0xfc99('0x33'),_0x4a31f6,_0x36ffda[_0xfc99('0x34')]));emitChannelQueueInteraction(_0x1fd7a1[_0xfc99('0x25')],_0x36ffda[_0xfc99('0x34')],_0x1fd7a1['body'],_0x1fd7a1['account'][_0xfc99('0x34')],_0x1fd7a1[_0xfc99('0x29')]['id'],![],_0x3b9be2,_0x36ffda['id']);return rpc[_0x1fd7a1['channel']+_0xfc99('0x35')][_0xfc99('0x36')](_0x1fd7a1[_0xfc99('0x27')]['id'],{'queueId':_0x36ffda['id']})[_0xfc99('0x37')](function(){if(rpc[_0x1fd7a1['channel']+_0xfc99('0x2d')]){return rpc[_0x1fd7a1[_0xfc99('0x25')]+'QueueReport'][_0xfc99('0x36')](_0x4a31f6,_0x308952)[_0xfc99('0x38')](function(_0x46ab07){logger[_0xfc99('0x2f')]('update\x20queue\x20report',_0x46ab07);});}});}}function endRouting(_0x2117a3,_0x50aa5c,_0x9271b5,_0x43c27e){if(_0x2117a3&&_0x50aa5c){_0x50aa5c[_0xfc99('0x30')]-=0x1;var _0x348dce={'leaveAt':moment()['format'](_0xfc99('0x31')),'exitAt':moment()['format'](_0xfc99('0x31')),'reason':'timeout'};logger[_0xfc99('0x2b')](util[_0xfc99('0x11')](_0xfc99('0x39'),_0x2117a3,_0x50aa5c['name']));emitChannelQueueInteraction(_0x9271b5['channel'],_0x50aa5c['name'],_0x9271b5[_0xfc99('0x22')],_0x9271b5[_0xfc99('0x9')][_0xfc99('0x34')],_0x9271b5[_0xfc99('0x29')]['id'],![],_0x43c27e);if(rpc[_0x9271b5[_0xfc99('0x25')]+'QueueReport']){return rpc[_0x9271b5['channel']+_0xfc99('0x2d')][_0xfc99('0x36')](_0x2117a3,_0x348dce)[_0xfc99('0x38')](function(_0x19a763){logger[_0xfc99('0x2f')](_0xfc99('0x3a'),_0x19a763);});}}}function handleFindQueue(_0xb09bc){return function(_0x31290e){return _0x31290e[_0xfc99('0x34')]['toLowerCase']()===_0xb09bc['toLowerCase']();};}exports[_0xfc99('0x3b')]=function(_0x2c55c8,_0x3316df,_0x4624af,_0x46d1d0){return function(_0x30d26f){try{var _0x46aa17={'name':_0x3316df[0x0],'timeout':_0x3316df[0x1]};var _0x581bd0=queue[_0xfc99('0x3c')](_0x46aa17,{'typecast':!![]});if(_0x581bd0['length']){logger['error'](_0xfc99('0x3d'),_0x2c55c8,_[_0xfc99('0x3e')](_0x581bd0,_0xfc99('0x29'))[_0xfc99('0x3f')](',\x20'));_0x30d26f[_0xfc99('0x40')]();}else{var _0x30db10=_['find'](_0x4624af[_0x46d1d0[_0xfc99('0x25')]+_0xfc99('0x41')],handleFindQueue(_0x46aa17[_0xfc99('0x34')]));if(_0x30db10){startRouting(_0x2c55c8,_0x30db10,_0x46d1d0,_0x4624af);var _0x3ba884=(_0x30db10[_0xfc99('0x42')]||0xa)*0x3e8;var _0x42e761=(_0x46aa17[_0xfc99('0x42')]||0x14)*0x3e8;var _0x3e158f;if(_0x3ba884>_0x42e761){_0x42e761=_0x3ba884;}var _0x2797f7=seqqueue[_0xfc99('0x43')](_0x3ba884);_0x2797f7['id']=_0x2c55c8;_0x2797f7[_0xfc99('0x44')]=_0x3ba884;_0x2797f7[_0xfc99('0x45')]=_0x42e761;_0x2797f7['channel']=_0x46d1d0[_0xfc99('0x25')];_0x4624af['rules'][_0x2c55c8]['on'](_0xfc99('0x46'),function(){logger[_0xfc99('0x2b')](_0xfc99('0x47'),_0x2c55c8);stopRouting(_0x2c55c8,_0x30db10,_0x46d1d0,_0x4624af);clearTimeout(_0x3e158f);_0x3e158f=undefined;_0x2797f7[_0xfc99('0x48')](!![]);if(_0x4624af[_0xfc99('0x49')][_0x2c55c8]){delete _0x4624af[_0xfc99('0x49')][_0x2c55c8];}_0x30d26f[_0xfc99('0x40')]();});_0x4624af[_0xfc99('0x49')][_0x2c55c8]['on'](_0xfc99('0x4a'),function(){if(_0x4624af[_0xfc99('0x49')][_0x2c55c8]){delete _0x4624af['rules'][_0x2c55c8];}});_0x3e158f=setTimeout(function(){logger['info'](_0xfc99('0x4b'),_0x2c55c8);endRouting(_0x2c55c8,_0x30db10,_0x46d1d0,_0x4624af);clearTimeout(_0x3e158f);_0x2797f7[_0xfc99('0x48')](!![]);_0x30d26f['next']();},_0x42e761);switch(_0x30db10['strategy']){case _0xfc99('0x4c'):strategy[_0xfc99('0x4c')](_0x2797f7,_0x30db10,_0x4624af,_0x46d1d0);break;default:strategy[_0xfc99('0x4d')](_0x2797f7,_0x30db10,_0x4624af,_0x46d1d0);}}else{logger[_0xfc99('0x2f')](_0xfc99('0x4e'),_0x2c55c8,_0x46aa17[_0xfc99('0x34')]);_0x30d26f[_0xfc99('0x40')]();}}}catch(_0x280156){logger[_0xfc99('0x2f')](_0xfc99('0x3d'),_0x2c55c8,_0x280156[_0xfc99('0x4f')]);_0x30d26f[_0xfc99('0x40')]();}};}; \ No newline at end of file +var _0x7821=['./strategy','defaults','redis','localhost','account','queue','from','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','moment','../../../../config/logger'];(function(_0x1d3eaf,_0x260522){var _0x19aa8d=function(_0x3ebe52){while(--_0x3ebe52){_0x1d3eaf['push'](_0x1d3eaf['shift']());}};_0x19aa8d(++_0x260522);}(_0x7821,0x9c));var _0x1782=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x7821[_0xd7b0a4];return _0x184e9e;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x1782('0x0'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x1782('0x1'))('routing');var strategy=require(_0x1782('0x2'));config['redis']=_[_0x1782('0x3')](config[_0x1782('0x4')],{'host':_0x1782('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1782('0x4')]));var attributes=['id','queue_id',_0x1782('0x6'),_0x1782('0x7'),_0x1782('0x8'),'joinAt'];function emit(_0x184913,_0x37ab9c,_0x4a93b1){io['to'](_0x184913)[_0x1782('0x9')](_0x37ab9c,_0x4a93b1);}function emitChannelQueueInteraction(_0x42d1ed,_0x505a46,_0xa3bd23,_0x5aea9a,_0x4109b8,_0x2508dd,_0x3f955a,_0x565363){var _0xf04421=_[_0x1782('0xa')](_0xa3bd23);_0xf04421['queue_id']=_0x565363;_0xf04421[_0x1782('0x7')]=_0x505a46;_0xf04421['account']=_0x5aea9a;_0xf04421['id']=_0x4109b8;if(_0x2508dd){attributes[_0x1782('0xb')](_[_0x1782('0xc')](_0x42d1ed)+_0x1782('0xd'));_0x3f955a[util['format'](_0x1782('0xe'),_0x42d1ed)][_0x4109b8]=_[_0x1782('0xf')](_0xf04421,attributes);}else{delete _0x3f955a[util['format']('%sQueuesWaitingInteractions',_0x42d1ed)][_0x4109b8];}emit(util[_0x1782('0x10')](_0x1782('0x11'),_0x42d1ed,_0x505a46),util[_0x1782('0x10')]('%s_queue_waiting_interaction:%s',_0x42d1ed,_0x2508dd?_0x1782('0x12'):'remove'),_['pick'](_0xf04421,attributes));}var rpc={'openchannelQueueReport':require(_0x1782('0x13')),'mailQueueReport':require(_0x1782('0x14')),'chatQueueReport':require(_0x1782('0x15')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x1782('0x16')),'whatsappQueueReport':require(_0x1782('0x17')),'chatInteraction':require(_0x1782('0x18')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x1782('0x19')),'openchannelInteraction':require(_0x1782('0x1a')),'smsInteraction':require(_0x1782('0x1b')),'whatsappInteraction':require(_0x1782('0x1c'))};var queue=schema({'name':{'type':_0x1782('0x1d'),'required':!![],'message':_0x1782('0x1e')},'timeout':{'type':_0x1782('0x1f'),'message':_0x1782('0x20')}});function startRouting(_0x3a39c9,_0x4abdbf,_0xd88f5d,_0xa0a71c){if(_0x3a39c9&&_0x4abdbf&&_0xd88f5d){_0x4abdbf[_0x1782('0x21')]+=0x1;var _0x39920d={'uniqueid':_0x3a39c9,'from':_0xd88f5d[_0x1782('0x22')]?_0xd88f5d[_0x1782('0x22')][_0x1782('0x8')]:'','joinAt':moment()['format'](_0x1782('0x23')),'ContactId':_0xd88f5d[_0x1782('0x24')]?_0xd88f5d[_0x1782('0x24')]['id']:null,'ListId':_0xd88f5d[_0x1782('0x25')]?_0xd88f5d[_0x1782('0x25')]['id']:null};_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+_0x1782('0x28')]=_0x4abdbf['id']||null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+_0x1782('0xd')]=_0xd88f5d['interaction']?_0xd88f5d[_0x1782('0x29')]['id']:null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+'MessageId']=_0xd88f5d[_0x1782('0x2a')]?_0xd88f5d[_0x1782('0x2a')]['id']:null;_0x39920d[_[_0x1782('0x26')](_0xd88f5d[_0x1782('0x27')])+(_0xd88f5d[_0x1782('0x27')]!==_0x1782('0x2b')?_0x1782('0x2c'):_0x1782('0x2d'))]=_0xd88f5d[_0x1782('0x6')]?_0xd88f5d[_0x1782('0x6')]['id']:null;logger['info'](util[_0x1782('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x3a39c9,_0x4abdbf[_0x1782('0x2e')]));emitChannelQueueInteraction(_0xd88f5d[_0x1782('0x27')],_0x4abdbf[_0x1782('0x2e')],_0x39920d,_0xd88f5d[_0x1782('0x6')][_0x1782('0x2e')],_0xd88f5d[_0x1782('0x2a')]['id'],!![],_0xa0a71c,_0x4abdbf['id']);if(rpc[_0xd88f5d[_0x1782('0x27')]+_0x1782('0x2f')]){return rpc[_0xd88f5d[_0x1782('0x27')]+_0x1782('0x2f')][_0x1782('0x30')](_0x39920d)[_0x1782('0x31')](function(_0x54d1e6){logger[_0x1782('0x32')]('create\x20queue\x20report',_0x54d1e6);});}}}function stopRouting(_0x108ceb,_0x4a8768,_0x42f7ca,_0x14dd8d){if(_0x108ceb&&_0x4a8768){_0x4a8768['waiting']-=0x1;var _0x443983={'leaveAt':moment()['format'](_0x1782('0x23')),'acceptAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'reason':_0x1782('0x33')};logger[_0x1782('0x34')](util['format'](_0x1782('0x35'),_0x108ceb,_0x4a8768['name']));emitChannelQueueInteraction(_0x42f7ca[_0x1782('0x27')],_0x4a8768[_0x1782('0x2e')],_0x42f7ca[_0x1782('0x22')],_0x42f7ca[_0x1782('0x6')][_0x1782('0x2e')],_0x42f7ca[_0x1782('0x2a')]['id'],![],_0x14dd8d,_0x4a8768['id']);return rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x36')]['update'](_0x42f7ca['interaction']['id'],{'queueId':_0x4a8768['id']})[_0x1782('0x37')](function(){if(rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x2f')]){return rpc[_0x42f7ca[_0x1782('0x27')]+_0x1782('0x2f')]['update'](_0x108ceb,_0x443983)['catch'](function(_0x5e9a89){logger[_0x1782('0x32')](_0x1782('0x38'),_0x5e9a89);});}});}}function endRouting(_0x524e9f,_0x454b98,_0x1ad731,_0x1ce01b){if(_0x524e9f&&_0x454b98){_0x454b98['waiting']-=0x1;var _0x495bfa={'leaveAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'exitAt':moment()[_0x1782('0x10')](_0x1782('0x23')),'reason':_0x1782('0x39')};logger[_0x1782('0x34')](util['format'](_0x1782('0x3a'),_0x524e9f,_0x454b98[_0x1782('0x2e')]));emitChannelQueueInteraction(_0x1ad731[_0x1782('0x27')],_0x454b98[_0x1782('0x2e')],_0x1ad731['body'],_0x1ad731[_0x1782('0x6')]['name'],_0x1ad731['message']['id'],![],_0x1ce01b);if(rpc[_0x1ad731['channel']+_0x1782('0x2f')]){return rpc[_0x1ad731[_0x1782('0x27')]+'QueueReport'][_0x1782('0x3b')](_0x524e9f,_0x495bfa)[_0x1782('0x31')](function(_0x57c748){logger['error'](_0x1782('0x38'),_0x57c748);});}}}function handleFindQueue(_0x1b5703){return function(_0x7ab579){return _0x7ab579[_0x1782('0x2e')][_0x1782('0x3c')]()===_0x1b5703[_0x1782('0x3c')]();};}exports[_0x1782('0x3d')]=function(_0x4c4f44,_0x5c60f,_0x24c95e,_0x48a96e){return function(_0x47f812){try{var _0x2db4b2={'name':_0x5c60f[0x0],'timeout':_0x5c60f[0x1]};var _0x1c4172=queue['validate'](_0x2db4b2,{'typecast':!![]});if(_0x1c4172[_0x1782('0x3e')]){logger['error'](_0x1782('0x3f'),_0x4c4f44,_[_0x1782('0x40')](_0x1c4172,_0x1782('0x2a'))['join'](',\x20'));_0x47f812[_0x1782('0x41')]();}else{var _0x1161ae=_[_0x1782('0x42')](_0x24c95e[_0x48a96e[_0x1782('0x27')]+_0x1782('0x43')],handleFindQueue(_0x2db4b2[_0x1782('0x2e')]));if(_0x1161ae){startRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);var _0x3197eb=(_0x1161ae[_0x1782('0x39')]||0xa)*0x3e8;var _0x42f308=(_0x2db4b2['timeout']||0x14)*0x3e8;var _0x564f82;if(_0x3197eb>_0x42f308){_0x42f308=_0x3197eb;}var _0x17954a=seqqueue[_0x1782('0x44')](_0x3197eb);_0x17954a['id']=_0x4c4f44;_0x17954a[_0x1782('0x45')]=_0x3197eb;_0x17954a[_0x1782('0x46')]=_0x42f308;_0x17954a['channel']=_0x48a96e[_0x1782('0x27')];_0x24c95e[_0x1782('0x47')][_0x4c4f44]['on'](_0x1782('0x48'),function(){logger[_0x1782('0x34')](_0x1782('0x49'),_0x4c4f44);stopRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);clearTimeout(_0x564f82);_0x564f82=undefined;_0x17954a[_0x1782('0x4a')](!![]);if(_0x24c95e[_0x1782('0x47')][_0x4c4f44]){delete _0x24c95e[_0x1782('0x47')][_0x4c4f44];}_0x47f812[_0x1782('0x41')]();});_0x24c95e[_0x1782('0x47')][_0x4c4f44]['on'](_0x1782('0x4b'),function(){if(_0x24c95e[_0x1782('0x47')][_0x4c4f44]){delete _0x24c95e['rules'][_0x4c4f44];}});_0x564f82=setTimeout(function(){logger[_0x1782('0x34')](_0x1782('0x4c'),_0x4c4f44);endRouting(_0x4c4f44,_0x1161ae,_0x48a96e,_0x24c95e);clearTimeout(_0x564f82);_0x17954a['close'](!![]);_0x47f812['next']();},_0x42f308);switch(_0x1161ae[_0x1782('0x4d')]){case _0x1782('0x4e'):strategy[_0x1782('0x4e')](_0x17954a,_0x1161ae,_0x24c95e,_0x48a96e);break;default:strategy['beepall'](_0x17954a,_0x1161ae,_0x24c95e,_0x48a96e);}}else{logger[_0x1782('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4c4f44,_0x2db4b2[_0x1782('0x2e')]);_0x47f812[_0x1782('0x41')]();}}}catch(_0x4d84f4){logger[_0x1782('0x32')](_0x1782('0x3f'),_0x4c4f44,_0x4d84f4['stack']);_0x47f812[_0x1782('0x41')]();}};}; \ 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 ec8c77a..cc0e06d 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 _0xca9e=['handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca9e,0x136));var _0xeca9=function(_0x2042f9,_0x45b344){_0x2042f9=_0x2042f9-0x0;var _0x4e4051=_0xca9e[_0x2042f9];return _0x4e4051;};'use strict';var _=require(_0xeca9('0x0'));var uuid=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var Agent=function(_0x1443e3,_0x8dbabb,_0x2c6185,_0x1b2864){this[_0xeca9('0x5')]=uuid['v4']();this[_0xeca9('0x6')]=_0x1443e3;this[_0xeca9('0x7')]=_0x8dbabb;this[_0xeca9('0x8')]=_0x2c6185;this[_0xeca9('0x4')]=_0x1b2864;this['squeue'][_0xeca9('0x9')](this[_0xeca9('0xa')]['bind'](this),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xc'),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xd'),this[_0xeca9('0xe')][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['push']=function(){this[_0xeca9('0x6')][_0xeca9('0x9')](this['handleRun'][_0xeca9('0xb')](this),this['handleTimeout'][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['handleDrained']=function(){this[_0xeca9('0x10')](!![]);};Agent[_0xeca9('0xf')][_0xeca9('0xa')]=function(){logger['debug'](_0xeca9('0x11'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);if(_[_0xeca9('0x12')](this['realtime']['agents'][this[_0xeca9('0x7')]['id']])){logger[_0xeca9('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xeca9('0x14')]||util[_0xeca9('0x15')](this[_0xeca9('0x6')]['id'],this['realtime'][_0xeca9('0x16')][this['agent']['id']],this['squeue'][_0xeca9('0x17')],![])){this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']]['busy']=!![];this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x18')]=undefined;util['saveWaitingNotification'](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this[_0xeca9('0x7')],this['squeue'][_0xeca9('0x17')]);util[_0xeca9('0x19')](this['notificationId'],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],null,this['routing']);util[_0xeca9('0x1a')](this['squeue']['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0xeca9('0x1b')+(this[_0xeca9('0x4')][_0xeca9('0x14')]?_0xeca9('0x1c'):''));}else{logger[_0xeca9('0x13')](_0xeca9('0x1d'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}}};Agent[_0xeca9('0xf')][_0xeca9('0x10')]=function(_0x4910a3){if(_['isNil'](this['realtime'][_0xeca9('0x16')][this['agent']['id']])){return logger[_0xeca9('0x13')](_0xeca9('0x1e'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);}else{logger[_0xeca9('0x13')](_0xeca9('0x1f'),this['squeue']['id'],this[_0xeca9('0x7')]['id']);util['hideNotification'](this[_0xeca9('0x5')],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')]['agents'][this[_0xeca9('0x7')]['id']],null,this[_0xeca9('0x4')]);this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x20')]=![];this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']][_0xeca9('0x18')]=undefined;util[_0xeca9('0x21')](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this['agent'],this[_0xeca9('0x6')][_0xeca9('0x17')]);util[_0xeca9('0x1a')](this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0x4910a3?'STOP':_0xeca9('0x22'));}if(!_0x4910a3){setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}};function agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463){return new Agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463);}module[_0xeca9('0x23')]=agent; \ No newline at end of file +var _0xf006=['realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','STOP','TIMEOUT','./util','../../../../../config/logger','squeue','agent'];(function(_0x11d12c,_0x2fa186){var _0x5d53ac=function(_0x443513){while(--_0x443513){_0x11d12c['push'](_0x11d12c['shift']());}};_0x5d53ac(++_0x2fa186);}(_0xf006,0x146));var _0x6f00=function(_0x273a38,_0x3bd943){_0x273a38=_0x273a38-0x0;var _0x3b7a2c=_0xf006[_0x273a38];return _0x3b7a2c;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6f00('0x0'));var logger=require(_0x6f00('0x1'))('routing');var Agent=function(_0xbab575,_0x4e9dbc,_0x1c7a9e,_0x4f4466){this['notificationId']=uuid['v4']();this[_0x6f00('0x2')]=_0xbab575;this[_0x6f00('0x3')]=_0x4e9dbc;this[_0x6f00('0x4')]=_0x1c7a9e;this['routing']=_0x4f4466;this[_0x6f00('0x2')]['push'](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x8'),this[_0x6f00('0x7')][_0x6f00('0x6')](this));this[_0x6f00('0x2')]['on'](_0x6f00('0x9'),this[_0x6f00('0xa')][_0x6f00('0x6')](this));};Agent[_0x6f00('0xb')]['push']=function(){this[_0x6f00('0x2')][_0x6f00('0xc')](this[_0x6f00('0x5')][_0x6f00('0x6')](this),this[_0x6f00('0x7')]['bind'](this));};Agent[_0x6f00('0xb')]['handleDrained']=function(){this[_0x6f00('0x7')](!![]);};Agent['prototype'][_0x6f00('0x5')]=function(){logger[_0x6f00('0xd')](_0x6f00('0xe'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){logger['debug'](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}else{if(this[_0x6f00('0x12')][_0x6f00('0x13')]||util[_0x6f00('0x14')](this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],this[_0x6f00('0x2')][_0x6f00('0x15')],![])){this[_0x6f00('0x4')]['agents'][this['agent']['id']]['busy']=!![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util[_0x6f00('0x16')](this[_0x6f00('0x4')],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x17')](this[_0x6f00('0x18')],this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this['routing']);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']],_0x6f00('0x1a')+(this[_0x6f00('0x12')][_0x6f00('0x13')]?_0x6f00('0x1b'):''));}else{logger['debug'](_0x6f00('0x1c'),this[_0x6f00('0x2')]['id'],this[_0x6f00('0x3')]['id']);setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}}};Agent[_0x6f00('0xb')][_0x6f00('0x7')]=function(_0x451849){if(_[_0x6f00('0xf')](this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']])){return logger[_0x6f00('0xd')](_0x6f00('0x11'),this['squeue']['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x6f00('0x1d')](this['notificationId'],this[_0x6f00('0x2')]['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],null,this[_0x6f00('0x12')]);this[_0x6f00('0x4')]['agents'][this[_0x6f00('0x3')]['id']][_0x6f00('0x1e')]=![];this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']]['busyQueue']=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x6f00('0x12')],this[_0x6f00('0x3')],this[_0x6f00('0x2')][_0x6f00('0x15')]);util[_0x6f00('0x19')](this['squeue']['id'],this[_0x6f00('0x4')][_0x6f00('0x10')][this[_0x6f00('0x3')]['id']],_0x451849?_0x6f00('0x1f'):_0x6f00('0x20'));}if(!_0x451849){setTimeout(this[_0x6f00('0xc')][_0x6f00('0x6')](this),0x3e8);}};function agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d){return new Agent(_0x52936d,_0x28e436,_0x1dee52,_0x4ba56d);}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 71389a3..b2775b5 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 _0x6121=['routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','length','Agents','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busy','name','saveWaitingNotification','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x6121,0x178));var _0x1612=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6121[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1612('0x0'));var uuid=require(_0x1612('0x1'));var util=require(_0x1612('0x2'));var logger=require(_0x1612('0x3'))(_0x1612('0x4'));var Beepall=function(_0x1a4d7b,_0x48e5eb,_0x52e21e,_0x3882cc){this[_0x1612('0x5')]=uuid['v4']();this[_0x1612('0x6')]=_0x1a4d7b;this[_0x1612('0x7')]=_0x48e5eb;this[_0x1612('0x8')]=_0x52e21e;this[_0x1612('0x4')]=_0x3882cc;this[_0x1612('0x6')][_0x1612('0x9')](this[_0x1612('0xa')][_0x1612('0xb')](this),this[_0x1612('0xc')][_0x1612('0xb')](this));this[_0x1612('0x6')]['on'](_0x1612('0xd'),this[_0x1612('0xc')][_0x1612('0xb')](this));this[_0x1612('0x6')]['on'](_0x1612('0xe'),this['handleDrained'][_0x1612('0xb')](this));};Beepall[_0x1612('0xf')][_0x1612('0x9')]=function(){this[_0x1612('0x6')][_0x1612('0x9')](this[_0x1612('0xa')][_0x1612('0xb')](this),this[_0x1612('0xc')][_0x1612('0xb')](this));};Beepall['prototype'][_0x1612('0x10')]=function(){this[_0x1612('0xc')](!![]);};Beepall[_0x1612('0xf')][_0x1612('0xa')]=function(){var _0x4298da=!![];if(!_['isNil'](this[_0x1612('0x7')])&&!_[_0x1612('0x11')](this[_0x1612('0x7')]['Agents'])&&this[_0x1612('0x7')]['Agents'][_0x1612('0x12')]>0x0){for(var _0x28f40a=0x0,_0x49f9b3;_0x28f40a0x0){for(var _0x4cfd46=0x0,_0x2552de;_0x4cfd460x0&&_0x4e5305[_0x158318+'CurrentCapacity']>=_0x4e5305[_0x158318+_0xaee3('0x1f')]){writeLog(_0x37932b,_0x4e5305,_0x158318[_0xaee3('0x22')]()+_0xaee3('0x23'));return![];}}return!![];};exports['showNotification']=function(_0xe3a5f3,_0x8ba563,_0x78a6e8,_0x2e1379,_0x296bcc){return sendNotification(!![],_0xe3a5f3,_0x8ba563,_0x78a6e8,_0x2e1379,_0x296bcc);};exports[_0xaee3('0x24')]=function(_0x167cdc,_0x5ecbcb,_0x55f3a8,_0x53894b,_0x56f579){return sendNotification(![],_0x167cdc,_0x5ecbcb,_0x55f3a8,_0x53894b,_0x56f579);};exports['checkWaitingNotifications']=function(_0x57be29,_0x770e13,_0x4ae8f9){var _0x327765=_0x770e13[_0xaee3('0x25')][_0xaee3('0x26')];if(!_0x327765&&_0x4ae8f9){_0x327765=_0x4ae8f9['id'];}var _0x1adb34=_[_0xaee3('0x27')](_0x57be29[_0x770e13[_0xaee3('0x28')]+_0xaee3('0x29')],function(_0x3b600d){var _0x3166b0=_[_0xaee3('0x2a')](_0x770e13['channel'])+_0xaee3('0x2b');return _0x3b600d[_0x3166b0]===_0x770e13[_0xaee3('0x25')]['id'];});if(!_0x1adb34&&_0x327765&&_0x57be29['agents'][_0x327765]){_0x1adb34=_[_0xaee3('0x27')](_0x57be29[_0xaee3('0x2c')][_0x327765][_0x770e13[_0xaee3('0x28')]+'WaitingInteractions'],function(_0x59e205){return _0x59e205['id']===_0x770e13['interaction']['id'];});}return _0x1adb34;};exports['saveWaitingNotification']=function(_0x1b697f,_0x25b6a0,_0x364ba3,_0x420318){if(_0x364ba3&&_0x364ba3['id']&&_0x1b697f[_0xaee3('0x2c')]&&_0x1b697f[_0xaee3('0x2c')][_0x364ba3['id']]){_0x1b697f[_0xaee3('0x2c')][_0x364ba3['id']][_0x420318+'WaitingInteractions'][_0x25b6a0[_0xaee3('0x2d')]['id']]={'id':_0x25b6a0[_0xaee3('0x25')]['id']};}};exports[_0xaee3('0x2e')]=function(_0x1b2ef4,_0x990864,_0x47fae3,_0x8b454){if(_0x47fae3&&_0x47fae3['id']&&_0x1b2ef4[_0xaee3('0x2c')]&&_0x1b2ef4[_0xaee3('0x2c')][_0x47fae3['id']]){delete _0x1b2ef4[_0xaee3('0x2c')][_0x47fae3['id']][_0x8b454+'WaitingInteractions'][_0x990864[_0xaee3('0x2d')]['id']];}};exports[_0xaee3('0x2f')]=writeLog; \ No newline at end of file +var _0x8ab2=['QueuesWaitingInteractions','capitalize','agents','some','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','../utils','../../../../../config/environment','../../../../../config/logger','defaults','redis','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction','UserId','channel'];(function(_0x1d510c,_0x1e5340){var _0x2abc50=function(_0x25699c){while(--_0x25699c){_0x1d510c['push'](_0x1d510c['shift']());}};_0x2abc50(++_0x1e5340);}(_0x8ab2,0x167));var _0x28ab=function(_0x819835,_0x57c7fa){_0x819835=_0x819835-0x0;var _0x1eb7de=_0x8ab2[_0x819835];return _0x1eb7de;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x28ab('0x0'));var Redis=require('ioredis');var config=require(_0x28ab('0x1'));var logger=require(_0x28ab('0x2'))('routing');config['redis']=_[_0x28ab('0x3')](config[_0x28ab('0x4')],{'host':_0x28ab('0x5'),'port':0x18eb});var io=require(_0x28ab('0x6'))(new Redis(config[_0x28ab('0x4')]));function sendNotification(_0x212cf6,_0x375859,_0x535533,_0x44c9f3,_0xe9c25c,_0x19ba46){var _0x51e39e=_0x19ba46||{};var _0x1fb906=_0x535533[_0x28ab('0x7')]('.');var _0x18528d={'uniqueid':_0x375859,'channel':_0x1fb906[0x0],'id':_0x1fb906[0x1],'title':_0x1fb906[0x0]+_0x28ab('0x8'),'interactionId':_0x1fb906[0x2],'queue':_0xe9c25c?_0xe9c25c[_0x28ab('0x9')]:null,'sound':_0x51e39e[_0x28ab('0xa')][_0x28ab('0xb')],'shake':_0x51e39e[_0x28ab('0xa')]['notificationShake']};try{if(!_0x51e39e[_0x28ab('0xc')]){_0x51e39e[_0x28ab('0xc')]={};}if(_0xe9c25c){_0x51e39e[_0x28ab('0xc')][_0x28ab('0xd')]=_0xe9c25c;}else if(_0x51e39e['body']['queue']){delete _0x51e39e['body'][_0x28ab('0xd')];}_0x18528d[_0x28ab('0xe')]=utils[_0x28ab('0xf')](_0x51e39e[_0x28ab('0xa')][_0x28ab('0x10')],_0x51e39e);}catch(_0x3fe625){_0x18528d['msg']=_0x28ab('0x11');logger[_0x28ab('0x12')](util[_0x28ab('0x13')](_0x28ab('0x14'),_0x375859,_0x3fe625['message']));}io['to'](util[_0x28ab('0x13')]('user:%s',_0x44c9f3['name']))[_0x28ab('0x15')](util['format'](_0x28ab('0x16'),_0x212cf6?_0x28ab('0x17'):_0x28ab('0x18')),_0x18528d);}function writeLog(_0x327710,_0x56a740,_0x2b394c){return logger['debug'](util[_0x28ab('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x327710,_0x56a740[_0x28ab('0x9')],_0x2b394c));}exports[_0x28ab('0x19')]=function(_0x1418f6,_0x403716,_0x3d46d2,_0x353bb1){if(_0x403716[_0x28ab('0x1a')]){writeLog(_0x1418f6,_0x403716,_0x28ab('0x1b'));return![];}if(!_0x403716[_0x28ab('0x1c')]){writeLog(_0x1418f6,_0x403716,_0x28ab('0x1d'));return![];}if(_0x403716[_0x3d46d2+'Pause']){writeLog(_0x1418f6,_0x403716,_0x28ab('0x1e'));return![];}if(_0x353bb1&&_0x403716['hasOwnProperty'](_0x3d46d2+'Capacity')&&_0x403716[_0x28ab('0x1f')](_0x3d46d2+_0x28ab('0x20'))){if(_0x403716[_0x3d46d2+_0x28ab('0x21')]>0x0&&_0x403716[_0x3d46d2+_0x28ab('0x20')]>=_0x403716[_0x3d46d2+_0x28ab('0x21')]){writeLog(_0x1418f6,_0x403716,_0x3d46d2[_0x28ab('0x22')]()+_0x28ab('0x23'));return![];}}return!![];};exports[_0x28ab('0x24')]=function(_0x41ee51,_0x1ccf9f,_0x2dab8b,_0x32a36e,_0x1c95a9){return sendNotification(!![],_0x41ee51,_0x1ccf9f,_0x2dab8b,_0x32a36e,_0x1c95a9);};exports['hideNotification']=function(_0x40eca3,_0x141e1b,_0x20c8c5,_0x319a97,_0x20c7d8){return sendNotification(![],_0x40eca3,_0x141e1b,_0x20c8c5,_0x319a97,_0x20c7d8);};exports[_0x28ab('0x25')]=function(_0x5ed932,_0x536eca,_0x39f8fc){var _0x1e4fd2=_0x536eca[_0x28ab('0x26')][_0x28ab('0x27')];if(!_0x1e4fd2&&_0x39f8fc){_0x1e4fd2=_0x39f8fc['id'];}var _0x295289=_['some'](_0x5ed932[_0x536eca[_0x28ab('0x28')]+_0x28ab('0x29')],function(_0x47a001){var _0x2f26ba=_[_0x28ab('0x2a')](_0x536eca[_0x28ab('0x28')])+'InteractionId';return _0x47a001[_0x2f26ba]===_0x536eca['interaction']['id'];});if(!_0x295289&&_0x1e4fd2&&_0x5ed932[_0x28ab('0x2b')][_0x1e4fd2]){_0x295289=_[_0x28ab('0x2c')](_0x5ed932[_0x28ab('0x2b')][_0x1e4fd2][_0x536eca[_0x28ab('0x28')]+_0x28ab('0x2d')],function(_0x1395b6){return _0x1395b6['id']===_0x536eca[_0x28ab('0x26')]['id'];});}return _0x295289;};exports[_0x28ab('0x2e')]=function(_0x408d91,_0x4dd982,_0x19b77a,_0x48d4bb){if(_0x19b77a&&_0x19b77a['id']&&_0x408d91[_0x28ab('0x2b')]&&_0x408d91[_0x28ab('0x2b')][_0x19b77a['id']]){_0x408d91[_0x28ab('0x2b')][_0x19b77a['id']][_0x48d4bb+_0x28ab('0x2d')][_0x4dd982[_0x28ab('0x2f')]['id']]={'id':_0x4dd982[_0x28ab('0x26')]['id']};}};exports[_0x28ab('0x30')]=function(_0x46d667,_0x1cb8b6,_0x49a8a3,_0x501364){if(_0x49a8a3&&_0x49a8a3['id']&&_0x46d667[_0x28ab('0x2b')]&&_0x46d667['agents'][_0x49a8a3['id']]){delete _0x46d667['agents'][_0x49a8a3['id']][_0x501364+_0x28ab('0x2d')][_0x1cb8b6['message']['id']];}};exports[_0x28ab('0x31')]=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 8eb1dbd..936a7e3 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 _0x3228=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','./utils','../../../../config/logger','routing','string'];(function(_0x487683,_0x58b9b8){var _0x178a4d=function(_0x1f9813){while(--_0x1f9813){_0x487683['push'](_0x487683['shift']());}};_0x178a4d(++_0x58b9b8);}(_0x3228,0x181));var _0x8322=function(_0x598e95,_0x1af378){_0x598e95=_0x598e95-0x0;var _0x149606=_0x3228[_0x598e95];return _0x149606;};'use strict';var schema=require(_0x8322('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x8322('0x1'));var logger=require(_0x8322('0x2'))(_0x8322('0x3'));var system=schema({'command':{'type':_0x8322('0x4'),'required':!![],'message':_0x8322('0x5')}});exports[_0x8322('0x6')]=function(_0x31253e,_0x3d2f8b){return function(_0x12998e){try{var _0x4979e7={'command':_0x3d2f8b[0x0]};var _0x2d3f72=system[_0x8322('0x0')](_0x4979e7,{'typecast':!![]});if(_0x2d3f72['length']){logger[_0x8322('0x7')](_0x8322('0x8'),_0x31253e,_[_0x8322('0x9')](_0x2d3f72,_0x8322('0xa'))[_0x8322('0xb')](',\x20'));logger[_0x8322('0xc')](_0x8322('0xd'),_0x31253e);_0x12998e[_0x8322('0xe')]();}else{var _0x35a94a=this;var _0x2a3369=utils[_0x8322('0xf')](_0x3d2f8b[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x31253e,_0x2a3369);sh[_0x8322('0x10')](_[_0x8322('0x11')](_0x2a3369),function(_0x87ac05,_0xfaf048){logger[_0x8322('0xc')](_0x8322('0x12'),_0x31253e,_0x87ac05);if(_0x87ac05==0x0){var _0x55608a=_0xfaf048[_0x8322('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x8322('0x14')](_0x3d2f8b[0x1])||_[_0x8322('0x15')](_0x3d2f8b[0x1])){logger[_0x8322('0xc')](_0x8322('0x16'),_0x31253e);_0x35a94a[_0x8322('0x17')][_0x3d2f8b[0x1]]=_0x55608a;}else{logger[_0x8322('0xc')](_0x8322('0x18'),_0x31253e,_0x3d2f8b[0x1],_0x55608a);_0x35a94a[_0x8322('0x17')][_0x3d2f8b[0x1]]=_0x55608a;}}_0x12998e[_0x8322('0xe')]();});}}catch(_0x1f7b71){logger[_0x8322('0x7')]('[%s][SYSTEM]\x20%s',_0x31253e,_[_0x8322('0x19')](_0x1f7b71)?JSON['stringify'](_0x1f7b71):_0x1f7b71);logger[_0x8322('0xc')](_0x8322('0xd'),_0x31253e);_0x12998e[_0x8322('0xe')]();}};}; \ No newline at end of file +var _0x5279=['getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x38eaa9,_0x12309e){var _0x26ecbe=function(_0x498c60){while(--_0x498c60){_0x38eaa9['push'](_0x38eaa9['shift']());}};_0x26ecbe(++_0x12309e);}(_0x5279,0xa1));var _0x9527=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x5279[_0x361d3f];return _0x320229;};'use strict';var schema=require(_0x9527('0x0'));var sh=require(_0x9527('0x1'));var _=require(_0x9527('0x2'));var utils=require(_0x9527('0x3'));var logger=require(_0x9527('0x4'))('routing');var system=schema({'command':{'type':_0x9527('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9527('0x6')]=function(_0x187ff2,_0x271b4c){return function(_0x349cbd){try{var _0x19bfa9={'command':_0x271b4c[0x0]};var _0xbaac4f=system[_0x9527('0x0')](_0x19bfa9,{'typecast':!![]});if(_0xbaac4f['length']){logger[_0x9527('0x7')](_0x9527('0x8'),_0x187ff2,_[_0x9527('0x9')](_0xbaac4f,_0x9527('0xa'))[_0x9527('0xb')](',\x20'));logger['info'](_0x9527('0xc'),_0x187ff2);_0x349cbd[_0x9527('0xd')]();}else{var _0x4255cc=this;var _0x39be91=utils[_0x9527('0xe')](_0x271b4c[0x0],this);logger[_0x9527('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x187ff2,_0x39be91);sh[_0x9527('0x10')](_[_0x9527('0x11')](_0x39be91),function(_0x33127a,_0x30f931){logger[_0x9527('0xf')](_0x9527('0x12'),_0x187ff2,_0x33127a);if(_0x33127a==0x0){var _0x1ecc52=_0x30f931['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x9527('0x13')](_0x271b4c[0x1])||_[_0x9527('0x14')](_0x271b4c[0x1])){logger['info'](_0x9527('0x15'),_0x187ff2);_0x4255cc[_0x9527('0x16')][_0x271b4c[0x1]]=_0x1ecc52;}else{logger[_0x9527('0xf')](_0x9527('0x17'),_0x187ff2,_0x271b4c[0x1],_0x1ecc52);_0x4255cc[_0x9527('0x16')][_0x271b4c[0x1]]=_0x1ecc52;}}_0x349cbd[_0x9527('0xd')]();});}}catch(_0x3763b6){logger[_0x9527('0x7')]('[%s][SYSTEM]\x20%s',_0x187ff2,_['isObject'](_0x3763b6)?JSON[_0x9527('0x18')](_0x3763b6):_0x3763b6);logger[_0x9527('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x187ff2);_0x349cbd[_0x9527('0xd')]();}};}; \ 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 9f929d1..0208160 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 _0x0c02=['interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','[%s][TAG]\x20%s','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags'];(function(_0x38b700,_0x38598c){var _0x5ec3be=function(_0x52abbe){while(--_0x52abbe){_0x38b700['push'](_0x38b700['shift']());}};_0x5ec3be(++_0x38598c);}(_0x0c02,0x14b));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require(_0x20c0('0x0'));var rpc={'chatInteraction':require(_0x20c0('0x1')),'openchannelInteraction':require(_0x20c0('0x2')),'smsInteraction':require(_0x20c0('0x3')),'mailInteraction':require(_0x20c0('0x4')),'faxInteraction':require(_0x20c0('0x5')),'whatsappInteraction':require(_0x20c0('0x6'))};var logger=require(_0x20c0('0x7'))(_0x20c0('0x8'));var tag=schema({'tag':{'type':_0x20c0('0x9'),'required':!![],'message':_0x20c0('0xa')}});exports['consequence']=function(_0x198e80,_0x42c49e,_0x2e3d36,_0x5a47f3){return function(_0x1755d6){try{var _0x3de56e={'tag':_0x42c49e[0x0]};var _0x509b53=tag[_0x20c0('0xb')](_0x3de56e,{'typecast':!![]});if(_0x509b53['length']){logger['error'](_0x20c0('0xc'),_0x198e80,_['map'](_0x509b53,'message')['join'](',\x20'));logger[_0x20c0('0xd')](_0x20c0('0xe'),_0x198e80);_0x1755d6[_0x20c0('0xf')]();}else{var _0x2f779c={'ids':[_0x42c49e[0x0]]};if(rpc[_0x5a47f3[_0x20c0('0x10')]+_0x20c0('0x11')]){rpc[_0x5a47f3[_0x20c0('0x10')]+_0x20c0('0x11')][_0x20c0('0x12')](_0x5a47f3[_0x20c0('0x13')]['id'],_0x2f779c)['then'](function(_0x504411){logger[_0x20c0('0xd')](_0x20c0('0x14'),_0x198e80,_0x42c49e[0x1],_0x5a47f3[_0x20c0('0x10')],_0x5a47f3[_0x20c0('0x13')]['id']);})[_0x20c0('0x15')](function(_0x2bb238){logger[_0x20c0('0x16')](_0x20c0('0xc'),_0x198e80,JSON[_0x20c0('0x17')](_0x2bb238));logger[_0x20c0('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x198e80);})[_0x20c0('0x18')](function(){_0x1755d6[_0x20c0('0xf')]();});}}}catch(_0x406a7f){logger[_0x20c0('0x16')](_0x20c0('0xc'),_0x198e80,_['isObject'](_0x406a7f)?JSON[_0x20c0('0x17')](_0x406a7f):_0x406a7f);logger['info'](_0x20c0('0xe'),_0x198e80);_0x1755d6['next']();}};}; \ No newline at end of file +var _0xb333=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','join','info','channel','Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify'];(function(_0x43d188,_0x44315d){var _0x54d96d=function(_0x49997e){while(--_0x49997e){_0x43d188['push'](_0x43d188['shift']());}};_0x54d96d(++_0x44315d);}(_0xb333,0xe4));var _0x3b33=function(_0x2db7fe,_0xb85dd2){_0x2db7fe=_0x2db7fe-0x0;var _0x1008ba=_0xb333[_0x2db7fe];return _0x1008ba;};'use strict';var schema=require(_0x3b33('0x0'));var _=require(_0x3b33('0x1'));var rpc={'chatInteraction':require(_0x3b33('0x2')),'openchannelInteraction':require(_0x3b33('0x3')),'smsInteraction':require(_0x3b33('0x4')),'mailInteraction':require(_0x3b33('0x5')),'faxInteraction':require(_0x3b33('0x6')),'whatsappInteraction':require(_0x3b33('0x7'))};var logger=require(_0x3b33('0x8'))(_0x3b33('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x3b33('0xa')}});exports[_0x3b33('0xb')]=function(_0x443fc8,_0x1874f1,_0x2ca0ea,_0x5aac6d){return function(_0x240cff){try{var _0x2335d0={'tag':_0x1874f1[0x0]};var _0x540662=tag[_0x3b33('0x0')](_0x2335d0,{'typecast':!![]});if(_0x540662[_0x3b33('0xc')]){logger[_0x3b33('0xd')]('[%s][TAG]\x20%s',_0x443fc8,_['map'](_0x540662,'message')[_0x3b33('0xe')](',\x20'));logger[_0x3b33('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x443fc8);_0x240cff['next']();}else{var _0x60a959={'ids':[_0x1874f1[0x0]]};if(rpc[_0x5aac6d[_0x3b33('0x10')]+_0x3b33('0x11')]){rpc[_0x5aac6d[_0x3b33('0x10')]+_0x3b33('0x11')][_0x3b33('0x12')](_0x5aac6d[_0x3b33('0x13')]['id'],_0x60a959)[_0x3b33('0x14')](function(_0x45e7b7){logger[_0x3b33('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x443fc8,_0x1874f1[0x1],_0x5aac6d['channel'],_0x5aac6d[_0x3b33('0x13')]['id']);})[_0x3b33('0x15')](function(_0x4ffbbc){logger[_0x3b33('0xd')](_0x3b33('0x16'),_0x443fc8,JSON[_0x3b33('0x17')](_0x4ffbbc));logger[_0x3b33('0xf')](_0x3b33('0x18'),_0x443fc8);})[_0x3b33('0x19')](function(){_0x240cff['next']();});}}}catch(_0x579020){logger[_0x3b33('0xd')](_0x3b33('0x16'),_0x443fc8,_[_0x3b33('0x1a')](_0x579020)?JSON[_0x3b33('0x17')](_0x579020):_0x579020);logger[_0x3b33('0xf')](_0x3b33('0x18'),_0x443fc8);_0x240cff[_0x3b33('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 87e3661..ad7076a 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92df=['includes','push','title','jsonrpc','2.0','method','login','params','utf8','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','then','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x4ac190,_0x39618e){var _0x2cb36a=function(_0x2d3341){while(--_0x2d3341){_0x4ac190['push'](_0x4ac190['shift']());}};_0x2cb36a(++_0x39618e);}(_0x92df,0x1c0));var _0xf92d=function(_0x1dd670,_0x41b05f){_0x1dd670=_0x1dd670-0x0;var _0x1a9d7f=_0x92df[_0x1dd670];return _0x1a9d7f;};'use strict';var rp=require(_0xf92d('0x0'));var logger=require(_0xf92d('0x1'))(_0xf92d('0x2'));var _=require(_0xf92d('0x3'));var arr=[];exports[_0xf92d('0x4')]=function(_0x396acf,_0x261085){return function(_0x55033d){var _0x351d12=_0x261085[0xa];var _0x3d93cd=_0x261085[0xb];var _0x25ab95=_0x261085[0xc];var _0x4d04b1=_0x261085[0xd];var _0x5f1da4=_0x261085[0xe];var _0x160609=_0x261085[0xf][_0xf92d('0x5')](/\n/g,_0xf92d('0x6'));var _0x2b5d24=_0x261085[0x10][_0xf92d('0x5')](/\n/g,'\x20');if(!arr[_0xf92d('0x7')](_0x3d93cd)){arr[_0xf92d('0x8')](_0x3d93cd);var _0x2295e8=_0x261085[0x3];var _0x3d77d3=_0x261085[0x4];var _0x1b87e1=_0x261085[0x1];var _0x371265=_0x261085[0x0];var _0x43929d={};_0x43929d['urlOnAnswer']=_0x261085[0x8]+'?params='+_0x25ab95+'|'+_0x351d12+'|'+_0x4d04b1+'|'+_0x3d93cd+'|'+_0x5f1da4;_0x43929d['urlOnRing']=_0x261085[0x7]+'?params='+_0x25ab95+'|'+_0x351d12+'|'+_0x4d04b1+'|'+_0x3d93cd+'|'+_0x5f1da4+'|'+_0x160609+'|'+_0x2b5d24;_0x43929d[_0xf92d('0x9')]=_0x261085[0x9];var _0xff417f={};_0xff417f[_0xf92d('0xa')]=_0xf92d('0xb');_0xff417f[_0xf92d('0xc')]=_0xf92d('0xd');var _0x100c09=[];_0x100c09['push'](_0x261085[0x2]);_0x100c09[_0xf92d('0x8')](_0x261085[0x5]);_0x100c09[_0xf92d('0x8')](_0x261085[0x6]);_0xff417f[_0xf92d('0xe')]=_0x100c09;_0xff417f['id']=0x1;var _0x14ddba=JSON['stringify'](_0xff417f);var _0x3c649c={'encoding':_0xf92d('0xf'),'method':'POST','timeout':0x2710,'url':_0x2295e8,'headers':{'Content-Type':_0xf92d('0x10')},'body':_0x14ddba};return rp(_0x3c649c)['then'](function(_0x3abcea){const _0x4913bf=JSON[_0xf92d('0x11')](_0x3abcea);if(!_0x4913bf[_0xf92d('0x12')][_0xf92d('0x13')]){throw new Error(_0xf92d('0x14'));}var _0x1754df=_0x3d93cd;var _0x197159=_0xf92d('0x15')+_0x1b87e1+_0xf92d('0x16')+_0x371265+_0xf92d('0x17')+_0x1754df+_0xf92d('0x18')+JSON[_0xf92d('0x19')](_0x43929d);var _0x243ac4=_0x3d77d3+'?'+_0x197159;return rp(_0x243ac4);})[_0xf92d('0x1a')](function(_0x274432){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x396acf,_0x274432);_0x55033d[_0xf92d('0x1b')]();})[_0xf92d('0x1c')](function(_0x1823eb){logger[_0xf92d('0x1d')](_0xf92d('0x1e'),_0x396acf,_[_0xf92d('0x1f')](_0x1823eb)?JSON[_0xf92d('0x19')](_0x1823eb):_0x1823eb);_0x55033d['stop']();});}else{logger[_0xf92d('0x20')](_0xf92d('0x21'),_0x396acf);_0x55033d[_0xf92d('0x22')]();}};}; \ No newline at end of file +var _0xf652=['utf8','POST','parse','result','logged','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify'];(function(_0x545a02,_0x2efaab){var _0x70e3e=function(_0x3132a0){while(--_0x3132a0){_0x545a02['push'](_0x545a02['shift']());}};_0x70e3e(++_0x2efaab);}(_0xf652,0x1ec));var _0x2f65=function(_0x2f2384,_0x1e2e88){_0x2f2384=_0x2f2384-0x0;var _0x128431=_0xf652[_0x2f2384];return _0x128431;};'use strict';var rp=require(_0x2f65('0x0'));var logger=require(_0x2f65('0x1'))(_0x2f65('0x2'));var _=require(_0x2f65('0x3'));var arr=[];exports['consequence']=function(_0x3c2641,_0x1e4166){return function(_0x2e98ae){var _0x2da608=_0x1e4166[0xa];var _0x5677e5=_0x1e4166[0xb];var _0x3a4c35=_0x1e4166[0xc];var _0xfb75f8=_0x1e4166[0xd];var _0x5000fc=_0x1e4166[0xe];var _0x5d9612=_0x1e4166[0xf][_0x2f65('0x4')](/\n/g,_0x2f65('0x5'));var _0x346287=_0x1e4166[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x2f65('0x6')](_0x5677e5)){arr[_0x2f65('0x7')](_0x5677e5);var _0x3f7d50=_0x1e4166[0x3];var _0x5efdb8=_0x1e4166[0x4];var _0x26376b=_0x1e4166[0x1];var _0x2b08b3=_0x1e4166[0x0];var _0x4d1409={};_0x4d1409[_0x2f65('0x8')]=_0x1e4166[0x8]+_0x2f65('0x9')+_0x3a4c35+'|'+_0x2da608+'|'+_0xfb75f8+'|'+_0x5677e5+'|'+_0x5000fc;_0x4d1409[_0x2f65('0xa')]=_0x1e4166[0x7]+'?params='+_0x3a4c35+'|'+_0x2da608+'|'+_0xfb75f8+'|'+_0x5677e5+'|'+_0x5000fc+'|'+_0x5d9612+'|'+_0x346287;_0x4d1409[_0x2f65('0xb')]=_0x1e4166[0x9];var _0x23e44e={};_0x23e44e[_0x2f65('0xc')]=_0x2f65('0xd');_0x23e44e[_0x2f65('0xe')]=_0x2f65('0xf');var _0x5978d4=[];_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x2]);_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x5]);_0x5978d4[_0x2f65('0x7')](_0x1e4166[0x6]);_0x23e44e[_0x2f65('0x10')]=_0x5978d4;_0x23e44e['id']=0x1;var _0x9c998f=JSON[_0x2f65('0x11')](_0x23e44e);var _0x426ecd={'encoding':_0x2f65('0x12'),'method':_0x2f65('0x13'),'timeout':0x2710,'url':_0x3f7d50,'headers':{'Content-Type':'application/json-rpc'},'body':_0x9c998f};return rp(_0x426ecd)['then'](function(_0x825003){const _0x4961ac=JSON[_0x2f65('0x14')](_0x825003);if(!_0x4961ac[_0x2f65('0x15')][_0x2f65('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x3f4412=_0x5677e5;var _0x12daef='channelId='+_0x26376b+'&serviceId='+_0x2b08b3+_0x2f65('0x17')+_0x3f4412+_0x2f65('0x18')+JSON[_0x2f65('0x11')](_0x4d1409);var _0x1e96ec=_0x5efdb8+'?'+_0x12daef;return rp(_0x1e96ec);})[_0x2f65('0x19')](function(_0x371417){logger[_0x2f65('0x1a')](_0x2f65('0x1b'),_0x3c2641,_0x371417);_0x2e98ae[_0x2f65('0x1c')]();})[_0x2f65('0x1d')](function(_0x54ba76){logger['error'](_0x2f65('0x1e'),_0x3c2641,_[_0x2f65('0x1f')](_0x54ba76)?JSON[_0x2f65('0x11')](_0x54ba76):_0x54ba76);_0x2e98ae[_0x2f65('0x1c')]();});}else{logger[_0x2f65('0x1a')](_0x2f65('0x20'),_0x3c2641);_0x2e98ae[_0x2f65('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 104e068..c5a8cba 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x2c9874,_0x2bec5b){var _0x2953f7=function(_0xc03bed){while(--_0xc03bed){_0x2c9874['push'](_0x2c9874['shift']());}};_0x2953f7(++_0x2bec5b);}(_0xe706,0xa3));var _0x6e70=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xe706[_0x72a33d];return _0x2621d5;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x559ffb,_0x3631b5){var _0xcaa0e3=function(_0x55c28e){while(--_0x55c28e){_0x559ffb['push'](_0x559ffb['shift']());}};_0xcaa0e3(++_0x3631b5);}(_0xe706,0xa3));var _0x6e70=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0xe706[_0x561e73];return _0x2dc60d;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f92690b..9e43873 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 _0x87d5=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','transfer','applications','length','existsSync','app','toLowerCase','autoreply','appdata','mail','push','slice','join','dialogflow','split','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','consequence','priority','info','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','QueueReport','UserId','catch','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x87d5,0x6b));var _0x587d=function(_0x425dbc,_0x3f9342){_0x425dbc=_0x425dbc-0x0;var _0x1a5f1e=_0x87d5[_0x425dbc];return _0x1a5f1e;};'use strict';var _=require(_0x587d('0x0'));var util=require('util');var path=require(_0x587d('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x587d('0x2'));var utils=require(_0x587d('0x3'));var sUtils=require(_0x587d('0x4'));var logger=require(_0x587d('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x587d('0x6')),'mailQueueReport':require(_0x587d('0x7')),'chatQueueReport':require(_0x587d('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x587d('0x9')),'whatsappQueueReport':require(_0x587d('0xa'))};var RuleEngine=require(_0x587d('0xb'));function getId(_0x5ea39b,_0x23f2eb,_0x2f6e57){return util[_0x587d('0xc')](_0x587d('0xd'),_0x5ea39b,_0x23f2eb||0x0,_0x2f6e57||0x0);}function getIntervals(_0x2c8d20,_0x30a942){var _0x4b72c1=[];if(!_[_0x587d('0xe')](_0x30a942[_0x587d('0xf')])&&!_['isNil'](_0x2c8d20[_0x30a942[_0x587d('0xf')]])&&!_[_0x587d('0xe')](_0x2c8d20[_0x30a942['IntervalId']]['Intervals'])){_0x4b72c1=_[_0x587d('0x10')](_0x2c8d20[_0x30a942[_0x587d('0xf')]][_0x587d('0x11')],'interval');}else if(!_[_0x587d('0xe')](_0x30a942[_0x587d('0x12')])){_0x4b72c1=[_0x30a942[_0x587d('0x12')]];}return _0x4b72c1;}exports[_0x587d('0x13')]=function(_0x165f36){_0x165f36[_0x587d('0x14')]={};return new BPromise(function(_0x12f2e8,_0x380e7a){var _0x4a9b39={'Start':function(_0x39a4e6){var _0x4b2b77=this;return new Promise(function(_0x272e09,_0x4e53a8){if(_0x39a4e6){try{var _0x5c9000=[];var _0x5053e8=getId(_0x39a4e6[_0x587d('0x15')],_0x39a4e6[_0x587d('0x16')]?_0x39a4e6[_0x587d('0x16')]['id']:0x0,_0x39a4e6[_0x587d('0x17')]?_0x39a4e6[_0x587d('0x17')]['id']:0x0);var _0x3038cb=sUtils['checkWaitingNotifications'](_0x165f36,_0x39a4e6);if(_0x39a4e6[_0x587d('0x18')]||!_0x3038cb&&_0x39a4e6[_0x587d('0x19')]&&_['isArray'](_0x39a4e6['applications'])&&_0x39a4e6['applications'][_0x587d('0x1a')]){for(var _0x3a4f66=0x0;_0x3a4f66<_0x39a4e6['applications'][_0x587d('0x1a')];_0x3a4f66+=0x1){var _0x4c3e48=_0x39a4e6[_0x587d('0x19')][_0x3a4f66];if(fs[_0x587d('0x1b')](path['join'](__dirname,_0x587d('0x19'),_0x4c3e48[_0x587d('0x1c')]+'.js'))){var _0x5f46f6=[];switch(_0x4c3e48[_0x587d('0x1c')][_0x587d('0x1d')]()){case _0x587d('0x1e'):var _0x3830a0=_0x4c3e48[_0x587d('0x1f')]['split'](',');if(_0x39a4e6[_0x587d('0x15')]===_0x587d('0x20')){_0x5f46f6[_0x587d('0x21')](_0x3830a0[0x0]);_0x5f46f6[_0x587d('0x21')](_0x3830a0[0x1]);_0x5f46f6[_0x587d('0x21')](_0x3830a0[_0x587d('0x22')](0x2,_0x3830a0['length'])[_0x587d('0x23')](','));}else{_0x5f46f6['push'](_0x3830a0[0x0]);_0x5f46f6[_0x587d('0x21')](_0x3830a0[_0x587d('0x22')](0x1,_0x3830a0['length'])[_0x587d('0x23')](','));}break;case _0x587d('0x24'):var _0x108bbb=_0x4c3e48['appdata'][_0x587d('0x25')](',');_0x5f46f6[_0x587d('0x21')](_0x108bbb[0x0]);_0x5f46f6['push'](_0x108bbb[0x1]);_0x5f46f6[_0x587d('0x21')](_0x108bbb[_0x587d('0x22')](0x2,_0x108bbb['length'])[_0x587d('0x23')](','));break;case'dialogflowv2':var _0x172b49=_0x4c3e48[_0x587d('0x1f')]['split'](',');_0x5f46f6['push'](_0x172b49[0x0]);_0x5f46f6[_0x587d('0x21')](_0x172b49[0x1]);_0x5f46f6[_0x587d('0x21')](_0x172b49[0x2]);_0x5f46f6[_0x587d('0x21')](_0x172b49[0x3]);_0x5f46f6[_0x587d('0x21')](_0x172b49[_0x587d('0x22')](0x4,_0x172b49[_0x587d('0x1a')])['join'](','));break;case'amazonlex':var _0x3584e7=_0x4c3e48['appdata'][_0x587d('0x25')](',');_0x5f46f6[_0x587d('0x21')](_0x3584e7[0x0]);_0x5f46f6[_0x587d('0x21')](_0x3584e7[0x1]);_0x5f46f6[_0x587d('0x21')](_0x3584e7[0x2]);_0x5f46f6[_0x587d('0x21')](_0x3584e7[0x3]);_0x5f46f6['push'](_0x3584e7['slice'](0x4,_0x3584e7[_0x587d('0x1a')])[_0x587d('0x23')](','));break;case'message':_0x5f46f6[_0x587d('0x21')](_0x4c3e48[_0x587d('0x1f')]);break;case _0x587d('0x26'):_0x5f46f6[_0x587d('0x21')](_0x4c3e48[_0x587d('0x27')]);_0x5f46f6['push'](_0x4c3e48[_0x587d('0x1f')]);break;case'tvox':var _0x1f550d=utils[_0x587d('0x28')](_0x39a4e6['account'][_0x587d('0x29')],_0x39a4e6);var _0x36950b=_0x4c3e48['appdata'][_0x587d('0x25')](',');_0x5f46f6[_0x587d('0x21')](_0x36950b[0x0]);_0x5f46f6[_0x587d('0x21')](_0x36950b[0x1]);_0x5f46f6[_0x587d('0x21')](_0x36950b[0x2]);_0x5f46f6['push'](_0x36950b[0x3]);_0x5f46f6['push'](_0x36950b[0x4]);_0x5f46f6[_0x587d('0x21')](_0x36950b[0x5]);_0x5f46f6['push'](_0x36950b[0x6]);_0x5f46f6[_0x587d('0x21')](_0x36950b[0x7]);_0x5f46f6['push'](_0x36950b[0x8]);_0x5f46f6['push'](_0x36950b[0x9]);_0x5f46f6[_0x587d('0x21')](_0x36950b[0xa]);_0x5f46f6[_0x587d('0x21')](_0x39a4e6[_0x587d('0x17')]['id']);_0x5f46f6[_0x587d('0x21')](_0x39a4e6[_0x587d('0x16')]['id']);_0x5f46f6[_0x587d('0x21')](_0x4c3e48[_0x587d('0x2a')]);_0x5f46f6[_0x587d('0x21')](_0x39a4e6[_0x587d('0x17')][_0x587d('0x2b')]);_0x5f46f6['push'](_0x39a4e6[_0x587d('0x2c')][_0x587d('0x2c')]);_0x5f46f6[_0x587d('0x21')](_0x1f550d);break;default:_0x5f46f6=_['isNil'](_0x4c3e48[_0x587d('0x1f')])?[]:_0x4c3e48[_0x587d('0x1f')][_0x587d('0x25')](',');}var _0x5cce5c={'id':util[_0x587d('0xc')](_0x587d('0x2d'),_0x5053e8,_0x4c3e48['id'],_0x4c3e48[_0x587d('0x1c')]),'condition':require(_0x587d('0x2e'))['condition'](_0x5053e8,getIntervals(_0x165f36['intervals'],_0x4c3e48),_0x165f36),'consequence':require('./applications/'+_0x4c3e48[_0x587d('0x1c')])[_0x587d('0x2f')](_0x5053e8,_0x5f46f6,_0x165f36,_0x39a4e6),'p':_0x4c3e48[_0x587d('0x30')]||0x0};logger[_0x587d('0x31')]('Push\x20new\x20rule',_0x5cce5c['id'],_0x587d('0x32'),getIntervals(_0x165f36[_0x587d('0x33')],_0x4c3e48)['join'](_0x587d('0x34')));_0x5c9000[_0x587d('0x21')](_0x5cce5c);}else{logger[_0x587d('0x35')](_0x587d('0x36'),path[_0x587d('0x23')](__dirname,_0x587d('0x19'),_0x4c3e48[_0x587d('0x1c')]+'.js'));}}_0x165f36[_0x587d('0x14')][_0x5053e8]=new RuleEngine(_0x5c9000);_0x165f36[_0x587d('0x14')][_0x5053e8]['execute'](_0x39a4e6,function(_0x48795b){logger[_0x587d('0x31')](_0x587d('0x37'),JSON[_0x587d('0x38')](_0x48795b[_0x587d('0x39')]));if(_0x165f36[_0x587d('0x14')][_0x5053e8]){_0x165f36[_0x587d('0x14')][_0x5053e8][_0x587d('0x3a')](_0x587d('0x3b'));}});return _0x272e09({'code':0xc8,'message':_0x39a4e6});}else{if(_0x3038cb){logger[_0x587d('0x31')](util[_0x587d('0xc')]('Skipped\x20routing\x20for\x20%s',_0x5053e8));}else{logger[_0x587d('0x31')](_0x587d('0x3c'));}return _0x272e09({'code':0xc8,'message':_0x39a4e6});}}catch(_0x4ef59c){logger['error'](_0x4ef59c[_0x587d('0x3d')]);return _0x4e53a8(_0x4b2b77[_0x587d('0x35')](0x1f4,_0x4ef59c));}}return _0x4e53a8('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5c3c42){var _0x40b6ed=this;return new Promise(function(_0x51acc7,_0x26deda){if(_0x5c3c42[_0x587d('0x3e')]&&_0x5c3c42[_0x587d('0x3e')]['id']){if(_0x165f36[_0x587d('0x3f')][_0x5c3c42[_0x587d('0x3e')]['id']]){_0x165f36['agents'][_0x5c3c42[_0x587d('0x3e')]['id']]['busy']=![];_0x165f36[_0x587d('0x3f')][_0x5c3c42[_0x587d('0x3e')]['id']][_0x587d('0x40')]=undefined;}}if(_0x5c3c42[_0x587d('0x16')]&&_0x5c3c42[_0x587d('0x16')]['id']){try{var _0x24d549=getId(_0x5c3c42[_0x587d('0x15')],_0x5c3c42[_0x587d('0x16')]?_0x5c3c42[_0x587d('0x16')]['id']:0x0,_0x5c3c42[_0x587d('0x17')]?_0x5c3c42[_0x587d('0x17')]['id']:0x0);if(_0x165f36['rules'][_0x24d549]){_0x165f36[_0x587d('0x14')][_0x24d549][_0x587d('0x3a')]('end');if(rpc[_0x5c3c42[_0x587d('0x15')]+'QueueReport']){rpc[_0x5c3c42[_0x587d('0x15')]+_0x587d('0x41')]['update'](_0x24d549,{'UserId':_0x5c3c42[_0x587d('0x16')][_0x587d('0x42')]})[_0x587d('0x43')](function(){logger[_0x587d('0x35')]('error\x20update\x20queue\x20report');});}}return _0x51acc7({'code':0xc8,'message':_0x5c3c42});}catch(_0xc4be68){logger[_0x587d('0x35')](_0xc4be68[_0x587d('0x3d')]);return _0x26deda(_0x40b6ed[_0x587d('0x35')](0x1f4,_0xc4be68));}}logger['error'](_0x587d('0x44'));return _0x26deda(_0x40b6ed[_0x587d('0x35')](0x1f4,_0x587d('0x44')));});},'RejectMessage':function(_0x18d2e0){var _0x16c2cc=this;return new Promise(function(_0x18e6f7,_0x1324ed){if(_0x18d2e0['agent']&&_0x18d2e0['agent']['id']){try{if(_0x165f36[_0x587d('0x3f')][_0x18d2e0[_0x587d('0x3e')]['id']]){_0x165f36[_0x587d('0x3f')][_0x18d2e0[_0x587d('0x3e')]['id']]['busy']=![];_0x165f36['agents'][_0x18d2e0['agent']['id']][_0x587d('0x40')]=undefined;}return _0x18e6f7({'code':0xc8,'message':_0x18d2e0});}catch(_0x38bcbb){logger[_0x587d('0x35')](_0x38bcbb['stack']);return _0x1324ed(_0x16c2cc[_0x587d('0x35')](0x1f4,_0x38bcbb));}}logger[_0x587d('0x35')](_0x587d('0x44'));return _0x1324ed(_0x16c2cc[_0x587d('0x35')](0x1f4,_0x587d('0x44')));});},'AbandonInteraction':function(_0x1c5987){var _0x317bd9=this;return new Promise(function(_0xb1b44b,_0x5516fb){if(_0x1c5987[_0x587d('0x15')]&&_0x1c5987['interaction']&&_0x1c5987[_0x587d('0x17')]['id']){try{var _0x39b781=getId(_0x1c5987[_0x587d('0x15')],_0x1c5987[_0x587d('0x16')]?_0x1c5987[_0x587d('0x16')]['id']:0x0,_0x1c5987['interaction']?_0x1c5987[_0x587d('0x17')]['id']:0x0);if(_0x165f36[_0x587d('0x14')][_0x39b781]){_0x165f36[_0x587d('0x14')][_0x39b781][_0x587d('0x3a')](_0x587d('0x45'));}return _0xb1b44b({'code':0xc8,'message':_0x1c5987});}catch(_0x1c7472){logger[_0x587d('0x35')](_0x1c7472['stack']);return _0x5516fb(_0x317bd9['error'](0x1f4,_0x1c7472));}}logger[_0x587d('0x35')](_0x587d('0x44'));return _0x5516fb(_0x317bd9[_0x587d('0x35')](0x1f4,_0x587d('0x44')));});},'AgentCapacity':function(_0x507686){var _0x3ce08b=this;return new Promise(function(_0x556990,_0x3c9e6c){if(_0x165f36['agents']['hasOwnProperty'](_0x507686['id'])){for(var _0x36935c in _0x507686[_0x587d('0x46')]){if(_0x507686['capacity'][_0x587d('0x47')](_0x36935c)){if(_0x165f36[_0x587d('0x3f')][_0x507686['id']]['hasOwnProperty'](_0x36935c+'CurrentCapacity')){_0x165f36['agents'][_0x507686['id']][_0x36935c+_0x587d('0x48')]=parseInt(_0x507686[_0x587d('0x46')][_0x36935c],0xa);}}}_0x165f36[_0x587d('0x3f')][_0x507686['id']]['updateRealtime']();return _0x556990({'code':0xc8,'message':_0x165f36[_0x587d('0x3f')][_0x507686['id']]});}else{return _0x3c9e6c(_0x3ce08b[_0x587d('0x35')](0x1f4,_0x587d('0x49')));}});},'Agents':function(_0x1259e6){return new Promise(function(_0x5ef908){var _0x3fa982=_['values'](_0x165f36['agents']);if(_0x1259e6&&_0x1259e6['id']){var _0x462dde=_[_0x587d('0x4a')](_0x3fa982,function(_0x1e48e7){return _0x1e48e7['id']===_0x1259e6['id'];});_0x5ef908(_0x462dde);}else{_0x5ef908({'count':_0x3fa982[_0x587d('0x1a')],'rows':_0x3fa982});}});},'ChatQueues':function(){return new Promise(function(_0x4744e3){var _0x2fbac7=[];for(var _0x18b2c6 in _0x165f36[_0x587d('0x4b')]){if(_0x165f36[_0x587d('0x4b')][_0x587d('0x47')](_0x18b2c6)){var _0x13f147=_0x165f36['chatQueues'][_0x18b2c6];var _0x1e09d9={'id':_0x13f147['id'],'available':_0x13f147['available'],'loggedIn':_0x13f147[_0x587d('0x4c')],'name':_0x13f147[_0x587d('0x4d')],'paused':_0x13f147[_0x587d('0x4e')],'waiting':_0x13f147[_0x587d('0x4f')]};_0x2fbac7[_0x587d('0x21')](_0x1e09d9);}}_0x4744e3({'count':_0x2fbac7[_0x587d('0x1a')],'rows':_0x2fbac7});});},'MailQueues':function(){return new Promise(function(_0x38bb9d){var _0x814346=[];for(var _0xbf74da in _0x165f36['mailQueues']){if(_0x165f36[_0x587d('0x50')]['hasOwnProperty'](_0xbf74da)){var _0x5ad895=_0x165f36[_0x587d('0x50')][_0xbf74da];var _0x6f398={'id':_0x5ad895['id'],'available':_0x5ad895[_0x587d('0x51')],'loggedIn':_0x5ad895['loggedIn'],'name':_0x5ad895[_0x587d('0x4d')],'paused':_0x5ad895[_0x587d('0x4e')],'waiting':_0x5ad895[_0x587d('0x4f')]};_0x814346['push'](_0x6f398);}}_0x38bb9d({'count':_0x814346[_0x587d('0x1a')],'rows':_0x814346});});},'OpenchannelQueues':function(){return new Promise(function(_0x4cea5e){var _0x15251f=[];for(var _0x39d64c in _0x165f36['openchannelQueues']){if(_0x165f36[_0x587d('0x52')]['hasOwnProperty'](_0x39d64c)){var _0x6b5db7=_0x165f36[_0x587d('0x52')][_0x39d64c];var _0x523780={'id':_0x6b5db7['id'],'available':_0x6b5db7[_0x587d('0x51')],'loggedIn':_0x6b5db7[_0x587d('0x4c')],'name':_0x6b5db7[_0x587d('0x4d')],'paused':_0x6b5db7[_0x587d('0x4e')],'waiting':_0x6b5db7['waiting']};_0x15251f[_0x587d('0x21')](_0x523780);}}_0x4cea5e({'count':_0x15251f['length'],'rows':_0x15251f});});},'SmsQueues':function(){return new Promise(function(_0x76549c){var _0x369ece=[];for(var _0x532c52 in _0x165f36[_0x587d('0x53')]){if(_0x165f36['smsQueues'][_0x587d('0x47')](_0x532c52)){var _0x55fe2e=_0x165f36['smsQueues'][_0x532c52];var _0x46a93a={'id':_0x55fe2e['id'],'available':_0x55fe2e[_0x587d('0x51')],'loggedIn':_0x55fe2e[_0x587d('0x4c')],'name':_0x55fe2e[_0x587d('0x4d')],'paused':_0x55fe2e[_0x587d('0x4e')],'waiting':_0x55fe2e['waiting']};_0x369ece[_0x587d('0x21')](_0x46a93a);}}_0x76549c({'count':_0x369ece[_0x587d('0x1a')],'rows':_0x369ece});});},'FaxQueues':function(){return new Promise(function(_0x242309){var _0x2a0b5f=[];for(var _0x2d2daa in _0x165f36[_0x587d('0x54')]){if(_0x165f36[_0x587d('0x54')]['hasOwnProperty'](_0x2d2daa)){var _0x172f4d=_0x165f36['faxQueues'][_0x2d2daa];var _0x395c4e={'id':_0x172f4d['id'],'available':_0x172f4d[_0x587d('0x51')],'loggedIn':_0x172f4d[_0x587d('0x4c')],'name':_0x172f4d[_0x587d('0x4d')],'paused':_0x172f4d[_0x587d('0x4e')],'waiting':_0x172f4d[_0x587d('0x4f')]};_0x2a0b5f['push'](_0x395c4e);}}_0x242309({'count':_0x2a0b5f[_0x587d('0x1a')],'rows':_0x2a0b5f});});},'WhatsappQueues':function(){return new Promise(function(_0x387cd5){var _0x32ad01=[];for(var _0x1550ad in _0x165f36['whatsappQueues']){if(_0x165f36[_0x587d('0x55')][_0x587d('0x47')](_0x1550ad)){var _0x2f2336=_0x165f36[_0x587d('0x55')][_0x1550ad];var _0x2eba02={'id':_0x2f2336['id'],'available':_0x2f2336[_0x587d('0x51')],'loggedIn':_0x2f2336[_0x587d('0x4c')],'name':_0x2f2336[_0x587d('0x4d')],'paused':_0x2f2336['paused'],'waiting':_0x2f2336[_0x587d('0x4f')]};_0x32ad01[_0x587d('0x21')](_0x2eba02);}}_0x387cd5({'count':_0x32ad01['length'],'rows':_0x32ad01});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2ae970){var _0x1f1eca=_[_0x587d('0x56')](_0x165f36[_0x587d('0x57')]);_0x2ae970({'count':_0x1f1eca['length'],'rows':_0x1f1eca});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5a43fa){var _0x592a20=_[_0x587d('0x56')](_0x165f36[_0x587d('0x58')]);_0x5a43fa({'count':_0x592a20[_0x587d('0x1a')],'rows':_0x592a20});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3d10de){var _0x5714b6=_[_0x587d('0x56')](_0x165f36[_0x587d('0x59')]);_0x3d10de({'count':_0x5714b6['length'],'rows':_0x5714b6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5c5f4c){var _0x15bbfb=_[_0x587d('0x56')](_0x165f36[_0x587d('0x5a')]);_0x5c5f4c({'count':_0x15bbfb[_0x587d('0x1a')],'rows':_0x15bbfb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xbee0db){var _0x473f73=_['values'](_0x165f36['faxQueuesWaitingInteractions']);_0xbee0db({'count':_0x473f73[_0x587d('0x1a')],'rows':_0x473f73});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x15f87a){var _0x49db05=_[_0x587d('0x56')](_0x165f36[_0x587d('0x5b')]);_0x15f87a({'count':_0x49db05[_0x587d('0x1a')],'rows':_0x49db05});});}};var _0x33ade2=jayson[_0x587d('0x5c')](_0x4a9b39)[_0x587d('0x5d')]();_0x33ade2['on'](_0x587d('0x35'),function(_0x3a73f1){logger[_0x587d('0x35')](JSON[_0x587d('0x38')](_0x3a73f1));return _0x380e7a(_0x3a73f1);});_0x33ade2['listen'](0x232c,_0x587d('0x5e'),function(){console['log'](_0x587d('0x5f'),0x232c);return _0x12f2e8(_0x587d('0x60')+0x232c);});});}; \ No newline at end of file +var _0xccd4=['tag','TagId','tvox','getMustacheRender','account','notificationTemplate','interaction','ChatWebsiteId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','error','execute','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','name','paused','waiting','mailQueues','available','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','app','.js','toLowerCase','split','mail','push','slice','join','dialogflow','dialogflowv2','appdata','amazonlex'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xccd4,0xa4));var _0x4ccd=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xccd4[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x4ccd('0x0'));var util=require(_0x4ccd('0x1'));var path=require(_0x4ccd('0x2'));var fs=require('fs');var jayson=require(_0x4ccd('0x3'));var BPromise=require(_0x4ccd('0x4'));var utils=require(_0x4ccd('0x5'));var sUtils=require(_0x4ccd('0x6'));var logger=require(_0x4ccd('0x7'))(_0x4ccd('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x4ccd('0x9')),'faxQueueReport':require(_0x4ccd('0xa')),'whatsappQueueReport':require(_0x4ccd('0xb'))};var RuleEngine=require(_0x4ccd('0xc'));function getId(_0x37977b,_0x3c5b28,_0x50ab0f){return util[_0x4ccd('0xd')](_0x4ccd('0xe'),_0x37977b,_0x3c5b28||0x0,_0x50ab0f||0x0);}function getIntervals(_0x4a242d,_0x5d4bfd){var _0xa07e4e=[];if(!_[_0x4ccd('0xf')](_0x5d4bfd['IntervalId'])&&!_[_0x4ccd('0xf')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]])&&!_[_0x4ccd('0xf')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]][_0x4ccd('0x11')])){_0xa07e4e=_[_0x4ccd('0x12')](_0x4a242d[_0x5d4bfd[_0x4ccd('0x10')]][_0x4ccd('0x11')],_0x4ccd('0x13'));}else if(!_[_0x4ccd('0xf')](_0x5d4bfd[_0x4ccd('0x13')])){_0xa07e4e=[_0x5d4bfd[_0x4ccd('0x13')]];}return _0xa07e4e;}exports[_0x4ccd('0x14')]=function(_0x46be83){_0x46be83[_0x4ccd('0x15')]={};return new BPromise(function(_0x3784ad,_0x29554c){var _0x1d91da={'Start':function(_0x29643b){var _0x4d4c9a=this;return new Promise(function(_0x27dcfa,_0xf338b7){if(_0x29643b){try{var _0x37805c=[];var _0x64b4a4=getId(_0x29643b[_0x4ccd('0x16')],_0x29643b['message']?_0x29643b[_0x4ccd('0x17')]['id']:0x0,_0x29643b['interaction']?_0x29643b['interaction']['id']:0x0);var _0x2b8389=sUtils[_0x4ccd('0x18')](_0x46be83,_0x29643b);if(_0x29643b[_0x4ccd('0x19')]||!_0x2b8389&&_0x29643b[_0x4ccd('0x1a')]&&_[_0x4ccd('0x1b')](_0x29643b[_0x4ccd('0x1a')])&&_0x29643b[_0x4ccd('0x1a')][_0x4ccd('0x1c')]){for(var _0xf76a13=0x0;_0xf76a13<_0x29643b[_0x4ccd('0x1a')][_0x4ccd('0x1c')];_0xf76a13+=0x1){var _0x33febc=_0x29643b[_0x4ccd('0x1a')][_0xf76a13];if(fs[_0x4ccd('0x1d')](path['join'](__dirname,_0x4ccd('0x1a'),_0x33febc[_0x4ccd('0x1e')]+_0x4ccd('0x1f')))){var _0x1a608d=[];switch(_0x33febc[_0x4ccd('0x1e')][_0x4ccd('0x20')]()){case'autoreply':var _0x35af9b=_0x33febc['appdata'][_0x4ccd('0x21')](',');if(_0x29643b[_0x4ccd('0x16')]===_0x4ccd('0x22')){_0x1a608d[_0x4ccd('0x23')](_0x35af9b[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[_0x4ccd('0x24')](0x2,_0x35af9b[_0x4ccd('0x1c')])[_0x4ccd('0x25')](','));}else{_0x1a608d['push'](_0x35af9b[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x35af9b[_0x4ccd('0x24')](0x1,_0x35af9b['length'])[_0x4ccd('0x25')](','));}break;case _0x4ccd('0x26'):var _0x48a22a=_0x33febc['appdata'][_0x4ccd('0x21')](',');_0x1a608d['push'](_0x48a22a[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x48a22a[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x48a22a['slice'](0x2,_0x48a22a['length'])[_0x4ccd('0x25')](','));break;case _0x4ccd('0x27'):var _0x22d966=_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x2]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x22d966[_0x4ccd('0x24')](0x4,_0x22d966[_0x4ccd('0x1c')])[_0x4ccd('0x25')](','));break;case _0x4ccd('0x29'):var _0x107f42=_0x33febc[_0x4ccd('0x28')]['split'](',');_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x1]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x2]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x107f42[_0x4ccd('0x24')](0x4,_0x107f42[_0x4ccd('0x1c')])['join'](','));break;case _0x4ccd('0x17'):_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x28')]);break;case _0x4ccd('0x2a'):_0x1a608d['push'](_0x33febc[_0x4ccd('0x2b')]);_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x28')]);break;case _0x4ccd('0x2c'):var _0x1836e7=utils[_0x4ccd('0x2d')](_0x29643b[_0x4ccd('0x2e')][_0x4ccd('0x2f')],_0x29643b);var _0x344682=_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');_0x1a608d[_0x4ccd('0x23')](_0x344682[0x0]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x1]);_0x1a608d['push'](_0x344682[0x2]);_0x1a608d['push'](_0x344682[0x3]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x4]);_0x1a608d['push'](_0x344682[0x5]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x6]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x7]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x8]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0x9]);_0x1a608d[_0x4ccd('0x23')](_0x344682[0xa]);_0x1a608d[_0x4ccd('0x23')](_0x29643b[_0x4ccd('0x30')]['id']);_0x1a608d[_0x4ccd('0x23')](_0x29643b['message']['id']);_0x1a608d[_0x4ccd('0x23')](_0x33febc[_0x4ccd('0x31')]);_0x1a608d[_0x4ccd('0x23')](_0x29643b['interaction']['ContactId']);_0x1a608d[_0x4ccd('0x23')](_0x29643b[_0x4ccd('0x32')]['body']);_0x1a608d[_0x4ccd('0x23')](_0x1836e7);break;default:_0x1a608d=_['isNil'](_0x33febc['appdata'])?[]:_0x33febc[_0x4ccd('0x28')][_0x4ccd('0x21')](',');}var _0x2512dd={'id':util[_0x4ccd('0xd')](_0x4ccd('0x33'),_0x64b4a4,_0x33febc['id'],_0x33febc['app']),'condition':require(_0x4ccd('0x34'))['condition'](_0x64b4a4,getIntervals(_0x46be83[_0x4ccd('0x35')],_0x33febc),_0x46be83),'consequence':require(_0x4ccd('0x36')+_0x33febc[_0x4ccd('0x1e')])[_0x4ccd('0x37')](_0x64b4a4,_0x1a608d,_0x46be83,_0x29643b),'p':_0x33febc['priority']||0x0};logger[_0x4ccd('0x38')]('Push\x20new\x20rule',_0x2512dd['id'],_0x4ccd('0x39'),getIntervals(_0x46be83[_0x4ccd('0x35')],_0x33febc)[_0x4ccd('0x25')](_0x4ccd('0x3a')));_0x37805c[_0x4ccd('0x23')](_0x2512dd);}else{logger[_0x4ccd('0x3b')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x4ccd('0x25')](__dirname,_0x4ccd('0x1a'),_0x33febc[_0x4ccd('0x1e')]+'.js'));}}_0x46be83[_0x4ccd('0x15')][_0x64b4a4]=new RuleEngine(_0x37805c);_0x46be83[_0x4ccd('0x15')][_0x64b4a4][_0x4ccd('0x3c')](_0x29643b,function(_0x3589b6){logger[_0x4ccd('0x38')]('Applications\x20executed',JSON[_0x4ccd('0x3d')](_0x3589b6['matchPath']));if(_0x46be83['rules'][_0x64b4a4]){_0x46be83[_0x4ccd('0x15')][_0x64b4a4][_0x4ccd('0x3e')](_0x4ccd('0x3f'));}});return _0x27dcfa({'code':0xc8,'message':_0x29643b});}else{if(_0x2b8389){logger[_0x4ccd('0x38')](util[_0x4ccd('0xd')](_0x4ccd('0x40'),_0x64b4a4));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x27dcfa({'code':0xc8,'message':_0x29643b});}}catch(_0x547019){logger[_0x4ccd('0x3b')](_0x547019[_0x4ccd('0x41')]);return _0xf338b7(_0x4d4c9a[_0x4ccd('0x3b')](0x1f4,_0x547019));}}return _0xf338b7(_0x4ccd('0x42'));});},'AcceptMessage':function(_0x145cfe){var _0x1720f1=this;return new Promise(function(_0x4c256c,_0xbe5e72){if(_0x145cfe[_0x4ccd('0x43')]&&_0x145cfe['agent']['id']){if(_0x46be83[_0x4ccd('0x44')][_0x145cfe[_0x4ccd('0x43')]['id']]){_0x46be83[_0x4ccd('0x44')][_0x145cfe[_0x4ccd('0x43')]['id']]['busy']=![];_0x46be83['agents'][_0x145cfe['agent']['id']][_0x4ccd('0x45')]=undefined;}}if(_0x145cfe['message']&&_0x145cfe[_0x4ccd('0x17')]['id']){try{var _0x4ba428=getId(_0x145cfe[_0x4ccd('0x16')],_0x145cfe['message']?_0x145cfe['message']['id']:0x0,_0x145cfe['interaction']?_0x145cfe[_0x4ccd('0x30')]['id']:0x0);if(_0x46be83[_0x4ccd('0x15')][_0x4ba428]){_0x46be83[_0x4ccd('0x15')][_0x4ba428][_0x4ccd('0x3e')]('end');if(rpc[_0x145cfe[_0x4ccd('0x16')]+_0x4ccd('0x46')]){rpc[_0x145cfe[_0x4ccd('0x16')]+_0x4ccd('0x46')][_0x4ccd('0x47')](_0x4ba428,{'UserId':_0x145cfe[_0x4ccd('0x17')][_0x4ccd('0x48')]})['catch'](function(){logger[_0x4ccd('0x3b')](_0x4ccd('0x49'));});}}return _0x4c256c({'code':0xc8,'message':_0x145cfe});}catch(_0x591e75){logger[_0x4ccd('0x3b')](_0x591e75[_0x4ccd('0x41')]);return _0xbe5e72(_0x1720f1['error'](0x1f4,_0x591e75));}}logger[_0x4ccd('0x3b')]('message\x20is\x20empty');return _0xbe5e72(_0x1720f1[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x4a')));});},'RejectMessage':function(_0x14d986){var _0x4434c2=this;return new Promise(function(_0x4b37bf,_0x2c6312){if(_0x14d986[_0x4ccd('0x43')]&&_0x14d986[_0x4ccd('0x43')]['id']){try{if(_0x46be83[_0x4ccd('0x44')][_0x14d986['agent']['id']]){_0x46be83['agents'][_0x14d986['agent']['id']][_0x4ccd('0x4b')]=![];_0x46be83[_0x4ccd('0x44')][_0x14d986['agent']['id']][_0x4ccd('0x45')]=undefined;}return _0x4b37bf({'code':0xc8,'message':_0x14d986});}catch(_0x52429a){logger[_0x4ccd('0x3b')](_0x52429a[_0x4ccd('0x41')]);return _0x2c6312(_0x4434c2[_0x4ccd('0x3b')](0x1f4,_0x52429a));}}logger[_0x4ccd('0x3b')](_0x4ccd('0x4a'));return _0x2c6312(_0x4434c2['error'](0x1f4,_0x4ccd('0x4a')));});},'AbandonInteraction':function(_0x89d6bf){var _0x22c0ce=this;return new Promise(function(_0x557612,_0x19d234){if(_0x89d6bf[_0x4ccd('0x16')]&&_0x89d6bf[_0x4ccd('0x30')]&&_0x89d6bf['interaction']['id']){try{var _0x171d21=getId(_0x89d6bf[_0x4ccd('0x16')],_0x89d6bf['message']?_0x89d6bf[_0x4ccd('0x17')]['id']:0x0,_0x89d6bf[_0x4ccd('0x30')]?_0x89d6bf['interaction']['id']:0x0);if(_0x46be83[_0x4ccd('0x15')][_0x171d21]){_0x46be83[_0x4ccd('0x15')][_0x171d21][_0x4ccd('0x3e')]('end');}return _0x557612({'code':0xc8,'message':_0x89d6bf});}catch(_0x3c2890){logger[_0x4ccd('0x3b')](_0x3c2890['stack']);return _0x19d234(_0x22c0ce[_0x4ccd('0x3b')](0x1f4,_0x3c2890));}}logger[_0x4ccd('0x3b')](_0x4ccd('0x4a'));return _0x19d234(_0x22c0ce[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x4a')));});},'AgentCapacity':function(_0x2f3516){var _0x1bbf94=this;return new Promise(function(_0x27082d,_0x73646a){if(_0x46be83[_0x4ccd('0x44')][_0x4ccd('0x4c')](_0x2f3516['id'])){for(var _0x52f7d9 in _0x2f3516[_0x4ccd('0x4d')]){if(_0x2f3516['capacity'][_0x4ccd('0x4c')](_0x52f7d9)){if(_0x46be83['agents'][_0x2f3516['id']][_0x4ccd('0x4c')](_0x52f7d9+'CurrentCapacity')){_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']][_0x52f7d9+_0x4ccd('0x4e')]=parseInt(_0x2f3516[_0x4ccd('0x4d')][_0x52f7d9],0xa);}}}_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']][_0x4ccd('0x4f')]();return _0x27082d({'code':0xc8,'message':_0x46be83[_0x4ccd('0x44')][_0x2f3516['id']]});}else{return _0x73646a(_0x1bbf94[_0x4ccd('0x3b')](0x1f4,_0x4ccd('0x50')));}});},'Agents':function(_0x4ba532){return new Promise(function(_0x3f0cb9){var _0x40d04a=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x44')]);if(_0x4ba532&&_0x4ba532['id']){var _0x456363=_[_0x4ccd('0x52')](_0x40d04a,function(_0x5c88e3){return _0x5c88e3['id']===_0x4ba532['id'];});_0x3f0cb9(_0x456363);}else{_0x3f0cb9({'count':_0x40d04a[_0x4ccd('0x1c')],'rows':_0x40d04a});}});},'ChatQueues':function(){return new Promise(function(_0x24ad9f){var _0x2cabba=[];for(var _0x5e0d5d in _0x46be83[_0x4ccd('0x53')]){if(_0x46be83[_0x4ccd('0x53')][_0x4ccd('0x4c')](_0x5e0d5d)){var _0x3f4c63=_0x46be83[_0x4ccd('0x53')][_0x5e0d5d];var _0x426bfd={'id':_0x3f4c63['id'],'available':_0x3f4c63['available'],'loggedIn':_0x3f4c63['loggedIn'],'name':_0x3f4c63[_0x4ccd('0x54')],'paused':_0x3f4c63[_0x4ccd('0x55')],'waiting':_0x3f4c63[_0x4ccd('0x56')]};_0x2cabba['push'](_0x426bfd);}}_0x24ad9f({'count':_0x2cabba[_0x4ccd('0x1c')],'rows':_0x2cabba});});},'MailQueues':function(){return new Promise(function(_0x19c53f){var _0x35e817=[];for(var _0x544343 in _0x46be83[_0x4ccd('0x57')]){if(_0x46be83[_0x4ccd('0x57')][_0x4ccd('0x4c')](_0x544343)){var _0xf07a2b=_0x46be83[_0x4ccd('0x57')][_0x544343];var _0x1561b1={'id':_0xf07a2b['id'],'available':_0xf07a2b[_0x4ccd('0x58')],'loggedIn':_0xf07a2b['loggedIn'],'name':_0xf07a2b[_0x4ccd('0x54')],'paused':_0xf07a2b['paused'],'waiting':_0xf07a2b[_0x4ccd('0x56')]};_0x35e817['push'](_0x1561b1);}}_0x19c53f({'count':_0x35e817[_0x4ccd('0x1c')],'rows':_0x35e817});});},'OpenchannelQueues':function(){return new Promise(function(_0x9014a1){var _0x4d971d=[];for(var _0x98a9ae in _0x46be83[_0x4ccd('0x59')]){if(_0x46be83[_0x4ccd('0x59')][_0x4ccd('0x4c')](_0x98a9ae)){var _0x3011b0=_0x46be83[_0x4ccd('0x59')][_0x98a9ae];var _0x45b667={'id':_0x3011b0['id'],'available':_0x3011b0[_0x4ccd('0x58')],'loggedIn':_0x3011b0[_0x4ccd('0x5a')],'name':_0x3011b0['name'],'paused':_0x3011b0[_0x4ccd('0x55')],'waiting':_0x3011b0[_0x4ccd('0x56')]};_0x4d971d[_0x4ccd('0x23')](_0x45b667);}}_0x9014a1({'count':_0x4d971d['length'],'rows':_0x4d971d});});},'SmsQueues':function(){return new Promise(function(_0x49f85e){var _0x5dc349=[];for(var _0x534e84 in _0x46be83[_0x4ccd('0x5b')]){if(_0x46be83['smsQueues'][_0x4ccd('0x4c')](_0x534e84)){var _0x3c1e82=_0x46be83['smsQueues'][_0x534e84];var _0x4eddae={'id':_0x3c1e82['id'],'available':_0x3c1e82[_0x4ccd('0x58')],'loggedIn':_0x3c1e82['loggedIn'],'name':_0x3c1e82['name'],'paused':_0x3c1e82[_0x4ccd('0x55')],'waiting':_0x3c1e82[_0x4ccd('0x56')]};_0x5dc349[_0x4ccd('0x23')](_0x4eddae);}}_0x49f85e({'count':_0x5dc349[_0x4ccd('0x1c')],'rows':_0x5dc349});});},'FaxQueues':function(){return new Promise(function(_0x249418){var _0x3f8974=[];for(var _0x48e0a0 in _0x46be83[_0x4ccd('0x5c')]){if(_0x46be83[_0x4ccd('0x5c')]['hasOwnProperty'](_0x48e0a0)){var _0x50d04d=_0x46be83[_0x4ccd('0x5c')][_0x48e0a0];var _0x3b7405={'id':_0x50d04d['id'],'available':_0x50d04d[_0x4ccd('0x58')],'loggedIn':_0x50d04d[_0x4ccd('0x5a')],'name':_0x50d04d[_0x4ccd('0x54')],'paused':_0x50d04d[_0x4ccd('0x55')],'waiting':_0x50d04d['waiting']};_0x3f8974[_0x4ccd('0x23')](_0x3b7405);}}_0x249418({'count':_0x3f8974['length'],'rows':_0x3f8974});});},'WhatsappQueues':function(){return new Promise(function(_0x3db39e){var _0x3102c2=[];for(var _0x4a4368 in _0x46be83[_0x4ccd('0x5d')]){if(_0x46be83[_0x4ccd('0x5d')]['hasOwnProperty'](_0x4a4368)){var _0x5089af=_0x46be83[_0x4ccd('0x5d')][_0x4a4368];var _0x559e5b={'id':_0x5089af['id'],'available':_0x5089af[_0x4ccd('0x58')],'loggedIn':_0x5089af[_0x4ccd('0x5a')],'name':_0x5089af[_0x4ccd('0x54')],'paused':_0x5089af['paused'],'waiting':_0x5089af[_0x4ccd('0x56')]};_0x3102c2[_0x4ccd('0x23')](_0x559e5b);}}_0x3db39e({'count':_0x3102c2[_0x4ccd('0x1c')],'rows':_0x3102c2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2393cc){var _0x118133=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x5e')]);_0x2393cc({'count':_0x118133[_0x4ccd('0x1c')],'rows':_0x118133});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5c303d){var _0x268388=_[_0x4ccd('0x51')](_0x46be83['mailQueuesWaitingInteractions']);_0x5c303d({'count':_0x268388['length'],'rows':_0x268388});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x48608f){var _0x51fb61=_['values'](_0x46be83['openchannelQueuesWaitingInteractions']);_0x48608f({'count':_0x51fb61[_0x4ccd('0x1c')],'rows':_0x51fb61});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x37c7e7){var _0x3783a3=_['values'](_0x46be83[_0x4ccd('0x5f')]);_0x37c7e7({'count':_0x3783a3['length'],'rows':_0x3783a3});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x52f289){var _0x45179d=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x60')]);_0x52f289({'count':_0x45179d['length'],'rows':_0x45179d});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3be105){var _0x5b1453=_[_0x4ccd('0x51')](_0x46be83[_0x4ccd('0x61')]);_0x3be105({'count':_0x5b1453[_0x4ccd('0x1c')],'rows':_0x5b1453});});}};var _0x3120eb=jayson[_0x4ccd('0x62')](_0x1d91da)[_0x4ccd('0x63')]();_0x3120eb['on'](_0x4ccd('0x3b'),function(_0x423743){logger[_0x4ccd('0x3b')](JSON['stringify'](_0x423743));return _0x29554c(_0x423743);});_0x3120eb[_0x4ccd('0x14')](0x232c,'127.0.0.1',function(){console[_0x4ccd('0x64')](_0x4ccd('0x65'),0x232c);return _0x3784ad(_0x4ccd('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 5956585..c75229c 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 _0xf542=['when','join','stop','lodash','../../../utils/iftime','iftime','../../../config/logger','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20'];(function(_0x178640,_0x4172a2){var _0x2f9469=function(_0x6c0c09){while(--_0x6c0c09){_0x178640['push'](_0x178640['shift']());}};_0x2f9469(++_0x4172a2);}(_0xf542,0xe0));var _0x2f54=function(_0x3116e6,_0x263f02){_0x3116e6=_0x3116e6-0x0;var _0x21b2cf=_0xf542[_0x3116e6];return _0x21b2cf;};'use strict';var _=require(_0x2f54('0x0'));var iftime=require(_0x2f54('0x1'))[_0x2f54('0x2')];var logger=require(_0x2f54('0x3'))('routing');exports['condition']=function(_0x5a3cd8,_0x29cb26,_0x5bc406){return function(_0x400727){if(_0x5bc406['rules']&&!_0x5bc406[_0x2f54('0x4')][_0x5a3cd8]){logger[_0x2f54('0x5')](_0x2f54('0x6'),_0x5a3cd8);return _0x400727['stop']();}var _0x3fe9ab=_0x29cb26[_0x2f54('0x7')](function(_0x42e996){return iftime(_0x42e996);});var _0x4acdfd=_['some'](_0x3fe9ab);if(_0x4acdfd){logger[_0x2f54('0x5')](_0x2f54('0x8'),_0x5a3cd8,_0x29cb26['join'](_0x2f54('0x9')),_0x4acdfd);_0x400727[_0x2f54('0xa')](_0x4acdfd);}else{logger[_0x2f54('0x5')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x5a3cd8,_0x29cb26[_0x2f54('0xb')]('\x20|\x20'));_0x400727[_0x2f54('0xc')]();}};}; \ No newline at end of file +var _0xc55e=['map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','stop','lodash','../../../utils/iftime','iftime','../../../config/logger','routing','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x5e7cf2,_0x3be5d5){var _0x2df0da=function(_0x44f74f){while(--_0x44f74f){_0x5e7cf2['push'](_0x5e7cf2['shift']());}};_0x2df0da(++_0x3be5d5);}(_0xc55e,0x160));var _0xec55=function(_0x54a7ce,_0x42d072){_0x54a7ce=_0x54a7ce-0x0;var _0x2c62f1=_0xc55e[_0x54a7ce];return _0x2c62f1;};'use strict';var _=require(_0xec55('0x0'));var iftime=require(_0xec55('0x1'))[_0xec55('0x2')];var logger=require(_0xec55('0x3'))(_0xec55('0x4'));exports['condition']=function(_0x545d18,_0xe341ff,_0x3b2f31){return function(_0x469e33){if(_0x3b2f31[_0xec55('0x5')]&&!_0x3b2f31[_0xec55('0x5')][_0x545d18]){logger[_0xec55('0x6')](_0xec55('0x7'),_0x545d18);return _0x469e33['stop']();}var _0x16aa33=_0xe341ff[_0xec55('0x8')](function(_0x554717){return iftime(_0x554717);});var _0x1e2d5a=_[_0xec55('0x9')](_0x16aa33);if(_0x1e2d5a){logger[_0xec55('0x6')](_0xec55('0xa'),_0x545d18,_0xe341ff[_0xec55('0xb')](_0xec55('0xc')),_0x1e2d5a);_0x469e33[_0xec55('0xd')](_0x1e2d5a);}else{logger[_0xec55('0x6')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x545d18,_0xe341ff[_0xec55('0xb')]('\x20|\x20'));_0x469e33[_0xec55('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f28ab97..b47ad33 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 _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x26d842,_0x338c65){var _0x5d50cd=function(_0x52499f){while(--_0x52499f){_0x26d842['push'](_0x26d842['shift']());}};_0x5d50cd(++_0x338c65);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file +var _0x34b7=['acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererexten','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw'];(function(_0x13ad99,_0x41ffa1){var _0x3884c4=function(_0x54ecdc){while(--_0x54ecdc){_0x13ad99['push'](_0x13ad99['shift']());}};_0x3884c4(++_0x41ffa1);}(_0x34b7,0x196));var _0x734b=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0x34b7[_0x30b710];return _0x205edf;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x734b('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1aedd0,_0x6e4318){utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3'),_0x1aedd0['uniqueid'],_0x1aedd0['channel'],_0x1aedd0[_0x734b('0x4')],_0x1aedd0[_0x734b('0x5')],_0x1aedd0[_0x734b('0x6')],_0x1aedd0[_0x734b('0x7')],_0x1aedd0[_0x734b('0x8')],_0x1aedd0[_0x734b('0x9')]));if(_0x1aedd0['queue']){utils[_0x734b('0xa')](_0x1aedd0[_0x734b('0x4')])['then'](function(_0x53f163){if(_0x53f163){_0x1aedd0['type']=_0x53f163[_0x734b('0xb')];_0x1aedd0['agentacw']=_0x1aedd0[_0x734b('0xc')]?_0x53f163[_0x734b('0xd')]:![];_0x1aedd0[_0x734b('0xe')]=_0x1aedd0[_0x734b('0xf')]?_0x53f163[_0x734b('0x10')]:0x0;}utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);});}else{utils[_0x734b('0x11')](_0x734b('0x12'),_0x1aedd0);}if(_0x6e4318){delete transfers[_0x1aedd0[_0x734b('0x13')]];}else{delete agents[_0x1aedd0[_0x734b('0x14')]];}}exports[_0x734b('0x15')]=function(_0x145ec3){try{utils[_0x734b('0x16')](util['format'](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x145ec3);agents[_0x145ec3[_0x734b('0x14')]]=_0x145ec3;agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x1a');agents[_0x145ec3[_0x734b('0x14')]][_0x734b('0x8')]=null;agents[_0x145ec3['destuniqueid']][_0x734b('0x1b')]=null;utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x1c'),_0x145ec3['uniqueid'],agents[_0x145ec3['destuniqueid']][_0x734b('0x5')],_0x145ec3[_0x734b('0x14')]));}catch(_0x1e6ed9){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x17'),_0x145ec3[_0x734b('0x13')]),_0x1e6ed9);}};exports[_0x734b('0x1e')]=function(_0x67eed){try{if(!_[_0x734b('0x1f')](agents[_0x67eed[_0x734b('0x14')]])){utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x20'),_0x67eed['uniqueid']),_0x67eed);utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x67eed[_0x734b('0x13')],agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x5')],_0x67eed[_0x734b('0x14')]));agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x1e')]=!![];agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x21')]=utils[_0x734b('0x19')]();agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x9')]=_0x734b('0x22');agents[_0x67eed[_0x734b('0x14')]]['reason']='timeout';agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x23')]=_0x67eed['ringtime']?parseInt(_0x67eed[_0x734b('0x24')])/0x3e8:0x0;agents[_0x67eed[_0x734b('0x14')]][_0x734b('0x25')]=0x0;unanswered[_0x734b('0x26')](_0x67eed[_0x734b('0x14')]);}}catch(_0x1b8295){utils[_0x734b('0x1d')](util['format'](_0x734b('0x20'),_0x67eed[_0x734b('0x13')]),_0x1b8295);}};exports[_0x734b('0x27')]=function(_0x241c89){try{_[_0x734b('0x28')](agents,function(_0x427c36,_0x1fed72){if(_0x427c36[_0x734b('0x13')]==_0x241c89[_0x734b('0x13')]&&!_[_0x734b('0x29')](unanswered,_0x427c36['destuniqueid'])){utils[_0x734b('0x16')](util[_0x734b('0x2')]('[%s][agents][queuecallerabandon]',_0x241c89[_0x734b('0x13')]),_0x241c89);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x2a'),_0x241c89[_0x734b('0x13')],_0x427c36[_0x734b('0x5')],_0x427c36[_0x734b('0x14')]));_0x427c36[_0x734b('0x1e')]=!![];_0x427c36[_0x734b('0x21')]=utils[_0x734b('0x19')]();_0x427c36[_0x734b('0x9')]=_0x734b('0x2b');_0x427c36[_0x734b('0x2c')]=_0x734b('0x2b');_0x427c36[_0x734b('0x23')]=_0x241c89['holdtime'];_0x427c36[_0x734b('0x25')]=0x0;writeDB(_0x427c36);}});}catch(_0x5e2444){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x2d'),_0x241c89[_0x734b('0x13')]),_0x5e2444);}};exports[_0x734b('0x2e')]=function(_0x16ab66){try{if(agents[_0x16ab66['destuniqueid']]){utils['debug'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66[_0x734b('0x13')]),_0x16ab66);utils['info'](util[_0x734b('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ab66[_0x734b('0x13')],agents[_0x16ab66['destuniqueid']][_0x734b('0x5')],_0x16ab66[_0x734b('0x14')]));agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x2f')]=utils[_0x734b('0x19')]();agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x8')]=_0x16ab66['connectedlinenum'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x1b')]=_0x16ab66['connectedlinename'];agents[_0x16ab66[_0x734b('0x14')]][_0x734b('0x23')]=_0x16ab66[_0x734b('0x24')];agents[_0x16ab66[_0x734b('0x14')]]['lastevent']=_0x734b('0x30');_[_0x734b('0x28')](agents,function(_0x4efb1f,_0x40674c){if(_0x4efb1f[_0x734b('0x14')]!=_0x16ab66['destuniqueid']&&_0x4efb1f[_0x734b('0x13')]==_0x16ab66[_0x734b('0x13')]){_0x4efb1f[_0x734b('0x25')]=0x0;_0x4efb1f[_0x734b('0x23')]=_0x16ab66['ringtime'];_0x4efb1f['agentringnoanswer']=!![];_0x4efb1f[_0x734b('0x21')]=utils['now']();_0x4efb1f['lastevent']=_0x734b('0x31');_0x4efb1f['reason']=_0x734b('0x31');_0x4efb1f['answeredelsewheredestinationuniqueid']=_0x16ab66[_0x734b('0x14')];_0x4efb1f[_0x734b('0x32')]=_0x16ab66[_0x734b('0x5')];writeDB(_0x4efb1f);}});}}catch(_0x4c3fdc){utils['error'](util[_0x734b('0x2')]('[%s][agents][agentconnect]',_0x16ab66['uniqueid']),_0x4c3fdc);}};exports[_0x734b('0xc')]=function(_0x159db9){try{if(!_['isNil'](agents[_0x159db9[_0x734b('0x14')]])){utils['debug'](util[_0x734b('0x2')](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x159db9);utils['info'](util[_0x734b('0x2')](_0x734b('0x34'),_0x159db9[_0x734b('0x13')],agents[_0x159db9[_0x734b('0x14')]]['membername'],_0x159db9['destuniqueid']));agents[_0x159db9['destuniqueid']][_0x734b('0xc')]=!![];agents[_0x159db9['destuniqueid']]['agentcompleteAt']=utils[_0x734b('0x19')]();agents[_0x159db9['destuniqueid']][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x159db9[_0x734b('0x14')]][_0x734b('0x36')],agents[_0x159db9['destuniqueid']][_0x734b('0x2f')]);agents[_0x159db9['destuniqueid']][_0x734b('0x2c')]=_0x159db9[_0x734b('0x2c')];agents[_0x159db9[_0x734b('0x14')]]['lastevent']=_0x734b('0x37');writeDB(agents[_0x159db9['destuniqueid']]);}}catch(_0x357ae4){utils[_0x734b('0x1d')](util['format'](_0x734b('0x33'),_0x159db9[_0x734b('0x13')]),_0x357ae4);}};exports[_0x734b('0x38')]=function(_0x38125a){try{if(!_[_0x734b('0x1f')](agents[_0x38125a['transfereruniqueid']])){utils[_0x734b('0x16')](util['format'](_0x734b('0x39'),_0x38125a['uniqueid']),_0x38125a);utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x3a'),_0x38125a[_0x734b('0x13')],agents[_0x38125a[_0x734b('0x3b')]]['membername'],agents[_0x38125a['transfereruniqueid']]['uniqueid']));agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x3c')]=!![];agents[_0x38125a['transfereruniqueid']][_0x734b('0x3d')]=_0x734b('0x3e');agents[_0x38125a['transfereruniqueid']][_0x734b('0x3f')]=_0x38125a[_0x734b('0x40')];agents[_0x38125a[_0x734b('0x3b')]]['transferuniqueid']=agents[_0x38125a[_0x734b('0x3b')]][_0x734b('0x13')];}}catch(_0x423b22){utils[_0x734b('0x1d')](util['format'](_0x734b('0x39'),_0x38125a[_0x734b('0x13')]),_0x423b22);}};exports[_0x734b('0x41')]=function(_0x432a96){try{utils['debug'](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]',_0x432a96[_0x734b('0x42')]),_0x432a96);if(_0x432a96[_0x734b('0x42')]==_0x432a96[_0x734b('0x43')]){if(!_[_0x734b('0x1f')](agents[_0x432a96['secondtransfereruniqueid']])){utils[_0x734b('0x1')](util[_0x734b('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96['origtransfereruniqueid'],agents[_0x432a96[_0x734b('0x44')]]['membername']));agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x3c')]=!![];agents[_0x432a96[_0x734b('0x44')]]['transfertype']=_0x734b('0x45');agents[_0x432a96['secondtransfereruniqueid']][_0x734b('0x3f')]=_0x432a96[_0x734b('0x46')];agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x47')]=_0x432a96['origtransfereruniqueid'];}if(_0x432a96[_0x734b('0x48')]&&agents[_0x432a96['transfereeuniqueid']]){agents[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x48')]]=_['clone'](agents[_0x432a96[_0x734b('0x48')]]);transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x44')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x48')]]['calleridname']=agents[_0x432a96[_0x734b('0x44')]]['calleridname'];transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96['transfereeuniqueid']][_0x734b('0x2f')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x48')]][_0x734b('0x49')]=0x2;}}else if(_0x432a96[_0x734b('0x44')]==_0x432a96['secondtransfererlinkedid']){if(!_[_0x734b('0x1f')](agents[_0x432a96[_0x734b('0x42')]])){utils[_0x734b('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x432a96[_0x734b('0x42')],agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x5')]));agents[_0x432a96[_0x734b('0x42')]]['transfer']=!![];agents[_0x432a96['origtransfereruniqueid']]['transfertype']=_0x734b('0x45');agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x3f')]=_0x432a96[_0x734b('0x4a')];agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x47')]=_0x432a96[_0x734b('0x44')];}if(_0x432a96[_0x734b('0x4b')]&&agents[_0x432a96[_0x734b('0x4b')]]){agents[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x1;transfers[_0x432a96[_0x734b('0x4b')]]=_[_0x734b('0x4c')](agents[_0x432a96[_0x734b('0x4b')]]);transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x7')]=agents[_0x432a96[_0x734b('0x42')]][_0x734b('0x7')];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x4d')]=agents[_0x432a96[_0x734b('0x42')]]['calleridname'];transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x18')]=utils[_0x734b('0x19')]();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x2f')]=utils['now']();transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x23')]=0x0;transfers[_0x432a96[_0x734b('0x4b')]][_0x734b('0x49')]=0x2;}}}catch(_0x3c7d93){utils[_0x734b('0x1d')](util['format']('[%s][agents][attendedtransfer]',_0x432a96['origtransfereruniqueid']),_0x3c7d93);}};exports['hangup']=function(_0x4d95c7){try{utils[_0x734b('0x16')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x4d95c7);if(agents[_0x4d95c7['uniqueid']]&&agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')]===_0x734b('0x22')){if(_0x4d95c7[_0x734b('0x4f')]==='21'){agents[_0x4d95c7[_0x734b('0x13')]]['reason']=_0x734b('0x50');agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x50');}utils['info'](util[_0x734b('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')],agents[_0x4d95c7['uniqueid']][_0x734b('0x9')]));writeDB(agents[_0x4d95c7[_0x734b('0x13')]]);var _0x3c40b5=unanswered[_0x734b('0x51')](_0x4d95c7[_0x734b('0x13')]);if(_0x3c40b5>-0x1){unanswered['splice'](_0x3c40b5,0x1);}}if(transfers[_0x4d95c7[_0x734b('0x13')]]){transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt']=utils[_0x734b('0x19')]();transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](transfers[_0x4d95c7[_0x734b('0x13')]]['agentcompleteAt'],transfers[_0x4d95c7[_0x734b('0x13')]]['agentconnectAt']);transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=_0x734b('0x52');transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4d95c7[_0x734b('0x13')],transfers[_0x4d95c7['uniqueid']][_0x734b('0x5')],transfers[_0x4d95c7[_0x734b('0x13')]]['reason'],transfers[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(transfers[_0x4d95c7[_0x734b('0x13')]],!![]);}if(agents[_0x4d95c7[_0x734b('0x13')]]&&agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]){agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0xc')]=!![];agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x36')]=utils['now']();agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x25')]=utils[_0x734b('0x35')](agents[_0x4d95c7['uniqueid']][_0x734b('0x36')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2f')]);agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x2c')]=agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x3c')]?_0x734b('0x3c'):'agent';agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]=_0x734b('0x37');utils[_0x734b('0x1')](util[_0x734b('0x2')](_0x734b('0x53'),_0x4d95c7[_0x734b('0x13')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x5')],agents[_0x4d95c7['uniqueid']][_0x734b('0x2c')],agents[_0x4d95c7[_0x734b('0x13')]][_0x734b('0x9')]));writeDB(agents[_0x4d95c7['uniqueid']]);}}catch(_0x31e1ec){utils[_0x734b('0x1d')](util[_0x734b('0x2')](_0x734b('0x4e'),_0x4d95c7[_0x734b('0x13')]),_0x31e1ec);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 67e9f9f..ab6ccaa 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 _0xb795=['format','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','value','source','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','lastdata','xmd-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','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','util','./utils','NO\x20ANSWER','FAILED','BUSY','info'];(function(_0x26840d,_0x2d354d){var _0x10ba0b=function(_0x1615d0){while(--_0x1615d0){_0x26840d['push'](_0x26840d['shift']());}};_0x10ba0b(++_0x2d354d);}(_0xb795,0x12f));var _0x5b79=function(_0x2fe7f5,_0x3ec1db){_0x2fe7f5=_0x2fe7f5-0x0;var _0x106f34=_0xb795[_0x2fe7f5];return _0x106f34;};'use strict';var _=require('lodash');var util=require(_0x5b79('0x0'));var utils=require(_0x5b79('0x1'));var dispositions=[_0x5b79('0x2'),_0x5b79('0x3'),_0x5b79('0x3'),_0x5b79('0x2'),_0x5b79('0x2'),_0x5b79('0x2'),'ANSWERED',_0x5b79('0x4'),_0x5b79('0x3'),_0x5b79('0x3'),_0x5b79('0x3')];var channels={};function writeDB(_0xdd2291){utils[_0x5b79('0x5')](util[_0x5b79('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdd2291['uniqueid'],_0xdd2291[_0x5b79('0x7')],_0xdd2291[_0x5b79('0x8')],_0xdd2291[_0x5b79('0x9')],_0xdd2291[_0x5b79('0xa')],_0xdd2291['calleridnum'],_0xdd2291[_0x5b79('0xb')],_0xdd2291[_0x5b79('0xc')]));if(_0xdd2291[_0x5b79('0xd')]){utils['getUserByInternal'](_0xdd2291[_0x5b79('0xd')])[_0x5b79('0xe')](function(_0x25a6c1){if(_0x25a6c1){_0xdd2291[_0x5b79('0xf')]=_0x25a6c1['id'];}utils[_0x5b79('0x10')]('CreateVoiceCallReport',_0xdd2291);});}else{utils[_0x5b79('0x10')](_0x5b79('0x11'),_0xdd2291);}if(channels[_0xdd2291['uniqueid']]){delete channels[_0xdd2291[_0x5b79('0x12')]];}}exports[_0x5b79('0x13')]=function(_0x41a9fd){try{utils[_0x5b79('0x14')](util[_0x5b79('0x6')](_0x5b79('0x15'),_0x41a9fd[_0x5b79('0x12')]),_0x41a9fd);if(_0x41a9fd['uniqueid']==_0x41a9fd[_0x5b79('0x16')]&&_0x41a9fd[_0x5b79('0x7')]!=_0x5b79('0x17')){utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x18'),_0x41a9fd[_0x5b79('0x12')],_0x41a9fd[_0x5b79('0x19')],_0x41a9fd[_0x5b79('0x1a')]));channels[_0x41a9fd[_0x5b79('0x12')]]={'uniqueid':_0x41a9fd['uniqueid'],'accountcode':_0x41a9fd[_0x5b79('0xd')],'source':_0x41a9fd[_0x5b79('0x1b')],'destination':_0x41a9fd['exten'],'destinationcontext':_0x41a9fd[_0x5b79('0x19')],'channel':_0x41a9fd[_0x5b79('0x7')],'starttime':utils[_0x5b79('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x5b79('0x1d')};}}catch(_0x9baf98){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')]('[%s][calls][newchannel]',_0x41a9fd[_0x5b79('0x12')]),_0x9baf98);}};exports[_0x5b79('0x1f')]=function(_0x1d3487){try{utils[_0x5b79('0x14')](util[_0x5b79('0x6')]('[%s][calls][newstate]',_0x1d3487[_0x5b79('0x12')]),_0x1d3487);if(!_[_0x5b79('0x20')](channels[_0x1d3487[_0x5b79('0x12')]])&&_0x1d3487[_0x5b79('0x21')]==0x6){utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x22'),_0x1d3487[_0x5b79('0x12')],_0x1d3487['context'],_0x1d3487[_0x5b79('0x7')]));if(_[_0x5b79('0x20')](channels[_0x1d3487[_0x5b79('0x12')]][_0x5b79('0x23')])){channels[_0x1d3487[_0x5b79('0x12')]]['systemanswertime']=utils[_0x5b79('0x1c')]();}}else if(!_[_0x5b79('0x20')](channels[_0x1d3487[_0x5b79('0x16')]])&&_0x1d3487['channelstate']==0x6&&_0x1d3487['context']!=_0x5b79('0x24')){utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x25'),_0x1d3487[_0x5b79('0x12')],_0x1d3487[_0x5b79('0x16')],_0x1d3487[_0x5b79('0x19')],_0x1d3487['channel']));channels[_0x1d3487['linkedid']][_0x5b79('0xd')]=_0x1d3487[_0x5b79('0xd')];channels[_0x1d3487[_0x5b79('0x16')]]['destinationchannel']=_0x1d3487['channel'];if(_[_0x5b79('0x20')](channels[_0x1d3487[_0x5b79('0x16')]]['answertime'])){channels[_0x1d3487[_0x5b79('0x16')]][_0x5b79('0x26')]=utils[_0x5b79('0x1c')]();}channels[_0x1d3487[_0x5b79('0x16')]][_0x5b79('0x27')]=dispositions[_[_0x5b79('0x28')](_0x1d3487[_0x5b79('0x21')])]||_0x5b79('0x29');}}catch(_0x5a86a2){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')](_0x5b79('0x2a'),_0x1d3487[_0x5b79('0x12')]),_0x5a86a2);}};exports['hangup']=function(_0x534ba6){try{if(!_[_0x5b79('0x20')](channels[_0x534ba6[_0x5b79('0x12')]])){utils['debug'](util[_0x5b79('0x6')](_0x5b79('0x2b'),_0x534ba6[_0x5b79('0x12')]),_0x534ba6);if(_[_0x5b79('0x20')](channels[_0x534ba6['uniqueid']][_0x5b79('0x2c')])){channels[_0x534ba6[_0x5b79('0x12')]]['callerid']=_0x534ba6[_0x5b79('0x2d')]+'\x20<'+_0x534ba6[_0x5b79('0x1b')]+'>';}utils[_0x5b79('0x5')](util[_0x5b79('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x534ba6[_0x5b79('0x12')],channels[_0x534ba6['uniqueid']]['callerid'],_0x534ba6['cause-txt']));channels[_0x534ba6[_0x5b79('0x12')]]['endtime']=utils['now']();channels[_0x534ba6[_0x5b79('0x12')]]['duration']=utils[_0x5b79('0x2e')](channels[_0x534ba6['uniqueid']][_0x5b79('0x2f')],channels[_0x534ba6[_0x5b79('0x12')]][_0x5b79('0x30')]);channels[_0x534ba6[_0x5b79('0x12')]][_0x5b79('0x31')]=channels[_0x534ba6[_0x5b79('0x12')]][_0x5b79('0x26')]?utils[_0x5b79('0x2e')](channels[_0x534ba6[_0x5b79('0x12')]][_0x5b79('0x2f')],channels[_0x534ba6['uniqueid']][_0x5b79('0x26')]):0x0;writeDB(channels[_0x534ba6['uniqueid']]);}}catch(_0x439670){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')](_0x5b79('0x2b'),_0x534ba6[_0x5b79('0x12')]),_0x439670);}};exports[_0x5b79('0x32')]=function(_0xfcc801){try{if(!_[_0x5b79('0x20')](channels[_0xfcc801[_0x5b79('0x33')]])){utils['debug'](util['format'](_0x5b79('0x34'),_0xfcc801[_0x5b79('0x35')]),_0xfcc801);if(channels[_0xfcc801['localtwolinkedid']][_0x5b79('0x7')]==_0xfcc801[_0x5b79('0x36')]){utils['info'](util[_0x5b79('0x6')](_0x5b79('0x37'),_0xfcc801[_0x5b79('0x35')],_0xfcc801[_0x5b79('0x33')],_0xfcc801['secondtransfererchannel']));channels[_0xfcc801[_0x5b79('0x33')]][_0x5b79('0x38')]=_0xfcc801[_0x5b79('0x39')];channels[_0xfcc801[_0x5b79('0x33')]]['userfield']=_0x5b79('0x3a');}else if(channels[_0xfcc801['localtwolinkedid']]['channel']=_0xfcc801[_0x5b79('0x3b')]){utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x37'),_0xfcc801['origtransfereruniqueid'],_0xfcc801[_0x5b79('0x33')],_0xfcc801['origtransfererchannel']));channels[_0xfcc801['localtwolinkedid']][_0x5b79('0x38')]=_0xfcc801['origtransfererchannel'];channels[_0xfcc801[_0x5b79('0x33')]][_0x5b79('0x3c')]=_0x5b79('0x3a');}}}catch(_0x582a36){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')]('[%s][calls][attendedtransfer]',_0xfcc801['origtransfereruniqueid']),_0x582a36);}};exports['musiconholdstart']=function(_0x18c005){try{if(!_[_0x5b79('0x20')](channels[_0x18c005['uniqueid']])){utils[_0x5b79('0x14')](util['format'](_0x5b79('0x3d'),_0x18c005[_0x5b79('0x12')]),_0x18c005);channels[_0x18c005[_0x5b79('0x12')]][_0x5b79('0x3e')]=utils[_0x5b79('0x1c')]();utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x3f'),_0x18c005[_0x5b79('0x12')],channels[_0x18c005[_0x5b79('0x12')]][_0x5b79('0x3e')]));}}catch(_0x14f89){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')]('[%s][calls][musiconholdstart]',_0x18c005[_0x5b79('0x12')]),_0x14f89);}};exports[_0x5b79('0x40')]=function(_0xce05cc){try{if(!_['isNil'](channels[_0xce05cc['uniqueid']])){utils[_0x5b79('0x14')](util[_0x5b79('0x6')](_0x5b79('0x41'),_0xce05cc[_0x5b79('0x12')]),_0xce05cc);if(!_[_0x5b79('0x20')](channels[_0xce05cc[_0x5b79('0x12')]][_0x5b79('0x3e')])){channels[_0xce05cc[_0x5b79('0x12')]][_0x5b79('0x42')]+=utils['diffTime'](utils[_0x5b79('0x1c')](),channels[_0xce05cc[_0x5b79('0x12')]]['musiconholdstartAt']);utils[_0x5b79('0x5')](util[_0x5b79('0x6')](_0x5b79('0x43'),_0xce05cc['uniqueid'],channels[_0xce05cc[_0x5b79('0x12')]][_0x5b79('0x42')]));delete channels[_0xce05cc[_0x5b79('0x12')]][_0x5b79('0x3e')];}}}catch(_0x1f38c1){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')](_0x5b79('0x41'),_0xce05cc[_0x5b79('0x12')]),_0x1f38c1);}};exports['varset']=function(_0x503745){try{if(!_['isNil'](channels[_0x503745['uniqueid']])){utils[_0x5b79('0x14')](util['format']('[%s][calls][varset]',_0x503745['uniqueid']),_0x503745);if(!_['isNil'](_0x503745[_0x5b79('0x44')][_0x5b79('0x45')])){utils[_0x5b79('0x5')](util[_0x5b79('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x503745[_0x5b79('0x12')],_0x503745[_0x5b79('0x46')]));channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x47')]=_0x503745[_0x5b79('0x46')];}if(!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x48')])){utils[_0x5b79('0x5')](util[_0x5b79('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x503745['uniqueid'],_0x503745[_0x5b79('0x46')]));channels[_0x503745['uniqueid']]['destination']=_0x503745[_0x5b79('0x46')];channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x2c')]='\x22'+_0x503745[_0x5b79('0x46')]+_0x5b79('0x49')+_0x503745[_0x5b79('0x46')]+'>';}if(!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x4a')])||!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x4b')])){utils[_0x5b79('0x5')](util['format'](_0x5b79('0x4c'),_0x503745[_0x5b79('0x12')],!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x4a')])?_0x5b79('0x4a'):_0x5b79('0x4b'),_0x503745[_0x5b79('0x46')]));channels[_0x503745[_0x5b79('0x12')]]['callerid']=_0x503745['value'];}if(!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')]['xmd-queue'])||!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x4d')])){utils[_0x5b79('0x5')](util['format'](_0x5b79('0x4c'),_0x503745['uniqueid'],!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x4e')])?_0x5b79('0x4e'):_0x5b79('0x4d'),_0x503745[_0x5b79('0x46')]));channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x4f')]='Queue';channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x50')]=_0x503745[_0x5b79('0x46')];channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x8')]=!![];}if(!_[_0x5b79('0x20')](_0x503745['variable'][_0x5b79('0x51')])){utils[_0x5b79('0x5')](util[_0x5b79('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x503745[_0x5b79('0x12')],_0x503745[_0x5b79('0x46')]));channels[_0x503745[_0x5b79('0x12')]]['ContactId']=_0x503745['value'];}if(!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x52')])){utils['info'](util[_0x5b79('0x6')](_0x5b79('0x53'),_0x503745['uniqueid'],_0x503745['value']));channels[_0x503745['uniqueid']][_0x5b79('0x54')]=_0x503745[_0x5b79('0x46')];}if(!_['isNil'](_0x503745['variable'][_0x5b79('0x55')])){utils['info'](util[_0x5b79('0x6')](_0x5b79('0x56'),_0x503745['uniqueid'],_0x503745['value']));channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x57')]=_0x503745[_0x5b79('0x46')];}if(!_[_0x5b79('0x20')](_0x503745[_0x5b79('0x44')][_0x5b79('0x58')])){utils[_0x5b79('0x5')](util['format'](_0x5b79('0x59'),_0x503745[_0x5b79('0x12')],_0x503745['value']));channels[_0x503745[_0x5b79('0x12')]][_0x5b79('0x58')]=_0x503745['value'];}}}catch(_0x45807a){utils[_0x5b79('0x1e')](util[_0x5b79('0x6')](_0x5b79('0x5a'),_0x503745['uniqueid']),_0x45807a);}};exports[_0x5b79('0x5b')]=function(_0x5964c4){try{if(!_[_0x5b79('0x20')](channels[_0x5964c4[_0x5b79('0x12')]])){utils[_0x5b79('0x14')](util[_0x5b79('0x6')](_0x5b79('0x5c'),_0x5964c4['uniqueid']),_0x5964c4);utils['info'](util[_0x5b79('0x6')](_0x5b79('0x5d'),_0x5964c4[_0x5b79('0x12')],_0x5964c4[_0x5b79('0x5e')],_0x5964c4[_0x5b79('0x5f')]));if(_0x5964c4[_0x5b79('0x5e')][_0x5b79('0x60')]()==_0x5b79('0x61')&&_[_0x5b79('0x62')](_0x5964c4['appdata']['toLowerCase'](),'cdr')){var _0x265370=_0x5964c4[_0x5b79('0x5f')][_0x5b79('0x63')]('=');var _0x5616b4=_0x265370[0x0][_0x5b79('0x64')](_0x265370[0x0][_0x5b79('0x65')]('(')+0x1,_0x265370[0x0][_0x5b79('0x65')](')'));var _0x382115=_0x265370[0x1];channels[_0x5964c4[_0x5b79('0x12')]][_0x5616b4]=_0x382115;}if(!_[_0x5b79('0x66')](['hangup','noop','execif',_0x5b79('0x61'),'gotoif'],_0x5964c4[_0x5b79('0x5e')][_0x5b79('0x60')]())){channels[_0x5964c4[_0x5b79('0x12')]]['lastapplication']=_0x5964c4['application'];channels[_0x5964c4[_0x5b79('0x12')]][_0x5b79('0x50')]=_0x5964c4[_0x5b79('0x5f')];}}}catch(_0x2acb24){utils[_0x5b79('0x1e')](util['format'](_0x5b79('0x5c'),_0x5964c4[_0x5b79('0x12')]),_0x2acb24);}}; \ No newline at end of file +var _0xd692=['xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','context','exten','calleridnum','DOCUMENTATION','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','now','disposition','toNumber','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd692,0x1c7));var _0x2d69=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd692[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2d69('0x0'));var util=require(_0x2d69('0x1'));var utils=require(_0x2d69('0x2'));var dispositions=[_0x2d69('0x3'),_0x2d69('0x4'),_0x2d69('0x4'),_0x2d69('0x3'),_0x2d69('0x3'),_0x2d69('0x3'),'ANSWERED','BUSY','FAILED',_0x2d69('0x4'),_0x2d69('0x4')];var channels={};function writeDB(_0x4c95f6){utils['info'](util[_0x2d69('0x5')](_0x2d69('0x6'),_0x4c95f6[_0x2d69('0x7')],_0x4c95f6[_0x2d69('0x8')],_0x4c95f6[_0x2d69('0x9')],_0x4c95f6[_0x2d69('0xa')],_0x4c95f6[_0x2d69('0xb')],_0x4c95f6['calleridnum'],_0x4c95f6[_0x2d69('0xc')],_0x4c95f6[_0x2d69('0xd')]));if(_0x4c95f6[_0x2d69('0xe')]){utils['getUserByInternal'](_0x4c95f6['accountcode'])['then'](function(_0x51685a){if(_0x51685a){_0x4c95f6['UserId']=_0x51685a['id'];}utils[_0x2d69('0xf')](_0x2d69('0x10'),_0x4c95f6);});}else{utils['request']('CreateVoiceCallReport',_0x4c95f6);}if(channels[_0x4c95f6[_0x2d69('0x7')]]){delete channels[_0x4c95f6['uniqueid']];}}exports[_0x2d69('0x11')]=function(_0x43c489){try{utils['debug'](util[_0x2d69('0x5')]('[%s][calls][newchannel]',_0x43c489[_0x2d69('0x7')]),_0x43c489);if(_0x43c489[_0x2d69('0x7')]==_0x43c489[_0x2d69('0x12')]&&_0x43c489['channel']!=_0x2d69('0x13')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x43c489[_0x2d69('0x7')],_0x43c489[_0x2d69('0x14')],_0x43c489[_0x2d69('0x15')]));channels[_0x43c489[_0x2d69('0x7')]]={'uniqueid':_0x43c489[_0x2d69('0x7')],'accountcode':_0x43c489['accountcode'],'source':_0x43c489[_0x2d69('0x16')],'destination':_0x43c489['exten'],'destinationcontext':_0x43c489[_0x2d69('0x14')],'channel':_0x43c489[_0x2d69('0x8')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2d69('0x3'),'amaflags':_0x2d69('0x17')};}}catch(_0x2084c3){utils['error'](util[_0x2d69('0x5')](_0x2d69('0x18'),_0x43c489['uniqueid']),_0x2084c3);}};exports['newstate']=function(_0x1da106){try{utils['debug'](util['format'](_0x2d69('0x19'),_0x1da106[_0x2d69('0x7')]),_0x1da106);if(!_[_0x2d69('0x1a')](channels[_0x1da106['uniqueid']])&&_0x1da106[_0x2d69('0x1b')]==0x6){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x1d'),_0x1da106[_0x2d69('0x7')],_0x1da106[_0x2d69('0x14')],_0x1da106[_0x2d69('0x8')]));if(_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x7')]][_0x2d69('0x1e')])){channels[_0x1da106[_0x2d69('0x7')]][_0x2d69('0x1e')]=utils['now']();}}else if(!_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x12')]])&&_0x1da106['channelstate']==0x6&&_0x1da106['context']!=_0x2d69('0x1f')){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x20'),_0x1da106[_0x2d69('0x7')],_0x1da106[_0x2d69('0x12')],_0x1da106[_0x2d69('0x14')],_0x1da106['channel']));channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0xe')]=_0x1da106[_0x2d69('0xe')];channels[_0x1da106[_0x2d69('0x12')]]['destinationchannel']=_0x1da106[_0x2d69('0x8')];if(_[_0x2d69('0x1a')](channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0x21')])){channels[_0x1da106[_0x2d69('0x12')]][_0x2d69('0x21')]=utils[_0x2d69('0x22')]();}channels[_0x1da106['linkedid']][_0x2d69('0x23')]=dispositions[_[_0x2d69('0x24')](_0x1da106[_0x2d69('0x1b')])]||'ANSWERED';}}catch(_0x1e7717){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x19'),_0x1da106[_0x2d69('0x7')]),_0x1e7717);}};exports[_0x2d69('0x26')]=function(_0x98ddbc){try{if(!_[_0x2d69('0x1a')](channels[_0x98ddbc[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x28'),_0x98ddbc[_0x2d69('0x7')]),_0x98ddbc);if(_[_0x2d69('0x1a')](channels[_0x98ddbc['uniqueid']][_0x2d69('0x29')])){channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x29')]=_0x98ddbc[_0x2d69('0x2a')]+'\x20<'+_0x98ddbc[_0x2d69('0x16')]+'>';}utils['info'](util[_0x2d69('0x5')](_0x2d69('0x2b'),_0x98ddbc[_0x2d69('0x7')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x29')],_0x98ddbc[_0x2d69('0x2c')]));channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2d')]=utils[_0x2d69('0x22')]();channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2e')]=utils['diffTime'](channels[_0x98ddbc['uniqueid']][_0x2d69('0x2d')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2f')]);channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x30')]=channels[_0x98ddbc['uniqueid']][_0x2d69('0x21')]?utils[_0x2d69('0x31')](channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x2d')],channels[_0x98ddbc[_0x2d69('0x7')]][_0x2d69('0x21')]):0x0;writeDB(channels[_0x98ddbc[_0x2d69('0x7')]]);}}catch(_0x53b76f){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x28'),_0x98ddbc[_0x2d69('0x7')]),_0x53b76f);}};exports[_0x2d69('0x32')]=function(_0x4b8cfd){try{if(!_[_0x2d69('0x1a')](channels[_0x4b8cfd[_0x2d69('0x33')]])){utils['debug'](util[_0x2d69('0x5')](_0x2d69('0x34'),_0x4b8cfd[_0x2d69('0x35')]),_0x4b8cfd);if(channels[_0x4b8cfd['localtwolinkedid']][_0x2d69('0x8')]==_0x4b8cfd[_0x2d69('0x36')]){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b8cfd[_0x2d69('0x35')],_0x4b8cfd[_0x2d69('0x33')],_0x4b8cfd['secondtransfererchannel']));channels[_0x4b8cfd[_0x2d69('0x33')]]['destinationchannel']=_0x4b8cfd[_0x2d69('0x37')];channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x38')]=_0x2d69('0x39');}else if(channels[_0x4b8cfd['localtwolinkedid']][_0x2d69('0x8')]=_0x4b8cfd[_0x2d69('0x3a')]){utils[_0x2d69('0x1c')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b8cfd['origtransfereruniqueid'],_0x4b8cfd['localtwolinkedid'],_0x4b8cfd[_0x2d69('0x3b')]));channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x3c')]=_0x4b8cfd[_0x2d69('0x3b')];channels[_0x4b8cfd[_0x2d69('0x33')]][_0x2d69('0x38')]=_0x2d69('0x39');}}}catch(_0x2386db){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x34'),_0x4b8cfd[_0x2d69('0x35')]),_0x2386db);}};exports[_0x2d69('0x3d')]=function(_0x2842b1){try{if(!_['isNil'](channels[_0x2842b1[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x3e'),_0x2842b1[_0x2d69('0x7')]),_0x2842b1);channels[_0x2842b1[_0x2d69('0x7')]][_0x2d69('0x3f')]=utils[_0x2d69('0x22')]();utils['info'](util[_0x2d69('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2842b1[_0x2d69('0x7')],channels[_0x2842b1[_0x2d69('0x7')]][_0x2d69('0x3f')]));}}catch(_0x522748){utils[_0x2d69('0x25')](util[_0x2d69('0x5')]('[%s][calls][musiconholdstart]',_0x2842b1[_0x2d69('0x7')]),_0x522748);}};exports[_0x2d69('0x40')]=function(_0x13ae34){try{if(!_[_0x2d69('0x1a')](channels[_0x13ae34['uniqueid']])){utils['debug'](util[_0x2d69('0x5')]('[%s][calls][musiconholdstop]',_0x13ae34[_0x2d69('0x7')]),_0x13ae34);if(!_[_0x2d69('0x1a')](channels[_0x13ae34[_0x2d69('0x7')]][_0x2d69('0x3f')])){channels[_0x13ae34[_0x2d69('0x7')]]['mohtime']+=utils[_0x2d69('0x31')](utils['now'](),channels[_0x13ae34[_0x2d69('0x7')]][_0x2d69('0x3f')]);utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x41'),_0x13ae34[_0x2d69('0x7')],channels[_0x13ae34['uniqueid']][_0x2d69('0x42')]));delete channels[_0x13ae34[_0x2d69('0x7')]]['musiconholdstartAt'];}}}catch(_0x2e37f7){utils[_0x2d69('0x25')](util[_0x2d69('0x5')]('[%s][calls][musiconholdstop]',_0x13ae34['uniqueid']),_0x2e37f7);}};exports[_0x2d69('0x43')]=function(_0x1fd3e3){try{if(!_[_0x2d69('0x1a')](channels[_0x1fd3e3[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x44'),_0x1fd3e3[_0x2d69('0x7')]),_0x1fd3e3);if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x46')])){utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x47'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x49')]=_0x1fd3e3[_0x2d69('0x48')];}if(!_['isNil'](_0x1fd3e3['variable']['xmd-phone'])){utils[_0x2d69('0x1c')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x4a')]=_0x1fd3e3[_0x2d69('0x48')];channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x29')]='\x22'+_0x1fd3e3['value']+_0x2d69('0x4b')+_0x1fd3e3[_0x2d69('0x48')]+'>';}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')]['xmd-callerid-preview'])||!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4c')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x4d'),_0x1fd3e3[_0x2d69('0x7')],!_['isNil'](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4e')])?'xmd-callerid-preview':_0x2d69('0x4c'),_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['callerid']=_0x1fd3e3['value'];}if(!_['isNil'](_0x1fd3e3['variable']['xmd-queue'])||!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x4f')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x4d'),_0x1fd3e3[_0x2d69('0x7')],!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x50')])?_0x2d69('0x50'):'xmcs-queue',_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3['uniqueid']][_0x2d69('0x51')]=_0x2d69('0x52');channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x53')]=_0x1fd3e3['value'];channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x9')]=!![];}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')]['xmd-contactid'])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x54'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['ContactId']=_0x1fd3e3['value'];}if(!_[_0x2d69('0x1a')](_0x1fd3e3[_0x2d69('0x45')][_0x2d69('0x55')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x56'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3['value']));channels[_0x1fd3e3['uniqueid']][_0x2d69('0x57')]=_0x1fd3e3['value'];}if(!_[_0x2d69('0x1a')](_0x1fd3e3['variable'][_0x2d69('0x58')])){utils[_0x2d69('0x1c')](util['format'](_0x2d69('0x59'),_0x1fd3e3[_0x2d69('0x7')],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]][_0x2d69('0x5a')]=_0x1fd3e3[_0x2d69('0x48')];}if(!_[_0x2d69('0x1a')](_0x1fd3e3['variable'][_0x2d69('0x5b')])){utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x5c'),_0x1fd3e3['uniqueid'],_0x1fd3e3[_0x2d69('0x48')]));channels[_0x1fd3e3[_0x2d69('0x7')]]['sipcallid']=_0x1fd3e3[_0x2d69('0x48')];}}}catch(_0x495b99){utils[_0x2d69('0x25')](util[_0x2d69('0x5')](_0x2d69('0x44'),_0x1fd3e3[_0x2d69('0x7')]),_0x495b99);}};exports['newexten']=function(_0x310aa1){try{if(!_['isNil'](channels[_0x310aa1[_0x2d69('0x7')]])){utils[_0x2d69('0x27')](util[_0x2d69('0x5')](_0x2d69('0x5d'),_0x310aa1[_0x2d69('0x7')]),_0x310aa1);utils[_0x2d69('0x1c')](util[_0x2d69('0x5')](_0x2d69('0x5e'),_0x310aa1[_0x2d69('0x7')],_0x310aa1[_0x2d69('0x5f')],_0x310aa1[_0x2d69('0x60')]));if(_0x310aa1['application'][_0x2d69('0x61')]()=='set'&&_[_0x2d69('0x62')](_0x310aa1['appdata'][_0x2d69('0x61')](),'cdr')){var _0x1795e2=_0x310aa1[_0x2d69('0x60')][_0x2d69('0x63')]('=');var _0x56becc=_0x1795e2[0x0][_0x2d69('0x64')](_0x1795e2[0x0][_0x2d69('0x65')]('(')+0x1,_0x1795e2[0x0][_0x2d69('0x65')](')'));var _0x513499=_0x1795e2[0x1];channels[_0x310aa1[_0x2d69('0x7')]][_0x56becc]=_0x513499;}if(!_[_0x2d69('0x66')](['hangup',_0x2d69('0x67'),_0x2d69('0x68'),_0x2d69('0x69'),_0x2d69('0x6a')],_0x310aa1['application']['toLowerCase']())){channels[_0x310aa1['uniqueid']][_0x2d69('0x51')]=_0x310aa1[_0x2d69('0x5f')];channels[_0x310aa1[_0x2d69('0x7')]]['lastdata']=_0x310aa1['appdata'];}}}catch(_0x5e2535){utils[_0x2d69('0x25')](util['format'](_0x2d69('0x5d'),_0x310aa1[_0x2d69('0x7')]),_0x5e2535);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2374b86..ecd1aab 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 _0x9a14=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','close','[core]\x20close'];(function(_0x5b79c9,_0x22e9de){var _0xa357ab=function(_0x3e400e){while(--_0x3e400e){_0x5b79c9['push'](_0x5b79c9['shift']());}};_0xa357ab(++_0x22e9de);}(_0x9a14,0xa8));var _0x49a1=function(_0x541a2f,_0x511248){_0x541a2f=_0x541a2f-0x0;var _0x13bf4c=_0x9a14[_0x541a2f];return _0x13bf4c;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x49a1('0x0')](_0x49a1('0x1'));};exports[_0x49a1('0x2')]=function(){utils[_0x49a1('0x0')](_0x49a1('0x3'));};exports[_0x49a1('0x4')]=function(){utils[_0x49a1('0x0')](_0x49a1('0x5'));};exports['error']=function(_0x5634c4){utils['error']('[core]\x20error',_0x5634c4);};exports[_0x49a1('0x6')]=function(){utils[_0x49a1('0x0')](_0x49a1('0x7'));};exports['managerevent']=function(_0x6c66e){}; \ No newline at end of file +var _0x64f1=['connect','info','[core]\x20connected','shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils'];(function(_0x352711,_0x4262e6){var _0x46f0f3=function(_0x110fdd){while(--_0x110fdd){_0x352711['push'](_0x352711['shift']());}};_0x46f0f3(++_0x4262e6);}(_0x64f1,0x153));var _0x164f=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x64f1[_0x29d623];return _0x242e59;};'use strict';var utils=require(_0x164f('0x0'));exports[_0x164f('0x1')]=function(){utils[_0x164f('0x2')](_0x164f('0x3'));};exports[_0x164f('0x4')]=function(){utils[_0x164f('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x164f('0x2')](_0x164f('0x5'));};exports[_0x164f('0x6')]=function(_0x35c704){utils[_0x164f('0x6')](_0x164f('0x7'),_0x35c704);};exports[_0x164f('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0x164f('0x9')]=function(_0x353c61){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index cba7935..41cce74 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 _0xc481=['[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','value','isNil','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','duration','diffTime','endtime','billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug'];(function(_0x78c618,_0x532586){var _0x3a4fcf=function(_0x381234){while(--_0x381234){_0x78c618['push'](_0x78c618['shift']());}};_0x3a4fcf(++_0x532586);}(_0xc481,0x16a));var _0x1c48=function(_0x3871d7,_0x3cfcc5){_0x3871d7=_0x3871d7-0x0;var _0x28ec09=_0xc481[_0x3871d7];return _0x28ec09;};'use strict';var _=require(_0x1c48('0x0'));var util=require('util');var utils=require(_0x1c48('0x1'));var dials={};function writeDB(_0x478801){utils['info'](util[_0x1c48('0x2')](_0x1c48('0x3'),_0x478801[_0x1c48('0x4')],_0x478801[_0x1c48('0x5')],_0x478801[_0x1c48('0x6')],_0x478801[_0x1c48('0x7')],_0x478801[_0x1c48('0x8')],_0x478801[_0x1c48('0x9')]));utils[_0x1c48('0xa')](_0x1c48('0xb'),_0x478801);delete dials[_0x478801[_0x1c48('0x4')]];}exports[_0x1c48('0xc')]=function(_0x5ee09f){try{utils[_0x1c48('0xd')](util[_0x1c48('0x2')](_0x1c48('0xe'),_0x5ee09f['uniqueid']),_0x5ee09f);utils[_0x1c48('0xf')](util[_0x1c48('0x2')](_0x1c48('0x10'),_0x5ee09f[_0x1c48('0x4')],_0x5ee09f['application'],_0x5ee09f['appdata']));if(_0x5ee09f[_0x1c48('0x11')][_0x1c48('0x12')]()==_0x1c48('0x13')&&_[_0x1c48('0x14')](_0x5ee09f[_0x1c48('0x15')][_0x1c48('0x12')](),_0x1c48('0x16'))){var _0x5d3631=_0x5ee09f[_0x1c48('0x15')][_0x1c48('0x17')]('=');dials[_0x5ee09f[_0x1c48('0x4')]]={'routeId':_0x5d3631[0x1]};}}catch(_0x5ee636){utils[_0x1c48('0x18')](util[_0x1c48('0x2')](_0x1c48('0xe'),_0x5ee09f[_0x1c48('0x4')]),_0x5ee636);}};exports[_0x1c48('0x19')]=function(_0x5f1dd8){try{utils['debug'](util[_0x1c48('0x2')](_0x1c48('0x1a'),_0x5f1dd8[_0x1c48('0x4')]),_0x5f1dd8);if(!_['isNil'](_0x5f1dd8[_0x1c48('0x1b')]['outboundrouteid'])){utils[_0x1c48('0xf')](util[_0x1c48('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5f1dd8[_0x1c48('0x4')],_0x5f1dd8[_0x1c48('0x1c')]));dials[_0x5f1dd8[_0x1c48('0x4')]]={'routeId':_0x5f1dd8['value']};}}catch(_0x351bf1){utils[_0x1c48('0x18')](util[_0x1c48('0x2')](_0x1c48('0x1a'),_0x5f1dd8[_0x1c48('0x4')]),_0x351bf1);}};exports['dialbegin']=function(_0x18690c){try{if(!_[_0x1c48('0x1d')](dials[_0x18690c[_0x1c48('0x4')]])){utils[_0x1c48('0xd')](util[_0x1c48('0x2')]('[%s][dials][dialbegin]',_0x18690c[_0x1c48('0x4')]),_0x18690c);dials[_0x18690c['uniqueid']]=_[_0x1c48('0x1e')](dials[_0x18690c[_0x1c48('0x4')]],_0x18690c);dials[_0x18690c[_0x1c48('0x4')]][_0x1c48('0x1f')]=utils[_0x1c48('0x20')]();dials[_0x18690c[_0x1c48('0x4')]][_0x1c48('0x21')]='called';utils[_0x1c48('0xf')](util[_0x1c48('0x2')](_0x1c48('0x22'),_0x18690c[_0x1c48('0x4')],dials[_0x18690c['uniqueid']][_0x1c48('0x1f')]));}}catch(_0x5b9914){utils[_0x1c48('0x18')](util['format']('[%s][dials][dialbegin]',_0x18690c[_0x1c48('0x4')]),_0x5b9914);}};exports['dialend']=function(_0x39456d){try{if(!_[_0x1c48('0x1d')](dials[_0x39456d[_0x1c48('0x4')]])){utils['debug'](util[_0x1c48('0x2')](_0x1c48('0x23'),_0x39456d[_0x1c48('0x4')]),_0x39456d);dials[_0x39456d['uniqueid']][_0x1c48('0x9')]=_0x39456d[_0x1c48('0x9')];if(_0x39456d[_0x1c48('0x9')]==_0x1c48('0x24')){dials[_0x39456d['uniqueid']]=_[_0x1c48('0x1e')](dials[_0x39456d[_0x1c48('0x4')]],_0x39456d);dials[_0x39456d[_0x1c48('0x4')]][_0x1c48('0x25')]=utils['now']();dials[_0x39456d[_0x1c48('0x4')]][_0x1c48('0x21')]=_0x1c48('0x26');utils[_0x1c48('0xf')](util[_0x1c48('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x39456d['uniqueid'],_0x39456d[_0x1c48('0x9')],dials[_0x39456d['uniqueid']]['answertime']));}else{utils[_0x1c48('0xf')](util['format'](_0x1c48('0x27'),_0x39456d[_0x1c48('0x4')],_0x39456d[_0x1c48('0x9')]));}}}catch(_0x25c988){utils[_0x1c48('0x18')](util[_0x1c48('0x2')](_0x1c48('0x23'),_0x39456d[_0x1c48('0x4')]),_0x25c988);}};exports[_0x1c48('0x28')]=function(_0x943f2b){try{if(!_['isNil'](dials[_0x943f2b['uniqueid']])){utils[_0x1c48('0xd')](util['format'](_0x1c48('0x29'),_0x943f2b[_0x1c48('0x4')]),_0x943f2b);utils[_0x1c48('0xf')](util[_0x1c48('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x943f2b['uniqueid'],_0x943f2b[_0x1c48('0x7')],_0x943f2b[_0x1c48('0x2a')],_0x943f2b['cause-txt']));dials[_0x943f2b[_0x1c48('0x4')]]=_['assign'](dials[_0x943f2b[_0x1c48('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x2b')]=utils[_0x1c48('0x2c')](dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x2d')],dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x1f')]);dials[_0x943f2b[_0x1c48('0x4')]]['holdtime']=utils['diffTime'](dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x25')]||dials[_0x943f2b[_0x1c48('0x4')]]['endtime'],dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x1f')]);dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x2e')]=dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x25')]?utils[_0x1c48('0x2c')](dials[_0x943f2b[_0x1c48('0x4')]][_0x1c48('0x2d')],dials[_0x943f2b['uniqueid']][_0x1c48('0x25')]):0x0;writeDB(dials[_0x943f2b[_0x1c48('0x4')]]);}}catch(_0x21865f){utils[_0x1c48('0x18')](util['format'](_0x1c48('0x29'),_0x943f2b[_0x1c48('0x4')]),_0x21865f);}}; \ No newline at end of file +var _0xd177=['holdtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0xaa0e2,_0x3aa20f){var _0x19a563=function(_0x2314c7){while(--_0x2314c7){_0xaa0e2['push'](_0xaa0e2['shift']());}};_0x19a563(++_0x3aa20f);}(_0xd177,0x1c4));var _0x7d17=function(_0x51b02d,_0x23dd0b){_0x51b02d=_0x51b02d-0x0;var _0x26f769=_0xd177[_0x51b02d];return _0x26f769;};'use strict';var _=require(_0x7d17('0x0'));var util=require(_0x7d17('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5d27c2){utils['info'](util[_0x7d17('0x2')](_0x7d17('0x3'),_0x5d27c2[_0x7d17('0x4')],_0x5d27c2[_0x7d17('0x5')],_0x5d27c2['dialstring'],_0x5d27c2[_0x7d17('0x6')],_0x5d27c2['connectedlinenum'],_0x5d27c2[_0x7d17('0x7')]));utils[_0x7d17('0x8')](_0x7d17('0x9'),_0x5d27c2);delete dials[_0x5d27c2[_0x7d17('0x4')]];}exports[_0x7d17('0xa')]=function(_0x3b25b4){try{utils[_0x7d17('0xb')](util[_0x7d17('0x2')]('[%s][dials][newexten]',_0x3b25b4[_0x7d17('0x4')]),_0x3b25b4);utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0xd'),_0x3b25b4[_0x7d17('0x4')],_0x3b25b4['application'],_0x3b25b4['appdata']));if(_0x3b25b4['application'][_0x7d17('0xe')]()==_0x7d17('0xf')&&_[_0x7d17('0x10')](_0x3b25b4['appdata']['toLowerCase'](),_0x7d17('0x11'))){var _0x3aedcb=_0x3b25b4[_0x7d17('0x12')][_0x7d17('0x13')]('=');dials[_0x3b25b4[_0x7d17('0x4')]]={'routeId':_0x3aedcb[0x1]};}}catch(_0x563fb6){utils[_0x7d17('0x14')](util['format']('[%s][dials][newexten]',_0x3b25b4[_0x7d17('0x4')]),_0x563fb6);}};exports[_0x7d17('0x15')]=function(_0x4b8932){try{utils[_0x7d17('0xb')](util['format'](_0x7d17('0x16'),_0x4b8932['uniqueid']),_0x4b8932);if(!_[_0x7d17('0x17')](_0x4b8932[_0x7d17('0x18')][_0x7d17('0x19')])){utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x1a'),_0x4b8932[_0x7d17('0x4')],_0x4b8932[_0x7d17('0x1b')]));dials[_0x4b8932[_0x7d17('0x4')]]={'routeId':_0x4b8932['value']};}}catch(_0x3ec6e1){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x16'),_0x4b8932[_0x7d17('0x4')]),_0x3ec6e1);}};exports[_0x7d17('0x1c')]=function(_0x42242e){try{if(!_[_0x7d17('0x17')](dials[_0x42242e[_0x7d17('0x4')]])){utils['debug'](util['format'](_0x7d17('0x1d'),_0x42242e[_0x7d17('0x4')]),_0x42242e);dials[_0x42242e[_0x7d17('0x4')]]=_[_0x7d17('0x1e')](dials[_0x42242e['uniqueid']],_0x42242e);dials[_0x42242e['uniqueid']][_0x7d17('0x1f')]=utils[_0x7d17('0x20')]();dials[_0x42242e[_0x7d17('0x4')]]['lastevent']='called';utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x21'),_0x42242e['uniqueid'],dials[_0x42242e[_0x7d17('0x4')]]['starttime']));}}catch(_0x4e5167){utils[_0x7d17('0x14')](util['format']('[%s][dials][dialbegin]',_0x42242e[_0x7d17('0x4')]),_0x4e5167);}};exports[_0x7d17('0x22')]=function(_0x50c911){try{if(!_[_0x7d17('0x17')](dials[_0x50c911[_0x7d17('0x4')]])){utils[_0x7d17('0xb')](util[_0x7d17('0x2')](_0x7d17('0x23'),_0x50c911[_0x7d17('0x4')]),_0x50c911);dials[_0x50c911[_0x7d17('0x4')]]['dialstatus']=_0x50c911[_0x7d17('0x7')];if(_0x50c911['dialstatus']==_0x7d17('0x24')){dials[_0x50c911[_0x7d17('0x4')]]=_[_0x7d17('0x1e')](dials[_0x50c911['uniqueid']],_0x50c911);dials[_0x50c911[_0x7d17('0x4')]][_0x7d17('0x25')]=utils[_0x7d17('0x20')]();dials[_0x50c911[_0x7d17('0x4')]][_0x7d17('0x26')]='connect';utils[_0x7d17('0xc')](util[_0x7d17('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x50c911[_0x7d17('0x4')],_0x50c911[_0x7d17('0x7')],dials[_0x50c911['uniqueid']][_0x7d17('0x25')]));}else{utils[_0x7d17('0xc')](util[_0x7d17('0x2')](_0x7d17('0x27'),_0x50c911['uniqueid'],_0x50c911['dialstatus']));}}}catch(_0x2c4f28){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x23'),_0x50c911[_0x7d17('0x4')]),_0x2c4f28);}};exports[_0x7d17('0x28')]=function(_0x20fc5c){try{if(!_[_0x7d17('0x17')](dials[_0x20fc5c['uniqueid']])){utils[_0x7d17('0xb')](util[_0x7d17('0x2')](_0x7d17('0x29'),_0x20fc5c['uniqueid']),_0x20fc5c);utils[_0x7d17('0xc')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x20fc5c[_0x7d17('0x4')],_0x20fc5c[_0x7d17('0x6')],_0x20fc5c[_0x7d17('0x2a')],_0x20fc5c[_0x7d17('0x2b')]));dials[_0x20fc5c[_0x7d17('0x4')]]=_['assign'](dials[_0x20fc5c['uniqueid']],{'endtime':utils[_0x7d17('0x20')](),'lastevent':_0x7d17('0x2c')});dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x2d')]=utils[_0x7d17('0x2e')](dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x2f')],dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x1f')]);dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x30')]=utils[_0x7d17('0x2e')](dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]||dials[_0x20fc5c[_0x7d17('0x4')]]['endtime'],dials[_0x20fc5c['uniqueid']][_0x7d17('0x1f')]);dials[_0x20fc5c[_0x7d17('0x4')]][_0x7d17('0x31')]=dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]?utils[_0x7d17('0x2e')](dials[_0x20fc5c['uniqueid']]['endtime'],dials[_0x20fc5c['uniqueid']][_0x7d17('0x25')]):0x0;writeDB(dials[_0x20fc5c[_0x7d17('0x4')]]);}}catch(_0x366a37){utils[_0x7d17('0x14')](util[_0x7d17('0x2')](_0x7d17('0x29'),_0x20fc5c[_0x7d17('0x4')]),_0x366a37);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e70d3ad..bbc79a0 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 _0x08dc=['keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','local','port','asterisk','username'];(function(_0x4fcfbe,_0x107dc6){var _0x50b203=function(_0x3a9083){while(--_0x3a9083){_0x4fcfbe['push'](_0x4fcfbe['shift']());}};_0x50b203(++_0x107dc6);}(_0x08dc,0x189));var _0xc08d=function(_0x4f47b1,_0x5c2351){_0x4f47b1=_0x4f47b1-0x0;var _0xf8cf26=_0x08dc[_0x4f47b1];return _0xf8cf26;};var AsteriskManager=require(_0xc08d('0x0'));var config=require('../../config/environment');var utils=require(_0xc08d('0x1'));var util=require(_0xc08d('0x2'));var isXDREnabled=config[_0xc08d('0x3')]&&config[_0xc08d('0x3')]['disabled']?!config[_0xc08d('0x3')][_0xc08d('0x4')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0xc08d('0x3')][_0xc08d('0x5')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xc08d('0x6')],config[_0xc08d('0x7')]['ip'],config['asterisk'][_0xc08d('0x8')],config[_0xc08d('0x7')]['password'],!![]);ami[_0xc08d('0x9')]();if(!isXDREnabled){utils[_0xc08d('0xa')](_0xc08d('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc08d('0xa')](_0xc08d('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0xc08d('0xd'));var queues=require(_0xc08d('0xe'));var recordings=require(_0xc08d('0xf'));var members=require(_0xc08d('0x10'));var dials=require(_0xc08d('0x11'));var transfers=require(_0xc08d('0x12'));var core=require('./core.controller');ami['on'](_0xc08d('0x13'),core[_0xc08d('0x13')]);ami['on'](_0xc08d('0x14'),core[_0xc08d('0x14')]);ami['on'](_0xc08d('0x15'),core['fullybooted']);ami['on'](_0xc08d('0x16'),core[_0xc08d('0x16')]);ami['on'](_0xc08d('0x17'),core['close']);ami['on'](_0xc08d('0x18'),core['managerevent']);ami['on'](_0xc08d('0x19'),function(_0x5c5fba){try{utils['debug'](util[_0xc08d('0x1a')](_0xc08d('0x1b'),_0x5c5fba[_0xc08d('0x1c')]),_0x5c5fba);members[_0xc08d('0x19')](_0x5c5fba);}catch(_0x549d88){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')]('[%s][index][devicestatechange]',_0x5c5fba[_0xc08d('0x1c')]),_0x549d88);}});ami['on'](_0xc08d('0x1d'),function(_0x5dabec){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x1f'),_0x5dabec['uniqueid']),_0x5dabec);agents['agentcalled'](_0x5dabec);}catch(_0x1eef8f){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')]('[%s][index][agentcalled]',_0x5dabec[_0xc08d('0x20')]),_0x1eef8f);}});ami['on'](_0xc08d('0x21'),function(_0x324b3d){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x22'),_0x324b3d[_0xc08d('0x20')]),_0x324b3d);agents[_0xc08d('0x21')](_0x324b3d);}catch(_0x394fa7){utils[_0xc08d('0x16')](util['format'](_0xc08d('0x22'),_0x324b3d['uniqueid']),_0x394fa7);}});ami['on'](_0xc08d('0x23'),function(_0x50cc96){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')]('[%s][index][agentconnect]',_0x50cc96[_0xc08d('0x20')]),_0x50cc96);agents[_0xc08d('0x23')](_0x50cc96);queues[_0xc08d('0x23')](_0x50cc96);}catch(_0x3c0334){utils[_0xc08d('0x16')](util['format'](_0xc08d('0x24'),_0x50cc96['uniqueid']),_0x3c0334);}});ami['on']('agentcomplete',function(_0x3dde34){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x25'),_0x3dde34[_0xc08d('0x20')]),_0x3dde34);agents[_0xc08d('0x26')](_0x3dde34);queues[_0xc08d('0x26')](_0x3dde34);members[_0xc08d('0x26')](_0x3dde34);}catch(_0x17d2a6){utils[_0xc08d('0x16')](util['format'](_0xc08d('0x25'),_0x3dde34['uniqueid']),_0x17d2a6);}});ami['on'](_0xc08d('0x27'),function(_0x2ef2af){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x28'),_0x2ef2af[_0xc08d('0x20')]),_0x2ef2af);agents[_0xc08d('0x27')](_0x2ef2af);queues[_0xc08d('0x27')](_0x2ef2af);}catch(_0x1dce08){utils['error'](util[_0xc08d('0x1a')]('[%s][index][queuecallerabandon]',_0x2ef2af['uniqueid']),_0x1dce08);}});ami['on']('queuecallerjoin',function(_0x361b6b){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')]('[%s][index][queuecallerjoin]',_0x361b6b[_0xc08d('0x20')]),_0x361b6b);queues[_0xc08d('0x29')](_0x361b6b);recordings['queuecallerjoin'](_0x361b6b);}catch(_0x1c9a22){utils[_0xc08d('0x16')](util['format'](_0xc08d('0x2a'),_0x361b6b[_0xc08d('0x20')]),_0x1c9a22);}});ami['on'](_0xc08d('0x2b'),function(_0x3c61b2){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x2c'),_0x3c61b2['uniqueid']),_0x3c61b2);queues[_0xc08d('0x2b')](_0x3c61b2);}catch(_0x1c2836){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')](_0xc08d('0x2c'),_0x3c61b2[_0xc08d('0x20')]),_0x1c2836);}});ami['on']('musiconholdstart',function(_0x153f16){try{utils['debug'](util[_0xc08d('0x1a')]('[%s][index][musiconholdstart]',_0x153f16[_0xc08d('0x20')]),_0x153f16);queues[_0xc08d('0x2d')](_0x153f16);calls[_0xc08d('0x2d')](_0x153f16);}catch(_0x1e2e25){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')]('[%s][index][musiconholdstart]',_0x153f16[_0xc08d('0x20')]),_0x1e2e25);}});ami['on'](_0xc08d('0x2e'),function(_0x16c66c){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')]('[%s][index][musiconholdstop]',_0x16c66c['uniqueid']),_0x16c66c);queues[_0xc08d('0x2e')](_0x16c66c);calls['musiconholdstop'](_0x16c66c);}catch(_0x1d537e){utils[_0xc08d('0x16')](util['format']('[%s][index][musiconholdstop]',_0x16c66c['uniqueid']),_0x1d537e);}});ami['on'](_0xc08d('0x2f'),function(_0xebf16){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x30'),_0xebf16['uniqueid']),_0xebf16);calls[_0xc08d('0x2f')](_0xebf16);recordings[_0xc08d('0x2f')](_0xebf16);}catch(_0x135543){utils['error'](util[_0xc08d('0x1a')](_0xc08d('0x30'),_0xebf16[_0xc08d('0x20')]),_0x135543);}});ami['on'](_0xc08d('0x31'),function(_0x25f42f){try{utils['debug'](util['format']('[%s][index][hangup]',_0x25f42f[_0xc08d('0x20')]),_0x25f42f);calls[_0xc08d('0x31')](_0x25f42f);recordings[_0xc08d('0x31')](_0x25f42f);dials['hangup'](_0x25f42f);agents[_0xc08d('0x31')](_0x25f42f);queues[_0xc08d('0x31')](_0x25f42f);}catch(_0x348451){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')](_0xc08d('0x32'),_0x25f42f['uniqueid']),_0x348451);}});ami['on'](_0xc08d('0x33'),function(_0x50c8b3){try{utils[_0xc08d('0x1e')](util['format'](_0xc08d('0x34'),_0x50c8b3[_0xc08d('0x20')]),_0x50c8b3);members[_0xc08d('0x33')](_0x50c8b3);}catch(_0x425acd){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')]('[%s][index][cdr]',_0x50c8b3[_0xc08d('0x20')]),_0x425acd);}});ami['on'](_0xc08d('0x35'),function(_0x12c403){try{utils[_0xc08d('0x1e')](util['format'](_0xc08d('0x36'),_0x12c403['uniqueid']),_0x12c403);queues[_0xc08d('0x35')](_0x12c403);agents[_0xc08d('0x35')](_0x12c403);transfers[_0xc08d('0x35')](_0x12c403);}catch(_0x17ca7a){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')]('[%s][index][blindtransfer]',_0x12c403[_0xc08d('0x20')]),_0x17ca7a);}});ami['on'](_0xc08d('0x37'),function(_0x2e14a0){try{utils['debug'](util[_0xc08d('0x1a')](_0xc08d('0x38'),_0x2e14a0['origtransfereruniqueid']),_0x2e14a0);queues[_0xc08d('0x37')](_0x2e14a0);transfers['attendedtransfer'](_0x2e14a0);agents[_0xc08d('0x37')](_0x2e14a0);calls[_0xc08d('0x37')](_0x2e14a0);}catch(_0xe05d3){utils[_0xc08d('0x16')](util['format'](_0xc08d('0x38'),_0x2e14a0[_0xc08d('0x39')]),_0xe05d3);}});ami['on'](_0xc08d('0x3a'),function(_0x5ab2f0){try{utils['debug'](util[_0xc08d('0x1a')]('[%s][index][varset]',_0x5ab2f0[_0xc08d('0x20')]),_0x5ab2f0);queues[_0xc08d('0x3a')](_0x5ab2f0);recordings['varset'](_0x5ab2f0);calls['varset'](_0x5ab2f0);dials[_0xc08d('0x3a')](_0x5ab2f0);}catch(_0x31b249){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')](_0xc08d('0x3b'),_0x5ab2f0['uniqueid']),_0x31b249);}});ami['on']('newexten',function(_0x3ca434){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')]('[%s][index][newexten]',_0x3ca434['uniqueid']),_0x3ca434);calls[_0xc08d('0x3c')](_0x3ca434);recordings['newexten'](_0x3ca434);dials[_0xc08d('0x3c')](_0x3ca434);}catch(_0x567e35){utils[_0xc08d('0x16')](util['format']('[%s][index][newexten]',_0x3ca434[_0xc08d('0x20')]),_0x567e35);}});ami['on'](_0xc08d('0x3d'),function(_0x4bee29){try{utils['debug'](util['format'](_0xc08d('0x3e'),_0x4bee29[_0xc08d('0x20')]),_0x4bee29);calls[_0xc08d('0x3d')](_0x4bee29);recordings['newchannel'](_0x4bee29);}catch(_0x55e71d){utils['error'](util[_0xc08d('0x1a')]('[%s][index][newchannel]',_0x4bee29[_0xc08d('0x20')]),_0x55e71d);}});ami['on'](_0xc08d('0x3f'),function(_0x1c3099){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')](_0xc08d('0x40'),_0x1c3099[_0xc08d('0x20')]),_0x1c3099);dials[_0xc08d('0x3f')](_0x1c3099);}catch(_0xf07ef0){utils['error'](util[_0xc08d('0x1a')]('[%s]dialbegin',_0x1c3099[_0xc08d('0x20')]),_0xf07ef0);}});ami['on'](_0xc08d('0x41'),function(_0x17f9ce){try{utils[_0xc08d('0x1e')](util[_0xc08d('0x1a')]('[%s][index][dialend]',_0x17f9ce[_0xc08d('0x20')]),_0x17f9ce);dials['dialend'](_0x17f9ce);}catch(_0x3c6aa6){utils[_0xc08d('0x16')](util[_0xc08d('0x1a')](_0xc08d('0x42'),_0x17f9ce[_0xc08d('0x20')]),_0x3c6aa6);}});} \ No newline at end of file +var _0xfbe6=['production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','debug','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','disabled','xdr','env'];(function(_0x554a48,_0x3b0b29){var _0x4cd1dc=function(_0x420dff){while(--_0x420dff){_0x554a48['push'](_0x554a48['shift']());}};_0x4cd1dc(++_0x3b0b29);}(_0xfbe6,0x16b));var _0x6fbe=function(_0x2c1b1c,_0x5e9c8e){_0x2c1b1c=_0x2c1b1c-0x0;var _0x1520fb=_0xfbe6[_0x2c1b1c];return _0x1520fb;};var AsteriskManager=require(_0x6fbe('0x0'));var config=require(_0x6fbe('0x1'));var utils=require(_0x6fbe('0x2'));var util=require(_0x6fbe('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0x6fbe('0x4')]?!config[_0x6fbe('0x5')]['disabled']:!![];var isProduction=config[_0x6fbe('0x6')]===_0x6fbe('0x7')||![];var isLocalAsterisk=config[_0x6fbe('0x5')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x6fbe('0x8')][_0x6fbe('0x9')],config[_0x6fbe('0x8')]['ip'],config['asterisk'][_0x6fbe('0xa')],config[_0x6fbe('0x8')][_0x6fbe('0xb')],!![]);ami[_0x6fbe('0xc')]();if(!isXDREnabled){utils[_0x6fbe('0xd')](_0x6fbe('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6fbe('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6fbe('0xf'));var calls=require(_0x6fbe('0x10'));var queues=require(_0x6fbe('0x11'));var recordings=require(_0x6fbe('0x12'));var members=require(_0x6fbe('0x13'));var dials=require(_0x6fbe('0x14'));var transfers=require(_0x6fbe('0x15'));var core=require(_0x6fbe('0x16'));ami['on'](_0x6fbe('0x17'),core[_0x6fbe('0x17')]);ami['on']('shutdown',core[_0x6fbe('0x18')]);ami['on'](_0x6fbe('0x19'),core['fullybooted']);ami['on'](_0x6fbe('0x1a'),core[_0x6fbe('0x1a')]);ami['on'](_0x6fbe('0x1b'),core[_0x6fbe('0x1b')]);ami['on'](_0x6fbe('0x1c'),core['managerevent']);ami['on'](_0x6fbe('0x1d'),function(_0x15129e){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x1f'),_0x15129e[_0x6fbe('0x20')]),_0x15129e);members[_0x6fbe('0x1d')](_0x15129e);}catch(_0x4246d9){utils['error'](util['format']('[%s][index][devicestatechange]',_0x15129e[_0x6fbe('0x20')]),_0x4246d9);}});ami['on'](_0x6fbe('0x21'),function(_0x5b7a2f){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x22'),_0x5b7a2f[_0x6fbe('0x23')]),_0x5b7a2f);agents[_0x6fbe('0x21')](_0x5b7a2f);}catch(_0x41e232){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x22'),_0x5b7a2f[_0x6fbe('0x23')]),_0x41e232);}});ami['on']('agentringnoanswer',function(_0x4eaf29){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x25'),_0x4eaf29['uniqueid']),_0x4eaf29);agents[_0x6fbe('0x26')](_0x4eaf29);}catch(_0x1d4b9c){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x25'),_0x4eaf29['uniqueid']),_0x1d4b9c);}});ami['on'](_0x6fbe('0x27'),function(_0x4aa2cf){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x28'),_0x4aa2cf[_0x6fbe('0x23')]),_0x4aa2cf);agents[_0x6fbe('0x27')](_0x4aa2cf);queues['agentconnect'](_0x4aa2cf);}catch(_0x2e8a55){utils[_0x6fbe('0x1a')](util['format']('[%s][index][agentconnect]',_0x4aa2cf[_0x6fbe('0x23')]),_0x2e8a55);}});ami['on'](_0x6fbe('0x29'),function(_0x68fa01){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][agentcomplete]',_0x68fa01[_0x6fbe('0x23')]),_0x68fa01);agents['agentcomplete'](_0x68fa01);queues[_0x6fbe('0x29')](_0x68fa01);members[_0x6fbe('0x29')](_0x68fa01);}catch(_0x2f9ec0){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x2a'),_0x68fa01[_0x6fbe('0x23')]),_0x2f9ec0);}});ami['on'](_0x6fbe('0x2b'),function(_0x54a6a9){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x2c'),_0x54a6a9[_0x6fbe('0x23')]),_0x54a6a9);agents[_0x6fbe('0x2b')](_0x54a6a9);queues[_0x6fbe('0x2b')](_0x54a6a9);}catch(_0x27c26e){utils['error'](util[_0x6fbe('0x1e')](_0x6fbe('0x2c'),_0x54a6a9[_0x6fbe('0x23')]),_0x27c26e);}});ami['on'](_0x6fbe('0x2d'),function(_0x24d671){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x2e'),_0x24d671[_0x6fbe('0x23')]),_0x24d671);queues[_0x6fbe('0x2d')](_0x24d671);recordings[_0x6fbe('0x2d')](_0x24d671);}catch(_0x47b29b){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x2e'),_0x24d671[_0x6fbe('0x23')]),_0x47b29b);}});ami['on'](_0x6fbe('0x2f'),function(_0x3849b4){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][queuecallerleave]',_0x3849b4[_0x6fbe('0x23')]),_0x3849b4);queues['queuecallerleave'](_0x3849b4);}catch(_0x421a94){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x30'),_0x3849b4[_0x6fbe('0x23')]),_0x421a94);}});ami['on'](_0x6fbe('0x31'),function(_0x191218){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x32'),_0x191218[_0x6fbe('0x23')]),_0x191218);queues[_0x6fbe('0x31')](_0x191218);calls['musiconholdstart'](_0x191218);}catch(_0x596e12){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x32'),_0x191218[_0x6fbe('0x23')]),_0x596e12);}});ami['on']('musiconholdstop',function(_0x6a906b){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x33'),_0x6a906b[_0x6fbe('0x23')]),_0x6a906b);queues[_0x6fbe('0x34')](_0x6a906b);calls[_0x6fbe('0x34')](_0x6a906b);}catch(_0x9e4139){utils[_0x6fbe('0x1a')](util['format']('[%s][index][musiconholdstop]',_0x6a906b['uniqueid']),_0x9e4139);}});ami['on']('newstate',function(_0x5351dc){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')](_0x6fbe('0x35'),_0x5351dc[_0x6fbe('0x23')]),_0x5351dc);calls[_0x6fbe('0x36')](_0x5351dc);recordings[_0x6fbe('0x36')](_0x5351dc);}catch(_0x2b66e7){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x35'),_0x5351dc[_0x6fbe('0x23')]),_0x2b66e7);}});ami['on']('hangup',function(_0x5f104e){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x37'),_0x5f104e['uniqueid']),_0x5f104e);calls[_0x6fbe('0x38')](_0x5f104e);recordings['hangup'](_0x5f104e);dials[_0x6fbe('0x38')](_0x5f104e);agents[_0x6fbe('0x38')](_0x5f104e);queues[_0x6fbe('0x38')](_0x5f104e);}catch(_0x445dc2){utils[_0x6fbe('0x1a')](util['format'](_0x6fbe('0x37'),_0x5f104e[_0x6fbe('0x23')]),_0x445dc2);}});ami['on'](_0x6fbe('0x39'),function(_0x1d6dc4){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][cdr]',_0x1d6dc4['uniqueid']),_0x1d6dc4);members['cdr'](_0x1d6dc4);}catch(_0x2786d8){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3a'),_0x1d6dc4[_0x6fbe('0x23')]),_0x2786d8);}});ami['on'](_0x6fbe('0x3b'),function(_0x2d06ad){try{utils['debug'](util[_0x6fbe('0x1e')](_0x6fbe('0x3c'),_0x2d06ad[_0x6fbe('0x23')]),_0x2d06ad);queues['blindtransfer'](_0x2d06ad);agents[_0x6fbe('0x3b')](_0x2d06ad);transfers[_0x6fbe('0x3b')](_0x2d06ad);}catch(_0x474717){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3c'),_0x2d06ad[_0x6fbe('0x23')]),_0x474717);}});ami['on'](_0x6fbe('0x3d'),function(_0x4941ef){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][attendedtransfer]',_0x4941ef[_0x6fbe('0x3e')]),_0x4941ef);queues[_0x6fbe('0x3d')](_0x4941ef);transfers[_0x6fbe('0x3d')](_0x4941ef);agents['attendedtransfer'](_0x4941ef);calls[_0x6fbe('0x3d')](_0x4941ef);}catch(_0x12fc7c){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x3f'),_0x4941ef['origtransfereruniqueid']),_0x12fc7c);}});ami['on'](_0x6fbe('0x40'),function(_0x491b8c){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x41'),_0x491b8c[_0x6fbe('0x23')]),_0x491b8c);queues[_0x6fbe('0x40')](_0x491b8c);recordings['varset'](_0x491b8c);calls[_0x6fbe('0x40')](_0x491b8c);dials[_0x6fbe('0x40')](_0x491b8c);}catch(_0x5bfb62){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')]('[%s][index][varset]',_0x491b8c['uniqueid']),_0x5bfb62);}});ami['on'](_0x6fbe('0x42'),function(_0x11ad6d){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][newexten]',_0x11ad6d[_0x6fbe('0x23')]),_0x11ad6d);calls[_0x6fbe('0x42')](_0x11ad6d);recordings[_0x6fbe('0x42')](_0x11ad6d);dials[_0x6fbe('0x42')](_0x11ad6d);}catch(_0x24f9e0){utils['error'](util[_0x6fbe('0x1e')](_0x6fbe('0x43'),_0x11ad6d[_0x6fbe('0x23')]),_0x24f9e0);}});ami['on'](_0x6fbe('0x44'),function(_0x4d5e0c){try{utils[_0x6fbe('0x24')](util['format'](_0x6fbe('0x45'),_0x4d5e0c[_0x6fbe('0x23')]),_0x4d5e0c);calls[_0x6fbe('0x44')](_0x4d5e0c);recordings[_0x6fbe('0x44')](_0x4d5e0c);}catch(_0xc68ea4){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')]('[%s][index][newchannel]',_0x4d5e0c[_0x6fbe('0x23')]),_0xc68ea4);}});ami['on'](_0x6fbe('0x46'),function(_0x4d2098){try{utils[_0x6fbe('0x24')](util[_0x6fbe('0x1e')]('[%s][index][dialbegin]',_0x4d2098[_0x6fbe('0x23')]),_0x4d2098);dials['dialbegin'](_0x4d2098);}catch(_0x575fa5){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x47'),_0x4d2098[_0x6fbe('0x23')]),_0x575fa5);}});ami['on']('dialend',function(_0x5bba1b){try{utils[_0x6fbe('0x24')](util['format']('[%s][index][dialend]',_0x5bba1b[_0x6fbe('0x23')]),_0x5bba1b);dials[_0x6fbe('0x48')](_0x5bba1b);}catch(_0x2cad1a){utils[_0x6fbe('0x1a')](util[_0x6fbe('0x1e')](_0x6fbe('0x49'),_0x5bba1b[_0x6fbe('0x23')]),_0x2cad1a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 03511c8..4425540 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 _0x4764=['queue','cdr','[%s][members][cdr]','assign','data1','type','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','data3','lodash','util','./utils','Local/_attended@transfer','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x2facd6,_0x2aaf16){var _0x4fbcb0=function(_0x4a8838){while(--_0x4a8838){_0x2facd6['push'](_0x2facd6['shift']());}};_0x4fbcb0(++_0x2aaf16);}(_0x4764,0x14f));var _0x4476=function(_0x3af2ef,_0x26148c){_0x3af2ef=_0x3af2ef-0x0;var _0x30cc83=_0x4764[_0x3af2ef];return _0x30cc83;};'use strict';var _=require(_0x4476('0x0'));var util=require(_0x4476('0x1'));var utils=require(_0x4476('0x2'));var members={};var exclude=[_0x4476('0x3'),'Queue:'];function writeDB(_0x2f80ec){utils[_0x4476('0x4')](util['format'](_0x4476('0x5'),_0x2f80ec[_0x4476('0x6')],_0x2f80ec[_0x4476('0x7')],_0x2f80ec[_0x4476('0x8')],_0x2f80ec[_0x4476('0x9')],_0x2f80ec[_0x4476('0xa')],_0x2f80ec['type']));if(_0x2f80ec[_0x4476('0x7')]){utils[_0x4476('0xb')](_0x2f80ec['interface'])[_0x4476('0xc')](function(_0x12c3ce){if(_0x12c3ce){_0x2f80ec[_0x4476('0xa')]=_0x12c3ce[_0x4476('0xd')];_0x2f80ec[_0x4476('0xe')]=_0x12c3ce[_0x4476('0xe')];utils['request'](_0x4476('0xf'),_0x2f80ec);}else{utils[_0x4476('0x10')](_0x2f80ec[_0x4476('0x7')][_0x4476('0x11')]('/')[0x1])[_0x4476('0xc')](function(_0x587a03){if(_0x587a03){_0x2f80ec['membername']=_0x587a03[_0x4476('0xd')];_0x2f80ec[_0x4476('0xe')]=_0x587a03[_0x4476('0xe')];utils[_0x4476('0x12')]('CreateMemberReport',_0x2f80ec);}});}})[_0x4476('0x13')](function(_0x14f901){utils[_0x4476('0x14')](util['format'](_0x4476('0x15'),_0x2f80ec['uniqueid']),_0x14f901);});}delete members[_0x2f80ec[_0x4476('0x7')]];}function startsWith(_0x4de81a,_0x2c3a83){return _[_0x4476('0x16')](_0x4de81a,function(_0x219793){return _[_0x4476('0x17')](_0x2c3a83,_0x219793);});}exports[_0x4476('0x18')]=function(_0x6748f){try{utils[_0x4476('0x19')](util[_0x4476('0x1a')](_0x4476('0x1b'),members[_0x6748f[_0x4476('0x1c')]]?members[_0x6748f['device']][_0x4476('0x6')]:_0x6748f[_0x4476('0x1c')]),_0x6748f);utils[_0x4476('0x4')](util[_0x4476('0x1a')](_0x4476('0x1d'),members[_0x6748f[_0x4476('0x1c')]]?members[_0x6748f[_0x4476('0x1c')]][_0x4476('0x6')]:_0x6748f[_0x4476('0x1c')],_0x6748f[_0x4476('0x1e')],_0x6748f[_0x4476('0x1c')]));switch(_0x6748f['state']){case _0x4476('0x1f'):case _0x4476('0x20'):if(!startsWith(exclude,_0x6748f[_0x4476('0x1c')])){members[_0x6748f['device']]={'channel':_0x4476('0x21'),'interface':_0x6748f[_0x4476('0x1c')],'type':_0x4476('0x22'),'enterAt':utils['now'](),'role':_0x4476('0x23')};}break;case _0x4476('0x24'):if(!_[_0x4476('0x25')](members[_0x6748f[_0x4476('0x1c')]])){members[_0x6748f[_0x4476('0x1c')]]['exitAt']=utils['now']();members[_0x6748f[_0x4476('0x1c')]]['duration']=utils[_0x4476('0x26')](members[_0x6748f[_0x4476('0x1c')]][_0x4476('0x27')],members[_0x6748f[_0x4476('0x1c')]][_0x4476('0x28')]);if(members[_0x6748f['device']][_0x4476('0x6')]){writeDB(members[_0x6748f[_0x4476('0x1c')]]);}}break;default:break;}}catch(_0x9f7bec){utils[_0x4476('0x14')](util[_0x4476('0x1a')]('[%s][members][devicestatechange]',members[_0x6748f[_0x4476('0x1c')]]?members[_0x6748f[_0x4476('0x1c')]][_0x4476('0x6')]:_0x6748f[_0x4476('0x1c')]),_0x9f7bec);}};exports[_0x4476('0x29')]=function(_0x57ed6f){try{if(!_[_0x4476('0x25')](members[_0x57ed6f['interface']])){utils[_0x4476('0x19')](util[_0x4476('0x1a')]('[%s][members][agentcomplete]',_0x57ed6f[_0x4476('0x6')]),_0x57ed6f);utils[_0x4476('0x4')](util[_0x4476('0x1a')](_0x4476('0x2a'),_0x57ed6f['uniqueid'],_0x57ed6f['interface'],_0x57ed6f[_0x4476('0x2b')]));members[_0x57ed6f[_0x4476('0x7')]]=_['assign'](members[_0x57ed6f['interface']],{'data4':_0x57ed6f[_0x4476('0x2b')],'uniqueid':_0x57ed6f['uniqueid']});}}catch(_0x5b675b){utils[_0x4476('0x14')](util[_0x4476('0x1a')]('[%s][members][agentcomplete]',_0x57ed6f[_0x4476('0x6')]),_0x5b675b);}};exports[_0x4476('0x2c')]=function(_0x53a694){try{utils[_0x4476('0x19')](util[_0x4476('0x1a')](_0x4476('0x2d'),_0x53a694[_0x4476('0x6')]),_0x53a694);if(_0x53a694[_0x4476('0x8')]){var _0x3b2c1b=_0x53a694['channel'][_0x4476('0x11')]('-')[0x0];if(!_[_0x4476('0x25')](members[_0x3b2c1b])){members[_0x3b2c1b]=_[_0x4476('0x2e')](members[_0x3b2c1b],{'data1':members[_0x3b2c1b][_0x4476('0x2f')]||_0x53a694[_0x4476('0x30')],'data2':members[_0x3b2c1b]['data2']||_0x53a694['source'],'data3':members[_0x3b2c1b]['data3']||_0x53a694[_0x4476('0x31')],'uniqueid':members[_0x3b2c1b][_0x4476('0x6')]||_0x53a694['uniqueid']});utils[_0x4476('0x4')](util['format'](_0x4476('0x32'),_0x53a694[_0x4476('0x6')],members[_0x3b2c1b]['data1'],members[_0x3b2c1b][_0x4476('0x9')],members[_0x3b2c1b]['data3']));if(members[_0x3b2c1b][_0x4476('0x27')]){writeDB(members[_0x3b2c1b]);}}}if(_0x53a694[_0x4476('0x33')]){var _0x4ed86e=_0x53a694[_0x4476('0x33')]['split']('-')[0x0];if(!_[_0x4476('0x25')](members[_0x4ed86e])){members[_0x4ed86e]=_[_0x4476('0x2e')](members[_0x4ed86e],{'data1':members[_0x4ed86e][_0x4476('0x2f')]||_0x53a694[_0x4476('0x30')],'data2':members[_0x4ed86e][_0x4476('0x9')]||_0x53a694[_0x4476('0x34')],'data3':members[_0x4ed86e][_0x4476('0x35')]||_0x53a694[_0x4476('0x31')],'uniqueid':members[_0x4ed86e][_0x4476('0x6')]||_0x53a694[_0x4476('0x6')]});utils[_0x4476('0x4')](util[_0x4476('0x1a')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x53a694[_0x4476('0x6')],members[_0x4ed86e][_0x4476('0x2f')],members[_0x4ed86e][_0x4476('0x9')],members[_0x4ed86e][_0x4476('0x35')]));if(members[_0x4ed86e]['exitAt']){writeDB(members[_0x4ed86e]);}}}}catch(_0x4082fe){utils[_0x4476('0x14')](util['format'](_0x4476('0x2d'),_0x53a694[_0x4476('0x6')]),_0x4082fe);}}; \ No newline at end of file +var _0x2cbd=['diffTime','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data3','destinationchannel','source','destination','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','interface','split','CreateMemberReport','error','uniqueid','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x2cbd[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var utils=require('./utils');var members={};var exclude=[_0xd2cb('0x2'),_0xd2cb('0x3')];function writeDB(_0x138022){utils['info'](util[_0xd2cb('0x4')](_0xd2cb('0x5'),_0x138022['uniqueid'],_0x138022['interface'],_0x138022[_0xd2cb('0x6')],_0x138022[_0xd2cb('0x7')],_0x138022[_0xd2cb('0x8')],_0x138022[_0xd2cb('0x9')]));if(_0x138022['interface']){utils[_0xd2cb('0xa')](_0x138022['interface'])[_0xd2cb('0xb')](function(_0x5e3bec){if(_0x5e3bec){_0x138022[_0xd2cb('0x8')]=_0x5e3bec[_0xd2cb('0xc')];_0x138022['internal']=_0x5e3bec[_0xd2cb('0xd')];utils[_0xd2cb('0xe')]('CreateMemberReport',_0x138022);}else{utils[_0xd2cb('0xf')](_0x138022[_0xd2cb('0x10')][_0xd2cb('0x11')]('/')[0x1])[_0xd2cb('0xb')](function(_0x51a1b6){if(_0x51a1b6){_0x138022['membername']=_0x51a1b6[_0xd2cb('0xc')];_0x138022[_0xd2cb('0xd')]=_0x51a1b6[_0xd2cb('0xd')];utils[_0xd2cb('0xe')](_0xd2cb('0x12'),_0x138022);}});}})['catch'](function(_0x3d6e2c){utils[_0xd2cb('0x13')](util[_0xd2cb('0x4')]('[%s][members][writeDB]',_0x138022[_0xd2cb('0x14')]),_0x3d6e2c);});}delete members[_0x138022[_0xd2cb('0x10')]];}function startsWith(_0x501e19,_0x33538d){return _['some'](_0x501e19,function(_0x4e02f7){return _[_0xd2cb('0x15')](_0x33538d,_0x4e02f7);});}exports[_0xd2cb('0x16')]=function(_0x1a24ac){try{utils[_0xd2cb('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac[_0xd2cb('0x18')]]['uniqueid']:_0x1a24ac[_0xd2cb('0x18')]),_0x1a24ac);utils[_0xd2cb('0x19')](util[_0xd2cb('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac['device']]['uniqueid']:_0x1a24ac[_0xd2cb('0x18')],_0x1a24ac[_0xd2cb('0x1a')],_0x1a24ac[_0xd2cb('0x18')]));switch(_0x1a24ac['state']){case _0xd2cb('0x1b'):case _0xd2cb('0x1c'):if(!startsWith(exclude,_0x1a24ac[_0xd2cb('0x18')])){members[_0x1a24ac[_0xd2cb('0x18')]]={'channel':_0xd2cb('0x1d'),'interface':_0x1a24ac[_0xd2cb('0x18')],'type':_0xd2cb('0x1e'),'enterAt':utils[_0xd2cb('0x1f')](),'role':'agent'};}break;case _0xd2cb('0x20'):if(!_[_0xd2cb('0x21')](members[_0x1a24ac['device']])){members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x22')]=utils[_0xd2cb('0x1f')]();members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x23')]=utils[_0xd2cb('0x24')](members[_0x1a24ac['device']][_0xd2cb('0x22')],members[_0x1a24ac['device']]['enterAt']);if(members[_0x1a24ac['device']][_0xd2cb('0x14')]){writeDB(members[_0x1a24ac[_0xd2cb('0x18')]]);}}break;default:break;}}catch(_0x35ac19){utils[_0xd2cb('0x13')](util['format'](_0xd2cb('0x25'),members[_0x1a24ac[_0xd2cb('0x18')]]?members[_0x1a24ac[_0xd2cb('0x18')]][_0xd2cb('0x14')]:_0x1a24ac[_0xd2cb('0x18')]),_0x35ac19);}};exports[_0xd2cb('0x26')]=function(_0x27926d){try{if(!_[_0xd2cb('0x21')](members[_0x27926d[_0xd2cb('0x10')]])){utils[_0xd2cb('0x17')](util['format'](_0xd2cb('0x27'),_0x27926d[_0xd2cb('0x14')]),_0x27926d);utils['info'](util[_0xd2cb('0x4')](_0xd2cb('0x28'),_0x27926d[_0xd2cb('0x14')],_0x27926d[_0xd2cb('0x10')],_0x27926d['queue']));members[_0x27926d['interface']]=_[_0xd2cb('0x29')](members[_0x27926d[_0xd2cb('0x10')]],{'data4':_0x27926d[_0xd2cb('0x2a')],'uniqueid':_0x27926d[_0xd2cb('0x14')]});}}catch(_0x416c40){utils['error'](util[_0xd2cb('0x4')](_0xd2cb('0x27'),_0x27926d[_0xd2cb('0x14')]),_0x416c40);}};exports[_0xd2cb('0x2b')]=function(_0x17715d){try{utils[_0xd2cb('0x17')](util[_0xd2cb('0x4')](_0xd2cb('0x2c'),_0x17715d['uniqueid']),_0x17715d);if(_0x17715d[_0xd2cb('0x6')]){var _0x4df591=_0x17715d[_0xd2cb('0x6')][_0xd2cb('0x11')]('-')[0x0];if(!_[_0xd2cb('0x21')](members[_0x4df591])){members[_0x4df591]=_[_0xd2cb('0x29')](members[_0x4df591],{'data1':members[_0x4df591][_0xd2cb('0x2d')]||_0x17715d[_0xd2cb('0x9')],'data2':members[_0x4df591][_0xd2cb('0x7')]||_0x17715d['source'],'data3':members[_0x4df591][_0xd2cb('0x2e')]||_0x17715d['destination'],'uniqueid':members[_0x4df591]['uniqueid']||_0x17715d[_0xd2cb('0x14')]});utils[_0xd2cb('0x19')](util[_0xd2cb('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x17715d[_0xd2cb('0x14')],members[_0x4df591]['data1'],members[_0x4df591][_0xd2cb('0x7')],members[_0x4df591]['data3']));if(members[_0x4df591]['exitAt']){writeDB(members[_0x4df591]);}}}if(_0x17715d[_0xd2cb('0x2f')]){var _0x11b54e=_0x17715d[_0xd2cb('0x2f')][_0xd2cb('0x11')]('-')[0x0];if(!_[_0xd2cb('0x21')](members[_0x11b54e])){members[_0x11b54e]=_[_0xd2cb('0x29')](members[_0x11b54e],{'data1':members[_0x11b54e][_0xd2cb('0x2d')]||_0x17715d['type'],'data2':members[_0x11b54e]['data2']||_0x17715d[_0xd2cb('0x30')],'data3':members[_0x11b54e][_0xd2cb('0x2e')]||_0x17715d[_0xd2cb('0x31')],'uniqueid':members[_0x11b54e][_0xd2cb('0x14')]||_0x17715d[_0xd2cb('0x14')]});utils['info'](util[_0xd2cb('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x17715d['uniqueid'],members[_0x11b54e][_0xd2cb('0x2d')],members[_0x11b54e]['data2'],members[_0x11b54e][_0xd2cb('0x2e')]));if(members[_0x11b54e][_0xd2cb('0x22')]){writeDB(members[_0x11b54e]);}}}}catch(_0x5647b8){utils[_0xd2cb('0x13')](util[_0xd2cb('0x4')](_0xd2cb('0x2c'),_0x17715d[_0xd2cb('0x14')]),_0x5647b8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0c73c1b..ba28b64 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 _0x871c=['variable','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','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','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','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','transferuniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','transfereduniqueid','queuecallerjoin','debug','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset'];(function(_0x52c8f8,_0x5b141b){var _0x3193ba=function(_0x294319){while(--_0x294319){_0x52c8f8['push'](_0x52c8f8['shift']());}};_0x3193ba(++_0x5b141b);}(_0x871c,0x113));var _0xc871=function(_0x7ee11f,_0x304236){_0x7ee11f=_0x7ee11f-0x0;var _0x2d13b7=_0x871c[_0x7ee11f];return _0x2d13b7;};'use strict';var _=require(_0xc871('0x0'));var util=require('util');var utils=require(_0xc871('0x1'));var queues={};function writeDB(_0x1be5bd){utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x4'),_0x1be5bd[_0xc871('0x5')],_0x1be5bd[_0xc871('0x6')],_0x1be5bd[_0xc871('0x7')],_0x1be5bd[_0xc871('0x8')],_0x1be5bd[_0xc871('0x9')],_0x1be5bd['accountcode'],_0x1be5bd[_0xc871('0xa')]));if(_0x1be5bd[_0xc871('0x7')]){utils[_0xc871('0xb')](_0x1be5bd[_0xc871('0x7')])[_0xc871('0xc')](function(_0x5a4815){if(_0x5a4815){_0x1be5bd[_0xc871('0xd')]=_0x5a4815[_0xc871('0xd')];}utils['request']('CreateVoiceQueueReport',_0x1be5bd);});}else{utils['request']('CreateVoiceQueueReport',_0x1be5bd);}if(_0x1be5bd[_0xc871('0xe')]){delete queues[_0x1be5bd[_0xc871('0xe')]];}else{delete queues[_0x1be5bd[_0xc871('0x5')]];}}exports[_0xc871('0xf')]=function(_0x34599b){try{utils[_0xc871('0x10')](util[_0xc871('0x3')]('[%s][queues][queuecallerjoin]',_0x34599b['uniqueid']),_0x34599b);utils[_0xc871('0x2')](util[_0xc871('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x34599b[_0xc871('0x5')],_0x34599b[_0xc871('0x7')],_0x34599b[_0xc871('0x11')]));queues[_0x34599b[_0xc871('0x5')]]=_[_0xc871('0x12')](_0x34599b,{'originalposition':_0x34599b[_0xc871('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4a52ad){utils[_0xc871('0x13')](util['format'](_0xc871('0x14'),_0x34599b[_0xc871('0x5')]),_0x4a52ad);}};exports[_0xc871('0x15')]=function(_0x43df5f){try{if(!_[_0xc871('0x16')](queues[_0x43df5f[_0xc871('0x5')]])){utils['debug'](util[_0xc871('0x3')]('[%s][queues][hangup]',_0x43df5f[_0xc871('0x5')]),_0x43df5f);if(queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0x17')]){if(!queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0x18')]&&!queues[_0x43df5f[_0xc871('0x5')]]['queuecallerexit']){queues[_0x43df5f['uniqueid']][_0xc871('0x19')]=!![];queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0x1a')]=utils[_0xc871('0x1b')]();queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0xa')]=_0xc871('0x1c');}utils[_0xc871('0x2')](util[_0xc871('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x43df5f[_0xc871('0x5')],queues[_0x43df5f['uniqueid']][_0xc871('0x1d')],queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0xa')]));writeDB(queues[_0x43df5f[_0xc871('0x5')]]);}else if(queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0xe')]){utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x1e'),_0x43df5f[_0xc871('0x5')],queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0x1d')],queues[_0x43df5f['uniqueid']][_0xc871('0xe')]));queues[queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0xe')]]=queues[_0x43df5f[_0xc871('0x5')]];queues[queues[_0x43df5f[_0xc871('0x5')]][_0xc871('0xe')]][_0xc871('0x1f')]=0x2;delete queues[_0x43df5f[_0xc871('0x5')]];}}}catch(_0x5d18fa){utils[_0xc871('0x13')](util[_0xc871('0x3')](_0xc871('0x20'),_0x43df5f[_0xc871('0x5')]),_0x5d18fa);}};exports[_0xc871('0x21')]=function(_0x208788){try{utils['debug'](util[_0xc871('0x3')]('[%s][queues][varset]',_0x208788[_0xc871('0x5')]),_0x208788);if(!_[_0xc871('0x16')](_0x208788[_0xc871('0x22')]['queuestatus'])&&_0x208788[_0xc871('0x23')][_0xc871('0x24')]()!=='CONTINUE'){if(!_[_0xc871('0x16')](queues[_0x208788['uniqueid']])){queues[_0x208788[_0xc871('0x5')]]['queuecallerabandon']=![];queues[_0x208788[_0xc871('0x5')]][_0xc871('0x25')]=null;queues[_0x208788[_0xc871('0x5')]][_0xc871('0x26')]=!![];queues[_0x208788[_0xc871('0x5')]][_0xc871('0x27')]=utils[_0xc871('0x1b')]();queues[_0x208788[_0xc871('0x5')]][_0xc871('0xa')]=_0x208788[_0xc871('0x23')]['toUpperCase']();utils['info'](util[_0xc871('0x3')](_0xc871('0x28'),_0x208788['uniqueid'],queues[_0x208788[_0xc871('0x5')]][_0xc871('0x1d')],_0x208788[_0xc871('0x23')],queues[_0x208788[_0xc871('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x208788[_0xc871('0x5')]]);}}else if(!_[_0xc871('0x16')](_0x208788[_0xc871('0x22')][_0xc871('0x29')])){if(!_[_0xc871('0x16')](queues[_0x208788[_0xc871('0x5')]])&&!queues[_0x208788[_0xc871('0x5')]][_0xc871('0x18')]){queues[_0x208788['uniqueid']][_0xc871('0x18')]=![];queues[_0x208788[_0xc871('0x5')]][_0xc871('0x25')]=null;queues[_0x208788['uniqueid']][_0xc871('0x26')]=!![];queues[_0x208788[_0xc871('0x5')]][_0xc871('0x27')]=utils[_0xc871('0x1b')]();queues[_0x208788[_0xc871('0x5')]]['queuecallerexitreason']=_0xc871('0x2a');utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x2b'),_0x208788[_0xc871('0x5')],queues[_0x208788[_0xc871('0x5')]]['name'],_0x208788[_0xc871('0x23')],queues[_0x208788[_0xc871('0x5')]][_0xc871('0xa')]));}}}catch(_0x1744a5){utils[_0xc871('0x13')](util['format']('[%s][queues][varset]',_0x208788[_0xc871('0x5')]),_0x1744a5);}};exports[_0xc871('0x18')]=function(_0x185132){try{if(!_[_0xc871('0x16')](queues[_0x185132[_0xc871('0x5')]])){utils['debug'](util[_0xc871('0x3')](_0xc871('0x2c'),_0x185132[_0xc871('0x5')]),_0x185132);queues[_0x185132[_0xc871('0x5')]][_0xc871('0x26')]=![];queues[_0x185132['uniqueid']][_0xc871('0x27')]=null;queues[_0x185132[_0xc871('0x5')]][_0xc871('0x18')]=!![];queues[_0x185132[_0xc871('0x5')]][_0xc871('0x25')]=utils[_0xc871('0x1b')]();queues[_0x185132['uniqueid']]['queuecallerexitreason']=_0xc871('0x2d');utils[_0xc871('0x2')](util['format'](_0xc871('0x2e'),_0x185132['uniqueid'],queues[_0x185132['uniqueid']][_0xc871('0x1d')],queues[_0x185132[_0xc871('0x5')]][_0xc871('0xa')]));}}catch(_0x5181fc){utils['error'](util['format']('[%s][queues][queuecallerabandon]',_0x185132['uniqueid']),_0x5181fc);}};exports[_0xc871('0x2f')]=function(_0x2ecbd9){try{if(!_[_0xc871('0x16')](queues[_0x2ecbd9[_0xc871('0x5')]])){utils[_0xc871('0x10')](util['format'](_0xc871('0x30'),_0x2ecbd9[_0xc871('0x5')]),_0x2ecbd9);utils['info'](util['format'](_0xc871('0x31'),_0x2ecbd9[_0xc871('0x5')],queues[_0x2ecbd9['uniqueid']]['name'],_0x2ecbd9[_0xc871('0x32')],_0x2ecbd9[_0xc871('0x33')]));queues[_0x2ecbd9[_0xc871('0x5')]][_0xc871('0x2f')]=!![];queues[_0x2ecbd9[_0xc871('0x5')]]['queuecallerleaveAt']=utils[_0xc871('0x1b')]();queues[_0x2ecbd9[_0xc871('0x5')]][_0xc871('0x34')]=utils[_0xc871('0x35')](queues[_0x2ecbd9[_0xc871('0x5')]][_0xc871('0x17')],queues[_0x2ecbd9[_0xc871('0x5')]]['queuecallerjoinAt']);queues[_0x2ecbd9['uniqueid']][_0xc871('0x11')]=_0x2ecbd9[_0xc871('0x11')];queues[_0x2ecbd9[_0xc871('0x5')]][_0xc871('0x36')]=_0x2ecbd9['count'];queues[_0x2ecbd9[_0xc871('0x5')]][_0xc871('0x32')]=_0x2ecbd9[_0xc871('0x32')];queues[_0x2ecbd9['uniqueid']]['connectedlinename']=_0x2ecbd9[_0xc871('0x33')];}}catch(_0x29c763){utils[_0xc871('0x13')](util[_0xc871('0x3')](_0xc871('0x30'),_0x2ecbd9[_0xc871('0x5')]),_0x29c763);}};exports['agentconnect']=function(_0xf5102f){try{if(!_[_0xc871('0x16')](queues[_0xf5102f[_0xc871('0x5')]])){utils['debug'](util['format'](_0xc871('0x37'),_0xf5102f[_0xc871('0x5')]),_0xf5102f);utils[_0xc871('0x2')](util['format'](_0xc871('0x38'),_0xf5102f[_0xc871('0x5')],queues[_0xf5102f[_0xc871('0x5')]][_0xc871('0x1d')],_0xf5102f[_0xc871('0x39')],_0xf5102f[_0xc871('0x3a')]));queues[_0xf5102f['uniqueid']][_0xc871('0x18')]=![];queues[_0xf5102f[_0xc871('0x5')]][_0xc871('0x18')]=![];queues[_0xf5102f['uniqueid']][_0xc871('0x25')]=null;queues[_0xf5102f['uniqueid']][_0xc871('0x26')]=![];queues[_0xf5102f['uniqueid']][_0xc871('0xa')]=null;queues[_0xf5102f['uniqueid']][_0xc871('0x27')]=null;queues[_0xf5102f['uniqueid']][_0xc871('0x3b')]=!![];queues[_0xf5102f[_0xc871('0x5')]][_0xc871('0x3c')]=_0xf5102f[_0xc871('0x3a')];queues[_0xf5102f[_0xc871('0x5')]][_0xc871('0x8')]=_0xf5102f[_0xc871('0x39')];}}catch(_0x2220f1){utils[_0xc871('0x13')](util[_0xc871('0x3')]('[%s][queues][agentconnect]',_0xf5102f[_0xc871('0x5')]),_0x2220f1);}};exports[_0xc871('0x3d')]=function(_0xe452df){try{if(!_['isNil'](queues[_0xe452df['uniqueid']])){if(queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x17')]){utils[_0xc871('0x10')](util[_0xc871('0x3')]('[%s][queues][agentcomplete]',_0xe452df[_0xc871('0x5')]),_0xe452df);queues[_0xe452df['uniqueid']][_0xc871('0x18')]=![];queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x18')]=![];queues[_0xe452df['uniqueid']]['queuecallerabandonAt']=null;queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x26')]=![];queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x27')]=null;queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x3b')]=!![];queues[_0xe452df['uniqueid']][_0xc871('0x8')]=_0xe452df[_0xc871('0x39')];queues[_0xe452df[_0xc871('0x5')]]['queuecallercomplete']=!![];queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x1a')]=utils[_0xc871('0x1b')]();if(_0xe452df[_0xc871('0x3e')]==_0xc871('0x3f')){if(!queues[_0xe452df['uniqueid']][_0xc871('0x3f')]){queues[_0xe452df['uniqueid']][_0xc871('0xa')]='TRANSFER';}}else{queues[_0xe452df['uniqueid']]['queuecallerexitreason']=_0xc871('0x40')+_0xe452df[_0xc871('0x3e')][_0xc871('0x24')]();}utils['info'](util[_0xc871('0x3')](_0xc871('0x41'),_0xe452df[_0xc871('0x5')],queues[_0xe452df[_0xc871('0x5')]][_0xc871('0x1d')],_0xe452df['membername'],queues[_0xe452df['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0xe452df[_0xc871('0x5')]]);}}}catch(_0x2085e9){utils[_0xc871('0x13')](util[_0xc871('0x3')](_0xc871('0x42'),_0xe452df[_0xc871('0x5')]),_0x2085e9);}};exports[_0xc871('0x43')]=function(_0xc90083){try{if(!_[_0xc871('0x16')](queues[_0xc90083[_0xc871('0x44')]])){utils[_0xc871('0x10')](util['format'](_0xc871('0x45'),_0xc90083[_0xc871('0x5')]),_0xc90083);queues[_0xc90083[_0xc871('0x44')]][_0xc871('0x3f')]=!![];queues[_0xc90083[_0xc871('0x44')]][_0xc871('0x46')]=_0xc871('0x47');queues[_0xc90083[_0xc871('0x44')]]['transferexten']=_0xc90083[_0xc871('0x48')];queues[_0xc90083[_0xc871('0x44')]]['transferuniqueid']=_0xc90083[_0xc871('0x44')];queues[_0xc90083[_0xc871('0x44')]][_0xc871('0xa')]=_0xc871('0x49');utils['info'](util[_0xc871('0x3')](_0xc871('0x4a'),_0xc90083[_0xc871('0x5')],queues[_0xc90083['transfereeuniqueid']][_0xc871('0x1d')],_0xc90083[_0xc871('0x44')],_0xc90083[_0xc871('0x48')]));}}catch(_0x5ac8e4){utils[_0xc871('0x13')](util[_0xc871('0x3')](_0xc871('0x45'),_0xc90083['uniqueid']),_0x5ac8e4);}};exports['attendedtransfer']=function(_0x30eae0){try{utils[_0xc871('0x10')](util['format'](_0xc871('0x4b'),_0x30eae0[_0xc871('0x4c')]),_0x30eae0);if(_0x30eae0['origtransfereruniqueid']==_0x30eae0[_0xc871('0x4d')]){if(!_[_0xc871('0x16')](queues[_0x30eae0[_0xc871('0x4e')]])){utils['info'](util['format'](_0xc871('0x4f'),_0x30eae0[_0xc871('0x4c')],queues[_0x30eae0[_0xc871('0x4e')]][_0xc871('0x1d')],_0x30eae0[_0xc871('0x50')]));queues[_0x30eae0[_0xc871('0x4e')]]['transfer']=!![];queues[_0x30eae0[_0xc871('0x4e')]][_0xc871('0x46')]=_0xc871('0x51');queues[_0x30eae0['secondtransfererlinkedid']][_0xc871('0x52')]=_0x30eae0['origtransfererexten'];queues[_0x30eae0[_0xc871('0x4e')]]['transferuniqueid']=_0x30eae0[_0xc871('0x4c')];queues[_0x30eae0['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xc871('0x16')](queues[_0x30eae0[_0xc871('0x4d')]])){if(_0x30eae0[_0xc871('0x53')]&&queues[_0x30eae0[_0xc871('0x53')]]){queues[_0x30eae0['transfereelinkedid']][_0xc871('0x1f')]=0x1;queues[_0x30eae0[_0xc871('0x44')]]=_['clone'](queues[_0x30eae0[_0xc871('0x53')]]);queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0xe')]=_0x30eae0[_0xc871('0x54')];queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x1f')]=0x2;queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x9')]=queues[_0x30eae0[_0xc871('0x4e')]]['calleridnum'];queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x55')]=queues[_0x30eae0[_0xc871('0x4e')]][_0xc871('0x55')];queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x56')]=utils[_0xc871('0x1b')]();queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x17')]=utils[_0xc871('0x1b')]();queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x34')]=0x0;queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x57')]=0x0;utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x58'),_0x30eae0[_0xc871('0x4c')],queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x1d')],queues[_0x30eae0[_0xc871('0x44')]][_0xc871('0x9')],queues[_0x30eae0['transfereeuniqueid']][_0xc871('0x55')]));}else{utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x59'),_0x30eae0['origtransfereruniqueid'],queues[_0x30eae0[_0xc871('0x4d')]][_0xc871('0x1d')],_0x30eae0[_0xc871('0x4e')]));queues[_0x30eae0['origtransfererlinkedid']]['transfereduniqueid']=_0x30eae0[_0xc871('0x4e')];}}}else if(_0x30eae0[_0xc871('0x5a')]==_0x30eae0['secondtransfererlinkedid']){if(!_[_0xc871('0x16')](queues[_0x30eae0['origtransfererlinkedid']])){utils[_0xc871('0x2')](util['format'](_0xc871('0x5b'),_0x30eae0[_0xc871('0x4c')],queues[_0x30eae0[_0xc871('0x4d')]][_0xc871('0x1d')],_0x30eae0['secondtransfereruniqueid'],_0x30eae0[_0xc871('0x5c')]));queues[_0x30eae0['origtransfererlinkedid']][_0xc871('0x3f')]=!![];queues[_0x30eae0['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x30eae0['origtransfererlinkedid']][_0xc871('0x52')]=_0x30eae0[_0xc871('0x5c')];queues[_0x30eae0['origtransfererlinkedid']][_0xc871('0x5d')]=_0x30eae0[_0xc871('0x5a')];queues[_0x30eae0[_0xc871('0x4d')]][_0xc871('0xa')]=_0xc871('0x5e');}if(!_[_0xc871('0x16')](queues[_0x30eae0['secondtransfererlinkedid']])){if(_0x30eae0[_0xc871('0x5f')]&&queues[_0x30eae0[_0xc871('0x5f')]]){queues[_0x30eae0[_0xc871('0x5f')]][_0xc871('0x1f')]=0x1;queues[_0x30eae0[_0xc871('0x54')]]=_[_0xc871('0x60')](queues[_0x30eae0[_0xc871('0x5f')]]);queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0xe')]=_0x30eae0[_0xc871('0x54')];queues[_0x30eae0['transfertargetuniqueid']][_0xc871('0x1f')]=0x2;queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x9')]=queues[_0x30eae0['origtransfererlinkedid']][_0xc871('0x9')];queues[_0x30eae0[_0xc871('0x54')]]['calleridname']=queues[_0x30eae0[_0xc871('0x4d')]][_0xc871('0x55')];queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x56')]=utils[_0xc871('0x1b')]();queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x17')]=utils['now']();queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x34')]=0x0;queues[_0x30eae0['transfertargetuniqueid']][_0xc871('0x57')]=0x0;utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x61'),_0x30eae0[_0xc871('0x4c')],queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x1d')],queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0xe')],queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x9')],queues[_0x30eae0[_0xc871('0x54')]][_0xc871('0x55')]));}else{utils[_0xc871('0x2')](util[_0xc871('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x30eae0[_0xc871('0x4c')],queues[_0x30eae0[_0xc871('0x4e')]]['name'],_0x30eae0[_0xc871('0x4d')]));queues[_0x30eae0[_0xc871('0x4e')]]['transfereduniqueid']=_0x30eae0['origtransfererlinkedid'];}}}}catch(_0x2ed6fb){utils[_0xc871('0x13')](util['format'](_0xc871('0x4b'),_0x30eae0[_0xc871('0x4c')]),_0x2ed6fb);}};exports['musiconholdstart']=function(_0x1ff901){try{if(!_[_0xc871('0x16')](queues[_0x1ff901['uniqueid']])){utils[_0xc871('0x10')](util[_0xc871('0x3')](_0xc871('0x62'),_0x1ff901[_0xc871('0x5')]),_0x1ff901);queues[_0x1ff901[_0xc871('0x5')]][_0xc871('0x63')]=utils[_0xc871('0x1b')]();utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1ff901['uniqueid'],queues[_0x1ff901[_0xc871('0x5')]][_0xc871('0x1d')],queues[_0x1ff901[_0xc871('0x5')]][_0xc871('0x63')]));}}catch(_0x572210){utils[_0xc871('0x13')](util['format'](_0xc871('0x62'),_0x1ff901['uniqueid']),_0x572210);}};exports[_0xc871('0x64')]=function(_0x27de25){try{if(!_[_0xc871('0x16')](queues[_0x27de25[_0xc871('0x5')]])){if(!_[_0xc871('0x16')](queues[_0x27de25['uniqueid']][_0xc871('0x63')])){utils[_0xc871('0x10')](util[_0xc871('0x3')](_0xc871('0x65'),_0x27de25[_0xc871('0x5')]),_0x27de25);queues[_0x27de25[_0xc871('0x5')]][_0xc871('0x57')]+=utils[_0xc871('0x35')](utils['now'](),queues[_0x27de25[_0xc871('0x5')]]['musiconholdstartAt']);utils[_0xc871('0x2')](util[_0xc871('0x3')](_0xc871('0x66'),_0x27de25['uniqueid'],queues[_0x27de25[_0xc871('0x5')]][_0xc871('0x1d')],queues[_0x27de25[_0xc871('0x5')]]['mohtime']));delete queues[_0x27de25['uniqueid']][_0xc871('0x63')];}}}catch(_0x1cc471){utils[_0xc871('0x13')](util[_0xc871('0x3')]('[%s][queues][musiconholdstop]',_0x27de25[_0xc871('0x5')]),_0x1cc471);}}; \ No newline at end of file +var _0x9f27=['musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','value','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfereruniqueid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9f27,0x13c));var _0x79f2=function(_0x314860,_0x5a8d78){_0x314860=_0x314860-0x0;var _0x370bf1=_0x9f27[_0x314860];return _0x370bf1;};'use strict';var _=require(_0x79f2('0x0'));var util=require(_0x79f2('0x1'));var utils=require(_0x79f2('0x2'));var queues={};function writeDB(_0x5a23a5){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x5'),_0x5a23a5[_0x79f2('0x6')],_0x5a23a5[_0x79f2('0x7')],_0x5a23a5[_0x79f2('0x8')],_0x5a23a5[_0x79f2('0x9')],_0x5a23a5[_0x79f2('0xa')],_0x5a23a5[_0x79f2('0xb')],_0x5a23a5[_0x79f2('0xc')]));if(_0x5a23a5[_0x79f2('0x8')]){utils['getVoiceQueueByName'](_0x5a23a5[_0x79f2('0x8')])[_0x79f2('0xd')](function(_0x2f1ab2){if(_0x2f1ab2){_0x5a23a5[_0x79f2('0xe')]=_0x2f1ab2[_0x79f2('0xe')];}utils[_0x79f2('0xf')](_0x79f2('0x10'),_0x5a23a5);});}else{utils[_0x79f2('0xf')](_0x79f2('0x10'),_0x5a23a5);}if(_0x5a23a5[_0x79f2('0x11')]){delete queues[_0x5a23a5[_0x79f2('0x11')]];}else{delete queues[_0x5a23a5[_0x79f2('0x6')]];}}exports[_0x79f2('0x12')]=function(_0x579b1b){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][queuecallerjoin]',_0x579b1b['uniqueid']),_0x579b1b);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x14'),_0x579b1b[_0x79f2('0x6')],_0x579b1b[_0x79f2('0x8')],_0x579b1b[_0x79f2('0x15')]));queues[_0x579b1b[_0x79f2('0x6')]]=_['assign'](_0x579b1b,{'originalposition':_0x579b1b[_0x79f2('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3cc51f){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x17'),_0x579b1b[_0x79f2('0x6')]),_0x3cc51f);}};exports[_0x79f2('0x18')]=function(_0x4748de){try{if(!_[_0x79f2('0x19')](queues[_0x4748de['uniqueid']])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x1a'),_0x4748de[_0x79f2('0x6')]),_0x4748de);if(queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1b')]){if(!queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1c')]&&!queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1d')]){queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1e')]=!![];queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x1f')]=utils['now']();queues[_0x4748de['uniqueid']][_0x79f2('0xc')]='COMPLETEDBYAGENT';}utils['info'](util[_0x79f2('0x4')](_0x79f2('0x20'),_0x4748de[_0x79f2('0x6')],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x21')],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0xc')]));writeDB(queues[_0x4748de['uniqueid']]);}else if(queues[_0x4748de['uniqueid']][_0x79f2('0x11')]){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x22'),_0x4748de[_0x79f2('0x6')],queues[_0x4748de['uniqueid']]['name'],queues[_0x4748de[_0x79f2('0x6')]][_0x79f2('0x11')]));queues[queues[_0x4748de['uniqueid']][_0x79f2('0x11')]]=queues[_0x4748de[_0x79f2('0x6')]];queues[queues[_0x4748de['uniqueid']][_0x79f2('0x11')]][_0x79f2('0x23')]=0x2;delete queues[_0x4748de[_0x79f2('0x6')]];}}}catch(_0xccf368){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x1a'),_0x4748de[_0x79f2('0x6')]),_0xccf368);}};exports['varset']=function(_0x4dee9f){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x24'),_0x4dee9f[_0x79f2('0x6')]),_0x4dee9f);if(!_[_0x79f2('0x19')](_0x4dee9f[_0x79f2('0x25')][_0x79f2('0x26')])&&_0x4dee9f['value'][_0x79f2('0x27')]()!==_0x79f2('0x28')){if(!_[_0x79f2('0x19')](queues[_0x4dee9f[_0x79f2('0x6')]])){queues[_0x4dee9f['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1d')]=!![];queues[_0x4dee9f['uniqueid']][_0x79f2('0x2a')]=utils[_0x79f2('0x2b')]();queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0xc')]=_0x4dee9f[_0x79f2('0x2c')][_0x79f2('0x27')]();utils[_0x79f2('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4dee9f[_0x79f2('0x6')],queues[_0x4dee9f[_0x79f2('0x6')]]['name'],_0x4dee9f[_0x79f2('0x2c')],queues[_0x4dee9f[_0x79f2('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x4dee9f[_0x79f2('0x6')]]);}}else if(!_[_0x79f2('0x19')](_0x4dee9f[_0x79f2('0x25')][_0x79f2('0x2d')])){if(!_[_0x79f2('0x19')](queues[_0x4dee9f[_0x79f2('0x6')]])&&!queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1c')]){queues[_0x4dee9f[_0x79f2('0x6')]]['queuecallerabandon']=![];queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x1d')]=!![];queues[_0x4dee9f['uniqueid']][_0x79f2('0x2a')]=utils['now']();queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0xc')]=_0x79f2('0x2e');utils[_0x79f2('0x3')](util[_0x79f2('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4dee9f[_0x79f2('0x6')],queues[_0x4dee9f[_0x79f2('0x6')]][_0x79f2('0x21')],_0x4dee9f[_0x79f2('0x2c')],queues[_0x4dee9f['uniqueid']]['queuecallerexitreason']));}}}catch(_0x21c32b){utils['error'](util[_0x79f2('0x4')](_0x79f2('0x24'),_0x4dee9f[_0x79f2('0x6')]),_0x21c32b);}};exports['queuecallerabandon']=function(_0x11f862){try{if(!_[_0x79f2('0x19')](queues[_0x11f862[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util['format'](_0x79f2('0x2f'),_0x11f862['uniqueid']),_0x11f862);queues[_0x11f862[_0x79f2('0x6')]]['queuecallerexit']=![];queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x2a')]=null;queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x1c')]=!![];queues[_0x11f862['uniqueid']]['queuecallerabandonAt']=utils[_0x79f2('0x2b')]();queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0xc')]='ABANDONED';utils['info'](util[_0x79f2('0x4')](_0x79f2('0x30'),_0x11f862[_0x79f2('0x6')],queues[_0x11f862[_0x79f2('0x6')]][_0x79f2('0x21')],queues[_0x11f862[_0x79f2('0x6')]]['queuecallerexitreason']));}}catch(_0x8a5741){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x2f'),_0x11f862['uniqueid']),_0x8a5741);}};exports[_0x79f2('0x31')]=function(_0x2bc877){try{if(!_[_0x79f2('0x19')](queues[_0x2bc877[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x32'),_0x2bc877[_0x79f2('0x6')]),_0x2bc877);utils[_0x79f2('0x3')](util['format'](_0x79f2('0x33'),_0x2bc877['uniqueid'],queues[_0x2bc877[_0x79f2('0x6')]]['name'],_0x2bc877['connectedlinenum'],_0x2bc877[_0x79f2('0x34')]));queues[_0x2bc877['uniqueid']][_0x79f2('0x31')]=!![];queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x1b')]=utils['now']();queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x35')]=utils[_0x79f2('0x36')](queues[_0x2bc877[_0x79f2('0x6')]]['queuecallerleaveAt'],queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x37')]);queues[_0x2bc877['uniqueid']][_0x79f2('0x15')]=_0x2bc877[_0x79f2('0x15')];queues[_0x2bc877['uniqueid']][_0x79f2('0x38')]=_0x2bc877[_0x79f2('0x38')];queues[_0x2bc877[_0x79f2('0x6')]]['connectedlinenum']=_0x2bc877['connectedlinenum'];queues[_0x2bc877[_0x79f2('0x6')]][_0x79f2('0x34')]=_0x2bc877[_0x79f2('0x34')];}}catch(_0x3d9039){utils[_0x79f2('0x16')](util[_0x79f2('0x4')]('[%s][queues][queuecallerleave]',_0x2bc877[_0x79f2('0x6')]),_0x3d9039);}};exports[_0x79f2('0x39')]=function(_0x2a94b3){try{if(!_[_0x79f2('0x19')](queues[_0x2a94b3['uniqueid']])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x3a'),_0x2a94b3[_0x79f2('0x6')]),_0x2a94b3);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x3b'),_0x2a94b3[_0x79f2('0x6')],queues[_0x2a94b3[_0x79f2('0x6')]]['name'],_0x2a94b3[_0x79f2('0x3c')],_0x2a94b3['destaccountcode']));queues[_0x2a94b3['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x1c')]=![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x29')]=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x1d')]=![];queues[_0x2a94b3[_0x79f2('0x6')]]['queuecallerexitreason']=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x2a')]=null;queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x3d')]=!![];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0xb')]=_0x2a94b3[_0x79f2('0x3e')];queues[_0x2a94b3[_0x79f2('0x6')]][_0x79f2('0x9')]=_0x2a94b3[_0x79f2('0x3c')];}}catch(_0x55a52b){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x3a'),_0x2a94b3['uniqueid']),_0x55a52b);}};exports[_0x79f2('0x3f')]=function(_0x137ea0){try{if(!_['isNil'](queues[_0x137ea0[_0x79f2('0x6')]])){if(queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x1b')]){utils[_0x79f2('0x13')](util['format'](_0x79f2('0x40'),_0x137ea0[_0x79f2('0x6')]),_0x137ea0);queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x1c')]=![];queues[_0x137ea0['uniqueid']][_0x79f2('0x1c')]=![];queues[_0x137ea0['uniqueid']][_0x79f2('0x29')]=null;queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexit']=![];queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexitAt']=null;queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x3d')]=!![];queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x9')]=_0x137ea0[_0x79f2('0x3c')];queues[_0x137ea0['uniqueid']][_0x79f2('0x1e')]=!![];queues[_0x137ea0[_0x79f2('0x6')]]['queuecallercompleteAt']=utils[_0x79f2('0x2b')]();if(_0x137ea0[_0x79f2('0x41')]==_0x79f2('0x42')){if(!queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x42')]){queues[_0x137ea0['uniqueid']][_0x79f2('0xc')]='TRANSFER';}}else{queues[_0x137ea0[_0x79f2('0x6')]]['queuecallerexitreason']=_0x79f2('0x43')+_0x137ea0['reason'][_0x79f2('0x27')]();}utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x44'),_0x137ea0[_0x79f2('0x6')],queues[_0x137ea0[_0x79f2('0x6')]][_0x79f2('0x21')],_0x137ea0[_0x79f2('0x3c')],queues[_0x137ea0['uniqueid']][_0x79f2('0xc')]));writeDB(queues[_0x137ea0['uniqueid']]);}}}catch(_0x33bc6c){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x40'),_0x137ea0[_0x79f2('0x6')]),_0x33bc6c);}};exports[_0x79f2('0x45')]=function(_0x4755cd){try{if(!_['isNil'](queues[_0x4755cd[_0x79f2('0x46')]])){utils['debug'](util[_0x79f2('0x4')](_0x79f2('0x47'),_0x4755cd[_0x79f2('0x6')]),_0x4755cd);queues[_0x4755cd[_0x79f2('0x46')]][_0x79f2('0x42')]=!![];queues[_0x4755cd[_0x79f2('0x46')]][_0x79f2('0x48')]=_0x79f2('0x49');queues[_0x4755cd[_0x79f2('0x46')]]['transferexten']=_0x4755cd['extension'];queues[_0x4755cd[_0x79f2('0x46')]]['transferuniqueid']=_0x4755cd[_0x79f2('0x46')];queues[_0x4755cd['transfereeuniqueid']]['queuecallerexitreason']=_0x79f2('0x4a');utils['info'](util[_0x79f2('0x4')](_0x79f2('0x4b'),_0x4755cd[_0x79f2('0x6')],queues[_0x4755cd[_0x79f2('0x46')]]['name'],_0x4755cd[_0x79f2('0x46')],_0x4755cd[_0x79f2('0x4c')]));}}catch(_0x2bbd5c){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x47'),_0x4755cd[_0x79f2('0x6')]),_0x2bbd5c);}};exports['attendedtransfer']=function(_0x19e4c6){try{utils[_0x79f2('0x13')](util[_0x79f2('0x4')](_0x79f2('0x4d'),_0x19e4c6['origtransfereruniqueid']),_0x19e4c6);if(_0x19e4c6['origtransfereruniqueid']==_0x19e4c6[_0x79f2('0x4e')]){if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4f')]])){utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x50'),_0x19e4c6['origtransfereruniqueid'],queues[_0x19e4c6['secondtransfererlinkedid']][_0x79f2('0x21')],_0x19e4c6[_0x79f2('0x51')]));queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x42')]=!![];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x48')]=_0x79f2('0x52');queues[_0x19e4c6['secondtransfererlinkedid']]['transferexten']=_0x19e4c6[_0x79f2('0x51')];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x53')]=_0x19e4c6['origtransfereruniqueid'];queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0xc')]='ATTENDEDTRANSFER';}if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4e')]])){if(_0x19e4c6[_0x79f2('0x54')]&&queues[_0x19e4c6[_0x79f2('0x54')]]){queues[_0x19e4c6['transfereelinkedid']][_0x79f2('0x23')]=0x1;queues[_0x19e4c6[_0x79f2('0x46')]]=_[_0x79f2('0x55')](queues[_0x19e4c6['transfereelinkedid']]);queues[_0x19e4c6['transfereeuniqueid']][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x56')];queues[_0x19e4c6[_0x79f2('0x46')]]['queuecallerenterreason']=0x2;queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0xa')]=queues[_0x19e4c6[_0x79f2('0x4f')]]['calleridnum'];queues[_0x19e4c6[_0x79f2('0x46')]]['calleridname']=queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x57')];queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x37')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x1b')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x46')]]['holdtime']=0x0;queues[_0x19e4c6['transfereeuniqueid']]['mohtime']=0x0;utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x58'),_0x19e4c6['origtransfereruniqueid'],queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x21')],queues[_0x19e4c6[_0x79f2('0x46')]]['calleridnum'],queues[_0x19e4c6[_0x79f2('0x46')]][_0x79f2('0x57')]));}else{utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x59'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6['origtransfererlinkedid']][_0x79f2('0x21')],_0x19e4c6['secondtransfererlinkedid']));queues[_0x19e4c6[_0x79f2('0x4e')]]['transfereduniqueid']=_0x19e4c6['secondtransfererlinkedid'];}}}else if(_0x19e4c6[_0x79f2('0x5b')]==_0x19e4c6[_0x79f2('0x4f')]){if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4e')]])){utils['info'](util[_0x79f2('0x4')](_0x79f2('0x5c'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6['origtransfererlinkedid']]['name'],_0x19e4c6['secondtransfereruniqueid'],_0x19e4c6[_0x79f2('0x5d')]));queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x42')]=!![];queues[_0x19e4c6[_0x79f2('0x4e')]]['transfertype']='ATTENDED';queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x5e')]=_0x19e4c6[_0x79f2('0x5d')];queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0x53')]=_0x19e4c6['secondtransfereruniqueid'];queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0xc')]=_0x79f2('0x5f');}if(!_[_0x79f2('0x19')](queues[_0x19e4c6[_0x79f2('0x4f')]])){if(_0x19e4c6[_0x79f2('0x60')]&&queues[_0x19e4c6[_0x79f2('0x60')]]){queues[_0x19e4c6[_0x79f2('0x60')]][_0x79f2('0x23')]=0x1;queues[_0x19e4c6[_0x79f2('0x56')]]=_[_0x79f2('0x55')](queues[_0x19e4c6['transfertargetlinkedid']]);queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x56')];queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x23')]=0x2;queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0xa')]=queues[_0x19e4c6[_0x79f2('0x4e')]][_0x79f2('0xa')];queues[_0x19e4c6['transfertargetuniqueid']][_0x79f2('0x57')]=queues[_0x19e4c6['origtransfererlinkedid']][_0x79f2('0x57')];queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x37')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6['transfertargetuniqueid']][_0x79f2('0x1b')]=utils[_0x79f2('0x2b')]();queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x35')]=0x0;queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x61')]=0x0;utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x62'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x21')],queues[_0x19e4c6['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0xa')],queues[_0x19e4c6[_0x79f2('0x56')]][_0x79f2('0x57')]));}else{utils[_0x79f2('0x3')](util['format'](_0x79f2('0x59'),_0x19e4c6[_0x79f2('0x5a')],queues[_0x19e4c6[_0x79f2('0x4f')]]['name'],_0x19e4c6[_0x79f2('0x4e')]));queues[_0x19e4c6[_0x79f2('0x4f')]][_0x79f2('0x11')]=_0x19e4c6[_0x79f2('0x4e')];}}}}catch(_0x2a378a){utils[_0x79f2('0x16')](util['format'](_0x79f2('0x4d'),_0x19e4c6[_0x79f2('0x5a')]),_0x2a378a);}};exports[_0x79f2('0x63')]=function(_0x1458bc){try{if(!_[_0x79f2('0x19')](queues[_0x1458bc[_0x79f2('0x6')]])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstart]',_0x1458bc['uniqueid']),_0x1458bc);queues[_0x1458bc[_0x79f2('0x6')]][_0x79f2('0x64')]=utils['now']();utils[_0x79f2('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1458bc['uniqueid'],queues[_0x1458bc[_0x79f2('0x6')]]['name'],queues[_0x1458bc[_0x79f2('0x6')]]['musiconholdstartAt']));}}catch(_0x49fec9){utils[_0x79f2('0x16')](util[_0x79f2('0x4')](_0x79f2('0x65'),_0x1458bc[_0x79f2('0x6')]),_0x49fec9);}};exports[_0x79f2('0x66')]=function(_0x12f874){try{if(!_[_0x79f2('0x19')](queues[_0x12f874[_0x79f2('0x6')]])){if(!_[_0x79f2('0x19')](queues[_0x12f874[_0x79f2('0x6')]][_0x79f2('0x64')])){utils[_0x79f2('0x13')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstop]',_0x12f874[_0x79f2('0x6')]),_0x12f874);queues[_0x12f874['uniqueid']][_0x79f2('0x61')]+=utils['diffTime'](utils[_0x79f2('0x2b')](),queues[_0x12f874['uniqueid']][_0x79f2('0x64')]);utils[_0x79f2('0x3')](util[_0x79f2('0x4')](_0x79f2('0x67'),_0x12f874[_0x79f2('0x6')],queues[_0x12f874['uniqueid']]['name'],queues[_0x12f874['uniqueid']][_0x79f2('0x61')]));delete queues[_0x12f874[_0x79f2('0x6')]]['musiconholdstartAt'];}}}catch(_0x2a1418){utils[_0x79f2('0x16')](util[_0x79f2('0x4')]('[%s][queues][musiconholdstop]',_0x12f874[_0x79f2('0x6')]),_0x2a1418);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 70188b6..bf308cf 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 _0x2094=['UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name'];(function(_0x33e3a0,_0x3b7d8a){var _0x9320c=function(_0x5d93ad){while(--_0x5d93ad){_0x33e3a0['push'](_0x33e3a0['shift']());}};_0x9320c(++_0x3b7d8a);}(_0x2094,0xfa));var _0x4209=function(_0x4f9792,_0x281a6a){_0x4f9792=_0x4f9792-0x0;var _0x1461ce=_0x2094[_0x4f9792];return _0x1461ce;};'use strict';var _=require('lodash');var util=require(_0x4209('0x0'));var utils=require(_0x4209('0x1'));var recordings={};function writeDB(_0x2ab6b3){utils[_0x4209('0x2')](util[_0x4209('0x3')]('[%s][recordings][writeDB]',_0x2ab6b3[_0x4209('0x4')]));if(_0x2ab6b3[_0x4209('0x5')]){utils[_0x4209('0x6')](_0x2ab6b3[_0x4209('0x5')])[_0x4209('0x7')](function(_0xe4e048){if(_0xe4e048){_0x2ab6b3[_0x4209('0x8')]=_0xe4e048[_0x4209('0x9')];_0x2ab6b3[_0x4209('0xa')]=_0xe4e048['id'];}utils[_0x4209('0xb')](_0x4209('0xc'),_0x2ab6b3);});}else{utils['request'](_0x4209('0xc'),_0x2ab6b3);}}exports['newchannel']=function(_0x508200){try{utils[_0x4209('0xd')](util[_0x4209('0x3')](_0x4209('0xe'),_0x508200[_0x4209('0x4')]),_0x508200);if(_0x508200[_0x4209('0x4')]==_0x508200[_0x4209('0xf')]){utils['info'](util[_0x4209('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x508200[_0x4209('0x4')],_0x508200[_0x4209('0x10')],_0x508200[_0x4209('0x11')]));recordings[_0x508200['uniqueid']]={'uniqueid':_0x508200[_0x4209('0x4')],'accountcode':_0x508200[_0x4209('0x5')],'exten':_0x508200['exten'],'context':_0x508200[_0x4209('0x10')],'channel':_0x508200[_0x4209('0x12')],'monitors':[]};}}catch(_0x4a761e){utils[_0x4209('0x13')](util[_0x4209('0x3')](_0x4209('0xe'),_0x508200[_0x4209('0x4')]),_0x4a761e);}};exports[_0x4209('0x14')]=function(_0x21bdc2){try{utils['debug'](util[_0x4209('0x3')](_0x4209('0x15'),_0x21bdc2['uniqueid']),_0x21bdc2);if(!_[_0x4209('0x16')](recordings[_0x21bdc2[_0x4209('0x4')]])&&_0x21bdc2[_0x4209('0x17')]==0x6){utils[_0x4209('0x2')](util[_0x4209('0x3')](_0x4209('0x18'),_0x21bdc2['uniqueid'],_0x21bdc2['context'],_0x21bdc2['channel']));}else if(!_[_0x4209('0x16')](recordings[_0x21bdc2[_0x4209('0xf')]])&&_0x21bdc2[_0x4209('0x17')]==0x6&&_0x21bdc2['context']!=_0x4209('0x19')){utils['info'](util[_0x4209('0x3')](_0x4209('0x1a'),_0x21bdc2['uniqueid'],_0x21bdc2[_0x4209('0xf')],_0x21bdc2['context'],_0x21bdc2[_0x4209('0x12')]));recordings[_0x21bdc2[_0x4209('0xf')]]['accountcode']=_0x21bdc2[_0x4209('0x5')];}}catch(_0x18ebb1){utils[_0x4209('0x13')](util['format']('[%s][recordings][newstate]',_0x21bdc2[_0x4209('0x4')]),_0x18ebb1);}};exports[_0x4209('0x1b')]=function(_0x3690a9){try{if(!_[_0x4209('0x16')](_0x3690a9[_0x4209('0x1c')])&&!_[_0x4209('0x16')](_0x3690a9[_0x4209('0x1c')][_0x4209('0x1d')])){utils[_0x4209('0xd')](util[_0x4209('0x3')](_0x4209('0x1e'),_0x3690a9[_0x4209('0x4')]),_0x3690a9);utils[_0x4209('0x2')](util[_0x4209('0x3')](_0x4209('0x1f'),_0x3690a9[_0x4209('0x4')],_0x3690a9[_0x4209('0x1c')],_0x3690a9[_0x4209('0x20')]));if(_[_0x4209('0x21')](_0x3690a9[_0x4209('0x20')],_0x4209('0x22'))){_0x3690a9[_0x4209('0x20')]=_0x3690a9[_0x4209('0x20')][_0x4209('0x23')](_0x4209('0x22'),_0x4209('0x24'));}if(recordings[_0x3690a9[_0x4209('0xf')]]){var _0x54f564=_['find'](recordings[_0x3690a9['linkedid']][_0x4209('0x25')],{'value':_0x3690a9[_0x4209('0x20')]});if(_[_0x4209('0x16')](_0x54f564)){recordings[_0x3690a9['linkedid']]['monitors'][_0x4209('0x26')]({'value':_0x3690a9[_0x4209('0x20')]});}}}}catch(_0x13950b){utils[_0x4209('0x13')](util['format'](_0x4209('0x1e'),_0x3690a9['uniqueid']),_0x13950b);}};exports[_0x4209('0x27')]=function(_0x4dea44){try{if(!_[_0x4209('0x16')](recordings[_0x4dea44[_0x4209('0x4')]])){utils[_0x4209('0xd')](util[_0x4209('0x3')]('[%s][recordings][hangup]',_0x4dea44[_0x4209('0x4')]),_0x4dea44);utils[_0x4209('0x2')](util['format'](_0x4209('0x28'),_0x4dea44[_0x4209('0x4')],_0x4dea44[_0x4209('0x29')],_0x4dea44[_0x4209('0x2a')],_0x4dea44[_0x4209('0x2b')]));recordings[_0x4dea44[_0x4209('0x4')]]['calleridnum']=_0x4dea44[_0x4209('0x29')];recordings[_0x4dea44['uniqueid']][_0x4209('0x2a')]=_0x4dea44[_0x4209('0x2a')];recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x2c')]=_0x4dea44[_0x4209('0x2c')];recordings[_0x4dea44[_0x4209('0x4')]]['connectedlinename']=_0x4dea44[_0x4209('0x2d')];if(recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x2e')]==_0x4209('0x2f')&&recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x5')]){recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x2c')]=recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x5')];recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x2d')]='';}recordings[_0x4dea44[_0x4209('0x4')]][_0x4209('0x25')][_0x4209('0x30')](function(_0x3ce84c){var _0xaf434=_[_0x4209('0x31')](recordings[_0x4dea44[_0x4209('0x4')]]);_0xaf434['value']=_0x3ce84c[_0x4209('0x20')];writeDB(_0xaf434);});delete recordings[_0x4dea44[_0x4209('0x4')]];}}catch(_0xb846af){utils[_0x4209('0x13')](util[_0x4209('0x3')](_0x4209('0x32'),_0x4dea44['uniqueid']),_0xb846af);}};exports[_0x4209('0x33')]=function(_0x565371){try{if(!_[_0x4209('0x16')](recordings[_0x565371[_0x4209('0x4')]])){utils[_0x4209('0xd')](util['format'](_0x4209('0x34'),_0x565371[_0x4209('0x4')]),_0x565371);utils[_0x4209('0x2')](util[_0x4209('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x565371[_0x4209('0x4')],_0x565371['application'],_0x565371[_0x4209('0x35')]));if(_0x565371[_0x4209('0x36')][_0x4209('0x37')]()==_0x4209('0x38')&&_[_0x4209('0x39')](_0x565371['appdata']['toLowerCase'](),'cdr')){var _0xe2815a=_0x565371[_0x4209('0x35')][_0x4209('0x3a')]('=');var _0x336db9=_0xe2815a[0x0][_0x4209('0x3b')](_0xe2815a[0x0]['lastIndexOf']('(')+0x1,_0xe2815a[0x0][_0x4209('0x3c')](')'));var _0x21744e=_0xe2815a[0x1];recordings[_0x565371[_0x4209('0x4')]][_0x336db9]=_0x21744e;}}}catch(_0x48ccda){utils[_0x4209('0x13')](util['format']('[%s][recordings][newexten]',_0x565371['uniqueid']),_0x48ccda);}};exports[_0x4209('0x3d')]=function(_0x668c23){try{if(!_['isNil'](recordings[_0x668c23[_0x4209('0x4')]])){utils[_0x4209('0xd')](util[_0x4209('0x3')](_0x4209('0x3e'),_0x668c23[_0x4209('0x4')]),_0x668c23);utils[_0x4209('0x2')](util[_0x4209('0x3')](_0x4209('0x3f'),_0x668c23[_0x4209('0x4')],_0x668c23['queue']));recordings[_0x668c23[_0x4209('0x4')]]['queue']=_0x668c23[_0x4209('0x40')];}}catch(_0x5e766d){utils[_0x4209('0x13')](util[_0x4209('0x3')](_0x4209('0x3e'),_0x668c23['uniqueid']),_0x5e766d);}}; \ No newline at end of file +var _0xa4e5=['queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','uniqueid','context','exten','channel','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','endsWith','value','replace','.wav49','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x3b152e,_0x49c791){var _0x5020af=function(_0x5a2ef7){while(--_0x5a2ef7){_0x3b152e['push'](_0x3b152e['shift']());}};_0x5020af(++_0x49c791);}(_0xa4e5,0x1ba));var _0x5a4e=function(_0x4c5172,_0x5c4f8c){_0x4c5172=_0x4c5172-0x0;var _0x397837=_0xa4e5[_0x4c5172];return _0x397837;};'use strict';var _=require(_0x5a4e('0x0'));var util=require(_0x5a4e('0x1'));var utils=require(_0x5a4e('0x2'));var recordings={};function writeDB(_0x4392d4){utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')](_0x5a4e('0x5'),_0x4392d4['uniqueid']));if(_0x4392d4[_0x5a4e('0x6')]){utils[_0x5a4e('0x7')](_0x4392d4[_0x5a4e('0x6')])['then'](function(_0x323b6d){if(_0x323b6d){_0x4392d4['membername']=_0x323b6d[_0x5a4e('0x8')];_0x4392d4[_0x5a4e('0x9')]=_0x323b6d['id'];}utils[_0x5a4e('0xa')](_0x5a4e('0xb'),_0x4392d4);});}else{utils[_0x5a4e('0xa')](_0x5a4e('0xb'),_0x4392d4);}}exports[_0x5a4e('0xc')]=function(_0x337b5e){try{utils[_0x5a4e('0xd')](util[_0x5a4e('0x4')](_0x5a4e('0xe'),_0x337b5e['uniqueid']),_0x337b5e);if(_0x337b5e['uniqueid']==_0x337b5e['linkedid']){utils['info'](util['format'](_0x5a4e('0xf'),_0x337b5e[_0x5a4e('0x10')],_0x337b5e[_0x5a4e('0x11')],_0x337b5e[_0x5a4e('0x12')]));recordings[_0x337b5e[_0x5a4e('0x10')]]={'uniqueid':_0x337b5e[_0x5a4e('0x10')],'accountcode':_0x337b5e[_0x5a4e('0x6')],'exten':_0x337b5e[_0x5a4e('0x12')],'context':_0x337b5e[_0x5a4e('0x11')],'channel':_0x337b5e[_0x5a4e('0x13')],'monitors':[]};}}catch(_0x9f3420){utils['error'](util[_0x5a4e('0x4')]('[%s][recordings][newchannel]',_0x337b5e[_0x5a4e('0x10')]),_0x9f3420);}};exports[_0x5a4e('0x14')]=function(_0x176652){try{utils[_0x5a4e('0xd')](util['format']('[%s][recordings][newstate]',_0x176652[_0x5a4e('0x10')]),_0x176652);if(!_[_0x5a4e('0x15')](recordings[_0x176652[_0x5a4e('0x10')]])&&_0x176652[_0x5a4e('0x16')]==0x6){utils['info'](util['format'](_0x5a4e('0x17'),_0x176652[_0x5a4e('0x10')],_0x176652[_0x5a4e('0x11')],_0x176652[_0x5a4e('0x13')]));}else if(!_['isNil'](recordings[_0x176652[_0x5a4e('0x18')]])&&_0x176652['channelstate']==0x6&&_0x176652[_0x5a4e('0x11')]!=_0x5a4e('0x19')){utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')](_0x5a4e('0x1a'),_0x176652[_0x5a4e('0x10')],_0x176652['linkedid'],_0x176652[_0x5a4e('0x11')],_0x176652[_0x5a4e('0x13')]));recordings[_0x176652[_0x5a4e('0x18')]][_0x5a4e('0x6')]=_0x176652[_0x5a4e('0x6')];}}catch(_0x7b6c0){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x1c'),_0x176652[_0x5a4e('0x10')]),_0x7b6c0);}};exports[_0x5a4e('0x1d')]=function(_0x5ae54a){try{if(!_['isNil'](_0x5ae54a[_0x5a4e('0x1e')])&&!_['isNil'](_0x5ae54a[_0x5a4e('0x1e')]['mixmonitor_filename'])){utils['debug'](util['format']('[%s][recordings][varset]',_0x5ae54a[_0x5a4e('0x10')]),_0x5ae54a);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5ae54a[_0x5a4e('0x10')],_0x5ae54a[_0x5a4e('0x1e')],_0x5ae54a['value']));if(_[_0x5a4e('0x1f')](_0x5ae54a[_0x5a4e('0x20')],'.wav49')){_0x5ae54a[_0x5a4e('0x20')]=_0x5ae54a[_0x5a4e('0x20')][_0x5a4e('0x21')](_0x5a4e('0x22'),_0x5a4e('0x23'));}if(recordings[_0x5ae54a[_0x5a4e('0x18')]]){var _0xc66133=_[_0x5a4e('0x24')](recordings[_0x5ae54a[_0x5a4e('0x18')]]['monitors'],{'value':_0x5ae54a[_0x5a4e('0x20')]});if(_[_0x5a4e('0x15')](_0xc66133)){recordings[_0x5ae54a[_0x5a4e('0x18')]][_0x5a4e('0x25')]['push']({'value':_0x5ae54a[_0x5a4e('0x20')]});}}}}catch(_0x1ab3a8){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x26'),_0x5ae54a[_0x5a4e('0x10')]),_0x1ab3a8);}};exports[_0x5a4e('0x27')]=function(_0x44eee5){try{if(!_['isNil'](recordings[_0x44eee5[_0x5a4e('0x10')]])){utils['debug'](util['format'](_0x5a4e('0x28'),_0x44eee5[_0x5a4e('0x10')]),_0x44eee5);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x44eee5[_0x5a4e('0x10')],_0x44eee5[_0x5a4e('0x29')],_0x44eee5[_0x5a4e('0x2a')],_0x44eee5[_0x5a4e('0x2b')]));recordings[_0x44eee5[_0x5a4e('0x10')]]['calleridnum']=_0x44eee5['calleridnum'];recordings[_0x44eee5[_0x5a4e('0x10')]]['calleridname']=_0x44eee5[_0x5a4e('0x2a')];recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2c')]=_0x44eee5[_0x5a4e('0x2c')];recordings[_0x44eee5[_0x5a4e('0x10')]][_0x5a4e('0x2d')]=_0x44eee5[_0x5a4e('0x2d')];if(recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2e')]==_0x5a4e('0x2f')&&recordings[_0x44eee5['uniqueid']][_0x5a4e('0x6')]){recordings[_0x44eee5['uniqueid']][_0x5a4e('0x2c')]=recordings[_0x44eee5[_0x5a4e('0x10')]]['accountcode'];recordings[_0x44eee5['uniqueid']]['connectedlinename']='';}recordings[_0x44eee5[_0x5a4e('0x10')]][_0x5a4e('0x25')][_0x5a4e('0x30')](function(_0x338891){var _0x2db4c8=_['clone'](recordings[_0x44eee5[_0x5a4e('0x10')]]);_0x2db4c8['value']=_0x338891[_0x5a4e('0x20')];writeDB(_0x2db4c8);});delete recordings[_0x44eee5[_0x5a4e('0x10')]];}}catch(_0x6ffddf){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')]('[%s][recordings][hangup]',_0x44eee5[_0x5a4e('0x10')]),_0x6ffddf);}};exports[_0x5a4e('0x31')]=function(_0x1e4dfb){try{if(!_['isNil'](recordings[_0x1e4dfb[_0x5a4e('0x10')]])){utils['debug'](util['format'](_0x5a4e('0x32'),_0x1e4dfb['uniqueid']),_0x1e4dfb);utils['info'](util[_0x5a4e('0x4')](_0x5a4e('0x33'),_0x1e4dfb[_0x5a4e('0x10')],_0x1e4dfb['application'],_0x1e4dfb[_0x5a4e('0x34')]));if(_0x1e4dfb['application']['toLowerCase']()==_0x5a4e('0x35')&&_[_0x5a4e('0x36')](_0x1e4dfb[_0x5a4e('0x34')][_0x5a4e('0x37')](),_0x5a4e('0x38'))){var _0x5265bd=_0x1e4dfb[_0x5a4e('0x34')][_0x5a4e('0x39')]('=');var _0x3cf50c=_0x5265bd[0x0][_0x5a4e('0x3a')](_0x5265bd[0x0]['lastIndexOf']('(')+0x1,_0x5265bd[0x0][_0x5a4e('0x3b')](')'));var _0x598c43=_0x5265bd[0x1];recordings[_0x1e4dfb['uniqueid']][_0x3cf50c]=_0x598c43;}}}catch(_0x460e72){utils[_0x5a4e('0x1b')](util[_0x5a4e('0x4')](_0x5a4e('0x32'),_0x1e4dfb[_0x5a4e('0x10')]),_0x460e72);}};exports[_0x5a4e('0x3c')]=function(_0xc11840){try{if(!_['isNil'](recordings[_0xc11840[_0x5a4e('0x10')]])){utils[_0x5a4e('0xd')](util[_0x5a4e('0x4')](_0x5a4e('0x3d'),_0xc11840[_0x5a4e('0x10')]),_0xc11840);utils[_0x5a4e('0x3')](util[_0x5a4e('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xc11840['uniqueid'],_0xc11840[_0x5a4e('0x3e')]));recordings[_0xc11840[_0x5a4e('0x10')]][_0x5a4e('0x3e')]=_0xc11840[_0x5a4e('0x3e')];}}catch(_0x52bb39){utils['error'](util[_0x5a4e('0x4')]('[%s][recordings][queuecallerjoin]',_0xc11840[_0x5a4e('0x10')]),_0x52bb39);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 62fb141..bbd6eb7 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 _0x3e22=['info','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','format','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','util','./utils'];(function(_0x105037,_0x43ae91){var _0xe804c2=function(_0x1dc484){while(--_0x1dc484){_0x105037['push'](_0x105037['shift']());}};_0xe804c2(++_0x43ae91);}(_0x3e22,0x12e));var _0x23e2=function(_0x928aa1,_0x16bd67){_0x928aa1=_0x928aa1-0x0;var _0x37b02b=_0x3e22[_0x928aa1];return _0x37b02b;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var utils=require(_0x23e2('0x1'));function writeDB(_0xbc8191){utils[_0x23e2('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0xbc8191[_0x23e2('0x3')]===_0x23e2('0x4')?_0xbc8191[_0x23e2('0x5')]:_0xbc8191['uniqueid'],_0xbc8191[_0x23e2('0x3')]));utils[_0x23e2('0x6')](_0x23e2('0x7'),_0xbc8191);}exports['blindtransfer']=function(_0x432910){try{utils[_0x23e2('0x8')](util[_0x23e2('0x9')]('[%s][transfers][blindtransfer]',_0x432910[_0x23e2('0xa')]),_0x432910);utils[_0x23e2('0x2')](util[_0x23e2('0x9')](_0x23e2('0xb'),_0x432910[_0x23e2('0xa')],_0x432910[_0x23e2('0xc')],_0x432910[_0x23e2('0xd')],_0x432910[_0x23e2('0xe')],_0x432910['transfereecalleridname']));_0x432910[_0x23e2('0x3')]=_0x23e2('0xf');writeDB(_0x432910);}catch(_0xecfaaf){utils[_0x23e2('0x10')](util[_0x23e2('0x9')](_0x23e2('0x11'),_0x432910['uniqueid']),_0xecfaaf);}};exports['attendedtransfer']=function(_0x42365e){try{utils[_0x23e2('0x8')](util['format'](_0x23e2('0x12'),_0x42365e[_0x23e2('0x5')]),_0x42365e);utils[_0x23e2('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x42365e[_0x23e2('0x5')],_0x42365e[_0x23e2('0x13')],_0x42365e[_0x23e2('0x14')],_0x42365e[_0x23e2('0x15')],_0x42365e[_0x23e2('0x16')]));_0x42365e=_['assign'](_0x42365e,{'transfererchannel':_0x42365e['origtransfererchannel'],'transferercalleridnum':_0x42365e[_0x23e2('0x13')],'transferercalleridname':_0x42365e['origtransferercalleridname'],'transfererconnectedlinenum':_0x42365e[_0x23e2('0x17')],'transfererconnectedlinename':_0x42365e[_0x23e2('0x18')],'transfereraccountcode':_0x42365e[_0x23e2('0x19')],'transferercontext':_0x42365e[_0x23e2('0x1a')],'transfererexten':_0x42365e[_0x23e2('0x1b')],'transfererlinkedid':_0x42365e[_0x23e2('0x1c')],'context':_0x42365e['origtransferercontext'],'extension':_0x42365e[_0x23e2('0x1d')],'type':'attended'});if(_[_0x23e2('0x1e')](_0x42365e[_0x23e2('0x1f')])){_0x42365e=_[_0x23e2('0x20')](_0x42365e,{'transfereechannel':_0x42365e[_0x23e2('0x21')],'transfereecalleridnum':_0x42365e[_0x23e2('0x15')],'transfereecalleridname':_0x42365e[_0x23e2('0x16')],'transfereeconnectedlinenum':_0x42365e[_0x23e2('0x22')],'transfereeconnectedlinename':_0x42365e[_0x23e2('0x23')],'transfereeaccountcode':_0x42365e[_0x23e2('0x24')],'transfereecontext':_0x42365e['transfertargetcontext'],'transfereeexten':_0x42365e['transfertargetexten'],'transfereelinkedid':_0x42365e[_0x23e2('0x25')]});}writeDB(_0x42365e);}catch(_0x51a4cc){utils[_0x23e2('0x10')](util[_0x23e2('0x9')](_0x23e2('0x12'),_0x42365e[_0x23e2('0x5')]),_0x51a4cc);}}; \ No newline at end of file +var _0xf840=['CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid'];(function(_0x320689,_0x5e496f){var _0xe3f33=function(_0x3173aa){while(--_0x3173aa){_0x320689['push'](_0x320689['shift']());}};_0xe3f33(++_0x5e496f);}(_0xf840,0x175));var _0x0f84=function(_0x565d34,_0x4176da){_0x565d34=_0x565d34-0x0;var _0x3751e7=_0xf840[_0x565d34];return _0x3751e7;};'use strict';var _=require('lodash');var util=require(_0x0f84('0x0'));var utils=require(_0x0f84('0x1'));function writeDB(_0x41d141){utils['info'](util[_0x0f84('0x2')](_0x0f84('0x3'),_0x41d141[_0x0f84('0x4')]===_0x0f84('0x5')?_0x41d141['origtransfereruniqueid']:_0x41d141[_0x0f84('0x6')],_0x41d141[_0x0f84('0x4')]));utils['request'](_0x0f84('0x7'),_0x41d141);}exports['blindtransfer']=function(_0x47ff8f){try{utils[_0x0f84('0x8')](util[_0x0f84('0x2')](_0x0f84('0x9'),_0x47ff8f[_0x0f84('0x6')]),_0x47ff8f);utils[_0x0f84('0xa')](util[_0x0f84('0x2')](_0x0f84('0xb'),_0x47ff8f[_0x0f84('0x6')],_0x47ff8f[_0x0f84('0xc')],_0x47ff8f[_0x0f84('0xd')],_0x47ff8f[_0x0f84('0xe')],_0x47ff8f[_0x0f84('0xf')]));_0x47ff8f[_0x0f84('0x4')]='blind';writeDB(_0x47ff8f);}catch(_0x4f0589){utils[_0x0f84('0x10')](util[_0x0f84('0x2')]('[%s][transfers][blindtransfer]',_0x47ff8f[_0x0f84('0x6')]),_0x4f0589);}};exports[_0x0f84('0x11')]=function(_0x3390d7){try{utils[_0x0f84('0x8')](util['format'](_0x0f84('0x12'),_0x3390d7[_0x0f84('0x13')]),_0x3390d7);utils[_0x0f84('0xa')](util[_0x0f84('0x2')](_0x0f84('0x14'),_0x3390d7[_0x0f84('0x13')],_0x3390d7['origtransferercalleridnum'],_0x3390d7[_0x0f84('0x15')],_0x3390d7[_0x0f84('0x16')],_0x3390d7[_0x0f84('0x17')]));_0x3390d7=_['assign'](_0x3390d7,{'transfererchannel':_0x3390d7[_0x0f84('0x18')],'transferercalleridnum':_0x3390d7[_0x0f84('0x19')],'transferercalleridname':_0x3390d7[_0x0f84('0x15')],'transfererconnectedlinenum':_0x3390d7[_0x0f84('0x1a')],'transfererconnectedlinename':_0x3390d7['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3390d7['origtransfereraccountcode'],'transferercontext':_0x3390d7[_0x0f84('0x1b')],'transfererexten':_0x3390d7[_0x0f84('0x1c')],'transfererlinkedid':_0x3390d7[_0x0f84('0x1d')],'context':_0x3390d7[_0x0f84('0x1e')],'extension':_0x3390d7[_0x0f84('0x1f')],'type':_0x0f84('0x5')});if(_['isNil'](_0x3390d7[_0x0f84('0x20')])){_0x3390d7=_[_0x0f84('0x21')](_0x3390d7,{'transfereechannel':_0x3390d7[_0x0f84('0x22')],'transfereecalleridnum':_0x3390d7[_0x0f84('0x16')],'transfereecalleridname':_0x3390d7[_0x0f84('0x17')],'transfereeconnectedlinenum':_0x3390d7[_0x0f84('0x23')],'transfereeconnectedlinename':_0x3390d7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3390d7['transfertargetaccountcode'],'transfereecontext':_0x3390d7[_0x0f84('0x24')],'transfereeexten':_0x3390d7[_0x0f84('0x25')],'transfereelinkedid':_0x3390d7['transfertargetlinkedid']});}writeDB(_0x3390d7);}catch(_0x102791){utils[_0x0f84('0x10')](util[_0x0f84('0x2')](_0x0f84('0x12'),_0x3390d7['origtransfereruniqueid']),_0x102791);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9d30c5e..95128fb 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 _0x7623=['GetVoiceQueue','name','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','info','inspect','debug','then','[utils][request]\x20name:%s','request','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','error','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','catch','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x5ed7a7,_0x15b29f){var _0x264b20=function(_0x3b0c9a){while(--_0x3b0c9a){_0x5ed7a7['push'](_0x5ed7a7['shift']());}};_0x264b20(++_0x15b29f);}(_0x7623,0x11e));var _0x3762=function(_0x262417,_0x9b9f85){_0x262417=_0x262417-0x0;var _0x4404f7=_0x7623[_0x262417];return _0x4404f7;};'use strict';var BPromise=require(_0x3762('0x0'));var jayson=require(_0x3762('0x1'));var moment=require(_0x3762('0x2'));var util=require('util');var client=jayson[_0x3762('0x3')]['http']({'port':0x2329});var logger=require(_0x3762('0x4'))('xdr');exports['info']=function(_0x1fe2e8,_0xf64609){logger[_0x3762('0x5')](_0x1fe2e8,_0xf64609?util[_0x3762('0x6')](_0xf64609,{'showHidden':![],'depth':null}):'');};exports[_0x3762('0x7')]=function(_0x264cd2,_0x43c910){logger[_0x3762('0x7')](_0x264cd2,_0x43c910?util['inspect'](_0x43c910,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x29846c,_0x524c1f){logger['error'](_0x29846c,_0x524c1f?util[_0x3762('0x6')](_0x524c1f,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x240f05,_0x8b5ef8){return client['request'](_0x240f05,{'body':_0x8b5ef8})[_0x3762('0x8')](function(_0x20beb9){logger[_0x3762('0x7')](_0x3762('0x9'),_0x240f05,_0x20beb9?util[_0x3762('0x6')](_0x20beb9,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3e6ea2){logger['error'](_0x3762('0x9'),_0x240f05,_0x3e6ea2?util[_0x3762('0x6')](_0x3e6ea2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3eb22f){return client[_0x3762('0xa')](_0x3762('0xb'),{'options':{'raw':!![],'attributes':['id',_0x3762('0xc'),'name',_0x3762('0xd')],'where':_0x3eb22f,'limit':0x1}})[_0x3762('0x8')](function(_0x45e839){logger['debug'](_0x3762('0xe'),JSON[_0x3762('0xf')](_0x3eb22f),_0x45e839?util['inspect'](_0x45e839,{'showHidden':![],'depth':null}):'');return _0x45e839['result'][_0x3762('0x10')]?_0x45e839[_0x3762('0x11')][0x0]:null;});}exports[_0x3762('0x12')]=function(_0x58c2e4){return new BPromise(function(_0x3de2ac,_0x510566){if(_0x58c2e4){return getUser({'internal':_0x58c2e4})[_0x3762('0x8')](function(_0x577cd8){logger['info'](_0x3762('0x13'),_0x58c2e4,_0x577cd8?'found':_0x3762('0x14'));return _0x3de2ac(_0x577cd8);})['catch'](function(_0x115b4d){logger[_0x3762('0x15')]('[utils][getUserByInternal]',_0x115b4d?util[_0x3762('0x6')](_0x115b4d,{'showHidden':![],'depth':null}):'');return _0x3de2ac(null);});}return _0x3de2ac(null);});};exports[_0x3762('0x16')]=function(_0x5268f1){return new BPromise(function(_0x19b4f5,_0x366312){if(_0x5268f1){return getUser({'interface':_0x5268f1})[_0x3762('0x8')](function(_0x48ac7a){logger[_0x3762('0x5')](_0x3762('0x17'),_0x5268f1,_0x48ac7a?_0x3762('0x18'):'notfound');return _0x19b4f5(_0x48ac7a);})[_0x3762('0x19')](function(_0x129124){logger[_0x3762('0x15')](_0x3762('0x1a'),_0x129124?util[_0x3762('0x6')](_0x129124,{'showHidden':![],'depth':null}):'');return _0x19b4f5(null);});}return _0x19b4f5(null);});};exports['getUserByName']=function(_0x1b20f3){return new BPromise(function(_0x91fcd8,_0x4e602c){if(_0x1b20f3){return getUser({'name':_0x1b20f3})[_0x3762('0x8')](function(_0xa27d52){logger['info'](_0x3762('0x1b'),_0x1b20f3,_0xa27d52?_0x3762('0x18'):_0x3762('0x14'));return _0x91fcd8(_0xa27d52);})[_0x3762('0x19')](function(_0x2f984c){logger[_0x3762('0x15')](_0x3762('0x1c'),_0x2f984c?util[_0x3762('0x6')](_0x2f984c,{'showHidden':![],'depth':null}):'');return _0x91fcd8(null);});}return _0x91fcd8(null);});};exports['getVoiceQueueByName']=function(_0x1838f6){return new BPromise(function(_0x4b64ae,_0x32fdd4){if(_0x1838f6){return client[_0x3762('0xa')](_0x3762('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x3762('0x1e'),'type','acw',_0x3762('0x1f')],'where':{'name':_0x1838f6},'limit':0x1}})[_0x3762('0x8')](function(_0x4f2fee){logger['debug'](_0x3762('0x20'),_0x1838f6,_0x4f2fee?util['inspect'](_0x4f2fee,{'showHidden':![],'depth':null}):'');logger[_0x3762('0x5')](_0x3762('0x21'),_0x1838f6,_0x4f2fee?'found':_0x3762('0x14'));return _0x4b64ae(_0x4f2fee[_0x3762('0x11')][_0x3762('0x10')]?_0x4f2fee[_0x3762('0x11')][0x0]:null);})[_0x3762('0x19')](function(_0x4d9f55){logger[_0x3762('0x15')](_0x3762('0x22'),_0x4d9f55?util['inspect'](_0x4d9f55,{'showHidden':![],'depth':null}):'');return _0x4b64ae(null);});}return _0x4b64ae(null);});};exports['addTime']=function(_0x1b5b2b,_0x542046){return moment(_0x1b5b2b)[_0x3762('0x23')](_0x542046,_0x3762('0x24'))['format'](_0x3762('0x25'));};exports[_0x3762('0x26')]=function(_0x1cd8cd,_0x19a850){return moment(_0x1cd8cd)['subtract'](_0x19a850,_0x3762('0x24'))[_0x3762('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2dc4d6,_0x135723){return moment(_0x2dc4d6)[_0x3762('0x28')](moment(_0x135723),'seconds');};exports[_0x3762('0x29')]=function(_0x2dcffd,_0x23cccb){return parseInt(_0x2dcffd,0xa)+parseInt(_0x23cccb,0xa);};exports[_0x3762('0x2a')]=function(){return moment()['format'](_0x3762('0x25'));};exports[_0x3762('0x2b')]=function(_0x561282,_0x4cb8dc){if(_0x4cb8dc){return moment(_0x561282)[_0x3762('0x2b')](_0x4cb8dc);}return!![];};exports[_0x3762('0x2c')]=function(_0xa40161,_0x441f6c){if(_0x441f6c){return moment(_0xa40161)[_0x3762('0x2c')](_0x441f6c);}else if(_0xa40161){return!![];}return![];}; \ No newline at end of file +var _0xf273=['[utils][request]\x20name:%s','internal','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','sumTime','now','isAfter','isBefore','bluebird','moment','../../config/logger','info','inspect','debug','error','request','catch'];(function(_0x4ad063,_0x5eddd0){var _0x12c738=function(_0x5359a6){while(--_0x5359a6){_0x4ad063['push'](_0x4ad063['shift']());}};_0x12c738(++_0x5eddd0);}(_0xf273,0x75));var _0x3f27=function(_0x2efc2d,_0x1efd65){_0x2efc2d=_0x2efc2d-0x0;var _0x2c7ee3=_0xf273[_0x2efc2d];return _0x2c7ee3;};'use strict';var BPromise=require(_0x3f27('0x0'));var jayson=require('jayson/promise');var moment=require(_0x3f27('0x1'));var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x3f27('0x2'))('xdr');exports['info']=function(_0x5bb9d6,_0xf1d53e){logger[_0x3f27('0x3')](_0x5bb9d6,_0xf1d53e?util[_0x3f27('0x4')](_0xf1d53e,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x5')]=function(_0x26e5d0,_0x51736a){logger[_0x3f27('0x5')](_0x26e5d0,_0x51736a?util[_0x3f27('0x4')](_0x51736a,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x6')]=function(_0x290af2,_0x48f0b9){logger[_0x3f27('0x6')](_0x290af2,_0x48f0b9?util[_0x3f27('0x4')](_0x48f0b9,{'showHidden':![],'depth':null}):'');};exports[_0x3f27('0x7')]=function(_0x3acaee,_0xe07905){return client[_0x3f27('0x7')](_0x3acaee,{'body':_0xe07905})['then'](function(_0x4a71d7){logger['debug']('[utils][request]\x20name:%s',_0x3acaee,_0x4a71d7?util['inspect'](_0x4a71d7,{'showHidden':![],'depth':null}):'');})[_0x3f27('0x8')](function(_0x1e19a0){logger[_0x3f27('0x6')](_0x3f27('0x9'),_0x3acaee,_0x1e19a0?util['inspect'](_0x1e19a0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4102d7){return client[_0x3f27('0x7')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x3f27('0xa'),'name','interface'],'where':_0x4102d7,'limit':0x1}})[_0x3f27('0xb')](function(_0x4ec637){logger[_0x3f27('0x5')](_0x3f27('0xc'),JSON['stringify'](_0x4102d7),_0x4ec637?util[_0x3f27('0x4')](_0x4ec637,{'showHidden':![],'depth':null}):'');return _0x4ec637[_0x3f27('0xd')][_0x3f27('0xe')]?_0x4ec637[_0x3f27('0xd')][0x0]:null;});}exports[_0x3f27('0xf')]=function(_0x43ec08){return new BPromise(function(_0x47427b,_0x47efd9){if(_0x43ec08){return getUser({'internal':_0x43ec08})['then'](function(_0x40857c){logger[_0x3f27('0x3')](_0x3f27('0x10'),_0x43ec08,_0x40857c?_0x3f27('0x11'):_0x3f27('0x12'));return _0x47427b(_0x40857c);})[_0x3f27('0x8')](function(_0x163138){logger['error'](_0x3f27('0x13'),_0x163138?util[_0x3f27('0x4')](_0x163138,{'showHidden':![],'depth':null}):'');return _0x47427b(null);});}return _0x47427b(null);});};exports[_0x3f27('0x14')]=function(_0x2dbefb){return new BPromise(function(_0x12a509,_0x38519c){if(_0x2dbefb){return getUser({'interface':_0x2dbefb})[_0x3f27('0xb')](function(_0x24ac92){logger['info'](_0x3f27('0x15'),_0x2dbefb,_0x24ac92?_0x3f27('0x11'):'notfound');return _0x12a509(_0x24ac92);})['catch'](function(_0x361ed9){logger[_0x3f27('0x6')]('[utils][getUserByInterface]',_0x361ed9?util[_0x3f27('0x4')](_0x361ed9,{'showHidden':![],'depth':null}):'');return _0x12a509(null);});}return _0x12a509(null);});};exports[_0x3f27('0x16')]=function(_0xa92aae){return new BPromise(function(_0x494a3c,_0x775b23){if(_0xa92aae){return getUser({'name':_0xa92aae})[_0x3f27('0xb')](function(_0x483501){logger[_0x3f27('0x3')]('[utils][getUserByName]\x20name:%s\x20%s',_0xa92aae,_0x483501?_0x3f27('0x11'):_0x3f27('0x12'));return _0x494a3c(_0x483501);})['catch'](function(_0x3c626){logger['error'](_0x3f27('0x17'),_0x3c626?util['inspect'](_0x3c626,{'showHidden':![],'depth':null}):'');return _0x494a3c(null);});}return _0x494a3c(null);});};exports[_0x3f27('0x18')]=function(_0x293b7){return new BPromise(function(_0x230f8a,_0x4137e0){if(_0x293b7){return client[_0x3f27('0x7')](_0x3f27('0x19'),{'options':{'raw':!![],'attributes':['id',_0x3f27('0x1a'),_0x3f27('0x1b'),_0x3f27('0x1c'),'acwTimeout'],'where':{'name':_0x293b7},'limit':0x1}})['then'](function(_0x234a77){logger[_0x3f27('0x5')](_0x3f27('0x1d'),_0x293b7,_0x234a77?util['inspect'](_0x234a77,{'showHidden':![],'depth':null}):'');logger['info'](_0x3f27('0x1e'),_0x293b7,_0x234a77?_0x3f27('0x11'):'notfound');return _0x230f8a(_0x234a77[_0x3f27('0xd')][_0x3f27('0xe')]?_0x234a77[_0x3f27('0xd')][0x0]:null);})[_0x3f27('0x8')](function(_0x309786){logger[_0x3f27('0x6')](_0x3f27('0x1f'),_0x309786?util[_0x3f27('0x4')](_0x309786,{'showHidden':![],'depth':null}):'');return _0x230f8a(null);});}return _0x230f8a(null);});};exports[_0x3f27('0x20')]=function(_0x55cf8f,_0x53fb87){return moment(_0x55cf8f)[_0x3f27('0x21')](_0x53fb87,_0x3f27('0x22'))[_0x3f27('0x23')](_0x3f27('0x24'));};exports[_0x3f27('0x25')]=function(_0x4ec28d,_0x376921){return moment(_0x4ec28d)['subtract'](_0x376921,_0x3f27('0x22'))[_0x3f27('0x23')](_0x3f27('0x24'));};exports['diffTime']=function(_0x2e6aae,_0x48b3dc){return moment(_0x2e6aae)['diff'](moment(_0x48b3dc),_0x3f27('0x22'));};exports[_0x3f27('0x26')]=function(_0x10b1fa,_0x29e579){return parseInt(_0x10b1fa,0xa)+parseInt(_0x29e579,0xa);};exports[_0x3f27('0x27')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x67c714,_0x1b3783){if(_0x1b3783){return moment(_0x67c714)[_0x3f27('0x28')](_0x1b3783);}return!![];};exports['isBefore']=function(_0x46a2b4,_0x48e872){if(_0x48e872){return moment(_0x46a2b4)[_0x3f27('0x29')](_0x48e872);}else if(_0x46a2b4){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 4fc077d..0aaae98 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf064=['format','method','x-forwarded-for','headers','connection','statusCode','responseTime','inspect','device','agent_id','remoteAddress','url','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','xcally','join','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','isEmpty','body','\x20body=%s'];(function(_0x5f4b42,_0x5e8c8d){var _0x2c5911=function(_0x5d00e4){while(--_0x5d00e4){_0x5f4b42['push'](_0x5f4b42['shift']());}};_0x2c5911(++_0x5e8c8d);}(_0xf064,0x160));var _0x4f06=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xf064[_0x80d733];return _0x435868;};var fs=require(_0x4f06('0x0'));var _=require('lodash');var ewinston=require(_0x4f06('0x1'));var path=require(_0x4f06('0x2'));var util=require(_0x4f06('0x3'));var fileLogger=require('./loggers')[_0x4f06('0x4')];var safeTemplate=require('./safe-template')[_0x4f06('0x5')];var maskSensitiveData=require(_0x4f06('0x6'))[_0x4f06('0x7')];function ClientSideLogger(){function _0x37c256(_0x15386e){var _0x540f20=path['join'](_0x4f06('0x8'),'log',_0x4f06('0x9'));var _0x185c52=path[_0x4f06('0xa')](_0x4f06('0xb'),_0x15386e[_0x4f06('0xc')]+'-'+_0x15386e[_0x4f06('0xd')]);return fs[_0x4f06('0xe')](path['join'](_0x540f20,_0x185c52))[_0x4f06('0xf')](function(){var _0x34ea47=fileLogger('client',path['join'](_0x540f20,_0x185c52));return _0x34ea47;})[_0x4f06('0x10')](function(_0x1a6746){throw _0x1a6746;});}this[_0x4f06('0x11')]=function(_0x38130b,_0x535411,_0x27c028,_0x1407a6){return _0x37c256(_0x38130b[_0x4f06('0x12')])[_0x4f06('0xf')](function(_0x20f567){var _0x3adcf2=_0x20f567[_0x535411];return _0x3adcf2;})[_0x4f06('0xf')](function(_0x15f1c7){var _0x5281a1=_0x38130b[_0x4f06('0x12')]?_0x38130b['user']['id']:_0x4f06('0x13');var _0x284fc7=_0x1407a6[_0x4f06('0x14')];var _0x4af872=_0x1407a6[_0x4f06('0x15')];var _0x1b44f8=new Date(Number(_0x4af872));return _0x15f1c7(_0x5281a1,_0x1b44f8,_0x27c028,_0x284fc7);})[_0x4f06('0x10')](function(_0x3772a3){fileLogger(_0x4f06('0xb'))[_0x4f06('0x16')](_0x3772a3);});};}function setupLoggers(_0x19b51d){return new Promise(function(_0x30b314){var _0x2549c8=new ClientSideLogger();var _0x3b8a6d=fileLogger(_0x4f06('0x17'));var _0x206c91=fileLogger(_0x4f06('0x18'));_0x19b51d[_0x4f06('0x19')](_0x4f06('0x1a'),_0x2549c8);_0x19b51d[_0x4f06('0x1b')](ewinston[_0x4f06('0x1c')]({'winstonInstance':_0x3b8a6d,'meta':![],'statusLevels':!![],'msg':function(_0x261fb4,_0x1de50a){var _0x165f14='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4f06('0x1d')](_0x261fb4[_0x4f06('0x1e')])){_0x165f14+=_0x4f06('0x1f');var _0x18e5cc=_0x261fb4['body'];maskSensitiveData(_0x18e5cc);}return safeTemplate(util[_0x4f06('0x20')](_0x165f14,_0x261fb4[_0x4f06('0x21')],_0x261fb4['headers'][_0x4f06('0x22')]?_0x261fb4[_0x4f06('0x23')][_0x4f06('0x22')]:_0x261fb4[_0x4f06('0x24')]['remoteAddress']||_0x261fb4['ip'],_0x261fb4['url'],_0x1de50a[_0x4f06('0x25')],_0x1de50a[_0x4f06('0x26')],_0x261fb4[_0x4f06('0x12')]?_0x261fb4[_0x4f06('0x12')]['id']:null,_0x261fb4[_0x4f06('0x12')]?_0x261fb4[_0x4f06('0x12')][_0x4f06('0xd')]:null,_0x261fb4[_0x4f06('0x12')]?_0x261fb4[_0x4f06('0x12')][_0x4f06('0xc')]:null,_0x18e5cc?util[_0x4f06('0x27')](_0x18e5cc,![],null):''));}}));_0x19b51d[_0x4f06('0x1b')](ewinston[_0x4f06('0x1c')]({'winstonInstance':_0x206c91,'meta':![],'statusLevels':!![],'msg':function(_0x16165b,_0x40ef7a){var _0x476d2f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x16165b['body']&&_0x16165b[_0x4f06('0x1e')][_0x4f06('0x28')]&&_0x16165b['body'][_0x4f06('0x29')]){_0x476d2f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4f06('0x20')](_0x476d2f,_0x16165b[_0x4f06('0x21')],_0x16165b[_0x4f06('0x23')][_0x4f06('0x22')]?_0x16165b[_0x4f06('0x23')]['x-forwarded-for']:_0x16165b[_0x4f06('0x24')][_0x4f06('0x2a')]||_0x16165b['ip'],_0x16165b[_0x4f06('0x2b')],_0x40ef7a[_0x4f06('0x25')],_0x40ef7a[_0x4f06('0x26')],_0x16165b[_0x4f06('0x12')]?_0x16165b[_0x4f06('0x12')]['id']:null,_0x16165b[_0x4f06('0x12')]?_0x16165b[_0x4f06('0x12')][_0x4f06('0xd')]:null,_0x16165b[_0x4f06('0x12')]?_0x16165b[_0x4f06('0x12')][_0x4f06('0xc')]:null,_0x16165b['body']&&_0x16165b[_0x4f06('0x1e')][_0x4f06('0x28')]?_0x16165b[_0x4f06('0x1e')][_0x4f06('0x28')]:_0x4f06('0x2c'),_0x16165b[_0x4f06('0x1e')]&&_0x16165b[_0x4f06('0x1e')][_0x4f06('0x29')]?_0x16165b['body'][_0x4f06('0x29')]:'',_0x16165b['body']&&_0x16165b[_0x4f06('0x1e')][_0x4f06('0x2d')]?_0x16165b[_0x4f06('0x1e')]['agent_name']:'');},'ignoreRoute':function(_0x32e9cb){var _0x184b17=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x184b17[_0x4f06('0x2e')](_0x32e9cb['url']);}}));return _0x30b314();});}exports[_0x4f06('0x2f')]=setupLoggers; \ No newline at end of file +var _0xa290=['statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_name','test','setupLoggers','fs-extra','fileLogger','safeTemplate','join','/var','log','xcally','client','role','name','then','user','no-user','data','timestamp','catch','error','auth','set','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','url'];(function(_0x4f052e,_0x5ae643){var _0x42743e=function(_0x39346e){while(--_0x39346e){_0x4f052e['push'](_0x4f052e['shift']());}};_0x42743e(++_0x5ae643);}(_0xa290,0x1c3));var _0x0a29=function(_0x5bc881,_0x546cda){_0x5bc881=_0x5bc881-0x0;var _0x399dd5=_0xa290[_0x5bc881];return _0x399dd5;};var fs=require(_0x0a29('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require('./loggers')[_0x0a29('0x1')];var safeTemplate=require('./safe-template')[_0x0a29('0x2')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x5d8c53(_0x1b85e0){var _0x90f29c=path[_0x0a29('0x3')](_0x0a29('0x4'),_0x0a29('0x5'),_0x0a29('0x6'));var _0x47c623=path[_0x0a29('0x3')](_0x0a29('0x7'),_0x1b85e0[_0x0a29('0x8')]+'-'+_0x1b85e0[_0x0a29('0x9')]);return fs['ensureDir'](path['join'](_0x90f29c,_0x47c623))[_0x0a29('0xa')](function(){var _0x3a20d2=fileLogger(_0x0a29('0x7'),path[_0x0a29('0x3')](_0x90f29c,_0x47c623));return _0x3a20d2;})['catch'](function(_0x1d66de){throw _0x1d66de;});}this[_0x0a29('0x5')]=function(_0x393b60,_0x25cf16,_0x1a46ee,_0x185c60){return _0x5d8c53(_0x393b60['user'])[_0x0a29('0xa')](function(_0x541fe4){var _0x3d112b=_0x541fe4[_0x25cf16];return _0x3d112b;})['then'](function(_0x2673cd){var _0x2d300e=_0x393b60['user']?_0x393b60[_0x0a29('0xb')]['id']:_0x0a29('0xc');var _0x2adc64=_0x185c60[_0x0a29('0xd')];var _0x78aa05=_0x185c60[_0x0a29('0xe')];var _0x21af40=new Date(Number(_0x78aa05));return _0x2673cd(_0x2d300e,_0x21af40,_0x1a46ee,_0x2adc64);})[_0x0a29('0xf')](function(_0x54b56e){fileLogger(_0x0a29('0x7'))[_0x0a29('0x10')](_0x54b56e);});};}function setupLoggers(_0x29606d){return new Promise(function(_0x16662c){var _0x25b5f0=new ClientSideLogger();var _0x240028=fileLogger('api');var _0x586279=fileLogger(_0x0a29('0x11'));_0x29606d[_0x0a29('0x12')]('client-side-logger',_0x25b5f0);_0x29606d[_0x0a29('0x13')](ewinston[_0x0a29('0x14')]({'winstonInstance':_0x240028,'meta':![],'statusLevels':!![],'msg':function(_0x36c245,_0x35827e){var _0x27c08a=_0x0a29('0x15');if(!_[_0x0a29('0x16')](_0x36c245[_0x0a29('0x17')])){_0x27c08a+='\x20body=%s';var _0x363fb2=_0x36c245[_0x0a29('0x17')];maskSensitiveData(_0x363fb2);}return safeTemplate(util[_0x0a29('0x18')](_0x27c08a,_0x36c245[_0x0a29('0x19')],_0x36c245[_0x0a29('0x1a')][_0x0a29('0x1b')]?_0x36c245[_0x0a29('0x1a')]['x-forwarded-for']:_0x36c245['connection']['remoteAddress']||_0x36c245['ip'],_0x36c245[_0x0a29('0x1c')],_0x35827e[_0x0a29('0x1d')],_0x35827e['responseTime'],_0x36c245[_0x0a29('0xb')]?_0x36c245[_0x0a29('0xb')]['id']:null,_0x36c245[_0x0a29('0xb')]?_0x36c245[_0x0a29('0xb')][_0x0a29('0x9')]:null,_0x36c245[_0x0a29('0xb')]?_0x36c245['user'][_0x0a29('0x8')]:null,_0x363fb2?util[_0x0a29('0x1e')](_0x363fb2,![],null):''));}}));_0x29606d['use'](ewinston[_0x0a29('0x14')]({'winstonInstance':_0x586279,'meta':![],'statusLevels':!![],'msg':function(_0x182158,_0x36aa34){var _0xe66c5f=_0x0a29('0x1f');if(_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x20')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]){_0xe66c5f=_0x0a29('0x22');}return util[_0x0a29('0x18')](_0xe66c5f,_0x182158['method'],_0x182158[_0x0a29('0x1a')][_0x0a29('0x1b')]?_0x182158[_0x0a29('0x1a')][_0x0a29('0x1b')]:_0x182158['connection']['remoteAddress']||_0x182158['ip'],_0x182158['url'],_0x36aa34[_0x0a29('0x1d')],_0x36aa34[_0x0a29('0x23')],_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['id']:null,_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['name']:null,_0x182158[_0x0a29('0xb')]?_0x182158[_0x0a29('0xb')]['role']:null,_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')]['device']?_0x182158['body'][_0x0a29('0x20')]:_0x0a29('0x24'),_0x182158['body']&&_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]?_0x182158[_0x0a29('0x17')][_0x0a29('0x21')]:'',_0x182158[_0x0a29('0x17')]&&_0x182158[_0x0a29('0x17')][_0x0a29('0x25')]?_0x182158[_0x0a29('0x17')]['agent_name']:'');},'ignoreRoute':function(_0x78a033){var _0x24e622=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24e622[_0x0a29('0x26')](_0x78a033[_0x0a29('0x1c')]);}}));return _0x16662c();});}exports[_0x0a29('0x27')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1e7bbc0..17bb60b 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x889f=['split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','startOf','day','endOf','isBetween','format','ddd','includes','dowCompare','daysInMonth','min','max','domCompare','MMM','monthCompare','guess','test','isMoment','length','padStart','iftime','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x889f,0x1d9));var _0xf889=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x889f[_0xfcbcb8];return _0x1b1f97;};var _=require(_0xf889('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xf889('0x1')](function(_0x12fbcd){return _0x12fbcd[_0xf889('0x2')];})[_0xf889('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf889('0x4');var EINVALID_DATE=_0xf889('0x5');function throwIfDateNotValid(_0x2e5fc4){if(!_0x2e5fc4[_0xf889('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5dc99c){var _0x598f85=_0x5dc99c[_0xf889('0x7')](':')[_0xf889('0x1')](function(_0x44742b){return parseInt(_0x44742b,0xa);});var _0x4e9f20=_0x598f85[0x0];var _0x2ad3ab=_0x598f85[0x1];if(_0x4e9f20<0x0||_0x4e9f20>0x17||_0x2ad3ab<0x0||_0x2ad3ab>0x3b){throw new Error(EINVALID_DATE);}return[_0x4e9f20,_0x2ad3ab];}function circularDoWInterval(_0x11ebb0,_0x58764e){if(_0x11ebb0===_0x58764e){return[_0x11ebb0];}else{var _0x363a53=moment[_0xf889('0x8')]();moment[_0xf889('0x8')]('en');var _0xf4decb=moment[_0xf889('0x9')]()[_0xf889('0x1')](function(_0x15c859){return _0x15c859[_0xf889('0xa')]();});moment[_0xf889('0x8')](_0x363a53);var _0x52a165=_0xf4decb[_0xf889('0xb')](_0x11ebb0);var _0x2de940=_0xf4decb[_0xf889('0xb')](_0x58764e);if(_0x2de940>_0x52a165){return _0xf4decb[_0xf889('0xc')](_0x52a165,_0x2de940+0x1);}else{var _0x1c9302=_0xf4decb[_0xf889('0xc')](0x0,_0x2de940+0x1);var _0x260468=_0xf4decb[_0xf889('0xc')](_0x52a165);return _0x260468[_0xf889('0xd')](_0x1c9302);}}}module[_0xf889('0xe')][_0xf889('0xf')]=circularDoWInterval;function circularMonthInterval(_0x408368,_0x351c83){if(_0x408368===_0x351c83){return[_0x408368];}else{var _0x4f3bea=moment[_0xf889('0x8')]();moment[_0xf889('0x8')]('en');var _0x5c8b8a=moment[_0xf889('0x10')]()[_0xf889('0x1')](function(_0x459eb7){return _0x459eb7[_0xf889('0xa')]();});moment[_0xf889('0x8')](_0x4f3bea);var _0x4ed0bb=_0x5c8b8a[_0xf889('0xb')](_0x408368);var _0x1f9234=_0x5c8b8a[_0xf889('0xb')](_0x351c83);if(_0x1f9234>_0x4ed0bb){return _0x5c8b8a[_0xf889('0xc')](_0x4ed0bb,_0x1f9234+0x1);}else{var _0x3551ff=_0x5c8b8a[_0xf889('0xc')](0x0,_0x1f9234+0x1);var _0x40c479=_0x5c8b8a[_0xf889('0xc')](_0x4ed0bb);return _0x40c479['concat'](_0x3551ff);}}}module[_0xf889('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x4e3371){var _0x5cfbdb=parseInt(_0x4e3371,0xa);if(_0x5cfbdb<0x1||_0x5cfbdb>0x1f){throw new Error(EINVALID_DATE);}return _0x5cfbdb;}function timeCompare(_0x12c1c3,_0xa08888,_0x115579){var _0xef1055=_0x12c1c3[_0xf889('0x11')]();var _0x2be61f=extractTime(_0xa08888);var _0x440673=_0x2be61f[0x0];var _0x17c0d8=_0x2be61f[0x1];var _0x536a06=_0x12c1c3[_0xf889('0x11')]()[_0xf889('0x12')](_0x440673)[_0xf889('0x13')](_0x17c0d8);throwIfDateNotValid(_0x536a06);var _0x4db1c0=extractTime(_0x115579);var _0x10ae5c=_0x4db1c0[0x0];var _0x3b5e70=_0x4db1c0[0x1];var _0x24b9e1=_0x12c1c3[_0xf889('0x11')]()[_0xf889('0x12')](_0x10ae5c)[_0xf889('0x13')](_0x3b5e70);throwIfDateNotValid(_0x24b9e1);if(_0x24b9e1['isBefore'](_0x536a06)){var _0x2ec30c=_0xef1055[_0xf889('0x11')]()[_0xf889('0x14')](_0xf889('0x15'));var _0x3b96c7=_0xef1055[_0xf889('0x11')]()[_0xf889('0x16')](_0xf889('0x15'));return _0xef1055['isBetween'](_0x536a06,_0x3b96c7,undefined,'[]')||_0xef1055[_0xf889('0x17')](_0x2ec30c,_0x24b9e1,undefined,'[]');}else{return _0xef1055['isBetween'](_0x536a06,_0x24b9e1,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x12a3b8,_0x223d16,_0x1cb681){var _0x6c0bfe=_0x12a3b8[_0xf889('0x8')]('en')[_0xf889('0x18')](_0xf889('0x19'))[_0xf889('0xa')]();return circularDoWInterval(_0x223d16,_0x1cb681)[_0xf889('0x1a')](_0x6c0bfe);}module[_0xf889('0xe')][_0xf889('0x1b')]=dowCompare;function domCompare(_0x5c1ae4,_0x3ba355,_0x3db7f2){var _0x51a6e4=_0x5c1ae4['date']();if(_0x3ba355===_0x3db7f2){return _0x51a6e4===_0x3ba355;}else{var _0x46b969=_0x5c1ae4[_0xf889('0x1c')]();var _0xaae8cf=_0x3ba355<_0x3db7f2;let _0x4a1bb5=![];var _0x23f0ba=0x0;var _0x1ac56f=0x0;if(_0xaae8cf){_0x23f0ba=Math['max'](0x1,_0x3ba355);_0x1ac56f=Math[_0xf889('0x1d')](_0x3db7f2,_0x46b969);_0x4a1bb5=_0x51a6e4>=_0x23f0ba&&_0x51a6e4<=_0x1ac56f;}else{_0x23f0ba=Math[_0xf889('0x1d')](_0x3ba355,_0x46b969);_0x1ac56f=Math[_0xf889('0x1e')](0x1,_0x3db7f2);_0x4a1bb5=_0x51a6e4>=_0x23f0ba||_0x51a6e4<=_0x1ac56f;}return _0x4a1bb5;}}module[_0xf889('0xe')][_0xf889('0x1f')]=domCompare;function monthCompare(_0x493634,_0x5f03d0,_0x1c7d52){var _0xedc365=_0x493634[_0xf889('0x8')]('en')['format'](_0xf889('0x20'))[_0xf889('0xa')]();return circularMonthInterval(_0x5f03d0,_0x1c7d52)[_0xf889('0x1a')](_0xedc365);}module['exports'][_0xf889('0x21')]=monthCompare;function iftime(_0x1894f4,_0x1498b6=moment['tz'][_0xf889('0x22')](),_0x1355c7=moment()){if(!validateRx[_0xf889('0x23')](_0x1894f4)){throw new Error(EINVALID_STRING);}else{var _0x4870cf=(moment[_0xf889('0x24')](_0x1355c7)?_0x1355c7[_0xf889('0x11')]():moment(_0x1355c7))['tz'](_0x1498b6)['locale']('en');throwIfDateNotValid(_0x4870cf);var _0x2536ae=_0x1894f4[_0xf889('0x7')](',');var _0x43443d=_0x2536ae[0x0];var _0x13c9e8=_0x2536ae[0x1];var _0x1bdbba=_0x2536ae[0x2];var _0x2dd46b=_0x2536ae[0x3];let _0x1cb01c=!![];if(_0x43443d!=='*'){var _0x419a55=_0x43443d[_0xf889('0x7')]('-');var _0x1c1fa6=_['padStart'](_0x419a55[0x0],0x5,'0');var _0x2c94cd=_0x419a55[_0xf889('0x25')]===0x2?_[_0xf889('0x26')](_0x419a55[0x1],0x5,'0'):_0x1c1fa6;_0x1cb01c=timeCompare(_0x4870cf,_0x1c1fa6,_0x2c94cd);}let _0x362114=!![];if(_0x13c9e8!=='*'){var _0x395f1c=_0x13c9e8[_0xf889('0x7')]('-');var _0xe8ad2e=_0x395f1c[0x0];var _0x25cfc9=_0x395f1c[_0xf889('0x25')]===0x2?_0x395f1c[0x1]:_0xe8ad2e;_0x362114=dowCompare(_0x4870cf,_0xe8ad2e,_0x25cfc9);}let _0x14a46a=!![];if(_0x1bdbba!=='*'){var _0x112dc8=_0x1bdbba[_0xf889('0x7')]('-');var _0x1be576=parseDom(_0x112dc8[0x0]);var _0x5be0e1=_0x112dc8[_0xf889('0x25')]===0x2?parseDom(_0x112dc8[0x1]):_0x1be576;_0x14a46a=domCompare(_0x4870cf,_0x1be576,_0x5be0e1);}let _0x3d3864=!![];if(_0x2dd46b!=='*'){var _0x3f56ab=_0x2dd46b[_0xf889('0x7')]('-');var _0x5a5c23=_0x3f56ab[0x0];var _0x47fe37=_0x3f56ab[_0xf889('0x25')]===0x2?_0x3f56ab[0x1]:_0x3f56ab[0x0];_0x3d3864=monthCompare(_0x4870cf,_0x5a5c23,_0x47fe37);}return _0x1cb01c&&_0x362114&&_0x14a46a&&_0x3d3864;}}module[_0xf889('0xe')][_0xf889('0x27')]=iftime; \ No newline at end of file +var _0x9499=['hours','minutes','isBefore','day','isBetween','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','format','MMM','monthCompare','guess','test','isMoment','split','length','padStart','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone'];(function(_0xda6ee6,_0x59c8b1){var _0x313510=function(_0x292ee9){while(--_0x292ee9){_0xda6ee6['push'](_0xda6ee6['shift']());}};_0x313510(++_0x59c8b1);}(_0x9499,0x65));var _0x9949=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9499[_0x1cc8fe];return _0x230054;};var _=require(_0x9949('0x0'));var moment=require(_0x9949('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9949('0x2')](function(_0x3ca430){return _0x3ca430[_0x9949('0x3')];})[_0x9949('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9949('0x5');var EINVALID_DATE=_0x9949('0x6');function throwIfDateNotValid(_0x247a61){if(!_0x247a61[_0x9949('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x26d4cb){var _0x1cdc34=_0x26d4cb['split'](':')[_0x9949('0x2')](function(_0x5a7a04){return parseInt(_0x5a7a04,0xa);});var _0x2b14d6=_0x1cdc34[0x0];var _0x58a77d=_0x1cdc34[0x1];if(_0x2b14d6<0x0||_0x2b14d6>0x17||_0x58a77d<0x0||_0x58a77d>0x3b){throw new Error(EINVALID_DATE);}return[_0x2b14d6,_0x58a77d];}function circularDoWInterval(_0x24b77a,_0x3b3b20){if(_0x24b77a===_0x3b3b20){return[_0x24b77a];}else{var _0x34fd2b=moment[_0x9949('0x8')]();moment[_0x9949('0x8')]('en');var _0xa91109=moment[_0x9949('0x9')]()[_0x9949('0x2')](function(_0x48d575){return _0x48d575[_0x9949('0xa')]();});moment['locale'](_0x34fd2b);var _0x4200ab=_0xa91109[_0x9949('0xb')](_0x24b77a);var _0x64feea=_0xa91109[_0x9949('0xb')](_0x3b3b20);if(_0x64feea>_0x4200ab){return _0xa91109['slice'](_0x4200ab,_0x64feea+0x1);}else{var _0x3cdc7b=_0xa91109[_0x9949('0xc')](0x0,_0x64feea+0x1);var _0x165b06=_0xa91109[_0x9949('0xc')](_0x4200ab);return _0x165b06[_0x9949('0xd')](_0x3cdc7b);}}}module[_0x9949('0xe')][_0x9949('0xf')]=circularDoWInterval;function circularMonthInterval(_0x4b8f04,_0x100cb8){if(_0x4b8f04===_0x100cb8){return[_0x4b8f04];}else{var _0x10c8aa=moment[_0x9949('0x8')]();moment['locale']('en');var _0x42a07a=moment[_0x9949('0x10')]()[_0x9949('0x2')](function(_0x54a473){return _0x54a473[_0x9949('0xa')]();});moment['locale'](_0x10c8aa);var _0x10fd83=_0x42a07a[_0x9949('0xb')](_0x4b8f04);var _0xf76153=_0x42a07a[_0x9949('0xb')](_0x100cb8);if(_0xf76153>_0x10fd83){return _0x42a07a[_0x9949('0xc')](_0x10fd83,_0xf76153+0x1);}else{var _0x2af9c1=_0x42a07a[_0x9949('0xc')](0x0,_0xf76153+0x1);var _0x25b46b=_0x42a07a[_0x9949('0xc')](_0x10fd83);return _0x25b46b['concat'](_0x2af9c1);}}}module[_0x9949('0xe')][_0x9949('0x11')]=circularMonthInterval;function parseDom(_0x15da35){var _0xd1e740=parseInt(_0x15da35,0xa);if(_0xd1e740<0x1||_0xd1e740>0x1f){throw new Error(EINVALID_DATE);}return _0xd1e740;}function timeCompare(_0x46b6db,_0x304b06,_0x15dc72){var _0x524b29=_0x46b6db[_0x9949('0x12')]();var _0x3e75a8=extractTime(_0x304b06);var _0x364036=_0x3e75a8[0x0];var _0x4f71e8=_0x3e75a8[0x1];var _0x38d0eb=_0x46b6db[_0x9949('0x12')]()[_0x9949('0x13')](_0x364036)[_0x9949('0x14')](_0x4f71e8);throwIfDateNotValid(_0x38d0eb);var _0x4b391b=extractTime(_0x15dc72);var _0x278547=_0x4b391b[0x0];var _0x189e04=_0x4b391b[0x1];var _0x38bfe5=_0x46b6db['clone']()[_0x9949('0x13')](_0x278547)['minutes'](_0x189e04);throwIfDateNotValid(_0x38bfe5);if(_0x38bfe5[_0x9949('0x15')](_0x38d0eb)){var _0xca1c91=_0x524b29[_0x9949('0x12')]()['startOf'](_0x9949('0x16'));var _0x10848a=_0x524b29[_0x9949('0x12')]()['endOf'](_0x9949('0x16'));return _0x524b29[_0x9949('0x17')](_0x38d0eb,_0x10848a,undefined,'[]')||_0x524b29[_0x9949('0x17')](_0xca1c91,_0x38bfe5,undefined,'[]');}else{return _0x524b29[_0x9949('0x17')](_0x38d0eb,_0x38bfe5,undefined,'[]');}}module[_0x9949('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x38c7ef,_0x5efc2c,_0x1623d9){var _0x3fbcf3=_0x38c7ef[_0x9949('0x8')]('en')['format'](_0x9949('0x18'))[_0x9949('0xa')]();return circularDoWInterval(_0x5efc2c,_0x1623d9)[_0x9949('0x19')](_0x3fbcf3);}module[_0x9949('0xe')][_0x9949('0x1a')]=dowCompare;function domCompare(_0x491c4b,_0xbfda13,_0x44f83c){var _0x10d6cd=_0x491c4b['date']();if(_0xbfda13===_0x44f83c){return _0x10d6cd===_0xbfda13;}else{var _0x509d8c=_0x491c4b[_0x9949('0x1b')]();var _0x5562cc=_0xbfda13<_0x44f83c;let _0x22f509=![];var _0x37f3a8=0x0;var _0x10f244=0x0;if(_0x5562cc){_0x37f3a8=Math[_0x9949('0x1c')](0x1,_0xbfda13);_0x10f244=Math[_0x9949('0x1d')](_0x44f83c,_0x509d8c);_0x22f509=_0x10d6cd>=_0x37f3a8&&_0x10d6cd<=_0x10f244;}else{_0x37f3a8=Math[_0x9949('0x1d')](_0xbfda13,_0x509d8c);_0x10f244=Math[_0x9949('0x1c')](0x1,_0x44f83c);_0x22f509=_0x10d6cd>=_0x37f3a8||_0x10d6cd<=_0x10f244;}return _0x22f509;}}module[_0x9949('0xe')][_0x9949('0x1e')]=domCompare;function monthCompare(_0x1a4ea5,_0x219f5b,_0x1ac8f7){var _0x21a359=_0x1a4ea5[_0x9949('0x8')]('en')[_0x9949('0x1f')](_0x9949('0x20'))[_0x9949('0xa')]();return circularMonthInterval(_0x219f5b,_0x1ac8f7)[_0x9949('0x19')](_0x21a359);}module[_0x9949('0xe')][_0x9949('0x21')]=monthCompare;function iftime(_0x411f23,_0xaff0a6=moment['tz'][_0x9949('0x22')](),_0x39a06b=moment()){if(!validateRx[_0x9949('0x23')](_0x411f23)){throw new Error(EINVALID_STRING);}else{var _0x104bb4=(moment[_0x9949('0x24')](_0x39a06b)?_0x39a06b[_0x9949('0x12')]():moment(_0x39a06b))['tz'](_0xaff0a6)[_0x9949('0x8')]('en');throwIfDateNotValid(_0x104bb4);var _0xb5026d=_0x411f23['split'](',');var _0x1e073e=_0xb5026d[0x0];var _0x20ea3b=_0xb5026d[0x1];var _0x272402=_0xb5026d[0x2];var _0x155f52=_0xb5026d[0x3];let _0x2ff69d=!![];if(_0x1e073e!=='*'){var _0x38914f=_0x1e073e[_0x9949('0x25')]('-');var _0x14a46d=_['padStart'](_0x38914f[0x0],0x5,'0');var _0x1f54ce=_0x38914f[_0x9949('0x26')]===0x2?_[_0x9949('0x27')](_0x38914f[0x1],0x5,'0'):_0x14a46d;_0x2ff69d=timeCompare(_0x104bb4,_0x14a46d,_0x1f54ce);}let _0x130794=!![];if(_0x20ea3b!=='*'){var _0x509efb=_0x20ea3b[_0x9949('0x25')]('-');var _0x58d069=_0x509efb[0x0];var _0x3ac723=_0x509efb[_0x9949('0x26')]===0x2?_0x509efb[0x1]:_0x58d069;_0x130794=dowCompare(_0x104bb4,_0x58d069,_0x3ac723);}let _0x3ad72e=!![];if(_0x272402!=='*'){var _0x70516=_0x272402[_0x9949('0x25')]('-');var _0x50f0fe=parseDom(_0x70516[0x0]);var _0x31de09=_0x70516[_0x9949('0x26')]===0x2?parseDom(_0x70516[0x1]):_0x50f0fe;_0x3ad72e=domCompare(_0x104bb4,_0x50f0fe,_0x31de09);}let _0x6ce849=!![];if(_0x155f52!=='*'){var _0x4c3f23=_0x155f52[_0x9949('0x25')]('-');var _0x46928d=_0x4c3f23[0x0];var _0x48205e=_0x4c3f23[_0x9949('0x26')]===0x2?_0x4c3f23[0x1]:_0x4c3f23[0x0];_0x6ce849=monthCompare(_0x104bb4,_0x46928d,_0x48205e);}return _0x2ff69d&&_0x130794&&_0x3ad72e&&_0x6ce849;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1068e71..89885d0 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ca=['redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','File','error','%s-%s','Console','warn','fileLogger','util','moment','winston','../config/environment','toLowerCase','info'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xb1ca,0x1a7));var _0xab1c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb1ca[_0x19950b];return _0x3c6b41;};'use strict';var path=require('path');var util=require(_0xab1c('0x0'));var moment=require(_0xab1c('0x1'));var winston=require(_0xab1c('0x2'));var config=require(_0xab1c('0x3'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xab1c('0x4')]():_0xab1c('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xab1c('0x6'),'error':_0xab1c('0x7'),'warn':_0xab1c('0x8'),'info':_0xab1c('0x9'),'print':'bold\x20white','success':_0xab1c('0xa'),'http':_0xab1c('0xb'),'verbose':_0xab1c('0xc'),'debug':_0xab1c('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x2d80fd,_0x5f1164,_0x5d98b5){var _0x1fa083=_0x2d80fd||_0xab1c('0xe');return path[_0xab1c('0xf')](_0x1fa083,util[_0xab1c('0x10')](_0xab1c('0x11'),_0x5f1164,_0x5d98b5));}function formatter(_0xb51bc3,_0x226d85){_0x226d85[_0xab1c('0x12')]=_0x226d85[_0xab1c('0x12')][_0xab1c('0x13')](/@@{/g,_0xab1c('0x14'))[_0xab1c('0x13')](/}@@/g,_0xab1c('0x15'))['replace'](/@{/g,'{{')[_0xab1c('0x13')](/}@/g,'}}');return util[_0xab1c('0x10')](_0xab1c('0x16'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x226d85[_0xab1c('0x17')][_0xab1c('0x18')](),_0xb51bc3,_0x226d85[_0xab1c('0x12')]);}function fileFormat(_0x574b1d,_0x492298){_0x492298[_0xab1c('0x12')]=_0x492298[_0xab1c('0x12')][_0xab1c('0x13')](/@@{/g,'{{{')[_0xab1c('0x13')](/}@@/g,_0xab1c('0x15'))[_0xab1c('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x578ea0=_0x492298[_0xab1c('0x19')]&&Object[_0xab1c('0x1a')](_0x492298[_0xab1c('0x19')])[_0xab1c('0x1b')]?'\x0a\x09'+JSON[_0xab1c('0x1c')](_0x492298['meta']):'';return util[_0xab1c('0x10')](_0xab1c('0x1d'),moment()[_0xab1c('0x10')](_0xab1c('0x1e')),_0x492298['level'][_0xab1c('0x18')](),_0x574b1d,_0x492298[_0xab1c('0x12')],_0x578ea0);}function consoleLogger(){var _0x193179=new winston[(_0xab1c('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x305844){return formatter('',_0x305844);}})]});return _0x193179;}function fileLogger(_0xff9625,_0x5d248b){var _0x41d106=new winston[(_0xab1c('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab1c('0x20'))][(_0xab1c('0x21'))]({'name':util['format']('%s-%s',_0xff9625,_0xab1c('0x22')),'filename':getLogFileName(_0x5d248b,_0xff9625,_0xab1c('0x22')),'level':_0xab1c('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x219596){return fileFormat(_0xff9625,_0x219596);}}),new winston[(_0xab1c('0x20'))][(_0xab1c('0x21'))]({'name':util[_0xab1c('0x10')](_0xab1c('0x23'),_0xff9625,debugLevel),'filename':getLogFileName(_0x5d248b,_0xff9625,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd44259){return fileFormat(_0xff9625,_0xd44259);}}),new winston[(_0xab1c('0x20'))][(_0xab1c('0x24'))]({'level':_0xab1c('0x25'),'json':![],'formatter':function(_0x4ce743){return fileFormat(_0xff9625,_0x4ce743);}})]});return _0x41d106;}exports['consoleLogger']=consoleLogger;exports[_0xab1c('0x26')]=fileLogger; \ No newline at end of file +var _0x336d=['bold\x20white','bold\x20green','gray','bold\x20cyan','addColors','/var/log/xcally','join','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','stringify','YYYY-MM-DD\x20HH:mm:ss','Console','warn','Logger','File','%s-%s','transports','consoleLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white'];(function(_0x1c2051,_0x4cb6b9){var _0x2b58a0=function(_0x4308df){while(--_0x4308df){_0x1c2051['push'](_0x1c2051['shift']());}};_0x2b58a0(++_0x4cb6b9);}(_0x336d,0x99));var _0xd336=function(_0x2230f7,_0x50b22c){_0x2230f7=_0x2230f7-0x0;var _0x46a081=_0x336d[_0x2230f7];return _0x46a081;};'use strict';var path=require(_0xd336('0x0'));var util=require('util');var moment=require(_0xd336('0x1'));var winston=require(_0xd336('0x2'));var config=require(_0xd336('0x3'));var debugLevel=config['debugLevel']?config[_0xd336('0x4')][_0xd336('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xd336('0x6'),'error':'red','warn':'bold\x20yellow','info':'white','print':_0xd336('0x7'),'success':_0xd336('0x8'),'http':_0xd336('0x9'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xd336('0xa')};winston[_0xd336('0xb')](XC_LOG_COLORS);function getLogFileName(_0x26bfb5,_0x4e341d,_0x20d418){var _0x1f17b4=_0x26bfb5||_0xd336('0xc');return path[_0xd336('0xd')](_0x1f17b4,util[_0xd336('0xe')]('%s-%s.log',_0x4e341d,_0x20d418));}function formatter(_0x55c5c0,_0x166a3f){_0x166a3f['message']=_0x166a3f[_0xd336('0xf')]['replace'](/@@{/g,_0xd336('0x10'))[_0xd336('0x11')](/}@@/g,_0xd336('0x12'))['replace'](/@{/g,'{{')[_0xd336('0x11')](/}@/g,'}}');return util[_0xd336('0xe')](_0xd336('0x13'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x166a3f[_0xd336('0x14')][_0xd336('0x15')](),_0x55c5c0,_0x166a3f[_0xd336('0xf')]);}function fileFormat(_0x9e7ef8,_0x431e38){_0x431e38['message']=_0x431e38[_0xd336('0xf')][_0xd336('0x11')](/@@{/g,_0xd336('0x10'))[_0xd336('0x11')](/}@@/g,_0xd336('0x12'))[_0xd336('0x11')](/@{/g,'{{')[_0xd336('0x11')](/}@/g,'}}');var _0x3bbd3e=_0x431e38['meta']&&Object['keys'](_0x431e38[_0xd336('0x16')])['length']?'\x0a\x09'+JSON[_0xd336('0x17')](_0x431e38[_0xd336('0x16')]):'';return util[_0xd336('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd336('0xe')](_0xd336('0x18')),_0x431e38['level'][_0xd336('0x15')](),_0x9e7ef8,_0x431e38[_0xd336('0xf')],_0x3bbd3e);}function consoleLogger(){var _0x227505=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd336('0x19'))]({'level':_0xd336('0x1a'),'json':![],'formatter':function(_0x5b73af){return formatter('',_0x5b73af);}})]});return _0x227505;}function fileLogger(_0x2725d2,_0x40dfba){var _0x5d5027=new winston[(_0xd336('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xd336('0x1c'))]({'name':util[_0xd336('0xe')](_0xd336('0x1d'),_0x2725d2,'error'),'filename':getLogFileName(_0x40dfba,_0x2725d2,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47dd37){return fileFormat(_0x2725d2,_0x47dd37);}}),new winston['transports'][(_0xd336('0x1c'))]({'name':util['format']('%s-%s',_0x2725d2,debugLevel),'filename':getLogFileName(_0x40dfba,_0x2725d2,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d0576){return fileFormat(_0x2725d2,_0x4d0576);}}),new winston[(_0xd336('0x1e'))]['Console']({'level':_0xd336('0x1a'),'json':![],'formatter':function(_0x29260b){return fileFormat(_0x2725d2,_0x29260b);}})]});return _0x5d5027;}exports[_0xd336('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 2118f9c..ccc22a1 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x356bc3,_0x537be8){_0x356bc3=_0x356bc3-0x0;var _0x4d376c=_0x7a54[_0x356bc3];return _0x4d376c;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x0295,0x1f0));var _0x5029=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x0295[_0x1ac120];return _0x19b703;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 40b29db..3f113d1 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x1528dd,_0x4b06ff){var _0x134616=function(_0x7a219){while(--_0x7a219){_0x1528dd['push'](_0x1528dd['shift']());}};_0x134616(++_0x4b06ff);}(_0x9348,0x10d));var _0x8934=function(_0x462b05,_0x2a6a8d){_0x462b05=_0x462b05-0x0;var _0x53d9c6=_0x9348[_0x462b05];return _0x53d9c6;};var _=require(_0x8934('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f716){return _0x23f716==='{{'?_0x8934('0x1'):_0x8934('0x2');}function safeTemplate(_0x46a231){var _0x4a2577=_0x46a231;if(typeof _0x46a231===_0x8934('0x3')){_0x4a2577=_0x46a231[_0x8934('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x46a231)){_0x4a2577=_0x46a231[_0x8934('0x5')](function(_0x923aa3){return safeTemplate(_0x923aa3);});}else if(_[_0x8934('0x6')](_0x46a231)){_0x4a2577=Object[_0x8934('0x7')](_0x46a231)[_0x8934('0x8')](function(_0x3ee9b9,_0x512f30){_0x3ee9b9[_0x512f30]=safeTemplate(_0x46a231[_0x512f30]);return _0x3ee9b9;},{});}return _0x4a2577;}module[_0x8934('0x9')][_0x8934('0xa')]=safeTemplate; \ No newline at end of file +var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x178d08,_0x274c99){var _0x23219b=function(_0x325e95){while(--_0x325e95){_0x178d08['push'](_0x178d08['shift']());}};_0x23219b(++_0x274c99);}(_0x9354,0x96));var _0x4935=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0x9354[_0x119d25];return _0x39cf30;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4fea921..4a7065b 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe53a=['apps','findIndex','env','NODE_PATH','string','then','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','resolve','server/app.json','legacy-libs'];(function(_0x5aba8f,_0x6387b6){var _0x1403ce=function(_0x434b1f){while(--_0x434b1f){_0x5aba8f['push'](_0x5aba8f['shift']());}};_0x1403ce(++_0x6387b6);}(_0xe53a,0xfa));var _0xae53=function(_0x29165d,_0x221063){_0x29165d=_0x29165d-0x0;var _0x3dd8f9=_0xe53a[_0x29165d];return _0x3dd8f9;};var fs=require(_0xae53('0x0'));var path=require(_0xae53('0x1'));var config=require(_0xae53('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0xae53('0x3')](root,_0xae53('0x4'));var NODEPATH=path[_0xae53('0x3')](root,_0xae53('0x5'));function setLegacyLibsNodeEnvPath(_0x18e2f5){let _0x524ff9=![];if(Array['isArray'](_0x18e2f5[_0xae53('0x6')])){var _0x31d39b=_0x18e2f5['apps'][_0xae53('0x7')](function(_0x4eda89){return _0x4eda89['name']==='motion2';});if(_0x31d39b>-0x1){var _0x45e501=_0x18e2f5[_0xae53('0x6')][_0x31d39b];if(typeof _0x45e501[_0xae53('0x8')][_0xae53('0x9')]!==_0xae53('0xa')){_0x45e501[_0xae53('0x8')]['NODE_PATH']=NODEPATH;_0x524ff9=!![];}}return{'appConfig':_0x18e2f5,'updated':_0x524ff9};}}function updateAppConfig(_0x3833d8){return fs['pathExists'](APP_JSON_PATH)[_0xae53('0xb')](function(_0x496b96){if(_0x496b96){return fs['readJSON'](APP_JSON_PATH)[_0xae53('0xb')](function(_0x41ddb1){var _0x522c22=setLegacyLibsNodeEnvPath(_0x41ddb1);if(_0x522c22[_0xae53('0xc')]){_0x3833d8['info'](_0xae53('0xd'));return fs[_0xae53('0xe')](APP_JSON_PATH,_0x41ddb1,{'spaces':0x2});}else{return Promise[_0xae53('0x3')]();}});}else{return Promise[_0xae53('0x3')]();}});}module[_0xae53('0xf')]=updateAppConfig; \ No newline at end of file +var _0x3cc1=['writeJSON','exports','path','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','pathExists','then','info','Updating\x20app.json'];(function(_0xb99735,_0x279535){var _0x5757e6=function(_0x4d8fe8){while(--_0x4d8fe8){_0xb99735['push'](_0xb99735['shift']());}};_0x5757e6(++_0x279535);}(_0x3cc1,0x142));var _0x13cc=function(_0x368c73,_0x2eeebc){_0x368c73=_0x368c73-0x0;var _0x310210=_0x3cc1[_0x368c73];return _0x310210;};var fs=require('fs-extra');var path=require(_0x13cc('0x0'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x13cc('0x1')](root,_0x13cc('0x2'));var NODEPATH=path['resolve'](root,_0x13cc('0x3'));function setLegacyLibsNodeEnvPath(_0x4ab84d){let _0x5d5c5f=![];if(Array[_0x13cc('0x4')](_0x4ab84d[_0x13cc('0x5')])){var _0x274570=_0x4ab84d['apps'][_0x13cc('0x6')](function(_0x1f91df){return _0x1f91df[_0x13cc('0x7')]===_0x13cc('0x8');});if(_0x274570>-0x1){var _0x2031e5=_0x4ab84d[_0x13cc('0x5')][_0x274570];if(typeof _0x2031e5['env'][_0x13cc('0x9')]!=='string'){_0x2031e5['env'][_0x13cc('0x9')]=NODEPATH;_0x5d5c5f=!![];}}return{'appConfig':_0x4ab84d,'updated':_0x5d5c5f};}}function updateAppConfig(_0x3bdc01){return fs[_0x13cc('0xa')](APP_JSON_PATH)[_0x13cc('0xb')](function(_0x5385a9){if(_0x5385a9){return fs['readJSON'](APP_JSON_PATH)[_0x13cc('0xb')](function(_0x4ad4b6){var _0x3d186a=setLegacyLibsNodeEnvPath(_0x4ad4b6);if(_0x3d186a['updated']){_0x3bdc01[_0x13cc('0xc')](_0x13cc('0xd'));return fs[_0x13cc('0xe')](APP_JSON_PATH,_0x4ad4b6,{'spaces':0x2});}else{return Promise[_0x13cc('0x1')]();}});}else{return Promise[_0x13cc('0x1')]();}});}module[_0x13cc('0xf')]=updateAppConfig; \ No newline at end of file